Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Public Member Functions | Data Fields | Protected Member Functions | Protected Attributes
Authorizenet Class Reference
Inheritance diagram for Authorizenet:
Directpost

Public Member Functions

 __construct (\Magento\Framework\Model\Context $context, \Magento\Framework\Registry $registry, \Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory, \Magento\Framework\Api\AttributeValueFactory $customAttributeFactory, \Magento\Payment\Helper\Data $paymentData, \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Payment\Model\Method\Logger $logger, \Magento\Framework\Module\ModuleListInterface $moduleList, \Magento\Framework\Stdlib\DateTime\TimezoneInterface $localeDate, \Magento\Authorizenet\Helper\Data $dataHelper, \Magento\Authorizenet\Model\Request\Factory $requestFactory, \Magento\Authorizenet\Model\Response\Factory $responseFactory, TransactionService $transactionService, ZendClientFactory $httpClientFactory, \Magento\Framework\Model\ResourceModel\AbstractResource $resource=null, \Magento\Framework\Data\Collection\AbstractDb $resourceCollection=null, array $data=[])
 
 canUseForCurrency ($currencyCode)
 
 getAcceptedCurrencyCodes ()
 
 cancel (\Magento\Payment\Model\InfoInterface $payment)
 
 fetchTransactionFraudDetails ($transactionId)
 

Data Fields

const CGI_URL = 'https://secure.authorize.net/gateway/transact.dll'
 
const REQUEST_METHOD_CC = 'CC'
 
const REQUEST_TYPE_AUTH_CAPTURE = 'AUTH_CAPTURE'
 
const REQUEST_TYPE_AUTH_ONLY = 'AUTH_ONLY'
 
const REQUEST_TYPE_CAPTURE_ONLY = 'CAPTURE_ONLY'
 
const REQUEST_TYPE_CREDIT = 'CREDIT'
 
const REQUEST_TYPE_VOID = 'VOID'
 
const REQUEST_TYPE_PRIOR_AUTH_CAPTURE = 'PRIOR_AUTH_CAPTURE'
 
const RESPONSE_DELIM_CHAR = '(~)'
 
const RESPONSE_CODE_APPROVED = 1
 
const RESPONSE_CODE_DECLINED = 2
 
const RESPONSE_CODE_ERROR = 3
 
const RESPONSE_CODE_HELD = 4
 
const RESPONSE_REASON_CODE_APPROVED = 1
 
const RESPONSE_REASON_CODE_PENDING_REVIEW_AUTHORIZED = 252
 
const RESPONSE_REASON_CODE_PENDING_REVIEW = 253
 
const RESPONSE_REASON_CODE_PENDING_REVIEW_DECLINED = 254
 
const TRANSACTION_FRAUD_STATE_KEY = 'is_transaction_fraud'
 
const REAL_TRANSACTION_ID_KEY = 'real_transaction_id'
 
const GATEWAY_ACTIONS_LOCKED_STATE_KEY = 'is_gateway_actions_locked'
 

Protected Member Functions

 getFraudFilters ($fraudFilters)
 
 getRequest ()
 
 isGatewayActionsLocked ($payment)
 

Protected Attributes

 $dataHelper
 
 $requestFactory
 
 $responseFactory
 
 $transactionService
 
 $_debugReplacePrivateDataKeys = ['merchantAuthentication', 'x_login']
 
 $httpClientFactory
 

Detailed Description

@SuppressWarnings(PHPMD.TooManyFields) @SuppressWarnings(PHPMD.ExcessiveClassComplexity) @SuppressWarnings(PHPMD.CouplingBetweenObjects)

Definition at line 16 of file Authorizenet.php.

Constructor & Destructor Documentation

◆ __construct()

Parameters
\Magento\Framework\Model\Context$context
\Magento\Framework\Registry$registry
\Magento\Framework\Api\ExtensionAttributesFactory$extensionFactory
\Magento\Framework\Api\AttributeValueFactory$customAttributeFactory
\Magento\Payment\Helper\Data$paymentData
\Magento\Framework\App\Config\ScopeConfigInterface$scopeConfig
\Magento\Payment\Model\Method\Logger$logger
\Magento\Framework\Module\ModuleListInterface$moduleList
\Magento\Framework\Stdlib\DateTime\TimezoneInterface$localeDate
\Magento\Authorizenet\Helper\Data$dataHelper
\Magento\Authorizenet\Model\Request\Factory$requestFactory
\Magento\Authorizenet\Model\Response\Factory$responseFactory
\Magento\Authorizenet\Model\TransactionService$transactionService
\Magento\Framework\HTTP\ZendClientFactory$httpClientFactory
\Magento\Framework\Model\ResourceModel\AbstractResource$resource
\Magento\Framework\Data\Collection\AbstractDb$resourceCollection
array$data@SuppressWarnings(PHPMD.ExcessiveParameterList)

Definition at line 126 of file Authorizenet.php.

144  {
145  $this->dataHelper = $dataHelper;
146  $this->requestFactory = $requestFactory;
147  $this->responseFactory = $responseFactory;
148  $this->transactionService = $transactionService;
149  $this->httpClientFactory = $httpClientFactory;
150 
151  parent::__construct(
152  $context,
153  $registry,
154  $extensionFactory,
155  $customAttributeFactory,
156  $paymentData,
157  $scopeConfig,
158  $logger,
159  $moduleList,
160  $localeDate,
161  $resource,
162  $resourceCollection,
163  $data
164  );
165  }
$resource
Definition: bulk.php:12
$logger

Member Function Documentation

◆ cancel()

cancel ( \Magento\Payment\Model\InfoInterface  $payment)

Cancel the payment through gateway

Parameters
\Magento\Payment\Model\InfoInterface$payment
Returns
$this

Definition at line 202 of file Authorizenet.php.

203  {
204  return $this->void($payment);
205  }
$payment
Definition: order.php:17

◆ canUseForCurrency()

canUseForCurrency (   $currencyCode)

Check method for processing with base currency

Parameters
string$currencyCode
Returns
bool

Definition at line 173 of file Authorizenet.php.

174  {
175  if (!in_array($currencyCode, $this->getAcceptedCurrencyCodes())) {
176  return false;
177  }
178  return true;
179  }

◆ fetchTransactionFraudDetails()

fetchTransactionFraudDetails (   $transactionId)

Fetch fraud details

Parameters
string$transactionId
Returns
\Magento\Framework\DataObject
Exceptions

Definition at line 214 of file Authorizenet.php.

215  {
216  $responseXmlDocument = $this->transactionService->getTransactionDetails($this, $transactionId);
217  $response = new \Magento\Framework\DataObject();
218 
219  if (empty($responseXmlDocument->transaction->FDSFilters->FDSFilter)) {
220  return $response;
221  }
222 
223  $response->setFdsFilterAction(
224  $this->dataHelper->getFdsFilterActionLabel((string)$responseXmlDocument->transaction->FDSFilterAction)
225  );
226  $response->setAvsResponse((string)$responseXmlDocument->transaction->AVSResponse);
227  $response->setCardCodeResponse((string)$responseXmlDocument->transaction->cardCodeResponse);
228  $response->setCavvResponse((string)$responseXmlDocument->transaction->CAVVResponse);
229  $response->setFraudFilters($this->getFraudFilters($responseXmlDocument->transaction->FDSFilters));
230 
231  return $response;
232  }
$response
Definition: 404.php:11

◆ getAcceptedCurrencyCodes()

getAcceptedCurrencyCodes ( )

Return array of currency codes supplied by Payment Gateway

Returns
array

Definition at line 186 of file Authorizenet.php.

187  {
188  if (!$this->hasData('_accepted_currency')) {
189  $acceptedCurrencyCodes = $this->dataHelper->getAllowedCurrencyCodes();
190  $acceptedCurrencyCodes[] = $this->getConfigData('currency');
191  $this->setData('_accepted_currency', $acceptedCurrencyCodes);
192  }
193  return $this->_getData('_accepted_currency');
194  }

◆ getFraudFilters()

getFraudFilters (   $fraudFilters)
protected

Get fraud filters

Parameters
\Magento\Framework\Simplexml\Element$fraudFilters
Returns
array

Definition at line 240 of file Authorizenet.php.

241  {
242  $result = [];
243 
244  foreach ($fraudFilters->FDSFilter as $filer) {
245  $result[] = [
246  'name' => (string)$filer->name,
247  'action' => $this->dataHelper->getFdsFilterActionLabel((string)$filer->action)
248  ];
249  }
250 
251  return $result;
252  }

◆ getRequest()

getRequest ( )
protected

Return authorize payment request

Returns
\Magento\Authorizenet\Model\Request

Definition at line 259 of file Authorizenet.php.

260  {
261  $request = $this->requestFactory->create()
262  ->setXVersion(3.1)
263  ->setXDelimData('True')
264  ->setXRelayResponse('False')
265  ->setXTestRequest($this->getConfigData('test') ? 'TRUE' : 'FALSE')
266  ->setXLogin($this->getConfigData('login'))
267  ->setXTranKey($this->getConfigData('trans_key'));
268  return $request;
269  }

◆ isGatewayActionsLocked()

isGatewayActionsLocked (   $payment)
protected

If gateway actions are locked return true

Parameters
\Magento\Payment\Model\InfoInterface$payment
Returns
bool

Definition at line 440 of file Authorizenet.php.

441  {
442  return $payment->getAdditionalInformation(self::GATEWAY_ACTIONS_LOCKED_STATE_KEY);
443  }
$payment
Definition: order.php:17

Field Documentation

◆ $_debugReplacePrivateDataKeys

$_debugReplacePrivateDataKeys = ['merchantAuthentication', 'x_login']
protected

Definition at line 99 of file Authorizenet.php.

◆ $dataHelper

$dataHelper
protected

Definition at line 73 of file Authorizenet.php.

◆ $httpClientFactory

$httpClientFactory
protected

Definition at line 104 of file Authorizenet.php.

◆ $requestFactory

$requestFactory
protected

Definition at line 80 of file Authorizenet.php.

◆ $responseFactory

$responseFactory
protected

Definition at line 87 of file Authorizenet.php.

◆ $transactionService

$transactionService
protected

Definition at line 92 of file Authorizenet.php.

◆ CGI_URL

const CGI_URL = 'https://secure.authorize.net/gateway/transact.dll'

AIM gateway url

Definition at line 21 of file Authorizenet.php.

◆ GATEWAY_ACTIONS_LOCKED_STATE_KEY

const GATEWAY_ACTIONS_LOCKED_STATE_KEY = 'is_gateway_actions_locked'

Gateway actions locked state key

Definition at line 68 of file Authorizenet.php.

◆ REAL_TRANSACTION_ID_KEY

const REAL_TRANSACTION_ID_KEY = 'real_transaction_id'

Real transaction id key

Definition at line 63 of file Authorizenet.php.

◆ REQUEST_METHOD_CC

const REQUEST_METHOD_CC = 'CC'

Definition at line 23 of file Authorizenet.php.

◆ REQUEST_TYPE_AUTH_CAPTURE

const REQUEST_TYPE_AUTH_CAPTURE = 'AUTH_CAPTURE'

Definition at line 25 of file Authorizenet.php.

◆ REQUEST_TYPE_AUTH_ONLY

const REQUEST_TYPE_AUTH_ONLY = 'AUTH_ONLY'

Definition at line 27 of file Authorizenet.php.

◆ REQUEST_TYPE_CAPTURE_ONLY

const REQUEST_TYPE_CAPTURE_ONLY = 'CAPTURE_ONLY'

Definition at line 29 of file Authorizenet.php.

◆ REQUEST_TYPE_CREDIT

const REQUEST_TYPE_CREDIT = 'CREDIT'

Definition at line 31 of file Authorizenet.php.

◆ REQUEST_TYPE_PRIOR_AUTH_CAPTURE

const REQUEST_TYPE_PRIOR_AUTH_CAPTURE = 'PRIOR_AUTH_CAPTURE'

Definition at line 35 of file Authorizenet.php.

◆ REQUEST_TYPE_VOID

const REQUEST_TYPE_VOID = 'VOID'

Definition at line 33 of file Authorizenet.php.

◆ RESPONSE_CODE_APPROVED

const RESPONSE_CODE_APPROVED = 1

Definition at line 39 of file Authorizenet.php.

◆ RESPONSE_CODE_DECLINED

const RESPONSE_CODE_DECLINED = 2

Definition at line 41 of file Authorizenet.php.

◆ RESPONSE_CODE_ERROR

const RESPONSE_CODE_ERROR = 3

Definition at line 43 of file Authorizenet.php.

◆ RESPONSE_CODE_HELD

const RESPONSE_CODE_HELD = 4

Definition at line 45 of file Authorizenet.php.

◆ RESPONSE_DELIM_CHAR

const RESPONSE_DELIM_CHAR = '(~)'

Definition at line 37 of file Authorizenet.php.

◆ RESPONSE_REASON_CODE_APPROVED

const RESPONSE_REASON_CODE_APPROVED = 1

Definition at line 47 of file Authorizenet.php.

◆ RESPONSE_REASON_CODE_PENDING_REVIEW

const RESPONSE_REASON_CODE_PENDING_REVIEW = 253

Definition at line 51 of file Authorizenet.php.

◆ RESPONSE_REASON_CODE_PENDING_REVIEW_AUTHORIZED

const RESPONSE_REASON_CODE_PENDING_REVIEW_AUTHORIZED = 252

Definition at line 49 of file Authorizenet.php.

◆ RESPONSE_REASON_CODE_PENDING_REVIEW_DECLINED

const RESPONSE_REASON_CODE_PENDING_REVIEW_DECLINED = 254

Definition at line 53 of file Authorizenet.php.

◆ TRANSACTION_FRAUD_STATE_KEY

const TRANSACTION_FRAUD_STATE_KEY = 'is_transaction_fraud'

Transaction fraud state key

Definition at line 58 of file Authorizenet.php.


The documentation for this class was generated from the following file: