Skip to main content

Wallet & Loyalty System

The wallet and loyalty system provides a rewards program with tiered benefits, wallet-based payment, and automated lifecycle management.

Core Concepts

Wallet

A digital wallet linked to a guest account. Stores reward points as monetary balance that can be applied toward bookings.

Loyalty Tiers

Guests are assigned to tiers based on their 12-month spending. Each tier has:

  • Minimum spend threshold — amount needed to qualify
  • Reward rule — conversion rate (spend → reward points) and expiry
  • Redemption capability — percentage of booking that can be paid via wallet
  • Benefits — redeemable perks (upgrades, early check-in, etc.)

Transaction Flow

Reward Credit (after booking checkout):
UPCOMING → EARNED → USED/EXPIRED

Wallet Hold (during checkout):
ON_HOLD → USED (confirmed) / RELEASED (cancelled)

Consumption:
EARNED transactions consumed in FIFO order (earliest expiry first)
WalletConsumedLog tracks which credit was consumed against which booking

Module Structure

wallet-loyalty/
├── service/
│ ├── WalletService # CRUD, wallet details, applicability, reward calculation
│ ├── WalletOperationsService # hold/confirm/release/credit/expire/load/cancel
│ └── LoyaltyService # CRUD, opt-in, tier progression, joining reward
└── scheduler/
├── LoyaltySchedulerService # tier re-eval, renewal, checkout updates
└── WalletAndLoyaltyScheduler # @Scheduled cron triggers

Both website (customer-facing) and crs (agent-facing) depend on this module.

Database Tables

TablePurpose
walletGuest wallet balance and status
wallet_transaction_logAll credit/debit/hold transactions
wallet_consumed_logTracks which earned transaction was consumed by which debit
wallet_reward_ruleDefines spend-to-reward conversion per tier
loyaltyGuest loyalty record (tier, spend, dates)
loyalty_tierTier definitions (level, thresholds, redemption %)
benefitAvailable benefits (upgrades, perks)
loyalty_tier_benefitM2M: which benefits belong to which tier
loyalty_joining_rewardTracks joining bonus rewards