@autobusal/order-process 1.3.0 → 1.3.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/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>
package/CHANGELOG.md ADDED
@@ -0,0 +1,30 @@
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.2] - 2026-07-19
8
+
9
+ ### Fixed
10
+
11
+ - **Payment-initiation failures no longer strand the user on a spinner.** The
12
+ five gateway components — `Reiffeisen/Raiffeisen.tsx`, `Stripe/Stripe.tsx`,
13
+ `Mollie/Mollie.tsx`, `Nexi/Nexi.tsx`, and `BKT/Bkt.tsx` — previously only
14
+ reacted to `isSuccess`. When the `useMake*` payment-initiation request
15
+ failed (gateway auth failure, no funds, etc.), the component sat on
16
+ "Preparing to take you to the payment portal…" indefinitely with no feedback
17
+ and no way out except leaving the page. Each now also consumes `isError`
18
+ from its query and, in an effect, calls `navigate(-1)` to return the user so
19
+ they can retry. No local `toast()`/`error()` is raised on purpose: the
20
+ `@autobusal/providers` Axios response interceptor already surfaces one toast
21
+ per 422/500, and adding another here stacked a duplicate.
22
+ - **BKT loading state could never resolve on failure (`BKT/Bkt.tsx`).** Unlike
23
+ the other four gateways, BKT never reached an `isSuccess` state on failure —
24
+ `isLoading` simply stayed `true` — so it was stuck on the loading text
25
+ forever. The new `isError` → `navigate(-1)` handling gives it the same exit
26
+ path as the others.
27
+
28
+ Authored by Ferjolt Ozuni. Consolidated from the magus and alvavel whitelabel
29
+ patch sets into canonical @autobusal source (eliminates per-repo patch-package
30
+ divergence).
package/Content.tsx CHANGED
@@ -4,6 +4,7 @@ import Bkt from './BKT/Bkt';
4
4
  import Stripe from './Stripe/Stripe';
5
5
  import Mollie from './Mollie/Mollie';
6
6
  import Raiffeisen from './Reiffeisen/Raiffeisen';
7
+ import Nexi from './Nexi/Nexi';
7
8
 
8
9
  interface Props {
9
10
  type?: string
@@ -25,6 +26,9 @@ const Content = ({ type, hash, t }: Props): JSX.Element => {
25
26
  case 'raiffeisen':
26
27
  return <Raiffeisen hash={ hash } t={ t } />;
27
28
 
29
+ case 'nexi':
30
+ return <Nexi hash={ hash } t={ t } />;
31
+
28
32
  default:
29
33
  return <Standard type={ type } hash={ hash } t={ t } />;
30
34
  }
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 ADDED
@@ -0,0 +1,44 @@
1
+ import { useEffect } from 'react';
2
+ import { TFunction } from 'i18next';
3
+ import { useNavigate } from 'react-router-dom';
4
+ import { Inline } from '@autobusal/common';
5
+ import { Container } from '../styles';
6
+ import { useMakeNexi } from '../services';
7
+
8
+ interface Props {
9
+ hash?: string
10
+ t: TFunction<'common'>
11
+ }
12
+
13
+ const Nexi = ({ hash, t }: Props): JSX.Element => {
14
+ const { data, isSuccess, isError } = useMakeNexi(String(hash));
15
+
16
+ const navigate = useNavigate();
17
+
18
+ useEffect(() => {
19
+ if (isSuccess) {
20
+ window.location.href = data.redirect;
21
+ }
22
+ }, [data, isSuccess]);
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
+
37
+ return (
38
+ <Container>
39
+ <Inline text={ t('order_process.nexi') } />
40
+ </Container>
41
+ );
42
+ };
43
+
44
+ export default 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
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "name": "@autobusal/order-process",
3
- "version": "1.3.0",
3
+ "version": "1.3.2",
4
+ "author": "Ferjolt Ozuni",
4
5
  "type": "module",
5
6
  "main": "index.ts"
6
7
  }
package/services.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { useQuery, UseQueryResult } from '@tanstack/react-query';
2
2
  import { apiClient } from '@autobusal/providers';
3
- import { BKTData, StripeData, MollieData, RaiffeisenData } from './types';
3
+ import { BKTData, StripeData, MollieData, RaiffeisenData, NexiData } from './types';
4
4
 
5
5
  export const useMakeStandard = (type: string, hash: string): UseQueryResult<string> => (
6
6
  useQuery({
@@ -68,4 +68,17 @@ export const useMakeRaiffeisen = (hash: string): UseQueryResult<RaiffeisenData>
68
68
  ))
69
69
  )
70
70
  })
71
+ );
72
+
73
+ export const useMakeNexi = (hash: string): UseQueryResult<NexiData> => (
74
+ useQuery({
75
+ queryKey: ['process-payment-nexi', { hash }],
76
+ queryFn: async () => (
77
+ await apiClient
78
+ .post('/api/payment/nexi', { hash })
79
+ .then(response => (
80
+ response?.data ?? ''
81
+ ))
82
+ )
83
+ })
71
84
  );
package/types.ts CHANGED
@@ -72,4 +72,8 @@ export interface MollieData {
72
72
 
73
73
  export interface RaiffeisenData {
74
74
  redirect: string
75
+ }
76
+
77
+ export interface NexiData {
78
+ redirect: string
75
79
  }