You are here

function mollie_payment_get_api_key in Mollie Payment 7.2

Same name and namespace in other branches
  1. 7 mollie_payment.module \mollie_payment_get_api_key()

Get Mollie API key from payment.

1 call to mollie_payment_get_api_key()
mollie_payment_get_client in ./mollie_payment.module
Initialize Mollie API client.

File

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

Code

function mollie_payment_get_api_key(Payment $payment = NULL) {
  if (!is_null($payment)) {
    $data = $payment->method->controller_data;
    if ($data['test_mode']) {
      return isset($data['mollie_test_api_key']) ? $data['mollie_test_api_key'] : variable_get('mollie_payment_default_api_key_test', '');
    }
    return isset($data['mollie_api_key']) ? $data['mollie_api_key'] : variable_get('mollie_payment_default_api_key_live', '');
  }
  return variable_get('mollie_payment_default_api_key_live', '');
}