From 8a286beab0bd637494136ece311ea572ea29976a Mon Sep 17 00:00:00 2001 From: Arman Tuyakbayev Date: Thu, 2 Jul 2020 15:46:29 +0600 Subject: [PATCH] Add patch method to TransactionService (#415) * Add patch method to TransactionService * Increase version --- CHANGELOG.md | 5 +++++ src/Client.php | 2 +- src/Services/TransactionService.php | 13 +++++++++++++ tests/Api/ServiceTest.php | 3 +++ 4 files changed, 22 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fe350a0a6..7ad5a48e7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,10 @@ Security - in case of vulnerabilities. ## [Unreleased] +_TBD_ + +## [2.8.0] 2020-07-02 + ### Added - [x] Added new **AML API** - [x] Added new **Gateway Account Limit API** @@ -31,6 +35,7 @@ Security - in case of vulnerabilities. - [x] Added new methods to `GatewayAccount`: `setDigitalWallets`, `getDigitalWallets` - [x] Added new properties to `Invoice`: `transactions`, `poNumber`, `notes` - [x] Added new property to `Subscription`: `recentInvoice` +- [x] Added `patch` method to `TransactionService` ### Deprecated - [x] Deprecated `PayPalAccount` method: `getApprovalLink` diff --git a/src/Client.php b/src/Client.php index a53180397..12d298734 100644 --- a/src/Client.php +++ b/src/Client.php @@ -96,7 +96,7 @@ final class Client public const CURRENT_VERSION = 'v2.1'; - public const SDK_VERSION = '2.7.0'; + public const SDK_VERSION = '2.8.0'; private static $services = [ 'authenticationOptions' => Services\AuthenticationOptionsService::class, diff --git a/src/Services/TransactionService.php b/src/Services/TransactionService.php index 0c573d0b3..af3d17cbe 100644 --- a/src/Services/TransactionService.php +++ b/src/Services/TransactionService.php @@ -108,4 +108,17 @@ public function create($data) 'transactions' ); } + + /** + * @param string $transactionId + * @param array|JsonSerializable|Transaction $data + * + * @throws UnprocessableEntityException The input data does not valid + * + * @return Transaction + */ + public function patch($transactionId, $data) + { + return $this->client()->patch($data, 'transactions/{transactionId}', ['transactionId' => $transactionId]); + } } diff --git a/tests/Api/ServiceTest.php b/tests/Api/ServiceTest.php index 5fc13ac6b..d0b95e541 100644 --- a/tests/Api/ServiceTest.php +++ b/tests/Api/ServiceTest.php @@ -533,6 +533,9 @@ public function transactionService() $result = $service->cancel('dummy'); $this->assertInstanceOf(Entities\Transaction::class, $result); + + $result = $service->patch('dummy', []); + $this->assertInstanceOf(Entities\Transaction::class, $result); } /**