diff --git a/src/types/onyx/Policy.ts b/src/types/onyx/Policy.ts index 672816e1fa6b..86f4a1aaad38 100644 --- a/src/types/onyx/Policy.ts +++ b/src/types/onyx/Policy.ts @@ -1491,9 +1491,15 @@ type PolicyInvoicingDetails = OnyxCommon.OnyxValueWithOfflineFeedback<{ /** Account balance */ stripeConnectAccountBalance?: number; + /** AccountID */ + stripeConnectAccountID?: string; + /** bankAccountID of selected BBA for payouts */ transferBankAccountID?: number; }; + + /** The markUp */ + markUp?: number; }>; /** Names of policy features */ @@ -1593,7 +1599,7 @@ type Policy = OnyxCommon.OnyxValueWithOfflineFeedback< outputCurrency: string; /** The address of the company */ - address?: CompanyAddress; + address?: CompanyAddress | []; /** The URL for the policy avatar */ avatarURL?: string; @@ -1742,13 +1748,15 @@ type Policy = OnyxCommon.OnyxValueWithOfflineFeedback< taxRates?: TaxRatesWithDefault; /** A set of rules related to the workpsace */ - rules?: { - /** A set of rules related to the workpsace approvals */ - approvalRules?: ApprovalRule[]; - - /** A set of rules related to the workpsace expenses */ - expenseRules?: ExpenseRule[]; - }; + rules?: + | { + /** A set of rules related to the workpsace approvals */ + approvalRules?: ApprovalRule[]; + + /** A set of rules related to the workpsace expenses */ + expenseRules?: ExpenseRule[]; + } + | []; /** ReportID of the admins room for this workspace */ chatReportIDAdmins?: number; diff --git a/src/types/onyx/Report.ts b/src/types/onyx/Report.ts index 7f652904f0cb..f552c5eeaef4 100644 --- a/src/types/onyx/Report.ts +++ b/src/types/onyx/Report.ts @@ -194,7 +194,7 @@ type Report = OnyxCommon.OnyxValueWithOfflineFeedback< currency?: string; /** Collection of errors that exist in report fields */ - errorFields?: OnyxCommon.ErrorFields; + errorFields?: OnyxCommon.ErrorFields | null; /** Whether the report is waiting on a bank account */ isWaitingOnBankAccount?: boolean; diff --git a/tests/actions/IOUTest.ts b/tests/actions/IOUTest.ts index a28ab0a5b3e8..9b75a5d9be63 100644 --- a/tests/actions/IOUTest.ts +++ b/tests/actions/IOUTest.ts @@ -3407,6 +3407,7 @@ describe('actions/IOU', () => { areReportFieldsEnabled: false, areConnectionsEnabled: false, employeeList: { + // eslint-disable-next-line @typescript-eslint/naming-convention 'a1@53019.com': { role: 'admin', errors: {}, @@ -3438,6 +3439,7 @@ describe('actions/IOU', () => { reimbursable: false, }, fieldList: { + // eslint-disable-next-line @typescript-eslint/naming-convention text_title: { defaultValue: '{report:type} {report:startdate}', deletable: true, @@ -3537,7 +3539,7 @@ describe('actions/IOU', () => { expect(writeSpy).toHaveBeenCalledWith( expect.anything(), expect.objectContaining({ - invoiceRoomReportID: expect.not.stringMatching(convertedInvoiceChat.reportID), + invoiceRoomReportID: expect.not.stringMatching(convertedInvoiceChat?.reportID ?? ''), }), expect.anything(), ); diff --git a/tests/unit/ReportUtilsTest.ts b/tests/unit/ReportUtilsTest.ts index 918115f3756d..5ff3a73b3089 100644 --- a/tests/unit/ReportUtilsTest.ts +++ b/tests/unit/ReportUtilsTest.ts @@ -8,6 +8,7 @@ import CONST from '@src/CONST'; import * as TransactionUtils from '@src/libs/TransactionUtils'; import ONYXKEYS from '@src/ONYXKEYS'; import type {PersonalDetailsList, Policy, Report, ReportAction} from '@src/types/onyx'; +import type {InvoiceReceiver} from '@src/types/onyx/Report'; import {toCollectionDataSet} from '@src/types/utils/CollectionDataSet'; import * as NumberUtils from '../../src/libs/NumberUtils'; import * as LHNTestUtils from '../utils/LHNTestUtils'; @@ -62,24 +63,27 @@ const policy: Policy = { isPolicyExpenseChatEnabled: false, }; -const convertedInvoiceChat = { +const convertedInvoiceChat: OnyxEntry = { chatType: CONST.REPORT.CHAT_TYPE.INVOICE, currency: 'USD', description: '', errorFields: null, hasOutstandingChildRequest: false, hasOutstandingChildTask: false, + + // The invoice receiver shouldn't have an accountID when the type is business, + // but this is to test that it still works if the value is present invoiceReceiver: { accountID: 33, policyID: '5F2F82F98C848CAA', type: 'policy', - }, + } as unknown as InvoiceReceiver, isCancelledIOU: false, isOwnPolicyExpenseChat: false, isPinned: false, isWaitingOnBankAccount: false, lastActionType: 'REPORTPREVIEW', - lastActorAccountID: '32', + lastActorAccountID: 32, lastMessageHtml: 'paid $1.00', lastMessageText: 'paid $1.00', lastMessageTranslationKey: '', @@ -98,7 +102,7 @@ const convertedInvoiceChat = { }, '33': { notificationPreference: 'always', - permissions: ['read', 'write', 'share', 'own'], + permissions: [CONST.REPORT.PERMISSIONS.READ, CONST.REPORT.PERMISSIONS.WRITE, CONST.REPORT.PERMISSIONS.SHARE, CONST.REPORT.PERMISSIONS.OWN], }, }, policyAvatar: '',