You are here

function _uc_authorizenet_cim_profile_create_request in Ubercart 8.4

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

Helper to create the CIM profile creation request.

1 call to _uc_authorizenet_cim_profile_create_request()
_uc_authorizenet_cim_profile_create in payment/uc_authorizenet/uc_authorizenet.module
Creates a CIM profile using an order's data.

File

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

Code

function _uc_authorizenet_cim_profile_create_request(OrderInterface $order) {
  return [
    'refId' => substr($order
      ->id() . '-' . \Drupal::time()
      ->getRequestTime(), 0, 20),
    'profile' => [
      'merchantCustomerId' => substr($order
        ->getOwnerId(), 0, 20),
      'description' => substr(t('Order @order taking place at @date', [
        '@order' => $order
          ->id(),
        '@date' => \Drupal::service('date.formatter')
          ->format(\Drupal::time()
          ->getRequestTime()),
      ]), 0, 255),
      'email' => substr($order
        ->getEmail(), 0, 255),
      'paymentProfiles' => [
        'billTo' => _uc_authorize_cim_xml_billto($order),
        'payment' => [
          'creditCard' => [
            'cardNumber' => $order->payment_details['cc_number'],
            'expirationDate' => $order->payment_details['cc_exp_year'] . '-' . str_pad($order->payment_details['cc_exp_month'], 2, '0', STR_PAD_LEFT),
          ],
        ],
      ],
      'shipToList' => _uc_authorize_cim_xml_shipto($order),
    ],
  ];
}