function _uc_authorizenet_cim_profile_create in Ubercart 8.4
Same name and namespace in other branches
- 5 payment/uc_authorizenet/uc_authorizenet.module \_uc_authorizenet_cim_profile_create()
- 6.2 payment/uc_authorizenet/uc_authorizenet.module \_uc_authorizenet_cim_profile_create()
- 7.3 payment/uc_authorizenet/uc_authorizenet.module \_uc_authorizenet_cim_profile_create()
Creates a CIM profile using an order's data.
2 calls to _uc_authorizenet_cim_profile_create()
- AuthorizeNet::chargeCard in payment/
uc_authorizenet/ src/ Plugin/ Ubercart/ PaymentMethod/ AuthorizeNet.php - Called when a credit card should be processed.
- AuthorizeNet::_uc_authorizenet_charge in payment/
uc_authorizenet/ src/ Plugin/ Ubercart/ PaymentMethod/ AuthorizeNet.php - Handles authorizations and captures through AIM at Authorize.Net.
File
- payment/
uc_authorizenet/ uc_authorizenet.module, line 37 - Processes payments using Authorize.net. Supports AIM and ARB.
Code
function _uc_authorizenet_cim_profile_create(OrderInterface $order) {
$server = variable_get('uc_authnet_cim_mode', 'disabled');
// Help build the request.
$request = _uc_authorizenet_cim_profile_create_request($order);
// Request a profile from auth.net.
$xml = _uc_authorizenet_xml_api_wrapper('createCustomerProfileRequest', _uc_authorizenet_array_to_xml($request));
// Parse the response.
$response = _uc_authorizenet_cim_parse_response(uc_authorizenet_xml_api($server, $xml));
if ($response['resultCode'] == 'Error') {
uc_order_comment_save($order
->id(), 0, t('Authorize.Net: Creating CIM profile failed.<br />@error - @text', [
'@error' => $response['code'],
'@text' => $response['text'],
]), 'admin');
return $response['text'];
}
else {
uc_order_comment_save($order
->id(), 0, t('Authorize.Net: CIM profile created - @id', [
'@id' => $response['customerProfileId'],
]));
}
// Save the new credit reference to the db.
$order->data = uc_credit_log_reference($order
->id(), $response['customerProfileId'], $order->payment_details['cc_number']);
return '';
}