/** * Copies paytype from payment additional data to session. * * @param \Magento\Checkout\Model\PaymentInformationManagement $subject * @param $cartId * @param \Magento\Quote\Api\Data\PaymentInterface $paymentMethod */ public function beforeSavePaymentInformationAndPlaceOrder(\Magento\Checkout\Model\PaymentInformationManagement $subject, $cartId, \Magento\Quote\Api\Data\PaymentInterface $paymentMethod) { if ($paymentMethod->getMethod() === \Orba\Payupl\Model\Payupl::CODE) { $additionalData = $paymentMethod->getAdditionalData(); $this->session->setPaytype(isset($additionalData['paytype']) ? $additionalData['paytype'] : null); } }
/** * @param \Magento\Sales\Model\Order $order * @return array */ public function getBasicData(\Magento\Sales\Model\Order $order) { $incrementId = $order->getIncrementId(); $billingAddress = $order->getBillingAddress(); $data = ['amount' => $order->getGrandTotal() * 100, 'desc' => __('Order # %1', [$incrementId]), 'first_name' => $billingAddress->getFirstname(), 'last_name' => $billingAddress->getLastname(), 'email' => $order->getCustomerEmail(), 'session_id' => $this->extOrderIdHelper->generate($order), 'order_id' => $incrementId]; $paytype = $this->session->getPaytype(); if ($paytype) { $data['pay_type'] = $paytype; $this->session->setPaytype(null); } return $data; }