| Conditions | 3 |
| Paths | 2 |
| Total Lines | 22 |
| Code Lines | 15 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 34 | public function build(array $buildSubject) |
||
| 35 | { |
||
| 36 | if (!isset($buildSubject['payment']) |
||
| 37 | || !$buildSubject['payment'] instanceof PaymentDataObjectInterface |
||
| 38 | ) { |
||
| 39 | throw new \InvalidArgumentException('Payment data object should be provided'); |
||
| 40 | } |
||
| 41 | |||
| 42 | /** @var PaymentDataObjectInterface $payment */ |
||
| 43 | $payment = $buildSubject['payment']; |
||
| 44 | $order = $payment->getOrder(); |
||
| 45 | $address = $order->getShippingAddress(); |
||
| 46 | |||
| 47 | return [ |
||
| 48 | 'TXN_TYPE' => 'A', |
||
| 49 | 'INVOICE' => $order->getOrderIncrementId(), |
||
| 50 | 'AMOUNT' => $order->getGrandTotalAmount(), |
||
| 51 | 'CURRENCY' => $order->getCurrencyCode(), |
||
| 52 | 'EMAIL' => $address->getEmail(), |
||
| 53 | 'MERCHANT_KEY' => $this->config->getValue( |
||
| 54 | 'merchant_gateway_key', |
||
| 55 | $order->getStoreId() |
||
| 56 | ) |
||
| 60 |