Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
PaymentDataBuilder.php
Go to the documentation of this file.
1 <?php
7 
12 use Magento\Payment\Helper\Formatter;
13 
18 {
19  use Formatter;
20 
25  const AMOUNT = 'amount';
26 
36  const PAYMENT_METHOD_NONCE = 'paymentMethodNonce';
37 
42  const MERCHANT_ACCOUNT_ID = 'merchantAccountId';
43 
47  const ORDER_ID = 'orderId';
48 
52  private $subjectReader;
53 
59  public function __construct(Config $config, SubjectReader $subjectReader)
60  {
61  $this->subjectReader = $subjectReader;
62  }
63 
67  public function build(array $buildSubject)
68  {
69  $paymentDO = $this->subjectReader->readPayment($buildSubject);
70 
71  $payment = $paymentDO->getPayment();
72  $order = $paymentDO->getOrder();
73 
74  $result = [
75  self::AMOUNT => $this->formatPrice($this->subjectReader->readAmount($buildSubject)),
76  self::PAYMENT_METHOD_NONCE => $payment->getAdditionalInformation(
78  ),
79  self::ORDER_ID => $order->getOrderIncrementId()
80  ];
81 
82  return $result;
83  }
84 }
$config
Definition: fraud_order.php:17
$order
Definition: order.php:55
$payment
Definition: order.php:17
__construct(Config $config, SubjectReader $subjectReader)