fixed checkout
This commit is contained in:
parent
c4c2f81478
commit
e0e841071b
|
|
@ -46,20 +46,23 @@ class CheckoutService
|
||||||
public function update($requestData): array
|
public function update($requestData): array
|
||||||
{
|
{
|
||||||
$shippingAddressId = $requestData['shipping_address_id'] ?? 0;
|
$shippingAddressId = $requestData['shipping_address_id'] ?? 0;
|
||||||
|
$shippingMethodCode = $requestData['shipping_method_code'] ?? '';
|
||||||
|
|
||||||
$paymentAddressId = $requestData['payment_address_id'] ?? 0;
|
$paymentAddressId = $requestData['payment_address_id'] ?? 0;
|
||||||
$shippingMethod = $requestData['shipping_method'] ?? '';
|
$paymentMethodCode = $requestData['payment_method_code'] ?? '';
|
||||||
$paymentMethod = $requestData['payment_method'] ?? '';
|
|
||||||
if ($shippingAddressId) {
|
if ($shippingAddressId) {
|
||||||
$this->updateShippingAddressId($shippingAddressId);
|
$this->updateShippingAddressId($shippingAddressId);
|
||||||
}
|
}
|
||||||
|
if ($shippingMethodCode) {
|
||||||
|
$this->updateShippingMethod($shippingMethodCode);
|
||||||
|
}
|
||||||
|
|
||||||
if ($paymentAddressId) {
|
if ($paymentAddressId) {
|
||||||
$this->updatePaymentAddressId($shippingAddressId);
|
$this->updatePaymentAddressId($shippingAddressId);
|
||||||
}
|
}
|
||||||
if ($shippingMethod) {
|
if ($paymentMethodCode) {
|
||||||
$this->updateShippingMethod($shippingMethod);
|
$this->updatePaymentMethod($paymentMethodCode);
|
||||||
}
|
|
||||||
if ($paymentMethod) {
|
|
||||||
$this->updatePaymentMethod($paymentMethod);
|
|
||||||
}
|
}
|
||||||
return $this->checkoutData();
|
return $this->checkoutData();
|
||||||
}
|
}
|
||||||
|
|
@ -85,14 +88,14 @@ class CheckoutService
|
||||||
$this->cart->update(['payment_address_id' => $paymentAddressId]);
|
$this->cart->update(['payment_address_id' => $paymentAddressId]);
|
||||||
}
|
}
|
||||||
|
|
||||||
private function updateShippingMethod($shippingMethod)
|
private function updateShippingMethod($shippingMethodCode)
|
||||||
{
|
{
|
||||||
$this->cart->update(['shipping_method_code' => $shippingMethod]);
|
$this->cart->update(['shipping_method_code' => $shippingMethodCode]);
|
||||||
}
|
}
|
||||||
|
|
||||||
private function updatePaymentMethod($paymentMethod)
|
private function updatePaymentMethod($paymentMethodCode)
|
||||||
{
|
{
|
||||||
$this->cart->update(['payment_method_code' => $paymentMethod]);
|
$this->cart->update(['payment_method_code' => $paymentMethodCode]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue