From 1328f9689159bb4f0ab1fa31bb197f8dee45a8e0 Mon Sep 17 00:00:00 2001 From: Shu Chen Date: Wed, 30 Aug 2023 11:45:02 +0200 Subject: [PATCH 01/16] Prepare release v1.8.0 (#139) * Request To Pay Payment method removed (#77) * Fixed an issue with getting issuers for iDeal (#78) Co-authored-by: Shu Chen * Adding missing subscriptions parameters (#79) * Add missing parameters * Add docblock * Bancontact update & fixes (#80) * Add missing parameters * Add docblock * Add bancontact alias * Fix wrong naming to payrecurring and add payoneclick method * Return null when response data is not set (#81) * BP-2345 add return and push url in the i deal qr request in the php sdk (#83) * Return null when response data is not set * Add missing parameters * Update test and example * 1.3.1 * Changing the version * Merge conflict * Update changelog * Update changelog * Return string instead of int in subcode code (#88) * [Bugfixes] outdated subscription example (#90) * Return string instead of int in subcode code * Update subscription examples * Update Paypal test * GitHub/action psr12 and phplint validation (#92) * 1.4.0 (#86) * Request To Pay Payment method removed (#77) * Fixed an issue with getting issuers for iDeal (#78) Co-authored-by: Shu Chen * Adding missing subscriptions parameters (#79) * Add missing parameters * Add docblock * Bancontact update & fixes (#80) * Add missing parameters * Add docblock * Add bancontact alias * Fix wrong naming to payrecurring and add payoneclick method * Return null when response data is not set (#81) * BP-2345 add return and push url in the i deal qr request in the php sdk (#83) * Return null when response data is not set * Add missing parameters * Update test and example * 1.3.1 * Changing the version * Merge conflict * Update changelog * Update changelog --------- Co-authored-by: reflie-nxte <122365318+reflie-nxte@users.noreply.github.com> * Added action * Added comment to trigger github action --------- Co-authored-by: Shu Chen Co-authored-by: reflie-nxte <122365318+reflie-nxte@users.noreply.github.com> * Update ideal qr test (#94) * BP-2404 Feature/8.2 support (#95) * Update ideal qr test * Add group reference * Move tests folder * wip * Conform phpcs * Remove comments * Release 1.5.0 (#97) * BP-2441 Added support for transaction requests without specifying a service code (#102) * Update Transaction Comment (#103) * 1.4.0 (#86) * Request To Pay Payment method removed (#77) * Fixed an issue with getting issuers for iDeal (#78) Co-authored-by: Shu Chen * Adding missing subscriptions parameters (#79) * Add missing parameters * Add docblock * Bancontact update & fixes (#80) * Add missing parameters * Add docblock * Add bancontact alias * Fix wrong naming to payrecurring and add payoneclick method * Return null when response data is not set (#81) * BP-2345 add return and push url in the i deal qr request in the php sdk (#83) * Return null when response data is not set * Add missing parameters * Update test and example * 1.3.1 * Changing the version * Merge conflict * Update changelog * Update changelog --------- Co-authored-by: reflie-nxte <122365318+reflie-nxte@users.noreply.github.com> * 1.5.0 (#98) * Request To Pay Payment method removed (#77) * Fixed an issue with getting issuers for iDeal (#78) Co-authored-by: Shu Chen * Adding missing subscriptions parameters (#79) * Add missing parameters * Add docblock * Bancontact update & fixes (#80) * Add missing parameters * Add docblock * Add bancontact alias * Fix wrong naming to payrecurring and add payoneclick method * Return null when response data is not set (#81) * BP-2345 add return and push url in the i deal qr request in the php sdk (#83) * Return null when response data is not set * Add missing parameters * Update test and example * 1.3.1 * Changing the version * Merge conflict * Update changelog * Update changelog * Return string instead of int in subcode code (#88) * [Bugfixes] outdated subscription example (#90) * Return string instead of int in subcode code * Update subscription examples * Update Paypal test * GitHub/action psr12 and phplint validation (#92) * 1.4.0 (#86) * Request To Pay Payment method removed (#77) * Fixed an issue with getting issuers for iDeal (#78) Co-authored-by: Shu Chen * Adding missing subscriptions parameters (#79) * Add missing parameters * Add docblock * Bancontact update & fixes (#80) * Add missing parameters * Add docblock * Add bancontact alias * Fix wrong naming to payrecurring and add payoneclick method * Return null when response data is not set (#81) * BP-2345 add return and push url in the i deal qr request in the php sdk (#83) * Return null when response data is not set * Add missing parameters * Update test and example * 1.3.1 * Changing the version * Merge conflict * Update changelog * Update changelog --------- Co-authored-by: reflie-nxte <122365318+reflie-nxte@users.noreply.github.com> * Added action * Added comment to trigger github action --------- Co-authored-by: Shu Chen Co-authored-by: reflie-nxte <122365318+reflie-nxte@users.noreply.github.com> * Update ideal qr test (#94) * BP-2404 Feature/8.2 support (#95) * Update ideal qr test * Add group reference * Move tests folder * wip * Conform phpcs * Remove comments * Release 1.5.0 (#97) --------- Co-authored-by: reflie-nxte <122365318+reflie-nxte@users.noreply.github.com> Co-authored-by: avido * Update Transaction Comment --------- Co-authored-by: Shu Chen Co-authored-by: reflie-nxte <122365318+reflie-nxte@users.noreply.github.com> Co-authored-by: avido * created new PayablePaymentMethod for when no service is specified * fix style * Minor fixes * update phpdoc, and fix Line exceeds 120 characters * Remove method paynoservice * Inlcude monolog version 3 * Include ramsey version 4 * Add missing property * Add PayRemainder in KlarnaPay (#112) * Pay remainder missing for some methods (#113) * Add PayRemainder to Alipay * Add PayRemainder to Paypal * Add PayRemainder to Payconiq * Add PayRemainder to Afterpay * Add PayRemainder to Trustly * Add PayRemainder to Przelewy24 * Add PayRemainder to Belfius * Add PayRemainder to EPS * Revert Belfius * Revert EPS * Revert Payconiq * BP-2509 Add Instant refunds,no service payment refactor (#109) * BP-2527 Batch functionality (#114) * WIP * Batch finished * Update php-cs-fixer * php cs fixer * PHPcs * Add transaction batch endpoint * phpcs fix * V1.6.0 * BP-2511 Removed Ippies (#117) * BP-2417 Added Thunes * Deleted Ippies * Deleted Thunes changes * BP-2417 Added Thunes (#111) * BP-2417 Added Thunes * BP-2417 Added Thunes * End of line * added the example again * Deleted Article.php * BP-2543 - Add (Bancontact) Deferred Sales (#116) * Added Deferred Sales * Authenticate method refers to authorize * BP-2617 - Allow CustomParameters (#118) * Added Deferred Sales * Authenticate method refers to authorize * Able to send custom parameters * Bugfix/addition parameter (#119) * Added Deferred Sales * Authenticate method refers to authorize * Able to send custom parameters * Fixing wrong name in additional parameter * Retain float in json_encode (#121) * Version change * BP-2507 Add Payment initiation (#110) * BP-2507 Add Payment initiation * BP-2507 Add Payment initiation * phpcs * PSR2 * PSR2 * Phpcs * Add missing shipping cost to refund in afterpay (#124) * Bp 2688 update readme file (#125) * v1.6.0 (#115) * Request To Pay Payment method removed (#77) * Fixed an issue with getting issuers for iDeal (#78) Co-authored-by: Shu Chen * Adding missing subscriptions parameters (#79) * Add missing parameters * Add docblock * Bancontact update & fixes (#80) * Add missing parameters * Add docblock * Add bancontact alias * Fix wrong naming to payrecurring and add payoneclick method * Return null when response data is not set (#81) * BP-2345 add return and push url in the i deal qr request in the php sdk (#83) * Return null when response data is not set * Add missing parameters * Update test and example * 1.3.1 * Changing the version * Merge conflict * Update changelog * Update changelog * Return string instead of int in subcode code (#88) * [Bugfixes] outdated subscription example (#90) * Return string instead of int in subcode code * Update subscription examples * Update Paypal test * GitHub/action psr12 and phplint validation (#92) * 1.4.0 (#86) * Request To Pay Payment method removed (#77) * Fixed an issue with getting issuers for iDeal (#78) Co-authored-by: Shu Chen * Adding missing subscriptions parameters (#79) * Add missing parameters * Add docblock * Bancontact update & fixes (#80) * Add missing parameters * Add docblock * Add bancontact alias * Fix wrong naming to payrecurring and add payoneclick method * Return null when response data is not set (#81) * BP-2345 add return and push url in the i deal qr request in the php sdk (#83) * Return null when response data is not set * Add missing parameters * Update test and example * 1.3.1 * Changing the version * Merge conflict * Update changelog * Update changelog --------- Co-authored-by: reflie-nxte <122365318+reflie-nxte@users.noreply.github.com> * Added action * Added comment to trigger github action --------- Co-authored-by: Shu Chen Co-authored-by: reflie-nxte <122365318+reflie-nxte@users.noreply.github.com> * Update ideal qr test (#94) * BP-2404 Feature/8.2 support (#95) * Update ideal qr test * Add group reference * Move tests folder * wip * Conform phpcs * Remove comments * Release 1.5.0 (#97) * BP-2441 Added support for transaction requests without specifying a service code (#102) * Update Transaction Comment (#103) * 1.4.0 (#86) * Request To Pay Payment method removed (#77) * Fixed an issue with getting issuers for iDeal (#78) Co-authored-by: Shu Chen * Adding missing subscriptions parameters (#79) * Add missing parameters * Add docblock * Bancontact update & fixes (#80) * Add missing parameters * Add docblock * Add bancontact alias * Fix wrong naming to payrecurring and add payoneclick method * Return null when response data is not set (#81) * BP-2345 add return and push url in the i deal qr request in the php sdk (#83) * Return null when response data is not set * Add missing parameters * Update test and example * 1.3.1 * Changing the version * Merge conflict * Update changelog * Update changelog --------- Co-authored-by: reflie-nxte <122365318+reflie-nxte@users.noreply.github.com> * 1.5.0 (#98) * Request To Pay Payment method removed (#77) * Fixed an issue with getting issuers for iDeal (#78) Co-authored-by: Shu Chen * Adding missing subscriptions parameters (#79) * Add missing parameters * Add docblock * Bancontact update & fixes (#80) * Add missing parameters * Add docblock * Add bancontact alias * Fix wrong naming to payrecurring and add payoneclick method * Return null when response data is not set (#81) * BP-2345 add return and push url in the i deal qr request in the php sdk (#83) * Return null when response data is not set * Add missing parameters * Update test and example * 1.3.1 * Changing the version * Merge conflict * Update changelog * Update changelog * Return string instead of int in subcode code (#88) * [Bugfixes] outdated subscription example (#90) * Return string instead of int in subcode code * Update subscription examples * Update Paypal test * GitHub/action psr12 and phplint validation (#92) * 1.4.0 (#86) * Request To Pay Payment method removed (#77) * Fixed an issue with getting issuers for iDeal (#78) Co-authored-by: Shu Chen * Adding missing subscriptions parameters (#79) * Add missing parameters * Add docblock * Bancontact update & fixes (#80) * Add missing parameters * Add docblock * Add bancontact alias * Fix wrong naming to payrecurring and add payoneclick method * Return null when response data is not set (#81) * BP-2345 add return and push url in the i deal qr request in the php sdk (#83) * Return null when response data is not set * Add missing parameters * Update test and example * 1.3.1 * Changing the version * Merge conflict * Update changelog * Update changelog --------- Co-authored-by: reflie-nxte <122365318+reflie-nxte@users.noreply.github.com> * Added action * Added comment to trigger github action --------- Co-authored-by: Shu Chen Co-authored-by: reflie-nxte <122365318+reflie-nxte@users.noreply.github.com> * Update ideal qr test (#94) * BP-2404 Feature/8.2 support (#95) * Update ideal qr test * Add group reference * Move tests folder * wip * Conform phpcs * Remove comments * Release 1.5.0 (#97) --------- Co-authored-by: reflie-nxte <122365318+reflie-nxte@users.noreply.github.com> Co-authored-by: avido * Update Transaction Comment --------- Co-authored-by: Shu Chen Co-authored-by: reflie-nxte <122365318+reflie-nxte@users.noreply.github.com> Co-authored-by: avido * created new PayablePaymentMethod for when no service is specified * fix style * Minor fixes * update phpdoc, and fix Line exceeds 120 characters * Remove method paynoservice * Inlcude monolog version 3 * Include ramsey version 4 * Add missing property * Add PayRemainder in KlarnaPay (#112) * Pay remainder missing for some methods (#113) * Add PayRemainder to Alipay * Add PayRemainder to Paypal * Add PayRemainder to Payconiq * Add PayRemainder to Afterpay * Add PayRemainder to Trustly * Add PayRemainder to Przelewy24 * Add PayRemainder to Belfius * Add PayRemainder to EPS * Revert Belfius * Revert EPS * Revert Payconiq * BP-2509 Add Instant refunds,no service payment refactor (#109) * BP-2527 Batch functionality (#114) * WIP * Batch finished * Update php-cs-fixer * php cs fixer * PHPcs * Add transaction batch endpoint * phpcs fix * V1.6.0 --------- Co-authored-by: reflie-nxte <122365318+reflie-nxte@users.noreply.github.com> Co-authored-by: avido Co-authored-by: Sander H <37146557+SandervdHulst@users.noreply.github.com> Co-authored-by: Muneeb Shoukat <89547149+Muneeb60coder@users.noreply.github.com> Co-authored-by: vegim carkaxhija Co-authored-by: Lucian Turiac <106905746+LucianTuriacArnia@users.noreply.github.com> Co-authored-by: Rinor12010 <105772190+Rinor12010@users.noreply.github.com> * Push validator fix (#123) * Retain float in json_encode * Version update * Update README.md Update READM.md --------- Co-authored-by: Shu Chen Co-authored-by: reflie-nxte <122365318+reflie-nxte@users.noreply.github.com> Co-authored-by: avido Co-authored-by: Sander H <37146557+SandervdHulst@users.noreply.github.com> Co-authored-by: Muneeb Shoukat <89547149+Muneeb60coder@users.noreply.github.com> Co-authored-by: vegim carkaxhija Co-authored-by: Lucian Turiac <106905746+LucianTuriacArnia@users.noreply.github.com> Co-authored-by: Rinor12010 <105772190+Rinor12010@users.noreply.github.com> * BP-2461 - Add the correct ModuleVersion and PlatformName (#120) * Added Deferred Sales * Authenticate method refers to authorize * Able to send custom parameters * Fixing wrong name in additional parameter * Ability to fill in software header * Able to pass in a config object into the constructor * PHP CS Fixer * Ignoring spaceafterkeyword * BP-2650 - Culture was not working correctly (#126) * BP-2417 Added Thunes * BP-2650 - Culture was not working correctly * Deleted Thunes/Models/Article.php * Adding culture to config * Phpcs fix --------- Co-authored-by: Shu Chen * Prepare v1.7.0 * Merge conflict resolved * Remove head merge conflict * Comment removal * Comment removal * Add pay by bank example (#128) * BP-2797 Add possibility to change Channel header (#134) * BP-2417 Added Thunes * BP-2797 Add possibility to change Channel header * delete file * Delete Channel from Payload * Features/in3new (#138) * In3 new * In3 new 2 * In3 new final touches * Filename update * In3 new added example --------- Co-authored-by: Shu Chen * Prepare release 1.8.0 --------- Co-authored-by: reflie-nxte <122365318+reflie-nxte@users.noreply.github.com> Co-authored-by: avido Co-authored-by: Sander H <37146557+SandervdHulst@users.noreply.github.com> Co-authored-by: Muneeb Shoukat <89547149+Muneeb60coder@users.noreply.github.com> Co-authored-by: vegim carkaxhija Co-authored-by: Lucian Turiac <106905746+LucianTuriacArnia@users.noreply.github.com> Co-authored-by: Rinor12010 <105772190+Rinor12010@users.noreply.github.com> Co-authored-by: Rene <105488705+Buckaroo-Rene@users.noreply.github.com> --- composer.json | 2 +- example/transactions/in3.php | 116 ++++++---- example/transactions/in3old.php | 78 +++++++ example/transactions/payment_initiation.php | 23 ++ src/Config/Config.php | 20 +- src/Models/Phone.php | 1 + src/PaymentMethods/In3/In3.php | 21 +- src/PaymentMethods/In3/Models/Article.php | 27 +++ src/PaymentMethods/In3/Models/Company.php | 26 +++ src/PaymentMethods/In3/Models/Pay.php | 159 ++++--------- src/PaymentMethods/In3/Models/Person.php | 28 +++ src/PaymentMethods/In3/Models/Recipient.php | 154 +++++++++++++ src/PaymentMethods/In3/Models/Refund.php | 58 +++++ .../Service/ParameterKeys/AddressAdapter.php | 6 +- .../Service/ParameterKeys/ArticleAdapter.php | 6 +- .../Service/ParameterKeys/PhoneAdapter.php | 4 +- .../ParameterKeys/RecipientAdapter.php | 34 +++ src/PaymentMethods/In3Old/In3Old.php | 63 ++++++ src/PaymentMethods/In3Old/Models/Pay.php | 211 ++++++++++++++++++ .../{In3 => In3Old}/Models/PayPayload.php | 2 +- .../{In3 => In3Old}/Models/Subtotal.php | 2 +- .../Service/ParameterKeys/AddressAdapter.php | 31 +++ .../Service/ParameterKeys/ArticleAdapter.php | 33 +++ .../Service/ParameterKeys/CompanyAdapter.php | 2 +- .../Service/ParameterKeys/PhoneAdapter.php | 30 +++ src/PaymentMethods/PaymentMethodFactory.php | 3 + .../TransactionHeaders/ChannelHeader.php | 56 +++++ src/Transaction/Client.php | 2 + tests/Buckaroo/Payments/AfterpayTest.php | 5 +- tests/Buckaroo/Payments/In3OldTest.php | 123 ++++++++++ tests/Buckaroo/Payments/In3Test.php | 137 +++++++----- 31 files changed, 1203 insertions(+), 260 deletions(-) create mode 100644 example/transactions/in3old.php create mode 100644 example/transactions/payment_initiation.php create mode 100644 src/PaymentMethods/In3/Models/Article.php create mode 100644 src/PaymentMethods/In3/Models/Company.php create mode 100644 src/PaymentMethods/In3/Models/Person.php create mode 100644 src/PaymentMethods/In3/Models/Recipient.php create mode 100644 src/PaymentMethods/In3/Models/Refund.php create mode 100644 src/PaymentMethods/In3/Service/ParameterKeys/RecipientAdapter.php create mode 100644 src/PaymentMethods/In3Old/In3Old.php create mode 100644 src/PaymentMethods/In3Old/Models/Pay.php rename src/PaymentMethods/{In3 => In3Old}/Models/PayPayload.php (95%) rename src/PaymentMethods/{In3 => In3Old}/Models/Subtotal.php (94%) create mode 100644 src/PaymentMethods/In3Old/Service/ParameterKeys/AddressAdapter.php create mode 100644 src/PaymentMethods/In3Old/Service/ParameterKeys/ArticleAdapter.php rename src/PaymentMethods/{In3 => In3Old}/Service/ParameterKeys/CompanyAdapter.php (93%) create mode 100644 src/PaymentMethods/In3Old/Service/ParameterKeys/PhoneAdapter.php create mode 100644 src/Services/TransactionHeaders/ChannelHeader.php create mode 100644 tests/Buckaroo/Payments/In3OldTest.php diff --git a/composer.json b/composer.json index 25842ccd..ebf10227 100644 --- a/composer.json +++ b/composer.json @@ -2,7 +2,7 @@ "name": "buckaroo/sdk", "description": "Buckaroo payment SDK", "license": "MIT", - "version": "1.7.6", + "version": "1.8.0", "type": "library", "require": { "php": ">=7.4|^8.0", diff --git a/example/transactions/in3.php b/example/transactions/in3.php index 2fc03cc4..64ec35df 100644 --- a/example/transactions/in3.php +++ b/example/transactions/in3.php @@ -3,73 +3,93 @@ require('../bootstrap.php'); use Buckaroo\BuckarooClient; -use Buckaroo\Resources\Constants\Gender; $buckaroo = new BuckarooClient($_ENV['BPE_WEBSITE_KEY'], $_ENV['BPE_SECRET_KEY']); $payload = [ - 'amountDebit' => 9.5, - 'order' => uniqid(), - 'invoice' => uniqid(), - 'description' => 'This is a test order', - 'invoiceDate' => '22-01-2018', - 'customerType' => 'Company', - 'email' => 'test@buckaroo.nl', - 'phone' => [ - 'mobile' => '0612345678', - ], - 'articles' => [ - [ - 'identifier' => uniqid(), - 'description' => 'Blue Toy Car', - 'quantity' => '1', - 'price' => 10.00, + 'amountDebit' => 52.30, + 'description' => 'in3 pay', + 'order' => uniqid(), + 'invoice' => uniqid(), + 'clientIP' => '127.0.0.1', + 'billing' => [ + 'recipient' => [ + 'category' => 'B2C', + 'initials' => 'J', + 'firstName' => 'John', + 'lastName' => 'Dona', + 'birthDate' => '1990-01-01', + 'customerNumber' => '12345', + 'phone' => '0612345678', + 'country' => 'NL', + 'companyName' => 'My Company B.V.', + 'chamberOfCommerce' => '123456' ], + 'address' => [ + 'street' => 'Hoofdstraat', + 'houseNumber' => '13', + 'houseNumberAdditional' => 'a', + 'zipcode' => '1234AB', + 'city' => 'Heerenveen', + 'country' => 'NL', + ], + 'phone' => [ + 'phone' => '0698765433', + ], + 'email' => 'test@buckaroo.nl', ], - 'company' => [ - 'companyName' => 'My Company B.V.', - 'chamberOfCommerce' => '123456', - ], - 'customer' => [ - 'gender' => Gender::FEMALE, - 'initials' => 'J.S.', - 'lastName' => 'Aflever', - 'email' => 'billingcustomer@buckaroo.nl', - 'phone' => '0610000000', - 'culture' => 'nl-NL', - 'birthDate' => '1990-01-01', - ], - 'address' => [ - 'street' => 'Hoofdstraat', - 'houseNumber' => '2', - 'houseNumberAdditional' => 'a', - 'zipcode' => '8441EE', - 'city' => 'Heerenveen', - 'country' => 'NL', + 'shipping' => [ + 'recipient' => [ + 'category' => 'B2C', + 'careOf' => 'John Smith', + 'firstName' => 'John', + 'lastName' => 'Do', + 'chamberOfCommerce' => '123456' + ], + 'address' => [ + 'street' => 'Kalverstraat', + 'houseNumber' => '13', + 'houseNumberAdditional' => 'b', + 'zipcode' => '4321EB', + 'city' => 'Amsterdam', + 'country' => 'NL', + ], ], - 'subtotals' => [ + 'articles' => [ [ - 'name' => 'Korting', - 'value' => -2.00, + 'identifier' => 'Articlenumber1', + 'type' => 'Physical', + 'description' => 'Blue Toy Car', + 'category' => 'test product', + 'vatPercentage' => '21', + 'quantity' => '2', + 'price' => '20.10', ], [ - 'name' => 'Betaaltoeslag', - 'value' => 0.50, + 'identifier' => 'Articlenumber2', + 'type' => 'Physical', + 'description' => 'Red Toy Car', + 'category' => 'test product', + 'vatPercentage' => '21', + 'quantity' => '1', + 'price' => '10.10', ], [ - 'name' => 'Verzendkosten', - 'value' => 1.00, + 'identifier' => 'USPShippingID', + 'type' => 'Physical', + 'description' => 'UPS', + 'category' => 'test product', + 'vatPercentage' => '21', + 'quantity' => '1', + 'price' => '2', ], - ], + ] ]; //Also accepts json //Pay $response = $buckaroo->method('in3')->pay($payload); -//Pay installment -$response = $buckaroo->method('in3')->payInInstallments($payload); - //Refund $response = $buckaroo->method('in3')->refund([ 'amountCredit' => 10, diff --git a/example/transactions/in3old.php b/example/transactions/in3old.php new file mode 100644 index 00000000..77272c07 --- /dev/null +++ b/example/transactions/in3old.php @@ -0,0 +1,78 @@ + 9.5, + 'order' => uniqid(), + 'invoice' => uniqid(), + 'description' => 'This is a test order', + 'invoiceDate' => '22-01-2018', + 'customerType' => 'Company', + 'email' => 'test@buckaroo.nl', + 'phone' => [ + 'mobile' => '0612345678', + ], + 'articles' => [ + [ + 'identifier' => uniqid(), + 'description' => 'Blue Toy Car', + 'quantity' => '1', + 'price' => 10.00, + ], + ], + 'company' => [ + 'companyName' => 'My Company B.V.', + 'chamberOfCommerce' => '123456', + ], + 'customer' => [ + 'gender' => Gender::FEMALE, + 'initials' => 'J.S.', + 'lastName' => 'Aflever', + 'email' => 'billingcustomer@buckaroo.nl', + 'phone' => '0610000000', + 'culture' => 'nl-NL', + 'birthDate' => '1990-01-01', + ], + 'address' => [ + 'street' => 'Hoofdstraat', + 'houseNumber' => '2', + 'houseNumberAdditional' => 'a', + 'zipcode' => '8441EE', + 'city' => 'Heerenveen', + 'country' => 'NL', + ], + 'subtotals' => [ + [ + 'name' => 'Korting', + 'value' => -2.00, + ], + [ + 'name' => 'Betaaltoeslag', + 'value' => 0.50, + ], + [ + 'name' => 'Verzendkosten', + 'value' => 1.00, + ], + ], +]; + +//Also accepts json +//Pay +$response = $buckaroo->method('in3Old')->pay($payload); + +//Pay installment +$response = $buckaroo->method('in3Old')->payInInstallments($payload); + +//Refund +$response = $buckaroo->method('in3Old')->refund([ + 'amountCredit' => 10, + 'invoice' => '10000480', + 'originalTransactionKey' => '9AA4C81A08A84FA7B68E6A6A6291XXXX', +]); diff --git a/example/transactions/payment_initiation.php b/example/transactions/payment_initiation.php new file mode 100644 index 00000000..b8eb9eb2 --- /dev/null +++ b/example/transactions/payment_initiation.php @@ -0,0 +1,23 @@ +method('paybybank')->pay([ + 'returnURL' => 'https://example.com/return', + 'amountDebit' => 10, + 'description' => 'Payment for testinvoice123', + 'issuer' => 'ABNANL2A', +]); + +//Refund +$response = $buckaroo->method('paybybank')->refund([ + 'invoice' => '', //Set invoice number of the transaction to refund + 'originalTransactionKey' => '', //Set transaction key of the transaction to refund + 'amountCredit' => 10, +]); \ No newline at end of file diff --git a/src/Config/Config.php b/src/Config/Config.php index 62c1b34f..dddfc0c4 100644 --- a/src/Config/Config.php +++ b/src/Config/Config.php @@ -91,7 +91,10 @@ abstract class Config implements Loggable * @var string|mixed */ private string $culture; - + /** + * @var string|mixed + */ + private string $channel; /** * @var Subject */ @@ -111,6 +114,7 @@ abstract class Config implements Loggable * @param string|null $moduleName * @param string|null $moduleVersion * @param string|null $culture + * @param string|null $channel * @param Subject|null $logger */ public function __construct( @@ -127,6 +131,7 @@ public function __construct( ?string $moduleName = null, ?string $moduleVersion = null, ?string $culture = null, + ?string $channel = null, Subject $logger = null ) { $this->websiteKey = $websiteKey; @@ -143,6 +148,7 @@ public function __construct( $this->moduleName = $_ENV['ModuleName'] ?? $moduleName ?? 'Empty Module name'; $this->moduleVersion = $_ENV['ModuleVersion'] ?? $moduleVersion ?? '1.0.0'; $this->culture = $_ENV['Culture'] ?? $culture ?? ''; + $this->channel = $_ENV['Channel'] ?? $channel ?? ''; $this->setLogger($logger ?? new DefaultLogger()); } @@ -270,6 +276,18 @@ public function culture(): string return 'en-GB'; } + /** + * @return string + */ + public function channel(): string + { + if (! empty($this->channel)) + { + return $this->channel; + } + return 'Web'; + } + /** * @param array $payload * @return $this diff --git a/src/Models/Phone.php b/src/Models/Phone.php index 3f07e9d1..3ecb257e 100644 --- a/src/Models/Phone.php +++ b/src/Models/Phone.php @@ -24,5 +24,6 @@ class Phone extends Model { protected string $landLine; protected string $mobile; + protected string $phone; protected string $fax; } diff --git a/src/PaymentMethods/In3/In3.php b/src/PaymentMethods/In3/In3.php index 818cdd70..4f659a0b 100644 --- a/src/PaymentMethods/In3/In3.php +++ b/src/PaymentMethods/In3/In3.php @@ -31,12 +31,7 @@ class In3 extends PayablePaymentMethod /** * @var string */ - protected string $paymentName = 'Capayable'; - - /** - * @var string - */ - protected string $payModel = PayPayload::class; + protected string $paymentName = 'In3'; /** * @param Model|null $model @@ -46,18 +41,4 @@ public function pay(?Model $model = null): TransactionResponse { return parent::pay($model ?? new Pay($this->payload)); } - - /** - * @return In3|mixed - */ - public function payInInstallments() - { - $pay = new Pay($this->payload); - - $this->setPayPayload(); - - $this->setServiceList('PayInInstallments', $pay); - - return $this->postRequest(); - } } diff --git a/src/PaymentMethods/In3/Models/Article.php b/src/PaymentMethods/In3/Models/Article.php new file mode 100644 index 00000000..4e8e8993 --- /dev/null +++ b/src/PaymentMethods/In3/Models/Article.php @@ -0,0 +1,27 @@ + [ - 'groupType' => 'ProductLine', - ], - 'address' => [ - 'groupType' => 'Address', - ], - 'customer' => [ - 'groupType' => 'Person', - ], - 'company' => [ - 'groupType' => 'Company', - ], - 'phone' => [ - 'groupType' => 'Phone', - ], - 'email' => [ - 'groupType' => 'Email', + 'groupType' => 'Article', ], ]; /** - * @param array|null $articles - * @return array + * @param $billing + * @return Recipient */ - public function articles(?array $articles = null) + public function billing($billing = null) { - if (is_array($articles)) + if (is_array($billing)) { - foreach ($articles as $article) - { - $this->articles[] = new ArticleAdapter(new Article($article)); - } + $this->billingRecipient = new Recipient('Billing', $billing); + $this->shippingRecipient = new Recipient('Shipping', $billing); } - return $this->articles; + return $this->billingRecipient; } /** - * @param $company - * @return CompanyAdapter + * @param $shipping + * @return Recipient */ - public function company($company = null) + public function shipping($shipping = null) { - if (is_array($company)) + if (is_array($shipping)) { - $this->company = new CompanyAdapter(new Company($company)); + $this->shippingRecipient = new Recipient('Shipping', $shipping); } - return $this->company; + return $this->shippingRecipient; } /** - * @param $customer - * @return Person - */ - public function customer($customer = null) - { - if (is_array($customer)) - { - $this->customer = new Person($customer); - } - - return $this->customer; - } - - /** - * @param $address - * @return AddressAdapter - */ - public function address($address = null) - { - if (is_array($address)) - { - $this->address = new AddressAdapter(new Address($address)); - } - - return $this->address; - } - - /** - * @param $email - * @return Email - */ - public function email($email = null) - { - if (is_string($email)) - { - $this->email = new Email($email); - } - - return $this->email; - } - - /** - * @param $phone - * @return PhoneAdapter - */ - public function phone($phone = null) - { - if (is_array($phone)) - { - $this->phone = new PhoneAdapter(new Phone($phone)); - } - - return $this->phone; - } - - /** - * @param array|null $subtotals + * @param array|null $articles * @return array */ - public function subtotals(?array $subtotals = null) + public function articles(?array $articles = null) { - if (is_array($subtotals)) + if (is_array($articles)) { - foreach ($subtotals as $subtotal) + foreach ($articles as $article) { - $this->subtotals[] = new Subtotal($subtotal); + $this->articles[] = new ArticleAdapter(new Article($article)); } } - return $this->subtotals; + return $this->articles; } } diff --git a/src/PaymentMethods/In3/Models/Person.php b/src/PaymentMethods/In3/Models/Person.php new file mode 100644 index 00000000..06a2d918 --- /dev/null +++ b/src/PaymentMethods/In3/Models/Person.php @@ -0,0 +1,28 @@ +type = $type; + + parent::__construct($values); + } + + /** + * @param $recipient + * @return RecipientInterface + * @throws \Exception + */ + public function recipient($recipient = null) + { + if (is_array($recipient)) + { + $this->recipient = $this->getRecipientObject($recipient); + } + + return $this->recipient; + } + + /** + * @param $address + * @return AddressAdapter + */ + public function address($address = null) + { + if (is_array($address)) + { + $this->address = new AddressAdapter(new Address($address)); + } + + return $this->address; + } + + /** + * @param $phone + * @return PhoneAdapter + */ + public function phone($phone = null) + { + if (is_array($phone)) + { + $this->phone = new PhoneAdapter(new Phone($phone)); + } + + return $this->phone; + } + + /** + * @param $email + * @return Email + */ + public function email($email = null) + { + if (is_string($email)) + { + $this->email = new Email($email); + } + + return $this->email; + } + + /** + * @param array $recipient + * @return RecipientInterface + * @throws \Exception + */ + private function getRecipientObject(array $recipient) : RecipientInterface + { + if (isset($recipient['category'])) + { + switch ($recipient['category']) + { + case 'B2B': + return new RecipientAdapter(new Company($recipient)); + case 'B2C': + return new RecipientAdapter(new Person($recipient)); + } + } + + throw new \Exception('No recipient category found.'); + } + + /** + * @param string $key + * @return string|null + */ + public function getGroupType(string $key): ?string + { + return $this->type . 'Customer'; + } +} diff --git a/src/PaymentMethods/In3/Models/Refund.php b/src/PaymentMethods/In3/Models/Refund.php new file mode 100644 index 00000000..4a8f0f58 --- /dev/null +++ b/src/PaymentMethods/In3/Models/Refund.php @@ -0,0 +1,58 @@ + [ + 'groupType' => 'Article', + ], + ]; + + /** + * @param array|null $articles + * @return array + */ + public function articles(?array $articles = null) + { + if (is_array($articles)) + { + foreach ($articles as $article) + { + $this->articles[] = new ArticleAdapter(new Article($article)); + } + } + + return $this->articles; + } +} diff --git a/src/PaymentMethods/In3/Service/ParameterKeys/AddressAdapter.php b/src/PaymentMethods/In3/Service/ParameterKeys/AddressAdapter.php index af572101..c73ef28b 100644 --- a/src/PaymentMethods/In3/Service/ParameterKeys/AddressAdapter.php +++ b/src/PaymentMethods/In3/Service/ParameterKeys/AddressAdapter.php @@ -25,7 +25,9 @@ class AddressAdapter extends ServiceParametersKeysAdapter { protected array $keys = [ - 'houseNumberAdditional' => 'HouseNumberSuffix', - 'zipcode' => 'ZipCode', + 'houseNumber' => 'StreetNumber', + 'houseNumberAdditional' => 'StreetNumberSuffix', + 'zipcode' => 'PostalCode', + 'country' => 'CountryCode' ]; } diff --git a/src/PaymentMethods/In3/Service/ParameterKeys/ArticleAdapter.php b/src/PaymentMethods/In3/Service/ParameterKeys/ArticleAdapter.php index 2afa11b0..ef06e310 100644 --- a/src/PaymentMethods/In3/Service/ParameterKeys/ArticleAdapter.php +++ b/src/PaymentMethods/In3/Service/ParameterKeys/ArticleAdapter.php @@ -25,9 +25,7 @@ class ArticleAdapter extends ServiceParametersKeysAdapter { protected array $keys = [ - 'identifier' => 'Code', - 'description' => 'Name', - 'quantity' => 'Quantity', - 'price' => 'Price', + 'price' => 'GrossUnitPrice', + 'category' => 'Category', ]; } diff --git a/src/PaymentMethods/In3/Service/ParameterKeys/PhoneAdapter.php b/src/PaymentMethods/In3/Service/ParameterKeys/PhoneAdapter.php index 27fbe7c6..dbba7c25 100644 --- a/src/PaymentMethods/In3/Service/ParameterKeys/PhoneAdapter.php +++ b/src/PaymentMethods/In3/Service/ParameterKeys/PhoneAdapter.php @@ -25,6 +25,8 @@ class PhoneAdapter extends ServiceParametersKeysAdapter { protected array $keys = [ - 'mobile' => 'Phone', + 'landLine' => 'Phone', + 'mobile' => 'MobilePhone', + 'phone' => 'Phone' ]; } diff --git a/src/PaymentMethods/In3/Service/ParameterKeys/RecipientAdapter.php b/src/PaymentMethods/In3/Service/ParameterKeys/RecipientAdapter.php new file mode 100644 index 00000000..26c6e92a --- /dev/null +++ b/src/PaymentMethods/In3/Service/ParameterKeys/RecipientAdapter.php @@ -0,0 +1,34 @@ + 'Salutation', + 'chamberOfCommerce' => 'CocNumber', + 'companyName' => 'CompanyName', + 'customerNumber' => 'customerNumber', + ]; +} diff --git a/src/PaymentMethods/In3Old/In3Old.php b/src/PaymentMethods/In3Old/In3Old.php new file mode 100644 index 00000000..89d10279 --- /dev/null +++ b/src/PaymentMethods/In3Old/In3Old.php @@ -0,0 +1,63 @@ +payload)); + } + + /** + * @return In3Old|mixed + */ + public function payInInstallments() + { + $pay = new Pay($this->payload); + + $this->setPayPayload(); + + $this->setServiceList('PayInInstallments', $pay); + + return $this->postRequest(); + } +} diff --git a/src/PaymentMethods/In3Old/Models/Pay.php b/src/PaymentMethods/In3Old/Models/Pay.php new file mode 100644 index 00000000..d542bb50 --- /dev/null +++ b/src/PaymentMethods/In3Old/Models/Pay.php @@ -0,0 +1,211 @@ + [ + 'groupType' => 'ProductLine', + ], + 'address' => [ + 'groupType' => 'Address', + ], + 'customer' => [ + 'groupType' => 'Person', + ], + 'company' => [ + 'groupType' => 'Company', + ], + 'phone' => [ + 'groupType' => 'Phone', + ], + 'email' => [ + 'groupType' => 'Email', + ], + ]; + + /** + * @param array|null $articles + * @return array + */ + public function articles(?array $articles = null) + { + if (is_array($articles)) + { + foreach ($articles as $article) + { + $this->articles[] = new ArticleAdapter(new Article($article)); + } + } + + return $this->articles; + } + + /** + * @param $company + * @return CompanyAdapter + */ + public function company($company = null) + { + if (is_array($company)) + { + $this->company = new CompanyAdapter(new Company($company)); + } + + return $this->company; + } + + /** + * @param $customer + * @return Person + */ + public function customer($customer = null) + { + if (is_array($customer)) + { + $this->customer = new Person($customer); + } + + return $this->customer; + } + + /** + * @param $address + * @return AddressAdapter + */ + public function address($address = null) + { + if (is_array($address)) + { + $this->address = new AddressAdapter(new Address($address)); + } + + return $this->address; + } + + /** + * @param $email + * @return Email + */ + public function email($email = null) + { + if (is_string($email)) + { + $this->email = new Email($email); + } + + return $this->email; + } + + /** + * @param $phone + * @return PhoneAdapter + */ + public function phone($phone = null) + { + if (is_array($phone)) + { + $this->phone = new PhoneAdapter(new Phone($phone)); + } + + return $this->phone; + } + + /** + * @param array|null $subtotals + * @return array + */ + public function subtotals(?array $subtotals = null) + { + if (is_array($subtotals)) + { + foreach ($subtotals as $subtotal) + { + $this->subtotals[] = new Subtotal($subtotal); + } + } + + return $this->subtotals; + } +} diff --git a/src/PaymentMethods/In3/Models/PayPayload.php b/src/PaymentMethods/In3Old/Models/PayPayload.php similarity index 95% rename from src/PaymentMethods/In3/Models/PayPayload.php rename to src/PaymentMethods/In3Old/Models/PayPayload.php index ad05d9e5..ead144f7 100644 --- a/src/PaymentMethods/In3/Models/PayPayload.php +++ b/src/PaymentMethods/In3Old/Models/PayPayload.php @@ -18,7 +18,7 @@ * @license https://tldrlegal.com/license/mit-license */ -namespace Buckaroo\PaymentMethods\In3\Models; +namespace Buckaroo\PaymentMethods\In3Old\Models; use Buckaroo\Models\ClientIP; diff --git a/src/PaymentMethods/In3/Models/Subtotal.php b/src/PaymentMethods/In3Old/Models/Subtotal.php similarity index 94% rename from src/PaymentMethods/In3/Models/Subtotal.php rename to src/PaymentMethods/In3Old/Models/Subtotal.php index 1c1b6fd6..2c95eb2f 100644 --- a/src/PaymentMethods/In3/Models/Subtotal.php +++ b/src/PaymentMethods/In3Old/Models/Subtotal.php @@ -18,7 +18,7 @@ * @license https://tldrlegal.com/license/mit-license */ -namespace Buckaroo\PaymentMethods\In3\Models; +namespace Buckaroo\PaymentMethods\In3Old\Models; use Buckaroo\Models\Model; diff --git a/src/PaymentMethods/In3Old/Service/ParameterKeys/AddressAdapter.php b/src/PaymentMethods/In3Old/Service/ParameterKeys/AddressAdapter.php new file mode 100644 index 00000000..868dda39 --- /dev/null +++ b/src/PaymentMethods/In3Old/Service/ParameterKeys/AddressAdapter.php @@ -0,0 +1,31 @@ + 'HouseNumberSuffix', + 'zipcode' => 'ZipCode', + ]; +} diff --git a/src/PaymentMethods/In3Old/Service/ParameterKeys/ArticleAdapter.php b/src/PaymentMethods/In3Old/Service/ParameterKeys/ArticleAdapter.php new file mode 100644 index 00000000..470eed16 --- /dev/null +++ b/src/PaymentMethods/In3Old/Service/ParameterKeys/ArticleAdapter.php @@ -0,0 +1,33 @@ + 'Code', + 'description' => 'Name', + 'quantity' => 'Quantity', + 'price' => 'Price', + ]; +} diff --git a/src/PaymentMethods/In3/Service/ParameterKeys/CompanyAdapter.php b/src/PaymentMethods/In3Old/Service/ParameterKeys/CompanyAdapter.php similarity index 93% rename from src/PaymentMethods/In3/Service/ParameterKeys/CompanyAdapter.php rename to src/PaymentMethods/In3Old/Service/ParameterKeys/CompanyAdapter.php index 868543c1..ab56fa23 100644 --- a/src/PaymentMethods/In3/Service/ParameterKeys/CompanyAdapter.php +++ b/src/PaymentMethods/In3Old/Service/ParameterKeys/CompanyAdapter.php @@ -18,7 +18,7 @@ * @license https://tldrlegal.com/license/mit-license */ -namespace Buckaroo\PaymentMethods\In3\Service\ParameterKeys; +namespace Buckaroo\PaymentMethods\In3Old\Service\ParameterKeys; use Buckaroo\Models\Adapters\ServiceParametersKeysAdapter; diff --git a/src/PaymentMethods/In3Old/Service/ParameterKeys/PhoneAdapter.php b/src/PaymentMethods/In3Old/Service/ParameterKeys/PhoneAdapter.php new file mode 100644 index 00000000..14bb2750 --- /dev/null +++ b/src/PaymentMethods/In3Old/Service/ParameterKeys/PhoneAdapter.php @@ -0,0 +1,30 @@ + 'Phone', + ]; +} diff --git a/src/PaymentMethods/PaymentMethodFactory.php b/src/PaymentMethods/PaymentMethodFactory.php index 35c5beb8..ca9149df 100644 --- a/src/PaymentMethods/PaymentMethodFactory.php +++ b/src/PaymentMethods/PaymentMethodFactory.php @@ -42,6 +42,7 @@ use Buckaroo\PaymentMethods\iDealQR\iDealQR; use Buckaroo\PaymentMethods\iDin\iDin; use Buckaroo\PaymentMethods\In3\In3; +use Buckaroo\PaymentMethods\In3Old\In3Old; use Buckaroo\PaymentMethods\KBC\KBC; use Buckaroo\PaymentMethods\KlarnaKP\KlarnaKP; use Buckaroo\PaymentMethods\KlarnaPay\KlarnaPay; @@ -91,6 +92,7 @@ class PaymentMethodFactory iDealQR::class => ['ideal_qr'], iDin::class => ['idin'], In3::class => ['in3'], + In3Old::class => ['in3old'], KlarnaPay::class => ['klarna', 'klarnain'], KlarnaKP::class => ['klarnakp'], Surepay::class => ['surepay'], @@ -110,6 +112,7 @@ class PaymentMethodFactory Przelewy24::class => ['przelewy24'], PointOfSale::class => ['pospayment'], Giropay::class => ['giropay'], + NoServiceSpecifiedPayment::class => ['noservice'], GiftCard::class => [ 'giftcard', 'westlandbon', 'babygiftcard', 'babyparkgiftcard', 'beautywellness', 'boekenbon', 'boekenvoordeel', diff --git a/src/Services/TransactionHeaders/ChannelHeader.php b/src/Services/TransactionHeaders/ChannelHeader.php new file mode 100644 index 00000000..f63beb5b --- /dev/null +++ b/src/Services/TransactionHeaders/ChannelHeader.php @@ -0,0 +1,56 @@ +config = $config; + + parent::__construct($transactionHeader); + } + + /** + * @return array + */ + public function getHeaders(): array + { + $headers = $this->transactionHeader->getHeaders(); + + $headers[] = "Channel: " . $this->config->channel(); + + return $headers; + } +} diff --git a/src/Transaction/Client.php b/src/Transaction/Client.php index 3d7e707f..b3116fac 100644 --- a/src/Transaction/Client.php +++ b/src/Transaction/Client.php @@ -27,6 +27,7 @@ use Buckaroo\Handlers\Logging\Subject; use Buckaroo\Resources\Constants\Endpoints; use Buckaroo\Services\TransactionHeaders\CultureHeader; +use Buckaroo\Services\TransactionHeaders\ChannelHeader; use Buckaroo\Services\TransactionHeaders\DefaultHeader; use Buckaroo\Services\TransactionHeaders\HmacHeader; use Buckaroo\Services\TransactionHeaders\SoftwareHeader; @@ -98,6 +99,7 @@ protected function getHeaders(string $url, string $data, string $method): array $headers = new HmacHeader($headers, $this->config, $url, $data, $method); $headers = new CultureHeader($headers, $this->config); + $headers = new ChannelHeader($headers, $this->config); $headers = new SoftwareHeader($headers, $this->config); return $headers->getHeaders(); diff --git a/tests/Buckaroo/Payments/AfterpayTest.php b/tests/Buckaroo/Payments/AfterpayTest.php index 9583477a..86841ec0 100644 --- a/tests/Buckaroo/Payments/AfterpayTest.php +++ b/tests/Buckaroo/Payments/AfterpayTest.php @@ -124,14 +124,15 @@ private function getPaymentPayload(?array $additional = null): array 'clientIP' => '127.0.0.1', 'billing' => [ 'recipient' => [ - 'category' => RecipientCategory::PERSON, + 'category' => RecipientCategory::COMPANY, 'careOf' => 'John Smith', 'title' => 'Mrs', 'firstName' => 'John', 'lastName' => 'Do', 'birthDate' => '1990-01-01', + 'companyName' => 'buckarooTest', 'conversationLanguage' => 'NL', - 'identificationNumber' => 'IdNumber12345', + 'chamberOfCommerce' => 'IdNumber12345', 'customerNumber' => 'customerNumber12345' ], 'address' => [ diff --git a/tests/Buckaroo/Payments/In3OldTest.php b/tests/Buckaroo/Payments/In3OldTest.php new file mode 100644 index 00000000..a4cd9b7e --- /dev/null +++ b/tests/Buckaroo/Payments/In3OldTest.php @@ -0,0 +1,123 @@ +buckaroo->method('in3old')->pay($this->getPaymentPayload()); + + $this->assertTrue($response->isSuccess()); + } + + /** + * @return void + * @test + */ + public function it_creates_a_in3old_installments_payment() + { + $response = $this->buckaroo->method('in3Old')->payInInstallments($this->getPaymentPayload()); + + $this->assertTrue($response->isPendingProcessing()); + } + + /** + * @return void + * @test + */ + public function it_creates_a_in3old_refund() + { + $response = $this->buckaroo->method('in3Old')->refund([ + 'amountCredit' => 10, + 'invoice' => '10000480', + 'originalTransactionKey' => '9AA4C81A08A84FA7B68E6A6A6291XXXX', + ]); + + $this->assertTrue($response->isFailed()); + } + + private function getPaymentPayload(): array + { + return [ + 'amountDebit' => 9.5, + 'order' => uniqid(), + 'invoice' => uniqid(), + 'description' => 'This is a test order', + 'invoiceDate' => '22-01-2018', + 'customerType' => 'Company', + 'email' => 'test@buckaroo.nl', + 'phone' => [ + 'mobile' => '0612345678', + ], + 'articles' => [ + [ + 'identifier' => uniqid(), + 'description' => 'Blue Toy Car', + 'quantity' => '1', + 'price' => 10.00, + ], + ], + 'company' => [ + 'companyName' => 'My Company B.V.', + 'chamberOfCommerce' => '123456', + ], + 'customer' => [ + 'gender' => Gender::FEMALE, + 'initials' => 'J.S.', + 'lastName' => 'Aflever', + 'email' => 'billingcustomer@buckaroo.nl', + 'phone' => '0610000000', + 'culture' => 'nl-NL', + 'birthDate' => '1990-01-01', + ], + 'address' => [ + 'street' => 'Hoofdstraat', + 'houseNumber' => '2', + 'houseNumberAdditional' => 'a', + 'zipcode' => '8441EE', + 'city' => 'Heerenveen', + 'country' => 'NL', + ], + 'subtotals' => [ + [ + 'name' => 'Korting', + 'value' => -2.00, + ], + [ + 'name' => 'Betaaltoeslag', + 'value' => 0.50, + ], + [ + 'name' => 'Verzendkosten', + 'value' => 1.00, + ], + ], + ]; + } +} diff --git a/tests/Buckaroo/Payments/In3Test.php b/tests/Buckaroo/Payments/In3Test.php index ea22d7af..18a32c85 100644 --- a/tests/Buckaroo/Payments/In3Test.php +++ b/tests/Buckaroo/Payments/In3Test.php @@ -20,6 +20,7 @@ namespace Tests\Buckaroo\Payments; +use Buckaroo\Resources\Constants\RecipientCategory; use Tests\Buckaroo\BuckarooTestCase; use Buckaroo\Resources\Constants\Gender; @@ -33,17 +34,6 @@ public function it_creates_a_in3_payment() { $response = $this->buckaroo->method('in3')->pay($this->getPaymentPayload()); - $this->assertTrue($response->isSuccess()); - } - - /** - * @return void - * @test - */ - public function it_creates_a_in3_installments_payment() - { - $response = $this->buckaroo->method('in3')->payInInstallments($this->getPaymentPayload()); - $this->assertTrue($response->isPendingProcessing()); } @@ -53,7 +43,7 @@ public function it_creates_a_in3_installments_payment() */ public function it_creates_a_in3_refund() { - $response = $this->buckaroo->method('in3')->refund([ + $response = $this->buckaroo->method('in3Old')->refund([ 'amountCredit' => 10, 'invoice' => '10000480', 'originalTransactionKey' => '9AA4C81A08A84FA7B68E6A6A6291XXXX', @@ -62,62 +52,93 @@ public function it_creates_a_in3_refund() $this->assertTrue($response->isFailed()); } - private function getPaymentPayload(): array + private function getPaymentPayload(?array $additional = null): array { - return [ - 'amountDebit' => 9.5, - 'order' => uniqid(), - 'invoice' => uniqid(), - 'description' => 'This is a test order', - 'invoiceDate' => '22-01-2018', - 'customerType' => 'Company', - 'email' => 'test@buckaroo.nl', - 'phone' => [ - 'mobile' => '0612345678', - ], - 'articles' => [ - [ - 'identifier' => uniqid(), - 'description' => 'Blue Toy Car', - 'quantity' => '1', - 'price' => 10.00, + $payload = [ + 'amountDebit' => 52.30, + 'description' => 'in3 pay', + 'order' => uniqid(), + 'invoice' => uniqid(), + 'clientIP' => '127.0.0.1', + 'billing' => [ + 'recipient' => [ + 'category' => 'B2C', + 'initials' => 'J', + 'firstName' => 'John', + 'lastName' => 'Dona', + 'birthDate' => '1990-01-01', + 'customerNumber' => '12345', + 'phone' => '0612345678', + 'country' => 'NL', + 'companyName' => 'My Company B.V.', + 'chamberOfCommerce' => '123456' ], + 'address' => [ + 'street' => 'Hoofdstraat', + 'houseNumber' => '13', + 'houseNumberAdditional' => 'a', + 'zipcode' => '1234AB', + 'city' => 'Heerenveen', + 'country' => 'NL', + ], + 'phone' => [ + 'phone' => '0698765433', + ], + 'email' => 'test@buckaroo.nl', ], - 'company' => [ - 'companyName' => 'My Company B.V.', - 'chamberOfCommerce' => '123456', - ], - 'customer' => [ - 'gender' => Gender::FEMALE, - 'initials' => 'J.S.', - 'lastName' => 'Aflever', - 'email' => 'billingcustomer@buckaroo.nl', - 'phone' => '0610000000', - 'culture' => 'nl-NL', - 'birthDate' => '1990-01-01', - ], - 'address' => [ - 'street' => 'Hoofdstraat', - 'houseNumber' => '2', - 'houseNumberAdditional' => 'a', - 'zipcode' => '8441EE', - 'city' => 'Heerenveen', - 'country' => 'NL', + 'shipping' => [ + 'recipient' => [ + 'category' => 'B2C', + 'careOf' => 'John Smith', + 'firstName' => 'John', + 'lastName' => 'Do', + 'chamberOfCommerce' => '123456' + ], + 'address' => [ + 'street' => 'Kalverstraat', + 'houseNumber' => '13', + 'houseNumberAdditional' => 'b', + 'zipcode' => '4321EB', + 'city' => 'Amsterdam', + 'country' => 'NL', + ], ], - 'subtotals' => [ + 'articles' => [ [ - 'name' => 'Korting', - 'value' => -2.00, + 'identifier' => 'Articlenumber1', + 'type' => 'Physical', + 'description' => 'Blue Toy Car', + 'category' => 'test product', + 'vatPercentage' => '21', + 'quantity' => '2', + 'price' => '20.10', ], [ - 'name' => 'Betaaltoeslag', - 'value' => 0.50, + 'identifier' => 'Articlenumber2', + 'type' => 'Physical', + 'description' => 'Red Toy Car', + 'category' => 'test product', + 'vatPercentage' => '21', + 'quantity' => '1', + 'price' => '10.10', ], [ - 'name' => 'Verzendkosten', - 'value' => 1.00, + 'identifier' => 'USPShippingID', + 'type' => 'Physical', + 'description' => 'UPS', + 'category' => 'test product', + 'vatPercentage' => '21', + 'quantity' => '1', + 'price' => '2', ], - ], + ] ]; + + if ($additional) + { + return array_merge($additional, $payload); + } + + return $payload; } } From 2760da82ae038337f736e842133ed532d43cf92f Mon Sep 17 00:00:00 2001 From: Shu Chen Date: Tue, 24 Oct 2023 13:04:13 +0200 Subject: [PATCH 02/16] Prepare v1.8.1 (#149) * Request To Pay Payment method removed (#77) * Fixed an issue with getting issuers for iDeal (#78) Co-authored-by: Shu Chen * Adding missing subscriptions parameters (#79) * Add missing parameters * Add docblock * Bancontact update & fixes (#80) * Add missing parameters * Add docblock * Add bancontact alias * Fix wrong naming to payrecurring and add payoneclick method * Return null when response data is not set (#81) * BP-2345 add return and push url in the i deal qr request in the php sdk (#83) * Return null when response data is not set * Add missing parameters * Update test and example * 1.3.1 * Changing the version * Merge conflict * Update changelog * Update changelog * Return string instead of int in subcode code (#88) * [Bugfixes] outdated subscription example (#90) * Return string instead of int in subcode code * Update subscription examples * Update Paypal test * GitHub/action psr12 and phplint validation (#92) * 1.4.0 (#86) * Request To Pay Payment method removed (#77) * Fixed an issue with getting issuers for iDeal (#78) Co-authored-by: Shu Chen * Adding missing subscriptions parameters (#79) * Add missing parameters * Add docblock * Bancontact update & fixes (#80) * Add missing parameters * Add docblock * Add bancontact alias * Fix wrong naming to payrecurring and add payoneclick method * Return null when response data is not set (#81) * BP-2345 add return and push url in the i deal qr request in the php sdk (#83) * Return null when response data is not set * Add missing parameters * Update test and example * 1.3.1 * Changing the version * Merge conflict * Update changelog * Update changelog --------- Co-authored-by: reflie-nxte <122365318+reflie-nxte@users.noreply.github.com> * Added action * Added comment to trigger github action --------- Co-authored-by: Shu Chen Co-authored-by: reflie-nxte <122365318+reflie-nxte@users.noreply.github.com> * Update ideal qr test (#94) * BP-2404 Feature/8.2 support (#95) * Update ideal qr test * Add group reference * Move tests folder * wip * Conform phpcs * Remove comments * Release 1.5.0 (#97) * BP-2441 Added support for transaction requests without specifying a service code (#102) * Update Transaction Comment (#103) * 1.4.0 (#86) * Request To Pay Payment method removed (#77) * Fixed an issue with getting issuers for iDeal (#78) Co-authored-by: Shu Chen * Adding missing subscriptions parameters (#79) * Add missing parameters * Add docblock * Bancontact update & fixes (#80) * Add missing parameters * Add docblock * Add bancontact alias * Fix wrong naming to payrecurring and add payoneclick method * Return null when response data is not set (#81) * BP-2345 add return and push url in the i deal qr request in the php sdk (#83) * Return null when response data is not set * Add missing parameters * Update test and example * 1.3.1 * Changing the version * Merge conflict * Update changelog * Update changelog --------- Co-authored-by: reflie-nxte <122365318+reflie-nxte@users.noreply.github.com> * 1.5.0 (#98) * Request To Pay Payment method removed (#77) * Fixed an issue with getting issuers for iDeal (#78) Co-authored-by: Shu Chen * Adding missing subscriptions parameters (#79) * Add missing parameters * Add docblock * Bancontact update & fixes (#80) * Add missing parameters * Add docblock * Add bancontact alias * Fix wrong naming to payrecurring and add payoneclick method * Return null when response data is not set (#81) * BP-2345 add return and push url in the i deal qr request in the php sdk (#83) * Return null when response data is not set * Add missing parameters * Update test and example * 1.3.1 * Changing the version * Merge conflict * Update changelog * Update changelog * Return string instead of int in subcode code (#88) * [Bugfixes] outdated subscription example (#90) * Return string instead of int in subcode code * Update subscription examples * Update Paypal test * GitHub/action psr12 and phplint validation (#92) * 1.4.0 (#86) * Request To Pay Payment method removed (#77) * Fixed an issue with getting issuers for iDeal (#78) Co-authored-by: Shu Chen * Adding missing subscriptions parameters (#79) * Add missing parameters * Add docblock * Bancontact update & fixes (#80) * Add missing parameters * Add docblock * Add bancontact alias * Fix wrong naming to payrecurring and add payoneclick method * Return null when response data is not set (#81) * BP-2345 add return and push url in the i deal qr request in the php sdk (#83) * Return null when response data is not set * Add missing parameters * Update test and example * 1.3.1 * Changing the version * Merge conflict * Update changelog * Update changelog --------- Co-authored-by: reflie-nxte <122365318+reflie-nxte@users.noreply.github.com> * Added action * Added comment to trigger github action --------- Co-authored-by: Shu Chen Co-authored-by: reflie-nxte <122365318+reflie-nxte@users.noreply.github.com> * Update ideal qr test (#94) * BP-2404 Feature/8.2 support (#95) * Update ideal qr test * Add group reference * Move tests folder * wip * Conform phpcs * Remove comments * Release 1.5.0 (#97) --------- Co-authored-by: reflie-nxte <122365318+reflie-nxte@users.noreply.github.com> Co-authored-by: avido * Update Transaction Comment --------- Co-authored-by: Shu Chen Co-authored-by: reflie-nxte <122365318+reflie-nxte@users.noreply.github.com> Co-authored-by: avido * created new PayablePaymentMethod for when no service is specified * fix style * Minor fixes * update phpdoc, and fix Line exceeds 120 characters * Remove method paynoservice * Inlcude monolog version 3 * Include ramsey version 4 * Add missing property * BP-2417 Added Thunes * Add PayRemainder in KlarnaPay (#112) * Pay remainder missing for some methods (#113) * Add PayRemainder to Alipay * Add PayRemainder to Paypal * Add PayRemainder to Payconiq * Add PayRemainder to Afterpay * Add PayRemainder to Trustly * Add PayRemainder to Przelewy24 * Add PayRemainder to Belfius * Add PayRemainder to EPS * Revert Belfius * Revert EPS * Revert Payconiq * BP-2509 Add Instant refunds,no service payment refactor (#109) * BP-2527 Batch functionality (#114) * WIP * Batch finished * Update php-cs-fixer * php cs fixer * PHPcs * Add transaction batch endpoint * phpcs fix * V1.6.0 * BP-2511 Removed Ippies (#117) * BP-2417 Added Thunes * Deleted Ippies * Deleted Thunes changes * BP-2417 Added Thunes (#111) * BP-2417 Added Thunes * BP-2417 Added Thunes * End of line * added the example again * Deleted Article.php * BP-2543 - Add (Bancontact) Deferred Sales (#116) * Added Deferred Sales * Authenticate method refers to authorize * BP-2617 - Allow CustomParameters (#118) * Added Deferred Sales * Authenticate method refers to authorize * Able to send custom parameters * Bugfix/addition parameter (#119) * Added Deferred Sales * Authenticate method refers to authorize * Able to send custom parameters * Fixing wrong name in additional parameter * Retain float in json_encode (#121) * Version change * BP-2507 Add Payment initiation (#110) * BP-2507 Add Payment initiation * BP-2507 Add Payment initiation * phpcs * PSR2 * PSR2 * Phpcs * Add missing shipping cost to refund in afterpay (#124) * Bp 2688 update readme file (#125) * v1.6.0 (#115) * Request To Pay Payment method removed (#77) * Fixed an issue with getting issuers for iDeal (#78) Co-authored-by: Shu Chen * Adding missing subscriptions parameters (#79) * Add missing parameters * Add docblock * Bancontact update & fixes (#80) * Add missing parameters * Add docblock * Add bancontact alias * Fix wrong naming to payrecurring and add payoneclick method * Return null when response data is not set (#81) * BP-2345 add return and push url in the i deal qr request in the php sdk (#83) * Return null when response data is not set * Add missing parameters * Update test and example * 1.3.1 * Changing the version * Merge conflict * Update changelog * Update changelog * Return string instead of int in subcode code (#88) * [Bugfixes] outdated subscription example (#90) * Return string instead of int in subcode code * Update subscription examples * Update Paypal test * GitHub/action psr12 and phplint validation (#92) * 1.4.0 (#86) * Request To Pay Payment method removed (#77) * Fixed an issue with getting issuers for iDeal (#78) Co-authored-by: Shu Chen * Adding missing subscriptions parameters (#79) * Add missing parameters * Add docblock * Bancontact update & fixes (#80) * Add missing parameters * Add docblock * Add bancontact alias * Fix wrong naming to payrecurring and add payoneclick method * Return null when response data is not set (#81) * BP-2345 add return and push url in the i deal qr request in the php sdk (#83) * Return null when response data is not set * Add missing parameters * Update test and example * 1.3.1 * Changing the version * Merge conflict * Update changelog * Update changelog --------- Co-authored-by: reflie-nxte <122365318+reflie-nxte@users.noreply.github.com> * Added action * Added comment to trigger github action --------- Co-authored-by: Shu Chen Co-authored-by: reflie-nxte <122365318+reflie-nxte@users.noreply.github.com> * Update ideal qr test (#94) * BP-2404 Feature/8.2 support (#95) * Update ideal qr test * Add group reference * Move tests folder * wip * Conform phpcs * Remove comments * Release 1.5.0 (#97) * BP-2441 Added support for transaction requests without specifying a service code (#102) * Update Transaction Comment (#103) * 1.4.0 (#86) * Request To Pay Payment method removed (#77) * Fixed an issue with getting issuers for iDeal (#78) Co-authored-by: Shu Chen * Adding missing subscriptions parameters (#79) * Add missing parameters * Add docblock * Bancontact update & fixes (#80) * Add missing parameters * Add docblock * Add bancontact alias * Fix wrong naming to payrecurring and add payoneclick method * Return null when response data is not set (#81) * BP-2345 add return and push url in the i deal qr request in the php sdk (#83) * Return null when response data is not set * Add missing parameters * Update test and example * 1.3.1 * Changing the version * Merge conflict * Update changelog * Update changelog --------- Co-authored-by: reflie-nxte <122365318+reflie-nxte@users.noreply.github.com> * 1.5.0 (#98) * Request To Pay Payment method removed (#77) * Fixed an issue with getting issuers for iDeal (#78) Co-authored-by: Shu Chen * Adding missing subscriptions parameters (#79) * Add missing parameters * Add docblock * Bancontact update & fixes (#80) * Add missing parameters * Add docblock * Add bancontact alias * Fix wrong naming to payrecurring and add payoneclick method * Return null when response data is not set (#81) * BP-2345 add return and push url in the i deal qr request in the php sdk (#83) * Return null when response data is not set * Add missing parameters * Update test and example * 1.3.1 * Changing the version * Merge conflict * Update changelog * Update changelog * Return string instead of int in subcode code (#88) * [Bugfixes] outdated subscription example (#90) * Return string instead of int in subcode code * Update subscription examples * Update Paypal test * GitHub/action psr12 and phplint validation (#92) * 1.4.0 (#86) * Request To Pay Payment method removed (#77) * Fixed an issue with getting issuers for iDeal (#78) Co-authored-by: Shu Chen * Adding missing subscriptions parameters (#79) * Add missing parameters * Add docblock * Bancontact update & fixes (#80) * Add missing parameters * Add docblock * Add bancontact alias * Fix wrong naming to payrecurring and add payoneclick method * Return null when response data is not set (#81) * BP-2345 add return and push url in the i deal qr request in the php sdk (#83) * Return null when response data is not set * Add missing parameters * Update test and example * 1.3.1 * Changing the version * Merge conflict * Update changelog * Update changelog --------- Co-authored-by: reflie-nxte <122365318+reflie-nxte@users.noreply.github.com> * Added action * Added comment to trigger github action --------- Co-authored-by: Shu Chen Co-authored-by: reflie-nxte <122365318+reflie-nxte@users.noreply.github.com> * Update ideal qr test (#94) * BP-2404 Feature/8.2 support (#95) * Update ideal qr test * Add group reference * Move tests folder * wip * Conform phpcs * Remove comments * Release 1.5.0 (#97) --------- Co-authored-by: reflie-nxte <122365318+reflie-nxte@users.noreply.github.com> Co-authored-by: avido * Update Transaction Comment --------- Co-authored-by: Shu Chen Co-authored-by: reflie-nxte <122365318+reflie-nxte@users.noreply.github.com> Co-authored-by: avido * created new PayablePaymentMethod for when no service is specified * fix style * Minor fixes * update phpdoc, and fix Line exceeds 120 characters * Remove method paynoservice * Inlcude monolog version 3 * Include ramsey version 4 * Add missing property * Add PayRemainder in KlarnaPay (#112) * Pay remainder missing for some methods (#113) * Add PayRemainder to Alipay * Add PayRemainder to Paypal * Add PayRemainder to Payconiq * Add PayRemainder to Afterpay * Add PayRemainder to Trustly * Add PayRemainder to Przelewy24 * Add PayRemainder to Belfius * Add PayRemainder to EPS * Revert Belfius * Revert EPS * Revert Payconiq * BP-2509 Add Instant refunds,no service payment refactor (#109) * BP-2527 Batch functionality (#114) * WIP * Batch finished * Update php-cs-fixer * php cs fixer * PHPcs * Add transaction batch endpoint * phpcs fix * V1.6.0 --------- Co-authored-by: reflie-nxte <122365318+reflie-nxte@users.noreply.github.com> Co-authored-by: avido Co-authored-by: Sander H <37146557+SandervdHulst@users.noreply.github.com> Co-authored-by: Muneeb Shoukat <89547149+Muneeb60coder@users.noreply.github.com> Co-authored-by: vegim carkaxhija Co-authored-by: Lucian Turiac <106905746+LucianTuriacArnia@users.noreply.github.com> Co-authored-by: Rinor12010 <105772190+Rinor12010@users.noreply.github.com> * Push validator fix (#123) * Retain float in json_encode * Version update * Update README.md Update READM.md --------- Co-authored-by: Shu Chen Co-authored-by: reflie-nxte <122365318+reflie-nxte@users.noreply.github.com> Co-authored-by: avido Co-authored-by: Sander H <37146557+SandervdHulst@users.noreply.github.com> Co-authored-by: Muneeb Shoukat <89547149+Muneeb60coder@users.noreply.github.com> Co-authored-by: vegim carkaxhija Co-authored-by: Lucian Turiac <106905746+LucianTuriacArnia@users.noreply.github.com> Co-authored-by: Rinor12010 <105772190+Rinor12010@users.noreply.github.com> * BP-2461 - Add the correct ModuleVersion and PlatformName (#120) * Added Deferred Sales * Authenticate method refers to authorize * Able to send custom parameters * Fixing wrong name in additional parameter * Ability to fill in software header * Able to pass in a config object into the constructor * PHP CS Fixer * Ignoring spaceafterkeyword * BP-2650 - Culture was not working correctly (#126) * BP-2417 Added Thunes * BP-2650 - Culture was not working correctly * Deleted Thunes/Models/Article.php * Adding culture to config * Phpcs fix --------- Co-authored-by: Shu Chen * Prepare v1.7.0 * Merge conflict resolved * Remove head merge conflict * Comment removal * Comment removal * Add pay by bank example (#128) * BP-2797 Add possibility to change Channel header (#134) * BP-2417 Added Thunes * BP-2797 Add possibility to change Channel header * delete file * Delete Channel from Payload * Features/in3new (#138) * In3 new * In3 new 2 * In3 new final touches * Filename update * In3 new added example --------- Co-authored-by: Shu Chen * Prepare release 1.8.0 * BP-2873 * Idin name change to idin * deleted article Thunes * Changed uppercase * Changed name * excluded iDin in check * Prepare 1.8.1 release --------- Co-authored-by: reflie-nxte <122365318+reflie-nxte@users.noreply.github.com> Co-authored-by: avido Co-authored-by: Sander H <37146557+SandervdHulst@users.noreply.github.com> Co-authored-by: Muneeb Shoukat <89547149+Muneeb60coder@users.noreply.github.com> Co-authored-by: vegim carkaxhija Co-authored-by: Lucian Turiac <106905746+LucianTuriacArnia@users.noreply.github.com> Co-authored-by: Sander Co-authored-by: Rinor12010 <105772190+Rinor12010@users.noreply.github.com> Co-authored-by: Rene <105488705+Buckaroo-Rene@users.noreply.github.com> --- composer.json | 2 +- phpcs.xml | 1 + src/PaymentMethods/GiftCard/GiftCard.php | 12 ++++++- src/PaymentMethods/GiftCard/Models/Refund.php | 35 +++++++++++++++++++ .../iDin/{IDin.php => iDin.php} | 4 +-- tests/Buckaroo/Payments/GiftcardsTest.php | 2 ++ 6 files changed, 52 insertions(+), 4 deletions(-) create mode 100644 src/PaymentMethods/GiftCard/Models/Refund.php rename src/PaymentMethods/iDin/{IDin.php => iDin.php} (96%) diff --git a/composer.json b/composer.json index ebf10227..dd0a93fb 100644 --- a/composer.json +++ b/composer.json @@ -2,7 +2,7 @@ "name": "buckaroo/sdk", "description": "Buckaroo payment SDK", "license": "MIT", - "version": "1.8.0", + "version": "1.8.1", "type": "library", "require": { "php": ">=7.4|^8.0", diff --git a/phpcs.xml b/phpcs.xml index 7391a251..e60e272d 100644 --- a/phpcs.xml +++ b/phpcs.xml @@ -15,6 +15,7 @@ src/PaymentMethods/iDeal/iDeal.php src/PaymentMethods/iDealQR/iDealQR.php + src/PaymentMethods/iDin/iDin.php diff --git a/src/PaymentMethods/GiftCard/GiftCard.php b/src/PaymentMethods/GiftCard/GiftCard.php index ae3864b2..336d8ec5 100644 --- a/src/PaymentMethods/GiftCard/GiftCard.php +++ b/src/PaymentMethods/GiftCard/GiftCard.php @@ -23,6 +23,7 @@ use Buckaroo\Models\Model; use Buckaroo\PaymentMethods\GiftCard\Models\Pay; use Buckaroo\PaymentMethods\GiftCard\Models\PayPayload; +use Buckaroo\PaymentMethods\GiftCard\Models\Refund; use Buckaroo\PaymentMethods\PayablePaymentMethod; use Buckaroo\Transaction\Response\TransactionResponse; @@ -41,6 +42,15 @@ public function pay(?Model $model = null): TransactionResponse return parent::pay($model ?? $pay); } + /** + * @param Model|null $model + * @return TransactionResponse + */ + public function refund(?Model $model = null): TransactionResponse + { + return parent::refund($model ?? new Refund($this->payload)); + } + /** * @return TransactionResponse */ @@ -51,7 +61,7 @@ public function payRedirect(): TransactionResponse $pay = new PayPayload($this->payload); $this->setPayPayload(); - + return $this->postRequest(); } diff --git a/src/PaymentMethods/GiftCard/Models/Refund.php b/src/PaymentMethods/GiftCard/Models/Refund.php new file mode 100644 index 00000000..30a37408 --- /dev/null +++ b/src/PaymentMethods/GiftCard/Models/Refund.php @@ -0,0 +1,35 @@ + 'testinvoice 123', 'originalTransactionKey' => '2D04704995B74D679AACC59F87XXXXXX', 'name' => 'boekenbon', + 'email' => 'test123@hotmail.com', + 'lastname' => 'test123' ]); $this->assertTrue($response->isFailed()); From 9b47ee2ca031d9854106d107a346ff71542e363e Mon Sep 17 00:00:00 2001 From: Shu Chen Date: Wed, 15 Nov 2023 10:45:06 +0100 Subject: [PATCH 03/16] Checkout update --- .github/workflows/codestyle.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/codestyle.yml b/.github/workflows/codestyle.yml index 1348548f..ee399ff9 100644 --- a/.github/workflows/codestyle.yml +++ b/.github/workflows/codestyle.yml @@ -12,13 +12,13 @@ jobs: strategy: fail-fast: true matrix: - php: [7.4, 8.1, 8.2] + php: [8.1, 8.2, 8.3] stability: [prefer-stable] name: PHP ${{ matrix.php }} - ${{ matrix.stability }} - ${{ matrix.os }} steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 with: fetch-depth: 0 From 54d0d5c3b88fa5f1ecf85c6dd26d7d68ea9dde1c Mon Sep 17 00:00:00 2001 From: Shu Chen Date: Wed, 15 Nov 2023 10:51:34 +0100 Subject: [PATCH 04/16] Version update --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index ebf10227..7e30bcd0 100644 --- a/composer.json +++ b/composer.json @@ -2,7 +2,7 @@ "name": "buckaroo/sdk", "description": "Buckaroo payment SDK", "license": "MIT", - "version": "1.8.0", + "version": "1.9.0", "type": "library", "require": { "php": ">=7.4|^8.0", From 4fc8def866bd8045c313699e214be406c3e2df81 Mon Sep 17 00:00:00 2001 From: Shu Chen Date: Wed, 15 Nov 2023 10:57:08 +0100 Subject: [PATCH 05/16] Fixing merge conflict --- composer.json | 4 ---- example/transactions/in3.php | 12 ------------ example/transactions/in3old.php | 4 ---- example/transactions/payment_initiation.php | 8 -------- .../In3/Service/ParameterKeys/PhoneAdapter.php | 6 ------ .../In3Old/Service/ParameterKeys/PhoneAdapter.php | 4 ---- 6 files changed, 38 deletions(-) diff --git a/composer.json b/composer.json index 9d3daad7..7e30bcd0 100644 --- a/composer.json +++ b/composer.json @@ -2,11 +2,7 @@ "name": "buckaroo/sdk", "description": "Buckaroo payment SDK", "license": "MIT", -<<<<<<< HEAD "version": "1.9.0", -======= - "version": "1.8.1", ->>>>>>> master "type": "library", "require": { "php": ">=7.4|^8.0", diff --git a/example/transactions/in3.php b/example/transactions/in3.php index d552d87a..1fdbddb2 100644 --- a/example/transactions/in3.php +++ b/example/transactions/in3.php @@ -60,11 +60,7 @@ 'identifier' => 'Articlenumber1', 'type' => 'Physical', 'description' => 'Blue Toy Car', -<<<<<<< HEAD 'category' => 'test product1', -======= - 'category' => 'test product', ->>>>>>> master 'vatPercentage' => '21', 'quantity' => '2', 'price' => '20.10', @@ -73,11 +69,7 @@ 'identifier' => 'Articlenumber2', 'type' => 'Physical', 'description' => 'Red Toy Car', -<<<<<<< HEAD 'category' => 'test product2', -======= - 'category' => 'test product', ->>>>>>> master 'vatPercentage' => '21', 'quantity' => '1', 'price' => '10.10', @@ -86,11 +78,7 @@ 'identifier' => 'USPShippingID', 'type' => 'Physical', 'description' => 'UPS', -<<<<<<< HEAD 'category' => 'test product3', -======= - 'category' => 'test product', ->>>>>>> master 'vatPercentage' => '21', 'quantity' => '1', 'price' => '2', diff --git a/example/transactions/in3old.php b/example/transactions/in3old.php index 6092862a..9c7a2321 100644 --- a/example/transactions/in3old.php +++ b/example/transactions/in3old.php @@ -1,10 +1,6 @@ >>>>>> master use Buckaroo\BuckarooClient; use Buckaroo\Resources\Constants\Gender; diff --git a/example/transactions/payment_initiation.php b/example/transactions/payment_initiation.php index 536b7f90..9cb542b9 100644 --- a/example/transactions/payment_initiation.php +++ b/example/transactions/payment_initiation.php @@ -1,10 +1,6 @@ >>>>>> master use Buckaroo\BuckarooClient; @@ -24,8 +20,4 @@ 'invoice' => '', //Set invoice number of the transaction to refund 'originalTransactionKey' => '', //Set transaction key of the transaction to refund 'amountCredit' => 10, -<<<<<<< HEAD ]); -======= -]); ->>>>>>> master diff --git a/src/PaymentMethods/In3/Service/ParameterKeys/PhoneAdapter.php b/src/PaymentMethods/In3/Service/ParameterKeys/PhoneAdapter.php index 38b37700..f18dd568 100644 --- a/src/PaymentMethods/In3/Service/ParameterKeys/PhoneAdapter.php +++ b/src/PaymentMethods/In3/Service/ParameterKeys/PhoneAdapter.php @@ -25,12 +25,6 @@ class PhoneAdapter extends ServiceParametersKeysAdapter { protected array $keys = [ -<<<<<<< HEAD 'mobile' => 'MobilePhone' -======= - 'landLine' => 'Phone', - 'mobile' => 'MobilePhone', - 'phone' => 'Phone' ->>>>>>> master ]; } diff --git a/src/PaymentMethods/In3Old/Service/ParameterKeys/PhoneAdapter.php b/src/PaymentMethods/In3Old/Service/ParameterKeys/PhoneAdapter.php index f7303f5b..17af7e7c 100644 --- a/src/PaymentMethods/In3Old/Service/ParameterKeys/PhoneAdapter.php +++ b/src/PaymentMethods/In3Old/Service/ParameterKeys/PhoneAdapter.php @@ -25,10 +25,6 @@ class PhoneAdapter extends ServiceParametersKeysAdapter { protected array $keys = [ -<<<<<<< HEAD 'mobile' => 'Phone' -======= - 'mobile' => 'Phone', ->>>>>>> master ]; } From f3eba028da63f0cbe17f1ccd4ee367dd5d356efa Mon Sep 17 00:00:00 2001 From: Shu Chen Date: Wed, 15 Nov 2023 11:25:51 +0100 Subject: [PATCH 06/16] Update workflows --- .github/workflows/codestyle.yml | 2 +- .github/workflows/sonarqube.yml | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/codestyle.yml b/.github/workflows/codestyle.yml index ee399ff9..b576eacc 100644 --- a/.github/workflows/codestyle.yml +++ b/.github/workflows/codestyle.yml @@ -18,7 +18,7 @@ jobs: name: PHP ${{ matrix.php }} - ${{ matrix.stability }} - ${{ matrix.os }} steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v3 with: fetch-depth: 0 diff --git a/.github/workflows/sonarqube.yml b/.github/workflows/sonarqube.yml index ce169472..7e3e7e4e 100644 --- a/.github/workflows/sonarqube.yml +++ b/.github/workflows/sonarqube.yml @@ -1,3 +1,5 @@ +name: SonarQube PR Analysis + on: push: branches: @@ -6,7 +8,7 @@ on: - 'bugfix/**' pull_request: types: [opened, synchronize, reopened] -name: SonarQube PR Analysis + jobs: sonarqube: runs-on: ubuntu-latest From 866af9aaa0b76ab53f509e87d1e14542f5cfb3c7 Mon Sep 17 00:00:00 2001 From: Shu Chen Date: Wed, 15 Nov 2023 11:45:51 +0100 Subject: [PATCH 07/16] disable sonarcube --- .github/workflows/sonarqube.yml | 23 ----------------------- 1 file changed, 23 deletions(-) diff --git a/.github/workflows/sonarqube.yml b/.github/workflows/sonarqube.yml index 7e3e7e4e..e69de29b 100644 --- a/.github/workflows/sonarqube.yml +++ b/.github/workflows/sonarqube.yml @@ -1,23 +0,0 @@ -name: SonarQube PR Analysis - -on: - push: - branches: - - master - - develop - - 'bugfix/**' - pull_request: - types: [opened, synchronize, reopened] - -jobs: - sonarqube: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - name: SonarQube Scan - uses: sonarsource/sonarqube-scan-action@master - env: - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }} From e43593f4937e4ea312b694a0ecdea5bd61bdf116 Mon Sep 17 00:00:00 2001 From: Shu Chen Date: Wed, 15 Nov 2023 11:46:27 +0100 Subject: [PATCH 08/16] Revert checklint --- .github/workflows/codestyle.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/codestyle.yml b/.github/workflows/codestyle.yml index b576eacc..1348548f 100644 --- a/.github/workflows/codestyle.yml +++ b/.github/workflows/codestyle.yml @@ -12,13 +12,13 @@ jobs: strategy: fail-fast: true matrix: - php: [8.1, 8.2, 8.3] + php: [7.4, 8.1, 8.2] stability: [prefer-stable] name: PHP ${{ matrix.php }} - ${{ matrix.stability }} - ${{ matrix.os }} steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v2 with: fetch-depth: 0 From df4902871830975aabefbcbd4dba0dc00c0f0337 Mon Sep 17 00:00:00 2001 From: Shu Chen Date: Wed, 15 Nov 2023 11:47:19 +0100 Subject: [PATCH 09/16] Revert --- .github/workflows/codestyle.yml | 3 ++- .github/workflows/sonarqube.yml | 23 +++++++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/.github/workflows/codestyle.yml b/.github/workflows/codestyle.yml index 1348548f..8f50834a 100644 --- a/.github/workflows/codestyle.yml +++ b/.github/workflows/codestyle.yml @@ -2,6 +2,7 @@ name: CheckStyleAndLint on: pull_request: + types: [opened, synchronize, reopened] paths: - "src/**.php" - "example/**.php" @@ -18,7 +19,7 @@ jobs: name: PHP ${{ matrix.php }} - ${{ matrix.stability }} - ${{ matrix.os }} steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 with: fetch-depth: 0 diff --git a/.github/workflows/sonarqube.yml b/.github/workflows/sonarqube.yml index e69de29b..4e1a1afa 100644 --- a/.github/workflows/sonarqube.yml +++ b/.github/workflows/sonarqube.yml @@ -0,0 +1,23 @@ +name: SonarQube PR Analysis + +on: + push: + branches: + - master + - develop/ + - 'bugfix/**' + pull_request: + types: [opened, synchronize, reopened] + +jobs: + sonarqube: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + - name: SonarQube Scan + uses: sonarsource/sonarqube-scan-action@master + env: + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }} From 10313cca7cc3beb3cd41ddc8aea37abc742d9d39 Mon Sep 17 00:00:00 2001 From: Sander Date: Wed, 15 Nov 2023 12:57:22 +0100 Subject: [PATCH 10/16] revert types and checkout version --- .github/workflows/codestyle.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/codestyle.yml b/.github/workflows/codestyle.yml index 8f50834a..1348548f 100644 --- a/.github/workflows/codestyle.yml +++ b/.github/workflows/codestyle.yml @@ -2,7 +2,6 @@ name: CheckStyleAndLint on: pull_request: - types: [opened, synchronize, reopened] paths: - "src/**.php" - "example/**.php" @@ -19,7 +18,7 @@ jobs: name: PHP ${{ matrix.php }} - ${{ matrix.stability }} - ${{ matrix.os }} steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v2 with: fetch-depth: 0 From b4b6fd8798cadf814d919148363b243d9895a65d Mon Sep 17 00:00:00 2001 From: Shu Chen Date: Wed, 15 Nov 2023 13:06:21 +0100 Subject: [PATCH 11/16] Remove sonarqube entirely --- .github/workflows/codestyle.yml | 19 ++++--------------- .github/workflows/sonarqube.yml | 23 ----------------------- 2 files changed, 4 insertions(+), 38 deletions(-) delete mode 100644 .github/workflows/sonarqube.yml diff --git a/.github/workflows/codestyle.yml b/.github/workflows/codestyle.yml index 1348548f..6372c73d 100644 --- a/.github/workflows/codestyle.yml +++ b/.github/workflows/codestyle.yml @@ -2,6 +2,7 @@ name: CheckStyleAndLint on: pull_request: + branches: [ "develop" ] paths: - "src/**.php" - "example/**.php" @@ -12,24 +13,12 @@ jobs: strategy: fail-fast: true matrix: - php: [7.4, 8.1, 8.2] + php: [7.4, 8.1, 8.2, 8.3] stability: [prefer-stable] name: PHP ${{ matrix.php }} - ${{ matrix.stability }} - ${{ matrix.os }} steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 with: - fetch-depth: 0 - - - name: Setup PHP - uses: shivammathur/setup-php@v2 - with: - php-version: ${{ matrix.php }} - tools: cs2pr, phplint, phpcs - - - name: Run phplint - run: phplint --no-configuration --no-cache --no-interaction ./src/* ./example/* - - - name: Run phpcs - run: phpcs -q --report=checkstyle --extensions=php ./src/* | cs2pr + fetch-depth: 0 \ No newline at end of file diff --git a/.github/workflows/sonarqube.yml b/.github/workflows/sonarqube.yml deleted file mode 100644 index 4e1a1afa..00000000 --- a/.github/workflows/sonarqube.yml +++ /dev/null @@ -1,23 +0,0 @@ -name: SonarQube PR Analysis - -on: - push: - branches: - - master - - develop/ - - 'bugfix/**' - pull_request: - types: [opened, synchronize, reopened] - -jobs: - sonarqube: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - name: SonarQube Scan - uses: sonarsource/sonarqube-scan-action@master - env: - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }} From 0b8bb66ace80555d8e6963564f4cf54baf7f89c0 Mon Sep 17 00:00:00 2001 From: Shu Chen Date: Wed, 15 Nov 2023 13:12:56 +0100 Subject: [PATCH 12/16] Workflow --- .github/workflows/codestyle.yml | 24 ---------------------- .github/workflows/codestyle2.yml | 35 ++++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+), 24 deletions(-) delete mode 100644 .github/workflows/codestyle.yml create mode 100644 .github/workflows/codestyle2.yml diff --git a/.github/workflows/codestyle.yml b/.github/workflows/codestyle.yml deleted file mode 100644 index 6372c73d..00000000 --- a/.github/workflows/codestyle.yml +++ /dev/null @@ -1,24 +0,0 @@ -name: CheckStyleAndLint - -on: - pull_request: - branches: [ "develop" ] - paths: - - "src/**.php" - - "example/**.php" - -jobs: - phpcs: - runs-on: ubuntu-latest - strategy: - fail-fast: true - matrix: - php: [7.4, 8.1, 8.2, 8.3] - stability: [prefer-stable] - - name: PHP ${{ matrix.php }} - ${{ matrix.stability }} - ${{ matrix.os }} - - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 \ No newline at end of file diff --git a/.github/workflows/codestyle2.yml b/.github/workflows/codestyle2.yml new file mode 100644 index 00000000..1348548f --- /dev/null +++ b/.github/workflows/codestyle2.yml @@ -0,0 +1,35 @@ +name: CheckStyleAndLint + +on: + pull_request: + paths: + - "src/**.php" + - "example/**.php" + +jobs: + phpcs: + runs-on: ubuntu-latest + strategy: + fail-fast: true + matrix: + php: [7.4, 8.1, 8.2] + stability: [prefer-stable] + + name: PHP ${{ matrix.php }} - ${{ matrix.stability }} - ${{ matrix.os }} + + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + tools: cs2pr, phplint, phpcs + + - name: Run phplint + run: phplint --no-configuration --no-cache --no-interaction ./src/* ./example/* + + - name: Run phpcs + run: phpcs -q --report=checkstyle --extensions=php ./src/* | cs2pr From 134f541e589c9e2b87e18ed0578d0acfc3c3da2b Mon Sep 17 00:00:00 2001 From: Shu Chen Date: Wed, 15 Nov 2023 13:14:47 +0100 Subject: [PATCH 13/16] Remove matrix os --- .github/workflows/{codestyle2.yml => codestyle.yml} | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename .github/workflows/{codestyle2.yml => codestyle.yml} (86%) diff --git a/.github/workflows/codestyle2.yml b/.github/workflows/codestyle.yml similarity index 86% rename from .github/workflows/codestyle2.yml rename to .github/workflows/codestyle.yml index 1348548f..69a352b3 100644 --- a/.github/workflows/codestyle2.yml +++ b/.github/workflows/codestyle.yml @@ -15,10 +15,10 @@ jobs: php: [7.4, 8.1, 8.2] stability: [prefer-stable] - name: PHP ${{ matrix.php }} - ${{ matrix.stability }} - ${{ matrix.os }} + name: PHP ${{ matrix.php }} - ${{ matrix.stability }} steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 with: fetch-depth: 0 From 991864195d4d8ec09ce053daefcc0794f2333caf Mon Sep 17 00:00:00 2001 From: Shu Chen Date: Wed, 15 Nov 2023 13:16:19 +0100 Subject: [PATCH 14/16] Re-add sonarqube --- .github/workflows/sonarqube.yml | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 .github/workflows/sonarqube.yml diff --git a/.github/workflows/sonarqube.yml b/.github/workflows/sonarqube.yml new file mode 100644 index 00000000..8fc4627a --- /dev/null +++ b/.github/workflows/sonarqube.yml @@ -0,0 +1,23 @@ +name: SonarQube PR Analysis + +on: + push: + branches: + - master + - develop/ + - 'bugfix/**' + pull_request: + types: [opened, synchronize, reopened] + +jobs: + sonarqube: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + - name: SonarQube Scan + uses: sonarsource/sonarqube-scan-action@master + env: + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }} \ No newline at end of file From 3da9fa60d76078ae78a9aea7d0f8d4b264d6d71e Mon Sep 17 00:00:00 2001 From: Sander Date: Wed, 15 Nov 2023 13:18:47 +0100 Subject: [PATCH 15/16] removed error with exception --- src/PaymentMethods/iDeal/iDeal.php | 1 - 1 file changed, 1 deletion(-) diff --git a/src/PaymentMethods/iDeal/iDeal.php b/src/PaymentMethods/iDeal/iDeal.php index 21c012f9..dbd07614 100644 --- a/src/PaymentMethods/iDeal/iDeal.php +++ b/src/PaymentMethods/iDeal/iDeal.php @@ -28,7 +28,6 @@ use Buckaroo\PaymentMethods\PayablePaymentMethod; use Buckaroo\Services\TraitHelpers\HasIssuers; use Buckaroo\Transaction\Response\TransactionResponse; -use Buckaroo\Exceptions\BuckarooException; class iDeal extends PayablePaymentMethod { From 836036115e9b599e3bbcd167f29d71b637a60614 Mon Sep 17 00:00:00 2001 From: Shu Chen Date: Wed, 15 Nov 2023 13:21:05 +0100 Subject: [PATCH 16/16] Adding php 8.3 --- .github/workflows/codestyle.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/codestyle.yml b/.github/workflows/codestyle.yml index 69a352b3..d1299723 100644 --- a/.github/workflows/codestyle.yml +++ b/.github/workflows/codestyle.yml @@ -12,10 +12,10 @@ jobs: strategy: fail-fast: true matrix: - php: [7.4, 8.1, 8.2] + php: [7.4, 8.1, 8.2, 8.3] stability: [prefer-stable] - name: PHP ${{ matrix.php }} - ${{ matrix.stability }} + name: PHP ${{ matrix.php }} - ${{ matrix.stability }} - ${{ matrix.os }} steps: - uses: actions/checkout@v4