Example #1
0
 /**
  * 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();
 }
Example #2
0
 /**
  * Convert quote payment object to payment data object
  *
  * @param \Magento\Payment\Model\MethodInterface $object
  * @return \Magento\Checkout\Service\V1\Data\Cart\PaymentMethod
  */
 public function toDataObject(\Magento\Payment\Model\MethodInterface $object)
 {
     $data = [QuotePaymentMethod::CODE => $object->getCode(), QuotePaymentMethod::TITLE => $object->getTitle()];
     return $this->builder->populateWithArray($data)->create();
 }