File tree Expand file tree Collapse file tree 2 files changed +72
-1
lines changed Expand file tree Collapse file tree 2 files changed +72
-1
lines changed Original file line number Diff line number Diff line change 44
55class Region
66{
7+ /**
8+ * European Union region
9+ */
710 const EU = "eu " ;
11+
12+ /**
13+ * United States region
14+ */
815 const US = "us " ;
16+
17+ /**
18+ * Australia region
19+ */
920 const AU = "au " ;
21+
22+ /**
23+ * India region
24+ */
1025 const IN = "in " ;
1126
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+ */
1236 const VALID_REGIONS = [
1337 self ::EU ,
1438 self ::US ,
1539 self ::AU ,
16- self ::IN
40+ self ::IN ,
41+ self ::APSE
1742 ];
1843
44+ /**
45+ * Maps regions to their respective Terminal API endpoints.
46+ * @var array<string, string>
47+ */
1948 const TERMINAL_API_ENDPOINTS_MAPPING = [
2049 self ::EU => Client::ENDPOINT_TERMINAL_CLOUD_LIVE ,
2150 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