Skip to content

Commit

Permalink
Merge pull request #4 from SimPaypl/fix/urls-for-payment-api
Browse files Browse the repository at this point in the history
Use correct api urls in payment api
  • Loading branch information
wgorczyca authored Mar 13, 2024
2 parents 6e4ca1b + 4fa3519 commit 6e24eb7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,6 @@ composer.phar
# PHPUnit cache
.phpunit.result.cache
/.cache/

# Phpactor cache
.phpactor.json
10 changes: 5 additions & 5 deletions src/PaymentApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public function __construct(HttpClientFactoryInterface $factory)
public function paymentGetServices(): PaymentServiceCollection
{
try {
$response = $this->client->request('GET', 'payment/services',);
$response = $this->client->request('GET', 'payment',);
$data = \json_decode($response->getBody()->getContents(), true, 512, JSON_THROW_ON_ERROR,);

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

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

$transactions = [];
Expand Down Expand Up @@ -103,7 +103,7 @@ public function paymentTransactionCreate(ServiceId $serviceId, CreatePayment $re
try {
$response = $this->client->request(
'POST',
\sprintf('payment/%s/transaction', $serviceId),
\sprintf('payment/%s/transactions', $serviceId),
[
RequestOptions::JSON => $request->toArray(),
],
Expand All @@ -121,7 +121,7 @@ public function paymentGetTransaction(ServiceId $serviceId, PaymentTransactionId
try {
$response = $this->client->request(
'GET',
\sprintf('payment/%s/transaction/%s', $serviceId, $transactionId),
\sprintf('payment/%s/transactions/%s', $serviceId, $transactionId),
);
$data = \json_decode($response->getBody()->getContents(), true, 512, JSON_THROW_ON_ERROR,);

Expand Down

0 comments on commit 6e24eb7

Please sign in to comment.