From 2f11a261da4d1b464b4c10338b083e3fb66669a7 Mon Sep 17 00:00:00 2001 From: sixer1182 Date: Tue, 19 Nov 2019 17:15:32 +0100 Subject: [PATCH 001/101] [cleanup] Fixed several minor issues. --- CHANGELOG.md | 6 +-- README.md | 4 +- .../TransactionTypes/ShipmentTest.php | 39 +++++-------------- 3 files changed, 15 insertions(+), 34 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c25a99ff..68818ee4 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,10 +6,10 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a ## [1.2.5.0][1.2.5.0] ### Added -* Hire purchase direct debit payment type (FlexiPay Rate) including example implementation. +* Hire purchase direct debit payment type (FlexiPay® Rate) including example implementation. * Additional parameters from payment type to transactions. * Facade method to update payment type. -* Property invoiceId to `Payment` class. +* Property `invoiceId` to `Payment` class. * Added card details to `Card` payment type. * Property `card3ds` to `Paypage`. * Geolocation to `Customer` resource. @@ -18,7 +18,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a ### Changed * Refactor invoice guaranteed tests to make them independent from each other. * Response Code for basket item image extension error has been deprecated since it has been removed from the API. -* Refactored cancellation feature to support FlexiPay Rate cancel. +* Refactored cancellation feature to support FlexiPay® Rate cancel. * Remove trailing slash from routes. * Float values are now rounded with 4 decimal places when exposed to the API. The value of the local object will be updated as well. diff --git a/README.md b/README.md index 90b18fed..df0c3502 100755 --- a/README.md +++ b/README.md @@ -29,11 +29,11 @@ Please refer to the following documentation for installation instructions and us * SEPA direct debit (guaranteed) * SOFORT * EPS -* FlexiPay Direct (PIS) +* FlexiPay® Direct (PIS) * Alipay * WeChat Pay * Invoice Factoring -* FlexiPay Rate (Hire Purchase Direct Debit) +* FlexiPay® Rate (Hire Purchase Direct Debit) ## Supported features * Webhooks and event handling diff --git a/test/integration/TransactionTypes/ShipmentTest.php b/test/integration/TransactionTypes/ShipmentTest.php index d1d3d671..7248c03a 100644 --- a/test/integration/TransactionTypes/ShipmentTest.php +++ b/test/integration/TransactionTypes/ShipmentTest.php @@ -41,14 +41,10 @@ class ShipmentTest extends BasePaymentTest */ public function shipmentShouldBeCreatableAndFetchable() { - $invoiceGuaranteed = new InvoiceGuaranteed(); - $charge = $this->heidelpay->charge( - 100.0, - 'EUR', - $invoiceGuaranteed, - self::RETURN_URL, - $this->getMaximumCustomerInclShippingAddress()->setShippingAddress($this->getBillingAddress()) - ); + $ivg = new InvoiceGuaranteed(); + $customer = $this->getMaximumCustomerInclShippingAddress()->setShippingAddress($this->getBillingAddress()); + + $charge = $this->heidelpay->charge(100.0, 'EUR', $ivg, self::RETURN_URL, $customer); $this->assertNotNull($charge->getId()); $this->assertNotNull($charge); @@ -72,13 +68,8 @@ public function shipmentShouldBeCreatableAndFetchable() public function shipmentCanBeCalledOnThePaymentObject() { $invoiceGuaranteed = new InvoiceGuaranteed(); - $charge = $this->heidelpay->charge( - 100.0, - 'EUR', - $invoiceGuaranteed, - self::RETURN_URL, - $this->getMaximumCustomerInclShippingAddress()->setShippingAddress($this->getBillingAddress()) - ); + $customer = $this->getMaximumCustomerInclShippingAddress()->setShippingAddress($this->getBillingAddress()); + $charge = $this->heidelpay->charge(100.0, 'EUR', $invoiceGuaranteed, self::RETURN_URL, $customer); $payment = $charge->getPayment(); $shipment = $payment->ship(self::generateRandomId(), self::generateRandomId()); @@ -103,13 +94,8 @@ public function shipmentCanBeCalledOnThePaymentObject() public function shipmentShouldBePossibleWithPaymentObject() { $invoiceGuaranteed = new InvoiceGuaranteed(); - $charge = $this->heidelpay->charge( - 100.0, - 'EUR', - $invoiceGuaranteed, - self::RETURN_URL, - $this->getMaximumCustomerInclShippingAddress()->setShippingAddress($this->getBillingAddress()) - ); + $customer = $this->getMaximumCustomerInclShippingAddress()->setShippingAddress($this->getBillingAddress()); + $charge = $this->heidelpay->charge(100.0, 'EUR', $invoiceGuaranteed, self::RETURN_URL, $customer); $payment = $charge->getPayment(); $shipment = $this->heidelpay->ship($payment, self::generateRandomId(), self::generateRandomId()); @@ -128,13 +114,8 @@ public function shipmentShouldBePossibleWithPaymentObject() public function shipmentStatusIsSetCorrectly() { $invoiceGuaranteed = new InvoiceGuaranteed(); - $charge = $this->heidelpay->charge( - 100.0, - 'EUR', - $invoiceGuaranteed, - self::RETURN_URL, - $this->getMaximumCustomerInclShippingAddress()->setShippingAddress($this->getBillingAddress()) - ); + $customer = $this->getMaximumCustomerInclShippingAddress()->setShippingAddress($this->getBillingAddress()); + $charge = $this->heidelpay->charge(100.0, 'EUR', $invoiceGuaranteed, self::RETURN_URL, $customer); $payment = $charge->getPayment(); $shipment = $this->heidelpay->ship($payment, self::generateRandomId(), self::generateRandomId()); From ad970281abcc41d8e119f42322a8ad32d62e564f Mon Sep 17 00:00:00 2001 From: sixer1182 Date: Wed, 20 Nov 2019 14:43:48 +0100 Subject: [PATCH 002/101] [change] (PHPLIB-263) P24: Add example. --- examples/Przelewy24/Constants.php | 30 ++++++++ examples/Przelewy24/Controller.php | 88 ++++++++++++++++++++++ examples/Przelewy24/ReturnController.php | 96 ++++++++++++++++++++++++ examples/Przelewy24/index.php | 92 +++++++++++++++++++++++ examples/index.php | 12 +++ 5 files changed, 318 insertions(+) create mode 100644 examples/Przelewy24/Constants.php create mode 100644 examples/Przelewy24/Controller.php create mode 100644 examples/Przelewy24/ReturnController.php create mode 100644 examples/Przelewy24/index.php diff --git a/examples/Przelewy24/Constants.php b/examples/Przelewy24/Constants.php new file mode 100644 index 00000000..c4f4ba51 --- /dev/null +++ b/examples/Przelewy24/Constants.php @@ -0,0 +1,30 @@ + + * + * @package heidelpayPHP/examples + */ + +require_once __DIR__ . '/../Constants.php'; + +define('EXAMPLE_URL', EXAMPLE_BASE_FOLDER . 'Przelewy24'); +define('CONTROLLER_URL', EXAMPLE_URL . '/Controller.php'); +define('RETURN_CONTROLLER_URL', EXAMPLE_URL . '/ReturnController.php'); diff --git a/examples/Przelewy24/Controller.php b/examples/Przelewy24/Controller.php new file mode 100644 index 00000000..4a3ab778 --- /dev/null +++ b/examples/Przelewy24/Controller.php @@ -0,0 +1,88 @@ + + * + * @package heidelpayPHP/examples + */ + +/** Require the constants of this example */ +require_once __DIR__ . '/Constants.php'; + +/** @noinspection PhpIncludeInspection */ +/** Require the composer autoloader file */ +require_once __DIR__ . '/../../../../autoload.php'; + +use heidelpayPHP\examples\ExampleDebugHandler; +use heidelpayPHP\Exceptions\HeidelpayApiException; +use heidelpayPHP\Heidelpay; +use heidelpayPHP\Resources\CustomerFactory; + +$clientMessage = 'Something went wrong. Please try again later.'; + +session_start(); +session_unset(); + +$clientMessage = 'Something went wrong. Please try again later.'; +$merchantMessage = 'Something went wrong. Please try again later.'; + +function redirect($url, $merchantMessage = '', $clientMessage = '') +{ + $_SESSION['merchantMessage'] = $merchantMessage; + $_SESSION['clientMessage'] = $clientMessage; + header('Location: ' . $url); + die(); +} + +// You will need the id of the payment type created in the frontend (index.php) +if (!isset($_POST['resourceId'])) { + redirect(FAILURE_URL, 'Resource id is missing!', $clientMessage); +} +$paymentTypeId = $_POST['resourceId']; + +// Catch API errors, write the message to your log and show the ClientMessage to the client. +try { + // Create a heidelpay object using your private key and register a debug handler if you want to. + $heidelpay = new Heidelpay(HEIDELPAY_PHP_PAYMENT_API_PRIVATE_KEY); + $heidelpay->setDebugMode(true)->setDebugHandler(new ExampleDebugHandler()); + + // Create a charge to get the redirectUrl. + $customer = CustomerFactory::createCustomer('Max', 'Mustermann'); + $charge = $heidelpay->charge(12.99, 'EUR', $paymentTypeId, RETURN_CONTROLLER_URL, $customer); + + // You'll need to remember the paymentId for later in the ReturnController + $_SESSION['PaymentId'] = $charge->getPaymentId(); + $_SESSION['ShortId'] = $charge->getShortId(); + + // Redirect to the P24 page of the selected bank + if (!$charge->isError() && $charge->getRedirectUrl() !== null) { + redirect($charge->getRedirectUrl()); + } + + // Check the result message of the charge to find out what went wrong. + $merchantMessage = $charge->getMessage()->getCustomer(); +} catch (HeidelpayApiException $e) { + $merchantMessage = $e->getMerchantMessage(); + $clientMessage = $e->getClientMessage(); +} catch (RuntimeException $e) { + $merchantMessage = $e->getMessage(); +} +redirect(FAILURE_URL, $merchantMessage, $clientMessage); diff --git a/examples/Przelewy24/ReturnController.php b/examples/Przelewy24/ReturnController.php new file mode 100644 index 00000000..fef5b3b5 --- /dev/null +++ b/examples/Przelewy24/ReturnController.php @@ -0,0 +1,96 @@ + + * + * @package heidelpayPHP/examples + */ + +/** Require the constants of this example */ +require_once __DIR__ . '/Constants.php'; + +/** @noinspection PhpIncludeInspection */ +/** Require the composer autoloader file */ +require_once __DIR__ . '/../../../../autoload.php'; + +use heidelpayPHP\examples\ExampleDebugHandler; +use heidelpayPHP\Exceptions\HeidelpayApiException; +use heidelpayPHP\Heidelpay; + +$clientMessage = 'Something went wrong. Please try again later.'; +$merchantMessage = 'Something went wrong. Please try again later.'; + +function redirect($url, $merchantMessage = '', $clientMessage = '') +{ + $_SESSION['merchantMessage'] = $merchantMessage; + $_SESSION['clientMessage'] = $clientMessage; + header('Location: ' . $url); + die(); +} + +session_start(); + +// Retrieve the paymentId you remembered within the Controller +if (!isset($_SESSION['PaymentId'])) { + redirect(FAILURE_URL, 'The payment id is missing.', $clientMessage); +} +$paymentId = $_SESSION['PaymentId']; + +// Catch API errors, write the message to your log and show the ClientMessage to the client. +try { + // Create a heidelpay object using your private key and register a debug handler if you want to. + $heidelpay = new Heidelpay(HEIDELPAY_PHP_PAYMENT_API_PRIVATE_KEY); + $heidelpay->setDebugMode(true)->setDebugHandler(new ExampleDebugHandler()); + + // Redirect to success if the payment has been successfully completed. + $payment = $heidelpay->fetchPayment($paymentId); + + if ($payment->isCompleted()) { + // The payment process has been successful. + // You can create the order and show a success page. + redirect(SUCCESS_URL); + } elseif ($payment->isPending()) { + // In case of authorization this is normal since you will later charge the payment. + // You can create the order with status pending payment and show a success page to the customer if you want. + + // In cases of redirection to an external service (e.g. 3D secure, PayPal, etc) it sometimes takes time for + // the payment to update it's status. In this case it might be pending at first and change to cancel or success later. + // Use the webhooks feature to stay informed about changes of the payment (e.g. cancel, success) + // then you can cancel the order later or mark it paid as soon as the event is triggered. + + // In any case, the payment is not done when the payment is pending and you should ship until it changes to success. + redirect(PENDING_URL); + } + // If the payment is neither success nor pending something went wrong. + // In this case do not create the order. + // Redirect to an error page in your shop and show an message if you want. + + // Check the result message of the charge to find out what went wrong. + $charge = $payment->getChargeByIndex(0); + $merchantMessage = $charge->getMessage()->getCustomer(); +} catch (HeidelpayApiException $e) { + $merchantMessage = $e->getMerchantMessage(); + $clientMessage = $e->getClientMessage(); +} catch (RuntimeException $e) { + $merchantMessage = $e->getMessage(); +} +redirect(FAILURE_URL, $merchantMessage, $clientMessage); + diff --git a/examples/Przelewy24/index.php b/examples/Przelewy24/index.php new file mode 100644 index 00000000..eef98794 --- /dev/null +++ b/examples/Przelewy24/index.php @@ -0,0 +1,92 @@ + + * + * @package heidelpayPHP/examples + */ + +/** Require the constants of this example */ +require_once __DIR__ . '/Constants.php'; + +/** @noinspection PhpIncludeInspection */ +/** Require the composer autoloader file */ +require_once __DIR__ . '/../../../../autoload.php'; +?> + + + + + + + Heidelpay UI Examples + + + + + + + + + +

Click here to open our test data in new tab.

+ +
+
+
+ +
+ + + + diff --git a/examples/index.php b/examples/index.php index 18bfd314..74a4fbbe 100755 --- a/examples/index.php +++ b/examples/index.php @@ -140,6 +140,18 @@ Try +
+
+
+ Przelewy24 (P24) +
+
+
+
+
+ Try +
+
From 39959e3119227235af9a54a561216fdf2b9ebb6a Mon Sep 17 00:00:00 2001 From: sixer1182 Date: Wed, 20 Nov 2019 14:47:43 +0100 Subject: [PATCH 003/101] [refactor] SDD: Refactor integration tests to make tests independent from each other. --- .../PaymentTypes/SepaDirectDebitTest.php | 60 +++++++++---------- 1 file changed, 27 insertions(+), 33 deletions(-) diff --git a/test/integration/PaymentTypes/SepaDirectDebitTest.php b/test/integration/PaymentTypes/SepaDirectDebitTest.php index 67b1bd6f..24bc73ad 100755 --- a/test/integration/PaymentTypes/SepaDirectDebitTest.php +++ b/test/integration/PaymentTypes/SepaDirectDebitTest.php @@ -28,7 +28,6 @@ use heidelpayPHP\Constants\ApiResponseCodes; use heidelpayPHP\Exceptions\HeidelpayApiException; use heidelpayPHP\Resources\PaymentTypes\SepaDirectDebit; -use heidelpayPHP\Resources\TransactionTypes\Charge; use heidelpayPHP\test\BasePaymentTest; use RuntimeException; @@ -60,26 +59,20 @@ public function sepaDirectDebitShouldBeCreatableWithMandatoryFieldsOnly() * * @test * - * @return SepaDirectDebit - * * @throws HeidelpayApiException * @throws RuntimeException */ - public function sepaDirectDebitShouldBeCreatable(): SepaDirectDebit + public function sepaDirectDebitShouldBeCreatable() { - /** @var SepaDirectDebit $directDebit */ - $directDebit = (new SepaDirectDebit('DE89370400440532013000')) - ->setHolder('Max Mustermann') - ->setBic('COBADEFFXXX'); - $directDebit = $this->heidelpay->createPaymentType($directDebit); - $this->assertInstanceOf(SepaDirectDebit::class, $directDebit); - $this->assertNotNull($directDebit->getId()); + /** @var SepaDirectDebit $sdd */ + $sdd = (new SepaDirectDebit('DE89370400440532013000'))->setHolder('Max Mustermann')->setBic('COBADEFFXXX'); + $sdd = $this->heidelpay->createPaymentType($sdd); + $this->assertInstanceOf(SepaDirectDebit::class, $sdd); + $this->assertNotNull($sdd->getId()); /** @var SepaDirectDebit $fetchedDirectDebit */ - $fetchedDirectDebit = $this->heidelpay->fetchPaymentType($directDebit->getId()); - $this->assertEquals($directDebit->expose(), $fetchedDirectDebit->expose()); - - return $fetchedDirectDebit; + $fetchedDirectDebit = $this->heidelpay->fetchPaymentType($sdd->getId()); + $this->assertEquals($sdd->expose(), $fetchedDirectDebit->expose()); } /** @@ -87,38 +80,34 @@ public function sepaDirectDebitShouldBeCreatable(): SepaDirectDebit * * @test * - * @param SepaDirectDebit $directDebit - * * @throws HeidelpayApiException * @throws RuntimeException - * @depends sepaDirectDebitShouldBeCreatable */ - public function authorizeShouldThrowException(SepaDirectDebit $directDebit) + public function authorizeShouldThrowException() { + /** @var SepaDirectDebit $sdd */ + $sdd = (new SepaDirectDebit('DE89370400440532013000'))->setHolder('Max Mustermann')->setBic('COBADEFFXXX'); + $sdd = $this->heidelpay->createPaymentType($sdd); $this->expectException(HeidelpayApiException::class); $this->expectExceptionCode(ApiResponseCodes::API_ERROR_TRANSACTION_AUTHORIZE_NOT_ALLOWED); - $this->heidelpay->authorize(1.0, 'EUR', $directDebit, self::RETURN_URL); + $this->heidelpay->authorize(1.0, 'EUR', $sdd, self::RETURN_URL); } /** * @test * - * @param SepaDirectDebit $directDebit - * - * @return Charge - * * @throws HeidelpayApiException * @throws RuntimeException - * @depends sepaDirectDebitShouldBeCreatable */ - public function directDebitShouldBeChargeable(SepaDirectDebit $directDebit): Charge + public function directDebitShouldBeChargeable() { - $charge = $directDebit->charge(100.0, 'EUR', self::RETURN_URL); + /** @var SepaDirectDebit $sdd */ + $sdd = (new SepaDirectDebit('DE89370400440532013000'))->setHolder('Max Mustermann')->setBic('COBADEFFXXX'); + $sdd = $this->heidelpay->createPaymentType($sdd); + $charge = $sdd->charge(100.0, 'EUR', self::RETURN_URL); $this->assertNotNull($charge); $this->assertNotNull($charge->getId()); - - return $charge; } /** @@ -126,15 +115,20 @@ public function directDebitShouldBeChargeable(SepaDirectDebit $directDebit): Cha * * @test * - * @param Charge $charge - * * @throws HeidelpayApiException * @throws RuntimeException - * @depends directDebitShouldBeChargeable */ - public function directDebitChargeShouldBeRefundable(Charge $charge) + public function directDebitChargeShouldBeRefundable() { + /** @var SepaDirectDebit $sdd */ + $sdd = (new SepaDirectDebit('DE89370400440532013000'))->setHolder('Max Mustermann')->setBic('COBADEFFXXX'); + $sdd = $this->heidelpay->createPaymentType($sdd); + $charge = $sdd->charge(100.0, 'EUR', self::RETURN_URL); + + // when $cancellation = $charge->cancel(); + + // then $this->assertNotNull($cancellation); $this->assertNotNull($cancellation->getId()); } From 191edb066caff817bf293a20bf2c1d207454ed01 Mon Sep 17 00:00:00 2001 From: sixer1182 Date: Wed, 20 Nov 2019 14:55:48 +0100 Subject: [PATCH 004/101] [change] (PHPLIB-263) P24: Update changelog and version. --- CHANGELOG.md | 9 +++++++++ src/Heidelpay.php | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 68818ee4..b181bd0a 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,14 @@ 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.6.0][1.2.6.0] + +### Added +* Example for Payment Type `Przelewy24`. + +### Fixed +* Several minor issues. + ## [1.2.5.0][1.2.5.0] ### Added @@ -332,3 +340,4 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a [1.2.3.0]: https://github.com/heidelpay/heidelpayPHP/compare/1.2.2.0..1.2.3.0 [1.2.4.0]: https://github.com/heidelpay/heidelpayPHP/compare/1.2.3.0..1.2.4.0 [1.2.5.0]: https://github.com/heidelpay/heidelpayPHP/compare/1.2.4.0..1.2.5.0 +[1.2.6.0]: https://github.com/heidelpay/heidelpayPHP/compare/1.2.5.0..1.2.6.0 diff --git a/src/Heidelpay.php b/src/Heidelpay.php index 9eb65262..cebd5e53 100755 --- a/src/Heidelpay.php +++ b/src/Heidelpay.php @@ -58,7 +58,7 @@ class Heidelpay implements HeidelpayParentInterface const BASE_URL = 'api.heidelpay.com'; const API_VERSION = 'v1'; const SDK_TYPE = 'HeidelpayPHP'; - const SDK_VERSION = '1.2.5.0'; + const SDK_VERSION = '1.2.6.0'; /** @var string $key */ private $key; From 1165de1a2bbb199e365e14a92f29c37c45a35642 Mon Sep 17 00:00:00 2001 From: sixer1182 Date: Wed, 20 Nov 2019 16:00:41 +0100 Subject: [PATCH 005/101] [change] (PHPLIB-XX) Refactor travis tests. --- .travis.yml | 43 ++++++++++++++++++++++-------------- test/script/travis_script.sh | 9 +++++--- 2 files changed, 33 insertions(+), 19 deletions(-) diff --git a/.travis.yml b/.travis.yml index 8887420a..942207f5 100755 --- a/.travis.yml +++ b/.travis.yml @@ -3,22 +3,33 @@ dist: trusty matrix: fast_finish: true include: - - php: 7.0 - env: deps=no - - php: 7.0 - env: deps=high - - php: 7.1 - env: deps=no - - php: 7.1 - env: deps=high - - php: 7.2 - env: deps=no - - php: 7.2 - env: deps=high - - php: 7.3 - env: deps=no - - php: 7.3 - env: deps=high + - 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.1 (install) - unit" + php: 7.1 + env: deps=no;level=unit + - name: "php 7.1 (update) - unit" + php: 7.1 + env: deps=high;level=unit + - 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.3 (install) - integration" + php: 7.3 + env: deps=high;level=integration cache: directories: - $HOME/.composer/cache diff --git a/test/script/travis_script.sh b/test/script/travis_script.sh index c58ec72e..62f99fd6 100755 --- a/test/script/travis_script.sh +++ b/test/script/travis_script.sh @@ -10,10 +10,13 @@ trap '>&2 echo Error: Command \`$BASH_COMMAND\` on line $LINENO failed with exit mv ~/.phpenv/versions/$(phpenv version-name)/xdebug.ini.bak ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/xdebug.ini ## run the tests -./vendor/bin/phpunit test/unit --coverage-clover build/coverage/xml +if [[ ("$level" == "unit") ]]; then + echo "Perform unit tests only"; + ./vendor/bin/phpunit test/unit --coverage-clover build/coverage/xml +fi ## perform this task only for php 7 with deps=no -if [[ ($(phpenv version-name) == "7.0") && ("$deps" == "no") ]]; then - echo "Perform integration tests"; +if [[ ("$level" == "integration") ]]; then + echo "Perform integration tests only"; ./vendor/bin/phpunit test/integration fi From 634d17db6ea76bf972607bf35f785b384bfd0998 Mon Sep 17 00:00:00 2001 From: sixer1182 Date: Wed, 20 Nov 2019 19:59:59 +0100 Subject: [PATCH 006/101] [change] (PHPLIB-XX) Refactor travis tests. --- test/script/travis_script.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test/script/travis_script.sh b/test/script/travis_script.sh index 62f99fd6..8c738bac 100755 --- a/test/script/travis_script.sh +++ b/test/script/travis_script.sh @@ -9,14 +9,14 @@ trap '>&2 echo Error: Command \`$BASH_COMMAND\` on line $LINENO failed with exit ## enable xdebug again mv ~/.phpenv/versions/$(phpenv version-name)/xdebug.ini.bak ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/xdebug.ini -## run the tests -if [[ ("$level" == "unit") ]]; then +## run the unit tests +if [ "$level" == "unit" ]; then echo "Perform unit tests only"; ./vendor/bin/phpunit test/unit --coverage-clover build/coverage/xml fi -## perform this task only for php 7 with deps=no -if [[ ("$level" == "integration") ]]; then +## run the integration tests +if [ "$level" == "integration" ]; then echo "Perform integration tests only"; ./vendor/bin/phpunit test/integration fi From 568c9758673fc29cc9730c80388be786595511f5 Mon Sep 17 00:00:00 2001 From: sixer1182 Date: Wed, 20 Nov 2019 20:01:23 +0100 Subject: [PATCH 007/101] [change] (PHPLIB-XX) Refactor travis tests. --- test/script/travis_script.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/test/script/travis_script.sh b/test/script/travis_script.sh index 8c738bac..74e09ba4 100755 --- a/test/script/travis_script.sh +++ b/test/script/travis_script.sh @@ -9,6 +9,9 @@ trap '>&2 echo Error: Command \`$BASH_COMMAND\` on line $LINENO failed with exit ## enable xdebug again mv ~/.phpenv/versions/$(phpenv version-name)/xdebug.ini.bak ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/xdebug.ini +echo "Env Dev: $dev"; +echo "Env Level: $level"; + ## run the unit tests if [ "$level" == "unit" ]; then echo "Perform unit tests only"; From d6bafbcdf37cab2bedbc829f55b8a09374da517b Mon Sep 17 00:00:00 2001 From: sixer1182 Date: Wed, 20 Nov 2019 20:05:48 +0100 Subject: [PATCH 008/101] [change] (PHPLIB-XX) Refactor travis tests. --- test/script/travis_script.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/script/travis_script.sh b/test/script/travis_script.sh index 74e09ba4..1d3d49c2 100755 --- a/test/script/travis_script.sh +++ b/test/script/travis_script.sh @@ -9,7 +9,7 @@ trap '>&2 echo Error: Command \`$BASH_COMMAND\` on line $LINENO failed with exit ## enable xdebug again mv ~/.phpenv/versions/$(phpenv version-name)/xdebug.ini.bak ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/xdebug.ini -echo "Env Dev: $dev"; +echo "Env Dev: $deps"; echo "Env Level: $level"; ## run the unit tests From 1431c0b899b791f2d614c775bb82cc37d7bd2da7 Mon Sep 17 00:00:00 2001 From: sixer1182 Date: Wed, 20 Nov 2019 20:10:13 +0100 Subject: [PATCH 009/101] [change] (PHPLIB-XX) Refactor travis tests. --- .travis.yml | 36 +++++++++++++++++++++++++++--------- 1 file changed, 27 insertions(+), 9 deletions(-) diff --git a/.travis.yml b/.travis.yml index 942207f5..679bafbc 100755 --- a/.travis.yml +++ b/.travis.yml @@ -5,31 +5,49 @@ matrix: include: - name: "php 7.0 (install) - unit" php: 7.0 - env: deps=no;level=unit + env: + - deps=no + - level=unit - name: "php 7.0 (update) - unit" php: 7.0 - env: deps=high;level=unit + env: + - deps=high + - level=unit - name: "php 7.1 (install) - unit" php: 7.1 - env: deps=no;level=unit + env: + - deps=no + - level=unit - name: "php 7.1 (update) - unit" php: 7.1 - env: deps=high;level=unit + env: + - deps=high + - level=unit - name: "php 7.2 (install) - unit" php: 7.2 - env: deps=no;level=unit + env: + - deps=no + - level=unit - name: "php 7.2 (update) - unit" php: 7.2 - env: deps=high;level=unit + env: + - deps=high + - level=unit - name: "php 7.3 (install) - unit" php: 7.3 - env: deps=no;level=unit + env: + - deps=no + - level=unit - name: "php 7.3 (update) - unit" php: 7.3 - env: deps=high;level=unit + env: + - deps=high + - level=unit - name: "php 7.3 (install) - integration" php: 7.3 - env: deps=high;level=integration + env: + - deps=high + - level=integration cache: directories: - $HOME/.composer/cache From 2aa4fb4bf4b925af64a8e1adbe6058d497771420 Mon Sep 17 00:00:00 2001 From: sixer1182 Date: Wed, 20 Nov 2019 20:26:08 +0100 Subject: [PATCH 010/101] [change] (PHPLIB-XX) Refactor travis tests. --- .travis.yml | 36 +++++++++++++++++------------------ test/script/travis_install.sh | 4 ++-- test/script/travis_script.sh | 8 ++++---- 3 files changed, 24 insertions(+), 24 deletions(-) diff --git a/.travis.yml b/.travis.yml index 679bafbc..3f1ac754 100755 --- a/.travis.yml +++ b/.travis.yml @@ -6,48 +6,48 @@ matrix: - name: "php 7.0 (install) - unit" php: 7.0 env: - - deps=no - - level=unit + - DEPS="NO" + - LEVEL="UNIT" - name: "php 7.0 (update) - unit" php: 7.0 env: - - deps=high - - level=unit + - DEPS="HIGH" + - LEVEL="UNIT" - name: "php 7.1 (install) - unit" php: 7.1 env: - - deps=no - - level=unit + - DEPS="NO" + - LEVEL="UNIT" - name: "php 7.1 (update) - unit" php: 7.1 env: - - deps=high - - level=unit + - DEPS="HIGH" + - LEVEL="UNIT" - name: "php 7.2 (install) - unit" php: 7.2 env: - - deps=no - - level=unit + - DEPS="NO" + - LEVEL="UNIT" - name: "php 7.2 (update) - unit" php: 7.2 env: - - deps=high - - level=unit + - DEPS="HIGH" + - LEVEL="UNIT" - name: "php 7.3 (install) - unit" php: 7.3 env: - - deps=no - - level=unit + - DEPS="NO" + - LEVEL="UNIT" - name: "php 7.3 (update) - unit" php: 7.3 env: - - deps=high - - level=unit + - DEPS="HIGH" + - LEVEL="UNIT" - name: "php 7.3 (install) - integration" php: 7.3 env: - - deps=high - - level=integration + - DEPS="HIGH" + - LEVEL=integration cache: directories: - $HOME/.composer/cache diff --git a/test/script/travis_install.sh b/test/script/travis_install.sh index be5ea772..f77c44e7 100755 --- a/test/script/travis_install.sh +++ b/test/script/travis_install.sh @@ -7,10 +7,10 @@ PHPVER=$(phpenv version-name) INSTALL_COMMAND="composer install --no-interaction --prefer-dist" UPDATE_COMMAND="composer update --no-interaction --prefer-source" -if [ "$deps" == "no" ]; then +if [ "$DEPS" == "NO" ]; then ${INSTALL_COMMAND} fi -if [ "$deps" == "high" ]; then +if [ "$DEPS" == "HIGH" ]; then ${UPDATE_COMMAND} fi diff --git a/test/script/travis_script.sh b/test/script/travis_script.sh index 1d3d49c2..6f10eb4a 100755 --- a/test/script/travis_script.sh +++ b/test/script/travis_script.sh @@ -9,17 +9,17 @@ trap '>&2 echo Error: Command \`$BASH_COMMAND\` on line $LINENO failed with exit ## enable xdebug again mv ~/.phpenv/versions/$(phpenv version-name)/xdebug.ini.bak ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/xdebug.ini -echo "Env Dev: $deps"; -echo "Env Level: $level"; +echo "$DEPS"; +echo "$LEVEL"; ## run the unit tests -if [ "$level" == "unit" ]; then +if [ "$LEVEL" == "UNIT" ]; then echo "Perform unit tests only"; ./vendor/bin/phpunit test/unit --coverage-clover build/coverage/xml fi ## run the integration tests -if [ "$level" == "integration" ]; then +if [ "$LEVEL" == "INTEGRATION" ]; then echo "Perform integration tests only"; ./vendor/bin/phpunit test/integration fi From 1b5506e67f310d9b7de655017c5ce7e00992a527 Mon Sep 17 00:00:00 2001 From: sixer1182 Date: Wed, 20 Nov 2019 20:36:42 +0100 Subject: [PATCH 011/101] [change] (PHPLIB-XX) Refactor travis tests. --- .travis.yml | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/.travis.yml b/.travis.yml index 3f1ac754..04d36f62 100755 --- a/.travis.yml +++ b/.travis.yml @@ -6,48 +6,48 @@ matrix: - name: "php 7.0 (install) - unit" php: 7.0 env: - - DEPS="NO" - - LEVEL="UNIT" + - DEPS=NO + - LEVEL=UNIT - name: "php 7.0 (update) - unit" php: 7.0 env: - - DEPS="HIGH" - - LEVEL="UNIT" + - DEPS=HIGH + - LEVEL=UNIT - name: "php 7.1 (install) - unit" php: 7.1 env: - - DEPS="NO" - - LEVEL="UNIT" + - DEPS=NO + - LEVEL=UNIT - name: "php 7.1 (update) - unit" php: 7.1 env: - - DEPS="HIGH" - - LEVEL="UNIT" + - DEPS=HIGH + - LEVEL=UNIT - name: "php 7.2 (install) - unit" php: 7.2 env: - - DEPS="NO" - - LEVEL="UNIT" + - DEPS=NO + - LEVEL=UNIT - name: "php 7.2 (update) - unit" php: 7.2 env: - - DEPS="HIGH" - - LEVEL="UNIT" + - DEPS=HIGH + - LEVEL=UNIT - name: "php 7.3 (install) - unit" php: 7.3 env: - - DEPS="NO" - - LEVEL="UNIT" + - DEPS=NO + - LEVEL=UNIT - name: "php 7.3 (update) - unit" php: 7.3 env: - - DEPS="HIGH" - - LEVEL="UNIT" + - DEPS=HIGH + - LEVEL=UNIT - name: "php 7.3 (install) - integration" php: 7.3 env: - - DEPS="HIGH" - - LEVEL=integration + - DEPS=HIGH + - LEVEL=INTEGRATION cache: directories: - $HOME/.composer/cache From 88acae0e6ea204a560e7b0b49d36ba450b69a42f Mon Sep 17 00:00:00 2001 From: sixer1182 Date: Wed, 20 Nov 2019 20:44:14 +0100 Subject: [PATCH 012/101] [change] (PHPLIB-XX) Refactor travis tests. --- test/script/travis_script.sh | 3 --- 1 file changed, 3 deletions(-) diff --git a/test/script/travis_script.sh b/test/script/travis_script.sh index 6f10eb4a..3170b704 100755 --- a/test/script/travis_script.sh +++ b/test/script/travis_script.sh @@ -9,9 +9,6 @@ trap '>&2 echo Error: Command \`$BASH_COMMAND\` on line $LINENO failed with exit ## enable xdebug again mv ~/.phpenv/versions/$(phpenv version-name)/xdebug.ini.bak ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/xdebug.ini -echo "$DEPS"; -echo "$LEVEL"; - ## run the unit tests if [ "$LEVEL" == "UNIT" ]; then echo "Perform unit tests only"; From 109f1a149aaf6b6fe2d66a3ee4dc7272941688cf Mon Sep 17 00:00:00 2001 From: sixer1182 Date: Thu, 21 Nov 2019 08:28:42 +0100 Subject: [PATCH 013/101] [change] (PHPLIB-263) P24: Fix example. --- examples/Przelewy24/Controller.php | 2 +- examples/Przelewy24/index.php | 3 --- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/examples/Przelewy24/Controller.php b/examples/Przelewy24/Controller.php index 4a3ab778..8b43020d 100644 --- a/examples/Przelewy24/Controller.php +++ b/examples/Przelewy24/Controller.php @@ -66,7 +66,7 @@ function redirect($url, $merchantMessage = '', $clientMessage = '') // Create a charge to get the redirectUrl. $customer = CustomerFactory::createCustomer('Max', 'Mustermann'); - $charge = $heidelpay->charge(12.99, 'EUR', $paymentTypeId, RETURN_CONTROLLER_URL, $customer); + $charge = $heidelpay->charge(12.99, 'PLN', $paymentTypeId, RETURN_CONTROLLER_URL, $customer); // You'll need to remember the paymentId for later in the ReturnController $_SESSION['PaymentId'] = $charge->getPaymentId(); diff --git a/examples/Przelewy24/index.php b/examples/Przelewy24/index.php index eef98794..711a42e3 100644 --- a/examples/Przelewy24/index.php +++ b/examples/Przelewy24/index.php @@ -61,9 +61,6 @@ // Create an Przelewy24 instance and render the iDeal form let p24 = heidelpayInstance.Przelewy24(); - p24.create('Przelewy24', { - containerId: 'example-przelewy24' - }); // Handling payment form submission let form = document.getElementById('payment-form'); From 84996d31628936d41d7169846f8616818f342935 Mon Sep 17 00:00:00 2001 From: sixer1182 Date: Mon, 25 Nov 2019 09:15:19 +0100 Subject: [PATCH 014/101] [refactor] (PHPLIB-273) Refactor tests. --- test/unit/Services/PaymentServiceTest.php | 144 +++++----------------- 1 file changed, 29 insertions(+), 115 deletions(-) diff --git a/test/unit/Services/PaymentServiceTest.php b/test/unit/Services/PaymentServiceTest.php index c515ad97..96f049b6 100755 --- a/test/unit/Services/PaymentServiceTest.php +++ b/test/unit/Services/PaymentServiceTest.php @@ -99,23 +99,13 @@ public function authorizeShouldCreatePaymentAndCallAuthorizeWithPayment() $customer = (new Customer())->setId('customerId'); $metadata = (new Metadata())->setId('metadataId'); - $paymentSrvMock = $this->getMockBuilder(PaymentService::class)->disableOriginalConstructor()->setMethods( - ['authorizeWithPayment'] - )->getMock(); + $paymentSrvMock = $this->getMockBuilder(PaymentService::class)->disableOriginalConstructor()->setMethods(['authorizeWithPayment'])->getMock(); $paymentSrvMock->expects($this->exactly(4))->method('authorizeWithPayment') ->withConsecutive( [1.23, 'testCurrency', $this->isInstanceOf(Payment::class), 'http://return.url'], [1.23, 'testCurrency', $this->isInstanceOf(Payment::class), 'http://return.url', $customer], [1.23, 'testCurrency', $this->isInstanceOf(Payment::class), 'http://return.url', $customer, $metadata], - [ - 1.23, - 'testCurrency', - $this->isInstanceOf(Payment::class), - 'http://return.url', - $customer, - $metadata, - 'OrderId' - ] + [1.23, 'testCurrency', $this->isInstanceOf(Payment::class), 'http://return.url', $customer, $metadata, 'OrderId'] ); /** @var PaymentService $paymentSrvMock */ @@ -123,15 +113,7 @@ public function authorizeShouldCreatePaymentAndCallAuthorizeWithPayment() $paymentSrvMock->authorize(1.23, 'testCurrency', $paymentType, 'http://return.url'); $paymentSrvMock->authorize(1.23, 'testCurrency', $paymentType, 'http://return.url', $customer); $paymentSrvMock->authorize(1.23, 'testCurrency', $paymentType, 'http://return.url', $customer, $metadata); - $paymentSrvMock->authorize( - 1.23, - 'testCurrency', - $paymentType, - 'http://return.url', - $customer, - $metadata, - 'OrderId' - ); + $paymentSrvMock->authorize(1.23, 'testCurrency', $paymentType, 'http://return.url', $customer, $metadata, 'OrderId'); } /** @@ -154,9 +136,7 @@ public function authorizeWithPaymentShouldCallCreateOnResourceServiceWithANewAut $heidelpay = new Heidelpay('s-priv-123'); $payment = (new Payment())->setParentResource($heidelpay)->setId('myPaymentId'); - $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->disableOriginalConstructor()->setMethods( - ['create'] - )->getMock(); + $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->disableOriginalConstructor()->setMethods(['create'])->getMock(); $resourceSrvMock->expects($this->once())->method('create')->with( $this->callback( static function ($authorize) use ($customer, $payment, $metadata, $basket, $card3ds) { @@ -180,18 +160,7 @@ static function ($authorize) use ($customer, $payment, $metadata, $basket, $card /** @var ResourceService $resourceSrvMock */ $paymentSrv = (new PaymentService($heidelpay))->setResourceService($resourceSrvMock); - $returnedAuth = - $paymentSrv->authorizeWithPayment( - 1.234, - 'myTestCurrency', - $payment, - 'myTestUrl', - $customer, - 'myOrderId', - $metadata, - $basket, - $card3ds - ); + $returnedAuth = $paymentSrv->authorizeWithPayment(1.234, 'myTestCurrency', $payment, 'myTestUrl', $customer, 'myOrderId', $metadata, $basket, $card3ds); $this->assertSame($payment->getAuthorization(), $returnedAuth); } @@ -219,8 +188,7 @@ public function chargeShouldCreateAPaymentAndCallCreateOnResourceServiceWithPaym $metadata = (new Metadata())->setId('myMetadataId'); $basket = (new Basket())->setId('myBasketId'); - $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->disableOriginalConstructor() - ->setMethods(['create'])->getMock(); + $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->disableOriginalConstructor()->setMethods(['create'])->getMock(); $resourceSrvMock->expects($this->once())->method('create')->with( $this->callback( static function ($charge) use ($customer, $paymentType, $basket, $card3ds) { @@ -228,9 +196,9 @@ static function ($charge) use ($customer, $paymentType, $basket, $card3ds) { $newPayment = $charge->getPayment(); return $charge instanceof Charge && $charge->getAmount() === 1.234 && - $charge->getCurrency() === 'myTestCurrency' && - $charge->getOrderId() === 'myOrderId' && - $charge->getReturnUrl() === 'myTestUrl' && + $charge->getCurrency() === 'myCurrency' && + $charge->getOrderId() === 'myId' && + $charge->getReturnUrl() === 'myUrl' && $charge->isCard3ds() === $card3ds && $newPayment instanceof Payment && $newPayment->getCustomer() === $customer && @@ -243,17 +211,7 @@ static function ($charge) use ($customer, $paymentType, $basket, $card3ds) { /** @var ResourceService $resourceSrvMock */ $paymentSrv = (new PaymentService($heidelpay))->setResourceService($resourceSrvMock); - $returnedCharge = $paymentSrv->charge( - 1.234, - 'myTestCurrency', - $paymentType, - 'myTestUrl', - $customer, - 'myOrderId', - $metadata, - $basket, - $card3ds - ); + $returnedCharge = $paymentSrv->charge(1.234, 'myCurrency', $paymentType, 'myUrl', $customer, 'myId', $metadata, $basket, $card3ds); $this->assertSame($paymentType, $returnedCharge->getPayment()->getPaymentType()); } @@ -269,10 +227,8 @@ static function ($charge) use ($customer, $paymentType, $basket, $card3ds) { public function chargeAuthorizationShouldCallChargePaymentWithTheGivenPaymentObject() { $paymentObject = (new Payment())->setId('myPaymentId'); - $paymentSrv = $this->getMockBuilder(PaymentService::class)->setMethods(['chargePayment']) - ->disableOriginalConstructor()->getMock(); - $paymentSrv->expects($this->exactly(2))->method('chargePayment') - ->withConsecutive([$paymentObject, null], [$paymentObject, 1.234]); + $paymentSrv = $this->getMockBuilder(PaymentService::class)->setMethods(['chargePayment'])->disableOriginalConstructor()->getMock(); + $paymentSrv->expects($this->exactly(2))->method('chargePayment')->withConsecutive([$paymentObject, null], [$paymentObject, 1.234]); /** @var PaymentService $paymentSrv */ $paymentSrv->setResourceService(new ResourceService(new Heidelpay('s-priv-123'))); @@ -292,12 +248,10 @@ public function chargeAuthorizationShouldCallChargePaymentWithTheGivenPaymentObj */ public function chargeAuthorizationShouldCallFetchPaymentIfThePaymentIsPassedAsIdString() { - $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->setMethods(['fetchPayment']) - ->disableOriginalConstructor()->getMock(); + $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->setMethods(['fetchPayment'])->disableOriginalConstructor()->getMock(); $resourceSrvMock->expects($this->once())->method('fetchPayment')->willReturn(new Payment()); - $paymentSrvMock = $this->getMockBuilder(PaymentService::class)->setMethods(['chargePayment']) - ->disableOriginalConstructor()->getMock(); + $paymentSrvMock = $this->getMockBuilder(PaymentService::class)->setMethods(['chargePayment'])->disableOriginalConstructor()->getMock(); $paymentSrvMock->expects($this->once())->method('chargePayment')->withAnyParameters(); /** @@ -322,8 +276,7 @@ public function chargePaymentShouldCallCreateOnResourceServiceWithNewCharge() $heidelpay = new Heidelpay('s-priv-123'); $payment = (new Payment())->setParentResource($heidelpay)->setId('myPaymentId'); - $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->disableOriginalConstructor() - ->setMethods(['create'])->getMock(); + $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->disableOriginalConstructor()->setMethods(['create'])->getMock(); $resourceSrvMock->expects($this->once())->method('create')->with( $this->callback( static function ($charge) use ($payment) { @@ -364,8 +317,7 @@ public function cancelAuthorizationShouldCallCreateOnResourceServiceWithNewCance $payment = (new Payment())->setParentResource($heidelpay)->setId('myPaymentId'); $authorization = (new Authorization())->setPayment($payment)->setId('s-aut-1'); - $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->disableOriginalConstructor() - ->setMethods(['create'])->getMock(); + $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->disableOriginalConstructor()->setMethods(['create'])->getMock(); $resourceSrvMock->expects($this->once())->method('create')->with( $this->callback( static function ($cancellation) use ($authorization, $payment) { @@ -399,12 +351,10 @@ public function cancelAuthorizationByPaymentShouldCallCancelAuthorization() { $authorization = (new Authorization())->setId('s-aut-1'); - $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->setMethods(['fetchAuthorization']) - ->disableOriginalConstructor()->getMock(); + $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->setMethods(['fetchAuthorization'])->disableOriginalConstructor()->getMock(); $resourceSrvMock->expects($this->exactly(2))->method('fetchAuthorization')->willReturn($authorization); - $paymentSrvMock = $this->getMockBuilder(PaymentService::class)->setMethods(['cancelAuthorization']) - ->disableOriginalConstructor()->getMock(); + $paymentSrvMock = $this->getMockBuilder(PaymentService::class)->setMethods(['cancelAuthorization'])->disableOriginalConstructor()->getMock(); $paymentSrvMock->expects($this->exactly(2))->method('cancelAuthorization')->withConsecutive( [$authorization, null], [$authorization, 1.123] @@ -435,13 +385,10 @@ public function cancelChargeByIdShouldFetchChargeAndPropagateToCancelCharge() $payment = (new Payment())->setId('myPaymentId'); $charge = new Charge(); - $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->setMethods(['fetchChargeById']) - ->disableOriginalConstructor()->getMock(); - $resourceSrvMock->expects($this->exactly(2))->method('fetchChargeById')->with($payment, 's-chg-1') - ->willReturn($charge); + $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->setMethods(['fetchChargeById'])->disableOriginalConstructor()->getMock(); + $resourceSrvMock->expects($this->exactly(2))->method('fetchChargeById')->with($payment, 's-chg-1')->willReturn($charge); - $paymentSrvMock = $this->getMockBuilder(PaymentService::class)->setMethods(['cancelCharge']) - ->disableOriginalConstructor()->getMock(); + $paymentSrvMock = $this->getMockBuilder(PaymentService::class)->setMethods(['cancelCharge'])->disableOriginalConstructor()->getMock(); $paymentSrvMock->expects($this->exactly(2))->method('cancelCharge')->withConsecutive( [$charge], [$charge, 10.11] @@ -473,8 +420,7 @@ public function cancelChargeShouldCreateCancellationAndCallsCreate() $payment = (new Payment())->setParentResource($heidelpay); $charge = (new Charge())->setPayment($payment); - $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->setMethods(['create']) - ->disableOriginalConstructor()->getMock(); + $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->setMethods(['create'])->disableOriginalConstructor()->getMock(); $resourceSrvMock->expects($this->once())->method('create')->with( $this->callback( static function ($cancellation) use ($payment, $charge) { @@ -511,8 +457,7 @@ public function shipShouldCreateShipmentAndCallCreateOnResourceServiceWithIt() $paymentSrv = new PaymentService($heidelpay); $payment = new Payment(); - $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->setMethods(['create', 'fetchPayment']) - ->disableOriginalConstructor()->getMock(); + $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->setMethods(['create', 'fetchPayment'])->disableOriginalConstructor()->getMock(); $resourceSrvMock->expects($this->exactly(2))->method('create')->with( $this->callback( static function ($shipment) use ($payment) { @@ -552,23 +497,13 @@ public function payoutShouldCreatePaymentAndCallPayoutWithPayment() $customer = (new Customer())->setId('customerId'); $metadata = (new Metadata())->setId('metadataId'); - $paymentSrvMock = $this->getMockBuilder(PaymentService::class)->disableOriginalConstructor()->setMethods( - ['payoutWithPayment'] - )->getMock(); + $paymentSrvMock = $this->getMockBuilder(PaymentService::class)->disableOriginalConstructor()->setMethods(['payoutWithPayment'])->getMock(); $paymentSrvMock->expects($this->exactly(4))->method('payoutWithPayment') ->withConsecutive( [1.23, 'testCurrency', $this->isInstanceOf(Payment::class), 'http://return.url'], [1.23, 'testCurrency', $this->isInstanceOf(Payment::class), 'http://return.url', $customer], [1.23, 'testCurrency', $this->isInstanceOf(Payment::class), 'http://return.url', $customer, $metadata], - [ - 1.23, - 'testCurrency', - $this->isInstanceOf(Payment::class), - 'http://return.url', - $customer, - $metadata, - 'OrderId' - ] + [1.23, 'testCurrency', $this->isInstanceOf(Payment::class), 'http://return.url', $customer, $metadata, 'OrderId'] ); /** @var PaymentService $paymentSrvMock */ @@ -576,15 +511,7 @@ public function payoutShouldCreatePaymentAndCallPayoutWithPayment() $paymentSrvMock->payout(1.23, 'testCurrency', $paymentType, 'http://return.url'); $paymentSrvMock->payout(1.23, 'testCurrency', $paymentType, 'http://return.url', $customer); $paymentSrvMock->payout(1.23, 'testCurrency', $paymentType, 'http://return.url', $customer, $metadata); - $paymentSrvMock->payout( - 1.23, - 'testCurrency', - $paymentType, - 'http://return.url', - $customer, - $metadata, - 'OrderId' - ); + $paymentSrvMock->payout(1.23, 'testCurrency', $paymentType, 'http://return.url', $customer, $metadata, 'OrderId'); } /** @@ -605,9 +532,7 @@ public function payoutWithPaymentShouldCallCreateOnResourceServiceWithANewPayout $heidelpay = new Heidelpay('s-priv-123'); $payment = (new Payment())->setParentResource($heidelpay)->setId('myPaymentId'); - $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->disableOriginalConstructor()->setMethods( - ['create'] - )->getMock(); + $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->disableOriginalConstructor()->setMethods(['create'])->getMock(); $resourceSrvMock->expects($this->once())->method('create')->with( $this->callback( static function ($payout) use ($customer, $payment, $basket, $metadata) { @@ -630,16 +555,7 @@ static function ($payout) use ($customer, $payment, $basket, $metadata) { /** @var ResourceService $resourceSrvMock */ $paymentSrv = (new PaymentService($heidelpay))->setResourceService($resourceSrvMock); - $returnedPayout = $paymentSrv->payoutWithPayment( - 1.234, - 'myTestCurrency', - $payment, - 'myTestUrl', - $customer, - 'myOrderId', - $metadata, - $basket - ); + $returnedPayout = $paymentSrv->payoutWithPayment(1.234, 'myTestCurrency', $payment, 'myTestUrl', $customer, 'myOrderId', $metadata, $basket); $this->assertSame($payment->getPayout(), $returnedPayout); } @@ -665,9 +581,7 @@ static function ($payout) use ($customer, $payment, $basket, $metadata) { public function paymentShouldBeCreatedByInitPayPage(string $action) { /** @var ResourceService|MockObject $resourceSrvMock */ - $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->setMethods( - ['create'] - )->disableOriginalConstructor()->getMock(); + $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->setMethods(['create'])->disableOriginalConstructor()->getMock(); $paymentSrv = (new PaymentService(new Heidelpay('s-priv-1234')))->setResourceService($resourceSrvMock); // when From bc48795c637e6f42f2aefa9980996727f4ce73cb Mon Sep 17 00:00:00 2001 From: sixer1182 Date: Mon, 25 Nov 2019 09:40:09 +0100 Subject: [PATCH 015/101] [refactor] (PHPLIB-273) Refactor tests. --- test/unit/Services/ResourceServiceTest.php | 536 +++++++-------------- 1 file changed, 181 insertions(+), 355 deletions(-) diff --git a/test/unit/Services/ResourceServiceTest.php b/test/unit/Services/ResourceServiceTest.php index 54d12eba..9b682825 100755 --- a/test/unit/Services/ResourceServiceTest.php +++ b/test/unit/Services/ResourceServiceTest.php @@ -125,8 +125,7 @@ public function getResourceShouldFetchIfTheResourcesIdIsSetAndItHasNotBeenFetche $resource, $timesFetchIsCalled ) { - $resourceSrv = $this->getMockBuilder(ResourceService::class)->setMethods(['fetch']) - ->disableOriginalConstructor()->getMock(); + $resourceSrv = $this->getMockBuilder(ResourceService::class)->setMethods(['fetch'])->disableOriginalConstructor()->getMock(); $resourceSrv->expects($this->exactly($timesFetchIsCalled))->method('fetch')->with($resource); /** @var ResourceService $resourceSrv */ @@ -148,13 +147,10 @@ public function createShouldCallSendAndThenHandleResponseWithTheResponseData() $response->id = 'myTestId'; $testResource = $this->getMockBuilder(Customer::class)->setMethods(['handleResponse'])->getMock(); - $testResource->expects($this->once())->method('handleResponse') - ->with($response, HttpAdapterInterface::REQUEST_POST); + $testResource->expects($this->once())->method('handleResponse')->with($response, HttpAdapterInterface::REQUEST_POST); - $resourceServiceMock = $this->getMockBuilder(ResourceService::class)->setMethods(['send']) - ->disableOriginalConstructor()->getMock(); - $resourceServiceMock->expects($this->once())->method('send') - ->with($testResource, HttpAdapterInterface::REQUEST_POST)->willReturn($response); + $resourceServiceMock = $this->getMockBuilder(ResourceService::class)->setMethods(['send'])->disableOriginalConstructor()->getMock(); + $resourceServiceMock->expects($this->once())->method('send')->with($testResource, HttpAdapterInterface::REQUEST_POST)->willReturn($response); /** * @var ResourceService $resourceServiceMock @@ -182,10 +178,8 @@ public function createShouldNotHandleResponseWithError() $testResource = $this->getMockBuilder(Customer::class)->setMethods(['handleResponse'])->getMock(); $testResource->expects($this->never())->method('handleResponse'); - $resourceServiceMock = $this->getMockBuilder(ResourceService::class)->setMethods(['send']) - ->disableOriginalConstructor()->getMock(); - $resourceServiceMock->expects($this->once())->method('send') - ->with($testResource, HttpAdapterInterface::REQUEST_POST)->willReturn($response); + $resourceServiceMock = $this->getMockBuilder(ResourceService::class)->setMethods(['send'])->disableOriginalConstructor()->getMock(); + $resourceServiceMock->expects($this->once())->method('send')->with($testResource, HttpAdapterInterface::REQUEST_POST)->willReturn($response); /** * @var ResourceService $resourceServiceMock @@ -209,13 +203,10 @@ public function updateShouldCallSendAndThenHandleResponseWithTheResponseData() $response = new stdClass(); $testResource = $this->getMockBuilder(Customer::class)->setMethods(['handleResponse'])->getMock(); - $testResource->expects($this->once())->method('handleResponse') - ->with($response, HttpAdapterInterface::REQUEST_PUT); + $testResource->expects($this->once())->method('handleResponse')->with($response, HttpAdapterInterface::REQUEST_PUT); - $resourceServiceMock = $this->getMockBuilder(ResourceService::class)->setMethods(['send']) - ->disableOriginalConstructor()->getMock(); - $resourceServiceMock->expects($this->once())->method('send') - ->with($testResource, HttpAdapterInterface::REQUEST_PUT)->willReturn($response); + $resourceServiceMock = $this->getMockBuilder(ResourceService::class)->setMethods(['send'])->disableOriginalConstructor()->getMock(); + $resourceServiceMock->expects($this->once())->method('send')->with($testResource, HttpAdapterInterface::REQUEST_PUT)->willReturn($response); /** * @var ResourceService $resourceServiceMock @@ -241,10 +232,8 @@ public function updateShouldNotHandleResponseWithError() $testResource = $this->getMockBuilder(Customer::class)->setMethods(['handleResponse'])->getMock(); $testResource->expects($this->never())->method('handleResponse'); - $resourceServiceMock = $this->getMockBuilder(ResourceService::class)->setMethods(['send']) - ->disableOriginalConstructor()->getMock(); - $resourceServiceMock->expects($this->once())->method('send') - ->with($testResource, HttpAdapterInterface::REQUEST_PUT)->willReturn($response); + $resourceServiceMock = $this->getMockBuilder(ResourceService::class)->setMethods(['send'])->disableOriginalConstructor()->getMock(); + $resourceServiceMock->expects($this->once())->method('send')->with($testResource, HttpAdapterInterface::REQUEST_PUT)->willReturn($response); /** * @var ResourceService $resourceServiceMock @@ -267,10 +256,8 @@ public function deleteShouldCallSendAndThenSetTheResourceNull() $response = new stdClass(); $testResource = $this->getMockBuilder(Customer::class)->getMock(); - $resourceServiceMock = $this->getMockBuilder(ResourceService::class)->setMethods(['send']) - ->disableOriginalConstructor()->getMock(); - $resourceServiceMock->expects($this->once())->method('send') - ->with($testResource, HttpAdapterInterface::REQUEST_DELETE)->willReturn($response); + $resourceServiceMock = $this->getMockBuilder(ResourceService::class)->setMethods(['send'])->disableOriginalConstructor()->getMock(); + $resourceServiceMock->expects($this->once())->method('send')->with($testResource, HttpAdapterInterface::REQUEST_DELETE)->willReturn($response); /** * @var ResourceService $resourceServiceMock @@ -296,10 +283,8 @@ public function deleteShouldNotDeleteObjectOnResponseWithError() $testResource = $this->getMockBuilder(Customer::class)->getMock(); - $resourceServiceMock = $this->getMockBuilder(ResourceService::class)->setMethods(['send']) - ->disableOriginalConstructor()->getMock(); - $resourceServiceMock->expects($this->once())->method('send') - ->with($testResource, HttpAdapterInterface::REQUEST_DELETE)->willReturn($response); + $resourceServiceMock = $this->getMockBuilder(ResourceService::class)->setMethods(['send'])->disableOriginalConstructor()->getMock(); + $resourceServiceMock->expects($this->once())->method('send')->with($testResource, HttpAdapterInterface::REQUEST_DELETE)->willReturn($response); /** * @var ResourceService $resourceServiceMock @@ -356,8 +341,7 @@ public function fetchPaymentShouldCallFetchWithTheGivenPaymentObject() { $payment = (new Payment())->setId('myPaymentId'); - $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->setMethods(['fetch']) - ->disableOriginalConstructor()->getMock(); + $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->setMethods(['fetch'])->disableOriginalConstructor()->getMock(); $resourceSrvMock->expects($this->once())->method('fetch')->with($payment); /** @var ResourceService $resourceSrvMock */ @@ -377,8 +361,7 @@ public function fetchPaymentShouldCallFetchWithTheGivenPaymentObject() public function fetchPaymentCalledWithIdShouldCreatePaymentObjectWithIdAndCallFetch() { $heidelpay = new Heidelpay('s-priv-1234'); - $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->setMethods(['fetch']) - ->setConstructorArgs([$heidelpay])->getMock(); + $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->setMethods(['fetch'])->setConstructorArgs([$heidelpay])->getMock(); $resourceSrvMock->expects($this->once())->method('fetch') ->with($this->callback( static function ($payment) use ($heidelpay) { @@ -428,13 +411,11 @@ static function ($payment) use ($heidelpay) { public function fetchKeypairShouldCallFetchWithAKeypairObject() { $heidelpay = new Heidelpay('s-priv-1234'); - $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->setMethods(['fetch']) - ->setConstructorArgs([$heidelpay])->getMock(); + $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->setMethods(['fetch'])->setConstructorArgs([$heidelpay])->getMock(); $resourceSrvMock->expects($this->once())->method('fetch') - ->with($this->callback( - static function ($keypair) use ($heidelpay) { - return $keypair instanceof Keypair && $keypair->getHeidelpayObject() === $heidelpay; - })); + ->with($this->callback(static function ($keypair) use ($heidelpay) { + return $keypair instanceof Keypair && $keypair->getHeidelpayObject() === $heidelpay; + })); /** @var ResourceService $resourceSrvMock */ $resourceSrvMock->fetchKeypair(); @@ -454,13 +435,11 @@ public function createPaymentTypeShouldSetHeidelpayObjectAndCallCreate() $heidelpay = new Heidelpay('s-priv-1234'); $paymentType = new Sofort(); - $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->setMethods(['create']) - ->setConstructorArgs([$heidelpay])->getMock(); + $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->setMethods(['create'])->setConstructorArgs([$heidelpay])->getMock(); $resourceSrvMock->expects($this->once())->method('create') - ->with($this->callback( - static function ($type) use ($heidelpay, $paymentType) { - return $type === $paymentType && $type->getHeidelpayObject() === $heidelpay; - })); + ->with($this->callback(static function ($type) use ($heidelpay, $paymentType) { + return $type === $paymentType && $type->getHeidelpayObject() === $heidelpay; + })); /** @var ResourceService $resourceSrvMock */ $returnedType = $resourceSrvMock->createPaymentType($paymentType); @@ -485,16 +464,14 @@ public function fetchPaymentTypeShouldFetchCorrectPaymentInstanceDependingOnId($ { $heidelpay = new Heidelpay('s-priv-1234'); - $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->setMethods(['fetch']) - ->setConstructorArgs([$heidelpay])->getMock(); + $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->setMethods(['fetch'])->setConstructorArgs([$heidelpay])->getMock(); $resourceSrvMock->expects($this->once())->method('fetch') - ->with($this->callback( - static function ($type) use ($heidelpay, $typeClass, $typeId) { - /** @var BasePaymentType $type */ - return $type instanceof $typeClass && - $type->getHeidelpayObject() === $heidelpay && - $type->getId() === $typeId; - })); + ->with($this->callback(static function ($type) use ($heidelpay, $typeClass, $typeId) { + /** @var BasePaymentType $type */ + return $type instanceof $typeClass && + $type->getHeidelpayObject() === $heidelpay && + $type->getId() === $typeId; + })); /** @var ResourceService $resourceSrvMock */ $resourceSrvMock->fetchPaymentType($typeId); @@ -514,8 +491,7 @@ static function ($type) use ($heidelpay, $typeClass, $typeId) { */ public function fetchPaymentTypeShouldThrowExceptionOnInvalidTypeId($typeId) { - $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->setMethods(['fetch']) - ->disableOriginalConstructor()->getMock(); + $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->setMethods(['fetch'])->disableOriginalConstructor()->getMock(); $resourceSrvMock->expects($this->never())->method('fetch'); $this->expectException(RuntimeException::class); @@ -563,13 +539,11 @@ public function createCustomerShouldCallCreateWithCustomerObjectAndSetHeidelpayR $heidelpay = new Heidelpay('s-priv-1234'); $customer = new Customer(); - $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->setMethods(['create']) - ->setConstructorArgs([$heidelpay])->getMock(); + $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->setMethods(['create'])->setConstructorArgs([$heidelpay])->getMock(); $resourceSrvMock->expects($this->once())->method('create') - ->with($this->callback( - static function ($resource) use ($heidelpay, $customer) { - return $resource === $customer && $resource->getHeidelpayObject() === $heidelpay; - })); + ->with($this->callback(static function ($resource) use ($heidelpay, $customer) { + return $resource === $customer && $resource->getHeidelpayObject() === $heidelpay; + })); /** @var ResourceService $resourceSrvMock */ $returnedCustomer = $resourceSrvMock->createCustomer($customer); @@ -600,19 +574,19 @@ public function createOrUpdateCustomerShouldFetchAndUpdateCustomerIfItAlreadyExi $resourceSrvMock->expects($this->once())->method('createCustomer')->with($customer)->willThrowException(new HeidelpayApiException('', '', ApiResponseCodes::API_ERROR_CUSTOMER_ID_ALREADY_EXISTS)); // Expect the customer to be fetched by its customerId if it already exists and has to be updated. - $resourceSrvMock->expects($this->once())->method('fetchCustomerByExtCustomerId')->with($this->callback( - static function ($customerId) use ($customer) { - return $customerId === $customer->getCustomerId(); - }))->willReturn($fetchedCustomer); + $resourceSrvMock->expects($this->once())->method('fetchCustomerByExtCustomerId') + ->with($this->callback(static function ($customerId) use ($customer) { + return $customerId === $customer->getCustomerId(); + }))->willReturn($fetchedCustomer); // Expect the fetched customer is then updated with the new data. - $resourceSrvMock->expects($this->once())->method('updateCustomer')->with($this->callback( - static function ($customerToUpdate) use ($customer) { - /** @var Customer $customerToUpdate */ - return $customerToUpdate === $customer && - $customerToUpdate->getId() === $customer->getId() && - $customerToUpdate->getEmail() === 'customer@email.de'; - })); + $resourceSrvMock->expects($this->once())->method('updateCustomer') + ->with($this->callback(static function ($customerToUpdate) use ($customer) { + /** @var Customer $customerToUpdate */ + return $customerToUpdate === $customer && + $customerToUpdate->getId() === $customer->getId() && + $customerToUpdate->getEmail() === 'customer@email.de'; + })); // Make the call and assertions. /** @var ResourceService $resourceSrvMock */ @@ -636,8 +610,7 @@ public function createOrUpdateCustomerShouldThrowTheExceptionIfItIsNotCustomerId { $customer = (new Customer())->setCustomerId('externalCustomerId')->setEmail('customer@email.de'); - $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->disableOriginalConstructor() - ->setMethods(['createCustomer', 'fetchCustomer', 'updateCustomer'])->getMock(); + $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->disableOriginalConstructor()->setMethods(['createCustomer', 'fetchCustomer', 'updateCustomer'])->getMock(); $exc = new HeidelpayApiException('', '', ApiResponseCodes::API_ERROR_CUSTOMER_ID_REQUIRED); $resourceSrvMock->expects($this->once())->method('createCustomer')->with($customer)->willThrowException($exc); @@ -665,8 +638,7 @@ public function fetchCustomerShouldCallFetchWithTheGivenCustomerAndSetHeidelpayR $heidelpay = new Heidelpay('s-priv-123'); $customer = (new Customer())->setId('myCustomerId'); - $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->setMethods(['fetch']) - ->setConstructorArgs([$heidelpay])->getMock(); + $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->setMethods(['fetch'])->setConstructorArgs([$heidelpay])->getMock(); $resourceSrvMock->expects($this->once())->method('fetch')->with($customer); try { @@ -696,16 +668,13 @@ public function fetchCustomerShouldCallFetchWithNewCustomerObject() { $heidelpay = new Heidelpay('s-priv-123'); - $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->setMethods(['fetch']) - ->setConstructorArgs([$heidelpay])->getMock(); + $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->setMethods(['fetch'])->setConstructorArgs([$heidelpay])->getMock(); $resourceSrvMock->expects($this->once())->method('fetch')->with( - $this->callback( - static function ($param) use ($heidelpay) { - return $param instanceof Customer && - $param->getId() === 'myCustomerId' && - $param->getHeidelpayObject() === $heidelpay; - }) - ); + $this->callback(static function ($param) use ($heidelpay) { + return $param instanceof Customer && + $param->getId() === 'myCustomerId' && + $param->getHeidelpayObject() === $heidelpay; + })); /** @var ResourceService $resourceSrvMock */ $returnedCustomer = $resourceSrvMock->fetchCustomer('myCustomerId'); @@ -726,13 +695,11 @@ public function updateCustomerShouldCallUpdateWithCustomerObject() { $customer = (new Customer())->setId('customerId'); - $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->setMethods(['update']) - ->disableOriginalConstructor()->getMock(); + /** @var ResourceService|MockObject $resourceSrvMock */ + $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->setMethods(['update'])->disableOriginalConstructor()->getMock(); $resourceSrvMock->expects($this->once())->method('update')->with($customer); - /** @var ResourceService $resourceSrvMock */ $returnedCustomer = $resourceSrvMock->updateCustomer($customer); - $this->assertSame($customer, $returnedCustomer); } @@ -749,11 +716,10 @@ public function deleteCustomerShouldCallDeleteWithTheGivenCustomer() { $customer = (new Customer())->setId('customerId'); - $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->setMethods(['delete']) - ->disableOriginalConstructor()->getMock(); + /** @var ResourceService|MockObject $resourceSrvMock */ + $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->setMethods(['delete'])->disableOriginalConstructor()->getMock(); $resourceSrvMock->expects($this->once())->method('delete')->with($customer); - /** @var ResourceService $resourceSrvMock */ $returnedCustomer = $resourceSrvMock->deleteCustomer($customer); $this->assertSame($customer, $returnedCustomer); } @@ -769,8 +735,7 @@ public function deleteCustomerShouldCallDeleteWithTheGivenCustomer() */ public function deleteCustomerShouldFetchCustomerByIdIfTheIdIsGiven() { - $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->setMethods(['delete', 'fetchCustomer']) - ->disableOriginalConstructor()->getMock(); + $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->setMethods(['delete', 'fetchCustomer'])->disableOriginalConstructor()->getMock(); $customer = CustomerFactory::createCustomer('Max', 'Mustermann'); $resourceSrvMock->expects($this->once())->method('fetchCustomer')->with('myCustomerId')->willReturn($customer); $resourceSrvMock->expects($this->once())->method('delete')->with($customer); @@ -791,16 +756,16 @@ public function deleteCustomerShouldFetchCustomerByIdIfTheIdIsGiven() */ public function fetchAuthorizationShouldFetchPaymentAndReturnItsAuthorization() { - $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->setMethods(['fetchPayment', 'fetch']) - ->disableOriginalConstructor()->getMock(); + $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->setMethods(['fetchPayment', 'fetch'])->disableOriginalConstructor()->getMock(); $paymentMock = $this->getMockBuilder(Payment::class)->setMethods(['getAuthorization'])->getMock(); $authorize = (new Authorization())->setId('s-aut-1'); + + /** @var ResourceService|MockObject $resourceSrvMock */ $resourceSrvMock->expects($this->once())->method('fetchPayment')->with($paymentMock)->willReturn($paymentMock); $paymentMock->expects($this->once())->method('getAuthorization')->willReturn($authorize); $resourceSrvMock->expects($this->once())->method('fetch')->with($authorize)->willReturn($authorize); - /** @var ResourceService $resourceSrvMock */ $returnedAuthorize = $resourceSrvMock->fetchAuthorization($paymentMock); $this->assertSame($authorize, $returnedAuthorize); } @@ -840,16 +805,16 @@ public function fetchPayoutShouldFetchPaymentAndReturnItsPayout() */ public function fetchChargeByIdShouldFetchPaymentAndReturnTheChargeOfThePayment() { - $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->setMethods(['fetchPayment', 'fetch']) - ->disableOriginalConstructor()->getMock(); + $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->setMethods(['fetchPayment', 'fetch'])->disableOriginalConstructor()->getMock(); $paymentMock = $this->getMockBuilder(Payment::class)->setMethods(['getCharge'])->getMock(); $charge = (new Charge())->setId('chargeId'); $paymentMock->expects($this->once())->method('getCharge')->with('chargeId')->willReturn($charge); + + /** @var ResourceService|MockObject $resourceSrvMock */ $resourceSrvMock->expects($this->once())->method('fetchPayment')->with($paymentMock)->willReturn($paymentMock); $resourceSrvMock->expects($this->once())->method('fetch')->with($charge)->willReturn($charge); - /** @var ResourceService $resourceSrvMock */ $returnedCharge = $resourceSrvMock->fetchChargeById($paymentMock, 'chargeId'); $this->assertSame($charge, $returnedCharge); } @@ -865,16 +830,14 @@ public function fetchChargeByIdShouldFetchPaymentAndReturnTheChargeOfThePayment( */ public function fetchReversalByAuthorizationShouldFetchAuthorizeAndReturnTheReversalFromIt() { - $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->setMethods(['fetch']) - ->disableOriginalConstructor()->getMock(); + /** @var ResourceService|MockObject $resourceSrvMock */ + $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->setMethods(['fetch'])->disableOriginalConstructor()->getMock(); $authorizeMock = $this->getMockBuilder(Authorization::class)->setMethods(['getCancellation'])->getMock(); $cancellation = new Cancellation(); $resourceSrvMock->expects($this->once())->method('fetch')->with($authorizeMock); - $authorizeMock->expects($this->once())->method('getCancellation')->with('cancelId')->willReturn($cancellation); - /** @var ResourceService $resourceSrvMock */ $returnedCancel = $resourceSrvMock->fetchReversalByAuthorization($authorizeMock, 'cancelId'); $this->assertSame($cancellation, $returnedCancel); } @@ -890,8 +853,7 @@ public function fetchReversalByAuthorizationShouldFetchAuthorizeAndReturnTheReve */ public function fetchReversalShouldFetchPaymentAndReturnDesiredReversalFromIt() { - $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->setMethods(['fetchPayment']) - ->disableOriginalConstructor()->getMock(); + $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->setMethods(['fetchPayment'])->disableOriginalConstructor()->getMock(); $paymentMock = $this->getMockBuilder(Payment::class)->setMethods(['getAuthorization'])->getMock(); $authorizationMock = $this->getMockBuilder(Authorization::class)->setMethods(['getCancellation'])->getMock(); @@ -916,17 +878,15 @@ public function fetchReversalShouldFetchPaymentAndReturnDesiredReversalFromIt() */ public function fetchRefundByIdShouldFetchChargeByIdAndThenFetchTheDesiredRefundFromIt() { - $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->setMethods(['fetchChargeById', 'fetchRefund']) - ->disableOriginalConstructor()->getMock(); + $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->setMethods(['fetchChargeById', 'fetchRefund'])->disableOriginalConstructor()->getMock(); $charge = (new Charge())->setId('chargeId'); $cancel = (new Cancellation())->setId('cancellationId'); - $resourceSrvMock->expects($this->once())->method('fetchChargeById')->with('paymentId', 'chargeId') - ->willReturn($charge); - $resourceSrvMock->expects($this->once())->method('fetchRefund')->with($charge, 'cancellationId') - ->willReturn($cancel); - /** @var ResourceService $resourceSrvMock */ + /** @var ResourceService|MockObject $resourceSrvMock */ + $resourceSrvMock->expects($this->once())->method('fetchChargeById')->with('paymentId', 'chargeId')->willReturn($charge); + $resourceSrvMock->expects($this->once())->method('fetchRefund')->with($charge, 'cancellationId')->willReturn($cancel); + $returnedCancellation = $resourceSrvMock->fetchRefundById('paymentId', 'chargeId', 'cancellationId'); $this->assertSame($cancel, $returnedCancellation); } @@ -942,19 +902,14 @@ public function fetchRefundByIdShouldFetchChargeByIdAndThenFetchTheDesiredRefund */ public function fetchRefundShouldGetAndFetchDesiredChargeCancellation() { - $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->setMethods(['fetch']) - ->disableOriginalConstructor()->getMock(); - $chargeMock = $this->getMockBuilder(Charge::class)->setMethods(['getCancellation'])->getMock(); - + /** @var ResourceService|MockObject $resourceSrvMock */ + $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->setMethods(['fetch'])->disableOriginalConstructor()->getMock(); $cancel = (new Cancellation())->setId('cancellationId'); - $chargeMock->expects($this->once())->method('getCancellation')->with('cancellationId', true) - ->willReturn($cancel); + $chargeMock = $this->getMockBuilder(Charge::class)->setMethods(['getCancellation'])->getMock(); + $chargeMock->expects($this->once())->method('getCancellation')->with('cancellationId', true)->willReturn($cancel); $resourceSrvMock->expects($this->once())->method('fetch')->with($cancel)->willReturn($cancel); - /** - * @var ResourceService $resourceSrvMock - * @var Charge $chargeMock - */ + /** @var Charge $chargeMock*/ $returnedCancellation = $resourceSrvMock->fetchRefund($chargeMock, 'cancellationId'); $this->assertSame($cancel, $returnedCancellation); } @@ -970,18 +925,14 @@ public function fetchRefundShouldGetAndFetchDesiredChargeCancellation() */ public function fetchShipmentShouldFetchPaymentAndReturnTheDesiredShipmentFromIt() { - $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->setMethods(['fetchPayment']) - ->disableOriginalConstructor()->getMock(); + /** @var ResourceService|MockObject $resourceSrvMock */ + $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->setMethods(['fetchPayment'])->disableOriginalConstructor()->getMock(); $paymentMock = $this->getMockBuilder(Payment::class)->setMethods(['getShipment'])->getMock(); - $shipment = (new Shipment())->setId('shipmentId'); $resourceSrvMock->expects($this->once())->method('fetchPayment')->with('paymentId')->willReturn($paymentMock); $paymentMock->expects($this->once())->method('getShipment')->with('shipmentId', false)->willReturn($shipment); - /** - * @var ResourceService $resourceSrvMock - * @var Payment $paymentMock - */ + /** @var Payment $paymentMock */ $returnedShipment = $resourceSrvMock->fetchShipment('paymentId', 'shipmentId'); $this->assertSame($shipment, $returnedShipment); } @@ -997,13 +948,11 @@ public function fetchShipmentShouldFetchPaymentAndReturnTheDesiredShipmentFromIt */ public function fetchMetadataShouldCallFetchWithTheGivenMetadataObject() { - $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->setMethods(['fetch']) - ->disableOriginalConstructor()->getMock(); - + /** @var ResourceService|MockObject $resourceSrvMock */ + $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->setMethods(['fetch'])->disableOriginalConstructor()->getMock(); $metadata = (new Metadata())->setId('myMetadataId'); $resourceSrvMock->expects($this->once())->method('fetch')->with($metadata); - /** @var ResourceService $resourceSrvMock */ $this->assertSame($metadata, $resourceSrvMock->fetchMetadata($metadata)); } @@ -1018,13 +967,11 @@ public function fetchMetadataShouldCallFetchWithTheGivenMetadataObject() */ public function createMetadataShouldCallCreateWithTheGivenMetadataObject() { - $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->setMethods(['create']) - ->disableOriginalConstructor()->getMock(); - + /** @var ResourceService|MockObject $resourceSrvMock */ + $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->setMethods(['create'])->disableOriginalConstructor()->getMock(); $metadata = new Metadata(); $resourceSrvMock->expects($this->once())->method('create')->with($metadata); - /** @var ResourceService $resourceSrvMock */ $this->assertSame($metadata, $resourceSrvMock->createMetadata($metadata)); } @@ -1039,17 +986,13 @@ public function createMetadataShouldCallCreateWithTheGivenMetadataObject() */ public function fetchMetadataShouldCallFetchWithANewMetadataObjectWithTheGivenId() { - $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->setMethods(['fetch']) - ->disableOriginalConstructor()->getMock(); - + /** @var ResourceService|MockObject $resourceSrvMock */ + $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->setMethods(['fetch'])->disableOriginalConstructor()->getMock(); $resourceSrvMock->expects($this->once())->method('fetch')->with( - $this->callback( - static function ($metadata) { - return $metadata instanceof Metadata && $metadata->getId() === 's-mtd-1234'; - }) - ); + $this->callback(static function ($metadata) { + return $metadata instanceof Metadata && $metadata->getId() === 's-mtd-1234'; + })); - /** @var ResourceService $resourceSrvMock */ $resourceSrvMock->fetchMetadata('s-mtd-1234'); } @@ -1057,44 +1000,33 @@ static function ($metadata) { * Verify send will call send on httpService. * * @test + * @dataProvider sendShouldCallSendOnHttpServiceDP + * + * @param string $method + * @param string $uri + * @param bool $appendId * - * @throws RuntimeException - * @throws ReflectionException * @throws HeidelpayApiException + * @throws ReflectionException + * @throws RuntimeException + * @throws \PHPUnit\Framework\Exception + * @throws \PHPUnit\Framework\MockObject\RuntimeException */ - public function sendShouldCallSendOnHttpService() + public function sendShouldCallSendOnHttpService(string $method, string $uri, bool $appendId) { $heidelpay = new Heidelpay('s-priv-1234'); - $resourceMock = $this->getMockBuilder(DummyResource::class)->setMethods( - ['getUri', 'getHeidelpayObject'] - )->getMock(); - $resourceMock->expects($this->exactly(4))->method('getUri') - ->withConsecutive([true], [false], [true], [true]) - ->willReturnOnConsecutiveCalls('/my/get/uri', '/my/post/uri', '/my/put/uri', '/my/delete/uri'); + $resourceMock = $this->getMockBuilder(DummyResource::class)->setMethods(['getUri', 'getHeidelpayObject'])->getMock(); + $resourceMock->expects($this->once())->method('getUri')->with($appendId)->willReturn($uri); $resourceMock->method('getHeidelpayObject')->willReturn($heidelpay); $httpSrvMock = $this->getMockBuilder(HttpService::class)->setMethods(['send'])->getMock(); $resourceSrv = new ResourceService($heidelpay); /** @var HttpService $httpSrvMock */ $heidelpay->setHttpService($httpSrvMock); - $httpSrvMock->expects($this->exactly(4))->method('send')->withConsecutive( - ['/my/get/uri', $resourceMock, 'GET'], - ['/my/post/uri', $resourceMock, 'POST'], - ['/my/put/uri', $resourceMock, 'PUT'], - ['/my/delete/uri', $resourceMock, 'DELETE'] - )->willReturn('{"response": "This is the response"}'); + $httpSrvMock->expects($this->once())->method('send')->with($uri, $resourceMock, $method)->willReturn('{"response": "This is the response"}'); /** @var AbstractHeidelpayResource $resourceMock */ - $response = $resourceSrv->send($resourceMock); - $this->assertEquals('This is the response', $response->response); - - $response = $resourceSrv->send($resourceMock, HttpAdapterInterface::REQUEST_POST); - $this->assertEquals('This is the response', $response->response); - - $response = $resourceSrv->send($resourceMock, HttpAdapterInterface::REQUEST_PUT); - $this->assertEquals('This is the response', $response->response); - - $response = $resourceSrv->send($resourceMock, HttpAdapterInterface::REQUEST_DELETE); + $response = $resourceSrv->send($resourceMock, $method); $this->assertEquals('This is the response', $response->response); } @@ -1110,9 +1042,8 @@ public function sendShouldCallSendOnHttpService() public function createBasketShouldSetTheParentResourceAndCallCreateWithTheGivenBasket() { $heidelpay = new Heidelpay('s-priv-123'); - $resourceSrvMock = $this->getMockBuilder(ResourceService::class) - ->setConstructorArgs([$heidelpay]) - ->setMethods(['create'])->getMock(); + /** @var ResourceService|MockObject $resourceSrvMock */ + $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->setConstructorArgs([$heidelpay])->setMethods(['create'])->getMock(); $resourceSrvMock->expects($this->once())->method('create'); $basket = new Basket(); @@ -1123,7 +1054,6 @@ public function createBasketShouldSetTheParentResourceAndCallCreateWithTheGivenB $this->assertEquals('Parent resource reference is not set!', $e->getMessage()); } - /** @var ResourceService $resourceSrvMock */ $this->assertSame($basket, $resourceSrvMock->createBasket($basket)); $this->assertSame($heidelpay, $basket->getParentResource()); } @@ -1140,18 +1070,14 @@ public function createBasketShouldSetTheParentResourceAndCallCreateWithTheGivenB public function fetchBasketShouldCreateBasketObjectWithGivenIdAndCallFetchWithIt() { $heidelpay = new Heidelpay('s-priv-123'); - $resourceSrvMock = $this->getMockBuilder(ResourceService::class) - ->setConstructorArgs([$heidelpay]) - ->setMethods(['fetch'])->getMock(); + /** @var ResourceService|MockObject $resourceSrvMock */ + $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->setConstructorArgs([$heidelpay])->setMethods(['fetch'])->getMock(); $resourceSrvMock->expects($this->once())->method('fetch')->with( - $this->callback( - static function ($basket) use ($heidelpay) { - /** @var Basket $basket */ - return $basket->getId() === 'myBasketId' && $basket->getParentResource() === $heidelpay; - }) - ); + $this->callback(static function ($basket) use ($heidelpay) { + /** @var Basket $basket */ + return $basket->getId() === 'myBasketId' && $basket->getParentResource() === $heidelpay; + })); - /** @var ResourceService $resourceSrvMock */ $basket = $resourceSrvMock->fetchBasket('myBasketId'); $this->assertEquals('myBasketId', $basket->getId()); @@ -1171,14 +1097,11 @@ static function ($basket) use ($heidelpay) { public function fetchBasketShouldCallFetchWithTheGivenBasketObject() { $heidelpay = new Heidelpay('s-priv-123'); - $resourceSrvMock = $this->getMockBuilder(ResourceService::class) - ->setConstructorArgs([$heidelpay]) - ->setMethods(['fetch'])->getMock(); - + /** @var ResourceService|MockObject $resourceSrvMock */ + $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->setConstructorArgs([$heidelpay])->setMethods(['fetch'])->getMock(); $basket = new Basket(); $resourceSrvMock->expects($this->once())->method('fetch')->with($basket); - /** @var ResourceService $resourceSrvMock */ $returnedBasket = $resourceSrvMock->fetchBasket($basket); $this->assertSame($basket, $returnedBasket); @@ -1198,13 +1121,11 @@ public function fetchBasketShouldCallFetchWithTheGivenBasketObject() public function updateBasketShouldCallUpdateAndReturnTheGivenBasket() { $heidelpay = new Heidelpay('s-priv-123'); - $resourceSrvMock = $this->getMockBuilder(ResourceService::class) - ->setConstructorArgs([$heidelpay])->setMethods(['update'])->getMock(); - + /** @var ResourceService|MockObject $resourceSrvMock */ + $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->setConstructorArgs([$heidelpay])->setMethods(['update'])->getMock(); $basket = new Basket(); $resourceSrvMock->expects($this->once())->method('update')->with($basket); - /** @var ResourceService $resourceSrvMock */ $returnedBasket = $resourceSrvMock->updateBasket($basket); $this->assertSame($basket, $returnedBasket); @@ -1218,8 +1139,8 @@ public function updateBasketShouldCallUpdateAndReturnTheGivenBasket() * @test * @dataProvider fetchResourceByUrlShouldFetchTheDesiredResourceDP * - * @param string $expectedFetchMethod - * @param mixed $expectedArguments + * @param string $fetchMethod + * @param mixed $arguments * @param string $resourceUrl * * @throws Exception @@ -1228,17 +1149,11 @@ public function updateBasketShouldCallUpdateAndReturnTheGivenBasket() * @throws ReflectionException * @throws RuntimeException */ - public function fetchResourceByUrlShouldFetchTheDesiredResource( - $expectedFetchMethod, - $expectedArguments, - $resourceUrl - ) { - $heidelpayMock = $this->getMockBuilder(Heidelpay::class)->disableOriginalConstructor()->setMethods( - [$expectedFetchMethod] - )->getMock(); - $heidelpayMock->expects($this->once())->method($expectedFetchMethod)->with(...$expectedArguments); - - /** @var Heidelpay $heidelpayMock */ + public function fetchResourceByUrlShouldFetchTheDesiredResource($fetchMethod, $arguments, $resourceUrl) + { + /** @var Heidelpay|MockObject $heidelpayMock */ + $heidelpayMock = $this->getMockBuilder(Heidelpay::class)->disableOriginalConstructor()->setMethods([$fetchMethod])->getMock(); + $heidelpayMock->expects($this->once())->method($fetchMethod)->with(...$arguments); $resourceService = new ResourceService($heidelpayMock); $resourceService->fetchResourceByUrl($resourceUrl); @@ -1261,12 +1176,10 @@ public function fetchResourceByUrlShouldFetchTheDesiredResource( */ public function fetchResourceByUrlForAPaymentTypeShouldCallFetchPaymentType($paymentTypeId, $resourceUrl) { - $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->disableOriginalConstructor() - ->setMethods(['fetchPaymentType'])->getMock(); - + /** @var ResourceService|MockObject $resourceSrvMock */ + $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->disableOriginalConstructor()->setMethods(['fetchPaymentType'])->getMock(); $resourceSrvMock->expects($this->once())->method('fetchPaymentType')->with($paymentTypeId); - /** @var ResourceService $resourceSrvMock */ $resourceSrvMock->fetchResourceByUrl($resourceUrl); } @@ -1283,15 +1196,11 @@ public function fetchResourceByUrlForAPaymentTypeShouldCallFetchPaymentType($pay */ public function fetchResourceByUrlForAPaymentTypeShouldReturnNullIfTheTypeIsUnknown() { - $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->disableOriginalConstructor() - ->setMethods(['fetchPaymentType'])->getMock(); - + /** @var ResourceService|MockObject $resourceSrvMock */ + $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->disableOriginalConstructor()->setMethods(['fetchPaymentType'])->getMock(); $resourceSrvMock->expects($this->never())->method('fetchPaymentType'); - /** @var ResourceService $resourceSrvMock */ - $this->assertNull( - $resourceSrvMock->fetchResourceByUrl('https://api.heidelpay.com/v1/types/card/s-unknown-xen2ybcovn56/') - ); + $this->assertNull($resourceSrvMock->fetchResourceByUrl('https://api.heidelpay.com/v1/types/card/s-unknown-xen2ybcovn56/')); } /** @@ -1311,11 +1220,9 @@ public function createRecurringShouldFetchThePaymentTypeById() $resourceServiceMock = $this->getMockBuilder(ResourceService::class)->disableOriginalConstructor()->setMethods(['fetchPaymentType', 'create'])->getMock(); $resourceServiceMock->expects(self::once())->method('fetchPaymentType')->with('typeId')->willReturn($paymentType); - $resourceServiceMock->expects(self::once())->method('create')->with( - $this::callback(static function ($data) { - return $data instanceof Recurring && - $data->getReturnUrl() === 'returnUrl' && - $data->getPaymentTypeId() === 'myId'; + $resourceServiceMock->expects(self::once())->method('create') + ->with($this::callback(static function ($data) { + return $data instanceof Recurring && $data->getReturnUrl() === 'returnUrl' && $data->getPaymentTypeId() === 'myId'; })); /** @var ResourceService $resourceServiceMock */ @@ -1336,18 +1243,15 @@ public function createRecurringShouldFetchThePaymentTypeById() public function createRecurringShouldNotFetchThePaymentTypeByObject() { $paymentType = new TraitDummyCanRecur(); - - $resourceServiceMock = $this->getMockBuilder(ResourceService::class)->disableOriginalConstructor()->setMethods(['fetchPaymentType', 'create'])->getMock(); - $resourceServiceMock->expects(self::never())->method('fetchPaymentType'); - $resourceServiceMock->expects(self::once())->method('create')->with( - $this::callback(static function ($data) { - return $data instanceof Recurring && - $data->getReturnUrl() === 'returnUrl' && - $data->getPaymentTypeId() === 'myId'; + /** @var ResourceService|MockObject $resourceSrvMock */ + $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->disableOriginalConstructor()->setMethods(['fetchPaymentType', 'create'])->getMock(); + $resourceSrvMock->expects(self::never())->method('fetchPaymentType'); + $resourceSrvMock->expects(self::once())->method('create') + ->with($this::callback(static function ($data) { + return $data instanceof Recurring && $data->getReturnUrl() === 'returnUrl' && $data->getPaymentTypeId() === 'myId'; })); - /** @var ResourceService $resourceServiceMock */ - $resourceServiceMock->createRecurring($paymentType, 'returnUrl'); + $resourceSrvMock->createRecurring($paymentType, 'returnUrl'); } /** @@ -1362,8 +1266,8 @@ public function createRecurringShouldNotFetchThePaymentTypeByObject() public function createRecurringShouldThrowExceptionWhenRecurringPaymentIsNotSupportedByType() { $resourceService = new ResourceService(new Heidelpay('s-priv-123')); - $this->expectException(RuntimeException::class); + $resourceService->createRecurring(new Sofort(), 'returnUrl'); } @@ -1485,56 +1389,16 @@ public function paymentTypeIdProviderInvalid(): array public function fetchResourceByUrlShouldFetchTheDesiredResourceDP(): array { return [ - 'Authorization' => [ - 'fetchAuthorization', - ['s-pay-100746'], - 'https://api.heidelpay.com/v1/payments/s-pay-100746/authorize/s-aut-1/' - ], - 'Charge' => [ - 'fetchChargeById', - ['s-pay-100798', 's-chg-1'], - 'https://api.heidelpay.com/v1/payments/s-pay-100798/charges/s-chg-1/' - ], - 'Shipment' => [ - 'fetchShipment', - ['s-pay-100801', 's-shp-1'], - 'https://api.heidelpay.com/v1/payments/s-pay-100801/shipments/s-shp-1/' - ], - 'Refund' => [ - 'fetchRefundById', - ['s-pay-100802', 's-chg-1', 's-cnl-1'], - 'https://api.heidelpay.com/v1/payments/s-pay-100802/charges/s-chg-1/cancels/s-cnl-1/' - ], - 'Reversal' => [ - 'fetchReversal', - ['s-pay-100803', 's-cnl-1'], - 'https://api.heidelpay.com/v1/payments/s-pay-100803/authorize/s-aut-1/cancels/s-cnl-1/' - ], - 'Payment' => [ - 'fetchPayment', - ['s-pay-100801'], - 'https://api.heidelpay.com/v1/payments/s-pay-100801' - ], - 'Metadata' => [ - 'fetchMetadata', - ['s-mtd-6glqv9axjpnc'], - 'https://api.heidelpay.com/v1/metadata/s-mtd-6glqv9axjpnc/' - ], - 'Customer' => [ - 'fetchCustomer', - ['s-cst-50c14d49e2fe'], - 'https://api.heidelpay.com/v1/customers/s-cst-50c14d49e2fe' - ], - 'Basket' => [ - 'fetchBasket', - ['s-bsk-1254'], - 'https://api.heidelpay.com/v1/baskets/s-bsk-1254/' - ], - 'Payout' => [ - 'fetchPayout', - ['s-pay-100746'], - 'https://api.heidelpay.com/v1/payments/s-pay-100746/payout/s-out-1/' - ] + 'Authorization' => ['fetchAuthorization', ['s-pay-100746'], 'https://api.heidelpay.com/v1/payments/s-pay-100746/authorize/s-aut-1/'], + 'Charge' => ['fetchChargeById', ['s-pay-100798', 's-chg-1'], 'https://api.heidelpay.com/v1/payments/s-pay-100798/charges/s-chg-1/'], + 'Shipment' => ['fetchShipment', ['s-pay-100801', 's-shp-1'], 'https://api.heidelpay.com/v1/payments/s-pay-100801/shipments/s-shp-1/'], + 'Refund' => ['fetchRefundById', ['s-pay-100802', 's-chg-1', 's-cnl-1'], 'https://api.heidelpay.com/v1/payments/s-pay-100802/charges/s-chg-1/cancels/s-cnl-1/'], + 'Reversal' => ['fetchReversal', ['s-pay-100803', 's-cnl-1'], 'https://api.heidelpay.com/v1/payments/s-pay-100803/authorize/s-aut-1/cancels/s-cnl-1/'], + 'Payment' => ['fetchPayment', ['s-pay-100801'], 'https://api.heidelpay.com/v1/payments/s-pay-100801'], + 'Metadata' => ['fetchMetadata', ['s-mtd-6glqv9axjpnc'], 'https://api.heidelpay.com/v1/metadata/s-mtd-6glqv9axjpnc/'], + 'Customer' => ['fetchCustomer', ['s-cst-50c14d49e2fe'], 'https://api.heidelpay.com/v1/customers/s-cst-50c14d49e2fe'], + 'Basket' => ['fetchBasket', ['s-bsk-1254'], 'https://api.heidelpay.com/v1/baskets/s-bsk-1254/'], + 'Payout' => ['fetchPayout', ['s-pay-100746'], 'https://api.heidelpay.com/v1/payments/s-pay-100746/payout/s-out-1/'] ]; } @@ -1546,74 +1410,36 @@ public function fetchResourceByUrlShouldFetchTheDesiredResourceDP(): array public function fetchResourceByUrlForAPaymentTypeShouldCallFetchPaymentTypeDP(): array { return [ - 'CARD' => [ - 's-crd-xen2ybcovn56', - 'https://api.heidelpay.com/v1/types/card/s-crd-xen2ybcovn56/' - ], - 'GIROPAY' => [ - 's-gro-xen2ybcovn56', - 'https://api.heidelpay.com/v1/types/giropay/s-gro-xen2ybcovn56/' - ], - 'IDEAL' => [ - 's-idl-xen2ybcovn56', - 'https://api.heidelpay.com/v1/types/ideal/s-idl-xen2ybcovn56/' - ], - 'INVOICE' => [ - 's-ivc-xen2ybcovn56', - 'https://api.heidelpay.com/v1/types/invoice/s-ivc-xen2ybcovn56/' - ], - 'INVOICE_GUARANTEED' => [ - 's-ivg-xen2ybcovn56', - 'https://api.heidelpay.com/v1/types/invoice-guaranteed/s-ivg-xen2ybcovn56/' - ], - 'PAYPAL' => [ - 's-ppl-xen2ybcovn56', - 'https://api.heidelpay.com/v1/types/paypal/s-ppl-xen2ybcovn56/' - ], - 'PREPAYMENT' => [ - 's-ppy-xen2ybcovn56', - 'https://api.heidelpay.com/v1/types/prepayment/s-ppy-xen2ybcovn56/' - ], - 'PRZELEWY24' => [ - 's-p24-xen2ybcovn56', - 'https://api.heidelpay.com/v1/types/przelewy24/s-p24-xen2ybcovn56/' - ], - 'SEPA_DIRECT_DEBIT_GUARANTEED' => [ - 's-ddg-xen2ybcovn56', - 'https://api.heidelpay.com/v1/types/direct-debit-guaranteed/s-ddg-xen2ybcovn56/' - ], - 'SEPA_DIRECT_DEBIT' => [ - 's-sdd-xen2ybcovn56', - 'https://api.heidelpay.com/v1/types/direct-debit/s-sdd-xen2ybcovn56/' - ], - 'SOFORT' => [ - 's-sft-xen2ybcovn56', - 'https://api.heidelpay.com/v1/types/sofort/s-sft-xen2ybcovn56/' - ], - 'PIS' => [ - 's-pis-xen2ybcovn56', - 'https://api.heidelpay.com/v1/types/pis/s-pis-xen2ybcovn56/' - ], - 'EPS' => [ - 's-eps-xen2ybcovn56', - 'https://api.heidelpay.com/v1/types/eps/s-eps-xen2ybcovn56/' - ], - 'ALIPAY' => [ - 's-ali-xen2ybcovn56', - 'https://api.heidelpay.com/v1/types/alipay/s-ali-xen2ybcovn56/' - ], - 'WECHATPAY' => [ - 's-wcp-xen2ybcovn56', - 'https://api.heidelpay.com/v1/types/wechatpay/s-wcp-xen2ybcovn56/' - ], - 'INVOICE_FACTORING' => [ - 's-ivf-xen2ybcovn56', - 'https://api.heidelpay.com/v1/types/wechatpay/s-ivf-xen2ybcovn56/' - ], - 'HIRE_PURCHASE_DIRECT_DEBIT' => [ - 's-hdd-xen2ybcovn56', - 'https://api.heidelpay.com/v1/types/hire-purchase-direct-debit/s-hdd-xen2ybcovn56/' - ] + 'CARD' => ['s-crd-xen2ybcovn56', 'https://api.heidelpay.com/v1/types/card/s-crd-xen2ybcovn56/'], + 'GIROPAY' => ['s-gro-xen2ybcovn56', 'https://api.heidelpay.com/v1/types/giropay/s-gro-xen2ybcovn56/'], + 'IDEAL' => ['s-idl-xen2ybcovn56', 'https://api.heidelpay.com/v1/types/ideal/s-idl-xen2ybcovn56/'], + 'INVOICE' => ['s-ivc-xen2ybcovn56', 'https://api.heidelpay.com/v1/types/invoice/s-ivc-xen2ybcovn56/'], + 'INVOICE_GUARANTEED' => ['s-ivg-xen2ybcovn56', 'https://api.heidelpay.com/v1/types/invoice-guaranteed/s-ivg-xen2ybcovn56/'], + 'PAYPAL' => ['s-ppl-xen2ybcovn56', 'https://api.heidelpay.com/v1/types/paypal/s-ppl-xen2ybcovn56/'], + 'PREPAYMENT' => ['s-ppy-xen2ybcovn56', 'https://api.heidelpay.com/v1/types/prepayment/s-ppy-xen2ybcovn56/'], + 'PRZELEWY24' => ['s-p24-xen2ybcovn56', 'https://api.heidelpay.com/v1/types/przelewy24/s-p24-xen2ybcovn56/'], + 'SEPA_DIRECT_DEBIT_GUARANTEED' => ['s-ddg-xen2ybcovn56', 'https://api.heidelpay.com/v1/types/direct-debit-guaranteed/s-ddg-xen2ybcovn56/'], + 'SEPA_DIRECT_DEBIT' => ['s-sdd-xen2ybcovn56', 'https://api.heidelpay.com/v1/types/direct-debit/s-sdd-xen2ybcovn56/'], + 'SOFORT' => ['s-sft-xen2ybcovn56', 'https://api.heidelpay.com/v1/types/sofort/s-sft-xen2ybcovn56/'], + 'PIS' => ['s-pis-xen2ybcovn56', 'https://api.heidelpay.com/v1/types/pis/s-pis-xen2ybcovn56/'], + 'EPS' => ['s-eps-xen2ybcovn56', 'https://api.heidelpay.com/v1/types/eps/s-eps-xen2ybcovn56/'], + 'ALIPAY' => ['s-ali-xen2ybcovn56', 'https://api.heidelpay.com/v1/types/alipay/s-ali-xen2ybcovn56/'], + 'WECHATPAY' => ['s-wcp-xen2ybcovn56', 'https://api.heidelpay.com/v1/types/wechatpay/s-wcp-xen2ybcovn56/'], + 'INVOICE_FACTORING' => ['s-ivf-xen2ybcovn56', 'https://api.heidelpay.com/v1/types/wechatpay/s-ivf-xen2ybcovn56/'], + 'HIRE_PURCHASE_DIRECT_DEBIT' => ['s-hdd-xen2ybcovn56', 'https://api.heidelpay.com/v1/types/hire-purchase-direct-debit/s-hdd-xen2ybcovn56/'] + ]; + } + + /** + * @return array + */ + public function sendShouldCallSendOnHttpServiceDP(): array + { + return [ + HttpAdapterInterface::REQUEST_GET => [HttpAdapterInterface::REQUEST_GET, '/my/get/uri', true], + HttpAdapterInterface::REQUEST_POST => [HttpAdapterInterface::REQUEST_POST, '/my/post/uri', false], + HttpAdapterInterface::REQUEST_PUT => [HttpAdapterInterface::REQUEST_PUT, '/my/put/uri', true], + HttpAdapterInterface::REQUEST_DELETE => [HttpAdapterInterface::REQUEST_DELETE, '/my/delete/uri', true], ]; } From 5633df0f295b4748806f77c79bf6245543faa87a Mon Sep 17 00:00:00 2001 From: sixer1182 Date: Mon, 25 Nov 2019 15:06:43 +0100 Subject: [PATCH 016/101] [refactor] (PHPLIB-274) Extract PaymentServiceInterface. Add interface. Refactor function headers. Refactor services. Refactor tests. --- src/Heidelpay.php | 254 ++---------- src/Interfaces/PaymentServiceInterface.php | 358 +++++++++++++++++ src/Resources/Payment.php | 2 +- src/Services/PaymentService.php | 427 +++++--------------- src/Services/ResourceService.php | 23 +- test/unit/HeidelpayTest.php | 14 +- test/unit/Services/PaymentServiceTest.php | 438 +++++++++------------ 7 files changed, 695 insertions(+), 821 deletions(-) create mode 100644 src/Interfaces/PaymentServiceInterface.php diff --git a/src/Heidelpay.php b/src/Heidelpay.php index 9eb65262..20ccd704 100755 --- a/src/Heidelpay.php +++ b/src/Heidelpay.php @@ -26,14 +26,13 @@ namespace heidelpayPHP; use DateTime; -use heidelpayPHP\Constants\TransactionTypes; use heidelpayPHP\Exceptions\HeidelpayApiException; use heidelpayPHP\Interfaces\DebugHandlerInterface; use heidelpayPHP\Interfaces\HeidelpayParentInterface; +use heidelpayPHP\Interfaces\PaymentServiceInterface; use heidelpayPHP\Resources\AbstractHeidelpayResource; use heidelpayPHP\Resources\Basket; use heidelpayPHP\Resources\Customer; -use heidelpayPHP\Resources\InstalmentPlans; use heidelpayPHP\Resources\Keypair; use heidelpayPHP\Resources\Metadata; use heidelpayPHP\Resources\Payment; @@ -53,7 +52,7 @@ use heidelpayPHP\Validators\PrivateKeyValidator; use RuntimeException; -class Heidelpay implements HeidelpayParentInterface +class Heidelpay implements HeidelpayParentInterface, PaymentServiceInterface { const BASE_URL = 'api.heidelpay.com'; const API_VERSION = 'v1'; @@ -69,7 +68,7 @@ class Heidelpay implements HeidelpayParentInterface /** @var ResourceService $resourceService */ private $resourceService; - /** @var PaymentService $paymentService */ + /** @var PaymentServiceInterface $paymentService */ private $paymentService; /** @var WebhookService $webhookService */ @@ -166,7 +165,7 @@ public function setLocale($locale): Heidelpay */ public function setResourceService(ResourceService $resourceService): Heidelpay { - $this->resourceService = $resourceService; + $this->resourceService = $resourceService->setHeidelpay($this); return $this; } @@ -187,14 +186,14 @@ public function getResourceService(): ResourceService */ public function setPaymentService(PaymentService $paymentService): Heidelpay { - $this->paymentService = $paymentService; + $this->paymentService = $paymentService->setHeidelpay($this); return $this; } /** - * @return PaymentService + * @return PaymentServiceInterface */ - public function getPaymentService(): PaymentService + public function getPaymentService(): PaymentServiceInterface { return $this->paymentService; } @@ -936,27 +935,7 @@ public function fetchResourceFromEvent($eventJson = null): AbstractHeidelpayReso // /** - * Performs an Authorization transaction and returns the resulting Authorization resource. - * - * @param float $amount The amount to authorize. - * @param string $currency The currency of the amount. - * @param string|BasePaymentType $paymentType The PaymentType object or the id of the PaymentType to use. - * @param string $returnUrl The URL used to return to the shop if the process requires leaving it. - * @param Customer|string|null $customer The Customer object or the id of the customer resource to reference. - * @param string|null $orderId A custom order id which can be set by the merchant. - * @param Metadata|null $metadata The Metadata object containing custom information for the payment. - * @param Basket|null $basket The Basket object corresponding to the payment. - * The Basket object will be created automatically if it does not exist - * yet (i.e. has no id). - * @param bool|null $card3ds Enables 3ds channel for credit cards if available. This parameter is - * optional and will be ignored if not applicable. - * @param string|null $invoiceId The external id of the invoice. - * @param string|null $paymentReference A reference text for the payment. - * - * @return Authorization The resulting object of the Authorization resource. - * - * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * {@inheritDoc} */ public function authorize( $amount, @@ -986,65 +965,12 @@ public function authorize( ); } - /** - * Performs an Authorization transaction using a Payment object and returns the resulting Authorization resource. - * - * @param float $amount The amount to authorize. - * @param string $currency The currency of the amount. - * @param Payment $payment The Payment object to create the Authorization for. - * @param string $returnUrl The URL used to return to the shop if the process requires leaving it. - * @param Customer|string|null $customer The Customer object or the id of the customer resource to reference. - * @param string|null $orderId A custom order id which can be set by the merchant. - * @param Metadata|null $metadata The Metadata object containing custom information for the payment. - * @param Basket|null $basket The Basket object corresponding to the payment. - * The Basket object will be created automatically if it does not exist - * yet (i.e. has no id). - * - * @return Authorization The resulting object of the Authorization resource. - * - * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. - */ - public function authorizeWithPayment( - $amount, - $currency, - Payment $payment, - $returnUrl = null, - $customer = null, - $orderId = null, - $metadata = null, - $basket = null - ): AbstractTransactionType { - return $this->paymentService - ->authorizeWithPayment($amount, $currency, $payment, $returnUrl, $customer, $orderId, $metadata, $basket); - } - // // /** - * Performs a Charge transaction and returns the resulting Charge resource. - * - * @param float $amount The amount to charge. - * @param string $currency The currency of the amount. - * @param string|BasePaymentType $paymentType The PaymentType object or the id of the PaymentType to use. - * @param string $returnUrl The URL used to return to the shop if the process requires leaving it. - * @param Customer|string|null $customer The Customer object or the id of the customer resource to reference. - * @param string|null $orderId A custom order id which can be set by the merchant. - * @param Metadata|null $metadata The Metadata object containing custom information for the payment. - * @param Basket|null $basket The Basket object corresponding to the payment. - * The Basket object will be created automatically if it does not exist - * yet (i.e. has no id). - * @param bool|null $card3ds Enables 3ds channel for credit cards if available. This parameter is - * optional and will be ignored if not applicable. - * @param string|null $invoiceId The external id of the invoice. - * @param string|null $paymentReference A reference text for the payment. - * - * @return Charge The resulting object of the Charge resource. - * - * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * {@inheritDoc} */ public function charge( $amount, @@ -1075,18 +1001,7 @@ public function charge( } /** - * Performs a Charge transaction for the Authorization of the given Payment object. - * To perform a full charge of the authorized amount leave the amount null. - * - * @param string|Payment $payment The Payment object the Authorization to charge belongs to. - * @param float|null $amount The amount to charge. - * @param string|null $orderId The order id from the shop. - * @param string|null $invoiceId The invoice id from the shop. - * - * @return Charge The resulting object of the Charge resource. - * - * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * {@inheritDoc} */ public function chargeAuthorization( $payment, @@ -1098,18 +1013,7 @@ public function chargeAuthorization( } /** - * Performs a Charge transaction for a specific Payment and returns the resulting Charge object. - * - * @param Payment|string $payment The Payment object to be charged. - * @param float|null $amount The amount to charge. - * @param string|null $currency The Currency of the charged amount. - * @param string|null $orderId The order id from the shop. - * @param string|null $invoiceId The invoice id from the shop. - * - * @return Charge The resulting Charge object. - * - * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * {@inheritDoc} */ public function chargePayment( $payment, @@ -1127,16 +1031,7 @@ public function chargePayment( // /** - * Performs a Cancellation transaction and returns the resulting Cancellation object. - * Performs a full cancel if the parameter amount is null. - * - * @param Authorization $authorization The Authorization to be canceled. - * @param float|null $amount The amount to be canceled. - * - * @return Cancellation The resulting Cancellation object. - * - * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * {@inheritDoc} */ public function cancelAuthorization(Authorization $authorization, $amount = null): AbstractTransactionType { @@ -1144,16 +1039,7 @@ public function cancelAuthorization(Authorization $authorization, $amount = null } /** - * Performs a Cancellation transaction for the Authorization of the given Payment object. - * Performs a full cancel if the parameter amount is null. - * - * @param Payment|string $payment The Payment object or the id of the Payment the Authorization belongs to. - * @param float|null $amount The amount to be canceled. - * - * @return Cancellation Resulting Cancellation object. - * - * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * {@inheritDoc} */ public function cancelAuthorizationByPayment($payment, $amount = null): AbstractTransactionType { @@ -1165,25 +1051,10 @@ public function cancelAuthorizationByPayment($payment, $amount = null): Abstract // /** - * Performs a Cancellation transaction for the given Charge and returns the resulting Cancellation object. - * Performs a full cancel if the parameter amount is null. - * - * @param Payment|string $paymentId The Payment object or the id of the Payment the charge belongs to. - * @param string $chargeId The id of the Charge to be canceled. - * @param float|null $amount The amount to be canceled. - * This will be sent as amountGross in case of Hire Purchase payment method. - * @param string|null $reasonCode Reason for the Cancellation ref \heidelpayPHP\Constants\CancelReasonCodes. - * @param string|null $paymentReference A reference string for the payment. - * @param float|null $amountNet The net value of the amount to be cancelled (Hire Purchase only). - * @param float|null $amountVat The vat value of the amount to be cancelled (Hire Purchase only). - * - * @return Cancellation The resulting Cancellation object. - * - * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * {@inheritDoc} */ public function cancelChargeById( - $paymentId, + $payment, $chargeId, float $amount = null, string $reasonCode = null, @@ -1192,7 +1063,7 @@ public function cancelChargeById( float $amountVat = null ): AbstractTransactionType { return $this->paymentService->cancelChargeById( - $paymentId, + $payment, $chargeId, $amount, $reasonCode, @@ -1203,21 +1074,7 @@ public function cancelChargeById( } /** - * Performs a Cancellation transaction and returns the resulting Cancellation object. - * Performs a full cancel if the parameter amount is null. - * - * @param Charge $charge The Charge object to create the Cancellation for. - * @param float|null $amount The amount to be canceled. - * This will be sent as amountGross in case of Hire Purchase payment method. - * @param string|null $reasonCode Reason for the Cancellation ref \heidelpayPHP\Constants\CancelReasonCodes. - * @param string|null $paymentReference A reference string for the payment. - * @param float|null $amountNet The net value of the amount to be cancelled (Hire Purchase only). - * @param float|null $amountVat The vat value of the amount to be cancelled (Hire Purchase only). - * - * @return Cancellation The resulting Cancellation object. - * - * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * {@inheritDoc} */ public function cancelCharge( Charge $charge, @@ -1242,18 +1099,9 @@ public function cancelCharge( // /** - * Performs a Shipment transaction and returns the resulting Shipment object. - * - * @param Payment|string $payment The Payment object the the id of the Payment to ship. - * @param string|null $invoiceId The id of the invoice in the shop. - * @param string|null $orderId The id of the order in shop. - * - * @return Shipment The resulting Shipment object. - * - * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * {@inheritDoc} */ - public function ship($payment, $invoiceId = null, $orderId = null): AbstractHeidelpayResource + public function ship($payment, string $invoiceId = null, string $orderId = null): AbstractHeidelpayResource { return $this->paymentService->ship($payment, $invoiceId, $orderId); } @@ -1263,25 +1111,7 @@ public function ship($payment, $invoiceId = null, $orderId = null): AbstractHeid // /** - * Performs a Payout transaction and returns the resulting Payout resource. - * - * @param float $amount The amount to charge. - * @param string $currency The currency of the amount. - * @param string|BasePaymentType $paymentType The PaymentType object or the id of the PaymentType to use. - * @param string $returnUrl The URL used to return to the shop if the process requires leaving it. - * @param Customer|string|null $customer The Customer object or the id of the customer resource to reference. - * @param string|null $orderId A custom order id which can be set by the merchant. - * @param Metadata|null $metadata The Metadata object containing custom information for the payment. - * @param Basket|null $basket The Basket object corresponding to the payment. - * The Basket object will be created automatically if it does not exist - * yet (i.e. has no id). - * @param string|null $invoiceId The external id of the invoice. - * @param string|null $paymentReference A reference text for the payment. - * - * @return Payout The resulting object of the Payout resource. - * - * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * {@inheritDoc} */ public function payout( $amount, @@ -1314,15 +1144,7 @@ public function payout( // /** - * @param Paypage $paypage - * @param Customer|null $customer - * @param Basket|null $basket - * @param Metadata|null $metadata - * - * @return Paypage - * - * @throws HeidelpayApiException - * @throws RuntimeException + * {@inheritDoc} */ public function initPayPageCharge( Paypage $paypage, @@ -1330,19 +1152,11 @@ public function initPayPageCharge( Basket $basket = null, Metadata $metadata = null ): Paypage { - return $this->paymentService->initPayPage($paypage, TransactionTypes::CHARGE, $customer, $basket, $metadata); + return $this->paymentService->initPayPageCharge($paypage, $customer, $basket, $metadata); } /** - * @param Paypage $paypage - * @param Customer|null $customer - * @param Basket|null $basket - * @param Metadata|null $metadata - * - * @return Paypage - * - * @throws HeidelpayApiException - * @throws RuntimeException + * {@inheritDoc} */ public function initPayPageAuthorize( Paypage $paypage, @@ -1350,13 +1164,7 @@ public function initPayPageAuthorize( Basket $basket = null, Metadata $metadata = null ): Paypage { - return $this->paymentService->initPayPage( - $paypage, - TransactionTypes::AUTHORIZATION, - $customer, - $basket, - $metadata - ); + return $this->paymentService->initPayPageAuthorize($paypage, $customer, $basket, $metadata); } // @@ -1364,24 +1172,14 @@ public function initPayPageAuthorize( // /** - * Returns available hire purchase direct debit instalment plans for the given values. - * - * @param $amount - * @param $currency - * @param $effectiveInterest - * @param DateTime|null $orderDate - * - * @return InstalmentPlans - * - * @throws HeidelpayApiException - * @throws RuntimeException + * {@inheritDoc} */ public function fetchDirectDebitInstalmentPlans( $amount, $currency, $effectiveInterest, DateTime $orderDate = null - ): InstalmentPlans { + ) { return $this->getPaymentService()->fetchDirectDebitInstalmentPlans( $amount, $currency, diff --git a/src/Interfaces/PaymentServiceInterface.php b/src/Interfaces/PaymentServiceInterface.php new file mode 100644 index 00000000..03bc12c7 --- /dev/null +++ b/src/Interfaces/PaymentServiceInterface.php @@ -0,0 +1,358 @@ + + * + * @package heidelpay/${Package} + */ +namespace heidelpayPHP\Interfaces; + +use DateTime; +use heidelpayPHP\Exceptions\HeidelpayApiException; +use heidelpayPHP\Resources\AbstractHeidelpayResource; +use heidelpayPHP\Resources\Basket; +use heidelpayPHP\Resources\Customer; +use heidelpayPHP\Resources\InstalmentPlans; +use heidelpayPHP\Resources\Metadata; +use heidelpayPHP\Resources\Payment; +use heidelpayPHP\Resources\PaymentTypes\BasePaymentType; +use heidelpayPHP\Resources\PaymentTypes\Paypage; +use heidelpayPHP\Resources\TransactionTypes\AbstractTransactionType; +use heidelpayPHP\Resources\TransactionTypes\Authorization; +use heidelpayPHP\Resources\TransactionTypes\Cancellation; +use heidelpayPHP\Resources\TransactionTypes\Charge; +use heidelpayPHP\Resources\TransactionTypes\Payout; +use heidelpayPHP\Resources\TransactionTypes\Shipment; +use RuntimeException; + +interface PaymentServiceInterface +{ + /** + * Performs an Authorization transaction and returns the resulting Authorization resource. + * + * @param float $amount The amount to authorize. + * @param string $currency The currency of the amount. + * @param string|BasePaymentType $paymentType The PaymentType object or the id of the PaymentType to use. + * @param string $returnUrl The URL used to return to the shop if the process requires leaving it. + * @param Customer|string|null $customer The Customer object or the id of the customer resource to reference. + * @param string|null $orderId A custom order id which can be set by the merchant. + * @param Metadata|null $metadata The Metadata object containing custom information for the payment. + * @param Basket|null $basket The Basket object corresponding to the payment. + * The Basket object will be created automatically if it does not exist + * yet (i.e. has no id). + * @param bool|null $card3ds Enables 3ds channel for credit cards if available. This parameter is + * optional and will be ignored if not applicable. + * @param string|null $invoiceId The external id of the invoice. + * @param string|null $paymentReference A reference text for the payment. + * + * @return Authorization The resulting object of the Authorization resource. + * + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + */ + public function authorize( + $amount, + $currency, + $paymentType, + $returnUrl, + $customer = null, + $orderId = null, + $metadata = null, + $basket = null, + $card3ds = null, + $invoiceId = null, + $paymentReference = null + ): AbstractTransactionType; + + /** + * Performs a Charge transaction and returns the resulting Charge resource. + * + * @param float $amount The amount to charge. + * @param string $currency The currency of the amount. + * @param string|BasePaymentType $paymentType The PaymentType object or the id of the PaymentType to use. + * @param string $returnUrl The URL used to return to the shop if the process requires leaving it. + * @param Customer|string|null $customer The Customer object or the id of the customer resource to reference. + * @param string|null $orderId A custom order id which can be set by the merchant. + * @param Metadata|null $metadata The Metadata object containing custom information for the payment. + * @param Basket|null $basket The Basket object corresponding to the payment. + * The Basket object will be created automatically if it does not exist + * yet (i.e. has no id). + * @param bool|null $card3ds Enables 3ds channel for credit cards if available. This parameter is + * optional and will be ignored if not applicable. + * @param string|null $invoiceId The external id of the invoice. + * @param string|null $paymentReference A reference text for the payment. + * + * @return Charge The resulting object of the Charge resource. + * + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + */ + public function charge( + $amount, + $currency, + $paymentType, + $returnUrl, + $customer = null, + $orderId = null, + $metadata = null, + $basket = null, + $card3ds = null, + $invoiceId = null, + $paymentReference = null + ): AbstractTransactionType; + + /** + * Performs a Charge transaction for the Authorization of the given Payment object. + * To perform a full charge of the authorized amount leave the amount null. + * + * @param string|Payment $payment The Payment object the Authorization to charge belongs to. + * @param float|null $amount The amount to charge. + * @param string|null $orderId The order id from the shop. + * @param string|null $invoiceId The invoice id from the shop. + * + * @return Charge The resulting object of the Charge resource. + * + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + */ + public function chargeAuthorization( + $payment, + float $amount = null, + string $orderId = null, + string $invoiceId = null + ): AbstractTransactionType; + + /** + * Performs a Charge transaction for a specific Payment and returns the resulting Charge object. + * + * @param Payment|string $payment The Payment object to be charged. + * @param float|null $amount The amount to charge. + * @param string|null $currency The Currency of the charged amount. + * @param string|null $orderId The order id from the shop. + * @param string|null $invoiceId The invoice id from the shop. + * + * @return Charge The resulting Charge object. + * + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + */ + public function chargePayment( + $payment, + float $amount = null, + string $currency = null, + string $orderId = null, + string $invoiceId = null + ): AbstractTransactionType; + + /** + * Performs a Payout transaction and returns the resulting Payout resource. + * + * @param float $amount The amount to payout. + * @param string $currency The currency of the amount. + * @param string|BasePaymentType $paymentType The PaymentType object or the id of the PaymentType to use. + * @param string $returnUrl The URL used to return to the shop if the process requires leaving it. + * @param Customer|string|null $customer The Customer object or the id of the customer resource to reference. + * @param string|null $orderId A custom order id which can be set by the merchant. + * @param Metadata|null $metadata The Metadata object containing custom information for the payment. + * @param Basket|null $basket The Basket object corresponding to the payment. + * The Basket object will be created automatically if it does not exist + * yet (i.e. has no id). + * @param string|null $invoiceId The external id of the invoice. + * @param string|null $paymentReference A reference text for the payment. + * + * @return Payout The resulting object of the Payout resource. + * + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + */ + public function payout( + $amount, + $currency, + $paymentType, + $returnUrl, + $customer = null, + $orderId = null, + $metadata = null, + $basket = null, + $invoiceId = null, + $paymentReference = null + ): AbstractTransactionType; + + /** + * Performs a Cancellation transaction and returns the resulting Cancellation object. + * Performs a full cancel if the parameter amount is null. + * + * @param Authorization $authorization The Authorization to be canceled. + * @param float|null $amount The amount to be canceled. + * + * @return Cancellation The resulting Cancellation object. + * + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + */ + public function cancelAuthorization(Authorization $authorization, $amount = null): AbstractTransactionType; + + /** + * Performs a Cancellation transaction for the Authorization of the given Payment object. + * Performs a full cancel if the parameter amount is null. + * + * @param Payment|string $payment The Payment object or the id of the Payment the Authorization belongs to. + * @param float|null $amount The amount to be canceled. + * + * @return Cancellation Resulting Cancellation object. + * + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + */ + public function cancelAuthorizationByPayment($payment, $amount = null): AbstractTransactionType; + + /** + * Performs a Cancellation transaction for the given Charge and returns the resulting Cancellation object. + * Performs a full cancel if the parameter amount is null. + * + * @param Payment|string $payment The Payment object or the id of the Payment the charge belongs to. + * @param string $chargeId The id of the Charge to be canceled. + * @param float|null $amount The amount to be canceled. + * This will be sent as amountGross in case of Hire Purchase payment method. + * @param string|null $reasonCode Reason for the Cancellation ref \heidelpayPHP\Constants\CancelReasonCodes. + * @param string|null $paymentReference A reference string for the payment. + * @param float|null $amountNet The net value of the amount to be cancelled (Hire Purchase only). + * @param float|null $amountVat The vat value of the amount to be cancelled (Hire Purchase only). + * + * @return Cancellation The resulting Cancellation object. + * + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + */ + public function cancelChargeById( + $payment, + $chargeId, + float $amount = null, + string $reasonCode = null, + string $paymentReference = null, + float $amountNet = null, + float $amountVat = null + ): AbstractTransactionType; + + /** + * Performs a Cancellation transaction and returns the resulting Cancellation object. + * Performs a full cancel if the parameter amount is null. + * + * @param Charge $charge The Charge object to create the Cancellation for. + * @param float|null $amount The amount to be canceled. + * This will be sent as amountGross in case of Hire Purchase payment method. + * @param string|null $reasonCode Reason for the Cancellation ref \heidelpayPHP\Constants\CancelReasonCodes. + * @param string|null $paymentReference A reference string for the payment. + * @param float|null $amountNet The net value of the amount to be cancelled (Hire Purchase only). + * @param float|null $amountVat The vat value of the amount to be cancelled (Hire Purchase only). + * + * @return Cancellation The resulting Cancellation object. + * + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + */ + public function cancelCharge( + Charge $charge, + $amount = null, + string $reasonCode = null, + string $paymentReference = null, + float $amountNet = null, + float $amountVat = null + ): AbstractTransactionType; + + /** + * Performs a Shipment transaction and returns the resulting Shipment object. + * + * @param Payment|string $payment The Payment object the the id of the Payment to ship. + * @param string|null $invoiceId The id of the invoice in the shop. + * @param string|null $orderId The id of the order in shop. + * + * @return Shipment The resulting Shipment object. + * + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + */ + public function ship($payment, string $invoiceId = null, string $orderId = null): AbstractHeidelpayResource; + + /** + * Initializes a PayPage for charge transaction and returns the PayPage resource. + * Use the id of the PayPage resource to render the embedded PayPage. + * Or redirect the client to the redirectUrl of the PayPage to show him the PayPage hosted by heidelpay. + * Please keep in mind, that payment types requiring an authorization will not be shown on the PayPage when + * initialized for charge. + * + * @param Paypage $paypage The PayPage resource to initialize. + * @param Customer|string|null $customer The optional customer object. + * Keep in mind that payment types with mandatory customer object might not be + * available to the customer if no customer resource is referenced here. + * @param Basket|null $basket The optional Basket object. + * Keep in mind that payment types with mandatory basket object might not be + * available to the customer if no basket resource is referenced here. + * @param Metadata|null $metadata The optional metadata resource. + * + * @return Paypage The updated PayPage resource. + * + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + */ + public function initPayPageCharge( + Paypage $paypage, + Customer $customer = null, + Basket $basket = null, + Metadata $metadata = null + ): Paypage; + + /** + * Initializes a PayPage for authorize transaction and returns the PayPage resource. + * Use the id of the PayPage resource to render the embedded PayPage. + * Or redirect the client to the redirectUrl of the PayPage to show him the PayPage hosted by heidelpay. + * Please keep in mind, that payment types requiring a charge transaction will not be shown on the PayPage when + * initialized for authorize. + * + * @param Paypage $paypage The PayPage resource to initialize. + * @param Customer|string|null $customer The optional customer object. + * Keep in mind that payment types with mandatory customer object might not be + * available to the customer if no customer resource is referenced here. + * @param Basket|null $basket The optional Basket object. + * Keep in mind that payment types with mandatory basket object might not be + * available to the customer if no basket resource is referenced here. + * @param Metadata|null $metadata The optional metadata resource. + * + * @return Paypage The updated PayPage resource. + * + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + */ + public function initPayPageAuthorize( + Paypage $paypage, + Customer $customer = null, + Basket $basket = null, + Metadata $metadata = null + ): Paypage; + + /** + * Returns an InstallmentPlans object containing all available instalment plans. + * + * @param float $amount The amount to be charged via FlexiPay Rate. + * @param string $currency The currency code of the transaction. + * @param float $effectiveInterest The effective interest rate. + * @param DateTime|null $orderDate The date the order took place, is set to today if left empty. + * + * @return InstalmentPlans|AbstractHeidelpayResource The object containing all possible instalment plans. + * + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + */ + public function fetchDirectDebitInstalmentPlans( + $amount, + $currency, + $effectiveInterest, + DateTime $orderDate = null + ); +} diff --git a/src/Resources/Payment.php b/src/Resources/Payment.php index 9df4e8c0..19c89f59 100755 --- a/src/Resources/Payment.php +++ b/src/Resources/Payment.php @@ -275,7 +275,7 @@ public function getChargeByIndex($index, $lazy = false) * The Customer resource can be passed as Customer object or the Id of a Customer resource. * If the Customer object has not been created yet via API this is done automatically. * - * @param Customer|string $customer The Customer object or the id of the Customer to be referenced by the Payment. + * @param Customer|string|null $customer The Customer object or the id of the Customer to be referenced by the Payment. * * @return Payment This Payment object. * diff --git a/src/Services/PaymentService.php b/src/Services/PaymentService.php index edb3c9a2..97947aee 100755 --- a/src/Services/PaymentService.php +++ b/src/Services/PaymentService.php @@ -25,8 +25,10 @@ namespace heidelpayPHP\Services; use DateTime; +use heidelpayPHP\Constants\TransactionTypes; use heidelpayPHP\Exceptions\HeidelpayApiException; use heidelpayPHP\Heidelpay; +use heidelpayPHP\Interfaces\PaymentServiceInterface; use heidelpayPHP\Resources\AbstractHeidelpayResource; use heidelpayPHP\Resources\Basket; use heidelpayPHP\Resources\Customer; @@ -44,14 +46,11 @@ use heidelpayPHP\Resources\TransactionTypes\Shipment; use RuntimeException; -class PaymentService +class PaymentService implements PaymentServiceInterface { /** @var Heidelpay */ private $heidelpay; - /** @var ResourceService $resourceService */ - private $resourceService; - /** * PaymentService constructor. * @@ -60,14 +59,11 @@ class PaymentService public function __construct(Heidelpay $heidelpay) { $this->heidelpay = $heidelpay; - $this->resourceService = $heidelpay->getResourceService(); } - // + //heidelpay; @@ -76,50 +72,18 @@ public function getHeidelpay(): Heidelpay /** * @param Heidelpay $heidelpay * - * @return PaymentService + * @return PaymentServiceInterface */ - public function setHeidelpay(Heidelpay $heidelpay): PaymentService + public function setHeidelpay(Heidelpay $heidelpay): PaymentServiceInterface { $this->heidelpay = $heidelpay; return $this; } - /** - * @return ResourceService - */ + /** @return ResourceService */ public function getResourceService(): ResourceService { - return $this->resourceService; - } - - /** - * @param ResourceService $resourceService - * - * @return PaymentService - */ - public function setResourceService(ResourceService $resourceService): PaymentService - { - $this->resourceService = $resourceService; - return $this; - } - - // - - // - - /** - * Create a Payment object with the given properties. - * - * @param BasePaymentType|string $paymentType - * - * @return Payment The resulting Payment object. - * - * @throws HeidelpayApiException - * @throws RuntimeException - */ - private function createPayment($paymentType): AbstractHeidelpayResource - { - return (new Payment($this->heidelpay))->setPaymentType($paymentType); + return $this->getHeidelpay()->getResourceService(); } // @@ -129,27 +93,7 @@ private function createPayment($paymentType): AbstractHeidelpayResource // /** - * Perform an Authorization transaction and return the corresponding Authorization object. - * - * @param float $amount - * @param string $currency - * @param BasePaymentType|string $paymentType - * @param string $returnUrl - * @param Customer|string|null $customer - * @param string|null $orderId - * @param Metadata|string|null $metadata - * @param Basket|null $basket The Basket object corresponding to the payment. - * The Basket object will be created automatically if it does not exist - * yet (i.e. has no id). - * @param bool|null $card3ds Enables 3ds channel for credit cards if available. This parameter is - * optional and will be ignored if not applicable. - * @param string|null $invoiceId The external id of the invoice. - * @param string|null $paymentReference A reference text for the payment. - * - * @return Authorization Resulting Authorization object. - * - * @throws HeidelpayApiException - * @throws RuntimeException + * {@inheritDoc} */ public function authorize( $amount, @@ -165,69 +109,19 @@ public function authorize( $paymentReference = null ): AbstractTransactionType { $payment = $this->createPayment($paymentType); - return $this->authorizeWithPayment( - $amount, - $currency, - $payment, - $returnUrl, - $customer, - $orderId, - $metadata, - $basket, - $card3ds, - $invoiceId, - $paymentReference - ); - } + $paymentType = $payment->getPaymentType(); - /** - * Perform an authorization and return the corresponding Authorization object. - * - * @param float $amount - * @param string $currency - * @param Payment $payment - * @param string $returnUrl - * @param Customer|string|null $customer - * @param string|null $orderId - * @param Metadata|string|null $metadata - * @param Basket|null $basket The Basket object corresponding to the payment. - * The Basket object will be created automatically if it does not exist - * yet (i.e. has no id). - * @param bool|null $card3ds Enables 3ds channel for credit cards if available. This parameter is - * optional and will be ignored if not applicable. - * @param string|null $invoiceId The external id of the invoice. - * @param string|null $paymentReference A reference text for the payment. - * - * @return Authorization Resulting Authorization object. - * - * @throws HeidelpayApiException - * @throws RuntimeException - */ - public function authorizeWithPayment( - $amount, - $currency, - Payment $payment, - $returnUrl = null, - $customer = null, - $orderId = null, - $metadata = null, - $basket = null, - $card3ds = null, - $invoiceId = null, - $paymentReference = null - ): Authorization { - $basePaymentType = $payment->getPaymentType(); /** @var Authorization $authorization */ $authorization = (new Authorization($amount, $currency, $returnUrl)) ->setOrderId($orderId) ->setInvoiceId($invoiceId) ->setPaymentReference($paymentReference) - ->setSpecialParams($basePaymentType !== null ? $basePaymentType->getTransactionParams() : []); + ->setSpecialParams($paymentType !== null ? $paymentType->getTransactionParams() : []); if ($card3ds !== null) { $authorization->setCard3ds($card3ds); } $payment->setAuthorization($authorization)->setCustomer($customer)->setMetadata($metadata)->setBasket($basket); - $this->resourceService->create($authorization); + $this->getResourceService()->create($authorization); return $authorization; } @@ -236,27 +130,7 @@ public function authorizeWithPayment( // /** - * Charge the given amount and currency on the given PaymentType resource. - * - * @param float $amount - * @param string $currency - * @param BasePaymentType|string $paymentType - * @param string $returnUrl - * @param Customer|string|null $customer - * @param string|null $orderId - * @param Metadata|null $metadata The Metadata object containing custom information for the payment. - * @param Basket|null $basket The Basket object corresponding to the payment. - * The Basket object will be created automatically if it does not exist - * yet (i.e. has no id). - * @param bool|null $card3ds Enables 3ds channel for credit cards if available. This parameter is - * optional and will be ignored if not applicable. - * @param string|null $invoiceId The external id of the invoice. - * @param string|null $paymentReference A reference text for the payment. - * - * @return Charge Resulting Charge object. - * - * @throws HeidelpayApiException - * @throws RuntimeException + * {@inheritDoc} */ public function charge( $amount, @@ -284,24 +158,13 @@ public function charge( $charge->setCard3ds($card3ds); } $payment->addCharge($charge)->setCustomer($customer)->setMetadata($metadata)->setBasket($basket); - $this->resourceService->create($charge); + $this->getResourceService()->create($charge); return $charge; } /** - * Charge the given amount on the payment with the given id. - * Perform a full charge by leaving the amount null. - * - * @param string|Payment $payment - * @param float|null $amount - * @param string|null $orderId - * @param string|null $invoiceId - * - * @return Charge Resulting Charge object. - * - * @throws HeidelpayApiException - * @throws RuntimeException + * {@inheritDoc} */ public function chargeAuthorization( $payment, @@ -309,28 +172,17 @@ public function chargeAuthorization( string $orderId = null, string $invoiceId = null ): AbstractTransactionType { - $paymentResource = $this->resourceService->getPaymentResource($payment); + $paymentResource = $this->getResourceService()->getPaymentResource($payment); return $this->chargePayment($paymentResource, $amount, $orderId, $invoiceId); } /** - * Charge the given amount on the given payment object with the given currency. - * - * @param Payment $payment - * @param float|null $amount - * @param string|null $currency - * @param string|null $orderId - * @param string|null $invoiceId - * - * @return Charge Resulting Charge object. - * - * @throws HeidelpayApiException - * @throws RuntimeException + * {@inheritDoc} */ public function chargePayment( $payment, - $amount = null, - $currency = null, + float $amount = null, + string $currency = null, string $orderId = null, string $invoiceId = null ): AbstractTransactionType { @@ -343,7 +195,7 @@ public function chargePayment( $charge->setInvoiceId($invoiceId); } $payment->addCharge($charge); - $this->resourceService->create($charge); + $this->getResourceService()->create($charge); return $charge; } @@ -352,25 +204,7 @@ public function chargePayment( // /** - * Performs a Payout transaction and returns the resulting Payout resource. - * - * @param float $amount The amount to charge. - * @param string $currency The currency of the amount. - * @param string|BasePaymentType $paymentType The PaymentType object or the id of the PaymentType to use. - * @param string $returnUrl The URL used to return to the shop if the process requires leaving it. - * @param Customer|string|null $customer The Customer object or the id of the customer resource to reference. - * @param string|null $orderId A custom order id which can be set by the merchant. - * @param Metadata|null $metadata The Metadata object containing custom information for the payment. - * @param Basket|null $basket The Basket object corresponding to the payment. - * The Basket object will be created automatically if it does not exist - * yet (i.e. has no id). - * @param string|null $invoiceId The external id of the invoice. - * @param string|null $paymentReference A reference text for the payment. - * - * @return Payout The resulting object of the Payout resource. - * - * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * {@inheritDoc} */ public function payout( $amount, @@ -385,57 +219,12 @@ public function payout( $paymentReference = null ): AbstractTransactionType { $payment = $this->createPayment($paymentType); - return $this->payoutWithPayment( - $amount, - $currency, - $payment, - $returnUrl, - $customer, - $orderId, - $metadata, - $basket, - $invoiceId, - $paymentReference - ); - } - - /** - * Performs a Payout transaction and returns the resulting Payout resource. - * - * @param float $amount The amount to charge. - * @param string $currency The currency of the amount. - * @param Payment $payment The payment object associated with the payout. - * @param string $returnUrl The URL used to return to the shop if the process requires leaving it. - * @param Customer|string|null $customer The customer associated with the payout. - * @param string|null $orderId A custom order id which can be set by the merchant. - * @param Metadata|null $metadata - * @param Basket|null $basket - * @param string|null $invoiceId The external id of the invoice. - * @param string|null $paymentReference A reference text for the payment. - * - * @return Payout The resulting object of the Payout resource. - * - * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. - */ - public function payoutWithPayment( - $amount, - $currency, - Payment $payment, - $returnUrl, - $customer = null, - $orderId = null, - $metadata = null, - $basket = null, - $invoiceId = null, - $paymentReference = null - ): AbstractTransactionType { $payout = (new Payout($amount, $currency, $returnUrl)) ->setOrderId($orderId) ->setInvoiceId($invoiceId) ->setPaymentReference($paymentReference); $payment->setPayout($payout)->setCustomer($customer)->setMetadata($metadata)->setBasket($basket); - $this->resourceService->create($payout); + $this->getResourceService()->create($payout); return $payout; } @@ -445,40 +234,24 @@ public function payoutWithPayment( // /** - * Perform a Cancellation transaction with the given amount for the given Authorization. - * - * @param Authorization $authorization - * @param float|null $amount - * - * @return Cancellation Resulting Cancellation object. - * - * @throws HeidelpayApiException - * @throws RuntimeException + * {@inheritDoc} */ public function cancelAuthorization(Authorization $authorization, $amount = null): AbstractTransactionType { $cancellation = new Cancellation($amount); $cancellation->setPayment($authorization->getPayment()); $authorization->addCancellation($cancellation); - $this->resourceService->create($cancellation); + $this->getResourceService()->create($cancellation); return $cancellation; } /** - * Creates a Cancellation transaction for the given Authorization object. - * - * @param Payment|string $payment - * @param float|null $amount - * - * @return Cancellation Resulting Cancellation object. - * - * @throws HeidelpayApiException - * @throws RuntimeException + * {@inheritDoc} */ public function cancelAuthorizationByPayment($payment, $amount = null): AbstractTransactionType { - $authorization = $this->resourceService->fetchAuthorization($payment); + $authorization = $this->getResourceService()->fetchAuthorization($payment); return $this->cancelAuthorization($authorization, $amount); } @@ -487,21 +260,7 @@ public function cancelAuthorizationByPayment($payment, $amount = null): Abstract // /** - * Create a Cancellation transaction for the charge with the given id belonging to the given Payment object. - * - * @param Payment|string $payment The Payment object or the id of the Payment the charge belongs to. - * @param string $chargeId The id of the Charge to be canceled. - * @param float|null $amount The amount to be canceled. - * This will be sent as amountGross in case of Hire Purchase payment method. - * @param string|null $reasonCode Reason for the Cancellation ref \heidelpayPHP\Constants\CancelReasonCodes. - * @param string|null $paymentReference A reference string for the payment. - * @param float|null $amountNet The net value of the amount to be cancelled (Hire Purchase only). - * @param float|null $amountVat The vat value of the amount to be cancelled (Hire Purchase only). - * - * @return Cancellation Resulting Cancellation object. - * - * @throws HeidelpayApiException - * @throws RuntimeException + * {@inheritDoc} */ public function cancelChargeById( $payment, @@ -512,25 +271,12 @@ public function cancelChargeById( float $amountNet = null, float $amountVat = null ): AbstractTransactionType { - $charge = $this->resourceService->fetchChargeById($payment, $chargeId); + $charge = $this->getResourceService()->fetchChargeById($payment, $chargeId); return $this->cancelCharge($charge, $amount, $reasonCode, $paymentReference, $amountNet, $amountVat); } /** - * Create a Cancellation transaction for the given Charge resource. - * - * @param Charge $charge The Charge object to create the Cancellation for. - * @param float|null $amount The amount to be canceled. - * This will be sent as amountGross in case of Hire Purchase payment method. - * @param string|null $reasonCode Reason for the Cancellation ref \heidelpayPHP\Constants\CancelReasonCodes. - * @param string|null $paymentReference A reference string for the payment. - * @param float|null $amountNet The net value of the amount to be cancelled (Hire Purchase only). - * @param float|null $amountVat The vat value of the amount to be cancelled (Hire Purchase only). - * - * @return Cancellation Resulting Cancellation object. - * - * @throws HeidelpayApiException - * @throws RuntimeException + * {@inheritDoc} */ public function cancelCharge( Charge $charge, @@ -548,7 +294,7 @@ public function cancelCharge( ->setAmountNet($amountNet) ->setAmountVat($amountVat); $charge->addCancellation($cancellation); - $this->resourceService->create($cancellation); + $this->getResourceService()->create($cancellation); return $cancellation; } @@ -558,23 +304,14 @@ public function cancelCharge( // /** - * Creates a Shipment transaction for the given Payment object. - * - * @param Payment|string $payment - * @param string|null $invoiceId - * @param string|null $orderId - * - * @return Shipment Resulting Shipment object. - * - * @throws HeidelpayApiException - * @throws RuntimeException + * {@inheritDoc} */ public function ship($payment, string $invoiceId = null, string $orderId = null): AbstractHeidelpayResource { $shipment = new Shipment(); $shipment->setInvoiceId($invoiceId)->setOrderId($orderId); - $this->resourceService->getPaymentResource($payment)->addShipment($shipment); - $this->resourceService->create($shipment); + $this->getResourceService()->getPaymentResource($payment)->addShipment($shipment); + $this->getResourceService()->create($shipment); return $shipment; } @@ -585,53 +322,42 @@ public function ship($payment, string $invoiceId = null, string $orderId = null) // /** - * @param Paypage $paypage - * @param $action - * @param Customer $customer - * @param Basket|null $basket - * @param Metadata|null $metadata - * - * @return Paypage - * - * @throws HeidelpayApiException - * @throws RuntimeException + * {@inheritDoc} */ - public function initPayPage( + public function initPayPageCharge( Paypage $paypage, - $action, Customer $customer = null, Basket $basket = null, Metadata $metadata = null ): Paypage { - $paypage->setAction($action)->setParentResource($this->heidelpay); - $payment = $this->createPayment($paypage)->setBasket($basket)->setCustomer($customer)->setMetadata($metadata); - $this->resourceService->create($paypage->setPayment($payment)); - return $paypage; + return $this->initPayPage($paypage, TransactionTypes::CHARGE, $customer, $basket, $metadata); + } + + /** + * {@inheritDoc} + */ + public function initPayPageAuthorize( + Paypage $paypage, + Customer $customer = null, + Basket $basket = null, + Metadata $metadata = null + ): Paypage { + return $this->initPayPage($paypage, TransactionTypes::AUTHORIZATION, $customer, $basket, $metadata); } // - // + // /** - * Returns an InstallmentPlans object containing all available instalment plans. - * - * @param float $amount The amount to be charged via FlexiPay Rate. - * @param string $currency The currency code of the transaction. - * @param float $effectiveInterest The effective interest rate. - * @param DateTime|null $orderDate The date the order took place, is set to today if left empty. - * - * @return InstalmentPlans|AbstractHeidelpayResource The object containing all possible instalment plans. - * - * @throws HeidelpayApiException - * @throws RuntimeException + * {@inheritDoc} */ public function fetchDirectDebitInstalmentPlans( $amount, $currency, $effectiveInterest, DateTime $orderDate = null - ): InstalmentPlans { + ) { $hdd = (new HirePurchaseDirectDebit(null, null, null))->setParentResource($this->heidelpay); $plans = (new InstalmentPlans($amount, $currency, $effectiveInterest, $orderDate))->setParentResource($hdd); return $this->heidelpay->getResourceService()->fetch($plans); @@ -639,5 +365,54 @@ public function fetchDirectDebitInstalmentPlans( // + // + + /** + * Creates the PayPage for the requested transaction method. + * + * @param Paypage $paypage The PayPage resource to initialize. + * @param string $action The transaction type (Charge or Authorize) to create the PayPage for. + * Depending on the chosen transaction the payment types available will vary. + * @param Customer|string|null $customer The optional customer object. + * Keep in mind that payment types with mandatory customer object might not be + * available to the customer if no customer resource is referenced here. + * @param Basket|null $basket The optional Basket object. + * Keep in mind that payment types with mandatory basket object might not be + * available to the customer if no basket resource is referenced here. + * @param Metadata|null $metadata The optional metadata resource. + * + * @return Paypage The updated PayPage resource. + * + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + */ + private function initPayPage( + Paypage $paypage, + $action, + Customer $customer = null, + Basket $basket = null, + Metadata $metadata = null + ): Paypage { + $paypage->setAction($action)->setParentResource($this->heidelpay); + $payment = $this->createPayment($paypage)->setBasket($basket)->setCustomer($customer)->setMetadata($metadata); + $this->getResourceService()->create($paypage->setPayment($payment)); + return $paypage; + } + + /** + * Create a Payment object with the given properties. + * + * @param BasePaymentType|string $paymentType + * + * @return Payment The resulting Payment object. + * + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + */ + private function createPayment($paymentType): AbstractHeidelpayResource + { + return (new Payment($this->heidelpay))->setPaymentType($paymentType); + } + // } diff --git a/src/Services/ResourceService.php b/src/Services/ResourceService.php index 3fbc0673..08b1a111 100755 --- a/src/Services/ResourceService.php +++ b/src/Services/ResourceService.php @@ -73,7 +73,7 @@ class ResourceService private $heidelpay; /** - * PaymentService constructor. + * ResourceService constructor. * * @param Heidelpay $heidelpay */ @@ -82,6 +82,27 @@ public function __construct(Heidelpay $heidelpay) $this->heidelpay = $heidelpay; } + //heidelpay; + } + + /** + * @param Heidelpay $heidelpay + * + * @return ResourceService + */ + public function setHeidelpay(Heidelpay $heidelpay): ResourceService + { + $this->heidelpay = $heidelpay; + return $this; + } + + // + // /** diff --git a/test/unit/HeidelpayTest.php b/test/unit/HeidelpayTest.php index 90e08291..ed013de3 100755 --- a/test/unit/HeidelpayTest.php +++ b/test/unit/HeidelpayTest.php @@ -26,8 +26,8 @@ namespace heidelpayPHP\test\unit; use DateTime; -use heidelpayPHP\Constants\TransactionTypes; use heidelpayPHP\Heidelpay; +use heidelpayPHP\Interfaces\PaymentServiceInterface; use heidelpayPHP\Resources\Basket; use heidelpayPHP\Resources\Customer; use heidelpayPHP\Resources\Metadata; @@ -163,7 +163,7 @@ public function heidelpayShouldForwardResourceActionCallsToTheResourceService( * Verify heidelpay propagates payment actions to the payment service. * * @test - * @dataProvider heidelpayShouldForwardPaymentActionCallsToThePaymentServiceDP + * @dataProvider paymentServiceDP * * @param string $heidelpayMethod * @param array $heidelpayParams @@ -185,7 +185,7 @@ public function heidelpayShouldForwardPaymentActionCallsToThePaymentService( $paymentSrvMock->expects($this->once())->method($serviceMethod)->with(...$serviceParams); $heidelpay = new Heidelpay('s-priv-234'); - /** @var PaymentService $paymentSrvMock */ + /** @var PaymentServiceInterface $paymentSrvMock */ $heidelpay->setPaymentService($paymentSrvMock); $heidelpay->$heidelpayMethod(...$heidelpayParams); @@ -307,7 +307,7 @@ public function heidelpayShouldForwardResourceActionCallsToTheResourceServiceDP( * * @throws \Exception */ - public function heidelpayShouldForwardPaymentActionCallsToThePaymentServiceDP(): array + public function paymentServiceDP(): array { $url = 'https://dev.heidelpay.com'; $orderId = 'orderId'; @@ -329,8 +329,6 @@ public function heidelpayShouldForwardPaymentActionCallsToThePaymentServiceDP(): 'auth' => ['authorize', [1.234, 'AFN', $sofort, $url, $customer, $orderId, $metadata], 'authorize', [1.234, 'AFN', $sofort, $url, $customer, $orderId, $metadata]], 'authAlt' => ['authorize', [234.1, 'DZD', $sofort, $url], 'authorize', [234.1, 'DZD', $sofort, $url]], 'authStr' => ['authorize', [34.12, 'DKK', $paymentTypeId, $url, $customerId, $orderId], 'authorize', [34.12, 'DKK', $paymentTypeId, $url, $customerId, $orderId]], - 'authWithPayment' => ['authorizeWithPayment', [1.234, 'AFN', $payment, $url, $customer, $orderId, $metadata], 'authorizeWithPayment', [1.234, 'AFN', $payment, $url, $customer, $orderId, $metadata]], - 'authWithPaymentStr' => ['authorizeWithPayment', [34.12, 'DKK', $payment, $url, $customerId, $orderId], 'authorizeWithPayment', [34.12, 'DKK', $payment, $url, $customerId, $orderId]], 'charge' => ['charge', [1.234, 'AFN', $sofort, $url, $customer, $orderId, $metadata], 'charge', [1.234, 'AFN', $sofort, $url, $customer, $orderId, $metadata]], 'chargeAlt' => ['charge', [234.1, 'DZD', $sofort, $url], 'charge', [234.1, 'DZD', $sofort, $url]], 'chargeStr' => ['charge', [34.12, 'DKK', $paymentTypeId, $url, $customerId, $orderId], 'charge', [34.12, 'DKK', $paymentTypeId, $url, $customerId, $orderId]], @@ -350,8 +348,8 @@ public function heidelpayShouldForwardPaymentActionCallsToThePaymentServiceDP(): 'cancelChargeAlt' => ['cancelCharge', [$charge], 'cancelCharge', [$charge]], 'ship' => ['ship', [$payment], 'ship', [$payment]], 'payout' => ['payout', [123, 'EUR', $paymentTypeId, 'url', $customer, $orderId, $metadata, 'basketId'], 'payout', [123, 'EUR', $paymentTypeId, 'url', $customer, $orderId, $metadata, 'basketId']], - 'initPayPageCharge' => ['initPayPageCharge', [$paypage, $customer, $basket, $metadata], 'initPayPage', [$paypage, TransactionTypes::CHARGE, $customer, $basket, $metadata]], - 'initPayPageAuthorize' => ['initPayPageAuthorize', [$paypage, $customer, $basket, $metadata], 'initPayPage', [$paypage, TransactionTypes::AUTHORIZATION, $customer, $basket, $metadata]], + 'initPayPageCharge' => ['initPayPageCharge', [$paypage, $customer, $basket, $metadata], 'initPayPageCharge', [$paypage, $customer, $basket, $metadata]], + 'initPayPageAuthorize' => ['initPayPageAuthorize', [$paypage, $customer, $basket, $metadata], 'initPayPageAuthorize', [$paypage, $customer, $basket, $metadata]], 'fetchDDInstalmentPlans' => ['fetchDirectDebitInstalmentPlans', [123.4567, 'EUR', 4.99, $today], 'fetchDirectDebitInstalmentPlans', [123.4567, 'EUR', 4.99, $today]] ]; } diff --git a/test/unit/Services/PaymentServiceTest.php b/test/unit/Services/PaymentServiceTest.php index 96f049b6..1de3568c 100755 --- a/test/unit/Services/PaymentServiceTest.php +++ b/test/unit/Services/PaymentServiceTest.php @@ -27,6 +27,7 @@ use heidelpayPHP\Constants\TransactionTypes; use heidelpayPHP\Exceptions\HeidelpayApiException; use heidelpayPHP\Heidelpay; +use heidelpayPHP\Interfaces\PaymentServiceInterface; use heidelpayPHP\Resources\Basket; use heidelpayPHP\Resources\Customer; use heidelpayPHP\Resources\InstalmentPlans; @@ -34,6 +35,7 @@ use heidelpayPHP\Resources\Payment; use heidelpayPHP\Resources\PaymentTypes\HirePurchaseDirectDebit; use heidelpayPHP\Resources\PaymentTypes\Paypage; +use heidelpayPHP\Resources\PaymentTypes\Paypal; use heidelpayPHP\Resources\PaymentTypes\SepaDirectDebit; use heidelpayPHP\Resources\PaymentTypes\Sofort; use heidelpayPHP\Resources\TransactionTypes\Authorization; @@ -64,58 +66,20 @@ class PaymentServiceTest extends BasePaymentTest public function gettersAndSettersShouldWorkProperly() { $heidelpay = new Heidelpay('s-priv-123'); - $paymentService = new PaymentService($heidelpay); + /** @var PaymentService $paymentService */ + $paymentService = $heidelpay->getPaymentService(); $this->assertSame($heidelpay, $paymentService->getHeidelpay()); $this->assertSame($heidelpay->getResourceService(), $paymentService->getResourceService()); $heidelpay2 = new Heidelpay('s-priv-1234'); - $resourceService2 = new ResourceService($heidelpay2); - $paymentService->setResourceService($resourceService2); - $this->assertSame($heidelpay, $paymentService->getHeidelpay()); - $this->assertNotSame($heidelpay2->getResourceService(), $paymentService->getResourceService()); - $this->assertSame($resourceService2, $paymentService->getResourceService()); - $paymentService->setHeidelpay($heidelpay2); $this->assertSame($heidelpay2, $paymentService->getHeidelpay()); - $this->assertNotSame($heidelpay2->getResourceService(), $paymentService->getResourceService()); } // // - /** - * Verify authorize method calls authorize with payment. - * - * @test - * - * @throws ReflectionException - * @throws RuntimeException - * @throws HeidelpayApiException - */ - public function authorizeShouldCreatePaymentAndCallAuthorizeWithPayment() - { - $paymentType = (new Sofort())->setId('typeId'); - $customer = (new Customer())->setId('customerId'); - $metadata = (new Metadata())->setId('metadataId'); - - $paymentSrvMock = $this->getMockBuilder(PaymentService::class)->disableOriginalConstructor()->setMethods(['authorizeWithPayment'])->getMock(); - $paymentSrvMock->expects($this->exactly(4))->method('authorizeWithPayment') - ->withConsecutive( - [1.23, 'testCurrency', $this->isInstanceOf(Payment::class), 'http://return.url'], - [1.23, 'testCurrency', $this->isInstanceOf(Payment::class), 'http://return.url', $customer], - [1.23, 'testCurrency', $this->isInstanceOf(Payment::class), 'http://return.url', $customer, $metadata], - [1.23, 'testCurrency', $this->isInstanceOf(Payment::class), 'http://return.url', $customer, $metadata, 'OrderId'] - ); - - /** @var PaymentService $paymentSrvMock */ - $paymentSrvMock->setHeidelpay(new Heidelpay('s-priv-123')); - $paymentSrvMock->authorize(1.23, 'testCurrency', $paymentType, 'http://return.url'); - $paymentSrvMock->authorize(1.23, 'testCurrency', $paymentType, 'http://return.url', $customer); - $paymentSrvMock->authorize(1.23, 'testCurrency', $paymentType, 'http://return.url', $customer, $metadata); - $paymentSrvMock->authorize(1.23, 'testCurrency', $paymentType, 'http://return.url', $customer, $metadata, 'OrderId'); - } - /** * Verify authorizeWithPayment calls create for a new authorization using the passed values. * @@ -128,40 +92,34 @@ public function authorizeShouldCreatePaymentAndCallAuthorizeWithPayment() * @throws RuntimeException * @dataProvider card3dsDataProvider */ - public function authorizeWithPaymentShouldCallCreateOnResourceServiceWithANewAuthorization($card3ds) + public function authorizeShouldCreateNewAuthorizationAndPayment($card3ds) { $customer = (new Customer())->setId('myCustomerId'); $metadata = (new Metadata())->setId('myMetadataId'); $basket = (new Basket())->setId('myBasketId'); - $heidelpay = new Heidelpay('s-priv-123'); - $payment = (new Payment())->setParentResource($heidelpay)->setId('myPaymentId'); + /** @var ResourceService|MockObject $resourceSrvMock */ $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->disableOriginalConstructor()->setMethods(['create'])->getMock(); - $resourceSrvMock->expects($this->once())->method('create')->with( - $this->callback( - static function ($authorize) use ($customer, $payment, $metadata, $basket, $card3ds) { - /** @var Authorization $authorize */ - $newPayment = $authorize->getPayment(); - return $authorize instanceof Authorization && - $authorize->getAmount() === 1.234 && - $authorize->getCurrency() === 'myTestCurrency' && - $authorize->getOrderId() === 'myOrderId' && - $authorize->getReturnUrl() === 'myTestUrl' && - $authorize->isCard3ds() === $card3ds && - $newPayment instanceof Payment && - $newPayment === $payment && - $newPayment->getMetadata() === $metadata && - $newPayment->getCustomer() === $customer && - $newPayment->getBasket() === $basket && - $newPayment->getAuthorization() === $authorize; - } - ) - ); - - /** @var ResourceService $resourceSrvMock */ - $paymentSrv = (new PaymentService($heidelpay))->setResourceService($resourceSrvMock); - $returnedAuth = $paymentSrv->authorizeWithPayment(1.234, 'myTestCurrency', $payment, 'myTestUrl', $customer, 'myOrderId', $metadata, $basket, $card3ds); - $this->assertSame($payment->getAuthorization(), $returnedAuth); + $paymentSrv = (new Heidelpay('s-priv-123'))->setResourceService($resourceSrvMock)->getPaymentService(); + $resourceSrvMock->expects($this->once())->method('create') + ->with($this->callback(static function ($authorize) use ($customer, $metadata, $basket, $card3ds) { + /** @var Authorization $authorize */ + $newPayment = $authorize->getPayment(); + return $authorize instanceof Authorization && + $authorize->getAmount() === 1.234 && + $authorize->getCurrency() === 'myCurrency' && + $authorize->getOrderId() === 'myId' && + $authorize->getReturnUrl() === 'myUrl' && + $authorize->isCard3ds() === $card3ds && + $newPayment instanceof Payment && + $newPayment->getMetadata() === $metadata && + $newPayment->getCustomer() === $customer && + $newPayment->getBasket() === $basket && + $newPayment->getAuthorization() === $authorize; + })); + + $type = (new PayPal())->setId('typeId'); + $paymentSrv->authorize(1.234, 'myCurrency', $type, 'myUrl', $customer, 'myId', $metadata, $basket, $card3ds); } // @@ -180,7 +138,7 @@ static function ($authorize) use ($customer, $payment, $metadata, $basket, $card * @throws RuntimeException * @dataProvider card3dsDataProvider */ - public function chargeShouldCreateAPaymentAndCallCreateOnResourceServiceWithPayment($card3ds) + public function chargeShouldCreateNewPaymentAndCharge($card3ds) { $customer = (new Customer())->setId('myCustomerId'); $heidelpay = new Heidelpay('s-priv-123'); @@ -189,28 +147,25 @@ public function chargeShouldCreateAPaymentAndCallCreateOnResourceServiceWithPaym $basket = (new Basket())->setId('myBasketId'); $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->disableOriginalConstructor()->setMethods(['create'])->getMock(); - $resourceSrvMock->expects($this->once())->method('create')->with( - $this->callback( - static function ($charge) use ($customer, $paymentType, $basket, $card3ds) { - /** @var Charge $charge */ - $newPayment = $charge->getPayment(); - return $charge instanceof Charge && - $charge->getAmount() === 1.234 && - $charge->getCurrency() === 'myCurrency' && - $charge->getOrderId() === 'myId' && - $charge->getReturnUrl() === 'myUrl' && - $charge->isCard3ds() === $card3ds && - $newPayment instanceof Payment && - $newPayment->getCustomer() === $customer && - $newPayment->getPaymentType() === $paymentType && - $newPayment->getBasket() === $basket && - in_array($charge, $newPayment->getCharges(), true); - } - ) - ); + $resourceSrvMock->expects($this->once())->method('create') + ->with($this->callback(static function ($charge) use ($customer, $paymentType, $basket, $card3ds) { + /** @var Charge $charge */ + $newPayment = $charge->getPayment(); + return $charge instanceof Charge && + $charge->getAmount() === 1.234 && + $charge->getCurrency() === 'myCurrency' && + $charge->getOrderId() === 'myId' && + $charge->getReturnUrl() === 'myUrl' && + $charge->isCard3ds() === $card3ds && + $newPayment instanceof Payment && + $newPayment->getCustomer() === $customer && + $newPayment->getPaymentType() === $paymentType && + $newPayment->getBasket() === $basket && + in_array($charge, $newPayment->getCharges(), true); + })); /** @var ResourceService $resourceSrvMock */ - $paymentSrv = (new PaymentService($heidelpay))->setResourceService($resourceSrvMock); + $paymentSrv = $heidelpay->setResourceService($resourceSrvMock)->getPaymentService(); $returnedCharge = $paymentSrv->charge(1.234, 'myCurrency', $paymentType, 'myUrl', $customer, 'myId', $metadata, $basket, $card3ds); $this->assertSame($paymentType, $returnedCharge->getPayment()->getPaymentType()); } @@ -226,15 +181,14 @@ static function ($charge) use ($customer, $paymentType, $basket, $card3ds) { */ public function chargeAuthorizationShouldCallChargePaymentWithTheGivenPaymentObject() { - $paymentObject = (new Payment())->setId('myPaymentId'); - $paymentSrv = $this->getMockBuilder(PaymentService::class)->setMethods(['chargePayment'])->disableOriginalConstructor()->getMock(); - $paymentSrv->expects($this->exactly(2))->method('chargePayment')->withConsecutive([$paymentObject, null], [$paymentObject, 1.234]); - - /** @var PaymentService $paymentSrv */ - $paymentSrv->setResourceService(new ResourceService(new Heidelpay('s-priv-123'))); + $paymentObject = (new Payment())->setId('myPaymentId'); + /** @var PaymentService|MockObject $paymentSrvMock */ + $paymentSrvMock = $this->getMockBuilder(PaymentService::class)->setMethods(['chargePayment'])->disableOriginalConstructor()->getMock(); + $paymentSrvMock->expects($this->exactly(2))->method('chargePayment')->withConsecutive([$paymentObject, null], [$paymentObject, 1.234]); - $paymentSrv->chargeAuthorization($paymentObject); - $paymentSrv->chargeAuthorization($paymentObject, 1.234); + $paymentSrvMock->setHeidelpay((new Heidelpay('s-priv-123'))->setPaymentService($paymentSrvMock)); + $paymentSrvMock->chargeAuthorization($paymentObject); + $paymentSrvMock->chargeAuthorization($paymentObject, 1.234); } /** @@ -248,17 +202,14 @@ public function chargeAuthorizationShouldCallChargePaymentWithTheGivenPaymentObj */ public function chargeAuthorizationShouldCallFetchPaymentIfThePaymentIsPassedAsIdString() { + /** @var ResourceService|MockObject $resourceSrvMock */ $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->setMethods(['fetchPayment'])->disableOriginalConstructor()->getMock(); $resourceSrvMock->expects($this->once())->method('fetchPayment')->willReturn(new Payment()); - - $paymentSrvMock = $this->getMockBuilder(PaymentService::class)->setMethods(['chargePayment'])->disableOriginalConstructor()->getMock(); + /** @var PaymentService|MockObject $paymentSrvMock */ + $paymentSrvMock = $this->getMockBuilder(PaymentService::class)->setMethods(['chargePayment', 'getResourceService'])->disableOriginalConstructor()->getMock(); $paymentSrvMock->expects($this->once())->method('chargePayment')->withAnyParameters(); + $paymentSrvMock->expects(self::once())->method('getResourceService')->willReturn($resourceSrvMock); - /** - * @var PaymentService $paymentSrvMock - * @var ResourceService $resourceSrvMock - */ - $paymentSrvMock->setResourceService($resourceSrvMock); $paymentSrvMock->chargeAuthorization('myPaymentId'); } @@ -276,24 +227,21 @@ public function chargePaymentShouldCallCreateOnResourceServiceWithNewCharge() $heidelpay = new Heidelpay('s-priv-123'); $payment = (new Payment())->setParentResource($heidelpay)->setId('myPaymentId'); + /** @var ResourceService|MockObject $resourceSrvMock */ $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->disableOriginalConstructor()->setMethods(['create'])->getMock(); - $resourceSrvMock->expects($this->once())->method('create')->with( - $this->callback( - static function ($charge) use ($payment) { - /** @var Charge $charge */ - $newPayment = $charge->getPayment(); - return $charge instanceof Charge && - $charge->getAmount() === 1.234 && - $charge->getCurrency() === 'myTestCurrency' && - $newPayment instanceof Payment && - $newPayment === $payment && - in_array($charge, $newPayment->getCharges(), true); - } - ) - ); - - /** @var ResourceService $resourceSrvMock */ - $paymentSrv = (new PaymentService($heidelpay))->setResourceService($resourceSrvMock); + $resourceSrvMock->expects($this->once())->method('create') + ->with($this->callback(static function ($charge) use ($payment) { + /** @var Charge $charge */ + $newPayment = $charge->getPayment(); + return $charge instanceof Charge && + $charge->getAmount() === 1.234 && + $charge->getCurrency() === 'myTestCurrency' && + $newPayment instanceof Payment && + $newPayment === $payment && + in_array($charge, $newPayment->getCharges(), true); + })); + + $paymentSrv = $heidelpay->setResourceService($resourceSrvMock)->getPaymentService(); $returnedCharge = $paymentSrv->chargePayment($payment, 1.234, 'myTestCurrency'); $this->assertArraySubset([$returnedCharge], $payment->getCharges()); } @@ -317,23 +265,20 @@ public function cancelAuthorizationShouldCallCreateOnResourceServiceWithNewCance $payment = (new Payment())->setParentResource($heidelpay)->setId('myPaymentId'); $authorization = (new Authorization())->setPayment($payment)->setId('s-aut-1'); + /** @var ResourceService|MockObject $resourceSrvMock */ $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->disableOriginalConstructor()->setMethods(['create'])->getMock(); - $resourceSrvMock->expects($this->once())->method('create')->with( - $this->callback( - static function ($cancellation) use ($authorization, $payment) { - /** @var Cancellation $cancellation */ - $newPayment = $cancellation->getPayment(); - return $cancellation instanceof Cancellation && - $cancellation->getAmount() === 12.122 && - $newPayment instanceof Payment && - $newPayment === $payment && - in_array($cancellation, $authorization->getCancellations(), true); - } - ) - ); - - /** @var ResourceService $resourceSrvMock */ - $paymentSrv = (new PaymentService($heidelpay))->setResourceService($resourceSrvMock); + $resourceSrvMock->expects($this->once())->method('create') + ->with($this->callback(static function ($cancellation) use ($authorization, $payment) { + /** @var Cancellation $cancellation */ + $newPayment = $cancellation->getPayment(); + return $cancellation instanceof Cancellation && + $cancellation->getAmount() === 12.122 && + $newPayment instanceof Payment && + $newPayment === $payment && + in_array($cancellation, $authorization->getCancellations(), true); + })); + + $paymentSrv = $heidelpay->setResourceService($resourceSrvMock)->getPaymentService(); $returnedCancellation = $paymentSrv->cancelAuthorization($authorization, 12.122); $this->assertArraySubset([$returnedCancellation], $authorization->getCancellations()); } @@ -350,23 +295,16 @@ static function ($cancellation) use ($authorization, $payment) { public function cancelAuthorizationByPaymentShouldCallCancelAuthorization() { $authorization = (new Authorization())->setId('s-aut-1'); + $heidelpay = new Heidelpay('s-priv-1234'); + /** @var ResourceService|MockObject $resourceSrvMock */ $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->setMethods(['fetchAuthorization'])->disableOriginalConstructor()->getMock(); $resourceSrvMock->expects($this->exactly(2))->method('fetchAuthorization')->willReturn($authorization); - + /** @var PaymentService|MockObject $paymentSrvMock */ $paymentSrvMock = $this->getMockBuilder(PaymentService::class)->setMethods(['cancelAuthorization'])->disableOriginalConstructor()->getMock(); - $paymentSrvMock->expects($this->exactly(2))->method('cancelAuthorization')->withConsecutive( - [$authorization, null], - [$authorization, 1.123] - ); - - /** - * @var PaymentService $paymentSrvMock - * @var ResourceService $resourceSrvMock - */ - $paymentSrvMock->setResourceService($resourceSrvMock); - - /** @var PaymentService $paymentSrvMock */ + $paymentSrvMock->expects($this->exactly(2))->method('cancelAuthorization')->withConsecutive([$authorization, null], [$authorization, 1.123]); + $heidelpay->setResourceService($resourceSrvMock)->setPaymentService($paymentSrvMock); + $paymentSrvMock->cancelAuthorizationByPayment(new Payment()); $paymentSrvMock->cancelAuthorizationByPayment(new Payment(), 1.123); } @@ -385,20 +323,14 @@ public function cancelChargeByIdShouldFetchChargeAndPropagateToCancelCharge() $payment = (new Payment())->setId('myPaymentId'); $charge = new Charge(); + /** @var ResourceService|MockObject $resourceSrvMock */ $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->setMethods(['fetchChargeById'])->disableOriginalConstructor()->getMock(); $resourceSrvMock->expects($this->exactly(2))->method('fetchChargeById')->with($payment, 's-chg-1')->willReturn($charge); - $paymentSrvMock = $this->getMockBuilder(PaymentService::class)->setMethods(['cancelCharge'])->disableOriginalConstructor()->getMock(); - $paymentSrvMock->expects($this->exactly(2))->method('cancelCharge')->withConsecutive( - [$charge], - [$charge, 10.11] - ); - - /** - * @var PaymentService $paymentSrvMock - * @var ResourceService $resourceSrvMock - */ - $paymentSrvMock->setResourceService($resourceSrvMock); + /** @var PaymentServiceInterface|MockObject $paymentSrvMock */ + $paymentSrvMock = $this->getMockBuilder(PaymentService::class)->setMethods(['cancelCharge', 'getResourceService'])->disableOriginalConstructor()->getMock(); + $paymentSrvMock->expects($this->exactly(2))->method('cancelCharge')->withConsecutive([$charge], [$charge, 10.11]); + $paymentSrvMock->expects($this->exactly(2))->method('getResourceService')->willReturn($resourceSrvMock); $paymentSrvMock->cancelChargeById($payment, 's-chg-1'); $paymentSrvMock->cancelChargeById($payment, 's-chg-1', 10.11); @@ -416,23 +348,20 @@ public function cancelChargeByIdShouldFetchChargeAndPropagateToCancelCharge() public function cancelChargeShouldCreateCancellationAndCallsCreate() { $heidelpay = new Heidelpay('s-priv-1234'); - $paymentSrv = new PaymentService($heidelpay); + $paymentSrv = $heidelpay->getPaymentService(); $payment = (new Payment())->setParentResource($heidelpay); $charge = (new Charge())->setPayment($payment); + /** @var ResourceService|MockObject $resourceSrvMock */ $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->setMethods(['create'])->disableOriginalConstructor()->getMock(); - $resourceSrvMock->expects($this->once())->method('create')->with( - $this->callback( - static function ($cancellation) use ($payment, $charge) { - return $cancellation instanceof Cancellation && - $cancellation->getAmount() === 12.22 && - $cancellation->getPayment() === $payment && - $cancellation->getParentResource() === $charge; - } - ) - ); - /** @var ResourceService $resourceSrvMock */ - $paymentSrv->setResourceService($resourceSrvMock); + $resourceSrvMock->expects($this->once())->method('create') + ->with($this->callback(static function ($cancellation) use ($payment, $charge) { + return $cancellation instanceof Cancellation && + $cancellation->getAmount() === 12.22 && + $cancellation->getPayment() === $payment && + $cancellation->getParentResource() === $charge; + })); + $heidelpay->setResourceService($resourceSrvMock); $paymentSrv->cancelCharge($charge, 12.22); } @@ -454,23 +383,19 @@ static function ($cancellation) use ($payment, $charge) { public function shipShouldCreateShipmentAndCallCreateOnResourceServiceWithIt() { $heidelpay = new Heidelpay('s-priv-1234'); - $paymentSrv = new PaymentService($heidelpay); + $paymentSrv = $heidelpay->getPaymentService(); $payment = new Payment(); + /** @var ResourceService|MockObject $resourceSrvMock */ $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->setMethods(['create', 'fetchPayment'])->disableOriginalConstructor()->getMock(); - $resourceSrvMock->expects($this->exactly(2))->method('create')->with( - $this->callback( - static function ($shipment) use ($payment) { - return $shipment instanceof Shipment && - $shipment->getPayment() === $payment && - $shipment->getParentResource() === $payment; - } - ) - ); + $resourceSrvMock->expects($this->exactly(2))->method('create') + ->with($this->callback(static function ($shipment) use ($payment) { + return $shipment instanceof Shipment && + $shipment->getPayment() === $payment && + $shipment->getParentResource() === $payment; + })); $resourceSrvMock->expects($this->once())->method('fetchPayment')->with('myPaymentId')->willReturn($payment); - - /** @var ResourceService $resourceSrvMock */ - $paymentSrv->setResourceService($resourceSrvMock); + $heidelpay->setResourceService($resourceSrvMock); $this->assertInstanceOf(Shipment::class, $paymentSrv->ship($payment)); $this->assertCount(1, $payment->getShipments()); @@ -497,21 +422,20 @@ public function payoutShouldCreatePaymentAndCallPayoutWithPayment() $customer = (new Customer())->setId('customerId'); $metadata = (new Metadata())->setId('metadataId'); - $paymentSrvMock = $this->getMockBuilder(PaymentService::class)->disableOriginalConstructor()->setMethods(['payoutWithPayment'])->getMock(); - $paymentSrvMock->expects($this->exactly(4))->method('payoutWithPayment') - ->withConsecutive( - [1.23, 'testCurrency', $this->isInstanceOf(Payment::class), 'http://return.url'], - [1.23, 'testCurrency', $this->isInstanceOf(Payment::class), 'http://return.url', $customer], - [1.23, 'testCurrency', $this->isInstanceOf(Payment::class), 'http://return.url', $customer, $metadata], - [1.23, 'testCurrency', $this->isInstanceOf(Payment::class), 'http://return.url', $customer, $metadata, 'OrderId'] - ); - - /** @var PaymentService $paymentSrvMock */ - $paymentSrvMock->setHeidelpay(new Heidelpay('s-priv-123')); - $paymentSrvMock->payout(1.23, 'testCurrency', $paymentType, 'http://return.url'); - $paymentSrvMock->payout(1.23, 'testCurrency', $paymentType, 'http://return.url', $customer); - $paymentSrvMock->payout(1.23, 'testCurrency', $paymentType, 'http://return.url', $customer, $metadata); - $paymentSrvMock->payout(1.23, 'testCurrency', $paymentType, 'http://return.url', $customer, $metadata, 'OrderId'); + /** @var ResourceService|MockObject $resourceSrvMock */ + $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->disableOriginalConstructor()->setMethods(['create'])->getMock(); + $resourceSrvMock->expects(self::once())->method('create') + ->with(self::callback(static function ($payout) use ($customer, $metadata) { + return $payout instanceof Payout && + 1.23 === $payout->getAmount() && + 'testCurrency' === $payout->getCurrency() && + $payout->getPayment() instanceof Payment && + 'http://return.url' === $payout->getReturnUrl() && + $customer === $payout->getPayment()->getCustomer() && + $metadata === $payout->getPayment()->getMetadata(); + })); + $heidelpay = (new Heidelpay('s-priv-123'))->setResourceService($resourceSrvMock); + $heidelpay->getPaymentService()->payout(1.23, 'testCurrency', $paymentType, 'http://return.url', $customer, 'OrderId', $metadata); } /** @@ -523,46 +447,50 @@ public function payoutShouldCreatePaymentAndCallPayoutWithPayment() * @throws ReflectionException * @throws RuntimeException */ - public function payoutWithPaymentShouldCallCreateOnResourceServiceWithANewPayout() + public function payoutShouldCreateNewPayout() { // we provide some fake resources with ids to avoid them to be automatically created - $customer = (new Customer())->setId('myCustomerId'); - $basket = (new Basket())->setId('myBasketId'); - $metadata = (new Metadata())->setId('myMetadataId'); + $customer = (new Customer())->setId('id-1'); + $basket = (new Basket())->setId('id-2'); + $metadata = (new Metadata())->setId('id-3'); $heidelpay = new Heidelpay('s-priv-123'); - $payment = (new Payment())->setParentResource($heidelpay)->setId('myPaymentId'); + /** @var ResourceService|MockObject $resourceSrvMock */ $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->disableOriginalConstructor()->setMethods(['create'])->getMock(); - $resourceSrvMock->expects($this->once())->method('create')->with( - $this->callback( - static function ($payout) use ($customer, $payment, $basket, $metadata) { - /** @var Payout $payout */ - $newPayment = $payout->getPayment(); - return $payout instanceof Payout && - $payout->getAmount() === 1.234 && - $payout->getCurrency() === 'myTestCurrency' && - $payout->getOrderId() === 'myOrderId' && - $payout->getReturnUrl() === 'myTestUrl' && - $newPayment instanceof Payment && - $newPayment === $payment && - $newPayment->getCustomer() === $customer && - $newPayment->getMetadata() === $metadata & - $newPayment->getBasket() === $basket && - $newPayment->getPayout() === $payout; - } - ) - ); - - /** @var ResourceService $resourceSrvMock */ - $paymentSrv = (new PaymentService($heidelpay))->setResourceService($resourceSrvMock); - $returnedPayout = $paymentSrv->payoutWithPayment(1.234, 'myTestCurrency', $payment, 'myTestUrl', $customer, 'myOrderId', $metadata, $basket); - $this->assertSame($payment->getPayout(), $returnedPayout); + $resourceSrvMock->expects($this->once())->method('create') + ->with($this->callback(static function ($payout) use ($customer, $basket, $metadata) { + /** @var Payout $payout */ + $newPayment = $payout->getPayment(); + return $payout instanceof Payout && + $payout->getAmount() === 1.234 && + $payout->getCurrency() === 'EUR' && + $payout->getOrderId() === 'id-4' && + $payout->getReturnUrl() === 'url' && + $newPayment instanceof Payment && + $newPayment->getCustomer() === $customer && + $newPayment->getMetadata() === $metadata & + $newPayment->getBasket() === $basket && + $newPayment->getPayout() === $payout; + })); + $paymentSrv = $heidelpay->setResourceService($resourceSrvMock)->getPaymentService(); + $paymentType = (new PayPal())->setId('id'); + $returnedPayout = $paymentSrv->payout(1.234, 'EUR', $paymentType, 'url', $customer, 'id-4', $metadata, $basket); + $this->assertEquals( + [ + 'amount' => 1.234, + 'currency' => 'EUR', + 'orderId' => 'id-4', + 'returnUrl' => 'url', + 'resources' => ['basketId' => 'id-2', 'customerId' => 'id-1', 'metadataId' => 'id-3', 'typeId' => 'id'] + ], $returnedPayout->expose()); } // // + /** @noinspection PhpDocRedundantThrowsInspection */ + /** * Verify initPayPage creates a payment with resources and calls create with said payment. * @@ -580,9 +508,11 @@ static function ($payout) use ($customer, $payment, $basket, $metadata) { */ public function paymentShouldBeCreatedByInitPayPage(string $action) { + $method = 'initPayPage' . $action; + /** @var ResourceService|MockObject $resourceSrvMock */ $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->setMethods(['create'])->disableOriginalConstructor()->getMock(); - $paymentSrv = (new PaymentService(new Heidelpay('s-priv-1234')))->setResourceService($resourceSrvMock); + $paymentSrv = (new Heidelpay('s-priv-1234'))->setResourceService($resourceSrvMock)->getPaymentService(); // when $paypage = new Paypage(123.4, 'CHF', 'url'); @@ -591,21 +521,18 @@ public function paymentShouldBeCreatedByInitPayPage(string $action) $metadata = (new Metadata())->setId('metadataId'); // should - $resourceSrvMock->expects($this->once())->method('create')->with( - $this->callback( - static function ($paypage) use ($basket, $customer, $metadata, $action) { - return $paypage instanceof Paypage && - $paypage->getPayment() instanceof Payment && - $basket === $paypage->getBasket() && - $customer === $paypage->getCustomer() && - $metadata === $paypage->getMetadata() && - $action === $paypage->getAction(); - } - ) - ); + $resourceSrvMock->expects($this->once())->method('create') + ->with($this->callback(static function ($paypage) use ($basket, $customer, $metadata, $action) { + return $paypage instanceof Paypage && + $paypage->getPayment() instanceof Payment && + $basket === $paypage->getBasket() && + $customer === $paypage->getCustomer() && + $metadata === $paypage->getMetadata() && + $action === $paypage->getAction(); + })); // when - $paymentSrv->initPayPage($paypage, $action, $customer, $basket, $metadata); + $paymentSrv->$method($paypage, $customer, $basket, $metadata); } // @@ -630,18 +557,15 @@ public function fetchInstalmentPlansWillCallFetchOnResourceService() $heidelpay->setResourceService($resourceSrvMock); $date = $this->getYesterdaysTimestamp(); - $resourceSrvMock->expects($this->once())->method('fetch')->with( - $this->callback( - static function ($param) use ($date) { - return $param instanceof InstalmentPlans && - $param->getAmount() === 12.23 && - $param->getCurrency() === 'EUR' && - $param->getEffectiveInterest() === 4.99 && - $param->getOrderDate() === $date->format('Y-m-d') && - $param->getParentResource() instanceof HirePurchaseDirectDebit; - } - ) - )->willReturn(new InstalmentPlans(12.23, 'EUR', 4.99, $date)); + $resourceSrvMock->expects($this->once())->method('fetch') + ->with($this->callback(static function ($param) use ($date) { + return $param instanceof InstalmentPlans && + $param->getAmount() === 12.23 && + $param->getCurrency() === 'EUR' && + $param->getEffectiveInterest() === 4.99 && + $param->getOrderDate() === $date->format('Y-m-d') && + $param->getParentResource() instanceof HirePurchaseDirectDebit; + }))->willReturn(new InstalmentPlans(12.23, 'EUR', 4.99, $date)); $heidelpay->getPaymentService()->fetchDirectDebitInstalmentPlans(12.23, 'EUR', 4.99, $date); } From ef08680c15940b8cf0ee1f2a265de08dd203f733 Mon Sep 17 00:00:00 2001 From: sixer1182 Date: Tue, 26 Nov 2019 17:50:52 +0100 Subject: [PATCH 017/101] [refactor] Fix minor issues. --- examples/CardRecurring/ReturnController.php | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/examples/CardRecurring/ReturnController.php b/examples/CardRecurring/ReturnController.php index 61f7b3e2..06b74f0c 100644 --- a/examples/CardRecurring/ReturnController.php +++ b/examples/CardRecurring/ReturnController.php @@ -65,12 +65,8 @@ function redirect($url, $merchantMessage = '', $clientMessage = '') /** @var Card $paymentType */ $paymentType = $heidelpay->fetchPaymentType($paymentTypeId); - switch (true) { - case $paymentType->isRecurring(): - redirect(SUCCESS_URL); - break; - default: - break; + if ($paymentType->isRecurring()) { + redirect(SUCCESS_URL); } } catch (HeidelpayApiException $e) { From d49e7ae2cba9953ca76b2c544bc20e2945931be5 Mon Sep 17 00:00:00 2001 From: sixer1182 Date: Tue, 26 Nov 2019 18:02:55 +0100 Subject: [PATCH 018/101] [refactor] Fix minor issues. --- src/Heidelpay.php | 56 +++++++-------- src/Resources/AbstractHeidelpayResource.php | 8 +-- src/Resources/Payment.php | 30 ++++---- src/Resources/PaymentTypes/Paypage.php | 7 +- .../AbstractTransactionType.php | 4 +- .../TransactionTypes/Authorization.php | 4 +- src/Resources/TransactionTypes/Charge.php | 4 +- src/Services/ResourceService.php | 32 ++++----- src/Services/ValueService.php | 2 + src/Services/WebhookService.php | 32 ++++----- src/Traits/CanAuthorize.php | 4 +- src/Traits/CanDirectCharge.php | 4 +- src/Traits/CanDirectChargeWithCustomer.php | 4 +- src/Traits/CanPayout.php | 4 +- src/Traits/CanPayoutWithCustomer.php | 4 +- src/Traits/HasCancellations.php | 4 +- test/BasePaymentTest.php | 12 ++-- test/integration/BasketTest.php | 20 +++--- test/integration/CustomerTest.php | 72 +++++++++---------- test/integration/ExceptionTest.php | 4 +- test/integration/PaymentCancelTest.php | 68 +++++++++--------- test/integration/PaymentTest.php | 36 +++++----- test/integration/PaymentTypes/CardTest.php | 56 +++++++-------- test/integration/PaymentTypes/EPSTest.php | 16 ++--- test/integration/PaymentTypes/GiropayTest.php | 16 ++--- .../HirePurchaseDirectDebitTest.php | 28 ++++---- test/integration/PaymentTypes/IdealTest.php | 16 ++--- .../PaymentTypes/InvoiceFactoringTest.php | 52 +++++++------- test/integration/PaymentTypes/InvoiceTest.php | 28 ++++---- .../PaymentTypes/PrepaymentTest.php | 20 +++--- .../PaymentTypes/Przelewy24Test.php | 16 ++--- .../SepaDirectDebitGuaranteedTest.php | 20 +++--- .../PaymentTypes/SepaDirectDebitTest.php | 20 +++--- test/integration/SetMetadataTest.php | 8 +-- .../TransactionTypes/AuthorizationTest.php | 20 +++--- .../CancelAfterAuthorizationTest.php | 16 ++--- .../CancelAfterChargeTest.php | 16 ++--- .../TransactionTypes/CancelTest.php | 4 +- .../TransactionTypes/ChargeTest.php | 12 ++-- .../TransactionTypes/PayoutTest.php | 12 ++-- .../TransactionTypes/ShipmentTest.php | 4 +- test/integration/WebhookTest.php | 28 ++++---- test/unit/Resources/CustomerTest.php | 2 +- test/unit/Resources/PaymentTest.php | 52 +++++++------- .../Resources/PaymentTypes/PayPageTest.php | 10 +-- .../TransactionTypes/AuthorizationTest.php | 4 +- .../TransactionTypes/ShipmentTest.php | 4 +- test/unit/Services/PaymentServiceTest.php | 6 +- test/unit/Services/ResourceServiceTest.php | 16 ++--- test/unit/Traits/CanRecurTest.php | 4 +- test/unit/Traits/TraitDummyCanRecur.php | 4 +- 51 files changed, 462 insertions(+), 463 deletions(-) diff --git a/src/Heidelpay.php b/src/Heidelpay.php index 4d4b2fcc..b1754d2b 100755 --- a/src/Heidelpay.php +++ b/src/Heidelpay.php @@ -348,8 +348,8 @@ public function fetchResource(AbstractHeidelpayResource $resource): AbstractHeid * * @return mixed * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function activateRecurringPayment($paymentType, $returnUrl) { @@ -420,8 +420,8 @@ public function fetchKeypair($detailed = false): AbstractHeidelpayResource * * @return Metadata The fetched Metadata resource. * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function createMetadata($metadata): Metadata { @@ -435,8 +435,8 @@ public function createMetadata($metadata): Metadata * * @return Metadata The fetched Metadata resource. * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function fetchMetadata($metadata): Metadata { @@ -454,8 +454,8 @@ public function fetchMetadata($metadata): Metadata * * @return Basket The created Basket object. * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function createBasket(Basket $basket): Basket { @@ -469,8 +469,8 @@ public function createBasket(Basket $basket): Basket * * @return Basket The fetched Basket object. * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function fetchBasket($basket): Basket { @@ -484,8 +484,8 @@ public function fetchBasket($basket): Basket * * @return Basket The updated Basket object. * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function updateBasket(Basket $basket): Basket { @@ -817,8 +817,8 @@ public function fetchPayout($payment): AbstractHeidelpayResource * * @return Webhook * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function createWebhook(string $url, string $event): Webhook { @@ -833,8 +833,8 @@ public function createWebhook(string $url, string $event): Webhook * * @return Webhook * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function fetchWebhook($webhook): Webhook { @@ -848,8 +848,8 @@ public function fetchWebhook($webhook): Webhook * * @return Webhook * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function updateWebhook($webhook): Webhook { @@ -863,8 +863,8 @@ public function updateWebhook($webhook): Webhook * * @return AbstractHeidelpayResource|Webhook|null * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function deleteWebhook($webhook) { @@ -876,8 +876,8 @@ public function deleteWebhook($webhook) * * @return array * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function fetchAllWebhooks(): array { @@ -887,8 +887,8 @@ public function fetchAllWebhooks(): array /** * Deletes all registered webhooks. * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function deleteAllWebhooks() { @@ -903,8 +903,8 @@ public function deleteAllWebhooks() * * @return array * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function registerMultipleWebhooks(string $url, array $events): array { @@ -918,8 +918,8 @@ public function registerMultipleWebhooks(string $url, array $events): array * * @return AbstractHeidelpayResource * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function fetchResourceFromEvent($eventJson = null): AbstractHeidelpayResource { diff --git a/src/Resources/AbstractHeidelpayResource.php b/src/Resources/AbstractHeidelpayResource.php index ec18fcd9..5a39e0e8 100755 --- a/src/Resources/AbstractHeidelpayResource.php +++ b/src/Resources/AbstractHeidelpayResource.php @@ -299,8 +299,8 @@ private function getResourceService(): ResourceService * * @return AbstractHeidelpayResource * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ protected function getResource(AbstractHeidelpayResource $resource): AbstractHeidelpayResource { @@ -312,8 +312,8 @@ protected function getResource(AbstractHeidelpayResource $resource): AbstractHei * * @param AbstractHeidelpayResource $resource * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ protected function fetchResource(AbstractHeidelpayResource $resource) { diff --git a/src/Resources/Payment.php b/src/Resources/Payment.php index 7a0722c8..c01f07f5 100755 --- a/src/Resources/Payment.php +++ b/src/Resources/Payment.php @@ -374,8 +374,8 @@ public function getMetadata() * * @return Payment * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function setMetadata($metadata): Payment { @@ -408,8 +408,8 @@ public function getBasket() * * @return Payment * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function setBasket($basket): Payment { @@ -744,8 +744,8 @@ public function cancelAmount( * * @return array * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. * * @deprecated since 1.2.3.0 * @see Payment::cancelAmount() @@ -778,8 +778,8 @@ public function cancelAllCharges(): array * * @return array * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. * * @deprecated since 1.2.3.0 * @see Payment::cancelAuthorizationAmount() @@ -805,8 +805,8 @@ public function cancelAuthorization($amount = null): array * * @return Cancellation|null * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function cancelAuthorizationAmount($amount = null) { @@ -850,7 +850,7 @@ public function cancelAuthorizationAmount($amount = null) * @param null $amount The amount to be charged. * @param null $currency The currency of the charged amount. * - * @return Charge The resulting Charge object. + * @return Charge|AbstractHeidelpayResource The resulting Charge object. * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. @@ -883,8 +883,8 @@ public function ship($invoiceId = null, $orderId = null) /** * @param array $transactions * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ private function updateResponseTransactions(array $transactions = []) { @@ -924,8 +924,8 @@ private function updateResponseTransactions(array $transactions = []) * * @param $resources * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ private function updateResponseResources($resources) { diff --git a/src/Resources/PaymentTypes/Paypage.php b/src/Resources/PaymentTypes/Paypage.php index 4f105065..a134c8cb 100644 --- a/src/Resources/PaymentTypes/Paypage.php +++ b/src/Resources/PaymentTypes/Paypage.php @@ -578,11 +578,8 @@ protected function getResourcePath(): string * {@inheritDoc} * Map external name of property to internal name of property. * - * @param stdClass $response - * @param string $method - * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function handleResponse(stdClass $response, $method = HttpAdapterInterface::REQUEST_GET) { diff --git a/src/Resources/TransactionTypes/AbstractTransactionType.php b/src/Resources/TransactionTypes/AbstractTransactionType.php index c0f6ce9c..f325f77f 100755 --- a/src/Resources/TransactionTypes/AbstractTransactionType.php +++ b/src/Resources/TransactionTypes/AbstractTransactionType.php @@ -154,8 +154,8 @@ public function getMessage(): Message /** * {@inheritDoc} * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function handleResponse(stdClass $response, $method = HttpAdapterInterface::REQUEST_GET) { diff --git a/src/Resources/TransactionTypes/Authorization.php b/src/Resources/TransactionTypes/Authorization.php index 57147c8d..b556b597 100755 --- a/src/Resources/TransactionTypes/Authorization.php +++ b/src/Resources/TransactionTypes/Authorization.php @@ -279,8 +279,8 @@ public function cancel($amount = null): Cancellation * * @return Charge * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function charge($amount = null): Charge { diff --git a/src/Resources/TransactionTypes/Charge.php b/src/Resources/TransactionTypes/Charge.php index 339a7187..2a59478c 100755 --- a/src/Resources/TransactionTypes/Charge.php +++ b/src/Resources/TransactionTypes/Charge.php @@ -312,8 +312,8 @@ protected function getResourcePath(): string * * @return Cancellation The resulting Cancellation object. * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function cancel( $amount = null, diff --git a/src/Services/ResourceService.php b/src/Services/ResourceService.php index 08b1a111..0620bd1e 100755 --- a/src/Services/ResourceService.php +++ b/src/Services/ResourceService.php @@ -113,8 +113,8 @@ public function setHeidelpay(Heidelpay $heidelpay): ResourceService * * @return stdClass * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function send( AbstractHeidelpayResource $resource, @@ -133,8 +133,8 @@ public function send( * * @return AbstractHeidelpayResource * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function getResource(AbstractHeidelpayResource $resource): AbstractHeidelpayResource { @@ -220,9 +220,8 @@ public function fetchResourceByUrl($url) * * @return AbstractHeidelpayResource * - * @throws HeidelpayApiException - * @throws RuntimeException - * @throws Exception + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function create(AbstractHeidelpayResource $resource): AbstractHeidelpayResource { @@ -249,8 +248,8 @@ public function create(AbstractHeidelpayResource $resource): AbstractHeidelpayRe * * @return AbstractHeidelpayResource * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. * @throws Exception */ public function update(AbstractHeidelpayResource $resource): AbstractHeidelpayResource @@ -272,8 +271,8 @@ public function update(AbstractHeidelpayResource $resource): AbstractHeidelpayRe * * @return AbstractHeidelpayResource|null * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function delete(AbstractHeidelpayResource &$resource) { @@ -297,9 +296,10 @@ public function delete(AbstractHeidelpayResource &$resource) * * @return AbstractHeidelpayResource * - * @throws HeidelpayApiException - * @throws RuntimeException - * @throws Exception + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * + * todo create and call local fetch method */ public function fetch(AbstractHeidelpayResource $resource): AbstractHeidelpayResource { @@ -381,8 +381,8 @@ public function createRecurring($paymentType, $returnUrl): Recurring * * @return AbstractHeidelpayResource|Payment * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function getPaymentResource($payment) { diff --git a/src/Services/ValueService.php b/src/Services/ValueService.php index 5a1d159a..157564b2 100644 --- a/src/Services/ValueService.php +++ b/src/Services/ValueService.php @@ -24,6 +24,8 @@ */ namespace heidelpayPHP\Services; +use function is_float; + class ValueService { /** diff --git a/src/Services/WebhookService.php b/src/Services/WebhookService.php index 4e18b2c7..ef5cb9a0 100755 --- a/src/Services/WebhookService.php +++ b/src/Services/WebhookService.php @@ -103,8 +103,8 @@ public function setResourceService(ResourceService $resourceService): WebhookSer * * @return Webhook * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function createWebhook(string $url, string $event): Webhook { @@ -122,8 +122,8 @@ public function createWebhook(string $url, string $event): Webhook * * @return Webhook * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function fetchWebhook($webhook): Webhook { @@ -145,8 +145,8 @@ public function fetchWebhook($webhook): Webhook * * @return Webhook * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function updateWebhook($webhook): Webhook { @@ -162,8 +162,8 @@ public function updateWebhook($webhook): Webhook * * @return Webhook|AbstractHeidelpayResource|null * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function deleteWebhook($webhook) { @@ -183,8 +183,8 @@ public function deleteWebhook($webhook) /** * Fetches all registered webhook events and returns them in an array. * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function fetchWebhooks(): array { @@ -199,8 +199,8 @@ public function fetchWebhooks(): array /** * Deletes all registered webhooks. * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function deleteWebhooks() { @@ -217,8 +217,8 @@ public function deleteWebhooks() * * @return array * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function createWebhooks(string $url, array $events): array { @@ -241,8 +241,8 @@ public function createWebhooks(string $url, array $events): array * * @return AbstractHeidelpayResource * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function fetchResourceByWebhookEvent($eventJson = null): AbstractHeidelpayResource { diff --git a/src/Traits/CanAuthorize.php b/src/Traits/CanAuthorize.php index 9e7402cd..159d4847 100755 --- a/src/Traits/CanAuthorize.php +++ b/src/Traits/CanAuthorize.php @@ -54,8 +54,8 @@ trait CanAuthorize * * @return Authorization * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function authorize( $amount, diff --git a/src/Traits/CanDirectCharge.php b/src/Traits/CanDirectCharge.php index f5fc821f..0555e5e5 100755 --- a/src/Traits/CanDirectCharge.php +++ b/src/Traits/CanDirectCharge.php @@ -54,8 +54,8 @@ trait CanDirectCharge * * @return Charge * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function charge( $amount, diff --git a/src/Traits/CanDirectChargeWithCustomer.php b/src/Traits/CanDirectChargeWithCustomer.php index dc8d2c8e..cf3a6ce1 100755 --- a/src/Traits/CanDirectChargeWithCustomer.php +++ b/src/Traits/CanDirectChargeWithCustomer.php @@ -54,8 +54,8 @@ trait CanDirectChargeWithCustomer * * @return Charge * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function charge( $amount, diff --git a/src/Traits/CanPayout.php b/src/Traits/CanPayout.php index 1076a124..e393f8ab 100644 --- a/src/Traits/CanPayout.php +++ b/src/Traits/CanPayout.php @@ -52,8 +52,8 @@ trait CanPayout * * @return Payout * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function payout( $amount, diff --git a/src/Traits/CanPayoutWithCustomer.php b/src/Traits/CanPayoutWithCustomer.php index 91b432d4..27100a87 100644 --- a/src/Traits/CanPayoutWithCustomer.php +++ b/src/Traits/CanPayoutWithCustomer.php @@ -50,8 +50,8 @@ trait CanPayoutWithCustomer * * @return Payout * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function payout( $amount, diff --git a/src/Traits/HasCancellations.php b/src/Traits/HasCancellations.php index 85bd484a..fb9f2272 100755 --- a/src/Traits/HasCancellations.php +++ b/src/Traits/HasCancellations.php @@ -76,8 +76,8 @@ public function addCancellation(Cancellation $cancellation): self * @param string $cancellationId * @param boolean $lazy * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. * * @return mixed */ diff --git a/test/BasePaymentTest.php b/test/BasePaymentTest.php index 2fa64e75..cdbba5c8 100755 --- a/test/BasePaymentTest.php +++ b/test/BasePaymentTest.php @@ -177,8 +177,8 @@ protected function assertPending($transaction) * * @return Basket * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function createBasket(): Basket { @@ -234,8 +234,8 @@ protected function createCardObject(string $cardNumber = '5453010000059543'): Ca * * @return Authorization * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function createCardAuthorization($amount = 100.0): Authorization { @@ -269,8 +269,8 @@ public function createPaypalAuthorization(): Authorization * * @return Charge * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function createCharge($amount = 100.0): Charge { diff --git a/test/integration/BasketTest.php b/test/integration/BasketTest.php index 970b7af1..b95c6a7a 100755 --- a/test/integration/BasketTest.php +++ b/test/integration/BasketTest.php @@ -138,8 +138,8 @@ public function basketItemWithInvalidUrlWillThrowAnError($expectException, $imag * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function basketShouldBeUpdateable() { @@ -170,8 +170,8 @@ public function basketShouldBeUpdateable() * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function authorizeTransactionsShouldPassAlongTheBasketIdIfSet() { @@ -196,8 +196,8 @@ public function authorizeTransactionsShouldPassAlongTheBasketIdIfSet() * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function chargeTransactionsShouldPassAlongTheBasketIdIfSet() { @@ -219,8 +219,8 @@ public function chargeTransactionsShouldPassAlongTheBasketIdIfSet() * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function authorizeTransactionsShouldCreateBasketIfItDoesNotExistYet() { @@ -245,8 +245,8 @@ public function authorizeTransactionsShouldCreateBasketIfItDoesNotExistYet() * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function chargeTransactionsShouldCreateBasketIfItDoesNotExistYet() { diff --git a/test/integration/CustomerTest.php b/test/integration/CustomerTest.php index 8f4e6ad1..336a2072 100755 --- a/test/integration/CustomerTest.php +++ b/test/integration/CustomerTest.php @@ -47,8 +47,8 @@ class CustomerTest extends BasePaymentTest * * @return Customer * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function minCustomerCanBeCreatedAndFetched(): Customer { @@ -84,8 +84,8 @@ public function minCustomerCanBeCreatedAndFetched(): Customer * * @return Customer * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function maxCustomerCanBeCreatedAndFetched(): Customer { @@ -104,8 +104,8 @@ public function maxCustomerCanBeCreatedAndFetched(): Customer /** * @param Customer $customer * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. * @depends maxCustomerCanBeCreatedAndFetched * @test */ @@ -116,8 +116,8 @@ public function customerCanBeFetchedById(Customer $customer) } /** - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. * @depends maxCustomerCanBeCreatedAndFetched * @test */ @@ -134,8 +134,8 @@ public function customerCanBeFetchedByCustomerId() /** * @param Customer $customer * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. * @depends maxCustomerCanBeCreatedAndFetched * @test */ @@ -149,8 +149,8 @@ public function customerCanBeFetchedByObject(Customer $customer) /** * @param Customer $customer * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. * @depends maxCustomerCanBeCreatedAndFetched * @test */ @@ -168,8 +168,8 @@ public function customerCanBeFetchedByObjectWithData(Customer $customer) * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function transactionShouldCreateAndReferenceCustomerIfItDoesNotExistYet() { @@ -194,8 +194,8 @@ public function transactionShouldCreateAndReferenceCustomerIfItDoesNotExistYet() * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function transactionShouldReferenceCustomerIfItExist() { @@ -220,8 +220,8 @@ public function transactionShouldReferenceCustomerIfItExist() * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function transactionShouldReferenceCustomerIfItExistAndItsIdHasBeenPassed() { @@ -249,8 +249,8 @@ public function transactionShouldReferenceCustomerIfItExistAndItsIdHasBeenPassed * * @param Customer $customer * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function customerShouldBeUpdatable(Customer $customer) { @@ -273,8 +273,8 @@ public function customerShouldBeUpdatable(Customer $customer) * * @param Customer $customer * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function customerShouldBeDeletableById(Customer $customer) { @@ -293,8 +293,8 @@ public function customerShouldBeDeletableById(Customer $customer) * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function customerShouldBeDeletableByObject() { @@ -316,8 +316,8 @@ public function customerShouldBeDeletableByObject() * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function apiShouldReturnErrorIfCustomerAlreadyExists() { @@ -339,8 +339,8 @@ public function apiShouldReturnErrorIfCustomerAlreadyExists() * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function customerShouldBeFetchedByCustomerIdAndUpdatedIfItAlreadyExists() { @@ -380,8 +380,8 @@ public function customerShouldBeFetchedByCustomerIdAndUpdatedIfItAlreadyExists() * * @return Customer * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function minNotRegisteredB2bCustomerCanBeCreatedAndFetched(): Customer { @@ -405,8 +405,8 @@ public function minNotRegisteredB2bCustomerCanBeCreatedAndFetched(): Customer * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function maxNotRegisteredB2bCustomerCanBeCreatedAndFetched() { @@ -432,8 +432,8 @@ public function maxNotRegisteredB2bCustomerCanBeCreatedAndFetched() * * @return Customer * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function minRegisteredB2bCustomerCanBeCreatedAndFetched(): Customer { @@ -457,8 +457,8 @@ public function minRegisteredB2bCustomerCanBeCreatedAndFetched(): Customer * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function maxRegisteredB2bCustomerCanBeCreatedAndFetched() { diff --git a/test/integration/ExceptionTest.php b/test/integration/ExceptionTest.php index b1859810..d0a80e75 100755 --- a/test/integration/ExceptionTest.php +++ b/test/integration/ExceptionTest.php @@ -39,8 +39,8 @@ class ExceptionTest extends BasePaymentTest * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function apiExceptionShouldHoldClientMessage() { diff --git a/test/integration/PaymentCancelTest.php b/test/integration/PaymentCancelTest.php index 536dd356..b55b092a 100644 --- a/test/integration/PaymentCancelTest.php +++ b/test/integration/PaymentCancelTest.php @@ -41,8 +41,8 @@ class PaymentCancelTest extends BasePaymentTest * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function doubleCancelOnAuthorizeShouldReturnEmptyArray() { @@ -68,8 +68,8 @@ public function doubleCancelOnAuthorizeShouldReturnEmptyArray() * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function cancelOnChargeAndDoubleCancel() { @@ -96,8 +96,8 @@ public function cancelOnChargeAndDoubleCancel() * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function fullCancelOnPaymentWithAuthorizeAndMultipleChargesShouldBePossible() { @@ -127,8 +127,8 @@ public function fullCancelOnPaymentWithAuthorizeAndMultipleChargesShouldBePossib * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function partialCancelAndFullCancelOnSingleCharge() { @@ -159,8 +159,8 @@ public function partialCancelAndFullCancelOnSingleCharge() * * @throws AssertionFailedError * @throws Exception - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function partialCancelOnMultipleChargedAuthorization($amount, $numberCancels) { @@ -194,8 +194,8 @@ public function partialCancelOnMultipleChargedAuthorization($amount, $numberCanc * * @throws AssertionFailedError * @throws Exception - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function fullCancelOnAuthorize($amount) { @@ -215,8 +215,8 @@ public function fullCancelOnAuthorize($amount) * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function fullCancelOnPartCanceledAuthorize() { @@ -251,8 +251,8 @@ public function fullCancelOnPartCanceledAuthorize() * * @throws AssertionFailedError * @throws Exception - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function fullCancelOnFullyChargedAuthorize($amount) { @@ -282,8 +282,8 @@ public function fullCancelOnFullyChargedAuthorize($amount) * * @throws AssertionFailedError * @throws Exception - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function fullCancelOnPartlyChargedAuthorizeShouldBePossible($amount) { @@ -310,8 +310,8 @@ public function fullCancelOnPartlyChargedAuthorizeShouldBePossible($amount) * * @throws AssertionFailedError * @throws Exception - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function partCancelOnUnchargedAuthorize() { @@ -333,8 +333,8 @@ public function partCancelOnUnchargedAuthorize() * * @throws AssertionFailedError * @throws Exception - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function partCancelOnPartlyChargedAuthorizeWithAmountLtCharged() { @@ -361,8 +361,8 @@ public function partCancelOnPartlyChargedAuthorizeWithAmountLtCharged() * * @throws AssertionFailedError * @throws Exception - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function partCancelOnPartlyChargedAuthorizeWithAmountGtCharged() { @@ -392,8 +392,8 @@ public function partCancelOnPartlyChargedAuthorizeWithAmountGtCharged() * * @throws AssertionFailedError * @throws Exception - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function fullCancelOnInitialInvoiceCharge($amount) { @@ -417,8 +417,8 @@ public function fullCancelOnInitialInvoiceCharge($amount) * * @throws AssertionFailedError * @throws Exception - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function partCancelOnInitialInvoiceChargeShouldBePossible() { @@ -442,8 +442,8 @@ public function partCancelOnInitialInvoiceChargeShouldBePossible() * * @throws AssertionFailedError * @throws Exception - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function cancelMoreThanWasCharged() { @@ -465,8 +465,8 @@ public function cancelMoreThanWasCharged() * * @throws AssertionFailedError * @throws Exception - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function secondCancelExceedsRemainderOfPartlyCancelledCharge() { @@ -500,8 +500,8 @@ public function secondCancelExceedsRemainderOfPartlyCancelledCharge() * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function cancellationShouldWorkWithAllParametersSet() { diff --git a/test/integration/PaymentTest.php b/test/integration/PaymentTest.php index 30fcb8be..16ce7326 100755 --- a/test/integration/PaymentTest.php +++ b/test/integration/PaymentTest.php @@ -41,8 +41,8 @@ class PaymentTest extends BasePaymentTest * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function paymentShouldBeFetchableById() { @@ -60,8 +60,8 @@ public function paymentShouldBeFetchableById() * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function fullChargeShouldBePossibleOnPaymentObject() { @@ -86,8 +86,8 @@ public function fullChargeShouldBePossibleOnPaymentObject() * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function paymentShouldBeFetchableWithCharges() { @@ -116,8 +116,8 @@ public function paymentShouldBeFetchableWithCharges() * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function partialChargeAfterAuthorization() { @@ -134,8 +134,8 @@ public function partialChargeAfterAuthorization() * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function authorizationShouldBePossibleOnHeidelpayObject() { @@ -151,8 +151,8 @@ public function authorizationShouldBePossibleOnHeidelpayObject() * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function paymentChargeOnAuthorizeShouldBePossibleUsingPaymentId() { @@ -168,8 +168,8 @@ public function paymentChargeOnAuthorizeShouldBePossibleUsingPaymentId() * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function paymentChargeOnAuthorizeShouldTakeResourceIds() { @@ -185,8 +185,8 @@ public function paymentChargeOnAuthorizeShouldTakeResourceIds() * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function chargePaymentShouldThrowErrorOnNonPaymentId() { @@ -200,8 +200,8 @@ public function chargePaymentShouldThrowErrorOnNonPaymentId() * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function apiShouldReturnErrorIfOrderIdAlreadyExists() { diff --git a/test/integration/PaymentTypes/CardTest.php b/test/integration/PaymentTypes/CardTest.php index d66e392c..302db300 100755 --- a/test/integration/PaymentTypes/CardTest.php +++ b/test/integration/PaymentTypes/CardTest.php @@ -53,8 +53,8 @@ class CardTest extends BasePaymentTest * @return BasePaymentType * * @throws Exception - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function cardShouldBeCreatable(string $cardNumber, CardDetails $expectedCardDetails): BasePaymentType { @@ -95,8 +95,8 @@ public function cardWith3dsFlagShouldSetItAlsoInTransactions() * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function cardCanPerformAuthorizationAndCreatesPayment() { @@ -129,8 +129,8 @@ public function cardCanPerformAuthorizationAndCreatesPayment() * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function cardCanPerformChargeAndCreatesPaymentObject() { @@ -171,8 +171,8 @@ public function cardCanPerformChargeAndCreatesPaymentObject() * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function cardCanBeFetched() { @@ -194,8 +194,8 @@ public function cardCanBeFetched() * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function fullChargeAfterAuthorize() { @@ -225,8 +225,8 @@ public function fullChargeAfterAuthorize() * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function partialChargeAfterAuthorization() { @@ -270,8 +270,8 @@ public function partialChargeAfterAuthorization() * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function exceptionShouldBeThrownWhenChargingMoreThenAuthorized() { @@ -298,8 +298,8 @@ public function exceptionShouldBeThrownWhenChargingMoreThenAuthorized() * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function partialAndFullChargeAfterAuthorization() { @@ -328,8 +328,8 @@ public function partialAndFullChargeAfterAuthorization() * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function authorizationShouldBeFetchable() { @@ -346,8 +346,8 @@ public function authorizationShouldBeFetchable() /** * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function fullCancelAfterCharge() { @@ -370,8 +370,8 @@ public function fullCancelAfterCharge() * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function fullCancelOnFullyChargedPayment() { @@ -404,8 +404,8 @@ public function fullCancelOnFullyChargedPayment() * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function fullCancelOnPartlyPaidAuthWithCanceledCharges() { @@ -436,8 +436,8 @@ public function fullCancelOnPartlyPaidAuthWithCanceledCharges() * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function cardChargeCanBeCanceled() { @@ -455,8 +455,8 @@ public function cardChargeCanBeCanceled() * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function cardAuthorizeCanBeCanceled() { diff --git a/test/integration/PaymentTypes/EPSTest.php b/test/integration/PaymentTypes/EPSTest.php index 29cda0d6..28d79162 100755 --- a/test/integration/PaymentTypes/EPSTest.php +++ b/test/integration/PaymentTypes/EPSTest.php @@ -41,8 +41,8 @@ class EPSTest extends BasePaymentTest * * @return EPS * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function epsShouldBeCreatable(): EPS { @@ -68,8 +68,8 @@ public function epsShouldBeCreatable(): EPS * * @param EPS $eps * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. * @depends epsShouldBeCreatable */ public function epsShouldThrowExceptionOnAuthorize(EPS $eps) @@ -88,8 +88,8 @@ public function epsShouldThrowExceptionOnAuthorize(EPS $eps) * * @param EPS $eps * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function epsShouldBeChargeable(EPS $eps) { @@ -112,8 +112,8 @@ public function epsShouldBeChargeable(EPS $eps) * * @param EPS $eps * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function epsTypeCanBeFetched(EPS $eps) { diff --git a/test/integration/PaymentTypes/GiropayTest.php b/test/integration/PaymentTypes/GiropayTest.php index b20ced36..ce28334c 100755 --- a/test/integration/PaymentTypes/GiropayTest.php +++ b/test/integration/PaymentTypes/GiropayTest.php @@ -37,8 +37,8 @@ class GiropayTest extends BasePaymentTest * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function giroPayShouldBeCreatable() { @@ -54,8 +54,8 @@ public function giroPayShouldBeCreatable() * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function giroPayShouldThrowExceptionOnAuthorize() { @@ -71,8 +71,8 @@ public function giroPayShouldThrowExceptionOnAuthorize() * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function giroPayShouldBeChargeable() { @@ -92,8 +92,8 @@ public function giroPayShouldBeChargeable() * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function giroPayCanBeFetched() { diff --git a/test/integration/PaymentTypes/HirePurchaseDirectDebitTest.php b/test/integration/PaymentTypes/HirePurchaseDirectDebitTest.php index 1e9e43dc..4e7dad27 100755 --- a/test/integration/PaymentTypes/HirePurchaseDirectDebitTest.php +++ b/test/integration/PaymentTypes/HirePurchaseDirectDebitTest.php @@ -49,8 +49,8 @@ class HirePurchaseDirectDebitTest extends BasePaymentTest * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. * @throws Exception */ public function instalmentPlanShouldBeSelectable() @@ -89,8 +89,8 @@ public function instalmentPlanShouldBeSelectable() * @param $lastname * @param $errorCode * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function hirePurchaseDirectDebitAuthorize($firstname, $lastname, $errorCode) { @@ -122,8 +122,8 @@ public function hirePurchaseDirectDebitAuthorize($firstname, $lastname, $errorCo * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. * @throws Exception */ public function instalmentPlanSelectionWithAllFieldsSet() @@ -145,8 +145,8 @@ public function instalmentPlanSelectionWithAllFieldsSet() * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. * @throws Exception */ public function verifyChargingAnInitializedHirePurchase() @@ -173,8 +173,8 @@ public function verifyChargingAnInitializedHirePurchase() * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. * @throws Exception */ public function verifyShippingAChargedHirePurchase() @@ -205,8 +205,8 @@ public function verifyShippingAChargedHirePurchase() * * @depends verifyChargingAnInitializedHirePurchase * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. * @throws Exception * * @group skip @@ -236,8 +236,8 @@ public function verifyChargeAndFullCancelAnInitializedHirePurchase() * * @depends verifyChargingAnInitializedHirePurchase * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. * @throws Exception */ public function verifyPartlyCancelChargedHirePurchase() diff --git a/test/integration/PaymentTypes/IdealTest.php b/test/integration/PaymentTypes/IdealTest.php index d2e94e54..34230362 100755 --- a/test/integration/PaymentTypes/IdealTest.php +++ b/test/integration/PaymentTypes/IdealTest.php @@ -39,8 +39,8 @@ class IdealTest extends BasePaymentTest * * @return Ideal * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function idealShouldBeCreatable(): Ideal { @@ -59,8 +59,8 @@ public function idealShouldBeCreatable(): Ideal * * @param Ideal $ideal * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. * @depends idealShouldBeCreatable */ public function idealShouldThrowExceptionOnAuthorize(Ideal $ideal) @@ -79,8 +79,8 @@ public function idealShouldThrowExceptionOnAuthorize(Ideal $ideal) * * @param Ideal $ideal * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function idealShouldBeChargeable(Ideal $ideal) { @@ -101,8 +101,8 @@ public function idealShouldBeChargeable(Ideal $ideal) * * @param Ideal $ideal * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function idealTypeCanBeFetched(Ideal $ideal) { diff --git a/test/integration/PaymentTypes/InvoiceFactoringTest.php b/test/integration/PaymentTypes/InvoiceFactoringTest.php index 6384d1c5..c5ae9e85 100755 --- a/test/integration/PaymentTypes/InvoiceFactoringTest.php +++ b/test/integration/PaymentTypes/InvoiceFactoringTest.php @@ -43,8 +43,8 @@ class InvoiceFactoringTest extends BasePaymentTest * * @return InvoiceFactoring * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function invoiceFactoringTypeShouldBeCreatableAndFetchable(): InvoiceFactoring { @@ -67,8 +67,8 @@ public function invoiceFactoringTypeShouldBeCreatableAndFetchable(): InvoiceFact * * @param InvoiceFactoring $invoice * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. * @depends invoiceFactoringTypeShouldBeCreatableAndFetchable */ public function verifyInvoiceIsNotAuthorizable(InvoiceFactoring $invoice) @@ -87,8 +87,8 @@ public function verifyInvoiceIsNotAuthorizable(InvoiceFactoring $invoice) * * @param InvoiceFactoring $invoiceFactoring * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function invoiceFactoringShouldRequiresCustomer(InvoiceFactoring $invoiceFactoring) { @@ -105,8 +105,8 @@ public function invoiceFactoringShouldRequiresCustomer(InvoiceFactoring $invoice * * @param InvoiceFactoring $invoiceFactoring * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function invoiceFactoringRequiresBasket(InvoiceFactoring $invoiceFactoring) { @@ -129,8 +129,8 @@ public function invoiceFactoringRequiresBasket(InvoiceFactoring $invoiceFactorin * * @return Charge * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. * @throws AssertionFailedError */ public function invoiceFactoringShouldBeChargeable(InvoiceFactoring $invoiceFactoring): Charge @@ -155,8 +155,8 @@ public function invoiceFactoringShouldBeChargeable(InvoiceFactoring $invoiceFact * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. * @throws Exception */ public function verifyInvoiceFactoringIsNotShippableWoInvoiceIdOnHeidelpayObject() @@ -184,8 +184,8 @@ public function verifyInvoiceFactoringIsNotShippableWoInvoiceIdOnHeidelpayObject * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. * @throws Exception */ public function verifyInvoiceFactoringIsNotShippableWoInvoiceIdOnPaymentObject() @@ -213,8 +213,8 @@ public function verifyInvoiceFactoringIsNotShippableWoInvoiceIdOnPaymentObject() * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function verifyInvoiceFactoringShipmentWithInvoiceIdOnHeidelpayObject() { @@ -242,8 +242,8 @@ public function verifyInvoiceFactoringShipmentWithInvoiceIdOnHeidelpayObject() * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function verifyInvoiceFactoringShipmentWithInvoiceIdOnPaymentObject() { @@ -270,8 +270,8 @@ public function verifyInvoiceFactoringShipmentWithInvoiceIdOnPaymentObject() * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function verifyInvoiceFactoringShipmentWithPreSetInvoiceId() { @@ -298,8 +298,8 @@ public function verifyInvoiceFactoringShipmentWithPreSetInvoiceId() * * @param Charge $charge * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. * @depends invoiceFactoringShouldBeChargeable */ public function verifyInvoiceChargeCanBeCanceled(Charge $charge) @@ -316,8 +316,8 @@ public function verifyInvoiceChargeCanBeCanceled(Charge $charge) * * @param Charge $charge * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. * @depends invoiceFactoringShouldBeChargeable */ public function verifyInvoiceChargeCanNotBeCancelledWoAmount(Charge $charge) @@ -334,8 +334,8 @@ public function verifyInvoiceChargeCanNotBeCancelledWoAmount(Charge $charge) * * @param Charge $charge * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. * @depends invoiceFactoringShouldBeChargeable */ public function verifyInvoiceChargeCanNotBeCancelledWoReasonCode(Charge $charge) diff --git a/test/integration/PaymentTypes/InvoiceTest.php b/test/integration/PaymentTypes/InvoiceTest.php index 6f49bc44..770b6080 100755 --- a/test/integration/PaymentTypes/InvoiceTest.php +++ b/test/integration/PaymentTypes/InvoiceTest.php @@ -37,8 +37,8 @@ class InvoiceTest extends BasePaymentTest * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function invoiceTypeShouldBeCreatable() { @@ -53,8 +53,8 @@ public function invoiceTypeShouldBeCreatable() * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function verifyInvoiceIsNotAuthorizable() { @@ -71,8 +71,8 @@ public function verifyInvoiceIsNotAuthorizable() * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function verifyInvoiceIsChargeable() { @@ -88,8 +88,8 @@ public function verifyInvoiceIsChargeable() * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function verifyInvoiceIsNotShippable() { @@ -114,8 +114,8 @@ public function verifyInvoiceIsNotShippable() * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function verifyInvoiceChargeCanBeCanceled() { @@ -134,8 +134,8 @@ public function verifyInvoiceChargeCanBeCanceled() * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function verifyInvoiceChargeCanBePartlyCanceled() { @@ -160,8 +160,8 @@ public function verifyInvoiceChargeCanBePartlyCanceled() * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function invoiceTypeCanBeFetched() { diff --git a/test/integration/PaymentTypes/PrepaymentTest.php b/test/integration/PaymentTypes/PrepaymentTest.php index 15e413c8..04ce3d02 100755 --- a/test/integration/PaymentTypes/PrepaymentTest.php +++ b/test/integration/PaymentTypes/PrepaymentTest.php @@ -39,8 +39,8 @@ class PrepaymentTest extends BasePaymentTest * * @return Prepayment * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. * @test */ public function prepaymentShouldBeCreatableAndFetchable(): AbstractHeidelpayResource @@ -67,8 +67,8 @@ public function prepaymentShouldBeCreatableAndFetchable(): AbstractHeidelpayReso * * @return Charge * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function prepaymentTypeShouldBeChargeable(Prepayment $prepayment): Charge { @@ -92,8 +92,8 @@ public function prepaymentTypeShouldBeChargeable(Prepayment $prepayment): Charge * * @param Prepayment $prepayment * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function prepaymentTypeShouldNotBeAuthorizable(Prepayment $prepayment) { @@ -112,8 +112,8 @@ public function prepaymentTypeShouldNotBeAuthorizable(Prepayment $prepayment) * * @param Charge $charge * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function prepaymentTypeShouldNotBeShippable(Charge $charge) { @@ -132,8 +132,8 @@ public function prepaymentTypeShouldNotBeShippable(Charge $charge) * * @param Prepayment $prepayment * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function prepaymentChargeCanBeCanceled(Prepayment $prepayment) { diff --git a/test/integration/PaymentTypes/Przelewy24Test.php b/test/integration/PaymentTypes/Przelewy24Test.php index 8996db0c..227a7ec6 100755 --- a/test/integration/PaymentTypes/Przelewy24Test.php +++ b/test/integration/PaymentTypes/Przelewy24Test.php @@ -41,8 +41,8 @@ class Przelewy24Test extends BasePaymentTest * * @return BasePaymentType * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function przelewy24ShouldBeCreatableAndFetchable(): BasePaymentType { @@ -66,8 +66,8 @@ public function przelewy24ShouldBeCreatableAndFetchable(): BasePaymentType * * @param Przelewy24 $przelewy24 * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function przelewy24ShouldBeChargeable(Przelewy24 $przelewy24) { @@ -89,8 +89,8 @@ public function przelewy24ShouldBeChargeable(Przelewy24 $przelewy24) * * @param Przelewy24 $przelewy24 * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function przelewy24ShouldNotBeAuthorizable(Przelewy24 $przelewy24) { @@ -109,8 +109,8 @@ public function przelewy24ShouldNotBeAuthorizable(Przelewy24 $przelewy24) * * @param string $currencyCode * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function przelewy24ShouldThrowExceptionIfCurrencyIsNotSupported($currencyCode) { diff --git a/test/integration/PaymentTypes/SepaDirectDebitGuaranteedTest.php b/test/integration/PaymentTypes/SepaDirectDebitGuaranteedTest.php index b2a84b81..214f2319 100755 --- a/test/integration/PaymentTypes/SepaDirectDebitGuaranteedTest.php +++ b/test/integration/PaymentTypes/SepaDirectDebitGuaranteedTest.php @@ -38,8 +38,8 @@ class SepaDirectDebitGuaranteedTest extends BasePaymentTest * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function sepaDirectDebitGuaranteedShouldBeCreatableWithMandatoryFieldsOnly() { @@ -61,8 +61,8 @@ public function sepaDirectDebitGuaranteedShouldBeCreatableWithMandatoryFieldsOnl * * @return SepaDirectDebitGuaranteed * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function sepaDirectDebitGuaranteedShouldBeCreatable(): SepaDirectDebitGuaranteed { @@ -86,8 +86,8 @@ public function sepaDirectDebitGuaranteedShouldBeCreatable(): SepaDirectDebitGua * * @param SepaDirectDebitGuaranteed $directDebitGuaranteed * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. * @depends sepaDirectDebitGuaranteedShouldBeCreatable */ public function directDebitGuaranteedShouldProhibitAuthorization(SepaDirectDebitGuaranteed $directDebitGuaranteed) @@ -103,8 +103,8 @@ public function directDebitGuaranteedShouldProhibitAuthorization(SepaDirectDebit * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function directDebitGuaranteedShouldAllowCharge() { @@ -121,8 +121,8 @@ public function directDebitGuaranteedShouldAllowCharge() * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function ddgShouldThrowErrorIfAddressesDoNotMatch() { diff --git a/test/integration/PaymentTypes/SepaDirectDebitTest.php b/test/integration/PaymentTypes/SepaDirectDebitTest.php index 67b1bd6f..c7eeed97 100755 --- a/test/integration/PaymentTypes/SepaDirectDebitTest.php +++ b/test/integration/PaymentTypes/SepaDirectDebitTest.php @@ -39,8 +39,8 @@ class SepaDirectDebitTest extends BasePaymentTest * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function sepaDirectDebitShouldBeCreatableWithMandatoryFieldsOnly() { @@ -62,8 +62,8 @@ public function sepaDirectDebitShouldBeCreatableWithMandatoryFieldsOnly() * * @return SepaDirectDebit * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function sepaDirectDebitShouldBeCreatable(): SepaDirectDebit { @@ -89,8 +89,8 @@ public function sepaDirectDebitShouldBeCreatable(): SepaDirectDebit * * @param SepaDirectDebit $directDebit * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. * @depends sepaDirectDebitShouldBeCreatable */ public function authorizeShouldThrowException(SepaDirectDebit $directDebit) @@ -108,8 +108,8 @@ public function authorizeShouldThrowException(SepaDirectDebit $directDebit) * * @return Charge * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. * @depends sepaDirectDebitShouldBeCreatable */ public function directDebitShouldBeChargeable(SepaDirectDebit $directDebit): Charge @@ -128,8 +128,8 @@ public function directDebitShouldBeChargeable(SepaDirectDebit $directDebit): Cha * * @param Charge $charge * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. * @depends directDebitShouldBeChargeable */ public function directDebitChargeShouldBeRefundable(Charge $charge) diff --git a/test/integration/SetMetadataTest.php b/test/integration/SetMetadataTest.php index e429e86b..29a5093d 100755 --- a/test/integration/SetMetadataTest.php +++ b/test/integration/SetMetadataTest.php @@ -116,8 +116,8 @@ public function chargeShouldCreateMetadata() * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function paymentShouldFetchMetadataResourceOnFetch() { @@ -139,8 +139,8 @@ public function paymentShouldFetchMetadataResourceOnFetch() * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function emptyMetaDataShouldLeadToError() { diff --git a/test/integration/TransactionTypes/AuthorizationTest.php b/test/integration/TransactionTypes/AuthorizationTest.php index 4e2d7393..8bb29a19 100644 --- a/test/integration/TransactionTypes/AuthorizationTest.php +++ b/test/integration/TransactionTypes/AuthorizationTest.php @@ -61,8 +61,8 @@ public function authorizeWithTypeId() * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function authorizeWithType() { @@ -77,8 +77,8 @@ public function authorizeWithType() * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function authorizationProducesPaymentAndCustomer() { @@ -103,8 +103,8 @@ public function authorizationProducesPaymentAndCustomer() * * @return Authorization * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function authorizationWithCustomerId(): Authorization { @@ -150,8 +150,8 @@ public function authorizationCanBeFetched(Authorization $authorization) * @param BasePaymentType|AbstractHeidelpayResource $paymentType * @param string $expectedState The state the transaction is expected to be in. * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function authorizeHasExpectedStates(BasePaymentType $paymentType, $expectedState) { @@ -167,8 +167,8 @@ public function authorizeHasExpectedStates(BasePaymentType $paymentType, $expect * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function authorizeShouldAcceptAllParameters() { diff --git a/test/integration/TransactionTypes/CancelAfterAuthorizationTest.php b/test/integration/TransactionTypes/CancelAfterAuthorizationTest.php index b3b95bab..104bcaf5 100644 --- a/test/integration/TransactionTypes/CancelAfterAuthorizationTest.php +++ b/test/integration/TransactionTypes/CancelAfterAuthorizationTest.php @@ -64,8 +64,8 @@ public function fullCancelOnAuthorization() * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function partCancelOnPayment() { @@ -86,8 +86,8 @@ public function partCancelOnPayment() * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function partCancelOnAuthorize() { @@ -111,8 +111,8 @@ public function partCancelOnAuthorize() * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function anAuthorizationsFullReversalShallBeFetchable() { @@ -149,8 +149,8 @@ public function anAuthorizationsFullReversalShallBeFetchable() * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function anAuthorizationsReversalsShouldBeFetchable() { diff --git a/test/integration/TransactionTypes/CancelAfterChargeTest.php b/test/integration/TransactionTypes/CancelAfterChargeTest.php index 8b431c35..1bfd1d40 100644 --- a/test/integration/TransactionTypes/CancelAfterChargeTest.php +++ b/test/integration/TransactionTypes/CancelAfterChargeTest.php @@ -40,8 +40,8 @@ class CancelAfterChargeTest extends BasePaymentTest * * @return Charge * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function chargeShouldBeFetchable(): Charge { @@ -98,8 +98,8 @@ public function chargeShouldBeFullyRefundableWithId() * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function chargeShouldBePartlyRefundableWithId() { @@ -126,8 +126,8 @@ public function chargeShouldBePartlyRefundableWithId() * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function chargeShouldBePartlyRefundable() { @@ -154,8 +154,8 @@ public function chargeShouldBePartlyRefundable() * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function cancelShouldAcceptPaymentReferenceParameter() { diff --git a/test/integration/TransactionTypes/CancelTest.php b/test/integration/TransactionTypes/CancelTest.php index c688fd69..0e770269 100644 --- a/test/integration/TransactionTypes/CancelTest.php +++ b/test/integration/TransactionTypes/CancelTest.php @@ -141,8 +141,8 @@ public function chargeCancellationsShouldBeFetchableViaPaymentObject() * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function cancelStatusIsSetCorrectly() { diff --git a/test/integration/TransactionTypes/ChargeTest.php b/test/integration/TransactionTypes/ChargeTest.php index b1f55e9d..87aab679 100644 --- a/test/integration/TransactionTypes/ChargeTest.php +++ b/test/integration/TransactionTypes/ChargeTest.php @@ -76,8 +76,8 @@ public function chargeShouldWorkWithTypeObject() * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function chargeStatusIsSetCorrectly() { @@ -89,8 +89,8 @@ public function chargeStatusIsSetCorrectly() * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function chargeShouldAcceptAllParameters() { @@ -138,8 +138,8 @@ public function chargeShouldAcceptAllParameters() * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function chargeWithCustomerShouldAcceptAllParameters() { diff --git a/test/integration/TransactionTypes/PayoutTest.php b/test/integration/TransactionTypes/PayoutTest.php index cfceb176..2e42940c 100644 --- a/test/integration/TransactionTypes/PayoutTest.php +++ b/test/integration/TransactionTypes/PayoutTest.php @@ -111,8 +111,8 @@ public function payoutCanBeCalledForSepaDirectDebitGuaranteedType() * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. * @throws Exception */ public function payoutShouldBeFetchedWhenItsPaymentResourceIsFetched() @@ -133,8 +133,8 @@ public function payoutShouldBeFetchedWhenItsPaymentResourceIsFetched() * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function payoutShouldBeFetchableViaItsUrl() { @@ -152,8 +152,8 @@ public function payoutShouldBeFetchableViaItsUrl() * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function payoutShouldAcceptAllParameters() { diff --git a/test/integration/TransactionTypes/ShipmentTest.php b/test/integration/TransactionTypes/ShipmentTest.php index d1d3d671..8292ea8e 100644 --- a/test/integration/TransactionTypes/ShipmentTest.php +++ b/test/integration/TransactionTypes/ShipmentTest.php @@ -122,8 +122,8 @@ public function shipmentShouldBePossibleWithPaymentObject() * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function shipmentStatusIsSetCorrectly() { diff --git a/test/integration/WebhookTest.php b/test/integration/WebhookTest.php index 9444d681..cc8629ee 100755 --- a/test/integration/WebhookTest.php +++ b/test/integration/WebhookTest.php @@ -48,8 +48,8 @@ class WebhookTest extends BasePaymentTest * @param string $event * * @throws Exception - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function webhookResourceCanBeRegisteredAndFetched($event) { @@ -114,8 +114,8 @@ public function webhookEventShouldNotBeUpdateable() * @test * * @throws Exception - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function webhookResourceShouldBeDeletable() { @@ -136,8 +136,8 @@ public function webhookResourceShouldBeDeletable() * @test * * @throws Exception - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function webhookCreateShouldThrowErrorWhenEventIsAlreadyRegistered() { @@ -159,8 +159,8 @@ public function webhookCreateShouldThrowErrorWhenEventIsAlreadyRegistered() * @test * * @throws Exception - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function fetchWebhooksShouldReturnArrayOfRegisteredWebhooks() { @@ -195,8 +195,8 @@ public function fetchWebhooksShouldReturnArrayOfRegisteredWebhooks() * @depends webhookResourceCanBeRegisteredAndFetched * * @throws Exception - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function allWebhooksShouldBeRemovableAtOnce() { @@ -216,8 +216,8 @@ public function allWebhooksShouldBeRemovableAtOnce() * @test * @depends allWebhooksShouldBeRemovableAtOnce * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function bulkSettingWebhookEventsShouldBePossible() { @@ -246,8 +246,8 @@ public function bulkSettingWebhookEventsShouldBePossible() * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function bulkSettingOnlyOneWebhookShouldBePossible() { diff --git a/test/unit/Resources/CustomerTest.php b/test/unit/Resources/CustomerTest.php index 89d1f304..0c6d1c6f 100755 --- a/test/unit/Resources/CustomerTest.php +++ b/test/unit/Resources/CustomerTest.php @@ -276,7 +276,7 @@ static function ($customer) use ($heidelpay) { } /** - * Verify Customer can be updated. + * Verify customer can be updated. * * @test * diff --git a/test/unit/Resources/PaymentTest.php b/test/unit/Resources/PaymentTest.php index 0f3b706b..266af02a 100755 --- a/test/unit/Resources/PaymentTest.php +++ b/test/unit/Resources/PaymentTest.php @@ -131,8 +131,8 @@ public function getAuthorizationShouldNotFetchAuthorizeIfNotLazyAndAuthIsNull() * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function chargesShouldBeHandledProperly() { @@ -226,8 +226,8 @@ public function getChargeShouldFetchChargeIfItExistsAndLazyLoadingIsOff() * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function getChargeMethodsShouldReturnNullIfTheChargeIdUnknown() { @@ -299,8 +299,8 @@ public function getPayoutShouldNotFetchPayoutIfNotLazyAndPayoutIsNull() * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function setCustomerShouldDoNothingIfTheCustomerIsEmpty() { @@ -372,8 +372,8 @@ public function setCustomerShouldCreateCustomerIfItIsPassedAsObjectWithoutId() * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function setPaymentTypeShouldDoNothingIfThePaymentTypeIsEmpty() { @@ -570,8 +570,8 @@ public function getCancellationShouldReturnCancellationIfItExistsAndFetchItIfNot * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function shipmentsShouldBeHandledProperly() { @@ -656,8 +656,8 @@ public function getAndSetCurrencyShouldPropagateToTheAmountObject() * * @param integer $state * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function handleResponseShouldUpdateStateId($state) { @@ -676,8 +676,8 @@ public function handleResponseShouldUpdateStateId($state) * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function handleResponseShouldUpdatePaymentId() { @@ -696,8 +696,8 @@ public function handleResponseShouldUpdatePaymentId() * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. * @throws ReflectionException */ public function handleResponseShouldFetchCustomerIfItIsNotSet() @@ -725,8 +725,8 @@ public function handleResponseShouldFetchCustomerIfItIsNotSet() * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. * @throws ReflectionException */ public function handleResponseShouldFetchAndUpdateCustomerIfItIsAlreadySet() @@ -754,8 +754,8 @@ public function handleResponseShouldFetchAndUpdateCustomerIfItIsAlreadySet() * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. * @throws ReflectionException */ public function handleResponseShouldFetchAndUpdatePaymentTypeIfTheIdIsSet() @@ -781,8 +781,8 @@ public function handleResponseShouldFetchAndUpdatePaymentTypeIfTheIdIsSet() * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. * @throws ReflectionException */ public function handleResponseShouldFetchAndUpdateMetadataIfTheIdIsSet() @@ -804,8 +804,8 @@ public function handleResponseShouldFetchAndUpdateMetadataIfTheIdIsSet() * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. * @throws ReflectionException */ public function handleResponseShouldGetMetadataIfUnfetchedMetadataObjectWithIdIsGiven() @@ -1383,8 +1383,8 @@ public function setMetaDataShouldSetParentResourceAndCreateMetaDataObject() * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. * @throws ReflectionException */ public function metadataMustBeOfTypeMetadata() diff --git a/test/unit/Resources/PaymentTypes/PayPageTest.php b/test/unit/Resources/PaymentTypes/PayPageTest.php index 3fb9a27b..0b0114c3 100644 --- a/test/unit/Resources/PaymentTypes/PayPageTest.php +++ b/test/unit/Resources/PaymentTypes/PayPageTest.php @@ -319,8 +319,8 @@ public function paymentShouldBeFetchedWhenItIsNoGetRequest($method, $fetchCallCo * @test * * @throws Exception - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function exposeShouldSetBasicParams() { @@ -335,8 +335,8 @@ public function exposeShouldSetBasicParams() ->setMetadata($metadata) ->setCustomer($customer); $paypage = (new Paypage(123.4567, 'EUR', self::RETURN_URL)) - ->setParentResource($payment) ->setFullPageImage('full page image') + ->setParentResource($payment) ->setLogoImage('logo image') ->setShopDescription('my shop description') ->setShopName('my shop name') @@ -386,8 +386,8 @@ public function exposeShouldSetBasicParams() * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function resourcesAreNullWithoutPaymentObject() { diff --git a/test/unit/Resources/TransactionTypes/AuthorizationTest.php b/test/unit/Resources/TransactionTypes/AuthorizationTest.php index 20e4e863..1d9ba7dc 100755 --- a/test/unit/Resources/TransactionTypes/AuthorizationTest.php +++ b/test/unit/Resources/TransactionTypes/AuthorizationTest.php @@ -194,8 +194,8 @@ public function cancelShouldCallCancelAuthorizationOnHeidelpayObject() * * @param float|null $value * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function chargeShouldThrowExceptionIfPaymentIsNotSet($value) { diff --git a/test/unit/Resources/TransactionTypes/ShipmentTest.php b/test/unit/Resources/TransactionTypes/ShipmentTest.php index 0cbc1b28..e57df68c 100755 --- a/test/unit/Resources/TransactionTypes/ShipmentTest.php +++ b/test/unit/Resources/TransactionTypes/ShipmentTest.php @@ -62,8 +62,8 @@ public function gettersAndSettersShouldWorkProperly(): Shipment * @param Shipment $shipment * * @throws Exception - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. * @depends gettersAndSettersShouldWorkProperly */ public function aShipmentShouldBeUpdatedThroughResponseHandling(Shipment $shipment) diff --git a/test/unit/Services/PaymentServiceTest.php b/test/unit/Services/PaymentServiceTest.php index 1de3568c..21b9d564 100755 --- a/test/unit/Services/PaymentServiceTest.php +++ b/test/unit/Services/PaymentServiceTest.php @@ -427,10 +427,10 @@ public function payoutShouldCreatePaymentAndCallPayoutWithPayment() $resourceSrvMock->expects(self::once())->method('create') ->with(self::callback(static function ($payout) use ($customer, $metadata) { return $payout instanceof Payout && - 1.23 === $payout->getAmount() && - 'testCurrency' === $payout->getCurrency() && + $payout->getAmount() === 1.23 && + $payout->getCurrency() === 'testCurrency' && $payout->getPayment() instanceof Payment && - 'http://return.url' === $payout->getReturnUrl() && + $payout->getReturnUrl() === 'http://return.url' && $customer === $payout->getPayment()->getCustomer() && $metadata === $payout->getPayment()->getMetadata(); })); diff --git a/test/unit/Services/ResourceServiceTest.php b/test/unit/Services/ResourceServiceTest.php index 9b682825..c131182b 100755 --- a/test/unit/Services/ResourceServiceTest.php +++ b/test/unit/Services/ResourceServiceTest.php @@ -1144,8 +1144,8 @@ public function updateBasketShouldCallUpdateAndReturnTheGivenBasket() * @param string $resourceUrl * * @throws Exception - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. * @throws ReflectionException * @throws RuntimeException */ @@ -1169,8 +1169,8 @@ public function fetchResourceByUrlShouldFetchTheDesiredResource($fetchMethod, $a * @param string $resourceUrl * * @throws Exception - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. * @throws ReflectionException * @throws RuntimeException */ @@ -1189,8 +1189,8 @@ public function fetchResourceByUrlForAPaymentTypeShouldCallFetchPaymentType($pay * @test * * @throws Exception - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. * @throws ReflectionException * @throws RuntimeException */ @@ -1259,8 +1259,8 @@ public function createRecurringShouldNotFetchThePaymentTypeByObject() * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. * @throws \PHPUnit\Framework\Exception */ public function createRecurringShouldThrowExceptionWhenRecurringPaymentIsNotSupportedByType() diff --git a/test/unit/Traits/CanRecurTest.php b/test/unit/Traits/CanRecurTest.php index 77cde3a3..5ece9d5f 100644 --- a/test/unit/Traits/CanRecurTest.php +++ b/test/unit/Traits/CanRecurTest.php @@ -58,8 +58,8 @@ public function gettersAndSettersShouldWorkProperly() * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function activateRecurringWillThrowExceptionIfTheObjectHasWrongType() { diff --git a/test/unit/Traits/TraitDummyCanRecur.php b/test/unit/Traits/TraitDummyCanRecur.php index e3197bf4..0c742d7a 100644 --- a/test/unit/Traits/TraitDummyCanRecur.php +++ b/test/unit/Traits/TraitDummyCanRecur.php @@ -24,10 +24,10 @@ */ namespace heidelpayPHP\test\unit\Traits; -use heidelpayPHP\Resources\AbstractHeidelpayResource; +use heidelpayPHP\Resources\PaymentTypes\BasePaymentType; use heidelpayPHP\Traits\CanRecur; -class TraitDummyCanRecur extends AbstractHeidelpayResource +class TraitDummyCanRecur extends BasePaymentType { use CanRecur; From 5af65da20df287bbe35738af42364b0433d2f740 Mon Sep 17 00:00:00 2001 From: sixer1182 Date: Wed, 27 Nov 2019 09:30:57 +0100 Subject: [PATCH 019/101] [refactor] (PHPLIB-274) PaymentServiceInterface: Refactor interface. --- src/Heidelpay.php | 25 +++++++++---------- src/Interfaces/PaymentServiceInterface.php | 25 ++++++++++--------- src/Services/PaymentService.php | 28 +++++++++++----------- test/integration/PaymentTest.php | 5 ++-- test/unit/HeidelpayTest.php | 3 ++- 5 files changed, 44 insertions(+), 42 deletions(-) diff --git a/src/Heidelpay.php b/src/Heidelpay.php index b1754d2b..e4122d9b 100755 --- a/src/Heidelpay.php +++ b/src/Heidelpay.php @@ -33,6 +33,7 @@ use heidelpayPHP\Resources\AbstractHeidelpayResource; use heidelpayPHP\Resources\Basket; use heidelpayPHP\Resources\Customer; +use heidelpayPHP\Resources\InstalmentPlans; use heidelpayPHP\Resources\Keypair; use heidelpayPHP\Resources\Metadata; use heidelpayPHP\Resources\Payment; @@ -949,7 +950,7 @@ public function authorize( $card3ds = null, $invoiceId = null, $paymentReference = null - ): AbstractTransactionType { + ): Authorization { return $this->paymentService->authorize( $amount, $currency, @@ -984,7 +985,7 @@ public function charge( $card3ds = null, $invoiceId = null, $paymentReference = null - ): AbstractTransactionType { + ): Charge { return $this->paymentService->charge( $amount, $currency, @@ -1008,7 +1009,7 @@ public function chargeAuthorization( float $amount = null, string $orderId = null, string $invoiceId = null - ): AbstractTransactionType { + ): Charge { return $this->paymentService->chargeAuthorization($payment, $amount, $orderId, $invoiceId); } @@ -1021,7 +1022,7 @@ public function chargePayment( string $currency = null, string $orderId = null, string $invoiceId = null - ): AbstractTransactionType { + ): Charge { $paymentObject = $this->resourceService->getPaymentResource($payment); return $this->paymentService->chargePayment($paymentObject, $amount, $currency, $orderId, $invoiceId); } @@ -1033,7 +1034,7 @@ public function chargePayment( /** * {@inheritDoc} */ - public function cancelAuthorization(Authorization $authorization, $amount = null): AbstractTransactionType + public function cancelAuthorization(Authorization $authorization, $amount = null): Cancellation { return $this->paymentService->cancelAuthorization($authorization, $amount); } @@ -1041,7 +1042,7 @@ public function cancelAuthorization(Authorization $authorization, $amount = null /** * {@inheritDoc} */ - public function cancelAuthorizationByPayment($payment, $amount = null): AbstractTransactionType + public function cancelAuthorizationByPayment($payment, $amount = null): Cancellation { return $this->paymentService->cancelAuthorizationByPayment($payment, $amount); } @@ -1061,7 +1062,7 @@ public function cancelChargeById( string $paymentReference = null, float $amountNet = null, float $amountVat = null - ): AbstractTransactionType { + ): Cancellation { return $this->paymentService->cancelChargeById( $payment, $chargeId, @@ -1083,7 +1084,7 @@ public function cancelCharge( string $paymentReference = null, float $amountNet = null, float $amountVat = null - ): AbstractTransactionType { + ): Cancellation { return $this->paymentService->cancelCharge( $charge, $amount, @@ -1101,7 +1102,7 @@ public function cancelCharge( /** * {@inheritDoc} */ - public function ship($payment, string $invoiceId = null, string $orderId = null): AbstractHeidelpayResource + public function ship($payment, string $invoiceId = null, string $orderId = null): Shipment { return $this->paymentService->ship($payment, $invoiceId, $orderId); } @@ -1124,7 +1125,7 @@ public function payout( $basket = null, $invoiceId = null, $paymentReference = null - ): AbstractTransactionType { + ): Payout { return $this->paymentService->payout( $amount, $currency, @@ -1179,8 +1180,8 @@ public function fetchDirectDebitInstalmentPlans( $currency, $effectiveInterest, DateTime $orderDate = null - ) { - return $this->getPaymentService()->fetchDirectDebitInstalmentPlans( + ): InstalmentPlans { + return $this->paymentService->fetchDirectDebitInstalmentPlans( $amount, $currency, $effectiveInterest, diff --git a/src/Interfaces/PaymentServiceInterface.php b/src/Interfaces/PaymentServiceInterface.php index 03bc12c7..fcc782d6 100644 --- a/src/Interfaces/PaymentServiceInterface.php +++ b/src/Interfaces/PaymentServiceInterface.php @@ -23,7 +23,6 @@ use heidelpayPHP\Resources\Payment; use heidelpayPHP\Resources\PaymentTypes\BasePaymentType; use heidelpayPHP\Resources\PaymentTypes\Paypage; -use heidelpayPHP\Resources\TransactionTypes\AbstractTransactionType; use heidelpayPHP\Resources\TransactionTypes\Authorization; use heidelpayPHP\Resources\TransactionTypes\Cancellation; use heidelpayPHP\Resources\TransactionTypes\Charge; @@ -68,7 +67,7 @@ public function authorize( $card3ds = null, $invoiceId = null, $paymentReference = null - ): AbstractTransactionType; + ): Authorization; /** * Performs a Charge transaction and returns the resulting Charge resource. @@ -105,7 +104,7 @@ public function charge( $card3ds = null, $invoiceId = null, $paymentReference = null - ): AbstractTransactionType; + ): Charge; /** * Performs a Charge transaction for the Authorization of the given Payment object. @@ -126,7 +125,7 @@ public function chargeAuthorization( float $amount = null, string $orderId = null, string $invoiceId = null - ): AbstractTransactionType; + ): Charge; /** * Performs a Charge transaction for a specific Payment and returns the resulting Charge object. @@ -148,7 +147,7 @@ public function chargePayment( string $currency = null, string $orderId = null, string $invoiceId = null - ): AbstractTransactionType; + ): Charge; /** * Performs a Payout transaction and returns the resulting Payout resource. @@ -166,7 +165,7 @@ public function chargePayment( * @param string|null $invoiceId The external id of the invoice. * @param string|null $paymentReference A reference text for the payment. * - * @return Payout The resulting object of the Payout resource. + * @return Payout|AbstractHeidelpayResource The resulting object of the Payout resource. * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. @@ -182,7 +181,7 @@ public function payout( $basket = null, $invoiceId = null, $paymentReference = null - ): AbstractTransactionType; + ): Payout; /** * Performs a Cancellation transaction and returns the resulting Cancellation object. @@ -196,7 +195,7 @@ public function payout( * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ - public function cancelAuthorization(Authorization $authorization, $amount = null): AbstractTransactionType; + public function cancelAuthorization(Authorization $authorization, $amount = null): Cancellation; /** * Performs a Cancellation transaction for the Authorization of the given Payment object. @@ -210,7 +209,7 @@ public function cancelAuthorization(Authorization $authorization, $amount = null * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ - public function cancelAuthorizationByPayment($payment, $amount = null): AbstractTransactionType; + public function cancelAuthorizationByPayment($payment, $amount = null): Cancellation; /** * Performs a Cancellation transaction for the given Charge and returns the resulting Cancellation object. @@ -238,7 +237,7 @@ public function cancelChargeById( string $paymentReference = null, float $amountNet = null, float $amountVat = null - ): AbstractTransactionType; + ): Cancellation; /** * Performs a Cancellation transaction and returns the resulting Cancellation object. @@ -264,7 +263,7 @@ public function cancelCharge( string $paymentReference = null, float $amountNet = null, float $amountVat = null - ): AbstractTransactionType; + ): Cancellation; /** * Performs a Shipment transaction and returns the resulting Shipment object. @@ -278,7 +277,7 @@ public function cancelCharge( * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ - public function ship($payment, string $invoiceId = null, string $orderId = null): AbstractHeidelpayResource; + public function ship($payment, string $invoiceId = null, string $orderId = null): Shipment; /** * Initializes a PayPage for charge transaction and returns the PayPage resource. @@ -354,5 +353,5 @@ public function fetchDirectDebitInstalmentPlans( $currency, $effectiveInterest, DateTime $orderDate = null - ); + ): InstalmentPlans; } diff --git a/src/Services/PaymentService.php b/src/Services/PaymentService.php index 97947aee..cd8509e8 100755 --- a/src/Services/PaymentService.php +++ b/src/Services/PaymentService.php @@ -38,7 +38,6 @@ use heidelpayPHP\Resources\PaymentTypes\BasePaymentType; use heidelpayPHP\Resources\PaymentTypes\HirePurchaseDirectDebit; use heidelpayPHP\Resources\PaymentTypes\Paypage; -use heidelpayPHP\Resources\TransactionTypes\AbstractTransactionType; use heidelpayPHP\Resources\TransactionTypes\Authorization; use heidelpayPHP\Resources\TransactionTypes\Cancellation; use heidelpayPHP\Resources\TransactionTypes\Charge; @@ -72,9 +71,9 @@ public function getHeidelpay(): Heidelpay /** * @param Heidelpay $heidelpay * - * @return PaymentServiceInterface + * @return PaymentService */ - public function setHeidelpay(Heidelpay $heidelpay): PaymentServiceInterface + public function setHeidelpay(Heidelpay $heidelpay): PaymentService { $this->heidelpay = $heidelpay; return $this; @@ -107,7 +106,7 @@ public function authorize( $card3ds = null, $invoiceId = null, $paymentReference = null - ): AbstractTransactionType { + ): Authorization { $payment = $this->createPayment($paymentType); $paymentType = $payment->getPaymentType(); @@ -144,7 +143,7 @@ public function charge( $card3ds = null, $invoiceId = null, $paymentReference = null - ): AbstractTransactionType { + ): Charge { $payment = $this->createPayment($paymentType); $paymentType = $payment->getPaymentType(); @@ -171,7 +170,7 @@ public function chargeAuthorization( float $amount = null, string $orderId = null, string $invoiceId = null - ): AbstractTransactionType { + ): Charge { $paymentResource = $this->getResourceService()->getPaymentResource($payment); return $this->chargePayment($paymentResource, $amount, $orderId, $invoiceId); } @@ -185,7 +184,7 @@ public function chargePayment( string $currency = null, string $orderId = null, string $invoiceId = null - ): AbstractTransactionType { + ): Charge { $charge = new Charge($amount, $currency); $charge->setPayment($payment); if ($orderId !== null) { @@ -217,7 +216,7 @@ public function payout( $basket = null, $invoiceId = null, $paymentReference = null - ): AbstractTransactionType { + ): Payout { $payment = $this->createPayment($paymentType); $payout = (new Payout($amount, $currency, $returnUrl)) ->setOrderId($orderId) @@ -236,7 +235,7 @@ public function payout( /** * {@inheritDoc} */ - public function cancelAuthorization(Authorization $authorization, $amount = null): AbstractTransactionType + public function cancelAuthorization(Authorization $authorization, $amount = null): Cancellation { $cancellation = new Cancellation($amount); $cancellation->setPayment($authorization->getPayment()); @@ -249,7 +248,7 @@ public function cancelAuthorization(Authorization $authorization, $amount = null /** * {@inheritDoc} */ - public function cancelAuthorizationByPayment($payment, $amount = null): AbstractTransactionType + public function cancelAuthorizationByPayment($payment, $amount = null): Cancellation { $authorization = $this->getResourceService()->fetchAuthorization($payment); return $this->cancelAuthorization($authorization, $amount); @@ -270,7 +269,7 @@ public function cancelChargeById( string $paymentReference = null, float $amountNet = null, float $amountVat = null - ): AbstractTransactionType { + ): Cancellation { $charge = $this->getResourceService()->fetchChargeById($payment, $chargeId); return $this->cancelCharge($charge, $amount, $reasonCode, $paymentReference, $amountNet, $amountVat); } @@ -285,7 +284,7 @@ public function cancelCharge( string $paymentReference = null, float $amountNet = null, float $amountVat = null - ): AbstractTransactionType { + ): Cancellation { $cancellation = new Cancellation($amount); $cancellation ->setReasonCode($reasonCode) @@ -306,7 +305,7 @@ public function cancelCharge( /** * {@inheritDoc} */ - public function ship($payment, string $invoiceId = null, string $orderId = null): AbstractHeidelpayResource + public function ship($payment, string $invoiceId = null, string $orderId = null): Shipment { $shipment = new Shipment(); $shipment->setInvoiceId($invoiceId)->setOrderId($orderId); @@ -357,8 +356,9 @@ public function fetchDirectDebitInstalmentPlans( $currency, $effectiveInterest, DateTime $orderDate = null - ) { + ): InstalmentPlans { $hdd = (new HirePurchaseDirectDebit(null, null, null))->setParentResource($this->heidelpay); + /** @var InstalmentPlans $plans */ $plans = (new InstalmentPlans($amount, $currency, $effectiveInterest, $orderDate))->setParentResource($hdd); return $this->heidelpay->getResourceService()->fetch($plans); } diff --git a/test/integration/PaymentTest.php b/test/integration/PaymentTest.php index 16ce7326..b0325ee9 100755 --- a/test/integration/PaymentTest.php +++ b/test/integration/PaymentTest.php @@ -160,7 +160,7 @@ public function paymentChargeOnAuthorizeShouldBePossibleUsingPaymentId() $authorization = $this->heidelpay->authorize(100.00, 'EUR', $card, 'http://heidelpay.com', null, null, null, null, false); $charge = $this->heidelpay->chargePayment($authorization->getPaymentId()); - $this->assertInstanceOf(Charge::class, $charge); + $this->assertNotEmpty($charge->getId()); } /** @@ -177,7 +177,8 @@ public function paymentChargeOnAuthorizeShouldTakeResourceIds() $authorization = $this->heidelpay->authorize(100.00, 'EUR', $card, 'http://heidelpay.com', null, null, null, null, false); $charge = $this->heidelpay->chargePayment($authorization->getPaymentId(), null, 'order-' . self::generateRandomId(), 'invoice-' . self::generateRandomId()); - $this->assertInstanceOf(Charge::class, $charge); + $this->assertNotEmpty($charge->getId()); + } /** diff --git a/test/unit/HeidelpayTest.php b/test/unit/HeidelpayTest.php index ed013de3..8fdbb580 100755 --- a/test/unit/HeidelpayTest.php +++ b/test/unit/HeidelpayTest.php @@ -26,6 +26,7 @@ namespace heidelpayPHP\test\unit; use DateTime; +use Exception; use heidelpayPHP\Heidelpay; use heidelpayPHP\Interfaces\PaymentServiceInterface; use heidelpayPHP\Resources\Basket; @@ -305,7 +306,7 @@ public function heidelpayShouldForwardResourceActionCallsToTheResourceServiceDP( * * @return array * - * @throws \Exception + * @throws Exception */ public function paymentServiceDP(): array { From 330f30f003d5e4ff94c60a7d41f2305f9dd8bf9a Mon Sep 17 00:00:00 2001 From: sixer1182 Date: Wed, 27 Nov 2019 09:31:31 +0100 Subject: [PATCH 020/101] [refactor] (PHPLIB-274) ResourceService: Add ResourceServiceInterface and refactor accordingly. --- src/Heidelpay.php | 91 ++--- src/Interfaces/ResourceServiceInterface.php | 385 ++++++++++++++++++ src/Resources/AbstractHeidelpayResource.php | 2 +- src/Services/PaymentService.php | 3 +- src/Services/ResourceService.php | 331 ++++----------- src/Services/WebhookService.php | 15 +- test/unit/HeidelpayTest.php | 54 +-- test/unit/Resources/CustomerTest.php | 20 +- test/unit/Resources/PaymentTest.php | 43 +- .../Resources/PaymentTypes/PayPageTest.php | 7 +- .../AbstractTransactionTypeTest.php | 7 +- test/unit/Services/PaymentServiceTest.php | 40 +- test/unit/Services/ResourceServiceTest.php | 243 ++++++----- test/unit/Services/WebhooksServiceTest.php | 43 +- 14 files changed, 722 insertions(+), 562 deletions(-) create mode 100644 src/Interfaces/ResourceServiceInterface.php diff --git a/src/Heidelpay.php b/src/Heidelpay.php index e4122d9b..6c45c8a3 100755 --- a/src/Heidelpay.php +++ b/src/Heidelpay.php @@ -30,6 +30,7 @@ use heidelpayPHP\Interfaces\DebugHandlerInterface; use heidelpayPHP\Interfaces\HeidelpayParentInterface; use heidelpayPHP\Interfaces\PaymentServiceInterface; +use heidelpayPHP\Interfaces\ResourceServiceInterface; use heidelpayPHP\Resources\AbstractHeidelpayResource; use heidelpayPHP\Resources\Basket; use heidelpayPHP\Resources\Customer; @@ -39,7 +40,7 @@ use heidelpayPHP\Resources\Payment; use heidelpayPHP\Resources\PaymentTypes\BasePaymentType; use heidelpayPHP\Resources\PaymentTypes\Paypage; -use heidelpayPHP\Resources\TransactionTypes\AbstractTransactionType; +use heidelpayPHP\Resources\Recurring; use heidelpayPHP\Resources\TransactionTypes\Authorization; use heidelpayPHP\Resources\TransactionTypes\Cancellation; use heidelpayPHP\Resources\TransactionTypes\Charge; @@ -53,7 +54,7 @@ use heidelpayPHP\Validators\PrivateKeyValidator; use RuntimeException; -class Heidelpay implements HeidelpayParentInterface, PaymentServiceInterface +class Heidelpay implements HeidelpayParentInterface, PaymentServiceInterface, ResourceServiceInterface { const BASE_URL = 'api.heidelpay.com'; const API_VERSION = 'v1'; @@ -66,7 +67,7 @@ class Heidelpay implements HeidelpayParentInterface, PaymentServiceInterface /** @var string $locale */ private $locale; - /** @var ResourceService $resourceService */ + /** @var ResourceServiceInterface $resourceService */ private $resourceService; /** @var PaymentServiceInterface $paymentService */ @@ -160,11 +161,11 @@ public function setLocale($locale): Heidelpay } /** - * @param ResourceService $resourceService + * @param ResourceServiceInterface $resourceService * * @return Heidelpay */ - public function setResourceService(ResourceService $resourceService): Heidelpay + public function setResourceService(ResourceServiceInterface $resourceService): Heidelpay { $this->resourceService = $resourceService->setHeidelpay($this); return $this; @@ -309,34 +310,11 @@ public function getUri($appendId = true): string // /** - * Updates the given local resource object if it has not been fetched before. - * If you are looking to update a local resource even if it has been fetched before please call fetchResource(). - * - * @param AbstractHeidelpayResource $resource The local resource object to update. - * - * @return AbstractHeidelpayResource The updated resource object. - * - * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. - */ - public function getResource(AbstractHeidelpayResource $resource): AbstractHeidelpayResource - { - return $this->resourceService->getResource($resource); - } - - /** - * Updates the given local resource object. - * - * @param AbstractHeidelpayResource $resource The local resource object to update. - * - * @return AbstractHeidelpayResource The updated resource object. - * - * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * {@inheritDoc} */ public function fetchResource(AbstractHeidelpayResource $resource): AbstractHeidelpayResource { - return $this->resourceService->fetch($resource); + return $this->resourceService->fetchResource($resource); } // @@ -352,9 +330,9 @@ public function fetchResource(AbstractHeidelpayResource $resource): AbstractHeid * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ - public function activateRecurringPayment($paymentType, $returnUrl) + public function activateRecurringPayment($paymentType, $returnUrl): Recurring { - return $this->resourceService->createRecurring($paymentType, $returnUrl); + return $this->resourceService->activateRecurringPayment($paymentType, $returnUrl); } // @@ -405,7 +383,7 @@ public function fetchPaymentByOrderId($orderId): Payment * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ - public function fetchKeypair($detailed = false): AbstractHeidelpayResource + public function fetchKeypair($detailed = false): Keypair { return $this->resourceService->fetchKeypair($detailed); } @@ -424,7 +402,7 @@ public function fetchKeypair($detailed = false): AbstractHeidelpayResource * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ - public function createMetadata($metadata): Metadata + public function createMetadata(Metadata $metadata): Metadata { return $this->resourceService->createMetadata($metadata); } @@ -539,7 +517,7 @@ public function updatePaymentType(BasePaymentType $paymentType): BasePaymentType * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ - public function fetchPaymentType($typeId): AbstractHeidelpayResource + public function fetchPaymentType($typeId): BasePaymentType { return $this->resourceService->fetchPaymentType($typeId); } @@ -558,7 +536,7 @@ public function fetchPaymentType($typeId): AbstractHeidelpayResource * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ - public function createCustomer(Customer $customer): AbstractHeidelpayResource + public function createCustomer(Customer $customer): Customer { return $this->resourceService->createCustomer($customer); } @@ -573,7 +551,7 @@ public function createCustomer(Customer $customer): AbstractHeidelpayResource * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ - public function createOrUpdateCustomer(Customer $customer): AbstractHeidelpayResource + public function createOrUpdateCustomer(Customer $customer): Customer { return $this->resourceService->createOrUpdateCustomer($customer); } @@ -590,7 +568,7 @@ public function createOrUpdateCustomer(Customer $customer): AbstractHeidelpayRes * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ - public function fetchCustomer($customer): AbstractHeidelpayResource + public function fetchCustomer($customer): Customer { return $this->resourceService->fetchCustomer($customer); } @@ -605,7 +583,7 @@ public function fetchCustomer($customer): AbstractHeidelpayResource * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ - public function fetchCustomerByExtCustomerId($customerId): AbstractHeidelpayResource + public function fetchCustomerByExtCustomerId($customerId): Customer { return $this->resourceService->fetchCustomerByExtCustomerId($customerId); } @@ -620,7 +598,7 @@ public function fetchCustomerByExtCustomerId($customerId): AbstractHeidelpayReso * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ - public function updateCustomer(Customer $customer): AbstractHeidelpayResource + public function updateCustomer(Customer $customer): Customer { return $this->resourceService->updateCustomer($customer); } @@ -655,7 +633,7 @@ public function deleteCustomer($customer) * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ - public function fetchAuthorization($payment): AbstractHeidelpayResource + public function fetchAuthorization($payment): Authorization { return $this->resourceService->fetchAuthorization($payment); } @@ -676,7 +654,7 @@ public function fetchAuthorization($payment): AbstractHeidelpayResource * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ - public function fetchChargeById($paymentId, $chargeId): AbstractHeidelpayResource + public function fetchChargeById($paymentId, $chargeId): Charge { return $this->resourceService->fetchChargeById($paymentId, $chargeId); } @@ -691,9 +669,9 @@ public function fetchChargeById($paymentId, $chargeId): AbstractHeidelpayResourc * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ - public function fetchCharge(Charge $charge): AbstractHeidelpayResource + public function fetchCharge(Charge $charge): Charge { - return $this->resourceService->fetch($charge); + return $this->resourceService->fetchCharge($charge); } // @@ -711,7 +689,7 @@ public function fetchCharge(Charge $charge): AbstractHeidelpayResource * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ - public function fetchReversalByAuthorization($authorization, $cancellationId): AbstractHeidelpayResource + public function fetchReversalByAuthorization($authorization, $cancellationId): Cancellation { return $this->resourceService->fetchReversalByAuthorization($authorization, $cancellationId); } @@ -727,7 +705,7 @@ public function fetchReversalByAuthorization($authorization, $cancellationId): A * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ - public function fetchReversal($payment, $cancellationId): AbstractHeidelpayResource + public function fetchReversal($payment, $cancellationId): Cancellation { return $this->resourceService->fetchReversal($payment, $cancellationId); } @@ -744,7 +722,7 @@ public function fetchReversal($payment, $cancellationId): AbstractHeidelpayResou * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ - public function fetchRefundById($payment, $chargeId, $cancellationId): AbstractHeidelpayResource + public function fetchRefundById($payment, $chargeId, $cancellationId): Cancellation { return $this->resourceService->fetchRefundById($payment, $chargeId, $cancellationId); } @@ -760,9 +738,9 @@ public function fetchRefundById($payment, $chargeId, $cancellationId): AbstractH * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ - public function fetchRefund(Charge $charge, $cancellationId): AbstractHeidelpayResource + public function fetchRefund(Charge $charge, $cancellationId): Cancellation { - return $this->resourceService->fetch($charge->getCancellation($cancellationId, true)); + return $this->resourceService->fetchRefund($charge, $cancellationId); } // @@ -780,7 +758,7 @@ public function fetchRefund(Charge $charge, $cancellationId): AbstractHeidelpayR * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ - public function fetchShipment($payment, $shipmentId): AbstractHeidelpayResource + public function fetchShipment($payment, $shipmentId): Shipment { return $this->resourceService->fetchShipment($payment, $shipmentId); } @@ -790,18 +768,9 @@ public function fetchShipment($payment, $shipmentId): AbstractHeidelpayResource // /** - * Retrieves an Payout resource via the API using the corresponding Payment. - * The Payout resource can not be fetched using its id since they are unique only within the Payment. - * A Payment can have zero or one Payouts. - * - * @param Payment|string $payment The Payment object or the id of a Payment object whose Payout to fetch. - * - * @return Payout The Payout object of the given Payment. - * - * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * {@inheritDoc} */ - public function fetchPayout($payment): AbstractHeidelpayResource + public function fetchPayout($payment): Payout { return $this->resourceService->fetchPayout($payment); } diff --git a/src/Interfaces/ResourceServiceInterface.php b/src/Interfaces/ResourceServiceInterface.php new file mode 100644 index 00000000..c8b452f0 --- /dev/null +++ b/src/Interfaces/ResourceServiceInterface.php @@ -0,0 +1,385 @@ + + * + * @package heidelpay/${Package} + */ +namespace heidelpayPHP\Interfaces; + +use heidelpayPHP\Exceptions\HeidelpayApiException; +use heidelpayPHP\Resources\AbstractHeidelpayResource; +use heidelpayPHP\Resources\Basket; +use heidelpayPHP\Resources\Customer; +use heidelpayPHP\Resources\Keypair; +use heidelpayPHP\Resources\Metadata; +use heidelpayPHP\Resources\Payment; +use heidelpayPHP\Resources\PaymentTypes\BasePaymentType; +use heidelpayPHP\Resources\Recurring; +use heidelpayPHP\Resources\TransactionTypes\Authorization; +use heidelpayPHP\Resources\TransactionTypes\Cancellation; +use heidelpayPHP\Resources\TransactionTypes\Charge; +use heidelpayPHP\Resources\TransactionTypes\Payout; +use heidelpayPHP\Resources\TransactionTypes\Shipment; +use RuntimeException; + +interface ResourceServiceInterface +{ + /** + * Updates the given local resource object (id must be set) + * + * @param AbstractHeidelpayResource $resource The local resource object to update. + * + * @return AbstractHeidelpayResource The updated resource object. + * + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + */ + public function fetchResource(AbstractHeidelpayResource $resource): AbstractHeidelpayResource; + + /** + * Retrieves an Payout resource via the API using the corresponding Payment or paymentId. + * The Payout resource can not be fetched using its id since they are unique only within the Payment. + * A Payment can have zero or one Payouts. + * + * @param Payment|string $payment The Payment object or the id of a Payment object whose Payout to fetch. + * There can only be one payout object to a payment. + * + * @return Payout The Payout object of the given Payment. + * + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + */ + public function fetchPayout($payment): Payout; + + /** + * Activate recurring payment for the given payment type (if possible). + * + * @param string|BasePaymentType $paymentType The payment to activate recurring payment for. + * @param string $returnUrl The URL to which the customer gets redirected in case of a 3ds + * transaction + * + * @return Recurring The recurring object. + * + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + */ + public function activateRecurringPayment($paymentType, $returnUrl): Recurring; + + /** + * Fetch and return payment by given payment id or payment object. + * If a payment object is given it will be updated as well, thus you do not rely on the returned object. + * + * @param Payment|string $payment The payment object or paymentId to fetch. + * + * @return Payment The fetched payment object. + * + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + */ + public function fetchPayment($payment): Payment; + + /** + * Fetch and return payment by given order id. + * + * @param string $orderId The external order id to fetch the payment by. + * + * @return Payment The fetched payment object. + * + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + */ + public function fetchPaymentByOrderId($orderId): Payment; + + /** + * Fetch public key and configured payment types from API. + * + * @param bool $detailed If this flag is set detailed information are fetched. + * + * @return Keypair + * + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + */ + public function fetchKeypair($detailed = false): Keypair; + + /** + * Create Metadata resource. + * + * @param Metadata $metadata The Metadata object to be created. + * + * @return Metadata The fetched Metadata resource. + * + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + */ + public function createMetadata(Metadata $metadata): Metadata; + + /** + * Fetch and return Metadata resource. + * + * @param Metadata|string $metadata + * + * @return Metadata + * + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + */ + public function fetchMetadata($metadata): Metadata; + + /** + * Creates and returns the given basket resource. + * + * @param Basket $basket The basket to be created. + * + * @return Basket The created Basket object. + * + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + */ + public function createBasket(Basket $basket): Basket; + + /** + * Fetches and returns the given Basket (by object or id). + * + * @param Basket|string $basket Basket object or id of basket to be fetched. + * + * @return Basket The fetched Basket object. + * + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + */ + public function fetchBasket($basket): Basket; + + /** + * Update the a basket resource with the given basket object (id must be set). + * + * @param Basket $basket + * + * @return Basket The updated Basket object. + * + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + */ + public function updateBasket(Basket $basket): Basket; + + /** + * Create the given payment type via api. + * + * @param BasePaymentType $paymentType + * + * @return BasePaymentType|AbstractHeidelpayResource + * + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + */ + public function createPaymentType(BasePaymentType $paymentType): BasePaymentType; + + /** + * Fetch the payment type with the given Id from the API. + * + * @param string $typeId + * + * @return BasePaymentType|AbstractHeidelpayResource + * + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + */ + public function fetchPaymentType($typeId): BasePaymentType; + + /** + * Updates the PaymentType resource with the given PaymentType object. + * + * @param BasePaymentType $x The PaymentType object to be updated. + * + * @return BasePaymentType|AbstractHeidelpayResource The updated PaymentType object. + * + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + */ + public function updatePaymentType(BasePaymentType $x): BasePaymentType; + + /** + * Create an API resource for the given customer object. + * + * @param Customer $customer The customer object to create the resource for. + * + * @return Customer The updated customer object after creation (it should have an id now). + * + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + */ + public function createCustomer(Customer $customer): Customer; + + /** + * Create a resource for given customer or updates it if it already exists. + * + * @param Customer $customer The customer object to create/update the resource for. + * + * @return Customer The updated customer object after creation/update. + * + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + */ + public function createOrUpdateCustomer(Customer $customer): Customer; + + /** + * Fetch and return Customer object from API by the given id. + * + * @param Customer|string $customer The customer object or id to fetch the customer by. + * + * @return Customer The fetched customer object. + * + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + */ + public function fetchCustomer($customer): Customer; + + /** + * Fetch and return customer object from API by the given external customer id. + * + * @param string $customerId The external customerId to fetch the customer resource by. + * + * @return Customer The fetched customer object. + * + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + */ + public function fetchCustomerByExtCustomerId($customerId): Customer; + + /** + * Update and return a Customer object via API. + * + * @param Customer $customer The locally changed customer date to update the resource in API by. + * + * @return Customer The customer object after update. + * + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + */ + public function updateCustomer(Customer $customer): Customer; + + /** + * Delete the given Customer resource. + * + * @param Customer|string $customer The customer to be deleted. Can be the customer object or its id. + * + * @return Customer|null The customer object if there was a failure deleting it or null if the deletion succeeded. + * + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + */ + public function deleteCustomer($customer); + + /** + * Fetch an authorization object by its payment object or id. + * Authorization ids are not unique to a merchant but to the payment. + * A Payment object can have zero or one authorizations. + * + * @param Payment|string $payment The payment object or payment id of which to fetch the authorization. + * + * @return Authorization|AbstractHeidelpayResource The fetched authorization. + * + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + */ + public function fetchAuthorization($payment): Authorization; + + /** + * Fetch a charge object by combination of payment id and charge id. + * Charge ids are not unique to a merchant but to the payment. + * + * @param Payment|string $payment The payment object or payment id to fetch the authorization from. + * @param string $chargeId The id of the charge to fetch. + * + * @return Charge|AbstractHeidelpayResource The fetched charge. + * + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + */ + public function fetchChargeById($payment, $chargeId): Charge; + + /** + * Update local charge object. + * + * @param Charge $charge The charge object to be fetched. + * + * @return Charge|AbstractHeidelpayResource The fetched charge. + * + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + */ + public function fetchCharge(Charge $charge): Charge; + + /** + * Fetch a cancel on an authorization (aka reversal). + * + * @param Authorization $authorization The authorization object for which to fetch the cancellation. + * @param string $cancellationId The id of the cancellation to fetch. + * + * @return Cancellation The fetched cancellation (reversal). + * + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + */ + public function fetchReversalByAuthorization($authorization, $cancellationId): Cancellation; + + /** + * Fetches a cancellation resource on an authorization (aka reversal) via payment and cancellation id. + * + * @param Payment|string $payment The payment object or id of the payment to fetch the cancellation for. + * @param string $cancellationId The id of the cancellation to fetch. + * + * @return Cancellation The fetched cancellation (reversal). + * + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + */ + public function fetchReversal($payment, $cancellationId): Cancellation; + + /** + * Fetch a cancellation resource on a charge (aka refund) via id. + * + * @param Payment|string $payment The payment object or id of the payment to fetch the cancellation for. + * @param string $chargeId The id of the charge to fetch the cancellation for. + * @param string $cancellationId The id of the cancellation to fetch. + * + * @return Cancellation The fetched cancellation (refund). + * + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + */ + public function fetchRefundById($payment, $chargeId, $cancellationId): Cancellation; + + /** + * Fetch a cancellation resource on a Charge (aka refund). + * + * @param Charge $charge The charge object to fetch the cancellation for. + * @param string $cancellationId The id of the cancellation to fetch. + * + * @return Cancellation The fetched cancellation (refund). + * + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + */ + public function fetchRefund(Charge $charge, $cancellationId): Cancellation; + + /** + * Fetch a shipment resource of the given payment by id. + * + * @param Payment|string $payment The payment object or id of the payment to fetch the cancellation for. + * @param string $shipmentId The id of the shipment to be fetched. + * + * @return Shipment The fetched shipment object. + * + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + */ + public function fetchShipment($payment, $shipmentId): Shipment; +} diff --git a/src/Resources/AbstractHeidelpayResource.php b/src/Resources/AbstractHeidelpayResource.php index 5a39e0e8..3c6ce459 100755 --- a/src/Resources/AbstractHeidelpayResource.php +++ b/src/Resources/AbstractHeidelpayResource.php @@ -317,7 +317,7 @@ protected function getResource(AbstractHeidelpayResource $resource): AbstractHei */ protected function fetchResource(AbstractHeidelpayResource $resource) { - $this->getResourceService()->fetch($resource); + $this->getResourceService()->fetchResource($resource); } // diff --git a/src/Services/PaymentService.php b/src/Services/PaymentService.php index cd8509e8..4d8b67c6 100755 --- a/src/Services/PaymentService.php +++ b/src/Services/PaymentService.php @@ -360,7 +360,8 @@ public function fetchDirectDebitInstalmentPlans( $hdd = (new HirePurchaseDirectDebit(null, null, null))->setParentResource($this->heidelpay); /** @var InstalmentPlans $plans */ $plans = (new InstalmentPlans($amount, $currency, $effectiveInterest, $orderDate))->setParentResource($hdd); - return $this->heidelpay->getResourceService()->fetch($plans); + $plans = $this->heidelpay->getResourceService()->fetchResource($plans); + return $plans; } // diff --git a/src/Services/ResourceService.php b/src/Services/ResourceService.php index 0620bd1e..aead83e6 100755 --- a/src/Services/ResourceService.php +++ b/src/Services/ResourceService.php @@ -31,6 +31,7 @@ use heidelpayPHP\Constants\IdStrings; use heidelpayPHP\Exceptions\HeidelpayApiException; use heidelpayPHP\Heidelpay; +use heidelpayPHP\Interfaces\ResourceServiceInterface; use heidelpayPHP\Resources\AbstractHeidelpayResource; use heidelpayPHP\Resources\Basket; use heidelpayPHP\Resources\Customer; @@ -67,7 +68,7 @@ use function in_array; use function is_string; -class ResourceService +class ResourceService implements ResourceServiceInterface { /** @var Heidelpay */ private $heidelpay; @@ -93,9 +94,9 @@ public function getHeidelpay(): Heidelpay /** * @param Heidelpay $heidelpay * - * @return ResourceService + * @return ResourceServiceInterface */ - public function setHeidelpay(Heidelpay $heidelpay): ResourceService + public function setHeidelpay(Heidelpay $heidelpay): ResourceServiceInterface { $this->heidelpay = $heidelpay; return $this; @@ -139,7 +140,7 @@ public function send( public function getResource(AbstractHeidelpayResource $resource): AbstractHeidelpayResource { if ($resource->getFetchedAt() === null && $resource->getId() !== null) { - $this->fetch($resource); + $this->fetchResource($resource); } return $resource; } @@ -301,7 +302,7 @@ public function delete(AbstractHeidelpayResource &$resource) * * todo create and call local fetch method */ - public function fetch(AbstractHeidelpayResource $resource): AbstractHeidelpayResource + public function fetchResource(AbstractHeidelpayResource $resource): AbstractHeidelpayResource { $method = HttpAdapterInterface::REQUEST_GET; $response = $this->send($resource, $method); @@ -327,11 +328,13 @@ public function fetch(AbstractHeidelpayResource $resource): AbstractHeidelpayRes * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ - public function fetchPayout($payment): AbstractHeidelpayResource + public function fetchPayout($payment): Payout { /** @var Payment $paymentObject */ $paymentObject = $this->fetchPayment($payment); - return $this->fetch($paymentObject->getPayout(true)); + /** @var Payout $payout */ + $payout = $this->fetchResource($paymentObject->getPayout(true)); + return $payout; } // @@ -339,18 +342,9 @@ public function fetchPayout($payment): AbstractHeidelpayResource // /** - * Activate recurring payment for the given payment type (if possible). - * - * @param string|BasePaymentType $paymentType The payment to activate recurring payment for. - * @param string $returnUrl The URL to which the customer gets redirected in case of a 3ds - * transaction - * - * @return Recurring - * - * @throws RuntimeException - * @throws HeidelpayApiException + * {@inheritDoc} */ - public function createRecurring($paymentType, $returnUrl): Recurring + public function activateRecurringPayment($paymentType, $returnUrl): Recurring { $paymentTypeObject = $paymentType; if (is_string($paymentType)) { @@ -384,7 +378,7 @@ public function createRecurring($paymentType, $returnUrl): Recurring * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ - public function getPaymentResource($payment) + public function getPaymentResource($payment): Payment { $paymentObject = $payment; @@ -395,14 +389,7 @@ public function getPaymentResource($payment) } /** - * Fetch and return payment by given payment id. - * - * @param Payment|string $payment - * - * @return Payment - * - * @throws HeidelpayApiException - * @throws RuntimeException + * {@inheritDoc} */ public function fetchPayment($payment): Payment { @@ -412,24 +399,17 @@ public function fetchPayment($payment): Payment $paymentObject->setId($payment); } - $this->fetch($paymentObject); + $this->fetchResource($paymentObject); return $paymentObject; } /** - * Fetch and return payment by given order id. - * - * @param string $orderId - * - * @return Payment - * - * @throws HeidelpayApiException - * @throws RuntimeException + * {@inheritDoc} */ public function fetchPaymentByOrderId($orderId): Payment { $paymentObject = (new Payment($this->heidelpay))->setOrderId($orderId); - $this->fetch($paymentObject); + $this->fetchResource($paymentObject); return $paymentObject; } @@ -438,19 +418,14 @@ public function fetchPaymentByOrderId($orderId): Payment // /** - * Fetch public key and configured payment types from API. - * - * @param bool $detailed If this flag is set detailed information are fetched. - * - * @return Keypair - * - * @throws HeidelpayApiException - * @throws RuntimeException + * {@inheritDoc} */ - public function fetchKeypair($detailed = false): AbstractHeidelpayResource + public function fetchKeypair($detailed = false): Keypair { + /** @var Keypair $keyPair */ $keyPair = (new Keypair())->setParentResource($this->heidelpay)->setDetailed($detailed); - return $this->fetch($keyPair); + $this->fetchResource($keyPair); + return $keyPair; } // @@ -458,14 +433,7 @@ public function fetchKeypair($detailed = false): AbstractHeidelpayResource // /** - * Create Metadata resource. - * - * @param Metadata $metadata The Metadata object to be created. - * - * @return Metadata The fetched Metadata resource. - * - * @throws HeidelpayApiException - * @throws RuntimeException + * {@inheritDoc} */ public function createMetadata(Metadata $metadata): Metadata { @@ -475,14 +443,7 @@ public function createMetadata(Metadata $metadata): Metadata } /** - * Fetch and return Metadata resource. - * - * @param Metadata|string $metadata - * - * @return Metadata - * - * @throws HeidelpayApiException - * @throws RuntimeException + * {@inheritDoc} */ public function fetchMetadata($metadata): Metadata { @@ -492,7 +453,7 @@ public function fetchMetadata($metadata): Metadata $metadataObject->setId($metadata); } - $this->fetch($metadataObject); + $this->fetchResource($metadataObject); return $metadataObject; } @@ -501,14 +462,7 @@ public function fetchMetadata($metadata): Metadata // /** - * Creates and returns the given basket resource. - * - * @param Basket $basket The basket to be created. - * - * @return Basket The created Basket object. - * - * @throws HeidelpayApiException - * @throws RuntimeException + * {@inheritDoc} */ public function createBasket(Basket $basket): Basket { @@ -518,14 +472,7 @@ public function createBasket(Basket $basket): Basket } /** - * Fetches and returns the given Basket (by object or id). - * - * @param Basket|string $basket Basket object or id of basket to be fetched. - * - * @return Basket The fetched Basket object. - * - * @throws HeidelpayApiException - * @throws RuntimeException + * {@inheritDoc} */ public function fetchBasket($basket): Basket { @@ -535,19 +482,12 @@ public function fetchBasket($basket): Basket } $basketObj->setParentResource($this->heidelpay); - $this->fetch($basketObj); + $this->fetchResource($basketObj); return $basketObj; } /** - * Update the a basket resource with the given basket object (id must be set). - * - * @param Basket $basket - * - * @return Basket The updated Basket object. - * - * @throws HeidelpayApiException - * @throws RuntimeException + * {@inheritDoc} */ public function updateBasket(Basket $basket): Basket { @@ -561,14 +501,7 @@ public function updateBasket(Basket $basket): Basket // /** - * Create the given payment type via api. - * - * @param BasePaymentType $paymentType - * - * @return BasePaymentType|AbstractHeidelpayResource - * - * @throws HeidelpayApiException - * @throws RuntimeException + * {@inheritDoc} */ public function createPaymentType(BasePaymentType $paymentType): BasePaymentType { @@ -579,16 +512,9 @@ public function createPaymentType(BasePaymentType $paymentType): BasePaymentType } /** - * Fetch the payment type with the given Id from the API. - * - * @param string $typeId - * - * @return BasePaymentType|AbstractHeidelpayResource - * - * @throws HeidelpayApiException - * @throws RuntimeException + * {@inheritDoc} */ - public function fetchPaymentType($typeId): AbstractHeidelpayResource + public function fetchPaymentType($typeId): BasePaymentType { $resourceType = IdService::getResourceTypeFromIdString($typeId); switch ($resourceType) { @@ -648,22 +574,20 @@ public function fetchPaymentType($typeId): AbstractHeidelpayResource break; } - return $this->fetch($paymentType->setParentResource($this->heidelpay)->setId($typeId)); + /** @var BasePaymentType $paymentType */ + $paymentType = $paymentType->setParentResource($this->heidelpay)->setId($typeId); + $this->fetchResource($paymentType); + return $paymentType; } /** - * Updates the PaymentType resource with the given PaymentType object. - * - * @param BasePaymentType $paymentType The PaymentType object to be updated. - * - * @return BasePaymentType|AbstractHeidelpayResource The updated PaymentType object. - * - * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * {@inheritDoc} */ public function updatePaymentType(BasePaymentType $paymentType): BasePaymentType { - return $this->update($paymentType); + /** @var BasePaymentType $retPaymentType */ + $retPaymentType = $this->update($paymentType); + return $retPaymentType; } // @@ -671,16 +595,9 @@ public function updatePaymentType(BasePaymentType $paymentType): BasePaymentType // /** - * Create the given Customer object via API. - * - * @param Customer $customer - * - * @return Customer - * - * @throws HeidelpayApiException - * @throws RuntimeException + * {@inheritDoc} */ - public function createCustomer(Customer $customer): AbstractHeidelpayResource + public function createCustomer(Customer $customer): Customer { $customer->setParentResource($this->heidelpay); $this->create($customer); @@ -688,16 +605,9 @@ public function createCustomer(Customer $customer): AbstractHeidelpayResource } /** - * Create the given Customer object via API. - * - * @param Customer $customer - * - * @return Customer - * - * @throws HeidelpayApiException - * @throws RuntimeException + * {@inheritDoc} */ - public function createOrUpdateCustomer(Customer $customer): AbstractHeidelpayResource + public function createOrUpdateCustomer(Customer $customer): Customer { try { $this->createCustomer($customer); @@ -717,16 +627,9 @@ public function createOrUpdateCustomer(Customer $customer): AbstractHeidelpayRes } /** - * Fetch and return Customer object from API by the given id. - * - * @param Customer|string $customer - * - * @return Customer - * - * @throws HeidelpayApiException - * @throws RuntimeException + * {@inheritDoc} */ - public function fetchCustomer($customer): AbstractHeidelpayResource + public function fetchCustomer($customer): Customer { $customerObject = $customer; @@ -734,52 +637,31 @@ public function fetchCustomer($customer): AbstractHeidelpayResource $customerObject = (new Customer())->setId($customer); } - $this->fetch($customerObject->setParentResource($this->heidelpay)); + $this->fetchResource($customerObject->setParentResource($this->heidelpay)); return $customerObject; } /** - * Fetch and return Customer object from API by the given external customer id. - * - * @param string $customerId - * - * @return Customer - * - * @throws HeidelpayApiException - * @throws RuntimeException + * {@inheritDoc} */ public function fetchCustomerByExtCustomerId($customerId): Customer { $customerObject = (new Customer())->setCustomerId($customerId); - $this->fetch($customerObject->setParentResource($this->heidelpay)); + $this->fetchResource($customerObject->setParentResource($this->heidelpay)); return $customerObject; } /** - * Update and return a Customer object via API. - * - * @param Customer $customer - * - * @return Customer - * - * @throws HeidelpayApiException - * @throws RuntimeException + * {@inheritDoc} */ - public function updateCustomer(Customer $customer): AbstractHeidelpayResource + public function updateCustomer(Customer $customer): Customer { $this->update($customer); return $customer; } /** - * Delete the given Customer resource. - * - * @param Customer|string|null $customer - * - * @return Customer|null|string - * - * @throws HeidelpayApiException - * @throws RuntimeException + * {@inheritDoc} */ public function deleteCustomer($customer) { @@ -798,45 +680,37 @@ public function deleteCustomer($customer) // /** - * Fetch an Authorization object by its paymentId. - * Authorization Ids are not global but specific to the payment. - * A Payment object can have zero to one authorizations. - * - * @param $payment - * - * @return Authorization - * - * @throws HeidelpayApiException - * @throws RuntimeException + * {@inheritDoc} */ - public function fetchAuthorization($payment): AbstractHeidelpayResource + public function fetchAuthorization($payment): Authorization { /** @var Payment $paymentObject */ $paymentObject = $this->fetchPayment($payment); - return $this->fetch($paymentObject->getAuthorization(true)); + /** @var Authorization $authorize */ + $authorize = $this->fetchResource($paymentObject->getAuthorization(true)); + return $authorize; } // // + public function fetchCharge(Charge $charge): Charge + { + /** @var Charge $retCharge */ + $retCharge = $this->fetchResource($charge); + return $retCharge; + } /** - * Fetch a Charge object by paymentId and chargeId. - * Charge Ids are not global but specific to the payment. - * - * @param Payment|string $payment - * @param string $chargeId - * - * @return Charge - * - * @throws HeidelpayApiException - * @throws RuntimeException + * {@inheritDoc} */ - public function fetchChargeById($payment, $chargeId): AbstractHeidelpayResource + public function fetchChargeById($payment, $chargeId): Charge { /** @var Payment $paymentObject */ $paymentObject = $this->fetchPayment($payment); - return $this->fetch($paymentObject->getCharge($chargeId, true)); + /** @var Charge $charge */ + $charge = $this->fetchResource($paymentObject->getCharge($chargeId, true)); + return $charge; } // @@ -844,53 +718,28 @@ public function fetchChargeById($payment, $chargeId): AbstractHeidelpayResource // /** - * Fetch a cancel on an authorization (aka reversal). - * - * @param Authorization|string $authorization - * @param string $cancellationId - * - * @return Cancellation - * - * @throws HeidelpayApiException - * @throws RuntimeException + * {@inheritDoc} */ - public function fetchReversalByAuthorization($authorization, $cancellationId): AbstractHeidelpayResource + public function fetchReversalByAuthorization($authorization, $cancellationId): Cancellation { - $this->fetch($authorization); + $this->fetchResource($authorization); return $authorization->getCancellation($cancellationId); } /** - * Fetch a Cancellation resource on an authorization (aka reversal) via id. - * - * @param string $paymentId - * @param string $cancellationId - * - * @return Cancellation - * - * @throws HeidelpayApiException - * @throws RuntimeException + * {@inheritDoc} */ - public function fetchReversal($paymentId, $cancellationId): AbstractHeidelpayResource + public function fetchReversal($payment, $cancellationId): Cancellation { /** @var Authorization $authorization */ - $authorization = $this->fetchPayment($paymentId)->getAuthorization(); + $authorization = $this->fetchPayment($payment)->getAuthorization(); return $authorization->getCancellation($cancellationId); } /** - * Fetch a Cancellation resource on a charge (aka refund) via id. - * - * @param Payment|string $payment - * @param string $chargeId - * @param string $cancellationId - * - * @return Cancellation - * - * @throws HeidelpayApiException - * @throws RuntimeException + * {@inheritDoc} */ - public function fetchRefundById($payment, $chargeId, $cancellationId): AbstractHeidelpayResource + public function fetchRefundById($payment, $chargeId, $cancellationId): Cancellation { /** @var Charge $charge */ $charge = $this->fetchChargeById($payment, $chargeId); @@ -898,19 +747,13 @@ public function fetchRefundById($payment, $chargeId, $cancellationId): AbstractH } /** - * Fetch a Cancellation resource on a Charge (aka refund). - * - * @param Charge $charge - * @param string $cancellationId - * - * @return Cancellation - * - * @throws HeidelpayApiException - * @throws RuntimeException + * {@inheritDoc} */ - public function fetchRefund(Charge $charge, $cancellationId): AbstractHeidelpayResource + public function fetchRefund(Charge $charge, $cancellationId): Cancellation { - return $this->fetch($charge->getCancellation($cancellationId, true)); + /** @var Cancellation $cancel */ + $cancel = $this->fetchResource($charge->getCancellation($cancellationId, true)); + return $cancel; } // @@ -918,17 +761,9 @@ public function fetchRefund(Charge $charge, $cancellationId): AbstractHeidelpayR // /** - * Fetch a Shipment resource of the given Payment resource by id. - * - * @param Payment|string $payment - * @param string $shipmentId - * - * @return Shipment - * - * @throws HeidelpayApiException - * @throws RuntimeException + * {@inheritDoc} */ - public function fetchShipment($payment, $shipmentId): AbstractHeidelpayResource + public function fetchShipment($payment, $shipmentId): Shipment { $paymentObject = $this->fetchPayment($payment); return $paymentObject->getShipment($shipmentId); diff --git a/src/Services/WebhookService.php b/src/Services/WebhookService.php index ef5cb9a0..f4e7c8a3 100755 --- a/src/Services/WebhookService.php +++ b/src/Services/WebhookService.php @@ -26,6 +26,7 @@ use heidelpayPHP\Exceptions\HeidelpayApiException; use heidelpayPHP\Heidelpay; +use heidelpayPHP\Interfaces\ResourceServiceInterface; use heidelpayPHP\Resources\AbstractHeidelpayResource; use heidelpayPHP\Resources\Webhook; use heidelpayPHP\Resources\Webhooks; @@ -37,7 +38,7 @@ class WebhookService /** @var Heidelpay $heidelpay */ private $heidelpay; - /** @var ResourceService $resourceService */ + /** @var ResourceServiceInterface $resourceService */ private $resourceService; /** @@ -73,19 +74,19 @@ public function setHeidelpay(Heidelpay $heidelpay): WebhookService } /** - * @return ResourceService + * @return ResourceServiceInterface */ - public function getResourceService(): ResourceService + public function getResourceService(): ResourceServiceInterface { return $this->resourceService; } /** - * @param ResourceService $resourceService + * @param ResourceServiceInterface $resourceService * * @return WebhookService */ - public function setResourceService(ResourceService $resourceService): WebhookService + public function setResourceService(ResourceServiceInterface $resourceService): WebhookService { $this->resourceService = $resourceService; return $this; @@ -134,7 +135,7 @@ public function fetchWebhook($webhook): Webhook } $webhookObject->setParentResource($this->heidelpay); - $this->resourceService->fetch($webhookObject); + $this->resourceService->fetchResource($webhookObject); return $webhookObject; } @@ -191,7 +192,7 @@ public function fetchWebhooks(): array /** @var Webhooks $webhooks */ $webhooks = new Webhooks(); $webhooks->setParentResource($this->heidelpay); - $webhooks = $this->resourceService->fetch($webhooks); + $webhooks = $this->resourceService->fetchResource($webhooks); return $webhooks->getWebhookList(); } diff --git a/test/unit/HeidelpayTest.php b/test/unit/HeidelpayTest.php index 8fdbb580..d1b43494 100755 --- a/test/unit/HeidelpayTest.php +++ b/test/unit/HeidelpayTest.php @@ -28,7 +28,6 @@ use DateTime; use Exception; use heidelpayPHP\Heidelpay; -use heidelpayPHP\Interfaces\PaymentServiceInterface; use heidelpayPHP\Resources\Basket; use heidelpayPHP\Resources\Customer; use heidelpayPHP\Resources\Metadata; @@ -37,7 +36,6 @@ use heidelpayPHP\Resources\PaymentTypes\Paypage; use heidelpayPHP\Resources\PaymentTypes\Sofort; use heidelpayPHP\Resources\TransactionTypes\Authorization; -use heidelpayPHP\Resources\TransactionTypes\Cancellation; use heidelpayPHP\Resources\TransactionTypes\Charge; use heidelpayPHP\Resources\Webhook; use heidelpayPHP\Services\HttpService; @@ -46,7 +44,7 @@ use heidelpayPHP\Services\WebhookService; use heidelpayPHP\test\BasePaymentTest; use heidelpayPHP\test\unit\Services\DummyDebugHandler; -use PHPUnit\Framework\Exception; +use PHPUnit\Framework\MockObject\MockObject; use ReflectionException; use RuntimeException; @@ -132,7 +130,7 @@ public function gettersAndSettersShouldWorkProperly() * Verify heidelpay propagates resource actions to the resource service. * * @test - * @dataProvider heidelpayShouldForwardResourceActionCallsToTheResourceServiceDP + * @dataProvider resourceServiceDP * * @param string $heidelpayMethod * @param array $heidelpayParams @@ -148,14 +146,10 @@ public function heidelpayShouldForwardResourceActionCallsToTheResourceService( $serviceMethod, array $serviceParams ) { - $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->disableOriginalConstructor() - ->setMethods([$serviceMethod])->getMock(); - + /** @var ResourceService|MockObject $resourceSrvMock */ + $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->disableOriginalConstructor()->setMethods([$serviceMethod])->getMock(); $resourceSrvMock->expects($this->once())->method($serviceMethod)->with(...$serviceParams); - $heidelpay = new Heidelpay('s-priv-234'); - - /** @var ResourceService $resourceSrvMock */ - $heidelpay->setResourceService($resourceSrvMock); + $heidelpay = (new Heidelpay('s-priv-234'))->setResourceService($resourceSrvMock); $heidelpay->$heidelpayMethod(...$heidelpayParams); } @@ -180,14 +174,10 @@ public function heidelpayShouldForwardPaymentActionCallsToThePaymentService( $serviceMethod, array $serviceParams ) { - $paymentSrvMock = $this->getMockBuilder(PaymentService::class)->disableOriginalConstructor() - ->setMethods([$serviceMethod])->getMock(); - + /** @var PaymentService|MockObject $paymentSrvMock */ + $paymentSrvMock = $this->getMockBuilder(PaymentService::class)->disableOriginalConstructor()->setMethods([$serviceMethod])->getMock(); $paymentSrvMock->expects($this->once())->method($serviceMethod)->with(...$serviceParams); - $heidelpay = new Heidelpay('s-priv-234'); - - /** @var PaymentServiceInterface $paymentSrvMock */ - $heidelpay->setPaymentService($paymentSrvMock); + $heidelpay = (new Heidelpay('s-priv-234'))->setPaymentService($paymentSrvMock); $heidelpay->$heidelpayMethod(...$heidelpayParams); } @@ -212,14 +202,10 @@ public function heidelpayShouldForwardWebhookActionCallsToTheWebhookService( $serviceMethod, array $serviceParams ) { - $webhookSrvMock = $this->getMockBuilder(WebhookService::class)->disableOriginalConstructor() - ->setMethods([$serviceMethod])->getMock(); - + /** @var WebhookService|MockObject $webhookSrvMock */ + $webhookSrvMock = $this->getMockBuilder(WebhookService::class)->disableOriginalConstructor()->setMethods([$serviceMethod])->getMock(); $webhookSrvMock->expects($this->once())->method($serviceMethod)->with(...$serviceParams); - $heidelpay = new Heidelpay('s-priv-234'); - - /** @var WebhookService $webhookSrvMock */ - $heidelpay->setWebhookService($webhookSrvMock); + $heidelpay = (new Heidelpay('s-priv-234'))->setWebhookService($webhookSrvMock); $heidelpay->$heidelpayMethod(...$heidelpayParams); } @@ -233,9 +219,8 @@ public function heidelpayShouldForwardWebhookActionCallsToTheWebhookService( * * @throws Exception * @throws RuntimeException - * @throws ReflectionException */ - public function heidelpayShouldForwardResourceActionCallsToTheResourceServiceDP(): array + public function resourceServiceDP(): array { $customerId = 'customerId'; $basketId = 'basketId'; @@ -253,15 +238,8 @@ public function heidelpayShouldForwardResourceActionCallsToTheResourceServiceDP( $auth = new Authorization(); $charge = new Charge(); $metadata = new Metadata(); - $cancellation = new Cancellation(); - $chargeMock = $this->getMockBuilder(Charge::class)->setMethods(['getCancellation'])->getMock(); - $chargeMock->expects($this->once())->method('getCancellation')->with($cancelId, true)->willReturn( - $cancellation - ); return [ - 'getResource' => ['getResource', [$customer], 'getResource', [$customer]], - 'fetchResource' => ['fetchResource', [$customer], 'fetch', [$customer]], 'fetchPayment' => ['fetchPayment', [$payment], 'fetchPayment', [$payment]], 'fetchPaymentByOrderId' => ['fetchPaymentByOrderId', [$orderId], 'fetchPaymentByOrderId', [$orderId]], 'fetchPaymentStr' => ['fetchPayment', [$paymentId], 'fetchPayment', [$paymentId]], @@ -286,16 +264,16 @@ public function heidelpayShouldForwardResourceActionCallsToTheResourceServiceDP( 'fetchAuthorization' => ['fetchAuthorization', [$payment], 'fetchAuthorization', [$payment]], 'fetchAuthorizationStr' => ['fetchAuthorization', [$paymentId], 'fetchAuthorization', [$paymentId]], 'fetchChargeById' => ['fetchChargeById', [$paymentId, $chargeId], 'fetchChargeById', [$paymentId, $chargeId]], - 'fetchCharge' => ['fetchCharge', [$charge], 'fetch', [$charge]], + 'fetchCharge' => ['fetchCharge', [$charge], 'fetchCharge', [$charge]], 'fetchReversalByAuthorization' => ['fetchReversalByAuthorization', [$auth, $cancelId], 'fetchReversalByAuthorization', [$auth, $cancelId]], 'fetchReversal' => ['fetchReversal', [$payment, $cancelId], 'fetchReversal', [$payment, $cancelId]], 'fetchReversalStr' => ['fetchReversal', [$paymentId, $cancelId], 'fetchReversal', [$paymentId, $cancelId]], 'fetchRefundById' => ['fetchRefundById', [$payment, $chargeId, $cancelId], 'fetchRefundById', [$payment, $chargeId, $cancelId]], 'fetchRefundByIdStr' => ['fetchRefundById', [$paymentId, $chargeId, $cancelId], 'fetchRefundById', [$paymentId, $chargeId, $cancelId]], - 'fetchRefund' => ['fetchRefund', [$chargeMock, $cancelId], 'fetch', [$cancellation]], + 'fetchRefund' => ['fetchRefund', [$charge, $cancelId], 'fetchRefund', [$charge, $cancelId]], 'fetchShipment' => ['fetchShipment', [$payment, 'shipId'], 'fetchShipment', [$payment, 'shipId']], - 'activateRecurring' => ['activateRecurringPayment', [$card, 'returnUrl'], 'createRecurring', [$card, 'returnUrl']], - 'activateRecurringWithId' => ['activateRecurringPayment', [$paymentTypeId, 'returnUrl'], 'createRecurring', [$paymentTypeId, 'returnUrl']], + 'activateRecurring' => ['activateRecurringPayment', [$card, 'returnUrl'], 'activateRecurringPayment', [$card, 'returnUrl']], + 'activateRecurringWithId' => ['activateRecurringPayment', [$paymentTypeId, 'returnUrl'], 'activateRecurringPayment', [$paymentTypeId, 'returnUrl']], 'fetchPayout' => ['fetchPayout', [$payment], 'fetchPayout', [$payment]], 'updatePaymentType' => ['updatePaymentType', [$card], 'updatePaymentType', [$card]] ]; diff --git a/test/unit/Resources/CustomerTest.php b/test/unit/Resources/CustomerTest.php index 0c6d1c6f..ee8aa7f5 100755 --- a/test/unit/Resources/CustomerTest.php +++ b/test/unit/Resources/CustomerTest.php @@ -30,6 +30,7 @@ use heidelpayPHP\Constants\Salutations; use heidelpayPHP\Exceptions\HeidelpayApiException; use heidelpayPHP\Heidelpay; +use heidelpayPHP\Interfaces\ResourceServiceInterface; use heidelpayPHP\Resources\Customer; use heidelpayPHP\Resources\EmbeddedResources\Address; use heidelpayPHP\Resources\EmbeddedResources\CompanyInfo; @@ -262,16 +263,15 @@ public function customerShouldBeFetchedByCustomerIdIfIdIsNotSet() public function fetchCustomerByOrderIdShouldCreateCustomerObjectWithCustomerIdAndCallFetch() { $heidelpay = new Heidelpay('s-priv-1234'); - $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->setMethods(['fetch'])->setConstructorArgs([$heidelpay])->getMock(); - $resourceSrvMock->expects($this->once())->method('fetch') - ->with($this->callback( - static function ($customer) use ($heidelpay) { - return $customer instanceof Customer && - $customer->getCustomerId() === 'myCustomerId' && - $customer->getHeidelpayObject() === $heidelpay; - })); - - /** @var ResourceService $resourceSrvMock */ + $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->setMethods(['fetchResource'])->setConstructorArgs([$heidelpay])->getMock(); + $resourceSrvMock->expects($this->once())->method('fetchResource') + ->with($this->callback(static function ($customer) use ($heidelpay) { + return $customer instanceof Customer && + $customer->getCustomerId() === 'myCustomerId' && + $customer->getHeidelpayObject() === $heidelpay; + })); + + /** @var ResourceServiceInterface $resourceSrvMock */ $resourceSrvMock->fetchCustomerByExtCustomerId('myCustomerId'); } diff --git a/test/unit/Resources/PaymentTest.php b/test/unit/Resources/PaymentTest.php index 266af02a..9bfc0467 100755 --- a/test/unit/Resources/PaymentTest.php +++ b/test/unit/Resources/PaymentTest.php @@ -27,6 +27,7 @@ use heidelpayPHP\Constants\PaymentState; use heidelpayPHP\Exceptions\HeidelpayApiException; use heidelpayPHP\Heidelpay; +use heidelpayPHP\Interfaces\ResourceServiceInterface; use heidelpayPHP\Resources\Basket; use heidelpayPHP\Resources\Customer; use heidelpayPHP\Resources\CustomerFactory; @@ -95,7 +96,7 @@ public function getAuthorizationShouldFetchAuthorizeIfNotLazyAndAuthIsNotNull() ->disableOriginalConstructor()->setMethods(['getResource'])->getMock(); $resourceServiceMock->expects($this->once())->method('getResource')->with($authorization); - /** @var ResourceService $resourceServiceMock */ + /** @var ResourceServiceInterface $resourceServiceMock */ $heidelpayObj = (new Heidelpay('s-priv-123'))->setResourceService($resourceServiceMock); $payment->setParentResource($heidelpayObj); @@ -119,7 +120,7 @@ public function getAuthorizationShouldNotFetchAuthorizeIfNotLazyAndAuthIsNull() ->disableOriginalConstructor()->setMethods(['getResource'])->getMock(); $resourceServiceMock->expects($this->never())->method('getResource'); - /** @var ResourceService $resourceServiceMock */ + /** @var ResourceServiceInterface $resourceServiceMock */ $heidelpayObj = (new Heidelpay('s-priv-123'))->setResourceService($resourceServiceMock); $payment->setParentResource($heidelpayObj); @@ -181,7 +182,7 @@ public function getChargeByIdShouldFetchChargeIfItExistsAndLazyLoadingIsOff() ->method('getResource') ->withConsecutive([$charge1], [$charge2]); - /** @var ResourceService $resourceServiceMock */ + /** @var ResourceServiceInterface $resourceServiceMock */ $heidelpayObj = (new Heidelpay('s-priv-123'))->setResourceService($resourceServiceMock); $payment->setParentResource($heidelpayObj); @@ -213,7 +214,7 @@ public function getChargeShouldFetchChargeIfItExistsAndLazyLoadingIsOff() ->method('getResource') ->withConsecutive([$charge1], [$charge2]); - /** @var ResourceService $resourceServiceMock */ + /** @var ResourceServiceInterface $resourceServiceMock */ $heidelpayObj = (new Heidelpay('s-priv-123'))->setResourceService($resourceServiceMock); $payment->setParentResource($heidelpayObj); @@ -264,7 +265,7 @@ public function getPayoutShouldFetchPayoutIfNotLazyAndPayoutIsNotNull() $resourceServiceMock = $this->getMockBuilder(ResourceService::class)->disableOriginalConstructor()->setMethods(['getResource'])->getMock(); $resourceServiceMock->expects($this->once())->method('getResource')->with($payout); - /** @var ResourceService $resourceServiceMock */ + /** @var ResourceServiceInterface $resourceServiceMock */ $heidelpayObj = (new Heidelpay('s-priv-123'))->setResourceService($resourceServiceMock); $payment->setParentResource($heidelpayObj); @@ -287,7 +288,7 @@ public function getPayoutShouldNotFetchPayoutIfNotLazyAndPayoutIsNull() $resourceServiceMock = $this->getMockBuilder(ResourceService::class)->disableOriginalConstructor()->setMethods(['getResource'])->getMock(); $resourceServiceMock->expects($this->never())->method('getResource'); - /** @var ResourceService $resourceServiceMock */ + /** @var ResourceServiceInterface $resourceServiceMock */ $heidelpayObj = (new Heidelpay('s-priv-123'))->setResourceService($resourceServiceMock); $payment->setParentResource($heidelpayObj); @@ -335,7 +336,7 @@ public function setCustomerShouldFetchCustomerIfItIsPassedAsIdString() ->disableOriginalConstructor()->setMethods(['fetchCustomer'])->getMock(); $resourceServiceMock->expects($this->once())->method('fetchCustomer')->with('MyCustomerId'); - /** @var ResourceService $resourceServiceMock */ + /** @var ResourceServiceInterface $resourceServiceMock */ $heidelpayObj = (new Heidelpay('s-priv-123'))->setResourceService($resourceServiceMock); $payment->setParentResource($heidelpayObj); @@ -360,7 +361,7 @@ public function setCustomerShouldCreateCustomerIfItIsPassedAsObjectWithoutId() ->disableOriginalConstructor()->setMethods(['createCustomer'])->getMock(); $resourceServiceMock->expects($this->once())->method('createCustomer')->with($customer); - /** @var ResourceService $resourceServiceMock */ + /** @var ResourceServiceInterface $resourceServiceMock */ $heidelpayObj = (new Heidelpay('s-priv-123'))->setResourceService($resourceServiceMock); $payment->setParentResource($heidelpayObj); @@ -408,7 +409,7 @@ public function setPaymentTypeShouldFetchResourceIfItIsPassedAsIdString() ->disableOriginalConstructor()->setMethods(['fetchPaymentType'])->getMock(); $resourceServiceMock->expects($this->once())->method('fetchPaymentType')->with('MyPaymentId'); - /** @var ResourceService $resourceServiceMock */ + /** @var ResourceServiceInterface $resourceServiceMock */ $heidelpayObj = (new Heidelpay('s-priv-123'))->setResourceService($resourceServiceMock); $payment->setParentResource($heidelpayObj); @@ -433,7 +434,7 @@ public function setPaymentTypeShouldCreateResourceIfItIsPassedAsObjectWithoutId( ->disableOriginalConstructor()->setMethods(['createPaymentType'])->getMock(); $resourceServiceMock->expects($this->once())->method('createPaymentType')->with($paymentType); - /** @var ResourceService $resourceServiceMock */ + /** @var ResourceServiceInterface $resourceServiceMock */ $heidelpayObj = (new Heidelpay('s-priv-123'))->setResourceService($resourceServiceMock); $payment->setParentResource($heidelpayObj); @@ -555,7 +556,7 @@ public function getCancellationShouldReturnCancellationIfItExistsAndFetchItIfNot ->disableOriginalConstructor()->setMethods(['getResource'])->getMock(); $resourceServiceMock->expects($this->once())->method('getResource')->with($cancellation); - /** @var ResourceService $resourceServiceMock */ + /** @var ResourceServiceInterface $resourceServiceMock */ $heidelpayObj = (new Heidelpay('s-priv-123'))->setResourceService($resourceServiceMock); /** @var Payment $paymentMock */ @@ -613,7 +614,7 @@ public function getShipmentByIdShouldReturnShipmentIfItExistsAndFetchItIfNotLazy ->disableOriginalConstructor()->setMethods(['getResource'])->getMock(); $resourceServiceMock->expects($this->once())->method('getResource')->with($shipment); - /** @var ResourceService $resourceServiceMock */ + /** @var ResourceServiceInterface $resourceServiceMock */ $heidelpayObj = (new Heidelpay('s-priv-123'))->setResourceService($resourceServiceMock); /** @var Payment $paymentMock */ @@ -708,7 +709,7 @@ public function handleResponseShouldFetchCustomerIfItIsNotSet() ->disableOriginalConstructor()->setMethods(['fetchCustomer'])->getMock(); $resourceServiceMock->expects($this->once())->method('fetchCustomer')->with('MyNewCustomerId'); - /** @var ResourceService $resourceServiceMock */ + /** @var ResourceServiceInterface $resourceServiceMock */ $heidelpayObj = (new Heidelpay('s-priv-123'))->setResourceService($resourceServiceMock); $payment->setParentResource($heidelpayObj); @@ -738,7 +739,7 @@ public function handleResponseShouldFetchAndUpdateCustomerIfItIsAlreadySet() ->disableOriginalConstructor()->setMethods(['getResource'])->getMock(); $resourceServiceMock->expects($this->once())->method('getResource')->with($customer); - /** @var ResourceService $resourceServiceMock */ + /** @var ResourceServiceInterface $resourceServiceMock */ $heidelpayObj = (new Heidelpay('s-priv-123'))->setResourceService($resourceServiceMock); $payment->setParentResource($heidelpayObj); $payment->setCustomer($customer); @@ -766,7 +767,7 @@ public function handleResponseShouldFetchAndUpdatePaymentTypeIfTheIdIsSet() ->disableOriginalConstructor()->setMethods(['fetchPaymentType'])->getMock(); $resourceServiceMock->expects($this->once())->method('fetchPaymentType')->with('PaymentTypeId'); - /** @var ResourceService $resourceServiceMock */ + /** @var ResourceServiceInterface $resourceServiceMock */ $heidelpayObj = (new Heidelpay('s-priv-123'))->setResourceService($resourceServiceMock); $payment->setParentResource($heidelpayObj); @@ -789,7 +790,7 @@ public function handleResponseShouldFetchAndUpdateMetadataIfTheIdIsSet() { $resourceServiceMock = $this->getMockBuilder(ResourceService::class)->disableOriginalConstructor()->setMethods(['fetchMetadata'])->getMock(); $resourceServiceMock->expects($this->once())->method('fetchMetadata')->with('MetadataId'); - /** @var ResourceService $resourceServiceMock */ + /** @var ResourceServiceInterface $resourceServiceMock */ $heidelpayObj = (new Heidelpay('s-priv-123'))->setResourceService($resourceServiceMock); $payment = (new Payment())->setId('myPaymentId')->setParentResource($heidelpayObj); @@ -813,7 +814,7 @@ public function handleResponseShouldGetMetadataIfUnfetchedMetadataObjectWithIdIs $metadata = (new Metadata())->setId('MetadataId'); $resourceServiceMock = $this->getMockBuilder(ResourceService::class)->disableOriginalConstructor()->setMethods(['getResource'])->getMock(); $resourceServiceMock->expects($this->once())->method('getResource')->with($metadata); - /** @var ResourceService $resourceServiceMock */ + /** @var ResourceServiceInterface $resourceServiceMock */ $heidelpayObj = (new Heidelpay('s-priv-123'))->setResourceService($resourceServiceMock); $payment = (new Payment())->setId('myPaymentId')->setParentResource($heidelpayObj)->setMetadata($metadata); @@ -1362,7 +1363,7 @@ public function setMetaDataShouldSetParentResourceAndCreateMetaDataObject() $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->setMethods(['create'])->disableOriginalConstructor()->getMock(); $resourceSrvMock->expects($this->once())->method('create')->with($metadata); - /** @var ResourceService $resourceSrvMock */ + /** @var ResourceServiceInterface $resourceSrvMock */ $heidelpay = (new Heidelpay('s-priv-1234'))->setResourceService($resourceSrvMock); $payment = new Payment($heidelpay); @@ -1392,7 +1393,7 @@ public function metadataMustBeOfTypeMetadata() $metadata = new Metadata(); $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->setMethods(['create'])->disableOriginalConstructor()->getMock(); $resourceSrvMock->expects($this->once())->method('create')->with($metadata); - /** @var ResourceService $resourceSrvMock */ + /** @var ResourceServiceInterface $resourceSrvMock */ $heidelpay = (new Heidelpay('s-priv-1234'))->setResourceService($resourceSrvMock); // when @@ -1429,7 +1430,7 @@ public function setBasketShouldCallCreateIfTheGivenBasketObjectDoesNotExistYet() $heidelpay = new Heidelpay('s-priv-123'); $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->setConstructorArgs([$heidelpay])->setMethods(['create'])->getMock(); - /** @var ResourceService $resourceSrvMock */ + /** @var ResourceServiceInterface $resourceSrvMock */ $heidelpay->setResourceService($resourceSrvMock); $basket = new Basket(); @@ -1459,7 +1460,7 @@ public function setBasketWontCallResourceServiceWhenBasketIsNull() $heidelpay = new Heidelpay('s-priv-123'); $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->setConstructorArgs([$heidelpay])->setMethods(['create'])->getMock(); - /** @var ResourceService $resourceSrvMock */ + /** @var ResourceServiceInterface $resourceSrvMock */ $heidelpay->setResourceService($resourceSrvMock); $resourceSrvMock->expects($this->once())->method('create'); diff --git a/test/unit/Resources/PaymentTypes/PayPageTest.php b/test/unit/Resources/PaymentTypes/PayPageTest.php index 0b0114c3..e7c6a85d 100644 --- a/test/unit/Resources/PaymentTypes/PayPageTest.php +++ b/test/unit/Resources/PaymentTypes/PayPageTest.php @@ -27,6 +27,7 @@ use heidelpayPHP\Adapter\HttpAdapterInterface; use heidelpayPHP\Constants\TransactionTypes; use heidelpayPHP\Exceptions\HeidelpayApiException; +use heidelpayPHP\Interfaces\ResourceServiceInterface; use heidelpayPHP\Resources\Basket; use heidelpayPHP\Resources\Customer; use heidelpayPHP\Resources\Metadata; @@ -295,8 +296,8 @@ public function responseHandlingShouldMapSpecialFieldsProperly() public function paymentShouldBeFetchedWhenItIsNoGetRequest($method, $fetchCallCount) { // mock resource service to check whether fetch is called on it with the payment object. - /** @var ResourceService|MockObject $resourceSrvMock */ - $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->disableOriginalConstructor()->setMethods(['fetch'])->getMock(); + /** @var ResourceServiceInterface|MockObject $resourceSrvMock */ + $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->disableOriginalConstructor()->setMethods(['fetchResource'])->getMock(); // when $paypage = new Paypage(123.4, 'EUR', 'https://docs.heidelpay.com'); @@ -304,7 +305,7 @@ public function paymentShouldBeFetchedWhenItIsNoGetRequest($method, $fetchCallCo $paypage->setPayment($payment)->setParentResource($payment); // should - $resourceSrvMock->expects($this->exactly($fetchCallCount))->method('fetch')->with($payment); + $resourceSrvMock->expects($this->exactly($fetchCallCount))->method('fetchResource')->with($payment); // when $response = new stdClass(); diff --git a/test/unit/Resources/TransactionTypes/AbstractTransactionTypeTest.php b/test/unit/Resources/TransactionTypes/AbstractTransactionTypeTest.php index 3ac1ae70..966f9e8f 100755 --- a/test/unit/Resources/TransactionTypes/AbstractTransactionTypeTest.php +++ b/test/unit/Resources/TransactionTypes/AbstractTransactionTypeTest.php @@ -28,6 +28,7 @@ use heidelpayPHP\Adapter\HttpAdapterInterface; use heidelpayPHP\Exceptions\HeidelpayApiException; use heidelpayPHP\Heidelpay; +use heidelpayPHP\Interfaces\ResourceServiceInterface; use heidelpayPHP\Resources\Payment; use heidelpayPHP\Resources\TransactionTypes\AbstractTransactionType; use heidelpayPHP\Services\ResourceService; @@ -181,10 +182,10 @@ public function fetchPaymentShouldFetchPaymentObject() $payment = (new Payment())->setId('myPaymentId'); $resourceServiceMock = $this->getMockBuilder(ResourceService::class) - ->disableOriginalConstructor()->setMethods(['fetch'])->getMock(); - $resourceServiceMock->expects($this->once())->method('fetch')->with($payment); + ->disableOriginalConstructor()->setMethods(['fetchResource'])->getMock(); + $resourceServiceMock->expects($this->once())->method('fetchResource')->with($payment); - /** @var ResourceService $resourceServiceMock */ + /** @var ResourceServiceInterface $resourceServiceMock */ $heidelpayObj = (new Heidelpay('s-priv-123'))->setResourceService($resourceServiceMock); $payment->setParentResource($heidelpayObj); diff --git a/test/unit/Services/PaymentServiceTest.php b/test/unit/Services/PaymentServiceTest.php index 21b9d564..7377d3b3 100755 --- a/test/unit/Services/PaymentServiceTest.php +++ b/test/unit/Services/PaymentServiceTest.php @@ -28,6 +28,7 @@ use heidelpayPHP\Exceptions\HeidelpayApiException; use heidelpayPHP\Heidelpay; use heidelpayPHP\Interfaces\PaymentServiceInterface; +use heidelpayPHP\Interfaces\ResourceServiceInterface; use heidelpayPHP\Resources\Basket; use heidelpayPHP\Resources\Customer; use heidelpayPHP\Resources\InstalmentPlans; @@ -98,7 +99,7 @@ public function authorizeShouldCreateNewAuthorizationAndPayment($card3ds) $metadata = (new Metadata())->setId('myMetadataId'); $basket = (new Basket())->setId('myBasketId'); - /** @var ResourceService|MockObject $resourceSrvMock */ + /** @var ResourceServiceInterface|MockObject $resourceSrvMock */ $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->disableOriginalConstructor()->setMethods(['create'])->getMock(); $paymentSrv = (new Heidelpay('s-priv-123'))->setResourceService($resourceSrvMock)->getPaymentService(); $resourceSrvMock->expects($this->once())->method('create') @@ -164,7 +165,7 @@ public function chargeShouldCreateNewPaymentAndCharge($card3ds) in_array($charge, $newPayment->getCharges(), true); })); - /** @var ResourceService $resourceSrvMock */ + /** @var ResourceServiceInterface $resourceSrvMock */ $paymentSrv = $heidelpay->setResourceService($resourceSrvMock)->getPaymentService(); $returnedCharge = $paymentSrv->charge(1.234, 'myCurrency', $paymentType, 'myUrl', $customer, 'myId', $metadata, $basket, $card3ds); $this->assertSame($paymentType, $returnedCharge->getPayment()->getPaymentType()); @@ -202,7 +203,7 @@ public function chargeAuthorizationShouldCallChargePaymentWithTheGivenPaymentObj */ public function chargeAuthorizationShouldCallFetchPaymentIfThePaymentIsPassedAsIdString() { - /** @var ResourceService|MockObject $resourceSrvMock */ + /** @var ResourceServiceInterface|MockObject $resourceSrvMock */ $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->setMethods(['fetchPayment'])->disableOriginalConstructor()->getMock(); $resourceSrvMock->expects($this->once())->method('fetchPayment')->willReturn(new Payment()); /** @var PaymentService|MockObject $paymentSrvMock */ @@ -227,7 +228,7 @@ public function chargePaymentShouldCallCreateOnResourceServiceWithNewCharge() $heidelpay = new Heidelpay('s-priv-123'); $payment = (new Payment())->setParentResource($heidelpay)->setId('myPaymentId'); - /** @var ResourceService|MockObject $resourceSrvMock */ + /** @var ResourceServiceInterface|MockObject $resourceSrvMock */ $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->disableOriginalConstructor()->setMethods(['create'])->getMock(); $resourceSrvMock->expects($this->once())->method('create') ->with($this->callback(static function ($charge) use ($payment) { @@ -265,7 +266,7 @@ public function cancelAuthorizationShouldCallCreateOnResourceServiceWithNewCance $payment = (new Payment())->setParentResource($heidelpay)->setId('myPaymentId'); $authorization = (new Authorization())->setPayment($payment)->setId('s-aut-1'); - /** @var ResourceService|MockObject $resourceSrvMock */ + /** @var ResourceServiceInterface|MockObject $resourceSrvMock */ $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->disableOriginalConstructor()->setMethods(['create'])->getMock(); $resourceSrvMock->expects($this->once())->method('create') ->with($this->callback(static function ($cancellation) use ($authorization, $payment) { @@ -297,7 +298,7 @@ public function cancelAuthorizationByPaymentShouldCallCancelAuthorization() $authorization = (new Authorization())->setId('s-aut-1'); $heidelpay = new Heidelpay('s-priv-1234'); - /** @var ResourceService|MockObject $resourceSrvMock */ + /** @var ResourceServiceInterface|MockObject $resourceSrvMock */ $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->setMethods(['fetchAuthorization'])->disableOriginalConstructor()->getMock(); $resourceSrvMock->expects($this->exactly(2))->method('fetchAuthorization')->willReturn($authorization); /** @var PaymentService|MockObject $paymentSrvMock */ @@ -323,7 +324,7 @@ public function cancelChargeByIdShouldFetchChargeAndPropagateToCancelCharge() $payment = (new Payment())->setId('myPaymentId'); $charge = new Charge(); - /** @var ResourceService|MockObject $resourceSrvMock */ + /** @var ResourceServiceInterface|MockObject $resourceSrvMock */ $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->setMethods(['fetchChargeById'])->disableOriginalConstructor()->getMock(); $resourceSrvMock->expects($this->exactly(2))->method('fetchChargeById')->with($payment, 's-chg-1')->willReturn($charge); @@ -352,7 +353,7 @@ public function cancelChargeShouldCreateCancellationAndCallsCreate() $payment = (new Payment())->setParentResource($heidelpay); $charge = (new Charge())->setPayment($payment); - /** @var ResourceService|MockObject $resourceSrvMock */ + /** @var ResourceServiceInterface|MockObject $resourceSrvMock */ $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->setMethods(['create'])->disableOriginalConstructor()->getMock(); $resourceSrvMock->expects($this->once())->method('create') ->with($this->callback(static function ($cancellation) use ($payment, $charge) { @@ -383,23 +384,22 @@ public function cancelChargeShouldCreateCancellationAndCallsCreate() public function shipShouldCreateShipmentAndCallCreateOnResourceServiceWithIt() { $heidelpay = new Heidelpay('s-priv-1234'); - $paymentSrv = $heidelpay->getPaymentService(); $payment = new Payment(); - /** @var ResourceService|MockObject $resourceSrvMock */ - $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->setMethods(['create', 'fetchPayment'])->disableOriginalConstructor()->getMock(); + /** @var ResourceServiceInterface|MockObject $resourceSrvMock */ + $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->setMethods(['create'])->disableOriginalConstructor()->getMock(); $resourceSrvMock->expects($this->exactly(2))->method('create') ->with($this->callback(static function ($shipment) use ($payment) { return $shipment instanceof Shipment && $shipment->getPayment() === $payment && $shipment->getParentResource() === $payment; })); - $resourceSrvMock->expects($this->once())->method('fetchPayment')->with('myPaymentId')->willReturn($payment); $heidelpay->setResourceService($resourceSrvMock); - $this->assertInstanceOf(Shipment::class, $paymentSrv->ship($payment)); + $heidelpay->getPaymentService()->ship($payment); $this->assertCount(1, $payment->getShipments()); - $this->assertInstanceOf(Shipment::class, $paymentSrv->ship('myPaymentId')); + + $heidelpay->getPaymentService()->ship($payment); $this->assertCount(2, $payment->getShipments()); } @@ -422,7 +422,7 @@ public function payoutShouldCreatePaymentAndCallPayoutWithPayment() $customer = (new Customer())->setId('customerId'); $metadata = (new Metadata())->setId('metadataId'); - /** @var ResourceService|MockObject $resourceSrvMock */ + /** @var ResourceServiceInterface|MockObject $resourceSrvMock */ $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->disableOriginalConstructor()->setMethods(['create'])->getMock(); $resourceSrvMock->expects(self::once())->method('create') ->with(self::callback(static function ($payout) use ($customer, $metadata) { @@ -455,7 +455,7 @@ public function payoutShouldCreateNewPayout() $metadata = (new Metadata())->setId('id-3'); $heidelpay = new Heidelpay('s-priv-123'); - /** @var ResourceService|MockObject $resourceSrvMock */ + /** @var ResourceServiceInterface|MockObject $resourceSrvMock */ $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->disableOriginalConstructor()->setMethods(['create'])->getMock(); $resourceSrvMock->expects($this->once())->method('create') ->with($this->callback(static function ($payout) use ($customer, $basket, $metadata) { @@ -510,7 +510,7 @@ public function paymentShouldBeCreatedByInitPayPage(string $action) { $method = 'initPayPage' . $action; - /** @var ResourceService|MockObject $resourceSrvMock */ + /** @var ResourceServiceInterface|MockObject $resourceSrvMock */ $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->setMethods(['create'])->disableOriginalConstructor()->getMock(); $paymentSrv = (new Heidelpay('s-priv-1234'))->setResourceService($resourceSrvMock)->getPaymentService(); @@ -552,12 +552,12 @@ public function paymentShouldBeCreatedByInitPayPage(string $action) public function fetchInstalmentPlansWillCallFetchOnResourceService() { $heidelpay = new Heidelpay('s-priv-1234'); - /** @var MockObject|ResourceService $resourceSrvMock */ - $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->setConstructorArgs(['heidelpay' => $heidelpay])->setMethods(['fetch'])->getMock(); + /** @var MockObject|ResourceServiceInterface $resourceSrvMock */ + $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->setConstructorArgs(['heidelpay' => $heidelpay])->setMethods(['fetchResource'])->getMock(); $heidelpay->setResourceService($resourceSrvMock); $date = $this->getYesterdaysTimestamp(); - $resourceSrvMock->expects($this->once())->method('fetch') + $resourceSrvMock->expects($this->once())->method('fetchResource') ->with($this->callback(static function ($param) use ($date) { return $param instanceof InstalmentPlans && $param->getAmount() === 12.23 && diff --git a/test/unit/Services/ResourceServiceTest.php b/test/unit/Services/ResourceServiceTest.php index c131182b..dad43518 100755 --- a/test/unit/Services/ResourceServiceTest.php +++ b/test/unit/Services/ResourceServiceTest.php @@ -30,6 +30,7 @@ use heidelpayPHP\Constants\ApiResponseCodes; use heidelpayPHP\Exceptions\HeidelpayApiException; use heidelpayPHP\Heidelpay; +use heidelpayPHP\Interfaces\ResourceServiceInterface; use heidelpayPHP\Resources\AbstractHeidelpayResource; use heidelpayPHP\Resources\Basket; use heidelpayPHP\Resources\Customer; @@ -125,11 +126,11 @@ public function getResourceShouldFetchIfTheResourcesIdIsSetAndItHasNotBeenFetche $resource, $timesFetchIsCalled ) { - $resourceSrv = $this->getMockBuilder(ResourceService::class)->setMethods(['fetch'])->disableOriginalConstructor()->getMock(); - $resourceSrv->expects($this->exactly($timesFetchIsCalled))->method('fetch')->with($resource); + /** @var ResourceService|MockObject $resourceSrvMock */ + $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->setMethods(['fetchResource'])->disableOriginalConstructor()->getMock(); + $resourceSrvMock->expects($this->exactly($timesFetchIsCalled))->method('fetchResource')->with($resource); - /** @var ResourceService $resourceSrv */ - $resourceSrv->getResource($resource); + $resourceSrvMock->getResource($resource); } /** @@ -146,16 +147,14 @@ public function createShouldCallSendAndThenHandleResponseWithTheResponseData() $response = new stdClass(); $response->id = 'myTestId'; + /** @var Customer|MockObject $testResource */ $testResource = $this->getMockBuilder(Customer::class)->setMethods(['handleResponse'])->getMock(); $testResource->expects($this->once())->method('handleResponse')->with($response, HttpAdapterInterface::REQUEST_POST); + /** @var ResourceService|MockObject $resourceServiceMock */ $resourceServiceMock = $this->getMockBuilder(ResourceService::class)->setMethods(['send'])->disableOriginalConstructor()->getMock(); $resourceServiceMock->expects($this->once())->method('send')->with($testResource, HttpAdapterInterface::REQUEST_POST)->willReturn($response); - /** - * @var ResourceService $resourceServiceMock - * @var AbstractHeidelpayResource $testResource - */ $this->assertSame($testResource, $resourceServiceMock->create($testResource)); $this->assertEquals('myTestId', $testResource->getId()); } @@ -175,16 +174,14 @@ public function createShouldNotHandleResponseWithError() $response->isError = true; $response->id = 'myId'; + /** @var Customer|MockObject $testResource */ $testResource = $this->getMockBuilder(Customer::class)->setMethods(['handleResponse'])->getMock(); $testResource->expects($this->never())->method('handleResponse'); + /** @var ResourceService|MockObject $resourceServiceMock */ $resourceServiceMock = $this->getMockBuilder(ResourceService::class)->setMethods(['send'])->disableOriginalConstructor()->getMock(); $resourceServiceMock->expects($this->once())->method('send')->with($testResource, HttpAdapterInterface::REQUEST_POST)->willReturn($response); - /** - * @var ResourceService $resourceServiceMock - * @var AbstractHeidelpayResource $testResource - */ $this->assertSame($testResource, $resourceServiceMock->create($testResource)); $this->assertNull($testResource->getId()); } @@ -202,16 +199,14 @@ public function updateShouldCallSendAndThenHandleResponseWithTheResponseData() { $response = new stdClass(); + /** @var Customer|MockObject $testResource */ $testResource = $this->getMockBuilder(Customer::class)->setMethods(['handleResponse'])->getMock(); $testResource->expects($this->once())->method('handleResponse')->with($response, HttpAdapterInterface::REQUEST_PUT); + /** @var ResourceService|MockObject $resourceServiceMock */ $resourceServiceMock = $this->getMockBuilder(ResourceService::class)->setMethods(['send'])->disableOriginalConstructor()->getMock(); $resourceServiceMock->expects($this->once())->method('send')->with($testResource, HttpAdapterInterface::REQUEST_PUT)->willReturn($response); - /** - * @var ResourceService $resourceServiceMock - * @var AbstractHeidelpayResource $testResource - */ $this->assertSame($testResource, $resourceServiceMock->update($testResource)); } @@ -226,19 +221,14 @@ public function updateShouldCallSendAndThenHandleResponseWithTheResponseData() */ public function updateShouldNotHandleResponseWithError() { - $response = new stdClass(); - $response->isError = true; - + /** @var Customer|MockObject $testResource */ $testResource = $this->getMockBuilder(Customer::class)->setMethods(['handleResponse'])->getMock(); $testResource->expects($this->never())->method('handleResponse'); + /** @var ResourceService|MockObject $resourceServiceMock */ $resourceServiceMock = $this->getMockBuilder(ResourceService::class)->setMethods(['send'])->disableOriginalConstructor()->getMock(); - $resourceServiceMock->expects($this->once())->method('send')->with($testResource, HttpAdapterInterface::REQUEST_PUT)->willReturn($response); + $resourceServiceMock->expects($this->once())->method('send')->with($testResource, HttpAdapterInterface::REQUEST_PUT)->willReturn((object)['isError' => true]); - /** - * @var ResourceService $resourceServiceMock - * @var AbstractHeidelpayResource $testResource - */ $this->assertSame($testResource, $resourceServiceMock->update($testResource)); } @@ -253,16 +243,13 @@ public function updateShouldNotHandleResponseWithError() */ public function deleteShouldCallSendAndThenSetTheResourceNull() { - $response = new stdClass(); - + /** @var Customer|MockObject $testResource */ $testResource = $this->getMockBuilder(Customer::class)->getMock(); + + /** @var ResourceService|MockObject $resourceServiceMock */ $resourceServiceMock = $this->getMockBuilder(ResourceService::class)->setMethods(['send'])->disableOriginalConstructor()->getMock(); - $resourceServiceMock->expects($this->once())->method('send')->with($testResource, HttpAdapterInterface::REQUEST_DELETE)->willReturn($response); + $resourceServiceMock->expects($this->once())->method('send')->with($testResource, HttpAdapterInterface::REQUEST_DELETE)->willReturn(new stdClass()); - /** - * @var ResourceService $resourceServiceMock - * @var AbstractHeidelpayResource $testResource - */ $this->assertNull($resourceServiceMock->delete($testResource)); $this->assertNull($testResource); } @@ -278,18 +265,13 @@ public function deleteShouldCallSendAndThenSetTheResourceNull() */ public function deleteShouldNotDeleteObjectOnResponseWithError() { - $response = new stdClass(); - $response->isError = true; - + /** @var Customer|MockObject $testResource */ $testResource = $this->getMockBuilder(Customer::class)->getMock(); + /** @var ResourceService|MockObject $resourceServiceMock */ $resourceServiceMock = $this->getMockBuilder(ResourceService::class)->setMethods(['send'])->disableOriginalConstructor()->getMock(); - $resourceServiceMock->expects($this->once())->method('send')->with($testResource, HttpAdapterInterface::REQUEST_DELETE)->willReturn($response); + $resourceServiceMock->expects($this->once())->method('send')->with($testResource, HttpAdapterInterface::REQUEST_DELETE)->willReturn((object)['isError' => true]); - /** - * @var ResourceService $resourceServiceMock - * @var AbstractHeidelpayResource $testResource - */ $responseResource = $resourceServiceMock->delete($testResource); $this->assertNotNull($responseResource); $this->assertNotNull($testResource); @@ -310,18 +292,17 @@ public function fetchShouldCallSendWithGetUpdateFetchedAtAndCallHandleResponse() { $response = new stdClass(); $response->test = '234'; + + /** @var AbstractHeidelpayResource|MockObject $resourceMock */ $resourceMock = $this->getMockBuilder(Customer::class)->setMethods(['handleResponse'])->getMock(); $resourceMock->expects($this->once())->method('handleResponse')->with($response); + /** @var ResourceService|MockObject $resourceSrvMock */ $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->setMethods(['send'])->disableOriginalConstructor()->getMock(); $resourceSrvMock->expects($this->once())->method('send')->with($resourceMock, HttpAdapterInterface::REQUEST_GET)->willReturn($response); - /** - * @var AbstractHeidelpayResource $resourceMock - * @var ResourceService $resourceSrvMock - */ $this->assertNull($resourceMock->getFetchedAt()); - $resourceSrvMock->fetch($resourceMock); + $resourceSrvMock->fetchResource($resourceMock); $now = (new DateTime('now'))->getTimestamp(); $then = $resourceMock->getFetchedAt()->getTimestamp(); @@ -341,10 +322,11 @@ public function fetchPaymentShouldCallFetchWithTheGivenPaymentObject() { $payment = (new Payment())->setId('myPaymentId'); - $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->setMethods(['fetch'])->disableOriginalConstructor()->getMock(); - $resourceSrvMock->expects($this->once())->method('fetch')->with($payment); + /** @var ResourceService|MockObject $resourceServiceMock */ + $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->setMethods(['fetchResource'])->disableOriginalConstructor()->getMock(); + $resourceSrvMock->expects($this->once())->method('fetchResource')->with($payment); - /** @var ResourceService $resourceSrvMock */ + /** @var ResourceServiceInterface $resourceSrvMock */ $returnedPayment = $resourceSrvMock->fetchPayment($payment); $this->assertSame($payment, $returnedPayment); } @@ -361,16 +343,17 @@ public function fetchPaymentShouldCallFetchWithTheGivenPaymentObject() public function fetchPaymentCalledWithIdShouldCreatePaymentObjectWithIdAndCallFetch() { $heidelpay = new Heidelpay('s-priv-1234'); - $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->setMethods(['fetch'])->setConstructorArgs([$heidelpay])->getMock(); - $resourceSrvMock->expects($this->once())->method('fetch') - ->with($this->callback( - static function ($payment) use ($heidelpay) { - return $payment instanceof Payment && - $payment->getId() === 'testPaymentId' && - $payment->getHeidelpayObject() === $heidelpay; - })); - - /** @var ResourceService $resourceSrvMock */ + + /** @var ResourceService|MockObject $resourceServiceMock */ + $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->setMethods(['fetchResource'])->setConstructorArgs([$heidelpay])->getMock(); + $resourceSrvMock->expects($this->once())->method('fetchResource') + ->with($this->callback(static function ($payment) use ($heidelpay) { + return $payment instanceof Payment && + $payment->getId() === 'testPaymentId' && + $payment->getHeidelpayObject() === $heidelpay; + })); + + /** @var ResourceServiceInterface $resourceSrvMock */ $resourceSrvMock->fetchPayment('testPaymentId'); } @@ -386,16 +369,17 @@ static function ($payment) use ($heidelpay) { public function fetchPaymentByOrderIdShouldCreatePaymentObjectWithOrderIdAndCallFetch() { $heidelpay = new Heidelpay('s-priv-1234'); - $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->setMethods(['fetch'])->setConstructorArgs([$heidelpay])->getMock(); - $resourceSrvMock->expects($this->once())->method('fetch') - ->with($this->callback( - static function ($payment) use ($heidelpay) { - return $payment instanceof Payment && - $payment->getOrderId() === 'myOrderId' && - $payment->getHeidelpayObject() === $heidelpay; - })); - - /** @var ResourceService $resourceSrvMock */ + + /** @var ResourceService|MockObject $resourceServiceMock */ + $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->setMethods(['fetchResource'])->setConstructorArgs([$heidelpay])->getMock(); + $resourceSrvMock->expects($this->once())->method('fetchResource') + ->with($this->callback(static function ($payment) use ($heidelpay) { + return $payment instanceof Payment && + $payment->getOrderId() === 'myOrderId' && + $payment->getHeidelpayObject() === $heidelpay; + })); + + /** @var ResourceServiceInterface $resourceSrvMock */ $resourceSrvMock->fetchPaymentByOrderId('myOrderId'); } @@ -411,13 +395,15 @@ static function ($payment) use ($heidelpay) { public function fetchKeypairShouldCallFetchWithAKeypairObject() { $heidelpay = new Heidelpay('s-priv-1234'); - $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->setMethods(['fetch'])->setConstructorArgs([$heidelpay])->getMock(); - $resourceSrvMock->expects($this->once())->method('fetch') + + /** @var ResourceServiceInterface|MockObject $resourceServiceMock */ + $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->setMethods(['fetchResource'])->setConstructorArgs([$heidelpay])->getMock(); + $resourceSrvMock->expects($this->once())->method('fetchResource') ->with($this->callback(static function ($keypair) use ($heidelpay) { return $keypair instanceof Keypair && $keypair->getHeidelpayObject() === $heidelpay; })); - /** @var ResourceService $resourceSrvMock */ + /** @var ResourceServiceInterface $resourceSrvMock */ $resourceSrvMock->fetchKeypair(); } @@ -441,7 +427,7 @@ public function createPaymentTypeShouldSetHeidelpayObjectAndCallCreate() return $type === $paymentType && $type->getHeidelpayObject() === $heidelpay; })); - /** @var ResourceService $resourceSrvMock */ + /** @var ResourceServiceInterface $resourceSrvMock */ $returnedType = $resourceSrvMock->createPaymentType($paymentType); $this->assertSame($paymentType, $returnedType); @@ -464,8 +450,8 @@ public function fetchPaymentTypeShouldFetchCorrectPaymentInstanceDependingOnId($ { $heidelpay = new Heidelpay('s-priv-1234'); - $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->setMethods(['fetch'])->setConstructorArgs([$heidelpay])->getMock(); - $resourceSrvMock->expects($this->once())->method('fetch') + $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->setMethods(['fetchResource'])->setConstructorArgs([$heidelpay])->getMock(); + $resourceSrvMock->expects($this->once())->method('fetchResource') ->with($this->callback(static function ($type) use ($heidelpay, $typeClass, $typeId) { /** @var BasePaymentType $type */ return $type instanceof $typeClass && @@ -473,7 +459,7 @@ public function fetchPaymentTypeShouldFetchCorrectPaymentInstanceDependingOnId($ $type->getId() === $typeId; })); - /** @var ResourceService $resourceSrvMock */ + /** @var ResourceServiceInterface $resourceSrvMock */ $resourceSrvMock->fetchPaymentType($typeId); } @@ -491,13 +477,13 @@ public function fetchPaymentTypeShouldFetchCorrectPaymentInstanceDependingOnId($ */ public function fetchPaymentTypeShouldThrowExceptionOnInvalidTypeId($typeId) { - $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->setMethods(['fetch'])->disableOriginalConstructor()->getMock(); - $resourceSrvMock->expects($this->never())->method('fetch'); + $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->setMethods(['fetchResource'])->disableOriginalConstructor()->getMock(); + $resourceSrvMock->expects($this->never())->method('fetchResource'); $this->expectException(RuntimeException::class); $this->expectExceptionMessage('Invalid payment type!'); - /** @var ResourceService $resourceSrvMock */ + /** @var ResourceServiceInterface $resourceSrvMock */ $resourceSrvMock->fetchPaymentType($typeId); } @@ -516,7 +502,7 @@ public function updatePaymentTypeShouldCallUpdateMethod() { $paymentType = (new HirePurchaseDirectDebit())->setId('paymentTypeId'); - /** @var ResourceService|MockObject $resourceSrvMock */ + /** @var ResourceServiceInterface|MockObject $resourceSrvMock */ $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->setMethods(['update'])->disableOriginalConstructor()->getMock(); $resourceSrvMock->expects($this->once())->method('update')->with($paymentType)->willReturn($paymentType); @@ -545,7 +531,7 @@ public function createCustomerShouldCallCreateWithCustomerObjectAndSetHeidelpayR return $resource === $customer && $resource->getHeidelpayObject() === $heidelpay; })); - /** @var ResourceService $resourceSrvMock */ + /** @var ResourceServiceInterface $resourceSrvMock */ $returnedCustomer = $resourceSrvMock->createCustomer($customer); $this->assertSame($customer, $returnedCustomer); @@ -589,7 +575,7 @@ public function createOrUpdateCustomerShouldFetchAndUpdateCustomerIfItAlreadyExi })); // Make the call and assertions. - /** @var ResourceService $resourceSrvMock */ + /** @var ResourceServiceInterface $resourceSrvMock */ $returnedCustomer = $resourceSrvMock->createOrUpdateCustomer($customer); $this->assertSame($customer, $returnedCustomer); $this->assertEquals('customerId', $customer->getId()); @@ -620,7 +606,7 @@ public function createOrUpdateCustomerShouldThrowTheExceptionIfItIsNotCustomerId $this->expectException(HeidelpayApiException::class); $this->expectExceptionCode(ApiResponseCodes::API_ERROR_CUSTOMER_ID_REQUIRED); - /** @var ResourceService $resourceSrvMock */ + /** @var ResourceServiceInterface $resourceSrvMock */ $resourceSrvMock->createOrUpdateCustomer($customer); } @@ -638,8 +624,8 @@ public function fetchCustomerShouldCallFetchWithTheGivenCustomerAndSetHeidelpayR $heidelpay = new Heidelpay('s-priv-123'); $customer = (new Customer())->setId('myCustomerId'); - $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->setMethods(['fetch'])->setConstructorArgs([$heidelpay])->getMock(); - $resourceSrvMock->expects($this->once())->method('fetch')->with($customer); + $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->setMethods(['fetchResource'])->setConstructorArgs([$heidelpay])->getMock(); + $resourceSrvMock->expects($this->once())->method('fetchResource')->with($customer); try { $customer->getHeidelpayObject(); @@ -649,7 +635,7 @@ public function fetchCustomerShouldCallFetchWithTheGivenCustomerAndSetHeidelpayR $this->assertEquals('Parent resource reference is not set!', $e->getMessage()); } - /** @var ResourceService $resourceSrvMock */ + /** @var ResourceServiceInterface $resourceSrvMock */ $returnedCustomer = $resourceSrvMock->fetchCustomer($customer); $this->assertSame($customer, $returnedCustomer); $this->assertSame($heidelpay, $customer->getHeidelpayObject()); @@ -668,15 +654,15 @@ public function fetchCustomerShouldCallFetchWithNewCustomerObject() { $heidelpay = new Heidelpay('s-priv-123'); - $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->setMethods(['fetch'])->setConstructorArgs([$heidelpay])->getMock(); - $resourceSrvMock->expects($this->once())->method('fetch')->with( + $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->setMethods(['fetchResource'])->setConstructorArgs([$heidelpay])->getMock(); + $resourceSrvMock->expects($this->once())->method('fetchResource')->with( $this->callback(static function ($param) use ($heidelpay) { return $param instanceof Customer && $param->getId() === 'myCustomerId' && $param->getHeidelpayObject() === $heidelpay; })); - /** @var ResourceService $resourceSrvMock */ + /** @var ResourceServiceInterface $resourceSrvMock */ $returnedCustomer = $resourceSrvMock->fetchCustomer('myCustomerId'); $this->assertEquals('myCustomerId', $returnedCustomer->getId()); $this->assertEquals($heidelpay, $returnedCustomer->getHeidelpayObject()); @@ -695,7 +681,7 @@ public function updateCustomerShouldCallUpdateWithCustomerObject() { $customer = (new Customer())->setId('customerId'); - /** @var ResourceService|MockObject $resourceSrvMock */ + /** @var ResourceServiceInterface|MockObject $resourceSrvMock */ $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->setMethods(['update'])->disableOriginalConstructor()->getMock(); $resourceSrvMock->expects($this->once())->method('update')->with($customer); @@ -716,7 +702,7 @@ public function deleteCustomerShouldCallDeleteWithTheGivenCustomer() { $customer = (new Customer())->setId('customerId'); - /** @var ResourceService|MockObject $resourceSrvMock */ + /** @var ResourceServiceInterface|MockObject $resourceSrvMock */ $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->setMethods(['delete'])->disableOriginalConstructor()->getMock(); $resourceSrvMock->expects($this->once())->method('delete')->with($customer); @@ -740,7 +726,7 @@ public function deleteCustomerShouldFetchCustomerByIdIfTheIdIsGiven() $resourceSrvMock->expects($this->once())->method('fetchCustomer')->with('myCustomerId')->willReturn($customer); $resourceSrvMock->expects($this->once())->method('delete')->with($customer); - /** @var ResourceService $resourceSrvMock */ + /** @var ResourceServiceInterface $resourceSrvMock */ $returnedCustomer = $resourceSrvMock->deleteCustomer('myCustomerId'); $this->assertSame($customer, $returnedCustomer); } @@ -756,15 +742,15 @@ public function deleteCustomerShouldFetchCustomerByIdIfTheIdIsGiven() */ public function fetchAuthorizationShouldFetchPaymentAndReturnItsAuthorization() { - $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->setMethods(['fetchPayment', 'fetch'])->disableOriginalConstructor()->getMock(); + $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->setMethods(['fetchPayment', 'fetchResource'])->disableOriginalConstructor()->getMock(); $paymentMock = $this->getMockBuilder(Payment::class)->setMethods(['getAuthorization'])->getMock(); $authorize = (new Authorization())->setId('s-aut-1'); - /** @var ResourceService|MockObject $resourceSrvMock */ + /** @var ResourceServiceInterface|MockObject $resourceSrvMock */ $resourceSrvMock->expects($this->once())->method('fetchPayment')->with($paymentMock)->willReturn($paymentMock); $paymentMock->expects($this->once())->method('getAuthorization')->willReturn($authorize); - $resourceSrvMock->expects($this->once())->method('fetch')->with($authorize)->willReturn($authorize); + $resourceSrvMock->expects($this->once())->method('fetchResource')->with($authorize)->willReturn($authorize); $returnedAuthorize = $resourceSrvMock->fetchAuthorization($paymentMock); $this->assertSame($authorize, $returnedAuthorize); @@ -781,15 +767,15 @@ public function fetchAuthorizationShouldFetchPaymentAndReturnItsAuthorization() */ public function fetchPayoutShouldFetchPaymentAndReturnItsPayout() { - $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->setMethods(['fetchPayment', 'fetch'])->disableOriginalConstructor()->getMock(); + $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->setMethods(['fetchPayment', 'fetchResource'])->disableOriginalConstructor()->getMock(); $paymentMock = $this->getMockBuilder(Payment::class)->setMethods(['getPayout'])->getMock(); $payout = (new Payout())->setId('s-out-1'); $resourceSrvMock->expects($this->once())->method('fetchPayment')->with($paymentMock)->willReturn($paymentMock); $paymentMock->expects($this->once())->method('getPayout')->willReturn($payout); - $resourceSrvMock->expects($this->once())->method('fetch')->with($payout)->willReturn($payout); + $resourceSrvMock->expects($this->once())->method('fetchResource')->with($payout)->willReturn($payout); - /** @var ResourceService $resourceSrvMock */ + /** @var ResourceServiceInterface $resourceSrvMock */ $returnedPayout = $resourceSrvMock->fetchPayout($paymentMock); $this->assertSame($payout, $returnedPayout); } @@ -805,15 +791,15 @@ public function fetchPayoutShouldFetchPaymentAndReturnItsPayout() */ public function fetchChargeByIdShouldFetchPaymentAndReturnTheChargeOfThePayment() { - $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->setMethods(['fetchPayment', 'fetch'])->disableOriginalConstructor()->getMock(); + $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->setMethods(['fetchPayment', 'fetchResource'])->disableOriginalConstructor()->getMock(); $paymentMock = $this->getMockBuilder(Payment::class)->setMethods(['getCharge'])->getMock(); $charge = (new Charge())->setId('chargeId'); $paymentMock->expects($this->once())->method('getCharge')->with('chargeId')->willReturn($charge); - /** @var ResourceService|MockObject $resourceSrvMock */ + /** @var ResourceServiceInterface|MockObject $resourceSrvMock */ $resourceSrvMock->expects($this->once())->method('fetchPayment')->with($paymentMock)->willReturn($paymentMock); - $resourceSrvMock->expects($this->once())->method('fetch')->with($charge)->willReturn($charge); + $resourceSrvMock->expects($this->once())->method('fetchResource')->with($charge)->willReturn($charge); $returnedCharge = $resourceSrvMock->fetchChargeById($paymentMock, 'chargeId'); $this->assertSame($charge, $returnedCharge); @@ -830,12 +816,13 @@ public function fetchChargeByIdShouldFetchPaymentAndReturnTheChargeOfThePayment( */ public function fetchReversalByAuthorizationShouldFetchAuthorizeAndReturnTheReversalFromIt() { - /** @var ResourceService|MockObject $resourceSrvMock */ - $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->setMethods(['fetch'])->disableOriginalConstructor()->getMock(); + /** @var ResourceServiceInterface|MockObject $resourceSrvMock */ + $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->setMethods(['fetchResource'])->disableOriginalConstructor()->getMock(); + /** @var Authorization|MockObject $authorizeMock */ $authorizeMock = $this->getMockBuilder(Authorization::class)->setMethods(['getCancellation'])->getMock(); $cancellation = new Cancellation(); - $resourceSrvMock->expects($this->once())->method('fetch')->with($authorizeMock); + $resourceSrvMock->expects($this->once())->method('fetchResource')->with($authorizeMock); $authorizeMock->expects($this->once())->method('getCancellation')->with('cancelId')->willReturn($cancellation); $returnedCancel = $resourceSrvMock->fetchReversalByAuthorization($authorizeMock, 'cancelId'); @@ -862,7 +849,7 @@ public function fetchReversalShouldFetchPaymentAndReturnDesiredReversalFromIt() $paymentMock->expects($this->once())->method('getAuthorization')->willReturn($authorizationMock); $authorizationMock->expects($this->once())->method('getCancellation')->willReturn($cancel); - /** @var ResourceService $resourceSrvMock */ + /** @var ResourceServiceInterface $resourceSrvMock */ $returnedCancel = $resourceSrvMock->fetchReversal('paymentId', 'cancelId'); $this->assertSame($cancel, $returnedCancel); } @@ -883,7 +870,7 @@ public function fetchRefundByIdShouldFetchChargeByIdAndThenFetchTheDesiredRefund $charge = (new Charge())->setId('chargeId'); $cancel = (new Cancellation())->setId('cancellationId'); - /** @var ResourceService|MockObject $resourceSrvMock */ + /** @var ResourceServiceInterface|MockObject $resourceSrvMock */ $resourceSrvMock->expects($this->once())->method('fetchChargeById')->with('paymentId', 'chargeId')->willReturn($charge); $resourceSrvMock->expects($this->once())->method('fetchRefund')->with($charge, 'cancellationId')->willReturn($cancel); @@ -902,12 +889,12 @@ public function fetchRefundByIdShouldFetchChargeByIdAndThenFetchTheDesiredRefund */ public function fetchRefundShouldGetAndFetchDesiredChargeCancellation() { - /** @var ResourceService|MockObject $resourceSrvMock */ - $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->setMethods(['fetch'])->disableOriginalConstructor()->getMock(); + /** @var ResourceServiceInterface|MockObject $resourceSrvMock */ + $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->setMethods(['fetchResource'])->disableOriginalConstructor()->getMock(); $cancel = (new Cancellation())->setId('cancellationId'); $chargeMock = $this->getMockBuilder(Charge::class)->setMethods(['getCancellation'])->getMock(); $chargeMock->expects($this->once())->method('getCancellation')->with('cancellationId', true)->willReturn($cancel); - $resourceSrvMock->expects($this->once())->method('fetch')->with($cancel)->willReturn($cancel); + $resourceSrvMock->expects($this->once())->method('fetchResource')->with($cancel)->willReturn($cancel); /** @var Charge $chargeMock*/ $returnedCancellation = $resourceSrvMock->fetchRefund($chargeMock, 'cancellationId'); @@ -925,7 +912,7 @@ public function fetchRefundShouldGetAndFetchDesiredChargeCancellation() */ public function fetchShipmentShouldFetchPaymentAndReturnTheDesiredShipmentFromIt() { - /** @var ResourceService|MockObject $resourceSrvMock */ + /** @var ResourceServiceInterface|MockObject $resourceSrvMock */ $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->setMethods(['fetchPayment'])->disableOriginalConstructor()->getMock(); $paymentMock = $this->getMockBuilder(Payment::class)->setMethods(['getShipment'])->getMock(); $shipment = (new Shipment())->setId('shipmentId'); @@ -948,10 +935,10 @@ public function fetchShipmentShouldFetchPaymentAndReturnTheDesiredShipmentFromIt */ public function fetchMetadataShouldCallFetchWithTheGivenMetadataObject() { - /** @var ResourceService|MockObject $resourceSrvMock */ - $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->setMethods(['fetch'])->disableOriginalConstructor()->getMock(); + /** @var ResourceServiceInterface|MockObject $resourceSrvMock */ + $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->setMethods(['fetchResource'])->disableOriginalConstructor()->getMock(); $metadata = (new Metadata())->setId('myMetadataId'); - $resourceSrvMock->expects($this->once())->method('fetch')->with($metadata); + $resourceSrvMock->expects($this->once())->method('fetchResource')->with($metadata); $this->assertSame($metadata, $resourceSrvMock->fetchMetadata($metadata)); } @@ -967,7 +954,7 @@ public function fetchMetadataShouldCallFetchWithTheGivenMetadataObject() */ public function createMetadataShouldCallCreateWithTheGivenMetadataObject() { - /** @var ResourceService|MockObject $resourceSrvMock */ + /** @var ResourceServiceInterface|MockObject $resourceSrvMock */ $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->setMethods(['create'])->disableOriginalConstructor()->getMock(); $metadata = new Metadata(); $resourceSrvMock->expects($this->once())->method('create')->with($metadata); @@ -986,9 +973,9 @@ public function createMetadataShouldCallCreateWithTheGivenMetadataObject() */ public function fetchMetadataShouldCallFetchWithANewMetadataObjectWithTheGivenId() { - /** @var ResourceService|MockObject $resourceSrvMock */ - $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->setMethods(['fetch'])->disableOriginalConstructor()->getMock(); - $resourceSrvMock->expects($this->once())->method('fetch')->with( + /** @var ResourceServiceInterface|MockObject $resourceSrvMock */ + $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->setMethods(['fetchResource'])->disableOriginalConstructor()->getMock(); + $resourceSrvMock->expects($this->once())->method('fetchResource')->with( $this->callback(static function ($metadata) { return $metadata instanceof Metadata && $metadata->getId() === 's-mtd-1234'; })); @@ -1042,7 +1029,7 @@ public function sendShouldCallSendOnHttpService(string $method, string $uri, boo public function createBasketShouldSetTheParentResourceAndCallCreateWithTheGivenBasket() { $heidelpay = new Heidelpay('s-priv-123'); - /** @var ResourceService|MockObject $resourceSrvMock */ + /** @var ResourceServiceInterface|MockObject $resourceSrvMock */ $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->setConstructorArgs([$heidelpay])->setMethods(['create'])->getMock(); $resourceSrvMock->expects($this->once())->method('create'); @@ -1070,9 +1057,9 @@ public function createBasketShouldSetTheParentResourceAndCallCreateWithTheGivenB public function fetchBasketShouldCreateBasketObjectWithGivenIdAndCallFetchWithIt() { $heidelpay = new Heidelpay('s-priv-123'); - /** @var ResourceService|MockObject $resourceSrvMock */ - $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->setConstructorArgs([$heidelpay])->setMethods(['fetch'])->getMock(); - $resourceSrvMock->expects($this->once())->method('fetch')->with( + /** @var ResourceServiceInterface|MockObject $resourceSrvMock */ + $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->setConstructorArgs([$heidelpay])->setMethods(['fetchResource'])->getMock(); + $resourceSrvMock->expects($this->once())->method('fetchResource')->with( $this->callback(static function ($basket) use ($heidelpay) { /** @var Basket $basket */ return $basket->getId() === 'myBasketId' && $basket->getParentResource() === $heidelpay; @@ -1097,10 +1084,10 @@ public function fetchBasketShouldCreateBasketObjectWithGivenIdAndCallFetchWithIt public function fetchBasketShouldCallFetchWithTheGivenBasketObject() { $heidelpay = new Heidelpay('s-priv-123'); - /** @var ResourceService|MockObject $resourceSrvMock */ - $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->setConstructorArgs([$heidelpay])->setMethods(['fetch'])->getMock(); + /** @var ResourceServiceInterface|MockObject $resourceSrvMock */ + $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->setConstructorArgs([$heidelpay])->setMethods(['fetchResource'])->getMock(); $basket = new Basket(); - $resourceSrvMock->expects($this->once())->method('fetch')->with($basket); + $resourceSrvMock->expects($this->once())->method('fetchResource')->with($basket); $returnedBasket = $resourceSrvMock->fetchBasket($basket); @@ -1121,7 +1108,7 @@ public function fetchBasketShouldCallFetchWithTheGivenBasketObject() public function updateBasketShouldCallUpdateAndReturnTheGivenBasket() { $heidelpay = new Heidelpay('s-priv-123'); - /** @var ResourceService|MockObject $resourceSrvMock */ + /** @var ResourceServiceInterface|MockObject $resourceSrvMock */ $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->setConstructorArgs([$heidelpay])->setMethods(['update'])->getMock(); $basket = new Basket(); $resourceSrvMock->expects($this->once())->method('update')->with($basket); @@ -1225,8 +1212,8 @@ public function createRecurringShouldFetchThePaymentTypeById() return $data instanceof Recurring && $data->getReturnUrl() === 'returnUrl' && $data->getPaymentTypeId() === 'myId'; })); - /** @var ResourceService $resourceServiceMock */ - $resourceServiceMock->createRecurring('typeId', 'returnUrl'); + /** @var ResourceServiceInterface $resourceServiceMock */ + $resourceServiceMock->activateRecurringPayment('typeId', 'returnUrl'); } /** @@ -1243,7 +1230,7 @@ public function createRecurringShouldFetchThePaymentTypeById() public function createRecurringShouldNotFetchThePaymentTypeByObject() { $paymentType = new TraitDummyCanRecur(); - /** @var ResourceService|MockObject $resourceSrvMock */ + /** @var ResourceServiceInterface|MockObject $resourceSrvMock */ $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->disableOriginalConstructor()->setMethods(['fetchPaymentType', 'create'])->getMock(); $resourceSrvMock->expects(self::never())->method('fetchPaymentType'); $resourceSrvMock->expects(self::once())->method('create') @@ -1251,7 +1238,7 @@ public function createRecurringShouldNotFetchThePaymentTypeByObject() return $data instanceof Recurring && $data->getReturnUrl() === 'returnUrl' && $data->getPaymentTypeId() === 'myId'; })); - $resourceSrvMock->createRecurring($paymentType, 'returnUrl'); + $resourceSrvMock->activateRecurringPayment($paymentType, 'returnUrl'); } /** @@ -1268,7 +1255,7 @@ public function createRecurringShouldThrowExceptionWhenRecurringPaymentIsNotSupp $resourceService = new ResourceService(new Heidelpay('s-priv-123')); $this->expectException(RuntimeException::class); - $resourceService->createRecurring(new Sofort(), 'returnUrl'); + $resourceService->activateRecurringPayment(new Sofort(), 'returnUrl'); } // diff --git a/test/unit/Services/WebhooksServiceTest.php b/test/unit/Services/WebhooksServiceTest.php index a58877c5..e4d7f32b 100755 --- a/test/unit/Services/WebhooksServiceTest.php +++ b/test/unit/Services/WebhooksServiceTest.php @@ -26,6 +26,7 @@ use heidelpayPHP\Exceptions\HeidelpayApiException; use heidelpayPHP\Heidelpay; +use heidelpayPHP\Interfaces\ResourceServiceInterface; use heidelpayPHP\Resources\Webhook; use heidelpayPHP\Resources\Webhooks; use heidelpayPHP\Services\ResourceService; @@ -86,7 +87,7 @@ public function createWebhookShouldCallResourceServiceWithWebhookObject() $webhookService = new WebhookService($heidelpay); $resourceServiceMock = $this->getMockBuilder(ResourceService::class)->disableOriginalConstructor() ->setMethods(['create'])->getMock(); - /** @var ResourceService $resourceServiceMock */ + /** @var ResourceServiceInterface $resourceServiceMock */ $webhookService->setResourceService($resourceServiceMock); $resourceServiceMock->expects($this->once())->method('create')->with($this->callback( static function ($param) use ($heidelpay) { @@ -114,10 +115,10 @@ public function fetchWebhookShouldCallResourceServiceWithTheGivenWebhookObject() $heidelpay = new Heidelpay('s-priv-123'); $webhookService = new WebhookService($heidelpay); $resourceServiceMock = $this->getMockBuilder(ResourceService::class)->disableOriginalConstructor() - ->setMethods(['fetch'])->getMock(); - /** @var ResourceService $resourceServiceMock */ + ->setMethods(['fetchResource'])->getMock(); + /** @var ResourceServiceInterface $resourceServiceMock */ $webhookService->setResourceService($resourceServiceMock); - $resourceServiceMock->expects($this->once())->method('fetch')->with($this->callback( + $resourceServiceMock->expects($this->once())->method('fetchResource')->with($this->callback( static function ($param) use ($heidelpay) { return $param instanceof Webhook && $param->getHeidelpayObject() === $heidelpay; } @@ -141,10 +142,10 @@ public function fetchWebhookShouldCallResourceServiceWithANewWebhookObjectWithTh $heidelpay = new Heidelpay('s-priv-123'); $webhookService = new WebhookService($heidelpay); $resourceServiceMock = $this->getMockBuilder(ResourceService::class)->disableOriginalConstructor() - ->setMethods(['fetch'])->getMock(); - /** @var ResourceService $resourceServiceMock */ + ->setMethods(['fetchResource'])->getMock(); + /** @var ResourceServiceInterface $resourceServiceMock */ $webhookService->setResourceService($resourceServiceMock); - $resourceServiceMock->expects($this->once())->method('fetch')->with($this->callback( + $resourceServiceMock->expects($this->once())->method('fetchResource')->with($this->callback( static function ($param) use ($heidelpay) { return $param instanceof Webhook && $param->getHeidelpayObject() === $heidelpay && @@ -170,7 +171,7 @@ public function updateWebhookShouldCallResourceServiceWithTheGivenWebhookObject( $webhookService = new WebhookService($heidelpay); $resourceServiceMock = $this->getMockBuilder(ResourceService::class)->disableOriginalConstructor() ->setMethods(['update'])->getMock(); - /** @var ResourceService $resourceServiceMock */ + /** @var ResourceServiceInterface $resourceServiceMock */ $webhookService->setResourceService($resourceServiceMock); $resourceServiceMock->expects($this->once())->method('update')->with($this->callback( static function ($param) use ($heidelpay) { @@ -200,7 +201,7 @@ public function deleteWebhookShouldCallResourceServiceWithTheGivenWebhookObject( $webhookService = new WebhookService($heidelpay); $resourceServiceMock = $this->getMockBuilder(ResourceService::class)->disableOriginalConstructor() ->setMethods(['delete'])->getMock(); - /** @var ResourceService $resourceServiceMock */ + /** @var ResourceServiceInterface $resourceServiceMock */ $webhookService->setResourceService($resourceServiceMock); $resourceServiceMock->expects($this->once())->method('delete')->with($this->callback( static function ($param) { @@ -229,10 +230,10 @@ public function deleteWebhookShouldCallResourceServiceFetchingAndDeletingTheWebh $webhookServiceMock = $this->getMockBuilder(WebhookService::class)->setConstructorArgs([$heidelpay]) ->setMethods(['fetchWebhook'])->getMock(); $resourceServiceMock = $this->getMockBuilder(ResourceService::class)->disableOriginalConstructor() - ->setMethods(['fetch', 'delete'])->getMock(); + ->setMethods(['fetchResource', 'delete'])->getMock(); /** - * @var ResourceService $resourceServiceMock - * @var WebhookService $webhookServiceMock + * @var ResourceServiceInterface $resourceServiceMock + * @var WebhookService $webhookServiceMock */ $webhookServiceMock->setResourceService($resourceServiceMock); @@ -268,8 +269,8 @@ public function fetchWebhooksShouldCallResourceService() $heidelpay = new Heidelpay('s-priv-123'); $webhookService = new WebhookService($heidelpay); $resourceServiceMock = $this->getMockBuilder(ResourceService::class)->disableOriginalConstructor() - ->setMethods(['fetch'])->getMock(); - /** @var ResourceService $resourceServiceMock */ + ->setMethods(['fetchResource'])->getMock(); + /** @var ResourceServiceInterface $resourceServiceMock */ $webhookService->setResourceService($resourceServiceMock); $webhooksMock = $this->getMockBuilder(Webhooks::class)->disableOriginalConstructor() @@ -277,7 +278,7 @@ public function fetchWebhooksShouldCallResourceService() $webhookArray = ['webhook1', 'webhook2']; $webhooksMock->expects($this->once())->method('getWebhookList')->willReturn($webhookArray); - $resourceServiceMock->expects($this->once())->method('fetch')->with($this->callback( + $resourceServiceMock->expects($this->once())->method('fetchResource')->with($this->callback( static function ($param) use ($heidelpay) { return $param instanceof Webhooks && $param->getHeidelpayObject() === $heidelpay; } @@ -301,7 +302,7 @@ public function deleteWebhooksShouldCallResourceServiceWithANewWebhooksObject() $webhookService = new WebhookService($heidelpay); $resourceServiceMock = $this->getMockBuilder(ResourceService::class)->disableOriginalConstructor() ->setMethods(['delete'])->getMock(); - /** @var ResourceService $resourceServiceMock */ + /** @var ResourceServiceInterface $resourceServiceMock */ $webhookService->setResourceService($resourceServiceMock); $resourceServiceMock->expects($this->once())->method('delete')->with($this->callback( static function ($param) use ($heidelpay) { @@ -327,7 +328,7 @@ public function createWebhooksShouldCallResourceServiceWithNewWebhooksObject() $webhookService = new WebhookService($heidelpay); $resourceServiceMock = $this->getMockBuilder(ResourceService::class)->disableOriginalConstructor() ->setMethods(['create'])->getMock(); - /** @var ResourceService $resourceServiceMock */ + /** @var ResourceServiceInterface $resourceServiceMock */ $webhookService->setResourceService($resourceServiceMock); $webhooksMock = $this->getMockBuilder(Webhooks::class)->setMethods(['getWebhookList'])->getMock(); @@ -399,8 +400,8 @@ public function fetchResourceByEventShouldThrowExceptionIfResourceObjectCanNotBe ->setMethods(['fetchResourceByUrl'])->getMock(); $resourceServiceMock->expects($this->once())->method('fetchResourceByUrl')->willReturn(null); /** - * @var ResourceService $resourceServiceMock - * @var WebhookService $webhookService + * @var ResourceServiceInterface $resourceServiceMock + * @var WebhookService $webhookService */ $webhookService->setResourceService($resourceServiceMock); @@ -437,8 +438,8 @@ public function fetchResourceByEventShouldGetResourceServiceWithRetrieveUrl() $dummyResource = new DummyResource(); $resourceServiceMock->expects($this->once())->method('fetchResourceByUrl')->with($retrieveUrl)->willReturn($dummyResource); /** - * @var ResourceService $resourceServiceMock - * @var WebhookService $webhookService + * @var ResourceServiceInterface $resourceServiceMock + * @var WebhookService $webhookService */ $webhookService->setResourceService($resourceServiceMock); From de0360c8144d2edcad882d7d5dad5318a296dddd Mon Sep 17 00:00:00 2001 From: sixer1182 Date: Wed, 27 Nov 2019 10:19:42 +0100 Subject: [PATCH 021/101] [refactor] (PHPLIB-274) ResourceService: Rename crud operations and remove them from interface. --- src/Heidelpay.php | 8 --- src/Interfaces/ResourceServiceInterface.php | 12 ----- src/Resources/Payment.php | 4 +- src/Services/PaymentService.php | 16 +++--- src/Services/ResourceService.php | 32 ++++++------ src/Services/WebhookService.php | 10 ++-- test/unit/Resources/PaymentTest.php | 16 +++--- test/unit/Services/PaymentServiceTest.php | 36 ++++++------- test/unit/Services/ResourceServiceTest.php | 56 ++++++++++----------- test/unit/Services/WebhooksServiceTest.php | 24 ++++----- 10 files changed, 96 insertions(+), 118 deletions(-) diff --git a/src/Heidelpay.php b/src/Heidelpay.php index 6c45c8a3..43ded5e4 100755 --- a/src/Heidelpay.php +++ b/src/Heidelpay.php @@ -309,14 +309,6 @@ public function getUri($appendId = true): string // - /** - * {@inheritDoc} - */ - public function fetchResource(AbstractHeidelpayResource $resource): AbstractHeidelpayResource - { - return $this->resourceService->fetchResource($resource); - } - // /** diff --git a/src/Interfaces/ResourceServiceInterface.php b/src/Interfaces/ResourceServiceInterface.php index c8b452f0..bf5839ee 100644 --- a/src/Interfaces/ResourceServiceInterface.php +++ b/src/Interfaces/ResourceServiceInterface.php @@ -31,18 +31,6 @@ interface ResourceServiceInterface { - /** - * Updates the given local resource object (id must be set) - * - * @param AbstractHeidelpayResource $resource The local resource object to update. - * - * @return AbstractHeidelpayResource The updated resource object. - * - * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. - */ - public function fetchResource(AbstractHeidelpayResource $resource): AbstractHeidelpayResource; - /** * Retrieves an Payout resource via the API using the corresponding Payment or paymentId. * The Payout resource can not be fetched using its id since they are unique only within the Payment. diff --git a/src/Resources/Payment.php b/src/Resources/Payment.php index c01f07f5..451d6860 100755 --- a/src/Resources/Payment.php +++ b/src/Resources/Payment.php @@ -387,7 +387,7 @@ public function setMetadata($metadata): Payment /** @var Heidelpay $heidelpay */ $heidelpay = $this->getHeidelpayObject(); if ($this->metadata->getId() === null) { - $heidelpay->getResourceService()->create($this->metadata->setParentResource($heidelpay)); + $heidelpay->getResourceService()->createResource($this->metadata->setParentResource($heidelpay)); } return $this; @@ -422,7 +422,7 @@ public function setBasket($basket): Payment /** @var Heidelpay $heidelpay */ $heidelpay = $this->getHeidelpayObject(); if ($this->basket->getId() === null) { - $heidelpay->getResourceService()->create($this->basket->setParentResource($heidelpay)); + $heidelpay->getResourceService()->createResource($this->basket->setParentResource($heidelpay)); } return $this; diff --git a/src/Services/PaymentService.php b/src/Services/PaymentService.php index 4d8b67c6..a11314ba 100755 --- a/src/Services/PaymentService.php +++ b/src/Services/PaymentService.php @@ -120,7 +120,7 @@ public function authorize( $authorization->setCard3ds($card3ds); } $payment->setAuthorization($authorization)->setCustomer($customer)->setMetadata($metadata)->setBasket($basket); - $this->getResourceService()->create($authorization); + $this->getResourceService()->createResource($authorization); return $authorization; } @@ -157,7 +157,7 @@ public function charge( $charge->setCard3ds($card3ds); } $payment->addCharge($charge)->setCustomer($customer)->setMetadata($metadata)->setBasket($basket); - $this->getResourceService()->create($charge); + $this->getResourceService()->createResource($charge); return $charge; } @@ -194,7 +194,7 @@ public function chargePayment( $charge->setInvoiceId($invoiceId); } $payment->addCharge($charge); - $this->getResourceService()->create($charge); + $this->getResourceService()->createResource($charge); return $charge; } @@ -223,7 +223,7 @@ public function payout( ->setInvoiceId($invoiceId) ->setPaymentReference($paymentReference); $payment->setPayout($payout)->setCustomer($customer)->setMetadata($metadata)->setBasket($basket); - $this->getResourceService()->create($payout); + $this->getResourceService()->createResource($payout); return $payout; } @@ -240,7 +240,7 @@ public function cancelAuthorization(Authorization $authorization, $amount = null $cancellation = new Cancellation($amount); $cancellation->setPayment($authorization->getPayment()); $authorization->addCancellation($cancellation); - $this->getResourceService()->create($cancellation); + $this->getResourceService()->createResource($cancellation); return $cancellation; } @@ -293,7 +293,7 @@ public function cancelCharge( ->setAmountNet($amountNet) ->setAmountVat($amountVat); $charge->addCancellation($cancellation); - $this->getResourceService()->create($cancellation); + $this->getResourceService()->createResource($cancellation); return $cancellation; } @@ -310,7 +310,7 @@ public function ship($payment, string $invoiceId = null, string $orderId = null) $shipment = new Shipment(); $shipment->setInvoiceId($invoiceId)->setOrderId($orderId); $this->getResourceService()->getPaymentResource($payment)->addShipment($shipment); - $this->getResourceService()->create($shipment); + $this->getResourceService()->createResource($shipment); return $shipment; } @@ -396,7 +396,7 @@ private function initPayPage( ): Paypage { $paypage->setAction($action)->setParentResource($this->heidelpay); $payment = $this->createPayment($paypage)->setBasket($basket)->setCustomer($customer)->setMetadata($metadata); - $this->getResourceService()->create($paypage->setPayment($payment)); + $this->getResourceService()->createResource($paypage->setPayment($payment)); return $paypage; } diff --git a/src/Services/ResourceService.php b/src/Services/ResourceService.php index aead83e6..c91bcbb2 100755 --- a/src/Services/ResourceService.php +++ b/src/Services/ResourceService.php @@ -224,7 +224,7 @@ public function fetchResourceByUrl($url) * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ - public function create(AbstractHeidelpayResource $resource): AbstractHeidelpayResource + public function createResource(AbstractHeidelpayResource $resource): AbstractHeidelpayResource { $method = HttpAdapterInterface::REQUEST_POST; $response = $this->send($resource, $method); @@ -253,7 +253,7 @@ public function create(AbstractHeidelpayResource $resource): AbstractHeidelpayRe * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. * @throws Exception */ - public function update(AbstractHeidelpayResource $resource): AbstractHeidelpayResource + public function updateResource(AbstractHeidelpayResource $resource): AbstractHeidelpayResource { $method = HttpAdapterInterface::REQUEST_PUT; $response = $this->send($resource, $method); @@ -275,7 +275,7 @@ public function update(AbstractHeidelpayResource $resource): AbstractHeidelpayRe * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ - public function delete(AbstractHeidelpayResource &$resource) + public function deleteResource(AbstractHeidelpayResource &$resource) { $response = $this->send($resource, HttpAdapterInterface::REQUEST_DELETE); @@ -291,16 +291,14 @@ public function delete(AbstractHeidelpayResource &$resource) } /** - * Fetch the resource from the api (id must be set). + * Updates the given local resource object (id must be set) * - * @param AbstractHeidelpayResource $resource + * @param AbstractHeidelpayResource $resource The local resource object to update. * - * @return AbstractHeidelpayResource + * @return AbstractHeidelpayResource The updated resource object. * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. - * - * todo create and call local fetch method */ public function fetchResource(AbstractHeidelpayResource $resource): AbstractHeidelpayResource { @@ -355,7 +353,7 @@ public function activateRecurringPayment($paymentType, $returnUrl): Recurring if (in_array(CanRecur::class, class_uses($paymentTypeObject), true)) { $recurring = new Recurring($paymentTypeObject->getId(), $returnUrl); $recurring->setParentResource($this->heidelpay); - $this->create($recurring); + $this->createResource($recurring); return $recurring; } @@ -438,7 +436,7 @@ public function fetchKeypair($detailed = false): Keypair public function createMetadata(Metadata $metadata): Metadata { $metadata->setParentResource($this->heidelpay); - $this->create($metadata); + $this->createResource($metadata); return $metadata; } @@ -467,7 +465,7 @@ public function fetchMetadata($metadata): Metadata public function createBasket(Basket $basket): Basket { $basket->setParentResource($this->heidelpay); - $this->create($basket); + $this->createResource($basket); return $basket; } @@ -492,7 +490,7 @@ public function fetchBasket($basket): Basket public function updateBasket(Basket $basket): Basket { $basket->setParentResource($this->heidelpay); - $this->update($basket); + $this->updateResource($basket); return $basket; } @@ -507,7 +505,7 @@ public function createPaymentType(BasePaymentType $paymentType): BasePaymentType { /** @var AbstractHeidelpayResource $paymentType */ $paymentType->setParentResource($this->heidelpay); - $this->create($paymentType); + $this->createResource($paymentType); return $paymentType; } @@ -586,7 +584,7 @@ public function fetchPaymentType($typeId): BasePaymentType public function updatePaymentType(BasePaymentType $paymentType): BasePaymentType { /** @var BasePaymentType $retPaymentType */ - $retPaymentType = $this->update($paymentType); + $retPaymentType = $this->updateResource($paymentType); return $retPaymentType; } @@ -600,7 +598,7 @@ public function updatePaymentType(BasePaymentType $paymentType): BasePaymentType public function createCustomer(Customer $customer): Customer { $customer->setParentResource($this->heidelpay); - $this->create($customer); + $this->createResource($customer); return $customer; } @@ -656,7 +654,7 @@ public function fetchCustomerByExtCustomerId($customerId): Customer */ public function updateCustomer(Customer $customer): Customer { - $this->update($customer); + $this->updateResource($customer); return $customer; } @@ -671,7 +669,7 @@ public function deleteCustomer($customer) $customerObject = $this->fetchCustomer($customer); } - $this->delete($customerObject); + $this->deleteResource($customerObject); return $customerObject; } diff --git a/src/Services/WebhookService.php b/src/Services/WebhookService.php index f4e7c8a3..a2cd44c2 100755 --- a/src/Services/WebhookService.php +++ b/src/Services/WebhookService.php @@ -111,7 +111,7 @@ public function createWebhook(string $url, string $event): Webhook { $webhook = new Webhook($url, $event); $webhook->setParentResource($this->heidelpay); - $this->resourceService->create($webhook); + $this->resourceService->createResource($webhook); return $webhook; } @@ -152,7 +152,7 @@ public function fetchWebhook($webhook): Webhook public function updateWebhook($webhook): Webhook { $webhook->setParentResource($this->heidelpay); - $this->resourceService->update($webhook); + $this->resourceService->updateResource($webhook); return $webhook; } @@ -174,7 +174,7 @@ public function deleteWebhook($webhook) $webhookObject = $this->fetchWebhook($webhook); } - return $this->resourceService->delete($webhookObject); + return $this->resourceService->deleteResource($webhookObject); } // @@ -207,7 +207,7 @@ public function deleteWebhooks() { $webhooks = new Webhooks(); $webhooks->setParentResource($this->heidelpay); - $this->resourceService->delete($webhooks); + $this->resourceService->deleteResource($webhooks); } /** @@ -226,7 +226,7 @@ public function createWebhooks(string $url, array $events): array /** @var Webhooks $webhooks */ $webhooks = new Webhooks($url, $events); $webhooks->setParentResource($this->heidelpay); - $webhooks = $this->resourceService->create($webhooks); + $webhooks = $this->resourceService->createResource($webhooks); return $webhooks->getWebhookList(); } diff --git a/test/unit/Resources/PaymentTest.php b/test/unit/Resources/PaymentTest.php index 9bfc0467..2b97db1c 100755 --- a/test/unit/Resources/PaymentTest.php +++ b/test/unit/Resources/PaymentTest.php @@ -1360,8 +1360,8 @@ public function setMetaDataShouldSetParentResourceAndCreateMetaDataObject() { $metadata = (new Metadata())->addMetadata('myData', 'myValue'); - $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->setMethods(['create'])->disableOriginalConstructor()->getMock(); - $resourceSrvMock->expects($this->once())->method('create')->with($metadata); + $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->setMethods(['createResource'])->disableOriginalConstructor()->getMock(); + $resourceSrvMock->expects($this->once())->method('createResource')->with($metadata); /** @var ResourceServiceInterface $resourceSrvMock */ $heidelpay = (new Heidelpay('s-priv-1234'))->setResourceService($resourceSrvMock); @@ -1391,8 +1391,8 @@ public function setMetaDataShouldSetParentResourceAndCreateMetaDataObject() public function metadataMustBeOfTypeMetadata() { $metadata = new Metadata(); - $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->setMethods(['create'])->disableOriginalConstructor()->getMock(); - $resourceSrvMock->expects($this->once())->method('create')->with($metadata); + $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->setMethods(['createResource'])->disableOriginalConstructor()->getMock(); + $resourceSrvMock->expects($this->once())->method('createResource')->with($metadata); /** @var ResourceServiceInterface $resourceSrvMock */ $heidelpay = (new Heidelpay('s-priv-1234'))->setResourceService($resourceSrvMock); @@ -1428,13 +1428,13 @@ public function metadataMustBeOfTypeMetadata() public function setBasketShouldCallCreateIfTheGivenBasketObjectDoesNotExistYet() { $heidelpay = new Heidelpay('s-priv-123'); - $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->setConstructorArgs([$heidelpay])->setMethods(['create'])->getMock(); + $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->setConstructorArgs([$heidelpay])->setMethods(['createResource'])->getMock(); /** @var ResourceServiceInterface $resourceSrvMock */ $heidelpay->setResourceService($resourceSrvMock); $basket = new Basket(); - $resourceSrvMock->expects($this->once())->method('create')->with( + $resourceSrvMock->expects($this->once())->method('createResource')->with( $this->callback( static function ($object) use ($basket, $heidelpay) { /** @var Basket $object */ @@ -1458,11 +1458,11 @@ static function ($object) use ($basket, $heidelpay) { public function setBasketWontCallResourceServiceWhenBasketIsNull() { $heidelpay = new Heidelpay('s-priv-123'); - $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->setConstructorArgs([$heidelpay])->setMethods(['create'])->getMock(); + $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->setConstructorArgs([$heidelpay])->setMethods(['createResource'])->getMock(); /** @var ResourceServiceInterface $resourceSrvMock */ $heidelpay->setResourceService($resourceSrvMock); - $resourceSrvMock->expects($this->once())->method('create'); + $resourceSrvMock->expects($this->once())->method('createResource'); // set basket first to prove the setter works both times $basket = new Basket(); diff --git a/test/unit/Services/PaymentServiceTest.php b/test/unit/Services/PaymentServiceTest.php index 7377d3b3..9064c8bf 100755 --- a/test/unit/Services/PaymentServiceTest.php +++ b/test/unit/Services/PaymentServiceTest.php @@ -100,9 +100,9 @@ public function authorizeShouldCreateNewAuthorizationAndPayment($card3ds) $basket = (new Basket())->setId('myBasketId'); /** @var ResourceServiceInterface|MockObject $resourceSrvMock */ - $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->disableOriginalConstructor()->setMethods(['create'])->getMock(); + $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->disableOriginalConstructor()->setMethods(['createResource'])->getMock(); $paymentSrv = (new Heidelpay('s-priv-123'))->setResourceService($resourceSrvMock)->getPaymentService(); - $resourceSrvMock->expects($this->once())->method('create') + $resourceSrvMock->expects($this->once())->method('createResource') ->with($this->callback(static function ($authorize) use ($customer, $metadata, $basket, $card3ds) { /** @var Authorization $authorize */ $newPayment = $authorize->getPayment(); @@ -147,8 +147,8 @@ public function chargeShouldCreateNewPaymentAndCharge($card3ds) $metadata = (new Metadata())->setId('myMetadataId'); $basket = (new Basket())->setId('myBasketId'); - $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->disableOriginalConstructor()->setMethods(['create'])->getMock(); - $resourceSrvMock->expects($this->once())->method('create') + $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->disableOriginalConstructor()->setMethods(['createResource'])->getMock(); + $resourceSrvMock->expects($this->once())->method('createResource') ->with($this->callback(static function ($charge) use ($customer, $paymentType, $basket, $card3ds) { /** @var Charge $charge */ $newPayment = $charge->getPayment(); @@ -229,8 +229,8 @@ public function chargePaymentShouldCallCreateOnResourceServiceWithNewCharge() $payment = (new Payment())->setParentResource($heidelpay)->setId('myPaymentId'); /** @var ResourceServiceInterface|MockObject $resourceSrvMock */ - $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->disableOriginalConstructor()->setMethods(['create'])->getMock(); - $resourceSrvMock->expects($this->once())->method('create') + $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->disableOriginalConstructor()->setMethods(['createResource'])->getMock(); + $resourceSrvMock->expects($this->once())->method('createResource') ->with($this->callback(static function ($charge) use ($payment) { /** @var Charge $charge */ $newPayment = $charge->getPayment(); @@ -267,8 +267,8 @@ public function cancelAuthorizationShouldCallCreateOnResourceServiceWithNewCance $authorization = (new Authorization())->setPayment($payment)->setId('s-aut-1'); /** @var ResourceServiceInterface|MockObject $resourceSrvMock */ - $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->disableOriginalConstructor()->setMethods(['create'])->getMock(); - $resourceSrvMock->expects($this->once())->method('create') + $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->disableOriginalConstructor()->setMethods(['createResource'])->getMock(); + $resourceSrvMock->expects($this->once())->method('createResource') ->with($this->callback(static function ($cancellation) use ($authorization, $payment) { /** @var Cancellation $cancellation */ $newPayment = $cancellation->getPayment(); @@ -354,8 +354,8 @@ public function cancelChargeShouldCreateCancellationAndCallsCreate() $charge = (new Charge())->setPayment($payment); /** @var ResourceServiceInterface|MockObject $resourceSrvMock */ - $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->setMethods(['create'])->disableOriginalConstructor()->getMock(); - $resourceSrvMock->expects($this->once())->method('create') + $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->setMethods(['createResource'])->disableOriginalConstructor()->getMock(); + $resourceSrvMock->expects($this->once())->method('createResource') ->with($this->callback(static function ($cancellation) use ($payment, $charge) { return $cancellation instanceof Cancellation && $cancellation->getAmount() === 12.22 && @@ -387,8 +387,8 @@ public function shipShouldCreateShipmentAndCallCreateOnResourceServiceWithIt() $payment = new Payment(); /** @var ResourceServiceInterface|MockObject $resourceSrvMock */ - $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->setMethods(['create'])->disableOriginalConstructor()->getMock(); - $resourceSrvMock->expects($this->exactly(2))->method('create') + $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->setMethods(['createResource'])->disableOriginalConstructor()->getMock(); + $resourceSrvMock->expects($this->exactly(2))->method('createResource') ->with($this->callback(static function ($shipment) use ($payment) { return $shipment instanceof Shipment && $shipment->getPayment() === $payment && @@ -423,8 +423,8 @@ public function payoutShouldCreatePaymentAndCallPayoutWithPayment() $metadata = (new Metadata())->setId('metadataId'); /** @var ResourceServiceInterface|MockObject $resourceSrvMock */ - $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->disableOriginalConstructor()->setMethods(['create'])->getMock(); - $resourceSrvMock->expects(self::once())->method('create') + $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->disableOriginalConstructor()->setMethods(['createResource'])->getMock(); + $resourceSrvMock->expects(self::once())->method('createResource') ->with(self::callback(static function ($payout) use ($customer, $metadata) { return $payout instanceof Payout && $payout->getAmount() === 1.23 && @@ -456,8 +456,8 @@ public function payoutShouldCreateNewPayout() $heidelpay = new Heidelpay('s-priv-123'); /** @var ResourceServiceInterface|MockObject $resourceSrvMock */ - $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->disableOriginalConstructor()->setMethods(['create'])->getMock(); - $resourceSrvMock->expects($this->once())->method('create') + $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->disableOriginalConstructor()->setMethods(['createResource'])->getMock(); + $resourceSrvMock->expects($this->once())->method('createResource') ->with($this->callback(static function ($payout) use ($customer, $basket, $metadata) { /** @var Payout $payout */ $newPayment = $payout->getPayment(); @@ -511,7 +511,7 @@ public function paymentShouldBeCreatedByInitPayPage(string $action) $method = 'initPayPage' . $action; /** @var ResourceServiceInterface|MockObject $resourceSrvMock */ - $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->setMethods(['create'])->disableOriginalConstructor()->getMock(); + $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->setMethods(['createResource'])->disableOriginalConstructor()->getMock(); $paymentSrv = (new Heidelpay('s-priv-1234'))->setResourceService($resourceSrvMock)->getPaymentService(); // when @@ -521,7 +521,7 @@ public function paymentShouldBeCreatedByInitPayPage(string $action) $metadata = (new Metadata())->setId('metadataId'); // should - $resourceSrvMock->expects($this->once())->method('create') + $resourceSrvMock->expects($this->once())->method('createResource') ->with($this->callback(static function ($paypage) use ($basket, $customer, $metadata, $action) { return $paypage instanceof Paypage && $paypage->getPayment() instanceof Payment && diff --git a/test/unit/Services/ResourceServiceTest.php b/test/unit/Services/ResourceServiceTest.php index dad43518..f03457ff 100755 --- a/test/unit/Services/ResourceServiceTest.php +++ b/test/unit/Services/ResourceServiceTest.php @@ -155,7 +155,7 @@ public function createShouldCallSendAndThenHandleResponseWithTheResponseData() $resourceServiceMock = $this->getMockBuilder(ResourceService::class)->setMethods(['send'])->disableOriginalConstructor()->getMock(); $resourceServiceMock->expects($this->once())->method('send')->with($testResource, HttpAdapterInterface::REQUEST_POST)->willReturn($response); - $this->assertSame($testResource, $resourceServiceMock->create($testResource)); + $this->assertSame($testResource, $resourceServiceMock->createResource($testResource)); $this->assertEquals('myTestId', $testResource->getId()); } @@ -182,7 +182,7 @@ public function createShouldNotHandleResponseWithError() $resourceServiceMock = $this->getMockBuilder(ResourceService::class)->setMethods(['send'])->disableOriginalConstructor()->getMock(); $resourceServiceMock->expects($this->once())->method('send')->with($testResource, HttpAdapterInterface::REQUEST_POST)->willReturn($response); - $this->assertSame($testResource, $resourceServiceMock->create($testResource)); + $this->assertSame($testResource, $resourceServiceMock->createResource($testResource)); $this->assertNull($testResource->getId()); } @@ -207,7 +207,7 @@ public function updateShouldCallSendAndThenHandleResponseWithTheResponseData() $resourceServiceMock = $this->getMockBuilder(ResourceService::class)->setMethods(['send'])->disableOriginalConstructor()->getMock(); $resourceServiceMock->expects($this->once())->method('send')->with($testResource, HttpAdapterInterface::REQUEST_PUT)->willReturn($response); - $this->assertSame($testResource, $resourceServiceMock->update($testResource)); + $this->assertSame($testResource, $resourceServiceMock->updateResource($testResource)); } /** @@ -229,7 +229,7 @@ public function updateShouldNotHandleResponseWithError() $resourceServiceMock = $this->getMockBuilder(ResourceService::class)->setMethods(['send'])->disableOriginalConstructor()->getMock(); $resourceServiceMock->expects($this->once())->method('send')->with($testResource, HttpAdapterInterface::REQUEST_PUT)->willReturn((object)['isError' => true]); - $this->assertSame($testResource, $resourceServiceMock->update($testResource)); + $this->assertSame($testResource, $resourceServiceMock->updateResource($testResource)); } /** @@ -250,7 +250,7 @@ public function deleteShouldCallSendAndThenSetTheResourceNull() $resourceServiceMock = $this->getMockBuilder(ResourceService::class)->setMethods(['send'])->disableOriginalConstructor()->getMock(); $resourceServiceMock->expects($this->once())->method('send')->with($testResource, HttpAdapterInterface::REQUEST_DELETE)->willReturn(new stdClass()); - $this->assertNull($resourceServiceMock->delete($testResource)); + $this->assertNull($resourceServiceMock->deleteResource($testResource)); $this->assertNull($testResource); } @@ -272,7 +272,7 @@ public function deleteShouldNotDeleteObjectOnResponseWithError() $resourceServiceMock = $this->getMockBuilder(ResourceService::class)->setMethods(['send'])->disableOriginalConstructor()->getMock(); $resourceServiceMock->expects($this->once())->method('send')->with($testResource, HttpAdapterInterface::REQUEST_DELETE)->willReturn((object)['isError' => true]); - $responseResource = $resourceServiceMock->delete($testResource); + $responseResource = $resourceServiceMock->deleteResource($testResource); $this->assertNotNull($responseResource); $this->assertNotNull($testResource); $this->assertSame($testResource, $responseResource); @@ -421,8 +421,8 @@ public function createPaymentTypeShouldSetHeidelpayObjectAndCallCreate() $heidelpay = new Heidelpay('s-priv-1234'); $paymentType = new Sofort(); - $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->setMethods(['create'])->setConstructorArgs([$heidelpay])->getMock(); - $resourceSrvMock->expects($this->once())->method('create') + $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->setMethods(['createResource'])->setConstructorArgs([$heidelpay])->getMock(); + $resourceSrvMock->expects($this->once())->method('createResource') ->with($this->callback(static function ($type) use ($heidelpay, $paymentType) { return $type === $paymentType && $type->getHeidelpayObject() === $heidelpay; })); @@ -503,8 +503,8 @@ public function updatePaymentTypeShouldCallUpdateMethod() $paymentType = (new HirePurchaseDirectDebit())->setId('paymentTypeId'); /** @var ResourceServiceInterface|MockObject $resourceSrvMock */ - $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->setMethods(['update'])->disableOriginalConstructor()->getMock(); - $resourceSrvMock->expects($this->once())->method('update')->with($paymentType)->willReturn($paymentType); + $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->setMethods(['updateResource'])->disableOriginalConstructor()->getMock(); + $resourceSrvMock->expects($this->once())->method('updateResource')->with($paymentType)->willReturn($paymentType); $returnedPaymentType = $resourceSrvMock->updatePaymentType($paymentType); @@ -525,8 +525,8 @@ public function createCustomerShouldCallCreateWithCustomerObjectAndSetHeidelpayR $heidelpay = new Heidelpay('s-priv-1234'); $customer = new Customer(); - $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->setMethods(['create'])->setConstructorArgs([$heidelpay])->getMock(); - $resourceSrvMock->expects($this->once())->method('create') + $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->setMethods(['createResource'])->setConstructorArgs([$heidelpay])->getMock(); + $resourceSrvMock->expects($this->once())->method('createResource') ->with($this->callback(static function ($resource) use ($heidelpay, $customer) { return $resource === $customer && $resource->getHeidelpayObject() === $heidelpay; })); @@ -682,8 +682,8 @@ public function updateCustomerShouldCallUpdateWithCustomerObject() $customer = (new Customer())->setId('customerId'); /** @var ResourceServiceInterface|MockObject $resourceSrvMock */ - $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->setMethods(['update'])->disableOriginalConstructor()->getMock(); - $resourceSrvMock->expects($this->once())->method('update')->with($customer); + $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->setMethods(['updateResource'])->disableOriginalConstructor()->getMock(); + $resourceSrvMock->expects($this->once())->method('updateResource')->with($customer); $returnedCustomer = $resourceSrvMock->updateCustomer($customer); $this->assertSame($customer, $returnedCustomer); @@ -703,8 +703,8 @@ public function deleteCustomerShouldCallDeleteWithTheGivenCustomer() $customer = (new Customer())->setId('customerId'); /** @var ResourceServiceInterface|MockObject $resourceSrvMock */ - $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->setMethods(['delete'])->disableOriginalConstructor()->getMock(); - $resourceSrvMock->expects($this->once())->method('delete')->with($customer); + $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->setMethods(['deleteResource'])->disableOriginalConstructor()->getMock(); + $resourceSrvMock->expects($this->once())->method('deleteResource')->with($customer); $returnedCustomer = $resourceSrvMock->deleteCustomer($customer); $this->assertSame($customer, $returnedCustomer); @@ -721,10 +721,10 @@ public function deleteCustomerShouldCallDeleteWithTheGivenCustomer() */ public function deleteCustomerShouldFetchCustomerByIdIfTheIdIsGiven() { - $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->setMethods(['delete', 'fetchCustomer'])->disableOriginalConstructor()->getMock(); + $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->setMethods(['deleteResource', 'fetchCustomer'])->disableOriginalConstructor()->getMock(); $customer = CustomerFactory::createCustomer('Max', 'Mustermann'); $resourceSrvMock->expects($this->once())->method('fetchCustomer')->with('myCustomerId')->willReturn($customer); - $resourceSrvMock->expects($this->once())->method('delete')->with($customer); + $resourceSrvMock->expects($this->once())->method('deleteResource')->with($customer); /** @var ResourceServiceInterface $resourceSrvMock */ $returnedCustomer = $resourceSrvMock->deleteCustomer('myCustomerId'); @@ -955,9 +955,9 @@ public function fetchMetadataShouldCallFetchWithTheGivenMetadataObject() public function createMetadataShouldCallCreateWithTheGivenMetadataObject() { /** @var ResourceServiceInterface|MockObject $resourceSrvMock */ - $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->setMethods(['create'])->disableOriginalConstructor()->getMock(); + $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->setMethods(['createResource'])->disableOriginalConstructor()->getMock(); $metadata = new Metadata(); - $resourceSrvMock->expects($this->once())->method('create')->with($metadata); + $resourceSrvMock->expects($this->once())->method('createResource')->with($metadata); $this->assertSame($metadata, $resourceSrvMock->createMetadata($metadata)); } @@ -1030,8 +1030,8 @@ public function createBasketShouldSetTheParentResourceAndCallCreateWithTheGivenB { $heidelpay = new Heidelpay('s-priv-123'); /** @var ResourceServiceInterface|MockObject $resourceSrvMock */ - $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->setConstructorArgs([$heidelpay])->setMethods(['create'])->getMock(); - $resourceSrvMock->expects($this->once())->method('create'); + $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->setConstructorArgs([$heidelpay])->setMethods(['createResource'])->getMock(); + $resourceSrvMock->expects($this->once())->method('createResource'); $basket = new Basket(); try { @@ -1109,9 +1109,9 @@ public function updateBasketShouldCallUpdateAndReturnTheGivenBasket() { $heidelpay = new Heidelpay('s-priv-123'); /** @var ResourceServiceInterface|MockObject $resourceSrvMock */ - $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->setConstructorArgs([$heidelpay])->setMethods(['update'])->getMock(); + $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->setConstructorArgs([$heidelpay])->setMethods(['updateResource'])->getMock(); $basket = new Basket(); - $resourceSrvMock->expects($this->once())->method('update')->with($basket); + $resourceSrvMock->expects($this->once())->method('updateResource')->with($basket); $returnedBasket = $resourceSrvMock->updateBasket($basket); @@ -1205,9 +1205,9 @@ public function createRecurringShouldFetchThePaymentTypeById() { $paymentType = new TraitDummyCanRecur(); - $resourceServiceMock = $this->getMockBuilder(ResourceService::class)->disableOriginalConstructor()->setMethods(['fetchPaymentType', 'create'])->getMock(); + $resourceServiceMock = $this->getMockBuilder(ResourceService::class)->disableOriginalConstructor()->setMethods(['fetchPaymentType', 'createResource'])->getMock(); $resourceServiceMock->expects(self::once())->method('fetchPaymentType')->with('typeId')->willReturn($paymentType); - $resourceServiceMock->expects(self::once())->method('create') + $resourceServiceMock->expects(self::once())->method('createResource') ->with($this::callback(static function ($data) { return $data instanceof Recurring && $data->getReturnUrl() === 'returnUrl' && $data->getPaymentTypeId() === 'myId'; })); @@ -1231,9 +1231,9 @@ public function createRecurringShouldNotFetchThePaymentTypeByObject() { $paymentType = new TraitDummyCanRecur(); /** @var ResourceServiceInterface|MockObject $resourceSrvMock */ - $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->disableOriginalConstructor()->setMethods(['fetchPaymentType', 'create'])->getMock(); + $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->disableOriginalConstructor()->setMethods(['fetchPaymentType', 'createResource'])->getMock(); $resourceSrvMock->expects(self::never())->method('fetchPaymentType'); - $resourceSrvMock->expects(self::once())->method('create') + $resourceSrvMock->expects(self::once())->method('createResource') ->with($this::callback(static function ($data) { return $data instanceof Recurring && $data->getReturnUrl() === 'returnUrl' && $data->getPaymentTypeId() === 'myId'; })); diff --git a/test/unit/Services/WebhooksServiceTest.php b/test/unit/Services/WebhooksServiceTest.php index e4d7f32b..e0d2cdc4 100755 --- a/test/unit/Services/WebhooksServiceTest.php +++ b/test/unit/Services/WebhooksServiceTest.php @@ -86,10 +86,10 @@ public function createWebhookShouldCallResourceServiceWithWebhookObject() $heidelpay = new Heidelpay('s-priv-123'); $webhookService = new WebhookService($heidelpay); $resourceServiceMock = $this->getMockBuilder(ResourceService::class)->disableOriginalConstructor() - ->setMethods(['create'])->getMock(); + ->setMethods(['createResource'])->getMock(); /** @var ResourceServiceInterface $resourceServiceMock */ $webhookService->setResourceService($resourceServiceMock); - $resourceServiceMock->expects($this->once())->method('create')->with($this->callback( + $resourceServiceMock->expects($this->once())->method('createResource')->with($this->callback( static function ($param) use ($heidelpay) { return $param instanceof Webhook && $param->getUrl() === 'myUrlString' && @@ -170,10 +170,10 @@ public function updateWebhookShouldCallResourceServiceWithTheGivenWebhookObject( $heidelpay = new Heidelpay('s-priv-123'); $webhookService = new WebhookService($heidelpay); $resourceServiceMock = $this->getMockBuilder(ResourceService::class)->disableOriginalConstructor() - ->setMethods(['update'])->getMock(); + ->setMethods(['updateResource'])->getMock(); /** @var ResourceServiceInterface $resourceServiceMock */ $webhookService->setResourceService($resourceServiceMock); - $resourceServiceMock->expects($this->once())->method('update')->with($this->callback( + $resourceServiceMock->expects($this->once())->method('updateResource')->with($this->callback( static function ($param) use ($heidelpay) { return $param instanceof Webhook && $param->getUrl() === 'myUrlString' && @@ -200,10 +200,10 @@ public function deleteWebhookShouldCallResourceServiceWithTheGivenWebhookObject( $heidelpay = new Heidelpay('s-priv-123'); $webhookService = new WebhookService($heidelpay); $resourceServiceMock = $this->getMockBuilder(ResourceService::class)->disableOriginalConstructor() - ->setMethods(['delete'])->getMock(); + ->setMethods(['deleteResource'])->getMock(); /** @var ResourceServiceInterface $resourceServiceMock */ $webhookService->setResourceService($resourceServiceMock); - $resourceServiceMock->expects($this->once())->method('delete')->with($this->callback( + $resourceServiceMock->expects($this->once())->method('deleteResource')->with($this->callback( static function ($param) { return $param instanceof Webhook && $param->getUrl() === 'myUrlString' && @@ -230,7 +230,7 @@ public function deleteWebhookShouldCallResourceServiceFetchingAndDeletingTheWebh $webhookServiceMock = $this->getMockBuilder(WebhookService::class)->setConstructorArgs([$heidelpay]) ->setMethods(['fetchWebhook'])->getMock(); $resourceServiceMock = $this->getMockBuilder(ResourceService::class)->disableOriginalConstructor() - ->setMethods(['fetchResource', 'delete'])->getMock(); + ->setMethods(['fetchResource', 'deleteResource'])->getMock(); /** * @var ResourceServiceInterface $resourceServiceMock * @var WebhookService $webhookServiceMock @@ -240,7 +240,7 @@ public function deleteWebhookShouldCallResourceServiceFetchingAndDeletingTheWebh $webhook = new Webhook('WebhookId', 'TestEvent'); $webhookServiceMock->expects($this->once())->method('fetchWebhook')->with('WebhookId') ->willReturn($webhook); - $resourceServiceMock->expects($this->once())->method('delete')->with($this->callback( + $resourceServiceMock->expects($this->once())->method('deleteResource')->with($this->callback( static function ($param) use ($webhook) { return $param === $webhook; } @@ -301,10 +301,10 @@ public function deleteWebhooksShouldCallResourceServiceWithANewWebhooksObject() $heidelpay = new Heidelpay('s-priv-123'); $webhookService = new WebhookService($heidelpay); $resourceServiceMock = $this->getMockBuilder(ResourceService::class)->disableOriginalConstructor() - ->setMethods(['delete'])->getMock(); + ->setMethods(['deleteResource'])->getMock(); /** @var ResourceServiceInterface $resourceServiceMock */ $webhookService->setResourceService($resourceServiceMock); - $resourceServiceMock->expects($this->once())->method('delete')->with($this->callback( + $resourceServiceMock->expects($this->once())->method('deleteResource')->with($this->callback( static function ($param) use ($heidelpay) { return $param instanceof Webhooks && $param->getHeidelpayObject() === $heidelpay; } @@ -327,14 +327,14 @@ public function createWebhooksShouldCallResourceServiceWithNewWebhooksObject() $heidelpay = new Heidelpay('s-priv-123'); $webhookService = new WebhookService($heidelpay); $resourceServiceMock = $this->getMockBuilder(ResourceService::class)->disableOriginalConstructor() - ->setMethods(['create'])->getMock(); + ->setMethods(['createResource'])->getMock(); /** @var ResourceServiceInterface $resourceServiceMock */ $webhookService->setResourceService($resourceServiceMock); $webhooksMock = $this->getMockBuilder(Webhooks::class)->setMethods(['getWebhookList'])->getMock(); $webhookList = ['ListItem1', 'ListItem2']; $webhooksMock->expects($this->once())->method('getWebhookList')->willReturn($webhookList); - $resourceServiceMock->expects($this->once())->method('create')->with($this->callback( + $resourceServiceMock->expects($this->once())->method('createResource')->with($this->callback( static function ($param) use ($heidelpay) { return $param instanceof Webhooks && $param->getUrl() === 'myUrlString' && From 5b122d3f825e26e95877f75bf13daccac5618820 Mon Sep 17 00:00:00 2001 From: sixer1182 Date: Wed, 27 Nov 2019 11:09:24 +0100 Subject: [PATCH 022/101] [refactor] (PHPLIB-274) WebhookService: Add WebhookServiceInterface and update code accordingly. --- src/Heidelpay.php | 80 +++---------- src/Interfaces/WebhookServiceInterface.php | 126 +++++++++++++++++++++ src/Services/WebhookService.php | 81 +++---------- test/integration/PaymentTest.php | 1 - test/unit/HeidelpayTest.php | 8 +- test/unit/Services/WebhooksServiceTest.php | 12 +- 6 files changed, 164 insertions(+), 144 deletions(-) create mode 100644 src/Interfaces/WebhookServiceInterface.php diff --git a/src/Heidelpay.php b/src/Heidelpay.php index 43ded5e4..bc444736 100755 --- a/src/Heidelpay.php +++ b/src/Heidelpay.php @@ -31,6 +31,7 @@ use heidelpayPHP\Interfaces\HeidelpayParentInterface; use heidelpayPHP\Interfaces\PaymentServiceInterface; use heidelpayPHP\Interfaces\ResourceServiceInterface; +use heidelpayPHP\Interfaces\WebhookServiceInterface; use heidelpayPHP\Resources\AbstractHeidelpayResource; use heidelpayPHP\Resources\Basket; use heidelpayPHP\Resources\Customer; @@ -54,7 +55,7 @@ use heidelpayPHP\Validators\PrivateKeyValidator; use RuntimeException; -class Heidelpay implements HeidelpayParentInterface, PaymentServiceInterface, ResourceServiceInterface +class Heidelpay implements HeidelpayParentInterface, PaymentServiceInterface, ResourceServiceInterface, WebhookServiceInterface { const BASE_URL = 'api.heidelpay.com'; const API_VERSION = 'v1'; @@ -772,15 +773,7 @@ public function fetchPayout($payment): Payout // /** - * Creates Webhook resource. - * - * @param string $url The url the registered webhook event should be send to. - * @param string $event The event to be registered. - * - * @return Webhook - * - * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * {@inheritDoc} */ public function createWebhook(string $url, string $event): Webhook { @@ -788,15 +781,7 @@ public function createWebhook(string $url, string $event): Webhook } /** - * Updates the given local Webhook object using the API. - * Retrieves a Webhook resource, if the webhook parameter is the webhook id. - * - * @param Webhook|string $webhook - * - * @return Webhook - * - * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * {@inheritDoc} */ public function fetchWebhook($webhook): Webhook { @@ -804,14 +789,7 @@ public function fetchWebhook($webhook): Webhook } /** - * Updates the Webhook resource of the api with the given object. - * - * @param Webhook $webhook - * - * @return Webhook - * - * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * {@inheritDoc} */ public function updateWebhook($webhook): Webhook { @@ -819,14 +797,7 @@ public function updateWebhook($webhook): Webhook } /** - * Updates the given Webhook resource of the api with the given object. - * - * @param Webhook|string $webhook - * - * @return AbstractHeidelpayResource|Webhook|null - * - * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * {@inheritDoc} */ public function deleteWebhook($webhook) { @@ -834,58 +805,35 @@ public function deleteWebhook($webhook) } /** - * Retrieves all registered webhooks and returns them in an array. - * - * @return array - * - * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * {@inheritDoc} */ public function fetchAllWebhooks(): array { - return $this->webhookService->fetchWebhooks(); + return $this->webhookService->fetchAllWebhooks(); } /** - * Deletes all registered webhooks. - * - * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * {@inheritDoc} */ public function deleteAllWebhooks() { - $this->webhookService->deleteWebhooks(); + $this->webhookService->deleteAllWebhooks(); } /** - * Registers multiple Webhook events at once. - * - * @param string $url The url the registered webhook events should be send to. - * @param array $events The events to be registered. - * - * @return array - * - * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * {@inheritDoc} */ public function registerMultipleWebhooks(string $url, array $events): array { - return $this->webhookService->createWebhooks($url, $events); + return $this->webhookService->registerMultipleWebhooks($url, $events); } /** - * Fetches a resource object based on the given event data. - * - * @param string|null $eventJson - * - * @return AbstractHeidelpayResource - * - * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * {@inheritDoc} */ public function fetchResourceFromEvent($eventJson = null): AbstractHeidelpayResource { - return $this->webhookService->fetchResourceByWebhookEvent($eventJson); + return $this->webhookService->fetchResourceFromEvent($eventJson); } // diff --git a/src/Interfaces/WebhookServiceInterface.php b/src/Interfaces/WebhookServiceInterface.php new file mode 100644 index 00000000..15d5c3c6 --- /dev/null +++ b/src/Interfaces/WebhookServiceInterface.php @@ -0,0 +1,126 @@ + + * + * @package heidelpayPHP/services + */ +namespace heidelpayPHP\Interfaces; + +use heidelpayPHP\Exceptions\HeidelpayApiException; +use heidelpayPHP\Resources\AbstractHeidelpayResource; +use heidelpayPHP\Resources\Webhook; +use RuntimeException; + +interface WebhookServiceInterface +{ + /** + * Creates Webhook resource + * + * @param string $url The url the registered webhook event should be send to. + * @param string $event The event to be registered. + * + * @return Webhook The newly created webhook resource. + * + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + */ + public function createWebhook(string $url, string $event): Webhook; + + /** + * Updates the given local Webhook object using the API. + * Retrieves a Webhook resource, if the webhook parameter is the webhook id. + * + * @param Webhook|string $webhook + * + * @return Webhook The fetched webhook object. + * + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + */ + public function fetchWebhook($webhook): Webhook; + + /** + * Updates the Webhook resource of the api with the given object. + * + * @param Webhook $webhook + * + * @return Webhook The webhook object returned after update. + * + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + */ + public function updateWebhook($webhook): Webhook; + + /** + * Deletes the given Webhook resource. + * + * @param Webhook|string $webhook The webhook object or the id of the webhook to be deleted. + * + * @return Webhook|AbstractHeidelpayResource|null Null if delete succeeded or the webhook object if not. + * + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + */ + public function deleteWebhook($webhook); + + /** + * Retrieves all registered webhooks and returns them in an array. + * + * @return array An array containing all registered webhooks. + * + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + */ + public function fetchAllWebhooks(): array; + + /** + * Deletes all registered webhooks. + * + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + */ + public function deleteAllWebhooks(); + + /** + * Registers multiple Webhook events at once. + * + * @param string $url The url the registered webhook events should be send to. + * @param array $events The events to be registered. + * + * @return array + * + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + */ + public function registerMultipleWebhooks(string $url, array $events): array; + + /** + * Fetches the resource corresponding to the given eventData. + * + * @param string|null $eventJson + * + * @return AbstractHeidelpayResource + * + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + */ + public function fetchResourceFromEvent($eventJson = null): AbstractHeidelpayResource; +} diff --git a/src/Services/WebhookService.php b/src/Services/WebhookService.php index a2cd44c2..b48957e8 100755 --- a/src/Services/WebhookService.php +++ b/src/Services/WebhookService.php @@ -24,16 +24,16 @@ */ namespace heidelpayPHP\Services; -use heidelpayPHP\Exceptions\HeidelpayApiException; use heidelpayPHP\Heidelpay; use heidelpayPHP\Interfaces\ResourceServiceInterface; +use heidelpayPHP\Interfaces\WebhookServiceInterface; use heidelpayPHP\Resources\AbstractHeidelpayResource; use heidelpayPHP\Resources\Webhook; use heidelpayPHP\Resources\Webhooks; use function is_string; use RuntimeException; -class WebhookService +class WebhookService implements WebhookServiceInterface { /** @var Heidelpay $heidelpay */ private $heidelpay; @@ -64,7 +64,6 @@ public function getHeidelpay(): Heidelpay /** * @param Heidelpay $heidelpay - * * @return WebhookService */ public function setHeidelpay(Heidelpay $heidelpay): WebhookService @@ -83,7 +82,6 @@ public function getResourceService(): ResourceServiceInterface /** * @param ResourceServiceInterface $resourceService - * * @return WebhookService */ public function setResourceService(ResourceServiceInterface $resourceService): WebhookService @@ -97,15 +95,7 @@ public function setResourceService(ResourceServiceInterface $resourceService): W // /** - * Creates Webhook resource - * - * @param string $url The url the registered webhook event should be send to. - * @param string $event The event to be registered. - * - * @return Webhook - * - * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * {@inheritDoc} */ public function createWebhook(string $url, string $event): Webhook { @@ -116,15 +106,7 @@ public function createWebhook(string $url, string $event): Webhook } /** - * Updates the given local Webhook object using the API. - * Retrieves a Webhook resource, if the webhook parameter is the webhook id. - * - * @param Webhook|string $webhook - * - * @return Webhook - * - * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * {@inheritDoc} */ public function fetchWebhook($webhook): Webhook { @@ -140,14 +122,7 @@ public function fetchWebhook($webhook): Webhook } /** - * Updates the Webhook resource of the api with the given object. - * - * @param Webhook $webhook - * - * @return Webhook - * - * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * {@inheritDoc} */ public function updateWebhook($webhook): Webhook { @@ -157,14 +132,7 @@ public function updateWebhook($webhook): Webhook } /** - * Deletes the given Webhook resource. - * - * @param Webhook|string $webhook - * - * @return Webhook|AbstractHeidelpayResource|null - * - * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * {@inheritDoc} */ public function deleteWebhook($webhook) { @@ -182,12 +150,9 @@ public function deleteWebhook($webhook) // /** - * Fetches all registered webhook events and returns them in an array. - * - * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * {@inheritDoc} */ - public function fetchWebhooks(): array + public function fetchAllWebhooks(): array { /** @var Webhooks $webhooks */ $webhooks = new Webhooks(); @@ -198,12 +163,9 @@ public function fetchWebhooks(): array } /** - * Deletes all registered webhooks. - * - * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * {@inheritDoc} */ - public function deleteWebhooks() + public function deleteAllWebhooks() { $webhooks = new Webhooks(); $webhooks->setParentResource($this->heidelpay); @@ -211,17 +173,9 @@ public function deleteWebhooks() } /** - * Registers multiple Webhook events at once. - * - * @param string $url The url the registered webhook events should be send to. - * @param array $events The events to be registered. - * - * @return array - * - * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * {@inheritDoc} */ - public function createWebhooks(string $url, array $events): array + public function registerMultipleWebhooks(string $url, array $events): array { /** @var Webhooks $webhooks */ $webhooks = new Webhooks($url, $events); @@ -236,16 +190,9 @@ public function createWebhooks(string $url, array $events): array // /** - * Fetches the resource corresponding to the given eventData. - * - * @param string|null $eventJson - * - * @return AbstractHeidelpayResource - * - * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * {@inheritDoc} */ - public function fetchResourceByWebhookEvent($eventJson = null): AbstractHeidelpayResource + public function fetchResourceFromEvent($eventJson = null): AbstractHeidelpayResource { $resourceObject = null; $eventData = json_decode($eventJson ?? $this->readInputStream(), false); diff --git a/test/integration/PaymentTest.php b/test/integration/PaymentTest.php index b0325ee9..26296c1b 100755 --- a/test/integration/PaymentTest.php +++ b/test/integration/PaymentTest.php @@ -178,7 +178,6 @@ public function paymentChargeOnAuthorizeShouldTakeResourceIds() $charge = $this->heidelpay->chargePayment($authorization->getPaymentId(), null, 'order-' . self::generateRandomId(), 'invoice-' . self::generateRandomId()); $this->assertNotEmpty($charge->getId()); - } /** diff --git a/test/unit/HeidelpayTest.php b/test/unit/HeidelpayTest.php index d1b43494..48dbced2 100755 --- a/test/unit/HeidelpayTest.php +++ b/test/unit/HeidelpayTest.php @@ -352,10 +352,10 @@ public function heidelpayShouldForwardWebhookActionCallsToTheWebhookServiceDP(): 'updateWebhook'=> [ 'updateWebhook', [$webhook], 'updateWebhook', [$webhook] ], 'deleteWebhook'=> [ 'deleteWebhook', [$webhookId], 'deleteWebhook', [$webhookId] ], 'deleteWebhook by object'=> [ 'deleteWebhook', [$webhook], 'deleteWebhook', [$webhook] ], - 'fetchAllWebhooks'=> [ 'fetchAllWebhooks', [], 'fetchWebhooks', [] ], - 'deleteAllWebhooks'=> [ 'deleteAllWebhooks', [], 'deleteWebhooks', [] ], - 'registerMultipleWebhooks'=> ['registerMultipleWebhooks', [$url, $event], 'createWebhooks', [$url, $event] ], - 'fetchResourceFromEvent'=> ['fetchResourceFromEvent', [], 'fetchResourceByWebhookEvent', [] ] + 'fetchAllWebhooks'=> [ 'fetchAllWebhooks', [], 'fetchAllWebhooks', [] ], + 'deleteAllWebhooks'=> [ 'deleteAllWebhooks', [], 'deleteAllWebhooks', [] ], + 'registerMultipleWebhooks'=> ['registerMultipleWebhooks', [$url, $event], 'registerMultipleWebhooks', [$url, $event] ], + 'fetchResourceFromEvent'=> ['fetchResourceFromEvent', [], 'fetchResourceFromEvent', [] ] ]; } diff --git a/test/unit/Services/WebhooksServiceTest.php b/test/unit/Services/WebhooksServiceTest.php index e0d2cdc4..909e163e 100755 --- a/test/unit/Services/WebhooksServiceTest.php +++ b/test/unit/Services/WebhooksServiceTest.php @@ -284,7 +284,7 @@ static function ($param) use ($heidelpay) { } ))->willReturn($webhooksMock); - $this->assertSame($webhookArray, $webhookService->fetchWebhooks()); + $this->assertSame($webhookArray, $webhookService->fetchAllWebhooks()); } /** @@ -310,7 +310,7 @@ static function ($param) use ($heidelpay) { } )); - $webhookService->deleteWebhooks(); + $webhookService->deleteAllWebhooks(); } /** @@ -345,7 +345,7 @@ static function ($param) use ($heidelpay) { $this->assertEquals( $webhookList, - $webhookService->createWebhooks('myUrlString', ['TestEvent1', 'TestEvent2']) + $webhookService->registerMultipleWebhooks('myUrlString', ['TestEvent1', 'TestEvent2']) ); } @@ -374,7 +374,7 @@ public function fetchResourceByEventWithEmptyRetrieveUrlShouldThrowException() $this->expectExceptionMessage('Error fetching resource!'); /** @var WebhookService $webhookService */ - $webhookService->fetchResourceByWebhookEvent(); + $webhookService->fetchResourceFromEvent(); } /** @@ -408,7 +408,7 @@ public function fetchResourceByEventShouldThrowExceptionIfResourceObjectCanNotBe $this->expectException(RuntimeException::class); $this->expectExceptionMessage('Error fetching resource!'); - $webhookService->fetchResourceByWebhookEvent(); + $webhookService->fetchResourceFromEvent(); } /** @@ -445,7 +445,7 @@ public function fetchResourceByEventShouldGetResourceServiceWithRetrieveUrl() // trigger test and verify the resource fetched from resourceService is returned /** @var WebhookService $webhookService */ - $this->assertSame($dummyResource, $webhookService->fetchResourceByWebhookEvent()); + $this->assertSame($dummyResource, $webhookService->fetchResourceFromEvent()); } // From 75d9bb98805e54c33bea068928650a403f125a76 Mon Sep 17 00:00:00 2001 From: sixer1182 Date: Wed, 27 Nov 2019 11:23:05 +0100 Subject: [PATCH 023/101] [refactor] (PHPLIB-274) Fix package annotations. --- examples/Alipay/Constants.php | 2 +- examples/Alipay/Controller.php | 2 +- examples/Alipay/ReturnController.php | 2 +- examples/Alipay/index.php | 2 +- examples/Card/Constants.php | 2 +- examples/Card/Controller.php | 2 +- examples/Card/ReturnController.php | 2 +- examples/Card/index.php | 2 +- examples/CardRecurring/Constants.php | 2 +- examples/CardRecurring/Controller.php | 2 +- examples/CardRecurring/ReturnController.php | 2 +- examples/CardRecurring/index.php | 2 +- examples/Constants.php | 2 +- examples/EPSCharge/Constants.php | 2 +- examples/EPSCharge/Controller.php | 2 +- examples/EPSCharge/ReturnController.php | 2 +- examples/EPSCharge/index.php | 2 +- examples/EmbeddedPayPage/Constants.php | 2 +- examples/EmbeddedPayPage/Controller.php | 2 +- examples/EmbeddedPayPage/ReturnController.php | 2 +- examples/EmbeddedPayPage/index.php | 2 +- examples/ExampleDebugHandler.php | 2 +- examples/Failure.php | 2 +- examples/FlexiPayDirect/Constants.php | 2 +- examples/FlexiPayDirect/Controller.php | 2 +- examples/FlexiPayDirect/ReturnController.php | 2 +- examples/FlexiPayDirect/index.php | 2 +- examples/Giropay/Constants.php | 2 +- examples/Giropay/Controller.php | 2 +- examples/Giropay/ReturnController.php | 2 +- examples/Giropay/index.php | 2 +- examples/HirePurchaseDirectDebit/Constants.php | 2 +- examples/HirePurchaseDirectDebit/Controller.php | 2 +- examples/HirePurchaseDirectDebit/PlaceOrderController.php | 2 +- examples/HirePurchaseDirectDebit/confirm.php | 2 +- examples/HirePurchaseDirectDebit/index.php | 2 +- examples/HostedPayPage/Constants.php | 2 +- examples/HostedPayPage/Controller.php | 2 +- examples/HostedPayPage/ReturnController.php | 2 +- examples/HostedPayPage/index.php | 2 +- examples/IDeal/Constants.php | 2 +- examples/IDeal/Controller.php | 2 +- examples/IDeal/ReturnController.php | 2 +- examples/IDeal/index.php | 2 +- examples/Invoice/Constants.php | 2 +- examples/Invoice/Controller.php | 2 +- examples/Invoice/index.php | 2 +- examples/InvoiceFactoring/Constants.php | 2 +- examples/InvoiceFactoring/Controller.php | 2 +- examples/InvoiceFactoring/index.php | 2 +- examples/InvoiceGuaranteed/Constants.php | 2 +- examples/InvoiceGuaranteed/Controller.php | 2 +- examples/InvoiceGuaranteed/index.php | 2 +- examples/PayPal/Constants.php | 2 +- examples/PayPal/Controller.php | 2 +- examples/PayPal/ReturnController.php | 2 +- examples/PayPal/index.php | 2 +- examples/PayPalRecurring/Constants.php | 2 +- examples/PayPalRecurring/Controller.php | 2 +- examples/PayPalRecurring/ReturnController.php | 2 +- examples/PayPalRecurring/index.php | 2 +- examples/Pending.php | 2 +- examples/Prepayment/Constants.php | 2 +- examples/Prepayment/Controller.php | 2 +- examples/Prepayment/index.php | 2 +- examples/SepaDirectDebitGuaranteed/Constants.php | 2 +- examples/SepaDirectDebitGuaranteed/Controller.php | 2 +- examples/SepaDirectDebitGuaranteed/index.php | 2 +- examples/Sofort/Constants.php | 2 +- examples/Sofort/Controller.php | 2 +- examples/Sofort/ReturnController.php | 2 +- examples/Sofort/index.php | 2 +- examples/Success.php | 2 +- examples/Webhooks/Constants.php | 2 +- examples/Webhooks/Controller.php | 2 +- examples/Webhooks/fetchAll.php | 2 +- examples/Webhooks/index.php | 2 +- examples/Webhooks/removeAll.php | 2 +- examples/Wechatpay/Constants.php | 2 +- examples/Wechatpay/Controller.php | 2 +- examples/Wechatpay/ReturnController.php | 2 +- examples/Wechatpay/index.php | 2 +- examples/_enableExamples.php | 2 +- examples/index.php | 2 +- src/Adapter/CurlAdapter.php | 2 +- src/Adapter/HttpAdapterInterface.php | 2 +- src/Constants/ApiResponseCodes.php | 2 +- src/Constants/BasketItemTypes.php | 2 +- src/Constants/CancelReasonCodes.php | 2 +- src/Constants/CompanyCommercialSectorItems.php | 2 +- src/Constants/CompanyRegistrationTypes.php | 2 +- src/Constants/IdStrings.php | 2 +- src/Constants/PaymentState.php | 2 +- src/Constants/Salutations.php | 2 +- src/Constants/TransactionTypes.php | 2 +- src/Constants/WebhookEvents.php | 2 +- src/Exceptions/HeidelpayApiException.php | 2 +- src/Interfaces/DebugHandlerInterface.php | 2 +- src/Interfaces/HeidelpayParentInterface.php | 2 +- src/Interfaces/WebhookServiceInterface.php | 2 +- src/Resources/AbstractHeidelpayResource.php | 2 +- src/Resources/Basket.php | 2 +- src/Resources/Customer.php | 2 +- src/Resources/CustomerFactory.php | 2 +- src/Resources/EmbeddedResources/Address.php | 2 +- src/Resources/EmbeddedResources/Amount.php | 2 +- src/Resources/EmbeddedResources/BasketItem.php | 2 +- src/Resources/EmbeddedResources/CardDetails.php | 2 +- src/Resources/EmbeddedResources/CompanyInfo.php | 2 +- src/Resources/EmbeddedResources/GeoLocation.php | 2 +- src/Resources/EmbeddedResources/Message.php | 2 +- src/Resources/InstalmentPlan.php | 2 +- src/Resources/InstalmentPlans.php | 2 +- src/Resources/Keypair.php | 2 +- src/Resources/Metadata.php | 2 +- src/Resources/Payment.php | 2 +- src/Resources/PaymentTypes/Alipay.php | 2 +- src/Resources/PaymentTypes/BasePaymentType.php | 2 +- src/Resources/PaymentTypes/Card.php | 2 +- src/Resources/PaymentTypes/EPS.php | 2 +- src/Resources/PaymentTypes/Giropay.php | 2 +- src/Resources/PaymentTypes/HirePurchaseDirectDebit.php | 2 +- src/Resources/PaymentTypes/Ideal.php | 2 +- src/Resources/PaymentTypes/Invoice.php | 2 +- src/Resources/PaymentTypes/InvoiceFactoring.php | 2 +- src/Resources/PaymentTypes/InvoiceGuaranteed.php | 2 +- src/Resources/PaymentTypes/PIS.php | 2 +- src/Resources/PaymentTypes/Paypage.php | 2 +- src/Resources/PaymentTypes/Paypal.php | 2 +- src/Resources/PaymentTypes/Prepayment.php | 2 +- src/Resources/PaymentTypes/Przelewy24.php | 2 +- src/Resources/PaymentTypes/SepaDirectDebit.php | 2 +- src/Resources/PaymentTypes/SepaDirectDebitGuaranteed.php | 2 +- src/Resources/PaymentTypes/Sofort.php | 2 +- src/Resources/PaymentTypes/Wechatpay.php | 2 +- src/Resources/Recurring.php | 2 +- src/Resources/TransactionTypes/AbstractTransactionType.php | 2 +- src/Resources/TransactionTypes/Authorization.php | 2 +- src/Resources/TransactionTypes/Cancellation.php | 2 +- src/Resources/TransactionTypes/Charge.php | 2 +- src/Resources/TransactionTypes/Payout.php | 2 +- src/Resources/TransactionTypes/Shipment.php | 2 +- src/Resources/Webhook.php | 2 +- src/Resources/Webhooks.php | 2 +- src/Services/EnvironmentService.php | 2 +- src/Services/HttpService.php | 2 +- src/Services/IdService.php | 2 +- src/Services/PaymentService.php | 2 +- src/Services/ResourceNameService.php | 2 +- src/Services/ResourceService.php | 2 +- src/Services/ValueService.php | 2 +- src/Services/WebhookService.php | 2 +- src/Traits/CanAuthorize.php | 2 +- src/Traits/CanAuthorizeWithCustomer.php | 2 +- src/Traits/CanDirectCharge.php | 2 +- src/Traits/CanDirectChargeWithCustomer.php | 2 +- src/Traits/CanPayout.php | 2 +- src/Traits/CanPayoutWithCustomer.php | 2 +- src/Traits/CanRecur.php | 2 +- src/Traits/HasCancellations.php | 2 +- src/Traits/HasInvoiceId.php | 2 +- src/Traits/HasOrderId.php | 2 +- src/Traits/HasPaymentState.php | 2 +- src/Traits/HasStates.php | 2 +- src/Traits/HasUniqueAndShortId.php | 2 +- src/Validators/ExpiryDateValidator.php | 2 +- src/Validators/PrivateKeyValidator.php | 2 +- src/Validators/PublicKeyValidator.php | 2 +- test/BasePaymentTest.php | 2 +- test/Fixtures/CustomerFixtureTrait.php | 2 +- test/TestDebugHandler.php | 2 +- test/bootstrap.php | 2 +- test/integration/BasketTest.php | 2 +- test/integration/CustomerTest.php | 2 +- test/integration/DummyResource.php | 2 +- test/integration/ExceptionTest.php | 2 +- test/integration/KeypairTest.php | 2 +- test/integration/PaymentCancelTest.php | 2 +- test/integration/PaymentTest.php | 2 +- test/integration/PaymentTypes/AlipayTest.php | 2 +- test/integration/PaymentTypes/CardTest.php | 2 +- test/integration/PaymentTypes/EPSTest.php | 2 +- test/integration/PaymentTypes/GiropayTest.php | 2 +- test/integration/PaymentTypes/HirePurchaseDirectDebitTest.php | 2 +- test/integration/PaymentTypes/IdealTest.php | 2 +- test/integration/PaymentTypes/InvoiceFactoringTest.php | 2 +- test/integration/PaymentTypes/InvoiceGuaranteedTest.php | 2 +- test/integration/PaymentTypes/InvoiceTest.php | 2 +- test/integration/PaymentTypes/PISTest.php | 2 +- test/integration/PaymentTypes/PaypageTest.php | 2 +- test/integration/PaymentTypes/PaypalTest.php | 2 +- test/integration/PaymentTypes/PrepaymentTest.php | 2 +- test/integration/PaymentTypes/Przelewy24Test.php | 2 +- test/integration/PaymentTypes/SepaDirectDebitGuaranteedTest.php | 2 +- test/integration/PaymentTypes/SepaDirectDebitTest.php | 2 +- test/integration/PaymentTypes/SofortTest.php | 2 +- test/integration/PaymentTypes/WechatpayTest.php | 2 +- test/integration/RecurringPaymentTest.php | 2 +- test/integration/SetMetadataTest.php | 2 +- test/integration/TransactionTypes/AuthorizationTest.php | 2 +- .../TransactionTypes/CancelAfterAuthorizationTest.php | 2 +- test/integration/TransactionTypes/CancelAfterChargeTest.php | 2 +- test/integration/TransactionTypes/CancelTest.php | 2 +- .../TransactionTypes/ChargeAfterAuthorizationTest.php | 2 +- test/integration/TransactionTypes/ChargeTest.php | 2 +- test/integration/TransactionTypes/PayoutTest.php | 2 +- test/integration/TransactionTypes/ShipmentTest.php | 2 +- test/integration/WebhookTest.php | 2 +- test/unit/Constants/PaymentStateTest.php | 2 +- test/unit/DummyResource.php | 2 +- test/unit/Exceptions/HeidelpayApiExceptionTest.php | 2 +- test/unit/HeidelpayTest.php | 2 +- test/unit/Resources/AbstractHeidelpayResourceTest.php | 2 +- test/unit/Resources/BasketTest.php | 2 +- test/unit/Resources/CustomerFactoryTest.php | 2 +- test/unit/Resources/CustomerTest.php | 2 +- test/unit/Resources/DummyHeidelpayResource.php | 2 +- test/unit/Resources/EmbeddedResources/AmountTest.php | 2 +- test/unit/Resources/EmbeddedResources/BasketItemTest.php | 2 +- test/unit/Resources/EmbeddedResources/GeoLocationTest.php | 2 +- test/unit/Resources/InstalmentPlanTest.php | 2 +- test/unit/Resources/KeypairTest.php | 2 +- test/unit/Resources/MetadataTest.php | 2 +- test/unit/Resources/PaymentCancelTest.php | 2 +- test/unit/Resources/PaymentTest.php | 2 +- test/unit/Resources/PaymentTypes/CardTest.php | 2 +- test/unit/Resources/PaymentTypes/EPSTest.php | 2 +- .../unit/Resources/PaymentTypes/HirePurchaseDirectDebitTest.php | 2 +- test/unit/Resources/PaymentTypes/IdealTest.php | 2 +- test/unit/Resources/PaymentTypes/PayPageTest.php | 2 +- test/unit/Resources/PaymentTypes/PayPalTest.php | 2 +- .../Resources/PaymentTypes/SepaDirectDebitGuaranteedTest.php | 2 +- test/unit/Resources/PaymentTypes/SepaDirectDebitTest.php | 2 +- test/unit/Resources/RecurringTest.php | 2 +- .../Resources/TransactionTypes/AbstractTransactionTypeTest.php | 2 +- test/unit/Resources/TransactionTypes/AuthorizationTest.php | 2 +- test/unit/Resources/TransactionTypes/CancellationTest.php | 2 +- test/unit/Resources/TransactionTypes/ChargeTest.php | 2 +- test/unit/Resources/TransactionTypes/DummyTransactionType.php | 2 +- test/unit/Resources/TransactionTypes/PayoutTest.php | 2 +- test/unit/Resources/TransactionTypes/ShipmentTest.php | 2 +- test/unit/Resources/WebhookTest.php | 2 +- test/unit/Resources/WebhooksTest.php | 2 +- test/unit/Services/DummyAdapter.php | 2 +- test/unit/Services/DummyDebugHandler.php | 2 +- test/unit/Services/HttpServiceTest.php | 2 +- test/unit/Services/PaymentServiceTest.php | 2 +- test/unit/Services/ResourceNameServiceTest.php | 2 +- test/unit/Services/ResourceServiceTest.php | 2 +- test/unit/Services/WebhooksServiceTest.php | 2 +- test/unit/Traits/CanAuthorizeTest.php | 2 +- test/unit/Traits/CanAuthorizeWithCustomerTest.php | 2 +- test/unit/Traits/CanDirectChargeTest.php | 2 +- test/unit/Traits/CanDirectChargeWithCustomerTest.php | 2 +- test/unit/Traits/CanPayoutTest.php | 2 +- test/unit/Traits/CanPayoutWithCustomerTest.php | 2 +- test/unit/Traits/CanRecurTest.php | 2 +- test/unit/Traits/HasCancellationsTest.php | 2 +- test/unit/Traits/HasInvoiceIdTest.php | 2 +- test/unit/Traits/HasPaymentStateTest.php | 2 +- test/unit/Traits/TraitDummyCanRecur.php | 2 +- test/unit/Traits/TraitDummyCanRecurNonResource.php | 2 +- test/unit/Traits/TraitDummyHasCancellationsHasPaymentState.php | 2 +- test/unit/Traits/TraitDummyHasInvoiceId.php | 2 +- test/unit/Traits/TraitDummyWithCustomerWithParentIF.php | 2 +- test/unit/Traits/TraitDummyWithCustomerWithoutParentIF.php | 2 +- test/unit/Traits/TraitDummyWithoutCustomerWithParentIF.php | 2 +- test/unit/Traits/TraitDummyWithoutCustomerWithoutParentIF.php | 2 +- test/unit/Validators/PrivateKeyValidatorTest.php | 2 +- test/unit/Validators/PublicKeyValidatorTest.php | 2 +- 270 files changed, 270 insertions(+), 270 deletions(-) diff --git a/examples/Alipay/Constants.php b/examples/Alipay/Constants.php index 8a52ef6e..de175dba 100755 --- a/examples/Alipay/Constants.php +++ b/examples/Alipay/Constants.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/examples + * @package heidelpayPHP\examples */ require_once __DIR__ . '/../Constants.php'; diff --git a/examples/Alipay/Controller.php b/examples/Alipay/Controller.php index 8ffb0424..928457c4 100755 --- a/examples/Alipay/Controller.php +++ b/examples/Alipay/Controller.php @@ -21,7 +21,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/examples + * @package heidelpayPHP\examples */ /** Require the constants of this example */ diff --git a/examples/Alipay/ReturnController.php b/examples/Alipay/ReturnController.php index 134c9081..f0849f47 100755 --- a/examples/Alipay/ReturnController.php +++ b/examples/Alipay/ReturnController.php @@ -21,7 +21,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/examples + * @package heidelpayPHP\examples */ /** Require the constants of this example */ diff --git a/examples/Alipay/index.php b/examples/Alipay/index.php index 351da9f7..097f6f08 100755 --- a/examples/Alipay/index.php +++ b/examples/Alipay/index.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/examples + * @package heidelpayPHP\examples */ /** Require the constants of this example */ diff --git a/examples/Card/Constants.php b/examples/Card/Constants.php index 9b435a5d..1c771888 100644 --- a/examples/Card/Constants.php +++ b/examples/Card/Constants.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/examples + * @package heidelpayPHP\examples */ require_once __DIR__ . '/../Constants.php'; diff --git a/examples/Card/Controller.php b/examples/Card/Controller.php index 4d51c584..e2b0617f 100644 --- a/examples/Card/Controller.php +++ b/examples/Card/Controller.php @@ -21,7 +21,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/examples + * @package heidelpayPHP\examples */ /** Require the constants of this example */ diff --git a/examples/Card/ReturnController.php b/examples/Card/ReturnController.php index 30027af2..b9d8643e 100644 --- a/examples/Card/ReturnController.php +++ b/examples/Card/ReturnController.php @@ -21,7 +21,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/examples + * @package heidelpayPHP\examples */ /** Require the constants of this example */ diff --git a/examples/Card/index.php b/examples/Card/index.php index deec55a2..f2b93d4f 100644 --- a/examples/Card/index.php +++ b/examples/Card/index.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/examples + * @package heidelpayPHP\examples */ /** Require the constants of this example */ diff --git a/examples/CardRecurring/Constants.php b/examples/CardRecurring/Constants.php index 159947bc..a19a0395 100644 --- a/examples/CardRecurring/Constants.php +++ b/examples/CardRecurring/Constants.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/examples + * @package heidelpayPHP\examples */ require_once __DIR__ . '/../Constants.php'; diff --git a/examples/CardRecurring/Controller.php b/examples/CardRecurring/Controller.php index c42aa363..33fde55a 100644 --- a/examples/CardRecurring/Controller.php +++ b/examples/CardRecurring/Controller.php @@ -21,7 +21,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/examples + * @package heidelpayPHP\examples */ /** Require the constants of this example */ diff --git a/examples/CardRecurring/ReturnController.php b/examples/CardRecurring/ReturnController.php index 06b74f0c..db2e960b 100644 --- a/examples/CardRecurring/ReturnController.php +++ b/examples/CardRecurring/ReturnController.php @@ -21,7 +21,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/examples + * @package heidelpayPHP\examples */ /** Require the constants of this example */ diff --git a/examples/CardRecurring/index.php b/examples/CardRecurring/index.php index edfdf07b..66de9978 100644 --- a/examples/CardRecurring/index.php +++ b/examples/CardRecurring/index.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/examples + * @package heidelpayPHP\examples */ /** Require the constants of this example */ diff --git a/examples/Constants.php b/examples/Constants.php index 8e255cc4..c9e201d5 100755 --- a/examples/Constants.php +++ b/examples/Constants.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/examples + * @package heidelpayPHP\examples */ require_once __DIR__ . '/_enableExamples.php'; diff --git a/examples/EPSCharge/Constants.php b/examples/EPSCharge/Constants.php index 0c478e3e..c14c7ed3 100755 --- a/examples/EPSCharge/Constants.php +++ b/examples/EPSCharge/Constants.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/examples + * @package heidelpayPHP\examples */ require_once __DIR__ . '/../Constants.php'; diff --git a/examples/EPSCharge/Controller.php b/examples/EPSCharge/Controller.php index 7717e1fd..d40824ba 100755 --- a/examples/EPSCharge/Controller.php +++ b/examples/EPSCharge/Controller.php @@ -21,7 +21,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/examples + * @package heidelpayPHP\examples */ /** Require the constants of this example */ diff --git a/examples/EPSCharge/ReturnController.php b/examples/EPSCharge/ReturnController.php index d430a1ec..281ed67d 100755 --- a/examples/EPSCharge/ReturnController.php +++ b/examples/EPSCharge/ReturnController.php @@ -21,7 +21,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/examples + * @package heidelpayPHP\examples */ /** Require the constants of this example */ diff --git a/examples/EPSCharge/index.php b/examples/EPSCharge/index.php index 33dbb0d4..efa72abf 100755 --- a/examples/EPSCharge/index.php +++ b/examples/EPSCharge/index.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/examples + * @package heidelpayPHP\examples */ /** Require the constants of this example */ diff --git a/examples/EmbeddedPayPage/Constants.php b/examples/EmbeddedPayPage/Constants.php index dc2d130a..0c9971ad 100644 --- a/examples/EmbeddedPayPage/Constants.php +++ b/examples/EmbeddedPayPage/Constants.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/examples + * @package heidelpayPHP\examples */ require_once __DIR__ . '/../Constants.php'; diff --git a/examples/EmbeddedPayPage/Controller.php b/examples/EmbeddedPayPage/Controller.php index 073d2a4c..9701e0b1 100644 --- a/examples/EmbeddedPayPage/Controller.php +++ b/examples/EmbeddedPayPage/Controller.php @@ -21,7 +21,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/examples + * @package heidelpayPHP\examples */ /** Require the constants of this example */ diff --git a/examples/EmbeddedPayPage/ReturnController.php b/examples/EmbeddedPayPage/ReturnController.php index d749eb62..0b629e77 100644 --- a/examples/EmbeddedPayPage/ReturnController.php +++ b/examples/EmbeddedPayPage/ReturnController.php @@ -21,7 +21,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/examples + * @package heidelpayPHP\examples */ /** Require the constants of this example */ diff --git a/examples/EmbeddedPayPage/index.php b/examples/EmbeddedPayPage/index.php index a87e0b1c..3a7e8477 100644 --- a/examples/EmbeddedPayPage/index.php +++ b/examples/EmbeddedPayPage/index.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/examples + * @package heidelpayPHP\examples */ /** Require the constants of this example */ diff --git a/examples/ExampleDebugHandler.php b/examples/ExampleDebugHandler.php index 30f6f3ce..cda6d17a 100755 --- a/examples/ExampleDebugHandler.php +++ b/examples/ExampleDebugHandler.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/integration + * @package heidelpayPHP\test\integration */ namespace heidelpayPHP\examples; diff --git a/examples/Failure.php b/examples/Failure.php index 0ccebe6c..6e91d18e 100755 --- a/examples/Failure.php +++ b/examples/Failure.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/examples + * @package heidelpayPHP\examples */ session_start(); diff --git a/examples/FlexiPayDirect/Constants.php b/examples/FlexiPayDirect/Constants.php index 3383271a..f1083075 100644 --- a/examples/FlexiPayDirect/Constants.php +++ b/examples/FlexiPayDirect/Constants.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/examples + * @package heidelpayPHP\examples */ require_once __DIR__ . '/../Constants.php'; diff --git a/examples/FlexiPayDirect/Controller.php b/examples/FlexiPayDirect/Controller.php index b85f1b03..f300d237 100644 --- a/examples/FlexiPayDirect/Controller.php +++ b/examples/FlexiPayDirect/Controller.php @@ -21,7 +21,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/examples + * @package heidelpayPHP\examples */ /** Require the constants of this example */ diff --git a/examples/FlexiPayDirect/ReturnController.php b/examples/FlexiPayDirect/ReturnController.php index 0652af91..80cc0607 100644 --- a/examples/FlexiPayDirect/ReturnController.php +++ b/examples/FlexiPayDirect/ReturnController.php @@ -21,7 +21,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/examples + * @package heidelpayPHP\examples */ /** Require the constants of this example */ diff --git a/examples/FlexiPayDirect/index.php b/examples/FlexiPayDirect/index.php index 5436330f..b22e0bab 100644 --- a/examples/FlexiPayDirect/index.php +++ b/examples/FlexiPayDirect/index.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/examples + * @package heidelpayPHP\examples */ /** Require the constants of this example */ diff --git a/examples/Giropay/Constants.php b/examples/Giropay/Constants.php index 965bd7f1..a6eb41b5 100644 --- a/examples/Giropay/Constants.php +++ b/examples/Giropay/Constants.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/examples + * @package heidelpayPHP\examples */ require_once __DIR__ . '/../Constants.php'; diff --git a/examples/Giropay/Controller.php b/examples/Giropay/Controller.php index 4c6f174e..fe2cd842 100644 --- a/examples/Giropay/Controller.php +++ b/examples/Giropay/Controller.php @@ -21,7 +21,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/examples + * @package heidelpayPHP\examples */ /** Require the constants of this example */ diff --git a/examples/Giropay/ReturnController.php b/examples/Giropay/ReturnController.php index 1ea23f84..9ed4728e 100644 --- a/examples/Giropay/ReturnController.php +++ b/examples/Giropay/ReturnController.php @@ -21,7 +21,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/examples + * @package heidelpayPHP\examples */ /** Require the constants of this example */ diff --git a/examples/Giropay/index.php b/examples/Giropay/index.php index 875c4ac5..531229a8 100644 --- a/examples/Giropay/index.php +++ b/examples/Giropay/index.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/examples + * @package heidelpayPHP\examples */ /** Require the constants of this example */ diff --git a/examples/HirePurchaseDirectDebit/Constants.php b/examples/HirePurchaseDirectDebit/Constants.php index 44384ce0..9337754e 100644 --- a/examples/HirePurchaseDirectDebit/Constants.php +++ b/examples/HirePurchaseDirectDebit/Constants.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/examples + * @package heidelpayPHP\examples */ require_once __DIR__ . '/../Constants.php'; diff --git a/examples/HirePurchaseDirectDebit/Controller.php b/examples/HirePurchaseDirectDebit/Controller.php index fe8b18e5..21efa1f0 100644 --- a/examples/HirePurchaseDirectDebit/Controller.php +++ b/examples/HirePurchaseDirectDebit/Controller.php @@ -21,7 +21,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/examples + * @package heidelpayPHP\examples */ /** Require the constants of this example */ diff --git a/examples/HirePurchaseDirectDebit/PlaceOrderController.php b/examples/HirePurchaseDirectDebit/PlaceOrderController.php index 822b5464..214721a3 100644 --- a/examples/HirePurchaseDirectDebit/PlaceOrderController.php +++ b/examples/HirePurchaseDirectDebit/PlaceOrderController.php @@ -21,7 +21,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/examples + * @package heidelpayPHP\examples */ /** Require the constants of this example */ diff --git a/examples/HirePurchaseDirectDebit/confirm.php b/examples/HirePurchaseDirectDebit/confirm.php index 99ad8858..fb58d3e4 100644 --- a/examples/HirePurchaseDirectDebit/confirm.php +++ b/examples/HirePurchaseDirectDebit/confirm.php @@ -21,7 +21,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/examples + * @package heidelpayPHP\examples */ /** Require the constants of this example */ diff --git a/examples/HirePurchaseDirectDebit/index.php b/examples/HirePurchaseDirectDebit/index.php index 46985f65..e6a4c1fa 100644 --- a/examples/HirePurchaseDirectDebit/index.php +++ b/examples/HirePurchaseDirectDebit/index.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/examples + * @package heidelpayPHP\examples */ /** Require the constants of this example */ diff --git a/examples/HostedPayPage/Constants.php b/examples/HostedPayPage/Constants.php index 7607650b..081007ab 100644 --- a/examples/HostedPayPage/Constants.php +++ b/examples/HostedPayPage/Constants.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/examples + * @package heidelpayPHP\examples */ require_once __DIR__ . '/../Constants.php'; diff --git a/examples/HostedPayPage/Controller.php b/examples/HostedPayPage/Controller.php index 5db8504e..771a6ba7 100644 --- a/examples/HostedPayPage/Controller.php +++ b/examples/HostedPayPage/Controller.php @@ -21,7 +21,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/examples + * @package heidelpayPHP\examples */ /** Require the constants of this example */ diff --git a/examples/HostedPayPage/ReturnController.php b/examples/HostedPayPage/ReturnController.php index 6c465222..462b8840 100644 --- a/examples/HostedPayPage/ReturnController.php +++ b/examples/HostedPayPage/ReturnController.php @@ -21,7 +21,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/examples + * @package heidelpayPHP\examples */ /** Require the constants of this example */ diff --git a/examples/HostedPayPage/index.php b/examples/HostedPayPage/index.php index 75020623..fc9e1560 100644 --- a/examples/HostedPayPage/index.php +++ b/examples/HostedPayPage/index.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/examples + * @package heidelpayPHP\examples */ /** Require the constants of this example */ diff --git a/examples/IDeal/Constants.php b/examples/IDeal/Constants.php index 3b83bf92..3b19c11a 100644 --- a/examples/IDeal/Constants.php +++ b/examples/IDeal/Constants.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/examples + * @package heidelpayPHP\examples */ require_once __DIR__ . '/../Constants.php'; diff --git a/examples/IDeal/Controller.php b/examples/IDeal/Controller.php index 37aaaabf..a413e01c 100644 --- a/examples/IDeal/Controller.php +++ b/examples/IDeal/Controller.php @@ -21,7 +21,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/examples + * @package heidelpayPHP\examples */ /** Require the constants of this example */ diff --git a/examples/IDeal/ReturnController.php b/examples/IDeal/ReturnController.php index f8e6bf5b..062617b6 100644 --- a/examples/IDeal/ReturnController.php +++ b/examples/IDeal/ReturnController.php @@ -21,7 +21,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/examples + * @package heidelpayPHP\examples */ /** Require the constants of this example */ diff --git a/examples/IDeal/index.php b/examples/IDeal/index.php index fde3cfe1..e4504589 100644 --- a/examples/IDeal/index.php +++ b/examples/IDeal/index.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/examples + * @package heidelpayPHP\examples */ /** Require the constants of this example */ diff --git a/examples/Invoice/Constants.php b/examples/Invoice/Constants.php index ea7321bc..5f0e575d 100644 --- a/examples/Invoice/Constants.php +++ b/examples/Invoice/Constants.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/examples + * @package heidelpayPHP\examples */ require_once __DIR__ . '/../Constants.php'; diff --git a/examples/Invoice/Controller.php b/examples/Invoice/Controller.php index 8a2aaafe..ea343cfe 100644 --- a/examples/Invoice/Controller.php +++ b/examples/Invoice/Controller.php @@ -21,7 +21,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/examples + * @package heidelpayPHP\examples */ /** Require the constants of this example */ diff --git a/examples/Invoice/index.php b/examples/Invoice/index.php index d3c1a749..0b266c72 100644 --- a/examples/Invoice/index.php +++ b/examples/Invoice/index.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/examples + * @package heidelpayPHP\examples */ /** Require the constants of this example */ diff --git a/examples/InvoiceFactoring/Constants.php b/examples/InvoiceFactoring/Constants.php index 086b83ff..881b469b 100755 --- a/examples/InvoiceFactoring/Constants.php +++ b/examples/InvoiceFactoring/Constants.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/examples + * @package heidelpayPHP\examples */ require_once __DIR__ . '/../Constants.php'; diff --git a/examples/InvoiceFactoring/Controller.php b/examples/InvoiceFactoring/Controller.php index 8a608352..11e7e9cc 100755 --- a/examples/InvoiceFactoring/Controller.php +++ b/examples/InvoiceFactoring/Controller.php @@ -21,7 +21,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/examples + * @package heidelpayPHP\examples */ /** Require the constants of this example */ diff --git a/examples/InvoiceFactoring/index.php b/examples/InvoiceFactoring/index.php index dc8ee4a5..9fa317ad 100755 --- a/examples/InvoiceFactoring/index.php +++ b/examples/InvoiceFactoring/index.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/examples + * @package heidelpayPHP\examples */ /** Require the constants of this example */ diff --git a/examples/InvoiceGuaranteed/Constants.php b/examples/InvoiceGuaranteed/Constants.php index d6a1dbf4..1fba835f 100755 --- a/examples/InvoiceGuaranteed/Constants.php +++ b/examples/InvoiceGuaranteed/Constants.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/examples + * @package heidelpayPHP\examples */ require_once __DIR__ . '/../Constants.php'; diff --git a/examples/InvoiceGuaranteed/Controller.php b/examples/InvoiceGuaranteed/Controller.php index ade773ca..e4c9c37c 100755 --- a/examples/InvoiceGuaranteed/Controller.php +++ b/examples/InvoiceGuaranteed/Controller.php @@ -21,7 +21,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/examples + * @package heidelpayPHP\examples */ /** Require the constants of this example */ diff --git a/examples/InvoiceGuaranteed/index.php b/examples/InvoiceGuaranteed/index.php index b8124be7..901be706 100755 --- a/examples/InvoiceGuaranteed/index.php +++ b/examples/InvoiceGuaranteed/index.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/examples + * @package heidelpayPHP\examples */ /** Require the constants of this example */ diff --git a/examples/PayPal/Constants.php b/examples/PayPal/Constants.php index 92dcec72..888622dd 100755 --- a/examples/PayPal/Constants.php +++ b/examples/PayPal/Constants.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/examples + * @package heidelpayPHP\examples */ require_once __DIR__ . '/../Constants.php'; diff --git a/examples/PayPal/Controller.php b/examples/PayPal/Controller.php index 6bd0cc33..8bc6d904 100755 --- a/examples/PayPal/Controller.php +++ b/examples/PayPal/Controller.php @@ -21,7 +21,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/examples + * @package heidelpayPHP\examples */ /** Require the constants of this example */ diff --git a/examples/PayPal/ReturnController.php b/examples/PayPal/ReturnController.php index 77927dd8..9d27c94b 100755 --- a/examples/PayPal/ReturnController.php +++ b/examples/PayPal/ReturnController.php @@ -21,7 +21,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/examples + * @package heidelpayPHP\examples */ /** Require the constants of this example */ diff --git a/examples/PayPal/index.php b/examples/PayPal/index.php index 58fa9b8a..5f4dac2e 100755 --- a/examples/PayPal/index.php +++ b/examples/PayPal/index.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/examples + * @package heidelpayPHP\examples */ /** Require the constants of this example */ diff --git a/examples/PayPalRecurring/Constants.php b/examples/PayPalRecurring/Constants.php index 5a39ce80..5a4a9e3d 100644 --- a/examples/PayPalRecurring/Constants.php +++ b/examples/PayPalRecurring/Constants.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/examples + * @package heidelpayPHP\examples */ require_once __DIR__ . '/../Constants.php'; diff --git a/examples/PayPalRecurring/Controller.php b/examples/PayPalRecurring/Controller.php index cbbbf3b4..8a2afdc0 100644 --- a/examples/PayPalRecurring/Controller.php +++ b/examples/PayPalRecurring/Controller.php @@ -21,7 +21,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/examples + * @package heidelpayPHP\examples */ /** Require the constants of this example */ diff --git a/examples/PayPalRecurring/ReturnController.php b/examples/PayPalRecurring/ReturnController.php index 239af0ee..212260a6 100644 --- a/examples/PayPalRecurring/ReturnController.php +++ b/examples/PayPalRecurring/ReturnController.php @@ -21,7 +21,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/examples + * @package heidelpayPHP\examples */ /** Require the constants of this example */ diff --git a/examples/PayPalRecurring/index.php b/examples/PayPalRecurring/index.php index 57562714..80061feb 100644 --- a/examples/PayPalRecurring/index.php +++ b/examples/PayPalRecurring/index.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/examples + * @package heidelpayPHP\examples */ /** Require the constants of this example */ diff --git a/examples/Pending.php b/examples/Pending.php index 8ec019e5..095f1913 100644 --- a/examples/Pending.php +++ b/examples/Pending.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/examples + * @package heidelpayPHP\examples */ session_start(); diff --git a/examples/Prepayment/Constants.php b/examples/Prepayment/Constants.php index 2712f389..abd7bfce 100644 --- a/examples/Prepayment/Constants.php +++ b/examples/Prepayment/Constants.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/examples + * @package heidelpayPHP\examples */ require_once __DIR__ . '/../Constants.php'; diff --git a/examples/Prepayment/Controller.php b/examples/Prepayment/Controller.php index b33ad4d4..bbe2062a 100644 --- a/examples/Prepayment/Controller.php +++ b/examples/Prepayment/Controller.php @@ -21,7 +21,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/examples + * @package heidelpayPHP\examples */ /** Require the constants of this example */ diff --git a/examples/Prepayment/index.php b/examples/Prepayment/index.php index dedf71df..3ed893b5 100644 --- a/examples/Prepayment/index.php +++ b/examples/Prepayment/index.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/examples + * @package heidelpayPHP\examples */ /** Require the constants of this example */ diff --git a/examples/SepaDirectDebitGuaranteed/Constants.php b/examples/SepaDirectDebitGuaranteed/Constants.php index 9fe3b385..032db55a 100755 --- a/examples/SepaDirectDebitGuaranteed/Constants.php +++ b/examples/SepaDirectDebitGuaranteed/Constants.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/examples + * @package heidelpayPHP\examples */ require_once __DIR__ . '/../Constants.php'; diff --git a/examples/SepaDirectDebitGuaranteed/Controller.php b/examples/SepaDirectDebitGuaranteed/Controller.php index c65dc303..40482b55 100755 --- a/examples/SepaDirectDebitGuaranteed/Controller.php +++ b/examples/SepaDirectDebitGuaranteed/Controller.php @@ -21,7 +21,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/examples + * @package heidelpayPHP\examples */ /** Require the constants of this example */ diff --git a/examples/SepaDirectDebitGuaranteed/index.php b/examples/SepaDirectDebitGuaranteed/index.php index a5cb0906..d9045d7a 100755 --- a/examples/SepaDirectDebitGuaranteed/index.php +++ b/examples/SepaDirectDebitGuaranteed/index.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/examples + * @package heidelpayPHP\examples */ /** Require the constants of this example */ diff --git a/examples/Sofort/Constants.php b/examples/Sofort/Constants.php index 5f6a72ab..8785ae8d 100644 --- a/examples/Sofort/Constants.php +++ b/examples/Sofort/Constants.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/examples + * @package heidelpayPHP\examples */ require_once __DIR__ . '/../Constants.php'; diff --git a/examples/Sofort/Controller.php b/examples/Sofort/Controller.php index aef5746d..8dbf7089 100644 --- a/examples/Sofort/Controller.php +++ b/examples/Sofort/Controller.php @@ -21,7 +21,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/examples + * @package heidelpayPHP\examples */ /** Require the constants of this example */ diff --git a/examples/Sofort/ReturnController.php b/examples/Sofort/ReturnController.php index 35cdcfe3..f35102ef 100644 --- a/examples/Sofort/ReturnController.php +++ b/examples/Sofort/ReturnController.php @@ -21,7 +21,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/examples + * @package heidelpayPHP\examples */ /** Require the constants of this example */ diff --git a/examples/Sofort/index.php b/examples/Sofort/index.php index 5f2b6a01..4f48f4d9 100644 --- a/examples/Sofort/index.php +++ b/examples/Sofort/index.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/examples + * @package heidelpayPHP\examples */ /** Require the constants of this example */ diff --git a/examples/Success.php b/examples/Success.php index eac88ffa..d7f3c0da 100755 --- a/examples/Success.php +++ b/examples/Success.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/examples + * @package heidelpayPHP\examples */ session_start(); diff --git a/examples/Webhooks/Constants.php b/examples/Webhooks/Constants.php index 77628792..f856edc8 100755 --- a/examples/Webhooks/Constants.php +++ b/examples/Webhooks/Constants.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/examples + * @package heidelpayPHP\examples */ require_once __DIR__ . '/../Constants.php'; diff --git a/examples/Webhooks/Controller.php b/examples/Webhooks/Controller.php index 0c75d2e4..bf6ee32b 100755 --- a/examples/Webhooks/Controller.php +++ b/examples/Webhooks/Controller.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/examples + * @package heidelpayPHP\examples */ /** Require the constants of this example */ diff --git a/examples/Webhooks/fetchAll.php b/examples/Webhooks/fetchAll.php index 8d6b10c9..9acb25ab 100644 --- a/examples/Webhooks/fetchAll.php +++ b/examples/Webhooks/fetchAll.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/examples + * @package heidelpayPHP\examples */ /** Require the constants of this example */ diff --git a/examples/Webhooks/index.php b/examples/Webhooks/index.php index 6c7adb99..c8e5dacf 100755 --- a/examples/Webhooks/index.php +++ b/examples/Webhooks/index.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/examples + * @package heidelpayPHP\examples */ /** Require the constants of this example */ diff --git a/examples/Webhooks/removeAll.php b/examples/Webhooks/removeAll.php index fc21ecf9..caf440f8 100755 --- a/examples/Webhooks/removeAll.php +++ b/examples/Webhooks/removeAll.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/examples + * @package heidelpayPHP\examples */ /** Require the constants of this example */ diff --git a/examples/Wechatpay/Constants.php b/examples/Wechatpay/Constants.php index 49d9c9da..807c63e9 100755 --- a/examples/Wechatpay/Constants.php +++ b/examples/Wechatpay/Constants.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/examples + * @package heidelpayPHP\examples */ require_once __DIR__ . '/../Constants.php'; diff --git a/examples/Wechatpay/Controller.php b/examples/Wechatpay/Controller.php index af9b9ffe..041c993d 100755 --- a/examples/Wechatpay/Controller.php +++ b/examples/Wechatpay/Controller.php @@ -21,7 +21,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/examples + * @package heidelpayPHP\examples */ /** Require the constants of this example */ diff --git a/examples/Wechatpay/ReturnController.php b/examples/Wechatpay/ReturnController.php index 322a4fd6..a50c0073 100755 --- a/examples/Wechatpay/ReturnController.php +++ b/examples/Wechatpay/ReturnController.php @@ -21,7 +21,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/examples + * @package heidelpayPHP\examples */ /** Require the constants of this example */ diff --git a/examples/Wechatpay/index.php b/examples/Wechatpay/index.php index 086c984b..80fb6b88 100755 --- a/examples/Wechatpay/index.php +++ b/examples/Wechatpay/index.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/examples + * @package heidelpayPHP\examples */ /** Require the constants of this example */ diff --git a/examples/_enableExamples.php b/examples/_enableExamples.php index 3bd68308..e4c5a4cd 100755 --- a/examples/_enableExamples.php +++ b/examples/_enableExamples.php @@ -22,7 +22,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/examples + * @package heidelpayPHP\examples */ /* Set to true if you want to enable the examples */ diff --git a/examples/index.php b/examples/index.php index 18bfd314..8bbfcd06 100755 --- a/examples/index.php +++ b/examples/index.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/examples + * @package heidelpayPHP\examples */ /** Require the constants of this example */ diff --git a/src/Adapter/CurlAdapter.php b/src/Adapter/CurlAdapter.php index a9d421dc..6d517490 100755 --- a/src/Adapter/CurlAdapter.php +++ b/src/Adapter/CurlAdapter.php @@ -21,7 +21,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/adapter + * @package heidelpayPHP\adapter */ namespace heidelpayPHP\Adapter; diff --git a/src/Adapter/HttpAdapterInterface.php b/src/Adapter/HttpAdapterInterface.php index d58ef09e..264a350b 100755 --- a/src/Adapter/HttpAdapterInterface.php +++ b/src/Adapter/HttpAdapterInterface.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/adapter + * @package heidelpayPHP\Adapter */ namespace heidelpayPHP\Adapter; diff --git a/src/Constants/ApiResponseCodes.php b/src/Constants/ApiResponseCodes.php index ca4dc4b7..3dbf4601 100755 --- a/src/Constants/ApiResponseCodes.php +++ b/src/Constants/ApiResponseCodes.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/constants + * @package heidelpayPHP\Constants */ namespace heidelpayPHP\Constants; diff --git a/src/Constants/BasketItemTypes.php b/src/Constants/BasketItemTypes.php index c9a042bd..60ec2b20 100644 --- a/src/Constants/BasketItemTypes.php +++ b/src/Constants/BasketItemTypes.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/constants + * @package heidelpayPHP\Constants */ namespace heidelpayPHP\Constants; diff --git a/src/Constants/CancelReasonCodes.php b/src/Constants/CancelReasonCodes.php index 42c864ef..7aa80db1 100755 --- a/src/Constants/CancelReasonCodes.php +++ b/src/Constants/CancelReasonCodes.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/constants + * @package heidelpayPHP\Constants */ namespace heidelpayPHP\Constants; diff --git a/src/Constants/CompanyCommercialSectorItems.php b/src/Constants/CompanyCommercialSectorItems.php index 479bec9a..3660b955 100644 --- a/src/Constants/CompanyCommercialSectorItems.php +++ b/src/Constants/CompanyCommercialSectorItems.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/constants + * @package heidelpayPHP\Constants */ namespace heidelpayPHP\Constants; diff --git a/src/Constants/CompanyRegistrationTypes.php b/src/Constants/CompanyRegistrationTypes.php index d52ae718..c3026e92 100644 --- a/src/Constants/CompanyRegistrationTypes.php +++ b/src/Constants/CompanyRegistrationTypes.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/constants + * @package heidelpayPHP\Constants */ namespace heidelpayPHP\Constants; diff --git a/src/Constants/IdStrings.php b/src/Constants/IdStrings.php index 37c92046..0530f832 100755 --- a/src/Constants/IdStrings.php +++ b/src/Constants/IdStrings.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/constants + * @package heidelpayPHP\Constants */ namespace heidelpayPHP\Constants; diff --git a/src/Constants/PaymentState.php b/src/Constants/PaymentState.php index bddc7fce..208eb1c4 100755 --- a/src/Constants/PaymentState.php +++ b/src/Constants/PaymentState.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/constants + * @package heidelpayPHP\Constants */ namespace heidelpayPHP\Constants; diff --git a/src/Constants/Salutations.php b/src/Constants/Salutations.php index 5c8d9bca..ac30098c 100755 --- a/src/Constants/Salutations.php +++ b/src/Constants/Salutations.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/constants + * @package heidelpayPHP\Constants */ namespace heidelpayPHP\Constants; diff --git a/src/Constants/TransactionTypes.php b/src/Constants/TransactionTypes.php index 887fd054..21460400 100755 --- a/src/Constants/TransactionTypes.php +++ b/src/Constants/TransactionTypes.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/constants + * @package heidelpayPHP\Constants */ namespace heidelpayPHP\Constants; diff --git a/src/Constants/WebhookEvents.php b/src/Constants/WebhookEvents.php index 85e06139..e6b5f0ae 100755 --- a/src/Constants/WebhookEvents.php +++ b/src/Constants/WebhookEvents.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/constants + * @package heidelpayPHP\Constants */ namespace heidelpayPHP\Constants; diff --git a/src/Exceptions/HeidelpayApiException.php b/src/Exceptions/HeidelpayApiException.php index 9eb52118..e730afa7 100755 --- a/src/Exceptions/HeidelpayApiException.php +++ b/src/Exceptions/HeidelpayApiException.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/exceptions + * @package heidelpayPHP\Exceptions */ namespace heidelpayPHP\Exceptions; diff --git a/src/Interfaces/DebugHandlerInterface.php b/src/Interfaces/DebugHandlerInterface.php index 111b89a0..e8be9cd8 100755 --- a/src/Interfaces/DebugHandlerInterface.php +++ b/src/Interfaces/DebugHandlerInterface.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/interfaces + * @package heidelpayPHP\Interfaces */ namespace heidelpayPHP\Interfaces; diff --git a/src/Interfaces/HeidelpayParentInterface.php b/src/Interfaces/HeidelpayParentInterface.php index b608a38e..14cbdcaf 100755 --- a/src/Interfaces/HeidelpayParentInterface.php +++ b/src/Interfaces/HeidelpayParentInterface.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/interfaces + * @package heidelpayPHP\Interfaces */ namespace heidelpayPHP\Interfaces; diff --git a/src/Interfaces/WebhookServiceInterface.php b/src/Interfaces/WebhookServiceInterface.php index 15d5c3c6..454dd925 100644 --- a/src/Interfaces/WebhookServiceInterface.php +++ b/src/Interfaces/WebhookServiceInterface.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/services + * @package heidelpayPHP\Interfaces */ namespace heidelpayPHP\Interfaces; diff --git a/src/Resources/AbstractHeidelpayResource.php b/src/Resources/AbstractHeidelpayResource.php index 3c6ce459..e1aa6092 100755 --- a/src/Resources/AbstractHeidelpayResource.php +++ b/src/Resources/AbstractHeidelpayResource.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/Resources + * @package heidelpayPHP\Resources */ namespace heidelpayPHP\Resources; diff --git a/src/Resources/Basket.php b/src/Resources/Basket.php index 95be8ed2..b96c41ba 100755 --- a/src/Resources/Basket.php +++ b/src/Resources/Basket.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/resources + * @package heidelpayPHP\Resources */ namespace heidelpayPHP\Resources; diff --git a/src/Resources/Customer.php b/src/Resources/Customer.php index dcaaada1..6ebd728e 100755 --- a/src/Resources/Customer.php +++ b/src/Resources/Customer.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/resources + * @package heidelpayPHP\Resources */ namespace heidelpayPHP\Resources; diff --git a/src/Resources/CustomerFactory.php b/src/Resources/CustomerFactory.php index b176d2e6..59127e8f 100644 --- a/src/Resources/CustomerFactory.php +++ b/src/Resources/CustomerFactory.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/resources + * @package heidelpayPHP\Resources */ namespace heidelpayPHP\Resources; diff --git a/src/Resources/EmbeddedResources/Address.php b/src/Resources/EmbeddedResources/Address.php index 50aabfa2..cf88d362 100755 --- a/src/Resources/EmbeddedResources/Address.php +++ b/src/Resources/EmbeddedResources/Address.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/resources/embedded_resources + * @package heidelpayPHP\Resources\EmbeddedResources */ namespace heidelpayPHP\Resources\EmbeddedResources; diff --git a/src/Resources/EmbeddedResources/Amount.php b/src/Resources/EmbeddedResources/Amount.php index e12c8d19..de39bbfc 100755 --- a/src/Resources/EmbeddedResources/Amount.php +++ b/src/Resources/EmbeddedResources/Amount.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/resources/embedded_resources + * @package heidelpayPHP\Resources\EmbeddedResources */ namespace heidelpayPHP\Resources\EmbeddedResources; diff --git a/src/Resources/EmbeddedResources/BasketItem.php b/src/Resources/EmbeddedResources/BasketItem.php index d90ba1dd..d3d9b583 100755 --- a/src/Resources/EmbeddedResources/BasketItem.php +++ b/src/Resources/EmbeddedResources/BasketItem.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/resources/embedded_resources + * @package heidelpayPHP\Resources\EmbeddedResources */ namespace heidelpayPHP\Resources\EmbeddedResources; diff --git a/src/Resources/EmbeddedResources/CardDetails.php b/src/Resources/EmbeddedResources/CardDetails.php index b0832abd..8b6a80e3 100644 --- a/src/Resources/EmbeddedResources/CardDetails.php +++ b/src/Resources/EmbeddedResources/CardDetails.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/resources/embedded_resources + * @package heidelpayPHP\Resources\EmbeddedResources */ namespace heidelpayPHP\Resources\EmbeddedResources; diff --git a/src/Resources/EmbeddedResources/CompanyInfo.php b/src/Resources/EmbeddedResources/CompanyInfo.php index 36b8d084..f5dd3018 100644 --- a/src/Resources/EmbeddedResources/CompanyInfo.php +++ b/src/Resources/EmbeddedResources/CompanyInfo.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/resources/embedded_resources + * @package heidelpayPHP\Resources\EmbeddedResources */ namespace heidelpayPHP\Resources\EmbeddedResources; diff --git a/src/Resources/EmbeddedResources/GeoLocation.php b/src/Resources/EmbeddedResources/GeoLocation.php index 35ef3933..aba16a81 100644 --- a/src/Resources/EmbeddedResources/GeoLocation.php +++ b/src/Resources/EmbeddedResources/GeoLocation.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/resources/embedded_resources + * @package heidelpayPHP\Resources\EmbeddedResources */ namespace heidelpayPHP\Resources\EmbeddedResources; diff --git a/src/Resources/EmbeddedResources/Message.php b/src/Resources/EmbeddedResources/Message.php index 10768f95..0ea439d7 100755 --- a/src/Resources/EmbeddedResources/Message.php +++ b/src/Resources/EmbeddedResources/Message.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/resources/embedded_resources + * @package heidelpayPHP\Resources\EmbeddedResources */ namespace heidelpayPHP\Resources\EmbeddedResources; diff --git a/src/Resources/InstalmentPlan.php b/src/Resources/InstalmentPlan.php index 92ad0c31..5468342e 100644 --- a/src/Resources/InstalmentPlan.php +++ b/src/Resources/InstalmentPlan.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/resources + * @package heidelpayPHP\Resources */ namespace heidelpayPHP\Resources; diff --git a/src/Resources/InstalmentPlans.php b/src/Resources/InstalmentPlans.php index 9b4b3aa3..70cc8b2e 100644 --- a/src/Resources/InstalmentPlans.php +++ b/src/Resources/InstalmentPlans.php @@ -22,7 +22,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/resources + * @package heidelpayPHP\Resources */ namespace heidelpayPHP\Resources; diff --git a/src/Resources/Keypair.php b/src/Resources/Keypair.php index 1c2cbee5..5914ac96 100755 --- a/src/Resources/Keypair.php +++ b/src/Resources/Keypair.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/resources + * @package heidelpayPHP\Resources */ namespace heidelpayPHP\Resources; diff --git a/src/Resources/Metadata.php b/src/Resources/Metadata.php index 5b26f472..32bdbc2c 100755 --- a/src/Resources/Metadata.php +++ b/src/Resources/Metadata.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/resources + * @package heidelpayPHP\Resources */ namespace heidelpayPHP\Resources; diff --git a/src/Resources/Payment.php b/src/Resources/Payment.php index 451d6860..c0617057 100755 --- a/src/Resources/Payment.php +++ b/src/Resources/Payment.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/resources + * @package heidelpayPHP\Resources */ namespace heidelpayPHP\Resources; diff --git a/src/Resources/PaymentTypes/Alipay.php b/src/Resources/PaymentTypes/Alipay.php index 225c8b63..caf32c87 100755 --- a/src/Resources/PaymentTypes/Alipay.php +++ b/src/Resources/PaymentTypes/Alipay.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/payment_types + * @package heidelpayPHP\PaymentTypes */ namespace heidelpayPHP\Resources\PaymentTypes; diff --git a/src/Resources/PaymentTypes/BasePaymentType.php b/src/Resources/PaymentTypes/BasePaymentType.php index d015e743..6b75aa14 100755 --- a/src/Resources/PaymentTypes/BasePaymentType.php +++ b/src/Resources/PaymentTypes/BasePaymentType.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/payment_types + * @package heidelpayPHP\PaymentTypes */ namespace heidelpayPHP\Resources\PaymentTypes; diff --git a/src/Resources/PaymentTypes/Card.php b/src/Resources/PaymentTypes/Card.php index 390fc66b..e903fecc 100755 --- a/src/Resources/PaymentTypes/Card.php +++ b/src/Resources/PaymentTypes/Card.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/payment_types + * @package heidelpayPHP\PaymentTypes */ namespace heidelpayPHP\Resources\PaymentTypes; diff --git a/src/Resources/PaymentTypes/EPS.php b/src/Resources/PaymentTypes/EPS.php index 6fb06f82..9a7fc411 100755 --- a/src/Resources/PaymentTypes/EPS.php +++ b/src/Resources/PaymentTypes/EPS.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/payment_types + * @package heidelpayPHP\PaymentTypes */ namespace heidelpayPHP\Resources\PaymentTypes; diff --git a/src/Resources/PaymentTypes/Giropay.php b/src/Resources/PaymentTypes/Giropay.php index 8163b7fb..860f2311 100755 --- a/src/Resources/PaymentTypes/Giropay.php +++ b/src/Resources/PaymentTypes/Giropay.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/payment_types + * @package heidelpayPHP\PaymentTypes */ namespace heidelpayPHP\Resources\PaymentTypes; diff --git a/src/Resources/PaymentTypes/HirePurchaseDirectDebit.php b/src/Resources/PaymentTypes/HirePurchaseDirectDebit.php index e6de9853..bb462909 100755 --- a/src/Resources/PaymentTypes/HirePurchaseDirectDebit.php +++ b/src/Resources/PaymentTypes/HirePurchaseDirectDebit.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/payment_types + * @package heidelpayPHP\PaymentTypes */ namespace heidelpayPHP\Resources\PaymentTypes; diff --git a/src/Resources/PaymentTypes/Ideal.php b/src/Resources/PaymentTypes/Ideal.php index 5e55388a..14838f56 100755 --- a/src/Resources/PaymentTypes/Ideal.php +++ b/src/Resources/PaymentTypes/Ideal.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/payment_types + * @package heidelpayPHP\PaymentTypes */ namespace heidelpayPHP\Resources\PaymentTypes; diff --git a/src/Resources/PaymentTypes/Invoice.php b/src/Resources/PaymentTypes/Invoice.php index c8624add..432c8d58 100755 --- a/src/Resources/PaymentTypes/Invoice.php +++ b/src/Resources/PaymentTypes/Invoice.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/payment_types + * @package heidelpayPHP\PaymentTypes */ namespace heidelpayPHP\Resources\PaymentTypes; diff --git a/src/Resources/PaymentTypes/InvoiceFactoring.php b/src/Resources/PaymentTypes/InvoiceFactoring.php index 21d1a339..2aff7ac0 100755 --- a/src/Resources/PaymentTypes/InvoiceFactoring.php +++ b/src/Resources/PaymentTypes/InvoiceFactoring.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/payment_types + * @package heidelpayPHP\PaymentTypes */ namespace heidelpayPHP\Resources\PaymentTypes; diff --git a/src/Resources/PaymentTypes/InvoiceGuaranteed.php b/src/Resources/PaymentTypes/InvoiceGuaranteed.php index 80c9f027..71b29a90 100755 --- a/src/Resources/PaymentTypes/InvoiceGuaranteed.php +++ b/src/Resources/PaymentTypes/InvoiceGuaranteed.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/payment_types + * @package heidelpayPHP\PaymentTypes */ namespace heidelpayPHP\Resources\PaymentTypes; diff --git a/src/Resources/PaymentTypes/PIS.php b/src/Resources/PaymentTypes/PIS.php index a825ffc2..523aa55d 100755 --- a/src/Resources/PaymentTypes/PIS.php +++ b/src/Resources/PaymentTypes/PIS.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/payment_types + * @package heidelpayPHP\PaymentTypes */ namespace heidelpayPHP\Resources\PaymentTypes; diff --git a/src/Resources/PaymentTypes/Paypage.php b/src/Resources/PaymentTypes/Paypage.php index a134c8cb..903b104d 100644 --- a/src/Resources/PaymentTypes/Paypage.php +++ b/src/Resources/PaymentTypes/Paypage.php @@ -21,7 +21,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/payment_types + * @package heidelpayPHP\PaymentTypes */ namespace heidelpayPHP\Resources\PaymentTypes; diff --git a/src/Resources/PaymentTypes/Paypal.php b/src/Resources/PaymentTypes/Paypal.php index 59a64a53..aac16aba 100755 --- a/src/Resources/PaymentTypes/Paypal.php +++ b/src/Resources/PaymentTypes/Paypal.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/payment_types + * @package heidelpayPHP\PaymentTypes */ namespace heidelpayPHP\Resources\PaymentTypes; diff --git a/src/Resources/PaymentTypes/Prepayment.php b/src/Resources/PaymentTypes/Prepayment.php index 4bc97b37..bf25159a 100755 --- a/src/Resources/PaymentTypes/Prepayment.php +++ b/src/Resources/PaymentTypes/Prepayment.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/payment_types + * @package heidelpayPHP\PaymentTypes */ namespace heidelpayPHP\Resources\PaymentTypes; diff --git a/src/Resources/PaymentTypes/Przelewy24.php b/src/Resources/PaymentTypes/Przelewy24.php index 4b51a052..0e21a15e 100755 --- a/src/Resources/PaymentTypes/Przelewy24.php +++ b/src/Resources/PaymentTypes/Przelewy24.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/payment_types + * @package heidelpayPHP\PaymentTypes */ namespace heidelpayPHP\Resources\PaymentTypes; diff --git a/src/Resources/PaymentTypes/SepaDirectDebit.php b/src/Resources/PaymentTypes/SepaDirectDebit.php index c724599d..722bff92 100755 --- a/src/Resources/PaymentTypes/SepaDirectDebit.php +++ b/src/Resources/PaymentTypes/SepaDirectDebit.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/payment_types + * @package heidelpayPHP\PaymentTypes */ namespace heidelpayPHP\Resources\PaymentTypes; diff --git a/src/Resources/PaymentTypes/SepaDirectDebitGuaranteed.php b/src/Resources/PaymentTypes/SepaDirectDebitGuaranteed.php index 237381a9..59dc86c7 100755 --- a/src/Resources/PaymentTypes/SepaDirectDebitGuaranteed.php +++ b/src/Resources/PaymentTypes/SepaDirectDebitGuaranteed.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/payment_types + * @package heidelpayPHP\PaymentTypes */ namespace heidelpayPHP\Resources\PaymentTypes; diff --git a/src/Resources/PaymentTypes/Sofort.php b/src/Resources/PaymentTypes/Sofort.php index 35bb6cd6..e2dfb0d6 100755 --- a/src/Resources/PaymentTypes/Sofort.php +++ b/src/Resources/PaymentTypes/Sofort.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/payment_types + * @package heidelpayPHP\PaymentTypes */ namespace heidelpayPHP\Resources\PaymentTypes; diff --git a/src/Resources/PaymentTypes/Wechatpay.php b/src/Resources/PaymentTypes/Wechatpay.php index 8218229e..254b1af2 100755 --- a/src/Resources/PaymentTypes/Wechatpay.php +++ b/src/Resources/PaymentTypes/Wechatpay.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/payment_types + * @package heidelpayPHP\PaymentTypes */ namespace heidelpayPHP\Resources\PaymentTypes; diff --git a/src/Resources/Recurring.php b/src/Resources/Recurring.php index d7ee3afd..1cf285f9 100644 --- a/src/Resources/Recurring.php +++ b/src/Resources/Recurring.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/resources + * @package heidelpayPHP\Resources */ namespace heidelpayPHP\Resources; diff --git a/src/Resources/TransactionTypes/AbstractTransactionType.php b/src/Resources/TransactionTypes/AbstractTransactionType.php index f325f77f..e98528d0 100755 --- a/src/Resources/TransactionTypes/AbstractTransactionType.php +++ b/src/Resources/TransactionTypes/AbstractTransactionType.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/transaction_types + * @package heidelpayPHP\TransactionTypes */ namespace heidelpayPHP\Resources\TransactionTypes; diff --git a/src/Resources/TransactionTypes/Authorization.php b/src/Resources/TransactionTypes/Authorization.php index b556b597..f733b73a 100755 --- a/src/Resources/TransactionTypes/Authorization.php +++ b/src/Resources/TransactionTypes/Authorization.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/transaction_types + * @package heidelpayPHP\TransactionTypes */ namespace heidelpayPHP\Resources\TransactionTypes; diff --git a/src/Resources/TransactionTypes/Cancellation.php b/src/Resources/TransactionTypes/Cancellation.php index 7be096df..2be98e36 100755 --- a/src/Resources/TransactionTypes/Cancellation.php +++ b/src/Resources/TransactionTypes/Cancellation.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/transaction_types + * @package heidelpayPHP\TransactionTypes */ namespace heidelpayPHP\Resources\TransactionTypes; diff --git a/src/Resources/TransactionTypes/Charge.php b/src/Resources/TransactionTypes/Charge.php index 2a59478c..c88389ea 100755 --- a/src/Resources/TransactionTypes/Charge.php +++ b/src/Resources/TransactionTypes/Charge.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/transaction_types + * @package heidelpayPHP\TransactionTypes */ namespace heidelpayPHP\Resources\TransactionTypes; diff --git a/src/Resources/TransactionTypes/Payout.php b/src/Resources/TransactionTypes/Payout.php index 0e138b4d..38f19fa7 100644 --- a/src/Resources/TransactionTypes/Payout.php +++ b/src/Resources/TransactionTypes/Payout.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/transaction_types + * @package heidelpayPHP\TransactionTypes */ namespace heidelpayPHP\Resources\TransactionTypes; diff --git a/src/Resources/TransactionTypes/Shipment.php b/src/Resources/TransactionTypes/Shipment.php index a9fd4d3f..d9d4d195 100755 --- a/src/Resources/TransactionTypes/Shipment.php +++ b/src/Resources/TransactionTypes/Shipment.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/transaction_types + * @package heidelpayPHP\TransactionTypes */ namespace heidelpayPHP\Resources\TransactionTypes; diff --git a/src/Resources/Webhook.php b/src/Resources/Webhook.php index 174f1ea1..320814c0 100755 --- a/src/Resources/Webhook.php +++ b/src/Resources/Webhook.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/resources + * @package heidelpayPHP\Resources */ namespace heidelpayPHP\Resources; diff --git a/src/Resources/Webhooks.php b/src/Resources/Webhooks.php index 735a1e08..336163ae 100755 --- a/src/Resources/Webhooks.php +++ b/src/Resources/Webhooks.php @@ -22,7 +22,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/resources + * @package heidelpayPHP\Resources */ namespace heidelpayPHP\Resources; diff --git a/src/Services/EnvironmentService.php b/src/Services/EnvironmentService.php index 11a4ba16..1d9d7356 100755 --- a/src/Services/EnvironmentService.php +++ b/src/Services/EnvironmentService.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/services + * @package heidelpayPHP\Services */ namespace heidelpayPHP\Services; diff --git a/src/Services/HttpService.php b/src/Services/HttpService.php index 54b3f913..4e4e62be 100755 --- a/src/Services/HttpService.php +++ b/src/Services/HttpService.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/services + * @package heidelpayPHP\Services */ namespace heidelpayPHP\Services; diff --git a/src/Services/IdService.php b/src/Services/IdService.php index 297c0e50..d626d6c7 100755 --- a/src/Services/IdService.php +++ b/src/Services/IdService.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/services + * @package heidelpayPHP\Services */ namespace heidelpayPHP\Services; diff --git a/src/Services/PaymentService.php b/src/Services/PaymentService.php index a11314ba..16d31840 100755 --- a/src/Services/PaymentService.php +++ b/src/Services/PaymentService.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/services + * @package heidelpayPHP\Services */ namespace heidelpayPHP\Services; diff --git a/src/Services/ResourceNameService.php b/src/Services/ResourceNameService.php index 0685e5a1..2d1b8768 100755 --- a/src/Services/ResourceNameService.php +++ b/src/Services/ResourceNameService.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/services + * @package heidelpayPHP\Services */ namespace heidelpayPHP\Services; diff --git a/src/Services/ResourceService.php b/src/Services/ResourceService.php index c91bcbb2..6e7947e2 100755 --- a/src/Services/ResourceService.php +++ b/src/Services/ResourceService.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/services + * @package heidelpayPHP\Services */ namespace heidelpayPHP\Services; diff --git a/src/Services/ValueService.php b/src/Services/ValueService.php index 157564b2..a0c4c9ad 100644 --- a/src/Services/ValueService.php +++ b/src/Services/ValueService.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/Services + * @package heidelpayPHP\Services */ namespace heidelpayPHP\Services; diff --git a/src/Services/WebhookService.php b/src/Services/WebhookService.php index b48957e8..5782d33a 100755 --- a/src/Services/WebhookService.php +++ b/src/Services/WebhookService.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/services + * @package heidelpayPHP\Services */ namespace heidelpayPHP\Services; diff --git a/src/Traits/CanAuthorize.php b/src/Traits/CanAuthorize.php index 159d4847..727ef1ef 100755 --- a/src/Traits/CanAuthorize.php +++ b/src/Traits/CanAuthorize.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/traits + * @package heidelpayPHP\Traits */ namespace heidelpayPHP\Traits; diff --git a/src/Traits/CanAuthorizeWithCustomer.php b/src/Traits/CanAuthorizeWithCustomer.php index 0edb77ff..100e7634 100755 --- a/src/Traits/CanAuthorizeWithCustomer.php +++ b/src/Traits/CanAuthorizeWithCustomer.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/traits + * @package heidelpayPHP\Traits */ namespace heidelpayPHP\Traits; diff --git a/src/Traits/CanDirectCharge.php b/src/Traits/CanDirectCharge.php index 0555e5e5..948b63fe 100755 --- a/src/Traits/CanDirectCharge.php +++ b/src/Traits/CanDirectCharge.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/traits + * @package heidelpayPHP\Traits */ namespace heidelpayPHP\Traits; diff --git a/src/Traits/CanDirectChargeWithCustomer.php b/src/Traits/CanDirectChargeWithCustomer.php index cf3a6ce1..0514647e 100755 --- a/src/Traits/CanDirectChargeWithCustomer.php +++ b/src/Traits/CanDirectChargeWithCustomer.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/traits + * @package heidelpayPHP\Traits */ namespace heidelpayPHP\Traits; diff --git a/src/Traits/CanPayout.php b/src/Traits/CanPayout.php index e393f8ab..bc5f0618 100644 --- a/src/Traits/CanPayout.php +++ b/src/Traits/CanPayout.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/traits + * @package heidelpayPHP\Traits */ namespace heidelpayPHP\Traits; diff --git a/src/Traits/CanPayoutWithCustomer.php b/src/Traits/CanPayoutWithCustomer.php index 27100a87..85e390db 100644 --- a/src/Traits/CanPayoutWithCustomer.php +++ b/src/Traits/CanPayoutWithCustomer.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/traits + * @package heidelpayPHP\Traits */ namespace heidelpayPHP\Traits; diff --git a/src/Traits/CanRecur.php b/src/Traits/CanRecur.php index 44253877..e49f478e 100644 --- a/src/Traits/CanRecur.php +++ b/src/Traits/CanRecur.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/traits + * @package heidelpayPHP\Traits */ namespace heidelpayPHP\Traits; diff --git a/src/Traits/HasCancellations.php b/src/Traits/HasCancellations.php index fb9f2272..eaf6ee4b 100755 --- a/src/Traits/HasCancellations.php +++ b/src/Traits/HasCancellations.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/traits + * @package heidelpayPHP\Traits */ namespace heidelpayPHP\Traits; diff --git a/src/Traits/HasInvoiceId.php b/src/Traits/HasInvoiceId.php index 5dd9f167..5cc10a7a 100755 --- a/src/Traits/HasInvoiceId.php +++ b/src/Traits/HasInvoiceId.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/traits + * @package heidelpayPHP\Traits */ namespace heidelpayPHP\Traits; diff --git a/src/Traits/HasOrderId.php b/src/Traits/HasOrderId.php index ae85d4bb..c2d3d568 100755 --- a/src/Traits/HasOrderId.php +++ b/src/Traits/HasOrderId.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/traits + * @package heidelpayPHP\Traits */ namespace heidelpayPHP\Traits; diff --git a/src/Traits/HasPaymentState.php b/src/Traits/HasPaymentState.php index b45f30e9..18abebc2 100755 --- a/src/Traits/HasPaymentState.php +++ b/src/Traits/HasPaymentState.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/traits + * @package heidelpayPHP\Traits */ namespace heidelpayPHP\Traits; diff --git a/src/Traits/HasStates.php b/src/Traits/HasStates.php index deec7874..50f2b493 100644 --- a/src/Traits/HasStates.php +++ b/src/Traits/HasStates.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/traits + * @package heidelpayPHP\Traits */ namespace heidelpayPHP\Traits; diff --git a/src/Traits/HasUniqueAndShortId.php b/src/Traits/HasUniqueAndShortId.php index 725ade7b..f7956b08 100644 --- a/src/Traits/HasUniqueAndShortId.php +++ b/src/Traits/HasUniqueAndShortId.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/traits + * @package heidelpayPHP\Traits */ namespace heidelpayPHP\Traits; diff --git a/src/Validators/ExpiryDateValidator.php b/src/Validators/ExpiryDateValidator.php index 1a4f6f0c..c9e4d122 100755 --- a/src/Validators/ExpiryDateValidator.php +++ b/src/Validators/ExpiryDateValidator.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/validators + * @package heidelpayPHP\Validators */ namespace heidelpayPHP\Validators; diff --git a/src/Validators/PrivateKeyValidator.php b/src/Validators/PrivateKeyValidator.php index 3d327784..2757b778 100755 --- a/src/Validators/PrivateKeyValidator.php +++ b/src/Validators/PrivateKeyValidator.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/validators + * @package heidelpayPHP\Validators */ namespace heidelpayPHP\Validators; diff --git a/src/Validators/PublicKeyValidator.php b/src/Validators/PublicKeyValidator.php index d22179e8..3b1efde1 100755 --- a/src/Validators/PublicKeyValidator.php +++ b/src/Validators/PublicKeyValidator.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/validators + * @package heidelpayPHP\Validators */ namespace heidelpayPHP\Validators; diff --git a/test/BasePaymentTest.php b/test/BasePaymentTest.php index cdbba5c8..d0cce3dd 100755 --- a/test/BasePaymentTest.php +++ b/test/BasePaymentTest.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/integration + * @package heidelpayPHP\test\integration */ namespace heidelpayPHP\test; diff --git a/test/Fixtures/CustomerFixtureTrait.php b/test/Fixtures/CustomerFixtureTrait.php index 9d2af19b..a16ffaf9 100755 --- a/test/Fixtures/CustomerFixtureTrait.php +++ b/test/Fixtures/CustomerFixtureTrait.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/fixtures + * @package heidelpayPHP\test\Fixtures */ namespace heidelpayPHP\test\Fixtures; diff --git a/test/TestDebugHandler.php b/test/TestDebugHandler.php index 20356ad3..4d6fa1d1 100755 --- a/test/TestDebugHandler.php +++ b/test/TestDebugHandler.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/integration + * @package heidelpayPHP\test\integration */ namespace heidelpayPHP\test; diff --git a/test/bootstrap.php b/test/bootstrap.php index 63e8fb20..b50370bf 100755 --- a/test/bootstrap.php +++ b/test/bootstrap.php @@ -20,6 +20,6 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/tests + * @package heidelpayPHP\tests */ require_once __DIR__ . '/../vendor/autoload.php'; diff --git a/test/integration/BasketTest.php b/test/integration/BasketTest.php index b95c6a7a..6aa49326 100755 --- a/test/integration/BasketTest.php +++ b/test/integration/BasketTest.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/integration + * @package heidelpayPHP\test\integration */ namespace heidelpayPHP\test\integration; diff --git a/test/integration/CustomerTest.php b/test/integration/CustomerTest.php index 336a2072..9b02e08e 100755 --- a/test/integration/CustomerTest.php +++ b/test/integration/CustomerTest.php @@ -21,7 +21,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/integration + * @package heidelpayPHP\test\integration */ namespace heidelpayPHP\test\integration; diff --git a/test/integration/DummyResource.php b/test/integration/DummyResource.php index d35f20ce..1847674f 100644 --- a/test/integration/DummyResource.php +++ b/test/integration/DummyResource.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/integration + * @package heidelpayPHP\test\integration */ namespace heidelpayPHP\test\integration; diff --git a/test/integration/ExceptionTest.php b/test/integration/ExceptionTest.php index d0a80e75..b339c979 100755 --- a/test/integration/ExceptionTest.php +++ b/test/integration/ExceptionTest.php @@ -21,7 +21,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/integration + * @package heidelpayPHP\test\integration */ namespace heidelpayPHP\test\integration; diff --git a/test/integration/KeypairTest.php b/test/integration/KeypairTest.php index f1cdcc8f..82c0464f 100644 --- a/test/integration/KeypairTest.php +++ b/test/integration/KeypairTest.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/integration + * @package heidelpayPHP\test\integration */ namespace heidelpayPHP\test\integration; diff --git a/test/integration/PaymentCancelTest.php b/test/integration/PaymentCancelTest.php index b55b092a..396c186d 100644 --- a/test/integration/PaymentCancelTest.php +++ b/test/integration/PaymentCancelTest.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/integration + * @package heidelpayPHP\test\integration */ namespace heidelpayPHP\test\integration; diff --git a/test/integration/PaymentTest.php b/test/integration/PaymentTest.php index 26296c1b..54aa226e 100755 --- a/test/integration/PaymentTest.php +++ b/test/integration/PaymentTest.php @@ -21,7 +21,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/integration + * @package heidelpayPHP\test\integration */ namespace heidelpayPHP\test\integration; diff --git a/test/integration/PaymentTypes/AlipayTest.php b/test/integration/PaymentTypes/AlipayTest.php index a4257822..e8ec06af 100755 --- a/test/integration/PaymentTypes/AlipayTest.php +++ b/test/integration/PaymentTypes/AlipayTest.php @@ -21,7 +21,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/integration/payment_types + * @package heidelpayPHP\test\integration\PaymentTypes */ namespace heidelpayPHP\test\integration\PaymentTypes; diff --git a/test/integration/PaymentTypes/CardTest.php b/test/integration/PaymentTypes/CardTest.php index 302db300..7cca8555 100755 --- a/test/integration/PaymentTypes/CardTest.php +++ b/test/integration/PaymentTypes/CardTest.php @@ -21,7 +21,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/integration/payment_types + * @package heidelpayPHP\test\integration\PaymentTypes */ namespace heidelpayPHP\test\integration\PaymentTypes; diff --git a/test/integration/PaymentTypes/EPSTest.php b/test/integration/PaymentTypes/EPSTest.php index 28d79162..21846732 100755 --- a/test/integration/PaymentTypes/EPSTest.php +++ b/test/integration/PaymentTypes/EPSTest.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/integration/payment_types + * @package heidelpayPHP\test\integration\PaymentTypes */ namespace heidelpayPHP\test\integration\PaymentTypes; diff --git a/test/integration/PaymentTypes/GiropayTest.php b/test/integration/PaymentTypes/GiropayTest.php index ce28334c..d7b07a1b 100755 --- a/test/integration/PaymentTypes/GiropayTest.php +++ b/test/integration/PaymentTypes/GiropayTest.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/integration/payment_types + * @package heidelpayPHP\test\integration\PaymentTypes */ namespace heidelpayPHP\test\integration\PaymentTypes; diff --git a/test/integration/PaymentTypes/HirePurchaseDirectDebitTest.php b/test/integration/PaymentTypes/HirePurchaseDirectDebitTest.php index 4e7dad27..085e0197 100755 --- a/test/integration/PaymentTypes/HirePurchaseDirectDebitTest.php +++ b/test/integration/PaymentTypes/HirePurchaseDirectDebitTest.php @@ -21,7 +21,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/integration/payment_types + * @package heidelpayPHP\test\integration\PaymentTypes */ namespace heidelpayPHP\test\integration\PaymentTypes; diff --git a/test/integration/PaymentTypes/IdealTest.php b/test/integration/PaymentTypes/IdealTest.php index 34230362..f77efa6e 100755 --- a/test/integration/PaymentTypes/IdealTest.php +++ b/test/integration/PaymentTypes/IdealTest.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/integration/payment_types + * @package heidelpayPHP\test\integration\PaymentTypes */ namespace heidelpayPHP\test\integration\PaymentTypes; diff --git a/test/integration/PaymentTypes/InvoiceFactoringTest.php b/test/integration/PaymentTypes/InvoiceFactoringTest.php index c5ae9e85..695cd32f 100755 --- a/test/integration/PaymentTypes/InvoiceFactoringTest.php +++ b/test/integration/PaymentTypes/InvoiceFactoringTest.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/integration/payment_types + * @package heidelpayPHP\test\integration\PaymentTypes */ namespace heidelpayPHP\test\integration\PaymentTypes; diff --git a/test/integration/PaymentTypes/InvoiceGuaranteedTest.php b/test/integration/PaymentTypes/InvoiceGuaranteedTest.php index 08575fff..90981c6d 100755 --- a/test/integration/PaymentTypes/InvoiceGuaranteedTest.php +++ b/test/integration/PaymentTypes/InvoiceGuaranteedTest.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/integration/payment_types + * @package heidelpayPHP\test\integration\PaymentTypes */ namespace heidelpayPHP\test\integration\PaymentTypes; diff --git a/test/integration/PaymentTypes/InvoiceTest.php b/test/integration/PaymentTypes/InvoiceTest.php index 770b6080..549a9354 100755 --- a/test/integration/PaymentTypes/InvoiceTest.php +++ b/test/integration/PaymentTypes/InvoiceTest.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/integration/payment_types + * @package heidelpayPHP\test\integration\PaymentTypes */ namespace heidelpayPHP\test\integration\PaymentTypes; diff --git a/test/integration/PaymentTypes/PISTest.php b/test/integration/PaymentTypes/PISTest.php index 742cdaa5..d938646e 100755 --- a/test/integration/PaymentTypes/PISTest.php +++ b/test/integration/PaymentTypes/PISTest.php @@ -21,7 +21,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/tests/integration/payment_types + * @package heidelpayPHP\tests/integration/payment_types */ namespace heidelpayPHP\test\integration\PaymentTypes; diff --git a/test/integration/PaymentTypes/PaypageTest.php b/test/integration/PaymentTypes/PaypageTest.php index 07a610cd..5ed266d3 100644 --- a/test/integration/PaymentTypes/PaypageTest.php +++ b/test/integration/PaymentTypes/PaypageTest.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/integration/payment_types + * @package heidelpayPHP\test\integration\PaymentTypes */ namespace heidelpayPHP\test\integration\PaymentTypes; diff --git a/test/integration/PaymentTypes/PaypalTest.php b/test/integration/PaymentTypes/PaypalTest.php index 4d83cc5f..9a87880d 100755 --- a/test/integration/PaymentTypes/PaypalTest.php +++ b/test/integration/PaymentTypes/PaypalTest.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/integration/payment_types + * @package heidelpayPHP\test\integration\PaymentTypes */ namespace heidelpayPHP\test\integration\PaymentTypes; diff --git a/test/integration/PaymentTypes/PrepaymentTest.php b/test/integration/PaymentTypes/PrepaymentTest.php index 04ce3d02..1dbc257d 100755 --- a/test/integration/PaymentTypes/PrepaymentTest.php +++ b/test/integration/PaymentTypes/PrepaymentTest.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/integration/payment_types + * @package heidelpayPHP\test\integration\PaymentTypes */ namespace heidelpayPHP\test\integration\PaymentTypes; diff --git a/test/integration/PaymentTypes/Przelewy24Test.php b/test/integration/PaymentTypes/Przelewy24Test.php index 227a7ec6..12b5cd4e 100755 --- a/test/integration/PaymentTypes/Przelewy24Test.php +++ b/test/integration/PaymentTypes/Przelewy24Test.php @@ -21,7 +21,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/integration/payment_types + * @package heidelpayPHP\test\integration\PaymentTypes */ namespace heidelpayPHP\test\integration\PaymentTypes; diff --git a/test/integration/PaymentTypes/SepaDirectDebitGuaranteedTest.php b/test/integration/PaymentTypes/SepaDirectDebitGuaranteedTest.php index 214f2319..3a1720fd 100755 --- a/test/integration/PaymentTypes/SepaDirectDebitGuaranteedTest.php +++ b/test/integration/PaymentTypes/SepaDirectDebitGuaranteedTest.php @@ -21,7 +21,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/integration/payment_types + * @package heidelpayPHP\test\integration\PaymentTypes */ namespace heidelpayPHP\test\integration\PaymentTypes; diff --git a/test/integration/PaymentTypes/SepaDirectDebitTest.php b/test/integration/PaymentTypes/SepaDirectDebitTest.php index c7eeed97..f1f98116 100755 --- a/test/integration/PaymentTypes/SepaDirectDebitTest.php +++ b/test/integration/PaymentTypes/SepaDirectDebitTest.php @@ -21,7 +21,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/integration/payment_types + * @package heidelpayPHP\test\integration\PaymentTypes */ namespace heidelpayPHP\test\integration\PaymentTypes; diff --git a/test/integration/PaymentTypes/SofortTest.php b/test/integration/PaymentTypes/SofortTest.php index cba435d5..24eff66c 100755 --- a/test/integration/PaymentTypes/SofortTest.php +++ b/test/integration/PaymentTypes/SofortTest.php @@ -21,7 +21,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/integration/payment_types + * @package heidelpayPHP\test\integration\PaymentTypes */ namespace heidelpayPHP\test\integration\PaymentTypes; diff --git a/test/integration/PaymentTypes/WechatpayTest.php b/test/integration/PaymentTypes/WechatpayTest.php index 4c01927b..8b547a02 100755 --- a/test/integration/PaymentTypes/WechatpayTest.php +++ b/test/integration/PaymentTypes/WechatpayTest.php @@ -21,7 +21,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/integration/payment_types + * @package heidelpayPHP\test\integration\PaymentTypes */ namespace heidelpayPHP\test\integration\PaymentTypes; diff --git a/test/integration/RecurringPaymentTest.php b/test/integration/RecurringPaymentTest.php index e48e3188..bdff798e 100644 --- a/test/integration/RecurringPaymentTest.php +++ b/test/integration/RecurringPaymentTest.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/integration + * @package heidelpayPHP\test\integration */ namespace heidelpayPHP\test\integration; diff --git a/test/integration/SetMetadataTest.php b/test/integration/SetMetadataTest.php index 29a5093d..f11b5cbb 100755 --- a/test/integration/SetMetadataTest.php +++ b/test/integration/SetMetadataTest.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/tests/integration + * @package heidelpayPHP\tests/integration */ namespace heidelpayPHP\test\integration; diff --git a/test/integration/TransactionTypes/AuthorizationTest.php b/test/integration/TransactionTypes/AuthorizationTest.php index 8bb29a19..d1a52e14 100644 --- a/test/integration/TransactionTypes/AuthorizationTest.php +++ b/test/integration/TransactionTypes/AuthorizationTest.php @@ -21,7 +21,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/integration/transaction_types + * @package heidelpayPHP\test\integration\TransactionTypes */ namespace heidelpayPHP\test\integration\TransactionTypes; diff --git a/test/integration/TransactionTypes/CancelAfterAuthorizationTest.php b/test/integration/TransactionTypes/CancelAfterAuthorizationTest.php index 104bcaf5..551d57dc 100644 --- a/test/integration/TransactionTypes/CancelAfterAuthorizationTest.php +++ b/test/integration/TransactionTypes/CancelAfterAuthorizationTest.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/integration/transaction_types + * @package heidelpayPHP\test\integration\TransactionTypes */ namespace heidelpayPHP\test\integration\TransactionTypes; diff --git a/test/integration/TransactionTypes/CancelAfterChargeTest.php b/test/integration/TransactionTypes/CancelAfterChargeTest.php index 1bfd1d40..917919b2 100644 --- a/test/integration/TransactionTypes/CancelAfterChargeTest.php +++ b/test/integration/TransactionTypes/CancelAfterChargeTest.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/integration/transaction_types + * @package heidelpayPHP\test\integration\TransactionTypes */ namespace heidelpayPHP\test\integration\TransactionTypes; diff --git a/test/integration/TransactionTypes/CancelTest.php b/test/integration/TransactionTypes/CancelTest.php index 0e770269..19ecf864 100644 --- a/test/integration/TransactionTypes/CancelTest.php +++ b/test/integration/TransactionTypes/CancelTest.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/integration/transaction_types + * @package heidelpayPHP\test\integration\TransactionTypes */ namespace heidelpayPHP\test\integration\TransactionTypes; diff --git a/test/integration/TransactionTypes/ChargeAfterAuthorizationTest.php b/test/integration/TransactionTypes/ChargeAfterAuthorizationTest.php index b59d057b..ed6e7123 100644 --- a/test/integration/TransactionTypes/ChargeAfterAuthorizationTest.php +++ b/test/integration/TransactionTypes/ChargeAfterAuthorizationTest.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/integration/transaction_types + * @package heidelpayPHP\test\integration\TransactionTypes */ namespace heidelpayPHP\test\integration\TransactionTypes; diff --git a/test/integration/TransactionTypes/ChargeTest.php b/test/integration/TransactionTypes/ChargeTest.php index 87aab679..89fc71fc 100644 --- a/test/integration/TransactionTypes/ChargeTest.php +++ b/test/integration/TransactionTypes/ChargeTest.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/integration/transaction_types + * @package heidelpayPHP\test\integration\TransactionTypes */ namespace heidelpayPHP\test\integration\TransactionTypes; diff --git a/test/integration/TransactionTypes/PayoutTest.php b/test/integration/TransactionTypes/PayoutTest.php index 2e42940c..c31aff18 100644 --- a/test/integration/TransactionTypes/PayoutTest.php +++ b/test/integration/TransactionTypes/PayoutTest.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/integration/transaction_types + * @package heidelpayPHP\test\integration\TransactionTypes */ namespace heidelpayPHP\test\integration\TransactionTypes; diff --git a/test/integration/TransactionTypes/ShipmentTest.php b/test/integration/TransactionTypes/ShipmentTest.php index 8292ea8e..6218cadd 100644 --- a/test/integration/TransactionTypes/ShipmentTest.php +++ b/test/integration/TransactionTypes/ShipmentTest.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/integration/transaction_types + * @package heidelpayPHP\test\integration\TransactionTypes */ namespace heidelpayPHP\test\integration\TransactionTypes; diff --git a/test/integration/WebhookTest.php b/test/integration/WebhookTest.php index cc8629ee..0b9bf727 100755 --- a/test/integration/WebhookTest.php +++ b/test/integration/WebhookTest.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/integration + * @package heidelpayPHP\test\integration */ namespace heidelpayPHP\test\integration; diff --git a/test/unit/Constants/PaymentStateTest.php b/test/unit/Constants/PaymentStateTest.php index ef41b22d..01f0c511 100755 --- a/test/unit/Constants/PaymentStateTest.php +++ b/test/unit/Constants/PaymentStateTest.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/unit + * @package heidelpayPHP\test\unit */ namespace heidelpayPHP\test\unit\Constants; diff --git a/test/unit/DummyResource.php b/test/unit/DummyResource.php index 03017387..e1e4d9e6 100755 --- a/test/unit/DummyResource.php +++ b/test/unit/DummyResource.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/unit + * @package heidelpayPHP\test\unit */ namespace heidelpayPHP\test\unit; diff --git a/test/unit/Exceptions/HeidelpayApiExceptionTest.php b/test/unit/Exceptions/HeidelpayApiExceptionTest.php index 878187d4..0e940683 100755 --- a/test/unit/Exceptions/HeidelpayApiExceptionTest.php +++ b/test/unit/Exceptions/HeidelpayApiExceptionTest.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/unit + * @package heidelpayPHP\test\unit */ namespace heidelpayPHP\test\unit\Exceptions; diff --git a/test/unit/HeidelpayTest.php b/test/unit/HeidelpayTest.php index 48dbced2..46c6ad04 100755 --- a/test/unit/HeidelpayTest.php +++ b/test/unit/HeidelpayTest.php @@ -21,7 +21,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/unit + * @package heidelpayPHP\test\unit */ namespace heidelpayPHP\test\unit; diff --git a/test/unit/Resources/AbstractHeidelpayResourceTest.php b/test/unit/Resources/AbstractHeidelpayResourceTest.php index 4fece867..58594fd2 100755 --- a/test/unit/Resources/AbstractHeidelpayResourceTest.php +++ b/test/unit/Resources/AbstractHeidelpayResourceTest.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/unit + * @package heidelpayPHP\test\unit */ namespace heidelpayPHP\test\unit\Resources; diff --git a/test/unit/Resources/BasketTest.php b/test/unit/Resources/BasketTest.php index b65fa7dd..0e87be63 100755 --- a/test/unit/Resources/BasketTest.php +++ b/test/unit/Resources/BasketTest.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/unit + * @package heidelpayPHP\test\unit */ namespace heidelpayPHP\test\unit\Resources; diff --git a/test/unit/Resources/CustomerFactoryTest.php b/test/unit/Resources/CustomerFactoryTest.php index 9523ff5c..d8fb57ee 100644 --- a/test/unit/Resources/CustomerFactoryTest.php +++ b/test/unit/Resources/CustomerFactoryTest.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/unit + * @package heidelpayPHP\test\unit */ namespace heidelpayPHP\test\unit\Resources; diff --git a/test/unit/Resources/CustomerTest.php b/test/unit/Resources/CustomerTest.php index ee8aa7f5..ddfc7c4c 100755 --- a/test/unit/Resources/CustomerTest.php +++ b/test/unit/Resources/CustomerTest.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/unit + * @package heidelpayPHP\test\unit */ namespace heidelpayPHP\test\unit\Resources; diff --git a/test/unit/Resources/DummyHeidelpayResource.php b/test/unit/Resources/DummyHeidelpayResource.php index a8125574..128a6d04 100755 --- a/test/unit/Resources/DummyHeidelpayResource.php +++ b/test/unit/Resources/DummyHeidelpayResource.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/unit + * @package heidelpayPHP\test\unit */ namespace heidelpayPHP\test\unit\Resources; diff --git a/test/unit/Resources/EmbeddedResources/AmountTest.php b/test/unit/Resources/EmbeddedResources/AmountTest.php index 047244a6..2b94e4e1 100755 --- a/test/unit/Resources/EmbeddedResources/AmountTest.php +++ b/test/unit/Resources/EmbeddedResources/AmountTest.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/unit + * @package heidelpayPHP\test\unit */ namespace heidelpayPHP\test\unit\Resources; diff --git a/test/unit/Resources/EmbeddedResources/BasketItemTest.php b/test/unit/Resources/EmbeddedResources/BasketItemTest.php index 66bc68e3..34907e6e 100755 --- a/test/unit/Resources/EmbeddedResources/BasketItemTest.php +++ b/test/unit/Resources/EmbeddedResources/BasketItemTest.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/unit + * @package heidelpayPHP\test\unit */ namespace heidelpayPHP\test\unit\Resources; diff --git a/test/unit/Resources/EmbeddedResources/GeoLocationTest.php b/test/unit/Resources/EmbeddedResources/GeoLocationTest.php index 89c97467..91c56622 100644 --- a/test/unit/Resources/EmbeddedResources/GeoLocationTest.php +++ b/test/unit/Resources/EmbeddedResources/GeoLocationTest.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/unit + * @package heidelpayPHP\test\unit */ namespace heidelpayPHP\test\unit\Resources; diff --git a/test/unit/Resources/InstalmentPlanTest.php b/test/unit/Resources/InstalmentPlanTest.php index c5e15b42..9b093cef 100644 --- a/test/unit/Resources/InstalmentPlanTest.php +++ b/test/unit/Resources/InstalmentPlanTest.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/unit + * @package heidelpayPHP\test\unit */ namespace heidelpayPHP\test\unit\Resources; diff --git a/test/unit/Resources/KeypairTest.php b/test/unit/Resources/KeypairTest.php index b94ff1fe..e81f62b6 100755 --- a/test/unit/Resources/KeypairTest.php +++ b/test/unit/Resources/KeypairTest.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/unit + * @package heidelpayPHP\test\unit */ namespace heidelpayPHP\test\unit\Resources; diff --git a/test/unit/Resources/MetadataTest.php b/test/unit/Resources/MetadataTest.php index 1f4ad1c0..f6c0c6e2 100755 --- a/test/unit/Resources/MetadataTest.php +++ b/test/unit/Resources/MetadataTest.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/unit + * @package heidelpayPHP\test\unit */ namespace heidelpayPHP\test\integration; diff --git a/test/unit/Resources/PaymentCancelTest.php b/test/unit/Resources/PaymentCancelTest.php index bb17815a..e7be6e71 100644 --- a/test/unit/Resources/PaymentCancelTest.php +++ b/test/unit/Resources/PaymentCancelTest.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/unit + * @package heidelpayPHP\test\unit */ namespace heidelpayPHP\test\unit\Resources; diff --git a/test/unit/Resources/PaymentTest.php b/test/unit/Resources/PaymentTest.php index 2b97db1c..b8749845 100755 --- a/test/unit/Resources/PaymentTest.php +++ b/test/unit/Resources/PaymentTest.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/unit + * @package heidelpayPHP\test\unit */ namespace heidelpayPHP\test\unit\Resources; diff --git a/test/unit/Resources/PaymentTypes/CardTest.php b/test/unit/Resources/PaymentTypes/CardTest.php index 1e8369f3..ab419c6b 100755 --- a/test/unit/Resources/PaymentTypes/CardTest.php +++ b/test/unit/Resources/PaymentTypes/CardTest.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/unit + * @package heidelpayPHP\test\unit */ namespace heidelpayPHP\test\unit\Resources\PaymentTypes; diff --git a/test/unit/Resources/PaymentTypes/EPSTest.php b/test/unit/Resources/PaymentTypes/EPSTest.php index 10535293..482ae1e7 100755 --- a/test/unit/Resources/PaymentTypes/EPSTest.php +++ b/test/unit/Resources/PaymentTypes/EPSTest.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/unit + * @package heidelpayPHP\test\unit */ namespace heidelpayPHP\test\unit\Resources\PaymentTypes; diff --git a/test/unit/Resources/PaymentTypes/HirePurchaseDirectDebitTest.php b/test/unit/Resources/PaymentTypes/HirePurchaseDirectDebitTest.php index bf36d1ad..c75a9279 100644 --- a/test/unit/Resources/PaymentTypes/HirePurchaseDirectDebitTest.php +++ b/test/unit/Resources/PaymentTypes/HirePurchaseDirectDebitTest.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/unit + * @package heidelpayPHP\test\unit */ namespace heidelpayPHP\test\unit\Resources\PaymentTypes; diff --git a/test/unit/Resources/PaymentTypes/IdealTest.php b/test/unit/Resources/PaymentTypes/IdealTest.php index ebb38275..45da68e5 100755 --- a/test/unit/Resources/PaymentTypes/IdealTest.php +++ b/test/unit/Resources/PaymentTypes/IdealTest.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/unit + * @package heidelpayPHP\test\unit */ namespace heidelpayPHP\test\unit\Resources\PaymentTypes; diff --git a/test/unit/Resources/PaymentTypes/PayPageTest.php b/test/unit/Resources/PaymentTypes/PayPageTest.php index e7c6a85d..73bef1ea 100644 --- a/test/unit/Resources/PaymentTypes/PayPageTest.php +++ b/test/unit/Resources/PaymentTypes/PayPageTest.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/unit + * @package heidelpayPHP\test\unit */ namespace heidelpayPHP\test\unit\Resources\PaymentTypes; diff --git a/test/unit/Resources/PaymentTypes/PayPalTest.php b/test/unit/Resources/PaymentTypes/PayPalTest.php index 65e6acb4..2a8bb840 100644 --- a/test/unit/Resources/PaymentTypes/PayPalTest.php +++ b/test/unit/Resources/PaymentTypes/PayPalTest.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/unit + * @package heidelpayPHP\test\unit */ namespace heidelpayPHP\test\unit\Resources\PaymentTypes; diff --git a/test/unit/Resources/PaymentTypes/SepaDirectDebitGuaranteedTest.php b/test/unit/Resources/PaymentTypes/SepaDirectDebitGuaranteedTest.php index 330432ef..45761927 100755 --- a/test/unit/Resources/PaymentTypes/SepaDirectDebitGuaranteedTest.php +++ b/test/unit/Resources/PaymentTypes/SepaDirectDebitGuaranteedTest.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/unit + * @package heidelpayPHP\test\unit */ namespace heidelpayPHP\test\unit\Resources\PaymentTypes; diff --git a/test/unit/Resources/PaymentTypes/SepaDirectDebitTest.php b/test/unit/Resources/PaymentTypes/SepaDirectDebitTest.php index 474254b1..13ba8516 100755 --- a/test/unit/Resources/PaymentTypes/SepaDirectDebitTest.php +++ b/test/unit/Resources/PaymentTypes/SepaDirectDebitTest.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/unit + * @package heidelpayPHP\test\unit */ namespace heidelpayPHP\test\unit\Resources\PaymentTypes; diff --git a/test/unit/Resources/RecurringTest.php b/test/unit/Resources/RecurringTest.php index c139f971..dcc920fb 100644 --- a/test/unit/Resources/RecurringTest.php +++ b/test/unit/Resources/RecurringTest.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/unit + * @package heidelpayPHP\test\unit */ namespace heidelpayPHP\test\unit\Resources; diff --git a/test/unit/Resources/TransactionTypes/AbstractTransactionTypeTest.php b/test/unit/Resources/TransactionTypes/AbstractTransactionTypeTest.php index 966f9e8f..5aa51f9d 100755 --- a/test/unit/Resources/TransactionTypes/AbstractTransactionTypeTest.php +++ b/test/unit/Resources/TransactionTypes/AbstractTransactionTypeTest.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/unit + * @package heidelpayPHP\test\unit */ namespace heidelpayPHP\test\unit\Resources\TransactionTypes; diff --git a/test/unit/Resources/TransactionTypes/AuthorizationTest.php b/test/unit/Resources/TransactionTypes/AuthorizationTest.php index 1d9ba7dc..8f75f05e 100755 --- a/test/unit/Resources/TransactionTypes/AuthorizationTest.php +++ b/test/unit/Resources/TransactionTypes/AuthorizationTest.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/unit + * @package heidelpayPHP\test\unit */ namespace heidelpayPHP\test\unit\Resources\TransactionTypes; diff --git a/test/unit/Resources/TransactionTypes/CancellationTest.php b/test/unit/Resources/TransactionTypes/CancellationTest.php index 936d6d08..ce462e89 100755 --- a/test/unit/Resources/TransactionTypes/CancellationTest.php +++ b/test/unit/Resources/TransactionTypes/CancellationTest.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/unit + * @package heidelpayPHP\test\unit */ namespace heidelpayPHP\test\unit\Resources\TransactionTypes; diff --git a/test/unit/Resources/TransactionTypes/ChargeTest.php b/test/unit/Resources/TransactionTypes/ChargeTest.php index ecb010e8..6e542d74 100755 --- a/test/unit/Resources/TransactionTypes/ChargeTest.php +++ b/test/unit/Resources/TransactionTypes/ChargeTest.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/unit + * @package heidelpayPHP\test\unit */ namespace heidelpayPHP\test\unit\Resources\TransactionTypes; diff --git a/test/unit/Resources/TransactionTypes/DummyTransactionType.php b/test/unit/Resources/TransactionTypes/DummyTransactionType.php index 9d730004..5a075d7d 100755 --- a/test/unit/Resources/TransactionTypes/DummyTransactionType.php +++ b/test/unit/Resources/TransactionTypes/DummyTransactionType.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/unit + * @package heidelpayPHP\test\unit */ namespace heidelpayPHP\test\unit\Resources\TransactionTypes; diff --git a/test/unit/Resources/TransactionTypes/PayoutTest.php b/test/unit/Resources/TransactionTypes/PayoutTest.php index c144c785..2b6a6865 100644 --- a/test/unit/Resources/TransactionTypes/PayoutTest.php +++ b/test/unit/Resources/TransactionTypes/PayoutTest.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/unit + * @package heidelpayPHP\test\unit */ namespace heidelpayPHP\test\unit\Resources\TransactionTypes; diff --git a/test/unit/Resources/TransactionTypes/ShipmentTest.php b/test/unit/Resources/TransactionTypes/ShipmentTest.php index e57df68c..635bec45 100755 --- a/test/unit/Resources/TransactionTypes/ShipmentTest.php +++ b/test/unit/Resources/TransactionTypes/ShipmentTest.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/unit + * @package heidelpayPHP\test\unit */ namespace heidelpayPHP\test\unit\Resources\TransactionTypes; diff --git a/test/unit/Resources/WebhookTest.php b/test/unit/Resources/WebhookTest.php index fadb09ea..805b6236 100755 --- a/test/unit/Resources/WebhookTest.php +++ b/test/unit/Resources/WebhookTest.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/unit + * @package heidelpayPHP\test\unit */ namespace heidelpayPHP\test\unit\Resources; diff --git a/test/unit/Resources/WebhooksTest.php b/test/unit/Resources/WebhooksTest.php index 3efe5f60..0c1d8623 100755 --- a/test/unit/Resources/WebhooksTest.php +++ b/test/unit/Resources/WebhooksTest.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/unit + * @package heidelpayPHP\test\unit */ namespace heidelpayPHP\test\unit\Resources; diff --git a/test/unit/Services/DummyAdapter.php b/test/unit/Services/DummyAdapter.php index 0f84bd76..3762808e 100755 --- a/test/unit/Services/DummyAdapter.php +++ b/test/unit/Services/DummyAdapter.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/unit + * @package heidelpayPHP\test\unit */ namespace heidelpayPHP\test\unit\Services; diff --git a/test/unit/Services/DummyDebugHandler.php b/test/unit/Services/DummyDebugHandler.php index d51cbaa0..48435e7c 100755 --- a/test/unit/Services/DummyDebugHandler.php +++ b/test/unit/Services/DummyDebugHandler.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/unit + * @package heidelpayPHP\test\unit */ namespace heidelpayPHP\test\unit\Services; diff --git a/test/unit/Services/HttpServiceTest.php b/test/unit/Services/HttpServiceTest.php index 591e00a6..3fca4b28 100755 --- a/test/unit/Services/HttpServiceTest.php +++ b/test/unit/Services/HttpServiceTest.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/unit + * @package heidelpayPHP\test\unit */ namespace heidelpayPHP\test\unit; diff --git a/test/unit/Services/PaymentServiceTest.php b/test/unit/Services/PaymentServiceTest.php index 9064c8bf..3dcd4310 100755 --- a/test/unit/Services/PaymentServiceTest.php +++ b/test/unit/Services/PaymentServiceTest.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/unit + * @package heidelpayPHP\test\unit */ namespace heidelpayPHP\test\unit\Services; diff --git a/test/unit/Services/ResourceNameServiceTest.php b/test/unit/Services/ResourceNameServiceTest.php index 8d849ced..06546b55 100755 --- a/test/unit/Services/ResourceNameServiceTest.php +++ b/test/unit/Services/ResourceNameServiceTest.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/unit + * @package heidelpayPHP\test\unit */ namespace heidelpayPHP\test\unit; diff --git a/test/unit/Services/ResourceServiceTest.php b/test/unit/Services/ResourceServiceTest.php index f03457ff..1bb465df 100755 --- a/test/unit/Services/ResourceServiceTest.php +++ b/test/unit/Services/ResourceServiceTest.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/unit + * @package heidelpayPHP\test\unit */ namespace heidelpayPHP\test\unit\Services; diff --git a/test/unit/Services/WebhooksServiceTest.php b/test/unit/Services/WebhooksServiceTest.php index 909e163e..67e0b9a3 100755 --- a/test/unit/Services/WebhooksServiceTest.php +++ b/test/unit/Services/WebhooksServiceTest.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/unit + * @package heidelpayPHP\test\unit */ namespace heidelpayPHP\test\unit\Services; diff --git a/test/unit/Traits/CanAuthorizeTest.php b/test/unit/Traits/CanAuthorizeTest.php index 21683741..e0f504d0 100755 --- a/test/unit/Traits/CanAuthorizeTest.php +++ b/test/unit/Traits/CanAuthorizeTest.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/unit + * @package heidelpayPHP\test\unit */ namespace heidelpayPHP\test\unit\Traits; diff --git a/test/unit/Traits/CanAuthorizeWithCustomerTest.php b/test/unit/Traits/CanAuthorizeWithCustomerTest.php index afc6dfd5..29f9073c 100755 --- a/test/unit/Traits/CanAuthorizeWithCustomerTest.php +++ b/test/unit/Traits/CanAuthorizeWithCustomerTest.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/unit + * @package heidelpayPHP\test\unit */ namespace heidelpayPHP\test\unit\Traits; diff --git a/test/unit/Traits/CanDirectChargeTest.php b/test/unit/Traits/CanDirectChargeTest.php index bb3d456b..32a2faae 100755 --- a/test/unit/Traits/CanDirectChargeTest.php +++ b/test/unit/Traits/CanDirectChargeTest.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/unit + * @package heidelpayPHP\test\unit */ namespace heidelpayPHP\test\unit\Traits; diff --git a/test/unit/Traits/CanDirectChargeWithCustomerTest.php b/test/unit/Traits/CanDirectChargeWithCustomerTest.php index 2780c088..f21c8963 100755 --- a/test/unit/Traits/CanDirectChargeWithCustomerTest.php +++ b/test/unit/Traits/CanDirectChargeWithCustomerTest.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/unit + * @package heidelpayPHP\test\unit */ namespace heidelpayPHP\test\unit\Traits; diff --git a/test/unit/Traits/CanPayoutTest.php b/test/unit/Traits/CanPayoutTest.php index 287d8166..2d6b6af2 100644 --- a/test/unit/Traits/CanPayoutTest.php +++ b/test/unit/Traits/CanPayoutTest.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/unit + * @package heidelpayPHP\test\unit */ namespace heidelpayPHP\test\unit\Traits; diff --git a/test/unit/Traits/CanPayoutWithCustomerTest.php b/test/unit/Traits/CanPayoutWithCustomerTest.php index a82efc22..6b28d34e 100644 --- a/test/unit/Traits/CanPayoutWithCustomerTest.php +++ b/test/unit/Traits/CanPayoutWithCustomerTest.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/unit + * @package heidelpayPHP\test\unit */ namespace heidelpayPHP\test\unit\Traits; diff --git a/test/unit/Traits/CanRecurTest.php b/test/unit/Traits/CanRecurTest.php index 5ece9d5f..49198971 100644 --- a/test/unit/Traits/CanRecurTest.php +++ b/test/unit/Traits/CanRecurTest.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/unit + * @package heidelpayPHP\test\unit */ namespace heidelpayPHP\test\unit\Traits; diff --git a/test/unit/Traits/HasCancellationsTest.php b/test/unit/Traits/HasCancellationsTest.php index d4813665..07fff25b 100755 --- a/test/unit/Traits/HasCancellationsTest.php +++ b/test/unit/Traits/HasCancellationsTest.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/unit + * @package heidelpayPHP\test\unit */ namespace heidelpayPHP\test\unit\Traits; diff --git a/test/unit/Traits/HasInvoiceIdTest.php b/test/unit/Traits/HasInvoiceIdTest.php index 580a0c87..180628fa 100755 --- a/test/unit/Traits/HasInvoiceIdTest.php +++ b/test/unit/Traits/HasInvoiceIdTest.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/unit + * @package heidelpayPHP\test\unit */ namespace heidelpayPHP\test\unit\Traits; diff --git a/test/unit/Traits/HasPaymentStateTest.php b/test/unit/Traits/HasPaymentStateTest.php index 3c68907e..9b0a6b83 100755 --- a/test/unit/Traits/HasPaymentStateTest.php +++ b/test/unit/Traits/HasPaymentStateTest.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/unit + * @package heidelpayPHP\test\unit */ namespace heidelpayPHP\test\unit\Traits; diff --git a/test/unit/Traits/TraitDummyCanRecur.php b/test/unit/Traits/TraitDummyCanRecur.php index 0c742d7a..c607da43 100644 --- a/test/unit/Traits/TraitDummyCanRecur.php +++ b/test/unit/Traits/TraitDummyCanRecur.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/unit + * @package heidelpayPHP\test\unit */ namespace heidelpayPHP\test\unit\Traits; diff --git a/test/unit/Traits/TraitDummyCanRecurNonResource.php b/test/unit/Traits/TraitDummyCanRecurNonResource.php index 7d05b6bc..ec8e7be8 100644 --- a/test/unit/Traits/TraitDummyCanRecurNonResource.php +++ b/test/unit/Traits/TraitDummyCanRecurNonResource.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/unit + * @package heidelpayPHP\test\unit */ namespace heidelpayPHP\test\unit\Traits; diff --git a/test/unit/Traits/TraitDummyHasCancellationsHasPaymentState.php b/test/unit/Traits/TraitDummyHasCancellationsHasPaymentState.php index b7b9d185..92d6cbbe 100755 --- a/test/unit/Traits/TraitDummyHasCancellationsHasPaymentState.php +++ b/test/unit/Traits/TraitDummyHasCancellationsHasPaymentState.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/unit + * @package heidelpayPHP\test\unit */ namespace heidelpayPHP\test\unit\Traits; diff --git a/test/unit/Traits/TraitDummyHasInvoiceId.php b/test/unit/Traits/TraitDummyHasInvoiceId.php index d78568eb..588a467e 100755 --- a/test/unit/Traits/TraitDummyHasInvoiceId.php +++ b/test/unit/Traits/TraitDummyHasInvoiceId.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/unit + * @package heidelpayPHP\test\unit */ namespace heidelpayPHP\test\unit\Traits; diff --git a/test/unit/Traits/TraitDummyWithCustomerWithParentIF.php b/test/unit/Traits/TraitDummyWithCustomerWithParentIF.php index a15cc61b..e1093d10 100755 --- a/test/unit/Traits/TraitDummyWithCustomerWithParentIF.php +++ b/test/unit/Traits/TraitDummyWithCustomerWithParentIF.php @@ -21,7 +21,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/unit + * @package heidelpayPHP\test\unit */ namespace heidelpayPHP\test\unit\Traits; diff --git a/test/unit/Traits/TraitDummyWithCustomerWithoutParentIF.php b/test/unit/Traits/TraitDummyWithCustomerWithoutParentIF.php index 7ef7860a..a96e6b2e 100755 --- a/test/unit/Traits/TraitDummyWithCustomerWithoutParentIF.php +++ b/test/unit/Traits/TraitDummyWithCustomerWithoutParentIF.php @@ -21,7 +21,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/unit + * @package heidelpayPHP\test\unit */ namespace heidelpayPHP\test\unit\Traits; diff --git a/test/unit/Traits/TraitDummyWithoutCustomerWithParentIF.php b/test/unit/Traits/TraitDummyWithoutCustomerWithParentIF.php index 7116739c..44327844 100755 --- a/test/unit/Traits/TraitDummyWithoutCustomerWithParentIF.php +++ b/test/unit/Traits/TraitDummyWithoutCustomerWithParentIF.php @@ -21,7 +21,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/unit + * @package heidelpayPHP\test\unit */ namespace heidelpayPHP\test\unit\Traits; diff --git a/test/unit/Traits/TraitDummyWithoutCustomerWithoutParentIF.php b/test/unit/Traits/TraitDummyWithoutCustomerWithoutParentIF.php index d1bc85a9..917e5056 100755 --- a/test/unit/Traits/TraitDummyWithoutCustomerWithoutParentIF.php +++ b/test/unit/Traits/TraitDummyWithoutCustomerWithoutParentIF.php @@ -21,7 +21,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/unit + * @package heidelpayPHP\test\unit */ namespace heidelpayPHP\test\unit\Traits; diff --git a/test/unit/Validators/PrivateKeyValidatorTest.php b/test/unit/Validators/PrivateKeyValidatorTest.php index b56f6389..68a9ccb9 100755 --- a/test/unit/Validators/PrivateKeyValidatorTest.php +++ b/test/unit/Validators/PrivateKeyValidatorTest.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/unit + * @package heidelpayPHP\test\unit */ namespace heidelpayPHP\test\unit\Resources; diff --git a/test/unit/Validators/PublicKeyValidatorTest.php b/test/unit/Validators/PublicKeyValidatorTest.php index fd0a4e10..46be7063 100755 --- a/test/unit/Validators/PublicKeyValidatorTest.php +++ b/test/unit/Validators/PublicKeyValidatorTest.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/unit + * @package heidelpayPHP\test\unit */ namespace heidelpayPHP\test\unit\Resources; From 8e5cea26b8d8e3724f0e6922c5630bd35dd589e2 Mon Sep 17 00:00:00 2001 From: sixer1182 Date: Wed, 27 Nov 2019 11:24:33 +0100 Subject: [PATCH 024/101] [refactor] (PHPLIB-274) Change file headers of service interfaces. --- src/Interfaces/PaymentServiceInterface.php | 23 +++++++++++++++------ src/Interfaces/ResourceServiceInterface.php | 23 +++++++++++++++------ 2 files changed, 34 insertions(+), 12 deletions(-) diff --git a/src/Interfaces/PaymentServiceInterface.php b/src/Interfaces/PaymentServiceInterface.php index fcc782d6..b5ed38ff 100644 --- a/src/Interfaces/PaymentServiceInterface.php +++ b/src/Interfaces/PaymentServiceInterface.php @@ -1,15 +1,26 @@ + * http://www.apache.org/licenses/LICENSE-2.0 * - * @package heidelpay/${Package} + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * @link https://docs.heidelpay.com/ + * + * @author Simon Gabriel + * + * @package heidelpayPHP\Interfaces */ namespace heidelpayPHP\Interfaces; diff --git a/src/Interfaces/ResourceServiceInterface.php b/src/Interfaces/ResourceServiceInterface.php index bf5839ee..035ff16d 100644 --- a/src/Interfaces/ResourceServiceInterface.php +++ b/src/Interfaces/ResourceServiceInterface.php @@ -1,15 +1,26 @@ + * http://www.apache.org/licenses/LICENSE-2.0 * - * @package heidelpay/${Package} + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * @link https://docs.heidelpay.com/ + * + * @author Simon Gabriel + * + * @package heidelpayPHP\Interfaces */ namespace heidelpayPHP\Interfaces; From f461f9d22f5406b60c546e8b633d028538d21055 Mon Sep 17 00:00:00 2001 From: sixer1182 Date: Wed, 27 Nov 2019 11:25:09 +0100 Subject: [PATCH 025/101] [refactor] (PHPLIB-274) Fix style issues. --- src/Services/WebhookService.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Services/WebhookService.php b/src/Services/WebhookService.php index 5782d33a..e5c838c8 100755 --- a/src/Services/WebhookService.php +++ b/src/Services/WebhookService.php @@ -64,6 +64,7 @@ public function getHeidelpay(): Heidelpay /** * @param Heidelpay $heidelpay + * * @return WebhookService */ public function setHeidelpay(Heidelpay $heidelpay): WebhookService @@ -82,6 +83,7 @@ public function getResourceService(): ResourceServiceInterface /** * @param ResourceServiceInterface $resourceService + * * @return WebhookService */ public function setResourceService(ResourceServiceInterface $resourceService): WebhookService From 163fa1d36c25a1d7f351ba473c4413cff52d355e Mon Sep 17 00:00:00 2001 From: sixer1182 Date: Wed, 27 Nov 2019 11:27:31 +0100 Subject: [PATCH 026/101] [refactor] (PHPLIB-274) Update changelog and version. --- CHANGELOG.md | 6 ++++++ src/Heidelpay.php | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 54f436da..faed16f8 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,11 @@ 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.3.0.0][1.3.0.0] + +### Change +* Refactor heidelpay facade to implement service interfaces. + ## [1.2.5.1][1.2.5.1] ### Fix @@ -338,3 +343,4 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a [1.2.4.0]: https://github.com/heidelpay/heidelpayPHP/compare/1.2.3.0..1.2.4.0 [1.2.5.0]: https://github.com/heidelpay/heidelpayPHP/compare/1.2.4.0..1.2.5.0 [1.2.5.1]: https://github.com/heidelpay/heidelpayPHP/compare/1.2.5.0..1.2.5.1 +[1.3.0.0]: https://github.com/heidelpay/heidelpayPHP/compare/1.2.5.1..1.3.0.0 diff --git a/src/Heidelpay.php b/src/Heidelpay.php index bc444736..7d7315da 100755 --- a/src/Heidelpay.php +++ b/src/Heidelpay.php @@ -60,7 +60,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.5.1'; + const SDK_VERSION = '1.3.0.0'; /** @var string $key */ private $key; From e7584a91f511aafcbcb37a7240c9947dc529e4d8 Mon Sep 17 00:00:00 2001 From: sixer1182 Date: Wed, 27 Nov 2019 11:37:33 +0100 Subject: [PATCH 027/101] [refactor] (PHPLIB-274) Remove deprecated code. --- src/Constants/ApiResponseCodes.php | 14 --- src/Resources/Basket.php | 24 ---- src/Resources/Customer.php | 29 ++--- src/Resources/Payment.php | 85 -------------- test/unit/Resources/BasketTest.php | 17 --- test/unit/Resources/PaymentCancelTest.php | 134 ---------------------- 6 files changed, 9 insertions(+), 294 deletions(-) diff --git a/src/Constants/ApiResponseCodes.php b/src/Constants/ApiResponseCodes.php index 3dbf4601..fd3689b2 100755 --- a/src/Constants/ApiResponseCodes.php +++ b/src/Constants/ApiResponseCodes.php @@ -45,17 +45,7 @@ class ApiResponseCodes const API_ERROR_IVF_REQUIRES_BASKET = 'API.330.100.023'; const API_ERROR_ADDRESSES_DO_NOT_MATCH = 'API.330.100.106'; const API_ERROR_CURRENCY_IS_NOT_SUPPORTED = 'API.330.100.202'; - /** - * @deprecated since 1.2.3.0 - * @see ApiResponseCodes::API_ERROR_ALREADY_CANCELLED - */ - const API_ERROR_AUTHORIZE_ALREADY_CANCELLED = 'API.340.100.014'; const API_ERROR_ALREADY_CANCELLED = 'API.340.100.014'; - /** - * @deprecated since 1.2.3.0 - * @see ApiResponseCodes::API_ERROR_ALREADY_CHARGED_BACK - */ - const API_ERROR_CHARGE_ALREADY_CHARGED_BACK = 'API.340.100.015'; const API_ERROR_ALREADY_CHARGED_BACK = 'API.340.100.015'; const API_ERROR_ALREADY_CHARGED = 'API.340.100.018'; const API_ERROR_CANCEL_REASON_CODE_IS_MISSING = 'API.340.100.024'; @@ -68,10 +58,6 @@ class ApiResponseCodes const API_ERROR_WEBHOOK_EVENT_ALREADY_REGISTERED = 'API.510.310.009'; const API_ERROR_WEBHOOK_CAN_NOT_BE_FOUND = 'API.510.310.008'; const API_ERROR_BASKET_ITEM_IMAGE_INVALID_URL = 'API.600.630.004'; - /** - * @deprecated since 1.2.5.0 Will be removed in next major version. - */ - const API_ERROR_BASKET_ITEM_IMAGE_INVALID_EXTENSION = 'API.600.630.005'; const API_ERROR_INVALID_KEY = 'API.710.000.002'; const API_ERROR_INSUFFICIENT_PERMISSION = 'API.710.000.005'; const API_ERROR_WRONG_AUTHENTICATION_METHOD = 'API.710.000.007'; diff --git a/src/Resources/Basket.php b/src/Resources/Basket.php index b96c41ba..9d348e69 100755 --- a/src/Resources/Basket.php +++ b/src/Resources/Basket.php @@ -93,30 +93,6 @@ public function setAmountTotalGross(float $amountTotalGross): Basket return $this; } - /** - * @return float - * - * @deprecated since 1.2.0.0 - * @see Basket::getAmountTotalGross() - */ - public function getAmountTotal(): float - { - return $this->getAmountTotalGross(); - } - - /** - * @param float $amountTotal - * - * @return Basket - * - * @deprecated since 1.2.0.0 - * @see Basket::setAmountTotalGross() - */ - public function setAmountTotal(float $amountTotal): Basket - { - return $this->setAmountTotalGross($amountTotal); - } - /** * @return float */ diff --git a/src/Resources/Customer.php b/src/Resources/Customer.php index 6ebd728e..af54dc88 100755 --- a/src/Resources/Customer.php +++ b/src/Resources/Customer.php @@ -73,26 +73,6 @@ class Customer extends AbstractHeidelpayResource /** @var GeoLocation $geoLocation */ private $geoLocation; - /** - * Customer constructor. - * - * @param string|null $firstname - * @param string|null $lastname - * - * @deprecated since Version 1.1.5.0 - * @see CustomerFactory::createCustomer() - * @see CustomerFactory::createNotRegisteredB2bCustomer() - * @see CustomerFactory::createRegisteredB2bCustomer() - */ - public function __construct(string $firstname = null, string $lastname = null) - { - $this->firstname = $firstname; - $this->lastname = $lastname; - $this->billingAddress = new Address(); - $this->shippingAddress = new Address(); - $this->geoLocation = new GeoLocation(); - } - // /** @@ -253,6 +233,9 @@ public function setMobile($mobile): Customer */ public function getBillingAddress(): Address { + if (!$this->billingAddress instanceof Address) { + $this->billingAddress = new Address(); + } return $this->billingAddress; } @@ -272,6 +255,9 @@ public function setBillingAddress(Address $billingAddress): Customer */ public function getShippingAddress(): Address { + if (!$this->shippingAddress instanceof Address) { + $this->shippingAddress = new Address(); + } return $this->shippingAddress; } @@ -329,6 +315,9 @@ public function setCompanyInfo(CompanyInfo $companyInfo): Customer */ public function getGeoLocation() { + if (!$this->geoLocation instanceof GeoLocation) { + $this->geoLocation = new GeoLocation(); + } return $this->geoLocation; } diff --git a/src/Resources/Payment.php b/src/Resources/Payment.php index c0617057..abfe20d2 100755 --- a/src/Resources/Payment.php +++ b/src/Resources/Payment.php @@ -45,7 +45,6 @@ use heidelpayPHP\Traits\HasPaymentState; use RuntimeException; use stdClass; -use function count; use function in_array; use function is_string; @@ -628,33 +627,6 @@ public function getExternalId() // - /** - * Performs a Cancellation transaction on the Payment. - * If no amount is given a full cancel will be performed i. e. all Charges and Authorizations will be cancelled. - * - * @param float|null $amount The amount to canceled. - * @param string $reason - * - * @return Cancellation|null The resulting Cancellation object. - * If more then one cancellation is performed the last one will be returned. - * - * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. - * - * @deprecated since 1.2.3.0 - * @see Payment::cancelAmount() - */ - public function cancel($amount = null, $reason = CancelReasonCodes::REASON_CODE_CANCEL) - { - $cancellations = $this->cancelAmount($amount, $reason); - - if (count($cancellations) > 0) { - return $cancellations[0]; - } - - throw new RuntimeException('This Payment could not be cancelled.'); - } - /** * Performs a Cancellation transaction on the Payment. * If no amount is given a full cancel will be performed i. e. all Charges and Authorizations will be cancelled. @@ -739,63 +711,6 @@ public function cancelAmount( return $cancellations; } - /** - * Cancels all charges of the payment and returns an array of the cancellations and exceptions that occur. - * - * @return array - * - * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. - * - * @deprecated since 1.2.3.0 - * @see Payment::cancelAmount() - */ - public function cancelAllCharges(): array - { - $cancels = []; - $exceptions = []; - - /** @var Charge $charge */ - foreach ($this->getCharges() as $charge) { - try { - $cancels[] = $charge->cancel(); - } catch (HeidelpayApiException $e) { - $allowedErrors = [ - ApiResponseCodes::API_ERROR_ALREADY_CHARGED_BACK, - ApiResponseCodes::API_ERROR_ALREADY_CANCELLED - ]; - if (!in_array($e->getCode(), $allowedErrors, true)) { - throw $e; - } - $exceptions[] = $e; - } - } - return array($cancels, $exceptions); - } - - /** - * @param float|null $amount - * - * @return array - * - * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. - * - * @deprecated since 1.2.3.0 - * @see Payment::cancelAuthorizationAmount() - */ - public function cancelAuthorization($amount = null): array - { - $cancels = []; - $cancel = $this->cancelAuthorizationAmount($amount); - - if ($cancel instanceof Cancellation) { - $cancels[] = $cancel; - } - - return array($cancels, []); - } - /** * Cancel the given amount of the payments authorization. * diff --git a/test/unit/Resources/BasketTest.php b/test/unit/Resources/BasketTest.php index 0e87be63..0abe0c3c 100755 --- a/test/unit/Resources/BasketTest.php +++ b/test/unit/Resources/BasketTest.php @@ -168,21 +168,4 @@ public function referenceIdShouldBeAutomaticallySetToTheArrayIndexIfItIsNotSet() $this->assertEquals('0', $basketItem3->getBasketItemReferenceId()); $this->assertEquals('1', $basketItem4->getBasketItemReferenceId()); } - - /** - * Verify amount total is replaced by amount total gross. - * - * @test - * - * @throws Exception - */ - public function amountTotalSetterGetterAccessAmountTotalGross() - { - $basket = new Basket(); - $this->assertEquals($basket->getAmountTotalGross(), $basket->getAmountTotal()); - $basket->setAmountTotalGross(123.45); - $this->assertEquals($basket->getAmountTotalGross(), $basket->getAmountTotal()); - $basket->setAmountTotal(45.321); - $this->assertEquals($basket->getAmountTotalGross(), $basket->getAmountTotal()); - } } diff --git a/test/unit/Resources/PaymentCancelTest.php b/test/unit/Resources/PaymentCancelTest.php index e7be6e71..347216ad 100644 --- a/test/unit/Resources/PaymentCancelTest.php +++ b/test/unit/Resources/PaymentCancelTest.php @@ -40,140 +40,6 @@ class PaymentCancelTest extends BasePaymentTest { - // - - /** - * Verify payment:cancel calls cancelAllCharges and cancelAuthorizationAmount and returns first charge cancellation - * object. - * - * @test - * - * @throws HeidelpayApiException - * @throws ReflectionException - * @throws RuntimeException - * - * @deprecated since 1.2.3.0 - */ - public function cancelShouldCallCancelAllChargesAndCancelAuthorizationAndReturnFirstChargeCancellationObject() - { - $paymentMock = $this->getMockBuilder(Payment::class)->setMethods(['cancelAmount'])->getMock(); - $cancellation = new Cancellation(1.0); - $paymentMock->expects($this->once())->method('cancelAmount')->willReturn([$cancellation]); - - /** @var Payment $paymentMock */ - $this->assertSame($cancellation, $paymentMock->cancel()); - } - - /** - * Verify payment:cancel throws Exception if no cancellation and no auth existed to be cancelled. - * - * @test - * - * @throws ReflectionException - * @throws RuntimeException - * @throws HeidelpayApiException - * - * @deprecated since 1.2.3.0 - */ - public function cancelShouldThrowExceptionIfNoTransactionExistsToBeCancelled() - { - $paymentMock = $this->getMockBuilder(Payment::class)->setMethods(['cancelAllCharges', 'cancelAuthorization'])->getMock(); - - $this->expectException(RuntimeException::class); - $this->expectExceptionMessage('This Payment could not be cancelled.'); - - /** @var Payment $paymentMock */ - $paymentMock->cancel(); - } - - /** - * Verify cancel all charges will call cancel on each existing charge of the payment and will return a list of - * cancels and exceptions. - * - * @test - * - * @throws HeidelpayApiException - * @throws ReflectionException - * @throws RuntimeException - * - * @deprecated since 1.2.3.0 - */ - public function cancelAllChargesShouldCallCancelOnAllChargesAndReturnCancelsAndExceptions() - { - $cancellation1 = new Cancellation(1.0); - $cancellation2 = new Cancellation(2.0); - $cancellation3 = new Cancellation(3.0); - $exception1 = new HeidelpayApiException('', '', ApiResponseCodes::API_ERROR_ALREADY_CHARGED_BACK); - $exception2 = new HeidelpayApiException('', '', ApiResponseCodes::API_ERROR_ALREADY_CHARGED_BACK); - - $chargeMock1 = $this->getMockBuilder(Charge::class)->setMethods(['cancel'])->getMock(); - $chargeMock1->expects($this->once())->method('cancel')->willReturn($cancellation1); - - $chargeMock2 = $this->getMockBuilder(Charge::class)->setMethods(['cancel'])->getMock(); - $chargeMock2->expects($this->once())->method('cancel')->willThrowException($exception1); - - $chargeMock3 = $this->getMockBuilder(Charge::class)->setMethods(['cancel'])->getMock(); - $chargeMock3->expects($this->once())->method('cancel')->willReturn($cancellation2); - - $chargeMock4 = $this->getMockBuilder(Charge::class)->setMethods(['cancel'])->getMock(); - $chargeMock4->expects($this->once())->method('cancel')->willThrowException($exception2); - - $chargeMock5 = $this->getMockBuilder(Charge::class)->setMethods(['cancel'])->getMock(); - $chargeMock5->expects($this->once())->method('cancel')->willReturn($cancellation3); - - /** - * @var Charge $chargeMock1 - * @var Charge $chargeMock2 - * @var Charge $chargeMock3 - * @var Charge $chargeMock4 - * @var Charge $chargeMock5 - */ - $payment = new Payment(); - $payment->addCharge($chargeMock1)->addCharge($chargeMock2)->addCharge($chargeMock3)->addCharge($chargeMock4)->addCharge($chargeMock5); - - list($cancellations, $exceptions) = $payment->cancelAllCharges(); - $this->assertArraySubset([$cancellation1, $cancellation2, $cancellation3], $cancellations); - $this->assertArraySubset([$exception1, $exception2], $exceptions); - } - - /** - * Verify cancelAllCharges will throw any exception with Code different to - * ApiResponseCodes::API_ERROR_CHARGE_ALREADY_CANCELED. - * - * @test - * - * @throws ReflectionException - * @throws RuntimeException - * - * @deprecated since 1.2.3.0 - */ - public function cancelAllChargesShouldThrowChargeCancelExceptionsOtherThanAlreadyCharged() - { - $ex1 = new HeidelpayApiException('', '', ApiResponseCodes::API_ERROR_ALREADY_CHARGED_BACK); - $ex2 = new HeidelpayApiException('', '', ApiResponseCodes::API_ERROR_CHARGED_AMOUNT_HIGHER_THAN_EXPECTED); - - $chargeMock1 = $this->getMockBuilder(Charge::class)->setMethods(['cancel'])->getMock(); - $chargeMock1->expects($this->once())->method('cancel')->willThrowException($ex1); - - $chargeMock2 = $this->getMockBuilder(Charge::class)->setMethods(['cancel'])->getMock(); - $chargeMock2->expects($this->once())->method('cancel')->willThrowException($ex2); - - /** - * @var Charge $chargeMock1 - * @var Charge $chargeMock2 - */ - $payment = (new Payment())->addCharge($chargeMock1)->addCharge($chargeMock2); - - try { - $payment->cancelAllCharges(); - $this->assertFalse(true, 'The expected exception has not been thrown.'); - } catch (HeidelpayApiException $e) { - $this->assertSame($ex2, $e); - } - } - - // - /** * Verify cancelAmount will call cancelAuthorizationAmount with the amountToCancel. * When cancelAmount is <= the value of the cancellation it Will return auth cancellation only. From 1cdcbf784f6a387e5964a86cd64eaf140da23386 Mon Sep 17 00:00:00 2001 From: sixer1182 Date: Wed, 27 Nov 2019 17:09:11 +0100 Subject: [PATCH 028/101] [refactor] (PHPLIB-274) Remove deprecated Customer constructor call in example. --- examples/HirePurchaseDirectDebit/Controller.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/examples/HirePurchaseDirectDebit/Controller.php b/examples/HirePurchaseDirectDebit/Controller.php index 21efa1f0..a382d540 100644 --- a/examples/HirePurchaseDirectDebit/Controller.php +++ b/examples/HirePurchaseDirectDebit/Controller.php @@ -35,7 +35,7 @@ use heidelpayPHP\Exceptions\HeidelpayApiException; use heidelpayPHP\Heidelpay; use heidelpayPHP\Resources\Basket; -use heidelpayPHP\Resources\Customer; +use heidelpayPHP\Resources\CustomerFactory; use heidelpayPHP\Resources\EmbeddedResources\Address; use heidelpayPHP\Resources\EmbeddedResources\BasketItem; use heidelpayPHP\Resources\PaymentTypes\HirePurchaseDirectDebit; @@ -80,7 +80,7 @@ function redirect($url, $merchantMessage = '', $clientMessage = '') ->setCity('Heidelberg') ->setZip('69155') ->setCountry('DE'); - $customer = (new Customer('Linda', 'Heideich')) + $customer = CustomerFactory::createCustomer('Linda', 'Heideich') ->setBirthDate('2000-02-12') ->setBillingAddress($address) ->setShippingAddress($address) @@ -91,8 +91,7 @@ function redirect($url, $merchantMessage = '', $clientMessage = '') ->setAmountNet(100.0) ->setAmountGross(119.0) ->setAmountVat(19.0); - $basket = (new Basket($orderId, 119.0, 'EUR', [$basketItem])) - ->setAmountTotalVat(19.0); + $basket = (new Basket($orderId, 119.0, 'EUR', [$basketItem]))->setAmountTotalVat(19.0); // initialize the payment $authorize = $heidelpay->authorize( @@ -103,7 +102,8 @@ function redirect($url, $merchantMessage = '', $clientMessage = '') $customer, $orderId, null, - $basket); + $basket + ); // You'll need to remember the shortId to show it on the success or failure page $_SESSION['PaymentId'] = $authorize->getPaymentId(); From 5440ace1adb2127aa0c97601ede298fe1a1dbf90 Mon Sep 17 00:00:00 2001 From: sixer1182 Date: Fri, 29 Nov 2019 08:57:40 +0100 Subject: [PATCH 029/101] [refactor] (PHPLIB-274) Fix minor issues. --- examples/ExampleDebugHandler.php | 2 +- src/Adapter/CurlAdapter.php | 2 +- src/Resources/Customer.php | 19 ++++++++++--------- 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/examples/ExampleDebugHandler.php b/examples/ExampleDebugHandler.php index cda6d17a..7470e992 100755 --- a/examples/ExampleDebugHandler.php +++ b/examples/ExampleDebugHandler.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP\test\integration + * @package heidelpayPHP\examples */ namespace heidelpayPHP\examples; diff --git a/src/Adapter/CurlAdapter.php b/src/Adapter/CurlAdapter.php index 6d517490..ef8f010d 100755 --- a/src/Adapter/CurlAdapter.php +++ b/src/Adapter/CurlAdapter.php @@ -21,7 +21,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP\adapter + * @package heidelpayPHP\Adapter */ namespace heidelpayPHP\Adapter; diff --git a/src/Resources/Customer.php b/src/Resources/Customer.php index af54dc88..371c51ae 100755 --- a/src/Resources/Customer.php +++ b/src/Resources/Customer.php @@ -75,6 +75,16 @@ class Customer extends AbstractHeidelpayResource // + /** + * Customer constructor. + */ + public function __construct() + { + $this->billingAddress = new Address(); + $this->shippingAddress = new Address(); + $this->geoLocation = new GeoLocation(); + } + /** * @return string|null */ @@ -233,9 +243,6 @@ public function setMobile($mobile): Customer */ public function getBillingAddress(): Address { - if (!$this->billingAddress instanceof Address) { - $this->billingAddress = new Address(); - } return $this->billingAddress; } @@ -255,9 +262,6 @@ public function setBillingAddress(Address $billingAddress): Customer */ public function getShippingAddress(): Address { - if (!$this->shippingAddress instanceof Address) { - $this->shippingAddress = new Address(); - } return $this->shippingAddress; } @@ -315,9 +319,6 @@ public function setCompanyInfo(CompanyInfo $companyInfo): Customer */ public function getGeoLocation() { - if (!$this->geoLocation instanceof GeoLocation) { - $this->geoLocation = new GeoLocation(); - } return $this->geoLocation; } From c7d6e34ea3ec6b6bc4a7cf803d4c3b794805ba4e Mon Sep 17 00:00:00 2001 From: sixer1182 Date: Fri, 29 Nov 2019 09:56:42 +0100 Subject: [PATCH 030/101] [refactor] (PHPLIB-274) Fix minor issues. --- src/Heidelpay.php | 14 ++++++------ src/Services/PaymentService.php | 8 +++++-- src/Services/ResourceService.php | 25 +++++++++++++++------- src/Traits/CanDirectCharge.php | 2 +- src/Traits/CanDirectChargeWithCustomer.php | 2 +- src/Traits/CanPayout.php | 2 +- src/Traits/CanPayoutWithCustomer.php | 2 +- src/Traits/HasCancellations.php | 4 ++-- test/integration/SetMetadataTest.php | 2 +- test/unit/Resources/PaymentTest.php | 16 +++++++------- 10 files changed, 45 insertions(+), 32 deletions(-) diff --git a/src/Heidelpay.php b/src/Heidelpay.php index 7d7315da..97b2a8a1 100755 --- a/src/Heidelpay.php +++ b/src/Heidelpay.php @@ -74,7 +74,7 @@ class Heidelpay implements HeidelpayParentInterface, PaymentServiceInterface, Re /** @var PaymentServiceInterface $paymentService */ private $paymentService; - /** @var WebhookService $webhookService */ + /** @var WebhookServiceInterface $webhookService */ private $webhookService; /** @var HttpService $httpService */ @@ -183,11 +183,11 @@ public function getResourceService(): ResourceService } /** - * @param PaymentService $paymentService + * @param PaymentServiceInterface $paymentService * * @return Heidelpay */ - public function setPaymentService(PaymentService $paymentService): Heidelpay + public function setPaymentService(PaymentServiceInterface $paymentService): Heidelpay { $this->paymentService = $paymentService->setHeidelpay($this); return $this; @@ -202,19 +202,19 @@ public function getPaymentService(): PaymentServiceInterface } /** - * @return WebhookService + * @return WebhookServiceInterface */ - public function getWebhookService(): WebhookService + public function getWebhookService(): WebhookServiceInterface { return $this->webhookService; } /** - * @param WebhookService $webhookService + * @param WebhookServiceInterface $webhookService * * @return Heidelpay */ - public function setWebhookService(WebhookService $webhookService): Heidelpay + public function setWebhookService(WebhookServiceInterface $webhookService): Heidelpay { $this->webhookService = $webhookService; return $this; diff --git a/src/Services/PaymentService.php b/src/Services/PaymentService.php index 16d31840..9fc1f670 100755 --- a/src/Services/PaymentService.php +++ b/src/Services/PaymentService.php @@ -62,7 +62,9 @@ public function __construct(Heidelpay $heidelpay) //heidelpay; @@ -79,7 +81,9 @@ public function setHeidelpay(Heidelpay $heidelpay): PaymentService return $this; } - /** @return ResourceService */ + /** + * @return ResourceService + */ public function getResourceService(): ResourceService { return $this->getHeidelpay()->getResourceService(); diff --git a/src/Services/ResourceService.php b/src/Services/ResourceService.php index 6e7947e2..5e5abf9e 100755 --- a/src/Services/ResourceService.php +++ b/src/Services/ResourceService.php @@ -366,8 +366,7 @@ public function activateRecurringPayment($paymentType, $returnUrl): Recurring /** * Fetches the payment object if the id is given. - * Else it just returns the given payment argument. - * (!) It does not fetch or update a given payment object but returns it as-is. (!) + * Else it just returns the given payment argument as-is. * * @param $payment * @@ -685,7 +684,13 @@ public function fetchAuthorization($payment): Authorization /** @var Payment $paymentObject */ $paymentObject = $this->fetchPayment($payment); /** @var Authorization $authorize */ - $authorize = $this->fetchResource($paymentObject->getAuthorization(true)); + $authorize = $paymentObject->getAuthorization(true); + + if (!$authorize instanceof Authorization) { + throw new RuntimeException('The payment does not seem to have an Authorization.'); + } + + $this->fetchResource($authorize); return $authorize; } @@ -694,9 +699,8 @@ public function fetchAuthorization($payment): Authorization // public function fetchCharge(Charge $charge): Charge { - /** @var Charge $retCharge */ - $retCharge = $this->fetchResource($charge); - return $retCharge; + $this->fetchResource($charge); + return $charge; } /** @@ -706,8 +710,13 @@ public function fetchChargeById($payment, $chargeId): Charge { /** @var Payment $paymentObject */ $paymentObject = $this->fetchPayment($payment); - /** @var Charge $charge */ - $charge = $this->fetchResource($paymentObject->getCharge($chargeId, true)); + $charge = $paymentObject->getCharge($chargeId, true); + + if (!$charge instanceof Charge) { + throw new RuntimeException('The charge object could not be found.'); + } + + $this->fetchResource($charge); return $charge; } diff --git a/src/Traits/CanDirectCharge.php b/src/Traits/CanDirectCharge.php index 948b63fe..196fdf14 100755 --- a/src/Traits/CanDirectCharge.php +++ b/src/Traits/CanDirectCharge.php @@ -52,7 +52,7 @@ trait CanDirectCharge * @param string|null $invoiceId The external id of the invoice. * @param string|null $paymentReference A reference text for the payment. * - * @return Charge + * @return Charge The resulting charge object. * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. diff --git a/src/Traits/CanDirectChargeWithCustomer.php b/src/Traits/CanDirectChargeWithCustomer.php index 0514647e..3202f515 100755 --- a/src/Traits/CanDirectChargeWithCustomer.php +++ b/src/Traits/CanDirectChargeWithCustomer.php @@ -52,7 +52,7 @@ trait CanDirectChargeWithCustomer * @param string|null $invoiceId The external id of the invoice. * @param string|null $paymentReference A reference text for the payment. * - * @return Charge + * @return Charge The resulting charge object. * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. diff --git a/src/Traits/CanPayout.php b/src/Traits/CanPayout.php index bc5f0618..23d39c5e 100644 --- a/src/Traits/CanPayout.php +++ b/src/Traits/CanPayout.php @@ -50,7 +50,7 @@ trait CanPayout * @param string|null $invoiceId The external id of the invoice. * @param string|null $paymentReference A reference text for the payment. * - * @return Payout + * @return Payout The resulting payout object. * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. diff --git a/src/Traits/CanPayoutWithCustomer.php b/src/Traits/CanPayoutWithCustomer.php index 85e390db..80f8d39e 100644 --- a/src/Traits/CanPayoutWithCustomer.php +++ b/src/Traits/CanPayoutWithCustomer.php @@ -48,7 +48,7 @@ trait CanPayoutWithCustomer * The Basket object will be created automatically if it does not exist * yet (i.e. has no id). * - * @return Payout + * @return Payout The resulting payout object. * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. diff --git a/src/Traits/HasCancellations.php b/src/Traits/HasCancellations.php index eaf6ee4b..fb37f04f 100755 --- a/src/Traits/HasCancellations.php +++ b/src/Traits/HasCancellations.php @@ -73,13 +73,13 @@ public function addCancellation(Cancellation $cancellation): self /** * Return specific Cancellation object or null if it does not exist. * - * @param string $cancellationId + * @param string $cancellationId The id of the cancellation object * @param boolean $lazy * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. * - * @return mixed + * @return Cancellation|null The cancellation or null if none could be found. */ public function getCancellation($cancellationId, $lazy = false) { diff --git a/test/integration/SetMetadataTest.php b/test/integration/SetMetadataTest.php index f11b5cbb..aee85a55 100755 --- a/test/integration/SetMetadataTest.php +++ b/test/integration/SetMetadataTest.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP\tests/integration + * @package heidelpayPHP\test\integration */ namespace heidelpayPHP\test\integration; diff --git a/test/unit/Resources/PaymentTest.php b/test/unit/Resources/PaymentTest.php index b8749845..0398cd06 100755 --- a/test/unit/Resources/PaymentTest.php +++ b/test/unit/Resources/PaymentTest.php @@ -1352,9 +1352,9 @@ public function shipMethodShouldPropagateToHeidelpayChargePaymentMethod() * * @test * - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. * @throws ReflectionException - * @throws HeidelpayApiException */ public function setMetaDataShouldSetParentResourceAndCreateMetaDataObject() { @@ -1421,9 +1421,9 @@ public function metadataMustBeOfTypeMetadata() * * @test * - * @throws HeidelpayApiException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. * @throws ReflectionException - * @throws RuntimeException */ public function setBasketShouldCallCreateIfTheGivenBasketObjectDoesNotExistYet() { @@ -1451,9 +1451,9 @@ static function ($object) use ($basket, $heidelpay) { * * @test * + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. * @throws ReflectionException - * @throws RuntimeException - * @throws HeidelpayApiException */ public function setBasketWontCallResourceServiceWhenBasketIsNull() { @@ -1479,9 +1479,9 @@ public function setBasketWontCallResourceServiceWhenBasketIsNull() * * @test * - * @throws HeidelpayApiException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. * @throws ReflectionException - * @throws RuntimeException */ public function updateResponseResourcesShouldFetchBasketIdIfItIsSetInResponse() { From 145685d6e0c91c79d7f311fd2b5b550c804610ce Mon Sep 17 00:00:00 2001 From: sixer1182 Date: Fri, 29 Nov 2019 10:34:13 +0100 Subject: [PATCH 031/101] [refactor] (PHPLIB-274) Fix package annotations. --- examples/Alipay/Constants.php | 2 +- examples/Alipay/Controller.php | 2 +- examples/Alipay/ReturnController.php | 2 +- examples/Alipay/index.php | 2 +- examples/Card/Constants.php | 2 +- examples/Card/Controller.php | 2 +- examples/Card/ReturnController.php | 2 +- examples/Card/index.php | 2 +- examples/CardRecurring/Constants.php | 2 +- examples/CardRecurring/Controller.php | 2 +- examples/CardRecurring/ReturnController.php | 2 +- examples/CardRecurring/index.php | 2 +- examples/Constants.php | 2 +- examples/EPSCharge/Constants.php | 2 +- examples/EPSCharge/Controller.php | 2 +- examples/EPSCharge/ReturnController.php | 2 +- examples/EPSCharge/index.php | 2 +- examples/EmbeddedPayPage/Constants.php | 2 +- examples/EmbeddedPayPage/Controller.php | 2 +- examples/EmbeddedPayPage/ReturnController.php | 2 +- examples/EmbeddedPayPage/index.php | 2 +- examples/ExampleDebugHandler.php | 2 +- examples/Failure.php | 2 +- examples/FlexiPayDirect/Constants.php | 2 +- examples/FlexiPayDirect/Controller.php | 2 +- examples/FlexiPayDirect/ReturnController.php | 2 +- examples/FlexiPayDirect/index.php | 2 +- examples/Giropay/Constants.php | 2 +- examples/Giropay/Controller.php | 2 +- examples/Giropay/ReturnController.php | 2 +- examples/Giropay/index.php | 2 +- examples/HirePurchaseDirectDebit/Constants.php | 2 +- examples/HirePurchaseDirectDebit/Controller.php | 2 +- examples/HirePurchaseDirectDebit/PlaceOrderController.php | 2 +- examples/HirePurchaseDirectDebit/confirm.php | 2 +- examples/HirePurchaseDirectDebit/index.php | 2 +- examples/HostedPayPage/Constants.php | 2 +- examples/HostedPayPage/Controller.php | 2 +- examples/HostedPayPage/ReturnController.php | 2 +- examples/HostedPayPage/index.php | 2 +- examples/IDeal/Constants.php | 2 +- examples/IDeal/Controller.php | 2 +- examples/IDeal/ReturnController.php | 2 +- examples/IDeal/index.php | 2 +- examples/Invoice/Constants.php | 2 +- examples/Invoice/Controller.php | 2 +- examples/Invoice/index.php | 2 +- examples/InvoiceFactoring/Constants.php | 2 +- examples/InvoiceFactoring/Controller.php | 2 +- examples/InvoiceFactoring/index.php | 2 +- examples/InvoiceGuaranteed/Constants.php | 2 +- examples/InvoiceGuaranteed/Controller.php | 2 +- examples/InvoiceGuaranteed/index.php | 2 +- examples/PayPal/Constants.php | 2 +- examples/PayPal/Controller.php | 2 +- examples/PayPal/ReturnController.php | 2 +- examples/PayPal/index.php | 2 +- examples/PayPalRecurring/Constants.php | 2 +- examples/PayPalRecurring/Controller.php | 2 +- examples/PayPalRecurring/ReturnController.php | 2 +- examples/PayPalRecurring/index.php | 2 +- examples/Pending.php | 2 +- examples/Prepayment/Constants.php | 2 +- examples/Prepayment/Controller.php | 2 +- examples/Prepayment/index.php | 2 +- examples/SepaDirectDebitGuaranteed/Constants.php | 2 +- examples/SepaDirectDebitGuaranteed/Controller.php | 2 +- examples/SepaDirectDebitGuaranteed/index.php | 2 +- examples/Sofort/Constants.php | 2 +- examples/Sofort/Controller.php | 2 +- examples/Sofort/ReturnController.php | 2 +- examples/Sofort/index.php | 2 +- examples/Success.php | 2 +- examples/Webhooks/Constants.php | 2 +- examples/Webhooks/Controller.php | 2 +- examples/Webhooks/fetchAll.php | 2 +- examples/Webhooks/index.php | 2 +- examples/Webhooks/removeAll.php | 2 +- examples/Wechatpay/Constants.php | 2 +- examples/Wechatpay/Controller.php | 2 +- examples/Wechatpay/ReturnController.php | 2 +- examples/Wechatpay/index.php | 2 +- examples/_enableExamples.php | 2 +- examples/index.php | 2 +- src/Adapter/CurlAdapter.php | 2 +- src/Adapter/HttpAdapterInterface.php | 2 +- src/Constants/ApiResponseCodes.php | 2 +- src/Constants/BasketItemTypes.php | 2 +- src/Constants/CancelReasonCodes.php | 2 +- src/Constants/CompanyCommercialSectorItems.php | 2 +- src/Constants/CompanyRegistrationTypes.php | 2 +- src/Constants/IdStrings.php | 2 +- src/Constants/PaymentState.php | 2 +- src/Constants/Salutations.php | 2 +- src/Constants/TransactionTypes.php | 2 +- src/Constants/WebhookEvents.php | 2 +- src/Exceptions/HeidelpayApiException.php | 2 +- src/Interfaces/DebugHandlerInterface.php | 2 +- src/Interfaces/HeidelpayParentInterface.php | 2 +- src/Resources/AbstractHeidelpayResource.php | 2 +- src/Resources/Basket.php | 2 +- src/Resources/Customer.php | 2 +- src/Resources/CustomerFactory.php | 2 +- src/Resources/EmbeddedResources/Address.php | 2 +- src/Resources/EmbeddedResources/Amount.php | 2 +- src/Resources/EmbeddedResources/BasketItem.php | 2 +- src/Resources/EmbeddedResources/CardDetails.php | 2 +- src/Resources/EmbeddedResources/CompanyInfo.php | 2 +- src/Resources/EmbeddedResources/GeoLocation.php | 2 +- src/Resources/EmbeddedResources/Message.php | 2 +- src/Resources/InstalmentPlan.php | 2 +- src/Resources/InstalmentPlans.php | 2 +- src/Resources/Keypair.php | 2 +- src/Resources/Metadata.php | 2 +- src/Resources/Payment.php | 2 +- src/Resources/PaymentTypes/Alipay.php | 2 +- src/Resources/PaymentTypes/BasePaymentType.php | 2 +- src/Resources/PaymentTypes/Card.php | 2 +- src/Resources/PaymentTypes/EPS.php | 2 +- src/Resources/PaymentTypes/Giropay.php | 2 +- src/Resources/PaymentTypes/HirePurchaseDirectDebit.php | 2 +- src/Resources/PaymentTypes/Ideal.php | 2 +- src/Resources/PaymentTypes/Invoice.php | 2 +- src/Resources/PaymentTypes/InvoiceFactoring.php | 2 +- src/Resources/PaymentTypes/InvoiceGuaranteed.php | 2 +- src/Resources/PaymentTypes/PIS.php | 2 +- src/Resources/PaymentTypes/Paypage.php | 2 +- src/Resources/PaymentTypes/Paypal.php | 2 +- src/Resources/PaymentTypes/Prepayment.php | 2 +- src/Resources/PaymentTypes/Przelewy24.php | 2 +- src/Resources/PaymentTypes/SepaDirectDebit.php | 2 +- src/Resources/PaymentTypes/SepaDirectDebitGuaranteed.php | 2 +- src/Resources/PaymentTypes/Sofort.php | 2 +- src/Resources/PaymentTypes/Wechatpay.php | 2 +- src/Resources/Recurring.php | 2 +- src/Resources/TransactionTypes/AbstractTransactionType.php | 2 +- src/Resources/TransactionTypes/Authorization.php | 2 +- src/Resources/TransactionTypes/Cancellation.php | 2 +- src/Resources/TransactionTypes/Charge.php | 2 +- src/Resources/TransactionTypes/Payout.php | 2 +- src/Resources/TransactionTypes/Shipment.php | 2 +- src/Resources/Webhook.php | 2 +- src/Resources/Webhooks.php | 2 +- src/Services/EnvironmentService.php | 2 +- src/Services/HttpService.php | 2 +- src/Services/IdService.php | 2 +- src/Services/PaymentService.php | 2 +- src/Services/ResourceNameService.php | 2 +- src/Services/ResourceService.php | 2 +- src/Services/ValueService.php | 2 +- src/Services/WebhookService.php | 2 +- src/Traits/CanAuthorize.php | 2 +- src/Traits/CanAuthorizeWithCustomer.php | 2 +- src/Traits/CanDirectCharge.php | 2 +- src/Traits/CanDirectChargeWithCustomer.php | 2 +- src/Traits/CanPayout.php | 2 +- src/Traits/CanPayoutWithCustomer.php | 2 +- src/Traits/CanRecur.php | 2 +- src/Traits/HasCancellations.php | 2 +- src/Traits/HasInvoiceId.php | 2 +- src/Traits/HasOrderId.php | 2 +- src/Traits/HasPaymentState.php | 2 +- src/Traits/HasStates.php | 2 +- src/Traits/HasUniqueAndShortId.php | 2 +- src/Validators/ExpiryDateValidator.php | 2 +- src/Validators/PrivateKeyValidator.php | 2 +- src/Validators/PublicKeyValidator.php | 2 +- test/BasePaymentTest.php | 2 +- test/Fixtures/CustomerFixtureTrait.php | 2 +- test/TestDebugHandler.php | 2 +- test/bootstrap.php | 2 +- test/integration/BasketTest.php | 2 +- test/integration/CustomerTest.php | 2 +- test/integration/DummyResource.php | 2 +- test/integration/ExceptionTest.php | 2 +- test/integration/KeypairTest.php | 2 +- test/integration/PaymentCancelTest.php | 2 +- test/integration/PaymentTest.php | 2 +- test/integration/PaymentTypes/AlipayTest.php | 2 +- test/integration/PaymentTypes/CardTest.php | 2 +- test/integration/PaymentTypes/EPSTest.php | 2 +- test/integration/PaymentTypes/GiropayTest.php | 2 +- test/integration/PaymentTypes/HirePurchaseDirectDebitTest.php | 2 +- test/integration/PaymentTypes/IdealTest.php | 2 +- test/integration/PaymentTypes/InvoiceFactoringTest.php | 2 +- test/integration/PaymentTypes/InvoiceGuaranteedTest.php | 2 +- test/integration/PaymentTypes/InvoiceTest.php | 2 +- test/integration/PaymentTypes/PISTest.php | 2 +- test/integration/PaymentTypes/PaypageTest.php | 2 +- test/integration/PaymentTypes/PaypalTest.php | 2 +- test/integration/PaymentTypes/PrepaymentTest.php | 2 +- test/integration/PaymentTypes/Przelewy24Test.php | 2 +- test/integration/PaymentTypes/SepaDirectDebitGuaranteedTest.php | 2 +- test/integration/PaymentTypes/SepaDirectDebitTest.php | 2 +- test/integration/PaymentTypes/SofortTest.php | 2 +- test/integration/PaymentTypes/WechatpayTest.php | 2 +- test/integration/RecurringPaymentTest.php | 2 +- test/integration/SetMetadataTest.php | 2 +- test/integration/TransactionTypes/AuthorizationTest.php | 2 +- .../TransactionTypes/CancelAfterAuthorizationTest.php | 2 +- test/integration/TransactionTypes/CancelAfterChargeTest.php | 2 +- test/integration/TransactionTypes/CancelTest.php | 2 +- .../TransactionTypes/ChargeAfterAuthorizationTest.php | 2 +- test/integration/TransactionTypes/ChargeTest.php | 2 +- test/integration/TransactionTypes/PayoutTest.php | 2 +- test/integration/TransactionTypes/ShipmentTest.php | 2 +- test/integration/WebhookTest.php | 2 +- test/unit/Constants/PaymentStateTest.php | 2 +- test/unit/DummyResource.php | 2 +- test/unit/Exceptions/HeidelpayApiExceptionTest.php | 2 +- test/unit/HeidelpayTest.php | 2 +- test/unit/Resources/AbstractHeidelpayResourceTest.php | 2 +- test/unit/Resources/BasketTest.php | 2 +- test/unit/Resources/CustomerFactoryTest.php | 2 +- test/unit/Resources/CustomerTest.php | 2 +- test/unit/Resources/DummyHeidelpayResource.php | 2 +- test/unit/Resources/EmbeddedResources/AmountTest.php | 2 +- test/unit/Resources/EmbeddedResources/BasketItemTest.php | 2 +- test/unit/Resources/EmbeddedResources/GeoLocationTest.php | 2 +- test/unit/Resources/InstalmentPlanTest.php | 2 +- test/unit/Resources/KeypairTest.php | 2 +- test/unit/Resources/MetadataTest.php | 2 +- test/unit/Resources/PaymentCancelTest.php | 2 +- test/unit/Resources/PaymentTypes/CardTest.php | 2 +- test/unit/Resources/PaymentTypes/EPSTest.php | 2 +- .../unit/Resources/PaymentTypes/HirePurchaseDirectDebitTest.php | 2 +- test/unit/Resources/PaymentTypes/IdealTest.php | 2 +- test/unit/Resources/PaymentTypes/PayPageTest.php | 2 +- test/unit/Resources/PaymentTypes/PayPalTest.php | 2 +- .../Resources/PaymentTypes/SepaDirectDebitGuaranteedTest.php | 2 +- test/unit/Resources/PaymentTypes/SepaDirectDebitTest.php | 2 +- test/unit/Resources/RecurringTest.php | 2 +- .../Resources/TransactionTypes/AbstractTransactionTypeTest.php | 2 +- test/unit/Resources/TransactionTypes/AuthorizationTest.php | 2 +- test/unit/Resources/TransactionTypes/CancellationTest.php | 2 +- test/unit/Resources/TransactionTypes/ChargeTest.php | 2 +- test/unit/Resources/TransactionTypes/DummyTransactionType.php | 2 +- test/unit/Resources/TransactionTypes/PayoutTest.php | 2 +- test/unit/Resources/TransactionTypes/ShipmentTest.php | 2 +- test/unit/Resources/WebhookTest.php | 2 +- test/unit/Resources/WebhooksTest.php | 2 +- test/unit/Services/DummyAdapter.php | 2 +- test/unit/Services/DummyDebugHandler.php | 2 +- test/unit/Services/HttpServiceTest.php | 2 +- test/unit/Services/PaymentServiceTest.php | 2 +- test/unit/Services/ResourceNameServiceTest.php | 2 +- test/unit/Services/ResourceServiceTest.php | 2 +- test/unit/Services/WebhooksServiceTest.php | 2 +- test/unit/Traits/CanAuthorizeTest.php | 2 +- test/unit/Traits/CanAuthorizeWithCustomerTest.php | 2 +- test/unit/Traits/CanDirectChargeTest.php | 2 +- test/unit/Traits/CanDirectChargeWithCustomerTest.php | 2 +- test/unit/Traits/CanPayoutTest.php | 2 +- test/unit/Traits/CanPayoutWithCustomerTest.php | 2 +- test/unit/Traits/CanRecurTest.php | 2 +- test/unit/Traits/HasCancellationsTest.php | 2 +- test/unit/Traits/HasInvoiceIdTest.php | 2 +- test/unit/Traits/HasPaymentStateTest.php | 2 +- test/unit/Traits/TraitDummyCanRecur.php | 2 +- test/unit/Traits/TraitDummyCanRecurNonResource.php | 2 +- test/unit/Traits/TraitDummyHasCancellationsHasPaymentState.php | 2 +- test/unit/Traits/TraitDummyHasInvoiceId.php | 2 +- test/unit/Traits/TraitDummyWithCustomerWithParentIF.php | 2 +- test/unit/Traits/TraitDummyWithCustomerWithoutParentIF.php | 2 +- test/unit/Traits/TraitDummyWithoutCustomerWithParentIF.php | 2 +- test/unit/Traits/TraitDummyWithoutCustomerWithoutParentIF.php | 2 +- test/unit/Validators/PrivateKeyValidatorTest.php | 2 +- test/unit/Validators/PublicKeyValidatorTest.php | 2 +- 268 files changed, 268 insertions(+), 268 deletions(-) diff --git a/examples/Alipay/Constants.php b/examples/Alipay/Constants.php index 8a52ef6e..de175dba 100755 --- a/examples/Alipay/Constants.php +++ b/examples/Alipay/Constants.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/examples + * @package heidelpayPHP\examples */ require_once __DIR__ . '/../Constants.php'; diff --git a/examples/Alipay/Controller.php b/examples/Alipay/Controller.php index 8ffb0424..928457c4 100755 --- a/examples/Alipay/Controller.php +++ b/examples/Alipay/Controller.php @@ -21,7 +21,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/examples + * @package heidelpayPHP\examples */ /** Require the constants of this example */ diff --git a/examples/Alipay/ReturnController.php b/examples/Alipay/ReturnController.php index 134c9081..f0849f47 100755 --- a/examples/Alipay/ReturnController.php +++ b/examples/Alipay/ReturnController.php @@ -21,7 +21,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/examples + * @package heidelpayPHP\examples */ /** Require the constants of this example */ diff --git a/examples/Alipay/index.php b/examples/Alipay/index.php index 351da9f7..097f6f08 100755 --- a/examples/Alipay/index.php +++ b/examples/Alipay/index.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/examples + * @package heidelpayPHP\examples */ /** Require the constants of this example */ diff --git a/examples/Card/Constants.php b/examples/Card/Constants.php index 9b435a5d..1c771888 100644 --- a/examples/Card/Constants.php +++ b/examples/Card/Constants.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/examples + * @package heidelpayPHP\examples */ require_once __DIR__ . '/../Constants.php'; diff --git a/examples/Card/Controller.php b/examples/Card/Controller.php index 4d51c584..e2b0617f 100644 --- a/examples/Card/Controller.php +++ b/examples/Card/Controller.php @@ -21,7 +21,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/examples + * @package heidelpayPHP\examples */ /** Require the constants of this example */ diff --git a/examples/Card/ReturnController.php b/examples/Card/ReturnController.php index 30027af2..b9d8643e 100644 --- a/examples/Card/ReturnController.php +++ b/examples/Card/ReturnController.php @@ -21,7 +21,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/examples + * @package heidelpayPHP\examples */ /** Require the constants of this example */ diff --git a/examples/Card/index.php b/examples/Card/index.php index deec55a2..f2b93d4f 100644 --- a/examples/Card/index.php +++ b/examples/Card/index.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/examples + * @package heidelpayPHP\examples */ /** Require the constants of this example */ diff --git a/examples/CardRecurring/Constants.php b/examples/CardRecurring/Constants.php index 159947bc..a19a0395 100644 --- a/examples/CardRecurring/Constants.php +++ b/examples/CardRecurring/Constants.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/examples + * @package heidelpayPHP\examples */ require_once __DIR__ . '/../Constants.php'; diff --git a/examples/CardRecurring/Controller.php b/examples/CardRecurring/Controller.php index c42aa363..33fde55a 100644 --- a/examples/CardRecurring/Controller.php +++ b/examples/CardRecurring/Controller.php @@ -21,7 +21,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/examples + * @package heidelpayPHP\examples */ /** Require the constants of this example */ diff --git a/examples/CardRecurring/ReturnController.php b/examples/CardRecurring/ReturnController.php index 61f7b3e2..ec55455d 100644 --- a/examples/CardRecurring/ReturnController.php +++ b/examples/CardRecurring/ReturnController.php @@ -21,7 +21,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/examples + * @package heidelpayPHP\examples */ /** Require the constants of this example */ diff --git a/examples/CardRecurring/index.php b/examples/CardRecurring/index.php index edfdf07b..66de9978 100644 --- a/examples/CardRecurring/index.php +++ b/examples/CardRecurring/index.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/examples + * @package heidelpayPHP\examples */ /** Require the constants of this example */ diff --git a/examples/Constants.php b/examples/Constants.php index 8e255cc4..c9e201d5 100755 --- a/examples/Constants.php +++ b/examples/Constants.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/examples + * @package heidelpayPHP\examples */ require_once __DIR__ . '/_enableExamples.php'; diff --git a/examples/EPSCharge/Constants.php b/examples/EPSCharge/Constants.php index 0c478e3e..c14c7ed3 100755 --- a/examples/EPSCharge/Constants.php +++ b/examples/EPSCharge/Constants.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/examples + * @package heidelpayPHP\examples */ require_once __DIR__ . '/../Constants.php'; diff --git a/examples/EPSCharge/Controller.php b/examples/EPSCharge/Controller.php index 7717e1fd..d40824ba 100755 --- a/examples/EPSCharge/Controller.php +++ b/examples/EPSCharge/Controller.php @@ -21,7 +21,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/examples + * @package heidelpayPHP\examples */ /** Require the constants of this example */ diff --git a/examples/EPSCharge/ReturnController.php b/examples/EPSCharge/ReturnController.php index d430a1ec..281ed67d 100755 --- a/examples/EPSCharge/ReturnController.php +++ b/examples/EPSCharge/ReturnController.php @@ -21,7 +21,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/examples + * @package heidelpayPHP\examples */ /** Require the constants of this example */ diff --git a/examples/EPSCharge/index.php b/examples/EPSCharge/index.php index 33dbb0d4..efa72abf 100755 --- a/examples/EPSCharge/index.php +++ b/examples/EPSCharge/index.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/examples + * @package heidelpayPHP\examples */ /** Require the constants of this example */ diff --git a/examples/EmbeddedPayPage/Constants.php b/examples/EmbeddedPayPage/Constants.php index dc2d130a..0c9971ad 100644 --- a/examples/EmbeddedPayPage/Constants.php +++ b/examples/EmbeddedPayPage/Constants.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/examples + * @package heidelpayPHP\examples */ require_once __DIR__ . '/../Constants.php'; diff --git a/examples/EmbeddedPayPage/Controller.php b/examples/EmbeddedPayPage/Controller.php index 073d2a4c..9701e0b1 100644 --- a/examples/EmbeddedPayPage/Controller.php +++ b/examples/EmbeddedPayPage/Controller.php @@ -21,7 +21,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/examples + * @package heidelpayPHP\examples */ /** Require the constants of this example */ diff --git a/examples/EmbeddedPayPage/ReturnController.php b/examples/EmbeddedPayPage/ReturnController.php index d749eb62..0b629e77 100644 --- a/examples/EmbeddedPayPage/ReturnController.php +++ b/examples/EmbeddedPayPage/ReturnController.php @@ -21,7 +21,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/examples + * @package heidelpayPHP\examples */ /** Require the constants of this example */ diff --git a/examples/EmbeddedPayPage/index.php b/examples/EmbeddedPayPage/index.php index a87e0b1c..3a7e8477 100644 --- a/examples/EmbeddedPayPage/index.php +++ b/examples/EmbeddedPayPage/index.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/examples + * @package heidelpayPHP\examples */ /** Require the constants of this example */ diff --git a/examples/ExampleDebugHandler.php b/examples/ExampleDebugHandler.php index 30f6f3ce..7470e992 100755 --- a/examples/ExampleDebugHandler.php +++ b/examples/ExampleDebugHandler.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/integration + * @package heidelpayPHP\examples */ namespace heidelpayPHP\examples; diff --git a/examples/Failure.php b/examples/Failure.php index 0ccebe6c..6e91d18e 100755 --- a/examples/Failure.php +++ b/examples/Failure.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/examples + * @package heidelpayPHP\examples */ session_start(); diff --git a/examples/FlexiPayDirect/Constants.php b/examples/FlexiPayDirect/Constants.php index 3383271a..f1083075 100644 --- a/examples/FlexiPayDirect/Constants.php +++ b/examples/FlexiPayDirect/Constants.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/examples + * @package heidelpayPHP\examples */ require_once __DIR__ . '/../Constants.php'; diff --git a/examples/FlexiPayDirect/Controller.php b/examples/FlexiPayDirect/Controller.php index b85f1b03..f300d237 100644 --- a/examples/FlexiPayDirect/Controller.php +++ b/examples/FlexiPayDirect/Controller.php @@ -21,7 +21,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/examples + * @package heidelpayPHP\examples */ /** Require the constants of this example */ diff --git a/examples/FlexiPayDirect/ReturnController.php b/examples/FlexiPayDirect/ReturnController.php index 0652af91..80cc0607 100644 --- a/examples/FlexiPayDirect/ReturnController.php +++ b/examples/FlexiPayDirect/ReturnController.php @@ -21,7 +21,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/examples + * @package heidelpayPHP\examples */ /** Require the constants of this example */ diff --git a/examples/FlexiPayDirect/index.php b/examples/FlexiPayDirect/index.php index 5436330f..b22e0bab 100644 --- a/examples/FlexiPayDirect/index.php +++ b/examples/FlexiPayDirect/index.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/examples + * @package heidelpayPHP\examples */ /** Require the constants of this example */ diff --git a/examples/Giropay/Constants.php b/examples/Giropay/Constants.php index 965bd7f1..a6eb41b5 100644 --- a/examples/Giropay/Constants.php +++ b/examples/Giropay/Constants.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/examples + * @package heidelpayPHP\examples */ require_once __DIR__ . '/../Constants.php'; diff --git a/examples/Giropay/Controller.php b/examples/Giropay/Controller.php index 4c6f174e..fe2cd842 100644 --- a/examples/Giropay/Controller.php +++ b/examples/Giropay/Controller.php @@ -21,7 +21,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/examples + * @package heidelpayPHP\examples */ /** Require the constants of this example */ diff --git a/examples/Giropay/ReturnController.php b/examples/Giropay/ReturnController.php index 1ea23f84..9ed4728e 100644 --- a/examples/Giropay/ReturnController.php +++ b/examples/Giropay/ReturnController.php @@ -21,7 +21,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/examples + * @package heidelpayPHP\examples */ /** Require the constants of this example */ diff --git a/examples/Giropay/index.php b/examples/Giropay/index.php index 875c4ac5..531229a8 100644 --- a/examples/Giropay/index.php +++ b/examples/Giropay/index.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/examples + * @package heidelpayPHP\examples */ /** Require the constants of this example */ diff --git a/examples/HirePurchaseDirectDebit/Constants.php b/examples/HirePurchaseDirectDebit/Constants.php index 44384ce0..9337754e 100644 --- a/examples/HirePurchaseDirectDebit/Constants.php +++ b/examples/HirePurchaseDirectDebit/Constants.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/examples + * @package heidelpayPHP\examples */ require_once __DIR__ . '/../Constants.php'; diff --git a/examples/HirePurchaseDirectDebit/Controller.php b/examples/HirePurchaseDirectDebit/Controller.php index fe8b18e5..21efa1f0 100644 --- a/examples/HirePurchaseDirectDebit/Controller.php +++ b/examples/HirePurchaseDirectDebit/Controller.php @@ -21,7 +21,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/examples + * @package heidelpayPHP\examples */ /** Require the constants of this example */ diff --git a/examples/HirePurchaseDirectDebit/PlaceOrderController.php b/examples/HirePurchaseDirectDebit/PlaceOrderController.php index 822b5464..214721a3 100644 --- a/examples/HirePurchaseDirectDebit/PlaceOrderController.php +++ b/examples/HirePurchaseDirectDebit/PlaceOrderController.php @@ -21,7 +21,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/examples + * @package heidelpayPHP\examples */ /** Require the constants of this example */ diff --git a/examples/HirePurchaseDirectDebit/confirm.php b/examples/HirePurchaseDirectDebit/confirm.php index 99ad8858..fb58d3e4 100644 --- a/examples/HirePurchaseDirectDebit/confirm.php +++ b/examples/HirePurchaseDirectDebit/confirm.php @@ -21,7 +21,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/examples + * @package heidelpayPHP\examples */ /** Require the constants of this example */ diff --git a/examples/HirePurchaseDirectDebit/index.php b/examples/HirePurchaseDirectDebit/index.php index 46985f65..e6a4c1fa 100644 --- a/examples/HirePurchaseDirectDebit/index.php +++ b/examples/HirePurchaseDirectDebit/index.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/examples + * @package heidelpayPHP\examples */ /** Require the constants of this example */ diff --git a/examples/HostedPayPage/Constants.php b/examples/HostedPayPage/Constants.php index 7607650b..081007ab 100644 --- a/examples/HostedPayPage/Constants.php +++ b/examples/HostedPayPage/Constants.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/examples + * @package heidelpayPHP\examples */ require_once __DIR__ . '/../Constants.php'; diff --git a/examples/HostedPayPage/Controller.php b/examples/HostedPayPage/Controller.php index 5db8504e..771a6ba7 100644 --- a/examples/HostedPayPage/Controller.php +++ b/examples/HostedPayPage/Controller.php @@ -21,7 +21,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/examples + * @package heidelpayPHP\examples */ /** Require the constants of this example */ diff --git a/examples/HostedPayPage/ReturnController.php b/examples/HostedPayPage/ReturnController.php index 6c465222..462b8840 100644 --- a/examples/HostedPayPage/ReturnController.php +++ b/examples/HostedPayPage/ReturnController.php @@ -21,7 +21,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/examples + * @package heidelpayPHP\examples */ /** Require the constants of this example */ diff --git a/examples/HostedPayPage/index.php b/examples/HostedPayPage/index.php index 75020623..fc9e1560 100644 --- a/examples/HostedPayPage/index.php +++ b/examples/HostedPayPage/index.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/examples + * @package heidelpayPHP\examples */ /** Require the constants of this example */ diff --git a/examples/IDeal/Constants.php b/examples/IDeal/Constants.php index 3b83bf92..3b19c11a 100644 --- a/examples/IDeal/Constants.php +++ b/examples/IDeal/Constants.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/examples + * @package heidelpayPHP\examples */ require_once __DIR__ . '/../Constants.php'; diff --git a/examples/IDeal/Controller.php b/examples/IDeal/Controller.php index 37aaaabf..a413e01c 100644 --- a/examples/IDeal/Controller.php +++ b/examples/IDeal/Controller.php @@ -21,7 +21,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/examples + * @package heidelpayPHP\examples */ /** Require the constants of this example */ diff --git a/examples/IDeal/ReturnController.php b/examples/IDeal/ReturnController.php index f8e6bf5b..062617b6 100644 --- a/examples/IDeal/ReturnController.php +++ b/examples/IDeal/ReturnController.php @@ -21,7 +21,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/examples + * @package heidelpayPHP\examples */ /** Require the constants of this example */ diff --git a/examples/IDeal/index.php b/examples/IDeal/index.php index fde3cfe1..e4504589 100644 --- a/examples/IDeal/index.php +++ b/examples/IDeal/index.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/examples + * @package heidelpayPHP\examples */ /** Require the constants of this example */ diff --git a/examples/Invoice/Constants.php b/examples/Invoice/Constants.php index ea7321bc..5f0e575d 100644 --- a/examples/Invoice/Constants.php +++ b/examples/Invoice/Constants.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/examples + * @package heidelpayPHP\examples */ require_once __DIR__ . '/../Constants.php'; diff --git a/examples/Invoice/Controller.php b/examples/Invoice/Controller.php index 8a2aaafe..ea343cfe 100644 --- a/examples/Invoice/Controller.php +++ b/examples/Invoice/Controller.php @@ -21,7 +21,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/examples + * @package heidelpayPHP\examples */ /** Require the constants of this example */ diff --git a/examples/Invoice/index.php b/examples/Invoice/index.php index d3c1a749..0b266c72 100644 --- a/examples/Invoice/index.php +++ b/examples/Invoice/index.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/examples + * @package heidelpayPHP\examples */ /** Require the constants of this example */ diff --git a/examples/InvoiceFactoring/Constants.php b/examples/InvoiceFactoring/Constants.php index 086b83ff..881b469b 100755 --- a/examples/InvoiceFactoring/Constants.php +++ b/examples/InvoiceFactoring/Constants.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/examples + * @package heidelpayPHP\examples */ require_once __DIR__ . '/../Constants.php'; diff --git a/examples/InvoiceFactoring/Controller.php b/examples/InvoiceFactoring/Controller.php index 8a608352..11e7e9cc 100755 --- a/examples/InvoiceFactoring/Controller.php +++ b/examples/InvoiceFactoring/Controller.php @@ -21,7 +21,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/examples + * @package heidelpayPHP\examples */ /** Require the constants of this example */ diff --git a/examples/InvoiceFactoring/index.php b/examples/InvoiceFactoring/index.php index dc8ee4a5..9fa317ad 100755 --- a/examples/InvoiceFactoring/index.php +++ b/examples/InvoiceFactoring/index.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/examples + * @package heidelpayPHP\examples */ /** Require the constants of this example */ diff --git a/examples/InvoiceGuaranteed/Constants.php b/examples/InvoiceGuaranteed/Constants.php index d6a1dbf4..1fba835f 100755 --- a/examples/InvoiceGuaranteed/Constants.php +++ b/examples/InvoiceGuaranteed/Constants.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/examples + * @package heidelpayPHP\examples */ require_once __DIR__ . '/../Constants.php'; diff --git a/examples/InvoiceGuaranteed/Controller.php b/examples/InvoiceGuaranteed/Controller.php index ade773ca..e4c9c37c 100755 --- a/examples/InvoiceGuaranteed/Controller.php +++ b/examples/InvoiceGuaranteed/Controller.php @@ -21,7 +21,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/examples + * @package heidelpayPHP\examples */ /** Require the constants of this example */ diff --git a/examples/InvoiceGuaranteed/index.php b/examples/InvoiceGuaranteed/index.php index b8124be7..901be706 100755 --- a/examples/InvoiceGuaranteed/index.php +++ b/examples/InvoiceGuaranteed/index.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/examples + * @package heidelpayPHP\examples */ /** Require the constants of this example */ diff --git a/examples/PayPal/Constants.php b/examples/PayPal/Constants.php index 92dcec72..888622dd 100755 --- a/examples/PayPal/Constants.php +++ b/examples/PayPal/Constants.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/examples + * @package heidelpayPHP\examples */ require_once __DIR__ . '/../Constants.php'; diff --git a/examples/PayPal/Controller.php b/examples/PayPal/Controller.php index 6bd0cc33..8bc6d904 100755 --- a/examples/PayPal/Controller.php +++ b/examples/PayPal/Controller.php @@ -21,7 +21,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/examples + * @package heidelpayPHP\examples */ /** Require the constants of this example */ diff --git a/examples/PayPal/ReturnController.php b/examples/PayPal/ReturnController.php index 77927dd8..9d27c94b 100755 --- a/examples/PayPal/ReturnController.php +++ b/examples/PayPal/ReturnController.php @@ -21,7 +21,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/examples + * @package heidelpayPHP\examples */ /** Require the constants of this example */ diff --git a/examples/PayPal/index.php b/examples/PayPal/index.php index 58fa9b8a..5f4dac2e 100755 --- a/examples/PayPal/index.php +++ b/examples/PayPal/index.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/examples + * @package heidelpayPHP\examples */ /** Require the constants of this example */ diff --git a/examples/PayPalRecurring/Constants.php b/examples/PayPalRecurring/Constants.php index 5a39ce80..5a4a9e3d 100644 --- a/examples/PayPalRecurring/Constants.php +++ b/examples/PayPalRecurring/Constants.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/examples + * @package heidelpayPHP\examples */ require_once __DIR__ . '/../Constants.php'; diff --git a/examples/PayPalRecurring/Controller.php b/examples/PayPalRecurring/Controller.php index cbbbf3b4..8a2afdc0 100644 --- a/examples/PayPalRecurring/Controller.php +++ b/examples/PayPalRecurring/Controller.php @@ -21,7 +21,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/examples + * @package heidelpayPHP\examples */ /** Require the constants of this example */ diff --git a/examples/PayPalRecurring/ReturnController.php b/examples/PayPalRecurring/ReturnController.php index 239af0ee..212260a6 100644 --- a/examples/PayPalRecurring/ReturnController.php +++ b/examples/PayPalRecurring/ReturnController.php @@ -21,7 +21,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/examples + * @package heidelpayPHP\examples */ /** Require the constants of this example */ diff --git a/examples/PayPalRecurring/index.php b/examples/PayPalRecurring/index.php index 57562714..80061feb 100644 --- a/examples/PayPalRecurring/index.php +++ b/examples/PayPalRecurring/index.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/examples + * @package heidelpayPHP\examples */ /** Require the constants of this example */ diff --git a/examples/Pending.php b/examples/Pending.php index 8ec019e5..095f1913 100644 --- a/examples/Pending.php +++ b/examples/Pending.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/examples + * @package heidelpayPHP\examples */ session_start(); diff --git a/examples/Prepayment/Constants.php b/examples/Prepayment/Constants.php index 2712f389..abd7bfce 100644 --- a/examples/Prepayment/Constants.php +++ b/examples/Prepayment/Constants.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/examples + * @package heidelpayPHP\examples */ require_once __DIR__ . '/../Constants.php'; diff --git a/examples/Prepayment/Controller.php b/examples/Prepayment/Controller.php index b33ad4d4..bbe2062a 100644 --- a/examples/Prepayment/Controller.php +++ b/examples/Prepayment/Controller.php @@ -21,7 +21,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/examples + * @package heidelpayPHP\examples */ /** Require the constants of this example */ diff --git a/examples/Prepayment/index.php b/examples/Prepayment/index.php index dedf71df..3ed893b5 100644 --- a/examples/Prepayment/index.php +++ b/examples/Prepayment/index.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/examples + * @package heidelpayPHP\examples */ /** Require the constants of this example */ diff --git a/examples/SepaDirectDebitGuaranteed/Constants.php b/examples/SepaDirectDebitGuaranteed/Constants.php index 9fe3b385..032db55a 100755 --- a/examples/SepaDirectDebitGuaranteed/Constants.php +++ b/examples/SepaDirectDebitGuaranteed/Constants.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/examples + * @package heidelpayPHP\examples */ require_once __DIR__ . '/../Constants.php'; diff --git a/examples/SepaDirectDebitGuaranteed/Controller.php b/examples/SepaDirectDebitGuaranteed/Controller.php index c65dc303..40482b55 100755 --- a/examples/SepaDirectDebitGuaranteed/Controller.php +++ b/examples/SepaDirectDebitGuaranteed/Controller.php @@ -21,7 +21,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/examples + * @package heidelpayPHP\examples */ /** Require the constants of this example */ diff --git a/examples/SepaDirectDebitGuaranteed/index.php b/examples/SepaDirectDebitGuaranteed/index.php index a5cb0906..d9045d7a 100755 --- a/examples/SepaDirectDebitGuaranteed/index.php +++ b/examples/SepaDirectDebitGuaranteed/index.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/examples + * @package heidelpayPHP\examples */ /** Require the constants of this example */ diff --git a/examples/Sofort/Constants.php b/examples/Sofort/Constants.php index 5f6a72ab..8785ae8d 100644 --- a/examples/Sofort/Constants.php +++ b/examples/Sofort/Constants.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/examples + * @package heidelpayPHP\examples */ require_once __DIR__ . '/../Constants.php'; diff --git a/examples/Sofort/Controller.php b/examples/Sofort/Controller.php index aef5746d..8dbf7089 100644 --- a/examples/Sofort/Controller.php +++ b/examples/Sofort/Controller.php @@ -21,7 +21,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/examples + * @package heidelpayPHP\examples */ /** Require the constants of this example */ diff --git a/examples/Sofort/ReturnController.php b/examples/Sofort/ReturnController.php index 35cdcfe3..f35102ef 100644 --- a/examples/Sofort/ReturnController.php +++ b/examples/Sofort/ReturnController.php @@ -21,7 +21,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/examples + * @package heidelpayPHP\examples */ /** Require the constants of this example */ diff --git a/examples/Sofort/index.php b/examples/Sofort/index.php index 5f2b6a01..4f48f4d9 100644 --- a/examples/Sofort/index.php +++ b/examples/Sofort/index.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/examples + * @package heidelpayPHP\examples */ /** Require the constants of this example */ diff --git a/examples/Success.php b/examples/Success.php index eac88ffa..d7f3c0da 100755 --- a/examples/Success.php +++ b/examples/Success.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/examples + * @package heidelpayPHP\examples */ session_start(); diff --git a/examples/Webhooks/Constants.php b/examples/Webhooks/Constants.php index 77628792..f856edc8 100755 --- a/examples/Webhooks/Constants.php +++ b/examples/Webhooks/Constants.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/examples + * @package heidelpayPHP\examples */ require_once __DIR__ . '/../Constants.php'; diff --git a/examples/Webhooks/Controller.php b/examples/Webhooks/Controller.php index 0c75d2e4..bf6ee32b 100755 --- a/examples/Webhooks/Controller.php +++ b/examples/Webhooks/Controller.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/examples + * @package heidelpayPHP\examples */ /** Require the constants of this example */ diff --git a/examples/Webhooks/fetchAll.php b/examples/Webhooks/fetchAll.php index 8d6b10c9..9acb25ab 100644 --- a/examples/Webhooks/fetchAll.php +++ b/examples/Webhooks/fetchAll.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/examples + * @package heidelpayPHP\examples */ /** Require the constants of this example */ diff --git a/examples/Webhooks/index.php b/examples/Webhooks/index.php index 6c7adb99..c8e5dacf 100755 --- a/examples/Webhooks/index.php +++ b/examples/Webhooks/index.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/examples + * @package heidelpayPHP\examples */ /** Require the constants of this example */ diff --git a/examples/Webhooks/removeAll.php b/examples/Webhooks/removeAll.php index fc21ecf9..caf440f8 100755 --- a/examples/Webhooks/removeAll.php +++ b/examples/Webhooks/removeAll.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/examples + * @package heidelpayPHP\examples */ /** Require the constants of this example */ diff --git a/examples/Wechatpay/Constants.php b/examples/Wechatpay/Constants.php index 49d9c9da..807c63e9 100755 --- a/examples/Wechatpay/Constants.php +++ b/examples/Wechatpay/Constants.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/examples + * @package heidelpayPHP\examples */ require_once __DIR__ . '/../Constants.php'; diff --git a/examples/Wechatpay/Controller.php b/examples/Wechatpay/Controller.php index af9b9ffe..041c993d 100755 --- a/examples/Wechatpay/Controller.php +++ b/examples/Wechatpay/Controller.php @@ -21,7 +21,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/examples + * @package heidelpayPHP\examples */ /** Require the constants of this example */ diff --git a/examples/Wechatpay/ReturnController.php b/examples/Wechatpay/ReturnController.php index 322a4fd6..a50c0073 100755 --- a/examples/Wechatpay/ReturnController.php +++ b/examples/Wechatpay/ReturnController.php @@ -21,7 +21,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/examples + * @package heidelpayPHP\examples */ /** Require the constants of this example */ diff --git a/examples/Wechatpay/index.php b/examples/Wechatpay/index.php index 086c984b..80fb6b88 100755 --- a/examples/Wechatpay/index.php +++ b/examples/Wechatpay/index.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/examples + * @package heidelpayPHP\examples */ /** Require the constants of this example */ diff --git a/examples/_enableExamples.php b/examples/_enableExamples.php index 3bd68308..e4c5a4cd 100755 --- a/examples/_enableExamples.php +++ b/examples/_enableExamples.php @@ -22,7 +22,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/examples + * @package heidelpayPHP\examples */ /* Set to true if you want to enable the examples */ diff --git a/examples/index.php b/examples/index.php index 18bfd314..8bbfcd06 100755 --- a/examples/index.php +++ b/examples/index.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/examples + * @package heidelpayPHP\examples */ /** Require the constants of this example */ diff --git a/src/Adapter/CurlAdapter.php b/src/Adapter/CurlAdapter.php index a9d421dc..ef8f010d 100755 --- a/src/Adapter/CurlAdapter.php +++ b/src/Adapter/CurlAdapter.php @@ -21,7 +21,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/adapter + * @package heidelpayPHP\Adapter */ namespace heidelpayPHP\Adapter; diff --git a/src/Adapter/HttpAdapterInterface.php b/src/Adapter/HttpAdapterInterface.php index d58ef09e..264a350b 100755 --- a/src/Adapter/HttpAdapterInterface.php +++ b/src/Adapter/HttpAdapterInterface.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/adapter + * @package heidelpayPHP\Adapter */ namespace heidelpayPHP\Adapter; diff --git a/src/Constants/ApiResponseCodes.php b/src/Constants/ApiResponseCodes.php index ca4dc4b7..3dbf4601 100755 --- a/src/Constants/ApiResponseCodes.php +++ b/src/Constants/ApiResponseCodes.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/constants + * @package heidelpayPHP\Constants */ namespace heidelpayPHP\Constants; diff --git a/src/Constants/BasketItemTypes.php b/src/Constants/BasketItemTypes.php index c9a042bd..60ec2b20 100644 --- a/src/Constants/BasketItemTypes.php +++ b/src/Constants/BasketItemTypes.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/constants + * @package heidelpayPHP\Constants */ namespace heidelpayPHP\Constants; diff --git a/src/Constants/CancelReasonCodes.php b/src/Constants/CancelReasonCodes.php index 42c864ef..7aa80db1 100755 --- a/src/Constants/CancelReasonCodes.php +++ b/src/Constants/CancelReasonCodes.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/constants + * @package heidelpayPHP\Constants */ namespace heidelpayPHP\Constants; diff --git a/src/Constants/CompanyCommercialSectorItems.php b/src/Constants/CompanyCommercialSectorItems.php index 479bec9a..3660b955 100644 --- a/src/Constants/CompanyCommercialSectorItems.php +++ b/src/Constants/CompanyCommercialSectorItems.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/constants + * @package heidelpayPHP\Constants */ namespace heidelpayPHP\Constants; diff --git a/src/Constants/CompanyRegistrationTypes.php b/src/Constants/CompanyRegistrationTypes.php index d52ae718..c3026e92 100644 --- a/src/Constants/CompanyRegistrationTypes.php +++ b/src/Constants/CompanyRegistrationTypes.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/constants + * @package heidelpayPHP\Constants */ namespace heidelpayPHP\Constants; diff --git a/src/Constants/IdStrings.php b/src/Constants/IdStrings.php index 37c92046..0530f832 100755 --- a/src/Constants/IdStrings.php +++ b/src/Constants/IdStrings.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/constants + * @package heidelpayPHP\Constants */ namespace heidelpayPHP\Constants; diff --git a/src/Constants/PaymentState.php b/src/Constants/PaymentState.php index bddc7fce..208eb1c4 100755 --- a/src/Constants/PaymentState.php +++ b/src/Constants/PaymentState.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/constants + * @package heidelpayPHP\Constants */ namespace heidelpayPHP\Constants; diff --git a/src/Constants/Salutations.php b/src/Constants/Salutations.php index 5c8d9bca..ac30098c 100755 --- a/src/Constants/Salutations.php +++ b/src/Constants/Salutations.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/constants + * @package heidelpayPHP\Constants */ namespace heidelpayPHP\Constants; diff --git a/src/Constants/TransactionTypes.php b/src/Constants/TransactionTypes.php index 887fd054..21460400 100755 --- a/src/Constants/TransactionTypes.php +++ b/src/Constants/TransactionTypes.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/constants + * @package heidelpayPHP\Constants */ namespace heidelpayPHP\Constants; diff --git a/src/Constants/WebhookEvents.php b/src/Constants/WebhookEvents.php index 85e06139..e6b5f0ae 100755 --- a/src/Constants/WebhookEvents.php +++ b/src/Constants/WebhookEvents.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/constants + * @package heidelpayPHP\Constants */ namespace heidelpayPHP\Constants; diff --git a/src/Exceptions/HeidelpayApiException.php b/src/Exceptions/HeidelpayApiException.php index 9eb52118..e730afa7 100755 --- a/src/Exceptions/HeidelpayApiException.php +++ b/src/Exceptions/HeidelpayApiException.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/exceptions + * @package heidelpayPHP\Exceptions */ namespace heidelpayPHP\Exceptions; diff --git a/src/Interfaces/DebugHandlerInterface.php b/src/Interfaces/DebugHandlerInterface.php index 111b89a0..e8be9cd8 100755 --- a/src/Interfaces/DebugHandlerInterface.php +++ b/src/Interfaces/DebugHandlerInterface.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/interfaces + * @package heidelpayPHP\Interfaces */ namespace heidelpayPHP\Interfaces; diff --git a/src/Interfaces/HeidelpayParentInterface.php b/src/Interfaces/HeidelpayParentInterface.php index b608a38e..14cbdcaf 100755 --- a/src/Interfaces/HeidelpayParentInterface.php +++ b/src/Interfaces/HeidelpayParentInterface.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/interfaces + * @package heidelpayPHP\Interfaces */ namespace heidelpayPHP\Interfaces; diff --git a/src/Resources/AbstractHeidelpayResource.php b/src/Resources/AbstractHeidelpayResource.php index ec18fcd9..2b788fe5 100755 --- a/src/Resources/AbstractHeidelpayResource.php +++ b/src/Resources/AbstractHeidelpayResource.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/Resources + * @package heidelpayPHP\Resources */ namespace heidelpayPHP\Resources; diff --git a/src/Resources/Basket.php b/src/Resources/Basket.php index 95be8ed2..b96c41ba 100755 --- a/src/Resources/Basket.php +++ b/src/Resources/Basket.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/resources + * @package heidelpayPHP\Resources */ namespace heidelpayPHP\Resources; diff --git a/src/Resources/Customer.php b/src/Resources/Customer.php index dcaaada1..6ebd728e 100755 --- a/src/Resources/Customer.php +++ b/src/Resources/Customer.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/resources + * @package heidelpayPHP\Resources */ namespace heidelpayPHP\Resources; diff --git a/src/Resources/CustomerFactory.php b/src/Resources/CustomerFactory.php index b176d2e6..59127e8f 100644 --- a/src/Resources/CustomerFactory.php +++ b/src/Resources/CustomerFactory.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/resources + * @package heidelpayPHP\Resources */ namespace heidelpayPHP\Resources; diff --git a/src/Resources/EmbeddedResources/Address.php b/src/Resources/EmbeddedResources/Address.php index 50aabfa2..cf88d362 100755 --- a/src/Resources/EmbeddedResources/Address.php +++ b/src/Resources/EmbeddedResources/Address.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/resources/embedded_resources + * @package heidelpayPHP\Resources\EmbeddedResources */ namespace heidelpayPHP\Resources\EmbeddedResources; diff --git a/src/Resources/EmbeddedResources/Amount.php b/src/Resources/EmbeddedResources/Amount.php index e12c8d19..de39bbfc 100755 --- a/src/Resources/EmbeddedResources/Amount.php +++ b/src/Resources/EmbeddedResources/Amount.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/resources/embedded_resources + * @package heidelpayPHP\Resources\EmbeddedResources */ namespace heidelpayPHP\Resources\EmbeddedResources; diff --git a/src/Resources/EmbeddedResources/BasketItem.php b/src/Resources/EmbeddedResources/BasketItem.php index d90ba1dd..d3d9b583 100755 --- a/src/Resources/EmbeddedResources/BasketItem.php +++ b/src/Resources/EmbeddedResources/BasketItem.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/resources/embedded_resources + * @package heidelpayPHP\Resources\EmbeddedResources */ namespace heidelpayPHP\Resources\EmbeddedResources; diff --git a/src/Resources/EmbeddedResources/CardDetails.php b/src/Resources/EmbeddedResources/CardDetails.php index b0832abd..8b6a80e3 100644 --- a/src/Resources/EmbeddedResources/CardDetails.php +++ b/src/Resources/EmbeddedResources/CardDetails.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/resources/embedded_resources + * @package heidelpayPHP\Resources\EmbeddedResources */ namespace heidelpayPHP\Resources\EmbeddedResources; diff --git a/src/Resources/EmbeddedResources/CompanyInfo.php b/src/Resources/EmbeddedResources/CompanyInfo.php index 36b8d084..f5dd3018 100644 --- a/src/Resources/EmbeddedResources/CompanyInfo.php +++ b/src/Resources/EmbeddedResources/CompanyInfo.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/resources/embedded_resources + * @package heidelpayPHP\Resources\EmbeddedResources */ namespace heidelpayPHP\Resources\EmbeddedResources; diff --git a/src/Resources/EmbeddedResources/GeoLocation.php b/src/Resources/EmbeddedResources/GeoLocation.php index 35ef3933..aba16a81 100644 --- a/src/Resources/EmbeddedResources/GeoLocation.php +++ b/src/Resources/EmbeddedResources/GeoLocation.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/resources/embedded_resources + * @package heidelpayPHP\Resources\EmbeddedResources */ namespace heidelpayPHP\Resources\EmbeddedResources; diff --git a/src/Resources/EmbeddedResources/Message.php b/src/Resources/EmbeddedResources/Message.php index 10768f95..0ea439d7 100755 --- a/src/Resources/EmbeddedResources/Message.php +++ b/src/Resources/EmbeddedResources/Message.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/resources/embedded_resources + * @package heidelpayPHP\Resources\EmbeddedResources */ namespace heidelpayPHP\Resources\EmbeddedResources; diff --git a/src/Resources/InstalmentPlan.php b/src/Resources/InstalmentPlan.php index 92ad0c31..5468342e 100644 --- a/src/Resources/InstalmentPlan.php +++ b/src/Resources/InstalmentPlan.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/resources + * @package heidelpayPHP\Resources */ namespace heidelpayPHP\Resources; diff --git a/src/Resources/InstalmentPlans.php b/src/Resources/InstalmentPlans.php index 9b4b3aa3..70cc8b2e 100644 --- a/src/Resources/InstalmentPlans.php +++ b/src/Resources/InstalmentPlans.php @@ -22,7 +22,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/resources + * @package heidelpayPHP\Resources */ namespace heidelpayPHP\Resources; diff --git a/src/Resources/Keypair.php b/src/Resources/Keypair.php index 1c2cbee5..5914ac96 100755 --- a/src/Resources/Keypair.php +++ b/src/Resources/Keypair.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/resources + * @package heidelpayPHP\Resources */ namespace heidelpayPHP\Resources; diff --git a/src/Resources/Metadata.php b/src/Resources/Metadata.php index 5b26f472..32bdbc2c 100755 --- a/src/Resources/Metadata.php +++ b/src/Resources/Metadata.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/resources + * @package heidelpayPHP\Resources */ namespace heidelpayPHP\Resources; diff --git a/src/Resources/Payment.php b/src/Resources/Payment.php index b7c6724c..21181d9d 100755 --- a/src/Resources/Payment.php +++ b/src/Resources/Payment.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/resources + * @package heidelpayPHP\Resources */ namespace heidelpayPHP\Resources; diff --git a/src/Resources/PaymentTypes/Alipay.php b/src/Resources/PaymentTypes/Alipay.php index 225c8b63..caf32c87 100755 --- a/src/Resources/PaymentTypes/Alipay.php +++ b/src/Resources/PaymentTypes/Alipay.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/payment_types + * @package heidelpayPHP\PaymentTypes */ namespace heidelpayPHP\Resources\PaymentTypes; diff --git a/src/Resources/PaymentTypes/BasePaymentType.php b/src/Resources/PaymentTypes/BasePaymentType.php index d015e743..6b75aa14 100755 --- a/src/Resources/PaymentTypes/BasePaymentType.php +++ b/src/Resources/PaymentTypes/BasePaymentType.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/payment_types + * @package heidelpayPHP\PaymentTypes */ namespace heidelpayPHP\Resources\PaymentTypes; diff --git a/src/Resources/PaymentTypes/Card.php b/src/Resources/PaymentTypes/Card.php index 390fc66b..e903fecc 100755 --- a/src/Resources/PaymentTypes/Card.php +++ b/src/Resources/PaymentTypes/Card.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/payment_types + * @package heidelpayPHP\PaymentTypes */ namespace heidelpayPHP\Resources\PaymentTypes; diff --git a/src/Resources/PaymentTypes/EPS.php b/src/Resources/PaymentTypes/EPS.php index 6fb06f82..9a7fc411 100755 --- a/src/Resources/PaymentTypes/EPS.php +++ b/src/Resources/PaymentTypes/EPS.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/payment_types + * @package heidelpayPHP\PaymentTypes */ namespace heidelpayPHP\Resources\PaymentTypes; diff --git a/src/Resources/PaymentTypes/Giropay.php b/src/Resources/PaymentTypes/Giropay.php index 8163b7fb..860f2311 100755 --- a/src/Resources/PaymentTypes/Giropay.php +++ b/src/Resources/PaymentTypes/Giropay.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/payment_types + * @package heidelpayPHP\PaymentTypes */ namespace heidelpayPHP\Resources\PaymentTypes; diff --git a/src/Resources/PaymentTypes/HirePurchaseDirectDebit.php b/src/Resources/PaymentTypes/HirePurchaseDirectDebit.php index e6de9853..bb462909 100755 --- a/src/Resources/PaymentTypes/HirePurchaseDirectDebit.php +++ b/src/Resources/PaymentTypes/HirePurchaseDirectDebit.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/payment_types + * @package heidelpayPHP\PaymentTypes */ namespace heidelpayPHP\Resources\PaymentTypes; diff --git a/src/Resources/PaymentTypes/Ideal.php b/src/Resources/PaymentTypes/Ideal.php index 5e55388a..14838f56 100755 --- a/src/Resources/PaymentTypes/Ideal.php +++ b/src/Resources/PaymentTypes/Ideal.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/payment_types + * @package heidelpayPHP\PaymentTypes */ namespace heidelpayPHP\Resources\PaymentTypes; diff --git a/src/Resources/PaymentTypes/Invoice.php b/src/Resources/PaymentTypes/Invoice.php index c8624add..432c8d58 100755 --- a/src/Resources/PaymentTypes/Invoice.php +++ b/src/Resources/PaymentTypes/Invoice.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/payment_types + * @package heidelpayPHP\PaymentTypes */ namespace heidelpayPHP\Resources\PaymentTypes; diff --git a/src/Resources/PaymentTypes/InvoiceFactoring.php b/src/Resources/PaymentTypes/InvoiceFactoring.php index 21d1a339..2aff7ac0 100755 --- a/src/Resources/PaymentTypes/InvoiceFactoring.php +++ b/src/Resources/PaymentTypes/InvoiceFactoring.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/payment_types + * @package heidelpayPHP\PaymentTypes */ namespace heidelpayPHP\Resources\PaymentTypes; diff --git a/src/Resources/PaymentTypes/InvoiceGuaranteed.php b/src/Resources/PaymentTypes/InvoiceGuaranteed.php index 80c9f027..71b29a90 100755 --- a/src/Resources/PaymentTypes/InvoiceGuaranteed.php +++ b/src/Resources/PaymentTypes/InvoiceGuaranteed.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/payment_types + * @package heidelpayPHP\PaymentTypes */ namespace heidelpayPHP\Resources\PaymentTypes; diff --git a/src/Resources/PaymentTypes/PIS.php b/src/Resources/PaymentTypes/PIS.php index a825ffc2..523aa55d 100755 --- a/src/Resources/PaymentTypes/PIS.php +++ b/src/Resources/PaymentTypes/PIS.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/payment_types + * @package heidelpayPHP\PaymentTypes */ namespace heidelpayPHP\Resources\PaymentTypes; diff --git a/src/Resources/PaymentTypes/Paypage.php b/src/Resources/PaymentTypes/Paypage.php index 4f105065..ae25a65a 100644 --- a/src/Resources/PaymentTypes/Paypage.php +++ b/src/Resources/PaymentTypes/Paypage.php @@ -21,7 +21,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/payment_types + * @package heidelpayPHP\PaymentTypes */ namespace heidelpayPHP\Resources\PaymentTypes; diff --git a/src/Resources/PaymentTypes/Paypal.php b/src/Resources/PaymentTypes/Paypal.php index 59a64a53..aac16aba 100755 --- a/src/Resources/PaymentTypes/Paypal.php +++ b/src/Resources/PaymentTypes/Paypal.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/payment_types + * @package heidelpayPHP\PaymentTypes */ namespace heidelpayPHP\Resources\PaymentTypes; diff --git a/src/Resources/PaymentTypes/Prepayment.php b/src/Resources/PaymentTypes/Prepayment.php index 4bc97b37..bf25159a 100755 --- a/src/Resources/PaymentTypes/Prepayment.php +++ b/src/Resources/PaymentTypes/Prepayment.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/payment_types + * @package heidelpayPHP\PaymentTypes */ namespace heidelpayPHP\Resources\PaymentTypes; diff --git a/src/Resources/PaymentTypes/Przelewy24.php b/src/Resources/PaymentTypes/Przelewy24.php index 4b51a052..0e21a15e 100755 --- a/src/Resources/PaymentTypes/Przelewy24.php +++ b/src/Resources/PaymentTypes/Przelewy24.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/payment_types + * @package heidelpayPHP\PaymentTypes */ namespace heidelpayPHP\Resources\PaymentTypes; diff --git a/src/Resources/PaymentTypes/SepaDirectDebit.php b/src/Resources/PaymentTypes/SepaDirectDebit.php index c724599d..722bff92 100755 --- a/src/Resources/PaymentTypes/SepaDirectDebit.php +++ b/src/Resources/PaymentTypes/SepaDirectDebit.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/payment_types + * @package heidelpayPHP\PaymentTypes */ namespace heidelpayPHP\Resources\PaymentTypes; diff --git a/src/Resources/PaymentTypes/SepaDirectDebitGuaranteed.php b/src/Resources/PaymentTypes/SepaDirectDebitGuaranteed.php index 237381a9..59dc86c7 100755 --- a/src/Resources/PaymentTypes/SepaDirectDebitGuaranteed.php +++ b/src/Resources/PaymentTypes/SepaDirectDebitGuaranteed.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/payment_types + * @package heidelpayPHP\PaymentTypes */ namespace heidelpayPHP\Resources\PaymentTypes; diff --git a/src/Resources/PaymentTypes/Sofort.php b/src/Resources/PaymentTypes/Sofort.php index 35bb6cd6..e2dfb0d6 100755 --- a/src/Resources/PaymentTypes/Sofort.php +++ b/src/Resources/PaymentTypes/Sofort.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/payment_types + * @package heidelpayPHP\PaymentTypes */ namespace heidelpayPHP\Resources\PaymentTypes; diff --git a/src/Resources/PaymentTypes/Wechatpay.php b/src/Resources/PaymentTypes/Wechatpay.php index 8218229e..254b1af2 100755 --- a/src/Resources/PaymentTypes/Wechatpay.php +++ b/src/Resources/PaymentTypes/Wechatpay.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/payment_types + * @package heidelpayPHP\PaymentTypes */ namespace heidelpayPHP\Resources\PaymentTypes; diff --git a/src/Resources/Recurring.php b/src/Resources/Recurring.php index d7ee3afd..1cf285f9 100644 --- a/src/Resources/Recurring.php +++ b/src/Resources/Recurring.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/resources + * @package heidelpayPHP\Resources */ namespace heidelpayPHP\Resources; diff --git a/src/Resources/TransactionTypes/AbstractTransactionType.php b/src/Resources/TransactionTypes/AbstractTransactionType.php index c0f6ce9c..59bb7488 100755 --- a/src/Resources/TransactionTypes/AbstractTransactionType.php +++ b/src/Resources/TransactionTypes/AbstractTransactionType.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/transaction_types + * @package heidelpayPHP\TransactionTypes */ namespace heidelpayPHP\Resources\TransactionTypes; diff --git a/src/Resources/TransactionTypes/Authorization.php b/src/Resources/TransactionTypes/Authorization.php index 57147c8d..c4580fdd 100755 --- a/src/Resources/TransactionTypes/Authorization.php +++ b/src/Resources/TransactionTypes/Authorization.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/transaction_types + * @package heidelpayPHP\TransactionTypes */ namespace heidelpayPHP\Resources\TransactionTypes; diff --git a/src/Resources/TransactionTypes/Cancellation.php b/src/Resources/TransactionTypes/Cancellation.php index 7be096df..2be98e36 100755 --- a/src/Resources/TransactionTypes/Cancellation.php +++ b/src/Resources/TransactionTypes/Cancellation.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/transaction_types + * @package heidelpayPHP\TransactionTypes */ namespace heidelpayPHP\Resources\TransactionTypes; diff --git a/src/Resources/TransactionTypes/Charge.php b/src/Resources/TransactionTypes/Charge.php index 339a7187..0121ce53 100755 --- a/src/Resources/TransactionTypes/Charge.php +++ b/src/Resources/TransactionTypes/Charge.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/transaction_types + * @package heidelpayPHP\TransactionTypes */ namespace heidelpayPHP\Resources\TransactionTypes; diff --git a/src/Resources/TransactionTypes/Payout.php b/src/Resources/TransactionTypes/Payout.php index 0e138b4d..38f19fa7 100644 --- a/src/Resources/TransactionTypes/Payout.php +++ b/src/Resources/TransactionTypes/Payout.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/transaction_types + * @package heidelpayPHP\TransactionTypes */ namespace heidelpayPHP\Resources\TransactionTypes; diff --git a/src/Resources/TransactionTypes/Shipment.php b/src/Resources/TransactionTypes/Shipment.php index a9fd4d3f..d9d4d195 100755 --- a/src/Resources/TransactionTypes/Shipment.php +++ b/src/Resources/TransactionTypes/Shipment.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/transaction_types + * @package heidelpayPHP\TransactionTypes */ namespace heidelpayPHP\Resources\TransactionTypes; diff --git a/src/Resources/Webhook.php b/src/Resources/Webhook.php index 174f1ea1..320814c0 100755 --- a/src/Resources/Webhook.php +++ b/src/Resources/Webhook.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/resources + * @package heidelpayPHP\Resources */ namespace heidelpayPHP\Resources; diff --git a/src/Resources/Webhooks.php b/src/Resources/Webhooks.php index 735a1e08..336163ae 100755 --- a/src/Resources/Webhooks.php +++ b/src/Resources/Webhooks.php @@ -22,7 +22,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/resources + * @package heidelpayPHP\Resources */ namespace heidelpayPHP\Resources; diff --git a/src/Services/EnvironmentService.php b/src/Services/EnvironmentService.php index 11a4ba16..1d9d7356 100755 --- a/src/Services/EnvironmentService.php +++ b/src/Services/EnvironmentService.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/services + * @package heidelpayPHP\Services */ namespace heidelpayPHP\Services; diff --git a/src/Services/HttpService.php b/src/Services/HttpService.php index 54b3f913..4e4e62be 100755 --- a/src/Services/HttpService.php +++ b/src/Services/HttpService.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/services + * @package heidelpayPHP\Services */ namespace heidelpayPHP\Services; diff --git a/src/Services/IdService.php b/src/Services/IdService.php index 297c0e50..d626d6c7 100755 --- a/src/Services/IdService.php +++ b/src/Services/IdService.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/services + * @package heidelpayPHP\Services */ namespace heidelpayPHP\Services; diff --git a/src/Services/PaymentService.php b/src/Services/PaymentService.php index edb3c9a2..3eebbe9d 100755 --- a/src/Services/PaymentService.php +++ b/src/Services/PaymentService.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/services + * @package heidelpayPHP\Services */ namespace heidelpayPHP\Services; diff --git a/src/Services/ResourceNameService.php b/src/Services/ResourceNameService.php index 0685e5a1..2d1b8768 100755 --- a/src/Services/ResourceNameService.php +++ b/src/Services/ResourceNameService.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/services + * @package heidelpayPHP\Services */ namespace heidelpayPHP\Services; diff --git a/src/Services/ResourceService.php b/src/Services/ResourceService.php index 3fbc0673..13ace975 100755 --- a/src/Services/ResourceService.php +++ b/src/Services/ResourceService.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/services + * @package heidelpayPHP\Services */ namespace heidelpayPHP\Services; diff --git a/src/Services/ValueService.php b/src/Services/ValueService.php index 5a1d159a..2771361a 100644 --- a/src/Services/ValueService.php +++ b/src/Services/ValueService.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/Services + * @package heidelpayPHP\Services */ namespace heidelpayPHP\Services; diff --git a/src/Services/WebhookService.php b/src/Services/WebhookService.php index 4e18b2c7..bc8a49f3 100755 --- a/src/Services/WebhookService.php +++ b/src/Services/WebhookService.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/services + * @package heidelpayPHP\Services */ namespace heidelpayPHP\Services; diff --git a/src/Traits/CanAuthorize.php b/src/Traits/CanAuthorize.php index 9e7402cd..a362840c 100755 --- a/src/Traits/CanAuthorize.php +++ b/src/Traits/CanAuthorize.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/traits + * @package heidelpayPHP\Traits */ namespace heidelpayPHP\Traits; diff --git a/src/Traits/CanAuthorizeWithCustomer.php b/src/Traits/CanAuthorizeWithCustomer.php index 0edb77ff..100e7634 100755 --- a/src/Traits/CanAuthorizeWithCustomer.php +++ b/src/Traits/CanAuthorizeWithCustomer.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/traits + * @package heidelpayPHP\Traits */ namespace heidelpayPHP\Traits; diff --git a/src/Traits/CanDirectCharge.php b/src/Traits/CanDirectCharge.php index f5fc821f..af5f6652 100755 --- a/src/Traits/CanDirectCharge.php +++ b/src/Traits/CanDirectCharge.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/traits + * @package heidelpayPHP\Traits */ namespace heidelpayPHP\Traits; diff --git a/src/Traits/CanDirectChargeWithCustomer.php b/src/Traits/CanDirectChargeWithCustomer.php index dc8d2c8e..41f1fc06 100755 --- a/src/Traits/CanDirectChargeWithCustomer.php +++ b/src/Traits/CanDirectChargeWithCustomer.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/traits + * @package heidelpayPHP\Traits */ namespace heidelpayPHP\Traits; diff --git a/src/Traits/CanPayout.php b/src/Traits/CanPayout.php index 1076a124..e5c9cb19 100644 --- a/src/Traits/CanPayout.php +++ b/src/Traits/CanPayout.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/traits + * @package heidelpayPHP\Traits */ namespace heidelpayPHP\Traits; diff --git a/src/Traits/CanPayoutWithCustomer.php b/src/Traits/CanPayoutWithCustomer.php index 91b432d4..ab645672 100644 --- a/src/Traits/CanPayoutWithCustomer.php +++ b/src/Traits/CanPayoutWithCustomer.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/traits + * @package heidelpayPHP\Traits */ namespace heidelpayPHP\Traits; diff --git a/src/Traits/CanRecur.php b/src/Traits/CanRecur.php index 44253877..e49f478e 100644 --- a/src/Traits/CanRecur.php +++ b/src/Traits/CanRecur.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/traits + * @package heidelpayPHP\Traits */ namespace heidelpayPHP\Traits; diff --git a/src/Traits/HasCancellations.php b/src/Traits/HasCancellations.php index 85bd484a..9aa11471 100755 --- a/src/Traits/HasCancellations.php +++ b/src/Traits/HasCancellations.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/traits + * @package heidelpayPHP\Traits */ namespace heidelpayPHP\Traits; diff --git a/src/Traits/HasInvoiceId.php b/src/Traits/HasInvoiceId.php index 5dd9f167..5cc10a7a 100755 --- a/src/Traits/HasInvoiceId.php +++ b/src/Traits/HasInvoiceId.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/traits + * @package heidelpayPHP\Traits */ namespace heidelpayPHP\Traits; diff --git a/src/Traits/HasOrderId.php b/src/Traits/HasOrderId.php index ae85d4bb..c2d3d568 100755 --- a/src/Traits/HasOrderId.php +++ b/src/Traits/HasOrderId.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/traits + * @package heidelpayPHP\Traits */ namespace heidelpayPHP\Traits; diff --git a/src/Traits/HasPaymentState.php b/src/Traits/HasPaymentState.php index b45f30e9..18abebc2 100755 --- a/src/Traits/HasPaymentState.php +++ b/src/Traits/HasPaymentState.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/traits + * @package heidelpayPHP\Traits */ namespace heidelpayPHP\Traits; diff --git a/src/Traits/HasStates.php b/src/Traits/HasStates.php index deec7874..50f2b493 100644 --- a/src/Traits/HasStates.php +++ b/src/Traits/HasStates.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/traits + * @package heidelpayPHP\Traits */ namespace heidelpayPHP\Traits; diff --git a/src/Traits/HasUniqueAndShortId.php b/src/Traits/HasUniqueAndShortId.php index 725ade7b..f7956b08 100644 --- a/src/Traits/HasUniqueAndShortId.php +++ b/src/Traits/HasUniqueAndShortId.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/traits + * @package heidelpayPHP\Traits */ namespace heidelpayPHP\Traits; diff --git a/src/Validators/ExpiryDateValidator.php b/src/Validators/ExpiryDateValidator.php index 1a4f6f0c..c9e4d122 100755 --- a/src/Validators/ExpiryDateValidator.php +++ b/src/Validators/ExpiryDateValidator.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/validators + * @package heidelpayPHP\Validators */ namespace heidelpayPHP\Validators; diff --git a/src/Validators/PrivateKeyValidator.php b/src/Validators/PrivateKeyValidator.php index 3d327784..2757b778 100755 --- a/src/Validators/PrivateKeyValidator.php +++ b/src/Validators/PrivateKeyValidator.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/validators + * @package heidelpayPHP\Validators */ namespace heidelpayPHP\Validators; diff --git a/src/Validators/PublicKeyValidator.php b/src/Validators/PublicKeyValidator.php index d22179e8..3b1efde1 100755 --- a/src/Validators/PublicKeyValidator.php +++ b/src/Validators/PublicKeyValidator.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/validators + * @package heidelpayPHP\Validators */ namespace heidelpayPHP\Validators; diff --git a/test/BasePaymentTest.php b/test/BasePaymentTest.php index 2fa64e75..296f248b 100755 --- a/test/BasePaymentTest.php +++ b/test/BasePaymentTest.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/integration + * @package heidelpayPHP\test\integration */ namespace heidelpayPHP\test; diff --git a/test/Fixtures/CustomerFixtureTrait.php b/test/Fixtures/CustomerFixtureTrait.php index 9d2af19b..a16ffaf9 100755 --- a/test/Fixtures/CustomerFixtureTrait.php +++ b/test/Fixtures/CustomerFixtureTrait.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/fixtures + * @package heidelpayPHP\test\Fixtures */ namespace heidelpayPHP\test\Fixtures; diff --git a/test/TestDebugHandler.php b/test/TestDebugHandler.php index 20356ad3..4d6fa1d1 100755 --- a/test/TestDebugHandler.php +++ b/test/TestDebugHandler.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/integration + * @package heidelpayPHP\test\integration */ namespace heidelpayPHP\test; diff --git a/test/bootstrap.php b/test/bootstrap.php index 63e8fb20..b50370bf 100755 --- a/test/bootstrap.php +++ b/test/bootstrap.php @@ -20,6 +20,6 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/tests + * @package heidelpayPHP\tests */ require_once __DIR__ . '/../vendor/autoload.php'; diff --git a/test/integration/BasketTest.php b/test/integration/BasketTest.php index 970b7af1..951b6718 100755 --- a/test/integration/BasketTest.php +++ b/test/integration/BasketTest.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/integration + * @package heidelpayPHP\test\integration */ namespace heidelpayPHP\test\integration; diff --git a/test/integration/CustomerTest.php b/test/integration/CustomerTest.php index 8f4e6ad1..8b405c92 100755 --- a/test/integration/CustomerTest.php +++ b/test/integration/CustomerTest.php @@ -21,7 +21,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/integration + * @package heidelpayPHP\test\integration */ namespace heidelpayPHP\test\integration; diff --git a/test/integration/DummyResource.php b/test/integration/DummyResource.php index d35f20ce..1847674f 100644 --- a/test/integration/DummyResource.php +++ b/test/integration/DummyResource.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/integration + * @package heidelpayPHP\test\integration */ namespace heidelpayPHP\test\integration; diff --git a/test/integration/ExceptionTest.php b/test/integration/ExceptionTest.php index b1859810..51a9fc84 100755 --- a/test/integration/ExceptionTest.php +++ b/test/integration/ExceptionTest.php @@ -21,7 +21,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/integration + * @package heidelpayPHP\test\integration */ namespace heidelpayPHP\test\integration; diff --git a/test/integration/KeypairTest.php b/test/integration/KeypairTest.php index f1cdcc8f..82c0464f 100644 --- a/test/integration/KeypairTest.php +++ b/test/integration/KeypairTest.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/integration + * @package heidelpayPHP\test\integration */ namespace heidelpayPHP\test\integration; diff --git a/test/integration/PaymentCancelTest.php b/test/integration/PaymentCancelTest.php index 536dd356..07b7ba34 100644 --- a/test/integration/PaymentCancelTest.php +++ b/test/integration/PaymentCancelTest.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/integration + * @package heidelpayPHP\test\integration */ namespace heidelpayPHP\test\integration; diff --git a/test/integration/PaymentTest.php b/test/integration/PaymentTest.php index 30fcb8be..dd1cbff8 100755 --- a/test/integration/PaymentTest.php +++ b/test/integration/PaymentTest.php @@ -21,7 +21,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/integration + * @package heidelpayPHP\test\integration */ namespace heidelpayPHP\test\integration; diff --git a/test/integration/PaymentTypes/AlipayTest.php b/test/integration/PaymentTypes/AlipayTest.php index a4257822..e8ec06af 100755 --- a/test/integration/PaymentTypes/AlipayTest.php +++ b/test/integration/PaymentTypes/AlipayTest.php @@ -21,7 +21,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/integration/payment_types + * @package heidelpayPHP\test\integration\PaymentTypes */ namespace heidelpayPHP\test\integration\PaymentTypes; diff --git a/test/integration/PaymentTypes/CardTest.php b/test/integration/PaymentTypes/CardTest.php index d66e392c..deb07931 100755 --- a/test/integration/PaymentTypes/CardTest.php +++ b/test/integration/PaymentTypes/CardTest.php @@ -21,7 +21,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/integration/payment_types + * @package heidelpayPHP\test\integration\PaymentTypes */ namespace heidelpayPHP\test\integration\PaymentTypes; diff --git a/test/integration/PaymentTypes/EPSTest.php b/test/integration/PaymentTypes/EPSTest.php index 29cda0d6..c9710749 100755 --- a/test/integration/PaymentTypes/EPSTest.php +++ b/test/integration/PaymentTypes/EPSTest.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/integration/payment_types + * @package heidelpayPHP\test\integration\PaymentTypes */ namespace heidelpayPHP\test\integration\PaymentTypes; diff --git a/test/integration/PaymentTypes/GiropayTest.php b/test/integration/PaymentTypes/GiropayTest.php index b20ced36..02c4a006 100755 --- a/test/integration/PaymentTypes/GiropayTest.php +++ b/test/integration/PaymentTypes/GiropayTest.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/integration/payment_types + * @package heidelpayPHP\test\integration\PaymentTypes */ namespace heidelpayPHP\test\integration\PaymentTypes; diff --git a/test/integration/PaymentTypes/HirePurchaseDirectDebitTest.php b/test/integration/PaymentTypes/HirePurchaseDirectDebitTest.php index 1e9e43dc..4080378f 100755 --- a/test/integration/PaymentTypes/HirePurchaseDirectDebitTest.php +++ b/test/integration/PaymentTypes/HirePurchaseDirectDebitTest.php @@ -21,7 +21,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/integration/payment_types + * @package heidelpayPHP\test\integration\PaymentTypes */ namespace heidelpayPHP\test\integration\PaymentTypes; diff --git a/test/integration/PaymentTypes/IdealTest.php b/test/integration/PaymentTypes/IdealTest.php index d2e94e54..9d1a1924 100755 --- a/test/integration/PaymentTypes/IdealTest.php +++ b/test/integration/PaymentTypes/IdealTest.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/integration/payment_types + * @package heidelpayPHP\test\integration\PaymentTypes */ namespace heidelpayPHP\test\integration\PaymentTypes; diff --git a/test/integration/PaymentTypes/InvoiceFactoringTest.php b/test/integration/PaymentTypes/InvoiceFactoringTest.php index 6384d1c5..5b4e2e02 100755 --- a/test/integration/PaymentTypes/InvoiceFactoringTest.php +++ b/test/integration/PaymentTypes/InvoiceFactoringTest.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/integration/payment_types + * @package heidelpayPHP\test\integration\PaymentTypes */ namespace heidelpayPHP\test\integration\PaymentTypes; diff --git a/test/integration/PaymentTypes/InvoiceGuaranteedTest.php b/test/integration/PaymentTypes/InvoiceGuaranteedTest.php index 08575fff..90981c6d 100755 --- a/test/integration/PaymentTypes/InvoiceGuaranteedTest.php +++ b/test/integration/PaymentTypes/InvoiceGuaranteedTest.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/integration/payment_types + * @package heidelpayPHP\test\integration\PaymentTypes */ namespace heidelpayPHP\test\integration\PaymentTypes; diff --git a/test/integration/PaymentTypes/InvoiceTest.php b/test/integration/PaymentTypes/InvoiceTest.php index 6f49bc44..b55ec0ce 100755 --- a/test/integration/PaymentTypes/InvoiceTest.php +++ b/test/integration/PaymentTypes/InvoiceTest.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/integration/payment_types + * @package heidelpayPHP\test\integration\PaymentTypes */ namespace heidelpayPHP\test\integration\PaymentTypes; diff --git a/test/integration/PaymentTypes/PISTest.php b/test/integration/PaymentTypes/PISTest.php index 742cdaa5..2ad2bd00 100755 --- a/test/integration/PaymentTypes/PISTest.php +++ b/test/integration/PaymentTypes/PISTest.php @@ -21,7 +21,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/tests/integration/payment_types + * @package heidelpayPHP\test\integration\PaymentTypes */ namespace heidelpayPHP\test\integration\PaymentTypes; diff --git a/test/integration/PaymentTypes/PaypageTest.php b/test/integration/PaymentTypes/PaypageTest.php index 07a610cd..5ed266d3 100644 --- a/test/integration/PaymentTypes/PaypageTest.php +++ b/test/integration/PaymentTypes/PaypageTest.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/integration/payment_types + * @package heidelpayPHP\test\integration\PaymentTypes */ namespace heidelpayPHP\test\integration\PaymentTypes; diff --git a/test/integration/PaymentTypes/PaypalTest.php b/test/integration/PaymentTypes/PaypalTest.php index 4d83cc5f..9a87880d 100755 --- a/test/integration/PaymentTypes/PaypalTest.php +++ b/test/integration/PaymentTypes/PaypalTest.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/integration/payment_types + * @package heidelpayPHP\test\integration\PaymentTypes */ namespace heidelpayPHP\test\integration\PaymentTypes; diff --git a/test/integration/PaymentTypes/PrepaymentTest.php b/test/integration/PaymentTypes/PrepaymentTest.php index 15e413c8..75b946b5 100755 --- a/test/integration/PaymentTypes/PrepaymentTest.php +++ b/test/integration/PaymentTypes/PrepaymentTest.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/integration/payment_types + * @package heidelpayPHP\test\integration\PaymentTypes */ namespace heidelpayPHP\test\integration\PaymentTypes; diff --git a/test/integration/PaymentTypes/Przelewy24Test.php b/test/integration/PaymentTypes/Przelewy24Test.php index 8996db0c..357dad6a 100755 --- a/test/integration/PaymentTypes/Przelewy24Test.php +++ b/test/integration/PaymentTypes/Przelewy24Test.php @@ -21,7 +21,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/integration/payment_types + * @package heidelpayPHP\test\integration\PaymentTypes */ namespace heidelpayPHP\test\integration\PaymentTypes; diff --git a/test/integration/PaymentTypes/SepaDirectDebitGuaranteedTest.php b/test/integration/PaymentTypes/SepaDirectDebitGuaranteedTest.php index b2a84b81..991406ff 100755 --- a/test/integration/PaymentTypes/SepaDirectDebitGuaranteedTest.php +++ b/test/integration/PaymentTypes/SepaDirectDebitGuaranteedTest.php @@ -21,7 +21,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/integration/payment_types + * @package heidelpayPHP\test\integration\PaymentTypes */ namespace heidelpayPHP\test\integration\PaymentTypes; diff --git a/test/integration/PaymentTypes/SepaDirectDebitTest.php b/test/integration/PaymentTypes/SepaDirectDebitTest.php index 67b1bd6f..294f8ceb 100755 --- a/test/integration/PaymentTypes/SepaDirectDebitTest.php +++ b/test/integration/PaymentTypes/SepaDirectDebitTest.php @@ -21,7 +21,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/integration/payment_types + * @package heidelpayPHP\test\integration\PaymentTypes */ namespace heidelpayPHP\test\integration\PaymentTypes; diff --git a/test/integration/PaymentTypes/SofortTest.php b/test/integration/PaymentTypes/SofortTest.php index cba435d5..24eff66c 100755 --- a/test/integration/PaymentTypes/SofortTest.php +++ b/test/integration/PaymentTypes/SofortTest.php @@ -21,7 +21,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/integration/payment_types + * @package heidelpayPHP\test\integration\PaymentTypes */ namespace heidelpayPHP\test\integration\PaymentTypes; diff --git a/test/integration/PaymentTypes/WechatpayTest.php b/test/integration/PaymentTypes/WechatpayTest.php index 4c01927b..8b547a02 100755 --- a/test/integration/PaymentTypes/WechatpayTest.php +++ b/test/integration/PaymentTypes/WechatpayTest.php @@ -21,7 +21,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/integration/payment_types + * @package heidelpayPHP\test\integration\PaymentTypes */ namespace heidelpayPHP\test\integration\PaymentTypes; diff --git a/test/integration/RecurringPaymentTest.php b/test/integration/RecurringPaymentTest.php index e48e3188..bdff798e 100644 --- a/test/integration/RecurringPaymentTest.php +++ b/test/integration/RecurringPaymentTest.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/integration + * @package heidelpayPHP\test\integration */ namespace heidelpayPHP\test\integration; diff --git a/test/integration/SetMetadataTest.php b/test/integration/SetMetadataTest.php index e429e86b..23162e8b 100755 --- a/test/integration/SetMetadataTest.php +++ b/test/integration/SetMetadataTest.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/tests/integration + * @package heidelpayPHP\test\integration */ namespace heidelpayPHP\test\integration; diff --git a/test/integration/TransactionTypes/AuthorizationTest.php b/test/integration/TransactionTypes/AuthorizationTest.php index 4e2d7393..aedd0bfd 100644 --- a/test/integration/TransactionTypes/AuthorizationTest.php +++ b/test/integration/TransactionTypes/AuthorizationTest.php @@ -21,7 +21,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/integration/transaction_types + * @package heidelpayPHP\test\integration\TransactionTypes */ namespace heidelpayPHP\test\integration\TransactionTypes; diff --git a/test/integration/TransactionTypes/CancelAfterAuthorizationTest.php b/test/integration/TransactionTypes/CancelAfterAuthorizationTest.php index b3b95bab..00590068 100644 --- a/test/integration/TransactionTypes/CancelAfterAuthorizationTest.php +++ b/test/integration/TransactionTypes/CancelAfterAuthorizationTest.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/integration/transaction_types + * @package heidelpayPHP\test\integration\TransactionTypes */ namespace heidelpayPHP\test\integration\TransactionTypes; diff --git a/test/integration/TransactionTypes/CancelAfterChargeTest.php b/test/integration/TransactionTypes/CancelAfterChargeTest.php index 8b431c35..3ab730de 100644 --- a/test/integration/TransactionTypes/CancelAfterChargeTest.php +++ b/test/integration/TransactionTypes/CancelAfterChargeTest.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/integration/transaction_types + * @package heidelpayPHP\test\integration\TransactionTypes */ namespace heidelpayPHP\test\integration\TransactionTypes; diff --git a/test/integration/TransactionTypes/CancelTest.php b/test/integration/TransactionTypes/CancelTest.php index c688fd69..79d88de7 100644 --- a/test/integration/TransactionTypes/CancelTest.php +++ b/test/integration/TransactionTypes/CancelTest.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/integration/transaction_types + * @package heidelpayPHP\test\integration\TransactionTypes */ namespace heidelpayPHP\test\integration\TransactionTypes; diff --git a/test/integration/TransactionTypes/ChargeAfterAuthorizationTest.php b/test/integration/TransactionTypes/ChargeAfterAuthorizationTest.php index b59d057b..ed6e7123 100644 --- a/test/integration/TransactionTypes/ChargeAfterAuthorizationTest.php +++ b/test/integration/TransactionTypes/ChargeAfterAuthorizationTest.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/integration/transaction_types + * @package heidelpayPHP\test\integration\TransactionTypes */ namespace heidelpayPHP\test\integration\TransactionTypes; diff --git a/test/integration/TransactionTypes/ChargeTest.php b/test/integration/TransactionTypes/ChargeTest.php index b1f55e9d..d4395f7c 100644 --- a/test/integration/TransactionTypes/ChargeTest.php +++ b/test/integration/TransactionTypes/ChargeTest.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/integration/transaction_types + * @package heidelpayPHP\test\integration\TransactionTypes */ namespace heidelpayPHP\test\integration\TransactionTypes; diff --git a/test/integration/TransactionTypes/PayoutTest.php b/test/integration/TransactionTypes/PayoutTest.php index cfceb176..bbb1c46c 100644 --- a/test/integration/TransactionTypes/PayoutTest.php +++ b/test/integration/TransactionTypes/PayoutTest.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/integration/transaction_types + * @package heidelpayPHP\test\integration\TransactionTypes */ namespace heidelpayPHP\test\integration\TransactionTypes; diff --git a/test/integration/TransactionTypes/ShipmentTest.php b/test/integration/TransactionTypes/ShipmentTest.php index d1d3d671..7597264d 100644 --- a/test/integration/TransactionTypes/ShipmentTest.php +++ b/test/integration/TransactionTypes/ShipmentTest.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/integration/transaction_types + * @package heidelpayPHP\test\integration\TransactionTypes */ namespace heidelpayPHP\test\integration\TransactionTypes; diff --git a/test/integration/WebhookTest.php b/test/integration/WebhookTest.php index 9444d681..d853730d 100755 --- a/test/integration/WebhookTest.php +++ b/test/integration/WebhookTest.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/integration + * @package heidelpayPHP\test\integration */ namespace heidelpayPHP\test\integration; diff --git a/test/unit/Constants/PaymentStateTest.php b/test/unit/Constants/PaymentStateTest.php index ef41b22d..01f0c511 100755 --- a/test/unit/Constants/PaymentStateTest.php +++ b/test/unit/Constants/PaymentStateTest.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/unit + * @package heidelpayPHP\test\unit */ namespace heidelpayPHP\test\unit\Constants; diff --git a/test/unit/DummyResource.php b/test/unit/DummyResource.php index 03017387..e1e4d9e6 100755 --- a/test/unit/DummyResource.php +++ b/test/unit/DummyResource.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/unit + * @package heidelpayPHP\test\unit */ namespace heidelpayPHP\test\unit; diff --git a/test/unit/Exceptions/HeidelpayApiExceptionTest.php b/test/unit/Exceptions/HeidelpayApiExceptionTest.php index 878187d4..0e940683 100755 --- a/test/unit/Exceptions/HeidelpayApiExceptionTest.php +++ b/test/unit/Exceptions/HeidelpayApiExceptionTest.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/unit + * @package heidelpayPHP\test\unit */ namespace heidelpayPHP\test\unit\Exceptions; diff --git a/test/unit/HeidelpayTest.php b/test/unit/HeidelpayTest.php index 90e08291..6214f21d 100755 --- a/test/unit/HeidelpayTest.php +++ b/test/unit/HeidelpayTest.php @@ -21,7 +21,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/unit + * @package heidelpayPHP\test\unit */ namespace heidelpayPHP\test\unit; diff --git a/test/unit/Resources/AbstractHeidelpayResourceTest.php b/test/unit/Resources/AbstractHeidelpayResourceTest.php index 4fece867..58594fd2 100755 --- a/test/unit/Resources/AbstractHeidelpayResourceTest.php +++ b/test/unit/Resources/AbstractHeidelpayResourceTest.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/unit + * @package heidelpayPHP\test\unit */ namespace heidelpayPHP\test\unit\Resources; diff --git a/test/unit/Resources/BasketTest.php b/test/unit/Resources/BasketTest.php index b65fa7dd..0e87be63 100755 --- a/test/unit/Resources/BasketTest.php +++ b/test/unit/Resources/BasketTest.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/unit + * @package heidelpayPHP\test\unit */ namespace heidelpayPHP\test\unit\Resources; diff --git a/test/unit/Resources/CustomerFactoryTest.php b/test/unit/Resources/CustomerFactoryTest.php index 9523ff5c..d8fb57ee 100644 --- a/test/unit/Resources/CustomerFactoryTest.php +++ b/test/unit/Resources/CustomerFactoryTest.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/unit + * @package heidelpayPHP\test\unit */ namespace heidelpayPHP\test\unit\Resources; diff --git a/test/unit/Resources/CustomerTest.php b/test/unit/Resources/CustomerTest.php index 89d1f304..aee6a9fd 100755 --- a/test/unit/Resources/CustomerTest.php +++ b/test/unit/Resources/CustomerTest.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/unit + * @package heidelpayPHP\test\unit */ namespace heidelpayPHP\test\unit\Resources; diff --git a/test/unit/Resources/DummyHeidelpayResource.php b/test/unit/Resources/DummyHeidelpayResource.php index a8125574..128a6d04 100755 --- a/test/unit/Resources/DummyHeidelpayResource.php +++ b/test/unit/Resources/DummyHeidelpayResource.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/unit + * @package heidelpayPHP\test\unit */ namespace heidelpayPHP\test\unit\Resources; diff --git a/test/unit/Resources/EmbeddedResources/AmountTest.php b/test/unit/Resources/EmbeddedResources/AmountTest.php index 047244a6..2b94e4e1 100755 --- a/test/unit/Resources/EmbeddedResources/AmountTest.php +++ b/test/unit/Resources/EmbeddedResources/AmountTest.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/unit + * @package heidelpayPHP\test\unit */ namespace heidelpayPHP\test\unit\Resources; diff --git a/test/unit/Resources/EmbeddedResources/BasketItemTest.php b/test/unit/Resources/EmbeddedResources/BasketItemTest.php index 66bc68e3..34907e6e 100755 --- a/test/unit/Resources/EmbeddedResources/BasketItemTest.php +++ b/test/unit/Resources/EmbeddedResources/BasketItemTest.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/unit + * @package heidelpayPHP\test\unit */ namespace heidelpayPHP\test\unit\Resources; diff --git a/test/unit/Resources/EmbeddedResources/GeoLocationTest.php b/test/unit/Resources/EmbeddedResources/GeoLocationTest.php index 89c97467..91c56622 100644 --- a/test/unit/Resources/EmbeddedResources/GeoLocationTest.php +++ b/test/unit/Resources/EmbeddedResources/GeoLocationTest.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/unit + * @package heidelpayPHP\test\unit */ namespace heidelpayPHP\test\unit\Resources; diff --git a/test/unit/Resources/InstalmentPlanTest.php b/test/unit/Resources/InstalmentPlanTest.php index c5e15b42..9b093cef 100644 --- a/test/unit/Resources/InstalmentPlanTest.php +++ b/test/unit/Resources/InstalmentPlanTest.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/unit + * @package heidelpayPHP\test\unit */ namespace heidelpayPHP\test\unit\Resources; diff --git a/test/unit/Resources/KeypairTest.php b/test/unit/Resources/KeypairTest.php index b94ff1fe..e81f62b6 100755 --- a/test/unit/Resources/KeypairTest.php +++ b/test/unit/Resources/KeypairTest.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/unit + * @package heidelpayPHP\test\unit */ namespace heidelpayPHP\test\unit\Resources; diff --git a/test/unit/Resources/MetadataTest.php b/test/unit/Resources/MetadataTest.php index 1f4ad1c0..f6c0c6e2 100755 --- a/test/unit/Resources/MetadataTest.php +++ b/test/unit/Resources/MetadataTest.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/unit + * @package heidelpayPHP\test\unit */ namespace heidelpayPHP\test\integration; diff --git a/test/unit/Resources/PaymentCancelTest.php b/test/unit/Resources/PaymentCancelTest.php index bb17815a..e7be6e71 100644 --- a/test/unit/Resources/PaymentCancelTest.php +++ b/test/unit/Resources/PaymentCancelTest.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/unit + * @package heidelpayPHP\test\unit */ namespace heidelpayPHP\test\unit\Resources; diff --git a/test/unit/Resources/PaymentTypes/CardTest.php b/test/unit/Resources/PaymentTypes/CardTest.php index 1e8369f3..ab419c6b 100755 --- a/test/unit/Resources/PaymentTypes/CardTest.php +++ b/test/unit/Resources/PaymentTypes/CardTest.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/unit + * @package heidelpayPHP\test\unit */ namespace heidelpayPHP\test\unit\Resources\PaymentTypes; diff --git a/test/unit/Resources/PaymentTypes/EPSTest.php b/test/unit/Resources/PaymentTypes/EPSTest.php index 10535293..482ae1e7 100755 --- a/test/unit/Resources/PaymentTypes/EPSTest.php +++ b/test/unit/Resources/PaymentTypes/EPSTest.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/unit + * @package heidelpayPHP\test\unit */ namespace heidelpayPHP\test\unit\Resources\PaymentTypes; diff --git a/test/unit/Resources/PaymentTypes/HirePurchaseDirectDebitTest.php b/test/unit/Resources/PaymentTypes/HirePurchaseDirectDebitTest.php index bf36d1ad..c75a9279 100644 --- a/test/unit/Resources/PaymentTypes/HirePurchaseDirectDebitTest.php +++ b/test/unit/Resources/PaymentTypes/HirePurchaseDirectDebitTest.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/unit + * @package heidelpayPHP\test\unit */ namespace heidelpayPHP\test\unit\Resources\PaymentTypes; diff --git a/test/unit/Resources/PaymentTypes/IdealTest.php b/test/unit/Resources/PaymentTypes/IdealTest.php index ebb38275..45da68e5 100755 --- a/test/unit/Resources/PaymentTypes/IdealTest.php +++ b/test/unit/Resources/PaymentTypes/IdealTest.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/unit + * @package heidelpayPHP\test\unit */ namespace heidelpayPHP\test\unit\Resources\PaymentTypes; diff --git a/test/unit/Resources/PaymentTypes/PayPageTest.php b/test/unit/Resources/PaymentTypes/PayPageTest.php index 3fb9a27b..3845ba50 100644 --- a/test/unit/Resources/PaymentTypes/PayPageTest.php +++ b/test/unit/Resources/PaymentTypes/PayPageTest.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/unit + * @package heidelpayPHP\test\unit */ namespace heidelpayPHP\test\unit\Resources\PaymentTypes; diff --git a/test/unit/Resources/PaymentTypes/PayPalTest.php b/test/unit/Resources/PaymentTypes/PayPalTest.php index 65e6acb4..2a8bb840 100644 --- a/test/unit/Resources/PaymentTypes/PayPalTest.php +++ b/test/unit/Resources/PaymentTypes/PayPalTest.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/unit + * @package heidelpayPHP\test\unit */ namespace heidelpayPHP\test\unit\Resources\PaymentTypes; diff --git a/test/unit/Resources/PaymentTypes/SepaDirectDebitGuaranteedTest.php b/test/unit/Resources/PaymentTypes/SepaDirectDebitGuaranteedTest.php index 330432ef..45761927 100755 --- a/test/unit/Resources/PaymentTypes/SepaDirectDebitGuaranteedTest.php +++ b/test/unit/Resources/PaymentTypes/SepaDirectDebitGuaranteedTest.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/unit + * @package heidelpayPHP\test\unit */ namespace heidelpayPHP\test\unit\Resources\PaymentTypes; diff --git a/test/unit/Resources/PaymentTypes/SepaDirectDebitTest.php b/test/unit/Resources/PaymentTypes/SepaDirectDebitTest.php index 474254b1..13ba8516 100755 --- a/test/unit/Resources/PaymentTypes/SepaDirectDebitTest.php +++ b/test/unit/Resources/PaymentTypes/SepaDirectDebitTest.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/unit + * @package heidelpayPHP\test\unit */ namespace heidelpayPHP\test\unit\Resources\PaymentTypes; diff --git a/test/unit/Resources/RecurringTest.php b/test/unit/Resources/RecurringTest.php index c139f971..dcc920fb 100644 --- a/test/unit/Resources/RecurringTest.php +++ b/test/unit/Resources/RecurringTest.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/unit + * @package heidelpayPHP\test\unit */ namespace heidelpayPHP\test\unit\Resources; diff --git a/test/unit/Resources/TransactionTypes/AbstractTransactionTypeTest.php b/test/unit/Resources/TransactionTypes/AbstractTransactionTypeTest.php index 3ac1ae70..7f4834ba 100755 --- a/test/unit/Resources/TransactionTypes/AbstractTransactionTypeTest.php +++ b/test/unit/Resources/TransactionTypes/AbstractTransactionTypeTest.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/unit + * @package heidelpayPHP\test\unit */ namespace heidelpayPHP\test\unit\Resources\TransactionTypes; diff --git a/test/unit/Resources/TransactionTypes/AuthorizationTest.php b/test/unit/Resources/TransactionTypes/AuthorizationTest.php index 20e4e863..f63e1190 100755 --- a/test/unit/Resources/TransactionTypes/AuthorizationTest.php +++ b/test/unit/Resources/TransactionTypes/AuthorizationTest.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/unit + * @package heidelpayPHP\test\unit */ namespace heidelpayPHP\test\unit\Resources\TransactionTypes; diff --git a/test/unit/Resources/TransactionTypes/CancellationTest.php b/test/unit/Resources/TransactionTypes/CancellationTest.php index 936d6d08..ce462e89 100755 --- a/test/unit/Resources/TransactionTypes/CancellationTest.php +++ b/test/unit/Resources/TransactionTypes/CancellationTest.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/unit + * @package heidelpayPHP\test\unit */ namespace heidelpayPHP\test\unit\Resources\TransactionTypes; diff --git a/test/unit/Resources/TransactionTypes/ChargeTest.php b/test/unit/Resources/TransactionTypes/ChargeTest.php index ecb010e8..6e542d74 100755 --- a/test/unit/Resources/TransactionTypes/ChargeTest.php +++ b/test/unit/Resources/TransactionTypes/ChargeTest.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/unit + * @package heidelpayPHP\test\unit */ namespace heidelpayPHP\test\unit\Resources\TransactionTypes; diff --git a/test/unit/Resources/TransactionTypes/DummyTransactionType.php b/test/unit/Resources/TransactionTypes/DummyTransactionType.php index 9d730004..5a075d7d 100755 --- a/test/unit/Resources/TransactionTypes/DummyTransactionType.php +++ b/test/unit/Resources/TransactionTypes/DummyTransactionType.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/unit + * @package heidelpayPHP\test\unit */ namespace heidelpayPHP\test\unit\Resources\TransactionTypes; diff --git a/test/unit/Resources/TransactionTypes/PayoutTest.php b/test/unit/Resources/TransactionTypes/PayoutTest.php index c144c785..2b6a6865 100644 --- a/test/unit/Resources/TransactionTypes/PayoutTest.php +++ b/test/unit/Resources/TransactionTypes/PayoutTest.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/unit + * @package heidelpayPHP\test\unit */ namespace heidelpayPHP\test\unit\Resources\TransactionTypes; diff --git a/test/unit/Resources/TransactionTypes/ShipmentTest.php b/test/unit/Resources/TransactionTypes/ShipmentTest.php index 0cbc1b28..25eca76b 100755 --- a/test/unit/Resources/TransactionTypes/ShipmentTest.php +++ b/test/unit/Resources/TransactionTypes/ShipmentTest.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/unit + * @package heidelpayPHP\test\unit */ namespace heidelpayPHP\test\unit\Resources\TransactionTypes; diff --git a/test/unit/Resources/WebhookTest.php b/test/unit/Resources/WebhookTest.php index fadb09ea..805b6236 100755 --- a/test/unit/Resources/WebhookTest.php +++ b/test/unit/Resources/WebhookTest.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/unit + * @package heidelpayPHP\test\unit */ namespace heidelpayPHP\test\unit\Resources; diff --git a/test/unit/Resources/WebhooksTest.php b/test/unit/Resources/WebhooksTest.php index 3efe5f60..0c1d8623 100755 --- a/test/unit/Resources/WebhooksTest.php +++ b/test/unit/Resources/WebhooksTest.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/unit + * @package heidelpayPHP\test\unit */ namespace heidelpayPHP\test\unit\Resources; diff --git a/test/unit/Services/DummyAdapter.php b/test/unit/Services/DummyAdapter.php index 0f84bd76..3762808e 100755 --- a/test/unit/Services/DummyAdapter.php +++ b/test/unit/Services/DummyAdapter.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/unit + * @package heidelpayPHP\test\unit */ namespace heidelpayPHP\test\unit\Services; diff --git a/test/unit/Services/DummyDebugHandler.php b/test/unit/Services/DummyDebugHandler.php index d51cbaa0..48435e7c 100755 --- a/test/unit/Services/DummyDebugHandler.php +++ b/test/unit/Services/DummyDebugHandler.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/unit + * @package heidelpayPHP\test\unit */ namespace heidelpayPHP\test\unit\Services; diff --git a/test/unit/Services/HttpServiceTest.php b/test/unit/Services/HttpServiceTest.php index 591e00a6..3fca4b28 100755 --- a/test/unit/Services/HttpServiceTest.php +++ b/test/unit/Services/HttpServiceTest.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/unit + * @package heidelpayPHP\test\unit */ namespace heidelpayPHP\test\unit; diff --git a/test/unit/Services/PaymentServiceTest.php b/test/unit/Services/PaymentServiceTest.php index c515ad97..fe28fadf 100755 --- a/test/unit/Services/PaymentServiceTest.php +++ b/test/unit/Services/PaymentServiceTest.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/unit + * @package heidelpayPHP\test\unit */ namespace heidelpayPHP\test\unit\Services; diff --git a/test/unit/Services/ResourceNameServiceTest.php b/test/unit/Services/ResourceNameServiceTest.php index 8d849ced..06546b55 100755 --- a/test/unit/Services/ResourceNameServiceTest.php +++ b/test/unit/Services/ResourceNameServiceTest.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/unit + * @package heidelpayPHP\test\unit */ namespace heidelpayPHP\test\unit; diff --git a/test/unit/Services/ResourceServiceTest.php b/test/unit/Services/ResourceServiceTest.php index 54d12eba..dcd4587a 100755 --- a/test/unit/Services/ResourceServiceTest.php +++ b/test/unit/Services/ResourceServiceTest.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/unit + * @package heidelpayPHP\test\unit */ namespace heidelpayPHP\test\unit\Services; diff --git a/test/unit/Services/WebhooksServiceTest.php b/test/unit/Services/WebhooksServiceTest.php index a58877c5..ffc85513 100755 --- a/test/unit/Services/WebhooksServiceTest.php +++ b/test/unit/Services/WebhooksServiceTest.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/unit + * @package heidelpayPHP\test\unit */ namespace heidelpayPHP\test\unit\Services; diff --git a/test/unit/Traits/CanAuthorizeTest.php b/test/unit/Traits/CanAuthorizeTest.php index 21683741..e0f504d0 100755 --- a/test/unit/Traits/CanAuthorizeTest.php +++ b/test/unit/Traits/CanAuthorizeTest.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/unit + * @package heidelpayPHP\test\unit */ namespace heidelpayPHP\test\unit\Traits; diff --git a/test/unit/Traits/CanAuthorizeWithCustomerTest.php b/test/unit/Traits/CanAuthorizeWithCustomerTest.php index afc6dfd5..29f9073c 100755 --- a/test/unit/Traits/CanAuthorizeWithCustomerTest.php +++ b/test/unit/Traits/CanAuthorizeWithCustomerTest.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/unit + * @package heidelpayPHP\test\unit */ namespace heidelpayPHP\test\unit\Traits; diff --git a/test/unit/Traits/CanDirectChargeTest.php b/test/unit/Traits/CanDirectChargeTest.php index bb3d456b..32a2faae 100755 --- a/test/unit/Traits/CanDirectChargeTest.php +++ b/test/unit/Traits/CanDirectChargeTest.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/unit + * @package heidelpayPHP\test\unit */ namespace heidelpayPHP\test\unit\Traits; diff --git a/test/unit/Traits/CanDirectChargeWithCustomerTest.php b/test/unit/Traits/CanDirectChargeWithCustomerTest.php index 2780c088..f21c8963 100755 --- a/test/unit/Traits/CanDirectChargeWithCustomerTest.php +++ b/test/unit/Traits/CanDirectChargeWithCustomerTest.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/unit + * @package heidelpayPHP\test\unit */ namespace heidelpayPHP\test\unit\Traits; diff --git a/test/unit/Traits/CanPayoutTest.php b/test/unit/Traits/CanPayoutTest.php index 287d8166..2d6b6af2 100644 --- a/test/unit/Traits/CanPayoutTest.php +++ b/test/unit/Traits/CanPayoutTest.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/unit + * @package heidelpayPHP\test\unit */ namespace heidelpayPHP\test\unit\Traits; diff --git a/test/unit/Traits/CanPayoutWithCustomerTest.php b/test/unit/Traits/CanPayoutWithCustomerTest.php index a82efc22..6b28d34e 100644 --- a/test/unit/Traits/CanPayoutWithCustomerTest.php +++ b/test/unit/Traits/CanPayoutWithCustomerTest.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/unit + * @package heidelpayPHP\test\unit */ namespace heidelpayPHP\test\unit\Traits; diff --git a/test/unit/Traits/CanRecurTest.php b/test/unit/Traits/CanRecurTest.php index 77cde3a3..3d52cac2 100644 --- a/test/unit/Traits/CanRecurTest.php +++ b/test/unit/Traits/CanRecurTest.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/unit + * @package heidelpayPHP\test\unit */ namespace heidelpayPHP\test\unit\Traits; diff --git a/test/unit/Traits/HasCancellationsTest.php b/test/unit/Traits/HasCancellationsTest.php index d4813665..07fff25b 100755 --- a/test/unit/Traits/HasCancellationsTest.php +++ b/test/unit/Traits/HasCancellationsTest.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/unit + * @package heidelpayPHP\test\unit */ namespace heidelpayPHP\test\unit\Traits; diff --git a/test/unit/Traits/HasInvoiceIdTest.php b/test/unit/Traits/HasInvoiceIdTest.php index 580a0c87..180628fa 100755 --- a/test/unit/Traits/HasInvoiceIdTest.php +++ b/test/unit/Traits/HasInvoiceIdTest.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/unit + * @package heidelpayPHP\test\unit */ namespace heidelpayPHP\test\unit\Traits; diff --git a/test/unit/Traits/HasPaymentStateTest.php b/test/unit/Traits/HasPaymentStateTest.php index 3c68907e..9b0a6b83 100755 --- a/test/unit/Traits/HasPaymentStateTest.php +++ b/test/unit/Traits/HasPaymentStateTest.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/unit + * @package heidelpayPHP\test\unit */ namespace heidelpayPHP\test\unit\Traits; diff --git a/test/unit/Traits/TraitDummyCanRecur.php b/test/unit/Traits/TraitDummyCanRecur.php index e3197bf4..08f1d790 100644 --- a/test/unit/Traits/TraitDummyCanRecur.php +++ b/test/unit/Traits/TraitDummyCanRecur.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/unit + * @package heidelpayPHP\test\unit */ namespace heidelpayPHP\test\unit\Traits; diff --git a/test/unit/Traits/TraitDummyCanRecurNonResource.php b/test/unit/Traits/TraitDummyCanRecurNonResource.php index 7d05b6bc..ec8e7be8 100644 --- a/test/unit/Traits/TraitDummyCanRecurNonResource.php +++ b/test/unit/Traits/TraitDummyCanRecurNonResource.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/unit + * @package heidelpayPHP\test\unit */ namespace heidelpayPHP\test\unit\Traits; diff --git a/test/unit/Traits/TraitDummyHasCancellationsHasPaymentState.php b/test/unit/Traits/TraitDummyHasCancellationsHasPaymentState.php index b7b9d185..92d6cbbe 100755 --- a/test/unit/Traits/TraitDummyHasCancellationsHasPaymentState.php +++ b/test/unit/Traits/TraitDummyHasCancellationsHasPaymentState.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/unit + * @package heidelpayPHP\test\unit */ namespace heidelpayPHP\test\unit\Traits; diff --git a/test/unit/Traits/TraitDummyHasInvoiceId.php b/test/unit/Traits/TraitDummyHasInvoiceId.php index d78568eb..588a467e 100755 --- a/test/unit/Traits/TraitDummyHasInvoiceId.php +++ b/test/unit/Traits/TraitDummyHasInvoiceId.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/unit + * @package heidelpayPHP\test\unit */ namespace heidelpayPHP\test\unit\Traits; diff --git a/test/unit/Traits/TraitDummyWithCustomerWithParentIF.php b/test/unit/Traits/TraitDummyWithCustomerWithParentIF.php index a15cc61b..e1093d10 100755 --- a/test/unit/Traits/TraitDummyWithCustomerWithParentIF.php +++ b/test/unit/Traits/TraitDummyWithCustomerWithParentIF.php @@ -21,7 +21,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/unit + * @package heidelpayPHP\test\unit */ namespace heidelpayPHP\test\unit\Traits; diff --git a/test/unit/Traits/TraitDummyWithCustomerWithoutParentIF.php b/test/unit/Traits/TraitDummyWithCustomerWithoutParentIF.php index 7ef7860a..a96e6b2e 100755 --- a/test/unit/Traits/TraitDummyWithCustomerWithoutParentIF.php +++ b/test/unit/Traits/TraitDummyWithCustomerWithoutParentIF.php @@ -21,7 +21,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/unit + * @package heidelpayPHP\test\unit */ namespace heidelpayPHP\test\unit\Traits; diff --git a/test/unit/Traits/TraitDummyWithoutCustomerWithParentIF.php b/test/unit/Traits/TraitDummyWithoutCustomerWithParentIF.php index 7116739c..44327844 100755 --- a/test/unit/Traits/TraitDummyWithoutCustomerWithParentIF.php +++ b/test/unit/Traits/TraitDummyWithoutCustomerWithParentIF.php @@ -21,7 +21,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/unit + * @package heidelpayPHP\test\unit */ namespace heidelpayPHP\test\unit\Traits; diff --git a/test/unit/Traits/TraitDummyWithoutCustomerWithoutParentIF.php b/test/unit/Traits/TraitDummyWithoutCustomerWithoutParentIF.php index d1bc85a9..917e5056 100755 --- a/test/unit/Traits/TraitDummyWithoutCustomerWithoutParentIF.php +++ b/test/unit/Traits/TraitDummyWithoutCustomerWithoutParentIF.php @@ -21,7 +21,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/unit + * @package heidelpayPHP\test\unit */ namespace heidelpayPHP\test\unit\Traits; diff --git a/test/unit/Validators/PrivateKeyValidatorTest.php b/test/unit/Validators/PrivateKeyValidatorTest.php index b56f6389..68a9ccb9 100755 --- a/test/unit/Validators/PrivateKeyValidatorTest.php +++ b/test/unit/Validators/PrivateKeyValidatorTest.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/unit + * @package heidelpayPHP\test\unit */ namespace heidelpayPHP\test\unit\Resources; diff --git a/test/unit/Validators/PublicKeyValidatorTest.php b/test/unit/Validators/PublicKeyValidatorTest.php index fd0a4e10..46be7063 100755 --- a/test/unit/Validators/PublicKeyValidatorTest.php +++ b/test/unit/Validators/PublicKeyValidatorTest.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/unit + * @package heidelpayPHP\test\unit */ namespace heidelpayPHP\test\unit\Resources; From 8070acfa696eb559d8281ebe988acebdf36eb589 Mon Sep 17 00:00:00 2001 From: sixer1182 Date: Fri, 29 Nov 2019 10:35:53 +0100 Subject: [PATCH 032/101] [refactor] (PHPLIB-274) Fix examples. --- examples/CardRecurring/ReturnController.php | 6 +----- examples/HirePurchaseDirectDebit/Controller.php | 10 +++++----- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/examples/CardRecurring/ReturnController.php b/examples/CardRecurring/ReturnController.php index ec55455d..d52ac604 100644 --- a/examples/CardRecurring/ReturnController.php +++ b/examples/CardRecurring/ReturnController.php @@ -65,12 +65,8 @@ function redirect($url, $merchantMessage = '', $clientMessage = '') /** @var Card $paymentType */ $paymentType = $heidelpay->fetchPaymentType($paymentTypeId); - switch (true) { - case $paymentType->isRecurring(): + if ($paymentType->isRecurring()) { redirect(SUCCESS_URL); - break; - default: - break; } } catch (HeidelpayApiException $e) { diff --git a/examples/HirePurchaseDirectDebit/Controller.php b/examples/HirePurchaseDirectDebit/Controller.php index 21efa1f0..a382d540 100644 --- a/examples/HirePurchaseDirectDebit/Controller.php +++ b/examples/HirePurchaseDirectDebit/Controller.php @@ -35,7 +35,7 @@ use heidelpayPHP\Exceptions\HeidelpayApiException; use heidelpayPHP\Heidelpay; use heidelpayPHP\Resources\Basket; -use heidelpayPHP\Resources\Customer; +use heidelpayPHP\Resources\CustomerFactory; use heidelpayPHP\Resources\EmbeddedResources\Address; use heidelpayPHP\Resources\EmbeddedResources\BasketItem; use heidelpayPHP\Resources\PaymentTypes\HirePurchaseDirectDebit; @@ -80,7 +80,7 @@ function redirect($url, $merchantMessage = '', $clientMessage = '') ->setCity('Heidelberg') ->setZip('69155') ->setCountry('DE'); - $customer = (new Customer('Linda', 'Heideich')) + $customer = CustomerFactory::createCustomer('Linda', 'Heideich') ->setBirthDate('2000-02-12') ->setBillingAddress($address) ->setShippingAddress($address) @@ -91,8 +91,7 @@ function redirect($url, $merchantMessage = '', $clientMessage = '') ->setAmountNet(100.0) ->setAmountGross(119.0) ->setAmountVat(19.0); - $basket = (new Basket($orderId, 119.0, 'EUR', [$basketItem])) - ->setAmountTotalVat(19.0); + $basket = (new Basket($orderId, 119.0, 'EUR', [$basketItem]))->setAmountTotalVat(19.0); // initialize the payment $authorize = $heidelpay->authorize( @@ -103,7 +102,8 @@ function redirect($url, $merchantMessage = '', $clientMessage = '') $customer, $orderId, null, - $basket); + $basket + ); // You'll need to remember the shortId to show it on the success or failure page $_SESSION['PaymentId'] = $authorize->getPaymentId(); From 0d92c16edb3cbd70f0d8215378ca74bdd27ca249 Mon Sep 17 00:00:00 2001 From: sixer1182 Date: Fri, 29 Nov 2019 10:51:07 +0100 Subject: [PATCH 033/101] [refactor] (PHPLIB-274) Fix package annotations. --- test/integration/PaymentTypes/PISTest.php | 2 +- test/unit/Resources/PaymentTest.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/test/integration/PaymentTypes/PISTest.php b/test/integration/PaymentTypes/PISTest.php index 2ad2bd00..d938646e 100755 --- a/test/integration/PaymentTypes/PISTest.php +++ b/test/integration/PaymentTypes/PISTest.php @@ -21,7 +21,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP\test\integration\PaymentTypes + * @package heidelpayPHP\tests/integration/payment_types */ namespace heidelpayPHP\test\integration\PaymentTypes; diff --git a/test/unit/Resources/PaymentTest.php b/test/unit/Resources/PaymentTest.php index 0f3b706b..05dd4d6e 100755 --- a/test/unit/Resources/PaymentTest.php +++ b/test/unit/Resources/PaymentTest.php @@ -20,7 +20,7 @@ * * @author Simon Gabriel * - * @package heidelpayPHP/test/unit + * @package heidelpayPHP\test\unit */ namespace heidelpayPHP\test\unit\Resources; From 954a0be746706548ef552c67d34cde6f5eaa937e Mon Sep 17 00:00:00 2001 From: sixer1182 Date: Fri, 29 Nov 2019 10:51:40 +0100 Subject: [PATCH 034/101] [refactor] (PHPLIB-274) Fix doc comments. --- src/Heidelpay.php | 24 +++---- src/Resources/AbstractHeidelpayResource.php | 8 +-- src/Resources/Payment.php | 20 +++--- src/Resources/PaymentTypes/Paypage.php | 7 +- .../AbstractTransactionType.php | 4 +- .../TransactionTypes/Authorization.php | 4 +- src/Resources/TransactionTypes/Charge.php | 4 +- src/Services/ResourceService.php | 41 +++++------ src/Traits/CanAuthorize.php | 4 +- src/Traits/CanDirectCharge.php | 6 +- src/Traits/CanDirectChargeWithCustomer.php | 6 +- src/Traits/CanPayout.php | 6 +- src/Traits/CanPayoutWithCustomer.php | 6 +- src/Traits/HasCancellations.php | 8 +-- test/BasePaymentTest.php | 12 ++-- test/integration/BasketTest.php | 20 +++--- test/integration/CustomerTest.php | 72 +++++++++---------- test/integration/ExceptionTest.php | 4 +- test/integration/PaymentCancelTest.php | 68 +++++++++--------- test/integration/PaymentTest.php | 40 +++++------ test/integration/PaymentTypes/CardTest.php | 56 +++++++-------- test/integration/PaymentTypes/EPSTest.php | 12 ++-- test/integration/PaymentTypes/GiropayTest.php | 16 ++--- .../HirePurchaseDirectDebitTest.php | 28 ++++---- test/integration/PaymentTypes/IdealTest.php | 16 ++--- .../PaymentTypes/InvoiceFactoringTest.php | 52 +++++++------- test/integration/PaymentTypes/InvoiceTest.php | 28 ++++---- .../PaymentTypes/PrepaymentTest.php | 20 +++--- .../PaymentTypes/Przelewy24Test.php | 16 ++--- .../SepaDirectDebitGuaranteedTest.php | 16 ++--- .../PaymentTypes/SepaDirectDebitTest.php | 20 +++--- test/integration/SetMetadataTest.php | 8 +-- .../TransactionTypes/AuthorizationTest.php | 20 +++--- .../CancelAfterAuthorizationTest.php | 16 ++--- .../CancelAfterChargeTest.php | 16 ++--- .../TransactionTypes/CancelTest.php | 4 +- .../TransactionTypes/ChargeTest.php | 12 ++-- .../TransactionTypes/PayoutTest.php | 8 +-- .../TransactionTypes/ShipmentTest.php | 4 +- test/integration/WebhookTest.php | 28 ++++---- test/unit/Resources/PaymentTest.php | 68 +++++++++--------- .../Resources/PaymentTypes/PayPageTest.php | 8 +-- .../TransactionTypes/AuthorizationTest.php | 4 +- .../TransactionTypes/ShipmentTest.php | 4 +- test/unit/Services/ResourceServiceTest.php | 19 +++-- test/unit/Traits/CanRecurTest.php | 4 +- 46 files changed, 429 insertions(+), 438 deletions(-) diff --git a/src/Heidelpay.php b/src/Heidelpay.php index 4402db82..2b7866a6 100755 --- a/src/Heidelpay.php +++ b/src/Heidelpay.php @@ -349,8 +349,8 @@ public function fetchResource(AbstractHeidelpayResource $resource): AbstractHeid * * @return mixed * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function activateRecurringPayment($paymentType, $returnUrl) { @@ -421,8 +421,8 @@ public function fetchKeypair($detailed = false): AbstractHeidelpayResource * * @return Metadata The fetched Metadata resource. * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function createMetadata($metadata): Metadata { @@ -436,8 +436,8 @@ public function createMetadata($metadata): Metadata * * @return Metadata The fetched Metadata resource. * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function fetchMetadata($metadata): Metadata { @@ -455,8 +455,8 @@ public function fetchMetadata($metadata): Metadata * * @return Basket The created Basket object. * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function createBasket(Basket $basket): Basket { @@ -470,8 +470,8 @@ public function createBasket(Basket $basket): Basket * * @return Basket The fetched Basket object. * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function fetchBasket($basket): Basket { @@ -485,8 +485,8 @@ public function fetchBasket($basket): Basket * * @return Basket The updated Basket object. * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function updateBasket(Basket $basket): Basket { diff --git a/src/Resources/AbstractHeidelpayResource.php b/src/Resources/AbstractHeidelpayResource.php index 2b788fe5..08fad861 100755 --- a/src/Resources/AbstractHeidelpayResource.php +++ b/src/Resources/AbstractHeidelpayResource.php @@ -299,8 +299,8 @@ private function getResourceService(): ResourceService * * @return AbstractHeidelpayResource * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ protected function getResource(AbstractHeidelpayResource $resource): AbstractHeidelpayResource { @@ -312,8 +312,8 @@ protected function getResource(AbstractHeidelpayResource $resource): AbstractHei * * @param AbstractHeidelpayResource $resource * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ protected function fetchResource(AbstractHeidelpayResource $resource) { diff --git a/src/Resources/Payment.php b/src/Resources/Payment.php index 21181d9d..081d2880 100755 --- a/src/Resources/Payment.php +++ b/src/Resources/Payment.php @@ -275,7 +275,7 @@ public function getChargeByIndex($index, $lazy = false) * The Customer resource can be passed as Customer object or the Id of a Customer resource. * If the Customer object has not been created yet via API this is done automatically. * - * @param Customer|string $customer The Customer object or the id of the Customer to be referenced by the Payment. + * @param Customer|string|null $customer The Customer object or the id of the Customer to be referenced by the Payment. * * @return Payment This Payment object. * @@ -374,8 +374,8 @@ public function getMetadata() * * @return Payment * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function setMetadata($metadata): Payment { @@ -408,8 +408,8 @@ public function getBasket() * * @return Payment * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function setBasket($basket): Payment { @@ -805,8 +805,8 @@ public function cancelAuthorization($amount = null): array * * @return Cancellation|null * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function cancelAuthorizationAmount($amount = null) { @@ -850,7 +850,7 @@ public function cancelAuthorizationAmount($amount = null) * @param null $amount The amount to be charged. * @param null $currency The currency of the charged amount. * - * @return Charge The resulting Charge object. + * @return Charge|AbstractHeidelpayResource The resulting Charge object. * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. @@ -883,8 +883,8 @@ public function ship($invoiceId = null, $orderId = null) /** * @param array $transactions * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ private function updateResponseTransactions(array $transactions = []) { diff --git a/src/Resources/PaymentTypes/Paypage.php b/src/Resources/PaymentTypes/Paypage.php index ae25a65a..903b104d 100644 --- a/src/Resources/PaymentTypes/Paypage.php +++ b/src/Resources/PaymentTypes/Paypage.php @@ -578,11 +578,8 @@ protected function getResourcePath(): string * {@inheritDoc} * Map external name of property to internal name of property. * - * @param stdClass $response - * @param string $method - * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function handleResponse(stdClass $response, $method = HttpAdapterInterface::REQUEST_GET) { diff --git a/src/Resources/TransactionTypes/AbstractTransactionType.php b/src/Resources/TransactionTypes/AbstractTransactionType.php index 59bb7488..e98528d0 100755 --- a/src/Resources/TransactionTypes/AbstractTransactionType.php +++ b/src/Resources/TransactionTypes/AbstractTransactionType.php @@ -154,8 +154,8 @@ public function getMessage(): Message /** * {@inheritDoc} * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function handleResponse(stdClass $response, $method = HttpAdapterInterface::REQUEST_GET) { diff --git a/src/Resources/TransactionTypes/Authorization.php b/src/Resources/TransactionTypes/Authorization.php index c4580fdd..f733b73a 100755 --- a/src/Resources/TransactionTypes/Authorization.php +++ b/src/Resources/TransactionTypes/Authorization.php @@ -279,8 +279,8 @@ public function cancel($amount = null): Cancellation * * @return Charge * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function charge($amount = null): Charge { diff --git a/src/Resources/TransactionTypes/Charge.php b/src/Resources/TransactionTypes/Charge.php index 0121ce53..c88389ea 100755 --- a/src/Resources/TransactionTypes/Charge.php +++ b/src/Resources/TransactionTypes/Charge.php @@ -312,8 +312,8 @@ protected function getResourcePath(): string * * @return Cancellation The resulting Cancellation object. * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function cancel( $amount = null, diff --git a/src/Services/ResourceService.php b/src/Services/ResourceService.php index 13ace975..66aab556 100755 --- a/src/Services/ResourceService.php +++ b/src/Services/ResourceService.php @@ -73,7 +73,7 @@ class ResourceService private $heidelpay; /** - * PaymentService constructor. + * ResourceService constructor. * * @param Heidelpay $heidelpay */ @@ -92,8 +92,8 @@ public function __construct(Heidelpay $heidelpay) * * @return stdClass * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function send( AbstractHeidelpayResource $resource, @@ -112,8 +112,8 @@ public function send( * * @return AbstractHeidelpayResource * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function getResource(AbstractHeidelpayResource $resource): AbstractHeidelpayResource { @@ -199,9 +199,8 @@ public function fetchResourceByUrl($url) * * @return AbstractHeidelpayResource * - * @throws HeidelpayApiException - * @throws RuntimeException - * @throws Exception + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function create(AbstractHeidelpayResource $resource): AbstractHeidelpayResource { @@ -228,8 +227,8 @@ public function create(AbstractHeidelpayResource $resource): AbstractHeidelpayRe * * @return AbstractHeidelpayResource * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. * @throws Exception */ public function update(AbstractHeidelpayResource $resource): AbstractHeidelpayResource @@ -251,8 +250,8 @@ public function update(AbstractHeidelpayResource $resource): AbstractHeidelpayRe * * @return AbstractHeidelpayResource|null * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function delete(AbstractHeidelpayResource &$resource) { @@ -270,15 +269,14 @@ public function delete(AbstractHeidelpayResource &$resource) } /** - * Fetch the resource from the api (id must be set). + * Updates the given local resource object (id must be set) * - * @param AbstractHeidelpayResource $resource + * @param AbstractHeidelpayResource $resource The local resource object to update. * - * @return AbstractHeidelpayResource + * @return AbstractHeidelpayResource The updated resource object. * - * @throws HeidelpayApiException - * @throws RuntimeException - * @throws Exception + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function fetch(AbstractHeidelpayResource $resource): AbstractHeidelpayResource { @@ -353,15 +351,14 @@ public function createRecurring($paymentType, $returnUrl): Recurring /** * Fetches the payment object if the id is given. - * Else it just returns the given payment argument. - * (!) It does not fetch or update a given payment object but returns it as-is. (!) + * Else it just returns the given payment argument as-is. * * @param $payment * * @return AbstractHeidelpayResource|Payment * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function getPaymentResource($payment) { diff --git a/src/Traits/CanAuthorize.php b/src/Traits/CanAuthorize.php index a362840c..727ef1ef 100755 --- a/src/Traits/CanAuthorize.php +++ b/src/Traits/CanAuthorize.php @@ -54,8 +54,8 @@ trait CanAuthorize * * @return Authorization * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function authorize( $amount, diff --git a/src/Traits/CanDirectCharge.php b/src/Traits/CanDirectCharge.php index af5f6652..196fdf14 100755 --- a/src/Traits/CanDirectCharge.php +++ b/src/Traits/CanDirectCharge.php @@ -52,10 +52,10 @@ trait CanDirectCharge * @param string|null $invoiceId The external id of the invoice. * @param string|null $paymentReference A reference text for the payment. * - * @return Charge + * @return Charge The resulting charge object. * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function charge( $amount, diff --git a/src/Traits/CanDirectChargeWithCustomer.php b/src/Traits/CanDirectChargeWithCustomer.php index 41f1fc06..3202f515 100755 --- a/src/Traits/CanDirectChargeWithCustomer.php +++ b/src/Traits/CanDirectChargeWithCustomer.php @@ -52,10 +52,10 @@ trait CanDirectChargeWithCustomer * @param string|null $invoiceId The external id of the invoice. * @param string|null $paymentReference A reference text for the payment. * - * @return Charge + * @return Charge The resulting charge object. * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function charge( $amount, diff --git a/src/Traits/CanPayout.php b/src/Traits/CanPayout.php index e5c9cb19..23d39c5e 100644 --- a/src/Traits/CanPayout.php +++ b/src/Traits/CanPayout.php @@ -50,10 +50,10 @@ trait CanPayout * @param string|null $invoiceId The external id of the invoice. * @param string|null $paymentReference A reference text for the payment. * - * @return Payout + * @return Payout The resulting payout object. * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function payout( $amount, diff --git a/src/Traits/CanPayoutWithCustomer.php b/src/Traits/CanPayoutWithCustomer.php index ab645672..80f8d39e 100644 --- a/src/Traits/CanPayoutWithCustomer.php +++ b/src/Traits/CanPayoutWithCustomer.php @@ -48,10 +48,10 @@ trait CanPayoutWithCustomer * The Basket object will be created automatically if it does not exist * yet (i.e. has no id). * - * @return Payout + * @return Payout The resulting payout object. * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function payout( $amount, diff --git a/src/Traits/HasCancellations.php b/src/Traits/HasCancellations.php index 9aa11471..fb37f04f 100755 --- a/src/Traits/HasCancellations.php +++ b/src/Traits/HasCancellations.php @@ -73,13 +73,13 @@ public function addCancellation(Cancellation $cancellation): self /** * Return specific Cancellation object or null if it does not exist. * - * @param string $cancellationId + * @param string $cancellationId The id of the cancellation object * @param boolean $lazy * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. * - * @return mixed + * @return Cancellation|null The cancellation or null if none could be found. */ public function getCancellation($cancellationId, $lazy = false) { diff --git a/test/BasePaymentTest.php b/test/BasePaymentTest.php index 296f248b..d0cce3dd 100755 --- a/test/BasePaymentTest.php +++ b/test/BasePaymentTest.php @@ -177,8 +177,8 @@ protected function assertPending($transaction) * * @return Basket * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function createBasket(): Basket { @@ -234,8 +234,8 @@ protected function createCardObject(string $cardNumber = '5453010000059543'): Ca * * @return Authorization * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function createCardAuthorization($amount = 100.0): Authorization { @@ -269,8 +269,8 @@ public function createPaypalAuthorization(): Authorization * * @return Charge * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function createCharge($amount = 100.0): Charge { diff --git a/test/integration/BasketTest.php b/test/integration/BasketTest.php index 951b6718..6aa49326 100755 --- a/test/integration/BasketTest.php +++ b/test/integration/BasketTest.php @@ -138,8 +138,8 @@ public function basketItemWithInvalidUrlWillThrowAnError($expectException, $imag * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function basketShouldBeUpdateable() { @@ -170,8 +170,8 @@ public function basketShouldBeUpdateable() * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function authorizeTransactionsShouldPassAlongTheBasketIdIfSet() { @@ -196,8 +196,8 @@ public function authorizeTransactionsShouldPassAlongTheBasketIdIfSet() * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function chargeTransactionsShouldPassAlongTheBasketIdIfSet() { @@ -219,8 +219,8 @@ public function chargeTransactionsShouldPassAlongTheBasketIdIfSet() * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function authorizeTransactionsShouldCreateBasketIfItDoesNotExistYet() { @@ -245,8 +245,8 @@ public function authorizeTransactionsShouldCreateBasketIfItDoesNotExistYet() * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function chargeTransactionsShouldCreateBasketIfItDoesNotExistYet() { diff --git a/test/integration/CustomerTest.php b/test/integration/CustomerTest.php index 8b405c92..9b02e08e 100755 --- a/test/integration/CustomerTest.php +++ b/test/integration/CustomerTest.php @@ -47,8 +47,8 @@ class CustomerTest extends BasePaymentTest * * @return Customer * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function minCustomerCanBeCreatedAndFetched(): Customer { @@ -84,8 +84,8 @@ public function minCustomerCanBeCreatedAndFetched(): Customer * * @return Customer * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function maxCustomerCanBeCreatedAndFetched(): Customer { @@ -104,8 +104,8 @@ public function maxCustomerCanBeCreatedAndFetched(): Customer /** * @param Customer $customer * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. * @depends maxCustomerCanBeCreatedAndFetched * @test */ @@ -116,8 +116,8 @@ public function customerCanBeFetchedById(Customer $customer) } /** - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. * @depends maxCustomerCanBeCreatedAndFetched * @test */ @@ -134,8 +134,8 @@ public function customerCanBeFetchedByCustomerId() /** * @param Customer $customer * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. * @depends maxCustomerCanBeCreatedAndFetched * @test */ @@ -149,8 +149,8 @@ public function customerCanBeFetchedByObject(Customer $customer) /** * @param Customer $customer * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. * @depends maxCustomerCanBeCreatedAndFetched * @test */ @@ -168,8 +168,8 @@ public function customerCanBeFetchedByObjectWithData(Customer $customer) * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function transactionShouldCreateAndReferenceCustomerIfItDoesNotExistYet() { @@ -194,8 +194,8 @@ public function transactionShouldCreateAndReferenceCustomerIfItDoesNotExistYet() * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function transactionShouldReferenceCustomerIfItExist() { @@ -220,8 +220,8 @@ public function transactionShouldReferenceCustomerIfItExist() * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function transactionShouldReferenceCustomerIfItExistAndItsIdHasBeenPassed() { @@ -249,8 +249,8 @@ public function transactionShouldReferenceCustomerIfItExistAndItsIdHasBeenPassed * * @param Customer $customer * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function customerShouldBeUpdatable(Customer $customer) { @@ -273,8 +273,8 @@ public function customerShouldBeUpdatable(Customer $customer) * * @param Customer $customer * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function customerShouldBeDeletableById(Customer $customer) { @@ -293,8 +293,8 @@ public function customerShouldBeDeletableById(Customer $customer) * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function customerShouldBeDeletableByObject() { @@ -316,8 +316,8 @@ public function customerShouldBeDeletableByObject() * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function apiShouldReturnErrorIfCustomerAlreadyExists() { @@ -339,8 +339,8 @@ public function apiShouldReturnErrorIfCustomerAlreadyExists() * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function customerShouldBeFetchedByCustomerIdAndUpdatedIfItAlreadyExists() { @@ -380,8 +380,8 @@ public function customerShouldBeFetchedByCustomerIdAndUpdatedIfItAlreadyExists() * * @return Customer * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function minNotRegisteredB2bCustomerCanBeCreatedAndFetched(): Customer { @@ -405,8 +405,8 @@ public function minNotRegisteredB2bCustomerCanBeCreatedAndFetched(): Customer * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function maxNotRegisteredB2bCustomerCanBeCreatedAndFetched() { @@ -432,8 +432,8 @@ public function maxNotRegisteredB2bCustomerCanBeCreatedAndFetched() * * @return Customer * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function minRegisteredB2bCustomerCanBeCreatedAndFetched(): Customer { @@ -457,8 +457,8 @@ public function minRegisteredB2bCustomerCanBeCreatedAndFetched(): Customer * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function maxRegisteredB2bCustomerCanBeCreatedAndFetched() { diff --git a/test/integration/ExceptionTest.php b/test/integration/ExceptionTest.php index 51a9fc84..b339c979 100755 --- a/test/integration/ExceptionTest.php +++ b/test/integration/ExceptionTest.php @@ -39,8 +39,8 @@ class ExceptionTest extends BasePaymentTest * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function apiExceptionShouldHoldClientMessage() { diff --git a/test/integration/PaymentCancelTest.php b/test/integration/PaymentCancelTest.php index 07b7ba34..396c186d 100644 --- a/test/integration/PaymentCancelTest.php +++ b/test/integration/PaymentCancelTest.php @@ -41,8 +41,8 @@ class PaymentCancelTest extends BasePaymentTest * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function doubleCancelOnAuthorizeShouldReturnEmptyArray() { @@ -68,8 +68,8 @@ public function doubleCancelOnAuthorizeShouldReturnEmptyArray() * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function cancelOnChargeAndDoubleCancel() { @@ -96,8 +96,8 @@ public function cancelOnChargeAndDoubleCancel() * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function fullCancelOnPaymentWithAuthorizeAndMultipleChargesShouldBePossible() { @@ -127,8 +127,8 @@ public function fullCancelOnPaymentWithAuthorizeAndMultipleChargesShouldBePossib * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function partialCancelAndFullCancelOnSingleCharge() { @@ -159,8 +159,8 @@ public function partialCancelAndFullCancelOnSingleCharge() * * @throws AssertionFailedError * @throws Exception - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function partialCancelOnMultipleChargedAuthorization($amount, $numberCancels) { @@ -194,8 +194,8 @@ public function partialCancelOnMultipleChargedAuthorization($amount, $numberCanc * * @throws AssertionFailedError * @throws Exception - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function fullCancelOnAuthorize($amount) { @@ -215,8 +215,8 @@ public function fullCancelOnAuthorize($amount) * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function fullCancelOnPartCanceledAuthorize() { @@ -251,8 +251,8 @@ public function fullCancelOnPartCanceledAuthorize() * * @throws AssertionFailedError * @throws Exception - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function fullCancelOnFullyChargedAuthorize($amount) { @@ -282,8 +282,8 @@ public function fullCancelOnFullyChargedAuthorize($amount) * * @throws AssertionFailedError * @throws Exception - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function fullCancelOnPartlyChargedAuthorizeShouldBePossible($amount) { @@ -310,8 +310,8 @@ public function fullCancelOnPartlyChargedAuthorizeShouldBePossible($amount) * * @throws AssertionFailedError * @throws Exception - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function partCancelOnUnchargedAuthorize() { @@ -333,8 +333,8 @@ public function partCancelOnUnchargedAuthorize() * * @throws AssertionFailedError * @throws Exception - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function partCancelOnPartlyChargedAuthorizeWithAmountLtCharged() { @@ -361,8 +361,8 @@ public function partCancelOnPartlyChargedAuthorizeWithAmountLtCharged() * * @throws AssertionFailedError * @throws Exception - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function partCancelOnPartlyChargedAuthorizeWithAmountGtCharged() { @@ -392,8 +392,8 @@ public function partCancelOnPartlyChargedAuthorizeWithAmountGtCharged() * * @throws AssertionFailedError * @throws Exception - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function fullCancelOnInitialInvoiceCharge($amount) { @@ -417,8 +417,8 @@ public function fullCancelOnInitialInvoiceCharge($amount) * * @throws AssertionFailedError * @throws Exception - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function partCancelOnInitialInvoiceChargeShouldBePossible() { @@ -442,8 +442,8 @@ public function partCancelOnInitialInvoiceChargeShouldBePossible() * * @throws AssertionFailedError * @throws Exception - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function cancelMoreThanWasCharged() { @@ -465,8 +465,8 @@ public function cancelMoreThanWasCharged() * * @throws AssertionFailedError * @throws Exception - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function secondCancelExceedsRemainderOfPartlyCancelledCharge() { @@ -500,8 +500,8 @@ public function secondCancelExceedsRemainderOfPartlyCancelledCharge() * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function cancellationShouldWorkWithAllParametersSet() { diff --git a/test/integration/PaymentTest.php b/test/integration/PaymentTest.php index dd1cbff8..54aa226e 100755 --- a/test/integration/PaymentTest.php +++ b/test/integration/PaymentTest.php @@ -41,8 +41,8 @@ class PaymentTest extends BasePaymentTest * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function paymentShouldBeFetchableById() { @@ -60,8 +60,8 @@ public function paymentShouldBeFetchableById() * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function fullChargeShouldBePossibleOnPaymentObject() { @@ -86,8 +86,8 @@ public function fullChargeShouldBePossibleOnPaymentObject() * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function paymentShouldBeFetchableWithCharges() { @@ -116,8 +116,8 @@ public function paymentShouldBeFetchableWithCharges() * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function partialChargeAfterAuthorization() { @@ -134,8 +134,8 @@ public function partialChargeAfterAuthorization() * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function authorizationShouldBePossibleOnHeidelpayObject() { @@ -151,8 +151,8 @@ public function authorizationShouldBePossibleOnHeidelpayObject() * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function paymentChargeOnAuthorizeShouldBePossibleUsingPaymentId() { @@ -160,7 +160,7 @@ public function paymentChargeOnAuthorizeShouldBePossibleUsingPaymentId() $authorization = $this->heidelpay->authorize(100.00, 'EUR', $card, 'http://heidelpay.com', null, null, null, null, false); $charge = $this->heidelpay->chargePayment($authorization->getPaymentId()); - $this->assertInstanceOf(Charge::class, $charge); + $this->assertNotEmpty($charge->getId()); } /** @@ -168,8 +168,8 @@ public function paymentChargeOnAuthorizeShouldBePossibleUsingPaymentId() * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function paymentChargeOnAuthorizeShouldTakeResourceIds() { @@ -177,7 +177,7 @@ public function paymentChargeOnAuthorizeShouldTakeResourceIds() $authorization = $this->heidelpay->authorize(100.00, 'EUR', $card, 'http://heidelpay.com', null, null, null, null, false); $charge = $this->heidelpay->chargePayment($authorization->getPaymentId(), null, 'order-' . self::generateRandomId(), 'invoice-' . self::generateRandomId()); - $this->assertInstanceOf(Charge::class, $charge); + $this->assertNotEmpty($charge->getId()); } /** @@ -185,8 +185,8 @@ public function paymentChargeOnAuthorizeShouldTakeResourceIds() * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function chargePaymentShouldThrowErrorOnNonPaymentId() { @@ -200,8 +200,8 @@ public function chargePaymentShouldThrowErrorOnNonPaymentId() * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function apiShouldReturnErrorIfOrderIdAlreadyExists() { diff --git a/test/integration/PaymentTypes/CardTest.php b/test/integration/PaymentTypes/CardTest.php index deb07931..7cca8555 100755 --- a/test/integration/PaymentTypes/CardTest.php +++ b/test/integration/PaymentTypes/CardTest.php @@ -53,8 +53,8 @@ class CardTest extends BasePaymentTest * @return BasePaymentType * * @throws Exception - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function cardShouldBeCreatable(string $cardNumber, CardDetails $expectedCardDetails): BasePaymentType { @@ -95,8 +95,8 @@ public function cardWith3dsFlagShouldSetItAlsoInTransactions() * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function cardCanPerformAuthorizationAndCreatesPayment() { @@ -129,8 +129,8 @@ public function cardCanPerformAuthorizationAndCreatesPayment() * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function cardCanPerformChargeAndCreatesPaymentObject() { @@ -171,8 +171,8 @@ public function cardCanPerformChargeAndCreatesPaymentObject() * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function cardCanBeFetched() { @@ -194,8 +194,8 @@ public function cardCanBeFetched() * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function fullChargeAfterAuthorize() { @@ -225,8 +225,8 @@ public function fullChargeAfterAuthorize() * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function partialChargeAfterAuthorization() { @@ -270,8 +270,8 @@ public function partialChargeAfterAuthorization() * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function exceptionShouldBeThrownWhenChargingMoreThenAuthorized() { @@ -298,8 +298,8 @@ public function exceptionShouldBeThrownWhenChargingMoreThenAuthorized() * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function partialAndFullChargeAfterAuthorization() { @@ -328,8 +328,8 @@ public function partialAndFullChargeAfterAuthorization() * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function authorizationShouldBeFetchable() { @@ -346,8 +346,8 @@ public function authorizationShouldBeFetchable() /** * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function fullCancelAfterCharge() { @@ -370,8 +370,8 @@ public function fullCancelAfterCharge() * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function fullCancelOnFullyChargedPayment() { @@ -404,8 +404,8 @@ public function fullCancelOnFullyChargedPayment() * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function fullCancelOnPartlyPaidAuthWithCanceledCharges() { @@ -436,8 +436,8 @@ public function fullCancelOnPartlyPaidAuthWithCanceledCharges() * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function cardChargeCanBeCanceled() { @@ -455,8 +455,8 @@ public function cardChargeCanBeCanceled() * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function cardAuthorizeCanBeCanceled() { diff --git a/test/integration/PaymentTypes/EPSTest.php b/test/integration/PaymentTypes/EPSTest.php index c9710749..3b40122e 100755 --- a/test/integration/PaymentTypes/EPSTest.php +++ b/test/integration/PaymentTypes/EPSTest.php @@ -41,8 +41,8 @@ class EPSTest extends BasePaymentTest * * @return EPS * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function epsShouldBeCreatable(): EPS { @@ -68,8 +68,8 @@ public function epsShouldBeCreatable(): EPS * * @param EPS $eps * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. * @depends epsShouldBeCreatable */ public function epsShouldThrowExceptionOnAuthorize(EPS $eps) @@ -88,8 +88,8 @@ public function epsShouldThrowExceptionOnAuthorize(EPS $eps) * * @param EPS $eps * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function epsShouldBeChargeable(EPS $eps) { diff --git a/test/integration/PaymentTypes/GiropayTest.php b/test/integration/PaymentTypes/GiropayTest.php index 02c4a006..d7b07a1b 100755 --- a/test/integration/PaymentTypes/GiropayTest.php +++ b/test/integration/PaymentTypes/GiropayTest.php @@ -37,8 +37,8 @@ class GiropayTest extends BasePaymentTest * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function giroPayShouldBeCreatable() { @@ -54,8 +54,8 @@ public function giroPayShouldBeCreatable() * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function giroPayShouldThrowExceptionOnAuthorize() { @@ -71,8 +71,8 @@ public function giroPayShouldThrowExceptionOnAuthorize() * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function giroPayShouldBeChargeable() { @@ -92,8 +92,8 @@ public function giroPayShouldBeChargeable() * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function giroPayCanBeFetched() { diff --git a/test/integration/PaymentTypes/HirePurchaseDirectDebitTest.php b/test/integration/PaymentTypes/HirePurchaseDirectDebitTest.php index 4080378f..085e0197 100755 --- a/test/integration/PaymentTypes/HirePurchaseDirectDebitTest.php +++ b/test/integration/PaymentTypes/HirePurchaseDirectDebitTest.php @@ -49,8 +49,8 @@ class HirePurchaseDirectDebitTest extends BasePaymentTest * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. * @throws Exception */ public function instalmentPlanShouldBeSelectable() @@ -89,8 +89,8 @@ public function instalmentPlanShouldBeSelectable() * @param $lastname * @param $errorCode * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function hirePurchaseDirectDebitAuthorize($firstname, $lastname, $errorCode) { @@ -122,8 +122,8 @@ public function hirePurchaseDirectDebitAuthorize($firstname, $lastname, $errorCo * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. * @throws Exception */ public function instalmentPlanSelectionWithAllFieldsSet() @@ -145,8 +145,8 @@ public function instalmentPlanSelectionWithAllFieldsSet() * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. * @throws Exception */ public function verifyChargingAnInitializedHirePurchase() @@ -173,8 +173,8 @@ public function verifyChargingAnInitializedHirePurchase() * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. * @throws Exception */ public function verifyShippingAChargedHirePurchase() @@ -205,8 +205,8 @@ public function verifyShippingAChargedHirePurchase() * * @depends verifyChargingAnInitializedHirePurchase * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. * @throws Exception * * @group skip @@ -236,8 +236,8 @@ public function verifyChargeAndFullCancelAnInitializedHirePurchase() * * @depends verifyChargingAnInitializedHirePurchase * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. * @throws Exception */ public function verifyPartlyCancelChargedHirePurchase() diff --git a/test/integration/PaymentTypes/IdealTest.php b/test/integration/PaymentTypes/IdealTest.php index 9d1a1924..f77efa6e 100755 --- a/test/integration/PaymentTypes/IdealTest.php +++ b/test/integration/PaymentTypes/IdealTest.php @@ -39,8 +39,8 @@ class IdealTest extends BasePaymentTest * * @return Ideal * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function idealShouldBeCreatable(): Ideal { @@ -59,8 +59,8 @@ public function idealShouldBeCreatable(): Ideal * * @param Ideal $ideal * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. * @depends idealShouldBeCreatable */ public function idealShouldThrowExceptionOnAuthorize(Ideal $ideal) @@ -79,8 +79,8 @@ public function idealShouldThrowExceptionOnAuthorize(Ideal $ideal) * * @param Ideal $ideal * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function idealShouldBeChargeable(Ideal $ideal) { @@ -101,8 +101,8 @@ public function idealShouldBeChargeable(Ideal $ideal) * * @param Ideal $ideal * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function idealTypeCanBeFetched(Ideal $ideal) { diff --git a/test/integration/PaymentTypes/InvoiceFactoringTest.php b/test/integration/PaymentTypes/InvoiceFactoringTest.php index 5b4e2e02..695cd32f 100755 --- a/test/integration/PaymentTypes/InvoiceFactoringTest.php +++ b/test/integration/PaymentTypes/InvoiceFactoringTest.php @@ -43,8 +43,8 @@ class InvoiceFactoringTest extends BasePaymentTest * * @return InvoiceFactoring * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function invoiceFactoringTypeShouldBeCreatableAndFetchable(): InvoiceFactoring { @@ -67,8 +67,8 @@ public function invoiceFactoringTypeShouldBeCreatableAndFetchable(): InvoiceFact * * @param InvoiceFactoring $invoice * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. * @depends invoiceFactoringTypeShouldBeCreatableAndFetchable */ public function verifyInvoiceIsNotAuthorizable(InvoiceFactoring $invoice) @@ -87,8 +87,8 @@ public function verifyInvoiceIsNotAuthorizable(InvoiceFactoring $invoice) * * @param InvoiceFactoring $invoiceFactoring * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function invoiceFactoringShouldRequiresCustomer(InvoiceFactoring $invoiceFactoring) { @@ -105,8 +105,8 @@ public function invoiceFactoringShouldRequiresCustomer(InvoiceFactoring $invoice * * @param InvoiceFactoring $invoiceFactoring * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function invoiceFactoringRequiresBasket(InvoiceFactoring $invoiceFactoring) { @@ -129,8 +129,8 @@ public function invoiceFactoringRequiresBasket(InvoiceFactoring $invoiceFactorin * * @return Charge * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. * @throws AssertionFailedError */ public function invoiceFactoringShouldBeChargeable(InvoiceFactoring $invoiceFactoring): Charge @@ -155,8 +155,8 @@ public function invoiceFactoringShouldBeChargeable(InvoiceFactoring $invoiceFact * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. * @throws Exception */ public function verifyInvoiceFactoringIsNotShippableWoInvoiceIdOnHeidelpayObject() @@ -184,8 +184,8 @@ public function verifyInvoiceFactoringIsNotShippableWoInvoiceIdOnHeidelpayObject * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. * @throws Exception */ public function verifyInvoiceFactoringIsNotShippableWoInvoiceIdOnPaymentObject() @@ -213,8 +213,8 @@ public function verifyInvoiceFactoringIsNotShippableWoInvoiceIdOnPaymentObject() * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function verifyInvoiceFactoringShipmentWithInvoiceIdOnHeidelpayObject() { @@ -242,8 +242,8 @@ public function verifyInvoiceFactoringShipmentWithInvoiceIdOnHeidelpayObject() * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function verifyInvoiceFactoringShipmentWithInvoiceIdOnPaymentObject() { @@ -270,8 +270,8 @@ public function verifyInvoiceFactoringShipmentWithInvoiceIdOnPaymentObject() * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function verifyInvoiceFactoringShipmentWithPreSetInvoiceId() { @@ -298,8 +298,8 @@ public function verifyInvoiceFactoringShipmentWithPreSetInvoiceId() * * @param Charge $charge * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. * @depends invoiceFactoringShouldBeChargeable */ public function verifyInvoiceChargeCanBeCanceled(Charge $charge) @@ -316,8 +316,8 @@ public function verifyInvoiceChargeCanBeCanceled(Charge $charge) * * @param Charge $charge * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. * @depends invoiceFactoringShouldBeChargeable */ public function verifyInvoiceChargeCanNotBeCancelledWoAmount(Charge $charge) @@ -334,8 +334,8 @@ public function verifyInvoiceChargeCanNotBeCancelledWoAmount(Charge $charge) * * @param Charge $charge * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. * @depends invoiceFactoringShouldBeChargeable */ public function verifyInvoiceChargeCanNotBeCancelledWoReasonCode(Charge $charge) diff --git a/test/integration/PaymentTypes/InvoiceTest.php b/test/integration/PaymentTypes/InvoiceTest.php index b55ec0ce..549a9354 100755 --- a/test/integration/PaymentTypes/InvoiceTest.php +++ b/test/integration/PaymentTypes/InvoiceTest.php @@ -37,8 +37,8 @@ class InvoiceTest extends BasePaymentTest * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function invoiceTypeShouldBeCreatable() { @@ -53,8 +53,8 @@ public function invoiceTypeShouldBeCreatable() * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function verifyInvoiceIsNotAuthorizable() { @@ -71,8 +71,8 @@ public function verifyInvoiceIsNotAuthorizable() * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function verifyInvoiceIsChargeable() { @@ -88,8 +88,8 @@ public function verifyInvoiceIsChargeable() * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function verifyInvoiceIsNotShippable() { @@ -114,8 +114,8 @@ public function verifyInvoiceIsNotShippable() * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function verifyInvoiceChargeCanBeCanceled() { @@ -134,8 +134,8 @@ public function verifyInvoiceChargeCanBeCanceled() * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function verifyInvoiceChargeCanBePartlyCanceled() { @@ -160,8 +160,8 @@ public function verifyInvoiceChargeCanBePartlyCanceled() * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function invoiceTypeCanBeFetched() { diff --git a/test/integration/PaymentTypes/PrepaymentTest.php b/test/integration/PaymentTypes/PrepaymentTest.php index 75b946b5..1dbc257d 100755 --- a/test/integration/PaymentTypes/PrepaymentTest.php +++ b/test/integration/PaymentTypes/PrepaymentTest.php @@ -39,8 +39,8 @@ class PrepaymentTest extends BasePaymentTest * * @return Prepayment * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. * @test */ public function prepaymentShouldBeCreatableAndFetchable(): AbstractHeidelpayResource @@ -67,8 +67,8 @@ public function prepaymentShouldBeCreatableAndFetchable(): AbstractHeidelpayReso * * @return Charge * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function prepaymentTypeShouldBeChargeable(Prepayment $prepayment): Charge { @@ -92,8 +92,8 @@ public function prepaymentTypeShouldBeChargeable(Prepayment $prepayment): Charge * * @param Prepayment $prepayment * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function prepaymentTypeShouldNotBeAuthorizable(Prepayment $prepayment) { @@ -112,8 +112,8 @@ public function prepaymentTypeShouldNotBeAuthorizable(Prepayment $prepayment) * * @param Charge $charge * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function prepaymentTypeShouldNotBeShippable(Charge $charge) { @@ -132,8 +132,8 @@ public function prepaymentTypeShouldNotBeShippable(Charge $charge) * * @param Prepayment $prepayment * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function prepaymentChargeCanBeCanceled(Prepayment $prepayment) { diff --git a/test/integration/PaymentTypes/Przelewy24Test.php b/test/integration/PaymentTypes/Przelewy24Test.php index 357dad6a..12b5cd4e 100755 --- a/test/integration/PaymentTypes/Przelewy24Test.php +++ b/test/integration/PaymentTypes/Przelewy24Test.php @@ -41,8 +41,8 @@ class Przelewy24Test extends BasePaymentTest * * @return BasePaymentType * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function przelewy24ShouldBeCreatableAndFetchable(): BasePaymentType { @@ -66,8 +66,8 @@ public function przelewy24ShouldBeCreatableAndFetchable(): BasePaymentType * * @param Przelewy24 $przelewy24 * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function przelewy24ShouldBeChargeable(Przelewy24 $przelewy24) { @@ -89,8 +89,8 @@ public function przelewy24ShouldBeChargeable(Przelewy24 $przelewy24) * * @param Przelewy24 $przelewy24 * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function przelewy24ShouldNotBeAuthorizable(Przelewy24 $przelewy24) { @@ -109,8 +109,8 @@ public function przelewy24ShouldNotBeAuthorizable(Przelewy24 $przelewy24) * * @param string $currencyCode * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function przelewy24ShouldThrowExceptionIfCurrencyIsNotSupported($currencyCode) { diff --git a/test/integration/PaymentTypes/SepaDirectDebitGuaranteedTest.php b/test/integration/PaymentTypes/SepaDirectDebitGuaranteedTest.php index 991406ff..5a90b139 100755 --- a/test/integration/PaymentTypes/SepaDirectDebitGuaranteedTest.php +++ b/test/integration/PaymentTypes/SepaDirectDebitGuaranteedTest.php @@ -38,8 +38,8 @@ class SepaDirectDebitGuaranteedTest extends BasePaymentTest * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function sepaDirectDebitGuaranteedShouldBeCreatableWithMandatoryFieldsOnly() { @@ -61,8 +61,8 @@ public function sepaDirectDebitGuaranteedShouldBeCreatableWithMandatoryFieldsOnl * * @return SepaDirectDebitGuaranteed * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function sepaDirectDebitGuaranteedShouldBeCreatable(): SepaDirectDebitGuaranteed { @@ -103,8 +103,8 @@ public function directDebitGuaranteedShouldProhibitAuthorization(SepaDirectDebit * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function directDebitGuaranteedShouldAllowCharge() { @@ -121,8 +121,8 @@ public function directDebitGuaranteedShouldAllowCharge() * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function ddgShouldThrowErrorIfAddressesDoNotMatch() { diff --git a/test/integration/PaymentTypes/SepaDirectDebitTest.php b/test/integration/PaymentTypes/SepaDirectDebitTest.php index 294f8ceb..f1f98116 100755 --- a/test/integration/PaymentTypes/SepaDirectDebitTest.php +++ b/test/integration/PaymentTypes/SepaDirectDebitTest.php @@ -39,8 +39,8 @@ class SepaDirectDebitTest extends BasePaymentTest * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function sepaDirectDebitShouldBeCreatableWithMandatoryFieldsOnly() { @@ -62,8 +62,8 @@ public function sepaDirectDebitShouldBeCreatableWithMandatoryFieldsOnly() * * @return SepaDirectDebit * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function sepaDirectDebitShouldBeCreatable(): SepaDirectDebit { @@ -89,8 +89,8 @@ public function sepaDirectDebitShouldBeCreatable(): SepaDirectDebit * * @param SepaDirectDebit $directDebit * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. * @depends sepaDirectDebitShouldBeCreatable */ public function authorizeShouldThrowException(SepaDirectDebit $directDebit) @@ -108,8 +108,8 @@ public function authorizeShouldThrowException(SepaDirectDebit $directDebit) * * @return Charge * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. * @depends sepaDirectDebitShouldBeCreatable */ public function directDebitShouldBeChargeable(SepaDirectDebit $directDebit): Charge @@ -128,8 +128,8 @@ public function directDebitShouldBeChargeable(SepaDirectDebit $directDebit): Cha * * @param Charge $charge * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. * @depends directDebitShouldBeChargeable */ public function directDebitChargeShouldBeRefundable(Charge $charge) diff --git a/test/integration/SetMetadataTest.php b/test/integration/SetMetadataTest.php index 23162e8b..aee85a55 100755 --- a/test/integration/SetMetadataTest.php +++ b/test/integration/SetMetadataTest.php @@ -116,8 +116,8 @@ public function chargeShouldCreateMetadata() * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function paymentShouldFetchMetadataResourceOnFetch() { @@ -139,8 +139,8 @@ public function paymentShouldFetchMetadataResourceOnFetch() * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function emptyMetaDataShouldLeadToError() { diff --git a/test/integration/TransactionTypes/AuthorizationTest.php b/test/integration/TransactionTypes/AuthorizationTest.php index aedd0bfd..d1a52e14 100644 --- a/test/integration/TransactionTypes/AuthorizationTest.php +++ b/test/integration/TransactionTypes/AuthorizationTest.php @@ -61,8 +61,8 @@ public function authorizeWithTypeId() * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function authorizeWithType() { @@ -77,8 +77,8 @@ public function authorizeWithType() * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function authorizationProducesPaymentAndCustomer() { @@ -103,8 +103,8 @@ public function authorizationProducesPaymentAndCustomer() * * @return Authorization * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function authorizationWithCustomerId(): Authorization { @@ -150,8 +150,8 @@ public function authorizationCanBeFetched(Authorization $authorization) * @param BasePaymentType|AbstractHeidelpayResource $paymentType * @param string $expectedState The state the transaction is expected to be in. * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function authorizeHasExpectedStates(BasePaymentType $paymentType, $expectedState) { @@ -167,8 +167,8 @@ public function authorizeHasExpectedStates(BasePaymentType $paymentType, $expect * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function authorizeShouldAcceptAllParameters() { diff --git a/test/integration/TransactionTypes/CancelAfterAuthorizationTest.php b/test/integration/TransactionTypes/CancelAfterAuthorizationTest.php index 00590068..551d57dc 100644 --- a/test/integration/TransactionTypes/CancelAfterAuthorizationTest.php +++ b/test/integration/TransactionTypes/CancelAfterAuthorizationTest.php @@ -64,8 +64,8 @@ public function fullCancelOnAuthorization() * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function partCancelOnPayment() { @@ -86,8 +86,8 @@ public function partCancelOnPayment() * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function partCancelOnAuthorize() { @@ -111,8 +111,8 @@ public function partCancelOnAuthorize() * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function anAuthorizationsFullReversalShallBeFetchable() { @@ -149,8 +149,8 @@ public function anAuthorizationsFullReversalShallBeFetchable() * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function anAuthorizationsReversalsShouldBeFetchable() { diff --git a/test/integration/TransactionTypes/CancelAfterChargeTest.php b/test/integration/TransactionTypes/CancelAfterChargeTest.php index 3ab730de..917919b2 100644 --- a/test/integration/TransactionTypes/CancelAfterChargeTest.php +++ b/test/integration/TransactionTypes/CancelAfterChargeTest.php @@ -40,8 +40,8 @@ class CancelAfterChargeTest extends BasePaymentTest * * @return Charge * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function chargeShouldBeFetchable(): Charge { @@ -98,8 +98,8 @@ public function chargeShouldBeFullyRefundableWithId() * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function chargeShouldBePartlyRefundableWithId() { @@ -126,8 +126,8 @@ public function chargeShouldBePartlyRefundableWithId() * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function chargeShouldBePartlyRefundable() { @@ -154,8 +154,8 @@ public function chargeShouldBePartlyRefundable() * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function cancelShouldAcceptPaymentReferenceParameter() { diff --git a/test/integration/TransactionTypes/CancelTest.php b/test/integration/TransactionTypes/CancelTest.php index 79d88de7..19ecf864 100644 --- a/test/integration/TransactionTypes/CancelTest.php +++ b/test/integration/TransactionTypes/CancelTest.php @@ -141,8 +141,8 @@ public function chargeCancellationsShouldBeFetchableViaPaymentObject() * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function cancelStatusIsSetCorrectly() { diff --git a/test/integration/TransactionTypes/ChargeTest.php b/test/integration/TransactionTypes/ChargeTest.php index d4395f7c..89fc71fc 100644 --- a/test/integration/TransactionTypes/ChargeTest.php +++ b/test/integration/TransactionTypes/ChargeTest.php @@ -76,8 +76,8 @@ public function chargeShouldWorkWithTypeObject() * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function chargeStatusIsSetCorrectly() { @@ -89,8 +89,8 @@ public function chargeStatusIsSetCorrectly() * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function chargeShouldAcceptAllParameters() { @@ -138,8 +138,8 @@ public function chargeShouldAcceptAllParameters() * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function chargeWithCustomerShouldAcceptAllParameters() { diff --git a/test/integration/TransactionTypes/PayoutTest.php b/test/integration/TransactionTypes/PayoutTest.php index bbb1c46c..43135229 100644 --- a/test/integration/TransactionTypes/PayoutTest.php +++ b/test/integration/TransactionTypes/PayoutTest.php @@ -111,8 +111,8 @@ public function payoutCanBeCalledForSepaDirectDebitGuaranteedType() * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. * @throws Exception */ public function payoutShouldBeFetchedWhenItsPaymentResourceIsFetched() @@ -133,8 +133,8 @@ public function payoutShouldBeFetchedWhenItsPaymentResourceIsFetched() * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function payoutShouldBeFetchableViaItsUrl() { diff --git a/test/integration/TransactionTypes/ShipmentTest.php b/test/integration/TransactionTypes/ShipmentTest.php index 7597264d..6218cadd 100644 --- a/test/integration/TransactionTypes/ShipmentTest.php +++ b/test/integration/TransactionTypes/ShipmentTest.php @@ -122,8 +122,8 @@ public function shipmentShouldBePossibleWithPaymentObject() * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function shipmentStatusIsSetCorrectly() { diff --git a/test/integration/WebhookTest.php b/test/integration/WebhookTest.php index d853730d..0b9bf727 100755 --- a/test/integration/WebhookTest.php +++ b/test/integration/WebhookTest.php @@ -48,8 +48,8 @@ class WebhookTest extends BasePaymentTest * @param string $event * * @throws Exception - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function webhookResourceCanBeRegisteredAndFetched($event) { @@ -114,8 +114,8 @@ public function webhookEventShouldNotBeUpdateable() * @test * * @throws Exception - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function webhookResourceShouldBeDeletable() { @@ -136,8 +136,8 @@ public function webhookResourceShouldBeDeletable() * @test * * @throws Exception - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function webhookCreateShouldThrowErrorWhenEventIsAlreadyRegistered() { @@ -159,8 +159,8 @@ public function webhookCreateShouldThrowErrorWhenEventIsAlreadyRegistered() * @test * * @throws Exception - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function fetchWebhooksShouldReturnArrayOfRegisteredWebhooks() { @@ -195,8 +195,8 @@ public function fetchWebhooksShouldReturnArrayOfRegisteredWebhooks() * @depends webhookResourceCanBeRegisteredAndFetched * * @throws Exception - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function allWebhooksShouldBeRemovableAtOnce() { @@ -216,8 +216,8 @@ public function allWebhooksShouldBeRemovableAtOnce() * @test * @depends allWebhooksShouldBeRemovableAtOnce * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function bulkSettingWebhookEventsShouldBePossible() { @@ -246,8 +246,8 @@ public function bulkSettingWebhookEventsShouldBePossible() * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function bulkSettingOnlyOneWebhookShouldBePossible() { diff --git a/test/unit/Resources/PaymentTest.php b/test/unit/Resources/PaymentTest.php index 05dd4d6e..27cdd656 100755 --- a/test/unit/Resources/PaymentTest.php +++ b/test/unit/Resources/PaymentTest.php @@ -131,8 +131,8 @@ public function getAuthorizationShouldNotFetchAuthorizeIfNotLazyAndAuthIsNull() * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function chargesShouldBeHandledProperly() { @@ -226,8 +226,8 @@ public function getChargeShouldFetchChargeIfItExistsAndLazyLoadingIsOff() * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function getChargeMethodsShouldReturnNullIfTheChargeIdUnknown() { @@ -299,8 +299,8 @@ public function getPayoutShouldNotFetchPayoutIfNotLazyAndPayoutIsNull() * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function setCustomerShouldDoNothingIfTheCustomerIsEmpty() { @@ -372,8 +372,8 @@ public function setCustomerShouldCreateCustomerIfItIsPassedAsObjectWithoutId() * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function setPaymentTypeShouldDoNothingIfThePaymentTypeIsEmpty() { @@ -570,8 +570,8 @@ public function getCancellationShouldReturnCancellationIfItExistsAndFetchItIfNot * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function shipmentsShouldBeHandledProperly() { @@ -656,8 +656,8 @@ public function getAndSetCurrencyShouldPropagateToTheAmountObject() * * @param integer $state * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function handleResponseShouldUpdateStateId($state) { @@ -676,8 +676,8 @@ public function handleResponseShouldUpdateStateId($state) * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function handleResponseShouldUpdatePaymentId() { @@ -696,8 +696,8 @@ public function handleResponseShouldUpdatePaymentId() * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. * @throws ReflectionException */ public function handleResponseShouldFetchCustomerIfItIsNotSet() @@ -725,8 +725,8 @@ public function handleResponseShouldFetchCustomerIfItIsNotSet() * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. * @throws ReflectionException */ public function handleResponseShouldFetchAndUpdateCustomerIfItIsAlreadySet() @@ -754,8 +754,8 @@ public function handleResponseShouldFetchAndUpdateCustomerIfItIsAlreadySet() * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. * @throws ReflectionException */ public function handleResponseShouldFetchAndUpdatePaymentTypeIfTheIdIsSet() @@ -781,8 +781,8 @@ public function handleResponseShouldFetchAndUpdatePaymentTypeIfTheIdIsSet() * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. * @throws ReflectionException */ public function handleResponseShouldFetchAndUpdateMetadataIfTheIdIsSet() @@ -804,8 +804,8 @@ public function handleResponseShouldFetchAndUpdateMetadataIfTheIdIsSet() * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. * @throws ReflectionException */ public function handleResponseShouldGetMetadataIfUnfetchedMetadataObjectWithIdIsGiven() @@ -1351,9 +1351,9 @@ public function shipMethodShouldPropagateToHeidelpayChargePaymentMethod() * * @test * - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. * @throws ReflectionException - * @throws HeidelpayApiException */ public function setMetaDataShouldSetParentResourceAndCreateMetaDataObject() { @@ -1383,8 +1383,8 @@ public function setMetaDataShouldSetParentResourceAndCreateMetaDataObject() * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. * @throws ReflectionException */ public function metadataMustBeOfTypeMetadata() @@ -1420,9 +1420,9 @@ public function metadataMustBeOfTypeMetadata() * * @test * - * @throws HeidelpayApiException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. * @throws ReflectionException - * @throws RuntimeException */ public function setBasketShouldCallCreateIfTheGivenBasketObjectDoesNotExistYet() { @@ -1450,9 +1450,9 @@ static function ($object) use ($basket, $heidelpay) { * * @test * + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. * @throws ReflectionException - * @throws RuntimeException - * @throws HeidelpayApiException */ public function setBasketWontCallResourceServiceWhenBasketIsNull() { @@ -1478,9 +1478,9 @@ public function setBasketWontCallResourceServiceWhenBasketIsNull() * * @test * - * @throws HeidelpayApiException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. * @throws ReflectionException - * @throws RuntimeException */ public function updateResponseResourcesShouldFetchBasketIdIfItIsSetInResponse() { diff --git a/test/unit/Resources/PaymentTypes/PayPageTest.php b/test/unit/Resources/PaymentTypes/PayPageTest.php index 3845ba50..8702870b 100644 --- a/test/unit/Resources/PaymentTypes/PayPageTest.php +++ b/test/unit/Resources/PaymentTypes/PayPageTest.php @@ -319,8 +319,8 @@ public function paymentShouldBeFetchedWhenItIsNoGetRequest($method, $fetchCallCo * @test * * @throws Exception - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function exposeShouldSetBasicParams() { @@ -386,8 +386,8 @@ public function exposeShouldSetBasicParams() * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function resourcesAreNullWithoutPaymentObject() { diff --git a/test/unit/Resources/TransactionTypes/AuthorizationTest.php b/test/unit/Resources/TransactionTypes/AuthorizationTest.php index f63e1190..8f75f05e 100755 --- a/test/unit/Resources/TransactionTypes/AuthorizationTest.php +++ b/test/unit/Resources/TransactionTypes/AuthorizationTest.php @@ -194,8 +194,8 @@ public function cancelShouldCallCancelAuthorizationOnHeidelpayObject() * * @param float|null $value * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function chargeShouldThrowExceptionIfPaymentIsNotSet($value) { diff --git a/test/unit/Resources/TransactionTypes/ShipmentTest.php b/test/unit/Resources/TransactionTypes/ShipmentTest.php index 25eca76b..635bec45 100755 --- a/test/unit/Resources/TransactionTypes/ShipmentTest.php +++ b/test/unit/Resources/TransactionTypes/ShipmentTest.php @@ -62,8 +62,8 @@ public function gettersAndSettersShouldWorkProperly(): Shipment * @param Shipment $shipment * * @throws Exception - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. * @depends gettersAndSettersShouldWorkProperly */ public function aShipmentShouldBeUpdatedThroughResponseHandling(Shipment $shipment) diff --git a/test/unit/Services/ResourceServiceTest.php b/test/unit/Services/ResourceServiceTest.php index dcd4587a..3c0a9a08 100755 --- a/test/unit/Services/ResourceServiceTest.php +++ b/test/unit/Services/ResourceServiceTest.php @@ -1223,10 +1223,9 @@ public function updateBasketShouldCallUpdateAndReturnTheGivenBasket() * @param string $resourceUrl * * @throws Exception - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. * @throws ReflectionException - * @throws RuntimeException */ public function fetchResourceByUrlShouldFetchTheDesiredResource( $expectedFetchMethod, @@ -1254,10 +1253,9 @@ public function fetchResourceByUrlShouldFetchTheDesiredResource( * @param string $resourceUrl * * @throws Exception - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. * @throws ReflectionException - * @throws RuntimeException */ public function fetchResourceByUrlForAPaymentTypeShouldCallFetchPaymentType($paymentTypeId, $resourceUrl) { @@ -1276,10 +1274,9 @@ public function fetchResourceByUrlForAPaymentTypeShouldCallFetchPaymentType($pay * @test * * @throws Exception - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. * @throws ReflectionException - * @throws RuntimeException */ public function fetchResourceByUrlForAPaymentTypeShouldReturnNullIfTheTypeIsUnknown() { @@ -1355,8 +1352,8 @@ public function createRecurringShouldNotFetchThePaymentTypeByObject() * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. * @throws \PHPUnit\Framework\Exception */ public function createRecurringShouldThrowExceptionWhenRecurringPaymentIsNotSupportedByType() diff --git a/test/unit/Traits/CanRecurTest.php b/test/unit/Traits/CanRecurTest.php index 3d52cac2..49198971 100644 --- a/test/unit/Traits/CanRecurTest.php +++ b/test/unit/Traits/CanRecurTest.php @@ -58,8 +58,8 @@ public function gettersAndSettersShouldWorkProperly() * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function activateRecurringWillThrowExceptionIfTheObjectHasWrongType() { From 9a333fdc31114fd46d46c064f93366ad4f141284 Mon Sep 17 00:00:00 2001 From: sixer1182 Date: Fri, 29 Nov 2019 11:21:54 +0100 Subject: [PATCH 035/101] [refactor] (PHPLIB-274) Remove deprecated code. --- CHANGELOG.md | 6 + src/Constants/ApiResponseCodes.php | 14 --- src/Heidelpay.php | 2 +- src/Resources/Basket.php | 24 ---- src/Resources/Customer.php | 12 +- src/Resources/Payment.php | 84 -------------- test/unit/Resources/BasketTest.php | 17 --- test/unit/Resources/PaymentCancelTest.php | 134 ---------------------- 8 files changed, 8 insertions(+), 285 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 54f436da..faed16f8 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,11 @@ 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.3.0.0][1.3.0.0] + +### Change +* Refactor heidelpay facade to implement service interfaces. + ## [1.2.5.1][1.2.5.1] ### Fix @@ -338,3 +343,4 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a [1.2.4.0]: https://github.com/heidelpay/heidelpayPHP/compare/1.2.3.0..1.2.4.0 [1.2.5.0]: https://github.com/heidelpay/heidelpayPHP/compare/1.2.4.0..1.2.5.0 [1.2.5.1]: https://github.com/heidelpay/heidelpayPHP/compare/1.2.5.0..1.2.5.1 +[1.3.0.0]: https://github.com/heidelpay/heidelpayPHP/compare/1.2.5.1..1.3.0.0 diff --git a/src/Constants/ApiResponseCodes.php b/src/Constants/ApiResponseCodes.php index 3dbf4601..fd3689b2 100755 --- a/src/Constants/ApiResponseCodes.php +++ b/src/Constants/ApiResponseCodes.php @@ -45,17 +45,7 @@ class ApiResponseCodes const API_ERROR_IVF_REQUIRES_BASKET = 'API.330.100.023'; const API_ERROR_ADDRESSES_DO_NOT_MATCH = 'API.330.100.106'; const API_ERROR_CURRENCY_IS_NOT_SUPPORTED = 'API.330.100.202'; - /** - * @deprecated since 1.2.3.0 - * @see ApiResponseCodes::API_ERROR_ALREADY_CANCELLED - */ - const API_ERROR_AUTHORIZE_ALREADY_CANCELLED = 'API.340.100.014'; const API_ERROR_ALREADY_CANCELLED = 'API.340.100.014'; - /** - * @deprecated since 1.2.3.0 - * @see ApiResponseCodes::API_ERROR_ALREADY_CHARGED_BACK - */ - const API_ERROR_CHARGE_ALREADY_CHARGED_BACK = 'API.340.100.015'; const API_ERROR_ALREADY_CHARGED_BACK = 'API.340.100.015'; const API_ERROR_ALREADY_CHARGED = 'API.340.100.018'; const API_ERROR_CANCEL_REASON_CODE_IS_MISSING = 'API.340.100.024'; @@ -68,10 +58,6 @@ class ApiResponseCodes const API_ERROR_WEBHOOK_EVENT_ALREADY_REGISTERED = 'API.510.310.009'; const API_ERROR_WEBHOOK_CAN_NOT_BE_FOUND = 'API.510.310.008'; const API_ERROR_BASKET_ITEM_IMAGE_INVALID_URL = 'API.600.630.004'; - /** - * @deprecated since 1.2.5.0 Will be removed in next major version. - */ - const API_ERROR_BASKET_ITEM_IMAGE_INVALID_EXTENSION = 'API.600.630.005'; const API_ERROR_INVALID_KEY = 'API.710.000.002'; const API_ERROR_INSUFFICIENT_PERMISSION = 'API.710.000.005'; const API_ERROR_WRONG_AUTHENTICATION_METHOD = 'API.710.000.007'; diff --git a/src/Heidelpay.php b/src/Heidelpay.php index 2b7866a6..7643e80b 100755 --- a/src/Heidelpay.php +++ b/src/Heidelpay.php @@ -58,7 +58,7 @@ class Heidelpay implements HeidelpayParentInterface const BASE_URL = 'api.heidelpay.com'; const API_VERSION = 'v1'; const SDK_TYPE = 'HeidelpayPHP'; - const SDK_VERSION = '1.2.5.1'; + const SDK_VERSION = '1.3.0.0'; /** @var string $key */ private $key; diff --git a/src/Resources/Basket.php b/src/Resources/Basket.php index b96c41ba..9d348e69 100755 --- a/src/Resources/Basket.php +++ b/src/Resources/Basket.php @@ -93,30 +93,6 @@ public function setAmountTotalGross(float $amountTotalGross): Basket return $this; } - /** - * @return float - * - * @deprecated since 1.2.0.0 - * @see Basket::getAmountTotalGross() - */ - public function getAmountTotal(): float - { - return $this->getAmountTotalGross(); - } - - /** - * @param float $amountTotal - * - * @return Basket - * - * @deprecated since 1.2.0.0 - * @see Basket::setAmountTotalGross() - */ - public function setAmountTotal(float $amountTotal): Basket - { - return $this->setAmountTotalGross($amountTotal); - } - /** * @return float */ diff --git a/src/Resources/Customer.php b/src/Resources/Customer.php index 6ebd728e..aab3dae1 100755 --- a/src/Resources/Customer.php +++ b/src/Resources/Customer.php @@ -75,19 +75,9 @@ class Customer extends AbstractHeidelpayResource /** * Customer constructor. - * - * @param string|null $firstname - * @param string|null $lastname - * - * @deprecated since Version 1.1.5.0 - * @see CustomerFactory::createCustomer() - * @see CustomerFactory::createNotRegisteredB2bCustomer() - * @see CustomerFactory::createRegisteredB2bCustomer() */ - public function __construct(string $firstname = null, string $lastname = null) + public function __construct() { - $this->firstname = $firstname; - $this->lastname = $lastname; $this->billingAddress = new Address(); $this->shippingAddress = new Address(); $this->geoLocation = new GeoLocation(); diff --git a/src/Resources/Payment.php b/src/Resources/Payment.php index 081d2880..7d8c0f0c 100755 --- a/src/Resources/Payment.php +++ b/src/Resources/Payment.php @@ -628,33 +628,6 @@ public function getExternalId() // - /** - * Performs a Cancellation transaction on the Payment. - * If no amount is given a full cancel will be performed i. e. all Charges and Authorizations will be cancelled. - * - * @param float|null $amount The amount to canceled. - * @param string $reason - * - * @return Cancellation|null The resulting Cancellation object. - * If more then one cancellation is performed the last one will be returned. - * - * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. - * - * @deprecated since 1.2.3.0 - * @see Payment::cancelAmount() - */ - public function cancel($amount = null, $reason = CancelReasonCodes::REASON_CODE_CANCEL) - { - $cancellations = $this->cancelAmount($amount, $reason); - - if (count($cancellations) > 0) { - return $cancellations[0]; - } - - throw new RuntimeException('This Payment could not be cancelled.'); - } - /** * Performs a Cancellation transaction on the Payment. * If no amount is given a full cancel will be performed i. e. all Charges and Authorizations will be cancelled. @@ -739,63 +712,6 @@ public function cancelAmount( return $cancellations; } - /** - * Cancels all charges of the payment and returns an array of the cancellations and exceptions that occur. - * - * @return array - * - * @throws HeidelpayApiException - * @throws RuntimeException - * - * @deprecated since 1.2.3.0 - * @see Payment::cancelAmount() - */ - public function cancelAllCharges(): array - { - $cancels = []; - $exceptions = []; - - /** @var Charge $charge */ - foreach ($this->getCharges() as $charge) { - try { - $cancels[] = $charge->cancel(); - } catch (HeidelpayApiException $e) { - $allowedErrors = [ - ApiResponseCodes::API_ERROR_ALREADY_CHARGED_BACK, - ApiResponseCodes::API_ERROR_ALREADY_CANCELLED - ]; - if (!in_array($e->getCode(), $allowedErrors, true)) { - throw $e; - } - $exceptions[] = $e; - } - } - return array($cancels, $exceptions); - } - - /** - * @param float|null $amount - * - * @return array - * - * @throws HeidelpayApiException - * @throws RuntimeException - * - * @deprecated since 1.2.3.0 - * @see Payment::cancelAuthorizationAmount() - */ - public function cancelAuthorization($amount = null): array - { - $cancels = []; - $cancel = $this->cancelAuthorizationAmount($amount); - - if ($cancel instanceof Cancellation) { - $cancels[] = $cancel; - } - - return array($cancels, []); - } - /** * Cancel the given amount of the payments authorization. * diff --git a/test/unit/Resources/BasketTest.php b/test/unit/Resources/BasketTest.php index 0e87be63..0abe0c3c 100755 --- a/test/unit/Resources/BasketTest.php +++ b/test/unit/Resources/BasketTest.php @@ -168,21 +168,4 @@ public function referenceIdShouldBeAutomaticallySetToTheArrayIndexIfItIsNotSet() $this->assertEquals('0', $basketItem3->getBasketItemReferenceId()); $this->assertEquals('1', $basketItem4->getBasketItemReferenceId()); } - - /** - * Verify amount total is replaced by amount total gross. - * - * @test - * - * @throws Exception - */ - public function amountTotalSetterGetterAccessAmountTotalGross() - { - $basket = new Basket(); - $this->assertEquals($basket->getAmountTotalGross(), $basket->getAmountTotal()); - $basket->setAmountTotalGross(123.45); - $this->assertEquals($basket->getAmountTotalGross(), $basket->getAmountTotal()); - $basket->setAmountTotal(45.321); - $this->assertEquals($basket->getAmountTotalGross(), $basket->getAmountTotal()); - } } diff --git a/test/unit/Resources/PaymentCancelTest.php b/test/unit/Resources/PaymentCancelTest.php index e7be6e71..347216ad 100644 --- a/test/unit/Resources/PaymentCancelTest.php +++ b/test/unit/Resources/PaymentCancelTest.php @@ -40,140 +40,6 @@ class PaymentCancelTest extends BasePaymentTest { - // - - /** - * Verify payment:cancel calls cancelAllCharges and cancelAuthorizationAmount and returns first charge cancellation - * object. - * - * @test - * - * @throws HeidelpayApiException - * @throws ReflectionException - * @throws RuntimeException - * - * @deprecated since 1.2.3.0 - */ - public function cancelShouldCallCancelAllChargesAndCancelAuthorizationAndReturnFirstChargeCancellationObject() - { - $paymentMock = $this->getMockBuilder(Payment::class)->setMethods(['cancelAmount'])->getMock(); - $cancellation = new Cancellation(1.0); - $paymentMock->expects($this->once())->method('cancelAmount')->willReturn([$cancellation]); - - /** @var Payment $paymentMock */ - $this->assertSame($cancellation, $paymentMock->cancel()); - } - - /** - * Verify payment:cancel throws Exception if no cancellation and no auth existed to be cancelled. - * - * @test - * - * @throws ReflectionException - * @throws RuntimeException - * @throws HeidelpayApiException - * - * @deprecated since 1.2.3.0 - */ - public function cancelShouldThrowExceptionIfNoTransactionExistsToBeCancelled() - { - $paymentMock = $this->getMockBuilder(Payment::class)->setMethods(['cancelAllCharges', 'cancelAuthorization'])->getMock(); - - $this->expectException(RuntimeException::class); - $this->expectExceptionMessage('This Payment could not be cancelled.'); - - /** @var Payment $paymentMock */ - $paymentMock->cancel(); - } - - /** - * Verify cancel all charges will call cancel on each existing charge of the payment and will return a list of - * cancels and exceptions. - * - * @test - * - * @throws HeidelpayApiException - * @throws ReflectionException - * @throws RuntimeException - * - * @deprecated since 1.2.3.0 - */ - public function cancelAllChargesShouldCallCancelOnAllChargesAndReturnCancelsAndExceptions() - { - $cancellation1 = new Cancellation(1.0); - $cancellation2 = new Cancellation(2.0); - $cancellation3 = new Cancellation(3.0); - $exception1 = new HeidelpayApiException('', '', ApiResponseCodes::API_ERROR_ALREADY_CHARGED_BACK); - $exception2 = new HeidelpayApiException('', '', ApiResponseCodes::API_ERROR_ALREADY_CHARGED_BACK); - - $chargeMock1 = $this->getMockBuilder(Charge::class)->setMethods(['cancel'])->getMock(); - $chargeMock1->expects($this->once())->method('cancel')->willReturn($cancellation1); - - $chargeMock2 = $this->getMockBuilder(Charge::class)->setMethods(['cancel'])->getMock(); - $chargeMock2->expects($this->once())->method('cancel')->willThrowException($exception1); - - $chargeMock3 = $this->getMockBuilder(Charge::class)->setMethods(['cancel'])->getMock(); - $chargeMock3->expects($this->once())->method('cancel')->willReturn($cancellation2); - - $chargeMock4 = $this->getMockBuilder(Charge::class)->setMethods(['cancel'])->getMock(); - $chargeMock4->expects($this->once())->method('cancel')->willThrowException($exception2); - - $chargeMock5 = $this->getMockBuilder(Charge::class)->setMethods(['cancel'])->getMock(); - $chargeMock5->expects($this->once())->method('cancel')->willReturn($cancellation3); - - /** - * @var Charge $chargeMock1 - * @var Charge $chargeMock2 - * @var Charge $chargeMock3 - * @var Charge $chargeMock4 - * @var Charge $chargeMock5 - */ - $payment = new Payment(); - $payment->addCharge($chargeMock1)->addCharge($chargeMock2)->addCharge($chargeMock3)->addCharge($chargeMock4)->addCharge($chargeMock5); - - list($cancellations, $exceptions) = $payment->cancelAllCharges(); - $this->assertArraySubset([$cancellation1, $cancellation2, $cancellation3], $cancellations); - $this->assertArraySubset([$exception1, $exception2], $exceptions); - } - - /** - * Verify cancelAllCharges will throw any exception with Code different to - * ApiResponseCodes::API_ERROR_CHARGE_ALREADY_CANCELED. - * - * @test - * - * @throws ReflectionException - * @throws RuntimeException - * - * @deprecated since 1.2.3.0 - */ - public function cancelAllChargesShouldThrowChargeCancelExceptionsOtherThanAlreadyCharged() - { - $ex1 = new HeidelpayApiException('', '', ApiResponseCodes::API_ERROR_ALREADY_CHARGED_BACK); - $ex2 = new HeidelpayApiException('', '', ApiResponseCodes::API_ERROR_CHARGED_AMOUNT_HIGHER_THAN_EXPECTED); - - $chargeMock1 = $this->getMockBuilder(Charge::class)->setMethods(['cancel'])->getMock(); - $chargeMock1->expects($this->once())->method('cancel')->willThrowException($ex1); - - $chargeMock2 = $this->getMockBuilder(Charge::class)->setMethods(['cancel'])->getMock(); - $chargeMock2->expects($this->once())->method('cancel')->willThrowException($ex2); - - /** - * @var Charge $chargeMock1 - * @var Charge $chargeMock2 - */ - $payment = (new Payment())->addCharge($chargeMock1)->addCharge($chargeMock2); - - try { - $payment->cancelAllCharges(); - $this->assertFalse(true, 'The expected exception has not been thrown.'); - } catch (HeidelpayApiException $e) { - $this->assertSame($ex2, $e); - } - } - - // - /** * Verify cancelAmount will call cancelAuthorizationAmount with the amountToCancel. * When cancelAmount is <= the value of the cancellation it Will return auth cancellation only. From 7e36cdf40d190d3bce1ce7f2708a80807cea1879 Mon Sep 17 00:00:00 2001 From: sixer1182 Date: Fri, 29 Nov 2019 11:22:33 +0100 Subject: [PATCH 036/101] [refactor] (PHPLIB-274) Fix minor issues. --- src/Resources/Payment.php | 5 ++--- src/Services/ValueService.php | 2 ++ test/integration/PaymentTypes/EPSTest.php | 4 ++-- .../PaymentTypes/SepaDirectDebitGuaranteedTest.php | 4 ++-- test/integration/TransactionTypes/PayoutTest.php | 4 ++-- test/unit/Resources/PaymentTypes/PayPageTest.php | 2 +- 6 files changed, 11 insertions(+), 10 deletions(-) diff --git a/src/Resources/Payment.php b/src/Resources/Payment.php index 7d8c0f0c..6b77757b 100755 --- a/src/Resources/Payment.php +++ b/src/Resources/Payment.php @@ -45,7 +45,6 @@ use heidelpayPHP\Traits\HasPaymentState; use RuntimeException; use stdClass; -use function count; use function in_array; use function is_string; @@ -840,8 +839,8 @@ private function updateResponseTransactions(array $transactions = []) * * @param $resources * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ private function updateResponseResources($resources) { diff --git a/src/Services/ValueService.php b/src/Services/ValueService.php index 2771361a..a0c4c9ad 100644 --- a/src/Services/ValueService.php +++ b/src/Services/ValueService.php @@ -24,6 +24,8 @@ */ namespace heidelpayPHP\Services; +use function is_float; + class ValueService { /** diff --git a/test/integration/PaymentTypes/EPSTest.php b/test/integration/PaymentTypes/EPSTest.php index 3b40122e..21846732 100755 --- a/test/integration/PaymentTypes/EPSTest.php +++ b/test/integration/PaymentTypes/EPSTest.php @@ -112,8 +112,8 @@ public function epsShouldBeChargeable(EPS $eps) * * @param EPS $eps * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function epsTypeCanBeFetched(EPS $eps) { diff --git a/test/integration/PaymentTypes/SepaDirectDebitGuaranteedTest.php b/test/integration/PaymentTypes/SepaDirectDebitGuaranteedTest.php index 5a90b139..3a1720fd 100755 --- a/test/integration/PaymentTypes/SepaDirectDebitGuaranteedTest.php +++ b/test/integration/PaymentTypes/SepaDirectDebitGuaranteedTest.php @@ -86,8 +86,8 @@ public function sepaDirectDebitGuaranteedShouldBeCreatable(): SepaDirectDebitGua * * @param SepaDirectDebitGuaranteed $directDebitGuaranteed * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. * @depends sepaDirectDebitGuaranteedShouldBeCreatable */ public function directDebitGuaranteedShouldProhibitAuthorization(SepaDirectDebitGuaranteed $directDebitGuaranteed) diff --git a/test/integration/TransactionTypes/PayoutTest.php b/test/integration/TransactionTypes/PayoutTest.php index 43135229..c31aff18 100644 --- a/test/integration/TransactionTypes/PayoutTest.php +++ b/test/integration/TransactionTypes/PayoutTest.php @@ -152,8 +152,8 @@ public function payoutShouldBeFetchableViaItsUrl() * * @test * - * @throws HeidelpayApiException - * @throws RuntimeException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function payoutShouldAcceptAllParameters() { diff --git a/test/unit/Resources/PaymentTypes/PayPageTest.php b/test/unit/Resources/PaymentTypes/PayPageTest.php index 8702870b..9ad830c6 100644 --- a/test/unit/Resources/PaymentTypes/PayPageTest.php +++ b/test/unit/Resources/PaymentTypes/PayPageTest.php @@ -335,8 +335,8 @@ public function exposeShouldSetBasicParams() ->setMetadata($metadata) ->setCustomer($customer); $paypage = (new Paypage(123.4567, 'EUR', self::RETURN_URL)) - ->setParentResource($payment) ->setFullPageImage('full page image') + ->setParentResource($payment) ->setLogoImage('logo image') ->setShopDescription('my shop description') ->setShopName('my shop name') From af8c38d447c9606883866fec80eb3928f143b075 Mon Sep 17 00:00:00 2001 From: sixer1182 Date: Fri, 29 Nov 2019 12:11:30 +0100 Subject: [PATCH 037/101] [refactor] (PHPLIB-274) Move cancel methods to dedicated service. --- src/Heidelpay.php | 35 ++++- src/Interfaces/CancelServiceInterface.php | 106 +++++++++++++++ src/Interfaces/PaymentServiceInterface.php | 83 ------------ src/Services/CancelService.php | 148 +++++++++++++++++++++ src/Services/PaymentService.php | 71 ---------- test/unit/HeidelpayTest.php | 65 +++++++-- test/unit/Services/PaymentServiceTest.php | 41 +++--- 7 files changed, 358 insertions(+), 191 deletions(-) create mode 100644 src/Interfaces/CancelServiceInterface.php create mode 100644 src/Services/CancelService.php diff --git a/src/Heidelpay.php b/src/Heidelpay.php index 97b2a8a1..0cbc7c44 100755 --- a/src/Heidelpay.php +++ b/src/Heidelpay.php @@ -27,6 +27,7 @@ use DateTime; use heidelpayPHP\Exceptions\HeidelpayApiException; +use heidelpayPHP\Interfaces\CancelServiceInterface; use heidelpayPHP\Interfaces\DebugHandlerInterface; use heidelpayPHP\Interfaces\HeidelpayParentInterface; use heidelpayPHP\Interfaces\PaymentServiceInterface; @@ -48,6 +49,7 @@ use heidelpayPHP\Resources\TransactionTypes\Payout; use heidelpayPHP\Resources\TransactionTypes\Shipment; use heidelpayPHP\Resources\Webhook; +use heidelpayPHP\Services\CancelService; use heidelpayPHP\Services\HttpService; use heidelpayPHP\Services\PaymentService; use heidelpayPHP\Services\ResourceService; @@ -55,7 +57,7 @@ use heidelpayPHP\Validators\PrivateKeyValidator; use RuntimeException; -class Heidelpay implements HeidelpayParentInterface, PaymentServiceInterface, ResourceServiceInterface, WebhookServiceInterface +class Heidelpay implements HeidelpayParentInterface, PaymentServiceInterface, ResourceServiceInterface, WebhookServiceInterface, CancelServiceInterface { const BASE_URL = 'api.heidelpay.com'; const API_VERSION = 'v1'; @@ -77,6 +79,9 @@ class Heidelpay implements HeidelpayParentInterface, PaymentServiceInterface, Re /** @var WebhookServiceInterface $webhookService */ private $webhookService; + /** @var CancelServiceInterface $cancelService */ + private $cancelService; + /** @var HttpService $httpService */ private $httpService; @@ -102,6 +107,7 @@ public function __construct($key, $locale = null) $this->resourceService = new ResourceService($this); $this->paymentService = new PaymentService($this); $this->webhookService = new WebhookService($this); + $this->cancelService = new CancelService($this); $this->httpService = new HttpService(); } @@ -220,6 +226,25 @@ public function setWebhookService(WebhookServiceInterface $webhookService): Heid return $this; } + /** + * @return CancelServiceInterface + */ + public function getCancelService(): CancelServiceInterface + { + return $this->cancelService; + } + + /** + * @param CancelService $cancelService + * + * @return Heidelpay + */ + public function setCancelService(CancelService $cancelService): Heidelpay + { + $this->cancelService = $cancelService->setHeidelpay($this); + return $this; + } + /** * @return bool */ @@ -945,7 +970,7 @@ public function chargePayment( */ public function cancelAuthorization(Authorization $authorization, $amount = null): Cancellation { - return $this->paymentService->cancelAuthorization($authorization, $amount); + return $this->cancelService->cancelAuthorization($authorization, $amount); } /** @@ -953,7 +978,7 @@ public function cancelAuthorization(Authorization $authorization, $amount = null */ public function cancelAuthorizationByPayment($payment, $amount = null): Cancellation { - return $this->paymentService->cancelAuthorizationByPayment($payment, $amount); + return $this->cancelService->cancelAuthorizationByPayment($payment, $amount); } // @@ -972,7 +997,7 @@ public function cancelChargeById( float $amountNet = null, float $amountVat = null ): Cancellation { - return $this->paymentService->cancelChargeById( + return $this->cancelService->cancelChargeById( $payment, $chargeId, $amount, @@ -994,7 +1019,7 @@ public function cancelCharge( float $amountNet = null, float $amountVat = null ): Cancellation { - return $this->paymentService->cancelCharge( + return $this->cancelService->cancelCharge( $charge, $amount, $reasonCode, diff --git a/src/Interfaces/CancelServiceInterface.php b/src/Interfaces/CancelServiceInterface.php new file mode 100644 index 00000000..fcd28c89 --- /dev/null +++ b/src/Interfaces/CancelServiceInterface.php @@ -0,0 +1,106 @@ + + * + * @package heidelpay/${Package} + */ +namespace heidelpayPHP\Interfaces; + +use heidelpayPHP\Exceptions\HeidelpayApiException; +use heidelpayPHP\Resources\Payment; +use heidelpayPHP\Resources\TransactionTypes\Authorization; +use heidelpayPHP\Resources\TransactionTypes\Cancellation; +use heidelpayPHP\Resources\TransactionTypes\Charge; +use RuntimeException; + +interface CancelServiceInterface +{ + /** + * Performs a Cancellation transaction and returns the resulting Cancellation object. + * Performs a full cancel if the parameter amount is null. + * + * @param Authorization $authorization The Authorization to be canceled. + * @param float|null $amount The amount to be canceled. + * + * @return Cancellation The resulting Cancellation object. + * + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + */ + public function cancelAuthorization(Authorization $authorization, $amount = null): Cancellation; + + /** + * Performs a Cancellation transaction for the Authorization of the given Payment object. + * Performs a full cancel if the parameter amount is null. + * + * @param Payment|string $payment The Payment object or the id of the Payment the Authorization belongs to. + * @param float|null $amount The amount to be canceled. + * + * @return Cancellation Resulting Cancellation object. + * + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + */ + public function cancelAuthorizationByPayment($payment, $amount = null): Cancellation; + + /** + * Performs a Cancellation transaction for the given Charge and returns the resulting Cancellation object. + * Performs a full cancel if the parameter amount is null. + * + * @param Payment|string $payment The Payment object or the id of the Payment the charge belongs to. + * @param string $chargeId The id of the Charge to be canceled. + * @param float|null $amount The amount to be canceled. + * This will be sent as amountGross in case of Hire Purchase payment method. + * @param string|null $reasonCode Reason for the Cancellation ref \heidelpayPHP\Constants\CancelReasonCodes. + * @param string|null $paymentReference A reference string for the payment. + * @param float|null $amountNet The net value of the amount to be cancelled (Hire Purchase only). + * @param float|null $amountVat The vat value of the amount to be cancelled (Hire Purchase only). + * + * @return Cancellation The resulting Cancellation object. + * + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + */ + public function cancelChargeById( + $payment, + $chargeId, + float $amount = null, + string $reasonCode = null, + string $paymentReference = null, + float $amountNet = null, + float $amountVat = null + ): Cancellation; + + /** + * Performs a Cancellation transaction and returns the resulting Cancellation object. + * Performs a full cancel if the parameter amount is null. + * + * @param Charge $charge The Charge object to create the Cancellation for. + * @param float|null $amount The amount to be canceled. + * This will be sent as amountGross in case of Hire Purchase payment method. + * @param string|null $reasonCode Reason for the Cancellation ref \heidelpayPHP\Constants\CancelReasonCodes. + * @param string|null $paymentReference A reference string for the payment. + * @param float|null $amountNet The net value of the amount to be cancelled (Hire Purchase only). + * @param float|null $amountVat The vat value of the amount to be cancelled (Hire Purchase only). + * + * @return Cancellation The resulting Cancellation object. + * + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + */ + public function cancelCharge( + Charge $charge, + $amount = null, + string $reasonCode = null, + string $paymentReference = null, + float $amountNet = null, + float $amountVat = null + ): Cancellation; +} diff --git a/src/Interfaces/PaymentServiceInterface.php b/src/Interfaces/PaymentServiceInterface.php index b5ed38ff..3e50f2f7 100644 --- a/src/Interfaces/PaymentServiceInterface.php +++ b/src/Interfaces/PaymentServiceInterface.php @@ -35,7 +35,6 @@ use heidelpayPHP\Resources\PaymentTypes\BasePaymentType; use heidelpayPHP\Resources\PaymentTypes\Paypage; use heidelpayPHP\Resources\TransactionTypes\Authorization; -use heidelpayPHP\Resources\TransactionTypes\Cancellation; use heidelpayPHP\Resources\TransactionTypes\Charge; use heidelpayPHP\Resources\TransactionTypes\Payout; use heidelpayPHP\Resources\TransactionTypes\Shipment; @@ -194,88 +193,6 @@ public function payout( $paymentReference = null ): Payout; - /** - * Performs a Cancellation transaction and returns the resulting Cancellation object. - * Performs a full cancel if the parameter amount is null. - * - * @param Authorization $authorization The Authorization to be canceled. - * @param float|null $amount The amount to be canceled. - * - * @return Cancellation The resulting Cancellation object. - * - * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. - */ - public function cancelAuthorization(Authorization $authorization, $amount = null): Cancellation; - - /** - * Performs a Cancellation transaction for the Authorization of the given Payment object. - * Performs a full cancel if the parameter amount is null. - * - * @param Payment|string $payment The Payment object or the id of the Payment the Authorization belongs to. - * @param float|null $amount The amount to be canceled. - * - * @return Cancellation Resulting Cancellation object. - * - * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. - */ - public function cancelAuthorizationByPayment($payment, $amount = null): Cancellation; - - /** - * Performs a Cancellation transaction for the given Charge and returns the resulting Cancellation object. - * Performs a full cancel if the parameter amount is null. - * - * @param Payment|string $payment The Payment object or the id of the Payment the charge belongs to. - * @param string $chargeId The id of the Charge to be canceled. - * @param float|null $amount The amount to be canceled. - * This will be sent as amountGross in case of Hire Purchase payment method. - * @param string|null $reasonCode Reason for the Cancellation ref \heidelpayPHP\Constants\CancelReasonCodes. - * @param string|null $paymentReference A reference string for the payment. - * @param float|null $amountNet The net value of the amount to be cancelled (Hire Purchase only). - * @param float|null $amountVat The vat value of the amount to be cancelled (Hire Purchase only). - * - * @return Cancellation The resulting Cancellation object. - * - * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. - */ - public function cancelChargeById( - $payment, - $chargeId, - float $amount = null, - string $reasonCode = null, - string $paymentReference = null, - float $amountNet = null, - float $amountVat = null - ): Cancellation; - - /** - * Performs a Cancellation transaction and returns the resulting Cancellation object. - * Performs a full cancel if the parameter amount is null. - * - * @param Charge $charge The Charge object to create the Cancellation for. - * @param float|null $amount The amount to be canceled. - * This will be sent as amountGross in case of Hire Purchase payment method. - * @param string|null $reasonCode Reason for the Cancellation ref \heidelpayPHP\Constants\CancelReasonCodes. - * @param string|null $paymentReference A reference string for the payment. - * @param float|null $amountNet The net value of the amount to be cancelled (Hire Purchase only). - * @param float|null $amountVat The vat value of the amount to be cancelled (Hire Purchase only). - * - * @return Cancellation The resulting Cancellation object. - * - * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. - */ - public function cancelCharge( - Charge $charge, - $amount = null, - string $reasonCode = null, - string $paymentReference = null, - float $amountNet = null, - float $amountVat = null - ): Cancellation; - /** * Performs a Shipment transaction and returns the resulting Shipment object. * diff --git a/src/Services/CancelService.php b/src/Services/CancelService.php new file mode 100644 index 00000000..bae992e5 --- /dev/null +++ b/src/Services/CancelService.php @@ -0,0 +1,148 @@ + + * + * @package heidelpayPHP\Services + */ +namespace heidelpayPHP\Services; + +use heidelpayPHP\Heidelpay; +use heidelpayPHP\Interfaces\CancelServiceInterface; +use heidelpayPHP\Resources\TransactionTypes\Authorization; +use heidelpayPHP\Resources\TransactionTypes\Cancellation; +use heidelpayPHP\Resources\TransactionTypes\Charge; + +class CancelService implements CancelServiceInterface +{ + /** @var Heidelpay */ + private $heidelpay; + + /** + * PaymentService constructor. + * + * @param Heidelpay $heidelpay + */ + public function __construct(Heidelpay $heidelpay) + { + $this->heidelpay = $heidelpay; + } + + //heidelpay; + } + + /** + * @param Heidelpay $heidelpay + * + * @return CancelService + */ + public function setHeidelpay(Heidelpay $heidelpay): CancelService + { + $this->heidelpay = $heidelpay; + return $this; + } + + /** + * @return ResourceService + */ + public function getResourceService(): ResourceService + { + return $this->getHeidelpay()->getResourceService(); + } + + // + + // + + /** + * {@inheritDoc} + */ + public function cancelAuthorization(Authorization $authorization, $amount = null): Cancellation + { + $cancellation = new Cancellation($amount); + $cancellation->setPayment($authorization->getPayment()); + $authorization->addCancellation($cancellation); + $this->getResourceService()->createResource($cancellation); + + return $cancellation; + } + + /** + * {@inheritDoc} + */ + public function cancelAuthorizationByPayment($payment, $amount = null): Cancellation + { + $authorization = $this->getResourceService()->fetchAuthorization($payment); + return $this->cancelAuthorization($authorization, $amount); + } + + // + + // + + /** + * {@inheritDoc} + */ + public function cancelChargeById( + $payment, + $chargeId, + float $amount = null, + string $reasonCode = null, + string $paymentReference = null, + float $amountNet = null, + float $amountVat = null + ): Cancellation { + $charge = $this->getResourceService()->fetchChargeById($payment, $chargeId); + return $this->cancelCharge($charge, $amount, $reasonCode, $paymentReference, $amountNet, $amountVat); + } + + /** + * {@inheritDoc} + */ + public function cancelCharge( + Charge $charge, + $amount = null, + string $reasonCode = null, + string $paymentReference = null, + float $amountNet = null, + float $amountVat = null + ): Cancellation { + $cancellation = new Cancellation($amount); + $cancellation + ->setReasonCode($reasonCode) + ->setPayment($charge->getPayment()) + ->setPaymentReference($paymentReference) + ->setAmountNet($amountNet) + ->setAmountVat($amountVat); + $charge->addCancellation($cancellation); + $this->getResourceService()->createResource($cancellation); + + return $cancellation; + } + + // +} diff --git a/src/Services/PaymentService.php b/src/Services/PaymentService.php index 9fc1f670..3a6c727b 100755 --- a/src/Services/PaymentService.php +++ b/src/Services/PaymentService.php @@ -39,7 +39,6 @@ use heidelpayPHP\Resources\PaymentTypes\HirePurchaseDirectDebit; use heidelpayPHP\Resources\PaymentTypes\Paypage; use heidelpayPHP\Resources\TransactionTypes\Authorization; -use heidelpayPHP\Resources\TransactionTypes\Cancellation; use heidelpayPHP\Resources\TransactionTypes\Charge; use heidelpayPHP\Resources\TransactionTypes\Payout; use heidelpayPHP\Resources\TransactionTypes\Shipment; @@ -234,76 +233,6 @@ public function payout( // - // - - /** - * {@inheritDoc} - */ - public function cancelAuthorization(Authorization $authorization, $amount = null): Cancellation - { - $cancellation = new Cancellation($amount); - $cancellation->setPayment($authorization->getPayment()); - $authorization->addCancellation($cancellation); - $this->getResourceService()->createResource($cancellation); - - return $cancellation; - } - - /** - * {@inheritDoc} - */ - public function cancelAuthorizationByPayment($payment, $amount = null): Cancellation - { - $authorization = $this->getResourceService()->fetchAuthorization($payment); - return $this->cancelAuthorization($authorization, $amount); - } - - // - - // - - /** - * {@inheritDoc} - */ - public function cancelChargeById( - $payment, - $chargeId, - float $amount = null, - string $reasonCode = null, - string $paymentReference = null, - float $amountNet = null, - float $amountVat = null - ): Cancellation { - $charge = $this->getResourceService()->fetchChargeById($payment, $chargeId); - return $this->cancelCharge($charge, $amount, $reasonCode, $paymentReference, $amountNet, $amountVat); - } - - /** - * {@inheritDoc} - */ - public function cancelCharge( - Charge $charge, - $amount = null, - string $reasonCode = null, - string $paymentReference = null, - float $amountNet = null, - float $amountVat = null - ): Cancellation { - $cancellation = new Cancellation($amount); - $cancellation - ->setReasonCode($reasonCode) - ->setPayment($charge->getPayment()) - ->setPaymentReference($paymentReference) - ->setAmountNet($amountNet) - ->setAmountVat($amountVat); - $charge->addCancellation($cancellation); - $this->getResourceService()->createResource($cancellation); - - return $cancellation; - } - - // - // /** diff --git a/test/unit/HeidelpayTest.php b/test/unit/HeidelpayTest.php index 46c6ad04..8412f268 100755 --- a/test/unit/HeidelpayTest.php +++ b/test/unit/HeidelpayTest.php @@ -38,6 +38,7 @@ use heidelpayPHP\Resources\TransactionTypes\Authorization; use heidelpayPHP\Resources\TransactionTypes\Charge; use heidelpayPHP\Resources\Webhook; +use heidelpayPHP\Services\CancelService; use heidelpayPHP\Services\HttpService; use heidelpayPHP\Services\PaymentService; use heidelpayPHP\Services\ResourceService; @@ -210,6 +211,34 @@ public function heidelpayShouldForwardWebhookActionCallsToTheWebhookService( $heidelpay->$heidelpayMethod(...$heidelpayParams); } + /** + * Verify heidelpay propagates cancel actions to the cancel service. + * + * @test + * @dataProvider cancelServiceDP + * + * @param string $heidelpayMethod + * @param array $heidelpayParams + * @param string $serviceMethod + * @param array $serviceParams + * + * @throws ReflectionException + * @throws RuntimeException + */ + public function heidelpayShouldForwardCancelActionCallsToTheCancelService( + $heidelpayMethod, + array $heidelpayParams, + $serviceMethod, + array $serviceParams + ) { + /** @var CancelService|MockObject $cancelSrvMock */ + $cancelSrvMock = $this->getMockBuilder(CancelService::class)->disableOriginalConstructor()->setMethods([$serviceMethod])->getMock(); + $cancelSrvMock->expects($this->once())->method($serviceMethod)->with(...$serviceParams); + $heidelpay = (new Heidelpay('s-priv-234'))->setCancelService($cancelSrvMock); + + $heidelpay->$heidelpayMethod(...$heidelpayParams); + } + // /** @@ -293,13 +322,10 @@ public function paymentServiceDP(): array $paymentTypeId = 'paymentTypeId'; $customerId = 'customerId'; $paymentId = 'paymentId'; - $chargeId = 'chargeId'; $customer = new Customer(); $sofort = new Sofort(); $metadata = new Metadata(); $payment = new Payment(); - $authorization = new Authorization(); - $charge = new Charge(); $paypage = new Paypage(123.1234, 'EUR', 'url'); $basket = new Basket(); $today = new DateTime(); @@ -316,15 +342,6 @@ public function paymentServiceDP(): array 'chargeAuthStr' => ['chargeAuthorization', [$paymentId, 2.345], 'chargeAuthorization', [$paymentId, 2.345]], 'chargePayment' => ['chargePayment', [$payment, 1.234, 'ALL'], 'chargePayment', [$payment, 1.234, 'ALL']], 'chargePaymentAlt' => ['chargePayment', [$payment], 'chargePayment', [$payment]], - 'cancelAuth' => ['cancelAuthorization', [$authorization, 1.234], 'cancelAuthorization', [$authorization, 1.234]], - 'cancelAuthAlt' => ['cancelAuthorization', [$authorization], 'cancelAuthorization', [$authorization]], - 'cancelAuthByPayment' => ['cancelAuthorizationByPayment', [$payment, 1.234], 'cancelAuthorizationByPayment', [$payment, 1.234]], - 'cancelAuthByPaymentAlt' => ['cancelAuthorizationByPayment', [$payment], 'cancelAuthorizationByPayment', [$payment]], - 'cancelAuthByPaymentStr' => ['cancelAuthorizationByPayment', [$paymentId, 234.5], 'cancelAuthorizationByPayment', [$paymentId, 234.5]], - 'cancelChargeById' => ['cancelChargeById', [$paymentId, $chargeId, 1.234], 'cancelChargeById', [$paymentId, $chargeId, 1.234]], - 'cancelChargeByIdAlt' => ['cancelChargeById', [$paymentId, $chargeId], 'cancelChargeById', [$paymentId, $chargeId]], - 'cancelCharge' => ['cancelCharge', [$charge, 1.234], 'cancelCharge', [$charge, 1.234]], - 'cancelChargeAlt' => ['cancelCharge', [$charge], 'cancelCharge', [$charge]], 'ship' => ['ship', [$payment], 'ship', [$payment]], 'payout' => ['payout', [123, 'EUR', $paymentTypeId, 'url', $customer, $orderId, $metadata, 'basketId'], 'payout', [123, 'EUR', $paymentTypeId, 'url', $customer, $orderId, $metadata, 'basketId']], 'initPayPageCharge' => ['initPayPageCharge', [$paypage, $customer, $basket, $metadata], 'initPayPageCharge', [$paypage, $customer, $basket, $metadata]], @@ -359,5 +376,29 @@ public function heidelpayShouldForwardWebhookActionCallsToTheWebhookServiceDP(): ]; } + /** + * @return array + */ + public function cancelServiceDP(): array + { + $payment = new Payment(); + $charge = new Charge(); + $authorization = new Authorization(); + $chargeId = 'chargeId'; + $paymentId = 'paymentId'; + + return [ + 'cancelAuth' => ['cancelAuthorization', [$authorization, 1.234], 'cancelAuthorization', [$authorization, 1.234]], + 'cancelAuthAlt' => ['cancelAuthorization', [$authorization], 'cancelAuthorization', [$authorization]], + 'cancelAuthByPayment' => ['cancelAuthorizationByPayment', [$payment, 1.234], 'cancelAuthorizationByPayment', [$payment, 1.234]], + 'cancelAuthByPaymentAlt' => ['cancelAuthorizationByPayment', [$payment], 'cancelAuthorizationByPayment', [$payment]], + 'cancelAuthByPaymentStr' => ['cancelAuthorizationByPayment', [$paymentId, 234.5], 'cancelAuthorizationByPayment', [$paymentId, 234.5]], + 'cancelChargeById' => ['cancelChargeById', [$paymentId, $chargeId, 1.234], 'cancelChargeById', [$paymentId, $chargeId, 1.234]], + 'cancelChargeByIdAlt' => ['cancelChargeById', [$paymentId, $chargeId], 'cancelChargeById', [$paymentId, $chargeId]], + 'cancelCharge' => ['cancelCharge', [$charge, 1.234], 'cancelCharge', [$charge, 1.234]], + 'cancelChargeAlt' => ['cancelCharge', [$charge], 'cancelCharge', [$charge]], + ]; + } + // } diff --git a/test/unit/Services/PaymentServiceTest.php b/test/unit/Services/PaymentServiceTest.php index 3dcd4310..aa0deccf 100755 --- a/test/unit/Services/PaymentServiceTest.php +++ b/test/unit/Services/PaymentServiceTest.php @@ -27,7 +27,7 @@ use heidelpayPHP\Constants\TransactionTypes; use heidelpayPHP\Exceptions\HeidelpayApiException; use heidelpayPHP\Heidelpay; -use heidelpayPHP\Interfaces\PaymentServiceInterface; +use heidelpayPHP\Interfaces\CancelServiceInterface; use heidelpayPHP\Interfaces\ResourceServiceInterface; use heidelpayPHP\Resources\Basket; use heidelpayPHP\Resources\Customer; @@ -44,6 +44,7 @@ use heidelpayPHP\Resources\TransactionTypes\Charge; use heidelpayPHP\Resources\TransactionTypes\Payout; use heidelpayPHP\Resources\TransactionTypes\Shipment; +use heidelpayPHP\Services\CancelService; use heidelpayPHP\Services\PaymentService; use heidelpayPHP\Services\ResourceService; use heidelpayPHP\test\BasePaymentTest; @@ -279,8 +280,8 @@ public function cancelAuthorizationShouldCallCreateOnResourceServiceWithNewCance in_array($cancellation, $authorization->getCancellations(), true); })); - $paymentSrv = $heidelpay->setResourceService($resourceSrvMock)->getPaymentService(); - $returnedCancellation = $paymentSrv->cancelAuthorization($authorization, 12.122); + $cancelSrv = $heidelpay->setResourceService($resourceSrvMock)->getCancelService(); + $returnedCancellation = $cancelSrv->cancelAuthorization($authorization, 12.122); $this->assertArraySubset([$returnedCancellation], $authorization->getCancellations()); } @@ -301,13 +302,13 @@ public function cancelAuthorizationByPaymentShouldCallCancelAuthorization() /** @var ResourceServiceInterface|MockObject $resourceSrvMock */ $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->setMethods(['fetchAuthorization'])->disableOriginalConstructor()->getMock(); $resourceSrvMock->expects($this->exactly(2))->method('fetchAuthorization')->willReturn($authorization); - /** @var PaymentService|MockObject $paymentSrvMock */ - $paymentSrvMock = $this->getMockBuilder(PaymentService::class)->setMethods(['cancelAuthorization'])->disableOriginalConstructor()->getMock(); - $paymentSrvMock->expects($this->exactly(2))->method('cancelAuthorization')->withConsecutive([$authorization, null], [$authorization, 1.123]); - $heidelpay->setResourceService($resourceSrvMock)->setPaymentService($paymentSrvMock); + /** @var CancelService|MockObject $cancelSrvMock */ + $cancelSrvMock = $this->getMockBuilder(CancelService::class)->setMethods(['cancelAuthorization'])->disableOriginalConstructor()->getMock(); + $cancelSrvMock->expects($this->exactly(2))->method('cancelAuthorization')->withConsecutive([$authorization, null], [$authorization, 1.123]); + $heidelpay->setResourceService($resourceSrvMock)->setCancelService($cancelSrvMock); - $paymentSrvMock->cancelAuthorizationByPayment(new Payment()); - $paymentSrvMock->cancelAuthorizationByPayment(new Payment(), 1.123); + $cancelSrvMock->cancelAuthorizationByPayment(new Payment()); + $cancelSrvMock->cancelAuthorizationByPayment(new Payment(), 1.123); } /** @@ -328,13 +329,13 @@ public function cancelChargeByIdShouldFetchChargeAndPropagateToCancelCharge() $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->setMethods(['fetchChargeById'])->disableOriginalConstructor()->getMock(); $resourceSrvMock->expects($this->exactly(2))->method('fetchChargeById')->with($payment, 's-chg-1')->willReturn($charge); - /** @var PaymentServiceInterface|MockObject $paymentSrvMock */ - $paymentSrvMock = $this->getMockBuilder(PaymentService::class)->setMethods(['cancelCharge', 'getResourceService'])->disableOriginalConstructor()->getMock(); - $paymentSrvMock->expects($this->exactly(2))->method('cancelCharge')->withConsecutive([$charge], [$charge, 10.11]); - $paymentSrvMock->expects($this->exactly(2))->method('getResourceService')->willReturn($resourceSrvMock); + /** @var CancelServiceInterface|MockObject $cancelSrvMock */ + $cancelSrvMock = $this->getMockBuilder(CancelService::class)->setMethods(['cancelCharge', 'getResourceService'])->disableOriginalConstructor()->getMock(); + $cancelSrvMock->expects($this->exactly(2))->method('cancelCharge')->withConsecutive([$charge], [$charge, 10.11]); + $cancelSrvMock->expects($this->exactly(2))->method('getResourceService')->willReturn($resourceSrvMock); - $paymentSrvMock->cancelChargeById($payment, 's-chg-1'); - $paymentSrvMock->cancelChargeById($payment, 's-chg-1', 10.11); + $cancelSrvMock->cancelChargeById($payment, 's-chg-1'); + $cancelSrvMock->cancelChargeById($payment, 's-chg-1', 10.11); } /** @@ -348,10 +349,10 @@ public function cancelChargeByIdShouldFetchChargeAndPropagateToCancelCharge() */ public function cancelChargeShouldCreateCancellationAndCallsCreate() { - $heidelpay = new Heidelpay('s-priv-1234'); - $paymentSrv = $heidelpay->getPaymentService(); - $payment = (new Payment())->setParentResource($heidelpay); - $charge = (new Charge())->setPayment($payment); + $heidelpay = new Heidelpay('s-priv-1234'); + $cancelSrv = $heidelpay->getCancelService(); + $payment = (new Payment())->setParentResource($heidelpay); + $charge = (new Charge())->setPayment($payment); /** @var ResourceServiceInterface|MockObject $resourceSrvMock */ $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->setMethods(['createResource'])->disableOriginalConstructor()->getMock(); @@ -364,7 +365,7 @@ public function cancelChargeShouldCreateCancellationAndCallsCreate() })); $heidelpay->setResourceService($resourceSrvMock); - $paymentSrv->cancelCharge($charge, 12.22); + $cancelSrv->cancelCharge($charge, 12.22); } // From d3bf5cf3d7d9ccf68f4ce3dd14223556d604aa96 Mon Sep 17 00:00:00 2001 From: sixer1182 Date: Mon, 2 Dec 2019 10:08:26 +0100 Subject: [PATCH 038/101] [refactor] (PHPLIB-260) Move payment cancel methods to cancel service. --- src/Heidelpay.php | 27 +++++ src/Interfaces/CancelServiceInterface.php | 42 +++++++ src/Resources/Payment.php | 109 ++--------------- src/Services/CancelService.php | 136 ++++++++++++++++++++++ 4 files changed, 214 insertions(+), 100 deletions(-) diff --git a/src/Heidelpay.php b/src/Heidelpay.php index 0cbc7c44..5f9cd47d 100755 --- a/src/Heidelpay.php +++ b/src/Heidelpay.php @@ -26,6 +26,7 @@ namespace heidelpayPHP; use DateTime; +use heidelpayPHP\Constants\CancelReasonCodes; use heidelpayPHP\Exceptions\HeidelpayApiException; use heidelpayPHP\Interfaces\CancelServiceInterface; use heidelpayPHP\Interfaces\DebugHandlerInterface; @@ -983,6 +984,32 @@ public function cancelAuthorizationByPayment($payment, $amount = null): Cancella // + // + + /** + * {@inheritDoc} + */ + public function cancelPayment( + Payment $payment, + $amount = null, + $reasonCode = CancelReasonCodes::REASON_CODE_CANCEL, + $paymentReference = null, + $amountNet = null, + $amountVat = null + ): array { + return $this->getCancelService()->cancelPayment($payment, $amount, $reasonCode, $paymentReference, $amountNet, $amountVat); + } + + /** + * {@inheritDoc} + */ + public function cancelPaymentAuthorization(Payment $payment, float $amount = null) + { + return $this->getCancelService()->cancelPaymentAuthorization($payment, $amount); + } + + // + // /** diff --git a/src/Interfaces/CancelServiceInterface.php b/src/Interfaces/CancelServiceInterface.php index fcd28c89..8f8cd784 100644 --- a/src/Interfaces/CancelServiceInterface.php +++ b/src/Interfaces/CancelServiceInterface.php @@ -13,6 +13,7 @@ */ namespace heidelpayPHP\Interfaces; +use heidelpayPHP\Constants\CancelReasonCodes; use heidelpayPHP\Exceptions\HeidelpayApiException; use heidelpayPHP\Resources\Payment; use heidelpayPHP\Resources\TransactionTypes\Authorization; @@ -103,4 +104,45 @@ public function cancelCharge( float $amountNet = null, float $amountVat = null ): Cancellation; + + /** + * Performs a Cancellation transaction on the Payment. + * If no amount is given a full cancel will be performed i. e. all Charges and Authorizations will be cancelled. + * + * @param Payment $payment The payment whose authorization should be canceled. + * @param float|null $amount The amount to be canceled. + * This will be sent as amountGross in case of Hire Purchase payment method. + * @param string|null $reasonCode Reason for the Cancellation ref \heidelpayPHP\Constants\CancelReasonCodes. + * @param string|null $paymentReference A reference string for the payment. + * @param float|null $amountNet The net value of the amount to be cancelled (Hire Purchase only). + * @param float|null $amountVat The vat value of the amount to be cancelled (Hire Purchase only). + * + * @return Cancellation[] An array holding all Cancellation objects created with this cancel call. + * + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + */ + public function cancelPayment( + Payment $payment, + $amount = null, + $reasonCode = CancelReasonCodes::REASON_CODE_CANCEL, + $paymentReference = null, + $amountNet = null, + $amountVat = null + ): array; + + /** + * Cancel the given amount of the payments authorization. + * + * @param Payment $payment The payment whose authorization should be canceled. + * @param float|null $amount The amount to be cancelled. If null the remaining uncharged amount of the authorization + * will be cancelled completely. If it exceeds the remaining uncharged amount the + * cancellation will only cancel the remaining uncharged amount. + * + * @return Cancellation|null The resulting cancellation. + * + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + */ + public function cancelPaymentAuthorization(Payment $payment, float $amount = null); } diff --git a/src/Resources/Payment.php b/src/Resources/Payment.php index abfe20d2..21381194 100755 --- a/src/Resources/Payment.php +++ b/src/Resources/Payment.php @@ -25,7 +25,6 @@ namespace heidelpayPHP\Resources; use heidelpayPHP\Adapter\HttpAdapterInterface; -use heidelpayPHP\Constants\ApiResponseCodes; use heidelpayPHP\Constants\CancelReasonCodes; use heidelpayPHP\Constants\IdStrings; use heidelpayPHP\Constants\TransactionTypes; @@ -45,7 +44,6 @@ use heidelpayPHP\Traits\HasPaymentState; use RuntimeException; use stdClass; -use function in_array; use function is_string; class Payment extends AbstractHeidelpayResource @@ -644,71 +642,13 @@ public function getExternalId() * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function cancelAmount( - $amount = null, - $reasonCode = CancelReasonCodes::REASON_CODE_CANCEL, - $paymentReference = null, - $amountNet = null, - $amountVat = null + float $amount = null, + string $reasonCode = CancelReasonCodes::REASON_CODE_CANCEL, + string $paymentReference = null, + float $amountNet = null, + float $amountVat = null ): array { - $charges = $this->charges; - $remainingToCancel = $amount; - - $cancelWholePayment = $remainingToCancel === null; - $cancellations = []; - $cancellation = null; - - if ($cancelWholePayment || $remainingToCancel > 0.0) { - $cancellation = $this->cancelAuthorizationAmount($remainingToCancel); - - if ($cancellation instanceof Cancellation) { - $cancellations[] = $cancellation; - if (!$cancelWholePayment) { - $remainingToCancel -= $cancellation->getAmount(); - } - $cancellation = null; - } - } - - if (!$cancelWholePayment && $remainingToCancel <= 0.0) { - return $cancellations; - } - - /** @var Charge $charge */ - foreach ($charges as $charge) { - $cancelAmount = null; - if (!$cancelWholePayment && $remainingToCancel <= $charge->getTotalAmount()) { - $cancelAmount = $remainingToCancel; - } - - try { - $cancellation = $charge->cancel($cancelAmount, $reasonCode, $paymentReference, $amountNet, $amountVat); - } catch (HeidelpayApiException $e) { - $allowedErrors = [ - ApiResponseCodes::API_ERROR_ALREADY_CANCELLED, - ApiResponseCodes::API_ERROR_ALREADY_CHARGED, - ApiResponseCodes::API_ERROR_ALREADY_CHARGED_BACK - ]; - - if (!in_array($e->getCode(), $allowedErrors, true)) { - throw $e; - } - continue; - } - - if ($cancellation instanceof Cancellation) { - $cancellations[] = $cancellation; - if (!$cancelWholePayment) { - $remainingToCancel -= $cancellation->getAmount(); - } - $cancellation = null; - } - - if (!$cancelWholePayment && $remainingToCancel <= 0) { - break; - } - } - - return $cancellations; + return $this->getHeidelpayObject()->cancelPayment($this, $amount, $reasonCode, $paymentReference, $amountNet, $amountVat); } /** @@ -718,45 +658,14 @@ public function cancelAmount( * will be cancelled completely. If it exceeds the remaining uncharged amount the * cancellation will only cancel the remaining uncharged amount. * - * @return Cancellation|null + * @return Cancellation|null The resulting cancellation object. * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ - public function cancelAuthorizationAmount($amount = null) + public function cancelAuthorizationAmount(float $amount = null) { - $cancellation = null; - $completeCancel = $amount === null; - - $authorize = $this->getAuthorization(); - if ($authorize !== null) { - $cancelAmount = null; - if (!$completeCancel) { - $remainingAuthorized = $this->getAmount()->getRemaining(); - $cancelAmount = $amount > $remainingAuthorized ? $remainingAuthorized : $amount; - - // do not attempt to cancel if there is nothing left to cancel - if ($cancelAmount === 0.0) { - return null; - } - } - - try { - $cancellation = $authorize->cancel($cancelAmount); - } catch (HeidelpayApiException $e) { - $allowedErrors = [ - ApiResponseCodes::API_ERROR_ALREADY_CANCELLED, - ApiResponseCodes::API_ERROR_ALREADY_CHARGED, - ApiResponseCodes::API_ERROR_TRANSACTION_CANCEL_NOT_ALLOWED - ]; - - if (!in_array($e->getCode(), $allowedErrors, true)) { - throw $e; - } - } - } - - return $cancellation; + return $this->getHeidelpayObject()->cancelPaymentAuthorization($this, $amount); } /** diff --git a/src/Services/CancelService.php b/src/Services/CancelService.php index bae992e5..21306101 100644 --- a/src/Services/CancelService.php +++ b/src/Services/CancelService.php @@ -24,11 +24,16 @@ */ namespace heidelpayPHP\Services; +use heidelpayPHP\Constants\ApiResponseCodes; +use heidelpayPHP\Constants\CancelReasonCodes; +use heidelpayPHP\Exceptions\HeidelpayApiException; use heidelpayPHP\Heidelpay; use heidelpayPHP\Interfaces\CancelServiceInterface; +use heidelpayPHP\Resources\Payment; use heidelpayPHP\Resources\TransactionTypes\Authorization; use heidelpayPHP\Resources\TransactionTypes\Cancellation; use heidelpayPHP\Resources\TransactionTypes\Charge; +use RuntimeException; class CancelService implements CancelServiceInterface { @@ -145,4 +150,135 @@ public function cancelCharge( } // + + /** + * @param Payment $payment + * @param float|null $amount + * @param mixed $reasonCode + * @param null|mixed $paymentReference + * @param null|mixed $amountNet + * @param null|mixed $amountVat + * + * @return array + * + * @throws HeidelpayApiException + * @throws RuntimeException + */ + public function cancelPayment( + Payment $payment, + $amount = null, + $reasonCode = CancelReasonCodes::REASON_CODE_CANCEL, + $paymentReference = null, + $amountNet = null, + $amountVat = null + ): array { + $charges = $payment->getCharges(); + $remainingToCancel = $amount; + + $cancelWholePayment = $remainingToCancel === null; + $cancellations = []; + $cancellation = null; + + if ($cancelWholePayment || $remainingToCancel > 0.0) { + $cancellation = $this->cancelPaymentAuthorization($payment, $remainingToCancel); + + if ($cancellation instanceof Cancellation) { + $cancellations[] = $cancellation; + if (!$cancelWholePayment) { + $remainingToCancel -= $cancellation->getAmount(); + } + $cancellation = null; + } + } + + if (!$cancelWholePayment && $remainingToCancel <= 0.0) { + return $cancellations; + } + + /** @var Charge $charge */ + foreach ($charges as $charge) { + $cancelAmount = null; + if (!$cancelWholePayment && $remainingToCancel <= $charge->getTotalAmount()) { + $cancelAmount = $remainingToCancel; + } + + try { + $cancellation = $charge->cancel($cancelAmount, $reasonCode, $paymentReference, $amountNet, $amountVat); + } catch (HeidelpayApiException $e) { + $allowedErrors = [ + ApiResponseCodes::API_ERROR_ALREADY_CANCELLED, + ApiResponseCodes::API_ERROR_ALREADY_CHARGED, + ApiResponseCodes::API_ERROR_ALREADY_CHARGED_BACK + ]; + + if (!in_array($e->getCode(), $allowedErrors, true)) { + throw $e; + } + continue; + } + + if ($cancellation instanceof Cancellation) { + $cancellations[] = $cancellation; + if (!$cancelWholePayment) { + $remainingToCancel -= $cancellation->getAmount(); + } + $cancellation = null; + } + + if (!$cancelWholePayment && $remainingToCancel <= 0) { + break; + } + } + + return $cancellations; + } + + /** + * Cancel the given amount of the payments authorization. + * + * @param Payment $payment The payment whose authorization should be canceled. + * @param float|null $amount The amount to be cancelled. If null the remaining uncharged amount of the authorization + * will be cancelled completely. If it exceeds the remaining uncharged amount the + * cancellation will only cancel the remaining uncharged amount. + * + * @return Cancellation|null + * + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + */ + public function cancelPaymentAuthorization(Payment $payment, float $amount = null) + { + $cancellation = null; + $completeCancel = $amount === null; + + $authorize = $payment->getAuthorization(); + if ($authorize !== null) { + $cancelAmount = null; + if (!$completeCancel) { + $remainingAuthorized = $payment->getAmount()->getRemaining(); + $cancelAmount = $amount > $remainingAuthorized ? $remainingAuthorized : $amount; + + // do not attempt to cancel if there is nothing left to cancel + if ($cancelAmount === 0.0) { + return null; + } + } + + try { + $cancellation = $authorize->cancel($cancelAmount); + } catch (HeidelpayApiException $e) { + $allowedErrors = [ + ApiResponseCodes::API_ERROR_ALREADY_CANCELLED, + ApiResponseCodes::API_ERROR_ALREADY_CHARGED, + ApiResponseCodes::API_ERROR_TRANSACTION_CANCEL_NOT_ALLOWED + ]; + + if (!in_array($e->getCode(), $allowedErrors, true)) { + throw $e; + } + } + } + + return $cancellation; + } } From a1b11c74c44e31c300b8b28d86d62f009f3d90f6 Mon Sep 17 00:00:00 2001 From: sixer1182 Date: Mon, 2 Dec 2019 11:19:49 +0100 Subject: [PATCH 039/101] [refactor] (PHPLIB-260) Refactor payment cancel tests. --- src/Heidelpay.php | 16 ++--- src/Interfaces/CancelServiceInterface.php | 16 ++--- src/Resources/Payment.php | 2 +- src/Services/CancelService.php | 18 ++--- test/unit/Resources/PaymentCancelTest.php | 80 +++++++++++++---------- 5 files changed, 71 insertions(+), 61 deletions(-) diff --git a/src/Heidelpay.php b/src/Heidelpay.php index 5f9cd47d..2d2d1db5 100755 --- a/src/Heidelpay.php +++ b/src/Heidelpay.php @@ -969,7 +969,7 @@ public function chargePayment( /** * {@inheritDoc} */ - public function cancelAuthorization(Authorization $authorization, $amount = null): Cancellation + public function cancelAuthorization(Authorization $authorization, float $amount = null): Cancellation { return $this->cancelService->cancelAuthorization($authorization, $amount); } @@ -977,7 +977,7 @@ public function cancelAuthorization(Authorization $authorization, $amount = null /** * {@inheritDoc} */ - public function cancelAuthorizationByPayment($payment, $amount = null): Cancellation + public function cancelAuthorizationByPayment($payment, float $amount = null): Cancellation { return $this->cancelService->cancelAuthorizationByPayment($payment, $amount); } @@ -991,11 +991,11 @@ public function cancelAuthorizationByPayment($payment, $amount = null): Cancella */ public function cancelPayment( Payment $payment, - $amount = null, + float $amount = null, $reasonCode = CancelReasonCodes::REASON_CODE_CANCEL, - $paymentReference = null, - $amountNet = null, - $amountVat = null + string $paymentReference = null, + float $amountNet = null, + float $amountVat = null ): array { return $this->getCancelService()->cancelPayment($payment, $amount, $reasonCode, $paymentReference, $amountNet, $amountVat); } @@ -1017,7 +1017,7 @@ public function cancelPaymentAuthorization(Payment $payment, float $amount = nul */ public function cancelChargeById( $payment, - $chargeId, + string $chargeId, float $amount = null, string $reasonCode = null, string $paymentReference = null, @@ -1040,7 +1040,7 @@ public function cancelChargeById( */ public function cancelCharge( Charge $charge, - $amount = null, + float $amount = null, string $reasonCode = null, string $paymentReference = null, float $amountNet = null, diff --git a/src/Interfaces/CancelServiceInterface.php b/src/Interfaces/CancelServiceInterface.php index 8f8cd784..eef18cd1 100644 --- a/src/Interfaces/CancelServiceInterface.php +++ b/src/Interfaces/CancelServiceInterface.php @@ -35,7 +35,7 @@ interface CancelServiceInterface * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ - public function cancelAuthorization(Authorization $authorization, $amount = null): Cancellation; + public function cancelAuthorization(Authorization $authorization, float $amount = null): Cancellation; /** * Performs a Cancellation transaction for the Authorization of the given Payment object. @@ -49,7 +49,7 @@ public function cancelAuthorization(Authorization $authorization, $amount = null * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ - public function cancelAuthorizationByPayment($payment, $amount = null): Cancellation; + public function cancelAuthorizationByPayment($payment, float $amount = null): Cancellation; /** * Performs a Cancellation transaction for the given Charge and returns the resulting Cancellation object. @@ -71,7 +71,7 @@ public function cancelAuthorizationByPayment($payment, $amount = null): Cancella */ public function cancelChargeById( $payment, - $chargeId, + string $chargeId, float $amount = null, string $reasonCode = null, string $paymentReference = null, @@ -98,7 +98,7 @@ public function cancelChargeById( */ public function cancelCharge( Charge $charge, - $amount = null, + float $amount = null, string $reasonCode = null, string $paymentReference = null, float $amountNet = null, @@ -124,11 +124,11 @@ public function cancelCharge( */ public function cancelPayment( Payment $payment, - $amount = null, + float $amount = null, $reasonCode = CancelReasonCodes::REASON_CODE_CANCEL, - $paymentReference = null, - $amountNet = null, - $amountVat = null + string $paymentReference = null, + float $amountNet = null, + float $amountVat = null ): array; /** diff --git a/src/Resources/Payment.php b/src/Resources/Payment.php index 21381194..c94ccf62 100755 --- a/src/Resources/Payment.php +++ b/src/Resources/Payment.php @@ -643,7 +643,7 @@ public function getExternalId() */ public function cancelAmount( float $amount = null, - string $reasonCode = CancelReasonCodes::REASON_CODE_CANCEL, + $reasonCode = CancelReasonCodes::REASON_CODE_CANCEL, string $paymentReference = null, float $amountNet = null, float $amountVat = null diff --git a/src/Services/CancelService.php b/src/Services/CancelService.php index 21306101..b5157e81 100644 --- a/src/Services/CancelService.php +++ b/src/Services/CancelService.php @@ -86,7 +86,7 @@ public function getResourceService(): ResourceService /** * {@inheritDoc} */ - public function cancelAuthorization(Authorization $authorization, $amount = null): Cancellation + public function cancelAuthorization(Authorization $authorization, float $amount = null): Cancellation { $cancellation = new Cancellation($amount); $cancellation->setPayment($authorization->getPayment()); @@ -99,7 +99,7 @@ public function cancelAuthorization(Authorization $authorization, $amount = null /** * {@inheritDoc} */ - public function cancelAuthorizationByPayment($payment, $amount = null): Cancellation + public function cancelAuthorizationByPayment($payment, float $amount = null): Cancellation { $authorization = $this->getResourceService()->fetchAuthorization($payment); return $this->cancelAuthorization($authorization, $amount); @@ -114,7 +114,7 @@ public function cancelAuthorizationByPayment($payment, $amount = null): Cancella */ public function cancelChargeById( $payment, - $chargeId, + string $chargeId, float $amount = null, string $reasonCode = null, string $paymentReference = null, @@ -130,7 +130,7 @@ public function cancelChargeById( */ public function cancelCharge( Charge $charge, - $amount = null, + float $amount = null, string $reasonCode = null, string $paymentReference = null, float $amountNet = null, @@ -166,11 +166,11 @@ public function cancelCharge( */ public function cancelPayment( Payment $payment, - $amount = null, - $reasonCode = CancelReasonCodes::REASON_CODE_CANCEL, - $paymentReference = null, - $amountNet = null, - $amountVat = null + float $amount = null, + $reasonCode = CancelReasonCodes::REASON_CODE_CANCEL, + string $paymentReference = null, + float $amountNet = null, + float $amountVat = null ): array { $charges = $payment->getCharges(); $remainingToCancel = $amount; diff --git a/test/unit/Resources/PaymentCancelTest.php b/test/unit/Resources/PaymentCancelTest.php index 347216ad..a8cc4e1e 100644 --- a/test/unit/Resources/PaymentCancelTest.php +++ b/test/unit/Resources/PaymentCancelTest.php @@ -31,6 +31,7 @@ use heidelpayPHP\Resources\TransactionTypes\Authorization; use heidelpayPHP\Resources\TransactionTypes\Cancellation; use heidelpayPHP\Resources\TransactionTypes\Charge; +use heidelpayPHP\Services\CancelService; use heidelpayPHP\test\BasePaymentTest; use PHPUnit\Framework\AssertionFailedError; use PHPUnit\Framework\Exception; @@ -55,18 +56,21 @@ class PaymentCancelTest extends BasePaymentTest */ public function cancelAmountShouldCallCancelAuthorizationAmount() { - /** @var MockObject|Payment $paymentMock */ - $paymentMock = $this->getMockBuilder(Payment::class)->setMethods(['cancelAuthorizationAmount'])->getMock(); + /** @var MockObject|CancelService $cancelSrvMock */ + $cancelSrvMock = $this->getMockBuilder(CancelService::class)->disableOriginalConstructor()->setMethods(['cancelPaymentAuthorization'])->getMock(); + $this->heidelpay->setCancelService($cancelSrvMock); + + /** @var MockObject|Charge $chargeMock */ $chargeMock = $this->getMockBuilder(Charge::class)->setMethods(['cancel'])->getMock(); - $paymentMock->setAuthorization((new Authorization(12.3))->setPayment($paymentMock)); + $payment = (new Payment($this->heidelpay))->setAuthorization(new Authorization(12.3)); $cancellation = new Cancellation(12.3); - $paymentMock->expects($this->exactly(2))->method('cancelAuthorizationAmount')->willReturn($cancellation); + $cancelSrvMock->expects($this->exactly(2))->method('cancelPaymentAuthorization')->willReturn($cancellation); $chargeMock->expects($this->never())->method('cancel'); - $this->assertEquals([$cancellation], $paymentMock->cancelAmount(10.0)); - $this->assertEquals([$cancellation], $paymentMock->cancelAmount(12.3)); + $this->assertEquals([$cancellation], $payment->cancelAmount(10.0)); + $this->assertEquals([$cancellation], $payment->cancelAmount(12.3)); } /** @@ -82,18 +86,21 @@ public function cancelAmountShouldCallCancelAuthorizationAmount() */ public function chargesShouldBeCancelledIfAuthDoesNotExist1() { - /** @var MockObject|Payment $paymentMock */ + /** @var MockObject|CancelService $cancelSrvMock */ + $cancelSrvMock = $this->getMockBuilder(CancelService::class)->disableOriginalConstructor()->setMethods(['cancelPaymentAuthorization'])->getMock(); + $this->heidelpay->setCancelService($cancelSrvMock); + /** @var MockObject|Charge $chargeMock */ - $paymentMock = $this->getMockBuilder(Payment::class)->setMethods(['cancelAuthorizationAmount'])->getMock(); $chargeMock = $this->getMockBuilder(Charge::class)->setMethods(['cancel'])->setConstructorArgs([10.0])->getMock(); $cancellation = new Cancellation(10.0); - $paymentMock->expects($this->once())->method('cancelAuthorizationAmount')->willReturn(null); + $cancelSrvMock->expects($this->once())->method('cancelPaymentAuthorization')->willReturn(null); $chargeMock->expects($this->once())->method('cancel')->with(10.0, 'CANCEL')->willReturn($cancellation); - $paymentMock->addCharge($chargeMock); - $this->assertEquals([$cancellation], $paymentMock->cancelAmount(10.0)); + $payment = (new Payment($this->heidelpay))->addCharge($chargeMock); + + $this->assertEquals([$cancellation], $payment->cancelAmount(10.0)); } /** @@ -109,25 +116,27 @@ public function chargesShouldBeCancelledIfAuthDoesNotExist1() */ public function chargesShouldBeCancelledIfAuthDoesNotExist2() { - /** @var MockObject|Payment $paymentMock */ + /** @var MockObject|CancelService $cancelSrvMock */ + $cancelSrvMock = $this->getMockBuilder(CancelService::class)->disableOriginalConstructor()->setMethods(['cancelPaymentAuthorization'])->getMock(); + $this->heidelpay->setCancelService($cancelSrvMock); /** @var MockObject|Charge $charge1Mock */ - /** @var MockObject|Charge $charge2Mock */ - $paymentMock = $this->getMockBuilder(Payment::class)->setMethods(['cancelAuthorizationAmount'])->getMock(); $charge1Mock = $this->getMockBuilder(Charge::class)->setMethods(['cancel'])->setConstructorArgs([10.0])->getMock(); + /** @var MockObject|Charge $charge2Mock */ $charge2Mock = $this->getMockBuilder(Charge::class)->setMethods(['cancel'])->setConstructorArgs([12.3])->getMock(); $cancellation1 = new Cancellation(10.0); $cancellation2 = new Cancellation(2.3); - $paymentMock->expects($this->exactly(3))->method('cancelAuthorizationAmount')->willReturn(null); + $cancelSrvMock->expects($this->exactly(3))->method('cancelPaymentAuthorization')->willReturn(null); $charge1Mock->expects($this->exactly(3))->method('cancel')->withConsecutive([10.0, 'CANCEL'], [null, 'CANCEL'], [null, 'CANCEL'])->willReturn($cancellation1); $charge2Mock->expects($this->exactly(2))->method('cancel')->withConsecutive([2.3, 'CANCEL'], [null, 'CANCEL'])->willReturn($cancellation2); - $paymentMock->addCharge($charge1Mock)->addCharge($charge2Mock); + $payment = (new Payment($this->heidelpay))->setAuthorization(new Authorization(12.3)); + $payment->addCharge($charge1Mock)->addCharge($charge2Mock); - $this->assertEquals([$cancellation1], $paymentMock->cancelAmount(10.0)); - $this->assertEquals([$cancellation1, $cancellation2], $paymentMock->cancelAmount(12.3)); - $this->assertEquals([$cancellation1, $cancellation2], $paymentMock->cancelAmount()); + $this->assertEquals([$cancellation1], $payment->cancelAmount(10.0)); + $this->assertEquals([$cancellation1, $cancellation2], $payment->cancelAmount(12.3)); + $this->assertEquals([$cancellation1, $cancellation2], $payment->cancelAmount()); } /** @@ -147,17 +156,19 @@ public function chargesShouldBeCancelledIfAuthDoesNotExist2() */ public function verifyAllowedErrorsWillBeIgnoredDuringChargeCancel($allowedExceptionCode, $shouldHaveThrownException) { - /** @var MockObject|Payment $paymentMock */ + /** @var MockObject|CancelService $cancelSrvMock */ + $cancelSrvMock = $this->getMockBuilder(CancelService::class)->disableOriginalConstructor()->setMethods(['cancelPaymentAuthorization'])->getMock(); + $this->heidelpay->setCancelService($cancelSrvMock); /** @var MockObject|Charge $chargeMock */ - $paymentMock = $this->getMockBuilder(Payment::class)->setMethods(['cancelAuthorizationAmount'])->getMock(); $chargeMock = $this->getMockBuilder(Charge::class)->setMethods(['cancel'])->disableOriginalConstructor()->getMock(); $allowedException = new HeidelpayApiException(null, null, $allowedExceptionCode); $chargeMock->method('cancel')->willThrowException($allowedException); - $paymentMock->addCharge($chargeMock); + + $payment = (new Payment($this->heidelpay))->addCharge($chargeMock); try { - $this->assertEquals([], $paymentMock->cancelAmount(12.3)); + $this->assertEquals([], $payment->cancelAmount(12.3)); $this->assertFalse($shouldHaveThrownException, 'Exception should have been thrown here!'); } catch (HeidelpayApiException $e) { $this->assertTrue($shouldHaveThrownException, "Exception should not have been thrown here! ({$e->getCode()})"); @@ -173,20 +184,18 @@ public function verifyAllowedErrorsWillBeIgnoredDuringChargeCancel($allowedExcep * @throws ReflectionException * @throws RuntimeException */ - public function cancelAuthorizationAmountShouldCallCancelOnTheAuthorizationAndReturnCancellation() + public function cancelAuthorizationAmountShouldCallCancelOnTheAuthorization() { - $cancellation = new Cancellation(1.0); + /** @var Authorization|MockObject $authorizationMock */ $authorizationMock = $this->getMockBuilder(Authorization::class)->setMethods(['cancel'])->getMock(); + $cancellation = new Cancellation(1.0); $authorizationMock->expects($this->once())->method('cancel')->willReturn($cancellation); + /** @var Payment|MockObject $paymentMock */ $paymentMock = $this->getMockBuilder(Payment::class)->setMethods(['getAuthorization'])->getMock(); $paymentMock->expects($this->once())->method('getAuthorization')->willReturn($authorizationMock); + $paymentMock->setParentResource($this->heidelpay)->setAuthorization($authorizationMock); - /** - * @var Authorization $authorizationMock - * @var Payment $paymentMock - */ - $paymentMock->setAuthorization($authorizationMock); $this->assertEquals($cancellation, $paymentMock->cancelAuthorizationAmount()); } @@ -210,14 +219,12 @@ public function cancelAuthorizationAmountShouldCallCancelWithTheRemainingAmountA $authorizationMock = $this->getMockBuilder(Authorization::class)->setConstructorArgs([100.0])->setMethods(['cancel'])->getMock(); $authorizationMock->expects($this->exactly(4))->method('cancel')->withConsecutive([null], [50.0], [100.0], [100.0])->willReturn($cancellation); + /** @var Payment|MockObject $paymentMock */ $paymentMock = $this->getMockBuilder(Payment::class)->setMethods(['getAuthorization', 'getAmount'])->getMock(); $paymentMock->method('getAmount')->willReturn((new Amount())->setRemaining(100.0)); $paymentMock->expects($this->exactly(4))->method('getAuthorization')->willReturn($authorizationMock); + $paymentMock->setParentResource($this->heidelpay); - /** - * @var Authorization $authorizationMock - * @var Payment $paymentMock - */ $paymentMock->setAuthorization($authorizationMock); $this->assertEquals($cancellation, $paymentMock->cancelAuthorizationAmount()); $this->assertEquals($cancellation, $paymentMock->cancelAuthorizationAmount(50.0)); @@ -243,14 +250,16 @@ public function cancelAuthorizationAmountShouldCallCancelWithTheRemainingAmountA public function verifyAllowedErrorsWillBeIgnoredDuringAuthorizeCancel($exceptionCode, $shouldHaveThrownException) { /** @var MockObject|Payment $paymentMock */ - /** @var MockObject|Authorization $authMock */ $paymentMock = $this->getMockBuilder(Payment::class)->setMethods(['getAuthorization'])->getMock(); + + /** @var MockObject|Authorization $authMock */ $authMock = $this->getMockBuilder(Authorization::class)->setMethods(['cancel'])->disableOriginalConstructor()->getMock(); $exception = new HeidelpayApiException(null, null, $exceptionCode); $authMock->method('cancel')->willThrowException($exception); $paymentMock->method('getAuthorization')->willReturn($authMock); $paymentMock->getAmount()->setRemaining(100.0); + $paymentMock->setParentResource($this->heidelpay); try { $this->assertEquals(null, $paymentMock->cancelAuthorizationAmount(12.3)); @@ -278,6 +287,7 @@ public function cancelAuthorizationAmountWillNotCallCancelIfThereIsNoOpenAmount( $paymentMock->method('getAuthorization')->willReturn($authMock); $authMock->expects(self::never())->method('cancel'); $paymentMock->getAmount()->setRemaining(0.0); + $paymentMock->setParentResource($this->heidelpay); $paymentMock->cancelAuthorizationAmount(12.3); $paymentMock->cancelAuthorizationAmount(0.0); From 1c83ec0fc51c0991734371ea1a9a4cd2813c0484 Mon Sep 17 00:00:00 2001 From: sixer1182 Date: Mon, 2 Dec 2019 11:44:44 +0100 Subject: [PATCH 040/101] [refactor] (PHPLIB-260) Fix style issue. --- src/Interfaces/ResourceServiceInterface.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Interfaces/ResourceServiceInterface.php b/src/Interfaces/ResourceServiceInterface.php index 035ff16d..6369147d 100644 --- a/src/Interfaces/ResourceServiceInterface.php +++ b/src/Interfaces/ResourceServiceInterface.php @@ -195,14 +195,14 @@ public function fetchPaymentType($typeId): BasePaymentType; /** * Updates the PaymentType resource with the given PaymentType object. * - * @param BasePaymentType $x The PaymentType object to be updated. + * @param BasePaymentType $paymentType The PaymentType object to be updated. * * @return BasePaymentType|AbstractHeidelpayResource The updated PaymentType object. * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ - public function updatePaymentType(BasePaymentType $x): BasePaymentType; + public function updatePaymentType(BasePaymentType $paymentType): BasePaymentType; /** * Create an API resource for the given customer object. From 95c99e04ea9f51c47691a282aa8f9bf94c570ab3 Mon Sep 17 00:00:00 2001 From: sixer1182 Date: Mon, 2 Dec 2019 12:52:28 +0100 Subject: [PATCH 041/101] [refactor] (PHPLIB-260) Update changelog. --- CHANGELOG.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index faed16f8..2cb6fd4b 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,8 +5,12 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a ## [1.3.0.0][1.3.0.0] +### This update contains breaking changes and you might have to update your implementation + ### Change * Refactor heidelpay facade to implement service interfaces. +* Move payment cancel methods to cancel service. +* Cleanup doc comments. ## [1.2.5.1][1.2.5.1] @@ -99,6 +103,8 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a ## [1.2.0.0][1.2.0.0] +### This update contains breaking changes and you might have to update your implementation + ### Changed * Refactored all examples. * Fixed iDeal example. @@ -208,7 +214,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a ## [1.1.0.0][1.1.0.0] -###### This update contains breaking changes and you will most certainly have to update your implementation +### This update contains breaking changes and you might have to update your implementation ### Changed * Payment types `Prepayment`, `Invoice` and `Invoice guaranteed` can no longer perform the authorize transaction but only direct charge. From cd88be7b558662ff0961ae2a00d234fa221cd3ca Mon Sep 17 00:00:00 2001 From: sixer1182 Date: Mon, 2 Dec 2019 13:50:52 +0100 Subject: [PATCH 042/101] [refactor] (PHPLIB-260) Cleanup code. Move method documentation to interfaces. Improve parameter naming. --- src/Heidelpay.php | 293 +++----------------- src/Interfaces/CancelServiceInterface.php | 50 ++-- src/Interfaces/PaymentServiceInterface.php | 26 +- src/Interfaces/ResourceServiceInterface.php | 52 ++-- src/Services/CancelService.php | 14 +- src/Services/PaymentService.php | 4 +- 6 files changed, 114 insertions(+), 325 deletions(-) diff --git a/src/Heidelpay.php b/src/Heidelpay.php index 2d2d1db5..028c2885 100755 --- a/src/Heidelpay.php +++ b/src/Heidelpay.php @@ -27,7 +27,6 @@ use DateTime; use heidelpayPHP\Constants\CancelReasonCodes; -use heidelpayPHP\Exceptions\HeidelpayApiException; use heidelpayPHP\Interfaces\CancelServiceInterface; use heidelpayPHP\Interfaces\DebugHandlerInterface; use heidelpayPHP\Interfaces\HeidelpayParentInterface; @@ -339,15 +338,7 @@ public function getUri($appendId = true): string // /** - * Activate recurring payment for the given payment type (if possible). - * - * @param string|BasePaymentType $paymentType The payment to activate recurring payment for. - * @param string $returnUrl The URL to which the customer gets redirected in case of a 3ds transaction - * - * @return mixed - * - * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * {@inheritDoc} */ public function activateRecurringPayment($paymentType, $returnUrl): Recurring { @@ -359,14 +350,7 @@ public function activateRecurringPayment($paymentType, $returnUrl): Recurring // /** - * Updates the given payment payment object. - * - * @param Payment|string $payment The local payment object to be updated. - * - * @return Payment Returns the updated payment object. - * - * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * {@inheritDoc} */ public function fetchPayment($payment): Payment { @@ -374,14 +358,7 @@ public function fetchPayment($payment): Payment } /** - * Fetches a payment object using its orderId. - * - * @param string $orderId The orderId set during authorize or charge. - * - * @return Payment Returns the updated payment object. - * - * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * {@inheritDoc} */ public function fetchPaymentByOrderId($orderId): Payment { @@ -393,14 +370,7 @@ public function fetchPaymentByOrderId($orderId): Payment // /** - * Read and return the public key and configured payment types from API. - * - * @param bool $detailed If this flag is set detailed information are fetched. - * - * @return Keypair The Keypair object composed of the data returned by the API. - * - * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * {@inheritDoc} */ public function fetchKeypair($detailed = false): Keypair { @@ -412,14 +382,7 @@ public function fetchKeypair($detailed = false): Keypair // /** - * Create Metadata resource. - * - * @param Metadata $metadata The Metadata object to be created. - * - * @return Metadata The fetched Metadata resource. - * - * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * {@inheritDoc} */ public function createMetadata(Metadata $metadata): Metadata { @@ -427,14 +390,7 @@ public function createMetadata(Metadata $metadata): Metadata } /** - * Fetch and return Metadata resource. - * - * @param Metadata|string $metadata The local Metadata object to be fetched. - * - * @return Metadata The fetched Metadata resource. - * - * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * {@inheritDoc} */ public function fetchMetadata($metadata): Metadata { @@ -446,14 +402,7 @@ public function fetchMetadata($metadata): Metadata // /** - * Creates and returns the given basket resource. - * - * @param Basket $basket The basket to be created. - * - * @return Basket The created Basket object. - * - * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * {@inheritDoc} */ public function createBasket(Basket $basket): Basket { @@ -461,14 +410,7 @@ public function createBasket(Basket $basket): Basket } /** - * Fetches and returns the given Basket (by object or id). - * - * @param Basket|string $basket Basket object or id of basket to be fetched. - * - * @return Basket The fetched Basket object. - * - * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * {@inheritDoc} */ public function fetchBasket($basket): Basket { @@ -476,14 +418,7 @@ public function fetchBasket($basket): Basket } /** - * Update the a basket resource with the given basket object (id must be set). - * - * @param Basket $basket - * - * @return Basket The updated Basket object. - * - * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * {@inheritDoc} */ public function updateBasket(Basket $basket): Basket { @@ -495,16 +430,7 @@ public function updateBasket(Basket $basket): Basket // /** - * Creates a PaymentType resource from the given PaymentType object. - * This is used to create the payment object prior to any transaction. - * Usually this will be done by the heidelpayUI components (https://docs.heidelpay.com/docs/heidelpay-ui-components) - * - * @param BasePaymentType $paymentType The PaymentType object representing the object to be created. - * - * @return BasePaymentType|AbstractHeidelpayResource The created and updated PaymentType object. - * - * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * {@inheritDoc} */ public function createPaymentType(BasePaymentType $paymentType): BasePaymentType { @@ -512,14 +438,7 @@ public function createPaymentType(BasePaymentType $paymentType): BasePaymentType } /** - * Updates the PaymentType resource with the given PaymentType object. - * - * @param BasePaymentType $paymentType The PaymentType object to be updated. - * - * @return BasePaymentType|AbstractHeidelpayResource The updated PaymentType object. - * - * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * {@inheritDoc} */ public function updatePaymentType(BasePaymentType $paymentType): BasePaymentType { @@ -527,14 +446,7 @@ public function updatePaymentType(BasePaymentType $paymentType): BasePaymentType } /** - * Retrieves a the PaymentType object with the given Id from the API. - * - * @param string $typeId The Id of the PaymentType resource to be fetched. - * - * @return BasePaymentType|AbstractHeidelpayResource The fetched PaymentType object. - * - * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * {@inheritDoc} */ public function fetchPaymentType($typeId): BasePaymentType { @@ -546,14 +458,7 @@ public function fetchPaymentType($typeId): BasePaymentType // /** - * Creates a Customer resource via API using the given Customer object. - * - * @param Customer $customer The Customer object to be created using the API. - * - * @return Customer The created and updated Customer object. - * - * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * {@inheritDoc} */ public function createCustomer(Customer $customer): Customer { @@ -561,14 +466,7 @@ public function createCustomer(Customer $customer): Customer } /** - * Creates a Customer resource via API using the given Customer object. - * - * @param Customer $customer The Customer object to be created using the API. - * - * @return Customer The created and updated Customer object. - * - * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * {@inheritDoc} */ public function createOrUpdateCustomer(Customer $customer): Customer { @@ -576,16 +474,7 @@ public function createOrUpdateCustomer(Customer $customer): Customer } /** - * Updates the given local Customer object using the API. - * Retrieves a Customer resource, if the customer parameter is the customer id. - * - * @param Customer|string $customer Either the local Customer object to be updated or the id of a Customer object - * to be retrieved from the API. - * - * @return Customer The retrieved/updated Customer object. - * - * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * {@inheritDoc} */ public function fetchCustomer($customer): Customer { @@ -593,14 +482,7 @@ public function fetchCustomer($customer): Customer } /** - * Retrieves a Customer resource, by the given external customer id. - * - * @param string $customerId The external customer id to fetch the customer object by. - * - * @return Customer The retrieved Customer object. - * - * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * {@inheritDoc} */ public function fetchCustomerByExtCustomerId($customerId): Customer { @@ -608,14 +490,7 @@ public function fetchCustomerByExtCustomerId($customerId): Customer } /** - * Updates the remote Customer resource using the changes of the given local Customer object. - * - * @param Customer $customer The local Customer object used to update the remote resource via API. - * - * @return Customer The updated Customer object. - * - * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * {@inheritDoc} */ public function updateCustomer(Customer $customer): Customer { @@ -623,13 +498,7 @@ public function updateCustomer(Customer $customer): Customer } /** - * Deletes the given Customer resource via API. - * The $customer parameter can be either a Customer instance or the id of the Customer to be deleted. - * - * @param Customer|string $customer Either the Customer object or the id of the Customer resource. - * - * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * {@inheritDoc} */ public function deleteCustomer($customer) { @@ -641,16 +510,7 @@ public function deleteCustomer($customer) // /** - * Retrieves an Authorization resource via the API using the corresponding Payment. - * The Authorization resource can not be fetched using its id since they are unique only within the Payment. - * A Payment can have zero or one Authorizations. - * - * @param Payment|string $payment The Payment object or the id of a Payment object whose Authorization to fetch. - * - * @return Authorization The Authorization object of the given Payment. - * - * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * {@inheritDoc} */ public function fetchAuthorization($payment): Authorization { @@ -662,16 +522,7 @@ public function fetchAuthorization($payment): Authorization // /** - * Retrieve a Charge object by payment id and charge id from the API. - * The Charge resource can not be fetched using its id since they are unique only within the Payment. - * - * @param string $paymentId The id of the Payment resource the Charge belongs to. - * @param string $chargeId The id of the Charge resource to be fetched. - * - * @return Charge The retrieved Charge object. - * - * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * {@inheritDoc} */ public function fetchChargeById($paymentId, $chargeId): Charge { @@ -679,14 +530,7 @@ public function fetchChargeById($paymentId, $chargeId): Charge } /** - * Fetch the given Charge resource from the api. - * - * @param Charge $charge - * - * @return Charge - * - * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * {@inheritDoc} */ public function fetchCharge(Charge $charge): Charge { @@ -698,15 +542,7 @@ public function fetchCharge(Charge $charge): Charge // /** - * Retrieves a Cancellation resource of the given Authorization (aka reversal) via the API. - * - * @param Authorization $authorization The Authorization object the Cancellation belongs to. - * @param string $cancellationId The id of the Cancellation object to be retrieved. - * - * @return Cancellation The retrieved Cancellation object. - * - * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * {@inheritDoc} */ public function fetchReversalByAuthorization($authorization, $cancellationId): Cancellation { @@ -714,15 +550,7 @@ public function fetchReversalByAuthorization($authorization, $cancellationId): C } /** - * Retrieves a Cancellation resource of the Authorization (aka reversal) which belongs to the Payment via API. - * - * @param Payment|string $payment The Payment object or the id of the Payment the Reversal belongs to. - * @param string $cancellationId The id of the Authorization Cancellation (aka reversal). - * - * @return Cancellation The cancellation object retrieved from the API. - * - * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * {@inheritDoc} */ public function fetchReversal($payment, $cancellationId): Cancellation { @@ -730,16 +558,7 @@ public function fetchReversal($payment, $cancellationId): Cancellation } /** - * Retrieves the Cancellation object of a Charge (aka refund) from the API. - * - * @param Payment|string $payment The Payment object or the id of the Payment the Cancellation belongs to. - * @param string $chargeId The id of the Charge the Cancellation belongs to. - * @param string $cancellationId The id of the Cancellation resource. - * - * @return Cancellation The retrieved Cancellation resource. - * - * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * {@inheritDoc} */ public function fetchRefundById($payment, $chargeId, $cancellationId): Cancellation { @@ -747,15 +566,7 @@ public function fetchRefundById($payment, $chargeId, $cancellationId): Cancellat } /** - * Retrieves and fetches a Cancellation resource of a Charge (aka refund) via API. - * - * @param Charge $charge The Charge object the Cancellation belongs to. - * @param string $cancellationId The id of the Cancellation object to be retrieved. - * - * @return Cancellation The retrieved Cancellation object. - * - * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * {@inheritDoc} */ public function fetchRefund(Charge $charge, $cancellationId): Cancellation { @@ -767,15 +578,7 @@ public function fetchRefund(Charge $charge, $cancellationId): Cancellation // /** - * Retrieves the Shipment resource of the given Payment resource by its id. - * - * @param Payment|string $payment The Payment object or the id of the Payment the Shipment resource belongs to. - * @param string $shipmentId The id of the Shipment resource to be retrieved. - * - * @return Shipment The retrieved Shipment object. - * - * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * {@inheritDoc} */ public function fetchShipment($payment, $shipmentId): Shipment { @@ -993,11 +796,12 @@ public function cancelPayment( Payment $payment, float $amount = null, $reasonCode = CancelReasonCodes::REASON_CODE_CANCEL, - string $paymentReference = null, + string $referenceText = null, float $amountNet = null, float $amountVat = null ): array { - return $this->getCancelService()->cancelPayment($payment, $amount, $reasonCode, $paymentReference, $amountNet, $amountVat); + return $this->cancelService + ->cancelPayment($payment, $amount, $reasonCode, $referenceText, $amountNet, $amountVat); } /** @@ -1005,7 +809,7 @@ public function cancelPayment( */ public function cancelPaymentAuthorization(Payment $payment, float $amount = null) { - return $this->getCancelService()->cancelPaymentAuthorization($payment, $amount); + return $this->cancelService->cancelPaymentAuthorization($payment, $amount); } // @@ -1020,19 +824,12 @@ public function cancelChargeById( string $chargeId, float $amount = null, string $reasonCode = null, - string $paymentReference = null, + string $referenceText = null, float $amountNet = null, float $amountVat = null ): Cancellation { - return $this->cancelService->cancelChargeById( - $payment, - $chargeId, - $amount, - $reasonCode, - $paymentReference, - $amountNet, - $amountVat - ); + return $this->cancelService + ->cancelChargeById($payment, $chargeId, $amount, $reasonCode, $referenceText, $amountNet, $amountVat); } /** @@ -1042,18 +839,12 @@ public function cancelCharge( Charge $charge, float $amount = null, string $reasonCode = null, - string $paymentReference = null, + string $referenceText = null, float $amountNet = null, float $amountVat = null ): Cancellation { - return $this->cancelService->cancelCharge( - $charge, - $amount, - $reasonCode, - $paymentReference, - $amountNet, - $amountVat - ); + return $this->cancelService + ->cancelCharge($charge, $amount, $reasonCode, $referenceText, $amountNet, $amountVat); } // @@ -1085,7 +876,7 @@ public function payout( $metadata = null, $basket = null, $invoiceId = null, - $paymentReference = null + $referenceText = null ): Payout { return $this->paymentService->payout( $amount, @@ -1097,7 +888,7 @@ public function payout( $metadata, $basket, $invoiceId, - $paymentReference + $referenceText ); } @@ -1142,12 +933,8 @@ public function fetchDirectDebitInstalmentPlans( $effectiveInterest, DateTime $orderDate = null ): InstalmentPlans { - return $this->paymentService->fetchDirectDebitInstalmentPlans( - $amount, - $currency, - $effectiveInterest, - $orderDate - ); + return $this->paymentService + ->fetchDirectDebitInstalmentPlans($amount, $currency, $effectiveInterest, $orderDate); } // diff --git a/src/Interfaces/CancelServiceInterface.php b/src/Interfaces/CancelServiceInterface.php index eef18cd1..20f7482a 100644 --- a/src/Interfaces/CancelServiceInterface.php +++ b/src/Interfaces/CancelServiceInterface.php @@ -55,14 +55,14 @@ public function cancelAuthorizationByPayment($payment, float $amount = null): Ca * Performs a Cancellation transaction for the given Charge and returns the resulting Cancellation object. * Performs a full cancel if the parameter amount is null. * - * @param Payment|string $payment The Payment object or the id of the Payment the charge belongs to. - * @param string $chargeId The id of the Charge to be canceled. - * @param float|null $amount The amount to be canceled. - * This will be sent as amountGross in case of Hire Purchase payment method. - * @param string|null $reasonCode Reason for the Cancellation ref \heidelpayPHP\Constants\CancelReasonCodes. - * @param string|null $paymentReference A reference string for the payment. - * @param float|null $amountNet The net value of the amount to be cancelled (Hire Purchase only). - * @param float|null $amountVat The vat value of the amount to be cancelled (Hire Purchase only). + * @param Payment|string $payment The Payment object or the id of the Payment the charge belongs to. + * @param string $chargeId The id of the Charge to be canceled. + * @param float|null $amount The amount to be canceled. + * This will be sent as amountGross in case of Hire Purchase payment method. + * @param string|null $reasonCode Reason for the Cancellation ref \heidelpayPHP\Constants\CancelReasonCodes. + * @param string|null $referenceText A reference string for the payment. + * @param float|null $amountNet The net value of the amount to be cancelled (Hire Purchase only). + * @param float|null $amountVat The vat value of the amount to be cancelled (Hire Purchase only). * * @return Cancellation The resulting Cancellation object. * @@ -74,7 +74,7 @@ public function cancelChargeById( string $chargeId, float $amount = null, string $reasonCode = null, - string $paymentReference = null, + string $referenceText = null, float $amountNet = null, float $amountVat = null ): Cancellation; @@ -83,13 +83,13 @@ public function cancelChargeById( * Performs a Cancellation transaction and returns the resulting Cancellation object. * Performs a full cancel if the parameter amount is null. * - * @param Charge $charge The Charge object to create the Cancellation for. - * @param float|null $amount The amount to be canceled. - * This will be sent as amountGross in case of Hire Purchase payment method. - * @param string|null $reasonCode Reason for the Cancellation ref \heidelpayPHP\Constants\CancelReasonCodes. - * @param string|null $paymentReference A reference string for the payment. - * @param float|null $amountNet The net value of the amount to be cancelled (Hire Purchase only). - * @param float|null $amountVat The vat value of the amount to be cancelled (Hire Purchase only). + * @param Charge $charge The Charge object to create the Cancellation for. + * @param float|null $amount The amount to be canceled. + * This will be sent as amountGross in case of Hire Purchase payment method. + * @param string|null $reasonCode Reason for the Cancellation ref \heidelpayPHP\Constants\CancelReasonCodes. + * @param string|null $referenceText A reference string for the payment. + * @param float|null $amountNet The net value of the amount to be cancelled (Hire Purchase only). + * @param float|null $amountVat The vat value of the amount to be cancelled (Hire Purchase only). * * @return Cancellation The resulting Cancellation object. * @@ -100,7 +100,7 @@ public function cancelCharge( Charge $charge, float $amount = null, string $reasonCode = null, - string $paymentReference = null, + string $referenceText = null, float $amountNet = null, float $amountVat = null ): Cancellation; @@ -109,13 +109,13 @@ public function cancelCharge( * Performs a Cancellation transaction on the Payment. * If no amount is given a full cancel will be performed i. e. all Charges and Authorizations will be cancelled. * - * @param Payment $payment The payment whose authorization should be canceled. - * @param float|null $amount The amount to be canceled. - * This will be sent as amountGross in case of Hire Purchase payment method. - * @param string|null $reasonCode Reason for the Cancellation ref \heidelpayPHP\Constants\CancelReasonCodes. - * @param string|null $paymentReference A reference string for the payment. - * @param float|null $amountNet The net value of the amount to be cancelled (Hire Purchase only). - * @param float|null $amountVat The vat value of the amount to be cancelled (Hire Purchase only). + * @param Payment $payment The payment whose authorization should be canceled. + * @param float|null $amount The amount to be canceled. + * This will be sent as amountGross in case of Hire Purchase payment method. + * @param string|null $reasonCode Reason for the Cancellation ref \heidelpayPHP\Constants\CancelReasonCodes. + * @param string|null $referenceText A reference string for the payment. + * @param float|null $amountNet The net value of the amount to be cancelled (Hire Purchase only). + * @param float|null $amountVat The vat value of the amount to be cancelled (Hire Purchase only). * * @return Cancellation[] An array holding all Cancellation objects created with this cancel call. * @@ -126,7 +126,7 @@ public function cancelPayment( Payment $payment, float $amount = null, $reasonCode = CancelReasonCodes::REASON_CODE_CANCEL, - string $paymentReference = null, + string $referenceText = null, float $amountNet = null, float $amountVat = null ): array; diff --git a/src/Interfaces/PaymentServiceInterface.php b/src/Interfaces/PaymentServiceInterface.php index 3e50f2f7..242489a3 100644 --- a/src/Interfaces/PaymentServiceInterface.php +++ b/src/Interfaces/PaymentServiceInterface.php @@ -162,18 +162,18 @@ public function chargePayment( /** * Performs a Payout transaction and returns the resulting Payout resource. * - * @param float $amount The amount to payout. - * @param string $currency The currency of the amount. - * @param string|BasePaymentType $paymentType The PaymentType object or the id of the PaymentType to use. - * @param string $returnUrl The URL used to return to the shop if the process requires leaving it. - * @param Customer|string|null $customer The Customer object or the id of the customer resource to reference. - * @param string|null $orderId A custom order id which can be set by the merchant. - * @param Metadata|null $metadata The Metadata object containing custom information for the payment. - * @param Basket|null $basket The Basket object corresponding to the payment. - * The Basket object will be created automatically if it does not exist - * yet (i.e. has no id). - * @param string|null $invoiceId The external id of the invoice. - * @param string|null $paymentReference A reference text for the payment. + * @param float $amount The amount to payout. + * @param string $currency The currency of the amount. + * @param string|BasePaymentType $paymentType The PaymentType object or the id of the PaymentType to use. + * @param string $returnUrl The URL used to return to the shop if the process requires leaving it. + * @param Customer|string|null $customer The Customer object or the id of the customer resource to reference. + * @param string|null $orderId A custom order id which can be set by the merchant. + * @param Metadata|null $metadata The Metadata object containing custom information for the payment. + * @param Basket|null $basket The Basket object corresponding to the payment. + * The Basket object will be created automatically if it does not exist + * yet (i.e. has no id). + * @param string|null $invoiceId The external id of the invoice. + * @param string|null $referenceText A reference text for the payment. * * @return Payout|AbstractHeidelpayResource The resulting object of the Payout resource. * @@ -190,7 +190,7 @@ public function payout( $metadata = null, $basket = null, $invoiceId = null, - $paymentReference = null + $referenceText = null ): Payout; /** diff --git a/src/Interfaces/ResourceServiceInterface.php b/src/Interfaces/ResourceServiceInterface.php index 6369147d..b936fbf2 100644 --- a/src/Interfaces/ResourceServiceInterface.php +++ b/src/Interfaces/ResourceServiceInterface.php @@ -42,21 +42,6 @@ interface ResourceServiceInterface { - /** - * Retrieves an Payout resource via the API using the corresponding Payment or paymentId. - * The Payout resource can not be fetched using its id since they are unique only within the Payment. - * A Payment can have zero or one Payouts. - * - * @param Payment|string $payment The Payment object or the id of a Payment object whose Payout to fetch. - * There can only be one payout object to a payment. - * - * @return Payout The Payout object of the given Payment. - * - * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. - */ - public function fetchPayout($payment): Payout; - /** * Activate recurring payment for the given payment type (if possible). * @@ -169,7 +154,9 @@ public function fetchBasket($basket): Basket; public function updateBasket(Basket $basket): Basket; /** - * Create the given payment type via api. + * Creates a PaymentType resource from the given PaymentType object. + * This is used to create the payment object prior to any transaction. + * Usually this will be done by the heidelpayUI components (https://docs.heidelpay.com/docs/heidelpay-ui-components) * * @param BasePaymentType $paymentType * @@ -181,28 +168,28 @@ public function updateBasket(Basket $basket): Basket; public function createPaymentType(BasePaymentType $paymentType): BasePaymentType; /** - * Fetch the payment type with the given Id from the API. + * Updates the PaymentType resource with the given PaymentType object. * - * @param string $typeId + * @param BasePaymentType $paymentType The PaymentType object to be updated. * - * @return BasePaymentType|AbstractHeidelpayResource + * @return BasePaymentType|AbstractHeidelpayResource The updated PaymentType object. * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ - public function fetchPaymentType($typeId): BasePaymentType; + public function updatePaymentType(BasePaymentType $paymentType): BasePaymentType; /** - * Updates the PaymentType resource with the given PaymentType object. + * Fetch the payment type with the given Id from the API. * - * @param BasePaymentType $paymentType The PaymentType object to be updated. + * @param string $typeId * - * @return BasePaymentType|AbstractHeidelpayResource The updated PaymentType object. + * @return BasePaymentType|AbstractHeidelpayResource * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ - public function updatePaymentType(BasePaymentType $paymentType): BasePaymentType; + public function fetchPaymentType($typeId): BasePaymentType; /** * Create an API resource for the given customer object. @@ -317,7 +304,7 @@ public function fetchChargeById($payment, $chargeId): Charge; public function fetchCharge(Charge $charge): Charge; /** - * Fetch a cancel on an authorization (aka reversal). + * Fetch a cancellation on an authorization (aka reversal). * * @param Authorization $authorization The authorization object for which to fetch the cancellation. * @param string $cancellationId The id of the cancellation to fetch. @@ -381,4 +368,19 @@ public function fetchRefund(Charge $charge, $cancellationId): Cancellation; * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function fetchShipment($payment, $shipmentId): Shipment; + + /** + * Retrieves an Payout resource via the API using the corresponding Payment or paymentId. + * The Payout resource can not be fetched using its id since they are unique only within the Payment. + * A Payment can have zero or one Payouts. + * + * @param Payment|string $payment The Payment object or the id of a Payment object whose Payout to fetch. + * There can only be one payout object to a payment. + * + * @return Payout The Payout object of the given Payment. + * + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + */ + public function fetchPayout($payment): Payout; } diff --git a/src/Services/CancelService.php b/src/Services/CancelService.php index b5157e81..dddb88ca 100644 --- a/src/Services/CancelService.php +++ b/src/Services/CancelService.php @@ -117,12 +117,12 @@ public function cancelChargeById( string $chargeId, float $amount = null, string $reasonCode = null, - string $paymentReference = null, + string $referenceText = null, float $amountNet = null, float $amountVat = null ): Cancellation { $charge = $this->getResourceService()->fetchChargeById($payment, $chargeId); - return $this->cancelCharge($charge, $amount, $reasonCode, $paymentReference, $amountNet, $amountVat); + return $this->cancelCharge($charge, $amount, $reasonCode, $referenceText, $amountNet, $amountVat); } /** @@ -132,7 +132,7 @@ public function cancelCharge( Charge $charge, float $amount = null, string $reasonCode = null, - string $paymentReference = null, + string $referenceText = null, float $amountNet = null, float $amountVat = null ): Cancellation { @@ -140,7 +140,7 @@ public function cancelCharge( $cancellation ->setReasonCode($reasonCode) ->setPayment($charge->getPayment()) - ->setPaymentReference($paymentReference) + ->setPaymentReference($referenceText) ->setAmountNet($amountNet) ->setAmountVat($amountVat); $charge->addCancellation($cancellation); @@ -155,7 +155,7 @@ public function cancelCharge( * @param Payment $payment * @param float|null $amount * @param mixed $reasonCode - * @param null|mixed $paymentReference + * @param null|mixed $referenceText * @param null|mixed $amountNet * @param null|mixed $amountVat * @@ -168,7 +168,7 @@ public function cancelPayment( Payment $payment, float $amount = null, $reasonCode = CancelReasonCodes::REASON_CODE_CANCEL, - string $paymentReference = null, + string $referenceText = null, float $amountNet = null, float $amountVat = null ): array { @@ -203,7 +203,7 @@ public function cancelPayment( } try { - $cancellation = $charge->cancel($cancelAmount, $reasonCode, $paymentReference, $amountNet, $amountVat); + $cancellation = $charge->cancel($cancelAmount, $reasonCode, $referenceText, $amountNet, $amountVat); } catch (HeidelpayApiException $e) { $allowedErrors = [ ApiResponseCodes::API_ERROR_ALREADY_CANCELLED, diff --git a/src/Services/PaymentService.php b/src/Services/PaymentService.php index 3a6c727b..91cd8386 100755 --- a/src/Services/PaymentService.php +++ b/src/Services/PaymentService.php @@ -218,13 +218,13 @@ public function payout( $metadata = null, $basket = null, $invoiceId = null, - $paymentReference = null + $referenceText = null ): Payout { $payment = $this->createPayment($paymentType); $payout = (new Payout($amount, $currency, $returnUrl)) ->setOrderId($orderId) ->setInvoiceId($invoiceId) - ->setPaymentReference($paymentReference); + ->setPaymentReference($referenceText); $payment->setPayout($payout)->setCustomer($customer)->setMetadata($metadata)->setBasket($basket); $this->getResourceService()->createResource($payout); From e1d67c584d8727adc2d0b6795daafff2dd46e0c7 Mon Sep 17 00:00:00 2001 From: sixer1182 Date: Mon, 2 Dec 2019 15:26:42 +0100 Subject: [PATCH 043/101] [refactor] (PHPLIB-260) Cleanup code. --- src/Heidelpay.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Heidelpay.php b/src/Heidelpay.php index 028c2885..07e40c5d 100755 --- a/src/Heidelpay.php +++ b/src/Heidelpay.php @@ -107,7 +107,7 @@ public function __construct($key, $locale = null) $this->resourceService = new ResourceService($this); $this->paymentService = new PaymentService($this); $this->webhookService = new WebhookService($this); - $this->cancelService = new CancelService($this); + $this->cancelService = new CancelService($this); $this->httpService = new HttpService(); } From 385eec95b2203d8222860a99e1ac5202758a0b8e Mon Sep 17 00:00:00 2001 From: sixer1182 Date: Tue, 3 Dec 2019 15:10:55 +0100 Subject: [PATCH 044/101] [refactor] (PHPLIB-260) Rename PaymentCancelTest class to CancelServiceTest. --- .../CancelServiceTest.php} | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) rename test/unit/{Resources/PaymentCancelTest.php => Services/CancelServiceTest.php} (99%) diff --git a/test/unit/Resources/PaymentCancelTest.php b/test/unit/Services/CancelServiceTest.php similarity index 99% rename from test/unit/Resources/PaymentCancelTest.php rename to test/unit/Services/CancelServiceTest.php index a8cc4e1e..664ef39a 100644 --- a/test/unit/Resources/PaymentCancelTest.php +++ b/test/unit/Services/CancelServiceTest.php @@ -1,6 +1,6 @@ Date: Tue, 3 Dec 2019 15:12:52 +0100 Subject: [PATCH 045/101] [refactor] (PHPLIB-260) Rename PaymentCancelTest class to CancelServiceTest. --- test/unit/Services/PaymentServiceTest.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/test/unit/Services/PaymentServiceTest.php b/test/unit/Services/PaymentServiceTest.php index aa0deccf..8296868a 100755 --- a/test/unit/Services/PaymentServiceTest.php +++ b/test/unit/Services/PaymentServiceTest.php @@ -538,6 +538,8 @@ public function paymentShouldBeCreatedByInitPayPage(string $action) // + // + /** * Verify fetch hdd instalment plans. * @@ -570,6 +572,8 @@ public function fetchInstalmentPlansWillCallFetchOnResourceService() $heidelpay->getPaymentService()->fetchDirectDebitInstalmentPlans(12.23, 'EUR', 4.99, $date); } + // + // /** From b66c69e53aa8ad3e34c36ab47be12f11c93ad86f Mon Sep 17 00:00:00 2001 From: sixer1182 Date: Tue, 3 Dec 2019 15:20:00 +0100 Subject: [PATCH 046/101] [refactor] (PHPLIB-260) Extend unit tests for PaymentService. --- test/unit/Services/PaymentServiceTest.php | 37 +++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/test/unit/Services/PaymentServiceTest.php b/test/unit/Services/PaymentServiceTest.php index 8296868a..d43647ca 100755 --- a/test/unit/Services/PaymentServiceTest.php +++ b/test/unit/Services/PaymentServiceTest.php @@ -238,6 +238,8 @@ public function chargePaymentShouldCallCreateOnResourceServiceWithNewCharge() return $charge instanceof Charge && $charge->getAmount() === 1.234 && $charge->getCurrency() === 'myTestCurrency' && + $charge->getOrderId() === null && + $charge->getInvoiceId() === null && $newPayment instanceof Payment && $newPayment === $payment && in_array($charge, $newPayment->getCharges(), true); @@ -248,6 +250,41 @@ public function chargePaymentShouldCallCreateOnResourceServiceWithNewCharge() $this->assertArraySubset([$returnedCharge], $payment->getCharges()); } + /** + * Verify chargePayment will set Ids if they are defined. + * + * @test + * + * @throws HeidelpayApiException + * @throws ReflectionException + * @throws RuntimeException + */ + public function chargePaymentShouldSetArgumentsInNewChargeObject() + { + $heidelpay = new Heidelpay('s-priv-123'); + $payment = (new Payment())->setParentResource($heidelpay)->setId('myPaymentId'); + + /** @var ResourceServiceInterface|MockObject $resourceSrvMock */ + $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->disableOriginalConstructor()->setMethods(['createResource'])->getMock(); + $resourceSrvMock->expects($this->once())->method('createResource') + ->with($this->callback(static function ($charge) use ($payment) { + /** @var Charge $charge */ + $newPayment = $charge->getPayment(); + return $charge instanceof Charge && + $charge->getAmount() === 1.234 && + $charge->getCurrency() === 'myTestCurrency' && + $charge->getOrderId() === 'orderId' && + $charge->getInvoiceId() === 'invoiceId' && + $newPayment instanceof Payment && + $newPayment === $payment && + in_array($charge, $newPayment->getCharges(), true); + })); + + $paymentSrv = $heidelpay->setResourceService($resourceSrvMock)->getPaymentService(); + $returnedCharge = $paymentSrv->chargePayment($payment, 1.234, 'myTestCurrency', 'orderId', 'invoiceId'); + $this->assertArraySubset([$returnedCharge], $payment->getCharges()); + } + // // From eca7cc4652a651d79e2b10e92831ee70660a86dd Mon Sep 17 00:00:00 2001 From: sixer1182 Date: Tue, 3 Dec 2019 15:40:38 +0100 Subject: [PATCH 047/101] [refactor] (PHPLIB-260) Cleanup: Refactor ResourceServiceTest class. --- test/unit/Services/ResourceServiceTest.php | 281 +++++++++++++-------- 1 file changed, 180 insertions(+), 101 deletions(-) diff --git a/test/unit/Services/ResourceServiceTest.php b/test/unit/Services/ResourceServiceTest.php index 3ced10be..5f6e0b0f 100755 --- a/test/unit/Services/ResourceServiceTest.php +++ b/test/unit/Services/ResourceServiceTest.php @@ -75,6 +75,65 @@ class ResourceServiceTest extends BasePaymentTest { + // + + /** + * Verify setters and getters work properly. + * + * @test + * + * @throws RuntimeException + */ + public function gettersAndSettersShouldWorkProperly() + { + $heidelpay = new Heidelpay('s-priv-123'); + /** @var ResourceService $resourceService */ + $resourceService = $heidelpay->getResourceService(); + $this->assertSame($heidelpay, $resourceService->getHeidelpay()); + + $heidelpay2 = new Heidelpay('s-priv-1234'); + $resourceService->setHeidelpay($heidelpay2); + $this->assertSame($heidelpay2, $resourceService->getHeidelpay()); + } + + /** + * Verify send will call send on httpService. + * + * @test + * @dataProvider sendShouldCallSendOnHttpServiceDP + * + * @param string $method + * @param string $uri + * @param bool $appendId + * + * @throws HeidelpayApiException + * @throws ReflectionException + * @throws RuntimeException + * @throws \PHPUnit\Framework\Exception + * @throws \PHPUnit\Framework\MockObject\RuntimeException + */ + public function sendShouldCallSendOnHttpService(string $method, string $uri, bool $appendId) + { + $heidelpay = new Heidelpay('s-priv-1234'); + $resourceMock = $this->getMockBuilder(DummyResource::class)->setMethods(['getUri', 'getHeidelpayObject'])->getMock(); + $resourceMock->expects($this->once())->method('getUri')->with($appendId)->willReturn($uri); + $resourceMock->method('getHeidelpayObject')->willReturn($heidelpay); + $httpSrvMock = $this->getMockBuilder(HttpService::class)->setMethods(['send'])->getMock(); + $resourceSrv = new ResourceService($heidelpay); + + /** @var HttpService $httpSrvMock */ + $heidelpay->setHttpService($httpSrvMock); + $httpSrvMock->expects($this->once())->method('send')->with($uri, $resourceMock, $method)->willReturn('{"response": "This is the response"}'); + + /** @var AbstractHeidelpayResource $resourceMock */ + $response = $resourceSrv->send($resourceMock, $method); + $this->assertEquals('This is the response', $response->response); + } + + // + + // + /** * Verify getResourceIdFromUrl works correctly. * @@ -109,11 +168,15 @@ public function getResourceIdFromUrlShouldThrowExceptionIfTheIdCanNotBeFound($ur IdService::getResourceIdFromUrl($uri, $idString); } + // + + // + /** - * Verify getResource calls fetch if its id is set and it has never been fetched before. + * Verify fetchResource calls fetch if its id is set and it has never been fetched before. * * @test - * @dataProvider getResourceFetchCallDataProvider + * @dataProvider fetchResourceFetchCallDP * * @param $resource * @param $timesFetchIsCalled @@ -122,7 +185,7 @@ public function getResourceIdFromUrlShouldThrowExceptionIfTheIdCanNotBeFound($ur * @throws ReflectionException * @throws RuntimeException */ - public function getResourceShouldFetchIfTheResourcesIdIsSetAndItHasNotBeenFetchedBefore( + public function fetchResourceShouldFetchIfTheResourcesIdIsSetAndItHasNotBeenFetchedBefore( $resource, $timesFetchIsCalled ) { @@ -309,6 +372,77 @@ public function fetchShouldCallSendWithGetUpdateFetchedAtAndCallHandleResponse() $this->assertTrue(($now - $then) < 60); } + /** + * Verify fetchResourceByUrl calls fetch for the desired resource. + * + * @test + * @dataProvider fetchResourceByUrlShouldFetchTheDesiredResourceDP + * + * @param string $fetchMethod + * @param mixed $arguments + * @param string $resourceUrl + * + * @throws Exception + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws ReflectionException + */ + public function fetchResourceByUrlShouldFetchTheDesiredResource($fetchMethod, $arguments, $resourceUrl) + { + /** @var Heidelpay|MockObject $heidelpayMock */ + $heidelpayMock = $this->getMockBuilder(Heidelpay::class)->disableOriginalConstructor()->setMethods([$fetchMethod])->getMock(); + $heidelpayMock->expects($this->once())->method($fetchMethod)->with(...$arguments); + $resourceService = new ResourceService($heidelpayMock); + + $resourceService->fetchResourceByUrl($resourceUrl); + } + + /** + * Verify fetchResourceByUrl calls fetch for the desired resource. + * + * @test + * @dataProvider fetchResourceByUrlForAPaymentTypeShouldCallFetchPaymentTypeDP + * + * @param $paymentTypeId + * @param string $resourceUrl + * + * @throws Exception + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws ReflectionException + */ + public function fetchResourceByUrlForAPaymentTypeShouldCallFetchPaymentType($paymentTypeId, $resourceUrl) + { + /** @var ResourceService|MockObject $resourceSrvMock */ + $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->disableOriginalConstructor()->setMethods(['fetchPaymentType'])->getMock(); + $resourceSrvMock->expects($this->once())->method('fetchPaymentType')->with($paymentTypeId); + + $resourceSrvMock->fetchResourceByUrl($resourceUrl); + } + + /** + * Verify does not call fetchResourceByUrl and returns null if the resource type is unknown. + * + * @test + * + * @throws Exception + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws ReflectionException + */ + public function fetchResourceByUrlForAPaymentTypeShouldReturnNullIfTheTypeIsUnknown() + { + /** @var ResourceService|MockObject $resourceSrvMock */ + $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->disableOriginalConstructor()->setMethods(['fetchPaymentType'])->getMock(); + $resourceSrvMock->expects($this->never())->method('fetchPaymentType'); + + $this->assertNull($resourceSrvMock->fetchResourceByUrl('https://api.heidelpay.com/v1/types/card/s-unknown-xen2ybcovn56/')); + } + + // + + // + /** * Verify fetchPayment method will fetch the passed payment object. * @@ -383,6 +517,10 @@ public function fetchPaymentByOrderIdShouldCreatePaymentObjectWithOrderIdAndCall $resourceSrvMock->fetchPaymentByOrderId('myOrderId'); } + // + + // + /** * Verify fetchKeypair will call fetch with a Keypair object. * @@ -407,6 +545,10 @@ public function fetchKeypairShouldCallFetchWithAKeypairObject() $resourceSrvMock->fetchKeypair(); } + // + + // + /** * Verify createPaymentType method will set parentResource to heidelpay object and call create. * @@ -511,6 +653,10 @@ public function updatePaymentTypeShouldCallUpdateMethod() $this->assertSame($paymentType, $returnedPaymentType); } + // + + // + /** * Verify createCustomer calls create with customer object and the heidelpay resource is set. * @@ -731,6 +877,10 @@ public function deleteCustomerShouldFetchCustomerByIdIfTheIdIsGiven() $this->assertSame($customer, $returnedCustomer); } + // + + // + /** * Verify fetchAuthorization fetches payment object and returns its authorization. * @@ -756,6 +906,10 @@ public function fetchAuthorizationShouldFetchPaymentAndReturnItsAuthorization() $this->assertSame($authorize, $returnedAuthorize); } + // + + // + /** * Verify fetchPayout fetches payment object and returns its payout. * @@ -780,6 +934,10 @@ public function fetchPayoutShouldFetchPaymentAndReturnItsPayout() $this->assertSame($payout, $returnedPayout); } + // + + // + /** * Verify fetchChargeById fetches payment object and gets and returns the charge object from it. * @@ -805,6 +963,10 @@ public function fetchChargeByIdShouldFetchPaymentAndReturnTheChargeOfThePayment( $this->assertSame($charge, $returnedCharge); } + // + + // + /** * Verify fetchReversalByAuthorization fetches authorization and gets and returns the reversal object from it. * @@ -901,6 +1063,10 @@ public function fetchRefundShouldGetAndFetchDesiredChargeCancellation() $this->assertSame($cancel, $returnedCancellation); } + // + + // + /** * Verify fetchShipment fetches payment object and returns the desired shipment from it. * @@ -924,6 +1090,10 @@ public function fetchShipmentShouldFetchPaymentAndReturnTheDesiredShipmentFromIt $this->assertSame($shipment, $returnedShipment); } + // + + // + /** * Verify fetchMetadata calls fetch with the given metadata object. * @@ -983,39 +1153,9 @@ public function fetchMetadataShouldCallFetchWithANewMetadataObjectWithTheGivenId $resourceSrvMock->fetchMetadata('s-mtd-1234'); } - /** - * Verify send will call send on httpService. - * - * @test - * @dataProvider sendShouldCallSendOnHttpServiceDP - * - * @param string $method - * @param string $uri - * @param bool $appendId - * - * @throws HeidelpayApiException - * @throws ReflectionException - * @throws RuntimeException - * @throws \PHPUnit\Framework\Exception - * @throws \PHPUnit\Framework\MockObject\RuntimeException - */ - public function sendShouldCallSendOnHttpService(string $method, string $uri, bool $appendId) - { - $heidelpay = new Heidelpay('s-priv-1234'); - $resourceMock = $this->getMockBuilder(DummyResource::class)->setMethods(['getUri', 'getHeidelpayObject'])->getMock(); - $resourceMock->expects($this->once())->method('getUri')->with($appendId)->willReturn($uri); - $resourceMock->method('getHeidelpayObject')->willReturn($heidelpay); - $httpSrvMock = $this->getMockBuilder(HttpService::class)->setMethods(['send'])->getMock(); - $resourceSrv = new ResourceService($heidelpay); + // - /** @var HttpService $httpSrvMock */ - $heidelpay->setHttpService($httpSrvMock); - $httpSrvMock->expects($this->once())->method('send')->with($uri, $resourceMock, $method)->willReturn('{"response": "This is the response"}'); - - /** @var AbstractHeidelpayResource $resourceMock */ - $response = $resourceSrv->send($resourceMock, $method); - $this->assertEquals('This is the response', $response->response); - } + // /** * Verify createBasket will set parentResource and call create with the given basket. @@ -1120,72 +1260,9 @@ public function updateBasketShouldCallUpdateAndReturnTheGivenBasket() $this->assertEquals($heidelpay, $basket->getHeidelpayObject()); } - /** - * Verify fetchResourceByUrl calls fetch for the desired resource. - * - * @test - * @dataProvider fetchResourceByUrlShouldFetchTheDesiredResourceDP - * - * @param string $fetchMethod - * @param mixed $arguments - * @param string $resourceUrl - * - * @throws Exception - * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. - * @throws ReflectionException - */ - public function fetchResourceByUrlShouldFetchTheDesiredResource($fetchMethod, $arguments, $resourceUrl) - { - /** @var Heidelpay|MockObject $heidelpayMock */ - $heidelpayMock = $this->getMockBuilder(Heidelpay::class)->disableOriginalConstructor()->setMethods([$fetchMethod])->getMock(); - $heidelpayMock->expects($this->once())->method($fetchMethod)->with(...$arguments); - $resourceService = new ResourceService($heidelpayMock); - - $resourceService->fetchResourceByUrl($resourceUrl); - } - - /** - * Verify fetchResourceByUrl calls fetch for the desired resource. - * - * @test - * @dataProvider fetchResourceByUrlForAPaymentTypeShouldCallFetchPaymentTypeDP - * - * @param $paymentTypeId - * @param string $resourceUrl - * - * @throws Exception - * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. - * @throws ReflectionException - */ - public function fetchResourceByUrlForAPaymentTypeShouldCallFetchPaymentType($paymentTypeId, $resourceUrl) - { - /** @var ResourceService|MockObject $resourceSrvMock */ - $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->disableOriginalConstructor()->setMethods(['fetchPaymentType'])->getMock(); - $resourceSrvMock->expects($this->once())->method('fetchPaymentType')->with($paymentTypeId); - - $resourceSrvMock->fetchResourceByUrl($resourceUrl); - } - - /** - * Verify does not call fetchResourceByUrl and returns null if the resource type is unknown. - * - * @test - * - * @throws Exception - * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. - * @throws ReflectionException - */ - public function fetchResourceByUrlForAPaymentTypeShouldReturnNullIfTheTypeIsUnknown() - { - /** @var ResourceService|MockObject $resourceSrvMock */ - $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->disableOriginalConstructor()->setMethods(['fetchPaymentType'])->getMock(); - $resourceSrvMock->expects($this->never())->method('fetchPaymentType'); + // - $this->assertNull($resourceSrvMock->fetchResourceByUrl('https://api.heidelpay.com/v1/types/card/s-unknown-xen2ybcovn56/')); - } + // /** * Verify createRecurring calls fetch for the payment type if it is given the id. @@ -1255,6 +1332,8 @@ public function createRecurringShouldThrowExceptionWhenRecurringPaymentIsNotSupp $resourceService->activateRecurringPayment(new Sofort(), 'returnUrl'); } + // + // /** @@ -1292,7 +1371,7 @@ public function failingUrlIdStringProvider(): array * * @throws Exception */ - public function getResourceFetchCallDataProvider(): array + public function fetchResourceFetchCallDP(): array { return [ 'fetchedAt is null, Id is null' => [new Customer(), 0], From 500afa7d352d0b0df7fbde658fd49c8750875721 Mon Sep 17 00:00:00 2001 From: sixer1182 Date: Wed, 4 Dec 2019 09:38:11 +0100 Subject: [PATCH 048/101] [refactor] (PHPLIB-260) Cleanup: Refactor unit Tests. --- src/Services/ResourceService.php | 9 +- .../AbstractTransactionTypeTest.php | 7 +- test/unit/Services/ResourceServiceTest.php | 454 +++++++----------- 3 files changed, 174 insertions(+), 296 deletions(-) diff --git a/src/Services/ResourceService.php b/src/Services/ResourceService.php index 5e5abf9e..cc0db014 100755 --- a/src/Services/ResourceService.php +++ b/src/Services/ResourceService.php @@ -392,11 +392,11 @@ public function fetchPayment($payment): Payment { $paymentObject = $payment; if (is_string($payment)) { - $paymentObject = new Payment($this->heidelpay); + $paymentObject = new Payment(); $paymentObject->setId($payment); } - $this->fetchResource($paymentObject); + $this->fetchResource($paymentObject->setParentResource($this->heidelpay)); return $paymentObject; } @@ -446,11 +446,10 @@ public function fetchMetadata($metadata): Metadata { $metadataObject = $metadata; if (is_string($metadata)) { - $metadataObject = (new Metadata())->setParentResource($this->heidelpay); - $metadataObject->setId($metadata); + $metadataObject = (new Metadata())->setId($metadata); } - $this->fetchResource($metadataObject); + $this->fetchResource($metadataObject->setParentResource($this->heidelpay)); return $metadataObject; } diff --git a/test/unit/Resources/TransactionTypes/AbstractTransactionTypeTest.php b/test/unit/Resources/TransactionTypes/AbstractTransactionTypeTest.php index 5aa51f9d..b8810287 100755 --- a/test/unit/Resources/TransactionTypes/AbstractTransactionTypeTest.php +++ b/test/unit/Resources/TransactionTypes/AbstractTransactionTypeTest.php @@ -28,12 +28,12 @@ use heidelpayPHP\Adapter\HttpAdapterInterface; use heidelpayPHP\Exceptions\HeidelpayApiException; use heidelpayPHP\Heidelpay; -use heidelpayPHP\Interfaces\ResourceServiceInterface; use heidelpayPHP\Resources\Payment; use heidelpayPHP\Resources\TransactionTypes\AbstractTransactionType; use heidelpayPHP\Services\ResourceService; use heidelpayPHP\test\BasePaymentTest; use PHPUnit\Framework\Exception; +use PHPUnit\Framework\MockObject\MockObject; use ReflectionException; use RuntimeException; use stdClass; @@ -181,11 +181,10 @@ public function fetchPaymentShouldFetchPaymentObject() { $payment = (new Payment())->setId('myPaymentId'); - $resourceServiceMock = $this->getMockBuilder(ResourceService::class) - ->disableOriginalConstructor()->setMethods(['fetchResource'])->getMock(); + /** @var ResourceService|MockObject $resourceServiceMock */ + $resourceServiceMock = $this->getMockBuilder(ResourceService::class)->disableOriginalConstructor()->setMethods(['fetchResource'])->getMock(); $resourceServiceMock->expects($this->once())->method('fetchResource')->with($payment); - /** @var ResourceServiceInterface $resourceServiceMock */ $heidelpayObj = (new Heidelpay('s-priv-123'))->setResourceService($resourceServiceMock); $payment->setParentResource($heidelpayObj); diff --git a/test/unit/Services/ResourceServiceTest.php b/test/unit/Services/ResourceServiceTest.php index 5f6e0b0f..38b84aa7 100755 --- a/test/unit/Services/ResourceServiceTest.php +++ b/test/unit/Services/ResourceServiceTest.php @@ -39,7 +39,6 @@ use heidelpayPHP\Resources\Metadata; use heidelpayPHP\Resources\Payment; use heidelpayPHP\Resources\PaymentTypes\Alipay; -use heidelpayPHP\Resources\PaymentTypes\BasePaymentType; use heidelpayPHP\Resources\PaymentTypes\Card; use heidelpayPHP\Resources\PaymentTypes\EPS; use heidelpayPHP\Resources\PaymentTypes\Giropay; @@ -185,10 +184,8 @@ public function getResourceIdFromUrlShouldThrowExceptionIfTheIdCanNotBeFound($ur * @throws ReflectionException * @throws RuntimeException */ - public function fetchResourceShouldFetchIfTheResourcesIdIsSetAndItHasNotBeenFetchedBefore( - $resource, - $timesFetchIsCalled - ) { + public function fetchResourceIfTheResourcesIdIsSetAndItHasNotBeenFetchedBefore($resource, $timesFetchIsCalled) + { /** @var ResourceService|MockObject $resourceSrvMock */ $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->setMethods(['fetchResource'])->disableOriginalConstructor()->getMock(); $resourceSrvMock->expects($this->exactly($timesFetchIsCalled))->method('fetchResource')->with($resource); @@ -439,110 +436,38 @@ public function fetchResourceByUrlForAPaymentTypeShouldReturnNullIfTheTypeIsUnkn $this->assertNull($resourceSrvMock->fetchResourceByUrl('https://api.heidelpay.com/v1/types/card/s-unknown-xen2ybcovn56/')); } - // - - // - /** * Verify fetchPayment method will fetch the passed payment object. * * @test + * @dataProvider fetchShouldCallFetchResourceDP * - * @throws HeidelpayApiException - * @throws ReflectionException - * @throws RuntimeException - */ - public function fetchPaymentShouldCallFetchWithTheGivenPaymentObject() - { - $payment = (new Payment())->setId('myPaymentId'); - - /** @var ResourceService|MockObject $resourceServiceMock */ - $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->setMethods(['fetchResource'])->disableOriginalConstructor()->getMock(); - $resourceSrvMock->expects($this->once())->method('fetchResource')->with($payment); - - /** @var ResourceServiceInterface $resourceSrvMock */ - $returnedPayment = $resourceSrvMock->fetchPayment($payment); - $this->assertSame($payment, $returnedPayment); - } - - /** - * Verify fetchPayment method called with paymentId will create a payment object set its id and call fetch with it. - * - * @test - * - * @throws HeidelpayApiException - * @throws ReflectionException - * @throws RuntimeException - */ - public function fetchPaymentCalledWithIdShouldCreatePaymentObjectWithIdAndCallFetch() - { - $heidelpay = new Heidelpay('s-priv-1234'); - - /** @var ResourceService|MockObject $resourceServiceMock */ - $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->setMethods(['fetchResource'])->setConstructorArgs([$heidelpay])->getMock(); - $resourceSrvMock->expects($this->once())->method('fetchResource') - ->with($this->callback(static function ($payment) use ($heidelpay) { - return $payment instanceof Payment && - $payment->getId() === 'testPaymentId' && - $payment->getHeidelpayObject() === $heidelpay; - })); - - /** @var ResourceServiceInterface $resourceSrvMock */ - $resourceSrvMock->fetchPayment('testPaymentId'); - } - - /** - * Verify fetchPaymentByOrderId method will create a payment object set its orderId and call fetch with it. - * - * @test + * @param string $fetchMethod + * @param array $arguments + * @param mixed $callback * - * @throws HeidelpayApiException * @throws ReflectionException + * @throws \PHPUnit\Framework\Exception + * @throws \PHPUnit\Framework\MockObject\RuntimeException * @throws RuntimeException */ - public function fetchPaymentByOrderIdShouldCreatePaymentObjectWithOrderIdAndCallFetch() + public function fetchShouldCallFetchResource(string $fetchMethod, array $arguments, $callback) { $heidelpay = new Heidelpay('s-priv-1234'); /** @var ResourceService|MockObject $resourceServiceMock */ $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->setMethods(['fetchResource'])->setConstructorArgs([$heidelpay])->getMock(); - $resourceSrvMock->expects($this->once())->method('fetchResource') - ->with($this->callback(static function ($payment) use ($heidelpay) { - return $payment instanceof Payment && - $payment->getOrderId() === 'myOrderId' && - $payment->getHeidelpayObject() === $heidelpay; - })); - - /** @var ResourceServiceInterface $resourceSrvMock */ - $resourceSrvMock->fetchPaymentByOrderId('myOrderId'); - } - - // - - // - - /** - * Verify fetchKeypair will call fetch with a Keypair object. - * - * @test - * - * @throws HeidelpayApiException - * @throws ReflectionException - * @throws RuntimeException - */ - public function fetchKeypairShouldCallFetchWithAKeypairObject() - { - $heidelpay = new Heidelpay('s-priv-1234'); - - /** @var ResourceServiceInterface|MockObject $resourceServiceMock */ - $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->setMethods(['fetchResource'])->setConstructorArgs([$heidelpay])->getMock(); - $resourceSrvMock->expects($this->once())->method('fetchResource') - ->with($this->callback(static function ($keypair) use ($heidelpay) { - return $keypair instanceof Keypair && $keypair->getHeidelpayObject() === $heidelpay; - })); - - /** @var ResourceServiceInterface $resourceSrvMock */ - $resourceSrvMock->fetchKeypair(); + $resourceSrvMock->expects($this->once())->method('fetchResource')->with($this->callback( + static function ($resource) use ($callback, $heidelpay) { + /** @var AbstractHeidelpayResource $resource */ + return $callback($resource) && $resource->getHeidelpayObject() === $heidelpay; + } + )); + + /** @var AbstractHeidelpayResource $resource */ + $resource = $resourceSrvMock->$fetchMethod(...$arguments); + $this->assertEquals($heidelpay, $resource->getParentResource()); + $this->assertEquals($heidelpay, $resource->getHeidelpayObject()); } // @@ -575,36 +500,6 @@ public function createPaymentTypeShouldSetHeidelpayObjectAndCallCreate() $this->assertSame($paymentType, $returnedType); } - /** - * Verify fetchPaymentType method is creating the correct payment type instance depending on the passed id. - * - * @test - * @dataProvider paymentTypeAndIdProvider - * - * @param string $typeClass - * @param string $typeId - * - * @throws RuntimeException - * @throws ReflectionException - * @throws HeidelpayApiException - */ - public function fetchPaymentTypeShouldFetchCorrectPaymentInstanceDependingOnId($typeClass, $typeId) - { - $heidelpay = new Heidelpay('s-priv-1234'); - - $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->setMethods(['fetchResource'])->setConstructorArgs([$heidelpay])->getMock(); - $resourceSrvMock->expects($this->once())->method('fetchResource') - ->with($this->callback(static function ($type) use ($heidelpay, $typeClass, $typeId) { - /** @var BasePaymentType $type */ - return $type instanceof $typeClass && - $type->getHeidelpayObject() === $heidelpay && - $type->getId() === $typeId; - })); - - /** @var ResourceServiceInterface $resourceSrvMock */ - $resourceSrvMock->fetchPaymentType($typeId); - } - /** * Verify fetchPaymentType will throw exception if the id does not fit any type or is invalid. * @@ -787,33 +682,6 @@ public function fetchCustomerShouldCallFetchWithTheGivenCustomerAndSetHeidelpayR $this->assertSame($heidelpay, $customer->getHeidelpayObject()); } - /** - * Verify fetchCustomer will call fetch with a new Customer object if the customer is referenced by id. - * - * @test - * - * @throws HeidelpayApiException - * @throws ReflectionException - * @throws RuntimeException - */ - public function fetchCustomerShouldCallFetchWithNewCustomerObject() - { - $heidelpay = new Heidelpay('s-priv-123'); - - $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->setMethods(['fetchResource'])->setConstructorArgs([$heidelpay])->getMock(); - $resourceSrvMock->expects($this->once())->method('fetchResource')->with( - $this->callback(static function ($param) use ($heidelpay) { - return $param instanceof Customer && - $param->getId() === 'myCustomerId' && - $param->getHeidelpayObject() === $heidelpay; - })); - - /** @var ResourceServiceInterface $resourceSrvMock */ - $returnedCustomer = $resourceSrvMock->fetchCustomer('myCustomerId'); - $this->assertEquals('myCustomerId', $returnedCustomer->getId()); - $this->assertEquals($heidelpay, $returnedCustomer->getHeidelpayObject()); - } - /** * Verify updateCustomer calls update with customer object. * @@ -906,6 +774,32 @@ public function fetchAuthorizationShouldFetchPaymentAndReturnItsAuthorization() $this->assertSame($authorize, $returnedAuthorize); } + /** + * Verify fetchAuthorization will throw runtime error if the given payment does not seem to have an authorization. + * + * @test + * + * @throws HeidelpayApiException + * @throws ReflectionException + * @throws RuntimeException + * @throws \PHPUnit\Framework\Exception + * @throws \PHPUnit\Framework\MockObject\RuntimeException + */ + public function fetchAuthorizationShouldThrowExceptionIfNoAuthorizationIsPresent() + { + /** @var MockObject|ResourceService $resourceSrvMock */ + $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->disableOriginalConstructor()->setMethods(['fetchPayment'])->getMock(); + + $payment = new Payment(); + $resourceSrvMock->expects($this->once())->method('fetchPayment')->willReturn($payment); + + $this->assertNull($payment->getAuthorization()); + $this->expectException(RuntimeException::class); + $this->expectExceptionMessage('The payment does not seem to have an Authorization.'); + + $resourceSrvMock->fetchAuthorization('paymentId'); + } + // // @@ -963,6 +857,50 @@ public function fetchChargeByIdShouldFetchPaymentAndReturnTheChargeOfThePayment( $this->assertSame($charge, $returnedCharge); } + /** + * Verify fetchCharge fetches payment object and gets and returns the charge object from it. + * + * @test + * + * @throws HeidelpayApiException + * @throws ReflectionException + * @throws RuntimeException + */ + public function fetchChargeShouldFetchPaymentAndReturnTheChargeOfThePayment() + { + /** @var ResourceService|MockObject $resourceSrvMock */ + $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->setMethods(['fetchResource'])->disableOriginalConstructor()->getMock(); + $charge = (new Charge())->setId('chargeId'); + + $resourceSrvMock->expects($this->once())->method('fetchResource')->with($charge)->willReturn($charge); + + $this->assertSame($charge, $resourceSrvMock->fetchCharge($charge)); + } + + /** + * Verify fetchChargeById throws exception if the charge can not be found. + * + * @test + * + * @throws HeidelpayApiException + * @throws ReflectionException + * @throws RuntimeException + */ + public function fetchChargeByIdShouldThrowExceptionIfChargeDoesNotExist() + { + /** @var MockObject|Payment $paymentMock */ + $paymentMock = $this->getMockBuilder(Payment::class)->setMethods(['getCharge'])->getMock(); + $paymentMock->expects($this->once())->method('getCharge')->with('chargeId')->willReturn(null); + + /** @var MockObject|ResourceService $resourceSrvMock */ + $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->setMethods(['fetchPayment'])->disableOriginalConstructor()->getMock(); + $resourceSrvMock->expects($this->once())->method('fetchPayment')->with($paymentMock)->willReturn($paymentMock); + + $this->expectException(RuntimeException::class); + $this->expectExceptionMessage('The charge object could not be found.'); + $resourceSrvMock->fetchChargeById($paymentMock, 'chargeId'); + } + // // @@ -1094,25 +1032,6 @@ public function fetchShipmentShouldFetchPaymentAndReturnTheDesiredShipmentFromIt // - /** - * Verify fetchMetadata calls fetch with the given metadata object. - * - * @test - * - * @throws HeidelpayApiException - * @throws ReflectionException - * @throws RuntimeException - */ - public function fetchMetadataShouldCallFetchWithTheGivenMetadataObject() - { - /** @var ResourceServiceInterface|MockObject $resourceSrvMock */ - $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->setMethods(['fetchResource'])->disableOriginalConstructor()->getMock(); - $metadata = (new Metadata())->setId('myMetadataId'); - $resourceSrvMock->expects($this->once())->method('fetchResource')->with($metadata); - - $this->assertSame($metadata, $resourceSrvMock->fetchMetadata($metadata)); - } - /** * Verify createMetadata calls create with the given metadata object. * @@ -1132,27 +1051,6 @@ public function createMetadataShouldCallCreateWithTheGivenMetadataObject() $this->assertSame($metadata, $resourceSrvMock->createMetadata($metadata)); } - /** - * Verify fetchMetadata calls fetch with a new metadata object with the given id. - * - * @test - * - * @throws HeidelpayApiException - * @throws ReflectionException - * @throws RuntimeException - */ - public function fetchMetadataShouldCallFetchWithANewMetadataObjectWithTheGivenId() - { - /** @var ResourceServiceInterface|MockObject $resourceSrvMock */ - $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->setMethods(['fetchResource'])->disableOriginalConstructor()->getMock(); - $resourceSrvMock->expects($this->once())->method('fetchResource')->with( - $this->callback(static function ($metadata) { - return $metadata instanceof Metadata && $metadata->getId() === 's-mtd-1234'; - })); - - $resourceSrvMock->fetchMetadata('s-mtd-1234'); - } - // // @@ -1185,57 +1083,6 @@ public function createBasketShouldSetTheParentResourceAndCallCreateWithTheGivenB $this->assertSame($heidelpay, $basket->getParentResource()); } - /** - * Verify fetchBasket will create basket obj and call fetch with it if the id is given. - * - * @test - * - * @throws RuntimeException - * @throws ReflectionException - * @throws HeidelpayApiException - */ - public function fetchBasketShouldCreateBasketObjectWithGivenIdAndCallFetchWithIt() - { - $heidelpay = new Heidelpay('s-priv-123'); - /** @var ResourceServiceInterface|MockObject $resourceSrvMock */ - $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->setConstructorArgs([$heidelpay])->setMethods(['fetchResource'])->getMock(); - $resourceSrvMock->expects($this->once())->method('fetchResource')->with( - $this->callback(static function ($basket) use ($heidelpay) { - /** @var Basket $basket */ - return $basket->getId() === 'myBasketId' && $basket->getParentResource() === $heidelpay; - })); - - $basket = $resourceSrvMock->fetchBasket('myBasketId'); - - $this->assertEquals('myBasketId', $basket->getId()); - $this->assertEquals($heidelpay, $basket->getParentResource()); - $this->assertEquals($heidelpay, $basket->getHeidelpayObject()); - } - - /** - * Verify fetchBasket will call fetch with the given basket obj. - * - * @test - * - * @throws RuntimeException - * @throws ReflectionException - * @throws HeidelpayApiException - */ - public function fetchBasketShouldCallFetchWithTheGivenBasketObject() - { - $heidelpay = new Heidelpay('s-priv-123'); - /** @var ResourceServiceInterface|MockObject $resourceSrvMock */ - $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->setConstructorArgs([$heidelpay])->setMethods(['fetchResource'])->getMock(); - $basket = new Basket(); - $resourceSrvMock->expects($this->once())->method('fetchResource')->with($basket); - - $returnedBasket = $resourceSrvMock->fetchBasket($basket); - - $this->assertSame($basket, $returnedBasket); - $this->assertEquals($heidelpay, $basket->getParentResource()); - $this->assertEquals($heidelpay, $basket->getHeidelpayObject()); - } - /** * Verify updateBasket calls update with the given basket and returns it. * @@ -1381,50 +1228,6 @@ public function fetchResourceFetchCallDP(): array ]; } - /** - * Data provider for fetchPaymentTypeShouldCreateCorrectPaymentInstanceDependingOnId. - * - * @return array - */ - public function paymentTypeAndIdProvider(): array - { - return [ - 'Card sandbox' => [Card::class, 's-crd-12345678'], - 'Giropay sandbox' => [Giropay::class, 's-gro-12345678'], - 'Ideal sandbox' => [Ideal::class, 's-idl-12345678'], - 'Invoice sandbox' => [Invoice::class, 's-ivc-12345678'], - 'InvoiceGuaranteed sandbox' => [InvoiceGuaranteed::class, 's-ivg-12345678'], - 'Paypal sandbox' => [Paypal::class, 's-ppl-12345678'], - 'Prepayment sandbox' => [Prepayment::class, 's-ppy-12345678'], - 'Przelewy24 sandbox' => [Przelewy24::class, 's-p24-12345678'], - 'SepaDirectDebit sandbox' => [SepaDirectDebit::class, 's-sdd-12345678'], - 'SepaDirectDebitGuaranteed sandbox' => [SepaDirectDebitGuaranteed::class, 's-ddg-12345678'], - 'Sofort sandbox' => [Sofort::class, 's-sft-12345678'], - 'PIS sandbox' => [PIS::class, 's-pis-12345678'], - 'EPS sandbox' => [EPS::class, 's-eps-12345678'], - 'Alipay sandbox' => [Alipay::class, 's-ali-12345678'], - 'Wechatpay sandbox' => [Wechatpay::class, 's-wcp-12345678'], - 'Invoice factoring sandbox' => [InvoiceFactoring::class, 's-ivf-12345678'], - 'HirePurchaseDirectDebit sandbox' => [HirePurchaseDirectDebit::class, 's-hdd-12345678'], - 'Card production' => [Card::class, 'p-crd-12345678'], - 'Giropay production' => [Giropay::class, 'p-gro-12345678'], - 'Ideal production' => [Ideal::class, 'p-idl-12345678'], - 'Invoice production' => [Invoice::class, 'p-ivc-12345678'], - 'InvoiceGuaranteed production' => [InvoiceGuaranteed::class, 'p-ivg-12345678'], - 'Paypal production' => [Paypal::class, 'p-ppl-12345678'], - 'Prepayment production' => [Prepayment::class, 'p-ppy-12345678'], - 'Przelewy24 production' => [Przelewy24::class, 'p-p24-12345678'], - 'SepaDirectDebit production' => [SepaDirectDebit::class, 'p-sdd-12345678'], - 'SepaDirectDebitGuaranteed production' => [SepaDirectDebitGuaranteed::class, 'p-ddg-12345678'], - 'Sofort production' => [Sofort::class, 'p-sft-12345678'], - 'EPS production' => [EPS::class, 'p-eps-12345678'], - 'Alipay production' => [Alipay::class, 'p-ali-12345678'], - 'Wechatpay production' => [Wechatpay::class, 'p-wcp-12345678'], - 'Invoice factoring production' => [InvoiceFactoring::class, 'p-ivf-12345678'], - 'HirePurchaseDirectDebit production' => [HirePurchaseDirectDebit::class, 'p-hdd-12345678'] - ]; - } - /** * Data provider for fetchPaymentTypeShouldThrowExceptionOnInvalidTypeId. * @@ -1506,5 +1309,82 @@ public function sendShouldCallSendOnHttpServiceDP(): array ]; } + /** + * @return array + */ + public function fetchShouldCallFetchResourceDP(): array + { + $fetchPaymentCB = static function ($payment) { + return $payment instanceof Payment && $payment->getId() === 'myPaymentId'; + }; + $fetchPaymentByOrderIdCB = static function ($payment) { + return $payment instanceof Payment && $payment->getOrderId() === 'myOrderId'; + }; + $fetchKeypairCB = static function ($keypair) { + return $keypair instanceof Keypair; + }; + $fetchCustomerCB = static function ($customer) { + return $customer instanceof Customer && $customer->getId() === 'myCustomerId'; + }; + $fetchMetadataCB = static function ($metadata) { + return $metadata instanceof Metadata && $metadata->getId() === 's-mtd-1234'; + }; + $fetchBasketCB = static function ($basket) { + return $basket instanceof Basket && $basket->getId() === 'myBasketId'; + }; + + // generate the asserting callback function for PaymentType fetch + $getPaymentTypeCB = static function ($typeClass) { + return static function ($type) use ($typeClass) { + return $type instanceof $typeClass; + }; + }; + + return [ + 'fetchPayment' => ['fetchPayment', [(new Payment())->setId('myPaymentId')], $fetchPaymentCB], + 'fetchPayment by id' => ['fetchPayment', ['myPaymentId'], $fetchPaymentCB], + 'fetchPayment by orderId' => ['fetchPaymentByOrderId', ['myOrderId'], $fetchPaymentByOrderIdCB], + 'fetchKeypair' => ['fetchKeypair', [], $fetchKeypairCB], + 'fetchCustomer' => ['fetchCustomer', ['myCustomerId'], $fetchCustomerCB], + 'fetchMetadata by obj' => ['fetchMetadata', [(new Metadata())->setId('s-mtd-1234')], $fetchMetadataCB], + 'fetchMetadata by id' => ['fetchMetadata', ['s-mtd-1234'], $fetchMetadataCB], + 'fetchBasket by id' => ['fetchBasket', ['myBasketId'], $fetchBasketCB], + 'fetchBasket by obj' => ['fetchBasket', [(new Basket())->setId('myBasketId')], $fetchBasketCB], + 'PaymentType Card sandbox' => ['fetchPaymentType', ['s-crd-12345678'], $getPaymentTypeCB(Card::class)], + 'PaymentType Giropay sandbox' => ['fetchPaymentType', ['s-gro-12345678'], $getPaymentTypeCB(Giropay::class)], + 'PaymentType Ideal sandbox' => ['fetchPaymentType', ['s-idl-12345678'], $getPaymentTypeCB(Ideal::class)], + 'PaymentType Invoice sandbox' => ['fetchPaymentType', ['s-ivc-12345678'], $getPaymentTypeCB(Invoice::class)], + 'PaymentType InvoiceGuaranteed sandbox' => ['fetchPaymentType', ['s-ivg-12345678'], $getPaymentTypeCB(InvoiceGuaranteed::class)], + 'PaymentType Paypal sandbox' => ['fetchPaymentType', ['s-ppl-12345678'], $getPaymentTypeCB(Paypal::class)], + 'PaymentType Prepayment sandbox' => ['fetchPaymentType', ['s-ppy-12345678'], $getPaymentTypeCB(Prepayment::class)], + 'PaymentType Przelewy24 sandbox' => ['fetchPaymentType', ['s-p24-12345678'], $getPaymentTypeCB(Przelewy24::class)], + 'PaymentType SepaDirectDebit sandbox' => ['fetchPaymentType', ['s-sdd-12345678'], $getPaymentTypeCB(SepaDirectDebit::class)], + 'PaymentType SepaDirectDebitGuaranteed sandbox' => ['fetchPaymentType', ['s-ddg-12345678'], $getPaymentTypeCB(SepaDirectDebitGuaranteed::class)], + 'PaymentType Sofort sandbox' => ['fetchPaymentType', ['s-sft-12345678'], $getPaymentTypeCB(Sofort::class)], + 'PaymentType PIS sandbox' => ['fetchPaymentType', ['s-pis-12345678'], $getPaymentTypeCB(PIS::class)], + 'PaymentType EPS sandbox' => ['fetchPaymentType', ['s-eps-12345678'], $getPaymentTypeCB(EPS::class)], + 'PaymentType Alipay sandbox' => ['fetchPaymentType', ['s-ali-12345678'], $getPaymentTypeCB(Alipay::class)], + 'PaymentType Wechatpay sandbox' => ['fetchPaymentType', ['s-wcp-12345678'], $getPaymentTypeCB(Wechatpay::class)], + 'PaymentType Invoice factoring sandbox' => ['fetchPaymentType', ['s-ivf-12345678'], $getPaymentTypeCB(InvoiceFactoring::class)], + 'PaymentType HirePurchaseDirectDebit sandbox' => ['fetchPaymentType', ['s-hdd-12345678'], $getPaymentTypeCB(HirePurchaseDirectDebit::class)], + 'PaymentType Card production' => ['fetchPaymentType', ['p-crd-12345678'], $getPaymentTypeCB(Card::class)], + 'PaymentType Giropay production' => ['fetchPaymentType', ['p-gro-12345678'], $getPaymentTypeCB(Giropay::class)], + 'PaymentType Ideal production' => ['fetchPaymentType', ['p-idl-12345678'], $getPaymentTypeCB(Ideal::class)], + 'PaymentType Invoice production' => ['fetchPaymentType', ['p-ivc-12345678'], $getPaymentTypeCB(Invoice::class)], + 'PaymentType InvoiceGuaranteed production' => ['fetchPaymentType', ['p-ivg-12345678'], $getPaymentTypeCB(InvoiceGuaranteed::class)], + 'PaymentType Paypal production' => ['fetchPaymentType', ['p-ppl-12345678'], $getPaymentTypeCB(Paypal::class)], + 'PaymentType Prepayment production' => ['fetchPaymentType', ['p-ppy-12345678'], $getPaymentTypeCB(Prepayment::class)], + 'PaymentType Przelewy24 production' => ['fetchPaymentType', ['p-p24-12345678'], $getPaymentTypeCB(Przelewy24::class)], + 'PaymentType SepaDirectDebit production' => ['fetchPaymentType', ['p-sdd-12345678'], $getPaymentTypeCB(SepaDirectDebit::class)], + 'PaymentType SepaDirectDebitGuaranteed production' => ['fetchPaymentType', ['p-ddg-12345678'], $getPaymentTypeCB(SepaDirectDebitGuaranteed::class)], + 'PaymentType Sofort production' => ['fetchPaymentType', ['p-sft-12345678'], $getPaymentTypeCB(Sofort::class)], + 'PaymentType EPS production' => ['fetchPaymentType', ['p-eps-12345678'], $getPaymentTypeCB(EPS::class)], + 'PaymentType Alipay production' => ['fetchPaymentType', ['p-ali-12345678'], $getPaymentTypeCB(Alipay::class)], + 'PaymentType Wechatpay production' => ['fetchPaymentType', ['p-wcp-12345678'], $getPaymentTypeCB(Wechatpay::class)], + 'PaymentType Invoice factoring production' => ['fetchPaymentType', ['p-ivf-12345678'], $getPaymentTypeCB(InvoiceFactoring::class)], + 'PaymentType HirePurchaseDirectDebit production' => ['fetchPaymentType', ['p-hdd-12345678'], $getPaymentTypeCB(HirePurchaseDirectDebit::class)] + ]; + } + // } From f6bf1a514a43dde72ed40453782036f55b9d625e Mon Sep 17 00:00:00 2001 From: sixer1182 Date: Wed, 4 Dec 2019 09:50:44 +0100 Subject: [PATCH 049/101] [refactor] (PHPLIB-260) Cleanup: Remove unused method. --- src/Resources/AbstractHeidelpayResource.php | 8 -------- .../Resources/AbstractHeidelpayResourceTest.php | 14 +++++--------- 2 files changed, 5 insertions(+), 17 deletions(-) diff --git a/src/Resources/AbstractHeidelpayResource.php b/src/Resources/AbstractHeidelpayResource.php index e1aa6092..e4719b2f 100755 --- a/src/Resources/AbstractHeidelpayResource.php +++ b/src/Resources/AbstractHeidelpayResource.php @@ -160,14 +160,6 @@ public function setSpecialParams(array $specialParams): self return $this; } - /** - * @return array - */ - protected function getAdditionalAttributes(): array - { - return $this->additionalAttributes; - } - /** * @param array $additionalAttributes * diff --git a/test/unit/Resources/AbstractHeidelpayResourceTest.php b/test/unit/Resources/AbstractHeidelpayResourceTest.php index 58594fd2..a62e3edd 100755 --- a/test/unit/Resources/AbstractHeidelpayResourceTest.php +++ b/test/unit/Resources/AbstractHeidelpayResourceTest.php @@ -262,12 +262,8 @@ public function updateValuesShouldUpdateChildObjects() */ public function updateValuesShouldUpdateValuesFromProcessingInTheActualObject() { - $testResponse = new stdClass(); - $processing = new stdClass(); - $processing->customerId = 'processingCustomerId'; - $processing->firstname = 'processingFirstName'; - $processing->lastname = 'processingLastName'; - $testResponse->processing = $processing; + $testResponse = new stdClass(); + $testResponse->processing = (object)['customerId' => 'cst-id', 'firstname' => 'first', 'lastname' => 'last']; /** @var Customer $customer */ $customer = CustomerFactory::createCustomer('firstName', 'lastName')->setCustomerId('customerId'); @@ -276,9 +272,9 @@ public function updateValuesShouldUpdateValuesFromProcessingInTheActualObject() $this->assertEquals('lastName', $customer->getLastname()); $customer->handleResponse($testResponse); - $this->assertEquals('processingCustomerId', $customer->getCustomerId()); - $this->assertEquals('processingFirstName', $customer->getFirstname()); - $this->assertEquals('processingLastName', $customer->getLastname()); + $this->assertEquals('cst-id', $customer->getCustomerId()); + $this->assertEquals('first', $customer->getFirstname()); + $this->assertEquals('last', $customer->getLastname()); } /** From d7c0fd3dd756953e7dff0e8a20d164ef5b4ad331 Mon Sep 17 00:00:00 2001 From: sixer1182 Date: Wed, 4 Dec 2019 10:06:22 +0100 Subject: [PATCH 050/101] [refactor] (PHPLIB-260) Update changelog. --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2cb6fd4b..e4af4d2d 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,10 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a * Refactor heidelpay facade to implement service interfaces. * Move payment cancel methods to cancel service. * Cleanup doc comments. +* Refactor unit tests. + +### Remove +* Removed deprecated code. ## [1.2.5.1][1.2.5.1] From 0c32ffb182e432504e37139907742bb59a4eab43 Mon Sep 17 00:00:00 2001 From: sixer1182 Date: Wed, 4 Dec 2019 10:58:57 +0100 Subject: [PATCH 051/101] [refactor] (PHPLIB-260) Reduce complexity of cancelPayment method. --- src/Resources/Payment.php | 3 +- src/Services/CancelService.php | 107 ++++++++++++++++++++++----------- 2 files changed, 72 insertions(+), 38 deletions(-) diff --git a/src/Resources/Payment.php b/src/Resources/Payment.php index c94ccf62..01ac6832 100755 --- a/src/Resources/Payment.php +++ b/src/Resources/Payment.php @@ -475,8 +475,7 @@ public function getCancellations(): array } $authorization = $this->getAuthorization(true); - $cancellations = array_merge($authorization ? $authorization->getCancellations() : [], ...$refunds); - return $cancellations; + return array_merge($authorization ? $authorization->getCancellations() : [], ...$refunds); } /** diff --git a/src/Services/CancelService.php b/src/Services/CancelService.php index dddb88ca..4af88559 100644 --- a/src/Services/CancelService.php +++ b/src/Services/CancelService.php @@ -172,7 +172,6 @@ public function cancelPayment( float $amountNet = null, float $amountVat = null ): array { - $charges = $payment->getCharges(); $remainingToCancel = $amount; $cancelWholePayment = $remainingToCancel === null; @@ -195,42 +194,16 @@ public function cancelPayment( return $cancellations; } - /** @var Charge $charge */ - foreach ($charges as $charge) { - $cancelAmount = null; - if (!$cancelWholePayment && $remainingToCancel <= $charge->getTotalAmount()) { - $cancelAmount = $remainingToCancel; - } + $chargeCancels = $this->cancelPaymentCharges( + $payment, + $reasonCode, + $referenceText, + $amountNet, + $amountVat, + $remainingToCancel + ); - try { - $cancellation = $charge->cancel($cancelAmount, $reasonCode, $referenceText, $amountNet, $amountVat); - } catch (HeidelpayApiException $e) { - $allowedErrors = [ - ApiResponseCodes::API_ERROR_ALREADY_CANCELLED, - ApiResponseCodes::API_ERROR_ALREADY_CHARGED, - ApiResponseCodes::API_ERROR_ALREADY_CHARGED_BACK - ]; - - if (!in_array($e->getCode(), $allowedErrors, true)) { - throw $e; - } - continue; - } - - if ($cancellation instanceof Cancellation) { - $cancellations[] = $cancellation; - if (!$cancelWholePayment) { - $remainingToCancel -= $cancellation->getAmount(); - } - $cancellation = null; - } - - if (!$cancelWholePayment && $remainingToCancel <= 0) { - break; - } - } - - return $cancellations; + return array_merge($cancellations, $chargeCancels); } /** @@ -281,4 +254,66 @@ public function cancelPaymentAuthorization(Payment $payment, float $amount = nul return $cancellation; } + + /** + * @param Payment $payment + * @param string $reasonCode + * @param string $referenceText + * @param float $amountNet + * @param float $amountVat + * @param float $remainingToCancel + * + * @return array + * + * @throws HeidelpayApiException + * @throws RuntimeException + */ + public function cancelPaymentCharges( + Payment $payment, + $reasonCode, + $referenceText, + $amountNet, + $amountVat, + float $remainingToCancel = null + ): array { + $cancellations = []; + $cancelWholePayment = $remainingToCancel === null; + + /** @var Charge $charge */ + foreach ($payment->getCharges() as $charge) { + $cancelAmount = null; + if (!$cancelWholePayment && $remainingToCancel <= $charge->getTotalAmount()) { + $cancelAmount = $remainingToCancel; + } + + try { + $cancellation = $charge->cancel($cancelAmount, $reasonCode, $referenceText, $amountNet, $amountVat); + } catch (HeidelpayApiException $e) { + $allowedErrors = [ + ApiResponseCodes::API_ERROR_ALREADY_CANCELLED, + ApiResponseCodes::API_ERROR_ALREADY_CHARGED, + ApiResponseCodes::API_ERROR_ALREADY_CHARGED_BACK + ]; + + if (!in_array($e->getCode(), $allowedErrors, true)) { + throw $e; + } + continue; + } + + if ($cancellation instanceof Cancellation) { + $cancellations[] = $cancellation; + if (!$cancelWholePayment) { + $remainingToCancel -= $cancellation->getAmount(); + } + $cancellation = null; + } + + // stop if the amount has already been cancelled + if (!$cancelWholePayment && $remainingToCancel <= 0) { + break; + } + } + return $cancellations; + } } From d79fbd161bef60eb2c65bb232f48732c9d25837f Mon Sep 17 00:00:00 2001 From: sixer1182 Date: Wed, 4 Dec 2019 14:54:40 +0100 Subject: [PATCH 052/101] [refactor] (PHPLIB-268) Rename ambiguous argument. --- src/Heidelpay.php | 4 +-- src/Interfaces/PaymentServiceInterface.php | 30 +++++++++---------- src/Resources/EmbeddedResources/Message.php | 4 +-- src/Resources/PaymentTypes/Paypage.php | 5 +++- .../AbstractTransactionType.php | 2 +- src/Resources/TransactionTypes/Charge.php | 6 ++-- src/Resources/TransactionTypes/Payout.php | 6 ++-- src/Services/PaymentService.php | 4 +-- 8 files changed, 32 insertions(+), 29 deletions(-) diff --git a/src/Heidelpay.php b/src/Heidelpay.php index 07e40c5d..7f8381d3 100755 --- a/src/Heidelpay.php +++ b/src/Heidelpay.php @@ -687,7 +687,7 @@ public function authorize( $basket = null, $card3ds = null, $invoiceId = null, - $paymentReference = null + $referenceText = null ): Authorization { return $this->paymentService->authorize( $amount, @@ -700,7 +700,7 @@ public function authorize( $basket, $card3ds, $invoiceId, - $paymentReference + $referenceText ); } diff --git a/src/Interfaces/PaymentServiceInterface.php b/src/Interfaces/PaymentServiceInterface.php index 242489a3..e53126ac 100644 --- a/src/Interfaces/PaymentServiceInterface.php +++ b/src/Interfaces/PaymentServiceInterface.php @@ -45,20 +45,20 @@ interface PaymentServiceInterface /** * Performs an Authorization transaction and returns the resulting Authorization resource. * - * @param float $amount The amount to authorize. - * @param string $currency The currency of the amount. - * @param string|BasePaymentType $paymentType The PaymentType object or the id of the PaymentType to use. - * @param string $returnUrl The URL used to return to the shop if the process requires leaving it. - * @param Customer|string|null $customer The Customer object or the id of the customer resource to reference. - * @param string|null $orderId A custom order id which can be set by the merchant. - * @param Metadata|null $metadata The Metadata object containing custom information for the payment. - * @param Basket|null $basket The Basket object corresponding to the payment. - * The Basket object will be created automatically if it does not exist - * yet (i.e. has no id). - * @param bool|null $card3ds Enables 3ds channel for credit cards if available. This parameter is - * optional and will be ignored if not applicable. - * @param string|null $invoiceId The external id of the invoice. - * @param string|null $paymentReference A reference text for the payment. + * @param float $amount The amount to authorize. + * @param string $currency The currency of the amount. + * @param string|BasePaymentType $paymentType The PaymentType object or the id of the PaymentType to use. + * @param string $returnUrl The URL used to return to the shop if the process requires leaving it. + * @param Customer|string|null $customer The Customer object or the id of the customer resource to reference. + * @param string|null $orderId A custom order id which can be set by the merchant. + * @param Metadata|null $metadata The Metadata object containing custom information for the payment. + * @param Basket|null $basket The Basket object corresponding to the payment. + * The Basket object will be created automatically if it does not exist + * yet (i.e. has no id). + * @param bool|null $card3ds Enables 3ds channel for credit cards if available. This parameter is + * optional and will be ignored if not applicable. + * @param string|null $invoiceId The external id of the invoice. + * @param string|null $referenceText A reference text for the payment. * * @return Authorization The resulting object of the Authorization resource. * @@ -76,7 +76,7 @@ public function authorize( $basket = null, $card3ds = null, $invoiceId = null, - $paymentReference = null + $referenceText = null ): Authorization; /** diff --git a/src/Resources/EmbeddedResources/Message.php b/src/Resources/EmbeddedResources/Message.php index 0ea439d7..3599c7e5 100755 --- a/src/Resources/EmbeddedResources/Message.php +++ b/src/Resources/EmbeddedResources/Message.php @@ -49,7 +49,7 @@ public function getCode(): string * * @return Message */ - public function setCode(string $code): Message + protected function setCode(string $code): Message { $this->code = $code; return $this; @@ -68,7 +68,7 @@ public function getCustomer(): string * * @return Message */ - public function setCustomer(string $customer): Message + protected function setCustomer(string $customer): Message { $this->customer = $customer; return $this; diff --git a/src/Resources/PaymentTypes/Paypage.php b/src/Resources/PaymentTypes/Paypage.php index 903b104d..fe679692 100644 --- a/src/Resources/PaymentTypes/Paypage.php +++ b/src/Resources/PaymentTypes/Paypage.php @@ -452,12 +452,15 @@ public function getRedirectUrl() * @param string $redirectUrl * * @return Paypage + * + * @throws HeidelpayApiException + * @throws RuntimeException */ public function setRedirectUrl(string $redirectUrl): Paypage { $payment = $this->getPayment(); if ($payment instanceof Payment) { - $payment->setRedirectUrl($redirectUrl); + $payment->handleResponse((object)['redirectUrl' => $redirectUrl]); } return $this; } diff --git a/src/Resources/TransactionTypes/AbstractTransactionType.php b/src/Resources/TransactionTypes/AbstractTransactionType.php index e98528d0..6bbbb0a8 100755 --- a/src/Resources/TransactionTypes/AbstractTransactionType.php +++ b/src/Resources/TransactionTypes/AbstractTransactionType.php @@ -168,7 +168,7 @@ public function handleResponse(stdClass $response, $method = HttpAdapterInterfac } if (isset($response->redirectUrl)) { - $payment->setRedirectUrl($response->redirectUrl); + $payment->handleResponse((object)['redirectUrl' => $response->redirectUrl]); } if ($method !== HttpAdapterInterface::REQUEST_GET) { diff --git a/src/Resources/TransactionTypes/Charge.php b/src/Resources/TransactionTypes/Charge.php index c88389ea..1a0f3ae9 100755 --- a/src/Resources/TransactionTypes/Charge.php +++ b/src/Resources/TransactionTypes/Charge.php @@ -255,13 +255,13 @@ public function getPaymentReference() } /** - * @param string|null $paymentReference + * @param string|null $referenceText * * @return Charge */ - public function setPaymentReference($paymentReference): Charge + public function setPaymentReference($referenceText): Charge { - $this->paymentReference = $paymentReference; + $this->paymentReference = $referenceText; return $this; } diff --git a/src/Resources/TransactionTypes/Payout.php b/src/Resources/TransactionTypes/Payout.php index 38f19fa7..b3f8ee16 100644 --- a/src/Resources/TransactionTypes/Payout.php +++ b/src/Resources/TransactionTypes/Payout.php @@ -126,13 +126,13 @@ public function getPaymentReference() } /** - * @param $paymentReference + * @param $referenceText * * @return Payout */ - public function setPaymentReference($paymentReference): Payout + public function setPaymentReference($referenceText): Payout { - $this->paymentReference = $paymentReference; + $this->paymentReference = $referenceText; return $this; } diff --git a/src/Services/PaymentService.php b/src/Services/PaymentService.php index 91cd8386..fd15bdc4 100755 --- a/src/Services/PaymentService.php +++ b/src/Services/PaymentService.php @@ -108,7 +108,7 @@ public function authorize( $basket = null, $card3ds = null, $invoiceId = null, - $paymentReference = null + $referenceText = null ): Authorization { $payment = $this->createPayment($paymentType); $paymentType = $payment->getPaymentType(); @@ -117,7 +117,7 @@ public function authorize( $authorization = (new Authorization($amount, $currency, $returnUrl)) ->setOrderId($orderId) ->setInvoiceId($invoiceId) - ->setPaymentReference($paymentReference) + ->setPaymentReference($referenceText) ->setSpecialParams($paymentType !== null ? $paymentType->getTransactionParams() : []); if ($card3ds !== null) { $authorization->setCard3ds($card3ds); From 745558103f13db21edfd26114638d0bbd0360ed3 Mon Sep 17 00:00:00 2001 From: sixer1182 Date: Wed, 4 Dec 2019 14:59:05 +0100 Subject: [PATCH 053/101] [refactor] (PHPLIB-268) Several minor changes. --- src/Resources/Payment.php | 4 ++-- src/Resources/Recurring.php | 12 ++++++------ test/BasePaymentTest.php | 3 +-- test/unit/Resources/RecurringTest.php | 1 - 4 files changed, 9 insertions(+), 11 deletions(-) diff --git a/src/Resources/Payment.php b/src/Resources/Payment.php index 01ac6832..35cb57e2 100755 --- a/src/Resources/Payment.php +++ b/src/Resources/Payment.php @@ -107,11 +107,11 @@ public function getRedirectUrl() /** * Sets the redirectUrl via response from API. * - * @param string $redirectUrl + * @param string|null $redirectUrl * * @return Payment */ - public function setRedirectUrl(string $redirectUrl): Payment + public function setRedirectUrl($redirectUrl): Payment { $this->redirectUrl = $redirectUrl; return $this; diff --git a/src/Resources/Recurring.php b/src/Resources/Recurring.php index 1cf285f9..80817cf3 100644 --- a/src/Resources/Recurring.php +++ b/src/Resources/Recurring.php @@ -24,14 +24,10 @@ */ namespace heidelpayPHP\Resources; -use heidelpayPHP\Traits\HasStates; -use heidelpayPHP\Traits\HasUniqueAndShortId; +use heidelpayPHP\Resources\TransactionTypes\AbstractTransactionType; -class Recurring extends AbstractHeidelpayResource +class Recurring extends AbstractTransactionType { - use HasStates; - use HasUniqueAndShortId; - /** @var string $returnUrl */ protected $returnUrl; @@ -47,6 +43,7 @@ class Recurring extends AbstractHeidelpayResource */ public function __construct(string $paymentType, string $returnUrl) { + parent::__construct(); $this->returnUrl = $returnUrl; $this->paymentTypeId = $paymentType; } @@ -114,6 +111,9 @@ public function setRedirectUrl(string $redirectUrl): Recurring // + /** + * {@inheritDoc} + */ protected function getResourcePath(): string { $parts = [ diff --git a/test/BasePaymentTest.php b/test/BasePaymentTest.php index d0cce3dd..e91d8476 100755 --- a/test/BasePaymentTest.php +++ b/test/BasePaymentTest.php @@ -241,8 +241,7 @@ public function createCardAuthorization($amount = 100.0): Authorization { $card = $this->heidelpay->createPaymentType($this->createCardObject()); $orderId = microtime(true); - $authorization = $this->heidelpay->authorize($amount, 'EUR', $card, self::RETURN_URL, null, $orderId, null, null, false); - return $authorization; + return $this->heidelpay->authorize($amount, 'EUR', $card, self::RETURN_URL, null, $orderId, null, null, false); } /** diff --git a/test/unit/Resources/RecurringTest.php b/test/unit/Resources/RecurringTest.php index dcc920fb..2c62c62d 100644 --- a/test/unit/Resources/RecurringTest.php +++ b/test/unit/Resources/RecurringTest.php @@ -48,7 +48,6 @@ public function gettersAndSettersShouldWorkAsExpected() $recurring->setRedirectUrl('different redirect url'); $this->assertEquals('different redirect url', $recurring->getRedirectUrl()); - $recurring->setPaymentTypeId('another type id'); $this->assertEquals('another type id', $recurring->getPaymentTypeId()); From 358313a37c0579b1586ccf825931b5133a10fe98 Mon Sep 17 00:00:00 2001 From: sixer1182 Date: Wed, 4 Dec 2019 16:25:41 +0100 Subject: [PATCH 054/101] [refactor] (PHPLIB-268) Several minor changes. --- test/unit/Resources/EmbeddedResources/AmountTest.php | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/test/unit/Resources/EmbeddedResources/AmountTest.php b/test/unit/Resources/EmbeddedResources/AmountTest.php index 2b94e4e1..bf3edd84 100755 --- a/test/unit/Resources/EmbeddedResources/AmountTest.php +++ b/test/unit/Resources/EmbeddedResources/AmountTest.php @@ -47,11 +47,8 @@ public function settersAndGettersShouldWork() $this->assertEquals(0.0, $amount->getCharged()); $this->assertEquals(0.0, $amount->getRemaining()); - $amount->setTotal(1.1); - $amount->setCanceled(2.2); - $amount->setCharged(3.3); - $amount->setRemaining(4.4); - $amount->setCurrency('MyCurrency'); + $resp = ['total' => 1.1, 'canceled' => 2.2, 'charged' => 3.3, 'remaining' => 4.4, 'currency' => 'MyCurrency']; + $amount->handleResponse((object)$resp); $this->assertEquals('MyCurrency', $amount->getCurrency()); $this->assertEquals(1.1, $amount->getTotal()); From c15c30d64e74c60a2032904000c32594cbae86a4 Mon Sep 17 00:00:00 2001 From: sixer1182 Date: Wed, 4 Dec 2019 16:29:47 +0100 Subject: [PATCH 055/101] [refactor] (PHPLIB-268) Change method access modifier to protected when they should not be visible to the merchant. --- src/Resources/EmbeddedResources/Amount.php | 10 +++++----- src/Resources/Payment.php | 6 +++--- src/Resources/Recurring.php | 2 +- test/unit/Resources/PaymentTest.php | 4 ++-- test/unit/Resources/RecurringTest.php | 10 ++++++++-- .../TransactionTypes/AbstractTransactionTypeTest.php | 4 +++- test/unit/Services/CancelServiceTest.php | 9 ++++++--- 7 files changed, 28 insertions(+), 17 deletions(-) diff --git a/src/Resources/EmbeddedResources/Amount.php b/src/Resources/EmbeddedResources/Amount.php index de39bbfc..559dfbc7 100755 --- a/src/Resources/EmbeddedResources/Amount.php +++ b/src/Resources/EmbeddedResources/Amount.php @@ -51,7 +51,7 @@ public function getTotal(): float * * @return $this */ - public function setTotal(float $total): self + protected function setTotal(float $total): self { $this->total = $total; return $this; @@ -70,7 +70,7 @@ public function getCharged(): float * * @return $this */ - public function setCharged(float $charged): self + protected function setCharged(float $charged): self { $this->charged = $charged; return $this; @@ -89,7 +89,7 @@ public function getCanceled(): float * * @return self */ - public function setCanceled(float $canceled): self + protected function setCanceled(float $canceled): self { $this->canceled = $canceled; return $this; @@ -108,7 +108,7 @@ public function getRemaining(): float * * @return self */ - public function setRemaining(float $remaining): self + protected function setRemaining(float $remaining): self { $this->remaining = $remaining; return $this; @@ -127,7 +127,7 @@ public function getCurrency() * * @return self */ - public function setCurrency(string $currency): self + protected function setCurrency(string $currency): self { $this->currency = $currency; return $this; diff --git a/src/Resources/Payment.php b/src/Resources/Payment.php index 35cb57e2..8e5bab2e 100755 --- a/src/Resources/Payment.php +++ b/src/Resources/Payment.php @@ -111,7 +111,7 @@ public function getRedirectUrl() * * @return Payment */ - public function setRedirectUrl($redirectUrl): Payment + protected function setRedirectUrl($redirectUrl): Payment { $this->redirectUrl = $redirectUrl; return $this; @@ -571,9 +571,9 @@ public function getCurrency(): string * * @return self */ - public function setCurrency(string $currency): self + protected function setCurrency(string $currency): self { - $this->amount->setCurrency($currency); + $this->amount->handleResponse((object)['currency' => $currency]); return $this; } diff --git a/src/Resources/Recurring.php b/src/Resources/Recurring.php index 80817cf3..9e7a0778 100644 --- a/src/Resources/Recurring.php +++ b/src/Resources/Recurring.php @@ -101,7 +101,7 @@ public function getRedirectUrl(): string * * @return Recurring */ - public function setRedirectUrl(string $redirectUrl): Recurring + protected function setRedirectUrl(string $redirectUrl): Recurring { $this->redirectUrl = $redirectUrl; return $this; diff --git a/test/unit/Resources/PaymentTest.php b/test/unit/Resources/PaymentTest.php index 0398cd06..b3564701 100755 --- a/test/unit/Resources/PaymentTest.php +++ b/test/unit/Resources/PaymentTest.php @@ -65,7 +65,7 @@ public function gettersAndSettersShouldWorkProperly() /** @noinspection UnnecessaryAssertionInspection */ $this->assertInstanceOf(Amount::class, $payment->getAmount()); - $payment->setRedirectUrl('https://my-redirect-url.test'); + $payment->handleResponse((object)['redirectUrl' => 'https://my-redirect-url.test']); $this->assertEquals('https://my-redirect-url.test', $payment->getRedirectUrl()); $authorize = new Authorization(); @@ -643,7 +643,7 @@ public function getAndSetCurrencyShouldPropagateToTheAmountObject() /** @var Amount $amountMock */ $payment->setAmount($amountMock); - $payment->setCurrency('MyTestSetCurrency'); + $amountMock->handleResponse((object) ['currency' => 'MyTestSetCurrency']); $this->assertEquals('MyTestGetCurrency', $payment->getCurrency()); } diff --git a/test/unit/Resources/RecurringTest.php b/test/unit/Resources/RecurringTest.php index 2c62c62d..498a0223 100644 --- a/test/unit/Resources/RecurringTest.php +++ b/test/unit/Resources/RecurringTest.php @@ -24,9 +24,12 @@ */ namespace heidelpayPHP\test\unit\Resources; +use heidelpayPHP\Exceptions\HeidelpayApiException; +use heidelpayPHP\Resources\Payment; use heidelpayPHP\Resources\Recurring; use heidelpayPHP\test\BasePaymentTest; use PHPUnit\Framework\Exception; +use RuntimeException; class RecurringTest extends BasePaymentTest { @@ -36,16 +39,19 @@ class RecurringTest extends BasePaymentTest * @test * * @throws Exception + * @throws RuntimeException + * @throws HeidelpayApiException */ public function gettersAndSettersShouldWorkAsExpected() { $recurring = new Recurring('payment type id', $this::RETURN_URL); + $recurring->setPayment(new Payment()); $this->assertEquals('payment type id', $recurring->getPaymentTypeId()); $this->assertEquals($this::RETURN_URL, $recurring->getReturnUrl()); - $recurring->setRedirectUrl('redirect url'); + $recurring->handleResponse((object)['redirectUrl' => 'redirect url']); $this->assertEquals('redirect url', $recurring->getRedirectUrl()); - $recurring->setRedirectUrl('different redirect url'); + $recurring->handleResponse((object)['redirectUrl' => 'different redirect url']); $this->assertEquals('different redirect url', $recurring->getRedirectUrl()); $recurring->setPaymentTypeId('another type id'); diff --git a/test/unit/Resources/TransactionTypes/AbstractTransactionTypeTest.php b/test/unit/Resources/TransactionTypes/AbstractTransactionTypeTest.php index b8810287..7be4217b 100755 --- a/test/unit/Resources/TransactionTypes/AbstractTransactionTypeTest.php +++ b/test/unit/Resources/TransactionTypes/AbstractTransactionTypeTest.php @@ -71,7 +71,9 @@ public function theGettersAndSettersShouldWorkProperly() $transactionType->setPayment($payment); $transactionType->setDate($date); $transactionType->setIsError(true)->setIsPending(true)->setIsSuccess(true); - $transactionType->getMessage()->setCode('1234')->setCustomer('This ist the customer message!'); + $transactionType->getMessage()->handleResponse( + (object)['code' => '1234', 'customer' => 'This ist the customer message!'] + ); $this->assertSame($payment, $transactionType->getPayment()); $this->assertEquals($date, $transactionType->getDate()); diff --git a/test/unit/Services/CancelServiceTest.php b/test/unit/Services/CancelServiceTest.php index 664ef39a..1bc83536 100644 --- a/test/unit/Services/CancelServiceTest.php +++ b/test/unit/Services/CancelServiceTest.php @@ -221,7 +221,9 @@ public function cancelAuthorizationAmountShouldCallCancelWithTheRemainingAmountA /** @var Payment|MockObject $paymentMock */ $paymentMock = $this->getMockBuilder(Payment::class)->setMethods(['getAuthorization', 'getAmount'])->getMock(); - $paymentMock->method('getAmount')->willReturn((new Amount())->setRemaining(100.0)); + $amountObj = new Amount(); + $amountObj->handleResponse((object)['remaining' => 100.0]); + $paymentMock->method('getAmount')->willReturn($amountObj); $paymentMock->expects($this->exactly(4))->method('getAuthorization')->willReturn($authorizationMock); $paymentMock->setParentResource($this->heidelpay); @@ -258,7 +260,7 @@ public function verifyAllowedErrorsWillBeIgnoredDuringAuthorizeCancel($exception $exception = new HeidelpayApiException(null, null, $exceptionCode); $authMock->method('cancel')->willThrowException($exception); $paymentMock->method('getAuthorization')->willReturn($authMock); - $paymentMock->getAmount()->setRemaining(100.0); + $paymentMock->getAmount()->handleResponse((object)['remaining' => 100.0]); $paymentMock->setParentResource($this->heidelpay); try { @@ -286,7 +288,8 @@ public function cancelAuthorizationAmountWillNotCallCancelIfThereIsNoOpenAmount( $authMock = $this->getMockBuilder(Authorization::class)->setMethods(['cancel'])->disableOriginalConstructor()->getMock(); $paymentMock->method('getAuthorization')->willReturn($authMock); $authMock->expects(self::never())->method('cancel'); - $paymentMock->getAmount()->setRemaining(0.0); + $paymentMock->getAmount()->handleResponse((object)['remaining' => 0.0]); + $paymentMock->setParentResource($this->heidelpay); $paymentMock->cancelAuthorizationAmount(12.3); From 398ca6fd2eb72b755d588c5f133dc1c926f90977 Mon Sep 17 00:00:00 2001 From: sixer1182 Date: Wed, 4 Dec 2019 16:38:32 +0100 Subject: [PATCH 056/101] [refactor] (PHPLIB-268) Several minor changes. --- test/unit/Resources/PaymentTest.php | 49 ++++++++++++++--------------- 1 file changed, 24 insertions(+), 25 deletions(-) diff --git a/test/unit/Resources/PaymentTest.php b/test/unit/Resources/PaymentTest.php index b3564701..e2d2b339 100755 --- a/test/unit/Resources/PaymentTest.php +++ b/test/unit/Resources/PaymentTest.php @@ -43,6 +43,7 @@ use heidelpayPHP\Services\ResourceService; use heidelpayPHP\test\BasePaymentTest; use PHPUnit\Framework\Exception; +use PHPUnit\Framework\MockObject\MockObject; use ReflectionException; use RuntimeException; use stdClass; @@ -632,18 +633,17 @@ public function getShipmentByIdShouldReturnShipmentIfItExistsAndFetchItIfNotLazy * @throws Exception * @throws RuntimeException * @throws ReflectionException + * @throws HeidelpayApiException */ public function getAndSetCurrencyShouldPropagateToTheAmountObject() { + /** @var Amount|MockObject $amountMock */ $amountMock = $this->getMockBuilder(Amount::class)->setMethods(['getCurrency', 'setCurrency'])->getMock(); $amountMock->expects($this->once())->method('getCurrency')->willReturn('MyTestGetCurrency'); $amountMock->expects($this->once())->method('setCurrency')->with('MyTestSetCurrency'); - $payment = new Payment(); - /** @var Amount $amountMock */ - $payment->setAmount($amountMock); - - $amountMock->handleResponse((object) ['currency' => 'MyTestSetCurrency']); + $payment = (new Payment())->setAmount($amountMock); + $payment->handleResponse((object) ['currency' => 'MyTestSetCurrency']); $this->assertEquals('MyTestGetCurrency', $payment->getCurrency()); } @@ -1308,16 +1308,15 @@ public function handleResponseShouldAddPayoutFromResponseIfItDoesNotExists() public function chargeMethodShouldPropagateToHeidelpayChargePaymentMethod() { $payment = new Payment(); - $heidelpayMock = $this->getMockBuilder(Heidelpay::class)->disableOriginalConstructor() - ->setMethods(['chargePayment'])->getMock(); + + /** @var Heidelpay|MockObject $heidelpayMock */ + $heidelpayMock = $this->getMockBuilder(Heidelpay::class)->disableOriginalConstructor()->setMethods(['chargePayment'])->getMock(); $heidelpayMock->expects($this->exactly(3))->method('chargePayment') ->withConsecutive( [$payment, null, null], [$payment, 1.1, null], [$payment, 2.2, 'MyCurrency'] )->willReturn(new Charge()); - - /** @var Heidelpay $heidelpayMock */ $payment->setParentResource($heidelpayMock); $payment->charge(); @@ -1337,13 +1336,12 @@ public function chargeMethodShouldPropagateToHeidelpayChargePaymentMethod() public function shipMethodShouldPropagateToHeidelpayChargePaymentMethod() { $payment = new Payment(); - $heidelpayMock = $this->getMockBuilder(Heidelpay::class)->disableOriginalConstructor() - ->setMethods(['ship'])->getMock(); + + /** @var Heidelpay|MockObject $heidelpayMock */ + $heidelpayMock = $this->getMockBuilder(Heidelpay::class)->disableOriginalConstructor()->setMethods(['ship'])->getMock(); $heidelpayMock->expects($this->once())->method('ship')->willReturn(new Shipment()); - /** @var Heidelpay $heidelpayMock */ $payment->setParentResource($heidelpayMock); - $payment->ship(); } @@ -1360,10 +1358,10 @@ public function setMetaDataShouldSetParentResourceAndCreateMetaDataObject() { $metadata = (new Metadata())->addMetadata('myData', 'myValue'); + /** @var ResourceService|MockObject $resourceSrvMock */ $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->setMethods(['createResource'])->disableOriginalConstructor()->getMock(); $resourceSrvMock->expects($this->once())->method('createResource')->with($metadata); - /** @var ResourceServiceInterface $resourceSrvMock */ $heidelpay = (new Heidelpay('s-priv-1234'))->setResourceService($resourceSrvMock); $payment = new Payment($heidelpay); @@ -1391,9 +1389,10 @@ public function setMetaDataShouldSetParentResourceAndCreateMetaDataObject() public function metadataMustBeOfTypeMetadata() { $metadata = new Metadata(); + + /** @var ResourceService|MockObject $resourceSrvMock */ $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->setMethods(['createResource'])->disableOriginalConstructor()->getMock(); $resourceSrvMock->expects($this->once())->method('createResource')->with($metadata); - /** @var ResourceServiceInterface $resourceSrvMock */ $heidelpay = (new Heidelpay('s-priv-1234'))->setResourceService($resourceSrvMock); // when @@ -1428,9 +1427,9 @@ public function metadataMustBeOfTypeMetadata() public function setBasketShouldCallCreateIfTheGivenBasketObjectDoesNotExistYet() { $heidelpay = new Heidelpay('s-priv-123'); - $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->setConstructorArgs([$heidelpay])->setMethods(['createResource'])->getMock(); - /** @var ResourceServiceInterface $resourceSrvMock */ + /** @var ResourceService|MockObject $resourceSrvMock */ + $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->setConstructorArgs([$heidelpay])->setMethods(['createResource'])->getMock(); $heidelpay->setResourceService($resourceSrvMock); $basket = new Basket(); @@ -1458,11 +1457,11 @@ static function ($object) use ($basket, $heidelpay) { public function setBasketWontCallResourceServiceWhenBasketIsNull() { $heidelpay = new Heidelpay('s-priv-123'); - $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->setConstructorArgs([$heidelpay])->setMethods(['createResource'])->getMock(); - /** @var ResourceServiceInterface $resourceSrvMock */ - $heidelpay->setResourceService($resourceSrvMock); + /** @var ResourceService|MockObject $resourceSrvMock */ + $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->setConstructorArgs([$heidelpay])->setMethods(['createResource'])->getMock(); $resourceSrvMock->expects($this->once())->method('createResource'); + $heidelpay->setResourceService($resourceSrvMock); // set basket first to prove the setter works both times $basket = new Basket(); @@ -1485,8 +1484,8 @@ public function setBasketWontCallResourceServiceWhenBasketIsNull() */ public function updateResponseResourcesShouldFetchBasketIdIfItIsSetInResponse() { - $heidelpayMock = $this->getMockBuilder(Heidelpay::class)->disableOriginalConstructor() - ->setMethods(['fetchBasket'])->getMock(); + /** @var Heidelpay|MockObject $heidelpayMock */ + $heidelpayMock = $this->getMockBuilder(Heidelpay::class)->disableOriginalConstructor()->setMethods(['fetchBasket'])->getMock(); $basket = new Basket(); $heidelpayMock->expects($this->once())->method('fetchBasket')->with('myResourcesBasketId')->willReturn($basket); @@ -1510,9 +1509,9 @@ public function updateResponseResourcesShouldFetchBasketIdIfItIsSetInResponse() */ public function paymentShouldBeFetchedByOrderIdIfIdIsNotSet() { - $orderId = str_replace(' ', '', microtime()); - $payment = (new Payment())->setOrderId($orderId)->setParentResource(new Heidelpay('s-priv-123')); - $lastElement = explode('/', rtrim($payment->getUri(), '/')); + $orderId = str_replace(' ', '', microtime()); + $payment = (new Payment())->setOrderId($orderId)->setParentResource(new Heidelpay('s-priv-123')); + $lastElement = explode('/', rtrim($payment->getUri(), '/')); $this->assertEquals($orderId, end($lastElement)); } From 36751f6a02828dd144adae5538ea2503b069f6b4 Mon Sep 17 00:00:00 2001 From: sixer1182 Date: Thu, 5 Dec 2019 12:23:36 +0100 Subject: [PATCH 057/101] [refactor] (PHPLIB-268) Change setters of traits to protected. --- src/Traits/HasPaymentState.php | 2 +- src/Traits/HasStates.php | 6 +++--- .../TransactionTypes/AbstractTransactionTypeTest.php | 8 +++----- test/unit/Traits/HasCancellationsTest.php | 2 +- test/unit/Traits/HasPaymentStateTest.php | 2 +- .../Traits/TraitDummyHasCancellationsHasPaymentState.php | 3 ++- 6 files changed, 11 insertions(+), 12 deletions(-) diff --git a/src/Traits/HasPaymentState.php b/src/Traits/HasPaymentState.php index 18abebc2..224a1718 100755 --- a/src/Traits/HasPaymentState.php +++ b/src/Traits/HasPaymentState.php @@ -127,7 +127,7 @@ public function getStateName(): string * * @return self */ - public function setState(int $state): self + protected function setState(int $state): self { $this->state = $state; return $this; diff --git a/src/Traits/HasStates.php b/src/Traits/HasStates.php index 50f2b493..3bcd194b 100644 --- a/src/Traits/HasStates.php +++ b/src/Traits/HasStates.php @@ -50,7 +50,7 @@ public function isError(): bool * * @return self */ - public function setIsError(bool $isError): self + protected function setIsError(bool $isError): self { $this->isError = $isError; return $this; @@ -69,7 +69,7 @@ public function isSuccess(): bool * * @return self */ - public function setIsSuccess(bool $isSuccess): self + protected function setIsSuccess(bool $isSuccess): self { $this->isSuccess = $isSuccess; return $this; @@ -88,7 +88,7 @@ public function isPending(): bool * * @return self */ - public function setIsPending(bool $isPending): self + protected function setIsPending(bool $isPending): self { $this->isPending = $isPending; return $this; diff --git a/test/unit/Resources/TransactionTypes/AbstractTransactionTypeTest.php b/test/unit/Resources/TransactionTypes/AbstractTransactionTypeTest.php index 7be4217b..e20db429 100755 --- a/test/unit/Resources/TransactionTypes/AbstractTransactionTypeTest.php +++ b/test/unit/Resources/TransactionTypes/AbstractTransactionTypeTest.php @@ -70,10 +70,8 @@ public function theGettersAndSettersShouldWorkProperly() $date = (new DateTime('now'))->format('Y-m-d h:i:s'); $transactionType->setPayment($payment); $transactionType->setDate($date); - $transactionType->setIsError(true)->setIsPending(true)->setIsSuccess(true); - $transactionType->getMessage()->handleResponse( - (object)['code' => '1234', 'customer' => 'This ist the customer message!'] - ); + $transactionType->handleResponse((object)['isError' => true, 'isPending' => true, 'isSuccess' => true]); + $transactionType->getMessage()->handleResponse((object)['code' => '1234', 'customer' => 'Customer message!']); $this->assertSame($payment, $transactionType->getPayment()); $this->assertEquals($date, $transactionType->getDate()); @@ -85,7 +83,7 @@ public function theGettersAndSettersShouldWorkProperly() $message = $transactionType->getMessage(); $this->assertSame('1234', $message->getCode()); - $this->assertSame('This ist the customer message!', $message->getCustomer()); + $this->assertSame('Customer message!', $message->getCustomer()); } /** diff --git a/test/unit/Traits/HasCancellationsTest.php b/test/unit/Traits/HasCancellationsTest.php index 07fff25b..02bb82c7 100755 --- a/test/unit/Traits/HasCancellationsTest.php +++ b/test/unit/Traits/HasCancellationsTest.php @@ -59,7 +59,7 @@ public function hasCancellationGettersAndSettersShouldWorkProperly() $this->assertArraySubset([$cancellation1, $cancellation2, $cancellation3], $dummy->getCancellations()); // assert getCancellation - $this->assertSame($cancellation3, $dummy->getCancellation('3')); + $this->assertSame($cancellation3, $dummy->getCancellation('3', true)); // assert setCancellations $cancellation4 = (new Cancellation())->setId('4'); diff --git a/test/unit/Traits/HasPaymentStateTest.php b/test/unit/Traits/HasPaymentStateTest.php index 9b0a6b83..3cfb5504 100755 --- a/test/unit/Traits/HasPaymentStateTest.php +++ b/test/unit/Traits/HasPaymentStateTest.php @@ -67,7 +67,7 @@ public function gettersAndSettersShouldWorkProperly( $this->assertFalse($traitDummy->isPaymentReview()); $this->assertFalse($traitDummy->isChargeBack()); - $traitDummy->setState($state); + $traitDummy->handleResponse((object)['state' => $state]); $this->assertEquals($state, $traitDummy->getState()); $this->assertEquals($stateName, $traitDummy->getStateName()); $this->assertEquals($pending, $traitDummy->isPending()); diff --git a/test/unit/Traits/TraitDummyHasCancellationsHasPaymentState.php b/test/unit/Traits/TraitDummyHasCancellationsHasPaymentState.php index 92d6cbbe..d6db0a2b 100755 --- a/test/unit/Traits/TraitDummyHasCancellationsHasPaymentState.php +++ b/test/unit/Traits/TraitDummyHasCancellationsHasPaymentState.php @@ -24,10 +24,11 @@ */ namespace heidelpayPHP\test\unit\Traits; +use heidelpayPHP\Resources\AbstractHeidelpayResource; use heidelpayPHP\Traits\HasCancellations; use heidelpayPHP\Traits\HasPaymentState; -class TraitDummyHasCancellationsHasPaymentState +class TraitDummyHasCancellationsHasPaymentState extends AbstractHeidelpayResource { use HasCancellations; use HasPaymentState; From ec692c141a8647f1cab315c83bced2661aee6ac4 Mon Sep 17 00:00:00 2001 From: sixer1182 Date: Thu, 5 Dec 2019 12:31:50 +0100 Subject: [PATCH 058/101] [refactor] (PHPLIB-268) Fix several minor issues. --- src/Services/CancelService.php | 1 + test/BasePaymentTest.php | 3 +-- test/integration/PaymentTypes/Przelewy24Test.php | 4 +--- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/Services/CancelService.php b/src/Services/CancelService.php index 4af88559..2703453a 100644 --- a/src/Services/CancelService.php +++ b/src/Services/CancelService.php @@ -34,6 +34,7 @@ use heidelpayPHP\Resources\TransactionTypes\Cancellation; use heidelpayPHP\Resources\TransactionTypes\Charge; use RuntimeException; +use function in_array; class CancelService implements CancelServiceInterface { diff --git a/test/BasePaymentTest.php b/test/BasePaymentTest.php index e91d8476..96712da6 100755 --- a/test/BasePaymentTest.php +++ b/test/BasePaymentTest.php @@ -257,8 +257,7 @@ public function createPaypalAuthorization(): Authorization /** @var Paypal $paypal */ $paypal = $this->heidelpay->createPaymentType(new Paypal()); $orderId = microtime(true); - $authorization = $this->heidelpay->authorize(100.0, 'EUR', $paypal, self::RETURN_URL, null, $orderId, null, null, false); - return $authorization; + return $this->heidelpay->authorize(100.0, 'EUR', $paypal, self::RETURN_URL, null, $orderId, null, null, false); } /** diff --git a/test/integration/PaymentTypes/Przelewy24Test.php b/test/integration/PaymentTypes/Przelewy24Test.php index 12b5cd4e..af1756ed 100755 --- a/test/integration/PaymentTypes/Przelewy24Test.php +++ b/test/integration/PaymentTypes/Przelewy24Test.php @@ -128,13 +128,11 @@ public function przelewy24ShouldThrowExceptionIfCurrencyIsNotSupported($currency */ public function przelewy24CurrencyCodeProvider(): array { - $currencyArray = [ + return [ 'EUR' => ['EUR'], 'US Dollar'=> ['USD'], 'Swiss Franc' => ['CHF'] ]; - - return $currencyArray; } // From 70908f17d574f14e1c031ae3e63c5b88ce7bd546 Mon Sep 17 00:00:00 2001 From: sixer1182 Date: Thu, 5 Dec 2019 12:52:01 +0100 Subject: [PATCH 059/101] [refactor] (PHPLIB-268) Refactor access modifiers. --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index e4af4d2d..7664696b 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a * Move payment cancel methods to cancel service. * Cleanup doc comments. * Refactor unit tests. +* Refactor access modifiers of setters intended for system access only. ### Remove * Removed deprecated code. From 4482fba3a7bf074a2f8cea8401cf1fe6cc3e782a Mon Sep 17 00:00:00 2001 From: sixer1182 Date: Thu, 12 Dec 2019 15:29:12 +0100 Subject: [PATCH 060/101] [refactor] (PHPLIB-269) Minor fixes. --- .travis.yml | 10 +++++----- CHANGELOG.md | 3 +++ 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index 04d36f62..2c574d6a 100755 --- a/.travis.yml +++ b/.travis.yml @@ -13,6 +13,11 @@ matrix: 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: @@ -43,11 +48,6 @@ matrix: env: - DEPS=HIGH - LEVEL=UNIT - - name: "php 7.3 (install) - integration" - php: 7.3 - env: - - DEPS=HIGH - - LEVEL=INTEGRATION cache: directories: - $HOME/.composer/cache diff --git a/CHANGELOG.md b/CHANGELOG.md index f725ebdf..fef68d50 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,9 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a * A bug which led to an error when trying to cancel the initial transaction of a charged invoice. * Several minor issues. +### Changed +* Refactor travis config. + ## [1.2.5.0][1.2.5.0] ### Added From 13ae6119ee7e9fd0f2134712fe294102a8228337 Mon Sep 17 00:00:00 2001 From: sixer1182 Date: Thu, 12 Dec 2019 17:16:37 +0100 Subject: [PATCH 061/101] [refactor] (PHPLIB-274) Minor fixes. --- CHANGELOG.md | 1 - 1 file changed, 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 64112b3c..fef68d50 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -345,4 +345,3 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a [1.2.4.0]: https://github.com/heidelpay/heidelpayPHP/compare/1.2.3.0..1.2.4.0 [1.2.5.0]: https://github.com/heidelpay/heidelpayPHP/compare/1.2.4.0..1.2.5.0 [1.2.6.0]: https://github.com/heidelpay/heidelpayPHP/compare/1.2.5.0..1.2.6.0 -[1.3.0.0]: https://github.com/heidelpay/heidelpayPHP/compare/1.2.5.1..1.3.0.0 From abddd29259cfa87e43b3239a720dd7e5bbf020b2 Mon Sep 17 00:00:00 2001 From: sixer1182 Date: Thu, 12 Dec 2019 17:27:51 +0100 Subject: [PATCH 062/101] [refactor] (PHPLIB-274) Re-add deprecated code previously removed. --- src/Constants/ApiResponseCodes.php | 14 +++ src/Resources/Basket.php | 24 ++++ src/Resources/Customer.php | 12 +- src/Resources/Payment.php | 84 ++++++++++++++ test/unit/Resources/BasketTest.php | 18 +++ test/unit/Resources/PaymentCancelTest.php | 134 ++++++++++++++++++++++ 6 files changed, 285 insertions(+), 1 deletion(-) diff --git a/src/Constants/ApiResponseCodes.php b/src/Constants/ApiResponseCodes.php index fd3689b2..3dbf4601 100755 --- a/src/Constants/ApiResponseCodes.php +++ b/src/Constants/ApiResponseCodes.php @@ -45,7 +45,17 @@ class ApiResponseCodes const API_ERROR_IVF_REQUIRES_BASKET = 'API.330.100.023'; const API_ERROR_ADDRESSES_DO_NOT_MATCH = 'API.330.100.106'; const API_ERROR_CURRENCY_IS_NOT_SUPPORTED = 'API.330.100.202'; + /** + * @deprecated since 1.2.3.0 + * @see ApiResponseCodes::API_ERROR_ALREADY_CANCELLED + */ + const API_ERROR_AUTHORIZE_ALREADY_CANCELLED = 'API.340.100.014'; const API_ERROR_ALREADY_CANCELLED = 'API.340.100.014'; + /** + * @deprecated since 1.2.3.0 + * @see ApiResponseCodes::API_ERROR_ALREADY_CHARGED_BACK + */ + const API_ERROR_CHARGE_ALREADY_CHARGED_BACK = 'API.340.100.015'; const API_ERROR_ALREADY_CHARGED_BACK = 'API.340.100.015'; const API_ERROR_ALREADY_CHARGED = 'API.340.100.018'; const API_ERROR_CANCEL_REASON_CODE_IS_MISSING = 'API.340.100.024'; @@ -58,6 +68,10 @@ class ApiResponseCodes const API_ERROR_WEBHOOK_EVENT_ALREADY_REGISTERED = 'API.510.310.009'; const API_ERROR_WEBHOOK_CAN_NOT_BE_FOUND = 'API.510.310.008'; const API_ERROR_BASKET_ITEM_IMAGE_INVALID_URL = 'API.600.630.004'; + /** + * @deprecated since 1.2.5.0 Will be removed in next major version. + */ + const API_ERROR_BASKET_ITEM_IMAGE_INVALID_EXTENSION = 'API.600.630.005'; const API_ERROR_INVALID_KEY = 'API.710.000.002'; const API_ERROR_INSUFFICIENT_PERMISSION = 'API.710.000.005'; const API_ERROR_WRONG_AUTHENTICATION_METHOD = 'API.710.000.007'; diff --git a/src/Resources/Basket.php b/src/Resources/Basket.php index 9d348e69..b96c41ba 100755 --- a/src/Resources/Basket.php +++ b/src/Resources/Basket.php @@ -93,6 +93,30 @@ public function setAmountTotalGross(float $amountTotalGross): Basket return $this; } + /** + * @return float + * + * @deprecated since 1.2.0.0 + * @see Basket::getAmountTotalGross() + */ + public function getAmountTotal(): float + { + return $this->getAmountTotalGross(); + } + + /** + * @param float $amountTotal + * + * @return Basket + * + * @deprecated since 1.2.0.0 + * @see Basket::setAmountTotalGross() + */ + public function setAmountTotal(float $amountTotal): Basket + { + return $this->setAmountTotalGross($amountTotal); + } + /** * @return float */ diff --git a/src/Resources/Customer.php b/src/Resources/Customer.php index aab3dae1..6ebd728e 100755 --- a/src/Resources/Customer.php +++ b/src/Resources/Customer.php @@ -75,9 +75,19 @@ class Customer extends AbstractHeidelpayResource /** * Customer constructor. + * + * @param string|null $firstname + * @param string|null $lastname + * + * @deprecated since Version 1.1.5.0 + * @see CustomerFactory::createCustomer() + * @see CustomerFactory::createNotRegisteredB2bCustomer() + * @see CustomerFactory::createRegisteredB2bCustomer() */ - public function __construct() + public function __construct(string $firstname = null, string $lastname = null) { + $this->firstname = $firstname; + $this->lastname = $lastname; $this->billingAddress = new Address(); $this->shippingAddress = new Address(); $this->geoLocation = new GeoLocation(); diff --git a/src/Resources/Payment.php b/src/Resources/Payment.php index 6b77757b..901dbbd3 100755 --- a/src/Resources/Payment.php +++ b/src/Resources/Payment.php @@ -627,6 +627,33 @@ public function getExternalId() // + /** + * Performs a Cancellation transaction on the Payment. + * If no amount is given a full cancel will be performed i. e. all Charges and Authorizations will be cancelled. + * + * @param float|null $amount The amount to canceled. + * @param string $reason + * + * @return Cancellation|null The resulting Cancellation object. + * If more then one cancellation is performed the last one will be returned. + * + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * + * @deprecated since 1.2.3.0 + * @see Payment::cancelAmount() + */ + public function cancel($amount = null, $reason = CancelReasonCodes::REASON_CODE_CANCEL) + { + $cancellations = $this->cancelAmount($amount, $reason); + + if (count($cancellations) > 0) { + return $cancellations[0]; + } + + throw new RuntimeException('This Payment could not be cancelled.'); + } + /** * Performs a Cancellation transaction on the Payment. * If no amount is given a full cancel will be performed i. e. all Charges and Authorizations will be cancelled. @@ -711,6 +738,63 @@ public function cancelAmount( return $cancellations; } + /** + * Cancels all charges of the payment and returns an array of the cancellations and exceptions that occur. + * + * @return array + * + * @throws HeidelpayApiException + * @throws RuntimeException + * + * @deprecated since 1.2.3.0 + * @see Payment::cancelAmount() + */ + public function cancelAllCharges(): array + { + $cancels = []; + $exceptions = []; + + /** @var Charge $charge */ + foreach ($this->getCharges() as $charge) { + try { + $cancels[] = $charge->cancel(); + } catch (HeidelpayApiException $e) { + $allowedErrors = [ + ApiResponseCodes::API_ERROR_ALREADY_CHARGED_BACK, + ApiResponseCodes::API_ERROR_ALREADY_CANCELLED + ]; + if (!in_array($e->getCode(), $allowedErrors, true)) { + throw $e; + } + $exceptions[] = $e; + } + } + return array($cancels, $exceptions); + } + + /** + * @param float|null $amount + * + * @return array + * + * @throws HeidelpayApiException + * @throws RuntimeException + * + * @deprecated since 1.2.3.0 + * @see Payment::cancelAuthorizationAmount() + */ + public function cancelAuthorization($amount = null): array + { + $cancels = []; + $cancel = $this->cancelAuthorizationAmount($amount); + + if ($cancel instanceof Cancellation) { + $cancels[] = $cancel; + } + + return array($cancels, []); + } + /** * Cancel the given amount of the payments authorization. * diff --git a/test/unit/Resources/BasketTest.php b/test/unit/Resources/BasketTest.php index 0abe0c3c..1533561f 100755 --- a/test/unit/Resources/BasketTest.php +++ b/test/unit/Resources/BasketTest.php @@ -168,4 +168,22 @@ public function referenceIdShouldBeAutomaticallySetToTheArrayIndexIfItIsNotSet() $this->assertEquals('0', $basketItem3->getBasketItemReferenceId()); $this->assertEquals('1', $basketItem4->getBasketItemReferenceId()); } + + /** + * Verify amount total is replaced by amount total gross. + * + * @test + * + * @throws Exception + * @deprecated since 1.2.6.0 + */ + public function amountTotalSetterGetterAccessAmountTotalGross() + { + $basket = new Basket(); + $this->assertEquals($basket->getAmountTotalGross(), $basket->getAmountTotal()); + $basket->setAmountTotalGross(123.45); + $this->assertEquals($basket->getAmountTotalGross(), $basket->getAmountTotal()); + $basket->setAmountTotal(45.321); + $this->assertEquals($basket->getAmountTotalGross(), $basket->getAmountTotal()); + } } diff --git a/test/unit/Resources/PaymentCancelTest.php b/test/unit/Resources/PaymentCancelTest.php index 347216ad..e7be6e71 100644 --- a/test/unit/Resources/PaymentCancelTest.php +++ b/test/unit/Resources/PaymentCancelTest.php @@ -40,6 +40,140 @@ class PaymentCancelTest extends BasePaymentTest { + // + + /** + * Verify payment:cancel calls cancelAllCharges and cancelAuthorizationAmount and returns first charge cancellation + * object. + * + * @test + * + * @throws HeidelpayApiException + * @throws ReflectionException + * @throws RuntimeException + * + * @deprecated since 1.2.3.0 + */ + public function cancelShouldCallCancelAllChargesAndCancelAuthorizationAndReturnFirstChargeCancellationObject() + { + $paymentMock = $this->getMockBuilder(Payment::class)->setMethods(['cancelAmount'])->getMock(); + $cancellation = new Cancellation(1.0); + $paymentMock->expects($this->once())->method('cancelAmount')->willReturn([$cancellation]); + + /** @var Payment $paymentMock */ + $this->assertSame($cancellation, $paymentMock->cancel()); + } + + /** + * Verify payment:cancel throws Exception if no cancellation and no auth existed to be cancelled. + * + * @test + * + * @throws ReflectionException + * @throws RuntimeException + * @throws HeidelpayApiException + * + * @deprecated since 1.2.3.0 + */ + public function cancelShouldThrowExceptionIfNoTransactionExistsToBeCancelled() + { + $paymentMock = $this->getMockBuilder(Payment::class)->setMethods(['cancelAllCharges', 'cancelAuthorization'])->getMock(); + + $this->expectException(RuntimeException::class); + $this->expectExceptionMessage('This Payment could not be cancelled.'); + + /** @var Payment $paymentMock */ + $paymentMock->cancel(); + } + + /** + * Verify cancel all charges will call cancel on each existing charge of the payment and will return a list of + * cancels and exceptions. + * + * @test + * + * @throws HeidelpayApiException + * @throws ReflectionException + * @throws RuntimeException + * + * @deprecated since 1.2.3.0 + */ + public function cancelAllChargesShouldCallCancelOnAllChargesAndReturnCancelsAndExceptions() + { + $cancellation1 = new Cancellation(1.0); + $cancellation2 = new Cancellation(2.0); + $cancellation3 = new Cancellation(3.0); + $exception1 = new HeidelpayApiException('', '', ApiResponseCodes::API_ERROR_ALREADY_CHARGED_BACK); + $exception2 = new HeidelpayApiException('', '', ApiResponseCodes::API_ERROR_ALREADY_CHARGED_BACK); + + $chargeMock1 = $this->getMockBuilder(Charge::class)->setMethods(['cancel'])->getMock(); + $chargeMock1->expects($this->once())->method('cancel')->willReturn($cancellation1); + + $chargeMock2 = $this->getMockBuilder(Charge::class)->setMethods(['cancel'])->getMock(); + $chargeMock2->expects($this->once())->method('cancel')->willThrowException($exception1); + + $chargeMock3 = $this->getMockBuilder(Charge::class)->setMethods(['cancel'])->getMock(); + $chargeMock3->expects($this->once())->method('cancel')->willReturn($cancellation2); + + $chargeMock4 = $this->getMockBuilder(Charge::class)->setMethods(['cancel'])->getMock(); + $chargeMock4->expects($this->once())->method('cancel')->willThrowException($exception2); + + $chargeMock5 = $this->getMockBuilder(Charge::class)->setMethods(['cancel'])->getMock(); + $chargeMock5->expects($this->once())->method('cancel')->willReturn($cancellation3); + + /** + * @var Charge $chargeMock1 + * @var Charge $chargeMock2 + * @var Charge $chargeMock3 + * @var Charge $chargeMock4 + * @var Charge $chargeMock5 + */ + $payment = new Payment(); + $payment->addCharge($chargeMock1)->addCharge($chargeMock2)->addCharge($chargeMock3)->addCharge($chargeMock4)->addCharge($chargeMock5); + + list($cancellations, $exceptions) = $payment->cancelAllCharges(); + $this->assertArraySubset([$cancellation1, $cancellation2, $cancellation3], $cancellations); + $this->assertArraySubset([$exception1, $exception2], $exceptions); + } + + /** + * Verify cancelAllCharges will throw any exception with Code different to + * ApiResponseCodes::API_ERROR_CHARGE_ALREADY_CANCELED. + * + * @test + * + * @throws ReflectionException + * @throws RuntimeException + * + * @deprecated since 1.2.3.0 + */ + public function cancelAllChargesShouldThrowChargeCancelExceptionsOtherThanAlreadyCharged() + { + $ex1 = new HeidelpayApiException('', '', ApiResponseCodes::API_ERROR_ALREADY_CHARGED_BACK); + $ex2 = new HeidelpayApiException('', '', ApiResponseCodes::API_ERROR_CHARGED_AMOUNT_HIGHER_THAN_EXPECTED); + + $chargeMock1 = $this->getMockBuilder(Charge::class)->setMethods(['cancel'])->getMock(); + $chargeMock1->expects($this->once())->method('cancel')->willThrowException($ex1); + + $chargeMock2 = $this->getMockBuilder(Charge::class)->setMethods(['cancel'])->getMock(); + $chargeMock2->expects($this->once())->method('cancel')->willThrowException($ex2); + + /** + * @var Charge $chargeMock1 + * @var Charge $chargeMock2 + */ + $payment = (new Payment())->addCharge($chargeMock1)->addCharge($chargeMock2); + + try { + $payment->cancelAllCharges(); + $this->assertFalse(true, 'The expected exception has not been thrown.'); + } catch (HeidelpayApiException $e) { + $this->assertSame($ex2, $e); + } + } + + // + /** * Verify cancelAmount will call cancelAuthorizationAmount with the amountToCancel. * When cancelAmount is <= the value of the cancellation it Will return auth cancellation only. From 4daf3efb34e19302546c6632d2514aa114e7d6c2 Mon Sep 17 00:00:00 2001 From: sixer1182 Date: Thu, 12 Dec 2019 17:28:05 +0100 Subject: [PATCH 063/101] [refactor] (PHPLIB-274) Minor fix. --- examples/CardRecurring/ReturnController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/CardRecurring/ReturnController.php b/examples/CardRecurring/ReturnController.php index d52ac604..db2e960b 100644 --- a/examples/CardRecurring/ReturnController.php +++ b/examples/CardRecurring/ReturnController.php @@ -66,7 +66,7 @@ function redirect($url, $merchantMessage = '', $clientMessage = '') $paymentType = $heidelpay->fetchPaymentType($paymentTypeId); if ($paymentType->isRecurring()) { - redirect(SUCCESS_URL); + redirect(SUCCESS_URL); } } catch (HeidelpayApiException $e) { From 73742540d998e535e5ec5899fb4c9a63a2470795 Mon Sep 17 00:00:00 2001 From: sixer1182 Date: Thu, 12 Dec 2019 17:31:31 +0100 Subject: [PATCH 064/101] [refactor] (PHPLIB-274) Minor fix. --- test/unit/Resources/BasketTest.php | 1 + 1 file changed, 1 insertion(+) diff --git a/test/unit/Resources/BasketTest.php b/test/unit/Resources/BasketTest.php index 1533561f..3ee04815 100755 --- a/test/unit/Resources/BasketTest.php +++ b/test/unit/Resources/BasketTest.php @@ -175,6 +175,7 @@ public function referenceIdShouldBeAutomaticallySetToTheArrayIndexIfItIsNotSet() * @test * * @throws Exception + * * @deprecated since 1.2.6.0 */ public function amountTotalSetterGetterAccessAmountTotalGross() From ca2753c3e72e3eea982a155e2b43ad965f621356 Mon Sep 17 00:00:00 2001 From: sixer1182 Date: Fri, 13 Dec 2019 09:53:16 +0100 Subject: [PATCH 065/101] [refactor] (PHPLIB-274) Minor fix. --- src/Heidelpay.php | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/src/Heidelpay.php b/src/Heidelpay.php index 6388b5b4..d6bd5da0 100755 --- a/src/Heidelpay.php +++ b/src/Heidelpay.php @@ -43,6 +43,7 @@ use heidelpayPHP\Resources\PaymentTypes\BasePaymentType; use heidelpayPHP\Resources\PaymentTypes\Paypage; use heidelpayPHP\Resources\Recurring; +use heidelpayPHP\Resources\TransactionTypes\AbstractTransactionType; use heidelpayPHP\Resources\TransactionTypes\Authorization; use heidelpayPHP\Resources\TransactionTypes\Cancellation; use heidelpayPHP\Resources\TransactionTypes\Charge; @@ -938,18 +939,18 @@ public function authorize( /** * Performs an Authorization transaction using a Payment object and returns the resulting Authorization resource. * - * @param float $amount The amount to authorize. - * @param string $currency The currency of the amount. - * @param Payment $payment The Payment object to create the Authorization for. - * @param string $returnUrl The URL used to return to the shop if the process requires leaving it. - * @param Customer|string|null $customer The Customer object or the id of the customer resource to reference. - * @param string|null $orderId A custom order id which can be set by the merchant. - * @param Metadata|null $metadata The Metadata object containing custom information for the payment. - * @param Basket|null $basket The Basket object corresponding to the payment. + * @param float $amount The amount to authorize. + * @param string $currency The currency of the amount. + * @param Payment $payment The Payment object to create the Authorization for. + * @param string $returnUrl The URL used to return to the shop if the process requires leaving it. + * @param Customer|string|null $customer The Customer object or the id of the customer resource to reference. + * @param string|null $orderId A custom order id which can be set by the merchant. + * @param Metadata|null $metadata The Metadata object containing custom information for the payment. + * @param Basket|null $basket The Basket object corresponding to the payment. * The Basket object will be created automatically if it does not exist * yet (i.e. has no id). * - * @return Authorization The resulting object of the Authorization resource. + * @return AbstractTransactionType The resulting object of the Authorization resource. * * @deprecated since 1.2.6.0 */ From 9080ef59ca8f10d882738286c3f006afa86df731 Mon Sep 17 00:00:00 2001 From: sixer1182 Date: Fri, 13 Dec 2019 11:09:31 +0100 Subject: [PATCH 066/101] [refactor] (PHPLIB-274) Re-add deprecated code. --- src/Constants/ApiResponseCodes.php | 14 +++ src/Resources/Basket.php | 24 ++++ src/Resources/Customer.php | 12 +- src/Resources/Payment.php | 86 ++++++++++++++ test/unit/Resources/BasketTest.php | 19 +++ test/unit/Resources/PaymentCancelTest.php | 134 ++++++++++++++++++++++ 6 files changed, 288 insertions(+), 1 deletion(-) diff --git a/src/Constants/ApiResponseCodes.php b/src/Constants/ApiResponseCodes.php index fd3689b2..3dbf4601 100755 --- a/src/Constants/ApiResponseCodes.php +++ b/src/Constants/ApiResponseCodes.php @@ -45,7 +45,17 @@ class ApiResponseCodes const API_ERROR_IVF_REQUIRES_BASKET = 'API.330.100.023'; const API_ERROR_ADDRESSES_DO_NOT_MATCH = 'API.330.100.106'; const API_ERROR_CURRENCY_IS_NOT_SUPPORTED = 'API.330.100.202'; + /** + * @deprecated since 1.2.3.0 + * @see ApiResponseCodes::API_ERROR_ALREADY_CANCELLED + */ + const API_ERROR_AUTHORIZE_ALREADY_CANCELLED = 'API.340.100.014'; const API_ERROR_ALREADY_CANCELLED = 'API.340.100.014'; + /** + * @deprecated since 1.2.3.0 + * @see ApiResponseCodes::API_ERROR_ALREADY_CHARGED_BACK + */ + const API_ERROR_CHARGE_ALREADY_CHARGED_BACK = 'API.340.100.015'; const API_ERROR_ALREADY_CHARGED_BACK = 'API.340.100.015'; const API_ERROR_ALREADY_CHARGED = 'API.340.100.018'; const API_ERROR_CANCEL_REASON_CODE_IS_MISSING = 'API.340.100.024'; @@ -58,6 +68,10 @@ class ApiResponseCodes const API_ERROR_WEBHOOK_EVENT_ALREADY_REGISTERED = 'API.510.310.009'; const API_ERROR_WEBHOOK_CAN_NOT_BE_FOUND = 'API.510.310.008'; const API_ERROR_BASKET_ITEM_IMAGE_INVALID_URL = 'API.600.630.004'; + /** + * @deprecated since 1.2.5.0 Will be removed in next major version. + */ + const API_ERROR_BASKET_ITEM_IMAGE_INVALID_EXTENSION = 'API.600.630.005'; const API_ERROR_INVALID_KEY = 'API.710.000.002'; const API_ERROR_INSUFFICIENT_PERMISSION = 'API.710.000.005'; const API_ERROR_WRONG_AUTHENTICATION_METHOD = 'API.710.000.007'; diff --git a/src/Resources/Basket.php b/src/Resources/Basket.php index 9d348e69..b96c41ba 100755 --- a/src/Resources/Basket.php +++ b/src/Resources/Basket.php @@ -93,6 +93,30 @@ public function setAmountTotalGross(float $amountTotalGross): Basket return $this; } + /** + * @return float + * + * @deprecated since 1.2.0.0 + * @see Basket::getAmountTotalGross() + */ + public function getAmountTotal(): float + { + return $this->getAmountTotalGross(); + } + + /** + * @param float $amountTotal + * + * @return Basket + * + * @deprecated since 1.2.0.0 + * @see Basket::setAmountTotalGross() + */ + public function setAmountTotal(float $amountTotal): Basket + { + return $this->setAmountTotalGross($amountTotal); + } + /** * @return float */ diff --git a/src/Resources/Customer.php b/src/Resources/Customer.php index 371c51ae..59c29650 100755 --- a/src/Resources/Customer.php +++ b/src/Resources/Customer.php @@ -77,9 +77,19 @@ class Customer extends AbstractHeidelpayResource /** * Customer constructor. + * + * @param string|null $firstname + * @param string|null $lastname + * + * @deprecated since Version 1.1.5.0 + * @see CustomerFactory::createCustomer() + * @see CustomerFactory::createNotRegisteredB2bCustomer() + * @see CustomerFactory::createRegisteredB2bCustomer() */ - public function __construct() + public function __construct(string $firstname = null, string $lastname = null) { + $this->firstname = $firstname; + $this->lastname = $lastname; $this->billingAddress = new Address(); $this->shippingAddress = new Address(); $this->geoLocation = new GeoLocation(); diff --git a/src/Resources/Payment.php b/src/Resources/Payment.php index abfe20d2..ae0d3dd9 100755 --- a/src/Resources/Payment.php +++ b/src/Resources/Payment.php @@ -45,6 +45,8 @@ use heidelpayPHP\Traits\HasPaymentState; use RuntimeException; use stdClass; + +use function count; use function in_array; use function is_string; @@ -627,6 +629,33 @@ public function getExternalId() // + /** + * Performs a Cancellation transaction on the Payment. + * If no amount is given a full cancel will be performed i. e. all Charges and Authorizations will be cancelled. + * + * @param float|null $amount The amount to canceled. + * @param string $reason + * + * @return Cancellation|null The resulting Cancellation object. + * If more then one cancellation is performed the last one will be returned. + * + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. + * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * + * @deprecated since 1.2.3.0 + * @see Payment::cancelAmount() + */ + public function cancel($amount = null, $reason = CancelReasonCodes::REASON_CODE_CANCEL) + { + $cancellations = $this->cancelAmount($amount, $reason); + + if (count($cancellations) > 0) { + return $cancellations[0]; + } + + throw new RuntimeException('This Payment could not be cancelled.'); + } + /** * Performs a Cancellation transaction on the Payment. * If no amount is given a full cancel will be performed i. e. all Charges and Authorizations will be cancelled. @@ -711,6 +740,63 @@ public function cancelAmount( return $cancellations; } + /** + * Cancels all charges of the payment and returns an array of the cancellations and exceptions that occur. + * + * @return array + * + * @throws HeidelpayApiException + * @throws RuntimeException + * + * @deprecated since 1.2.3.0 + * @see Payment::cancelAmount() + */ + public function cancelAllCharges(): array + { + $cancels = []; + $exceptions = []; + + /** @var Charge $charge */ + foreach ($this->getCharges() as $charge) { + try { + $cancels[] = $charge->cancel(); + } catch (HeidelpayApiException $e) { + $allowedErrors = [ + ApiResponseCodes::API_ERROR_ALREADY_CHARGED_BACK, + ApiResponseCodes::API_ERROR_ALREADY_CANCELLED + ]; + if (!in_array($e->getCode(), $allowedErrors, true)) { + throw $e; + } + $exceptions[] = $e; + } + } + return array($cancels, $exceptions); + } + + /** + * @param float|null $amount + * + * @return array + * + * @throws HeidelpayApiException + * @throws RuntimeException + * + * @deprecated since 1.2.3.0 + * @see Payment::cancelAuthorizationAmount() + */ + public function cancelAuthorization($amount = null): array + { + $cancels = []; + $cancel = $this->cancelAuthorizationAmount($amount); + + if ($cancel instanceof Cancellation) { + $cancels[] = $cancel; + } + + return array($cancels, []); + } + /** * Cancel the given amount of the payments authorization. * diff --git a/test/unit/Resources/BasketTest.php b/test/unit/Resources/BasketTest.php index 0abe0c3c..3ee04815 100755 --- a/test/unit/Resources/BasketTest.php +++ b/test/unit/Resources/BasketTest.php @@ -168,4 +168,23 @@ public function referenceIdShouldBeAutomaticallySetToTheArrayIndexIfItIsNotSet() $this->assertEquals('0', $basketItem3->getBasketItemReferenceId()); $this->assertEquals('1', $basketItem4->getBasketItemReferenceId()); } + + /** + * Verify amount total is replaced by amount total gross. + * + * @test + * + * @throws Exception + * + * @deprecated since 1.2.6.0 + */ + public function amountTotalSetterGetterAccessAmountTotalGross() + { + $basket = new Basket(); + $this->assertEquals($basket->getAmountTotalGross(), $basket->getAmountTotal()); + $basket->setAmountTotalGross(123.45); + $this->assertEquals($basket->getAmountTotalGross(), $basket->getAmountTotal()); + $basket->setAmountTotal(45.321); + $this->assertEquals($basket->getAmountTotalGross(), $basket->getAmountTotal()); + } } diff --git a/test/unit/Resources/PaymentCancelTest.php b/test/unit/Resources/PaymentCancelTest.php index 347216ad..e7be6e71 100644 --- a/test/unit/Resources/PaymentCancelTest.php +++ b/test/unit/Resources/PaymentCancelTest.php @@ -40,6 +40,140 @@ class PaymentCancelTest extends BasePaymentTest { + // + + /** + * Verify payment:cancel calls cancelAllCharges and cancelAuthorizationAmount and returns first charge cancellation + * object. + * + * @test + * + * @throws HeidelpayApiException + * @throws ReflectionException + * @throws RuntimeException + * + * @deprecated since 1.2.3.0 + */ + public function cancelShouldCallCancelAllChargesAndCancelAuthorizationAndReturnFirstChargeCancellationObject() + { + $paymentMock = $this->getMockBuilder(Payment::class)->setMethods(['cancelAmount'])->getMock(); + $cancellation = new Cancellation(1.0); + $paymentMock->expects($this->once())->method('cancelAmount')->willReturn([$cancellation]); + + /** @var Payment $paymentMock */ + $this->assertSame($cancellation, $paymentMock->cancel()); + } + + /** + * Verify payment:cancel throws Exception if no cancellation and no auth existed to be cancelled. + * + * @test + * + * @throws ReflectionException + * @throws RuntimeException + * @throws HeidelpayApiException + * + * @deprecated since 1.2.3.0 + */ + public function cancelShouldThrowExceptionIfNoTransactionExistsToBeCancelled() + { + $paymentMock = $this->getMockBuilder(Payment::class)->setMethods(['cancelAllCharges', 'cancelAuthorization'])->getMock(); + + $this->expectException(RuntimeException::class); + $this->expectExceptionMessage('This Payment could not be cancelled.'); + + /** @var Payment $paymentMock */ + $paymentMock->cancel(); + } + + /** + * Verify cancel all charges will call cancel on each existing charge of the payment and will return a list of + * cancels and exceptions. + * + * @test + * + * @throws HeidelpayApiException + * @throws ReflectionException + * @throws RuntimeException + * + * @deprecated since 1.2.3.0 + */ + public function cancelAllChargesShouldCallCancelOnAllChargesAndReturnCancelsAndExceptions() + { + $cancellation1 = new Cancellation(1.0); + $cancellation2 = new Cancellation(2.0); + $cancellation3 = new Cancellation(3.0); + $exception1 = new HeidelpayApiException('', '', ApiResponseCodes::API_ERROR_ALREADY_CHARGED_BACK); + $exception2 = new HeidelpayApiException('', '', ApiResponseCodes::API_ERROR_ALREADY_CHARGED_BACK); + + $chargeMock1 = $this->getMockBuilder(Charge::class)->setMethods(['cancel'])->getMock(); + $chargeMock1->expects($this->once())->method('cancel')->willReturn($cancellation1); + + $chargeMock2 = $this->getMockBuilder(Charge::class)->setMethods(['cancel'])->getMock(); + $chargeMock2->expects($this->once())->method('cancel')->willThrowException($exception1); + + $chargeMock3 = $this->getMockBuilder(Charge::class)->setMethods(['cancel'])->getMock(); + $chargeMock3->expects($this->once())->method('cancel')->willReturn($cancellation2); + + $chargeMock4 = $this->getMockBuilder(Charge::class)->setMethods(['cancel'])->getMock(); + $chargeMock4->expects($this->once())->method('cancel')->willThrowException($exception2); + + $chargeMock5 = $this->getMockBuilder(Charge::class)->setMethods(['cancel'])->getMock(); + $chargeMock5->expects($this->once())->method('cancel')->willReturn($cancellation3); + + /** + * @var Charge $chargeMock1 + * @var Charge $chargeMock2 + * @var Charge $chargeMock3 + * @var Charge $chargeMock4 + * @var Charge $chargeMock5 + */ + $payment = new Payment(); + $payment->addCharge($chargeMock1)->addCharge($chargeMock2)->addCharge($chargeMock3)->addCharge($chargeMock4)->addCharge($chargeMock5); + + list($cancellations, $exceptions) = $payment->cancelAllCharges(); + $this->assertArraySubset([$cancellation1, $cancellation2, $cancellation3], $cancellations); + $this->assertArraySubset([$exception1, $exception2], $exceptions); + } + + /** + * Verify cancelAllCharges will throw any exception with Code different to + * ApiResponseCodes::API_ERROR_CHARGE_ALREADY_CANCELED. + * + * @test + * + * @throws ReflectionException + * @throws RuntimeException + * + * @deprecated since 1.2.3.0 + */ + public function cancelAllChargesShouldThrowChargeCancelExceptionsOtherThanAlreadyCharged() + { + $ex1 = new HeidelpayApiException('', '', ApiResponseCodes::API_ERROR_ALREADY_CHARGED_BACK); + $ex2 = new HeidelpayApiException('', '', ApiResponseCodes::API_ERROR_CHARGED_AMOUNT_HIGHER_THAN_EXPECTED); + + $chargeMock1 = $this->getMockBuilder(Charge::class)->setMethods(['cancel'])->getMock(); + $chargeMock1->expects($this->once())->method('cancel')->willThrowException($ex1); + + $chargeMock2 = $this->getMockBuilder(Charge::class)->setMethods(['cancel'])->getMock(); + $chargeMock2->expects($this->once())->method('cancel')->willThrowException($ex2); + + /** + * @var Charge $chargeMock1 + * @var Charge $chargeMock2 + */ + $payment = (new Payment())->addCharge($chargeMock1)->addCharge($chargeMock2); + + try { + $payment->cancelAllCharges(); + $this->assertFalse(true, 'The expected exception has not been thrown.'); + } catch (HeidelpayApiException $e) { + $this->assertSame($ex2, $e); + } + } + + // + /** * Verify cancelAmount will call cancelAuthorizationAmount with the amountToCancel. * When cancelAmount is <= the value of the cancellation it Will return auth cancellation only. From 8f10a0fbf0093bcc2b271a8491f1b9c4afe05f40 Mon Sep 17 00:00:00 2001 From: sixer1182 Date: Fri, 13 Dec 2019 11:10:06 +0100 Subject: [PATCH 067/101] [refactor] (PHPLIB-274) Apply minor changes. --- src/Resources/Customer.php | 4 ++-- src/Resources/Payment.php | 3 +-- test/BasePaymentTest.php | 12 +++++------- test/integration/PaymentTypes/Przelewy24Test.php | 4 +--- 4 files changed, 9 insertions(+), 14 deletions(-) diff --git a/src/Resources/Customer.php b/src/Resources/Customer.php index 59c29650..6ebd728e 100755 --- a/src/Resources/Customer.php +++ b/src/Resources/Customer.php @@ -73,8 +73,6 @@ class Customer extends AbstractHeidelpayResource /** @var GeoLocation $geoLocation */ private $geoLocation; - // - /** * Customer constructor. * @@ -95,6 +93,8 @@ public function __construct(string $firstname = null, string $lastname = null) $this->geoLocation = new GeoLocation(); } + // + /** * @return string|null */ diff --git a/src/Resources/Payment.php b/src/Resources/Payment.php index ae0d3dd9..b92c91e4 100755 --- a/src/Resources/Payment.php +++ b/src/Resources/Payment.php @@ -479,8 +479,7 @@ public function getCancellations(): array } $authorization = $this->getAuthorization(true); - $cancellations = array_merge($authorization ? $authorization->getCancellations() : [], ...$refunds); - return $cancellations; + return array_merge($authorization ? $authorization->getCancellations() : [], ...$refunds); } /** diff --git a/test/BasePaymentTest.php b/test/BasePaymentTest.php index d0cce3dd..da106f73 100755 --- a/test/BasePaymentTest.php +++ b/test/BasePaymentTest.php @@ -239,10 +239,9 @@ protected function createCardObject(string $cardNumber = '5453010000059543'): Ca */ public function createCardAuthorization($amount = 100.0): Authorization { - $card = $this->heidelpay->createPaymentType($this->createCardObject()); - $orderId = microtime(true); - $authorization = $this->heidelpay->authorize($amount, 'EUR', $card, self::RETURN_URL, null, $orderId, null, null, false); - return $authorization; + $card = $this->heidelpay->createPaymentType($this->createCardObject()); + $orderId = microtime(true); + return $this->heidelpay->authorize($amount, 'EUR', $card, self::RETURN_URL, null, $orderId, null, null, false); } /** @@ -256,10 +255,9 @@ public function createCardAuthorization($amount = 100.0): Authorization public function createPaypalAuthorization(): Authorization { /** @var Paypal $paypal */ - $paypal = $this->heidelpay->createPaymentType(new Paypal()); + $paypal = $this->heidelpay->createPaymentType(new Paypal()); $orderId = microtime(true); - $authorization = $this->heidelpay->authorize(100.0, 'EUR', $paypal, self::RETURN_URL, null, $orderId, null, null, false); - return $authorization; + return $this->heidelpay->authorize(100.0, 'EUR', $paypal, self::RETURN_URL, null, $orderId, null, null, false); } /** diff --git a/test/integration/PaymentTypes/Przelewy24Test.php b/test/integration/PaymentTypes/Przelewy24Test.php index 12b5cd4e..af1756ed 100755 --- a/test/integration/PaymentTypes/Przelewy24Test.php +++ b/test/integration/PaymentTypes/Przelewy24Test.php @@ -128,13 +128,11 @@ public function przelewy24ShouldThrowExceptionIfCurrencyIsNotSupported($currency */ public function przelewy24CurrencyCodeProvider(): array { - $currencyArray = [ + return [ 'EUR' => ['EUR'], 'US Dollar'=> ['USD'], 'Swiss Franc' => ['CHF'] ]; - - return $currencyArray; } // From e3218944b97a649d270227a3326714344205d640 Mon Sep 17 00:00:00 2001 From: sixer1182 Date: Fri, 13 Dec 2019 13:12:49 +0100 Subject: [PATCH 068/101] [refactor] (PHPLIB-274) Fix typo. --- src/Heidelpay.php | 80 +++++++++---------- src/Resources/AbstractHeidelpayResource.php | 4 +- src/Resources/Payment.php | 50 ++++++------ src/Resources/PaymentTypes/Paypage.php | 2 +- .../AbstractTransactionType.php | 2 +- .../TransactionTypes/Authorization.php | 2 +- src/Resources/TransactionTypes/Charge.php | 2 +- src/Services/PaymentService.php | 4 +- src/Services/ResourceService.php | 18 ++--- src/Traits/CanAuthorize.php | 2 +- src/Traits/CanDirectCharge.php | 2 +- src/Traits/CanDirectChargeWithCustomer.php | 2 +- src/Traits/CanPayout.php | 2 +- src/Traits/CanPayoutWithCustomer.php | 2 +- src/Traits/HasCancellations.php | 2 +- test/BasePaymentTest.php | 6 +- test/integration/BasketTest.php | 10 +-- test/integration/CustomerTest.php | 36 ++++----- test/integration/ExceptionTest.php | 2 +- test/integration/PaymentCancelTest.php | 34 ++++---- test/integration/PaymentTest.php | 18 ++--- test/integration/PaymentTypes/CardTest.php | 28 +++---- test/integration/PaymentTypes/EPSTest.php | 8 +- test/integration/PaymentTypes/GiropayTest.php | 8 +- .../HirePurchaseDirectDebitTest.php | 14 ++-- test/integration/PaymentTypes/IdealTest.php | 8 +- .../PaymentTypes/InvoiceFactoringTest.php | 26 +++--- test/integration/PaymentTypes/InvoiceTest.php | 14 ++-- .../PaymentTypes/PrepaymentTest.php | 10 +-- .../PaymentTypes/Przelewy24Test.php | 8 +- .../SepaDirectDebitGuaranteedTest.php | 10 +-- .../PaymentTypes/SepaDirectDebitTest.php | 10 +-- test/integration/SetMetadataTest.php | 4 +- .../TransactionTypes/AuthorizationTest.php | 10 +-- .../CancelAfterAuthorizationTest.php | 8 +- .../CancelAfterChargeTest.php | 8 +- .../TransactionTypes/CancelTest.php | 2 +- .../TransactionTypes/ChargeTest.php | 6 +- .../TransactionTypes/PayoutTest.php | 6 +- .../TransactionTypes/ShipmentTest.php | 2 +- test/integration/WebhookTest.php | 14 ++-- test/unit/Resources/PaymentTest.php | 34 ++++---- .../Resources/PaymentTypes/PayPageTest.php | 4 +- .../TransactionTypes/AuthorizationTest.php | 2 +- .../TransactionTypes/ShipmentTest.php | 2 +- test/unit/Services/ResourceServiceTest.php | 8 +- test/unit/Traits/CanRecurTest.php | 2 +- 47 files changed, 269 insertions(+), 269 deletions(-) diff --git a/src/Heidelpay.php b/src/Heidelpay.php index efca2cfa..ac6a8aec 100755 --- a/src/Heidelpay.php +++ b/src/Heidelpay.php @@ -317,7 +317,7 @@ public function getUri($appendId = true): string * @return AbstractHeidelpayResource The updated resource object. * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function getResource(AbstractHeidelpayResource $resource): AbstractHeidelpayResource { @@ -332,7 +332,7 @@ public function getResource(AbstractHeidelpayResource $resource): AbstractHeidel * @return AbstractHeidelpayResource The updated resource object. * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function fetchResource(AbstractHeidelpayResource $resource): AbstractHeidelpayResource { @@ -350,7 +350,7 @@ public function fetchResource(AbstractHeidelpayResource $resource): AbstractHeid * @return mixed * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function activateRecurringPayment($paymentType, $returnUrl) { @@ -369,7 +369,7 @@ public function activateRecurringPayment($paymentType, $returnUrl) * @return Payment Returns the updated payment object. * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function fetchPayment($payment): Payment { @@ -384,7 +384,7 @@ public function fetchPayment($payment): Payment * @return Payment Returns the updated payment object. * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function fetchPaymentByOrderId($orderId): Payment { @@ -403,7 +403,7 @@ public function fetchPaymentByOrderId($orderId): Payment * @return Keypair The Keypair object composed of the data returned by the API. * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function fetchKeypair($detailed = false): AbstractHeidelpayResource { @@ -422,7 +422,7 @@ public function fetchKeypair($detailed = false): AbstractHeidelpayResource * @return Metadata The fetched Metadata resource. * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function createMetadata($metadata): Metadata { @@ -437,7 +437,7 @@ public function createMetadata($metadata): Metadata * @return Metadata The fetched Metadata resource. * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function fetchMetadata($metadata): Metadata { @@ -456,7 +456,7 @@ public function fetchMetadata($metadata): Metadata * @return Basket The created Basket object. * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function createBasket(Basket $basket): Basket { @@ -471,7 +471,7 @@ public function createBasket(Basket $basket): Basket * @return Basket The fetched Basket object. * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function fetchBasket($basket): Basket { @@ -486,7 +486,7 @@ public function fetchBasket($basket): Basket * @return Basket The updated Basket object. * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function updateBasket(Basket $basket): Basket { @@ -507,7 +507,7 @@ public function updateBasket(Basket $basket): Basket * @return BasePaymentType|AbstractHeidelpayResource The created and updated PaymentType object. * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function createPaymentType(BasePaymentType $paymentType): BasePaymentType { @@ -522,7 +522,7 @@ public function createPaymentType(BasePaymentType $paymentType): BasePaymentType * @return BasePaymentType|AbstractHeidelpayResource The updated PaymentType object. * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function updatePaymentType(BasePaymentType $paymentType): BasePaymentType { @@ -537,7 +537,7 @@ public function updatePaymentType(BasePaymentType $paymentType): BasePaymentType * @return BasePaymentType|AbstractHeidelpayResource The fetched PaymentType object. * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function fetchPaymentType($typeId): AbstractHeidelpayResource { @@ -556,7 +556,7 @@ public function fetchPaymentType($typeId): AbstractHeidelpayResource * @return Customer The created and updated Customer object. * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function createCustomer(Customer $customer): AbstractHeidelpayResource { @@ -571,7 +571,7 @@ public function createCustomer(Customer $customer): AbstractHeidelpayResource * @return Customer The created and updated Customer object. * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function createOrUpdateCustomer(Customer $customer): AbstractHeidelpayResource { @@ -588,7 +588,7 @@ public function createOrUpdateCustomer(Customer $customer): AbstractHeidelpayRes * @return Customer The retrieved/updated Customer object. * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function fetchCustomer($customer): AbstractHeidelpayResource { @@ -603,7 +603,7 @@ public function fetchCustomer($customer): AbstractHeidelpayResource * @return Customer The retrieved Customer object. * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function fetchCustomerByExtCustomerId($customerId): AbstractHeidelpayResource { @@ -618,7 +618,7 @@ public function fetchCustomerByExtCustomerId($customerId): AbstractHeidelpayReso * @return Customer The updated Customer object. * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function updateCustomer(Customer $customer): AbstractHeidelpayResource { @@ -632,7 +632,7 @@ public function updateCustomer(Customer $customer): AbstractHeidelpayResource * @param Customer|string $customer Either the Customer object or the id of the Customer resource. * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function deleteCustomer($customer) { @@ -653,7 +653,7 @@ public function deleteCustomer($customer) * @return Authorization The Authorization object of the given Payment. * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function fetchAuthorization($payment): AbstractHeidelpayResource { @@ -674,7 +674,7 @@ public function fetchAuthorization($payment): AbstractHeidelpayResource * @return Charge The retrieved Charge object. * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function fetchChargeById($paymentId, $chargeId): AbstractHeidelpayResource { @@ -689,7 +689,7 @@ public function fetchChargeById($paymentId, $chargeId): AbstractHeidelpayResourc * @return Charge * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function fetchCharge(Charge $charge): AbstractHeidelpayResource { @@ -709,7 +709,7 @@ public function fetchCharge(Charge $charge): AbstractHeidelpayResource * @return Cancellation The retrieved Cancellation object. * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function fetchReversalByAuthorization($authorization, $cancellationId): AbstractHeidelpayResource { @@ -725,7 +725,7 @@ public function fetchReversalByAuthorization($authorization, $cancellationId): A * @return Cancellation The cancellation object retrieved from the API. * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function fetchReversal($payment, $cancellationId): AbstractHeidelpayResource { @@ -742,7 +742,7 @@ public function fetchReversal($payment, $cancellationId): AbstractHeidelpayResou * @return Cancellation The retrieved Cancellation resource. * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function fetchRefundById($payment, $chargeId, $cancellationId): AbstractHeidelpayResource { @@ -758,7 +758,7 @@ public function fetchRefundById($payment, $chargeId, $cancellationId): AbstractH * @return Cancellation The retrieved Cancellation object. * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function fetchRefund(Charge $charge, $cancellationId): AbstractHeidelpayResource { @@ -778,7 +778,7 @@ public function fetchRefund(Charge $charge, $cancellationId): AbstractHeidelpayR * @return Shipment The retrieved Shipment object. * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function fetchShipment($payment, $shipmentId): AbstractHeidelpayResource { @@ -799,7 +799,7 @@ public function fetchShipment($payment, $shipmentId): AbstractHeidelpayResource * @return Payout The Payout object of the given Payment. * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function fetchPayout($payment): AbstractHeidelpayResource { @@ -956,7 +956,7 @@ public function fetchResourceFromEvent($eventJson = null): AbstractHeidelpayReso * @return Authorization The resulting object of the Authorization resource. * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function authorize( $amount, @@ -1003,7 +1003,7 @@ public function authorize( * @return Authorization The resulting object of the Authorization resource. * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function authorizeWithPayment( $amount, @@ -1044,7 +1044,7 @@ public function authorizeWithPayment( * @return Charge The resulting object of the Charge resource. * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function charge( $amount, @@ -1086,7 +1086,7 @@ public function charge( * @return Charge The resulting object of the Charge resource. * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function chargeAuthorization( $payment, @@ -1109,7 +1109,7 @@ public function chargeAuthorization( * @return Charge The resulting Charge object. * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function chargePayment( $payment, @@ -1136,7 +1136,7 @@ public function chargePayment( * @return Cancellation The resulting Cancellation object. * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function cancelAuthorization(Authorization $authorization, $amount = null): AbstractTransactionType { @@ -1153,7 +1153,7 @@ public function cancelAuthorization(Authorization $authorization, $amount = null * @return Cancellation Resulting Cancellation object. * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function cancelAuthorizationByPayment($payment, $amount = null): AbstractTransactionType { @@ -1180,7 +1180,7 @@ public function cancelAuthorizationByPayment($payment, $amount = null): Abstract * @return Cancellation The resulting Cancellation object. * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function cancelChargeById( $paymentId, @@ -1217,7 +1217,7 @@ public function cancelChargeById( * @return Cancellation The resulting Cancellation object. * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function cancelCharge( Charge $charge, @@ -1251,7 +1251,7 @@ public function cancelCharge( * @return Shipment The resulting Shipment object. * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function ship($payment, $invoiceId = null, $orderId = null): AbstractHeidelpayResource { @@ -1281,7 +1281,7 @@ public function ship($payment, $invoiceId = null, $orderId = null): AbstractHeid * @return Payout The resulting object of the Payout resource. * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function payout( $amount, diff --git a/src/Resources/AbstractHeidelpayResource.php b/src/Resources/AbstractHeidelpayResource.php index 08fad861..cec9f904 100755 --- a/src/Resources/AbstractHeidelpayResource.php +++ b/src/Resources/AbstractHeidelpayResource.php @@ -300,7 +300,7 @@ private function getResourceService(): ResourceService * @return AbstractHeidelpayResource * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ protected function getResource(AbstractHeidelpayResource $resource): AbstractHeidelpayResource { @@ -313,7 +313,7 @@ protected function getResource(AbstractHeidelpayResource $resource): AbstractHei * @param AbstractHeidelpayResource $resource * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ protected function fetchResource(AbstractHeidelpayResource $resource) { diff --git a/src/Resources/Payment.php b/src/Resources/Payment.php index 901dbbd3..48a69011 100755 --- a/src/Resources/Payment.php +++ b/src/Resources/Payment.php @@ -130,7 +130,7 @@ public function setRedirectUrl(string $redirectUrl): Payment * @return Authorization|AbstractHeidelpayResource|null The Authorization object if it exists. * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function getAuthorization($lazy = false) { @@ -166,7 +166,7 @@ public function setAuthorization(Authorization $authorize): Payment * @return Payout|AbstractHeidelpayResource|null The Payout object if it exists. * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function getPayout($lazy = false) { @@ -227,7 +227,7 @@ public function addCharge(Charge $charge): self * @return Charge|null The retrieved Charge object or null if it does not exist. * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function getCharge($chargeId, $lazy = false) { @@ -255,7 +255,7 @@ public function getCharge($chargeId, $lazy = false) * @return AbstractHeidelpayResource|Charge|null The retrieved Charge object or null if it could not be found. * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function getChargeByIndex($index, $lazy = false) { @@ -279,7 +279,7 @@ public function getChargeByIndex($index, $lazy = false) * @return Payment This Payment object. * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function setCustomer($customer): Payment { @@ -335,7 +335,7 @@ public function getPaymentType() * @return Payment This Payment object. * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function setPaymentType($paymentType): Payment { @@ -374,7 +374,7 @@ public function getMetadata() * @return Payment * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function setMetadata($metadata): Payment { @@ -408,7 +408,7 @@ public function getBasket() * @return Payment * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function setBasket($basket): Payment { @@ -441,7 +441,7 @@ public function setBasket($basket): Payment * @return Cancellation|null The retrieved Cancellation object. * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function getCancellation($cancellationId, $lazy = false) { @@ -465,7 +465,7 @@ public function getCancellation($cancellationId, $lazy = false) * @return array The array containing all Cancellation objects of this Payment object. * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function getCancellations(): array { @@ -515,7 +515,7 @@ public function getShipments(): array * @return Shipment|null The retrieved Shipment object. * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function getShipment($shipmentId, $lazy = false) { @@ -596,7 +596,7 @@ protected function getResourcePath(): string * {@inheritDoc} * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function handleResponse(stdClass $response, $method = HttpAdapterInterface::REQUEST_GET) { @@ -638,7 +638,7 @@ public function getExternalId() * If more then one cancellation is performed the last one will be returned. * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. * * @deprecated since 1.2.3.0 * @see Payment::cancelAmount() @@ -668,7 +668,7 @@ public function cancel($amount = null, $reason = CancelReasonCodes::REASON_CODE_ * @return Cancellation[] An array holding all Cancellation objects created with this cancel call. * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function cancelAmount( $amount = null, @@ -805,7 +805,7 @@ public function cancelAuthorization($amount = null): array * @return Cancellation|null * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function cancelAuthorizationAmount($amount = null) { @@ -852,7 +852,7 @@ public function cancelAuthorizationAmount($amount = null) * @return Charge|AbstractHeidelpayResource The resulting Charge object. * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function charge($amount = null, $currency = null): Charge { @@ -868,7 +868,7 @@ public function charge($amount = null, $currency = null): Charge * @return AbstractHeidelpayResource|Shipment The resulting Shipment object. * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function ship($invoiceId = null, $orderId = null) { @@ -883,7 +883,7 @@ public function ship($invoiceId = null, $orderId = null) * @param array $transactions * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ private function updateResponseTransactions(array $transactions = []) { @@ -924,7 +924,7 @@ private function updateResponseTransactions(array $transactions = []) * @param $resources * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ private function updateResponseResources($resources) { @@ -966,7 +966,7 @@ private function updateResponseResources($resources) * @param stdClass $transaction The transaction from the Payment response containing the Authorization data. * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ private function updateAuthorizationTransaction($transaction) { @@ -986,7 +986,7 @@ private function updateAuthorizationTransaction($transaction) * @param stdClass $transaction The transaction from the Payment response containing the Charge data. * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ private function updateChargeTransaction($transaction) { @@ -1006,7 +1006,7 @@ private function updateChargeTransaction($transaction) * @param stdClass $transaction The transaction from the Payment response containing the Cancellation data. * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ private function updateReversalTransaction($transaction) { @@ -1031,7 +1031,7 @@ private function updateReversalTransaction($transaction) * @param stdClass $transaction The transaction from the Payment response containing the Cancellation data. * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ private function updateRefundTransaction($transaction) { @@ -1058,7 +1058,7 @@ private function updateRefundTransaction($transaction) * @param stdClass $transaction The transaction from the Payment response containing the Shipment data. * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ private function updateShipmentTransaction($transaction) { @@ -1078,7 +1078,7 @@ private function updateShipmentTransaction($transaction) * @param stdClass $transaction The transaction from the Payment response containing the Payout data. * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ private function updatePayoutTransaction($transaction) { diff --git a/src/Resources/PaymentTypes/Paypage.php b/src/Resources/PaymentTypes/Paypage.php index 903b104d..6952cf0f 100644 --- a/src/Resources/PaymentTypes/Paypage.php +++ b/src/Resources/PaymentTypes/Paypage.php @@ -579,7 +579,7 @@ protected function getResourcePath(): string * Map external name of property to internal name of property. * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function handleResponse(stdClass $response, $method = HttpAdapterInterface::REQUEST_GET) { diff --git a/src/Resources/TransactionTypes/AbstractTransactionType.php b/src/Resources/TransactionTypes/AbstractTransactionType.php index e98528d0..2ce36c7c 100755 --- a/src/Resources/TransactionTypes/AbstractTransactionType.php +++ b/src/Resources/TransactionTypes/AbstractTransactionType.php @@ -155,7 +155,7 @@ public function getMessage(): Message * {@inheritDoc} * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function handleResponse(stdClass $response, $method = HttpAdapterInterface::REQUEST_GET) { diff --git a/src/Resources/TransactionTypes/Authorization.php b/src/Resources/TransactionTypes/Authorization.php index f733b73a..6f9de21d 100755 --- a/src/Resources/TransactionTypes/Authorization.php +++ b/src/Resources/TransactionTypes/Authorization.php @@ -280,7 +280,7 @@ public function cancel($amount = null): Cancellation * @return Charge * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function charge($amount = null): Charge { diff --git a/src/Resources/TransactionTypes/Charge.php b/src/Resources/TransactionTypes/Charge.php index c88389ea..8308cb0b 100755 --- a/src/Resources/TransactionTypes/Charge.php +++ b/src/Resources/TransactionTypes/Charge.php @@ -313,7 +313,7 @@ protected function getResourcePath(): string * @return Cancellation The resulting Cancellation object. * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function cancel( $amount = null, diff --git a/src/Services/PaymentService.php b/src/Services/PaymentService.php index 3eebbe9d..d972f1d0 100755 --- a/src/Services/PaymentService.php +++ b/src/Services/PaymentService.php @@ -370,7 +370,7 @@ public function chargePayment( * @return Payout The resulting object of the Payout resource. * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function payout( $amount, @@ -416,7 +416,7 @@ public function payout( * @return Payout The resulting object of the Payout resource. * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function payoutWithPayment( $amount, diff --git a/src/Services/ResourceService.php b/src/Services/ResourceService.php index 66aab556..61d37410 100755 --- a/src/Services/ResourceService.php +++ b/src/Services/ResourceService.php @@ -93,7 +93,7 @@ public function __construct(Heidelpay $heidelpay) * @return stdClass * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function send( AbstractHeidelpayResource $resource, @@ -113,7 +113,7 @@ public function send( * @return AbstractHeidelpayResource * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function getResource(AbstractHeidelpayResource $resource): AbstractHeidelpayResource { @@ -200,7 +200,7 @@ public function fetchResourceByUrl($url) * @return AbstractHeidelpayResource * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function create(AbstractHeidelpayResource $resource): AbstractHeidelpayResource { @@ -228,7 +228,7 @@ public function create(AbstractHeidelpayResource $resource): AbstractHeidelpayRe * @return AbstractHeidelpayResource * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. * @throws Exception */ public function update(AbstractHeidelpayResource $resource): AbstractHeidelpayResource @@ -251,7 +251,7 @@ public function update(AbstractHeidelpayResource $resource): AbstractHeidelpayRe * @return AbstractHeidelpayResource|null * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function delete(AbstractHeidelpayResource &$resource) { @@ -276,7 +276,7 @@ public function delete(AbstractHeidelpayResource &$resource) * @return AbstractHeidelpayResource The updated resource object. * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function fetch(AbstractHeidelpayResource $resource): AbstractHeidelpayResource { @@ -302,7 +302,7 @@ public function fetch(AbstractHeidelpayResource $resource): AbstractHeidelpayRes * @return Payout The Payout object of the given Payment. * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function fetchPayout($payment): AbstractHeidelpayResource { @@ -358,7 +358,7 @@ public function createRecurring($paymentType, $returnUrl): Recurring * @return AbstractHeidelpayResource|Payment * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function getPaymentResource($payment) { @@ -635,7 +635,7 @@ public function fetchPaymentType($typeId): AbstractHeidelpayResource * @return BasePaymentType|AbstractHeidelpayResource The updated PaymentType object. * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function updatePaymentType(BasePaymentType $paymentType): BasePaymentType { diff --git a/src/Traits/CanAuthorize.php b/src/Traits/CanAuthorize.php index 727ef1ef..be91bdc5 100755 --- a/src/Traits/CanAuthorize.php +++ b/src/Traits/CanAuthorize.php @@ -55,7 +55,7 @@ trait CanAuthorize * @return Authorization * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function authorize( $amount, diff --git a/src/Traits/CanDirectCharge.php b/src/Traits/CanDirectCharge.php index 196fdf14..f199bae9 100755 --- a/src/Traits/CanDirectCharge.php +++ b/src/Traits/CanDirectCharge.php @@ -55,7 +55,7 @@ trait CanDirectCharge * @return Charge The resulting charge object. * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function charge( $amount, diff --git a/src/Traits/CanDirectChargeWithCustomer.php b/src/Traits/CanDirectChargeWithCustomer.php index 3202f515..f5b7d95b 100755 --- a/src/Traits/CanDirectChargeWithCustomer.php +++ b/src/Traits/CanDirectChargeWithCustomer.php @@ -55,7 +55,7 @@ trait CanDirectChargeWithCustomer * @return Charge The resulting charge object. * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function charge( $amount, diff --git a/src/Traits/CanPayout.php b/src/Traits/CanPayout.php index 23d39c5e..d6bc2bf8 100644 --- a/src/Traits/CanPayout.php +++ b/src/Traits/CanPayout.php @@ -53,7 +53,7 @@ trait CanPayout * @return Payout The resulting payout object. * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function payout( $amount, diff --git a/src/Traits/CanPayoutWithCustomer.php b/src/Traits/CanPayoutWithCustomer.php index 80f8d39e..cb06a802 100644 --- a/src/Traits/CanPayoutWithCustomer.php +++ b/src/Traits/CanPayoutWithCustomer.php @@ -51,7 +51,7 @@ trait CanPayoutWithCustomer * @return Payout The resulting payout object. * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function payout( $amount, diff --git a/src/Traits/HasCancellations.php b/src/Traits/HasCancellations.php index fb37f04f..852bff5e 100755 --- a/src/Traits/HasCancellations.php +++ b/src/Traits/HasCancellations.php @@ -77,7 +77,7 @@ public function addCancellation(Cancellation $cancellation): self * @param boolean $lazy * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. * * @return Cancellation|null The cancellation or null if none could be found. */ diff --git a/test/BasePaymentTest.php b/test/BasePaymentTest.php index d0cce3dd..67994b62 100755 --- a/test/BasePaymentTest.php +++ b/test/BasePaymentTest.php @@ -178,7 +178,7 @@ protected function assertPending($transaction) * @return Basket * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function createBasket(): Basket { @@ -235,7 +235,7 @@ protected function createCardObject(string $cardNumber = '5453010000059543'): Ca * @return Authorization * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function createCardAuthorization($amount = 100.0): Authorization { @@ -270,7 +270,7 @@ public function createPaypalAuthorization(): Authorization * @return Charge * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function createCharge($amount = 100.0): Charge { diff --git a/test/integration/BasketTest.php b/test/integration/BasketTest.php index 6aa49326..db58639a 100755 --- a/test/integration/BasketTest.php +++ b/test/integration/BasketTest.php @@ -139,7 +139,7 @@ public function basketItemWithInvalidUrlWillThrowAnError($expectException, $imag * @test * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function basketShouldBeUpdateable() { @@ -171,7 +171,7 @@ public function basketShouldBeUpdateable() * @test * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function authorizeTransactionsShouldPassAlongTheBasketIdIfSet() { @@ -197,7 +197,7 @@ public function authorizeTransactionsShouldPassAlongTheBasketIdIfSet() * @test * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function chargeTransactionsShouldPassAlongTheBasketIdIfSet() { @@ -220,7 +220,7 @@ public function chargeTransactionsShouldPassAlongTheBasketIdIfSet() * @test * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function authorizeTransactionsShouldCreateBasketIfItDoesNotExistYet() { @@ -246,7 +246,7 @@ public function authorizeTransactionsShouldCreateBasketIfItDoesNotExistYet() * @test * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function chargeTransactionsShouldCreateBasketIfItDoesNotExistYet() { diff --git a/test/integration/CustomerTest.php b/test/integration/CustomerTest.php index 9b02e08e..cc6d5e0d 100755 --- a/test/integration/CustomerTest.php +++ b/test/integration/CustomerTest.php @@ -48,7 +48,7 @@ class CustomerTest extends BasePaymentTest * @return Customer * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function minCustomerCanBeCreatedAndFetched(): Customer { @@ -85,7 +85,7 @@ public function minCustomerCanBeCreatedAndFetched(): Customer * @return Customer * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function maxCustomerCanBeCreatedAndFetched(): Customer { @@ -105,7 +105,7 @@ public function maxCustomerCanBeCreatedAndFetched(): Customer * @param Customer $customer * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. * @depends maxCustomerCanBeCreatedAndFetched * @test */ @@ -117,7 +117,7 @@ public function customerCanBeFetchedById(Customer $customer) /** * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. * @depends maxCustomerCanBeCreatedAndFetched * @test */ @@ -135,7 +135,7 @@ public function customerCanBeFetchedByCustomerId() * @param Customer $customer * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. * @depends maxCustomerCanBeCreatedAndFetched * @test */ @@ -150,7 +150,7 @@ public function customerCanBeFetchedByObject(Customer $customer) * @param Customer $customer * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. * @depends maxCustomerCanBeCreatedAndFetched * @test */ @@ -169,7 +169,7 @@ public function customerCanBeFetchedByObjectWithData(Customer $customer) * @test * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function transactionShouldCreateAndReferenceCustomerIfItDoesNotExistYet() { @@ -195,7 +195,7 @@ public function transactionShouldCreateAndReferenceCustomerIfItDoesNotExistYet() * @test * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function transactionShouldReferenceCustomerIfItExist() { @@ -221,7 +221,7 @@ public function transactionShouldReferenceCustomerIfItExist() * @test * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function transactionShouldReferenceCustomerIfItExistAndItsIdHasBeenPassed() { @@ -250,7 +250,7 @@ public function transactionShouldReferenceCustomerIfItExistAndItsIdHasBeenPassed * @param Customer $customer * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function customerShouldBeUpdatable(Customer $customer) { @@ -274,7 +274,7 @@ public function customerShouldBeUpdatable(Customer $customer) * @param Customer $customer * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function customerShouldBeDeletableById(Customer $customer) { @@ -294,7 +294,7 @@ public function customerShouldBeDeletableById(Customer $customer) * @test * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function customerShouldBeDeletableByObject() { @@ -317,7 +317,7 @@ public function customerShouldBeDeletableByObject() * @test * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function apiShouldReturnErrorIfCustomerAlreadyExists() { @@ -340,7 +340,7 @@ public function apiShouldReturnErrorIfCustomerAlreadyExists() * @test * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function customerShouldBeFetchedByCustomerIdAndUpdatedIfItAlreadyExists() { @@ -381,7 +381,7 @@ public function customerShouldBeFetchedByCustomerIdAndUpdatedIfItAlreadyExists() * @return Customer * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function minNotRegisteredB2bCustomerCanBeCreatedAndFetched(): Customer { @@ -406,7 +406,7 @@ public function minNotRegisteredB2bCustomerCanBeCreatedAndFetched(): Customer * @test * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function maxNotRegisteredB2bCustomerCanBeCreatedAndFetched() { @@ -433,7 +433,7 @@ public function maxNotRegisteredB2bCustomerCanBeCreatedAndFetched() * @return Customer * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function minRegisteredB2bCustomerCanBeCreatedAndFetched(): Customer { @@ -458,7 +458,7 @@ public function minRegisteredB2bCustomerCanBeCreatedAndFetched(): Customer * @test * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function maxRegisteredB2bCustomerCanBeCreatedAndFetched() { diff --git a/test/integration/ExceptionTest.php b/test/integration/ExceptionTest.php index b339c979..82759712 100755 --- a/test/integration/ExceptionTest.php +++ b/test/integration/ExceptionTest.php @@ -40,7 +40,7 @@ class ExceptionTest extends BasePaymentTest * @test * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function apiExceptionShouldHoldClientMessage() { diff --git a/test/integration/PaymentCancelTest.php b/test/integration/PaymentCancelTest.php index 396c186d..8491a34d 100644 --- a/test/integration/PaymentCancelTest.php +++ b/test/integration/PaymentCancelTest.php @@ -42,7 +42,7 @@ class PaymentCancelTest extends BasePaymentTest * @test * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function doubleCancelOnAuthorizeShouldReturnEmptyArray() { @@ -69,7 +69,7 @@ public function doubleCancelOnAuthorizeShouldReturnEmptyArray() * @test * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function cancelOnChargeAndDoubleCancel() { @@ -97,7 +97,7 @@ public function cancelOnChargeAndDoubleCancel() * @test * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function fullCancelOnPaymentWithAuthorizeAndMultipleChargesShouldBePossible() { @@ -128,7 +128,7 @@ public function fullCancelOnPaymentWithAuthorizeAndMultipleChargesShouldBePossib * @test * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function partialCancelAndFullCancelOnSingleCharge() { @@ -160,7 +160,7 @@ public function partialCancelAndFullCancelOnSingleCharge() * @throws AssertionFailedError * @throws Exception * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function partialCancelOnMultipleChargedAuthorization($amount, $numberCancels) { @@ -195,7 +195,7 @@ public function partialCancelOnMultipleChargedAuthorization($amount, $numberCanc * @throws AssertionFailedError * @throws Exception * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function fullCancelOnAuthorize($amount) { @@ -216,7 +216,7 @@ public function fullCancelOnAuthorize($amount) * @test * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function fullCancelOnPartCanceledAuthorize() { @@ -252,7 +252,7 @@ public function fullCancelOnPartCanceledAuthorize() * @throws AssertionFailedError * @throws Exception * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function fullCancelOnFullyChargedAuthorize($amount) { @@ -283,7 +283,7 @@ public function fullCancelOnFullyChargedAuthorize($amount) * @throws AssertionFailedError * @throws Exception * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function fullCancelOnPartlyChargedAuthorizeShouldBePossible($amount) { @@ -311,7 +311,7 @@ public function fullCancelOnPartlyChargedAuthorizeShouldBePossible($amount) * @throws AssertionFailedError * @throws Exception * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function partCancelOnUnchargedAuthorize() { @@ -334,7 +334,7 @@ public function partCancelOnUnchargedAuthorize() * @throws AssertionFailedError * @throws Exception * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function partCancelOnPartlyChargedAuthorizeWithAmountLtCharged() { @@ -362,7 +362,7 @@ public function partCancelOnPartlyChargedAuthorizeWithAmountLtCharged() * @throws AssertionFailedError * @throws Exception * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function partCancelOnPartlyChargedAuthorizeWithAmountGtCharged() { @@ -393,7 +393,7 @@ public function partCancelOnPartlyChargedAuthorizeWithAmountGtCharged() * @throws AssertionFailedError * @throws Exception * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function fullCancelOnInitialInvoiceCharge($amount) { @@ -418,7 +418,7 @@ public function fullCancelOnInitialInvoiceCharge($amount) * @throws AssertionFailedError * @throws Exception * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function partCancelOnInitialInvoiceChargeShouldBePossible() { @@ -443,7 +443,7 @@ public function partCancelOnInitialInvoiceChargeShouldBePossible() * @throws AssertionFailedError * @throws Exception * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function cancelMoreThanWasCharged() { @@ -466,7 +466,7 @@ public function cancelMoreThanWasCharged() * @throws AssertionFailedError * @throws Exception * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function secondCancelExceedsRemainderOfPartlyCancelledCharge() { @@ -501,7 +501,7 @@ public function secondCancelExceedsRemainderOfPartlyCancelledCharge() * @test * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function cancellationShouldWorkWithAllParametersSet() { diff --git a/test/integration/PaymentTest.php b/test/integration/PaymentTest.php index 54aa226e..b513e10e 100755 --- a/test/integration/PaymentTest.php +++ b/test/integration/PaymentTest.php @@ -42,7 +42,7 @@ class PaymentTest extends BasePaymentTest * @test * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function paymentShouldBeFetchableById() { @@ -61,7 +61,7 @@ public function paymentShouldBeFetchableById() * @test * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function fullChargeShouldBePossibleOnPaymentObject() { @@ -87,7 +87,7 @@ public function fullChargeShouldBePossibleOnPaymentObject() * @test * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function paymentShouldBeFetchableWithCharges() { @@ -117,7 +117,7 @@ public function paymentShouldBeFetchableWithCharges() * @test * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function partialChargeAfterAuthorization() { @@ -135,7 +135,7 @@ public function partialChargeAfterAuthorization() * @test * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function authorizationShouldBePossibleOnHeidelpayObject() { @@ -152,7 +152,7 @@ public function authorizationShouldBePossibleOnHeidelpayObject() * @test * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function paymentChargeOnAuthorizeShouldBePossibleUsingPaymentId() { @@ -169,7 +169,7 @@ public function paymentChargeOnAuthorizeShouldBePossibleUsingPaymentId() * @test * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function paymentChargeOnAuthorizeShouldTakeResourceIds() { @@ -186,7 +186,7 @@ public function paymentChargeOnAuthorizeShouldTakeResourceIds() * @test * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function chargePaymentShouldThrowErrorOnNonPaymentId() { @@ -201,7 +201,7 @@ public function chargePaymentShouldThrowErrorOnNonPaymentId() * @test * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function apiShouldReturnErrorIfOrderIdAlreadyExists() { diff --git a/test/integration/PaymentTypes/CardTest.php b/test/integration/PaymentTypes/CardTest.php index 7cca8555..14d2d838 100755 --- a/test/integration/PaymentTypes/CardTest.php +++ b/test/integration/PaymentTypes/CardTest.php @@ -54,7 +54,7 @@ class CardTest extends BasePaymentTest * * @throws Exception * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function cardShouldBeCreatable(string $cardNumber, CardDetails $expectedCardDetails): BasePaymentType { @@ -96,7 +96,7 @@ public function cardWith3dsFlagShouldSetItAlsoInTransactions() * @test * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function cardCanPerformAuthorizationAndCreatesPayment() { @@ -130,7 +130,7 @@ public function cardCanPerformAuthorizationAndCreatesPayment() * @test * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function cardCanPerformChargeAndCreatesPaymentObject() { @@ -172,7 +172,7 @@ public function cardCanPerformChargeAndCreatesPaymentObject() * @test * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function cardCanBeFetched() { @@ -195,7 +195,7 @@ public function cardCanBeFetched() * @test * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function fullChargeAfterAuthorize() { @@ -226,7 +226,7 @@ public function fullChargeAfterAuthorize() * @test * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function partialChargeAfterAuthorization() { @@ -271,7 +271,7 @@ public function partialChargeAfterAuthorization() * @test * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function exceptionShouldBeThrownWhenChargingMoreThenAuthorized() { @@ -299,7 +299,7 @@ public function exceptionShouldBeThrownWhenChargingMoreThenAuthorized() * @test * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function partialAndFullChargeAfterAuthorization() { @@ -329,7 +329,7 @@ public function partialAndFullChargeAfterAuthorization() * @test * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function authorizationShouldBeFetchable() { @@ -347,7 +347,7 @@ public function authorizationShouldBeFetchable() * @test * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function fullCancelAfterCharge() { @@ -371,7 +371,7 @@ public function fullCancelAfterCharge() * @test * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function fullCancelOnFullyChargedPayment() { @@ -405,7 +405,7 @@ public function fullCancelOnFullyChargedPayment() * @test * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function fullCancelOnPartlyPaidAuthWithCanceledCharges() { @@ -437,7 +437,7 @@ public function fullCancelOnPartlyPaidAuthWithCanceledCharges() * @test * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function cardChargeCanBeCanceled() { @@ -456,7 +456,7 @@ public function cardChargeCanBeCanceled() * @test * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function cardAuthorizeCanBeCanceled() { diff --git a/test/integration/PaymentTypes/EPSTest.php b/test/integration/PaymentTypes/EPSTest.php index 21846732..217c7f06 100755 --- a/test/integration/PaymentTypes/EPSTest.php +++ b/test/integration/PaymentTypes/EPSTest.php @@ -42,7 +42,7 @@ class EPSTest extends BasePaymentTest * @return EPS * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function epsShouldBeCreatable(): EPS { @@ -69,7 +69,7 @@ public function epsShouldBeCreatable(): EPS * @param EPS $eps * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. * @depends epsShouldBeCreatable */ public function epsShouldThrowExceptionOnAuthorize(EPS $eps) @@ -89,7 +89,7 @@ public function epsShouldThrowExceptionOnAuthorize(EPS $eps) * @param EPS $eps * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function epsShouldBeChargeable(EPS $eps) { @@ -113,7 +113,7 @@ public function epsShouldBeChargeable(EPS $eps) * @param EPS $eps * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function epsTypeCanBeFetched(EPS $eps) { diff --git a/test/integration/PaymentTypes/GiropayTest.php b/test/integration/PaymentTypes/GiropayTest.php index d7b07a1b..2d120c22 100755 --- a/test/integration/PaymentTypes/GiropayTest.php +++ b/test/integration/PaymentTypes/GiropayTest.php @@ -38,7 +38,7 @@ class GiropayTest extends BasePaymentTest * @test * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function giroPayShouldBeCreatable() { @@ -55,7 +55,7 @@ public function giroPayShouldBeCreatable() * @test * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function giroPayShouldThrowExceptionOnAuthorize() { @@ -72,7 +72,7 @@ public function giroPayShouldThrowExceptionOnAuthorize() * @test * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function giroPayShouldBeChargeable() { @@ -93,7 +93,7 @@ public function giroPayShouldBeChargeable() * @test * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function giroPayCanBeFetched() { diff --git a/test/integration/PaymentTypes/HirePurchaseDirectDebitTest.php b/test/integration/PaymentTypes/HirePurchaseDirectDebitTest.php index 085e0197..05df763c 100755 --- a/test/integration/PaymentTypes/HirePurchaseDirectDebitTest.php +++ b/test/integration/PaymentTypes/HirePurchaseDirectDebitTest.php @@ -50,7 +50,7 @@ class HirePurchaseDirectDebitTest extends BasePaymentTest * @test * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. * @throws Exception */ public function instalmentPlanShouldBeSelectable() @@ -90,7 +90,7 @@ public function instalmentPlanShouldBeSelectable() * @param $errorCode * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function hirePurchaseDirectDebitAuthorize($firstname, $lastname, $errorCode) { @@ -123,7 +123,7 @@ public function hirePurchaseDirectDebitAuthorize($firstname, $lastname, $errorCo * @test * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. * @throws Exception */ public function instalmentPlanSelectionWithAllFieldsSet() @@ -146,7 +146,7 @@ public function instalmentPlanSelectionWithAllFieldsSet() * @test * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. * @throws Exception */ public function verifyChargingAnInitializedHirePurchase() @@ -174,7 +174,7 @@ public function verifyChargingAnInitializedHirePurchase() * @test * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. * @throws Exception */ public function verifyShippingAChargedHirePurchase() @@ -206,7 +206,7 @@ public function verifyShippingAChargedHirePurchase() * @depends verifyChargingAnInitializedHirePurchase * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. * @throws Exception * * @group skip @@ -237,7 +237,7 @@ public function verifyChargeAndFullCancelAnInitializedHirePurchase() * @depends verifyChargingAnInitializedHirePurchase * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. * @throws Exception */ public function verifyPartlyCancelChargedHirePurchase() diff --git a/test/integration/PaymentTypes/IdealTest.php b/test/integration/PaymentTypes/IdealTest.php index f77efa6e..fcf3c38b 100755 --- a/test/integration/PaymentTypes/IdealTest.php +++ b/test/integration/PaymentTypes/IdealTest.php @@ -40,7 +40,7 @@ class IdealTest extends BasePaymentTest * @return Ideal * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function idealShouldBeCreatable(): Ideal { @@ -60,7 +60,7 @@ public function idealShouldBeCreatable(): Ideal * @param Ideal $ideal * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. * @depends idealShouldBeCreatable */ public function idealShouldThrowExceptionOnAuthorize(Ideal $ideal) @@ -80,7 +80,7 @@ public function idealShouldThrowExceptionOnAuthorize(Ideal $ideal) * @param Ideal $ideal * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function idealShouldBeChargeable(Ideal $ideal) { @@ -102,7 +102,7 @@ public function idealShouldBeChargeable(Ideal $ideal) * @param Ideal $ideal * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function idealTypeCanBeFetched(Ideal $ideal) { diff --git a/test/integration/PaymentTypes/InvoiceFactoringTest.php b/test/integration/PaymentTypes/InvoiceFactoringTest.php index 695cd32f..6dfd6461 100755 --- a/test/integration/PaymentTypes/InvoiceFactoringTest.php +++ b/test/integration/PaymentTypes/InvoiceFactoringTest.php @@ -44,7 +44,7 @@ class InvoiceFactoringTest extends BasePaymentTest * @return InvoiceFactoring * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function invoiceFactoringTypeShouldBeCreatableAndFetchable(): InvoiceFactoring { @@ -68,7 +68,7 @@ public function invoiceFactoringTypeShouldBeCreatableAndFetchable(): InvoiceFact * @param InvoiceFactoring $invoice * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. * @depends invoiceFactoringTypeShouldBeCreatableAndFetchable */ public function verifyInvoiceIsNotAuthorizable(InvoiceFactoring $invoice) @@ -88,7 +88,7 @@ public function verifyInvoiceIsNotAuthorizable(InvoiceFactoring $invoice) * @param InvoiceFactoring $invoiceFactoring * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function invoiceFactoringShouldRequiresCustomer(InvoiceFactoring $invoiceFactoring) { @@ -106,7 +106,7 @@ public function invoiceFactoringShouldRequiresCustomer(InvoiceFactoring $invoice * @param InvoiceFactoring $invoiceFactoring * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function invoiceFactoringRequiresBasket(InvoiceFactoring $invoiceFactoring) { @@ -130,7 +130,7 @@ public function invoiceFactoringRequiresBasket(InvoiceFactoring $invoiceFactorin * @return Charge * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. * @throws AssertionFailedError */ public function invoiceFactoringShouldBeChargeable(InvoiceFactoring $invoiceFactoring): Charge @@ -156,7 +156,7 @@ public function invoiceFactoringShouldBeChargeable(InvoiceFactoring $invoiceFact * @test * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. * @throws Exception */ public function verifyInvoiceFactoringIsNotShippableWoInvoiceIdOnHeidelpayObject() @@ -185,7 +185,7 @@ public function verifyInvoiceFactoringIsNotShippableWoInvoiceIdOnHeidelpayObject * @test * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. * @throws Exception */ public function verifyInvoiceFactoringIsNotShippableWoInvoiceIdOnPaymentObject() @@ -214,7 +214,7 @@ public function verifyInvoiceFactoringIsNotShippableWoInvoiceIdOnPaymentObject() * @test * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function verifyInvoiceFactoringShipmentWithInvoiceIdOnHeidelpayObject() { @@ -243,7 +243,7 @@ public function verifyInvoiceFactoringShipmentWithInvoiceIdOnHeidelpayObject() * @test * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function verifyInvoiceFactoringShipmentWithInvoiceIdOnPaymentObject() { @@ -271,7 +271,7 @@ public function verifyInvoiceFactoringShipmentWithInvoiceIdOnPaymentObject() * @test * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function verifyInvoiceFactoringShipmentWithPreSetInvoiceId() { @@ -299,7 +299,7 @@ public function verifyInvoiceFactoringShipmentWithPreSetInvoiceId() * @param Charge $charge * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. * @depends invoiceFactoringShouldBeChargeable */ public function verifyInvoiceChargeCanBeCanceled(Charge $charge) @@ -317,7 +317,7 @@ public function verifyInvoiceChargeCanBeCanceled(Charge $charge) * @param Charge $charge * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. * @depends invoiceFactoringShouldBeChargeable */ public function verifyInvoiceChargeCanNotBeCancelledWoAmount(Charge $charge) @@ -335,7 +335,7 @@ public function verifyInvoiceChargeCanNotBeCancelledWoAmount(Charge $charge) * @param Charge $charge * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. * @depends invoiceFactoringShouldBeChargeable */ public function verifyInvoiceChargeCanNotBeCancelledWoReasonCode(Charge $charge) diff --git a/test/integration/PaymentTypes/InvoiceTest.php b/test/integration/PaymentTypes/InvoiceTest.php index 549a9354..a75a52ac 100755 --- a/test/integration/PaymentTypes/InvoiceTest.php +++ b/test/integration/PaymentTypes/InvoiceTest.php @@ -38,7 +38,7 @@ class InvoiceTest extends BasePaymentTest * @test * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function invoiceTypeShouldBeCreatable() { @@ -54,7 +54,7 @@ public function invoiceTypeShouldBeCreatable() * @test * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function verifyInvoiceIsNotAuthorizable() { @@ -72,7 +72,7 @@ public function verifyInvoiceIsNotAuthorizable() * @test * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function verifyInvoiceIsChargeable() { @@ -89,7 +89,7 @@ public function verifyInvoiceIsChargeable() * @test * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function verifyInvoiceIsNotShippable() { @@ -115,7 +115,7 @@ public function verifyInvoiceIsNotShippable() * @test * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function verifyInvoiceChargeCanBeCanceled() { @@ -135,7 +135,7 @@ public function verifyInvoiceChargeCanBeCanceled() * @test * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function verifyInvoiceChargeCanBePartlyCanceled() { @@ -161,7 +161,7 @@ public function verifyInvoiceChargeCanBePartlyCanceled() * @test * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function invoiceTypeCanBeFetched() { diff --git a/test/integration/PaymentTypes/PrepaymentTest.php b/test/integration/PaymentTypes/PrepaymentTest.php index 1dbc257d..ca7924e1 100755 --- a/test/integration/PaymentTypes/PrepaymentTest.php +++ b/test/integration/PaymentTypes/PrepaymentTest.php @@ -40,7 +40,7 @@ class PrepaymentTest extends BasePaymentTest * @return Prepayment * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. * @test */ public function prepaymentShouldBeCreatableAndFetchable(): AbstractHeidelpayResource @@ -68,7 +68,7 @@ public function prepaymentShouldBeCreatableAndFetchable(): AbstractHeidelpayReso * @return Charge * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function prepaymentTypeShouldBeChargeable(Prepayment $prepayment): Charge { @@ -93,7 +93,7 @@ public function prepaymentTypeShouldBeChargeable(Prepayment $prepayment): Charge * @param Prepayment $prepayment * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function prepaymentTypeShouldNotBeAuthorizable(Prepayment $prepayment) { @@ -113,7 +113,7 @@ public function prepaymentTypeShouldNotBeAuthorizable(Prepayment $prepayment) * @param Charge $charge * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function prepaymentTypeShouldNotBeShippable(Charge $charge) { @@ -133,7 +133,7 @@ public function prepaymentTypeShouldNotBeShippable(Charge $charge) * @param Prepayment $prepayment * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function prepaymentChargeCanBeCanceled(Prepayment $prepayment) { diff --git a/test/integration/PaymentTypes/Przelewy24Test.php b/test/integration/PaymentTypes/Przelewy24Test.php index 12b5cd4e..28c262bd 100755 --- a/test/integration/PaymentTypes/Przelewy24Test.php +++ b/test/integration/PaymentTypes/Przelewy24Test.php @@ -42,7 +42,7 @@ class Przelewy24Test extends BasePaymentTest * @return BasePaymentType * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function przelewy24ShouldBeCreatableAndFetchable(): BasePaymentType { @@ -67,7 +67,7 @@ public function przelewy24ShouldBeCreatableAndFetchable(): BasePaymentType * @param Przelewy24 $przelewy24 * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function przelewy24ShouldBeChargeable(Przelewy24 $przelewy24) { @@ -90,7 +90,7 @@ public function przelewy24ShouldBeChargeable(Przelewy24 $przelewy24) * @param Przelewy24 $przelewy24 * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function przelewy24ShouldNotBeAuthorizable(Przelewy24 $przelewy24) { @@ -110,7 +110,7 @@ public function przelewy24ShouldNotBeAuthorizable(Przelewy24 $przelewy24) * @param string $currencyCode * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function przelewy24ShouldThrowExceptionIfCurrencyIsNotSupported($currencyCode) { diff --git a/test/integration/PaymentTypes/SepaDirectDebitGuaranteedTest.php b/test/integration/PaymentTypes/SepaDirectDebitGuaranteedTest.php index 3a1720fd..7b995aa1 100755 --- a/test/integration/PaymentTypes/SepaDirectDebitGuaranteedTest.php +++ b/test/integration/PaymentTypes/SepaDirectDebitGuaranteedTest.php @@ -39,7 +39,7 @@ class SepaDirectDebitGuaranteedTest extends BasePaymentTest * @test * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function sepaDirectDebitGuaranteedShouldBeCreatableWithMandatoryFieldsOnly() { @@ -62,7 +62,7 @@ public function sepaDirectDebitGuaranteedShouldBeCreatableWithMandatoryFieldsOnl * @return SepaDirectDebitGuaranteed * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function sepaDirectDebitGuaranteedShouldBeCreatable(): SepaDirectDebitGuaranteed { @@ -87,7 +87,7 @@ public function sepaDirectDebitGuaranteedShouldBeCreatable(): SepaDirectDebitGua * @param SepaDirectDebitGuaranteed $directDebitGuaranteed * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. * @depends sepaDirectDebitGuaranteedShouldBeCreatable */ public function directDebitGuaranteedShouldProhibitAuthorization(SepaDirectDebitGuaranteed $directDebitGuaranteed) @@ -104,7 +104,7 @@ public function directDebitGuaranteedShouldProhibitAuthorization(SepaDirectDebit * @test * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function directDebitGuaranteedShouldAllowCharge() { @@ -122,7 +122,7 @@ public function directDebitGuaranteedShouldAllowCharge() * @test * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function ddgShouldThrowErrorIfAddressesDoNotMatch() { diff --git a/test/integration/PaymentTypes/SepaDirectDebitTest.php b/test/integration/PaymentTypes/SepaDirectDebitTest.php index ff1d9f18..fae570e1 100755 --- a/test/integration/PaymentTypes/SepaDirectDebitTest.php +++ b/test/integration/PaymentTypes/SepaDirectDebitTest.php @@ -39,7 +39,7 @@ class SepaDirectDebitTest extends BasePaymentTest * @test * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function sepaDirectDebitShouldBeCreatableWithMandatoryFieldsOnly() { @@ -60,7 +60,7 @@ public function sepaDirectDebitShouldBeCreatableWithMandatoryFieldsOnly() * @test * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function sepaDirectDebitShouldBeCreatable() { @@ -81,7 +81,7 @@ public function sepaDirectDebitShouldBeCreatable() * @test * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function authorizeShouldThrowException() { @@ -98,7 +98,7 @@ public function authorizeShouldThrowException() * @test * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function directDebitShouldBeChargeable() { @@ -116,7 +116,7 @@ public function directDebitShouldBeChargeable() * @test * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function directDebitChargeShouldBeRefundable() { diff --git a/test/integration/SetMetadataTest.php b/test/integration/SetMetadataTest.php index aee85a55..933f03d2 100755 --- a/test/integration/SetMetadataTest.php +++ b/test/integration/SetMetadataTest.php @@ -117,7 +117,7 @@ public function chargeShouldCreateMetadata() * @test * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function paymentShouldFetchMetadataResourceOnFetch() { @@ -140,7 +140,7 @@ public function paymentShouldFetchMetadataResourceOnFetch() * @test * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function emptyMetaDataShouldLeadToError() { diff --git a/test/integration/TransactionTypes/AuthorizationTest.php b/test/integration/TransactionTypes/AuthorizationTest.php index d1a52e14..ba437efc 100644 --- a/test/integration/TransactionTypes/AuthorizationTest.php +++ b/test/integration/TransactionTypes/AuthorizationTest.php @@ -62,7 +62,7 @@ public function authorizeWithTypeId() * @test * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function authorizeWithType() { @@ -78,7 +78,7 @@ public function authorizeWithType() * @test * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function authorizationProducesPaymentAndCustomer() { @@ -104,7 +104,7 @@ public function authorizationProducesPaymentAndCustomer() * @return Authorization * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function authorizationWithCustomerId(): Authorization { @@ -151,7 +151,7 @@ public function authorizationCanBeFetched(Authorization $authorization) * @param string $expectedState The state the transaction is expected to be in. * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function authorizeHasExpectedStates(BasePaymentType $paymentType, $expectedState) { @@ -168,7 +168,7 @@ public function authorizeHasExpectedStates(BasePaymentType $paymentType, $expect * @test * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function authorizeShouldAcceptAllParameters() { diff --git a/test/integration/TransactionTypes/CancelAfterAuthorizationTest.php b/test/integration/TransactionTypes/CancelAfterAuthorizationTest.php index 551d57dc..581a8c96 100644 --- a/test/integration/TransactionTypes/CancelAfterAuthorizationTest.php +++ b/test/integration/TransactionTypes/CancelAfterAuthorizationTest.php @@ -65,7 +65,7 @@ public function fullCancelOnAuthorization() * @test * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function partCancelOnPayment() { @@ -87,7 +87,7 @@ public function partCancelOnPayment() * @test * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function partCancelOnAuthorize() { @@ -112,7 +112,7 @@ public function partCancelOnAuthorize() * @test * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function anAuthorizationsFullReversalShallBeFetchable() { @@ -150,7 +150,7 @@ public function anAuthorizationsFullReversalShallBeFetchable() * @test * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function anAuthorizationsReversalsShouldBeFetchable() { diff --git a/test/integration/TransactionTypes/CancelAfterChargeTest.php b/test/integration/TransactionTypes/CancelAfterChargeTest.php index 917919b2..3dc7ec25 100644 --- a/test/integration/TransactionTypes/CancelAfterChargeTest.php +++ b/test/integration/TransactionTypes/CancelAfterChargeTest.php @@ -41,7 +41,7 @@ class CancelAfterChargeTest extends BasePaymentTest * @return Charge * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function chargeShouldBeFetchable(): Charge { @@ -99,7 +99,7 @@ public function chargeShouldBeFullyRefundableWithId() * @test * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function chargeShouldBePartlyRefundableWithId() { @@ -127,7 +127,7 @@ public function chargeShouldBePartlyRefundableWithId() * @test * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function chargeShouldBePartlyRefundable() { @@ -155,7 +155,7 @@ public function chargeShouldBePartlyRefundable() * @test * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function cancelShouldAcceptPaymentReferenceParameter() { diff --git a/test/integration/TransactionTypes/CancelTest.php b/test/integration/TransactionTypes/CancelTest.php index 19ecf864..9a771150 100644 --- a/test/integration/TransactionTypes/CancelTest.php +++ b/test/integration/TransactionTypes/CancelTest.php @@ -142,7 +142,7 @@ public function chargeCancellationsShouldBeFetchableViaPaymentObject() * @test * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function cancelStatusIsSetCorrectly() { diff --git a/test/integration/TransactionTypes/ChargeTest.php b/test/integration/TransactionTypes/ChargeTest.php index 89fc71fc..00588fbd 100644 --- a/test/integration/TransactionTypes/ChargeTest.php +++ b/test/integration/TransactionTypes/ChargeTest.php @@ -77,7 +77,7 @@ public function chargeShouldWorkWithTypeObject() * @test * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function chargeStatusIsSetCorrectly() { @@ -90,7 +90,7 @@ public function chargeStatusIsSetCorrectly() * @test * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function chargeShouldAcceptAllParameters() { @@ -139,7 +139,7 @@ public function chargeShouldAcceptAllParameters() * @test * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function chargeWithCustomerShouldAcceptAllParameters() { diff --git a/test/integration/TransactionTypes/PayoutTest.php b/test/integration/TransactionTypes/PayoutTest.php index c31aff18..3e9ce297 100644 --- a/test/integration/TransactionTypes/PayoutTest.php +++ b/test/integration/TransactionTypes/PayoutTest.php @@ -112,7 +112,7 @@ public function payoutCanBeCalledForSepaDirectDebitGuaranteedType() * @test * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. * @throws Exception */ public function payoutShouldBeFetchedWhenItsPaymentResourceIsFetched() @@ -134,7 +134,7 @@ public function payoutShouldBeFetchedWhenItsPaymentResourceIsFetched() * @test * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function payoutShouldBeFetchableViaItsUrl() { @@ -153,7 +153,7 @@ public function payoutShouldBeFetchableViaItsUrl() * @test * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function payoutShouldAcceptAllParameters() { diff --git a/test/integration/TransactionTypes/ShipmentTest.php b/test/integration/TransactionTypes/ShipmentTest.php index c37dba51..912b66fc 100644 --- a/test/integration/TransactionTypes/ShipmentTest.php +++ b/test/integration/TransactionTypes/ShipmentTest.php @@ -109,7 +109,7 @@ public function shipmentShouldBePossibleWithPaymentObject() * @test * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function shipmentStatusIsSetCorrectly() { diff --git a/test/integration/WebhookTest.php b/test/integration/WebhookTest.php index 0b9bf727..a3890d32 100755 --- a/test/integration/WebhookTest.php +++ b/test/integration/WebhookTest.php @@ -49,7 +49,7 @@ class WebhookTest extends BasePaymentTest * * @throws Exception * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function webhookResourceCanBeRegisteredAndFetched($event) { @@ -115,7 +115,7 @@ public function webhookEventShouldNotBeUpdateable() * * @throws Exception * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function webhookResourceShouldBeDeletable() { @@ -137,7 +137,7 @@ public function webhookResourceShouldBeDeletable() * * @throws Exception * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function webhookCreateShouldThrowErrorWhenEventIsAlreadyRegistered() { @@ -160,7 +160,7 @@ public function webhookCreateShouldThrowErrorWhenEventIsAlreadyRegistered() * * @throws Exception * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function fetchWebhooksShouldReturnArrayOfRegisteredWebhooks() { @@ -196,7 +196,7 @@ public function fetchWebhooksShouldReturnArrayOfRegisteredWebhooks() * * @throws Exception * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function allWebhooksShouldBeRemovableAtOnce() { @@ -217,7 +217,7 @@ public function allWebhooksShouldBeRemovableAtOnce() * @depends allWebhooksShouldBeRemovableAtOnce * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function bulkSettingWebhookEventsShouldBePossible() { @@ -247,7 +247,7 @@ public function bulkSettingWebhookEventsShouldBePossible() * @test * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function bulkSettingOnlyOneWebhookShouldBePossible() { diff --git a/test/unit/Resources/PaymentTest.php b/test/unit/Resources/PaymentTest.php index 27cdd656..23836806 100755 --- a/test/unit/Resources/PaymentTest.php +++ b/test/unit/Resources/PaymentTest.php @@ -132,7 +132,7 @@ public function getAuthorizationShouldNotFetchAuthorizeIfNotLazyAndAuthIsNull() * @test * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function chargesShouldBeHandledProperly() { @@ -227,7 +227,7 @@ public function getChargeShouldFetchChargeIfItExistsAndLazyLoadingIsOff() * @test * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function getChargeMethodsShouldReturnNullIfTheChargeIdUnknown() { @@ -300,7 +300,7 @@ public function getPayoutShouldNotFetchPayoutIfNotLazyAndPayoutIsNull() * @test * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function setCustomerShouldDoNothingIfTheCustomerIsEmpty() { @@ -373,7 +373,7 @@ public function setCustomerShouldCreateCustomerIfItIsPassedAsObjectWithoutId() * @test * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function setPaymentTypeShouldDoNothingIfThePaymentTypeIsEmpty() { @@ -571,7 +571,7 @@ public function getCancellationShouldReturnCancellationIfItExistsAndFetchItIfNot * @test * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function shipmentsShouldBeHandledProperly() { @@ -657,7 +657,7 @@ public function getAndSetCurrencyShouldPropagateToTheAmountObject() * @param integer $state * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function handleResponseShouldUpdateStateId($state) { @@ -677,7 +677,7 @@ public function handleResponseShouldUpdateStateId($state) * @test * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function handleResponseShouldUpdatePaymentId() { @@ -697,7 +697,7 @@ public function handleResponseShouldUpdatePaymentId() * @test * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. * @throws ReflectionException */ public function handleResponseShouldFetchCustomerIfItIsNotSet() @@ -726,7 +726,7 @@ public function handleResponseShouldFetchCustomerIfItIsNotSet() * @test * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. * @throws ReflectionException */ public function handleResponseShouldFetchAndUpdateCustomerIfItIsAlreadySet() @@ -755,7 +755,7 @@ public function handleResponseShouldFetchAndUpdateCustomerIfItIsAlreadySet() * @test * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. * @throws ReflectionException */ public function handleResponseShouldFetchAndUpdatePaymentTypeIfTheIdIsSet() @@ -782,7 +782,7 @@ public function handleResponseShouldFetchAndUpdatePaymentTypeIfTheIdIsSet() * @test * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. * @throws ReflectionException */ public function handleResponseShouldFetchAndUpdateMetadataIfTheIdIsSet() @@ -805,7 +805,7 @@ public function handleResponseShouldFetchAndUpdateMetadataIfTheIdIsSet() * @test * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. * @throws ReflectionException */ public function handleResponseShouldGetMetadataIfUnfetchedMetadataObjectWithIdIsGiven() @@ -1352,7 +1352,7 @@ public function shipMethodShouldPropagateToHeidelpayChargePaymentMethod() * @test * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. * @throws ReflectionException */ public function setMetaDataShouldSetParentResourceAndCreateMetaDataObject() @@ -1384,7 +1384,7 @@ public function setMetaDataShouldSetParentResourceAndCreateMetaDataObject() * @test * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. * @throws ReflectionException */ public function metadataMustBeOfTypeMetadata() @@ -1421,7 +1421,7 @@ public function metadataMustBeOfTypeMetadata() * @test * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. * @throws ReflectionException */ public function setBasketShouldCallCreateIfTheGivenBasketObjectDoesNotExistYet() @@ -1451,7 +1451,7 @@ static function ($object) use ($basket, $heidelpay) { * @test * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. * @throws ReflectionException */ public function setBasketWontCallResourceServiceWhenBasketIsNull() @@ -1479,7 +1479,7 @@ public function setBasketWontCallResourceServiceWhenBasketIsNull() * @test * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. * @throws ReflectionException */ public function updateResponseResourcesShouldFetchBasketIdIfItIsSetInResponse() diff --git a/test/unit/Resources/PaymentTypes/PayPageTest.php b/test/unit/Resources/PaymentTypes/PayPageTest.php index 9ad830c6..c5a73f5a 100644 --- a/test/unit/Resources/PaymentTypes/PayPageTest.php +++ b/test/unit/Resources/PaymentTypes/PayPageTest.php @@ -320,7 +320,7 @@ public function paymentShouldBeFetchedWhenItIsNoGetRequest($method, $fetchCallCo * * @throws Exception * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function exposeShouldSetBasicParams() { @@ -387,7 +387,7 @@ public function exposeShouldSetBasicParams() * @test * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function resourcesAreNullWithoutPaymentObject() { diff --git a/test/unit/Resources/TransactionTypes/AuthorizationTest.php b/test/unit/Resources/TransactionTypes/AuthorizationTest.php index 8f75f05e..0808b1cd 100755 --- a/test/unit/Resources/TransactionTypes/AuthorizationTest.php +++ b/test/unit/Resources/TransactionTypes/AuthorizationTest.php @@ -195,7 +195,7 @@ public function cancelShouldCallCancelAuthorizationOnHeidelpayObject() * @param float|null $value * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function chargeShouldThrowExceptionIfPaymentIsNotSet($value) { diff --git a/test/unit/Resources/TransactionTypes/ShipmentTest.php b/test/unit/Resources/TransactionTypes/ShipmentTest.php index 635bec45..324ecc30 100755 --- a/test/unit/Resources/TransactionTypes/ShipmentTest.php +++ b/test/unit/Resources/TransactionTypes/ShipmentTest.php @@ -63,7 +63,7 @@ public function gettersAndSettersShouldWorkProperly(): Shipment * * @throws Exception * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. * @depends gettersAndSettersShouldWorkProperly */ public function aShipmentShouldBeUpdatedThroughResponseHandling(Shipment $shipment) diff --git a/test/unit/Services/ResourceServiceTest.php b/test/unit/Services/ResourceServiceTest.php index 3c0a9a08..c37c4637 100755 --- a/test/unit/Services/ResourceServiceTest.php +++ b/test/unit/Services/ResourceServiceTest.php @@ -1224,7 +1224,7 @@ public function updateBasketShouldCallUpdateAndReturnTheGivenBasket() * * @throws Exception * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. * @throws ReflectionException */ public function fetchResourceByUrlShouldFetchTheDesiredResource( @@ -1254,7 +1254,7 @@ public function fetchResourceByUrlShouldFetchTheDesiredResource( * * @throws Exception * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. * @throws ReflectionException */ public function fetchResourceByUrlForAPaymentTypeShouldCallFetchPaymentType($paymentTypeId, $resourceUrl) @@ -1275,7 +1275,7 @@ public function fetchResourceByUrlForAPaymentTypeShouldCallFetchPaymentType($pay * * @throws Exception * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. * @throws ReflectionException */ public function fetchResourceByUrlForAPaymentTypeShouldReturnNullIfTheTypeIsUnknown() @@ -1353,7 +1353,7 @@ public function createRecurringShouldNotFetchThePaymentTypeByObject() * @test * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. * @throws \PHPUnit\Framework\Exception */ public function createRecurringShouldThrowExceptionWhenRecurringPaymentIsNotSupportedByType() diff --git a/test/unit/Traits/CanRecurTest.php b/test/unit/Traits/CanRecurTest.php index 49198971..293bd00f 100644 --- a/test/unit/Traits/CanRecurTest.php +++ b/test/unit/Traits/CanRecurTest.php @@ -59,7 +59,7 @@ public function gettersAndSettersShouldWorkProperly() * @test * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function activateRecurringWillThrowExceptionIfTheObjectHasWrongType() { From 59c1b61fbd3aa5848240fb80c0ff2fdc1db73d9f Mon Sep 17 00:00:00 2001 From: sixer1182 Date: Fri, 13 Dec 2019 13:35:38 +0100 Subject: [PATCH 069/101] [refactor] (PHPLIB-274) Fix typo. --- src/Interfaces/CancelServiceInterface.php | 8 +-- src/Interfaces/PaymentServiceInterface.php | 18 +++---- src/Interfaces/ResourceServiceInterface.php | 54 ++++++++++----------- src/Interfaces/WebhookServiceInterface.php | 16 +++--- src/Resources/Payment.php | 2 +- src/Services/PaymentService.php | 4 +- 6 files changed, 51 insertions(+), 51 deletions(-) diff --git a/src/Interfaces/CancelServiceInterface.php b/src/Interfaces/CancelServiceInterface.php index fcd28c89..858395db 100644 --- a/src/Interfaces/CancelServiceInterface.php +++ b/src/Interfaces/CancelServiceInterface.php @@ -32,7 +32,7 @@ interface CancelServiceInterface * @return Cancellation The resulting Cancellation object. * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function cancelAuthorization(Authorization $authorization, $amount = null): Cancellation; @@ -46,7 +46,7 @@ public function cancelAuthorization(Authorization $authorization, $amount = null * @return Cancellation Resulting Cancellation object. * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function cancelAuthorizationByPayment($payment, $amount = null): Cancellation; @@ -66,7 +66,7 @@ public function cancelAuthorizationByPayment($payment, $amount = null): Cancella * @return Cancellation The resulting Cancellation object. * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function cancelChargeById( $payment, @@ -93,7 +93,7 @@ public function cancelChargeById( * @return Cancellation The resulting Cancellation object. * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function cancelCharge( Charge $charge, diff --git a/src/Interfaces/PaymentServiceInterface.php b/src/Interfaces/PaymentServiceInterface.php index 3e50f2f7..f92f9116 100644 --- a/src/Interfaces/PaymentServiceInterface.php +++ b/src/Interfaces/PaymentServiceInterface.php @@ -63,7 +63,7 @@ interface PaymentServiceInterface * @return Authorization The resulting object of the Authorization resource. * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function authorize( $amount, @@ -100,7 +100,7 @@ public function authorize( * @return Charge The resulting object of the Charge resource. * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function charge( $amount, @@ -128,7 +128,7 @@ public function charge( * @return Charge The resulting object of the Charge resource. * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function chargeAuthorization( $payment, @@ -149,7 +149,7 @@ public function chargeAuthorization( * @return Charge The resulting Charge object. * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function chargePayment( $payment, @@ -178,7 +178,7 @@ public function chargePayment( * @return Payout|AbstractHeidelpayResource The resulting object of the Payout resource. * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function payout( $amount, @@ -203,7 +203,7 @@ public function payout( * @return Shipment The resulting Shipment object. * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function ship($payment, string $invoiceId = null, string $orderId = null): Shipment; @@ -226,7 +226,7 @@ public function ship($payment, string $invoiceId = null, string $orderId = null) * @return Paypage The updated PayPage resource. * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function initPayPageCharge( Paypage $paypage, @@ -254,7 +254,7 @@ public function initPayPageCharge( * @return Paypage The updated PayPage resource. * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function initPayPageAuthorize( Paypage $paypage, @@ -274,7 +274,7 @@ public function initPayPageAuthorize( * @return InstalmentPlans|AbstractHeidelpayResource The object containing all possible instalment plans. * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function fetchDirectDebitInstalmentPlans( $amount, diff --git a/src/Interfaces/ResourceServiceInterface.php b/src/Interfaces/ResourceServiceInterface.php index 035ff16d..3fd56922 100644 --- a/src/Interfaces/ResourceServiceInterface.php +++ b/src/Interfaces/ResourceServiceInterface.php @@ -53,7 +53,7 @@ interface ResourceServiceInterface * @return Payout The Payout object of the given Payment. * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function fetchPayout($payment): Payout; @@ -67,7 +67,7 @@ public function fetchPayout($payment): Payout; * @return Recurring The recurring object. * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function activateRecurringPayment($paymentType, $returnUrl): Recurring; @@ -80,7 +80,7 @@ public function activateRecurringPayment($paymentType, $returnUrl): Recurring; * @return Payment The fetched payment object. * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function fetchPayment($payment): Payment; @@ -92,7 +92,7 @@ public function fetchPayment($payment): Payment; * @return Payment The fetched payment object. * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function fetchPaymentByOrderId($orderId): Payment; @@ -104,7 +104,7 @@ public function fetchPaymentByOrderId($orderId): Payment; * @return Keypair * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function fetchKeypair($detailed = false): Keypair; @@ -116,7 +116,7 @@ public function fetchKeypair($detailed = false): Keypair; * @return Metadata The fetched Metadata resource. * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function createMetadata(Metadata $metadata): Metadata; @@ -128,7 +128,7 @@ public function createMetadata(Metadata $metadata): Metadata; * @return Metadata * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function fetchMetadata($metadata): Metadata; @@ -140,7 +140,7 @@ public function fetchMetadata($metadata): Metadata; * @return Basket The created Basket object. * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function createBasket(Basket $basket): Basket; @@ -152,7 +152,7 @@ public function createBasket(Basket $basket): Basket; * @return Basket The fetched Basket object. * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function fetchBasket($basket): Basket; @@ -164,7 +164,7 @@ public function fetchBasket($basket): Basket; * @return Basket The updated Basket object. * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function updateBasket(Basket $basket): Basket; @@ -176,7 +176,7 @@ public function updateBasket(Basket $basket): Basket; * @return BasePaymentType|AbstractHeidelpayResource * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function createPaymentType(BasePaymentType $paymentType): BasePaymentType; @@ -188,7 +188,7 @@ public function createPaymentType(BasePaymentType $paymentType): BasePaymentType * @return BasePaymentType|AbstractHeidelpayResource * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function fetchPaymentType($typeId): BasePaymentType; @@ -200,7 +200,7 @@ public function fetchPaymentType($typeId): BasePaymentType; * @return BasePaymentType|AbstractHeidelpayResource The updated PaymentType object. * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function updatePaymentType(BasePaymentType $x): BasePaymentType; @@ -212,7 +212,7 @@ public function updatePaymentType(BasePaymentType $x): BasePaymentType; * @return Customer The updated customer object after creation (it should have an id now). * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function createCustomer(Customer $customer): Customer; @@ -224,7 +224,7 @@ public function createCustomer(Customer $customer): Customer; * @return Customer The updated customer object after creation/update. * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function createOrUpdateCustomer(Customer $customer): Customer; @@ -236,7 +236,7 @@ public function createOrUpdateCustomer(Customer $customer): Customer; * @return Customer The fetched customer object. * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function fetchCustomer($customer): Customer; @@ -248,7 +248,7 @@ public function fetchCustomer($customer): Customer; * @return Customer The fetched customer object. * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function fetchCustomerByExtCustomerId($customerId): Customer; @@ -260,7 +260,7 @@ public function fetchCustomerByExtCustomerId($customerId): Customer; * @return Customer The customer object after update. * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function updateCustomer(Customer $customer): Customer; @@ -272,7 +272,7 @@ public function updateCustomer(Customer $customer): Customer; * @return Customer|null The customer object if there was a failure deleting it or null if the deletion succeeded. * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function deleteCustomer($customer); @@ -286,7 +286,7 @@ public function deleteCustomer($customer); * @return Authorization|AbstractHeidelpayResource The fetched authorization. * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function fetchAuthorization($payment): Authorization; @@ -300,7 +300,7 @@ public function fetchAuthorization($payment): Authorization; * @return Charge|AbstractHeidelpayResource The fetched charge. * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function fetchChargeById($payment, $chargeId): Charge; @@ -312,7 +312,7 @@ public function fetchChargeById($payment, $chargeId): Charge; * @return Charge|AbstractHeidelpayResource The fetched charge. * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function fetchCharge(Charge $charge): Charge; @@ -325,7 +325,7 @@ public function fetchCharge(Charge $charge): Charge; * @return Cancellation The fetched cancellation (reversal). * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function fetchReversalByAuthorization($authorization, $cancellationId): Cancellation; @@ -338,7 +338,7 @@ public function fetchReversalByAuthorization($authorization, $cancellationId): C * @return Cancellation The fetched cancellation (reversal). * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function fetchReversal($payment, $cancellationId): Cancellation; @@ -352,7 +352,7 @@ public function fetchReversal($payment, $cancellationId): Cancellation; * @return Cancellation The fetched cancellation (refund). * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function fetchRefundById($payment, $chargeId, $cancellationId): Cancellation; @@ -365,7 +365,7 @@ public function fetchRefundById($payment, $chargeId, $cancellationId): Cancellat * @return Cancellation The fetched cancellation (refund). * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function fetchRefund(Charge $charge, $cancellationId): Cancellation; @@ -378,7 +378,7 @@ public function fetchRefund(Charge $charge, $cancellationId): Cancellation; * @return Shipment The fetched shipment object. * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function fetchShipment($payment, $shipmentId): Shipment; } diff --git a/src/Interfaces/WebhookServiceInterface.php b/src/Interfaces/WebhookServiceInterface.php index 454dd925..d50089c7 100644 --- a/src/Interfaces/WebhookServiceInterface.php +++ b/src/Interfaces/WebhookServiceInterface.php @@ -40,7 +40,7 @@ interface WebhookServiceInterface * @return Webhook The newly created webhook resource. * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function createWebhook(string $url, string $event): Webhook; @@ -53,7 +53,7 @@ public function createWebhook(string $url, string $event): Webhook; * @return Webhook The fetched webhook object. * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function fetchWebhook($webhook): Webhook; @@ -65,7 +65,7 @@ public function fetchWebhook($webhook): Webhook; * @return Webhook The webhook object returned after update. * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function updateWebhook($webhook): Webhook; @@ -77,7 +77,7 @@ public function updateWebhook($webhook): Webhook; * @return Webhook|AbstractHeidelpayResource|null Null if delete succeeded or the webhook object if not. * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function deleteWebhook($webhook); @@ -87,7 +87,7 @@ public function deleteWebhook($webhook); * @return array An array containing all registered webhooks. * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function fetchAllWebhooks(): array; @@ -95,7 +95,7 @@ public function fetchAllWebhooks(): array; * Deletes all registered webhooks. * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function deleteAllWebhooks(); @@ -108,7 +108,7 @@ public function deleteAllWebhooks(); * @return array * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function registerMultipleWebhooks(string $url, array $events): array; @@ -120,7 +120,7 @@ public function registerMultipleWebhooks(string $url, array $events): array; * @return AbstractHeidelpayResource * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function fetchResourceFromEvent($eventJson = null): AbstractHeidelpayResource; } diff --git a/src/Resources/Payment.php b/src/Resources/Payment.php index 516f7abf..f2c8d1a7 100755 --- a/src/Resources/Payment.php +++ b/src/Resources/Payment.php @@ -639,7 +639,7 @@ public function getExternalId() * If more then one cancellation is performed the last one will be returned. * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. * * @deprecated since 1.2.3.0 * @see Payment::cancelAmount() diff --git a/src/Services/PaymentService.php b/src/Services/PaymentService.php index 3a6c727b..e4bbc9d4 100755 --- a/src/Services/PaymentService.php +++ b/src/Services/PaymentService.php @@ -318,7 +318,7 @@ public function fetchDirectDebitInstalmentPlans( * @return Paypage The updated PayPage resource. * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ private function initPayPage( Paypage $paypage, @@ -341,7 +341,7 @@ private function initPayPage( * @return Payment The resulting Payment object. * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ private function createPayment($paymentType): AbstractHeidelpayResource { From c13e06113457f80d1b9a1fb76d6ff02b7bbcc6cb Mon Sep 17 00:00:00 2001 From: sixer1182 Date: Fri, 13 Dec 2019 14:14:26 +0100 Subject: [PATCH 070/101] [refactor] (PHPLIB-274) Fix minor issues. --- examples/Przelewy24/Controller.php | 2 +- src/Services/HttpService.php | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/examples/Przelewy24/Controller.php b/examples/Przelewy24/Controller.php index 8b43020d..8bac4705 100644 --- a/examples/Przelewy24/Controller.php +++ b/examples/Przelewy24/Controller.php @@ -1,6 +1,6 @@ Heidelpay::SDK_VERSION, 'SDK-TYPE' => Heidelpay::SDK_TYPE ]; - /** @noinspection IsEmptyFunctionUsageInspection */ if (!empty($locale)) { $httpHeaders['Accept-Language'] = $locale; } From bbd21b39fc1e0d95d67170c729263e7bf270e021 Mon Sep 17 00:00:00 2001 From: sixer1182 Date: Fri, 13 Dec 2019 14:38:24 +0100 Subject: [PATCH 071/101] [refactor] (PHPLIB-274) Remove dependencies from WeChat Pay tests. --- .../PaymentTypes/WechatpayTest.php | 24 +++++-------------- 1 file changed, 6 insertions(+), 18 deletions(-) diff --git a/test/integration/PaymentTypes/WechatpayTest.php b/test/integration/PaymentTypes/WechatpayTest.php index 8b547a02..222b0e77 100755 --- a/test/integration/PaymentTypes/WechatpayTest.php +++ b/test/integration/PaymentTypes/WechatpayTest.php @@ -28,7 +28,6 @@ use heidelpayPHP\Constants\ApiResponseCodes; use heidelpayPHP\Exceptions\HeidelpayApiException; use heidelpayPHP\Resources\PaymentTypes\Wechatpay; -use heidelpayPHP\Resources\TransactionTypes\Charge; use heidelpayPHP\test\BasePaymentTest; use RuntimeException; @@ -39,12 +38,10 @@ class WechatpayTest extends BasePaymentTest * * @test * - * @return Wechatpay - * * @throws RuntimeException * @throws HeidelpayApiException */ - public function wechatpayShouldBeCreatableAndFetchable(): Wechatpay + public function wechatpayShouldBeCreatableAndFetchable() { $wechatpay = $this->heidelpay->createPaymentType(new Wechatpay()); $this->assertInstanceOf(Wechatpay::class, $wechatpay); @@ -54,8 +51,6 @@ public function wechatpayShouldBeCreatableAndFetchable(): Wechatpay $fetchedWechatpay = $this->heidelpay->fetchPaymentType($wechatpay->getId()); $this->assertInstanceOf(Wechatpay::class, $fetchedWechatpay); $this->assertEquals($wechatpay->expose(), $fetchedWechatpay->expose()); - - return $fetchedWechatpay; } /** @@ -63,22 +58,17 @@ public function wechatpayShouldBeCreatableAndFetchable(): Wechatpay * * @test * - * @param Wechatpay $wechatpay - * - * @return Charge - * * @throws RuntimeException * @throws HeidelpayApiException - * @depends wechatpayShouldBeCreatableAndFetchable */ - public function wechatpayShouldBeAbleToCharge(Wechatpay $wechatpay): Charge + public function wechatpayShouldBeAbleToCharge() { + /** @var Wechatpay $wechatpay */ + $wechatpay = $this->heidelpay->createPaymentType(new Wechatpay()); $charge = $wechatpay->charge(100.0, 'EUR', self::RETURN_URL); $this->assertNotNull($charge); $this->assertNotEmpty($charge->getId()); $this->assertNotEmpty($charge->getRedirectUrl()); - - return $charge; } /** @@ -86,14 +76,12 @@ public function wechatpayShouldBeAbleToCharge(Wechatpay $wechatpay): Charge * * @test * - * @param Wechatpay $wechatpay - * * @throws RuntimeException * @throws HeidelpayApiException - * @depends wechatpayShouldBeCreatableAndFetchable */ - public function wechatpayShouldNotBeAuthorizable(Wechatpay $wechatpay) + public function wechatpayShouldNotBeAuthorizable() { + $wechatpay = $this->heidelpay->createPaymentType(new Wechatpay()); $this->expectException(HeidelpayApiException::class); $this->expectExceptionCode(ApiResponseCodes::API_ERROR_TRANSACTION_AUTHORIZE_NOT_ALLOWED); From e7c98b87a8207d379a3e06892c692eb3c870b7b7 Mon Sep 17 00:00:00 2001 From: sixer1182 Date: Fri, 13 Dec 2019 14:38:50 +0100 Subject: [PATCH 072/101] [refactor] (PHPLIB-274) Refactor exception annotations. --- src/Resources/PaymentTypes/Paypage.php | 4 +- .../AbstractTransactionType.php | 4 +- .../TransactionTypes/Authorization.php | 4 +- src/Services/HttpService.php | 4 +- src/Services/ResourceService.php | 4 +- src/Traits/CanAuthorizeWithCustomer.php | 4 +- src/Traits/CanRecur.php | 4 +- test/BasePaymentTest.php | 4 +- test/integration/BasketTest.php | 8 +- test/integration/KeypairTest.php | 8 +- test/integration/PaymentTest.php | 4 +- test/integration/PaymentTypes/AlipayTest.php | 12 +-- test/integration/PaymentTypes/CardTest.php | 4 +- .../PaymentTypes/InvoiceGuaranteedTest.php | 24 ++--- test/integration/PaymentTypes/PISTest.php | 12 +-- test/integration/PaymentTypes/PaypageTest.php | 16 ++-- test/integration/PaymentTypes/PaypalTest.php | 16 ++-- test/integration/PaymentTypes/SofortTest.php | 12 +-- .../PaymentTypes/WechatpayTest.php | 12 +-- test/integration/RecurringPaymentTest.php | 12 +-- test/integration/SetMetadataTest.php | 12 +-- .../TransactionTypes/AuthorizationTest.php | 4 +- .../CancelAfterAuthorizationTest.php | 4 +- .../CancelAfterChargeTest.php | 8 +- .../TransactionTypes/CancelTest.php | 24 ++--- .../ChargeAfterAuthorizationTest.php | 12 +-- .../TransactionTypes/ChargeTest.php | 8 +- .../TransactionTypes/PayoutTest.php | 12 +-- .../TransactionTypes/ShipmentTest.php | 12 +-- .../AbstractHeidelpayResourceTest.php | 4 +- test/unit/Resources/PaymentCancelTest.php | 4 +- test/unit/Resources/PaymentTest.php | 96 +++++++++---------- .../Resources/PaymentTypes/PayPageTest.php | 16 ++-- .../AbstractTransactionTypeTest.php | 4 +- .../TransactionTypes/AuthorizationTest.php | 8 +- .../TransactionTypes/CancellationTest.php | 4 +- .../Resources/TransactionTypes/ChargeTest.php | 8 +- .../Resources/TransactionTypes/PayoutTest.php | 8 +- test/unit/Services/HttpServiceTest.php | 4 +- test/unit/Services/PaymentServiceTest.php | 20 ++-- test/unit/Services/ResourceServiceTest.php | 12 +-- test/unit/Services/WebhooksServiceTest.php | 8 +- test/unit/Traits/CanAuthorizeTest.php | 4 +- .../Traits/CanAuthorizeWithCustomerTest.php | 4 +- test/unit/Traits/CanDirectChargeTest.php | 4 +- .../CanDirectChargeWithCustomerTest.php | 4 +- test/unit/Traits/CanPayoutTest.php | 4 +- .../unit/Traits/CanPayoutWithCustomerTest.php | 4 +- test/unit/Traits/HasCancellationsTest.php | 4 +- 49 files changed, 246 insertions(+), 246 deletions(-) diff --git a/src/Resources/PaymentTypes/Paypage.php b/src/Resources/PaymentTypes/Paypage.php index 6952cf0f..f7e53a7c 100644 --- a/src/Resources/PaymentTypes/Paypage.php +++ b/src/Resources/PaymentTypes/Paypage.php @@ -635,8 +635,8 @@ public function getLinkedResources(): array * Updates the referenced payment object if it exists and if this is not the payment object itself. * This is called from the crud methods to update the payments state whenever anything happens. * - * @throws RuntimeException - * @throws HeidelpayApiException + * @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. */ private function fetchPayment() { diff --git a/src/Resources/TransactionTypes/AbstractTransactionType.php b/src/Resources/TransactionTypes/AbstractTransactionType.php index 2ce36c7c..9f7a184f 100755 --- a/src/Resources/TransactionTypes/AbstractTransactionType.php +++ b/src/Resources/TransactionTypes/AbstractTransactionType.php @@ -208,8 +208,8 @@ public function getLinkedResources(): array * Updates the referenced payment object if it exists and if this is not the payment object itself. * This is called from the crud methods to update the payments state whenever anything happens. * - * @throws RuntimeException - * @throws HeidelpayApiException + * @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 fetchPayment() { diff --git a/src/Resources/TransactionTypes/Authorization.php b/src/Resources/TransactionTypes/Authorization.php index 6f9de21d..e4625245 100755 --- a/src/Resources/TransactionTypes/Authorization.php +++ b/src/Resources/TransactionTypes/Authorization.php @@ -264,8 +264,8 @@ protected function getResourcePath(): string * * @return Cancellation * - * @throws RuntimeException - * @throws HeidelpayApiException + * @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 cancel($amount = null): Cancellation { diff --git a/src/Services/HttpService.php b/src/Services/HttpService.php index f9f48ff2..deab41ba 100755 --- a/src/Services/HttpService.php +++ b/src/Services/HttpService.php @@ -105,8 +105,8 @@ public function setEnvironmentService(EnvironmentService $environmentService): H * * @return string * - * @throws RuntimeException - * @throws HeidelpayApiException + * @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 send( $uri = null, diff --git a/src/Services/ResourceService.php b/src/Services/ResourceService.php index 800d31b1..3a1a81a3 100755 --- a/src/Services/ResourceService.php +++ b/src/Services/ResourceService.php @@ -150,8 +150,8 @@ public function getResource(AbstractHeidelpayResource $resource): AbstractHeidel * * @return AbstractHeidelpayResource|null * - * @throws RuntimeException - * @throws HeidelpayApiException + * @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 fetchResourceByUrl($url) { diff --git a/src/Traits/CanAuthorizeWithCustomer.php b/src/Traits/CanAuthorizeWithCustomer.php index 100e7634..4a69e240 100755 --- a/src/Traits/CanAuthorizeWithCustomer.php +++ b/src/Traits/CanAuthorizeWithCustomer.php @@ -52,8 +52,8 @@ trait CanAuthorizeWithCustomer * * @return Authorization * - * @throws RuntimeException - * @throws HeidelpayApiException + * @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 authorize( $amount, diff --git a/src/Traits/CanRecur.php b/src/Traits/CanRecur.php index e49f478e..9ea2adab 100644 --- a/src/Traits/CanRecur.php +++ b/src/Traits/CanRecur.php @@ -41,8 +41,8 @@ trait CanRecur * * @return Recurring * - * @throws RuntimeException - * @throws HeidelpayApiException + * @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 activateRecurring($returnUrl): Recurring { diff --git a/test/BasePaymentTest.php b/test/BasePaymentTest.php index db45a2a8..34faf0af 100755 --- a/test/BasePaymentTest.php +++ b/test/BasePaymentTest.php @@ -249,8 +249,8 @@ public function createCardAuthorization($amount = 100.0): Authorization * * @return Authorization * - * @throws RuntimeException - * @throws HeidelpayApiException + * @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 createPaypalAuthorization(): Authorization { diff --git a/test/integration/BasketTest.php b/test/integration/BasketTest.php index db58639a..cd09af81 100755 --- a/test/integration/BasketTest.php +++ b/test/integration/BasketTest.php @@ -42,8 +42,8 @@ class BasketTest extends BasePaymentTest * * @test * - * @throws RuntimeException - * @throws HeidelpayApiException + * @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 minBasketShouldBeCreatableAndFetchable() { @@ -69,8 +69,8 @@ public function minBasketShouldBeCreatableAndFetchable() * * @test * - * @throws RuntimeException - * @throws HeidelpayApiException + * @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 maxBasketShouldBeCreatableAndFetchableWorkAround() { diff --git a/test/integration/KeypairTest.php b/test/integration/KeypairTest.php index 82c0464f..dcbda170 100644 --- a/test/integration/KeypairTest.php +++ b/test/integration/KeypairTest.php @@ -68,8 +68,8 @@ public function invalidKeysShouldResultInException($key) * * @test * - * @throws RuntimeException - * @throws HeidelpayApiException + * @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 keypairShouldReturnExpectedValues() { @@ -86,8 +86,8 @@ public function keypairShouldReturnExpectedValues() * * @test * - * @throws RuntimeException - * @throws HeidelpayApiException + * @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 keypairShouldBeFetchableWithDetails() { diff --git a/test/integration/PaymentTest.php b/test/integration/PaymentTest.php index b513e10e..037e619c 100755 --- a/test/integration/PaymentTest.php +++ b/test/integration/PaymentTest.php @@ -223,8 +223,8 @@ public function apiShouldReturnErrorIfOrderIdAlreadyExists() * * @test * - * @throws RuntimeException - * @throws HeidelpayApiException + * @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 paymentShouldBeFetchedByOrderIdIfIdIsNotSet() { diff --git a/test/integration/PaymentTypes/AlipayTest.php b/test/integration/PaymentTypes/AlipayTest.php index e8ec06af..0ac735a0 100755 --- a/test/integration/PaymentTypes/AlipayTest.php +++ b/test/integration/PaymentTypes/AlipayTest.php @@ -41,8 +41,8 @@ class AlipayTest extends BasePaymentTest * * @return Alipay * - * @throws RuntimeException - * @throws HeidelpayApiException + * @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 alipayShouldBeCreatableAndFetchable(): Alipay { @@ -67,8 +67,8 @@ public function alipayShouldBeCreatableAndFetchable(): Alipay * * @return Charge * - * @throws RuntimeException - * @throws HeidelpayApiException + * @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. * @depends alipayShouldBeCreatableAndFetchable */ public function alipayShouldBeAbleToCharge(Alipay $alipay): Charge @@ -88,8 +88,8 @@ public function alipayShouldBeAbleToCharge(Alipay $alipay): Charge * * @param Alipay $alipay * - * @throws RuntimeException - * @throws HeidelpayApiException + * @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. * @depends alipayShouldBeCreatableAndFetchable */ public function alipayShouldNotBeAuthorizable(Alipay $alipay) diff --git a/test/integration/PaymentTypes/CardTest.php b/test/integration/PaymentTypes/CardTest.php index 14d2d838..b901886d 100755 --- a/test/integration/PaymentTypes/CardTest.php +++ b/test/integration/PaymentTypes/CardTest.php @@ -76,8 +76,8 @@ public function cardShouldBeCreatable(string $cardNumber, CardDetails $expectedC * * @test * - * @throws RuntimeException - * @throws HeidelpayApiException + * @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 cardWith3dsFlagShouldSetItAlsoInTransactions() { diff --git a/test/integration/PaymentTypes/InvoiceGuaranteedTest.php b/test/integration/PaymentTypes/InvoiceGuaranteedTest.php index 90981c6d..9a44d60c 100755 --- a/test/integration/PaymentTypes/InvoiceGuaranteedTest.php +++ b/test/integration/PaymentTypes/InvoiceGuaranteedTest.php @@ -37,8 +37,8 @@ class InvoiceGuaranteedTest extends BasePaymentTest * * @test * - * @throws RuntimeException - * @throws HeidelpayApiException + * @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 invoiceGuaranteedTypeShouldBeCreatable() { @@ -53,8 +53,8 @@ public function invoiceGuaranteedTypeShouldBeCreatable() * * @test * - * @throws RuntimeException - * @throws HeidelpayApiException + * @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 verifyInvoiceGuaranteedShipment() { @@ -78,8 +78,8 @@ public function verifyInvoiceGuaranteedShipment() * * @test * - * @throws RuntimeException - * @throws HeidelpayApiException + * @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 verifyInvoiceGuaranteedCanBeChargedAndCancelled() { @@ -98,8 +98,8 @@ public function verifyInvoiceGuaranteedCanBeChargedAndCancelled() * * @test * - * @throws RuntimeException - * @throws HeidelpayApiException + * @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 invoiceGuaranteedTypeCanBeFetched() { @@ -115,8 +115,8 @@ public function invoiceGuaranteedTypeCanBeFetched() * * @test * - * @throws RuntimeException - * @throws HeidelpayApiException + * @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 ivgShouldThrowErrorIfAddressesDoNotMatch() { @@ -134,8 +134,8 @@ public function ivgShouldThrowErrorIfAddressesDoNotMatch() * * @test * - * @throws RuntimeException - * @throws HeidelpayApiException + * @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 verifyInvoiceIdInShipmentWillOverrideTheOneFromCharge() { diff --git a/test/integration/PaymentTypes/PISTest.php b/test/integration/PaymentTypes/PISTest.php index d938646e..49a4c773 100755 --- a/test/integration/PaymentTypes/PISTest.php +++ b/test/integration/PaymentTypes/PISTest.php @@ -41,8 +41,8 @@ class PISTest extends BasePaymentTest * * @return PIS * - * @throws RuntimeException - * @throws HeidelpayApiException + * @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 pisShouldBeCreatableAndFetchable(): PIS { @@ -67,8 +67,8 @@ public function pisShouldBeCreatableAndFetchable(): PIS * * @return Charge * - * @throws RuntimeException - * @throws HeidelpayApiException + * @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. * @depends pisShouldBeCreatableAndFetchable */ public function pisShouldBeAbleToCharge(PIS $pis): Charge @@ -88,8 +88,8 @@ public function pisShouldBeAbleToCharge(PIS $pis): Charge * * @param PIS $pis * - * @throws RuntimeException - * @throws HeidelpayApiException + * @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. * @depends pisShouldBeCreatableAndFetchable */ public function pisShouldNotBeAuthorizable(PIS $pis) diff --git a/test/integration/PaymentTypes/PaypageTest.php b/test/integration/PaymentTypes/PaypageTest.php index 5ed266d3..e009f1c2 100644 --- a/test/integration/PaymentTypes/PaypageTest.php +++ b/test/integration/PaymentTypes/PaypageTest.php @@ -41,8 +41,8 @@ class PaypageTest extends BasePaymentTest * @test * * @throws AssertionFailedError - * @throws RuntimeException - * @throws HeidelpayApiException + * @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 minimalPaypageChargeShouldBeCreatableAndFetchable() { @@ -58,8 +58,8 @@ public function minimalPaypageChargeShouldBeCreatableAndFetchable() * @test * * @throws AssertionFailedError - * @throws RuntimeException - * @throws HeidelpayApiException + * @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 maximumPaypageChargeShouldBeCreatable() { @@ -98,8 +98,8 @@ public function maximumPaypageChargeShouldBeCreatable() * @test * * @throws AssertionFailedError - * @throws RuntimeException - * @throws HeidelpayApiException + * @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 minimalPaypageAuthorizeShouldBeCreatableAndFetchable() { @@ -115,8 +115,8 @@ public function minimalPaypageAuthorizeShouldBeCreatableAndFetchable() * @test * * @throws AssertionFailedError - * @throws RuntimeException - * @throws HeidelpayApiException + * @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 maximumPaypageAuthorizeShouldBeCreatable() { diff --git a/test/integration/PaymentTypes/PaypalTest.php b/test/integration/PaymentTypes/PaypalTest.php index 9a87880d..54b32ba3 100755 --- a/test/integration/PaymentTypes/PaypalTest.php +++ b/test/integration/PaymentTypes/PaypalTest.php @@ -39,8 +39,8 @@ class PaypalTest extends BasePaymentTest * * @return BasePaymentType * - * @throws RuntimeException - * @throws HeidelpayApiException + * @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 paypalShouldBeCreatableAndFetchable(): BasePaymentType { @@ -63,8 +63,8 @@ public function paypalShouldBeCreatableAndFetchable(): BasePaymentType * * @return BasePaymentType * - * @throws RuntimeException - * @throws HeidelpayApiException + * @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 paypalShouldBeCreatableAndFetchableWithEmail(): BasePaymentType { @@ -88,8 +88,8 @@ public function paypalShouldBeCreatableAndFetchableWithEmail(): BasePaymentType * * @param Paypal $paypal * - * @throws RuntimeException - * @throws HeidelpayApiException + * @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 paypalShouldBeAuthorizable(Paypal $paypal) { @@ -111,8 +111,8 @@ public function paypalShouldBeAuthorizable(Paypal $paypal) * * @param Paypal $paypal * - * @throws RuntimeException - * @throws HeidelpayApiException + * @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 paypalShouldBeChargeable(Paypal $paypal) { diff --git a/test/integration/PaymentTypes/SofortTest.php b/test/integration/PaymentTypes/SofortTest.php index 24eff66c..33119789 100755 --- a/test/integration/PaymentTypes/SofortTest.php +++ b/test/integration/PaymentTypes/SofortTest.php @@ -41,8 +41,8 @@ class SofortTest extends BasePaymentTest * * @return Sofort * - * @throws RuntimeException - * @throws HeidelpayApiException + * @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 sofortShouldBeCreatableAndFetchable(): Sofort { @@ -67,8 +67,8 @@ public function sofortShouldBeCreatableAndFetchable(): Sofort * * @return Charge * - * @throws RuntimeException - * @throws HeidelpayApiException + * @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. * @depends sofortShouldBeCreatableAndFetchable */ public function sofortShouldBeAbleToCharge(Sofort $sofort): Charge @@ -88,8 +88,8 @@ public function sofortShouldBeAbleToCharge(Sofort $sofort): Charge * * @param Sofort $sofort * - * @throws RuntimeException - * @throws HeidelpayApiException + * @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. * @depends sofortShouldBeCreatableAndFetchable */ public function sofortShouldNotBeAuthorizable(Sofort $sofort) diff --git a/test/integration/PaymentTypes/WechatpayTest.php b/test/integration/PaymentTypes/WechatpayTest.php index 222b0e77..fe73691b 100755 --- a/test/integration/PaymentTypes/WechatpayTest.php +++ b/test/integration/PaymentTypes/WechatpayTest.php @@ -38,8 +38,8 @@ class WechatpayTest extends BasePaymentTest * * @test * - * @throws RuntimeException - * @throws HeidelpayApiException + * @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 wechatpayShouldBeCreatableAndFetchable() { @@ -58,8 +58,8 @@ public function wechatpayShouldBeCreatableAndFetchable() * * @test * - * @throws RuntimeException - * @throws HeidelpayApiException + * @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 wechatpayShouldBeAbleToCharge() { @@ -76,8 +76,8 @@ public function wechatpayShouldBeAbleToCharge() * * @test * - * @throws RuntimeException - * @throws HeidelpayApiException + * @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 wechatpayShouldNotBeAuthorizable() { diff --git a/test/integration/RecurringPaymentTest.php b/test/integration/RecurringPaymentTest.php index bdff798e..ff0ebd94 100644 --- a/test/integration/RecurringPaymentTest.php +++ b/test/integration/RecurringPaymentTest.php @@ -55,8 +55,8 @@ public function exceptionShouldBeThrownIfTheObjectIsNotAResource() * * @test * - * @throws RuntimeException - * @throws HeidelpayApiException + * @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 recurringForCardWith3dsShouldReturnRedirectURL() { @@ -72,8 +72,8 @@ public function recurringForCardWith3dsShouldReturnRedirectURL() * * @test * - * @throws RuntimeException - * @throws HeidelpayApiException + * @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. * * @group skip */ @@ -96,8 +96,8 @@ public function recurringForCardWithout3dsShouldActivateRecurringAtOnce() * * @test * - * @throws RuntimeException - * @throws HeidelpayApiException + * @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 paypalShouldBeAbleToActivateRecurringPayments() { diff --git a/test/integration/SetMetadataTest.php b/test/integration/SetMetadataTest.php index 933f03d2..6ac44123 100755 --- a/test/integration/SetMetadataTest.php +++ b/test/integration/SetMetadataTest.php @@ -38,8 +38,8 @@ class SetMetadataTest extends BasePaymentTest * * @test * - * @throws RuntimeException - * @throws HeidelpayApiException + * @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 metadataShouldBeCreatableAndFetchableWithTheApi() { @@ -72,8 +72,8 @@ public function metadataShouldBeCreatableAndFetchableWithTheApi() * * @test * - * @throws RuntimeException - * @throws HeidelpayApiException + * @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 authorizeShouldCreateMetadata() { @@ -94,8 +94,8 @@ public function authorizeShouldCreateMetadata() * * @test * - * @throws RuntimeException - * @throws HeidelpayApiException + * @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 chargeShouldCreateMetadata() { diff --git a/test/integration/TransactionTypes/AuthorizationTest.php b/test/integration/TransactionTypes/AuthorizationTest.php index ba437efc..c1991dd2 100644 --- a/test/integration/TransactionTypes/AuthorizationTest.php +++ b/test/integration/TransactionTypes/AuthorizationTest.php @@ -43,8 +43,8 @@ class AuthorizationTest extends BasePaymentTest * * @test * - * @throws RuntimeException - * @throws HeidelpayApiException + * @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 authorizeWithTypeId() { diff --git a/test/integration/TransactionTypes/CancelAfterAuthorizationTest.php b/test/integration/TransactionTypes/CancelAfterAuthorizationTest.php index 581a8c96..db0c4241 100644 --- a/test/integration/TransactionTypes/CancelAfterAuthorizationTest.php +++ b/test/integration/TransactionTypes/CancelAfterAuthorizationTest.php @@ -37,8 +37,8 @@ class CancelAfterAuthorizationTest extends BasePaymentTest * * @test * - * @throws RuntimeException - * @throws HeidelpayApiException + * @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 fullCancelOnAuthorization() { diff --git a/test/integration/TransactionTypes/CancelAfterChargeTest.php b/test/integration/TransactionTypes/CancelAfterChargeTest.php index 3dc7ec25..157ce73d 100644 --- a/test/integration/TransactionTypes/CancelAfterChargeTest.php +++ b/test/integration/TransactionTypes/CancelAfterChargeTest.php @@ -63,8 +63,8 @@ public function chargeShouldBeFetchable(): Charge * * @param Charge $charge * - * @throws RuntimeException - * @throws HeidelpayApiException + * @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 chargeShouldBeFullyRefundable(Charge $charge) { @@ -79,8 +79,8 @@ public function chargeShouldBeFullyRefundable(Charge $charge) * * @test * - * @throws RuntimeException - * @throws HeidelpayApiException + * @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 chargeShouldBeFullyRefundableWithId() { diff --git a/test/integration/TransactionTypes/CancelTest.php b/test/integration/TransactionTypes/CancelTest.php index 9a771150..b44e0d68 100644 --- a/test/integration/TransactionTypes/CancelTest.php +++ b/test/integration/TransactionTypes/CancelTest.php @@ -35,8 +35,8 @@ class CancelTest extends BasePaymentTest * * @test * - * @throws RuntimeException - * @throws HeidelpayApiException + * @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 reversalShouldBeFetchableViaHeidelpayObject() { @@ -52,8 +52,8 @@ public function reversalShouldBeFetchableViaHeidelpayObject() * * @test * - * @throws RuntimeException - * @throws HeidelpayApiException + * @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 reversalShouldBeFetchableViaPaymentObject() { @@ -69,8 +69,8 @@ public function reversalShouldBeFetchableViaPaymentObject() * * @test * - * @throws RuntimeException - * @throws HeidelpayApiException + * @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 refundShouldBeFetchableViaHeidelpayObject() { @@ -86,8 +86,8 @@ public function refundShouldBeFetchableViaHeidelpayObject() * * @test * - * @throws RuntimeException - * @throws HeidelpayApiException + * @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 refundShouldBeFetchableViaPaymentObject() { @@ -103,8 +103,8 @@ public function refundShouldBeFetchableViaPaymentObject() * * @test * - * @throws RuntimeException - * @throws HeidelpayApiException + * @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 authorizationCancellationsShouldBeFetchableViaPaymentObject() { @@ -122,8 +122,8 @@ public function authorizationCancellationsShouldBeFetchableViaPaymentObject() * * @test * - * @throws RuntimeException - * @throws HeidelpayApiException + * @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 chargeCancellationsShouldBeFetchableViaPaymentObject() { diff --git a/test/integration/TransactionTypes/ChargeAfterAuthorizationTest.php b/test/integration/TransactionTypes/ChargeAfterAuthorizationTest.php index ed6e7123..98e94b8c 100644 --- a/test/integration/TransactionTypes/ChargeAfterAuthorizationTest.php +++ b/test/integration/TransactionTypes/ChargeAfterAuthorizationTest.php @@ -35,8 +35,8 @@ class ChargeAfterAuthorizationTest extends BasePaymentTest * * @test * - * @throws RuntimeException - * @throws HeidelpayApiException + * @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 authorizationShouldBeFullyChargeable() { @@ -58,8 +58,8 @@ public function authorizationShouldBeFullyChargeable() * * @test * - * @throws RuntimeException - * @throws HeidelpayApiException + * @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 authorizationShouldBeFullyChargeableViaHeidelpayObject() { @@ -81,8 +81,8 @@ public function authorizationShouldBeFullyChargeableViaHeidelpayObject() * * @test * - * @throws RuntimeException - * @throws HeidelpayApiException + * @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 authorizationShouldBePartlyChargeable() { diff --git a/test/integration/TransactionTypes/ChargeTest.php b/test/integration/TransactionTypes/ChargeTest.php index 00588fbd..a5c0e027 100644 --- a/test/integration/TransactionTypes/ChargeTest.php +++ b/test/integration/TransactionTypes/ChargeTest.php @@ -40,8 +40,8 @@ class ChargeTest extends BasePaymentTest * * @test * - * @throws RuntimeException - * @throws HeidelpayApiException + * @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 chargeShouldWorkWithTypeId() { @@ -58,8 +58,8 @@ public function chargeShouldWorkWithTypeId() * * @test * - * @throws RuntimeException - * @throws HeidelpayApiException + * @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 chargeShouldWorkWithTypeObject() { diff --git a/test/integration/TransactionTypes/PayoutTest.php b/test/integration/TransactionTypes/PayoutTest.php index 3e9ce297..cec76e23 100644 --- a/test/integration/TransactionTypes/PayoutTest.php +++ b/test/integration/TransactionTypes/PayoutTest.php @@ -43,8 +43,8 @@ class PayoutTest extends BasePaymentTest * * @test * - * @throws RuntimeException - * @throws HeidelpayApiException + * @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 payoutCanBeCalledForCardType() { @@ -66,8 +66,8 @@ public function payoutCanBeCalledForCardType() * * @test * - * @throws RuntimeException - * @throws HeidelpayApiException + * @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 payoutCanBeCalledForSepaDirectDebitType() { @@ -88,8 +88,8 @@ public function payoutCanBeCalledForSepaDirectDebitType() * * @test * - * @throws RuntimeException - * @throws HeidelpayApiException + * @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 payoutCanBeCalledForSepaDirectDebitGuaranteedType() { diff --git a/test/integration/TransactionTypes/ShipmentTest.php b/test/integration/TransactionTypes/ShipmentTest.php index 912b66fc..d3c2063f 100644 --- a/test/integration/TransactionTypes/ShipmentTest.php +++ b/test/integration/TransactionTypes/ShipmentTest.php @@ -36,8 +36,8 @@ class ShipmentTest extends BasePaymentTest * * @test * - * @throws RuntimeException - * @throws HeidelpayApiException + * @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 shipmentShouldBeCreatableAndFetchable() { @@ -62,8 +62,8 @@ public function shipmentShouldBeCreatableAndFetchable() * * @test * - * @throws RuntimeException - * @throws HeidelpayApiException + * @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 shipmentCanBeCalledOnThePaymentObject() { @@ -88,8 +88,8 @@ public function shipmentCanBeCalledOnThePaymentObject() * * @test * - * @throws RuntimeException - * @throws HeidelpayApiException + * @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 shipmentShouldBePossibleWithPaymentObject() { diff --git a/test/unit/Resources/AbstractHeidelpayResourceTest.php b/test/unit/Resources/AbstractHeidelpayResourceTest.php index 58594fd2..419a8bec 100755 --- a/test/unit/Resources/AbstractHeidelpayResourceTest.php +++ b/test/unit/Resources/AbstractHeidelpayResourceTest.php @@ -405,8 +405,8 @@ public function moreThenFourDecimalPlaces() * @test * * @throws Exception - * @throws RuntimeException - * @throws HeidelpayApiException + * @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 additionalAttributesShouldBeSettable() { diff --git a/test/unit/Resources/PaymentCancelTest.php b/test/unit/Resources/PaymentCancelTest.php index e7be6e71..d8edd689 100644 --- a/test/unit/Resources/PaymentCancelTest.php +++ b/test/unit/Resources/PaymentCancelTest.php @@ -70,8 +70,8 @@ public function cancelShouldCallCancelAllChargesAndCancelAuthorizationAndReturnF * @test * * @throws ReflectionException - * @throws RuntimeException - * @throws HeidelpayApiException + * @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. * * @deprecated since 1.2.3.0 */ diff --git a/test/unit/Resources/PaymentTest.php b/test/unit/Resources/PaymentTest.php index f76f3153..be7da771 100755 --- a/test/unit/Resources/PaymentTest.php +++ b/test/unit/Resources/PaymentTest.php @@ -54,8 +54,8 @@ class PaymentTest extends BasePaymentTest * * @test * - * @throws RuntimeException - * @throws HeidelpayApiException + * @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 gettersAndSettersShouldWorkProperly() { @@ -83,8 +83,8 @@ public function gettersAndSettersShouldWorkProperly() * @test * * @throws ReflectionException - * @throws RuntimeException - * @throws HeidelpayApiException + * @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 getAuthorizationShouldFetchAuthorizeIfNotLazyAndAuthIsNotNull() { @@ -109,8 +109,8 @@ public function getAuthorizationShouldFetchAuthorizeIfNotLazyAndAuthIsNotNull() * @test * * @throws ReflectionException - * @throws RuntimeException - * @throws HeidelpayApiException + * @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 getAuthorizationShouldNotFetchAuthorizeIfNotLazyAndAuthIsNull() { @@ -253,8 +253,8 @@ public function getChargeMethodsShouldReturnNullIfTheChargeIdUnknown() * @test * * @throws ReflectionException - * @throws RuntimeException - * @throws HeidelpayApiException + * @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 getPayoutShouldFetchPayoutIfNotLazyAndPayoutIsNotNull() { @@ -278,8 +278,8 @@ public function getPayoutShouldFetchPayoutIfNotLazyAndPayoutIsNotNull() * @test * * @throws ReflectionException - * @throws RuntimeException - * @throws HeidelpayApiException + * @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 getPayoutShouldNotFetchPayoutIfNotLazyAndPayoutIsNull() { @@ -325,8 +325,8 @@ public function setCustomerShouldDoNothingIfTheCustomerIsEmpty() * @test * * @throws ReflectionException - * @throws RuntimeException - * @throws HeidelpayApiException + * @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 setCustomerShouldFetchCustomerIfItIsPassedAsIdString() { @@ -349,8 +349,8 @@ public function setCustomerShouldFetchCustomerIfItIsPassedAsIdString() * @test * * @throws ReflectionException - * @throws RuntimeException - * @throws HeidelpayApiException + * @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 setCustomerShouldCreateCustomerIfItIsPassedAsObjectWithoutId() { @@ -398,8 +398,8 @@ public function setPaymentTypeShouldDoNothingIfThePaymentTypeIsEmpty() * @test * * @throws ReflectionException - * @throws RuntimeException - * @throws HeidelpayApiException + * @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 setPaymentTypeShouldFetchResourceIfItIsPassedAsIdString() { @@ -422,8 +422,8 @@ public function setPaymentTypeShouldFetchResourceIfItIsPassedAsIdString() * @test * * @throws ReflectionException - * @throws RuntimeException - * @throws HeidelpayApiException + * @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 setPaymentTypeShouldCreateResourceIfItIsPassedAsObjectWithoutId() { @@ -829,8 +829,8 @@ public function handleResponseShouldGetMetadataIfUnfetchedMetadataObjectWithIdIs * * @test * - * @throws RuntimeException - * @throws HeidelpayApiException + * @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 handleResponseShouldUpdateChargeTransactions() { @@ -855,8 +855,8 @@ public function handleResponseShouldUpdateChargeTransactions() * * @test * - * @throws RuntimeException - * @throws HeidelpayApiException + * @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 handleResponseShouldUpdateAuthorizationFromResponse() { @@ -887,8 +887,8 @@ public function handleResponseShouldUpdateAuthorizationFromResponse() * * @test * - * @throws RuntimeException - * @throws HeidelpayApiException + * @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 handleResponseShouldAddAuthorizationFromResponse() { @@ -918,8 +918,8 @@ public function handleResponseShouldAddAuthorizationFromResponse() * * @test * - * @throws RuntimeException - * @throws HeidelpayApiException + * @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 handleResponseShouldUpdateChargeFromResponseIfItExists() { @@ -952,8 +952,8 @@ public function handleResponseShouldUpdateChargeFromResponseIfItExists() * * @test * - * @throws RuntimeException - * @throws HeidelpayApiException + * @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 handleResponseShouldAddChargeFromResponseIfItDoesNotExists() { @@ -985,8 +985,8 @@ public function handleResponseShouldAddChargeFromResponseIfItDoesNotExists() * * @test * - * @throws RuntimeException - * @throws HeidelpayApiException + * @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 handleResponseShouldUpdateReversalFromResponseIfItExists() { @@ -1020,8 +1020,8 @@ public function handleResponseShouldUpdateReversalFromResponseIfItExists() * * @test * - * @throws RuntimeException - * @throws HeidelpayApiException + * @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 handleResponseShouldAddReversalFromResponseIfItDoesNotExists() { @@ -1056,8 +1056,8 @@ public function handleResponseShouldAddReversalFromResponseIfItDoesNotExists() * * @test * - * @throws RuntimeException - * @throws HeidelpayApiException + * @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 handleResponseShouldThrowExceptionIfAnAuthorizeToAReversalDoesNotExist() { @@ -1082,8 +1082,8 @@ public function handleResponseShouldThrowExceptionIfAnAuthorizeToAReversalDoesNo * * @test * - * @throws RuntimeException - * @throws HeidelpayApiException + * @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 handleResponseShouldUpdateRefundsFromResponseIfItExists() { @@ -1117,8 +1117,8 @@ public function handleResponseShouldUpdateRefundsFromResponseIfItExists() * * @test * - * @throws RuntimeException - * @throws HeidelpayApiException + * @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 handleResponseShouldAddRefundFromResponseIfItDoesNotExists() { @@ -1153,8 +1153,8 @@ public function handleResponseShouldAddRefundFromResponseIfItDoesNotExists() * * @test * - * @throws RuntimeException - * @throws HeidelpayApiException + * @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 handleResponseShouldThrowExceptionIfAChargeToARefundDoesNotExist() { @@ -1179,8 +1179,8 @@ public function handleResponseShouldThrowExceptionIfAChargeToARefundDoesNotExist * * @test * - * @throws RuntimeException - * @throws HeidelpayApiException + * @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 handleResponseShouldUpdateShipmentFromResponseIfItExists() { @@ -1210,8 +1210,8 @@ public function handleResponseShouldUpdateShipmentFromResponseIfItExists() * * @test * - * @throws RuntimeException - * @throws HeidelpayApiException + * @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 handleResponseShouldAddShipmentFromResponseIfItDoesNotExists() { @@ -1240,8 +1240,8 @@ public function handleResponseShouldAddShipmentFromResponseIfItDoesNotExists() * * @test * - * @throws RuntimeException - * @throws HeidelpayApiException + * @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 handleResponseShouldUpdatePayoutFromResponseIfItExists() { @@ -1271,8 +1271,8 @@ public function handleResponseShouldUpdatePayoutFromResponseIfItExists() * * @test * - * @throws RuntimeException - * @throws HeidelpayApiException + * @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 handleResponseShouldAddPayoutFromResponseIfItDoesNotExists() { diff --git a/test/unit/Resources/PaymentTypes/PayPageTest.php b/test/unit/Resources/PaymentTypes/PayPageTest.php index 16904caa..a23719d6 100644 --- a/test/unit/Resources/PaymentTypes/PayPageTest.php +++ b/test/unit/Resources/PaymentTypes/PayPageTest.php @@ -150,8 +150,8 @@ public function getterAndSetterWorkAsExpected() * * @test * - * @throws RuntimeException - * @throws HeidelpayApiException + * @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 responseHandlingShouldWorkProperly() { @@ -228,8 +228,8 @@ public function responseHandlingShouldWorkProperly() * * @test * - * @throws RuntimeException - * @throws HeidelpayApiException + * @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 paymentObjectShouldBeUpdatedProperly() { @@ -263,8 +263,8 @@ public function paymentObjectShouldBeUpdatedProperly() * * @test * - * @throws RuntimeException - * @throws HeidelpayApiException + * @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 responseHandlingShouldMapSpecialFieldsProperly() { @@ -290,8 +290,8 @@ public function responseHandlingShouldMapSpecialFieldsProperly() * @param mixed $fetchCallCount * *@throws ReflectionException - * @throws RuntimeException - * @throws HeidelpayApiException + * @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 paymentShouldBeFetchedWhenItIsNoGetRequest($method, $fetchCallCount) { diff --git a/test/unit/Resources/TransactionTypes/AbstractTransactionTypeTest.php b/test/unit/Resources/TransactionTypes/AbstractTransactionTypeTest.php index 5aa51f9d..ee78a54c 100755 --- a/test/unit/Resources/TransactionTypes/AbstractTransactionTypeTest.php +++ b/test/unit/Resources/TransactionTypes/AbstractTransactionTypeTest.php @@ -112,8 +112,8 @@ public function getRedirectUrlShouldCallPaymentGetRedirectUrl() * * @test * - * @throws RuntimeException - * @throws HeidelpayApiException + * @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 handleResponseShouldUpdateValuesOfAbstractTransaction() { diff --git a/test/unit/Resources/TransactionTypes/AuthorizationTest.php b/test/unit/Resources/TransactionTypes/AuthorizationTest.php index 0808b1cd..1967e803 100755 --- a/test/unit/Resources/TransactionTypes/AuthorizationTest.php +++ b/test/unit/Resources/TransactionTypes/AuthorizationTest.php @@ -77,8 +77,8 @@ public function gettersAndSettersShouldWorkProperly() * * @test * - * @throws RuntimeException - * @throws HeidelpayApiException + * @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 anAuthorizationShouldBeUpdatedThroughResponseHandling() { @@ -137,8 +137,8 @@ public function getLinkedResourcesShouldThrowExceptionWhenThePaymentTypeIsNotSet * @test * * @throws Exception - * @throws RuntimeException - * @throws HeidelpayApiException + * @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 getLinkedResourceShouldReturnResourcesBelongingToAuthorization() { diff --git a/test/unit/Resources/TransactionTypes/CancellationTest.php b/test/unit/Resources/TransactionTypes/CancellationTest.php index ce462e89..c2104595 100755 --- a/test/unit/Resources/TransactionTypes/CancellationTest.php +++ b/test/unit/Resources/TransactionTypes/CancellationTest.php @@ -85,8 +85,8 @@ public function gettersAndSettersShouldWorkProperly() * @test * * @throws Exception - * @throws RuntimeException - * @throws HeidelpayApiException + * @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. * @throws ReflectionException */ public function exposeWillReplaceAmountWithAmountGross() diff --git a/test/unit/Resources/TransactionTypes/ChargeTest.php b/test/unit/Resources/TransactionTypes/ChargeTest.php index 6e542d74..b7eae7e4 100755 --- a/test/unit/Resources/TransactionTypes/ChargeTest.php +++ b/test/unit/Resources/TransactionTypes/ChargeTest.php @@ -80,8 +80,8 @@ public function gettersAndSettersShouldWorkProperly() * * @test * - * @throws RuntimeException - * @throws HeidelpayApiException + * @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 aChargeShouldBeUpdatedThroughResponseHandling() { @@ -138,8 +138,8 @@ public function getLinkedResourcesShouldThrowExceptionWhenThePaymentTypeIsNotSet * * @test * - * @throws RuntimeException - * @throws HeidelpayApiException + * @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 getLinkedResourceShouldReturnResourcesBelongingToCharge() { diff --git a/test/unit/Resources/TransactionTypes/PayoutTest.php b/test/unit/Resources/TransactionTypes/PayoutTest.php index 2b6a6865..5b45d91e 100644 --- a/test/unit/Resources/TransactionTypes/PayoutTest.php +++ b/test/unit/Resources/TransactionTypes/PayoutTest.php @@ -71,8 +71,8 @@ public function gettersAndSettersShouldWorkProperly() * * @test * - * @throws RuntimeException - * @throws HeidelpayApiException + * @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 aPayoutShouldBeUpdatedThroughResponseHandling() { @@ -118,8 +118,8 @@ public function getLinkedResourcesShouldThrowExceptionWhenThePaymentTypeIsNotSet * @test * * @throws Exception - * @throws RuntimeException - * @throws HeidelpayApiException + * @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 getLinkedResourceShouldReturnResourcesBelongingToPayout() { diff --git a/test/unit/Services/HttpServiceTest.php b/test/unit/Services/HttpServiceTest.php index 3fca4b28..71a61b45 100755 --- a/test/unit/Services/HttpServiceTest.php +++ b/test/unit/Services/HttpServiceTest.php @@ -86,8 +86,8 @@ public function environmentServiceShouldBeInjectable() * * @test * - * @throws RuntimeException - * @throws HeidelpayApiException + * @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 sendShouldThrowExceptionIfResourceIsNotSet() { diff --git a/test/unit/Services/PaymentServiceTest.php b/test/unit/Services/PaymentServiceTest.php index aa0deccf..0f43797d 100755 --- a/test/unit/Services/PaymentServiceTest.php +++ b/test/unit/Services/PaymentServiceTest.php @@ -177,8 +177,8 @@ public function chargeShouldCreateNewPaymentAndCharge($card3ds) * * @test * - * @throws RuntimeException - * @throws HeidelpayApiException + * @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. * @throws ReflectionException */ public function chargeAuthorizationShouldCallChargePaymentWithTheGivenPaymentObject() @@ -198,8 +198,8 @@ public function chargeAuthorizationShouldCallChargePaymentWithTheGivenPaymentObj * * @test * - * @throws RuntimeException - * @throws HeidelpayApiException + * @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. * @throws ReflectionException */ public function chargeAuthorizationShouldCallFetchPaymentIfThePaymentIsPassedAsIdString() @@ -379,8 +379,8 @@ public function cancelChargeShouldCreateCancellationAndCallsCreate() * @test * * @throws ReflectionException - * @throws RuntimeException - * @throws HeidelpayApiException + * @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 shipShouldCreateShipmentAndCallCreateOnResourceServiceWithIt() { @@ -414,8 +414,8 @@ public function shipShouldCreateShipmentAndCallCreateOnResourceServiceWithIt() * @test * * @throws ReflectionException - * @throws RuntimeException - * @throws HeidelpayApiException + * @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 payoutShouldCreatePaymentAndCallPayoutWithPayment() { @@ -546,8 +546,8 @@ public function paymentShouldBeCreatedByInitPayPage(string $action) * @throws Exception * @throws ReflectionException * @throws \PHPUnit\Framework\MockObject\RuntimeException - * @throws RuntimeException - * @throws HeidelpayApiException + * @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. * @throws \Exception */ public function fetchInstalmentPlansWillCallFetchOnResourceService() diff --git a/test/unit/Services/ResourceServiceTest.php b/test/unit/Services/ResourceServiceTest.php index 1423594d..53953998 100755 --- a/test/unit/Services/ResourceServiceTest.php +++ b/test/unit/Services/ResourceServiceTest.php @@ -413,8 +413,8 @@ public function fetchKeypairShouldCallFetchWithAKeypairObject() * @test * * @throws ReflectionException - * @throws RuntimeException - * @throws HeidelpayApiException + * @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 createPaymentTypeShouldSetHeidelpayObjectAndCallCreate() { @@ -543,8 +543,8 @@ public function createCustomerShouldCallCreateWithCustomerObjectAndSetHeidelpayR * @test * * @throws ReflectionException - * @throws RuntimeException - * @throws HeidelpayApiException + * @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 createOrUpdateCustomerShouldFetchAndUpdateCustomerIfItAlreadyExists() { @@ -589,8 +589,8 @@ public function createOrUpdateCustomerShouldFetchAndUpdateCustomerIfItAlreadyExi * @test * * @throws ReflectionException - * @throws RuntimeException - * @throws HeidelpayApiException + * @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 createOrUpdateCustomerShouldThrowTheExceptionIfItIsNotCustomerIdAlreadyExists() { diff --git a/test/unit/Services/WebhooksServiceTest.php b/test/unit/Services/WebhooksServiceTest.php index 67e0b9a3..b693cba7 100755 --- a/test/unit/Services/WebhooksServiceTest.php +++ b/test/unit/Services/WebhooksServiceTest.php @@ -77,8 +77,8 @@ public function gettersAndSettersShouldWorkProperly() * * @test * - * @throws RuntimeException - * @throws HeidelpayApiException + * @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. * @throws ReflectionException */ public function createWebhookShouldCallResourceServiceWithWebhookObject() @@ -318,8 +318,8 @@ static function ($param) use ($heidelpay) { * * @test * - * @throws RuntimeException - * @throws HeidelpayApiException + * @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. * @throws ReflectionException */ public function createWebhooksShouldCallResourceServiceWithNewWebhooksObject() diff --git a/test/unit/Traits/CanAuthorizeTest.php b/test/unit/Traits/CanAuthorizeTest.php index e0f504d0..7dfcb303 100755 --- a/test/unit/Traits/CanAuthorizeTest.php +++ b/test/unit/Traits/CanAuthorizeTest.php @@ -40,8 +40,8 @@ class CanAuthorizeTest extends BasePaymentTest * * @test * - * @throws RuntimeException - * @throws HeidelpayApiException + * @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 authorizeShouldThrowExceptionIfTheClassDoesNotImplementParentInterface() { diff --git a/test/unit/Traits/CanAuthorizeWithCustomerTest.php b/test/unit/Traits/CanAuthorizeWithCustomerTest.php index 29f9073c..5ffe4439 100755 --- a/test/unit/Traits/CanAuthorizeWithCustomerTest.php +++ b/test/unit/Traits/CanAuthorizeWithCustomerTest.php @@ -40,8 +40,8 @@ class CanAuthorizeWithCustomerTest extends BasePaymentTest * * @test * - * @throws RuntimeException - * @throws HeidelpayApiException + * @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 authorizeShouldThrowExceptionIfTheClassDoesNotImplementParentInterface() { diff --git a/test/unit/Traits/CanDirectChargeTest.php b/test/unit/Traits/CanDirectChargeTest.php index 32a2faae..f88c18f7 100755 --- a/test/unit/Traits/CanDirectChargeTest.php +++ b/test/unit/Traits/CanDirectChargeTest.php @@ -40,8 +40,8 @@ class CanDirectChargeTest extends BasePaymentTest * * @test * - * @throws RuntimeException - * @throws HeidelpayApiException + * @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 directChargeShouldThrowExceptionIfTheClassDoesNotImplementParentInterface() { diff --git a/test/unit/Traits/CanDirectChargeWithCustomerTest.php b/test/unit/Traits/CanDirectChargeWithCustomerTest.php index f21c8963..d36d7fea 100755 --- a/test/unit/Traits/CanDirectChargeWithCustomerTest.php +++ b/test/unit/Traits/CanDirectChargeWithCustomerTest.php @@ -40,8 +40,8 @@ class CanDirectChargeWithCustomerTest extends BasePaymentTest * * @test * - * @throws RuntimeException - * @throws HeidelpayApiException + * @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 directChargeShouldThrowExceptionIfTheClassDoesNotImplementParentInterface() { diff --git a/test/unit/Traits/CanPayoutTest.php b/test/unit/Traits/CanPayoutTest.php index 2d6b6af2..09522314 100644 --- a/test/unit/Traits/CanPayoutTest.php +++ b/test/unit/Traits/CanPayoutTest.php @@ -40,8 +40,8 @@ class CanPayoutTest extends BasePaymentTest * * @test * - * @throws RuntimeException - * @throws HeidelpayApiException + * @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 payoutShouldThrowExceptionIfTheClassDoesNotImplementParentInterface() { diff --git a/test/unit/Traits/CanPayoutWithCustomerTest.php b/test/unit/Traits/CanPayoutWithCustomerTest.php index 6b28d34e..8ba0c129 100644 --- a/test/unit/Traits/CanPayoutWithCustomerTest.php +++ b/test/unit/Traits/CanPayoutWithCustomerTest.php @@ -40,8 +40,8 @@ class CanPayoutWithCustomerTest extends BasePaymentTest * * @test * - * @throws RuntimeException - * @throws HeidelpayApiException + * @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 payoutShouldThrowExceptionIfTheClassDoesNotImplementParentInterface() { diff --git a/test/unit/Traits/HasCancellationsTest.php b/test/unit/Traits/HasCancellationsTest.php index 07fff25b..dd465394 100755 --- a/test/unit/Traits/HasCancellationsTest.php +++ b/test/unit/Traits/HasCancellationsTest.php @@ -38,8 +38,8 @@ class HasCancellationsTest extends BasePaymentTest * * @test * - * @throws RuntimeException - * @throws HeidelpayApiException + * @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 hasCancellationGettersAndSettersShouldWorkProperly() { From a2218bbf790528c76695a2fe7105454273be1129 Mon Sep 17 00:00:00 2001 From: sixer1182 Date: Fri, 13 Dec 2019 15:58:48 +0100 Subject: [PATCH 073/101] [refactor] (PHPLIB-274) Skip failing test. --- test/integration/PaymentTypes/WechatpayTest.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/integration/PaymentTypes/WechatpayTest.php b/test/integration/PaymentTypes/WechatpayTest.php index fe73691b..d4f3f003 100755 --- a/test/integration/PaymentTypes/WechatpayTest.php +++ b/test/integration/PaymentTypes/WechatpayTest.php @@ -60,6 +60,8 @@ public function wechatpayShouldBeCreatableAndFetchable() * * @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. + * + * @group skip */ public function wechatpayShouldBeAbleToCharge() { From b3ade76f37cb8e5ba9b47a75c534808834409a44 Mon Sep 17 00:00:00 2001 From: sixer1182 Date: Fri, 13 Dec 2019 16:02:06 +0100 Subject: [PATCH 074/101] [refactor] (PHPLIB-274) Fix code style issue. --- src/Interfaces/ResourceServiceInterface.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Interfaces/ResourceServiceInterface.php b/src/Interfaces/ResourceServiceInterface.php index 3fd56922..19c82bd7 100644 --- a/src/Interfaces/ResourceServiceInterface.php +++ b/src/Interfaces/ResourceServiceInterface.php @@ -195,14 +195,14 @@ public function fetchPaymentType($typeId): BasePaymentType; /** * Updates the PaymentType resource with the given PaymentType object. * - * @param BasePaymentType $x The PaymentType object to be updated. + * @param BasePaymentType $paymentType The PaymentType object to be updated. * * @return BasePaymentType|AbstractHeidelpayResource The updated PaymentType object. * * @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 updatePaymentType(BasePaymentType $x): BasePaymentType; + public function updatePaymentType(BasePaymentType $paymentType): BasePaymentType; /** * Create an API resource for the given customer object. From 7ab1fae5339383ac0262391a01ae66b9c5be45b1 Mon Sep 17 00:00:00 2001 From: sixer1182 Date: Fri, 13 Dec 2019 16:06:20 +0100 Subject: [PATCH 075/101] [refactor] (PHPLIB-274) Fix code style issue. --- test/unit/Services/PaymentServiceTest.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/unit/Services/PaymentServiceTest.php b/test/unit/Services/PaymentServiceTest.php index 0f43797d..a4e6f251 100755 --- a/test/unit/Services/PaymentServiceTest.php +++ b/test/unit/Services/PaymentServiceTest.php @@ -546,8 +546,8 @@ public function paymentShouldBeCreatedByInitPayPage(string $action) * @throws Exception * @throws ReflectionException * @throws \PHPUnit\Framework\MockObject\RuntimeException - * @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. + * @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. * @throws \Exception */ public function fetchInstalmentPlansWillCallFetchOnResourceService() From ef26d37ec0fbaf00ae74645f1e1ad7226b7dc3b7 Mon Sep 17 00:00:00 2001 From: sixer1182 Date: Fri, 13 Dec 2019 17:02:59 +0100 Subject: [PATCH 076/101] [refactor] (PHPLIB-260) Fix failing test. --- test/unit/Services/CancelServiceTest.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/test/unit/Services/CancelServiceTest.php b/test/unit/Services/CancelServiceTest.php index 52260e92..ffa63a03 100644 --- a/test/unit/Services/CancelServiceTest.php +++ b/test/unit/Services/CancelServiceTest.php @@ -26,6 +26,7 @@ use heidelpayPHP\Constants\ApiResponseCodes; use heidelpayPHP\Exceptions\HeidelpayApiException; +use heidelpayPHP\Heidelpay; use heidelpayPHP\Resources\EmbeddedResources\Amount; use heidelpayPHP\Resources\Payment; use heidelpayPHP\Resources\TransactionTypes\Authorization; @@ -78,13 +79,17 @@ public function cancelShouldCallCancelAllChargesAndCancelAuthorizationAndReturnF */ public function cancelShouldThrowExceptionIfNoTransactionExistsToBeCancelled() { - $paymentMock = $this->getMockBuilder(Payment::class)->setMethods(['cancelAllCharges', 'cancelAuthorization'])->getMock(); + /** @var CancelService|MockObject $cancelSrvMock */ + $cancelSrvMock = $this->getMockBuilder(CancelService::class)->disableOriginalConstructor()->setMethods(['cancelAllCharges', 'cancelAuthorization'])->getMock(); $this->expectException(RuntimeException::class); $this->expectExceptionMessage('This Payment could not be cancelled.'); - /** @var Payment $paymentMock */ - $paymentMock->cancel(); + $heidelpay = new Heidelpay('s-priv-1234'); + $heidelpay->setCancelService($cancelSrvMock); + $payment = (new Payment())->setParentResource($heidelpay); + + $payment->cancel(); } /** From db04d91c10f869d94f95fa7e47f8ee9efaea03cb Mon Sep 17 00:00:00 2001 From: sixer1182 Date: Fri, 13 Dec 2019 17:03:41 +0100 Subject: [PATCH 077/101] [refactor] (PHPLIB-260) Cleanup after merge. --- src/Heidelpay.php | 1 + src/Resources/Payment.php | 1 + src/Services/CancelService.php | 2 + test/unit/Services/ResourceServiceTest.php | 66 ---------------------- 4 files changed, 4 insertions(+), 66 deletions(-) diff --git a/src/Heidelpay.php b/src/Heidelpay.php index 579dc9c1..3b773cc6 100755 --- a/src/Heidelpay.php +++ b/src/Heidelpay.php @@ -27,6 +27,7 @@ use DateTime; use heidelpayPHP\Constants\CancelReasonCodes; +use heidelpayPHP\Exceptions\HeidelpayApiException; use heidelpayPHP\Interfaces\CancelServiceInterface; use heidelpayPHP\Interfaces\DebugHandlerInterface; use heidelpayPHP\Interfaces\HeidelpayParentInterface; diff --git a/src/Resources/Payment.php b/src/Resources/Payment.php index 67c3bd2c..b805ec74 100755 --- a/src/Resources/Payment.php +++ b/src/Resources/Payment.php @@ -25,6 +25,7 @@ namespace heidelpayPHP\Resources; use heidelpayPHP\Adapter\HttpAdapterInterface; +use heidelpayPHP\Constants\ApiResponseCodes; use heidelpayPHP\Constants\CancelReasonCodes; use heidelpayPHP\Constants\IdStrings; use heidelpayPHP\Constants\TransactionTypes; diff --git a/src/Services/CancelService.php b/src/Services/CancelService.php index 4af88559..5d8cc911 100644 --- a/src/Services/CancelService.php +++ b/src/Services/CancelService.php @@ -35,6 +35,8 @@ use heidelpayPHP\Resources\TransactionTypes\Charge; use RuntimeException; +use function in_array; + class CancelService implements CancelServiceInterface { /** @var Heidelpay */ diff --git a/test/unit/Services/ResourceServiceTest.php b/test/unit/Services/ResourceServiceTest.php index 400d0044..8848f8dc 100755 --- a/test/unit/Services/ResourceServiceTest.php +++ b/test/unit/Services/ResourceServiceTest.php @@ -1108,74 +1108,8 @@ public function updateBasketShouldCallUpdateAndReturnTheGivenBasket() } // - /** - * Verify fetchResourceByUrl calls fetch for the desired resource. - * - * @test - * @dataProvider fetchResourceByUrlShouldFetchTheDesiredResourceDP - * - * @param string $fetchMethod - * @param mixed $arguments - * @param string $resourceUrl - * - * @throws Exception - * @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. - * @throws ReflectionException - */ - public function fetchResourceByUrlShouldFetchTheDesiredResource($fetchMethod, $arguments, $resourceUrl) - { - /** @var Heidelpay|MockObject $heidelpayMock */ - $heidelpayMock = $this->getMockBuilder(Heidelpay::class)->disableOriginalConstructor()->setMethods([$fetchMethod])->getMock(); - $heidelpayMock->expects($this->once())->method($fetchMethod)->with(...$arguments); - $resourceService = new ResourceService($heidelpayMock); - - $resourceService->fetchResourceByUrl($resourceUrl); - } - - /** - * Verify fetchResourceByUrl calls fetch for the desired resource. - * - * @test - * @dataProvider fetchResourceByUrlForAPaymentTypeShouldCallFetchPaymentTypeDP - * - * @param $paymentTypeId - * @param string $resourceUrl - * - * @throws Exception - * @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. - * @throws ReflectionException - */ - public function fetchResourceByUrlForAPaymentTypeShouldCallFetchPaymentType($paymentTypeId, $resourceUrl) - { - /** @var ResourceService|MockObject $resourceSrvMock */ - $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->disableOriginalConstructor()->setMethods(['fetchPaymentType'])->getMock(); - $resourceSrvMock->expects($this->once())->method('fetchPaymentType')->with($paymentTypeId); - - $resourceSrvMock->fetchResourceByUrl($resourceUrl); - } // - /** - * Verify does not call fetchResourceByUrl and returns null if the resource type is unknown. - * - * @test - * - * @throws Exception - * @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. - * @throws ReflectionException - */ - public function fetchResourceByUrlForAPaymentTypeShouldReturnNullIfTheTypeIsUnknown() - { - /** @var ResourceService|MockObject $resourceSrvMock */ - $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->disableOriginalConstructor()->setMethods(['fetchPaymentType'])->getMock(); - $resourceSrvMock->expects($this->never())->method('fetchPaymentType'); - - $this->assertNull($resourceSrvMock->fetchResourceByUrl('https://api.heidelpay.com/v1/types/card/s-unknown-xen2ybcovn56/')); - } - /** * Verify createRecurring calls fetch for the payment type if it is given the id. * From 78edd295fca84f37a306a540693e71bfc8ef0b09 Mon Sep 17 00:00:00 2001 From: sixer1182 Date: Mon, 16 Dec 2019 08:30:11 +0100 Subject: [PATCH 078/101] [refactor] (PHPLIB-260) Fix code style issue. --- test/unit/Services/ResourceServiceTest.php | 1 + 1 file changed, 1 insertion(+) diff --git a/test/unit/Services/ResourceServiceTest.php b/test/unit/Services/ResourceServiceTest.php index 8848f8dc..e58581e3 100755 --- a/test/unit/Services/ResourceServiceTest.php +++ b/test/unit/Services/ResourceServiceTest.php @@ -1110,6 +1110,7 @@ public function updateBasketShouldCallUpdateAndReturnTheGivenBasket() // // + /** * Verify createRecurring calls fetch for the payment type if it is given the id. * From 9bf4320d43c3f333ccee02b55b0af29eda25b7e0 Mon Sep 17 00:00:00 2001 From: sixer1182 Date: Mon, 16 Dec 2019 09:01:31 +0100 Subject: [PATCH 079/101] [refactor] (PHPLIB-274) Apply changes from code review --- src/Services/ResourceService.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Services/ResourceService.php b/src/Services/ResourceService.php index 3a1a81a3..98173e83 100755 --- a/src/Services/ResourceService.php +++ b/src/Services/ResourceService.php @@ -582,9 +582,9 @@ public function fetchPaymentType($typeId): BasePaymentType */ public function updatePaymentType(BasePaymentType $paymentType): BasePaymentType { - /** @var BasePaymentType $retPaymentType */ - $retPaymentType = $this->updateResource($paymentType); - return $retPaymentType; + /** @var BasePaymentType $returnPaymentType */ + $returnPaymentType = $this->updateResource($paymentType); + return $returnPaymentType; } // From b413a3cccc4937701247d85dd02896a9e15aba46 Mon Sep 17 00:00:00 2001 From: sixer1182 Date: Mon, 16 Dec 2019 10:19:42 +0100 Subject: [PATCH 080/101] [refactor] (PHPLIB-268) Fix tests. --- test/unit/Services/CancelServiceTest.php | 11 +++- test/unit/Services/ResourceServiceTest.php | 65 ---------------------- 2 files changed, 8 insertions(+), 68 deletions(-) diff --git a/test/unit/Services/CancelServiceTest.php b/test/unit/Services/CancelServiceTest.php index 98cbc67b..25614fc7 100644 --- a/test/unit/Services/CancelServiceTest.php +++ b/test/unit/Services/CancelServiceTest.php @@ -26,6 +26,7 @@ use heidelpayPHP\Constants\ApiResponseCodes; use heidelpayPHP\Exceptions\HeidelpayApiException; +use heidelpayPHP\Heidelpay; use heidelpayPHP\Resources\EmbeddedResources\Amount; use heidelpayPHP\Resources\Payment; use heidelpayPHP\Resources\TransactionTypes\Authorization; @@ -78,13 +79,17 @@ public function cancelShouldCallCancelAllChargesAndCancelAuthorizationAndReturnF */ public function cancelShouldThrowExceptionIfNoTransactionExistsToBeCancelled() { - $paymentMock = $this->getMockBuilder(Payment::class)->setMethods(['cancelAllCharges', 'cancelAuthorization'])->getMock(); + /** @var CancelService|MockObject $cancelSrvMock */ + $cancelSrvMock = $this->getMockBuilder(CancelService::class)->disableOriginalConstructor()->setMethods(['cancelAllCharges', 'cancelAuthorization'])->getMock(); $this->expectException(RuntimeException::class); $this->expectExceptionMessage('This Payment could not be cancelled.'); - /** @var Payment $paymentMock */ - $paymentMock->cancel(); + $heidelpay = new Heidelpay('s-priv-1234'); + $heidelpay->setCancelService($cancelSrvMock); + $payment = (new Payment())->setParentResource($heidelpay); + + $payment->cancel(); } /** diff --git a/test/unit/Services/ResourceServiceTest.php b/test/unit/Services/ResourceServiceTest.php index 6db0b42c..e58581e3 100755 --- a/test/unit/Services/ResourceServiceTest.php +++ b/test/unit/Services/ResourceServiceTest.php @@ -1107,74 +1107,9 @@ public function updateBasketShouldCallUpdateAndReturnTheGivenBasket() $this->assertEquals($heidelpay, $basket->getHeidelpayObject()); } - /** - * Verify fetchResourceByUrl calls fetch for the desired resource. - * - * @test - * @dataProvider fetchResourceByUrlShouldFetchTheDesiredResourceDP - * - * @param string $fetchMethod - * @param mixed $arguments - * @param string $resourceUrl - * - * @throws Exception - * @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. - * @throws ReflectionException - */ - public function fetchResourceByUrlShouldFetchTheDesiredResource($fetchMethod, $arguments, $resourceUrl) - { - /** @var Heidelpay|MockObject $heidelpayMock */ - $heidelpayMock = $this->getMockBuilder(Heidelpay::class)->disableOriginalConstructor()->setMethods([$fetchMethod])->getMock(); - $heidelpayMock->expects($this->once())->method($fetchMethod)->with(...$arguments); - $resourceService = new ResourceService($heidelpayMock); - - $resourceService->fetchResourceByUrl($resourceUrl); - } - - /** - * Verify fetchResourceByUrl calls fetch for the desired resource. - * - * @test - * @dataProvider fetchResourceByUrlForAPaymentTypeShouldCallFetchPaymentTypeDP - * - * @param $paymentTypeId - * @param string $resourceUrl - * - * @throws Exception - * @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. - * @throws ReflectionException - */ - public function fetchResourceByUrlForAPaymentTypeShouldCallFetchPaymentType($paymentTypeId, $resourceUrl) - { - /** @var ResourceService|MockObject $resourceSrvMock */ - $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->disableOriginalConstructor()->setMethods(['fetchPaymentType'])->getMock(); - $resourceSrvMock->expects($this->once())->method('fetchPaymentType')->with($paymentTypeId); - - $resourceSrvMock->fetchResourceByUrl($resourceUrl); - } // // - /** - * Verify does not call fetchResourceByUrl and returns null if the resource type is unknown. - * - * @test - * - * @throws Exception - * @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. - * @throws ReflectionException - */ - public function fetchResourceByUrlForAPaymentTypeShouldReturnNullIfTheTypeIsUnknown() - { - /** @var ResourceService|MockObject $resourceSrvMock */ - $resourceSrvMock = $this->getMockBuilder(ResourceService::class)->disableOriginalConstructor()->setMethods(['fetchPaymentType'])->getMock(); - $resourceSrvMock->expects($this->never())->method('fetchPaymentType'); - - $this->assertNull($resourceSrvMock->fetchResourceByUrl('https://api.heidelpay.com/v1/types/card/s-unknown-xen2ybcovn56/')); - } /** * Verify createRecurring calls fetch for the payment type if it is given the id. From 5417b921a2bcb884a008f6e0ba7bd1743b351c55 Mon Sep 17 00:00:00 2001 From: sixer1182 Date: Mon, 16 Dec 2019 10:20:12 +0100 Subject: [PATCH 081/101] [refactor] (PHPLIB-274) Fix merging errors --- CHANGELOG.md | 5 ----- src/Heidelpay.php | 1 + src/Interfaces/ResourceServiceInterface.php | 15 --------------- src/Resources/Payment.php | 1 + 4 files changed, 2 insertions(+), 20 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 09f5793e..ec48f28a 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,11 +23,6 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a ### Remove * Removed deprecated code. -## [1.2.5.1][1.2.5.1] - -### Fix -* A bug which led to an error when trying to cancel the initial transaction of a charged invoice. - ## [1.2.5.0][1.2.5.0] ### Added diff --git a/src/Heidelpay.php b/src/Heidelpay.php index b4c10f76..dc609e5c 100755 --- a/src/Heidelpay.php +++ b/src/Heidelpay.php @@ -27,6 +27,7 @@ use DateTime; use heidelpayPHP\Constants\CancelReasonCodes; +use heidelpayPHP\Exceptions\HeidelpayApiException; use heidelpayPHP\Interfaces\CancelServiceInterface; use heidelpayPHP\Interfaces\DebugHandlerInterface; use heidelpayPHP\Interfaces\HeidelpayParentInterface; diff --git a/src/Interfaces/ResourceServiceInterface.php b/src/Interfaces/ResourceServiceInterface.php index 0b3a0000..c368a683 100644 --- a/src/Interfaces/ResourceServiceInterface.php +++ b/src/Interfaces/ResourceServiceInterface.php @@ -383,19 +383,4 @@ public function fetchRefund(Charge $charge, $cancellationId): Cancellation; * @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK. */ public function fetchShipment($payment, $shipmentId): Shipment; - - /** - * Retrieves an Payout resource via the API using the corresponding Payment or paymentId. - * The Payout resource can not be fetched using its id since they are unique only within the Payment. - * A Payment can have zero or one Payouts. - * - * @param Payment|string $payment The Payment object or the id of a Payment object whose Payout to fetch. - * There can only be one payout object to a payment. - * - * @return Payout The Payout object of the given Payment. - * - * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. - */ - public function fetchPayout($payment): Payout; } diff --git a/src/Resources/Payment.php b/src/Resources/Payment.php index d7498d11..6f0df15a 100755 --- a/src/Resources/Payment.php +++ b/src/Resources/Payment.php @@ -25,6 +25,7 @@ namespace heidelpayPHP\Resources; use heidelpayPHP\Adapter\HttpAdapterInterface; +use heidelpayPHP\Constants\ApiResponseCodes; use heidelpayPHP\Constants\CancelReasonCodes; use heidelpayPHP\Constants\IdStrings; use heidelpayPHP\Constants\TransactionTypes; From 69ac560ff275fa3383d56870e8641ad458a5c145 Mon Sep 17 00:00:00 2001 From: sixer1182 Date: Mon, 16 Dec 2019 11:38:44 +0100 Subject: [PATCH 082/101] [refactor] (PHPLIB-268) Fix merging errors --- src/Services/CancelService.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/Services/CancelService.php b/src/Services/CancelService.php index 868b5805..2703453a 100644 --- a/src/Services/CancelService.php +++ b/src/Services/CancelService.php @@ -36,8 +36,6 @@ use RuntimeException; use function in_array; -use function in_array; - class CancelService implements CancelServiceInterface { /** @var Heidelpay */ From 4804920c0e224a9b7569422c56c1e525a0c39731 Mon Sep 17 00:00:00 2001 From: sixer1182 Date: Tue, 17 Dec 2019 08:44:02 +0100 Subject: [PATCH 083/101] [refactor] (PHPLIB-260) Re-organize code. --- src/Services/CancelService.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Services/CancelService.php b/src/Services/CancelService.php index 5d8cc911..764483cd 100644 --- a/src/Services/CancelService.php +++ b/src/Services/CancelService.php @@ -153,6 +153,8 @@ public function cancelCharge( // + // + /** * @param Payment $payment * @param float|null $amount @@ -318,4 +320,6 @@ public function cancelPaymentCharges( } return $cancellations; } + + // } From 1aa70ccfa8ea85e459a60dfce922743da1fef394 Mon Sep 17 00:00:00 2001 From: sixer1182 Date: Tue, 17 Dec 2019 11:22:58 +0100 Subject: [PATCH 084/101] [refactor] (PHPLIB-260) Reduce complexity of CancelService::cancelPayment method. --- src/Services/CancelService.php | 71 ++++++++++++++++++++++------------ 1 file changed, 47 insertions(+), 24 deletions(-) diff --git a/src/Services/CancelService.php b/src/Services/CancelService.php index 764483cd..72113915 100644 --- a/src/Services/CancelService.php +++ b/src/Services/CancelService.php @@ -187,9 +187,7 @@ public function cancelPayment( if ($cancellation instanceof Cancellation) { $cancellations[] = $cancellation; - if (!$cancelWholePayment) { - $remainingToCancel -= $cancellation->getAmount(); - } + $remainingToCancel = $this->updateCancelAmount($remainingToCancel, $cancellation->getAmount()); $cancellation = null; } } @@ -244,15 +242,7 @@ public function cancelPaymentAuthorization(Payment $payment, float $amount = nul try { $cancellation = $authorize->cancel($cancelAmount); } catch (HeidelpayApiException $e) { - $allowedErrors = [ - ApiResponseCodes::API_ERROR_ALREADY_CANCELLED, - ApiResponseCodes::API_ERROR_ALREADY_CHARGED, - ApiResponseCodes::API_ERROR_TRANSACTION_CANCEL_NOT_ALLOWED - ]; - - if (!in_array($e->getCode(), $allowedErrors, true)) { - throw $e; - } + $this->isExceptionAllowed($e); } } @@ -293,23 +283,13 @@ public function cancelPaymentCharges( try { $cancellation = $charge->cancel($cancelAmount, $reasonCode, $referenceText, $amountNet, $amountVat); } catch (HeidelpayApiException $e) { - $allowedErrors = [ - ApiResponseCodes::API_ERROR_ALREADY_CANCELLED, - ApiResponseCodes::API_ERROR_ALREADY_CHARGED, - ApiResponseCodes::API_ERROR_ALREADY_CHARGED_BACK - ]; - - if (!in_array($e->getCode(), $allowedErrors, true)) { - throw $e; - } + $this->isExceptionAllowed($e); continue; } if ($cancellation instanceof Cancellation) { $cancellations[] = $cancellation; - if (!$cancelWholePayment) { - $remainingToCancel -= $cancellation->getAmount(); - } + $remainingToCancel = $this->updateCancelAmount($remainingToCancel, $cancellation->getAmount()); $cancellation = null; } @@ -322,4 +302,47 @@ public function cancelPaymentCharges( } // + + // + + /** + * Throws exception if the passed exception is not to be ignored while cancelling charges or authorization. + * + * @param $exception + * + * @throws HeidelpayApiException + */ + public function isExceptionAllowed(HeidelpayApiException $exception) + { + $allowedErrors = [ + ApiResponseCodes::API_ERROR_ALREADY_CANCELLED, + ApiResponseCodes::API_ERROR_ALREADY_CHARGED, + ApiResponseCodes::API_ERROR_TRANSACTION_CANCEL_NOT_ALLOWED, + ApiResponseCodes::API_ERROR_ALREADY_CHARGED_BACK + ]; + + if (!in_array($exception->getCode(), $allowedErrors, true)) { + throw $exception; + } + } + + /** + * Calculates and returns the remaining amount to cancel. + * Returns null if the whole payment is to be canceled. + * + * @param float|null $remainingToCancel + * @param float $amount + * + * @return float|null + */ + public function updateCancelAmount($remainingToCancel, float $amount) + { + $cancelWholePayment = $remainingToCancel === null; + if (!$cancelWholePayment) { + $remainingToCancel -= $amount; + } + return $remainingToCancel; + } + + // } From 84210c9a049118a8da8e962c414032a4854f4458 Mon Sep 17 00:00:00 2001 From: sixer1182 Date: Tue, 17 Dec 2019 11:23:14 +0100 Subject: [PATCH 085/101] [refactor] (PHPLIB-260) Minor changes. --- src/Services/ResourceService.php | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Services/ResourceService.php b/src/Services/ResourceService.php index 13b377da..59ac3032 100755 --- a/src/Services/ResourceService.php +++ b/src/Services/ResourceService.php @@ -328,7 +328,6 @@ public function fetchResource(AbstractHeidelpayResource $resource): AbstractHeid */ public function fetchPayout($payment): Payout { - /** @var Payment $paymentObject */ $paymentObject = $this->fetchPayment($payment); /** @var Payout $payout */ $payout = $this->fetchResource($paymentObject->getPayout(true)); From be0f75c9fd68b962e515d3ec99fa5c858b50c3e3 Mon Sep 17 00:00:00 2001 From: sixer1182 Date: Tue, 17 Dec 2019 14:32:50 +0100 Subject: [PATCH 086/101] [refactor] (PHPLIB-260) Update gitignore. --- .gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 151385ba..b5862c82 100755 --- a/.gitignore +++ b/.gitignore @@ -7,4 +7,4 @@ /vendor/ /composer.lock /build -/LessonsLearned.md +/myreport.html/ From 4a1dd4913a6d428eb9b8640abd82988dc938b777 Mon Sep 17 00:00:00 2001 From: sixer1182 Date: Tue, 17 Dec 2019 14:58:15 +0100 Subject: [PATCH 087/101] [refactor] (PHPLIB-260) Un-skip wechat pay test. --- test/integration/PaymentTypes/WechatpayTest.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/test/integration/PaymentTypes/WechatpayTest.php b/test/integration/PaymentTypes/WechatpayTest.php index d4f3f003..fe73691b 100755 --- a/test/integration/PaymentTypes/WechatpayTest.php +++ b/test/integration/PaymentTypes/WechatpayTest.php @@ -60,8 +60,6 @@ public function wechatpayShouldBeCreatableAndFetchable() * * @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. - * - * @group skip */ public function wechatpayShouldBeAbleToCharge() { From 3d76601facd6fc31f262c60dc9e9aabd4a99aca1 Mon Sep 17 00:00:00 2001 From: sixer1182 Date: Tue, 17 Dec 2019 15:15:03 +0100 Subject: [PATCH 088/101] [refactor] (PHPLIB-260) Un-skip wechat pay test. --- CHANGELOG.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5c2a800c..9b3ab8b0 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,7 +20,8 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a * Refactor unit tests. ### Remove -* Removed deprecated code. +* Move method doc blocks to service interfaces. +* Remove dead code. ## [1.2.5.0][1.2.5.0] From 2aa2ce23f9510d89a3271215eaf0ff048b31ca22 Mon Sep 17 00:00:00 2001 From: sixer1182 Date: Wed, 18 Dec 2019 10:40:57 +0100 Subject: [PATCH 089/101] [refactor] (PHPLIB-168) Move customer message property to trait. --- .../AbstractTransactionType.php | 26 +--------- src/Traits/HasCustomerMessage.php | 49 +++++++++++++++++++ .../AbstractTransactionTypeTest.php | 3 +- 3 files changed, 53 insertions(+), 25 deletions(-) create mode 100644 src/Traits/HasCustomerMessage.php diff --git a/src/Resources/TransactionTypes/AbstractTransactionType.php b/src/Resources/TransactionTypes/AbstractTransactionType.php index 4ced9d88..87d90a00 100755 --- a/src/Resources/TransactionTypes/AbstractTransactionType.php +++ b/src/Resources/TransactionTypes/AbstractTransactionType.php @@ -29,9 +29,9 @@ use heidelpayPHP\Adapter\HttpAdapterInterface; use heidelpayPHP\Exceptions\HeidelpayApiException; use heidelpayPHP\Resources\AbstractHeidelpayResource; -use heidelpayPHP\Resources\EmbeddedResources\Message; use heidelpayPHP\Resources\Payment; use heidelpayPHP\Resources\PaymentTypes\BasePaymentType; +use heidelpayPHP\Traits\HasCustomerMessage; use heidelpayPHP\Traits\HasOrderId; use heidelpayPHP\Traits\HasStates; use heidelpayPHP\Traits\HasUniqueAndShortId; @@ -43,6 +43,7 @@ abstract class AbstractTransactionType extends AbstractHeidelpayResource use HasOrderId; use HasStates; use HasUniqueAndShortId; + use HasCustomerMessage; // @@ -52,19 +53,8 @@ abstract class AbstractTransactionType extends AbstractHeidelpayResource /** @var DateTime $date */ private $date; - /** @var Message $message */ - private $message; - // - /** - * AbstractTransactionType constructor. - */ - public function __construct() - { - $this->message = new Message(); - } - // /** @@ -139,14 +129,6 @@ public function setDate(string $date): self return $this; } - /** - * @return Message - */ - public function getMessage(): Message - { - return $this->message; - } - // // @@ -174,10 +156,6 @@ public function handleResponse(stdClass $response, $method = HttpAdapterInterfac if ($method !== HttpAdapterInterface::REQUEST_GET) { $this->fetchPayment(); } - - if (isset($response->message)) { - $this->message->handleResponse($response->message); - } } /** diff --git a/src/Traits/HasCustomerMessage.php b/src/Traits/HasCustomerMessage.php new file mode 100644 index 00000000..19844442 --- /dev/null +++ b/src/Traits/HasCustomerMessage.php @@ -0,0 +1,49 @@ + + * + * @package heidelpayPHP\Traits + */ +namespace heidelpayPHP\Traits; + +use heidelpayPHP\Resources\EmbeddedResources\Message; + +trait HasCustomerMessage +{ + /** @var Message $message */ + private $message; + + // + + /** + * @return Message + */ + public function getMessage(): Message + { + if (!$this->message instanceof Message) { + $this->message = new Message(); + } + + return $this->message; + } + + // +} diff --git a/test/unit/Resources/TransactionTypes/AbstractTransactionTypeTest.php b/test/unit/Resources/TransactionTypes/AbstractTransactionTypeTest.php index 0154fbaf..23e5a936 100755 --- a/test/unit/Resources/TransactionTypes/AbstractTransactionTypeTest.php +++ b/test/unit/Resources/TransactionTypes/AbstractTransactionTypeTest.php @@ -71,7 +71,8 @@ public function theGettersAndSettersShouldWorkProperly() $transactionType->setPayment($payment); $transactionType->setDate($date); $transactionType->handleResponse((object)['isError' => true, 'isPending' => true, 'isSuccess' => true]); - $transactionType->getMessage()->handleResponse((object)['code' => '1234', 'customer' => 'Customer message!']); + $messageResponse = (object)['code' => '1234', 'customer' => 'Customer message!']; + $transactionType->handleResponse((object)['message' => $messageResponse]); $this->assertSame($payment, $transactionType->getPayment()); $this->assertEquals($date, $transactionType->getDate()); From b96f7c63660773372ffacba3a6834edd17eaba8e Mon Sep 17 00:00:00 2001 From: sixer1182 Date: Wed, 18 Dec 2019 11:18:57 +0100 Subject: [PATCH 090/101] [refactor] (PHPLIB-260) Add merchant to message class. --- src/Resources/EmbeddedResources/Message.php | 22 +++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/Resources/EmbeddedResources/Message.php b/src/Resources/EmbeddedResources/Message.php index 3599c7e5..2909a5dd 100755 --- a/src/Resources/EmbeddedResources/Message.php +++ b/src/Resources/EmbeddedResources/Message.php @@ -34,6 +34,9 @@ class Message extends AbstractHeidelpayResource /** @var string $customer */ private $customer = ''; + /** @var string $merchant */ + private $merchant = ''; + // /** @@ -74,5 +77,24 @@ protected function setCustomer(string $customer): Message return $this; } + /** + * @return string|null + */ + public function getMerchant() + { + return $this->merchant; + } + + /** + * @param string|null $merchant + * + * @return Message + */ + protected function setMerchant($merchant): Message + { + $this->merchant = $merchant; + return $this; + } + // } From 2d7e0f6d7afc3dc6cb2a017f74cd4a600d18c41b Mon Sep 17 00:00:00 2001 From: sixer1182 Date: Wed, 18 Dec 2019 11:19:53 +0100 Subject: [PATCH 091/101] [refactor] (PHPLIB-260) Add missing properties. --- src/Resources/AbstractHeidelpayResource.php | 25 +++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/src/Resources/AbstractHeidelpayResource.php b/src/Resources/AbstractHeidelpayResource.php index dd39d1d6..75dc2c69 100755 --- a/src/Resources/AbstractHeidelpayResource.php +++ b/src/Resources/AbstractHeidelpayResource.php @@ -25,6 +25,7 @@ namespace heidelpayPHP\Resources; use DateTime; +use Exception; use heidelpayPHP\Adapter\HttpAdapterInterface; use heidelpayPHP\Exceptions\HeidelpayApiException; use heidelpayPHP\Heidelpay; @@ -56,6 +57,9 @@ abstract class AbstractHeidelpayResource implements HeidelpayParentInterface /** @var array $specialParams */ private $specialParams = []; + /** @var DateTime|null */ + private $date; + /** @var array $additionalAttributes */ protected $additionalAttributes = []; @@ -137,6 +141,27 @@ public function setFetchedAt(DateTime $fetchedAt): self return $this; } + /** + * @return DateTime|null + */ + public function getDate() + { + return $this->date; + } + + /** + * @param DateTime|null $date + * + * @return AbstractHeidelpayResource + * + * @throws Exception + */ + protected function setDate($date): AbstractHeidelpayResource + { + $this->date = new DateTime($date); + return $this; + } + /** * Returns an array of additional params which can be added to the resource request. * From c97ad75563e287ce31c4e1c98eaa9d0446fd2dfa Mon Sep 17 00:00:00 2001 From: sixer1182 Date: Wed, 18 Dec 2019 11:20:52 +0100 Subject: [PATCH 092/101] [refactor] (PHPLIB-260) Fix problem with recurring which did not work as transaction. --- src/Constants/ApiResponseCodes.php | 4 ++++ src/Resources/Recurring.php | 11 ++++++++--- test/integration/RecurringPaymentTest.php | 12 ++++++++++-- 3 files changed, 22 insertions(+), 5 deletions(-) diff --git a/src/Constants/ApiResponseCodes.php b/src/Constants/ApiResponseCodes.php index 3dbf4601..eb05a4d7 100755 --- a/src/Constants/ApiResponseCodes.php +++ b/src/Constants/ApiResponseCodes.php @@ -26,10 +26,14 @@ class ApiResponseCodes { + // Status codes const API_SUCCESS_REQUEST_PROCESSED_IN_TEST_MODE = 'API.000.100.112'; const API_SUCCESS_CHARGED_AMOUNT_HIGHER_THAN_EXPECTED = 'API.100.550.340'; const API_SUCCESS_CHARGED_AMOUNT_LOWER_THAN_EXPECTED = 'API.100.550.341'; + const CORE_TRANSACTION_PENDING = 'COR.000.200.000'; + + // Errors codes const API_ERROR_GENERAL = 'API.000.000.999'; const API_ERROR_PAYMENT_NOT_FOUND = 'API.310.100.003'; const API_ERROR_TRANSACTION_AUTHORIZE_NOT_ALLOWED = 'API.320.000.004'; diff --git a/src/Resources/Recurring.php b/src/Resources/Recurring.php index 9e7a0778..992e5cb5 100644 --- a/src/Resources/Recurring.php +++ b/src/Resources/Recurring.php @@ -24,10 +24,16 @@ */ namespace heidelpayPHP\Resources; -use heidelpayPHP\Resources\TransactionTypes\AbstractTransactionType; +use heidelpayPHP\Traits\HasCustomerMessage; +use heidelpayPHP\Traits\HasStates; +use heidelpayPHP\Traits\HasUniqueAndShortId; -class Recurring extends AbstractTransactionType +class Recurring extends AbstractHeidelpayResource { + use HasStates; + use HasUniqueAndShortId; + use HasCustomerMessage; + /** @var string $returnUrl */ protected $returnUrl; @@ -43,7 +49,6 @@ class Recurring extends AbstractTransactionType */ public function __construct(string $paymentType, string $returnUrl) { - parent::__construct(); $this->returnUrl = $returnUrl; $this->paymentTypeId = $paymentType; } diff --git a/test/integration/RecurringPaymentTest.php b/test/integration/RecurringPaymentTest.php index ff0ebd94..493805b1 100644 --- a/test/integration/RecurringPaymentTest.php +++ b/test/integration/RecurringPaymentTest.php @@ -24,6 +24,8 @@ */ namespace heidelpayPHP\test\integration; +use DateTime; +use heidelpayPHP\Constants\ApiResponseCodes; use heidelpayPHP\Exceptions\HeidelpayApiException; use heidelpayPHP\Resources\PaymentTypes\Card; use heidelpayPHP\Resources\PaymentTypes\Paypal; @@ -52,19 +54,25 @@ public function exceptionShouldBeThrownIfTheObjectIsNotAResource() /** * Verify card with 3ds can activate recurring payments. + * After recurring call the parameters are set. * * @test * * @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 recurringForCardWith3dsShouldReturnRedirectURL() + public function recurringForCardWith3dsShouldReturnAttributes() { /** @var Card $card */ $card = $this->heidelpay->createPaymentType($this->createCardObject()->set3ds(true)); $recurring = $card->activateRecurring('https://dev.heidelpay.com'); $this->assertPending($recurring); - $this->assertNotEmpty($recurring->getReturnUrl()); + $this->assertEquals('https://dev.heidelpay.com', $recurring->getReturnUrl()); + $this->assertInstanceOf(DateTime::class, $recurring->getDate()); + + $message = $recurring->getMessage(); + $this->assertEquals(ApiResponseCodes::CORE_TRANSACTION_PENDING, $message->getCode()); + $this->assertNotEmpty($message->getCustomer()); } /** From bdd3422151daade8d8fca13325fff46a5b37d4e2 Mon Sep 17 00:00:00 2001 From: sixer1182 Date: Wed, 18 Dec 2019 11:40:59 +0100 Subject: [PATCH 093/101] [refactor] (PHPLIB-260) Apply changes from code review. --- src/Services/CancelService.php | 28 ++++------------------------ 1 file changed, 4 insertions(+), 24 deletions(-) diff --git a/src/Services/CancelService.php b/src/Services/CancelService.php index 72113915..33e90f53 100644 --- a/src/Services/CancelService.php +++ b/src/Services/CancelService.php @@ -156,17 +156,7 @@ public function cancelCharge( // /** - * @param Payment $payment - * @param float|null $amount - * @param mixed $reasonCode - * @param null|mixed $referenceText - * @param null|mixed $amountNet - * @param null|mixed $amountVat - * - * @return array - * - * @throws HeidelpayApiException - * @throws RuntimeException + * {@inheritDoc} */ public function cancelPayment( Payment $payment, @@ -209,17 +199,7 @@ public function cancelPayment( } /** - * Cancel the given amount of the payments authorization. - * - * @param Payment $payment The payment whose authorization should be canceled. - * @param float|null $amount The amount to be cancelled. If null the remaining uncharged amount of the authorization - * will be cancelled completely. If it exceeds the remaining uncharged amount the - * cancellation will only cancel the remaining uncharged amount. - * - * @return Cancellation|null - * - * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. - * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. + * {@inheritDoc} */ public function cancelPaymentAuthorization(Payment $payment, float $amount = null) { @@ -312,7 +292,7 @@ public function cancelPaymentCharges( * * @throws HeidelpayApiException */ - public function isExceptionAllowed(HeidelpayApiException $exception) + private function isExceptionAllowed(HeidelpayApiException $exception) { $allowedErrors = [ ApiResponseCodes::API_ERROR_ALREADY_CANCELLED, @@ -335,7 +315,7 @@ public function isExceptionAllowed(HeidelpayApiException $exception) * * @return float|null */ - public function updateCancelAmount($remainingToCancel, float $amount) + private function updateCancelAmount($remainingToCancel, float $amount) { $cancelWholePayment = $remainingToCancel === null; if (!$cancelWholePayment) { From 7f4d135e1a119e405fa1180e1e3a7140fa59b9ad Mon Sep 17 00:00:00 2001 From: sixer1182 Date: Wed, 18 Dec 2019 15:04:09 +0100 Subject: [PATCH 094/101] [refactor] (PHPLIB-260) Refactor cancelPayment to allow to pass the paymentId instead of the payment object. --- src/Heidelpay.php | 4 ++-- src/Interfaces/CancelServiceInterface.php | 26 +++++++++++------------ src/Services/CancelService.php | 17 +++++++++++---- test/unit/Services/CancelServiceTest.php | 24 +++++++++++++++++++++ 4 files changed, 52 insertions(+), 19 deletions(-) diff --git a/src/Heidelpay.php b/src/Heidelpay.php index 3b773cc6..972a9c0a 100755 --- a/src/Heidelpay.php +++ b/src/Heidelpay.php @@ -862,7 +862,7 @@ public function cancelAuthorizationByPayment($payment, float $amount = null): Ca * {@inheritDoc} */ public function cancelPayment( - Payment $payment, + $payment, float $amount = null, $reasonCode = CancelReasonCodes::REASON_CODE_CANCEL, string $referenceText = null, @@ -876,7 +876,7 @@ public function cancelPayment( /** * {@inheritDoc} */ - public function cancelPaymentAuthorization(Payment $payment, float $amount = null) + public function cancelPaymentAuthorization($payment, float $amount = null) { return $this->cancelService->cancelPaymentAuthorization($payment, $amount); } diff --git a/src/Interfaces/CancelServiceInterface.php b/src/Interfaces/CancelServiceInterface.php index 397796f2..c53ad89f 100644 --- a/src/Interfaces/CancelServiceInterface.php +++ b/src/Interfaces/CancelServiceInterface.php @@ -109,13 +109,13 @@ public function cancelCharge( * Performs a Cancellation transaction on the Payment. * If no amount is given a full cancel will be performed i. e. all Charges and Authorizations will be cancelled. * - * @param Payment $payment The payment whose authorization should be canceled. - * @param float|null $amount The amount to be canceled. - * This will be sent as amountGross in case of Hire Purchase payment method. - * @param string|null $reasonCode Reason for the Cancellation ref \heidelpayPHP\Constants\CancelReasonCodes. - * @param string|null $referenceText A reference string for the payment. - * @param float|null $amountNet The net value of the amount to be cancelled (Hire Purchase only). - * @param float|null $amountVat The vat value of the amount to be cancelled (Hire Purchase only). + * @param Payment|string $payment The Payment object or the id of the Payment to be cancelled. + * @param float|null $amount The amount to be canceled. + * This will be sent as amountGross in case of Hire Purchase payment method. + * @param string|null $reasonCode Reason for the Cancellation ref \heidelpayPHP\Constants\CancelReasonCodes. + * @param string|null $referenceText A reference string for the payment. + * @param float|null $amountNet The net value of the amount to be cancelled (Hire Purchase only). + * @param float|null $amountVat The vat value of the amount to be cancelled (Hire Purchase only). * * @return Cancellation[] An array holding all Cancellation objects created with this cancel call. * @@ -123,7 +123,7 @@ public function cancelCharge( * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ public function cancelPayment( - Payment $payment, + $payment, float $amount = null, $reasonCode = CancelReasonCodes::REASON_CODE_CANCEL, string $referenceText = null, @@ -134,15 +134,15 @@ public function cancelPayment( /** * Cancel the given amount of the payments authorization. * - * @param Payment $payment The payment whose authorization should be canceled. - * @param float|null $amount The amount to be cancelled. If null the remaining uncharged amount of the authorization - * will be cancelled completely. If it exceeds the remaining uncharged amount the - * cancellation will only cancel the remaining uncharged amount. + * @param Payment|string $payment The Payment object or the id of the Payment the authorization belongs to. + * @param float|null $amount The amount to be cancelled. If null the remaining uncharged amount of the authorization + * will be cancelled completely. If it exceeds the remaining uncharged amount the + * cancellation will only cancel the remaining uncharged amount. * * @return Cancellation|null The resulting cancellation. * * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. * @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK. */ - public function cancelPaymentAuthorization(Payment $payment, float $amount = null); + public function cancelPaymentAuthorization($payment, float $amount = null); } diff --git a/src/Services/CancelService.php b/src/Services/CancelService.php index 33e90f53..d176b09f 100644 --- a/src/Services/CancelService.php +++ b/src/Services/CancelService.php @@ -159,13 +159,22 @@ public function cancelCharge( * {@inheritDoc} */ public function cancelPayment( - Payment $payment, + $payment, float $amount = null, $reasonCode = CancelReasonCodes::REASON_CODE_CANCEL, string $referenceText = null, float $amountNet = null, float $amountVat = null ): array { + $paymentObject = $payment; + if (is_string($payment)) { + $paymentObject = $this->getResourceService()->fetchPayment($payment); + } + + if (!$paymentObject instanceof Payment) { + throw new RuntimeException('Invalid payment object.'); + } + $remainingToCancel = $amount; $cancelWholePayment = $remainingToCancel === null; @@ -173,7 +182,7 @@ public function cancelPayment( $cancellation = null; if ($cancelWholePayment || $remainingToCancel > 0.0) { - $cancellation = $this->cancelPaymentAuthorization($payment, $remainingToCancel); + $cancellation = $this->cancelPaymentAuthorization($paymentObject, $remainingToCancel); if ($cancellation instanceof Cancellation) { $cancellations[] = $cancellation; @@ -187,7 +196,7 @@ public function cancelPayment( } $chargeCancels = $this->cancelPaymentCharges( - $payment, + $paymentObject, $reasonCode, $referenceText, $amountNet, @@ -201,7 +210,7 @@ public function cancelPayment( /** * {@inheritDoc} */ - public function cancelPaymentAuthorization(Payment $payment, float $amount = null) + public function cancelPaymentAuthorization($payment, float $amount = null) { $cancellation = null; $completeCancel = $amount === null; diff --git a/test/unit/Services/CancelServiceTest.php b/test/unit/Services/CancelServiceTest.php index ffa63a03..25e6bd6a 100644 --- a/test/unit/Services/CancelServiceTest.php +++ b/test/unit/Services/CancelServiceTest.php @@ -33,6 +33,7 @@ use heidelpayPHP\Resources\TransactionTypes\Cancellation; use heidelpayPHP\Resources\TransactionTypes\Charge; use heidelpayPHP\Services\CancelService; +use heidelpayPHP\Services\ResourceService; use heidelpayPHP\test\BasePaymentTest; use PHPUnit\Framework\AssertionFailedError; use PHPUnit\Framework\Exception; @@ -432,6 +433,29 @@ public function cancelAuthorizationAmountWillNotCallCancelIfThereIsNoOpenAmount( $paymentMock->cancelAuthorizationAmount(0.0); } + /** + * Verify cancelPayment will fetch payment if the payment is referenced by paymentId. + * + * @test + * + * @throws Exception + * @throws HeidelpayApiException + * @throws ReflectionException + * @throws RuntimeException + * @throws \PHPUnit\Framework\MockObject\RuntimeException + */ + public function paymentCancelShouldFetchPaymentIfPaymentIdIsPassed() + { + /** @var MockObject|ResourceService $resourceServiceMock */ + $resourceServiceMock = $this->getMockBuilder(ResourceService::class)->disableOriginalConstructor()->setMethods(['fetchPayment'])->getMock(); + $cancelService = $this->heidelpay->setResourceService($resourceServiceMock)->getCancelService(); + + $payment = (new Payment($this->heidelpay))->setId('paymentId'); + + $resourceServiceMock->expects(self::once())->method('fetchPayment')->with('paymentId')->willReturn($payment); + $cancelService->cancelPayment('paymentId'); + } + // /** From 26ef069c3a97cff5c2c571c8470ae912ce265694 Mon Sep 17 00:00:00 2001 From: sixer1182 Date: Wed, 18 Dec 2019 15:04:31 +0100 Subject: [PATCH 095/101] [refactor] (PHPLIB-260) Unskip test. --- test/integration/PaymentTypes/HirePurchaseDirectDebitTest.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/test/integration/PaymentTypes/HirePurchaseDirectDebitTest.php b/test/integration/PaymentTypes/HirePurchaseDirectDebitTest.php index 05df763c..74b4d971 100755 --- a/test/integration/PaymentTypes/HirePurchaseDirectDebitTest.php +++ b/test/integration/PaymentTypes/HirePurchaseDirectDebitTest.php @@ -208,8 +208,6 @@ public function verifyShippingAChargedHirePurchase() * @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. * @throws Exception - * - * @group skip */ public function verifyChargeAndFullCancelAnInitializedHirePurchase() { From a6bb62123fa14956a7233a531d7878f261723166 Mon Sep 17 00:00:00 2001 From: sixer1182 Date: Wed, 18 Dec 2019 15:26:56 +0100 Subject: [PATCH 096/101] [refactor] (PHPLIB-168) Remove call to removed setter. --- test/unit/Resources/RecurringTest.php | 4 ---- 1 file changed, 4 deletions(-) diff --git a/test/unit/Resources/RecurringTest.php b/test/unit/Resources/RecurringTest.php index 498a0223..9f30d2be 100644 --- a/test/unit/Resources/RecurringTest.php +++ b/test/unit/Resources/RecurringTest.php @@ -24,8 +24,6 @@ */ namespace heidelpayPHP\test\unit\Resources; -use heidelpayPHP\Exceptions\HeidelpayApiException; -use heidelpayPHP\Resources\Payment; use heidelpayPHP\Resources\Recurring; use heidelpayPHP\test\BasePaymentTest; use PHPUnit\Framework\Exception; @@ -40,12 +38,10 @@ class RecurringTest extends BasePaymentTest * * @throws Exception * @throws RuntimeException - * @throws HeidelpayApiException */ public function gettersAndSettersShouldWorkAsExpected() { $recurring = new Recurring('payment type id', $this::RETURN_URL); - $recurring->setPayment(new Payment()); $this->assertEquals('payment type id', $recurring->getPaymentTypeId()); $this->assertEquals($this::RETURN_URL, $recurring->getReturnUrl()); From a4f552020a1603f86b1f958a2942611f6156b05d Mon Sep 17 00:00:00 2001 From: sixer1182 Date: Wed, 18 Dec 2019 15:27:14 +0100 Subject: [PATCH 097/101] [refactor] (PHPLIB-168) Move date property to trait. --- src/Resources/AbstractHeidelpayResource.php | 25 -------- src/Resources/Recurring.php | 2 + .../AbstractTransactionType.php | 31 +--------- .../TransactionTypes/Authorization.php | 2 - .../TransactionTypes/Cancellation.php | 2 - src/Resources/TransactionTypes/Charge.php | 2 - src/Resources/TransactionTypes/Payout.php | 2 - src/Traits/HasDate.php | 62 +++++++++++++++++++ test/unit/HeidelpayTest.php | 8 +-- 9 files changed, 70 insertions(+), 66 deletions(-) create mode 100644 src/Traits/HasDate.php diff --git a/src/Resources/AbstractHeidelpayResource.php b/src/Resources/AbstractHeidelpayResource.php index 75dc2c69..dd39d1d6 100755 --- a/src/Resources/AbstractHeidelpayResource.php +++ b/src/Resources/AbstractHeidelpayResource.php @@ -25,7 +25,6 @@ namespace heidelpayPHP\Resources; use DateTime; -use Exception; use heidelpayPHP\Adapter\HttpAdapterInterface; use heidelpayPHP\Exceptions\HeidelpayApiException; use heidelpayPHP\Heidelpay; @@ -57,9 +56,6 @@ abstract class AbstractHeidelpayResource implements HeidelpayParentInterface /** @var array $specialParams */ private $specialParams = []; - /** @var DateTime|null */ - private $date; - /** @var array $additionalAttributes */ protected $additionalAttributes = []; @@ -141,27 +137,6 @@ public function setFetchedAt(DateTime $fetchedAt): self return $this; } - /** - * @return DateTime|null - */ - public function getDate() - { - return $this->date; - } - - /** - * @param DateTime|null $date - * - * @return AbstractHeidelpayResource - * - * @throws Exception - */ - protected function setDate($date): AbstractHeidelpayResource - { - $this->date = new DateTime($date); - return $this; - } - /** * Returns an array of additional params which can be added to the resource request. * diff --git a/src/Resources/Recurring.php b/src/Resources/Recurring.php index 992e5cb5..28bd4b2d 100644 --- a/src/Resources/Recurring.php +++ b/src/Resources/Recurring.php @@ -25,6 +25,7 @@ namespace heidelpayPHP\Resources; use heidelpayPHP\Traits\HasCustomerMessage; +use heidelpayPHP\Traits\HasDate; use heidelpayPHP\Traits\HasStates; use heidelpayPHP\Traits\HasUniqueAndShortId; @@ -33,6 +34,7 @@ class Recurring extends AbstractHeidelpayResource use HasStates; use HasUniqueAndShortId; use HasCustomerMessage; + use HasDate; /** @var string $returnUrl */ protected $returnUrl; diff --git a/src/Resources/TransactionTypes/AbstractTransactionType.php b/src/Resources/TransactionTypes/AbstractTransactionType.php index 87d90a00..77c4830f 100755 --- a/src/Resources/TransactionTypes/AbstractTransactionType.php +++ b/src/Resources/TransactionTypes/AbstractTransactionType.php @@ -24,14 +24,13 @@ */ namespace heidelpayPHP\Resources\TransactionTypes; -use DateTime; -use Exception; use heidelpayPHP\Adapter\HttpAdapterInterface; use heidelpayPHP\Exceptions\HeidelpayApiException; use heidelpayPHP\Resources\AbstractHeidelpayResource; use heidelpayPHP\Resources\Payment; use heidelpayPHP\Resources\PaymentTypes\BasePaymentType; use heidelpayPHP\Traits\HasCustomerMessage; +use heidelpayPHP\Traits\HasDate; use heidelpayPHP\Traits\HasOrderId; use heidelpayPHP\Traits\HasStates; use heidelpayPHP\Traits\HasUniqueAndShortId; @@ -44,15 +43,13 @@ abstract class AbstractTransactionType extends AbstractHeidelpayResource use HasStates; use HasUniqueAndShortId; use HasCustomerMessage; + use HasDate; // /** @var Payment $payment */ private $payment; - /** @var DateTime $date */ - private $date; - // // @@ -105,30 +102,6 @@ public function getRedirectUrl() return $this->payment->getRedirectUrl(); } - /** - * This returns the date of the Transaction as string. - * - * @return string|null - */ - public function getDate() - { - $date = $this->date; - return $date ? $date->format('Y-m-d h:i:s') : null; - } - - /** - * @param string $date - * - * @return $this - * - * @throws Exception - */ - public function setDate(string $date): self - { - $this->date = new DateTime($date); - return $this; - } - // // diff --git a/src/Resources/TransactionTypes/Authorization.php b/src/Resources/TransactionTypes/Authorization.php index e4625245..eb0fa6cc 100755 --- a/src/Resources/TransactionTypes/Authorization.php +++ b/src/Resources/TransactionTypes/Authorization.php @@ -71,8 +71,6 @@ public function __construct($amount = null, $currency = null, $returnUrl = null) $this->setAmount($amount); $this->setCurrency($currency); $this->setReturnUrl($returnUrl); - - parent::__construct(); } // diff --git a/src/Resources/TransactionTypes/Cancellation.php b/src/Resources/TransactionTypes/Cancellation.php index 2be98e36..790da78a 100755 --- a/src/Resources/TransactionTypes/Cancellation.php +++ b/src/Resources/TransactionTypes/Cancellation.php @@ -66,8 +66,6 @@ class Cancellation extends AbstractTransactionType public function __construct($amount = null) { $this->setAmount($amount); - - parent::__construct(); } // diff --git a/src/Resources/TransactionTypes/Charge.php b/src/Resources/TransactionTypes/Charge.php index 20462df5..3bd2ff06 100755 --- a/src/Resources/TransactionTypes/Charge.php +++ b/src/Resources/TransactionTypes/Charge.php @@ -73,8 +73,6 @@ public function __construct($amount = null, $currency = null, $returnUrl = null) $this->setAmount($amount); $this->setCurrency($currency); $this->setReturnUrl($returnUrl); - - parent::__construct(); } // diff --git a/src/Resources/TransactionTypes/Payout.php b/src/Resources/TransactionTypes/Payout.php index b3f8ee16..ab4820d4 100644 --- a/src/Resources/TransactionTypes/Payout.php +++ b/src/Resources/TransactionTypes/Payout.php @@ -54,8 +54,6 @@ public function __construct($amount = null, $currency = null, $returnUrl = null) $this->setAmount($amount); $this->setCurrency($currency); $this->setReturnUrl($returnUrl); - - parent::__construct(); } // diff --git a/src/Traits/HasDate.php b/src/Traits/HasDate.php new file mode 100644 index 00000000..21c37d92 --- /dev/null +++ b/src/Traits/HasDate.php @@ -0,0 +1,62 @@ + + * + * @package heidelpayPHP\Traits + */ +namespace heidelpayPHP\Traits; + +use DateTime; +use Exception; + +trait HasDate +{ + /** @var DateTime $date */ + private $date; + + // + + /** + * This returns the date of the Transaction as string. + * + * @return string|null + */ + public function getDate() + { + $date = $this->date; + return $date ? $date->format('Y-m-d h:i:s') : null; + } + + /** + * @param string $date + * + * @return $this + * + * @throws Exception + */ + public function setDate(string $date): self + { + $this->date = new DateTime($date); + return $this; + } + + // +} diff --git a/test/unit/HeidelpayTest.php b/test/unit/HeidelpayTest.php index 8412f268..f393abf8 100755 --- a/test/unit/HeidelpayTest.php +++ b/test/unit/HeidelpayTest.php @@ -249,7 +249,7 @@ public function heidelpayShouldForwardCancelActionCallsToTheCancelService( * @throws Exception * @throws RuntimeException */ - public function resourceServiceDP(): array + public static function resourceServiceDP(): array { $customerId = 'customerId'; $basketId = 'basketId'; @@ -315,7 +315,7 @@ public function resourceServiceDP(): array * * @throws Exception */ - public function paymentServiceDP(): array + public static function paymentServiceDP(): array { $url = 'https://dev.heidelpay.com'; $orderId = 'orderId'; @@ -355,7 +355,7 @@ public function paymentServiceDP(): array * * @return array */ - public function heidelpayShouldForwardWebhookActionCallsToTheWebhookServiceDP(): array + public static function heidelpayShouldForwardWebhookActionCallsToTheWebhookServiceDP(): array { $url = 'https://dev.heidelpay.com'; $webhookId = 'webhookId'; @@ -379,7 +379,7 @@ public function heidelpayShouldForwardWebhookActionCallsToTheWebhookServiceDP(): /** * @return array */ - public function cancelServiceDP(): array + public static function cancelServiceDP(): array { $payment = new Payment(); $charge = new Charge(); From 8efe41aa8ffc837e0c73662d27974f670b4f7b7f Mon Sep 17 00:00:00 2001 From: sixer1182 Date: Wed, 18 Dec 2019 15:29:33 +0100 Subject: [PATCH 098/101] [refactor] (PHPLIB-168) Fix test for date property. --- test/integration/RecurringPaymentTest.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/test/integration/RecurringPaymentTest.php b/test/integration/RecurringPaymentTest.php index 493805b1..43c0a3f4 100644 --- a/test/integration/RecurringPaymentTest.php +++ b/test/integration/RecurringPaymentTest.php @@ -24,7 +24,6 @@ */ namespace heidelpayPHP\test\integration; -use DateTime; use heidelpayPHP\Constants\ApiResponseCodes; use heidelpayPHP\Exceptions\HeidelpayApiException; use heidelpayPHP\Resources\PaymentTypes\Card; @@ -68,7 +67,7 @@ public function recurringForCardWith3dsShouldReturnAttributes() $recurring = $card->activateRecurring('https://dev.heidelpay.com'); $this->assertPending($recurring); $this->assertEquals('https://dev.heidelpay.com', $recurring->getReturnUrl()); - $this->assertInstanceOf(DateTime::class, $recurring->getDate()); + $this->assertNotEmpty($recurring->getDate()); $message = $recurring->getMessage(); $this->assertEquals(ApiResponseCodes::CORE_TRANSACTION_PENDING, $message->getCode()); From 71e74796ee8d99e6bbb90ce5f97cc627487c2c3b Mon Sep 17 00:00:00 2001 From: sixer1182 Date: Fri, 3 Jan 2020 10:21:39 +0100 Subject: [PATCH 099/101] [refactor] (PHPLIB-168) Refactor docs. --- src/Resources/PaymentTypes/Paypage.php | 4 ++-- test/integration/WebhookTest.php | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Resources/PaymentTypes/Paypage.php b/src/Resources/PaymentTypes/Paypage.php index 1b91e364..b728d887 100644 --- a/src/Resources/PaymentTypes/Paypage.php +++ b/src/Resources/PaymentTypes/Paypage.php @@ -453,8 +453,8 @@ public function getRedirectUrl() * * @return Paypage * - * @throws HeidelpayApiException - * @throws RuntimeException + * @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 setRedirectUrl(string $redirectUrl): Paypage { diff --git a/test/integration/WebhookTest.php b/test/integration/WebhookTest.php index a3890d32..9bf1cee7 100755 --- a/test/integration/WebhookTest.php +++ b/test/integration/WebhookTest.php @@ -67,9 +67,9 @@ public function webhookResourceCanBeRegisteredAndFetched($event) * * @test * - * @throws HeidelpayApiException * @throws Exception - * @throws RuntimeException + * @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 webhookUrlShouldBeUpdateable() { @@ -91,9 +91,9 @@ public function webhookUrlShouldBeUpdateable() * * @test * - * @throws HeidelpayApiException * @throws Exception - * @throws RuntimeException + * @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 webhookEventShouldNotBeUpdateable() { From d9b2ec4c973e2048620ae98bbaa858cd2970a67d Mon Sep 17 00:00:00 2001 From: sixer1182 Date: Fri, 3 Jan 2020 10:27:38 +0100 Subject: [PATCH 100/101] [refactor] (PHPLIB-168) Refactor docs. --- src/Adapter/HttpAdapterInterface.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Adapter/HttpAdapterInterface.php b/src/Adapter/HttpAdapterInterface.php index 264a350b..35cba149 100755 --- a/src/Adapter/HttpAdapterInterface.php +++ b/src/Adapter/HttpAdapterInterface.php @@ -47,7 +47,7 @@ public function init($url, $payload = null, $httpMethod = HttpAdapterInterface:: * * @return string|null * - * @throws HeidelpayApiException + * @throws HeidelpayApiException A HeidelpayApiException is thrown if there is an error returned on API-request. */ public function execute(); From 3981952156687b078e4d9d96b3d343d9f2255229 Mon Sep 17 00:00:00 2001 From: sixer1182 Date: Wed, 8 Jan 2020 16:32:15 +0100 Subject: [PATCH 101/101] [change] (PHPLIB-281) Fix php version constraint. --- CHANGELOG.md | 1 + composer.json | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 36b88d71..5d9e0f36 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a ### Fixed * A bug which led to an error when trying to cancel the initial transaction of a charged invoice. +* Composer: PHP version constraint. * Several minor issues. ### Changed diff --git a/composer.json b/composer.json index c82e3ab3..364df00b 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", + "php": "~7.0.0|~7.1.0|~7.2.0|~7.3.0", "ext-json": "*" }, "require-dev": {