From b1d747c7c08e5bc165eb9f76509467295bcbc62a Mon Sep 17 00:00:00 2001 From: sixer1182 Date: Tue, 15 Oct 2019 10:03:12 +0200 Subject: [PATCH 01/11] [change] (PHPLIB-245) SEPA: Allow recurring payment. --- CHANGELOG.md | 1 + README.md | 2 +- .../PaymentTypes/SepaDirectDebit.php | 2 ++ .../SepaDirectDebitGuaranteed.php | 2 ++ test/integration/RecurringPaymentTest.php | 36 +++++++++++++++++++ 5 files changed, 42 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 685d088a..3bfc1822 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,6 +25,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a * Refactor deprecation notices. * Refactored and extended unit tests. * Test keypair can now be set via environment variables. +* Activate recurring payment for `SEPA Direct Debit (guaranteed)`. ## [1.2.2.0][1.2.2.0] diff --git a/README.md b/README.md index e017acdd..78d3d64e 100755 --- a/README.md +++ b/README.md @@ -26,7 +26,7 @@ Please refer to the following documentation for installation instructions and us * PayPal + Recurring * Prepayment * Przelewy24 -* SEPA direct debit (guaranteed) +* SEPA direct debit (guaranteed) + Recurring * SOFORT * EPS * FlexiPay direct (PIS) diff --git a/src/Resources/PaymentTypes/SepaDirectDebit.php b/src/Resources/PaymentTypes/SepaDirectDebit.php index c724599d..89fb00d4 100755 --- a/src/Resources/PaymentTypes/SepaDirectDebit.php +++ b/src/Resources/PaymentTypes/SepaDirectDebit.php @@ -26,11 +26,13 @@ use heidelpayPHP\Traits\CanDirectCharge; use heidelpayPHP\Traits\CanPayout; +use heidelpayPHP\Traits\CanRecur; class SepaDirectDebit extends BasePaymentType { use CanDirectCharge; use CanPayout; + use CanRecur; /** @var string $iban */ protected $iban; diff --git a/src/Resources/PaymentTypes/SepaDirectDebitGuaranteed.php b/src/Resources/PaymentTypes/SepaDirectDebitGuaranteed.php index 237381a9..70408cae 100755 --- a/src/Resources/PaymentTypes/SepaDirectDebitGuaranteed.php +++ b/src/Resources/PaymentTypes/SepaDirectDebitGuaranteed.php @@ -26,11 +26,13 @@ use heidelpayPHP\Traits\CanDirectChargeWithCustomer; use heidelpayPHP\Traits\CanPayoutWithCustomer; +use heidelpayPHP\Traits\CanRecur; class SepaDirectDebitGuaranteed extends BasePaymentType { use CanDirectChargeWithCustomer; use CanPayoutWithCustomer; + use CanRecur; /** @var string $iban */ protected $iban; diff --git a/test/integration/RecurringPaymentTest.php b/test/integration/RecurringPaymentTest.php index 334faec0..f849c132 100644 --- a/test/integration/RecurringPaymentTest.php +++ b/test/integration/RecurringPaymentTest.php @@ -27,6 +27,8 @@ use heidelpayPHP\Exceptions\HeidelpayApiException; use heidelpayPHP\Resources\PaymentTypes\Card; use heidelpayPHP\Resources\PaymentTypes\Paypal; +use heidelpayPHP\Resources\PaymentTypes\SepaDirectDebit; +use heidelpayPHP\Resources\PaymentTypes\SepaDirectDebitGuaranteed; use heidelpayPHP\test\BasePaymentTest; use PHPUnit\Framework\Exception; use RuntimeException; @@ -83,4 +85,38 @@ public function paypalShouldBeAbleToActivateRecurringPayments() $this->assertPending($recurring); $this->assertNotEmpty($recurring->getReturnUrl()); } + + /** + * Verify sepa direct debit can activate recurring payments. + * + * @test + * + * @throws RuntimeException + * @throws HeidelpayApiException + */ + public function sepaDirectDebitShouldBeAbleToActivateRecurringPayments() + { + /** @var SepaDirectDebit $dd */ + $dd = $this->heidelpay->createPaymentType(new SepaDirectDebit('DE89370400440532013000')); + $recurring = $dd->activateRecurring('https://dev.heidelpay.com'); + $this->assertPending($recurring); + $this->assertNotEmpty($recurring->getReturnUrl()); + } + + /** + * Verify sepa direct debit guaranteed can activate recurring payments. + * + * @test + * + * @throws RuntimeException + * @throws HeidelpayApiException + */ + public function sepaDirectDebitGuaranteedShouldBeAbleToActivateRecurringPayments() + { + /** @var SepaDirectDebitGuaranteed $ddg */ + $ddg = $this->heidelpay->createPaymentType(new SepaDirectDebitGuaranteed('DE89370400440532013000')); + $recurring = $ddg->activateRecurring('https://dev.heidelpay.com'); + $this->assertPending($recurring); + $this->assertNotEmpty($recurring->getReturnUrl()); + } } From cca964054eb46bcbce13bf7559500c1c3eb00a49 Mon Sep 17 00:00:00 2001 From: sixer1182 Date: Wed, 16 Oct 2019 09:07:52 +0200 Subject: [PATCH 02/11] [change] (PHPLIB-245) SEPA recurring: trial-and-error. --- test/integration/RecurringPaymentTest.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/test/integration/RecurringPaymentTest.php b/test/integration/RecurringPaymentTest.php index f849c132..0c5f4803 100644 --- a/test/integration/RecurringPaymentTest.php +++ b/test/integration/RecurringPaymentTest.php @@ -98,9 +98,12 @@ public function sepaDirectDebitShouldBeAbleToActivateRecurringPayments() { /** @var SepaDirectDebit $dd */ $dd = $this->heidelpay->createPaymentType(new SepaDirectDebit('DE89370400440532013000')); - $recurring = $dd->activateRecurring('https://dev.heidelpay.com'); - $this->assertPending($recurring); - $this->assertNotEmpty($recurring->getReturnUrl()); + $this->assertFalse($dd->isRecurring()); + $dd->charge(10.0, 'EUR', self::RETURN_URL); + $dd = $this->heidelpay->fetchPaymentType($dd->getId()); + $this->assertTrue($dd->isRecurring()); + // todo: catch error when AHC-2432 is done + $this->heidelpay->activateRecurringPayment($dd, self::RETURN_URL); } /** From c43fa0a4d5f8b3916d4cc43d98daa85727d70969 Mon Sep 17 00:00:00 2001 From: sixer1182 Date: Thu, 9 Jan 2020 17:33:32 +0100 Subject: [PATCH 03/11] [change] (PHPLIB-245) Enable recurring tests for SEPA Direct Debit. --- src/Constants/ApiResponseCodes.php | 2 ++ test/integration/RecurringPaymentTest.php | 11 +++++++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/Constants/ApiResponseCodes.php b/src/Constants/ApiResponseCodes.php index eb05a4d7..76392b8c 100755 --- a/src/Constants/ApiResponseCodes.php +++ b/src/Constants/ApiResponseCodes.php @@ -69,6 +69,8 @@ class ApiResponseCodes const API_ERROR_CUSTOMER_CAN_NOT_BE_FOUND = 'API.500.100.100'; const API_ERROR_REQUEST_DATA_IS_INVALID = 'API.500.300.999'; const API_ERROR_RECURRING_PAYMENT_NOT_SUPPORTED = 'API.500.550.004'; + const API_ERROR_ACTIVATE_RECURRING_VIA_TRANSACTION = 'API.500.550.005'; + const API_ERROR_RECURRING_ALREADY_ACTIVE = 'API.500.550.006'; 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'; diff --git a/test/integration/RecurringPaymentTest.php b/test/integration/RecurringPaymentTest.php index ea8e1e4d..5be3f1c2 100644 --- a/test/integration/RecurringPaymentTest.php +++ b/test/integration/RecurringPaymentTest.php @@ -133,7 +133,9 @@ public function sepaDirectDebitShouldBeAbleToActivateRecurringPayments() $dd->charge(10.0, 'EUR', self::RETURN_URL); $dd = $this->heidelpay->fetchPaymentType($dd->getId()); $this->assertTrue($dd->isRecurring()); - // todo: catch error when AHC-2432 is done + + $this->expectException(HeidelpayApiException::class); + $this->expectExceptionCode(ApiResponseCodes::API_ERROR_RECURRING_ALREADY_ACTIVE); $this->heidelpay->activateRecurringPayment($dd, self::RETURN_URL); } @@ -149,8 +151,9 @@ public function sepaDirectDebitGuaranteedShouldBeAbleToActivateRecurringPayments { /** @var SepaDirectDebitGuaranteed $ddg */ $ddg = $this->heidelpay->createPaymentType(new SepaDirectDebitGuaranteed('DE89370400440532013000')); - $recurring = $ddg->activateRecurring('https://dev.heidelpay.com'); - $this->assertPending($recurring); - $this->assertNotEmpty($recurring->getReturnUrl()); + + $this->expectException(HeidelpayApiException::class); + $this->expectExceptionCode(ApiResponseCodes::API_ERROR_ACTIVATE_RECURRING_VIA_TRANSACTION); + $ddg->activateRecurring('https://dev.heidelpay.com'); } } From 0078b56cfbf7193900db24b9118bc80441cc3080 Mon Sep 17 00:00:00 2001 From: sixer1182 Date: Thu, 9 Jan 2020 18:10:03 +0100 Subject: [PATCH 04/11] [change] (PHPLIB-245) Update CHANGELOG.md and README.md. --- CHANGELOG.md | 1 + README.md | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f662c8d7..0fea84f6 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a ### Added * Example for Payment Type `Przelewy24`. +* Enabled recurring payment for SEPA direct debit. ### Fixed * A bug which led to an error when trying to cancel the initial transaction of a charged invoice. diff --git a/README.md b/README.md index 5094b82e..f3b88f16 100755 --- a/README.md +++ b/README.md @@ -26,7 +26,8 @@ Please refer to the following documentation for installation instructions and us * PayPal + Recurring * Prepayment * Przelewy24 -* SEPA direct debit (guaranteed) + Recurring +* SEPA direct debit + Recurring +* SEPA direct debit guaranteed * SOFORT * EPS * FlexiPay® Direct (PIS) From b35a233aa518557ed4ca66fbaa11146bea2a5a6d Mon Sep 17 00:00:00 2001 From: sixer1182 Date: Thu, 9 Jan 2020 18:14:23 +0100 Subject: [PATCH 05/11] [change] (PHPLIB-245) Update CHANGELOG.md and README.md. --- CHANGELOG.md | 2 +- README.md | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0fea84f6..e48af782 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,7 +7,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a ### Added * Example for Payment Type `Przelewy24`. -* Enabled recurring payment for SEPA direct debit. +* Enabled recurring payment for SEPA direct debit (guaranteed). ### Fixed * A bug which led to an error when trying to cancel the initial transaction of a charged invoice. diff --git a/README.md b/README.md index f3b88f16..5094b82e 100755 --- a/README.md +++ b/README.md @@ -26,8 +26,7 @@ Please refer to the following documentation for installation instructions and us * PayPal + Recurring * Prepayment * Przelewy24 -* SEPA direct debit + Recurring -* SEPA direct debit guaranteed +* SEPA direct debit (guaranteed) + Recurring * SOFORT * EPS * FlexiPay® Direct (PIS) From eccd14c42484376ee94a85c0fc57706e0fcf6e64 Mon Sep 17 00:00:00 2001 From: sixer1182 Date: Fri, 10 Jan 2020 13:18:43 +0100 Subject: [PATCH 06/11] [change] (PHPLIB-245) Fix problem with null return on empty redirectUrl. --- src/Resources/Recurring.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Resources/Recurring.php b/src/Resources/Recurring.php index 28bd4b2d..413db441 100644 --- a/src/Resources/Recurring.php +++ b/src/Resources/Recurring.php @@ -39,7 +39,7 @@ class Recurring extends AbstractHeidelpayResource /** @var string $returnUrl */ protected $returnUrl; - /** @var string $redirectUrl */ + /** @var string|null $redirectUrl */ protected $redirectUrl; /** @var string $paymentTypeId */ @@ -96,19 +96,19 @@ public function setPaymentTypeId(string $paymentTypeId): Recurring } /** - * @return string + * @return string|null */ - public function getRedirectUrl(): string + public function getRedirectUrl() { return $this->redirectUrl; } /** - * @param string $redirectUrl + * @param string|null $redirectUrl * * @return Recurring */ - protected function setRedirectUrl(string $redirectUrl): Recurring + protected function setRedirectUrl($redirectUrl): Recurring { $this->redirectUrl = $redirectUrl; return $this; From 463503fe9d06ee4077c1c90cb772d6e8b4b8ad23 Mon Sep 17 00:00:00 2001 From: sixer1182 Date: Fri, 10 Jan 2020 14:41:54 +0100 Subject: [PATCH 07/11] [change] (PHPLIB-245) Refactor card recurring test. --- src/Services/EnvironmentService.php | 16 ++++++++++------ test/BasePaymentTest.php | 8 ++++---- test/integration/RecurringPaymentTest.php | 18 +++++++++++++----- 3 files changed, 27 insertions(+), 15 deletions(-) diff --git a/src/Services/EnvironmentService.php b/src/Services/EnvironmentService.php index 1d9d7356..d9ae08d4 100755 --- a/src/Services/EnvironmentService.php +++ b/src/Services/EnvironmentService.php @@ -80,23 +80,27 @@ public static function getTimeout(): int * Returns the private key string set via environment variable. * Returns the default key if the environment variable is not set. * + * @param bool $non3ds * @return string */ - public function getTestPrivateKey(): string + public function getTestPrivateKey($non3ds = false): string { - $key = $_SERVER[self::ENV_VAR_TEST_PRIVATE_KEY] ?? ''; - return empty($key) ? self::DEFAULT_TEST_PRIVATE_KEY : $key; + $variableName = self::ENV_VAR_TEST_PRIVATE_KEY . ($non3ds ? '_NON_3DS' : ''); + $key = $_SERVER[$variableName] ?? ''; + return empty($key) && !$non3ds ? self::DEFAULT_TEST_PRIVATE_KEY : $key; } /** * Returns the public key string set via environment variable. * Returns the default key if the environment variable is not set. * + * @param bool $non3ds * @return string */ - public function getTestPublicKey(): string + public function getTestPublicKey($non3ds = false): string { - $key = $_SERVER[self::ENV_VAR_TEST_PUBLIC_KEY] ?? ''; - return empty($key) ? self::DEFAULT_TEST_PUBLIC_KEY : $key; + $variableName = self::ENV_VAR_TEST_PUBLIC_KEY . ($non3ds ? '_NON_3DS' : ''); + $key = $_SERVER[$variableName] ?? ''; + return empty($key) && !$non3ds ? self::DEFAULT_TEST_PUBLIC_KEY : $key; } } diff --git a/test/BasePaymentTest.php b/test/BasePaymentTest.php index 34faf0af..bbdc8e3a 100755 --- a/test/BasePaymentTest.php +++ b/test/BasePaymentTest.php @@ -129,11 +129,11 @@ public function assertTransactionResourceHasBeenCreated($transactionType) /** * Asserts whether the given transaction was successful. * - * @param AbstractTransactionType $transaction + * @param AbstractTransactionType|Recurring $transaction * * @throws AssertionFailedError */ - protected function assertSuccess(AbstractTransactionType $transaction) + protected function assertSuccess($transaction) { $this->assertTrue($transaction->isSuccess()); $this->assertFalse($transaction->isPending()); @@ -143,11 +143,11 @@ protected function assertSuccess(AbstractTransactionType $transaction) /** * Asserts whether the given transaction was a failure. * - * @param AbstractTransactionType $transaction + * @param AbstractTransactionType|Recurring $transaction * * @throws AssertionFailedError */ - protected function assertError(AbstractTransactionType $transaction) + protected function assertError($transaction) { $this->assertFalse($transaction->isSuccess()); $this->assertFalse($transaction->isPending()); diff --git a/test/integration/RecurringPaymentTest.php b/test/integration/RecurringPaymentTest.php index 5be3f1c2..e1661996 100644 --- a/test/integration/RecurringPaymentTest.php +++ b/test/integration/RecurringPaymentTest.php @@ -26,10 +26,12 @@ use heidelpayPHP\Constants\ApiResponseCodes; use heidelpayPHP\Exceptions\HeidelpayApiException; +use heidelpayPHP\Heidelpay; use heidelpayPHP\Resources\PaymentTypes\Card; use heidelpayPHP\Resources\PaymentTypes\Paypal; use heidelpayPHP\Resources\PaymentTypes\SepaDirectDebit; use heidelpayPHP\Resources\PaymentTypes\SepaDirectDebitGuaranteed; +use heidelpayPHP\Services\EnvironmentService; use heidelpayPHP\test\BasePaymentTest; use PHPUnit\Framework\Exception; use RuntimeException; @@ -83,20 +85,26 @@ public function recurringForCardWith3dsShouldReturnAttributes() * * @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 recurringForCardWithout3dsShouldActivateRecurringAtOnce() { + $privateKey = (new EnvironmentService())->getTestPrivateKey(true); + if (empty($privateKey)) { + $this->markTestIncomplete('No non 3ds private key set'); + } + $heidelpay = new Heidelpay($privateKey); + + $heidelpay->setDebugMode(true)->setDebugHandler($this->heidelpay->getDebugHandler()); + /** @var Card $card */ - $card = $this->heidelpay->createPaymentType($this->createCardObject()->set3ds(false)); + $card = $heidelpay->createPaymentType($this->createCardObject()->set3ds(false)); $this->assertFalse($card->isRecurring()); $recurring = $card->activateRecurring('https://dev.heidelpay.com'); - $this->assertPending($recurring); + $this->assertSuccess($recurring); /** @var Card $fetchedCard */ - $fetchedCard = $this->heidelpay->fetchPaymentType($card->getId()); + $fetchedCard = $heidelpay->fetchPaymentType($card->getId()); $this->assertTrue($fetchedCard->isRecurring()); } From 5a0a62a30f40aeefcbff391544898c0a11d37d3c Mon Sep 17 00:00:00 2001 From: sixer1182 Date: Fri, 10 Jan 2020 14:51:26 +0100 Subject: [PATCH 08/11] [change] (PHPLIB-245) Fix style. --- src/Services/EnvironmentService.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Services/EnvironmentService.php b/src/Services/EnvironmentService.php index d9ae08d4..8cd265f9 100755 --- a/src/Services/EnvironmentService.php +++ b/src/Services/EnvironmentService.php @@ -81,6 +81,7 @@ public static function getTimeout(): int * Returns the default key if the environment variable is not set. * * @param bool $non3ds + * * @return string */ public function getTestPrivateKey($non3ds = false): string @@ -95,6 +96,7 @@ public function getTestPrivateKey($non3ds = false): string * Returns the default key if the environment variable is not set. * * @param bool $non3ds + * * @return string */ public function getTestPublicKey($non3ds = false): string From 949d181058e3d301ad780447a211203270cf7dd2 Mon Sep 17 00:00:00 2001 From: sixer1182 Date: Mon, 20 Jan 2020 09:54:04 +0100 Subject: [PATCH 09/11] [change] (PHPLIB-245) Add tests to verify new api behaviour. --- test/integration/PaymentTest.php | 51 ++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/test/integration/PaymentTest.php b/test/integration/PaymentTest.php index 037e619c..7db8addb 100755 --- a/test/integration/PaymentTest.php +++ b/test/integration/PaymentTest.php @@ -28,6 +28,7 @@ use heidelpayPHP\Constants\ApiResponseCodes; use heidelpayPHP\Exceptions\HeidelpayApiException; use heidelpayPHP\Resources\Payment; +use heidelpayPHP\Resources\PaymentTypes\Card; use heidelpayPHP\Resources\PaymentTypes\Paypal; use heidelpayPHP\Resources\TransactionTypes\Authorization; use heidelpayPHP\Resources\TransactionTypes\Charge; @@ -237,4 +238,54 @@ public function paymentShouldBeFetchedByOrderIdIfIdIsNotSet() $this->assertNotSame($payment, $fetchedPayment); $this->assertEquals($payment->expose(), $fetchedPayment->expose()); } + + /** + * Verify orderId does not need to be unique. + * + * @test + * @throws HeidelpayApiException + * @throws RuntimeException + */ + public function shouldAllowNonUniqueOrderId() + { + $orderId = self::generateRandomId(); + + /** @var Card $card */ + $card = $this->heidelpay->createPaymentType($this->createCardObject()); + $card->charge(1023, 'EUR', self::RETURN_URL, null, $orderId); + + try { + /** @var Card $card2 */ + $card2 = $this->heidelpay->createPaymentType($this->createCardObject()); + $card2->charge(1023, 'EUR', self::RETURN_URL, null, $orderId); + $this->assertTrue(true); + } catch (HeidelpayApiException $e) { + $this->assertTrue(false, "No exception expected here. ({$e->getMerchantMessage()})"); + } + } + + /** + * Verify invoiceId does not need to be unique. + * + * @test + * @throws HeidelpayApiException + * @throws RuntimeException + */ + public function shouldAllowNonUniqueInvoiceId() + { + $invoiceId = self::generateRandomId(); + + /** @var Card $card */ + $card = $this->heidelpay->createPaymentType($this->createCardObject()); + $card->charge(1023, 'EUR', self::RETURN_URL, null, null, null, null, null, $invoiceId); + + try { + /** @var Card $card2 */ + $card2 = $this->heidelpay->createPaymentType($this->createCardObject()); + $card2->charge(1023, 'EUR', self::RETURN_URL, null, null, null, null, null, $invoiceId); + $this->assertTrue(true); + } catch (HeidelpayApiException $e) { + $this->assertTrue(false, "No exception expected here. ({$e->getMerchantMessage()})"); + } + } } From 7323484cfc3a974694496c49f705f7442188d03e Mon Sep 17 00:00:00 2001 From: sixer1182 Date: Mon, 20 Jan 2020 13:24:14 +0100 Subject: [PATCH 10/11] [change] (PHPLIB-245) Remove obsolete test. --- test/integration/PaymentTest.php | 25 ++----------------------- 1 file changed, 2 insertions(+), 23 deletions(-) diff --git a/test/integration/PaymentTest.php b/test/integration/PaymentTest.php index 7db8addb..7b865d20 100755 --- a/test/integration/PaymentTest.php +++ b/test/integration/PaymentTest.php @@ -196,29 +196,6 @@ public function chargePaymentShouldThrowErrorOnNonPaymentId() $this->heidelpay->chargePayment('s-crd-xlj0qhdiw40k'); } - /** - * Verify an Exception is thrown if the orderId already exists. - * - * @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 apiShouldReturnErrorIfOrderIdAlreadyExists() - { - $orderId = str_replace(' ', '', microtime()); - - $paypal = $this->heidelpay->createPaymentType(new Paypal()); - $authorization = $this->heidelpay->authorize(100.00, 'EUR', $paypal, 'http://heidelpay.com', null, $orderId, null, null, false); - $this->assertNotEmpty($authorization); - - $paypal2 = $this->heidelpay->createPaymentType(new Paypal()); - - $this->expectException(HeidelpayApiException::class); - $this->expectExceptionCode(ApiResponseCodes::API_ERROR_ORDER_ID_ALREADY_IN_USE); - $this->heidelpay->authorize(101.00, 'EUR', $paypal2, 'http://heidelpay.com', null, $orderId, null, null, false); - } - /** * Verify a payment is fetched by orderId if the id is not set. * @@ -243,6 +220,7 @@ public function paymentShouldBeFetchedByOrderIdIfIdIsNotSet() * Verify orderId does not need to be unique. * * @test + * * @throws HeidelpayApiException * @throws RuntimeException */ @@ -268,6 +246,7 @@ public function shouldAllowNonUniqueOrderId() * Verify invoiceId does not need to be unique. * * @test + * * @throws HeidelpayApiException * @throws RuntimeException */ From 832b63653a7dff950ebee472ba9cca1b2244a331 Mon Sep 17 00:00:00 2001 From: sixer1182 Date: Tue, 21 Jan 2020 10:17:40 +0100 Subject: [PATCH 11/11] [change] (PHPLIB-245) Fix CHANGELOG.md --- CHANGELOG.md | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e48af782..fe4e1008 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,7 +10,6 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a * Enabled recurring payment for SEPA direct debit (guaranteed). ### 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. @@ -26,6 +25,11 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a * Move method doc blocks to service interfaces. * Remove dead 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 @@ -358,4 +362,5 @@ 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 +[1.2.5.1]: https://github.com/heidelpay/heidelpayPHP/compare/1.2.5.0..1.2.5.1 +[1.2.6.0]: https://github.com/heidelpay/heidelpayPHP/compare/1.2.5.1..1.2.6.0