Use Parcel2Go public API scope by default
Deploy HickLab3D Dashboard / Deploy to production (push) Successful in 1m1s

This commit is contained in:
Hickmeister
2026-10-11 16:50:13 +01:00
parent 75d8df532b
commit 61dd05384f
13 changed files with 102 additions and 9 deletions
+21
View File
@@ -82,6 +82,27 @@ class IntegrationsTest extends TestCase
Http::assertSent(fn ($request) => $request->url() === 'https://shipping.example.test/api/quotes' && $request['Parcels'][0]['Weight'] === 2);
}
public function test_shipping_page_works_with_public_api_scope_without_profile_access(): void
{
Http::preventStrayRequests();
Http::fake(['https://auth.example.test/token' => function ($request) {
return $request['scope'] === 'public-api'
? Http::response(['access_token' => 'test-token'])
: Http::response(['error' => 'invalid_scope'], 400);
}]);
config()->set('services.parcel2go', [
'client_id' => 'id', 'client_secret' => 'secret',
'auth_url' => 'https://auth.example.test/token',
'base_url' => 'https://shipping.example.test/api',
'scope' => 'public-api',
]);
$this->actingAs(User::factory()->create(['role' => 'admin']))->get(route('shipping'))
->assertOk()->assertSee('Parcel2Go connected for quotes and collections')
->assertDontSee('Parcel2Go is unavailable');
Http::assertSentCount(1);
}
public function test_shipping_label_is_downloaded_for_an_order_in_account_history(): void
{
Http::preventStrayRequests();