diff --git a/backend/src/wallet/apple-pass.service.ts b/backend/src/wallet/apple-pass.service.ts index 8725cce..e641837 100644 --- a/backend/src/wallet/apple-pass.service.ts +++ b/backend/src/wallet/apple-pass.service.ts @@ -56,6 +56,8 @@ export class ApplePassService { const unit = unitLabel(card); const nextReward = nextRewardText(card); + // Seul champ à message de la face avant : il annonce aussi la récompense devenue disponible. + const balanceMessage = `Nouveau solde : %@ ${unit.toLowerCase()}${nextReward?.endsWith('disponible !') ? ` · ${nextReward}` : ''}`; const publicUrl: string = this.config.get('publicUrl')!; const webServiceURL = publicUrl.startsWith('https://') ? `${publicUrl}/api/wallet/apple` : null; const passJson = { @@ -75,14 +77,15 @@ export class ApplePassService { barcodes: [{ format: 'PKBarcodeFormatQR', message: card.serial, messageEncoding: 'iso-8859-1' }], storeCard: { headerFields: [{ key: 'balance-header', label: unit.toUpperCase(), value: card.balance }], - primaryFields: [{ key: 'balance', label: 'SOLDE', value: card.balance, changeMessage: `Nouveau solde : %@ ${unit.toLowerCase()}` }], + primaryFields: [{ key: 'balance', label: 'SOLDE', value: card.balance, changeMessage: balanceMessage }], secondaryFields: [ { key: 'program', label: 'PROGRAMME', value: design.programName }, { key: 'member', label: 'MEMBRE', value: card.customer.firstName, textAlignment: 'PKTextAlignmentRight' }, ], - // Face avant : la prochaine récompense ; la notification s'affiche quand elle devient disponible. + // Face avant : la prochaine récompense. Pas de message de notification ici : quand deux champs + // à message changent ensemble (solde + récompense), l'iPhone affiche « Carte de fidélité modifiée ». ...(nextReward && { - auxiliaryFields: [{ key: 'next-reward', label: 'PROCHAINE RÉCOMPENSE', value: nextReward, changeMessage: '%@' }], + auxiliaryFields: [{ key: 'next-reward', label: 'PROCHAINE RÉCOMPENSE', value: nextReward }], }), backFields: [ // Toujours présent : quand sa valeur change (nouvelle campagne), l'iPhone affiche le message sur l'écran verrouillé.