Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/libs/actions/IOU/Split.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1864,13 +1864,13 @@ function setIndividualShare(transactionID: string, participantAccountID: number,
/**
* Calculate merchant for distance transactions based on distance and rate
*/
function getDistanceMerchantFromDistance(distanceInUnits: number, unit: Unit | undefined, rate: number | undefined, currency: string, transactionCurrency?: string): string {
function getDistanceMerchantFromDistance(distanceInUnits: number, unit: Unit | undefined, rate: number | undefined, currency: string): string {
if (!rate || rate <= 0 || !unit) {
return '';
}

const distanceInMeters = DistanceRequestUtils.convertToDistanceInMeters(distanceInUnits, unit);
const currencyForMerchant = currency ?? transactionCurrency ?? CONST.CURRENCY.USD;
const currencyForMerchant = currency;
const currentLocale = IntlStore.getCurrentLocale();
return DistanceRequestUtils.getDistanceMerchant(
true,
Expand Down Expand Up @@ -1911,7 +1911,7 @@ function updateSplitExpenseDistanceFromAmount(
quantity,
};

const merchant = getDistanceMerchantFromDistance(distanceInUnits, unit, rate, mileageRate?.currency ?? transactionCurrency ?? CONST.CURRENCY.USD, transactionCurrency);
const merchant = getDistanceMerchantFromDistance(distanceInUnits, unit, rate, transactionCurrency ?? mileageRate?.currency ?? CONST.CURRENCY.USD);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Use selected rate currency in split amount recalculations

This change makes updateSplitExpenseDistanceFromAmount() prefer transactionCurrency over mileageRate.currency, which causes wrong merchant currency when a split expense rate is changed to one with a different currency. In split flows, amount recalculations (e.g., updateSplitExpenseAmountField) pass originalTransaction.currency as transactionCurrency, so the amount is recomputed from the new rate but the merchant string is formatted with the old currency, creating a currency/amount mismatch for edited split distances.

Useful? React with 👍 / 👎.


return {customUnit, merchant};
}
Expand Down Expand Up @@ -2339,8 +2339,8 @@ function updateSplitExpenseField(
updatedItem.amount = calculatedAmount;

// Update merchant for distance transactions
const currency = mileageRate?.currency ?? originalTransaction.currency ?? CONST.CURRENCY.USD;
updatedItem.merchant = getDistanceMerchantFromDistance(distanceInUnits, unit, rate, currency, originalTransaction.currency);
const currency = originalTransaction.currency ?? mileageRate?.currency ?? CONST.CURRENCY.USD;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Keep saved split-distance merchant aligned with chosen rate

When saving split distance edits, this now prioritizes originalTransaction.currency instead of mileageRate.currency for merchant formatting. In the split rate picker flow, changing customUnitRateID updates the draft transaction to the selected rate context, so if that rate uses a different currency, save will still stamp merchant text with the original transaction currency and show an incorrect currency symbol.

Useful? React with 👍 / 👎.

updatedItem.merchant = getDistanceMerchantFromDistance(distanceInUnits, unit, rate, currency);
}
}
}
Expand Down
Loading