예제 #1
0
파일: Order.php 프로젝트: aiesh/magento2
 /**
  * Convert order payment to quote payment
  *
  * @param \Magento\Sales\Model\Order\Payment $payment
  * @param null|\Magento\Sales\Model\Quote\Payment $quotePayment
  * @return \Magento\Sales\Model\Quote\Payment
  */
 public function paymentToQuotePayment(\Magento\Sales\Model\Order\Payment $payment, $quotePayment = null)
 {
     if (!$quotePayment instanceof \Magento\Sales\Model\Quote\Payment) {
         $quotePayment = $this->_quotePaymentFactory->create();
     }
     $quotePayment->setStoreId($payment->getStoreId())->setCustomerPaymentId($payment->getCustomerPaymentId());
     $this->_objectCopyService->copyFieldsetToTarget('sales_convert_order_payment', 'to_quote_payment', $payment, $quotePayment);
     return $quotePayment;
 }
예제 #2
0
 /**
  * @return \Magento\Sales\Model\Quote\Payment
  */
 public function getPayment()
 {
     foreach ($this->getPaymentsCollection() as $payment) {
         if (!$payment->isDeleted()) {
             return $payment;
         }
     }
     $payment = $this->_quotePaymentFactory->create();
     $this->addPayment($payment);
     return $payment;
 }