Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
ThreeDSecureDetailsHandler.php
Go to the documentation of this file.
1 <?php
7 
8 use Braintree\Transaction;
13 
18 {
19  const LIABILITY_SHIFTED = 'liabilityShifted';
20 
21  const LIABILITY_SHIFT_POSSIBLE = 'liabilityShiftPossible';
22 
26  private $subjectReader;
27 
33  public function __construct(SubjectReader $subjectReader)
34  {
35  $this->subjectReader = $subjectReader;
36  }
37 
41  public function handle(array $handlingSubject, array $response)
42  {
43  $paymentDO = $this->subjectReader->readPayment($handlingSubject);
48  $payment = $paymentDO->getPayment();
50 
52  $transaction = $this->subjectReader->readTransaction($response);
53 
54  if ($payment->hasAdditionalInformation(self::LIABILITY_SHIFTED)) {
55  // remove 3d secure details for reorder
56  $payment->unsAdditionalInformation(self::LIABILITY_SHIFTED);
57  $payment->unsAdditionalInformation(self::LIABILITY_SHIFT_POSSIBLE);
58  }
59 
60  if (empty($transaction->threeDSecureInfo)) {
61  return;
62  }
63 
65  $info = $transaction->threeDSecureInfo;
66  $payment->setAdditionalInformation(self::LIABILITY_SHIFTED, $info->liabilityShifted ? 'Yes' : 'No');
67  $shiftPossible = $info->liabilityShiftPossible ? 'Yes' : 'No';
68  $payment->setAdditionalInformation(self::LIABILITY_SHIFT_POSSIBLE, $shiftPossible);
69  }
70 }
$transaction
$response
Definition: 404.php:11
handle(array $handlingSubject, array $response)
$payment
Definition: order.php:17
foreach( $_productCollection as $_product)() ?>" class $info
Definition: listing.phtml:52
static assertOrderPayment(InfoInterface $paymentInfo)