From 41542e3320c439e6e3ed3bcec4682771ea458744 Mon Sep 17 00:00:00 2001 From: "Zaid J. Barghouthi" Date: Thu, 8 Aug 2024 11:45:58 +0300 Subject: [PATCH] fix dependecies --- composer.json | 9 +++++---- src/LaravelAmznSPA.php | 8 ++++---- tests/Unit/SetupTest.php | 24 ++++++++++++++++-------- 3 files changed, 25 insertions(+), 16 deletions(-) diff --git a/composer.json b/composer.json index 77c2c33..06a48b6 100644 --- a/composer.json +++ b/composer.json @@ -16,13 +16,14 @@ } ], "require": { - "php": "^8.0", - "illuminate/contracts": "^10.0", - "jasara/php-amzn-selling-partner-api": "0.*", + "php": "^8.1", + "illuminate/http": "^10.0|^11.0", + "illuminate/support": "^10.0|^11.0", + "jasara/php-amzn-selling-partner-api": "^0.5.3", "spatie/laravel-package-tools": "^1.11.0" }, "require-dev": { - "orchestra/testbench": "7.x-dev", + "orchestra/testbench": "^8.0", "phpunit/phpunit": "^9", "spatie/laravel-ray": "^1.23" }, diff --git a/src/LaravelAmznSPA.php b/src/LaravelAmznSPA.php index 20c07d0..bc21854 100755 --- a/src/LaravelAmznSPA.php +++ b/src/LaravelAmznSPA.php @@ -6,15 +6,15 @@ use Illuminate\Support\Facades\Http; use Jasara\AmznSPA\AmznSPA; use Jasara\AmznSPA\AmznSPAConfig; -use Jasara\AmznSPA\DataTransferObjects\AuthTokensDTO; -use Jasara\AmznSPA\DataTransferObjects\GrantlessTokenDTO; +use Jasara\AmznSPA\Data\AuthTokens; +use Jasara\AmznSPA\Data\GrantlessToken; class LaravelAmznSPA extends AmznSPA { public function __construct( - ?AuthTokensDTO $tokens = null, + ?AuthTokens $tokens = null, ?Factory $http = null, - ?GrantlessTokenDTO $grantless_token = null, + ?GrantlessToken $grantless_token = null, ?string $marketplace_id = null, ) { $marketplace_id = $marketplace_id ?: config('selling-partner-api.marketplace_id'); diff --git a/tests/Unit/SetupTest.php b/tests/Unit/SetupTest.php index bd41f23..091d621 100644 --- a/tests/Unit/SetupTest.php +++ b/tests/Unit/SetupTest.php @@ -2,13 +2,14 @@ namespace Jasara\LaravelAmznSPA\Tests\Unit; +use Carbon\CarbonImmutable; use Illuminate\Http\Client\Factory; use Illuminate\Support\Facades\Http; use Illuminate\Support\Str; use Jasara\AmznSPA\AmznSPA; -use Jasara\AmznSPA\DataTransferObjects\AuthTokensDTO; -use Jasara\AmznSPA\DataTransferObjects\GrantlessTokenDTO; -use Jasara\AmznSPA\DataTransferObjects\Responses\Notifications\GetSubscriptionResponse; +use Jasara\AmznSPA\Data\AuthTokens; +use Jasara\AmznSPA\Data\GrantlessToken; +use Jasara\AmznSPA\Data\Responses\Notifications\GetSubscriptionResponse; use Jasara\AmznSPA\Exceptions\AuthenticationException; use Jasara\LaravelAmznSPA\LaravelAmznSPA; use Jasara\LaravelAmznSPA\Tests\TestCase; @@ -29,12 +30,15 @@ public function testConfigParameters() $this->setupConfigKeys(); $amzn = new LaravelAmznSPA( - new AuthTokensDTO( + new AuthTokens( access_token: Str::random(), + refresh_token: null, + expires_at: null, ), new Factory(), - new GrantlessTokenDTO( + new GrantlessToken( access_token: Str::random(), + expires_at: null, ), marketplace_id: 'ATVPDKIKX0DER', ); @@ -51,14 +55,16 @@ public function testFakeHttpCall() 'payload' => [ 'subscriptionId' => '7fcacc7e-727b-11e9-8848-1681be663d3e', 'payloadVersion' => '1.0', - 'destinationId'=> '3acafc7e-121b-1329-8ae8-1571be663aa2', + 'destinationId' => '3acafc7e-121b-1329-8ae8-1571be663aa2', ], ], 200), ]); $amzn = new LaravelAmznSPA( - new AuthTokensDTO( + new AuthTokens( access_token: Str::random(), + refresh_token: Str::random(), + expires_at: CarbonImmutable::now(), ), ); $response = $amzn->notifications->getSubscription('ANY_OFFER_CHANGED'); @@ -83,8 +89,10 @@ public function testHandle401() ]); $amzn = new LaravelAmznSPA( - new AuthTokensDTO( + new AuthTokens( access_token: Str::random(), + refresh_token: Str::random(), + expires_at: CarbonImmutable::now(), ), );