Skip to content

Commit 5005f59

Browse files
authored
Merge pull request #46557 from gijoe0295/gijoe/46339
[CP Staging] Fix: Not redirect to workspace chat when pay IOU with business account
2 parents b783854 + 161d11f commit 5005f59

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

src/components/KYCWall/BaseKYCWall.tsx

+4-1
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,10 @@ function KYCWall({
127127
Navigation.navigate(addDebitCardRoute);
128128
} else if (paymentMethod === CONST.PAYMENT_METHODS.BUSINESS_BANK_ACCOUNT) {
129129
if (iouReport && ReportUtils.isIOUReport(iouReport)) {
130-
const policyID = Policy.createWorkspaceFromIOUPayment(iouReport);
130+
const {policyID, workspaceChatReportID, reportPreviewReportActionID} = Policy.createWorkspaceFromIOUPayment(iouReport) ?? {};
131+
if (workspaceChatReportID) {
132+
Navigation.navigate(ROUTES.REPORT_WITH_ID.getRoute(workspaceChatReportID, reportPreviewReportActionID));
133+
}
131134

132135
// Navigate to the bank account set up flow for this specific policy
133136
Navigation.navigate(ROUTES.BANK_ACCOUNT_WITH_STEP_TO_OPEN.getRoute('', policyID));

src/libs/actions/Policy/Policy.ts

+8-2
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,12 @@ type NewCustomUnit = {
107107
rates: Rate;
108108
};
109109

110+
type WorkspaceFromIOUCreationData = {
111+
policyID: string;
112+
workspaceChatReportID: string;
113+
reportPreviewReportActionID?: string;
114+
};
115+
110116
const allPolicies: OnyxCollection<Policy> = {};
111117
Onyx.connect({
112118
key: ONYXKEYS.COLLECTION.POLICY,
@@ -2066,7 +2072,7 @@ function dismissAddedWithPrimaryLoginMessages(policyID: string) {
20662072
*
20672073
* @returns policyID of the workspace we have created
20682074
*/
2069-
function createWorkspaceFromIOUPayment(iouReport: OnyxEntry<Report>): string | undefined {
2075+
function createWorkspaceFromIOUPayment(iouReport: OnyxEntry<Report>): WorkspaceFromIOUCreationData | undefined {
20702076
// This flow only works for IOU reports
20712077
if (!ReportUtils.isIOUReportUsingReport(iouReport)) {
20722078
return;
@@ -2499,7 +2505,7 @@ function createWorkspaceFromIOUPayment(iouReport: OnyxEntry<Report>): string | u
24992505

25002506
API.write(WRITE_COMMANDS.CREATE_WORKSPACE_FROM_IOU_PAYMENT, params, {optimisticData, successData, failureData});
25012507

2502-
return policyID;
2508+
return {policyID, workspaceChatReportID: memberData.workspaceChatReportID, reportPreviewReportActionID: reportPreview?.reportActionID};
25032509
}
25042510

25052511
function enablePolicyConnections(policyID: string, enabled: boolean) {

0 commit comments

Comments
 (0)