Example #1
0
 /**
  * @return \Magento\Quote\Model\Quote\Payment
  */
 public function getPayment()
 {
     if (null === $this->_currentPayment || !$this->_currentPayment) {
         $this->_currentPayment = $this->_quotePaymentCollectionFactory->create()->setQuoteFilter($this->getId())->getFirstItem();
     }
     if ($payment = $this->_currentPayment) {
         if ($this->getId()) {
             $payment->setQuote($this);
         }
         if (!$payment->isDeleted()) {
             return $payment;
         }
     }
     $payment = $this->_quotePaymentFactory->create();
     $this->addPayment($payment);
     return $payment;
 }