Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
PaymentDetailsHandler.php
Go to the documentation of this file.
1 <?php
7 
12 
17 {
18  const AVS_POSTAL_RESPONSE_CODE = 'avsPostalCodeResponseCode';
19 
20  const AVS_STREET_ADDRESS_RESPONSE_CODE = 'avsStreetAddressResponseCode';
21 
22  const CVV_RESPONSE_CODE = 'cvvResponseCode';
23 
24  const PROCESSOR_AUTHORIZATION_CODE = 'processorAuthorizationCode';
25 
26  const PROCESSOR_RESPONSE_CODE = 'processorResponseCode';
27 
28  const PROCESSOR_RESPONSE_TEXT = 'processorResponseText';
29 
41  ];
42 
46  private $subjectReader;
47 
53  public function __construct(SubjectReader $subjectReader)
54  {
55  $this->subjectReader = $subjectReader;
56  }
57 
61  public function handle(array $handlingSubject, array $response)
62  {
63  $paymentDO = $this->subjectReader->readPayment($handlingSubject);
65  $transaction = $this->subjectReader->readTransaction($response);
67  $payment = $paymentDO->getPayment();
68 
69  $payment->setCcTransId($transaction->id);
70  $payment->setLastTransId($transaction->id);
71 
72  //remove previously set payment nonce
73  $payment->unsAdditionalInformation(DataAssignObserver::PAYMENT_METHOD_NONCE);
74  foreach ($this->additionalInformationMapping as $item) {
75  if (!isset($transaction->$item)) {
76  continue;
77  }
78  $payment->setAdditionalInformation($item, $transaction->$item);
79  }
80  }
81 }
$transaction
$response
Definition: 404.php:11
handle(array $handlingSubject, array $response)
$payment
Definition: order.php:17