Releases: ThePay/api-client
v2.1.0
What's Changed
Non final class ThePay\ApiClient\Model\SimplePayment
has new method getCard returning information about PaymentCard if payment was paid by method with PaymentMethodTag card.
- 4837 - PaymentCard test by @joseftraxler in #60
- add card attribute to SimplePayment by @AlexKratky in #59
- fixed links by @AlexKratky in #64
- stage to master by @AlexKratky in #65
- nullable pay and state url by @AlexKratky in #63
- 4976 updated url by @AlexKratky in #66
- PaymentCard model code quality improvements by @Triplkrypl in #67
- V2.x merge v1.x by @Triplkrypl in #68
- add php 8.3 support in github workflow by @Triplkrypl in #69
Full Changelog: v2.0.0...v2.1.0
v2.0.0
⚠ Break changes ⚠
Hear ye, hear ye!
This is a new major version v2.0.0 of our api-client. This package uses Semantic Versioning, which means a major version is released only when there are breaking changes present. If you are upgrading your integration from v1.* to the v2.0.0 version, you must update your code accordingly, to accomodate these breaking changes. We recommend using Phpstan, Psalm or a similar static analyzer for automated detection of such changes.
Following is the list of changes in the interface:
PHP requirement change
You must upgrade your PHP version to 7.4 or higher!
We use new PHP syntax (which is really cute 😍), so we highly recommend you try it out as well!
New composer packages requirement
The class ThePay\ApiClient\Exception\CurlException
and all classes in namespace ThePay\ApiClient\Http
were removed and replaced with composer packages psr/http-client, psr/http-factory, psr/http-message (PSR interfaces). This will reduce the overall maintenance of HTTP communication in the future.
You must use some form of PSR-18 implementation. If you do not use any yet, we suggest the composer package Guzzle:
composer require guzzlehttp/guzzle
Example usage is shown further below.
TheClient and ApiService interface changes
The constructors for \ThePay\ApiClient\Service\ApiService
and for the main class \ThePay\ApiClient\TheClient
were changed due to the usage of PSR.
You must update the creation of TheClient instance in your integration and inject some PSR HTTP client implementation into TheClient dependencies.
From old code:
/** @var \ThePay\ApiClient\TheConfig $theConfig */
$thePayClient = new TheClient($theConfig);
To new code:
/** @var \ThePay\ApiClient\TheConfig $theConfig */
$signatureService = new \ThePay\ApiClient\Service\SignatureService($theConfig);
/** @var \Psr\Http\Client\ClientInterface $httpClient some PSR-18 implementation */
/** @var \Psr\Http\Message\RequestFactoryInterface $requestFactory some PSR-17 implementation */
/** @var \Psr\Http\Message\StreamFactoryInterface $streamFactory some PSR-17 implementation */
// if you install suggested guzzle implementation you can use this:
// $httpClient = new \GuzzleHttp\Client();
// $requestFactory = $streamFactory = new \GuzzleHttp\Psr7\HttpFactory();
$apiService = new \ThePay\ApiClient\Service\ApiService(
$theConfig,
$signatureService,
$httpClient,
$requestFactory,
$streamFactory
);
$thePayClient = new \ThePay\ApiClient\TheClient(
$theConfig,
$apiService
);
ApiService, ApiServiceInterface and TheClient were also changed - either method parameters or the return type might now have more concrete definition. For example int
changed into int<1, max>
or string
into non-empty-string
, StringValue
into native string
etc.
You should check your TheClient methods calls, if you pass the exact types and correct values. Otherwise the SDK could throw some new Exceptions.
Changed method list:
\ThePay\ApiClient\Service\ApiServiceInterface::getPayments
\ThePay\ApiClient\Service\ApiServiceInterface::getAccountTransactionHistory
\ThePay\ApiClient\Service\ApiServiceInterface::createPayment
\ThePay\ApiClient\Service\ApiServiceInterface::changePaymentMethod
\ThePay\ApiClient\Service\ApiServiceInterface::createPaymentRefund
\ThePay\ApiClient\Service\ApiService::getPayments
\ThePay\ApiClient\Service\ApiService::getAccountTransactionHistory
\ThePay\ApiClient\Service\ApiService::createPayment
\ThePay\ApiClient\Service\ApiService::changePaymentMethod
\ThePay\ApiClient\Service\ApiService::createPaymentRefund
\ThePay\ApiClient\TheClient::createPayment
\ThePay\ApiClient\TheClient::changePaymentMethod
\ThePay\ApiClient\TheClient::realizePreauthorizedPayment
\ThePay\ApiClient\TheClient::cancelPreauthorizedPayment
\ThePay\ApiClient\TheClient::generatePaymentConfirmationPdf
Removed methods and classes
We removed some functionality which was no longer needed or could potentionally lead into wrong usage of our SDK. For example, in the past, the enum of payment methods was often used as method list instead of call API endpoint TheClient::getActivePaymentMethods
, which woudn't give you an up to date method list in case of their update (which happens frequently).
The full list of affected classes:
\ThePay\ApiClient\Filter\PaymentsFilter
\ThePay\ApiClient\Model\CreatePaymentParams
\ThePay\ApiClient\Model\PaymentMethod
\ThePay\ApiClient\Service\SignatureService
\ThePay\ApiClient\ValueObject\PaymentMethodCode
You must find the usage of removed methods or classes in your integration and resolve them in accordance to the changes. A few examples:
\ThePay\ApiClient\ValueObject\PaymentMethodCode
was completely removed. Just change the type into non-empty-string
as seen in the \ThePay\ApiClient\Filter\PaymentsFilter::__construct
parameter.
From old code:
function someMethod(\ThePay\ApiClient\ValueObject\PaymentMethodCode $methodCode): void
To new code:
/**
* @param non-empty-string $methodCode
*/
function someMethod(string $methodCode): void
From \ThePay\ApiClient\Model\CreatePaymentParams
the isRecurring
and setIsRecurring
methods were removed. We changed the naming convention from recurring payments into save authorization, as it better represents the real business usage of those methods. Again, it can be resolved just by calling the new methods as shown in the following example.
From old code:
/** @var \ThePay\ApiClient\Model\CreatePaymentParams $params */
$params->setIsRecurring(true);
$params->isRecurring();
To new code:
/** @var \ThePay\ApiClient\Model\CreatePaymentParams $params */
$params->setSaveAuthorization(true);
$params->getSaveAuthorization();
In \ThePay\ApiClient\Model\PaymentMethod
the TAG_*
constants were removed. This was an unnecessary duplication, since these tags already exist in the \ThePay\ApiClient\ValueObject\PaymentMethodTag
enum.
From old code:
$tagCard = \ThePay\ApiClient\Model\PaymentMethod::TAG_CARD;
To new code:
$tagCard = \ThePay\ApiClient\ValueObject\PaymentMethodTag::CARD;
\ThePay\ApiClient\Service\SignatureService
contained some unused functionality, which was removed. The following methods are not present anymore.
Removed methods: signGateRequest
, getBase64FromParameters
, getSignatureForBase64
What's Changed
- v1.x -> v2.x by @Triplkrypl in #43
- 1951 old PHP sintax removed from fixer rules by @Triplkrypl in #45
- deprecated php versions removed and phpunit update by @Triplkrypl in #44
- 4648 PaymentMethodCode enum removed by @Triplkrypl in #46
- v1.x -> v2.x by @Triplkrypl in #48
- 4650 ThePay\ApiClient\Http replaced by PSR standarts by @Triplkrypl in #49
- 4647 removing all deprecated code by @Triplkrypl in #50
- 4651 all todos are resolved by @Triplkrypl in #51
- V2.x 4729 merge v1.x by @Triplkrypl in #53
- V2.x 4729 merge v1.x by @Triplkrypl in #57
- Version update to 2.0.0 by @Triplkrypl in #58
Full Changelog: v1.7.0...v2.0.0
v1.7.0
What's Changed
- 4573 added order_id filter by @AlexKratky in #40
- 7.2 and 7.3 PHP version marked as deprecated by @Triplkrypl in #41
- 4648 method enum marked as deprecated by @Triplkrypl in #42
- 4650 Classes in Http namespace marked as deprecated by @Triplkrypl in #47
- 4698 new method for generating payment confirmation by @Triplkrypl in #52
- TheClient::getAccountsBalances method added by @Triplkrypl in #55
- Version update to 1.7.0 by @Triplkrypl in #56
Full Changelog: v1.6.0...v1.7.0
v1.6.0
What's Changed
- payment urls by @AlexKratky in #28
- Removing of unsupported PHP versions from CI scripts and new PHP 8.2 added with partial support. by @Triplkrypl in #36
- documentation cleanup by @Triplkrypl in #38
- Release - 1.x autumn by @tymajiri in #37
- Version update to 1.6.0 by @tymajiri in #39
Full Changelog: v1.5.1...v1.6.0
v1.5.1
What's Changed
- 4282 - Fix node-sass certificate issue by @joseftraxler in #32
- Mark old php versions as deprecated by @Triplkrypl in #33
- v1.5.1 by @joseftraxler in #34
Full Changelog: v1.5.0...v1.5.1
v1.5.0
What's Changed
- added description_for_merchant by @AlexKratky in #10
- added support for shipping address by @AlexKratky in #17
- added currency code to filter by @AlexKratky in #16
- new better example for setting of allowed ip addresses by @Triplkrypl in #29
- V1.x summer by @tymajiri in #30
- Update TheClient.php by @tymajiri in #31
Full Changelog: v1.4.3...v1.5.0
v1.4.3
What's Changed
- unnecessary condition removed by @Triplkrypl in #26
- Hotfix 4213 header case sensitivity by @Triplkrypl in #27
Full Changelog: v1.4.2...v1.4.3