@autobusal/routes-order 1.33.2 → 1.33.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.33.3
4
+
5
+ ### Fixed
6
+
7
+ - **Checkout swallowed every booking error.** A 4xx from order creation - a seat taken while the form was open, the unpaid-hold limit, a route gone unavailable - left the buyer on the filled form with no message. It now surfaces the API's message. (Audit BOOK-13-c.)
8
+
3
9
  ## 1.33.2
4
10
 
5
11
  ### Fixed
@@ -27,6 +27,7 @@ import { useGetSettings } from '@autobusal/providers/services';
27
27
  import { usePostOrder, useGetFlex, useGetPayments, useGetSavedPassengers } from '../services';
28
28
  import { addon as commerceAddon, beginCheckout, stash } from '@autobusal/providers/Setup/commerce';
29
29
  import { item as commerceItem } from '../commerce';
30
+ import { error as notifyError } from '@autobusal/utilities';
30
31
 
31
32
  interface Props {
32
33
  values?: PersonData
@@ -351,6 +352,20 @@ const Checkout = ({ values, step1, step2, step3, isPartner, t, onStore, onBack }
351
352
  );
352
353
 
353
354
  navigate(`/orders/process/${ action }/${ hash }`);
355
+ },
356
+ /*
357
+ * Edited: Claude - Date: 2026-08-22 (audit finding BOOK-13-c)
358
+ *
359
+ * Surface why the booking was refused. Every 4xx from order creation -
360
+ * a seat taken while the form was open, the unpaid-hold limit, a route
361
+ * that just went unavailable - left the buyer on the filled form with
362
+ * no message, clicking Pay again. The API's own message says exactly
363
+ * what happened.
364
+ */
365
+ onError: (submitError: unknown) => {
366
+ const message = (submitError as { response?: { data?: { message?: string } } })?.response?.data?.message;
367
+
368
+ notifyError(message ?? t('routes_order.checkout.error', { ns: 'common', defaultValue: 'We could not complete your booking. Please try again.' }));
354
369
  }
355
370
  });
356
371
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@autobusal/routes-order",
3
- "version": "1.33.2",
3
+ "version": "1.33.3",
4
4
  "author": "Ferjolt Ozuni",
5
5
  "type": "module",
6
6
  "main": "index.ts"