Conditions | 4 |
Paths | 3 |
Total Lines | 25 |
Code Lines | 14 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
35 | public function build(array $buildSubject) |
||
36 | { |
||
37 | if (!isset($buildSubject['payment']) |
||
38 | || !$buildSubject['payment'] instanceof PaymentDataObjectInterface |
||
39 | ) { |
||
40 | throw new \InvalidArgumentException('Payment data object should be provided'); |
||
41 | } |
||
42 | |||
43 | /** @var PaymentDataObjectInterface $paymentDO */ |
||
44 | $paymentDO = $buildSubject['payment']; |
||
45 | |||
46 | $order = $paymentDO->getOrder(); |
||
47 | |||
48 | $payment = $paymentDO->getPayment(); |
||
49 | |||
50 | if (!$payment instanceof OrderPaymentInterface) { |
||
51 | throw new \LogicException('Order payment should be provided.'); |
||
52 | } |
||
53 | |||
54 | return [ |
||
55 | 'TXN_TYPE' => 'S', |
||
56 | 'TXN_ID' => $payment->getLastTransId(), |
||
57 | 'MERCHANT_KEY' => $this->config->getValue( |
||
58 | 'merchant_gateway_key', |
||
59 | $order->getStoreId() |
||
60 | ) |
||
64 |