Skip to content

## feat: Per-item loyalty cashback, unified checkout UI, settings cleanup - #9

Merged
itsbkm merged 1 commit into
FreeOpenSourcePOS:mainfrom
ARCHITVARMA15:main
Jun 17, 2026
Merged

## feat: Per-item loyalty cashback, unified checkout UI, settings cleanup#9
itsbkm merged 1 commit into
FreeOpenSourcePOS:mainfrom
ARCHITVARMA15:main

Conversation

@ARCHITVARMA15

Copy link
Copy Markdown
Contributor

Changes

Loyalty System

  • Implement per-item cashback crediting on bill payment — credits cb_percent of each order item's subtotal to the customer's loyalty wallet
  • Loyalty points are now credited per-item (not per-order total), aligned with per-product cashback configuration
  • Removed configurable "Points per ₹" and "Redemption Value" fields from Settings (loyalty is managed per-product via the existing cb_percent field)
  • Add GET /customers/:id/loyalty-ledger — returns balance, next expiry, full transaction history
  • Customers list now includes live loyalty balance (pts) from the ledger

Checkout UI Consistency

  • Unified PrepaidCheckoutModal and PaymentModal to use the same dark card header (TOTAL DUE + customer name)
  • Removed redundant phone number from checkout card
  • Added staff-facing loyalty strip in both modals: current pts + expiry date
  • Removed marketing-language "earn X points" banner

Customers Page

  • Added loyalty ledger modal (history icon) — shows total balance, next expiry, full transaction table
  • Fixed duplicate country code display in phone numbers
  • Fixed customer topbar showing raw tag data ("7 x1")
  • Loyalty column now shows live pts balance instead of always showing "—"

Settings

  • Loyalty settings page now shows only: Enable toggle + Points Expiry (days)

@itsbkm
itsbkm merged commit a23cee5 into FreeOpenSourcePOS:main Jun 17, 2026
khaira777 added a commit that referenced this pull request Jul 5, 2026
…ts/discounts/tax/loyalty)

Integration tests (7 files, 123 assertions):
- Happy path: order→discount→bill→payment→completed
- Tax correctness: India GST calculation and recalculation
- Payment integrity: split payments, wallet double-spend, zero-amount rejection
- Order lifecycle: status transitions, cancel with PIN
- Bill reconciliation: discount sync, add-items sync
- Loyalty points: cashback, idempotency, wallet balance
- Discount edge cases: combined discounts, max limits, addon prices

Bug fixes:
- #3: Add-items filters cancelled items from total recalculation
- #4: Add-items syncs bill after updating order total
- #5: Cancel/restore round-off formula corrected
- #6: Discount endpoint wrapped in withTxn (race condition)
- #7: Infinity passes validation (NaN/isFinite check)
- #8: Missing amount defaults to remaining balance
- #9: Amount capped at remaining balance
- #11: Removing discount restores original tax
- #12: Add-items preserves order-level discount
- #13: Cancel/restore preserves order-level discount
- #14: Item-level discount checks max settings
- #15: Item-level discount syncs to bill
- #17: Cancel/restore wrapped in withTxn
- #20: Cashback calculated on discounted subtotal
- #23: Quantity/price validation on order creation

Shared test helper (tests/helpers/test-setup.ts):
- Extracts 40 lines of boilerplate per test file
- Provides: initTestDb, createApp, startServer, seed helpers, assert utilities

Co-Authored-By: Claude <noreply@anthropic.com>
khaira777 pushed a commit that referenced this pull request Jul 6, 2026
## feat: Per-item loyalty cashback, unified checkout UI, settings cleanup
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants