Skip to content

Commit

Permalink
cardInfo-fix
Browse files Browse the repository at this point in the history
  • Loading branch information
mysiar authored May 19, 2022
1 parent 5a4e945 commit f5831d7
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/Message/AbstractRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ protected function sendRequest(string $method, string $endpoint, $data): Respons
$this->getEndpoint() . $endpoint,
[
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'Authorization' => sprintf(
'Basic %s',
base64_encode(sprintf('%s:%s', $this->getMerchantId(), $this->getReportKey()))
Expand Down
2 changes: 1 addition & 1 deletion src/Message/CardInfoRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public function getData()

public function sendData($data): CardInfoResponse
{
$httpResponse = $this->sendRequest('GET', sprintf('/api/v1/card/info/%s', $data['transactionId']), []);
$httpResponse = $this->sendRequest('GET', sprintf('card/info/%s', $data['transactionId']), []);

$responseData = json_decode($httpResponse->getBody()->getContents(), true);

Expand Down
11 changes: 10 additions & 1 deletion tests-api/GatewayTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ public function testPurchaseCard(): void
'returnUrl' => 'https://omnipay-przelewy24v1.requestcatcher.com/return',
'notifyUrl' => 'https://omnipay-przelewy24v1.requestcatcher.com/notify',
'cardNotifyUrl' => 'https://omnipay-przelewy24v1.requestcatcher.com/notifyCard',
'channel' => 218,
'channel' => 1,
]);

$response = $request->send();
Expand All @@ -151,6 +151,15 @@ public function testPurchaseCard(): void
$this->assertSame(35, strlen($response->getToken()));
}

public function testCardInfo(): void
{
$transactionId = '317229535';
$this->markTestSkipped('Comment this out if you have payment with credit card');
$response = $this->gateway->cardInfo($transactionId)->send();
dump($response->getCode());
dump($response->getInfo());
}

private function randomString(int $length = 15): string
{
$characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
Expand Down

0 comments on commit f5831d7

Please sign in to comment.