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>
16 use Civi\Payment\Exception\PaymentProcessorException
;
20 * When looking up response codes in the Authorize.Net API, they
21 * begin at one, so always delete one from the "Position in Response"
23 class CRM_Core_Payment_AuthorizeNet
extends CRM_Core_Payment
{
24 const CHARSET
= 'iso-8859-1';
25 const AUTH_APPROVED
= 1;
26 const AUTH_DECLINED
= 2;
28 const AUTH_REVIEW
= 4;
29 const TIMEZONE
= 'America/Denver';
31 protected $_mode = NULL;
33 protected $_params = [];
36 * @var GuzzleHttp\Client
38 protected $guzzleClient;
41 * @return \GuzzleHttp\Client
43 public function getGuzzleClient(): \GuzzleHttp\Client
{
44 return $this->guzzleClient ??
new \GuzzleHttp\
Client();
48 * @param \GuzzleHttp\Client $guzzleClient
50 public function setGuzzleClient(\GuzzleHttp\Client
$guzzleClient) {
51 $this->guzzleClient
= $guzzleClient;
58 * The mode of operation: live or test.
60 * @param $paymentProcessor
62 * @return \CRM_Core_Payment_AuthorizeNet
64 public function __construct($mode, &$paymentProcessor) {
66 $this->_paymentProcessor
= $paymentProcessor;
68 $this->_setParam('apiLogin', $paymentProcessor['user_name']);
69 $this->_setParam('paymentKey', $paymentProcessor['password']);
70 $this->_setParam('paymentType', 'AIM');
71 $this->_setParam('md5Hash', CRM_Utils_Array
::value('signature', $paymentProcessor));
73 $this->_setParam('timestamp', time());
75 $this->_setParam('sequence', rand(1, 1000));
79 * Should the first payment date be configurable when setting up back office recurring payments.
80 * In the case of Authorize.net this is an option
83 protected function supportsFutureRecurStartDate() {
88 * Can recurring contributions be set against pledges.
90 * In practice all processors that use the baseIPN function to finish transactions or
91 * call the completetransaction api support this by looking up previous contributions in the
92 * series and, if there is a prior contribution against a pledge, and the pledge is not complete,
93 * adding the new payment to the pledge.
95 * However, only enabling for processors it has been tested against.
99 protected function supportsRecurContributionsForPledges() {
104 * Submit a payment using Advanced Integration Method.
106 * @param array $params
107 * Assoc array of input parameters for this transaction.
110 * the result in a nice formatted array (or an error object)
112 * @throws \Civi\Payment\Exception\PaymentProcessorException
114 public function doDirectPayment(&$params) {
115 if (!defined('CURLOPT_SSLCERT')) {
116 return self
::error(9001, 'Authorize.Net requires curl with SSL support');
120 * recurpayment function does not compile an array & then process it -
121 * - the tpl does the transformation so adding call to hook here
122 * & giving it a change to act on the params array
124 $newParams = $params;
125 if (!empty($params['is_recur']) && !empty($params['contributionRecurID'])) {
126 CRM_Utils_Hook
::alterPaymentProcessorParams($this,
131 foreach ($newParams as $field => $value) {
132 $this->_setParam($field, $value);
135 if (!empty($params['is_recur']) && !empty($params['contributionRecurID'])) {
136 $result = $this->doRecurPayment();
137 if (is_a($result, 'CRM_Core_Error')) {
144 $authorizeNetFields = $this->_getAuthorizeNetFields();
146 // Set up our call for hook_civicrm_paymentProcessor,
147 // since we now have our parameters as assigned for the AIM back end.
148 CRM_Utils_Hook
::alterPaymentProcessorParams($this,
153 foreach ($authorizeNetFields as $field => $value) {
154 // CRM-7419, since double quote is used as enclosure while doing csv parsing
155 $value = ($field == 'x_description') ?
str_replace('"', "'", $value) : $value;
156 $postFields[] = $field . '=' . urlencode($value);
159 // Authorize.Net will not refuse duplicates, so we should check if the user already submitted this transaction
160 if ($this->checkDupe($authorizeNetFields['x_invoice_num'], CRM_Utils_Array
::value('contributionID', $params))) {
161 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.');
164 $submit = curl_init($this->_paymentProcessor
['url_site']);
167 return self
::error(9002, 'Could not initiate connection to payment gateway');
170 curl_setopt($submit, CURLOPT_POST
, TRUE);
171 curl_setopt($submit, CURLOPT_RETURNTRANSFER
, TRUE);
172 curl_setopt($submit, CURLOPT_POSTFIELDS
, implode('&', $postFields));
173 curl_setopt($submit, CURLOPT_SSL_VERIFYPEER
, Civi
::settings()->get('verifySSL'));
175 $response = curl_exec($submit);
178 return self
::error(curl_errno($submit), curl_error($submit));
183 $response_fields = $this->explode_csv($response);
185 // fetch available contribution statuses
186 $contributionStatus = CRM_Contribute_PseudoConstant
::contributionStatus(NULL, 'name');
188 // check for application errors
190 // AVS, CVV2, CAVV, and other verification results
191 switch ($response_fields[0]) {
192 case self
::AUTH_REVIEW
:
193 $params['payment_status_id'] = array_search('Pending', $contributionStatus);
196 case self
::AUTH_ERROR
:
197 $params['payment_status_id'] = array_search('Failed', $contributionStatus);
198 $errormsg = $response_fields[2] . ' ' . $response_fields[3];
199 return self
::error($response_fields[1], $errormsg);
201 case self
::AUTH_DECLINED
:
202 $errormsg = $response_fields[2] . ' ' . $response_fields[3];
203 return self
::error($response_fields[1], $errormsg);
208 // test mode always returns trxn_id = 0
209 // also live mode in CiviCRM with test mode set in
210 // Authorize.Net return $response_fields[6] = 0
211 // hence treat that also as test mode transaction
213 if (($this->_mode
== 'test') ||
$response_fields[6] == 0) {
214 $query = "SELECT MAX(trxn_id) FROM civicrm_contribution WHERE trxn_id RLIKE 'test[0-9]+'";
216 $trxn_id = strval(CRM_Core_DAO
::singleValueQuery($query, $p));
217 $trxn_id = str_replace('test', '', $trxn_id);
218 $trxn_id = intval($trxn_id) +
1;
219 $params['trxn_id'] = sprintf('test%08d', $trxn_id);
222 $params['trxn_id'] = $response_fields[6];
224 $params['gross_amount'] = $response_fields[9];
227 // TODO: include authorization code?
233 * Submit an Automated Recurring Billing subscription.
235 public function doRecurPayment() {
236 $template = CRM_Core_Smarty
::singleton();
238 $intervalLength = $this->_getParam('frequency_interval');
239 $intervalUnit = $this->_getParam('frequency_unit');
240 if ($intervalUnit == 'week') {
241 $intervalLength *= 7;
242 $intervalUnit = 'days';
244 elseif ($intervalUnit == 'year') {
245 $intervalLength *= 12;
246 $intervalUnit = 'months';
248 elseif ($intervalUnit === 'day') {
249 $intervalUnit = 'days';
251 elseif ($intervalUnit == 'month') {
252 $intervalUnit = 'months';
255 // interval cannot be less than 7 days or more than 1 year
256 if ($intervalUnit == 'days') {
257 if ($intervalLength < 7) {
258 return self
::error(9001, 'Payment interval must be at least one week');
260 elseif ($intervalLength > 365) {
261 return self
::error(9001, 'Payment interval may not be longer than one year');
264 elseif ($intervalUnit == 'months') {
265 if ($intervalLength < 1) {
266 return self
::error(9001, 'Payment interval must be at least one week');
268 elseif ($intervalLength > 12) {
269 return self
::error(9001, 'Payment interval may not be longer than one year');
273 $template->assign('intervalLength', $intervalLength);
274 $template->assign('intervalUnit', $intervalUnit);
276 $template->assign('apiLogin', $this->_getParam('apiLogin'));
277 $template->assign('paymentKey', $this->_getParam('paymentKey'));
278 $template->assign('refId', substr($this->_getParam('invoiceID'), 0, 20));
280 //for recurring, carry first contribution id
281 $template->assign('invoiceNumber', $this->_getParam('contributionID'));
282 $firstPaymentDate = $this->_getParam('receive_date');
283 if (!empty($firstPaymentDate)) {
284 //allow for post dated payment if set in form
285 $startDate = date_create($firstPaymentDate);
288 $startDate = date_create();
290 /* Format start date in Mountain Time to avoid Authorize.net error E00017
291 * we do this only if the day we are setting our start time to is LESS than the current
292 * day in mountaintime (ie. the server time of the A-net server). A.net won't accept a date
293 * earlier than the current date on it's server so if we are in PST we might need to use mountain
294 * time to bring our date forward. But if we are submitting something future dated we want
295 * the date we entered to be respected
297 $minDate = date_create('now', new DateTimeZone(self
::TIMEZONE
));
298 if (strtotime($startDate->format('Y-m-d')) < strtotime($minDate->format('Y-m-d'))) {
299 $startDate->setTimezone(new DateTimeZone(self
::TIMEZONE
));
302 $template->assign('startDate', $startDate->format('Y-m-d'));
304 $installments = $this->_getParam('installments');
306 // for open ended subscription totalOccurrences has to be 9999
307 $installments = empty($installments) ?
9999 : $installments;
308 $template->assign('totalOccurrences', $installments);
310 $template->assign('amount', $this->_getParam('amount'));
312 $template->assign('cardNumber', $this->_getParam('credit_card_number'));
313 $exp_month = str_pad($this->_getParam('month'), 2, '0', STR_PAD_LEFT
);
314 $exp_year = $this->_getParam('year');
315 $template->assign('expirationDate', $exp_year . '-' . $exp_month);
317 // name rather than description is used in the tpl - see http://www.authorize.net/support/ARB_guide.pdf
318 $template->assign('name', $this->_getParam('description', TRUE));
320 $template->assign('email', $this->_getParam('email'));
321 $template->assign('contactID', $this->_getParam('contactID'));
322 $template->assign('billingFirstName', $this->_getParam('billing_first_name'));
323 $template->assign('billingLastName', $this->_getParam('billing_last_name'));
324 $template->assign('billingAddress', $this->_getParam('street_address', TRUE));
325 $template->assign('billingCity', $this->_getParam('city', TRUE));
326 $template->assign('billingState', $this->_getParam('state_province'));
327 $template->assign('billingZip', $this->_getParam('postal_code', TRUE));
328 $template->assign('billingCountry', $this->_getParam('country'));
330 $arbXML = $template->fetch('CRM/Contribute/Form/Contribution/AuthorizeNetARB.tpl');
332 // Submit to authorize.net
333 $response = $this->getGuzzleClient()->post($this->_paymentProcessor
['url_recur'], [
335 'Content-Type' => 'text/xml; charset=UTF8',
339 CURLOPT_RETURNTRANSFER
=> TRUE,
340 CURLOPT_SSL_VERIFYPEER
=> Civi
::settings()->get('verifySSL'),
343 $responseFields = $this->_ParseArbReturn((string) $response->getBody());
345 if ($responseFields['resultCode'] === 'Error') {
346 throw new PaymentProcessorException($responseFields['code'], $responseFields['text']);
349 // update recur processor_id with subscriptionId
350 CRM_Core_DAO
::setFieldValue('CRM_Contribute_DAO_ContributionRecur', $this->_getParam('contributionRecurID'),
351 'processor_id', $responseFields['subscriptionId']
353 //only impact of assigning this here is is can be used to cancel the subscription in an automated test
354 // if it isn't cancelled a duplicate transaction error occurs
355 if (!empty($responseFields['subscriptionId'])) {
356 $this->_setParam('subscriptionId', $responseFields['subscriptionId']);
363 public function _getAuthorizeNetFields() {
364 //Total amount is from the form contribution field
365 $amount = $this->_getParam('total_amount');
366 //CRM-9894 would this ever be the case??
367 if (empty($amount)) {
368 $amount = $this->_getParam('amount');
371 $fields['x_login'] = $this->_getParam('apiLogin');
372 $fields['x_tran_key'] = $this->_getParam('paymentKey');
373 $fields['x_email_customer'] = $this->_getParam('emailCustomer');
374 $fields['x_first_name'] = $this->_getParam('billing_first_name');
375 $fields['x_last_name'] = $this->_getParam('billing_last_name');
376 $fields['x_address'] = $this->_getParam('street_address');
377 $fields['x_city'] = $this->_getParam('city');
378 $fields['x_state'] = $this->_getParam('state_province');
379 $fields['x_zip'] = $this->_getParam('postal_code');
380 $fields['x_country'] = $this->_getParam('country');
381 $fields['x_customer_ip'] = $this->_getParam('ip_address');
382 $fields['x_email'] = $this->_getParam('email');
383 $fields['x_invoice_num'] = $this->_getParam('invoiceID');
384 $fields['x_amount'] = $amount;
385 $fields['x_currency_code'] = $this->_getParam('currencyID');
386 $fields['x_description'] = $this->_getParam('description');
387 $fields['x_cust_id'] = $this->_getParam('contactID');
388 if ($this->_getParam('paymentType') == 'AIM') {
389 $fields['x_relay_response'] = 'FALSE';
390 // request response in CSV format
391 $fields['x_delim_data'] = 'TRUE';
392 $fields['x_delim_char'] = ',';
393 $fields['x_encap_char'] = '"';
395 $fields['x_card_num'] = $this->_getParam('credit_card_number');
396 $fields['x_card_code'] = $this->_getParam('cvv2');
397 $exp_month = str_pad($this->_getParam('month'), 2, '0', STR_PAD_LEFT
);
398 $exp_year = $this->_getParam('year');
399 $fields['x_exp_date'] = "$exp_month/$exp_year";
402 if ($this->_mode
!= 'live') {
403 $fields['x_test_request'] = 'TRUE';
413 * @param string $data
416 * the HMAC_MD5 encoding string
418 public function hmac($key, $data) {
419 if (function_exists('mhash')) {
420 // Use PHP mhash extension
421 return (bin2hex(mhash(MHASH_MD5
, $data, $key)));
424 // RFC 2104 HMAC implementation for php.
425 // Creates an md5 HMAC.
426 // Eliminates the need to install mhash to compute a HMAC
427 // Hacked by Lance Rushing
428 // byte length for md5
430 if (strlen($key) > $b) {
431 $key = pack("H*", md5($key));
433 $key = str_pad($key, $b, chr(0x00));
434 $ipad = str_pad('', $b, chr(0x36));
435 $opad = str_pad('', $b, chr(0x5c));
436 $k_ipad = $key ^
$ipad;
437 $k_opad = $key ^
$opad;
438 return md5($k_opad . pack("H*", md5($k_ipad . $data)));
443 * Calculate and return the transaction fingerprint.
448 public function CalculateFP() {
449 $x_tran_key = $this->_getParam('paymentKey');
450 $loginid = $this->_getParam('apiLogin');
451 $sequence = $this->_getParam('sequence');
452 $timestamp = $this->_getParam('timestamp');
453 $amount = $this->_getParam('amount');
454 $currency = $this->_getParam('currencyID');
455 $transaction = "$loginid^$sequence^$timestamp^$amount^$currency";
456 return $this->hmac($x_tran_key, $transaction);
460 * Split a CSV file. Requires , as delimiter and " as enclosure.
461 * Based off notes from http://php.net/fgetcsv
463 * @param string $data
469 public function explode_csv($data) {
471 //make it easier to parse fields with quotes in them
472 $data = str_replace('""', "''", $data);
475 while ($data != '') {
477 if ($data[0] == '"') {
478 // handle quoted fields
479 preg_match('/^"(([^"]|\\")*?)",?(.*)$/', $data, $matches);
481 $fields[] = str_replace("''", '"', $matches[1]);
485 preg_match('/^([^,]*),?(.*)$/', $data, $matches);
487 $fields[] = $matches[1];
495 * Extract variables from returned XML.
497 * Function is from Authorize.Net sample code, and used
498 * to prevent the requirement of XML functions.
500 * @param string $content
501 * XML reply from Authorize.Net.
504 * refId, resultCode, code, text, subscriptionId
506 public function _parseArbReturn($content) {
507 $refId = $this->_substring_between($content, '<refId>', '</refId>');
508 $resultCode = $this->_substring_between($content, '<resultCode>', '</resultCode>');
509 $code = $this->_substring_between($content, '<code>', '</code>');
510 $text = $this->_substring_between($content, '<text>', '</text>');
511 $subscriptionId = $this->_substring_between($content, '<subscriptionId>', '</subscriptionId>');
514 'resultCode' => $resultCode,
517 'subscriptionId' => $subscriptionId,
522 * Helper function for _parseArbReturn.
524 * Function is from Authorize.Net sample code, and used to avoid using
527 * @param string $haystack
528 * @param string $start
531 * @return bool|string
533 public function _substring_between(&$haystack, $start, $end) {
534 if (strpos($haystack, $start) === FALSE ||
strpos($haystack, $end) === FALSE) {
538 $start_position = strpos($haystack, $start) +
strlen($start);
539 $end_position = strpos($haystack, $end);
540 return substr($haystack, $start_position, $end_position - $start_position);
545 * Get the value of a field if set.
547 * @param string $field
550 * @param bool $xmlSafe
552 * value of the field, or empty string if the field is
555 public function _getParam($field, $xmlSafe = FALSE) {
556 $value = CRM_Utils_Array
::value($field, $this->_params
, '');
558 $value = str_replace(['&', '"', "'", '<', '>'], '', $value);
564 * @param null $errorCode
565 * @param null $errorMessage
569 public function &error($errorCode = NULL, $errorMessage = NULL) {
570 $e = CRM_Core_Error
::singleton();
572 $e->push($errorCode, 0, [], $errorMessage);
575 $e->push(9001, 0, [], 'Unknown System Error.');
581 * Set a field to the specified value. Value must be a scalar (int,
582 * float, string, or boolean)
584 * @param string $field
585 * @param mixed $value
588 * false if value is not a scalar, true if successful
590 public function _setParam($field, $value) {
591 if (!is_scalar($value)) {
595 $this->_params
[$field] = $value;
600 * This function checks to see if we have the right config values.
603 * the error message if any
605 public function checkConfig() {
607 if (empty($this->_paymentProcessor
['user_name'])) {
608 $error[] = ts('APILogin is not set for this payment processor');
611 if (empty($this->_paymentProcessor
['password'])) {
612 $error[] = ts('Key is not set for this payment processor');
615 if (!empty($error)) {
616 return implode('<p>', $error);
626 public function accountLoginURL() {
627 return ($this->_mode
== 'test') ?
'https://test.authorize.net' : 'https://authorize.net';
631 * @param string $message
632 * @param array $params
634 * @return bool|object
636 public function cancelSubscription(&$message = '', $params = []) {
637 $template = CRM_Core_Smarty
::singleton();
639 $template->assign('subscriptionType', 'cancel');
641 $template->assign('apiLogin', $this->_getParam('apiLogin'));
642 $template->assign('paymentKey', $this->_getParam('paymentKey'));
643 $template->assign('subscriptionId', CRM_Utils_Array
::value('subscriptionId', $params));
645 $arbXML = $template->fetch('CRM/Contribute/Form/Contribution/AuthorizeNetARB.tpl');
647 // submit to authorize.net
648 $submit = curl_init($this->_paymentProcessor
['url_recur']);
650 return self
::error(9002, 'Could not initiate connection to payment gateway');
653 curl_setopt($submit, CURLOPT_RETURNTRANSFER
, 1);
654 curl_setopt($submit, CURLOPT_HTTPHEADER
, ["Content-Type: text/xml"]);
655 curl_setopt($submit, CURLOPT_HEADER
, 1);
656 curl_setopt($submit, CURLOPT_POSTFIELDS
, $arbXML);
657 curl_setopt($submit, CURLOPT_POST
, 1);
658 curl_setopt($submit, CURLOPT_SSL_VERIFYPEER
, Civi
::settings()->get('verifySSL'));
660 $response = curl_exec($submit);
663 return self
::error(curl_errno($submit), curl_error($submit));
668 $responseFields = $this->_ParseArbReturn($response);
669 $message = "{$responseFields['code']}: {$responseFields['text']}";
671 if ($responseFields['resultCode'] == 'Error') {
672 return self
::error($responseFields['code'], $responseFields['text']);
678 * @param string $message
679 * @param array $params
681 * @return bool|object
683 public function updateSubscriptionBillingInfo(&$message = '', $params = []) {
684 $template = CRM_Core_Smarty
::singleton();
685 $template->assign('subscriptionType', 'updateBilling');
687 $template->assign('apiLogin', $this->_getParam('apiLogin'));
688 $template->assign('paymentKey', $this->_getParam('paymentKey'));
689 $template->assign('subscriptionId', $params['subscriptionId']);
691 $template->assign('cardNumber', $params['credit_card_number']);
692 $exp_month = str_pad($params['month'], 2, '0', STR_PAD_LEFT
);
693 $exp_year = $params['year'];
694 $template->assign('expirationDate', $exp_year . '-' . $exp_month);
696 $template->assign('billingFirstName', $params['first_name']);
697 $template->assign('billingLastName', $params['last_name']);
698 $template->assign('billingAddress', $params['street_address']);
699 $template->assign('billingCity', $params['city']);
700 $template->assign('billingState', $params['state_province']);
701 $template->assign('billingZip', $params['postal_code']);
702 $template->assign('billingCountry', $params['country']);
704 $arbXML = $template->fetch('CRM/Contribute/Form/Contribution/AuthorizeNetARB.tpl');
706 // submit to authorize.net
707 $submit = curl_init($this->_paymentProcessor
['url_recur']);
709 return self
::error(9002, 'Could not initiate connection to payment gateway');
712 curl_setopt($submit, CURLOPT_RETURNTRANSFER
, 1);
713 curl_setopt($submit, CURLOPT_HTTPHEADER
, ["Content-Type: text/xml"]);
714 curl_setopt($submit, CURLOPT_HEADER
, 1);
715 curl_setopt($submit, CURLOPT_POSTFIELDS
, $arbXML);
716 curl_setopt($submit, CURLOPT_POST
, 1);
717 curl_setopt($submit, CURLOPT_SSL_VERIFYPEER
, Civi
::settings()->get('verifySSL'));
719 $response = curl_exec($submit);
722 return self
::error(curl_errno($submit), curl_error($submit));
727 $responseFields = $this->_ParseArbReturn($response);
728 $message = "{$responseFields['code']}: {$responseFields['text']}";
730 if ($responseFields['resultCode'] == 'Error') {
731 return self
::error($responseFields['code'], $responseFields['text']);
737 * Process incoming notification.
739 public static function handlePaymentNotification() {
740 $ipnClass = new CRM_Core_Payment_AuthorizeNetIPN(array_merge($_GET, $_REQUEST));
745 * @param string $message
746 * @param array $params
748 * @return bool|object
750 public function changeSubscriptionAmount(&$message = '', $params = []) {
751 $template = CRM_Core_Smarty
::singleton();
753 $template->assign('subscriptionType', 'update');
755 $template->assign('apiLogin', $this->_getParam('apiLogin'));
756 $template->assign('paymentKey', $this->_getParam('paymentKey'));
758 $template->assign('subscriptionId', $params['subscriptionId']);
760 // for open ended subscription totalOccurrences has to be 9999
761 $installments = empty($params['installments']) ?
9999 : $params['installments'];
762 $template->assign('totalOccurrences', $installments);
764 $template->assign('amount', $params['amount']);
766 $arbXML = $template->fetch('CRM/Contribute/Form/Contribution/AuthorizeNetARB.tpl');
768 // submit to authorize.net
769 $submit = curl_init($this->_paymentProcessor
['url_recur']);
771 throw new PaymentProcessorException('Could not initiate connection to payment gateway', 9002);
774 curl_setopt($submit, CURLOPT_RETURNTRANSFER
, 1);
775 curl_setopt($submit, CURLOPT_HTTPHEADER
, ["Content-Type: text/xml"]);
776 curl_setopt($submit, CURLOPT_HEADER
, 1);
777 curl_setopt($submit, CURLOPT_POSTFIELDS
, $arbXML);
778 curl_setopt($submit, CURLOPT_POST
, 1);
779 curl_setopt($submit, CURLOPT_SSL_VERIFYPEER
, Civi
::settings()->get('verifySSL'));
781 $response = curl_exec($submit);
784 return self
::error(curl_errno($submit), curl_error($submit));
789 $responseFields = $this->_parseArbReturn($response);
790 $message = "{$responseFields['code']}: {$responseFields['text']}";
792 if ($responseFields['resultCode'] == 'Error') {
793 throw new PaymentProcessorException($responseFields['text'], $responseFields['code']);