From b75b4776d057ad7e8fdfd5c963bd6f1ce87e3960 Mon Sep 17 00:00:00 2001 From: dukenv0307 Date: Mon, 4 Dec 2023 16:24:10 +0700 Subject: [PATCH 1/4] Bank account option is not present in Pay with Expensify menu --- src/components/AddPaymentMethodMenu.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/components/AddPaymentMethodMenu.js b/src/components/AddPaymentMethodMenu.js index 4d01fa108e2a..8f93ef2009ff 100644 --- a/src/components/AddPaymentMethodMenu.js +++ b/src/components/AddPaymentMethodMenu.js @@ -7,6 +7,7 @@ import useLocalize from '@hooks/useLocalize'; import compose from '@libs/compose'; import * as ReportActionsUtils from '@libs/ReportActionsUtils'; import * as ReportUtils from '@libs/ReportUtils'; +import {iouDefaultProps, iouPropTypes} from '@pages/iou/propTypes'; import iouReportPropTypes from '@pages/iouReportPropTypes'; import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; @@ -48,6 +49,9 @@ const propTypes = { /** Currently logged in user accountID */ accountID: PropTypes.number, }), + + /** Holds data related to Money Request view state, rather than the underlying Money Request data. */ + iou: iouPropTypes, }; const defaultProps = { @@ -59,9 +63,10 @@ const defaultProps = { }, anchorRef: () => {}, session: {}, + iou: iouDefaultProps, }; -function AddPaymentMethodMenu({isVisible, onClose, anchorPosition, anchorAlignment, anchorRef, iouReport, onItemSelected, session}) { +function AddPaymentMethodMenu({isVisible, onClose, anchorPosition, anchorAlignment, anchorRef, iouReport, onItemSelected, session, iou}) { const {translate} = useLocalize(); // Users can choose to pay with business bank account in case of Expense reports or in case of P2P IOU report @@ -70,6 +75,8 @@ function AddPaymentMethodMenu({isVisible, onClose, anchorPosition, anchorAlignme ReportUtils.isExpenseReport(iouReport) || (ReportUtils.isIOUReport(iouReport) && !ReportActionsUtils.hasRequestFromCurrentAccount(lodashGet(iouReport, 'reportID', 0), lodashGet(session, 'accountID', 0))); + const canUsePersonalBankAccount = iou.id === CONST.IOU.TYPE.SEND; + return ( Date: Wed, 6 Dec 2023 18:25:03 +0700 Subject: [PATCH 2/4] add Personal bank account option to the IOU report --- src/components/AddPaymentMethodMenu.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/AddPaymentMethodMenu.js b/src/components/AddPaymentMethodMenu.js index 8f93ef2009ff..6b6794c46b38 100644 --- a/src/components/AddPaymentMethodMenu.js +++ b/src/components/AddPaymentMethodMenu.js @@ -75,7 +75,7 @@ function AddPaymentMethodMenu({isVisible, onClose, anchorPosition, anchorAlignme ReportUtils.isExpenseReport(iouReport) || (ReportUtils.isIOUReport(iouReport) && !ReportActionsUtils.hasRequestFromCurrentAccount(lodashGet(iouReport, 'reportID', 0), lodashGet(session, 'accountID', 0))); - const canUsePersonalBankAccount = iou.id === CONST.IOU.TYPE.SEND; + const canUsePersonalBankAccount = iou.id === CONST.IOU.TYPE.SEND || ReportUtils.isIOUReport(iouReport); return ( Date: Mon, 11 Dec 2023 15:53:33 +0700 Subject: [PATCH 3/4] pass iouType to SettlementButton --- src/components/AddPaymentMethodMenu.js | 14 +++++--------- src/components/KYCWall/BaseKYCWall.js | 2 ++ src/components/KYCWall/kycWallPropTypes.js | 4 ++++ src/components/MoneyRequestConfirmationList.js | 1 + src/components/SettlementButton.js | 6 ++++++ 5 files changed, 18 insertions(+), 9 deletions(-) diff --git a/src/components/AddPaymentMethodMenu.js b/src/components/AddPaymentMethodMenu.js index 6b6794c46b38..4abe5655e307 100644 --- a/src/components/AddPaymentMethodMenu.js +++ b/src/components/AddPaymentMethodMenu.js @@ -7,7 +7,6 @@ import useLocalize from '@hooks/useLocalize'; import compose from '@libs/compose'; import * as ReportActionsUtils from '@libs/ReportActionsUtils'; import * as ReportUtils from '@libs/ReportUtils'; -import {iouDefaultProps, iouPropTypes} from '@pages/iou/propTypes'; import iouReportPropTypes from '@pages/iouReportPropTypes'; import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; @@ -50,8 +49,8 @@ const propTypes = { accountID: PropTypes.number, }), - /** Holds data related to Money Request view state, rather than the underlying Money Request data. */ - iou: iouPropTypes, + /** Whether the personal bank account option should be shown */ + shouldShowPersonalBankAccountOption: PropTypes.bool, }; const defaultProps = { @@ -63,10 +62,10 @@ const defaultProps = { }, anchorRef: () => {}, session: {}, - iou: iouDefaultProps, + shouldShowPersonalBankAccountOption: false, }; -function AddPaymentMethodMenu({isVisible, onClose, anchorPosition, anchorAlignment, anchorRef, iouReport, onItemSelected, session, iou}) { +function AddPaymentMethodMenu({isVisible, onClose, anchorPosition, anchorAlignment, anchorRef, iouReport, onItemSelected, session, shouldShowPersonalBankAccountOption}) { const {translate} = useLocalize(); // Users can choose to pay with business bank account in case of Expense reports or in case of P2P IOU report @@ -75,7 +74,7 @@ function AddPaymentMethodMenu({isVisible, onClose, anchorPosition, anchorAlignme ReportUtils.isExpenseReport(iouReport) || (ReportUtils.isIOUReport(iouReport) && !ReportActionsUtils.hasRequestFromCurrentAccount(lodashGet(iouReport, 'reportID', 0), lodashGet(session, 'accountID', 0))); - const canUsePersonalBankAccount = iou.id === CONST.IOU.TYPE.SEND || ReportUtils.isIOUReport(iouReport); + const canUsePersonalBankAccount = shouldShowPersonalBankAccountOption || ReportUtils.isIOUReport(iouReport); return ( {children(continueAction, anchorRef)} diff --git a/src/components/KYCWall/kycWallPropTypes.js b/src/components/KYCWall/kycWallPropTypes.js index 58db2c1c1940..2f14f1e12e11 100644 --- a/src/components/KYCWall/kycWallPropTypes.js +++ b/src/components/KYCWall/kycWallPropTypes.js @@ -62,6 +62,9 @@ const propTypes = { /** Callback for when a payment method has been selected */ onSelectPaymentMethod: PropTypes.func, + + /** Whether the personal bank account option should be shown */ + shouldShowPersonalBankAccountOption: PropTypes.bool, }; const defaultProps = { @@ -82,6 +85,7 @@ const defaultProps = { }, shouldIncludeDebitCard: true, onSelectPaymentMethod: () => {}, + shouldShowPersonalBankAccountOption: false, }; export {propTypes, defaultProps}; diff --git a/src/components/MoneyRequestConfirmationList.js b/src/components/MoneyRequestConfirmationList.js index 258a15c4c813..16cfaf84d96a 100755 --- a/src/components/MoneyRequestConfirmationList.js +++ b/src/components/MoneyRequestConfirmationList.js @@ -517,6 +517,7 @@ function MoneyRequestConfirmationList(props) { horizontal: CONST.MODAL.ANCHOR_ORIGIN_HORIZONTAL.RIGHT, vertical: CONST.MODAL.ANCHOR_ORIGIN_VERTICAL.BOTTOM, }} + shouldShowPersonalBankAccountOption={shouldShowSettlementButton} /> ) : ( {(triggerKYCFlow, buttonRef) => ( Date: Thu, 14 Dec 2023 17:13:05 +0700 Subject: [PATCH 4/4] clean code --- src/components/MoneyRequestConfirmationList.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/MoneyRequestConfirmationList.js b/src/components/MoneyRequestConfirmationList.js index fc0e4e8854b7..fc3e4b095873 100755 --- a/src/components/MoneyRequestConfirmationList.js +++ b/src/components/MoneyRequestConfirmationList.js @@ -521,7 +521,7 @@ function MoneyRequestConfirmationList(props) { horizontal: CONST.MODAL.ANCHOR_ORIGIN_HORIZONTAL.RIGHT, vertical: CONST.MODAL.ANCHOR_ORIGIN_VERTICAL.BOTTOM, }} - shouldShowPersonalBankAccountOption={shouldShowSettlementButton} + shouldShowPersonalBankAccountOption /> ) : (