Skip to content

Commit

Permalink
Merge pull request #17 from mysiar/dev
Browse files Browse the repository at this point in the history
fixes
  • Loading branch information
mysiar authored May 19, 2022
2 parents 92ae8d8 + f5831d7 commit 7bb584e
Show file tree
Hide file tree
Showing 6 changed files with 58 additions and 3 deletions.
20 changes: 20 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: ''
assignees: ''

---

**Description**
<!-- A clear and concise description of the problem. -->

**How to reproduce**
<!-- Code and/or config needed to reproduce the problem. -->

**Possible Solution**
<!--- Optional: only if you have suggestions on a fix/reason for the bug. -->

**Additional Context**
<!-- Optional: any other context about the problem: log messages, error messages, etc. -->
20 changes: 20 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: ''
assignees: ''

---

**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

**Describe the solution you'd like**
A clear and concise description of what you want to happen.

**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.

**Additional context**
Add any other context or screenshots about the feature request here.
5 changes: 5 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,8 @@ jobs:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./var/coverage.xml
fail_ci_if_error: true
- name: Upload coverage to Scrutinizer
run: |
wget https://scrutinizer-ci.com/ocular.phar
cp var/coverage.xml var/coverage.clover
php${{ matrix.php }} ocular.phar code-coverage:upload --access-token="${{ secrets.SCRUTINIZER_TOKEN }}" --format=php-clover var/coverage.clover
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
13 changes: 11 additions & 2 deletions 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 @@ -144,13 +144,22 @@ public function testPurchaseCard(): void
VarDumper::dump($response->getRedirectUrl());
VarDumper::dump($response->getMessage());

$this->assertSame(AbstractResponse::HTTP_OK, $response->getCode());
$this->assertSame(Response::HTTP_OK, $response->getCode());
$this->assertSame('', $response->getMessage());
$this->assertTrue($response->isSuccessful());
$this->assertContains('https://sandbox.przelewy24.pl/trnRequest/', $response->getRedirectUrl());
$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 7bb584e

Please sign in to comment.