From ff2101717cf022b6197d9acbb044601840f375d4 Mon Sep 17 00:00:00 2001 From: bernard-ng Date: Tue, 15 Oct 2024 14:13:34 +0200 Subject: [PATCH] fix: vpos to card rename --- CHANGELOG.md | 10 ++++------ src/Client.php | 2 +- src/Environment.php | 10 +--------- tests/EnvironmentTest.php | 4 ++-- 4 files changed, 8 insertions(+), 18 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 40c7d36..b6a1711 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,10 +2,10 @@ This changelog references the relevant changes (bug and security fixes) done -## 2.0.1 -- Fixed: vpos urls for production and test environments in `Environment` -### 2.0.0 +### 2.0.x +- Rename: vpos to card +- Fixed: vpos urls for production and test environments in `Environment` - Added: `isSuccessful` to `Transaction` class - Breaking Change: `pay` supports both `vpos` and `mobile` request - Added: `vpos` and `mobile` method to `Client` @@ -15,8 +15,6 @@ This changelog references the relevant changes (bug and security fixes) done - Added: Support for `check`, `vpos`, `mobile` urls in `Environment`, - Removed: `getPaymentBaseUrl` method in `Environment` -### 1.0.1 +### 1.0.x - Fixed: allow `$message` to be an empty string in `PaymentResponse` - -### 1.0.0 - Initial release diff --git a/src/Client.php b/src/Client.php index 77afe16..51651bb 100644 --- a/src/Client.php +++ b/src/Client.php @@ -97,7 +97,7 @@ public function card(CardRequest $request): CardResponse /** @var CardResponse $response */ $response = $this->getMappedData( type: CardResponse::class, - data: $this->http->request('POST', $this->environment->getVposAskUrl(), [ + data: $this->http->request('POST', $this->environment->getCardPaymentUrl(), [ 'json' => $request->getPayload(), ])->toArray() ); diff --git a/src/Environment.php b/src/Environment.php index 25834c2..e19f835 100644 --- a/src/Environment.php +++ b/src/Environment.php @@ -14,7 +14,7 @@ enum Environment: string case LIVE = 'prod'; case SANDBOX = 'dev'; - public function getVposAskUrl(): string + public function getCardPaymentUrl(): string { return match ($this) { self::LIVE => 'https://cardpayment.flexpay.cd/v1.1/pay', @@ -29,14 +29,6 @@ public function getMobilePaymentUrl(): string }; } - public function getVposPaymentUrl(string $orderNumber): string - { - return match ($this) { - self::LIVE => sprintf('https://cardpayment.flexpay.cd/vpos/pay/%s', $orderNumber), - self::SANDBOX => sprintf('https://beta-cardpayment.flexpay.cd/vpos/pay/%s', $orderNumber), - }; - } - public function getCheckStatusUrl(string $orderNumber): string { return match ($this) { diff --git a/tests/EnvironmentTest.php b/tests/EnvironmentTest.php index 9746bea..c399d35 100644 --- a/tests/EnvironmentTest.php +++ b/tests/EnvironmentTest.php @@ -35,11 +35,11 @@ public function testGetCardPaymentUrl(): void { $this->assertEquals( 'https://cardpayment.flexpay.cd/v1.1/pay', - $this->prod->getVposAskUrl() + $this->prod->getCardPaymentUrl() ); $this->assertEquals( 'https://beta-cardpayment.flexpay.cd/v1.1/pay', - $this->dev->getVposAskUrl() + $this->dev->getCardPaymentUrl() ); }