@autobusal/order-process 1.3.4 → 1.3.5
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 +6 -0
- package/Standard/Standard.tsx +27 -3
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.3.5
|
|
4
|
+
|
|
5
|
+
### Fixed
|
|
6
|
+
|
|
7
|
+
- **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.)
|
|
8
|
+
|
|
3
9
|
All notable changes to `@autobusal/order-process` are documented here. This
|
|
4
10
|
project adheres to [Keep a Changelog](https://keepachangelog.com/en/1.1.0/) and
|
|
5
11
|
[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,8 +12,30 @@ 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));
|
|
27
|
+
|
|
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]);
|
|
15
39
|
|
|
16
40
|
if (isSuccess) {
|
|
17
41
|
return <Navigate to={ data } />;
|
|
@@ -24,4 +48,4 @@ const Standard = ({ type, hash, t }: Props): JSX.Element => {
|
|
|
24
48
|
);
|
|
25
49
|
};
|
|
26
50
|
|
|
27
|
-
export default Standard;
|
|
51
|
+
export default Standard;
|