Skip to content

Commit

Permalink
Merge pull request Expensify#52482 from callstack-internal/expense-fi…
Browse files Browse the repository at this point in the history
…x-view-of-amount-with-description

Fix distance amount changes after submitting track distance expense with description
  • Loading branch information
rlinoz authored Nov 18, 2024
2 parents d9462db + 76de333 commit b5dbb51
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/libs/API/parameters/CategorizeTrackedExpenseParams.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ type CategorizeTrackedExpenseParams = {
taxCode: string;
taxAmount: number;
billable?: boolean;
waypoints?: string;
customUnitRateID?: string;
};

export default CategorizeTrackedExpenseParams;
2 changes: 2 additions & 0 deletions src/libs/API/parameters/ShareTrackedExpenseParams.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ type ShareTrackedExpenseParams = {
taxCode: string;
taxAmount: number;
billable?: boolean;
customUnitRateID?: string;
waypoints?: string;
};

export default ShareTrackedExpenseParams;
16 changes: 15 additions & 1 deletion src/libs/actions/IOU.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3389,6 +3389,8 @@ function categorizeTrackedExpense(
billable?: boolean,
receipt?: Receipt,
createdWorkspaceParams?: CreateWorkspaceParams,
waypoints?: string,
customUnitRateID?: string,
) {
const {optimisticData, successData, failureData} = onyxData ?? {};

Expand Down Expand Up @@ -3435,6 +3437,8 @@ function categorizeTrackedExpense(
policyExpenseCreatedReportActionID: createdWorkspaceParams?.expenseCreatedReportActionID,
adminsChatReportID: createdWorkspaceParams?.adminsChatReportID,
adminsCreatedReportActionID: createdWorkspaceParams?.adminsCreatedReportActionID,
waypoints,
customUnitRateID,
};

API.write(WRITE_COMMANDS.CATEGORIZE_TRACKED_EXPENSE, parameters, {optimisticData, successData, failureData});
Expand Down Expand Up @@ -3470,6 +3474,8 @@ function shareTrackedExpense(
billable?: boolean,
receipt?: Receipt,
createdWorkspaceParams?: CreateWorkspaceParams,
waypoints?: string,
customUnitRateID?: string,
) {
const {optimisticData, successData, failureData} = onyxData ?? {};

Expand Down Expand Up @@ -3516,6 +3522,8 @@ function shareTrackedExpense(
policyExpenseCreatedReportActionID: createdWorkspaceParams?.expenseCreatedReportActionID,
adminsChatReportID: createdWorkspaceParams?.adminsChatReportID,
adminsCreatedReportActionID: createdWorkspaceParams?.adminsCreatedReportActionID,
waypoints,
customUnitRateID,
};

API.write(WRITE_COMMANDS.SHARE_TRACKED_EXPENSE, parameters, {optimisticData, successData, failureData});
Expand Down Expand Up @@ -3819,6 +3827,8 @@ function trackExpense(
value: recentServerValidatedWaypoints,
});

const waypoints = validWaypoints ? JSON.stringify(sanitizeRecentWaypoints(validWaypoints)) : undefined;

switch (action) {
case CONST.IOU.ACTION.CATEGORIZE: {
if (!linkedTrackedExpenseReportAction || !actionableWhisperReportActionID || !linkedTrackedExpenseReportID) {
Expand Down Expand Up @@ -3849,6 +3859,8 @@ function trackExpense(
billable,
trackedReceipt,
createdWorkspaceParams,
waypoints,
customUnitRateID,
);
break;
}
Expand Down Expand Up @@ -3880,6 +3892,8 @@ function trackExpense(
billable,
trackedReceipt,
createdWorkspaceParams,
waypoints,
customUnitRateID,
);
break;
}
Expand Down Expand Up @@ -3908,7 +3922,7 @@ function trackExpense(
receiptGpsPoints: gpsPoints ? JSON.stringify(gpsPoints) : undefined,
transactionThreadReportID: transactionThreadReportID ?? '-1',
createdReportActionIDForThread: createdReportActionIDForThread ?? '-1',
waypoints: validWaypoints ? JSON.stringify(sanitizeRecentWaypoints(validWaypoints)) : undefined,
waypoints,
customUnitRateID,
};
if (actionableWhisperReportActionIDParam) {
Expand Down

0 comments on commit b5dbb51

Please sign in to comment.