From 712d92aa0e5bb6a4c9e674c8881a3e45ab314bfd Mon Sep 17 00:00:00 2001 From: Cole Eason Date: Fri, 29 Sep 2023 13:30:59 +0800 Subject: [PATCH 1/5] Add conditional wallet terms based on program ID --- src/CONST.ts | 1 + src/languages/en.ts | 4 +++- src/languages/types.ts | 3 +++ src/pages/EnablePayments/EnablePaymentsPage.js | 2 +- .../EnablePayments/TermsPage/ShortTermsForm.js | 16 ++++++++++++++-- src/pages/EnablePayments/TermsStep.js | 7 ++++++- src/pages/EnablePayments/userWalletPropTypes.js | 3 +++ src/types/onyx/UserWallet.ts | 3 +++ 8 files changed, 34 insertions(+), 5 deletions(-) diff --git a/src/CONST.ts b/src/CONST.ts index dbe47c6ed1a7..068b1f6507cb 100755 --- a/src/CONST.ts +++ b/src/CONST.ts @@ -992,6 +992,7 @@ const CONST = { STATEMENT: 'STATEMENT_NAVIGATE', CONCIERGE: 'CONCIERGE_NAVIGATE', }, + MTL_WALLET_PROGRAM_ID : '760', }, PLAID: { diff --git a/src/languages/en.ts b/src/languages/en.ts index 9c49e2907702..8395854a4000 100755 --- a/src/languages/en.ts +++ b/src/languages/en.ts @@ -73,8 +73,10 @@ import type { RequestedAmountMessageParams, TagSelectionParams, TranslationBase, + WalletProgramParams, } from './types'; import * as ReportActionsUtils from '../libs/ReportActionsUtils'; +import walletTermsPropTypes from '../pages/EnablePayments/walletTermsPropTypes'; type StateValue = { stateISO: string; @@ -1170,7 +1172,7 @@ export default { electronicFundsWithdrawal: 'Electronic funds withdrawal', standard: 'Standard', shortTermsForm: { - expensifyPaymentsAccount: 'The Expensify Wallet is issued by The Bancorp Bank.', + expensifyPaymentsAccount: ({ walletProgram }: WalletProgramParams) => `The Expensify Wallet is issued by ${walletProgram}.`, perPurchase: 'Per purchase', atmWithdrawal: 'ATM withdrawal', cashReload: 'Cash reload', diff --git a/src/languages/types.ts b/src/languages/types.ts index 70bf2e4cae3d..330973bd5e08 100644 --- a/src/languages/types.ts +++ b/src/languages/types.ts @@ -194,6 +194,8 @@ type FormattedMaxLengthParams = {formattedMaxLength: string}; type TagSelectionParams = {tagName: string}; +type WalletProgramParams = { walletProgram: string }; + /* Translation Object types */ // eslint-disable-next-line @typescript-eslint/no-explicit-any type TranslationBaseValue = string | string[] | ((...args: any[]) => string); @@ -307,4 +309,5 @@ export type { RemovedTheRequestParams, FormattedMaxLengthParams, TagSelectionParams, + WalletProgramParams, }; diff --git a/src/pages/EnablePayments/EnablePaymentsPage.js b/src/pages/EnablePayments/EnablePaymentsPage.js index 773dfe8b5df7..f7ef2a174208 100644 --- a/src/pages/EnablePayments/EnablePaymentsPage.js +++ b/src/pages/EnablePayments/EnablePaymentsPage.js @@ -76,7 +76,7 @@ function EnablePaymentsPage({userWallet}) { case CONST.WALLET.STEP.ONFIDO: return ; case CONST.WALLET.STEP.TERMS: - return ; + return ; case CONST.WALLET.STEP.ACTIVATE: return ; default: diff --git a/src/pages/EnablePayments/TermsPage/ShortTermsForm.js b/src/pages/EnablePayments/TermsPage/ShortTermsForm.js index a6f685fcb562..adf164ea7e3c 100644 --- a/src/pages/EnablePayments/TermsPage/ShortTermsForm.js +++ b/src/pages/EnablePayments/TermsPage/ShortTermsForm.js @@ -5,11 +5,21 @@ import Text from '../../../components/Text'; import * as Localize from '../../../libs/Localize'; import CONST from '../../../CONST'; import TextLink from '../../../components/TextLink'; +import userWalletPropTypes from '../userWalletPropTypes'; -function ShortTermsForm() { +const propTypes = { + /** The user's wallet */ + userWallet: userWalletPropTypes, +}; + +const defaultProps = { + userWallet: {}, +}; + +function ShortTermsForm(props) { return ( <> - {Localize.translateLocal('termsStep.shortTermsForm.expensifyPaymentsAccount')} + {Localize.translateLocal('termsStep.shortTermsForm.expensifyPaymentsAccount', { walletProgram: props.userWallet.walletProgramID === CONST.WALLET.MTL_WALLET_PROGRAM_ID ? 'Expensify Payments' : 'The Bancorp Bank'})} @@ -132,6 +142,8 @@ function ShortTermsForm() { ); } +ShortTermsForm.propTypes = propTypes; +ShortTermsForm.defaultProps = defaultProps; ShortTermsForm.displayName = 'ShortTermsForm'; export default ShortTermsForm; diff --git a/src/pages/EnablePayments/TermsStep.js b/src/pages/EnablePayments/TermsStep.js index e96d93dc4de9..3194ea637a7d 100644 --- a/src/pages/EnablePayments/TermsStep.js +++ b/src/pages/EnablePayments/TermsStep.js @@ -15,8 +15,12 @@ import LongTermsForm from './TermsPage/LongTermsForm'; import FormAlertWithSubmitButton from '../../components/FormAlertWithSubmitButton'; import walletTermsPropTypes from './walletTermsPropTypes'; import * as ErrorUtils from '../../libs/ErrorUtils'; +import userWalletPropTypes from './userWalletPropTypes'; const propTypes = { + /** The user's wallet */ + userWallet: userWalletPropTypes, + /** Comes from Onyx. Information about the terms for the wallet */ walletTerms: walletTermsPropTypes, @@ -24,6 +28,7 @@ const propTypes = { }; const defaultProps = { + userWallet: {}, walletTerms: {}, }; @@ -59,7 +64,7 @@ function TermsStep(props) { style={styles.flex1} contentContainerStyle={styles.ph5} > - + Date: Fri, 29 Sep 2023 13:48:48 +0800 Subject: [PATCH 2/5] Fix lint checks --- src/languages/en.ts | 1 - src/languages/es.ts | 3 ++- src/pages/EnablePayments/TermsStep.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/languages/en.ts b/src/languages/en.ts index 8395854a4000..ecfb131d68b3 100755 --- a/src/languages/en.ts +++ b/src/languages/en.ts @@ -76,7 +76,6 @@ import type { WalletProgramParams, } from './types'; import * as ReportActionsUtils from '../libs/ReportActionsUtils'; -import walletTermsPropTypes from '../pages/EnablePayments/walletTermsPropTypes'; type StateValue = { stateISO: string; diff --git a/src/languages/es.ts b/src/languages/es.ts index 2be3f9e96265..08817bb84b6a 100644 --- a/src/languages/es.ts +++ b/src/languages/es.ts @@ -73,6 +73,7 @@ import type { RequestedAmountMessageParams, TagSelectionParams, EnglishTranslation, + WalletProgramParams, } from './types'; /* eslint-disable max-len */ @@ -1187,7 +1188,7 @@ export default { electronicFundsWithdrawal: 'Retiro electrónico de fondos', standard: 'Estándar', shortTermsForm: { - expensifyPaymentsAccount: 'La billetera Expensify es emitida por The Bancorp Bank.', + expensifyPaymentsAccount: ({ walletProgram }: WalletProgramParams) => `La billetera Expensify es emitida por ${walletProgram}.`, perPurchase: 'Por compra', atmWithdrawal: 'Retiro de cajero automático', cashReload: 'Recarga de efectivo', diff --git a/src/pages/EnablePayments/TermsStep.js b/src/pages/EnablePayments/TermsStep.js index 3194ea637a7d..39f4826ec0b2 100644 --- a/src/pages/EnablePayments/TermsStep.js +++ b/src/pages/EnablePayments/TermsStep.js @@ -64,7 +64,7 @@ function TermsStep(props) { style={styles.flex1} contentContainerStyle={styles.ph5} > - + Date: Fri, 29 Sep 2023 13:55:28 +0800 Subject: [PATCH 3/5] prettier fixes --- src/CONST.ts | 2 +- src/languages/en.ts | 2 +- src/languages/es.ts | 2 +- src/languages/types.ts | 2 +- src/pages/EnablePayments/TermsPage/ShortTermsForm.js | 6 +++++- 5 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/CONST.ts b/src/CONST.ts index 068b1f6507cb..f1d717f697cc 100755 --- a/src/CONST.ts +++ b/src/CONST.ts @@ -992,7 +992,7 @@ const CONST = { STATEMENT: 'STATEMENT_NAVIGATE', CONCIERGE: 'CONCIERGE_NAVIGATE', }, - MTL_WALLET_PROGRAM_ID : '760', + MTL_WALLET_PROGRAM_ID: '760', }, PLAID: { diff --git a/src/languages/en.ts b/src/languages/en.ts index ecfb131d68b3..db08b5484ddf 100755 --- a/src/languages/en.ts +++ b/src/languages/en.ts @@ -1171,7 +1171,7 @@ export default { electronicFundsWithdrawal: 'Electronic funds withdrawal', standard: 'Standard', shortTermsForm: { - expensifyPaymentsAccount: ({ walletProgram }: WalletProgramParams) => `The Expensify Wallet is issued by ${walletProgram}.`, + expensifyPaymentsAccount: ({walletProgram}: WalletProgramParams) => `The Expensify Wallet is issued by ${walletProgram}.`, perPurchase: 'Per purchase', atmWithdrawal: 'ATM withdrawal', cashReload: 'Cash reload', diff --git a/src/languages/es.ts b/src/languages/es.ts index 08817bb84b6a..4b5623aef268 100644 --- a/src/languages/es.ts +++ b/src/languages/es.ts @@ -1188,7 +1188,7 @@ export default { electronicFundsWithdrawal: 'Retiro electrónico de fondos', standard: 'Estándar', shortTermsForm: { - expensifyPaymentsAccount: ({ walletProgram }: WalletProgramParams) => `La billetera Expensify es emitida por ${walletProgram}.`, + expensifyPaymentsAccount: ({walletProgram}: WalletProgramParams) => `La billetera Expensify es emitida por ${walletProgram}.`, perPurchase: 'Por compra', atmWithdrawal: 'Retiro de cajero automático', cashReload: 'Recarga de efectivo', diff --git a/src/languages/types.ts b/src/languages/types.ts index 330973bd5e08..52f2df8b3765 100644 --- a/src/languages/types.ts +++ b/src/languages/types.ts @@ -194,7 +194,7 @@ type FormattedMaxLengthParams = {formattedMaxLength: string}; type TagSelectionParams = {tagName: string}; -type WalletProgramParams = { walletProgram: string }; +type WalletProgramParams = {walletProgram: string}; /* Translation Object types */ // eslint-disable-next-line @typescript-eslint/no-explicit-any diff --git a/src/pages/EnablePayments/TermsPage/ShortTermsForm.js b/src/pages/EnablePayments/TermsPage/ShortTermsForm.js index adf164ea7e3c..4c3bfb7eaf61 100644 --- a/src/pages/EnablePayments/TermsPage/ShortTermsForm.js +++ b/src/pages/EnablePayments/TermsPage/ShortTermsForm.js @@ -19,7 +19,11 @@ const defaultProps = { function ShortTermsForm(props) { return ( <> - {Localize.translateLocal('termsStep.shortTermsForm.expensifyPaymentsAccount', { walletProgram: props.userWallet.walletProgramID === CONST.WALLET.MTL_WALLET_PROGRAM_ID ? 'Expensify Payments' : 'The Bancorp Bank'})} + + {Localize.translateLocal('termsStep.shortTermsForm.expensifyPaymentsAccount', { + walletProgram: props.userWallet.walletProgramID === CONST.WALLET.MTL_WALLET_PROGRAM_ID ? 'Expensify Payments' : 'The Bancorp Bank', + })} + From 828456b9d118526aa1768c1e12a54f45f2ddf204 Mon Sep 17 00:00:00 2001 From: Cole Eason Date: Fri, 29 Sep 2023 14:20:12 +0800 Subject: [PATCH 4/5] Use a constant for bank names --- src/CONST.ts | 4 ++++ src/languages/en.ts | 8 ++++---- src/languages/es.ts | 8 ++++---- src/pages/EnablePayments/TermsPage/ShortTermsForm.js | 2 +- 4 files changed, 13 insertions(+), 9 deletions(-) diff --git a/src/CONST.ts b/src/CONST.ts index f1d717f697cc..0d671bbba260 100755 --- a/src/CONST.ts +++ b/src/CONST.ts @@ -993,6 +993,10 @@ const CONST = { CONCIERGE: 'CONCIERGE_NAVIGATE', }, MTL_WALLET_PROGRAM_ID: '760', + PROGRAM_ISSUERS: { + EXPENSIFY_PAYMENTS: 'Expensify Payments LLC', + BANCORP_BANK: 'The Bancorp Bank' + } }, PLAID: { diff --git a/src/languages/en.ts b/src/languages/en.ts index db08b5484ddf..f16097aa03d1 100755 --- a/src/languages/en.ts +++ b/src/languages/en.ts @@ -910,7 +910,7 @@ export default { phrase2: 'Terms of Service', phrase3: 'and', phrase4: 'Privacy', - phrase5: 'Money transmission is provided by Expensify Payments LLC (NMLS ID:2017010) pursuant to its', + phrase5: `Money transmission is provided by ${CONST.WALLET.PROGRAM_ISSUERS.EXPENSIFY_PAYMENTS} (NMLS ID:2017010) pursuant to its`, phrase6: 'licenses', }, validateCodeForm: { @@ -1213,10 +1213,10 @@ export default { 'several minutes. The fee is 1.5% of the transfer amount (with a minimum fee of $0.25).', fdicInsuranceBancorp: 'Your funds are eligible for FDIC insurance. Your funds will be held at or ' + - 'transferred to The Bancorp Bank, an FDIC-insured institution. Once there, your funds are insured up ' + - 'to $250,000 by the FDIC in the event The Bancorp Bank fails. See', + `transferred to ${CONST.WALLET.PROGRAM_ISSUERS.BANCORP_BANK}, an FDIC-insured institution. Once there, your funds are insured up ` + + `to $250,000 by the FDIC in the event ${CONST.WALLET.PROGRAM_ISSUERS.BANCORP_BANK} fails. See`, fdicInsuranceBancorp2: 'for details.', - contactExpensifyPayments: 'Contact Expensify Payments by calling +1 833-400-0904, by email at', + contactExpensifyPayments: `Contact ${CONST.WALLET.PROGRAM_ISSUERS.EXPENSIFY_PAYMENTS} by calling +1 833-400-0904, by email at`, contactExpensifyPayments2: 'or sign in at', generalInformation: 'For general information about prepaid accounts, visit', generalInformation2: 'If you have a complaint about a prepaid account, call the Consumer Financial Protection Bureau at 1-855-411-2372 or visit', diff --git a/src/languages/es.ts b/src/languages/es.ts index 4b5623aef268..3860c34f6ef1 100644 --- a/src/languages/es.ts +++ b/src/languages/es.ts @@ -906,7 +906,7 @@ export default { phrase2: 'Términos de Servicio', phrase3: 'y', phrase4: 'Privacidad', - phrase5: 'El envío de dinero es brindado por Expensify Payments LLC (NMLS ID:2017010) de conformidad con sus', + phrase5: `El envío de dinero es brindado por ${CONST.WALLET.PROGRAM_ISSUERS.EXPENSIFY_PAYMENTS} (NMLS ID:2017010) de conformidad con sus`, phrase6: 'licencias', }, validateCodeForm: { @@ -1231,10 +1231,10 @@ export default { 'transferencia (con una tarifa mínima de $ 0.25). ', fdicInsuranceBancorp: 'Sus fondos son elegibles para el seguro de la FDIC. Sus fondos se mantendrán en o ' + - 'transferido a The Bancorp Bank, una institución asegurada por la FDIC. Una vez allí, sus fondos ' + - 'están asegurados a $ 250,000 por la FDIC en caso de que The Bancorp Bank quiebre. Ver', + `transferido a ${CONST.WALLET.PROGRAM_ISSUERS.BANCORP_BANK}, una institución asegurada por la FDIC. Una vez allí, sus fondos ` + + `están asegurados a $ 250,000 por la FDIC en caso de que ${CONST.WALLET.PROGRAM_ISSUERS.BANCORP_BANK} quiebre. Ver`, fdicInsuranceBancorp2: 'para detalles.', - contactExpensifyPayments: 'Comuníquese con Expensify Payments llamando al + 1833-400-0904, por correoelectrónico a', + contactExpensifyPayments: `Comuníquese con ${CONST.WALLET.PROGRAM_ISSUERS.EXPENSIFY_PAYMENTS} llamando al + 1833-400-0904, por correoelectrónico a`, contactExpensifyPayments2: 'o inicie sesión en', generalInformation: 'Para obtener información general sobre cuentas prepagas, visite', generalInformation2: 'Si tiene una queja sobre una cuenta prepaga, llame al Consumer Financial Oficina de Protección al 1-855-411-2372 o visite', diff --git a/src/pages/EnablePayments/TermsPage/ShortTermsForm.js b/src/pages/EnablePayments/TermsPage/ShortTermsForm.js index 4c3bfb7eaf61..8bc4e9a9d80a 100644 --- a/src/pages/EnablePayments/TermsPage/ShortTermsForm.js +++ b/src/pages/EnablePayments/TermsPage/ShortTermsForm.js @@ -21,7 +21,7 @@ function ShortTermsForm(props) { <> {Localize.translateLocal('termsStep.shortTermsForm.expensifyPaymentsAccount', { - walletProgram: props.userWallet.walletProgramID === CONST.WALLET.MTL_WALLET_PROGRAM_ID ? 'Expensify Payments' : 'The Bancorp Bank', + walletProgram: props.userWallet.walletProgramID === CONST.WALLET.MTL_WALLET_PROGRAM_ID ? CONST.WALLET.PROGRAM_ISSUERS.EXPENSIFY_PAYMENTS : CONST.WALLET.PROGRAM_ISSUERS.BANCORP_BANK, })} From f3939746e50fcb2a7c20fb428f84d7794387efbd Mon Sep 17 00:00:00 2001 From: Cole Eason Date: Fri, 29 Sep 2023 14:29:17 +0800 Subject: [PATCH 5/5] Run prettier --- src/CONST.ts | 4 ++-- src/pages/EnablePayments/TermsPage/ShortTermsForm.js | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/CONST.ts b/src/CONST.ts index 0d671bbba260..bd91137ae946 100755 --- a/src/CONST.ts +++ b/src/CONST.ts @@ -995,8 +995,8 @@ const CONST = { MTL_WALLET_PROGRAM_ID: '760', PROGRAM_ISSUERS: { EXPENSIFY_PAYMENTS: 'Expensify Payments LLC', - BANCORP_BANK: 'The Bancorp Bank' - } + BANCORP_BANK: 'The Bancorp Bank', + }, }, PLAID: { diff --git a/src/pages/EnablePayments/TermsPage/ShortTermsForm.js b/src/pages/EnablePayments/TermsPage/ShortTermsForm.js index 8bc4e9a9d80a..1b693add95b7 100644 --- a/src/pages/EnablePayments/TermsPage/ShortTermsForm.js +++ b/src/pages/EnablePayments/TermsPage/ShortTermsForm.js @@ -21,7 +21,8 @@ function ShortTermsForm(props) { <> {Localize.translateLocal('termsStep.shortTermsForm.expensifyPaymentsAccount', { - walletProgram: props.userWallet.walletProgramID === CONST.WALLET.MTL_WALLET_PROGRAM_ID ? CONST.WALLET.PROGRAM_ISSUERS.EXPENSIFY_PAYMENTS : CONST.WALLET.PROGRAM_ISSUERS.BANCORP_BANK, + walletProgram: + props.userWallet.walletProgramID === CONST.WALLET.MTL_WALLET_PROGRAM_ID ? CONST.WALLET.PROGRAM_ISSUERS.EXPENSIFY_PAYMENTS : CONST.WALLET.PROGRAM_ISSUERS.BANCORP_BANK, })}