File tree 2 files changed +72
-1
lines changed
2 files changed +72
-1
lines changed Original file line number Diff line number Diff line change 4
4
5
5
class Region
6
6
{
7
+ /**
8
+ * European Union region
9
+ */
7
10
const EU = "eu " ;
11
+
12
+ /**
13
+ * United States region
14
+ */
8
15
const US = "us " ;
16
+
17
+ /**
18
+ * Australia region
19
+ */
9
20
const AU = "au " ;
21
+
22
+ /**
23
+ * India region
24
+ */
10
25
const IN = "in " ;
11
26
27
+ /**
28
+ * Asia-Pacific, South East region
29
+ */
30
+ const APSE = "apse " ;
31
+
32
+ /**
33
+ * List of all valid regions
34
+ * @var array<int,string>
35
+ */
12
36
const VALID_REGIONS = [
13
37
self ::EU ,
14
38
self ::US ,
15
39
self ::AU ,
16
- self ::IN
40
+ self ::IN ,
41
+ self ::APSE
17
42
];
18
43
44
+ /**
45
+ * Maps regions to their respective Terminal API endpoints.
46
+ * @var array<string, string>
47
+ */
19
48
const TERMINAL_API_ENDPOINTS_MAPPING = [
20
49
self ::EU => Client::ENDPOINT_TERMINAL_CLOUD_LIVE ,
21
50
self ::US => Client::ENDPOINT_TERMINAL_CLOUD_US_LIVE ,
Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ namespace Adyen \Tests \Unit ;
4
+
5
+ use PHPUnit \Framework \TestCase ;
6
+ use Adyen \Region ;
7
+
8
+ class RegionTest extends TestCase
9
+ {
10
+ public function testValidRegions ()
11
+ {
12
+ $ expected = [
13
+ "eu " ,
14
+ "us " ,
15
+ "au " ,
16
+ "in " ,
17
+ "apse " ,
18
+ ];
19
+
20
+ $ this ->assertEquals (
21
+ $ expected ,
22
+ Region::VALID_REGIONS ,
23
+ "VALID_REGIONS should match the expected regions. "
24
+ );
25
+ }
26
+
27
+ public function testTerminalApiEndpointsMapping ()
28
+ {
29
+ $ expected = [
30
+ "eu " => "https://terminal-api-live.adyen.com " ,
31
+ "us " => "https://terminal-api-live-us.adyen.com " ,
32
+ "au " => "https://terminal-api-live-au.adyen.com " ,
33
+ "apse " => "https://terminal-api-live-apse.adyen.com " ,
34
+ ];
35
+
36
+ $ this ->assertEquals (
37
+ $ expected ,
38
+ Region::TERMINAL_API_ENDPOINTS_MAPPING ,
39
+ "TERMINAL_API_ENDPOINTS_MAPPING should match the expected mappings. "
40
+ );
41
+ }
42
+ }
You can’t perform that action at this time.
0 commit comments