feat: Implement default payment method for pickup and enhance payment method handling in CartTab and PaymentMethodSelector components
This commit is contained in:
@@ -80,8 +80,13 @@ class CheckoutValidation {
|
||||
return "wire";
|
||||
}
|
||||
|
||||
// Prefer stripe when available and meets minimum amount
|
||||
if (deliveryMethod === "DHL" || deliveryMethod === "DPD" || deliveryMethod === "Abholung") {
|
||||
// Pickup defaults to in-store payment
|
||||
if (deliveryMethod === "Abholung") {
|
||||
return "cash";
|
||||
}
|
||||
|
||||
// Prefer wire for shippable delivery methods
|
||||
if (deliveryMethod === "DHL" || deliveryMethod === "DPD") {
|
||||
return "wire";/*stripe*/
|
||||
}
|
||||
|
||||
@@ -96,9 +101,10 @@ class CheckoutValidation {
|
||||
const subtotal = cartItems.reduce((total, item) => total + item.price * item.quantity, 0);
|
||||
const totalAmount = subtotal + deliveryCost;
|
||||
|
||||
// Reset payment method if it's no longer valid
|
||||
// Reset "Nachnahme" when delivery is not DHL.
|
||||
// For pickup, default to in-store payment.
|
||||
if (deliveryMethod !== "DHL" && paymentMethod === "onDelivery") {
|
||||
newPaymentMethod = "wire";
|
||||
newPaymentMethod = deliveryMethod === "Abholung" ? "cash" : "wire";
|
||||
}
|
||||
|
||||
// Allow stripe for DHL, DPD, and Abholung delivery methods, but check minimum amount
|
||||
|
||||
Reference in New Issue
Block a user