feat(commercial) : 2e email de facturation optionnel sur l'adresse client (ERP-119)
Pendant du telephone secondaire (max 2). Bump @malio/layer-ui 1.7.8 (prop addable du MalioInputEmail). - back : colonne billing_email_secondary (migration + COMMENT + catalogue), propriete ClientAddress (Email + Length), Callback etendu (2e email interdit hors facturation, optionnel sinon), normalisation lowercase au Processor. - front : draft + flag UI hasSecondaryBillingEmail, mappers, payloads, champ MalioInputEmail :addable -> revele un 2e champ ; layout : 2e email qui coule dans la grille et Adresse complementaire sur une colonne. - tests back (2 emails / 2e email hors facturation) et front (payload).
This commit is contained in:
@@ -189,6 +189,65 @@ final class ClientAddressTest extends AbstractCommercialApiTestCase
|
||||
self::assertResponseStatusCodeSame(201);
|
||||
}
|
||||
|
||||
/**
|
||||
* ERP-119 : une adresse de facturation accepte un 2e email (optionnel, max 2).
|
||||
*/
|
||||
public function testBillingAddressAcceptsTwoEmails(): void
|
||||
{
|
||||
$this->skipIfSitesModuleDisabled();
|
||||
$client = $this->createAdminClient();
|
||||
$seed = $this->seedClient('Billing Two Emails');
|
||||
$category = $this->createCategory('SECTEUR');
|
||||
|
||||
$client->request('POST', '/api/clients/'.$seed->getId().'/addresses', [
|
||||
'headers' => ['Content-Type' => self::LD],
|
||||
'json' => [
|
||||
'isBilling' => true,
|
||||
'billingEmail' => 'facturation@test.fr',
|
||||
'billingEmailSecondary' => 'compta@test.fr',
|
||||
'postalCode' => '86100',
|
||||
'city' => 'Châtellerault',
|
||||
'street' => '1 rue du Test',
|
||||
'sites' => [$this->firstSiteIri()],
|
||||
'categories' => ['/api/categories/'.$category->getId()],
|
||||
],
|
||||
]);
|
||||
|
||||
self::assertResponseStatusCodeSame(201);
|
||||
}
|
||||
|
||||
/**
|
||||
* ERP-119 : le 2e email de facturation, comme le principal, n'est autorise que
|
||||
* sur une adresse de facturation -> 422 avec violation sur billingEmailSecondary.
|
||||
*/
|
||||
public function testSecondaryBillingEmailRejectedOnNonBillingAddress(): void
|
||||
{
|
||||
$this->skipIfSitesModuleDisabled();
|
||||
$client = $this->createAdminClient();
|
||||
$seed = $this->seedClient('Secondary Email Non Billing');
|
||||
$category = $this->createCategory('SECTEUR');
|
||||
|
||||
$body = $client->request('POST', '/api/clients/'.$seed->getId().'/addresses', [
|
||||
'headers' => ['Content-Type' => self::LD, 'Accept' => self::LD],
|
||||
'json' => [
|
||||
'isDelivery' => true,
|
||||
'billingEmailSecondary' => 'compta@test.fr',
|
||||
'postalCode' => '86100',
|
||||
'city' => 'Châtellerault',
|
||||
'street' => '1 rue du Test',
|
||||
'sites' => [$this->firstSiteIri()],
|
||||
'categories' => ['/api/categories/'.$category->getId()],
|
||||
],
|
||||
])->toArray(false);
|
||||
|
||||
self::assertResponseStatusCodeSame(422);
|
||||
$byPath = [];
|
||||
foreach ($body['violations'] ?? [] as $v) {
|
||||
$byPath[$v['propertyPath']] = $v['message'];
|
||||
}
|
||||
self::assertArrayHasKey('billingEmailSecondary', $byPath);
|
||||
}
|
||||
|
||||
/**
|
||||
* RG-1.29 : poster une categorie de type DISTRIBUTEUR sur une adresse -> 422
|
||||
* avec violation sur le champ `categories`.
|
||||
|
||||
Reference in New Issue
Block a user