You are here

function _uc_authorizenet_cim_profile_charge_request in Ubercart 6.2

Same name and namespace in other branches
  1. 8.4 payment/uc_authorizenet/uc_authorizenet.module \_uc_authorizenet_cim_profile_charge_request()
  2. 5 payment/uc_authorizenet/uc_authorizenet.module \_uc_authorizenet_cim_profile_charge_request()
  3. 7.3 payment/uc_authorizenet/uc_authorizenet.module \_uc_authorizenet_cim_profile_charge_request()

Helper for building the request for a CIM profile charge.

1 call to _uc_authorizenet_cim_profile_charge_request()
_uc_authorizenet_cim_profile_charge in payment/uc_authorizenet/uc_authorizenet.module
Use a reference to charge to a CIM profile.

File

payment/uc_authorizenet/uc_authorizenet.module, line 388
Process payments using Authorize.net. Supports AIM and ARB.

Code

function _uc_authorizenet_cim_profile_charge_request($order, $amount, $data) {
  $profile = _uc_authorizenet_cim_profile_get($order, $data['ref_id']);
  if ($profile['resultCode'] == 'Error') {
    return $profile;
  }
  else {
    return array(
      'refId' => substr($order->order_id . '-' . time(), 0, 20),
      'transaction' => array(
        'profileTransAuthCapture' => array(
          'amount' => _uc_authorizenet_format_amount($amount),
          'customerProfileId' => $profile['customerProfileId'],
          'customerPaymentProfileId' => $profile['customerPaymentProfileId'],
          'customerShippingAddressId' => !empty($profile['customerAddressId']) ? $profile['customerAddressId'] : '0',
          'order' => array(
            'invoiceNumber' => $order->order_id,
          ),
        ),
      ),
    );
  }
}