@autobusal/order-confirm 1.2.1 → 1.2.2

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,9 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.2.2 - 2026-08-29
4
+
5
+ - The purchase confirmation shows the real PNR rather than the internal hash from its own URL (audit A3-03h) - the email, the ticket and the invoice all name the PNR, and it is the code /viewtrip and a support desk accept. Falls back to the hash, so the page can always confirm.
6
+
3
7
  ## 1.2.1
4
8
 
5
9
  ### Fixed
package/OrderConfirm.tsx CHANGED
@@ -9,7 +9,7 @@ import Reason from './Reason';
9
9
  import Telegram from './Telegram/Telegram';
10
10
  import { Title, Actions } from './styles';
11
11
  import { useUserStore } from '@autobusal/providers/stores/user';
12
- import { useReleaseOrder } from './services';
12
+ import { useReleaseOrder, useGetOrderNumber } from './services';
13
13
  import { flush } from '@autobusal/providers/Setup/commerce';
14
14
 
15
15
  interface Props {
@@ -40,6 +40,10 @@ const OrderConfirm = ({ t }: Props): (JSX.Element | null) => {
40
40
 
41
41
  const { data: UserData } = useUserStore();
42
42
 
43
+ const { data: NumberData } = useGetOrderNumber(hash);
44
+
45
+ const orderNumber = NumberData?.order_number ?? String(hash ?? '');
46
+
43
47
  /*
44
48
  * Claude - 2026-08-22 (audit finding BOOK-11-b): this page is where the
45
49
  * gateway's cancelUrl AND failUrl land, and it used to say "your order
@@ -131,8 +135,16 @@ const OrderConfirm = ({ t }: Props): (JSX.Element | null) => {
131
135
  { t(`order_confirm.title.${ type }`) }
132
136
  </Title>
133
137
 
138
+ { /* Claude - 2026-08-29 (audit A3-03h, low): the booking's REAL order
139
+ number, not the URL hash. This page announced the 15-character
140
+ Hashids token as "your order with number ..." while the email, the
141
+ ticket and the invoice all named the six-character PNR - and the
142
+ PNR is what /viewtrip's own Order Number field accepts and what a
143
+ support desk can look up. Falls back to the hash while the lookup
144
+ is in flight or if it fails, which is exactly what was shown
145
+ before, so a confirmation page can still always confirm. */ }
134
146
  <div className="box" dangerouslySetInnerHTML={{
135
- __html: t(`order_confirm.content.${ type === 'cancelled' && released ? 'released' : type }`, { order: `<strong>${ escapeHtml(String(hash ?? '')) }</strong>` })
147
+ __html: t(`order_confirm.content.${ type === 'cancelled' && released ? 'released' : type }`, { order: `<strong>${ escapeHtml(orderNumber) }</strong>` })
136
148
  }} />
137
149
 
138
150
  <>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@autobusal/order-confirm",
3
- "version": "1.2.1",
3
+ "version": "1.2.2",
4
4
  "author": "Ferjolt Ozuni",
5
5
  "type": "module",
6
6
  "main": "index.ts"
package/services.ts CHANGED
@@ -36,6 +36,31 @@ export const useGetOrderTelegramStatus = (hash: string): UseQueryResult<OrderTel
36
36
  })
37
37
  );
38
38
 
39
+ /**
40
+ * The booking's real Order Number, from the hash this page was given.
41
+ *
42
+ * Claude - 2026-08-29 (audit A3-03h, low). The confirmation had only the URL
43
+ * hash and printed it as "your order with number gnl3d5kolxpw78q", while the
44
+ * email, the ticket and the invoice for the same booking all said ZRQGV2 -
45
+ * and ZRQGV2 is the code the /viewtrip lookup and a support desk actually
46
+ * accept. Not retried and allowed to fail: a confirmation page must never
47
+ * fail to confirm, so the caller falls back to the hash.
48
+ */
49
+ export const useGetOrderNumber = (hash?: string): UseQueryResult<{ order_number: string }> => (
50
+ useQuery({
51
+ queryKey: ['order-number', hash],
52
+ enabled: hash !== undefined && hash !== '',
53
+ retry: false,
54
+ queryFn: async () => (
55
+ await apiClient
56
+ .get('/api/orders/number', { params: { hash } })
57
+ .then(response => (
58
+ response.data
59
+ ))
60
+ )
61
+ })
62
+ );
63
+
39
64
  /*
40
65
  * Claude - 2026-08-22 (audit finding BOOK-11-b): the "cancelled" return
41
66
  * page used to claim the order was cancelled while the reservation kept