Skip to content

Commit

Permalink
Revert a change and edit docs
Browse files Browse the repository at this point in the history
  • Loading branch information
MonilBhavsar committed Jun 5, 2024
1 parent 7f1f408 commit 941dd37
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/libs/TransactionUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -695,8 +695,9 @@ function getRateID(transaction: OnyxEntry<Transaction>): string | undefined {
}

/**
* Gets the tax code based on selected currency.
* Returns policy default tax rate if transaction is in policy default currency, otherwise returns foreign default tax rate
* Gets the tax code based on the type of transaction and selected currency.
* If it is distance request, then returns the tax code corresponding to the custom unit rate
* Else returns policy default tax rate if transaction is in policy default currency, otherwise foreign default tax rate
*/
function getDefaultTaxCode(policy: OnyxEntry<Policy>, transaction: OnyxEntry<Transaction>, currency?: string | undefined) {
if (isDistanceRequest(transaction)) {
Expand Down Expand Up @@ -748,12 +749,11 @@ function getWorkspaceTaxesSettingsName(policy: OnyxEntry<Policy>, taxCode: strin
}

/**
* Gets the tax name for the given transaction.
* If it is distance request, then returns the tax name corresponding to the custom unit rate
* Gets the name corresponding to the taxCode that is displayed to the user
*/
function getTaxName(policy: OnyxEntry<Policy>, transaction: OnyxEntry<Transaction>) {
const taxCode = getDefaultTaxCode(policy, transaction) ?? '';
return Object.values(transformedTaxRates(policy, transaction)).find((taxRate) => taxRate.code === (transaction?.taxCode ?? taxCode))?.modifiedName;
const defaultTaxCode = getDefaultTaxCode(policy, transaction);
return Object.values(transformedTaxRates(policy, transaction)).find((taxRate) => taxRate.code === (transaction?.taxCode ?? defaultTaxCode))?.modifiedName;
}

export {
Expand Down

0 comments on commit 941dd37

Please sign in to comment.