From 3e040d43b1438f9f0003f4eb1d875a9a34be79f6 Mon Sep 17 00:00:00 2001 From: Tharindu Kumarasiri Date: Thu, 22 Aug 2024 10:26:53 +0530 Subject: [PATCH] selected language passed to session service --- example/App.tsx | 2 +- example/PaymentScreen.tsx | 4 +++- example/services/sessionService.ts | 3 +++ 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/example/App.tsx b/example/App.tsx index 96c3ed8..307aef2 100644 --- a/example/App.tsx +++ b/example/App.tsx @@ -35,7 +35,7 @@ function App(): React.JSX.Element { - + {loading ? : null} diff --git a/example/PaymentScreen.tsx b/example/PaymentScreen.tsx index 84c6795..861a6cb 100644 --- a/example/PaymentScreen.tsx +++ b/example/PaymentScreen.tsx @@ -18,8 +18,10 @@ export enum CurrencyTypes { } const PaymentScreen = ({ + language, setLoading, }: { + language: string; setLoading: Dispatch>; }) => { const [amount, setAmount] = useState(''); @@ -37,7 +39,7 @@ const PaymentScreen = ({ } // fetch a session Id to initiate payment - const sessionId = await createSession({amount, currency}); + const sessionId = await createSession({amount, currency, language}); setLoading(false); // invoke createPayment method with sessionId as parameters to open the payment portal diff --git a/example/services/sessionService.ts b/example/services/sessionService.ts index a69148f..02f6b1e 100644 --- a/example/services/sessionService.ts +++ b/example/services/sessionService.ts @@ -7,11 +7,13 @@ import {CREATE_SESSION_URL} from './constants'; type createSessionProps = { amount: string; currency: string; + language: string; }; const createSession = async ({ amount, currency, + language, }: createSessionProps): Promise => { try { const options = { @@ -23,6 +25,7 @@ const createSession = async ({ body: JSON.stringify({ amount, currency, + language, }), }; const response = await fetch(CREATE_SESSION_URL, options);