## What changed - enforce EAN draft delivery wiring by setting `recipient.nemHandelType=ean` when customer EAN is present - copy existing e-conomic customer metadata into draft payload: `recipient.attention`, `references.customerContact`, `references.salesPerson`, and `deliveryLocation` - keep `references.other` external-id mapping intact - remove legacy explicit `Rabat:` text-line injection and use line-level `discountPercentage` instead - add/update unit tests for helper extraction and discount/EAN wiring ## Tests - `vendor/bin/pest tests/Unit/Invoicing/EconomicCustomerEanHelperTest.php tests/Unit/Invoicing/EconomicInvoiceDraftRecipientEanWiringTest.php tests/Unit/Invoicing/EconomicLegacyDraftDiscountWiringTest.php tests/Unit/Invoicing/EconomicInvoiceDraftDiscountLineModeWiringTest.php tests/Unit/Invoicing/CollectedInvoiceEconomicBatchTransferWiringTest.php tests/Unit/Invoicing/EconomicInvoiceDraftItemizedDiscountTest.php --colors=never` ## Notes - full unit suite in this environment still has an unrelated pre-existing failure in `Tests\\Unit\\Bird\\BirdControlPlaneActivationTest` requiring `PLENO_REPO_ROOT_FOR_TESTS`. - live manual verification against customer `12345679` remains environment-blocked due missing e-conomic credentials. --------- Co-authored-by: Jeppe Bundgaard <jb@truckwash.dk> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
20 lines
766 B
PHP
20 lines
766 B
PHP
<?php
|
|
|
|
it('uses line discount percentages instead of explicit Rabat text lines in legacy draft transfer flows', function (): void {
|
|
$transfer_executor = file_get_contents(app_path('classes/economic_transfer_executor.php'));
|
|
$route = file_get_contents(app_path('routes/economicInvoiceRoute.php'));
|
|
|
|
expect($transfer_executor)->not->toBeFalse();
|
|
expect($route)->not->toBeFalse();
|
|
|
|
expect((string)$transfer_executor)
|
|
->toContain('$economic_invoice_draft->addLine(')
|
|
->toContain('$discount_percentage')
|
|
->not->toContain("addLineTEXT('Rabat:");
|
|
|
|
expect((string)$route)
|
|
->toContain('$economic_invoice_draft->addLine(')
|
|
->toContain('$discount_percentage')
|
|
->not->toContain("addLineTEXT('Rabat:");
|
|
});
|