diff --git a/src/CONST.ts b/src/CONST.ts index 4c694ad78de6..99084a2c7080 100755 --- a/src/CONST.ts +++ b/src/CONST.ts @@ -6634,10 +6634,10 @@ const CONST = { }, }, LAST_PAYMENT_METHOD: { - DEFAULT: 'DEFAULT', - IOU: 'IOU', - EXPENSE: 'EXPENSE', - INVOICE: 'INVOICE', + LAST_USED: 'lastUsed', + IOU: 'Iou', + EXPENSE: 'Expense', + INVOICE: 'Invoice', }, SKIPPABLE_COLLECTION_MEMBER_IDS: [String(DEFAULT_NUMBER_ID), '-1', 'undefined', 'null', 'NaN'] as string[], SETUP_SPECIALIST_LOGIN: 'Setup Specialist', diff --git a/src/components/Search/SearchPageHeader.tsx b/src/components/Search/SearchPageHeader.tsx index 2cfcbc6f00cd..3c62498ffd4d 100644 --- a/src/components/Search/SearchPageHeader.tsx +++ b/src/components/Search/SearchPageHeader.tsx @@ -150,14 +150,14 @@ function SearchPageHeader({queryJSON}: SearchPageHeaderProps) { report.action === CONST.SEARCH.ACTION_TYPES.PAY && report.policyID && ((!!lastPaymentMethods[report.policyID] && typeof lastPaymentMethods[report.policyID] === 'string') || - !!(lastPaymentMethods[report.policyID] as LastPaymentMethodType)?.DEFAULT), + !!(lastPaymentMethods[report.policyID] as LastPaymentMethodType)?.lastUsed), ) : selectedTransactionsKeys.every( (id) => selectedTransactions[id].action === CONST.SEARCH.ACTION_TYPES.PAY && selectedTransactions[id].policyID && ((!!lastPaymentMethods[selectedTransactions[id].policyID] && typeof lastPaymentMethods[selectedTransactions[id].policyID] === 'string') || - !!(lastPaymentMethods[selectedTransactions[id].policyID] as LastPaymentMethodType).DEFAULT), + !!(lastPaymentMethods[selectedTransactions[id].policyID] as LastPaymentMethodType).lastUsed), )); if (shouldShowPayOption) { diff --git a/src/components/SettlementButton/index.tsx b/src/components/SettlementButton/index.tsx index c4454b32e52b..bca6765d099f 100644 --- a/src/components/SettlementButton/index.tsx +++ b/src/components/SettlementButton/index.tsx @@ -80,7 +80,7 @@ function SettlementButton({ if (typeof paymentMethod?.[policyIDKey] === 'string') { return paymentMethod?.[policyIDKey]; } - return (paymentMethod?.[policyIDKey] as LastPaymentMethodType)?.DEFAULT; + return (paymentMethod?.[policyIDKey] as LastPaymentMethodType)?.lastUsed; }, }); diff --git a/src/libs/actions/Search.ts b/src/libs/actions/Search.ts index 062aab2eedb3..a5b9d8f9d7b2 100644 --- a/src/libs/actions/Search.ts +++ b/src/libs/actions/Search.ts @@ -85,7 +85,7 @@ function getLastPolicyPaymentMethod(policyID: string | undefined, lastPaymentMet if (typeof lastPaymentMethods?.[policyID] === 'string') { lastPolicyPaymentMethod = lastPaymentMethods?.[policyID] as ValueOf; } else { - lastPolicyPaymentMethod = (lastPaymentMethods?.[policyID] as LastPaymentMethodType)?.DEFAULT as ValueOf; + lastPolicyPaymentMethod = (lastPaymentMethods?.[policyID] as LastPaymentMethodType)?.lastUsed as ValueOf; } return lastPolicyPaymentMethod; @@ -97,7 +97,7 @@ function getPayActionCallback(hash: number, item: TransactionListItemType | Repo if (typeof lastPaymentMethod?.[item.policyID] === 'string') { lastPolicyPaymentMethod = lastPaymentMethod?.[item.policyID] as ValueOf; } else { - lastPolicyPaymentMethod = (lastPaymentMethod?.[item.policyID] as LastPaymentMethodType)?.DEFAULT as ValueOf; + lastPolicyPaymentMethod = (lastPaymentMethod?.[item.policyID] as LastPaymentMethodType)?.lastUsed as ValueOf; } } diff --git a/src/types/onyx/LastPaymentMethod.ts b/src/types/onyx/LastPaymentMethod.ts index fb7038eaceb3..3e2a5156289d 100644 --- a/src/types/onyx/LastPaymentMethod.ts +++ b/src/types/onyx/LastPaymentMethod.ts @@ -3,13 +3,13 @@ */ type LastPaymentMethodType = { /** The default last payment method, this one holds the existing data of the old lastPaymentMethod value which is string */ - DEFAULT: string; + lastUsed: string; /** The lastPaymentMethod of an IOU */ - IOU: string; + Iou: string; /** The lastPaymentMethod of an Expense */ - EXPENSE: string; + Expense: string; /** The lastPaymentMethod of an Invoice */ - INVOICE: string; + Invoice: string; }; /** Record of last payment methods, indexed by policy id */