/**
  * {@inheritDoc}
  */
 public function savePaymentInformation($cartId, \Magento\Quote\Api\Data\PaymentInterface $paymentMethod, \Magento\Quote\Api\Data\AddressInterface $billingAddress = null)
 {
     if ($billingAddress) {
         $this->billingAddressManagement->assign($cartId, $billingAddress);
     }
     $this->paymentMethodManagement->set($cartId, $paymentMethod);
     return true;
 }
 /**
  * {@inheritDoc}
  */
 public function collectTotals($cartId, \Magento\Quote\Api\Data\PaymentInterface $paymentMethod, $shippingCarrierCode = null, $shippingMethodCode = null, \Magento\Quote\Api\Data\TotalsAdditionalDataInterface $additionalData = null)
 {
     if ($shippingCarrierCode && $shippingMethodCode) {
         $this->shippingMethodManagement->set($cartId, $shippingCarrierCode, $shippingMethodCode);
     }
     $this->paymentMethodManagement->set($cartId, $paymentMethod);
     if ($additionalData !== null) {
         $this->dataProcessor->process($additionalData, $cartId);
     }
     return $this->cartTotalsRepository->get($cartId);
 }
 /**
  * Saves payment information in quote
  *
  * @param Object $response
  * @return void
  */
 public function savePaymentInQuote($response)
 {
     $quote = $this->quoteRepository->get($this->sessionTransparent->getQuoteId());
     /** @var InfoInterface $payment */
     $payment = $this->paymentManagement->get($quote->getId());
     $payment->setAdditionalInformation('pnref', $response->getPnref());
     $this->errorHandler->handle($payment, $response);
     $this->paymentManagement->set($quote->getId(), $payment);
 }
 /**
  * {@inheritdoc}
  */
 public function set($cartId, \Magento\Quote\Api\Data\PaymentInterface $method)
 {
     /** @var $quoteIdMask QuoteIdMask */
     $quoteIdMask = $this->quoteIdMaskFactory->create()->load($cartId, 'masked_id');
     return $this->paymentMethodManagement->set($quoteIdMask->getQuoteId(), $method);
 }