diff --git a/.travis.yml b/.travis.yml index 47a52c8a..f2316349 100755 --- a/.travis.yml +++ b/.travis.yml @@ -3,61 +3,31 @@ dist: trusty matrix: fast_finish: true include: - - name: "php 7.0 (install) - unit" - php: 7.0 - env: - - DEPS=NO - - LEVEL=UNIT - - name: "php 7.0 (update) - unit" - php: 7.0 - env: - - DEPS=HIGH - - LEVEL=UNIT - - name: "php 7.0 (update) - integration" - php: 7.0 - env: - - DEPS=HIGH - - LEVEL=INTEGRATION - name: "php 7.1 (install) - unit" php: 7.1 env: - DEPS=NO - LEVEL=UNIT - - name: "php 7.1 (update) - unit" + - name: "php 7.1 (install) - integration" php: 7.1 env: - - DEPS=HIGH - - LEVEL=UNIT + - DEPS=NO + - LEVEL=INTEGRATION - name: "php 7.2 (install) - unit" php: 7.2 env: - DEPS=NO - LEVEL=UNIT - - name: "php 7.2 (update) - unit" - php: 7.2 - env: - - DEPS=HIGH - - LEVEL=UNIT - name: "php 7.3 (install) - unit" php: 7.3 env: - DEPS=NO - LEVEL=UNIT - - name: "php 7.3 (update) - unit" - php: 7.3 - env: - - DEPS=HIGH - - LEVEL=UNIT - name: "php 7.4 (install) - unit" php: 7.4 env: - DEPS=NO - LEVEL=UNIT - - name: "php 7.4 (update) - unit" - php: 7.4 - env: - - DEPS=HIGH - - LEVEL=UNIT cache: directories: - $HOME/.composer/cache diff --git a/CHANGELOG.md b/CHANGELOG.md index 0c86e36a..0807fe14 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,18 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). +## [1.2.7.1][1.2.7.1] + +### Added +* PHP version to HTTP header. + +### Remove +* PHP7.0 support. +* Travis tests using composer update. + +### Fix +* Changed date format string to support times with 24h-format. + ## [1.2.7.0][1.2.7.0] ### Added @@ -381,3 +393,4 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a [1.2.5.1]: https://github.com/heidelpay/heidelpayPHP/compare/1.2.5.0..1.2.5.1 [1.2.6.0]: https://github.com/heidelpay/heidelpayPHP/compare/1.2.5.1..1.2.6.0 [1.2.7.0]: https://github.com/heidelpay/heidelpayPHP/compare/1.2.6.0..1.2.7.0 +[1.2.7.1]: https://github.com/heidelpay/heidelpayPHP/compare/1.2.7.0..1.2.7.1 diff --git a/README.md b/README.md index db96b851..229fec7c 100755 --- a/README.md +++ b/README.md @@ -1,7 +1,6 @@ [![Latest Version on Packagist](https://img.shields.io/packagist/v/heidelpay/heidelpay-php.svg?style=flat-square)](https://packagist.org/packages/heidelpay/heidelpay-php) [![Codacy Badge](https://api.codacy.com/project/badge/Grade/a5fceb1b4f674fb49db39929559f3959)](https://www.codacy.com/app/heidelpay/heidelpayPHP?utm_source=github.com&utm_medium=referral&utm_content=heidelpay/heidelpayPHP&utm_campaign=Badge_Grade) [![Codacy Badge](https://api.codacy.com/project/badge/Coverage/a5fceb1b4f674fb49db39929559f3959)](https://www.codacy.com/app/heidelpay/heidelpayPHP?utm_source=github.com&utm_medium=referral&utm_content=heidelpay/heidelpayPHP&utm_campaign=Badge_Coverage) -[![PHP 7.0](https://img.shields.io/badge/php-7.0-blue.svg)](http://www.php.net) [![PHP 7.1](https://img.shields.io/badge/php-7.1-blue.svg)](http://www.php.net) [![PHP 7.2](https://img.shields.io/badge/php-7.2-blue.svg)](http://www.php.net) [![PHP 7.3](https://img.shields.io/badge/php-7.3-blue.svg)](http://www.php.net) diff --git a/composer.json b/composer.json index 5835fbd4..ae925171 100755 --- a/composer.json +++ b/composer.json @@ -10,7 +10,7 @@ } ], "require": { - "php": "~7.0.0|~7.1.0|~7.2.0|~7.3.0|~7.4.0", + "php": "~7.1.0|~7.2.0|~7.3.0|~7.4.0", "ext-json": "*" }, "require-dev": { diff --git a/src/Heidelpay.php b/src/Heidelpay.php index 828a747c..581f7fd4 100755 --- a/src/Heidelpay.php +++ b/src/Heidelpay.php @@ -64,7 +64,7 @@ class Heidelpay implements HeidelpayParentInterface, PaymentServiceInterface, Re const BASE_URL = 'api.heidelpay.com'; const API_VERSION = 'v1'; const SDK_TYPE = 'HeidelpayPHP'; - const SDK_VERSION = '1.2.7.0'; + const SDK_VERSION = '1.2.7.1'; /** @var string $key */ private $key; diff --git a/src/Services/HttpService.php b/src/Services/HttpService.php index c659321e..49f69e33 100755 --- a/src/Services/HttpService.php +++ b/src/Services/HttpService.php @@ -31,6 +31,7 @@ use heidelpayPHP\Resources\AbstractHeidelpayResource; use RuntimeException; use function in_array; +use const PHP_VERSION; class HttpService { @@ -261,7 +262,8 @@ public function composerHttpHeaders(Heidelpay $heidelpay): array 'Authorization' => 'Basic ' . base64_encode($key . ':'), 'Content-Type' => 'application/json', 'SDK-VERSION' => Heidelpay::SDK_VERSION, - 'SDK-TYPE' => Heidelpay::SDK_TYPE + 'SDK-TYPE' => Heidelpay::SDK_TYPE, + 'PHP-VERSION' => PHP_VERSION ]; if (!empty($locale)) { $httpHeaders['Accept-Language'] = $locale; diff --git a/src/Traits/HasDate.php b/src/Traits/HasDate.php index 21c37d92..41d72790 100644 --- a/src/Traits/HasDate.php +++ b/src/Traits/HasDate.php @@ -42,7 +42,7 @@ trait HasDate public function getDate() { $date = $this->date; - return $date ? $date->format('Y-m-d h:i:s') : null; + return $date ? $date->format('Y-m-d H:i:s') : null; } /** diff --git a/test/integration/PaymentTest.php b/test/integration/PaymentTest.php index 7b865d20..ebab4006 100755 --- a/test/integration/PaymentTest.php +++ b/test/integration/PaymentTest.php @@ -27,7 +27,6 @@ use heidelpayPHP\Constants\ApiResponseCodes; use heidelpayPHP\Exceptions\HeidelpayApiException; -use heidelpayPHP\Resources\Payment; use heidelpayPHP\Resources\PaymentTypes\Card; use heidelpayPHP\Resources\PaymentTypes\Paypal; use heidelpayPHP\Resources\TransactionTypes\Authorization; @@ -45,11 +44,10 @@ class PaymentTest extends BasePaymentTest * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ - public function paymentShouldBeFetchableById() + public function paymentShouldBeFetchableById(): void { $authorize = $this->createPaypalAuthorization(); $payment = $this->heidelpay->fetchPayment($authorize->getPayment()->getId()); - $this->assertNotNull(Payment::class, $payment); $this->assertNotEmpty($payment->getId()); $this->assertInstanceOf(Authorization::class, $payment->getAuthorization()); $this->assertNotEmpty($payment->getAuthorization()->getId()); diff --git a/test/unit/Resources/TransactionTypes/AbstractTransactionTypeTest.php b/test/unit/Resources/TransactionTypes/AbstractTransactionTypeTest.php index 23e5a936..baa19fa7 100755 --- a/test/unit/Resources/TransactionTypes/AbstractTransactionTypeTest.php +++ b/test/unit/Resources/TransactionTypes/AbstractTransactionTypeTest.php @@ -67,7 +67,7 @@ public function theGettersAndSettersShouldWorkProperly() $this->assertNull($transactionType->getRedirectUrl()); $payment->setId('MyPaymentId'); - $date = (new DateTime('now'))->format('Y-m-d h:i:s'); + $date = (new DateTime('now'))->format('Y-m-d H:i:s'); $transactionType->setPayment($payment); $transactionType->setDate($date); $transactionType->handleResponse((object)['isError' => true, 'isPending' => true, 'isSuccess' => true]); diff --git a/test/unit/Services/HttpServiceTest.php b/test/unit/Services/HttpServiceTest.php index 712ff2c3..581eb355 100755 --- a/test/unit/Services/HttpServiceTest.php +++ b/test/unit/Services/HttpServiceTest.php @@ -37,6 +37,7 @@ use PHPUnit\Framework\Exception; use ReflectionException; use RuntimeException; +use const PHP_VERSION; class HttpServiceTest extends BasePaymentTest { @@ -128,7 +129,8 @@ static function ($url) { 'Authorization' => 'Basic cy1wcml2LU15VGVzdEtleTo=', 'Content-Type' => 'application/json', 'SDK-VERSION' => Heidelpay::SDK_VERSION, - 'SDK-TYPE' => Heidelpay::SDK_TYPE + 'SDK-TYPE' => Heidelpay::SDK_TYPE, + 'PHP-VERSION' => PHP_VERSION ]; $adapterMock->expects($this->once())->method('setHeaders')->with($headers); $adapterMock->expects($this->once())->method('execute')->willReturn('myResponseString');