Skip to content

Commit

Permalink
fix dependecies
Browse files Browse the repository at this point in the history
  • Loading branch information
zjbarg committed Aug 8, 2024
1 parent d057691 commit 41542e3
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 16 deletions.
9 changes: 5 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
},
Expand Down
8 changes: 4 additions & 4 deletions src/LaravelAmznSPA.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
24 changes: 16 additions & 8 deletions tests/Unit/SetupTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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',
);
Expand All @@ -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');
Expand All @@ -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(),
),
);

Expand Down

0 comments on commit 41542e3

Please sign in to comment.