/** * Convert quote payment object to payment data object * * @param \Magento\Sales\Model\Quote\Payment $object * @return QuotePaymentMethod */ public function toDataObject(\Magento\Sales\Model\Quote\Payment $object) { $data = [QuotePaymentMethod::METHOD => $object->getMethod(), QuotePaymentMethod::PO_NUMBER => $object->getPoNumber(), QuotePaymentMethod::CC_OWNER => $object->getCcOwner(), QuotePaymentMethod::CC_NUMBER => $object->getCcNumber(), QuotePaymentMethod::CC_TYPE => $object->getCcType(), QuotePaymentMethod::CC_EXP_YEAR => $object->getCcExpYear(), QuotePaymentMethod::CC_EXP_MONTH => $object->getCcExpMonth(), QuotePaymentMethod::PAYMENT_DETAILS => $object->getAdditionalData()]; return $this->builder->populateWithArray($data)->create(); }
/** * @param \Magento\Sales\Model\Quote\Payment $payment * @return \Magento\Sales\Model\Quote\Payment */ public function setPayment(\Magento\Sales\Model\Quote\Payment $payment) { if (!$this->getIsMultiPayment() && ($old = $this->getPayment())) { $payment->setId($old->getId()); } $this->addPayment($payment); return $payment; }
/** * Convert quote payment to order payment * * @param \Magento\Sales\Model\Quote\Payment $payment * @return \Magento\Sales\Model\Quote\Payment */ public function paymentToOrderPayment(\Magento\Sales\Model\Quote\Payment $payment) { /** @var \Magento\Sales\Model\Order\Payment $orderPayment */ $orderPayment = $this->_orderPaymentFactory->create()->setStoreId($payment->getStoreId()); $orderPayment->setCustomerPaymentId($payment->getCustomerPaymentId()); $this->_objectCopyService->copyFieldsetToTarget('sales_convert_quote_payment', 'to_order_payment', $payment, $orderPayment); $orderPayment->setAdditionalInformation(\Magento\Payment\Model\Method\Substitution::INFO_KEY_TITLE, $payment->getMethodInstance()->getTitle()); return $orderPayment; }