feat: wire Google Wallet into loyalty enrollment, stamps, and points flows
Connect the fully-implemented Google Wallet service to the loyalty module: - Create wallet class/object on customer enrollment - Sync wallet passes on stamp and points operations - Expose wallet URLs in storefront API responses - Add conditional "Add to Google Wallet" buttons on dashboard and enroll-success pages - Use platform-wide env var config (not per-merchant DB column) - Add Google service account patterns to .gitignore - Add LOYALTY_GOOGLE_* fields to app Settings - Update deployment docs and add local testing guide Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -167,14 +167,19 @@ Maximum stamps per card per day (default: 5).
|
||||
|
||||
### Google Wallet
|
||||
|
||||
Architecture: **Server-side storage with API updates**
|
||||
Architecture: **Server-side storage with automatic API updates**
|
||||
|
||||
1. Program created → Create `LoyaltyClass` via Google API
|
||||
2. Customer enrolls → Create `LoyaltyObject` via Google API
|
||||
3. Stamp/points change → `PATCH` the object
|
||||
4. Generate JWT for "Add to Wallet" button
|
||||
All wallet operations are triggered automatically — no manual API calls needed:
|
||||
|
||||
No device registration needed - Google syncs automatically.
|
||||
| Event | Wallet Action | Trigger |
|
||||
|-------|---------------|---------|
|
||||
| Customer enrolls | Create `LoyaltyClass` (first time) + `LoyaltyObject` | `card_service.enroll_customer()` → `wallet_service.create_wallet_objects()` |
|
||||
| Stamp/points change | `PATCH` the object with new balance | `stamp_service`/`points_service` → `wallet_service.sync_card_to_wallets()` |
|
||||
| Customer views dashboard | Generate JWT "Add to Wallet" URL (1h expiry) | `GET /storefront/loyalty/card` → `wallet_service.get_add_to_wallet_urls()` |
|
||||
|
||||
**Setup:** Configure `LOYALTY_GOOGLE_ISSUER_ID` and `LOYALTY_GOOGLE_SERVICE_ACCOUNT_JSON` env vars. This is a platform-wide setting — all merchants automatically get Google Wallet support. See [Google Wallet Setup](../deployment/hetzner-server-setup.md#step-25-google-wallet-integration) for full instructions.
|
||||
|
||||
No device registration needed — Google syncs automatically.
|
||||
|
||||
### Apple Wallet
|
||||
|
||||
|
||||
Reference in New Issue
Block a user