Read Parcel2Go label hash from order links when Hash is empty
Deploy HickLab3D Dashboard / Deploy to production (push) Successful in 26s

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
Hickmeister
2026-10-11 20:36:04 +01:00
co-authored by Claude Sonnet 5.5
parent 504a867351
commit 51c6748894
4 changed files with 42 additions and 3 deletions
+19
View File
@@ -191,6 +191,25 @@ class IntegrationsTest extends TestCase
Http::assertSent(fn ($request) => str_contains($request->url(), '/labels/123') && str_contains($request->url(), 'hash=order-hash'));
}
public function test_shipping_label_uses_the_hash_from_order_links_when_hash_field_is_empty(): void
{
Http::preventStrayRequests();
Http::fake([
'https://auth.example.test/token' => Http::response(['access_token' => 'test-token']),
'https://shipping.example.test/api/me/orders/detail' => Http::response(['Orders' => [[
'OrderLineId' => 123, 'Hash' => null,
'Links' => [['Name' => 'labels-a4', 'Link' => 'https://www.parcel2go.com/label/orderline?media=0&orderlineid=123&hash=link%2Bhash%3D']],
]]]),
'https://shipping.example.test/api/labels/123*' => Http::response(['Base64EncodedLabels' => [base64_encode('%PDF-1.4 test label')]]),
]);
config()->set('services.parcel2go', ['client_id' => 'id', 'client_secret' => 'secret', 'auth_url' => 'https://auth.example.test/token', 'base_url' => 'https://shipping.example.test/api']);
$admin = User::factory()->create(['role' => 'admin']);
$this->actingAs($admin)->get(route('shipping'))->assertSee(route('shipping.label', 123), false);
$this->actingAs($admin)->get(route('shipping.label', 123))->assertOk()->assertSee('%PDF-1.4 test label');
Http::assertSent(fn ($request) => str_contains($request->url(), '/labels/123') && str_contains($request->url(), 'hash=link%2Bhash%3D'));
}
public function test_collection_booking_uses_quoted_service_and_available_date(): void
{
$this->pendingEtsyOrder();