You are here

function _uc_cybersource_soap_login_data in Ubercart 7.3

Same name and namespace in other branches
  1. 5 payment/uc_cybersource/uc_cybersource.module \_uc_cybersource_soap_login_data()
  2. 6.2 payment/uc_cybersource/uc_cybersource.module \_uc_cybersource_soap_login_data()

Returns an array with the SOAP Merchant ID and Transaction key.

4 calls to _uc_cybersource_soap_login_data()
CyberSourceSoapClient::__doRequest in payment/uc_cybersource/uc_cybersource.soap.inc
Inserts the UsernameToken information in the outgoing request.
uc_cybersource_settings_form in payment/uc_cybersource/uc_cybersource.module
Adds the CyberSource fields to the payment gateway settings form.
uc_cybersource_uc_calculate_tax in payment/uc_cybersource/uc_cybersource.module
Implements hook_uc_calculate_tax().
_uc_cybersource_soap_charge in payment/uc_cybersource/uc_cybersource.module
Handles the SOAP charge request and Ubercart order save.

File

payment/uc_cybersource/uc_cybersource.module, line 1268
A module used for CyberSource's Silent Order POST and Hosted Order Page methods of payment.

Code

function _uc_cybersource_soap_login_data() {
  static $data;
  if (!empty($data)) {
    return $data;
  }
  $merchant_id = variable_get('uc_cybersource_soap_merchant_id', '');
  $transaction_key = variable_get('uc_cybersource_soap_transaction_key', '');

  // If CC encryption has been configured properly.
  if ($key = uc_credit_encryption_key()) {

    // Setup our encryption object.
    $crypt = new UbercartEncryption();

    // Decrypt the Merchant ID and Transaction key.
    if (!empty($merchant_id)) {
      $merchant_id = $crypt
        ->decrypt($key, $merchant_id);
    }
    if (!empty($transaction_key)) {
      $transaction_key = $crypt
        ->decrypt($key, $transaction_key);
    }

    // Store any errors.
    uc_store_encryption_errors($crypt, 'uc_cybersource');
  }
  $data = array(
    'merchant_id' => $merchant_id,
    'transaction_key' => $transaction_key,
  );
  return $data;
}