Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added APSE to VALID_REGIONS #717

Merged
merged 4 commits into from
Dec 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 30 additions & 1 deletion src/Adyen/Region.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,47 @@

class Region
{
/**
* European Union region
*/
const EU = "eu";

/**
* United States region
*/
const US = "us";

/**
* Australia region
*/
const AU = "au";

/**
* India region
*/
const IN = "in";

/**
* Asia-Pacific, South East region
*/
const APSE = "apse";

/**
* List of all valid regions
* @var array<int,string>
*/
const VALID_REGIONS = [
self::EU,
self::US,
self::AU,
self::IN
self::IN,
self::APSE
];

/**
* Maps regions to their respective Terminal API endpoints.
* @var array<string, string>
*/
const TERMINAL_API_ENDPOINTS_MAPPING = [
self::EU => Client::ENDPOINT_TERMINAL_CLOUD_LIVE,
self::US => Client::ENDPOINT_TERMINAL_CLOUD_US_LIVE,
Expand Down
42 changes: 42 additions & 0 deletions tests/Unit/RegionTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<?php

namespace Adyen\Tests\Unit;

use PHPUnit\Framework\TestCase;
use Adyen\Region;

class RegionTest extends TestCase
{
public function testValidRegions()
{
$expected = [
"eu",
"us",
"au",
"in",
"apse",
];

$this->assertEquals(
$expected,
Region::VALID_REGIONS,
"VALID_REGIONS should match the expected regions."
);
}

public function testTerminalApiEndpointsMapping()
{
$expected = [
"eu" => "https://terminal-api-live.adyen.com",
"us" => "https://terminal-api-live-us.adyen.com",
"au" => "https://terminal-api-live-au.adyen.com",
"apse" => "https://terminal-api-live-apse.adyen.com",
];

$this->assertEquals(
$expected,
Region::TERMINAL_API_ENDPOINTS_MAPPING,
"TERMINAL_API_ENDPOINTS_MAPPING should match the expected mappings."
);
}
}
Loading