function uc_authorizenet_xml_api in Ubercart 5
Same name and namespace in other branches
- 6.2 payment/uc_authorizenet/uc_authorizenet.module \uc_authorizenet_xml_api()
- 7.3 payment/uc_authorizenet/uc_authorizenet.module \uc_authorizenet_xml_api()
Sends an XML API Request to Authorize.Net.
Parameters
$server: The name of the server to send a request to - 'production' or 'developer'.
$xml: The XML to send to Authorize.Net.
$callback: The name of the function that should process the response.
Return value
TRUE or FALSE indicating the success of the API request.
7 calls to uc_authorizenet_xml_api()
- uc_authorizenet_arb_cancel in payment/
uc_authorizenet/ uc_authorizenet.module - Cancels an ARB subscription.
- uc_authorizenet_arb_create in payment/
uc_authorizenet/ uc_authorizenet.module - Sends an ARB Create request via the XML API.
- uc_authorizenet_arb_update in payment/
uc_authorizenet/ uc_authorizenet.module - Updates an ARB subscription; for simplicity's sake, payment schedule information cannot be updated at this time.
- _uc_authorizenet_cim_payment_profile_get in payment/
uc_authorizenet/ uc_authorizenet.module - Get a CIM payment profile stored at auth.net.
- _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 726 - Process payments using Authorize.net. Supports AIM and ARB.
Code
function uc_authorizenet_xml_api($server, $xml) {
// Check for cURL support.
if (!_uc_authorizenet_curl_check()) {
return FALSE;
}
if ($server == 'production') {
$post_url = 'https://api.authorize.net/xml/v1/request.api';
}
elseif ($server == 'developer') {
$post_url = 'https://apitest.authorize.net/xml/v1/request.api';
}
else {
return FALSE;
}
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $post_url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
"Content-Type: text/xml",
));
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $xml);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
$response = curl_exec($ch);
// Log any errors to the watchdog.
if ($error = curl_error($ch)) {
watchdog('uc_authorizenet', t('cURL error: @error', array(
'@error' => $error,
)), WATCHDOG_ERROR);
return FALSE;
}
curl_close($ch);
return $response;
}