You are here

function _uc_authorizenet_cim_profile_charge_request in Ubercart 8.4

Same name and namespace in other branches
  1. 5 payment/uc_authorizenet/uc_authorizenet.module \_uc_authorizenet_cim_profile_charge_request()
  2. 6.2 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
Uses a reference to charge to a CIM profile.

File

payment/uc_authorizenet/uc_authorizenet.module, line 141
Processes payments using Authorize.net. Supports AIM and ARB.

Code

function _uc_authorizenet_cim_profile_charge_request(OrderInterface $order, $amount, $data) {
  $profile = _uc_authorizenet_cim_profile_get($order, $data['ref_id']);
  if ($profile['resultCode'] == 'Error') {
    return $profile;
  }
  else {
    return [
      'refId' => substr($order
        ->id() . '-' . \Drupal::time()
        ->getRequestTime(), 0, 20),
      'transaction' => [
        'profileTransAuthCapture' => [
          'amount' => uc_currency_format($amount, FALSE, FALSE, '.'),
          'customerProfileId' => $profile['customerProfileId'],
          'customerPaymentProfileId' => $profile['customerPaymentProfileId'],
          'customerShippingAddressId' => $profile['customerAddressId'],
          'order' => [
            'invoiceNumber' => $order
              ->id(),
          ],
        ],
      ],
    ];
  }
}