/** * @inheritdoc */ public function build(array $buildSubject) { $paymentDO = $this->subjectReader->readPayment($buildSubject); $payment = $paymentDO->getPayment(); $extensionAttributes = $payment->getExtensionAttributes(); $paymentToken = $extensionAttributes->getVaultPaymentToken(); return ['amount' => $this->formatPrice($this->subjectReader->readAmount($buildSubject)), 'paymentMethodToken' => $paymentToken->getGatewayToken()]; }
/** * @inheritdoc */ public function build(array $buildSubject) { $paymentDO = $this->subjectReader->readPayment($buildSubject); $payment = $paymentDO->getPayment(); $transactionId = $payment->getCcTransId(); if (!$transactionId) { throw new LocalizedException(__('No authorization transaction to proceed capture.')); } return [self::TRANSACTION_ID => $transactionId, PaymentDataBuilder::AMOUNT => $this->formatPrice($this->subjectReader->readAmount($buildSubject))]; }
/** * @inheritdoc */ public function build(array $buildSubject) { $result = []; $paymentDO = $this->subjectReader->readPayment($buildSubject); $amount = $this->formatPrice($this->subjectReader->readAmount($buildSubject)); if ($this->is3DSecureEnabled($paymentDO->getOrder(), $amount)) { $result['options'][Config::CODE_3DSECURE] = ['required' => true]; } return $result; }
/** * @inheritdoc */ public function build(array $buildSubject) { $paymentDO = $this->subjectReader->readPayment($buildSubject); $payment = $paymentDO->getPayment(); $order = $paymentDO->getOrder(); $result = [self::AMOUNT => $this->formatPrice($this->subjectReader->readAmount($buildSubject)), self::PAYMENT_METHOD_NONCE => $payment->getAdditionalInformation(DataAssignObserver::PAYMENT_METHOD_NONCE), self::ORDER_ID => $order->getOrderIncrementId()]; $merchantAccountId = $this->config->getValue(Config::KEY_MERCHANT_ACCOUNT_ID); if (!empty($merchantAccountId)) { $result[self::MERCHANT_ACCOUNT_ID] = $merchantAccountId; } return $result; }
/** * Builds ENV request * * @param array $buildSubject * @return array */ public function build(array $buildSubject) { $paymentDO = $this->subjectReader->readPayment($buildSubject); /** @var Payment $payment */ $payment = $paymentDO->getPayment(); $amount = null; try { $amount = $this->formatPrice($this->subjectReader->readAmount($buildSubject)); } catch (\InvalidArgumentException $e) { // pass } /* * we should remember that Payment sets Capture txn id of current Invoice into ParentTransactionId Field * We should also support previous implementations of Magento Braintree - * and cut off '-capture' postfix from transaction ID to support backward compatibility */ $txnId = str_replace('-' . TransactionInterface::TYPE_CAPTURE, '', $payment->getParentTransactionId()); return ['transaction_id' => $txnId, PaymentDataBuilder::AMOUNT => $amount]; }