Skip to content

Commit

Permalink
Merge pull request #31908 from Expensify/vit-fixBottomUp
Browse files Browse the repository at this point in the history
[CP Staging] Show Business Bank account as payment option on expense reports
  • Loading branch information
mountiny authored Nov 27, 2023
2 parents b70686d + a137813 commit 60838bf
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/components/AddPaymentMethodMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,12 @@ 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 (
<PopoverMenu
isVisible={isVisible}
Expand All @@ -84,7 +90,7 @@ function AddPaymentMethodMenu({isVisible, onClose, anchorPosition, anchorAlignme
},
]
: []),
...(!ReportActionsUtils.hasRequestFromCurrentAccount(lodashGet(iouReport, 'reportID', 0), lodashGet(session, 'accountID', 0))
...(canUseBusinessBankAccount
? [
{
text: translate('common.businessBankAccount'),
Expand Down

0 comments on commit 60838bf

Please sign in to comment.