Some checks failed
Adds the backend half of the Android tablet rollout. Merchants can
pair tablets to specific stores from /merchants/loyalty/devices (or
admins can pair on behalf from the merchant detail page). Each
pairing issues a long-lived JWT shown ONCE in the response with a
server-rendered QR PNG containing {api_url, store_code, auth_token} —
the tablet scans it on first boot and persists the three fields.
The store API (/api/v1/store/loyalty/*) now accepts these device JWTs
alongside user JWTs. Revoking a device row immediately rejects its
token (401 TERMINAL_DEVICE_REVOKED). Tokens expire after 1 year;
re-pair to renew.
- Migration loyalty_010 + TerminalDevice model
- create_device_token / verify_device_token JWT helpers
- 5 endpoints x 2 portals (merchant + admin on-behalf)
- Bearer-auth wiring in app/api/deps.py
- Pages, shared list partial with one-time pairing-QR modal,
Alpine.js factories
- Locale strings (en authoritative; fr/de/lb seeded with EN copy
for translation)
- 6 integration tests covering pair, list, revoke, idempotency,
cross-merchant rejection, store-API auth via device JWT
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
66 lines
1.5 KiB
Python
66 lines
1.5 KiB
Python
# 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.apple_wallet_service import (
|
|
AppleWalletService,
|
|
apple_wallet_service,
|
|
)
|
|
from app.modules.loyalty.services.card_service import (
|
|
CardService,
|
|
card_service,
|
|
)
|
|
from app.modules.loyalty.services.google_wallet_service import (
|
|
GoogleWalletService,
|
|
google_wallet_service,
|
|
)
|
|
from app.modules.loyalty.services.pin_service import (
|
|
PinService,
|
|
pin_service,
|
|
)
|
|
from app.modules.loyalty.services.points_service import (
|
|
PointsService,
|
|
points_service,
|
|
)
|
|
from app.modules.loyalty.services.program_service import (
|
|
ProgramService,
|
|
program_service,
|
|
)
|
|
from app.modules.loyalty.services.stamp_service import (
|
|
StampService,
|
|
stamp_service,
|
|
)
|
|
from app.modules.loyalty.services.terminal_device_service import (
|
|
TerminalDeviceService,
|
|
terminal_device_service,
|
|
)
|
|
from app.modules.loyalty.services.wallet_service import (
|
|
WalletService,
|
|
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",
|
|
"TerminalDeviceService",
|
|
"terminal_device_service",
|
|
]
|