feat: Implement default payment method for pickup and enhance payment method handling in CartTab and PaymentMethodSelector components

This commit is contained in:
sebseb7
2026-03-24 06:51:47 +01:00
parent e6f3fb7c18
commit 1840512aac
3 changed files with 43 additions and 8 deletions

View File

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