function uc_authorizenet_xml_api in Ubercart 7.3
Same name and namespace in other branches
- 5 payment/uc_authorizenet/uc_authorizenet.module \uc_authorizenet_xml_api()
- 6.2 payment/uc_authorizenet/uc_authorizenet.module \uc_authorizenet_xml_api()
Sends an XML API Request to Authorize.Net.
Parameters
string $server: The name of the server to send a request to - 'production' or 'developer'.
string $xml: The XML to send to Authorize.Net.
$callback: The name of the function that should process the response.
Return value
bool TRUE or FALSE indicating the success of the API request.
5 calls to uc_authorizenet_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 - Gets a CIM payment profile stored at auth.net.
- _uc_authorizenet_cim_profile_charge in payment/
uc_authorizenet/ uc_authorizenet.module - Uses a reference to charge to a CIM profile.
- _uc_authorizenet_cim_profile_create in payment/
uc_authorizenet/ uc_authorizenet.module - Creates a CIM profile using an order's data.
- _uc_authorizenet_cim_profile_get in payment/
uc_authorizenet/ uc_authorizenet.module - Gets a CIM profile stored at Authorize.Net.
File
- payment/
uc_authorizenet/ uc_authorizenet.module, line 611 - Processes payments using Authorize.net. Supports AIM and ARB.
Code
function uc_authorizenet_xml_api($server, $xml) {
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, 1);
$response = curl_exec($ch);
// Log any errors to the watchdog.
if ($error = curl_error($ch)) {
watchdog('uc_authorizenet', 'cURL error: @error', array(
'@error' => $error,
), WATCHDOG_ERROR);
return FALSE;
}
curl_close($ch);
return $response;
}