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

Adds KYC Wall trigger for Transfer Balance action #7211

Merged
merged 8 commits into from
Jan 20, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
4 changes: 2 additions & 2 deletions src/libs/API.js
Original file line number Diff line number Diff line change
Expand Up @@ -1175,7 +1175,7 @@ function CreatePolicyRoom(parameters) {
* @param {String} [parameters.fundID]
* @returns {Promise}
*/
function Wallet_TransferBalance(parameters) {
function TransferWalletBalance(parameters) {
const commandName = 'TransferWalletBalance';
if (!parameters.bankAccountID && !parameters.fundID) {
throw new Error('Must pass either bankAccountID or fundID to TransferWalletBalance');
Expand Down Expand Up @@ -1244,7 +1244,7 @@ export {
ValidateEmail,
Wallet_Activate,
Wallet_GetOnfidoSDKToken,
Wallet_TransferBalance,
TransferWalletBalance,
GetLocalCurrency,
GetCurrencyList,
Policy_Create,
Expand Down
4 changes: 2 additions & 2 deletions src/libs/PaymentUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ function formatPaymentMethods(bankAccountList, cardList, payPalMeUsername = '',
iconSize,
key: `bankAccount-${bankAccount.bankAccountID}`,
accountType: CONST.PAYMENT_METHODS.BANK_ACCOUNT,
accountData: _.extend(bankAccount, {icon}),
accountData: _.extend({}, bankAccount, {icon}),
isDefault,
});
});
Expand All @@ -70,7 +70,7 @@ function formatPaymentMethods(bankAccountList, cardList, payPalMeUsername = '',
iconSize,
key: `card-${card.cardNumber}`,
accountType: CONST.PAYMENT_METHODS.DEBIT_CARD,
accountData: _.extend(card, {icon}),
accountData: _.extend({}, card, {icon}),
isDefault,
});
});
Expand Down
4 changes: 2 additions & 2 deletions src/pages/ReimbursementAccount/EnableStep.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,14 @@ const propTypes = {
isLoadingPaymentMethods: PropTypes.bool,

/** Array of bank account objects */
bankAccountList: PropTypes.arrayOf(bankAccountPropTypes),
bankAccountList: PropTypes.objectOf(bankAccountPropTypes),

...withLocalizePropTypes,
};

const defaultProps = {
isLoadingPaymentMethods: true,
bankAccountList: [],
bankAccountList: {},
};

class EnableStep extends React.Component {
Expand Down
7 changes: 4 additions & 3 deletions src/pages/settings/Payments/PaymentMethodList.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ const propTypes = {

const defaultProps = {
payPalMeUsername: '',
bankAccountList: [],
cardList: [],
bankAccountList: {},
cardList: {},
userWallet: {
walletLinkedAccountID: 0,
walletLinkedAccountType: '',
Expand Down Expand Up @@ -91,6 +91,7 @@ class PaymentMethodList extends Component {
// If we have not added any payment methods, show a default empty state
if (_.isEmpty(combinedPaymentMethods)) {
combinedPaymentMethods.push({
key: 'addFirstPaymentMethodHelpText',
text: this.props.translate('paymentMethodList.addFirstPaymentMethod'),
});
}
Expand Down Expand Up @@ -125,7 +126,6 @@ class PaymentMethodList extends Component {
title={item.title}
description={item.description}
icon={item.icon}
key={item.key}
disabled={item.disabled}
iconFill={item.iconFill}
iconHeight={item.iconSize}
Expand All @@ -150,6 +150,7 @@ class PaymentMethodList extends Component {
<FlatList
data={this.createPaymentMethodList()}
renderItem={this.renderItem}
keyExtractor={item => item.key}
/>
);
}
Expand Down
17 changes: 7 additions & 10 deletions src/pages/settings/Payments/TransferBalancePage.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const propTypes = {
userWallet: userWalletPropTypes.userWallet,

/** Array of bank account objects */
Copy link
Contributor

Choose a reason for hiding this comment

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

NAB: Ah I think we should update that this is no longer an array but an object, no?

bankAccountList: PropTypes.arrayOf(PropTypes.shape({
bankAccountList: PropTypes.objectOf(PropTypes.shape({
/** The name of the institution (bank of america, etc) */
addressName: PropTypes.string,

Expand All @@ -45,7 +45,7 @@ const propTypes = {
})),

/** Array of card objects */
Copy link
Contributor

Choose a reason for hiding this comment

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

NAB: Same here? Which can be an Object (or Dictionary) of card objects?

cardList: PropTypes.arrayOf(PropTypes.shape({
cardList: PropTypes.objectOf(PropTypes.shape({
/** The name of the institution (bank of america, etc) */
cardName: PropTypes.string,

Expand All @@ -64,8 +64,8 @@ const propTypes = {

const defaultProps = {
userWallet: {},
bankAccountList: [],
cardList: [],
bankAccountList: {},
cardList: {},
walletTransfer: {},
};

Expand Down Expand Up @@ -97,6 +97,8 @@ class TransferBalancePage extends React.Component {
];

this.saveTransferAmountAndBalance = this.saveTransferAmountAndBalance.bind(this);
this.getSelectedPaymentMethodAccount = this.getSelectedPaymentMethodAccount.bind(this);

const selectedAccount = this.getSelectedPaymentMethodAccount();
PaymentMethods.saveWalletTransferAccountAndResetData(selectedAccount ? selectedAccount.id : '');
}
Expand All @@ -106,12 +108,7 @@ class TransferBalancePage extends React.Component {
* @returns {Object|undefined}
*/
getSelectedPaymentMethodAccount() {
const paymentMethods = PaymentUtils.formatPaymentMethods(
this.props.bankAccountList,
this.props.cardList,
this.props.userWallet,
);

const paymentMethods = PaymentUtils.formatPaymentMethods(this.props.bankAccountList, this.props.cardList, '', this.props.userWallet);
const accountID = this.props.walletTransfer.selectedAccountID || lodashGet(this.props, 'userWallet.walletLinkedAccountID', '');
return _.find(paymentMethods, method => method.methodID === accountID);
}
Expand Down
4 changes: 2 additions & 2 deletions src/pages/workspace/WorkspaceResetBankAccountModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ const propTypes = {
reimbursementAccount: reimbursementAccountPropTypes,

/** List of bank accounts */
bankAccountList: PropTypes.arrayOf(bankAccountPropTypes),
bankAccountList: PropTypes.objectOf(bankAccountPropTypes),

...withLocalizePropTypes,
};

const defaultProps = {
reimbursementAccount: {},
bankAccountList: [],
bankAccountList: {},
};

const WorkspaceResetBankAccountModal = (props) => {
Expand Down