- public function savePaymentInformation(
- $cartId,
- $email,
- \Magento\Quote\Api\Data\PaymentInterface $paymentMethod,
- \Magento\Quote\Api\Data\AddressInterface $billingAddress = null
- ) {
- if ($billingAddress) {
- $billingAddress->setEmail($email);
- $this->billingAddressManagement->assign($cartId, $billingAddress);
- } else {
- $quoteIdMask = $this->quoteIdMaskFactory->create()->load($cartId, 'masked_id');
- $this->cartRepository->getActive($quoteIdMask->getQuoteId())->getBillingAddress()->setEmail($email);
- }
-
- $this->paymentMethodManagement->set($cartId, $paymentMethod);
- return true;
- }