fixed checkout

This commit is contained in:
Edward Yang 2022-07-04 17:52:17 +08:00
parent d92793e24e
commit 3b62b00b95
1 changed files with 6 additions and 7 deletions

View File

@ -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,