Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add conditional wallet terms based on program ID #28433

Merged
merged 5 commits into from
Sep 29, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
3 changes: 2 additions & 1 deletion src/languages/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ import type {
RequestedAmountMessageParams,
TagSelectionParams,
TranslationBase,
WalletProgramParams,
} from './types';
import * as ReportActionsUtils from '../libs/ReportActionsUtils';

Expand Down Expand Up @@ -1170,7 +1171,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: 2 additions & 1 deletion src/languages/es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ import type {
RequestedAmountMessageParams,
TagSelectionParams,
EnglishTranslation,
WalletProgramParams,
} from './types';

/* eslint-disable max-len */
Expand Down Expand Up @@ -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',
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
20 changes: 18 additions & 2 deletions src/pages/EnablePayments/TermsPage/ShortTermsForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,25 @@ 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',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should create consts for Expensify Payments and The Bancorp Bank

})}
</Text>

<View style={[styles.shortTermsBorder, styles.p2, styles.mb6]}>
<View style={[styles.shortTermsRow, styles.mb4]}>
Expand Down Expand Up @@ -132,6 +146,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={props.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