Skip to content

Commit

Permalink
Add conditional wallet terms based on program ID
Browse files Browse the repository at this point in the history
  • Loading branch information
coleaeason committed Sep 29, 2023
1 parent 6093340 commit 712d92a
Show file tree
Hide file tree
Showing 8 changed files with 34 additions and 5 deletions.
1 change: 1 addition & 0 deletions src/CONST.ts
Original file line number Diff line number Diff line change
Expand Up @@ -992,6 +992,7 @@ const CONST = {
STATEMENT: 'STATEMENT_NAVIGATE',
CONCIERGE: 'CONCIERGE_NAVIGATE',
},
MTL_WALLET_PROGRAM_ID : '760',
},

PLAID: {
Expand Down
4 changes: 3 additions & 1 deletion src/languages/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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',
Expand Down
3 changes: 3 additions & 0 deletions src/languages/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -307,4 +309,5 @@ export type {
RemovedTheRequestParams,
FormattedMaxLengthParams,
TagSelectionParams,
WalletProgramParams,
};
2 changes: 1 addition & 1 deletion src/pages/EnablePayments/EnablePaymentsPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ function EnablePaymentsPage({userWallet}) {
case CONST.WALLET.STEP.ONFIDO:
return <OnfidoStep />;
case CONST.WALLET.STEP.TERMS:
return <TermsStep />;
return <TermsStep userWallet={userWallet} />;
case CONST.WALLET.STEP.ACTIVATE:
return <ActivateStep userWallet={userWallet} />;
default:
Expand Down
16 changes: 14 additions & 2 deletions src/pages/EnablePayments/TermsPage/ShortTermsForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
<>
<Text style={styles.mb5}>{Localize.translateLocal('termsStep.shortTermsForm.expensifyPaymentsAccount')}</Text>
<Text style={styles.mb5}>{Localize.translateLocal('termsStep.shortTermsForm.expensifyPaymentsAccount', { walletProgram: props.userWallet.walletProgramID === CONST.WALLET.MTL_WALLET_PROGRAM_ID ? 'Expensify Payments' : 'The Bancorp Bank'})}</Text>

<View style={[styles.shortTermsBorder, styles.p2, styles.mb6]}>
<View style={[styles.shortTermsRow, styles.mb4]}>
Expand Down Expand Up @@ -132,6 +142,8 @@ function ShortTermsForm() {
);
}

ShortTermsForm.propTypes = propTypes;
ShortTermsForm.defaultProps = defaultProps;
ShortTermsForm.displayName = 'ShortTermsForm';

export default ShortTermsForm;
7 changes: 6 additions & 1 deletion src/pages/EnablePayments/TermsStep.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,20 @@ 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,

...withLocalizePropTypes,
};

const defaultProps = {
userWallet: {},
walletTerms: {},
};

Expand Down Expand Up @@ -59,7 +64,7 @@ function TermsStep(props) {
style={styles.flex1}
contentContainerStyle={styles.ph5}
>
<ShortTermsForm />
<ShortTermsForm userWallet={userWallet} />
<LongTermsForm />
<CheckboxWithLabel
accessibilityLabel={props.translate('termsStep.haveReadAndAgree')}
Expand Down
3 changes: 3 additions & 0 deletions src/pages/EnablePayments/userWalletPropTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,7 @@ export default PropTypes.shape({

/** Whether we should show the ActivateStep success view after the user finished the KYC flow */
shouldShowWalletActivationSuccess: PropTypes.bool,

/** The wallet's programID, used to show the correct terms. */
walletProgramID: PropTypes.string,
});
3 changes: 3 additions & 0 deletions src/types/onyx/UserWallet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ type UserWallet = {
/** The type of the linked account (debitCard or bankAccount) */
walletLinkedAccountType: WalletLinkedAccountType;

/** The wallet's programID, used to show the correct terms. */
walletProgramID?: string;

/** The user's bank account ID */
bankAccountID?: number;

Expand Down

0 comments on commit 712d92a

Please sign in to comment.