feat(commercial) : controle croise pays BIC/IBAN sur les RIB
Pull Request — Quality gate / Backend (PHP CS + PHPUnit) (pull_request) Successful in 2m3s
Pull Request — Quality gate / Frontend (lint + Vitest + build) (pull_request) Successful in 1m9s

Assert\Bic avec ibanPropertyPath sur ClientRib et SupplierRib : le pays du BIC
(positions 5-6) doit correspondre au pays de l'IBAN (positions 1-2). Un BIC et un
IBAN valides isolement mais de pays differents -> 422, violation portee par le
champ bic avec message FR (ibanMessage), mappee inline cote front.

Tests fonctionnels du mismatch (BIC DE + IBAN FR -> 422 sur propertyPath=bic)
cote client et fournisseur.
This commit is contained in:
2026-06-09 10:29:37 +02:00
parent c73111121f
commit 36b5e84053
5 changed files with 94 additions and 25 deletions
@@ -294,6 +294,27 @@ final class SupplierSubResourceApiTest extends AbstractSupplierApiTestCase
self::assertResponseStatusCodeSame(422);
}
/**
* Controle croise pays BIC/IBAN (Assert\Bic ibanPropertyPath) : un BIC (DE) et
* un IBAN (FR) valides isolement mais de pays differents -> 422. La violation
* porte propertyPath=bic et le message FR `ibanMessage` (mapping inline front).
*/
public function testPostRibWithBicIbanCountryMismatchReturns422WithFrenchMessageOnBic(): void
{
$client = $this->createAdminClient();
$seed = $this->seedSupplier('Rib Pays Mismatch');
$response = $client->request('POST', '/api/suppliers/'.$seed->getId().'/ribs', [
'headers' => ['Content-Type' => self::LD, 'Accept' => self::LD],
'json' => ['label' => 'Compte incoherent', 'bic' => self::FOREIGN_BIC, 'iban' => self::VALID_IBAN],
]);
self::assertResponseStatusCodeSame(422);
$byPath = $this->violationsByPath($response->toArray(false));
self::assertArrayHasKey('bic', $byPath, 'Le mismatch pays BIC/IBAN doit porter propertyPath=bic (mapping front).');
self::assertSame('Le BIC ne correspond pas au pays de l\'IBAN.', $byPath['bic']);
}
public function testDeleteRibNonLcrReturns204(): void
{
$client = $this->createAdminClient();