diff --git a/composer.json b/composer.json index c09d6227..d4712ec4 100644 --- a/composer.json +++ b/composer.json @@ -2,7 +2,7 @@ "name": "buckaroo/sdk", "description": "Buckaroo payment SDK", "license": "MIT", - "version": "1.10.0", + "version": "1.11.0", "type": "library", "require": { "php": ">=7.4|^8.0", diff --git a/src/Handlers/Logging/DefaultLogger.php b/src/Handlers/Logging/DefaultLogger.php index 70650d7f..a0b4fccc 100644 --- a/src/Handlers/Logging/DefaultLogger.php +++ b/src/Handlers/Logging/DefaultLogger.php @@ -37,7 +37,10 @@ class DefaultLogger implements Subject, LoggerInterface */ public function __construct() { - $this->attach(new Monolog()); + if (($_ENV['BPE_LOG'] ?? false) === 'true') + { + $this->attach(new Monolog()); + } if (($_ENV['BPE_REPORT_ERROR'] ?? false) === 'true') { diff --git a/src/PaymentMethods/In3/Service/ParameterKeys/PhoneAdapter.php b/src/PaymentMethods/In3/Service/ParameterKeys/PhoneAdapter.php index f18dd568..b14298c5 100644 --- a/src/PaymentMethods/In3/Service/ParameterKeys/PhoneAdapter.php +++ b/src/PaymentMethods/In3/Service/ParameterKeys/PhoneAdapter.php @@ -25,6 +25,6 @@ class PhoneAdapter extends ServiceParametersKeysAdapter { protected array $keys = [ - 'mobile' => 'MobilePhone' + 'mobile' => 'Phone' ]; } diff --git a/src/PaymentMethods/KnakenPay/KnakenPay.php b/src/PaymentMethods/KnakenPay/KnakenPay.php new file mode 100644 index 00000000..1ceb1559 --- /dev/null +++ b/src/PaymentMethods/KnakenPay/KnakenPay.php @@ -0,0 +1,47 @@ +payload)); + } +} diff --git a/src/PaymentMethods/KnakenPay/Models/Pay.php b/src/PaymentMethods/KnakenPay/Models/Pay.php new file mode 100644 index 00000000..8d0f15d1 --- /dev/null +++ b/src/PaymentMethods/KnakenPay/Models/Pay.php @@ -0,0 +1,28 @@ + ['in3old'], KlarnaPay::class => ['klarna', 'klarnain'], KlarnaKP::class => ['klarnakp'], + KnakenPay::class => ['knaken', 'knakenpay'], Multibanco::class => ['multibanco'], MBWay::class => ['mbway'], Surepay::class => ['surepay'], diff --git a/src/PaymentMethods/Subscriptions/Models/Subscription.php b/src/PaymentMethods/Subscriptions/Models/Subscription.php index 955b35be..3c88e21c 100644 --- a/src/PaymentMethods/Subscriptions/Models/Subscription.php +++ b/src/PaymentMethods/Subscriptions/Models/Subscription.php @@ -160,6 +160,12 @@ class Subscription extends ServiceParameter 'address' => [ 'groupType' => 'Address', ], + 'company' => [ + 'groupType' => 'Company', + ], + 'phone' => [ + 'groupType' => 'Phone', + ], 'addRatePlan' => [ 'groupType' => 'AddRatePlan', ], diff --git a/tests/Buckaroo/Payments/KBCTest.php b/tests/Buckaroo/Payments/KBCTest.php index 5fa57174..ce0a2669 100644 --- a/tests/Buckaroo/Payments/KBCTest.php +++ b/tests/Buckaroo/Payments/KBCTest.php @@ -24,6 +24,8 @@ class KBCTest extends BuckarooTestCase { + protected array $paymentPayload; + protected function setUp(): void { $this->paymentPayload = ([ diff --git a/tests/Buckaroo/Payments/KnakenPayTest.php b/tests/Buckaroo/Payments/KnakenPayTest.php new file mode 100644 index 00000000..71e57f96 --- /dev/null +++ b/tests/Buckaroo/Payments/KnakenPayTest.php @@ -0,0 +1,61 @@ +buckaroo->method('knaken')->pay([ + 'invoice' => uniqid(), + 'amountDebit' => 10.99, + 'returnURL' => 'https://buckaroo.dev./return', + 'returnURLCancel' => 'https://buckaroo.dev/cancel', + 'returnURLError' => 'https://buckaroo.dev/error', + 'returnURLReject' => 'https://buckaroo.dev/reject', + 'pushURL' => 'https://buckaroo.dev/push', + 'pushURLFailure' => 'https://buckaroo.dev/push-failure', + ]); + + $this->assertTrue($response->isPendingProcessing()); + } + + /** + * @test + */ + public function it_creates_a_knaken_refund() + { + $response = $this->buckaroo->method('knaken')->refund([ + 'invoice' => '2024020209061234', //Set invoice number of the transaction to refund + 'originalTransactionKey' => '2FBB9F43A0AF4AC8B49F9073C0EC828B', + //Set transaction key of the transaction to refund + 'amountCredit' => 0.01 + ]); + + $this->assertTrue($response->isFailed()); + } +} diff --git a/tests/Buckaroo/Payments/SepaTest.php b/tests/Buckaroo/Payments/SepaTest.php index 5a6194ac..918fcdd7 100644 --- a/tests/Buckaroo/Payments/SepaTest.php +++ b/tests/Buckaroo/Payments/SepaTest.php @@ -6,6 +6,8 @@ class SepaTest extends BuckarooTestCase { + protected array $paymentPayload; + protected function setUp(): void { $this->paymentPayload = ([ diff --git a/tests/Buckaroo/Payments/SofortTest.php b/tests/Buckaroo/Payments/SofortTest.php index ef4759da..e0656911 100644 --- a/tests/Buckaroo/Payments/SofortTest.php +++ b/tests/Buckaroo/Payments/SofortTest.php @@ -24,6 +24,8 @@ class SofortTest extends BuckarooTestCase { + protected array $paymentPayload; + protected function setUp(): void { $this->paymentPayload = ([