Skip to content

Commit 6e24eb7

Browse files
authored
Merge pull request #4 from SimPaypl/fix/urls-for-payment-api
Use correct api urls in payment api
2 parents 6e4ca1b + 4fa3519 commit 6e24eb7

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,6 @@ composer.phar
1616
# PHPUnit cache
1717
.phpunit.result.cache
1818
/.cache/
19+
20+
# Phpactor cache
21+
.phpactor.json

src/PaymentApi.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public function __construct(HttpClientFactoryInterface $factory)
3232
public function paymentGetServices(): PaymentServiceCollection
3333
{
3434
try {
35-
$response = $this->client->request('GET', 'payment/services',);
35+
$response = $this->client->request('GET', 'payment',);
3636
$data = \json_decode($response->getBody()->getContents(), true, 512, JSON_THROW_ON_ERROR,);
3737

3838
$services = [];
@@ -50,7 +50,7 @@ public function paymentGetServices(): PaymentServiceCollection
5050
public function paymentGetService(ServiceId $serviceId): PaymentService
5151
{
5252
try {
53-
$response = $this->client->request('GET', \sprintf('payment/services/%s', $serviceId),);
53+
$response = $this->client->request('GET', \sprintf('payment/%s', $serviceId),);
5454
$data = \json_decode($response->getBody()->getContents(), true, 512, JSON_THROW_ON_ERROR,);
5555

5656
return PaymentService::createFromResponse($data['data']);
@@ -62,7 +62,7 @@ public function paymentGetService(ServiceId $serviceId): PaymentService
6262
public function paymentGetTransactions(ServiceId $serviceId): PaymentServiceTransactionCollection
6363
{
6464
try {
65-
$response = $this->client->request('GET', \sprintf('payment/services/%s/transactions', $serviceId),);
65+
$response = $this->client->request('GET', \sprintf('payment/%s/transactions', $serviceId),);
6666
$data = \json_decode($response->getBody()->getContents(), true, 512, JSON_THROW_ON_ERROR,);
6767

6868
$transactions = [];
@@ -103,7 +103,7 @@ public function paymentTransactionCreate(ServiceId $serviceId, CreatePayment $re
103103
try {
104104
$response = $this->client->request(
105105
'POST',
106-
\sprintf('payment/%s/transaction', $serviceId),
106+
\sprintf('payment/%s/transactions', $serviceId),
107107
[
108108
RequestOptions::JSON => $request->toArray(),
109109
],
@@ -121,7 +121,7 @@ public function paymentGetTransaction(ServiceId $serviceId, PaymentTransactionId
121121
try {
122122
$response = $this->client->request(
123123
'GET',
124-
\sprintf('payment/%s/transaction/%s', $serviceId, $transactionId),
124+
\sprintf('payment/%s/transactions/%s', $serviceId, $transactionId),
125125
);
126126
$data = \json_decode($response->getBody()->getContents(), true, 512, JSON_THROW_ON_ERROR,);
127127

0 commit comments

Comments
 (0)