@autobusal/order-process 1.3.1 → 1.3.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/BKT/Bkt.tsx +22 -2
- package/CHANGELOG.md +37 -0
- package/Mollie/Mollie.tsx +17 -1
- package/Nexi/Nexi.tsx +17 -1
- package/Reiffeisen/Raiffeisen.tsx +20 -1
- package/Stripe/Stripe.tsx +17 -1
- package/package.json +2 -1
- package/types.ts +1 -0
package/BKT/Bkt.tsx
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { useEffect, useRef } from 'react';
|
|
2
2
|
import { TFunction } from 'i18next';
|
|
3
3
|
import { useForm } from 'react-hook-form';
|
|
4
|
+
import { useNavigate } from 'react-router-dom';
|
|
4
5
|
import { Inline } from '@autobusal/common';
|
|
5
6
|
import { Container } from '../styles';
|
|
6
7
|
import { BKTFormData } from '../types';
|
|
@@ -16,7 +17,9 @@ const Bkt = ({ hash, t }: Props): JSX.Element => {
|
|
|
16
17
|
|
|
17
18
|
const ref = useRef<HTMLFormElement>(null);
|
|
18
19
|
|
|
19
|
-
const { data, isLoading, isSuccess } = useMakeBkt(String(hash));
|
|
20
|
+
const { data, isLoading, isSuccess, isError } = useMakeBkt(String(hash));
|
|
21
|
+
|
|
22
|
+
const navigate = useNavigate();
|
|
20
23
|
|
|
21
24
|
const onSubmit = (): void => {
|
|
22
25
|
ref.current?.submit();
|
|
@@ -28,6 +31,18 @@ const Bkt = ({ hash, t }: Props): JSX.Element => {
|
|
|
28
31
|
}
|
|
29
32
|
}, [isSuccess, handleSubmit]);
|
|
30
33
|
|
|
34
|
+
// Edited: Ferjolt Ozuni - Date: 2026-07-18
|
|
35
|
+
// Bug: unlike the other 4 gateways, BKT never even reached an isSuccess
|
|
36
|
+
// state on failure (isLoading just stayed true), so this stuck on the
|
|
37
|
+
// loading text forever with no way out. Fix: navigate back so they can
|
|
38
|
+
// retry. Same fix as Raiffeisen/Stripe/Mollie/Nexi (see Raiffeisen.tsx for
|
|
39
|
+
// the full explanation, including why there's no toast() call here).
|
|
40
|
+
useEffect(() => {
|
|
41
|
+
if (isError) {
|
|
42
|
+
navigate(-1);
|
|
43
|
+
}
|
|
44
|
+
}, [isError, navigate]);
|
|
45
|
+
|
|
31
46
|
if (isLoading) {
|
|
32
47
|
return (
|
|
33
48
|
<Container>
|
|
@@ -40,7 +55,12 @@ const Bkt = ({ hash, t }: Props): JSX.Element => {
|
|
|
40
55
|
<Container>
|
|
41
56
|
<Inline text={ t('order_process.bkt') } />
|
|
42
57
|
|
|
43
|
-
|
|
58
|
+
{ /* Edited: Ferjolt Ozuni - Date: 2026-07-24
|
|
59
|
+
Bug: the gateway URL was hardcoded here instead of read from the
|
|
60
|
+
label's own configured BKT credentials (which already have an
|
|
61
|
+
editable 'url' field in the admin GUI, just unused). Now reads
|
|
62
|
+
data.url, returned by Prepare::addAccountData() in obtapi. */ }
|
|
63
|
+
<form ref={ ref } action={ data?.url } method="POST" onSubmit={ handleSubmit(onSubmit) }>
|
|
44
64
|
<input type="hidden" defaultValue={ data?.clientId } { ...register('clientid') } />
|
|
45
65
|
<input type="hidden" defaultValue={ data?.storetype } { ...register('storetype') } />
|
|
46
66
|
<input type="hidden" defaultValue={ data?.trantype } { ...register('trantype') } />
|
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to `@autobusal/order-process` are documented here. This
|
|
4
|
+
project adheres to [Keep a Changelog](https://keepachangelog.com/en/1.1.0/) and
|
|
5
|
+
[Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
6
|
+
|
|
7
|
+
## [1.3.3] - 2026-07-24
|
|
8
|
+
|
|
9
|
+
### Fixed
|
|
10
|
+
|
|
11
|
+
- **`BKT/Bkt.tsx` was submitting a nearly-blank form to the bank.** The component reads camelCase fields (`clientId`, `orderId`, `fullName`, `postalCode`, etc.) matching the `BKTData` type, but `BKTController::make()` on the backend was returning a differently-shaped payload (raw bank field names like `clientid`, `ObtBktId`, `ShippingNameSurname`) with none of the expected keys present — every hidden input except `amount`/`description`/`rnd`/`hash`/`refreshtime` was silently `undefined`. Fixed on the obtapi side (`Prepare::$data` is now what's returned); no change needed here beyond adding the new `url` field.
|
|
12
|
+
- The gateway URL was hardcoded (`https://pgw.bkt.com.al/fim/est3Dgate`) instead of read from the label's own configured BKT credentials. Now reads `data.url`, which the admin GUI already has an editable field for.
|
|
13
|
+
|
|
14
|
+
## [1.3.2] - 2026-07-19
|
|
15
|
+
|
|
16
|
+
### Fixed
|
|
17
|
+
|
|
18
|
+
- **Payment-initiation failures no longer strand the user on a spinner.** The
|
|
19
|
+
five gateway components — `Reiffeisen/Raiffeisen.tsx`, `Stripe/Stripe.tsx`,
|
|
20
|
+
`Mollie/Mollie.tsx`, `Nexi/Nexi.tsx`, and `BKT/Bkt.tsx` — previously only
|
|
21
|
+
reacted to `isSuccess`. When the `useMake*` payment-initiation request
|
|
22
|
+
failed (gateway auth failure, no funds, etc.), the component sat on
|
|
23
|
+
"Preparing to take you to the payment portal…" indefinitely with no feedback
|
|
24
|
+
and no way out except leaving the page. Each now also consumes `isError`
|
|
25
|
+
from its query and, in an effect, calls `navigate(-1)` to return the user so
|
|
26
|
+
they can retry. No local `toast()`/`error()` is raised on purpose: the
|
|
27
|
+
`@autobusal/providers` Axios response interceptor already surfaces one toast
|
|
28
|
+
per 422/500, and adding another here stacked a duplicate.
|
|
29
|
+
- **BKT loading state could never resolve on failure (`BKT/Bkt.tsx`).** Unlike
|
|
30
|
+
the other four gateways, BKT never reached an `isSuccess` state on failure —
|
|
31
|
+
`isLoading` simply stayed `true` — so it was stuck on the loading text
|
|
32
|
+
forever. The new `isError` → `navigate(-1)` handling gives it the same exit
|
|
33
|
+
path as the others.
|
|
34
|
+
|
|
35
|
+
Authored by Ferjolt Ozuni. Consolidated from the magus and alvavel whitelabel
|
|
36
|
+
patch sets into canonical @autobusal source (eliminates per-repo patch-package
|
|
37
|
+
divergence).
|
package/Mollie/Mollie.tsx
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { useEffect } from 'react';
|
|
2
2
|
import { TFunction } from 'i18next';
|
|
3
|
+
import { useNavigate } from 'react-router-dom';
|
|
3
4
|
import { Inline } from '@autobusal/common';
|
|
4
5
|
import { Container } from '../styles';
|
|
5
6
|
import { useMakeMollie } from '../services';
|
|
@@ -10,7 +11,9 @@ interface Props {
|
|
|
10
11
|
}
|
|
11
12
|
|
|
12
13
|
const Mollie = ({ hash, t }: Props): JSX.Element => {
|
|
13
|
-
const { data, isSuccess } = useMakeMollie(String(hash));
|
|
14
|
+
const { data, isSuccess, isError } = useMakeMollie(String(hash));
|
|
15
|
+
|
|
16
|
+
const navigate = useNavigate();
|
|
14
17
|
|
|
15
18
|
useEffect(() => {
|
|
16
19
|
if (isSuccess) {
|
|
@@ -18,6 +21,19 @@ const Mollie = ({ hash, t }: Props): JSX.Element => {
|
|
|
18
21
|
}
|
|
19
22
|
}, [data, isSuccess]);
|
|
20
23
|
|
|
24
|
+
// Edited: Ferjolt Ozuni - Date: 2026-07-18
|
|
25
|
+
// Bug: this only ever checked isSuccess - a failed payment-initiation
|
|
26
|
+
// request left the user staring at "Preparing to take you to the payment
|
|
27
|
+
// portal..." forever with no feedback at all. Fix: navigate back so they
|
|
28
|
+
// can retry. Same fix applied identically to Raiffeisen/Stripe/Nexi/Bkt
|
|
29
|
+
// (see Raiffeisen.tsx for the full explanation, including why there's no
|
|
30
|
+
// toast() call here).
|
|
31
|
+
useEffect(() => {
|
|
32
|
+
if (isError) {
|
|
33
|
+
navigate(-1);
|
|
34
|
+
}
|
|
35
|
+
}, [isError, navigate]);
|
|
36
|
+
|
|
21
37
|
return (
|
|
22
38
|
<Container>
|
|
23
39
|
<Inline text={ t('order_process.mollie') } />
|
package/Nexi/Nexi.tsx
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { useEffect } from 'react';
|
|
2
2
|
import { TFunction } from 'i18next';
|
|
3
|
+
import { useNavigate } from 'react-router-dom';
|
|
3
4
|
import { Inline } from '@autobusal/common';
|
|
4
5
|
import { Container } from '../styles';
|
|
5
6
|
import { useMakeNexi } from '../services';
|
|
@@ -10,7 +11,9 @@ interface Props {
|
|
|
10
11
|
}
|
|
11
12
|
|
|
12
13
|
const Nexi = ({ hash, t }: Props): JSX.Element => {
|
|
13
|
-
const { data, isSuccess } = useMakeNexi(String(hash));
|
|
14
|
+
const { data, isSuccess, isError } = useMakeNexi(String(hash));
|
|
15
|
+
|
|
16
|
+
const navigate = useNavigate();
|
|
14
17
|
|
|
15
18
|
useEffect(() => {
|
|
16
19
|
if (isSuccess) {
|
|
@@ -18,6 +21,19 @@ const Nexi = ({ hash, t }: Props): JSX.Element => {
|
|
|
18
21
|
}
|
|
19
22
|
}, [data, isSuccess]);
|
|
20
23
|
|
|
24
|
+
// Edited: Ferjolt Ozuni - Date: 2026-07-18
|
|
25
|
+
// Bug: this only ever checked isSuccess - a failed payment-initiation
|
|
26
|
+
// request left the user staring at "Preparing to take you to the payment
|
|
27
|
+
// portal..." forever with no feedback at all. Fix: navigate back so they
|
|
28
|
+
// can retry. Same fix applied identically to Raiffeisen/Stripe/Mollie/Bkt
|
|
29
|
+
// (see Raiffeisen.tsx for the full explanation, including why there's no
|
|
30
|
+
// toast() call here).
|
|
31
|
+
useEffect(() => {
|
|
32
|
+
if (isError) {
|
|
33
|
+
navigate(-1);
|
|
34
|
+
}
|
|
35
|
+
}, [isError, navigate]);
|
|
36
|
+
|
|
21
37
|
return (
|
|
22
38
|
<Container>
|
|
23
39
|
<Inline text={ t('order_process.nexi') } />
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { useEffect } from 'react';
|
|
2
2
|
import { TFunction } from 'i18next';
|
|
3
|
+
import { useNavigate } from 'react-router-dom';
|
|
3
4
|
import { Inline } from '@autobusal/common';
|
|
4
5
|
import { Container } from '../styles';
|
|
5
6
|
import { useMakeRaiffeisen } from '../services';
|
|
@@ -10,7 +11,9 @@ interface Props {
|
|
|
10
11
|
}
|
|
11
12
|
|
|
12
13
|
const Raiffeisen = ({ hash, t }: Props): JSX.Element => {
|
|
13
|
-
const { data, isSuccess } = useMakeRaiffeisen(String(hash));
|
|
14
|
+
const { data, isSuccess, isError } = useMakeRaiffeisen(String(hash));
|
|
15
|
+
|
|
16
|
+
const navigate = useNavigate();
|
|
14
17
|
|
|
15
18
|
useEffect(() => {
|
|
16
19
|
if (isSuccess) {
|
|
@@ -18,6 +21,22 @@ const Raiffeisen = ({ hash, t }: Props): JSX.Element => {
|
|
|
18
21
|
}
|
|
19
22
|
}, [data, isSuccess]);
|
|
20
23
|
|
|
24
|
+
// Edited: Ferjolt Ozuni - Date: 2026-07-18
|
|
25
|
+
// Bug: this only ever checked isSuccess - a failed payment-initiation
|
|
26
|
+
// request (gateway auth failure, no funds, etc) left the user staring
|
|
27
|
+
// at "Preparing to take you to the payment portal..." forever with no
|
|
28
|
+
// feedback at all and no way out except leaving the page. Fix: navigate
|
|
29
|
+
// them back so they can retry. No toast() call here - apiClient's Axios
|
|
30
|
+
// response interceptor (@autobusal/providers/Queries/apiClient.ts)
|
|
31
|
+
// already shows one for every 422/500, and calling error() again here
|
|
32
|
+
// stacked a second, duplicate toast on top of it (caught in browser
|
|
33
|
+
// testing against the Raiffeisen sandbox).
|
|
34
|
+
useEffect(() => {
|
|
35
|
+
if (isError) {
|
|
36
|
+
navigate(-1);
|
|
37
|
+
}
|
|
38
|
+
}, [isError, navigate]);
|
|
39
|
+
|
|
21
40
|
return (
|
|
22
41
|
<Container>
|
|
23
42
|
<Inline text={ t('order_process.raiffeisen') } />
|
package/Stripe/Stripe.tsx
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { useEffect } from 'react';
|
|
2
2
|
import { TFunction } from 'i18next';
|
|
3
|
+
import { useNavigate } from 'react-router-dom';
|
|
3
4
|
import { Inline } from '@autobusal/common';
|
|
4
5
|
import { Container } from '../styles';
|
|
5
6
|
import { useMakeStripe } from '../services';
|
|
@@ -10,7 +11,9 @@ interface Props {
|
|
|
10
11
|
}
|
|
11
12
|
|
|
12
13
|
const Stripe = ({ hash, t }: Props): JSX.Element => {
|
|
13
|
-
const { data, isSuccess } = useMakeStripe(String(hash));
|
|
14
|
+
const { data, isSuccess, isError } = useMakeStripe(String(hash));
|
|
15
|
+
|
|
16
|
+
const navigate = useNavigate();
|
|
14
17
|
|
|
15
18
|
useEffect(() => {
|
|
16
19
|
if (isSuccess) {
|
|
@@ -18,6 +21,19 @@ const Stripe = ({ hash, t }: Props): JSX.Element => {
|
|
|
18
21
|
}
|
|
19
22
|
}, [data, isSuccess]);
|
|
20
23
|
|
|
24
|
+
// Edited: Ferjolt Ozuni - Date: 2026-07-18
|
|
25
|
+
// Bug: this only ever checked isSuccess - a failed payment-initiation
|
|
26
|
+
// request left the user staring at "Preparing to take you to the payment
|
|
27
|
+
// portal..." forever with no feedback at all. Fix: navigate back so they
|
|
28
|
+
// can retry. Same fix applied identically to Raiffeisen/Mollie/Nexi/Bkt
|
|
29
|
+
// (see Raiffeisen.tsx for the full explanation, including why there's no
|
|
30
|
+
// toast() call here).
|
|
31
|
+
useEffect(() => {
|
|
32
|
+
if (isError) {
|
|
33
|
+
navigate(-1);
|
|
34
|
+
}
|
|
35
|
+
}, [isError, navigate]);
|
|
36
|
+
|
|
21
37
|
return (
|
|
22
38
|
<Container>
|
|
23
39
|
<Inline text={ t('order_process.stripe') } />
|
package/package.json
CHANGED