From 3b62b00b9599af6bd4be745cf2e4fe15ef97d45b Mon Sep 17 00:00:00 2001 From: Edward Yang Date: Mon, 4 Jul 2022 17:52:17 +0800 Subject: [PATCH] fixed checkout --- beike/Shop/Services/CheckoutService.php | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/beike/Shop/Services/CheckoutService.php b/beike/Shop/Services/CheckoutService.php index ceabcdfc..534b7557 100644 --- a/beike/Shop/Services/CheckoutService.php +++ b/beike/Shop/Services/CheckoutService.php @@ -102,9 +102,8 @@ class CheckoutService */ public function checkoutData(): array { - $customer = current_customer(); - - $addresses = AddressRepo::listByCustomer(current_customer()); + $customer = $this->customer; + $addresses = AddressRepo::listByCustomer($customer); $shipments = ShippingMethodItem::collection(PluginRepo::getShippingMethods())->jsonSerialize(); $payments = PaymentMethodItem::collection(PluginRepo::getPaymentMethods())->jsonSerialize(); @@ -113,10 +112,10 @@ class CheckoutService $data = [ 'current' => [ - 'shipping_address_id' => 7, - 'payment_address_id' => 3, - 'shipping_method' => 'flat_shipping', - 'payment_method' => 'bk_stripe', + 'shipping_address_id' => $this->cart->shipping_address_id, + 'shipping_method_code' => $this->cart->shipping_method_code, + 'payment_address_id' => $this->cart->payment_address_id, + 'payment_method_code' => $this->cart->payment_method_code, ], 'country_id' => (int)setting('country_id'), 'customer_id' => $customer->id ?? null,