function _uc_authorizenet_cim_profile_create in Ubercart 5
Same name and namespace in other branches
- 8.4 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()
Create a CIM profile using an order's data.
2 calls to _uc_authorizenet_cim_profile_create()
- uc_authorizenet_charge in payment/
uc_authorizenet/ uc_authorizenet.module - _uc_authorizenet_charge in payment/
uc_authorizenet/ uc_authorizenet.module - Handles authorizations and captures through AIM at Authorize.Net
File
- payment/
uc_authorizenet/ uc_authorizenet.module, line 266 - Process payments using Authorize.net. Supports AIM and ARB.
Code
function _uc_authorizenet_cim_profile_create($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->order_id, 0, t('Authorize.Net: Creating CIM profile failed.<br />@error - @text', array(
'@error' => $response['code'],
'@text' => $response['text'],
)), 'admin');
return $response['text'];
}
else {
uc_order_comment_save($order->order_id, 0, t('Authorize.Net: CIM profile created - @id', array(
'@id' => $response['customerProfileId'],
)));
}
// Save the new credit reference to the db.
$order->data = uc_credit_log_reference($order->order_id, $response['customerProfileId'], $order->payment_details['cc_number']);
return '';
}