@autobusal/order-process 1.2.0 → 1.3.0

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/Content.tsx CHANGED
@@ -3,6 +3,7 @@ import Standard from './Standard/Standard';
3
3
  import Bkt from './BKT/Bkt';
4
4
  import Stripe from './Stripe/Stripe';
5
5
  import Mollie from './Mollie/Mollie';
6
+ import Raiffeisen from './Reiffeisen/Raiffeisen';
6
7
 
7
8
  interface Props {
8
9
  type?: string
@@ -21,6 +22,9 @@ const Content = ({ type, hash, t }: Props): JSX.Element => {
21
22
  case 'mollie':
22
23
  return <Mollie hash={ hash } t={ t } />;
23
24
 
25
+ case 'raiffeisen':
26
+ return <Raiffeisen hash={ hash } t={ t } />;
27
+
24
28
  default:
25
29
  return <Standard type={ type } hash={ hash } t={ t } />;
26
30
  }
@@ -0,0 +1,28 @@
1
+ import { useEffect } from 'react';
2
+ import { TFunction } from 'i18next';
3
+ import { Inline } from '@autobusal/common';
4
+ import { Container } from '../styles';
5
+ import { useMakeRaiffeisen } from '../services';
6
+
7
+ interface Props {
8
+ hash?: string
9
+ t: TFunction<'common'>
10
+ }
11
+
12
+ const Raiffeisen = ({ hash, t }: Props): JSX.Element => {
13
+ const { data, isSuccess } = useMakeRaiffeisen(String(hash));
14
+
15
+ useEffect(() => {
16
+ if (isSuccess) {
17
+ window.location.href = data.redirect;
18
+ }
19
+ }, [data, isSuccess]);
20
+
21
+ return (
22
+ <Container>
23
+ <Inline text={ t('order_process.raiffeisen') } />
24
+ </Container>
25
+ );
26
+ };
27
+
28
+ export default Raiffeisen;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@autobusal/order-process",
3
- "version": "1.2.0",
3
+ "version": "1.3.0",
4
4
  "type": "module",
5
5
  "main": "index.ts"
6
6
  }
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 } from './types';
3
+ import { BKTData, StripeData, MollieData, RaiffeisenData } from './types';
4
4
 
5
5
  export const useMakeStandard = (type: string, hash: string): UseQueryResult<string> => (
6
6
  useQuery({
@@ -55,4 +55,17 @@ export const useMakeMollie = (hash: string): UseQueryResult<MollieData> => (
55
55
  ))
56
56
  )
57
57
  })
58
+ );
59
+
60
+ export const useMakeRaiffeisen = (hash: string): UseQueryResult<RaiffeisenData> => (
61
+ useQuery({
62
+ queryKey: ['process-payment-raiffeisen', { hash }],
63
+ queryFn: async () => (
64
+ await apiClient
65
+ .post('/api/payment/raiffeisen', { hash })
66
+ .then(response => (
67
+ response?.data ?? ''
68
+ ))
69
+ )
70
+ })
58
71
  );
package/types.ts CHANGED
@@ -68,4 +68,8 @@ export interface StripeData {
68
68
 
69
69
  export interface MollieData {
70
70
  redirect: string
71
+ }
72
+
73
+ export interface RaiffeisenData {
74
+ redirect: string
71
75
  }