feat(loyalty): implement complete loyalty module MVP
Add stamp-based and points-based loyalty programs for vendors with: Database Models (5 tables): - loyalty_programs: Vendor program configuration - loyalty_cards: Customer cards with stamp/point balances - loyalty_transactions: Immutable audit log - staff_pins: Fraud prevention PINs (bcrypt hashed) - apple_device_registrations: Apple Wallet push tokens Services: - program_service: Program CRUD and statistics - card_service: Customer enrollment and card lookup - stamp_service: Stamp operations with anti-fraud checks - points_service: Points earning and redemption - pin_service: Staff PIN management with lockout - wallet_service: Unified wallet abstraction - google_wallet_service: Google Wallet API integration - apple_wallet_service: Apple Wallet .pkpass generation API Routes: - Admin: /api/v1/admin/loyalty/* (programs list, stats) - Vendor: /api/v1/vendor/loyalty/* (stamp, points, cards, PINs) - Public: /api/v1/loyalty/* (enrollment, Apple Web Service) Anti-Fraud Features: - Staff PIN verification (configurable per program) - Cooldown period between stamps (default 15 min) - Daily stamp limits (default 5/day) - PIN lockout after failed attempts Wallet Integration: - Google Wallet: LoyaltyClass and LoyaltyObject management - Apple Wallet: .pkpass generation with PKCS#7 signing - Apple Web Service endpoints for device registration/updates Also includes: - Alembic migration for all tables with indexes - Localization files (en, fr, de, lu) - Module documentation - Phase 2 interface and user journey plan Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
59
app/modules/loyalty/services/__init__.py
Normal file
59
app/modules/loyalty/services/__init__.py
Normal file
@@ -0,0 +1,59 @@
|
||||
# app/modules/loyalty/services/__init__.py
|
||||
"""
|
||||
Loyalty module services.
|
||||
|
||||
Provides loyalty program management, card operations, stamp/points
|
||||
handling, and wallet integration.
|
||||
"""
|
||||
|
||||
from app.modules.loyalty.services.program_service import (
|
||||
ProgramService,
|
||||
program_service,
|
||||
)
|
||||
from app.modules.loyalty.services.card_service import (
|
||||
CardService,
|
||||
card_service,
|
||||
)
|
||||
from app.modules.loyalty.services.stamp_service import (
|
||||
StampService,
|
||||
stamp_service,
|
||||
)
|
||||
from app.modules.loyalty.services.points_service import (
|
||||
PointsService,
|
||||
points_service,
|
||||
)
|
||||
from app.modules.loyalty.services.pin_service import (
|
||||
PinService,
|
||||
pin_service,
|
||||
)
|
||||
from app.modules.loyalty.services.wallet_service import (
|
||||
WalletService,
|
||||
wallet_service,
|
||||
)
|
||||
from app.modules.loyalty.services.google_wallet_service import (
|
||||
GoogleWalletService,
|
||||
google_wallet_service,
|
||||
)
|
||||
from app.modules.loyalty.services.apple_wallet_service import (
|
||||
AppleWalletService,
|
||||
apple_wallet_service,
|
||||
)
|
||||
|
||||
__all__ = [
|
||||
"ProgramService",
|
||||
"program_service",
|
||||
"CardService",
|
||||
"card_service",
|
||||
"StampService",
|
||||
"stamp_service",
|
||||
"PointsService",
|
||||
"points_service",
|
||||
"PinService",
|
||||
"pin_service",
|
||||
"WalletService",
|
||||
"wallet_service",
|
||||
"GoogleWalletService",
|
||||
"google_wallet_service",
|
||||
"AppleWalletService",
|
||||
"apple_wallet_service",
|
||||
]
|
||||
Reference in New Issue
Block a user