@autobusal/order-process 1.3.4 → 1.3.6
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 +12 -0
- package/Standard/Standard.tsx +44 -4
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.3.6
|
|
4
|
+
|
|
5
|
+
### Fixed
|
|
6
|
+
|
|
7
|
+
- **A 200 with an empty body no longer navigates to the homepage** while the order sits reserved - the confirmation path is only followed when the API actually named one. (Audit BOOK-04-b.)
|
|
8
|
+
|
|
9
|
+
## 1.3.5
|
|
10
|
+
|
|
11
|
+
### Fixed
|
|
12
|
+
|
|
13
|
+
- **A refused funds payment spun forever.** The standard (funds/reserve) processor had only a success branch, so an agent's "not enough funds" left the page on "Processing your order" with no message and the order stuck reserved. It now surfaces the API's own message and returns the buyer so they can try again. (Platform audit BOOK-05-c.)
|
|
14
|
+
|
|
3
15
|
All notable changes to `@autobusal/order-process` are documented here. This
|
|
4
16
|
project adheres to [Keep a Changelog](https://keepachangelog.com/en/1.1.0/) and
|
|
5
17
|
[Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
package/Standard/Standard.tsx
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import { useEffect } from 'react';
|
|
1
2
|
import { TFunction } from 'i18next';
|
|
2
|
-
import { Navigate } from 'react-router-dom';
|
|
3
|
+
import { Navigate, useNavigate } from 'react-router-dom';
|
|
3
4
|
import { Inline } from '@autobusal/common';
|
|
5
|
+
import { error as notifyError } from '@autobusal/utilities';
|
|
4
6
|
import { Container } from '../styles';
|
|
5
7
|
import { useMakeStandard } from '../services';
|
|
6
8
|
|
|
@@ -10,13 +12,51 @@ interface Props {
|
|
|
10
12
|
t: TFunction<'common'>
|
|
11
13
|
}
|
|
12
14
|
|
|
15
|
+
/*
|
|
16
|
+
* Edited: Claude - Date: 2026-08-22 (audit finding BOOK-05-c)
|
|
17
|
+
*
|
|
18
|
+
* This had only an isSuccess branch, so a refused payment - most visibly an
|
|
19
|
+
* agent's "not enough funds" - left the page spinning on "Processing your
|
|
20
|
+
* order" forever, with no message and no way out. The reserved order just
|
|
21
|
+
* sat there. Now a failure surfaces the API's own message (the funds gate
|
|
22
|
+
* returns exactly the text the agent needs) and returns them to where they
|
|
23
|
+
* were, so they can top up and try again - the reservation is still theirs.
|
|
24
|
+
*/
|
|
13
25
|
const Standard = ({ type, hash, t }: Props): JSX.Element => {
|
|
14
|
-
const { data, isSuccess } = useMakeStandard(String(type), String(hash));
|
|
26
|
+
const { data, isSuccess, isError, error } = useMakeStandard(String(type), String(hash));
|
|
15
27
|
|
|
16
|
-
|
|
28
|
+
const navigate = useNavigate();
|
|
29
|
+
|
|
30
|
+
useEffect(() => {
|
|
31
|
+
if (isError) {
|
|
32
|
+
const message = (error as { response?: { data?: { message?: string } } })?.response?.data?.message;
|
|
33
|
+
|
|
34
|
+
notifyError(message ?? t('order_process.error', { ns: 'common', defaultValue: 'We could not complete your order. Please try again.' }));
|
|
35
|
+
|
|
36
|
+
navigate(-1);
|
|
37
|
+
}
|
|
38
|
+
}, [isError, error, navigate, t]);
|
|
39
|
+
|
|
40
|
+
/*
|
|
41
|
+
* Claude - 2026-08-22 (audit finding BOOK-04-b): a 200 whose body is
|
|
42
|
+
* empty or not the expected path string used to make this
|
|
43
|
+
* <Navigate to=""> - which lands on the HOMEPAGE while the order sits
|
|
44
|
+
* reserved, silently. Measured once in the audit (an intermittent BFF
|
|
45
|
+
* hiccup); never navigate anywhere that isn't the confirmation the API
|
|
46
|
+
* actually named.
|
|
47
|
+
*/
|
|
48
|
+
if (isSuccess && typeof data === 'string' && data.startsWith('/')) {
|
|
17
49
|
return <Navigate to={ data } />;
|
|
18
50
|
}
|
|
19
51
|
|
|
52
|
+
if (isSuccess) {
|
|
53
|
+
return (
|
|
54
|
+
<Container>
|
|
55
|
+
<Inline text={ t('order_process.error', { ns: 'common', defaultValue: 'We could not confirm your order. Please open your orders to check its state.' }) } />
|
|
56
|
+
</Container>
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
|
|
20
60
|
return (
|
|
21
61
|
<Container>
|
|
22
62
|
<Inline text={ t('order_process.loading') } />
|
|
@@ -24,4 +64,4 @@ const Standard = ({ type, hash, t }: Props): JSX.Element => {
|
|
|
24
64
|
);
|
|
25
65
|
};
|
|
26
66
|
|
|
27
|
-
export default Standard;
|
|
67
|
+
export default Standard;
|