From 5ee65fd9e09ba33849ebc77d48d12396cb8a9f42 Mon Sep 17 00:00:00 2001 From: Cole Denslow <33993134+BoldCole@users.noreply.github.com> Date: Tue, 6 Feb 2024 09:42:58 -0600 Subject: [PATCH] [PS-768] Fix Bold payments for guest customers (#37) --- Checkout/Service/Extractor/Quote.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/Checkout/Service/Extractor/Quote.php b/Checkout/Service/Extractor/Quote.php index db31744..d781faa 100644 --- a/Checkout/Service/Extractor/Quote.php +++ b/Checkout/Service/Extractor/Quote.php @@ -83,13 +83,17 @@ private static function extractQuote(Mage_Sales_Model_Quote $quote) private static function extractCustomer(Mage_Sales_Model_Quote $quote) { $customer = $quote->getCustomer(); - if ($quote->getCustomerIsGuest()) { + if ($quote->getCustomerIsGuest() || $customer->getId() == null) { return [ - 'email' => $customer->getEmail(), - 'firstname' => $customer->getFirstname(), - 'lastname' => $customer->getLastname(), + 'email' => $customer->getEmail() + ?: $quote->getBillingAddress()->getEmail(), + 'firstname' => $customer->getFirstname() + ?: $quote->getBillingAddress()->getFirstname(), + 'lastname' => $customer->getLastname() + ?: $quote->getBillingAddress()->getLastname(), ]; } + return current(Bold_Checkout_Service_Extractor_Customer::extract([$customer])); } }