Skip to content
This repository has been archived by the owner on Apr 8, 2023. It is now read-only.

Commit

Permalink
Merge branch 'release/0.2.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
Cakasim committed Jul 18, 2020
2 parents caff45b + 820f1a2 commit c2669ba
Show file tree
Hide file tree
Showing 47 changed files with 746 additions and 3,054 deletions.
6 changes: 5 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,11 @@ jobs:
vendor/bin/phpunit --version
- name: Composer Install
run: composer install --prefer-dist --no-progress --no-suggest
run: |
composer install --prefer-dist --no-interaction --no-progress --no-suggest --ignore-platform-reqs
composer require --prefer-dist --no-interaction --no-progress --no-suggest --ignore-platform-reqs cakasim/payone-sdk-http-message:^0.1
composer require --prefer-dist --no-interaction --no-progress --no-suggest --ignore-platform-reqs cakasim/payone-sdk-stream-client:^0.1
composer require --prefer-dist --no-interaction --no-progress --no-suggest --ignore-platform-reqs cakasim/payone-sdk-silent-logger:^0.1
- name: Run Coding Style Checks
run: vendor/bin/phpcsf -v fix --dry-run --allow-risky=yes
Expand Down
3 changes: 3 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ cache:

install:
- composer install --prefer-dist --no-interaction --no-suggest --ignore-platform-reqs
- composer require --prefer-dist --no-interaction --no-suggest --ignore-platform-reqs cakasim/payone-sdk-http-message:^0.1
- composer require --prefer-dist --no-interaction --no-suggest --ignore-platform-reqs cakasim/payone-sdk-stream-client:^0.1
- composer require --prefer-dist --no-interaction --no-suggest --ignore-platform-reqs cakasim/payone-sdk-silent-logger:^0.1

before_script:
- composer download-phpunit
Expand Down
39 changes: 38 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,45 @@
Changelog
=========

0.2.0
----
**_Development Release / 2020-07-18_**

_Please use this release with caution. Versions prior to 1.0.0
are considered development releases._

### Changes

- **[BREAKING]** Removed `Cakasim\Payone\Sdk\Api\Service::getClient()`
- Added new proxy method `Cakasim\Payone\Sdk\Api\Service::sendRequest()`
- **[BREAKING]** Removed `getUriFactory()`, `getStreamFactory()`,
`getRequestFactory()`, `getResponseFactory()` and `getClient()` from
`Cakasim\Payone\Sdk\Http\Service` class
- Added new method `Cakasim\Payone\Sdk\Http\Service::createServerRequest()`
that creates a PSR-7 server request from the current environment.
- The `Cakasim\Payone\Sdk\Config\Config` class now comes with a default
configuration that is automatically applied. The following parameters
have default values: `api.endpoint`, `api.key_hash_type`, `api.mode`,
`notification.sender_address_whitelist`, `redirect.token_lifetime`,
`redirect.token_encryption_method` and `redirect.token_signing_algo`
[[#22](https://github.com/Cakasim/php-payone-sdk/issues/22)]
- **[BREAKING]** Moved PSR-7 HTTP message and PSR-17 HTTP factory components
into separate package which is now available as `cakasim/payone-sdk-http-message`
- **[BREAKING]** Moved PSR-18 HTTP client component into separate package
which is now available as `cakasim/payone-sdk-stream-client`
- **[BREAKING]** Moved PSR-3 logging component into separate package
which is now available as `cakasim/payone-sdk-silent-logger`
- **[BREAKING]** Removed log component and service
- Use URL-safe Base64 encoding instead of Base62 for redirect tokens which
fixes a strange IV length problem and drops the `ext-gmp` requirement
- The `Cakasim\Payone\Sdk\Sdk` class now has a `getConfig()` method
for accessing the config more conveniently
- Implemented logging for the redirect and notification services
[[#14](https://github.com/Cakasim/php-payone-sdk/issues/14)]
- Updated README in general and added a new section about the redirect service

0.1.0
-------------------------------
-----
**_Development Release / 2020-02-05_**

_This is the initial release of the project. Please use this release with caution.
Expand Down
292 changes: 237 additions & 55 deletions README.md

Large diffs are not rendered by default.

8 changes: 6 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,18 @@
"php": "^7.1",
"ext-json": "*",
"ext-openssl": "*",
"ext-gmp": "*",
"psr/http-message": "^1.0",
"psr/http-client": "^1.0",
"psr/http-factory": "^1.0",
"psr/log": "^1.1",
"psr/container": "^1.0"
},
"require-dev": {},
"suggest": {
"cakasim/payone-sdk-http-message": "Provides the default HTTP message implementation.",
"cakasim/payone-sdk-stream-client": "Provides the default HTTP client implementation.",
"cakasim/payone-sdk-silent-logger": "Provides the default logger implementation."
},
"autoload": {
"psr-4": {
"Cakasim\\Payone\\Sdk\\": "src/"
Expand All @@ -45,7 +50,6 @@
"Cakasim\\Payone\\Sdk\\Tests\\": "tests/"
}
},
"require-dev": {},
"scripts": {
"download-phpcsf": "curl --silent -L https://cs.symfony.com/download/php-cs-fixer-v2.phar --create-dirs --output vendor/bin/phpcsf",
"download-phpstan": "curl --silent -L https://github.com/phpstan/phpstan/releases/download/0.12.5/phpstan.phar --create-dirs --output vendor/bin/phpstan",
Expand Down
16 changes: 9 additions & 7 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 1 addition & 26 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -30,38 +30,13 @@ parameters:
count: 1
path: src\Container\Container.php

-
message: "#^Array \\(array\\<array\\<string\\>\\>\\) does not accept array\\<int, array\\|int\\|string\\>\\.$#"
count: 1
path: src\Http\Message\AbstractMessage.php

-
message: "#^Method Cakasim\\\\Payone\\\\Sdk\\\\Http\\\\Message\\\\AbstractMessage\\:\\:getHeaders\\(\\) should return array\\<array\\<string\\>\\> but returns array\\<string, string\\>\\.$#"
count: 1
path: src\Http\Message\AbstractMessage.php

-
message: "#^Method Cakasim\\\\Payone\\\\Sdk\\\\Http\\\\Message\\\\AbstractMessage\\:\\:getHeader\\(\\) should return array\\<string\\> but returns array\\|string\\.$#"
count: 1
path: src\Http\Message\AbstractMessage.php

-
message: "#^Array \\(array\\<array\\<string\\>\\>\\) does not accept array\\<int, array\\<string\\>\\|string\\>\\.$#"
count: 1
path: src\Http\Message\AbstractMessage.php

-
message: "#^Cannot assign offset string to array\\<int\\|string, int\\>\\|false\\.$#"
count: 1
path: src\Http\Message\Stream.php

-
message: "#^Method Cakasim\\\\Payone\\\\Sdk\\\\Notification\\\\Message\\\\AbstractMessage\\:\\:unserialize\\(\\) has parameter \\$serialized with no typehint specified\\.$#"
count: 1
path: src\Notification\Message\AbstractMessage.php

-
message: "#^PHPDoc tag @throws with type Psr\\\\Container\\\\ContainerExceptionInterface is not subtype of Throwable$#"
count: 5
count: 4
path: src\Sdk.php

16 changes: 12 additions & 4 deletions src/Api/Service.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@
namespace Cakasim\Payone\Sdk\Api;

use Cakasim\Payone\Sdk\AbstractService;
use Cakasim\Payone\Sdk\Api\Client\ClientExceptionInterface;
use Cakasim\Payone\Sdk\Api\Client\ClientInterface;
use Cakasim\Payone\Sdk\Api\Client\ErrorResponseExceptionInterface;
use Cakasim\Payone\Sdk\Api\Message\RequestInterface;
use Cakasim\Payone\Sdk\Api\Message\ResponseInterface;
use Psr\Container\ContainerInterface;

/**
Expand Down Expand Up @@ -36,12 +40,16 @@ public function __construct(
}

/**
* Returns the API client.
* Sends the provided request message and populates
* the provided response message with the API response.
*
* @return ClientInterface The API client.
* @param RequestInterface $request The request message to send.
* @param ResponseInterface $response The response message to populate with the API response.
* @throws ClientExceptionInterface If sending fails.
* @throws ErrorResponseExceptionInterface If the response is a PAYONE API error.
*/
public function getClient(): ClientInterface
public function sendRequest(RequestInterface $request, ResponseInterface $response): void
{
return $this->client;
$this->client->sendRequest($request, $response);
}
}
48 changes: 48 additions & 0 deletions src/Config/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,59 @@
*/
class Config implements ConfigInterface
{
/**
* The static configuration defaults.
*/
protected const DEFAULTS = [
'api.endpoint' => 'https://api.pay1.de/post-gateway/',
'api.key_hash_type' => 'sha384',
'api.mode' => 'test',

'notification.sender_address_whitelist' => [
'185.60.20.0/24',
'217.70.200.0/24',
'213.178.72.196',
'213.178.72.197',
],

'redirect.token_lifetime' => 3600,
'redirect.token_encryption_method' => 'aes-256-ctr',
'redirect.token_signing_algo' => 'sha256',
];

/**
* @var array Stores the config entries.
*/
protected $config = [];

/**
* Constructs the config with defaults.
*/
public function __construct()
{
$this->applyDefaults();
}

/**
* Applies the configuration defaults.
*/
protected function applyDefaults(): void
{
foreach ($this->getDefaults() as $name => $value) {
$this->set($name, $value);
}
}

/**
* Returns the configuration defaults.
*
* @return array The configuration defaults.
*/
protected function getDefaults(): array
{
return static::DEFAULTS;
}

/**
* @inheritDoc
*/
Expand Down
Loading

0 comments on commit c2669ba

Please sign in to comment.