config = $config; $this->orderRepository = $orderRepository; $this->quoteRepository = $quoteRepository; $this->coreHelper = $coreHelper; $this->productMetaData = $productMetadata; $this->subjectReader = $subjectReader; $this->logger = $logger; } /** * @param array $buildSubject * @return array * @throws \Magento\Framework\Exception\NoSuchEntityException */ public function build(array $buildSubject) { $data = []; $paymentDO = $this->subjectReader->readPayment($buildSubject); $orderDO = $paymentDO->getOrder(); $currencyCode = $orderDO->getCurrencyCode(); $total = $buildSubject['amount']; if ($buildSubject['multicurrency']['multicurrency']) { $currencyCode = $buildSubject['multicurrency']['order_currency']; $total = $buildSubject['multicurrency']['total']; } if (isset($buildSubject['amazon_order_id']) && $buildSubject['amazon_order_id']) { $data = [ 'amazon_authorization_id' => $paymentDO->getPayment()->getParentTransactionId(), 'capture_amount' => $total, 'currency_code' => $currencyCode, 'amazon_order_reference_id' => $buildSubject['amazon_order_id'], 'store_id' => $buildSubject['multicurrency']['store_id'], 'store_name' => $buildSubject['multicurrency']['store_name'], 'custom_information' => 'Magento Version : ' . $this->productMetaData->getVersion() . ' ' . 'Plugin Version : ' . $this->coreHelper->getVersion(), 'platform_id' => $this->config->getValue('platform_id'), 'request_payment_authorization' => false ]; if (isset($buildSubject['request_payment_authorization']) && $buildSubject['request_payment_authorization']) { $data['request_payment_authorization'] = true; } } return $data; } }