From 1d4e925c2725a4c8ab106b55cc62daaea6521387 Mon Sep 17 00:00:00 2001 From: Shu Chen Date: Tue, 23 May 2023 15:41:09 +0200 Subject: [PATCH] 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> --- .gitignore | 2 + .php-cs-fixer.cache | 1 - .php-cs-fixer.dist.php => .php-cs-fixer.php | 4 + README.md | 2 +- composer.json | 6 +- example/transactions/noservicespecified.php | 27 ++++++ src/BuckarooClient.php | 15 +++- src/Exceptions/BuckarooException.php | 3 + src/Handlers/Credentials.php | 3 +- src/PaymentMethods/Afterpay/Afterpay.php | 9 ++ src/PaymentMethods/Alipay/Alipay.php | 9 ++ src/PaymentMethods/BatchTransactions.php | 41 +++++++++ src/PaymentMethods/KlarnaPay/KlarnaPay.php | 9 ++ .../NoServiceSpecifiedPayment.php | 47 ++++++++++ src/PaymentMethods/PayablePaymentMethod.php | 1 - src/PaymentMethods/Payconiq/Payconiq.php | 15 ++++ src/PaymentMethods/PaymentFacade.php | 4 +- src/PaymentMethods/PaymentMethod.php | 7 +- src/PaymentMethods/PaymentMethodFactory.php | 32 ++++--- src/PaymentMethods/Paypal/Paypal.php | 9 ++ src/PaymentMethods/Przelewy24/Przelewy24.php | 9 ++ src/PaymentMethods/Sofort/Sofort.php | 15 ++++ src/PaymentMethods/Trustly/Trustly.php | 9 ++ src/PaymentMethods/iDeal/iDeal.php | 18 +++- src/Transaction/Client.php | 26 ++++++ src/Transaction/Request/BatchRequest.php | 34 ++++++++ .../Request/HttpClient/HttpClientGuzzle.php | 3 +- src/Transaction/Request/Request.php | 3 +- tests/Buckaroo/Payments/BatchTest.php | 85 +++++++++++++++++++ .../NoServiceSpecifiedPaymentTest.php | 41 +++++++++ 30 files changed, 464 insertions(+), 25 deletions(-) delete mode 100644 .php-cs-fixer.cache rename .php-cs-fixer.dist.php => .php-cs-fixer.php (86%) create mode 100644 example/transactions/noservicespecified.php create mode 100644 src/PaymentMethods/BatchTransactions.php create mode 100644 src/PaymentMethods/NoServiceSpecifiedPayment/NoServiceSpecifiedPayment.php create mode 100644 src/Transaction/Request/BatchRequest.php create mode 100644 tests/Buckaroo/Payments/BatchTest.php create mode 100644 tests/Buckaroo/Payments/NoServiceSpecifiedPaymentTest.php diff --git a/.gitignore b/.gitignore index e1ce02c8..6e5adff6 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,5 @@ example/logs .phpunit.result.cache logs/ + +.php-cs-fixer.cache diff --git a/.php-cs-fixer.cache b/.php-cs-fixer.cache deleted file mode 100644 index 5c8d2e10..00000000 --- a/.php-cs-fixer.cache +++ /dev/null @@ -1 +0,0 @@ -{"php":"8.2.4","version":"3.15.1:v3.15.1#d48755372a113bddb99f749e34805d83f3acfe04","indent":" ","lineEnding":"\n","rules":{"blank_line_after_namespace":true,"braces":{"allow_single_line_closure":false,"position_after_functions_and_oop_constructs":"next","position_after_anonymous_constructs":"next","position_after_control_structures":"next"},"class_definition":true,"constant_case":true,"elseif":true,"function_declaration":true,"indentation_type":true,"line_ending":true,"lowercase_keywords":true,"method_argument_space":{"on_multiline":"ensure_fully_multiline","keep_multiple_spaces_after_comma":true},"no_break_comment":true,"no_closing_tag":true,"no_space_around_double_colon":true,"no_spaces_after_function_name":true,"no_spaces_inside_parenthesis":true,"no_trailing_whitespace":true,"no_trailing_whitespace_in_comment":true,"single_blank_line_at_eof":true,"single_class_element_per_statement":{"elements":["property"]},"single_import_per_statement":true,"single_line_after_imports":true,"switch_case_semicolon_to_colon":true,"switch_case_space":true,"visibility_required":{"elements":["method","property"]},"encoding":true,"full_opening_tag":true,"array_syntax":{"syntax":"short"},"ordered_imports":{"sort_algorithm":"alpha"},"no_unused_imports":true,"not_operator_with_successor_space":true,"trailing_comma_in_multiline":true,"phpdoc_scalar":true,"unary_operator_spaces":true,"binary_operator_spaces":true,"blank_line_before_statement":{"statements":["break","continue","declare","return","throw","try"]},"phpdoc_single_line_var_spacing":true,"phpdoc_var_without_name":true,"single_trait_insert_per_statement":true},"hashes":{"src\/BuckarooClient.php":"a04feed78f40b502363053f348a95d42","src\/Config\/Config.php":"3049e56bf3e3a3f2b947f4a18cded93a","src\/Config\/DefaultConfig.php":"ff088b4e5124f40155cc198401134378","src\/Exceptions\/BuckarooException.php":"d2544fdaa34bf1de4d51630f8d9cc5a9","src\/Exceptions\/TransferException.php":"d6d7bc200cb3e9697368e423c2dfacd5","src\/Handlers\/Credentials.php":"72547a0871ef078f61217d9c387e8bf6","src\/Handlers\/HMAC\/Generator.php":"285cbc96e2eb0a709b1d541602257cae","src\/Handlers\/HMAC\/Hmac.php":"18f9016e7c5aea3a0b692d20723940a7","src\/Handlers\/HMAC\/Validator.php":"75a5227ff35b94611b9799121e026abc","src\/Handlers\/Logging\/DefaultLogger.php":"91e9a8fa50a5770f092be6a546f4f179","src\/Handlers\/Logging\/Loggable.php":"f4b7e8704cbbe37d9c354801bebbfc59","src\/Handlers\/Logging\/Observer.php":"060d6e5806f7d7e16004d03cab986d37","src\/Handlers\/Logging\/Observers\/ErrorReporter.php":"7ec7da9e92f3b23b4c5d4efce8d86bd9","src\/Handlers\/Logging\/Observers\/Monolog.php":"e7d485dc3bc8bb26769249749e590f27","src\/Handlers\/Logging\/Subject.php":"3d67799142a50aab2eef4e24219cb74e","src\/Handlers\/Reply\/HttpPost.php":"4e0f9906ba5d6cdd307ebfadee255542","src\/Handlers\/Reply\/Json.php":"c9843468bfb3433c27fcd733d659e28a","src\/Handlers\/Reply\/ReplyHandler.php":"845bd35eb1b47207345d1407b83e1266","src\/Handlers\/Reply\/ReplyStrategy.php":"5bab082004f01d9950a9bc1ff468cd69","src\/Models\/Adapters\/ServiceParametersKeysAdapter.php":"b9ba2ebeed2dcfc47dac37dca6f3546c","src\/Models\/AdditionalParameters.php":"4971bbecdfda4aafd081ff5dbc1e3dd0","src\/Models\/Address.php":"ceeab777c91d46aeae2d4e7ab5d7df99","src\/Models\/Article.php":"aa20190c5a3dd2ff6ae169268a2d34e0","src\/Models\/BankAccount.php":"e82a08360df8697c9e059178a7c8fbd8","src\/Models\/ClientIP.php":"e19df1c3fe6357c96c26e2f8ff1e5e29","src\/Models\/Company.php":"d47ad3497173c8fc6fb6fc3daa73aec9","src\/Models\/Debtor.php":"3e6ab2b25de1e477d44bfb1165913366","src\/Models\/Email.php":"982763a72eb2935b8a9b3e9982ed72ca","src\/Models\/Interfaces\/Recipient.php":"85589ae85ccc2fdeecc18b3b2a0fdcbb","src\/Models\/Model.php":"2c7d00151866c93051e081a74097bd88","src\/Models\/Payload\/PayPayload.php":"cca5ff8b604ae2aa749b6b3dfabbaf82","src\/Models\/Payload\/Payload.php":"cf211d0785d48099c6daf8e78813029b","src\/Models\/Payload\/RefundPayload.php":"50ca2b6fadd6d1dfc1af85e4e475a551","src\/Models\/Person.php":"da9fce2330f7dbe81553cdf6a6ff5474","src\/Models\/Phone.php":"1a9f7c4872419d316fdebb2703f658a8","src\/Models\/ServiceList.php":"e51064ef8722035a1af8577f1cdb29dc","src\/Models\/ServiceParameter.php":"dafc671a780a47388f2cf6067b9c08ce","src\/Models\/Services.php":"953ba8de24fdf96f25f87a19439528d4","src\/PaymentMethods\/Afterpay\/Afterpay.php":"5220a26153046c35a71c5f9544a8c07c","src\/PaymentMethods\/Afterpay\/Models\/Article.php":"1101df36002c534b8194c8f38b5f359c","src\/PaymentMethods\/Afterpay\/Models\/Pay.php":"e8d7f0818eb7078a61ca31056c8c1394","src\/PaymentMethods\/Afterpay\/Models\/Person.php":"400ed6119966980ff0c48ca7e75702c6","src\/PaymentMethods\/Afterpay\/Models\/Recipient.php":"1da6ea525690661c2237ab21382ed19e","src\/PaymentMethods\/Afterpay\/Models\/Refund.php":"bc0c928de027bd2c3eca4ad997d2ed10","src\/PaymentMethods\/Afterpay\/Service\/ParameterKeys\/AddressAdapter.php":"692191fd233a1ea93b3dea94a8b4a9d1","src\/PaymentMethods\/Afterpay\/Service\/ParameterKeys\/ArticleAdapter.php":"c9cf7fac3e8bd7554fb773180301ddfe","src\/PaymentMethods\/Afterpay\/Service\/ParameterKeys\/PhoneAdapter.php":"5a13e983066abe460ae4831cabe1c428","src\/PaymentMethods\/Afterpay\/Service\/ParameterKeys\/RecipientAdapter.php":"9ce22d14bc2d17220e3f5765720f713a","src\/PaymentMethods\/AfterpayDigiAccept\/AfterpayDigiAccept.php":"a17f362fc17716edaf11c5e6c2f1dc8f","src\/PaymentMethods\/AfterpayDigiAccept\/Models\/Pay.php":"59cb734c920506b03f62bd89b9590554","src\/PaymentMethods\/AfterpayDigiAccept\/Models\/Recipient.php":"049301de1c6a4ca82cba08830ff04eb0","src\/PaymentMethods\/AfterpayDigiAccept\/Models\/Refund.php":"0453cf9fdd07cd1ff5cb68feac2cc2c1","src\/PaymentMethods\/AfterpayDigiAccept\/Service\/ParameterKeys\/AddressAdapter.php":"81ac818062aaf5e4aca0deaef2d0f17c","src\/PaymentMethods\/AfterpayDigiAccept\/Service\/ParameterKeys\/ArticleAdapter.php":"54cb4aa29bbfa9d13250d7c90069eab0","src\/PaymentMethods\/AfterpayDigiAccept\/Service\/ParameterKeys\/EmailAdapter.php":"607a333d0355446d5b2bb5d78d2648af","src\/PaymentMethods\/AfterpayDigiAccept\/Service\/ParameterKeys\/PhoneAdapter.php":"e025168a23f2bc4033e4f08669604ee7","src\/PaymentMethods\/AfterpayDigiAccept\/Service\/ParameterKeys\/RecipientAdapter.php":"9f932e8753a8dd4bb8e2a4c5a5b4be9b","src\/PaymentMethods\/AfterpayDigiAccept\/Service\/ParameterKeys\/ServiceAdapter.php":"bc34e01a54c01929cda40c8bac36de03","src\/PaymentMethods\/Alipay\/Alipay.php":"dd908e596902c85130e0e4920da04272","src\/PaymentMethods\/Alipay\/Models\/Pay.php":"fb9572ebd5464e8a006c0681a452e951","src\/PaymentMethods\/ApplePay\/ApplePay.php":"877e953b5326ffa57f75dbe34496c185","src\/PaymentMethods\/ApplePay\/Models\/Pay.php":"3b614359549f91062e646ab56f436490","src\/PaymentMethods\/ApplePay\/Models\/PayPayload.php":"c676ee7ee1bcc1907a04a27f9e2ac160","src\/PaymentMethods\/Bancontact\/Bancontact.php":"bc5b720c1f4304c1319f48a757c6688f","src\/PaymentMethods\/Bancontact\/Models\/Authenticate.php":"62906afe0a165a35651eb394b951193d","src\/PaymentMethods\/Bancontact\/Models\/Pay.php":"8fc9760c4052b60eb79d5ffa3b0ae69b","src\/PaymentMethods\/Bancontact\/Models\/PayEncrypted.php":"f0f4283c57c8ab2bb06e5f5950f8e643","src\/PaymentMethods\/BankTransfer\/BankTransfer.php":"15b6812b9c8cc34f2d81aaa685c99f5d","src\/PaymentMethods\/BankTransfer\/Models\/Pay.php":"991cff07b81d31ad98343c9ccf674510","src\/PaymentMethods\/BankTransfer\/Service\/ParameterKeys\/CustomerAdapter.php":"6c859ee4db8fc7fa505e5e7987da5977","src\/PaymentMethods\/BankTransfer\/Service\/ParameterKeys\/EmailAdapter.php":"cdbdc24a8503270b046be3553bfe4583","src\/PaymentMethods\/BankTransfer\/Service\/ParameterKeys\/PayAdapter.php":"ae9149be34d4d0912b490722b6756e86","src\/PaymentMethods\/Belfius\/Belfius.php":"6d0514225d9c9f5281900d7bc53e704c","src\/PaymentMethods\/Billink\/Billink.php":"adb3e9af9aea69f6ed8c2d0f8ecc280b","src\/PaymentMethods\/Billink\/Models\/Article.php":"ed916bb29315a44950f44604b5a6b399","src\/PaymentMethods\/Billink\/Models\/Capture.php":"d78606a9918a5925ed15a11cc29df1f6","src\/PaymentMethods\/Billink\/Models\/Pay.php":"74e1561269fdf63a24a696cb0de0c5fb","src\/PaymentMethods\/Billink\/Models\/Recipient.php":"39b57b32e18e6069844aad09f92b0f43","src\/PaymentMethods\/Billink\/Service\/ParameterKeys\/AddressAdapter.php":"8de6d09943d0621affdda7e724708274","src\/PaymentMethods\/Billink\/Service\/ParameterKeys\/ArticleAdapter.php":"4f5d6145f7becd1ed27ca33f22077397","src\/PaymentMethods\/Billink\/Service\/ParameterKeys\/PhoneAdapter.php":"0edca59d6e4c151f1c85fe465c6ef3bd","src\/PaymentMethods\/Billink\/Service\/ParameterKeys\/RecipientAdapter.php":"105fa7a29317a0b80f1a8b9b119c5fc1","src\/PaymentMethods\/BuckarooVoucher\/BuckarooVoucher.php":"b181c9e03dd924b899cac175e8c15259","src\/PaymentMethods\/BuckarooVoucher\/Models\/Create.php":"255d4fa0461244cad9aa4435ccb7e43c","src\/PaymentMethods\/BuckarooVoucher\/Models\/CreatePayload.php":"42913f90c793c2ed1b27fc855fae68c8","src\/PaymentMethods\/BuckarooVoucher\/Models\/Deactivate.php":"96bed609390d0ecb3dd8a94dd9ba240b","src\/PaymentMethods\/BuckarooVoucher\/Models\/GetBalance.php":"65b690ff91464e3898d3d960467c6690","src\/PaymentMethods\/BuckarooVoucher\/Models\/Pay.php":"e39a2921209a5c4ec9f5649dd3c4ac50","src\/PaymentMethods\/BuckarooWallet\/BuckarooWallet.php":"ef5b362c63a5fde93fa3281690c79c41","src\/PaymentMethods\/BuckarooWallet\/Models\/DepositReservePayload.php":"c57b8f8352bc2b4eac33fa49d8416958","src\/PaymentMethods\/BuckarooWallet\/Models\/ReleasePayload.php":"e31a198d3046222442855a7ec111d9ef","src\/PaymentMethods\/BuckarooWallet\/Models\/Wallet.php":"fd1d7d36ea9c27bc6da65aadb2d48a38","src\/PaymentMethods\/BuckarooWallet\/Service\/ParameterKeys\/BankAccountAdapter.php":"3a433e884d2b0d755f469a20861a6430","src\/PaymentMethods\/BuckarooWallet\/Service\/ParameterKeys\/CustomerAdapter.php":"303e6c1671897d735dd113cc4166af1d","src\/PaymentMethods\/BuckarooWallet\/Service\/ParameterKeys\/EmailAdapter.php":"703b17e3e3fcb9175aab78ce7d317ef7","src\/PaymentMethods\/CreditCard\/CreditCard.php":"8430cd30423a606b9a9b8b5f9663762b","src\/PaymentMethods\/CreditCard\/Models\/CardData.php":"df7536390b7b2b7a63903a0ff3d24069","src\/PaymentMethods\/CreditCard\/Models\/SecurityCode.php":"d9a6a20c5ca807629e3b4a1877446132","src\/PaymentMethods\/CreditClick\/CreditClick.php":"9e5484352aa2b73cbf5ece5e238d826f","src\/PaymentMethods\/CreditClick\/Models\/Pay.php":"8e8763e5fdf905c1c58e689fc96a77d0","src\/PaymentMethods\/CreditClick\/Models\/Refund.php":"82ec73b5892602d35c0321150ec499b7","src\/PaymentMethods\/CreditClick\/Service\/ParameterKeys\/CustomerAdapter.php":"7f94f0737428a95fde806eec14d2be5d","src\/PaymentMethods\/CreditManagement\/CreditManagement.php":"2bb0a0507d143bc8d42ea4c6cb523f92","src\/PaymentMethods\/CreditManagement\/Models\/AddOrUpdateProductLines.php":"5275167ba0256eb6e0aeffe0f6ade3a5","src\/PaymentMethods\/CreditManagement\/Models\/Article.php":"61b8495754e71a08c69f4aa5267c5e0b","src\/PaymentMethods\/CreditManagement\/Models\/CreditNote.php":"386def7c4e3295db852923423ac99b9b","src\/PaymentMethods\/CreditManagement\/Models\/Debtor.php":"611fdd1a517f779701709420e7b0866e","src\/PaymentMethods\/CreditManagement\/Models\/DebtorFile.php":"59f4fe33c0156a68fb9153b492a3c824","src\/PaymentMethods\/CreditManagement\/Models\/DebtorInfo.php":"f78fdb63e146972a09975a234b7e1d44","src\/PaymentMethods\/CreditManagement\/Models\/Invoice.php":"6a0c3c9d3f6149bcdd5b7f5cd20f6170","src\/PaymentMethods\/CreditManagement\/Models\/MultipleInvoiceInfo.php":"e8b87aa2fcbd7357f0cea6ef05f4f0f0","src\/PaymentMethods\/CreditManagement\/Models\/PaymentPlan.php":"1e1c12e66f2091ba9a65090364ad62dd","src\/PaymentMethods\/CreditManagement\/Service\/ParameterKeys\/ArticleAdapter.php":"d644cfeb053b9ed4c585badae22c39cd","src\/PaymentMethods\/CreditManagement\/Service\/ParameterKeys\/DebtorInfoAdapter.php":"111483943c0c031041d2cf9c5bdd6896","src\/PaymentMethods\/EPS\/EPS.php":"4a19a3827ec83faed3a7abae33fb60c2","src\/PaymentMethods\/Emandates\/Emandates.php":"e1f0adf6f026b2004ca4db417295a483","src\/PaymentMethods\/Emandates\/Models\/Mandate.php":"825f7606cdce24b7cd87c85c56ef51be","src\/PaymentMethods\/GiftCard\/GiftCard.php":"605c12b4ba7a57b69538a94bcfd1bc48","src\/PaymentMethods\/GiftCard\/Models\/Pay.php":"5672b5bb84a6ec7989fb82b3c70f566f","src\/PaymentMethods\/GiftCard\/Models\/PayPayload.php":"6beb12d039bb1a75e9545860c3cbf9bc","src\/PaymentMethods\/Giropay\/Giropay.php":"afe9d431a68e56af845b5945c6ee6d72","src\/PaymentMethods\/Giropay\/Models\/Pay.php":"bd0fb92797290265baafbef8c143d77b","src\/PaymentMethods\/In3\/In3.php":"2ce32872023af75f0a60be62474f46a9","src\/PaymentMethods\/In3\/Models\/Pay.php":"bc41a5976dc954f06bab49e3451b4931","src\/PaymentMethods\/In3\/Models\/PayPayload.php":"5e1559127bd6bcc39af9cba5016f71fe","src\/PaymentMethods\/In3\/Models\/Subtotal.php":"1a9ac4476a45521af82482e1be6ba854","src\/PaymentMethods\/In3\/Service\/ParameterKeys\/AddressAdapter.php":"53b92ce98c02ae7d93e6b14227563b47","src\/PaymentMethods\/In3\/Service\/ParameterKeys\/ArticleAdapter.php":"58b9d16f6ea930ac4efc763a326e28ca","src\/PaymentMethods\/In3\/Service\/ParameterKeys\/CompanyAdapter.php":"f5ea7377501c6af673f61849e5566f58","src\/PaymentMethods\/In3\/Service\/ParameterKeys\/PhoneAdapter.php":"2d6f0fa594ab03430d55ec26dcd8ba39","src\/PaymentMethods\/Interfaces\/Combinable.php":"b3a8a715e15d40f1fec8e8aa69e23db4","src\/PaymentMethods\/KBC\/KBC.php":"1dd2a8585a64b8078339a1172f09bf10","src\/PaymentMethods\/KlarnaKP\/KlarnaKP.php":"2c5696440cc568dc337c0d7cb4ebfc48","src\/PaymentMethods\/KlarnaKP\/Models\/Payload.php":"b33d782fc49f5ec4e61aa240da52d2de","src\/PaymentMethods\/KlarnaKP\/Models\/Recipient.php":"1ea7c1ca72ea5b10c109db5752ed158f","src\/PaymentMethods\/KlarnaKP\/Service\/ParameterKeys\/AddressAdapter.php":"b683bbacf1c10c1e7b0dc3625b83730a","src\/PaymentMethods\/KlarnaKP\/Service\/ParameterKeys\/ArticleAdapter.php":"7d987920678ff84247fa9941d2a219d0","src\/PaymentMethods\/KlarnaKP\/Service\/ParameterKeys\/EmailAdapter.php":"6c7a63c151b2d52475ba843259e369da","src\/PaymentMethods\/KlarnaKP\/Service\/ParameterKeys\/PhoneAdapter.php":"3f18c0a203e29cdb2c7fbed3e5e78e71","src\/PaymentMethods\/KlarnaKP\/Service\/ParameterKeys\/RecipientAdapter.php":"a79df1fdeb4bcc7f4147218891a266df","src\/PaymentMethods\/KlarnaPay\/KlarnaPay.php":"74ffbf3cc7239a4dbb3ab30698e19792","src\/PaymentMethods\/KlarnaPay\/Models\/Pay.php":"158f36bcb659ea6d2fe6226c7dd6900c","src\/PaymentMethods\/KlarnaPay\/Models\/PayPayload.php":"74f8711b521078bc34dfb2abeef6bcb6","src\/PaymentMethods\/KlarnaPay\/Models\/Recipient.php":"d5cf4d926b5d08c514150fc4e98f6343","src\/PaymentMethods\/KlarnaPay\/Service\/ParameterKeys\/AddressAdapter.php":"ae4d5a23dc640095d90cbb919ecdeab2","src\/PaymentMethods\/KlarnaPay\/Service\/ParameterKeys\/ArticleAdapter.php":"99629484c73633b2fcef73e74a2016ca","src\/PaymentMethods\/KlarnaPay\/Service\/ParameterKeys\/PhoneAdapter.php":"dbede561858850c098431e29785363a4","src\/PaymentMethods\/Marketplaces\/Marketplaces.php":"a58ad6edd52a8da52e37c55f88bf6a42","src\/PaymentMethods\/Marketplaces\/Models\/Marketplace.php":"c56e09f922cdc3c84912ba11414f37cc","src\/PaymentMethods\/Marketplaces\/Models\/Seller.php":"36a79655bb1190ecb8781b3b7fcd7ddf","src\/PaymentMethods\/Marketplaces\/Models\/ServiceList.php":"a25677f4cb9f55a72f90c78d9e05fad9","src\/PaymentMethods\/PayPerEmail\/Models\/Attachment.php":"ccff70fe9482b7ac0c4ee99c0f1e3923","src\/PaymentMethods\/PayPerEmail\/Models\/PaymentInvitation.php":"db244fffd49b47138ad8d32d14af187d","src\/PaymentMethods\/PayPerEmail\/PayPerEmail.php":"c07cb576cd8f37362b11dac19a7898e6","src\/PaymentMethods\/PayPerEmail\/Service\/ParameterKeys\/AttachmentAdapter.php":"cc857add67db197985a4879125190f84","src\/PaymentMethods\/PayPerEmail\/Service\/ParameterKeys\/CustomerAdapter.php":"cff29d3c99971efd11d19fc7392d23e2","src\/PaymentMethods\/PayPerEmail\/Service\/ParameterKeys\/EmailAdapter.php":"b16e545c775b75e3ed3747ef2151154b","src\/PaymentMethods\/PayablePaymentMethod.php":"eeb8a8a289ad40f6c7bffea0efe56311","src\/PaymentMethods\/Payconiq\/Payconiq.php":"057415ee3ede1bbbc1d9cb67a5e51bc2","src\/PaymentMethods\/PaymentFacade.php":"d241ed41b8f0c5a8f1c6543385185baa","src\/PaymentMethods\/PaymentInterface.php":"accc043249c9d1184d4fb100f14fb303","src\/PaymentMethods\/PaymentMethod.php":"39c673e7942aeb2f4b702dd53a6b086c","src\/PaymentMethods\/PaymentMethodFactory.php":"38c7d8bb6deba14b026ddc4b01ce7c37","src\/PaymentMethods\/Paypal\/Models\/Address.php":"74d8d0bc2ac7235e4a1a657cc70827c9","src\/PaymentMethods\/Paypal\/Models\/ExtraInfo.php":"b1e13c02b0c39531358693233b028bf7","src\/PaymentMethods\/Paypal\/Models\/Pay.php":"67225ec2037509db760c99ad4038d459","src\/PaymentMethods\/Paypal\/Paypal.php":"ab57cc1612f2438ea246cd745bbd6b3c","src\/PaymentMethods\/Paypal\/Service\/ParameterKeys\/AddressAdapter.php":"d370a51df269afcfad9dc75e8e148dd4","src\/PaymentMethods\/Paypal\/Service\/ParameterKeys\/PhoneAdapter.php":"046f3a220b5602d42482a3a3ec389f9a","src\/PaymentMethods\/PointOfSale\/Models\/Pay.php":"e1842ac15bedd7a83aeaa296049252eb","src\/PaymentMethods\/PointOfSale\/PointOfSale.php":"25637901753d2c07d00ab6bf0beb381c","src\/PaymentMethods\/Przelewy24\/Models\/Pay.php":"814d22c0721a1c222f44dbd9a97383f7","src\/PaymentMethods\/Przelewy24\/Przelewy24.php":"1c983da62802be6050cfc74d8057f67f","src\/PaymentMethods\/Przelewy24\/Service\/ParameterKeys\/CustomerAdapter.php":"bc65a7576fe49c7c36d10f96f578fcc4","src\/PaymentMethods\/Przelewy24\/Service\/ParameterKeys\/EmailAdapter.php":"6af44a175667a1691e5161f8e7758d4e","src\/PaymentMethods\/SEPA\/Models\/ExtraInfo.php":"22e1282bfe0d8d4a619e2e3488781709","src\/PaymentMethods\/SEPA\/Models\/Pay.php":"830cef74f9747712da251f22dac45a8f","src\/PaymentMethods\/SEPA\/SEPA.php":"4b1ca116d0a6fdb1af60ce65d6d58ae5","src\/PaymentMethods\/SEPA\/Service\/ParameterKeys\/AddressAdapter.php":"889d7bf15ae56a1e915e8174c98a7bad","src\/PaymentMethods\/SEPA\/Service\/ParameterKeys\/CustomerAdapter.php":"2af215870b7bb4d3c8fcf7c2e2de2ade","src\/PaymentMethods\/SEPA\/Service\/ParameterKeys\/PayAdapter.php":"d3b6a8f9c8bd89562484aa0d4d2fae45","src\/PaymentMethods\/Sofort\/Sofort.php":"c9569a2fd82566d49e0ab32049e31790","src\/PaymentMethods\/Subscriptions\/Models\/CombinedPayload.php":"291879ac2ef3c2ffe1e8ea281e422be1","src\/PaymentMethods\/Subscriptions\/Models\/Configuration.php":"26db1893644139846d4c54eb0eb7a5fc","src\/PaymentMethods\/Subscriptions\/Models\/RatePlan.php":"b2aba50e5921250f589f90b2dded6e74","src\/PaymentMethods\/Subscriptions\/Models\/RatePlanCharge.php":"a3d5fe992c41ce30d489ca5c47a60e39","src\/PaymentMethods\/Subscriptions\/Models\/ResumeSubscription.php":"919bca409c01c1aa94eb40f831217207","src\/PaymentMethods\/Subscriptions\/Models\/Subscription.php":"7391d0702787f876e07de142b3dd636c","src\/PaymentMethods\/Subscriptions\/Service\/ParameterKeys\/CompanyAdapter.php":"6f4f7e91f77c9a2479a11ae7f33a5362","src\/PaymentMethods\/Subscriptions\/Subscriptions.php":"eb54f618f94dfacfc4c99af8c789e629","src\/PaymentMethods\/Surepay\/Models\/Verify.php":"027841518d304cdf248d8cf1939ee0c8","src\/PaymentMethods\/Surepay\/Service\/ParameterKeys\/BankAccountAdapter.php":"9c1fa1ab42ab667878db82e1d6fbf8e0","src\/PaymentMethods\/Surepay\/Surepay.php":"bf44ddde109ed1fc424b6c585ab9bc51","src\/PaymentMethods\/Tinka\/Models\/Article.php":"2e2b75383981bd6bbff67cfe7a4ad566","src\/PaymentMethods\/Tinka\/Models\/Pay.php":"049ead8ce258a9e0ac6db008285ee31b","src\/PaymentMethods\/Tinka\/Models\/Recipient.php":"a1eb20125c466d0b48028c6c4f00f46c","src\/PaymentMethods\/Tinka\/Service\/ParameterKeys\/AddressAdapter.php":"82e58c240201ff1468b8b9be353f33e9","src\/PaymentMethods\/Tinka\/Service\/ParameterKeys\/ArticleAdapter.php":"05c428e81a33f41916f688964eb906da","src\/PaymentMethods\/Tinka\/Service\/ParameterKeys\/CustomerAdapter.php":"be0e6db5b2a617fc6bc9e22af096ff9a","src\/PaymentMethods\/Tinka\/Service\/ParameterKeys\/PhoneAdapter.php":"43c682cf85f9fbdeb64b9637df3a0240","src\/PaymentMethods\/Tinka\/Tinka.php":"90bf921d625064956a42dae45a155e1d","src\/PaymentMethods\/Traits\/CountableGroupKey.php":"bbaf4ac62c697e4ea8ecdc0ad979b08f","src\/PaymentMethods\/Trustly\/Models\/Pay.php":"4d7d1f5790586bb743c7205f34064b83","src\/PaymentMethods\/Trustly\/Service\/ParameterKeys\/CustomerAdapter.php":"e18c0a88bc3ba7f213623c11b2ddb78f","src\/PaymentMethods\/Trustly\/Service\/ParameterKeys\/PayAdapter.php":"ac193e9ad3cb7c91f33c93dba4876771","src\/PaymentMethods\/Trustly\/Trustly.php":"2e8290e1eaae8a1cd8e57b5e4f949f70","src\/PaymentMethods\/WeChatPay\/Models\/Pay.php":"b6752b57a0f3d33711c2d47ec6bcb4d8","src\/PaymentMethods\/WeChatPay\/WeChatPay.php":"7ff27945ea981100f38b22c0c529dfd7","src\/PaymentMethods\/iDeal\/Models\/Pay.php":"8953ccceaed38d93289ac3e4a0ed01b5","src\/PaymentMethods\/iDeal\/iDeal.php":"ca2c50211f06c227c318d85b59c130be","src\/PaymentMethods\/iDealQR\/Models\/Generate.php":"f62e5ea61ee49356adaecbee64b4614e","src\/PaymentMethods\/iDealQR\/iDealQR.php":"ae9ba3ead224c6442cf9db5d68db042f","src\/PaymentMethods\/iDin\/Models\/Issuer.php":"902e454bbfebb4bd52e6ef8b8ba98414","src\/PaymentMethods\/iDin\/Service\/ParameterKeys\/IssuerAdapter.php":"c94438083ea61affd5d9e93e408bb81e","src\/PaymentMethods\/iDin\/iDin.php":"90ce856c9fee3f40cb14d7c3a7af3ef5","src\/Resources\/Arrayable.php":"309daa9c8e87e451a36c15936d5096ea","src\/Resources\/Constants\/CreditManagementInstallmentInterval.php":"56be568c35303858ae97945530c21396","src\/Resources\/Constants\/Endpoints.php":"1ae5ae439f1e44add96c81154b667c00","src\/Resources\/Constants\/Gender.php":"97e49539071851397500521f9c89a12d","src\/Resources\/Constants\/IPProtocolVersion.php":"0db5ea9636219a2c7413db7123cf9bf6","src\/Resources\/Constants\/RecipientCategory.php":"5c1e88ed6130c05a6e70a7d63a93d35b","src\/Resources\/Constants\/ResponseStatus.php":"415427f1ee6d9d6f0ae0b493f35f7ced","src\/Services\/PayloadService.php":"b9389c2f502dba9d991deb80b0d35423","src\/Services\/ServiceListParameters\/DefaultParameters.php":"70310adb54e262d917a6f7cf56f33845","src\/Services\/ServiceListParameters\/ModelParameters.php":"95b6660ae0e9ea3b1c2a9b49c6464325","src\/Services\/ServiceListParameters\/ServiceListParameter.php":"6a3ee9bf76707933ca0e5f62b939b1ef","src\/Services\/TransactionHeaders\/CultureHeader.php":"a3c118a69ea9425294a401b4e535e366","src\/Services\/TransactionHeaders\/DefaultHeader.php":"49e846e47a97aec9e88e07876c91292b","src\/Services\/TransactionHeaders\/HmacHeader.php":"3dcf867cebc0e187c0f3689c274e93d9","src\/Services\/TransactionHeaders\/SoftwareHeader.php":"401661ee7e91717cc8e85dd287350697","src\/Services\/TransactionHeaders\/TransactionHeader.php":"3561b8da46cc8c2e30e388f4c14f43a2","src\/Services\/TransactionService.php":"92a316ca3f4c13ef79e80647b3eb667c","src\/Transaction\/Client.php":"03b658c31b936d5925a53da3754f3917","src\/Transaction\/Request\/HttpClient\/HttpClientAbstract.php":"fca81cd7e91893e62dc1e20e5550c4c6","src\/Transaction\/Request\/HttpClient\/HttpClientGuzzle.php":"8ce604417529a02cf77243adaee62ccd","src\/Transaction\/Request\/HttpClient\/HttpClientInterface.php":"848ed947a3d1fa37d02cd99052c278bc","src\/Transaction\/Request\/Request.php":"702c743d61aa070aa8c8407b70421a1d","src\/Transaction\/Request\/TransactionRequest.php":"5f53d3e7cd9db218ad1727721519496e","src\/Transaction\/Response\/Response.php":"7abe9d998466a8eb81fc26da385e80d8","src\/Transaction\/Response\/TransactionResponse.php":"49417487c7e4bb93c9c84b0eac0a9656","example\/additional_services\/credit_management.php":"32ebd2c0cd3cd10b074c35edd114e674","example\/additional_services\/idin.php":"7dd17bb4d43dd2ae991ebe4686a7c6d2","example\/additional_services\/marketplaces.php":"307e99ab0f2342eeb80c756b4d2e81ed","example\/additional_services\/pay_per_email.php":"d3e2fc698cd56d5c1379f29c587da5df","example\/additional_services\/subscriptions.php":"5f27b97869c216c34fa930c091521fa1","example\/additional_services\/surepay.php":"cf0dd7b1f1aa99c94a5bb68bfccc5445","example\/additional_services\/voucher.php":"bdb49b1d45e44bf5fdd705032e9f4d57","example\/additional_services\/wallets.php":"962b46e5e78ca375562dd7f864550e83","example\/bootstrap.php":"a3f3d709889533c8780df931a288e763","example\/responses\/push.php":"b01ea22e8d4bf8e41a62b66f83249694","example\/responses\/return.php":"88d46cf36ec3550a3c0daca8aad94849","example\/transactions\/afterpay.php":"f8dc471f412bb3fefbf6c5a5f50c55aa","example\/transactions\/afterpaydigiaccept.php":"81b4d5de6624b4dc52dd37d6eb44fed8","example\/transactions\/alipay.php":"3b87fc27ec2ac13b13553454ae632fcd","example\/transactions\/applepay.php":"0d507f91f2224307c33fe85c52f8e732","example\/transactions\/applepay_redirect.php":"00ba0cabc3a7bb547f8821fadf94c74b","example\/transactions\/bancontact.php":"d1ee54f16d05c1a9126cbf228951d44f","example\/transactions\/belfius.php":"16a0efb01febb9cbcd70f7badcf5c64d","example\/transactions\/billink.php":"9305b0ee2b569d5ea1b5ac3f702bfc4e","example\/transactions\/credit_click.php":"27463cb1ab953baa0b7a82d32b500996","example\/transactions\/creditcard.php":"98a19b4d843617f53bd93f447fe3df0a","example\/transactions\/eps.php":"46fa813019489d29dd68e02b9bfa2a92","example\/transactions\/giftcards.php":"89a4fd8eb260009808402066944f7b95","example\/transactions\/giftcards_redirect.php":"1e7c17cd1c83a39e4b230758fdc77e0c","example\/transactions\/giropay.php":"2c82c4a5aa0fee3dc8c0ad40d3c5d791","example\/transactions\/ideal.php":"b346b5816272e6b626850efffb1d5f28","example\/transactions\/ideal_qr.php":"65bf7d44865b1cbaa08c9d00967fc0b1","example\/transactions\/in3.php":"f078817d49c83c22232bc615fc721521","example\/transactions\/kbc.php":"5c55f714be73d80e632912f3acb56def","example\/transactions\/klarna.php":"6e8d1b91bdc5992e5e514d3e652d25c9","example\/transactions\/klarnakp.php":"716cfcbdbb24e47f772330a85c4f69c4","example\/transactions\/payconiq.php":"cd952b2d7a6ce6df0e25f6c5f03230e1","example\/transactions\/paypal.php":"d819893fca49ff7ccbf140133d2ea7ac","example\/transactions\/pos.php":"cd2118e471e77210a4b687a98d067989","example\/transactions\/przelewy24.php":"d92bb6501d79d637ca91b811bb6e82e7","example\/transactions\/sepa.php":"10268e103cd7c7df9dd4b66988bcda82","example\/transactions\/sofort.php":"a8552ca60ec035fc0d03eafdbecfcca7","example\/transactions\/tinka.php":"1e10d360bf3987b4bf2dd07446ad610d","example\/transactions\/transfer.php":"53a25922b9707797df8d6d9623dc6565","example\/transactions\/trustly.php":"98c0c06cf6b3b6cad2ce5894dad8bb9b","example\/transactions\/wechat.php":"5c4f687f253b3b1c557feedcd45ad05b"}} \ No newline at end of file diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.php similarity index 86% rename from .php-cs-fixer.dist.php rename to .php-cs-fixer.php index 1f539060..21867d19 100644 --- a/.php-cs-fixer.dist.php +++ b/.php-cs-fixer.php @@ -31,6 +31,10 @@ 'position_after_anonymous_constructs' => 'next', 'position_after_control_structures' => 'next', ], + 'curly_braces_position' => [ + 'classes_opening_brace' => 'next_line_unless_newline_at_signature_end', + 'control_structures_opening_brace' => 'next_line_unless_newline_at_signature_end' + ], 'phpdoc_single_line_var_spacing' => true, 'phpdoc_var_without_name' => true, 'method_argument_space' => [ diff --git a/README.md b/README.md index 4b5fb719..d9d33579 100644 --- a/README.md +++ b/README.md @@ -73,7 +73,7 @@ $buckaroo->method('creditcard') // Input the desire payment method. After you create a transaction, you can retrieve several transaction information on demand. ```php -# Create a new payment +# Retrieve transaction information $transaction = $buckaroo->transaction('YOUR-TRANSACTION-KEY') $transaction->status(); // Retrieve transaction status diff --git a/composer.json b/composer.json index a474b32f..189018b1 100644 --- a/composer.json +++ b/composer.json @@ -2,17 +2,17 @@ "name": "buckaroo/sdk", "description": "Buckaroo payment SDK", "license": "MIT", - "version": "1.5.2", + "version": "1.6.0", "type": "library", "require": { "php": ">=7.4|^8.0", "ext-json": "*", "ext-pcre": "*", "ext-fileinfo": "*", - "monolog/monolog": "^2.2", + "monolog/monolog": "^2.2|^3", "guzzlehttp/guzzle": "^7.0", "composer/ca-bundle": "^1.3", - "ramsey/uuid": "^3.9.7" + "ramsey/uuid": "^3.9.7|^4" }, "require-dev": { "squizlabs/php_codesniffer": "3.*", diff --git a/example/transactions/noservicespecified.php b/example/transactions/noservicespecified.php new file mode 100644 index 00000000..c68fde4f --- /dev/null +++ b/example/transactions/noservicespecified.php @@ -0,0 +1,27 @@ +method(null)->pay([ + 'invoice' => uniqid(), + 'amountDebit' => 10.10, + 'servicesSelectableByClient' => 'ideal,bancontactmrcash,paypal', + 'servicesExcludedForClient' => 'ideal', + 'continueOnIncomplete' => '1', +]); + + +//Refund +$response = $buckaroo->method(null)->refund([ + 'invoice' => '', //Set invoice number of the transaction to refund + 'originalTransactionKey' => '', //Set transaction key of the transaction to refund + 'amountCredit' => 10.10, +]); diff --git a/src/BuckarooClient.php b/src/BuckarooClient.php index 6c20a039..8568e96f 100644 --- a/src/BuckarooClient.php +++ b/src/BuckarooClient.php @@ -25,10 +25,14 @@ use Buckaroo\Exceptions\BuckarooException; use Buckaroo\Handlers\Credentials; use Buckaroo\Handlers\Logging\Observer as LoggingObserver; +use Buckaroo\PaymentMethods\BatchTransactions; use Buckaroo\PaymentMethods\PaymentFacade; use Buckaroo\Services\TransactionService; use Buckaroo\Transaction\Client; +/** + * + */ class BuckarooClient { /** @@ -56,11 +60,20 @@ public function __construct(string $websiteKey, string $secretKey, string $mode * @param string $method * @return PaymentFacade */ - public function method(string $method): PaymentFacade + public function method(string $method = null): PaymentFacade { return new PaymentFacade($this->client, $method); } + /** + * @param array $transactions + * @return BatchTransactions + */ + public function batch(array $transactions): BatchTransactions + { + return new BatchTransactions($this->client, $transactions); + } + /** * @param string $transactionKey * @return TransactionService diff --git a/src/Exceptions/BuckarooException.php b/src/Exceptions/BuckarooException.php index 0e9f5694..0eba822a 100644 --- a/src/Exceptions/BuckarooException.php +++ b/src/Exceptions/BuckarooException.php @@ -32,6 +32,9 @@ class BuckarooException extends Exception * @param int $code * @param Throwable|null $previous */ + + protected ?Subject $logger; + public function __construct(?Subject $logger, string $message = "", int $code = 0, Throwable $previous = null) { $message = $this->message($message); diff --git a/src/Handlers/Credentials.php b/src/Handlers/Credentials.php index 5b7f8377..2bc49081 100644 --- a/src/Handlers/Credentials.php +++ b/src/Handlers/Credentials.php @@ -60,7 +60,8 @@ public function confirm(): bool try { $response = $this->client->specification($request, 'ideal', 2); - } catch (BuckarooException $e) { + } catch (BuckarooException $e) + { return false; } diff --git a/src/PaymentMethods/Afterpay/Afterpay.php b/src/PaymentMethods/Afterpay/Afterpay.php index 3acdd554..666e91f5 100644 --- a/src/PaymentMethods/Afterpay/Afterpay.php +++ b/src/PaymentMethods/Afterpay/Afterpay.php @@ -94,4 +94,13 @@ public function refund(?Model $model = null): TransactionResponse { return parent::refund($model ?? new Refund($this->payload)); } + + /** + * @param Model|null $model + * @return TransactionResponse + */ + public function payRemainder(?Model $model = null): TransactionResponse + { + return parent::payRemainder($model ?? new Pay($this->payload)); + } } diff --git a/src/PaymentMethods/Alipay/Alipay.php b/src/PaymentMethods/Alipay/Alipay.php index 423c0988..3fa388d7 100644 --- a/src/PaymentMethods/Alipay/Alipay.php +++ b/src/PaymentMethods/Alipay/Alipay.php @@ -40,4 +40,13 @@ public function pay(?Model $model = null): TransactionResponse { return parent::pay($model ?? new Pay($this->payload)); } + + /** + * @param Model|null $model + * @return TransactionResponse + */ + public function payRemainder(?Model $model = null): TransactionResponse + { + return parent::payRemainder($model ?? new Pay($this->payload)); + } } diff --git a/src/PaymentMethods/BatchTransactions.php b/src/PaymentMethods/BatchTransactions.php new file mode 100644 index 00000000..14aed589 --- /dev/null +++ b/src/PaymentMethods/BatchTransactions.php @@ -0,0 +1,41 @@ +client = $client; + + $this->batch_transactions = new BatchRequest($transactions); + } + + /** + * @return mixed + * @throws \Buckaroo\Exceptions\BuckarooException + */ + public function execute() + { + return $this->client->dataBatchRequest($this->batch_transactions); + } +} diff --git a/src/PaymentMethods/KlarnaPay/KlarnaPay.php b/src/PaymentMethods/KlarnaPay/KlarnaPay.php index 2741c35b..3f0e564d 100644 --- a/src/PaymentMethods/KlarnaPay/KlarnaPay.php +++ b/src/PaymentMethods/KlarnaPay/KlarnaPay.php @@ -59,4 +59,13 @@ public function payInInstallments(): TransactionResponse return $this->postRequest(); } + + /** + * @param Model|null $model + * @return TransactionResponse + */ + public function payRemainder(?Model $model = null): TransactionResponse + { + return parent::payRemainder($model ?? new Pay($this->payload)); + } } diff --git a/src/PaymentMethods/NoServiceSpecifiedPayment/NoServiceSpecifiedPayment.php b/src/PaymentMethods/NoServiceSpecifiedPayment/NoServiceSpecifiedPayment.php new file mode 100644 index 00000000..bb02a8f8 --- /dev/null +++ b/src/PaymentMethods/NoServiceSpecifiedPayment/NoServiceSpecifiedPayment.php @@ -0,0 +1,47 @@ +validate(); - return $this->postRequest(); } diff --git a/src/PaymentMethods/Payconiq/Payconiq.php b/src/PaymentMethods/Payconiq/Payconiq.php index 451a37d2..61a3bc21 100644 --- a/src/PaymentMethods/Payconiq/Payconiq.php +++ b/src/PaymentMethods/Payconiq/Payconiq.php @@ -20,10 +20,25 @@ namespace Buckaroo\PaymentMethods\Payconiq; +use Buckaroo\Models\Model; use Buckaroo\PaymentMethods\Interfaces\Combinable; use Buckaroo\PaymentMethods\PayablePaymentMethod; +use Buckaroo\Transaction\Response\TransactionResponse; class Payconiq extends PayablePaymentMethod implements Combinable { protected string $paymentName = 'payconiq'; + + /** + * @param Model|null $model + * @return TransactionResponse + */ + public function instantRefund(?Model $model = null):TransactionResponse + { + $this->setRefundPayload(); + + $this->setServiceList('instantRefund', $model); + + return $this->postRequest(); + } } diff --git a/src/PaymentMethods/PaymentFacade.php b/src/PaymentMethods/PaymentFacade.php index bd6480b5..9096a1d6 100644 --- a/src/PaymentMethods/PaymentFacade.php +++ b/src/PaymentMethods/PaymentFacade.php @@ -108,7 +108,7 @@ class PaymentFacade * @param Client $client * @param string $method */ - public function __construct(Client $client, string $method) + public function __construct(Client $client, ?string $method) { $this->client = $client; @@ -163,7 +163,7 @@ public function paymentMethod(): PaymentMethod * @return mixed * @throws BuckarooException */ - public function __call(string $name, array $arguments) + public function __call(?string $name, array $arguments) { if (method_exists($this->paymentMethod, $name)) { diff --git a/src/PaymentMethods/PaymentMethod.php b/src/PaymentMethods/PaymentMethod.php index e458aaae..3041656c 100644 --- a/src/PaymentMethods/PaymentMethod.php +++ b/src/PaymentMethods/PaymentMethod.php @@ -146,7 +146,7 @@ protected function dataRequest() * @param Model|null $model * @return $this */ - protected function setServiceList(string $action, ?Model $model = null) + protected function setServiceList(?string $action, ?Model $model = null): PaymentMethod { $serviceList = new ServiceList($this->paymentName(), $this->serviceVersion(), $action, $model); @@ -209,4 +209,9 @@ public function combinePayment(Combinable $combinablePayment) return $this; } + + public function request(): TransactionRequest + { + return $this->request; + } } diff --git a/src/PaymentMethods/PaymentMethodFactory.php b/src/PaymentMethods/PaymentMethodFactory.php index 00dc9ee4..107a232c 100644 --- a/src/PaymentMethods/PaymentMethodFactory.php +++ b/src/PaymentMethods/PaymentMethodFactory.php @@ -46,6 +46,7 @@ use Buckaroo\PaymentMethods\KlarnaKP\KlarnaKP; use Buckaroo\PaymentMethods\KlarnaPay\KlarnaPay; use Buckaroo\PaymentMethods\Marketplaces\Marketplaces; +use Buckaroo\PaymentMethods\NoServiceSpecifiedPayment\NoServiceSpecifiedPayment; use Buckaroo\PaymentMethods\Payconiq\Payconiq; use Buckaroo\PaymentMethods\Paypal\Paypal; use Buckaroo\PaymentMethods\PayPerEmail\PayPerEmail; @@ -101,6 +102,7 @@ class PaymentMethodFactory Sofort::class => ['sofort', 'sofortueberweisung'], Tinka::class => ['tinka'], Marketplaces::class => ['marketplaces'], + NoServiceSpecifiedPayment::class => ['noservice'], Payconiq::class => ['payconiq'], Przelewy24::class => ['przelewy24'], PointOfSale::class => ['pospayment'], @@ -129,40 +131,50 @@ class PaymentMethodFactory /** * @var string */ - private string $paymentMethod; + private ?string $paymentMethod; /** * @param Client $client - * @param string $paymentMethod + * @param string|null $paymentMethod */ - public function __construct(Client $client, string $paymentMethod) + public function __construct(Client $client, ?string $paymentMethod) { $this->client = $client; - $this->paymentMethod = strtolower($paymentMethod); + $this->paymentMethod = ($paymentMethod)? strtolower($paymentMethod) : null; } /** * @return PaymentMethod + * @throws BuckarooException */ public function getPaymentMethod(): PaymentMethod { - foreach (self::$payments as $class => $alias) + if ($this->paymentMethod) { - if (in_array($this->paymentMethod, $alias)) + foreach (self::$payments as $class => $alias) { - return new $class($this->client, $this->paymentMethod); + if (in_array($this->paymentMethod, $alias)) + { + return new $class($this->client, $this->paymentMethod); + } } + + throw new BuckarooException( + $this->client->config()->getLogger(), + "Wrong payment method code has been given" + ); } - throw new BuckarooException($this->client->config()->getLogger(), "Wrong payment method code has been given"); + return new NoServiceSpecifiedPayment($this->client, $this->paymentMethod); } /** * @param Client $client - * @param string $paymentMethod + * @param string|null $paymentMethod * @return PaymentMethod + * @throws BuckarooException */ - public static function get(Client $client, string $paymentMethod): PaymentMethod + public static function get(Client $client, ?string $paymentMethod): PaymentMethod { $factory = new self($client, $paymentMethod); diff --git a/src/PaymentMethods/Paypal/Paypal.php b/src/PaymentMethods/Paypal/Paypal.php index 2ec73266..19c34276 100644 --- a/src/PaymentMethods/Paypal/Paypal.php +++ b/src/PaymentMethods/Paypal/Paypal.php @@ -70,4 +70,13 @@ public function extraInfo() return $this->postRequest(); } + + /** + * @param Model|null $model + * @return TransactionResponse + */ + public function payRemainder(?Model $model = null): TransactionResponse + { + return parent::payRemainder($model ?? new Pay($this->payload)); + } } diff --git a/src/PaymentMethods/Przelewy24/Przelewy24.php b/src/PaymentMethods/Przelewy24/Przelewy24.php index e61a07be..a1ec0dfb 100644 --- a/src/PaymentMethods/Przelewy24/Przelewy24.php +++ b/src/PaymentMethods/Przelewy24/Przelewy24.php @@ -40,4 +40,13 @@ public function pay(?Model $model = null): TransactionResponse { return parent::pay($model ?? new Pay($this->payload)); } + + /** + * @param Model|null $model + * @return TransactionResponse + */ + public function payRemainder(?Model $model = null): TransactionResponse + { + return parent::payRemainder($model ?? new Pay($this->payload)); + } } diff --git a/src/PaymentMethods/Sofort/Sofort.php b/src/PaymentMethods/Sofort/Sofort.php index 99e158e3..f595d89d 100644 --- a/src/PaymentMethods/Sofort/Sofort.php +++ b/src/PaymentMethods/Sofort/Sofort.php @@ -22,11 +22,26 @@ namespace Buckaroo\PaymentMethods\Sofort; +use Buckaroo\Models\Model; use Buckaroo\PaymentMethods\Interfaces\Combinable; use Buckaroo\PaymentMethods\PayablePaymentMethod; +use Buckaroo\Transaction\Response\TransactionResponse; class Sofort extends PayablePaymentMethod implements Combinable { protected string $paymentName = 'sofortueberweisung'; protected int $serviceVersion = 1; + + /** + * @param Model|null $model + * @return TransactionResponse + */ + public function instantRefund(?Model $model = null):TransactionResponse + { + $this->setRefundPayload(); + + $this->setServiceList('instantRefund', $model); + + return $this->postRequest(); + } } diff --git a/src/PaymentMethods/Trustly/Trustly.php b/src/PaymentMethods/Trustly/Trustly.php index 1082d855..bafe3891 100644 --- a/src/PaymentMethods/Trustly/Trustly.php +++ b/src/PaymentMethods/Trustly/Trustly.php @@ -34,4 +34,13 @@ public function pay(?Model $model = null): TransactionResponse { return parent::pay($model ?? new PayAdapter(new Pay($this->payload))); } + + /** + * @param Model|null $model + * @return TransactionResponse + */ + public function payRemainder(?Model $model = null): TransactionResponse + { + return parent::payRemainder($model ?? new Pay($this->payload)); + } } diff --git a/src/PaymentMethods/iDeal/iDeal.php b/src/PaymentMethods/iDeal/iDeal.php index 0365cd8f..daa26282 100644 --- a/src/PaymentMethods/iDeal/iDeal.php +++ b/src/PaymentMethods/iDeal/iDeal.php @@ -43,7 +43,7 @@ class iDeal extends PayablePaymentMethod * @param Model|null $model * @return TransactionResponse */ - public function pay(?Model $model = null): TransactionResponse + public function pay(?Model $model = null) { return parent::pay($model ?? new Pay($this->payload)); } @@ -57,6 +57,19 @@ public function payRemainder(?Model $model = null): TransactionResponse return parent::payRemainder($model ?? new Pay($this->payload)); } + /** + * @param Model|null $model + * @return TransactionResponse + */ + public function instantRefund(?Model $model = null):TransactionResponse + { + $this->setRefundPayload(); + + $this->setServiceList('instantRefund', $model); + + return $this->postRequest(); + } + /** * @return array * @throws \Buckaroo\Exceptions\BuckarooException @@ -67,7 +80,8 @@ public function issuers(): array try { $response = $this->client->specification($request, 'ideal', 2); - } catch (BuckarooException $e) { + } catch (BuckarooException $e) + { return []; } diff --git a/src/Transaction/Client.php b/src/Transaction/Client.php index 435f497d..7b0aefc9 100644 --- a/src/Transaction/Client.php +++ b/src/Transaction/Client.php @@ -137,6 +137,32 @@ public function dataRequest(Request $data = null, $responseClass = TransactionRe return $this->call(self::METHOD_POST, $data, $responseClass, $endPoint); } + /** + * @param Request|null $data + * @param $responseClass + * @return mixed + * @throws BuckarooException + */ + public function dataBatchRequest(Request $data = null, $responseClass = TransactionResponse::class) + { + $endPoint = $this->getEndpoint('json/batch/DataRequests'); + + return $this->call(self::METHOD_POST, $data, $responseClass, $endPoint); + } + + /** + * @param Request|null $data + * @param $responseClass + * @return mixed + * @throws BuckarooException + */ + public function transactionBatchRequest(Request $data = null, $responseClass = TransactionResponse::class) + { + $endPoint = $this->getEndpoint('json/batch/Transactions'); + + return $this->call(self::METHOD_POST, $data, $responseClass, $endPoint); + } + /** * @param Request|null $data * @param string $paymentName diff --git a/src/Transaction/Request/BatchRequest.php b/src/Transaction/Request/BatchRequest.php new file mode 100644 index 00000000..773812b5 --- /dev/null +++ b/src/Transaction/Request/BatchRequest.php @@ -0,0 +1,34 @@ +transactions = $transactions; + } + + /** + * @return string + */ + public function toJson(): string + { + $data = array_map(function ($transaction) { + return $transaction->request()->toArray(); + }, $this->transactions); + + return json_encode($data); + } +} diff --git a/src/Transaction/Request/HttpClient/HttpClientGuzzle.php b/src/Transaction/Request/HttpClient/HttpClientGuzzle.php index 544cb425..92dcf1e4 100644 --- a/src/Transaction/Request/HttpClient/HttpClientGuzzle.php +++ b/src/Transaction/Request/HttpClient/HttpClientGuzzle.php @@ -76,7 +76,8 @@ public function call(string $url, array $headers, string $method, string $data = $this->logger->info('RESPONSE HEADERS: ' . json_encode($response->getHeaders())); $this->logger->info('RESPONSE BODY: ' . $response->getBody()); - } catch (GuzzleException $e) { + } catch (GuzzleException $e) + { throw new TransferException($this->logger, "Transfer failed", 0, $e); } diff --git a/src/Transaction/Request/Request.php b/src/Transaction/Request/Request.php index 1227e4dd..afb4936e 100644 --- a/src/Transaction/Request/Request.php +++ b/src/Transaction/Request/Request.php @@ -95,7 +95,8 @@ public function __call($method, $args) if ($prefix === 'set') { return $this->offsetSet($param, $arg); - } elseif ($prefix === 'get') { + } elseif ($prefix === 'get') + { return $this->offsetGet($param); } diff --git a/tests/Buckaroo/Payments/BatchTest.php b/tests/Buckaroo/Payments/BatchTest.php new file mode 100644 index 00000000..aa3db504 --- /dev/null +++ b/tests/Buckaroo/Payments/BatchTest.php @@ -0,0 +1,85 @@ +buckaroo->method('credit_management')->manually()->createCombinedInvoice([ + 'invoice' => rand(1000, 9999), + 'applyStartRecurrent' => 'False', + 'invoiceAmount' => 10.00, + 'invoiceAmountVAT' => 1.00, + 'invoiceDate' => date('Y-m-d'), + 'dueDate' => date('Y-m-d'), + 'schemeKey' => '2amq34', + 'maxStepIndex' => 1, + 'allowedServices' => 'ideal,mastercard', + 'debtor' => [ + 'code' => 'johnsmith4', + ], + 'email' => 'youremail@example.nl', + 'phone' => [ + 'mobile' => '06198765432', + ], + 'person' => [ + 'culture' => 'nl-NL', + 'title' => 'Msc', + 'initials' => 'JS', + 'firstName' => 'Test', + 'lastNamePrefix' => 'Jones', + 'lastName' => 'Aflever', + 'gender' => Gender::MALE, + ], + 'company' => [ + 'culture' => 'nl-NL', + 'name' => 'My Company Corporation', + 'vatApplicable' => true, + 'vatNumber' => 'NL140619562B01', + 'chamberOfCommerce' => '20091741', + ], + 'address' => [ + 'street' => 'Hoofdtraat', + 'houseNumber' => '90', + 'houseNumberSuffix' => 'A', + 'zipcode' => '8441ER', + 'city' => 'Heerenveen', + 'state' => 'Friesland', + 'country' => 'NL', + ], + ]); + + $transactions[] = $this->buckaroo->method('sepadirectdebit')->combine($invoice)->manually()->pay([ + 'invoice' => uniqid(), + 'amountDebit' => 10.10, + 'iban' => 'NL13TEST0123456789', + 'bic' => 'TESTNL2A', + 'collectdate' => date('Y-m-d'), + 'mandateReference' => '1DCtestreference', + 'mandateDate' => '2022-07-03', + 'customer' => [ + 'name' => 'John Smith', + ], + ]); + } + + $response = $this->buckaroo->batch($transactions)->execute(); + + $this->assertTrue($response->data('Message') == '3 data requests were queued for processing.'); + } +} \ No newline at end of file diff --git a/tests/Buckaroo/Payments/NoServiceSpecifiedPaymentTest.php b/tests/Buckaroo/Payments/NoServiceSpecifiedPaymentTest.php new file mode 100644 index 00000000..94ea5f67 --- /dev/null +++ b/tests/Buckaroo/Payments/NoServiceSpecifiedPaymentTest.php @@ -0,0 +1,41 @@ +buckaroo->method(null)->pay([ + 'amountDebit' => 10, + 'invoice' => uniqid(), + 'servicesSelectableByClient' => 'ideal,bancontactmrcash,paypal', + 'servicesExcludedForClient' => 'ideal', + 'continueOnIncomplete' => '1', + ]); + $this->assertTrue($response->isWaitingOnUserInput()); + } +}