4 * Licensed to CiviCRM under the Academic Free License version 3.0.
6 * Written and contributed by Ideal Solution, LLC (http://www.idealso.com)
13 * @author Marshal Newrock <marshal@idealso.com>
18 * When looking up response codes in the Authorize.Net API, they
19 * begin at one, so always delete one from the "Position in Response"
21 class CRM_Core_Payment_AuthorizeNet
extends CRM_Core_Payment
{
22 const CHARSET
= 'iso-8859-1';
23 const AUTH_APPROVED
= 1;
24 const AUTH_DECLINED
= 2;
26 const TIMEZONE
= 'America/Denver';
28 protected $_mode = NULL;
30 protected $_params = array();
33 * We only need one instance of this object. So we use the singleton
34 * pattern and cache the instance in this variable
38 static private $_singleton = NULL;
44 * The mode of operation: live or test.
46 * @param $paymentProcessor
48 * @return \CRM_Core_Payment_AuthorizeNet
50 public function __construct($mode, &$paymentProcessor) {
52 $this->_paymentProcessor
= $paymentProcessor;
53 $this->_processorName
= ts('Authorize.net');
55 $this->_setParam('apiLogin', $paymentProcessor['user_name']);
56 $this->_setParam('paymentKey', $paymentProcessor['password']);
57 $this->_setParam('paymentType', 'AIM');
58 $this->_setParam('md5Hash', CRM_Utils_Array
::value('signature', $paymentProcessor));
60 $this->_setParam('emailCustomer', 'TRUE');
61 $this->_setParam('timestamp', time());
63 $this->_setParam('sequence', rand(1, 1000));
67 * Should the first payment date be configurable when setting up back office recurring payments.
68 * In the case of Authorize.net this is an option
71 protected function supportsFutureRecurStartDate() {
76 * Can recurring contributions be set against pledges.
78 * In practice all processors that use the baseIPN function to finish transactions or
79 * call the completetransaction api support this by looking up previous contributions in the
80 * series and, if there is a prior contribution against a pledge, and the pledge is not complete,
81 * adding the new payment to the pledge.
83 * However, only enabling for processors it has been tested against.
87 protected function supportsRecurContributionsForPledges() {
92 * Submit a payment using Advanced Integration Method.
94 * @param array $params
95 * Assoc array of input parameters for this transaction.
98 * the result in a nice formatted array (or an error object)
100 public function doDirectPayment(&$params) {
101 if (!defined('CURLOPT_SSLCERT')) {
102 return self
::error(9001, 'Authorize.Net requires curl with SSL support');
106 * recurpayment function does not compile an array & then process it -
107 * - the tpl does the transformation so adding call to hook here
108 * & giving it a change to act on the params array
110 $newParams = $params;
111 if (!empty($params['is_recur']) && !empty($params['contributionRecurID'])) {
112 CRM_Utils_Hook
::alterPaymentProcessorParams($this,
117 foreach ($newParams as $field => $value) {
118 $this->_setParam($field, $value);
121 if (!empty($params['is_recur']) && !empty($params['contributionRecurID'])) {
122 $result = $this->doRecurPayment();
123 if (is_a($result, 'CRM_Core_Error')) {
129 $postFields = array();
130 $authorizeNetFields = $this->_getAuthorizeNetFields();
132 // Set up our call for hook_civicrm_paymentProcessor,
133 // since we now have our parameters as assigned for the AIM back end.
134 CRM_Utils_Hook
::alterPaymentProcessorParams($this,
139 foreach ($authorizeNetFields as $field => $value) {
140 // CRM-7419, since double quote is used as enclosure while doing csv parsing
141 $value = ($field == 'x_description') ?
str_replace('"', "'", $value) : $value;
142 $postFields[] = $field . '=' . urlencode($value);
145 // Authorize.Net will not refuse duplicates, so we should check if the user already submitted this transaction
146 if ($this->checkDupe($authorizeNetFields['x_invoice_num'], CRM_Utils_Array
::value('contributionID', $params))) {
147 return self
::error(9004, 'It appears that this transaction is a duplicate. Have you already submitted the form once? If so there may have been a connection problem. Check your email for a receipt from Authorize.net. If you do not receive a receipt within 2 hours you can try your transaction again. If you continue to have problems please contact the site administrator.');
150 $submit = curl_init($this->_paymentProcessor
['url_site']);
153 return self
::error(9002, 'Could not initiate connection to payment gateway');
156 curl_setopt($submit, CURLOPT_POST
, TRUE);
157 curl_setopt($submit, CURLOPT_RETURNTRANSFER
, TRUE);
158 curl_setopt($submit, CURLOPT_POSTFIELDS
, implode('&', $postFields));
159 curl_setopt($submit, CURLOPT_SSL_VERIFYPEER
, Civi
::settings()->get('verifySSL'));
161 $response = curl_exec($submit);
164 return self
::error(curl_errno($submit), curl_error($submit));
169 $response_fields = $this->explode_csv($response);
171 // check gateway MD5 response
172 if (!$this->checkMD5($response_fields[37], $response_fields[6], $response_fields[9])) {
173 return self
::error(9003, 'MD5 Verification failed');
176 // check for application errors
178 // AVS, CVV2, CAVV, and other verification results
179 if ($response_fields[0] != self
::AUTH_APPROVED
) {
180 $errormsg = $response_fields[2] . ' ' . $response_fields[3];
181 return self
::error($response_fields[1], $errormsg);
186 // test mode always returns trxn_id = 0
187 // also live mode in CiviCRM with test mode set in
188 // Authorize.Net return $response_fields[6] = 0
189 // hence treat that also as test mode transaction
191 if (($this->_mode
== 'test') ||
$response_fields[6] == 0) {
192 $query = "SELECT MAX(trxn_id) FROM civicrm_contribution WHERE trxn_id RLIKE 'test[0-9]+'";
194 $trxn_id = strval(CRM_Core_DAO
::singleValueQuery($query, $p));
195 $trxn_id = str_replace('test', '', $trxn_id);
196 $trxn_id = intval($trxn_id) +
1;
197 $params['trxn_id'] = sprintf('test%08d', $trxn_id);
200 $params['trxn_id'] = $response_fields[6];
202 $params['gross_amount'] = $response_fields[9];
203 // TODO: include authorization code?
209 * Submit an Automated Recurring Billing subscription.
211 public function doRecurPayment() {
212 $template = CRM_Core_Smarty
::singleton();
214 $intervalLength = $this->_getParam('frequency_interval');
215 $intervalUnit = $this->_getParam('frequency_unit');
216 if ($intervalUnit == 'week') {
217 $intervalLength *= 7;
218 $intervalUnit = 'days';
220 elseif ($intervalUnit == 'year') {
221 $intervalLength *= 12;
222 $intervalUnit = 'months';
224 elseif ($intervalUnit == 'day') {
225 $intervalUnit = 'days';
227 elseif ($intervalUnit == 'month') {
228 $intervalUnit = 'months';
231 // interval cannot be less than 7 days or more than 1 year
232 if ($intervalUnit == 'days') {
233 if ($intervalLength < 7) {
234 return self
::error(9001, 'Payment interval must be at least one week');
236 elseif ($intervalLength > 365) {
237 return self
::error(9001, 'Payment interval may not be longer than one year');
240 elseif ($intervalUnit == 'months') {
241 if ($intervalLength < 1) {
242 return self
::error(9001, 'Payment interval must be at least one week');
244 elseif ($intervalLength > 12) {
245 return self
::error(9001, 'Payment interval may not be longer than one year');
249 $template->assign('intervalLength', $intervalLength);
250 $template->assign('intervalUnit', $intervalUnit);
252 $template->assign('apiLogin', $this->_getParam('apiLogin'));
253 $template->assign('paymentKey', $this->_getParam('paymentKey'));
254 $template->assign('refId', substr($this->_getParam('invoiceID'), 0, 20));
256 //for recurring, carry first contribution id
257 $template->assign('invoiceNumber', $this->_getParam('contributionID'));
258 $firstPaymentDate = $this->_getParam('receive_date');
259 if (!empty($firstPaymentDate)) {
260 //allow for post dated payment if set in form
261 $startDate = date_create($firstPaymentDate);
264 $startDate = date_create();
266 /* Format start date in Mountain Time to avoid Authorize.net error E00017
267 * we do this only if the day we are setting our start time to is LESS than the current
268 * day in mountaintime (ie. the server time of the A-net server). A.net won't accept a date
269 * earlier than the current date on it's server so if we are in PST we might need to use mountain
270 * time to bring our date forward. But if we are submitting something future dated we want
271 * the date we entered to be respected
273 $minDate = date_create('now', new DateTimeZone(self
::TIMEZONE
));
274 if (strtotime($startDate->format('Y-m-d')) < strtotime($minDate->format('Y-m-d'))) {
275 $startDate->setTimezone(new DateTimeZone(self
::TIMEZONE
));
278 $template->assign('startDate', $startDate->format('Y-m-d'));
280 $installments = $this->_getParam('installments');
282 // for open ended subscription totalOccurrences has to be 9999
283 $installments = empty($installments) ?
9999 : $installments;
284 $template->assign('totalOccurrences', $installments);
286 $template->assign('amount', $this->_getParam('amount'));
288 $template->assign('cardNumber', $this->_getParam('credit_card_number'));
289 $exp_month = str_pad($this->_getParam('month'), 2, '0', STR_PAD_LEFT
);
290 $exp_year = $this->_getParam('year');
291 $template->assign('expirationDate', $exp_year . '-' . $exp_month);
293 // name rather than description is used in the tpl - see http://www.authorize.net/support/ARB_guide.pdf
294 $template->assign('name', $this->_getParam('description', TRUE));
296 $template->assign('email', $this->_getParam('email'));
297 $template->assign('contactID', $this->_getParam('contactID'));
298 $template->assign('billingFirstName', $this->_getParam('billing_first_name'));
299 $template->assign('billingLastName', $this->_getParam('billing_last_name'));
300 $template->assign('billingAddress', $this->_getParam('street_address', TRUE));
301 $template->assign('billingCity', $this->_getParam('city', TRUE));
302 $template->assign('billingState', $this->_getParam('state_province'));
303 $template->assign('billingZip', $this->_getParam('postal_code', TRUE));
304 $template->assign('billingCountry', $this->_getParam('country'));
306 $arbXML = $template->fetch('CRM/Contribute/Form/Contribution/AuthorizeNetARB.tpl');
307 // submit to authorize.net
309 $submit = curl_init($this->_paymentProcessor
['url_recur']);
311 return self
::error(9002, 'Could not initiate connection to payment gateway');
313 curl_setopt($submit, CURLOPT_RETURNTRANSFER
, 1);
314 curl_setopt($submit, CURLOPT_HTTPHEADER
, array("Content-Type: text/xml"));
315 curl_setopt($submit, CURLOPT_HEADER
, 1);
316 curl_setopt($submit, CURLOPT_POSTFIELDS
, $arbXML);
317 curl_setopt($submit, CURLOPT_POST
, 1);
318 curl_setopt($submit, CURLOPT_SSL_VERIFYPEER
, Civi
::settings()->get('verifySSL'));
320 $response = curl_exec($submit);
323 return self
::error(curl_errno($submit), curl_error($submit));
327 $responseFields = $this->_ParseArbReturn($response);
329 if ($responseFields['resultCode'] == 'Error') {
330 return self
::error($responseFields['code'], $responseFields['text']);
333 // update recur processor_id with subscriptionId
334 CRM_Core_DAO
::setFieldValue('CRM_Contribute_DAO_ContributionRecur', $this->_getParam('contributionRecurID'),
335 'processor_id', $responseFields['subscriptionId']
337 //only impact of assigning this here is is can be used to cancel the subscription in an automated test
338 // if it isn't cancelled a duplicate transaction error occurs
339 if (!empty($responseFields['subscriptionId'])) {
340 $this->_setParam('subscriptionId', $responseFields['subscriptionId']);
347 public function _getAuthorizeNetFields() {
348 $amount = $this->_getParam('total_amount');//Total amount is from the form contribution field
349 if (empty($amount)) {//CRM-9894 would this ever be the case??
350 $amount = $this->_getParam('amount');
353 $fields['x_login'] = $this->_getParam('apiLogin');
354 $fields['x_tran_key'] = $this->_getParam('paymentKey');
355 $fields['x_email_customer'] = $this->_getParam('emailCustomer');
356 $fields['x_first_name'] = $this->_getParam('billing_first_name');
357 $fields['x_last_name'] = $this->_getParam('billing_last_name');
358 $fields['x_address'] = $this->_getParam('street_address');
359 $fields['x_city'] = $this->_getParam('city');
360 $fields['x_state'] = $this->_getParam('state_province');
361 $fields['x_zip'] = $this->_getParam('postal_code');
362 $fields['x_country'] = $this->_getParam('country');
363 $fields['x_customer_ip'] = $this->_getParam('ip_address');
364 $fields['x_email'] = $this->_getParam('email');
365 $fields['x_invoice_num'] = substr($this->_getParam('invoiceID'), 0, 20);
366 $fields['x_amount'] = $amount;
367 $fields['x_currency_code'] = $this->_getParam('currencyID');
368 $fields['x_description'] = $this->_getParam('description');
369 $fields['x_cust_id'] = $this->_getParam('contactID');
370 if ($this->_getParam('paymentType') == 'AIM') {
371 $fields['x_relay_response'] = 'FALSE';
372 // request response in CSV format
373 $fields['x_delim_data'] = 'TRUE';
374 $fields['x_delim_char'] = ',';
375 $fields['x_encap_char'] = '"';
377 $fields['x_card_num'] = $this->_getParam('credit_card_number');
378 $fields['x_card_code'] = $this->_getParam('cvv2');
379 $exp_month = str_pad($this->_getParam('month'), 2, '0', STR_PAD_LEFT
);
380 $exp_year = $this->_getParam('year');
381 $fields['x_exp_date'] = "$exp_month/$exp_year";
384 if ($this->_mode
!= 'live') {
385 $fields['x_test_request'] = 'TRUE';
395 * @param string $data
398 * the HMAC_MD5 encoding string
400 public function hmac($key, $data) {
401 if (function_exists('mhash')) {
402 // Use PHP mhash extension
403 return (bin2hex(mhash(MHASH_MD5
, $data, $key)));
406 // RFC 2104 HMAC implementation for php.
407 // Creates an md5 HMAC.
408 // Eliminates the need to install mhash to compute a HMAC
409 // Hacked by Lance Rushing
410 // byte length for md5
412 if (strlen($key) > $b) {
413 $key = pack("H*", md5($key));
415 $key = str_pad($key, $b, chr(0x00));
416 $ipad = str_pad('', $b, chr(0x36));
417 $opad = str_pad('', $b, chr(0x5c));
418 $k_ipad = $key ^
$ipad;
419 $k_opad = $key ^
$opad;
420 return md5($k_opad . pack("H*", md5($k_ipad . $data)));
425 * Check the gateway MD5 response to make sure that this is a proper
428 * @param string $responseMD5
429 * MD5 hash generated by the gateway.
430 * @param string $transaction_id
431 * Transaction id generated by the gateway.
432 * @param string $amount
439 public function checkMD5($responseMD5, $transaction_id, $amount, $ipn = FALSE) {
440 // cannot check if no MD5 hash
441 $md5Hash = $this->_getParam('md5Hash');
442 if (empty($md5Hash)) {
445 $loginid = $this->_getParam('apiLogin');
446 $hashString = $ipn ?
($md5Hash . $transaction_id . $amount) : ($md5Hash . $loginid . $transaction_id . $amount);
447 $result = strtoupper(md5($hashString));
449 if ($result == $responseMD5) {
458 * Calculate and return the transaction fingerprint.
463 public function CalculateFP() {
464 $x_tran_key = $this->_getParam('paymentKey');
465 $loginid = $this->_getParam('apiLogin');
466 $sequence = $this->_getParam('sequence');
467 $timestamp = $this->_getParam('timestamp');
468 $amount = $this->_getParam('amount');
469 $currency = $this->_getParam('currencyID');
470 $transaction = "$loginid^$sequence^$timestamp^$amount^$currency";
471 return $this->hmac($x_tran_key, $transaction);
475 * Split a CSV file. Requires , as delimiter and " as enclosure.
476 * Based off notes from http://php.net/fgetcsv
478 * @param string $data
484 public function explode_csv($data) {
486 //make it easier to parse fields with quotes in them
487 $data = str_replace('""', "''", $data);
490 while ($data != '') {
492 if ($data[0] == '"') {
493 // handle quoted fields
494 preg_match('/^"(([^"]|\\")*?)",?(.*)$/', $data, $matches);
496 $fields[] = str_replace("''", '"', $matches[1]);
500 preg_match('/^([^,]*),?(.*)$/', $data, $matches);
502 $fields[] = $matches[1];
510 * Extract variables from returned XML.
512 * Function is from Authorize.Net sample code, and used
513 * to prevent the requirement of XML functions.
515 * @param string $content
516 * XML reply from Authorize.Net.
519 * refId, resultCode, code, text, subscriptionId
521 public function _parseArbReturn($content) {
522 $refId = $this->_substring_between($content, '<refId>', '</refId>');
523 $resultCode = $this->_substring_between($content, '<resultCode>', '</resultCode>');
524 $code = $this->_substring_between($content, '<code>', '</code>');
525 $text = $this->_substring_between($content, '<text>', '</text>');
526 $subscriptionId = $this->_substring_between($content, '<subscriptionId>', '</subscriptionId>');
529 'resultCode' => $resultCode,
532 'subscriptionId' => $subscriptionId,
537 * Helper function for _parseArbReturn.
539 * Function is from Authorize.Net sample code, and used to avoid using
542 * @param string $haystack
543 * @param string $start
546 * @return bool|string
548 public function _substring_between(&$haystack, $start, $end) {
549 if (strpos($haystack, $start) === FALSE ||
strpos($haystack, $end) === FALSE) {
553 $start_position = strpos($haystack, $start) +
strlen($start);
554 $end_position = strpos($haystack, $end);
555 return substr($haystack, $start_position, $end_position - $start_position);
560 * Get the value of a field if set.
562 * @param string $field
565 * @param bool $xmlSafe
567 * value of the field, or empty string if the field is
570 public function _getParam($field, $xmlSafe = FALSE) {
571 $value = CRM_Utils_Array
::value($field, $this->_params
, '');
573 $value = str_replace(array('&', '"', "'", '<', '>'), '', $value);
579 * @param null $errorCode
580 * @param null $errorMessage
584 public function &error($errorCode = NULL, $errorMessage = NULL) {
585 $e = CRM_Core_Error
::singleton();
587 $e->push($errorCode, 0, array(), $errorMessage);
590 $e->push(9001, 0, array(), 'Unknown System Error.');
596 * Set a field to the specified value. Value must be a scalar (int,
597 * float, string, or boolean)
599 * @param string $field
600 * @param mixed $value
603 * false if value is not a scalar, true if successful
605 public function _setParam($field, $value) {
606 if (!is_scalar($value)) {
610 $this->_params
[$field] = $value;
615 * This function checks to see if we have the right config values.
618 * the error message if any
620 public function checkConfig() {
622 if (empty($this->_paymentProcessor
['user_name'])) {
623 $error[] = ts('APILogin is not set for this payment processor');
626 if (empty($this->_paymentProcessor
['password'])) {
627 $error[] = ts('Key is not set for this payment processor');
630 if (!empty($error)) {
631 return implode('<p>', $error);
641 public function accountLoginURL() {
642 return ($this->_mode
== 'test') ?
'https://test.authorize.net' : 'https://authorize.net';
646 * @param string $message
647 * @param array $params
649 * @return bool|object
651 public function cancelSubscription(&$message = '', $params = array()) {
652 $template = CRM_Core_Smarty
::singleton();
654 $template->assign('subscriptionType', 'cancel');
656 $template->assign('apiLogin', $this->_getParam('apiLogin'));
657 $template->assign('paymentKey', $this->_getParam('paymentKey'));
658 $template->assign('subscriptionId', CRM_Utils_Array
::value('subscriptionId', $params));
660 $arbXML = $template->fetch('CRM/Contribute/Form/Contribution/AuthorizeNetARB.tpl');
662 // submit to authorize.net
663 $submit = curl_init($this->_paymentProcessor
['url_recur']);
665 return self
::error(9002, 'Could not initiate connection to payment gateway');
668 curl_setopt($submit, CURLOPT_RETURNTRANSFER
, 1);
669 curl_setopt($submit, CURLOPT_HTTPHEADER
, array("Content-Type: text/xml"));
670 curl_setopt($submit, CURLOPT_HEADER
, 1);
671 curl_setopt($submit, CURLOPT_POSTFIELDS
, $arbXML);
672 curl_setopt($submit, CURLOPT_POST
, 1);
673 curl_setopt($submit, CURLOPT_SSL_VERIFYPEER
, Civi
::settings()->get('verifySSL'));
675 $response = curl_exec($submit);
678 return self
::error(curl_errno($submit), curl_error($submit));
683 $responseFields = $this->_ParseArbReturn($response);
684 $message = "{$responseFields['code']}: {$responseFields['text']}";
686 if ($responseFields['resultCode'] == 'Error') {
687 return self
::error($responseFields['code'], $responseFields['text']);
693 * @param string $message
694 * @param array $params
696 * @return bool|object
698 public function updateSubscriptionBillingInfo(&$message = '', $params = array()) {
699 $template = CRM_Core_Smarty
::singleton();
700 $template->assign('subscriptionType', 'updateBilling');
702 $template->assign('apiLogin', $this->_getParam('apiLogin'));
703 $template->assign('paymentKey', $this->_getParam('paymentKey'));
704 $template->assign('subscriptionId', $params['subscriptionId']);
706 $template->assign('cardNumber', $params['credit_card_number']);
707 $exp_month = str_pad($params['month'], 2, '0', STR_PAD_LEFT
);
708 $exp_year = $params['year'];
709 $template->assign('expirationDate', $exp_year . '-' . $exp_month);
711 $template->assign('billingFirstName', $params['first_name']);
712 $template->assign('billingLastName', $params['last_name']);
713 $template->assign('billingAddress', $params['street_address']);
714 $template->assign('billingCity', $params['city']);
715 $template->assign('billingState', $params['state_province']);
716 $template->assign('billingZip', $params['postal_code']);
717 $template->assign('billingCountry', $params['country']);
719 $arbXML = $template->fetch('CRM/Contribute/Form/Contribution/AuthorizeNetARB.tpl');
721 // submit to authorize.net
722 $submit = curl_init($this->_paymentProcessor
['url_recur']);
724 return self
::error(9002, 'Could not initiate connection to payment gateway');
727 curl_setopt($submit, CURLOPT_RETURNTRANSFER
, 1);
728 curl_setopt($submit, CURLOPT_HTTPHEADER
, array("Content-Type: text/xml"));
729 curl_setopt($submit, CURLOPT_HEADER
, 1);
730 curl_setopt($submit, CURLOPT_POSTFIELDS
, $arbXML);
731 curl_setopt($submit, CURLOPT_POST
, 1);
732 curl_setopt($submit, CURLOPT_SSL_VERIFYPEER
, Civi
::settings()->get('verifySSL'));
734 $response = curl_exec($submit);
737 return self
::error(curl_errno($submit), curl_error($submit));
742 $responseFields = $this->_ParseArbReturn($response);
743 $message = "{$responseFields['code']}: {$responseFields['text']}";
745 if ($responseFields['resultCode'] == 'Error') {
746 return self
::error($responseFields['code'], $responseFields['text']);
752 * Process incoming notification.
754 static public function handlePaymentNotification() {
755 $ipnClass = new CRM_Core_Payment_AuthorizeNetIPN(array_merge($_GET, $_REQUEST));
760 * @param string $message
761 * @param array $params
763 * @return bool|object
765 public function changeSubscriptionAmount(&$message = '', $params = array()) {
766 $template = CRM_Core_Smarty
::singleton();
768 $template->assign('subscriptionType', 'update');
770 $template->assign('apiLogin', $this->_getParam('apiLogin'));
771 $template->assign('paymentKey', $this->_getParam('paymentKey'));
773 $template->assign('subscriptionId', $params['subscriptionId']);
775 // for open ended subscription totalOccurrences has to be 9999
776 $installments = empty($params['installments']) ?
9999 : $params['installments'];
777 $template->assign('totalOccurrences', $installments);
779 $template->assign('amount', $params['amount']);
781 $arbXML = $template->fetch('CRM/Contribute/Form/Contribution/AuthorizeNetARB.tpl');
783 // submit to authorize.net
784 $submit = curl_init($this->_paymentProcessor
['url_recur']);
786 return self
::error(9002, 'Could not initiate connection to payment gateway');
789 curl_setopt($submit, CURLOPT_RETURNTRANSFER
, 1);
790 curl_setopt($submit, CURLOPT_HTTPHEADER
, array("Content-Type: text/xml"));
791 curl_setopt($submit, CURLOPT_HEADER
, 1);
792 curl_setopt($submit, CURLOPT_POSTFIELDS
, $arbXML);
793 curl_setopt($submit, CURLOPT_POST
, 1);
794 curl_setopt($submit, CURLOPT_SSL_VERIFYPEER
, Civi
::settings()->get('verifySSL'));
796 $response = curl_exec($submit);
799 return self
::error(curl_errno($submit), curl_error($submit));
804 $responseFields = $this->_ParseArbReturn($response);
805 $message = "{$responseFields['code']}: {$responseFields['text']}";
807 if ($responseFields['resultCode'] == 'Error') {
808 return self
::error($responseFields['code'], $responseFields['text']);