/**
  * {@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;
 }
 public function testGetAvailableMethods()
 {
     $storeId = 1;
     $quoteMock = $this->getMock('\\Magento\\Quote\\Model\\Quote', [], [], '', false);
     $quoteMock->expects($this->once())->method('getStoreId')->will($this->returnValue($storeId));
     $quoteMock->expects($this->atLeastOnce())->method('getPayment')->will($this->returnValue($this->getMock('\\Magento\\Quote\\Model\\Quote\\Payment', [], [], '', false)));
     $methodMock = $this->getMock('Magento\\Payment\\Model\\Method\\AbstractMethod', [], [], '', false);
     $compositeMock = $this->getMock('\\Magento\\Payment\\Model\\Checks\\Composite', [], [], '', false);
     $compositeMock->expects($this->atLeastOnce())->method('isApplicable')->with($methodMock, $quoteMock)->will($this->returnValue(true));
     $this->specificationFactoryMock->expects($this->atLeastOnce())->method('create')->will($this->returnValue($compositeMock));
     $storeMethods = [$methodMock];
     $this->paymentHelperMock->expects($this->once())->method('getStoreMethods')->with($storeId, $quoteMock)->will($this->returnValue($storeMethods));
     $methodMock->expects($this->atLeastOnce())->method('setInfoInstance')->with($this->getMock('\\Magento\\Quote\\Model\\Quote\\Payment', [], [], '', false))->will($this->returnSelf());
     $this->assertEquals([$methodMock], $this->methodList->getAvailableMethods($quoteMock));
 }
 /**
  * {@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;
 }
 /**
  * {@inheritdoc}
  */
 public function getList($cartId)
 {
     /** @var \Magento\Quote\Model\Quote $quote */
     $quote = $this->quoteRepository->get($cartId);
     return $this->methodList->getAvailableMethods($quote);
 }