From 65c73c1e696cb6e7f7d8d12695dc18b09e89696c Mon Sep 17 00:00:00 2001 From: Vit Horacek Date: Mon, 27 Nov 2023 12:16:36 +0000 Subject: [PATCH 1/3] Show the business bank account as an option for workspace chats --- src/components/AddPaymentMethodMenu.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/components/AddPaymentMethodMenu.js b/src/components/AddPaymentMethodMenu.js index ce26985932d6..a9c9aa5f4556 100644 --- a/src/components/AddPaymentMethodMenu.js +++ b/src/components/AddPaymentMethodMenu.js @@ -84,7 +84,11 @@ function AddPaymentMethodMenu({isVisible, onClose, anchorPosition, anchorAlignme }, ] : []), - ...(!ReportActionsUtils.hasRequestFromCurrentAccount(lodashGet(iouReport, 'reportID', 0), lodashGet(session, 'accountID', 0)) + + // Users can choose to pay with business bank account in case of Expense reports or in case of P2P IOU report + // which then starts a bottom up flow and creates a Collect workspace where the payer is an admin and payee is an employee. + ...(ReportUtils.isExpenseReport(iouReport) || + (ReportUtils.isIOUReport(iouReport) && !ReportActionsUtils.hasRequestFromCurrentAccount(lodashGet(iouReport, 'reportID', 0), lodashGet(session, 'accountID', 0))) ? [ { text: translate('common.businessBankAccount'), From 66cf34833f91e5a378495dc4a326a78b36fe2a0a Mon Sep 17 00:00:00 2001 From: Vit Horacek Date: Mon, 27 Nov 2023 13:15:11 +0000 Subject: [PATCH 2/3] Move the conditional to its on variable in AddPaymentsMethod --- src/components/AddPaymentMethodMenu.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/components/AddPaymentMethodMenu.js b/src/components/AddPaymentMethodMenu.js index a9c9aa5f4556..cfaf47c77bf0 100644 --- a/src/components/AddPaymentMethodMenu.js +++ b/src/components/AddPaymentMethodMenu.js @@ -64,6 +64,11 @@ const defaultProps = { function AddPaymentMethodMenu({isVisible, onClose, anchorPosition, anchorAlignment, anchorRef, iouReport, onItemSelected, session}) { const {translate} = useLocalize(); + // Users can choose to pay with business bank account in case of Expense reports or in case of P2P IOU report + // which then starts a bottom up flow and creates a Collect workspace where the payer is an admin and payee is an employee. + const canUseBusinessBankAccount = ReportUtils.isExpenseReport(iouReport) || + (ReportUtils.isIOUReport(iouReport) && !ReportActionsUtils.hasRequestFromCurrentAccount(lodashGet(iouReport, 'reportID', 0), lodashGet(session, 'accountID', 0))); + return ( Date: Mon, 27 Nov 2023 13:22:16 +0000 Subject: [PATCH 3/3] Lint --- src/components/AddPaymentMethodMenu.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/components/AddPaymentMethodMenu.js b/src/components/AddPaymentMethodMenu.js index cfaf47c77bf0..4d01fa108e2a 100644 --- a/src/components/AddPaymentMethodMenu.js +++ b/src/components/AddPaymentMethodMenu.js @@ -66,8 +66,9 @@ function AddPaymentMethodMenu({isVisible, onClose, anchorPosition, anchorAlignme // Users can choose to pay with business bank account in case of Expense reports or in case of P2P IOU report // which then starts a bottom up flow and creates a Collect workspace where the payer is an admin and payee is an employee. - const canUseBusinessBankAccount = ReportUtils.isExpenseReport(iouReport) || - (ReportUtils.isIOUReport(iouReport) && !ReportActionsUtils.hasRequestFromCurrentAccount(lodashGet(iouReport, 'reportID', 0), lodashGet(session, 'accountID', 0))); + const canUseBusinessBankAccount = + ReportUtils.isExpenseReport(iouReport) || + (ReportUtils.isIOUReport(iouReport) && !ReportActionsUtils.hasRequestFromCurrentAccount(lodashGet(iouReport, 'reportID', 0), lodashGet(session, 'accountID', 0))); return (