diff --git a/src/Components/Surcharge.res b/src/Components/Surcharge.res index 0ad9e075f..f8821d4bf 100644 --- a/src/Components/Surcharge.res +++ b/src/Components/Surcharge.res @@ -24,7 +24,7 @@ let make = ( SurchargeUtils.getOneClickWalletsMessage(~list) } else { switch paymentMethodTypes.surcharge_details { - | Some(surchargeDetails) => SurchargeUtils.getMessage(~paymentMethod, ~surchargeDetails) + | Some(surchargeDetails) => SurchargeUtils.getMessage(~paymentMethod, ~surchargeDetails, ~list) | None => if paymentMethod === "card" { let creditPaymentMethodTypes = getPaymentMethodTypes("credit") @@ -44,13 +44,13 @@ let make = ( let debitCardSurcharge = debitSurchargeDetails.displayTotalSurchargeAmount if creditCardSurcharge >= debitCardSurcharge { - SurchargeUtils.getMessage(~paymentMethod, ~surchargeDetails={creditSurchargeDetails}) + SurchargeUtils.getMessage(~paymentMethod, ~surchargeDetails={creditSurchargeDetails}, ~list) } else { - SurchargeUtils.getMessage(~paymentMethod, ~surchargeDetails={debitSurchargeDetails}) + SurchargeUtils.getMessage(~paymentMethod, ~surchargeDetails={debitSurchargeDetails}, ~list) } | (None, Some(surchargeDetails)) | (Some(surchargeDetails), None) => - SurchargeUtils.getMessage(~paymentMethod, ~surchargeDetails) + SurchargeUtils.getMessage(~paymentMethod, ~surchargeDetails, ~list) | (None, None) => None } } else { diff --git a/src/Components/SurchargeUtils.res b/src/Components/SurchargeUtils.res index c136f4d52..cc077d976 100644 --- a/src/Components/SurchargeUtils.res +++ b/src/Components/SurchargeUtils.res @@ -48,12 +48,18 @@ let getSurchargeDetailsForOneClickWallets = (~list) => { }, []) } -let getMessage = (~surchargeDetails: PaymentMethodsRecord.surchargeDetails, ~paymentMethod) => { +let getMessage = ( + ~surchargeDetails: PaymentMethodsRecord.surchargeDetails, + ~paymentMethod, + ~list: PaymentMethodsRecord.list, +) => { let {localeString} = Recoil.useRecoilValueFromAtom(RecoilAtoms.configAtom) let surchargeValue = surchargeDetails.displayTotalSurchargeAmount->Js.Float.toString let getLocaleStrForSurcharge = (cardLocale, altPaymentLocale) => { - paymentMethod === "card" ? cardLocale(surchargeValue) : altPaymentLocale(surchargeValue) + paymentMethod === "card" + ? cardLocale(list.currency, surchargeValue) + : altPaymentLocale(list.currency, surchargeValue) } Some( @@ -74,7 +80,7 @@ let getOneClickWalletsMessage = (~list) => { let amount = wallet.surchargeDetails.displayTotalSurchargeAmount->Js.Float.toString let myMsg = <> - {React.string(amount)} + {React.string(`${list.currency} ${amount}`)} {React.string(`${Utils.nbsp}${localeString.on} ${wallet.name}`)} let msgToConcat = if index === 0 { diff --git a/src/LocaleString.res b/src/LocaleString.res index c3719894f..95485592a 100644 --- a/src/LocaleString.res +++ b/src/LocaleString.res @@ -42,8 +42,8 @@ type localeStrings = { enterFieldsText: string, enterValidDetailsText: string, card: string, - surchargeMsgAmount: string => React.element, - surchargeMsgAmountForCard: string => React.element, + surchargeMsgAmount: (string, string) => React.element, + surchargeMsgAmountForCard: (string, string) => React.element, surchargeMsgAmountForOneClickWallets: string, billingNameLabel: string, billingNamePlaceholder: string, @@ -99,14 +99,14 @@ let defaultLocale = { enterFieldsText: "Please enter all fields", enterValidDetailsText: "Please enter valid details", card: "Card", - surchargeMsgAmount: str => <> + surchargeMsgAmount: (currency, str) => <> {React.string(`A surcharge amount of${Utils.nbsp}`)} - {React.string(str)} + {React.string(`${currency} ${str}`)} {React.string({`${Utils.nbsp}will be applied for this transaction`})} , - surchargeMsgAmountForCard: str => <> + surchargeMsgAmountForCard: (currency, str) => <> {React.string(`A surcharge amount of upto${Utils.nbsp}`)} - {React.string(str)} + {React.string(`${currency} ${str}`)} {React.string(`${Utils.nbsp}will be applied for this transaction`)} , surchargeMsgAmountForOneClickWallets: "Additional fee applicable", @@ -166,14 +166,14 @@ let localeStrings = [ enterFieldsText: "Please enter all fields", enterValidDetailsText: "Please enter valid details", card: "Card", - surchargeMsgAmount: str => <> + surchargeMsgAmount: (currency, str) => <> {React.string(`A surcharge amount of${Utils.nbsp}`)} - {React.string(str)} + {React.string(`${currency} ${str}`)} {React.string({`${Utils.nbsp}will be applied for this transaction`})} , - surchargeMsgAmountForCard: str => <> + surchargeMsgAmountForCard: (currency, str) => <> {React.string(`A surcharge amount of upto${Utils.nbsp}`)} - {React.string(str)} + {React.string(`${currency} ${str}`)} {React.string(`${Utils.nbsp}will be applied for this transaction`)} , surchargeMsgAmountForOneClickWallets: "Additional fee applicable", @@ -230,14 +230,14 @@ let localeStrings = [ enterFieldsText: `יש להזין את כל השדות`, enterValidDetailsText: `יש להזין פרטים תקינים`, card: `כרטיס`, - surchargeMsgAmount: str => <> + surchargeMsgAmount: (currency, str) => <> {React.string(`סכום היטל של${Utils.nbsp}`)} - {React.string(str)} + {React.string(`${currency} ${str}`)} {React.string(`${Utils.nbsp}יוחל עבור עסקה זו`)} , - surchargeMsgAmountForCard: str => <> + surchargeMsgAmountForCard: (currency, str) => <> {React.string(`סכום היטל של עד${Utils.nbsp}`)} - {React.string(str)} + {React.string(`${currency} ${str}`)} {React.string(`${Utils.nbsp}יחול עבור עסקה זו`)} , surchargeMsgAmountForOneClickWallets: `תשלום נוסף חל`, @@ -294,14 +294,14 @@ let localeStrings = [ enterFieldsText: `Veuillez saisir tous les champs`, enterValidDetailsText: `Veuillez saisir des informations valides`, card: `Carte`, - surchargeMsgAmount: str => <> + surchargeMsgAmount: (currency, str) => <> {React.string(`Un montant supplémentaire d'${Utils.nbsp}`)} - {React.string(str)} + {React.string(`${currency} ${str}`)} {React.string(`${Utils.nbsp}sera appliqué pour cette transaction`)} , - surchargeMsgAmountForCard: str => <> + surchargeMsgAmountForCard: (currency, str) => <> {React.string(`Un montant supplémentaire allant jusqu'à${Utils.nbsp}`)} - {React.string(str)} + {React.string(`${currency} ${str}`)} {React.string(`${Utils.nbsp}sera appliqué pour cette transaction.`)} , surchargeMsgAmountForOneClickWallets: `Frais supplémentaires applicables`, @@ -358,14 +358,14 @@ let localeStrings = [ enterFieldsText: "Please enter all fields", enterValidDetailsText: "Please enter valid details", card: "Card", - surchargeMsgAmount: str => <> + surchargeMsgAmount: (currency, str) => <> {React.string(`A surcharge amount of${Utils.nbsp}`)} - {React.string(str)} + {React.string(`${currency} ${str}`)} {React.string(`${Utils.nbsp}will be applied for this transaction`)} , - surchargeMsgAmountForCard: str => <> + surchargeMsgAmountForCard: (currency, str) => <> {React.string(`A surcharge amount of upto${Utils.nbsp}`)} - {React.string(str)} + {React.string(`${currency} ${str}`)} {React.string(`${Utils.nbsp}will be applied for this transaction`)} , surchargeMsgAmountForOneClickWallets: "Additional fee applicable", @@ -422,14 +422,14 @@ let localeStrings = [ enterFieldsText: `الرجاء إدخال كافة الحقول`, enterValidDetailsText: `الرجاء إدخال تفاصيل صالحة`, card: `بطاقة`, - surchargeMsgAmount: str => <> + surchargeMsgAmount: (currency, str) => <> {React.string(`سيتم تطبيق مبلغ إضافي من${Utils.nbsp}`)} - {React.string(str)} + {React.string(`${currency} ${str}`)} {React.string(`${Utils.nbsp}على هذه المعاملة`)} , - surchargeMsgAmountForCard: str => <> + surchargeMsgAmountForCard: (currency, str) => <> {React.string(`سيتم تطبيق مبلغ إضافي يصل إلى${Utils.nbsp}`)} - {React.string(str)} + {React.string(`${currency} ${str}`)} {React.string(`${Utils.nbsp}على هذه المعاملة`)} , surchargeMsgAmountForOneClickWallets: `رسوم إضافية قابلة للتطبيق`, @@ -486,14 +486,14 @@ let localeStrings = [ enterFieldsText: `すべてのフィールドに入力してください`, enterValidDetailsText: `有効な詳細を入力してください`, card: `カード`, - surchargeMsgAmount: str => <> + surchargeMsgAmount: (currency, str) => <> {React.string(`この取引には${Utils.nbsp}`)} - {React.string(str)} + {React.string(`${currency} ${str}`)} {React.string(`${Utils.nbsp}の追加料金が適用されます`)} , - surchargeMsgAmountForCard: str => <> + surchargeMsgAmountForCard: (currency, str) => <> {React.string(`この取引には${Utils.nbsp}`)} - {React.string(str)} + {React.string(`${currency} ${str}`)} {React.string(`${Utils.nbsp}までの追加料金が適用されます`)} , surchargeMsgAmountForOneClickWallets: `追加料金が適用されます`, @@ -550,14 +550,14 @@ let localeStrings = [ enterFieldsText: `Bitte füllen Sie alle Felder aus`, enterValidDetailsText: `Bitte geben Sie gültige Daten ein`, card: `Karte`, - surchargeMsgAmount: str => <> + surchargeMsgAmount: (currency, str) => <> {React.string(`Für diese Transaktion wird ein Zuschlag in Höhe von${Utils.nbsp}`)} - {React.string(str)} + {React.string(`${currency} ${str}`)} {React.string(`${Utils.nbsp}erhoben`)} , - surchargeMsgAmountForCard: str => <> + surchargeMsgAmountForCard: (currency, str) => <> {React.string(`Für diese Transaktion wird ein Zuschlagsbetrag von bis zu${Utils.nbsp}`)} - {React.string(str)} + {React.string(`${currency} ${str}`)} {React.string(`${Utils.nbsp}erhoben`)} , surchargeMsgAmountForOneClickWallets: `Es fällt eine zusätzliche Gebühr an`, diff --git a/src/Payments/PaymentMethodsRecord.res b/src/Payments/PaymentMethodsRecord.res index f4c707f5c..6d6104f40 100644 --- a/src/Payments/PaymentMethodsRecord.res +++ b/src/Payments/PaymentMethodsRecord.res @@ -702,6 +702,7 @@ type mandate = { type list = { redirect_url: string, + currency: string, payment_methods: array, mandate_payment: option, payment_type: string, @@ -722,6 +723,7 @@ let defaultPaymentMethodType = { let defaultList = { redirect_url: "", + currency: "", payment_methods: [], mandate_payment: None, payment_type: "", @@ -920,6 +922,7 @@ let getMandate = (dict, str) => { let itemToObjMapper = dict => { { redirect_url: getString(dict, "redirect_url", ""), + currency: getString(dict, "currency", ""), payment_methods: getMethodsArr(dict, "payment_methods"), mandate_payment: getMandate(dict, "mandate_payment"), payment_type: getString(dict, "payment_type", ""),