diff --git a/src/components/AddPaymentMethodMenu.tsx b/src/components/AddPaymentMethodMenu.tsx index 0057438e3913..50020906075d 100644 --- a/src/components/AddPaymentMethodMenu.tsx +++ b/src/components/AddPaymentMethodMenu.tsx @@ -117,7 +117,6 @@ function AddPaymentMethodMenu({ text: translate('common.businessBankAccount'), icon: Expensicons.Building, onSelected: () => { - completePaymentOnboarding(CONST.PAYMENT_SELECTED.BBA); onItemSelected(CONST.PAYMENT_METHODS.BUSINESS_BANK_ACCOUNT); }, }, diff --git a/src/components/KYCWall/BaseKYCWall.tsx b/src/components/KYCWall/BaseKYCWall.tsx index b846449faafd..7526720bddc0 100644 --- a/src/components/KYCWall/BaseKYCWall.tsx +++ b/src/components/KYCWall/BaseKYCWall.tsx @@ -5,6 +5,7 @@ import type {EmitterSubscription, GestureResponderEvent, View} from 'react-nativ import {useOnyx} from 'react-native-onyx'; import AddPaymentMethodMenu from '@components/AddPaymentMethodMenu'; import * as BankAccounts from '@libs/actions/BankAccounts'; +import {completePaymentOnboarding} from '@libs/actions/IOU'; import getClickedTargetLocation from '@libs/getClickedTargetLocation'; import Log from '@libs/Log'; import Navigation from '@libs/Navigation/Navigation'; @@ -108,7 +109,8 @@ function KYCWall({ Navigation.navigate(addDebitCardRoute); } else if (paymentMethod === CONST.PAYMENT_METHODS.BUSINESS_BANK_ACCOUNT) { if (iouReport && ReportUtils.isIOUReport(iouReport)) { - const {policyID, workspaceChatReportID, reportPreviewReportActionID} = Policy.createWorkspaceFromIOUPayment(iouReport) ?? {}; + const {policyID, workspaceChatReportID, reportPreviewReportActionID, adminsChatReportID} = Policy.createWorkspaceFromIOUPayment(iouReport) ?? {}; + completePaymentOnboarding(CONST.PAYMENT_SELECTED.BBA, adminsChatReportID, policyID); if (workspaceChatReportID) { Navigation.navigate(ROUTES.REPORT_WITH_ID.getRoute(workspaceChatReportID, reportPreviewReportActionID)); } diff --git a/src/libs/actions/IOU.ts b/src/libs/actions/IOU.ts index e0c2fb339f52..498de39a145d 100644 --- a/src/libs/actions/IOU.ts +++ b/src/libs/actions/IOU.ts @@ -7346,7 +7346,7 @@ function cancelPayment(expenseReport: OnyxEntry, chatReport: O * * @param paymentSelected based on which we choose the onboarding choice and concierge message */ -function completePaymentOnboarding(paymentSelected: ValueOf) { +function completePaymentOnboarding(paymentSelected: ValueOf, adminsChatReportID?: string, onboardingPolicyID?: string) { const isInviteOnboardingComplete = introSelected?.isInviteOnboardingComplete ?? false; if (isInviteOnboardingComplete || !introSelected?.choice) { @@ -7367,7 +7367,15 @@ function completePaymentOnboarding(paymentSelected: ValueOf, full = true) { diff --git a/src/libs/actions/Policy/Policy.ts b/src/libs/actions/Policy/Policy.ts index f514a9b27158..628e0918aa54 100644 --- a/src/libs/actions/Policy/Policy.ts +++ b/src/libs/actions/Policy/Policy.ts @@ -130,6 +130,7 @@ type WorkspaceFromIOUCreationData = { policyID: string; workspaceChatReportID: string; reportPreviewReportActionID?: string; + adminsChatReportID: string; }; const allPolicies: OnyxCollection = {}; @@ -2563,7 +2564,7 @@ function createWorkspaceFromIOUPayment(iouReport: OnyxEntry): WorkspaceF API.write(WRITE_COMMANDS.CREATE_WORKSPACE_FROM_IOU_PAYMENT, params, {optimisticData, successData, failureData}); - return {policyID, workspaceChatReportID: memberData.workspaceChatReportID, reportPreviewReportActionID: reportPreview?.reportActionID}; + return {policyID, workspaceChatReportID: memberData.workspaceChatReportID, reportPreviewReportActionID: reportPreview?.reportActionID, adminsChatReportID}; } function enablePolicyConnections(policyID: string, enabled: boolean) {