Activation d'un magasin possible sans logo

Google Wallet exige un logo : à défaut de celui du magasin, la carte
utilise le symbole MonEspacePro (backend/public/logo-defaut.png, servi
sur /static/). Côté Apple, l'icône unie existait déjà.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Tony AVERTY 2026-10-06 14:29:25 +02:00
parent f844048777
commit fcf1b95795
5 changed files with 13 additions and 7 deletions

View file

@ -257,7 +257,7 @@ export function CardWizard({ store, onSaved }: { store: StoreDetail; onSaved: ()
</div> </div>
{store.status === 'DRAFT' && ( {store.status === 'DRAFT' && (
<p style={{ margin: 0 }}> <p style={{ margin: 0 }}>
Utilisez le bouton <strong>Activer</strong> en haut de la fiche pour ouvrir le programme (logo obligatoire). Utilisez le bouton <strong>Activer</strong> en haut de la fiche pour ouvrir le programme.
</p> </p>
)} )}
</> </>

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.6 KiB

View file

@ -5,6 +5,7 @@ import { RequestMethod, ValidationPipe } from '@nestjs/common';
import { ConfigService } from '@nestjs/config'; import { ConfigService } from '@nestjs/config';
import { NestExpressApplication } from '@nestjs/platform-express'; import { NestExpressApplication } from '@nestjs/platform-express';
import helmet from 'helmet'; import helmet from 'helmet';
import { join } from 'path';
import { AppModule } from './app.module'; import { AppModule } from './app.module';
import { UPLOADS_DIR } from './card-design/card-design.service'; 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 }); 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). // Logos et bandeaux des cartes (aperçu admin, page d'inscription, génération des pass).
app.useStaticAssets(UPLOADS_DIR, { prefix: '/uploads/' }); 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). // Les pages client gardent des URL courtes (imprimées sur les QR, envoyées par e-mail).
app.setGlobalPrefix('api', { app.setGlobalPrefix('api', {
exclude: [ exclude: [

View file

@ -85,10 +85,6 @@ export class StoresService {
if (status === 'ACTIVE' && !store.cardDesign) { if (status === 'ACTIVE' && !store.cardDesign) {
throw new BadRequestException("La carte de fidélité doit être conçue avant l'activation"); 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 } }); const updated = await this.prisma.store.update({ where: { id }, data: { status } });
return this.present(updated); return this.present(updated);
} }

View file

@ -36,19 +36,26 @@ export class GoogleWalletService {
const account = this.loadAccount(); const account = this.loadAccount();
if (!account) throw new ServiceUnavailableException('Google Wallet n’est pas encore configuré'); if (!account) throw new ServiceUnavailableException('Google Wallet n’est pas encore configuré');
const design = card.store.cardDesign; 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 publicUrl: string = this.config.get('publicUrl')!;
const image = (path: string, description: string) => ({ const image = (path: string, description: string) => ({
sourceUri: { uri: `${publicUrl}/uploads/${path}` }, sourceUri: { uri: `${publicUrl}/uploads/${path}` },
contentDescription: { defaultValue: { language: 'fr-FR', value: description } }, 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 = { const loyaltyClass = {
id: this.classId(card.storeId), id: this.classId(card.storeId),
issuerName: card.store.name, issuerName: card.store.name,
programName: design.programName, programName: design.programName,
programLogo: image(design.logoPath, `Logo ${card.store.name}`), programLogo,
...(design.stripPath && { heroImage: image(design.stripPath, card.store.name) }), ...(design.stripPath && { heroImage: image(design.stripPath, card.store.name) }),
hexBackgroundColor: design.backgroundColor, hexBackgroundColor: design.backgroundColor,
reviewStatus: 'UNDER_REVIEW', reviewStatus: 'UNDER_REVIEW',