Skip to content

Commit e31687c

Browse files
committed
Add constants for the supported regions
1 parent 9eac366 commit e31687c

File tree

3 files changed

+19
-4
lines changed

3 files changed

+19
-4
lines changed

src/Region.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?php
2+
3+
namespace Incenteev\AsyncAmazonIncentives;
4+
5+
final class Region
6+
{
7+
public const EUROPE_AND_ASIA = 'eu';
8+
public const EUROPE_AND_ASIA_SANDBOX = 'eu-sandbox';
9+
public const FAR_EAST = 'fr';
10+
public const FAR_EAST_SANDBOX = 'fe-sandbox';
11+
public const NORTH_AMERICA = 'na';
12+
public const NORTH_AMERICA_SANDBOX = 'na-sandbox';
13+
}

tests/Integration/AmazonIncentivesClientTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
use Incenteev\AsyncAmazonIncentives\Input\CancelGiftCardRequest;
1111
use Incenteev\AsyncAmazonIncentives\Input\CreateGiftCardRequest;
1212
use Incenteev\AsyncAmazonIncentives\Input\GetAvailableFundsRequest;
13+
use Incenteev\AsyncAmazonIncentives\Region;
1314
use Incenteev\AsyncAmazonIncentives\ValueObject\MoneyAmount;
1415

1516
class AmazonIncentivesClientTest extends TestCase
@@ -74,7 +75,7 @@ private function getClient(): AmazonIncentivesClient
7475

7576
// @phpstan-ignore-next-line
7677
return new AmazonIncentivesClient([
77-
'endpoint' => 'http://localhost',
78+
'region' => Region::EUROPE_AND_ASIA_SANDBOX,
7879
], new NullProvider());
7980
}
8081
}

tests/Unit/AmazonIncentivesClientTest.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
use Incenteev\AsyncAmazonIncentives\Input\CancelGiftCardRequest;
1010
use Incenteev\AsyncAmazonIncentives\Input\CreateGiftCardRequest;
1111
use Incenteev\AsyncAmazonIncentives\Input\GetAvailableFundsRequest;
12+
use Incenteev\AsyncAmazonIncentives\Region;
1213
use Incenteev\AsyncAmazonIncentives\Result\CancelGiftCardResponse;
1314
use Incenteev\AsyncAmazonIncentives\Result\CreateGiftCardResponse;
1415
use Incenteev\AsyncAmazonIncentives\Result\GetAvailableFundsResponse;
@@ -19,7 +20,7 @@ class AmazonIncentivesClientTest extends TestCase
1920
{
2021
public function testCancelGiftCard(): void
2122
{
22-
$client = new AmazonIncentivesClient(['region' => 'eu'], new NullProvider(), new MockHttpClient());
23+
$client = new AmazonIncentivesClient(['region' => Region::EUROPE_AND_ASIA_SANDBOX], new NullProvider(), new MockHttpClient());
2324

2425
$input = new CancelGiftCardRequest([
2526
'creationRequestId' => 'change me',
@@ -34,7 +35,7 @@ public function testCancelGiftCard(): void
3435

3536
public function testCreateGiftCard(): void
3637
{
37-
$client = new AmazonIncentivesClient(['region' => 'eu'], new NullProvider(), new MockHttpClient());
38+
$client = new AmazonIncentivesClient(['region' => Region::EUROPE_AND_ASIA_SANDBOX], new NullProvider(), new MockHttpClient());
3839

3940
$input = new CreateGiftCardRequest([
4041
'creationRequestId' => 'change me',
@@ -52,7 +53,7 @@ public function testCreateGiftCard(): void
5253

5354
public function testGetAvailableFunds(): void
5455
{
55-
$client = new AmazonIncentivesClient(['region' => 'eu'], new NullProvider(), new MockHttpClient());
56+
$client = new AmazonIncentivesClient(['region' => Region::EUROPE_AND_ASIA_SANDBOX], new NullProvider(), new MockHttpClient());
5657

5758
$input = new GetAvailableFundsRequest([
5859
'partnerId' => 'change me',

0 commit comments

Comments
 (0)