From 4c77b78c6cf3b4a5e3bb1484d6c9b861d46077f1 Mon Sep 17 00:00:00 2001 From: Jeppe B <2jepp9350@gmail.com> Date: Tue, 2 Jun 2026 02:15:27 +0200 Subject: [PATCH] Keep self-serve invoice billing customer authoritative --- .../app/modules/selfserve/traits/selfserve_lane_invoice_t.php | 2 +- services/nginx/app/tests/Api/SelfserveFixtureApiTest.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/services/nginx/app/modules/selfserve/traits/selfserve_lane_invoice_t.php b/services/nginx/app/modules/selfserve/traits/selfserve_lane_invoice_t.php index 9c7b571d..28f0b7b1 100644 --- a/services/nginx/app/modules/selfserve/traits/selfserve_lane_invoice_t.php +++ b/services/nginx/app/modules/selfserve/traits/selfserve_lane_invoice_t.php @@ -224,7 +224,7 @@ trait selfserve_lane_invoice_t $billing_customer_number = $this->getCustomerNumber(); $draft_customer_number = (new economic())->getTransactionDraftCustomerNumber(); $order = (new orders_o())->add( - $draft_customer_number ?? $billing_customer_number, + $billing_customer_number, self::INVOICE_SYSTEM_USER_ID, '', '', diff --git a/services/nginx/app/tests/Api/SelfserveFixtureApiTest.php b/services/nginx/app/tests/Api/SelfserveFixtureApiTest.php index 127d7f4e..8665c164 100644 --- a/services/nginx/app/tests/Api/SelfserveFixtureApiTest.php +++ b/services/nginx/app/tests/Api/SelfserveFixtureApiTest.php @@ -41,7 +41,7 @@ it('creates a comprehensive self-serve API scenario with demo relays', function ->and($session['reg'])->toBe($scenario['vehicle']['reg']); }); -it('creates self-serve invoice orders on the draft customer with original customer and driver metadata attached', function (): void { +it('creates self-serve invoice orders for the lane customer with draft customer and driver metadata attached', function (): void { selfserve_fixture_ensure_legacy_redis_constant(); $draftCustomer = api_fixtures()->createUser(['display_name' => 'Self-Serve Draft Customer']); @@ -82,7 +82,7 @@ it('creates self-serve invoice orders on the draft customer with original custom api_fixtures()->cleanupDeleteWhere('object_attachments', ['object_type' => $attachmentObjectType, 'object_id' => $orderId]); expect($order)->not->toBeNull() - ->and((int)$order['customer_id'])->toBe((int)$draftCustomer['customer_number']) + ->and((int)$order['customer_id'])->toBe((int)$scenario['customer']['customer_number']) ->and((int)$order['department_id'])->toBe((int)$scenario['department']['id']) ->and((string)$order['reg_1'])->toBe((string)$scenario['vehicle']['reg']) ->and((int)$order['lane'])->toBe((int)$scenario['lane']['id'])