diff --git a/admin/src/pages/CardWizard.tsx b/admin/src/pages/CardWizard.tsx index d5c8269..a6e373d 100644 --- a/admin/src/pages/CardWizard.tsx +++ b/admin/src/pages/CardWizard.tsx @@ -257,7 +257,7 @@ export function CardWizard({ store, onSaved }: { store: StoreDetail; onSaved: () {store.status === 'DRAFT' && (
- Utilisez le bouton Activer en haut de la fiche pour ouvrir le programme (logo obligatoire). + Utilisez le bouton Activer en haut de la fiche pour ouvrir le programme.
)} > diff --git a/backend/public/logo-defaut.png b/backend/public/logo-defaut.png new file mode 100644 index 0000000..05f03fa Binary files /dev/null and b/backend/public/logo-defaut.png differ diff --git a/backend/src/main.ts b/backend/src/main.ts index d92d959..895fe31 100644 --- a/backend/src/main.ts +++ b/backend/src/main.ts @@ -5,6 +5,7 @@ import { RequestMethod, ValidationPipe } from '@nestjs/common'; import { ConfigService } from '@nestjs/config'; import { NestExpressApplication } from '@nestjs/platform-express'; import helmet from 'helmet'; +import { join } from 'path'; import { AppModule } from './app.module'; import { UPLOADS_DIR } from './card-design/card-design.service'; @@ -39,6 +40,8 @@ async function bootstrap() { app.enableCors({ origin: origins.length ? origins : false, credentials: true }); // Logos et bandeaux des cartes (aperçu admin, page d'inscription, génération des pass). app.useStaticAssets(UPLOADS_DIR, { prefix: '/uploads/' }); + // Fichiers fixes de la plateforme (logo par défaut des cartes Google Wallet). + app.useStaticAssets(join(process.cwd(), 'public'), { prefix: '/static/' }); // Les pages client gardent des URL courtes (imprimées sur les QR, envoyées par e-mail). app.setGlobalPrefix('api', { exclude: [ diff --git a/backend/src/stores/stores.service.ts b/backend/src/stores/stores.service.ts index 8849f62..846cd50 100644 --- a/backend/src/stores/stores.service.ts +++ b/backend/src/stores/stores.service.ts @@ -85,10 +85,6 @@ export class StoresService { if (status === 'ACTIVE' && !store.cardDesign) { throw new BadRequestException("La carte de fidélité doit être conçue avant l'activation"); } - if (status === 'ACTIVE' && !store.cardDesign?.logoPath) { - // Google Wallet refuse une carte sans logo ; Apple s'en sert comme icône. - throw new BadRequestException("Ajoutez le logo du magasin avant l'activation"); - } const updated = await this.prisma.store.update({ where: { id }, data: { status } }); return this.present(updated); } diff --git a/backend/src/wallet/google-wallet.service.ts b/backend/src/wallet/google-wallet.service.ts index af687c1..849fe12 100644 --- a/backend/src/wallet/google-wallet.service.ts +++ b/backend/src/wallet/google-wallet.service.ts @@ -36,19 +36,26 @@ export class GoogleWalletService { const account = this.loadAccount(); if (!account) throw new ServiceUnavailableException('Google Wallet n’est pas encore configuré'); const design = card.store.cardDesign; - if (!design?.logoPath) throw new ServiceUnavailableException('Logo du magasin manquant'); + if (!design) throw new ServiceUnavailableException('Carte non conçue'); const publicUrl: string = this.config.get('publicUrl')!; const image = (path: string, description: string) => ({ sourceUri: { uri: `${publicUrl}/uploads/${path}` }, contentDescription: { defaultValue: { language: 'fr-FR', value: description } }, }); + // Google exige un logo : sans logo du magasin, on met le symbole MonEspacePro. + const programLogo = design.logoPath + ? image(design.logoPath, `Logo ${card.store.name}`) + : { + sourceUri: { uri: `${publicUrl}/static/logo-defaut.png` }, + contentDescription: { defaultValue: { language: 'fr-FR', value: card.store.name } }, + }; const loyaltyClass = { id: this.classId(card.storeId), issuerName: card.store.name, programName: design.programName, - programLogo: image(design.logoPath, `Logo ${card.store.name}`), + programLogo, ...(design.stripPath && { heroImage: image(design.stripPath, card.store.name) }), hexBackgroundColor: design.backgroundColor, reviewStatus: 'UNDER_REVIEW',