From 8931afc6701cc873c47f4469019c842027cdf303 Mon Sep 17 00:00:00 2001 From: Michael Czechowski Date: Fri, 9 Oct 2026 02:32:32 +0200 Subject: [PATCH] feat(checkout): show a German message when a checkout step fails checkoutErrorMessage (utils/checkoutError.ts) maps the status and body of a failed request, the shop's answer or a raw CMS (Strapi) error, to one fixed message for the customer, addressed with "du": an invalid e-mail address (when data.email is among the rejected fields), other invalid input, an order already paid, a product no longer available, an order not ready for checkout (naming the missing steps), a payment that does not fit the order or an order changed during the payment ("Bitte starte die Zahlung neu"), PayPal not reachable ("versuche es in ein paar Minuten noch einmal"), a payment PayPal may have taken that the CMS could not confirm or record ("Bitte bezahle nicht noch einmal"), and a general fallback. It never shows the server's text. Steps 1 and 2 show the message above their submit button, in the style of step 3's payment error, instead of logging the error only. Step 3 shows it for a failed PayPal order creation or capture. The e-mail input of step 1 is type="email" (Input.vue takes a type). Refs https://git.librete.ch/libretech/mp/issues/71 --- components/Input.vue | 5 +- pages/checkout/1.vue | 10 +- pages/checkout/2.vue | 8 ++ pages/checkout/3.vue | 6 +- tests/unit/checkoutError.test.ts | 185 +++++++++++++++++++++++++++++++ utils/checkoutError.ts | 98 ++++++++++++++++ 6 files changed, 309 insertions(+), 3 deletions(-) create mode 100644 tests/unit/checkoutError.test.ts create mode 100644 utils/checkoutError.ts diff --git a/components/Input.vue b/components/Input.vue index 6be8034..8f47616 100644 --- a/components/Input.vue +++ b/components/Input.vue @@ -5,6 +5,7 @@ {{ label }} (), { - autocomplete: "off" + autocomplete: "off", + type: "text" } ); diff --git a/pages/checkout/1.vue b/pages/checkout/1.vue index 3d59010..0b0ffc3 100644 --- a/pages/checkout/1.vue +++ b/pages/checkout/1.vue @@ -29,7 +29,7 @@
- +
@@ -60,6 +64,7 @@