diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 0000000..9d29af1 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,20 @@ +--- +name: Bug report +about: Create a report to help us improve +title: '' +labels: '' +assignees: '' + +--- + +**Description** + + +**How to reproduce** + + +**Possible Solution** + + +**Additional Context** + diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 0000000..bbcbbe7 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -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. diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index bd7dee3..a82d7f6 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -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 diff --git a/src/Message/AbstractRequest.php b/src/Message/AbstractRequest.php index 996ec7d..2fec807 100644 --- a/src/Message/AbstractRequest.php +++ b/src/Message/AbstractRequest.php @@ -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())) diff --git a/src/Message/CardInfoRequest.php b/src/Message/CardInfoRequest.php index 6aa746c..e3e896e 100644 --- a/src/Message/CardInfoRequest.php +++ b/src/Message/CardInfoRequest.php @@ -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); diff --git a/tests-api/GatewayTest.php b/tests-api/GatewayTest.php index 092a88c..d1c9707 100644 --- a/tests-api/GatewayTest.php +++ b/tests-api/GatewayTest.php @@ -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(); @@ -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';