From 5b4b0c6adc669e97c7cd4e3e48025d77a0bbe30d Mon Sep 17 00:00:00 2001 From: Sander Date: Tue, 31 Oct 2023 14:57:27 +0100 Subject: [PATCH] Bugs and code smells --- README.md | 3 +- .../additional_services/credit_management.php | 5 +- example/additional_services/idin.php | 2 +- example/additional_services/marketplaces.php | 2 +- example/additional_services/pay_per_email.php | 2 +- example/additional_services/subscriptions.php | 6 +-- example/additional_services/surepay.php | 2 +- example/additional_services/voucher.php | 2 +- example/additional_services/wallets.php | 2 +- example/bootstrap.php | 2 + example/responses/push.php | 18 ++++++-- example/responses/return.php | 5 +- example/transactions/afterpay.php | 6 +-- example/transactions/afterpaydigiaccept.php | 2 +- example/transactions/alipay.php | 2 +- example/transactions/applepay.php | 2 +- example/transactions/applepay_redirect.php | 2 +- example/transactions/bancontact.php | 13 ++++-- example/transactions/belfius.php | 2 +- example/transactions/billink.php | 5 +- example/transactions/credit_click.php | 2 +- example/transactions/creditcard.php | 20 +++++--- example/transactions/eps.php | 2 +- example/transactions/giftcards.php | 2 +- example/transactions/giftcards_redirect.php | 7 ++- example/transactions/giropay.php | 2 +- example/transactions/ideal.php | 2 +- example/transactions/ideal_qr.php | 2 +- example/transactions/in3.php | 8 ++-- example/transactions/in3old.php | 2 +- example/transactions/kbc.php | 2 +- example/transactions/klarna.php | 2 +- example/transactions/klarnakp.php | 2 +- example/transactions/mbway.php | 2 +- example/transactions/multibanco.php | 2 +- example/transactions/noservicespecified.php | 2 +- example/transactions/payconiq.php | 2 +- example/transactions/payment_initiation.php | 4 +- example/transactions/paypal.php | 2 +- example/transactions/pos.php | 2 +- example/transactions/przelewy24.php | 2 +- example/transactions/sepa.php | 2 +- example/transactions/sofort.php | 2 +- example/transactions/thunes.php | 2 +- example/transactions/tinka.php | 2 +- example/transactions/transfer.php | 2 +- example/transactions/trustly.php | 2 +- example/transactions/wechat.php | 2 +- src/PaymentMethods/iDeal/iDeal.php | 3 +- src/Transaction/Request/Request.php | 2 +- .../Payments/AfterpayDigiAcceptTest.php | 15 ------ tests/Buckaroo/Payments/AfterpayTest.php | 21 ++------- tests/Buckaroo/Payments/BancontactTest.php | 5 +- tests/Buckaroo/Payments/BatchTest.php | 2 +- tests/Buckaroo/Payments/BillinkTest.php | 6 ++- tests/Buckaroo/Payments/CreditcardTest.php | 12 +++-- tests/Buckaroo/Payments/IdealTest.php | 9 +--- tests/Buckaroo/Payments/MarketplacesTest.php | 3 +- .../NoServiceSpecifiedPaymentTest.php | 2 +- tests/Buckaroo/Payments/PaymentInitiation.php | 2 +- tests/Buckaroo/Payments/PushTest.php | 46 +++++++------------ 61 files changed, 149 insertions(+), 151 deletions(-) diff --git a/README.md b/README.md index 225b0055..4d68cf0b 100644 --- a/README.md +++ b/README.md @@ -56,7 +56,8 @@ You can find your credentials in plaza [WEBSITE_KEY](https://plaza.buckaroo.nl/ require __DIR__ . '/vendor/autoload.php'; # Get your website & secret key in your plaza. -# You can perform a test payment by giving the third param with the string "test", on default it is set on "live" +# You can perform a test payment by giving the third param with the string "test", on default it is set on "test". +# By changing the value of the third parameter to "live", a live transaction can be performed. $buckaroo = new \BuckarooClient('WEBSITE_KEY', 'SECRET_KEY', 'test'); ``` diff --git a/example/additional_services/credit_management.php b/example/additional_services/credit_management.php index e26bd257..a57cc686 100644 --- a/example/additional_services/credit_management.php +++ b/example/additional_services/credit_management.php @@ -1,6 +1,6 @@ method('sepadirectdebit')->combine($invoice)->pay([ 'invoice' => uniqid(), diff --git a/example/additional_services/idin.php b/example/additional_services/idin.php index 8fe3a8b6..027166c4 100644 --- a/example/additional_services/idin.php +++ b/example/additional_services/idin.php @@ -1,6 +1,6 @@ [ - 'mobile' => '0612345678', + 'mobile' => '0612345679', ], 'debtor' => [ 'code' => 'johnsmith4', @@ -113,7 +113,7 @@ 'country' => 'NL', ], 'phone' => [ - 'mobile' => '0612345678', + 'mobile' => '0612345670', ], ]); diff --git a/example/additional_services/surepay.php b/example/additional_services/surepay.php index 33f5017b..a3ff5035 100644 --- a/example/additional_services/surepay.php +++ b/example/additional_services/surepay.php @@ -1,6 +1,6 @@ "J. de Tèster", "brq_invoicenumber" => "SDKDevelopment.com_INVOICE_NO_628c6d032af90", "brq_ordernumber" => "SDKDevelopment.com_ORDER_NO_628c6d032af95", - "brq_payer_hash" => "2d26d34584a4eafeeaa97eed10cfdae22ae64cdce1649a80a55fafca8850e3e22cb32eb7c8fc95ef0c6f96669a21651d4734cc568816f9bd59c2092911e6c0da", + "brq_payer_hash" => "2d26d34584a4eafeeaa97eed10cfdae22ae64cdce1649a80a55fafca8850e3e22cb32eb7c8fc95ef0c6f96669a2 + 1651d4734cc568816f9bd59c2092911e6c0da", "brq_payment" => "D44ACDD0F99D4A1C811D2CD3EFDB05BA", "brq_payment_method" => "ideal", "brq_SERVICE_ideal_consumerBIC" => "RABONL2U", @@ -40,7 +41,18 @@ //START JSON PUSH $auth_header = 'IBjihN7Fhp:0YvyjYAzDQ28W+hQi80f2nhe0Z1QFJLbz7IH//6LsAU=:cad1832100784f57a6e6de835d9f3638:1658227572'; -$post_data = '{"Transaction":{"Key":"5340604668D74435AA344E1428ED1292","Invoice":"62d68b6c8ab0c","ServiceCode":"ideal","Status":{"Code":{"Code":190,"Description":"Success"},"SubCode":{"Code":"S001","Description":"Transaction successfully processed"},"DateTime":"2022-07-19T12:46:12"},"IsTest":true,"Order":"ORDER_NO_62d68b6ca2df3","Currency":"EUR","AmountDebit":10.1,"TransactionType":"C021","Services":[{"Name":"ideal","Action":null,"Parameters":[{"Name":"consumerIssuer","Value":"ABN AMRO"},{"Name":"transactionId","Value":"0000000000000001"},{"Name":"consumerName","Value":"J. de Tèster"},{"Name":"consumerIBAN","Value":"NL44RABO0123456789"},{"Name":"consumerBIC","Value":"RABONL2U"}],"VersionAsProperty":2}],"CustomParameters":null,"AdditionalParameters":{"List":[{"Name":"initiated_by_magento","Value":"1"},{"Name":"service_action","Value":"something"}]},"MutationType":1,"RelatedTransactions":null,"IsCancelable":false,"IssuingCountry":null,"StartRecurrent":false,"Recurring":false,"CustomerName":"J. de Tèster","PayerHash":"2d26d34584a4eafeeaa97eed10cfdae22ae64cdce1649a80a55fafca8850e3e22cb32eb7c8fc95ef0c6f96669a21651d4734cc568816f9bd59c2092911e6c0da","PaymentKey":"AEC974D455FF4A4B9B4C21E437A04838","Description":null}}'; +$post_data = '{"Transaction":{"Key":"5340604668D74435AA344E1428ED1292","Invoice":"62d68b6c8ab0c","ServiceCode":"ideal", +"Status":{"Code":{"Code":190,"Description":"Success"},"SubCode":{"Code":"S001", +"Description":"Transaction successfully processed"},"DateTime":"2022-07-19T12:46:12"},"IsTest":true, +"Order":"ORDER_NO_62d68b6ca2df3","Currency":"EUR","AmountDebit":10.1,"TransactionType":"C021", +"Services":[{"Name":"ideal","Action":null,"Parameters":[{"Name":"consumerIssuer","Value":"ABN AMRO"}, +{"Name":"transactionId","Value":"0000000000000001"},{"Name":"consumerName","Value":"J. de Tèster"}, +{"Name":"consumerIBAN","Value":"NL44RABO0123456789"},{"Name":"consumerBIC","Value":"RABONL2U"}], +"VersionAsProperty":2}],"CustomParameters":null,"AdditionalParameters":{"List":[{"Name":"initiated_by_magento", +"Value":"1"},{"Name":"service_action","Value":"something"}]},"MutationType":1,"RelatedTransactions":null, +"IsCancelable":false,"IssuingCountry":null,"StartRecurrent":false,"Recurring":false,"CustomerName":"J. de Tèster", +"PayerHash":"2d26d34584a4eafeeaa97eed10cfdae22ae64cdce1649a80a55fafca8850e3e22cb32eb7c8fc95ef0c6f96669a21651d4734 +cc568816f9bd59c2092911e6c0da","PaymentKey":"AEC974D455FF4A4B9B4C21E437A04838","Description":null}}'; $uri = 'https://buckaroo.dev/push'; $reply_handler = new ReplyHandler($buckaroo->client()->config(), $post_data, $auth_header, $uri); diff --git a/example/responses/return.php b/example/responses/return.php index 319091bc..99aa5410 100644 --- a/example/responses/return.php +++ b/example/responses/return.php @@ -1,6 +1,6 @@ "J. de Tèster", "brq_invoicenumber" => "SDKDevelopment.com_INVOICE_NO_628c6d032af90", "brq_ordernumber" => "SDKDevelopment.com_ORDER_NO_628c6d032af95", - "brq_payer_hash" => "2d26d34584a4eafeeaa97eed10cfdae22ae64cdce1649a80a55fafca8850e3e22cb32eb7c8fc95ef0c6f96669a21651d4734cc568816f9bd59c2092911e6c0da", + "brq_payer_hash" => "2d26d34584a4eafeeaa97eed10cfdae22ae64cdce1649a80a55fafca8850e3e22cb32eb7c8fc95ef0c6f966 + 69a21651d4734cc568816f9bd59c2092911e6c0da", "brq_payment" => "D44ACDD0F99D4A1C811D2CD3EFDB05BA", "brq_payment_method" => "ideal", "brq_SERVICE_ideal_consumerBIC" => "RABONL2U", diff --git a/example/transactions/afterpay.php b/example/transactions/afterpay.php index 80ff3eab..885148bc 100644 --- a/example/transactions/afterpay.php +++ b/example/transactions/afterpay.php @@ -1,6 +1,6 @@ [ 'mobile' => '0698765433', - 'landline' => '0109876543', + 'landline' => '0109876541', ], 'email' => 'test@buckaroo.nl', ], @@ -103,7 +103,7 @@ 'firstName' => 'Test', 'lastName' => 'Acceptatie', 'email' => 'billingcustomer@buckaroo.nl', - 'phone' => '0109876543', + 'phone' => '0109876542', 'street' => 'Hoofdstraat', 'streetNumber' => '80', 'streetNumberAdditional' => 'A', diff --git a/example/transactions/afterpaydigiaccept.php b/example/transactions/afterpaydigiaccept.php index eb9f01b1..bd3eb614 100644 --- a/example/transactions/afterpaydigiaccept.php +++ b/example/transactions/afterpaydigiaccept.php @@ -1,6 +1,6 @@ method('bancontactmrcash')->pay([ - //'saveToken' => true, //SaveToken is the parameter used to indicate if a token is to be created, that can be used for Wallet Initiated Payments in the future. - //'encryptedCardData' => '', //If this is set PayEncryoted Action will be used. The value of this parameter is the result of the "encryptCardData"-function of our Client Side Encryption SDK. + //'saveToken' => true, //SaveToken is the parameter used to indicate if a token is to be created, that can be used + // for Wallet Initiated Payments in the future. + //'encryptedCardData' => '', //If this is set PayEncryoted Action will be used. + // The value of this parameter is the result of the "encryptCardData"-function of our Client Side Encryption SDK. 'invoice' => uniqid(), 'amountDebit' => 10.10, ]); @@ -20,7 +22,10 @@ 'invoice' => uniqid(), 'amountDebit' => 10.10, 'description' => 'Bancontact PayEncrypted Test 123', - 'encryptedCardData' => '001SlXfd8MbiTd/JFwCiGVs3f6o4x6xt0aN29NzOSNZHPKlVsz/EWeQmyhb1gGZ86VY88DP7gfDV+UyjcPfpVfHZd7u+WkO71hnV2QfYILCBNqE1aiPv2GQVGdaGbuoQloKu1o3o3I1UDmVxivXTMQX76ovot89geA6hqbtakmpmvxeiwwea3l4htNoX1IlD1hfYkDDl9rzSu5ypcjvVs6aRGXK5iMHnyrmEsEnfdj/Q5XWbsD5xAm4u3y6J8d4UP7LB31VLECzZUTiJOtKKcCQlT01YThIkQlj8PWBBMtt4H52VN3IH2+wPYtR8HiOZzcA2HA7UxozogIpS53tIURj/g==', + 'encryptedCardData' => '001SlXfd8MbiTd/JFwCiGVs3f6o4x6xt0aN29NzOSNZHPKlVsz/EWeQmyhb1gGZ86VY88DP7gfDV+UyjcP + fpVfHZd7u+WkO71hnV2QfYILCBNqE1aiPv2GQVGdaGbuoQloKu1o3o3I1UDmVxivXTMQX76ovot89geA6hqbtakmpmvxeiwwea3l4htNoX + 1IlD1hfYkDDl9rzSu5ypcjvVs6aRGXK5iMHnyrmEsEnfdj/Q5XWbsD5xAm4u3y6J8d4UP7LB31VLECzZUTiJOtKKcCQlT01YThIkQlj8PW + BBMtt4H52VN3IH2+wPYtR8HiOZzcA2HA7UxozogIpS53tIURj/g==', ]); //Recurrent payment diff --git a/example/transactions/belfius.php b/example/transactions/belfius.php index 06945fd0..3b70e42c 100644 --- a/example/transactions/belfius.php +++ b/example/transactions/belfius.php @@ -1,6 +1,6 @@ method('billink')->cancelAuthorize([ - 'originalTransactionKey' => '74AD098CCFAA4F739FE16279B5059B6B', //Set transaction key of the authorized transaction to cancel + 'originalTransactionKey' => '74AD098CCFAA4F739FE16279B5059B6B', + //Set transaction key of the authorized transaction to cancel 'invoice' => '62905fa2650f4', //Set invoice id 'AmountCredit' => 10, //set amount to capture ]); diff --git a/example/transactions/credit_click.php b/example/transactions/credit_click.php index 32187c1f..63a3c9fe 100644 --- a/example/transactions/credit_click.php +++ b/example/transactions/credit_click.php @@ -1,6 +1,6 @@ 10, 'invoice' => uniqid(), 'name' => 'mastercard', - 'cardData' => '001u8gJNwngKubFCO6FmJod6aESlIFATkKYaj47KlgBp7f3NeVxUzChg1Aug7WD2vc5wut2KU9NPLUaO0tFmzhVLZoDWn7dX4AzGxSjPrsPmDMWYcEkIwMZfcyJqoRfFkF3j15mil3muXxhR1a609NfkTo11J3ENVsvU3k60z', + 'cardData' => '001u8gJNwngKubFCO6FmJod6aESlIFATkKYaj47KlgBp7f3NeVxUzChg1Aug7WD2vc5wut2KU9NPLUaO0tFmzhVLZoDW + n7dX4AzGxSjPrsPmDMWYcEkIwMZfcyJqoRfFkF3j15mil3muXxhR1a609NfkTo11J3ENVsvU3k60z', ]); //Pay with security code @@ -27,7 +28,8 @@ 'invoice' => uniqid(), 'originalTransactionKey' => '6C5DBB69E74644958F8C25199514DC6C', 'name' => 'mastercard', - 'securityCode' => '001u8gJNwngKubFCO6FmJod6aESlIFATkKYaj47KlgBp7f3NeVxUzChg1Aug7WD2vc5wut2KU9NPLUaO0tFmzhVLZoDWn7dX4AzGxSjPrsPmDMWYcEkIwMZfcyJqoRfFkF3j15mil3muXxhR1a609NfkTo11J3ENVsvU3k60z', + 'securityCode' => '001u8gJNwngKubFCO6FmJod6aESlIFATkKYaj47KlgBp7f3NeVxUzChg1Aug7WD2vc5wut2KU9NPLUaO0tFmzhVLZoDW + n7dX4AzGxSjPrsPmDMWYcEkIwMZfcyJqoRfFkF3j15mil3muXxhR1a609NfkTo11J3ENVsvU3k60z', ]); //Refund @@ -50,7 +52,8 @@ 'amountDebit' => 10, 'invoice' => uniqid(), 'name' => 'mastercard', - 'cardData' => '001u8gJNwngKubFCO6FmJod6aESlIFATkKYaj47KlgBp7f3NeVxUzChg1Aug7WD2vc5wut2KU9NPLUaO0tFmzhVLZoDWn7dX4AzGxSjPrsPmDMWYcEkIwMZfcyJqoRfFkF3j15mil3muXxhR1a609NfkTo11J3ENVsvU3k60z', + 'cardData' => '001u8gJNwngKubFCO6FmJod6aESlIFATkKYaj47KlgBp7f3NeVxUzChg1Aug7WD2vc5wut2KU9NPLUaO0tFmzhVLZoDW + n7dX4AzGxSjPrsPmDMWYcEkIwMZfcyJqoRfFkF3j15mil3muXxhR1a609NfkTo11J3ENVsvU3k60z', ]); //Authorize with security code @@ -59,7 +62,8 @@ 'invoice' => uniqid(), 'originalTransactionKey' => '6C5DBB69E74644958F8C25199514DC6C', 'name' => 'mastercard', - 'securityCode' => '001u8gJNwngKubFCO6FmJod6aESlIFATkKYaj47KlgBp7f3NeVxUzChg1Aug7WD2vc5wut2KU9NPLUaO0tFmzhVLZoDWn7dX4AzGxSjPrsPmDMWYcEkIwMZfcyJqoRfFkF3j15mil3muXxhR1a609NfkTo11J3ENVsvU3k60z', + 'securityCode' => '001u8gJNwngKubFCO6FmJod6aESlIFATkKYaj47KlgBp7f3NeVxUzChg1Aug7WD2vc5wut2KU9NPLUaO0tFmzhVLZoDW + n7dX4AzGxSjPrsPmDMWYcEkIwMZfcyJqoRfFkF3j15mil3muXxhR1a609NfkTo11J3ENVsvU3k60z', ]); //Capture @@ -68,7 +72,8 @@ 'invoice' => uniqid(), 'originalTransactionKey' => '6C5DBB69E74644958F8C25199514DC6C', 'name' => 'mastercard', - 'securityCode' => '001u8gJNwngKubFCO6FmJod6aESlIFATkKYaj47KlgBp7f3NeVxUzChg1Aug7WD2vc5wut2KU9NPLUaO0tFmzhVLZoDWn7dX4AzGxSjPrsPmDMWYcEkIwMZfcyJqoRfFkF3j15mil3muXxhR1a609NfkTo11J3ENVsvU3k60z', + 'securityCode' => '001u8gJNwngKubFCO6FmJod6aESlIFATkKYaj47KlgBp7f3NeVxUzChg1Aug7WD2vc5wut2KU9NPLUaO0tFmzhVLZoDW + n7dX4AzGxSjPrsPmDMWYcEkIwMZfcyJqoRfFkF3j15mil3muXxhR1a609NfkTo11J3ENVsvU3k60z', ]); //Pay Recurrent @@ -77,5 +82,6 @@ 'invoice' => uniqid(), 'originalTransactionKey' => '6C5DBB69E74644958F8C25199514DC6C', 'name' => 'mastercard', - 'securityCode' => '001u8gJNwngKubFCO6FmJod6aESlIFATkKYaj47KlgBp7f3NeVxUzChg1Aug7WD2vc5wut2KU9NPLUaO0tFmzhVLZoDWn7dX4AzGxSjPrsPmDMWYcEkIwMZfcyJqoRfFkF3j15mil3muXxhR1a609NfkTo11J3ENVsvU3k60z', + 'securityCode' => '001u8gJNwngKubFCO6FmJod6aESlIFATkKYaj47KlgBp7f3NeVxUzChg1Aug7WD2vc5wut2KU9NPLUaO0tFmzhVLZoDW + n7dX4AzGxSjPrsPmDMWYcEkIwMZfcyJqoRfFkF3j15mil3muXxhR1a609NfkTo11J3ENVsvU3k60z', ]); diff --git a/example/transactions/eps.php b/example/transactions/eps.php index 426ed7ae..06530240 100644 --- a/example/transactions/eps.php +++ b/example/transactions/eps.php @@ -1,6 +1,6 @@ method('giftcard')->payRedirect([ 'amountDebit' => 10, 'invoice' => uniqid(), - 'servicesSelectableByClient' => 'westlandbon,ideal,babygiftcard,babyparkgiftcard,beautywellness,boekenbon,boekenvoordeel,designshopsgiftcard,fashioncheque,fashionucadeaukaart,fijncadeau,koffiecadeau,kokenzo,kookcadeau,nationaleentertainmentcard,naturesgift,podiumcadeaukaart,shoesaccessories,webshopgiftcard,wijncadeau,wonenzo,yourgift,vvvgiftcard,parfumcadeaukaart', + 'servicesSelectableByClient' => 'westlandbon,ideal,babygiftcard,babyparkgiftcard,beautywellness,boekenbon, + boekenvoordeel,designshopsgiftcard,fashioncheque,fashionucadeaukaart,fijncadeau,koffiecadeau,kokenzo, + kookcadeau,nationaleentertainmentcard,naturesgift,podiumcadeaukaart,shoesaccessories,webshopgiftcard, + wijncadeau,wonenzo,yourgift,vvvgiftcard,parfumcadeaukaart', 'continueOnIncomplete' => '1', ]); diff --git a/example/transactions/giropay.php b/example/transactions/giropay.php index d1cfbac0..625da64f 100644 --- a/example/transactions/giropay.php +++ b/example/transactions/giropay.php @@ -1,6 +1,6 @@ 'Articlenumber1', 'type' => 'Physical', 'description' => 'Blue Toy Car', - 'category' => 'test product', + 'category' => 'test product1', 'vatPercentage' => '21', 'quantity' => '2', 'price' => '20.10', @@ -69,7 +69,7 @@ 'identifier' => 'Articlenumber2', 'type' => 'Physical', 'description' => 'Red Toy Car', - 'category' => 'test product', + 'category' => 'test product2', 'vatPercentage' => '21', 'quantity' => '1', 'price' => '10.10', @@ -78,7 +78,7 @@ 'identifier' => 'USPShippingID', 'type' => 'Physical', 'description' => 'UPS', - 'category' => 'test product', + 'category' => 'test product3', 'vatPercentage' => '21', 'quantity' => '1', 'price' => '2', diff --git a/example/transactions/in3old.php b/example/transactions/in3old.php index 77272c07..9c7a2321 100644 --- a/example/transactions/in3old.php +++ b/example/transactions/in3old.php @@ -1,6 +1,6 @@ '', //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/example/transactions/paypal.php b/example/transactions/paypal.php index d2958527..33866902 100644 --- a/example/transactions/paypal.php +++ b/example/transactions/paypal.php @@ -1,6 +1,6 @@ offsetSet($param, $arg); + $this->offsetSet($param, $arg); } elseif ($prefix === 'get') { return $this->offsetGet($param); diff --git a/tests/Buckaroo/Payments/AfterpayDigiAcceptTest.php b/tests/Buckaroo/Payments/AfterpayDigiAcceptTest.php index 95409eff..0e5dca6e 100644 --- a/tests/Buckaroo/Payments/AfterpayDigiAcceptTest.php +++ b/tests/Buckaroo/Payments/AfterpayDigiAcceptTest.php @@ -60,21 +60,6 @@ public function it_creates_a_afterpaydigiaccept_capture() $this->assertTrue($response->isFailed()); } -// /** -// * @return void -// * @test -// */ -// public function it_creates_a_afterpaydigiaccept_cancel_authorize() -// { -// $response = $this->buckaroo->method('afterpaydigiaccept')->cancelAuthorize([ -// 'amountCredit' => 10, -// 'invoice' => '10000480', -// 'originalTransactionKey' => '9AA4C81A08A84FA7B68E6A6A6291XXXX' -// ]); -// -// $this->assertTrue($response->isFailed()); -// } - /** * @return void * @test diff --git a/tests/Buckaroo/Payments/AfterpayTest.php b/tests/Buckaroo/Payments/AfterpayTest.php index 86841ec0..a92d30d0 100644 --- a/tests/Buckaroo/Payments/AfterpayTest.php +++ b/tests/Buckaroo/Payments/AfterpayTest.php @@ -47,21 +47,6 @@ public function it_creates_a_afterpay_authorize() $this->assertTrue($response->isSuccess()); } -// /** -// * @return void -// * @test -// */ -// public function it_creates_a_afterpay_cancel_authorize() -// { -// $response = $this->buckaroo->method('afterpay')->cancelAuthorize([ -// 'amountCredit' => 10, -// 'originalTransactionKey' => 'F86579ECED1D493887ECAE7C287BXXXX', -// 'invoice' => 'testinvoice12345cvx' -// ]); -// -// $this->assertTrue($response->isRejected()); -// } - /** * @return void * @test @@ -83,7 +68,8 @@ public function it_creates_a_afterpay_refund() { $response = $this->buckaroo->method('afterpay')->refund([ 'invoice' => 'testinvoice 123', //Set invoice number of the transaction to refund - 'originalTransactionKey' => '4E8BD922192746C3918BF4077CXXXXXX', //Set transaction key of the transaction to refund + 'originalTransactionKey' => '4E8BD922192746C3918BF4077CXXXXXX', + //Set transaction key of the transaction to refund 'amountCredit' => 1.23, ]); @@ -98,7 +84,8 @@ public function it_creates_a_afterpay_partial_refund() { $response = $this->buckaroo->method('afterpay')->refund([ 'invoice' => 'testinvoice 123', //Set invoice number of the transaction to refund - 'originalTransactionKey' => '4E8BD922192746C3918BF4077CXXXXXX', //Set transaction key of the transaction to refund + 'originalTransactionKey' => '4E8BD922192746C3918BF4077CXXXXXX', + //Set transaction key of the transaction to refund 'amountCredit' => 1.23, 'articles' => [ [ diff --git a/tests/Buckaroo/Payments/BancontactTest.php b/tests/Buckaroo/Payments/BancontactTest.php index be9606f5..e4f93522 100644 --- a/tests/Buckaroo/Payments/BancontactTest.php +++ b/tests/Buckaroo/Payments/BancontactTest.php @@ -63,7 +63,10 @@ public function it_creates_a_bancontact_encrypted_payment() 'invoice' => uniqid(), 'amountDebit' => 10.10, 'description' => 'Bancontact PayEncrypted Test 123', - 'encryptedCardData' => '001SlXfd8MbiTd/JFwCiGVs3f6o4x6xt0aN29NzOSNZHPKlVsz/EWeQmyhb1gGZ86VY88DP7gfDV+UyjcPfpVfHZd7u+WkO71hnV2QfYILCBNqE1aiPv2GQVGdaGbuoQloKu1o3o3I1UDmVxivXTMQX76ovot89geA6hqbtakmpmvxeiwwea3l4htNoX1IlD1hfYkDDl9rzSu5ypcjvVs6aRGXK5iMHnyrmEsEnfdj/Q5XWbsD5xAm4u3y6J8d4UP7LB31VLECzZUTiJOtKKcCQlT01YThIkQlj8PWBBMtt4H52VN3IH2+wPYtR8HiOZzcA2HA7UxozogIpS53tIURj/g==', + 'encryptedCardData' => '001SlXfd8MbiTd/JFwCiGVs3f6o4x6xt0aN29NzOSNZHPKlVsz/EWeQmyhb1gGZ86VY88DP7gf + DV+UyjcPfpVfHZd7u+WkO71hnV2QfYILCBNqE1aiPv2GQVGdaGbuoQloKu1o3o3I1UDmVxivXTMQX76ovot89geA6hqbtakmpm + vxeiwwea3l4htNoX1IlD1hfYkDDl9rzSu5ypcjvVs6aRGXK5iMHnyrmEsEnfdj/Q5XWbsD5xAm4u3y6J8d4UP7LB31VLECzZUT + iJOtKKcCQlT01YThIkQlj8PWBBMtt4H52VN3IH2+wPYtR8HiOZzcA2HA7UxozogIpS53tIURj/g==', ]); $this->assertTrue($response->isPendingProcessing()); diff --git a/tests/Buckaroo/Payments/BatchTest.php b/tests/Buckaroo/Payments/BatchTest.php index aa3db504..8c948e6a 100644 --- a/tests/Buckaroo/Payments/BatchTest.php +++ b/tests/Buckaroo/Payments/BatchTest.php @@ -82,4 +82,4 @@ public function it_tests_batch_api() $this->assertTrue($response->data('Message') == '3 data requests were queued for processing.'); } -} \ No newline at end of file +} diff --git a/tests/Buckaroo/Payments/BillinkTest.php b/tests/Buckaroo/Payments/BillinkTest.php index 599aad46..51015a9f 100644 --- a/tests/Buckaroo/Payments/BillinkTest.php +++ b/tests/Buckaroo/Payments/BillinkTest.php @@ -50,7 +50,8 @@ public function it_creates_a_billink_authorize() public function it_creates_a_billink_capture() { $response = $this->buckaroo->method('billink')->capture([ - 'originalTransactionKey' => '74AD098CCFAA4F739FE16279B5059B6B', //Set transaction key of the transaction to capture + 'originalTransactionKey' => '74AD098CCFAA4F739FE16279B5059B6B', + //Set transaction key of the transaction to capture 'invoice' => '62905fa2650f4', //Set invoice id 'amountDebit' => 50.30, //set amount to capture 'articles' => [ @@ -169,7 +170,8 @@ private function getPaymentPayload(): array public function it_creates_a_billink_cancel_authorize() { $response = $this->buckaroo->method('billink')->cancelAuthorize([ - 'originalTransactionKey' => '74AD098CCFAA4F739FE16279B5059B6B', //Set transaction key of the transaction to capture + 'originalTransactionKey' => '74AD098CCFAA4F739FE16279B5059B6B', + //Set transaction key of the transaction to capture 'invoice' => '62905fa2650f4', //Set invoice id 'AmountCredit' => 10, //set amount to capture ]); diff --git a/tests/Buckaroo/Payments/CreditcardTest.php b/tests/Buckaroo/Payments/CreditcardTest.php index a877af45..9ff06630 100644 --- a/tests/Buckaroo/Payments/CreditcardTest.php +++ b/tests/Buckaroo/Payments/CreditcardTest.php @@ -49,7 +49,8 @@ public function it_creates_a_creditcard_encrypted_payment() 'amountDebit' => 10, 'invoice' => uniqid(), 'name' => 'mastercard', - 'encryptedCardData' => '001u8gJNwngKubFCO6FmJod6aESlIFATkKYaj47KlgBp7f3NeVxUzChg1Aug7WD2vc5wut2KU9NPLUaO0tFmzhVLZoDWn7dX4AzGxSjPrsPmDMWYcEkIwMZfcyJqoRfFkF3j15mil3muXxhR1a609NfkTo11J3ENVsvU3k60z', + 'encryptedCardData' => '001u8gJNwngKubFCO6FmJod6aESlIFATkKYaj47KlgBp7f3NeVxUzChg1Aug7WD2vc5wut2KU + 9NPLUaO0tFmzhVLZoDWn7dX4AzGxSjPrsPmDMWYcEkIwMZfcyJqoRfFkF3j15mil3muXxhR1a609NfkTo11J3ENVsvU3k60z', ]); $this->assertTrue($response->isValidationFailure()); @@ -66,7 +67,8 @@ public function it_creates_a_creditcard_security_code_payment() 'invoice' => uniqid(), 'originalTransactionKey' => '6C5DBB69E74644958F8C25199514DC6C', 'name' => 'mastercard', - 'encryptedSecurityCode' => '001u8gJNwngKubFCO6FmJod6aESlIFATkKYaj47KlgBp7f3NeVxUzChg1Aug7WD2vc5wut2KU9NPLUaO0tFmzhVLZoDWn7dX4AzGxSjPrsPmDMWYcEkIwMZfcyJqoRfFkF3j15mil3muXxhR1a609NfkTo11J3ENVsvU3k60z', + 'encryptedSecurityCode' => '001u8gJNwngKubFCO6FmJod6aESlIFATkKYaj47KlgBp7f3NeVxUzChg1Aug7WD2vc5wut2 + KU9NPLUaO0tFmzhVLZoDWn7dX4AzGxSjPrsPmDMWYcEkIwMZfcyJqoRfFkF3j15mil3muXxhR1a609NfkTo11J3ENVsvU3k60z', ]); $this->assertTrue($response->isValidationFailure()); @@ -113,7 +115,8 @@ public function it_creates_a_creditcard_encrypted_authorize() 'amountDebit' => 10, 'invoice' => uniqid(), 'name' => 'mastercard', - 'encryptedCardData' => '001u8gJNwngKubFCO6FmJod6aESlIFATkKYaj47KlgBp7f3NeVxUzChg1Aug7WD2vc5wut2KU9NPLUaO0tFmzhVLZoDWn7dX4AzGxSjPrsPmDMWYcEkIwMZfcyJqoRfFkF3j15mil3muXxhR1a609NfkTo11J3ENVsvU3k60z', + 'encryptedCardData' => '001u8gJNwngKubFCO6FmJod6aESlIFATkKYaj47KlgBp7f3NeVxUzChg1Aug7WD2vc5wut2KU + 9NPLUaO0tFmzhVLZoDWn7dX4AzGxSjPrsPmDMWYcEkIwMZfcyJqoRfFkF3j15mil3muXxhR1a609NfkTo11J3ENVsvU3k60z', ]); $this->assertTrue($response->isValidationFailure()); @@ -130,7 +133,8 @@ public function it_creates_a_creditcard_security_code_authorize() 'invoice' => uniqid(), 'originalTransactionKey' => '6C5DBB69E74644958F8C25199514DC6C', 'name' => 'mastercard', - 'encryptedSecurityCode' => '001u8gJNwngKubFCO6FmJod6aESlIFATkKYaj47KlgBp7f3NeVxUzChg1Aug7WD2vc5wut2KU9NPLUaO0tFmzhVLZoDWn7dX4AzGxSjPrsPmDMWYcEkIwMZfcyJqoRfFkF3j15mil3muXxhR1a609NfkTo11J3ENVsvU3k60z', + 'encryptedSecurityCode' => '001u8gJNwngKubFCO6FmJod6aESlIFATkKYaj47KlgBp7f3NeVxUzChg1Aug7WD2vc5wut2KU + 9NPLUaO0tFmzhVLZoDWn7dX4AzGxSjPrsPmDMWYcEkIwMZfcyJqoRfFkF3j15mil3muXxhR1a609NfkTo11J3ENVsvU3k60z', ]); $this->assertTrue($response->isValidationFailure()); diff --git a/tests/Buckaroo/Payments/IdealTest.php b/tests/Buckaroo/Payments/IdealTest.php index a8f5c177..f7201ecb 100644 --- a/tests/Buckaroo/Payments/IdealTest.php +++ b/tests/Buckaroo/Payments/IdealTest.php @@ -63,7 +63,8 @@ protected function setUp(): void $this->refundPayload = [ 'invoice' => 'testinvoice 123', //Set invoice number of the transaction to refund - 'originalTransactionKey' => '4E8BD922192746C3918BF4077CXXXXXX', //Set transaction key of the transaction to refund + 'originalTransactionKey' => '4E8BD922192746C3918BF4077CXXXXXX', + //Set transaction key of the transaction to refund 'amountCredit' => 1.23, 'clientIP' => [ 'address' => '123.456.789.123', @@ -85,12 +86,6 @@ public function it_creates_a_ideal_payment() $response = $this->buckaroo->method('idealprocessing')->pay($this->paymentPayload); $this->assertTrue($response->isPendingProcessing()); - -// $customConfig = new CustomConfig(); -// $customConfig->currency('AUD'); -// -// $response = $this->buckaroo->setConfig($customConfig)->payment('ideal')->pay(json_encode($this->paymentPayload)); -// $this->assertTrue($response->isPendingProcessing()); } /** diff --git a/tests/Buckaroo/Payments/MarketplacesTest.php b/tests/Buckaroo/Payments/MarketplacesTest.php index 715f12c6..d301385b 100644 --- a/tests/Buckaroo/Payments/MarketplacesTest.php +++ b/tests/Buckaroo/Payments/MarketplacesTest.php @@ -98,7 +98,8 @@ public function it_creates_marketplaces_refund() $response = $this->buckaroo->method('ideal')->combine($marketplace)->refund([ 'invoice' => 'testinvoice 123', //Set invoice number of the transaction to refund - 'originalTransactionKey' => '4E8BD922192746C3918BF4077CXXXXXX', //Set transaction key of the transaction to refund + 'originalTransactionKey' => '4E8BD922192746C3918BF4077CXXXXXX', + //Set transaction key of the transaction to refund 'amountCredit' => 30, ]); diff --git a/tests/Buckaroo/Payments/NoServiceSpecifiedPaymentTest.php b/tests/Buckaroo/Payments/NoServiceSpecifiedPaymentTest.php index bef3e411..effdfe20 100644 --- a/tests/Buckaroo/Payments/NoServiceSpecifiedPaymentTest.php +++ b/tests/Buckaroo/Payments/NoServiceSpecifiedPaymentTest.php @@ -39,4 +39,4 @@ public function it_creates_a_noservice_payment() $this->assertTrue($response->isWaitingOnUserInput()); } -} \ No newline at end of file +} diff --git a/tests/Buckaroo/Payments/PaymentInitiation.php b/tests/Buckaroo/Payments/PaymentInitiation.php index 3759c63d..3a3795ef 100644 --- a/tests/Buckaroo/Payments/PaymentInitiation.php +++ b/tests/Buckaroo/Payments/PaymentInitiation.php @@ -4,7 +4,7 @@ use Tests\Buckaroo\BuckarooTestCase; -class PaymentInitiation extends BuckarooTestCase +class PaymentInitiationTest extends BuckarooTestCase { /** diff --git a/tests/Buckaroo/Payments/PushTest.php b/tests/Buckaroo/Payments/PushTest.php index 3aab3f4d..a2ec3b9b 100644 --- a/tests/Buckaroo/Payments/PushTest.php +++ b/tests/Buckaroo/Payments/PushTest.php @@ -39,8 +39,21 @@ public function it_test_the_push_response() $replyHandler = $this->buckaroo->method('ideal'); - $auth_header = 'IBjihN7Fhp:0YvyjYAzDQ28W+hQi80f2nhe0Z1QFJLbz7IH//6LsAU=:cad1832100784f57a6e6de835d9f3638:1658227572'; - $post_data = '{"Transaction":{"Key":"5340604668D74435AA344E1428ED1292","Invoice":"62d68b6c8ab0c","ServiceCode":"ideal","Status":{"Code":{"Code":190,"Description":"Success"},"SubCode":{"Code":"S001","Description":"Transaction successfully processed"},"DateTime":"2022-07-19T12:46:12"},"IsTest":true,"Order":"ORDER_NO_62d68b6ca2df3","Currency":"EUR","AmountDebit":10.1,"TransactionType":"C021","Services":[{"Name":"ideal","Action":null,"Parameters":[{"Name":"consumerIssuer","Value":"ABN AMRO"},{"Name":"transactionId","Value":"0000000000000001"},{"Name":"consumerName","Value":"J. de Tèster"},{"Name":"consumerIBAN","Value":"NL44RABO0123456789"},{"Name":"consumerBIC","Value":"RABONL2U"}],"VersionAsProperty":2}],"CustomParameters":null,"AdditionalParameters":{"List":[{"Name":"initiated_by_magento","Value":"1"},{"Name":"service_action","Value":"something"}]},"MutationType":1,"RelatedTransactions":null,"IsCancelable":false,"IssuingCountry":null,"StartRecurrent":false,"Recurring":false,"CustomerName":"J. de Tèster","PayerHash":"2d26d34584a4eafeeaa97eed10cfdae22ae64cdce1649a80a55fafca8850e3e22cb32eb7c8fc95ef0c6f96669a21651d4734cc568816f9bd59c2092911e6c0da","PaymentKey":"AEC974D455FF4A4B9B4C21E437A04838","Description":null}}'; + $auth_header = 'IBjihN7Fhp:0YvyjYAzDQ28W+hQi80f2nhe0Z1QFJLbz7IH//6LsAU=:cad1832100784f57a6e6de835d9f3638: + 1658227572'; + $post_data = '{"Transaction":{"Key":"5340604668D74435AA344E1428ED1292","Invoice":"62d68b6c8ab0c", + "ServiceCode":"ideal","Status":{"Code":{"Code":190,"Description":"Success"},"SubCode":{"Code":"S001", + "Description":"Transaction successfully processed"},"DateTime":"2022-07-19T12:46:12"},"IsTest":true, + "Order":"ORDER_NO_62d68b6ca2df3","Currency":"EUR","AmountDebit":10.1,"TransactionType":"C021", + "Services":[{"Name":"ideal","Action":null,"Parameters":[{"Name":"consumerIssuer","Value":"ABN AMRO"}, + {"Name":"transactionId","Value":"0000000000000001"},{"Name":"consumerName","Value":"J. de Tèster"}, + {"Name":"consumerIBAN","Value":"NL44RABO0123456789"},{"Name":"consumerBIC","Value":"RABONL2U"}], + "VersionAsProperty":2}],"CustomParameters":null,"AdditionalParameters":{"List":[{"Name": + "initiated_by_magento","Value":"1"},{"Name":"service_action","Value":"something"}]},"MutationType":1, + "RelatedTransactions":null,"IsCancelable":false,"IssuingCountry":null,"StartRecurrent":false, + "Recurring":false,"CustomerName":"J. de Tèster","PayerHash":"2d26d34584a4eafeeaa97eed10cfdae22ae64cdce + 1649a80a55fafca8850e3e22cb32eb7c8fc95ef0c6f96669a21651d4734cc568816f9bd59c2092911e6c0da","PaymentKey": + "AEC974D455FF4A4B9B4C21E437A04838","Description":null}}'; $uri = 'https://buckaroo.dev/push'; $post_data = [ @@ -49,7 +62,8 @@ public function it_test_the_push_response() "brq_customer_name" => "J. de Tèster", "brq_invoicenumber" => "SDKDevelopment.com_INVOICE_NO_628c6d032af90", "brq_ordernumber" => "SDKDevelopment.com_ORDER_NO_628c6d032af95", - "brq_payer_hash" => "2d26d34584a4eafeeaa97eed10cfdae22ae64cdce1649a80a55fafca8850e3e22cb32eb7c8fc95ef0c6f96669a21651d4734cc568816f9bd59c2092911e6c0da", + "brq_payer_hash" => "2d26d34584a4eafeeaa97eed10cfdae22ae64cdce1649a80a55fafca8850e3e22cb32eb7 + c8fc95ef0c6f96669a21651d4734cc568816f9bd59c2092911e6c0da", "brq_payment" => "D44ACDD0F99D4A1C811D2CD3EFDB05BA", "brq_payment_method" => "ideal", "brq_SERVICE_ideal_consumerBIC" => "RABONL2U", @@ -67,32 +81,6 @@ public function it_test_the_push_response() "brq_signature" => "bf7a62c830da2d2e004199919a8fe0d53b0668f5", ]; -// $post_data = [ -// "BRQ_AMOUNT" => "10.10", -// "BRQ_CURRENCY" => "EUR", -// "BRQ_CUSTOMER_NAME" => "J. de Tèster", -// "BRQ_INVOICENUMBER" => "63208dbcb5702", -// "BRQ_ORDERNUMBER" => "ORDER_NO_63208dbcd10e2", -// "BRQ_PAYER_HASH" => "2d26d34584a4eafeeaa97eed10cfdae22ae64cdce1649a80a55fafca8850e3e22cb32eb7c8fc95ef0c6f96669a21651d4734cc568816f9bd59c2092911e6c0da", -// "BRQ_PAYMENT" => "7F817F3A3F614062AC3E6EE634B2699F", -// "BRQ_PAYMENT_METHOD" => "ideal", -// "BRQ_SERVICE_IDEAL_CONSUMERBIC" => "RABONL2U", -// "BRQ_SERVICE_IDEAL_CONSUMERIBAN" => "NL44RABO0123456789", -// "BRQ_SERVICE_IDEAL_CONSUMERISSUER" => "ABN AMRO", -// "BRQ_SERVICE_IDEAL_CONSUMERNAME" => "J. de Tèster", -// "BRQ_SERVICE_IDEAL_TRANSACTIONID" => "0000000000000001", -// "BRQ_STATUSCODE" => "190", -// "BRQ_STATUSCODE_DETAIL" => "S001", -// "BRQ_STATUSMESSAGE" => "Transaction successfully processed", -// "BRQ_TEST" => "true", -// "BRQ_TIMESTAMP" => "2022-09-13 16:03:58", -// "BRQ_TRANSACTIONS" => "BBEB99F178C64A7FB30667B6427D8064", -// "BRQ_WEBSITEKEY" => "IBjihN7Fhp", -// "BRQ_SIGNATURE" => "06de0e66b0df062df376fa619cc0792b2ed5f3fd", -// "ADD_INITIATED_BY_MAGENTO" => "1", -// "ADD_SERVICE_ACTION" => "something" -// ]; - $reply_handler = new ReplyHandler($this->buckaroo->client()->config(), $post_data, $auth_header, $uri); $reply_handler->validate();