fix(wallet): offer Google Wallet only where it works, and never post it to the Apple route

- GET /api/trips/:tripId/reservations/google-wallet answers whether this
  server can make Google Wallet passes: passes on, and the TREK services'
  signer with its Google route mounted (it is once liketrek has a Wallet
  issuer). The probe is kept for ten minutes.
- The Google route is derived from TREK_WALLET_SIGNER_URL by its path, the
  query kept; a signer URL that does not end in /pass has none, and the
  booking is refused with a 404 instead of going to the Apple signer.
- End-to-end tests for the save link: owner, stranger, another trip, no
  issuer yet, a link that is not Google Wallet, and the availability.
- Italian and Hungarian wording of the button.
This commit is contained in:
Maurice
2026-11-07 14:50:17 +01:00
parent 924836be31
commit 99a8701bd4
8 changed files with 185 additions and 9 deletions
+1 -1
View File
@@ -278,7 +278,7 @@ const reservations: TranslationStrings = {
'reservations.needsConnection': 'Ehhez kapcsolat kell. Próbáld újra, amint a TREK újra online lesz.',
'reservations.exportCsvFiltered': 'A megjelenített {shown} sor exportálása a(z) {total} közül (CSV)',
'reservations.wallet.add': 'Hozzáadás az Apple Wallethez',
'reservations.wallet.addGoogle': 'Hozzáadás az Google Wallethez',
'reservations.wallet.addGoogle': 'Hozzáadás a Google Wallethez',
'reservations.wallet.failed': 'Nem sikerült létrehozni a Wallet-kártyát. Próbáld újra.',
'reservations.wallet.undated': 'Előbb adj dátumot a foglalásnak: a Wallet az időpont körül jeleníti meg a kártyát.',
};
+1 -1
View File
@@ -275,7 +275,7 @@ const reservations: TranslationStrings = {
'reservations.needsConnection': 'Serve una connessione. Riprova quando TREK tornerà online.',
'reservations.exportCsvFiltered': 'Esporta le {shown} righe mostrate su {total} (CSV)',
'reservations.wallet.add': 'Aggiungi ad Apple Wallet',
'reservations.wallet.addGoogle': 'Aggiungi ad Google Wallet',
'reservations.wallet.addGoogle': 'Aggiungi a Google Wallet',
'reservations.wallet.failed': 'Impossibile creare il pass di Wallet. Riprova.',
'reservations.wallet.undated': 'Prima dai una data alla prenotazione: Wallet mostra il pass intorno a quel momento.',
};
@@ -412,3 +412,10 @@ export const googleWalletSaveResponseSchema = z.object({
saveUrl: z.string().url().startsWith('https://pay.google.com/gp/v/save/'),
});
export type GoogleWalletSaveResponse = z.infer<typeof googleWalletSaveResponseSchema>;
/**
* GET /api/trips/:tripId/reservations/google-wallet: whether this server can make
* Google Wallet passes right now (passes on, and liketrek's Wallet issuer live).
*/
export const googleWalletAvailabilityResponseSchema = z.object({ available: z.boolean() });
export type GoogleWalletAvailabilityResponse = z.infer<typeof googleWalletAvailabilityResponseSchema>;