You are here

function mollie_payment_get_client in Mollie Payment 7

Same name and namespace in other branches
  1. 7.2 mollie_payment.module \mollie_payment_get_client()

Initialize Mollie API client.

7 calls to mollie_payment_get_client()
MolliePaymentMethodController::execute in includes/mollie_payment.class.inc
Implements PaymentMethodController::execute().
mollie_payment_configuration in ./mollie_payment.module
Payment method configuration form elements callback.
mollie_payment_listener in ./mollie_payment.module
Listener callback.
mollie_payment_payment_recurring_can_stop in ./mollie_payment.module
Implements hook_payment_recurring_can_OPERATION() for stop.
mollie_payment_payment_recurring_stop in ./mollie_payment.module
Implements hook_payment_recurring_OPERATION() for stop.

... See full list

File

./mollie_payment.module, line 560
Provides Mollie integration for the Payment platform.

Code

function mollie_payment_get_client(Payment $payment) {
  $api_key = mollie_payment_get_api_key($payment);
  try {
    libraries_load('mollie_api');
    $client = new Mollie_API_Client();
    $client
      ->setApiKey($api_key);

    // Register major version of Drupal.
    $client
      ->addVersionString('Drupal/7.x');

    // Register minor version of Drupal.
    $client
      ->addVersionString('Drupal/' . VERSION);
    return $client;
  } catch (Exception $e) {
    drupal_set_message($e
      ->getMessage(), 'error');
    return FALSE;
  }
}