Esempio n. 1
0
 /**
  * {@inheritdoc}
  */
 public function getList($cartId)
 {
     $output = [];
     /** @var \Magento\Sales\Model\Quote $quote */
     $quote = $this->quoteRepository->get($cartId);
     foreach ($this->methodList->getAvailableMethods($quote) as $method) {
         $output[] = $this->paymentMethodConverter->toDataObject($method);
     }
     return $output;
 }
Esempio n. 2
0
 public function testConvertQuotePaymentObjectToPaymentDataObject()
 {
     $methodMock = $this->getMock('\\Magento\\Payment\\Model\\Method\\AbstractMethod', [], [], '', false);
     $methodMock->expects($this->once())->method('getCode')->will($this->returnValue('paymentCode'));
     $methodMock->expects($this->once())->method('getTitle')->will($this->returnValue('paymentTitle'));
     $data = [PaymentMethod::TITLE => 'paymentTitle', PaymentMethod::CODE => 'paymentCode'];
     $this->paymentMethodBuilderMock->expects($this->once())->method('populateWithArray')->with($data)->will($this->returnSelf());
     $paymentMethodMock = $this->getMock('\\Magento\\Checkout\\Service\\V1\\Data\\PaymentMethod', [], [], '', false);
     $this->paymentMethodBuilderMock->expects($this->once())->method('create')->will($this->returnValue($paymentMethodMock));
     $this->assertEquals($paymentMethodMock, $this->converter->toDataObject($methodMock));
 }
Esempio n. 3
0
 /**
  * {@inheritdoc}
  */
 public function getList($cartId)
 {
     $output = [];
     /** @var \Magento\Sales\Model\Quote $quote */
     $quote = $this->quoteLoader->load($cartId, $this->storeManager->getStore()->getId());
     foreach ($this->methodList->getAvailableMethods($quote) as $method) {
         $output[] = $this->paymentMethodConverter->toDataObject($method);
     }
     return $output;
 }