diff --git a/src/components/ReportWelcomeText.js b/src/components/ReportWelcomeText.js index a204d0c59aaf..3693d02252f0 100644 --- a/src/components/ReportWelcomeText.js +++ b/src/components/ReportWelcomeText.js @@ -70,7 +70,7 @@ function ReportWelcomeText(props) { ); const isUserPolicyAdmin = PolicyUtils.isPolicyAdmin(props.policy); const roomWelcomeMessage = ReportUtils.getRoomWelcomeMessage(props.report, isUserPolicyAdmin); - const moneyRequestOptions = ReportUtils.getMoneyRequestOptions(props.report, participantAccountIDs); + const moneyRequestOptions = ReportUtils.getMoneyRequestOptions(props.report, props.policy, participantAccountIDs); return ( <> diff --git a/src/libs/PolicyUtils.ts b/src/libs/PolicyUtils.ts index 220f58fe671e..bc7ddb14b53e 100644 --- a/src/libs/PolicyUtils.ts +++ b/src/libs/PolicyUtils.ts @@ -197,6 +197,10 @@ function isPendingDeletePolicy(policy: OnyxEntry): boolean { return policy?.pendingAction === CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE; } +function isPaidGroupPolicy(policy: OnyxEntry): boolean { + return policy?.type === CONST.POLICY.TYPE.TEAM || policy?.type === CONST.POLICY.TYPE.CORPORATE; +} + export { getActivePolicies, hasPolicyMemberError, @@ -217,4 +221,5 @@ export { getTagList, isPendingDeletePolicy, isPolicyMember, + isPaidGroupPolicy, }; diff --git a/src/libs/ReportUtils.ts b/src/libs/ReportUtils.ts index e88e81aacaab..81bbf1df6273 100644 --- a/src/libs/ReportUtils.ts +++ b/src/libs/ReportUtils.ts @@ -3634,7 +3634,7 @@ function hasIOUWaitingOnCurrentUserBankAccount(chatReport: OnyxEntry): b * - in an IOU report, which is not settled yet * - in a 1:1 DM chat */ -function canRequestMoney(report: OnyxEntry, otherParticipants: number[]): boolean { +function canRequestMoney(report: OnyxEntry, policy: OnyxEntry, otherParticipants: number[]): boolean { // User cannot request money in chat thread or in task report or in chat room if (isChatThread(report) || isTaskReport(report) || isChatRoom(report)) { return false; @@ -3664,7 +3664,11 @@ function canRequestMoney(report: OnyxEntry, otherParticipants: number[]) // User can request money in any IOU report, unless paid, but user can only request money in an expense report // which is tied to their workspace chat. if (isMoneyRequestReport(report)) { - return ((isExpenseReport(report) && isOwnPolicyExpenseChat) || isIOUReport(report)) && !isReportApproved(report) && !isSettled(report?.reportID); + const isOwnExpenseReport = isExpenseReport(report) && isOwnPolicyExpenseChat; + if (isOwnExpenseReport && PolicyUtils.isPaidGroupPolicy(policy)) { + return isDraftExpenseReport(report); + } + return (isOwnExpenseReport || isIOUReport(report)) && !isReportApproved(report) && !isSettled(report?.reportID); } // In case of policy expense chat, users can only request money from their own policy expense chat @@ -3689,7 +3693,7 @@ function canRequestMoney(report: OnyxEntry, otherParticipants: number[]) * None of the options should show in chat threads or if there is some special Expensify account * as a participant of the report. */ -function getMoneyRequestOptions(report: OnyxEntry, reportParticipants: number[]): Array> { +function getMoneyRequestOptions(report: OnyxEntry, policy: OnyxEntry, reportParticipants: number[]): Array> { // In any thread or task report, we do not allow any new money requests yet if (isChatThread(report) || isTaskReport(report)) { return []; @@ -3715,7 +3719,7 @@ function getMoneyRequestOptions(report: OnyxEntry, reportParticipants: n options = [CONST.IOU.TYPE.SPLIT]; } - if (canRequestMoney(report, otherParticipants)) { + if (canRequestMoney(report, policy, otherParticipants)) { options = [...options, CONST.IOU.TYPE.REQUEST]; } @@ -3872,12 +3876,12 @@ function getPolicyExpenseChatReportIDByOwner(policyOwner: string): string | null /** * Check if the report can create the request with type is iouType */ -function canCreateRequest(report: OnyxEntry, iouType: (typeof CONST.IOU.TYPE)[keyof typeof CONST.IOU.TYPE]): boolean { +function canCreateRequest(report: OnyxEntry, policy: OnyxEntry, iouType: (typeof CONST.IOU.TYPE)[keyof typeof CONST.IOU.TYPE]): boolean { const participantAccountIDs = report?.participantAccountIDs ?? []; if (!canUserPerformWriteAction(report)) { return false; } - return getMoneyRequestOptions(report, participantAccountIDs).includes(iouType); + return getMoneyRequestOptions(report, policy, participantAccountIDs).includes(iouType); } function getWorkspaceChats(policyID: string, accountIDs: number[]): Array> { diff --git a/src/pages/home/report/ReportActionCompose/AttachmentPickerWithMenuItems.js b/src/pages/home/report/ReportActionCompose/AttachmentPickerWithMenuItems.js index c183d6ef0afa..1bfbc0125221 100644 --- a/src/pages/home/report/ReportActionCompose/AttachmentPickerWithMenuItems.js +++ b/src/pages/home/report/ReportActionCompose/AttachmentPickerWithMenuItems.js @@ -1,6 +1,8 @@ +import lodashGet from 'lodash/get'; import PropTypes from 'prop-types'; import React, {useCallback, useEffect, useMemo} from 'react'; import {View} from 'react-native'; +import {withOnyx} from 'react-native-onyx'; import _ from 'underscore'; import AttachmentPicker from '@components/AttachmentPicker'; import Icon from '@components/Icon'; @@ -15,12 +17,14 @@ import useTheme from '@hooks/useTheme'; import useThemeStyles from '@hooks/useThemeStyles'; import useWindowDimensions from '@hooks/useWindowDimensions'; import * as Browser from '@libs/Browser'; +import compose from '@libs/compose'; import Navigation from '@libs/Navigation/Navigation'; import * as ReportUtils from '@libs/ReportUtils'; import * as IOU from '@userActions/IOU'; import * as Report from '@userActions/Report'; import * as Task from '@userActions/Task'; import CONST from '@src/CONST'; +import ONYXKEYS from '@src/ONYXKEYS'; import ROUTES from '@src/ROUTES'; const propTypes = { @@ -33,6 +37,12 @@ const propTypes = { loading: PropTypes.bool, }).isRequired, + /** The policy tied to the report */ + policy: PropTypes.shape({ + /** Type of the policy */ + type: PropTypes.string, + }), + /** The personal details of everyone in the report */ reportParticipantIDs: PropTypes.arrayOf(PropTypes.number), @@ -90,6 +100,7 @@ const propTypes = { const defaultProps = { reportParticipantIDs: [], + policy: {}, }; /** @@ -100,6 +111,7 @@ const defaultProps = { */ function AttachmentPickerWithMenuItems({ report, + policy, reportParticipantIDs, displayFileInModal, isFullComposerAvailable, @@ -146,10 +158,10 @@ function AttachmentPickerWithMenuItems({ }, }; - return _.map(ReportUtils.getMoneyRequestOptions(report, reportParticipantIDs), (option) => ({ + return _.map(ReportUtils.getMoneyRequestOptions(report, policy, reportParticipantIDs), (option) => ({ ...options[option], })); - }, [report, reportParticipantIDs, translate]); + }, [report, policy, reportParticipantIDs, translate]); /** * Determines if we can show the task option @@ -321,4 +333,11 @@ AttachmentPickerWithMenuItems.propTypes = propTypes; AttachmentPickerWithMenuItems.defaultProps = defaultProps; AttachmentPickerWithMenuItems.displayName = 'AttachmentPickerWithMenuItems'; -export default withNavigationFocus(AttachmentPickerWithMenuItems); +export default compose( + withNavigationFocus, + withOnyx({ + policy: { + key: ({report}) => `${ONYXKEYS.COLLECTION.POLICY}${lodashGet(report, 'policyID')}`, + }, + }), +)(AttachmentPickerWithMenuItems); diff --git a/src/pages/iou/MoneyRequestSelectorPage.js b/src/pages/iou/MoneyRequestSelectorPage.js index e367709cb010..7b87b50bb7f3 100644 --- a/src/pages/iou/MoneyRequestSelectorPage.js +++ b/src/pages/iou/MoneyRequestSelectorPage.js @@ -43,6 +43,12 @@ const propTypes = { /** Report on which the money request is being created */ report: reportPropTypes, + /** The policy tied to the report */ + policy: PropTypes.shape({ + /** Type of the policy */ + type: PropTypes.string, + }), + /** Which tab has been selected */ selectedTab: PropTypes.string, }; @@ -50,6 +56,7 @@ const propTypes = { const defaultProps = { selectedTab: CONST.TAB_REQUEST.SCAN, report: {}, + policy: {}, }; function MoneyRequestSelectorPage(props) { @@ -76,7 +83,7 @@ function MoneyRequestSelectorPage(props) { }; // Allow the user to create the request if we are creating the request in global menu or the report can create the request - const isAllowedToCreateRequest = _.isEmpty(props.report.reportID) || ReportUtils.canCreateRequest(props.report, iouType); + const isAllowedToCreateRequest = _.isEmpty(props.report.reportID) || ReportUtils.canCreateRequest(props.report, props.policy, iouType); const prevSelectedTab = usePrevious(props.selectedTab); useEffect(() => { @@ -159,5 +166,8 @@ export default compose( selectedTab: { key: `${ONYXKEYS.COLLECTION.SELECTED_TAB}${CONST.TAB.RECEIPT_TAB_ID}`, }, + policy: { + key: ({report}) => `${ONYXKEYS.COLLECTION.POLICY}${lodashGet(report, 'policyID')}`, + }, }), )(MoneyRequestSelectorPage); diff --git a/src/pages/iou/request/IOURequestStartPage.js b/src/pages/iou/request/IOURequestStartPage.js index 6572e154ee14..388dd358019e 100644 --- a/src/pages/iou/request/IOURequestStartPage.js +++ b/src/pages/iou/request/IOURequestStartPage.js @@ -37,6 +37,12 @@ const propTypes = { /** The report that holds the transaction */ report: reportPropTypes, + /** The policy tied to the report */ + policy: PropTypes.shape({ + /** Type of the policy */ + type: PropTypes.string, + }), + /** The tab to select by default (whatever the user visited last) */ selectedTab: PropTypes.oneOf(_.values(CONST.TAB_REQUEST)), @@ -46,12 +52,14 @@ const propTypes = { const defaultProps = { report: {}, + policy: {}, selectedTab: CONST.TAB_REQUEST.SCAN, transaction: {}, }; function IOURequestStartPage({ report, + policy, route, route: { params: {iouType, reportID}, @@ -92,7 +100,7 @@ function IOURequestStartPage({ const shouldDisplayDistanceRequest = isExpenseChat || isExpenseReport || isFromGlobalCreate; // Allow the user to create the request if we are creating the request in global menu or the report can create the request - const isAllowedToCreateRequest = _.isEmpty(report.reportID) || ReportUtils.canCreateRequest(report, iouType); + const isAllowedToCreateRequest = _.isEmpty(report.reportID) || ReportUtils.canCreateRequest(report, policy, iouType); const navigateBack = () => { Navigation.dismissModal(); @@ -166,6 +174,9 @@ export default withOnyx({ report: { key: ({route}) => `${ONYXKEYS.COLLECTION.REPORT}${route.params.reportID}`, }, + policy: { + key: ({report}) => `${ONYXKEYS.COLLECTION.POLICY}${lodashGet(report, 'policyID')}`, + }, selectedTab: { key: `${ONYXKEYS.COLLECTION.SELECTED_TAB}${CONST.TAB.IOU_REQUEST_TYPE}`, }, diff --git a/tests/perf-test/ReportUtils.perf-test.ts b/tests/perf-test/ReportUtils.perf-test.ts index b931ae85a7da..928d9a9fbdff 100644 --- a/tests/perf-test/ReportUtils.perf-test.ts +++ b/tests/perf-test/ReportUtils.perf-test.ts @@ -176,6 +176,7 @@ test('[ReportUtils] getWorkspaceIcon on 5k policies', async () => { test('[ReportUtils] getMoneyRequestOptions on 1k participants', async () => { const report = {...createRandomReport(1), type: CONST.REPORT.TYPE.CHAT, chatType: CONST.REPORT.CHAT_TYPE.POLICY_EXPENSE_CHAT, isOwnPolicyExpenseChat: true}; + const policy = createRandomPolicy(1); const reportParticipants = Array.from({length: 1000}, (v, i) => i + 1); await Onyx.multiSet({ @@ -183,7 +184,7 @@ test('[ReportUtils] getMoneyRequestOptions on 1k participants', async () => { }); await waitForBatchedUpdates(); - await measureFunction(() => ReportUtils.getMoneyRequestOptions(report, reportParticipants), {runs}); + await measureFunction(() => ReportUtils.getMoneyRequestOptions(report, policy, reportParticipants), {runs}); }); test('[ReportUtils] getWorkspaceAvatar on 5k policies', async () => { diff --git a/tests/unit/ReportUtilsTest.js b/tests/unit/ReportUtilsTest.js index 090140f20ecd..d700aa4724f1 100644 --- a/tests/unit/ReportUtilsTest.js +++ b/tests/unit/ReportUtilsTest.js @@ -339,7 +339,7 @@ describe('ReportUtils', () => { describe('return empty iou options if', () => { it('participants aray contains excluded expensify iou emails', () => { const allEmpty = _.every(CONST.EXPENSIFY_ACCOUNT_IDS, (accountID) => { - const moneyRequestOptions = ReportUtils.getMoneyRequestOptions({}, [currentUserAccountID, accountID], []); + const moneyRequestOptions = ReportUtils.getMoneyRequestOptions({}, {}, [currentUserAccountID, accountID]); return moneyRequestOptions.length === 0; }); expect(allEmpty).toBe(true); @@ -350,7 +350,7 @@ describe('ReportUtils', () => { ...LHNTestUtils.getFakeReport(), chatType: CONST.REPORT.CHAT_TYPE.POLICY_ROOM, }; - const moneyRequestOptions = ReportUtils.getMoneyRequestOptions(report, [currentUserAccountID], []); + const moneyRequestOptions = ReportUtils.getMoneyRequestOptions(report, {}, [currentUserAccountID]); expect(moneyRequestOptions.length).toBe(0); }); @@ -360,7 +360,7 @@ describe('ReportUtils', () => { chatType: CONST.REPORT.CHAT_TYPE.POLICY_EXPENSE_CHAT, isOwnPolicyExpenseChat: false, }; - const moneyRequestOptions = ReportUtils.getMoneyRequestOptions(report, [currentUserAccountID], []); + const moneyRequestOptions = ReportUtils.getMoneyRequestOptions(report, {}, [currentUserAccountID]); expect(moneyRequestOptions.length).toBe(0); }); @@ -370,7 +370,7 @@ describe('ReportUtils', () => { type: CONST.REPORT.TYPE.IOU, statusNum: CONST.REPORT.STATUS.REIMBURSED, }; - const moneyRequestOptions = ReportUtils.getMoneyRequestOptions(report, [currentUserAccountID], []); + const moneyRequestOptions = ReportUtils.getMoneyRequestOptions(report, {}, [currentUserAccountID]); expect(moneyRequestOptions.length).toBe(0); }); @@ -381,7 +381,7 @@ describe('ReportUtils', () => { stateNum: CONST.REPORT.STATE_NUM.SUBMITTED, statusNum: CONST.REPORT.STATUS.APPROVED, }; - const moneyRequestOptions = ReportUtils.getMoneyRequestOptions(report, [currentUserAccountID], []); + const moneyRequestOptions = ReportUtils.getMoneyRequestOptions(report, {}, [currentUserAccountID]); expect(moneyRequestOptions.length).toBe(0); }); @@ -391,7 +391,7 @@ describe('ReportUtils', () => { type: CONST.REPORT.TYPE.EXPENSE, statusNum: CONST.REPORT.STATUS.REIMBURSED, }; - const moneyRequestOptions = ReportUtils.getMoneyRequestOptions(report, [currentUserAccountID], []); + const moneyRequestOptions = ReportUtils.getMoneyRequestOptions(report, {}, [currentUserAccountID]); expect(moneyRequestOptions.length).toBe(0); }); @@ -405,7 +405,28 @@ describe('ReportUtils', () => { parentReportID: '100', type: CONST.REPORT.TYPE.EXPENSE, }; - const moneyRequestOptions = ReportUtils.getMoneyRequestOptions(report, [currentUserAccountID], [CONST.BETAS.IOU_SEND]); + const moneyRequestOptions = ReportUtils.getMoneyRequestOptions(report, {}, [currentUserAccountID]); + expect(moneyRequestOptions.length).toBe(0); + }); + }); + + it("it is a non-open expense report tied to user's own paid policy expense chat", () => { + Onyx.merge(`${ONYXKEYS.COLLECTION.REPORT}101`, { + reportID: '101', + chatType: CONST.REPORT.CHAT_TYPE.POLICY_EXPENSE_CHAT, + isOwnPolicyExpenseChat: true, + }).then(() => { + const report = { + ...LHNTestUtils.getFakeReport(), + type: CONST.REPORT.TYPE.EXPENSE, + stateNum: CONST.REPORT.STATE_NUM.PROCESSING, + statusNum: CONST.REPORT.STATUS.SUBMITTED, + parentReportID: '101', + }; + const paidPolicy = { + type: CONST.POLICY.TYPE.TEAM, + }; + const moneyRequestOptions = ReportUtils.getMoneyRequestOptions(report, paidPolicy, [currentUserAccountID, participantsAccountIDs[0]]); expect(moneyRequestOptions.length).toBe(0); }); }); @@ -420,7 +441,7 @@ describe('ReportUtils', () => { ...LHNTestUtils.getFakeReport(), chatType, }; - const moneyRequestOptions = ReportUtils.getMoneyRequestOptions(report, [currentUserAccountID, participantsAccountIDs[0]], []); + const moneyRequestOptions = ReportUtils.getMoneyRequestOptions(report, {}, [currentUserAccountID, participantsAccountIDs[0]]); return moneyRequestOptions.length === 1 && moneyRequestOptions.includes(CONST.IOU.TYPE.SPLIT); }, ); @@ -432,7 +453,7 @@ describe('ReportUtils', () => { ...LHNTestUtils.getFakeReport(), chatType: CONST.REPORT.CHAT_TYPE.POLICY_ROOM, }; - const moneyRequestOptions = ReportUtils.getMoneyRequestOptions(report, [currentUserAccountID, ...participantsAccountIDs], []); + const moneyRequestOptions = ReportUtils.getMoneyRequestOptions(report, {}, [currentUserAccountID, ...participantsAccountIDs]); expect(moneyRequestOptions.length).toBe(1); expect(moneyRequestOptions.includes(CONST.IOU.TYPE.SPLIT)).toBe(true); }); @@ -442,7 +463,7 @@ describe('ReportUtils', () => { ...LHNTestUtils.getFakeReport(), chatType: CONST.REPORT.CHAT_TYPE.POLICY_ROOM, }; - const moneyRequestOptions = ReportUtils.getMoneyRequestOptions(report, [currentUserAccountID, ...participantsAccountIDs], [CONST.BETAS.IOU_SEND]); + const moneyRequestOptions = ReportUtils.getMoneyRequestOptions(report, {}, [currentUserAccountID, ...participantsAccountIDs]); expect(moneyRequestOptions.length).toBe(1); expect(moneyRequestOptions.includes(CONST.IOU.TYPE.SPLIT)).toBe(true); }); @@ -453,7 +474,7 @@ describe('ReportUtils', () => { type: CONST.REPORT.TYPE.CHAT, participantsAccountIDs: [currentUserAccountID, ...participantsAccountIDs], }; - const moneyRequestOptions = ReportUtils.getMoneyRequestOptions(report, [currentUserAccountID, ...participantsAccountIDs], [CONST.BETAS.IOU_SEND]); + const moneyRequestOptions = ReportUtils.getMoneyRequestOptions(report, {}, [currentUserAccountID, ...participantsAccountIDs]); expect(moneyRequestOptions.length).toBe(1); expect(moneyRequestOptions.includes(CONST.IOU.TYPE.SPLIT)).toBe(true); }); @@ -461,22 +482,43 @@ describe('ReportUtils', () => { describe('return only money request option if', () => { it("it is an expense report tied to user's own policy expense chat", () => { - Onyx.merge(`${ONYXKEYS.COLLECTION.REPORT}101`, { - reportID: '101', + Onyx.merge(`${ONYXKEYS.COLLECTION.REPORT}102`, { + reportID: '102', chatType: CONST.REPORT.CHAT_TYPE.POLICY_EXPENSE_CHAT, isOwnPolicyExpenseChat: true, }).then(() => { const report = { ...LHNTestUtils.getFakeReport(), - parentReportID: '101', + parentReportID: '102', type: CONST.REPORT.TYPE.EXPENSE, }; - const moneyRequestOptions = ReportUtils.getMoneyRequestOptions(report, [currentUserAccountID], [CONST.BETAS.IOU_SEND]); + const moneyRequestOptions = ReportUtils.getMoneyRequestOptions(report, {}, [currentUserAccountID]); expect(moneyRequestOptions.length).toBe(1); expect(moneyRequestOptions.includes(CONST.IOU.TYPE.REQUEST)).toBe(true); }); }); + it("it is an open expense report tied to user's own paid policy expense chat", () => { + Onyx.merge(`${ONYXKEYS.COLLECTION.REPORT}103`, { + reportID: '103', + chatType: CONST.REPORT.CHAT_TYPE.POLICY_EXPENSE_CHAT, + isOwnPolicyExpenseChat: true, + }).then(() => { + const report = { + ...LHNTestUtils.getFakeReport(), + type: CONST.REPORT.TYPE.EXPENSE, + stateNum: CONST.REPORT.STATE_NUM.OPEN, + statusNum: CONST.REPORT.STATUS.OPEN, + parentReportID: '103', + }; + const paidPolicy = { + type: CONST.POLICY.TYPE.TEAM, + }; + const moneyRequestOptions = ReportUtils.getMoneyRequestOptions(report, paidPolicy, [currentUserAccountID, participantsAccountIDs[0]], true); + expect(moneyRequestOptions.length).toBe(1); + }); + }); + it('it is an IOU report in submitted state', () => { const report = { ...LHNTestUtils.getFakeReport(), @@ -485,7 +527,7 @@ describe('ReportUtils', () => { stateNum: CONST.REPORT.STATE_NUM.PROCESSING, statusNum: CONST.REPORT.STATUS.SUBMITTED, }; - const moneyRequestOptions = ReportUtils.getMoneyRequestOptions(report, [currentUserAccountID, participantsAccountIDs[0]], []); + const moneyRequestOptions = ReportUtils.getMoneyRequestOptions(report, {}, [currentUserAccountID, participantsAccountIDs[0]]); expect(moneyRequestOptions.length).toBe(1); expect(moneyRequestOptions.includes(CONST.IOU.TYPE.REQUEST)).toBe(true); }); @@ -498,7 +540,7 @@ describe('ReportUtils', () => { stateNum: CONST.REPORT.STATE_NUM.PROCESSING, statusNum: CONST.REPORT.STATUS.SUBMITTED, }; - const moneyRequestOptions = ReportUtils.getMoneyRequestOptions(report, [currentUserAccountID, participantsAccountIDs[0]], [CONST.BETAS.IOU_SEND]); + const moneyRequestOptions = ReportUtils.getMoneyRequestOptions(report, {}, [currentUserAccountID, participantsAccountIDs[0]]); expect(moneyRequestOptions.length).toBe(1); expect(moneyRequestOptions.includes(CONST.IOU.TYPE.REQUEST)).toBe(true); }); @@ -511,7 +553,7 @@ describe('ReportUtils', () => { chatType: CONST.REPORT.CHAT_TYPE.POLICY_EXPENSE_CHAT, isOwnPolicyExpenseChat: true, }; - const moneyRequestOptions = ReportUtils.getMoneyRequestOptions(report, [currentUserAccountID, ...participantsAccountIDs], [CONST.BETAS.IOU_SEND]); + const moneyRequestOptions = ReportUtils.getMoneyRequestOptions(report, {}, [currentUserAccountID, ...participantsAccountIDs]); expect(moneyRequestOptions.length).toBe(2); expect(moneyRequestOptions.includes(CONST.IOU.TYPE.REQUEST)).toBe(true); expect(moneyRequestOptions.includes(CONST.IOU.TYPE.SPLIT)).toBe(true); @@ -522,7 +564,7 @@ describe('ReportUtils', () => { ...LHNTestUtils.getFakeReport(), type: CONST.REPORT.TYPE.CHAT, }; - const moneyRequestOptions = ReportUtils.getMoneyRequestOptions(report, [currentUserAccountID, participantsAccountIDs[0]], [CONST.BETAS.IOU_SEND]); + const moneyRequestOptions = ReportUtils.getMoneyRequestOptions(report, {}, [currentUserAccountID, participantsAccountIDs[0]]); expect(moneyRequestOptions.length).toBe(2); expect(moneyRequestOptions.includes(CONST.IOU.TYPE.REQUEST)).toBe(true); expect(moneyRequestOptions.includes(CONST.IOU.TYPE.SEND)).toBe(true);