Project

General

Profile

Edit Copy Actions

Feature #10320

open

To implement dynamic currency data in Reward Points Ledger & Customer Reward Statistics

Added by Ajit A about 1 month ago. Updated about 1 month ago.

Status:
Resolved
Priority:
Normal
Assignee:
Target version:
-
Start date:
08/11/2026
Due date:
% Done:

100%

Estimated time:

Add

Subtasks


Add

Related issues

Updated by Ajit A about 1 month ago

  • % Done changed from 0 to 50

1. Backend Repository (evergreen_pos_be)
Files Modified:

src/models/Loyalty/loyaltyWalletSchema.js
src/models/Loyalty/loyaltyLedgerSchema.js
src/models/Loyalty/loyaltyProgramSchema.js
src/services/loyaltyEngine.js
src/services/loyaltyProgram.service.js
src/services/nursery/sale.service.js
Key Changes:

Database Schema Enhancements:
Added a spendByCurrency array to the LoyaltyWallet schema to explicitly track raw local currency spending (e.g. INR vs USD) without mixing disparate currencies.
Added currency attributes directly to the LoyaltyLedger for historical referencing.
Currency Normalization Logic:
Updated POS and E-commerce flows (sale.service.js & loyaltyEngine.js) to protect VIP tier eligibility (lifetimeSpend).
lifetimeSpend is now strictly calculated using the normalized Base Currency (e.g. USD).
The actual transaction currency footprint is accurately calculated via the exchange rate and stored into the spendByCurrency array.
Multi-Channel Display & Performance:
Heavily optimized the Customer Accounts API (listTenantCustomerLoyaltyAccounts in loyaltyProgram.service.js) by disabling legacy blocking sync queries that caused timeout/slowness issues.
Implemented an aggregator that scans a customer's entire ledger history, merges it with their base channelType, and returns a dynamically grouped, comma-separated list of all their active channels (e.g., online, pos, service).
Retrofitted the API filtering logic to intelligently support "Includes" matching so that filtering the dropdown by "POS" still perfectly matches customers returning "online, pos".
Added support for the currency query parameter on the Loyalty Ledger list API.
2. Frontend Repository (evergreen_pos_fe)
Files Modified:

src/pages/Settings/CompanyProfile/LoyaltyCustomerAnalytics.tsx
src/pages/Settings/CompanyProfile/LoyaltyRewardSettings.tsx
src/pages/Nuresy/POS/PaymentComponentNew.tsx
Key Changes:

Dynamic Currency Formatting:
Removed hardcoded USD formatting across the Customer Accounts and Ledger tabs.
The application now dynamically retrieves the company's base currency code from the cached companyDetails (or defaults gracefully) and applies proper locale-aware Intl.NumberFormat to all loyalty monetary values.
Filter Enhancements:
Added UI dropdown inputs in the Ledger table to support filtering loyalty transactions by the specific transaction currency.
Data Presentation:
The "Channel" column now natively supports and visually displays the comma-separated multi-channel combinations (e.g. online, pos) delivered by the new backend aggregator API.

Updated by Ajit A about 1 month ago

  • % Done changed from 50 to 100

Completed

Actions #3

Updated by Ajit A about 1 month ago

  • Status changed from New to Resolved
Edit Copy Actions

Also available in: Atom PDF