Version Notes
Now using the paynl SDK
Added instore payments (PIN)
Added Yehhpay
Download this release
Release Info
Developer | Andy Pieters |
Extension | Pay_NL |
Version | 3.7.0 |
Comparing to | |
See all releases |
Code changes from version 3.6.6 to 3.7.0
- app/code/community/Pay/Payment/Block/Form/Instore.php +18 -0
- app/code/community/Pay/Payment/Block/Form/Yehhpay.php +11 -0
- app/code/community/Pay/Payment/Helper/Api.php +0 -115
- app/code/community/Pay/Payment/Helper/Api/Capture.php +0 -37
- app/code/community/Pay/Payment/Helper/Api/Exception.php +0 -4
- app/code/community/Pay/Payment/Helper/Api/Getservice.php +0 -65
- app/code/community/Pay/Payment/Helper/Api/Info.php +0 -24
- app/code/community/Pay/Payment/Helper/Api/Ispayserverip.php +0 -16
- app/code/community/Pay/Payment/Helper/Api/Refund.php +0 -42
- app/code/community/Pay/Payment/Helper/Api/Start.php +0 -252
- app/code/community/Pay/Payment/Helper/Api/Void.php +0 -27
- app/code/community/Pay/Payment/Helper/Data.php +281 -224
- app/code/community/Pay/Payment/Helper/Order.php +34 -65
- app/code/community/Pay/Payment/Model/Observer.php +23 -0
- app/code/community/Pay/Payment/Model/Paymentmethod.php +222 -180
- app/code/community/Pay/Payment/Model/Paymentmethod/Ideal.php +0 -26
- app/code/community/Pay/Payment/Model/Paymentmethod/Instore.php +96 -0
- app/code/community/Pay/Payment/Model/Paymentmethod/Klarna.php +25 -97
- app/code/community/Pay/Payment/Model/Paymentmethod/Paylink.php +0 -18
- app/code/community/Pay/Payment/Model/Paymentmethod/Yehhpay.php +11 -0
- app/code/community/Pay/Payment/Model/Source/Paymentmethod/Instore/Active.php +4 -0
- app/code/community/Pay/Payment/Model/Source/Paymentmethod/Yehhpay/Active.php +4 -0
- app/code/community/Pay/Payment/Model/Transaction/LockException.php +12 -0
- app/code/community/Pay/Payment/composer.json +5 -0
- app/code/community/Pay/Payment/composer.lock +111 -0
- app/code/community/Pay/Payment/controllers/CheckoutController.php +20 -3
- app/code/community/Pay/Payment/controllers/OrderController.php +57 -35
- app/code/community/Pay/Payment/etc/config.xml +48 -3
- app/code/community/Pay/Payment/etc/system.xml +465 -13
- app/code/community/Pay/Payment/sql/pay_payment_setup/install-3.1.2.8.php +0 -128
- app/code/community/Pay/Payment/sql/pay_payment_setup/install-3.7.0.php +135 -0
- app/code/community/Pay/Payment/sql/pay_payment_setup/upgrade-3.2.1-3.2.2.php +12 -2
- app/code/community/Pay/Payment/sql/pay_payment_setup/upgrade-3.6.5-3.6.6.php +16 -0
- app/code/community/Pay/Payment/sql/pay_payment_setup/upgrade-3.6.6-3.7.0.php +16 -0
- app/code/community/Pay/Payment/vendor/autoload.php +7 -0
- app/code/community/Pay/Payment/vendor/composer/ClassLoader.php +413 -0
- app/code/community/Pay/Payment/vendor/composer/LICENSE +56 -0
- app/code/community/Pay/Payment/vendor/composer/autoload_classmap.php +9 -0
- app/code/community/Pay/Payment/vendor/composer/autoload_namespaces.php +9 -0
- app/code/community/Pay/Payment/vendor/composer/autoload_psr4.php +11 -0
- app/code/community/Pay/Payment/vendor/composer/autoload_real.php +52 -0
- app/code/community/Pay/Payment/vendor/composer/autoload_static.php +39 -0
- app/code/community/Pay/Payment/vendor/composer/installed.json +98 -0
- app/code/community/Pay/Payment/vendor/paynl/sdk/.gitignore +5 -0
- app/code/community/Pay/Payment/vendor/paynl/sdk/.travis.yml +31 -0
- app/code/community/Pay/Payment/vendor/paynl/sdk/README.md +185 -0
- app/code/community/Pay/Payment/vendor/paynl/sdk/composer.json +21 -0
- app/code/community/Pay/Payment/vendor/paynl/sdk/samples/config.sample.php +8 -0
- app/code/community/Pay/Payment/vendor/paynl/sdk/samples/directDebit/add.php +29 -0
- app/code/community/Pay/Payment/vendor/paynl/sdk/samples/directDebit/get.php +9 -0
- app/code/community/Pay/Payment/vendor/paynl/sdk/samples/directDebit/mandate/add.php +29 -0
- app/code/community/Pay/Payment/vendor/paynl/sdk/samples/directDebit/mandate/addTransaction.php +14 -0
- app/code/community/Pay/Payment/vendor/paynl/sdk/samples/directDebit/mandate/get.php +9 -0
- app/code/community/Pay/Payment/vendor/paynl/sdk/samples/directDebit/recurring/add.php +32 -0
- app/code/community/Pay/Payment/vendor/paynl/sdk/samples/directDebit/recurring/get.php +9 -0
- app/code/community/Pay/Payment/vendor/paynl/sdk/samples/exchange.php +51 -0
- app/code/community/Pay/Payment/vendor/paynl/sdk/samples/instore/confirmPayment.php +36 -0
- app/code/community/Pay/Payment/vendor/paynl/sdk/samples/instore/getAllTerminals.php +28 -0
- app/code/community/Pay/Payment/vendor/paynl/sdk/samples/instore/getReceipt.php +29 -0
- app/code/community/Pay/Payment/vendor/paynl/sdk/samples/instore/payment.php +41 -0
- app/code/community/Pay/Payment/vendor/paynl/sdk/samples/instore/status.php +30 -0
- app/code/community/Pay/Payment/vendor/paynl/sdk/samples/return.php +44 -0
- app/code/community/Pay/Payment/vendor/paynl/sdk/samples/service/getPaylinkUrl.php +60 -0
- app/code/community/Pay/Payment/vendor/paynl/sdk/samples/transaction/capture.php +27 -0
- app/code/community/Pay/Payment/vendor/paynl/sdk/samples/transaction/paymentMethods.php +28 -0
- app/code/community/Pay/Payment/vendor/paynl/sdk/samples/transaction/refund.php +27 -0
- app/code/community/Pay/Payment/vendor/paynl/sdk/samples/transaction/start.php +130 -0
- app/code/community/Pay/Payment/vendor/paynl/sdk/samples/transaction/void.php +27 -0
- app/code/community/Pay/Payment/vendor/paynl/sdk/samples/validate/isPayServerIp.php +31 -0
- app/code/community/Pay/Payment/vendor/paynl/sdk/src/Api/Api.php +120 -0
- app/code/community/Pay/Payment/vendor/paynl/sdk/src/Api/Currency/Currency.php +31 -0
- app/code/community/Pay/Payment/vendor/paynl/sdk/src/Api/Currency/GetAll.php +18 -0
- app/code/community/Pay/Payment/vendor/paynl/sdk/src/Api/DirectDebit/DebitAdd.php +317 -0
- app/code/community/Pay/Payment/vendor/paynl/sdk/src/Api/DirectDebit/DebitGet.php +46 -0
- app/code/community/Pay/Payment/vendor/paynl/sdk/src/Api/DirectDebit/Delete.php +43 -0
- app/code/community/Pay/Payment/vendor/paynl/sdk/src/Api/DirectDebit/DirectDebit.php +45 -0
- app/code/community/Pay/Payment/vendor/paynl/sdk/src/Api/DirectDebit/MandateAdd.php +39 -0
- app/code/community/Pay/Payment/vendor/paynl/sdk/src/Api/DirectDebit/MandateDebit.php +102 -0
- app/code/community/Pay/Payment/vendor/paynl/sdk/src/Api/DirectDebit/MandateGet.php +40 -0
- app/code/community/Pay/Payment/vendor/paynl/sdk/src/Api/DirectDebit/RecurringAdd.php +61 -0
- app/code/community/Pay/Payment/vendor/paynl/sdk/src/Api/DirectDebit/RecurringGet.php +45 -0
- app/code/community/Pay/Payment/vendor/paynl/sdk/src/Api/DirectDebit/Update.php +315 -0
- app/code/community/Pay/Payment/vendor/paynl/sdk/src/Api/Instore/ConfirmPayment.php +103 -0
- app/code/community/Pay/Payment/vendor/paynl/sdk/src/Api/Instore/GetAllTerminals.php +39 -0
- app/code/community/Pay/Payment/vendor/paynl/sdk/src/Api/Instore/GetTransactionTicket.php +68 -0
- app/code/community/Pay/Payment/vendor/paynl/sdk/src/Api/Instore/Instore.php +48 -0
- app/code/community/Pay/Payment/vendor/paynl/sdk/src/Api/Instore/Payment.php +86 -0
- app/code/community/Pay/Payment/vendor/paynl/sdk/src/Api/Instore/Status.php +68 -0
- app/code/community/Pay/Payment/vendor/paynl/sdk/src/Api/Refund/Add.php +262 -0
- app/code/community/Pay/Payment/vendor/paynl/sdk/src/Api/Refund/Refund.php +47 -0
- app/code/community/Pay/Payment/vendor/paynl/sdk/src/Api/Service/GetPayLinkUrl.php +162 -0
- app/code/community/Pay/Payment/vendor/paynl/sdk/src/Api/Service/Service.php +35 -0
- app/code/community/Pay/Payment/vendor/paynl/sdk/src/Api/Transaction/Approve.php +70 -0
- app/code/community/Pay/Payment/vendor/paynl/sdk/src/Api/Transaction/Capture.php +70 -0
- app/code/community/Pay/Payment/vendor/paynl/sdk/src/Api/Transaction/Decline.php +70 -0
- app/code/community/Pay/Payment/vendor/paynl/sdk/src/Api/Transaction/GetService.php +76 -0
- app/code/community/Pay/Payment/vendor/paynl/sdk/src/Api/Transaction/Info.php +70 -0
- app/code/community/Pay/Payment/vendor/paynl/sdk/src/Api/Transaction/Refund.php +100 -0
- app/code/community/Pay/Payment/vendor/paynl/sdk/src/Api/Transaction/Start.php +493 -0
- app/code/community/Pay/Payment/vendor/paynl/sdk/src/Api/Transaction/Transaction.php +47 -0
- app/code/community/Pay/Payment/vendor/paynl/sdk/src/Api/Transaction/Void.php +70 -0
- app/code/community/Pay/Payment/vendor/paynl/sdk/src/Api/Validate/IsPayServerIp.php +42 -0
- app/code/community/Pay/Payment/vendor/paynl/sdk/src/Api/Validate/Validate.php +45 -0
- app/code/community/Pay/Payment/vendor/paynl/sdk/src/Api/Voucher/Activate.php +104 -0
- app/code/community/Pay/Payment/vendor/paynl/sdk/src/Api/Voucher/Balance.php +58 -0
- app/code/community/Pay/Payment/vendor/paynl/sdk/src/Api/Voucher/Charge.php +86 -0
- app/code/community/Pay/Payment/vendor/paynl/sdk/src/Api/Voucher/Voucher.php +29 -0
- app/code/community/Pay/Payment/vendor/paynl/sdk/src/Config.php +183 -0
- app/code/community/Pay/Payment/vendor/paynl/sdk/src/Curl/Dummy.php +28 -0
- app/code/community/Pay/Payment/vendor/paynl/sdk/src/Currency.php +49 -0
- app/code/community/Pay/Payment/vendor/paynl/sdk/src/DirectDebit.php +181 -0
- app/code/community/Pay/Payment/vendor/paynl/sdk/src/DirectDebit/Mandate.php +121 -0
- app/code/community/Pay/Payment/vendor/paynl/sdk/src/DirectDebit/Recurring.php +110 -0
- app/code/community/Pay/Payment/vendor/paynl/sdk/src/Error/Api.php +30 -0
- app/code/community/Pay/Payment/vendor/paynl/sdk/src/Error/Error.php +30 -0
- app/code/community/Pay/Payment/vendor/paynl/sdk/src/Error/NotFound.php +21 -0
- app/code/community/Pay/Payment/vendor/paynl/sdk/src/Error/Required.php +39 -0
- app/code/community/Pay/Payment/vendor/paynl/sdk/src/Error/Required/ApiToken.php +36 -0
- app/code/community/Pay/Payment/vendor/paynl/sdk/src/Error/Required/ServiceId.php +36 -0
- app/code/community/Pay/Payment/vendor/paynl/sdk/src/Helper.php +213 -0
- app/code/community/Pay/Payment/vendor/paynl/sdk/src/Instore.php +147 -0
- app/code/community/Pay/Payment/vendor/paynl/sdk/src/Paymentmethods.php +126 -0
- app/code/community/Pay/Payment/vendor/paynl/sdk/src/Refund.php +102 -0
- app/code/community/Pay/Payment/vendor/paynl/sdk/src/Result/DirectDebit/Add.php +19 -0
- app/code/community/Pay/Payment/vendor/paynl/sdk/src/Result/DirectDebit/Get.php +54 -0
- app/code/community/Pay/Payment/vendor/paynl/sdk/src/Result/DirectDebit/Mandate/Add.php +19 -0
- app/code/community/Pay/Payment/vendor/paynl/sdk/src/Result/DirectDebit/Mandate/AddTransaction.php +19 -0
- app/code/community/Pay/Payment/vendor/paynl/sdk/src/Result/DirectDebit/Mandate/Get.php +19 -0
- app/code/community/Pay/Payment/vendor/paynl/sdk/src/Result/DirectDebit/Recurring/Add.php +19 -0
- app/code/community/Pay/Payment/vendor/paynl/sdk/src/Result/DirectDebit/Recurring/Get.php +19 -0
- app/code/community/Pay/Payment/vendor/paynl/sdk/src/Result/Instore/ConfirmPayment.php +31 -0
- app/code/community/Pay/Payment/vendor/paynl/sdk/src/Result/Instore/Payment.php +53 -0
- app/code/community/Pay/Payment/vendor/paynl/sdk/src/Result/Instore/Receipt.php +59 -0
- app/code/community/Pay/Payment/vendor/paynl/sdk/src/Result/Instore/Status.php +39 -0
- app/code/community/Pay/Payment/vendor/paynl/sdk/src/Result/Instore/Terminals.php +34 -0
- app/code/community/Pay/Payment/vendor/paynl/sdk/src/Result/Refund/Add.php +38 -0
- app/code/community/Pay/Payment/vendor/paynl/sdk/src/Result/Result.php +44 -0
- app/code/community/Pay/Payment/vendor/paynl/sdk/src/Result/Transaction/Refund.php +37 -0
- app/code/community/Pay/Payment/vendor/paynl/sdk/src/Result/Transaction/Start.php +54 -0
- app/code/community/Pay/Payment/vendor/paynl/sdk/src/Result/Transaction/Transaction.php +241 -0
- app/code/community/Pay/Payment/vendor/paynl/sdk/src/Result/Voucher/Voucher.php +49 -0
- app/code/community/Pay/Payment/vendor/paynl/sdk/src/Service.php +73 -0
- app/code/community/Pay/Payment/vendor/paynl/sdk/src/Transaction.php +325 -0
- app/code/community/Pay/Payment/vendor/paynl/sdk/src/Validate.php +36 -0
- app/code/community/Pay/Payment/vendor/paynl/sdk/src/Voucher.php +91 -0
- app/code/community/Pay/Payment/vendor/paynl/sdk/tests/ConfigTest.php +60 -0
- app/code/community/Pay/Payment/vendor/paynl/sdk/tests/CurrencyTest.php +47 -0
- app/code/community/Pay/Payment/vendor/paynl/sdk/tests/HelperTest.php +77 -0
- app/code/community/Pay/Payment/vendor/paynl/sdk/tests/PaymentmethodsTest.php +125 -0
- app/code/community/Pay/Payment/vendor/paynl/sdk/tests/RefundTest.php +65 -0
- app/code/community/Pay/Payment/vendor/paynl/sdk/tests/TransactionTest.php +310 -0
- app/code/community/Pay/Payment/vendor/paynl/sdk/tests/ValidateTest.php +33 -0
- app/code/community/Pay/Payment/vendor/paynl/sdk/tests/dummyData/Refund/refund.json +6 -0
- app/code/community/Pay/Payment/vendor/paynl/sdk/tests/dummyData/Refund/refundError.json +8 -0
- app/code/community/Pay/Payment/vendor/paynl/sdk/tests/dummyData/Transaction/Result/approve.json +5 -0
- app/code/community/Pay/Payment/vendor/paynl/sdk/tests/dummyData/Transaction/Result/decline.json +5 -0
- app/code/community/Pay/Payment/vendor/paynl/sdk/tests/dummyData/Transaction/Result/refund.json +6 -0
- app/code/community/Pay/Payment/vendor/paynl/sdk/tests/dummyData/Transaction/Result/refundError.json +8 -0
- app/code/community/Pay/Payment/vendor/paynl/sdk/tests/dummyData/Transaction/Result/transactionPaid.json +133 -0
- app/code/community/Pay/Payment/vendor/paynl/sdk/tests/dummyData/Transaction/Result/transactionVerify.json +133 -0
- app/code/community/Pay/Payment/vendor/paynl/sdk/tests/dummyData/Transaction/startOk.json +16 -0
- app/code/community/Pay/Payment/vendor/paynl/sdk/tests/dummyData/Validate/isPayServerIpNo.json +3 -0
- app/code/community/Pay/Payment/vendor/paynl/sdk/tests/dummyData/Validate/isPayServerIpYes.json +3 -0
- app/code/community/Pay/Payment/vendor/paynl/sdk/tests/dummyData/currencies.json +177 -0
- app/code/community/Pay/Payment/vendor/paynl/sdk/tests/dummyData/getService.json +271 -0
- app/code/community/Pay/Payment/vendor/php-curl-class/php-curl-class/.github/CONTRIBUTING.md +6 -0
- app/code/community/Pay/Payment/vendor/php-curl-class/php-curl-class/.github/ISSUE_TEMPLATE.md +5 -0
- app/code/community/Pay/Payment/vendor/php-curl-class/php-curl-class/.gitignore +4 -0
- app/code/community/Pay/Payment/vendor/php-curl-class/php-curl-class/.travis.yml +20 -0
- app/code/community/Pay/Payment/vendor/php-curl-class/php-curl-class/LICENSE +24 -0
- app/code/community/Pay/Payment/vendor/php-curl-class/php-curl-class/README.md +268 -0
- app/code/community/Pay/Payment/vendor/php-curl-class/php-curl-class/composer.json +27 -0
- app/code/community/Pay/Payment/vendor/php-curl-class/php-curl-class/docs/.gitignore +1 -0
- app/code/community/Pay/Payment/vendor/php-curl-class/php-curl-class/docs/Makefile +192 -0
- app/code/community/Pay/Payment/vendor/php-curl-class/php-curl-class/docs/README.md +4 -0
- app/code/community/Pay/Payment/vendor/php-curl-class/php-curl-class/docs/source/conf.py +291 -0
- app/code/community/Pay/Payment/vendor/php-curl-class/php-curl-class/docs/source/faq.rst +38 -0
- app/code/community/Pay/Payment/vendor/php-curl-class/php-curl-class/docs/source/index.rst +37 -0
- app/code/community/Pay/Payment/vendor/php-curl-class/php-curl-class/docs/source/overview.rst +75 -0
- app/code/community/Pay/Payment/vendor/php-curl-class/php-curl-class/examples/README.md +2 -0
- app/code/community/Pay/Payment/vendor/php-curl-class/php-curl-class/examples/coinbase_account_balance.php +23 -0
- app/code/community/Pay/Payment/vendor/php-curl-class/php-curl-class/examples/coinbase_spot_rate.php +12 -0
- app/code/community/Pay/Payment/vendor/php-curl-class/php-curl-class/examples/deviant_art_rss.php +21 -0
- app/code/community/Pay/Payment/vendor/php-curl-class/php-curl-class/examples/download_file.php +7 -0
- app/code/community/Pay/Payment/vendor/php-curl-class/php-curl-class/examples/download_file_with_callback.php +12 -0
- app/code/community/Pay/Payment/vendor/php-curl-class/php-curl-class/examples/flickr.class.php +118 -0
- app/code/community/Pay/Payment/vendor/php-curl-class/php-curl-class/examples/flickr_photo_search.php +31 -0
- app/code/community/Pay/Payment/vendor/php-curl-class/php-curl-class/examples/flickr_upload_photo.php +43 -0
- app/code/community/Pay/Payment/vendor/php-curl-class/php-curl-class/examples/get.php +12 -0
- app/code/community/Pay/Payment/vendor/php-curl-class/php-curl-class/examples/get_base_url_1.php +12 -0
- app/code/community/Pay/Payment/vendor/php-curl-class/php-curl-class/examples/get_base_url_2.php +13 -0
- app/code/community/Pay/Payment/vendor/php-curl-class/php-curl-class/examples/github_create_gist.php +22 -0
- app/code/community/Pay/Payment/vendor/php-curl-class/php-curl-class/examples/gmail_send_email.php +80 -0
- app/code/community/Pay/Payment/vendor/php-curl-class/php-curl-class/examples/google_maps_geocode_address.php +18 -0
- app/code/community/Pay/Payment/vendor/php-curl-class/php-curl-class/examples/google_plus_profile.php +67 -0
- app/code/community/Pay/Payment/vendor/php-curl-class/php-curl-class/examples/gratipay_send_tip.php +29 -0
- app/code/community/Pay/Payment/vendor/php-curl-class/php-curl-class/examples/instagram_popular_media.php +57 -0
- app/code/community/Pay/Payment/vendor/php-curl-class/php-curl-class/examples/instagram_search_photos.php +18 -0
- app/code/community/Pay/Payment/vendor/php-curl-class/php-curl-class/examples/mailchimp_subscribe_email_address.php +36 -0
- app/code/community/Pay/Payment/vendor/php-curl-class/php-curl-class/examples/multi_curl_before_send.php +23 -0
- app/code/community/Pay/Payment/vendor/php-curl-class/php-curl-class/examples/multi_curl_delete.php +15 -0
- app/code/community/Pay/Payment/vendor/php-curl-class/php-curl-class/examples/multi_curl_download.php +9 -0
- app/code/community/Pay/Payment/vendor/php-curl-class/php-curl-class/examples/multi_curl_download_with_callback.php +16 -0
- app/code/community/Pay/Payment/vendor/php-curl-class/php-curl-class/examples/multi_curl_get.php +18 -0
- app/code/community/Pay/Payment/vendor/php-curl-class/php-curl-class/examples/multi_curl_get_callbacks.php +31 -0
- app/code/community/Pay/Payment/vendor/php-curl-class/php-curl-class/examples/multi_curl_patch.php +17 -0
- app/code/community/Pay/Payment/vendor/php-curl-class/php-curl-class/examples/multi_curl_post.php +19 -0
- app/code/community/Pay/Payment/vendor/php-curl-class/php-curl-class/examples/multi_curl_put.php +19 -0
- app/code/community/Pay/Payment/vendor/php-curl-class/php-curl-class/examples/post.php +19 -0
- app/code/community/Pay/Payment/vendor/php-curl-class/php-curl-class/examples/post_json.php +20 -0
- app/code/community/Pay/Payment/vendor/php-curl-class/php-curl-class/examples/post_redirect_get.php +27 -0
- app/code/community/Pay/Payment/vendor/php-curl-class/php-curl-class/examples/progress.php +15 -0
- app/code/community/Pay/Payment/vendor/php-curl-class/php-curl-class/examples/progress_advanced.php +30 -0
- app/code/community/Pay/Payment/vendor/php-curl-class/php-curl-class/examples/proxy.php +11 -0
- app/code/community/Pay/Payment/vendor/php-curl-class/php-curl-class/examples/put.php +15 -0
- app/code/community/Pay/Payment/vendor/php-curl-class/php-curl-class/examples/reddit_top_pics.php +29 -0
- app/code/community/Pay/Payment/vendor/php-curl-class/php-curl-class/examples/set_cookie.php +9 -0
- app/code/community/Pay/Payment/vendor/php-curl-class/php-curl-class/examples/set_url_1.php +18 -0
- app/code/community/Pay/Payment/vendor/php-curl-class/php-curl-class/examples/set_url_2.php +19 -0
- app/code/community/Pay/Payment/vendor/php-curl-class/php-curl-class/examples/twitter_post_tweet.php +36 -0
- app/code/community/Pay/Payment/vendor/php-curl-class/php-curl-class/examples/twitter_trending_topics.php +50 -0
- app/code/community/Pay/Payment/vendor/php-curl-class/php-curl-class/examples/upload_file.php +23 -0
- app/code/community/Pay/Payment/vendor/php-curl-class/php-curl-class/examples/youtube_list_playlist_videos.php +25 -0
- app/code/community/Pay/Payment/vendor/php-curl-class/php-curl-class/examples/youtube_video_count.php +20 -0
- app/code/community/Pay/Payment/vendor/php-curl-class/php-curl-class/scripts/bump_major_version.php +20 -0
- app/code/community/Pay/Payment/vendor/php-curl-class/php-curl-class/scripts/bump_minor_version.php +20 -0
- app/code/community/Pay/Payment/vendor/php-curl-class/php-curl-class/scripts/bump_patch_version.php +20 -0
- app/code/community/Pay/Payment/vendor/php-curl-class/php-curl-class/scripts/update_readme_methods.sh +44 -0
- app/code/community/Pay/Payment/vendor/php-curl-class/php-curl-class/scripts/v4_migration.php +93 -0
- app/code/community/Pay/Payment/vendor/php-curl-class/php-curl-class/src/Curl/CaseInsensitiveArray.php +234 -0
- app/code/community/Pay/Payment/vendor/php-curl-class/php-curl-class/src/Curl/Curl.php +1217 -0
- app/code/community/Pay/Payment/vendor/php-curl-class/php-curl-class/src/Curl/MultiCurl.php +632 -0
- app/code/community/Pay/Payment/vendor/php-curl-class/php-curl-class/tests/PHPCurlClass/Helper.php +91 -0
- app/code/community/Pay/Payment/vendor/php-curl-class/php-curl-class/tests/PHPCurlClass/PHPCurlClassTest.php +2698 -0
- app/code/community/Pay/Payment/vendor/php-curl-class/php-curl-class/tests/PHPCurlClass/PHPMultiCurlClassTest.php +2265 -0
- app/code/community/Pay/Payment/vendor/php-curl-class/php-curl-class/tests/PHPCurlClass/server.php +310 -0
- app/code/community/Pay/Payment/vendor/php-curl-class/php-curl-class/tests/before_script.sh +64 -0
- app/code/community/Pay/Payment/vendor/php-curl-class/php-curl-class/tests/check_syntax.sh +1 -0
- app/code/community/Pay/Payment/vendor/php-curl-class/php-curl-class/tests/phpunit.xml +7 -0
- app/code/community/Pay/Payment/vendor/php-curl-class/php-curl-class/tests/run.sh +8 -0
- app/code/community/Pay/Payment/vendor/php-curl-class/php-curl-class/tests/script.sh +101 -0
- app/design/adminhtml/base/default/template/pay/payment/form/instore.phtml +20 -0
- app/design/adminhtml/base/default/template/pay/payment/form/paylink.phtml +1 -0
- app/design/adminhtml/base/default/template/pay/payment/mark.phtml +1 -0
- app/design/frontend/base/default/template/pay/payment/form/instore.phtml +20 -0
- app/design/frontend/base/default/template/pay/payment/form/yehhpay.phtml +37 -0
- package.xml +7 -8
app/code/community/Pay/Payment/Block/Form/Instore.php
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Pay_Payment_Block_Form_Instore extends Pay_Payment_Block_Form_Abstract {
|
4 |
+
|
5 |
+
protected $paymentMethodId = Pay_Payment_Model_Paymentmethod_Instore::OPTION_ID;
|
6 |
+
protected $paymentMethodName = 'Instore';
|
7 |
+
|
8 |
+
protected $methodCode = 'pay_payment_instore';
|
9 |
+
|
10 |
+
protected $template = 'pay/payment/form/instore.phtml';
|
11 |
+
|
12 |
+
protected function getTerminals() {
|
13 |
+
$helper = Mage::helper('pay_payment');
|
14 |
+
$option = $helper->getOption(Pay_Payment_Model_Paymentmethod_Instore::OPTION_ID);
|
15 |
+
$banks = $option->getSubs();
|
16 |
+
return $banks;
|
17 |
+
}
|
18 |
+
}
|
app/code/community/Pay/Payment/Block/Form/Yehhpay.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Pay_Payment_Block_Form_Yehhpay extends Pay_Payment_Block_Form_Abstract {
|
4 |
+
|
5 |
+
protected $paymentMethodId = Pay_Payment_Model_Paymentmethod_Yehhpay::OPTION_ID;
|
6 |
+
protected $paymentMethodName = 'Yehhpay';
|
7 |
+
protected $methodCode = 'pay_payment_yehhpay';
|
8 |
+
|
9 |
+
protected $template = 'pay/payment/form/yehhpay.phtml';
|
10 |
+
|
11 |
+
}
|
app/code/community/Pay/Payment/Helper/Api.php
DELETED
@@ -1,115 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Pay_Payment_Helper_Api extends Mage_Core_Helper_Abstract {
|
4 |
-
|
5 |
-
const REQUEST_TYPE_POST = 1;
|
6 |
-
const REQUEST_TYPE_GET = 0;
|
7 |
-
|
8 |
-
protected $_apiUrl = 'https://rest-api.pay.nl';
|
9 |
-
protected $_version = 'v5';
|
10 |
-
protected $_controller = '';
|
11 |
-
protected $_action = '';
|
12 |
-
protected $_serviceId = '';
|
13 |
-
protected $_apiToken = '';
|
14 |
-
protected $_requestType = self::REQUEST_TYPE_POST;
|
15 |
-
protected $_postData = array();
|
16 |
-
|
17 |
-
protected static $_backupApiUrl;
|
18 |
-
|
19 |
-
public static function _setBackupApiUrl($url){
|
20 |
-
self::$_backupApiUrl = $url;
|
21 |
-
}
|
22 |
-
|
23 |
-
public function setServiceId($serviceId) {
|
24 |
-
$this->_serviceId = $serviceId;
|
25 |
-
}
|
26 |
-
|
27 |
-
public function setApiToken($apiToken) {
|
28 |
-
$this->_apiToken = $apiToken;
|
29 |
-
}
|
30 |
-
|
31 |
-
protected function _getPostData() {
|
32 |
-
|
33 |
-
return $this->_postData;
|
34 |
-
}
|
35 |
-
|
36 |
-
protected function _processResult($data) {
|
37 |
-
return $data;
|
38 |
-
}
|
39 |
-
|
40 |
-
private function _getApiUrl() {
|
41 |
-
if ($this->_version == '') {
|
42 |
-
throw Mage::exception('Pay_Payment_Helper_Api', 'version not set', 1);
|
43 |
-
}
|
44 |
-
if ($this->_controller == '') {
|
45 |
-
throw Mage::exception('Pay_Payment_Helper_Api', 'controller not set', 1);
|
46 |
-
}
|
47 |
-
if ($this->_action == '') {
|
48 |
-
throw Mage::exception('Pay_Payment_Helper_Api', 'action not set', 1);
|
49 |
-
}
|
50 |
-
|
51 |
-
$apiUrl = $this->_apiUrl;
|
52 |
-
if(!empty(self::$_backupApiUrl)){
|
53 |
-
$apiUrl = self::$_backupApiUrl;
|
54 |
-
}
|
55 |
-
|
56 |
-
return $apiUrl . '/' . $this->_version . '/' . $this->_controller . '/' . $this->_action . '/json/';
|
57 |
-
}
|
58 |
-
|
59 |
-
public function doRequest() {
|
60 |
-
if ($this->_getPostData()) {
|
61 |
-
|
62 |
-
$url = $this->_getApiUrl();
|
63 |
-
|
64 |
-
$data = $this->_getPostData();
|
65 |
-
|
66 |
-
$strData = http_build_query($data);
|
67 |
-
|
68 |
-
$apiUrl = $url;
|
69 |
-
|
70 |
-
$ch = curl_init();
|
71 |
-
if ($this->_requestType == self::REQUEST_TYPE_GET) {
|
72 |
-
$apiUrl .= '?' . $strData;
|
73 |
-
} else {
|
74 |
-
curl_setopt($ch, CURLOPT_POSTFIELDS, $strData);
|
75 |
-
}
|
76 |
-
|
77 |
-
curl_setopt($ch, CURLOPT_URL, $apiUrl);
|
78 |
-
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
79 |
-
|
80 |
-
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
81 |
-
|
82 |
-
$result = curl_exec($ch);
|
83 |
-
|
84 |
-
if ($result == false) {
|
85 |
-
$error = curl_error($ch);
|
86 |
-
throw Mage::exception('Pay_Payment_Helper_Api', 'Curl Exception: '.$error, 1);
|
87 |
-
}
|
88 |
-
|
89 |
-
curl_close($ch);
|
90 |
-
|
91 |
-
$arrResult = json_decode($result, true);
|
92 |
-
|
93 |
-
if ($this->validateResult($arrResult)) {
|
94 |
-
return $this->_processResult($arrResult);
|
95 |
-
}
|
96 |
-
}
|
97 |
-
}
|
98 |
-
|
99 |
-
protected function validateResult($arrResult) {
|
100 |
-
if ($arrResult['request']['result'] == 1) {
|
101 |
-
return true;
|
102 |
-
} else {
|
103 |
-
if(isset($arrResult['request']['errorId']) && isset($arrResult['request']['errorMessage']) ){
|
104 |
-
throw Mage::exception('Pay_Payment_Helper_Api', $arrResult['request']['errorId'] . ' - ' . $arrResult['request']['errorMessage']);
|
105 |
-
} else {
|
106 |
-
if($arrResult['status'] == 'FALSE' && isset($arrResult['error'])){
|
107 |
-
throw Mage::exception('Pay_Payment_Helper_Api', 'API error: '.$arrResult['error']);
|
108 |
-
} else {
|
109 |
-
throw Mage::exception('Pay_Payment_Helper_Api', 'Unexpected api result: '. print_r($arrResult, true));
|
110 |
-
}
|
111 |
-
}
|
112 |
-
}
|
113 |
-
}
|
114 |
-
|
115 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Pay/Payment/Helper/Api/Capture.php
DELETED
@@ -1,37 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Pay_Payment_Helper_Api_Capture extends Pay_Payment_Helper_Api {
|
4 |
-
|
5 |
-
protected $_version = 'v6';
|
6 |
-
protected $_controller = 'transaction';
|
7 |
-
protected $_action = 'capture';
|
8 |
-
|
9 |
-
|
10 |
-
protected $_amount = '';
|
11 |
-
protected $_description = '';
|
12 |
-
|
13 |
-
public function setTransactionId($transactionId){
|
14 |
-
$this->_postData['transactionId'] = $transactionId;
|
15 |
-
}
|
16 |
-
|
17 |
-
public function setAmount($amount){
|
18 |
-
$this->_amount = $amount;
|
19 |
-
}
|
20 |
-
|
21 |
-
protected function _getPostData() {
|
22 |
-
$data = parent::_getPostData();
|
23 |
-
if ($this->_apiToken == '') {
|
24 |
-
throw Mage::exception('Pay_Payment_Helper_Api', 'apiToken not set', 1);
|
25 |
-
} else {
|
26 |
-
$data['token'] = $this->_apiToken;
|
27 |
-
}
|
28 |
-
if(!isset($this->_postData['transactionId'])){
|
29 |
-
throw Mage::exception('Pay_Payment_Helper_Api', 'transactionId is not set', 1);
|
30 |
-
}
|
31 |
-
if($this->_amount != ''){
|
32 |
-
$data['amount'] = $this->_amount;
|
33 |
-
}
|
34 |
-
|
35 |
-
return $data;
|
36 |
-
}
|
37 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Pay/Payment/Helper/Api/Exception.php
DELETED
@@ -1,4 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
class Pay_Payment_Helper_Api_Exception extends Pay_Payment_Exception{
|
3 |
-
|
4 |
-
}
|
|
|
|
|
|
|
|
app/code/community/Pay/Payment/Helper/Api/Getservice.php
DELETED
@@ -1,65 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Pay_Payment_Helper_Api_Getservice extends Pay_Payment_Helper_Api {
|
4 |
-
|
5 |
-
protected $_version = 'v3';
|
6 |
-
protected $_controller = 'transaction';
|
7 |
-
protected $_action = 'getService';
|
8 |
-
|
9 |
-
protected function _getPostData() {
|
10 |
-
$data = parent::_getPostData();
|
11 |
-
|
12 |
-
// Checken of alle verplichte velden geset zijn
|
13 |
-
if ($this->_apiToken == '') {
|
14 |
-
throw Mage::exception('Pay_Payment_Helper_Api', 'apiToken not set', 1);
|
15 |
-
} else {
|
16 |
-
$data['token'] = $this->_apiToken;
|
17 |
-
}
|
18 |
-
if (empty($this->_serviceId)) {
|
19 |
-
throw Mage::exception('Pay_Payment_Helper_Api', 'apiToken not set', 1);
|
20 |
-
} else {
|
21 |
-
$data['serviceId'] = $this->_serviceId;
|
22 |
-
}
|
23 |
-
return $data;
|
24 |
-
}
|
25 |
-
protected function _processResult($arrReturn) {
|
26 |
-
if (!$arrReturn['request']['result']) {
|
27 |
-
return $arrReturn;
|
28 |
-
}
|
29 |
-
|
30 |
-
$arrReturn['paymentOptions'] = array();
|
31 |
-
|
32 |
-
$countryOptionList = $arrReturn['countryOptionList'];
|
33 |
-
unset($arrReturn['countryOptionList']);
|
34 |
-
if (isset($countryOptionList) && is_array($countryOptionList)) {
|
35 |
-
foreach ($countryOptionList AS $strCountrCode => $arrCountry) {
|
36 |
-
foreach ($arrCountry['paymentOptionList'] AS $arrPaymentProfile) {
|
37 |
-
|
38 |
-
if (!isset($arrReturn['paymentOptions'][$arrPaymentProfile['id']])) {
|
39 |
-
$arrReturn['paymentOptions'][$arrPaymentProfile['id']] = array(
|
40 |
-
'id' => $arrPaymentProfile['id'],
|
41 |
-
'name' => $arrPaymentProfile['name'],
|
42 |
-
'visibleName' => $arrPaymentProfile['name'],
|
43 |
-
'img' => $arrPaymentProfile['img'],
|
44 |
-
'path' => $arrPaymentProfile['path'],
|
45 |
-
'paymentOptionSubList' => array(),
|
46 |
-
'countries' => array(),
|
47 |
-
);
|
48 |
-
}
|
49 |
-
|
50 |
-
if (!empty($arrPaymentProfile['paymentOptionSubList'])) {
|
51 |
-
$arrReturn['paymentOptions'][$arrPaymentProfile['id']]['paymentOptionSubList'] = $arrPaymentProfile['paymentOptionSubList'];
|
52 |
-
}
|
53 |
-
|
54 |
-
|
55 |
-
$arrReturn['paymentOptions'][$arrPaymentProfile['id']]['countries'][$strCountrCode] = array(
|
56 |
-
'id' => $strCountrCode,
|
57 |
-
'name' => $arrCountry['visibleName'],
|
58 |
-
);
|
59 |
-
}
|
60 |
-
}
|
61 |
-
}
|
62 |
-
return $arrReturn;
|
63 |
-
}
|
64 |
-
|
65 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Pay/Payment/Helper/Api/Info.php
DELETED
@@ -1,24 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Pay_Payment_Helper_Api_Info extends Pay_Payment_Helper_Api {
|
4 |
-
|
5 |
-
protected $_version = 'v3';
|
6 |
-
protected $_controller = 'transaction';
|
7 |
-
protected $_action = 'info';
|
8 |
-
|
9 |
-
public function setTransactionId($transactionId){
|
10 |
-
$this->_postData['transactionId'] = $transactionId;
|
11 |
-
}
|
12 |
-
protected function _getPostData() {
|
13 |
-
$data = parent::_getPostData();
|
14 |
-
if ($this->_apiToken == '') {
|
15 |
-
throw Mage::exception('Pay_Payment_Helper_Api', 'apiToken not set', 1);
|
16 |
-
} else {
|
17 |
-
$data['token'] = $this->_apiToken;
|
18 |
-
}
|
19 |
-
if(!isset($this->_postData['transactionId'])){
|
20 |
-
throw Mage::exception('Pay_Payment_Helper_Api', 'transactionId is not set', 1);
|
21 |
-
}
|
22 |
-
return $data;
|
23 |
-
}
|
24 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Pay/Payment/Helper/Api/Ispayserverip.php
DELETED
@@ -1,16 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
class Pay_Payment_Helper_Api_Ispayserverip extends Pay_Payment_Helper_Api {
|
3 |
-
|
4 |
-
protected $_version = 'v1';
|
5 |
-
protected $_controller = 'Validate';
|
6 |
-
protected $_action = 'isPayServerIp';
|
7 |
-
|
8 |
-
public function setIpaddress($ipAddress){
|
9 |
-
$this->_postData['ipAddress'] = $ipAddress;
|
10 |
-
}
|
11 |
-
|
12 |
-
protected function validateResult($result) {
|
13 |
-
return true;
|
14 |
-
}
|
15 |
-
|
16 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Pay/Payment/Helper/Api/Refund.php
DELETED
@@ -1,42 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Pay_Payment_Helper_Api_Refund extends Pay_Payment_Helper_Api {
|
4 |
-
|
5 |
-
protected $_version = 'v5';
|
6 |
-
protected $_controller = 'transaction';
|
7 |
-
protected $_action = 'refund';
|
8 |
-
|
9 |
-
|
10 |
-
protected $_amount = '';
|
11 |
-
protected $_description = '';
|
12 |
-
|
13 |
-
public function setTransactionId($transactionId){
|
14 |
-
$this->_postData['transactionId'] = $transactionId;
|
15 |
-
}
|
16 |
-
|
17 |
-
public function setAmount($amount){
|
18 |
-
$this->_amount = $amount;
|
19 |
-
}
|
20 |
-
public function setDescription($description){
|
21 |
-
$this->_description = $description;
|
22 |
-
}
|
23 |
-
|
24 |
-
protected function _getPostData() {
|
25 |
-
$data = parent::_getPostData();
|
26 |
-
if ($this->_apiToken == '') {
|
27 |
-
throw Mage::exception('Pay_Payment_Helper_Api', 'apiToken not set', 1);
|
28 |
-
} else {
|
29 |
-
$data['token'] = $this->_apiToken;
|
30 |
-
}
|
31 |
-
if(!isset($this->_postData['transactionId'])){
|
32 |
-
throw Mage::exception('Pay_Payment_Helper_Api', 'transactionId is not set', 1);
|
33 |
-
}
|
34 |
-
if($this->_amount != ''){
|
35 |
-
$data['amount'] = $this->_amount;
|
36 |
-
}
|
37 |
-
if($this->_description != ''){
|
38 |
-
$data['description'] = $this->_description;
|
39 |
-
}
|
40 |
-
return $data;
|
41 |
-
}
|
42 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Pay/Payment/Helper/Api/Start.php
DELETED
@@ -1,252 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Pay_Payment_Helper_Api_Start extends Pay_Payment_Helper_Api
|
4 |
-
{
|
5 |
-
|
6 |
-
protected $_version = 'v6';
|
7 |
-
protected $_controller = 'transaction';
|
8 |
-
protected $_action = 'start';
|
9 |
-
private $_amount;
|
10 |
-
private $_currency;
|
11 |
-
private $_paymentOptionId;
|
12 |
-
private $_paymentOptionSubId;
|
13 |
-
private $_finishUrl;
|
14 |
-
private $_costs_for_customer = 0;
|
15 |
-
private $_exchangeUrl;
|
16 |
-
private $_orderId;
|
17 |
-
private $_description;
|
18 |
-
private $_enduser;
|
19 |
-
private $_extra2;
|
20 |
-
private $_extra3;
|
21 |
-
private $_expireDate;
|
22 |
-
private $_products = array();
|
23 |
-
|
24 |
-
/**
|
25 |
-
* @param string $expireDate
|
26 |
-
*/
|
27 |
-
public function setExpireDate($expireDate)
|
28 |
-
{
|
29 |
-
$this->_expireDate = $expireDate;
|
30 |
-
}
|
31 |
-
|
32 |
-
public function addProduct($id, $description, $price, $quantity, $vatPercentage, $type='ARTICLE')
|
33 |
-
{
|
34 |
-
if (!is_numeric($price)) {
|
35 |
-
throw Mage::exception('Pay_Payment_Helper_Api', 'Price moet numeriek zijn', 1);
|
36 |
-
}
|
37 |
-
if (!is_numeric($quantity)) {
|
38 |
-
throw Mage::exception('Pay_Payment_Helper_Api', 'Quantity moet numeriek zijn', 1);
|
39 |
-
}
|
40 |
-
$quantity = $quantity * 1;
|
41 |
-
|
42 |
-
//description mag maar 45 chars lang zijn
|
43 |
-
$description = substr($description, 0, 45);
|
44 |
-
|
45 |
-
$arrProduct = array(
|
46 |
-
'productId' => $id,
|
47 |
-
'productType' => $type,
|
48 |
-
'description' => $description,
|
49 |
-
'price' => $price,
|
50 |
-
'quantity' => $quantity,
|
51 |
-
'vatCode' => $vatPercentage,
|
52 |
-
);
|
53 |
-
$this->_products[] = $arrProduct;
|
54 |
-
}
|
55 |
-
|
56 |
-
public function setEnduser($enduser)
|
57 |
-
{
|
58 |
-
$this->_enduser = $enduser;
|
59 |
-
}
|
60 |
-
|
61 |
-
public function setAmount($amount)
|
62 |
-
{
|
63 |
-
if (is_numeric($amount)) {
|
64 |
-
$this->_amount = $amount;
|
65 |
-
} else {
|
66 |
-
throw Mage::exception('Pay_Payment_Helper_Api', 'Amount is niet numeriek', 1);
|
67 |
-
}
|
68 |
-
}
|
69 |
-
|
70 |
-
public function setCurrency($currency)
|
71 |
-
{
|
72 |
-
$this->_currency = strtoupper($currency);
|
73 |
-
}
|
74 |
-
|
75 |
-
public function setPaymentOptionId($paymentOptionId)
|
76 |
-
{
|
77 |
-
if (is_numeric($paymentOptionId)) {
|
78 |
-
$this->_paymentOptionId = $paymentOptionId;
|
79 |
-
} else {
|
80 |
-
throw Mage::exception('Pay_Payment_Helper_Api', 'PaymentOptionId is niet numeriek', 1);
|
81 |
-
}
|
82 |
-
}
|
83 |
-
|
84 |
-
public function setPaymentOptionSubId($paymentOptionSubId)
|
85 |
-
{
|
86 |
-
if (is_numeric($paymentOptionSubId)) {
|
87 |
-
$this->_paymentOptionSubId = $paymentOptionSubId;
|
88 |
-
} else {
|
89 |
-
throw Mage::exception('Pay_Payment_Helper_Api', 'PaymentOptionSubId is niet numeriek', 1);
|
90 |
-
}
|
91 |
-
}
|
92 |
-
|
93 |
-
public function setFinishUrl($finishUrl)
|
94 |
-
{
|
95 |
-
$this->_finishUrl = $finishUrl;
|
96 |
-
}
|
97 |
-
|
98 |
-
public function setCostsForCustomer($costs_for_customer)
|
99 |
-
{
|
100 |
-
if ($costs_for_customer == 1) {
|
101 |
-
$this->_costs_for_customer = 1;
|
102 |
-
} else {
|
103 |
-
$this->_costs_for_customer = 0;
|
104 |
-
}
|
105 |
-
}
|
106 |
-
|
107 |
-
public function setExchangeUrl($exchangeUrl)
|
108 |
-
{
|
109 |
-
$this->_exchangeUrl = $exchangeUrl;
|
110 |
-
}
|
111 |
-
|
112 |
-
public function setExtra2($extra2)
|
113 |
-
{
|
114 |
-
$this->_extra2 = $extra2;
|
115 |
-
}
|
116 |
-
|
117 |
-
public function setExtra3($extra3)
|
118 |
-
{
|
119 |
-
$this->_extra3 = $extra3;
|
120 |
-
}
|
121 |
-
|
122 |
-
public function setOrderId($orderId)
|
123 |
-
{
|
124 |
-
$this->_orderId = $orderId;
|
125 |
-
}
|
126 |
-
|
127 |
-
public function setDescription($description)
|
128 |
-
{
|
129 |
-
$this->_description = $description;
|
130 |
-
}
|
131 |
-
|
132 |
-
protected function _getPostData()
|
133 |
-
{
|
134 |
-
$data = parent::_getPostData();
|
135 |
-
|
136 |
-
/*
|
137 |
-
* Verplicht
|
138 |
-
*
|
139 |
-
* amount
|
140 |
-
* paymentOptionId
|
141 |
-
* finishUrl
|
142 |
-
* exchangeUrl
|
143 |
-
* orderId
|
144 |
-
*
|
145 |
-
*
|
146 |
-
* Optioneel
|
147 |
-
*
|
148 |
-
* costs
|
149 |
-
* paymentOptionSubId
|
150 |
-
*/
|
151 |
-
|
152 |
-
// Checken of alle verplichte velden geset zijn
|
153 |
-
if ($this->_apiToken == '') {
|
154 |
-
throw Mage::exception('Pay_Payment_Helper_Api', 'apiToken not set', 1);
|
155 |
-
} else {
|
156 |
-
$data['token'] = $this->_apiToken;
|
157 |
-
}
|
158 |
-
if (empty($this->_serviceId)) {
|
159 |
-
throw Mage::exception('Pay_Payment_Helper_Api', 'apiToken not set', 1);
|
160 |
-
} else {
|
161 |
-
$data['serviceId'] = $this->_serviceId;
|
162 |
-
}
|
163 |
-
if (empty($this->_amount)) {
|
164 |
-
throw Mage::exception('Pay_Payment_Helper_Api', 'Amount is niet geset', 1);
|
165 |
-
} else {
|
166 |
-
$data['amount'] = $this->_amount;
|
167 |
-
}
|
168 |
-
if (!empty($this->_expireDate)) {
|
169 |
-
$data['transaction']['expireDate'] = $this->_expireDate;
|
170 |
-
}
|
171 |
-
|
172 |
-
if (!empty($this->_currency)) {
|
173 |
-
$data['transaction']['currency'] = $this->_currency;
|
174 |
-
}
|
175 |
-
if (empty($this->_paymentOptionId)) {
|
176 |
-
throw Mage::exception('Pay_Payment_Helper_Api', 'PaymentOptionId is niet geset', 1);
|
177 |
-
} else {
|
178 |
-
$data['paymentOptionId'] = $this->_paymentOptionId;
|
179 |
-
}
|
180 |
-
if (empty($this->_finishUrl)) {
|
181 |
-
throw Mage::exception('Pay_Payment_Helper_Api', 'FinishUrl is niet geset', 1);
|
182 |
-
} else {
|
183 |
-
$data['finishUrl'] = $this->_finishUrl;
|
184 |
-
}
|
185 |
-
if (empty($this->_exchangeUrl)) {
|
186 |
-
throw Mage::exception('Pay_Payment_Helper_Api', 'exchangeUrl is niet geset', 1);
|
187 |
-
} else {
|
188 |
-
$data['transaction']['orderExchangeUrl'] = $this->_exchangeUrl;
|
189 |
-
}
|
190 |
-
if (empty($this->_orderId)) {
|
191 |
-
throw Mage::exception('Pay_Payment_Helper_Api', 'orderId is niet geset', 1);
|
192 |
-
} else {
|
193 |
-
$data['statsData']['extra1'] = $this->_orderId;
|
194 |
-
}
|
195 |
-
if (empty($this->_description)) {
|
196 |
-
$data['transaction']['description'] = $this->_orderId;
|
197 |
-
} else {
|
198 |
-
$data['transaction']['description'] = $this->_description;
|
199 |
-
}
|
200 |
-
|
201 |
-
if (!empty($this->_extra2)) {
|
202 |
-
$data['statsData']['extra2'] = $this->_extra2;
|
203 |
-
}
|
204 |
-
if (!empty($this->_extra3)) {
|
205 |
-
$data['statsData']['extra3'] = $this->_extra3;
|
206 |
-
}
|
207 |
-
|
208 |
-
if ($this->_costs_for_customer == 1) {
|
209 |
-
$data['transaction']['costs'] = 1;
|
210 |
-
}
|
211 |
-
|
212 |
-
if (!empty($this->_paymentOptionSubId)) {
|
213 |
-
$data['paymentOptionSubId'] = $this->_paymentOptionSubId;
|
214 |
-
}
|
215 |
-
|
216 |
-
//ip en browserdata setten
|
217 |
-
$data['ipAddress'] = Pay_Payment_Helper_Data::getIp();
|
218 |
-
$data['browserData'] = array(
|
219 |
-
'browser_name_regex' => '^mozilla/5\.0 (windows; .; windows nt 5\.1; .*rv:.*) gecko/.* firefox/0\.9.*$',
|
220 |
-
'browser_name_pattern' => 'Mozilla/5.0 (Windows; ?; Windows NT 5.1; *rv:*) Gecko/* Firefox/0.9*',
|
221 |
-
'parent' => 'Firefox 0.9',
|
222 |
-
'platform' => 'WinXP',
|
223 |
-
'browser' => 'Firefox',
|
224 |
-
'version' => 0.9,
|
225 |
-
'majorver' => 0,
|
226 |
-
'minorver' => 9,
|
227 |
-
'cssversion' => 2,
|
228 |
-
'frames' => 1,
|
229 |
-
'iframes' => 1,
|
230 |
-
'tables' => 1,
|
231 |
-
'cookies' => 1,
|
232 |
-
);
|
233 |
-
if (!empty($this->_products)) {
|
234 |
-
$data['saleData']['invoiceDate'] = date('d-m-Y');
|
235 |
-
$data['saleData']['deliveryDate'] = date('d-m-Y', strtotime('+1 day'));
|
236 |
-
$data['saleData']['orderData'] = $this->_products;
|
237 |
-
}
|
238 |
-
$data['enduser'] = array();
|
239 |
-
if (!empty($this->_enduser)) {
|
240 |
-
$data['enduser'] = $this->_enduser;
|
241 |
-
}
|
242 |
-
|
243 |
-
|
244 |
-
//taal instellen
|
245 |
-
|
246 |
-
$data['enduser']['language'] = Pay_Payment_Helper_Data::getLanguage();
|
247 |
-
|
248 |
-
|
249 |
-
return $data;
|
250 |
-
}
|
251 |
-
|
252 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Pay/Payment/Helper/Api/Void.php
DELETED
@@ -1,27 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Pay_Payment_Helper_Api_Void extends Pay_Payment_Helper_Api {
|
4 |
-
|
5 |
-
protected $_version = 'v1';
|
6 |
-
protected $_controller = 'Klarna';
|
7 |
-
protected $_action = 'cancelAuthorization';
|
8 |
-
|
9 |
-
|
10 |
-
public function setTransactionId($transactionId){
|
11 |
-
$this->_postData['orderId'] = $transactionId;
|
12 |
-
}
|
13 |
-
|
14 |
-
protected function _getPostData() {
|
15 |
-
$data = parent::_getPostData();
|
16 |
-
if ($this->_apiToken == '') {
|
17 |
-
throw Mage::exception('Pay_Payment_Helper_Api', 'apiToken not set', 1);
|
18 |
-
} else {
|
19 |
-
$data['token'] = $this->_apiToken;
|
20 |
-
}
|
21 |
-
if(!isset($this->_postData['orderId'])){
|
22 |
-
throw Mage::exception('Pay_Payment_Helper_Api', 'transactionId is not set', 1);
|
23 |
-
}
|
24 |
-
|
25 |
-
return $data;
|
26 |
-
}
|
27 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Pay/Payment/Helper/Data.php
CHANGED
@@ -1,17 +1,191 @@
|
|
1 |
<?php
|
2 |
|
|
|
3 |
class Pay_Payment_Helper_Data extends Mage_Core_Helper_Abstract
|
4 |
{
|
5 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6 |
public function isPayIp($ipAddress)
|
7 |
{
|
8 |
-
|
9 |
-
* @var Pay_Payment_Helper_Api_Ispayserverip $helperApi
|
10 |
-
*/
|
11 |
-
$helperApi = Mage::helper('pay_payment/api_ispayserverip');
|
12 |
-
$helperApi->setIpaddress($ipAddress);
|
13 |
-
$result = $helperApi->doRequest();
|
14 |
-
return $result['result'] == 1;
|
15 |
}
|
16 |
|
17 |
public function isOptionAvailable($option_id, $store = null)
|
@@ -20,6 +194,44 @@ class Pay_Payment_Helper_Data extends Mage_Core_Helper_Abstract
|
|
20 |
return !is_null($option->getInternalId());
|
21 |
}
|
22 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
23 |
public function getTransaction($transactionId)
|
24 |
{
|
25 |
$transaction = Mage::getModel('pay_payment/transaction')
|
@@ -28,7 +240,16 @@ class Pay_Payment_Helper_Data extends Mage_Core_Helper_Abstract
|
|
28 |
->getFirstItem();
|
29 |
return $transaction;
|
30 |
}
|
31 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
32 |
/** @var Pay_Payment_Model_Mysql4_Transaction_Collection $transaction */
|
33 |
$transaction = Mage::getModel('pay_payment/transaction')
|
34 |
->getCollection()
|
@@ -44,58 +265,60 @@ class Pay_Payment_Helper_Data extends Mage_Core_Helper_Abstract
|
|
44 |
$store = Mage::app()->getStore();
|
45 |
}
|
46 |
$serviceId = $store->getConfig('pay_payment/general/serviceid');
|
47 |
-
//$serviceId = Mage::getStoreConfig('pay_payment/general/serviceid', $store);
|
48 |
|
49 |
$options = Mage::getModel('pay_payment/option')->getCollection()
|
50 |
->addFieldToFilter('service_id', $serviceId);
|
51 |
return $options;
|
52 |
}
|
53 |
|
54 |
-
public function
|
55 |
{
|
56 |
if ($store == null) {
|
57 |
$store = Mage::app()->getStore();
|
58 |
}
|
59 |
-
$serviceId = $store->getConfig('pay_payment/general/serviceid');
|
60 |
-
//$serviceId = Mage::getStoreConfig('pay_payment/general/serviceid', $store);
|
61 |
|
62 |
-
$
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
}
|
68 |
|
69 |
-
private function
|
70 |
-
{
|
71 |
if ($store == null) {
|
72 |
$store = Mage::app()->getStore();
|
73 |
}
|
74 |
-
$serviceId = $store->getConfig('pay_payment/general/serviceid');
|
75 |
-
//$serviceId = Mage::getStoreConfig('pay_payment/general/serviceid', $store);
|
76 |
|
77 |
-
$
|
78 |
-
$paymentOptions = $data['paymentOptions'];
|
79 |
|
80 |
-
$
|
81 |
|
82 |
-
$
|
|
|
83 |
|
84 |
-
|
85 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
86 |
|
87 |
/**
|
88 |
* @var Pay_Payment_Model_Option $objOption
|
89 |
*/
|
90 |
$objOption = Mage::getModel('pay_payment/option')->getCollection()
|
91 |
->addFieldToFilter('service_id', $serviceId)
|
92 |
-
->addFieldToFilter('option_id', $
|
93 |
->getFirstItem();
|
94 |
|
95 |
$optionData = array(
|
96 |
-
'option_id' => (string)
|
97 |
'service_id' => $serviceId,
|
98 |
-
'name' => (string)
|
99 |
'image' => $image,
|
100 |
'update_date' => time(),
|
101 |
);
|
@@ -107,15 +330,30 @@ class Pay_Payment_Helper_Data extends Mage_Core_Helper_Abstract
|
|
107 |
|
108 |
$arrUsedOptionSubIds = array();
|
109 |
|
110 |
-
if
|
111 |
-
|
112 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
113 |
$optionSubData = array(
|
114 |
'option_sub_id' => $optionSub['id'],
|
115 |
'option_internal_id' => $objOption->getInternalId(),
|
116 |
-
'name' => $optionSub['
|
117 |
-
'image' =>
|
118 |
-
'active' =>
|
119 |
);
|
120 |
|
121 |
$objOptionSub = Mage::getModel('pay_payment/optionsub')->getCollection()
|
@@ -140,7 +378,7 @@ class Pay_Payment_Helper_Data extends Mage_Core_Helper_Abstract
|
|
140 |
->addFieldToFilter('option_internal_id',
|
141 |
$objOption->getInternalId())
|
142 |
->addFieldToFilter('internal_id',
|
143 |
-
|
144 |
|
145 |
foreach ($arrSubsToDelete as $subToDelete) {
|
146 |
$subToDelete->delete();
|
@@ -155,36 +393,9 @@ class Pay_Payment_Helper_Data extends Mage_Core_Helper_Abstract
|
|
155 |
}
|
156 |
}
|
157 |
|
158 |
-
public function loadOptions($store = null)
|
159 |
-
{
|
160 |
-
if ($store == null) {
|
161 |
-
$store = Mage::app()->getStore();
|
162 |
-
}
|
163 |
-
$serviceId = $store->getConfig('pay_payment/general/serviceid');
|
164 |
-
//$serviceId = Mage::getStoreConfig('pay_payment/general/serviceid', $store);
|
165 |
-
$apiToken = $store->getConfig('pay_payment/general/apitoken');
|
166 |
-
//$apiToken = Mage::getStoreConfig('pay_payment/general/apitoken', $store);
|
167 |
-
|
168 |
-
$useBackupApi = Mage::getStoreConfig('pay_payment/general/use_backup_api', $store);
|
169 |
-
$backupApiUrl = Mage::getStoreConfig('pay_payment/general/backup_api_url', $store);
|
170 |
-
if($useBackupApi == 1){
|
171 |
-
Pay_Payment_Helper_Api::_setBackupApiUrl($backupApiUrl);
|
172 |
-
}
|
173 |
-
|
174 |
-
$api = Mage::helper('pay_payment/api_getservice');
|
175 |
-
|
176 |
-
/* @var $api Pay_Payment_Helper_Api_GetService */
|
177 |
-
$api->setApiToken($apiToken);
|
178 |
-
$api->setServiceId($serviceId);
|
179 |
-
|
180 |
-
$data = $api->doRequest();
|
181 |
-
|
182 |
-
$this->_saveOptions($data, $store);
|
183 |
-
}
|
184 |
-
|
185 |
public function getPaymentChargeTaxClass($code)
|
186 |
{
|
187 |
-
$taxClass = Mage::getStoreConfig('payment/'.strval($code).'/charge_tax_class');
|
188 |
return $taxClass;
|
189 |
}
|
190 |
|
@@ -199,12 +410,12 @@ class Pay_Payment_Helper_Data extends Mage_Core_Helper_Abstract
|
|
199 |
if (is_null($quote)) {
|
200 |
$quote = Mage::getSingleton('checkout/session')->getQuote();
|
201 |
}
|
202 |
-
$amount
|
203 |
$address = $quote->isVirtual() ? $quote->getBillingAddress() : $quote->getShippingAddress();
|
204 |
|
205 |
|
206 |
-
$chargeType
|
207 |
-
$chargeValue = Mage::getStoreConfig('payment/'.strval($code).'/charge_value');
|
208 |
|
209 |
if ($chargeType == "percentage") {
|
210 |
//totaal moet berekend worden
|
@@ -213,165 +424,11 @@ class Pay_Payment_Helper_Data extends Mage_Core_Helper_Abstract
|
|
213 |
$discount = $address->getDiscountAmount();
|
214 |
|
215 |
$grandTotal = $subTotal + $shipping + $discount;
|
216 |
-
$amount
|
217 |
} else {
|
218 |
$amount = floatval($chargeValue);
|
219 |
}
|
220 |
-
// }
|
221 |
-
////echo $amount;
|
222 |
-
//return Mage::helper('core')->formatPrice($amount);
|
223 |
-
return $amount;
|
224 |
-
}
|
225 |
-
|
226 |
-
public static function getLanguage()
|
227 |
-
{
|
228 |
-
$store = Mage::app()->getStore();
|
229 |
-
|
230 |
-
$language = $store->getConfig('pay_payment/general/user_language');
|
231 |
-
// $language = Mage::getStoreConfig('pay_payment/general/user_language', $store);
|
232 |
-
|
233 |
-
if ($language == 'browser' || empty($language)) {
|
234 |
-
return self::getDefaultLanguage();
|
235 |
-
} else {
|
236 |
-
return $language;
|
237 |
-
}
|
238 |
-
}
|
239 |
-
|
240 |
-
protected static function getDefaultLanguage()
|
241 |
-
{
|
242 |
-
|
243 |
-
if (isset($_SERVER["HTTP_ACCEPT_LANGUAGE"]))
|
244 |
-
return self::parseDefaultLanguage($_SERVER["HTTP_ACCEPT_LANGUAGE"]);
|
245 |
-
else return self::parseDefaultLanguage(NULL);
|
246 |
-
}
|
247 |
-
|
248 |
-
private static function parseDefaultLanguage($http_accept, $deflang = "en")
|
249 |
-
{
|
250 |
-
if (isset($http_accept) && strlen($http_accept) > 1) {
|
251 |
-
# Split possible languages into array
|
252 |
-
$x = explode(",", $http_accept);
|
253 |
-
foreach ($x as $val) {
|
254 |
-
#check for q-value and create associative array. No q-value means 1 by rule
|
255 |
-
if (preg_match("/(.*);q=([0-1]{0,1}.[0-9]{0,4})/i", $val,
|
256 |
-
$matches)) {
|
257 |
-
$lang[$matches[1]] = (float) $matches[2].'';
|
258 |
-
} else {
|
259 |
-
$lang[$val] = 1.0;
|
260 |
-
}
|
261 |
-
}
|
262 |
-
|
263 |
-
$languages = new Pay_Payment_Model_Source_Language();
|
264 |
-
|
265 |
-
$arrLanguages = $languages->toOptionArray();
|
266 |
-
$arrAvailableLanguages = array();
|
267 |
-
foreach ($arrLanguages as $language) {
|
268 |
-
$arrAvailableLanguages[] = $language['value'];
|
269 |
-
}
|
270 |
-
|
271 |
-
//laatste er af halen
|
272 |
-
array_pop($arrAvailableLanguages);
|
273 |
-
|
274 |
-
#return default language (highest q-value)
|
275 |
-
$qval = 0.0;
|
276 |
-
foreach ($lang as $key => $value) {
|
277 |
-
$languagecode = strtolower(substr($key, 0, 2));
|
278 |
-
|
279 |
-
if (in_array($languagecode, $arrAvailableLanguages)) {
|
280 |
-
if ($value > $qval) {
|
281 |
-
$qval = (float) $value;
|
282 |
-
$deflang = $key;
|
283 |
-
}
|
284 |
-
}
|
285 |
-
}
|
286 |
-
}
|
287 |
-
return strtolower(substr($deflang, 0, 2));
|
288 |
-
}
|
289 |
-
|
290 |
-
public static function splitAddress($strAddress)
|
291 |
-
{
|
292 |
-
$strAddress = trim($strAddress);
|
293 |
-
|
294 |
-
$a = preg_split('/([0-9]+)/', $strAddress, 2,
|
295 |
-
PREG_SPLIT_DELIM_CAPTURE);
|
296 |
-
$strStreetName = trim(array_shift($a));
|
297 |
-
$strStreetNumber = trim(implode('', $a));
|
298 |
-
|
299 |
-
if (empty($strStreetName)) { // American address notation
|
300 |
-
$a = preg_split('/([a-zA-Z]{2,})/', $strAddress, 2,
|
301 |
-
PREG_SPLIT_DELIM_CAPTURE);
|
302 |
-
|
303 |
-
$strStreetNumber = trim(array_shift($a));
|
304 |
-
$strStreetName = implode(' ', $a);
|
305 |
-
}
|
306 |
-
|
307 |
-
return array($strStreetName, $strStreetNumber);
|
308 |
-
}
|
309 |
-
|
310 |
-
public static function getIp()
|
311 |
-
{
|
312 |
-
|
313 |
-
//Just get the headers if we can or else use the SERVER global
|
314 |
-
if (function_exists('apache_request_headers')) {
|
315 |
-
$headers = apache_request_headers();
|
316 |
-
} else {
|
317 |
-
$headers = $_SERVER;
|
318 |
-
}
|
319 |
-
//Get the forwarded IP if it exists
|
320 |
-
if (array_key_exists('X-Forwarded-For', $headers)) {
|
321 |
-
$the_ip = $headers['X-Forwarded-For'];
|
322 |
-
} elseif (array_key_exists('HTTP_X_FORWARDED_FOR', $headers)) {
|
323 |
-
$the_ip = $headers['HTTP_X_FORWARDED_FOR'];
|
324 |
-
} else {
|
325 |
-
$the_ip = $_SERVER['REMOTE_ADDR'];
|
326 |
-
}
|
327 |
-
$arrIp = explode(',', $the_ip);
|
328 |
-
$the_ip = $arrIp[0];
|
329 |
-
|
330 |
-
$the_ip = filter_var(trim($the_ip), FILTER_VALIDATE_IP);
|
331 |
-
|
332 |
-
return $the_ip;
|
333 |
-
}
|
334 |
-
|
335 |
-
public static function nearest($number, $numbers)
|
336 |
-
{
|
337 |
-
$output = FALSE;
|
338 |
-
$number = intval($number);
|
339 |
-
if (is_array($numbers) && count($numbers) >= 1) {
|
340 |
-
$NDat = array();
|
341 |
-
foreach ($numbers as $n) {
|
342 |
-
$NDat[abs($number - $n)] = $n;
|
343 |
-
}
|
344 |
-
ksort($NDat);
|
345 |
-
$NDat = array_values($NDat);
|
346 |
-
$output = $NDat[0];
|
347 |
-
}
|
348 |
-
return $output;
|
349 |
-
}
|
350 |
|
351 |
-
|
352 |
-
{
|
353 |
-
$taxClasses = array(
|
354 |
-
0 => 'N',
|
355 |
-
6 => 'L',
|
356 |
-
21 => 'H'
|
357 |
-
);
|
358 |
-
$nearestTaxRate = self::nearest($taxRate, array_keys($taxClasses));
|
359 |
-
|
360 |
-
return($taxClasses[$nearestTaxRate]);
|
361 |
-
}
|
362 |
-
|
363 |
-
public static function calculateTaxClass($amountInclTax, $taxAmount)
|
364 |
-
{
|
365 |
-
if(!$amountInclTax || !$taxAmount ){
|
366 |
-
return self::getTaxCodeFromRate(0);
|
367 |
-
}
|
368 |
-
$amountExclTax = $amountInclTax - $taxAmount;
|
369 |
-
if($amountExclTax == 0){ // prevent division by zero
|
370 |
-
$taxRate = 0;
|
371 |
-
} else {
|
372 |
-
$taxRate = ($taxAmount / $amountExclTax) * 100;
|
373 |
-
}
|
374 |
-
|
375 |
-
return self::getTaxCodeFromRate($taxRate);
|
376 |
}
|
377 |
}
|
1 |
<?php
|
2 |
|
3 |
+
|
4 |
class Pay_Payment_Helper_Data extends Mage_Core_Helper_Abstract
|
5 |
{
|
6 |
|
7 |
+
public function loginSDK($store = null)
|
8 |
+
{
|
9 |
+
if ($store == null) {
|
10 |
+
$store = Mage::app()->getStore();
|
11 |
+
}
|
12 |
+
|
13 |
+
$serviceId = $store->getConfig('pay_payment/general/serviceid');
|
14 |
+
$apiToken = $store->getConfig('pay_payment/general/apitoken');
|
15 |
+
|
16 |
+
\Paynl\Config::setApiToken($apiToken);
|
17 |
+
\Paynl\Config::setServiceId($serviceId);
|
18 |
+
|
19 |
+
$useBackupApi = Mage::getStoreConfig('pay_payment/general/use_backup_api', $store);
|
20 |
+
$backupApiUrl = Mage::getStoreConfig('pay_payment/general/backup_api_url', $store);
|
21 |
+
if ($useBackupApi == 1) {
|
22 |
+
\Paynl\Config::setApiBase($backupApiUrl);
|
23 |
+
}
|
24 |
+
}
|
25 |
+
|
26 |
+
public static function getLanguage($store = null)
|
27 |
+
{
|
28 |
+
if(is_null($store)){
|
29 |
+
$store = Mage::app()->getStore();
|
30 |
+
}
|
31 |
+
|
32 |
+
$language = $store->getConfig('pay_payment/general/user_language');
|
33 |
+
|
34 |
+
if ($language == 'browser' || empty($language)) {
|
35 |
+
return self::getDefaultLanguage();
|
36 |
+
} else {
|
37 |
+
return $language;
|
38 |
+
}
|
39 |
+
}
|
40 |
+
|
41 |
+
protected static function getDefaultLanguage()
|
42 |
+
{
|
43 |
+
if (isset($_SERVER["HTTP_ACCEPT_LANGUAGE"]))
|
44 |
+
return self::parseDefaultLanguage($_SERVER["HTTP_ACCEPT_LANGUAGE"]);
|
45 |
+
else return self::parseDefaultLanguage(NULL);
|
46 |
+
}
|
47 |
+
|
48 |
+
private static function parseDefaultLanguage($http_accept, $deflang = "en")
|
49 |
+
{
|
50 |
+
if (isset($http_accept) && strlen($http_accept) > 1) {
|
51 |
+
$lang = array();
|
52 |
+
# Split possible languages into array
|
53 |
+
$x = explode(",", $http_accept);
|
54 |
+
foreach ($x as $val) {
|
55 |
+
#check for q-value and create associative array. No q-value means 1 by rule
|
56 |
+
if (preg_match("/(.*);q=([0-1]{0,1}.[0-9]{0,4})/i", $val,
|
57 |
+
$matches)) {
|
58 |
+
$lang[$matches[1]] = (float)$matches[2] . '';
|
59 |
+
} else {
|
60 |
+
$lang[$val] = 1.0;
|
61 |
+
}
|
62 |
+
}
|
63 |
+
|
64 |
+
$languages = new Pay_Payment_Model_Source_Language();
|
65 |
+
|
66 |
+
$arrLanguages = $languages->toOptionArray();
|
67 |
+
$arrAvailableLanguages = array();
|
68 |
+
foreach ($arrLanguages as $language) {
|
69 |
+
$arrAvailableLanguages[] = $language['value'];
|
70 |
+
}
|
71 |
+
|
72 |
+
//laatste er af halen
|
73 |
+
array_pop($arrAvailableLanguages);
|
74 |
+
|
75 |
+
#return default language (highest q-value)
|
76 |
+
$qval = 0.0;
|
77 |
+
foreach ($lang as $key => $value) {
|
78 |
+
$languagecode = strtolower(substr($key, 0, 2));
|
79 |
+
|
80 |
+
if (in_array($languagecode, $arrAvailableLanguages)) {
|
81 |
+
if ($value > $qval) {
|
82 |
+
$qval = (float)$value;
|
83 |
+
$deflang = $key;
|
84 |
+
}
|
85 |
+
}
|
86 |
+
}
|
87 |
+
}
|
88 |
+
return strtolower(substr($deflang, 0, 2));
|
89 |
+
}
|
90 |
+
|
91 |
+
public static function splitAddress($strAddress)
|
92 |
+
{
|
93 |
+
return \Paynl\Helper::splitAddress(trim($strAddress));
|
94 |
+
}
|
95 |
+
|
96 |
+
public static function getIp()
|
97 |
+
{
|
98 |
+
|
99 |
+
//Just get the headers if we can or else use the SERVER global
|
100 |
+
if (function_exists('apache_request_headers')) {
|
101 |
+
$headers = apache_request_headers();
|
102 |
+
} else {
|
103 |
+
$headers = $_SERVER;
|
104 |
+
}
|
105 |
+
//Get the forwarded IP if it exists
|
106 |
+
if (array_key_exists('X-Forwarded-For', $headers)) {
|
107 |
+
$the_ip = $headers['X-Forwarded-For'];
|
108 |
+
} elseif (array_key_exists('HTTP_X_FORWARDED_FOR', $headers)) {
|
109 |
+
$the_ip = $headers['HTTP_X_FORWARDED_FOR'];
|
110 |
+
} else {
|
111 |
+
$the_ip = $_SERVER['REMOTE_ADDR'];
|
112 |
+
}
|
113 |
+
$arrIp = explode(',', $the_ip);
|
114 |
+
$the_ip = $arrIp[0];
|
115 |
+
|
116 |
+
$the_ip = filter_var(trim($the_ip), FILTER_VALIDATE_IP);
|
117 |
+
|
118 |
+
return $the_ip;
|
119 |
+
}
|
120 |
+
|
121 |
+
/**
|
122 |
+
* @param $amountInclTax
|
123 |
+
* @param $taxAmount
|
124 |
+
* @return mixed
|
125 |
+
* @deprecated
|
126 |
+
*/
|
127 |
+
public static function calculateTaxClass($amountInclTax, $taxAmount)
|
128 |
+
{
|
129 |
+
if (!$amountInclTax || !$taxAmount) {
|
130 |
+
return self::getTaxCodeFromRate(0);
|
131 |
+
}
|
132 |
+
$amountExclTax = $amountInclTax - $taxAmount;
|
133 |
+
if ($amountExclTax == 0) { // prevent division by zero
|
134 |
+
$taxRate = 0;
|
135 |
+
} else {
|
136 |
+
$taxRate = ($taxAmount / $amountExclTax) * 100;
|
137 |
+
}
|
138 |
+
|
139 |
+
return self::getTaxCodeFromRate($taxRate);
|
140 |
+
}
|
141 |
+
|
142 |
+
/**
|
143 |
+
* @param $taxRate
|
144 |
+
* @return mixed
|
145 |
+
* @deprecated
|
146 |
+
*/
|
147 |
+
public static function getTaxCodeFromRate($taxRate)
|
148 |
+
{
|
149 |
+
$taxClasses = array(
|
150 |
+
0 => 'N',
|
151 |
+
6 => 'L',
|
152 |
+
21 => 'H'
|
153 |
+
);
|
154 |
+
$nearestTaxRate = self::nearest($taxRate, array_keys($taxClasses));
|
155 |
+
|
156 |
+
return ($taxClasses[$nearestTaxRate]);
|
157 |
+
}
|
158 |
+
|
159 |
+
/**
|
160 |
+
* @param $number
|
161 |
+
* @param $numbers
|
162 |
+
* @return bool
|
163 |
+
* @deprecated
|
164 |
+
*/
|
165 |
+
public static function nearest($number, $numbers)
|
166 |
+
{
|
167 |
+
$output = FALSE;
|
168 |
+
$number = intval($number);
|
169 |
+
if (is_array($numbers) && count($numbers) >= 1) {
|
170 |
+
$NDat = array();
|
171 |
+
foreach ($numbers as $n) {
|
172 |
+
$NDat[abs($number - $n)] = $n;
|
173 |
+
}
|
174 |
+
ksort($NDat);
|
175 |
+
$NDat = array_values($NDat);
|
176 |
+
$output = $NDat[0];
|
177 |
+
}
|
178 |
+
return $output;
|
179 |
+
}
|
180 |
+
|
181 |
+
/**
|
182 |
+
* @param $ipAddress
|
183 |
+
* @return array
|
184 |
+
* @deprecated
|
185 |
+
*/
|
186 |
public function isPayIp($ipAddress)
|
187 |
{
|
188 |
+
return \Paynl\Validate::isPayServerIp($ipAddress);
|
|
|
|
|
|
|
|
|
|
|
|
|
189 |
}
|
190 |
|
191 |
public function isOptionAvailable($option_id, $store = null)
|
194 |
return !is_null($option->getInternalId());
|
195 |
}
|
196 |
|
197 |
+
public function getOption($option_id, $store = null)
|
198 |
+
{
|
199 |
+
if ($store == null) {
|
200 |
+
$store = Mage::app()->getStore();
|
201 |
+
}
|
202 |
+
$serviceId = $store->getConfig('pay_payment/general/serviceid');
|
203 |
+
//$serviceId = Mage::getStoreConfig('pay_payment/general/serviceid', $store);
|
204 |
+
|
205 |
+
$option = Mage::getModel('pay_payment/option')->getCollection()
|
206 |
+
->addFieldToFilter('service_id', $serviceId)
|
207 |
+
->addFieldToFilter('option_id', $option_id)
|
208 |
+
->getFirstItem();
|
209 |
+
return $option;
|
210 |
+
}
|
211 |
+
|
212 |
+
public function lockTransaction($transactionId)
|
213 |
+
{
|
214 |
+
$transaction = $this->getTransaction($transactionId);
|
215 |
+
$max_lock = strtotime('+5 min');
|
216 |
+
$current_lock = $transaction->getLockDate();
|
217 |
+
if ($current_lock !== null) {
|
218 |
+
$current_lock = strtotime($current_lock);
|
219 |
+
}
|
220 |
+
if ($current_lock !== null && $current_lock < $max_lock) {
|
221 |
+
$obj_max_lock = new DateTime();
|
222 |
+
$obj_max_lock->setTimestamp($max_lock);
|
223 |
+
|
224 |
+
throw new Pay_Payment_Model_Transaction_LockException('Cannot lock transaction, transaction already locked until: ' . $obj_max_lock->format('H:i:s d-m-Y'));
|
225 |
+
}
|
226 |
+
$transaction->setLockDate(strtotime('now'));
|
227 |
+
$transaction->save();
|
228 |
+
return true;
|
229 |
+
}
|
230 |
+
|
231 |
+
/**
|
232 |
+
* @param $transactionId
|
233 |
+
* @return Pay_Payment_Model_Mysql4_Transaction
|
234 |
+
*/
|
235 |
public function getTransaction($transactionId)
|
236 |
{
|
237 |
$transaction = Mage::getModel('pay_payment/transaction')
|
240 |
->getFirstItem();
|
241 |
return $transaction;
|
242 |
}
|
243 |
+
|
244 |
+
public function removeLock($transactionId)
|
245 |
+
{
|
246 |
+
$transaction = $this->getTransaction($transactionId);
|
247 |
+
$transaction->setLockDate(null);
|
248 |
+
$transaction->save();
|
249 |
+
}
|
250 |
+
|
251 |
+
public function isOrderPaid($orderId)
|
252 |
+
{
|
253 |
/** @var Pay_Payment_Model_Mysql4_Transaction_Collection $transaction */
|
254 |
$transaction = Mage::getModel('pay_payment/transaction')
|
255 |
->getCollection()
|
265 |
$store = Mage::app()->getStore();
|
266 |
}
|
267 |
$serviceId = $store->getConfig('pay_payment/general/serviceid');
|
|
|
268 |
|
269 |
$options = Mage::getModel('pay_payment/option')->getCollection()
|
270 |
->addFieldToFilter('service_id', $serviceId);
|
271 |
return $options;
|
272 |
}
|
273 |
|
274 |
+
public function loadOptions($store = null)
|
275 |
{
|
276 |
if ($store == null) {
|
277 |
$store = Mage::app()->getStore();
|
278 |
}
|
|
|
|
|
279 |
|
280 |
+
$this->loginSDK($store);
|
281 |
+
|
282 |
+
$paymentMethods = \Paynl\Paymentmethods::getList();
|
283 |
+
|
284 |
+
$this->_saveOptions($paymentMethods, $store);
|
285 |
}
|
286 |
|
287 |
+
private function getTerminals($store = null){
|
|
|
288 |
if ($store == null) {
|
289 |
$store = Mage::app()->getStore();
|
290 |
}
|
|
|
|
|
291 |
|
292 |
+
$this->loginSDK($store);
|
|
|
293 |
|
294 |
+
$terminals = \Paynl\Instore::getAllTerminals();
|
295 |
|
296 |
+
return $terminals->getList();
|
297 |
+
}
|
298 |
|
299 |
+
private function _saveOptions($paymentMethods, $store = null)
|
300 |
+
{
|
301 |
+
if ($store == null) {
|
302 |
+
$store = Mage::app()->getStore();
|
303 |
+
}
|
304 |
+
$serviceId = $store->getConfig('pay_payment/general/serviceid');
|
305 |
+
|
306 |
+
$arrUsedOptionIds = array();
|
307 |
+
foreach ($paymentMethods as $paymentMethod) {
|
308 |
+
$image = 'https://www.pay.nl/images/payment_profiles/20x20/' . $paymentMethod['id'] . '.png';
|
309 |
|
310 |
/**
|
311 |
* @var Pay_Payment_Model_Option $objOption
|
312 |
*/
|
313 |
$objOption = Mage::getModel('pay_payment/option')->getCollection()
|
314 |
->addFieldToFilter('service_id', $serviceId)
|
315 |
+
->addFieldToFilter('option_id', $paymentMethod['id'])
|
316 |
->getFirstItem();
|
317 |
|
318 |
$optionData = array(
|
319 |
+
'option_id' => (string)$paymentMethod['id'],
|
320 |
'service_id' => $serviceId,
|
321 |
+
'name' => (string)$paymentMethod['visibleName'],
|
322 |
'image' => $image,
|
323 |
'update_date' => time(),
|
324 |
);
|
330 |
|
331 |
$arrUsedOptionSubIds = array();
|
332 |
|
333 |
+
if($paymentMethod['id'] == Pay_Payment_Model_Paymentmethod_Instore::OPTION_ID){
|
334 |
+
$paymentMethod['banks'] = array();
|
335 |
+
|
336 |
+
$arrTerminals = $this->getTerminals($store);
|
337 |
+
foreach ($arrTerminals as $terminal){
|
338 |
+
$paymentMethod['banks'][] = array(
|
339 |
+
'id' => $terminal['id'],
|
340 |
+
'name' => $terminal['name'],
|
341 |
+
'visibleName' => $terminal['name']
|
342 |
+
);
|
343 |
+
}
|
344 |
+
}
|
345 |
+
if (!empty($paymentMethod['banks']) &&
|
346 |
+
(
|
347 |
+
$paymentMethod['id'] == Pay_Payment_Model_Paymentmethod_Ideal::OPTION_ID ||
|
348 |
+
$paymentMethod['id'] == Pay_Payment_Model_Paymentmethod_Instore::OPTION_ID
|
349 |
+
)) {
|
350 |
+
foreach ($paymentMethod['banks'] as $optionSub) {
|
351 |
$optionSubData = array(
|
352 |
'option_sub_id' => $optionSub['id'],
|
353 |
'option_internal_id' => $objOption->getInternalId(),
|
354 |
+
'name' => $optionSub['visibleName'],
|
355 |
+
'image' => '',
|
356 |
+
'active' => 1
|
357 |
);
|
358 |
|
359 |
$objOptionSub = Mage::getModel('pay_payment/optionsub')->getCollection()
|
378 |
->addFieldToFilter('option_internal_id',
|
379 |
$objOption->getInternalId())
|
380 |
->addFieldToFilter('internal_id',
|
381 |
+
array('nin' => $arrUsedOptionSubIds));
|
382 |
|
383 |
foreach ($arrSubsToDelete as $subToDelete) {
|
384 |
$subToDelete->delete();
|
393 |
}
|
394 |
}
|
395 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
396 |
public function getPaymentChargeTaxClass($code)
|
397 |
{
|
398 |
+
$taxClass = Mage::getStoreConfig('payment/' . strval($code) . '/charge_tax_class');
|
399 |
return $taxClass;
|
400 |
}
|
401 |
|
410 |
if (is_null($quote)) {
|
411 |
$quote = Mage::getSingleton('checkout/session')->getQuote();
|
412 |
}
|
413 |
+
$amount = 0;
|
414 |
$address = $quote->isVirtual() ? $quote->getBillingAddress() : $quote->getShippingAddress();
|
415 |
|
416 |
|
417 |
+
$chargeType = Mage::getStoreConfig('payment/' . strval($code) . '/charge_type');
|
418 |
+
$chargeValue = Mage::getStoreConfig('payment/' . strval($code) . '/charge_value');
|
419 |
|
420 |
if ($chargeType == "percentage") {
|
421 |
//totaal moet berekend worden
|
424 |
$discount = $address->getDiscountAmount();
|
425 |
|
426 |
$grandTotal = $subTotal + $shipping + $discount;
|
427 |
+
$amount = $grandTotal * floatval($chargeValue) / 100;
|
428 |
} else {
|
429 |
$amount = floatval($chargeValue);
|
430 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
431 |
|
432 |
+
return $amount;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
433 |
}
|
434 |
}
|
app/code/community/Pay/Payment/Helper/Order.php
CHANGED
@@ -3,6 +3,16 @@
|
|
3 |
class Pay_Payment_Helper_Order extends Mage_Core_Helper_Abstract
|
4 |
{
|
5 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6 |
/**
|
7 |
* Processes the order by transactionId, the data is collected by calling the pay api
|
8 |
*
|
@@ -16,24 +26,26 @@ class Pay_Payment_Helper_Order extends Mage_Core_Helper_Abstract
|
|
16 |
$store = Mage::app()->getStore();
|
17 |
}
|
18 |
|
19 |
-
$
|
20 |
|
|
|
|
|
21 |
$status = Pay_Payment_Model_Transaction::STATE_PENDING;
|
22 |
|
23 |
//status bepalen
|
24 |
-
if ($
|
25 |
$status = Pay_Payment_Model_Transaction::STATE_SUCCESS;
|
26 |
} elseif ($transactionInfo['paymentDetails']['state'] == 95) {
|
27 |
$status = Pay_Payment_Model_Transaction::STATE_AUTHORIZED;
|
28 |
-
} elseif ($
|
29 |
$status = Pay_Payment_Model_Transaction::STATE_CANCELED;
|
30 |
} else {
|
31 |
$status = Pay_Payment_Model_Transaction::STATE_PENDING;
|
32 |
//we gaan geen update doen
|
33 |
return;
|
34 |
}
|
35 |
-
$paidAmount = $
|
36 |
-
$endUserId = $
|
37 |
|
38 |
// alle data is opgehaald status updaten
|
39 |
$this->updateState($transactionId, $status, $paidAmount, $endUserId, $store);
|
@@ -41,40 +53,8 @@ class Pay_Payment_Helper_Order extends Mage_Core_Helper_Abstract
|
|
41 |
return $status;
|
42 |
}
|
43 |
|
44 |
-
public function getTransactionInfo($transactionId, $store = null)
|
45 |
-
{
|
46 |
-
if ($store == null) {
|
47 |
-
$store = Mage::app()->getStore();
|
48 |
-
}
|
49 |
-
|
50 |
-
$helperApi = Mage::helper('pay_payment/api_info');
|
51 |
-
/* @var $helperApi Pay_Payment_Helper_Api_Info */
|
52 |
-
|
53 |
-
|
54 |
-
$apiToken = $store->getConfig('pay_payment/general/apitoken');
|
55 |
-
|
56 |
-
|
57 |
-
$useBackupApi = Mage::getStoreConfig('pay_payment/general/use_backup_api', $store);
|
58 |
-
$backupApiUrl = Mage::getStoreConfig('pay_payment/general/backup_api_url', $store);
|
59 |
-
if ($useBackupApi == 1) {
|
60 |
-
Pay_Payment_Helper_Api::_setBackupApiUrl($backupApiUrl);
|
61 |
-
}
|
62 |
-
|
63 |
-
$helperApi->setApiToken($apiToken);
|
64 |
-
$helperApi->setTransactionId($transactionId);
|
65 |
-
|
66 |
-
$transactionInfo = $helperApi->doRequest();
|
67 |
-
|
68 |
-
return $transactionInfo;
|
69 |
-
}
|
70 |
-
|
71 |
public function updateState($transactionId, $status, $paidAmount = null, $endUserId = null, $store = null)
|
72 |
{
|
73 |
-
if ($store == null) {
|
74 |
-
$store = Mage::app()->getStore();
|
75 |
-
}
|
76 |
-
|
77 |
-
//$transactionInfo = $this->getTransactionInfo($transactionId, $store);
|
78 |
//transactie ophalen uit pay tabel
|
79 |
/** @var Pay_Payment_Helper_Data $helperData */
|
80 |
$helperData = Mage::helper('pay_payment');
|
@@ -83,6 +63,9 @@ class Pay_Payment_Helper_Order extends Mage_Core_Helper_Abstract
|
|
83 |
$order = $this->getOrderByTransactionId($transactionId);
|
84 |
$payment = $order->getPayment();
|
85 |
|
|
|
|
|
|
|
86 |
|
87 |
if ($transaction->getStatus() == $status || $order->getTotalDue() == 0) {
|
88 |
//status is al verwerkt - geen actie vereist
|
@@ -91,20 +74,18 @@ class Pay_Payment_Helper_Order extends Mage_Core_Helper_Abstract
|
|
91 |
$autoInvoice = $store->getConfig('pay_payment/general/auto_invoice');
|
92 |
$invoiceEmail = $store->getConfig('pay_payment/general/invoice_email');
|
93 |
|
94 |
-
$autoCapture = $store->getConfig('payment/'.$payment->getMethod().'/auto_capture');
|
95 |
-
|
96 |
if ($status == Pay_Payment_Model_Transaction::STATE_SUCCESS) {
|
97 |
// als het order al canceled was, gaan we hem nu uncancelen
|
98 |
if ($order->isCanceled()) {
|
99 |
$this->uncancel($order);
|
100 |
}
|
101 |
|
102 |
-
$orderAmount =
|
103 |
-
$paidAmount =
|
104 |
|
105 |
//controleren of het gehele bedrag betaald is
|
106 |
-
if ($orderAmount
|
107 |
-
$order->addStatusHistoryComment('Bedrag komt niet overeen. Order bedrag: ' .
|
108 |
}
|
109 |
|
110 |
|
@@ -164,7 +145,6 @@ class Pay_Payment_Helper_Order extends Mage_Core_Helper_Abstract
|
|
164 |
|
165 |
// ingestelde status ophalen
|
166 |
$processedStatus = $store->getConfig('payment/' . $payment->getMethod() . '/order_status_success');
|
167 |
-
// $processedStatus = Mage::getStoreConfig('payment/' . $payment->getMethod() . '/order_status_success', $store);
|
168 |
|
169 |
$order->setIsInProcess(true);
|
170 |
|
@@ -214,22 +194,7 @@ class Pay_Payment_Helper_Order extends Mage_Core_Helper_Abstract
|
|
214 |
$order->setState(Mage_Sales_Model_Order::STATE_PROCESSING, 'processing', '', false);
|
215 |
|
216 |
$order->save();
|
217 |
-
// auto capture
|
218 |
-
if ($autoCapture) {
|
219 |
-
$payment->capture();
|
220 |
|
221 |
-
$invoice = $this->_getInvoiceForTransactionId($order, $transactionId);
|
222 |
-
$invoice->setRequestedCaptureCase(Mage_Sales_Model_Order_Invoice::CAPTURE_ONLINE);
|
223 |
-
$invoice->register();
|
224 |
-
$invoice->save();
|
225 |
-
|
226 |
-
if ($invoiceEmail) {
|
227 |
-
$invoice->sendEmail();
|
228 |
-
$invoice->setEmailSent(true);
|
229 |
-
$invoice->save();
|
230 |
-
}
|
231 |
-
}
|
232 |
-
$order->save();
|
233 |
$payment->save();
|
234 |
|
235 |
} elseif ($status == Pay_Payment_Model_Transaction::STATE_CANCELED) {
|
@@ -242,7 +207,10 @@ class Pay_Payment_Helper_Order extends Mage_Core_Helper_Abstract
|
|
242 |
}
|
243 |
|
244 |
// order annuleren
|
245 |
-
|
|
|
|
|
|
|
246 |
$order->cancel();
|
247 |
$order->save();
|
248 |
$sendStatusupdates = $store->getConfig('pay_payment/general/send_statusupdates');
|
@@ -269,8 +237,7 @@ class Pay_Payment_Helper_Order extends Mage_Core_Helper_Abstract
|
|
269 |
public function getOrderByTransactionId($transactionId)
|
270 |
{
|
271 |
//transactie ophalen uit pay tabel
|
272 |
-
$
|
273 |
-
$transaction = $helperData->getTransaction($transactionId);
|
274 |
|
275 |
//order ophalen
|
276 |
$order = Mage::getModel('sales/order');
|
@@ -350,14 +317,16 @@ class Pay_Payment_Helper_Order extends Mage_Core_Helper_Abstract
|
|
350 |
|
351 |
public function getTransactionStatus($transactionId, $store = null)
|
352 |
{
|
353 |
-
$
|
|
|
|
|
354 |
|
355 |
$status = Pay_Payment_Model_Transaction::STATE_PENDING;
|
356 |
|
357 |
//status bepalen
|
358 |
-
if ($
|
359 |
return Pay_Payment_Model_Transaction::STATE_SUCCESS;
|
360 |
-
} elseif ($
|
361 |
return Pay_Payment_Model_Transaction::STATE_CANCELED;
|
362 |
} else {
|
363 |
return Pay_Payment_Model_Transaction::STATE_PENDING;
|
3 |
class Pay_Payment_Helper_Order extends Mage_Core_Helper_Abstract
|
4 |
{
|
5 |
|
6 |
+
/**
|
7 |
+
* @var Pay_Payment_Helper_Data
|
8 |
+
*/
|
9 |
+
private $helperData;
|
10 |
+
|
11 |
+
public function __construct()
|
12 |
+
{
|
13 |
+
$this->helperData = Mage::helper('pay_payment');
|
14 |
+
}
|
15 |
+
|
16 |
/**
|
17 |
* Processes the order by transactionId, the data is collected by calling the pay api
|
18 |
*
|
26 |
$store = Mage::app()->getStore();
|
27 |
}
|
28 |
|
29 |
+
$this->helperData->loginSDK($store);
|
30 |
|
31 |
+
$transaction = \Paynl\Transaction::get($transactionId);
|
32 |
+
$transactionInfo = $transaction->getData();
|
33 |
$status = Pay_Payment_Model_Transaction::STATE_PENDING;
|
34 |
|
35 |
//status bepalen
|
36 |
+
if ($transaction->isPaid()) {
|
37 |
$status = Pay_Payment_Model_Transaction::STATE_SUCCESS;
|
38 |
} elseif ($transactionInfo['paymentDetails']['state'] == 95) {
|
39 |
$status = Pay_Payment_Model_Transaction::STATE_AUTHORIZED;
|
40 |
+
} elseif ($transaction->isCancelled()) {
|
41 |
$status = Pay_Payment_Model_Transaction::STATE_CANCELED;
|
42 |
} else {
|
43 |
$status = Pay_Payment_Model_Transaction::STATE_PENDING;
|
44 |
//we gaan geen update doen
|
45 |
return;
|
46 |
}
|
47 |
+
$paidAmount = $transaction->getPaidAmount();
|
48 |
+
$endUserId = $transaction->getAccountNumber();
|
49 |
|
50 |
// alle data is opgehaald status updaten
|
51 |
$this->updateState($transactionId, $status, $paidAmount, $endUserId, $store);
|
53 |
return $status;
|
54 |
}
|
55 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
56 |
public function updateState($transactionId, $status, $paidAmount = null, $endUserId = null, $store = null)
|
57 |
{
|
|
|
|
|
|
|
|
|
|
|
58 |
//transactie ophalen uit pay tabel
|
59 |
/** @var Pay_Payment_Helper_Data $helperData */
|
60 |
$helperData = Mage::helper('pay_payment');
|
63 |
$order = $this->getOrderByTransactionId($transactionId);
|
64 |
$payment = $order->getPayment();
|
65 |
|
66 |
+
if ($store == null) {
|
67 |
+
$store = $order->getStore();
|
68 |
+
}
|
69 |
|
70 |
if ($transaction->getStatus() == $status || $order->getTotalDue() == 0) {
|
71 |
//status is al verwerkt - geen actie vereist
|
74 |
$autoInvoice = $store->getConfig('pay_payment/general/auto_invoice');
|
75 |
$invoiceEmail = $store->getConfig('pay_payment/general/invoice_email');
|
76 |
|
|
|
|
|
77 |
if ($status == Pay_Payment_Model_Transaction::STATE_SUCCESS) {
|
78 |
// als het order al canceled was, gaan we hem nu uncancelen
|
79 |
if ($order->isCanceled()) {
|
80 |
$this->uncancel($order);
|
81 |
}
|
82 |
|
83 |
+
$orderAmount = $order->getGrandTotal()*1;
|
84 |
+
$paidAmount = $paidAmount*1;
|
85 |
|
86 |
//controleren of het gehele bedrag betaald is
|
87 |
+
if (abs($orderAmount-$paidAmount) > 0.0001) {
|
88 |
+
$order->addStatusHistoryComment('Bedrag komt niet overeen. Order bedrag: ' . $orderAmount . ' Betaald: ' . $paidAmount);
|
89 |
}
|
90 |
|
91 |
|
145 |
|
146 |
// ingestelde status ophalen
|
147 |
$processedStatus = $store->getConfig('payment/' . $payment->getMethod() . '/order_status_success');
|
|
|
148 |
|
149 |
$order->setIsInProcess(true);
|
150 |
|
194 |
$order->setState(Mage_Sales_Model_Order::STATE_PROCESSING, 'processing', '', false);
|
195 |
|
196 |
$order->save();
|
|
|
|
|
|
|
197 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
198 |
$payment->save();
|
199 |
|
200 |
} elseif ($status == Pay_Payment_Model_Transaction::STATE_CANCELED) {
|
207 |
}
|
208 |
|
209 |
// order annuleren
|
210 |
+
// if the order has an authorization, close it so the api doesn't get called
|
211 |
+
if($order->getPayment()->getAuthorizationTransaction()){
|
212 |
+
$order->getPayment()->getAuthorizationTransaction()->close(true);
|
213 |
+
}
|
214 |
$order->cancel();
|
215 |
$order->save();
|
216 |
$sendStatusupdates = $store->getConfig('pay_payment/general/send_statusupdates');
|
237 |
public function getOrderByTransactionId($transactionId)
|
238 |
{
|
239 |
//transactie ophalen uit pay tabel
|
240 |
+
$transaction = $this->helperData->getTransaction($transactionId);
|
|
|
241 |
|
242 |
//order ophalen
|
243 |
$order = Mage::getModel('sales/order');
|
317 |
|
318 |
public function getTransactionStatus($transactionId, $store = null)
|
319 |
{
|
320 |
+
$this->helperData->loginSDK($store);
|
321 |
+
|
322 |
+
$transaction = \Paynl\Transaction::get($transactionId);
|
323 |
|
324 |
$status = Pay_Payment_Model_Transaction::STATE_PENDING;
|
325 |
|
326 |
//status bepalen
|
327 |
+
if ($transaction->isPaid()) {
|
328 |
return Pay_Payment_Model_Transaction::STATE_SUCCESS;
|
329 |
+
} elseif ($transaction->isCanceled()) {
|
330 |
return Pay_Payment_Model_Transaction::STATE_CANCELED;
|
331 |
} else {
|
332 |
return Pay_Payment_Model_Transaction::STATE_PENDING;
|
app/code/community/Pay/Payment/Model/Observer.php
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Created by PhpStorm.
|
5 |
+
* User: andy
|
6 |
+
* Date: 9-3-17
|
7 |
+
* Time: 16:09
|
8 |
+
*/
|
9 |
+
class Pay_Payment_Model_Observer extends Mage_Core_Model_Observer
|
10 |
+
{
|
11 |
+
static $shouldAdd = true;
|
12 |
+
|
13 |
+
public function addAutoloader()
|
14 |
+
{
|
15 |
+
if (!self::$shouldAdd) {
|
16 |
+
return;
|
17 |
+
}
|
18 |
+
require_once(dirname(dirname(__FILE__)).'/vendor/autoload.php');
|
19 |
+
|
20 |
+
self::$shouldAdd = false;
|
21 |
+
}
|
22 |
+
|
23 |
+
}
|
app/code/community/Pay/Payment/Model/Paymentmethod.php
CHANGED
@@ -6,7 +6,7 @@ class Pay_Payment_Model_Paymentmethod extends Mage_Payment_Model_Method_Abstract
|
|
6 |
const OPTION_ID = 0;
|
7 |
|
8 |
protected $_isInitializeNeeded = true;
|
9 |
-
protected $_canUseInternal =
|
10 |
protected $_canUseForMultishipping = false;
|
11 |
protected $_canCapture = true;
|
12 |
protected $_canRefund = true;
|
@@ -16,6 +16,23 @@ class Pay_Payment_Model_Paymentmethod extends Mage_Payment_Model_Method_Abstract
|
|
16 |
|
17 |
protected $_additionalData = array();
|
18 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
19 |
public function isApplicableToQuote($quote, $checksBitMask)
|
20 |
{
|
21 |
$store = $quote->getStore();
|
@@ -60,226 +77,252 @@ class Pay_Payment_Model_Paymentmethod extends Mage_Payment_Model_Method_Abstract
|
|
60 |
$order = $payment->getOrder();
|
61 |
$store = $order->getStore();
|
62 |
|
63 |
-
$
|
64 |
-
$apiToken = Mage::getStoreConfig('pay_payment/general/apitoken', $store);
|
65 |
-
|
66 |
-
$useBackupApi = Mage::getStoreConfig('pay_payment/general/use_backup_api', $store);
|
67 |
-
$backupApiUrl = Mage::getStoreConfig('pay_payment/general/backup_api_url', $store);
|
68 |
-
if ($useBackupApi == 1) {
|
69 |
-
Pay_Payment_Helper_Api::_setBackupApiUrl($backupApiUrl);
|
70 |
-
}
|
71 |
|
72 |
$parentTransactionId = $payment->getParentTransactionId();
|
73 |
|
74 |
-
$
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
$apiRefund->doRequest();
|
84 |
|
85 |
return $this;
|
86 |
}
|
87 |
|
88 |
-
|
89 |
-
|
90 |
-
$session = Mage::getSingleton('checkout/session');
|
91 |
-
|
92 |
-
Mage::log('Starting payment for order: ' . $order->getId(), null, 'paynl.log');
|
93 |
-
|
94 |
-
$payment = $order->getPayment();
|
95 |
-
|
96 |
-
$additionalData = $session->getPaynlPaymentData();
|
97 |
|
98 |
-
|
99 |
-
$
|
|
|
100 |
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
$
|
114 |
}
|
115 |
|
116 |
-
|
117 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
118 |
|
119 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
120 |
|
121 |
-
$
|
122 |
|
123 |
-
$
|
124 |
-
|
125 |
-
$backupApiUrl = Mage::getStoreConfig('pay_payment/general/backup_api_url', Mage::app()->getStore());
|
126 |
-
if ($useBackupApi == 1) {
|
127 |
-
Pay_Payment_Helper_Api::_setBackupApiUrl($backupApiUrl);
|
128 |
-
}
|
129 |
|
130 |
-
|
|
|
131 |
|
132 |
-
|
|
|
|
|
|
|
133 |
|
134 |
-
|
135 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
136 |
|
137 |
-
|
138 |
-
$api->setExpireDate(date('d-m-Y H:i:s', strtotime('+' . $additionalData['valid_days'] . ' days')));
|
139 |
}
|
|
|
140 |
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
152 |
|
153 |
-
|
154 |
-
|
155 |
-
$price = round($price * 100);
|
156 |
-
$api->addProduct($productId, $description, $price, $quantity, $taxClass);
|
157 |
-
}
|
158 |
|
159 |
-
|
|
|
160 |
|
161 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
162 |
|
163 |
-
|
164 |
-
$api->addProduct('discount', 'Korting (' . $order->getDiscountDescription() . ')', round($discountAmount * 100), 1, 'N', 'DISCOUNT');
|
165 |
-
}
|
166 |
|
167 |
-
$shipping = $order->getShippingInclTax();
|
168 |
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
}
|
177 |
|
178 |
-
|
179 |
-
|
180 |
-
$code = $payment->getMethod();
|
181 |
-
$taxClass = $helper->getPaymentChargeTaxClass($code);
|
182 |
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
|
|
|
|
|
|
|
|
|
|
187 |
|
188 |
-
|
|
|
|
|
189 |
|
190 |
-
|
191 |
-
|
192 |
|
193 |
-
|
194 |
-
|
|
|
|
|
|
|
195 |
|
196 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
197 |
|
198 |
-
|
199 |
-
|
200 |
-
}
|
201 |
|
202 |
-
|
203 |
-
|
204 |
-
$billingAddress = $order->getBillingAddress();
|
205 |
|
206 |
-
|
207 |
-
// $arrEnduser['initials'] = substr($shippingAddress->getFirstname(), 0, 1);
|
208 |
-
$arrEnduser['initials'] = $shippingAddress->getFirstname();
|
209 |
-
$arrEnduser['lastName'] = substr($shippingAddress->getLastname(), 0, 30);
|
210 |
|
211 |
-
|
212 |
|
213 |
-
|
214 |
-
$arrAddressFull[] = $shippingAddress->getStreet1();
|
215 |
-
$arrAddressFull[] = $shippingAddress->getStreet2();
|
216 |
-
$arrAddressFull[] = $shippingAddress->getStreet3();
|
217 |
-
$arrAddressFull[] = $shippingAddress->getStreet4();
|
218 |
-
$arrAddressFull = array_unique($arrAddressFull);
|
219 |
-
$addressFull = implode(' ', $arrAddressFull);
|
220 |
|
|
|
|
|
221 |
|
222 |
-
|
223 |
-
|
|
|
|
|
|
|
224 |
|
225 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
226 |
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
$arrEnduser['initials'] = substr($billingAddress->getFirstname(), 0, 1);
|
234 |
-
$arrEnduser['lastName'] = substr($billingAddress->getLastname(), 0, 30);
|
235 |
-
}
|
236 |
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
$arrAddressFull[] = $billingAddress->getStreet4();
|
243 |
-
$arrAddressFull = array_unique($arrAddressFull);
|
244 |
-
$addressFull = implode(' ', $arrAddressFull);
|
245 |
-
|
246 |
-
$addressFull = str_replace("\n", ' ', $addressFull);
|
247 |
-
$addressFull = str_replace("\r", ' ', $addressFull);
|
248 |
-
|
249 |
-
list($address, $housenumber) = $helper->splitAddress($addressFull);
|
250 |
-
|
251 |
-
$arrEnduser['invoiceAddress']['streetName'] = $address;
|
252 |
-
$arrEnduser['invoiceAddress']['streetNumber'] = $housenumber;
|
253 |
-
$arrEnduser['invoiceAddress']['zipCode'] = $billingAddress->getPostcode();
|
254 |
-
$arrEnduser['invoiceAddress']['city'] = $billingAddress->getCity();
|
255 |
-
$arrEnduser['invoiceAddress']['countryCode'] = $billingAddress->getCountry();
|
256 |
-
|
257 |
-
// $arrEnduser['invoiceAddress']['initials'] = substr($billingAddress->getFirstname(), 0, 1);
|
258 |
-
$arrEnduser['invoiceAddress']['initials'] = $billingAddress->getFirstname();
|
259 |
-
$arrEnduser['invoiceAddress']['lastName'] = substr($billingAddress->getLastname(), 0, 30);
|
260 |
-
}
|
261 |
-
$api->setEnduser($arrEnduser);
|
262 |
}
|
263 |
|
264 |
-
$
|
265 |
-
|
266 |
|
267 |
-
|
268 |
-
|
|
|
|
|
269 |
|
270 |
-
$
|
271 |
-
$api->setFinishUrl(Mage::getUrl('pay_payment/order/return'));
|
272 |
|
273 |
-
$
|
274 |
-
$api->setOrderId($order->getIncrementId());
|
275 |
|
276 |
-
if (!empty($optionSubId)) {
|
277 |
-
$api->setPaymentOptionSubId($optionSubId);
|
278 |
-
}
|
279 |
try {
|
280 |
Mage::log('Calling Pay api to start transaction', null, 'paynl.log');
|
281 |
|
282 |
-
$
|
283 |
|
284 |
} catch (Exception $e) {
|
285 |
Mage::log("Creating transaction failed, Exception: " . $e->getMessage(), null, 'paynl.log');
|
@@ -303,7 +346,6 @@ class Pay_Payment_Model_Paymentmethod extends Mage_Payment_Model_Method_Abstract
|
|
303 |
// Add error to cart
|
304 |
Mage::getSingleton('checkout/session')->addError(Mage::helper('pay_payment')->__('Er is een storing bij de door u gekozen betaalmethode of bank. Kiest u alstublieft een andere betaalmethode of probeer het later nogmaals'));
|
305 |
Mage::getSingleton('checkout/session')->addError($e->getMessage());
|
306 |
-
// Mage::getSingleton('checkout/session')->addError(print_r($api->getPostData(),1));
|
307 |
// Redirect via header
|
308 |
|
309 |
return array('url' => Mage::getUrl('checkout/cart'));
|
@@ -311,17 +353,17 @@ class Pay_Payment_Model_Paymentmethod extends Mage_Payment_Model_Method_Abstract
|
|
311 |
|
312 |
$transaction = Mage::getModel('pay_payment/transaction');
|
313 |
|
314 |
-
$transactionId = $
|
315 |
|
316 |
Mage::log('Transaction started, transactionId: ' . $transactionId, null, 'paynl.log');
|
317 |
|
318 |
$transaction->setData(
|
319 |
array(
|
320 |
'transaction_id' => $transactionId,
|
321 |
-
'service_id' =>
|
322 |
-
'option_id' => $
|
323 |
-
'option_sub_id' =>
|
324 |
-
'amount' => round($amount * 100),
|
325 |
'order_id' => $order->getId(),
|
326 |
'status' => Pay_Payment_Model_Transaction::STATE_PENDING,
|
327 |
'created' => time(),
|
@@ -331,18 +373,18 @@ class Pay_Payment_Model_Paymentmethod extends Mage_Payment_Model_Method_Abstract
|
|
331 |
$transaction->save();
|
332 |
|
333 |
//redirecten
|
334 |
-
$url = $
|
335 |
|
336 |
-
$
|
337 |
|
338 |
$order->addStatusHistoryComment(
|
339 |
'Transactie gestart, transactieId: ' . $transactionId . " \nBetaalUrl: " . $url
|
340 |
);
|
341 |
|
342 |
-
|
343 |
$order->save();
|
344 |
|
345 |
-
$sendMail = Mage::getStoreConfig('payment/' . $payment->getMethod() . '/send_mail',
|
|
|
346 |
if ($sendMail == 'start') {
|
347 |
$order->sendNewOrderEmail();
|
348 |
}
|
6 |
const OPTION_ID = 0;
|
7 |
|
8 |
protected $_isInitializeNeeded = true;
|
9 |
+
protected $_canUseInternal = false;
|
10 |
protected $_canUseForMultishipping = false;
|
11 |
protected $_canCapture = true;
|
12 |
protected $_canRefund = true;
|
16 |
|
17 |
protected $_additionalData = array();
|
18 |
|
19 |
+
/**
|
20 |
+
* @var Pay_Payment_Helper_Data
|
21 |
+
*/
|
22 |
+
protected $helperData;
|
23 |
+
/**
|
24 |
+
* @var Pay_Payment_Helper_Order
|
25 |
+
*/
|
26 |
+
protected $helperOrder;
|
27 |
+
|
28 |
+
public function __construct()
|
29 |
+
{
|
30 |
+
$this->helperData = Mage::helper('pay_payment');
|
31 |
+
$this->helperOrder = Mage::helper('pay_payment/order');
|
32 |
+
|
33 |
+
parent::__construct();
|
34 |
+
}
|
35 |
+
|
36 |
public function isApplicableToQuote($quote, $checksBitMask)
|
37 |
{
|
38 |
$store = $quote->getStore();
|
77 |
$order = $payment->getOrder();
|
78 |
$store = $order->getStore();
|
79 |
|
80 |
+
$this->helperData->loginSDK($store);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
81 |
|
82 |
$parentTransactionId = $payment->getParentTransactionId();
|
83 |
|
84 |
+
if($pos = strpos($parentTransactionId, '-')){
|
85 |
+
$parentTransactionId = substr($parentTransactionId, 0, $pos);
|
86 |
+
}
|
87 |
+
try{
|
88 |
+
\Paynl\Transaction::refund($parentTransactionId, $amount);
|
89 |
+
} catch (Exception $e){
|
90 |
+
// exception needs to be thrown this way, otherwise we don't get the message in the admin
|
91 |
+
Mage::throwException($e->getMessage());
|
92 |
+
}
|
|
|
93 |
|
94 |
return $this;
|
95 |
}
|
96 |
|
97 |
+
private function getProducts(Mage_Sales_Model_Order $order){
|
98 |
+
$arrProducts = array();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
99 |
|
100 |
+
$items = $order->getItemsCollection(array(), true);
|
101 |
+
foreach ($items as $item) {
|
102 |
+
/* @var $item Mage_Sales_Model_Order_Item */
|
103 |
|
104 |
+
$price = $item->getPriceInclTax();
|
105 |
+
if($price == 0){
|
106 |
+
continue;
|
107 |
+
}
|
108 |
+
$product = array(
|
109 |
+
'id' => $item->getId(),
|
110 |
+
'name' => $item->getName(),
|
111 |
+
'price' => $item->getPriceInclTax(),
|
112 |
+
'vatPercentage' => $item->getTaxPercent(),
|
113 |
+
'qty' => $item->getQtyOrdered(),
|
114 |
+
'type' => \Paynl\Transaction::PRODUCT_TYPE_ARTICLE
|
115 |
+
);
|
116 |
+
$arrProducts[] = $product;
|
117 |
}
|
118 |
|
119 |
+
$discountAmount = $order->getDiscountAmount();
|
120 |
+
if ($discountAmount < 0) {
|
121 |
+
$discount = array(
|
122 |
+
'id' => 'discount',
|
123 |
+
'name' => 'Korting (' . $order->getDiscountDescription() . ')',
|
124 |
+
'price' => $discountAmount,
|
125 |
+
'vatPercentage' => 0,
|
126 |
+
'qty' => 1,
|
127 |
+
'type' => \Paynl\Transaction::PRODUCT_TYPE_DISCOUNT
|
128 |
+
);
|
129 |
+
|
130 |
+
$arrProducts[] = $discount;
|
131 |
+
}
|
132 |
|
133 |
+
$shipping = $order->getShippingInclTax();
|
134 |
+
if ($shipping > 0) {
|
135 |
+
$shipping = array(
|
136 |
+
'id' => 'shipping',
|
137 |
+
'name' => $order->getShippingDescription(),
|
138 |
+
'price' => $order->getShippingInclTax(),
|
139 |
+
'tax' => $order->getShippingTaxAmount(),
|
140 |
+
'qty' => 1,
|
141 |
+
'type' => \Paynl\Transaction::PRODUCT_TYPE_SHIPPING
|
142 |
+
);
|
143 |
+
|
144 |
+
$arrProducts[] = $shipping;
|
145 |
+
}
|
146 |
|
147 |
+
$extraFee = $order->getPaymentCharge();
|
148 |
|
149 |
+
if ($extraFee != 0) {
|
150 |
+
$payment = $order->getPayment();
|
|
|
|
|
|
|
|
|
151 |
|
152 |
+
$code = $payment->getMethod();
|
153 |
+
$taxClass = $this->helperData->getPaymentChargeTaxClass($code);
|
154 |
|
155 |
+
$taxCalculationModel = Mage::getSingleton('tax/calculation');
|
156 |
+
$request = $taxCalculationModel->getRateRequest($order->getShippingAddress(), $order->getBillingAddress());
|
157 |
+
$request->setStore(Mage::app()->getStore());
|
158 |
+
$vatPercentage = $taxCalculationModel->getRate($request->setProductClassId($taxClass));
|
159 |
|
160 |
+
$fee = array(
|
161 |
+
'id' => 'paymentfee',
|
162 |
+
'name' => Mage::getStoreConfig('pay_payment/general/text_payment_charge', $order->getStore()),
|
163 |
+
'price' => $extraFee,
|
164 |
+
'vatPercentage' => $vatPercentage,
|
165 |
+
'qty' => 1,
|
166 |
+
'type' => \Paynl\Transaction::PRODUCT_TYPE_HANDLING
|
167 |
+
);
|
168 |
|
169 |
+
$arrProducts[] = $fee;
|
|
|
170 |
}
|
171 |
+
return $arrProducts;
|
172 |
|
173 |
+
}
|
174 |
+
private function getBillingAddress(Mage_Sales_Model_Order $order){
|
175 |
+
$objBillingAddress = $order->getBillingAddress();
|
176 |
+
|
177 |
+
$arrAddressFull = array();
|
178 |
+
$arrAddressFull[] = $objBillingAddress->getStreet1();
|
179 |
+
$arrAddressFull[] = $objBillingAddress->getStreet2();
|
180 |
+
$arrAddressFull[] = $objBillingAddress->getStreet3();
|
181 |
+
$arrAddressFull[] = $objBillingAddress->getStreet4();
|
182 |
+
$arrAddressFull = array_unique($arrAddressFull);
|
183 |
+
$addressFull = implode(' ', $arrAddressFull);
|
184 |
+
$addressFull = str_replace("\n", ' ', $addressFull);
|
185 |
+
$addressFull = str_replace("\r", ' ', $addressFull);
|
186 |
+
|
187 |
+
list($address, $housenumber) = \Paynl\Helper::splitAddress($addressFull);
|
188 |
+
|
189 |
+
|
190 |
+
$arrBillingAddress = array(
|
191 |
+
'initials' => $objBillingAddress->getFirstname(),
|
192 |
+
'lastName' => $objBillingAddress->getLastname(),
|
193 |
+
'streetName' => $address,
|
194 |
+
'houseNumber' => $housenumber,
|
195 |
+
'zipCode' => $objBillingAddress->getPostcode(),
|
196 |
+
'city' => $objBillingAddress->getCity(),
|
197 |
+
'country' => $objBillingAddress->getCountry()
|
198 |
+
);
|
199 |
|
200 |
+
return $arrBillingAddress;
|
201 |
+
}
|
|
|
|
|
|
|
202 |
|
203 |
+
private function getShippingAddress(Mage_Sales_Model_Order $order){
|
204 |
+
$objShippingAddress= $order->getShippingAddress();
|
205 |
|
206 |
+
$arrAddressFull = array();
|
207 |
+
$arrAddressFull[] = $objShippingAddress->getStreet1();
|
208 |
+
$arrAddressFull[] = $objShippingAddress->getStreet2();
|
209 |
+
$arrAddressFull[] = $objShippingAddress->getStreet3();
|
210 |
+
$arrAddressFull[] = $objShippingAddress->getStreet4();
|
211 |
+
$arrAddressFull = array_unique($arrAddressFull);
|
212 |
+
$addressFull = implode(' ', $arrAddressFull);
|
213 |
+
$addressFull = str_replace("\n", ' ', $addressFull);
|
214 |
+
$addressFull = str_replace("\r", ' ', $addressFull);
|
215 |
|
216 |
+
list($address, $housenumber) = \Paynl\Helper::splitAddress($addressFull);
|
|
|
|
|
217 |
|
|
|
218 |
|
219 |
+
$arrShippingAddress = array(
|
220 |
+
'streetName' => $address,
|
221 |
+
'houseNumber' => $housenumber,
|
222 |
+
'zipCode' => $objShippingAddress->getPostcode(),
|
223 |
+
'city' => $objShippingAddress->getCity(),
|
224 |
+
'country' => $objShippingAddress->getCountry()
|
225 |
+
);
|
|
|
226 |
|
227 |
+
return $arrShippingAddress;
|
228 |
+
}
|
|
|
|
|
229 |
|
230 |
+
private function getEnduserData(Mage_Sales_Model_Order $order){
|
231 |
+
$session = Mage::getSingleton('checkout/session');
|
232 |
+
$additionalData = $session->getPaynlPaymentData();
|
233 |
+
if (
|
234 |
+
isset($additionalData['birthday_day']) &&
|
235 |
+
isset($additionalData['birthday_month']) &&
|
236 |
+
isset($additionalData['birthday_year'])
|
237 |
+
) {
|
238 |
+
$birthDate = $additionalData['birthday_year'] . '-' . $additionalData['birthday_month'] . '-' . $additionalData['birthday_day'];
|
239 |
|
240 |
+
$order->setCustomerDob($birthDate);
|
241 |
+
$order->save();
|
242 |
+
}
|
243 |
|
244 |
+
list($birthDate) = explode(' ', $order->getCustomerDob());
|
245 |
+
list($dobYear, $dobMonth, $dobDay) = explode('-', $birthDate);
|
246 |
|
247 |
+
$birthDate = null;
|
248 |
+
if($dobDay && $dobMonth && $dobYear){
|
249 |
+
$birthDate = $dobDay . '-' . $dobMonth . '-' . $dobYear;
|
250 |
+
}
|
251 |
+
$iban = $additionalData['iban'] ? $additionalData['iban'] : null;
|
252 |
|
253 |
+
$enduser = array(
|
254 |
+
'initials' => $order->getShippingAddress()->getFirstname(),
|
255 |
+
'lastName' => $order->getShippingAddress()->getLastname(),
|
256 |
+
'birthDate' => $birthDate,
|
257 |
+
'iban' => $iban,
|
258 |
+
'phoneNumber' => $order->getShippingAddress()->getTelephone(),
|
259 |
+
'emailAddress' => $order->getShippingAddress()->getEmail()
|
260 |
+
);
|
261 |
|
262 |
+
return $enduser;
|
263 |
+
}
|
|
|
264 |
|
265 |
+
private function getTransactionStartData(Mage_Sales_Model_Order $order){
|
266 |
+
$store = $order->getStore();
|
|
|
267 |
|
268 |
+
$session = Mage::getSingleton('checkout/session');
|
|
|
|
|
|
|
269 |
|
270 |
+
$sendOrderData = $store->getConfig('pay_payment/general/send_order_data');
|
271 |
|
272 |
+
$additionalData = $session->getPaynlPaymentData();
|
|
|
|
|
|
|
|
|
|
|
|
|
273 |
|
274 |
+
$optionId = $this->_paymentOptionId;
|
275 |
+
$optionSubId = $additionalData['option_sub'] ? $additionalData['option_sub'] : null;
|
276 |
|
277 |
+
$ipAddress= $order->getRemoteIp();
|
278 |
+
if(empty($ipAddress)) $ipAddress = \Paynl\Helper::getIp();
|
279 |
+
if(strpos($ipAddress, ',') !== false){
|
280 |
+
$ipAddress = substr($ipAddress,0,strpos($ipAddress, ','));
|
281 |
+
}
|
282 |
|
283 |
+
$arrStartData = array(
|
284 |
+
'amount' => $order->getGrandTotal(),
|
285 |
+
'returnUrl' => Mage::getUrl('pay_payment/order/return', array('_store' => $store->getCode())),
|
286 |
+
'exchangeUrl' => Mage::getUrl('pay_payment/order/exchange', array('_store' => $store->getCode())),
|
287 |
+
'paymentMethod' => $optionId,
|
288 |
+
'description' => $order->getIncrementId(),
|
289 |
+
'currency' => $order->getOrderCurrencyCode(),
|
290 |
+
'extra1' => $order->getIncrementId(),
|
291 |
+
'extra2' => $order->getCustomerEmail(),
|
292 |
+
'ipAddress' => $ipAddress,
|
293 |
+
'language' => $this->helperData->getLanguage($order->getStore())
|
294 |
+
);
|
295 |
|
296 |
+
if(!is_null($optionSubId)){
|
297 |
+
$arrStartData['bank'] = $optionSubId;
|
298 |
+
}
|
299 |
+
if (isset($additionalData['valid_days'])) {
|
300 |
+
$arrStartData['expireDate'] = date('d-m-Y H:i:s', strtotime('+' . $additionalData['valid_days'] . ' days'));
|
301 |
+
}
|
|
|
|
|
|
|
302 |
|
303 |
+
if($sendOrderData){
|
304 |
+
$arrStartData['enduser'] = $this->getEnduserData($order);
|
305 |
+
$arrStartData['address'] = $this->getShippingAddress($order);
|
306 |
+
$arrStartData['invoiceAddress'] = $this->getBillingAddress($order);
|
307 |
+
$arrStartData['products'] = $this->getProducts($order);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
308 |
}
|
309 |
|
310 |
+
return $arrStartData;
|
311 |
+
}
|
312 |
|
313 |
+
public function startPayment(Mage_Sales_Model_Order $order)
|
314 |
+
{
|
315 |
+
$store = $order->getStore();
|
316 |
+
$this->helperData->loginSDK($store);
|
317 |
|
318 |
+
Mage::log('Starting payment for order: ' . $order->getId(), null, 'paynl.log');
|
|
|
319 |
|
320 |
+
$arrStartData = $this->getTransactionStartData($order);
|
|
|
321 |
|
|
|
|
|
|
|
322 |
try {
|
323 |
Mage::log('Calling Pay api to start transaction', null, 'paynl.log');
|
324 |
|
325 |
+
$objStartResult = \Paynl\Transaction::start($arrStartData);
|
326 |
|
327 |
} catch (Exception $e) {
|
328 |
Mage::log("Creating transaction failed, Exception: " . $e->getMessage(), null, 'paynl.log');
|
346 |
// Add error to cart
|
347 |
Mage::getSingleton('checkout/session')->addError(Mage::helper('pay_payment')->__('Er is een storing bij de door u gekozen betaalmethode of bank. Kiest u alstublieft een andere betaalmethode of probeer het later nogmaals'));
|
348 |
Mage::getSingleton('checkout/session')->addError($e->getMessage());
|
|
|
349 |
// Redirect via header
|
350 |
|
351 |
return array('url' => Mage::getUrl('checkout/cart'));
|
353 |
|
354 |
$transaction = Mage::getModel('pay_payment/transaction');
|
355 |
|
356 |
+
$transactionId = $objStartResult->getTransactionId();
|
357 |
|
358 |
Mage::log('Transaction started, transactionId: ' . $transactionId, null, 'paynl.log');
|
359 |
|
360 |
$transaction->setData(
|
361 |
array(
|
362 |
'transaction_id' => $transactionId,
|
363 |
+
'service_id' => \Paynl\Config::getServiceId(),
|
364 |
+
'option_id' => $this->getPaymentOptionId(),
|
365 |
+
'option_sub_id' => null,
|
366 |
+
'amount' => round($arrStartData['amount'] * 100),
|
367 |
'order_id' => $order->getId(),
|
368 |
'status' => Pay_Payment_Model_Transaction::STATE_PENDING,
|
369 |
'created' => time(),
|
373 |
$transaction->save();
|
374 |
|
375 |
//redirecten
|
376 |
+
$url = $objStartResult->getRedirectUrl();
|
377 |
|
378 |
+
$payment = $order->getPayment();
|
379 |
|
380 |
$order->addStatusHistoryComment(
|
381 |
'Transactie gestart, transactieId: ' . $transactionId . " \nBetaalUrl: " . $url
|
382 |
);
|
383 |
|
|
|
384 |
$order->save();
|
385 |
|
386 |
+
$sendMail = Mage::getStoreConfig('payment/' . $payment->getMethod() . '/send_mail', $order->getStore());
|
387 |
+
|
388 |
if ($sendMail == 'start') {
|
389 |
$order->sendNewOrderEmail();
|
390 |
}
|
app/code/community/Pay/Payment/Model/Paymentmethod/Ideal.php
CHANGED
@@ -14,30 +14,4 @@ class Pay_Payment_Model_Paymentmethod_Ideal extends Pay_Payment_Model_Paymentmet
|
|
14 |
|
15 |
parent::__construct();
|
16 |
}
|
17 |
-
|
18 |
-
|
19 |
-
// public function assignData($data) {
|
20 |
-
// $store = Mage::app()->getStore();
|
21 |
-
// $bankSelectType = $store->getConfig('payment/pay_payment_ideal/bank_select_type');
|
22 |
-
//// $bankSelectType = Mage::getStoreConfig('payment/pay_payment_ideal/bank_select_type', Mage::app()->getStore());
|
23 |
-
// if($bankSelectType == 'none'){
|
24 |
-
// return $this;
|
25 |
-
// }
|
26 |
-
//
|
27 |
-
// if (!($data instanceof Varien_Object)) {
|
28 |
-
// $data = new Varien_Object($data);
|
29 |
-
// }
|
30 |
-
// $session = Mage::getSingleton('checkout/session');
|
31 |
-
// /* @var $session Mage_Checkout_Model_Session */
|
32 |
-
//
|
33 |
-
// $session->setOptionSubId();
|
34 |
-
//
|
35 |
-
// if ($data->getOptionSub()) {
|
36 |
-
// $optionSub = $data->getOptionSub();
|
37 |
-
// $session->setOptionSubId($optionSub);
|
38 |
-
// }
|
39 |
-
//
|
40 |
-
// return parent::assignData($data);
|
41 |
-
// }
|
42 |
-
|
43 |
}
|
14 |
|
15 |
parent::__construct();
|
16 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
17 |
}
|
app/code/community/Pay/Payment/Model/Paymentmethod/Instore.php
ADDED
@@ -0,0 +1,96 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Pay_Payment_Model_Paymentmethod_Instore extends Pay_Payment_Model_Paymentmethod
|
4 |
+
{
|
5 |
+
const OPTION_ID = 1729;
|
6 |
+
protected $_paymentOptionId = 1729;
|
7 |
+
protected $_code = 'pay_payment_instore';
|
8 |
+
protected $_formBlockType = 'pay_payment/form_instore';
|
9 |
+
|
10 |
+
// Can only be used in backend orders
|
11 |
+
protected $_canUseInternal = true;
|
12 |
+
protected $_canUseCheckout = true;
|
13 |
+
|
14 |
+
private $_redirectUrl = null;
|
15 |
+
|
16 |
+
public function __construct()
|
17 |
+
{
|
18 |
+
$this->_canUseCheckout = Mage::getStoreConfig('payment/pay_payment_instore/active_checkout')==1;
|
19 |
+
|
20 |
+
parent::__construct();
|
21 |
+
}
|
22 |
+
|
23 |
+
public function initialize($paymentAction, $stateObject)
|
24 |
+
{
|
25 |
+
switch ($paymentAction) {
|
26 |
+
case self::ACTION_AUTHORIZE:
|
27 |
+
case self::ACTION_AUTHORIZE_CAPTURE:
|
28 |
+
$payment = $this->getInfoInstance();
|
29 |
+
/** @var Mage_Sales_Model_Order $order */
|
30 |
+
$order = $payment->getOrder();
|
31 |
+
|
32 |
+
/** @var Pay_Payment_Model_Paymentmethod $method */
|
33 |
+
$method = $payment->getMethodInstance();
|
34 |
+
|
35 |
+
$this->_startResult = $method->startPayment($order);
|
36 |
+
|
37 |
+
return true;
|
38 |
+
break;
|
39 |
+
default:
|
40 |
+
break;
|
41 |
+
}
|
42 |
+
return parent::initialize($paymentAction, $stateObject);
|
43 |
+
}
|
44 |
+
|
45 |
+
private function sendToTerminal($transactionId, $terminalId)
|
46 |
+
{
|
47 |
+
$payment = \Paynl\Instore::payment(array(
|
48 |
+
'transactionId' => $transactionId,
|
49 |
+
'terminalId' => $terminalId
|
50 |
+
));
|
51 |
+
|
52 |
+
$hash = $payment->getHash();
|
53 |
+
|
54 |
+
for ($i = 0; $i < 60; $i++) {
|
55 |
+
$status = \Paynl\Instore::status(array('hash' => $hash));
|
56 |
+
$state = $status->getTransactionState();
|
57 |
+
|
58 |
+
if ($state != 'init') {
|
59 |
+
if ($state == 'approved') {
|
60 |
+
return true;
|
61 |
+
}
|
62 |
+
return false;
|
63 |
+
}
|
64 |
+
|
65 |
+
sleep(1);
|
66 |
+
}
|
67 |
+
return false;
|
68 |
+
}
|
69 |
+
|
70 |
+
public function getOrderPlaceRedirectUrl()
|
71 |
+
{
|
72 |
+
return $this->_redirectUrl;
|
73 |
+
}
|
74 |
+
|
75 |
+
public function startPayment(Mage_Sales_Model_Order $order)
|
76 |
+
{
|
77 |
+
if(!is_null($this->_startResult)){
|
78 |
+
return $this->_startResult;
|
79 |
+
}
|
80 |
+
|
81 |
+
$result = parent::startPayment($order);
|
82 |
+
|
83 |
+
$store = $order->getStore();
|
84 |
+
$pageSuccess = $store->getConfig('pay_payment/general/page_success');
|
85 |
+
|
86 |
+
if($this->sendToTerminal($result['transactionId'], $_POST['payment']['terminalId'])){
|
87 |
+
$result['url'] = $pageSuccess;
|
88 |
+
$this->_redirectUrl = $pageSuccess;
|
89 |
+
return $result;
|
90 |
+
} else{
|
91 |
+
Mage::throwException('Payment canceled');
|
92 |
+
}
|
93 |
+
|
94 |
+
}
|
95 |
+
}
|
96 |
+
|
app/code/community/Pay/Payment/Model/Paymentmethod/Klarna.php
CHANGED
@@ -1,5 +1,7 @@
|
|
1 |
<?php
|
2 |
-
|
|
|
|
|
3 |
const OPTION_ID = 1717;
|
4 |
protected $_paymentOptionId = 1717;
|
5 |
protected $_code = 'pay_payment_klarna';
|
@@ -11,58 +13,36 @@ class Pay_Payment_Model_Paymentmethod_Klarna extends Pay_Payment_Model_Paymentme
|
|
11 |
|
12 |
protected $_canCapturePartial = false;
|
13 |
|
14 |
-
|
15 |
-
|
16 |
-
// public function authorize(Mage_Sales_Model_Order_Payment $payment, $amount)
|
17 |
-
// {
|
18 |
-
// $order = $payment->getOrder();
|
19 |
-
// $method = $payment->getMethodInstance();
|
20 |
-
//
|
21 |
-
// $data = $method->startPayment($order);
|
22 |
-
//
|
23 |
-
// $payment->setTransactionId($data['transactionId'])
|
24 |
-
// ->setIsTransactionClosed(0);
|
25 |
-
//
|
26 |
-
// $transaction = $payment->addTransaction(Mage_Sales_Model_Order_Payment_Transaction::TYPE_AUTH);
|
27 |
-
//
|
28 |
-
// $transaction->setId($data['transactionId']);
|
29 |
-
//// $transaction->setIsClosed(0);
|
30 |
-
// $transaction->save();
|
31 |
-
// $payment->save();
|
32 |
-
//
|
33 |
-
// return parent::authorize($payment, $amount); // TODO: Change the autogenerated stub
|
34 |
-
// }
|
35 |
-
|
36 |
/**
|
37 |
* @return boolean
|
38 |
*/
|
39 |
|
40 |
public function isApplicableToQuote($quote, $checksBitMask)
|
41 |
{
|
42 |
-
if(strtolower($quote->getShippingAddress()->getFirstname()) !== strtolower($quote->getBillingAddress()->getFirstname())){
|
43 |
return false;
|
44 |
}
|
45 |
-
if(strtolower($quote->getShippingAddress()->getLastname()) !== strtolower($quote->getBillingAddress()->getLastname())){
|
46 |
return false;
|
47 |
}
|
48 |
-
if($quote->getShippingAddress()->getCountryId() != $quote->getBillingAddress()->getCountryId()){
|
49 |
return false;
|
50 |
}
|
51 |
-
if($quote->getShippingAddress()->getCompany()){
|
52 |
return false;
|
53 |
}
|
54 |
-
if($quote->getBillingAddress()->getCompany()){
|
55 |
return false;
|
56 |
}
|
57 |
-
|
58 |
return parent::isApplicableToQuote($quote, $checksBitMask);
|
59 |
}
|
60 |
-
|
61 |
public function capture(Varien_Object $payment, $amount)
|
62 |
{
|
63 |
$transaction = $payment->getAuthorizationTransaction();
|
64 |
|
65 |
-
if(!$transaction){
|
66 |
Mage::throwException('Cannot find authorize transaction');
|
67 |
}
|
68 |
$transactionId = $transaction->getTxnId();
|
@@ -70,27 +50,15 @@ class Pay_Payment_Model_Paymentmethod_Klarna extends Pay_Payment_Model_Paymentme
|
|
70 |
$order = $payment->getOrder();
|
71 |
$store = $order->getStore();
|
72 |
|
73 |
-
$
|
74 |
|
75 |
-
$
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
*/
|
83 |
-
$apiCapture = Mage::helper('pay_payment/api_capture');
|
84 |
-
|
85 |
-
$apiCapture->setApiToken($apiToken);
|
86 |
-
$apiCapture->setAmount($amount);
|
87 |
-
$apiCapture->setTransactionId($transactionId);
|
88 |
-
$result = $apiCapture->doRequest();
|
89 |
-
|
90 |
-
if($result['request']['result'] == true) {
|
91 |
-
return true;
|
92 |
-
}
|
93 |
-
else throw new Exception($result['request']['errorMessage']);
|
94 |
}
|
95 |
|
96 |
public function cancel(Varien_Object $payment)
|
@@ -102,7 +70,7 @@ class Pay_Payment_Model_Paymentmethod_Klarna extends Pay_Payment_Model_Paymentme
|
|
102 |
{
|
103 |
$transaction = $payment->getAuthorizationTransaction();
|
104 |
|
105 |
-
if(!$transaction){
|
106 |
Mage::throwException('Cannot find authorize transaction');
|
107 |
}
|
108 |
$transactionId = $transaction->getTxnId();
|
@@ -110,55 +78,15 @@ class Pay_Payment_Model_Paymentmethod_Klarna extends Pay_Payment_Model_Paymentme
|
|
110 |
$order = $payment->getOrder();
|
111 |
$store = $order->getStore();
|
112 |
|
113 |
-
$apiToken = Mage::getStoreConfig('pay_payment/general/apitoken', $store);
|
114 |
|
115 |
-
$
|
116 |
-
$backupApiUrl = Mage::getStoreConfig('pay_payment/general/backup_api_url', $store);
|
117 |
-
if ($useBackupApi == 1) {
|
118 |
-
Pay_Payment_Helper_Api::_setBackupApiUrl($backupApiUrl);
|
119 |
-
}
|
120 |
|
121 |
-
|
122 |
-
$
|
123 |
-
$apiVoid->setApiToken($apiToken);
|
124 |
-
$apiVoid->setTransactionId($transactionId);
|
125 |
|
126 |
-
$
|
127 |
|
128 |
-
|
129 |
-
return true;
|
130 |
-
}
|
131 |
-
else throw new Exception($result['request']['errorMessage']);
|
132 |
}
|
133 |
-
//
|
134 |
-
// /**
|
135 |
-
// * Instantiate state and set it to state object
|
136 |
-
// *
|
137 |
-
// * @param string $paymentAction
|
138 |
-
// * @param Varien_Object
|
139 |
-
// */
|
140 |
-
// public function initialize($paymentAction, $stateObject)
|
141 |
-
// {
|
142 |
-
// switch ($paymentAction) {
|
143 |
-
// case self::ACTION_AUTHORIZE:
|
144 |
-
// case self::ACTION_AUTHORIZE_CAPTURE:
|
145 |
-
// $payment = $this->getInfoInstance();
|
146 |
-
// $order = $payment->getOrder();
|
147 |
-
// $order->setCanSendNewEmailFlag(false);
|
148 |
-
// $payment->authorize(true, $order->getBaseTotalDue()); // base amount will be set inside
|
149 |
-
// $payment->setAmountAuthorized($order->getTotalDue());
|
150 |
-
//
|
151 |
-
// $order->setState(Mage_Sales_Model_Order::STATE_PENDING_PAYMENT, 'pending_payment', '', false);
|
152 |
-
//
|
153 |
-
// $stateObject->setState(Mage_Sales_Model_Order::STATE_PENDING_PAYMENT);
|
154 |
-
// $stateObject->setStatus('pending_payment');
|
155 |
-
// $stateObject->setIsNotified(false);
|
156 |
-
// break;
|
157 |
-
// default:
|
158 |
-
// break;
|
159 |
-
// }
|
160 |
-
// parent::initialize();
|
161 |
-
// }
|
162 |
-
|
163 |
}
|
164 |
|
1 |
<?php
|
2 |
+
|
3 |
+
class Pay_Payment_Model_Paymentmethod_Klarna extends Pay_Payment_Model_Paymentmethod
|
4 |
+
{
|
5 |
const OPTION_ID = 1717;
|
6 |
protected $_paymentOptionId = 1717;
|
7 |
protected $_code = 'pay_payment_klarna';
|
13 |
|
14 |
protected $_canCapturePartial = false;
|
15 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
16 |
/**
|
17 |
* @return boolean
|
18 |
*/
|
19 |
|
20 |
public function isApplicableToQuote($quote, $checksBitMask)
|
21 |
{
|
22 |
+
if (strtolower($quote->getShippingAddress()->getFirstname()) !== strtolower($quote->getBillingAddress()->getFirstname())) {
|
23 |
return false;
|
24 |
}
|
25 |
+
if (strtolower($quote->getShippingAddress()->getLastname()) !== strtolower($quote->getBillingAddress()->getLastname())) {
|
26 |
return false;
|
27 |
}
|
28 |
+
if ($quote->getShippingAddress()->getCountryId() != $quote->getBillingAddress()->getCountryId()) {
|
29 |
return false;
|
30 |
}
|
31 |
+
if ($quote->getShippingAddress()->getCompany()) {
|
32 |
return false;
|
33 |
}
|
34 |
+
if ($quote->getBillingAddress()->getCompany()) {
|
35 |
return false;
|
36 |
}
|
37 |
+
|
38 |
return parent::isApplicableToQuote($quote, $checksBitMask);
|
39 |
}
|
40 |
+
|
41 |
public function capture(Varien_Object $payment, $amount)
|
42 |
{
|
43 |
$transaction = $payment->getAuthorizationTransaction();
|
44 |
|
45 |
+
if (!$transaction) {
|
46 |
Mage::throwException('Cannot find authorize transaction');
|
47 |
}
|
48 |
$transactionId = $transaction->getTxnId();
|
50 |
$order = $payment->getOrder();
|
51 |
$store = $order->getStore();
|
52 |
|
53 |
+
$this->helperData->loginSDK($store);
|
54 |
|
55 |
+
$this->helperData->lockTransaction($transactionId);
|
56 |
+
|
57 |
+
$result = \Paynl\Transaction::capture($transactionId);
|
58 |
+
|
59 |
+
$this->helperData->removeLock($transactionId);
|
60 |
+
|
61 |
+
return $result;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
62 |
}
|
63 |
|
64 |
public function cancel(Varien_Object $payment)
|
70 |
{
|
71 |
$transaction = $payment->getAuthorizationTransaction();
|
72 |
|
73 |
+
if (!$transaction) {
|
74 |
Mage::throwException('Cannot find authorize transaction');
|
75 |
}
|
76 |
$transactionId = $transaction->getTxnId();
|
78 |
$order = $payment->getOrder();
|
79 |
$store = $order->getStore();
|
80 |
|
|
|
81 |
|
82 |
+
$this->helperData->lockTransaction($transactionId);
|
|
|
|
|
|
|
|
|
83 |
|
84 |
+
$this->helperData->loginSDK($store);
|
85 |
+
$result = \Paynl\Transaction::void($transactionId);
|
|
|
|
|
86 |
|
87 |
+
$this->helperData->removeLock($transactionId);
|
88 |
|
89 |
+
return $result;
|
|
|
|
|
|
|
90 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
91 |
}
|
92 |
|
app/code/community/Pay/Payment/Model/Paymentmethod/Paylink.php
CHANGED
@@ -12,24 +12,6 @@ class Pay_Payment_Model_Paymentmethod_Paylink extends Pay_Payment_Model_Paymentm
|
|
12 |
protected $_canUseCheckout = false;
|
13 |
|
14 |
|
15 |
-
// public function authorize(Mage_Sales_Model_Order_Payment $payment, $amount)
|
16 |
-
// {
|
17 |
-
// $order = $payment->getOrder();
|
18 |
-
// $method = $payment->getMethodInstance();
|
19 |
-
//
|
20 |
-
// $data = $method->startPayment($order);
|
21 |
-
//
|
22 |
-
// $payment->setTransactionId($data['transactionId'])
|
23 |
-
// ->setIsTransactionClosed(0);
|
24 |
-
//
|
25 |
-
// $transaction = $payment->addTransaction(Mage_Sales_Model_Order_Payment_Transaction::TYPE_AUTH);
|
26 |
-
//
|
27 |
-
// $transaction->setId($data['transactionId']);
|
28 |
-
// $transaction->save();
|
29 |
-
// $payment->save();
|
30 |
-
//
|
31 |
-
// return parent::authorize($payment, $amount); // TODO: Change the autogenerated stub
|
32 |
-
// }
|
33 |
|
34 |
public function initialize($paymentAction, $stateObject)
|
35 |
{
|
12 |
protected $_canUseCheckout = false;
|
13 |
|
14 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
15 |
|
16 |
public function initialize($paymentAction, $stateObject)
|
17 |
{
|
app/code/community/Pay/Payment/Model/Paymentmethod/Yehhpay.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Pay_Payment_Model_Paymentmethod_Yehhpay extends Pay_Payment_Model_Paymentmethod {
|
4 |
+
|
5 |
+
const OPTION_ID = 1877;
|
6 |
+
|
7 |
+
protected $_paymentOptionId = 1877;
|
8 |
+
protected $_code = 'pay_payment_yehhpay';
|
9 |
+
protected $_formBlockType = 'pay_payment/form_yehhpay';
|
10 |
+
|
11 |
+
}
|
app/code/community/Pay/Payment/Model/Source/Paymentmethod/Instore/Active.php
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Pay_Payment_Model_Source_Paymentmethod_Instore_Active extends Pay_Payment_Model_Source_Paymentmethod_Active{
|
3 |
+
protected $_option_id = Pay_Payment_Model_Paymentmethod_Instore::OPTION_ID;
|
4 |
+
}
|
app/code/community/Pay/Payment/Model/Source/Paymentmethod/Yehhpay/Active.php
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Pay_Payment_Model_Source_Paymentmethod_Yehhpay_Active extends Pay_Payment_Model_Source_Paymentmethod_Active{
|
3 |
+
protected $_option_id = Pay_Payment_Model_Paymentmethod_Yehhpay::OPTION_ID;
|
4 |
+
}
|
app/code/community/Pay/Payment/Model/Transaction/LockException.php
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Created by PhpStorm.
|
5 |
+
* User: andy
|
6 |
+
* Date: 21-3-17
|
7 |
+
* Time: 14:38
|
8 |
+
*/
|
9 |
+
class Pay_Payment_Model_Transaction_LockException extends Pay_Payment_Exception
|
10 |
+
{
|
11 |
+
protected $code = 1;
|
12 |
+
}
|
app/code/community/Pay/Payment/composer.json
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"require": {
|
3 |
+
"paynl/sdk": "^1.2"
|
4 |
+
}
|
5 |
+
}
|
app/code/community/Pay/Payment/composer.lock
ADDED
@@ -0,0 +1,111 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"_readme": [
|
3 |
+
"This file locks the dependencies of your project to a known state",
|
4 |
+
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
|
5 |
+
"This file is @generated automatically"
|
6 |
+
],
|
7 |
+
"hash": "6c8823e38701d6ad4db0d02873530de2",
|
8 |
+
"content-hash": "50755699e58e5bc8078862714d9ec24d",
|
9 |
+
"packages": [
|
10 |
+
{
|
11 |
+
"name": "paynl/sdk",
|
12 |
+
"version": "v1.2.9",
|
13 |
+
"source": {
|
14 |
+
"type": "git",
|
15 |
+
"url": "https://github.com/paynl/sdk.git",
|
16 |
+
"reference": "3521f99df7f9d34709b8fb1acfab10423084407f"
|
17 |
+
},
|
18 |
+
"dist": {
|
19 |
+
"type": "zip",
|
20 |
+
"url": "https://api.github.com/repos/paynl/sdk/zipball/3521f99df7f9d34709b8fb1acfab10423084407f",
|
21 |
+
"reference": "3521f99df7f9d34709b8fb1acfab10423084407f",
|
22 |
+
"shasum": ""
|
23 |
+
},
|
24 |
+
"require": {
|
25 |
+
"php-curl-class/php-curl-class": "^4.8"
|
26 |
+
},
|
27 |
+
"require-dev": {
|
28 |
+
"phpunit/phpunit": "^4.8",
|
29 |
+
"satooshi/php-coveralls": "~1.0"
|
30 |
+
},
|
31 |
+
"type": "library",
|
32 |
+
"autoload": {
|
33 |
+
"psr-4": {
|
34 |
+
"Paynl\\": "src/"
|
35 |
+
}
|
36 |
+
},
|
37 |
+
"notification-url": "https://packagist.org/downloads/",
|
38 |
+
"authors": [
|
39 |
+
{
|
40 |
+
"name": "Andy Pieters",
|
41 |
+
"email": "andy@pay.nl"
|
42 |
+
}
|
43 |
+
],
|
44 |
+
"time": "2017-03-14 16:42:11"
|
45 |
+
},
|
46 |
+
{
|
47 |
+
"name": "php-curl-class/php-curl-class",
|
48 |
+
"version": "4.13.0",
|
49 |
+
"source": {
|
50 |
+
"type": "git",
|
51 |
+
"url": "https://github.com/php-curl-class/php-curl-class.git",
|
52 |
+
"reference": "debe0a89ee1eb9a2f15c0bb63ce8b347130af50d"
|
53 |
+
},
|
54 |
+
"dist": {
|
55 |
+
"type": "zip",
|
56 |
+
"url": "https://api.github.com/repos/php-curl-class/php-curl-class/zipball/debe0a89ee1eb9a2f15c0bb63ce8b347130af50d",
|
57 |
+
"reference": "debe0a89ee1eb9a2f15c0bb63ce8b347130af50d",
|
58 |
+
"shasum": ""
|
59 |
+
},
|
60 |
+
"require": {
|
61 |
+
"ext-curl": "*",
|
62 |
+
"php": ">=5.3"
|
63 |
+
},
|
64 |
+
"require-dev": {
|
65 |
+
"phpunit/phpunit": "*"
|
66 |
+
},
|
67 |
+
"type": "library",
|
68 |
+
"autoload": {
|
69 |
+
"psr-4": {
|
70 |
+
"Curl\\": "src/Curl/"
|
71 |
+
}
|
72 |
+
},
|
73 |
+
"notification-url": "https://packagist.org/downloads/",
|
74 |
+
"license": [
|
75 |
+
"Unlicense"
|
76 |
+
],
|
77 |
+
"authors": [
|
78 |
+
{
|
79 |
+
"name": "Zach Borboa"
|
80 |
+
}
|
81 |
+
],
|
82 |
+
"description": "PHP Curl Class is an object-oriented wrapper of the PHP cURL extension.",
|
83 |
+
"homepage": "https://github.com/php-curl-class/php-curl-class",
|
84 |
+
"keywords": [
|
85 |
+
"api",
|
86 |
+
"class",
|
87 |
+
"client",
|
88 |
+
"curl",
|
89 |
+
"framework",
|
90 |
+
"http",
|
91 |
+
"http client",
|
92 |
+
"json",
|
93 |
+
"php",
|
94 |
+
"requests",
|
95 |
+
"rest",
|
96 |
+
"restful",
|
97 |
+
"web service",
|
98 |
+
"xml"
|
99 |
+
],
|
100 |
+
"time": "2016-07-25 19:31:39"
|
101 |
+
}
|
102 |
+
],
|
103 |
+
"packages-dev": [],
|
104 |
+
"aliases": [],
|
105 |
+
"minimum-stability": "stable",
|
106 |
+
"stability-flags": [],
|
107 |
+
"prefer-stable": false,
|
108 |
+
"prefer-lowest": false,
|
109 |
+
"platform": [],
|
110 |
+
"platform-dev": []
|
111 |
+
}
|
app/code/community/Pay/Payment/controllers/CheckoutController.php
CHANGED
@@ -2,13 +2,30 @@
|
|
2 |
|
3 |
class Pay_Payment_CheckoutController extends Mage_Core_Controller_Front_Action
|
4 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
|
6 |
public function redirectAction()
|
7 |
{
|
8 |
Mage::log('Starting transaction', null, 'paynl.log');
|
9 |
-
|
10 |
-
$session
|
11 |
-
|
12 |
if ($session->getLastRealOrderId()) {
|
13 |
Mage::log('Order found in session, orderId: ' . $session->getLastRealOrderId(), null, 'paynl.log');
|
14 |
|
2 |
|
3 |
class Pay_Payment_CheckoutController extends Mage_Core_Controller_Front_Action
|
4 |
{
|
5 |
+
/**
|
6 |
+
* @var Pay_Payment_Helper_Order
|
7 |
+
*/
|
8 |
+
private $helperOrder;
|
9 |
+
/**
|
10 |
+
* @var Pay_Payment_Helper_Data
|
11 |
+
*/
|
12 |
+
private $helperData;
|
13 |
+
|
14 |
+
public function __construct(Zend_Controller_Request_Abstract $request, Zend_Controller_Response_Abstract $response, array $invokeArgs = array())
|
15 |
+
{
|
16 |
+
$this->helperData = Mage::helper('pay_payment');
|
17 |
+
$this->helperOrder = Mage::helper('pay_payment/order');
|
18 |
+
|
19 |
+
|
20 |
+
parent::__construct($request, $response, $invokeArgs);
|
21 |
+
}
|
22 |
|
23 |
public function redirectAction()
|
24 |
{
|
25 |
Mage::log('Starting transaction', null, 'paynl.log');
|
26 |
+
|
27 |
+
$session= Mage::getSingleton('checkout/session');
|
28 |
+
|
29 |
if ($session->getLastRealOrderId()) {
|
30 |
Mage::log('Order found in session, orderId: ' . $session->getLastRealOrderId(), null, 'paynl.log');
|
31 |
|
app/code/community/Pay/Payment/controllers/OrderController.php
CHANGED
@@ -1,31 +1,47 @@
|
|
1 |
<?php
|
2 |
|
3 |
-
class Pay_Payment_OrderController extends Mage_Core_Controller_Front_Action
|
4 |
-
|
5 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6 |
|
|
|
|
|
7 |
try {
|
8 |
$params = $this->getRequest()->getParams();
|
9 |
|
10 |
$transactionId = $params['orderId'];
|
11 |
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
$
|
16 |
-
$order = $orderHelper->getOrderByTransactionId($transactionId);
|
17 |
//$orderHelper->processByTransactionId($transactionId);
|
18 |
} catch (Pay_Payment_Exception $e) {
|
19 |
if ($e->getCode() != 0) {
|
20 |
throw new Exception($e);
|
21 |
}
|
22 |
}
|
23 |
-
|
24 |
-
$pageSuccess = Mage::getStoreConfig('pay_payment/general/page_success', Mage::app()->getStore());
|
25 |
-
$pagePending = Mage::getStoreConfig('pay_payment/general/page_pending', Mage::app()->getStore());
|
26 |
-
$pageCanceled = Mage::getStoreConfig('pay_payment/general/page_canceled', Mage::app()->getStore());
|
27 |
|
28 |
-
|
|
|
|
|
|
|
29 |
if ($status == Pay_Payment_Model_Transaction::STATE_CANCELED) {
|
30 |
Mage::getSingleton('checkout/session')->addNotice($this->__('Betaling geannuleerd'));
|
31 |
}
|
@@ -52,46 +68,50 @@ class Pay_Payment_OrderController extends Mage_Core_Controller_Front_Action {
|
|
52 |
}
|
53 |
}
|
54 |
|
55 |
-
public function exchangeAction()
|
56 |
-
|
57 |
|
58 |
$error = false;
|
59 |
$params = $this->getRequest()->getParams();
|
60 |
|
61 |
$transactionId = $params['order_id'];
|
62 |
-
if(empty($transactionId)){
|
63 |
$get = $this->getRequest()->setParamSources(array('_GET'))->getParams();
|
64 |
$post = $this->getRequest()->setParamSources(array('_POST'))->getParams();
|
65 |
|
66 |
-
if(!empty($get['order_id'])){
|
67 |
$transactionId = $get['order_id'];
|
68 |
-
Mage::log('Error in exchange, but fixed by getting only the _GET var ',null,'exchange.log');
|
69 |
-
} elseif(!empty($post['order_id'])) {
|
70 |
$transactionId = $post['order_id'];
|
71 |
-
Mage::log('Error in exchange, but fixed by getting only the _POST var ',null,'exchange.log');
|
72 |
} else {
|
73 |
-
Mage::log('Error in exchange, cannot find orderId in _GET or _POST ',null,'exchange.log');
|
74 |
}
|
75 |
|
76 |
-
$get
|
77 |
-
$post
|
78 |
-
Mage::log('_GET was: '.json_encode($get),null,'exchange.log');
|
79 |
-
Mage::log('_POST was: '.json_encode($post),null,'exchange.log');
|
80 |
}
|
81 |
-
|
82 |
-
$helper = Mage::helper('pay_payment');
|
83 |
-
/** @var $helper Pay_Payment_Helper_Data */
|
84 |
try {
|
85 |
-
|
86 |
-
/** @var $orderHelper Pay_Payment_Helper_Order */
|
87 |
-
|
88 |
if ($params['action'] == 'pending') {
|
89 |
throw Mage::exception('Pay_Payment', 'Ignoring pending', 0);
|
90 |
}
|
91 |
-
|
92 |
-
$
|
|
|
|
|
|
|
|
|
93 |
|
94 |
$resultMsg = 'Status updated to ' . $status;
|
|
|
|
|
|
|
|
|
95 |
} catch (Pay_Payment_Exception $e) {
|
96 |
if ($e->getCode() == 0) {
|
97 |
$resultMsg = 'NOTICE: ';
|
@@ -100,17 +120,19 @@ class Pay_Payment_OrderController extends Mage_Core_Controller_Front_Action {
|
|
100 |
$resultMsg = 'ERROR: ';
|
101 |
}
|
102 |
$resultMsg .= $e->getMessage();
|
|
|
103 |
} catch (Exception $e) {
|
104 |
$error = true;
|
105 |
$resultMsg = 'ERROR: ' . $e->getMessage();
|
|
|
106 |
}
|
107 |
|
108 |
-
if($error){
|
109 |
echo "FALSE|" . $resultMsg;
|
110 |
} else {
|
111 |
echo "TRUE|" . $resultMsg;
|
112 |
}
|
113 |
-
|
114 |
die();
|
115 |
}
|
116 |
|
1 |
<?php
|
2 |
|
3 |
+
class Pay_Payment_OrderController extends Mage_Core_Controller_Front_Action
|
4 |
+
{
|
5 |
+
|
6 |
+
/**
|
7 |
+
* @var Pay_Payment_Helper_Order
|
8 |
+
*/
|
9 |
+
private $helperOrder;
|
10 |
+
/**
|
11 |
+
* @var Pay_Payment_Helper_Data
|
12 |
+
*/
|
13 |
+
private $helperData;
|
14 |
+
|
15 |
+
public function __construct(Zend_Controller_Request_Abstract $request, Zend_Controller_Response_Abstract $response, array $invokeArgs = array())
|
16 |
+
{
|
17 |
+
$this->helperData = Mage::helper('pay_payment');
|
18 |
+
$this->helperOrder = Mage::helper('pay_payment/order');
|
19 |
+
|
20 |
+
parent::__construct($request, $response, $invokeArgs);
|
21 |
+
}
|
22 |
|
23 |
+
public function returnAction()
|
24 |
+
{
|
25 |
try {
|
26 |
$params = $this->getRequest()->getParams();
|
27 |
|
28 |
$transactionId = $params['orderId'];
|
29 |
|
30 |
+
|
31 |
+
$status = $this->helperOrder->getTransactionStatus($transactionId);
|
32 |
+
$order = $this->helperOrder->getOrderByTransactionId($transactionId);
|
33 |
+
$store = $order->getStore();
|
|
|
34 |
//$orderHelper->processByTransactionId($transactionId);
|
35 |
} catch (Pay_Payment_Exception $e) {
|
36 |
if ($e->getCode() != 0) {
|
37 |
throw new Exception($e);
|
38 |
}
|
39 |
}
|
|
|
|
|
|
|
|
|
40 |
|
41 |
+
$pageSuccess = $store->getConfig('pay_payment/general/page_success');
|
42 |
+
$pagePending = $store->getConfig('pay_payment/general/page_pending');
|
43 |
+
$pageCanceled = $store->getConfig('pay_payment/general/page_canceled');
|
44 |
+
|
45 |
if ($status == Pay_Payment_Model_Transaction::STATE_CANCELED) {
|
46 |
Mage::getSingleton('checkout/session')->addNotice($this->__('Betaling geannuleerd'));
|
47 |
}
|
68 |
}
|
69 |
}
|
70 |
|
71 |
+
public function exchangeAction()
|
72 |
+
{
|
73 |
|
74 |
$error = false;
|
75 |
$params = $this->getRequest()->getParams();
|
76 |
|
77 |
$transactionId = $params['order_id'];
|
78 |
+
if (empty($transactionId)) {
|
79 |
$get = $this->getRequest()->setParamSources(array('_GET'))->getParams();
|
80 |
$post = $this->getRequest()->setParamSources(array('_POST'))->getParams();
|
81 |
|
82 |
+
if (!empty($get['order_id'])) {
|
83 |
$transactionId = $get['order_id'];
|
84 |
+
Mage::log('Error in exchange, but fixed by getting only the _GET var ', null, 'exchange.log');
|
85 |
+
} elseif (!empty($post['order_id'])) {
|
86 |
$transactionId = $post['order_id'];
|
87 |
+
Mage::log('Error in exchange, but fixed by getting only the _POST var ', null, 'exchange.log');
|
88 |
} else {
|
89 |
+
Mage::log('Error in exchange, cannot find orderId in _GET or _POST ', null, 'exchange.log');
|
90 |
}
|
91 |
|
92 |
+
$get = $this->getRequest()->setParamSources(array('_GET'))->getParams();
|
93 |
+
$post = $this->getRequest()->setParamSources(array('_POST'))->getParams();
|
94 |
+
Mage::log('_GET was: ' . json_encode($get), null, 'exchange.log');
|
95 |
+
Mage::log('_POST was: ' . json_encode($post), null, 'exchange.log');
|
96 |
}
|
97 |
+
|
|
|
|
|
98 |
try {
|
99 |
+
|
|
|
|
|
100 |
if ($params['action'] == 'pending') {
|
101 |
throw Mage::exception('Pay_Payment', 'Ignoring pending', 0);
|
102 |
}
|
103 |
+
|
104 |
+
$this->helperData->lockTransaction($transactionId);
|
105 |
+
|
106 |
+
$status = $this->helperOrder->processByTransactionId($transactionId);
|
107 |
+
|
108 |
+
$this->helperData->removeLock($transactionId);
|
109 |
|
110 |
$resultMsg = 'Status updated to ' . $status;
|
111 |
+
} catch (Pay_Payment_Model_Transaction_LockException $e) {
|
112 |
+
$error = true;
|
113 |
+
$resultMsg = 'ERROR: ';
|
114 |
+
$resultMsg .= $e->getMessage();
|
115 |
} catch (Pay_Payment_Exception $e) {
|
116 |
if ($e->getCode() == 0) {
|
117 |
$resultMsg = 'NOTICE: ';
|
120 |
$resultMsg = 'ERROR: ';
|
121 |
}
|
122 |
$resultMsg .= $e->getMessage();
|
123 |
+
$this->helperData->removeLock($transactionId);
|
124 |
} catch (Exception $e) {
|
125 |
$error = true;
|
126 |
$resultMsg = 'ERROR: ' . $e->getMessage();
|
127 |
+
$this->helperData->removeLock($transactionId);
|
128 |
}
|
129 |
|
130 |
+
if ($error) {
|
131 |
echo "FALSE|" . $resultMsg;
|
132 |
} else {
|
133 |
echo "TRUE|" . $resultMsg;
|
134 |
}
|
135 |
+
|
136 |
die();
|
137 |
}
|
138 |
|
app/code/community/Pay/Payment/etc/config.xml
CHANGED
@@ -2,11 +2,36 @@
|
|
2 |
<config>
|
3 |
<modules>
|
4 |
<Pay_Payment>
|
5 |
-
<version>3.
|
6 |
</Pay_Payment>
|
7 |
</modules>
|
8 |
-
|
9 |
<global>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
<models>
|
11 |
<pay_payment>
|
12 |
<class>Pay_Payment_Model</class>
|
@@ -200,7 +225,6 @@
|
|
200 |
<pay_payment_klarna>
|
201 |
<active>0</active>
|
202 |
<model>pay_payment/Paymentmethod_Klarna</model>
|
203 |
-
<auto_capture>1</auto_capture>
|
204 |
<title>Klarna</title>
|
205 |
<payment_action>authorize</payment_action>
|
206 |
<order_status>pending_payment</order_status>
|
@@ -308,6 +332,17 @@
|
|
308 |
<send_mail>success</send_mail>
|
309 |
<limit_shipping>0</limit_shipping>
|
310 |
</pay_payment_incasso>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
311 |
<pay_payment_paypal>
|
312 |
<active>0</active>
|
313 |
<model>pay_payment/Paymentmethod_Paypal</model>
|
@@ -512,6 +547,16 @@
|
|
512 |
<send_mail>success</send_mail>
|
513 |
<limit_shipping>0</limit_shipping>
|
514 |
</pay_payment_paylink>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
515 |
</payment>
|
516 |
</default>
|
517 |
</config>
|
2 |
<config>
|
3 |
<modules>
|
4 |
<Pay_Payment>
|
5 |
+
<version>3.7.0</version>
|
6 |
</Pay_Payment>
|
7 |
</modules>
|
|
|
8 |
<global>
|
9 |
+
<events>
|
10 |
+
<core_collection_abstract_load_before>
|
11 |
+
<observers>
|
12 |
+
<pay_payment>
|
13 |
+
<class>Pay_Payment_Model_Observer</class>
|
14 |
+
<method>addAutoloader</method>
|
15 |
+
</pay_payment>
|
16 |
+
</observers>
|
17 |
+
</core_collection_abstract_load_before>
|
18 |
+
<resource_get_tablename>
|
19 |
+
<observers>
|
20 |
+
<pay_payment>
|
21 |
+
<class>Pay_Payment_Model_Observer</class>
|
22 |
+
<method>addAutoloader</method>
|
23 |
+
</pay_payment>
|
24 |
+
</observers>
|
25 |
+
</resource_get_tablename>
|
26 |
+
<add_spl_autoloader>
|
27 |
+
<observers>
|
28 |
+
<pay_payment>
|
29 |
+
<class>Pay_Payment_Model_Observer</class>
|
30 |
+
<method>addAutoloader</method>
|
31 |
+
</pay_payment>
|
32 |
+
</observers>
|
33 |
+
</add_spl_autoloader>
|
34 |
+
</events>
|
35 |
<models>
|
36 |
<pay_payment>
|
37 |
<class>Pay_Payment_Model</class>
|
225 |
<pay_payment_klarna>
|
226 |
<active>0</active>
|
227 |
<model>pay_payment/Paymentmethod_Klarna</model>
|
|
|
228 |
<title>Klarna</title>
|
229 |
<payment_action>authorize</payment_action>
|
230 |
<order_status>pending_payment</order_status>
|
332 |
<send_mail>success</send_mail>
|
333 |
<limit_shipping>0</limit_shipping>
|
334 |
</pay_payment_incasso>
|
335 |
+
<pay_payment_instore>
|
336 |
+
<active>0</active>
|
337 |
+
<active_checkout>0</active_checkout>
|
338 |
+
<model>pay_payment/Paymentmethod_Instore</model>
|
339 |
+
<title>Pinnen</title>
|
340 |
+
<payment_action>authorize</payment_action>
|
341 |
+
<order_status>pending_payment</order_status>
|
342 |
+
<order_status_success>processing</order_status_success>
|
343 |
+
<send_mail>success</send_mail>
|
344 |
+
<limit_shipping>0</limit_shipping>
|
345 |
+
</pay_payment_instore>
|
346 |
<pay_payment_paypal>
|
347 |
<active>0</active>
|
348 |
<model>pay_payment/Paymentmethod_Paypal</model>
|
547 |
<send_mail>success</send_mail>
|
548 |
<limit_shipping>0</limit_shipping>
|
549 |
</pay_payment_paylink>
|
550 |
+
<pay_payment_yehhpay>
|
551 |
+
<active>0</active>
|
552 |
+
<model>pay_payment/Paymentmethod_Yehhpay</model>
|
553 |
+
<title>Yehhpay</title>
|
554 |
+
<payment_action>authorize</payment_action>
|
555 |
+
<order_status>pending_payment</order_status>
|
556 |
+
<order_status_success>processing</order_status_success>
|
557 |
+
<send_mail>success</send_mail>
|
558 |
+
<limit_shipping>0</limit_shipping>
|
559 |
+
</pay_payment_yehhpay>
|
560 |
</payment>
|
561 |
</default>
|
562 |
</config>
|
app/code/community/Pay/Payment/etc/system.xml
CHANGED
@@ -3805,10 +3805,10 @@
|
|
3805 |
</send_mail>
|
3806 |
</fields>
|
3807 |
</pay_payment_incasso>
|
3808 |
-
<
|
3809 |
-
<label>
|
3810 |
-
<model>pay_payment/
|
3811 |
-
<sort_order>
|
3812 |
<show_in_default>1</show_in_default>
|
3813 |
<show_in_website>1</show_in_website>
|
3814 |
<show_in_store>1</show_in_store>
|
@@ -3821,9 +3821,23 @@
|
|
3821 |
<show_in_website>1</show_in_website>
|
3822 |
<show_in_store>1</show_in_store>
|
3823 |
<frontend_type>select</frontend_type>
|
3824 |
-
<source_model>pay_payment/
|
3825 |
-
<config_path>payment/
|
3826 |
</active>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3827 |
<title translate="label">
|
3828 |
<depends>
|
3829 |
<active>1</active>
|
@@ -3834,22 +3848,234 @@
|
|
3834 |
<show_in_default>1</show_in_default>
|
3835 |
<show_in_website>1</show_in_website>
|
3836 |
<show_in_store>1</show_in_store>
|
3837 |
-
<config_path>payment/
|
3838 |
</title>
|
3839 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3840 |
<depends>
|
3841 |
<active>1</active>
|
3842 |
</depends>
|
3843 |
-
<label>
|
3844 |
-
<comment>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3845 |
<frontend_type>select</frontend_type>
|
3846 |
<source_model>adminhtml/system_config_source_yesno</source_model>
|
3847 |
-
<sort_order>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3848 |
<show_in_default>1</show_in_default>
|
3849 |
<show_in_website>1</show_in_website>
|
3850 |
<show_in_store>1</show_in_store>
|
3851 |
-
<config_path>payment/pay_payment_klarna/
|
3852 |
-
</
|
3853 |
<sort_order translate="label">
|
3854 |
<depends>
|
3855 |
<active>1</active>
|
@@ -7207,6 +7433,232 @@
|
|
7207 |
</send_mail>
|
7208 |
</fields>
|
7209 |
</pay_payment_wijncadeau>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7210 |
<pay_payment_yourgift type="group" translate="label" module="pay_payment">
|
7211 |
<label>YourGift</label>
|
7212 |
<model>pay_payment/Model_Paymentmethod_Yourgift</model>
|
3805 |
</send_mail>
|
3806 |
</fields>
|
3807 |
</pay_payment_incasso>
|
3808 |
+
<pay_payment_instore type="group" translate="label" module="pay_payment">
|
3809 |
+
<label>Instore (Pin)</label>
|
3810 |
+
<model>pay_payment/Model_Paymentmethod_Instore</model>
|
3811 |
+
<sort_order>2650</sort_order>
|
3812 |
<show_in_default>1</show_in_default>
|
3813 |
<show_in_website>1</show_in_website>
|
3814 |
<show_in_store>1</show_in_store>
|
3821 |
<show_in_website>1</show_in_website>
|
3822 |
<show_in_store>1</show_in_store>
|
3823 |
<frontend_type>select</frontend_type>
|
3824 |
+
<source_model>pay_payment/source_paymentmethod_instore_active</source_model>
|
3825 |
+
<config_path>payment/pay_payment_instore/active</config_path>
|
3826 |
</active>
|
3827 |
+
<active_checkout translate="label">
|
3828 |
+
<depends>
|
3829 |
+
<active>1</active>
|
3830 |
+
</depends>
|
3831 |
+
<label>Actief in Checkout</label>
|
3832 |
+
<comment>Wilt u deze betaalmethode tonen in de checkout, standaard wordt deze alleen weergegeven bij admin orders</comment>
|
3833 |
+
<sort_order>1</sort_order>
|
3834 |
+
<show_in_default>1</show_in_default>
|
3835 |
+
<show_in_website>1</show_in_website>
|
3836 |
+
<show_in_store>1</show_in_store>
|
3837 |
+
<frontend_type>select</frontend_type>
|
3838 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
3839 |
+
<config_path>payment/pay_payment_instore/active_checkout</config_path>
|
3840 |
+
</active_checkout>
|
3841 |
<title translate="label">
|
3842 |
<depends>
|
3843 |
<active>1</active>
|
3848 |
<show_in_default>1</show_in_default>
|
3849 |
<show_in_website>1</show_in_website>
|
3850 |
<show_in_store>1</show_in_store>
|
3851 |
+
<config_path>payment/pay_payment_instore/title</config_path>
|
3852 |
</title>
|
3853 |
+
|
3854 |
+
<sort_order translate="label">
|
3855 |
+
<depends>
|
3856 |
+
<active>1</active>
|
3857 |
+
</depends>
|
3858 |
+
<label>Betaalmethode sorteer volgorde</label>
|
3859 |
+
<frontend_type>text</frontend_type>
|
3860 |
+
<sort_order>4</sort_order>
|
3861 |
+
<show_in_default>1</show_in_default>
|
3862 |
+
<show_in_website>1</show_in_website>
|
3863 |
+
<show_in_store>1</show_in_store>
|
3864 |
+
<config_path>payment/pay_payment_instore/sort_order</config_path>
|
3865 |
+
</sort_order>
|
3866 |
+
<min_order_total translate="label">
|
3867 |
<depends>
|
3868 |
<active>1</active>
|
3869 |
</depends>
|
3870 |
+
<label>Minimum bedrag</label>
|
3871 |
+
<comment>Het minimum bedrag waarvoor deze betaalmethode gebruikt mag worden
|
3872 |
+
</comment>
|
3873 |
+
<frontend_type>text</frontend_type>
|
3874 |
+
<sort_order>5</sort_order>
|
3875 |
+
<show_in_default>1</show_in_default>
|
3876 |
+
<show_in_website>1</show_in_website>
|
3877 |
+
<show_in_store>1</show_in_store>
|
3878 |
+
<config_path>payment/pay_payment_instore/min_order_total</config_path>
|
3879 |
+
</min_order_total>
|
3880 |
+
<max_order_total translate="label">
|
3881 |
+
<depends>
|
3882 |
+
<active>1</active>
|
3883 |
+
</depends>
|
3884 |
+
<label>Maximum bedrag</label>
|
3885 |
+
<comment>Het maximum bedrag waarvoor deze betaalmethode gebruikt mag worden
|
3886 |
+
</comment>
|
3887 |
+
<frontend_type>text</frontend_type>
|
3888 |
+
<sort_order>6</sort_order>
|
3889 |
+
<show_in_default>1</show_in_default>
|
3890 |
+
<show_in_website>1</show_in_website>
|
3891 |
+
<show_in_store>1</show_in_store>
|
3892 |
+
<config_path>payment/pay_payment_instore/max_order_total</config_path>
|
3893 |
+
</max_order_total>
|
3894 |
+
<allowspecific translate="label">
|
3895 |
+
<depends>
|
3896 |
+
<active>1</active>
|
3897 |
+
</depends>
|
3898 |
+
<label>Beschikbaarheid per land</label>
|
3899 |
+
<frontend_type>allowspecific</frontend_type>
|
3900 |
+
<source_model>adminhtml/system_config_source_payment_allspecificcountries
|
3901 |
+
</source_model>
|
3902 |
+
<sort_order>7</sort_order>
|
3903 |
+
<show_in_default>1</show_in_default>
|
3904 |
+
<show_in_website>1</show_in_website>
|
3905 |
+
<show_in_store>1</show_in_store>
|
3906 |
+
<config_path>payment/pay_payment_instore/allowspecific</config_path>
|
3907 |
+
</allowspecific>
|
3908 |
+
<specificcountry translate="label">
|
3909 |
+
<depends>
|
3910 |
+
<active>1</active>
|
3911 |
+
<allowspecific>1</allowspecific>
|
3912 |
+
</depends>
|
3913 |
+
<label>Toegestane landen</label>
|
3914 |
+
<frontend_type>multiselect</frontend_type>
|
3915 |
+
<source_model>adminhtml/system_config_source_country</source_model>
|
3916 |
+
<sort_order>8</sort_order>
|
3917 |
+
<show_in_default>1</show_in_default>
|
3918 |
+
<show_in_website>1</show_in_website>
|
3919 |
+
<show_in_store>1</show_in_store>
|
3920 |
+
<comment>Selecteer de landen waarvoor deze betaalmethode beschikbaar is</comment>
|
3921 |
+
<config_path>payment/pay_payment_instore/specificcountry</config_path>
|
3922 |
+
</specificcountry>
|
3923 |
+
<limit_shipping translate="label">
|
3924 |
+
<depends>
|
3925 |
+
<active>1</active>
|
3926 |
+
</depends>
|
3927 |
+
<label>Verzendmethoden blokkeren</label>
|
3928 |
+
<comment>
|
3929 |
+
Schakel dit in als u deze betaalmethode wilt blokkeren voor bepaalde
|
3930 |
+
verzendmethoden
|
3931 |
+
</comment>
|
3932 |
<frontend_type>select</frontend_type>
|
3933 |
<source_model>adminhtml/system_config_source_yesno</source_model>
|
3934 |
+
<sort_order>9</sort_order>
|
3935 |
+
<show_in_default>1</show_in_default>
|
3936 |
+
<show_in_website>1</show_in_website>
|
3937 |
+
<show_in_store>1</show_in_store>
|
3938 |
+
<config_path>payment/pay_payment_instore/limit_shipping</config_path>
|
3939 |
+
</limit_shipping>
|
3940 |
+
<disabled_shippingmethods>
|
3941 |
+
<depends>
|
3942 |
+
<active>1</active>
|
3943 |
+
<limit_shipping>1</limit_shipping>
|
3944 |
+
</depends>
|
3945 |
+
<comment>
|
3946 |
+
Selecteer de verzendmethoden waarvoor deze betaalmethode NIET beschikbaar is
|
3947 |
+
</comment>
|
3948 |
+
<label>Geblokkeerde verzendmethoden</label>
|
3949 |
+
<frontend_type>multiselect</frontend_type>
|
3950 |
+
<source_model>adminhtml/system_config_source_shipping_allmethods</source_model>
|
3951 |
+
<sort_order>10</sort_order>
|
3952 |
+
<show_in_default>1</show_in_default>
|
3953 |
+
<show_in_website>1</show_in_website>
|
3954 |
+
<show_in_store>1</show_in_store>
|
3955 |
+
<config_path>payment/pay_payment_instore/disabled_shippingmethods</config_path>
|
3956 |
+
</disabled_shippingmethods>
|
3957 |
+
<order_status translate="label">
|
3958 |
+
<depends>
|
3959 |
+
<active>1</active>
|
3960 |
+
</depends>
|
3961 |
+
<label>Nieuwe order status</label>
|
3962 |
+
<comment>De status die een order moet krijgen bij het toevoegen</comment>
|
3963 |
+
<frontend_type>select</frontend_type>
|
3964 |
+
<source_model>pay_payment/source_status_pendingPayment</source_model>
|
3965 |
+
<sort_order>11</sort_order>
|
3966 |
+
<show_in_default>1</show_in_default>
|
3967 |
+
<show_in_website>1</show_in_website>
|
3968 |
+
<show_in_store>1</show_in_store>
|
3969 |
+
<config_path>payment/pay_payment_instore/order_status</config_path>
|
3970 |
+
</order_status>
|
3971 |
+
<order_status_success translate="label">
|
3972 |
+
<depends>
|
3973 |
+
<active>1</active>
|
3974 |
+
</depends>
|
3975 |
+
<label>Gelukt order status</label>
|
3976 |
+
<comment>De status die een order moet krijgen na succesvolle betaling</comment>
|
3977 |
+
<frontend_type>select</frontend_type>
|
3978 |
+
<source_model>pay_payment/source_status_processing</source_model>
|
3979 |
+
<sort_order>12</sort_order>
|
3980 |
+
<show_in_default>1</show_in_default>
|
3981 |
+
<show_in_website>1</show_in_website>
|
3982 |
+
<show_in_store>1</show_in_store>
|
3983 |
+
<config_path>payment/pay_payment_instore/order_status_success</config_path>
|
3984 |
+
</order_status_success>
|
3985 |
+
<charge_type translate="label">
|
3986 |
+
<depends>
|
3987 |
+
<active>1</active>
|
3988 |
+
</depends>
|
3989 |
+
<label>Extra kosten rekenen</label>
|
3990 |
+
<comment>Geef hier aan of u extra kosten wilt rekenen op basis van een percentage
|
3991 |
+
van
|
3992 |
+
het
|
3993 |
+
totaalbedrag of een vast bedrag
|
3994 |
+
</comment>
|
3995 |
+
<frontend_type>select</frontend_type>
|
3996 |
+
<source_model>pay_payment/system_config_source_chargetype</source_model>
|
3997 |
+
<sort_order>200</sort_order>
|
3998 |
+
<show_in_default>1</show_in_default>
|
3999 |
+
<show_in_website>1</show_in_website>
|
4000 |
+
<show_in_store>1</show_in_store>
|
4001 |
+
<config_path>payment/pay_payment_instore/charge_type</config_path>
|
4002 |
+
</charge_type>
|
4003 |
+
<charge_value translate="label">
|
4004 |
+
<depends>
|
4005 |
+
<active>1</active>
|
4006 |
+
</depends>
|
4007 |
+
<label>Extra kosten</label>
|
4008 |
+
<comment>Geef hier aan hoeveel extra kosten u wilt rekenen, gebruik een punt voor
|
4009 |
+
decimalen,
|
4010 |
+
als u geen extra kosten wilt rekenen vult u niets in
|
4011 |
+
</comment>
|
4012 |
+
<frontend_type>text</frontend_type>
|
4013 |
+
<sort_order>201</sort_order>
|
4014 |
+
<show_in_default>1</show_in_default>
|
4015 |
+
<show_in_website>1</show_in_website>
|
4016 |
+
<show_in_store>1</show_in_store>
|
4017 |
+
<config_path>payment/pay_payment_instore/charge_value</config_path>
|
4018 |
+
</charge_value>
|
4019 |
+
<charge_tax_class translate="label">
|
4020 |
+
<depends>
|
4021 |
+
<active>1</active>
|
4022 |
+
</depends>
|
4023 |
+
<label>Btw voor extra kosten</label>
|
4024 |
+
<frontend_type>select</frontend_type>
|
4025 |
+
<source_model>adminhtml/system_config_source_shipping_taxclass</source_model>
|
4026 |
+
<sort_order>202</sort_order>
|
4027 |
+
<show_in_default>1</show_in_default>
|
4028 |
+
<show_in_website>1</show_in_website>
|
4029 |
+
<show_in_store>1</show_in_store>
|
4030 |
+
<config_path>payment/pay_payment_instore/charge_tax_class</config_path>
|
4031 |
+
</charge_tax_class>
|
4032 |
+
<send_mail translate="label">
|
4033 |
+
<depends>
|
4034 |
+
<active>1</active>
|
4035 |
+
</depends>
|
4036 |
+
<label>Bevestigingsmail sturen</label>
|
4037 |
+
<comment>Wanneer wilt u dat de bevestigingsmail wordt verstuurd</comment>
|
4038 |
+
<sort_order>300</sort_order>
|
4039 |
+
<show_in_default>1</show_in_default>
|
4040 |
+
<show_in_website>1</show_in_website>
|
4041 |
+
<show_in_store>1</show_in_store>
|
4042 |
+
<frontend_type>select</frontend_type>
|
4043 |
+
<source_model>pay_payment/source_sendmail</source_model>
|
4044 |
+
<config_path>payment/pay_payment_instore/send_mail</config_path>
|
4045 |
+
</send_mail>
|
4046 |
+
</fields>
|
4047 |
+
</pay_payment_instore>
|
4048 |
+
<pay_payment_klarna type="group" translate="label" module="pay_payment">
|
4049 |
+
<label>Klarna</label>
|
4050 |
+
<model>pay_payment/Model_Paymentmethod_Klarna</model>
|
4051 |
+
<sort_order>2700</sort_order>
|
4052 |
+
<show_in_default>1</show_in_default>
|
4053 |
+
<show_in_website>1</show_in_website>
|
4054 |
+
<show_in_store>1</show_in_store>
|
4055 |
+
<fields>
|
4056 |
+
<active translate="label">
|
4057 |
+
<label>Actief</label>
|
4058 |
+
<comment>Wilt u deze betaalmethode gebruiken</comment>
|
4059 |
+
<sort_order>1</sort_order>
|
4060 |
+
<show_in_default>1</show_in_default>
|
4061 |
+
<show_in_website>1</show_in_website>
|
4062 |
+
<show_in_store>1</show_in_store>
|
4063 |
+
<frontend_type>select</frontend_type>
|
4064 |
+
<source_model>pay_payment/source_paymentmethod_klarna_active</source_model>
|
4065 |
+
<config_path>payment/pay_payment_klarna/active</config_path>
|
4066 |
+
</active>
|
4067 |
+
<title translate="label">
|
4068 |
+
<depends>
|
4069 |
+
<active>1</active>
|
4070 |
+
</depends>
|
4071 |
+
<label>Titel van de betaalmethode</label>
|
4072 |
+
<frontend_type>text</frontend_type>
|
4073 |
+
<sort_order>2</sort_order>
|
4074 |
<show_in_default>1</show_in_default>
|
4075 |
<show_in_website>1</show_in_website>
|
4076 |
<show_in_store>1</show_in_store>
|
4077 |
+
<config_path>payment/pay_payment_klarna/title</config_path>
|
4078 |
+
</title>
|
4079 |
<sort_order translate="label">
|
4080 |
<depends>
|
4081 |
<active>1</active>
|
7433 |
</send_mail>
|
7434 |
</fields>
|
7435 |
</pay_payment_wijncadeau>
|
7436 |
+
<pay_payment_yehhpay type="group" translate="label" module="pay_payment">
|
7437 |
+
<label>Yehhpay</label>
|
7438 |
+
<model>pay_payment/Model_Paymentmethod_Yehhpay</model>
|
7439 |
+
<sort_order>4250</sort_order>
|
7440 |
+
<show_in_default>1</show_in_default>
|
7441 |
+
<show_in_website>1</show_in_website>
|
7442 |
+
<show_in_store>1</show_in_store>
|
7443 |
+
<fields>
|
7444 |
+
<active translate="label">
|
7445 |
+
<label>Actief</label>
|
7446 |
+
<comment>Wilt u deze betaalmethode gebruiken</comment>
|
7447 |
+
<sort_order>1</sort_order>
|
7448 |
+
<show_in_default>1</show_in_default>
|
7449 |
+
<show_in_website>1</show_in_website>
|
7450 |
+
<show_in_store>1</show_in_store>
|
7451 |
+
<frontend_type>select</frontend_type>
|
7452 |
+
<source_model>pay_payment/source_paymentmethod_yehhpay_active</source_model>
|
7453 |
+
<config_path>payment/pay_payment_yehhpay/active</config_path>
|
7454 |
+
</active>
|
7455 |
+
<title translate="label">
|
7456 |
+
<depends>
|
7457 |
+
<active>1</active>
|
7458 |
+
</depends>
|
7459 |
+
<label>Titel van de betaalmethode</label>
|
7460 |
+
<frontend_type>text</frontend_type>
|
7461 |
+
<sort_order>2</sort_order>
|
7462 |
+
<show_in_default>1</show_in_default>
|
7463 |
+
<show_in_website>1</show_in_website>
|
7464 |
+
<show_in_store>1</show_in_store>
|
7465 |
+
<config_path>payment/pay_payment_yehhpay/title</config_path>
|
7466 |
+
</title>
|
7467 |
+
|
7468 |
+
<sort_order translate="label">
|
7469 |
+
<depends>
|
7470 |
+
<active>1</active>
|
7471 |
+
</depends>
|
7472 |
+
<label>Betaalmethode sorteer volgorde</label>
|
7473 |
+
<frontend_type>text</frontend_type>
|
7474 |
+
<sort_order>4</sort_order>
|
7475 |
+
<show_in_default>1</show_in_default>
|
7476 |
+
<show_in_website>1</show_in_website>
|
7477 |
+
<show_in_store>1</show_in_store>
|
7478 |
+
<config_path>payment/pay_payment_yehhpay/sort_order</config_path>
|
7479 |
+
</sort_order>
|
7480 |
+
<min_order_total translate="label">
|
7481 |
+
<depends>
|
7482 |
+
<active>1</active>
|
7483 |
+
</depends>
|
7484 |
+
<label>Minimum bedrag</label>
|
7485 |
+
<comment>Het minimum bedrag waarvoor deze betaalmethode gebruikt mag worden
|
7486 |
+
</comment>
|
7487 |
+
<frontend_type>text</frontend_type>
|
7488 |
+
<sort_order>5</sort_order>
|
7489 |
+
<show_in_default>1</show_in_default>
|
7490 |
+
<show_in_website>1</show_in_website>
|
7491 |
+
<show_in_store>1</show_in_store>
|
7492 |
+
<config_path>payment/pay_payment_yehhpay/min_order_total</config_path>
|
7493 |
+
</min_order_total>
|
7494 |
+
<max_order_total translate="label">
|
7495 |
+
<depends>
|
7496 |
+
<active>1</active>
|
7497 |
+
</depends>
|
7498 |
+
<label>Maximum bedrag</label>
|
7499 |
+
<comment>Het maximum bedrag waarvoor deze betaalmethode gebruikt mag worden
|
7500 |
+
</comment>
|
7501 |
+
<frontend_type>text</frontend_type>
|
7502 |
+
<sort_order>6</sort_order>
|
7503 |
+
<show_in_default>1</show_in_default>
|
7504 |
+
<show_in_website>1</show_in_website>
|
7505 |
+
<show_in_store>1</show_in_store>
|
7506 |
+
<config_path>payment/pay_payment_yehhpay/max_order_total</config_path>
|
7507 |
+
</max_order_total>
|
7508 |
+
<allowspecific translate="label">
|
7509 |
+
<depends>
|
7510 |
+
<active>1</active>
|
7511 |
+
</depends>
|
7512 |
+
<label>Beschikbaarheid per land</label>
|
7513 |
+
<frontend_type>allowspecific</frontend_type>
|
7514 |
+
<source_model>adminhtml/system_config_source_payment_allspecificcountries
|
7515 |
+
</source_model>
|
7516 |
+
<sort_order>7</sort_order>
|
7517 |
+
<show_in_default>1</show_in_default>
|
7518 |
+
<show_in_website>1</show_in_website>
|
7519 |
+
<show_in_store>1</show_in_store>
|
7520 |
+
<config_path>payment/pay_payment_yehhpay/allowspecific</config_path>
|
7521 |
+
</allowspecific>
|
7522 |
+
<specificcountry translate="label">
|
7523 |
+
<depends>
|
7524 |
+
<active>1</active>
|
7525 |
+
<allowspecific>1</allowspecific>
|
7526 |
+
</depends>
|
7527 |
+
<label>Toegestane landen</label>
|
7528 |
+
<frontend_type>multiselect</frontend_type>
|
7529 |
+
<source_model>adminhtml/system_config_source_country</source_model>
|
7530 |
+
<sort_order>8</sort_order>
|
7531 |
+
<show_in_default>1</show_in_default>
|
7532 |
+
<show_in_website>1</show_in_website>
|
7533 |
+
<show_in_store>1</show_in_store>
|
7534 |
+
<comment>Selecteer de landen waarvoor deze betaalmethode beschikbaar is</comment>
|
7535 |
+
<config_path>payment/pay_payment_yehhpay/specificcountry</config_path>
|
7536 |
+
</specificcountry>
|
7537 |
+
<limit_shipping translate="label">
|
7538 |
+
<depends>
|
7539 |
+
<active>1</active>
|
7540 |
+
</depends>
|
7541 |
+
<label>Verzendmethoden blokkeren</label>
|
7542 |
+
<comment>
|
7543 |
+
Schakel dit in als u deze betaalmethode wilt blokkeren voor bepaalde
|
7544 |
+
verzendmethoden
|
7545 |
+
</comment>
|
7546 |
+
<frontend_type>select</frontend_type>
|
7547 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
7548 |
+
<sort_order>9</sort_order>
|
7549 |
+
<show_in_default>1</show_in_default>
|
7550 |
+
<show_in_website>1</show_in_website>
|
7551 |
+
<show_in_store>1</show_in_store>
|
7552 |
+
<config_path>payment/pay_payment_yehhpay/limit_shipping</config_path>
|
7553 |
+
</limit_shipping>
|
7554 |
+
<disabled_shippingmethods>
|
7555 |
+
<depends>
|
7556 |
+
<active>1</active>
|
7557 |
+
<limit_shipping>1</limit_shipping>
|
7558 |
+
</depends>
|
7559 |
+
<comment>
|
7560 |
+
Selecteer de verzendmethoden waarvoor deze betaalmethode NIET beschikbaar is
|
7561 |
+
</comment>
|
7562 |
+
<label>Geblokkeerde verzendmethoden</label>
|
7563 |
+
<frontend_type>multiselect</frontend_type>
|
7564 |
+
<source_model>adminhtml/system_config_source_shipping_allmethods</source_model>
|
7565 |
+
<sort_order>10</sort_order>
|
7566 |
+
<show_in_default>1</show_in_default>
|
7567 |
+
<show_in_website>1</show_in_website>
|
7568 |
+
<show_in_store>1</show_in_store>
|
7569 |
+
<config_path>payment/pay_payment_yehhpay/disabled_shippingmethods</config_path>
|
7570 |
+
</disabled_shippingmethods>
|
7571 |
+
<order_status translate="label">
|
7572 |
+
<depends>
|
7573 |
+
<active>1</active>
|
7574 |
+
</depends>
|
7575 |
+
<label>Nieuwe order status</label>
|
7576 |
+
<comment>De status die een order moet krijgen bij het toevoegen</comment>
|
7577 |
+
<frontend_type>select</frontend_type>
|
7578 |
+
<source_model>pay_payment/source_status_pendingPayment</source_model>
|
7579 |
+
<sort_order>11</sort_order>
|
7580 |
+
<show_in_default>1</show_in_default>
|
7581 |
+
<show_in_website>1</show_in_website>
|
7582 |
+
<show_in_store>1</show_in_store>
|
7583 |
+
<config_path>payment/pay_payment_yehhpay/order_status</config_path>
|
7584 |
+
</order_status>
|
7585 |
+
<order_status_success translate="label">
|
7586 |
+
<depends>
|
7587 |
+
<active>1</active>
|
7588 |
+
</depends>
|
7589 |
+
<label>Gelukt order status</label>
|
7590 |
+
<comment>De status die een order moet krijgen na succesvolle betaling</comment>
|
7591 |
+
<frontend_type>select</frontend_type>
|
7592 |
+
<source_model>pay_payment/source_status_processing</source_model>
|
7593 |
+
<sort_order>12</sort_order>
|
7594 |
+
<show_in_default>1</show_in_default>
|
7595 |
+
<show_in_website>1</show_in_website>
|
7596 |
+
<show_in_store>1</show_in_store>
|
7597 |
+
<config_path>payment/pay_payment_yehhpay/order_status_success</config_path>
|
7598 |
+
</order_status_success>
|
7599 |
+
<charge_type translate="label">
|
7600 |
+
<depends>
|
7601 |
+
<active>1</active>
|
7602 |
+
</depends>
|
7603 |
+
<label>Extra kosten rekenen</label>
|
7604 |
+
<comment>Geef hier aan of u extra kosten wilt rekenen op basis van een percentage
|
7605 |
+
van
|
7606 |
+
het
|
7607 |
+
totaalbedrag of een vast bedrag
|
7608 |
+
</comment>
|
7609 |
+
<frontend_type>select</frontend_type>
|
7610 |
+
<source_model>pay_payment/system_config_source_chargetype</source_model>
|
7611 |
+
<sort_order>200</sort_order>
|
7612 |
+
<show_in_default>1</show_in_default>
|
7613 |
+
<show_in_website>1</show_in_website>
|
7614 |
+
<show_in_store>1</show_in_store>
|
7615 |
+
<config_path>payment/pay_payment_yehhpay/charge_type</config_path>
|
7616 |
+
</charge_type>
|
7617 |
+
<charge_value translate="label">
|
7618 |
+
<depends>
|
7619 |
+
<active>1</active>
|
7620 |
+
</depends>
|
7621 |
+
<label>Extra kosten</label>
|
7622 |
+
<comment>Geef hier aan hoeveel extra kosten u wilt rekenen, gebruik een punt voor
|
7623 |
+
decimalen,
|
7624 |
+
als u geen extra kosten wilt rekenen vult u niets in
|
7625 |
+
</comment>
|
7626 |
+
<frontend_type>text</frontend_type>
|
7627 |
+
<sort_order>201</sort_order>
|
7628 |
+
<show_in_default>1</show_in_default>
|
7629 |
+
<show_in_website>1</show_in_website>
|
7630 |
+
<show_in_store>1</show_in_store>
|
7631 |
+
<config_path>payment/pay_payment_yehhpay/charge_value</config_path>
|
7632 |
+
</charge_value>
|
7633 |
+
<charge_tax_class translate="label">
|
7634 |
+
<depends>
|
7635 |
+
<active>1</active>
|
7636 |
+
</depends>
|
7637 |
+
<label>Btw voor extra kosten</label>
|
7638 |
+
<frontend_type>select</frontend_type>
|
7639 |
+
<source_model>adminhtml/system_config_source_shipping_taxclass</source_model>
|
7640 |
+
<sort_order>202</sort_order>
|
7641 |
+
<show_in_default>1</show_in_default>
|
7642 |
+
<show_in_website>1</show_in_website>
|
7643 |
+
<show_in_store>1</show_in_store>
|
7644 |
+
<config_path>payment/pay_payment_yehhpay/charge_tax_class</config_path>
|
7645 |
+
</charge_tax_class>
|
7646 |
+
<send_mail translate="label">
|
7647 |
+
<depends>
|
7648 |
+
<active>1</active>
|
7649 |
+
</depends>
|
7650 |
+
<label>Bevestigingsmail sturen</label>
|
7651 |
+
<comment>Wanneer wilt u dat de bevestigingsmail wordt verstuurd</comment>
|
7652 |
+
<sort_order>300</sort_order>
|
7653 |
+
<show_in_default>1</show_in_default>
|
7654 |
+
<show_in_website>1</show_in_website>
|
7655 |
+
<show_in_store>1</show_in_store>
|
7656 |
+
<frontend_type>select</frontend_type>
|
7657 |
+
<source_model>pay_payment/source_sendmail</source_model>
|
7658 |
+
<config_path>payment/pay_payment_yehhpay/send_mail</config_path>
|
7659 |
+
</send_mail>
|
7660 |
+
</fields>
|
7661 |
+
</pay_payment_yehhpay>
|
7662 |
<pay_payment_yourgift type="group" translate="label" module="pay_payment">
|
7663 |
<label>YourGift</label>
|
7664 |
<model>pay_payment/Model_Paymentmethod_Yourgift</model>
|
app/code/community/Pay/Payment/sql/pay_payment_setup/install-3.1.2.8.php
DELETED
@@ -1,128 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/* @var $installer Pay_Payment_Model_Resource_Setup */
|
4 |
-
$installer = $this;
|
5 |
-
$installer->startSetup();
|
6 |
-
|
7 |
-
$installer->addAttribute('quote_address', 'payment_charge', array('type' => 'decimal'));
|
8 |
-
$installer->addAttribute('quote_address', 'base_payment_charge', array('type' => 'decimal'));
|
9 |
-
|
10 |
-
$installer->addAttribute('order', 'payment_charge', array('type' => 'decimal'));
|
11 |
-
$installer->addAttribute('order', 'base_payment_charge', array('type' => 'decimal'));
|
12 |
-
|
13 |
-
$installer->addAttribute('invoice', 'payment_charge', array('type' => 'decimal'));
|
14 |
-
$installer->addAttribute('invoice', 'base_payment_charge', array('type' => 'decimal'));
|
15 |
-
|
16 |
-
$installer->addAttribute('creditmemo', 'payment_charge', array('type' => 'decimal'));
|
17 |
-
$installer->addAttribute('creditmemo', 'base_payment_charge', array('type' => 'decimal'));
|
18 |
-
|
19 |
-
//create the pay_payment/option table
|
20 |
-
$tableName = $installer->getTable('pay_payment/option');
|
21 |
-
|
22 |
-
// Check if the table already exists
|
23 |
-
if (!$installer->getConnection()->isTableExists($tableName)) {
|
24 |
-
$table = $installer->getConnection()
|
25 |
-
->newTable($tableName)
|
26 |
-
->addColumn('internal_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
|
27 |
-
'identity' => true,
|
28 |
-
'unsigned' => true,
|
29 |
-
'nullable' => false,
|
30 |
-
'primary' => true,
|
31 |
-
), 'Payment option Id')
|
32 |
-
->addColumn('option_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
|
33 |
-
'identity' => false,
|
34 |
-
'unsigned' => true,
|
35 |
-
'nullable' => false,
|
36 |
-
), 'Payment option Id')
|
37 |
-
->addColumn('service_id', Varien_Db_Ddl_Table::TYPE_VARCHAR, 12, array(
|
38 |
-
'nullable' => false,
|
39 |
-
), 'Service Id (SL-xxxx-xxxx)')
|
40 |
-
->addColumn('name', Varien_Db_Ddl_Table::TYPE_VARCHAR, 255, array('nullable' => false), 'Payment option name')
|
41 |
-
->addColumn('image', Varien_Db_Ddl_Table::TYPE_VARCHAR, 255, array('nullable' => false), 'The url to the icon image')
|
42 |
-
->addColumn('update_date', Varien_Db_Ddl_Table::TYPE_DATETIME, null, array(
|
43 |
-
'nullable' => false
|
44 |
-
), 'The datetime this payment option was refreshed')
|
45 |
-
->addIndex($installer->getIdxName($tableName, array(
|
46 |
-
'option_id',
|
47 |
-
'service_id'
|
48 |
-
), Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE), array('option_id', 'service_id'), array('type' => Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE));
|
49 |
-
|
50 |
-
$installer->getConnection()->createTable($table);
|
51 |
-
}
|
52 |
-
|
53 |
-
//create the pay_payment/optionsub table
|
54 |
-
$tableName = $installer->getTable('pay_payment/optionsub');
|
55 |
-
|
56 |
-
// Check if the table already exists
|
57 |
-
if (!$installer->getConnection()->isTableExists($tableName)) {
|
58 |
-
$table = $installer->getConnection()
|
59 |
-
->newTable($tableName)
|
60 |
-
->addColumn('internal_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
|
61 |
-
'identity' => true,
|
62 |
-
'unsigned' => true,
|
63 |
-
'nullable' => false,
|
64 |
-
'primary' => true,
|
65 |
-
), 'Id')
|
66 |
-
->addColumn('option_sub_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
|
67 |
-
'unsigned' => true,
|
68 |
-
'nullable' => false,
|
69 |
-
), 'Payment option sub Id')
|
70 |
-
->addColumn('option_internal_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
|
71 |
-
'unsigned' => true,
|
72 |
-
'nullable' => false,
|
73 |
-
), 'Link to the payment option')
|
74 |
-
->addColumn('name', Varien_Db_Ddl_Table::TYPE_VARCHAR, 255, array('nullable' => false), 'The name of the option sub')
|
75 |
-
->addColumn('image', Varien_Db_Ddl_Table::TYPE_VARCHAR, 255, array('nullable' => false), 'The url to the icon image')
|
76 |
-
->addColumn('active', Varien_Db_Ddl_Table::TYPE_BOOLEAN, null, array('nullable' => false), 'OptionSub active or not')
|
77 |
-
->addIndex($installer->getIdxName($tableName, array('option_internal_id')), array('option_internal_id'))
|
78 |
-
->addIndex($installer->getIdxName($tableName, array('option_sub_id', 'option_internal_id'), Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE), array('option_sub_id', 'option_internal_id'), array('type' => Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE))
|
79 |
-
->addForeignKey($installer->getFkName($tableName, 'option_internal_id', 'pay_payment/option', 'internal_id'), 'option_internal_id', $installer->getTable('pay_payment/option'), 'internal_id', Varien_Db_Ddl_Table::ACTION_CASCADE, Varien_Db_Ddl_Table::ACTION_CASCADE);
|
80 |
-
$installer->getConnection()->createTable($table);
|
81 |
-
}
|
82 |
-
//create the pay_payment/optionsub table
|
83 |
-
$tableName = $installer->getTable('pay_payment/transaction');
|
84 |
-
|
85 |
-
$tableNameSalesOrder = $installer->getTable('sales/order');
|
86 |
-
|
87 |
-
// Check if the table already exists
|
88 |
-
if (!$installer->getConnection()->isTableExists($tableName)) {
|
89 |
-
$table = $installer->getConnection()
|
90 |
-
->newTable($tableName)
|
91 |
-
->addColumn('id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
|
92 |
-
'nullable' => false,
|
93 |
-
'primary' => true,
|
94 |
-
'identity' => true,
|
95 |
-
'unsigned' => true,
|
96 |
-
))
|
97 |
-
->addColumn('transaction_id', Varien_Db_Ddl_Table::TYPE_VARCHAR, 20, array(
|
98 |
-
'nullable' => false,
|
99 |
-
), 'The transaction id, generated by pay.nl')
|
100 |
-
->addColumn('service_id', Varien_Db_Ddl_Table::TYPE_VARCHAR, 12, array(
|
101 |
-
'nullable' => false,
|
102 |
-
), 'Service Id (SL-xxxx-xxxx)')
|
103 |
-
->addColumn('option_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
|
104 |
-
'unsigned' => true,
|
105 |
-
'nullable' => false
|
106 |
-
), 'The payment option id')
|
107 |
-
->addColumn('option_sub_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
|
108 |
-
'unsigned' => true,
|
109 |
-
'nullable' => true
|
110 |
-
), 'The payment option sub id')
|
111 |
-
->addColumn('amount', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
|
112 |
-
'unsigned' => false,
|
113 |
-
'nullable' => false
|
114 |
-
), 'The total amount in cents')
|
115 |
-
->addColumn('order_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
|
116 |
-
'unsigned' => true,
|
117 |
-
'nullable' => false
|
118 |
-
), 'The order entity_id (references: sales_flat_order.entity_id)')
|
119 |
-
->addColumn('status', Varien_Db_Ddl_Table::TYPE_VARCHAR, 20, array('nullable' => false), 'The status of the transaction')
|
120 |
-
->addColumn('created', Varien_Db_Ddl_Table::TYPE_DATETIME, null, array('nullable' => false), 'The datetime the transaction was created')
|
121 |
-
->addColumn('last_update', Varien_Db_Ddl_Table::TYPE_DATETIME, null, array('nullable' => false), 'The datetime the transaction was last updated')
|
122 |
-
->addIndex($installer->getIdxName($tableName, array('order_id'), Varien_Db_Adapter_Interface::INDEX_TYPE_INDEX), array('order_id'), array('type' => Varien_Db_Adapter_Interface::INDEX_TYPE_INDEX))
|
123 |
-
->addForeignKey($installer->getFkName($tableName, 'order_id', $tableNameSalesOrder, 'entity_id'), 'order_id', $tableNameSalesOrder, 'entity_id', Varien_Db_Ddl_Table::ACTION_CASCADE, Varien_Db_Ddl_Table::ACTION_CASCADE);
|
124 |
-
$installer->getConnection()->createTable($table);
|
125 |
-
}
|
126 |
-
|
127 |
-
|
128 |
-
$installer->endSetup();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Pay/Payment/sql/pay_payment_setup/install-3.7.0.php
ADDED
@@ -0,0 +1,135 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/* @var $installer Pay_Payment_Model_Resource_Setup */
|
4 |
+
$installer = $this;
|
5 |
+
$installer->startSetup();
|
6 |
+
|
7 |
+
$installer->addAttribute('quote_address', 'payment_charge', array('type' => 'decimal'));
|
8 |
+
$installer->addAttribute('quote_address', 'base_payment_charge', array('type' => 'decimal'));
|
9 |
+
|
10 |
+
$installer->addAttribute('order', 'payment_charge', array('type' => 'decimal'));
|
11 |
+
$installer->addAttribute('order', 'base_payment_charge', array('type' => 'decimal'));
|
12 |
+
|
13 |
+
$installer->addAttribute('invoice', 'payment_charge', array('type' => 'decimal'));
|
14 |
+
$installer->addAttribute('invoice', 'base_payment_charge', array('type' => 'decimal'));
|
15 |
+
|
16 |
+
$installer->addAttribute('creditmemo', 'payment_charge', array('type' => 'decimal'));
|
17 |
+
$installer->addAttribute('creditmemo', 'base_payment_charge', array('type' => 'decimal'));
|
18 |
+
|
19 |
+
//create the pay_payment/option table
|
20 |
+
$tableName = $installer->getTable('pay_payment/option');
|
21 |
+
|
22 |
+
// Check if the table already exists
|
23 |
+
if (!$installer->getConnection()->isTableExists($tableName)) {
|
24 |
+
$table = $installer->getConnection()
|
25 |
+
->newTable($tableName)
|
26 |
+
->addColumn('internal_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
|
27 |
+
'identity' => true,
|
28 |
+
'unsigned' => true,
|
29 |
+
'nullable' => false,
|
30 |
+
'primary' => true,
|
31 |
+
), 'Payment option Id')
|
32 |
+
->addColumn('option_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
|
33 |
+
'identity' => false,
|
34 |
+
'unsigned' => true,
|
35 |
+
'nullable' => false,
|
36 |
+
), 'Payment option Id')
|
37 |
+
->addColumn('service_id', Varien_Db_Ddl_Table::TYPE_VARCHAR, 12, array(
|
38 |
+
'nullable' => false,
|
39 |
+
), 'Service Id (SL-xxxx-xxxx)')
|
40 |
+
->addColumn('name', Varien_Db_Ddl_Table::TYPE_VARCHAR, 255, array('nullable' => false), 'Payment option name')
|
41 |
+
->addColumn('image', Varien_Db_Ddl_Table::TYPE_VARCHAR, 255, array('nullable' => false), 'The url to the icon image')
|
42 |
+
->addColumn('update_date', Varien_Db_Ddl_Table::TYPE_DATETIME, null, array(
|
43 |
+
'nullable' => false
|
44 |
+
), 'The datetime this payment option was refreshed')
|
45 |
+
->addIndex($installer->getIdxName($tableName, array(
|
46 |
+
'option_id',
|
47 |
+
'service_id'
|
48 |
+
), Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE), array('option_id', 'service_id'), array('type' => Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE));
|
49 |
+
|
50 |
+
$installer->getConnection()->createTable($table);
|
51 |
+
}
|
52 |
+
|
53 |
+
//create the pay_payment/optionsub table
|
54 |
+
$tableName = $installer->getTable('pay_payment/optionsub');
|
55 |
+
|
56 |
+
// Check if the table already exists
|
57 |
+
if (!$installer->getConnection()->isTableExists($tableName)) {
|
58 |
+
$table = $installer->getConnection()
|
59 |
+
->newTable($tableName)
|
60 |
+
->addColumn('internal_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
|
61 |
+
'identity' => true,
|
62 |
+
'unsigned' => true,
|
63 |
+
'nullable' => false,
|
64 |
+
'primary' => true,
|
65 |
+
), 'Id')
|
66 |
+
->addColumn('option_sub_id', Varien_Db_Ddl_Table::TYPE_TEXT, 100, array(
|
67 |
+
'nullable' => false,
|
68 |
+
), 'Payment option sub Id')
|
69 |
+
->addColumn('option_internal_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
|
70 |
+
'unsigned' => true,
|
71 |
+
'nullable' => false,
|
72 |
+
), 'Link to the payment option')
|
73 |
+
->addColumn('name', Varien_Db_Ddl_Table::TYPE_VARCHAR, 255, array('nullable' => false), 'The name of the option sub')
|
74 |
+
->addColumn('image', Varien_Db_Ddl_Table::TYPE_VARCHAR, 255, array('nullable' => false), 'The url to the icon image')
|
75 |
+
->addColumn('active', Varien_Db_Ddl_Table::TYPE_BOOLEAN, null, array('nullable' => false), 'OptionSub active or not')
|
76 |
+
->addIndex($installer->getIdxName($tableName, array('option_internal_id')), array('option_internal_id'))
|
77 |
+
->addIndex($installer->getIdxName($tableName, array('option_sub_id', 'option_internal_id'), Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE), array('option_sub_id', 'option_internal_id'), array('type' => Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE))
|
78 |
+
->addForeignKey($installer->getFkName($tableName, 'option_internal_id', 'pay_payment/option', 'internal_id'), 'option_internal_id', $installer->getTable('pay_payment/option'), 'internal_id', Varien_Db_Ddl_Table::ACTION_CASCADE, Varien_Db_Ddl_Table::ACTION_CASCADE);
|
79 |
+
$installer->getConnection()->createTable($table);
|
80 |
+
}
|
81 |
+
//create the pay_payment/optionsub table
|
82 |
+
$tableName = $installer->getTable('pay_payment/transaction');
|
83 |
+
|
84 |
+
$tableNameSalesOrder = $installer->getTable('sales/order');
|
85 |
+
|
86 |
+
// Check if the table already exists
|
87 |
+
if (!$installer->getConnection()->isTableExists($tableName)) {
|
88 |
+
$table = $installer->getConnection()
|
89 |
+
->newTable($tableName)
|
90 |
+
->addColumn('id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
|
91 |
+
'nullable' => false,
|
92 |
+
'primary' => true,
|
93 |
+
'identity' => true,
|
94 |
+
'unsigned' => true,
|
95 |
+
))
|
96 |
+
->addColumn('transaction_id', Varien_Db_Ddl_Table::TYPE_VARCHAR, 20, array(
|
97 |
+
'nullable' => false,
|
98 |
+
), 'The transaction id, generated by pay.nl')
|
99 |
+
->addColumn('service_id', Varien_Db_Ddl_Table::TYPE_VARCHAR, 12, array(
|
100 |
+
'nullable' => false,
|
101 |
+
), 'Service Id (SL-xxxx-xxxx)')
|
102 |
+
->addColumn('option_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
|
103 |
+
'unsigned' => true,
|
104 |
+
'nullable' => false
|
105 |
+
), 'The payment option id')
|
106 |
+
->addColumn('option_sub_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
|
107 |
+
'unsigned' => true,
|
108 |
+
'nullable' => true
|
109 |
+
), 'The payment option sub id')
|
110 |
+
->addColumn('amount', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
|
111 |
+
'unsigned' => false,
|
112 |
+
'nullable' => false
|
113 |
+
), 'The total amount in cents')
|
114 |
+
->addColumn('order_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
|
115 |
+
'unsigned' => true,
|
116 |
+
'nullable' => false
|
117 |
+
), 'The order entity_id (references: sales_flat_order.entity_id)')
|
118 |
+
->addColumn('status', Varien_Db_Ddl_Table::TYPE_VARCHAR, 20, array('nullable' => false), 'The status of the transaction')
|
119 |
+
->addColumn('created', Varien_Db_Ddl_Table::TYPE_DATETIME, null, array('nullable' => false), 'The datetime the transaction was created')
|
120 |
+
->addColumn('last_update', Varien_Db_Ddl_Table::TYPE_DATETIME, null, array('nullable' => false), 'The datetime the transaction was last updated')
|
121 |
+
->addColumn('lock_date', Varien_Db_Ddl_Table::TYPE_DATETIME, null, array('nullable' => true), 'The plugin uses this column to put a lock on processing this transaction, after processing this field should be null')
|
122 |
+
->addIndex($installer->getIdxName($tableName, array('order_id'), Varien_Db_Adapter_Interface::INDEX_TYPE_INDEX), array('order_id'), array('type' => Varien_Db_Adapter_Interface::INDEX_TYPE_INDEX))
|
123 |
+
->addForeignKey(
|
124 |
+
$installer->getFkName($tableName, 'order_id', $tableNameSalesOrder, 'entity_id'),
|
125 |
+
'order_id',
|
126 |
+
$tableNameSalesOrder,
|
127 |
+
'entity_id',
|
128 |
+
Varien_Db_Ddl_Table::ACTION_CASCADE,
|
129 |
+
Varien_Db_Ddl_Table::ACTION_CASCADE);
|
130 |
+
|
131 |
+
$installer->getConnection()->createTable($table);
|
132 |
+
}
|
133 |
+
|
134 |
+
|
135 |
+
$installer->endSetup();
|
app/code/community/Pay/Payment/sql/pay_payment_setup/upgrade-3.2.1-3.2.2.php
CHANGED
@@ -8,7 +8,17 @@ $tableNameSalesOrder = $installer->getTable('sales/order');
|
|
8 |
|
9 |
if ($installer->getConnection()->isTableExists($tableName)) {
|
10 |
$installer->getConnection()
|
11 |
-
->dropForeignKey(
|
12 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
13 |
}
|
14 |
$installer->endSetup();
|
8 |
|
9 |
if ($installer->getConnection()->isTableExists($tableName)) {
|
10 |
$installer->getConnection()
|
11 |
+
->dropForeignKey(
|
12 |
+
$tableName,
|
13 |
+
$installer->getFkName($tableName, 'order_id', $tableNameSalesOrder, 'entity_id')
|
14 |
+
)
|
15 |
+
->addForeignKey(
|
16 |
+
$installer->getFkName($tableName, 'order_id', $tableNameSalesOrder, 'entity_id'),
|
17 |
+
$tableName,
|
18 |
+
'order_id',
|
19 |
+
$tableNameSalesOrder,
|
20 |
+
'entity_id',
|
21 |
+
Varien_Db_Ddl_Table::ACTION_CASCADE,
|
22 |
+
Varien_Db_Ddl_Table::ACTION_CASCADE);
|
23 |
}
|
24 |
$installer->endSetup();
|
app/code/community/Pay/Payment/sql/pay_payment_setup/upgrade-3.6.5-3.6.6.php
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/* @var $installer Mage_Sales_Model_Mysql4_Setup */
|
3 |
+
$installer = $this;
|
4 |
+
$installer->startSetup();
|
5 |
+
|
6 |
+
$tableName = $installer->getTable('pay_payment/transaction');
|
7 |
+
|
8 |
+
if ($installer->getConnection()->isTableExists($tableName)) {
|
9 |
+
$installer->getConnection()->addColumn($tableName, 'lock_date', array(
|
10 |
+
'type' => Varien_Db_Ddl_Table::TYPE_DATETIME,
|
11 |
+
'nullable' => true,
|
12 |
+
'comment' => 'The plugin uses this column to put a lock on processing this transaction, after processing this field should be null'
|
13 |
+
));
|
14 |
+
}
|
15 |
+
|
16 |
+
$installer->endSetup();
|
app/code/community/Pay/Payment/sql/pay_payment_setup/upgrade-3.6.6-3.7.0.php
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/* @var $installer Mage_Sales_Model_Mysql4_Setup */
|
3 |
+
$installer = $this;
|
4 |
+
$installer->startSetup();
|
5 |
+
|
6 |
+
$tableName = $installer->getTable('pay_payment/optionsub');
|
7 |
+
|
8 |
+
if ($installer->getConnection()->isTableExists($tableName)) {
|
9 |
+
$installer->getConnection()->modifyColumn($tableName, 'option_sub_id', array(
|
10 |
+
'type' => Varien_Db_Ddl_Table::TYPE_TEXT,
|
11 |
+
'nullable' => false,
|
12 |
+
'length' => 100
|
13 |
+
));
|
14 |
+
}
|
15 |
+
|
16 |
+
$installer->endSetup();
|
app/code/community/Pay/Payment/vendor/autoload.php
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
// autoload.php @generated by Composer
|
4 |
+
|
5 |
+
require_once __DIR__ . '/composer' . '/autoload_real.php';
|
6 |
+
|
7 |
+
return ComposerAutoloaderInitea3453e1b724e71ac1e1487d7036efba::getLoader();
|
app/code/community/Pay/Payment/vendor/composer/ClassLoader.php
ADDED
@@ -0,0 +1,413 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Composer.
|
5 |
+
*
|
6 |
+
* (c) Nils Adermann <naderman@naderman.de>
|
7 |
+
* Jordi Boggiano <j.boggiano@seld.be>
|
8 |
+
*
|
9 |
+
* For the full copyright and license information, please view the LICENSE
|
10 |
+
* file that was distributed with this source code.
|
11 |
+
*/
|
12 |
+
|
13 |
+
namespace Composer\Autoload;
|
14 |
+
|
15 |
+
/**
|
16 |
+
* ClassLoader implements a PSR-0, PSR-4 and classmap class loader.
|
17 |
+
*
|
18 |
+
* $loader = new \Composer\Autoload\ClassLoader();
|
19 |
+
*
|
20 |
+
* // register classes with namespaces
|
21 |
+
* $loader->add('Symfony\Component', __DIR__.'/component');
|
22 |
+
* $loader->add('Symfony', __DIR__.'/framework');
|
23 |
+
*
|
24 |
+
* // activate the autoloader
|
25 |
+
* $loader->register();
|
26 |
+
*
|
27 |
+
* // to enable searching the include path (eg. for PEAR packages)
|
28 |
+
* $loader->setUseIncludePath(true);
|
29 |
+
*
|
30 |
+
* In this example, if you try to use a class in the Symfony\Component
|
31 |
+
* namespace or one of its children (Symfony\Component\Console for instance),
|
32 |
+
* the autoloader will first look for the class under the component/
|
33 |
+
* directory, and it will then fallback to the framework/ directory if not
|
34 |
+
* found before giving up.
|
35 |
+
*
|
36 |
+
* This class is loosely based on the Symfony UniversalClassLoader.
|
37 |
+
*
|
38 |
+
* @author Fabien Potencier <fabien@symfony.com>
|
39 |
+
* @author Jordi Boggiano <j.boggiano@seld.be>
|
40 |
+
* @see http://www.php-fig.org/psr/psr-0/
|
41 |
+
* @see http://www.php-fig.org/psr/psr-4/
|
42 |
+
*/
|
43 |
+
class ClassLoader
|
44 |
+
{
|
45 |
+
// PSR-4
|
46 |
+
private $prefixLengthsPsr4 = array();
|
47 |
+
private $prefixDirsPsr4 = array();
|
48 |
+
private $fallbackDirsPsr4 = array();
|
49 |
+
|
50 |
+
// PSR-0
|
51 |
+
private $prefixesPsr0 = array();
|
52 |
+
private $fallbackDirsPsr0 = array();
|
53 |
+
|
54 |
+
private $useIncludePath = false;
|
55 |
+
private $classMap = array();
|
56 |
+
|
57 |
+
private $classMapAuthoritative = false;
|
58 |
+
|
59 |
+
public function getPrefixes()
|
60 |
+
{
|
61 |
+
if (!empty($this->prefixesPsr0)) {
|
62 |
+
return call_user_func_array('array_merge', $this->prefixesPsr0);
|
63 |
+
}
|
64 |
+
|
65 |
+
return array();
|
66 |
+
}
|
67 |
+
|
68 |
+
public function getPrefixesPsr4()
|
69 |
+
{
|
70 |
+
return $this->prefixDirsPsr4;
|
71 |
+
}
|
72 |
+
|
73 |
+
public function getFallbackDirs()
|
74 |
+
{
|
75 |
+
return $this->fallbackDirsPsr0;
|
76 |
+
}
|
77 |
+
|
78 |
+
public function getFallbackDirsPsr4()
|
79 |
+
{
|
80 |
+
return $this->fallbackDirsPsr4;
|
81 |
+
}
|
82 |
+
|
83 |
+
public function getClassMap()
|
84 |
+
{
|
85 |
+
return $this->classMap;
|
86 |
+
}
|
87 |
+
|
88 |
+
/**
|
89 |
+
* @param array $classMap Class to filename map
|
90 |
+
*/
|
91 |
+
public function addClassMap(array $classMap)
|
92 |
+
{
|
93 |
+
if ($this->classMap) {
|
94 |
+
$this->classMap = array_merge($this->classMap, $classMap);
|
95 |
+
} else {
|
96 |
+
$this->classMap = $classMap;
|
97 |
+
}
|
98 |
+
}
|
99 |
+
|
100 |
+
/**
|
101 |
+
* Registers a set of PSR-0 directories for a given prefix, either
|
102 |
+
* appending or prepending to the ones previously set for this prefix.
|
103 |
+
*
|
104 |
+
* @param string $prefix The prefix
|
105 |
+
* @param array|string $paths The PSR-0 root directories
|
106 |
+
* @param bool $prepend Whether to prepend the directories
|
107 |
+
*/
|
108 |
+
public function add($prefix, $paths, $prepend = false)
|
109 |
+
{
|
110 |
+
if (!$prefix) {
|
111 |
+
if ($prepend) {
|
112 |
+
$this->fallbackDirsPsr0 = array_merge(
|
113 |
+
(array) $paths,
|
114 |
+
$this->fallbackDirsPsr0
|
115 |
+
);
|
116 |
+
} else {
|
117 |
+
$this->fallbackDirsPsr0 = array_merge(
|
118 |
+
$this->fallbackDirsPsr0,
|
119 |
+
(array) $paths
|
120 |
+
);
|
121 |
+
}
|
122 |
+
|
123 |
+
return;
|
124 |
+
}
|
125 |
+
|
126 |
+
$first = $prefix[0];
|
127 |
+
if (!isset($this->prefixesPsr0[$first][$prefix])) {
|
128 |
+
$this->prefixesPsr0[$first][$prefix] = (array) $paths;
|
129 |
+
|
130 |
+
return;
|
131 |
+
}
|
132 |
+
if ($prepend) {
|
133 |
+
$this->prefixesPsr0[$first][$prefix] = array_merge(
|
134 |
+
(array) $paths,
|
135 |
+
$this->prefixesPsr0[$first][$prefix]
|
136 |
+
);
|
137 |
+
} else {
|
138 |
+
$this->prefixesPsr0[$first][$prefix] = array_merge(
|
139 |
+
$this->prefixesPsr0[$first][$prefix],
|
140 |
+
(array) $paths
|
141 |
+
);
|
142 |
+
}
|
143 |
+
}
|
144 |
+
|
145 |
+
/**
|
146 |
+
* Registers a set of PSR-4 directories for a given namespace, either
|
147 |
+
* appending or prepending to the ones previously set for this namespace.
|
148 |
+
*
|
149 |
+
* @param string $prefix The prefix/namespace, with trailing '\\'
|
150 |
+
* @param array|string $paths The PSR-4 base directories
|
151 |
+
* @param bool $prepend Whether to prepend the directories
|
152 |
+
*
|
153 |
+
* @throws \InvalidArgumentException
|
154 |
+
*/
|
155 |
+
public function addPsr4($prefix, $paths, $prepend = false)
|
156 |
+
{
|
157 |
+
if (!$prefix) {
|
158 |
+
// Register directories for the root namespace.
|
159 |
+
if ($prepend) {
|
160 |
+
$this->fallbackDirsPsr4 = array_merge(
|
161 |
+
(array) $paths,
|
162 |
+
$this->fallbackDirsPsr4
|
163 |
+
);
|
164 |
+
} else {
|
165 |
+
$this->fallbackDirsPsr4 = array_merge(
|
166 |
+
$this->fallbackDirsPsr4,
|
167 |
+
(array) $paths
|
168 |
+
);
|
169 |
+
}
|
170 |
+
} elseif (!isset($this->prefixDirsPsr4[$prefix])) {
|
171 |
+
// Register directories for a new namespace.
|
172 |
+
$length = strlen($prefix);
|
173 |
+
if ('\\' !== $prefix[$length - 1]) {
|
174 |
+
throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
|
175 |
+
}
|
176 |
+
$this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
|
177 |
+
$this->prefixDirsPsr4[$prefix] = (array) $paths;
|
178 |
+
} elseif ($prepend) {
|
179 |
+
// Prepend directories for an already registered namespace.
|
180 |
+
$this->prefixDirsPsr4[$prefix] = array_merge(
|
181 |
+
(array) $paths,
|
182 |
+
$this->prefixDirsPsr4[$prefix]
|
183 |
+
);
|
184 |
+
} else {
|
185 |
+
// Append directories for an already registered namespace.
|
186 |
+
$this->prefixDirsPsr4[$prefix] = array_merge(
|
187 |
+
$this->prefixDirsPsr4[$prefix],
|
188 |
+
(array) $paths
|
189 |
+
);
|
190 |
+
}
|
191 |
+
}
|
192 |
+
|
193 |
+
/**
|
194 |
+
* Registers a set of PSR-0 directories for a given prefix,
|
195 |
+
* replacing any others previously set for this prefix.
|
196 |
+
*
|
197 |
+
* @param string $prefix The prefix
|
198 |
+
* @param array|string $paths The PSR-0 base directories
|
199 |
+
*/
|
200 |
+
public function set($prefix, $paths)
|
201 |
+
{
|
202 |
+
if (!$prefix) {
|
203 |
+
$this->fallbackDirsPsr0 = (array) $paths;
|
204 |
+
} else {
|
205 |
+
$this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths;
|
206 |
+
}
|
207 |
+
}
|
208 |
+
|
209 |
+
/**
|
210 |
+
* Registers a set of PSR-4 directories for a given namespace,
|
211 |
+
* replacing any others previously set for this namespace.
|
212 |
+
*
|
213 |
+
* @param string $prefix The prefix/namespace, with trailing '\\'
|
214 |
+
* @param array|string $paths The PSR-4 base directories
|
215 |
+
*
|
216 |
+
* @throws \InvalidArgumentException
|
217 |
+
*/
|
218 |
+
public function setPsr4($prefix, $paths)
|
219 |
+
{
|
220 |
+
if (!$prefix) {
|
221 |
+
$this->fallbackDirsPsr4 = (array) $paths;
|
222 |
+
} else {
|
223 |
+
$length = strlen($prefix);
|
224 |
+
if ('\\' !== $prefix[$length - 1]) {
|
225 |
+
throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
|
226 |
+
}
|
227 |
+
$this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
|
228 |
+
$this->prefixDirsPsr4[$prefix] = (array) $paths;
|
229 |
+
}
|
230 |
+
}
|
231 |
+
|
232 |
+
/**
|
233 |
+
* Turns on searching the include path for class files.
|
234 |
+
*
|
235 |
+
* @param bool $useIncludePath
|
236 |
+
*/
|
237 |
+
public function setUseIncludePath($useIncludePath)
|
238 |
+
{
|
239 |
+
$this->useIncludePath = $useIncludePath;
|
240 |
+
}
|
241 |
+
|
242 |
+
/**
|
243 |
+
* Can be used to check if the autoloader uses the include path to check
|
244 |
+
* for classes.
|
245 |
+
*
|
246 |
+
* @return bool
|
247 |
+
*/
|
248 |
+
public function getUseIncludePath()
|
249 |
+
{
|
250 |
+
return $this->useIncludePath;
|
251 |
+
}
|
252 |
+
|
253 |
+
/**
|
254 |
+
* Turns off searching the prefix and fallback directories for classes
|
255 |
+
* that have not been registered with the class map.
|
256 |
+
*
|
257 |
+
* @param bool $classMapAuthoritative
|
258 |
+
*/
|
259 |
+
public function setClassMapAuthoritative($classMapAuthoritative)
|
260 |
+
{
|
261 |
+
$this->classMapAuthoritative = $classMapAuthoritative;
|
262 |
+
}
|
263 |
+
|
264 |
+
/**
|
265 |
+
* Should class lookup fail if not found in the current class map?
|
266 |
+
*
|
267 |
+
* @return bool
|
268 |
+
*/
|
269 |
+
public function isClassMapAuthoritative()
|
270 |
+
{
|
271 |
+
return $this->classMapAuthoritative;
|
272 |
+
}
|
273 |
+
|
274 |
+
/**
|
275 |
+
* Registers this instance as an autoloader.
|
276 |
+
*
|
277 |
+
* @param bool $prepend Whether to prepend the autoloader or not
|
278 |
+
*/
|
279 |
+
public function register($prepend = false)
|
280 |
+
{
|
281 |
+
spl_autoload_register(array($this, 'loadClass'), true, $prepend);
|
282 |
+
}
|
283 |
+
|
284 |
+
/**
|
285 |
+
* Unregisters this instance as an autoloader.
|
286 |
+
*/
|
287 |
+
public function unregister()
|
288 |
+
{
|
289 |
+
spl_autoload_unregister(array($this, 'loadClass'));
|
290 |
+
}
|
291 |
+
|
292 |
+
/**
|
293 |
+
* Loads the given class or interface.
|
294 |
+
*
|
295 |
+
* @param string $class The name of the class
|
296 |
+
* @return bool|null True if loaded, null otherwise
|
297 |
+
*/
|
298 |
+
public function loadClass($class)
|
299 |
+
{
|
300 |
+
if ($file = $this->findFile($class)) {
|
301 |
+
includeFile($file);
|
302 |
+
|
303 |
+
return true;
|
304 |
+
}
|
305 |
+
}
|
306 |
+
|
307 |
+
/**
|
308 |
+
* Finds the path to the file where the class is defined.
|
309 |
+
*
|
310 |
+
* @param string $class The name of the class
|
311 |
+
*
|
312 |
+
* @return string|false The path if found, false otherwise
|
313 |
+
*/
|
314 |
+
public function findFile($class)
|
315 |
+
{
|
316 |
+
// work around for PHP 5.3.0 - 5.3.2 https://bugs.php.net/50731
|
317 |
+
if ('\\' == $class[0]) {
|
318 |
+
$class = substr($class, 1);
|
319 |
+
}
|
320 |
+
|
321 |
+
// class map lookup
|
322 |
+
if (isset($this->classMap[$class])) {
|
323 |
+
return $this->classMap[$class];
|
324 |
+
}
|
325 |
+
if ($this->classMapAuthoritative) {
|
326 |
+
return false;
|
327 |
+
}
|
328 |
+
|
329 |
+
$file = $this->findFileWithExtension($class, '.php');
|
330 |
+
|
331 |
+
// Search for Hack files if we are running on HHVM
|
332 |
+
if ($file === null && defined('HHVM_VERSION')) {
|
333 |
+
$file = $this->findFileWithExtension($class, '.hh');
|
334 |
+
}
|
335 |
+
|
336 |
+
if ($file === null) {
|
337 |
+
// Remember that this class does not exist.
|
338 |
+
return $this->classMap[$class] = false;
|
339 |
+
}
|
340 |
+
|
341 |
+
return $file;
|
342 |
+
}
|
343 |
+
|
344 |
+
private function findFileWithExtension($class, $ext)
|
345 |
+
{
|
346 |
+
// PSR-4 lookup
|
347 |
+
$logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext;
|
348 |
+
|
349 |
+
$first = $class[0];
|
350 |
+
if (isset($this->prefixLengthsPsr4[$first])) {
|
351 |
+
foreach ($this->prefixLengthsPsr4[$first] as $prefix => $length) {
|
352 |
+
if (0 === strpos($class, $prefix)) {
|
353 |
+
foreach ($this->prefixDirsPsr4[$prefix] as $dir) {
|
354 |
+
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $length))) {
|
355 |
+
return $file;
|
356 |
+
}
|
357 |
+
}
|
358 |
+
}
|
359 |
+
}
|
360 |
+
}
|
361 |
+
|
362 |
+
// PSR-4 fallback dirs
|
363 |
+
foreach ($this->fallbackDirsPsr4 as $dir) {
|
364 |
+
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) {
|
365 |
+
return $file;
|
366 |
+
}
|
367 |
+
}
|
368 |
+
|
369 |
+
// PSR-0 lookup
|
370 |
+
if (false !== $pos = strrpos($class, '\\')) {
|
371 |
+
// namespaced class name
|
372 |
+
$logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1)
|
373 |
+
. strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR);
|
374 |
+
} else {
|
375 |
+
// PEAR-like class name
|
376 |
+
$logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext;
|
377 |
+
}
|
378 |
+
|
379 |
+
if (isset($this->prefixesPsr0[$first])) {
|
380 |
+
foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) {
|
381 |
+
if (0 === strpos($class, $prefix)) {
|
382 |
+
foreach ($dirs as $dir) {
|
383 |
+
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
|
384 |
+
return $file;
|
385 |
+
}
|
386 |
+
}
|
387 |
+
}
|
388 |
+
}
|
389 |
+
}
|
390 |
+
|
391 |
+
// PSR-0 fallback dirs
|
392 |
+
foreach ($this->fallbackDirsPsr0 as $dir) {
|
393 |
+
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
|
394 |
+
return $file;
|
395 |
+
}
|
396 |
+
}
|
397 |
+
|
398 |
+
// PSR-0 include paths.
|
399 |
+
if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) {
|
400 |
+
return $file;
|
401 |
+
}
|
402 |
+
}
|
403 |
+
}
|
404 |
+
|
405 |
+
/**
|
406 |
+
* Scope isolated include.
|
407 |
+
*
|
408 |
+
* Prevents access to $this/self from included files.
|
409 |
+
*/
|
410 |
+
function includeFile($file)
|
411 |
+
{
|
412 |
+
include $file;
|
413 |
+
}
|
app/code/community/Pay/Payment/vendor/composer/LICENSE
ADDED
@@ -0,0 +1,56 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
|
2 |
+
Upstream-Name: Composer
|
3 |
+
Upstream-Contact: Jordi Boggiano <j.boggiano@seld.be>
|
4 |
+
Source: https://github.com/composer/composer
|
5 |
+
|
6 |
+
Files: *
|
7 |
+
Copyright: 2016, Nils Adermann <naderman@naderman.de>
|
8 |
+
2016, Jordi Boggiano <j.boggiano@seld.be>
|
9 |
+
License: Expat
|
10 |
+
|
11 |
+
Files: src/Composer/Util/TlsHelper.php
|
12 |
+
Copyright: 2016, Nils Adermann <naderman@naderman.de>
|
13 |
+
2016, Jordi Boggiano <j.boggiano@seld.be>
|
14 |
+
2013, Evan Coury <me@evancoury.com>
|
15 |
+
License: Expat and BSD-2-Clause
|
16 |
+
|
17 |
+
License: BSD-2-Clause
|
18 |
+
Redistribution and use in source and binary forms, with or without modification,
|
19 |
+
are permitted provided that the following conditions are met:
|
20 |
+
.
|
21 |
+
* Redistributions of source code must retain the above copyright notice,
|
22 |
+
this list of conditions and the following disclaimer.
|
23 |
+
.
|
24 |
+
* Redistributions in binary form must reproduce the above copyright notice,
|
25 |
+
this list of conditions and the following disclaimer in the documentation
|
26 |
+
and/or other materials provided with the distribution.
|
27 |
+
.
|
28 |
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
29 |
+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
30 |
+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
31 |
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
32 |
+
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
33 |
+
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
34 |
+
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
35 |
+
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
36 |
+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
37 |
+
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
38 |
+
|
39 |
+
License: Expat
|
40 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
41 |
+
of this software and associated documentation files (the "Software"), to deal
|
42 |
+
in the Software without restriction, including without limitation the rights
|
43 |
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
44 |
+
copies of the Software, and to permit persons to whom the Software is furnished
|
45 |
+
to do so, subject to the following conditions:
|
46 |
+
.
|
47 |
+
The above copyright notice and this permission notice shall be included in all
|
48 |
+
copies or substantial portions of the Software.
|
49 |
+
.
|
50 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
51 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
52 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
53 |
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
54 |
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
55 |
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
56 |
+
THE SOFTWARE.
|
app/code/community/Pay/Payment/vendor/composer/autoload_classmap.php
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
// autoload_classmap.php @generated by Composer
|
4 |
+
|
5 |
+
$vendorDir = dirname(dirname(__FILE__));
|
6 |
+
$baseDir = dirname($vendorDir);
|
7 |
+
|
8 |
+
return array(
|
9 |
+
);
|
app/code/community/Pay/Payment/vendor/composer/autoload_namespaces.php
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
// autoload_namespaces.php @generated by Composer
|
4 |
+
|
5 |
+
$vendorDir = dirname(dirname(__FILE__));
|
6 |
+
$baseDir = dirname($vendorDir);
|
7 |
+
|
8 |
+
return array(
|
9 |
+
);
|
app/code/community/Pay/Payment/vendor/composer/autoload_psr4.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
// autoload_psr4.php @generated by Composer
|
4 |
+
|
5 |
+
$vendorDir = dirname(dirname(__FILE__));
|
6 |
+
$baseDir = dirname($vendorDir);
|
7 |
+
|
8 |
+
return array(
|
9 |
+
'Paynl\\' => array($vendorDir . '/paynl/sdk/src'),
|
10 |
+
'Curl\\' => array($vendorDir . '/php-curl-class/php-curl-class/src/Curl'),
|
11 |
+
);
|
app/code/community/Pay/Payment/vendor/composer/autoload_real.php
ADDED
@@ -0,0 +1,52 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
// autoload_real.php @generated by Composer
|
4 |
+
|
5 |
+
class ComposerAutoloaderInitea3453e1b724e71ac1e1487d7036efba
|
6 |
+
{
|
7 |
+
private static $loader;
|
8 |
+
|
9 |
+
public static function loadClassLoader($class)
|
10 |
+
{
|
11 |
+
if ('Composer\Autoload\ClassLoader' === $class) {
|
12 |
+
require __DIR__ . '/ClassLoader.php';
|
13 |
+
}
|
14 |
+
}
|
15 |
+
|
16 |
+
public static function getLoader()
|
17 |
+
{
|
18 |
+
if (null !== self::$loader) {
|
19 |
+
return self::$loader;
|
20 |
+
}
|
21 |
+
|
22 |
+
spl_autoload_register(array('ComposerAutoloaderInitea3453e1b724e71ac1e1487d7036efba', 'loadClassLoader'), true, true);
|
23 |
+
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
|
24 |
+
spl_autoload_unregister(array('ComposerAutoloaderInitea3453e1b724e71ac1e1487d7036efba', 'loadClassLoader'));
|
25 |
+
|
26 |
+
$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION');
|
27 |
+
if ($useStaticLoader) {
|
28 |
+
require_once __DIR__ . '/autoload_static.php';
|
29 |
+
|
30 |
+
call_user_func(\Composer\Autoload\ComposerStaticInitea3453e1b724e71ac1e1487d7036efba::getInitializer($loader));
|
31 |
+
} else {
|
32 |
+
$map = require __DIR__ . '/autoload_namespaces.php';
|
33 |
+
foreach ($map as $namespace => $path) {
|
34 |
+
$loader->set($namespace, $path);
|
35 |
+
}
|
36 |
+
|
37 |
+
$map = require __DIR__ . '/autoload_psr4.php';
|
38 |
+
foreach ($map as $namespace => $path) {
|
39 |
+
$loader->setPsr4($namespace, $path);
|
40 |
+
}
|
41 |
+
|
42 |
+
$classMap = require __DIR__ . '/autoload_classmap.php';
|
43 |
+
if ($classMap) {
|
44 |
+
$loader->addClassMap($classMap);
|
45 |
+
}
|
46 |
+
}
|
47 |
+
|
48 |
+
$loader->register(true);
|
49 |
+
|
50 |
+
return $loader;
|
51 |
+
}
|
52 |
+
}
|
app/code/community/Pay/Payment/vendor/composer/autoload_static.php
ADDED
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
// autoload_static.php @generated by Composer
|
4 |
+
|
5 |
+
namespace Composer\Autoload;
|
6 |
+
|
7 |
+
class ComposerStaticInitea3453e1b724e71ac1e1487d7036efba
|
8 |
+
{
|
9 |
+
public static $prefixLengthsPsr4 = array (
|
10 |
+
'P' =>
|
11 |
+
array (
|
12 |
+
'Paynl\\' => 6,
|
13 |
+
),
|
14 |
+
'C' =>
|
15 |
+
array (
|
16 |
+
'Curl\\' => 5,
|
17 |
+
),
|
18 |
+
);
|
19 |
+
|
20 |
+
public static $prefixDirsPsr4 = array (
|
21 |
+
'Paynl\\' =>
|
22 |
+
array (
|
23 |
+
0 => __DIR__ . '/..' . '/paynl/sdk/src',
|
24 |
+
),
|
25 |
+
'Curl\\' =>
|
26 |
+
array (
|
27 |
+
0 => __DIR__ . '/..' . '/php-curl-class/php-curl-class/src/Curl',
|
28 |
+
),
|
29 |
+
);
|
30 |
+
|
31 |
+
public static function getInitializer(ClassLoader $loader)
|
32 |
+
{
|
33 |
+
return \Closure::bind(function () use ($loader) {
|
34 |
+
$loader->prefixLengthsPsr4 = ComposerStaticInitea3453e1b724e71ac1e1487d7036efba::$prefixLengthsPsr4;
|
35 |
+
$loader->prefixDirsPsr4 = ComposerStaticInitea3453e1b724e71ac1e1487d7036efba::$prefixDirsPsr4;
|
36 |
+
|
37 |
+
}, null, ClassLoader::class);
|
38 |
+
}
|
39 |
+
}
|
app/code/community/Pay/Payment/vendor/composer/installed.json
ADDED
@@ -0,0 +1,98 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
[
|
2 |
+
{
|
3 |
+
"name": "php-curl-class/php-curl-class",
|
4 |
+
"version": "4.13.0",
|
5 |
+
"version_normalized": "4.13.0.0",
|
6 |
+
"source": {
|
7 |
+
"type": "git",
|
8 |
+
"url": "https://github.com/php-curl-class/php-curl-class.git",
|
9 |
+
"reference": "debe0a89ee1eb9a2f15c0bb63ce8b347130af50d"
|
10 |
+
},
|
11 |
+
"dist": {
|
12 |
+
"type": "zip",
|
13 |
+
"url": "https://api.github.com/repos/php-curl-class/php-curl-class/zipball/debe0a89ee1eb9a2f15c0bb63ce8b347130af50d",
|
14 |
+
"reference": "debe0a89ee1eb9a2f15c0bb63ce8b347130af50d",
|
15 |
+
"shasum": ""
|
16 |
+
},
|
17 |
+
"require": {
|
18 |
+
"ext-curl": "*",
|
19 |
+
"php": ">=5.3"
|
20 |
+
},
|
21 |
+
"require-dev": {
|
22 |
+
"phpunit/phpunit": "*"
|
23 |
+
},
|
24 |
+
"time": "2016-07-25 19:31:39",
|
25 |
+
"type": "library",
|
26 |
+
"installation-source": "dist",
|
27 |
+
"autoload": {
|
28 |
+
"psr-4": {
|
29 |
+
"Curl\\": "src/Curl/"
|
30 |
+
}
|
31 |
+
},
|
32 |
+
"notification-url": "https://packagist.org/downloads/",
|
33 |
+
"license": [
|
34 |
+
"Unlicense"
|
35 |
+
],
|
36 |
+
"authors": [
|
37 |
+
{
|
38 |
+
"name": "Zach Borboa"
|
39 |
+
}
|
40 |
+
],
|
41 |
+
"description": "PHP Curl Class is an object-oriented wrapper of the PHP cURL extension.",
|
42 |
+
"homepage": "https://github.com/php-curl-class/php-curl-class",
|
43 |
+
"keywords": [
|
44 |
+
"api",
|
45 |
+
"class",
|
46 |
+
"client",
|
47 |
+
"curl",
|
48 |
+
"framework",
|
49 |
+
"http",
|
50 |
+
"http client",
|
51 |
+
"json",
|
52 |
+
"php",
|
53 |
+
"requests",
|
54 |
+
"rest",
|
55 |
+
"restful",
|
56 |
+
"web service",
|
57 |
+
"xml"
|
58 |
+
]
|
59 |
+
},
|
60 |
+
{
|
61 |
+
"name": "paynl/sdk",
|
62 |
+
"version": "v1.2.9",
|
63 |
+
"version_normalized": "1.2.9.0",
|
64 |
+
"source": {
|
65 |
+
"type": "git",
|
66 |
+
"url": "https://github.com/paynl/sdk.git",
|
67 |
+
"reference": "3521f99df7f9d34709b8fb1acfab10423084407f"
|
68 |
+
},
|
69 |
+
"dist": {
|
70 |
+
"type": "zip",
|
71 |
+
"url": "https://api.github.com/repos/paynl/sdk/zipball/3521f99df7f9d34709b8fb1acfab10423084407f",
|
72 |
+
"reference": "3521f99df7f9d34709b8fb1acfab10423084407f",
|
73 |
+
"shasum": ""
|
74 |
+
},
|
75 |
+
"require": {
|
76 |
+
"php-curl-class/php-curl-class": "^4.8"
|
77 |
+
},
|
78 |
+
"require-dev": {
|
79 |
+
"phpunit/phpunit": "^4.8",
|
80 |
+
"satooshi/php-coveralls": "~1.0"
|
81 |
+
},
|
82 |
+
"time": "2017-03-14 16:42:11",
|
83 |
+
"type": "library",
|
84 |
+
"installation-source": "dist",
|
85 |
+
"autoload": {
|
86 |
+
"psr-4": {
|
87 |
+
"Paynl\\": "src/"
|
88 |
+
}
|
89 |
+
},
|
90 |
+
"notification-url": "https://packagist.org/downloads/",
|
91 |
+
"authors": [
|
92 |
+
{
|
93 |
+
"name": "Andy Pieters",
|
94 |
+
"email": "andy@pay.nl"
|
95 |
+
}
|
96 |
+
]
|
97 |
+
}
|
98 |
+
]
|
app/code/community/Pay/Payment/vendor/paynl/sdk/.gitignore
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
nbproject/*
|
2 |
+
composer.lock
|
3 |
+
samples/config.php
|
4 |
+
.idea/*
|
5 |
+
vendor/
|
app/code/community/Pay/Payment/vendor/paynl/sdk/.travis.yml
ADDED
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
language: php
|
2 |
+
|
3 |
+
sudo: false
|
4 |
+
|
5 |
+
# whitelist for building branches
|
6 |
+
branches:
|
7 |
+
only:
|
8 |
+
- master
|
9 |
+
- stable
|
10 |
+
|
11 |
+
matrix:
|
12 |
+
include:
|
13 |
+
- php: 5.3
|
14 |
+
- php: 5.4
|
15 |
+
- php: 5.5
|
16 |
+
- php: 5.6
|
17 |
+
- php: 7
|
18 |
+
- php: 7.1
|
19 |
+
fast_finish: true
|
20 |
+
|
21 |
+
before_install:
|
22 |
+
- composer self-update
|
23 |
+
|
24 |
+
before_script:
|
25 |
+
- composer install
|
26 |
+
|
27 |
+
script:
|
28 |
+
- vendor/bin/phpunit --bootstrap vendor/autoload.php --coverage-clover build/logs/clover.xml tests/
|
29 |
+
|
30 |
+
after_success:
|
31 |
+
- travis_retry php vendor/bin/coveralls
|
app/code/community/Pay/Payment/vendor/paynl/sdk/README.md
ADDED
@@ -0,0 +1,185 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
[![Latest Stable Version](https://poser.pugx.org/paynl/sdk/v/stable)](https://packagist.org/packages/paynl/sdk)
|
2 |
+
[![Total Downloads](https://poser.pugx.org/paynl/sdk/downloads)](https://packagist.org/packages/paynl/sdk)
|
3 |
+
[![Latest Unstable Version](https://poser.pugx.org/paynl/sdk/v/unstable)](https://packagist.org/packages/paynl/sdk)
|
4 |
+
[![Build Status](https://travis-ci.org/paynl/sdk.svg?branch=master)](https://travis-ci.org/paynl/sdk)
|
5 |
+
[![Coverage Status](https://coveralls.io/repos/github/paynl/sdk/badge.svg?branch=master)](https://coveralls.io/github/paynl/sdk?branch=master)
|
6 |
+
# Pay.nl PHP SDK
|
7 |
+
|
8 |
+
---
|
9 |
+
|
10 |
+
- [Installation](#installation)
|
11 |
+
- [Installation without composer](#installation-without-composer)
|
12 |
+
- [Requirements](#requirements)
|
13 |
+
- [Quick start and examples](#quick-start-and-examples)
|
14 |
+
|
15 |
+
---
|
16 |
+
|
17 |
+
### Installation
|
18 |
+
|
19 |
+
This SDK uses composer.
|
20 |
+
|
21 |
+
Composer is a tool for dependency management in PHP. It allows you to declare the libraries your project depends on and it will manage (install/update) them for you.
|
22 |
+
|
23 |
+
For more information on how to use/install composer, please visit: [https://github.com/composer/composer](https://github.com/composer/composer)
|
24 |
+
|
25 |
+
To install the Pay.nl PHP sdk into your project, simply
|
26 |
+
|
27 |
+
$ composer require paynl/sdk
|
28 |
+
|
29 |
+
### Installation without composer
|
30 |
+
|
31 |
+
If you don't have experience with composer, it is possible to use the SDK without using composer.
|
32 |
+
|
33 |
+
You can download the zip on the projects [releases](https://github.com/paynl/sdk/releases) page.
|
34 |
+
|
35 |
+
1. Download the package zip (SDKvx.x.x.zip).
|
36 |
+
2. Unzip the contents of the zip, and upload the vendor directory to your server.
|
37 |
+
3. In your project, require the file vendor/autoload.php
|
38 |
+
4. You can now use the SDK in your project
|
39 |
+
|
40 |
+
### Requirements
|
41 |
+
|
42 |
+
The Pay.nl PHP SDK works on php versions 5.3, 5.4, 5.5 and 5.6.
|
43 |
+
Also the php curl extension needs to be installed.
|
44 |
+
|
45 |
+
### Quick start and examples
|
46 |
+
|
47 |
+
Set the configuration
|
48 |
+
```php
|
49 |
+
require __DIR__ . '/vendor/autoload.php';
|
50 |
+
|
51 |
+
// Replace apitoken and serviceId with your own.
|
52 |
+
\Paynl\Config::setApiToken('e41f83b246b706291ea9ad798ccfd9f0fee5e0ab');
|
53 |
+
\Paynl\Config::setServiceId('SL-3490-4320');
|
54 |
+
```
|
55 |
+
|
56 |
+
Get available payment methods
|
57 |
+
```php
|
58 |
+
require __DIR__ . '/vendor/autoload.php';
|
59 |
+
|
60 |
+
\Paynl\Config::setApiToken('e41f83b246b706291ea9ad798ccfd9f0fee5e0ab');
|
61 |
+
\Paynl\Config::setServiceId('SL-3490-4320');
|
62 |
+
|
63 |
+
$paymentMethods = \Paynl\Paymentmethods::getList();
|
64 |
+
var_dump($paymentMethods);
|
65 |
+
```
|
66 |
+
|
67 |
+
Start a transaction
|
68 |
+
```php
|
69 |
+
require __DIR__ . '/vendor/autoload.php';
|
70 |
+
|
71 |
+
\Paynl\Config::setApiToken('e41f83b246b706291ea9ad798ccfd9f0fee5e0ab');
|
72 |
+
\Paynl\Config::setServiceId('SL-3490-4320');
|
73 |
+
|
74 |
+
$result = \Paynl\Transaction::start(array(
|
75 |
+
// required
|
76 |
+
'amount' => 10.00,
|
77 |
+
'returnUrl' => Paynl\Helper::getBaseUrl().'/return.php',
|
78 |
+
|
79 |
+
// optional
|
80 |
+
'currency' => 'EUR',
|
81 |
+
'exchangeUrl' => Paynl\Helper::getBaseUrl().'/exchange.php',
|
82 |
+
'paymentMethod' => 10,
|
83 |
+
'bank' => 1,
|
84 |
+
'description' => 'demo betaling',
|
85 |
+
'testmode' => 1,
|
86 |
+
'extra1' => 'ext1',
|
87 |
+
'extra2' => 'ext2',
|
88 |
+
'extra3' => 'ext3',
|
89 |
+
'products' => array(
|
90 |
+
array(
|
91 |
+
'id' => 1,
|
92 |
+
'name' => 'een product',
|
93 |
+
'price' => 5.00,
|
94 |
+
'tax' => 0.87,
|
95 |
+
'qty' => 1,
|
96 |
+
),
|
97 |
+
array(
|
98 |
+
'id' => 2,
|
99 |
+
'name' => 'ander product',
|
100 |
+
'price' => 5.00,
|
101 |
+
'tax' => 0.87,
|
102 |
+
'qty' => 1,
|
103 |
+
)
|
104 |
+
),
|
105 |
+
'language' => 'EN',
|
106 |
+
'ipaddress' => '127.0.0.1',
|
107 |
+
'invoiceDate' => new DateTime('2016-02-16'),
|
108 |
+
'deliveryDate' => new DateTime('2016-06-06'), // in case of tickets for an event, use the event date here
|
109 |
+
'enduser' => array(
|
110 |
+
'initials' => 'T',
|
111 |
+
'lastName' => 'Test',
|
112 |
+
'gender' => 'M',
|
113 |
+
'dob' => '14-05-1999',
|
114 |
+
'phoneNumber' => '0612345678',
|
115 |
+
'emailAddress' => 'test@test.nl',
|
116 |
+
),
|
117 |
+
'address' => array(
|
118 |
+
'streetName' => 'Test',
|
119 |
+
'houseNumber' => '10',
|
120 |
+
'zipCode' => '1234AB',
|
121 |
+
'city' => 'Test',
|
122 |
+
'country' => 'NL',
|
123 |
+
),
|
124 |
+
'invoiceAddress' => array(
|
125 |
+
'initials' => 'IT',
|
126 |
+
'lastName' => 'ITEST',
|
127 |
+
'streetName' => 'Istreet',
|
128 |
+
'houseNumber' => '70',
|
129 |
+
'zipCode' => '5678CD',
|
130 |
+
'city' => 'ITest',
|
131 |
+
'country' => 'NL',
|
132 |
+
),
|
133 |
+
));
|
134 |
+
|
135 |
+
// Save this transactionid and link it to your order
|
136 |
+
$transactionId = $result->getTransactionId();
|
137 |
+
|
138 |
+
// Redirect the customer to this url to complete the payment
|
139 |
+
$redirect = $result->getRedirectUrl();
|
140 |
+
```
|
141 |
+
|
142 |
+
On the return page, redirect the user to the thank you page or back to checkout
|
143 |
+
```php
|
144 |
+
require __DIR__ . '/vendor/autoload.php';
|
145 |
+
|
146 |
+
\Paynl\Config::setApiToken('e41f83b246b706291ea9ad798ccfd9f0fee5e0ab');
|
147 |
+
|
148 |
+
$transaction = \Paynl\Transaction::getForReturn();
|
149 |
+
|
150 |
+
//manual transfer transactions are always pending when the user is returned
|
151 |
+
if( $transaction->isPaid() || $transaction->isPending()){
|
152 |
+
// redirect to thank you page
|
153 |
+
|
154 |
+
} elseif($transaction->isCanceled()) {
|
155 |
+
// redirect back to checkout
|
156 |
+
|
157 |
+
}
|
158 |
+
```
|
159 |
+
|
160 |
+
On the exchange script, process the order
|
161 |
+
```php
|
162 |
+
require __DIR__ . '/vendor/autoload.php';
|
163 |
+
|
164 |
+
\Paynl\Config::setApiToken('e41f83b246b706291ea9ad798ccfd9f0fee5e0ab');
|
165 |
+
|
166 |
+
$transaction = \Paynl\Transaction::getForExchange();
|
167 |
+
|
168 |
+
if($transaction->isPaid()){
|
169 |
+
// process the payment
|
170 |
+
} elseif($transaction->isCanceled()){
|
171 |
+
// payment canceled, restock items
|
172 |
+
}
|
173 |
+
|
174 |
+
// always start your response with TRUE|
|
175 |
+
echo "TRUE| ";
|
176 |
+
|
177 |
+
// Optionally you can send a message after TRUE|, you can view these messages in the logs.
|
178 |
+
// https://admin.pay.nl/logs/payment_state
|
179 |
+
echo $transaction->isPaid()?'Paid':'Not paid';
|
180 |
+
|
181 |
+
|
182 |
+
```
|
183 |
+
|
184 |
+
### Testing
|
185 |
+
Please run ```vendor/bin/phpunit --bootstrap vendor/autoload.php tests/``` to test the application
|
app/code/community/Pay/Payment/vendor/paynl/sdk/composer.json
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"name": "paynl/sdk",
|
3 |
+
"require": {
|
4 |
+
"php-curl-class/php-curl-class": "^4.8"
|
5 |
+
},
|
6 |
+
"require-dev": {
|
7 |
+
"phpunit/phpunit": "^4.8",
|
8 |
+
"satooshi/php-coveralls": "~1.0"
|
9 |
+
},
|
10 |
+
"authors": [
|
11 |
+
{
|
12 |
+
"name": "Andy Pieters",
|
13 |
+
"email": "andy@pay.nl"
|
14 |
+
}
|
15 |
+
],
|
16 |
+
"autoload":{
|
17 |
+
"psr-4": {
|
18 |
+
"Paynl\\": "src/"
|
19 |
+
}
|
20 |
+
}
|
21 |
+
}
|
app/code/community/Pay/Payment/vendor/paynl/sdk/samples/config.sample.php
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
\Paynl\Config::setApiToken('bf81d83f6f8ca32bca272dfdcaf2f14902ff41');
|
3 |
+
\Paynl\Config::setServiceId('SL-3490-4320');
|
4 |
+
|
5 |
+
//optional: you can download it on https://curl.haxx.se/ca/cacert.pem
|
6 |
+
//\Paynl\Config::setCAInfoLocation('path/to/cacert.pem');
|
7 |
+
// Or you can skip verifyPeer
|
8 |
+
//\Paynl\Config::setVerifyPeer(false);
|
app/code/community/Pay/Payment/vendor/paynl/sdk/samples/directDebit/add.php
ADDED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
require_once '../../vendor/autoload.php';
|
3 |
+
require_once '../config.php';
|
4 |
+
try {
|
5 |
+
$result = Paynl\DirectDebit::add(array(
|
6 |
+
'amount' => 0.1,
|
7 |
+
'bankaccountHolder' => 'N. Klant',
|
8 |
+
'bankaccountNumber' => 'NL00RAB0123456789',
|
9 |
+
|
10 |
+
// optional
|
11 |
+
'bankaccountBic' => 'RABONL2U',
|
12 |
+
// 'exchangeUrl' => 'http://path_to_your_exchange/file.php',
|
13 |
+
'processDate' => new DateTime('tomorrow'),
|
14 |
+
'description' => 'De omschrijving',
|
15 |
+
'ipAddress' => '192.168.20.123',
|
16 |
+
'email' => 'naam@email.com',
|
17 |
+
'promotorId' => '123456789',
|
18 |
+
'tool' => 'sdk',
|
19 |
+
'info' => 'info',
|
20 |
+
'object' => 'object',
|
21 |
+
'extra1' => 'extra1',
|
22 |
+
'extra2' => 'extra2',
|
23 |
+
'extra3' => 'extra3',
|
24 |
+
'currency' => 'EUR',
|
25 |
+
));
|
26 |
+
echo $result->getMandateId();
|
27 |
+
} catch (\Paynl\Error\Error $e){
|
28 |
+
echo "Error: ".$e->getMessage();
|
29 |
+
}
|
app/code/community/Pay/Payment/vendor/paynl/sdk/samples/directDebit/get.php
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
require_once '../../vendor/autoload.php';
|
3 |
+
require_once '../config.php';
|
4 |
+
try {
|
5 |
+
$result = Paynl\DirectDebit::get('IO-9350-3111-3010');
|
6 |
+
var_dump($result->getData());
|
7 |
+
} catch (\Paynl\Error\Error $e){
|
8 |
+
echo "Error: ".$e->getMessage();
|
9 |
+
}
|
app/code/community/Pay/Payment/vendor/paynl/sdk/samples/directDebit/mandate/add.php
ADDED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
require_once '../../../vendor/autoload.php';
|
3 |
+
require_once '../../config.php';
|
4 |
+
try {
|
5 |
+
$result = Paynl\DirectDebit\Mandate::add(array(
|
6 |
+
'amount' => 0.1,
|
7 |
+
'bankaccountHolder' => 'N. Klant',
|
8 |
+
'bankaccountNumber' => 'NL00RABO0123456789',
|
9 |
+
|
10 |
+
// optional
|
11 |
+
'bankaccountBic' => 'RABONL2U',
|
12 |
+
'processDate' => new DateTime('tomorrow'),
|
13 |
+
// 'exchangeUrl' => 'http://path_to_your_exchange/file.php',
|
14 |
+
'description' => 'De omschrijving',
|
15 |
+
'ipAddress' => '192.168.20.123',
|
16 |
+
'email' => 'naam@email.com',
|
17 |
+
'promotorId' => '123456789',
|
18 |
+
'tool' => 'sdk',
|
19 |
+
'info' => 'info',
|
20 |
+
'object' => 'object',
|
21 |
+
'extra1' => 'extra1',
|
22 |
+
'extra2' => 'extra2',
|
23 |
+
'extra3' => 'extra3',
|
24 |
+
'currency' => 'EUR',
|
25 |
+
));
|
26 |
+
echo $result->getMandateId();
|
27 |
+
} catch (\Paynl\Error\Error $e){
|
28 |
+
echo "Error: ".$e->getMessage();
|
29 |
+
}
|
app/code/community/Pay/Payment/vendor/paynl/sdk/samples/directDebit/mandate/addTransaction.php
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
require_once '../../../vendor/autoload.php';
|
3 |
+
require_once '../../config.php';
|
4 |
+
try {
|
5 |
+
$result = Paynl\DirectDebit\Mandate::addTransaction(array(
|
6 |
+
'mandateId' => 'IO-6604-2112-1710',
|
7 |
+
'amount' => 0.10,
|
8 |
+
'description' => 'Handmatig herhaald',
|
9 |
+
'processDate' => new DateTime('tomorrow'),
|
10 |
+
));
|
11 |
+
var_dump($result->getData());
|
12 |
+
} catch (\Paynl\Error\Error $e){
|
13 |
+
echo "Error: ".$e->getMessage();
|
14 |
+
}
|
app/code/community/Pay/Payment/vendor/paynl/sdk/samples/directDebit/mandate/get.php
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
require_once '../../../vendor/autoload.php';
|
3 |
+
require_once '../../config.php';
|
4 |
+
try {
|
5 |
+
$result = Paynl\DirectDebit\Mandate::get('IO-6604-2112-1710');
|
6 |
+
var_dump($result->getData()['result']);
|
7 |
+
} catch (\Paynl\Error\Error $e){
|
8 |
+
echo "Error: ".$e->getMessage();
|
9 |
+
}
|
app/code/community/Pay/Payment/vendor/paynl/sdk/samples/directDebit/recurring/add.php
ADDED
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
require_once '../../../vendor/autoload.php';
|
3 |
+
require_once '../../config.php';
|
4 |
+
try {
|
5 |
+
$result = Paynl\DirectDebit\Recurring::add(array(
|
6 |
+
'amount' => 0.1,
|
7 |
+
'bankaccountHolder' => 'N Klant',
|
8 |
+
'bankaccountNumber' => 'NL00RABO0123456789',
|
9 |
+
'intervalValue' => 1,
|
10 |
+
'intervalPeriod' => Paynl\DirectDebit\Recurring::INTERVAL_DAY,
|
11 |
+
'intervalQuantity' => 3,
|
12 |
+
'bankaccountBic' => 'RABONL2U',
|
13 |
+
'processDate' => '08-07-2016',
|
14 |
+
|
15 |
+
// optional
|
16 |
+
// 'exchangeUrl' => 'http://path_to_your_exchange/file.php',
|
17 |
+
'description' => 'De omschrijving',
|
18 |
+
'ipAddress' => '192.168.20.123',
|
19 |
+
'email' => 'naam@email.com',
|
20 |
+
'promotorId' => '123456789',
|
21 |
+
'tool' => 'sdk',
|
22 |
+
'info' => 'info',
|
23 |
+
'object' => 'object',
|
24 |
+
'extra1' => 'extra1',
|
25 |
+
'extra2' => 'extra2',
|
26 |
+
'extra3' => 'extra3',
|
27 |
+
'currency' => 'EUR',
|
28 |
+
));
|
29 |
+
echo $result->getMandateId();
|
30 |
+
} catch (\Paynl\Error\Error $e){
|
31 |
+
echo "Error: ".$e->getMessage();
|
32 |
+
}
|
app/code/community/Pay/Payment/vendor/paynl/sdk/samples/directDebit/recurring/get.php
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
require_once '../../../vendor/autoload.php';
|
3 |
+
require_once '../../config.php';
|
4 |
+
try {
|
5 |
+
$result = Paynl\DirectDebit\Recurring::get('IO-3674-2126-0710');
|
6 |
+
echo var_dump($result->getData()['result']);
|
7 |
+
} catch (\Paynl\Error\Error $e){
|
8 |
+
echo "Error: ".$e->getMessage();
|
9 |
+
}
|
app/code/community/Pay/Payment/vendor/paynl/sdk/samples/exchange.php
ADDED
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Copyright (C) 2015 Andy Pieters <andy@pay.nl>
|
4 |
+
*
|
5 |
+
* This program is free software: you can redistribute it and/or modify
|
6 |
+
* it under the terms of the GNU General Public License as published by
|
7 |
+
* the Free Software Foundation, either version 3 of the License, or
|
8 |
+
* (at your option) any later version.
|
9 |
+
*
|
10 |
+
* This program is distributed in the hope that it will be useful,
|
11 |
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
+
* GNU General Public License for more details.
|
14 |
+
*
|
15 |
+
* You should have received a copy of the GNU General Public License
|
16 |
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
17 |
+
*/
|
18 |
+
|
19 |
+
require_once '../vendor/autoload.php';
|
20 |
+
require_once 'config.php';
|
21 |
+
|
22 |
+
try {
|
23 |
+
$transaction = \Paynl\Transaction::getForExchange();
|
24 |
+
if($transaction->isBeingVerified()){
|
25 |
+
// here you can do your own checks and approve or decline the order yourself
|
26 |
+
// the script is stopped after approving or declining, after which a new exchange call will follow.
|
27 |
+
// the status of this new exchange call will be paid (approved) or canceled (declined)
|
28 |
+
$approved = false; // use your own function to determine if this should be true or false.
|
29 |
+
$declined = false; // use your own function to determine if this should be true or false.
|
30 |
+
if($approved){
|
31 |
+
$transaction->approve();
|
32 |
+
die("TRUE| Transaction approved");
|
33 |
+
} elseif($declined) {
|
34 |
+
$transaction->decline();
|
35 |
+
die("TRUE| Transaction declined");
|
36 |
+
}
|
37 |
+
}
|
38 |
+
|
39 |
+
if ($transaction->isPaid()) {
|
40 |
+
// process the payment
|
41 |
+
} elseif ($transaction->isCanceled()) {
|
42 |
+
// payment canceled, restock items
|
43 |
+
}
|
44 |
+
|
45 |
+
// always start your response with TRUE|
|
46 |
+
echo "TRUE| ";
|
47 |
+
// Optionally you can send a message after TRUE|, you can view these messages in the logs. https://admin.pay.nl/logs/payment_state
|
48 |
+
echo $transaction->isPaid() ? 'Paid' : 'Not paid';
|
49 |
+
} catch (\Paynl\Error\Error $e) {
|
50 |
+
echo "Fout: " . $e->getMessage();
|
51 |
+
}
|
app/code/community/Pay/Payment/vendor/paynl/sdk/samples/instore/confirmPayment.php
ADDED
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Copyright (C) 2015 Andy Pieters <andy@pay.nl>
|
4 |
+
*
|
5 |
+
* This program is free software: you can redistribute it and/or modify
|
6 |
+
* it under the terms of the GNU General Public License as published by
|
7 |
+
* the Free Software Foundation, either version 3 of the License, or
|
8 |
+
* (at your option) any later version.
|
9 |
+
*
|
10 |
+
* This program is distributed in the hope that it will be useful,
|
11 |
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
+
* GNU General Public License for more details.
|
14 |
+
*
|
15 |
+
* You should have received a copy of the GNU General Public License
|
16 |
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
17 |
+
*/
|
18 |
+
|
19 |
+
require_once '../../vendor/autoload.php';
|
20 |
+
require_once '../config.php';
|
21 |
+
|
22 |
+
$hash = $_GET['hash']; //The hash you get from instore/payment
|
23 |
+
$emailAddress = @$_GET['emailAddress'];
|
24 |
+
$languageId = @$_GET['languageId'];
|
25 |
+
|
26 |
+
try {
|
27 |
+
$result = \Paynl\Instore::confirmPayment(array(
|
28 |
+
'hash' => $hash,
|
29 |
+
'emailAddress' => $emailAddress,
|
30 |
+
'languageId' => $languageId
|
31 |
+
));
|
32 |
+
|
33 |
+
var_dump($result->getData());
|
34 |
+
} catch (\Paynl\Error\Error $e) {
|
35 |
+
echo "Fout: " . $e->getMessage();
|
36 |
+
}
|
app/code/community/Pay/Payment/vendor/paynl/sdk/samples/instore/getAllTerminals.php
ADDED
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Copyright (C) 2015 Andy Pieters <andy@pay.nl>
|
4 |
+
*
|
5 |
+
* This program is free software: you can redistribute it and/or modify
|
6 |
+
* it under the terms of the GNU General Public License as published by
|
7 |
+
* the Free Software Foundation, either version 3 of the License, or
|
8 |
+
* (at your option) any later version.
|
9 |
+
*
|
10 |
+
* This program is distributed in the hope that it will be useful,
|
11 |
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
+
* GNU General Public License for more details.
|
14 |
+
*
|
15 |
+
* You should have received a copy of the GNU General Public License
|
16 |
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
17 |
+
*/
|
18 |
+
|
19 |
+
require_once '../../vendor/autoload.php';
|
20 |
+
require_once '../config.php';
|
21 |
+
|
22 |
+
try {
|
23 |
+
$result = \Paynl\Instore::getAllTerminals();
|
24 |
+
|
25 |
+
var_dump($result->getData());
|
26 |
+
} catch (\Paynl\Error\Error $e) {
|
27 |
+
echo "Fout: " . $e->getMessage();
|
28 |
+
}
|
app/code/community/Pay/Payment/vendor/paynl/sdk/samples/instore/getReceipt.php
ADDED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Copyright (C) 2015 Andy Pieters <andy@pay.nl>
|
4 |
+
*
|
5 |
+
* This program is free software: you can redistribute it and/or modify
|
6 |
+
* it under the terms of the GNU General Public License as published by
|
7 |
+
* the Free Software Foundation, either version 3 of the License, or
|
8 |
+
* (at your option) any later version.
|
9 |
+
*
|
10 |
+
* This program is distributed in the hope that it will be useful,
|
11 |
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
+
* GNU General Public License for more details.
|
14 |
+
*
|
15 |
+
* You should have received a copy of the GNU General Public License
|
16 |
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
17 |
+
*/
|
18 |
+
|
19 |
+
require_once '../../vendor/autoload.php';
|
20 |
+
require_once '../config.php';
|
21 |
+
|
22 |
+
$hash = $_GET['hash']; //The hash you get from instore/payment
|
23 |
+
|
24 |
+
try {
|
25 |
+
$result = \Paynl\Instore::getReceipt(array('hash' => $hash));
|
26 |
+
echo nl2br($result->getReceipt());
|
27 |
+
} catch (\Paynl\Error\Error $e) {
|
28 |
+
echo "Fout: " . $e->getMessage();
|
29 |
+
}
|
app/code/community/Pay/Payment/vendor/paynl/sdk/samples/instore/payment.php
ADDED
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Copyright (C) 2015 Andy Pieters <andy@pay.nl>
|
4 |
+
*
|
5 |
+
* This program is free software: you can redistribute it and/or modify
|
6 |
+
* it under the terms of the GNU General Public License as published by
|
7 |
+
* the Free Software Foundation, either version 3 of the License, or
|
8 |
+
* (at your option) any later version.
|
9 |
+
*
|
10 |
+
* This program is distributed in the hope that it will be useful,
|
11 |
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
+
* GNU General Public License for more details.
|
14 |
+
*
|
15 |
+
* You should have received a copy of the GNU General Public License
|
16 |
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
17 |
+
*/
|
18 |
+
|
19 |
+
require_once '../../vendor/autoload.php';
|
20 |
+
require_once '../config.php';
|
21 |
+
|
22 |
+
$transactionId = $_GET['transactionId']; // The transactionId you get from transaction/start
|
23 |
+
$terminalId = $_GET['terminalId']; // the terminalId you get from getAllTerminals
|
24 |
+
|
25 |
+
try {
|
26 |
+
$result = \Paynl\Instore::payment(array(
|
27 |
+
'transactionId' => $transactionId,
|
28 |
+
'terminalId' => $terminalId
|
29 |
+
));
|
30 |
+
|
31 |
+
$hash = $result->getHash();
|
32 |
+
|
33 |
+
echo "<a href='getReceipt.php?hash=".$hash."'>Receipt</a><br />";
|
34 |
+
echo "<a href='confirmPayment.php?hash=".$hash."'>Confirm</a><br />";
|
35 |
+
echo "<a href='status.php?hash=".$hash."'>Status</a><br />";
|
36 |
+
|
37 |
+
echo "<br /><a href='".$result->getRedirectUrl()."'>Status - Paynl</a><br />";
|
38 |
+
|
39 |
+
} catch (Paynl\Error\Error $e) {
|
40 |
+
echo 'Fout: ' . $e->getMessage();
|
41 |
+
}
|
app/code/community/Pay/Payment/vendor/paynl/sdk/samples/instore/status.php
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Copyright (C) 2015 Andy Pieters <andy@pay.nl>
|
4 |
+
*
|
5 |
+
* This program is free software: you can redistribute it and/or modify
|
6 |
+
* it under the terms of the GNU General Public License as published by
|
7 |
+
* the Free Software Foundation, either version 3 of the License, or
|
8 |
+
* (at your option) any later version.
|
9 |
+
*
|
10 |
+
* This program is distributed in the hope that it will be useful,
|
11 |
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
+
* GNU General Public License for more details.
|
14 |
+
*
|
15 |
+
* You should have received a copy of the GNU General Public License
|
16 |
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
17 |
+
*/
|
18 |
+
|
19 |
+
require_once '../../vendor/autoload.php';
|
20 |
+
require_once '../config.php';
|
21 |
+
|
22 |
+
$hash = $_GET['hash']; //The hash you get from instore/payment
|
23 |
+
|
24 |
+
try {
|
25 |
+
$result = \Paynl\Instore::status(array('hash' => $hash));
|
26 |
+
|
27 |
+
var_dump($result->getData());
|
28 |
+
} catch (\Paynl\Error\Error $e) {
|
29 |
+
echo "Fout: " . $e->getMessage();
|
30 |
+
}
|
app/code/community/Pay/Payment/vendor/paynl/sdk/samples/return.php
ADDED
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Copyright (C) 2015 Andy Pieters <andy@pay.nl>
|
4 |
+
*
|
5 |
+
* This program is free software: you can redistribute it and/or modify
|
6 |
+
* it under the terms of the GNU General Public License as published by
|
7 |
+
* the Free Software Foundation, either version 3 of the License, or
|
8 |
+
* (at your option) any later version.
|
9 |
+
*
|
10 |
+
* This program is distributed in the hope that it will be useful,
|
11 |
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
+
* GNU General Public License for more details.
|
14 |
+
*
|
15 |
+
* You should have received a copy of the GNU General Public License
|
16 |
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
17 |
+
*/
|
18 |
+
|
19 |
+
require_once '../vendor/autoload.php';
|
20 |
+
require_once 'config.php';
|
21 |
+
|
22 |
+
try {
|
23 |
+
$transaction = \Paynl\Transaction::getForReturn();
|
24 |
+
|
25 |
+
|
26 |
+
if ($transaction->isPaid() ||
|
27 |
+
$transaction->isPending() //manual transfer transactions are always pending when the user is returned
|
28 |
+
) {
|
29 |
+
// redirect to thank you page
|
30 |
+
echo "Thank you<br /><a href='transaction/start.php'>New payment</a>";
|
31 |
+
if ($transaction->isPaid()) {
|
32 |
+
echo "<br /><a href='transaction/refund.php?transactionId=" . $transaction->getId() . "'>Refund</a>";
|
33 |
+
}
|
34 |
+
} elseif ($transaction->isCanceled()) {
|
35 |
+
// redirect back to checkout
|
36 |
+
echo "Payment canceled <br /><a href='transaction/start.php'>Try again</a>";
|
37 |
+
} elseif ($transaction->isAuthorized()) {
|
38 |
+
echo "Payment authorized<br />";
|
39 |
+
echo "<a href='transaction/capture.php?transactionId=" . $transaction->getId() . "'>capture</a><br />";
|
40 |
+
echo "<a href='transaction/void.php?transactionId=" . $transaction->getId() . "'>void</a>";
|
41 |
+
}
|
42 |
+
} catch (\Paynl\Error\Error $e) {
|
43 |
+
echo "Fout: " . $e->getMessage();
|
44 |
+
}
|
app/code/community/Pay/Payment/vendor/paynl/sdk/samples/service/getPaylinkUrl.php
ADDED
@@ -0,0 +1,60 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Copyright (C) 2015 Andy Pieters <andy@pay.nl>
|
4 |
+
*
|
5 |
+
* This program is free software: you can redistribute it and/or modify
|
6 |
+
* it under the terms of the GNU General Public License as published by
|
7 |
+
* the Free Software Foundation, either version 3 of the License, or
|
8 |
+
* (at your option) any later version.
|
9 |
+
*
|
10 |
+
* This program is distributed in the hope that it will be useful,
|
11 |
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
+
* GNU General Public License for more details.
|
14 |
+
*
|
15 |
+
* You should have received a copy of the GNU General Public License
|
16 |
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
17 |
+
*/
|
18 |
+
|
19 |
+
require_once '../../vendor/autoload.php';
|
20 |
+
require_once '../config.php';
|
21 |
+
|
22 |
+
try {
|
23 |
+
$url = \Paynl\Service::getPayLinkUrl([
|
24 |
+
/**
|
25 |
+
* securityMode:
|
26 |
+
* 0: no checks (only minimum amount)
|
27 |
+
* 1: amount cannot be changed
|
28 |
+
* 2: prefilled extra variables cannot be changed, empty variables can be removed
|
29 |
+
* 3: prefilled extra variables cannot be changed, empty variables cannot be removed
|
30 |
+
*/
|
31 |
+
'securityMode' => 3,
|
32 |
+
'amount' => 10,
|
33 |
+
'amountMin' => 0,
|
34 |
+
|
35 |
+
'countryCode' => 'nl',
|
36 |
+
'language' => 'nl',
|
37 |
+
|
38 |
+
'extra1' => [
|
39 |
+
'name' => 'Customer Id',
|
40 |
+
'value' => '12345678'
|
41 |
+
],
|
42 |
+
'extra2' => [
|
43 |
+
'name' => 'Email',
|
44 |
+
'value' => '' //if you leave the value empty, the customer can fill in the value
|
45 |
+
],
|
46 |
+
'extra3' => [
|
47 |
+
'name' => 'Phone',
|
48 |
+
'value' => '0612345678'
|
49 |
+
],
|
50 |
+
/**
|
51 |
+
* Extra stats data
|
52 |
+
*/
|
53 |
+
'tool' => 'tool',
|
54 |
+
'info' => 'info'
|
55 |
+
]);
|
56 |
+
|
57 |
+
echo $url;
|
58 |
+
} catch (\Paynl\Error\Error $e) {
|
59 |
+
echo $e->getMessage();
|
60 |
+
}
|
app/code/community/Pay/Payment/vendor/paynl/sdk/samples/transaction/capture.php
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Copyright (C) 2015 Andy Pieters <andy@pay.nl>
|
4 |
+
*
|
5 |
+
* This program is free software: you can redistribute it and/or modify
|
6 |
+
* it under the terms of the GNU General Public License as published by
|
7 |
+
* the Free Software Foundation, either version 3 of the License, or
|
8 |
+
* (at your option) any later version.
|
9 |
+
*
|
10 |
+
* This program is distributed in the hope that it will be useful,
|
11 |
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
+
* GNU General Public License for more details.
|
14 |
+
*
|
15 |
+
* You should have received a copy of the GNU General Public License
|
16 |
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
17 |
+
*/
|
18 |
+
|
19 |
+
require_once '../../vendor/autoload.php';
|
20 |
+
require_once '../config.php';
|
21 |
+
|
22 |
+
$transactionId = $_GET['transactionId'];
|
23 |
+
try {
|
24 |
+
$result = \Paynl\Transaction::capture($transactionId);
|
25 |
+
} catch (\Paynl\Error\Error $e) {
|
26 |
+
echo $e->getMessage();
|
27 |
+
}
|
app/code/community/Pay/Payment/vendor/paynl/sdk/samples/transaction/paymentMethods.php
ADDED
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Copyright (C) 2015 Andy Pieters <andy@pay.nl>
|
4 |
+
*
|
5 |
+
* This program is free software: you can redistribute it and/or modify
|
6 |
+
* it under the terms of the GNU General Public License as published by
|
7 |
+
* the Free Software Foundation, either version 3 of the License, or
|
8 |
+
* (at your option) any later version.
|
9 |
+
*
|
10 |
+
* This program is distributed in the hope that it will be useful,
|
11 |
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
+
* GNU General Public License for more details.
|
14 |
+
*
|
15 |
+
* You should have received a copy of the GNU General Public License
|
16 |
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
17 |
+
*/
|
18 |
+
|
19 |
+
require_once '../../vendor/autoload.php';
|
20 |
+
require_once '../config.php';
|
21 |
+
|
22 |
+
try {
|
23 |
+
$paymentMethods = \Paynl\Paymentmethods::getList();
|
24 |
+
var_dump($paymentMethods);
|
25 |
+
} catch (\Paynl\Error\Error $e) {
|
26 |
+
echo "Fout: " . $e->getMessage();
|
27 |
+
}
|
28 |
+
|
app/code/community/Pay/Payment/vendor/paynl/sdk/samples/transaction/refund.php
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Copyright (C) 2015 Andy Pieters <andy@pay.nl>
|
4 |
+
*
|
5 |
+
* This program is free software: you can redistribute it and/or modify
|
6 |
+
* it under the terms of the GNU General Public License as published by
|
7 |
+
* the Free Software Foundation, either version 3 of the License, or
|
8 |
+
* (at your option) any later version.
|
9 |
+
*
|
10 |
+
* This program is distributed in the hope that it will be useful,
|
11 |
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
+
* GNU General Public License for more details.
|
14 |
+
*
|
15 |
+
* You should have received a copy of the GNU General Public License
|
16 |
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
17 |
+
*/
|
18 |
+
|
19 |
+
require_once '../../vendor/autoload.php';
|
20 |
+
require_once '../config.php';
|
21 |
+
|
22 |
+
$transactionId = $_GET['transactionId'];
|
23 |
+
try {
|
24 |
+
$result = \Paynl\Transaction::refund($transactionId, 5);
|
25 |
+
} catch (\Paynl\Error\Error $e) {
|
26 |
+
echo $e->getMessage();
|
27 |
+
}
|
app/code/community/Pay/Payment/vendor/paynl/sdk/samples/transaction/start.php
ADDED
@@ -0,0 +1,130 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Copyright (C) 2015 Andy Pieters <andy@pay.nl>
|
4 |
+
*
|
5 |
+
* This program is free software: you can redistribute it and/or modify
|
6 |
+
* it under the terms of the GNU General Public License as published by
|
7 |
+
* the Free Software Foundation, either version 3 of the License, or
|
8 |
+
* (at your option) any later version.
|
9 |
+
*
|
10 |
+
* This program is distributed in the hope that it will be useful,
|
11 |
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
+
* GNU General Public License for more details.
|
14 |
+
*
|
15 |
+
* You should have received a copy of the GNU General Public License
|
16 |
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
17 |
+
*/
|
18 |
+
|
19 |
+
require_once '../../vendor/autoload.php';
|
20 |
+
require_once '../config.php';
|
21 |
+
|
22 |
+
try {
|
23 |
+
$result = \Paynl\Transaction::start(array(
|
24 |
+
// required
|
25 |
+
'amount' => 12.5,
|
26 |
+
'returnUrl' => dirname(Paynl\Helper::getBaseUrl()) . '/return.php',
|
27 |
+
|
28 |
+
// optional
|
29 |
+
'exchangeUrl' => dirname(Paynl\Helper::getBaseUrl()) . '/exchange.php',
|
30 |
+
'paymentMethod' => 10,
|
31 |
+
'currency' => 'EUR',
|
32 |
+
'expireDate' => new DateTime('2016-04-01'),
|
33 |
+
// 'bank' => 1,
|
34 |
+
'description' => '123456',
|
35 |
+
'testmode' => 0,
|
36 |
+
'extra1' => 'ext1',
|
37 |
+
'extra2' => 'ext2',
|
38 |
+
'extra3' => 'ext3',
|
39 |
+
'ipaddress' => '10.0.0.1',
|
40 |
+
'invoiceDate' => new DateTime('now'),
|
41 |
+
'deliveryDate' => new DateTime('2016-06-06'), // in case of tickets for an event, use the event date here
|
42 |
+
'products' => array(
|
43 |
+
array(
|
44 |
+
'id' => 1,
|
45 |
+
'name' => 'een product',
|
46 |
+
'price' => 5,
|
47 |
+
'vatPercentage' => 21,
|
48 |
+
'qty' => 1,
|
49 |
+
'type' => \Paynl\Transaction::PRODUCT_TYPE_ARTICLE
|
50 |
+
),
|
51 |
+
array(
|
52 |
+
'id' => 2,
|
53 |
+
'name' => 'ander product 15 %',
|
54 |
+
'price' => 5,
|
55 |
+
'vatPercentage' => 15,
|
56 |
+
'qty' => 1,
|
57 |
+
'type' => \Paynl\Transaction::PRODUCT_TYPE_ARTICLE
|
58 |
+
),
|
59 |
+
array(
|
60 |
+
'id' => 'shipping',
|
61 |
+
'name' => 'verzendkosten',
|
62 |
+
'price' => 5,
|
63 |
+
'vatPercentage' => 21,
|
64 |
+
'qty' => 1,
|
65 |
+
'type' => \Paynl\Transaction::PRODUCT_TYPE_SHIPPING
|
66 |
+
),
|
67 |
+
array(
|
68 |
+
'id' => 'fee',
|
69 |
+
'name' => 'Handling fee',
|
70 |
+
'price' => 1,
|
71 |
+
'vatPercentage' => 21,
|
72 |
+
'qty' => 1,
|
73 |
+
'type' => \Paynl\Transaction::PRODUCT_TYPE_HANDLING
|
74 |
+
),
|
75 |
+
array(
|
76 |
+
'id' => '5543',
|
77 |
+
'name' => 'Coupon 3,50 korting',
|
78 |
+
'price' => -3.5,
|
79 |
+
'vatPercentage' => 21,
|
80 |
+
'qty' => 1,
|
81 |
+
'type' => \Paynl\Transaction::PRODUCT_TYPE_DISCOUNT
|
82 |
+
),
|
83 |
+
),
|
84 |
+
'language' => 'EN',
|
85 |
+
'enduser' => array(
|
86 |
+
'initials' => 'T',
|
87 |
+
'lastName' => 'Test',
|
88 |
+
'gender' => 'M',
|
89 |
+
'birthDate' => '14-05-1999',
|
90 |
+
'phoneNumber' => '0612345678',
|
91 |
+
'emailAddress' => 'test@test.nl',
|
92 |
+
'customerReference' => '456789',//your customer id
|
93 |
+
'customerTrust' => 0, // -10 - 10 how much do you trust this customer? -10 untrustable 10 trusted
|
94 |
+
),
|
95 |
+
'address' => array(
|
96 |
+
'streetName' => 'Test',
|
97 |
+
'houseNumber' => '10',
|
98 |
+
'houseNumberExtension' => 'A',
|
99 |
+
'zipCode' => '1234AB',
|
100 |
+
'city' => 'Test',
|
101 |
+
'country' => 'NL',
|
102 |
+
),
|
103 |
+
'invoiceAddress' => array(
|
104 |
+
'initials' => 'IT',
|
105 |
+
'lastName' => 'ITEST',
|
106 |
+
'streetName' => 'Istreet',
|
107 |
+
'houseNumber' => '70',
|
108 |
+
'houseNumberExtension' => 'A',
|
109 |
+
'zipCode' => '5678CD',
|
110 |
+
'city' => 'ITest',
|
111 |
+
'country' => 'NL',
|
112 |
+
),
|
113 |
+
|
114 |
+
// Only use this if you are told to
|
115 |
+
// 'transferType' => 'merchant',
|
116 |
+
// 'transferValue' => 'M-0123-4567', // the merchantCode
|
117 |
+
//
|
118 |
+
// 'transferType' => 'transaction',
|
119 |
+
// 'transferValue' => '12345678X260bc5', // The transactionId
|
120 |
+
));
|
121 |
+
|
122 |
+
// Save this transactionid and link it to your order
|
123 |
+
$transactionId = $result->getTransactionId();
|
124 |
+
|
125 |
+
echo '<a href="' . $result->getRedirectUrl() . '">' . $result->getRedirectUrl() . '</a>';
|
126 |
+
echo "<br />" . $transactionId;
|
127 |
+
|
128 |
+
} catch (\Paynl\Error\Error $e) {
|
129 |
+
echo "Fout: " . $e->getMessage();
|
130 |
+
}
|
app/code/community/Pay/Payment/vendor/paynl/sdk/samples/transaction/void.php
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Copyright (C) 2015 Andy Pieters <andy@pay.nl>
|
4 |
+
*
|
5 |
+
* This program is free software: you can redistribute it and/or modify
|
6 |
+
* it under the terms of the GNU General Public License as published by
|
7 |
+
* the Free Software Foundation, either version 3 of the License, or
|
8 |
+
* (at your option) any later version.
|
9 |
+
*
|
10 |
+
* This program is distributed in the hope that it will be useful,
|
11 |
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
+
* GNU General Public License for more details.
|
14 |
+
*
|
15 |
+
* You should have received a copy of the GNU General Public License
|
16 |
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
17 |
+
*/
|
18 |
+
|
19 |
+
require_once '../../vendor/autoload.php';
|
20 |
+
require_once '../config.php';
|
21 |
+
|
22 |
+
$transactionId = $_GET['transactionId'];
|
23 |
+
try {
|
24 |
+
$result = \Paynl\Transaction::void($transactionId);
|
25 |
+
} catch (\Paynl\Error\Error $e) {
|
26 |
+
echo $e->getMessage();
|
27 |
+
}
|
app/code/community/Pay/Payment/vendor/paynl/sdk/samples/validate/isPayServerIp.php
ADDED
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Copyright (C) 2015 Andy Pieters <andy@pay.nl>
|
4 |
+
*
|
5 |
+
* This program is free software: you can redistribute it and/or modify
|
6 |
+
* it under the terms of the GNU General Public License as published by
|
7 |
+
* the Free Software Foundation, either version 3 of the License, or
|
8 |
+
* (at your option) any later version.
|
9 |
+
*
|
10 |
+
* This program is distributed in the hope that it will be useful,
|
11 |
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
+
* GNU General Public License for more details.
|
14 |
+
*
|
15 |
+
* You should have received a copy of the GNU General Public License
|
16 |
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
17 |
+
*/
|
18 |
+
|
19 |
+
require_once '../../vendor/autoload.php';
|
20 |
+
require_once '../config.php';
|
21 |
+
|
22 |
+
try {
|
23 |
+
$results = array();
|
24 |
+
|
25 |
+
$results[] = \Paynl\Validate::isPayServerIp('12.34.56.78'); // not a pay server ip
|
26 |
+
$results[] = \Paynl\Validate::isPayServerIp('37.46.137.135'); // pay server ip
|
27 |
+
|
28 |
+
var_dump($results);
|
29 |
+
} catch (\Paynl\Error\Error $e) {
|
30 |
+
echo "Fout: " . $e->getMessage();
|
31 |
+
}
|
app/code/community/Pay/Payment/vendor/paynl/sdk/src/Api/Api.php
ADDED
@@ -0,0 +1,120 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Copyright (C) 2015 Andy Pieters <andy@andypieters.nl>
|
4 |
+
*
|
5 |
+
* This program is free software: you can redistribute it and/or modify
|
6 |
+
* it under the terms of the GNU General Public License as published by
|
7 |
+
* the Free Software Foundation, either version 3 of the License, or
|
8 |
+
* (at your option) any later version.
|
9 |
+
*
|
10 |
+
* This program is distributed in the hope that it will be useful,
|
11 |
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
+
* GNU General Public License for more details.
|
14 |
+
*
|
15 |
+
* You should have received a copy of the GNU General Public License
|
16 |
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
17 |
+
*/
|
18 |
+
|
19 |
+
namespace Paynl\Api;
|
20 |
+
|
21 |
+
use Paynl\Config;
|
22 |
+
use Paynl\Error;
|
23 |
+
use Paynl\Helper;
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Description of Api
|
27 |
+
*
|
28 |
+
* @author Andy Pieters <andy@andypieters.nl>
|
29 |
+
*/
|
30 |
+
class Api
|
31 |
+
{
|
32 |
+
protected $version = 1;
|
33 |
+
|
34 |
+
protected $data = array();
|
35 |
+
|
36 |
+
/**
|
37 |
+
* @var bool Is the ApiToken required for this API
|
38 |
+
*/
|
39 |
+
protected $apiTokenRequired = false;
|
40 |
+
/**
|
41 |
+
* @var bool Is the serviceId required for this API
|
42 |
+
*/
|
43 |
+
protected $serviceIdRequired = false;
|
44 |
+
|
45 |
+
public function isApiTokenRequired()
|
46 |
+
{
|
47 |
+
return $this->apiTokenRequired;
|
48 |
+
}
|
49 |
+
|
50 |
+
public function isServiceIdRequired()
|
51 |
+
{
|
52 |
+
return $this->serviceIdRequired;
|
53 |
+
}
|
54 |
+
|
55 |
+
protected function getData()
|
56 |
+
{
|
57 |
+
if($this->isApiTokenRequired()) {
|
58 |
+
Helper::requireApiToken();
|
59 |
+
|
60 |
+
$this->data['token'] = Config::getApiToken();
|
61 |
+
}
|
62 |
+
if($this->isServiceIdRequired()){
|
63 |
+
Helper::requireServiceId();
|
64 |
+
|
65 |
+
$this->data['serviceId'] = Config::getServiceId();
|
66 |
+
}
|
67 |
+
return $this->data;
|
68 |
+
}
|
69 |
+
|
70 |
+
protected function processResult($result)
|
71 |
+
{
|
72 |
+
$output = Helper::objectToArray($result);
|
73 |
+
|
74 |
+
if(!is_array($output)){
|
75 |
+
throw new Error\Api($output);
|
76 |
+
}
|
77 |
+
|
78 |
+
if ($output['request']['result'] != 1 && $output['request']['result'] != 'TRUE') {
|
79 |
+
throw new Error\Api($output['request']['errorId'] . ' - ' . $output['request']['errorMessage']);
|
80 |
+
}
|
81 |
+
return $output;
|
82 |
+
}
|
83 |
+
|
84 |
+
public function doRequest($endpoint, $version = null)
|
85 |
+
{
|
86 |
+
if(is_null($version)){
|
87 |
+
$version = $this->version;
|
88 |
+
}
|
89 |
+
|
90 |
+
$data = $this->getData();
|
91 |
+
|
92 |
+
|
93 |
+
$uri = Config::getApiUrl($endpoint, $version);
|
94 |
+
|
95 |
+
$curl = Config::getCurl();
|
96 |
+
|
97 |
+
if(Config::getCAInfoLocation()){
|
98 |
+
// set a custom CAInfo file
|
99 |
+
$curl->setOpt(CURLOPT_CAINFO, Config::getCAInfoLocation());
|
100 |
+
}
|
101 |
+
|
102 |
+
$verifyPeer = Config::getVerifyPeer();
|
103 |
+
$curl->setOpt(CURLOPT_SSL_VERIFYPEER, $verifyPeer);
|
104 |
+
|
105 |
+
$result = $curl->post($uri, $data);
|
106 |
+
|
107 |
+
if($curl->error){
|
108 |
+
if(!empty($result)) {
|
109 |
+
if ($result->status == "FALSE") {
|
110 |
+
throw new Error\Api($result->error);
|
111 |
+
}
|
112 |
+
}
|
113 |
+
throw new Error\Error($curl->errorMessage);
|
114 |
+
}
|
115 |
+
|
116 |
+
$output = static::processResult($result);
|
117 |
+
|
118 |
+
return $output;
|
119 |
+
}
|
120 |
+
}
|
app/code/community/Pay/Payment/vendor/paynl/sdk/src/Api/Currency/Currency.php
ADDED
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Created by PhpStorm.
|
4 |
+
* User: andy
|
5 |
+
* Date: 6-7-16
|
6 |
+
* Time: 17:55
|
7 |
+
*/
|
8 |
+
|
9 |
+
namespace Paynl\Api\Currency;
|
10 |
+
|
11 |
+
use Paynl\Error;
|
12 |
+
use Paynl\Api\Api;
|
13 |
+
use Paynl\Helper;
|
14 |
+
|
15 |
+
class Currency extends Api
|
16 |
+
{
|
17 |
+
protected $apiTokenRequired = true;
|
18 |
+
|
19 |
+
protected $version = 2;
|
20 |
+
|
21 |
+
protected function processResult($result)
|
22 |
+
{
|
23 |
+
$output = Helper::objectToArray($result);
|
24 |
+
|
25 |
+
if(!is_array($output)){
|
26 |
+
throw new Error\Api($output);
|
27 |
+
}
|
28 |
+
|
29 |
+
return $output;
|
30 |
+
}
|
31 |
+
}
|
app/code/community/Pay/Payment/vendor/paynl/sdk/src/Api/Currency/GetAll.php
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Created by PhpStorm.
|
4 |
+
* User: andy
|
5 |
+
* Date: 6-7-16
|
6 |
+
* Time: 17:57
|
7 |
+
*/
|
8 |
+
|
9 |
+
namespace Paynl\Api\Currency;
|
10 |
+
|
11 |
+
|
12 |
+
class GetAll extends Currency
|
13 |
+
{
|
14 |
+
public function doRequest($endpoint = null, $version = null)
|
15 |
+
{
|
16 |
+
return parent::doRequest('Currency/getAll', $version);
|
17 |
+
}
|
18 |
+
}
|
app/code/community/Pay/Payment/vendor/paynl/sdk/src/Api/DirectDebit/DebitAdd.php
ADDED
@@ -0,0 +1,317 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Copyright (C) 2015 Andy Pieters <andy@pay.nl>
|
4 |
+
*
|
5 |
+
* This program is free software: you can redistribute it and/or modify
|
6 |
+
* it under the terms of the GNU General Public License as published by
|
7 |
+
* the Free Software Foundation, either version 3 of the License, or
|
8 |
+
* (at your option) any later version.
|
9 |
+
*
|
10 |
+
* This program is distributed in the hope that it will be useful,
|
11 |
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
+
* GNU General Public License for more details.
|
14 |
+
*
|
15 |
+
* You should have received a copy of the GNU General Public License
|
16 |
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
17 |
+
*/
|
18 |
+
|
19 |
+
namespace Paynl\Api\DirectDebit;
|
20 |
+
|
21 |
+
use Paynl\Error\Required;
|
22 |
+
|
23 |
+
/**
|
24 |
+
* @author Andy Pieters <andy@pay.nl>
|
25 |
+
*/
|
26 |
+
class DebitAdd extends DirectDebit
|
27 |
+
{
|
28 |
+
/**
|
29 |
+
* @var bool Is the ApiToken required for this API
|
30 |
+
*/
|
31 |
+
protected $apiTokenRequired = true;
|
32 |
+
/**
|
33 |
+
* @var bool Is the serviceId required for this API
|
34 |
+
*/
|
35 |
+
protected $serviceIdRequired = true;
|
36 |
+
|
37 |
+
/**
|
38 |
+
* @var integer The amount to be paid should be given in cents. For example € 3.50 becomes 350.
|
39 |
+
*/
|
40 |
+
private $_amount;
|
41 |
+
/**
|
42 |
+
* @var string The name of the customer.
|
43 |
+
*/
|
44 |
+
private $_bankaccountHolder;
|
45 |
+
/**
|
46 |
+
* @var string The bankaccount number of the customer.
|
47 |
+
*/
|
48 |
+
private $_bankaccountNumber;
|
49 |
+
/**
|
50 |
+
* @var string The BIC of the bank.
|
51 |
+
*/
|
52 |
+
private $_bankaccountBic;
|
53 |
+
/**
|
54 |
+
* @var \DateTime Date on which the directdebit needs to be processed.
|
55 |
+
*/
|
56 |
+
private $_processDate;
|
57 |
+
/**
|
58 |
+
* @var string Description to include with the payment.
|
59 |
+
*/
|
60 |
+
private $_description;
|
61 |
+
/**
|
62 |
+
* @var string The IP address of the customer.
|
63 |
+
*/
|
64 |
+
private $_ipAddress;
|
65 |
+
/**
|
66 |
+
* @var string The email address of the customer.
|
67 |
+
*/
|
68 |
+
private $_email;
|
69 |
+
/**
|
70 |
+
* @var integer The ID of the webmaster / promotor.
|
71 |
+
*/
|
72 |
+
private $_promotorId;
|
73 |
+
/**
|
74 |
+
* @var string The used tool code.
|
75 |
+
*/
|
76 |
+
private $_tool;
|
77 |
+
/**
|
78 |
+
* @var string The used info code.
|
79 |
+
*/
|
80 |
+
private $_info;
|
81 |
+
/**
|
82 |
+
* @var string The used object.
|
83 |
+
*/
|
84 |
+
private $_object;
|
85 |
+
/**
|
86 |
+
* @var string The first free value.
|
87 |
+
*/
|
88 |
+
private $_extra1;
|
89 |
+
/**
|
90 |
+
* @var string The second free value.
|
91 |
+
*/
|
92 |
+
private $_extra2;
|
93 |
+
/**
|
94 |
+
* @var string The third free value.
|
95 |
+
*/
|
96 |
+
private $_extra3;
|
97 |
+
/**
|
98 |
+
* @var string The currency of the amount. Default is EUR.
|
99 |
+
*/
|
100 |
+
private $_currency;
|
101 |
+
/**
|
102 |
+
* @var string Yes The exchange URL for this order.
|
103 |
+
*/
|
104 |
+
private $_exchangeUrl;
|
105 |
+
|
106 |
+
/**
|
107 |
+
* @param int $amount
|
108 |
+
*/
|
109 |
+
public function setAmount($amount)
|
110 |
+
{
|
111 |
+
$this->_amount = round($amount);
|
112 |
+
}
|
113 |
+
|
114 |
+
/**
|
115 |
+
* @param string $bankaccountHolder
|
116 |
+
*/
|
117 |
+
public function setBankaccountHolder($bankaccountHolder)
|
118 |
+
{
|
119 |
+
$this->_bankaccountHolder = $bankaccountHolder;
|
120 |
+
}
|
121 |
+
|
122 |
+
/**
|
123 |
+
* @param string $bankaccountNumber
|
124 |
+
*/
|
125 |
+
public function setBankaccountNumber($bankaccountNumber)
|
126 |
+
{
|
127 |
+
$this->_bankaccountNumber = $bankaccountNumber;
|
128 |
+
}
|
129 |
+
|
130 |
+
/**
|
131 |
+
* @param string $bankaccountBic
|
132 |
+
*/
|
133 |
+
public function setBankaccountBic($bankaccountBic)
|
134 |
+
{
|
135 |
+
$this->_bankaccountBic = $bankaccountBic;
|
136 |
+
}
|
137 |
+
|
138 |
+
/**
|
139 |
+
* @param \DateTime $processDate
|
140 |
+
*/
|
141 |
+
public function setProcessDate(\DateTime $processDate)
|
142 |
+
{
|
143 |
+
$this->_processDate = $processDate;
|
144 |
+
}
|
145 |
+
|
146 |
+
/**
|
147 |
+
* @param string $description
|
148 |
+
*/
|
149 |
+
public function setDescription($description)
|
150 |
+
{
|
151 |
+
$this->_description = $description;
|
152 |
+
}
|
153 |
+
|
154 |
+
/**
|
155 |
+
* @param string $ipAddress
|
156 |
+
*/
|
157 |
+
public function setIpAddress($ipAddress)
|
158 |
+
{
|
159 |
+
$this->_ipAddress = $ipAddress;
|
160 |
+
}
|
161 |
+
|
162 |
+
/**
|
163 |
+
* @param string $email
|
164 |
+
*/
|
165 |
+
public function setEmail($email)
|
166 |
+
{
|
167 |
+
$this->_email = $email;
|
168 |
+
}
|
169 |
+
|
170 |
+
/**
|
171 |
+
* @param int $promotorId
|
172 |
+
*/
|
173 |
+
public function setPromotorId($promotorId)
|
174 |
+
{
|
175 |
+
$this->_promotorId = (int)$promotorId;
|
176 |
+
}
|
177 |
+
|
178 |
+
/**
|
179 |
+
* @param string $tool
|
180 |
+
*/
|
181 |
+
public function setTool($tool)
|
182 |
+
{
|
183 |
+
$this->_tool = $tool;
|
184 |
+
}
|
185 |
+
|
186 |
+
/**
|
187 |
+
* @param string $info
|
188 |
+
*/
|
189 |
+
public function setInfo($info)
|
190 |
+
{
|
191 |
+
$this->_info = $info;
|
192 |
+
}
|
193 |
+
|
194 |
+
/**
|
195 |
+
* @param string $object
|
196 |
+
*/
|
197 |
+
public function setObject($object)
|
198 |
+
{
|
199 |
+
$this->_object = $object;
|
200 |
+
}
|
201 |
+
|
202 |
+
/**
|
203 |
+
* @param string $extra1
|
204 |
+
*/
|
205 |
+
public function setExtra1($extra1)
|
206 |
+
{
|
207 |
+
$this->_extra1 = $extra1;
|
208 |
+
}
|
209 |
+
|
210 |
+
/**
|
211 |
+
* @param string $extra2
|
212 |
+
*/
|
213 |
+
public function setExtra2($extra2)
|
214 |
+
{
|
215 |
+
$this->_extra2 = $extra2;
|
216 |
+
}
|
217 |
+
|
218 |
+
/**
|
219 |
+
* @param string $extra3
|
220 |
+
*/
|
221 |
+
public function setExtra3($extra3)
|
222 |
+
{
|
223 |
+
$this->_extra3 = $extra3;
|
224 |
+
}
|
225 |
+
|
226 |
+
/**
|
227 |
+
* @param string $currency
|
228 |
+
*/
|
229 |
+
public function setCurrency($currency)
|
230 |
+
{
|
231 |
+
$this->_currency = $currency;
|
232 |
+
}
|
233 |
+
|
234 |
+
/**
|
235 |
+
* @param string $exchangeUrl
|
236 |
+
*/
|
237 |
+
public function setExchangeUrl($exchangeUrl)
|
238 |
+
{
|
239 |
+
$this->_exchangeUrl = $exchangeUrl;
|
240 |
+
}
|
241 |
+
|
242 |
+
public function getData()
|
243 |
+
{
|
244 |
+
if (empty($this->_amount)) {
|
245 |
+
throw new Required('amount');
|
246 |
+
} else {
|
247 |
+
$this->data['amount'] = $this->_amount;
|
248 |
+
}
|
249 |
+
if (empty($this->_bankaccountHolder)) {
|
250 |
+
throw new Required('bankaccountHolder');
|
251 |
+
} else {
|
252 |
+
$this->data['bankaccountHolder'] = $this->_bankaccountHolder;
|
253 |
+
}
|
254 |
+
if (empty($this->_bankaccountNumber)) {
|
255 |
+
throw new Required('bankaccountnumber');
|
256 |
+
} else {
|
257 |
+
$this->data['bankaccountnumber'] = $this->_bankaccountNumber;
|
258 |
+
}
|
259 |
+
if (!empty($this->_bankaccountBic)) {
|
260 |
+
$this->data['bankaccountBic'] = $this->_bankaccountBic;
|
261 |
+
}
|
262 |
+
if (!empty($this->_processDate)) {
|
263 |
+
$this->data['processDate'] = $this->_processDate->format('d-m-Y');
|
264 |
+
}
|
265 |
+
if (!empty($this->_description)) {
|
266 |
+
$this->data['description'] = $this->_description;
|
267 |
+
}
|
268 |
+
if (!empty($this->_ipAddress)) {
|
269 |
+
$this->data['ipAddress'] = $this->_ipAddress;
|
270 |
+
}
|
271 |
+
if (!empty($this->_email)) {
|
272 |
+
$this->data['email'] = $this->_email;
|
273 |
+
}
|
274 |
+
if (!empty($this->_promotorId)) {
|
275 |
+
$this->data['promotorId'] = $this->_promotorId;
|
276 |
+
}
|
277 |
+
if (!empty($this->_tool)) {
|
278 |
+
$this->data['tool'] = $this->_tool;
|
279 |
+
}
|
280 |
+
if (!empty($this->_info)) {
|
281 |
+
$this->data['info'] = $this->_info;
|
282 |
+
}
|
283 |
+
if (!empty($this->_object)) {
|
284 |
+
$this->data['object'] = $this->_object;
|
285 |
+
}
|
286 |
+
if (!empty($this->_extra1)) {
|
287 |
+
$this->data['extra1'] = $this->_extra1;
|
288 |
+
}
|
289 |
+
if (!empty($this->_extra2)) {
|
290 |
+
$this->data['extra2'] = $this->_extra2;
|
291 |
+
}
|
292 |
+
if (!empty($this->_extra3)) {
|
293 |
+
$this->data['extra3'] = $this->_extra3;
|
294 |
+
}
|
295 |
+
if (!empty($this->_currency)) {
|
296 |
+
$this->data['currency'] = $this->_currency;
|
297 |
+
}
|
298 |
+
if (!empty($this->_exchangeUrl)) {
|
299 |
+
$this->data['exchangeUrl'] = $this->_exchangeUrl;
|
300 |
+
}
|
301 |
+
|
302 |
+
return parent::getData();
|
303 |
+
}
|
304 |
+
|
305 |
+
/**
|
306 |
+
* @param string $endpoint
|
307 |
+
* @param int|null $version
|
308 |
+
* @return array The result
|
309 |
+
*/
|
310 |
+
public function doRequest($endpoint = 'DirectDebit/debitAdd', $version = null)
|
311 |
+
{
|
312 |
+
if (is_null($version)) {
|
313 |
+
$version = $this->version;
|
314 |
+
}
|
315 |
+
return parent::doRequest($endpoint, $version);
|
316 |
+
}
|
317 |
+
}
|
app/code/community/Pay/Payment/vendor/paynl/sdk/src/Api/DirectDebit/DebitGet.php
ADDED
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Created by PhpStorm.
|
4 |
+
* User: andy
|
5 |
+
* Date: 7-7-16
|
6 |
+
* Time: 15:51
|
7 |
+
*/
|
8 |
+
|
9 |
+
namespace Paynl\Api\DirectDebit;
|
10 |
+
|
11 |
+
|
12 |
+
use Paynl\Error\Required;
|
13 |
+
|
14 |
+
class DebitGet extends DirectDebit
|
15 |
+
{
|
16 |
+
protected $apiTokenRequired = true;
|
17 |
+
|
18 |
+
/**
|
19 |
+
* @var string The mandate id (IO-xxxx-xxxx-xxxx)
|
20 |
+
*/
|
21 |
+
private $_mandateId;
|
22 |
+
|
23 |
+
/**
|
24 |
+
* @param string $mandateId The mandate id (IO-xxxx-xxxx-xxxx)
|
25 |
+
*/
|
26 |
+
public function setMandateId($mandateId)
|
27 |
+
{
|
28 |
+
$this->_mandateId = $mandateId;
|
29 |
+
}
|
30 |
+
|
31 |
+
public function getData()
|
32 |
+
{
|
33 |
+
if(empty($this->_mandateId)){
|
34 |
+
throw new Required('mandateId');
|
35 |
+
}
|
36 |
+
|
37 |
+
$this->data['mandateId'] = $this->_mandateId;
|
38 |
+
|
39 |
+
return parent::getData();
|
40 |
+
}
|
41 |
+
|
42 |
+
public function doRequest($endpoint = null, $version = null)
|
43 |
+
{
|
44 |
+
return parent::doRequest('DirectDebit/debitGet');
|
45 |
+
}
|
46 |
+
}
|
app/code/community/Pay/Payment/vendor/paynl/sdk/src/Api/DirectDebit/Delete.php
ADDED
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Created by PhpStorm.
|
4 |
+
* User: andy
|
5 |
+
* Date: 13-7-16
|
6 |
+
* Time: 19:55
|
7 |
+
*/
|
8 |
+
|
9 |
+
namespace Paynl\Api\DirectDebit;
|
10 |
+
|
11 |
+
|
12 |
+
use Paynl\Error\Required;
|
13 |
+
|
14 |
+
class Delete extends DirectDebit
|
15 |
+
{
|
16 |
+
/**
|
17 |
+
* @var string The mandateId of the directdebit.
|
18 |
+
*/
|
19 |
+
private $_mandateId;
|
20 |
+
|
21 |
+
/**
|
22 |
+
* @param string $mandateId The mandateId of the directdebit.
|
23 |
+
*/
|
24 |
+
public function setMandateId($mandateId)
|
25 |
+
{
|
26 |
+
$this->_mandateId = $mandateId;
|
27 |
+
}
|
28 |
+
|
29 |
+
protected function getData()
|
30 |
+
{
|
31 |
+
if(empty($this->_mandateId)){
|
32 |
+
throw new Required('mandateId');
|
33 |
+
} else {
|
34 |
+
$this->data['mandateId'] = $this->_mandateId;
|
35 |
+
}
|
36 |
+
|
37 |
+
return parent::getData();
|
38 |
+
}
|
39 |
+
public function doRequest($endpoint = null, $version = null)
|
40 |
+
{
|
41 |
+
return parent::doRequest('DirectDebit/delete');
|
42 |
+
}
|
43 |
+
}
|
app/code/community/Pay/Payment/vendor/paynl/sdk/src/Api/DirectDebit/DirectDebit.php
ADDED
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Copyright (C) 2015 Andy Pieters <andy@pay.nl>
|
4 |
+
*
|
5 |
+
* This program is free software: you can redistribute it and/or modify
|
6 |
+
* it under the terms of the GNU General Public License as published by
|
7 |
+
* the Free Software Foundation, either version 3 of the License, or
|
8 |
+
* (at your option) any later version.
|
9 |
+
*
|
10 |
+
* This program is distributed in the hope that it will be useful,
|
11 |
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
+
* GNU General Public License for more details.
|
14 |
+
*
|
15 |
+
* You should have received a copy of the GNU General Public License
|
16 |
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
17 |
+
*/
|
18 |
+
|
19 |
+
namespace Paynl\Api\DirectDebit;
|
20 |
+
|
21 |
+
use Paynl\Api\Api;
|
22 |
+
|
23 |
+
/**
|
24 |
+
* @author Andy Pieters <andy@pay.nl>
|
25 |
+
*/
|
26 |
+
class DirectDebit extends Api
|
27 |
+
{
|
28 |
+
/**
|
29 |
+
* @var int the version of the api
|
30 |
+
*/
|
31 |
+
protected $version = 3;
|
32 |
+
|
33 |
+
/**
|
34 |
+
* @param string $endpoint
|
35 |
+
* @param int|null $version
|
36 |
+
* @return array The result
|
37 |
+
*/
|
38 |
+
public function doRequest($endpoint, $version = null)
|
39 |
+
{
|
40 |
+
if (is_null($version)) {
|
41 |
+
$version = $this->version;
|
42 |
+
}
|
43 |
+
return parent::doRequest($endpoint, $version);
|
44 |
+
}
|
45 |
+
}
|
app/code/community/Pay/Payment/vendor/paynl/sdk/src/Api/DirectDebit/MandateAdd.php
ADDED
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Created by PhpStorm.
|
4 |
+
* User: andy
|
5 |
+
* Date: 6-7-16
|
6 |
+
* Time: 16:06
|
7 |
+
*/
|
8 |
+
|
9 |
+
namespace Paynl\Api\DirectDebit;
|
10 |
+
|
11 |
+
|
12 |
+
class MandateAdd extends DebitAdd
|
13 |
+
{
|
14 |
+
/**
|
15 |
+
* @var integer Indicated the number of times this order should be executed.
|
16 |
+
*/
|
17 |
+
private $_intervalQuantity;
|
18 |
+
|
19 |
+
/**
|
20 |
+
* @param int $intervalQuantity Indicated the number of times this order should be executed.
|
21 |
+
*/
|
22 |
+
public function setIntervalQuantity($intervalQuantity)
|
23 |
+
{
|
24 |
+
$this->_intervalQuantity = $intervalQuantity;
|
25 |
+
}
|
26 |
+
|
27 |
+
public function getData()
|
28 |
+
{
|
29 |
+
if(!empty($this->_intervalQuantity)){
|
30 |
+
$this->data['intervalQuantity'] = $this->_intervalQuantity;
|
31 |
+
}
|
32 |
+
return parent::getData();
|
33 |
+
}
|
34 |
+
|
35 |
+
public function doRequest($endpoint = 'DirectDebit/mandateAdd', $version = null)
|
36 |
+
{
|
37 |
+
return parent::doRequest($endpoint, $version);
|
38 |
+
}
|
39 |
+
}
|
app/code/community/Pay/Payment/vendor/paynl/sdk/src/Api/DirectDebit/MandateDebit.php
ADDED
@@ -0,0 +1,102 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Created by PhpStorm.
|
4 |
+
* User: andy
|
5 |
+
* Date: 7-7-16
|
6 |
+
* Time: 15:58
|
7 |
+
*/
|
8 |
+
|
9 |
+
namespace Paynl\Api\DirectDebit;
|
10 |
+
|
11 |
+
|
12 |
+
use Paynl\Error\Required;
|
13 |
+
|
14 |
+
class MandateDebit extends DirectDebit
|
15 |
+
{
|
16 |
+
protected $apiTokenRequired = true;
|
17 |
+
/**
|
18 |
+
* @var string The mandateId (IO-xxxx-xxxx-xxxx)
|
19 |
+
*/
|
20 |
+
private $_mandateId;
|
21 |
+
/**
|
22 |
+
* @var int The amount of the recurring directdebit. If not present, the amount of the last directdebit will be used.
|
23 |
+
*/
|
24 |
+
private $_amount;
|
25 |
+
/**
|
26 |
+
* @var string The description for the recurring directdebit. If not present, the description of the last directdebit will be used.
|
27 |
+
*/
|
28 |
+
private $_description;
|
29 |
+
/**
|
30 |
+
* @var \DateTime The processDate of the recurring directdebit. If not present, it will be processed as soon as possible.
|
31 |
+
*/
|
32 |
+
private $_processDate;
|
33 |
+
/**
|
34 |
+
* @var boolean Indicate wether this is the last directdebit for this mandateId.
|
35 |
+
*/
|
36 |
+
private $_last;
|
37 |
+
|
38 |
+
/**
|
39 |
+
* @param string $mandateId
|
40 |
+
*/
|
41 |
+
public function setMandateId($mandateId)
|
42 |
+
{
|
43 |
+
$this->_mandateId = $mandateId;
|
44 |
+
}
|
45 |
+
|
46 |
+
/**
|
47 |
+
* @param int $amount
|
48 |
+
*/
|
49 |
+
public function setAmount($amount)
|
50 |
+
{
|
51 |
+
$this->_amount = (int)$amount;
|
52 |
+
}
|
53 |
+
|
54 |
+
/**
|
55 |
+
* @param string $description
|
56 |
+
*/
|
57 |
+
public function setDescription($description)
|
58 |
+
{
|
59 |
+
$this->_description = $description;
|
60 |
+
}
|
61 |
+
|
62 |
+
/**
|
63 |
+
* @param \DateTime $processDate
|
64 |
+
*/
|
65 |
+
public function setProcessDate(\DateTime $processDate)
|
66 |
+
{
|
67 |
+
$this->_processDate = $processDate;
|
68 |
+
}
|
69 |
+
|
70 |
+
/**
|
71 |
+
* @param boolean $last
|
72 |
+
*/
|
73 |
+
public function setLast($last)
|
74 |
+
{
|
75 |
+
$this->_last = $last;
|
76 |
+
}
|
77 |
+
|
78 |
+
protected function getData()
|
79 |
+
{
|
80 |
+
if (empty($this->_mandateId)) {
|
81 |
+
throw new Required('mandateId');
|
82 |
+
} else {
|
83 |
+
$this->data['mandateId'] = $this->_mandateId;
|
84 |
+
}
|
85 |
+
if (!empty($this->_amount)) {
|
86 |
+
$this->data['amount'] = (int)$this->_amount;
|
87 |
+
}
|
88 |
+
if (!empty($this->_description)) {
|
89 |
+
$this->data['description'] = $this->_description;
|
90 |
+
}
|
91 |
+
if (!empty($this->_processDate)) {
|
92 |
+
$this->data['processDate'] = $this->_processDate->format('d-m-Y');
|
93 |
+
}
|
94 |
+
|
95 |
+
return parent::getData();
|
96 |
+
}
|
97 |
+
|
98 |
+
public function doRequest($endpoint = null, $version = null)
|
99 |
+
{
|
100 |
+
return parent::doRequest('DirectDebit/mandateDebit');
|
101 |
+
}
|
102 |
+
}
|
app/code/community/Pay/Payment/vendor/paynl/sdk/src/Api/DirectDebit/MandateGet.php
ADDED
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Created by PhpStorm.
|
4 |
+
* User: andy
|
5 |
+
* Date: 7-7-16
|
6 |
+
* Time: 15:56
|
7 |
+
*/
|
8 |
+
|
9 |
+
namespace Paynl\Api\DirectDebit;
|
10 |
+
|
11 |
+
|
12 |
+
class MandateGet extends DirectDebit
|
13 |
+
{
|
14 |
+
protected $apiTokenRequired = true;
|
15 |
+
|
16 |
+
/**
|
17 |
+
* @var string The mandate id (IO-xxxx-xxxx-xxxx)
|
18 |
+
*/
|
19 |
+
private $_mandateId;
|
20 |
+
|
21 |
+
/**
|
22 |
+
* @param string $mandateId The mandate id (IO-xxxx-xxxx-xxxx)
|
23 |
+
*/
|
24 |
+
public function setMandateId($mandateId)
|
25 |
+
{
|
26 |
+
$this->_mandateId = $mandateId;
|
27 |
+
}
|
28 |
+
|
29 |
+
public function getData()
|
30 |
+
{
|
31 |
+
$this->data['mandateId'] = $this->_mandateId;
|
32 |
+
|
33 |
+
return parent::getData();
|
34 |
+
}
|
35 |
+
|
36 |
+
public function doRequest($endpoint = null, $version = null)
|
37 |
+
{
|
38 |
+
return parent::doRequest('DirectDebit/mandateGet');
|
39 |
+
}
|
40 |
+
}
|
app/code/community/Pay/Payment/vendor/paynl/sdk/src/Api/DirectDebit/RecurringAdd.php
ADDED
@@ -0,0 +1,61 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Created by PhpStorm.
|
4 |
+
* User: andy
|
5 |
+
* Date: 6-7-16
|
6 |
+
* Time: 16:23
|
7 |
+
*/
|
8 |
+
|
9 |
+
namespace Paynl\Api\DirectDebit;
|
10 |
+
|
11 |
+
|
12 |
+
use Paynl\Error\Required;
|
13 |
+
|
14 |
+
class RecurringAdd extends MandateAdd
|
15 |
+
{
|
16 |
+
/**
|
17 |
+
* @var int Need for recurring part, if intervalValue is 2 and intervalPeriod is 1 than process the directdebit every two weeks
|
18 |
+
*/
|
19 |
+
private $_intervalValue;
|
20 |
+
/**
|
21 |
+
* @var int 1 : Week, 2 : Month, 3: Quarter, 4 : Half year, 5: Year, 6: Day
|
22 |
+
*/
|
23 |
+
private $_intervalPeriod;
|
24 |
+
|
25 |
+
/**
|
26 |
+
* @param int $intervalValue Need for recurring part, if intervalValue is 2 and intervalPeriod is 1 than process the directdebit every two weeks
|
27 |
+
*/
|
28 |
+
public function setIntervalValue($intervalValue)
|
29 |
+
{
|
30 |
+
$this->_intervalValue = $intervalValue;
|
31 |
+
}
|
32 |
+
|
33 |
+
/**
|
34 |
+
* @param int $intervalPeriod 1 : Week, 2 : Month, 3: Quarter, 4 : Half year, 5: Year, 6: Day
|
35 |
+
*/
|
36 |
+
public function setIntervalPeriod($intervalPeriod)
|
37 |
+
{
|
38 |
+
$this->_intervalPeriod = $intervalPeriod;
|
39 |
+
}
|
40 |
+
|
41 |
+
public function getData()
|
42 |
+
{
|
43 |
+
if(empty($this->_intervalValue)){
|
44 |
+
throw new Required('intervalValue');
|
45 |
+
} else {
|
46 |
+
$this->data['intervalValue'] = $this->_intervalValue;
|
47 |
+
}
|
48 |
+
if(empty($this->_intervalPeriod)){
|
49 |
+
throw new Required('intervalPeriod');
|
50 |
+
} else {
|
51 |
+
$this->data['intervalPeriod'] = $this->_intervalPeriod;
|
52 |
+
}
|
53 |
+
|
54 |
+
return parent::getData();
|
55 |
+
}
|
56 |
+
|
57 |
+
public function doRequest($endpoint = 'DirectDebit/recurringAdd', $version = null)
|
58 |
+
{
|
59 |
+
return parent::doRequest($endpoint, $version);
|
60 |
+
}
|
61 |
+
}
|
app/code/community/Pay/Payment/vendor/paynl/sdk/src/Api/DirectDebit/RecurringGet.php
ADDED
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Created by PhpStorm.
|
4 |
+
* User: andy
|
5 |
+
* Date: 7-7-16
|
6 |
+
* Time: 15:51
|
7 |
+
*/
|
8 |
+
|
9 |
+
namespace Paynl\Api\DirectDebit;
|
10 |
+
|
11 |
+
use Paynl\Error\Required;
|
12 |
+
|
13 |
+
class RecurringGet extends DirectDebit
|
14 |
+
{
|
15 |
+
protected $apiTokenRequired = true;
|
16 |
+
|
17 |
+
/**
|
18 |
+
* @var string The mandate id (IO-xxxx-xxxx-xxxx)
|
19 |
+
*/
|
20 |
+
private $_mandateId;
|
21 |
+
|
22 |
+
/**
|
23 |
+
* @param string $mandateId The mandate id (IO-xxxx-xxxx-xxxx)
|
24 |
+
*/
|
25 |
+
public function setMandateId($mandateId)
|
26 |
+
{
|
27 |
+
$this->_mandateId = $mandateId;
|
28 |
+
}
|
29 |
+
|
30 |
+
public function getData()
|
31 |
+
{
|
32 |
+
if(empty($this->_mandateId)){
|
33 |
+
throw new Required('mandateId');
|
34 |
+
}
|
35 |
+
|
36 |
+
$this->data['mandateId'] = $this->_mandateId;
|
37 |
+
|
38 |
+
return parent::getData();
|
39 |
+
}
|
40 |
+
|
41 |
+
public function doRequest($endpoint = null, $version = null)
|
42 |
+
{
|
43 |
+
return parent::doRequest('DirectDebit/recurringGet');
|
44 |
+
}
|
45 |
+
}
|
app/code/community/Pay/Payment/vendor/paynl/sdk/src/Api/DirectDebit/Update.php
ADDED
@@ -0,0 +1,315 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Created by PhpStorm.
|
4 |
+
* User: andy
|
5 |
+
* Date: 13-7-16
|
6 |
+
* Time: 14:04
|
7 |
+
*/
|
8 |
+
|
9 |
+
namespace Paynl\Api\DirectDebit;
|
10 |
+
|
11 |
+
|
12 |
+
use Paynl\Error\Required;
|
13 |
+
|
14 |
+
class Update extends DirectDebit
|
15 |
+
{
|
16 |
+
protected $apiTokenRequired = true;
|
17 |
+
|
18 |
+
/**
|
19 |
+
* @var string The mandateId of the directdebit
|
20 |
+
*/
|
21 |
+
private $_mandateId;
|
22 |
+
/**
|
23 |
+
* @var integer The amount to be paid should be given in cents. For example € 3.50 becomes 350.
|
24 |
+
*/
|
25 |
+
private $_amount;
|
26 |
+
/**
|
27 |
+
* @var string The name of the customer.
|
28 |
+
*/
|
29 |
+
private $_bankaccountHolder;
|
30 |
+
/**
|
31 |
+
* @var string The bankaccount number of the customer.
|
32 |
+
*/
|
33 |
+
private $_bankaccountNumber;
|
34 |
+
/**
|
35 |
+
* @var string The BIC of the bank.
|
36 |
+
*/
|
37 |
+
private $_bankaccountBic;
|
38 |
+
/**
|
39 |
+
* @var string Date on which the directdebit needs to be processed.
|
40 |
+
*/
|
41 |
+
private $_processDate;
|
42 |
+
/**
|
43 |
+
* @var integer Need for recurring part, if intervalValue is 2 and intervalPeriod is 1 than process the directdebit every two weeks.
|
44 |
+
*/
|
45 |
+
private $_intervalValue;
|
46 |
+
/**
|
47 |
+
* @var integer 1 : Week, 2 : Month, 3: Quarter, 4 : Half year, 5: Year, 6: Day
|
48 |
+
*/
|
49 |
+
private $_intervalPeriod;
|
50 |
+
/**
|
51 |
+
* @var integer Indicated the number of times this order should be executed.
|
52 |
+
*/
|
53 |
+
private $_intervalQuantity;
|
54 |
+
/**
|
55 |
+
* @var string First description to include with the payment.
|
56 |
+
*/
|
57 |
+
private $_description;
|
58 |
+
/**
|
59 |
+
* @var string The IP address of the customer.
|
60 |
+
*/
|
61 |
+
private $_ipAddress;
|
62 |
+
/**
|
63 |
+
* @var string The email address of the customer.
|
64 |
+
*/
|
65 |
+
private $_email;
|
66 |
+
/**
|
67 |
+
* @var integer The ID of the webmaster / promotor.
|
68 |
+
*/
|
69 |
+
private $_promotorId;
|
70 |
+
/**
|
71 |
+
* @var string The used tool code.
|
72 |
+
*/
|
73 |
+
private $_tool;
|
74 |
+
/**
|
75 |
+
* @var string The used info code.
|
76 |
+
*/
|
77 |
+
private $_info;
|
78 |
+
/**
|
79 |
+
* @var string The used object.
|
80 |
+
*/
|
81 |
+
private $_object;
|
82 |
+
/**
|
83 |
+
* @var string The first free value.
|
84 |
+
*/
|
85 |
+
private $_extra1;
|
86 |
+
/**
|
87 |
+
* @var string The second free value.
|
88 |
+
*/
|
89 |
+
private $_extra2;
|
90 |
+
/**
|
91 |
+
* @var string The third free value.
|
92 |
+
*/
|
93 |
+
private $_extra3;
|
94 |
+
|
95 |
+
/**
|
96 |
+
* @param string $mandateId The mandateId of the directdebit.
|
97 |
+
*/
|
98 |
+
public function setMandateId($mandateId)
|
99 |
+
{
|
100 |
+
$this->_mandateId = $mandateId;
|
101 |
+
}
|
102 |
+
|
103 |
+
/**
|
104 |
+
* @param int $amount The amount to be paid should be given in cents. For example € 3.50 becomes 350.
|
105 |
+
*/
|
106 |
+
public function setAmount($amount)
|
107 |
+
{
|
108 |
+
$this->_amount = (int)$amount;
|
109 |
+
}
|
110 |
+
|
111 |
+
/**
|
112 |
+
* @param string $bankaccountHolder The name of the customer.
|
113 |
+
*/
|
114 |
+
public function setBankaccountHolder($bankaccountHolder)
|
115 |
+
{
|
116 |
+
$this->_bankaccountHolder = $bankaccountHolder;
|
117 |
+
}
|
118 |
+
|
119 |
+
/**
|
120 |
+
* @param string $bankaccountNumber The bankaccount number of the customer.
|
121 |
+
*/
|
122 |
+
public function setBankaccountNumber($bankaccountNumber)
|
123 |
+
{
|
124 |
+
$this->_bankaccountNumber = $bankaccountNumber;
|
125 |
+
}
|
126 |
+
|
127 |
+
/**
|
128 |
+
* @param string $bankaccountBic The BIC of the bank.
|
129 |
+
*/
|
130 |
+
public function setBankaccountBic($bankaccountBic)
|
131 |
+
{
|
132 |
+
$this->_bankaccountBic = $bankaccountBic;
|
133 |
+
}
|
134 |
+
|
135 |
+
/**
|
136 |
+
* @param \DateTime $processDate Date on which the directdebit needs to be processed.
|
137 |
+
*/
|
138 |
+
public function setProcessDate(\DateTime $processDate)
|
139 |
+
{
|
140 |
+
$this->_processDate = $processDate->format('d-m-Y');
|
141 |
+
}
|
142 |
+
|
143 |
+
/**
|
144 |
+
* @param integer $intervalValue Need for recurring part, if intervalValue is 2 and intervalPeriod is 1 than process the directdebit every two weeks.
|
145 |
+
*/
|
146 |
+
public function setIntervalValue($intervalValue)
|
147 |
+
{
|
148 |
+
$this->_intervalValue = $intervalValue;
|
149 |
+
}
|
150 |
+
|
151 |
+
/**
|
152 |
+
* @param int $intervalPeriod 1 : Week, 2 : Month, 3: Quarter, 4 : Half year, 5: Year, 6: Day
|
153 |
+
*/
|
154 |
+
public function setIntervalPeriod($intervalPeriod)
|
155 |
+
{
|
156 |
+
$this->_intervalPeriod = $intervalPeriod;
|
157 |
+
}
|
158 |
+
|
159 |
+
/**
|
160 |
+
* @param int $intervalQuantity Indicated the number of times this order should be executed.
|
161 |
+
*/
|
162 |
+
public function setIntervalQuantity($intervalQuantity)
|
163 |
+
{
|
164 |
+
$this->_intervalQuantity = $intervalQuantity;
|
165 |
+
}
|
166 |
+
|
167 |
+
/**
|
168 |
+
* @param string $description First description to include with the payment.
|
169 |
+
*/
|
170 |
+
public function setDescription($description)
|
171 |
+
{
|
172 |
+
$this->_description = $description;
|
173 |
+
}
|
174 |
+
|
175 |
+
/**
|
176 |
+
* @param string $ipAddress The IP address of the customer.
|
177 |
+
*/
|
178 |
+
public function setIpAddress($ipAddress)
|
179 |
+
{
|
180 |
+
$this->_ipAddress = $ipAddress;
|
181 |
+
}
|
182 |
+
|
183 |
+
/**
|
184 |
+
* @param string $email The email address of the customer.
|
185 |
+
*/
|
186 |
+
public function setEmail($email)
|
187 |
+
{
|
188 |
+
$this->_email = $email;
|
189 |
+
}
|
190 |
+
|
191 |
+
/**
|
192 |
+
* @param int $promotorId The ID of the webmaster / promotor.
|
193 |
+
*/
|
194 |
+
public function setPromotorId($promotorId)
|
195 |
+
{
|
196 |
+
$this->_promotorId = (int)$promotorId;
|
197 |
+
}
|
198 |
+
|
199 |
+
/**
|
200 |
+
* @param string $tool The used tool code.
|
201 |
+
*/
|
202 |
+
public function setTool($tool)
|
203 |
+
{
|
204 |
+
$this->_tool = $tool;
|
205 |
+
}
|
206 |
+
|
207 |
+
/**
|
208 |
+
* @param string $info The used info code.
|
209 |
+
*/
|
210 |
+
public function setInfo($info)
|
211 |
+
{
|
212 |
+
$this->_info = $info;
|
213 |
+
}
|
214 |
+
|
215 |
+
/**
|
216 |
+
* @param string $object The used object
|
217 |
+
*/
|
218 |
+
public function setObject($object)
|
219 |
+
{
|
220 |
+
$this->_object = $object;
|
221 |
+
}
|
222 |
+
|
223 |
+
/**
|
224 |
+
* @param string $extra1 The first free value.
|
225 |
+
*/
|
226 |
+
public function setExtra1($extra1)
|
227 |
+
{
|
228 |
+
$this->_extra1 = $extra1;
|
229 |
+
}
|
230 |
+
|
231 |
+
/**
|
232 |
+
* @param string $extra2 The second free value.
|
233 |
+
*/
|
234 |
+
public function setExtra2($extra2)
|
235 |
+
{
|
236 |
+
$this->_extra2 = $extra2;
|
237 |
+
}
|
238 |
+
|
239 |
+
/**
|
240 |
+
* @param string $extra3 The third free value.
|
241 |
+
*/
|
242 |
+
public function setExtra3($extra3)
|
243 |
+
{
|
244 |
+
$this->_extra3 = $extra3;
|
245 |
+
}
|
246 |
+
|
247 |
+
protected function getData()
|
248 |
+
{
|
249 |
+
if(empty($this->_mandateId)){
|
250 |
+
throw new Required('mandateId');
|
251 |
+
} else {
|
252 |
+
$this->data['mandateId'];
|
253 |
+
}
|
254 |
+
if(!empty($this->_amount)){
|
255 |
+
$this->data['amount'] = $this->_amount;
|
256 |
+
}
|
257 |
+
if(!empty($this->_bankaccountHolder)){
|
258 |
+
$this->data['bankaccountHolder'] = $this->_bankaccountHolder;
|
259 |
+
}
|
260 |
+
if(!empty($this->_bankaccountNumber)){
|
261 |
+
$this->data['bankaccountNumber'] = $this->_bankaccountNumber;
|
262 |
+
}
|
263 |
+
if(!empty($this->_bankaccountBic)){
|
264 |
+
$this->data['bankaccountBic'] = $this->_bankaccountBic;
|
265 |
+
}
|
266 |
+
if(!empty($this->_processDate)){
|
267 |
+
$this->data['processDate'] = $this->_processDate;
|
268 |
+
}
|
269 |
+
if(!empty($this->_intervalValue)){
|
270 |
+
$this->data['intervalValue'] = $this->_intervalValue;
|
271 |
+
}
|
272 |
+
if(!empty($this->_intervalPeriod)){
|
273 |
+
$this->data['intervalPeriod'] = $this->_intervalPeriod;
|
274 |
+
}
|
275 |
+
if(!empty($this->_intervalQuantity)){
|
276 |
+
$this->data['intervalQuantity'] = $this->_intervalQuantity;
|
277 |
+
}
|
278 |
+
if(!empty($this->_description)){
|
279 |
+
$this->data['description'] = $this->_description;
|
280 |
+
}
|
281 |
+
if(!empty($this->_ipAddress)){
|
282 |
+
$this->data['ipAddress'] = $this->_ipAddress;
|
283 |
+
}
|
284 |
+
if(!empty($this->_email)){
|
285 |
+
$this->data['email'] = $this->_email;
|
286 |
+
}
|
287 |
+
if(!empty($this->_promotorId)){
|
288 |
+
$this->data['promotorId'] = $this->_promotorId;
|
289 |
+
}
|
290 |
+
if(!empty($this->_tool)){
|
291 |
+
$this->data['tool'] = $this->_tool;
|
292 |
+
}
|
293 |
+
if(!empty($this->_info)){
|
294 |
+
$this->data['info'] = $this->_info;
|
295 |
+
}
|
296 |
+
if(!empty($this->_object)){
|
297 |
+
$this->data['object'] = $this->_object;
|
298 |
+
}
|
299 |
+
if(!empty($this->_extra1)){
|
300 |
+
$this->data['extra1'] = $this->_extra1;
|
301 |
+
}
|
302 |
+
if(!empty($this->_extra2)){
|
303 |
+
$this->data['extra2'] = $this->_extra2;
|
304 |
+
}
|
305 |
+
if(!empty($this->_extra3)){
|
306 |
+
$this->data['extra3'] = $this->_extra3;
|
307 |
+
}
|
308 |
+
|
309 |
+
return parent::getData();
|
310 |
+
}
|
311 |
+
public function doRequest($endpoint = '', $version = null)
|
312 |
+
{
|
313 |
+
return parent::doRequest('DirectDebit/update');
|
314 |
+
}
|
315 |
+
}
|
app/code/community/Pay/Payment/vendor/paynl/sdk/src/Api/Instore/ConfirmPayment.php
ADDED
@@ -0,0 +1,103 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Copyright (C) 2015 Andy Pieters <andy@pay.nl>
|
4 |
+
*
|
5 |
+
* This program is free software: you can redistribute it and/or modify
|
6 |
+
* it under the terms of the GNU General Public License as published by
|
7 |
+
* the Free Software Foundation, either version 3 of the License, or
|
8 |
+
* (at your option) any later version.
|
9 |
+
*
|
10 |
+
* This program is distributed in the hope that it will be useful,
|
11 |
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
+
* GNU General Public License for more details.
|
14 |
+
*
|
15 |
+
* You should have received a copy of the GNU General Public License
|
16 |
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
17 |
+
*/
|
18 |
+
|
19 |
+
namespace Paynl\Api\Instore;
|
20 |
+
|
21 |
+
use Paynl\Error;
|
22 |
+
|
23 |
+
|
24 |
+
/**
|
25 |
+
* Confirm the payment, and optionally sent the receipt to the enduser
|
26 |
+
*
|
27 |
+
* @author Andy Pieters <andy@pay.nl>
|
28 |
+
*/
|
29 |
+
class ConfirmPayment extends Instore
|
30 |
+
{
|
31 |
+
protected $apiTokenRequired = false;
|
32 |
+
protected $serviceIdRequired = false;
|
33 |
+
|
34 |
+
/**
|
35 |
+
* @var string The hash of the transaction
|
36 |
+
*/
|
37 |
+
protected $hash;
|
38 |
+
/**
|
39 |
+
* @var string The email address of the end-user
|
40 |
+
*/
|
41 |
+
protected $emailAddress;
|
42 |
+
|
43 |
+
/**
|
44 |
+
* @param string $hash
|
45 |
+
*/
|
46 |
+
public function setHash($hash)
|
47 |
+
{
|
48 |
+
$this->hash = $hash;
|
49 |
+
}
|
50 |
+
|
51 |
+
/**
|
52 |
+
* @param string $emailAddress
|
53 |
+
*/
|
54 |
+
public function setEmailAddress($emailAddress)
|
55 |
+
{
|
56 |
+
$this->emailAddress = $emailAddress;
|
57 |
+
}
|
58 |
+
|
59 |
+
/**
|
60 |
+
* @param int $languageId
|
61 |
+
*/
|
62 |
+
public function setLanguageId($languageId)
|
63 |
+
{
|
64 |
+
$this->languageId = (int)$languageId;
|
65 |
+
}
|
66 |
+
|
67 |
+
/**
|
68 |
+
* @var int The language of the email sent
|
69 |
+
*/
|
70 |
+
protected $languageId;
|
71 |
+
|
72 |
+
/**
|
73 |
+
* @return array The data
|
74 |
+
* @throws Error\Required
|
75 |
+
*/
|
76 |
+
protected function getData()
|
77 |
+
{
|
78 |
+
if (empty($this->hash)) {
|
79 |
+
throw new Error\Required('Hash is required');
|
80 |
+
}
|
81 |
+
$this->data['hash'] = $this->hash;
|
82 |
+
|
83 |
+
if (!empty($this->emailAddress)) {
|
84 |
+
$this->data['emailAddress'] = $this->emailAddress;
|
85 |
+
}
|
86 |
+
if (!empty($this->languageId)) {
|
87 |
+
$this->data['languageId'] = $this->languageId;
|
88 |
+
}
|
89 |
+
|
90 |
+
return parent::getData();
|
91 |
+
}
|
92 |
+
|
93 |
+
|
94 |
+
/**
|
95 |
+
* @param null $endpoint
|
96 |
+
* @param null $version
|
97 |
+
* @return array The result
|
98 |
+
*/
|
99 |
+
public function doRequest($endpoint = null, $version = null)
|
100 |
+
{
|
101 |
+
return parent::doRequest('instore/confirmPayment');
|
102 |
+
}
|
103 |
+
}
|
app/code/community/Pay/Payment/vendor/paynl/sdk/src/Api/Instore/GetAllTerminals.php
ADDED
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Copyright (C) 2015 Andy Pieters <andy@pay.nl>
|
4 |
+
*
|
5 |
+
* This program is free software: you can redistribute it and/or modify
|
6 |
+
* it under the terms of the GNU General Public License as published by
|
7 |
+
* the Free Software Foundation, either version 3 of the License, or
|
8 |
+
* (at your option) any later version.
|
9 |
+
*
|
10 |
+
* This program is distributed in the hope that it will be useful,
|
11 |
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
+
* GNU General Public License for more details.
|
14 |
+
*
|
15 |
+
* You should have received a copy of the GNU General Public License
|
16 |
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
17 |
+
*/
|
18 |
+
|
19 |
+
namespace Paynl\Api\Instore;
|
20 |
+
|
21 |
+
/**
|
22 |
+
* Description of GetAllTerminals
|
23 |
+
*
|
24 |
+
* @author Andy Pieters <andy@pay.nl>
|
25 |
+
*/
|
26 |
+
class GetAllTerminals extends Instore
|
27 |
+
{
|
28 |
+
protected $apiTokenRequired = true;
|
29 |
+
protected $serviceIdRequired = false;
|
30 |
+
/**
|
31 |
+
* @param null $endpoint
|
32 |
+
* @param null $version
|
33 |
+
* @return array the result
|
34 |
+
*/
|
35 |
+
public function doRequest($endpoint = null, $version = null)
|
36 |
+
{
|
37 |
+
return parent::doRequest('instore/getAllTerminals');
|
38 |
+
}
|
39 |
+
}
|
app/code/community/Pay/Payment/vendor/paynl/sdk/src/Api/Instore/GetTransactionTicket.php
ADDED
@@ -0,0 +1,68 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Copyright (C) 2015 Andy Pieters <andy@pay.nl>
|
4 |
+
*
|
5 |
+
* This program is free software: you can redistribute it and/or modify
|
6 |
+
* it under the terms of the GNU General Public License as published by
|
7 |
+
* the Free Software Foundation, either version 3 of the License, or
|
8 |
+
* (at your option) any later version.
|
9 |
+
*
|
10 |
+
* This program is distributed in the hope that it will be useful,
|
11 |
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
+
* GNU General Public License for more details.
|
14 |
+
*
|
15 |
+
* You should have received a copy of the GNU General Public License
|
16 |
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
17 |
+
*/
|
18 |
+
|
19 |
+
namespace Paynl\Api\Instore;
|
20 |
+
|
21 |
+
use Paynl\Error;
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Get the receipt data of an instore transaction
|
25 |
+
*
|
26 |
+
* @author Andy Pieters <andy@pay.nl>
|
27 |
+
*/
|
28 |
+
class GetTransactionTicket extends Instore
|
29 |
+
{
|
30 |
+
protected $apiTokenRequired = false;
|
31 |
+
protected $serviceIdRequired = false;
|
32 |
+
|
33 |
+
/**
|
34 |
+
* @var string The hash of the instore transaction
|
35 |
+
*/
|
36 |
+
private $hash;
|
37 |
+
|
38 |
+
/**
|
39 |
+
* @return array the data
|
40 |
+
* @throws Error\Required
|
41 |
+
*/
|
42 |
+
protected function getData()
|
43 |
+
{
|
44 |
+
if (empty($this->hash)) {
|
45 |
+
throw new Error\Required('Hash is niet geset');
|
46 |
+
}
|
47 |
+
$this->data['hash'] = $this->hash;
|
48 |
+
return parent::getData();
|
49 |
+
}
|
50 |
+
|
51 |
+
/**
|
52 |
+
* @param string $hash the hash of the instore transaction
|
53 |
+
*/
|
54 |
+
public function setHash($hash)
|
55 |
+
{
|
56 |
+
$this->hash = $hash;
|
57 |
+
}
|
58 |
+
|
59 |
+
/**
|
60 |
+
* @param null $endpoint
|
61 |
+
* @param null $version
|
62 |
+
* @return array the result
|
63 |
+
*/
|
64 |
+
public function doRequest($endpoint = null, $version = null)
|
65 |
+
{
|
66 |
+
return parent::doRequest('instore/getTransactionTicket');
|
67 |
+
}
|
68 |
+
}
|
app/code/community/Pay/Payment/vendor/paynl/sdk/src/Api/Instore/Instore.php
ADDED
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Copyright (C) 2015 Andy Pieters <andy@pay.nl>
|
4 |
+
*
|
5 |
+
* This program is free software: you can redistribute it and/or modify
|
6 |
+
* it under the terms of the GNU General Public License as published by
|
7 |
+
* the Free Software Foundation, either version 3 of the License, or
|
8 |
+
* (at your option) any later version.
|
9 |
+
*
|
10 |
+
* This program is distributed in the hope that it will be useful,
|
11 |
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
+
* GNU General Public License for more details.
|
14 |
+
*
|
15 |
+
* You should have received a copy of the GNU General Public License
|
16 |
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
17 |
+
*/
|
18 |
+
|
19 |
+
namespace Paynl\Api\Instore;
|
20 |
+
|
21 |
+
use Paynl\Api\Api;
|
22 |
+
use Paynl\Error;
|
23 |
+
|
24 |
+
/**
|
25 |
+
* Description of Instore
|
26 |
+
*
|
27 |
+
* @author Andy Pieters <andy@pay.nl>
|
28 |
+
*/
|
29 |
+
class Instore extends Api
|
30 |
+
{
|
31 |
+
/**
|
32 |
+
* @var int the version of the api
|
33 |
+
*/
|
34 |
+
protected $version = 1;
|
35 |
+
|
36 |
+
/**
|
37 |
+
* @param string $endpoint
|
38 |
+
* @param int|null $version
|
39 |
+
* @return array The result
|
40 |
+
*/
|
41 |
+
public function doRequest($endpoint, $version = null)
|
42 |
+
{
|
43 |
+
if (is_null($version)) {
|
44 |
+
$version = $this->version;
|
45 |
+
}
|
46 |
+
return parent::doRequest($endpoint, $version);
|
47 |
+
}
|
48 |
+
}
|
app/code/community/Pay/Payment/vendor/paynl/sdk/src/Api/Instore/Payment.php
ADDED
@@ -0,0 +1,86 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Copyright (C) 2015 Andy Pieters <andy@pay.nl>
|
4 |
+
*
|
5 |
+
* This program is free software: you can redistribute it and/or modify
|
6 |
+
* it under the terms of the GNU General Public License as published by
|
7 |
+
* the Free Software Foundation, either version 3 of the License, or
|
8 |
+
* (at your option) any later version.
|
9 |
+
*
|
10 |
+
* This program is distributed in the hope that it will be useful,
|
11 |
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
+
* GNU General Public License for more details.
|
14 |
+
*
|
15 |
+
* You should have received a copy of the GNU General Public License
|
16 |
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
17 |
+
*/
|
18 |
+
|
19 |
+
namespace Paynl\Api\Instore;
|
20 |
+
|
21 |
+
use Paynl\Error;
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Description of Status
|
25 |
+
*
|
26 |
+
* @author Andy Pieters <andy@pay.nl>
|
27 |
+
*/
|
28 |
+
class Payment extends Instore
|
29 |
+
{
|
30 |
+
protected $apiTokenRequired = true;
|
31 |
+
protected $serviceIdRequired = false;
|
32 |
+
|
33 |
+
/**
|
34 |
+
* @var string the TransactionId
|
35 |
+
*/
|
36 |
+
private $transactionId;
|
37 |
+
|
38 |
+
/**
|
39 |
+
* @var string the terminalId
|
40 |
+
*/
|
41 |
+
private $terminalId;
|
42 |
+
|
43 |
+
/**
|
44 |
+
* @return array The data
|
45 |
+
* @throws Error\Required
|
46 |
+
*/
|
47 |
+
protected function getData()
|
48 |
+
{
|
49 |
+
if (empty($this->transactionId)) {
|
50 |
+
throw new Error\Required('transactionId is niet geset');
|
51 |
+
}
|
52 |
+
$this->data['transactionId'] = $this->transactionId;
|
53 |
+
|
54 |
+
if (!empty($this->terminalId)) {
|
55 |
+
$this->data['terminalId'] = $this->terminalId;
|
56 |
+
}
|
57 |
+
|
58 |
+
return parent::getData();
|
59 |
+
}
|
60 |
+
|
61 |
+
/**
|
62 |
+
* @param string $transactionId
|
63 |
+
*/
|
64 |
+
public function setTransactionId($transactionId)
|
65 |
+
{
|
66 |
+
$this->transactionId = $transactionId;
|
67 |
+
}
|
68 |
+
|
69 |
+
/**
|
70 |
+
* @param string $terminalId
|
71 |
+
*/
|
72 |
+
public function setTerminalId($terminalId)
|
73 |
+
{
|
74 |
+
$this->terminalId = $terminalId;
|
75 |
+
}
|
76 |
+
|
77 |
+
/**
|
78 |
+
* @param null $endpoint
|
79 |
+
* @param null $version
|
80 |
+
* @return array The result
|
81 |
+
*/
|
82 |
+
public function doRequest($endpoint = null, $version = null)
|
83 |
+
{
|
84 |
+
return parent::doRequest('instore/payment');
|
85 |
+
}
|
86 |
+
}
|
app/code/community/Pay/Payment/vendor/paynl/sdk/src/Api/Instore/Status.php
ADDED
@@ -0,0 +1,68 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Copyright (C) 2015 Andy Pieters <andy@pay.nl>
|
4 |
+
*
|
5 |
+
* This program is free software: you can redistribute it and/or modify
|
6 |
+
* it under the terms of the GNU General Public License as published by
|
7 |
+
* the Free Software Foundation, either version 3 of the License, or
|
8 |
+
* (at your option) any later version.
|
9 |
+
*
|
10 |
+
* This program is distributed in the hope that it will be useful,
|
11 |
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
+
* GNU General Public License for more details.
|
14 |
+
*
|
15 |
+
* You should have received a copy of the GNU General Public License
|
16 |
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
17 |
+
*/
|
18 |
+
|
19 |
+
namespace Paynl\Api\Instore;
|
20 |
+
|
21 |
+
use Paynl\Error;
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Description of Status
|
25 |
+
*
|
26 |
+
* @author Andy Pieters <andy@pay.nl>
|
27 |
+
*/
|
28 |
+
class Status extends Instore
|
29 |
+
{
|
30 |
+
protected $apiTokenRequired = false;
|
31 |
+
protected $serviceIdRequired = false;
|
32 |
+
|
33 |
+
/**
|
34 |
+
* @var string The hash of the instore transaction
|
35 |
+
*/
|
36 |
+
private $hash;
|
37 |
+
|
38 |
+
/**
|
39 |
+
* @return array the data
|
40 |
+
* @throws Error\Required
|
41 |
+
*/
|
42 |
+
protected function getData()
|
43 |
+
{
|
44 |
+
if (empty($this->hash)) {
|
45 |
+
throw new Error\Required('Hash is niet geset');
|
46 |
+
}
|
47 |
+
$this->data['hash'] = $this->hash;
|
48 |
+
return parent::getData();
|
49 |
+
}
|
50 |
+
|
51 |
+
/**
|
52 |
+
* @param string $hash the hash of the instore transaction
|
53 |
+
*/
|
54 |
+
public function setHash($hash)
|
55 |
+
{
|
56 |
+
$this->hash = $hash;
|
57 |
+
}
|
58 |
+
|
59 |
+
/**
|
60 |
+
* @param null $endpoint
|
61 |
+
* @param null $version
|
62 |
+
* @return array the result
|
63 |
+
*/
|
64 |
+
public function doRequest($endpoint = null, $version = null)
|
65 |
+
{
|
66 |
+
return parent::doRequest('instore/status');
|
67 |
+
}
|
68 |
+
}
|
app/code/community/Pay/Payment/vendor/paynl/sdk/src/Api/Refund/Add.php
ADDED
@@ -0,0 +1,262 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Copyright (C) 2015 Andy Pieters <andy@pay.nl>
|
4 |
+
*
|
5 |
+
* This program is free software: you can redistribute it and/or modify
|
6 |
+
* it under the terms of the GNU General Public License as published by
|
7 |
+
* the Free Software Foundation, either version 3 of the License, or
|
8 |
+
* (at your option) any later version.
|
9 |
+
*
|
10 |
+
* This program is distributed in the hope that it will be useful,
|
11 |
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
+
* GNU General Public License for more details.
|
14 |
+
*
|
15 |
+
* You should have received a copy of the GNU General Public License
|
16 |
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
17 |
+
*/
|
18 |
+
|
19 |
+
namespace Paynl\Api\Refund;
|
20 |
+
|
21 |
+
use Paynl\Helper;
|
22 |
+
use Paynl\Config;
|
23 |
+
use Paynl\Error\Required as ErrorRequired;
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Api class to refund a transaction
|
27 |
+
*
|
28 |
+
* @author Chris de Jong <chris@eventix.io>
|
29 |
+
*/
|
30 |
+
class Add extends Refund
|
31 |
+
{
|
32 |
+
protected $apiTokenRequired = true;
|
33 |
+
protected $serviceIdRequired = true;
|
34 |
+
|
35 |
+
/**
|
36 |
+
* @var int the amount in cents
|
37 |
+
*/
|
38 |
+
private $_amount;
|
39 |
+
/**
|
40 |
+
* @var string the bankAccountHolder
|
41 |
+
*/
|
42 |
+
private $_bankAccountHolder;
|
43 |
+
/**
|
44 |
+
* @var string the bankAccountNumber
|
45 |
+
*/
|
46 |
+
private $_bankAccountNumber;
|
47 |
+
/**
|
48 |
+
* @var string the bankAccountBic
|
49 |
+
*/
|
50 |
+
private $_bankAccountBic;
|
51 |
+
/**
|
52 |
+
* @var string the description for this refund
|
53 |
+
*/
|
54 |
+
private $_description;
|
55 |
+
/**
|
56 |
+
* @var string additional data promotorId
|
57 |
+
*/
|
58 |
+
private $_promotorId;
|
59 |
+
/**
|
60 |
+
* @var string additional data tool
|
61 |
+
*/
|
62 |
+
private $_tool;
|
63 |
+
/**
|
64 |
+
* @var string additional data info
|
65 |
+
*/
|
66 |
+
private $_info;
|
67 |
+
/**
|
68 |
+
* @var string additional data info
|
69 |
+
*/
|
70 |
+
private $_object;
|
71 |
+
/**
|
72 |
+
* @var string additional data extra1
|
73 |
+
*/
|
74 |
+
private $_extra1;
|
75 |
+
/**
|
76 |
+
* @var string additional data extra2
|
77 |
+
*/
|
78 |
+
private $_extra2;
|
79 |
+
/**
|
80 |
+
* @var string additional data extra3
|
81 |
+
*/
|
82 |
+
private $_extra3;
|
83 |
+
/**
|
84 |
+
* @var string the orderId
|
85 |
+
*/
|
86 |
+
private $_orderId;
|
87 |
+
/**
|
88 |
+
* @var string the currency
|
89 |
+
*/
|
90 |
+
private $_currency;
|
91 |
+
/**
|
92 |
+
* @var string the currency
|
93 |
+
*/
|
94 |
+
private $_processDate;
|
95 |
+
|
96 |
+
/**
|
97 |
+
* Get data to send to the api
|
98 |
+
*
|
99 |
+
* @return array
|
100 |
+
* @throws ErrorRequired
|
101 |
+
*/
|
102 |
+
protected function getData()
|
103 |
+
{
|
104 |
+
Helper::requireServiceId();
|
105 |
+
|
106 |
+
$this->data['serviceId'] = Config::getServiceId();
|
107 |
+
|
108 |
+
if (empty($this->_amount)) {
|
109 |
+
throw new ErrorRequired('Amount is not set', 1);
|
110 |
+
}
|
111 |
+
$this->data['amount'] = $this->_amount;
|
112 |
+
|
113 |
+
if (empty($this->_bankAccountHolder)) {
|
114 |
+
throw new ErrorRequired('bankAccountHolder is not set', 1);
|
115 |
+
}
|
116 |
+
$this->data['bankAccountHolder'] = $this->_bankAccountHolder;
|
117 |
+
|
118 |
+
if (empty($this->_bankAccountNumber)) {
|
119 |
+
throw new ErrorRequired('bankAccountNumber is not set', 1);
|
120 |
+
}
|
121 |
+
$this->data['bankAccountNumber'] = $this->_bankAccountNumber;
|
122 |
+
|
123 |
+
if (!empty($this->_bankAccountBic)) {
|
124 |
+
$this->data['bankAccountBic'] = $this->_bankAccountBic;
|
125 |
+
}
|
126 |
+
if (!empty($this->_description)) {
|
127 |
+
$this->data['description'] = $this->_description;
|
128 |
+
}
|
129 |
+
if (!empty($this->_promotorId)) {
|
130 |
+
$this->data['promotorId'] = $this->_promotorId;
|
131 |
+
}
|
132 |
+
if (!empty($this->_info)) {
|
133 |
+
$this->data['info'] = $this->_info;
|
134 |
+
}
|
135 |
+
if (!empty($this->_tool)) {
|
136 |
+
$this->data['tool'] = $this->_tool;
|
137 |
+
}
|
138 |
+
if (!empty($this->_object)) {
|
139 |
+
$this->data['object'] = $this->_object;
|
140 |
+
}
|
141 |
+
if (!empty($this->_extra1)) {
|
142 |
+
$this->data['extra1'] = $this->_extra1;
|
143 |
+
}
|
144 |
+
if (!empty($this->_extra2)) {
|
145 |
+
$this->data['extra2'] = $this->_extra2;
|
146 |
+
}
|
147 |
+
if (!empty($this->_extra3)) {
|
148 |
+
$this->data['extra3'] = $this->_extra3;
|
149 |
+
}
|
150 |
+
if (isset($this->_orderId)) {
|
151 |
+
$this->data['orderId'] = $this->_orderId;
|
152 |
+
}
|
153 |
+
if (isset($this->_currency)) {
|
154 |
+
$this->data['currency'] = $this->_currency;
|
155 |
+
}
|
156 |
+
if(!empty($this->_processDate)){
|
157 |
+
$this->data['processDate'] = $this->_processDate->format('d-m-Y');
|
158 |
+
}
|
159 |
+
|
160 |
+
return parent::getData();
|
161 |
+
}
|
162 |
+
|
163 |
+
/**
|
164 |
+
* @param int $amount
|
165 |
+
*/
|
166 |
+
public function setAmount($amount)
|
167 |
+
{
|
168 |
+
$this->_amount = (int)$amount;
|
169 |
+
}
|
170 |
+
|
171 |
+
/**
|
172 |
+
* @param string $bankAccountHolder
|
173 |
+
*/
|
174 |
+
public function setBankAccountHolder($bankAccountHolder)
|
175 |
+
{
|
176 |
+
$this->_bankAccountHolder = $bankAccountHolder;
|
177 |
+
}
|
178 |
+
|
179 |
+
/**
|
180 |
+
* @param string $bankAccountHolder
|
181 |
+
*/
|
182 |
+
public function setBankAccountNumber($bankAccountNumber)
|
183 |
+
{
|
184 |
+
$this->_bankAccountNumber = $bankAccountNumber;
|
185 |
+
}
|
186 |
+
|
187 |
+
/**
|
188 |
+
* @param string $bankAccountHolder
|
189 |
+
*/
|
190 |
+
public function setBankAccountBic($bankAccountBic)
|
191 |
+
{
|
192 |
+
$this->_bankAccountBic = $bankAccountBic;
|
193 |
+
}
|
194 |
+
|
195 |
+
/**
|
196 |
+
* @param string $description
|
197 |
+
*/
|
198 |
+
public function setDescription($description)
|
199 |
+
{
|
200 |
+
$this->_description = $description;
|
201 |
+
}
|
202 |
+
|
203 |
+
public function setPromotorId($promotorId)
|
204 |
+
{
|
205 |
+
$this->_promotorId = $promotorId;
|
206 |
+
}
|
207 |
+
|
208 |
+
public function setTool($tool)
|
209 |
+
{
|
210 |
+
$this->_tool = $tool;
|
211 |
+
}
|
212 |
+
|
213 |
+
public function setInfo($info)
|
214 |
+
{
|
215 |
+
$this->_info = $info;
|
216 |
+
}
|
217 |
+
|
218 |
+
public function setObject($object)
|
219 |
+
{
|
220 |
+
$this->_object = $object;
|
221 |
+
}
|
222 |
+
|
223 |
+
public function setExtra1($extra1)
|
224 |
+
{
|
225 |
+
$this->_extra1 = $extra1;
|
226 |
+
}
|
227 |
+
|
228 |
+
public function setExtra2($extra2)
|
229 |
+
{
|
230 |
+
$this->_extra2 = $extra2;
|
231 |
+
}
|
232 |
+
|
233 |
+
public function setExtra3($extra3)
|
234 |
+
{
|
235 |
+
$this->_extra3 = $extra3;
|
236 |
+
}
|
237 |
+
|
238 |
+
public function setOrderId($orderId)
|
239 |
+
{
|
240 |
+
$this->_orderId = $orderId;
|
241 |
+
}
|
242 |
+
|
243 |
+
public function setCurrency($currency)
|
244 |
+
{
|
245 |
+
$this->_currency = $currency;
|
246 |
+
}
|
247 |
+
|
248 |
+
public function setProcessDate(\DateTime $processDate)
|
249 |
+
{
|
250 |
+
$this->_processDate = $processDate;
|
251 |
+
}
|
252 |
+
|
253 |
+
/**
|
254 |
+
* @param null $endpoint
|
255 |
+
* @param null $version
|
256 |
+
* @return array
|
257 |
+
*/
|
258 |
+
public function doRequest($endpoint = null, $version = null)
|
259 |
+
{
|
260 |
+
return parent::doRequest('Refund/add');
|
261 |
+
}
|
262 |
+
}
|
app/code/community/Pay/Payment/vendor/paynl/sdk/src/Api/Refund/Refund.php
ADDED
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Copyright (C) 2015 Andy Pieters <andy@pay.nl>
|
4 |
+
*
|
5 |
+
* This program is free software: you can redistribute it and/or modify
|
6 |
+
* it under the terms of the GNU General Public License as published by
|
7 |
+
* the Free Software Foundation, either version 3 of the License, or
|
8 |
+
* (at your option) any later version.
|
9 |
+
*
|
10 |
+
* This program is distributed in the hope that it will be useful,
|
11 |
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
+
* GNU General Public License for more details.
|
14 |
+
*
|
15 |
+
* You should have received a copy of the GNU General Public License
|
16 |
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
17 |
+
*/
|
18 |
+
|
19 |
+
namespace Paynl\Api\Refund;
|
20 |
+
|
21 |
+
use Paynl\Api\Api;
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Description of Instore
|
25 |
+
*
|
26 |
+
* @author Chris de Jong <chris@eventix.io>
|
27 |
+
*/
|
28 |
+
class Refund extends Api
|
29 |
+
{
|
30 |
+
/**
|
31 |
+
* @var int the version of the api
|
32 |
+
*/
|
33 |
+
protected $_version = 2;
|
34 |
+
|
35 |
+
/**
|
36 |
+
* @param string $endpoint
|
37 |
+
* @param int|null $version
|
38 |
+
* @return array The result
|
39 |
+
*/
|
40 |
+
public function doRequest($endpoint, $version = null)
|
41 |
+
{
|
42 |
+
if (is_null($version)) {
|
43 |
+
$version = $this->_version;
|
44 |
+
}
|
45 |
+
return parent::doRequest($endpoint, $version);
|
46 |
+
}
|
47 |
+
}
|
app/code/community/Pay/Payment/vendor/paynl/sdk/src/Api/Service/GetPayLinkUrl.php
ADDED
@@ -0,0 +1,162 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
namespace Paynl\Api\Service;
|
3 |
+
|
4 |
+
class GetPayLinkUrl extends Service
|
5 |
+
{
|
6 |
+
protected $serviceIdRequired = true;
|
7 |
+
|
8 |
+
/**
|
9 |
+
* @var integer
|
10 |
+
*/
|
11 |
+
private $securityMode;
|
12 |
+
/**
|
13 |
+
* @var integer
|
14 |
+
*/
|
15 |
+
private $amount;
|
16 |
+
/**
|
17 |
+
* @var integer
|
18 |
+
*/
|
19 |
+
private $amountMin;
|
20 |
+
/**
|
21 |
+
* @var string
|
22 |
+
*/
|
23 |
+
private $countryCode;
|
24 |
+
/**
|
25 |
+
* @var string
|
26 |
+
*/
|
27 |
+
private $language;
|
28 |
+
/**
|
29 |
+
* @var array
|
30 |
+
*/
|
31 |
+
private $extra1;
|
32 |
+
/**
|
33 |
+
* @var array
|
34 |
+
*/
|
35 |
+
private $extra2;
|
36 |
+
/**
|
37 |
+
* @var array
|
38 |
+
*/
|
39 |
+
private $extra3;
|
40 |
+
/**
|
41 |
+
* @var string
|
42 |
+
*/
|
43 |
+
private $tool;
|
44 |
+
/**
|
45 |
+
* @var string
|
46 |
+
*/
|
47 |
+
private $info;
|
48 |
+
|
49 |
+
/**
|
50 |
+
* @param int $securityMode
|
51 |
+
*/
|
52 |
+
public function setSecurityMode($securityMode)
|
53 |
+
{
|
54 |
+
$this->securityMode = $securityMode;
|
55 |
+
}
|
56 |
+
|
57 |
+
/**
|
58 |
+
* @param int $amount
|
59 |
+
*/
|
60 |
+
public function setAmount($amount)
|
61 |
+
{
|
62 |
+
$this->amount = $amount;
|
63 |
+
}
|
64 |
+
|
65 |
+
/**
|
66 |
+
* @param int $amountMin
|
67 |
+
*/
|
68 |
+
public function setAmountMin($amountMin)
|
69 |
+
{
|
70 |
+
$this->amountMin = $amountMin;
|
71 |
+
}
|
72 |
+
|
73 |
+
/**
|
74 |
+
* @param string $countryCode
|
75 |
+
*/
|
76 |
+
public function setCountryCode($countryCode)
|
77 |
+
{
|
78 |
+
$this->countryCode = $countryCode;
|
79 |
+
}
|
80 |
+
|
81 |
+
/**
|
82 |
+
* @param string $language
|
83 |
+
*/
|
84 |
+
public function setLanguage($language)
|
85 |
+
{
|
86 |
+
$this->language = $language;
|
87 |
+
}
|
88 |
+
|
89 |
+
/**
|
90 |
+
* @param array $extra1
|
91 |
+
*/
|
92 |
+
public function setExtra1(array $extra1)
|
93 |
+
{
|
94 |
+
$this->extra1 = $extra1;
|
95 |
+
}
|
96 |
+
|
97 |
+
/**
|
98 |
+
* @param array $extra2
|
99 |
+
*/
|
100 |
+
public function setExtra2(array $extra2)
|
101 |
+
{
|
102 |
+
$this->extra2 = $extra2;
|
103 |
+
}
|
104 |
+
|
105 |
+
/**
|
106 |
+
* @param array $extra3
|
107 |
+
*/
|
108 |
+
public function setExtra3(array $extra3)
|
109 |
+
{
|
110 |
+
$this->extra3 = $extra3;
|
111 |
+
}
|
112 |
+
|
113 |
+
/**
|
114 |
+
* @param string $tool
|
115 |
+
*/
|
116 |
+
public function setTool($tool)
|
117 |
+
{
|
118 |
+
$this->tool = $tool;
|
119 |
+
}
|
120 |
+
|
121 |
+
/**
|
122 |
+
* @param string $info
|
123 |
+
*/
|
124 |
+
public function setInfo($info)
|
125 |
+
{
|
126 |
+
$this->info = $info;
|
127 |
+
}
|
128 |
+
|
129 |
+
protected function getData()
|
130 |
+
{
|
131 |
+
$data = parent::getData();
|
132 |
+
|
133 |
+
$data['securityMode'] = $this->securityMode;
|
134 |
+
$data['amount'] = $this->amount;
|
135 |
+
$data['amountMin'] = $this->amountMin;
|
136 |
+
if (isset($this->countryCode))
|
137 |
+
$data['countryCode'] = $this->countryCode;
|
138 |
+
if (isset($this->language))
|
139 |
+
$data['language'] = $this->language;
|
140 |
+
if (isset($this->extra1))
|
141 |
+
$data['extra1'] = $this->extra1;
|
142 |
+
if (isset($this->extra2))
|
143 |
+
$data['extra2'] = $this->extra2;
|
144 |
+
if (isset($this->extra3))
|
145 |
+
$data['extra3'] = $this->extra3;
|
146 |
+
if (isset($this->tool))
|
147 |
+
$data['tool'] = $this->tool;
|
148 |
+
if (isset($this->info))
|
149 |
+
$data['info'] = $this->info;
|
150 |
+
|
151 |
+
return $data;
|
152 |
+
}
|
153 |
+
/**
|
154 |
+
* @param null $endpoint
|
155 |
+
* @param null $version
|
156 |
+
* @return array
|
157 |
+
*/
|
158 |
+
public function doRequest($endpoint = null, $version = null)
|
159 |
+
{
|
160 |
+
return parent::doRequest('Service/getPayLinkUrl');
|
161 |
+
}
|
162 |
+
}
|
app/code/community/Pay/Payment/vendor/paynl/sdk/src/Api/Service/Service.php
ADDED
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Created by PhpStorm.
|
4 |
+
* User: andy
|
5 |
+
* Date: 16-1-17
|
6 |
+
* Time: 20:26
|
7 |
+
*/
|
8 |
+
|
9 |
+
namespace Paynl\Api\Service;
|
10 |
+
|
11 |
+
|
12 |
+
use Paynl\Api\Api;
|
13 |
+
|
14 |
+
class Service extends Api
|
15 |
+
{
|
16 |
+
protected $apiTokenRequired = true;
|
17 |
+
|
18 |
+
/**
|
19 |
+
* @var int the version of the api
|
20 |
+
*/
|
21 |
+
protected $_version = 3;
|
22 |
+
|
23 |
+
/**
|
24 |
+
* @param string $endpoint
|
25 |
+
* @param int|null $version
|
26 |
+
* @return array The result
|
27 |
+
*/
|
28 |
+
public function doRequest($endpoint, $version = null)
|
29 |
+
{
|
30 |
+
if (is_null($version)) {
|
31 |
+
$version = $this->_version;
|
32 |
+
}
|
33 |
+
return parent::doRequest($endpoint, $version);
|
34 |
+
}
|
35 |
+
}
|
app/code/community/Pay/Payment/vendor/paynl/sdk/src/Api/Transaction/Approve.php
ADDED
@@ -0,0 +1,70 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Copyright (C) 2015 Andy Pieters <andy@pay.nl>
|
4 |
+
*
|
5 |
+
* This program is free software: you can redistribute it and/or modify
|
6 |
+
* it under the terms of the GNU General Public License as published by
|
7 |
+
* the Free Software Foundation, either version 3 of the License, or
|
8 |
+
* (at your option) any later version.
|
9 |
+
*
|
10 |
+
* This program is distributed in the hope that it will be useful,
|
11 |
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
+
* GNU General Public License for more details.
|
14 |
+
*
|
15 |
+
* You should have received a copy of the GNU General Public License
|
16 |
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
17 |
+
*/
|
18 |
+
|
19 |
+
namespace Paynl\Api\Transaction;
|
20 |
+
|
21 |
+
use Paynl\Error;
|
22 |
+
/**
|
23 |
+
* Description of Approve
|
24 |
+
*
|
25 |
+
* @author Andy Pieters <andy@pay.nl>
|
26 |
+
*/
|
27 |
+
class Approve extends Transaction
|
28 |
+
{
|
29 |
+
protected $apiTokenRequired = true;
|
30 |
+
protected $serviceIdRequired = false;
|
31 |
+
|
32 |
+
/**
|
33 |
+
* @var string
|
34 |
+
*/
|
35 |
+
private $transactionId;
|
36 |
+
|
37 |
+
/**
|
38 |
+
* Get data to send to the api
|
39 |
+
*
|
40 |
+
* @return array
|
41 |
+
* @throws Error\Required
|
42 |
+
*/
|
43 |
+
protected function getData() {
|
44 |
+
if(empty($this->transactionId)){
|
45 |
+
throw new Error\Required('TransactionId is niet geset');
|
46 |
+
}
|
47 |
+
$this->data['orderId'] = $this->transactionId;
|
48 |
+
return parent::getData();
|
49 |
+
}
|
50 |
+
|
51 |
+
/**
|
52 |
+
* Set the transactionId
|
53 |
+
*
|
54 |
+
* @param string $transactionId
|
55 |
+
*/
|
56 |
+
public function setTransactionId($transactionId){
|
57 |
+
$this->transactionId = $transactionId;
|
58 |
+
}
|
59 |
+
|
60 |
+
/**
|
61 |
+
* Do the request
|
62 |
+
*
|
63 |
+
* @param null $endpoint
|
64 |
+
* @param null $version
|
65 |
+
* @return array the result
|
66 |
+
*/
|
67 |
+
public function doRequest($endpoint = null, $version = null) {
|
68 |
+
return parent::doRequest('transaction/approve');
|
69 |
+
}
|
70 |
+
}
|
app/code/community/Pay/Payment/vendor/paynl/sdk/src/Api/Transaction/Capture.php
ADDED
@@ -0,0 +1,70 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Copyright (C) 2015 Andy Pieters <andy@pay.nl>
|
4 |
+
*
|
5 |
+
* This program is free software: you can redistribute it and/or modify
|
6 |
+
* it under the terms of the GNU General Public License as published by
|
7 |
+
* the Free Software Foundation, either version 3 of the License, or
|
8 |
+
* (at your option) any later version.
|
9 |
+
*
|
10 |
+
* This program is distributed in the hope that it will be useful,
|
11 |
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
+
* GNU General Public License for more details.
|
14 |
+
*
|
15 |
+
* You should have received a copy of the GNU General Public License
|
16 |
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
17 |
+
*/
|
18 |
+
|
19 |
+
namespace Paynl\Api\Transaction;
|
20 |
+
|
21 |
+
use Paynl\Error;
|
22 |
+
/**
|
23 |
+
* Description of Approve
|
24 |
+
*
|
25 |
+
* @author Andy Pieters <andy@pay.nl>
|
26 |
+
*/
|
27 |
+
class Capture extends Transaction
|
28 |
+
{
|
29 |
+
protected $apiTokenRequired = true;
|
30 |
+
protected $serviceIdRequired = false;
|
31 |
+
|
32 |
+
/**
|
33 |
+
* @var string
|
34 |
+
*/
|
35 |
+
private $transactionId;
|
36 |
+
|
37 |
+
/**
|
38 |
+
* Get data to send to the api
|
39 |
+
*
|
40 |
+
* @return array
|
41 |
+
* @throws Error\Required
|
42 |
+
*/
|
43 |
+
protected function getData() {
|
44 |
+
if(empty($this->transactionId)){
|
45 |
+
throw new Error\Required('TransactionId is niet geset');
|
46 |
+
}
|
47 |
+
$this->data['transactionId'] = $this->transactionId;
|
48 |
+
return parent::getData();
|
49 |
+
}
|
50 |
+
|
51 |
+
/**
|
52 |
+
* Set the transactionId
|
53 |
+
*
|
54 |
+
* @param string $transactionId
|
55 |
+
*/
|
56 |
+
public function setTransactionId($transactionId){
|
57 |
+
$this->transactionId = $transactionId;
|
58 |
+
}
|
59 |
+
|
60 |
+
/**
|
61 |
+
* Do the request
|
62 |
+
*
|
63 |
+
* @param null $endpoint
|
64 |
+
* @param null $version
|
65 |
+
* @return array the result
|
66 |
+
*/
|
67 |
+
public function doRequest($endpoint = null, $version = null) {
|
68 |
+
return parent::doRequest('transaction/capture');
|
69 |
+
}
|
70 |
+
}
|
app/code/community/Pay/Payment/vendor/paynl/sdk/src/Api/Transaction/Decline.php
ADDED
@@ -0,0 +1,70 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Copyright (C) 2015 Andy Pieters <andy@pay.nl>
|
4 |
+
*
|
5 |
+
* This program is free software: you can redistribute it and/or modify
|
6 |
+
* it under the terms of the GNU General Public License as published by
|
7 |
+
* the Free Software Foundation, either version 3 of the License, or
|
8 |
+
* (at your option) any later version.
|
9 |
+
*
|
10 |
+
* This program is distributed in the hope that it will be useful,
|
11 |
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
+
* GNU General Public License for more details.
|
14 |
+
*
|
15 |
+
* You should have received a copy of the GNU General Public License
|
16 |
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
17 |
+
*/
|
18 |
+
|
19 |
+
namespace Paynl\Api\Transaction;
|
20 |
+
|
21 |
+
use Paynl\Error;
|
22 |
+
/**
|
23 |
+
* Description of Approve
|
24 |
+
*
|
25 |
+
* @author Andy Pieters <andy@pay.nl>
|
26 |
+
*/
|
27 |
+
class Decline extends Transaction
|
28 |
+
{
|
29 |
+
protected $apiTokenRequired = true;
|
30 |
+
protected $serviceIdRequired = false;
|
31 |
+
|
32 |
+
/**
|
33 |
+
* @var string
|
34 |
+
*/
|
35 |
+
private $transactionId;
|
36 |
+
|
37 |
+
/**
|
38 |
+
* Get data to send to the api
|
39 |
+
*
|
40 |
+
* @return array
|
41 |
+
* @throws Error\Required
|
42 |
+
*/
|
43 |
+
protected function getData() {
|
44 |
+
if(empty($this->transactionId)){
|
45 |
+
throw new Error\Required('TransactionId is niet geset');
|
46 |
+
}
|
47 |
+
$this->data['orderId'] = $this->transactionId;
|
48 |
+
return parent::getData();
|
49 |
+
}
|
50 |
+
|
51 |
+
/**
|
52 |
+
* Set the transactionId
|
53 |
+
*
|
54 |
+
* @param string $transactionId
|
55 |
+
*/
|
56 |
+
public function setTransactionId($transactionId){
|
57 |
+
$this->transactionId = $transactionId;
|
58 |
+
}
|
59 |
+
|
60 |
+
/**
|
61 |
+
* Do the request
|
62 |
+
*
|
63 |
+
* @param null $endpoint
|
64 |
+
* @param null $version
|
65 |
+
* @return array the result
|
66 |
+
*/
|
67 |
+
public function doRequest($endpoint = null, $version = null) {
|
68 |
+
return parent::doRequest('transaction/decline');
|
69 |
+
}
|
70 |
+
}
|
app/code/community/Pay/Payment/vendor/paynl/sdk/src/Api/Transaction/GetService.php
ADDED
@@ -0,0 +1,76 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* Copyright (C) 2015 Andy Pieters <andy@andypieters.nl>
|
5 |
+
*
|
6 |
+
* This program is free software: you can redistribute it and/or modify
|
7 |
+
* it under the terms of the GNU General Public License as published by
|
8 |
+
* the Free Software Foundation, either version 3 of the License, or
|
9 |
+
* (at your option) any later version.
|
10 |
+
*
|
11 |
+
* This program is distributed in the hope that it will be useful,
|
12 |
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13 |
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14 |
+
* GNU General Public License for more details.
|
15 |
+
*
|
16 |
+
* You should have received a copy of the GNU General Public License
|
17 |
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
18 |
+
*/
|
19 |
+
|
20 |
+
namespace Paynl\Api\Transaction;
|
21 |
+
|
22 |
+
use Paynl\Helper;
|
23 |
+
use Paynl\Config;
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Description of GetService
|
27 |
+
*
|
28 |
+
* @author Andy Pieters <andy@andypieters.nl>
|
29 |
+
*/
|
30 |
+
class GetService extends Transaction
|
31 |
+
{
|
32 |
+
protected $apiTokenRequired = true;
|
33 |
+
protected $serviceIdRequired = true;
|
34 |
+
|
35 |
+
/**
|
36 |
+
* @var array cached result
|
37 |
+
*/
|
38 |
+
private static $cache = array();
|
39 |
+
|
40 |
+
/**
|
41 |
+
* Get data to send to the api
|
42 |
+
*
|
43 |
+
* @return array
|
44 |
+
* @throws \Paynl\Error\Required\ServiceId
|
45 |
+
*/
|
46 |
+
protected function getData()
|
47 |
+
{
|
48 |
+
Helper::requireServiceId();
|
49 |
+
|
50 |
+
$this->data['serviceId'] = Config::getServiceId();
|
51 |
+
|
52 |
+
return parent::getData();
|
53 |
+
}
|
54 |
+
|
55 |
+
/**
|
56 |
+
* Do the request
|
57 |
+
*
|
58 |
+
* @param null $endpoint
|
59 |
+
* @param null $version
|
60 |
+
* @return array The result
|
61 |
+
*/
|
62 |
+
public function doRequest($endpoint = null, $version = null)
|
63 |
+
{
|
64 |
+
if (isset(self::$cache[Config::getServiceId()])) {
|
65 |
+
Helper::requireApiToken();
|
66 |
+
Helper::requireServiceId();
|
67 |
+
return self::$cache[Config::getServiceId()];
|
68 |
+
} else {
|
69 |
+
$result = parent::doRequest('transaction/getService');
|
70 |
+
self::$cache[Config::getServiceId()] = $result;
|
71 |
+
return $result;
|
72 |
+
}
|
73 |
+
}
|
74 |
+
|
75 |
+
|
76 |
+
}
|
app/code/community/Pay/Payment/vendor/paynl/sdk/src/Api/Transaction/Info.php
ADDED
@@ -0,0 +1,70 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Copyright (C) 2015 Andy Pieters <andy@pay.nl>
|
4 |
+
*
|
5 |
+
* This program is free software: you can redistribute it and/or modify
|
6 |
+
* it under the terms of the GNU General Public License as published by
|
7 |
+
* the Free Software Foundation, either version 3 of the License, or
|
8 |
+
* (at your option) any later version.
|
9 |
+
*
|
10 |
+
* This program is distributed in the hope that it will be useful,
|
11 |
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
+
* GNU General Public License for more details.
|
14 |
+
*
|
15 |
+
* You should have received a copy of the GNU General Public License
|
16 |
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
17 |
+
*/
|
18 |
+
|
19 |
+
namespace Paynl\Api\Transaction;
|
20 |
+
|
21 |
+
use Paynl\Error;
|
22 |
+
/**
|
23 |
+
* Description of Info
|
24 |
+
*
|
25 |
+
* @author Andy Pieters <andy@pay.nl>
|
26 |
+
*/
|
27 |
+
class Info extends Transaction
|
28 |
+
{
|
29 |
+
protected $apiTokenRequired = true;
|
30 |
+
protected $serviceIdRequired = false;
|
31 |
+
|
32 |
+
/**
|
33 |
+
* @var string
|
34 |
+
*/
|
35 |
+
private $transactionId;
|
36 |
+
|
37 |
+
/**
|
38 |
+
* Get data to send to the api
|
39 |
+
*
|
40 |
+
* @return array
|
41 |
+
* @throws Error\Required
|
42 |
+
*/
|
43 |
+
protected function getData() {
|
44 |
+
if(empty($this->transactionId)){
|
45 |
+
throw new Error\Required('TransactionId is niet geset');
|
46 |
+
}
|
47 |
+
$this->data['transactionId'] = $this->transactionId;
|
48 |
+
return parent::getData();
|
49 |
+
}
|
50 |
+
|
51 |
+
/**
|
52 |
+
* Set the transactionId
|
53 |
+
*
|
54 |
+
* @param string $transactionId
|
55 |
+
*/
|
56 |
+
public function setTransactionId($transactionId){
|
57 |
+
$this->transactionId = $transactionId;
|
58 |
+
}
|
59 |
+
|
60 |
+
/**
|
61 |
+
* Do the request
|
62 |
+
*
|
63 |
+
* @param null $endpoint
|
64 |
+
* @param null $version
|
65 |
+
* @return array the result
|
66 |
+
*/
|
67 |
+
public function doRequest($endpoint = null, $version = null) {
|
68 |
+
return parent::doRequest('transaction/info');
|
69 |
+
}
|
70 |
+
}
|
app/code/community/Pay/Payment/vendor/paynl/sdk/src/Api/Transaction/Refund.php
ADDED
@@ -0,0 +1,100 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Copyright (C) 2015 Andy Pieters <andy@pay.nl>
|
4 |
+
*
|
5 |
+
* This program is free software: you can redistribute it and/or modify
|
6 |
+
* it under the terms of the GNU General Public License as published by
|
7 |
+
* the Free Software Foundation, either version 3 of the License, or
|
8 |
+
* (at your option) any later version.
|
9 |
+
*
|
10 |
+
* This program is distributed in the hope that it will be useful,
|
11 |
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
+
* GNU General Public License for more details.
|
14 |
+
*
|
15 |
+
* You should have received a copy of the GNU General Public License
|
16 |
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
17 |
+
*/
|
18 |
+
|
19 |
+
namespace Paynl\Api\Transaction;
|
20 |
+
|
21 |
+
use Paynl\Error;
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Api class to refund a transaction
|
25 |
+
*
|
26 |
+
* @author Andy Pieters <andy@pay.nl>
|
27 |
+
*/
|
28 |
+
class Refund extends Transaction
|
29 |
+
{
|
30 |
+
protected $apiTokenRequired = true;
|
31 |
+
protected $serviceIdRequired = false;
|
32 |
+
|
33 |
+
/**
|
34 |
+
* @var string the transactionId
|
35 |
+
*/
|
36 |
+
private $transactionId;
|
37 |
+
|
38 |
+
/**
|
39 |
+
* @var int the amount in cents
|
40 |
+
*/
|
41 |
+
private $amount;
|
42 |
+
/**
|
43 |
+
* @var string the description for this refund
|
44 |
+
*/
|
45 |
+
private $description;
|
46 |
+
|
47 |
+
/**
|
48 |
+
* Get data to send to the api
|
49 |
+
*
|
50 |
+
* @return array
|
51 |
+
* @throws Error\Required
|
52 |
+
*/
|
53 |
+
protected function getData()
|
54 |
+
{
|
55 |
+
if (empty($this->transactionId)) {
|
56 |
+
throw new Error\Required('TransactionId is niet geset');
|
57 |
+
}
|
58 |
+
$this->data['transactionId'] = $this->transactionId;
|
59 |
+
|
60 |
+
if (!empty($this->amount)) {
|
61 |
+
$this->data['amount'] = $this->amount;
|
62 |
+
}
|
63 |
+
|
64 |
+
return parent::getData();
|
65 |
+
}
|
66 |
+
|
67 |
+
/**
|
68 |
+
* @param string $transactionId
|
69 |
+
*/
|
70 |
+
public function setTransactionId($transactionId)
|
71 |
+
{
|
72 |
+
$this->transactionId = $transactionId;
|
73 |
+
}
|
74 |
+
|
75 |
+
/**
|
76 |
+
* @param int $amount
|
77 |
+
*/
|
78 |
+
public function setAmount($amount)
|
79 |
+
{
|
80 |
+
$this->amount = (int)$amount;
|
81 |
+
}
|
82 |
+
|
83 |
+
/**
|
84 |
+
* @param string $description
|
85 |
+
*/
|
86 |
+
public function setDescription($description)
|
87 |
+
{
|
88 |
+
$this->description = $description;
|
89 |
+
}
|
90 |
+
|
91 |
+
/**
|
92 |
+
* @param null $endpoint
|
93 |
+
* @param null $version
|
94 |
+
* @return array
|
95 |
+
*/
|
96 |
+
public function doRequest($endpoint = null, $version = null)
|
97 |
+
{
|
98 |
+
return parent::doRequest('transaction/refund');
|
99 |
+
}
|
100 |
+
}
|
app/code/community/Pay/Payment/vendor/paynl/sdk/src/Api/Transaction/Start.php
ADDED
@@ -0,0 +1,493 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Copyright (C) 2015 Andy Pieters <andy@pay.nl>
|
4 |
+
*
|
5 |
+
* This program is free software: you can redistribute it and/or modify
|
6 |
+
* it under the terms of the GNU General Public License as published by
|
7 |
+
* the Free Software Foundation, either version 3 of the License, or
|
8 |
+
* (at your option) any later version.
|
9 |
+
*
|
10 |
+
* This program is distributed in the hope that it will be useful,
|
11 |
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
+
* GNU General Public License for more details.
|
14 |
+
*
|
15 |
+
* You should have received a copy of the GNU General Public License
|
16 |
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
17 |
+
*/
|
18 |
+
|
19 |
+
namespace Paynl\Api\Transaction;
|
20 |
+
|
21 |
+
use Paynl\Config;
|
22 |
+
use Paynl\Error\Error as Error;
|
23 |
+
use Paynl\Error\Required as ErrorRequired;
|
24 |
+
use Paynl\Helper;
|
25 |
+
|
26 |
+
/**
|
27 |
+
* Api class to start a new transaction
|
28 |
+
*
|
29 |
+
* @author Andy Pieters <andy@pay.nl>
|
30 |
+
*/
|
31 |
+
class Start extends Transaction
|
32 |
+
{
|
33 |
+
protected $apiTokenRequired = true;
|
34 |
+
protected $serviceIdRequired = true;
|
35 |
+
|
36 |
+
/**
|
37 |
+
* @var int amount in cents
|
38 |
+
*/
|
39 |
+
private $_amount;
|
40 |
+
/**
|
41 |
+
* @var int the payment method id
|
42 |
+
*/
|
43 |
+
private $_paymentOptionId;
|
44 |
+
/**
|
45 |
+
* @var int the bank id
|
46 |
+
*/
|
47 |
+
private $_paymentOptionSubId;
|
48 |
+
/**
|
49 |
+
* @var string the finish url
|
50 |
+
*/
|
51 |
+
private $_finishUrl;
|
52 |
+
/**
|
53 |
+
* @var string the currency
|
54 |
+
*/
|
55 |
+
private $_currency;
|
56 |
+
/**
|
57 |
+
* @var string the exchagne url
|
58 |
+
*/
|
59 |
+
private $_exchangeUrl;
|
60 |
+
/**
|
61 |
+
* @var string the description
|
62 |
+
*/
|
63 |
+
private $_description;
|
64 |
+
/**
|
65 |
+
* @var array The enduser data
|
66 |
+
*/
|
67 |
+
private $_enduser;
|
68 |
+
/**
|
69 |
+
* @var string additional data extra1
|
70 |
+
*/
|
71 |
+
private $_extra1;
|
72 |
+
/**
|
73 |
+
* @var string additional data extra2
|
74 |
+
*/
|
75 |
+
private $_extra2;
|
76 |
+
/**
|
77 |
+
* @var string additional data extra3
|
78 |
+
*/
|
79 |
+
private $_extra3;
|
80 |
+
/**
|
81 |
+
* @var bool start transaction in testmode
|
82 |
+
*/
|
83 |
+
private $_testMode = false;
|
84 |
+
/**
|
85 |
+
* @var string additional data promotorId
|
86 |
+
*/
|
87 |
+
private $_promotorId;
|
88 |
+
/**
|
89 |
+
* @var string additional data info
|
90 |
+
*/
|
91 |
+
private $_info;
|
92 |
+
/**
|
93 |
+
* @var string additional data tool
|
94 |
+
*/
|
95 |
+
private $_tool;
|
96 |
+
/**
|
97 |
+
* @var string additional data info
|
98 |
+
*/
|
99 |
+
private $_object;
|
100 |
+
/**
|
101 |
+
* @var string additional data domainId
|
102 |
+
*/
|
103 |
+
private $_domainId;
|
104 |
+
/**
|
105 |
+
* @var string additional data transferData
|
106 |
+
*/
|
107 |
+
private $_transferData;
|
108 |
+
/**
|
109 |
+
* @var string
|
110 |
+
*/
|
111 |
+
private $_transferType;
|
112 |
+
/**
|
113 |
+
* @var string
|
114 |
+
*/
|
115 |
+
private $_transferValue;
|
116 |
+
/**
|
117 |
+
* @var string the ipaddress of the enduser, used for fraud detecion
|
118 |
+
*/
|
119 |
+
private $_ipaddress;
|
120 |
+
|
121 |
+
/**
|
122 |
+
* @var \DateTime
|
123 |
+
*/
|
124 |
+
private $_invoiceDate;
|
125 |
+
/**
|
126 |
+
* @var \DateTime
|
127 |
+
*/
|
128 |
+
private $_deliveryDate;
|
129 |
+
|
130 |
+
/**
|
131 |
+
* @var array the products for the order
|
132 |
+
*/
|
133 |
+
private $_products = array();
|
134 |
+
|
135 |
+
/**
|
136 |
+
* @var \DateTime
|
137 |
+
*/
|
138 |
+
private $_expireDate;
|
139 |
+
|
140 |
+
/**
|
141 |
+
* @param \DateTime $expireDate
|
142 |
+
*/
|
143 |
+
public function setExpireDate(\DateTime $expireDate)
|
144 |
+
{
|
145 |
+
$this->_expireDate = $expireDate;
|
146 |
+
}
|
147 |
+
|
148 |
+
|
149 |
+
/**
|
150 |
+
* @param \DateTime $invoiceDate
|
151 |
+
*/
|
152 |
+
public function setInvoiceDate(\DateTime $invoiceDate)
|
153 |
+
{
|
154 |
+
$this->_invoiceDate = $invoiceDate;
|
155 |
+
}
|
156 |
+
|
157 |
+
/**
|
158 |
+
* @param \DateTime $deliveryDate
|
159 |
+
*/
|
160 |
+
public function setDeliveryDate(\DateTime $deliveryDate)
|
161 |
+
{
|
162 |
+
$this->_deliveryDate = $deliveryDate;
|
163 |
+
}
|
164 |
+
|
165 |
+
public function setIpAddress($ipAddress)
|
166 |
+
{
|
167 |
+
$this->_ipaddress = $ipAddress;
|
168 |
+
}
|
169 |
+
|
170 |
+
public function setPromotorId($promotorId)
|
171 |
+
{
|
172 |
+
$this->_promotorId = $promotorId;
|
173 |
+
}
|
174 |
+
|
175 |
+
public function setCurrency($currency)
|
176 |
+
{
|
177 |
+
$this->_currency = $currency;
|
178 |
+
}
|
179 |
+
|
180 |
+
public function setInfo($info)
|
181 |
+
{
|
182 |
+
$this->_info = $info;
|
183 |
+
}
|
184 |
+
|
185 |
+
public function setTool($tool)
|
186 |
+
{
|
187 |
+
$this->_tool = $tool;
|
188 |
+
}
|
189 |
+
|
190 |
+
public function setObject($object)
|
191 |
+
{
|
192 |
+
$this->_object = $object;
|
193 |
+
}
|
194 |
+
|
195 |
+
public function setTransferData($transferData)
|
196 |
+
{
|
197 |
+
$this->_transferData = $transferData;
|
198 |
+
}
|
199 |
+
|
200 |
+
public function setTransferType($transferType)
|
201 |
+
{
|
202 |
+
$this->_transferType = $transferType;
|
203 |
+
}
|
204 |
+
|
205 |
+
public function setTransferValue($transferValue)
|
206 |
+
{
|
207 |
+
$this->_transferValue = $transferValue;
|
208 |
+
}
|
209 |
+
|
210 |
+
|
211 |
+
/**
|
212 |
+
* Add a product to an order
|
213 |
+
* Attention! This is purely an adminstrative option, the amount of the order is not modified.
|
214 |
+
*
|
215 |
+
* @param string $id
|
216 |
+
* @param string $description
|
217 |
+
* @param int $price
|
218 |
+
* @param int $quantity
|
219 |
+
* @param int $vatCode
|
220 |
+
* @throws Error
|
221 |
+
*/
|
222 |
+
public function addProduct($id, $description, $productType, $price, $quantity,
|
223 |
+
$vatCode, $vatPercentage)
|
224 |
+
{
|
225 |
+
if (!is_numeric($price)) {
|
226 |
+
throw new Error('Price must be numeric', 1);
|
227 |
+
}
|
228 |
+
if (!is_numeric($quantity)) {
|
229 |
+
throw new Error('Quantity must be numeric', 1);
|
230 |
+
}
|
231 |
+
|
232 |
+
$quantity = $quantity * 1;
|
233 |
+
|
234 |
+
//description mag maar 45 chars lang zijn
|
235 |
+
$description = substr($description, 0, 45);
|
236 |
+
|
237 |
+
$arrProduct = array(
|
238 |
+
'productId' => $id,
|
239 |
+
'productType' => $productType,
|
240 |
+
'description' => $description,
|
241 |
+
'price' => $price,
|
242 |
+
'quantity' => $quantity,
|
243 |
+
'vatCode' => $vatCode,
|
244 |
+
'vatPercentage' => $vatPercentage
|
245 |
+
);
|
246 |
+
$this->_products[] = $arrProduct;
|
247 |
+
}
|
248 |
+
|
249 |
+
/**
|
250 |
+
* Set the enduser data in the following format
|
251 |
+
*
|
252 |
+
* array(
|
253 |
+
* initials
|
254 |
+
* lastName
|
255 |
+
* language
|
256 |
+
* accessCode
|
257 |
+
* gender (M or F)
|
258 |
+
* dob (DD-MM-YYYY)
|
259 |
+
* phoneNumber
|
260 |
+
* emailAddress
|
261 |
+
* bankAccount
|
262 |
+
* iban
|
263 |
+
* bic
|
264 |
+
* sendConfirmMail
|
265 |
+
* confirmMailTemplate
|
266 |
+
* address => array(
|
267 |
+
* streetName
|
268 |
+
* streetNumber
|
269 |
+
* zipCode
|
270 |
+
* city
|
271 |
+
* countryCode
|
272 |
+
* )
|
273 |
+
* invoiceAddress => array(
|
274 |
+
* initials
|
275 |
+
* lastname
|
276 |
+
* streetName
|
277 |
+
* streetNumber
|
278 |
+
* zipCode
|
279 |
+
* city
|
280 |
+
* countryCode
|
281 |
+
* )
|
282 |
+
* )
|
283 |
+
* @param array $enduser
|
284 |
+
*/
|
285 |
+
public function setEnduser($enduser)
|
286 |
+
{
|
287 |
+
$this->_enduser = $enduser;
|
288 |
+
}
|
289 |
+
|
290 |
+
/**
|
291 |
+
* Set the amount(in cents) of the transaction
|
292 |
+
*
|
293 |
+
* @param int $amount
|
294 |
+
* @throws Error
|
295 |
+
*/
|
296 |
+
public function setAmount($amount)
|
297 |
+
{
|
298 |
+
if (is_numeric($amount)) {
|
299 |
+
$this->_amount = $amount;
|
300 |
+
} else {
|
301 |
+
throw new Error('Amount is niet numeriek', 1);
|
302 |
+
}
|
303 |
+
}
|
304 |
+
|
305 |
+
public function setPaymentOptionId($paymentOptionId)
|
306 |
+
{
|
307 |
+
if (is_numeric($paymentOptionId)) {
|
308 |
+
$this->_paymentOptionId = $paymentOptionId;
|
309 |
+
} else {
|
310 |
+
throw new Error('PaymentOptionId is niet numeriek', 1);
|
311 |
+
}
|
312 |
+
}
|
313 |
+
|
314 |
+
public function setPaymentOptionSubId($paymentOptionSubId)
|
315 |
+
{
|
316 |
+
if (is_numeric($paymentOptionSubId)) {
|
317 |
+
$this->_paymentOptionSubId = $paymentOptionSubId;
|
318 |
+
} else {
|
319 |
+
throw new Error('PaymentOptionSubId is niet numeriek', 1);
|
320 |
+
}
|
321 |
+
}
|
322 |
+
|
323 |
+
/**
|
324 |
+
* Set the url where the user will be redirected to after payment.
|
325 |
+
*
|
326 |
+
* @param string $finishUrl
|
327 |
+
*/
|
328 |
+
public function setFinishUrl($finishUrl)
|
329 |
+
{
|
330 |
+
$this->_finishUrl = $finishUrl;
|
331 |
+
}
|
332 |
+
|
333 |
+
/**
|
334 |
+
* Set the communication url, the pay.nl server will call this url when the status of the transaction changes
|
335 |
+
*
|
336 |
+
* @param string $exchangeUrl
|
337 |
+
*/
|
338 |
+
public function setExchangeUrl($exchangeUrl)
|
339 |
+
{
|
340 |
+
$this->_exchangeUrl = $exchangeUrl;
|
341 |
+
}
|
342 |
+
|
343 |
+
public function setTestMode($testmode)
|
344 |
+
{
|
345 |
+
$this->_testMode = (bool)$testmode;
|
346 |
+
}
|
347 |
+
|
348 |
+
public function setExtra1($extra1)
|
349 |
+
{
|
350 |
+
$this->_extra1 = $extra1;
|
351 |
+
}
|
352 |
+
|
353 |
+
public function setExtra2($extra2)
|
354 |
+
{
|
355 |
+
$this->_extra2 = $extra2;
|
356 |
+
}
|
357 |
+
|
358 |
+
public function setExtra3($extra3)
|
359 |
+
{
|
360 |
+
$this->_extra3 = $extra3;
|
361 |
+
}
|
362 |
+
|
363 |
+
public function setDomainId($domainId)
|
364 |
+
{
|
365 |
+
$this->_domainId = $domainId;
|
366 |
+
}
|
367 |
+
|
368 |
+
/**
|
369 |
+
* Set the description for the transaction
|
370 |
+
* @param string $description
|
371 |
+
*/
|
372 |
+
public function setDescription($description)
|
373 |
+
{
|
374 |
+
$this->_description = $description;
|
375 |
+
}
|
376 |
+
|
377 |
+
public function doRequest($endpoint = null, $version = null)
|
378 |
+
{
|
379 |
+
return parent::doRequest('transaction/start');
|
380 |
+
}
|
381 |
+
|
382 |
+
protected function getData()
|
383 |
+
{
|
384 |
+
// Checken of alle verplichte velden geset zijn
|
385 |
+
Helper::requireServiceId();
|
386 |
+
|
387 |
+
$data['serviceId'] = Config::getServiceId();
|
388 |
+
|
389 |
+
if ($this->_testMode === true) {
|
390 |
+
$data['testMode'] = '1';
|
391 |
+
} else {
|
392 |
+
$data['testMode'] = '0';
|
393 |
+
}
|
394 |
+
|
395 |
+
if (empty($this->_amount)) {
|
396 |
+
throw new ErrorRequired('Amount is niet geset', 1);
|
397 |
+
} else {
|
398 |
+
$data['amount'] = $this->_amount;
|
399 |
+
}
|
400 |
+
|
401 |
+
|
402 |
+
if (!empty($this->_paymentOptionId)) {
|
403 |
+
$data['paymentOptionId'] = $this->_paymentOptionId;
|
404 |
+
}
|
405 |
+
if (empty($this->_finishUrl)) {
|
406 |
+
throw new ErrorRequired('FinishUrl is niet geset', 1);
|
407 |
+
} else {
|
408 |
+
$data['finishUrl'] = $this->_finishUrl;
|
409 |
+
}
|
410 |
+
if (!empty($this->_exchangeUrl)) {
|
411 |
+
$data['transaction']['orderExchangeUrl'] = $this->_exchangeUrl;
|
412 |
+
}
|
413 |
+
|
414 |
+
if (!empty($this->_description)) {
|
415 |
+
$data['transaction']['description'] = $this->_description;
|
416 |
+
}
|
417 |
+
if (isset($this->_currency)) {
|
418 |
+
$data['transaction']['currency'] = $this->_currency;
|
419 |
+
}
|
420 |
+
|
421 |
+
if (isset($this->_expireDate)) {
|
422 |
+
$data['transaction']['expireDate'] = $this->_expireDate->format('d-m-Y H:i:s');
|
423 |
+
}
|
424 |
+
|
425 |
+
if (!empty($this->_paymentOptionSubId)) {
|
426 |
+
$data['paymentOptionSubId'] = $this->_paymentOptionSubId;
|
427 |
+
}
|
428 |
+
|
429 |
+
|
430 |
+
if (isset($this->_ipaddress)) {
|
431 |
+
$data['ipAddress'] = $this->_ipaddress;
|
432 |
+
} else {
|
433 |
+
$data['ipAddress'] = Helper::getIp();
|
434 |
+
}
|
435 |
+
|
436 |
+
if (!empty($this->_products)) {
|
437 |
+
$data['saleData']['orderData'] = $this->_products;
|
438 |
+
}
|
439 |
+
if (!empty($this->_deliveryDate)) {
|
440 |
+
$data['saleData']['deliveryDate'] = $this->_deliveryDate->format('d-m-Y');
|
441 |
+
}
|
442 |
+
if (!empty($this->_invoiceDate)) {
|
443 |
+
$data['saleData']['invoiceDate'] = $this->_invoiceDate->format('d-m-Y');
|
444 |
+
}
|
445 |
+
|
446 |
+
if (!empty($this->_enduser)) {
|
447 |
+
if (isset($this->_enduser['birthDate'])) {
|
448 |
+
$this->_enduser['dob'] = $this->_enduser['birthDate']->format('d-m-Y');
|
449 |
+
unset($this->_enduser['birthDate']);
|
450 |
+
}
|
451 |
+
$data['enduser'] = $this->_enduser;
|
452 |
+
}
|
453 |
+
|
454 |
+
if (!empty($this->_extra1)) {
|
455 |
+
$data['statsData']['extra1'] = $this->_extra1;
|
456 |
+
}
|
457 |
+
if (!empty($this->_extra2)) {
|
458 |
+
$data['statsData']['extra2'] = $this->_extra2;
|
459 |
+
}
|
460 |
+
if (!empty($this->_extra3)) {
|
461 |
+
$data['statsData']['extra3'] = $this->_extra3;
|
462 |
+
}
|
463 |
+
if (!empty($this->_promotorId)) {
|
464 |
+
$data['statsData']['promotorId'] = $this->_promotorId;
|
465 |
+
}
|
466 |
+
if (!empty($this->_info)) {
|
467 |
+
$data['statsData']['info'] = $this->_info;
|
468 |
+
}
|
469 |
+
if (!empty($this->_tool)) {
|
470 |
+
$data['statsData']['tool'] = $this->_tool;
|
471 |
+
}
|
472 |
+
if (!empty($this->_object)) {
|
473 |
+
$data['statsData']['object'] = $this->_object;
|
474 |
+
}
|
475 |
+
if (!empty($this->_domainId)) {
|
476 |
+
$data['statsData']['domain_id'] = $this->_domainId;
|
477 |
+
}
|
478 |
+
if (!empty($this->_transferData)) {
|
479 |
+
$data['statsData']['transferData'] = $this->_transferData;
|
480 |
+
}
|
481 |
+
|
482 |
+
if (!empty($this->_transferType)) {
|
483 |
+
$data['transferType'] = $this->_transferType;
|
484 |
+
}
|
485 |
+
if (!empty($this->_transferValue)) {
|
486 |
+
$data['transferValue'] = $this->_transferValue;
|
487 |
+
}
|
488 |
+
|
489 |
+
$this->data = array_merge($data, $this->data);
|
490 |
+
|
491 |
+
return parent::getData();
|
492 |
+
}
|
493 |
+
}
|
app/code/community/Pay/Payment/vendor/paynl/sdk/src/Api/Transaction/Transaction.php
ADDED
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Copyright (C) 2015 Andy Pieters <andy@pay.nl>
|
4 |
+
*
|
5 |
+
* This program is free software: you can redistribute it and/or modify
|
6 |
+
* it under the terms of the GNU General Public License as published by
|
7 |
+
* the Free Software Foundation, either version 3 of the License, or
|
8 |
+
* (at your option) any later version.
|
9 |
+
*
|
10 |
+
* This program is distributed in the hope that it will be useful,
|
11 |
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
+
* GNU General Public License for more details.
|
14 |
+
*
|
15 |
+
* You should have received a copy of the GNU General Public License
|
16 |
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
17 |
+
*/
|
18 |
+
|
19 |
+
namespace Paynl\Api\Transaction;
|
20 |
+
|
21 |
+
use Paynl\Api\Api;
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Description of Instore
|
25 |
+
*
|
26 |
+
* @author Andy Pieters <andy@pay.nl>
|
27 |
+
*/
|
28 |
+
class Transaction extends Api
|
29 |
+
{
|
30 |
+
/**
|
31 |
+
* @var int the version of the api
|
32 |
+
*/
|
33 |
+
protected $version = 6;
|
34 |
+
|
35 |
+
/**
|
36 |
+
* @param string $endpoint
|
37 |
+
* @param int|null $version
|
38 |
+
* @return array The result
|
39 |
+
*/
|
40 |
+
public function doRequest($endpoint, $version = null)
|
41 |
+
{
|
42 |
+
if (is_null($version)) {
|
43 |
+
$version = $this->version;
|
44 |
+
}
|
45 |
+
return parent::doRequest($endpoint, $version);
|
46 |
+
}
|
47 |
+
}
|
app/code/community/Pay/Payment/vendor/paynl/sdk/src/Api/Transaction/Void.php
ADDED
@@ -0,0 +1,70 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Copyright (C) 2015 Andy Pieters <andy@pay.nl>
|
4 |
+
*
|
5 |
+
* This program is free software: you can redistribute it and/or modify
|
6 |
+
* it under the terms of the GNU General Public License as published by
|
7 |
+
* the Free Software Foundation, either version 3 of the License, or
|
8 |
+
* (at your option) any later version.
|
9 |
+
*
|
10 |
+
* This program is distributed in the hope that it will be useful,
|
11 |
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
+
* GNU General Public License for more details.
|
14 |
+
*
|
15 |
+
* You should have received a copy of the GNU General Public License
|
16 |
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
17 |
+
*/
|
18 |
+
|
19 |
+
namespace Paynl\Api\Transaction;
|
20 |
+
|
21 |
+
use Paynl\Error;
|
22 |
+
/**
|
23 |
+
* Description of Approve
|
24 |
+
*
|
25 |
+
* @author Andy Pieters <andy@pay.nl>
|
26 |
+
*/
|
27 |
+
class Void extends Transaction
|
28 |
+
{
|
29 |
+
protected $apiTokenRequired = true;
|
30 |
+
protected $serviceIdRequired = false;
|
31 |
+
|
32 |
+
/**
|
33 |
+
* @var string
|
34 |
+
*/
|
35 |
+
private $transactionId;
|
36 |
+
|
37 |
+
/**
|
38 |
+
* Get data to send to the api
|
39 |
+
*
|
40 |
+
* @return array
|
41 |
+
* @throws Error\Required
|
42 |
+
*/
|
43 |
+
protected function getData() {
|
44 |
+
if(empty($this->transactionId)){
|
45 |
+
throw new Error\Required('TransactionId is niet geset');
|
46 |
+
}
|
47 |
+
$this->data['transactionId'] = $this->transactionId;
|
48 |
+
return parent::getData();
|
49 |
+
}
|
50 |
+
|
51 |
+
/**
|
52 |
+
* Set the transactionId
|
53 |
+
*
|
54 |
+
* @param string $transactionId
|
55 |
+
*/
|
56 |
+
public function setTransactionId($transactionId){
|
57 |
+
$this->transactionId = $transactionId;
|
58 |
+
}
|
59 |
+
|
60 |
+
/**
|
61 |
+
* Do the request
|
62 |
+
*
|
63 |
+
* @param null $endpoint
|
64 |
+
* @param null $version
|
65 |
+
* @return array the result
|
66 |
+
*/
|
67 |
+
public function doRequest($endpoint = null, $version = null) {
|
68 |
+
return parent::doRequest('transaction/voidAuthorization');
|
69 |
+
}
|
70 |
+
}
|
app/code/community/Pay/Payment/vendor/paynl/sdk/src/Api/Validate/IsPayServerIp.php
ADDED
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Created by PhpStorm.
|
4 |
+
* User: andy
|
5 |
+
* Date: 21-12-2015
|
6 |
+
* Time: 12:27
|
7 |
+
*/
|
8 |
+
|
9 |
+
namespace Paynl\Api\Validate;
|
10 |
+
|
11 |
+
use \Paynl\Error;
|
12 |
+
|
13 |
+
class IsPayServerIp extends Validate
|
14 |
+
{
|
15 |
+
protected $apiTokenRequired = false;
|
16 |
+
protected $serviceIdRequired = false;
|
17 |
+
|
18 |
+
protected function getData()
|
19 |
+
{
|
20 |
+
|
21 |
+
if (!isset($this->data['ipAddress'])) {
|
22 |
+
throw new Error\Required('ipAddress is required');
|
23 |
+
}
|
24 |
+
|
25 |
+
return $this->data;
|
26 |
+
}
|
27 |
+
|
28 |
+
public function setIpAddress($ipAddress)
|
29 |
+
{
|
30 |
+
$this->data['ipAddress'] = $ipAddress;
|
31 |
+
}
|
32 |
+
|
33 |
+
protected function processResult($result)
|
34 |
+
{
|
35 |
+
return (bool)$result->result;
|
36 |
+
}
|
37 |
+
|
38 |
+
public function doRequest($endpoint = null, $version = null)
|
39 |
+
{
|
40 |
+
return parent::doRequest('validate/isPayServerIp');
|
41 |
+
}
|
42 |
+
}
|
app/code/community/Pay/Payment/vendor/paynl/sdk/src/Api/Validate/Validate.php
ADDED
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Copyright (C) 2015 Andy Pieters <andy@pay.nl>
|
4 |
+
*
|
5 |
+
* This program is free software: you can redistribute it and/or modify
|
6 |
+
* it under the terms of the GNU General Public License as published by
|
7 |
+
* the Free Software Foundation, either version 3 of the License, or
|
8 |
+
* (at your option) any later version.
|
9 |
+
*
|
10 |
+
* This program is distributed in the hope that it will be useful,
|
11 |
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
+
* GNU General Public License for more details.
|
14 |
+
*
|
15 |
+
* You should have received a copy of the GNU General Public License
|
16 |
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
17 |
+
*/
|
18 |
+
|
19 |
+
namespace Paynl\Api\Validate;
|
20 |
+
|
21 |
+
use Paynl\Api\Api;
|
22 |
+
|
23 |
+
/**
|
24 |
+
* @author Andy Pieters <andy@pay.nl>
|
25 |
+
*/
|
26 |
+
class Validate extends Api
|
27 |
+
{
|
28 |
+
/**
|
29 |
+
* @var int the version of the api
|
30 |
+
*/
|
31 |
+
protected $version = 1;
|
32 |
+
|
33 |
+
/**
|
34 |
+
* @param string $endpoint
|
35 |
+
* @param int|null $version
|
36 |
+
* @return array The result
|
37 |
+
*/
|
38 |
+
public function doRequest($endpoint, $version = null)
|
39 |
+
{
|
40 |
+
if (is_null($version)) {
|
41 |
+
$version = $this->version;
|
42 |
+
}
|
43 |
+
return parent::doRequest($endpoint, $version);
|
44 |
+
}
|
45 |
+
}
|
app/code/community/Pay/Payment/vendor/paynl/sdk/src/Api/Voucher/Activate.php
ADDED
@@ -0,0 +1,104 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Paynl\Api\Voucher;
|
4 |
+
|
5 |
+
use Paynl\Error\Error;
|
6 |
+
use Paynl\Error\Required as ErrorRequired;
|
7 |
+
|
8 |
+
class Activate extends Voucher
|
9 |
+
{
|
10 |
+
|
11 |
+
protected $apiTokenRequired = true;
|
12 |
+
protected $serviceIdRequired = true;
|
13 |
+
|
14 |
+
/**
|
15 |
+
* @var string The voucher card number
|
16 |
+
*/
|
17 |
+
private $_cardNumber;
|
18 |
+
/**
|
19 |
+
* @var string The voucher pin code
|
20 |
+
*/
|
21 |
+
private $_pincode;
|
22 |
+
/**
|
23 |
+
* @var string The voucher amount
|
24 |
+
*/
|
25 |
+
private $_amount;
|
26 |
+
/**
|
27 |
+
* @var string The PosId that activates the voucher ( reference id )
|
28 |
+
*/
|
29 |
+
private $_posId;
|
30 |
+
|
31 |
+
/**
|
32 |
+
* @param mixed $posId
|
33 |
+
*/
|
34 |
+
public function setPosId($posId)
|
35 |
+
{
|
36 |
+
$this->_posId = $posId;
|
37 |
+
}
|
38 |
+
|
39 |
+
/**
|
40 |
+
* @param string $cardNumber
|
41 |
+
*/
|
42 |
+
public function setCardNumber($cardNumber)
|
43 |
+
{
|
44 |
+
$this->_cardNumber = $cardNumber;
|
45 |
+
}
|
46 |
+
|
47 |
+
/**
|
48 |
+
* @param string $pincode
|
49 |
+
*/
|
50 |
+
public function setPincode($pincode)
|
51 |
+
{
|
52 |
+
$this->_pincode = $pincode;
|
53 |
+
}
|
54 |
+
|
55 |
+
/**
|
56 |
+
* Set the amount(in cents) of the transaction
|
57 |
+
*
|
58 |
+
* @param int $amount
|
59 |
+
*
|
60 |
+
* @throws Error
|
61 |
+
*/
|
62 |
+
public function setAmount($amount)
|
63 |
+
{
|
64 |
+
if(is_numeric($amount)){
|
65 |
+
$this->_amount = $amount;
|
66 |
+
}else{
|
67 |
+
throw new Error('Amount is niet numeriek', 1);
|
68 |
+
}
|
69 |
+
}
|
70 |
+
|
71 |
+
protected function getData()
|
72 |
+
{
|
73 |
+
if(!empty($this->_pincode)){
|
74 |
+
$data['pincode'] = $this->_pincode;
|
75 |
+
}
|
76 |
+
if(empty($this->_cardNumber)){
|
77 |
+
throw new ErrorRequired('cardNumber is niet geset', 1);
|
78 |
+
}else{
|
79 |
+
$data['cardNumber'] = $this->_cardNumber;
|
80 |
+
}
|
81 |
+
|
82 |
+
if(empty($this->_amount)){
|
83 |
+
throw new ErrorRequired('Amount is niet geset', 1);
|
84 |
+
}else{
|
85 |
+
$data['amount'] = $this->_amount;
|
86 |
+
}
|
87 |
+
|
88 |
+
if(empty($this->_posId)){
|
89 |
+
throw new ErrorRequired('posId is niet geset', 1);
|
90 |
+
}else{
|
91 |
+
$data['posId'] = $this->_posId;
|
92 |
+
}
|
93 |
+
|
94 |
+
|
95 |
+
$this->data = array_merge($data, $this->data);
|
96 |
+
|
97 |
+
return parent::getData();
|
98 |
+
}
|
99 |
+
|
100 |
+
public function doRequest($endpoint = null, $version = null)
|
101 |
+
{
|
102 |
+
return parent::doRequest('voucher/activate');
|
103 |
+
}
|
104 |
+
}
|
app/code/community/Pay/Payment/vendor/paynl/sdk/src/Api/Voucher/Balance.php
ADDED
@@ -0,0 +1,58 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Paynl\Api\Voucher;
|
4 |
+
|
5 |
+
use Paynl\Error\Required as ErrorRequired;
|
6 |
+
|
7 |
+
class Balance extends Voucher
|
8 |
+
{
|
9 |
+
|
10 |
+
protected $apiTokenRequired = true;
|
11 |
+
protected $serviceIdRequired = false;
|
12 |
+
|
13 |
+
/**
|
14 |
+
* @var string The voucher card number
|
15 |
+
*/
|
16 |
+
private $_cardNumber;
|
17 |
+
/**
|
18 |
+
* @var string The voucher pin doe (if required)
|
19 |
+
*/
|
20 |
+
private $_pincode;
|
21 |
+
|
22 |
+
/**
|
23 |
+
* @param string $cardNumber
|
24 |
+
*/
|
25 |
+
public function setCardNumber($cardNumber)
|
26 |
+
{
|
27 |
+
$this->_cardNumber = $cardNumber;
|
28 |
+
}
|
29 |
+
|
30 |
+
/**
|
31 |
+
* @param string $pincode
|
32 |
+
*/
|
33 |
+
public function setPincode($pincode)
|
34 |
+
{
|
35 |
+
$this->_pincode = $pincode;
|
36 |
+
}
|
37 |
+
|
38 |
+
protected function getData()
|
39 |
+
{
|
40 |
+
if(!empty($this->_pincode)){
|
41 |
+
$data['pincode'] = $this->_pincode;
|
42 |
+
}
|
43 |
+
if(empty($this->_cardNumber)){
|
44 |
+
throw new ErrorRequired('cardNumber is niet geset', 1);
|
45 |
+
}else{
|
46 |
+
$data['cardNumber'] = $this->_cardNumber;
|
47 |
+
}
|
48 |
+
|
49 |
+
$this->data = array_merge($data, $this->data);
|
50 |
+
|
51 |
+
return parent::getData();
|
52 |
+
}
|
53 |
+
|
54 |
+
public function doRequest($endpoint = null, $version = null)
|
55 |
+
{
|
56 |
+
return parent::doRequest('voucher/balance');
|
57 |
+
}
|
58 |
+
}
|
app/code/community/Pay/Payment/vendor/paynl/sdk/src/Api/Voucher/Charge.php
ADDED
@@ -0,0 +1,86 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Paynl\Api\Voucher;
|
4 |
+
|
5 |
+
use Paynl\Error\Error;
|
6 |
+
use Paynl\Error\Required as ErrorRequired;
|
7 |
+
|
8 |
+
class Charge extends Voucher
|
9 |
+
{
|
10 |
+
|
11 |
+
protected $apiTokenRequired = true;
|
12 |
+
protected $serviceIdRequired = false;
|
13 |
+
|
14 |
+
/**
|
15 |
+
* @var string The voucher card number
|
16 |
+
*/
|
17 |
+
private $_cardNumber;
|
18 |
+
/**
|
19 |
+
* @var string The voucher pin doe (if required)
|
20 |
+
*/
|
21 |
+
private $_pincode;
|
22 |
+
/**
|
23 |
+
* @var string The voucher pin doe (if required)
|
24 |
+
*/
|
25 |
+
private $_amount;
|
26 |
+
|
27 |
+
/**
|
28 |
+
* @param string $cardNumber
|
29 |
+
*/
|
30 |
+
public function setCardNumber($cardNumber)
|
31 |
+
{
|
32 |
+
$this->_cardNumber = $cardNumber;
|
33 |
+
}
|
34 |
+
|
35 |
+
/**
|
36 |
+
* @param string $pincode
|
37 |
+
*/
|
38 |
+
public function setPincode($pincode)
|
39 |
+
{
|
40 |
+
$this->_pincode = $pincode;
|
41 |
+
}
|
42 |
+
|
43 |
+
/**
|
44 |
+
* Set the amount(in cents) of the transaction
|
45 |
+
*
|
46 |
+
* @param int $amount
|
47 |
+
*
|
48 |
+
* @throws Error
|
49 |
+
*/
|
50 |
+
public function setAmount($amount)
|
51 |
+
{
|
52 |
+
if (is_numeric($amount)) {
|
53 |
+
$this->_amount = $amount;
|
54 |
+
} else {
|
55 |
+
throw new Error('Amount is niet numeriek', 1);
|
56 |
+
}
|
57 |
+
}
|
58 |
+
|
59 |
+
protected function getData()
|
60 |
+
{
|
61 |
+
if (empty($this->_cardNumber)) {
|
62 |
+
throw new ErrorRequired('cardNumber is niet geset', 1);
|
63 |
+
} else {
|
64 |
+
$data['cardNumber'] = $this->_cardNumber;
|
65 |
+
}
|
66 |
+
|
67 |
+
if (!empty($this->_pincode)) {
|
68 |
+
$data['pincode'] = $this->_pincode;
|
69 |
+
}
|
70 |
+
|
71 |
+
if (empty($this->_amount)) {
|
72 |
+
throw new ErrorRequired('Amount is niet geset', 1);
|
73 |
+
} else {
|
74 |
+
$data['amount'] = $this->_amount;
|
75 |
+
}
|
76 |
+
|
77 |
+
$this->data = array_merge($data, $this->data);
|
78 |
+
|
79 |
+
return parent::getData();
|
80 |
+
}
|
81 |
+
|
82 |
+
public function doRequest($endpoint = null, $version = null)
|
83 |
+
{
|
84 |
+
return parent::doRequest('voucher/charge');
|
85 |
+
}
|
86 |
+
}
|
app/code/community/Pay/Payment/vendor/paynl/sdk/src/Api/Voucher/Voucher.php
ADDED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Paynl\Api\Voucher;
|
4 |
+
|
5 |
+
use Paynl\Api\Api;
|
6 |
+
|
7 |
+
class Voucher extends Api
|
8 |
+
{
|
9 |
+
|
10 |
+
/**
|
11 |
+
* @var int the version of the api
|
12 |
+
*/
|
13 |
+
protected $version = 1;
|
14 |
+
|
15 |
+
/**
|
16 |
+
* @param string $endpoint
|
17 |
+
* @param int|null $version
|
18 |
+
*
|
19 |
+
* @return array The result
|
20 |
+
*/
|
21 |
+
public function doRequest($endpoint, $version = null)
|
22 |
+
{
|
23 |
+
if (is_null($version)) {
|
24 |
+
$version = $this->version;
|
25 |
+
}
|
26 |
+
|
27 |
+
return parent::doRequest($endpoint, $version);
|
28 |
+
}
|
29 |
+
}
|
app/code/community/Pay/Payment/vendor/paynl/sdk/src/Config.php
ADDED
@@ -0,0 +1,183 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Copyright (C) 2015 Andy Pieters <andy@pay.nl>
|
4 |
+
*
|
5 |
+
* This program is free software: you can redistribute it and/or modify
|
6 |
+
* it under the terms of the GNU General Public License as published by
|
7 |
+
* the Free Software Foundation, either version 3 of the License, or
|
8 |
+
* (at your option) any later version.
|
9 |
+
*
|
10 |
+
* This program is distributed in the hope that it will be useful,
|
11 |
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
+
* GNU General Public License for more details.
|
14 |
+
*
|
15 |
+
* You should have received a copy of the GNU General Public License
|
16 |
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
17 |
+
*/
|
18 |
+
|
19 |
+
|
20 |
+
namespace Paynl;
|
21 |
+
|
22 |
+
use Curl\Curl;
|
23 |
+
|
24 |
+
/**
|
25 |
+
* Description of Pay
|
26 |
+
*
|
27 |
+
* @author Andy Pieters <andy@andypieters.nl>
|
28 |
+
*/
|
29 |
+
class Config
|
30 |
+
{
|
31 |
+
|
32 |
+
// @var string The Pay.nl API token to be used for requests.
|
33 |
+
private static $apiToken;
|
34 |
+
// @var string The service id (SL-xxxx-xxxx)
|
35 |
+
private static $serviceId;
|
36 |
+
// @var string The base URL for the Pay.nl API.
|
37 |
+
private static $apiBase = 'https://rest-api.pay.nl';
|
38 |
+
// @var int The version of the Pay.nl API to use for requests.
|
39 |
+
private static $apiVersion = 5;
|
40 |
+
|
41 |
+
private static $curl;
|
42 |
+
|
43 |
+
/**
|
44 |
+
* @var string path tho CAInfo location
|
45 |
+
*/
|
46 |
+
private static $CAInfoLocation = null;
|
47 |
+
|
48 |
+
/**
|
49 |
+
* @var bool Disable this if you have certificate errors that you don't know how to fix
|
50 |
+
*/
|
51 |
+
private static $verifyPeer = true;
|
52 |
+
|
53 |
+
/**
|
54 |
+
* @return bool
|
55 |
+
*/
|
56 |
+
public static function getVerifyPeer()
|
57 |
+
{
|
58 |
+
return self::$verifyPeer;
|
59 |
+
}
|
60 |
+
|
61 |
+
/**
|
62 |
+
* @param bool $verifyPeer
|
63 |
+
*/
|
64 |
+
public static function setVerifyPeer($verifyPeer)
|
65 |
+
{
|
66 |
+
self::$verifyPeer = (boolean)$verifyPeer;
|
67 |
+
}
|
68 |
+
|
69 |
+
|
70 |
+
/**
|
71 |
+
* @param string $apiBase
|
72 |
+
*/
|
73 |
+
public static function setApiBase($apiBase)
|
74 |
+
{
|
75 |
+
self::$apiBase = $apiBase;
|
76 |
+
}
|
77 |
+
|
78 |
+
/**
|
79 |
+
* @return string
|
80 |
+
*/
|
81 |
+
public static function getCAInfoLocation()
|
82 |
+
{
|
83 |
+
return self::$CAInfoLocation;
|
84 |
+
}
|
85 |
+
|
86 |
+
/**
|
87 |
+
* @param string $CAInfoLocation
|
88 |
+
*/
|
89 |
+
public static function setCAInfoLocation($CAInfoLocation)
|
90 |
+
{
|
91 |
+
self::$CAInfoLocation = $CAInfoLocation;
|
92 |
+
}
|
93 |
+
|
94 |
+
/**
|
95 |
+
* @return string The API token used for requests.
|
96 |
+
*/
|
97 |
+
public static function getApiToken()
|
98 |
+
{
|
99 |
+
return self::$apiToken;
|
100 |
+
}
|
101 |
+
|
102 |
+
/**
|
103 |
+
* Sets the API token to be used for requests.
|
104 |
+
*
|
105 |
+
* @param string $apiToken
|
106 |
+
*/
|
107 |
+
public static function setApiToken($apiToken)
|
108 |
+
{
|
109 |
+
self::$apiToken = $apiToken;
|
110 |
+
}
|
111 |
+
|
112 |
+
/**
|
113 |
+
* @return string The service id used for requests.
|
114 |
+
*/
|
115 |
+
public static function getServiceId()
|
116 |
+
{
|
117 |
+
return self::$serviceId;
|
118 |
+
}
|
119 |
+
|
120 |
+
/**
|
121 |
+
* Sets the service id to be used for requests.
|
122 |
+
*
|
123 |
+
* @param string $serviceId
|
124 |
+
*/
|
125 |
+
public static function setServiceId($serviceId)
|
126 |
+
{
|
127 |
+
self::$serviceId = $serviceId;
|
128 |
+
}
|
129 |
+
|
130 |
+
/**
|
131 |
+
* @return string The API version used for requests.
|
132 |
+
*/
|
133 |
+
public static function getApiVersion()
|
134 |
+
{
|
135 |
+
return self::$apiVersion;
|
136 |
+
}
|
137 |
+
|
138 |
+
/**
|
139 |
+
* @param string $apiVersion The API version to use for requests.
|
140 |
+
*/
|
141 |
+
public static function setApiVersion($apiVersion)
|
142 |
+
{
|
143 |
+
self::$apiVersion = $apiVersion;
|
144 |
+
}
|
145 |
+
|
146 |
+
/**
|
147 |
+
* @param string $endpoint The endpoint of the API, for example Transaction/Start
|
148 |
+
* @param string|null $version
|
149 |
+
*
|
150 |
+
* @return string The url to the api
|
151 |
+
*/
|
152 |
+
public static function getApiUrl($endpoint, $version = null)
|
153 |
+
{
|
154 |
+
if (is_null($version)) {
|
155 |
+
$version = self::$apiVersion;
|
156 |
+
}
|
157 |
+
return self::$apiBase . '/v' . $version . '/' . $endpoint . '/json';
|
158 |
+
}
|
159 |
+
|
160 |
+
/**
|
161 |
+
* @return object
|
162 |
+
*/
|
163 |
+
public static function getCurl()
|
164 |
+
{
|
165 |
+
if (null === self::$curl) {
|
166 |
+
self::$curl = new Curl();
|
167 |
+
}
|
168 |
+
|
169 |
+
return self::$curl;
|
170 |
+
}
|
171 |
+
|
172 |
+
/**
|
173 |
+
* @param mixed $curl
|
174 |
+
*/
|
175 |
+
public static function setCurl($curl)
|
176 |
+
{
|
177 |
+
if (is_string($curl)) {
|
178 |
+
$curl = new $curl;
|
179 |
+
}
|
180 |
+
|
181 |
+
self::$curl = $curl;
|
182 |
+
}
|
183 |
+
}
|
app/code/community/Pay/Payment/vendor/paynl/sdk/src/Curl/Dummy.php
ADDED
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
namespace Paynl\Curl;
|
3 |
+
|
4 |
+
class Dummy
|
5 |
+
{
|
6 |
+
private $_result;
|
7 |
+
|
8 |
+
public $error;
|
9 |
+
|
10 |
+
public function setResult($result){
|
11 |
+
$this->_result = $result;
|
12 |
+
}
|
13 |
+
|
14 |
+
//dummy function to prevent errors
|
15 |
+
public function __call($name, $arguments)
|
16 |
+
{
|
17 |
+
if(in_array($name, array(
|
18 |
+
'delete',
|
19 |
+
'get',
|
20 |
+
'patch',
|
21 |
+
'post',
|
22 |
+
'put',
|
23 |
+
))){
|
24 |
+
return json_decode($this->_result);
|
25 |
+
}
|
26 |
+
return true;
|
27 |
+
}
|
28 |
+
}
|
app/code/community/Pay/Payment/vendor/paynl/sdk/src/Currency.php
ADDED
@@ -0,0 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Created by PhpStorm.
|
4 |
+
* User: andy
|
5 |
+
* Date: 6-7-16
|
6 |
+
* Time: 17:59
|
7 |
+
*/
|
8 |
+
|
9 |
+
namespace Paynl;
|
10 |
+
|
11 |
+
|
12 |
+
use Paynl\Api\Currency as Api;
|
13 |
+
use Paynl\Error\NotFound;
|
14 |
+
|
15 |
+
class Currency
|
16 |
+
{
|
17 |
+
private static $_allCurrencies;
|
18 |
+
|
19 |
+
/**
|
20 |
+
* @return array All supported currencies
|
21 |
+
*/
|
22 |
+
public static function getAll(){
|
23 |
+
if(empty(self::$_allCurrencies)){
|
24 |
+
$api = new Api\GetAll();
|
25 |
+
|
26 |
+
self::$_allCurrencies = $api->doRequest();
|
27 |
+
}
|
28 |
+
|
29 |
+
return self::$_allCurrencies;
|
30 |
+
}
|
31 |
+
|
32 |
+
/**
|
33 |
+
* Get the currencyId for a currency
|
34 |
+
*
|
35 |
+
* @param $isoCode
|
36 |
+
* @return int
|
37 |
+
* @throws NotFound
|
38 |
+
*/
|
39 |
+
public static function getCurrencyId($isoCode){
|
40 |
+
$allCurrencies = self::getAll();
|
41 |
+
|
42 |
+
foreach($allCurrencies as $currency){
|
43 |
+
if(strtoupper($currency['abbreviation']) == strtoupper($isoCode)){
|
44 |
+
return $currency['id'];
|
45 |
+
}
|
46 |
+
}
|
47 |
+
throw new NotFound('Currency', $isoCode);
|
48 |
+
}
|
49 |
+
}
|
app/code/community/Pay/Payment/vendor/paynl/sdk/src/DirectDebit.php
ADDED
@@ -0,0 +1,181 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Created by PhpStorm.
|
4 |
+
* User: andy
|
5 |
+
* Date: 6-7-16
|
6 |
+
* Time: 16:39
|
7 |
+
*/
|
8 |
+
|
9 |
+
namespace Paynl;
|
10 |
+
|
11 |
+
|
12 |
+
use Paynl\Api\DirectDebit as Api;
|
13 |
+
use Paynl\Error\Required;
|
14 |
+
use Paynl\Result\DirectDebit as Result;
|
15 |
+
|
16 |
+
class DirectDebit
|
17 |
+
{
|
18 |
+
/**
|
19 |
+
* Add a Single DirectDebit Transaction (non recurring)
|
20 |
+
*
|
21 |
+
* @param array $options
|
22 |
+
* @throws Required When a required field is not set
|
23 |
+
*/
|
24 |
+
public static function add($options = array())
|
25 |
+
{
|
26 |
+
$api = new Api\DebitAdd();
|
27 |
+
|
28 |
+
if (empty($options['amount'])) {
|
29 |
+
throw new Required('amount');
|
30 |
+
} else {
|
31 |
+
$api->setAmount(round($options['amount'] * 100));
|
32 |
+
}
|
33 |
+
if (empty($options['bankaccountHolder'])) {
|
34 |
+
throw new Required('bankaccountHolder');
|
35 |
+
} else {
|
36 |
+
$api->setBankaccountHolder($options['bankaccountHolder']);
|
37 |
+
}
|
38 |
+
if (empty($options['bankaccountNumber'])) {
|
39 |
+
throw new Required('bankaccountNumber');
|
40 |
+
} else {
|
41 |
+
$api->setBankaccountNumber($options['bankaccountNumber']);
|
42 |
+
}
|
43 |
+
if (!empty($options['bankaccountBic'])) {
|
44 |
+
$api->setBankaccountBic($options['bankaccountBic']);
|
45 |
+
}
|
46 |
+
if (!empty($options['processDate'])) {
|
47 |
+
if (is_string($options['processDate'])) {
|
48 |
+
$options['processDate'] = new \DateTime($options['processDate']);
|
49 |
+
}
|
50 |
+
$api->setProcessDate($options['processDate']);
|
51 |
+
}
|
52 |
+
if (!empty($options['description'])) {
|
53 |
+
$api->setDescription($options['description']);
|
54 |
+
}
|
55 |
+
if (!empty($options['ipAddress'])) {
|
56 |
+
$api->setIpAddress($options['ipAddress']);
|
57 |
+
}
|
58 |
+
if (!empty($options['email'])) {
|
59 |
+
$api->setEmail($options['email']);
|
60 |
+
}
|
61 |
+
if (!empty($options['promotorId'])) {
|
62 |
+
$api->setPromotorId($options['promotorId']);
|
63 |
+
}
|
64 |
+
if (!empty($options['tool'])) {
|
65 |
+
$api->setTool($options['tool']);
|
66 |
+
}
|
67 |
+
if (!empty($options['info'])) {
|
68 |
+
$api->setInfo($options['info']);
|
69 |
+
}
|
70 |
+
if (!empty($options['object'])) {
|
71 |
+
$api->setObject($options['object']);
|
72 |
+
}
|
73 |
+
if (!empty($options['extra1'])) {
|
74 |
+
$api->setExtra1($options['extra1']);
|
75 |
+
}
|
76 |
+
if (!empty($options['extra2'])) {
|
77 |
+
$api->setExtra2($options['extra2']);
|
78 |
+
}
|
79 |
+
if (!empty($options['extra3'])) {
|
80 |
+
$api->setExtra3($options['extra3']);
|
81 |
+
}
|
82 |
+
if (!empty($options['currency'])) {
|
83 |
+
$api->setCurrency($options['currency']);
|
84 |
+
}
|
85 |
+
if (!empty($options['exchangeUrl'])) {
|
86 |
+
$api->setExchangeUrl($options['exchangeUrl']);
|
87 |
+
}
|
88 |
+
|
89 |
+
$result = $api->doRequest();
|
90 |
+
|
91 |
+
return new Result\Add($result);
|
92 |
+
}
|
93 |
+
|
94 |
+
public static function get($mandateId)
|
95 |
+
{
|
96 |
+
$api = new Api\DebitGet();
|
97 |
+
$api->setMandateId($mandateId);
|
98 |
+
|
99 |
+
$result = $api->doRequest();
|
100 |
+
return new Result\Get($result);
|
101 |
+
}
|
102 |
+
|
103 |
+
public function delete($mandateId)
|
104 |
+
{
|
105 |
+
$api = new Api\Delete();
|
106 |
+
$api->setMandateId($mandateId);
|
107 |
+
|
108 |
+
$result = $api->doRequest();
|
109 |
+
return $result;
|
110 |
+
}
|
111 |
+
|
112 |
+
public function update($mandateId, $options)
|
113 |
+
{
|
114 |
+
if (empty($mandateId)) {
|
115 |
+
throw new Required('mandateId');
|
116 |
+
}
|
117 |
+
$api = new Api\Update();
|
118 |
+
$api->setMandateId($mandateId);
|
119 |
+
|
120 |
+
if (!empty($options['amount'])) {
|
121 |
+
$api->setAmount(round($options['amount'] * 100));
|
122 |
+
}
|
123 |
+
if (!empty($options['bankaccountHolder'])) {
|
124 |
+
$api->setBankaccountHolder($options['bankaccountHolder']);
|
125 |
+
}
|
126 |
+
if (!empty($options['bankaccountNumber'])) {
|
127 |
+
$api->setBankaccountNumber($options['bankaccountNumber']);
|
128 |
+
}
|
129 |
+
if (!empty($options['bankaccountBic'])) {
|
130 |
+
$api->setBankaccountBic($options['bankaccountBic']);
|
131 |
+
}
|
132 |
+
if (!empty($options['processDate'])) {
|
133 |
+
$processDate = $options['processDate'];
|
134 |
+
if (!($processDate instanceof \DateTime)) {
|
135 |
+
$processDate = new \DateTime($processDate);
|
136 |
+
}
|
137 |
+
$api->setProcessDate($processDate);
|
138 |
+
}
|
139 |
+
if (!empty($options['intervalValue'])) {
|
140 |
+
$api->setIntervalValue($options['intervalValue']);
|
141 |
+
}
|
142 |
+
if (!empty($options['intervalPeriod'])) {
|
143 |
+
$api->setIntervalPeriod($options['intervalPeriod']);
|
144 |
+
}
|
145 |
+
if (!empty($options['intervalQuantity'])) {
|
146 |
+
$api->setIntervalQuantity($options['intervalQuantity']);
|
147 |
+
}
|
148 |
+
if (!empty($options['description'])) {
|
149 |
+
$api->setDescription($options['description']);
|
150 |
+
}
|
151 |
+
if (!empty($options['ipAddress'])) {
|
152 |
+
$api->setIpAddress($options['ipAddress']);
|
153 |
+
}
|
154 |
+
if (!empty($options['email'])) {
|
155 |
+
$api->setEmail($options['email']);
|
156 |
+
}
|
157 |
+
if (!empty($options['promotorId'])) {
|
158 |
+
$api->setPromotorId($options['promotorId']);
|
159 |
+
}
|
160 |
+
if (!empty($options['tool'])) {
|
161 |
+
$api->setTool($options['tool']);
|
162 |
+
}
|
163 |
+
if (!empty($options['info'])) {
|
164 |
+
$api->setInfo($options['info']);
|
165 |
+
}
|
166 |
+
if (!empty($options['object'])) {
|
167 |
+
$api->setObject($options['object']);
|
168 |
+
}
|
169 |
+
if (!empty($options['extra1'])) {
|
170 |
+
$api->setExtra1($options['extra1']);
|
171 |
+
}
|
172 |
+
if (!empty($options['extra2'])) {
|
173 |
+
$api->setExtra2($options['extra2']);
|
174 |
+
}
|
175 |
+
if (!empty($options['extra3'])) {
|
176 |
+
$api->setExtra3($options['extra3']);
|
177 |
+
}
|
178 |
+
$result = $api->doRequest();
|
179 |
+
return $result;
|
180 |
+
}
|
181 |
+
}
|
app/code/community/Pay/Payment/vendor/paynl/sdk/src/DirectDebit/Mandate.php
ADDED
@@ -0,0 +1,121 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Created by PhpStorm.
|
4 |
+
* User: andy
|
5 |
+
* Date: 7-7-16
|
6 |
+
* Time: 11:37
|
7 |
+
*/
|
8 |
+
|
9 |
+
namespace Paynl\DirectDebit;
|
10 |
+
|
11 |
+
use Paynl\Api\DirectDebit as Api;
|
12 |
+
use Paynl\Error\Required;
|
13 |
+
use Paynl\Result\DirectDebit\Mandate as Result;
|
14 |
+
|
15 |
+
class Mandate
|
16 |
+
{
|
17 |
+
public static function add($options){
|
18 |
+
$api = new Api\MandateAdd();
|
19 |
+
|
20 |
+
if (empty($options['amount'])) {
|
21 |
+
throw new Required('amount');
|
22 |
+
} else {
|
23 |
+
$api->setAmount(round($options['amount'] * 100));
|
24 |
+
}
|
25 |
+
if (empty($options['bankaccountHolder'])) {
|
26 |
+
throw new Required('bankaccountHolder');
|
27 |
+
} else {
|
28 |
+
$api->setBankaccountHolder($options['bankaccountHolder']);
|
29 |
+
}
|
30 |
+
if (empty($options['bankaccountNumber'])) {
|
31 |
+
throw new Required('bankaccountNumber');
|
32 |
+
} else {
|
33 |
+
$api->setBankaccountNumber($options['bankaccountNumber']);
|
34 |
+
}
|
35 |
+
if (!empty($options['bankaccountBic'])) {
|
36 |
+
$api->setBankaccountBic($options['bankaccountBic']);
|
37 |
+
}
|
38 |
+
if (!empty($options['processDate'])) {
|
39 |
+
if(is_string($options['processDate'])){
|
40 |
+
$options['processDate'] = new \DateTime($options['processDate']);
|
41 |
+
}
|
42 |
+
$api->setProcessDate($options['processDate']);
|
43 |
+
}
|
44 |
+
if (!empty($options['description'])) {
|
45 |
+
$api->setDescription($options['description']);
|
46 |
+
}
|
47 |
+
if (!empty($options['ipAddress'])) {
|
48 |
+
$api->setIpAddress($options['ipAddress']);
|
49 |
+
}
|
50 |
+
if (!empty($options['email'])) {
|
51 |
+
$api->setEmail($options['email']);
|
52 |
+
}
|
53 |
+
if (!empty($options['promotorId'])) {
|
54 |
+
$api->setPromotorId($options['promotorId']);
|
55 |
+
}
|
56 |
+
if (!empty($options['tool'])) {
|
57 |
+
$api->setTool($options['tool']);
|
58 |
+
}
|
59 |
+
if (!empty($options['info'])) {
|
60 |
+
$api->setInfo($options['info']);
|
61 |
+
}
|
62 |
+
if (!empty($options['object'])) {
|
63 |
+
$api->setObject($options['object']);
|
64 |
+
}
|
65 |
+
if (!empty($options['extra1'])) {
|
66 |
+
$api->setExtra1($options['extra1']);
|
67 |
+
}
|
68 |
+
if (!empty($options['extra2'])) {
|
69 |
+
$api->setExtra2($options['extra2']);
|
70 |
+
}
|
71 |
+
if (!empty($options['extra3'])) {
|
72 |
+
$api->setExtra3($options['extra3']);
|
73 |
+
}
|
74 |
+
if(!empty($options['currency'])){
|
75 |
+
$api->setCurrency($options['currency']);
|
76 |
+
}
|
77 |
+
if (!empty($options['exchangeUrl'])) {
|
78 |
+
$api->setExchangeUrl($options['exchangeUrl']);
|
79 |
+
}
|
80 |
+
if(!empty($options['intervalQuantity'])){
|
81 |
+
$api->setIntervalQuantity((int)$options['intervalQuantity']);
|
82 |
+
}
|
83 |
+
|
84 |
+
$result = $api->doRequest();
|
85 |
+
return new Result\Add($result);
|
86 |
+
}
|
87 |
+
|
88 |
+
public static function addTransaction($options){
|
89 |
+
$api = new Api\MandateDebit();
|
90 |
+
|
91 |
+
if(empty($options['mandateId'])){
|
92 |
+
throw new Required('mandateId');
|
93 |
+
} else {
|
94 |
+
$api->setMandateId($options['mandateId']);
|
95 |
+
}
|
96 |
+
|
97 |
+
if(!empty($options['amount'])){
|
98 |
+
$api->setAmount($options['amount']);
|
99 |
+
}
|
100 |
+
if (!empty($options['description'])) {
|
101 |
+
$api->setDescription($options['description']);
|
102 |
+
}
|
103 |
+
if (!empty($options['processDate'])) {
|
104 |
+
if(is_string($options['processDate'])){
|
105 |
+
$options['processDate'] = new \DateTime($options['processDate']);
|
106 |
+
}
|
107 |
+
$api->setProcessDate($options['processDate']);
|
108 |
+
}
|
109 |
+
$result = $api->doRequest();
|
110 |
+
return new Result\AddTransaction($result);
|
111 |
+
|
112 |
+
}
|
113 |
+
|
114 |
+
public static function get($mandateId){
|
115 |
+
$api = new Api\MandateGet();
|
116 |
+
$api->setMandateId($mandateId);
|
117 |
+
|
118 |
+
$result = $api->doRequest();
|
119 |
+
return new Result\Get($result);
|
120 |
+
}
|
121 |
+
}
|
app/code/community/Pay/Payment/vendor/paynl/sdk/src/DirectDebit/Recurring.php
ADDED
@@ -0,0 +1,110 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Created by PhpStorm.
|
4 |
+
* User: andy
|
5 |
+
* Date: 7-7-16
|
6 |
+
* Time: 12:02
|
7 |
+
*/
|
8 |
+
|
9 |
+
namespace Paynl\DirectDebit;
|
10 |
+
|
11 |
+
use Paynl\Api\DirectDebit as Api;
|
12 |
+
use Paynl\Error\Required;
|
13 |
+
use Paynl\Result\DirectDebit\Recurring as Result;
|
14 |
+
|
15 |
+
class Recurring
|
16 |
+
{
|
17 |
+
const INTERVAL_DAY = 6;
|
18 |
+
const INTERVAL_WEEK = 1;
|
19 |
+
const INTERVAL_MONTH = 2;
|
20 |
+
const INTERVAL_QUARTER = 3;
|
21 |
+
const INTERVAL_HALF_YEAR = 4;
|
22 |
+
const INTERVAL_YEAR = 5;
|
23 |
+
|
24 |
+
public static function add($options)
|
25 |
+
{
|
26 |
+
$api = new Api\RecurringAdd();
|
27 |
+
|
28 |
+
if (empty($options['amount'])) {
|
29 |
+
throw new Required('amount');
|
30 |
+
} else {
|
31 |
+
$api->setAmount(round($options['amount'] * 100));
|
32 |
+
}
|
33 |
+
if (empty($options['bankaccountHolder'])) {
|
34 |
+
throw new Required('bankaccountHolder');
|
35 |
+
} else {
|
36 |
+
$api->setBankaccountHolder($options['bankaccountHolder']);
|
37 |
+
}
|
38 |
+
if (empty($options['bankaccountNumber'])) {
|
39 |
+
throw new Required('bankaccountNumber');
|
40 |
+
} else {
|
41 |
+
$api->setBankaccountNumber($options['bankaccountNumber']);
|
42 |
+
}
|
43 |
+
if (!empty($options['bankaccountBic'])) {
|
44 |
+
$api->setBankaccountBic($options['bankaccountBic']);
|
45 |
+
}
|
46 |
+
if (!empty($options['processDate'])) {
|
47 |
+
if(is_string($options['processDate'])){
|
48 |
+
$options['processDate'] = new \DateTime($options['processDate']);
|
49 |
+
}
|
50 |
+
$api->setProcessDate($options['processDate']);
|
51 |
+
}
|
52 |
+
if (!empty($options['description'])) {
|
53 |
+
$api->setDescription($options['description']);
|
54 |
+
}
|
55 |
+
if (!empty($options['ipAddress'])) {
|
56 |
+
$api->setIpAddress($options['ipAddress']);
|
57 |
+
}
|
58 |
+
if (!empty($options['email'])) {
|
59 |
+
$api->setEmail($options['email']);
|
60 |
+
}
|
61 |
+
if (!empty($options['promotorId'])) {
|
62 |
+
$api->setPromotorId($options['promotorId']);
|
63 |
+
}
|
64 |
+
if (!empty($options['tool'])) {
|
65 |
+
$api->setTool($options['tool']);
|
66 |
+
}
|
67 |
+
if (!empty($options['info'])) {
|
68 |
+
$api->setInfo($options['info']);
|
69 |
+
}
|
70 |
+
if (!empty($options['object'])) {
|
71 |
+
$api->setObject($options['object']);
|
72 |
+
}
|
73 |
+
if (!empty($options['extra1'])) {
|
74 |
+
$api->setExtra1($options['extra1']);
|
75 |
+
}
|
76 |
+
if (!empty($options['extra2'])) {
|
77 |
+
$api->setExtra2($options['extra2']);
|
78 |
+
}
|
79 |
+
if (!empty($options['extra3'])) {
|
80 |
+
$api->setExtra3($options['extra3']);
|
81 |
+
}
|
82 |
+
if (!empty($options['currency'])) {
|
83 |
+
$api->setCurrency($options['currency']);
|
84 |
+
}
|
85 |
+
if (!empty($options['exchangeUrl'])) {
|
86 |
+
$api->setExchangeUrl($options['exchangeUrl']);
|
87 |
+
}
|
88 |
+
if (!empty($options['intervalQuantity'])) {
|
89 |
+
$api->setIntervalQuantity((int)$options['intervalQuantity']);
|
90 |
+
}
|
91 |
+
if (!empty($options['intervalValue'])) {
|
92 |
+
$api->setIntervalValue((int)$options['intervalValue']);
|
93 |
+
}
|
94 |
+
if (!empty($options['intervalPeriod'])) {
|
95 |
+
$api->setIntervalPeriod((int)$options['intervalPeriod']);
|
96 |
+
}
|
97 |
+
|
98 |
+
$result = $api->doRequest();
|
99 |
+
return new Result\Add($result);
|
100 |
+
}
|
101 |
+
|
102 |
+
public static function get($mandateId){
|
103 |
+
$api = new Api\RecurringGet();
|
104 |
+
$api->setMandateId($mandateId);
|
105 |
+
|
106 |
+
$result = $api->doRequest();
|
107 |
+
return new Result\Get($result);
|
108 |
+
}
|
109 |
+
|
110 |
+
}
|
app/code/community/Pay/Payment/vendor/paynl/sdk/src/Error/Api.php
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Copyright (C) 2015 Andy Pieters <andy@pay.nl>
|
4 |
+
*
|
5 |
+
* This program is free software: you can redistribute it and/or modify
|
6 |
+
* it under the terms of the GNU General Public License as published by
|
7 |
+
* the Free Software Foundation, either version 3 of the License, or
|
8 |
+
* (at your option) any later version.
|
9 |
+
*
|
10 |
+
* This program is distributed in the hope that it will be useful,
|
11 |
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
+
* GNU General Public License for more details.
|
14 |
+
*
|
15 |
+
* You should have received a copy of the GNU General Public License
|
16 |
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
17 |
+
*/
|
18 |
+
|
19 |
+
|
20 |
+
namespace Paynl\Error;
|
21 |
+
|
22 |
+
/**
|
23 |
+
* Api error
|
24 |
+
*
|
25 |
+
* @author Andy Pieters <andy@pay.nl>
|
26 |
+
*/
|
27 |
+
class Api extends Error
|
28 |
+
{
|
29 |
+
//put your code here
|
30 |
+
}
|
app/code/community/Pay/Payment/vendor/paynl/sdk/src/Error/Error.php
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Copyright (C) 2015 Andy Pieters <andy@pay.nl>
|
4 |
+
*
|
5 |
+
* This program is free software: you can redistribute it and/or modify
|
6 |
+
* it under the terms of the GNU General Public License as published by
|
7 |
+
* the Free Software Foundation, either version 3 of the License, or
|
8 |
+
* (at your option) any later version.
|
9 |
+
*
|
10 |
+
* This program is distributed in the hope that it will be useful,
|
11 |
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
+
* GNU General Public License for more details.
|
14 |
+
*
|
15 |
+
* You should have received a copy of the GNU General Public License
|
16 |
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
17 |
+
*/
|
18 |
+
|
19 |
+
|
20 |
+
namespace Paynl\Error;
|
21 |
+
|
22 |
+
/**
|
23 |
+
* Description of Error
|
24 |
+
*
|
25 |
+
* @author Andy Pieters <andy@andypieters.nl>
|
26 |
+
*/
|
27 |
+
class Error extends \Exception
|
28 |
+
{
|
29 |
+
//put your code here
|
30 |
+
}
|
app/code/community/Pay/Payment/vendor/paynl/sdk/src/Error/NotFound.php
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Created by PhpStorm.
|
4 |
+
* User: andy
|
5 |
+
* Date: 6-7-16
|
6 |
+
* Time: 18:06
|
7 |
+
*/
|
8 |
+
|
9 |
+
namespace Paynl\Error;
|
10 |
+
|
11 |
+
|
12 |
+
class NotFound extends Error
|
13 |
+
{
|
14 |
+
|
15 |
+
public function __construct($objectName, $identifier, Exception $previous = null)
|
16 |
+
{
|
17 |
+
$message = "$objectName: '$identifier' Not found";
|
18 |
+
parent::__construct($message, 404, $previous);
|
19 |
+
}
|
20 |
+
|
21 |
+
}
|
app/code/community/Pay/Payment/vendor/paynl/sdk/src/Error/Required.php
ADDED
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Copyright (C) 2015 Andy Pieters <andy@pay.nl>
|
4 |
+
*
|
5 |
+
* This program is free software: you can redistribute it and/or modify
|
6 |
+
* it under the terms of the GNU General Public License as published by
|
7 |
+
* the Free Software Foundation, either version 3 of the License, or
|
8 |
+
* (at your option) any later version.
|
9 |
+
*
|
10 |
+
* This program is distributed in the hope that it will be useful,
|
11 |
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
+
* GNU General Public License for more details.
|
14 |
+
*
|
15 |
+
* You should have received a copy of the GNU General Public License
|
16 |
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
17 |
+
*/
|
18 |
+
|
19 |
+
|
20 |
+
namespace Paynl\Error;
|
21 |
+
|
22 |
+
/**
|
23 |
+
* Description of Error
|
24 |
+
*
|
25 |
+
* @author Andy Pieters <andy@andypieters.nl>
|
26 |
+
*/
|
27 |
+
class Required extends \Exception
|
28 |
+
{
|
29 |
+
/***
|
30 |
+
* @param string $message
|
31 |
+
* @param null $code
|
32 |
+
* @param \Exception|null $previous
|
33 |
+
*/
|
34 |
+
public function __construct($message, $code = null, \Exception $previous = null)
|
35 |
+
{
|
36 |
+
$message = "'$message' is required";
|
37 |
+
parent::__construct($message, $code, $previous);
|
38 |
+
}
|
39 |
+
}
|
app/code/community/Pay/Payment/vendor/paynl/sdk/src/Error/Required/ApiToken.php
ADDED
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Copyright (C) 2015 Andy Pieters <andy@pay.nl>
|
4 |
+
*
|
5 |
+
* This program is free software: you can redistribute it and/or modify
|
6 |
+
* it under the terms of the GNU General Public License as published by
|
7 |
+
* the Free Software Foundation, either version 3 of the License, or
|
8 |
+
* (at your option) any later version.
|
9 |
+
*
|
10 |
+
* This program is distributed in the hope that it will be useful,
|
11 |
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
+
* GNU General Public License for more details.
|
14 |
+
*
|
15 |
+
* You should have received a copy of the GNU General Public License
|
16 |
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
17 |
+
*/
|
18 |
+
|
19 |
+
|
20 |
+
namespace Paynl\Error\Required;
|
21 |
+
|
22 |
+
use \Paynl\Error\Required;
|
23 |
+
|
24 |
+
/**
|
25 |
+
* thrown when Apitoken is missing
|
26 |
+
*
|
27 |
+
* @author Andy Pieters <andy@andypieters.nl>
|
28 |
+
*/
|
29 |
+
class ApiToken extends Required
|
30 |
+
{
|
31 |
+
public function __construct($message = null, $code = null, $previous = null)
|
32 |
+
{
|
33 |
+
parent::__construct('No APItoken is set, use \\Paynl\\Config::setApiToken() to set the API token');
|
34 |
+
}
|
35 |
+
|
36 |
+
}
|
app/code/community/Pay/Payment/vendor/paynl/sdk/src/Error/Required/ServiceId.php
ADDED
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Copyright (C) 2015 Andy Pieters <andy@pay.nl>
|
4 |
+
*
|
5 |
+
* This program is free software: you can redistribute it and/or modify
|
6 |
+
* it under the terms of the GNU General Public License as published by
|
7 |
+
* the Free Software Foundation, either version 3 of the License, or
|
8 |
+
* (at your option) any later version.
|
9 |
+
*
|
10 |
+
* This program is distributed in the hope that it will be useful,
|
11 |
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
+
* GNU General Public License for more details.
|
14 |
+
*
|
15 |
+
* You should have received a copy of the GNU General Public License
|
16 |
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
17 |
+
*/
|
18 |
+
|
19 |
+
|
20 |
+
namespace Paynl\Error\Required;
|
21 |
+
|
22 |
+
use \Paynl\Error\Required;
|
23 |
+
|
24 |
+
/**
|
25 |
+
* Thrown when serviceId is missing
|
26 |
+
*
|
27 |
+
* @author Andy Pieters <andy@andypieters.nl>
|
28 |
+
*/
|
29 |
+
class ServiceId extends Required
|
30 |
+
{
|
31 |
+
public function __construct($message = null, $code = null, $previous = null)
|
32 |
+
{
|
33 |
+
parent::__construct('No Service id is set, use \\Paynl\\Config::setServiceId() to set the Service id');
|
34 |
+
}
|
35 |
+
|
36 |
+
}
|
app/code/community/Pay/Payment/vendor/paynl/sdk/src/Helper.php
ADDED
@@ -0,0 +1,213 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Copyright (C) 2015 Andy Pieters <andy@pay.nl>
|
4 |
+
*
|
5 |
+
* This program is free software: you can redistribute it and/or modify
|
6 |
+
* it under the terms of the GNU General Public License as published by
|
7 |
+
* the Free Software Foundation, either version 3 of the License, or
|
8 |
+
* (at your option) any later version.
|
9 |
+
*
|
10 |
+
* This program is distributed in the hope that it will be useful,
|
11 |
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
+
* GNU General Public License for more details.
|
14 |
+
*
|
15 |
+
* You should have received a copy of the GNU General Public License
|
16 |
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
17 |
+
*/
|
18 |
+
|
19 |
+
namespace Paynl;
|
20 |
+
|
21 |
+
|
22 |
+
use Paynl\Error;
|
23 |
+
|
24 |
+
/**
|
25 |
+
* Description of Helper
|
26 |
+
*
|
27 |
+
* @author Andy Pieters <andy@pay.nl>
|
28 |
+
*/
|
29 |
+
class Helper
|
30 |
+
{
|
31 |
+
|
32 |
+
/**
|
33 |
+
* Checks if the apiToken is set
|
34 |
+
*
|
35 |
+
* @throws Error\Required\ApiToken
|
36 |
+
*/
|
37 |
+
public static function requireApiToken()
|
38 |
+
{
|
39 |
+
$apiToken = Config::getApiToken();
|
40 |
+
if (empty($apiToken)) {
|
41 |
+
throw new Error\Required\ApiToken();
|
42 |
+
}
|
43 |
+
}
|
44 |
+
|
45 |
+
/**
|
46 |
+
* Checks if the serviceId is set
|
47 |
+
*
|
48 |
+
* @throws Error\Required\ServiceId
|
49 |
+
*/
|
50 |
+
public static function requireServiceId()
|
51 |
+
{
|
52 |
+
$serviceId = Config::getServiceId();
|
53 |
+
if (empty($serviceId)) {
|
54 |
+
throw new Error\Required\ServiceId();
|
55 |
+
}
|
56 |
+
}
|
57 |
+
|
58 |
+
/**
|
59 |
+
* Get the ip of the user
|
60 |
+
*
|
61 |
+
* @return string
|
62 |
+
*/
|
63 |
+
public static function getIp()
|
64 |
+
{
|
65 |
+
//Just get the headers if we can or else use the SERVER global
|
66 |
+
if (function_exists('apache_request_headers')) {
|
67 |
+
$headers = apache_request_headers();
|
68 |
+
} else {
|
69 |
+
$headers = $_SERVER;
|
70 |
+
}
|
71 |
+
//Get the forwarded IP if it exists
|
72 |
+
if (array_key_exists('X-Forwarded-For', $headers)) {
|
73 |
+
$the_ip = $headers['X-Forwarded-For'];
|
74 |
+
} elseif (array_key_exists('HTTP_X_FORWARDED_FOR', $headers)) {
|
75 |
+
$the_ip = $headers['HTTP_X_FORWARDED_FOR'];
|
76 |
+
} else {
|
77 |
+
$the_ip = $_SERVER['REMOTE_ADDR'];
|
78 |
+
}
|
79 |
+
$arrIp = explode(',', $the_ip);
|
80 |
+
$the_ip = $arrIp[0];
|
81 |
+
|
82 |
+
$the_ip = filter_var(trim($the_ip), FILTER_VALIDATE_IP);
|
83 |
+
|
84 |
+
return $the_ip;
|
85 |
+
}
|
86 |
+
|
87 |
+
/**
|
88 |
+
* Redirect the user to a url
|
89 |
+
*
|
90 |
+
* @param $url
|
91 |
+
*/
|
92 |
+
public static function redirect($url)
|
93 |
+
{
|
94 |
+
header('location: ' . $url);
|
95 |
+
}
|
96 |
+
|
97 |
+
/**
|
98 |
+
* Get the nearest number
|
99 |
+
*
|
100 |
+
* @param int $number
|
101 |
+
* @param array $numbers
|
102 |
+
* @return int|bool nearest number false on error
|
103 |
+
*/
|
104 |
+
private static function nearest($number, $numbers)
|
105 |
+
{
|
106 |
+
$output = FALSE;
|
107 |
+
$number = intval($number);
|
108 |
+
if (is_array($numbers) && count($numbers) >= 1) {
|
109 |
+
$NDat = array();
|
110 |
+
foreach ($numbers as $n) {
|
111 |
+
$NDat[abs($number - $n)] = $n;
|
112 |
+
}
|
113 |
+
ksort($NDat);
|
114 |
+
$NDat = array_values($NDat);
|
115 |
+
$output = $NDat[0];
|
116 |
+
}
|
117 |
+
return $output;
|
118 |
+
}
|
119 |
+
|
120 |
+
/**
|
121 |
+
* Convert a stdClass object to an array
|
122 |
+
*
|
123 |
+
* @param \stdClass $d
|
124 |
+
* @return array
|
125 |
+
*/
|
126 |
+
public static function objectToArray($d)
|
127 |
+
{
|
128 |
+
if (is_object($d)) {
|
129 |
+
$d = get_object_vars($d);
|
130 |
+
}
|
131 |
+
if (is_array($d)) {
|
132 |
+
return array_map(array(__CLASS__, __FUNCTION__), $d); // recursive
|
133 |
+
} else {
|
134 |
+
return $d;
|
135 |
+
}
|
136 |
+
}
|
137 |
+
|
138 |
+
public static function calculateTaxPercentage($amountInclTax, $taxAmount){
|
139 |
+
// return 0 if amount or tax is 0
|
140 |
+
if ($taxAmount == 0 || $amountInclTax == 0) {
|
141 |
+
return 0;
|
142 |
+
}
|
143 |
+
$amountExclTax = $amountInclTax - $taxAmount;
|
144 |
+
$taxRate = ($taxAmount / $amountExclTax) * 100;
|
145 |
+
|
146 |
+
return $taxRate;
|
147 |
+
}
|
148 |
+
/**
|
149 |
+
* Determine the tax class to send to Pay.nl
|
150 |
+
*
|
151 |
+
* @param int|float $amountInclTax
|
152 |
+
* @param int|float $taxAmount
|
153 |
+
* @return string The tax class (N, L or H)
|
154 |
+
*/
|
155 |
+
public static function calculateTaxClass($amountInclTax, $taxAmount)
|
156 |
+
{
|
157 |
+
$taxClasses = array(
|
158 |
+
0 => 'N',
|
159 |
+
6 => 'L',
|
160 |
+
21 => 'H'
|
161 |
+
);
|
162 |
+
|
163 |
+
$taxRate = self::calculateTaxPercentage($amountInclTax, $taxAmount);
|
164 |
+
|
165 |
+
$nearestTaxRate = self::nearest($taxRate, array_keys($taxClasses));
|
166 |
+
return ($taxClasses[$nearestTaxRate]);
|
167 |
+
}
|
168 |
+
|
169 |
+
/**
|
170 |
+
* Try to split an address into street and housenumber
|
171 |
+
* This is not guaranteed to always return a correct answer
|
172 |
+
*
|
173 |
+
* @param string $strAddress
|
174 |
+
* @return array
|
175 |
+
*/
|
176 |
+
public static function splitAddress($strAddress)
|
177 |
+
{
|
178 |
+
$strAddress = trim($strAddress);
|
179 |
+
|
180 |
+
$a = preg_split('/(\\s+)([0-9]+)/', $strAddress, 2,
|
181 |
+
PREG_SPLIT_DELIM_CAPTURE);
|
182 |
+
$strStreetName = trim(array_shift($a));
|
183 |
+
$strStreetNumber = trim(implode('', $a));
|
184 |
+
|
185 |
+
if (empty($strStreetName) || empty($strStreetNumber)) { // American address notation
|
186 |
+
$a = preg_split('/([a-zA-Z]{2,})/', $strAddress, 2,
|
187 |
+
PREG_SPLIT_DELIM_CAPTURE);
|
188 |
+
|
189 |
+
$strStreetNumber = trim(array_shift($a));
|
190 |
+
$strStreetName = implode('', $a);
|
191 |
+
}
|
192 |
+
|
193 |
+
return array($strStreetName, $strStreetNumber);
|
194 |
+
}
|
195 |
+
|
196 |
+
/**
|
197 |
+
* Get the url where this script is running.
|
198 |
+
* This is used in samples to determine the exchange and return urls
|
199 |
+
*
|
200 |
+
* @return string
|
201 |
+
*/
|
202 |
+
public static function getBaseUrl()
|
203 |
+
{
|
204 |
+
$protocol = isset($_SERVER["HTTPS"]) ? 'https' : 'http';
|
205 |
+
$url = $protocol . '://' . $_SERVER['SERVER_NAME'] .':'.$_SERVER['SERVER_PORT']. $_SERVER['REQUEST_URI'];
|
206 |
+
|
207 |
+
|
208 |
+
// op de laatste / afknippen (index.php willen we niet zien)
|
209 |
+
$baseUrl = substr($url, 0, strrpos($url, '/'));
|
210 |
+
|
211 |
+
return $baseUrl;
|
212 |
+
}
|
213 |
+
}
|
app/code/community/Pay/Payment/vendor/paynl/sdk/src/Instore.php
ADDED
@@ -0,0 +1,147 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Copyright (C) 2015 Andy Pieters <andy@pay.nl>
|
4 |
+
*
|
5 |
+
* This program is free software: you can redistribute it and/or modify
|
6 |
+
* it under the terms of the GNU General Public License as published by
|
7 |
+
* the Free Software Foundation, either version 3 of the License, or
|
8 |
+
* (at your option) any later version.
|
9 |
+
*
|
10 |
+
* This program is distributed in the hope that it will be useful,
|
11 |
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
+
* GNU General Public License for more details.
|
14 |
+
*
|
15 |
+
* You should have received a copy of the GNU General Public License
|
16 |
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
17 |
+
*/
|
18 |
+
|
19 |
+
namespace Paynl;
|
20 |
+
|
21 |
+
use Paynl\Api\Instore as Api;
|
22 |
+
use Paynl\Result\Instore as Result;
|
23 |
+
|
24 |
+
/**
|
25 |
+
* Description of Transaction
|
26 |
+
*
|
27 |
+
* @author Andy Pieters <andy@andypieters.nl>
|
28 |
+
*/
|
29 |
+
class Instore
|
30 |
+
{
|
31 |
+
/**
|
32 |
+
* Get the status for an instore payment
|
33 |
+
*
|
34 |
+
* @param array $options
|
35 |
+
* @return Result\Status
|
36 |
+
*/
|
37 |
+
public static function status($options)
|
38 |
+
{
|
39 |
+
$api = new Api\Status();
|
40 |
+
|
41 |
+
if (isset($options['hash'])) {
|
42 |
+
$api->setHash($options['hash']);
|
43 |
+
}
|
44 |
+
|
45 |
+
$result = $api->doRequest();
|
46 |
+
|
47 |
+
return new Result\Status($result);
|
48 |
+
}
|
49 |
+
|
50 |
+
/**
|
51 |
+
* Get all terminals linked to the service
|
52 |
+
*
|
53 |
+
* @return Result\Terminals
|
54 |
+
*/
|
55 |
+
public static function getAllTerminals()
|
56 |
+
{
|
57 |
+
$api = new Api\GetAllTerminals();
|
58 |
+
|
59 |
+
$result = $api->doRequest();
|
60 |
+
|
61 |
+
return new Result\Terminals($result);
|
62 |
+
}
|
63 |
+
|
64 |
+
/**
|
65 |
+
* Send the payment to a terminal
|
66 |
+
*
|
67 |
+
* Options:
|
68 |
+
* ['transactionId'] The transactionId (result from Transaction::Start())
|
69 |
+
* ['terminalId'] The id of the terminal, to get a list of terminals use \Paynl\Instore::getAllTerminals()
|
70 |
+
* @param array $options (see above)
|
71 |
+
*
|
72 |
+
* @return Result\Payment
|
73 |
+
*/
|
74 |
+
public static function payment($options)
|
75 |
+
{
|
76 |
+
$api = new Api\Payment();
|
77 |
+
|
78 |
+
if (isset($options['transactionId'])) {
|
79 |
+
$api->setTransactionId($options['transactionId']);
|
80 |
+
}
|
81 |
+
if (isset($options['terminalId'])) {
|
82 |
+
$api->setTerminalId($options['terminalId']);
|
83 |
+
}
|
84 |
+
|
85 |
+
$result = $api->doRequest();
|
86 |
+
return new Result\Payment($result);
|
87 |
+
}
|
88 |
+
|
89 |
+
/**
|
90 |
+
* Confirm the payment
|
91 |
+
*
|
92 |
+
* When email address is set, the customer will receive a receipt of the transaction.
|
93 |
+
* The language can be set to define the language of the email
|
94 |
+
*
|
95 |
+
* Options:
|
96 |
+
* ['hash'] string the hash of the transaction
|
97 |
+
* ['emailAddress'] string the email address to send the receipt to
|
98 |
+
* ['languageId'] int the languageId
|
99 |
+
* 1. Dutch
|
100 |
+
* 2. Flemish
|
101 |
+
* 4. English
|
102 |
+
* 5. German
|
103 |
+
* 6. French
|
104 |
+
* 8. Spanish
|
105 |
+
* 9. Italian
|
106 |
+
*
|
107 |
+
* @param array $options (See above)
|
108 |
+
* @return Result\ConfirmPayment
|
109 |
+
*/
|
110 |
+
public static function confirmPayment($options)
|
111 |
+
{
|
112 |
+
$api = new Api\ConfirmPayment();
|
113 |
+
|
114 |
+
if (isset($options['hash'])) {
|
115 |
+
$api->setHash($options['hash']);
|
116 |
+
}
|
117 |
+
if (isset($options['emailAddress'])) {
|
118 |
+
$api->setEmailAddress($options['emailAddress']);
|
119 |
+
}
|
120 |
+
if (isset($options['languageId'])) {
|
121 |
+
$api->setLanguageId($options['languageId']);
|
122 |
+
}
|
123 |
+
|
124 |
+
$result = $api->doRequest();
|
125 |
+
return new Result\ConfirmPayment($result);
|
126 |
+
}
|
127 |
+
|
128 |
+
/**
|
129 |
+
* Get the receipt data of an instore payment
|
130 |
+
* ONLY AVAILABLE FOR 30 MINUTES AFTER COMPLETING THE TRANSACTION!
|
131 |
+
*
|
132 |
+
* Options:
|
133 |
+
* ['hash'] The hash of the instore payment transaction
|
134 |
+
*
|
135 |
+
* @param array $options (see above)
|
136 |
+
* @return Result\Receipt
|
137 |
+
*/
|
138 |
+
public static function getReceipt($options){
|
139 |
+
$api = new Api\GetTransactionTicket();
|
140 |
+
if (isset($options['hash'])) {
|
141 |
+
$api->setHash($options['hash']);
|
142 |
+
}
|
143 |
+
|
144 |
+
$result = $api->doRequest();
|
145 |
+
return new Result\Receipt($result);
|
146 |
+
}
|
147 |
+
}
|
app/code/community/Pay/Payment/vendor/paynl/sdk/src/Paymentmethods.php
ADDED
@@ -0,0 +1,126 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Copyright (C) 2015 Andy Pieters <andy@andypieters.nl>
|
4 |
+
*
|
5 |
+
* This program is free software: you can redistribute it and/or modify
|
6 |
+
* it under the terms of the GNU General Public License as published by
|
7 |
+
* the Free Software Foundation, either version 3 of the License, or
|
8 |
+
* (at your option) any later version.
|
9 |
+
*
|
10 |
+
* This program is distributed in the hope that it will be useful,
|
11 |
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
+
* GNU General Public License for more details.
|
14 |
+
*
|
15 |
+
* You should have received a copy of the GNU General Public License
|
16 |
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
17 |
+
*/
|
18 |
+
|
19 |
+
namespace Paynl;
|
20 |
+
|
21 |
+
use Paynl\Api\Transaction as Api;
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Description of Paymentmethods
|
25 |
+
*
|
26 |
+
* @author Andy Pieters <andy@andypieters.nl>
|
27 |
+
*/
|
28 |
+
class Paymentmethods
|
29 |
+
{
|
30 |
+
|
31 |
+
/**
|
32 |
+
* Reorder the result from the Transaction/getService API into a more logical format
|
33 |
+
*
|
34 |
+
* @param array $input The result from the getService API
|
35 |
+
* @return array
|
36 |
+
*/
|
37 |
+
private static function reorderOutput($input)
|
38 |
+
{
|
39 |
+
$paymentMethods = array();
|
40 |
+
|
41 |
+
foreach ($input['countryOptionList'] as $country) {
|
42 |
+
foreach ($country['paymentOptionList'] as $paymentOption) {
|
43 |
+
if (isset($paymentMethods[$paymentOption['id']])) {
|
44 |
+
$paymentMethods[$paymentOption['id']]['countries'][] = $country['id'];
|
45 |
+
} else {
|
46 |
+
$banks = array();
|
47 |
+
if (!empty($paymentOption['paymentOptionSubList'])) {
|
48 |
+
foreach ($paymentOption['paymentOptionSubList'] as $optionSub) {
|
49 |
+
$bank = array();
|
50 |
+
$bank['id'] = $optionSub['id'];
|
51 |
+
$bank['name'] = $optionSub['name'];
|
52 |
+
$bank['visibleName'] = $optionSub['visibleName'];
|
53 |
+
$banks[] = $bank;
|
54 |
+
}
|
55 |
+
}
|
56 |
+
|
57 |
+
$paymentMethod = array(
|
58 |
+
'id' => $paymentOption['id'],
|
59 |
+
'name' => $paymentOption['name'],
|
60 |
+
'visibleName' => $paymentOption['visibleName'],
|
61 |
+
'countries' => array($country['id']),
|
62 |
+
'banks' => $banks,
|
63 |
+
);
|
64 |
+
$paymentMethods[$paymentOption['id']] = $paymentMethod;
|
65 |
+
}
|
66 |
+
}
|
67 |
+
}
|
68 |
+
|
69 |
+
return $paymentMethods;
|
70 |
+
}
|
71 |
+
|
72 |
+
/**
|
73 |
+
* Filter the result to only return payment methods allowed for a country
|
74 |
+
*
|
75 |
+
* @param array $paymentMethods
|
76 |
+
* @param string $country
|
77 |
+
* @return array filtered paymentmethods
|
78 |
+
*/
|
79 |
+
private static function filterCountry($paymentMethods, $country)
|
80 |
+
{
|
81 |
+
$output = array();
|
82 |
+
foreach ($paymentMethods as $paymentMethod) {
|
83 |
+
if (in_array($country, $paymentMethod['countries']) || in_array('ALL',
|
84 |
+
$paymentMethod['countries'])
|
85 |
+
) {
|
86 |
+
$output[] = $paymentMethod;
|
87 |
+
}
|
88 |
+
}
|
89 |
+
return $output;
|
90 |
+
}
|
91 |
+
|
92 |
+
/**
|
93 |
+
* Get a list of available payment methods
|
94 |
+
*
|
95 |
+
* @param array|null $options
|
96 |
+
* @return array
|
97 |
+
*/
|
98 |
+
public static function getList($options = array())
|
99 |
+
{
|
100 |
+
$api = new Api\GetService();
|
101 |
+
$result = $api->doRequest();
|
102 |
+
$paymentMethods = self::reorderOutput($result);
|
103 |
+
|
104 |
+
if (isset($options['country'])) {
|
105 |
+
$paymentMethods = self::filterCountry($paymentMethods,
|
106 |
+
$options['country']);
|
107 |
+
}
|
108 |
+
|
109 |
+
return $paymentMethods;
|
110 |
+
}
|
111 |
+
|
112 |
+
/**
|
113 |
+
* Get a list of available banks
|
114 |
+
*
|
115 |
+
* @param int|null $paymentMethodId If empty, the paymentMethodId for iDEAL will be used
|
116 |
+
* @return array
|
117 |
+
*/
|
118 |
+
public static function getBanks($paymentMethodId = 10)
|
119 |
+
{
|
120 |
+
$paymentMethods = self::getList();
|
121 |
+
if (isset($paymentMethods[$paymentMethodId])) {
|
122 |
+
return $paymentMethods[$paymentMethodId]['banks'];
|
123 |
+
}
|
124 |
+
return array();
|
125 |
+
}
|
126 |
+
}
|
app/code/community/Pay/Payment/vendor/paynl/sdk/src/Refund.php
ADDED
@@ -0,0 +1,102 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Copyright (C) 2015 Andy Pieters <andy@pay.nl>
|
4 |
+
*
|
5 |
+
* This program is free software: you can redistribute it and/or modify
|
6 |
+
* it under the terms of the GNU General Public License as published by
|
7 |
+
* the Free Software Foundation, either version 3 of the License, or
|
8 |
+
* (at your option) any later version.
|
9 |
+
*
|
10 |
+
* This program is distributed in the hope that it will be useful,
|
11 |
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
+
* GNU General Public License for more details.
|
14 |
+
*
|
15 |
+
* You should have received a copy of the GNU General Public License
|
16 |
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
17 |
+
*/
|
18 |
+
|
19 |
+
namespace Paynl;
|
20 |
+
|
21 |
+
use Paynl\Result\Refund as Result;
|
22 |
+
|
23 |
+
use Paynl\Api\Refund as Api;
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Description of Refund
|
27 |
+
*
|
28 |
+
* @author Chris de Jong <chris@eventix.io>
|
29 |
+
*/
|
30 |
+
class Refund
|
31 |
+
{
|
32 |
+
|
33 |
+
/**
|
34 |
+
* Start a new transaction
|
35 |
+
*
|
36 |
+
* @param array|null $options
|
37 |
+
* @return Result\Add
|
38 |
+
* @throws Error\Error
|
39 |
+
*/
|
40 |
+
public static function add($options = array())
|
41 |
+
{
|
42 |
+
$api = new Api\Add();
|
43 |
+
|
44 |
+
if (isset($options['amount'])) {
|
45 |
+
$api->setAmount(round($options['amount'] * 100));
|
46 |
+
}
|
47 |
+
|
48 |
+
if (isset($options['bankAccountHolder']) && !empty($options['bankAccountHolder'])) {
|
49 |
+
$api->setBankAccountHolder($options['bankAccountHolder']);
|
50 |
+
}
|
51 |
+
|
52 |
+
if (isset($options['bankAccountNumber']) && !empty($options['bankAccountNumber'])) {
|
53 |
+
$api->setBankAccountNumber($options['bankAccountNumber']);
|
54 |
+
}
|
55 |
+
|
56 |
+
if (isset($options['bankAccountBic']) && !empty($options['bankAccountBic'])) {
|
57 |
+
$api->setBankAccountBic($options['bankAccountBic']);
|
58 |
+
}
|
59 |
+
|
60 |
+
if (isset($options['description']) && !empty($options['description'])) {
|
61 |
+
$api->setDescription($options['description']);
|
62 |
+
}
|
63 |
+
|
64 |
+
if (isset($options['promotorId'])) {
|
65 |
+
$api->setPromotorId($options['promotorId']);
|
66 |
+
}
|
67 |
+
if (isset($options['tool'])) {
|
68 |
+
$api->setTool($options['tool']);
|
69 |
+
}
|
70 |
+
if (isset($options['info'])) {
|
71 |
+
$api->setInfo($options['info']);
|
72 |
+
}
|
73 |
+
if (isset($options['object'])) {
|
74 |
+
$api->setObject($options['object']);
|
75 |
+
}
|
76 |
+
if (isset($options['extra1'])) {
|
77 |
+
$api->setExtra1($options['extra1']);
|
78 |
+
}
|
79 |
+
if (isset($options['extra2'])) {
|
80 |
+
$api->setExtra2($options['extra2']);
|
81 |
+
}
|
82 |
+
if (isset($options['extra3'])) {
|
83 |
+
$api->setExtra3($options['extra3']);
|
84 |
+
}
|
85 |
+
if (isset($options['orderId'])) {
|
86 |
+
$api->setOrderId($options['orderId']);
|
87 |
+
}
|
88 |
+
if (isset($options['currency'])) {
|
89 |
+
$api->setCurrency($options['currency']);
|
90 |
+
}
|
91 |
+
if (isset($options['processDate'])) {
|
92 |
+
if(is_string($options['processDate'])){
|
93 |
+
$options['processDate'] = new \DateTime($options['processDate']);
|
94 |
+
}
|
95 |
+
$api->setProcessDate($options['processDate']);
|
96 |
+
}
|
97 |
+
|
98 |
+
$result = $api->doRequest();
|
99 |
+
|
100 |
+
return new Result\Add($result);
|
101 |
+
}
|
102 |
+
}
|
app/code/community/Pay/Payment/vendor/paynl/sdk/src/Result/DirectDebit/Add.php
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Created by PhpStorm.
|
4 |
+
* User: andy
|
5 |
+
* Date: 6-7-16
|
6 |
+
* Time: 18:22
|
7 |
+
*/
|
8 |
+
|
9 |
+
namespace Paynl\Result\DirectDebit;
|
10 |
+
|
11 |
+
|
12 |
+
use Paynl\Result\Result;
|
13 |
+
|
14 |
+
class Add extends Result
|
15 |
+
{
|
16 |
+
public function getMandateId(){
|
17 |
+
return $this->data['result'];
|
18 |
+
}
|
19 |
+
}
|
app/code/community/Pay/Payment/vendor/paynl/sdk/src/Result/DirectDebit/Get.php
ADDED
@@ -0,0 +1,54 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Created by PhpStorm.
|
4 |
+
* User: andy
|
5 |
+
* Date: 6-7-16
|
6 |
+
* Time: 18:22
|
7 |
+
*/
|
8 |
+
|
9 |
+
namespace Paynl\Result\DirectDebit;
|
10 |
+
|
11 |
+
|
12 |
+
use Paynl\Result\Result;
|
13 |
+
|
14 |
+
class Get extends Result
|
15 |
+
{
|
16 |
+
protected function getOrder(){
|
17 |
+
return $this->data['result']['order'];
|
18 |
+
}
|
19 |
+
|
20 |
+
public function getMandateId(){
|
21 |
+
return $this->getOrder()['mandateId'];
|
22 |
+
}
|
23 |
+
public function getBankaccountNumber(){
|
24 |
+
return $this->getOrder()['bankaccountNumber'];
|
25 |
+
}
|
26 |
+
public function getBankaccountOwner(){
|
27 |
+
return $this->getOrder()['bankaccounOwner'];
|
28 |
+
}
|
29 |
+
public function getBankaccountBic(){
|
30 |
+
return $this->getOrder()['bankaccounBic'];
|
31 |
+
}
|
32 |
+
public function getAmount(){
|
33 |
+
return $this->getOrder()['amount']/100;
|
34 |
+
}
|
35 |
+
public function getDescription(){
|
36 |
+
return $this->getOrder()['description'];
|
37 |
+
}
|
38 |
+
public function getIpAddress(){
|
39 |
+
return $this->getOrder()['ipAddress'];
|
40 |
+
}
|
41 |
+
public function getEmail(){
|
42 |
+
return $this->getOrder()['email'];
|
43 |
+
}
|
44 |
+
public function getExtra1(){
|
45 |
+
return $this->getOrder()['extra1'];
|
46 |
+
}
|
47 |
+
public function getExtra2(){
|
48 |
+
return isset($this->getOrder()['extra2'])?$this->getOrder()['extra2']:'';
|
49 |
+
}
|
50 |
+
public function getExtra3(){
|
51 |
+
return isset($this->getOrder()['extra3'])?$this->getOrder()['extra3']:'';
|
52 |
+
}
|
53 |
+
|
54 |
+
}
|
app/code/community/Pay/Payment/vendor/paynl/sdk/src/Result/DirectDebit/Mandate/Add.php
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Created by PhpStorm.
|
4 |
+
* User: andy
|
5 |
+
* Date: 6-7-16
|
6 |
+
* Time: 18:22
|
7 |
+
*/
|
8 |
+
|
9 |
+
namespace Paynl\Result\DirectDebit\Mandate;
|
10 |
+
|
11 |
+
|
12 |
+
use Paynl\Result\Result;
|
13 |
+
|
14 |
+
class Add extends Result
|
15 |
+
{
|
16 |
+
public function getMandateId(){
|
17 |
+
return $this->data['result'];
|
18 |
+
}
|
19 |
+
}
|
app/code/community/Pay/Payment/vendor/paynl/sdk/src/Result/DirectDebit/Mandate/AddTransaction.php
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Created by PhpStorm.
|
4 |
+
* User: andy
|
5 |
+
* Date: 7-7-16
|
6 |
+
* Time: 16:45
|
7 |
+
*/
|
8 |
+
|
9 |
+
namespace Paynl\Result\DirectDebit\Mandate;
|
10 |
+
|
11 |
+
|
12 |
+
use Paynl\Result\Result;
|
13 |
+
|
14 |
+
class AddTransaction extends Result
|
15 |
+
{
|
16 |
+
/**
|
17 |
+
* todo: functies maken om data op te halen
|
18 |
+
*/
|
19 |
+
}
|
app/code/community/Pay/Payment/vendor/paynl/sdk/src/Result/DirectDebit/Mandate/Get.php
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Created by PhpStorm.
|
4 |
+
* User: andy
|
5 |
+
* Date: 6-7-16
|
6 |
+
* Time: 18:22
|
7 |
+
*/
|
8 |
+
|
9 |
+
namespace Paynl\Result\DirectDebit\Mandate;
|
10 |
+
|
11 |
+
|
12 |
+
use Paynl\Result\Result;
|
13 |
+
|
14 |
+
class Get extends Result
|
15 |
+
{
|
16 |
+
/**
|
17 |
+
* todo: functies maken om data op te halen
|
18 |
+
*/
|
19 |
+
}
|
app/code/community/Pay/Payment/vendor/paynl/sdk/src/Result/DirectDebit/Recurring/Add.php
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Created by PhpStorm.
|
4 |
+
* User: andy
|
5 |
+
* Date: 6-7-16
|
6 |
+
* Time: 18:22
|
7 |
+
*/
|
8 |
+
|
9 |
+
namespace Paynl\Result\DirectDebit\Recurring;
|
10 |
+
|
11 |
+
|
12 |
+
use Paynl\Result\Result;
|
13 |
+
|
14 |
+
class Add extends Result
|
15 |
+
{
|
16 |
+
public function getMandateId(){
|
17 |
+
return $this->data['result'];
|
18 |
+
}
|
19 |
+
}
|
app/code/community/Pay/Payment/vendor/paynl/sdk/src/Result/DirectDebit/Recurring/Get.php
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Created by PhpStorm.
|
4 |
+
* User: andy
|
5 |
+
* Date: 6-7-16
|
6 |
+
* Time: 18:22
|
7 |
+
*/
|
8 |
+
|
9 |
+
namespace Paynl\Result\DirectDebit\Recurring;
|
10 |
+
|
11 |
+
|
12 |
+
use Paynl\Result\Result;
|
13 |
+
|
14 |
+
class Get extends Result
|
15 |
+
{
|
16 |
+
/**
|
17 |
+
* todo: functies maken om data op te halen
|
18 |
+
*/
|
19 |
+
}
|
app/code/community/Pay/Payment/vendor/paynl/sdk/src/Result/Instore/ConfirmPayment.php
ADDED
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Copyright (C) 2015 Andy Pieters <andy@pay.nl>
|
4 |
+
*
|
5 |
+
* This program is free software: you can redistribute it and/or modify
|
6 |
+
* it under the terms of the GNU General Public License as published by
|
7 |
+
* the Free Software Foundation, either version 3 of the License, or
|
8 |
+
* (at your option) any later version.
|
9 |
+
*
|
10 |
+
* This program is distributed in the hope that it will be useful,
|
11 |
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
+
* GNU General Public License for more details.
|
14 |
+
*
|
15 |
+
* You should have received a copy of the GNU General Public License
|
16 |
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
17 |
+
*/
|
18 |
+
|
19 |
+
namespace Paynl\Result\Instore;
|
20 |
+
|
21 |
+
use Paynl\Result\Result;
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Result class for instore confirm payment
|
25 |
+
*
|
26 |
+
* @author Andy Pieters <andy@pay.nl>
|
27 |
+
*/
|
28 |
+
class ConfirmPayment extends Result
|
29 |
+
{
|
30 |
+
|
31 |
+
}
|
app/code/community/Pay/Payment/vendor/paynl/sdk/src/Result/Instore/Payment.php
ADDED
@@ -0,0 +1,53 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Copyright (C) 2015 Andy Pieters <andy@pay.nl>
|
4 |
+
*
|
5 |
+
* This program is free software: you can redistribute it and/or modify
|
6 |
+
* it under the terms of the GNU General Public License as published by
|
7 |
+
* the Free Software Foundation, either version 3 of the License, or
|
8 |
+
* (at your option) any later version.
|
9 |
+
*
|
10 |
+
* This program is distributed in the hope that it will be useful,
|
11 |
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
+
* GNU General Public License for more details.
|
14 |
+
*
|
15 |
+
* You should have received a copy of the GNU General Public License
|
16 |
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
17 |
+
*/
|
18 |
+
|
19 |
+
namespace Paynl\Result\Instore;
|
20 |
+
|
21 |
+
use Paynl\Result\Result;
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Result class for instore payment
|
25 |
+
*
|
26 |
+
* @author Andy Pieters <andy@pay.nl>
|
27 |
+
*/
|
28 |
+
class Payment extends Result
|
29 |
+
{
|
30 |
+
/**
|
31 |
+
* @return string The transaction id
|
32 |
+
*/
|
33 |
+
public function getTransactionId()
|
34 |
+
{
|
35 |
+
return $this->data['transaction']['transactionId'];
|
36 |
+
}
|
37 |
+
|
38 |
+
/**
|
39 |
+
* @return mixed The terminal hash for this transaction, use this for Instore::Status
|
40 |
+
*/
|
41 |
+
public function getHash()
|
42 |
+
{
|
43 |
+
return $this->data['transaction']['terminalHash'];
|
44 |
+
}
|
45 |
+
|
46 |
+
/**
|
47 |
+
* @return string The url to the status page
|
48 |
+
*/
|
49 |
+
public function getRedirectUrl()
|
50 |
+
{
|
51 |
+
return $this->data['transaction']['issuerUrl'];
|
52 |
+
}
|
53 |
+
}
|
app/code/community/Pay/Payment/vendor/paynl/sdk/src/Result/Instore/Receipt.php
ADDED
@@ -0,0 +1,59 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Copyright (C) 2015 Andy Pieters <andy@pay.nl>
|
4 |
+
*
|
5 |
+
* This program is free software: you can redistribute it and/or modify
|
6 |
+
* it under the terms of the GNU General Public License as published by
|
7 |
+
* the Free Software Foundation, either version 3 of the License, or
|
8 |
+
* (at your option) any later version.
|
9 |
+
*
|
10 |
+
* This program is distributed in the hope that it will be useful,
|
11 |
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
+
* GNU General Public License for more details.
|
14 |
+
*
|
15 |
+
* You should have received a copy of the GNU General Public License
|
16 |
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
17 |
+
*/
|
18 |
+
|
19 |
+
namespace Paynl\Result\Instore;
|
20 |
+
|
21 |
+
use Paynl\Result\Result;
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Result class for getTerminals
|
25 |
+
*
|
26 |
+
* @author Andy Pieters <andy@pay.nl>
|
27 |
+
*/
|
28 |
+
class Receipt extends Result
|
29 |
+
{
|
30 |
+
public function getReceipt()
|
31 |
+
{
|
32 |
+
return base64_decode($this->data['receipt']);
|
33 |
+
}
|
34 |
+
|
35 |
+
public function getApprovalId()
|
36 |
+
{
|
37 |
+
return $this->data['approvalId'];
|
38 |
+
}
|
39 |
+
|
40 |
+
public function getCardBrandId()
|
41 |
+
{
|
42 |
+
return $this->data['cardBrandId'];
|
43 |
+
}
|
44 |
+
|
45 |
+
public function getCardBrandName()
|
46 |
+
{
|
47 |
+
return $this->data['cardBrandName'];
|
48 |
+
}
|
49 |
+
|
50 |
+
public function getPaymentProfileId()
|
51 |
+
{
|
52 |
+
return $this->data['paymentProfileId'];
|
53 |
+
}
|
54 |
+
|
55 |
+
public function getPaymentProfileName()
|
56 |
+
{
|
57 |
+
return $this->data['paymentProfileName'];
|
58 |
+
}
|
59 |
+
}
|
app/code/community/Pay/Payment/vendor/paynl/sdk/src/Result/Instore/Status.php
ADDED
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Copyright (C) 2015 Andy Pieters <andy@pay.nl>
|
4 |
+
*
|
5 |
+
* This program is free software: you can redistribute it and/or modify
|
6 |
+
* it under the terms of the GNU General Public License as published by
|
7 |
+
* the Free Software Foundation, either version 3 of the License, or
|
8 |
+
* (at your option) any later version.
|
9 |
+
*
|
10 |
+
* This program is distributed in the hope that it will be useful,
|
11 |
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
+
* GNU General Public License for more details.
|
14 |
+
*
|
15 |
+
* You should have received a copy of the GNU General Public License
|
16 |
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
17 |
+
*/
|
18 |
+
|
19 |
+
namespace Paynl\Result\Instore;
|
20 |
+
|
21 |
+
use Paynl\Result\Result;
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Result class for terminal status
|
25 |
+
*
|
26 |
+
* @author Andy Pieters <andy@pay.nl>
|
27 |
+
*/
|
28 |
+
class Status extends Result
|
29 |
+
{
|
30 |
+
public function getTransactionState(){
|
31 |
+
return $this->data['transaction']['state'];
|
32 |
+
}
|
33 |
+
public function getTerminalState(){
|
34 |
+
return $this->data['terminal']['state'];
|
35 |
+
}
|
36 |
+
public function getProgressPercentage(){
|
37 |
+
return $this->data['progress']['percentage'];
|
38 |
+
}
|
39 |
+
}
|
app/code/community/Pay/Payment/vendor/paynl/sdk/src/Result/Instore/Terminals.php
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Copyright (C) 2015 Andy Pieters <andy@pay.nl>
|
4 |
+
*
|
5 |
+
* This program is free software: you can redistribute it and/or modify
|
6 |
+
* it under the terms of the GNU General Public License as published by
|
7 |
+
* the Free Software Foundation, either version 3 of the License, or
|
8 |
+
* (at your option) any later version.
|
9 |
+
*
|
10 |
+
* This program is distributed in the hope that it will be useful,
|
11 |
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
+
* GNU General Public License for more details.
|
14 |
+
*
|
15 |
+
* You should have received a copy of the GNU General Public License
|
16 |
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
17 |
+
*/
|
18 |
+
|
19 |
+
namespace Paynl\Result\Instore;
|
20 |
+
|
21 |
+
use Paynl\Result\Result;
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Result class for getTerminals
|
25 |
+
*
|
26 |
+
* @author Andy Pieters <andy@pay.nl>
|
27 |
+
*/
|
28 |
+
class Terminals extends Result
|
29 |
+
{
|
30 |
+
public function getList()
|
31 |
+
{
|
32 |
+
return $this->data['terminals'];
|
33 |
+
}
|
34 |
+
}
|
app/code/community/Pay/Payment/vendor/paynl/sdk/src/Result/Refund/Add.php
ADDED
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Copyright (C) 2015 Andy Pieters <andy@pay.nl>
|
4 |
+
*
|
5 |
+
* This program is free software: you can redistribute it and/or modify
|
6 |
+
* it under the terms of the GNU General Public License as published by
|
7 |
+
* the Free Software Foundation, either version 3 of the License, or
|
8 |
+
* (at your option) any later version.
|
9 |
+
*
|
10 |
+
* This program is distributed in the hope that it will be useful,
|
11 |
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
+
* GNU General Public License for more details.
|
14 |
+
*
|
15 |
+
* You should have received a copy of the GNU General Public License
|
16 |
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
17 |
+
*/
|
18 |
+
|
19 |
+
|
20 |
+
namespace Paynl\Result\Refund;
|
21 |
+
|
22 |
+
use Paynl\Result\Result;
|
23 |
+
|
24 |
+
/**
|
25 |
+
* Description of Add
|
26 |
+
*
|
27 |
+
* @author Chris de Jong <chris@eventix.io>
|
28 |
+
*/
|
29 |
+
class Add extends Result
|
30 |
+
{
|
31 |
+
/**
|
32 |
+
* @return string The refundId
|
33 |
+
*/
|
34 |
+
public function getRefundId()
|
35 |
+
{
|
36 |
+
return $this->data['refundId'];
|
37 |
+
}
|
38 |
+
}
|
app/code/community/Pay/Payment/vendor/paynl/sdk/src/Result/Result.php
ADDED
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Copyright (C) 2015 Andy Pieters <andy@pay.nl>
|
4 |
+
*
|
5 |
+
* This program is free software: you can redistribute it and/or modify
|
6 |
+
* it under the terms of the GNU General Public License as published by
|
7 |
+
* the Free Software Foundation, either version 3 of the License, or
|
8 |
+
* (at your option) any later version.
|
9 |
+
*
|
10 |
+
* This program is distributed in the hope that it will be useful,
|
11 |
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
+
* GNU General Public License for more details.
|
14 |
+
*
|
15 |
+
* You should have received a copy of the GNU General Public License
|
16 |
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
17 |
+
*/
|
18 |
+
|
19 |
+
|
20 |
+
namespace Paynl\Result;
|
21 |
+
|
22 |
+
/**
|
23 |
+
* Base class for the results of the API
|
24 |
+
*
|
25 |
+
* @author Andy Pieters <andy@pay.nl>
|
26 |
+
*/
|
27 |
+
class Result
|
28 |
+
{
|
29 |
+
protected $data = array();
|
30 |
+
|
31 |
+
public function __construct($data)
|
32 |
+
{
|
33 |
+
$this->data = $data;
|
34 |
+
}
|
35 |
+
|
36 |
+
/**
|
37 |
+
* Get the complete result as an array
|
38 |
+
* @return array
|
39 |
+
*/
|
40 |
+
public function getData()
|
41 |
+
{
|
42 |
+
return $this->data;
|
43 |
+
}
|
44 |
+
}
|
app/code/community/Pay/Payment/vendor/paynl/sdk/src/Result/Transaction/Refund.php
ADDED
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Copyright (C) 2015 Andy Pieters <andy@pay.nl>
|
4 |
+
*
|
5 |
+
* This program is free software: you can redistribute it and/or modify
|
6 |
+
* it under the terms of the GNU General Public License as published by
|
7 |
+
* the Free Software Foundation, either version 3 of the License, or
|
8 |
+
* (at your option) any later version.
|
9 |
+
*
|
10 |
+
* This program is distributed in the hope that it will be useful,
|
11 |
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
+
* GNU General Public License for more details.
|
14 |
+
*
|
15 |
+
* You should have received a copy of the GNU General Public License
|
16 |
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
17 |
+
*/
|
18 |
+
|
19 |
+
namespace Paynl\Result\Transaction;
|
20 |
+
|
21 |
+
use Paynl\Result\Result;
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Result class for a refund
|
25 |
+
*
|
26 |
+
* @author Andy Pieters <andy@pay.nl>
|
27 |
+
*/
|
28 |
+
class Refund extends Result
|
29 |
+
{
|
30 |
+
/**
|
31 |
+
* @return string The refundId
|
32 |
+
*/
|
33 |
+
public function getRefundId()
|
34 |
+
{
|
35 |
+
return $this->data['refundId'];
|
36 |
+
}
|
37 |
+
}
|
app/code/community/Pay/Payment/vendor/paynl/sdk/src/Result/Transaction/Start.php
ADDED
@@ -0,0 +1,54 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Copyright (C) 2015 Andy Pieters <andy@pay.nl>
|
4 |
+
*
|
5 |
+
* This program is free software: you can redistribute it and/or modify
|
6 |
+
* it under the terms of the GNU General Public License as published by
|
7 |
+
* the Free Software Foundation, either version 3 of the License, or
|
8 |
+
* (at your option) any later version.
|
9 |
+
*
|
10 |
+
* This program is distributed in the hope that it will be useful,
|
11 |
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
+
* GNU General Public License for more details.
|
14 |
+
*
|
15 |
+
* You should have received a copy of the GNU General Public License
|
16 |
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
17 |
+
*/
|
18 |
+
|
19 |
+
|
20 |
+
namespace Paynl\Result\Transaction;
|
21 |
+
|
22 |
+
use Paynl\Result\Result;
|
23 |
+
|
24 |
+
/**
|
25 |
+
* Description of Start
|
26 |
+
*
|
27 |
+
* @author Andy Pieters <andy@pay.nl>
|
28 |
+
*/
|
29 |
+
class Start extends Result
|
30 |
+
{
|
31 |
+
/**
|
32 |
+
* @return string The transactionId
|
33 |
+
*/
|
34 |
+
public function getTransactionId()
|
35 |
+
{
|
36 |
+
return $this->data['transaction']['transactionId'];
|
37 |
+
}
|
38 |
+
|
39 |
+
/**
|
40 |
+
* @return string The url where the customer can complete the payment
|
41 |
+
*/
|
42 |
+
public function getRedirectUrl()
|
43 |
+
{
|
44 |
+
return $this->data['transaction']['paymentURL'];
|
45 |
+
}
|
46 |
+
|
47 |
+
/**
|
48 |
+
* @return string The payment reference (for manual transfer)
|
49 |
+
*/
|
50 |
+
public function getPaymentReference()
|
51 |
+
{
|
52 |
+
return $this->data['transaction']['paymentReference'];
|
53 |
+
}
|
54 |
+
}
|
app/code/community/Pay/Payment/vendor/paynl/sdk/src/Result/Transaction/Transaction.php
ADDED
@@ -0,0 +1,241 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Copyright (C) 2015 Andy Pieters <andy@pay.nl>
|
4 |
+
*
|
5 |
+
* This program is free software: you can redistribute it and/or modify
|
6 |
+
* it under the terms of the GNU General Public License as published by
|
7 |
+
* the Free Software Foundation, either version 3 of the License, or
|
8 |
+
* (at your option) any later version.
|
9 |
+
*
|
10 |
+
* This program is distributed in the hope that it will be useful,
|
11 |
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
+
* GNU General Public License for more details.
|
14 |
+
*
|
15 |
+
* You should have received a copy of the GNU General Public License
|
16 |
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
17 |
+
*/
|
18 |
+
|
19 |
+
namespace Paynl\Result\Transaction;
|
20 |
+
|
21 |
+
use Paynl\Error\Error;
|
22 |
+
use Paynl\Result\Result;
|
23 |
+
|
24 |
+
/**
|
25 |
+
* Description of Transaction
|
26 |
+
*
|
27 |
+
* @author Andy Pieters <andy@pay.nl>
|
28 |
+
*/
|
29 |
+
class Transaction extends Result
|
30 |
+
{
|
31 |
+
/**
|
32 |
+
* @return bool Transaction is paid
|
33 |
+
*/
|
34 |
+
public function isPaid()
|
35 |
+
{
|
36 |
+
return $this->data['paymentDetails']['stateName'] == 'PAID';
|
37 |
+
}
|
38 |
+
|
39 |
+
/**
|
40 |
+
* @return bool
|
41 |
+
*/
|
42 |
+
public function isPending()
|
43 |
+
{
|
44 |
+
return $this->data['paymentDetails']['stateName'] == 'PENDING' || $this->data['paymentDetails']['stateName'] == 'VERIFY';
|
45 |
+
}
|
46 |
+
|
47 |
+
/**
|
48 |
+
* Alias for isCanceled
|
49 |
+
*
|
50 |
+
* @return bool Transaction is Canceled
|
51 |
+
*/
|
52 |
+
public function isCancelled()
|
53 |
+
{
|
54 |
+
return $this->isCanceled();
|
55 |
+
}
|
56 |
+
|
57 |
+
/**
|
58 |
+
* @return bool Transaction is Canceled
|
59 |
+
*/
|
60 |
+
public function isCanceled()
|
61 |
+
{
|
62 |
+
return $this->data['paymentDetails']['state'] < 0;
|
63 |
+
}
|
64 |
+
|
65 |
+
public function isAuthorized()
|
66 |
+
{
|
67 |
+
return $this->data['paymentDetails']['state'] == 95;
|
68 |
+
}
|
69 |
+
|
70 |
+
public function void(){
|
71 |
+
if(!$this->isAuthorized()){
|
72 |
+
throw new Error('Cannod void transaction, status is not authorized');
|
73 |
+
}
|
74 |
+
return \Paynl\Transaction::void($this->getId());
|
75 |
+
}
|
76 |
+
public function capture(){
|
77 |
+
if(!$this->isAuthorized()){
|
78 |
+
throw new Error('Cannod capture transaction, status is not authorized');
|
79 |
+
}
|
80 |
+
return \Paynl\Transaction::capture($this->getId());
|
81 |
+
}
|
82 |
+
|
83 |
+
/**
|
84 |
+
* @param bool|true $allowPartialRefunds
|
85 |
+
*
|
86 |
+
* @return bool
|
87 |
+
*/
|
88 |
+
public function isRefunded($allowPartialRefunds = true)
|
89 |
+
{
|
90 |
+
if ($this->data['paymentDetails']['stateName'] == 'REFUND') {
|
91 |
+
return true;
|
92 |
+
}
|
93 |
+
|
94 |
+
if ($allowPartialRefunds && $this->data['paymentDetails']['stateName'] == 'PARTIAL_REFUND') {
|
95 |
+
return true;
|
96 |
+
}
|
97 |
+
|
98 |
+
return false;
|
99 |
+
}
|
100 |
+
|
101 |
+
/**
|
102 |
+
* @return bool
|
103 |
+
*/
|
104 |
+
public function isPartiallyRefunded()
|
105 |
+
{
|
106 |
+
return $this->data['paymentDetails']['stateName'] == 'PARTIAL_REFUND';
|
107 |
+
}
|
108 |
+
|
109 |
+
/**
|
110 |
+
* @return float Paid amount in original currency
|
111 |
+
*/
|
112 |
+
public function getPaidCurrencyAmount()
|
113 |
+
{
|
114 |
+
return $this->data['paymentDetails']['paidCurrenyAmount'] / 100;
|
115 |
+
}
|
116 |
+
|
117 |
+
/**
|
118 |
+
* @return float Paid amount
|
119 |
+
*/
|
120 |
+
public function getPaidAmount()
|
121 |
+
{
|
122 |
+
return $this->data['paymentDetails']['paidAmount'] / 100;
|
123 |
+
}
|
124 |
+
|
125 |
+
/**
|
126 |
+
* @return string Currency in which the transaction is actually paid
|
127 |
+
*/
|
128 |
+
public function getPaidCurrency()
|
129 |
+
{
|
130 |
+
return $this->data['paymentDetails']['paidCurrency'];
|
131 |
+
}
|
132 |
+
|
133 |
+
/**
|
134 |
+
* @return string The name of the account holder
|
135 |
+
*/
|
136 |
+
public function getAccountHolderName()
|
137 |
+
{
|
138 |
+
return $this->data['paymentDetails']['identifierName'];
|
139 |
+
}
|
140 |
+
|
141 |
+
/**
|
142 |
+
* @return string The name of the payment method
|
143 |
+
*/
|
144 |
+
public function getPaymentMethodName()
|
145 |
+
{
|
146 |
+
return $this->data['paymentDetails']['paymentProfileName'];
|
147 |
+
}
|
148 |
+
|
149 |
+
/**
|
150 |
+
* @return string The account number, or masked creditcard number
|
151 |
+
*/
|
152 |
+
public function getAccountNumber()
|
153 |
+
{
|
154 |
+
return $this->data['paymentDetails']['identifierPublic'];
|
155 |
+
}
|
156 |
+
|
157 |
+
/**
|
158 |
+
* @return string The account number, or masked creditcard number
|
159 |
+
*/
|
160 |
+
public function getAccountHash()
|
161 |
+
{
|
162 |
+
return $this->data['paymentDetails']['identifierHash'];
|
163 |
+
}
|
164 |
+
|
165 |
+
/**
|
166 |
+
* @return string The transaction description, as defined while starting the transaction
|
167 |
+
*/
|
168 |
+
public function getDescription()
|
169 |
+
{
|
170 |
+
return $this->data['paymentDetails']['description'];
|
171 |
+
}
|
172 |
+
|
173 |
+
/**
|
174 |
+
* @return string The extra1 variable, as defined while starting the transaction
|
175 |
+
*/
|
176 |
+
public function getExtra1()
|
177 |
+
{
|
178 |
+
return $this->data['statsDetails']['extra1'];
|
179 |
+
}
|
180 |
+
|
181 |
+
/**
|
182 |
+
* @return string The extra2 variable, as defined while starting the transaction
|
183 |
+
*/
|
184 |
+
public function getExtra2()
|
185 |
+
{
|
186 |
+
return $this->data['statsDetails']['extra2'];
|
187 |
+
}
|
188 |
+
|
189 |
+
/**
|
190 |
+
* @return string The extra3 variable, as defined while starting the transaction
|
191 |
+
*/
|
192 |
+
public function getExtra3()
|
193 |
+
{
|
194 |
+
return $this->data['statsDetails']['extra3'];
|
195 |
+
}
|
196 |
+
|
197 |
+
public function approve()
|
198 |
+
{
|
199 |
+
if ($this->isBeingVerified()) {
|
200 |
+
$result = \Paynl\Transaction::approve($this->getId());
|
201 |
+
$this->_reload(); //status is changed, so refresh the object
|
202 |
+
return $result;
|
203 |
+
} else {
|
204 |
+
throw new Error("Cannot approve transaction because it does not have the status 'verify'");
|
205 |
+
}
|
206 |
+
}
|
207 |
+
|
208 |
+
/**
|
209 |
+
* @return bool
|
210 |
+
*/
|
211 |
+
public function isBeingVerified()
|
212 |
+
{
|
213 |
+
return $this->data['paymentDetails']['stateName'] == 'VERIFY';
|
214 |
+
}
|
215 |
+
|
216 |
+
/**
|
217 |
+
* @return string The transaction id
|
218 |
+
*/
|
219 |
+
public function getId()
|
220 |
+
{
|
221 |
+
return $this->data['transactionId'];
|
222 |
+
}
|
223 |
+
|
224 |
+
private function _reload()
|
225 |
+
{
|
226 |
+
$result = \Paynl\Transaction::get($this->getId());
|
227 |
+
$this->data = $result->getData();
|
228 |
+
}
|
229 |
+
|
230 |
+
public function decline()
|
231 |
+
{
|
232 |
+
if ($this->isBeingVerified()) {
|
233 |
+
$result = \Paynl\Transaction::decline($this->getId());
|
234 |
+
$this->_reload();//status is changed, so refresh the object
|
235 |
+
return $result;
|
236 |
+
} else {
|
237 |
+
throw new Error("Cannot decline transaction because it does not have the status 'verify'");
|
238 |
+
}
|
239 |
+
}
|
240 |
+
|
241 |
+
}
|
app/code/community/Pay/Payment/vendor/paynl/sdk/src/Result/Voucher/Voucher.php
ADDED
@@ -0,0 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Paynl\Result\Voucher;
|
4 |
+
|
5 |
+
use Paynl\Result\Result;
|
6 |
+
|
7 |
+
class Voucher extends Result
|
8 |
+
{
|
9 |
+
/**
|
10 |
+
* Returns the balance for the voucher
|
11 |
+
* @return float the current balance of the voucher
|
12 |
+
*/
|
13 |
+
public function getBalance()
|
14 |
+
{
|
15 |
+
return $this->data['balance'] / 100;
|
16 |
+
}
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Returns the voucher code
|
20 |
+
* @return string
|
21 |
+
*/
|
22 |
+
public function getCardNumber()
|
23 |
+
{
|
24 |
+
return $this->data['cardNumber'];
|
25 |
+
}
|
26 |
+
|
27 |
+
/**
|
28 |
+
* refresh the internal data
|
29 |
+
*/
|
30 |
+
private function _reload()
|
31 |
+
{
|
32 |
+
$this->data = \Paynl\Voucher::get($this->getCardNumber())->getData();
|
33 |
+
}
|
34 |
+
|
35 |
+
/**
|
36 |
+
* provide functionality to charge the voucher from this instance
|
37 |
+
*
|
38 |
+
* @param float $amount the amount to charge the voucher with
|
39 |
+
* @param string $pin the pin code for the voucher
|
40 |
+
* @return bool if the charge was done succesfully
|
41 |
+
*/
|
42 |
+
public function charge($amount, $pin)
|
43 |
+
{
|
44 |
+
$state = \Paynl\Voucher::charge(['cardNumber' => $this->getCardNumber(), 'amount' => $amount, 'pincode' => $pin]);
|
45 |
+
|
46 |
+
$this->_reload();
|
47 |
+
return $state;
|
48 |
+
}
|
49 |
+
}
|
app/code/community/Pay/Payment/vendor/paynl/sdk/src/Service.php
ADDED
@@ -0,0 +1,73 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Copyright (C) 2015 Andy Pieters <andy@andypieters.nl>
|
4 |
+
*
|
5 |
+
* This program is free software: you can redistribute it and/or modify
|
6 |
+
* it under the terms of the GNU General Public License as published by
|
7 |
+
* the Free Software Foundation, either version 3 of the License, or
|
8 |
+
* (at your option) any later version.
|
9 |
+
*
|
10 |
+
* This program is distributed in the hope that it will be useful,
|
11 |
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
+
* GNU General Public License for more details.
|
14 |
+
*
|
15 |
+
* You should have received a copy of the GNU General Public License
|
16 |
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
17 |
+
*/
|
18 |
+
|
19 |
+
namespace Paynl;
|
20 |
+
use Paynl\Api\Service\GetPayLinkUrl;
|
21 |
+
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Description of Paymentmethods
|
25 |
+
*
|
26 |
+
* @author Andy Pieters <andy@andypieters.nl>
|
27 |
+
*/
|
28 |
+
class Service
|
29 |
+
{
|
30 |
+
public static function getPayLinkUrl($options = [])
|
31 |
+
{
|
32 |
+
$api = new GetPayLinkUrl();
|
33 |
+
|
34 |
+
if (!isset($options['securityMode'])){
|
35 |
+
throw new Error\Required('securityMode');
|
36 |
+
}
|
37 |
+
$api->setSecurityMode($options['securityMode']);
|
38 |
+
|
39 |
+
if(!isset($options['amount'])){
|
40 |
+
throw new Error\Required('amount');
|
41 |
+
}
|
42 |
+
$api->setAmount(round($options['amount']*100));
|
43 |
+
|
44 |
+
if(!isset($options['amountMin'])){
|
45 |
+
throw new Error\Required('amountMin');
|
46 |
+
}
|
47 |
+
$api->setAmountMin(round($options['amountMin']*100));
|
48 |
+
|
49 |
+
if(isset($options['countryCode'])){
|
50 |
+
$api->setCountryCode($options['countryCode']);
|
51 |
+
}
|
52 |
+
if(isset($options['language'])){
|
53 |
+
$api->setLanguage($options['language']);
|
54 |
+
}
|
55 |
+
if(isset($options['extra1'])){
|
56 |
+
$api->setExtra1($options['extra1']);
|
57 |
+
}
|
58 |
+
if(isset($options['extra2'])){
|
59 |
+
$api->setExtra2($options['extra2']);
|
60 |
+
}
|
61 |
+
if(isset($options['extra3'])){
|
62 |
+
$api->setExtra3($options['extra3']);
|
63 |
+
}
|
64 |
+
if(isset($options['tool'])){
|
65 |
+
$api->setTool($options['tool']);
|
66 |
+
}
|
67 |
+
if(isset($options['info'])){
|
68 |
+
$api->setInfo($options['info']);
|
69 |
+
}
|
70 |
+
$result = $api->doRequest();
|
71 |
+
return $result['url'];
|
72 |
+
}
|
73 |
+
}
|
app/code/community/Pay/Payment/vendor/paynl/sdk/src/Transaction.php
ADDED
@@ -0,0 +1,325 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Copyright (C) 2015 Andy Pieters <andy@pay.nl>
|
4 |
+
*
|
5 |
+
* This program is free software: you can redistribute it and/or modify
|
6 |
+
* it under the terms of the GNU General Public License as published by
|
7 |
+
* the Free Software Foundation, either version 3 of the License, or
|
8 |
+
* (at your option) any later version.
|
9 |
+
*
|
10 |
+
* This program is distributed in the hope that it will be useful,
|
11 |
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
+
* GNU General Public License for more details.
|
14 |
+
*
|
15 |
+
* You should have received a copy of the GNU General Public License
|
16 |
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
17 |
+
*/
|
18 |
+
|
19 |
+
namespace Paynl;
|
20 |
+
|
21 |
+
use Paynl\Result\Transaction as Result;
|
22 |
+
|
23 |
+
use Paynl\Api\Transaction as Api;
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Description of Transaction
|
27 |
+
*
|
28 |
+
* @author Andy Pieters <andy@andypieters.nl>
|
29 |
+
*/
|
30 |
+
class Transaction
|
31 |
+
{
|
32 |
+
const PRODUCT_TYPE_ARTICLE = 'ARTICLE';
|
33 |
+
const PRODUCT_TYPE_SHIPPING = 'SHIPPING';
|
34 |
+
const PRODUCT_TYPE_HANDLING = 'HANDLING';
|
35 |
+
const PRODUCT_TYPE_DISCOUNT = 'DISCOUNT';
|
36 |
+
|
37 |
+
/**
|
38 |
+
* Start a new transaction
|
39 |
+
*
|
40 |
+
* @param array|null $options
|
41 |
+
* @return Result\Start
|
42 |
+
* @throws Error\Error
|
43 |
+
*/
|
44 |
+
public static function start($options = array())
|
45 |
+
{
|
46 |
+
$api = new Api\Start();
|
47 |
+
|
48 |
+
if (isset($options['amount'])) {
|
49 |
+
$api->setAmount(round($options['amount'] * 100));
|
50 |
+
}
|
51 |
+
if (isset($options['currency'])) {
|
52 |
+
$api->setCurrency($options['currency']);
|
53 |
+
}
|
54 |
+
if (isset($options['expireDate'])) {
|
55 |
+
if (is_string($options['expireDate'])) {
|
56 |
+
$options['expireDate'] = new \DateTime($options['expireDate']);
|
57 |
+
}
|
58 |
+
$api->setExpireDate($options['expireDate']);
|
59 |
+
}
|
60 |
+
|
61 |
+
if (isset($options['returnUrl'])) {
|
62 |
+
$api->setFinishUrl($options['returnUrl']);
|
63 |
+
}
|
64 |
+
|
65 |
+
if (isset($options['exchangeUrl'])) {
|
66 |
+
$api->setExchangeUrl($options['exchangeUrl']);
|
67 |
+
}
|
68 |
+
|
69 |
+
if (isset($options['paymentMethod']) && !empty($options['paymentMethod'])) {
|
70 |
+
$api->setPaymentOptionId($options['paymentMethod']);
|
71 |
+
}
|
72 |
+
if (isset($options['bank']) && !empty($options['bank'])) {
|
73 |
+
$api->setPaymentOptionSubId($options['bank']);
|
74 |
+
}
|
75 |
+
|
76 |
+
if (isset($options['description']) && !empty($options['description'])) {
|
77 |
+
$api->setDescription($options['description']);
|
78 |
+
}
|
79 |
+
|
80 |
+
if (isset($options['testmode']) && $options['testmode'] == 1) {
|
81 |
+
$api->setTestMode(true);
|
82 |
+
}
|
83 |
+
|
84 |
+
if (isset($options['extra1'])) {
|
85 |
+
$api->setExtra1($options['extra1']);
|
86 |
+
}
|
87 |
+
if (isset($options['extra2'])) {
|
88 |
+
$api->setExtra2($options['extra2']);
|
89 |
+
}
|
90 |
+
if (isset($options['extra3'])) {
|
91 |
+
$api->setExtra3($options['extra3']);
|
92 |
+
}
|
93 |
+
|
94 |
+
if (isset($options['ipaddress'])) {
|
95 |
+
$api->setIpAddress($options['ipaddress']);
|
96 |
+
}
|
97 |
+
|
98 |
+
if (isset($options['invoiceDate'])) {
|
99 |
+
if (is_string($options['invoiceDate'])) {
|
100 |
+
$options['invoiceDate'] = new \DateTime($options['invoiceDate']);
|
101 |
+
}
|
102 |
+
$api->setInvoiceDate($options['invoiceDate']);
|
103 |
+
}
|
104 |
+
|
105 |
+
if (isset($options['deliveryDate'])) {
|
106 |
+
if (is_string($options['deliveryDate'])) {
|
107 |
+
$options['deliveryDate'] = new \DateTime($options['deliveryDate']);
|
108 |
+
}
|
109 |
+
$api->setDeliveryDate($options['deliveryDate']);
|
110 |
+
}
|
111 |
+
|
112 |
+
if (isset($options['products'])) {
|
113 |
+
foreach ($options['products'] as $product) {
|
114 |
+
if(isset($product['tax'])) {
|
115 |
+
$taxClass = Helper::calculateTaxClass($product['price'], $product['tax']);
|
116 |
+
} else {
|
117 |
+
$taxClass = 'N';
|
118 |
+
}
|
119 |
+
|
120 |
+
$taxPercentage = null;
|
121 |
+
if (isset($product['vatPercentage']) && is_numeric($product['vatPercentage'])) {
|
122 |
+
$taxPercentage = round($product['vatPercentage'], 2);
|
123 |
+
$taxClass = Helper::calculateTaxClass(100 + $taxPercentage, $taxPercentage);
|
124 |
+
} else {
|
125 |
+
$taxPercentage = round(Helper::calculateTaxPercentage($product['price'], $product['tax']));
|
126 |
+
}
|
127 |
+
|
128 |
+
if (!isset($product['type'])) {
|
129 |
+
$product['type'] = self::PRODUCT_TYPE_ARTICLE;
|
130 |
+
}
|
131 |
+
|
132 |
+
$api->addProduct($product['id'], $product['name'], $product['type'], round($product['price'] * 100),
|
133 |
+
$product['qty'], $taxClass, $taxPercentage);
|
134 |
+
}
|
135 |
+
}
|
136 |
+
$enduser = array();
|
137 |
+
if (isset($options['enduser'])) {
|
138 |
+
if (isset($options['enduser']['birthDate']) && is_string($options['enduser']['birthDate'])) {
|
139 |
+
$options['enduser']['birthDate'] = new \DateTime($options['enduser']['birthDate']);
|
140 |
+
}
|
141 |
+
$enduser = $options['enduser'];
|
142 |
+
}
|
143 |
+
if (isset($options['language'])) {
|
144 |
+
$enduser['language'] = $options['language'];
|
145 |
+
}
|
146 |
+
if (isset($options['address'])) {
|
147 |
+
$address = array();
|
148 |
+
if (isset($options['address']['streetName'])) {
|
149 |
+
$address['streetName'] = $options['address']['streetName'];
|
150 |
+
}
|
151 |
+
if (isset($options['address']['houseNumber'])) {
|
152 |
+
$address['streetNumber'] = $options['address']['houseNumber'];
|
153 |
+
}
|
154 |
+
if (isset($options['address']['houseNumberExtension'])) {
|
155 |
+
$address['streetNumberExtension'] = $options['address']['houseNumberExtension'];
|
156 |
+
}
|
157 |
+
if (isset($options['address']['zipCode'])) {
|
158 |
+
$address['zipCode'] = $options['address']['zipCode'];
|
159 |
+
}
|
160 |
+
if (isset($options['address']['city'])) {
|
161 |
+
$address['city'] = $options['address']['city'];
|
162 |
+
}
|
163 |
+
if (isset($options['address']['country'])) {
|
164 |
+
$address['countryCode'] = $options['address']['country'];
|
165 |
+
}
|
166 |
+
$enduser['address'] = $address;
|
167 |
+
}
|
168 |
+
if (isset($options['invoiceAddress'])) {
|
169 |
+
$invoiceAddress = array();
|
170 |
+
|
171 |
+
if (isset($options['invoiceAddress']['initials'])) {
|
172 |
+
$invoiceAddress['initials'] = $options['invoiceAddress']['initials'];
|
173 |
+
}
|
174 |
+
if (isset($options['invoiceAddress']['lastName'])) {
|
175 |
+
$invoiceAddress['lastName'] = $options['invoiceAddress']['lastName'];
|
176 |
+
}
|
177 |
+
if (isset($options['invoiceAddress']['streetName'])) {
|
178 |
+
$invoiceAddress['streetName'] = $options['invoiceAddress']['streetName'];
|
179 |
+
}
|
180 |
+
if (isset($options['invoiceAddress']['houseNumber'])) {
|
181 |
+
$invoiceAddress['streetNumber'] = $options['invoiceAddress']['houseNumber'];
|
182 |
+
}
|
183 |
+
if (isset($options['invoiceAddress']['houseNumberExtension'])) {
|
184 |
+
$invoiceAddress['streetNumberExtension'] = $options['invoiceAddress']['houseNumberExtension'];
|
185 |
+
}
|
186 |
+
if (isset($options['invoiceAddress']['zipCode'])) {
|
187 |
+
$invoiceAddress['zipCode'] = $options['invoiceAddress']['zipCode'];
|
188 |
+
}
|
189 |
+
if (isset($options['invoiceAddress']['city'])) {
|
190 |
+
$invoiceAddress['city'] = $options['invoiceAddress']['city'];
|
191 |
+
}
|
192 |
+
if (isset($options['invoiceAddress']['country'])) {
|
193 |
+
$invoiceAddress['countryCode'] = $options['invoiceAddress']['country'];
|
194 |
+
}
|
195 |
+
if (isset($options['invoiceAddress']['gender'])) {
|
196 |
+
$invoiceAddress['gender'] = $options['invoiceAddress']['gender'];
|
197 |
+
}
|
198 |
+
|
199 |
+
$enduser['invoiceAddress'] = $invoiceAddress;
|
200 |
+
}
|
201 |
+
if (!empty($enduser)) {
|
202 |
+
$api->setEnduser($enduser);
|
203 |
+
}
|
204 |
+
|
205 |
+
if (isset($options['transferType'])) {
|
206 |
+
$api->setTransferType($options['transferType']);
|
207 |
+
}
|
208 |
+
|
209 |
+
if (isset($options['transferValue'])) {
|
210 |
+
$api->setTransferValue($options['transferValue']);
|
211 |
+
}
|
212 |
+
|
213 |
+
$result = $api->doRequest();
|
214 |
+
|
215 |
+
return new Result\Start($result);
|
216 |
+
}
|
217 |
+
|
218 |
+
/**
|
219 |
+
* Get the transaction
|
220 |
+
*
|
221 |
+
* @param string $transactionId
|
222 |
+
* @return \Paynl\Result\Transaction\Transaction
|
223 |
+
*/
|
224 |
+
public static function get($transactionId)
|
225 |
+
{
|
226 |
+
$api = new Api\Info();
|
227 |
+
$api->setTransactionId($transactionId);
|
228 |
+
$result = $api->doRequest();
|
229 |
+
$result['transactionId'] = $transactionId;
|
230 |
+
return new Result\Transaction($result);
|
231 |
+
}
|
232 |
+
|
233 |
+
/**
|
234 |
+
* Get the transaction in a return script.
|
235 |
+
* This will automatically load orderId from the get string to fetch the transaction
|
236 |
+
*
|
237 |
+
* @return \Paynl\Result\Transaction\Transaction
|
238 |
+
*/
|
239 |
+
public static function getForReturn()
|
240 |
+
{
|
241 |
+
$transactionId = $_GET['orderId'];
|
242 |
+
return self::get($transactionId);
|
243 |
+
}
|
244 |
+
|
245 |
+
/**
|
246 |
+
* Get the transaction in an exchange script.
|
247 |
+
* This will work for all kinds of exchange calls (GET, POST AND POST_XML)
|
248 |
+
*
|
249 |
+
* @return \Paynl\Result\Transaction\Transaction
|
250 |
+
*/
|
251 |
+
public static function getForExchange()
|
252 |
+
{
|
253 |
+
if (isset($_GET['order_id'])) {
|
254 |
+
$transactionId = $_GET['order_id'];
|
255 |
+
} elseif (isset($_POST['order_id'])) {
|
256 |
+
$transactionId = $_POST['order_id'];
|
257 |
+
} else {
|
258 |
+
// maybe its xml
|
259 |
+
$input = file_get_contents('php://input');
|
260 |
+
$xml = simplexml_load_string($input);
|
261 |
+
|
262 |
+
$transactionId = $xml->order_id;
|
263 |
+
}
|
264 |
+
|
265 |
+
return self::get($transactionId);
|
266 |
+
}
|
267 |
+
|
268 |
+
/**
|
269 |
+
* (Partially) Refund a transaction
|
270 |
+
* If only the transactionId is supplied, the full amount of transaction will be refunded
|
271 |
+
*
|
272 |
+
* @param string $transactionId
|
273 |
+
* @param int|float|null $amount
|
274 |
+
* @param string|null $description
|
275 |
+
*
|
276 |
+
* @return Result\Refund
|
277 |
+
*/
|
278 |
+
public static function refund($transactionId, $amount = null,
|
279 |
+
$description = null)
|
280 |
+
{
|
281 |
+
$api = new Api\Refund();
|
282 |
+
$api->setTransactionId($transactionId);
|
283 |
+
if (!is_null($amount)) {
|
284 |
+
$amount = round($amount * 100);
|
285 |
+
$api->setAmount($amount);
|
286 |
+
}
|
287 |
+
|
288 |
+
if (!is_null($description)) {
|
289 |
+
$api->setDescription($description);
|
290 |
+
}
|
291 |
+
$result = $api->doRequest();
|
292 |
+
|
293 |
+
return new Result\Refund($result);
|
294 |
+
}
|
295 |
+
|
296 |
+
public static function approve($transactionId)
|
297 |
+
{
|
298 |
+
$api = new Api\Approve();
|
299 |
+
$api->setTransactionId($transactionId);
|
300 |
+
$result = $api->doRequest();
|
301 |
+
return $result['request']['result'] == 1;
|
302 |
+
}
|
303 |
+
|
304 |
+
public static function decline($transactionId)
|
305 |
+
{
|
306 |
+
$api = new Api\Decline();
|
307 |
+
$api->setTransactionId($transactionId);
|
308 |
+
$result = $api->doRequest();
|
309 |
+
return $result['request']['result'] == 1;
|
310 |
+
}
|
311 |
+
|
312 |
+
public static function capture($transactionId){
|
313 |
+
$api = new Api\Capture();
|
314 |
+
$api->setTransactionId($transactionId);
|
315 |
+
$result = $api->doRequest();
|
316 |
+
return $result['request']['result'] == 1;
|
317 |
+
}
|
318 |
+
|
319 |
+
public static function void($transactionId){
|
320 |
+
$api = new Api\Void();
|
321 |
+
$api->setTransactionId($transactionId);
|
322 |
+
$result = $api->doRequest();
|
323 |
+
return $result['request']['result'] == 1;
|
324 |
+
}
|
325 |
+
}
|
app/code/community/Pay/Payment/vendor/paynl/sdk/src/Validate.php
ADDED
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Copyright (C) 2015 Andy Pieters <andy@andypieters.nl>
|
4 |
+
*
|
5 |
+
* This program is free software: you can redistribute it and/or modify
|
6 |
+
* it under the terms of the GNU General Public License as published by
|
7 |
+
* the Free Software Foundation, either version 3 of the License, or
|
8 |
+
* (at your option) any later version.
|
9 |
+
*
|
10 |
+
* This program is distributed in the hope that it will be useful,
|
11 |
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
+
* GNU General Public License for more details.
|
14 |
+
*
|
15 |
+
* You should have received a copy of the GNU General Public License
|
16 |
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
17 |
+
*/
|
18 |
+
|
19 |
+
namespace Paynl;
|
20 |
+
|
21 |
+
use \Paynl\Api\Validate\IsPayServerIp as Api;
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Description of Paymentmethods
|
25 |
+
*
|
26 |
+
* @author Andy Pieters <andy@andypieters.nl>
|
27 |
+
*/
|
28 |
+
class Validate
|
29 |
+
{
|
30 |
+
public static function isPayServerIp($ipAddress)
|
31 |
+
{
|
32 |
+
$api = new Api();
|
33 |
+
$api->setIpAddress($ipAddress);
|
34 |
+
return $api->doRequest();
|
35 |
+
}
|
36 |
+
}
|
app/code/community/Pay/Payment/vendor/paynl/sdk/src/Voucher.php
ADDED
@@ -0,0 +1,91 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Paynl;
|
4 |
+
|
5 |
+
use Paynl\Api\Voucher as Api;
|
6 |
+
use Paynl\Result\Voucher as Result;
|
7 |
+
|
8 |
+
class Voucher
|
9 |
+
{
|
10 |
+
|
11 |
+
|
12 |
+
/**
|
13 |
+
* Return the voucher
|
14 |
+
*
|
15 |
+
* @param string $cardNumber
|
16 |
+
* @return \Paynl\Result\Voucher\Voucher
|
17 |
+
*/
|
18 |
+
public static function get($cardNumber)
|
19 |
+
{
|
20 |
+
$api = new Api\Balance();
|
21 |
+
$api->setCardNumber($cardNumber);
|
22 |
+
$result = $api->doRequest();
|
23 |
+
return new Result\Voucher($result);
|
24 |
+
}
|
25 |
+
|
26 |
+
/**
|
27 |
+
* Return the voucher
|
28 |
+
*
|
29 |
+
* @param string $cardNumber
|
30 |
+
* @return float the current balance
|
31 |
+
*/
|
32 |
+
public static function balance($options = [])
|
33 |
+
{
|
34 |
+
$api = new Api\Balance();
|
35 |
+
|
36 |
+
if(isset($options['cardNumber'])){
|
37 |
+
$api->setCardNumber($options['cardNumber']);
|
38 |
+
}
|
39 |
+
|
40 |
+
$result = $api->doRequest();
|
41 |
+
return $result['balance'] / 100;
|
42 |
+
|
43 |
+
}
|
44 |
+
|
45 |
+
/**
|
46 |
+
* Charge a voucher
|
47 |
+
* @param array $options
|
48 |
+
* @return bool if the charge was done succefully
|
49 |
+
*/
|
50 |
+
public static function charge($options = [])
|
51 |
+
{
|
52 |
+
$api = new Api\Charge();
|
53 |
+
|
54 |
+
if(isset($options['pincode'])){
|
55 |
+
$api->setPincode($options['pincode']);
|
56 |
+
}
|
57 |
+
if(isset($options['cardNumber'])){
|
58 |
+
$api->setCardNumber($options['cardNumber']);
|
59 |
+
}
|
60 |
+
if(isset($options['amount'])){
|
61 |
+
$api->setAmount(round($options['amount'] * 100));
|
62 |
+
}
|
63 |
+
|
64 |
+
$result = $api->doRequest();
|
65 |
+
|
66 |
+
return $result['request']['result'] == 1;
|
67 |
+
|
68 |
+
}
|
69 |
+
|
70 |
+
public static function activate($options = []){
|
71 |
+
$api = new Api\Activate();
|
72 |
+
|
73 |
+
if(isset($options['pincode'])){
|
74 |
+
$api->setPincode($options['pincode']);
|
75 |
+
}
|
76 |
+
if(isset($options['cardNumber'])){
|
77 |
+
$api->setCardNumber($options['cardNumber']);
|
78 |
+
}
|
79 |
+
if(isset($options['amount'])){
|
80 |
+
$api->setAmount(round($options['amount'] * 100));
|
81 |
+
}
|
82 |
+
if(isset($options['posId'])){
|
83 |
+
$api->setPosId($options['posId']);
|
84 |
+
}
|
85 |
+
$result = $api->doRequest();
|
86 |
+
|
87 |
+
return $result['request']['result'] == 1;
|
88 |
+
}
|
89 |
+
|
90 |
+
|
91 |
+
}
|
app/code/community/Pay/Payment/vendor/paynl/sdk/tests/ConfigTest.php
ADDED
@@ -0,0 +1,60 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class ConfigTest extends PHPUnit_Framework_TestCase
|
4 |
+
{
|
5 |
+
public function testCAInfoLocation()
|
6 |
+
{
|
7 |
+
\Paynl\Config::setCAInfoLocation('test/location');
|
8 |
+
|
9 |
+
$this->assertEquals('test/location',
|
10 |
+
\Paynl\Config::getCAInfoLocation());
|
11 |
+
}
|
12 |
+
|
13 |
+
public function testApiToken()
|
14 |
+
{
|
15 |
+
\Paynl\Config::setApiToken('my-api-token');
|
16 |
+
|
17 |
+
$this->assertEquals('my-api-token', \Paynl\Config::getApiToken());
|
18 |
+
}
|
19 |
+
|
20 |
+
public function testServiceId()
|
21 |
+
{
|
22 |
+
\Paynl\Config::setServiceId('my-service-id');
|
23 |
+
|
24 |
+
$this->assertEquals('my-service-id', \Paynl\Config::getServiceId());
|
25 |
+
}
|
26 |
+
|
27 |
+
public function testApiVersion()
|
28 |
+
{
|
29 |
+
\Paynl\Config::setApiVersion(4);
|
30 |
+
|
31 |
+
$this->assertEquals(4, \Paynl\Config::getApiVersion());
|
32 |
+
}
|
33 |
+
|
34 |
+
public function testApiUrl()
|
35 |
+
{
|
36 |
+
\Paynl\Config::setApiVersion(4);
|
37 |
+
|
38 |
+
$this->assertEquals(
|
39 |
+
'https://rest-api.pay.nl/v4/transaction/json',
|
40 |
+
\Paynl\Config::getApiUrl('transaction')
|
41 |
+
);
|
42 |
+
\Paynl\Config::setApiBase('https://alternative-api.com');
|
43 |
+
|
44 |
+
$this->assertEquals(
|
45 |
+
'https://alternative-api.com/v4/transaction/json',
|
46 |
+
\Paynl\Config::getApiUrl('transaction')
|
47 |
+
);
|
48 |
+
}
|
49 |
+
public function testGetCurlDefault(){
|
50 |
+
$this->assertInstanceOf('\Curl\Curl', \Paynl\Config::getCurl());
|
51 |
+
}
|
52 |
+
public function testGetCurlCustom(){
|
53 |
+
\Paynl\Config::setCurl(new \Paynl\Curl\Dummy());
|
54 |
+
$this->assertInstanceOf('\Paynl\Curl\Dummy', \Paynl\Config::getCurl());
|
55 |
+
}
|
56 |
+
public function testGetCurlCustomString(){
|
57 |
+
\Paynl\Config::setCurl('\Paynl\Curl\Dummy');
|
58 |
+
$this->assertInstanceOf('\Paynl\Curl\Dummy', \Paynl\Config::getCurl());
|
59 |
+
}
|
60 |
+
}
|
app/code/community/Pay/Payment/vendor/paynl/sdk/tests/CurrencyTest.php
ADDED
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Created by PhpStorm.
|
5 |
+
* User: andy
|
6 |
+
* Date: 13-10-16
|
7 |
+
* Time: 12:34
|
8 |
+
*/
|
9 |
+
class CurrencyTest extends PHPUnit_Framework_TestCase
|
10 |
+
{
|
11 |
+
private $testApiResult;
|
12 |
+
|
13 |
+
|
14 |
+
private function setDummyData(){
|
15 |
+
$this->testApiResult = file_get_contents(dirname(__FILE__).'/dummyData/currencies.json');
|
16 |
+
|
17 |
+
$curl = new \Paynl\Curl\Dummy();
|
18 |
+
$curl->setResult($this->testApiResult);
|
19 |
+
\Paynl\Config::setCurl($curl);
|
20 |
+
}
|
21 |
+
|
22 |
+
|
23 |
+
public function testGetCurrencies(){
|
24 |
+
\Paynl\Config::setApiToken('1234567894561234567');
|
25 |
+
$this->setDummyData();
|
26 |
+
|
27 |
+
$currencies = \Paynl\Currency::getAll();
|
28 |
+
|
29 |
+
$this->assertInternalType('array', $currencies);
|
30 |
+
}
|
31 |
+
public function testGetCurrencyId(){
|
32 |
+
\Paynl\Config::setApiToken('1234567894561234567');
|
33 |
+
$this->setDummyData();
|
34 |
+
$currencyId = \Paynl\Currency::getCurrencyId('EUR');
|
35 |
+
|
36 |
+
$this->assertEquals(1, $currencyId);
|
37 |
+
}
|
38 |
+
|
39 |
+
public function testNotFound(){
|
40 |
+
\Paynl\Config::setApiToken('1234567894561234567');
|
41 |
+
$this->setDummyData();
|
42 |
+
|
43 |
+
$this->setExpectedException('\Paynl\Error\NotFound');
|
44 |
+
|
45 |
+
\Paynl\Currency::getCurrencyId('ZZZ');
|
46 |
+
}
|
47 |
+
}
|
app/code/community/Pay/Payment/vendor/paynl/sdk/tests/HelperTest.php
ADDED
@@ -0,0 +1,77 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class HelperTest extends PHPUnit_Framework_TestCase
|
4 |
+
{
|
5 |
+
public function testRequireApiTokenException()
|
6 |
+
{
|
7 |
+
$this->setExpectedException('\Paynl\Error\Required\ApiToken');
|
8 |
+
|
9 |
+
\Paynl\Config::setApiToken('');
|
10 |
+
\Paynl\Helper::requireApiToken();
|
11 |
+
}
|
12 |
+
|
13 |
+
public function testRequireServiceIdException()
|
14 |
+
{
|
15 |
+
$this->setExpectedException('\Paynl\Error\Required\ServiceId');
|
16 |
+
|
17 |
+
\Paynl\Config::setServiceId('');
|
18 |
+
\Paynl\Helper::requireServiceId();
|
19 |
+
}
|
20 |
+
|
21 |
+
public function testCalculateTaxClassN()
|
22 |
+
{
|
23 |
+
$calculatedTaxClass = \Paynl\Helper::calculateTaxClass(10, 0);
|
24 |
+
$this->assertEquals('N', $calculatedTaxClass);
|
25 |
+
}
|
26 |
+
|
27 |
+
public function testCalculateTaxClassL()
|
28 |
+
{
|
29 |
+
$calculatedTaxClass = \Paynl\Helper::calculateTaxClass(10, 0.5);
|
30 |
+
$this->assertEquals('L', $calculatedTaxClass);
|
31 |
+
}
|
32 |
+
|
33 |
+
public function testCalculateTaxClassH()
|
34 |
+
{
|
35 |
+
$calculatedTaxClass = \Paynl\Helper::calculateTaxClass(10, 1.74);
|
36 |
+
$this->assertEquals('H', $calculatedTaxClass);
|
37 |
+
}
|
38 |
+
|
39 |
+
public function testSplitAddress()
|
40 |
+
{
|
41 |
+
// @todo Straatnamen met een nummer er in bijvoorbeeld: Boulevard 1945
|
42 |
+
$addresses = array(
|
43 |
+
array('Voorstraat 2', 'Voorstraat', '2'),
|
44 |
+
array('Kopersteden 10', 'Kopersteden', '10'),
|
45 |
+
array('Kopersteden 10A', 'Kopersteden', '10A'),
|
46 |
+
array('Kopersteden 10 A', 'Kopersteden', '10 A'),
|
47 |
+
array('Kopersteden 10-A', 'Kopersteden', '10-A'),
|
48 |
+
array('25 American street', 'American street', '25'),
|
49 |
+
array('1e Wereldoorlogweg 12', '1e Wereldoorlogweg', '12'),
|
50 |
+
array('Lang huisnummer 1234567890', 'Lang huisnummer', '1234567890'),
|
51 |
+
array('2e Bothofdwarsstraat 2-44', '2e Bothofdwarsstraat', '2-44'),
|
52 |
+
array('Straat 145-Boven', 'Straat', '145-Boven'),
|
53 |
+
array('Appartementenweg 12-786', 'Appartementenweg', '12-786'),
|
54 |
+
array('Appartementenweg 3 hoog achter', 'Appartementenweg', '3 hoog achter'),
|
55 |
+
array('driesplein 22/2', 'driesplein', '22/2'),
|
56 |
+
);
|
57 |
+
|
58 |
+
foreach($addresses as $address){
|
59 |
+
$arrAddress = \Paynl\Helper::splitAddress($address[0]);
|
60 |
+
|
61 |
+
$this->assertEquals(array(
|
62 |
+
$address[1],
|
63 |
+
$address[2]
|
64 |
+
), $arrAddress);
|
65 |
+
}
|
66 |
+
|
67 |
+
}
|
68 |
+
public function testObjectToArray()
|
69 |
+
{
|
70 |
+
$object = (object)array('a' => '1', 'b' => '2', 'c' => '3', 'd' => '4');
|
71 |
+
$array = \Paynl\Helper::objectToArray($object);
|
72 |
+
|
73 |
+
$this->assertInternalType('array', $array);
|
74 |
+
}
|
75 |
+
|
76 |
+
|
77 |
+
}
|
app/code/community/Pay/Payment/vendor/paynl/sdk/tests/PaymentmethodsTest.php
ADDED
@@ -0,0 +1,125 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Created by PhpStorm.
|
5 |
+
* User: andy
|
6 |
+
* Date: 15-4-2016
|
7 |
+
* Time: 16:22
|
8 |
+
*/
|
9 |
+
class PaymentmethodsTest extends PHPUnit_Framework_TestCase
|
10 |
+
{
|
11 |
+
private $testApiResult;
|
12 |
+
|
13 |
+
|
14 |
+
private function setDummyData(){
|
15 |
+
$this->testApiResult = file_get_contents(dirname(__FILE__).'/dummyData/getService.json');
|
16 |
+
|
17 |
+
$curl = new \Paynl\Curl\Dummy();
|
18 |
+
$curl->setResult($this->testApiResult);
|
19 |
+
\Paynl\Config::setCurl($curl);
|
20 |
+
}
|
21 |
+
|
22 |
+
public function testGetPaymentMethodsNoServiceId(){
|
23 |
+
$this->setDummyData();
|
24 |
+
\Paynl\Config::setApiToken('123456789012345678901234567890');
|
25 |
+
\Paynl\Config::setServiceId('');
|
26 |
+
$this->setExpectedException('\Paynl\Error\Required\ServiceId');
|
27 |
+
\Paynl\Paymentmethods::getList();
|
28 |
+
|
29 |
+
}
|
30 |
+
public function testGetPaymentMethodsNoToken(){
|
31 |
+
$this->setDummyData();
|
32 |
+
\Paynl\Config::setApiToken('');
|
33 |
+
\Paynl\Config::setServiceId('SL-1234-5678');
|
34 |
+
$this->setExpectedException('\Paynl\Error\Required\Apitoken');
|
35 |
+
\Paynl\Paymentmethods::getList();
|
36 |
+
}
|
37 |
+
public function testGetPaymentMethods(){
|
38 |
+
$this->setDummyData();
|
39 |
+
|
40 |
+
\Paynl\Config::setServiceId('SL-1234-5678');
|
41 |
+
\Paynl\Config::setApiToken('123456789012345678901234567890');
|
42 |
+
|
43 |
+
$list = \Paynl\Paymentmethods::getList();
|
44 |
+
|
45 |
+
$this->assertInternalType('array',$list);
|
46 |
+
|
47 |
+
foreach($list as $paymentMethod){
|
48 |
+
$this->assertArrayHasKey('id', $paymentMethod);
|
49 |
+
$this->assertArrayHasKey('name', $paymentMethod);
|
50 |
+
$this->assertArrayHasKey('visibleName', $paymentMethod);
|
51 |
+
}
|
52 |
+
}
|
53 |
+
public function testGetPaymentMethodsCountry(){
|
54 |
+
$this->setDummyData();
|
55 |
+
|
56 |
+
\Paynl\Config::setServiceId('SL-1234-5678');
|
57 |
+
\Paynl\Config::setApiToken('123456789012345678901234567890');
|
58 |
+
|
59 |
+
$list = \Paynl\Paymentmethods::getList(array('country' => 'NL'));
|
60 |
+
|
61 |
+
$this->assertInternalType('array',$list);
|
62 |
+
|
63 |
+
foreach($list as $paymentMethod){
|
64 |
+
$this->assertArrayHasKey('id', $paymentMethod);
|
65 |
+
$this->assertArrayHasKey('name', $paymentMethod);
|
66 |
+
$this->assertArrayHasKey('visibleName', $paymentMethod);
|
67 |
+
$this->assertTrue(in_array('ALL',$paymentMethod['countries']) ||
|
68 |
+
in_array('NL',$paymentMethod['countries']),
|
69 |
+
'Returned paymentMethod invalid for this country');
|
70 |
+
}
|
71 |
+
}
|
72 |
+
|
73 |
+
public function testGetBanksNoToken(){
|
74 |
+
$this->setExpectedException('\Paynl\Error\Required\Apitoken');
|
75 |
+
$this->setDummyData();
|
76 |
+
|
77 |
+
\Paynl\Config::setServiceId('SL-1234-5678');
|
78 |
+
\Paynl\Config::setApiToken('');
|
79 |
+
|
80 |
+
\Paynl\Paymentmethods::getBanks();
|
81 |
+
}
|
82 |
+
|
83 |
+
public function testGetBanksNoServiceId(){
|
84 |
+
$this->setExpectedException('\Paynl\Error\Required\ServiceId');
|
85 |
+
$this->setDummyData();
|
86 |
+
|
87 |
+
\Paynl\Config::setServiceId('');
|
88 |
+
\Paynl\Config::setApiToken('123456789012345678901234567890');
|
89 |
+
|
90 |
+
\Paynl\Paymentmethods::getBanks();
|
91 |
+
}
|
92 |
+
|
93 |
+
public function testGetBanks(){
|
94 |
+
$this->setDummyData();
|
95 |
+
|
96 |
+
\Paynl\Config::setServiceId('SL-1234-5678');
|
97 |
+
\Paynl\Config::setApiToken('123456789012345678901234567890');
|
98 |
+
|
99 |
+
$banks = \Paynl\Paymentmethods::getBanks();
|
100 |
+
|
101 |
+
$this->assertInternalType('array',$banks);
|
102 |
+
|
103 |
+
foreach($banks as $bank){
|
104 |
+
$this->assertArrayHasKey('id', $bank);
|
105 |
+
$this->assertArrayHasKey('name', $bank);
|
106 |
+
$this->assertArrayHasKey('visibleName', $bank);
|
107 |
+
}
|
108 |
+
}
|
109 |
+
public function testGetBanksInvalidPaymentMethod(){
|
110 |
+
$this->setDummyData();
|
111 |
+
|
112 |
+
\Paynl\Config::setServiceId('SL-1234-5678');
|
113 |
+
\Paynl\Config::setApiToken('123456789012345678901234567890');
|
114 |
+
|
115 |
+
$banks = \Paynl\Paymentmethods::getBanks(12345);//Non existent paymentmethod
|
116 |
+
|
117 |
+
$this->assertInternalType('array',$banks);
|
118 |
+
|
119 |
+
foreach($banks as $bank){
|
120 |
+
$this->assertArrayHasKey('id', $bank);
|
121 |
+
$this->assertArrayHasKey('name', $bank);
|
122 |
+
$this->assertArrayHasKey('visibleName', $bank);
|
123 |
+
}
|
124 |
+
}
|
125 |
+
}
|
app/code/community/Pay/Payment/vendor/paynl/sdk/tests/RefundTest.php
ADDED
@@ -0,0 +1,65 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Created by PhpStorm.
|
5 |
+
* User: andy
|
6 |
+
* Date: 12-10-16
|
7 |
+
* Time: 18:07
|
8 |
+
*/
|
9 |
+
class RefundTest extends PHPUnit_Framework_TestCase
|
10 |
+
{
|
11 |
+
private $testApiResult;
|
12 |
+
|
13 |
+
private function setDummyData($name)
|
14 |
+
{
|
15 |
+
$this->testApiResult = file_get_contents(dirname(__FILE__) . '/dummyData/Refund/' . $name . '.json');
|
16 |
+
$curl = new \Paynl\Curl\Dummy();
|
17 |
+
$curl->setResult($this->testApiResult);
|
18 |
+
\Paynl\Config::setCurl($curl);
|
19 |
+
}
|
20 |
+
private function refundAddFull(){
|
21 |
+
return \Paynl\Refund::add(array(
|
22 |
+
'amount' => 1,
|
23 |
+
'bankAccountHolder' => 'N Klant',
|
24 |
+
'bankAccountNumber' => '123456789',
|
25 |
+
'bankAccountBic' => '123456789',
|
26 |
+
'description' => 'description',
|
27 |
+
'promotorId' => '1',
|
28 |
+
'info' => '1',
|
29 |
+
'tool' => '1',
|
30 |
+
'object' => '1',
|
31 |
+
'extra1' => '1',
|
32 |
+
'extra2' => '1',
|
33 |
+
'extra3' => '1',
|
34 |
+
'orderId' => '1',
|
35 |
+
'currency' => '1',
|
36 |
+
'processDate' => '12-12-2017',
|
37 |
+
));
|
38 |
+
}
|
39 |
+
public function testRefundAddNoServiceId(){
|
40 |
+
$this->setDummyData('refund');
|
41 |
+
$this->setExpectedException('\Paynl\Error\Required\ServiceId');
|
42 |
+
|
43 |
+
\Paynl\Config::setApiToken('123456789012345678901234567890');
|
44 |
+
\Paynl\Config::setServiceId('');
|
45 |
+
|
46 |
+
$this->refundAddFull();
|
47 |
+
}
|
48 |
+
public function testRefundAddNoToken(){
|
49 |
+
$this->setDummyData('refund');
|
50 |
+
$this->setExpectedException('\Paynl\Error\Required\ApiToken');
|
51 |
+
|
52 |
+
\Paynl\Config::setApiToken('');
|
53 |
+
\Paynl\Config::setServiceId('SL-1234-5678');
|
54 |
+
|
55 |
+
$this->refundAddFull();
|
56 |
+
}
|
57 |
+
public function testRefundAdd(){
|
58 |
+
$this->setDummyData('refund');
|
59 |
+
\Paynl\Config::setApiToken('123456789012345678901234567890');
|
60 |
+
\Paynl\Config::setServiceId('SL-1234-5678');
|
61 |
+
$result = $this->refundAddFull();
|
62 |
+
$this->assertInstanceOf('\Paynl\Result\Refund\Add', $result);
|
63 |
+
$this->assertStringStartsWith('RF-',$result->getRefundId());
|
64 |
+
}
|
65 |
+
}
|
app/code/community/Pay/Payment/vendor/paynl/sdk/tests/TransactionTest.php
ADDED
@@ -0,0 +1,310 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Created by PhpStorm.
|
5 |
+
* User: andy
|
6 |
+
* Date: 20-4-2016
|
7 |
+
* Time: 14:06
|
8 |
+
*/
|
9 |
+
class TransactionTest extends PHPUnit_Framework_TestCase
|
10 |
+
{
|
11 |
+
private $testApiResult;
|
12 |
+
|
13 |
+
private function setDummyData($name)
|
14 |
+
{
|
15 |
+
$this->testApiResult = file_get_contents(dirname(__FILE__) . '/dummyData/Transaction/' . $name . '.json');
|
16 |
+
$curl = new \Paynl\Curl\Dummy();
|
17 |
+
$curl->setResult($this->testApiResult);
|
18 |
+
\Paynl\Config::setCurl($curl);
|
19 |
+
}
|
20 |
+
|
21 |
+
/**
|
22 |
+
* Start a transaction with all options
|
23 |
+
*
|
24 |
+
* @return \Paynl\Result\Transaction\Start
|
25 |
+
*/
|
26 |
+
private function startTransactionFull()
|
27 |
+
{
|
28 |
+
$this->setDummyData('startOk');
|
29 |
+
$result = \Paynl\Transaction::start(array(
|
30 |
+
// required
|
31 |
+
'amount' => 10,
|
32 |
+
'returnUrl' => '/return.php',
|
33 |
+
|
34 |
+
// optional
|
35 |
+
'exchangeUrl' => '/exchange.php',
|
36 |
+
'paymentMethod' => 10,
|
37 |
+
'currency' => 'EUR',
|
38 |
+
'expireDate' => 'tomorrow',
|
39 |
+
'bank' => 1,
|
40 |
+
'description' => '123456',
|
41 |
+
'testmode' => 1,
|
42 |
+
'extra1' => 'ext1',
|
43 |
+
'extra2' => 'ext2',
|
44 |
+
'extra3' => 'ext3',
|
45 |
+
'ipaddress' => '123.123.123.123',
|
46 |
+
'invoiceDate' => 'now',
|
47 |
+
'transferType' => 'transaction',
|
48 |
+
'transferValue' => '123441x12341',
|
49 |
+
'deliveryDate' => 'tomorrow', // in case of tickets for an event, use the event date here
|
50 |
+
'products' => array(
|
51 |
+
array(
|
52 |
+
'id' => 1,
|
53 |
+
'name' => 'een product',
|
54 |
+
'price' => 5,
|
55 |
+
'tax' => 0.87,
|
56 |
+
'qty' => 1,
|
57 |
+
),
|
58 |
+
array(
|
59 |
+
'id' => 2,
|
60 |
+
'name' => 'ander product',
|
61 |
+
'price' => 5,
|
62 |
+
'tax' => 0.87,
|
63 |
+
'qty' => 1,
|
64 |
+
)
|
65 |
+
),
|
66 |
+
'language' => 'EN',
|
67 |
+
'enduser' => array(
|
68 |
+
'initials' => 'T',
|
69 |
+
'lastName' => 'Test',
|
70 |
+
'gender' => 'M',
|
71 |
+
'birthDate' => '14-05-1999',
|
72 |
+
'phoneNumber' => '0612345678',
|
73 |
+
'emailAddress' => 'test@test.nl',
|
74 |
+
),
|
75 |
+
'address' => array(
|
76 |
+
'streetName' => 'Test',
|
77 |
+
'houseNumber' => '10',
|
78 |
+
'zipCode' => '1234AB',
|
79 |
+
'city' => 'Test',
|
80 |
+
'country' => 'NL',
|
81 |
+
),
|
82 |
+
'invoiceAddress' => array(
|
83 |
+
'initials' => 'IT',
|
84 |
+
'lastName' => 'ITEST',
|
85 |
+
'streetName' => 'Istreet',
|
86 |
+
'houseNumber' => '70',
|
87 |
+
'zipCode' => '5678CD',
|
88 |
+
'city' => 'ITest',
|
89 |
+
'country' => 'NL',
|
90 |
+
'gender' => 'F'
|
91 |
+
),
|
92 |
+
));
|
93 |
+
return $result;
|
94 |
+
}
|
95 |
+
|
96 |
+
public function testStartNoToken()
|
97 |
+
{
|
98 |
+
$this->setExpectedException('\Paynl\Error\Required\ApiToken');
|
99 |
+
|
100 |
+
\Paynl\Config::setApiToken('');
|
101 |
+
\Paynl\Config::setServiceId('SL-1234-5678');
|
102 |
+
|
103 |
+
$this->startTransactionFull();
|
104 |
+
}
|
105 |
+
|
106 |
+
public function testStartNoServiceId()
|
107 |
+
{
|
108 |
+
$this->setExpectedException('\Paynl\Error\Required\ServiceId');
|
109 |
+
|
110 |
+
\Paynl\Config::setApiToken('123456789012345678901234567890');
|
111 |
+
\Paynl\Config::setServiceId('');
|
112 |
+
|
113 |
+
$this->startTransactionFull();
|
114 |
+
}
|
115 |
+
|
116 |
+
public function testStartNoAmount()
|
117 |
+
{
|
118 |
+
$this->setExpectedException('\Paynl\Error\Required');
|
119 |
+
$this->setDummyData('startOk');
|
120 |
+
\Paynl\Config::setApiToken('123456789012345678901234567890');
|
121 |
+
\Paynl\Config::setServiceId('SL-1234-5678');
|
122 |
+
|
123 |
+
\Paynl\Transaction::start(array(
|
124 |
+
'returnUrl' => '/return.php',
|
125 |
+
'ipaddress' => '127.0.0.1',
|
126 |
+
));
|
127 |
+
}
|
128 |
+
|
129 |
+
public function testStartNoReturn()
|
130 |
+
{
|
131 |
+
$this->setExpectedException('\Paynl\Error\Required');
|
132 |
+
$this->setDummyData('startOk');
|
133 |
+
\Paynl\Config::setApiToken('123456789012345678901234567890');
|
134 |
+
\Paynl\Config::setServiceId('SL-1234-5678');
|
135 |
+
|
136 |
+
\Paynl\Transaction::start(array(
|
137 |
+
'amount' => 10,
|
138 |
+
'ipaddress' => '127.0.0.1',
|
139 |
+
));
|
140 |
+
}
|
141 |
+
|
142 |
+
public function testStartMinumumOk()
|
143 |
+
{
|
144 |
+
\Paynl\Config::setApiToken('123456789012345678901234567890');
|
145 |
+
\Paynl\Config::setServiceId('SL-1234-5678');
|
146 |
+
|
147 |
+
$this->setDummyData('startOk');
|
148 |
+
$result = \Paynl\Transaction::start(array(
|
149 |
+
'amount' => 10,
|
150 |
+
'returnUrl' => '/return.php',
|
151 |
+
'ipaddress' => '127.0.0.1',
|
152 |
+
));
|
153 |
+
|
154 |
+
$this->validateStartResult($result);
|
155 |
+
}
|
156 |
+
|
157 |
+
private function validateStartResult($result)
|
158 |
+
{
|
159 |
+
$this->assertInstanceOf('\Paynl\Result\Transaction\Start', $result);
|
160 |
+
|
161 |
+
/**
|
162 |
+
* @var $result \Paynl\Result\Transaction\Start
|
163 |
+
*/
|
164 |
+
|
165 |
+
$this->assertNotEmpty($result->getTransactionId(), 'Could not get the transactionId');
|
166 |
+
$this->assertNotEmpty($result->getPaymentReference(), 'Could not get the PaymentReference');
|
167 |
+
$this->assertNotEmpty($result->getRedirectUrl(), 'Could not get the redirectUrl');
|
168 |
+
}
|
169 |
+
|
170 |
+
public function testStartFullOk()
|
171 |
+
{
|
172 |
+
\Paynl\Config::setApiToken('123456789012345678901234567890');
|
173 |
+
\Paynl\Config::setServiceId('SL-1234-5678');
|
174 |
+
|
175 |
+
$result = $this->startTransactionFull();
|
176 |
+
|
177 |
+
$this->validateStartResult($result);
|
178 |
+
}
|
179 |
+
|
180 |
+
public function testGetTransactionPaid()
|
181 |
+
{
|
182 |
+
\Paynl\Config::setApiToken('123456789012345678901234567890');
|
183 |
+
|
184 |
+
$this->setDummyData('Result/transactionPaid');
|
185 |
+
|
186 |
+
$transaction = Paynl\Transaction::get('645958819Xdd3ea1');
|
187 |
+
|
188 |
+
$this->assertInstanceOf('\Paynl\Result\Transaction\Transaction', $transaction);
|
189 |
+
|
190 |
+
}
|
191 |
+
|
192 |
+
public function testGetForReturn()
|
193 |
+
{
|
194 |
+
\Paynl\Config::setApiToken('123456789012345678901234567890');
|
195 |
+
|
196 |
+
$this->setDummyData('Result/transactionPaid');
|
197 |
+
|
198 |
+
$_GET['orderId'] = "645958819Xdd3ea1";
|
199 |
+
|
200 |
+
$transaction = Paynl\Transaction::getForReturn();
|
201 |
+
$this->assertInstanceOf('\Paynl\Result\Transaction\Transaction', $transaction);
|
202 |
+
}
|
203 |
+
|
204 |
+
public function testGetForExchange()
|
205 |
+
{
|
206 |
+
\Paynl\Config::setApiToken('123456789012345678901234567890');
|
207 |
+
|
208 |
+
$this->setDummyData('Result/transactionPaid');
|
209 |
+
|
210 |
+
$_GET['order_id'] = "645958819Xdd3ea1";
|
211 |
+
|
212 |
+
$transaction = Paynl\Transaction::getForExchange();
|
213 |
+
$this->assertInstanceOf('\Paynl\Result\Transaction\Transaction', $transaction);
|
214 |
+
}
|
215 |
+
|
216 |
+
public function testGetForExchangePost()
|
217 |
+
{
|
218 |
+
\Paynl\Config::setApiToken('123456789012345678901234567890');
|
219 |
+
|
220 |
+
$this->setDummyData('Result/transactionPaid');
|
221 |
+
|
222 |
+
unset($_GET['order_id']);
|
223 |
+
|
224 |
+
$_POST['order_id'] = "645958819Xdd3ea1";
|
225 |
+
|
226 |
+
$transaction = Paynl\Transaction::getForExchange();
|
227 |
+
$this->assertInstanceOf('\Paynl\Result\Transaction\Transaction', $transaction);
|
228 |
+
}
|
229 |
+
|
230 |
+
public function testRefund()
|
231 |
+
{
|
232 |
+
\Paynl\Config::setApiToken('123456789012345678901234567890');
|
233 |
+
|
234 |
+
$this->setDummyData('Result/refund');
|
235 |
+
$refund = \Paynl\Transaction::refund('645958819Xdd3ea1', 5);
|
236 |
+
|
237 |
+
$this->assertInstanceOf('Paynl\Result\Transaction\Refund', $refund);
|
238 |
+
$this->assertStringStartsWith('RF-', $refund->getRefundId());
|
239 |
+
}
|
240 |
+
|
241 |
+
public function testRefundError()
|
242 |
+
{
|
243 |
+
\Paynl\Config::setApiToken('123456789012345678901234567890');
|
244 |
+
|
245 |
+
$this->setExpectedException('\Paynl\Error\Api');
|
246 |
+
|
247 |
+
$this->setDummyData('Result/refundError');
|
248 |
+
\Paynl\Transaction::refund('645958819Xdd3ea1', 5, 'Description');
|
249 |
+
}
|
250 |
+
public function testApprove(){
|
251 |
+
\Paynl\Config::setApiToken('123456789012345678901234567890');
|
252 |
+
|
253 |
+
$this->setDummyData('Result/transactionVerify');
|
254 |
+
|
255 |
+
$transaction = Paynl\Transaction::get('12456789');
|
256 |
+
|
257 |
+
$this->setDummyData('Result/approve');
|
258 |
+
$result = $transaction->approve();
|
259 |
+
|
260 |
+
$this->assertEquals(true, $result);
|
261 |
+
}
|
262 |
+
public function testApprovePaidTransaction(){
|
263 |
+
\Paynl\Config::setApiToken('123456789012345678901234567890');
|
264 |
+
|
265 |
+
$this->setDummyData('Result/transactionPaid');
|
266 |
+
|
267 |
+
$transaction = Paynl\Transaction::get('12456789');
|
268 |
+
|
269 |
+
$this->setDummyData('Result/approve');
|
270 |
+
$this->setExpectedException('\Paynl\Error\Error');
|
271 |
+
$transaction->approve();
|
272 |
+
}
|
273 |
+
public function testDecline(){
|
274 |
+
\Paynl\Config::setApiToken('123456789012345678901234567890');
|
275 |
+
|
276 |
+
$this->setDummyData('Result/transactionVerify');
|
277 |
+
|
278 |
+
$transaction = Paynl\Transaction::get('12456789');
|
279 |
+
|
280 |
+
$this->setDummyData('Result/decline');
|
281 |
+
$result = $transaction->decline();
|
282 |
+
|
283 |
+
$this->assertEquals(true, $result);
|
284 |
+
}
|
285 |
+
public function testDeclinePaidTransaction(){
|
286 |
+
\Paynl\Config::setApiToken('123456789012345678901234567890');
|
287 |
+
|
288 |
+
$this->setDummyData('Result/transactionPaid');
|
289 |
+
|
290 |
+
$transaction = Paynl\Transaction::get('12456789');
|
291 |
+
|
292 |
+
$this->setDummyData('Result/decline');
|
293 |
+
$this->setExpectedException('\Paynl\Error\Error');
|
294 |
+
$transaction->decline();
|
295 |
+
}
|
296 |
+
public function testApproveWithoutTransactionId(){
|
297 |
+
\Paynl\Config::setApiToken('123456789012345678901234567890');
|
298 |
+
|
299 |
+
$this->setExpectedException('\Paynl\Error\Required');
|
300 |
+
|
301 |
+
\Paynl\Transaction::approve('');
|
302 |
+
}
|
303 |
+
public function testDeclineWithoutTransactionId(){
|
304 |
+
\Paynl\Config::setApiToken('123456789012345678901234567890');
|
305 |
+
|
306 |
+
$this->setExpectedException('\Paynl\Error\Required');
|
307 |
+
|
308 |
+
\Paynl\Transaction::decline('');
|
309 |
+
}
|
310 |
+
}
|
app/code/community/Pay/Payment/vendor/paynl/sdk/tests/ValidateTest.php
ADDED
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Created by PhpStorm.
|
5 |
+
* User: andy
|
6 |
+
* Date: 26-4-16
|
7 |
+
* Time: 19:30
|
8 |
+
*/
|
9 |
+
class ValidateTest extends PHPUnit_Framework_TestCase
|
10 |
+
{
|
11 |
+
private $testApiResult;
|
12 |
+
|
13 |
+
private function setDummyData($name){
|
14 |
+
$this->testApiResult = file_get_contents(dirname(__FILE__).'/dummyData/Validate/'.$name.'.json');
|
15 |
+
$curl = new \Paynl\Curl\Dummy();
|
16 |
+
$curl->setResult($this->testApiResult);
|
17 |
+
\Paynl\Config::setCurl($curl);
|
18 |
+
}
|
19 |
+
|
20 |
+
public function testIsPayServerIpYes(){
|
21 |
+
$this->setDummyData('isPayServerIpYes');
|
22 |
+
$result = \Paynl\Validate::isPayServerIp('37.46.137.137');
|
23 |
+
|
24 |
+
$this->assertEquals(true, $result);
|
25 |
+
}
|
26 |
+
public function testIsPayServerIpNo(){
|
27 |
+
$this->setDummyData('isPayServerIpNo');
|
28 |
+
|
29 |
+
$result = \Paynl\Validate::isPayServerIp('192.168.20.1');
|
30 |
+
|
31 |
+
$this->assertEquals(false, $result);
|
32 |
+
}
|
33 |
+
}
|
app/code/community/Pay/Payment/vendor/paynl/sdk/tests/dummyData/Refund/refund.json
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"request": {
|
3 |
+
"result": "1"
|
4 |
+
},
|
5 |
+
"refundId": "RF-1234-1234"
|
6 |
+
}
|
app/code/community/Pay/Payment/vendor/paynl/sdk/tests/dummyData/Refund/refundError.json
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"request": {
|
3 |
+
"result": "0",
|
4 |
+
"errorId": "1",
|
5 |
+
"errorMessage": "You do not have enough credit to refund this amount."
|
6 |
+
},
|
7 |
+
"refundId": ""
|
8 |
+
}
|
app/code/community/Pay/Payment/vendor/paynl/sdk/tests/dummyData/Transaction/Result/approve.json
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"request": {
|
3 |
+
"result": "1"
|
4 |
+
}
|
5 |
+
}
|
app/code/community/Pay/Payment/vendor/paynl/sdk/tests/dummyData/Transaction/Result/decline.json
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"request": {
|
3 |
+
"result": "1"
|
4 |
+
}
|
5 |
+
}
|
app/code/community/Pay/Payment/vendor/paynl/sdk/tests/dummyData/Transaction/Result/refund.json
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"request": {
|
3 |
+
"result": "1"
|
4 |
+
},
|
5 |
+
"refundId": "RF-1234-1234"
|
6 |
+
}
|
app/code/community/Pay/Payment/vendor/paynl/sdk/tests/dummyData/Transaction/Result/refundError.json
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"request": {
|
3 |
+
"result": "0",
|
4 |
+
"errorId": "1",
|
5 |
+
"errorMessage": "You do not have enough credit to refund this amount."
|
6 |
+
},
|
7 |
+
"refundId": ""
|
8 |
+
}
|
app/code/community/Pay/Payment/vendor/paynl/sdk/tests/dummyData/Transaction/Result/transactionPaid.json
ADDED
@@ -0,0 +1,133 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"request": {
|
3 |
+
"result": "1",
|
4 |
+
"errorId": "",
|
5 |
+
"errorMessage": ""
|
6 |
+
},
|
7 |
+
"connection": {
|
8 |
+
"trust": "10",
|
9 |
+
"country": "NL",
|
10 |
+
"city": "Zwolle",
|
11 |
+
"locationLat": "52.505798339844",
|
12 |
+
"locationLon": "6.0858001708984",
|
13 |
+
"browserData": "",
|
14 |
+
"ipAddress": "213.126.82.230",
|
15 |
+
"countryName": "Netherlands",
|
16 |
+
"blacklist": "0",
|
17 |
+
"host": "D57E52E6.static.ziggozakelijk.nl",
|
18 |
+
"orderIpAddress": "213.126.82.230",
|
19 |
+
"orderReturnURL": "http:\/\/c80fde59.ngrok.io\/pay_payment\/order\/return\/",
|
20 |
+
"merchantCode": "M-3421-2120",
|
21 |
+
"merchantName": "Classic Carparts"
|
22 |
+
},
|
23 |
+
"enduser": {
|
24 |
+
"gender": "0",
|
25 |
+
"emailAddress": "andy@pay.nl",
|
26 |
+
"initials": "A",
|
27 |
+
"lastName": "Pieters",
|
28 |
+
"phoneNumber": "0612345678",
|
29 |
+
"address": {
|
30 |
+
"streetName": "Kopersteden",
|
31 |
+
"streetNumber": "10",
|
32 |
+
"zipCode": "7547 TK",
|
33 |
+
"city": "Enschede",
|
34 |
+
"countryCode": "NL"
|
35 |
+
},
|
36 |
+
"invoiceAddress": {
|
37 |
+
"streetName": "Kopersteden",
|
38 |
+
"streetNumber": "10",
|
39 |
+
"zipCode": "7547 TK",
|
40 |
+
"city": "Enschede",
|
41 |
+
"countryCode": "NL",
|
42 |
+
"initials": "A",
|
43 |
+
"lastName": "Pieters",
|
44 |
+
"gender": ""
|
45 |
+
},
|
46 |
+
"language": "nl",
|
47 |
+
"accessCode": "",
|
48 |
+
"dob": "",
|
49 |
+
"bankAccount": "",
|
50 |
+
"iban": "",
|
51 |
+
"bic": "",
|
52 |
+
"sendConfirmMail": "",
|
53 |
+
"confirmMailTemplate": ""
|
54 |
+
},
|
55 |
+
"saleData": {
|
56 |
+
"invoiceDate": "26-04-2016",
|
57 |
+
"deliveryDate": "27-04-2016",
|
58 |
+
"orderData": [
|
59 |
+
{
|
60 |
+
"productId": "608",
|
61 |
+
"description": "Tori Tank",
|
62 |
+
"price": "6000",
|
63 |
+
"quantity": "1",
|
64 |
+
"vatCode": "N"
|
65 |
+
},
|
66 |
+
{
|
67 |
+
"productId": "0",
|
68 |
+
"description": "Verzendkosten",
|
69 |
+
"price": "500",
|
70 |
+
"quantity": "1",
|
71 |
+
"vatCode": "N"
|
72 |
+
}
|
73 |
+
]
|
74 |
+
},
|
75 |
+
"paymentDetails": {
|
76 |
+
"amount": "6500",
|
77 |
+
"currenyAmount": "6500",
|
78 |
+
"paidAmount": "6500",
|
79 |
+
"paidCurrenyAmount": "6500",
|
80 |
+
"paidBase": "6500",
|
81 |
+
"paidCosts": "0",
|
82 |
+
"paidCostsVat": "0",
|
83 |
+
"paidCurrency": "EUR",
|
84 |
+
"paidAttemps": "1",
|
85 |
+
"paidDuration": "0",
|
86 |
+
"description": "145000011",
|
87 |
+
"processTime": "10",
|
88 |
+
"state": "100",
|
89 |
+
"stateName": "PAID",
|
90 |
+
"stateDescription": "Paid",
|
91 |
+
"exchange": "",
|
92 |
+
"storno": "0",
|
93 |
+
"paymentOptionId": "613",
|
94 |
+
"paymentOptionSubId": "0",
|
95 |
+
"secure": "0",
|
96 |
+
"secureStatus": "",
|
97 |
+
"identifierName": "A Pieters",
|
98 |
+
"identifierPublic": "",
|
99 |
+
"identifierHash": "",
|
100 |
+
"customerKey": "11f2365950119362500e06af693e380b",
|
101 |
+
"serviceId": "SL-6712-4510",
|
102 |
+
"serviceName": "Andy",
|
103 |
+
"serviceDescription": "Test voor andys webshops",
|
104 |
+
"created": "2016-04-26 15:34:03",
|
105 |
+
"modified": "2016-04-26 15:34:13",
|
106 |
+
"paymentMethodId": "4",
|
107 |
+
"paymentMethodName": "Transacties ",
|
108 |
+
"paymentMethodDescription": "Pay Per Transaction",
|
109 |
+
"paymentProfileName": "SandBox"
|
110 |
+
},
|
111 |
+
"statsDetails": {
|
112 |
+
"tool": "",
|
113 |
+
"info": "",
|
114 |
+
"object": "",
|
115 |
+
"extra1": "145000011",
|
116 |
+
"extra2": "andy@pay.nl",
|
117 |
+
"extra3": "",
|
118 |
+
"promotorId": "0",
|
119 |
+
"transferData": "",
|
120 |
+
"paymentSessionId": "645958819"
|
121 |
+
},
|
122 |
+
"stornoDetails": {
|
123 |
+
"stornoId": "",
|
124 |
+
"stornoAmount": "",
|
125 |
+
"bankAccount": "",
|
126 |
+
"iban": "",
|
127 |
+
"bic": "",
|
128 |
+
"city": "",
|
129 |
+
"datetime": "",
|
130 |
+
"reason": "",
|
131 |
+
"emailAddress": ""
|
132 |
+
}
|
133 |
+
}
|
app/code/community/Pay/Payment/vendor/paynl/sdk/tests/dummyData/Transaction/Result/transactionVerify.json
ADDED
@@ -0,0 +1,133 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"request": {
|
3 |
+
"result": "1",
|
4 |
+
"errorId": "",
|
5 |
+
"errorMessage": ""
|
6 |
+
},
|
7 |
+
"connection": {
|
8 |
+
"trust": "10",
|
9 |
+
"country": "NL",
|
10 |
+
"city": "Zwolle",
|
11 |
+
"locationLat": "52.505798339844",
|
12 |
+
"locationLon": "6.0858001708984",
|
13 |
+
"browserData": "",
|
14 |
+
"ipAddress": "213.126.82.230",
|
15 |
+
"countryName": "Netherlands",
|
16 |
+
"blacklist": "0",
|
17 |
+
"host": "D57E52E6.static.ziggozakelijk.nl",
|
18 |
+
"orderIpAddress": "213.126.82.230",
|
19 |
+
"orderReturnURL": "http:\/\/c80fde59.ngrok.io\/pay_payment\/order\/return\/",
|
20 |
+
"merchantCode": "M-3421-2120",
|
21 |
+
"merchantName": "Classic Carparts"
|
22 |
+
},
|
23 |
+
"enduser": {
|
24 |
+
"gender": "0",
|
25 |
+
"emailAddress": "andy@pay.nl",
|
26 |
+
"initials": "A",
|
27 |
+
"lastName": "Pieters",
|
28 |
+
"phoneNumber": "0612345678",
|
29 |
+
"address": {
|
30 |
+
"streetName": "Kopersteden",
|
31 |
+
"streetNumber": "10",
|
32 |
+
"zipCode": "7547 TK",
|
33 |
+
"city": "Enschede",
|
34 |
+
"countryCode": "NL"
|
35 |
+
},
|
36 |
+
"invoiceAddress": {
|
37 |
+
"streetName": "Kopersteden",
|
38 |
+
"streetNumber": "10",
|
39 |
+
"zipCode": "7547 TK",
|
40 |
+
"city": "Enschede",
|
41 |
+
"countryCode": "NL",
|
42 |
+
"initials": "A",
|
43 |
+
"lastName": "Pieters",
|
44 |
+
"gender": ""
|
45 |
+
},
|
46 |
+
"language": "nl",
|
47 |
+
"accessCode": "",
|
48 |
+
"dob": "",
|
49 |
+
"bankAccount": "",
|
50 |
+
"iban": "",
|
51 |
+
"bic": "",
|
52 |
+
"sendConfirmMail": "",
|
53 |
+
"confirmMailTemplate": ""
|
54 |
+
},
|
55 |
+
"saleData": {
|
56 |
+
"invoiceDate": "26-04-2016",
|
57 |
+
"deliveryDate": "27-04-2016",
|
58 |
+
"orderData": [
|
59 |
+
{
|
60 |
+
"productId": "608",
|
61 |
+
"description": "Tori Tank",
|
62 |
+
"price": "6000",
|
63 |
+
"quantity": "1",
|
64 |
+
"vatCode": "N"
|
65 |
+
},
|
66 |
+
{
|
67 |
+
"productId": "0",
|
68 |
+
"description": "Verzendkosten",
|
69 |
+
"price": "500",
|
70 |
+
"quantity": "1",
|
71 |
+
"vatCode": "N"
|
72 |
+
}
|
73 |
+
]
|
74 |
+
},
|
75 |
+
"paymentDetails": {
|
76 |
+
"amount": "6500",
|
77 |
+
"currenyAmount": "6500",
|
78 |
+
"paidAmount": "6500",
|
79 |
+
"paidCurrenyAmount": "6500",
|
80 |
+
"paidBase": "6500",
|
81 |
+
"paidCosts": "0",
|
82 |
+
"paidCostsVat": "0",
|
83 |
+
"paidCurrency": "EUR",
|
84 |
+
"paidAttemps": "1",
|
85 |
+
"paidDuration": "0",
|
86 |
+
"description": "145000011",
|
87 |
+
"processTime": "10",
|
88 |
+
"state": "85",
|
89 |
+
"stateName": "VERIFY",
|
90 |
+
"stateDescription": "Verify",
|
91 |
+
"exchange": "",
|
92 |
+
"storno": "0",
|
93 |
+
"paymentOptionId": "613",
|
94 |
+
"paymentOptionSubId": "0",
|
95 |
+
"secure": "0",
|
96 |
+
"secureStatus": "",
|
97 |
+
"identifierName": "A Pieters",
|
98 |
+
"identifierPublic": "",
|
99 |
+
"identifierHash": "",
|
100 |
+
"customerKey": "11f2365950119362500e06af693e380b",
|
101 |
+
"serviceId": "SL-6712-4510",
|
102 |
+
"serviceName": "Andy",
|
103 |
+
"serviceDescription": "Test voor andys webshops",
|
104 |
+
"created": "2016-04-26 15:34:03",
|
105 |
+
"modified": "2016-04-26 15:34:13",
|
106 |
+
"paymentMethodId": "4",
|
107 |
+
"paymentMethodName": "Transacties ",
|
108 |
+
"paymentMethodDescription": "Pay Per Transaction",
|
109 |
+
"paymentProfileName": "SandBox"
|
110 |
+
},
|
111 |
+
"statsDetails": {
|
112 |
+
"tool": "",
|
113 |
+
"info": "",
|
114 |
+
"object": "",
|
115 |
+
"extra1": "145000011",
|
116 |
+
"extra2": "andy@pay.nl",
|
117 |
+
"extra3": "",
|
118 |
+
"promotorId": "0",
|
119 |
+
"transferData": "",
|
120 |
+
"paymentSessionId": "645958819"
|
121 |
+
},
|
122 |
+
"stornoDetails": {
|
123 |
+
"stornoId": "",
|
124 |
+
"stornoAmount": "",
|
125 |
+
"bankAccount": "",
|
126 |
+
"iban": "",
|
127 |
+
"bic": "",
|
128 |
+
"city": "",
|
129 |
+
"datetime": "",
|
130 |
+
"reason": "",
|
131 |
+
"emailAddress": ""
|
132 |
+
}
|
133 |
+
}
|
app/code/community/Pay/Payment/vendor/paynl/sdk/tests/dummyData/Transaction/startOk.json
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"request": {
|
3 |
+
"result": "1",
|
4 |
+
"errorId": "",
|
5 |
+
"errorMessage": ""
|
6 |
+
},
|
7 |
+
"endUser": {
|
8 |
+
"blacklist": "0"
|
9 |
+
},
|
10 |
+
"transaction": {
|
11 |
+
"transactionId": "643872862Xe19e4c",
|
12 |
+
"paymentURL": "https:\/\/betalen.rabobank.nl\/ideal-betaling\/landingpage?random=93ea6be3e748ed876158a6ebd5fa8ce1c3950a67f9551c990a5f6f7acd7432c3&trxid=0020001238088229",
|
13 |
+
"popupAllowed": "0",
|
14 |
+
"paymentReference": "6000 0006 4387 2862"
|
15 |
+
}
|
16 |
+
}
|
app/code/community/Pay/Payment/vendor/paynl/sdk/tests/dummyData/Validate/isPayServerIpNo.json
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"result": "0"
|
3 |
+
}
|
app/code/community/Pay/Payment/vendor/paynl/sdk/tests/dummyData/Validate/isPayServerIpYes.json
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"result": "1"
|
3 |
+
}
|
app/code/community/Pay/Payment/vendor/paynl/sdk/tests/dummyData/currencies.json
ADDED
@@ -0,0 +1,177 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
[
|
2 |
+
{
|
3 |
+
"id": "24",
|
4 |
+
"description": "Australian dollar",
|
5 |
+
"abbreviation": "AUD"
|
6 |
+
},
|
7 |
+
{
|
8 |
+
"id": "4",
|
9 |
+
"description": "Bulgarian lev",
|
10 |
+
"abbreviation": "BGN"
|
11 |
+
},
|
12 |
+
{
|
13 |
+
"id": "25",
|
14 |
+
"description": "Canadian dollar",
|
15 |
+
"abbreviation": "CAD"
|
16 |
+
},
|
17 |
+
{
|
18 |
+
"id": "18",
|
19 |
+
"description": "Swiss franc",
|
20 |
+
"abbreviation": "CHF"
|
21 |
+
},
|
22 |
+
{
|
23 |
+
"id": "26",
|
24 |
+
"description": "Chinese yuan renminbi",
|
25 |
+
"abbreviation": "CNY"
|
26 |
+
},
|
27 |
+
{
|
28 |
+
"id": "6",
|
29 |
+
"description": "Czech koruna",
|
30 |
+
"abbreviation": "CZK"
|
31 |
+
},
|
32 |
+
{
|
33 |
+
"id": "7",
|
34 |
+
"description": "Danish krone",
|
35 |
+
"abbreviation": "DKK"
|
36 |
+
},
|
37 |
+
{
|
38 |
+
"id": "8",
|
39 |
+
"description": "Estonian kroon",
|
40 |
+
"abbreviation": "EEK"
|
41 |
+
},
|
42 |
+
{
|
43 |
+
"id": "1",
|
44 |
+
"description": "Euro",
|
45 |
+
"abbreviation": "EUR"
|
46 |
+
},
|
47 |
+
{
|
48 |
+
"id": "9",
|
49 |
+
"description": "Pound sterling",
|
50 |
+
"abbreviation": "GBP"
|
51 |
+
},
|
52 |
+
{
|
53 |
+
"id": "27",
|
54 |
+
"description": "Hong Kong dollar",
|
55 |
+
"abbreviation": "HKD"
|
56 |
+
},
|
57 |
+
{
|
58 |
+
"id": "21",
|
59 |
+
"description": "Croatian kuna",
|
60 |
+
"abbreviation": "HRK"
|
61 |
+
},
|
62 |
+
{
|
63 |
+
"id": "10",
|
64 |
+
"description": "Hungarian forint",
|
65 |
+
"abbreviation": "HUF"
|
66 |
+
},
|
67 |
+
{
|
68 |
+
"id": "28",
|
69 |
+
"description": "Indonesian rupiah",
|
70 |
+
"abbreviation": "IDR"
|
71 |
+
},
|
72 |
+
{
|
73 |
+
"id": "37",
|
74 |
+
"description": "Indian rupee",
|
75 |
+
"abbreviation": "INR"
|
76 |
+
},
|
77 |
+
{
|
78 |
+
"id": "19",
|
79 |
+
"description": "Icelandic krona",
|
80 |
+
"abbreviation": "ISK"
|
81 |
+
},
|
82 |
+
{
|
83 |
+
"id": "3",
|
84 |
+
"description": "Japanese yen",
|
85 |
+
"abbreviation": "JPY"
|
86 |
+
},
|
87 |
+
{
|
88 |
+
"id": "29",
|
89 |
+
"description": "South Korean won",
|
90 |
+
"abbreviation": "KRW"
|
91 |
+
},
|
92 |
+
{
|
93 |
+
"id": "11",
|
94 |
+
"description": "Lithuanian litas",
|
95 |
+
"abbreviation": "LTL"
|
96 |
+
},
|
97 |
+
{
|
98 |
+
"id": "12",
|
99 |
+
"description": "Latvian lats",
|
100 |
+
"abbreviation": "LVL"
|
101 |
+
},
|
102 |
+
{
|
103 |
+
"id": "40",
|
104 |
+
"description": "Mexican peso",
|
105 |
+
"abbreviation": "MXN"
|
106 |
+
},
|
107 |
+
{
|
108 |
+
"id": "30",
|
109 |
+
"description": "Malaysian ringgit",
|
110 |
+
"abbreviation": "MYR"
|
111 |
+
},
|
112 |
+
{
|
113 |
+
"id": "20",
|
114 |
+
"description": "Norwegian krone",
|
115 |
+
"abbreviation": "NOK"
|
116 |
+
},
|
117 |
+
{
|
118 |
+
"id": "31",
|
119 |
+
"description": "New Zealand dollar",
|
120 |
+
"abbreviation": "NZD"
|
121 |
+
},
|
122 |
+
{
|
123 |
+
"id": "32",
|
124 |
+
"description": "Philippine peso",
|
125 |
+
"abbreviation": "PHP"
|
126 |
+
},
|
127 |
+
{
|
128 |
+
"id": "14",
|
129 |
+
"description": "Polish zloty",
|
130 |
+
"abbreviation": "PLN"
|
131 |
+
},
|
132 |
+
{
|
133 |
+
"id": "15",
|
134 |
+
"description": "New Romanian leu",
|
135 |
+
"abbreviation": "RON"
|
136 |
+
},
|
137 |
+
{
|
138 |
+
"id": "22",
|
139 |
+
"description": "Russian rouble",
|
140 |
+
"abbreviation": "RUB"
|
141 |
+
},
|
142 |
+
{
|
143 |
+
"id": "16",
|
144 |
+
"description": "Swedish krona",
|
145 |
+
"abbreviation": "SEK"
|
146 |
+
},
|
147 |
+
{
|
148 |
+
"id": "33",
|
149 |
+
"description": "Singapore dollar",
|
150 |
+
"abbreviation": "SGD"
|
151 |
+
},
|
152 |
+
{
|
153 |
+
"id": "17",
|
154 |
+
"description": "Slovak koruna",
|
155 |
+
"abbreviation": "SKK"
|
156 |
+
},
|
157 |
+
{
|
158 |
+
"id": "34",
|
159 |
+
"description": "Thai baht",
|
160 |
+
"abbreviation": "THB"
|
161 |
+
},
|
162 |
+
{
|
163 |
+
"id": "23",
|
164 |
+
"description": "New Turkish lira",
|
165 |
+
"abbreviation": "TRY"
|
166 |
+
},
|
167 |
+
{
|
168 |
+
"id": "2",
|
169 |
+
"description": "US dollar",
|
170 |
+
"abbreviation": "USD"
|
171 |
+
},
|
172 |
+
{
|
173 |
+
"id": "35",
|
174 |
+
"description": "South African rand",
|
175 |
+
"abbreviation": "ZAR"
|
176 |
+
}
|
177 |
+
]
|
app/code/community/Pay/Payment/vendor/paynl/sdk/tests/dummyData/getService.json
ADDED
@@ -0,0 +1,271 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"request": {
|
3 |
+
"result": "1",
|
4 |
+
"errorId": "",
|
5 |
+
"errorMessage": ""
|
6 |
+
},
|
7 |
+
"merchant": {
|
8 |
+
"id": "M-3421-2120",
|
9 |
+
"name": "Demotour Pay.nl",
|
10 |
+
"publicName": "Demotour Pay.nl",
|
11 |
+
"state": "1"
|
12 |
+
},
|
13 |
+
"service": {
|
14 |
+
"id": "SL-6712-4510",
|
15 |
+
"state": "1",
|
16 |
+
"name": "Andy",
|
17 |
+
"description": "Test voor andys webshops",
|
18 |
+
"publication": "http:\/\/andy.dev2.kopersteden.nl",
|
19 |
+
"basePath": "https:\/\/admin.pay.nl\/images",
|
20 |
+
"module": "2",
|
21 |
+
"subModule": "39",
|
22 |
+
"successUrl": "",
|
23 |
+
"errorUrl": ""
|
24 |
+
},
|
25 |
+
"settings": "",
|
26 |
+
"countryOptionList": {
|
27 |
+
"NL": {
|
28 |
+
"id": "NL",
|
29 |
+
"name": "Netherlands",
|
30 |
+
"visibleName": "Netherlands",
|
31 |
+
"in_eu": "1",
|
32 |
+
"img": "nl.gif",
|
33 |
+
"path": "\/flags\/",
|
34 |
+
"paymentOptionList": {
|
35 |
+
"10": {
|
36 |
+
"id": "10",
|
37 |
+
"name": "iDEAL",
|
38 |
+
"visibleName": "iDEAL",
|
39 |
+
"img": "10.gif",
|
40 |
+
"path": "\/payment_profiles\/",
|
41 |
+
"state": "1",
|
42 |
+
"useOnlyInStore": "0",
|
43 |
+
"paymentMethodId": "4",
|
44 |
+
"paymentOptionSubList": {
|
45 |
+
"1": {
|
46 |
+
"id": "1",
|
47 |
+
"name": "ABN Amro",
|
48 |
+
"visibleName": "ABN Amro",
|
49 |
+
"img": "1.png",
|
50 |
+
"path": "\/payment_banks\/",
|
51 |
+
"state": "1"
|
52 |
+
},
|
53 |
+
"2": {
|
54 |
+
"id": "2",
|
55 |
+
"name": "Rabobank",
|
56 |
+
"visibleName": "Rabobank",
|
57 |
+
"img": "2.png",
|
58 |
+
"path": "\/payment_banks\/",
|
59 |
+
"state": "1"
|
60 |
+
},
|
61 |
+
"4": {
|
62 |
+
"id": "4",
|
63 |
+
"name": "ING Bank",
|
64 |
+
"visibleName": "ING Bank",
|
65 |
+
"img": "4.png",
|
66 |
+
"path": "\/payment_banks\/",
|
67 |
+
"state": "1"
|
68 |
+
},
|
69 |
+
"5": {
|
70 |
+
"id": "5",
|
71 |
+
"name": "SNS Bank",
|
72 |
+
"visibleName": "SNS Bank",
|
73 |
+
"img": "5.png",
|
74 |
+
"path": "\/payment_banks\/",
|
75 |
+
"state": "1"
|
76 |
+
},
|
77 |
+
"8": {
|
78 |
+
"id": "8",
|
79 |
+
"name": "ASN Bank",
|
80 |
+
"visibleName": "ASN Bank",
|
81 |
+
"img": "8.png",
|
82 |
+
"path": "\/payment_banks\/",
|
83 |
+
"state": "1"
|
84 |
+
},
|
85 |
+
"9": {
|
86 |
+
"id": "9",
|
87 |
+
"name": "RegioBank",
|
88 |
+
"visibleName": "RegioBank",
|
89 |
+
"img": "9.png",
|
90 |
+
"path": "\/payment_banks\/",
|
91 |
+
"state": "1"
|
92 |
+
},
|
93 |
+
"10": {
|
94 |
+
"id": "10",
|
95 |
+
"name": "Triodos Bank",
|
96 |
+
"visibleName": "Triodos Bank",
|
97 |
+
"img": "10.png",
|
98 |
+
"path": "\/payment_banks\/",
|
99 |
+
"state": "1"
|
100 |
+
},
|
101 |
+
"11": {
|
102 |
+
"id": "11",
|
103 |
+
"name": "Van Lanschot Bankiers",
|
104 |
+
"visibleName": "Van Lanschot Bankiers",
|
105 |
+
"img": "11.png",
|
106 |
+
"path": "\/payment_banks\/",
|
107 |
+
"state": "1"
|
108 |
+
},
|
109 |
+
"12": {
|
110 |
+
"id": "12",
|
111 |
+
"name": "Knab bank",
|
112 |
+
"visibleName": "Knab bank",
|
113 |
+
"img": "12.png",
|
114 |
+
"path": "\/payment_banks\/",
|
115 |
+
"state": "1"
|
116 |
+
},
|
117 |
+
"5080": {
|
118 |
+
"id": "5080",
|
119 |
+
"name": "Bunq",
|
120 |
+
"visibleName": "Bunq",
|
121 |
+
"img": "5080.png",
|
122 |
+
"path": "\/payment_banks\/",
|
123 |
+
"state": "1"
|
124 |
+
}
|
125 |
+
}
|
126 |
+
},
|
127 |
+
"739": {
|
128 |
+
"id": "739",
|
129 |
+
"name": "AfterPay",
|
130 |
+
"visibleName": "AfterPay",
|
131 |
+
"img": "739.gif",
|
132 |
+
"path": "\/payment_profiles\/",
|
133 |
+
"state": "1",
|
134 |
+
"useOnlyInStore": "0",
|
135 |
+
"paymentMethodId": "4",
|
136 |
+
"paymentOptionSubList": ""
|
137 |
+
},
|
138 |
+
"811": {
|
139 |
+
"id": "811",
|
140 |
+
"name": "Webshopgiftcard",
|
141 |
+
"visibleName": "Webshopgiftcard",
|
142 |
+
"img": "811.gif",
|
143 |
+
"path": "\/payment_profiles\/",
|
144 |
+
"state": "1",
|
145 |
+
"useOnlyInStore": "0",
|
146 |
+
"paymentMethodId": "4",
|
147 |
+
"paymentOptionSubList": ""
|
148 |
+
},
|
149 |
+
"740": {
|
150 |
+
"id": "740",
|
151 |
+
"name": "Afterpay EM",
|
152 |
+
"visibleName": "Afterpay EM",
|
153 |
+
"img": "740.gif",
|
154 |
+
"path": "\/payment_profiles\/",
|
155 |
+
"state": "1",
|
156 |
+
"useOnlyInStore": "0",
|
157 |
+
"paymentMethodId": "4",
|
158 |
+
"paymentOptionSubList": ""
|
159 |
+
},
|
160 |
+
"1666": {
|
161 |
+
"id": "1666",
|
162 |
+
"name": "WijnCadeau",
|
163 |
+
"visibleName": "WijnCadeau",
|
164 |
+
"img": "1666.gif",
|
165 |
+
"path": "\/payment_profiles\/",
|
166 |
+
"state": "1",
|
167 |
+
"useOnlyInStore": "0",
|
168 |
+
"paymentMethodId": "4",
|
169 |
+
"paymentOptionSubList": ""
|
170 |
+
},
|
171 |
+
"1657": {
|
172 |
+
"id": "1657",
|
173 |
+
"name": "Givacard",
|
174 |
+
"visibleName": "Givacard",
|
175 |
+
"img": "1657.gif",
|
176 |
+
"path": "\/payment_profiles\/",
|
177 |
+
"state": "1",
|
178 |
+
"useOnlyInStore": "0",
|
179 |
+
"paymentMethodId": "4",
|
180 |
+
"paymentOptionSubList": ""
|
181 |
+
},
|
182 |
+
"1672": {
|
183 |
+
"id": "1672",
|
184 |
+
"name": "Billink",
|
185 |
+
"visibleName": "Billink",
|
186 |
+
"img": "1672.gif",
|
187 |
+
"path": "\/payment_profiles\/",
|
188 |
+
"state": "1",
|
189 |
+
"useOnlyInStore": "0",
|
190 |
+
"paymentMethodId": "4",
|
191 |
+
"paymentOptionSubList": ""
|
192 |
+
},
|
193 |
+
"1714": {
|
194 |
+
"id": "1714",
|
195 |
+
"name": "VVV Giftcard",
|
196 |
+
"visibleName": "VVV Giftcard",
|
197 |
+
"img": "1714.gif",
|
198 |
+
"path": "\/payment_profiles\/",
|
199 |
+
"state": "1",
|
200 |
+
"useOnlyInStore": "0",
|
201 |
+
"paymentMethodId": "4",
|
202 |
+
"paymentOptionSubList": ""
|
203 |
+
},
|
204 |
+
"1702": {
|
205 |
+
"id": "1702",
|
206 |
+
"name": "Focum - Achteraf betalen",
|
207 |
+
"visibleName": "Achteraf betalen op factuur",
|
208 |
+
"img": "1702.gif",
|
209 |
+
"path": "\/payment_profiles\/",
|
210 |
+
"state": "1",
|
211 |
+
"useOnlyInStore": "0",
|
212 |
+
"paymentMethodId": "4",
|
213 |
+
"paymentOptionSubList": ""
|
214 |
+
}
|
215 |
+
}
|
216 |
+
},
|
217 |
+
"ALL": {
|
218 |
+
"id": "ALL",
|
219 |
+
"name": "All countries",
|
220 |
+
"visibleName": "All countries",
|
221 |
+
"in_eu": "0",
|
222 |
+
"img": "all.gif",
|
223 |
+
"path": "\/flags\/",
|
224 |
+
"paymentOptionList": {
|
225 |
+
"136": {
|
226 |
+
"id": "136",
|
227 |
+
"name": "Overboeking",
|
228 |
+
"visibleName": "Overboeking",
|
229 |
+
"img": "136.gif",
|
230 |
+
"path": "\/payment_profiles\/",
|
231 |
+
"state": "1",
|
232 |
+
"useOnlyInStore": "0",
|
233 |
+
"paymentMethodId": "4",
|
234 |
+
"paymentOptionSubList": ""
|
235 |
+
},
|
236 |
+
"559": {
|
237 |
+
"id": "559",
|
238 |
+
"name": "Sofortbanking eCommerce (fysieke producten)",
|
239 |
+
"visibleName": "Sofortbanking",
|
240 |
+
"img": "559.gif",
|
241 |
+
"path": "\/payment_profiles\/",
|
242 |
+
"state": "1",
|
243 |
+
"useOnlyInStore": "0",
|
244 |
+
"paymentMethodId": "4",
|
245 |
+
"paymentOptionSubList": ""
|
246 |
+
}
|
247 |
+
}
|
248 |
+
},
|
249 |
+
"BE": {
|
250 |
+
"id": "BE",
|
251 |
+
"name": "Belgium",
|
252 |
+
"visibleName": "Belgium",
|
253 |
+
"in_eu": "1",
|
254 |
+
"img": "be.gif",
|
255 |
+
"path": "\/flags\/",
|
256 |
+
"paymentOptionList": {
|
257 |
+
"436": {
|
258 |
+
"id": "436",
|
259 |
+
"name": "MisterCash \/ Bancontact",
|
260 |
+
"visibleName": "MisterCash \/ Bancontact",
|
261 |
+
"img": "436.gif",
|
262 |
+
"path": "\/payment_profiles\/",
|
263 |
+
"state": "1",
|
264 |
+
"useOnlyInStore": "0",
|
265 |
+
"paymentMethodId": "4",
|
266 |
+
"paymentOptionSubList": ""
|
267 |
+
}
|
268 |
+
}
|
269 |
+
}
|
270 |
+
}
|
271 |
+
}
|
app/code/community/Pay/Payment/vendor/php-curl-class/php-curl-class/.github/CONTRIBUTING.md
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
### Contributing to PHP Curl Class
|
2 |
+
1. Check for open issues or open a new issue to start a discussion around a bug or feature.
|
3 |
+
1. Fork the repository on GitHub to start making your changes.
|
4 |
+
1. Write one or more tests for the new feature or that expose the bug.
|
5 |
+
1. Make code changes to implement the feature or fix the bug.
|
6 |
+
1. Send a pull request to get your changes merged and published.
|
app/code/community/Pay/Payment/vendor/php-curl-class/php-curl-class/.github/ISSUE_TEMPLATE.md
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
What is the expected behavior?
|
2 |
+
|
3 |
+
What is the actual behavior?
|
4 |
+
|
5 |
+
What steps will reproduce the problem?
|
app/code/community/Pay/Payment/vendor/php-curl-class/php-curl-class/.gitignore
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
1 |
+
vendor/
|
2 |
+
composer.lock
|
3 |
+
|
4 |
+
.idea/
|
app/code/community/Pay/Payment/vendor/php-curl-class/php-curl-class/.travis.yml
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
language: php
|
2 |
+
|
3 |
+
php:
|
4 |
+
- 5.3
|
5 |
+
- 5.4
|
6 |
+
- 5.5
|
7 |
+
- 5.6
|
8 |
+
- 7.0
|
9 |
+
- hhvm
|
10 |
+
- nightly
|
11 |
+
|
12 |
+
matrix:
|
13 |
+
allow_failures:
|
14 |
+
- php: nightly
|
15 |
+
|
16 |
+
before_script:
|
17 |
+
- bash tests/before_script.sh
|
18 |
+
|
19 |
+
script:
|
20 |
+
- bash tests/script.sh
|
app/code/community/Pay/Payment/vendor/php-curl-class/php-curl-class/LICENSE
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
This is free and unencumbered software released into the public domain.
|
2 |
+
|
3 |
+
Anyone is free to copy, modify, publish, use, compile, sell, or
|
4 |
+
distribute this software, either in source code form or as a compiled
|
5 |
+
binary, for any purpose, commercial or non-commercial, and by any
|
6 |
+
means.
|
7 |
+
|
8 |
+
In jurisdictions that recognize copyright laws, the author or authors
|
9 |
+
of this software dedicate any and all copyright interest in the
|
10 |
+
software to the public domain. We make this dedication for the benefit
|
11 |
+
of the public at large and to the detriment of our heirs and
|
12 |
+
successors. We intend this dedication to be an overt act of
|
13 |
+
relinquishment in perpetuity of all present and future rights to this
|
14 |
+
software under copyright law.
|
15 |
+
|
16 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17 |
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18 |
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
19 |
+
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
20 |
+
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
21 |
+
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
22 |
+
OTHER DEALINGS IN THE SOFTWARE.
|
23 |
+
|
24 |
+
For more information, please refer to <http://unlicense.org/>
|
app/code/community/Pay/Payment/vendor/php-curl-class/php-curl-class/README.md
ADDED
@@ -0,0 +1,268 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# PHP Curl Class: HTTP requests made easy
|
2 |
+
|
3 |
+
[![Build Status](https://api.travis-ci.org/php-curl-class/php-curl-class.svg)](https://travis-ci.org/php-curl-class/php-curl-class)
|
4 |
+
[![Downloads](https://img.shields.io/packagist/dt/php-curl-class/php-curl-class.svg)](https://packagist.org/packages/php-curl-class/php-curl-class)
|
5 |
+
|
6 |
+
[![License](https://img.shields.io/packagist/l/php-curl-class/php-curl-class.svg)](https://github.com/php-curl-class/php-curl-class/blob/master/LICENSE)
|
7 |
+
|
8 |
+
PHP Curl Class is an object-oriented wrapper of the PHP cURL extension that makes it easy to send HTTP requests and integrate with web APIs.
|
9 |
+
|
10 |
+
---
|
11 |
+
|
12 |
+
- [Installation](#installation)
|
13 |
+
- [Requirements](#requirements)
|
14 |
+
- [Quick Start and Examples](#quick-start-and-examples)
|
15 |
+
- [Available Methods](#available-methods)
|
16 |
+
- [Contribute](#contribute)
|
17 |
+
|
18 |
+
---
|
19 |
+
|
20 |
+
### Installation
|
21 |
+
|
22 |
+
To install PHP Curl Class, simply:
|
23 |
+
|
24 |
+
$ composer require php-curl-class/php-curl-class
|
25 |
+
|
26 |
+
### Requirements
|
27 |
+
|
28 |
+
PHP Curl Class works with PHP 5.3, 5.4, 5.5, 5.6, 7.0, and HHVM.
|
29 |
+
|
30 |
+
### Quick Start and Examples
|
31 |
+
|
32 |
+
More examples are available under [/examples](https://github.com/php-curl-class/php-curl-class/tree/master/examples).
|
33 |
+
|
34 |
+
```php
|
35 |
+
require __DIR__ . '/vendor/autoload.php';
|
36 |
+
|
37 |
+
use \Curl\Curl;
|
38 |
+
|
39 |
+
$curl = new Curl();
|
40 |
+
$curl->get('http://www.example.com/');
|
41 |
+
```
|
42 |
+
|
43 |
+
```php
|
44 |
+
$curl = new Curl();
|
45 |
+
$curl->get('http://www.example.com/search', array(
|
46 |
+
'q' => 'keyword',
|
47 |
+
));
|
48 |
+
```
|
49 |
+
|
50 |
+
```php
|
51 |
+
$curl = new Curl();
|
52 |
+
$curl->post('http://www.example.com/login/', array(
|
53 |
+
'username' => 'myusername',
|
54 |
+
'password' => 'mypassword',
|
55 |
+
));
|
56 |
+
```
|
57 |
+
|
58 |
+
```php
|
59 |
+
$curl = new Curl();
|
60 |
+
$curl->setBasicAuthentication('username', 'password');
|
61 |
+
$curl->setUserAgent('');
|
62 |
+
$curl->setReferrer('');
|
63 |
+
$curl->setHeader('X-Requested-With', 'XMLHttpRequest');
|
64 |
+
$curl->setCookie('key', 'value');
|
65 |
+
$curl->get('http://www.example.com/');
|
66 |
+
|
67 |
+
if ($curl->error) {
|
68 |
+
echo 'Error: ' . $curl->errorCode . ': ' . $curl->errorMessage;
|
69 |
+
}
|
70 |
+
else {
|
71 |
+
echo $curl->response;
|
72 |
+
}
|
73 |
+
|
74 |
+
var_dump($curl->requestHeaders);
|
75 |
+
var_dump($curl->responseHeaders);
|
76 |
+
```
|
77 |
+
|
78 |
+
```php
|
79 |
+
$curl = new Curl();
|
80 |
+
$curl->setOpt(CURLOPT_SSL_VERIFYPEER, false);
|
81 |
+
$curl->get('https://encrypted.example.com/');
|
82 |
+
```
|
83 |
+
|
84 |
+
```php
|
85 |
+
$curl = new Curl();
|
86 |
+
$curl->put('http://api.example.com/user/', array(
|
87 |
+
'first_name' => 'Zach',
|
88 |
+
'last_name' => 'Borboa',
|
89 |
+
));
|
90 |
+
```
|
91 |
+
|
92 |
+
```php
|
93 |
+
$curl = new Curl();
|
94 |
+
$curl->patch('http://api.example.com/profile/', array(
|
95 |
+
'image' => '@path/to/file.jpg',
|
96 |
+
));
|
97 |
+
```
|
98 |
+
|
99 |
+
```php
|
100 |
+
$curl = new Curl();
|
101 |
+
$curl->patch('http://api.example.com/profile/', array(
|
102 |
+
'image' => new CURLFile('path/to/file.jpg'),
|
103 |
+
));
|
104 |
+
```
|
105 |
+
|
106 |
+
```php
|
107 |
+
$curl = new Curl();
|
108 |
+
$curl->delete('http://api.example.com/user/', array(
|
109 |
+
'id' => '1234',
|
110 |
+
));
|
111 |
+
```
|
112 |
+
|
113 |
+
```php
|
114 |
+
// Enable gzip compression and download a file.
|
115 |
+
$curl = new Curl();
|
116 |
+
$curl->setOpt(CURLOPT_ENCODING , 'gzip');
|
117 |
+
$curl->download('https://www.example.com/image.png', '/tmp/myimage.png');
|
118 |
+
```
|
119 |
+
|
120 |
+
```php
|
121 |
+
// Case-insensitive access to headers.
|
122 |
+
$curl = new Curl();
|
123 |
+
$curl->download('https://www.example.com/image.png', '/tmp/myimage.png');
|
124 |
+
echo $curl->responseHeaders['Content-Type'] . "\n"; // image/png
|
125 |
+
echo $curl->responseHeaders['CoNTeNT-TyPE'] . "\n"; // image/png
|
126 |
+
```
|
127 |
+
|
128 |
+
```php
|
129 |
+
$curl->close();
|
130 |
+
```
|
131 |
+
|
132 |
+
```php
|
133 |
+
// Example access to curl object.
|
134 |
+
curl_set_opt($curl->curl, CURLOPT_USERAGENT, 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1');
|
135 |
+
curl_close($curl->curl);
|
136 |
+
```
|
137 |
+
|
138 |
+
```php
|
139 |
+
require __DIR__ . '/vendor/autoload.php';
|
140 |
+
|
141 |
+
use \Curl\MultiCurl;
|
142 |
+
|
143 |
+
// Requests in parallel with callback functions.
|
144 |
+
$multi_curl = new MultiCurl();
|
145 |
+
|
146 |
+
$multi_curl->success(function($instance) {
|
147 |
+
echo 'call to "' . $instance->url . '" was successful.' . "\n";
|
148 |
+
echo 'response: ' . $instance->response . "\n";
|
149 |
+
});
|
150 |
+
$multi_curl->error(function($instance) {
|
151 |
+
echo 'call to "' . $instance->url . '" was unsuccessful.' . "\n";
|
152 |
+
echo 'error code: ' . $instance->errorCode . "\n";
|
153 |
+
echo 'error message: ' . $instance->errorMessage . "\n";
|
154 |
+
});
|
155 |
+
$multi_curl->complete(function($instance) {
|
156 |
+
echo 'call completed' . "\n";
|
157 |
+
});
|
158 |
+
|
159 |
+
$multi_curl->addGet('https://www.google.com/search', array(
|
160 |
+
'q' => 'hello world',
|
161 |
+
));
|
162 |
+
$multi_curl->addGet('https://duckduckgo.com/', array(
|
163 |
+
'q' => 'hello world',
|
164 |
+
));
|
165 |
+
$multi_curl->addGet('https://www.bing.com/search', array(
|
166 |
+
'q' => 'hello world',
|
167 |
+
));
|
168 |
+
|
169 |
+
$multi_curl->start(); // Blocks until all items in the queue have been processed.
|
170 |
+
```
|
171 |
+
|
172 |
+
### Available Methods
|
173 |
+
```php
|
174 |
+
Curl::__construct($base_url = null)
|
175 |
+
Curl::__destruct()
|
176 |
+
Curl::__get($name)
|
177 |
+
Curl::beforeSend($callback)
|
178 |
+
Curl::buildPostData($data)
|
179 |
+
Curl::call()
|
180 |
+
Curl::close()
|
181 |
+
Curl::complete($callback)
|
182 |
+
Curl::delete($url, $query_parameters = array(), $data = array())
|
183 |
+
Curl::download($url, $mixed_filename)
|
184 |
+
Curl::downloadComplete($fh)
|
185 |
+
Curl::error($callback)
|
186 |
+
Curl::exec($ch = null)
|
187 |
+
Curl::get($url, $data = array())
|
188 |
+
Curl::getCookie($key)
|
189 |
+
Curl::getInfo($opt)
|
190 |
+
Curl::getOpt($option)
|
191 |
+
Curl::getResponseCookie($key)
|
192 |
+
Curl::getResponseCookies()
|
193 |
+
Curl::head($url, $data = array())
|
194 |
+
Curl::headerCallback($ch, $header)
|
195 |
+
Curl::options($url, $data = array())
|
196 |
+
Curl::patch($url, $data = array())
|
197 |
+
Curl::post($url, $data = array(), $follow_303_with_post = false)
|
198 |
+
Curl::progress($callback)
|
199 |
+
Curl::put($url, $data = array())
|
200 |
+
Curl::setBasicAuthentication($username, $password = '')
|
201 |
+
Curl::setConnectTimeout($seconds)
|
202 |
+
Curl::setCookie($key, $value)
|
203 |
+
Curl::setCookieFile($cookie_file)
|
204 |
+
Curl::setCookieJar($cookie_jar)
|
205 |
+
Curl::setCookieString($string)
|
206 |
+
Curl::setDefaultDecoder($decoder = 'json')
|
207 |
+
Curl::setDefaultJsonDecoder()
|
208 |
+
Curl::setDefaultTimeout()
|
209 |
+
Curl::setDefaultUserAgent()
|
210 |
+
Curl::setDefaultXmlDecoder()
|
211 |
+
Curl::setDigestAuthentication($username, $password = '')
|
212 |
+
Curl::setHeader($key, $value)
|
213 |
+
Curl::setJsonDecoder($function)
|
214 |
+
Curl::setOpt($option, $value)
|
215 |
+
Curl::setPort($port)
|
216 |
+
Curl::setReferer($referer)
|
217 |
+
Curl::setReferrer($referrer)
|
218 |
+
Curl::setTimeout($seconds)
|
219 |
+
Curl::setURL($url, $data = array())
|
220 |
+
Curl::setUserAgent($user_agent)
|
221 |
+
Curl::setXmlDecoder($function)
|
222 |
+
Curl::success($callback)
|
223 |
+
Curl::unsetHeader($key)
|
224 |
+
Curl::verbose($on = true, $output=STDERR)
|
225 |
+
Curl::http_build_multi_query($data, $key = null)
|
226 |
+
Curl::is_array_assoc($array)
|
227 |
+
Curl::is_array_multidim($array)
|
228 |
+
MultiCurl::__construct($base_url = null)
|
229 |
+
MultiCurl::__destruct()
|
230 |
+
MultiCurl::addDelete($url, $query_parameters = array(), $data = array())
|
231 |
+
MultiCurl::addDownload($url, $mixed_filename)
|
232 |
+
MultiCurl::addGet($url, $data = array())
|
233 |
+
MultiCurl::addHead($url, $data = array())
|
234 |
+
MultiCurl::addOptions($url, $data = array())
|
235 |
+
MultiCurl::addPatch($url, $data = array())
|
236 |
+
MultiCurl::addPost($url, $data = array(), $follow_303_with_post = false)
|
237 |
+
MultiCurl::addPut($url, $data = array())
|
238 |
+
MultiCurl::beforeSend($callback)
|
239 |
+
MultiCurl::close()
|
240 |
+
MultiCurl::complete($callback)
|
241 |
+
MultiCurl::error($callback)
|
242 |
+
MultiCurl::getOpt($option)
|
243 |
+
MultiCurl::setBasicAuthentication($username, $password = '')
|
244 |
+
MultiCurl::setCookie($key, $value)
|
245 |
+
MultiCurl::setCookieFile($cookie_file)
|
246 |
+
MultiCurl::setCookieJar($cookie_jar)
|
247 |
+
MultiCurl::setDigestAuthentication($username, $password = '')
|
248 |
+
MultiCurl::setHeader($key, $value)
|
249 |
+
MultiCurl::setJsonDecoder($function)
|
250 |
+
MultiCurl::setOpt($option, $value)
|
251 |
+
MultiCurl::setReferer($referer)
|
252 |
+
MultiCurl::setReferrer($referrer)
|
253 |
+
MultiCurl::setTimeout($seconds)
|
254 |
+
MultiCurl::setURL($url)
|
255 |
+
MultiCurl::setUserAgent($user_agent)
|
256 |
+
MultiCurl::setXmlDecoder($function)
|
257 |
+
MultiCurl::start()
|
258 |
+
MultiCurl::success($callback)
|
259 |
+
MultiCurl::unsetHeader($key)
|
260 |
+
MultiCurl::verbose($on = true, $output=STDERR)
|
261 |
+
```
|
262 |
+
|
263 |
+
### Contribute
|
264 |
+
1. Check for open issues or open a new issue to start a discussion around a bug or feature.
|
265 |
+
1. Fork the repository on GitHub to start making your changes.
|
266 |
+
1. Write one or more tests for the new feature or that expose the bug.
|
267 |
+
1. Make code changes to implement the feature or fix the bug.
|
268 |
+
1. Send a pull request to get your changes merged and published.
|
app/code/community/Pay/Payment/vendor/php-curl-class/php-curl-class/composer.json
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"name": "php-curl-class/php-curl-class",
|
3 |
+
"description": "PHP Curl Class is an object-oriented wrapper of the PHP cURL extension.",
|
4 |
+
"homepage": "https://github.com/php-curl-class/php-curl-class",
|
5 |
+
"license": "Unlicense",
|
6 |
+
"keywords": [
|
7 |
+
"php", "curl", "class", "api", "client", "framework", "http client",
|
8 |
+
"http", "json", "requests", "rest", "restful", "web service", "xml"
|
9 |
+
],
|
10 |
+
"authors": [
|
11 |
+
{
|
12 |
+
"name": "Zach Borboa"
|
13 |
+
}
|
14 |
+
],
|
15 |
+
"require": {
|
16 |
+
"php": ">=5.3",
|
17 |
+
"ext-curl": "*"
|
18 |
+
},
|
19 |
+
"require-dev": {
|
20 |
+
"phpunit/phpunit": "*"
|
21 |
+
},
|
22 |
+
"autoload": {
|
23 |
+
"psr-4": {
|
24 |
+
"Curl\\": "src/Curl/"
|
25 |
+
}
|
26 |
+
}
|
27 |
+
}
|
app/code/community/Pay/Payment/vendor/php-curl-class/php-curl-class/docs/.gitignore
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
build/
|
app/code/community/Pay/Payment/vendor/php-curl-class/php-curl-class/docs/Makefile
ADDED
@@ -0,0 +1,192 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Makefile for Sphinx documentation
|
2 |
+
#
|
3 |
+
|
4 |
+
# You can set these variables from the command line.
|
5 |
+
SPHINXOPTS =
|
6 |
+
SPHINXBUILD = sphinx-build
|
7 |
+
PAPER =
|
8 |
+
BUILDDIR = build
|
9 |
+
|
10 |
+
# User-friendly check for sphinx-build
|
11 |
+
ifeq ($(shell which $(SPHINXBUILD) >/dev/null 2>&1; echo $$?), 1)
|
12 |
+
$(error The '$(SPHINXBUILD)' command was not found. Make sure you have Sphinx installed, then set the SPHINXBUILD environment variable to point to the full path of the '$(SPHINXBUILD)' executable. Alternatively you can add the directory with the executable to your PATH. If you don't have Sphinx installed, grab it from http://sphinx-doc.org/)
|
13 |
+
endif
|
14 |
+
|
15 |
+
# Internal variables.
|
16 |
+
PAPEROPT_a4 = -D latex_paper_size=a4
|
17 |
+
PAPEROPT_letter = -D latex_paper_size=letter
|
18 |
+
ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) source
|
19 |
+
# the i18n builder cannot share the environment and doctrees with the others
|
20 |
+
I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) source
|
21 |
+
|
22 |
+
.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest coverage gettext
|
23 |
+
|
24 |
+
help:
|
25 |
+
@echo "Please use \`make <target>' where <target> is one of"
|
26 |
+
@echo " html to make standalone HTML files"
|
27 |
+
@echo " dirhtml to make HTML files named index.html in directories"
|
28 |
+
@echo " singlehtml to make a single large HTML file"
|
29 |
+
@echo " pickle to make pickle files"
|
30 |
+
@echo " json to make JSON files"
|
31 |
+
@echo " htmlhelp to make HTML files and a HTML help project"
|
32 |
+
@echo " qthelp to make HTML files and a qthelp project"
|
33 |
+
@echo " applehelp to make an Apple Help Book"
|
34 |
+
@echo " devhelp to make HTML files and a Devhelp project"
|
35 |
+
@echo " epub to make an epub"
|
36 |
+
@echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
|
37 |
+
@echo " latexpdf to make LaTeX files and run them through pdflatex"
|
38 |
+
@echo " latexpdfja to make LaTeX files and run them through platex/dvipdfmx"
|
39 |
+
@echo " text to make text files"
|
40 |
+
@echo " man to make manual pages"
|
41 |
+
@echo " texinfo to make Texinfo files"
|
42 |
+
@echo " info to make Texinfo files and run them through makeinfo"
|
43 |
+
@echo " gettext to make PO message catalogs"
|
44 |
+
@echo " changes to make an overview of all changed/added/deprecated items"
|
45 |
+
@echo " xml to make Docutils-native XML files"
|
46 |
+
@echo " pseudoxml to make pseudoxml-XML files for display purposes"
|
47 |
+
@echo " linkcheck to check all external links for integrity"
|
48 |
+
@echo " doctest to run all doctests embedded in the documentation (if enabled)"
|
49 |
+
@echo " coverage to run coverage check of the documentation (if enabled)"
|
50 |
+
|
51 |
+
clean:
|
52 |
+
rm -rf $(BUILDDIR)/*
|
53 |
+
|
54 |
+
html:
|
55 |
+
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
|
56 |
+
@echo
|
57 |
+
@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
|
58 |
+
|
59 |
+
dirhtml:
|
60 |
+
$(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
|
61 |
+
@echo
|
62 |
+
@echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml."
|
63 |
+
|
64 |
+
singlehtml:
|
65 |
+
$(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml
|
66 |
+
@echo
|
67 |
+
@echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml."
|
68 |
+
|
69 |
+
pickle:
|
70 |
+
$(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle
|
71 |
+
@echo
|
72 |
+
@echo "Build finished; now you can process the pickle files."
|
73 |
+
|
74 |
+
json:
|
75 |
+
$(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json
|
76 |
+
@echo
|
77 |
+
@echo "Build finished; now you can process the JSON files."
|
78 |
+
|
79 |
+
htmlhelp:
|
80 |
+
$(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp
|
81 |
+
@echo
|
82 |
+
@echo "Build finished; now you can run HTML Help Workshop with the" \
|
83 |
+
".hhp project file in $(BUILDDIR)/htmlhelp."
|
84 |
+
|
85 |
+
qthelp:
|
86 |
+
$(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp
|
87 |
+
@echo
|
88 |
+
@echo "Build finished; now you can run "qcollectiongenerator" with the" \
|
89 |
+
".qhcp project file in $(BUILDDIR)/qthelp, like this:"
|
90 |
+
@echo "# qcollectiongenerator $(BUILDDIR)/qthelp/PHPCurlClass.qhcp"
|
91 |
+
@echo "To view the help file:"
|
92 |
+
@echo "# assistant -collectionFile $(BUILDDIR)/qthelp/PHPCurlClass.qhc"
|
93 |
+
|
94 |
+
applehelp:
|
95 |
+
$(SPHINXBUILD) -b applehelp $(ALLSPHINXOPTS) $(BUILDDIR)/applehelp
|
96 |
+
@echo
|
97 |
+
@echo "Build finished. The help book is in $(BUILDDIR)/applehelp."
|
98 |
+
@echo "N.B. You won't be able to view it unless you put it in" \
|
99 |
+
"~/Library/Documentation/Help or install it in your application" \
|
100 |
+
"bundle."
|
101 |
+
|
102 |
+
devhelp:
|
103 |
+
$(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp
|
104 |
+
@echo
|
105 |
+
@echo "Build finished."
|
106 |
+
@echo "To view the help file:"
|
107 |
+
@echo "# mkdir -p $$HOME/.local/share/devhelp/PHPCurlClass"
|
108 |
+
@echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/PHPCurlClass"
|
109 |
+
@echo "# devhelp"
|
110 |
+
|
111 |
+
epub:
|
112 |
+
$(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub
|
113 |
+
@echo
|
114 |
+
@echo "Build finished. The epub file is in $(BUILDDIR)/epub."
|
115 |
+
|
116 |
+
latex:
|
117 |
+
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
|
118 |
+
@echo
|
119 |
+
@echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex."
|
120 |
+
@echo "Run \`make' in that directory to run these through (pdf)latex" \
|
121 |
+
"(use \`make latexpdf' here to do that automatically)."
|
122 |
+
|
123 |
+
latexpdf:
|
124 |
+
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
|
125 |
+
@echo "Running LaTeX files through pdflatex..."
|
126 |
+
$(MAKE) -C $(BUILDDIR)/latex all-pdf
|
127 |
+
@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
|
128 |
+
|
129 |
+
latexpdfja:
|
130 |
+
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
|
131 |
+
@echo "Running LaTeX files through platex and dvipdfmx..."
|
132 |
+
$(MAKE) -C $(BUILDDIR)/latex all-pdf-ja
|
133 |
+
@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
|
134 |
+
|
135 |
+
text:
|
136 |
+
$(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text
|
137 |
+
@echo
|
138 |
+
@echo "Build finished. The text files are in $(BUILDDIR)/text."
|
139 |
+
|
140 |
+
man:
|
141 |
+
$(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man
|
142 |
+
@echo
|
143 |
+
@echo "Build finished. The manual pages are in $(BUILDDIR)/man."
|
144 |
+
|
145 |
+
texinfo:
|
146 |
+
$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
|
147 |
+
@echo
|
148 |
+
@echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo."
|
149 |
+
@echo "Run \`make' in that directory to run these through makeinfo" \
|
150 |
+
"(use \`make info' here to do that automatically)."
|
151 |
+
|
152 |
+
info:
|
153 |
+
$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
|
154 |
+
@echo "Running Texinfo files through makeinfo..."
|
155 |
+
make -C $(BUILDDIR)/texinfo info
|
156 |
+
@echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo."
|
157 |
+
|
158 |
+
gettext:
|
159 |
+
$(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale
|
160 |
+
@echo
|
161 |
+
@echo "Build finished. The message catalogs are in $(BUILDDIR)/locale."
|
162 |
+
|
163 |
+
changes:
|
164 |
+
$(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes
|
165 |
+
@echo
|
166 |
+
@echo "The overview file is in $(BUILDDIR)/changes."
|
167 |
+
|
168 |
+
linkcheck:
|
169 |
+
$(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck
|
170 |
+
@echo
|
171 |
+
@echo "Link check complete; look for any errors in the above output " \
|
172 |
+
"or in $(BUILDDIR)/linkcheck/output.txt."
|
173 |
+
|
174 |
+
doctest:
|
175 |
+
$(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest
|
176 |
+
@echo "Testing of doctests in the sources finished, look at the " \
|
177 |
+
"results in $(BUILDDIR)/doctest/output.txt."
|
178 |
+
|
179 |
+
coverage:
|
180 |
+
$(SPHINXBUILD) -b coverage $(ALLSPHINXOPTS) $(BUILDDIR)/coverage
|
181 |
+
@echo "Testing of coverage in the sources finished, look at the " \
|
182 |
+
"results in $(BUILDDIR)/coverage/python.txt."
|
183 |
+
|
184 |
+
xml:
|
185 |
+
$(SPHINXBUILD) -b xml $(ALLSPHINXOPTS) $(BUILDDIR)/xml
|
186 |
+
@echo
|
187 |
+
@echo "Build finished. The XML files are in $(BUILDDIR)/xml."
|
188 |
+
|
189 |
+
pseudoxml:
|
190 |
+
$(SPHINXBUILD) -b pseudoxml $(ALLSPHINXOPTS) $(BUILDDIR)/pseudoxml
|
191 |
+
@echo
|
192 |
+
@echo "Build finished. The pseudo-XML files are in $(BUILDDIR)/pseudoxml."
|
app/code/community/Pay/Payment/vendor/php-curl-class/php-curl-class/docs/README.md
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
1 |
+
# PHP Curl Class Documentation
|
2 |
+
http://www.phpcurlclass.com/
|
3 |
+
|
4 |
+
The [examples](https://github.com/php-curl-class/php-curl-class/tree/master/examples) are a great starting point.
|
app/code/community/Pay/Payment/vendor/php-curl-class/php-curl-class/docs/source/conf.py
ADDED
@@ -0,0 +1,291 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# -*- coding: utf-8 -*-
|
2 |
+
#
|
3 |
+
# PHP Curl Class documentation build configuration file, created by
|
4 |
+
# sphinx-quickstart.
|
5 |
+
#
|
6 |
+
# This file is execfile()d with the current directory set to its
|
7 |
+
# containing dir.
|
8 |
+
#
|
9 |
+
# Note that not all possible configuration values are present in this
|
10 |
+
# autogenerated file.
|
11 |
+
#
|
12 |
+
# All configuration values have a default; values that are commented out
|
13 |
+
# serve to show the default.
|
14 |
+
|
15 |
+
import sys
|
16 |
+
import os
|
17 |
+
import shlex
|
18 |
+
|
19 |
+
# If extensions (or modules to document with autodoc) are in another directory,
|
20 |
+
# add these directories to sys.path here. If the directory is relative to the
|
21 |
+
# documentation root, use os.path.abspath to make it absolute, like shown here.
|
22 |
+
#sys.path.insert(0, os.path.abspath('.'))
|
23 |
+
|
24 |
+
# -- General configuration ------------------------------------------------
|
25 |
+
|
26 |
+
# If your documentation needs a minimal Sphinx version, state it here.
|
27 |
+
#needs_sphinx = '1.0'
|
28 |
+
|
29 |
+
# Add any Sphinx extension module names here, as strings. They can be
|
30 |
+
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
|
31 |
+
# ones.
|
32 |
+
extensions = [
|
33 |
+
'sphinx.ext.autodoc',
|
34 |
+
'sphinx.ext.doctest',
|
35 |
+
'sphinx.ext.coverage',
|
36 |
+
'sphinx.ext.mathjax',
|
37 |
+
'sphinx.ext.ifconfig',
|
38 |
+
'sphinx.ext.viewcode',
|
39 |
+
]
|
40 |
+
|
41 |
+
# Add any paths that contain templates here, relative to this directory.
|
42 |
+
templates_path = ['ntemplates']
|
43 |
+
|
44 |
+
# The suffix(es) of source filenames.
|
45 |
+
# You can specify multiple suffix as a list of string:
|
46 |
+
# source_suffix = ['.rst', '.md']
|
47 |
+
source_suffix = '.rst'
|
48 |
+
|
49 |
+
# The encoding of source files.
|
50 |
+
#source_encoding = 'utf-8-sig'
|
51 |
+
|
52 |
+
# The master toctree document.
|
53 |
+
master_doc = 'index'
|
54 |
+
|
55 |
+
# General information about the project.
|
56 |
+
project = u'PHP Curl Class'
|
57 |
+
copyright = u'2015, Zach Borboa'
|
58 |
+
author = u'Zach Borboa'
|
59 |
+
|
60 |
+
# The version info for the project you're documenting, acts as replacement for
|
61 |
+
# |version| and |release|, also used in various other places throughout the
|
62 |
+
# built documents.
|
63 |
+
#
|
64 |
+
# The short X.Y version.
|
65 |
+
version = '4.8.1'
|
66 |
+
# The full version, including alpha/beta/rc tags.
|
67 |
+
release = '4.8.1'
|
68 |
+
|
69 |
+
# The language for content autogenerated by Sphinx. Refer to documentation
|
70 |
+
# for a list of supported languages.
|
71 |
+
#
|
72 |
+
# This is also used if you do content translation via gettext catalogs.
|
73 |
+
# Usually you set "language" from the command line for these cases.
|
74 |
+
language = None
|
75 |
+
|
76 |
+
# There are two options for replacing |today|: either, you set today to some
|
77 |
+
# non-false value, then it is used:
|
78 |
+
#today = ''
|
79 |
+
# Else, today_fmt is used as the format for a strftime call.
|
80 |
+
#today_fmt = '%B %d, %Y'
|
81 |
+
|
82 |
+
# List of patterns, relative to source directory, that match files and
|
83 |
+
# directories to ignore when looking for source files.
|
84 |
+
exclude_patterns = []
|
85 |
+
|
86 |
+
# The reST default role (used for this markup: `text`) to use for all
|
87 |
+
# documents.
|
88 |
+
#default_role = None
|
89 |
+
|
90 |
+
# If true, '()' will be appended to :func: etc. cross-reference text.
|
91 |
+
#add_function_parentheses = True
|
92 |
+
|
93 |
+
# If true, the current module name will be prepended to all description
|
94 |
+
# unit titles (such as .. function::).
|
95 |
+
#add_module_names = True
|
96 |
+
|
97 |
+
# If true, sectionauthor and moduleauthor directives will be shown in the
|
98 |
+
# output. They are ignored by default.
|
99 |
+
#show_authors = False
|
100 |
+
|
101 |
+
# The name of the Pygments (syntax highlighting) style to use.
|
102 |
+
pygments_style = 'sphinx'
|
103 |
+
|
104 |
+
# A list of ignored prefixes for module index sorting.
|
105 |
+
#modindex_common_prefix = []
|
106 |
+
|
107 |
+
# If true, keep warnings as "system message" paragraphs in the built documents.
|
108 |
+
#keep_warnings = False
|
109 |
+
|
110 |
+
# If true, `todo` and `todoList` produce output, else they produce nothing.
|
111 |
+
todo_include_todos = False
|
112 |
+
|
113 |
+
|
114 |
+
# -- Options for HTML output ----------------------------------------------
|
115 |
+
|
116 |
+
# The theme to use for HTML and HTML Help pages. See the documentation for
|
117 |
+
# a list of builtin themes.
|
118 |
+
html_theme = 'default'
|
119 |
+
|
120 |
+
# Theme options are theme-specific and customize the look and feel of a theme
|
121 |
+
# further. For a list of options available for each theme, see the
|
122 |
+
# documentation.
|
123 |
+
#html_theme_options = {}
|
124 |
+
|
125 |
+
# Add any paths that contain custom themes here, relative to this directory.
|
126 |
+
#html_theme_path = []
|
127 |
+
|
128 |
+
# The name for this set of Sphinx documents. If None, it defaults to
|
129 |
+
# "<project> v<release> documentation".
|
130 |
+
#html_title = None
|
131 |
+
|
132 |
+
# A shorter title for the navigation bar. Default is the same as html_title.
|
133 |
+
#html_short_title = None
|
134 |
+
|
135 |
+
# The name of an image file (relative to this directory) to place at the top
|
136 |
+
# of the sidebar.
|
137 |
+
#html_logo = None
|
138 |
+
|
139 |
+
# The name of an image file (within the static path) to use as favicon of the
|
140 |
+
# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
|
141 |
+
# pixels large.
|
142 |
+
#html_favicon = None
|
143 |
+
|
144 |
+
# Add any paths that contain custom static files (such as style sheets) here,
|
145 |
+
# relative to this directory. They are copied after the builtin static files,
|
146 |
+
# so a file named "default.css" will overwrite the builtin "default.css".
|
147 |
+
html_static_path = ['nstatic']
|
148 |
+
|
149 |
+
# Add any extra paths that contain custom files (such as robots.txt or
|
150 |
+
# .htaccess) here, relative to this directory. These files are copied
|
151 |
+
# directly to the root of the documentation.
|
152 |
+
#html_extra_path = []
|
153 |
+
|
154 |
+
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
|
155 |
+
# using the given strftime format.
|
156 |
+
#html_last_updated_fmt = '%b %d, %Y'
|
157 |
+
|
158 |
+
# If true, SmartyPants will be used to convert quotes and dashes to
|
159 |
+
# typographically correct entities.
|
160 |
+
#html_use_smartypants = True
|
161 |
+
|
162 |
+
# Custom sidebar templates, maps document names to template names.
|
163 |
+
#html_sidebars = {}
|
164 |
+
|
165 |
+
# Additional templates that should be rendered to pages, maps page names to
|
166 |
+
# template names.
|
167 |
+
#html_additional_pages = {}
|
168 |
+
|
169 |
+
# If false, no module index is generated.
|
170 |
+
#html_domain_indices = True
|
171 |
+
|
172 |
+
# If false, no index is generated.
|
173 |
+
#html_use_index = True
|
174 |
+
|
175 |
+
# If true, the index is split into individual pages for each letter.
|
176 |
+
#html_split_index = False
|
177 |
+
|
178 |
+
# If true, links to the reST sources are added to the pages.
|
179 |
+
#html_show_sourcelink = True
|
180 |
+
|
181 |
+
# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
|
182 |
+
#html_show_sphinx = True
|
183 |
+
|
184 |
+
# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
|
185 |
+
#html_show_copyright = True
|
186 |
+
|
187 |
+
# If true, an OpenSearch description file will be output, and all pages will
|
188 |
+
# contain a <link> tag referring to it. The value of this option must be the
|
189 |
+
# base URL from which the finished HTML is served.
|
190 |
+
#html_use_opensearch = ''
|
191 |
+
|
192 |
+
# This is the file name suffix for HTML files (e.g. ".xhtml").
|
193 |
+
#html_file_suffix = None
|
194 |
+
|
195 |
+
# Language to be used for generating the HTML full-text search index.
|
196 |
+
# Sphinx supports the following languages:
|
197 |
+
# 'da', 'de', 'en', 'es', 'fi', 'fr', 'hu', 'it', 'ja'
|
198 |
+
# 'nl', 'no', 'pt', 'ro', 'ru', 'sv', 'tr'
|
199 |
+
#html_search_language = 'en'
|
200 |
+
|
201 |
+
# A dictionary with options for the search language support, empty by default.
|
202 |
+
# Now only 'ja' uses this config value
|
203 |
+
#html_search_options = {'type': 'default'}
|
204 |
+
|
205 |
+
# The name of a javascript file (relative to the configuration directory) that
|
206 |
+
# implements a search results scorer. If empty, the default will be used.
|
207 |
+
#html_search_scorer = 'scorer.js'
|
208 |
+
|
209 |
+
# Output file base name for HTML help builder.
|
210 |
+
htmlhelp_basename = 'PHPCurlClassdoc'
|
211 |
+
|
212 |
+
# -- Options for LaTeX output ---------------------------------------------
|
213 |
+
|
214 |
+
latex_elements = {
|
215 |
+
# The paper size ('letterpaper' or 'a4paper').
|
216 |
+
#'papersize': 'letterpaper',
|
217 |
+
|
218 |
+
# The font size ('10pt', '11pt' or '12pt').
|
219 |
+
#'pointsize': '10pt',
|
220 |
+
|
221 |
+
# Additional stuff for the LaTeX preamble.
|
222 |
+
#'preamble': '',
|
223 |
+
|
224 |
+
# Latex figure (float) alignment
|
225 |
+
#'figure_align': 'htbp',
|
226 |
+
}
|
227 |
+
|
228 |
+
# Grouping the document tree into LaTeX files. List of tuples
|
229 |
+
# (source start file, target name, title,
|
230 |
+
# author, documentclass [howto, manual, or own class]).
|
231 |
+
latex_documents = [
|
232 |
+
(master_doc, 'PHPCurlClass.tex', u'PHP Curl Class Documentation',
|
233 |
+
u'Zach Borboa', 'manual'),
|
234 |
+
]
|
235 |
+
|
236 |
+
# The name of an image file (relative to this directory) to place at the top of
|
237 |
+
# the title page.
|
238 |
+
#latex_logo = None
|
239 |
+
|
240 |
+
# For "manual" documents, if this is true, then toplevel headings are parts,
|
241 |
+
# not chapters.
|
242 |
+
#latex_use_parts = False
|
243 |
+
|
244 |
+
# If true, show page references after internal links.
|
245 |
+
#latex_show_pagerefs = False
|
246 |
+
|
247 |
+
# If true, show URL addresses after external links.
|
248 |
+
#latex_show_urls = False
|
249 |
+
|
250 |
+
# Documents to append as an appendix to all manuals.
|
251 |
+
#latex_appendices = []
|
252 |
+
|
253 |
+
# If false, no module index is generated.
|
254 |
+
#latex_domain_indices = True
|
255 |
+
|
256 |
+
|
257 |
+
# -- Options for manual page output ---------------------------------------
|
258 |
+
|
259 |
+
# One entry per manual page. List of tuples
|
260 |
+
# (source start file, name, description, authors, manual section).
|
261 |
+
man_pages = [
|
262 |
+
(master_doc, 'phpcurlclass', u'PHP Curl Class Documentation',
|
263 |
+
[author], 1)
|
264 |
+
]
|
265 |
+
|
266 |
+
# If true, show URL addresses after external links.
|
267 |
+
#man_show_urls = False
|
268 |
+
|
269 |
+
|
270 |
+
# -- Options for Texinfo output -------------------------------------------
|
271 |
+
|
272 |
+
# Grouping the document tree into Texinfo files. List of tuples
|
273 |
+
# (source start file, target name, title, author,
|
274 |
+
# dir menu entry, description, category)
|
275 |
+
texinfo_documents = [
|
276 |
+
(master_doc, 'PHPCurlClass', u'PHP Curl Class Documentation',
|
277 |
+
author, 'PHPCurlClass', '',
|
278 |
+
'Miscellaneous'),
|
279 |
+
]
|
280 |
+
|
281 |
+
# Documents to append as an appendix to all manuals.
|
282 |
+
#texinfo_appendices = []
|
283 |
+
|
284 |
+
# If false, no module index is generated.
|
285 |
+
#texinfo_domain_indices = True
|
286 |
+
|
287 |
+
# How to display URL addresses: 'footnote', 'no', or 'inline'.
|
288 |
+
#texinfo_show_urls = 'footnote'
|
289 |
+
|
290 |
+
# If true, do not generate a @detailmenu in the "Top" node's menu.
|
291 |
+
#texinfo_no_detailmenu = False
|
app/code/community/Pay/Payment/vendor/php-curl-class/php-curl-class/docs/source/faq.rst
ADDED
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
===
|
2 |
+
FAQ
|
3 |
+
===
|
4 |
+
|
5 |
+
|
6 |
+
How do I set custom cURL options?
|
7 |
+
=================================
|
8 |
+
|
9 |
+
Set custom `cURL options
|
10 |
+
<https://secure.php.net/manual/en/function.curl-setopt.php>`_ using the
|
11 |
+
``Curl::setOpt`` and ``MultiCurl::setOpt`` methods.
|
12 |
+
|
13 |
+
.. code-block:: php
|
14 |
+
|
15 |
+
$curl->setOpt(CURLOPT_ENCODING , 'gzip');
|
16 |
+
|
17 |
+
Can PHP Curl Class send asynchronous requests?
|
18 |
+
==============================================
|
19 |
+
|
20 |
+
Yes. Use the ``MultiCurl`` class to send an asynchronous requests.
|
21 |
+
|
22 |
+
.. code-block:: php
|
23 |
+
|
24 |
+
require __DIR__ . '/vendor/autoload.php';
|
25 |
+
|
26 |
+
use \Curl\MultiCurl;
|
27 |
+
|
28 |
+
$multi_curl = new MultiCurl();
|
29 |
+
$multi_curl->complete(function($instance) {
|
30 |
+
echo 'call completed' . "\n";
|
31 |
+
echo $instance->response;
|
32 |
+
});
|
33 |
+
$multi_curl->addGet('https://httpbin.org/get');
|
34 |
+
$multi_curl->addGet('https://httpbin.org/get');
|
35 |
+
$multi_curl->addGet('https://httpbin.org/get');
|
36 |
+
echo 'Starting...';
|
37 |
+
$multi_curl->start();
|
38 |
+
echo 'All done!';
|
app/code/community/Pay/Payment/vendor/php-curl-class/php-curl-class/docs/source/index.rst
ADDED
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
.. title:: PHP Curl Class
|
2 |
+
|
3 |
+
============================
|
4 |
+
PHP Curl Class Documentation
|
5 |
+
============================
|
6 |
+
|
7 |
+
PHP Curl Class makes it easy to send HTTP requests and integrate with web APIs.
|
8 |
+
|
9 |
+
.. code-block:: php
|
10 |
+
|
11 |
+
$curl = new Curl();
|
12 |
+
$curl->get('https://httpbin.org/get', array(
|
13 |
+
'q' => 'keyword',
|
14 |
+
));
|
15 |
+
echo $curl->httpStatusCode; // 200
|
16 |
+
echo $curl->responseHeaders['content-type']; // "application/json"
|
17 |
+
|
18 |
+
// Send asynchronous requests.
|
19 |
+
$multi_curl = new MultiCurl();
|
20 |
+
$multi_curl->complete(function($instance) {
|
21 |
+
echo 'call completed' . "\n";
|
22 |
+
echo $instance->response;
|
23 |
+
});
|
24 |
+
$multi_curl->addPost('https://httpbin.org/post');
|
25 |
+
$multi_curl->addGet('https://httpbin.org/get');
|
26 |
+
$multi_curl->addDelete('https://httpbin.org/delete');
|
27 |
+
$multi_curl->start();
|
28 |
+
|
29 |
+
|
30 |
+
User Guide
|
31 |
+
==========
|
32 |
+
|
33 |
+
.. toctree::
|
34 |
+
:maxdepth: 3
|
35 |
+
|
36 |
+
overview
|
37 |
+
faq
|
app/code/community/Pay/Payment/vendor/php-curl-class/php-curl-class/docs/source/overview.rst
ADDED
@@ -0,0 +1,75 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
========
|
2 |
+
Overview
|
3 |
+
========
|
4 |
+
|
5 |
+
Requirements
|
6 |
+
============
|
7 |
+
|
8 |
+
#. PHP 5.3, 5.4, 5.5, 5.6, or HHVM.
|
9 |
+
#. PHP compiled with cURL.
|
10 |
+
|
11 |
+
.. _installation:
|
12 |
+
|
13 |
+
|
14 |
+
Installation
|
15 |
+
============
|
16 |
+
|
17 |
+
The recommended way to install PHP Curl Class is with
|
18 |
+
`Composer <https://getcomposer.org>`_. Composer is a dependency manager for php.
|
19 |
+
|
20 |
+
.. code-block:: bash
|
21 |
+
|
22 |
+
# Install Composer
|
23 |
+
curl -sS https://getcomposer.org/installer | php
|
24 |
+
|
25 |
+
Install PHP Curl Class as a dependency using composer:
|
26 |
+
|
27 |
+
.. code-block:: bash
|
28 |
+
|
29 |
+
composer require php-curl-class/php-curl-class
|
30 |
+
|
31 |
+
Composer generates a ``vendor/autoload.php`` file. You can simply include this
|
32 |
+
file and you will get autoloading for free:
|
33 |
+
|
34 |
+
.. code-block:: php
|
35 |
+
|
36 |
+
require __DIR__ . 'vendor/autoload.php';
|
37 |
+
|
38 |
+
|
39 |
+
License
|
40 |
+
=======
|
41 |
+
|
42 |
+
This is free and unencumbered software released into the public domain.
|
43 |
+
|
44 |
+
Anyone is free to copy, modify, publish, use, compile, sell, or
|
45 |
+
distribute this software, either in source code form or as a compiled
|
46 |
+
binary, for any purpose, commercial or non-commercial, and by any
|
47 |
+
means.
|
48 |
+
|
49 |
+
In jurisdictions that recognize copyright laws, the author or authors
|
50 |
+
of this software dedicate any and all copyright interest in the
|
51 |
+
software to the public domain. We make this dedication for the benefit
|
52 |
+
of the public at large and to the detriment of our heirs and
|
53 |
+
successors. We intend this dedication to be an overt act of
|
54 |
+
relinquishment in perpetuity of all present and future rights to this
|
55 |
+
software under copyright law.
|
56 |
+
|
57 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
58 |
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
59 |
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
60 |
+
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
61 |
+
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
62 |
+
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
63 |
+
OTHER DEALINGS IN THE SOFTWARE.
|
64 |
+
|
65 |
+
For more information, please refer to <http://unlicense.org/>
|
66 |
+
|
67 |
+
|
68 |
+
Contributing
|
69 |
+
============
|
70 |
+
|
71 |
+
#. Check for open issues or open a new issue to start a discussion around a bug or feature.
|
72 |
+
#. Fork the repository on GitHub to start making your changes.
|
73 |
+
#. Write one or more tests for the new feature or that expose the bug.
|
74 |
+
#. Make code changes to implement the feature or fix the bug.
|
75 |
+
#. Send a pull request to get your changes merged and published.
|
app/code/community/Pay/Payment/vendor/php-curl-class/php-curl-class/examples/README.md
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
1 |
+
# Didn't find an example that fits your use case?
|
2 |
+
Please [file a ticket](https://github.com/php-curl-class/php-curl-class/issues/new). Thanks!
|
app/code/community/Pay/Payment/vendor/php-curl-class/php-curl-class/examples/coinbase_account_balance.php
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
require __DIR__ . '/vendor/autoload.php';
|
3 |
+
|
4 |
+
use \Curl\Curl;
|
5 |
+
|
6 |
+
define('API_KEY', '');
|
7 |
+
define('API_SECRET', '');
|
8 |
+
|
9 |
+
$url = 'https://coinbase.com/api/v1/account/balance';
|
10 |
+
|
11 |
+
$nonce = (int)(microtime(true) * 1e6);
|
12 |
+
$message = $nonce . $url;
|
13 |
+
$signature = hash_hmac('sha256', $message, API_SECRET);
|
14 |
+
|
15 |
+
$curl = new Curl();
|
16 |
+
$curl->setHeader('ACCESS_KEY', API_KEY);
|
17 |
+
$curl->setHeader('ACCESS_SIGNATURE', $signature);
|
18 |
+
$curl->setHeader('ACCESS_NONCE', $nonce);
|
19 |
+
$curl->get($url);
|
20 |
+
|
21 |
+
echo
|
22 |
+
'My current account balance at Coinbase is ' .
|
23 |
+
$curl->response->amount . ' ' . $curl->response->currency . '.' . "\n";
|
app/code/community/Pay/Payment/vendor/php-curl-class/php-curl-class/examples/coinbase_spot_rate.php
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
require __DIR__ . '/vendor/autoload.php';
|
3 |
+
|
4 |
+
use \Curl\Curl;
|
5 |
+
|
6 |
+
$curl = new Curl();
|
7 |
+
$curl->setHeader('CB-VERSION', '2016-01-01');
|
8 |
+
$curl->get('https://api.coinbase.com/v2/prices/spot');
|
9 |
+
|
10 |
+
echo
|
11 |
+
'The current price of bitcoin at Coinbase is ' .
|
12 |
+
'$' . $curl->response->data->amount . ' ' . $curl->response->data->currency . '.' . "\n";
|
app/code/community/Pay/Payment/vendor/php-curl-class/php-curl-class/examples/deviant_art_rss.php
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
require __DIR__ . '/vendor/autoload.php';
|
3 |
+
|
4 |
+
use \Curl\Curl;
|
5 |
+
|
6 |
+
$curl = new Curl();
|
7 |
+
$curl->get('http://backend.deviantart.com/rss.xml', array(
|
8 |
+
'q' => 'boost:popular in:photography/people/fashion',
|
9 |
+
'type' => 'deviation',
|
10 |
+
));
|
11 |
+
|
12 |
+
foreach ($curl->response->channel->item as $entry) {
|
13 |
+
$thumbnails = $entry->children('http://search.yahoo.com/mrss/')->thumbnail;
|
14 |
+
foreach ($thumbnails as $thumbnail) {
|
15 |
+
$img = $thumbnail->attributes();
|
16 |
+
echo
|
17 |
+
'<a href="' . $entry->link . '">' .
|
18 |
+
'<img alt="" src="' . $img->url . '" height="' . $img->height . '" width="' . $img->width . '" />' .
|
19 |
+
'</a>';
|
20 |
+
}
|
21 |
+
}
|
app/code/community/Pay/Payment/vendor/php-curl-class/php-curl-class/examples/download_file.php
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
require __DIR__ . '/vendor/autoload.php';
|
3 |
+
|
4 |
+
use \Curl\Curl;
|
5 |
+
|
6 |
+
$curl = new Curl();
|
7 |
+
$curl->download('https://secure.php.net/images/logos/php-med-trans.png', '/tmp/php-med-trans.png');
|
app/code/community/Pay/Payment/vendor/php-curl-class/php-curl-class/examples/download_file_with_callback.php
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
require __DIR__ . '/vendor/autoload.php';
|
3 |
+
|
4 |
+
use \Curl\Curl;
|
5 |
+
|
6 |
+
$curl = new Curl();
|
7 |
+
$curl->download('https://secure.php.net/images/logos/php-med-trans.png', function($instance, $tmpfile) {
|
8 |
+
$save_to_path = '/tmp/' . basename($instance->url);
|
9 |
+
$fh = fopen($save_to_path, 'wb');
|
10 |
+
stream_copy_to_stream($tmpfile, $fh);
|
11 |
+
fclose($fh);
|
12 |
+
});
|
app/code/community/Pay/Payment/vendor/php-curl-class/php-curl-class/examples/flickr.class.php
ADDED
@@ -0,0 +1,118 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
define('FLICKR_API_KEY', 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX');
|
3 |
+
define('FLICKR_API_SECRET', 'XXXXXXXXXXXXXXXX');
|
4 |
+
|
5 |
+
|
6 |
+
class Flickr
|
7 |
+
{
|
8 |
+
public function __construct()
|
9 |
+
{
|
10 |
+
if (session_status() === PHP_SESSION_NONE) {
|
11 |
+
session_start();
|
12 |
+
}
|
13 |
+
}
|
14 |
+
|
15 |
+
public function authenticate()
|
16 |
+
{
|
17 |
+
if (isset($_SESSION['authenticated']) && $_SESSION['authenticated']) {
|
18 |
+
return;
|
19 |
+
}
|
20 |
+
|
21 |
+
if (isset($_GET['oauth_token']) && isset($_GET['oauth_verifier'])) {
|
22 |
+
$this->getAccessToken();
|
23 |
+
} else {
|
24 |
+
$this->getRequestToken();
|
25 |
+
}
|
26 |
+
}
|
27 |
+
|
28 |
+
public function uploadPhoto()
|
29 |
+
{
|
30 |
+
$oauth_data = $this->getOAuthParameters();
|
31 |
+
$oauth_data['oauth_token'] = $_SESSION['oauth_access_token'];
|
32 |
+
$oauth_data['title'] = $_POST['title'];
|
33 |
+
$oauth_data['tags'] = $_POST['tags'];
|
34 |
+
|
35 |
+
$upload_url = 'https://up.flickr.com/services/upload/';
|
36 |
+
$oauth_data['oauth_signature'] = $this->getSignature('POST', $upload_url, $oauth_data);
|
37 |
+
$oauth_data['photo'] = '@' . $_FILES['photo']['tmp_name'];
|
38 |
+
|
39 |
+
$curl = new Curl();
|
40 |
+
$curl->post($upload_url, $oauth_data);
|
41 |
+
return $curl;
|
42 |
+
}
|
43 |
+
|
44 |
+
private function getOAuthParameters()
|
45 |
+
{
|
46 |
+
return array(
|
47 |
+
'oauth_nonce' => md5(microtime() . mt_rand()),
|
48 |
+
'oauth_timestamp' => time(),
|
49 |
+
'oauth_consumer_key' => FLICKR_API_KEY,
|
50 |
+
'oauth_signature_method' => 'HMAC-SHA1',
|
51 |
+
'oauth_version' => '1.0',
|
52 |
+
);
|
53 |
+
}
|
54 |
+
|
55 |
+
private function getSignature($request_method, $url, $parameters)
|
56 |
+
{
|
57 |
+
ksort($parameters, SORT_STRING);
|
58 |
+
$request = implode('&', array(
|
59 |
+
rawurlencode($request_method),
|
60 |
+
rawurlencode($url),
|
61 |
+
rawurlencode(http_build_query($parameters, '', '&', PHP_QUERY_RFC3986)),
|
62 |
+
));
|
63 |
+
$key = FLICKR_API_SECRET . '&';
|
64 |
+
if (!empty($_SESSION['oauth_access_token_secret'])) {
|
65 |
+
$key .= $_SESSION['oauth_access_token_secret'];
|
66 |
+
} elseif (!empty($_SESSION['oauth_token_secret'])) {
|
67 |
+
$key .= $_SESSION['oauth_token_secret'];
|
68 |
+
}
|
69 |
+
$signature = base64_encode(hash_hmac('sha1', $request, $key, true));
|
70 |
+
return $signature;
|
71 |
+
}
|
72 |
+
|
73 |
+
private function getRequestToken()
|
74 |
+
{
|
75 |
+
$oauth_data = $this->getOAuthParameters();
|
76 |
+
$oauth_data['oauth_callback'] = implode('', array(
|
77 |
+
isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? 'https' : 'http',
|
78 |
+
'://',
|
79 |
+
$_SERVER['SERVER_NAME'],
|
80 |
+
$_SERVER['SCRIPT_NAME'],
|
81 |
+
));
|
82 |
+
|
83 |
+
$request_token_url = 'https://www.flickr.com/services/oauth/request_token';
|
84 |
+
$oauth_data['oauth_signature'] = $this->getSignature('POST', $request_token_url, $oauth_data);
|
85 |
+
|
86 |
+
$curl = new Curl();
|
87 |
+
$curl->post($request_token_url, $oauth_data);
|
88 |
+
|
89 |
+
parse_str($curl->response, $parts);
|
90 |
+
$_SESSION['oauth_token_secret'] = $parts['oauth_token_secret'];
|
91 |
+
|
92 |
+
// Continue to Flickr for user's authorization.
|
93 |
+
header('Location: https://secure.flickr.com/services/oauth/authorize?' . http_build_query(array(
|
94 |
+
'oauth_token' => $parts['oauth_token'],
|
95 |
+
'perms' => 'write',
|
96 |
+
)));
|
97 |
+
exit;
|
98 |
+
}
|
99 |
+
|
100 |
+
private function getAccessToken()
|
101 |
+
{
|
102 |
+
$oauth_data = $this->getOAuthParameters();
|
103 |
+
$oauth_data['oauth_token'] = $_GET['oauth_token'];
|
104 |
+
$oauth_data['oauth_verifier'] = $_GET['oauth_verifier'];
|
105 |
+
|
106 |
+
$access_token_url = 'https://www.flickr.com/services/oauth/access_token';
|
107 |
+
$oauth_data['oauth_signature'] = $this->getSignature('POST', $access_token_url, $oauth_data);
|
108 |
+
|
109 |
+
$curl = new Curl();
|
110 |
+
$curl->post($access_token_url, $oauth_data);
|
111 |
+
|
112 |
+
parse_str($curl->response, $parts);
|
113 |
+
$_SESSION['oauth_access_token'] = $parts['oauth_token'];
|
114 |
+
$_SESSION['oauth_access_token_secret'] = $parts['oauth_token_secret'];
|
115 |
+
$_SESSION['user_id'] = $parts['user_nsid'];
|
116 |
+
$_SESSION['authenticated'] = true;
|
117 |
+
}
|
118 |
+
}
|
app/code/community/Pay/Payment/vendor/php-curl-class/php-curl-class/examples/flickr_photo_search.php
ADDED
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
require __DIR__ . '/vendor/autoload.php';
|
3 |
+
|
4 |
+
use \Curl\Curl;
|
5 |
+
|
6 |
+
function construct_url($photo, $size = 's', $ext = 'jpg')
|
7 |
+
{
|
8 |
+
$url = 'http://farm' . $photo->farm . '.staticflickr.com/' . $photo->server . '/' .
|
9 |
+
$photo->id . '_' . $photo->secret . '_' . $size . '.' . $ext;
|
10 |
+
|
11 |
+
return $url;
|
12 |
+
}
|
13 |
+
|
14 |
+
define('FLICKR_API_KEY', 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX');
|
15 |
+
|
16 |
+
$data = array(
|
17 |
+
'method' => 'flickr.photos.search',
|
18 |
+
'api_key' => FLICKR_API_KEY,
|
19 |
+
'text' => 'happy',
|
20 |
+
'sort' => 'interestingness-desc',
|
21 |
+
'safe_search' => '3',
|
22 |
+
'format' => 'json',
|
23 |
+
'nojsoncallback' => '1',
|
24 |
+
);
|
25 |
+
|
26 |
+
$curl = new Curl();
|
27 |
+
$curl->get('https://api.flickr.com/services/rest/', $data);
|
28 |
+
|
29 |
+
foreach ($curl->response->photos->photo as $photo) {
|
30 |
+
echo '<img alt="" src="' . construct_url($photo) . '" height="75" width="75" />';
|
31 |
+
}
|
app/code/community/Pay/Payment/vendor/php-curl-class/php-curl-class/examples/flickr_upload_photo.php
ADDED
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
require __DIR__ . '/vendor/autoload.php';
|
3 |
+
require 'flickr.class.php';
|
4 |
+
|
5 |
+
use \Curl\Curl;
|
6 |
+
|
7 |
+
$flickr = new Flickr();
|
8 |
+
$flickr->authenticate();
|
9 |
+
?>
|
10 |
+
<!doctype html>
|
11 |
+
<html>
|
12 |
+
<head>
|
13 |
+
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
|
14 |
+
<title>Flickr Photo Upload</title>
|
15 |
+
</head>
|
16 |
+
<body>
|
17 |
+
|
18 |
+
<?php
|
19 |
+
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
20 |
+
$result = $flickr->uploadPhoto();
|
21 |
+
if ($result->error) {
|
22 |
+
echo '<p>Photo upload failed.</p>';
|
23 |
+
} else {
|
24 |
+
$user_id = $_SESSION['user_id'];
|
25 |
+
$photo_id = $result->response->photoid;
|
26 |
+
$photo_url = 'http://www.flickr.com/photos/' . $user_id . '/' . $photo_id;
|
27 |
+
echo '<p>Photo uploaded successfully. <a href="' . $photo_url . '">View photo</a>.</p>';
|
28 |
+
}
|
29 |
+
}
|
30 |
+
?>
|
31 |
+
|
32 |
+
<form enctype="multipart/form-data" method="post">
|
33 |
+
<fieldset>
|
34 |
+
<legend>Flickr Photo Upload</legend>
|
35 |
+
<label>Photo <input name="photo" type="file" /></label><br />
|
36 |
+
<label>Title <input name="title" placeholder="Vacation (optional)" type="text" /></label><br />
|
37 |
+
<label>Tags <input name="tags" placeholder="tropical,beach,vacation (optional)" type="text" /></label><br />
|
38 |
+
<input type="submit" />
|
39 |
+
</fieldset>
|
40 |
+
</form>
|
41 |
+
|
42 |
+
</body>
|
43 |
+
</html>
|
app/code/community/Pay/Payment/vendor/php-curl-class/php-curl-class/examples/get.php
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
require __DIR__ . '/vendor/autoload.php';
|
3 |
+
|
4 |
+
use \Curl\Curl;
|
5 |
+
|
6 |
+
$curl = new Curl();
|
7 |
+
for ($i = 1; $i <= 10; $i++) {
|
8 |
+
$curl->get('https://httpbin.org/get', array(
|
9 |
+
'page' => $i,
|
10 |
+
));
|
11 |
+
// TODO: Do something with result $curl->response.
|
12 |
+
}
|
app/code/community/Pay/Payment/vendor/php-curl-class/php-curl-class/examples/get_base_url_1.php
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
require __DIR__ . '/vendor/autoload.php';
|
3 |
+
|
4 |
+
use \Curl\Curl;
|
5 |
+
|
6 |
+
$curl = new Curl('https://httpbin.org/get');
|
7 |
+
for ($i = 1; $i <= 10; $i++) {
|
8 |
+
$curl->get(array(
|
9 |
+
'page' => $i,
|
10 |
+
));
|
11 |
+
// TODO: Do something with result $curl->response.
|
12 |
+
}
|
app/code/community/Pay/Payment/vendor/php-curl-class/php-curl-class/examples/get_base_url_2.php
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
require __DIR__ . '/vendor/autoload.php';
|
3 |
+
|
4 |
+
use \Curl\Curl;
|
5 |
+
|
6 |
+
$curl = new Curl();
|
7 |
+
$curl->setUrl('https://httpbin.org/get');
|
8 |
+
for ($i = 1; $i <= 10; $i++) {
|
9 |
+
$curl->get(array(
|
10 |
+
'page' => $i,
|
11 |
+
));
|
12 |
+
// TODO: Do something with result $curl->response.
|
13 |
+
}
|
app/code/community/Pay/Payment/vendor/php-curl-class/php-curl-class/examples/github_create_gist.php
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
require __DIR__ . '/vendor/autoload.php';
|
3 |
+
|
4 |
+
use \Curl\Curl;
|
5 |
+
|
6 |
+
$content = <<<EOF
|
7 |
+
<?php
|
8 |
+
echo 'hello, world';
|
9 |
+
EOF;
|
10 |
+
|
11 |
+
$curl = new Curl();
|
12 |
+
$curl->post('https://api.github.com/gists', json_encode(array(
|
13 |
+
'description' => 'PHP-Curl-Class test.',
|
14 |
+
'public' => 'true',
|
15 |
+
'files' => array(
|
16 |
+
'Untitled.php' => array(
|
17 |
+
'content' => $content,
|
18 |
+
),
|
19 |
+
),
|
20 |
+
)));
|
21 |
+
|
22 |
+
echo 'Gist created at ' . $curl->response->html_url . "\n";
|
app/code/community/Pay/Payment/vendor/php-curl-class/php-curl-class/examples/gmail_send_email.php
ADDED
@@ -0,0 +1,80 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
require __DIR__ . '/vendor/autoload.php';
|
3 |
+
|
4 |
+
use \Curl\Curl;
|
5 |
+
|
6 |
+
define('CLIENT_ID', 'XXXXXXXXXXXX.apps.googleusercontent.com');
|
7 |
+
define('CLIENT_SECRET', 'XXXXXXXXXXXXXXXXXXXXXXXX');
|
8 |
+
|
9 |
+
session_start();
|
10 |
+
|
11 |
+
if (isset($_GET['code'])) {
|
12 |
+
$code = $_GET['code'];
|
13 |
+
|
14 |
+
// Exchange the authorization code for an access token.
|
15 |
+
$curl = new Curl();
|
16 |
+
$curl->post('https://accounts.google.com/o/oauth2/token', array(
|
17 |
+
'code' => $code,
|
18 |
+
'client_id' => CLIENT_ID,
|
19 |
+
'client_secret' => CLIENT_SECRET,
|
20 |
+
'redirect_uri' => implode('', array(
|
21 |
+
isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? 'https' : 'http',
|
22 |
+
'://',
|
23 |
+
$_SERVER['SERVER_NAME'],
|
24 |
+
$_SERVER['SCRIPT_NAME'],
|
25 |
+
)),
|
26 |
+
'grant_type' => 'authorization_code',
|
27 |
+
));
|
28 |
+
|
29 |
+
if ($curl->error) {
|
30 |
+
echo $curl->response->error . ': ' . $curl->response->error_description;
|
31 |
+
exit;
|
32 |
+
}
|
33 |
+
|
34 |
+
$_SESSION['access_token'] = $curl->response->access_token;
|
35 |
+
header('Location: ?');
|
36 |
+
} elseif (!empty($_SESSION['access_token'])) {
|
37 |
+
// Use the access token to send an email.
|
38 |
+
$curl = new Curl();
|
39 |
+
$curl->setHeader('Content-Type', 'message/rfc822');
|
40 |
+
$curl->setHeader('Authorization', 'OAuth ' . $_SESSION['access_token']);
|
41 |
+
|
42 |
+
$boundary = md5(time());
|
43 |
+
$raw =
|
44 |
+
'MIME-Version: 1.0' . "\r\n" .
|
45 |
+
'Subject: hi' . "\r\n" .
|
46 |
+
'To: John Doe <jdoe@example.com>' . "\r\n" .
|
47 |
+
'Content-Type: multipart/alternative; boundary=' . $boundary . "\r\n" .
|
48 |
+
"\r\n" .
|
49 |
+
'--' . $boundary . "\r\n" .
|
50 |
+
'Content-Type: text/plain; charset=UTF-8' . "\r\n" .
|
51 |
+
"\r\n" .
|
52 |
+
'hello, world' . "\r\n" .
|
53 |
+
"\r\n" .
|
54 |
+
'--' . $boundary . "\r\n" .
|
55 |
+
'Content-Type: text/html; charset=UTF-8' . "\r\n" .
|
56 |
+
"\r\n" .
|
57 |
+
'<em>hello, world</em>' . "\r\n" .
|
58 |
+
'';
|
59 |
+
|
60 |
+
$curl->post('https://www.googleapis.com/upload/gmail/v1/users/me/messages/send', $raw);
|
61 |
+
|
62 |
+
echo 'Email ' . $curl->response->id . ' was sent.';
|
63 |
+
} else {
|
64 |
+
$curl = new Curl();
|
65 |
+
$curl->get('https://accounts.google.com/o/oauth2/auth', array(
|
66 |
+
'scope' => 'https://www.googleapis.com/auth/gmail.compose',
|
67 |
+
'redirect_uri' => implode('', array(
|
68 |
+
isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? 'https' : 'http',
|
69 |
+
'://',
|
70 |
+
$_SERVER['SERVER_NAME'],
|
71 |
+
$_SERVER['SCRIPT_NAME'],
|
72 |
+
)),
|
73 |
+
'response_type' => 'code',
|
74 |
+
'client_id' => CLIENT_ID,
|
75 |
+
'approval_prompt' => 'force',
|
76 |
+
));
|
77 |
+
|
78 |
+
$url = $curl->responseHeaders['Location'];
|
79 |
+
echo '<a href="' . $url . '">Continue</a>';
|
80 |
+
}
|
app/code/community/Pay/Payment/vendor/php-curl-class/php-curl-class/examples/google_maps_geocode_address.php
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
require __DIR__ . '/vendor/autoload.php';
|
3 |
+
|
4 |
+
use \Curl\Curl;
|
5 |
+
|
6 |
+
$address = 'Paris, France';
|
7 |
+
$curl = new Curl();
|
8 |
+
$curl->get('http://maps.googleapis.com/maps/api/geocode/json', array(
|
9 |
+
'address' => $address,
|
10 |
+
));
|
11 |
+
|
12 |
+
if ($curl->response->status === 'OK') {
|
13 |
+
$result = $curl->response->results['0'];
|
14 |
+
echo
|
15 |
+
$result->formatted_address . ' is located at ' .
|
16 |
+
'latitude ' . $result->geometry->location->lat . ' and ' .
|
17 |
+
'longitude ' . $result->geometry->location->lng . '.';
|
18 |
+
}
|
app/code/community/Pay/Payment/vendor/php-curl-class/php-curl-class/examples/google_plus_profile.php
ADDED
@@ -0,0 +1,67 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
require __DIR__ . '/vendor/autoload.php';
|
3 |
+
|
4 |
+
use \Curl\Curl;
|
5 |
+
|
6 |
+
define('CLIENT_ID', 'XXXXXXXXXXXX.apps.googleusercontent.com');
|
7 |
+
define('CLIENT_SECRET', 'XXXXXXXXXXXXXXXXXXXXXXXX');
|
8 |
+
|
9 |
+
session_start();
|
10 |
+
|
11 |
+
if (isset($_GET['code'])) {
|
12 |
+
$code = $_GET['code'];
|
13 |
+
|
14 |
+
// Exchange the authorization code for an access token.
|
15 |
+
$curl = new Curl();
|
16 |
+
$curl->post('https://accounts.google.com/o/oauth2/token', array(
|
17 |
+
'code' => $code,
|
18 |
+
'client_id' => CLIENT_ID,
|
19 |
+
'client_secret' => CLIENT_SECRET,
|
20 |
+
'redirect_uri' => implode('', array(
|
21 |
+
isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? 'https' : 'http',
|
22 |
+
'://',
|
23 |
+
$_SERVER['SERVER_NAME'],
|
24 |
+
$_SERVER['SCRIPT_NAME'],
|
25 |
+
)),
|
26 |
+
'grant_type' => 'authorization_code',
|
27 |
+
));
|
28 |
+
|
29 |
+
if ($curl->error) {
|
30 |
+
echo $curl->response->error . ': ' . $curl->response->error_description;
|
31 |
+
exit;
|
32 |
+
}
|
33 |
+
|
34 |
+
$_SESSION['access_token'] = $curl->response->access_token;
|
35 |
+
header('Location: ?');
|
36 |
+
} elseif (!empty($_SESSION['access_token']) && !isset($_GET['retry'])) {
|
37 |
+
// Use the access token to retrieve the profile.
|
38 |
+
$curl = new Curl();
|
39 |
+
$curl->setHeader('Content-Type', 'application/json');
|
40 |
+
$curl->setHeader('Authorization', 'OAuth ' . $_SESSION['access_token']);
|
41 |
+
$curl->get('https://www.googleapis.com/plus/v1/people/me');
|
42 |
+
|
43 |
+
if ($curl->error) {
|
44 |
+
echo 'Error ' . $curl->response->error->code . ': ' . $curl->response->error->message . '.<br />';
|
45 |
+
echo '<a href="?retry">Retry?</a>';
|
46 |
+
exit;
|
47 |
+
}
|
48 |
+
|
49 |
+
echo 'Hi ' . $curl->response->displayName . '.';
|
50 |
+
} else {
|
51 |
+
$curl = new Curl();
|
52 |
+
$curl->get('https://accounts.google.com/o/oauth2/auth', array(
|
53 |
+
'scope' => 'https://www.googleapis.com/auth/plus.me',
|
54 |
+
'redirect_uri' => implode('', array(
|
55 |
+
isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? 'https' : 'http',
|
56 |
+
'://',
|
57 |
+
$_SERVER['SERVER_NAME'],
|
58 |
+
$_SERVER['SCRIPT_NAME'],
|
59 |
+
)),
|
60 |
+
'response_type' => 'code',
|
61 |
+
'client_id' => CLIENT_ID,
|
62 |
+
'approval_prompt' => 'force',
|
63 |
+
));
|
64 |
+
|
65 |
+
$url = $curl->responseHeaders['Location'];
|
66 |
+
echo '<a href="' . $url . '">Continue</a>';
|
67 |
+
}
|
app/code/community/Pay/Payment/vendor/php-curl-class/php-curl-class/examples/gratipay_send_tip.php
ADDED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
require __DIR__ . '/vendor/autoload.php';
|
3 |
+
|
4 |
+
use \Curl\Curl;
|
5 |
+
|
6 |
+
define('GRATIPAY_USERNAME', 'XXXXXXXXXX');
|
7 |
+
define('GRATIPAY_API_KEY', 'XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX');
|
8 |
+
|
9 |
+
$data = array(
|
10 |
+
array(
|
11 |
+
'username' => 'user' . mt_rand(),
|
12 |
+
'platform' => 'gratipay',
|
13 |
+
'amount' => '0.02',
|
14 |
+
),
|
15 |
+
array(
|
16 |
+
'username' => 'user' . mt_rand(),
|
17 |
+
'platform' => 'gratipay',
|
18 |
+
'amount' => '0.02',
|
19 |
+
),
|
20 |
+
);
|
21 |
+
|
22 |
+
$curl = new Curl();
|
23 |
+
$curl->setHeader('Content-Type', 'application/json');
|
24 |
+
$curl->setBasicAuthentication(GRATIPAY_API_KEY);
|
25 |
+
$curl->post('https://gratipay.com/' . GRATIPAY_USERNAME . '/tips.json', json_encode($data));
|
26 |
+
|
27 |
+
foreach ($curl->response as $tip) {
|
28 |
+
echo $tip->amount . ' given to ' . $tip->username . '.' . "\n";
|
29 |
+
}
|
app/code/community/Pay/Payment/vendor/php-curl-class/php-curl-class/examples/instagram_popular_media.php
ADDED
@@ -0,0 +1,57 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
require __DIR__ . '/vendor/autoload.php';
|
3 |
+
|
4 |
+
use \Curl\Curl;
|
5 |
+
|
6 |
+
define('INSTAGRAM_CLIENT_ID', 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX');
|
7 |
+
define('INSTAGRAM_CLIENT_SECRET', 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX');
|
8 |
+
|
9 |
+
session_start();
|
10 |
+
|
11 |
+
$redirect_uri = implode('', array(
|
12 |
+
isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? 'https' : 'http',
|
13 |
+
'://',
|
14 |
+
$_SERVER['SERVER_NAME'],
|
15 |
+
$_SERVER['SCRIPT_NAME'],
|
16 |
+
));
|
17 |
+
|
18 |
+
if (isset($_GET['code'])) {
|
19 |
+
$code = $_GET['code'];
|
20 |
+
|
21 |
+
$curl = new Curl();
|
22 |
+
$curl->post('https://api.instagram.com/oauth/access_token', array(
|
23 |
+
'client_id' => INSTAGRAM_CLIENT_ID,
|
24 |
+
'client_secret' => INSTAGRAM_CLIENT_SECRET,
|
25 |
+
'grant_type' => 'authorization_code',
|
26 |
+
'redirect_uri' => $redirect_uri,
|
27 |
+
'code' => $code,
|
28 |
+
));
|
29 |
+
|
30 |
+
if ($curl->error) {
|
31 |
+
echo $curl->response->error_type . ': ' . $curl->response->errorMessage . '<br />';
|
32 |
+
echo '<a href="?">Try again?</a>';
|
33 |
+
exit;
|
34 |
+
}
|
35 |
+
|
36 |
+
$_SESSION['access_token'] = $curl->response->access_token;
|
37 |
+
}
|
38 |
+
|
39 |
+
if (isset($_SESSION['access_token'])) {
|
40 |
+
$curl = new Curl();
|
41 |
+
$curl->get('https://api.instagram.com/v1/media/popular', array(
|
42 |
+
'access_token' => $_SESSION['access_token'],
|
43 |
+
));
|
44 |
+
foreach ($curl->response->data as $media) {
|
45 |
+
echo
|
46 |
+
'<a href="' . $media->link . '" target="_blank">' .
|
47 |
+
'<img alt="" src="' . $media->images->thumbnail->url . '" />' .
|
48 |
+
'</a>';
|
49 |
+
}
|
50 |
+
} else {
|
51 |
+
header('Location: https://api.instagram.com/oauth/authorize/?' . http_build_query(array(
|
52 |
+
'client_id' => INSTAGRAM_CLIENT_ID,
|
53 |
+
'redirect_uri' => $redirect_uri,
|
54 |
+
'response_type' => 'code',
|
55 |
+
)));
|
56 |
+
exit;
|
57 |
+
}
|
app/code/community/Pay/Payment/vendor/php-curl-class/php-curl-class/examples/instagram_search_photos.php
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
require __DIR__ . '/vendor/autoload.php';
|
3 |
+
|
4 |
+
use \Curl\Curl;
|
5 |
+
|
6 |
+
define('INSTAGRAM_CLIENT_ID', 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX');
|
7 |
+
|
8 |
+
$curl = new Curl();
|
9 |
+
$curl->get('https://api.instagram.com/v1/media/search', array(
|
10 |
+
'client_id' => INSTAGRAM_CLIENT_ID,
|
11 |
+
'lat' => '37.8296',
|
12 |
+
'lng' => '-122.4832',
|
13 |
+
));
|
14 |
+
|
15 |
+
foreach ($curl->response->data as $media) {
|
16 |
+
$image = $media->images->low_resolution;
|
17 |
+
echo '<img alt="" src="' . $image->url . '" width="' . $image->width . '" height="' . $image->height . '" />';
|
18 |
+
}
|
app/code/community/Pay/Payment/vendor/php-curl-class/php-curl-class/examples/mailchimp_subscribe_email_address.php
ADDED
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
require __DIR__ . '/vendor/autoload.php';
|
3 |
+
|
4 |
+
use \Curl\Curl;
|
5 |
+
|
6 |
+
define('MAILCHIMP_API_KEY', 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX-XXX');
|
7 |
+
$parts = explode('-', MAILCHIMP_API_KEY);
|
8 |
+
define('MAILCHIMP_BASE_URL', 'https://' . $parts['1'] . '.api.mailchimp.com/2.0/');
|
9 |
+
|
10 |
+
|
11 |
+
$curl = new Curl();
|
12 |
+
$curl->get(MAILCHIMP_BASE_URL . '/lists/list.json', array(
|
13 |
+
'apikey' => MAILCHIMP_API_KEY,
|
14 |
+
));
|
15 |
+
|
16 |
+
if ($curl->response->total === 0) {
|
17 |
+
echo 'No lists found';
|
18 |
+
exit;
|
19 |
+
}
|
20 |
+
|
21 |
+
$lists = $curl->response->data;
|
22 |
+
$list = $lists['0'];
|
23 |
+
|
24 |
+
$curl->post(MAILCHIMP_BASE_URL . '/lists/subscribe.json', array(
|
25 |
+
'apikey' => MAILCHIMP_API_KEY,
|
26 |
+
'id' => $list->id,
|
27 |
+
'email' => array(
|
28 |
+
'email' => 'user@example.com',
|
29 |
+
),
|
30 |
+
));
|
31 |
+
|
32 |
+
if ($curl->error) {
|
33 |
+
echo $curl->response->name . ': ' . $curl->response->error . "\n";
|
34 |
+
} else {
|
35 |
+
echo 'Subscribed ' . $curl->response->email . '.' . "\n";
|
36 |
+
}
|
app/code/community/Pay/Payment/vendor/php-curl-class/php-curl-class/examples/multi_curl_before_send.php
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
require __DIR__ . '/vendor/autoload.php';
|
3 |
+
|
4 |
+
use \Curl\MultiCurl;
|
5 |
+
|
6 |
+
$headers = array(
|
7 |
+
'Content-Type' => 'application/json',
|
8 |
+
'X-CUSTOM-HEADER' => 'my-custom-header',
|
9 |
+
);
|
10 |
+
|
11 |
+
$multi_curl = new MultiCurl();
|
12 |
+
|
13 |
+
$multi_curl->beforeSend(function ($instance) use ($headers) {
|
14 |
+
foreach ($headers as $key => $value) {
|
15 |
+
$instance->setHeader($key, $value);
|
16 |
+
}
|
17 |
+
});
|
18 |
+
|
19 |
+
$multi_curl->addGet('https://www.example.com/');
|
20 |
+
$multi_curl->addGet('https://www.example.org/');
|
21 |
+
$multi_curl->addGet('https://www.example.net/');
|
22 |
+
|
23 |
+
$multi_curl->start();
|
app/code/community/Pay/Payment/vendor/php-curl-class/php-curl-class/examples/multi_curl_delete.php
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
require __DIR__ . '/vendor/autoload.php';
|
3 |
+
|
4 |
+
use \Curl\MultiCurl;
|
5 |
+
|
6 |
+
$multi_curl = new MultiCurl();
|
7 |
+
|
8 |
+
$multi_curl->addDelete('https://httpbin.org/delete', array(
|
9 |
+
'id' => '123',
|
10 |
+
));
|
11 |
+
$multi_curl->addDelete('https://httpbin.org/delete', array(
|
12 |
+
'id' => '456',
|
13 |
+
));
|
14 |
+
|
15 |
+
$multi_curl->start();
|
app/code/community/Pay/Payment/vendor/php-curl-class/php-curl-class/examples/multi_curl_download.php
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
require __DIR__ . '/vendor/autoload.php';
|
3 |
+
|
4 |
+
use \Curl\MultiCurl;
|
5 |
+
|
6 |
+
$multi_curl = new MultiCurl();
|
7 |
+
$multi_curl->addDownload('https://secure.php.net/images/logos/php-med-trans.png', '/tmp/php-med-trans.png');
|
8 |
+
$multi_curl->addDownload('https://upload.wikimedia.org/wikipedia/commons/c/c1/PHP_Logo.png', '/tmp/PHP_Logo.png');
|
9 |
+
$multi_curl->start();
|
app/code/community/Pay/Payment/vendor/php-curl-class/php-curl-class/examples/multi_curl_download_with_callback.php
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
require __DIR__ . '/vendor/autoload.php';
|
3 |
+
|
4 |
+
use \Curl\MultiCurl;
|
5 |
+
|
6 |
+
$callback = function($instance, $tmpfile) {
|
7 |
+
$save_to_path = '/tmp/' . basename($instance->url);
|
8 |
+
$fh = fopen($save_to_path, 'wb');
|
9 |
+
stream_copy_to_stream($tmpfile, $fh);
|
10 |
+
fclose($fh);
|
11 |
+
};
|
12 |
+
|
13 |
+
$multi_curl = new MultiCurl();
|
14 |
+
$multi_curl->addDownload('https://secure.php.net/images/logos/php-med-trans.png', $callback);
|
15 |
+
$multi_curl->addDownload('https://upload.wikimedia.org/wikipedia/commons/c/c1/PHP_Logo.png', $callback);
|
16 |
+
$multi_curl->start();
|
app/code/community/Pay/Payment/vendor/php-curl-class/php-curl-class/examples/multi_curl_get.php
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
require __DIR__ . '/vendor/autoload.php';
|
3 |
+
|
4 |
+
use \Curl\MultiCurl;
|
5 |
+
|
6 |
+
$multi_curl = new MultiCurl();
|
7 |
+
|
8 |
+
$multi_curl->addGet('https://www.google.com/search', array(
|
9 |
+
'q' => 'hello world',
|
10 |
+
));
|
11 |
+
$multi_curl->addGet('https://duckduckgo.com/', array(
|
12 |
+
'q' => 'hello world',
|
13 |
+
));
|
14 |
+
$multi_curl->addGet('https://www.bing.com/search', array(
|
15 |
+
'q' => 'hello world',
|
16 |
+
));
|
17 |
+
|
18 |
+
$multi_curl->start();
|
app/code/community/Pay/Payment/vendor/php-curl-class/php-curl-class/examples/multi_curl_get_callbacks.php
ADDED
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
require __DIR__ . '/vendor/autoload.php';
|
3 |
+
|
4 |
+
use \Curl\MultiCurl;
|
5 |
+
|
6 |
+
$multi_curl = new MultiCurl();
|
7 |
+
|
8 |
+
$multi_curl->success(function($instance) {
|
9 |
+
echo 'call to "' . $instance->url . '" was successful.' . "\n";
|
10 |
+
echo 'response: ' . $instance->response . "\n";
|
11 |
+
});
|
12 |
+
$multi_curl->error(function($instance) {
|
13 |
+
echo 'call to "' . $instance->url . '" was unsuccessful.' . "\n";
|
14 |
+
echo 'error code: ' . $instance->errorCode . "\n";
|
15 |
+
echo 'error message: ' . $instance->errorMessage . "\n";
|
16 |
+
});
|
17 |
+
$multi_curl->complete(function($instance) {
|
18 |
+
echo 'call completed' . "\n";
|
19 |
+
});
|
20 |
+
|
21 |
+
$multi_curl->addGet('https://www.google.com/search', array(
|
22 |
+
'q' => 'hello world',
|
23 |
+
));
|
24 |
+
$multi_curl->addGet('https://duckduckgo.com/', array(
|
25 |
+
'q' => 'hello world',
|
26 |
+
));
|
27 |
+
$multi_curl->addGet('https://www.bing.com/search', array(
|
28 |
+
'q' => 'hello world',
|
29 |
+
));
|
30 |
+
|
31 |
+
$multi_curl->start();
|
app/code/community/Pay/Payment/vendor/php-curl-class/php-curl-class/examples/multi_curl_patch.php
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
require __DIR__ . '/vendor/autoload.php';
|
3 |
+
|
4 |
+
use \Curl\MultiCurl;
|
5 |
+
|
6 |
+
$multi_curl = new MultiCurl();
|
7 |
+
|
8 |
+
$multi_curl->addPatch('https://httpbin.org/patch', array(
|
9 |
+
'id' => '123',
|
10 |
+
'body' => 'hello world!',
|
11 |
+
));
|
12 |
+
$multi_curl->addPatch('https://httpbin.org/patch', array(
|
13 |
+
'id' => '456',
|
14 |
+
'body' => 'hello world!',
|
15 |
+
));
|
16 |
+
|
17 |
+
$multi_curl->start();
|
app/code/community/Pay/Payment/vendor/php-curl-class/php-curl-class/examples/multi_curl_post.php
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
require __DIR__ . '/vendor/autoload.php';
|
3 |
+
|
4 |
+
use \Curl\MultiCurl;
|
5 |
+
|
6 |
+
$multi_curl = new MultiCurl();
|
7 |
+
|
8 |
+
$multi_curl->addPost('https://httpbin.org/post', array(
|
9 |
+
'to' => 'alice',
|
10 |
+
'subject' => 'hi',
|
11 |
+
'body' => 'hi Alice',
|
12 |
+
));
|
13 |
+
$multi_curl->addPost('https://httpbin.org/post', array(
|
14 |
+
'to' => 'bob',
|
15 |
+
'subject' => 'hi',
|
16 |
+
'body' => 'hi Bob',
|
17 |
+
));
|
18 |
+
|
19 |
+
$multi_curl->start();
|
app/code/community/Pay/Payment/vendor/php-curl-class/php-curl-class/examples/multi_curl_put.php
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
require __DIR__ . '/vendor/autoload.php';
|
3 |
+
|
4 |
+
use \Curl\MultiCurl;
|
5 |
+
|
6 |
+
$multi_curl = new MultiCurl();
|
7 |
+
|
8 |
+
$multi_curl->addPut('https://httpbin.org/put', array(
|
9 |
+
'id' => '123',
|
10 |
+
'subject' => 'hello',
|
11 |
+
'body' => 'hello',
|
12 |
+
));
|
13 |
+
$multi_curl->addPut('https://httpbin.org/put', array(
|
14 |
+
'id' => '456',
|
15 |
+
'subject' => 'hello',
|
16 |
+
'body' => 'hello',
|
17 |
+
));
|
18 |
+
|
19 |
+
$multi_curl->start();
|
app/code/community/Pay/Payment/vendor/php-curl-class/php-curl-class/examples/post.php
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
require __DIR__ . '/vendor/autoload.php';
|
3 |
+
|
4 |
+
use \Curl\Curl;
|
5 |
+
|
6 |
+
// curl \
|
7 |
+
// -X POST \
|
8 |
+
// -d "id=1&content=Hello+world%21&date=2015-06-30+19%3A42%3A21" \
|
9 |
+
// "https://httpbin.org/post"
|
10 |
+
|
11 |
+
$data = array(
|
12 |
+
'id' => '1',
|
13 |
+
'content' => 'Hello world!',
|
14 |
+
'date' => date('Y-m-d H:i:s'),
|
15 |
+
);
|
16 |
+
|
17 |
+
$curl = new Curl();
|
18 |
+
$curl->post('https://httpbin.org/post', $data);
|
19 |
+
var_dump($curl->response->form);
|
app/code/community/Pay/Payment/vendor/php-curl-class/php-curl-class/examples/post_json.php
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
require __DIR__ . '/vendor/autoload.php';
|
3 |
+
|
4 |
+
use \Curl\Curl;
|
5 |
+
|
6 |
+
// curl \
|
7 |
+
// -X POST \
|
8 |
+
// -d "{"id":"1","content":"Hello world!","date":"2015-06-30 19:42:21"}" \
|
9 |
+
// "https://httpbin.org/post"
|
10 |
+
|
11 |
+
$data = array(
|
12 |
+
'id' => '1',
|
13 |
+
'content' => 'Hello world!',
|
14 |
+
'date' => date('Y-m-d H:i:s'),
|
15 |
+
);
|
16 |
+
|
17 |
+
$curl = new Curl();
|
18 |
+
$curl->setHeader('Content-Type', 'application/json');
|
19 |
+
$curl->post('https://httpbin.org/post', $data);
|
20 |
+
var_dump($curl->response->json);
|
app/code/community/Pay/Payment/vendor/php-curl-class/php-curl-class/examples/post_redirect_get.php
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
// Perform a post-redirect-get request (POST data and follow 303 redirections
|
3 |
+
// using GET requests).
|
4 |
+
$curl = new Curl();
|
5 |
+
$curl->setOpt(CURLOPT_FOLLOWLOCATION, true);
|
6 |
+
$curl->post('http://www.example.com/login/', array(
|
7 |
+
'username' => 'myusername',
|
8 |
+
'password' => 'mypassword',
|
9 |
+
));
|
10 |
+
|
11 |
+
// POST data and follow 303 redirections by POSTing data again. Please note
|
12 |
+
// that 303 redirections should not be handled this way.
|
13 |
+
// https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.3.4
|
14 |
+
$curl = new Curl();
|
15 |
+
$curl->setOpt(CURLOPT_FOLLOWLOCATION, true);
|
16 |
+
$curl->post('http://www.example.com/login/', array(
|
17 |
+
'username' => 'myusername',
|
18 |
+
'password' => 'mypassword',
|
19 |
+
), false);
|
20 |
+
|
21 |
+
// A POST request performs a post-redirect-get by default. Other request
|
22 |
+
// methods force an option which conflicts with the post-redirect-get behavior.
|
23 |
+
// Due to technical limitations of PHP engines <5.5.11 and HHVM, it is not
|
24 |
+
// possible to reset this option. It is therefore impossible to perform a
|
25 |
+
// post-redirect-get request using a php-curl-class Curl object that has already
|
26 |
+
// been used to perform other types of requests. Either use a new php-curl-class
|
27 |
+
// Curl object or upgrade your PHP engine.
|
app/code/community/Pay/Payment/vendor/php-curl-class/php-curl-class/examples/progress.php
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
require __DIR__ . '/vendor/autoload.php';
|
3 |
+
|
4 |
+
use \Curl\Curl;
|
5 |
+
|
6 |
+
$curl = new Curl();
|
7 |
+
$curl->progress(function($client, $download_size, $downloaded, $upload_size, $uploaded) {
|
8 |
+
if ($download_size === 0) {
|
9 |
+
return;
|
10 |
+
}
|
11 |
+
|
12 |
+
$percent = floor( $downloaded * 100 / $download_size );
|
13 |
+
echo ' ' . $percent . '%' . "\r";
|
14 |
+
});
|
15 |
+
$curl->download('https://php.net/distributions/manual/php_manual_en.html.gz', '/tmp/php_manual_en.html.gz');
|
app/code/community/Pay/Payment/vendor/php-curl-class/php-curl-class/examples/progress_advanced.php
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
require __DIR__ . '/vendor/autoload.php';
|
3 |
+
|
4 |
+
use \Curl\Curl;
|
5 |
+
|
6 |
+
$curl = new Curl();
|
7 |
+
$curl->progress(function($client, $download_size, $downloaded, $upload_size, $uploaded) {
|
8 |
+
if ($download_size === 0) {
|
9 |
+
return;
|
10 |
+
}
|
11 |
+
|
12 |
+
// Display a progress bar: xxx% [=======> ]
|
13 |
+
$progress_size = 40;
|
14 |
+
$fraction_downloaded = $downloaded / $download_size;
|
15 |
+
$dots = round($fraction_downloaded * $progress_size);
|
16 |
+
printf('%3.0f%% [', $fraction_downloaded * 100 );
|
17 |
+
$i = 0;
|
18 |
+
for ( ; $i < $dots - 1; $i++) {
|
19 |
+
echo '=';
|
20 |
+
}
|
21 |
+
echo '>';
|
22 |
+
for ( ; $i < $progress_size - 1; $i++) {
|
23 |
+
echo ' ';
|
24 |
+
}
|
25 |
+
echo ']' . "\r";
|
26 |
+
});
|
27 |
+
$curl->complete(function($instance) {
|
28 |
+
echo "\n" . 'download complete' . "\n";
|
29 |
+
});
|
30 |
+
$curl->download('https://secure.php.net/distributions/manual/php_manual_en.html.gz', '/tmp/php_manual_en.html.gz');
|
app/code/community/Pay/Payment/vendor/php-curl-class/php-curl-class/examples/proxy.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
require __DIR__ . '/vendor/autoload.php';
|
3 |
+
|
4 |
+
use \Curl\Curl;
|
5 |
+
|
6 |
+
$curl = new Curl();
|
7 |
+
$curl->setOpt(CURLOPT_HTTPPROXYTUNNEL, 1);
|
8 |
+
$curl->setOpt(CURLOPT_PROXY, 'someproxy.com:9999');
|
9 |
+
$curl->setOpt(CURLOPT_PROXYUSERPWD, 'username:password');
|
10 |
+
$curl->get('https://httpbin.org/get');
|
11 |
+
var_dump($curl->response);
|
app/code/community/Pay/Payment/vendor/php-curl-class/php-curl-class/examples/put.php
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
require __DIR__ . '/vendor/autoload.php';
|
3 |
+
|
4 |
+
use \Curl\Curl;
|
5 |
+
|
6 |
+
// curl -X PUT -d "id=1&first_name=Zach&last_name=Borboa" "https://httpbin.org/put"
|
7 |
+
$curl = new Curl();
|
8 |
+
$curl->put('https://httpbin.org/put', array(
|
9 |
+
'id' => 1,
|
10 |
+
'first_name' => 'Zach',
|
11 |
+
'last_name' => 'Borboa',
|
12 |
+
));
|
13 |
+
|
14 |
+
echo 'Data server received via PUT:' . "\n";
|
15 |
+
var_dump($curl->response->form);
|
app/code/community/Pay/Payment/vendor/php-curl-class/php-curl-class/examples/reddit_top_pics.php
ADDED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
require __DIR__ . '/vendor/autoload.php';
|
3 |
+
|
4 |
+
use \Curl\Curl;
|
5 |
+
|
6 |
+
$data = array();
|
7 |
+
if (isset($_GET['after'])) {
|
8 |
+
$data['after'] = $_GET['after'];
|
9 |
+
}
|
10 |
+
|
11 |
+
$curl = new Curl();
|
12 |
+
$curl->get('http://www.reddit.com/r/pics/top/.json', $data);
|
13 |
+
|
14 |
+
echo '<ul>';
|
15 |
+
|
16 |
+
foreach ($curl->response->data->children as $result) {
|
17 |
+
$pic = $result->data;
|
18 |
+
echo
|
19 |
+
'<li>' .
|
20 |
+
'<a href="' . $pic->url . '" target="_blank">' .
|
21 |
+
$pic->title . '<br />' .
|
22 |
+
'<img alt="" src="' . $pic->thumbnail . '" />' .
|
23 |
+
'</a> ' .
|
24 |
+
$pic->score . ' pts ' . $pic->num_comments . ' comments by ' . $pic->author .
|
25 |
+
'</li>';
|
26 |
+
}
|
27 |
+
|
28 |
+
echo '</ul>';
|
29 |
+
echo '<a href="?after=' . $curl->response->data->after . '">Next</a>';
|
app/code/community/Pay/Payment/vendor/php-curl-class/php-curl-class/examples/set_cookie.php
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
require __DIR__ . '/vendor/autoload.php';
|
3 |
+
|
4 |
+
use \Curl\Curl;
|
5 |
+
|
6 |
+
$curl = new Curl();
|
7 |
+
$curl->setCookie('foo', 'bar');
|
8 |
+
$curl->get('https://httpbin.org/cookies');
|
9 |
+
var_dump($curl->response->cookies->foo === 'bar');
|
app/code/community/Pay/Payment/vendor/php-curl-class/php-curl-class/examples/set_url_1.php
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
require __DIR__ . '/vendor/autoload.php';
|
3 |
+
|
4 |
+
use \Curl\Curl;
|
5 |
+
|
6 |
+
// Retrieve first N pages of search results.
|
7 |
+
$pages = 10;
|
8 |
+
$q = 'coffee';
|
9 |
+
|
10 |
+
$curl = new Curl('https://www.example.com/search');
|
11 |
+
|
12 |
+
for ($i = 1; $i <= $pages; $i++) {
|
13 |
+
// https://www.example.com/search?q=coffee&page=N
|
14 |
+
$curl->get(array(
|
15 |
+
'q' => $q,
|
16 |
+
'page' => $i,
|
17 |
+
));
|
18 |
+
}
|
app/code/community/Pay/Payment/vendor/php-curl-class/php-curl-class/examples/set_url_2.php
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
require __DIR__ . '/vendor/autoload.php';
|
3 |
+
|
4 |
+
use \Curl\Curl;
|
5 |
+
|
6 |
+
// Retrieve first N pages of search results.
|
7 |
+
$pages = 10;
|
8 |
+
$q = 'coffee';
|
9 |
+
|
10 |
+
$curl = new Curl();
|
11 |
+
$curl->setURL('https://www.example.com/search');
|
12 |
+
|
13 |
+
for ($i = 1; $i <= $pages; $i++) {
|
14 |
+
// https://www.example.com/search?q=coffee&page=N
|
15 |
+
$curl->get(array(
|
16 |
+
'q' => $q,
|
17 |
+
'page' => $i,
|
18 |
+
));
|
19 |
+
}
|
app/code/community/Pay/Payment/vendor/php-curl-class/php-curl-class/examples/twitter_post_tweet.php
ADDED
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
require __DIR__ . '/vendor/autoload.php';
|
3 |
+
|
4 |
+
use \Curl\Curl;
|
5 |
+
|
6 |
+
define('API_KEY', 'XXXXXXXXXXXXXXXXXXXXXXXXX');
|
7 |
+
define('API_SECRET', 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX');
|
8 |
+
define('OAUTH_ACCESS_TOKEN', 'XXXXXXXX-XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX');
|
9 |
+
define('OAUTH_TOKEN_SECRET', 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX');
|
10 |
+
|
11 |
+
$status = 'I love php curl class. https://github.com/php-curl-class/php-curl-class';
|
12 |
+
|
13 |
+
$oauth_data = array(
|
14 |
+
'oauth_consumer_key' => API_KEY,
|
15 |
+
'oauth_nonce' => md5(microtime() . mt_rand()),
|
16 |
+
'oauth_signature_method' => 'HMAC-SHA1',
|
17 |
+
'oauth_timestamp' => time(),
|
18 |
+
'oauth_token' => OAUTH_ACCESS_TOKEN,
|
19 |
+
'oauth_version' => '1.0',
|
20 |
+
'status' => $status,
|
21 |
+
);
|
22 |
+
|
23 |
+
$url = 'https://api.twitter.com/1.1/statuses/update.json';
|
24 |
+
$request = implode('&', array(
|
25 |
+
'POST',
|
26 |
+
rawurlencode($url),
|
27 |
+
rawurlencode(http_build_query($oauth_data, '', '&', PHP_QUERY_RFC3986)),
|
28 |
+
));
|
29 |
+
$key = implode('&', array(API_SECRET, OAUTH_TOKEN_SECRET));
|
30 |
+
$oauth_data['oauth_signature'] = base64_encode(hash_hmac('sha1', $request, $key, true));
|
31 |
+
$data = http_build_query($oauth_data, '', '&');
|
32 |
+
|
33 |
+
$curl = new Curl();
|
34 |
+
$curl->post($url, $data);
|
35 |
+
|
36 |
+
echo 'Posted "' . $curl->response->text . '" at ' . $curl->response->created_at . '.' . "\n";
|
app/code/community/Pay/Payment/vendor/php-curl-class/php-curl-class/examples/twitter_trending_topics.php
ADDED
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
require __DIR__ . '/vendor/autoload.php';
|
3 |
+
|
4 |
+
use \Curl\Curl;
|
5 |
+
|
6 |
+
define('API_KEY', 'XXXXXXXXXXXXXXXXXXXXXXXXX');
|
7 |
+
define('API_SECRET', 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX');
|
8 |
+
define('OAUTH_ACCESS_TOKEN', 'XXXXXXXX-XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX');
|
9 |
+
define('OAUTH_TOKEN_SECRET', 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX');
|
10 |
+
|
11 |
+
$woeid = '2487956';
|
12 |
+
|
13 |
+
$oauth_data = array(
|
14 |
+
'id' => $woeid,
|
15 |
+
'oauth_consumer_key' => API_KEY,
|
16 |
+
'oauth_nonce' => md5(microtime() . mt_rand()),
|
17 |
+
'oauth_signature_method' => 'HMAC-SHA1',
|
18 |
+
'oauth_timestamp' => time(),
|
19 |
+
'oauth_token' => OAUTH_ACCESS_TOKEN,
|
20 |
+
'oauth_version' => '1.0',
|
21 |
+
);
|
22 |
+
|
23 |
+
$request_values = $oauth_data;
|
24 |
+
ksort($request_values);
|
25 |
+
|
26 |
+
$url = 'https://api.twitter.com/1.1/trends/place.json';
|
27 |
+
$request = implode('&', array(
|
28 |
+
'GET',
|
29 |
+
rawurlencode($url),
|
30 |
+
rawurlencode(http_build_query($request_values, '', '&', PHP_QUERY_RFC3986)),
|
31 |
+
));
|
32 |
+
$key = implode('&', array(rawurlencode(API_SECRET), rawurlencode(OAUTH_TOKEN_SECRET)));
|
33 |
+
$oauth_data['oauth_signature'] = base64_encode(hash_hmac('sha1', $request, $key, true));
|
34 |
+
|
35 |
+
$authorization = array();
|
36 |
+
foreach ($oauth_data as $key => $value) {
|
37 |
+
$authorization[] = $key . '="' . rawurlencode($value) . '"';
|
38 |
+
}
|
39 |
+
$authorization = 'Authorization: OAuth ' . implode(', ', $authorization);
|
40 |
+
|
41 |
+
$curl = new Curl();
|
42 |
+
$curl->setOpt(CURLOPT_HTTPHEADER, array($authorization));
|
43 |
+
$curl->get($url, array(
|
44 |
+
'id' => $woeid,
|
45 |
+
));
|
46 |
+
|
47 |
+
echo 'Current trends:' . "\n";
|
48 |
+
foreach ($curl->response['0']->trends as $trend) {
|
49 |
+
echo '- ' . $trend->name . "\n";
|
50 |
+
}
|
app/code/community/Pay/Payment/vendor/php-curl-class/php-curl-class/examples/upload_file.php
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
require __DIR__ . '/vendor/autoload.php';
|
3 |
+
|
4 |
+
use \Curl\Curl;
|
5 |
+
|
6 |
+
$myfile = curl_file_create('cats.jpg', 'image/png', 'test_name');
|
7 |
+
|
8 |
+
$curl = new Curl();
|
9 |
+
|
10 |
+
// HINT: If API documentation refers to using something like curl -F "myimage=image.png",
|
11 |
+
// curl --form "myimage=image.png", or the html form is similar to <form enctype="multipart/form-data" method="post">,
|
12 |
+
// then try uncommenting the following line:
|
13 |
+
// $curl->setHeader('Content-Type', 'multipart/form-data');
|
14 |
+
|
15 |
+
$curl->post('https://httpbin.org/post', array(
|
16 |
+
'myfile' => $myfile,
|
17 |
+
));
|
18 |
+
|
19 |
+
if ($curl->error) {
|
20 |
+
echo 'Error: ' . $curl->errorMessage . "\n";
|
21 |
+
} else {
|
22 |
+
echo 'Success' . "\n";
|
23 |
+
}
|
app/code/community/Pay/Payment/vendor/php-curl-class/php-curl-class/examples/youtube_list_playlist_videos.php
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
require __DIR__ . '/vendor/autoload.php';
|
3 |
+
|
4 |
+
use \Curl\Curl;
|
5 |
+
|
6 |
+
define('YOUTUBE_API_KEY', 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX');
|
7 |
+
|
8 |
+
$playlistId = 'RDHJb0VYVtaNc';
|
9 |
+
|
10 |
+
$curl = new Curl();
|
11 |
+
$curl->get('https://www.googleapis.com/youtube/v3/playlistItems', array(
|
12 |
+
'key' => YOUTUBE_API_KEY,
|
13 |
+
'maxResults' => '50',
|
14 |
+
'part' => 'snippet',
|
15 |
+
'playlistId' => $playlistId,
|
16 |
+
));
|
17 |
+
|
18 |
+
echo 'Songs in this playlist:' . "\n";
|
19 |
+
|
20 |
+
foreach ($curl->response->items as $item) {
|
21 |
+
echo
|
22 |
+
$item->snippet->title . "\n" .
|
23 |
+
'https://www.youtube.com/watch?v=' . $item->snippet->resourceId->videoId . "\n" .
|
24 |
+
"\n";
|
25 |
+
}
|
app/code/community/Pay/Payment/vendor/php-curl-class/php-curl-class/examples/youtube_video_count.php
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
require __DIR__ . '/vendor/autoload.php';
|
3 |
+
|
4 |
+
use \Curl\Curl;
|
5 |
+
|
6 |
+
$video_ids = array(
|
7 |
+
'9bZkp7q19f0',
|
8 |
+
'_OBlgSz8sSM',
|
9 |
+
'uelHwf8o7_U',
|
10 |
+
'KQ6zr6kCPj8',
|
11 |
+
'ASO_zypdnsQ',
|
12 |
+
'pRpeEdMmmQ0',
|
13 |
+
);
|
14 |
+
|
15 |
+
foreach ($video_ids as $video_id) {
|
16 |
+
$curl = new Curl();
|
17 |
+
$curl->get('https://gdata.youtube.com/feeds/api/videos/' . $video_id . '?alt=json');
|
18 |
+
echo '"' . $curl->response->entry->title->{'$t'} . '" has ' .
|
19 |
+
number_format($curl->response->entry->{'yt$statistics'}->viewCount) . ' views.' . "\n";
|
20 |
+
}
|
app/code/community/Pay/Payment/vendor/php-curl-class/php-curl-class/scripts/bump_major_version.php
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/usr/bin/php
|
2 |
+
<?php
|
3 |
+
require dirname(__FILE__) . '/../src/Curl/Curl.php';
|
4 |
+
|
5 |
+
$current_version = Curl\Curl::VERSION;
|
6 |
+
list($major, $_, $_) = explode('.', $current_version);
|
7 |
+
$new_version = implode('.', array((string)((int)$major += 1), '0', '0'));
|
8 |
+
|
9 |
+
foreach(
|
10 |
+
array(
|
11 |
+
array(
|
12 |
+
dirname(__FILE__) . '/../src/Curl/Curl.php',
|
13 |
+
'/const VERSION = \'(?:\d+.\d+.\d+)\';/',
|
14 |
+
'const VERSION = \'' . $new_version . '\';',
|
15 |
+
),
|
16 |
+
) as $info) {
|
17 |
+
list($filepath, $find, $replace) = $info;
|
18 |
+
$data = preg_replace($find, $replace, file_get_contents($filepath));
|
19 |
+
file_put_contents($filepath, $data);
|
20 |
+
}
|
app/code/community/Pay/Payment/vendor/php-curl-class/php-curl-class/scripts/bump_minor_version.php
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/usr/bin/php
|
2 |
+
<?php
|
3 |
+
require dirname(__FILE__) . '/../src/Curl/Curl.php';
|
4 |
+
|
5 |
+
$current_version = Curl\Curl::VERSION;
|
6 |
+
list($major, $minor, $_) = explode('.', $current_version);
|
7 |
+
$new_version = implode('.', array($major, (string)((int)$minor += 1), '0'));
|
8 |
+
|
9 |
+
foreach(
|
10 |
+
array(
|
11 |
+
array(
|
12 |
+
dirname(__FILE__) . '/../src/Curl/Curl.php',
|
13 |
+
'/const VERSION = \'(?:\d+.\d+.\d+)\';/',
|
14 |
+
'const VERSION = \'' . $new_version . '\';',
|
15 |
+
),
|
16 |
+
) as $info) {
|
17 |
+
list($filepath, $find, $replace) = $info;
|
18 |
+
$data = preg_replace($find, $replace, file_get_contents($filepath));
|
19 |
+
file_put_contents($filepath, $data);
|
20 |
+
}
|
app/code/community/Pay/Payment/vendor/php-curl-class/php-curl-class/scripts/bump_patch_version.php
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/usr/bin/php
|
2 |
+
<?php
|
3 |
+
require dirname(__FILE__) . '/../src/Curl/Curl.php';
|
4 |
+
|
5 |
+
$current_version = Curl\Curl::VERSION;
|
6 |
+
list($major, $minor, $patch) = explode('.', $current_version);
|
7 |
+
$new_version = implode('.', array($major, $minor, (string)((int)$patch += 1)));
|
8 |
+
|
9 |
+
foreach(
|
10 |
+
array(
|
11 |
+
array(
|
12 |
+
dirname(__FILE__) . '/../src/Curl/Curl.php',
|
13 |
+
'/const VERSION = \'(?:\d+.\d+.\d+)\';/',
|
14 |
+
'const VERSION = \'' . $new_version . '\';',
|
15 |
+
),
|
16 |
+
) as $info) {
|
17 |
+
list($filepath, $find, $replace) = $info;
|
18 |
+
$data = preg_replace($find, $replace, file_get_contents($filepath));
|
19 |
+
file_put_contents($filepath, $data);
|
20 |
+
}
|
app/code/community/Pay/Payment/vendor/php-curl-class/php-curl-class/scripts/update_readme_methods.sh
ADDED
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
before=$(head -n $(
|
2 |
+
grep --context="0" --line-number --max-count="1" "### Available Methods" "README.md" |
|
3 |
+
perl -pe 's/^(\d+):.*/\1/') "README.md")
|
4 |
+
|
5 |
+
after=$(tail -n +$(
|
6 |
+
grep --context="0" --line-number --max-count="1" "### Contribute" "README.md" |
|
7 |
+
perl -pe 's/^(\d+):.*/\1/') "README.md")
|
8 |
+
|
9 |
+
echo "${before}" > "README.md"
|
10 |
+
|
11 |
+
curl_max_line_number=$(grep --context="0" --line-number --max-count="1" '^}$' "src/Curl/Curl.php" | \
|
12 |
+
perl -pe 's/^(\d+):.*/\1/')
|
13 |
+
echo '```php' >> "README.md"
|
14 |
+
head -n "${curl_max_line_number}" "src/Curl/Curl.php" | \
|
15 |
+
egrep "^ .* function .*" | \
|
16 |
+
egrep "^ public" | \
|
17 |
+
sort | \
|
18 |
+
perl -pe 's/^ public (.* )?function /Curl::/' \
|
19 |
+
>> "README.md"
|
20 |
+
egrep "^ .* function .*" "src/Curl/MultiCurl.php" | \
|
21 |
+
egrep "^ public" | \
|
22 |
+
sort | \
|
23 |
+
perl -pe 's/^ public (.* )?function /MultiCurl::/' \
|
24 |
+
>> "README.md"
|
25 |
+
echo '```' >> "README.md"
|
26 |
+
echo >> "README.md"
|
27 |
+
|
28 |
+
echo "${after}" >> "README.md"
|
29 |
+
|
30 |
+
# Update table of contents.
|
31 |
+
script=$(cat <<'EOF'
|
32 |
+
$data = file_get_contents('README.md');
|
33 |
+
preg_match_all('/^### ([\w ]+)/m', $data, $matches);
|
34 |
+
$toc = array();
|
35 |
+
foreach ($matches['1'] as $match) {
|
36 |
+
$href = '#' . str_replace(' ', '-', strtolower($match));
|
37 |
+
$toc[] = '- [' . $match . '](' . $href . ')';
|
38 |
+
}
|
39 |
+
$toc = implode("\n", $toc);
|
40 |
+
$toc = '---' . "\n\n" . $toc . "\n\n" . '---' . "\n\n";
|
41 |
+
$data = preg_replace('/---\n\n(?:- .*\n)+?\n---\n\n/', $toc, $data);
|
42 |
+
file_put_contents('README.md', $data);
|
43 |
+
EOF)
|
44 |
+
php --run "${script}"
|
app/code/community/Pay/Payment/vendor/php-curl-class/php-curl-class/scripts/v4_migration.php
ADDED
@@ -0,0 +1,93 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
// Migrate pre-4.x.x php scripts to use current naming convention of $camelCase
|
4 |
+
// for properties / class member variables. To use, change into the directory
|
5 |
+
// containing php files that you wish to update and run this script. Example:
|
6 |
+
// $ cd /path/to/project
|
7 |
+
// $ php ../php-curl-class/scripts/v4_migration.php
|
8 |
+
|
9 |
+
$cwd = getcwd();
|
10 |
+
echo 'Checking current directory "' . $cwd . '" for possible changes.' . "\n";
|
11 |
+
|
12 |
+
$results = array(
|
13 |
+
'errors' => array(),
|
14 |
+
'files_found' => array(),
|
15 |
+
'files_to_change' => array(),
|
16 |
+
);
|
17 |
+
|
18 |
+
$migrations = array(
|
19 |
+
'error_code' => 'errorCode',
|
20 |
+
'error_message' => 'errorMessage',
|
21 |
+
'curl_error' => 'curlError',
|
22 |
+
'curl_error_code' => 'curlErrorCode',
|
23 |
+
'curl_error_message' => 'curlErrorMessage',
|
24 |
+
'http_error' => 'httpError',
|
25 |
+
'http_status_code' => 'httpStatusCode',
|
26 |
+
'http_error_message' => 'httpErrorMessage',
|
27 |
+
'base_url' => 'baseUrl',
|
28 |
+
'request_headers' => 'requestHeaders',
|
29 |
+
'response_headers' => 'responseHeaders',
|
30 |
+
'raw_response_headers' => 'rawResponseHeaders',
|
31 |
+
'raw_response' => 'rawResponse',
|
32 |
+
'before_send_function' => 'beforeSendFunction',
|
33 |
+
'download_complete_function' => 'downloadCompleteFunction',
|
34 |
+
);
|
35 |
+
|
36 |
+
$directory = new RecursiveDirectoryIterator($cwd);
|
37 |
+
$iterator = new RecursiveIteratorIterator($directory);
|
38 |
+
$regex = new RegexIterator($iterator, '/^.+\.php$/i', RecursiveRegexIterator::GET_MATCH);
|
39 |
+
foreach ($regex as $file) {
|
40 |
+
$filepath = $file['0'];
|
41 |
+
$results['files_found'][] = $filepath;
|
42 |
+
if ($filepath === __FILE__) {
|
43 |
+
continue;
|
44 |
+
}
|
45 |
+
$data = file_get_contents($filepath);
|
46 |
+
$short_path = str_replace($cwd, '', $filepath);
|
47 |
+
if ($data === false) {
|
48 |
+
$results['errors'][] = $filepath;
|
49 |
+
echo $short_path . ' [ERROR]' . "\n";
|
50 |
+
} else {
|
51 |
+
foreach ($migrations as $old => $new) {
|
52 |
+
if (!(strpos($data, '->' . $old) === false)) {
|
53 |
+
$results['files_to_change'][] = $filepath;
|
54 |
+
echo $short_path . "\n";
|
55 |
+
break;
|
56 |
+
}
|
57 |
+
}
|
58 |
+
}
|
59 |
+
}
|
60 |
+
|
61 |
+
foreach ($results as $name => $files) {
|
62 |
+
$results[$name . '_count'] = count($files);
|
63 |
+
}
|
64 |
+
$results['errors_count'] = count($results['errors']);
|
65 |
+
$results['files_found_count'] = count($results['files_found']);
|
66 |
+
$results['files_to_change_count'] = count($results['files_to_change']);
|
67 |
+
|
68 |
+
if ($results['errors_count'] > 0) {
|
69 |
+
echo 'ERROR: Unable to read files.' . "\n";
|
70 |
+
exit(1);
|
71 |
+
} else if ($results['files_found_count'] === 0) {
|
72 |
+
echo 'Current directory "' . $cwd . '"' . "\n";
|
73 |
+
echo 'ERROR: No read files found in current directory.' . "\n";
|
74 |
+
exit(1);
|
75 |
+
} else if ($results['files_to_change_count'] === 0) {
|
76 |
+
echo 'OK: No files to change.' . "\n";
|
77 |
+
exit(0);
|
78 |
+
} else if ($results['files_to_change_count'] > 0) {
|
79 |
+
echo $results['files_to_change_count'] . ' of ' . $results['files_found_count'] . ' files to change found.' . "\n";
|
80 |
+
echo 'Continue? [y/n] ';
|
81 |
+
if (!in_array(trim(fgets(STDIN)), array('y', 'Y'))) {
|
82 |
+
die();
|
83 |
+
}
|
84 |
+
foreach ($results['files_to_change'] as $filepath) {
|
85 |
+
$data = file_get_contents($filepath);
|
86 |
+
foreach ($migrations as $old => $new) {
|
87 |
+
$data = str_replace('->' . $old, '->' . $new, $data);
|
88 |
+
}
|
89 |
+
file_put_contents($filepath, $data);
|
90 |
+
}
|
91 |
+
echo 'Done' . "\n";
|
92 |
+
exit(0);
|
93 |
+
}
|
app/code/community/Pay/Payment/vendor/php-curl-class/php-curl-class/src/Curl/CaseInsensitiveArray.php
ADDED
@@ -0,0 +1,234 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Curl;
|
4 |
+
|
5 |
+
class CaseInsensitiveArray implements \ArrayAccess, \Countable, \Iterator
|
6 |
+
{
|
7 |
+
|
8 |
+
/**
|
9 |
+
* @var mixed[] Data storage with lower-case keys
|
10 |
+
* @see offsetSet()
|
11 |
+
* @see offsetExists()
|
12 |
+
* @see offsetUnset()
|
13 |
+
* @see offsetGet()
|
14 |
+
* @see count()
|
15 |
+
* @see current()
|
16 |
+
* @see next()
|
17 |
+
* @see key()
|
18 |
+
*/
|
19 |
+
private $data = array();
|
20 |
+
|
21 |
+
/**
|
22 |
+
* @var string[] Case-Sensitive keys.
|
23 |
+
* @see offsetSet()
|
24 |
+
* @see offsetUnset()
|
25 |
+
* @see key()
|
26 |
+
*/
|
27 |
+
private $keys = array();
|
28 |
+
|
29 |
+
/**
|
30 |
+
* Construct
|
31 |
+
*
|
32 |
+
* Allow creating either an empty Array, or convert an existing Array to a
|
33 |
+
* Case-Insensitive Array. (Caution: Data may be lost when converting Case-
|
34 |
+
* Sensitive Arrays to Case-Insensitive Arrays)
|
35 |
+
*
|
36 |
+
* @param mixed[] $initial (optional) Existing Array to convert.
|
37 |
+
*
|
38 |
+
* @return void
|
39 |
+
*
|
40 |
+
* @access public
|
41 |
+
*/
|
42 |
+
public function __construct(Array $initial = null)
|
43 |
+
{
|
44 |
+
if ($initial !== null) {
|
45 |
+
foreach ($initial as $key => $value) {
|
46 |
+
$this->offsetSet($key, $value);
|
47 |
+
}
|
48 |
+
}
|
49 |
+
}
|
50 |
+
|
51 |
+
/**
|
52 |
+
* Offset Set
|
53 |
+
*
|
54 |
+
* Set data at a specified Offset. Converts the offset to lower-case, and
|
55 |
+
* stores the Case-Sensitive Offset and the Data at the lower-case indexes
|
56 |
+
* in $this->keys and @this->data.
|
57 |
+
*
|
58 |
+
* @see https://secure.php.net/manual/en/arrayaccess.offseteset.php
|
59 |
+
*
|
60 |
+
* @param string $offset The offset to store the data at (case-insensitive).
|
61 |
+
* @param mixed $value The data to store at the specified offset.
|
62 |
+
*
|
63 |
+
* @return void
|
64 |
+
*
|
65 |
+
* @access public
|
66 |
+
*/
|
67 |
+
public function offsetSet($offset, $value)
|
68 |
+
{
|
69 |
+
if ($offset === null) {
|
70 |
+
$this->data[] = $value;
|
71 |
+
} else {
|
72 |
+
$offsetlower = strtolower($offset);
|
73 |
+
$this->data[$offsetlower] = $value;
|
74 |
+
$this->keys[$offsetlower] = $offset;
|
75 |
+
}
|
76 |
+
}
|
77 |
+
|
78 |
+
/**
|
79 |
+
* Offset Exists
|
80 |
+
*
|
81 |
+
* Checks if the Offset exists in data storage. The index is looked up with
|
82 |
+
* the lower-case version of the provided offset.
|
83 |
+
*
|
84 |
+
* @see https://secure.php.net/manual/en/arrayaccess.offsetexists.php
|
85 |
+
*
|
86 |
+
* @param string $offset Offset to check
|
87 |
+
*
|
88 |
+
* @return bool If the offset exists.
|
89 |
+
*
|
90 |
+
* @access public
|
91 |
+
*/
|
92 |
+
public function offsetExists($offset)
|
93 |
+
{
|
94 |
+
return (bool) array_key_exists(strtolower($offset), $this->data);
|
95 |
+
}
|
96 |
+
|
97 |
+
/**
|
98 |
+
* Offset Unset
|
99 |
+
*
|
100 |
+
* Unsets the specified offset. Converts the provided offset to lowercase,
|
101 |
+
* and unsets the Case-Sensitive Key, as well as the stored data.
|
102 |
+
*
|
103 |
+
* @see https://secure.php.net/manual/en/arrayaccess.offsetunset.php
|
104 |
+
*
|
105 |
+
* @param string $offset The offset to unset.
|
106 |
+
*
|
107 |
+
* @return void
|
108 |
+
*
|
109 |
+
* @access public
|
110 |
+
*/
|
111 |
+
public function offsetUnset($offset)
|
112 |
+
{
|
113 |
+
$offsetlower = strtolower($offset);
|
114 |
+
unset($this->data[$offsetlower]);
|
115 |
+
unset($this->keys[$offsetlower]);
|
116 |
+
}
|
117 |
+
|
118 |
+
/**
|
119 |
+
* Offset Get
|
120 |
+
*
|
121 |
+
* Return the stored data at the provided offset. The offset is converted to
|
122 |
+
* lowercase and the lookup is done on the Data store directly.
|
123 |
+
*
|
124 |
+
* @see https://secure.php.net/manual/en/arrayaccess.offsetget.php
|
125 |
+
*
|
126 |
+
* @param string $offset Offset to lookup.
|
127 |
+
*
|
128 |
+
* @return mixed The data stored at the offset.
|
129 |
+
*
|
130 |
+
* @access public
|
131 |
+
*/
|
132 |
+
public function offsetGet($offset)
|
133 |
+
{
|
134 |
+
$offsetlower = strtolower($offset);
|
135 |
+
return isset($this->data[$offsetlower]) ? $this->data[$offsetlower] : null;
|
136 |
+
}
|
137 |
+
|
138 |
+
/**
|
139 |
+
* Count
|
140 |
+
*
|
141 |
+
* @see https://secure.php.net/manual/en/countable.count.php
|
142 |
+
*
|
143 |
+
* @param void
|
144 |
+
*
|
145 |
+
* @return int The number of elements stored in the Array.
|
146 |
+
*
|
147 |
+
* @access public
|
148 |
+
*/
|
149 |
+
public function count()
|
150 |
+
{
|
151 |
+
return (int) count($this->data);
|
152 |
+
}
|
153 |
+
|
154 |
+
/**
|
155 |
+
* Current
|
156 |
+
*
|
157 |
+
* @see https://secure.php.net/manual/en/iterator.current.php
|
158 |
+
*
|
159 |
+
* @param void
|
160 |
+
*
|
161 |
+
* @return mixed Data at the current position.
|
162 |
+
*
|
163 |
+
* @access public
|
164 |
+
*/
|
165 |
+
public function current()
|
166 |
+
{
|
167 |
+
return current($this->data);
|
168 |
+
}
|
169 |
+
|
170 |
+
/**
|
171 |
+
* Next
|
172 |
+
*
|
173 |
+
* @see https://secure.php.net/manual/en/iterator.next.php
|
174 |
+
*
|
175 |
+
* @param void
|
176 |
+
*
|
177 |
+
* @return void
|
178 |
+
*
|
179 |
+
* @access public
|
180 |
+
*/
|
181 |
+
public function next()
|
182 |
+
{
|
183 |
+
next($this->data);
|
184 |
+
}
|
185 |
+
|
186 |
+
/**
|
187 |
+
* Key
|
188 |
+
*
|
189 |
+
* @see https://secure.php.net/manual/en/iterator.key.php
|
190 |
+
*
|
191 |
+
* @param void
|
192 |
+
*
|
193 |
+
* @return mixed Case-Sensitive key at current position.
|
194 |
+
*
|
195 |
+
* @access public
|
196 |
+
*/
|
197 |
+
public function key()
|
198 |
+
{
|
199 |
+
$key = key($this->data);
|
200 |
+
return isset($this->keys[$key]) ? $this->keys[$key] : $key;
|
201 |
+
}
|
202 |
+
|
203 |
+
/**
|
204 |
+
* Valid
|
205 |
+
*
|
206 |
+
* @see https://secure.php.net/manual/en/iterator.valid.php
|
207 |
+
*
|
208 |
+
* @param void
|
209 |
+
*
|
210 |
+
* @return bool If the current position is valid.
|
211 |
+
*
|
212 |
+
* @access public
|
213 |
+
*/
|
214 |
+
public function valid()
|
215 |
+
{
|
216 |
+
return (bool) !(key($this->data) === null);
|
217 |
+
}
|
218 |
+
|
219 |
+
/**
|
220 |
+
* Rewind
|
221 |
+
*
|
222 |
+
* @see https://secure.php.net/manual/en/iterator.rewind.php
|
223 |
+
*
|
224 |
+
* @param void
|
225 |
+
*
|
226 |
+
* @return void
|
227 |
+
*
|
228 |
+
* @access public
|
229 |
+
*/
|
230 |
+
public function rewind()
|
231 |
+
{
|
232 |
+
reset($this->data);
|
233 |
+
}
|
234 |
+
}
|
app/code/community/Pay/Payment/vendor/php-curl-class/php-curl-class/src/Curl/Curl.php
ADDED
@@ -0,0 +1,1217 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Curl;
|
4 |
+
|
5 |
+
|
6 |
+
class Curl
|
7 |
+
{
|
8 |
+
const VERSION = '4.13.0';
|
9 |
+
const DEFAULT_TIMEOUT = 30;
|
10 |
+
|
11 |
+
public static $RFC2616 = array(
|
12 |
+
// RFC2616: "any CHAR except CTLs or separators".
|
13 |
+
// CHAR = <any US-ASCII character (octets 0 - 127)>
|
14 |
+
// CTL = <any US-ASCII control character
|
15 |
+
// (octets 0 - 31) and DEL (127)>
|
16 |
+
// separators = "(" | ")" | "<" | ">" | "@"
|
17 |
+
// | "," | ";" | ":" | "\" | <">
|
18 |
+
// | "/" | "[" | "]" | "?" | "="
|
19 |
+
// | "{" | "}" | SP | HT
|
20 |
+
// SP = <US-ASCII SP, space (32)>
|
21 |
+
// HT = <US-ASCII HT, horizontal-tab (9)>
|
22 |
+
// <"> = <US-ASCII double-quote mark (34)>
|
23 |
+
'!', '#', '$', '%', '&', "'", '*', '+', '-', '.', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B',
|
24 |
+
'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X',
|
25 |
+
'Y', 'Z', '^', '_', '`', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q',
|
26 |
+
'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '|', '~',
|
27 |
+
);
|
28 |
+
public static $RFC6265 = array(
|
29 |
+
// RFC6265: "US-ASCII characters excluding CTLs, whitespace DQUOTE, comma, semicolon, and backslash".
|
30 |
+
// %x21
|
31 |
+
'!',
|
32 |
+
// %x23-2B
|
33 |
+
'#', '$', '%', '&', "'", '(', ')', '*', '+',
|
34 |
+
// %x2D-3A
|
35 |
+
'-', '.', '/', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', ':',
|
36 |
+
// %x3C-5B
|
37 |
+
'<', '=', '>', '?', '@', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q',
|
38 |
+
'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '[',
|
39 |
+
// %x5D-7E
|
40 |
+
']', '^', '_', '`', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r',
|
41 |
+
's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '{', '|', '}', '~',
|
42 |
+
);
|
43 |
+
|
44 |
+
public $curl;
|
45 |
+
public $id = null;
|
46 |
+
|
47 |
+
public $error = false;
|
48 |
+
public $errorCode = 0;
|
49 |
+
public $errorMessage = null;
|
50 |
+
|
51 |
+
public $curlError = false;
|
52 |
+
public $curlErrorCode = 0;
|
53 |
+
public $curlErrorMessage = null;
|
54 |
+
|
55 |
+
public $httpError = false;
|
56 |
+
public $httpStatusCode = 0;
|
57 |
+
public $httpErrorMessage = null;
|
58 |
+
|
59 |
+
public $baseUrl = null;
|
60 |
+
public $url = null;
|
61 |
+
public $requestHeaders = null;
|
62 |
+
public $responseHeaders = null;
|
63 |
+
public $rawResponseHeaders = '';
|
64 |
+
public $response = null;
|
65 |
+
public $rawResponse = null;
|
66 |
+
|
67 |
+
public $beforeSendFunction = null;
|
68 |
+
public $downloadCompleteFunction = null;
|
69 |
+
public $successFunction = null;
|
70 |
+
public $errorFunction = null;
|
71 |
+
public $completeFunction = null;
|
72 |
+
|
73 |
+
private $cookies = array();
|
74 |
+
private $responseCookies = array();
|
75 |
+
private $headers = array();
|
76 |
+
private $options = array();
|
77 |
+
|
78 |
+
private $jsonDecoder = null;
|
79 |
+
private $jsonPattern = '/^(?:application|text)\/(?:[a-z]+(?:[\.-][0-9a-z]+){0,}[\+\.]|x-)?json(?:-[a-z]+)?/i';
|
80 |
+
private $xmlDecoder = null;
|
81 |
+
private $xmlPattern = '~^(?:text/|application/(?:atom\+|rss\+)?)xml~i';
|
82 |
+
private $defaultDecoder = null;
|
83 |
+
|
84 |
+
private static $deferredProperties = array(
|
85 |
+
'effectiveUrl',
|
86 |
+
'totalTime',
|
87 |
+
);
|
88 |
+
|
89 |
+
/**
|
90 |
+
* Construct
|
91 |
+
*
|
92 |
+
* @access public
|
93 |
+
* @param $base_url
|
94 |
+
* @throws \ErrorException
|
95 |
+
*/
|
96 |
+
public function __construct($base_url = null)
|
97 |
+
{
|
98 |
+
if (!extension_loaded('curl')) {
|
99 |
+
throw new \ErrorException('cURL library is not loaded');
|
100 |
+
}
|
101 |
+
|
102 |
+
$this->curl = curl_init();
|
103 |
+
$this->id = 1;
|
104 |
+
$this->setDefaultUserAgent();
|
105 |
+
$this->setDefaultJsonDecoder();
|
106 |
+
$this->setDefaultXmlDecoder();
|
107 |
+
$this->setDefaultTimeout();
|
108 |
+
$this->setOpt(CURLINFO_HEADER_OUT, true);
|
109 |
+
$this->setOpt(CURLOPT_HEADERFUNCTION, array($this, 'headerCallback'));
|
110 |
+
$this->setOpt(CURLOPT_RETURNTRANSFER, true);
|
111 |
+
$this->headers = new CaseInsensitiveArray();
|
112 |
+
$this->setURL($base_url);
|
113 |
+
$this->rfc2616 = array_fill_keys(self::$RFC2616, true);
|
114 |
+
$this->rfc6265 = array_fill_keys(self::$RFC6265, true);
|
115 |
+
}
|
116 |
+
|
117 |
+
/**
|
118 |
+
* Before Send
|
119 |
+
*
|
120 |
+
* @access public
|
121 |
+
* @param $callback
|
122 |
+
*/
|
123 |
+
public function beforeSend($callback)
|
124 |
+
{
|
125 |
+
$this->beforeSendFunction = $callback;
|
126 |
+
}
|
127 |
+
|
128 |
+
/**
|
129 |
+
* Build Post Data
|
130 |
+
*
|
131 |
+
* @access public
|
132 |
+
* @param $data
|
133 |
+
*
|
134 |
+
* @return array|string
|
135 |
+
*/
|
136 |
+
public function buildPostData($data)
|
137 |
+
{
|
138 |
+
if (is_array($data)) {
|
139 |
+
if (isset($this->headers['Content-Type']) &&
|
140 |
+
preg_match($this->jsonPattern, $this->headers['Content-Type'])) {
|
141 |
+
$json_str = json_encode($data);
|
142 |
+
if (!($json_str === false)) {
|
143 |
+
$data = $json_str;
|
144 |
+
}
|
145 |
+
} else if (self::is_array_multidim($data)) {
|
146 |
+
$data = self::http_build_multi_query($data);
|
147 |
+
} else {
|
148 |
+
$binary_data = false;
|
149 |
+
foreach ($data as $key => $value) {
|
150 |
+
// Fix "Notice: Array to string conversion" when $value in curl_setopt($ch, CURLOPT_POSTFIELDS,
|
151 |
+
// $value) is an array that contains an empty array.
|
152 |
+
if (is_array($value) && empty($value)) {
|
153 |
+
$data[$key] = '';
|
154 |
+
// Fix "curl_setopt(): The usage of the @filename API for file uploading is deprecated. Please use
|
155 |
+
// the CURLFile class instead". Ignore non-file values prefixed with the @ character.
|
156 |
+
} elseif (is_string($value) && strpos($value, '@') === 0 && is_file(substr($value, 1))) {
|
157 |
+
$binary_data = true;
|
158 |
+
if (class_exists('CURLFile')) {
|
159 |
+
$data[$key] = new \CURLFile(substr($value, 1));
|
160 |
+
}
|
161 |
+
} elseif ($value instanceof \CURLFile) {
|
162 |
+
$binary_data = true;
|
163 |
+
}
|
164 |
+
}
|
165 |
+
|
166 |
+
if (!$binary_data) {
|
167 |
+
$data = http_build_query($data, '', '&');
|
168 |
+
}
|
169 |
+
}
|
170 |
+
}
|
171 |
+
|
172 |
+
return $data;
|
173 |
+
}
|
174 |
+
|
175 |
+
/**
|
176 |
+
* Call
|
177 |
+
*
|
178 |
+
* @access public
|
179 |
+
*/
|
180 |
+
public function call()
|
181 |
+
{
|
182 |
+
$args = func_get_args();
|
183 |
+
$function = array_shift($args);
|
184 |
+
if (is_callable($function)) {
|
185 |
+
array_unshift($args, $this);
|
186 |
+
call_user_func_array($function, $args);
|
187 |
+
}
|
188 |
+
}
|
189 |
+
|
190 |
+
/**
|
191 |
+
* Close
|
192 |
+
*
|
193 |
+
* @access public
|
194 |
+
*/
|
195 |
+
public function close()
|
196 |
+
{
|
197 |
+
if (is_resource($this->curl)) {
|
198 |
+
curl_close($this->curl);
|
199 |
+
}
|
200 |
+
$this->options = null;
|
201 |
+
$this->jsonDecoder = null;
|
202 |
+
$this->xmlDecoder = null;
|
203 |
+
}
|
204 |
+
|
205 |
+
/**
|
206 |
+
* Complete
|
207 |
+
*
|
208 |
+
* @access public
|
209 |
+
* @param $callback
|
210 |
+
*/
|
211 |
+
public function complete($callback)
|
212 |
+
{
|
213 |
+
$this->completeFunction = $callback;
|
214 |
+
}
|
215 |
+
|
216 |
+
/**
|
217 |
+
* Progress
|
218 |
+
*
|
219 |
+
* @access public
|
220 |
+
* @param $callback
|
221 |
+
*/
|
222 |
+
public function progress($callback)
|
223 |
+
{
|
224 |
+
$this->setOpt(CURLOPT_PROGRESSFUNCTION, $callback);
|
225 |
+
$this->setOpt(CURLOPT_NOPROGRESS, false);
|
226 |
+
}
|
227 |
+
|
228 |
+
/**
|
229 |
+
* Delete
|
230 |
+
*
|
231 |
+
* @access public
|
232 |
+
* @param $url
|
233 |
+
* @param $query_parameters
|
234 |
+
* @param $data
|
235 |
+
*
|
236 |
+
* @return string
|
237 |
+
*/
|
238 |
+
public function delete($url, $query_parameters = array(), $data = array())
|
239 |
+
{
|
240 |
+
if (is_array($url)) {
|
241 |
+
$data = $query_parameters;
|
242 |
+
$query_parameters = $url;
|
243 |
+
$url = $this->baseUrl;
|
244 |
+
}
|
245 |
+
|
246 |
+
$this->setURL($url, $query_parameters);
|
247 |
+
$this->setOpt(CURLOPT_CUSTOMREQUEST, 'DELETE');
|
248 |
+
$this->setOpt(CURLOPT_POSTFIELDS, $this->buildPostData($data));
|
249 |
+
return $this->exec();
|
250 |
+
}
|
251 |
+
|
252 |
+
/**
|
253 |
+
* Download Complete
|
254 |
+
*
|
255 |
+
* @access public
|
256 |
+
* @param $fh
|
257 |
+
*/
|
258 |
+
public function downloadComplete($fh)
|
259 |
+
{
|
260 |
+
if (!$this->error && $this->downloadCompleteFunction) {
|
261 |
+
rewind($fh);
|
262 |
+
$this->call($this->downloadCompleteFunction, $fh);
|
263 |
+
$this->downloadCompleteFunction = null;
|
264 |
+
}
|
265 |
+
|
266 |
+
if (is_resource($fh)) {
|
267 |
+
fclose($fh);
|
268 |
+
}
|
269 |
+
|
270 |
+
// Fix "PHP Notice: Use of undefined constant STDOUT" when reading the
|
271 |
+
// PHP script from stdin. Using null causes "Warning: curl_setopt():
|
272 |
+
// supplied argument is not a valid File-Handle resource".
|
273 |
+
if (!defined('STDOUT')) {
|
274 |
+
define('STDOUT', fopen('php://stdout', 'w'));
|
275 |
+
}
|
276 |
+
|
277 |
+
// Reset CURLOPT_FILE with STDOUT to avoid: "curl_exec(): CURLOPT_FILE
|
278 |
+
// resource has gone away, resetting to default".
|
279 |
+
$this->setOpt(CURLOPT_FILE, STDOUT);
|
280 |
+
|
281 |
+
// Reset CURLOPT_RETURNTRANSFER to tell cURL to return subsequent
|
282 |
+
// responses as the return value of curl_exec(). Without this,
|
283 |
+
// curl_exec() will revert to returning boolean values.
|
284 |
+
$this->setOpt(CURLOPT_RETURNTRANSFER, true);
|
285 |
+
}
|
286 |
+
|
287 |
+
/**
|
288 |
+
* Download
|
289 |
+
*
|
290 |
+
* @access public
|
291 |
+
* @param $url
|
292 |
+
* @param $mixed_filename
|
293 |
+
*
|
294 |
+
* @return boolean
|
295 |
+
*/
|
296 |
+
public function download($url, $mixed_filename)
|
297 |
+
{
|
298 |
+
if (is_callable($mixed_filename)) {
|
299 |
+
$this->downloadCompleteFunction = $mixed_filename;
|
300 |
+
$fh = tmpfile();
|
301 |
+
} else {
|
302 |
+
$filename = $mixed_filename;
|
303 |
+
$fh = fopen($filename, 'wb');
|
304 |
+
}
|
305 |
+
|
306 |
+
$this->setOpt(CURLOPT_FILE, $fh);
|
307 |
+
$this->get($url);
|
308 |
+
$this->downloadComplete($fh);
|
309 |
+
|
310 |
+
return ! $this->error;
|
311 |
+
}
|
312 |
+
|
313 |
+
/**
|
314 |
+
* Error
|
315 |
+
*
|
316 |
+
* @access public
|
317 |
+
* @param $callback
|
318 |
+
*/
|
319 |
+
public function error($callback)
|
320 |
+
{
|
321 |
+
$this->errorFunction = $callback;
|
322 |
+
}
|
323 |
+
|
324 |
+
/**
|
325 |
+
* Exec
|
326 |
+
*
|
327 |
+
* @access public
|
328 |
+
* @param $ch
|
329 |
+
*
|
330 |
+
* @return mixed Returns the value provided by parseResponse.
|
331 |
+
*/
|
332 |
+
public function exec($ch = null)
|
333 |
+
{
|
334 |
+
$this->responseCookies = array();
|
335 |
+
if (!($ch === null)) {
|
336 |
+
$this->rawResponse = curl_multi_getcontent($ch);
|
337 |
+
} else {
|
338 |
+
$this->call($this->beforeSendFunction);
|
339 |
+
$this->rawResponse = curl_exec($this->curl);
|
340 |
+
$this->curlErrorCode = curl_errno($this->curl);
|
341 |
+
}
|
342 |
+
$this->curlErrorMessage = curl_error($this->curl);
|
343 |
+
$this->curlError = !($this->curlErrorCode === 0);
|
344 |
+
$this->httpStatusCode = $this->getInfo(CURLINFO_HTTP_CODE);
|
345 |
+
$this->httpError = in_array(floor($this->httpStatusCode / 100), array(4, 5));
|
346 |
+
$this->error = $this->curlError || $this->httpError;
|
347 |
+
$this->errorCode = $this->error ? ($this->curlError ? $this->curlErrorCode : $this->httpStatusCode) : 0;
|
348 |
+
|
349 |
+
// NOTE: CURLINFO_HEADER_OUT set to true is required for requestHeaders
|
350 |
+
// to not be empty (e.g. $curl->setOpt(CURLINFO_HEADER_OUT, true);).
|
351 |
+
if ($this->getOpt(CURLINFO_HEADER_OUT) === true) {
|
352 |
+
$this->requestHeaders = $this->parseRequestHeaders($this->getInfo(CURLINFO_HEADER_OUT));
|
353 |
+
}
|
354 |
+
$this->responseHeaders = $this->parseResponseHeaders($this->rawResponseHeaders);
|
355 |
+
$this->response = $this->parseResponse($this->responseHeaders, $this->rawResponse);
|
356 |
+
|
357 |
+
$this->httpErrorMessage = '';
|
358 |
+
if ($this->error) {
|
359 |
+
if (isset($this->responseHeaders['Status-Line'])) {
|
360 |
+
$this->httpErrorMessage = $this->responseHeaders['Status-Line'];
|
361 |
+
}
|
362 |
+
}
|
363 |
+
$this->errorMessage = $this->curlError ? $this->curlErrorMessage : $this->httpErrorMessage;
|
364 |
+
|
365 |
+
if (!$this->error) {
|
366 |
+
$this->call($this->successFunction);
|
367 |
+
} else {
|
368 |
+
$this->call($this->errorFunction);
|
369 |
+
}
|
370 |
+
|
371 |
+
$this->call($this->completeFunction);
|
372 |
+
|
373 |
+
return $this->response;
|
374 |
+
}
|
375 |
+
|
376 |
+
/**
|
377 |
+
* Get
|
378 |
+
*
|
379 |
+
* @access public
|
380 |
+
* @param $url
|
381 |
+
* @param $data
|
382 |
+
*
|
383 |
+
* @return mixed Returns the value provided by exec.
|
384 |
+
*/
|
385 |
+
public function get($url, $data = array())
|
386 |
+
{
|
387 |
+
if (is_array($url)) {
|
388 |
+
$data = $url;
|
389 |
+
$url = $this->baseUrl;
|
390 |
+
}
|
391 |
+
$this->setURL($url, $data);
|
392 |
+
$this->setOpt(CURLOPT_CUSTOMREQUEST, 'GET');
|
393 |
+
$this->setOpt(CURLOPT_HTTPGET, true);
|
394 |
+
return $this->exec();
|
395 |
+
}
|
396 |
+
|
397 |
+
/**
|
398 |
+
* Get Info
|
399 |
+
*
|
400 |
+
* @access public
|
401 |
+
* @param $opt
|
402 |
+
*/
|
403 |
+
public function getInfo($opt)
|
404 |
+
{
|
405 |
+
return curl_getinfo($this->curl, $opt);
|
406 |
+
}
|
407 |
+
|
408 |
+
/**
|
409 |
+
* Get Opt
|
410 |
+
*
|
411 |
+
* @access public
|
412 |
+
* @param $option
|
413 |
+
*
|
414 |
+
* @return mixed
|
415 |
+
*/
|
416 |
+
public function getOpt($option)
|
417 |
+
{
|
418 |
+
return $this->options[$option];
|
419 |
+
}
|
420 |
+
|
421 |
+
/**
|
422 |
+
* Head
|
423 |
+
*
|
424 |
+
* @access public
|
425 |
+
* @param $url
|
426 |
+
* @param $data
|
427 |
+
*
|
428 |
+
* @return string
|
429 |
+
*/
|
430 |
+
public function head($url, $data = array())
|
431 |
+
{
|
432 |
+
if (is_array($url)) {
|
433 |
+
$data = $url;
|
434 |
+
$url = $this->baseUrl;
|
435 |
+
}
|
436 |
+
$this->setURL($url, $data);
|
437 |
+
$this->setOpt(CURLOPT_CUSTOMREQUEST, 'HEAD');
|
438 |
+
$this->setOpt(CURLOPT_NOBODY, true);
|
439 |
+
return $this->exec();
|
440 |
+
}
|
441 |
+
|
442 |
+
/**
|
443 |
+
* Header Callback
|
444 |
+
*
|
445 |
+
* @access public
|
446 |
+
* @param $ch
|
447 |
+
* @param $header
|
448 |
+
*
|
449 |
+
* @return integer
|
450 |
+
*/
|
451 |
+
public function headerCallback($ch, $header)
|
452 |
+
{
|
453 |
+
if (preg_match('/^Set-Cookie:\s*([^=]+)=([^;]+)/mi', $header, $cookie) === 1) {
|
454 |
+
$this->responseCookies[$cookie[1]] = trim($cookie[2], " \n\r\t\0\x0B");
|
455 |
+
}
|
456 |
+
$this->rawResponseHeaders .= $header;
|
457 |
+
return strlen($header);
|
458 |
+
}
|
459 |
+
|
460 |
+
/**
|
461 |
+
* Options
|
462 |
+
*
|
463 |
+
* @access public
|
464 |
+
* @param $url
|
465 |
+
* @param $data
|
466 |
+
*
|
467 |
+
* @return string
|
468 |
+
*/
|
469 |
+
public function options($url, $data = array())
|
470 |
+
{
|
471 |
+
if (is_array($url)) {
|
472 |
+
$data = $url;
|
473 |
+
$url = $this->baseUrl;
|
474 |
+
}
|
475 |
+
$this->setURL($url, $data);
|
476 |
+
$this->unsetHeader('Content-Length');
|
477 |
+
$this->setOpt(CURLOPT_CUSTOMREQUEST, 'OPTIONS');
|
478 |
+
return $this->exec();
|
479 |
+
}
|
480 |
+
|
481 |
+
/**
|
482 |
+
* Patch
|
483 |
+
*
|
484 |
+
* @access public
|
485 |
+
* @param $url
|
486 |
+
* @param $data
|
487 |
+
*
|
488 |
+
* @return string
|
489 |
+
*/
|
490 |
+
public function patch($url, $data = array())
|
491 |
+
{
|
492 |
+
if (is_array($url)) {
|
493 |
+
$data = $url;
|
494 |
+
$url = $this->baseUrl;
|
495 |
+
}
|
496 |
+
|
497 |
+
if (is_array($data) && empty($data)) {
|
498 |
+
$this->unsetHeader('Content-Length');
|
499 |
+
}
|
500 |
+
|
501 |
+
$this->setURL($url);
|
502 |
+
$this->setOpt(CURLOPT_CUSTOMREQUEST, 'PATCH');
|
503 |
+
$this->setOpt(CURLOPT_POSTFIELDS, $this->buildPostData($data));
|
504 |
+
return $this->exec();
|
505 |
+
}
|
506 |
+
|
507 |
+
/**
|
508 |
+
* Post
|
509 |
+
*
|
510 |
+
* @access public
|
511 |
+
* @param $url
|
512 |
+
* @param $data
|
513 |
+
* @param $follow_303_with_post If true, will cause 303 redirections to be followed using
|
514 |
+
* a POST request (default: false).
|
515 |
+
* Notes:
|
516 |
+
* - Redirections are only followed if the CURLOPT_FOLLOWLOCATION option is set to true.
|
517 |
+
* - According to the HTTP specs (see [1]), a 303 redirection should be followed using
|
518 |
+
* the GET method. 301 and 302 must not.
|
519 |
+
* - In order to force a 303 redirection to be performed using the same method, the
|
520 |
+
* underlying cURL object must be set in a special state (the CURLOPT_CURSTOMREQUEST
|
521 |
+
* option must be set to the method to use after the redirection). Due to a limitation
|
522 |
+
* of the cURL extension of PHP < 5.5.11 ([2], [3]) and of HHVM, it is not possible
|
523 |
+
* to reset this option. Using these PHP engines, it is therefore impossible to
|
524 |
+
* restore this behavior on an existing php-curl-class Curl object.
|
525 |
+
*
|
526 |
+
* @return string
|
527 |
+
*
|
528 |
+
* [1] https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.3.2
|
529 |
+
* [2] https://github.com/php/php-src/pull/531
|
530 |
+
* [3] http://php.net/ChangeLog-5.php#5.5.11
|
531 |
+
*/
|
532 |
+
public function post($url, $data = array(), $follow_303_with_post = false)
|
533 |
+
{
|
534 |
+
if (is_array($url)) {
|
535 |
+
$follow_303_with_post = (bool)$data;
|
536 |
+
$data = $url;
|
537 |
+
$url = $this->baseUrl;
|
538 |
+
}
|
539 |
+
|
540 |
+
$this->setURL($url);
|
541 |
+
|
542 |
+
if ($follow_303_with_post) {
|
543 |
+
$this->setOpt(CURLOPT_CUSTOMREQUEST, 'POST');
|
544 |
+
} else {
|
545 |
+
if (isset($this->options[CURLOPT_CUSTOMREQUEST])) {
|
546 |
+
if ((version_compare(PHP_VERSION, '5.5.11') < 0) || defined('HHVM_VERSION')) {
|
547 |
+
trigger_error('Due to technical limitations of PHP <= 5.5.11 and HHVM, it is not possible to '
|
548 |
+
. 'perform a post-redirect-get request using a php-curl-class Curl object that '
|
549 |
+
. 'has already been used to perform other types of requests. Either use a new '
|
550 |
+
. 'php-curl-class Curl object or upgrade your PHP engine.',
|
551 |
+
E_USER_ERROR);
|
552 |
+
} else {
|
553 |
+
$this->setOpt(CURLOPT_CUSTOMREQUEST, null);
|
554 |
+
}
|
555 |
+
}
|
556 |
+
}
|
557 |
+
|
558 |
+
$this->setOpt(CURLOPT_POST, true);
|
559 |
+
$this->setOpt(CURLOPT_POSTFIELDS, $this->buildPostData($data));
|
560 |
+
return $this->exec();
|
561 |
+
}
|
562 |
+
|
563 |
+
/**
|
564 |
+
* Put
|
565 |
+
*
|
566 |
+
* @access public
|
567 |
+
* @param $url
|
568 |
+
* @param $data
|
569 |
+
*
|
570 |
+
* @return string
|
571 |
+
*/
|
572 |
+
public function put($url, $data = array())
|
573 |
+
{
|
574 |
+
if (is_array($url)) {
|
575 |
+
$data = $url;
|
576 |
+
$url = $this->baseUrl;
|
577 |
+
}
|
578 |
+
$this->setURL($url);
|
579 |
+
$this->setOpt(CURLOPT_CUSTOMREQUEST, 'PUT');
|
580 |
+
$put_data = $this->buildPostData($data);
|
581 |
+
if (empty($this->options[CURLOPT_INFILE]) && empty($this->options[CURLOPT_INFILESIZE])) {
|
582 |
+
$this->setHeader('Content-Length', strlen($put_data));
|
583 |
+
}
|
584 |
+
if (!empty($put_data)) {
|
585 |
+
$this->setOpt(CURLOPT_POSTFIELDS, $put_data);
|
586 |
+
}
|
587 |
+
return $this->exec();
|
588 |
+
}
|
589 |
+
|
590 |
+
/**
|
591 |
+
* Set Basic Authentication
|
592 |
+
*
|
593 |
+
* @access public
|
594 |
+
* @param $username
|
595 |
+
* @param $password
|
596 |
+
*/
|
597 |
+
public function setBasicAuthentication($username, $password = '')
|
598 |
+
{
|
599 |
+
$this->setOpt(CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
|
600 |
+
$this->setOpt(CURLOPT_USERPWD, $username . ':' . $password);
|
601 |
+
}
|
602 |
+
|
603 |
+
/**
|
604 |
+
* Set Digest Authentication
|
605 |
+
*
|
606 |
+
* @access public
|
607 |
+
* @param $username
|
608 |
+
* @param $password
|
609 |
+
*/
|
610 |
+
public function setDigestAuthentication($username, $password = '')
|
611 |
+
{
|
612 |
+
$this->setOpt(CURLOPT_HTTPAUTH, CURLAUTH_DIGEST);
|
613 |
+
$this->setOpt(CURLOPT_USERPWD, $username . ':' . $password);
|
614 |
+
}
|
615 |
+
|
616 |
+
/**
|
617 |
+
* Set Cookie
|
618 |
+
*
|
619 |
+
* @access public
|
620 |
+
* @param $key
|
621 |
+
* @param $value
|
622 |
+
*/
|
623 |
+
public function setCookie($key, $value)
|
624 |
+
{
|
625 |
+
$name_chars = array();
|
626 |
+
foreach (str_split($key) as $name_char) {
|
627 |
+
if (!isset($this->rfc2616[$name_char])) {
|
628 |
+
$name_chars[] = rawurlencode($name_char);
|
629 |
+
} else {
|
630 |
+
$name_chars[] = $name_char;
|
631 |
+
}
|
632 |
+
}
|
633 |
+
|
634 |
+
$value_chars = array();
|
635 |
+
foreach (str_split($value) as $value_char) {
|
636 |
+
if (!isset($this->rfc6265[$value_char])) {
|
637 |
+
$value_chars[] = rawurlencode($value_char);
|
638 |
+
} else {
|
639 |
+
$value_chars[] = $value_char;
|
640 |
+
}
|
641 |
+
}
|
642 |
+
|
643 |
+
$this->cookies[implode('', $name_chars)] = implode('', $value_chars);
|
644 |
+
$this->setOpt(CURLOPT_COOKIE, implode('; ', array_map(function($k, $v) {
|
645 |
+
return $k . '=' . $v;
|
646 |
+
}, array_keys($this->cookies), array_values($this->cookies))));
|
647 |
+
}
|
648 |
+
|
649 |
+
/**
|
650 |
+
* Get cookie.
|
651 |
+
*
|
652 |
+
* @access public
|
653 |
+
* @param $key
|
654 |
+
* @return mixed
|
655 |
+
*/
|
656 |
+
public function getCookie($key)
|
657 |
+
{
|
658 |
+
return $this->getResponseCookie($key);
|
659 |
+
}
|
660 |
+
|
661 |
+
/**
|
662 |
+
* Get response cookie.
|
663 |
+
*
|
664 |
+
* @access public
|
665 |
+
* @param $key
|
666 |
+
* @return mixed
|
667 |
+
*/
|
668 |
+
public function getResponseCookie($key)
|
669 |
+
{
|
670 |
+
return isset($this->responseCookies[$key]) ? $this->responseCookies[$key] : null;
|
671 |
+
}
|
672 |
+
|
673 |
+
/**
|
674 |
+
* Get response cookies.
|
675 |
+
*
|
676 |
+
* @access public
|
677 |
+
* @return array
|
678 |
+
*/
|
679 |
+
public function getResponseCookies()
|
680 |
+
{
|
681 |
+
return $this->responseCookies;
|
682 |
+
}
|
683 |
+
|
684 |
+
/**
|
685 |
+
* Set Port
|
686 |
+
*
|
687 |
+
* @access public
|
688 |
+
* @param $port
|
689 |
+
*/
|
690 |
+
public function setPort($port)
|
691 |
+
{
|
692 |
+
$this->setOpt(CURLOPT_PORT, intval($port));
|
693 |
+
}
|
694 |
+
|
695 |
+
/**
|
696 |
+
* Set Connect Timeout
|
697 |
+
*
|
698 |
+
* @access public
|
699 |
+
* @param $seconds
|
700 |
+
*/
|
701 |
+
public function setConnectTimeout($seconds)
|
702 |
+
{
|
703 |
+
$this->setOpt(CURLOPT_CONNECTTIMEOUT, $seconds);
|
704 |
+
}
|
705 |
+
|
706 |
+
/**
|
707 |
+
* Set Cookie String
|
708 |
+
*
|
709 |
+
* @access public
|
710 |
+
* @param $string
|
711 |
+
*/
|
712 |
+
public function setCookieString($string)
|
713 |
+
{
|
714 |
+
return $this->setOpt(CURLOPT_COOKIE, $string);
|
715 |
+
}
|
716 |
+
|
717 |
+
/**
|
718 |
+
* Set Cookie File
|
719 |
+
*
|
720 |
+
* @access public
|
721 |
+
* @param $cookie_file
|
722 |
+
*/
|
723 |
+
public function setCookieFile($cookie_file)
|
724 |
+
{
|
725 |
+
$this->setOpt(CURLOPT_COOKIEFILE, $cookie_file);
|
726 |
+
}
|
727 |
+
|
728 |
+
/**
|
729 |
+
* Set Cookie Jar
|
730 |
+
*
|
731 |
+
* @access public
|
732 |
+
* @param $cookie_jar
|
733 |
+
*/
|
734 |
+
public function setCookieJar($cookie_jar)
|
735 |
+
{
|
736 |
+
$this->setOpt(CURLOPT_COOKIEJAR, $cookie_jar);
|
737 |
+
}
|
738 |
+
|
739 |
+
/**
|
740 |
+
* Set Default JSON Decoder
|
741 |
+
*
|
742 |
+
* @access public
|
743 |
+
* @param $assoc
|
744 |
+
* @param $depth
|
745 |
+
* @param $options
|
746 |
+
*/
|
747 |
+
public function setDefaultJsonDecoder()
|
748 |
+
{
|
749 |
+
$args = func_get_args();
|
750 |
+
$this->jsonDecoder = function($response) use ($args) {
|
751 |
+
array_unshift($args, $response);
|
752 |
+
|
753 |
+
// Call json_decode() without the $options parameter in PHP
|
754 |
+
// versions less than 5.4.0 as the $options parameter was added in
|
755 |
+
// PHP version 5.4.0.
|
756 |
+
if (version_compare(PHP_VERSION, '5.4.0', '<')) {
|
757 |
+
$args = array_slice($args, 0, 3);
|
758 |
+
}
|
759 |
+
|
760 |
+
$json_obj = call_user_func_array('json_decode', $args);
|
761 |
+
if (!($json_obj === null)) {
|
762 |
+
$response = $json_obj;
|
763 |
+
}
|
764 |
+
return $response;
|
765 |
+
};
|
766 |
+
}
|
767 |
+
|
768 |
+
/**
|
769 |
+
* Set Default XML Decoder
|
770 |
+
*
|
771 |
+
* @access public
|
772 |
+
*/
|
773 |
+
public function setDefaultXmlDecoder()
|
774 |
+
{
|
775 |
+
$this->xmlDecoder = function($response) {
|
776 |
+
$xml_obj = @simplexml_load_string($response);
|
777 |
+
if (!($xml_obj === false)) {
|
778 |
+
$response = $xml_obj;
|
779 |
+
}
|
780 |
+
return $response;
|
781 |
+
};
|
782 |
+
}
|
783 |
+
|
784 |
+
/**
|
785 |
+
* Set Default Decoder
|
786 |
+
*
|
787 |
+
* @access public
|
788 |
+
* @param $decoder string|callable
|
789 |
+
*/
|
790 |
+
public function setDefaultDecoder($decoder = 'json')
|
791 |
+
{
|
792 |
+
if (is_callable($decoder)) {
|
793 |
+
$this->defaultDecoder = $decoder;
|
794 |
+
} else {
|
795 |
+
if ($decoder === 'json') {
|
796 |
+
$this->defaultDecoder = $this->jsonDecoder;
|
797 |
+
} elseif ($decoder === 'xml') {
|
798 |
+
$this->defaultDecoder = $this->xmlDecoder;
|
799 |
+
}
|
800 |
+
}
|
801 |
+
}
|
802 |
+
|
803 |
+
/**
|
804 |
+
* Set Default Timeout
|
805 |
+
*
|
806 |
+
* @access public
|
807 |
+
*/
|
808 |
+
public function setDefaultTimeout()
|
809 |
+
{
|
810 |
+
$this->setTimeout(self::DEFAULT_TIMEOUT);
|
811 |
+
}
|
812 |
+
|
813 |
+
/**
|
814 |
+
* Set Default User Agent
|
815 |
+
*
|
816 |
+
* @access public
|
817 |
+
*/
|
818 |
+
public function setDefaultUserAgent()
|
819 |
+
{
|
820 |
+
$user_agent = 'PHP-Curl-Class/' . self::VERSION . ' (+https://github.com/php-curl-class/php-curl-class)';
|
821 |
+
$user_agent .= ' PHP/' . PHP_VERSION;
|
822 |
+
$curl_version = curl_version();
|
823 |
+
$user_agent .= ' curl/' . $curl_version['version'];
|
824 |
+
$this->setUserAgent($user_agent);
|
825 |
+
}
|
826 |
+
|
827 |
+
/**
|
828 |
+
* Set Header
|
829 |
+
*
|
830 |
+
* @access public
|
831 |
+
* @param $key
|
832 |
+
* @param $value
|
833 |
+
*/
|
834 |
+
public function setHeader($key, $value)
|
835 |
+
{
|
836 |
+
$this->headers[$key] = $value;
|
837 |
+
$headers = array();
|
838 |
+
foreach ($this->headers as $key => $value) {
|
839 |
+
$headers[] = $key . ': ' . $value;
|
840 |
+
}
|
841 |
+
$this->setOpt(CURLOPT_HTTPHEADER, $headers);
|
842 |
+
}
|
843 |
+
|
844 |
+
/**
|
845 |
+
* Set JSON Decoder
|
846 |
+
*
|
847 |
+
* @access public
|
848 |
+
* @param $function
|
849 |
+
*/
|
850 |
+
public function setJsonDecoder($function)
|
851 |
+
{
|
852 |
+
if (is_callable($function)) {
|
853 |
+
$this->jsonDecoder = $function;
|
854 |
+
}
|
855 |
+
}
|
856 |
+
|
857 |
+
/**
|
858 |
+
* Set XML Decoder
|
859 |
+
*
|
860 |
+
* @access public
|
861 |
+
* @param $function
|
862 |
+
*/
|
863 |
+
public function setXmlDecoder($function)
|
864 |
+
{
|
865 |
+
if (is_callable($function)) {
|
866 |
+
$this->xmlDecoder = $function;
|
867 |
+
}
|
868 |
+
}
|
869 |
+
|
870 |
+
/**
|
871 |
+
* Set Opt
|
872 |
+
*
|
873 |
+
* @access public
|
874 |
+
* @param $option
|
875 |
+
* @param $value
|
876 |
+
*
|
877 |
+
* @return boolean
|
878 |
+
*/
|
879 |
+
public function setOpt($option, $value)
|
880 |
+
{
|
881 |
+
$required_options = array(
|
882 |
+
CURLOPT_RETURNTRANSFER => 'CURLOPT_RETURNTRANSFER',
|
883 |
+
);
|
884 |
+
|
885 |
+
if (in_array($option, array_keys($required_options), true) && !($value === true)) {
|
886 |
+
trigger_error($required_options[$option] . ' is a required option', E_USER_WARNING);
|
887 |
+
}
|
888 |
+
|
889 |
+
$this->options[$option] = $value;
|
890 |
+
return curl_setopt($this->curl, $option, $value);
|
891 |
+
}
|
892 |
+
|
893 |
+
/**
|
894 |
+
* Set Referer
|
895 |
+
*
|
896 |
+
* @access public
|
897 |
+
* @param $referer
|
898 |
+
*/
|
899 |
+
public function setReferer($referer)
|
900 |
+
{
|
901 |
+
$this->setReferrer($referer);
|
902 |
+
}
|
903 |
+
|
904 |
+
/**
|
905 |
+
* Set Referrer
|
906 |
+
*
|
907 |
+
* @access public
|
908 |
+
* @param $referrer
|
909 |
+
*/
|
910 |
+
public function setReferrer($referrer)
|
911 |
+
{
|
912 |
+
$this->setOpt(CURLOPT_REFERER, $referrer);
|
913 |
+
}
|
914 |
+
|
915 |
+
/**
|
916 |
+
* Set Timeout
|
917 |
+
*
|
918 |
+
* @access public
|
919 |
+
* @param $seconds
|
920 |
+
*/
|
921 |
+
public function setTimeout($seconds)
|
922 |
+
{
|
923 |
+
$this->setOpt(CURLOPT_TIMEOUT, $seconds);
|
924 |
+
}
|
925 |
+
|
926 |
+
/**
|
927 |
+
* Set Url
|
928 |
+
*
|
929 |
+
* @access public
|
930 |
+
* @param $url
|
931 |
+
* @param $data
|
932 |
+
*/
|
933 |
+
public function setURL($url, $data = array())
|
934 |
+
{
|
935 |
+
$this->baseUrl = $url;
|
936 |
+
$this->url = $this->buildURL($url, $data);
|
937 |
+
$this->setOpt(CURLOPT_URL, $this->url);
|
938 |
+
}
|
939 |
+
|
940 |
+
/**
|
941 |
+
* Set User Agent
|
942 |
+
*
|
943 |
+
* @access public
|
944 |
+
* @param $user_agent
|
945 |
+
*/
|
946 |
+
public function setUserAgent($user_agent)
|
947 |
+
{
|
948 |
+
$this->setOpt(CURLOPT_USERAGENT, $user_agent);
|
949 |
+
}
|
950 |
+
|
951 |
+
/**
|
952 |
+
* Success
|
953 |
+
*
|
954 |
+
* @access public
|
955 |
+
* @param $callback
|
956 |
+
*/
|
957 |
+
public function success($callback)
|
958 |
+
{
|
959 |
+
$this->successFunction = $callback;
|
960 |
+
}
|
961 |
+
|
962 |
+
/**
|
963 |
+
* Unset Header
|
964 |
+
*
|
965 |
+
* @access public
|
966 |
+
* @param $key
|
967 |
+
*/
|
968 |
+
public function unsetHeader($key)
|
969 |
+
{
|
970 |
+
$this->setHeader($key, '');
|
971 |
+
unset($this->headers[$key]);
|
972 |
+
}
|
973 |
+
|
974 |
+
/**
|
975 |
+
* Verbose
|
976 |
+
*
|
977 |
+
* @access public
|
978 |
+
* @param bool $on
|
979 |
+
* @param resource $output
|
980 |
+
*/
|
981 |
+
public function verbose($on = true, $output = STDERR)
|
982 |
+
{
|
983 |
+
// Turn off CURLINFO_HEADER_OUT for verbose to work. This has the side
|
984 |
+
// effect of causing Curl::requestHeaders to be empty.
|
985 |
+
if ($on) {
|
986 |
+
$this->setOpt(CURLINFO_HEADER_OUT, false);
|
987 |
+
}
|
988 |
+
$this->setOpt(CURLOPT_VERBOSE, $on);
|
989 |
+
$this->setOpt(CURLOPT_STDERR, $output);
|
990 |
+
}
|
991 |
+
|
992 |
+
/**
|
993 |
+
* Destruct
|
994 |
+
*
|
995 |
+
* @access public
|
996 |
+
*/
|
997 |
+
public function __destruct()
|
998 |
+
{
|
999 |
+
$this->close();
|
1000 |
+
}
|
1001 |
+
|
1002 |
+
public function __get($name)
|
1003 |
+
{
|
1004 |
+
$return = null;
|
1005 |
+
if (in_array($name, self::$deferredProperties) && is_callable(array($this, $getter = '__get_' . $name))) {
|
1006 |
+
$return = $this->$name = $this->$getter();
|
1007 |
+
}
|
1008 |
+
return $return;
|
1009 |
+
}
|
1010 |
+
|
1011 |
+
/**
|
1012 |
+
* Get Effective Url
|
1013 |
+
*
|
1014 |
+
* @access private
|
1015 |
+
*/
|
1016 |
+
private function __get_effectiveUrl() {
|
1017 |
+
return $this->getInfo(CURLINFO_EFFECTIVE_URL);
|
1018 |
+
}
|
1019 |
+
|
1020 |
+
/**
|
1021 |
+
* Get Total Time
|
1022 |
+
*
|
1023 |
+
* @access private
|
1024 |
+
*/
|
1025 |
+
private function __get_totalTime() {
|
1026 |
+
return $this->getInfo(CURLINFO_TOTAL_TIME);
|
1027 |
+
}
|
1028 |
+
|
1029 |
+
/**
|
1030 |
+
* Build Url
|
1031 |
+
*
|
1032 |
+
* @access private
|
1033 |
+
* @param $url
|
1034 |
+
* @param $data
|
1035 |
+
*
|
1036 |
+
* @return string
|
1037 |
+
*/
|
1038 |
+
private function buildURL($url, $data = array())
|
1039 |
+
{
|
1040 |
+
return $url . (empty($data) ? '' : '?' . http_build_query($data));
|
1041 |
+
}
|
1042 |
+
|
1043 |
+
/**
|
1044 |
+
* Parse Headers
|
1045 |
+
*
|
1046 |
+
* @access private
|
1047 |
+
* @param $raw_headers
|
1048 |
+
*
|
1049 |
+
* @return array
|
1050 |
+
*/
|
1051 |
+
private function parseHeaders($raw_headers)
|
1052 |
+
{
|
1053 |
+
$raw_headers = preg_split('/\r\n/', $raw_headers, null, PREG_SPLIT_NO_EMPTY);
|
1054 |
+
$http_headers = new CaseInsensitiveArray();
|
1055 |
+
|
1056 |
+
$raw_headers_count = count($raw_headers);
|
1057 |
+
for ($i = 1; $i < $raw_headers_count; $i++) {
|
1058 |
+
list($key, $value) = explode(':', $raw_headers[$i], 2);
|
1059 |
+
$key = trim($key);
|
1060 |
+
$value = trim($value);
|
1061 |
+
// Use isset() as array_key_exists() and ArrayAccess are not compatible.
|
1062 |
+
if (isset($http_headers[$key])) {
|
1063 |
+
$http_headers[$key] .= ',' . $value;
|
1064 |
+
} else {
|
1065 |
+
$http_headers[$key] = $value;
|
1066 |
+
}
|
1067 |
+
}
|
1068 |
+
|
1069 |
+
return array(isset($raw_headers['0']) ? $raw_headers['0'] : '', $http_headers);
|
1070 |
+
}
|
1071 |
+
|
1072 |
+
/**
|
1073 |
+
* Parse Request Headers
|
1074 |
+
*
|
1075 |
+
* @access private
|
1076 |
+
* @param $raw_headers
|
1077 |
+
*
|
1078 |
+
* @return array
|
1079 |
+
*/
|
1080 |
+
private function parseRequestHeaders($raw_headers)
|
1081 |
+
{
|
1082 |
+
$request_headers = new CaseInsensitiveArray();
|
1083 |
+
list($first_line, $headers) = $this->parseHeaders($raw_headers);
|
1084 |
+
$request_headers['Request-Line'] = $first_line;
|
1085 |
+
foreach ($headers as $key => $value) {
|
1086 |
+
$request_headers[$key] = $value;
|
1087 |
+
}
|
1088 |
+
return $request_headers;
|
1089 |
+
}
|
1090 |
+
|
1091 |
+
/**
|
1092 |
+
* Parse Response
|
1093 |
+
*
|
1094 |
+
* @access private
|
1095 |
+
* @param $response_headers
|
1096 |
+
* @param $raw_response
|
1097 |
+
*
|
1098 |
+
* @return mixed
|
1099 |
+
* Provided the content-type is determined to be json or xml:
|
1100 |
+
* Returns stdClass object when the default json decoder is used and the content-type is json.
|
1101 |
+
* Returns SimpleXMLElement object when the default xml decoder is used and the content-type is xml.
|
1102 |
+
*/
|
1103 |
+
private function parseResponse($response_headers, $raw_response)
|
1104 |
+
{
|
1105 |
+
$response = $raw_response;
|
1106 |
+
if (isset($response_headers['Content-Type'])) {
|
1107 |
+
if (preg_match($this->jsonPattern, $response_headers['Content-Type'])) {
|
1108 |
+
$json_decoder = $this->jsonDecoder;
|
1109 |
+
if (is_callable($json_decoder)) {
|
1110 |
+
$response = $json_decoder($response);
|
1111 |
+
}
|
1112 |
+
} elseif (preg_match($this->xmlPattern, $response_headers['Content-Type'])) {
|
1113 |
+
$xml_decoder = $this->xmlDecoder;
|
1114 |
+
if (is_callable($xml_decoder)) {
|
1115 |
+
$response = $xml_decoder($response);
|
1116 |
+
}
|
1117 |
+
} else {
|
1118 |
+
$decoder = $this->defaultDecoder;
|
1119 |
+
if (is_callable($decoder)) {
|
1120 |
+
$response = $decoder($response);
|
1121 |
+
}
|
1122 |
+
}
|
1123 |
+
}
|
1124 |
+
|
1125 |
+
return $response;
|
1126 |
+
}
|
1127 |
+
|
1128 |
+
/**
|
1129 |
+
* Parse Response Headers
|
1130 |
+
*
|
1131 |
+
* @access private
|
1132 |
+
* @param $raw_response_headers
|
1133 |
+
*
|
1134 |
+
* @return array
|
1135 |
+
*/
|
1136 |
+
private function parseResponseHeaders($raw_response_headers)
|
1137 |
+
{
|
1138 |
+
$response_header_array = explode("\r\n\r\n", $raw_response_headers);
|
1139 |
+
$response_header = '';
|
1140 |
+
for ($i = count($response_header_array) - 1; $i >= 0; $i--) {
|
1141 |
+
if (stripos($response_header_array[$i], 'HTTP/') === 0) {
|
1142 |
+
$response_header = $response_header_array[$i];
|
1143 |
+
break;
|
1144 |
+
}
|
1145 |
+
}
|
1146 |
+
|
1147 |
+
$response_headers = new CaseInsensitiveArray();
|
1148 |
+
list($first_line, $headers) = $this->parseHeaders($response_header);
|
1149 |
+
$response_headers['Status-Line'] = $first_line;
|
1150 |
+
foreach ($headers as $key => $value) {
|
1151 |
+
$response_headers[$key] = $value;
|
1152 |
+
}
|
1153 |
+
return $response_headers;
|
1154 |
+
}
|
1155 |
+
|
1156 |
+
/**
|
1157 |
+
* Http Build Multi Query
|
1158 |
+
*
|
1159 |
+
* @access public
|
1160 |
+
* @param $data
|
1161 |
+
* @param $key
|
1162 |
+
*
|
1163 |
+
* @return string
|
1164 |
+
*/
|
1165 |
+
public static function http_build_multi_query($data, $key = null)
|
1166 |
+
{
|
1167 |
+
$query = array();
|
1168 |
+
|
1169 |
+
if (empty($data)) {
|
1170 |
+
return $key . '=';
|
1171 |
+
}
|
1172 |
+
|
1173 |
+
$is_array_assoc = self::is_array_assoc($data);
|
1174 |
+
|
1175 |
+
foreach ($data as $k => $value) {
|
1176 |
+
if (is_string($value) || is_numeric($value)) {
|
1177 |
+
$brackets = $is_array_assoc ? '[' . $k . ']' : '[]';
|
1178 |
+
$query[] = urlencode($key === null ? $k : $key . $brackets) . '=' . rawurlencode($value);
|
1179 |
+
} elseif (is_array($value)) {
|
1180 |
+
$nested = $key === null ? $k : $key . '[' . $k . ']';
|
1181 |
+
$query[] = self::http_build_multi_query($value, $nested);
|
1182 |
+
}
|
1183 |
+
}
|
1184 |
+
|
1185 |
+
return implode('&', $query);
|
1186 |
+
}
|
1187 |
+
|
1188 |
+
/**
|
1189 |
+
* Is Array Assoc
|
1190 |
+
*
|
1191 |
+
* @access public
|
1192 |
+
* @param $array
|
1193 |
+
*
|
1194 |
+
* @return boolean
|
1195 |
+
*/
|
1196 |
+
public static function is_array_assoc($array)
|
1197 |
+
{
|
1198 |
+
return (bool)count(array_filter(array_keys($array), 'is_string'));
|
1199 |
+
}
|
1200 |
+
|
1201 |
+
/**
|
1202 |
+
* Is Array Multidim
|
1203 |
+
*
|
1204 |
+
* @access public
|
1205 |
+
* @param $array
|
1206 |
+
*
|
1207 |
+
* @return boolean
|
1208 |
+
*/
|
1209 |
+
public static function is_array_multidim($array)
|
1210 |
+
{
|
1211 |
+
if (!is_array($array)) {
|
1212 |
+
return false;
|
1213 |
+
}
|
1214 |
+
|
1215 |
+
return (bool)count(array_filter($array, 'is_array'));
|
1216 |
+
}
|
1217 |
+
}
|
app/code/community/Pay/Payment/vendor/php-curl-class/php-curl-class/src/Curl/MultiCurl.php
ADDED
@@ -0,0 +1,632 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Curl;
|
4 |
+
|
5 |
+
class MultiCurl
|
6 |
+
{
|
7 |
+
public $baseUrl = null;
|
8 |
+
public $multiCurl;
|
9 |
+
public $curls = array();
|
10 |
+
private $curlFileHandles = array();
|
11 |
+
private $nextCurlId = 1;
|
12 |
+
private $isStarted = false;
|
13 |
+
|
14 |
+
private $beforeSendFunction = null;
|
15 |
+
private $successFunction = null;
|
16 |
+
private $errorFunction = null;
|
17 |
+
private $completeFunction = null;
|
18 |
+
|
19 |
+
private $cookies = array();
|
20 |
+
private $headers = array();
|
21 |
+
private $options = array();
|
22 |
+
|
23 |
+
private $jsonDecoder = null;
|
24 |
+
private $xmlDecoder = null;
|
25 |
+
|
26 |
+
/**
|
27 |
+
* Construct
|
28 |
+
*
|
29 |
+
* @access public
|
30 |
+
* @param $base_url
|
31 |
+
*/
|
32 |
+
public function __construct($base_url = null)
|
33 |
+
{
|
34 |
+
$this->multiCurl = curl_multi_init();
|
35 |
+
$this->headers = new CaseInsensitiveArray();
|
36 |
+
$this->setURL($base_url);
|
37 |
+
}
|
38 |
+
|
39 |
+
/**
|
40 |
+
* Add Delete
|
41 |
+
*
|
42 |
+
* @access public
|
43 |
+
* @param $url
|
44 |
+
* @param $query_parameters
|
45 |
+
* @param $data
|
46 |
+
*
|
47 |
+
* @return object
|
48 |
+
*/
|
49 |
+
public function addDelete($url, $query_parameters = array(), $data = array())
|
50 |
+
{
|
51 |
+
if (is_array($url)) {
|
52 |
+
$data = $query_parameters;
|
53 |
+
$query_parameters = $url;
|
54 |
+
$url = $this->baseUrl;
|
55 |
+
}
|
56 |
+
$curl = new Curl();
|
57 |
+
$curl->setURL($url, $query_parameters);
|
58 |
+
$curl->setOpt(CURLOPT_CUSTOMREQUEST, 'DELETE');
|
59 |
+
$curl->setOpt(CURLOPT_POSTFIELDS, $curl->buildPostData($data));
|
60 |
+
$this->addHandle($curl);
|
61 |
+
return $curl;
|
62 |
+
}
|
63 |
+
|
64 |
+
/**
|
65 |
+
* Add Download
|
66 |
+
*
|
67 |
+
* @access public
|
68 |
+
* @param $url
|
69 |
+
* @param $mixed_filename
|
70 |
+
*
|
71 |
+
* @return object
|
72 |
+
*/
|
73 |
+
public function addDownload($url, $mixed_filename)
|
74 |
+
{
|
75 |
+
$curl = new Curl();
|
76 |
+
$curl->setURL($url);
|
77 |
+
|
78 |
+
if (is_callable($mixed_filename)) {
|
79 |
+
$callback = $mixed_filename;
|
80 |
+
$curl->downloadCompleteFunction = $callback;
|
81 |
+
$fh = tmpfile();
|
82 |
+
} else {
|
83 |
+
$filename = $mixed_filename;
|
84 |
+
$fh = fopen($filename, 'wb');
|
85 |
+
}
|
86 |
+
|
87 |
+
$curl->setOpt(CURLOPT_FILE, $fh);
|
88 |
+
$curl->setOpt(CURLOPT_CUSTOMREQUEST, 'GET');
|
89 |
+
$curl->setOpt(CURLOPT_HTTPGET, true);
|
90 |
+
$this->addHandle($curl);
|
91 |
+
$this->curlFileHandles[$curl->id] = $fh;
|
92 |
+
return $curl;
|
93 |
+
}
|
94 |
+
|
95 |
+
/**
|
96 |
+
* Add Get
|
97 |
+
*
|
98 |
+
* @access public
|
99 |
+
* @param $url
|
100 |
+
* @param $data
|
101 |
+
*
|
102 |
+
* @return object
|
103 |
+
*/
|
104 |
+
public function addGet($url, $data = array())
|
105 |
+
{
|
106 |
+
if (is_array($url)) {
|
107 |
+
$data = $url;
|
108 |
+
$url = $this->baseUrl;
|
109 |
+
}
|
110 |
+
$curl = new Curl();
|
111 |
+
$curl->setURL($url, $data);
|
112 |
+
$curl->setOpt(CURLOPT_CUSTOMREQUEST, 'GET');
|
113 |
+
$curl->setOpt(CURLOPT_HTTPGET, true);
|
114 |
+
$this->addHandle($curl);
|
115 |
+
return $curl;
|
116 |
+
}
|
117 |
+
|
118 |
+
/**
|
119 |
+
* Add Head
|
120 |
+
*
|
121 |
+
* @access public
|
122 |
+
* @param $url
|
123 |
+
* @param $data
|
124 |
+
*
|
125 |
+
* @return object
|
126 |
+
*/
|
127 |
+
public function addHead($url, $data = array())
|
128 |
+
{
|
129 |
+
if (is_array($url)) {
|
130 |
+
$data = $url;
|
131 |
+
$url = $this->baseUrl;
|
132 |
+
}
|
133 |
+
$curl = new Curl();
|
134 |
+
$curl->setURL($url, $data);
|
135 |
+
$curl->setOpt(CURLOPT_CUSTOMREQUEST, 'HEAD');
|
136 |
+
$curl->setOpt(CURLOPT_NOBODY, true);
|
137 |
+
$this->addHandle($curl);
|
138 |
+
return $curl;
|
139 |
+
}
|
140 |
+
|
141 |
+
/**
|
142 |
+
* Add Options
|
143 |
+
*
|
144 |
+
* @access public
|
145 |
+
* @param $url
|
146 |
+
* @param $data
|
147 |
+
*
|
148 |
+
* @return object
|
149 |
+
*/
|
150 |
+
public function addOptions($url, $data = array())
|
151 |
+
{
|
152 |
+
if (is_array($url)) {
|
153 |
+
$data = $url;
|
154 |
+
$url = $this->baseUrl;
|
155 |
+
}
|
156 |
+
$curl = new Curl();
|
157 |
+
$curl->setURL($url, $data);
|
158 |
+
$curl->unsetHeader('Content-Length');
|
159 |
+
$curl->setOpt(CURLOPT_CUSTOMREQUEST, 'OPTIONS');
|
160 |
+
$this->addHandle($curl);
|
161 |
+
return $curl;
|
162 |
+
}
|
163 |
+
|
164 |
+
/**
|
165 |
+
* Add Patch
|
166 |
+
*
|
167 |
+
* @access public
|
168 |
+
* @param $url
|
169 |
+
* @param $data
|
170 |
+
*
|
171 |
+
* @return object
|
172 |
+
*/
|
173 |
+
public function addPatch($url, $data = array())
|
174 |
+
{
|
175 |
+
if (is_array($url)) {
|
176 |
+
$data = $url;
|
177 |
+
$url = $this->baseUrl;
|
178 |
+
}
|
179 |
+
$curl = new Curl();
|
180 |
+
$curl->setURL($url);
|
181 |
+
$curl->unsetHeader('Content-Length');
|
182 |
+
$curl->setOpt(CURLOPT_CUSTOMREQUEST, 'PATCH');
|
183 |
+
$curl->setOpt(CURLOPT_POSTFIELDS, $data);
|
184 |
+
$this->addHandle($curl);
|
185 |
+
return $curl;
|
186 |
+
}
|
187 |
+
|
188 |
+
/**
|
189 |
+
* Add Post
|
190 |
+
*
|
191 |
+
* @access public
|
192 |
+
* @param $url
|
193 |
+
* @param $data
|
194 |
+
* @param $follow_303_with_post If true, will cause 303 redirections to be followed using
|
195 |
+
* GET requests (default: false).
|
196 |
+
* Note: Redirections are only followed if the CURLOPT_FOLLOWLOCATION option is set to true.
|
197 |
+
*
|
198 |
+
* @return object
|
199 |
+
*/
|
200 |
+
public function addPost($url, $data = array(), $follow_303_with_post = false)
|
201 |
+
{
|
202 |
+
if (is_array($url)) {
|
203 |
+
$follow_303_with_post = (bool)$data;
|
204 |
+
$data = $url;
|
205 |
+
$url = $this->baseUrl;
|
206 |
+
}
|
207 |
+
|
208 |
+
$curl = new Curl();
|
209 |
+
|
210 |
+
if (is_array($data) && empty($data)) {
|
211 |
+
$curl->unsetHeader('Content-Length');
|
212 |
+
}
|
213 |
+
|
214 |
+
$curl->setURL($url);
|
215 |
+
|
216 |
+
/*
|
217 |
+
* For post-redirect-get requests, the CURLOPT_CUSTOMREQUEST option must not
|
218 |
+
* be set, otherwise cURL will perform POST requests for redirections.
|
219 |
+
*/
|
220 |
+
if (!$follow_303_with_post) {
|
221 |
+
$curl->setOpt(CURLOPT_CUSTOMREQUEST, 'POST');
|
222 |
+
}
|
223 |
+
|
224 |
+
$curl->setOpt(CURLOPT_POST, true);
|
225 |
+
$curl->setOpt(CURLOPT_POSTFIELDS, $curl->buildPostData($data));
|
226 |
+
$this->addHandle($curl);
|
227 |
+
return $curl;
|
228 |
+
}
|
229 |
+
|
230 |
+
/**
|
231 |
+
* Add Put
|
232 |
+
*
|
233 |
+
* @access public
|
234 |
+
* @param $url
|
235 |
+
* @param $data
|
236 |
+
*
|
237 |
+
* @return object
|
238 |
+
*/
|
239 |
+
public function addPut($url, $data = array())
|
240 |
+
{
|
241 |
+
if (is_array($url)) {
|
242 |
+
$data = $url;
|
243 |
+
$url = $this->baseUrl;
|
244 |
+
}
|
245 |
+
$curl = new Curl();
|
246 |
+
$curl->setURL($url);
|
247 |
+
$curl->setOpt(CURLOPT_CUSTOMREQUEST, 'PUT');
|
248 |
+
$put_data = $curl->buildPostData($data);
|
249 |
+
$curl->setHeader('Content-Length', strlen($put_data));
|
250 |
+
$curl->setOpt(CURLOPT_POSTFIELDS, $put_data);
|
251 |
+
$this->addHandle($curl);
|
252 |
+
return $curl;
|
253 |
+
}
|
254 |
+
|
255 |
+
/**
|
256 |
+
* Before Send
|
257 |
+
*
|
258 |
+
* @access public
|
259 |
+
* @param $callback
|
260 |
+
*/
|
261 |
+
public function beforeSend($callback)
|
262 |
+
{
|
263 |
+
$this->beforeSendFunction = $callback;
|
264 |
+
}
|
265 |
+
|
266 |
+
/**
|
267 |
+
* Close
|
268 |
+
*
|
269 |
+
* @access public
|
270 |
+
*/
|
271 |
+
public function close()
|
272 |
+
{
|
273 |
+
foreach ($this->curls as $ch) {
|
274 |
+
$ch->close();
|
275 |
+
}
|
276 |
+
|
277 |
+
if (is_resource($this->multiCurl)) {
|
278 |
+
curl_multi_close($this->multiCurl);
|
279 |
+
}
|
280 |
+
}
|
281 |
+
|
282 |
+
/**
|
283 |
+
* Complete
|
284 |
+
*
|
285 |
+
* @access public
|
286 |
+
* @param $callback
|
287 |
+
*/
|
288 |
+
public function complete($callback)
|
289 |
+
{
|
290 |
+
$this->completeFunction = $callback;
|
291 |
+
}
|
292 |
+
|
293 |
+
/**
|
294 |
+
* Error
|
295 |
+
*
|
296 |
+
* @access public
|
297 |
+
* @param $callback
|
298 |
+
*/
|
299 |
+
public function error($callback)
|
300 |
+
{
|
301 |
+
$this->errorFunction = $callback;
|
302 |
+
}
|
303 |
+
|
304 |
+
/**
|
305 |
+
* Get Opt
|
306 |
+
*
|
307 |
+
* @access public
|
308 |
+
* @param $option
|
309 |
+
*
|
310 |
+
* @return mixed
|
311 |
+
*/
|
312 |
+
public function getOpt($option)
|
313 |
+
{
|
314 |
+
return $this->options[$option];
|
315 |
+
}
|
316 |
+
|
317 |
+
/**
|
318 |
+
* Set Basic Authentication
|
319 |
+
*
|
320 |
+
* @access public
|
321 |
+
* @param $username
|
322 |
+
* @param $password
|
323 |
+
*/
|
324 |
+
public function setBasicAuthentication($username, $password = '')
|
325 |
+
{
|
326 |
+
$this->setOpt(CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
|
327 |
+
$this->setOpt(CURLOPT_USERPWD, $username . ':' . $password);
|
328 |
+
}
|
329 |
+
|
330 |
+
/**
|
331 |
+
* Set Digest Authentication
|
332 |
+
*
|
333 |
+
* @access public
|
334 |
+
* @param $username
|
335 |
+
* @param $password
|
336 |
+
*/
|
337 |
+
public function setDigestAuthentication($username, $password = '')
|
338 |
+
{
|
339 |
+
$this->setOpt(CURLOPT_HTTPAUTH, CURLAUTH_DIGEST);
|
340 |
+
$this->setOpt(CURLOPT_USERPWD, $username . ':' . $password);
|
341 |
+
}
|
342 |
+
|
343 |
+
/**
|
344 |
+
* Set Cookie
|
345 |
+
*
|
346 |
+
* @access public
|
347 |
+
* @param $key
|
348 |
+
* @param $value
|
349 |
+
*/
|
350 |
+
public function setCookie($key, $value)
|
351 |
+
{
|
352 |
+
$this->cookies[$key] = $value;
|
353 |
+
$this->setOpt(CURLOPT_COOKIE, str_replace('+', '%20', http_build_query($this->cookies, '', '; ')));
|
354 |
+
}
|
355 |
+
|
356 |
+
/**
|
357 |
+
* Set Cookie File
|
358 |
+
*
|
359 |
+
* @access public
|
360 |
+
* @param $cookie_file
|
361 |
+
*/
|
362 |
+
public function setCookieFile($cookie_file)
|
363 |
+
{
|
364 |
+
$this->setOpt(CURLOPT_COOKIEFILE, $cookie_file);
|
365 |
+
}
|
366 |
+
|
367 |
+
/**
|
368 |
+
* Set Cookie Jar
|
369 |
+
*
|
370 |
+
* @access public
|
371 |
+
* @param $cookie_jar
|
372 |
+
*/
|
373 |
+
public function setCookieJar($cookie_jar)
|
374 |
+
{
|
375 |
+
$this->setOpt(CURLOPT_COOKIEJAR, $cookie_jar);
|
376 |
+
}
|
377 |
+
|
378 |
+
/**
|
379 |
+
* Set Header
|
380 |
+
*
|
381 |
+
* @access public
|
382 |
+
* @param $key
|
383 |
+
* @param $value
|
384 |
+
*/
|
385 |
+
public function setHeader($key, $value)
|
386 |
+
{
|
387 |
+
$this->headers[$key] = $value;
|
388 |
+
}
|
389 |
+
|
390 |
+
/**
|
391 |
+
* Set JSON Decoder
|
392 |
+
*
|
393 |
+
* @access public
|
394 |
+
* @param $function
|
395 |
+
*/
|
396 |
+
public function setJsonDecoder($function)
|
397 |
+
{
|
398 |
+
if (is_callable($function)) {
|
399 |
+
$this->jsonDecoder = $function;
|
400 |
+
}
|
401 |
+
}
|
402 |
+
|
403 |
+
/**
|
404 |
+
* Set XML Decoder
|
405 |
+
*
|
406 |
+
* @access public
|
407 |
+
* @param $function
|
408 |
+
*/
|
409 |
+
public function setXmlDecoder($function)
|
410 |
+
{
|
411 |
+
if (is_callable($function)) {
|
412 |
+
$this->xmlDecoder = $function;
|
413 |
+
}
|
414 |
+
}
|
415 |
+
|
416 |
+
/**
|
417 |
+
* Set Opt
|
418 |
+
*
|
419 |
+
* @access public
|
420 |
+
* @param $option
|
421 |
+
* @param $value
|
422 |
+
*/
|
423 |
+
public function setOpt($option, $value)
|
424 |
+
{
|
425 |
+
$this->options[$option] = $value;
|
426 |
+
}
|
427 |
+
|
428 |
+
/**
|
429 |
+
* Set Referer
|
430 |
+
*
|
431 |
+
* @access public
|
432 |
+
* @param $referer
|
433 |
+
*/
|
434 |
+
public function setReferer($referer)
|
435 |
+
{
|
436 |
+
$this->setReferrer($referer);
|
437 |
+
}
|
438 |
+
|
439 |
+
/**
|
440 |
+
* Set Referrer
|
441 |
+
*
|
442 |
+
* @access public
|
443 |
+
* @param $referrer
|
444 |
+
*/
|
445 |
+
public function setReferrer($referrer)
|
446 |
+
{
|
447 |
+
$this->setOpt(CURLOPT_REFERER, $referrer);
|
448 |
+
}
|
449 |
+
|
450 |
+
/**
|
451 |
+
* Set Timeout
|
452 |
+
*
|
453 |
+
* @access public
|
454 |
+
* @param $seconds
|
455 |
+
*/
|
456 |
+
public function setTimeout($seconds)
|
457 |
+
{
|
458 |
+
$this->setOpt(CURLOPT_TIMEOUT, $seconds);
|
459 |
+
}
|
460 |
+
|
461 |
+
/**
|
462 |
+
* Set Url
|
463 |
+
*
|
464 |
+
* @access public
|
465 |
+
* @param $url
|
466 |
+
*/
|
467 |
+
public function setURL($url)
|
468 |
+
{
|
469 |
+
$this->baseUrl = $url;
|
470 |
+
}
|
471 |
+
|
472 |
+
/**
|
473 |
+
* Set User Agent
|
474 |
+
*
|
475 |
+
* @access public
|
476 |
+
* @param $user_agent
|
477 |
+
*/
|
478 |
+
public function setUserAgent($user_agent)
|
479 |
+
{
|
480 |
+
$this->setOpt(CURLOPT_USERAGENT, $user_agent);
|
481 |
+
}
|
482 |
+
|
483 |
+
/**
|
484 |
+
* Start
|
485 |
+
*
|
486 |
+
* @access public
|
487 |
+
*/
|
488 |
+
public function start()
|
489 |
+
{
|
490 |
+
foreach ($this->curls as $ch) {
|
491 |
+
$this->initHandle($ch);
|
492 |
+
}
|
493 |
+
|
494 |
+
$this->isStarted = true;
|
495 |
+
|
496 |
+
do {
|
497 |
+
curl_multi_select($this->multiCurl);
|
498 |
+
curl_multi_exec($this->multiCurl, $active);
|
499 |
+
|
500 |
+
while (!($info_array = curl_multi_info_read($this->multiCurl)) === false) {
|
501 |
+
if ($info_array['msg'] === CURLMSG_DONE) {
|
502 |
+
foreach ($this->curls as $key => $ch) {
|
503 |
+
if ($ch->curl === $info_array['handle']) {
|
504 |
+
$ch->curlErrorCode = $info_array['result'];
|
505 |
+
$ch->exec($ch->curl);
|
506 |
+
curl_multi_remove_handle($this->multiCurl, $ch->curl);
|
507 |
+
unset($this->curls[$key]);
|
508 |
+
|
509 |
+
// Close open file handles and reset the curl instance.
|
510 |
+
if (isset($this->curlFileHandles[$ch->id])) {
|
511 |
+
$ch->downloadComplete($this->curlFileHandles[$ch->id]);
|
512 |
+
unset($this->curlFileHandles[$ch->id]);
|
513 |
+
}
|
514 |
+
break;
|
515 |
+
}
|
516 |
+
}
|
517 |
+
}
|
518 |
+
}
|
519 |
+
|
520 |
+
if (!$active) {
|
521 |
+
$active = count($this->curls);
|
522 |
+
}
|
523 |
+
} while ($active > 0);
|
524 |
+
|
525 |
+
$this->isStarted = false;
|
526 |
+
}
|
527 |
+
|
528 |
+
/**
|
529 |
+
* Success
|
530 |
+
*
|
531 |
+
* @access public
|
532 |
+
* @param $callback
|
533 |
+
*/
|
534 |
+
public function success($callback)
|
535 |
+
{
|
536 |
+
$this->successFunction = $callback;
|
537 |
+
}
|
538 |
+
|
539 |
+
/**
|
540 |
+
* Unset Header
|
541 |
+
*
|
542 |
+
* @access public
|
543 |
+
* @param $key
|
544 |
+
*/
|
545 |
+
public function unsetHeader($key)
|
546 |
+
{
|
547 |
+
$this->setHeader($key, '');
|
548 |
+
unset($this->headers[$key]);
|
549 |
+
}
|
550 |
+
|
551 |
+
/**
|
552 |
+
* Verbose
|
553 |
+
*
|
554 |
+
* @access public
|
555 |
+
* @param bool $on
|
556 |
+
* @param resource $output
|
557 |
+
*/
|
558 |
+
public function verbose($on = true, $output=STDERR)
|
559 |
+
{
|
560 |
+
// Turn off CURLINFO_HEADER_OUT for verbose to work. This has the side
|
561 |
+
// effect of causing Curl::requestHeaders to be empty.
|
562 |
+
if ($on) {
|
563 |
+
$this->setOpt(CURLINFO_HEADER_OUT, false);
|
564 |
+
}
|
565 |
+
$this->setOpt(CURLOPT_VERBOSE, $on);
|
566 |
+
$this->setOpt(CURLOPT_STDERR, $output);
|
567 |
+
}
|
568 |
+
|
569 |
+
/**
|
570 |
+
* Destruct
|
571 |
+
*
|
572 |
+
* @access public
|
573 |
+
*/
|
574 |
+
public function __destruct()
|
575 |
+
{
|
576 |
+
$this->close();
|
577 |
+
}
|
578 |
+
|
579 |
+
/**
|
580 |
+
* Add Handle
|
581 |
+
*
|
582 |
+
* @access private
|
583 |
+
* @param $curl
|
584 |
+
* @throws \ErrorException
|
585 |
+
*/
|
586 |
+
private function addHandle($curl)
|
587 |
+
{
|
588 |
+
$curlm_error_code = curl_multi_add_handle($this->multiCurl, $curl->curl);
|
589 |
+
if (!($curlm_error_code === CURLM_OK)) {
|
590 |
+
throw new \ErrorException('cURL multi add handle error: ' . curl_multi_strerror($curlm_error_code));
|
591 |
+
}
|
592 |
+
$this->curls[] = $curl;
|
593 |
+
$curl->id = $this->nextCurlId++;
|
594 |
+
|
595 |
+
if ($this->isStarted) {
|
596 |
+
$this->initHandle($curl);
|
597 |
+
}
|
598 |
+
}
|
599 |
+
|
600 |
+
/**
|
601 |
+
* Init Handle
|
602 |
+
*
|
603 |
+
* @access private
|
604 |
+
* @param $curl
|
605 |
+
*/
|
606 |
+
private function initHandle($curl)
|
607 |
+
{
|
608 |
+
// Set callbacks if not already individually set.
|
609 |
+
if ($curl->beforeSendFunction === null) {
|
610 |
+
$curl->beforeSend($this->beforeSendFunction);
|
611 |
+
}
|
612 |
+
if ($curl->successFunction === null) {
|
613 |
+
$curl->success($this->successFunction);
|
614 |
+
}
|
615 |
+
if ($curl->errorFunction === null) {
|
616 |
+
$curl->error($this->errorFunction);
|
617 |
+
}
|
618 |
+
if ($curl->completeFunction === null) {
|
619 |
+
$curl->complete($this->completeFunction);
|
620 |
+
}
|
621 |
+
|
622 |
+
foreach ($this->options as $option => $value) {
|
623 |
+
$curl->setOpt($option, $value);
|
624 |
+
}
|
625 |
+
foreach ($this->headers as $key => $value) {
|
626 |
+
$curl->setHeader($key, $value);
|
627 |
+
}
|
628 |
+
$curl->setJsonDecoder($this->jsonDecoder);
|
629 |
+
$curl->setXmlDecoder($this->xmlDecoder);
|
630 |
+
$curl->call($curl->beforeSendFunction);
|
631 |
+
}
|
632 |
+
}
|
app/code/community/Pay/Payment/vendor/php-curl-class/php-curl-class/tests/PHPCurlClass/Helper.php
ADDED
@@ -0,0 +1,91 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
namespace Helper;
|
3 |
+
|
4 |
+
use Curl\Curl;
|
5 |
+
|
6 |
+
class Test
|
7 |
+
{
|
8 |
+
const TEST_URL = 'http://127.0.0.1:8000/';
|
9 |
+
const ERROR_URL = 'https://1.2.3.4/';
|
10 |
+
|
11 |
+
public function __construct()
|
12 |
+
{
|
13 |
+
$this->curl = new Curl();
|
14 |
+
$this->curl->setOpt(CURLOPT_SSL_VERIFYPEER, false);
|
15 |
+
$this->curl->setOpt(CURLOPT_SSL_VERIFYHOST, false);
|
16 |
+
}
|
17 |
+
|
18 |
+
public function server($test, $request_method, $query_parameters = array(), $data = array())
|
19 |
+
{
|
20 |
+
$this->curl->setHeader('X-DEBUG-TEST', $test);
|
21 |
+
$request_method = strtolower($request_method);
|
22 |
+
if (is_array($data) && empty($data)) {
|
23 |
+
$this->curl->$request_method(self::TEST_URL, $query_parameters);
|
24 |
+
} else {
|
25 |
+
$this->curl->$request_method(self::TEST_URL, $query_parameters, $data);
|
26 |
+
}
|
27 |
+
return $this->curl->response;
|
28 |
+
}
|
29 |
+
|
30 |
+
/*
|
31 |
+
* When chaining requests, the method must be forced, otherwise a
|
32 |
+
* previously forced method might be inherited.
|
33 |
+
* Especially, POSTs must be configured to not perform post-redirect-get.
|
34 |
+
*/
|
35 |
+
private function chained_request($request_method)
|
36 |
+
{
|
37 |
+
if ($request_method === 'POST') {
|
38 |
+
$this->server('request_method', $request_method, array(), true);
|
39 |
+
} else {
|
40 |
+
$this->server('request_method', $request_method);
|
41 |
+
}
|
42 |
+
\PHPUnit_Framework_Assert::assertEquals($request_method, $this->curl->responseHeaders['X-REQUEST-METHOD']);
|
43 |
+
}
|
44 |
+
|
45 |
+
public function chain_requests($first, $second)
|
46 |
+
{
|
47 |
+
$this->chained_request($first);
|
48 |
+
$this->chained_request($second);
|
49 |
+
}
|
50 |
+
}
|
51 |
+
|
52 |
+
function create_png()
|
53 |
+
{
|
54 |
+
// PNG image data, 1 x 1, 1-bit colormap, non-interlaced
|
55 |
+
ob_start();
|
56 |
+
imagepng(imagecreatefromstring(base64_decode('R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7')));
|
57 |
+
$raw_image = ob_get_contents();
|
58 |
+
ob_end_clean();
|
59 |
+
return $raw_image;
|
60 |
+
}
|
61 |
+
|
62 |
+
function create_tmp_file($data)
|
63 |
+
{
|
64 |
+
$tmp_file = tmpfile();
|
65 |
+
fwrite($tmp_file, $data);
|
66 |
+
rewind($tmp_file);
|
67 |
+
return $tmp_file;
|
68 |
+
}
|
69 |
+
|
70 |
+
function get_png()
|
71 |
+
{
|
72 |
+
$tmp_filename = tempnam('/tmp', 'php-curl-class.');
|
73 |
+
file_put_contents($tmp_filename, create_png());
|
74 |
+
return $tmp_filename;
|
75 |
+
}
|
76 |
+
|
77 |
+
if (function_exists('finfo_open')) {
|
78 |
+
function mime_type($file_path)
|
79 |
+
{
|
80 |
+
$finfo = finfo_open(FILEINFO_MIME_TYPE);
|
81 |
+
$mime_type = finfo_file($finfo, $file_path);
|
82 |
+
finfo_close($finfo);
|
83 |
+
return $mime_type;
|
84 |
+
}
|
85 |
+
} else {
|
86 |
+
function mime_type($file_path)
|
87 |
+
{
|
88 |
+
$mime_type = mime_content_type($file_path);
|
89 |
+
return $mime_type;
|
90 |
+
}
|
91 |
+
}
|
app/code/community/Pay/Payment/vendor/php-curl-class/php-curl-class/tests/PHPCurlClass/PHPCurlClassTest.php
ADDED
@@ -0,0 +1,2698 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
use \Curl\Curl;
|
4 |
+
use \Curl\CaseInsensitiveArray;
|
5 |
+
use \Helper\Test;
|
6 |
+
|
7 |
+
class CurlTest extends PHPUnit_Framework_TestCase
|
8 |
+
{
|
9 |
+
public function testExtensionsLoaded()
|
10 |
+
{
|
11 |
+
$this->assertTrue(extension_loaded('curl'));
|
12 |
+
$this->assertTrue(extension_loaded('gd'));
|
13 |
+
}
|
14 |
+
|
15 |
+
public function testArrayAssociative()
|
16 |
+
{
|
17 |
+
$this->assertTrue(Curl::is_array_assoc(array(
|
18 |
+
'foo' => 'wibble',
|
19 |
+
'bar' => 'wubble',
|
20 |
+
'baz' => 'wobble',
|
21 |
+
)));
|
22 |
+
}
|
23 |
+
|
24 |
+
public function testArrayIndexed()
|
25 |
+
{
|
26 |
+
$this->assertFalse(Curl::is_array_assoc(array(
|
27 |
+
'wibble',
|
28 |
+
'wubble',
|
29 |
+
'wobble',
|
30 |
+
)));
|
31 |
+
}
|
32 |
+
|
33 |
+
public function testCaseInsensitiveArrayGet()
|
34 |
+
{
|
35 |
+
$array = new CaseInsensitiveArray();
|
36 |
+
$this->assertTrue(is_object($array));
|
37 |
+
$this->assertCount(0, $array);
|
38 |
+
$this->assertNull($array[(string)rand()]);
|
39 |
+
|
40 |
+
$array['foo'] = 'bar';
|
41 |
+
$this->assertNotEmpty($array);
|
42 |
+
$this->assertCount(1, $array);
|
43 |
+
}
|
44 |
+
|
45 |
+
public function testCaseInsensitiveArraySet()
|
46 |
+
{
|
47 |
+
$array = new CaseInsensitiveArray();
|
48 |
+
foreach (array('FOO', 'FOo', 'Foo', 'fOO', 'fOo', 'foO', 'foo') as $key) {
|
49 |
+
$value = mt_rand();
|
50 |
+
$array[$key] = $value;
|
51 |
+
$this->assertCount(1, $array);
|
52 |
+
$this->assertEquals($value, $array['FOO']);
|
53 |
+
$this->assertEquals($value, $array['FOo']);
|
54 |
+
$this->assertEquals($value, $array['Foo']);
|
55 |
+
$this->assertEquals($value, $array['fOO']);
|
56 |
+
$this->assertEquals($value, $array['fOo']);
|
57 |
+
$this->assertEquals($value, $array['foO']);
|
58 |
+
$this->assertEquals($value, $array['foo']);
|
59 |
+
}
|
60 |
+
|
61 |
+
$array['baz'] = 'qux';
|
62 |
+
$this->assertCount(2, $array);
|
63 |
+
}
|
64 |
+
|
65 |
+
public function testBuildPostDataArgSeparator()
|
66 |
+
{
|
67 |
+
$data = array(
|
68 |
+
'foo' => 'Hello',
|
69 |
+
'bar' => 'World',
|
70 |
+
);
|
71 |
+
|
72 |
+
foreach (array(false, '&', '&') as $arg_separator) {
|
73 |
+
if ($arg_separator) {
|
74 |
+
ini_set('arg_separator.output', $arg_separator);
|
75 |
+
}
|
76 |
+
$curl = new Curl();
|
77 |
+
$this->assertEquals('foo=Hello&bar=World', $curl->buildPostData($data));
|
78 |
+
}
|
79 |
+
}
|
80 |
+
|
81 |
+
public function testUserAgent()
|
82 |
+
{
|
83 |
+
$php_version = preg_replace('/([\.\+\?\*\(\)\[\]\^\$\/])/', '\\\\\1', 'PHP/' . PHP_VERSION);
|
84 |
+
$curl_version = curl_version();
|
85 |
+
$curl_version = 'curl\/' . $curl_version['version'];
|
86 |
+
|
87 |
+
$test = new Test();
|
88 |
+
$user_agent = $test->server('server', 'GET', array('key' => 'HTTP_USER_AGENT'));
|
89 |
+
$this->assertRegExp('/' . $php_version . '/', $user_agent);
|
90 |
+
$this->assertRegExp('/' . $curl_version . '/', $user_agent);
|
91 |
+
}
|
92 |
+
|
93 |
+
public function testGet()
|
94 |
+
{
|
95 |
+
$test = new Test();
|
96 |
+
$this->assertEquals('GET', $test->server('request_method', 'GET'));
|
97 |
+
}
|
98 |
+
|
99 |
+
public function testUrl()
|
100 |
+
{
|
101 |
+
$data = array('foo' => 'bar');
|
102 |
+
|
103 |
+
// curl -v --get --request GET "http://127.0.0.1:8000/" --data "foo=bar"
|
104 |
+
$test = new Test();
|
105 |
+
$test->server('server', 'GET', $data);
|
106 |
+
$this->assertEquals(Test::TEST_URL, $test->curl->baseUrl);
|
107 |
+
$this->assertEquals(Test::TEST_URL . '?' . http_build_query($data), $test->curl->url);
|
108 |
+
|
109 |
+
// curl -v --request POST "http://127.0.0.1:8000/" --data "foo=bar"
|
110 |
+
$test = new Test();
|
111 |
+
$test->server('server', 'POST', $data);
|
112 |
+
$this->assertEquals(Test::TEST_URL, $test->curl->baseUrl);
|
113 |
+
$this->assertEquals(Test::TEST_URL, $test->curl->url);
|
114 |
+
|
115 |
+
// curl -v --request PUT "http://127.0.0.1:8000/" --data "foo=bar"
|
116 |
+
$test = new Test();
|
117 |
+
$test->server('server', 'PUT', $data);
|
118 |
+
$this->assertEquals(Test::TEST_URL, $test->curl->baseUrl);
|
119 |
+
$this->assertEquals(Test::TEST_URL, $test->curl->url);
|
120 |
+
|
121 |
+
// curl -v --request PATCH "http://127.0.0.1:8000/" --data "foo=bar"
|
122 |
+
$test = new Test();
|
123 |
+
$test->server('server', 'PATCH', $data);
|
124 |
+
$this->assertEquals(Test::TEST_URL, $test->curl->baseUrl);
|
125 |
+
$this->assertEquals(Test::TEST_URL, $test->curl->url);
|
126 |
+
|
127 |
+
// curl -v --request DELETE "http://127.0.0.1:8000/?foo=bar"
|
128 |
+
$test = new Test();
|
129 |
+
$test->server('server', 'DELETE', $data);
|
130 |
+
$this->assertEquals(Test::TEST_URL, $test->curl->baseUrl);
|
131 |
+
$this->assertEquals(Test::TEST_URL . '?' . http_build_query($data), $test->curl->url);
|
132 |
+
|
133 |
+
// curl -v --get --request HEAD --head "http://127.0.0.1:8000/" --data "foo=bar"
|
134 |
+
$test = new Test();
|
135 |
+
$test->server('server', 'HEAD', $data);
|
136 |
+
$this->assertEquals(Test::TEST_URL, $test->curl->baseUrl);
|
137 |
+
$this->assertEquals(Test::TEST_URL . '?' . http_build_query($data), $test->curl->url);
|
138 |
+
|
139 |
+
// curl -v --get --request OPTIONS "http://127.0.0.1:8000/" --data "foo=bar"
|
140 |
+
$test = new Test();
|
141 |
+
$test->server('server', 'OPTIONS', $data);
|
142 |
+
$this->assertEquals(Test::TEST_URL, $test->curl->baseUrl);
|
143 |
+
$this->assertEquals(Test::TEST_URL . '?' . http_build_query($data), $test->curl->url);
|
144 |
+
}
|
145 |
+
|
146 |
+
public function testSetUrlInConstructor()
|
147 |
+
{
|
148 |
+
$data = array('key' => 'value');
|
149 |
+
|
150 |
+
$curl = new Curl(Test::TEST_URL);
|
151 |
+
$curl->setHeader('X-DEBUG-TEST', 'delete_with_body');
|
152 |
+
$curl->delete($data, array('wibble' => 'wubble'));
|
153 |
+
$this->assertEquals(Test::TEST_URL, $curl->baseUrl);
|
154 |
+
$this->assertEquals('{"get":{"key":"value"},"delete":{"wibble":"wubble"}}', $curl->rawResponse);
|
155 |
+
|
156 |
+
$curl = new Curl(Test::TEST_URL);
|
157 |
+
$curl->setHeader('X-DEBUG-TEST', 'get');
|
158 |
+
$curl->delete($data);
|
159 |
+
$this->assertEquals(Test::TEST_URL, $curl->baseUrl);
|
160 |
+
$this->assertEquals('key=value', $curl->response);
|
161 |
+
|
162 |
+
$curl = new Curl(Test::TEST_URL);
|
163 |
+
$curl->setHeader('X-DEBUG-TEST', 'get');
|
164 |
+
$curl->get($data);
|
165 |
+
$this->assertEquals(Test::TEST_URL, $curl->baseUrl);
|
166 |
+
$this->assertEquals('key=value', $curl->response);
|
167 |
+
|
168 |
+
$curl = new Curl(Test::TEST_URL);
|
169 |
+
$curl->setHeader('X-DEBUG-TEST', 'get');
|
170 |
+
$curl->head($data);
|
171 |
+
$this->assertEquals(Test::TEST_URL, $curl->baseUrl);
|
172 |
+
$this->assertEquals('HEAD /?key=value HTTP/1.1', $curl->requestHeaders['Request-Line']);
|
173 |
+
|
174 |
+
$curl = new Curl(Test::TEST_URL);
|
175 |
+
$curl->setHeader('X-DEBUG-TEST', 'get');
|
176 |
+
$curl->options($data);
|
177 |
+
$this->assertEquals(Test::TEST_URL, $curl->baseUrl);
|
178 |
+
$this->assertEquals('key=value', $curl->response);
|
179 |
+
|
180 |
+
$curl = new Curl(Test::TEST_URL);
|
181 |
+
$curl->setHeader('X-DEBUG-TEST', 'request_method');
|
182 |
+
$curl->patch($data);
|
183 |
+
$this->assertEquals(Test::TEST_URL, $curl->baseUrl);
|
184 |
+
$this->assertEquals('PATCH', $curl->response);
|
185 |
+
|
186 |
+
$curl = new Curl(Test::TEST_URL);
|
187 |
+
$curl->setHeader('X-DEBUG-TEST', 'post');
|
188 |
+
$curl->post($data);
|
189 |
+
$this->assertEquals(Test::TEST_URL, $curl->baseUrl);
|
190 |
+
$this->assertEquals('key=value', $curl->response);
|
191 |
+
|
192 |
+
$curl = new Curl(Test::TEST_URL);
|
193 |
+
$curl->setHeader('X-DEBUG-TEST', 'put');
|
194 |
+
$curl->put($data);
|
195 |
+
$this->assertEquals(Test::TEST_URL, $curl->baseUrl);
|
196 |
+
$this->assertEquals('key=value', $curl->response);
|
197 |
+
}
|
198 |
+
|
199 |
+
public function testSetUrl()
|
200 |
+
{
|
201 |
+
$data = array('key' => 'value');
|
202 |
+
|
203 |
+
$curl = new Curl();
|
204 |
+
$curl->setHeader('X-DEBUG-TEST', 'get');
|
205 |
+
$curl->setUrl(Test::TEST_URL);
|
206 |
+
$curl->delete($data);
|
207 |
+
$this->assertEquals(Test::TEST_URL, $curl->baseUrl);
|
208 |
+
$this->assertEquals('key=value', $curl->response);
|
209 |
+
|
210 |
+
$curl = new Curl();
|
211 |
+
$curl->setHeader('X-DEBUG-TEST', 'get');
|
212 |
+
$curl->setUrl(Test::TEST_URL);
|
213 |
+
$curl->get($data);
|
214 |
+
$this->assertEquals(Test::TEST_URL, $curl->baseUrl);
|
215 |
+
$this->assertEquals('key=value', $curl->response);
|
216 |
+
|
217 |
+
$curl = new Curl();
|
218 |
+
$curl->setHeader('X-DEBUG-TEST', 'get');
|
219 |
+
$curl->setUrl(Test::TEST_URL);
|
220 |
+
$curl->head($data);
|
221 |
+
$this->assertEquals(Test::TEST_URL, $curl->baseUrl);
|
222 |
+
$this->assertEquals('HEAD /?key=value HTTP/1.1', $curl->requestHeaders['Request-Line']);
|
223 |
+
|
224 |
+
$curl = new Curl();
|
225 |
+
$curl->setHeader('X-DEBUG-TEST', 'get');
|
226 |
+
$curl->setUrl(Test::TEST_URL);
|
227 |
+
$curl->options($data);
|
228 |
+
$this->assertEquals(Test::TEST_URL, $curl->baseUrl);
|
229 |
+
$this->assertEquals('key=value', $curl->response);
|
230 |
+
|
231 |
+
$curl = new Curl();
|
232 |
+
$curl->setHeader('X-DEBUG-TEST', 'request_method');
|
233 |
+
$curl->setUrl(Test::TEST_URL);
|
234 |
+
$curl->patch($data);
|
235 |
+
$this->assertEquals(Test::TEST_URL, $curl->baseUrl);
|
236 |
+
$this->assertEquals('PATCH', $curl->response);
|
237 |
+
|
238 |
+
$curl = new Curl();
|
239 |
+
$curl->setHeader('X-DEBUG-TEST', 'post');
|
240 |
+
$curl->setUrl(Test::TEST_URL);
|
241 |
+
$curl->post($data);
|
242 |
+
$this->assertEquals(Test::TEST_URL, $curl->baseUrl);
|
243 |
+
$this->assertEquals('key=value', $curl->response);
|
244 |
+
|
245 |
+
$curl = new Curl();
|
246 |
+
$curl->setHeader('X-DEBUG-TEST', 'put');
|
247 |
+
$curl->setUrl(Test::TEST_URL);
|
248 |
+
$curl->put($data);
|
249 |
+
$this->assertEquals(Test::TEST_URL, $curl->baseUrl);
|
250 |
+
$this->assertEquals('key=value', $curl->response);
|
251 |
+
}
|
252 |
+
|
253 |
+
public function testEffectiveUrl()
|
254 |
+
{
|
255 |
+
$test = new Test();
|
256 |
+
$test->server('redirect', 'GET');
|
257 |
+
$this->assertEquals(Test::TEST_URL, $test->curl->effectiveUrl);
|
258 |
+
|
259 |
+
$test = new Test();
|
260 |
+
$test->curl->setOpt(CURLOPT_FOLLOWLOCATION, true);
|
261 |
+
$test->server('redirect', 'GET');
|
262 |
+
$this->assertEquals(Test::TEST_URL . '?redirect', $test->curl->effectiveUrl);
|
263 |
+
}
|
264 |
+
|
265 |
+
public function testPostRequestMethod()
|
266 |
+
{
|
267 |
+
$test = new Test();
|
268 |
+
$this->assertEquals('POST', $test->server('request_method', 'POST'));
|
269 |
+
}
|
270 |
+
|
271 |
+
public function testPostContinueResponseHeader()
|
272 |
+
{
|
273 |
+
// 100 Continue responses may contain additional optional headers per
|
274 |
+
// RFC 2616, Section 10.1:
|
275 |
+
// This class of status code indicates a provisional response,
|
276 |
+
// consisting only of the Status-Line and optional headers, and is
|
277 |
+
// terminated by an empty line.
|
278 |
+
$response =
|
279 |
+
'HTTP/1.1 100 Continue' . "\r\n" .
|
280 |
+
'Date: Fri, 01 Jan 1990 00:00:00 GMT' . "\r\n" .
|
281 |
+
'Server: PHP-Curl-Class' . "\r\n" .
|
282 |
+
"\r\n" .
|
283 |
+
'HTTP/1.1 200 OK' . "\r\n" .
|
284 |
+
'Date: Fri, 01 Jan 1990 00:00:00 GMT' . "\r\n" .
|
285 |
+
'Cache-Control: private' . "\r\n" .
|
286 |
+
'Vary: Accept-Encoding' . "\r\n" .
|
287 |
+
'Content-Length: 2' . "\r\n" .
|
288 |
+
'Content-Type: text/plain;charset=UTF-8' . "\r\n" .
|
289 |
+
'Server: PHP-Curl-Class' . "\r\n" .
|
290 |
+
'Connection: keep-alive' . "\r\n" .
|
291 |
+
"\r\n";
|
292 |
+
|
293 |
+
$reflector = new ReflectionClass('\Curl\Curl');
|
294 |
+
$reflection_method = $reflector->getMethod('parseResponseHeaders');
|
295 |
+
$reflection_method->setAccessible(true);
|
296 |
+
|
297 |
+
$curl = new Curl();
|
298 |
+
$response_headers = $reflection_method->invoke($curl, $response);
|
299 |
+
|
300 |
+
$this->assertEquals('HTTP/1.1 200 OK', $response_headers['Status-Line']);
|
301 |
+
}
|
302 |
+
|
303 |
+
public function testPostData()
|
304 |
+
{
|
305 |
+
$test = new Test();
|
306 |
+
$this->assertEquals('key=value', $test->server('post', 'POST', array(
|
307 |
+
'key' => 'value',
|
308 |
+
)));
|
309 |
+
}
|
310 |
+
|
311 |
+
public function testPostAssociativeArrayData()
|
312 |
+
{
|
313 |
+
$test = new Test();
|
314 |
+
$this->assertEquals(
|
315 |
+
'username=myusername' .
|
316 |
+
'&password=mypassword' .
|
317 |
+
'&more_data%5Bparam1%5D=something' .
|
318 |
+
'&more_data%5Bparam2%5D=other%20thing' .
|
319 |
+
'&more_data%5Bparam3%5D=123' .
|
320 |
+
'&more_data%5Bparam4%5D=3.14',
|
321 |
+
$test->server('post_multidimensional', 'POST', array(
|
322 |
+
'username' => 'myusername',
|
323 |
+
'password' => 'mypassword',
|
324 |
+
'more_data' => array(
|
325 |
+
'param1' => 'something',
|
326 |
+
'param2' => 'other thing',
|
327 |
+
'param3' => 123,
|
328 |
+
'param4' => 3.14,
|
329 |
+
),
|
330 |
+
))
|
331 |
+
);
|
332 |
+
}
|
333 |
+
|
334 |
+
public function testPostContentLength()
|
335 |
+
{
|
336 |
+
$test_data = array(
|
337 |
+
array(false, 0),
|
338 |
+
array('', 0),
|
339 |
+
array(array(), 0),
|
340 |
+
array(null, 0),
|
341 |
+
);
|
342 |
+
foreach ($test_data as $data) {
|
343 |
+
$test = new Test();
|
344 |
+
list($post_data, $expected_content_length) = $data;
|
345 |
+
if ($post_data === false) {
|
346 |
+
$test->server('post', 'POST');
|
347 |
+
} else {
|
348 |
+
$test->server('post', 'POST', $post_data);
|
349 |
+
}
|
350 |
+
$this->assertEquals($expected_content_length, $test->curl->requestHeaders['Content-Length']);
|
351 |
+
}
|
352 |
+
}
|
353 |
+
|
354 |
+
public function testPostMultidimensionalData()
|
355 |
+
{
|
356 |
+
$test = new Test();
|
357 |
+
$this->assertEquals(
|
358 |
+
'key=file&file%5B%5D=wibble&file%5B%5D=wubble&file%5B%5D=wobble',
|
359 |
+
$test->server('post_multidimensional', 'POST', array(
|
360 |
+
'key' => 'file',
|
361 |
+
'file' => array(
|
362 |
+
'wibble',
|
363 |
+
'wubble',
|
364 |
+
'wobble',
|
365 |
+
),
|
366 |
+
))
|
367 |
+
);
|
368 |
+
}
|
369 |
+
|
370 |
+
public function testPostFilePathUpload()
|
371 |
+
{
|
372 |
+
$file_path = Helper\get_png();
|
373 |
+
|
374 |
+
$test = new Test();
|
375 |
+
$this->assertEquals('image/png', $test->server('post_file_path_upload', 'POST', array(
|
376 |
+
'key' => 'image',
|
377 |
+
'image' => '@' . $file_path,
|
378 |
+
)));
|
379 |
+
|
380 |
+
unlink($file_path);
|
381 |
+
$this->assertFalse(file_exists($file_path));
|
382 |
+
}
|
383 |
+
|
384 |
+
public function testPostCurlFileUpload()
|
385 |
+
{
|
386 |
+
if (class_exists('CURLFile')) {
|
387 |
+
$file_path = Helper\get_png();
|
388 |
+
|
389 |
+
$test = new Test();
|
390 |
+
$this->assertEquals('image/png', $test->server('post_file_path_upload', 'POST', array(
|
391 |
+
'key' => 'image',
|
392 |
+
'image' => new CURLFile($file_path),
|
393 |
+
)));
|
394 |
+
|
395 |
+
unlink($file_path);
|
396 |
+
$this->assertFalse(file_exists($file_path));
|
397 |
+
}
|
398 |
+
}
|
399 |
+
|
400 |
+
public function testPostNonFilePathUpload()
|
401 |
+
{
|
402 |
+
$test = new Test();
|
403 |
+
$test->server('post', 'POST', array(
|
404 |
+
'foo' => 'bar',
|
405 |
+
'file' => '@not-a-file',
|
406 |
+
));
|
407 |
+
$this->assertFalse($test->curl->error);
|
408 |
+
$this->assertEquals('foo=bar&file=%40not-a-file', $test->curl->response);
|
409 |
+
}
|
410 |
+
|
411 |
+
public function testPostRedirectGet()
|
412 |
+
{
|
413 |
+
// Follow 303 redirection with GET
|
414 |
+
$test = new Test();
|
415 |
+
$test->curl->setOpt(CURLOPT_FOLLOWLOCATION, true);
|
416 |
+
$this->assertEquals('Redirected: GET', $test->server('post_redirect_get', 'POST'));
|
417 |
+
|
418 |
+
// Follow 303 redirection with POST
|
419 |
+
$test = new Test();
|
420 |
+
$test->curl->setOpt(CURLOPT_FOLLOWLOCATION, true);
|
421 |
+
$this->assertEquals('Redirected: POST', $test->server('post_redirect_get', 'POST', array(), true));
|
422 |
+
|
423 |
+
// On compatible PHP engines, ensure that it is possible to reuse an existing Curl object
|
424 |
+
if ((version_compare(PHP_VERSION, '5.5.11') > 0) && !defined('HHVM_VERSION')) {
|
425 |
+
$this->assertEquals('Redirected: GET', $test->server('post_redirect_get', 'POST'));
|
426 |
+
}
|
427 |
+
}
|
428 |
+
|
429 |
+
public function testPostRedirectGetReuseObjectIncompatibleEngine()
|
430 |
+
{
|
431 |
+
if ((version_compare(PHP_VERSION, '5.5.11') > 0) && !defined('HHVM_VERSION')) {
|
432 |
+
$this->markTestSkipped('This test is not applicable to this platform.');
|
433 |
+
}
|
434 |
+
|
435 |
+
try {
|
436 |
+
// Follow 303 redirection with POST
|
437 |
+
$test = new Test();
|
438 |
+
$test->curl->setOpt(CURLOPT_FOLLOWLOCATION, true);
|
439 |
+
$test->server('post_redirect_get', 'POST', array(), true);
|
440 |
+
|
441 |
+
// On incompatible PHP engines, reusing an existing Curl object to perform a
|
442 |
+
// post-redirect-get request will trigger a PHP error
|
443 |
+
$test->server('post_redirect_get', 'POST');
|
444 |
+
|
445 |
+
$this->assertTrue(false,
|
446 |
+
'Reusing an existing Curl object on incompatible PHP engines shall trigger an error.');
|
447 |
+
} catch (PHPUnit_Framework_Error $e) {
|
448 |
+
$this->assertTrue(true);
|
449 |
+
}
|
450 |
+
}
|
451 |
+
|
452 |
+
public function testPutRequestMethod()
|
453 |
+
{
|
454 |
+
$test = new Test();
|
455 |
+
$this->assertEquals('PUT', $test->server('request_method', 'PUT'));
|
456 |
+
}
|
457 |
+
|
458 |
+
public function testPutData()
|
459 |
+
{
|
460 |
+
$test = new Test();
|
461 |
+
$this->assertEquals('key=value', $test->server('put', 'PUT', array(
|
462 |
+
'key' => 'value',
|
463 |
+
)));
|
464 |
+
|
465 |
+
$test = new Test();
|
466 |
+
$this->assertEquals('{"key":"value"}', $test->server('put', 'PUT', json_encode(array(
|
467 |
+
'key' => 'value',
|
468 |
+
))));
|
469 |
+
}
|
470 |
+
|
471 |
+
public function testPutFileHandle()
|
472 |
+
{
|
473 |
+
$png = Helper\create_png();
|
474 |
+
$tmp_file = Helper\create_tmp_file($png);
|
475 |
+
|
476 |
+
$test = new Test();
|
477 |
+
$test->curl->setHeader('X-DEBUG-TEST', 'put_file_handle');
|
478 |
+
$test->curl->setOpt(CURLOPT_PUT, true);
|
479 |
+
$test->curl->setOpt(CURLOPT_INFILE, $tmp_file);
|
480 |
+
$test->curl->setOpt(CURLOPT_INFILESIZE, strlen($png));
|
481 |
+
$test->curl->put(Test::TEST_URL);
|
482 |
+
|
483 |
+
fclose($tmp_file);
|
484 |
+
|
485 |
+
$this->assertEquals('image/png', $test->curl->response);
|
486 |
+
}
|
487 |
+
|
488 |
+
public function testPatchRequestMethod()
|
489 |
+
{
|
490 |
+
$test = new Test();
|
491 |
+
$this->assertEquals('PATCH', $test->server('request_method', 'PATCH'));
|
492 |
+
}
|
493 |
+
|
494 |
+
public function testPatchData()
|
495 |
+
{
|
496 |
+
$test = new Test();
|
497 |
+
$this->assertEquals('key=value', $test->server('patch', 'PATCH', array(
|
498 |
+
'key' => 'value',
|
499 |
+
)));
|
500 |
+
|
501 |
+
$test = new Test();
|
502 |
+
$this->assertEquals('{"key":"value"}', $test->server('patch', 'PATCH', json_encode(array(
|
503 |
+
'key' => 'value',
|
504 |
+
))));
|
505 |
+
}
|
506 |
+
|
507 |
+
public function testPatchRequestMethodWithMultidimArray()
|
508 |
+
{
|
509 |
+
$data = array(
|
510 |
+
'data' => array(
|
511 |
+
'foo' => 'bar',
|
512 |
+
'wibble' => 'wubble',
|
513 |
+
),
|
514 |
+
);
|
515 |
+
|
516 |
+
$curl = new Curl();
|
517 |
+
$curl->setHeader('X-DEBUG-TEST', 'data_values');
|
518 |
+
$curl->patch(Test::TEST_URL, $data);
|
519 |
+
$this->assertEquals('{"data":{"foo":"bar","wibble":"wubble"}}', $curl->rawResponse);
|
520 |
+
$this->assertEquals(json_decode(json_encode($data), false), $curl->response);
|
521 |
+
}
|
522 |
+
|
523 |
+
public function testDeleteRequestMethod()
|
524 |
+
{
|
525 |
+
$test = new Test();
|
526 |
+
$this->assertEquals('DELETE', $test->server('request_method', 'DELETE'));
|
527 |
+
}
|
528 |
+
|
529 |
+
public function testDeleteRequestBody()
|
530 |
+
{
|
531 |
+
$test = new Test();
|
532 |
+
$test->server('delete_with_body', 'DELETE', array('foo' => 'bar'), array('wibble' => 'wubble'));
|
533 |
+
$this->assertEquals('{"get":{"foo":"bar"},"delete":{"wibble":"wubble"}}', $test->curl->rawResponse);
|
534 |
+
}
|
535 |
+
|
536 |
+
public function testHeadRequestMethod()
|
537 |
+
{
|
538 |
+
$test = new Test();
|
539 |
+
$test->server('request_method', 'HEAD');
|
540 |
+
$this->assertEquals('HEAD', $test->curl->responseHeaders['X-REQUEST-METHOD']);
|
541 |
+
$this->assertEmpty($test->curl->response);
|
542 |
+
}
|
543 |
+
|
544 |
+
public function testOptionsRequestMethod()
|
545 |
+
{
|
546 |
+
$test = new Test();
|
547 |
+
$test->server('request_method', 'OPTIONS');
|
548 |
+
$this->assertEquals('OPTIONS', $test->curl->responseHeaders['X-REQUEST-METHOD']);
|
549 |
+
}
|
550 |
+
|
551 |
+
public function testDownload()
|
552 |
+
{
|
553 |
+
// Upload a file.
|
554 |
+
$upload_file_path = Helper\get_png();
|
555 |
+
$upload_test = new Test();
|
556 |
+
$upload_test->server('upload_response', 'POST', array(
|
557 |
+
'image' => '@' . $upload_file_path,
|
558 |
+
));
|
559 |
+
$uploaded_file_path = $upload_test->curl->response->file_path;
|
560 |
+
$this->assertNotEquals($upload_file_path, $uploaded_file_path);
|
561 |
+
$this->assertEquals(md5_file($upload_file_path), $upload_test->curl->responseHeaders['ETag']);
|
562 |
+
|
563 |
+
// Download the file.
|
564 |
+
$downloaded_file_path = tempnam('/tmp', 'php-curl-class.');
|
565 |
+
$download_test = new Test();
|
566 |
+
$download_test->curl->setHeader('X-DEBUG-TEST', 'download_response');
|
567 |
+
$this->assertTrue($download_test->curl->download(Test::TEST_URL . '?' . http_build_query(array(
|
568 |
+
'file_path' => $uploaded_file_path,
|
569 |
+
)), $downloaded_file_path));
|
570 |
+
$this->assertNotEquals($uploaded_file_path, $downloaded_file_path);
|
571 |
+
|
572 |
+
$this->assertEquals(filesize($upload_file_path), filesize($downloaded_file_path));
|
573 |
+
$this->assertEquals(md5_file($upload_file_path), md5_file($downloaded_file_path));
|
574 |
+
$this->assertEquals(md5_file($upload_file_path), $download_test->curl->responseHeaders['ETag']);
|
575 |
+
|
576 |
+
// Ensure successive requests set the appropriate values.
|
577 |
+
$this->assertEquals('GET', $download_test->server('request_method', 'GET'));
|
578 |
+
$this->assertFalse(is_bool($download_test->curl->response));
|
579 |
+
$this->assertFalse(is_bool($download_test->curl->rawResponse));
|
580 |
+
|
581 |
+
// Remove server file.
|
582 |
+
$download_test = new Test();
|
583 |
+
$this->assertEquals('true', $download_test->server('upload_cleanup', 'POST', array(
|
584 |
+
'file_path' => $uploaded_file_path,
|
585 |
+
)));
|
586 |
+
|
587 |
+
unlink($upload_file_path);
|
588 |
+
unlink($downloaded_file_path);
|
589 |
+
$this->assertFalse(file_exists($upload_file_path));
|
590 |
+
$this->assertFalse(file_exists($uploaded_file_path));
|
591 |
+
$this->assertFalse(file_exists($downloaded_file_path));
|
592 |
+
}
|
593 |
+
|
594 |
+
public function testDownloadCallback()
|
595 |
+
{
|
596 |
+
// Upload a file.
|
597 |
+
$upload_file_path = Helper\get_png();
|
598 |
+
$upload_test = new Test();
|
599 |
+
$upload_test->server('upload_response', 'POST', array(
|
600 |
+
'image' => '@' . $upload_file_path,
|
601 |
+
));
|
602 |
+
$uploaded_file_path = $upload_test->curl->response->file_path;
|
603 |
+
|
604 |
+
// Download the file.
|
605 |
+
$callback_called = false;
|
606 |
+
$curl = new Curl();
|
607 |
+
$curl->setHeader('X-DEBUG-TEST', 'download_response');
|
608 |
+
$curl->download(Test::TEST_URL . '?' . http_build_query(array(
|
609 |
+
'file_path' => $uploaded_file_path,
|
610 |
+
)), function($instance, $fh) use (&$callback_called) {
|
611 |
+
PHPUnit_Framework_Assert::assertFalse($callback_called);
|
612 |
+
PHPUnit_Framework_Assert::assertInstanceOf('Curl\Curl', $instance);
|
613 |
+
PHPUnit_Framework_Assert::assertTrue(is_resource($fh));
|
614 |
+
PHPUnit_Framework_Assert::assertEquals('stream', get_resource_type($fh));
|
615 |
+
PHPUnit_Framework_Assert::assertGreaterThan(0, strlen(stream_get_contents($fh)));
|
616 |
+
PHPUnit_Framework_Assert::assertEquals(0, strlen(stream_get_contents($fh)));
|
617 |
+
PHPUnit_Framework_Assert::assertTrue(fclose($fh));
|
618 |
+
$callback_called = true;
|
619 |
+
});
|
620 |
+
$this->assertTrue($callback_called);
|
621 |
+
|
622 |
+
// Remove server file.
|
623 |
+
$this->assertEquals('true', $upload_test->server('upload_cleanup', 'POST', array(
|
624 |
+
'file_path' => $uploaded_file_path,
|
625 |
+
)));
|
626 |
+
|
627 |
+
unlink($upload_file_path);
|
628 |
+
$this->assertFalse(file_exists($upload_file_path));
|
629 |
+
$this->assertFalse(file_exists($uploaded_file_path));
|
630 |
+
}
|
631 |
+
|
632 |
+
public function testBasicHttpAuth()
|
633 |
+
{
|
634 |
+
$test = new Test();
|
635 |
+
$this->assertEquals('canceled', $test->server('http_basic_auth', 'GET'));
|
636 |
+
|
637 |
+
$username = 'myusername';
|
638 |
+
$password = 'mypassword';
|
639 |
+
$test = new Test();
|
640 |
+
$test->curl->setBasicAuthentication($username, $password);
|
641 |
+
$test->server('http_basic_auth', 'GET');
|
642 |
+
$json = $test->curl->response;
|
643 |
+
$this->assertEquals($username, $json->username);
|
644 |
+
$this->assertEquals($password, $json->password);
|
645 |
+
}
|
646 |
+
|
647 |
+
public function testDigestHttpAuth()
|
648 |
+
{
|
649 |
+
// Skip Digest Access Authentication test on HHVM.
|
650 |
+
// https://github.com/facebook/hhvm/issues/5201
|
651 |
+
if (defined('HHVM_VERSION')) {
|
652 |
+
return;
|
653 |
+
}
|
654 |
+
|
655 |
+
$username = 'myusername';
|
656 |
+
$password = 'mypassword';
|
657 |
+
$invalid_password = 'anotherpassword';
|
658 |
+
|
659 |
+
$test = new Test();
|
660 |
+
$test->server('http_digest_auth', 'GET');
|
661 |
+
$this->assertEquals('canceled', $test->curl->response);
|
662 |
+
$this->assertEquals(401, $test->curl->httpStatusCode);
|
663 |
+
|
664 |
+
$test = new Test();
|
665 |
+
$test->curl->setDigestAuthentication($username, $invalid_password);
|
666 |
+
$test->server('http_digest_auth', 'GET');
|
667 |
+
$this->assertEquals('invalid', $test->curl->response);
|
668 |
+
$this->assertEquals(401, $test->curl->httpStatusCode);
|
669 |
+
|
670 |
+
$test = new Test();
|
671 |
+
$test->curl->setDigestAuthentication($username, $password);
|
672 |
+
$test->server('http_digest_auth', 'GET');
|
673 |
+
$this->assertEquals('valid', $test->curl->response);
|
674 |
+
$this->assertEquals(200, $test->curl->httpStatusCode);
|
675 |
+
}
|
676 |
+
|
677 |
+
public function testReferrer()
|
678 |
+
{
|
679 |
+
$test = new Test();
|
680 |
+
$test->curl->setReferrer('myreferrer');
|
681 |
+
$this->assertEquals('myreferrer', $test->server('server', 'GET', array(
|
682 |
+
'key' => 'HTTP_REFERER',
|
683 |
+
)));
|
684 |
+
|
685 |
+
$test = new Test();
|
686 |
+
$test->curl->setReferer('myreferer');
|
687 |
+
$this->assertEquals('myreferer', $test->server('server', 'GET', array(
|
688 |
+
'key' => 'HTTP_REFERER',
|
689 |
+
)));
|
690 |
+
}
|
691 |
+
|
692 |
+
public function testResponseBody()
|
693 |
+
{
|
694 |
+
foreach (array(
|
695 |
+
'GET' => 'OK',
|
696 |
+
'POST' => 'OK',
|
697 |
+
'PUT' => 'OK',
|
698 |
+
'PATCH' => 'OK',
|
699 |
+
'DELETE' => 'OK',
|
700 |
+
'HEAD' => '',
|
701 |
+
'OPTIONS' => 'OK',
|
702 |
+
) as $request_method => $expected_response) {
|
703 |
+
$curl = new Curl();
|
704 |
+
$curl->setHeader('X-DEBUG-TEST', 'response_body');
|
705 |
+
$this->assertEquals($expected_response, $curl->$request_method(Test::TEST_URL));
|
706 |
+
}
|
707 |
+
}
|
708 |
+
|
709 |
+
public function testSetCookie()
|
710 |
+
{
|
711 |
+
$test = new Test();
|
712 |
+
$test->curl->setCookie('mycookie', 'yum');
|
713 |
+
$this->assertEquals('yum', $test->server('cookie', 'GET', array(
|
714 |
+
'key' => 'mycookie',
|
715 |
+
)));
|
716 |
+
}
|
717 |
+
|
718 |
+
public function testSetCookieEncodingSpace()
|
719 |
+
{
|
720 |
+
$curl = new Curl();
|
721 |
+
$curl->setCookie('cookie', 'Om nom nom nom');
|
722 |
+
|
723 |
+
$reflectionClass = new ReflectionClass('\Curl\Curl');
|
724 |
+
$reflectionProperty = $reflectionClass->getProperty('options');
|
725 |
+
$reflectionProperty->setAccessible(true);
|
726 |
+
$options = $reflectionProperty->getValue($curl);
|
727 |
+
$this->assertEquals('cookie=Om%20nom%20nom%20nom', $options[CURLOPT_COOKIE]);
|
728 |
+
}
|
729 |
+
|
730 |
+
public function testSetMultipleCookies()
|
731 |
+
{
|
732 |
+
$curl = new Curl();
|
733 |
+
$curl->setCookie('cookie', 'Om nom nom nom');
|
734 |
+
$curl->setCookie('foo', 'bar');
|
735 |
+
|
736 |
+
$reflectionClass = new ReflectionClass('\Curl\Curl');
|
737 |
+
$reflectionProperty = $reflectionClass->getProperty('options');
|
738 |
+
$reflectionProperty->setAccessible(true);
|
739 |
+
$options = $reflectionProperty->getValue($curl);
|
740 |
+
$this->assertEquals('cookie=Om%20nom%20nom%20nom; foo=bar', $options[CURLOPT_COOKIE]);
|
741 |
+
}
|
742 |
+
|
743 |
+
public function testSetCookieEncodingColon()
|
744 |
+
{
|
745 |
+
$curl = new Curl();
|
746 |
+
$curl->setCookie('JSESSIONID', '0000wd-PcsB3bZ-KzYGAqm_rKlm:17925chrl');
|
747 |
+
|
748 |
+
$reflectionClass = new ReflectionClass('\Curl\Curl');
|
749 |
+
$reflectionProperty = $reflectionClass->getProperty('options');
|
750 |
+
$reflectionProperty->setAccessible(true);
|
751 |
+
$options = $reflectionProperty->getValue($curl);
|
752 |
+
$this->assertEquals('JSESSIONID=0000wd-PcsB3bZ-KzYGAqm_rKlm:17925chrl', $options[CURLOPT_COOKIE]);
|
753 |
+
}
|
754 |
+
|
755 |
+
public function testSetCookieString()
|
756 |
+
{
|
757 |
+
$cookie_string = 'fruit=apple; color=red';
|
758 |
+
|
759 |
+
$test = new Test();
|
760 |
+
$test->curl->setCookieString($cookie_string);
|
761 |
+
|
762 |
+
$reflectionClass = new ReflectionClass('\Curl\Curl');
|
763 |
+
$reflectionProperty = $reflectionClass->getProperty('options');
|
764 |
+
$reflectionProperty->setAccessible(true);
|
765 |
+
$options = $reflectionProperty->getValue($test->curl);
|
766 |
+
$this->assertEquals($cookie_string, $options[CURLOPT_COOKIE]);
|
767 |
+
$this->assertEquals('fruit=apple&color=red', $test->server('cookie', 'GET'));
|
768 |
+
}
|
769 |
+
|
770 |
+
public function testCookieFile()
|
771 |
+
{
|
772 |
+
$cookie_file = dirname(__FILE__) . '/cookies.txt';
|
773 |
+
$cookie_data = implode("\t", array(
|
774 |
+
'127.0.0.1', // domain
|
775 |
+
'FALSE', // tailmatch
|
776 |
+
'/', // path
|
777 |
+
'FALSE', // secure
|
778 |
+
'0', // expires
|
779 |
+
'mycookie', // name
|
780 |
+
'yum', // value
|
781 |
+
));
|
782 |
+
file_put_contents($cookie_file, $cookie_data);
|
783 |
+
|
784 |
+
$test = new Test();
|
785 |
+
$test->curl->setCookieFile($cookie_file);
|
786 |
+
$this->assertEquals('yum', $test->server('cookie', 'GET', array(
|
787 |
+
'key' => 'mycookie',
|
788 |
+
)));
|
789 |
+
|
790 |
+
unlink($cookie_file);
|
791 |
+
$this->assertFalse(file_exists($cookie_file));
|
792 |
+
}
|
793 |
+
|
794 |
+
public function testCookieJar()
|
795 |
+
{
|
796 |
+
$cookie_file = dirname(__FILE__) . '/cookies.txt';
|
797 |
+
|
798 |
+
$test = new Test();
|
799 |
+
$test->curl->setCookieJar($cookie_file);
|
800 |
+
$test->server('cookiejar', 'GET');
|
801 |
+
$test->curl->close();
|
802 |
+
|
803 |
+
$this->assertTrue(!(strpos(file_get_contents($cookie_file), "\t" . 'mycookie' . "\t" . 'yum') === false));
|
804 |
+
unlink($cookie_file);
|
805 |
+
$this->assertFalse(file_exists($cookie_file));
|
806 |
+
}
|
807 |
+
|
808 |
+
public function testMultipleCookieResponse()
|
809 |
+
{
|
810 |
+
$test = new Test();
|
811 |
+
$test->server('multiple_cookie', 'GET');
|
812 |
+
$this->assertEquals('cookie1=scrumptious,cookie2=mouthwatering', $test->curl->responseHeaders['Set-Cookie']);
|
813 |
+
|
814 |
+
$response_cookies = $test->curl->getResponseCookies();
|
815 |
+
$this->assertEquals('scrumptious', $response_cookies['cookie1']);
|
816 |
+
$this->assertEquals('mouthwatering', $response_cookies['cookie2']);
|
817 |
+
}
|
818 |
+
|
819 |
+
public function testDefaultTimeout()
|
820 |
+
{
|
821 |
+
$test = new Test();
|
822 |
+
$test->server('timeout', 'GET', array(
|
823 |
+
'seconds' => '31',
|
824 |
+
));
|
825 |
+
$this->assertTrue($test->curl->error);
|
826 |
+
$this->assertTrue($test->curl->curlError);
|
827 |
+
$this->assertEquals(CURLE_OPERATION_TIMEOUTED, $test->curl->errorCode);
|
828 |
+
$this->assertEquals(CURLE_OPERATION_TIMEOUTED, $test->curl->curlErrorCode);
|
829 |
+
$this->assertFalse($test->curl->httpError);
|
830 |
+
}
|
831 |
+
|
832 |
+
public function testTimeoutError()
|
833 |
+
{
|
834 |
+
$test = new Test();
|
835 |
+
$test->curl->setTimeout(5);
|
836 |
+
$test->server('timeout', 'GET', array(
|
837 |
+
'seconds' => '10',
|
838 |
+
));
|
839 |
+
$this->assertTrue($test->curl->error);
|
840 |
+
$this->assertTrue($test->curl->curlError);
|
841 |
+
$this->assertEquals(CURLE_OPERATION_TIMEOUTED, $test->curl->errorCode);
|
842 |
+
$this->assertEquals(CURLE_OPERATION_TIMEOUTED, $test->curl->curlErrorCode);
|
843 |
+
$this->assertFalse($test->curl->httpError);
|
844 |
+
}
|
845 |
+
|
846 |
+
public function testTimeout()
|
847 |
+
{
|
848 |
+
$test = new Test();
|
849 |
+
$test->curl->setTimeout(10);
|
850 |
+
$test->server('timeout', 'GET', array(
|
851 |
+
'seconds' => '5',
|
852 |
+
));
|
853 |
+
$this->assertFalse($test->curl->error);
|
854 |
+
$this->assertFalse($test->curl->curlError);
|
855 |
+
$this->assertNotEquals(CURLE_OPERATION_TIMEOUTED, $test->curl->errorCode);
|
856 |
+
$this->assertNotEquals(CURLE_OPERATION_TIMEOUTED, $test->curl->curlErrorCode);
|
857 |
+
$this->assertFalse($test->curl->httpError);
|
858 |
+
}
|
859 |
+
|
860 |
+
public function testError()
|
861 |
+
{
|
862 |
+
$test = new Test();
|
863 |
+
$test->curl->setOpt(CURLOPT_CONNECTTIMEOUT_MS, 4000);
|
864 |
+
$test->curl->get(Test::ERROR_URL);
|
865 |
+
$this->assertTrue($test->curl->error);
|
866 |
+
$this->assertTrue($test->curl->curlError);
|
867 |
+
$this->assertEquals(CURLE_OPERATION_TIMEOUTED, $test->curl->errorCode);
|
868 |
+
$this->assertEquals(CURLE_OPERATION_TIMEOUTED, $test->curl->curlErrorCode);
|
869 |
+
}
|
870 |
+
|
871 |
+
public function testErrorMessage()
|
872 |
+
{
|
873 |
+
$test = new Test();
|
874 |
+
$test->server('error_message', 'GET');
|
875 |
+
$this->assertEquals('HTTP/1.1 401 Unauthorized', $test->curl->errorMessage);
|
876 |
+
}
|
877 |
+
|
878 |
+
public function testRequestHeaderCaseSensitivity()
|
879 |
+
{
|
880 |
+
$content_type = 'application/json';
|
881 |
+
$curl = new Curl();
|
882 |
+
$curl->setHeader('Content-Type', $content_type);
|
883 |
+
|
884 |
+
$reflector = new ReflectionClass('\Curl\Curl');
|
885 |
+
$property = $reflector->getProperty('headers');
|
886 |
+
$property->setAccessible(true);
|
887 |
+
$headers = $property->getValue($curl);
|
888 |
+
|
889 |
+
$this->assertEquals($content_type, $headers['Content-Type']);
|
890 |
+
$this->assertEquals($content_type, $headers['content-type']);
|
891 |
+
$this->assertEquals($content_type, $headers['CONTENT-TYPE']);
|
892 |
+
$this->assertEquals($content_type, $headers['cOnTeNt-TyPe']);
|
893 |
+
}
|
894 |
+
|
895 |
+
public function testResponseHeaders()
|
896 |
+
{
|
897 |
+
$test = new Test();
|
898 |
+
$test->curl->setHeader('Content-Type', 'application/json');
|
899 |
+
$test->curl->setHeader('X-Requested-With', 'XMLHttpRequest');
|
900 |
+
$test->curl->setHeader('Accept', 'application/json');
|
901 |
+
$this->assertEquals('application/json', $test->server('server', 'GET', array('key' => 'CONTENT_TYPE')));
|
902 |
+
$this->assertEquals('XMLHttpRequest', $test->server('server', 'GET', array('key' => 'HTTP_X_REQUESTED_WITH')));
|
903 |
+
$this->assertEquals('application/json', $test->server('server', 'GET', array('key' => 'HTTP_ACCEPT')));
|
904 |
+
}
|
905 |
+
|
906 |
+
public function testResponseHeaderCaseSensitivity()
|
907 |
+
{
|
908 |
+
$content_type = 'application/json';
|
909 |
+
$test = new Test();
|
910 |
+
$test->curl->setHeader('Content-Type', $content_type);
|
911 |
+
$test->server('response_header', 'GET');
|
912 |
+
|
913 |
+
$request_headers = $test->curl->requestHeaders;
|
914 |
+
$response_headers = $test->curl->responseHeaders;
|
915 |
+
|
916 |
+
$this->assertEquals($content_type, $request_headers['Content-Type']);
|
917 |
+
$this->assertEquals($content_type, $request_headers['content-type']);
|
918 |
+
$this->assertEquals($content_type, $request_headers['CONTENT-TYPE']);
|
919 |
+
$this->assertEquals($content_type, $request_headers['cOnTeNt-TyPe']);
|
920 |
+
|
921 |
+
$etag = $response_headers['ETag'];
|
922 |
+
$this->assertEquals($etag, $response_headers['ETAG']);
|
923 |
+
$this->assertEquals($etag, $response_headers['etag']);
|
924 |
+
$this->assertEquals($etag, $response_headers['eTAG']);
|
925 |
+
$this->assertEquals($etag, $response_headers['eTaG']);
|
926 |
+
}
|
927 |
+
|
928 |
+
public function testHeaderOutOptional()
|
929 |
+
{
|
930 |
+
// CURLINFO_HEADER_OUT is true by default.
|
931 |
+
$test_1 = new Test();
|
932 |
+
$test_1->server('response_header', 'GET');
|
933 |
+
$this->assertNotEmpty($test_1->curl->requestHeaders);
|
934 |
+
$this->assertNotEmpty($test_1->curl->requestHeaders['Request-Line']);
|
935 |
+
|
936 |
+
// CURLINFO_HEADER_OUT is set to true.
|
937 |
+
$test_2 = new Test();
|
938 |
+
$test_2->curl->setOpt(CURLINFO_HEADER_OUT, true);
|
939 |
+
$test_2->server('response_header', 'GET');
|
940 |
+
$this->assertNotEmpty($test_2->curl->requestHeaders);
|
941 |
+
$this->assertNotEmpty($test_2->curl->requestHeaders['Request-Line']);
|
942 |
+
|
943 |
+
// CURLINFO_HEADER_OUT is set to false.
|
944 |
+
$test_3 = new Test();
|
945 |
+
$test_3->curl->setOpt(CURLINFO_HEADER_OUT, false);
|
946 |
+
$test_3->curl->verbose();
|
947 |
+
$test_3->server('response_header', 'GET');
|
948 |
+
$this->assertNull($test_3->curl->requestHeaders);
|
949 |
+
}
|
950 |
+
|
951 |
+
public function testHeaderRedirect()
|
952 |
+
{
|
953 |
+
$test = new Test();
|
954 |
+
$test->curl->setOpt(CURLOPT_FOLLOWLOCATION, true);
|
955 |
+
$test->server('redirect', 'GET');
|
956 |
+
$this->assertEquals('OK', $test->curl->response);
|
957 |
+
}
|
958 |
+
|
959 |
+
public function testRequestUrl()
|
960 |
+
{
|
961 |
+
$test = new Test();
|
962 |
+
$this->assertFalse(substr($test->server('request_uri', 'GET'), -1) === '?');
|
963 |
+
$test = new Test();
|
964 |
+
$this->assertFalse(substr($test->server('request_uri', 'POST'), -1) === '?');
|
965 |
+
$test = new Test();
|
966 |
+
$this->assertFalse(substr($test->server('request_uri', 'PUT'), -1) === '?');
|
967 |
+
$test = new Test();
|
968 |
+
$this->assertFalse(substr($test->server('request_uri', 'PATCH'), -1) === '?');
|
969 |
+
$test = new Test();
|
970 |
+
$this->assertFalse(substr($test->server('request_uri', 'DELETE'), -1) === '?');
|
971 |
+
}
|
972 |
+
|
973 |
+
public function testNestedData()
|
974 |
+
{
|
975 |
+
$test = new Test();
|
976 |
+
$data = array(
|
977 |
+
'username' => 'myusername',
|
978 |
+
'password' => 'mypassword',
|
979 |
+
'more_data' => array(
|
980 |
+
'param1' => 'something',
|
981 |
+
'param2' => 'other thing',
|
982 |
+
'another' => array(
|
983 |
+
'extra' => 'level',
|
984 |
+
'because' => 'I need it',
|
985 |
+
),
|
986 |
+
),
|
987 |
+
);
|
988 |
+
$this->assertEquals(http_build_query($data), $test->server('post', 'POST', $data));
|
989 |
+
}
|
990 |
+
|
991 |
+
public function testPostStringUrlEncodedContentType()
|
992 |
+
{
|
993 |
+
$test = new Test();
|
994 |
+
$test->server('server', 'POST', 'foo=bar');
|
995 |
+
$this->assertEquals('application/x-www-form-urlencoded', $test->curl->requestHeaders['Content-Type']);
|
996 |
+
}
|
997 |
+
|
998 |
+
public function testPostArrayUrlEncodedContentType()
|
999 |
+
{
|
1000 |
+
$test = new Test();
|
1001 |
+
$test->server('server', 'POST', array(
|
1002 |
+
'foo' => 'bar',
|
1003 |
+
));
|
1004 |
+
$this->assertEquals('application/x-www-form-urlencoded', $test->curl->requestHeaders['Content-Type']);
|
1005 |
+
}
|
1006 |
+
|
1007 |
+
public function testPostFileFormDataContentType()
|
1008 |
+
{
|
1009 |
+
$file_path = Helper\get_png();
|
1010 |
+
|
1011 |
+
$test = new Test();
|
1012 |
+
$test->server('server', 'POST', array(
|
1013 |
+
'image' => '@' . $file_path,
|
1014 |
+
));
|
1015 |
+
$this->assertEquals('100-continue', $test->curl->requestHeaders['Expect']);
|
1016 |
+
preg_match('/^multipart\/form-data; boundary=/', $test->curl->requestHeaders['Content-Type'], $content_type);
|
1017 |
+
$this->assertTrue(!empty($content_type));
|
1018 |
+
|
1019 |
+
unlink($file_path);
|
1020 |
+
$this->assertFalse(file_exists($file_path));
|
1021 |
+
}
|
1022 |
+
|
1023 |
+
public function testPostCurlFileFormDataContentType()
|
1024 |
+
{
|
1025 |
+
if (!class_exists('CURLFile')) {
|
1026 |
+
return;
|
1027 |
+
}
|
1028 |
+
|
1029 |
+
$file_path = Helper\get_png();
|
1030 |
+
|
1031 |
+
$test = new Test();
|
1032 |
+
$test->server('server', 'POST', array(
|
1033 |
+
'image' => new CURLFile($file_path),
|
1034 |
+
));
|
1035 |
+
$this->assertEquals('100-continue', $test->curl->requestHeaders['Expect']);
|
1036 |
+
preg_match('/^multipart\/form-data; boundary=/', $test->curl->requestHeaders['Content-Type'], $content_type);
|
1037 |
+
$this->assertTrue(!empty($content_type));
|
1038 |
+
|
1039 |
+
unlink($file_path) ;
|
1040 |
+
$this->assertFalse(file_exists($file_path));
|
1041 |
+
}
|
1042 |
+
|
1043 |
+
public function testJsonRequest()
|
1044 |
+
{
|
1045 |
+
foreach (
|
1046 |
+
array(
|
1047 |
+
array(
|
1048 |
+
array(
|
1049 |
+
'key' => 'value',
|
1050 |
+
),
|
1051 |
+
'{"key":"value"}',
|
1052 |
+
),
|
1053 |
+
array(
|
1054 |
+
array(
|
1055 |
+
'key' => 'value',
|
1056 |
+
'strings' => array(
|
1057 |
+
'a',
|
1058 |
+
'b',
|
1059 |
+
'c',
|
1060 |
+
),
|
1061 |
+
),
|
1062 |
+
'{"key":"value","strings":["a","b","c"]}',
|
1063 |
+
),
|
1064 |
+
) as $test) {
|
1065 |
+
list($data, $expected_response) = $test;
|
1066 |
+
|
1067 |
+
$test = new Test();
|
1068 |
+
$this->assertEquals($expected_response, $test->server('post_json', 'POST', json_encode($data)));
|
1069 |
+
|
1070 |
+
foreach (array(
|
1071 |
+
'Content-Type',
|
1072 |
+
'content-type',
|
1073 |
+
'CONTENT-TYPE') as $key) {
|
1074 |
+
foreach (array(
|
1075 |
+
'APPLICATION/JSON',
|
1076 |
+
'APPLICATION/JSON; CHARSET=UTF-8',
|
1077 |
+
'APPLICATION/JSON;CHARSET=UTF-8',
|
1078 |
+
'application/json',
|
1079 |
+
'application/json; charset=utf-8',
|
1080 |
+
'application/json;charset=UTF-8',
|
1081 |
+
) as $value) {
|
1082 |
+
$test = new Test();
|
1083 |
+
$test->curl->setHeader($key, $value);
|
1084 |
+
$this->assertEquals($expected_response, $test->server('post_json', 'POST', json_encode($data)));
|
1085 |
+
|
1086 |
+
$test = new Test();
|
1087 |
+
$test->curl->setHeader($key, $value);
|
1088 |
+
$this->assertEquals($expected_response, $test->server('post_json', 'POST', $data));
|
1089 |
+
}
|
1090 |
+
}
|
1091 |
+
}
|
1092 |
+
}
|
1093 |
+
|
1094 |
+
public function testJsonResponse()
|
1095 |
+
{
|
1096 |
+
foreach (array(
|
1097 |
+
'Content-Type',
|
1098 |
+
'content-type',
|
1099 |
+
'CONTENT-TYPE') as $key) {
|
1100 |
+
foreach (array(
|
1101 |
+
'APPLICATION/JSON',
|
1102 |
+
'APPLICATION/JSON; CHARSET=UTF-8',
|
1103 |
+
'APPLICATION/JSON;CHARSET=UTF-8',
|
1104 |
+
'application/json',
|
1105 |
+
'application/json; charset=utf-8',
|
1106 |
+
'application/json;charset=UTF-8',
|
1107 |
+
) as $value) {
|
1108 |
+
$test = new Test();
|
1109 |
+
$test->server('json_response', 'POST', array(
|
1110 |
+
'key' => $key,
|
1111 |
+
'value' => $value,
|
1112 |
+
));
|
1113 |
+
|
1114 |
+
$response = $test->curl->response;
|
1115 |
+
$this->assertNotNull($response);
|
1116 |
+
$this->assertNull($response->null);
|
1117 |
+
$this->assertTrue($response->true);
|
1118 |
+
$this->assertFalse($response->false);
|
1119 |
+
$this->assertTrue(is_int($response->integer));
|
1120 |
+
$this->assertTrue(is_float($response->float));
|
1121 |
+
$this->assertEmpty($response->empty);
|
1122 |
+
$this->assertTrue(is_string($response->string));
|
1123 |
+
$this->assertEquals(json_encode(array(
|
1124 |
+
'null' => null,
|
1125 |
+
'true' => true,
|
1126 |
+
'false' => false,
|
1127 |
+
'integer' => 1,
|
1128 |
+
'float' => 3.14,
|
1129 |
+
'empty' => '',
|
1130 |
+
'string' => 'string',
|
1131 |
+
)), $test->curl->rawResponse);
|
1132 |
+
}
|
1133 |
+
}
|
1134 |
+
}
|
1135 |
+
|
1136 |
+
public function testJsonDecoderOptions()
|
1137 |
+
{
|
1138 |
+
// Implicit default json decoder should return object.
|
1139 |
+
$test = new Test();
|
1140 |
+
$test->server('json_response', 'GET');
|
1141 |
+
$this->assertTrue(is_object($test->curl->response));
|
1142 |
+
|
1143 |
+
// Explicit default json decoder should return object.
|
1144 |
+
$test = new Test();
|
1145 |
+
$test->curl->setDefaultJsonDecoder();
|
1146 |
+
$test->server('json_response', 'GET');
|
1147 |
+
$this->assertTrue(is_object($test->curl->response));
|
1148 |
+
|
1149 |
+
// Explicit default json decoder with options should return associative array as specified.
|
1150 |
+
$assoc = true;
|
1151 |
+
$depth = 512;
|
1152 |
+
$options = 0;
|
1153 |
+
$test = new Test();
|
1154 |
+
$test->curl->setDefaultJsonDecoder($assoc, $depth, $options);
|
1155 |
+
$test->server('json_response', 'GET');
|
1156 |
+
$this->assertTrue(is_array($test->curl->response));
|
1157 |
+
}
|
1158 |
+
|
1159 |
+
public function testJsonDecoder()
|
1160 |
+
{
|
1161 |
+
$data = array(
|
1162 |
+
'key' => 'Content-Type',
|
1163 |
+
'value' => 'application/json',
|
1164 |
+
);
|
1165 |
+
|
1166 |
+
$test = new Test();
|
1167 |
+
$test->server('json_response', 'POST', $data);
|
1168 |
+
$this->assertTrue(is_object($test->curl->response));
|
1169 |
+
$this->assertFalse(is_array($test->curl->response));
|
1170 |
+
|
1171 |
+
$test = new Test();
|
1172 |
+
$test->curl->setJsonDecoder(function($response) {
|
1173 |
+
return json_decode($response, true);
|
1174 |
+
});
|
1175 |
+
$test->server('json_response', 'POST', $data);
|
1176 |
+
$this->assertFalse(is_object($test->curl->response));
|
1177 |
+
$this->assertTrue(is_array($test->curl->response));
|
1178 |
+
}
|
1179 |
+
|
1180 |
+
public function testJsonContentTypeDetection()
|
1181 |
+
{
|
1182 |
+
$json_content_types = array(
|
1183 |
+
'application/alto-costmap+json',
|
1184 |
+
'application/alto-costmapfilter+json',
|
1185 |
+
'application/alto-directory+json',
|
1186 |
+
'application/alto-endpointprop+json',
|
1187 |
+
'application/alto-endpointpropparams+json',
|
1188 |
+
'application/alto-endpointcost+json',
|
1189 |
+
'application/alto-endpointcostparams+json',
|
1190 |
+
'application/alto-error+json',
|
1191 |
+
'application/alto-networkmapfilter+json',
|
1192 |
+
'application/alto-networkmap+json',
|
1193 |
+
'application/calendar+json',
|
1194 |
+
'application/coap-group+json',
|
1195 |
+
'application/jose+json',
|
1196 |
+
'application/jrd+json',
|
1197 |
+
'application/json',
|
1198 |
+
'application/json-patch+json',
|
1199 |
+
'application/json-seq',
|
1200 |
+
'application/jwk+json',
|
1201 |
+
'application/jwk-set+json',
|
1202 |
+
'application/ld+json',
|
1203 |
+
'application/merge-patch+json',
|
1204 |
+
'application/rdap+json',
|
1205 |
+
'application/reputon+json',
|
1206 |
+
'application/vcard+json',
|
1207 |
+
'application/vnd.apache.thrift.json',
|
1208 |
+
'application/vnd.api+json',
|
1209 |
+
'application/vnd.bekitzur-stech+json',
|
1210 |
+
'application/vnd.collection.doc+json',
|
1211 |
+
'application/vnd.collection+json',
|
1212 |
+
'application/vnd.collection.next+json',
|
1213 |
+
'application/vnd.document+json',
|
1214 |
+
'application/vnd.geo+json',
|
1215 |
+
'application/vnd.hal+json',
|
1216 |
+
'application/vnd.heroku+json',
|
1217 |
+
'application/vnd.ims.lis.v2.result+json',
|
1218 |
+
'application/vnd.ims.lti.v2.toolconsumerprofile+json',
|
1219 |
+
'application/vnd.ims.lti.v2.toolproxy.id+json',
|
1220 |
+
'application/vnd.ims.lti.v2.toolproxy+json',
|
1221 |
+
'application/vnd.ims.lti.v2.toolsettings+json',
|
1222 |
+
'application/vnd.ims.lti.v2.toolsettings.simple+json',
|
1223 |
+
'application/vnd.mason+json',
|
1224 |
+
'application/vnd.micro+json',
|
1225 |
+
'application/vnd.miele+json',
|
1226 |
+
'application/vnd.oftn.l10n+json',
|
1227 |
+
'application/vnd.oracle.resource+json',
|
1228 |
+
'application/vnd.siren+json',
|
1229 |
+
'application/vnd.xacml+json',
|
1230 |
+
|
1231 |
+
// Non-standard
|
1232 |
+
'application/x-json',
|
1233 |
+
'text/json',
|
1234 |
+
'text/x-json',
|
1235 |
+
);
|
1236 |
+
|
1237 |
+
$class = new ReflectionClass('\Curl\Curl');
|
1238 |
+
$property = $class->getProperty('jsonPattern');
|
1239 |
+
$property->setAccessible(true);
|
1240 |
+
$json_pattern = $property->getValue(new Curl);
|
1241 |
+
|
1242 |
+
foreach ($json_content_types as $json_content_type) {
|
1243 |
+
$message = '"' . $json_content_type . '" does not match pattern ' . $json_pattern;
|
1244 |
+
$this->assertEquals(1, preg_match($json_pattern, $json_content_type), $message);
|
1245 |
+
}
|
1246 |
+
|
1247 |
+
$not_json_content_types = array(
|
1248 |
+
'application/1d-interleaved-parityfec',
|
1249 |
+
'application/3gpdash-qoe-report+xml',
|
1250 |
+
'application/3gpp-ims+xml',
|
1251 |
+
'application/A2L',
|
1252 |
+
'application/activemessage',
|
1253 |
+
'application/activemessage',
|
1254 |
+
'application/AML',
|
1255 |
+
'application/andrew-inset',
|
1256 |
+
'application/applefile',
|
1257 |
+
'application/ATF',
|
1258 |
+
'application/ATFX',
|
1259 |
+
'application/atom+xml',
|
1260 |
+
'application/atomcat+xml',
|
1261 |
+
'application/atomdeleted+xml',
|
1262 |
+
'application/atomicmail',
|
1263 |
+
'application/atomsvc+xml',
|
1264 |
+
'application/ATXML',
|
1265 |
+
'application/auth-policy+xml',
|
1266 |
+
'application/bacnet-xdd+zip',
|
1267 |
+
'application/batch-SMTP',
|
1268 |
+
'application/beep+xml',
|
1269 |
+
'application/calendar+xml',
|
1270 |
+
'application/call-completion',
|
1271 |
+
'application/cals-1840',
|
1272 |
+
'application/cbor',
|
1273 |
+
'application/ccmp+xml',
|
1274 |
+
'application/ccxml+xml',
|
1275 |
+
'application/CDFX+XML',
|
1276 |
+
'application/cdmi-capability',
|
1277 |
+
'application/cdmi-container',
|
1278 |
+
'application/cdmi-domain',
|
1279 |
+
'application/cdmi-object',
|
1280 |
+
'application/cdmi-queue',
|
1281 |
+
'application/CEA',
|
1282 |
+
'application/cea-2018+xml',
|
1283 |
+
'application/cellml+xml',
|
1284 |
+
'application/cfw',
|
1285 |
+
'application/cms',
|
1286 |
+
'application/cnrp+xml',
|
1287 |
+
'application/commonground',
|
1288 |
+
'application/conference-info+xml',
|
1289 |
+
'application/cpl+xml',
|
1290 |
+
'application/csrattrs',
|
1291 |
+
'application/csta+xml',
|
1292 |
+
'application/CSTAdata+xml',
|
1293 |
+
'application/cybercash',
|
1294 |
+
'application/dash+xml',
|
1295 |
+
'application/dashdelta',
|
1296 |
+
'application/davmount+xml',
|
1297 |
+
'application/dca-rft',
|
1298 |
+
'application/DCD',
|
1299 |
+
'application/dec-dx',
|
1300 |
+
'application/dialog-info+xml',
|
1301 |
+
'application/dicom',
|
1302 |
+
'application/DII',
|
1303 |
+
'application/DIT',
|
1304 |
+
'application/dns',
|
1305 |
+
'application/dskpp+xml',
|
1306 |
+
'application/dssc+der',
|
1307 |
+
'application/dssc+xml',
|
1308 |
+
'application/dvcs',
|
1309 |
+
'application/ecmascript',
|
1310 |
+
'application/EDI-consent',
|
1311 |
+
'application/EDIFACT',
|
1312 |
+
'application/EDI-X12',
|
1313 |
+
'application/emotionml+xml',
|
1314 |
+
'application/encaprtp',
|
1315 |
+
'application/epp+xml',
|
1316 |
+
'application/epub+zip',
|
1317 |
+
'application/eshop',
|
1318 |
+
'application/example',
|
1319 |
+
'application/fastinfoset',
|
1320 |
+
'application/fastsoap',
|
1321 |
+
'application/fdt+xml',
|
1322 |
+
'application/fits',
|
1323 |
+
'application/font-sfnt',
|
1324 |
+
'application/font-tdpfr',
|
1325 |
+
'application/font-woff',
|
1326 |
+
'application/framework-attributes+xml',
|
1327 |
+
'application/gzip',
|
1328 |
+
'application/H224',
|
1329 |
+
'application/held+xml',
|
1330 |
+
'application/http',
|
1331 |
+
'application/hyperstudio',
|
1332 |
+
'application/ibe-key-request+xml',
|
1333 |
+
'application/ibe-pkg-reply+xml',
|
1334 |
+
'application/ibe-pp-data',
|
1335 |
+
'application/iges',
|
1336 |
+
'application/im-iscomposing+xml',
|
1337 |
+
'application/index',
|
1338 |
+
'application/index.cmd',
|
1339 |
+
'application/index.obj',
|
1340 |
+
'application/index.response',
|
1341 |
+
'application/index.vnd',
|
1342 |
+
'application/inkml+xml',
|
1343 |
+
'application/IOTP',
|
1344 |
+
'application/ipfix',
|
1345 |
+
'application/ipp',
|
1346 |
+
'application/ISUP',
|
1347 |
+
'application/its+xml',
|
1348 |
+
'application/javascript',
|
1349 |
+
'application/jose',
|
1350 |
+
'application/jwt',
|
1351 |
+
'application/kpml-request+xml',
|
1352 |
+
'application/kpml-response+xml',
|
1353 |
+
'application/link-format',
|
1354 |
+
'application/load-control+xml',
|
1355 |
+
'application/lost+xml',
|
1356 |
+
'application/lostsync+xml',
|
1357 |
+
'application/LXF',
|
1358 |
+
'application/mac-binhex40',
|
1359 |
+
'application/macwriteii',
|
1360 |
+
'application/mads+xml',
|
1361 |
+
'application/marc',
|
1362 |
+
'application/marcxml+xml',
|
1363 |
+
'application/mathematica',
|
1364 |
+
'application/mbms-associated-procedure-description+xml',
|
1365 |
+
'application/mbms-deregister+xml',
|
1366 |
+
'application/mbms-envelope+xml',
|
1367 |
+
'application/mbms-msk-response+xml',
|
1368 |
+
'application/mbms-msk+xml',
|
1369 |
+
'application/mbms-protection-description+xml',
|
1370 |
+
'application/mbms-reception-report+xml',
|
1371 |
+
'application/mbms-register-response+xml',
|
1372 |
+
'application/mbms-register+xml',
|
1373 |
+
'application/mbms-schedule+xml',
|
1374 |
+
'application/mbms-user-service-description+xml',
|
1375 |
+
'application/mbox+xml',
|
1376 |
+
'application/media_control+xml',
|
1377 |
+
'application/media-policy-dataset+xml',
|
1378 |
+
'application/mediaservercontrol+xml',
|
1379 |
+
'application/metalink4+xml',
|
1380 |
+
'application/mets+xml',
|
1381 |
+
'application/MF4',
|
1382 |
+
'application/mikey',
|
1383 |
+
'application/mods+xml',
|
1384 |
+
'application/moss-keys',
|
1385 |
+
'application/moss-signature',
|
1386 |
+
'application/mosskey-data',
|
1387 |
+
'application/mosskey-request',
|
1388 |
+
'application/mp21',
|
1389 |
+
'application/mp4',
|
1390 |
+
'application/mpeg4-generic',
|
1391 |
+
'application/mpeg4-iod',
|
1392 |
+
'application/mpeg4-iod-xmt',
|
1393 |
+
'application/mrb-consumer+xml',
|
1394 |
+
'application/mrb-publish+xml',
|
1395 |
+
'application/msc-ivr+xml',
|
1396 |
+
'application/msc-mixer+xml',
|
1397 |
+
'application/msword',
|
1398 |
+
'application/mxf',
|
1399 |
+
'application/nasdata',
|
1400 |
+
'application/news-checkgroups',
|
1401 |
+
'application/news-groupinfo',
|
1402 |
+
'application/news-transmission',
|
1403 |
+
'application/nlsml+xml',
|
1404 |
+
'application/nss',
|
1405 |
+
'application/ocsp-request',
|
1406 |
+
'application/oscp-response',
|
1407 |
+
'application/octet-stream',
|
1408 |
+
'application/ODA',
|
1409 |
+
'application/ODX',
|
1410 |
+
'application/oebps-package+xml',
|
1411 |
+
'application/ogg',
|
1412 |
+
'application/oxps',
|
1413 |
+
'application/p2p-overlay+xml',
|
1414 |
+
'application/patch-ops-error+xml',
|
1415 |
+
'application/pdf',
|
1416 |
+
'application/PDX',
|
1417 |
+
'application/pgp-encrypted',
|
1418 |
+
'application/pgp-signature',
|
1419 |
+
'application/pidf-diff+xml',
|
1420 |
+
'application/pidf+xml',
|
1421 |
+
'application/pkcs10',
|
1422 |
+
'application/pkcs7-mime',
|
1423 |
+
'application/pkcs7-signature',
|
1424 |
+
'application/pkcs8',
|
1425 |
+
'application/pkix-attr-cert',
|
1426 |
+
'application/pkix-cert',
|
1427 |
+
'application/pkix-crl',
|
1428 |
+
'application/pkix-pkipath',
|
1429 |
+
'application/pkixcmp',
|
1430 |
+
'application/pls+xml',
|
1431 |
+
'application/poc-settings+xml',
|
1432 |
+
'application/postscript',
|
1433 |
+
'application/provenance+xml',
|
1434 |
+
'application/prs.alvestrand.titrax-sheet',
|
1435 |
+
'application/prs.cww',
|
1436 |
+
'application/prs.hpub+zip',
|
1437 |
+
'application/prs.nprend',
|
1438 |
+
'application/prs.plucker',
|
1439 |
+
'application/prs.rdf-xml-crypt',
|
1440 |
+
'application/prs.xsf+xml',
|
1441 |
+
'application/pskc+xml',
|
1442 |
+
'application/rdf+xml',
|
1443 |
+
'application/QSIG',
|
1444 |
+
'application/raptorfec',
|
1445 |
+
'application/reginfo+xml',
|
1446 |
+
'application/relax-ng-compact-syntax',
|
1447 |
+
'application/remote-printing',
|
1448 |
+
'application/resource-lists-diff+xml',
|
1449 |
+
'application/resource-lists+xml',
|
1450 |
+
'application/riscos',
|
1451 |
+
'application/rlmi+xml',
|
1452 |
+
'application/rls-services+xml',
|
1453 |
+
'application/rpki-ghostbusters',
|
1454 |
+
'application/rpki-manifest',
|
1455 |
+
'application/rpki-roa',
|
1456 |
+
'application/rpki-updown',
|
1457 |
+
'application/rtf',
|
1458 |
+
'application/rtploopback',
|
1459 |
+
'application/rtx',
|
1460 |
+
'application/samlassertion+xml',
|
1461 |
+
'application/samlmetadata+xml',
|
1462 |
+
'application/sbml+xml',
|
1463 |
+
'application/scaip+xml',
|
1464 |
+
'application/scvp-cv-request',
|
1465 |
+
'application/scvp-cv-response',
|
1466 |
+
'application/scvp-vp-request',
|
1467 |
+
'application/scvp-vp-response',
|
1468 |
+
'application/sdp',
|
1469 |
+
'application/sep-exi',
|
1470 |
+
'application/sep+xml',
|
1471 |
+
'application/session-info',
|
1472 |
+
'application/set-payment',
|
1473 |
+
'application/set-payment-initiation',
|
1474 |
+
'application/set-registration',
|
1475 |
+
'application/set-registration-initiation',
|
1476 |
+
'application/SGML',
|
1477 |
+
'application/sgml-open-catalog',
|
1478 |
+
'application/shf+xml',
|
1479 |
+
'application/sieve',
|
1480 |
+
'application/simple-filter+xml',
|
1481 |
+
'application/simple-message-summary',
|
1482 |
+
'application/simpleSymbolContainer',
|
1483 |
+
'application/slate',
|
1484 |
+
'application/smil',
|
1485 |
+
'application/smil+xml',
|
1486 |
+
'application/smpte336m',
|
1487 |
+
'application/soap+fastinfoset',
|
1488 |
+
'application/soap+xml',
|
1489 |
+
'application/spirits-event+xml',
|
1490 |
+
'application/sql',
|
1491 |
+
'application/srgs',
|
1492 |
+
'application/srgs+xml',
|
1493 |
+
'application/sru+xml',
|
1494 |
+
'application/ssml+xml',
|
1495 |
+
'application/tamp-apex-update',
|
1496 |
+
'application/tamp-apex-update-confirm',
|
1497 |
+
'application/tamp-community-update',
|
1498 |
+
'application/tamp-community-update-confirm',
|
1499 |
+
'application/tamp-error',
|
1500 |
+
'application/tamp-sequence-adjust',
|
1501 |
+
'application/tamp-sequence-adjust-confirm',
|
1502 |
+
'application/tamp-status-query',
|
1503 |
+
'application/tamp-status-response',
|
1504 |
+
'application/tamp-update',
|
1505 |
+
'application/tamp-update-confirm',
|
1506 |
+
'application/tei+xml',
|
1507 |
+
'application/thraud+xml',
|
1508 |
+
'application/timestamp-query',
|
1509 |
+
'application/timestamp-reply',
|
1510 |
+
'application/timestamped-data',
|
1511 |
+
'application/ttml+xml',
|
1512 |
+
'application/tve-trigger',
|
1513 |
+
'application/ulpfec',
|
1514 |
+
'application/urc-grpsheet+xml',
|
1515 |
+
'application/urc-ressheet+xml',
|
1516 |
+
'application/urc-targetdesc+xml',
|
1517 |
+
'application/urc-uisocketdesc+xml',
|
1518 |
+
'application/vcard+xml',
|
1519 |
+
'application/vemmi',
|
1520 |
+
'application/vnd.3gpp.bsf+xml',
|
1521 |
+
'application/vnd.3gpp.pic-bw-large',
|
1522 |
+
'application/vnd.3gpp.pic-bw-small',
|
1523 |
+
'application/vnd.3gpp.pic-bw-var',
|
1524 |
+
'application/vnd.3gpp.sms',
|
1525 |
+
'application/vnd.3gpp2.bcmcsinfo+xml',
|
1526 |
+
'application/vnd.3gpp2.sms',
|
1527 |
+
'application/vnd.3gpp2.tcap',
|
1528 |
+
'application/vnd.3M.Post-it-Notes',
|
1529 |
+
'application/vnd.accpac.simply.aso',
|
1530 |
+
'application/vnd.accpac.simply.imp',
|
1531 |
+
'application/vnd-acucobol',
|
1532 |
+
'application/vnd.acucorp',
|
1533 |
+
'application/vnd.adobe.flash-movie',
|
1534 |
+
'application/vnd.adobe.formscentral.fcdt',
|
1535 |
+
'application/vnd.adobe.fxp',
|
1536 |
+
'application/vnd.adobe.partial-upload',
|
1537 |
+
'application/vnd.adobe.xdp+xml',
|
1538 |
+
'application/vnd.adobe.xfdf',
|
1539 |
+
'application/vnd.aether.imp',
|
1540 |
+
'application/vnd.ah-barcode',
|
1541 |
+
'application/vnd.ahead.space',
|
1542 |
+
'application/vnd.airzip.filesecure.azf',
|
1543 |
+
'application/vnd.airzip.filesecure.azs',
|
1544 |
+
'application/vnd.americandynamics.acc',
|
1545 |
+
'application/vnd.amiga.ami',
|
1546 |
+
'application/vnd.amundsen.maze+xml',
|
1547 |
+
'application/vnd.anser-web-certificate-issue-initiation',
|
1548 |
+
'application/vnd.antix.game-component',
|
1549 |
+
'application/vnd.apache.thrift.binary',
|
1550 |
+
'application/vnd.apache.thrift.compact',
|
1551 |
+
'application/vnd.apple.mpegurl',
|
1552 |
+
'application/vnd.apple.installer+xml',
|
1553 |
+
'application/vnd.arastra.swi',
|
1554 |
+
'application/vnd.aristanetworks.swi',
|
1555 |
+
'application/vnd.artsquare',
|
1556 |
+
'application/vnd.astraea-software.iota',
|
1557 |
+
'application/vnd.audiograph',
|
1558 |
+
'application/vnd.autopackage',
|
1559 |
+
'application/vnd.avistar+xml',
|
1560 |
+
'application/vnd.balsamiq.bmml+xml',
|
1561 |
+
'application/vnd.blueice.multipass',
|
1562 |
+
'application/vnd.bluetooth.ep.oob',
|
1563 |
+
'application/vnd.bluetooth.le.oob',
|
1564 |
+
'application/vnd.bmi',
|
1565 |
+
'application/vnd.businessobjects',
|
1566 |
+
'application/vnd.cab-jscript',
|
1567 |
+
'application/vnd.canon-cpdl',
|
1568 |
+
'application/vnd.canon-lips',
|
1569 |
+
'application/vnd.cendio.thinlinc.clientconf',
|
1570 |
+
'application/vnd.century-systems.tcp_stream',
|
1571 |
+
'application/vnd.chemdraw+xml',
|
1572 |
+
'application/vnd.chipnuts.karaoke-mmd',
|
1573 |
+
'application/vnd.cinderella',
|
1574 |
+
'application/vnd.cirpack.isdn-ext',
|
1575 |
+
'application/vnd.citationstyles.style+xml',
|
1576 |
+
'application/vnd.claymore',
|
1577 |
+
'application/vnd.cloanto.rp9',
|
1578 |
+
'application/vnd.clonk.c4group',
|
1579 |
+
'application/vnd.cluetrust.cartomobile-config',
|
1580 |
+
'application/vnd.cluetrust.cartomobile-config-pkg',
|
1581 |
+
'application/vnd.coffeescript',
|
1582 |
+
'application/vnd.commerce-battelle',
|
1583 |
+
'application/vnd.commonspace',
|
1584 |
+
'application/vnd.cosmocaller',
|
1585 |
+
'application/vnd.contact.cmsg',
|
1586 |
+
'application/vnd.crick.clicker',
|
1587 |
+
'application/vnd.crick.clicker.keyboard',
|
1588 |
+
'application/vnd.crick.clicker.palette',
|
1589 |
+
'application/vnd.crick.clicker.template',
|
1590 |
+
'application/vnd.crick.clicker.wordbank',
|
1591 |
+
'application/vnd.criticaltools.wbs+xml',
|
1592 |
+
'application/vnd.ctc-posml',
|
1593 |
+
'application/vnd.ctct.ws+xml',
|
1594 |
+
'application/vnd.cups-pdf',
|
1595 |
+
'application/vnd.cups-postscript',
|
1596 |
+
'application/vnd.cups-ppd',
|
1597 |
+
'application/vnd.cups-raster',
|
1598 |
+
'application/vnd.cups-raw',
|
1599 |
+
'application/vnd-curl',
|
1600 |
+
'application/vnd.cyan.dean.root+xml',
|
1601 |
+
'application/vnd.cybank',
|
1602 |
+
'application/vnd-dart',
|
1603 |
+
'application/vnd.data-vision.rdz',
|
1604 |
+
'application/vnd.debian.binary-package',
|
1605 |
+
'application/vnd.dece.data',
|
1606 |
+
'application/vnd.dece.ttml+xml',
|
1607 |
+
'application/vnd.dece.unspecified',
|
1608 |
+
'application/vnd.dece-zip',
|
1609 |
+
'application/vnd.denovo.fcselayout-link',
|
1610 |
+
'application/vnd.desmume-movie',
|
1611 |
+
'application/vnd.dir-bi.plate-dl-nosuffix',
|
1612 |
+
'application/vnd.dm.delegation+xml',
|
1613 |
+
'application/vnd.dna',
|
1614 |
+
'application/vnd.dolby.mobile.1',
|
1615 |
+
'application/vnd.dolby.mobile.2',
|
1616 |
+
'application/vnd.doremir.scorecloud-binary-document',
|
1617 |
+
'application/vnd.dpgraph',
|
1618 |
+
'application/vnd.dreamfactory',
|
1619 |
+
'application/vnd.dtg.local',
|
1620 |
+
'application/vnd.dtg.local.flash',
|
1621 |
+
'application/vnd.dtg.local.html',
|
1622 |
+
'application/vnd.dvb.ait',
|
1623 |
+
'application/vnd.dvb.dvbj',
|
1624 |
+
'application/vnd.dvb.esgcontainer',
|
1625 |
+
'application/vnd.dvb.ipdcdftnotifaccess',
|
1626 |
+
'application/vnd.dvb.ipdcesgaccess',
|
1627 |
+
'application/vnd.dvb.ipdcesgaccess2',
|
1628 |
+
'application/vnd.dvb.ipdcesgpdd',
|
1629 |
+
'application/vnd.dvb.ipdcroaming',
|
1630 |
+
'application/vnd.dvb.iptv.alfec-base',
|
1631 |
+
'application/vnd.dvb.iptv.alfec-enhancement',
|
1632 |
+
'application/vnd.dvb.notif-aggregate-root+xml',
|
1633 |
+
'application/vnd.dvb.notif-container+xml',
|
1634 |
+
'application/vnd.dvb.notif-generic+xml',
|
1635 |
+
'application/vnd.dvb.notif-ia-msglist+xml',
|
1636 |
+
'application/vnd.dvb.notif-ia-registration-request+xml',
|
1637 |
+
'application/vnd.dvb.notif-ia-registration-response+xml',
|
1638 |
+
'application/vnd.dvb.notif-init+xml',
|
1639 |
+
'application/vnd.dvb.pfr',
|
1640 |
+
'application/vnd.dvb_service',
|
1641 |
+
'application/vnd-dxr',
|
1642 |
+
'application/vnd.dynageo',
|
1643 |
+
'application/vnd.dzr',
|
1644 |
+
'application/vnd.easykaraoke.cdgdownload',
|
1645 |
+
'application/vnd.ecdis-update',
|
1646 |
+
'application/vnd.ecowin.chart',
|
1647 |
+
'application/vnd.ecowin.filerequest',
|
1648 |
+
'application/vnd.ecowin.fileupdate',
|
1649 |
+
'application/vnd.ecowin.series',
|
1650 |
+
'application/vnd.ecowin.seriesrequest',
|
1651 |
+
'application/vnd.ecowin.seriesupdate',
|
1652 |
+
'application/vnd.emclient.accessrequest+xml',
|
1653 |
+
'application/vnd.enliven',
|
1654 |
+
'application/vnd.enphase.envoy',
|
1655 |
+
'application/vnd.eprints.data+xml',
|
1656 |
+
'application/vnd.epson.esf',
|
1657 |
+
'application/vnd.epson.msf',
|
1658 |
+
'application/vnd.epson.quickanime',
|
1659 |
+
'application/vnd.epson.salt',
|
1660 |
+
'application/vnd.epson.ssf',
|
1661 |
+
'application/vnd.ericsson.quickcall',
|
1662 |
+
'application/vnd.eszigno3+xml',
|
1663 |
+
'application/vnd.etsi.aoc+xml',
|
1664 |
+
'application/vnd.etsi.asic-s+zip',
|
1665 |
+
'application/vnd.etsi.asic-e+zip',
|
1666 |
+
'application/vnd.etsi.cug+xml',
|
1667 |
+
'application/vnd.etsi.iptvcommand+xml',
|
1668 |
+
'application/vnd.etsi.iptvdiscovery+xml',
|
1669 |
+
'application/vnd.etsi.iptvprofile+xml',
|
1670 |
+
'application/vnd.etsi.iptvsad-bc+xml',
|
1671 |
+
'application/vnd.etsi.iptvsad-cod+xml',
|
1672 |
+
'application/vnd.etsi.iptvsad-npvr+xml',
|
1673 |
+
'application/vnd.etsi.iptvservice+xml',
|
1674 |
+
'application/vnd.etsi.iptvsync+xml',
|
1675 |
+
'application/vnd.etsi.iptvueprofile+xml',
|
1676 |
+
'application/vnd.etsi.mcid+xml',
|
1677 |
+
'application/vnd.etsi.mheg5',
|
1678 |
+
'application/vnd.etsi.overload-control-policy-dataset+xml',
|
1679 |
+
'application/vnd.etsi.pstn+xml',
|
1680 |
+
'application/vnd.etsi.sci+xml',
|
1681 |
+
'application/vnd.etsi.simservs+xml',
|
1682 |
+
'application/vnd.etsi.timestamp-token',
|
1683 |
+
'application/vnd.etsi.tsl+xml',
|
1684 |
+
'application/vnd.etsi.tsl.der',
|
1685 |
+
'application/vnd.eudora.data',
|
1686 |
+
'application/vnd.ezpix-album',
|
1687 |
+
'application/vnd.ezpix-package',
|
1688 |
+
'application/vnd.f-secure.mobile',
|
1689 |
+
'application/vnd.fastcopy-disk-image',
|
1690 |
+
'application/vnd-fdf',
|
1691 |
+
'application/vnd.fdsn.mseed',
|
1692 |
+
'application/vnd.fdsn.seed',
|
1693 |
+
'application/vnd.ffsns',
|
1694 |
+
'application/vnd.fints',
|
1695 |
+
'application/vnd.FloGraphIt',
|
1696 |
+
'application/vnd.fluxtime.clip',
|
1697 |
+
'application/vnd.font-fontforge-sfd',
|
1698 |
+
'application/vnd.framemaker',
|
1699 |
+
'application/vnd.frogans.fnc',
|
1700 |
+
'application/vnd.frogans.ltf',
|
1701 |
+
'application/vnd.fsc.weblaunch',
|
1702 |
+
'application/vnd.fujitsu.oasys',
|
1703 |
+
'application/vnd.fujitsu.oasys2',
|
1704 |
+
'application/vnd.fujitsu.oasys3',
|
1705 |
+
'application/vnd.fujitsu.oasysgp',
|
1706 |
+
'application/vnd.fujitsu.oasysprs',
|
1707 |
+
'application/vnd.fujixerox.ART4',
|
1708 |
+
'application/vnd.fujixerox.ART-EX',
|
1709 |
+
'application/vnd.fujixerox.ddd',
|
1710 |
+
'application/vnd.fujixerox.docuworks',
|
1711 |
+
'application/vnd.fujixerox.docuworks.binder',
|
1712 |
+
'application/vnd.fujixerox.docuworks.container',
|
1713 |
+
'application/vnd.fujixerox.HBPL',
|
1714 |
+
'application/vnd.fut-misnet',
|
1715 |
+
'application/vnd.fuzzysheet',
|
1716 |
+
'application/vnd.genomatix.tuxedo',
|
1717 |
+
'application/vnd.geocube+xml',
|
1718 |
+
'application/vnd.geogebra.file',
|
1719 |
+
'application/vnd.geogebra.tool',
|
1720 |
+
'application/vnd.geometry-explorer',
|
1721 |
+
'application/vnd.geonext',
|
1722 |
+
'application/vnd.geoplan',
|
1723 |
+
'application/vnd.geospace',
|
1724 |
+
'application/vnd.gerber',
|
1725 |
+
'application/vnd.globalplatform.card-content-mgt',
|
1726 |
+
'application/vnd.globalplatform.card-content-mgt-response',
|
1727 |
+
'application/vnd.gmx',
|
1728 |
+
'application/vnd.google-earth.kml+xml',
|
1729 |
+
'application/vnd.google-earth.kmz',
|
1730 |
+
'application/vnd.gov.sk.e-form+xml',
|
1731 |
+
'application/vnd.gov.sk.e-form+zip',
|
1732 |
+
'application/vnd.gov.sk.xmldatacontainer+xml',
|
1733 |
+
'application/vnd.grafeq',
|
1734 |
+
'application/vnd.gridmp',
|
1735 |
+
'application/vnd.groove-account',
|
1736 |
+
'application/vnd.groove-help',
|
1737 |
+
'application/vnd.groove-identity-message',
|
1738 |
+
'application/vnd.groove-injector',
|
1739 |
+
'application/vnd.groove-tool-message',
|
1740 |
+
'application/vnd.groove-tool-template',
|
1741 |
+
'application/vnd.groove-vcard',
|
1742 |
+
'application/vnd.hal+xml',
|
1743 |
+
'application/vnd.HandHeld-Entertainment+xml',
|
1744 |
+
'application/vnd.hbci',
|
1745 |
+
'application/vnd.hcl-bireports',
|
1746 |
+
'application/vnd.hhe.lesson-player',
|
1747 |
+
'application/vnd.hp-HPGL',
|
1748 |
+
'application/vnd.hp-hpid',
|
1749 |
+
'application/vnd.hp-hps',
|
1750 |
+
'application/vnd.hp-jlyt',
|
1751 |
+
'application/vnd.hp-PCL',
|
1752 |
+
'application/vnd.hp-PCLXL',
|
1753 |
+
'application/vnd.httphone',
|
1754 |
+
'application/vnd.hydrostatix.sof-data',
|
1755 |
+
'application/vnd.hzn-3d-crossword',
|
1756 |
+
'application/vnd.ibm.afplinedata',
|
1757 |
+
'application/vnd.ibm.electronic-media',
|
1758 |
+
'application/vnd.ibm.MiniPay',
|
1759 |
+
'application/vnd.ibm.modcap',
|
1760 |
+
'application/vnd.ibm.rights-management',
|
1761 |
+
'application/vnd.ibm.secure-container',
|
1762 |
+
'application/vnd.iccprofile',
|
1763 |
+
'application/vnd.ieee.1905',
|
1764 |
+
'application/vnd.igloader',
|
1765 |
+
'application/vnd.immervision-ivp',
|
1766 |
+
'application/vnd.immervision-ivu',
|
1767 |
+
'application/vnd.ims.imsccv1p1',
|
1768 |
+
'application/vnd.ims.imsccv1p2',
|
1769 |
+
'application/vnd.ims.imsccv1p3',
|
1770 |
+
'application/vnd.informedcontrol.rms+xml',
|
1771 |
+
'application/vnd.infotech.project',
|
1772 |
+
'application/vnd.infotech.project+xml',
|
1773 |
+
'application/vnd.informix-visionary',
|
1774 |
+
'application/vnd.innopath.wamp.notification',
|
1775 |
+
'application/vnd.insors.igm',
|
1776 |
+
'application/vnd.intercon.formnet',
|
1777 |
+
'application/vnd.intergeo',
|
1778 |
+
'application/vnd.intertrust.digibox',
|
1779 |
+
'application/vnd.intertrust.nncp',
|
1780 |
+
'application/vnd.intu.qbo',
|
1781 |
+
'application/vnd.intu.qfx',
|
1782 |
+
'application/vnd.iptc.g2.catalogitem+xml',
|
1783 |
+
'application/vnd.iptc.g2.conceptitem+xml',
|
1784 |
+
'application/vnd.iptc.g2.knowledgeitem+xml',
|
1785 |
+
'application/vnd.iptc.g2.newsitem+xml',
|
1786 |
+
'application/vnd.iptc.g2.newsmessage+xml',
|
1787 |
+
'application/vnd.iptc.g2.packageitem+xml',
|
1788 |
+
'application/vnd.iptc.g2.planningitem+xml',
|
1789 |
+
'application/vnd.ipunplugged.rcprofile',
|
1790 |
+
'application/vnd.irepository.package+xml',
|
1791 |
+
'application/vnd.is-xpr',
|
1792 |
+
'application/vnd.isac.fcs',
|
1793 |
+
'application/vnd.jam',
|
1794 |
+
'application/vnd.japannet-directory-service',
|
1795 |
+
'application/vnd.japannet-jpnstore-wakeup',
|
1796 |
+
'application/vnd.japannet-payment-wakeup',
|
1797 |
+
'application/vnd.japannet-registration',
|
1798 |
+
'application/vnd.japannet-registration-wakeup',
|
1799 |
+
'application/vnd.japannet-setstore-wakeup',
|
1800 |
+
'application/vnd.japannet-verification',
|
1801 |
+
'application/vnd.japannet-verification-wakeup',
|
1802 |
+
'application/vnd.jcp.javame.midlet-rms',
|
1803 |
+
'application/vnd.jisp',
|
1804 |
+
'application/vnd.joost.joda-archive',
|
1805 |
+
'application/vnd.jsk.isdn-ngn',
|
1806 |
+
'application/vnd.kahootz',
|
1807 |
+
'application/vnd.kde.karbon',
|
1808 |
+
'application/vnd.kde.kchart',
|
1809 |
+
'application/vnd.kde.kformula',
|
1810 |
+
'application/vnd.kde.kivio',
|
1811 |
+
'application/vnd.kde.kontour',
|
1812 |
+
'application/vnd.kde.kpresenter',
|
1813 |
+
'application/vnd.kde.kspread',
|
1814 |
+
'application/vnd.kde.kword',
|
1815 |
+
'application/vnd.kenameaapp',
|
1816 |
+
'application/vnd.kidspiration',
|
1817 |
+
'application/vnd.Kinar',
|
1818 |
+
'application/vnd.koan',
|
1819 |
+
'application/vnd.kodak-descriptor',
|
1820 |
+
'application/vnd.las.las+xml',
|
1821 |
+
'application/vnd.liberty-request+xml',
|
1822 |
+
'application/vnd.llamagraphics.life-balance.desktop',
|
1823 |
+
'application/vnd.llamagraphics.life-balance.exchange+xml',
|
1824 |
+
'application/vnd.lotus-1-2-3',
|
1825 |
+
'application/vnd.lotus-approach',
|
1826 |
+
'application/vnd.lotus-freelance',
|
1827 |
+
'application/vnd.lotus-notes',
|
1828 |
+
'application/vnd.lotus-organizer',
|
1829 |
+
'application/vnd.lotus-screencam',
|
1830 |
+
'application/vnd.lotus-wordpro',
|
1831 |
+
'application/vnd.macports.portpkg',
|
1832 |
+
'application/vnd.marlin.drm.actiontoken+xml',
|
1833 |
+
'application/vnd.marlin.drm.conftoken+xml',
|
1834 |
+
'application/vnd.marlin.drm.license+xml',
|
1835 |
+
'application/vnd.marlin.drm.mdcf',
|
1836 |
+
'application/vnd.maxmind.maxmind-db',
|
1837 |
+
'application/vnd.mcd',
|
1838 |
+
'application/vnd.medcalcdata',
|
1839 |
+
'application/vnd.mediastation.cdkey',
|
1840 |
+
'application/vnd.meridian-slingshot',
|
1841 |
+
'application/vnd.MFER',
|
1842 |
+
'application/vnd.mfmp',
|
1843 |
+
'application/vnd.micrografx.flo',
|
1844 |
+
'application/vnd.micrografx-igx',
|
1845 |
+
'application/vnd.microsoft.portable-executable',
|
1846 |
+
'application/vnd-mif',
|
1847 |
+
'application/vnd.minisoft-hp3000-save',
|
1848 |
+
'application/vnd.mitsubishi.misty-guard.trustweb',
|
1849 |
+
'application/vnd.Mobius.DAF',
|
1850 |
+
'application/vnd.Mobius.DIS',
|
1851 |
+
'application/vnd.Mobius.MBK',
|
1852 |
+
'application/vnd.Mobius.MQY',
|
1853 |
+
'application/vnd.Mobius.MSL',
|
1854 |
+
'application/vnd.Mobius.PLC',
|
1855 |
+
'application/vnd.Mobius.TXF',
|
1856 |
+
'application/vnd.mophun.application',
|
1857 |
+
'application/vnd.mophun.certificate',
|
1858 |
+
'application/vnd.motorola.flexsuite',
|
1859 |
+
'application/vnd.motorola.flexsuite.adsi',
|
1860 |
+
'application/vnd.motorola.flexsuite.fis',
|
1861 |
+
'application/vnd.motorola.flexsuite.gotap',
|
1862 |
+
'application/vnd.motorola.flexsuite.kmr',
|
1863 |
+
'application/vnd.motorola.flexsuite.ttc',
|
1864 |
+
'application/vnd.motorola.flexsuite.wem',
|
1865 |
+
'application/vnd.motorola.iprm',
|
1866 |
+
'application/vnd.mozilla.xul+xml',
|
1867 |
+
'application/vnd.ms-artgalry',
|
1868 |
+
'application/vnd.ms-asf',
|
1869 |
+
'application/vnd.ms-cab-compressed',
|
1870 |
+
'application/vnd.ms-3mfdocument',
|
1871 |
+
'application/vnd.ms-excel',
|
1872 |
+
'application/vnd.ms-excel.addin.macroEnabled.12',
|
1873 |
+
'application/vnd.ms-excel.sheet.binary.macroEnabled.12',
|
1874 |
+
'application/vnd.ms-excel.sheet.macroEnabled.12',
|
1875 |
+
'application/vnd.ms-excel.template.macroEnabled.12',
|
1876 |
+
'application/vnd.ms-fontobject',
|
1877 |
+
'application/vnd.ms-htmlhelp',
|
1878 |
+
'application/vnd.ms-ims',
|
1879 |
+
'application/vnd.ms-lrm',
|
1880 |
+
'application/vnd.ms-office.activeX+xml',
|
1881 |
+
'application/vnd.ms-officetheme',
|
1882 |
+
'application/vnd.ms-playready.initiator+xml',
|
1883 |
+
'application/vnd.ms-powerpoint',
|
1884 |
+
'application/vnd.ms-powerpoint.addin.macroEnabled.12',
|
1885 |
+
'application/vnd.ms-powerpoint.presentation.macroEnabled.12',
|
1886 |
+
'application/vnd.ms-powerpoint.slide.macroEnabled.12',
|
1887 |
+
'application/vnd.ms-powerpoint.slideshow.macroEnabled.12',
|
1888 |
+
'application/vnd.ms-powerpoint.template.macroEnabled.12',
|
1889 |
+
'application/vnd.ms-project',
|
1890 |
+
'application/vnd.ms-tnef',
|
1891 |
+
'application/vnd.ms-windows.printerpairing',
|
1892 |
+
'application/vnd.ms-wmdrm.lic-chlg-req',
|
1893 |
+
'application/vnd.ms-wmdrm.lic-resp',
|
1894 |
+
'application/vnd.ms-wmdrm.meter-chlg-req',
|
1895 |
+
'application/vnd.ms-wmdrm.meter-resp',
|
1896 |
+
'application/vnd.ms-word.document.macroEnabled.12',
|
1897 |
+
'application/vnd.ms-word.template.macroEnabled.12',
|
1898 |
+
'application/vnd.ms-works',
|
1899 |
+
'application/vnd.ms-wpl',
|
1900 |
+
'application/vnd.ms-xpsdocument',
|
1901 |
+
'application/vnd.msa-disk-image',
|
1902 |
+
'application/vnd.mseq',
|
1903 |
+
'application/vnd.msign',
|
1904 |
+
'application/vnd.multiad.creator',
|
1905 |
+
'application/vnd.multiad.creator.cif',
|
1906 |
+
'application/vnd.musician',
|
1907 |
+
'application/vnd.music-niff',
|
1908 |
+
'application/vnd.muvee.style',
|
1909 |
+
'application/vnd.mynfc',
|
1910 |
+
'application/vnd.ncd.control',
|
1911 |
+
'application/vnd.ncd.reference',
|
1912 |
+
'application/vnd.nervana',
|
1913 |
+
'application/vnd.netfpx',
|
1914 |
+
'application/vnd.neurolanguage.nlu',
|
1915 |
+
'application/vnd.nintendo.snes.rom',
|
1916 |
+
'application/vnd.nintendo.nitro.rom',
|
1917 |
+
'application/vnd.nitf',
|
1918 |
+
'application/vnd.noblenet-directory',
|
1919 |
+
'application/vnd.noblenet-sealer',
|
1920 |
+
'application/vnd.noblenet-web',
|
1921 |
+
'application/vnd.nokia.catalogs',
|
1922 |
+
'application/vnd.nokia.conml+wbxml',
|
1923 |
+
'application/vnd.nokia.conml+xml',
|
1924 |
+
'application/vnd.nokia.iptv.config+xml',
|
1925 |
+
'application/vnd.nokia.iSDS-radio-presets',
|
1926 |
+
'application/vnd.nokia.landmark+wbxml',
|
1927 |
+
'application/vnd.nokia.landmark+xml',
|
1928 |
+
'application/vnd.nokia.landmarkcollection+xml',
|
1929 |
+
'application/vnd.nokia.ncd',
|
1930 |
+
'application/vnd.nokia.n-gage.ac+xml',
|
1931 |
+
'application/vnd.nokia.n-gage.data',
|
1932 |
+
'application/vnd.nokia.n-gage.symbian.install',
|
1933 |
+
'application/vnd.nokia.pcd+wbxml',
|
1934 |
+
'application/vnd.nokia.pcd+xml',
|
1935 |
+
'application/vnd.nokia.radio-preset',
|
1936 |
+
'application/vnd.nokia.radio-presets',
|
1937 |
+
'application/vnd.novadigm.EDM',
|
1938 |
+
'application/vnd.novadigm.EDX',
|
1939 |
+
'application/vnd.novadigm.EXT',
|
1940 |
+
'application/vnd.ntt-local.content-share',
|
1941 |
+
'application/vnd.ntt-local.file-transfer',
|
1942 |
+
'application/vnd.ntt-local.ogw_remote-access',
|
1943 |
+
'application/vnd.ntt-local.sip-ta_remote',
|
1944 |
+
'application/vnd.ntt-local.sip-ta_tcp_stream',
|
1945 |
+
'application/vnd.oasis.opendocument.chart',
|
1946 |
+
'application/vnd.oasis.opendocument.chart-template',
|
1947 |
+
'application/vnd.oasis.opendocument.database',
|
1948 |
+
'application/vnd.oasis.opendocument.formula',
|
1949 |
+
'application/vnd.oasis.opendocument.formula-template',
|
1950 |
+
'application/vnd.oasis.opendocument.graphics',
|
1951 |
+
'application/vnd.oasis.opendocument.graphics-template',
|
1952 |
+
'application/vnd.oasis.opendocument.image',
|
1953 |
+
'application/vnd.oasis.opendocument.image-template',
|
1954 |
+
'application/vnd.oasis.opendocument.presentation',
|
1955 |
+
'application/vnd.oasis.opendocument.presentation-template',
|
1956 |
+
'application/vnd.oasis.opendocument.spreadsheet',
|
1957 |
+
'application/vnd.oasis.opendocument.spreadsheet-template',
|
1958 |
+
'application/vnd.oasis.opendocument.text',
|
1959 |
+
'application/vnd.oasis.opendocument.text-master',
|
1960 |
+
'application/vnd.oasis.opendocument.text-template',
|
1961 |
+
'application/vnd.oasis.opendocument.text-web',
|
1962 |
+
'application/vnd.obn',
|
1963 |
+
'application/vnd.oipf.contentaccessdownload+xml',
|
1964 |
+
'application/vnd.oipf.contentaccessstreaming+xml',
|
1965 |
+
'application/vnd.oipf.cspg-hexbinary',
|
1966 |
+
'application/vnd.oipf.dae.svg+xml',
|
1967 |
+
'application/vnd.oipf.dae.xhtml+xml',
|
1968 |
+
'application/vnd.oipf.mippvcontrolmessage+xml',
|
1969 |
+
'application/vnd.oipf.pae.gem',
|
1970 |
+
'application/vnd.oipf.spdiscovery+xml',
|
1971 |
+
'application/vnd.oipf.spdlist+xml',
|
1972 |
+
'application/vnd.oipf.ueprofile+xml',
|
1973 |
+
'application/vnd.oipf.userprofile+xml',
|
1974 |
+
'application/vnd.olpc-sugar',
|
1975 |
+
'application/vnd.oma.bcast.associated-procedure-parameter+xml',
|
1976 |
+
'application/vnd.oma.bcast.drm-trigger+xml',
|
1977 |
+
'application/vnd.oma.bcast.imd+xml',
|
1978 |
+
'application/vnd.oma.bcast.ltkm',
|
1979 |
+
'application/vnd.oma.bcast.notification+xml',
|
1980 |
+
'application/vnd.oma.bcast.provisioningtrigger',
|
1981 |
+
'application/vnd.oma.bcast.sgboot',
|
1982 |
+
'application/vnd.oma.bcast.sgdd+xml',
|
1983 |
+
'application/vnd.oma.bcast.sgdu',
|
1984 |
+
'application/vnd.oma.bcast.simple-symbol-container',
|
1985 |
+
'application/vnd.oma.bcast.smartcard-trigger+xml',
|
1986 |
+
'application/vnd.oma.bcast.sprov+xml',
|
1987 |
+
'application/vnd.oma.bcast.stkm',
|
1988 |
+
'application/vnd.oma.cab-address-book+xml',
|
1989 |
+
'application/vnd.oma.cab-feature-handler+xml',
|
1990 |
+
'application/vnd.oma.cab-pcc+xml',
|
1991 |
+
'application/vnd.oma.cab-subs-invite+xml',
|
1992 |
+
'application/vnd.oma.cab-user-prefs+xml',
|
1993 |
+
'application/vnd.oma.dcd',
|
1994 |
+
'application/vnd.oma.dcdc',
|
1995 |
+
'application/vnd.oma.dd2+xml',
|
1996 |
+
'application/vnd.oma.drm.risd+xml',
|
1997 |
+
'application/vnd.oma.group-usage-list+xml',
|
1998 |
+
'application/vnd.oma.pal+xml',
|
1999 |
+
'application/vnd.oma.poc.detailed-progress-report+xml',
|
2000 |
+
'application/vnd.oma.poc.final-report+xml',
|
2001 |
+
'application/vnd.oma.poc.groups+xml',
|
2002 |
+
'application/vnd.oma.poc.invocation-descriptor+xml',
|
2003 |
+
'application/vnd.oma.poc.optimized-progress-report+xml',
|
2004 |
+
'application/vnd.oma.push',
|
2005 |
+
'application/vnd.oma.scidm.messages+xml',
|
2006 |
+
'application/vnd.oma.xcap-directory+xml',
|
2007 |
+
'application/vnd.omads-email+xml',
|
2008 |
+
'application/vnd.omads-file+xml',
|
2009 |
+
'application/vnd.omads-folder+xml',
|
2010 |
+
'application/vnd.omaloc-supl-init',
|
2011 |
+
'application/vnd.oma-scws-config',
|
2012 |
+
'application/vnd.oma-scws-http-request',
|
2013 |
+
'application/vnd.oma-scws-http-response',
|
2014 |
+
'application/vnd.openeye.oeb',
|
2015 |
+
'application/vnd.openxmlformats-officedocument.custom-properties+xml',
|
2016 |
+
'application/vnd.openxmlformats-officedocument.customXmlProperties+xml',
|
2017 |
+
'application/vnd.openxmlformats-officedocument.drawing+xml',
|
2018 |
+
'application/vnd.openxmlformats-officedocument.drawingml.chart+xml',
|
2019 |
+
'application/vnd.openxmlformats-officedocument.drawingml.chartshapes+xml',
|
2020 |
+
'application/vnd.openxmlformats-officedocument.drawingml.diagramColors+xml',
|
2021 |
+
'application/vnd.openxmlformats-officedocument.drawingml.diagramData+xml',
|
2022 |
+
'application/vnd.openxmlformats-officedocument.drawingml.diagramLayout+xml',
|
2023 |
+
'application/vnd.openxmlformats-officedocument.drawingml.diagramStyle+xml',
|
2024 |
+
'application/vnd.openxmlformats-officedocument.extended-properties+xml',
|
2025 |
+
'application/vnd.openxmlformats-officedocument.presentationml.commentAuthors+xml',
|
2026 |
+
'application/vnd.openxmlformats-officedocument.presentationml.comments+xml',
|
2027 |
+
'application/vnd.openxmlformats-officedocument.presentationml.handoutMaster+xml',
|
2028 |
+
'application/vnd.openxmlformats-officedocument.presentationml.notesMaster+xml',
|
2029 |
+
'application/vnd.openxmlformats-officedocument.presentationml.notesSlide+xml',
|
2030 |
+
'application/vnd.openxmlformats-officedocument.presentationml.presentation',
|
2031 |
+
'application/vnd.openxmlformats-officedocument.presentationml.presentation.main+xml',
|
2032 |
+
'application/vnd.openxmlformats-officedocument.presentationml.presProps+xml',
|
2033 |
+
'application/vnd.openxmlformats-officedocument.presentationml.slide',
|
2034 |
+
'application/vnd.openxmlformats-officedocument.presentationml.slide+xml',
|
2035 |
+
'application/vnd.openxmlformats-officedocument.presentationml.slideLayout+xml',
|
2036 |
+
'application/vnd.openxmlformats-officedocument.presentationml.slideMaster+xml',
|
2037 |
+
'application/vnd.openxmlformats-officedocument.presentationml.slideshow',
|
2038 |
+
'application/vnd.openxmlformats-officedocument.presentationml.slideshow.main+xml',
|
2039 |
+
'application/vnd.openxmlformats-officedocument.presentationml.slideUpdateInfo+xml',
|
2040 |
+
'application/vnd.openxmlformats-officedocument.presentationml.tableStyles+xml',
|
2041 |
+
'application/vnd.openxmlformats-officedocument.presentationml.tags+xml',
|
2042 |
+
'application/vnd.openxmlformats-officedocument.presentationml-template',
|
2043 |
+
'application/vnd.openxmlformats-officedocument.presentationml.template.main+xml',
|
2044 |
+
'application/vnd.openxmlformats-officedocument.presentationml.viewProps+xml',
|
2045 |
+
'application/vnd.openxmlformats-officedocument.spreadsheetml.calcChain+xml',
|
2046 |
+
'application/vnd.openxmlformats-officedocument.spreadsheetml.chartsheet+xml',
|
2047 |
+
'application/vnd.openxmlformats-officedocument.spreadsheetml.comments+xml',
|
2048 |
+
'application/vnd.openxmlformats-officedocument.spreadsheetml.connections+xml',
|
2049 |
+
'application/vnd.openxmlformats-officedocument.spreadsheetml.dialogsheet+xml',
|
2050 |
+
'application/vnd.openxmlformats-officedocument.spreadsheetml.externalLink+xml',
|
2051 |
+
'application/vnd.openxmlformats-officedocument.spreadsheetml.pivotCacheDefinition+xml',
|
2052 |
+
'application/vnd.openxmlformats-officedocument.spreadsheetml.pivotCacheRecords+xml',
|
2053 |
+
'application/vnd.openxmlformats-officedocument.spreadsheetml.pivotTable+xml',
|
2054 |
+
'application/vnd.openxmlformats-officedocument.spreadsheetml.queryTable+xml',
|
2055 |
+
'application/vnd.openxmlformats-officedocument.spreadsheetml.revisionHeaders+xml',
|
2056 |
+
'application/vnd.openxmlformats-officedocument.spreadsheetml.revisionLog+xml',
|
2057 |
+
'application/vnd.openxmlformats-officedocument.spreadsheetml.sharedStrings+xml',
|
2058 |
+
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
|
2059 |
+
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml',
|
2060 |
+
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheetMetadata+xml',
|
2061 |
+
'application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml',
|
2062 |
+
'application/vnd.openxmlformats-officedocument.spreadsheetml.table+xml',
|
2063 |
+
'application/vnd.openxmlformats-officedocument.spreadsheetml.tableSingleCells+xml',
|
2064 |
+
'application/vnd.openxmlformats-officedocument.spreadsheetml-template',
|
2065 |
+
'application/vnd.openxmlformats-officedocument.spreadsheetml.template.main+xml',
|
2066 |
+
'application/vnd.openxmlformats-officedocument.spreadsheetml.userNames+xml',
|
2067 |
+
'application/vnd.openxmlformats-officedocument.spreadsheetml.volatileDependencies+xml',
|
2068 |
+
'application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml',
|
2069 |
+
'application/vnd.openxmlformats-officedocument.theme+xml',
|
2070 |
+
'application/vnd.openxmlformats-officedocument.themeOverride+xml',
|
2071 |
+
'application/vnd.openxmlformats-officedocument.vmlDrawing',
|
2072 |
+
'application/vnd.openxmlformats-officedocument.wordprocessingml.comments+xml',
|
2073 |
+
'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
|
2074 |
+
'application/vnd.openxmlformats-officedocument.wordprocessingml.document.glossary+xml',
|
2075 |
+
'application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml',
|
2076 |
+
'application/vnd.openxmlformats-officedocument.wordprocessingml.endnotes+xml',
|
2077 |
+
'application/vnd.openxmlformats-officedocument.wordprocessingml.fontTable+xml',
|
2078 |
+
'application/vnd.openxmlformats-officedocument.wordprocessingml.footer+xml',
|
2079 |
+
'application/vnd.openxmlformats-officedocument.wordprocessingml.footnotes+xml',
|
2080 |
+
'application/vnd.openxmlformats-officedocument.wordprocessingml.numbering+xml',
|
2081 |
+
'application/vnd.openxmlformats-officedocument.wordprocessingml.settings+xml',
|
2082 |
+
'application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml',
|
2083 |
+
'application/vnd.openxmlformats-officedocument.wordprocessingml-template',
|
2084 |
+
'application/vnd.openxmlformats-officedocument.wordprocessingml.template.main+xml',
|
2085 |
+
'application/vnd.openxmlformats-officedocument.wordprocessingml.webSettings+xml',
|
2086 |
+
'application/vnd.openxmlformats-package.core-properties+xml',
|
2087 |
+
'application/vnd.openxmlformats-package.digital-signature-xmlsignature+xml',
|
2088 |
+
'application/vnd.openxmlformats-package.relationships+xml',
|
2089 |
+
'application/vnd.orange.indata',
|
2090 |
+
'application/vnd.osa.netdeploy',
|
2091 |
+
'application/vnd.osgeo.mapguide.package',
|
2092 |
+
'application/vnd.osgi.bundle',
|
2093 |
+
'application/vnd.osgi.dp',
|
2094 |
+
'application/vnd.osgi.subsystem',
|
2095 |
+
'application/vnd.otps.ct-kip+xml',
|
2096 |
+
'application/vnd.palm',
|
2097 |
+
'application/vnd.panoply',
|
2098 |
+
'application/vnd.paos+xml',
|
2099 |
+
'application/vnd.pawaafile',
|
2100 |
+
'application/vnd.pcos',
|
2101 |
+
'application/vnd.pg.format',
|
2102 |
+
'application/vnd.pg.osasli',
|
2103 |
+
'application/vnd.piaccess.application-licence',
|
2104 |
+
'application/vnd.picsel',
|
2105 |
+
'application/vnd.pmi.widget',
|
2106 |
+
'application/vnd.poc.group-advertisement+xml',
|
2107 |
+
'application/vnd.pocketlearn',
|
2108 |
+
'application/vnd.powerbuilder6',
|
2109 |
+
'application/vnd.powerbuilder6-s',
|
2110 |
+
'application/vnd.powerbuilder7',
|
2111 |
+
'application/vnd.powerbuilder75',
|
2112 |
+
'application/vnd.powerbuilder75-s',
|
2113 |
+
'application/vnd.powerbuilder7-s',
|
2114 |
+
'application/vnd.preminet',
|
2115 |
+
'application/vnd.previewsystems.box',
|
2116 |
+
'application/vnd.proteus.magazine',
|
2117 |
+
'application/vnd.publishare-delta-tree',
|
2118 |
+
'application/vnd.pvi.ptid1',
|
2119 |
+
'application/vwg-multiplexed',
|
2120 |
+
'application/vnd.pwg-xhtml-print+xml',
|
2121 |
+
'application/vnd.qualcomm.brew-app-res',
|
2122 |
+
'application/vnd.Quark.QuarkXPress',
|
2123 |
+
'application/vnd.quobject-quoxdocument',
|
2124 |
+
'application/vnd.radisys.moml+xml',
|
2125 |
+
'application/vnd.radisys.msml-audit-conf+xml',
|
2126 |
+
'application/vnd.radisys.msml-audit-conn+xml',
|
2127 |
+
'application/vnd.radisys.msml-audit-dialog+xml',
|
2128 |
+
'application/vnd.radisys.msml-audit-stream+xml',
|
2129 |
+
'application/vnd.radisys.msml-audit+xml',
|
2130 |
+
'application/vnd.radisys.msml-conf+xml',
|
2131 |
+
'application/vnd.radisys.msml-dialog-base+xml',
|
2132 |
+
'application/vnd.radisys.msml-dialog-fax-detect+xml',
|
2133 |
+
'application/vnd.radisys.msml-dialog-fax-sendrecv+xml',
|
2134 |
+
'application/vnd.radisys.msml-dialog-group+xml',
|
2135 |
+
'application/vnd.radisys.msml-dialog-speech+xml',
|
2136 |
+
'application/vnd.radisys.msml-dialog-transform+xml',
|
2137 |
+
'application/vnd.radisys.msml-dialog+xml',
|
2138 |
+
'application/vnd.radisys.msml+xml',
|
2139 |
+
'application/vnd.rainstor.data',
|
2140 |
+
'application/vnd.rapid',
|
2141 |
+
'application/vnd.realvnc.bed',
|
2142 |
+
'application/vnd.recordare.musicxml',
|
2143 |
+
'application/vnd.recordare.musicxml+xml',
|
2144 |
+
'application/vnd.renlearn.rlprint',
|
2145 |
+
'application/vnd.rig.cryptonote',
|
2146 |
+
'application/vnd.route66.link66+xml',
|
2147 |
+
'application/vnd.rs-274x',
|
2148 |
+
'application/vnd.ruckus.download',
|
2149 |
+
'application/vnd.s3sms',
|
2150 |
+
'application/vnd.sailingtracker.track',
|
2151 |
+
'application/vnd.sbm.cid',
|
2152 |
+
'application/vnd.sbm.mid2',
|
2153 |
+
'application/vnd.scribus',
|
2154 |
+
'application/vnd.sealed.3df',
|
2155 |
+
'application/vnd.sealed.csf',
|
2156 |
+
'application/vnd.sealed-doc',
|
2157 |
+
'application/vnd.sealed-eml',
|
2158 |
+
'application/vnd.sealed-mht',
|
2159 |
+
'application/vnd.sealed.net',
|
2160 |
+
'application/vnd.sealed-ppt',
|
2161 |
+
'application/vnd.sealed-tiff',
|
2162 |
+
'application/vnd.sealed-xls',
|
2163 |
+
'application/vnd.sealedmedia.softseal-html',
|
2164 |
+
'application/vnd.sealedmedia.softseal-pdf',
|
2165 |
+
'application/vnd.seemail',
|
2166 |
+
'application/vnd-sema',
|
2167 |
+
'application/vnd.semd',
|
2168 |
+
'application/vnd.semf',
|
2169 |
+
'application/vnd.shana.informed.formdata',
|
2170 |
+
'application/vnd.shana.informed.formtemplate',
|
2171 |
+
'application/vnd.shana.informed.interchange',
|
2172 |
+
'application/vnd.shana.informed.package',
|
2173 |
+
'application/vnd.SimTech-MindMapper',
|
2174 |
+
'application/vnd.smaf',
|
2175 |
+
'application/vnd.smart.notebook',
|
2176 |
+
'application/vnd.smart.teacher',
|
2177 |
+
'application/vnd.software602.filler.form+xml',
|
2178 |
+
'application/vnd.software602.filler.form-xml-zip',
|
2179 |
+
'application/vnd.solent.sdkm+xml',
|
2180 |
+
'application/vnd.spotfire.dxp',
|
2181 |
+
'application/vnd.spotfire.sfs',
|
2182 |
+
'application/vnd.sss-cod',
|
2183 |
+
'application/vnd.sss-dtf',
|
2184 |
+
'application/vnd.sss-ntf',
|
2185 |
+
'application/vnd.stepmania.package',
|
2186 |
+
'application/vnd.stepmania.stepchart',
|
2187 |
+
'application/vnd.street-stream',
|
2188 |
+
'application/vnd.sun.wadl+xml',
|
2189 |
+
'application/vnd.sus-calendar',
|
2190 |
+
'application/vnd.svd',
|
2191 |
+
'application/vnd.swiftview-ics',
|
2192 |
+
'application/vnd.syncml.dm.notification',
|
2193 |
+
'application/vnd.syncml.dmddf+xml',
|
2194 |
+
'application/vnd.syncml.dmtnds+wbxml',
|
2195 |
+
'application/vnd.syncml.dmtnds+xml',
|
2196 |
+
'application/vnd.syncml.dmddf+wbxml',
|
2197 |
+
'application/vnd.syncml.dm+wbxml',
|
2198 |
+
'application/vnd.syncml.dm+xml',
|
2199 |
+
'application/vnd.syncml.ds.notification',
|
2200 |
+
'application/vnd.syncml+xml',
|
2201 |
+
'application/vnd.tao.intent-module-archive',
|
2202 |
+
'application/vnd.tcpdump.pcap',
|
2203 |
+
'application/vnd.tmd.mediaflex.api+xml',
|
2204 |
+
'application/vnd.tmobile-livetv',
|
2205 |
+
'application/vnd.trid.tpt',
|
2206 |
+
'application/vnd.triscape.mxs',
|
2207 |
+
'application/vnd.trueapp',
|
2208 |
+
'application/vnd.truedoc',
|
2209 |
+
'application/vnd.ubisoft.webplayer',
|
2210 |
+
'application/vnd.ufdl',
|
2211 |
+
'application/vnd.uiq.theme',
|
2212 |
+
'application/vnd.umajin',
|
2213 |
+
'application/vnd.unity',
|
2214 |
+
'application/vnd.uoml+xml',
|
2215 |
+
'application/vnd.uplanet.alert',
|
2216 |
+
'application/vnd.uplanet.alert-wbxml',
|
2217 |
+
'application/vnd.uplanet.bearer-choice',
|
2218 |
+
'application/vnd.uplanet.bearer-choice-wbxml',
|
2219 |
+
'application/vnd.uplanet.cacheop',
|
2220 |
+
'application/vnd.uplanet.cacheop-wbxml',
|
2221 |
+
'application/vnd.uplanet.channel',
|
2222 |
+
'application/vnd.uplanet.channel-wbxml',
|
2223 |
+
'application/vnd.uplanet.list',
|
2224 |
+
'application/vnd.uplanet.listcmd',
|
2225 |
+
'application/vnd.uplanet.listcmd-wbxml',
|
2226 |
+
'application/vnd.uplanet.list-wbxml',
|
2227 |
+
'application/vnd.uplanet.signal',
|
2228 |
+
'application/vnd.valve.source.material',
|
2229 |
+
'application/vnd.vcx',
|
2230 |
+
'application/vnd.vd-study',
|
2231 |
+
'application/vnd.vectorworks',
|
2232 |
+
'application/vnd.verimatrix.vcas',
|
2233 |
+
'application/vnd.vidsoft.vidconference',
|
2234 |
+
'application/vnd.visio',
|
2235 |
+
'application/vnd.visionary',
|
2236 |
+
'application/vnd.vividence.scriptfile',
|
2237 |
+
'application/vnd.vsf',
|
2238 |
+
'application/vnd.wap.sic',
|
2239 |
+
'application/vnd.wap-slc',
|
2240 |
+
'application/vnd.wap-wbxml',
|
2241 |
+
'application/vnd-wap-wmlc',
|
2242 |
+
'application/vnd.wap.wmlscriptc',
|
2243 |
+
'application/vnd.webturbo',
|
2244 |
+
'application/vnd.wfa.p2p',
|
2245 |
+
'application/vnd.wfa.wsc',
|
2246 |
+
'application/vnd.windows.devicepairing',
|
2247 |
+
'application/vnd.wmc',
|
2248 |
+
'application/vnd.wmf.bootstrap',
|
2249 |
+
'application/vnd.wolfram.mathematica',
|
2250 |
+
'application/vnd.wolfram.mathematica.package',
|
2251 |
+
'application/vnd.wolfram.player',
|
2252 |
+
'application/vnd.wordperfect',
|
2253 |
+
'application/vnd.wqd',
|
2254 |
+
'application/vnd.wrq-hp3000-labelled',
|
2255 |
+
'application/vnd.wt.stf',
|
2256 |
+
'application/vnd.wv.csp+xml',
|
2257 |
+
'application/vnd.wv.csp+wbxml',
|
2258 |
+
'application/vnd.wv.ssp+xml',
|
2259 |
+
'application/vnd.xara',
|
2260 |
+
'application/vnd.xfdl',
|
2261 |
+
'application/vnd.xfdl.webform',
|
2262 |
+
'application/vnd.xmi+xml',
|
2263 |
+
'application/vnd.xmpie.cpkg',
|
2264 |
+
'application/vnd.xmpie.dpkg',
|
2265 |
+
'application/vnd.xmpie.plan',
|
2266 |
+
'application/vnd.xmpie.ppkg',
|
2267 |
+
'application/vnd.xmpie.xlim',
|
2268 |
+
'application/vnd.yamaha.hv-dic',
|
2269 |
+
'application/vnd.yamaha.hv-script',
|
2270 |
+
'application/vnd.yamaha.hv-voice',
|
2271 |
+
'application/vnd.yamaha.openscoreformat.osfpvg+xml',
|
2272 |
+
'application/vnd.yamaha.openscoreformat',
|
2273 |
+
'application/vnd.yamaha.remote-setup',
|
2274 |
+
'application/vnd.yamaha.smaf-audio',
|
2275 |
+
'application/vnd.yamaha.smaf-phrase',
|
2276 |
+
'application/vnd.yamaha.through-ngn',
|
2277 |
+
'application/vnd.yamaha.tunnel-udpencap',
|
2278 |
+
'application/vnd.yaoweme',
|
2279 |
+
'application/vnd.yellowriver-custom-menu',
|
2280 |
+
'application/vnd.zul',
|
2281 |
+
'application/vnd.zzazz.deck+xml',
|
2282 |
+
'application/voicexml+xml',
|
2283 |
+
'application/vq-rtcpxr',
|
2284 |
+
'application/watcherinfo+xml',
|
2285 |
+
'application/whoispp-query',
|
2286 |
+
'application/whoispp-response',
|
2287 |
+
'application/wita',
|
2288 |
+
'application/wordperfect5.1',
|
2289 |
+
'application/wsdl+xml',
|
2290 |
+
'application/wspolicy+xml',
|
2291 |
+
'application/x-www-form-urlencoded',
|
2292 |
+
'application/x400-bp',
|
2293 |
+
'application/xacml+xml',
|
2294 |
+
'application/xcap-att+xml',
|
2295 |
+
'application/xcap-caps+xml',
|
2296 |
+
'application/xcap-diff+xml',
|
2297 |
+
'application/xcap-el+xml',
|
2298 |
+
'application/xcap-error+xml',
|
2299 |
+
'application/xcap-ns+xml',
|
2300 |
+
'application/xcon-conference-info-diff+xml',
|
2301 |
+
'application/xcon-conference-info+xml',
|
2302 |
+
'application/xenc+xml',
|
2303 |
+
'application/xhtml-voice+xml',
|
2304 |
+
'application/xhtml+xml',
|
2305 |
+
'application/xml',
|
2306 |
+
'application/xml-dtd',
|
2307 |
+
'application/xml-external-parsed-entity',
|
2308 |
+
'application/xml-patch+xml',
|
2309 |
+
'application/xmpp+xml',
|
2310 |
+
'application/xop+xml',
|
2311 |
+
'application/xv+xml',
|
2312 |
+
'application/yang',
|
2313 |
+
'application/yin+xml',
|
2314 |
+
'application/zip',
|
2315 |
+
'application/zlib',
|
2316 |
+
);
|
2317 |
+
|
2318 |
+
foreach ($not_json_content_types as $json_content_type) {
|
2319 |
+
$message = '"' . $json_content_type . '" matches pattern ' . $json_pattern;
|
2320 |
+
$this->assertEquals(0, preg_match($json_pattern, $json_content_type), $message);
|
2321 |
+
}
|
2322 |
+
}
|
2323 |
+
|
2324 |
+
public function testXMLResponse()
|
2325 |
+
{
|
2326 |
+
foreach (array(
|
2327 |
+
'Content-Type',
|
2328 |
+
'content-type',
|
2329 |
+
'CONTENT-TYPE') as $key) {
|
2330 |
+
foreach (array(
|
2331 |
+
'application/atom+xml; charset=UTF-8',
|
2332 |
+
'application/atom+xml;charset=UTF-8',
|
2333 |
+
'application/rss+xml',
|
2334 |
+
'application/rss+xml; charset=utf-8',
|
2335 |
+
'application/rss+xml;charset=utf-8',
|
2336 |
+
'application/xml',
|
2337 |
+
'application/xml; charset=utf-8',
|
2338 |
+
'application/xml;charset=utf-8',
|
2339 |
+
'text/xml',
|
2340 |
+
'text/xml; charset=utf-8',
|
2341 |
+
'text/xml;charset=utf-8',
|
2342 |
+
) as $value) {
|
2343 |
+
$test = new Test();
|
2344 |
+
$test->server('xml_response', 'POST', array(
|
2345 |
+
'key' => $key,
|
2346 |
+
'value' => $value,
|
2347 |
+
));
|
2348 |
+
|
2349 |
+
$this->assertInstanceOf('SimpleXMLElement', $test->curl->response);
|
2350 |
+
|
2351 |
+
$doc = new DOMDocument();
|
2352 |
+
$doc->formatOutput = true;
|
2353 |
+
$rss = $doc->appendChild($doc->createElement('rss'));
|
2354 |
+
$rss->setAttribute('version', '2.0');
|
2355 |
+
$channel = $doc->createElement('channel');
|
2356 |
+
$title = $doc->createElement('title');
|
2357 |
+
$title->appendChild($doc->createTextNode('Title'));
|
2358 |
+
$channel->appendChild($title);
|
2359 |
+
$link = $doc->createElement('link');
|
2360 |
+
$link->appendChild($doc->createTextNode('Link'));
|
2361 |
+
$channel->appendChild($link);
|
2362 |
+
$description = $doc->createElement('description');
|
2363 |
+
$description->appendChild($doc->createTextNode('Description'));
|
2364 |
+
$channel->appendChild($description);
|
2365 |
+
$rss->appendChild($channel);
|
2366 |
+
$xml = $doc->saveXML();
|
2367 |
+
$this->assertEquals($xml, $test->curl->rawResponse);
|
2368 |
+
}
|
2369 |
+
}
|
2370 |
+
}
|
2371 |
+
|
2372 |
+
public function testEmptyResponse()
|
2373 |
+
{
|
2374 |
+
$response = "\r\n\r\n";
|
2375 |
+
|
2376 |
+
$reflector = new ReflectionClass('\Curl\Curl');
|
2377 |
+
$reflection_method = $reflector->getMethod('parseResponseHeaders');
|
2378 |
+
$reflection_method->setAccessible(true);
|
2379 |
+
|
2380 |
+
$curl = new Curl();
|
2381 |
+
$reflection_method->invoke($curl, $response);
|
2382 |
+
}
|
2383 |
+
|
2384 |
+
public function testArrayToStringConversion()
|
2385 |
+
{
|
2386 |
+
$test = new Test();
|
2387 |
+
$test->server('post', 'POST', array(
|
2388 |
+
'foo' => 'bar',
|
2389 |
+
'baz' => array(
|
2390 |
+
),
|
2391 |
+
));
|
2392 |
+
$this->assertEquals('foo=bar&baz=', $test->curl->response);
|
2393 |
+
|
2394 |
+
$test = new Test();
|
2395 |
+
$test->server('post', 'POST', array(
|
2396 |
+
'foo' => 'bar',
|
2397 |
+
'baz' => array(
|
2398 |
+
'qux' => array(
|
2399 |
+
),
|
2400 |
+
),
|
2401 |
+
));
|
2402 |
+
$this->assertEquals('foo=bar&baz[qux]=', urldecode($test->curl->response));
|
2403 |
+
|
2404 |
+
$test = new Test();
|
2405 |
+
$test->server('post', 'POST', array(
|
2406 |
+
'foo' => 'bar',
|
2407 |
+
'baz' => array(
|
2408 |
+
'qux' => array(
|
2409 |
+
),
|
2410 |
+
'wibble' => 'wobble',
|
2411 |
+
),
|
2412 |
+
));
|
2413 |
+
$this->assertEquals('foo=bar&baz[qux]=&baz[wibble]=wobble', urldecode($test->curl->response));
|
2414 |
+
}
|
2415 |
+
|
2416 |
+
public function testSuccessCallback()
|
2417 |
+
{
|
2418 |
+
$before_send_called = false;
|
2419 |
+
$success_called = false;
|
2420 |
+
$error_called = false;
|
2421 |
+
$complete_called = false;
|
2422 |
+
|
2423 |
+
$test = new Test();
|
2424 |
+
$curl = $test->curl;
|
2425 |
+
$curl->setHeader('X-DEBUG-TEST', 'get');
|
2426 |
+
$curl->beforeSend(function ($instance) use (
|
2427 |
+
&$before_send_called, &$success_called, &$error_called, &$complete_called) {
|
2428 |
+
PHPUnit_Framework_Assert::assertInstanceOf('Curl\Curl', $instance);
|
2429 |
+
PHPUnit_Framework_Assert::assertFalse($before_send_called);
|
2430 |
+
PHPUnit_Framework_Assert::assertFalse($success_called);
|
2431 |
+
PHPUnit_Framework_Assert::assertFalse($error_called);
|
2432 |
+
PHPUnit_Framework_Assert::assertFalse($complete_called);
|
2433 |
+
$before_send_called = true;
|
2434 |
+
});
|
2435 |
+
$curl->success(function ($instance) use (
|
2436 |
+
&$before_send_called, &$success_called, &$error_called, &$complete_called) {
|
2437 |
+
PHPUnit_Framework_Assert::assertInstanceOf('Curl\Curl', $instance);
|
2438 |
+
PHPUnit_Framework_Assert::assertTrue($before_send_called);
|
2439 |
+
PHPUnit_Framework_Assert::assertFalse($success_called);
|
2440 |
+
PHPUnit_Framework_Assert::assertFalse($error_called);
|
2441 |
+
PHPUnit_Framework_Assert::assertFalse($complete_called);
|
2442 |
+
$success_called = true;
|
2443 |
+
});
|
2444 |
+
$curl->error(function ($instance) use (
|
2445 |
+
&$before_send_called, &$success_called, &$error_called, &$complete_called) {
|
2446 |
+
$error_called = true;
|
2447 |
+
});
|
2448 |
+
$curl->complete(function ($instance) use (
|
2449 |
+
&$before_send_called, &$success_called, &$error_called, &$complete_called) {
|
2450 |
+
PHPUnit_Framework_Assert::assertInstanceOf('Curl\Curl', $instance);
|
2451 |
+
PHPUnit_Framework_Assert::assertTrue($before_send_called);
|
2452 |
+
PHPUnit_Framework_Assert::assertTrue($success_called);
|
2453 |
+
PHPUnit_Framework_Assert::assertFalse($error_called);
|
2454 |
+
PHPUnit_Framework_Assert::assertFalse($complete_called);
|
2455 |
+
$complete_called = true;
|
2456 |
+
});
|
2457 |
+
|
2458 |
+
$curl->get(Test::TEST_URL);
|
2459 |
+
|
2460 |
+
$this->assertTrue($before_send_called);
|
2461 |
+
$this->assertTrue($success_called);
|
2462 |
+
$this->assertFalse($error_called);
|
2463 |
+
$this->assertTrue($complete_called);
|
2464 |
+
}
|
2465 |
+
|
2466 |
+
public function testErrorCallback()
|
2467 |
+
{
|
2468 |
+
$before_send_called = false;
|
2469 |
+
$success_called = false;
|
2470 |
+
$error_called = false;
|
2471 |
+
$complete_called = false;
|
2472 |
+
|
2473 |
+
$test = new Test();
|
2474 |
+
$curl = $test->curl;
|
2475 |
+
$curl->setHeader('X-DEBUG-TEST', 'get');
|
2476 |
+
$curl->setOpt(CURLOPT_CONNECTTIMEOUT_MS, 2000);
|
2477 |
+
$curl->beforeSend(function ($instance) use (
|
2478 |
+
&$before_send_called, &$success_called, &$error_called, &$complete_called) {
|
2479 |
+
PHPUnit_Framework_Assert::assertInstanceOf('Curl\Curl', $instance);
|
2480 |
+
PHPUnit_Framework_Assert::assertFalse($before_send_called);
|
2481 |
+
PHPUnit_Framework_Assert::assertFalse($success_called);
|
2482 |
+
PHPUnit_Framework_Assert::assertFalse($error_called);
|
2483 |
+
PHPUnit_Framework_Assert::assertFalse($complete_called);
|
2484 |
+
$before_send_called = true;
|
2485 |
+
});
|
2486 |
+
$curl->success(function ($instance) use (
|
2487 |
+
&$before_send_called, &$success_called, &$error_called, &$complete_called) {
|
2488 |
+
$success_called = true;
|
2489 |
+
});
|
2490 |
+
$curl->error(function ($instance) use (
|
2491 |
+
&$before_send_called, &$success_called, &$error_called, &$complete_called) {
|
2492 |
+
PHPUnit_Framework_Assert::assertInstanceOf('Curl\Curl', $instance);
|
2493 |
+
PHPUnit_Framework_Assert::assertTrue($before_send_called);
|
2494 |
+
PHPUnit_Framework_Assert::assertFalse($success_called);
|
2495 |
+
PHPUnit_Framework_Assert::assertFalse($error_called);
|
2496 |
+
PHPUnit_Framework_Assert::assertFalse($complete_called);
|
2497 |
+
$error_called = true;
|
2498 |
+
});
|
2499 |
+
$curl->complete(function ($instance) use (
|
2500 |
+
&$before_send_called, &$success_called, &$error_called, &$complete_called) {
|
2501 |
+
PHPUnit_Framework_Assert::assertInstanceOf('Curl\Curl', $instance);
|
2502 |
+
PHPUnit_Framework_Assert::assertTrue($before_send_called);
|
2503 |
+
PHPUnit_Framework_Assert::assertFalse($success_called);
|
2504 |
+
PHPUnit_Framework_Assert::assertTrue($error_called);
|
2505 |
+
PHPUnit_Framework_Assert::assertFalse($complete_called);
|
2506 |
+
$complete_called = true;
|
2507 |
+
});
|
2508 |
+
|
2509 |
+
$curl->get(Test::ERROR_URL);
|
2510 |
+
|
2511 |
+
$this->assertTrue($before_send_called);
|
2512 |
+
$this->assertFalse($success_called);
|
2513 |
+
$this->assertTrue($error_called);
|
2514 |
+
$this->assertTrue($complete_called);
|
2515 |
+
}
|
2516 |
+
|
2517 |
+
public function testClose()
|
2518 |
+
{
|
2519 |
+
$test = new Test();
|
2520 |
+
$curl = $test->curl;
|
2521 |
+
$curl->setHeader('X-DEBUG-TEST', 'post');
|
2522 |
+
$curl->post(Test::TEST_URL);
|
2523 |
+
$this->assertTrue(is_resource($curl->curl));
|
2524 |
+
$curl->close();
|
2525 |
+
$this->assertFalse(is_resource($curl->curl));
|
2526 |
+
}
|
2527 |
+
|
2528 |
+
/**
|
2529 |
+
* @expectedException PHPUnit_Framework_Error_Warning
|
2530 |
+
*/
|
2531 |
+
public function testRequiredOptionCurlOptReturnTransferEmitsWarning()
|
2532 |
+
{
|
2533 |
+
$curl = new Curl();
|
2534 |
+
$curl->setOpt(CURLOPT_RETURNTRANSFER, false);
|
2535 |
+
}
|
2536 |
+
|
2537 |
+
public function testRequestMethodSuccessiveGetRequests()
|
2538 |
+
{
|
2539 |
+
$test = new Test();
|
2540 |
+
$test->chain_requests('GET', 'POST');
|
2541 |
+
$test->chain_requests('GET', 'PUT');
|
2542 |
+
$test->chain_requests('GET', 'PATCH');
|
2543 |
+
$test->chain_requests('GET', 'DELETE');
|
2544 |
+
$test->chain_requests('GET', 'HEAD');
|
2545 |
+
$test->chain_requests('GET', 'OPTIONS');
|
2546 |
+
}
|
2547 |
+
|
2548 |
+
public function testRequestMethodSuccessivePostRequests()
|
2549 |
+
{
|
2550 |
+
$test = new Test();
|
2551 |
+
$test->chain_requests('POST', 'GET');
|
2552 |
+
$test->chain_requests('POST', 'PUT');
|
2553 |
+
$test->chain_requests('POST', 'PATCH');
|
2554 |
+
$test->chain_requests('POST', 'DELETE');
|
2555 |
+
$test->chain_requests('POST', 'HEAD');
|
2556 |
+
$test->chain_requests('POST', 'OPTIONS');
|
2557 |
+
}
|
2558 |
+
|
2559 |
+
public function testRequestMethodSuccessivePutRequests()
|
2560 |
+
{
|
2561 |
+
$test = new Test();
|
2562 |
+
$test->chain_requests('PUT', 'GET');
|
2563 |
+
$test->chain_requests('PUT', 'POST');
|
2564 |
+
$test->chain_requests('PUT', 'PATCH');
|
2565 |
+
$test->chain_requests('PUT', 'DELETE');
|
2566 |
+
$test->chain_requests('PUT', 'HEAD');
|
2567 |
+
$test->chain_requests('PUT', 'OPTIONS');
|
2568 |
+
}
|
2569 |
+
|
2570 |
+
public function testRequestMethodSuccessivePatchRequests()
|
2571 |
+
{
|
2572 |
+
$test = new Test();
|
2573 |
+
$test->chain_requests('PATCH', 'GET');
|
2574 |
+
$test->chain_requests('PATCH', 'POST');
|
2575 |
+
$test->chain_requests('PATCH', 'PUT');
|
2576 |
+
$test->chain_requests('PATCH', 'DELETE');
|
2577 |
+
$test->chain_requests('PATCH', 'HEAD');
|
2578 |
+
$test->chain_requests('PATCH', 'OPTIONS');
|
2579 |
+
}
|
2580 |
+
|
2581 |
+
public function testRequestMethodSuccessiveDeleteRequests()
|
2582 |
+
{
|
2583 |
+
$test = new Test();
|
2584 |
+
$test->chain_requests('DELETE', 'GET');
|
2585 |
+
$test->chain_requests('DELETE', 'POST');
|
2586 |
+
$test->chain_requests('DELETE', 'PUT');
|
2587 |
+
$test->chain_requests('DELETE', 'PATCH');
|
2588 |
+
$test->chain_requests('DELETE', 'HEAD');
|
2589 |
+
$test->chain_requests('DELETE', 'OPTIONS');
|
2590 |
+
}
|
2591 |
+
|
2592 |
+
public function testRequestMethodSuccessiveHeadRequests()
|
2593 |
+
{
|
2594 |
+
$test = new Test();
|
2595 |
+
$test->chain_requests('HEAD', 'GET');
|
2596 |
+
$test->chain_requests('HEAD', 'POST');
|
2597 |
+
$test->chain_requests('HEAD', 'PUT');
|
2598 |
+
$test->chain_requests('HEAD', 'PATCH');
|
2599 |
+
$test->chain_requests('HEAD', 'DELETE');
|
2600 |
+
$test->chain_requests('HEAD', 'OPTIONS');
|
2601 |
+
}
|
2602 |
+
|
2603 |
+
public function testRequestMethodSuccessiveOptionsRequests()
|
2604 |
+
{
|
2605 |
+
$test = new Test();
|
2606 |
+
$test->chain_requests('OPTIONS', 'GET');
|
2607 |
+
$test->chain_requests('OPTIONS', 'POST');
|
2608 |
+
$test->chain_requests('OPTIONS', 'PUT');
|
2609 |
+
$test->chain_requests('OPTIONS', 'PATCH');
|
2610 |
+
$test->chain_requests('OPTIONS', 'DELETE');
|
2611 |
+
$test->chain_requests('OPTIONS', 'HEAD');
|
2612 |
+
}
|
2613 |
+
|
2614 |
+
public function testMemoryLeak()
|
2615 |
+
{
|
2616 |
+
// Skip memory leak test failing for PHP 7.
|
2617 |
+
// "Failed asserting that 8192 is less than 1000."
|
2618 |
+
if (getenv('TRAVIS_PHP_VERSION') === '7.0') {
|
2619 |
+
return;
|
2620 |
+
}
|
2621 |
+
|
2622 |
+
ob_start();
|
2623 |
+
echo '[';
|
2624 |
+
for ($i = 0; $i < 10; $i++) {
|
2625 |
+
if ($i >= 1) {
|
2626 |
+
echo ',';
|
2627 |
+
}
|
2628 |
+
echo '{"before":' . memory_get_usage() . ',';
|
2629 |
+
$curl = new Curl();
|
2630 |
+
$curl->close();
|
2631 |
+
echo '"after":' . memory_get_usage() . '}';
|
2632 |
+
sleep(1);
|
2633 |
+
}
|
2634 |
+
echo ']';
|
2635 |
+
$html = ob_get_contents();
|
2636 |
+
ob_end_clean();
|
2637 |
+
$results = json_decode($html, true);
|
2638 |
+
|
2639 |
+
// Ensure memory does not leak excessively after instantiating a new
|
2640 |
+
// Curl instance and cleaning up. Memory diffs in the 2000-6000+ range
|
2641 |
+
// indicate a memory leak.
|
2642 |
+
$max_memory_diff = 1000;
|
2643 |
+
foreach ($results as $i => $result) {
|
2644 |
+
$memory_diff = $result['after'] - $result['before'];;
|
2645 |
+
|
2646 |
+
// Skip the first test to allow memory usage to settle.
|
2647 |
+
if ($i >= 1) {
|
2648 |
+
$this->assertLessThan($max_memory_diff, $memory_diff);
|
2649 |
+
}
|
2650 |
+
}
|
2651 |
+
}
|
2652 |
+
|
2653 |
+
public function testAlternativeStandardErrorOutput()
|
2654 |
+
{
|
2655 |
+
// Skip test on HHVM due to "Segmentation fault".
|
2656 |
+
if (defined('HHVM_VERSION')) {
|
2657 |
+
return;
|
2658 |
+
}
|
2659 |
+
|
2660 |
+
$buffer = fopen('php://memory', 'w+');
|
2661 |
+
|
2662 |
+
$curl = new Curl();
|
2663 |
+
$curl->verbose(true, $buffer);
|
2664 |
+
$curl->post(Test::TEST_URL);
|
2665 |
+
|
2666 |
+
rewind($buffer);
|
2667 |
+
$stderr = stream_get_contents($buffer);
|
2668 |
+
fclose($buffer);
|
2669 |
+
|
2670 |
+
$this->assertNotEmpty($stderr);
|
2671 |
+
}
|
2672 |
+
|
2673 |
+
public function testXMLDecoder()
|
2674 |
+
{
|
2675 |
+
$data = array(
|
2676 |
+
'key' => 'Content-Type',
|
2677 |
+
'value' => 'text/xml',
|
2678 |
+
);
|
2679 |
+
|
2680 |
+
$test = new Test();
|
2681 |
+
$test->server('xml_with_cdata_response', 'POST', $data);
|
2682 |
+
$this->assertFalse(strpos($test->curl->response->saveXML(), '<![CDATA[') === false);
|
2683 |
+
|
2684 |
+
$test = new Test();
|
2685 |
+
$test->curl->setXmlDecoder(function($response) {
|
2686 |
+
return simplexml_load_string($response, 'SimpleXMLElement', LIBXML_NOCDATA);
|
2687 |
+
});
|
2688 |
+
$test->server('xml_with_cdata_response', 'POST', $data);
|
2689 |
+
$this->assertTrue(strpos($test->curl->response->saveXML(), '<![CDATA[') === false);
|
2690 |
+
}
|
2691 |
+
|
2692 |
+
public function testTotalTime()
|
2693 |
+
{
|
2694 |
+
$test = new Test();
|
2695 |
+
$test->server('request_method', 'GET');
|
2696 |
+
$this->assertTrue(is_float($test->curl->totalTime));
|
2697 |
+
}
|
2698 |
+
}
|
app/code/community/Pay/Payment/vendor/php-curl-class/php-curl-class/tests/PHPCurlClass/PHPMultiCurlClassTest.php
ADDED
@@ -0,0 +1,2265 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
use \Curl\MultiCurl;
|
4 |
+
use \Helper\Test;
|
5 |
+
|
6 |
+
class MultiCurlTest extends PHPUnit_Framework_TestCase
|
7 |
+
{
|
8 |
+
public function testMultiCurlCallback()
|
9 |
+
{
|
10 |
+
$delete_before_send_called = false;
|
11 |
+
$delete_success_called = false;
|
12 |
+
$delete_error_called = false;
|
13 |
+
$delete_complete_called = false;
|
14 |
+
|
15 |
+
$download_before_send_called = false;
|
16 |
+
$download_success_called = false;
|
17 |
+
$download_error_called = false;
|
18 |
+
$download_complete_called = false;
|
19 |
+
|
20 |
+
$get_before_send_called = false;
|
21 |
+
$get_success_called = false;
|
22 |
+
$get_error_called = false;
|
23 |
+
$get_complete_called = false;
|
24 |
+
|
25 |
+
$head_before_send_called = false;
|
26 |
+
$head_success_called = false;
|
27 |
+
$head_error_called = false;
|
28 |
+
$head_complete_called = false;
|
29 |
+
|
30 |
+
$options_before_send_called = false;
|
31 |
+
$options_success_called = false;
|
32 |
+
$options_error_called = false;
|
33 |
+
$options_complete_called = false;
|
34 |
+
|
35 |
+
$patch_before_send_called = false;
|
36 |
+
$patch_success_called = false;
|
37 |
+
$patch_error_called = false;
|
38 |
+
$patch_complete_called = false;
|
39 |
+
|
40 |
+
$post_before_send_called = false;
|
41 |
+
$post_success_called = false;
|
42 |
+
$post_error_called = false;
|
43 |
+
$post_complete_called = false;
|
44 |
+
|
45 |
+
$put_before_send_called = false;
|
46 |
+
$put_success_called = false;
|
47 |
+
$put_error_called = false;
|
48 |
+
$put_complete_called = false;
|
49 |
+
|
50 |
+
$multi_curl = new MultiCurl();
|
51 |
+
$multi_curl->beforeSend(function ($instance) use (
|
52 |
+
&$delete_before_send_called, &$delete_success_called, &$delete_error_called, &$delete_complete_called,
|
53 |
+
&$download_before_send_called, &$download_success_called, &$download_error_called,
|
54 |
+
&$download_complete_called,
|
55 |
+
&$get_before_send_called, &$get_success_called, &$get_error_called, &$get_complete_called,
|
56 |
+
&$head_before_send_called, &$head_success_called, &$head_error_called, &$head_complete_called,
|
57 |
+
&$options_before_send_called, &$options_success_called, &$options_error_called, &$options_complete_called,
|
58 |
+
&$patch_before_send_called, &$patch_success_called, &$patch_error_called, &$patch_complete_called,
|
59 |
+
&$post_before_send_called, &$post_success_called, &$post_error_called, &$post_complete_called,
|
60 |
+
&$put_before_send_called, &$put_success_called, &$put_error_called, &$put_complete_called) {
|
61 |
+
PHPUnit_Framework_Assert::assertInstanceOf('Curl\Curl', $instance);
|
62 |
+
$request_method = $instance->getOpt(CURLOPT_CUSTOMREQUEST);
|
63 |
+
if ($request_method === 'DELETE') {
|
64 |
+
PHPUnit_Framework_Assert::assertFalse($delete_before_send_called);
|
65 |
+
PHPUnit_Framework_Assert::assertFalse($delete_success_called);
|
66 |
+
PHPUnit_Framework_Assert::assertFalse($delete_error_called);
|
67 |
+
PHPUnit_Framework_Assert::assertFalse($delete_complete_called);
|
68 |
+
$delete_before_send_called = true;
|
69 |
+
}
|
70 |
+
if (isset($instance->download)) {
|
71 |
+
PHPUnit_Framework_Assert::assertFalse($download_before_send_called);
|
72 |
+
PHPUnit_Framework_Assert::assertFalse($download_success_called);
|
73 |
+
PHPUnit_Framework_Assert::assertFalse($download_error_called);
|
74 |
+
PHPUnit_Framework_Assert::assertFalse($download_complete_called);
|
75 |
+
$download_before_send_called = true;
|
76 |
+
} elseif ($request_method === 'GET') {
|
77 |
+
PHPUnit_Framework_Assert::assertFalse($get_before_send_called);
|
78 |
+
PHPUnit_Framework_Assert::assertFalse($get_success_called);
|
79 |
+
PHPUnit_Framework_Assert::assertFalse($get_error_called);
|
80 |
+
PHPUnit_Framework_Assert::assertFalse($get_complete_called);
|
81 |
+
$get_before_send_called = true;
|
82 |
+
}
|
83 |
+
if ($request_method === 'HEAD') {
|
84 |
+
PHPUnit_Framework_Assert::assertFalse($head_before_send_called);
|
85 |
+
PHPUnit_Framework_Assert::assertFalse($head_success_called);
|
86 |
+
PHPUnit_Framework_Assert::assertFalse($head_error_called);
|
87 |
+
PHPUnit_Framework_Assert::assertFalse($head_complete_called);
|
88 |
+
$head_before_send_called = true;
|
89 |
+
}
|
90 |
+
if ($request_method === 'OPTIONS') {
|
91 |
+
PHPUnit_Framework_Assert::assertFalse($options_before_send_called);
|
92 |
+
PHPUnit_Framework_Assert::assertFalse($options_success_called);
|
93 |
+
PHPUnit_Framework_Assert::assertFalse($options_error_called);
|
94 |
+
PHPUnit_Framework_Assert::assertFalse($options_complete_called);
|
95 |
+
$options_before_send_called = true;
|
96 |
+
}
|
97 |
+
if ($request_method === 'PATCH') {
|
98 |
+
PHPUnit_Framework_Assert::assertFalse($patch_before_send_called);
|
99 |
+
PHPUnit_Framework_Assert::assertFalse($patch_success_called);
|
100 |
+
PHPUnit_Framework_Assert::assertFalse($patch_error_called);
|
101 |
+
PHPUnit_Framework_Assert::assertFalse($patch_complete_called);
|
102 |
+
$patch_before_send_called = true;
|
103 |
+
}
|
104 |
+
if ($request_method === 'POST') {
|
105 |
+
PHPUnit_Framework_Assert::assertFalse($post_before_send_called);
|
106 |
+
PHPUnit_Framework_Assert::assertFalse($post_success_called);
|
107 |
+
PHPUnit_Framework_Assert::assertFalse($post_error_called);
|
108 |
+
PHPUnit_Framework_Assert::assertFalse($post_complete_called);
|
109 |
+
$post_before_send_called = true;
|
110 |
+
}
|
111 |
+
if ($request_method === 'PUT') {
|
112 |
+
PHPUnit_Framework_Assert::assertFalse($put_before_send_called);
|
113 |
+
PHPUnit_Framework_Assert::assertFalse($put_success_called);
|
114 |
+
PHPUnit_Framework_Assert::assertFalse($put_error_called);
|
115 |
+
PHPUnit_Framework_Assert::assertFalse($put_complete_called);
|
116 |
+
$put_before_send_called = true;
|
117 |
+
}
|
118 |
+
});
|
119 |
+
$multi_curl->success(function ($instance) use (
|
120 |
+
&$delete_before_send_called, &$delete_success_called, &$delete_error_called, &$delete_complete_called,
|
121 |
+
&$download_before_send_called, &$download_success_called, &$download_error_called,
|
122 |
+
&$download_complete_called,
|
123 |
+
&$get_before_send_called, &$get_success_called, &$get_error_called, &$get_complete_called,
|
124 |
+
&$head_before_send_called, &$head_success_called, &$head_error_called, &$head_complete_called,
|
125 |
+
&$options_before_send_called, &$options_success_called, &$options_error_called, &$options_complete_called,
|
126 |
+
&$patch_before_send_called, &$patch_success_called, &$patch_error_called, &$patch_complete_called,
|
127 |
+
&$post_before_send_called, &$post_success_called, &$post_error_called, &$post_complete_called,
|
128 |
+
&$put_before_send_called, &$put_success_called, &$put_error_called, &$put_complete_called) {
|
129 |
+
PHPUnit_Framework_Assert::assertInstanceOf('Curl\Curl', $instance);
|
130 |
+
$request_method = $instance->getOpt(CURLOPT_CUSTOMREQUEST);
|
131 |
+
if ($request_method === 'DELETE') {
|
132 |
+
PHPUnit_Framework_Assert::assertTrue($delete_before_send_called);
|
133 |
+
PHPUnit_Framework_Assert::assertFalse($delete_success_called);
|
134 |
+
PHPUnit_Framework_Assert::assertFalse($delete_error_called);
|
135 |
+
PHPUnit_Framework_Assert::assertFalse($delete_complete_called);
|
136 |
+
$delete_success_called = true;
|
137 |
+
}
|
138 |
+
if (isset($instance->download)) {
|
139 |
+
PHPUnit_Framework_Assert::assertTrue($download_before_send_called);
|
140 |
+
PHPUnit_Framework_Assert::assertFalse($download_success_called);
|
141 |
+
PHPUnit_Framework_Assert::assertFalse($download_error_called);
|
142 |
+
PHPUnit_Framework_Assert::assertFalse($download_complete_called);
|
143 |
+
$download_success_called = true;
|
144 |
+
} elseif ($request_method === 'GET') {
|
145 |
+
PHPUnit_Framework_Assert::assertTrue($get_before_send_called);
|
146 |
+
PHPUnit_Framework_Assert::assertFalse($get_success_called);
|
147 |
+
PHPUnit_Framework_Assert::assertFalse($get_error_called);
|
148 |
+
PHPUnit_Framework_Assert::assertFalse($get_complete_called);
|
149 |
+
$get_success_called = true;
|
150 |
+
}
|
151 |
+
if ($request_method === 'HEAD') {
|
152 |
+
PHPUnit_Framework_Assert::assertTrue($head_before_send_called);
|
153 |
+
PHPUnit_Framework_Assert::assertFalse($head_success_called);
|
154 |
+
PHPUnit_Framework_Assert::assertFalse($head_error_called);
|
155 |
+
PHPUnit_Framework_Assert::assertFalse($head_complete_called);
|
156 |
+
$head_success_called = true;
|
157 |
+
}
|
158 |
+
if ($request_method === 'OPTIONS') {
|
159 |
+
PHPUnit_Framework_Assert::assertTrue($options_before_send_called);
|
160 |
+
PHPUnit_Framework_Assert::assertFalse($options_success_called);
|
161 |
+
PHPUnit_Framework_Assert::assertFalse($options_error_called);
|
162 |
+
PHPUnit_Framework_Assert::assertFalse($options_complete_called);
|
163 |
+
$options_success_called = true;
|
164 |
+
}
|
165 |
+
if ($request_method === 'PATCH') {
|
166 |
+
PHPUnit_Framework_Assert::assertTrue($patch_before_send_called);
|
167 |
+
PHPUnit_Framework_Assert::assertFalse($patch_success_called);
|
168 |
+
PHPUnit_Framework_Assert::assertFalse($patch_error_called);
|
169 |
+
PHPUnit_Framework_Assert::assertFalse($patch_complete_called);
|
170 |
+
$patch_success_called = true;
|
171 |
+
}
|
172 |
+
if ($request_method === 'POST') {
|
173 |
+
PHPUnit_Framework_Assert::assertTrue($post_before_send_called);
|
174 |
+
PHPUnit_Framework_Assert::assertFalse($post_success_called);
|
175 |
+
PHPUnit_Framework_Assert::assertFalse($post_error_called);
|
176 |
+
PHPUnit_Framework_Assert::assertFalse($post_complete_called);
|
177 |
+
$post_success_called = true;
|
178 |
+
}
|
179 |
+
if ($request_method === 'PUT') {
|
180 |
+
PHPUnit_Framework_Assert::assertTrue($put_before_send_called);
|
181 |
+
PHPUnit_Framework_Assert::assertFalse($put_success_called);
|
182 |
+
PHPUnit_Framework_Assert::assertFalse($put_error_called);
|
183 |
+
PHPUnit_Framework_Assert::assertFalse($put_complete_called);
|
184 |
+
$put_success_called = true;
|
185 |
+
}
|
186 |
+
});
|
187 |
+
$multi_curl->error(function ($instance) use (
|
188 |
+
&$delete_error_called,
|
189 |
+
&$download_error_called,
|
190 |
+
&$get_error_called,
|
191 |
+
&$head_error_called,
|
192 |
+
&$options_error_called,
|
193 |
+
&$patch_error_called,
|
194 |
+
&$post_error_called,
|
195 |
+
&$put_error_called) {
|
196 |
+
$delete_error_called = true;
|
197 |
+
$download_error_called = true;
|
198 |
+
$get_error_called = true;
|
199 |
+
$head_error_called = true;
|
200 |
+
$options_error_called = true;
|
201 |
+
$patch_error_called = true;
|
202 |
+
$post_error_called = true;
|
203 |
+
$put_error_called = true;
|
204 |
+
});
|
205 |
+
$multi_curl->complete(function ($instance) use (
|
206 |
+
&$delete_before_send_called, &$delete_success_called, &$delete_error_called, &$delete_complete_called,
|
207 |
+
&$download_before_send_called, &$download_success_called, &$download_error_called,
|
208 |
+
&$download_complete_called,
|
209 |
+
&$get_before_send_called, &$get_success_called, &$get_error_called, &$get_complete_called,
|
210 |
+
&$head_before_send_called, &$head_success_called, &$head_error_called, &$head_complete_called,
|
211 |
+
&$options_before_send_called, &$options_success_called, &$options_error_called, &$options_complete_called,
|
212 |
+
&$patch_before_send_called, &$patch_success_called, &$patch_error_called, &$patch_complete_called,
|
213 |
+
&$post_before_send_called, &$post_success_called, &$post_error_called, &$post_complete_called,
|
214 |
+
&$put_before_send_called, &$put_success_called, &$put_error_called, &$put_complete_called) {
|
215 |
+
PHPUnit_Framework_Assert::assertInstanceOf('Curl\Curl', $instance);
|
216 |
+
$request_method = $instance->getOpt(CURLOPT_CUSTOMREQUEST);
|
217 |
+
if ($request_method === 'DELETE') {
|
218 |
+
PHPUnit_Framework_Assert::assertTrue($delete_before_send_called);
|
219 |
+
PHPUnit_Framework_Assert::assertTrue($delete_success_called);
|
220 |
+
PHPUnit_Framework_Assert::assertFalse($delete_error_called);
|
221 |
+
PHPUnit_Framework_Assert::assertFalse($delete_complete_called);
|
222 |
+
$delete_complete_called = true;
|
223 |
+
}
|
224 |
+
if (isset($instance->download)) {
|
225 |
+
PHPUnit_Framework_Assert::assertTrue($download_before_send_called);
|
226 |
+
PHPUnit_Framework_Assert::assertTrue($download_success_called);
|
227 |
+
PHPUnit_Framework_Assert::assertFalse($download_error_called);
|
228 |
+
PHPUnit_Framework_Assert::assertFalse($download_complete_called);
|
229 |
+
$download_complete_called = true;
|
230 |
+
} elseif ($request_method === 'GET') {
|
231 |
+
PHPUnit_Framework_Assert::assertTrue($get_before_send_called);
|
232 |
+
PHPUnit_Framework_Assert::assertTrue($get_success_called);
|
233 |
+
PHPUnit_Framework_Assert::assertFalse($get_error_called);
|
234 |
+
PHPUnit_Framework_Assert::assertFalse($get_complete_called);
|
235 |
+
$get_complete_called = true;
|
236 |
+
}
|
237 |
+
if ($request_method === 'HEAD') {
|
238 |
+
PHPUnit_Framework_Assert::assertTrue($head_before_send_called);
|
239 |
+
PHPUnit_Framework_Assert::assertTrue($head_success_called);
|
240 |
+
PHPUnit_Framework_Assert::assertFalse($head_error_called);
|
241 |
+
PHPUnit_Framework_Assert::assertFalse($head_complete_called);
|
242 |
+
$head_complete_called = true;
|
243 |
+
}
|
244 |
+
if ($request_method === 'OPTIONS') {
|
245 |
+
PHPUnit_Framework_Assert::assertTrue($options_before_send_called);
|
246 |
+
PHPUnit_Framework_Assert::assertTrue($options_success_called);
|
247 |
+
PHPUnit_Framework_Assert::assertFalse($options_error_called);
|
248 |
+
PHPUnit_Framework_Assert::assertFalse($options_complete_called);
|
249 |
+
$options_complete_called = true;
|
250 |
+
}
|
251 |
+
if ($request_method === 'PATCH') {
|
252 |
+
PHPUnit_Framework_Assert::assertTrue($patch_before_send_called);
|
253 |
+
PHPUnit_Framework_Assert::assertTrue($patch_success_called);
|
254 |
+
PHPUnit_Framework_Assert::assertFalse($patch_error_called);
|
255 |
+
PHPUnit_Framework_Assert::assertFalse($patch_complete_called);
|
256 |
+
$patch_complete_called = true;
|
257 |
+
}
|
258 |
+
if ($request_method === 'POST') {
|
259 |
+
PHPUnit_Framework_Assert::assertTrue($post_before_send_called);
|
260 |
+
PHPUnit_Framework_Assert::assertTrue($post_success_called);
|
261 |
+
PHPUnit_Framework_Assert::assertFalse($post_error_called);
|
262 |
+
PHPUnit_Framework_Assert::assertFalse($post_complete_called);
|
263 |
+
$post_complete_called = true;
|
264 |
+
}
|
265 |
+
if ($request_method === 'PUT') {
|
266 |
+
PHPUnit_Framework_Assert::assertTrue($put_before_send_called);
|
267 |
+
PHPUnit_Framework_Assert::assertTrue($put_success_called);
|
268 |
+
PHPUnit_Framework_Assert::assertFalse($put_error_called);
|
269 |
+
PHPUnit_Framework_Assert::assertFalse($put_complete_called);
|
270 |
+
$put_complete_called = true;
|
271 |
+
}
|
272 |
+
});
|
273 |
+
|
274 |
+
$multi_curl->addDelete(Test::TEST_URL);
|
275 |
+
$download_file_path = tempnam('/tmp', 'php-curl-class.');
|
276 |
+
$multi_curl->addDownload(Test::TEST_URL, $download_file_path)->download = true;
|
277 |
+
$multi_curl->addGet(Test::TEST_URL);
|
278 |
+
$multi_curl->addHead(Test::TEST_URL);
|
279 |
+
$multi_curl->addOptions(Test::TEST_URL);
|
280 |
+
$multi_curl->addPatch(Test::TEST_URL);
|
281 |
+
$multi_curl->addPost(Test::TEST_URL);
|
282 |
+
$multi_curl->addPut(Test::TEST_URL);
|
283 |
+
$multi_curl->start();
|
284 |
+
|
285 |
+
$this->assertTrue($delete_before_send_called);
|
286 |
+
$this->assertTrue($delete_success_called);
|
287 |
+
$this->assertFalse($delete_error_called);
|
288 |
+
$this->assertTrue($delete_complete_called);
|
289 |
+
|
290 |
+
$this->assertTrue($download_before_send_called);
|
291 |
+
$this->assertTrue($download_success_called);
|
292 |
+
$this->assertFalse($download_error_called);
|
293 |
+
$this->assertTrue($download_complete_called);
|
294 |
+
$this->assertTrue(unlink($download_file_path));
|
295 |
+
|
296 |
+
$this->assertTrue($get_before_send_called);
|
297 |
+
$this->assertTrue($get_success_called);
|
298 |
+
$this->assertFalse($get_error_called);
|
299 |
+
$this->assertTrue($get_complete_called);
|
300 |
+
|
301 |
+
$this->assertTrue($head_before_send_called);
|
302 |
+
$this->assertTrue($head_success_called);
|
303 |
+
$this->assertFalse($head_error_called);
|
304 |
+
$this->assertTrue($head_complete_called);
|
305 |
+
|
306 |
+
$this->assertTrue($options_before_send_called);
|
307 |
+
$this->assertTrue($options_success_called);
|
308 |
+
$this->assertFalse($options_error_called);
|
309 |
+
$this->assertTrue($options_complete_called);
|
310 |
+
|
311 |
+
$this->assertTrue($patch_before_send_called);
|
312 |
+
$this->assertTrue($patch_success_called);
|
313 |
+
$this->assertFalse($patch_error_called);
|
314 |
+
$this->assertTrue($patch_complete_called);
|
315 |
+
|
316 |
+
$this->assertTrue($post_before_send_called);
|
317 |
+
$this->assertTrue($post_success_called);
|
318 |
+
$this->assertFalse($post_error_called);
|
319 |
+
$this->assertTrue($post_complete_called);
|
320 |
+
|
321 |
+
$this->assertTrue($put_before_send_called);
|
322 |
+
$this->assertTrue($put_success_called);
|
323 |
+
$this->assertFalse($put_error_called);
|
324 |
+
$this->assertTrue($put_complete_called);
|
325 |
+
}
|
326 |
+
|
327 |
+
public function testMultiCurlCallbackError()
|
328 |
+
{
|
329 |
+
$delete_before_send_called = false;
|
330 |
+
$delete_success_called = false;
|
331 |
+
$delete_error_called = false;
|
332 |
+
$delete_complete_called = false;
|
333 |
+
|
334 |
+
$download_before_send_called = false;
|
335 |
+
$download_success_called = false;
|
336 |
+
$download_error_called = false;
|
337 |
+
$download_complete_called = false;
|
338 |
+
|
339 |
+
$get_before_send_called = false;
|
340 |
+
$get_success_called = false;
|
341 |
+
$get_error_called = false;
|
342 |
+
$get_complete_called = false;
|
343 |
+
|
344 |
+
$head_before_send_called = false;
|
345 |
+
$head_success_called = false;
|
346 |
+
$head_error_called = false;
|
347 |
+
$head_complete_called = false;
|
348 |
+
|
349 |
+
$options_before_send_called = false;
|
350 |
+
$options_success_called = false;
|
351 |
+
$options_error_called = false;
|
352 |
+
$options_complete_called = false;
|
353 |
+
|
354 |
+
$patch_before_send_called = false;
|
355 |
+
$patch_success_called = false;
|
356 |
+
$patch_error_called = false;
|
357 |
+
$patch_complete_called = false;
|
358 |
+
|
359 |
+
$post_before_send_called = false;
|
360 |
+
$post_success_called = false;
|
361 |
+
$post_error_called = false;
|
362 |
+
$post_complete_called = false;
|
363 |
+
|
364 |
+
$put_before_send_called = false;
|
365 |
+
$put_success_called = false;
|
366 |
+
$put_error_called = false;
|
367 |
+
$put_complete_called = false;
|
368 |
+
|
369 |
+
$multi_curl = new MultiCurl();
|
370 |
+
$multi_curl->beforeSend(function ($instance) use (
|
371 |
+
&$delete_before_send_called, &$delete_success_called, &$delete_error_called, &$delete_complete_called,
|
372 |
+
&$download_before_send_called, &$download_success_called, &$download_error_called,
|
373 |
+
&$download_complete_called,
|
374 |
+
&$get_before_send_called, &$get_success_called, &$get_error_called, &$get_complete_called,
|
375 |
+
&$head_before_send_called, &$head_success_called, &$head_error_called, &$head_complete_called,
|
376 |
+
&$options_before_send_called, &$options_success_called, &$options_error_called, &$options_complete_called,
|
377 |
+
&$patch_before_send_called, &$patch_success_called, &$patch_error_called, &$patch_complete_called,
|
378 |
+
&$post_before_send_called, &$post_success_called, &$post_error_called, &$post_complete_called,
|
379 |
+
&$put_before_send_called, &$put_success_called, &$put_error_called, &$put_complete_called) {
|
380 |
+
PHPUnit_Framework_Assert::assertInstanceOf('Curl\Curl', $instance);
|
381 |
+
$request_method = $instance->getOpt(CURLOPT_CUSTOMREQUEST);
|
382 |
+
if ($request_method === 'DELETE') {
|
383 |
+
PHPUnit_Framework_Assert::assertFalse($delete_before_send_called);
|
384 |
+
PHPUnit_Framework_Assert::assertFalse($delete_success_called);
|
385 |
+
PHPUnit_Framework_Assert::assertFalse($delete_error_called);
|
386 |
+
PHPUnit_Framework_Assert::assertFalse($delete_complete_called);
|
387 |
+
$delete_before_send_called = true;
|
388 |
+
}
|
389 |
+
if (isset($instance->download)) {
|
390 |
+
PHPUnit_Framework_Assert::assertFalse($download_before_send_called);
|
391 |
+
PHPUnit_Framework_Assert::assertFalse($download_success_called);
|
392 |
+
PHPUnit_Framework_Assert::assertFalse($download_error_called);
|
393 |
+
PHPUnit_Framework_Assert::assertFalse($download_complete_called);
|
394 |
+
$download_before_send_called = true;
|
395 |
+
} elseif ($request_method === 'GET') {
|
396 |
+
PHPUnit_Framework_Assert::assertFalse($get_before_send_called);
|
397 |
+
PHPUnit_Framework_Assert::assertFalse($get_success_called);
|
398 |
+
PHPUnit_Framework_Assert::assertFalse($get_error_called);
|
399 |
+
PHPUnit_Framework_Assert::assertFalse($get_complete_called);
|
400 |
+
$get_before_send_called = true;
|
401 |
+
}
|
402 |
+
if ($request_method === 'HEAD') {
|
403 |
+
PHPUnit_Framework_Assert::assertFalse($head_before_send_called);
|
404 |
+
PHPUnit_Framework_Assert::assertFalse($head_success_called);
|
405 |
+
PHPUnit_Framework_Assert::assertFalse($head_error_called);
|
406 |
+
PHPUnit_Framework_Assert::assertFalse($head_complete_called);
|
407 |
+
$head_before_send_called = true;
|
408 |
+
}
|
409 |
+
if ($request_method === 'OPTIONS') {
|
410 |
+
PHPUnit_Framework_Assert::assertFalse($options_before_send_called);
|
411 |
+
PHPUnit_Framework_Assert::assertFalse($options_success_called);
|
412 |
+
PHPUnit_Framework_Assert::assertFalse($options_error_called);
|
413 |
+
PHPUnit_Framework_Assert::assertFalse($options_complete_called);
|
414 |
+
$options_before_send_called = true;
|
415 |
+
}
|
416 |
+
if ($request_method === 'PATCH') {
|
417 |
+
PHPUnit_Framework_Assert::assertFalse($patch_before_send_called);
|
418 |
+
PHPUnit_Framework_Assert::assertFalse($patch_success_called);
|
419 |
+
PHPUnit_Framework_Assert::assertFalse($patch_error_called);
|
420 |
+
PHPUnit_Framework_Assert::assertFalse($patch_complete_called);
|
421 |
+
$patch_before_send_called = true;
|
422 |
+
}
|
423 |
+
if ($request_method === 'POST') {
|
424 |
+
PHPUnit_Framework_Assert::assertFalse($post_before_send_called);
|
425 |
+
PHPUnit_Framework_Assert::assertFalse($post_success_called);
|
426 |
+
PHPUnit_Framework_Assert::assertFalse($post_error_called);
|
427 |
+
PHPUnit_Framework_Assert::assertFalse($post_complete_called);
|
428 |
+
$post_before_send_called = true;
|
429 |
+
}
|
430 |
+
if ($request_method === 'PUT') {
|
431 |
+
PHPUnit_Framework_Assert::assertFalse($put_before_send_called);
|
432 |
+
PHPUnit_Framework_Assert::assertFalse($put_success_called);
|
433 |
+
PHPUnit_Framework_Assert::assertFalse($put_error_called);
|
434 |
+
PHPUnit_Framework_Assert::assertFalse($put_complete_called);
|
435 |
+
$put_before_send_called = true;
|
436 |
+
}
|
437 |
+
});
|
438 |
+
$multi_curl->success(function ($instance) use (
|
439 |
+
&$delete_success_called,
|
440 |
+
&$download_success_called,
|
441 |
+
&$get_success_called,
|
442 |
+
&$head_success_called,
|
443 |
+
&$options_success_called,
|
444 |
+
&$patch_success_called,
|
445 |
+
&$post_success_called,
|
446 |
+
&$put_success_called) {
|
447 |
+
$delete_success_called = true;
|
448 |
+
$get_success_called = true;
|
449 |
+
$head_success_called = true;
|
450 |
+
$options_success_called = true;
|
451 |
+
$patch_success_called = true;
|
452 |
+
$post_success_called = true;
|
453 |
+
$put_success_called = true;
|
454 |
+
});
|
455 |
+
$multi_curl->error(function ($instance) use (
|
456 |
+
&$delete_before_send_called, &$delete_success_called, &$delete_error_called, &$delete_complete_called,
|
457 |
+
&$download_before_send_called, &$download_success_called, &$download_error_called,
|
458 |
+
&$download_complete_called,
|
459 |
+
&$get_before_send_called, &$get_success_called, &$get_error_called, &$get_complete_called,
|
460 |
+
&$head_before_send_called, &$head_success_called, &$head_error_called, &$head_complete_called,
|
461 |
+
&$options_before_send_called, &$options_success_called, &$options_error_called, &$options_complete_called,
|
462 |
+
&$patch_before_send_called, &$patch_success_called, &$patch_error_called, &$patch_complete_called,
|
463 |
+
&$post_before_send_called, &$post_success_called, &$post_error_called, &$post_complete_called,
|
464 |
+
&$put_before_send_called, &$put_success_called, &$put_error_called, &$put_complete_called) {
|
465 |
+
PHPUnit_Framework_Assert::assertInstanceOf('Curl\Curl', $instance);
|
466 |
+
$request_method = $instance->getOpt(CURLOPT_CUSTOMREQUEST);
|
467 |
+
if ($request_method === 'DELETE') {
|
468 |
+
PHPUnit_Framework_Assert::assertTrue($delete_before_send_called);
|
469 |
+
PHPUnit_Framework_Assert::assertFalse($delete_success_called);
|
470 |
+
PHPUnit_Framework_Assert::assertFalse($delete_error_called);
|
471 |
+
PHPUnit_Framework_Assert::assertFalse($delete_complete_called);
|
472 |
+
$delete_error_called = true;
|
473 |
+
}
|
474 |
+
if (isset($instance->download)) {
|
475 |
+
PHPUnit_Framework_Assert::assertTrue($download_before_send_called);
|
476 |
+
PHPUnit_Framework_Assert::assertFalse($download_success_called);
|
477 |
+
PHPUnit_Framework_Assert::assertFalse($download_error_called);
|
478 |
+
PHPUnit_Framework_Assert::assertFalse($download_complete_called);
|
479 |
+
$download_error_called = true;
|
480 |
+
} elseif ($request_method === 'GET') {
|
481 |
+
PHPUnit_Framework_Assert::assertTrue($get_before_send_called);
|
482 |
+
PHPUnit_Framework_Assert::assertFalse($get_success_called);
|
483 |
+
PHPUnit_Framework_Assert::assertFalse($get_error_called);
|
484 |
+
PHPUnit_Framework_Assert::assertFalse($get_complete_called);
|
485 |
+
$get_error_called = true;
|
486 |
+
}
|
487 |
+
if ($request_method === 'HEAD') {
|
488 |
+
PHPUnit_Framework_Assert::assertTrue($head_before_send_called);
|
489 |
+
PHPUnit_Framework_Assert::assertFalse($head_success_called);
|
490 |
+
PHPUnit_Framework_Assert::assertFalse($head_error_called);
|
491 |
+
PHPUnit_Framework_Assert::assertFalse($head_complete_called);
|
492 |
+
$head_error_called = true;
|
493 |
+
}
|
494 |
+
if ($request_method === 'OPTIONS') {
|
495 |
+
PHPUnit_Framework_Assert::assertTrue($options_before_send_called);
|
496 |
+
PHPUnit_Framework_Assert::assertFalse($options_success_called);
|
497 |
+
PHPUnit_Framework_Assert::assertFalse($options_error_called);
|
498 |
+
PHPUnit_Framework_Assert::assertFalse($options_complete_called);
|
499 |
+
$options_error_called = true;
|
500 |
+
}
|
501 |
+
if ($request_method === 'PATCH') {
|
502 |
+
PHPUnit_Framework_Assert::assertTrue($patch_before_send_called);
|
503 |
+
PHPUnit_Framework_Assert::assertFalse($patch_success_called);
|
504 |
+
PHPUnit_Framework_Assert::assertFalse($patch_error_called);
|
505 |
+
PHPUnit_Framework_Assert::assertFalse($patch_complete_called);
|
506 |
+
$patch_error_called = true;
|
507 |
+
}
|
508 |
+
if ($request_method === 'POST') {
|
509 |
+
PHPUnit_Framework_Assert::assertTrue($post_before_send_called);
|
510 |
+
PHPUnit_Framework_Assert::assertFalse($post_success_called);
|
511 |
+
PHPUnit_Framework_Assert::assertFalse($post_error_called);
|
512 |
+
PHPUnit_Framework_Assert::assertFalse($post_complete_called);
|
513 |
+
$post_error_called = true;
|
514 |
+
}
|
515 |
+
if ($request_method === 'PUT') {
|
516 |
+
PHPUnit_Framework_Assert::assertTrue($put_before_send_called);
|
517 |
+
PHPUnit_Framework_Assert::assertFalse($put_success_called);
|
518 |
+
PHPUnit_Framework_Assert::assertFalse($put_error_called);
|
519 |
+
PHPUnit_Framework_Assert::assertFalse($put_complete_called);
|
520 |
+
$put_error_called = true;
|
521 |
+
}
|
522 |
+
});
|
523 |
+
$multi_curl->complete(function ($instance) use (
|
524 |
+
&$delete_before_send_called, &$delete_success_called, &$delete_error_called, &$delete_complete_called,
|
525 |
+
&$download_before_send_called, &$download_success_called, &$download_error_called,
|
526 |
+
&$download_complete_called,
|
527 |
+
&$get_before_send_called, &$get_success_called, &$get_error_called, &$get_complete_called,
|
528 |
+
&$head_before_send_called, &$head_success_called, &$head_error_called, &$head_complete_called,
|
529 |
+
&$options_before_send_called, &$options_success_called, &$options_error_called, &$options_complete_called,
|
530 |
+
&$patch_before_send_called, &$patch_success_called, &$patch_error_called, &$patch_complete_called,
|
531 |
+
&$post_before_send_called, &$post_success_called, &$post_error_called, &$post_complete_called,
|
532 |
+
&$put_before_send_called, &$put_success_called, &$put_error_called, &$put_complete_called) {
|
533 |
+
PHPUnit_Framework_Assert::assertInstanceOf('Curl\Curl', $instance);
|
534 |
+
$request_method = $instance->getOpt(CURLOPT_CUSTOMREQUEST);
|
535 |
+
if ($request_method === 'DELETE') {
|
536 |
+
PHPUnit_Framework_Assert::assertTrue($delete_before_send_called);
|
537 |
+
PHPUnit_Framework_Assert::assertFalse($delete_success_called);
|
538 |
+
PHPUnit_Framework_Assert::assertTrue($delete_error_called);
|
539 |
+
PHPUnit_Framework_Assert::assertFalse($delete_complete_called);
|
540 |
+
$delete_complete_called = true;
|
541 |
+
}
|
542 |
+
if (isset($instance->download)) {
|
543 |
+
PHPUnit_Framework_Assert::assertTrue($download_before_send_called);
|
544 |
+
PHPUnit_Framework_Assert::assertFalse($download_success_called);
|
545 |
+
PHPUnit_Framework_Assert::assertTrue($download_error_called);
|
546 |
+
PHPUnit_Framework_Assert::assertFalse($download_complete_called);
|
547 |
+
$download_complete_called = true;
|
548 |
+
} elseif ($request_method === 'GET') {
|
549 |
+
PHPUnit_Framework_Assert::assertTrue($get_before_send_called);
|
550 |
+
PHPUnit_Framework_Assert::assertFalse($get_success_called);
|
551 |
+
PHPUnit_Framework_Assert::assertTrue($get_error_called);
|
552 |
+
PHPUnit_Framework_Assert::assertFalse($get_complete_called);
|
553 |
+
$get_complete_called = true;
|
554 |
+
}
|
555 |
+
if ($request_method === 'HEAD') {
|
556 |
+
PHPUnit_Framework_Assert::assertTrue($head_before_send_called);
|
557 |
+
PHPUnit_Framework_Assert::assertFalse($head_success_called);
|
558 |
+
PHPUnit_Framework_Assert::assertTrue($head_error_called);
|
559 |
+
PHPUnit_Framework_Assert::assertFalse($head_complete_called);
|
560 |
+
$head_complete_called = true;
|
561 |
+
}
|
562 |
+
if ($request_method === 'OPTIONS') {
|
563 |
+
PHPUnit_Framework_Assert::assertTrue($options_before_send_called);
|
564 |
+
PHPUnit_Framework_Assert::assertFalse($options_success_called);
|
565 |
+
PHPUnit_Framework_Assert::assertTrue($options_error_called);
|
566 |
+
PHPUnit_Framework_Assert::assertFalse($options_complete_called);
|
567 |
+
$options_complete_called = true;
|
568 |
+
}
|
569 |
+
if ($request_method === 'PATCH') {
|
570 |
+
PHPUnit_Framework_Assert::assertTrue($patch_before_send_called);
|
571 |
+
PHPUnit_Framework_Assert::assertFalse($patch_success_called);
|
572 |
+
PHPUnit_Framework_Assert::assertTrue($patch_error_called);
|
573 |
+
PHPUnit_Framework_Assert::assertFalse($patch_complete_called);
|
574 |
+
$patch_complete_called = true;
|
575 |
+
}
|
576 |
+
if ($request_method === 'POST') {
|
577 |
+
PHPUnit_Framework_Assert::assertTrue($post_before_send_called);
|
578 |
+
PHPUnit_Framework_Assert::assertFalse($post_success_called);
|
579 |
+
PHPUnit_Framework_Assert::assertTrue($post_error_called);
|
580 |
+
PHPUnit_Framework_Assert::assertFalse($post_complete_called);
|
581 |
+
$post_complete_called = true;
|
582 |
+
}
|
583 |
+
if ($request_method === 'PUT') {
|
584 |
+
PHPUnit_Framework_Assert::assertTrue($put_before_send_called);
|
585 |
+
PHPUnit_Framework_Assert::assertFalse($put_success_called);
|
586 |
+
PHPUnit_Framework_Assert::assertTrue($put_error_called);
|
587 |
+
PHPUnit_Framework_Assert::assertFalse($put_complete_called);
|
588 |
+
$put_complete_called = true;
|
589 |
+
}
|
590 |
+
PHPUnit_Framework_Assert::assertTrue($instance->error);
|
591 |
+
PHPUnit_Framework_Assert::assertTrue($instance->curlError);
|
592 |
+
PHPUnit_Framework_Assert::assertFalse($instance->httpError);
|
593 |
+
PHPUnit_Framework_Assert::assertEquals(CURLE_OPERATION_TIMEOUTED, $instance->errorCode);
|
594 |
+
PHPUnit_Framework_Assert::assertEquals(CURLE_OPERATION_TIMEOUTED, $instance->curlErrorCode);
|
595 |
+
});
|
596 |
+
|
597 |
+
$multi_curl->addDelete(Test::ERROR_URL);
|
598 |
+
$download_file_path = tempnam('/tmp', 'php-curl-class.');
|
599 |
+
$multi_curl->addDownload(Test::ERROR_URL, $download_file_path)->download = true;
|
600 |
+
$multi_curl->addGet(Test::ERROR_URL);
|
601 |
+
$multi_curl->addHead(Test::ERROR_URL);
|
602 |
+
$multi_curl->addOptions(Test::ERROR_URL);
|
603 |
+
$multi_curl->addPatch(Test::ERROR_URL);
|
604 |
+
$multi_curl->addPost(Test::ERROR_URL);
|
605 |
+
$multi_curl->addPut(Test::ERROR_URL);
|
606 |
+
$multi_curl->start();
|
607 |
+
|
608 |
+
$this->assertTrue($delete_before_send_called);
|
609 |
+
$this->assertFalse($delete_success_called);
|
610 |
+
$this->assertTrue($delete_error_called);
|
611 |
+
$this->assertTrue($delete_complete_called);
|
612 |
+
|
613 |
+
$this->assertTrue($download_before_send_called);
|
614 |
+
$this->assertFalse($download_success_called);
|
615 |
+
$this->assertTrue($download_error_called);
|
616 |
+
$this->assertTrue($download_complete_called);
|
617 |
+
$this->assertTrue(unlink($download_file_path));
|
618 |
+
|
619 |
+
$this->assertTrue($get_before_send_called);
|
620 |
+
$this->assertFalse($get_success_called);
|
621 |
+
$this->assertTrue($get_error_called);
|
622 |
+
$this->assertTrue($get_complete_called);
|
623 |
+
|
624 |
+
$this->assertTrue($head_before_send_called);
|
625 |
+
$this->assertFalse($head_success_called);
|
626 |
+
$this->assertTrue($head_error_called);
|
627 |
+
$this->assertTrue($head_complete_called);
|
628 |
+
|
629 |
+
$this->assertTrue($options_before_send_called);
|
630 |
+
$this->assertFalse($options_success_called);
|
631 |
+
$this->assertTrue($options_error_called);
|
632 |
+
$this->assertTrue($options_complete_called);
|
633 |
+
|
634 |
+
$this->assertTrue($patch_before_send_called);
|
635 |
+
$this->assertFalse($patch_success_called);
|
636 |
+
$this->assertTrue($patch_error_called);
|
637 |
+
$this->assertTrue($patch_complete_called);
|
638 |
+
|
639 |
+
$this->assertTrue($post_before_send_called);
|
640 |
+
$this->assertFalse($post_success_called);
|
641 |
+
$this->assertTrue($post_error_called);
|
642 |
+
$this->assertTrue($post_complete_called);
|
643 |
+
|
644 |
+
$this->assertTrue($put_before_send_called);
|
645 |
+
$this->assertFalse($put_success_called);
|
646 |
+
$this->assertTrue($put_error_called);
|
647 |
+
$this->assertTrue($put_complete_called);
|
648 |
+
}
|
649 |
+
|
650 |
+
public function testCurlCallback()
|
651 |
+
{
|
652 |
+
$multi_curl = new MultiCurl();
|
653 |
+
|
654 |
+
$delete_before_send_called = false;
|
655 |
+
$delete_success_called = false;
|
656 |
+
$delete_error_called = false;
|
657 |
+
$delete_complete_called = false;
|
658 |
+
$delete = $multi_curl->addDelete(Test::TEST_URL);
|
659 |
+
$delete->beforeSend(function ($instance) use (
|
660 |
+
&$delete_before_send_called, &$delete_success_called, &$delete_error_called, &$delete_complete_called) {
|
661 |
+
PHPUnit_Framework_Assert::assertInstanceOf('Curl\Curl', $instance);
|
662 |
+
PHPUnit_Framework_Assert::assertFalse($delete_before_send_called);
|
663 |
+
PHPUnit_Framework_Assert::assertFalse($delete_success_called);
|
664 |
+
PHPUnit_Framework_Assert::assertFalse($delete_error_called);
|
665 |
+
PHPUnit_Framework_Assert::assertFalse($delete_complete_called);
|
666 |
+
$delete_before_send_called = true;
|
667 |
+
});
|
668 |
+
$delete->success(function ($instance) use (
|
669 |
+
&$delete_before_send_called, &$delete_success_called, &$delete_error_called, &$delete_complete_called) {
|
670 |
+
PHPUnit_Framework_Assert::assertInstanceOf('Curl\Curl', $instance);
|
671 |
+
PHPUnit_Framework_Assert::assertTrue($delete_before_send_called);
|
672 |
+
PHPUnit_Framework_Assert::assertFalse($delete_success_called);
|
673 |
+
PHPUnit_Framework_Assert::assertFalse($delete_error_called);
|
674 |
+
PHPUnit_Framework_Assert::assertFalse($delete_complete_called);
|
675 |
+
$delete_success_called = true;
|
676 |
+
});
|
677 |
+
$delete->error(function ($instance) use (
|
678 |
+
&$delete_error_called) {
|
679 |
+
$delete_error_called = true;
|
680 |
+
});
|
681 |
+
$delete->complete(function ($instance) use (
|
682 |
+
&$delete_before_send_called, &$delete_success_called, &$delete_error_called, &$delete_complete_called) {
|
683 |
+
PHPUnit_Framework_Assert::assertInstanceOf('Curl\Curl', $instance);
|
684 |
+
PHPUnit_Framework_Assert::assertTrue($delete_before_send_called);
|
685 |
+
PHPUnit_Framework_Assert::assertTrue($delete_success_called);
|
686 |
+
PHPUnit_Framework_Assert::assertFalse($delete_error_called);
|
687 |
+
PHPUnit_Framework_Assert::assertFalse($delete_complete_called);
|
688 |
+
$delete_complete_called = true;
|
689 |
+
});
|
690 |
+
|
691 |
+
$download_before_send_called = false;
|
692 |
+
$download_success_called = false;
|
693 |
+
$download_error_called = false;
|
694 |
+
$download_complete_called = false;
|
695 |
+
$download_file_path = tempnam('/tmp', 'php-curl-class.');
|
696 |
+
$download = $multi_curl->addDownload(Test::TEST_URL, $download_file_path);
|
697 |
+
$download->beforeSend(function ($instance) use (
|
698 |
+
&$download_before_send_called, &$download_success_called, &$download_error_called,
|
699 |
+
&$download_complete_called) {
|
700 |
+
PHPUnit_Framework_Assert::assertInstanceOf('Curl\Curl', $instance);
|
701 |
+
PHPUnit_Framework_Assert::assertFalse($download_before_send_called);
|
702 |
+
PHPUnit_Framework_Assert::assertFalse($download_success_called);
|
703 |
+
PHPUnit_Framework_Assert::assertFalse($download_error_called);
|
704 |
+
PHPUnit_Framework_Assert::assertFalse($download_complete_called);
|
705 |
+
$download_before_send_called = true;
|
706 |
+
});
|
707 |
+
$download->success(function ($instance) use (
|
708 |
+
&$download_before_send_called, &$download_success_called, &$download_error_called,
|
709 |
+
&$download_complete_called) {
|
710 |
+
PHPUnit_Framework_Assert::assertInstanceOf('Curl\Curl', $instance);
|
711 |
+
PHPUnit_Framework_Assert::assertTrue($download_before_send_called);
|
712 |
+
PHPUnit_Framework_Assert::assertFalse($download_success_called);
|
713 |
+
PHPUnit_Framework_Assert::assertFalse($download_error_called);
|
714 |
+
PHPUnit_Framework_Assert::assertFalse($download_complete_called);
|
715 |
+
$download_success_called = true;
|
716 |
+
});
|
717 |
+
$download->error(function ($instance) use (
|
718 |
+
&$download_error_called) {
|
719 |
+
$download_error_called = true;
|
720 |
+
});
|
721 |
+
$download->complete(function ($instance) use (
|
722 |
+
&$download_before_send_called, &$download_success_called, &$download_error_called,
|
723 |
+
&$download_complete_called) {
|
724 |
+
PHPUnit_Framework_Assert::assertInstanceOf('Curl\Curl', $instance);
|
725 |
+
PHPUnit_Framework_Assert::assertTrue($download_before_send_called);
|
726 |
+
PHPUnit_Framework_Assert::assertTrue($download_success_called);
|
727 |
+
PHPUnit_Framework_Assert::assertFalse($download_error_called);
|
728 |
+
PHPUnit_Framework_Assert::assertFalse($download_complete_called);
|
729 |
+
$download_complete_called = true;
|
730 |
+
});
|
731 |
+
|
732 |
+
$get_before_send_called = false;
|
733 |
+
$get_success_called = false;
|
734 |
+
$get_error_called = false;
|
735 |
+
$get_complete_called = false;
|
736 |
+
$get = $multi_curl->addGet(Test::TEST_URL);
|
737 |
+
$get->beforeSend(function ($instance) use (
|
738 |
+
&$get_before_send_called, &$get_success_called, &$get_error_called, &$get_complete_called) {
|
739 |
+
PHPUnit_Framework_Assert::assertInstanceOf('Curl\Curl', $instance);
|
740 |
+
PHPUnit_Framework_Assert::assertFalse($get_before_send_called);
|
741 |
+
PHPUnit_Framework_Assert::assertFalse($get_success_called);
|
742 |
+
PHPUnit_Framework_Assert::assertFalse($get_error_called);
|
743 |
+
PHPUnit_Framework_Assert::assertFalse($get_complete_called);
|
744 |
+
$get_before_send_called = true;
|
745 |
+
});
|
746 |
+
$get->success(function ($instance) use (
|
747 |
+
&$get_before_send_called, &$get_success_called, &$get_error_called, &$get_complete_called) {
|
748 |
+
PHPUnit_Framework_Assert::assertInstanceOf('Curl\Curl', $instance);
|
749 |
+
PHPUnit_Framework_Assert::assertTrue($get_before_send_called);
|
750 |
+
PHPUnit_Framework_Assert::assertFalse($get_success_called);
|
751 |
+
PHPUnit_Framework_Assert::assertFalse($get_error_called);
|
752 |
+
PHPUnit_Framework_Assert::assertFalse($get_complete_called);
|
753 |
+
$get_success_called = true;
|
754 |
+
});
|
755 |
+
$get->error(function ($instance) use (
|
756 |
+
&$get_error_called) {
|
757 |
+
$get_error_called = true;
|
758 |
+
});
|
759 |
+
$get->complete(function ($instance) use (
|
760 |
+
&$get_before_send_called, &$get_success_called, &$get_error_called, &$get_complete_called) {
|
761 |
+
PHPUnit_Framework_Assert::assertInstanceOf('Curl\Curl', $instance);
|
762 |
+
PHPUnit_Framework_Assert::assertTrue($get_before_send_called);
|
763 |
+
PHPUnit_Framework_Assert::assertTrue($get_success_called);
|
764 |
+
PHPUnit_Framework_Assert::assertFalse($get_error_called);
|
765 |
+
PHPUnit_Framework_Assert::assertFalse($get_complete_called);
|
766 |
+
$get_complete_called = true;
|
767 |
+
});
|
768 |
+
|
769 |
+
$head_before_send_called = false;
|
770 |
+
$head_success_called = false;
|
771 |
+
$head_error_called = false;
|
772 |
+
$head_complete_called = false;
|
773 |
+
$head = $multi_curl->addHead(Test::TEST_URL);
|
774 |
+
$head->beforeSend(function ($instance) use (
|
775 |
+
&$head_before_send_called, &$head_success_called, &$head_error_called, &$head_complete_called) {
|
776 |
+
PHPUnit_Framework_Assert::assertInstanceOf('Curl\Curl', $instance);
|
777 |
+
PHPUnit_Framework_Assert::assertFalse($head_before_send_called);
|
778 |
+
PHPUnit_Framework_Assert::assertFalse($head_success_called);
|
779 |
+
PHPUnit_Framework_Assert::assertFalse($head_error_called);
|
780 |
+
PHPUnit_Framework_Assert::assertFalse($head_complete_called);
|
781 |
+
$head_before_send_called = true;
|
782 |
+
});
|
783 |
+
$head->success(function ($instance) use (
|
784 |
+
&$head_before_send_called, &$head_success_called, &$head_error_called, &$head_complete_called) {
|
785 |
+
PHPUnit_Framework_Assert::assertInstanceOf('Curl\Curl', $instance);
|
786 |
+
PHPUnit_Framework_Assert::assertTrue($head_before_send_called);
|
787 |
+
PHPUnit_Framework_Assert::assertFalse($head_success_called);
|
788 |
+
PHPUnit_Framework_Assert::assertFalse($head_error_called);
|
789 |
+
PHPUnit_Framework_Assert::assertFalse($head_complete_called);
|
790 |
+
$head_success_called = true;
|
791 |
+
});
|
792 |
+
$head->error(function ($instance) use (
|
793 |
+
&$head_error_called) {
|
794 |
+
$head_error_called = true;
|
795 |
+
});
|
796 |
+
$head->complete(function ($instance) use (
|
797 |
+
&$head_before_send_called, &$head_success_called, &$head_error_called, &$head_complete_called) {
|
798 |
+
PHPUnit_Framework_Assert::assertInstanceOf('Curl\Curl', $instance);
|
799 |
+
PHPUnit_Framework_Assert::assertTrue($head_before_send_called);
|
800 |
+
PHPUnit_Framework_Assert::assertTrue($head_success_called);
|
801 |
+
PHPUnit_Framework_Assert::assertFalse($head_error_called);
|
802 |
+
PHPUnit_Framework_Assert::assertFalse($head_complete_called);
|
803 |
+
$head_complete_called = true;
|
804 |
+
});
|
805 |
+
|
806 |
+
$options_before_send_called = false;
|
807 |
+
$options_success_called = false;
|
808 |
+
$options_error_called = false;
|
809 |
+
$options_complete_called = false;
|
810 |
+
$options = $multi_curl->addOptions(Test::TEST_URL);
|
811 |
+
$options->beforeSend(function ($instance) use (
|
812 |
+
&$options_before_send_called, &$options_success_called, &$options_error_called, &$options_complete_called) {
|
813 |
+
PHPUnit_Framework_Assert::assertInstanceOf('Curl\Curl', $instance);
|
814 |
+
PHPUnit_Framework_Assert::assertFalse($options_before_send_called);
|
815 |
+
PHPUnit_Framework_Assert::assertFalse($options_success_called);
|
816 |
+
PHPUnit_Framework_Assert::assertFalse($options_error_called);
|
817 |
+
PHPUnit_Framework_Assert::assertFalse($options_complete_called);
|
818 |
+
$options_before_send_called = true;
|
819 |
+
});
|
820 |
+
$options->success(function ($instance) use (
|
821 |
+
&$options_before_send_called, &$options_success_called, &$options_error_called, &$options_complete_called) {
|
822 |
+
PHPUnit_Framework_Assert::assertInstanceOf('Curl\Curl', $instance);
|
823 |
+
PHPUnit_Framework_Assert::assertTrue($options_before_send_called);
|
824 |
+
PHPUnit_Framework_Assert::assertFalse($options_success_called);
|
825 |
+
PHPUnit_Framework_Assert::assertFalse($options_error_called);
|
826 |
+
PHPUnit_Framework_Assert::assertFalse($options_complete_called);
|
827 |
+
$options_success_called = true;
|
828 |
+
});
|
829 |
+
$options->error(function ($instance) use (
|
830 |
+
&$options_error_called) {
|
831 |
+
$options_error_called = true;
|
832 |
+
});
|
833 |
+
$options->complete(function ($instance) use (
|
834 |
+
&$options_before_send_called, &$options_success_called, &$options_error_called, &$options_complete_called) {
|
835 |
+
PHPUnit_Framework_Assert::assertInstanceOf('Curl\Curl', $instance);
|
836 |
+
PHPUnit_Framework_Assert::assertTrue($options_before_send_called);
|
837 |
+
PHPUnit_Framework_Assert::assertTrue($options_success_called);
|
838 |
+
PHPUnit_Framework_Assert::assertFalse($options_error_called);
|
839 |
+
PHPUnit_Framework_Assert::assertFalse($options_complete_called);
|
840 |
+
$options_complete_called = true;
|
841 |
+
});
|
842 |
+
|
843 |
+
$patch_before_send_called = false;
|
844 |
+
$patch_success_called = false;
|
845 |
+
$patch_error_called = false;
|
846 |
+
$patch_complete_called = false;
|
847 |
+
$patch = $multi_curl->addPatch(Test::TEST_URL);
|
848 |
+
$patch->beforeSend(function ($instance) use (
|
849 |
+
&$patch_before_send_called, &$patch_success_called, &$patch_error_called, &$patch_complete_called) {
|
850 |
+
PHPUnit_Framework_Assert::assertInstanceOf('Curl\Curl', $instance);
|
851 |
+
PHPUnit_Framework_Assert::assertFalse($patch_before_send_called);
|
852 |
+
PHPUnit_Framework_Assert::assertFalse($patch_success_called);
|
853 |
+
PHPUnit_Framework_Assert::assertFalse($patch_error_called);
|
854 |
+
PHPUnit_Framework_Assert::assertFalse($patch_complete_called);
|
855 |
+
$patch_before_send_called = true;
|
856 |
+
});
|
857 |
+
$patch->success(function ($instance) use (
|
858 |
+
&$patch_before_send_called, &$patch_success_called, &$patch_error_called, &$patch_complete_called) {
|
859 |
+
PHPUnit_Framework_Assert::assertInstanceOf('Curl\Curl', $instance);
|
860 |
+
PHPUnit_Framework_Assert::assertTrue($patch_before_send_called);
|
861 |
+
PHPUnit_Framework_Assert::assertFalse($patch_success_called);
|
862 |
+
PHPUnit_Framework_Assert::assertFalse($patch_error_called);
|
863 |
+
PHPUnit_Framework_Assert::assertFalse($patch_complete_called);
|
864 |
+
$patch_success_called = true;
|
865 |
+
});
|
866 |
+
$patch->error(function ($instance) use (
|
867 |
+
&$patch_error_called) {
|
868 |
+
$patch_error_called = true;
|
869 |
+
});
|
870 |
+
$patch->complete(function ($instance) use (
|
871 |
+
&$patch_before_send_called, &$patch_success_called, &$patch_error_called, &$patch_complete_called) {
|
872 |
+
PHPUnit_Framework_Assert::assertInstanceOf('Curl\Curl', $instance);
|
873 |
+
PHPUnit_Framework_Assert::assertTrue($patch_before_send_called);
|
874 |
+
PHPUnit_Framework_Assert::assertTrue($patch_success_called);
|
875 |
+
PHPUnit_Framework_Assert::assertFalse($patch_error_called);
|
876 |
+
PHPUnit_Framework_Assert::assertFalse($patch_complete_called);
|
877 |
+
$patch_complete_called = true;
|
878 |
+
});
|
879 |
+
|
880 |
+
$post_before_send_called = false;
|
881 |
+
$post_success_called = false;
|
882 |
+
$post_error_called = false;
|
883 |
+
$post_complete_called = false;
|
884 |
+
$post = $multi_curl->addPost(Test::TEST_URL);
|
885 |
+
$post->beforeSend(function ($instance) use (
|
886 |
+
&$post_before_send_called, &$post_success_called, &$post_error_called, &$post_complete_called) {
|
887 |
+
PHPUnit_Framework_Assert::assertInstanceOf('Curl\Curl', $instance);
|
888 |
+
PHPUnit_Framework_Assert::assertFalse($post_before_send_called);
|
889 |
+
PHPUnit_Framework_Assert::assertFalse($post_success_called);
|
890 |
+
PHPUnit_Framework_Assert::assertFalse($post_error_called);
|
891 |
+
PHPUnit_Framework_Assert::assertFalse($post_complete_called);
|
892 |
+
$post_before_send_called = true;
|
893 |
+
});
|
894 |
+
$post->success(function ($instance) use (
|
895 |
+
&$post_before_send_called, &$post_success_called, &$post_error_called, &$post_complete_called) {
|
896 |
+
PHPUnit_Framework_Assert::assertInstanceOf('Curl\Curl', $instance);
|
897 |
+
PHPUnit_Framework_Assert::assertTrue($post_before_send_called);
|
898 |
+
PHPUnit_Framework_Assert::assertFalse($post_success_called);
|
899 |
+
PHPUnit_Framework_Assert::assertFalse($post_error_called);
|
900 |
+
PHPUnit_Framework_Assert::assertFalse($post_complete_called);
|
901 |
+
$post_success_called = true;
|
902 |
+
});
|
903 |
+
$post->error(function ($instance) use (
|
904 |
+
&$post_error_called) {
|
905 |
+
$post_error_called = true;
|
906 |
+
});
|
907 |
+
$post->complete(function ($instance) use (
|
908 |
+
&$post_before_send_called, &$post_success_called, &$post_error_called, &$post_complete_called) {
|
909 |
+
PHPUnit_Framework_Assert::assertInstanceOf('Curl\Curl', $instance);
|
910 |
+
PHPUnit_Framework_Assert::assertTrue($post_before_send_called);
|
911 |
+
PHPUnit_Framework_Assert::assertTrue($post_success_called);
|
912 |
+
PHPUnit_Framework_Assert::assertFalse($post_error_called);
|
913 |
+
PHPUnit_Framework_Assert::assertFalse($post_complete_called);
|
914 |
+
$post_complete_called = true;
|
915 |
+
});
|
916 |
+
|
917 |
+
$put_before_send_called = false;
|
918 |
+
$put_success_called = false;
|
919 |
+
$put_error_called = false;
|
920 |
+
$put_complete_called = false;
|
921 |
+
$put = $multi_curl->addPut(Test::TEST_URL);
|
922 |
+
$put->beforeSend(function ($instance) use (
|
923 |
+
&$put_before_send_called, &$put_success_called, &$put_error_called, &$put_complete_called) {
|
924 |
+
PHPUnit_Framework_Assert::assertInstanceOf('Curl\Curl', $instance);
|
925 |
+
PHPUnit_Framework_Assert::assertFalse($put_before_send_called);
|
926 |
+
PHPUnit_Framework_Assert::assertFalse($put_success_called);
|
927 |
+
PHPUnit_Framework_Assert::assertFalse($put_error_called);
|
928 |
+
PHPUnit_Framework_Assert::assertFalse($put_complete_called);
|
929 |
+
$put_before_send_called = true;
|
930 |
+
});
|
931 |
+
$put->success(function ($instance) use (
|
932 |
+
&$put_before_send_called, &$put_success_called, &$put_error_called, &$put_complete_called) {
|
933 |
+
PHPUnit_Framework_Assert::assertInstanceOf('Curl\Curl', $instance);
|
934 |
+
PHPUnit_Framework_Assert::assertTrue($put_before_send_called);
|
935 |
+
PHPUnit_Framework_Assert::assertFalse($put_success_called);
|
936 |
+
PHPUnit_Framework_Assert::assertFalse($put_error_called);
|
937 |
+
PHPUnit_Framework_Assert::assertFalse($put_complete_called);
|
938 |
+
$put_success_called = true;
|
939 |
+
});
|
940 |
+
$put->error(function ($instance) use (
|
941 |
+
&$put_error_called) {
|
942 |
+
$put_error_called = true;
|
943 |
+
});
|
944 |
+
$put->complete(function ($instance) use (
|
945 |
+
&$put_before_send_called, &$put_success_called, &$put_error_called, &$put_complete_called) {
|
946 |
+
PHPUnit_Framework_Assert::assertInstanceOf('Curl\Curl', $instance);
|
947 |
+
PHPUnit_Framework_Assert::assertTrue($put_before_send_called);
|
948 |
+
PHPUnit_Framework_Assert::assertTrue($put_success_called);
|
949 |
+
PHPUnit_Framework_Assert::assertFalse($put_error_called);
|
950 |
+
PHPUnit_Framework_Assert::assertFalse($put_complete_called);
|
951 |
+
$put_complete_called = true;
|
952 |
+
});
|
953 |
+
|
954 |
+
$multi_curl->start();
|
955 |
+
|
956 |
+
$this->assertTrue($delete_before_send_called);
|
957 |
+
$this->assertTrue($delete_success_called);
|
958 |
+
$this->assertFalse($delete_error_called);
|
959 |
+
$this->assertTrue($delete_complete_called);
|
960 |
+
|
961 |
+
$this->assertTrue($download_before_send_called);
|
962 |
+
$this->assertTrue($download_success_called);
|
963 |
+
$this->assertFalse($download_error_called);
|
964 |
+
$this->assertTrue($download_complete_called);
|
965 |
+
$this->assertTrue(unlink($download_file_path));
|
966 |
+
|
967 |
+
$this->assertTrue($get_before_send_called);
|
968 |
+
$this->assertTrue($get_success_called);
|
969 |
+
$this->assertFalse($get_error_called);
|
970 |
+
$this->assertTrue($get_complete_called);
|
971 |
+
|
972 |
+
$this->assertTrue($head_before_send_called);
|
973 |
+
$this->assertTrue($head_success_called);
|
974 |
+
$this->assertFalse($head_error_called);
|
975 |
+
$this->assertTrue($head_complete_called);
|
976 |
+
|
977 |
+
$this->assertTrue($options_before_send_called);
|
978 |
+
$this->assertTrue($options_success_called);
|
979 |
+
$this->assertFalse($options_error_called);
|
980 |
+
$this->assertTrue($options_complete_called);
|
981 |
+
|
982 |
+
$this->assertTrue($patch_before_send_called);
|
983 |
+
$this->assertTrue($patch_success_called);
|
984 |
+
$this->assertFalse($patch_error_called);
|
985 |
+
$this->assertTrue($patch_complete_called);
|
986 |
+
|
987 |
+
$this->assertTrue($post_before_send_called);
|
988 |
+
$this->assertTrue($post_success_called);
|
989 |
+
$this->assertFalse($post_error_called);
|
990 |
+
$this->assertTrue($post_complete_called);
|
991 |
+
|
992 |
+
$this->assertTrue($put_before_send_called);
|
993 |
+
$this->assertTrue($put_success_called);
|
994 |
+
$this->assertFalse($put_error_called);
|
995 |
+
$this->assertTrue($put_complete_called);
|
996 |
+
}
|
997 |
+
|
998 |
+
public function testCurlCallbackError()
|
999 |
+
{
|
1000 |
+
$multi_curl = new MultiCurl();
|
1001 |
+
|
1002 |
+
$delete_before_send_called = false;
|
1003 |
+
$delete_success_called = false;
|
1004 |
+
$delete_error_called = false;
|
1005 |
+
$delete_complete_called = false;
|
1006 |
+
$delete = $multi_curl->addDelete(Test::ERROR_URL);
|
1007 |
+
$delete->beforeSend(function ($instance) use (
|
1008 |
+
&$delete_before_send_called, &$delete_success_called, &$delete_error_called, &$delete_complete_called) {
|
1009 |
+
PHPUnit_Framework_Assert::assertInstanceOf('Curl\Curl', $instance);
|
1010 |
+
PHPUnit_Framework_Assert::assertFalse($delete_before_send_called);
|
1011 |
+
PHPUnit_Framework_Assert::assertFalse($delete_success_called);
|
1012 |
+
PHPUnit_Framework_Assert::assertFalse($delete_error_called);
|
1013 |
+
PHPUnit_Framework_Assert::assertFalse($delete_complete_called);
|
1014 |
+
$delete_before_send_called = true;
|
1015 |
+
});
|
1016 |
+
$delete->success(function ($instance) use (
|
1017 |
+
&$delete_success_called) {
|
1018 |
+
$delete_success_called = true;
|
1019 |
+
});
|
1020 |
+
$delete->error(function ($instance) use (
|
1021 |
+
&$delete_before_send_called, &$delete_success_called, &$delete_error_called, &$delete_complete_called) {
|
1022 |
+
PHPUnit_Framework_Assert::assertInstanceOf('Curl\Curl', $instance);
|
1023 |
+
PHPUnit_Framework_Assert::assertTrue($delete_before_send_called);
|
1024 |
+
PHPUnit_Framework_Assert::assertFalse($delete_success_called);
|
1025 |
+
PHPUnit_Framework_Assert::assertFalse($delete_error_called);
|
1026 |
+
PHPUnit_Framework_Assert::assertFalse($delete_complete_called);
|
1027 |
+
$delete_error_called = true;
|
1028 |
+
});
|
1029 |
+
$delete->complete(function ($instance) use (
|
1030 |
+
&$delete_before_send_called, &$delete_success_called, &$delete_error_called, &$delete_complete_called) {
|
1031 |
+
PHPUnit_Framework_Assert::assertInstanceOf('Curl\Curl', $instance);
|
1032 |
+
PHPUnit_Framework_Assert::assertTrue($delete_before_send_called);
|
1033 |
+
PHPUnit_Framework_Assert::assertFalse($delete_success_called);
|
1034 |
+
PHPUnit_Framework_Assert::assertTrue($delete_error_called);
|
1035 |
+
PHPUnit_Framework_Assert::assertFalse($delete_complete_called);
|
1036 |
+
$delete_complete_called = true;
|
1037 |
+
});
|
1038 |
+
|
1039 |
+
$download_before_send_called = false;
|
1040 |
+
$download_success_called = false;
|
1041 |
+
$download_error_called = false;
|
1042 |
+
$download_complete_called = false;
|
1043 |
+
$download_file_path = tempnam('/tmp', 'php-curl-class.');
|
1044 |
+
$download = $multi_curl->addDownload(Test::ERROR_URL, $download_file_path);
|
1045 |
+
$download->beforeSend(function ($instance) use (
|
1046 |
+
&$download_before_send_called, &$download_success_called, &$download_error_called,
|
1047 |
+
&$download_complete_called) {
|
1048 |
+
PHPUnit_Framework_Assert::assertInstanceOf('Curl\Curl', $instance);
|
1049 |
+
PHPUnit_Framework_Assert::assertFalse($download_before_send_called);
|
1050 |
+
PHPUnit_Framework_Assert::assertFalse($download_success_called);
|
1051 |
+
PHPUnit_Framework_Assert::assertFalse($download_error_called);
|
1052 |
+
PHPUnit_Framework_Assert::assertFalse($download_complete_called);
|
1053 |
+
$download_before_send_called = true;
|
1054 |
+
});
|
1055 |
+
$download->success(function ($instance) use (
|
1056 |
+
&$download_success_called) {
|
1057 |
+
$download_success_called = true;
|
1058 |
+
});
|
1059 |
+
$download->error(function ($instance) use (
|
1060 |
+
&$download_before_send_called, &$download_success_called, &$download_error_called,
|
1061 |
+
&$download_complete_called) {
|
1062 |
+
PHPUnit_Framework_Assert::assertInstanceOf('Curl\Curl', $instance);
|
1063 |
+
PHPUnit_Framework_Assert::assertTrue($download_before_send_called);
|
1064 |
+
PHPUnit_Framework_Assert::assertFalse($download_success_called);
|
1065 |
+
PHPUnit_Framework_Assert::assertFalse($download_error_called);
|
1066 |
+
PHPUnit_Framework_Assert::assertFalse($download_complete_called);
|
1067 |
+
$download_error_called = true;
|
1068 |
+
});
|
1069 |
+
$download->complete(function ($instance) use (
|
1070 |
+
&$download_before_send_called, &$download_success_called, &$download_error_called,
|
1071 |
+
&$download_complete_called) {
|
1072 |
+
PHPUnit_Framework_Assert::assertInstanceOf('Curl\Curl', $instance);
|
1073 |
+
PHPUnit_Framework_Assert::assertTrue($download_before_send_called);
|
1074 |
+
PHPUnit_Framework_Assert::assertFalse($download_success_called);
|
1075 |
+
PHPUnit_Framework_Assert::assertTrue($download_error_called);
|
1076 |
+
PHPUnit_Framework_Assert::assertFalse($download_complete_called);
|
1077 |
+
$download_complete_called = true;
|
1078 |
+
});
|
1079 |
+
|
1080 |
+
$get_before_send_called = false;
|
1081 |
+
$get_success_called = false;
|
1082 |
+
$get_error_called = false;
|
1083 |
+
$get_complete_called = false;
|
1084 |
+
$get = $multi_curl->addGet(Test::ERROR_URL);
|
1085 |
+
$get->beforeSend(function ($instance) use (
|
1086 |
+
&$get_before_send_called, &$get_success_called, &$get_error_called, &$get_complete_called) {
|
1087 |
+
PHPUnit_Framework_Assert::assertInstanceOf('Curl\Curl', $instance);
|
1088 |
+
PHPUnit_Framework_Assert::assertFalse($get_before_send_called);
|
1089 |
+
PHPUnit_Framework_Assert::assertFalse($get_success_called);
|
1090 |
+
PHPUnit_Framework_Assert::assertFalse($get_error_called);
|
1091 |
+
PHPUnit_Framework_Assert::assertFalse($get_complete_called);
|
1092 |
+
$get_before_send_called = true;
|
1093 |
+
});
|
1094 |
+
$get->success(function ($instance) use (
|
1095 |
+
&$get_success_called) {
|
1096 |
+
$get_success_called = true;
|
1097 |
+
});
|
1098 |
+
$get->error(function ($instance) use (
|
1099 |
+
&$get_before_send_called, &$get_success_called, &$get_error_called, &$get_complete_called) {
|
1100 |
+
PHPUnit_Framework_Assert::assertInstanceOf('Curl\Curl', $instance);
|
1101 |
+
PHPUnit_Framework_Assert::assertTrue($get_before_send_called);
|
1102 |
+
PHPUnit_Framework_Assert::assertFalse($get_success_called);
|
1103 |
+
PHPUnit_Framework_Assert::assertFalse($get_error_called);
|
1104 |
+
PHPUnit_Framework_Assert::assertFalse($get_complete_called);
|
1105 |
+
$get_error_called = true;
|
1106 |
+
});
|
1107 |
+
$get->complete(function ($instance) use (
|
1108 |
+
&$get_before_send_called, &$get_success_called, &$get_error_called, &$get_complete_called) {
|
1109 |
+
PHPUnit_Framework_Assert::assertInstanceOf('Curl\Curl', $instance);
|
1110 |
+
PHPUnit_Framework_Assert::assertTrue($get_before_send_called);
|
1111 |
+
PHPUnit_Framework_Assert::assertFalse($get_success_called);
|
1112 |
+
PHPUnit_Framework_Assert::assertTrue($get_error_called);
|
1113 |
+
PHPUnit_Framework_Assert::assertFalse($get_complete_called);
|
1114 |
+
$get_complete_called = true;
|
1115 |
+
});
|
1116 |
+
|
1117 |
+
$head_before_send_called = false;
|
1118 |
+
$head_success_called = false;
|
1119 |
+
$head_error_called = false;
|
1120 |
+
$head_complete_called = false;
|
1121 |
+
$head = $multi_curl->addHead(Test::ERROR_URL);
|
1122 |
+
$head->beforeSend(function ($instance) use (
|
1123 |
+
&$head_before_send_called, &$head_success_called, &$head_error_called, &$head_complete_called) {
|
1124 |
+
PHPUnit_Framework_Assert::assertInstanceOf('Curl\Curl', $instance);
|
1125 |
+
PHPUnit_Framework_Assert::assertFalse($head_before_send_called);
|
1126 |
+
PHPUnit_Framework_Assert::assertFalse($head_success_called);
|
1127 |
+
PHPUnit_Framework_Assert::assertFalse($head_error_called);
|
1128 |
+
PHPUnit_Framework_Assert::assertFalse($head_complete_called);
|
1129 |
+
$head_before_send_called = true;
|
1130 |
+
});
|
1131 |
+
$head->success(function ($instance) use (
|
1132 |
+
&$head_success_called) {
|
1133 |
+
$head_success_called = true;
|
1134 |
+
});
|
1135 |
+
$head->error(function ($instance) use (
|
1136 |
+
&$head_before_send_called, &$head_success_called, &$head_error_called, &$head_complete_called) {
|
1137 |
+
PHPUnit_Framework_Assert::assertInstanceOf('Curl\Curl', $instance);
|
1138 |
+
PHPUnit_Framework_Assert::assertTrue($head_before_send_called);
|
1139 |
+
PHPUnit_Framework_Assert::assertFalse($head_success_called);
|
1140 |
+
PHPUnit_Framework_Assert::assertFalse($head_error_called);
|
1141 |
+
PHPUnit_Framework_Assert::assertFalse($head_complete_called);
|
1142 |
+
$head_error_called = true;
|
1143 |
+
});
|
1144 |
+
$head->complete(function ($instance) use (
|
1145 |
+
&$head_before_send_called, &$head_success_called, &$head_error_called, &$head_complete_called) {
|
1146 |
+
PHPUnit_Framework_Assert::assertInstanceOf('Curl\Curl', $instance);
|
1147 |
+
PHPUnit_Framework_Assert::assertTrue($head_before_send_called);
|
1148 |
+
PHPUnit_Framework_Assert::assertFalse($head_success_called);
|
1149 |
+
PHPUnit_Framework_Assert::assertTrue($head_error_called);
|
1150 |
+
PHPUnit_Framework_Assert::assertFalse($head_complete_called);
|
1151 |
+
$head_complete_called = true;
|
1152 |
+
});
|
1153 |
+
|
1154 |
+
$options_before_send_called = false;
|
1155 |
+
$options_success_called = false;
|
1156 |
+
$options_error_called = false;
|
1157 |
+
$options_complete_called = false;
|
1158 |
+
$options = $multi_curl->addOptions(Test::ERROR_URL);
|
1159 |
+
$options->beforeSend(function ($instance) use (
|
1160 |
+
&$options_before_send_called, &$options_success_called, &$options_error_called, &$options_complete_called) {
|
1161 |
+
PHPUnit_Framework_Assert::assertInstanceOf('Curl\Curl', $instance);
|
1162 |
+
PHPUnit_Framework_Assert::assertFalse($options_before_send_called);
|
1163 |
+
PHPUnit_Framework_Assert::assertFalse($options_success_called);
|
1164 |
+
PHPUnit_Framework_Assert::assertFalse($options_error_called);
|
1165 |
+
PHPUnit_Framework_Assert::assertFalse($options_complete_called);
|
1166 |
+
$options_before_send_called = true;
|
1167 |
+
});
|
1168 |
+
$options->success(function ($instance) use (
|
1169 |
+
&$options_success_called) {
|
1170 |
+
$options_success_called = true;
|
1171 |
+
});
|
1172 |
+
$options->error(function ($instance) use (
|
1173 |
+
&$options_before_send_called, &$options_success_called, &$options_error_called, &$options_complete_called) {
|
1174 |
+
PHPUnit_Framework_Assert::assertInstanceOf('Curl\Curl', $instance);
|
1175 |
+
PHPUnit_Framework_Assert::assertTrue($options_before_send_called);
|
1176 |
+
PHPUnit_Framework_Assert::assertFalse($options_success_called);
|
1177 |
+
PHPUnit_Framework_Assert::assertFalse($options_error_called);
|
1178 |
+
PHPUnit_Framework_Assert::assertFalse($options_complete_called);
|
1179 |
+
$options_error_called = true;
|
1180 |
+
});
|
1181 |
+
$options->complete(function ($instance) use (
|
1182 |
+
&$options_before_send_called, &$options_success_called, &$options_error_called, &$options_complete_called) {
|
1183 |
+
PHPUnit_Framework_Assert::assertInstanceOf('Curl\Curl', $instance);
|
1184 |
+
PHPUnit_Framework_Assert::assertTrue($options_before_send_called);
|
1185 |
+
PHPUnit_Framework_Assert::assertFalse($options_success_called);
|
1186 |
+
PHPUnit_Framework_Assert::assertTrue($options_error_called);
|
1187 |
+
PHPUnit_Framework_Assert::assertFalse($options_complete_called);
|
1188 |
+
$options_complete_called = true;
|
1189 |
+
});
|
1190 |
+
|
1191 |
+
$patch_before_send_called = false;
|
1192 |
+
$patch_success_called = false;
|
1193 |
+
$patch_error_called = false;
|
1194 |
+
$patch_complete_called = false;
|
1195 |
+
$patch = $multi_curl->addPatch(Test::ERROR_URL);
|
1196 |
+
$patch->beforeSend(function ($instance) use (
|
1197 |
+
&$patch_before_send_called, &$patch_success_called, &$patch_error_called, &$patch_complete_called) {
|
1198 |
+
PHPUnit_Framework_Assert::assertInstanceOf('Curl\Curl', $instance);
|
1199 |
+
PHPUnit_Framework_Assert::assertFalse($patch_before_send_called);
|
1200 |
+
PHPUnit_Framework_Assert::assertFalse($patch_success_called);
|
1201 |
+
PHPUnit_Framework_Assert::assertFalse($patch_error_called);
|
1202 |
+
PHPUnit_Framework_Assert::assertFalse($patch_complete_called);
|
1203 |
+
$patch_before_send_called = true;
|
1204 |
+
});
|
1205 |
+
$patch->success(function ($instance) use (
|
1206 |
+
&$patch_success_called) {
|
1207 |
+
$patch_success_called = true;
|
1208 |
+
});
|
1209 |
+
$patch->error(function ($instance) use (
|
1210 |
+
&$patch_before_send_called, &$patch_success_called, &$patch_error_called, &$patch_complete_called) {
|
1211 |
+
PHPUnit_Framework_Assert::assertInstanceOf('Curl\Curl', $instance);
|
1212 |
+
PHPUnit_Framework_Assert::assertTrue($patch_before_send_called);
|
1213 |
+
PHPUnit_Framework_Assert::assertFalse($patch_success_called);
|
1214 |
+
PHPUnit_Framework_Assert::assertFalse($patch_error_called);
|
1215 |
+
PHPUnit_Framework_Assert::assertFalse($patch_complete_called);
|
1216 |
+
$patch_error_called = true;
|
1217 |
+
});
|
1218 |
+
$patch->complete(function ($instance) use (
|
1219 |
+
&$patch_before_send_called, &$patch_success_called, &$patch_error_called, &$patch_complete_called) {
|
1220 |
+
PHPUnit_Framework_Assert::assertInstanceOf('Curl\Curl', $instance);
|
1221 |
+
PHPUnit_Framework_Assert::assertTrue($patch_before_send_called);
|
1222 |
+
PHPUnit_Framework_Assert::assertFalse($patch_success_called);
|
1223 |
+
PHPUnit_Framework_Assert::assertTrue($patch_error_called);
|
1224 |
+
PHPUnit_Framework_Assert::assertFalse($patch_complete_called);
|
1225 |
+
$patch_complete_called = true;
|
1226 |
+
});
|
1227 |
+
|
1228 |
+
$post_before_send_called = false;
|
1229 |
+
$post_success_called = false;
|
1230 |
+
$post_error_called = false;
|
1231 |
+
$post_complete_called = false;
|
1232 |
+
$post = $multi_curl->addPost(Test::ERROR_URL);
|
1233 |
+
$post->beforeSend(function ($instance) use (
|
1234 |
+
&$post_before_send_called, &$post_success_called, &$post_error_called, &$post_complete_called) {
|
1235 |
+
PHPUnit_Framework_Assert::assertInstanceOf('Curl\Curl', $instance);
|
1236 |
+
PHPUnit_Framework_Assert::assertFalse($post_before_send_called);
|
1237 |
+
PHPUnit_Framework_Assert::assertFalse($post_success_called);
|
1238 |
+
PHPUnit_Framework_Assert::assertFalse($post_error_called);
|
1239 |
+
PHPUnit_Framework_Assert::assertFalse($post_complete_called);
|
1240 |
+
$post_before_send_called = true;
|
1241 |
+
});
|
1242 |
+
$post->success(function ($instance) use (
|
1243 |
+
&$post_success_called) {
|
1244 |
+
$post_sucess_called = true;
|
1245 |
+
});
|
1246 |
+
$post->error(function ($instance) use (
|
1247 |
+
&$post_before_send_called, &$post_success_called, &$post_error_called, &$post_complete_called) {
|
1248 |
+
PHPUnit_Framework_Assert::assertInstanceOf('Curl\Curl', $instance);
|
1249 |
+
PHPUnit_Framework_Assert::assertTrue($post_before_send_called);
|
1250 |
+
PHPUnit_Framework_Assert::assertFalse($post_success_called);
|
1251 |
+
PHPUnit_Framework_Assert::assertFalse($post_error_called);
|
1252 |
+
PHPUnit_Framework_Assert::assertFalse($post_complete_called);
|
1253 |
+
$post_error_called = true;
|
1254 |
+
});
|
1255 |
+
$post->complete(function ($instance) use (
|
1256 |
+
&$post_before_send_called, &$post_success_called, &$post_error_called, &$post_complete_called) {
|
1257 |
+
PHPUnit_Framework_Assert::assertInstanceOf('Curl\Curl', $instance);
|
1258 |
+
PHPUnit_Framework_Assert::assertTrue($post_before_send_called);
|
1259 |
+
PHPUnit_Framework_Assert::assertFalse($post_success_called);
|
1260 |
+
PHPUnit_Framework_Assert::assertTrue($post_error_called);
|
1261 |
+
PHPUnit_Framework_Assert::assertFalse($post_complete_called);
|
1262 |
+
$post_complete_called = true;
|
1263 |
+
});
|
1264 |
+
|
1265 |
+
$put_before_send_called = false;
|
1266 |
+
$put_success_called = false;
|
1267 |
+
$put_error_called = false;
|
1268 |
+
$put_complete_called = false;
|
1269 |
+
$put = $multi_curl->addPut(Test::ERROR_URL);
|
1270 |
+
$put->beforeSend(function ($instance) use (
|
1271 |
+
&$put_before_send_called, &$put_success_called, &$put_error_called, &$put_complete_called) {
|
1272 |
+
PHPUnit_Framework_Assert::assertInstanceOf('Curl\Curl', $instance);
|
1273 |
+
PHPUnit_Framework_Assert::assertFalse($put_before_send_called);
|
1274 |
+
PHPUnit_Framework_Assert::assertFalse($put_success_called);
|
1275 |
+
PHPUnit_Framework_Assert::assertFalse($put_error_called);
|
1276 |
+
PHPUnit_Framework_Assert::assertFalse($put_complete_called);
|
1277 |
+
$put_before_send_called = true;
|
1278 |
+
});
|
1279 |
+
$put->success(function ($instance) use (
|
1280 |
+
&$put_success_called) {
|
1281 |
+
$put_success_called = true;
|
1282 |
+
});
|
1283 |
+
$put->error(function ($instance) use (
|
1284 |
+
&$put_before_send_called, &$put_success_called, &$put_error_called, &$put_complete_called) {
|
1285 |
+
PHPUnit_Framework_Assert::assertInstanceOf('Curl\Curl', $instance);
|
1286 |
+
PHPUnit_Framework_Assert::assertTrue($put_before_send_called);
|
1287 |
+
PHPUnit_Framework_Assert::assertFalse($put_success_called);
|
1288 |
+
PHPUnit_Framework_Assert::assertFalse($put_error_called);
|
1289 |
+
PHPUnit_Framework_Assert::assertFalse($put_complete_called);
|
1290 |
+
$put_error_called = true;
|
1291 |
+
});
|
1292 |
+
$put->complete(function ($instance) use (
|
1293 |
+
&$put_before_send_called, &$put_success_called, &$put_error_called, &$put_complete_called) {
|
1294 |
+
PHPUnit_Framework_Assert::assertInstanceOf('Curl\Curl', $instance);
|
1295 |
+
PHPUnit_Framework_Assert::assertTrue($put_before_send_called);
|
1296 |
+
PHPUnit_Framework_Assert::assertFalse($put_success_called);
|
1297 |
+
PHPUnit_Framework_Assert::assertTrue($put_error_called);
|
1298 |
+
PHPUnit_Framework_Assert::assertFalse($put_complete_called);
|
1299 |
+
$put_complete_called = true;
|
1300 |
+
});
|
1301 |
+
|
1302 |
+
$multi_curl->start();
|
1303 |
+
|
1304 |
+
$this->assertTrue($delete_before_send_called);
|
1305 |
+
$this->assertFalse($delete_success_called);
|
1306 |
+
$this->assertTrue($delete_error_called);
|
1307 |
+
$this->assertTrue($delete_complete_called);
|
1308 |
+
|
1309 |
+
$this->assertTrue($download_before_send_called);
|
1310 |
+
$this->assertFalse($download_success_called);
|
1311 |
+
$this->assertTrue($download_error_called);
|
1312 |
+
$this->assertTrue($download_complete_called);
|
1313 |
+
$this->assertTrue(unlink($download_file_path));
|
1314 |
+
|
1315 |
+
$this->assertTrue($get_before_send_called);
|
1316 |
+
$this->assertFalse($get_success_called);
|
1317 |
+
$this->assertTrue($get_error_called);
|
1318 |
+
$this->assertTrue($get_complete_called);
|
1319 |
+
|
1320 |
+
$this->assertTrue($head_before_send_called);
|
1321 |
+
$this->assertFalse($head_success_called);
|
1322 |
+
$this->assertTrue($head_error_called);
|
1323 |
+
$this->assertTrue($head_complete_called);
|
1324 |
+
|
1325 |
+
$this->assertTrue($options_before_send_called);
|
1326 |
+
$this->assertFalse($options_success_called);
|
1327 |
+
$this->assertTrue($options_error_called);
|
1328 |
+
$this->assertTrue($options_complete_called);
|
1329 |
+
|
1330 |
+
$this->assertTrue($patch_before_send_called);
|
1331 |
+
$this->assertFalse($patch_success_called);
|
1332 |
+
$this->assertTrue($patch_error_called);
|
1333 |
+
$this->assertTrue($patch_complete_called);
|
1334 |
+
|
1335 |
+
$this->assertTrue($post_before_send_called);
|
1336 |
+
$this->assertFalse($post_success_called);
|
1337 |
+
$this->assertTrue($post_error_called);
|
1338 |
+
$this->assertTrue($post_complete_called);
|
1339 |
+
|
1340 |
+
$this->assertTrue($put_before_send_called);
|
1341 |
+
$this->assertFalse($put_success_called);
|
1342 |
+
$this->assertTrue($put_error_called);
|
1343 |
+
$this->assertTrue($put_complete_called);
|
1344 |
+
}
|
1345 |
+
|
1346 |
+
public function testCurlCallbackOverride()
|
1347 |
+
{
|
1348 |
+
$multi_curl = new MultiCurl();
|
1349 |
+
$multi_curl->beforeSend(function() {
|
1350 |
+
PHPUnit_Framework_Assert::assertFalse(true);
|
1351 |
+
});
|
1352 |
+
$multi_curl->success(function() {
|
1353 |
+
PHPUnit_Framework_Assert::assertFalse(true);
|
1354 |
+
});
|
1355 |
+
$multi_curl->error(function() {
|
1356 |
+
PHPUnit_Framework_Assert::assertFalse(true);
|
1357 |
+
});
|
1358 |
+
$multi_curl->complete(function() {
|
1359 |
+
PHPUnit_Framework_Assert::assertFalse(true);
|
1360 |
+
});
|
1361 |
+
|
1362 |
+
$delete_before_send_called = false;
|
1363 |
+
$delete_success_called = false;
|
1364 |
+
$delete_error_called = false;
|
1365 |
+
$delete_complete_called = false;
|
1366 |
+
$delete = $multi_curl->addDelete(Test::TEST_URL);
|
1367 |
+
$delete->beforeSend(function ($instance) use (&$delete_before_send_called) {
|
1368 |
+
$delete_before_send_called = true;
|
1369 |
+
});
|
1370 |
+
$delete->success(function ($instance) use (&$delete_success_called) {
|
1371 |
+
$delete_success_called = true;
|
1372 |
+
});
|
1373 |
+
$delete->error(function ($instance) use (&$delete_error_called) {
|
1374 |
+
$delete_error_called = true;
|
1375 |
+
});
|
1376 |
+
$delete->complete(function ($instance) use (&$delete_complete_called) {
|
1377 |
+
$delete_complete_called = true;
|
1378 |
+
});
|
1379 |
+
|
1380 |
+
$download_before_send_called = false;
|
1381 |
+
$download_success_called = false;
|
1382 |
+
$download_error_called = false;
|
1383 |
+
$download_complete_called = false;
|
1384 |
+
$download_file_path = tempnam('/tmp', 'php-curl-class.');
|
1385 |
+
$download = $multi_curl->addDownload(Test::TEST_URL, $download_file_path);
|
1386 |
+
$download->beforeSend(function ($instance) use (&$download_before_send_called) {
|
1387 |
+
$download_before_send_called = true;
|
1388 |
+
});
|
1389 |
+
$download->success(function ($instance) use (&$download_success_called) {
|
1390 |
+
$download_success_called = true;
|
1391 |
+
});
|
1392 |
+
$download->error(function ($instance) use (&$download_error_called) {
|
1393 |
+
$download_error_called = true;
|
1394 |
+
});
|
1395 |
+
$download->complete(function ($instance) use (&$download_complete_called) {
|
1396 |
+
$download_complete_called = true;
|
1397 |
+
});
|
1398 |
+
|
1399 |
+
$get_before_send_called = false;
|
1400 |
+
$get_success_called = false;
|
1401 |
+
$get_error_called = false;
|
1402 |
+
$get_complete_called = false;
|
1403 |
+
$get = $multi_curl->addGet(Test::TEST_URL);
|
1404 |
+
$get->beforeSend(function ($instance) use (&$get_before_send_called) {
|
1405 |
+
$get_before_send_called = true;
|
1406 |
+
});
|
1407 |
+
$get->success(function ($instance) use (&$get_success_called) {
|
1408 |
+
$get_success_called = true;
|
1409 |
+
});
|
1410 |
+
$get->error(function ($instance) use (&$get_error_called) {
|
1411 |
+
$get_error_called = true;
|
1412 |
+
});
|
1413 |
+
$get->complete(function ($instance) use (&$get_complete_called) {
|
1414 |
+
$get_complete_called = true;
|
1415 |
+
});
|
1416 |
+
|
1417 |
+
$head_before_send_called = false;
|
1418 |
+
$head_success_called = false;
|
1419 |
+
$head_error_called = false;
|
1420 |
+
$head_complete_called = false;
|
1421 |
+
$head = $multi_curl->addHead(Test::TEST_URL);
|
1422 |
+
$head->beforeSend(function ($instance) use (&$head_before_send_called) {
|
1423 |
+
$head_before_send_called = true;
|
1424 |
+
});
|
1425 |
+
$head->success(function ($instance) use (&$head_success_called) {
|
1426 |
+
$head_success_called = true;
|
1427 |
+
});
|
1428 |
+
$head->error(function ($instance) use (&$head_error_called) {
|
1429 |
+
$head_error_called = true;
|
1430 |
+
});
|
1431 |
+
$head->complete(function ($instance) use (&$head_complete_called) {
|
1432 |
+
$head_complete_called = true;
|
1433 |
+
});
|
1434 |
+
|
1435 |
+
$options_before_send_called = false;
|
1436 |
+
$options_success_called = false;
|
1437 |
+
$options_error_called = false;
|
1438 |
+
$options_complete_called = false;
|
1439 |
+
$options = $multi_curl->addOptions(Test::TEST_URL);
|
1440 |
+
$options->beforeSend(function ($instance) use (&$options_before_send_called) {
|
1441 |
+
$options_before_send_called = true;
|
1442 |
+
});
|
1443 |
+
$options->success(function ($instance) use (&$options_success_called) {
|
1444 |
+
$options_success_called = true;
|
1445 |
+
});
|
1446 |
+
$options->error(function ($instance) use (&$options_error_called) {
|
1447 |
+
$options_error_called = true;
|
1448 |
+
});
|
1449 |
+
$options->complete(function ($instance) use (&$options_complete_called) {
|
1450 |
+
$options_complete_called = true;
|
1451 |
+
});
|
1452 |
+
|
1453 |
+
$patch_before_send_called = false;
|
1454 |
+
$patch_success_called = false;
|
1455 |
+
$patch_error_called = false;
|
1456 |
+
$patch_complete_called = false;
|
1457 |
+
$patch = $multi_curl->addPatch(Test::TEST_URL);
|
1458 |
+
$patch->beforeSend(function ($instance) use (&$patch_before_send_called) {
|
1459 |
+
$patch_before_send_called = true;
|
1460 |
+
});
|
1461 |
+
$patch->success(function ($instance) use (&$patch_success_called) {
|
1462 |
+
$patch_success_called = true;
|
1463 |
+
});
|
1464 |
+
$patch->error(function ($instance) use (&$patch_error_called) {
|
1465 |
+
$patch_error_called = true;
|
1466 |
+
});
|
1467 |
+
$patch->complete(function ($instance) use (&$patch_complete_called) {
|
1468 |
+
$patch_complete_called = true;
|
1469 |
+
});
|
1470 |
+
|
1471 |
+
$post_before_send_called = false;
|
1472 |
+
$post_success_called = false;
|
1473 |
+
$post_error_called = false;
|
1474 |
+
$post_complete_called = false;
|
1475 |
+
$post = $multi_curl->addPost(Test::TEST_URL);
|
1476 |
+
$post->beforeSend(function ($instance) use (&$post_before_send_called) {
|
1477 |
+
$post_before_send_called = true;
|
1478 |
+
});
|
1479 |
+
$post->success(function ($instance) use (&$post_success_called) {
|
1480 |
+
$post_success_called = true;
|
1481 |
+
});
|
1482 |
+
$post->error(function ($instance) use (&$post_error_called) {
|
1483 |
+
$post_error_called = true;
|
1484 |
+
});
|
1485 |
+
$post->complete(function ($instance) use (&$post_complete_called) {
|
1486 |
+
$post_complete_called = true;
|
1487 |
+
});
|
1488 |
+
|
1489 |
+
$put_before_send_called = false;
|
1490 |
+
$put_success_called = false;
|
1491 |
+
$put_error_called = false;
|
1492 |
+
$put_complete_called = false;
|
1493 |
+
$put = $multi_curl->addPut(Test::TEST_URL);
|
1494 |
+
$put->beforeSend(function ($instance) use (&$put_before_send_called) {
|
1495 |
+
$put_before_send_called = true;
|
1496 |
+
});
|
1497 |
+
$put->success(function ($instance) use (&$put_success_called) {
|
1498 |
+
$put_success_called = true;
|
1499 |
+
});
|
1500 |
+
$put->error(function ($instance) use (&$put_error_called) {
|
1501 |
+
$put_error_called = true;
|
1502 |
+
});
|
1503 |
+
$put->complete(function ($instance) use (&$put_complete_called) {
|
1504 |
+
$put_complete_called = true;
|
1505 |
+
});
|
1506 |
+
|
1507 |
+
$multi_curl->start();
|
1508 |
+
|
1509 |
+
$this->assertTrue($delete_before_send_called);
|
1510 |
+
$this->assertTrue($delete_success_called);
|
1511 |
+
$this->assertFalse($delete_error_called);
|
1512 |
+
$this->assertTrue($delete_complete_called);
|
1513 |
+
|
1514 |
+
$this->assertTrue($download_before_send_called);
|
1515 |
+
$this->assertTrue($download_success_called);
|
1516 |
+
$this->assertFalse($download_error_called);
|
1517 |
+
$this->assertTrue($download_complete_called);
|
1518 |
+
$this->assertTrue(unlink($download_file_path));
|
1519 |
+
|
1520 |
+
$this->assertTrue($get_before_send_called);
|
1521 |
+
$this->assertTrue($get_success_called);
|
1522 |
+
$this->assertFalse($get_error_called);
|
1523 |
+
$this->assertTrue($get_complete_called);
|
1524 |
+
|
1525 |
+
$this->assertTrue($head_before_send_called);
|
1526 |
+
$this->assertTrue($head_success_called);
|
1527 |
+
$this->assertFalse($head_error_called);
|
1528 |
+
$this->assertTrue($head_complete_called);
|
1529 |
+
|
1530 |
+
$this->assertTrue($options_before_send_called);
|
1531 |
+
$this->assertTrue($options_success_called);
|
1532 |
+
$this->assertFalse($options_error_called);
|
1533 |
+
$this->assertTrue($options_complete_called);
|
1534 |
+
|
1535 |
+
$this->assertTrue($patch_before_send_called);
|
1536 |
+
$this->assertTrue($patch_success_called);
|
1537 |
+
$this->assertFalse($patch_error_called);
|
1538 |
+
$this->assertTrue($patch_complete_called);
|
1539 |
+
|
1540 |
+
$this->assertTrue($post_before_send_called);
|
1541 |
+
$this->assertTrue($post_success_called);
|
1542 |
+
$this->assertFalse($post_error_called);
|
1543 |
+
$this->assertTrue($post_complete_called);
|
1544 |
+
|
1545 |
+
$this->assertTrue($put_before_send_called);
|
1546 |
+
$this->assertTrue($put_success_called);
|
1547 |
+
$this->assertFalse($put_error_called);
|
1548 |
+
$this->assertTrue($put_complete_called);
|
1549 |
+
}
|
1550 |
+
|
1551 |
+
public function testCurlCallbackAddedAfter()
|
1552 |
+
{
|
1553 |
+
$delete_before_send_called = false;
|
1554 |
+
$delete_success_called = false;
|
1555 |
+
$delete_error_called = false;
|
1556 |
+
$delete_complete_called = false;
|
1557 |
+
$multi_curl = new MultiCurl();
|
1558 |
+
$multi_curl->addDelete(Test::TEST_URL);
|
1559 |
+
$multi_curl->beforeSend(function ($instance) use (&$delete_before_send_called) {
|
1560 |
+
$delete_before_send_called = true;
|
1561 |
+
});
|
1562 |
+
$multi_curl->success(function ($instance) use (&$delete_success_called) {
|
1563 |
+
$delete_success_called = true;
|
1564 |
+
});
|
1565 |
+
$multi_curl->error(function ($instance) use (&$delete_error_called) {
|
1566 |
+
$delete_error_called = true;
|
1567 |
+
});
|
1568 |
+
$multi_curl->complete(function ($instance) use (&$delete_complete_called) {
|
1569 |
+
$delete_complete_called = true;
|
1570 |
+
});
|
1571 |
+
$multi_curl->start();
|
1572 |
+
$this->assertTrue($delete_before_send_called);
|
1573 |
+
$this->assertTrue($delete_success_called);
|
1574 |
+
$this->assertFalse($delete_error_called);
|
1575 |
+
$this->assertTrue($delete_complete_called);
|
1576 |
+
|
1577 |
+
$download_before_send_called = false;
|
1578 |
+
$download_success_called = false;
|
1579 |
+
$download_error_called = false;
|
1580 |
+
$download_complete_called = false;
|
1581 |
+
$download_file_path = tempnam('/tmp', 'php-curl-class.');
|
1582 |
+
$multi_curl = new MultiCurl();
|
1583 |
+
$multi_curl->addDownload(Test::TEST_URL, $download_file_path);
|
1584 |
+
$multi_curl->beforeSend(function ($instance) use (&$download_before_send_called) {
|
1585 |
+
$download_before_send_called = true;
|
1586 |
+
});
|
1587 |
+
$multi_curl->success(function ($instance) use (&$download_success_called) {
|
1588 |
+
$download_success_called = true;
|
1589 |
+
});
|
1590 |
+
$multi_curl->error(function ($instance) use (&$download_error_called) {
|
1591 |
+
$download_error_called = true;
|
1592 |
+
});
|
1593 |
+
$multi_curl->complete(function ($instance) use (&$download_complete_called) {
|
1594 |
+
$download_complete_called = true;
|
1595 |
+
});
|
1596 |
+
$multi_curl->start();
|
1597 |
+
$this->assertTrue($download_before_send_called);
|
1598 |
+
$this->assertTrue($download_success_called);
|
1599 |
+
$this->assertFalse($download_error_called);
|
1600 |
+
$this->assertTrue($download_complete_called);
|
1601 |
+
$this->assertTrue(unlink($download_file_path));
|
1602 |
+
|
1603 |
+
$get_before_send_called = false;
|
1604 |
+
$get_success_called = false;
|
1605 |
+
$get_error_called = false;
|
1606 |
+
$get_complete_called = false;
|
1607 |
+
$multi_curl = new MultiCurl();
|
1608 |
+
$multi_curl->addGet(Test::TEST_URL);
|
1609 |
+
$multi_curl->beforeSend(function ($instance) use (&$get_before_send_called) {
|
1610 |
+
$get_before_send_called = true;
|
1611 |
+
});
|
1612 |
+
$multi_curl->success(function ($instance) use (&$get_success_called) {
|
1613 |
+
$get_success_called = true;
|
1614 |
+
});
|
1615 |
+
$multi_curl->error(function ($instance) use (&$get_error_called) {
|
1616 |
+
$get_error_called = true;
|
1617 |
+
});
|
1618 |
+
$multi_curl->complete(function ($instance) use (&$get_complete_called) {
|
1619 |
+
$get_complete_called = true;
|
1620 |
+
});
|
1621 |
+
$multi_curl->start();
|
1622 |
+
$this->assertTrue($get_before_send_called);
|
1623 |
+
$this->assertTrue($get_success_called);
|
1624 |
+
$this->assertFalse($get_error_called);
|
1625 |
+
$this->assertTrue($get_complete_called);
|
1626 |
+
|
1627 |
+
$head_before_send_called = false;
|
1628 |
+
$head_success_called = false;
|
1629 |
+
$head_error_called = false;
|
1630 |
+
$head_complete_called = false;
|
1631 |
+
$multi_curl = new MultiCurl();
|
1632 |
+
$multi_curl->addHead(Test::TEST_URL);
|
1633 |
+
$multi_curl->beforeSend(function ($instance) use (&$head_before_send_called) {
|
1634 |
+
$head_before_send_called = true;
|
1635 |
+
});
|
1636 |
+
$multi_curl->success(function ($instance) use (&$head_success_called) {
|
1637 |
+
$head_success_called = true;
|
1638 |
+
});
|
1639 |
+
$multi_curl->error(function ($instance) use (&$head_error_called) {
|
1640 |
+
$head_error_called = true;
|
1641 |
+
});
|
1642 |
+
$multi_curl->complete(function ($instance) use (&$head_complete_called) {
|
1643 |
+
$head_complete_called = true;
|
1644 |
+
});
|
1645 |
+
$multi_curl->start();
|
1646 |
+
$this->assertTrue($head_before_send_called);
|
1647 |
+
$this->assertTrue($head_success_called);
|
1648 |
+
$this->assertFalse($head_error_called);
|
1649 |
+
$this->assertTrue($head_complete_called);
|
1650 |
+
|
1651 |
+
$options_before_send_called = false;
|
1652 |
+
$options_success_called = false;
|
1653 |
+
$options_error_called = false;
|
1654 |
+
$options_complete_called = false;
|
1655 |
+
$multi_curl = new MultiCurl();
|
1656 |
+
$multi_curl->addOptions(Test::TEST_URL);
|
1657 |
+
$multi_curl->beforeSend(function ($instance) use (&$options_before_send_called) {
|
1658 |
+
$options_before_send_called = true;
|
1659 |
+
});
|
1660 |
+
$multi_curl->success(function ($instance) use (&$options_success_called) {
|
1661 |
+
$options_success_called = true;
|
1662 |
+
});
|
1663 |
+
$multi_curl->error(function ($instance) use (&$options_error_called) {
|
1664 |
+
$options_error_called = true;
|
1665 |
+
});
|
1666 |
+
$multi_curl->complete(function ($instance) use (&$options_complete_called) {
|
1667 |
+
$options_complete_called = true;
|
1668 |
+
});
|
1669 |
+
$multi_curl->start();
|
1670 |
+
$this->assertTrue($options_before_send_called);
|
1671 |
+
$this->assertTrue($options_success_called);
|
1672 |
+
$this->assertFalse($options_error_called);
|
1673 |
+
$this->assertTrue($options_complete_called);
|
1674 |
+
|
1675 |
+
$patch_before_send_called = false;
|
1676 |
+
$patch_success_called = false;
|
1677 |
+
$patch_error_called = false;
|
1678 |
+
$patch_complete_called = false;
|
1679 |
+
$multi_curl = new MultiCurl();
|
1680 |
+
$multi_curl->addPatch(Test::TEST_URL);
|
1681 |
+
$multi_curl->beforeSend(function ($instance) use (&$patch_before_send_called) {
|
1682 |
+
$patch_before_send_called = true;
|
1683 |
+
});
|
1684 |
+
$multi_curl->success(function ($instance) use (&$patch_success_called) {
|
1685 |
+
$patch_success_called = true;
|
1686 |
+
});
|
1687 |
+
$multi_curl->error(function ($instance) use (&$patch_error_called) {
|
1688 |
+
$patch_error_called = true;
|
1689 |
+
});
|
1690 |
+
$multi_curl->complete(function ($instance) use (&$patch_complete_called) {
|
1691 |
+
$patch_complete_called = true;
|
1692 |
+
});
|
1693 |
+
$multi_curl->start();
|
1694 |
+
$this->assertTrue($patch_before_send_called);
|
1695 |
+
$this->assertTrue($patch_success_called);
|
1696 |
+
$this->assertFalse($patch_error_called);
|
1697 |
+
$this->assertTrue($patch_complete_called);
|
1698 |
+
|
1699 |
+
$post_before_send_called = false;
|
1700 |
+
$post_success_called = false;
|
1701 |
+
$post_error_called = false;
|
1702 |
+
$post_complete_called = false;
|
1703 |
+
$multi_curl = new MultiCurl();
|
1704 |
+
$multi_curl->addPost(Test::TEST_URL);
|
1705 |
+
$multi_curl->beforeSend(function ($instance) use (&$post_before_send_called) {
|
1706 |
+
$post_before_send_called = true;
|
1707 |
+
});
|
1708 |
+
$multi_curl->success(function ($instance) use (&$post_success_called) {
|
1709 |
+
$post_success_called = true;
|
1710 |
+
});
|
1711 |
+
$multi_curl->error(function ($instance) use (&$post_error_called) {
|
1712 |
+
$post_error_called = true;
|
1713 |
+
});
|
1714 |
+
$multi_curl->complete(function ($instance) use (&$post_complete_called) {
|
1715 |
+
$post_complete_called = true;
|
1716 |
+
});
|
1717 |
+
$multi_curl->start();
|
1718 |
+
$this->assertTrue($post_before_send_called);
|
1719 |
+
$this->assertTrue($post_success_called);
|
1720 |
+
$this->assertFalse($post_error_called);
|
1721 |
+
$this->assertTrue($post_complete_called);
|
1722 |
+
|
1723 |
+
$put_before_send_called = false;
|
1724 |
+
$put_success_called = false;
|
1725 |
+
$put_error_called = false;
|
1726 |
+
$put_complete_called = false;
|
1727 |
+
$multi_curl = new MultiCurl();
|
1728 |
+
$multi_curl->addPut(Test::TEST_URL);
|
1729 |
+
$multi_curl->beforeSend(function ($instance) use (&$put_before_send_called) {
|
1730 |
+
$put_before_send_called = true;
|
1731 |
+
});
|
1732 |
+
$multi_curl->success(function ($instance) use (&$put_success_called) {
|
1733 |
+
$put_success_called = true;
|
1734 |
+
});
|
1735 |
+
$multi_curl->error(function ($instance) use (&$put_error_called) {
|
1736 |
+
$put_error_called = true;
|
1737 |
+
});
|
1738 |
+
$multi_curl->complete(function ($instance) use (&$put_complete_called) {
|
1739 |
+
$put_complete_called = true;
|
1740 |
+
});
|
1741 |
+
$multi_curl->start();
|
1742 |
+
$this->assertTrue($put_before_send_called);
|
1743 |
+
$this->assertTrue($put_success_called);
|
1744 |
+
$this->assertFalse($put_error_called);
|
1745 |
+
$this->assertTrue($put_complete_called);
|
1746 |
+
}
|
1747 |
+
|
1748 |
+
public function testSetOptAndSetOptOverride()
|
1749 |
+
{
|
1750 |
+
$multi_curl_user_agent = 'multi curl user agent';
|
1751 |
+
$curl_user_agent = 'curl user agent';
|
1752 |
+
$data = array('key' => 'HTTP_USER_AGENT');
|
1753 |
+
|
1754 |
+
$multi_curl = new MultiCurl();
|
1755 |
+
$multi_curl->setHeader('X-DEBUG-TEST', 'server');
|
1756 |
+
$multi_curl->setOpt(CURLOPT_USERAGENT, $multi_curl_user_agent);
|
1757 |
+
|
1758 |
+
$get_1 = $multi_curl->addGet(Test::TEST_URL, $data);
|
1759 |
+
$get_1->complete(function ($instance) use ($multi_curl_user_agent) {
|
1760 |
+
PHPUnit_Framework_Assert::assertInstanceOf('Curl\Curl', $instance);
|
1761 |
+
PHPUnit_Framework_Assert::assertEquals($multi_curl_user_agent, $instance->getOpt(CURLOPT_USERAGENT));
|
1762 |
+
PHPUnit_Framework_Assert::assertEquals($multi_curl_user_agent, $instance->response);
|
1763 |
+
});
|
1764 |
+
|
1765 |
+
$get_2 = $multi_curl->addGet(Test::TEST_URL, $data);
|
1766 |
+
$get_2->beforeSend(function ($instance) use ($curl_user_agent) {
|
1767 |
+
$instance->setOpt(CURLOPT_USERAGENT, $curl_user_agent);
|
1768 |
+
});
|
1769 |
+
$get_2->complete(function ($instance) use ($curl_user_agent) {
|
1770 |
+
PHPUnit_Framework_Assert::assertInstanceOf('Curl\Curl', $instance);
|
1771 |
+
PHPUnit_Framework_Assert::assertEquals($curl_user_agent, $instance->getOpt(CURLOPT_USERAGENT));
|
1772 |
+
PHPUnit_Framework_Assert::assertEquals($curl_user_agent, $instance->response);
|
1773 |
+
});
|
1774 |
+
|
1775 |
+
$multi_curl->start();
|
1776 |
+
|
1777 |
+
$this->assertEquals($multi_curl_user_agent, $multi_curl->getOpt(CURLOPT_USERAGENT));
|
1778 |
+
$this->assertEquals($multi_curl_user_agent, $get_1->getOpt(CURLOPT_USERAGENT));
|
1779 |
+
$this->assertEquals($multi_curl_user_agent, $get_1->response);
|
1780 |
+
$this->assertEquals($curl_user_agent, $get_2->getOpt(CURLOPT_USERAGENT));
|
1781 |
+
$this->assertEquals($curl_user_agent, $get_2->response);
|
1782 |
+
}
|
1783 |
+
|
1784 |
+
public function testBasicHttpAuthSuccess()
|
1785 |
+
{
|
1786 |
+
$username1 = 'myusername';
|
1787 |
+
$password1 = 'mypassword';
|
1788 |
+
$username2 = 'myotherusername';
|
1789 |
+
$password2 = 'myotherpassword';
|
1790 |
+
|
1791 |
+
$multi_curl = new MultiCurl();
|
1792 |
+
$multi_curl->setHeader('X-DEBUG-TEST', 'http_basic_auth');
|
1793 |
+
$multi_curl->setBasicAuthentication($username1, $password1);
|
1794 |
+
|
1795 |
+
$get_1 = $multi_curl->addGet(Test::TEST_URL);
|
1796 |
+
$get_1->complete(function ($instance) use ($username1, $password1) {
|
1797 |
+
PHPUnit_Framework_Assert::assertInstanceOf('Curl\Curl', $instance);
|
1798 |
+
PHPUnit_Framework_Assert::assertEquals($username1, $instance->response->username);
|
1799 |
+
PHPUnit_Framework_Assert::assertEquals($password1, $instance->response->password);
|
1800 |
+
});
|
1801 |
+
|
1802 |
+
$get_2 = $multi_curl->addGet(Test::TEST_URL);
|
1803 |
+
$get_2->beforeSend(function ($instance) use ($username2, $password2) {
|
1804 |
+
$instance->setBasicAuthentication($username2, $password2);
|
1805 |
+
});
|
1806 |
+
$get_2->complete(function ($instance) use ($username2, $password2) {
|
1807 |
+
PHPUnit_Framework_Assert::assertInstanceOf('Curl\Curl', $instance);
|
1808 |
+
PHPUnit_Framework_Assert::assertEquals($username2, $instance->response->username);
|
1809 |
+
PHPUnit_Framework_Assert::assertEquals($password2, $instance->response->password);
|
1810 |
+
});
|
1811 |
+
|
1812 |
+
$multi_curl->start();
|
1813 |
+
|
1814 |
+
$this->assertEquals(CURLAUTH_BASIC, $multi_curl->getOpt(CURLOPT_HTTPAUTH));
|
1815 |
+
$this->assertEquals(CURLAUTH_BASIC, $get_1->getOpt(CURLOPT_HTTPAUTH));
|
1816 |
+
$this->assertEquals($username1, $get_1->response->username);
|
1817 |
+
$this->assertEquals($password1, $get_1->response->password);
|
1818 |
+
$this->assertEquals(CURLAUTH_BASIC, $get_2->getOpt(CURLOPT_HTTPAUTH));
|
1819 |
+
$this->assertEquals($username2, $get_2->response->username);
|
1820 |
+
$this->assertEquals($password2, $get_2->response->password);
|
1821 |
+
}
|
1822 |
+
|
1823 |
+
public function testDigestHttpAuthSuccess()
|
1824 |
+
{
|
1825 |
+
// Skip Digest Access Authentication test on HHVM.
|
1826 |
+
// https://github.com/facebook/hhvm/issues/5201
|
1827 |
+
if (defined('HHVM_VERSION')) {
|
1828 |
+
return;
|
1829 |
+
}
|
1830 |
+
|
1831 |
+
$username = 'myusername';
|
1832 |
+
$password = 'mypassword';
|
1833 |
+
$invalid_password = 'anotherpassword';
|
1834 |
+
|
1835 |
+
// Ensure that http digest returns canceled when not using any http digest authentication.
|
1836 |
+
$multi_curl = new MultiCurl();
|
1837 |
+
$multi_curl->setHeader('X-DEBUG-TEST', 'http_digest_auth');
|
1838 |
+
|
1839 |
+
$get_1 = $multi_curl->addGet(Test::TEST_URL);
|
1840 |
+
$get_1->complete(function ($instance) {
|
1841 |
+
PHPUnit_Framework_Assert::assertEquals('canceled', $instance->response);
|
1842 |
+
PHPUnit_Framework_Assert::assertEquals(401, $instance->httpStatusCode);
|
1843 |
+
});
|
1844 |
+
|
1845 |
+
$multi_curl->start();
|
1846 |
+
|
1847 |
+
// Ensure that http digest returns invalid when using incorrect http digest authentication.
|
1848 |
+
$multi_curl = new MultiCurl();
|
1849 |
+
$multi_curl->setHeader('X-DEBUG-TEST', 'http_digest_auth');
|
1850 |
+
$multi_curl->setDigestAuthentication($username, $invalid_password);
|
1851 |
+
$this->assertEquals(CURLAUTH_DIGEST, $multi_curl->getOpt(CURLOPT_HTTPAUTH));
|
1852 |
+
|
1853 |
+
$get_1 = $multi_curl->addGet(Test::TEST_URL);
|
1854 |
+
$get_1->complete(function ($instance) {
|
1855 |
+
PHPUnit_Framework_Assert::assertEquals(CURLAUTH_DIGEST, $instance->getOpt(CURLOPT_HTTPAUTH));
|
1856 |
+
PHPUnit_Framework_Assert::assertEquals('invalid', $instance->response);
|
1857 |
+
PHPUnit_Framework_Assert::assertEquals(401, $instance->httpStatusCode);
|
1858 |
+
});
|
1859 |
+
|
1860 |
+
$multi_curl->start();
|
1861 |
+
|
1862 |
+
// Ensure that http digest returns valid when using correct http digest authentication.
|
1863 |
+
$multi_curl = new MultiCurl();
|
1864 |
+
$multi_curl->setHeader('X-DEBUG-TEST', 'http_digest_auth');
|
1865 |
+
$multi_curl->setDigestAuthentication($username, $password);
|
1866 |
+
$this->assertEquals(CURLAUTH_DIGEST, $multi_curl->getOpt(CURLOPT_HTTPAUTH));
|
1867 |
+
|
1868 |
+
$get_1 = $multi_curl->addGet(Test::TEST_URL);
|
1869 |
+
$get_1->complete(function ($instance) {
|
1870 |
+
PHPUnit_Framework_Assert::assertEquals(CURLAUTH_DIGEST, $instance->getOpt(CURLOPT_HTTPAUTH));
|
1871 |
+
PHPUnit_Framework_Assert::assertEquals('valid', $instance->response);
|
1872 |
+
PHPUnit_Framework_Assert::assertEquals(200, $instance->httpStatusCode);
|
1873 |
+
});
|
1874 |
+
|
1875 |
+
$multi_curl->start();
|
1876 |
+
|
1877 |
+
// Ensure that http digest can return both invalid and valid when using
|
1878 |
+
// incorrect and correct authentication in the same MultiCurl.
|
1879 |
+
$multi_curl = new MultiCurl();
|
1880 |
+
$multi_curl->setHeader('X-DEBUG-TEST', 'http_digest_auth');
|
1881 |
+
$multi_curl->setDigestAuthentication($username, $password);
|
1882 |
+
$this->assertEquals(CURLAUTH_DIGEST, $multi_curl->getOpt(CURLOPT_HTTPAUTH));
|
1883 |
+
|
1884 |
+
$get_1 = $multi_curl->addGet(Test::TEST_URL);
|
1885 |
+
$get_1->beforeSend(function ($instance) use ($username, $invalid_password) {
|
1886 |
+
$instance->setDigestAuthentication($username, $invalid_password);
|
1887 |
+
PHPUnit_Framework_Assert::assertEquals(CURLAUTH_DIGEST, $instance->getOpt(CURLOPT_HTTPAUTH));
|
1888 |
+
});
|
1889 |
+
$get_1->complete(function ($instance) {
|
1890 |
+
PHPUnit_Framework_Assert::assertEquals(CURLAUTH_DIGEST, $instance->getOpt(CURLOPT_HTTPAUTH));
|
1891 |
+
PHPUnit_Framework_Assert::assertEquals('invalid', $instance->response);
|
1892 |
+
PHPUnit_Framework_Assert::assertEquals(401, $instance->httpStatusCode);
|
1893 |
+
});
|
1894 |
+
|
1895 |
+
$get_2 = $multi_curl->addGet(Test::TEST_URL);
|
1896 |
+
$get_2->complete(function ($instance) {
|
1897 |
+
PHPUnit_Framework_Assert::assertEquals(CURLAUTH_DIGEST, $instance->getOpt(CURLOPT_HTTPAUTH));
|
1898 |
+
PHPUnit_Framework_Assert::assertEquals('valid', $instance->response);
|
1899 |
+
PHPUnit_Framework_Assert::assertEquals(200, $instance->httpStatusCode);
|
1900 |
+
});
|
1901 |
+
|
1902 |
+
$multi_curl->start();
|
1903 |
+
}
|
1904 |
+
|
1905 |
+
public function testCookies()
|
1906 |
+
{
|
1907 |
+
$data = array('key' => 'mycookie');
|
1908 |
+
|
1909 |
+
$multi_curl = new MultiCurl();
|
1910 |
+
$multi_curl->setHeader('X-DEBUG-TEST', 'cookie');
|
1911 |
+
$multi_curl->setCookie('mycookie', 'yum');
|
1912 |
+
|
1913 |
+
$get_1 = $multi_curl->addGet(Test::TEST_URL, $data);
|
1914 |
+
$get_1->complete(function ($instance) {
|
1915 |
+
PHPUnit_Framework_Assert::assertInstanceOf('Curl\Curl', $instance);
|
1916 |
+
PHPUnit_Framework_Assert::assertEquals('yum', $instance->response);
|
1917 |
+
});
|
1918 |
+
|
1919 |
+
$get_2 = $multi_curl->addGet(Test::TEST_URL, $data);
|
1920 |
+
$get_2->beforeSend(function ($instance) {
|
1921 |
+
$instance->setCookie('mycookie', 'yummy');
|
1922 |
+
});
|
1923 |
+
$get_2->complete(function ($instance) {
|
1924 |
+
PHPUnit_Framework_Assert::assertInstanceOf('Curl\Curl', $instance);
|
1925 |
+
PHPUnit_Framework_Assert::assertEquals('yummy', $instance->response);
|
1926 |
+
});
|
1927 |
+
|
1928 |
+
$multi_curl->start();
|
1929 |
+
|
1930 |
+
$this->assertEquals('yum', $get_1->response);
|
1931 |
+
$this->assertEquals('yummy', $get_2->response);
|
1932 |
+
}
|
1933 |
+
|
1934 |
+
public function testJSONDecoder()
|
1935 |
+
{
|
1936 |
+
$multi_curl = new MultiCurl();
|
1937 |
+
$multi_curl->setHeader('X-DEBUG-TEST', 'json_response');
|
1938 |
+
$multi_curl->setJsonDecoder(function($response) {
|
1939 |
+
return 'foo';
|
1940 |
+
});
|
1941 |
+
|
1942 |
+
$get_1 = $multi_curl->addGet(Test::TEST_URL);
|
1943 |
+
$get_1->complete(function ($instance) {
|
1944 |
+
PHPUnit_Framework_Assert::assertInstanceOf('Curl\Curl', $instance);
|
1945 |
+
PHPUnit_Framework_Assert::assertEquals('foo', $instance->response);
|
1946 |
+
});
|
1947 |
+
|
1948 |
+
$get_2 = $multi_curl->addGet(Test::TEST_URL);
|
1949 |
+
$get_2->beforeSend(function ($instance) {
|
1950 |
+
$instance->setJsonDecoder(function($response) {
|
1951 |
+
return 'bar';
|
1952 |
+
});
|
1953 |
+
});
|
1954 |
+
$get_2->complete(function ($instance) {
|
1955 |
+
PHPUnit_Framework_Assert::assertInstanceOf('Curl\Curl', $instance);
|
1956 |
+
PHPUnit_Framework_Assert::assertEquals('bar', $instance->response);
|
1957 |
+
});
|
1958 |
+
|
1959 |
+
$multi_curl->start();
|
1960 |
+
$this->assertEquals('foo', $get_1->response);
|
1961 |
+
$this->assertEquals('bar', $get_2->response);
|
1962 |
+
}
|
1963 |
+
|
1964 |
+
public function testXMLDecoder()
|
1965 |
+
{
|
1966 |
+
$multi_curl = new MultiCurl();
|
1967 |
+
$multi_curl->setHeader('X-DEBUG-TEST', 'xml_with_cdata_response');
|
1968 |
+
$multi_curl->setXmlDecoder(function($response) {
|
1969 |
+
return 'foo';
|
1970 |
+
});
|
1971 |
+
|
1972 |
+
$get_1 = $multi_curl->addGet(Test::TEST_URL);
|
1973 |
+
$get_1->complete(function ($instance) {
|
1974 |
+
PHPUnit_Framework_Assert::assertInstanceOf('Curl\Curl', $instance);
|
1975 |
+
PHPUnit_Framework_Assert::assertEquals('foo', $instance->response);
|
1976 |
+
});
|
1977 |
+
|
1978 |
+
$get_2 = $multi_curl->addGet(Test::TEST_URL);
|
1979 |
+
$get_2->beforeSend(function ($instance) {
|
1980 |
+
$instance->setXmlDecoder(function($response) {
|
1981 |
+
return 'bar';
|
1982 |
+
});
|
1983 |
+
});
|
1984 |
+
$get_2->complete(function ($instance) {
|
1985 |
+
PHPUnit_Framework_Assert::assertInstanceOf('Curl\Curl', $instance);
|
1986 |
+
PHPUnit_Framework_Assert::assertEquals('bar', $instance->response);
|
1987 |
+
});
|
1988 |
+
|
1989 |
+
$multi_curl->start();
|
1990 |
+
$this->assertEquals('foo', $get_1->response);
|
1991 |
+
$this->assertEquals('bar', $get_2->response);
|
1992 |
+
}
|
1993 |
+
|
1994 |
+
public function testDownloadCallback()
|
1995 |
+
{
|
1996 |
+
// Upload a file.
|
1997 |
+
$upload_file_path = Helper\get_png();
|
1998 |
+
$upload_test = new Test();
|
1999 |
+
$upload_test->server('upload_response', 'POST', array(
|
2000 |
+
'image' => '@' . $upload_file_path,
|
2001 |
+
));
|
2002 |
+
$uploaded_file_path = $upload_test->curl->response->file_path;
|
2003 |
+
|
2004 |
+
// Download the file.
|
2005 |
+
$download_callback_called = false;
|
2006 |
+
$multi_curl = new MultiCurl();
|
2007 |
+
$multi_curl->setHeader('X-DEBUG-TEST', 'download_response');
|
2008 |
+
$multi_curl->addDownload(Test::TEST_URL . '?' . http_build_query(array(
|
2009 |
+
'file_path' => $uploaded_file_path,
|
2010 |
+
)), function($instance, $fh) use (&$download_callback_called) {
|
2011 |
+
PHPUnit_Framework_Assert::assertFalse($download_callback_called);
|
2012 |
+
PHPUnit_Framework_Assert::assertInstanceOf('Curl\Curl', $instance);
|
2013 |
+
PHPUnit_Framework_Assert::assertTrue(is_resource($fh));
|
2014 |
+
PHPUnit_Framework_Assert::assertEquals('stream', get_resource_type($fh));
|
2015 |
+
PHPUnit_Framework_Assert::assertGreaterThan(0, strlen(stream_get_contents($fh)));
|
2016 |
+
PHPUnit_Framework_Assert::assertEquals(0, strlen(stream_get_contents($fh)));
|
2017 |
+
PHPUnit_Framework_Assert::assertTrue(fclose($fh));
|
2018 |
+
$download_callback_called = true;
|
2019 |
+
});
|
2020 |
+
$multi_curl->start();
|
2021 |
+
$this->assertTrue($download_callback_called);
|
2022 |
+
|
2023 |
+
// Remove server file.
|
2024 |
+
$this->assertEquals('true', $upload_test->server('upload_cleanup', 'POST', array(
|
2025 |
+
'file_path' => $uploaded_file_path,
|
2026 |
+
)));
|
2027 |
+
|
2028 |
+
unlink($upload_file_path);
|
2029 |
+
$this->assertFalse(file_exists($upload_file_path));
|
2030 |
+
$this->assertFalse(file_exists($uploaded_file_path));
|
2031 |
+
}
|
2032 |
+
|
2033 |
+
public function testDownloadCallbackError()
|
2034 |
+
{
|
2035 |
+
$download_before_send_called = false;
|
2036 |
+
$download_callback_called = false;
|
2037 |
+
$multi_curl = new MultiCurl();
|
2038 |
+
$multi_curl->beforeSend(function ($instance) use (&$download_before_send_called) {
|
2039 |
+
PHPUnit_Framework_Assert::assertFalse($download_before_send_called);
|
2040 |
+
$download_before_send_called = true;
|
2041 |
+
});
|
2042 |
+
$multi_curl->addDownload(Test::ERROR_URL, function($instance, $fh) use (&$download_callback_called) {
|
2043 |
+
$download_callback_called = true;
|
2044 |
+
});
|
2045 |
+
$multi_curl->start();
|
2046 |
+
$this->assertTrue($download_before_send_called);
|
2047 |
+
$this->assertFalse($download_callback_called);
|
2048 |
+
}
|
2049 |
+
|
2050 |
+
public function testSetUrlInConstructor()
|
2051 |
+
{
|
2052 |
+
$data = array('key' => 'value');
|
2053 |
+
|
2054 |
+
$multi_curl = new MultiCurl(Test::TEST_URL);
|
2055 |
+
$multi_curl->setHeader('X-DEBUG-TEST', 'delete_with_body');
|
2056 |
+
$multi_curl->addDelete($data, array('wibble' => 'wubble'))->complete(function($instance) {
|
2057 |
+
PHPUnit_Framework_Assert::assertEquals(Test::TEST_URL, $instance->baseUrl);
|
2058 |
+
PHPUnit_Framework_Assert::assertEquals('{"get":{"key":"value"},"delete":{"wibble":"wubble"}}',
|
2059 |
+
$instance->rawResponse);
|
2060 |
+
});
|
2061 |
+
$multi_curl->start();
|
2062 |
+
|
2063 |
+
$multi_curl = new MultiCurl(Test::TEST_URL);
|
2064 |
+
$multi_curl->setHeader('X-DEBUG-TEST', 'get');
|
2065 |
+
$multi_curl->addDelete($data)->complete(function($instance) {
|
2066 |
+
PHPUnit_Framework_Assert::assertEquals(Test::TEST_URL, $instance->baseUrl);
|
2067 |
+
PHPUnit_Framework_Assert::assertEquals('key=value', $instance->response);
|
2068 |
+
});
|
2069 |
+
$multi_curl->start();
|
2070 |
+
|
2071 |
+
$multi_curl = new MultiCurl(Test::TEST_URL);
|
2072 |
+
$multi_curl->setHeader('X-DEBUG-TEST', 'get');
|
2073 |
+
$multi_curl->addGet($data)->complete(function($instance) {
|
2074 |
+
PHPUnit_Framework_Assert::assertEquals(Test::TEST_URL, $instance->baseUrl);
|
2075 |
+
PHPUnit_Framework_Assert::assertEquals('key=value', $instance->response);
|
2076 |
+
});
|
2077 |
+
$multi_curl->start();
|
2078 |
+
|
2079 |
+
$multi_curl = new MultiCurl(Test::TEST_URL);
|
2080 |
+
$multi_curl->setHeader('X-DEBUG-TEST', 'get');
|
2081 |
+
$multi_curl->addHead($data)->complete(function($instance) {
|
2082 |
+
PHPUnit_Framework_Assert::assertEquals(Test::TEST_URL, $instance->baseUrl);
|
2083 |
+
PHPUnit_Framework_Assert::assertEquals(
|
2084 |
+
'HEAD /?key=value HTTP/1.1', $instance->requestHeaders['Request-Line']);
|
2085 |
+
});
|
2086 |
+
$multi_curl->start();
|
2087 |
+
|
2088 |
+
$multi_curl = new MultiCurl(Test::TEST_URL);
|
2089 |
+
$multi_curl->setHeader('X-DEBUG-TEST', 'get');
|
2090 |
+
$multi_curl->addOptions($data)->complete(function($instance) {
|
2091 |
+
PHPUnit_Framework_Assert::assertEquals(Test::TEST_URL, $instance->baseUrl);
|
2092 |
+
PHPUnit_Framework_Assert::assertEquals('key=value', $instance->response);
|
2093 |
+
});
|
2094 |
+
$multi_curl->start();
|
2095 |
+
|
2096 |
+
$multi_curl = new MultiCurl(Test::TEST_URL);
|
2097 |
+
$multi_curl->setHeader('X-DEBUG-TEST', 'request_method');
|
2098 |
+
$multi_curl->addPatch($data)->complete(function($instance) {
|
2099 |
+
PHPUnit_Framework_Assert::assertEquals(Test::TEST_URL, $instance->baseUrl);
|
2100 |
+
PHPUnit_Framework_Assert::assertEquals('PATCH', $instance->response);
|
2101 |
+
});
|
2102 |
+
$multi_curl->start();
|
2103 |
+
|
2104 |
+
$multi_curl = new MultiCurl(Test::TEST_URL);
|
2105 |
+
$multi_curl->setHeader('X-DEBUG-TEST', 'post');
|
2106 |
+
$multi_curl->addPost($data)->complete(function($instance) {
|
2107 |
+
PHPUnit_Framework_Assert::assertEquals(Test::TEST_URL, $instance->baseUrl);
|
2108 |
+
PHPUnit_Framework_Assert::assertEquals('key=value', $instance->response);
|
2109 |
+
});
|
2110 |
+
$multi_curl->start();
|
2111 |
+
|
2112 |
+
$multi_curl = new MultiCurl(Test::TEST_URL);
|
2113 |
+
$multi_curl->setHeader('X-DEBUG-TEST', 'put');
|
2114 |
+
$multi_curl->addPut($data)->complete(function($instance) {
|
2115 |
+
PHPUnit_Framework_Assert::assertEquals(Test::TEST_URL, $instance->baseUrl);
|
2116 |
+
PHPUnit_Framework_Assert::assertEquals('key=value', $instance->response);
|
2117 |
+
});
|
2118 |
+
$multi_curl->start();
|
2119 |
+
}
|
2120 |
+
|
2121 |
+
public function testSetUrl()
|
2122 |
+
{
|
2123 |
+
$data = array('key' => 'value');
|
2124 |
+
|
2125 |
+
$multi_curl = new MultiCurl();
|
2126 |
+
$multi_curl->setHeader('X-DEBUG-TEST', 'get');
|
2127 |
+
$multi_curl->setUrl(Test::TEST_URL);
|
2128 |
+
$multi_curl->addDelete($data)->complete(function($instance) {
|
2129 |
+
PHPUnit_Framework_Assert::assertEquals(Test::TEST_URL, $instance->baseUrl);
|
2130 |
+
PHPUnit_Framework_Assert::assertEquals('key=value', $instance->response);
|
2131 |
+
});
|
2132 |
+
$multi_curl->start();
|
2133 |
+
|
2134 |
+
$multi_curl = new MultiCurl();
|
2135 |
+
$multi_curl->setHeader('X-DEBUG-TEST', 'get');
|
2136 |
+
$multi_curl->setUrl(Test::TEST_URL);
|
2137 |
+
$multi_curl->addGet($data)->complete(function($instance) {
|
2138 |
+
PHPUnit_Framework_Assert::assertEquals(Test::TEST_URL, $instance->baseUrl);
|
2139 |
+
PHPUnit_Framework_Assert::assertEquals('key=value', $instance->response);
|
2140 |
+
});
|
2141 |
+
$multi_curl->start();
|
2142 |
+
|
2143 |
+
$multi_curl = new MultiCurl();
|
2144 |
+
$multi_curl->setHeader('X-DEBUG-TEST', 'get');
|
2145 |
+
$multi_curl->setUrl(Test::TEST_URL);
|
2146 |
+
$multi_curl->addHead($data)->complete(function($instance) {
|
2147 |
+
PHPUnit_Framework_Assert::assertEquals(Test::TEST_URL, $instance->baseUrl);
|
2148 |
+
PHPUnit_Framework_Assert::assertEquals(
|
2149 |
+
'HEAD /?key=value HTTP/1.1', $instance->requestHeaders['Request-Line']);
|
2150 |
+
});
|
2151 |
+
$multi_curl->start();
|
2152 |
+
|
2153 |
+
$multi_curl = new MultiCurl();
|
2154 |
+
$multi_curl->setHeader('X-DEBUG-TEST', 'get');
|
2155 |
+
$multi_curl->setUrl(Test::TEST_URL);
|
2156 |
+
$multi_curl->addOptions($data)->complete(function($instance) {
|
2157 |
+
PHPUnit_Framework_Assert::assertEquals(Test::TEST_URL, $instance->baseUrl);
|
2158 |
+
PHPUnit_Framework_Assert::assertEquals('key=value', $instance->response);
|
2159 |
+
});
|
2160 |
+
|
2161 |
+
$multi_curl = new MultiCurl();
|
2162 |
+
$multi_curl->setHeader('X-DEBUG-TEST', 'request_method');
|
2163 |
+
$multi_curl->setUrl(Test::TEST_URL);
|
2164 |
+
$multi_curl->addPatch($data)->complete(function($instance) {
|
2165 |
+
PHPUnit_Framework_Assert::assertEquals(Test::TEST_URL, $instance->baseUrl);
|
2166 |
+
PHPUnit_Framework_Assert::assertEquals('PATCH', $instance->response);
|
2167 |
+
});
|
2168 |
+
|
2169 |
+
$multi_curl = new MultiCurl();
|
2170 |
+
$multi_curl->setHeader('X-DEBUG-TEST', 'post');
|
2171 |
+
$multi_curl->setUrl(Test::TEST_URL);
|
2172 |
+
$multi_curl->addPost($data)->complete(function($instance) {
|
2173 |
+
PHPUnit_Framework_Assert::assertEquals(Test::TEST_URL, $instance->baseUrl);
|
2174 |
+
PHPUnit_Framework_Assert::assertEquals('key=value', $instance->response);
|
2175 |
+
});
|
2176 |
+
|
2177 |
+
$multi_curl = new MultiCurl();
|
2178 |
+
$multi_curl->setHeader('X-DEBUG-TEST', 'put');
|
2179 |
+
$multi_curl->setUrl(Test::TEST_URL);
|
2180 |
+
$multi_curl->addPut($data)->complete(function($instance) {
|
2181 |
+
PHPUnit_Framework_Assert::assertEquals(Test::TEST_URL, $instance->baseUrl);
|
2182 |
+
PHPUnit_Framework_Assert::assertEquals('key=value', $instance->response);
|
2183 |
+
});
|
2184 |
+
}
|
2185 |
+
|
2186 |
+
public function testAddRequestAfterStart() {
|
2187 |
+
$multi_curl = new MultiCurl();
|
2188 |
+
|
2189 |
+
$urls = array();
|
2190 |
+
$copy_of_urls = array();
|
2191 |
+
for ($i = 0; $i < 10; $i++) {
|
2192 |
+
$url = Test::TEST_URL . '?' . md5(mt_rand());
|
2193 |
+
$urls[] = $url;
|
2194 |
+
$copy_of_urls[] = $url;
|
2195 |
+
}
|
2196 |
+
|
2197 |
+
$urls_called = array();
|
2198 |
+
$multi_curl->complete(function ($instance) use (&$multi_curl, &$urls, &$urls_called) {
|
2199 |
+
$urls_called[] = $instance->url;
|
2200 |
+
$next_url = array_pop($urls);
|
2201 |
+
if (!($next_url === null)) {
|
2202 |
+
$multi_curl->addGet($next_url);
|
2203 |
+
}
|
2204 |
+
});
|
2205 |
+
|
2206 |
+
$multi_curl->addGet(array_pop($urls));
|
2207 |
+
$multi_curl->start();
|
2208 |
+
|
2209 |
+
$this->assertNotEmpty($copy_of_urls);
|
2210 |
+
$this->assertNotEmpty($urls_called);
|
2211 |
+
$this->assertEquals(count($copy_of_urls), count($urls_called));
|
2212 |
+
|
2213 |
+
foreach ($copy_of_urls as $url) {
|
2214 |
+
$this->assertTrue(in_array($url, $urls_called, true));
|
2215 |
+
}
|
2216 |
+
}
|
2217 |
+
|
2218 |
+
public function testClose()
|
2219 |
+
{
|
2220 |
+
$multi_curl = new MultiCurl();
|
2221 |
+
$multi_curl->addGet(Test::TEST_URL);
|
2222 |
+
$multi_curl->start();
|
2223 |
+
$this->assertTrue(is_resource($multi_curl->multiCurl));
|
2224 |
+
$multi_curl->close();
|
2225 |
+
$this->assertFalse(is_resource($multi_curl->multiCurl));
|
2226 |
+
}
|
2227 |
+
|
2228 |
+
public function testMultiPostRedirectGet()
|
2229 |
+
{
|
2230 |
+
// Deny post-redirect-get
|
2231 |
+
$multi_curl = new MultiCurl(Test::TEST_URL);
|
2232 |
+
$multi_curl->setOpt(CURLOPT_FOLLOWLOCATION, true);
|
2233 |
+
$multi_curl->setHeader('X-DEBUG-TEST', 'post_redirect_get');
|
2234 |
+
$multi_curl->addPost(array(), false)->complete(function($instance) {
|
2235 |
+
PHPUnit_Framework_Assert::assertEquals('Redirected: POST', $instance->response);
|
2236 |
+
});
|
2237 |
+
$multi_curl->start();
|
2238 |
+
|
2239 |
+
// Allow post-redirect-get
|
2240 |
+
$multi_curl = new MultiCurl(Test::TEST_URL);
|
2241 |
+
$multi_curl->setOpt(CURLOPT_FOLLOWLOCATION, true);
|
2242 |
+
$multi_curl->setHeader('X-DEBUG-TEST', 'post_redirect_get');
|
2243 |
+
$multi_curl->addPost(array(), true)->complete(function($instance) {
|
2244 |
+
PHPUnit_Framework_Assert::assertEquals('Redirected: GET', $instance->response);
|
2245 |
+
});
|
2246 |
+
$multi_curl->start();
|
2247 |
+
}
|
2248 |
+
|
2249 |
+
public function testAlternativeStandardErrorOutput()
|
2250 |
+
{
|
2251 |
+
|
2252 |
+
$buffer = fopen('php://memory', 'w+');
|
2253 |
+
|
2254 |
+
$multi_curl = new MultiCurl();
|
2255 |
+
$multi_curl->verbose(true, $buffer);
|
2256 |
+
$multi_curl->addGet(Test::TEST_URL);
|
2257 |
+
$multi_curl->start();
|
2258 |
+
|
2259 |
+
rewind($buffer);
|
2260 |
+
$stderr = stream_get_contents($buffer);
|
2261 |
+
fclose($buffer);
|
2262 |
+
|
2263 |
+
$this->assertNotEmpty($stderr);
|
2264 |
+
}
|
2265 |
+
}
|
app/code/community/Pay/Payment/vendor/php-curl-class/php-curl-class/tests/PHPCurlClass/server.php
ADDED
@@ -0,0 +1,310 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
require_once 'Helper.php';
|
3 |
+
|
4 |
+
use \Helper\Test;
|
5 |
+
|
6 |
+
$http_raw_post_data = file_get_contents('php://input');
|
7 |
+
$_PUT = array();
|
8 |
+
$_PATCH = array();
|
9 |
+
$_DELETE = array();
|
10 |
+
|
11 |
+
$request_method = isset($_SERVER['REQUEST_METHOD']) ? $_SERVER['REQUEST_METHOD'] : '';
|
12 |
+
if (!array_key_exists('CONTENT_TYPE', $_SERVER) && array_key_exists('HTTP_CONTENT_TYPE', $_SERVER)) {
|
13 |
+
$_SERVER['CONTENT_TYPE'] = $_SERVER['HTTP_CONTENT_TYPE'];
|
14 |
+
}
|
15 |
+
$content_type = isset($_SERVER['CONTENT_TYPE']) ? $_SERVER['CONTENT_TYPE'] : '';
|
16 |
+
$data_values = $_GET;
|
17 |
+
if ($request_method === 'POST') {
|
18 |
+
$data_values = $_POST;
|
19 |
+
} elseif ($request_method === 'PUT') {
|
20 |
+
if (strpos($content_type, 'application/x-www-form-urlencoded') === 0) {
|
21 |
+
parse_str($http_raw_post_data, $_PUT);
|
22 |
+
$data_values = $_PUT;
|
23 |
+
}
|
24 |
+
} elseif ($request_method === 'PATCH') {
|
25 |
+
if (strpos($content_type, 'application/x-www-form-urlencoded') === 0) {
|
26 |
+
parse_str($http_raw_post_data, $_PATCH);
|
27 |
+
$data_values = $_PATCH;
|
28 |
+
}
|
29 |
+
} elseif ($request_method === 'DELETE') {
|
30 |
+
if (strpos($content_type, 'application/x-www-form-urlencoded') === 0) {
|
31 |
+
parse_str($http_raw_post_data, $_DELETE);
|
32 |
+
$data_values = $_DELETE;
|
33 |
+
}
|
34 |
+
}
|
35 |
+
|
36 |
+
$test = isset($_SERVER['HTTP_X_DEBUG_TEST']) ? $_SERVER['HTTP_X_DEBUG_TEST'] : '';
|
37 |
+
$key = isset($data_values['key']) ? $data_values['key'] : '';
|
38 |
+
|
39 |
+
if ($test === 'http_basic_auth') {
|
40 |
+
if (!isset($_SERVER['PHP_AUTH_USER'])) {
|
41 |
+
header('WWW-Authenticate: Basic realm="My Realm"');
|
42 |
+
header('HTTP/1.0 401 Unauthorized');
|
43 |
+
echo 'canceled';
|
44 |
+
exit;
|
45 |
+
}
|
46 |
+
|
47 |
+
header('Content-Type: application/json');
|
48 |
+
echo json_encode(array(
|
49 |
+
'username' => $_SERVER['PHP_AUTH_USER'],
|
50 |
+
'password' => $_SERVER['PHP_AUTH_PW'],
|
51 |
+
));
|
52 |
+
exit;
|
53 |
+
} elseif ($test === 'http_digest_auth') {
|
54 |
+
$users = array(
|
55 |
+
'myusername' => 'mypassword',
|
56 |
+
);
|
57 |
+
|
58 |
+
$realm = 'Restricted area';
|
59 |
+
$qop = 'auth';
|
60 |
+
$nonce = md5(uniqid());
|
61 |
+
$opaque = md5(uniqid());
|
62 |
+
if (empty($_SERVER['PHP_AUTH_DIGEST'])) {
|
63 |
+
header('HTTP/1.1 401 Unauthorized');
|
64 |
+
header(sprintf(
|
65 |
+
'WWW-Authenticate: Digest realm="%s", qop="%s", nonce="%s", opaque="%s"', $realm, $qop, $nonce, $opaque));
|
66 |
+
echo 'canceled';
|
67 |
+
exit;
|
68 |
+
}
|
69 |
+
|
70 |
+
$data = array(
|
71 |
+
'nonce' => '',
|
72 |
+
'nc' => '',
|
73 |
+
'cnonce' => '',
|
74 |
+
'qop' => '',
|
75 |
+
'username' => '',
|
76 |
+
'uri' => '',
|
77 |
+
'response' => '',
|
78 |
+
);
|
79 |
+
preg_match_all('@(' . implode('|', array_keys($data)) . ')=(?:([\'"])([^\2]+?)\2|([^\s,]+))@',
|
80 |
+
$_SERVER['PHP_AUTH_DIGEST'], $matches, PREG_SET_ORDER);
|
81 |
+
foreach ($matches as $match) {
|
82 |
+
$data[$match['1']] = $match['3'] ? $match['3'] : $match['4'];
|
83 |
+
}
|
84 |
+
|
85 |
+
$A1 = md5($data['username'] . ':' . $realm . ':' . $users[$data['username']]);
|
86 |
+
$A2 = md5($_SERVER['REQUEST_METHOD'] . ':' . $data['uri']);
|
87 |
+
$valid_response = md5(
|
88 |
+
$A1 . ':' . $data['nonce'] . ':' . $data['nc'] . ':' . $data['cnonce'] . ':' . $data['qop'] . ':' . $A2);
|
89 |
+
|
90 |
+
if (!($data['response'] === $valid_response)) {
|
91 |
+
header('HTTP/1.1 401 Unauthorized');
|
92 |
+
echo 'invalid';
|
93 |
+
exit;
|
94 |
+
}
|
95 |
+
|
96 |
+
echo 'valid';
|
97 |
+
exit;
|
98 |
+
} elseif ($test === 'get') {
|
99 |
+
echo http_build_query($_GET);
|
100 |
+
exit;
|
101 |
+
} elseif ($test === 'post') {
|
102 |
+
echo http_build_query($_POST);
|
103 |
+
exit;
|
104 |
+
} elseif ($test === 'post_json') {
|
105 |
+
echo $http_raw_post_data;
|
106 |
+
exit;
|
107 |
+
} elseif ($test === 'put') {
|
108 |
+
echo $http_raw_post_data;
|
109 |
+
exit;
|
110 |
+
} elseif ($test === 'patch') {
|
111 |
+
echo $http_raw_post_data;
|
112 |
+
exit;
|
113 |
+
} elseif ($test === 'post_multidimensional') {
|
114 |
+
echo $http_raw_post_data;
|
115 |
+
exit;
|
116 |
+
} elseif ($test === 'post_file_path_upload') {
|
117 |
+
echo Helper\mime_type($_FILES[$key]['tmp_name']);
|
118 |
+
exit;
|
119 |
+
} elseif ($test === 'put_file_handle') {
|
120 |
+
$tmp_filename = tempnam('/tmp', 'php-curl-class.');
|
121 |
+
file_put_contents($tmp_filename, $http_raw_post_data);
|
122 |
+
echo Helper\mime_type($tmp_filename);
|
123 |
+
unlink($tmp_filename);
|
124 |
+
exit;
|
125 |
+
} elseif ($test === 'request_method') {
|
126 |
+
header('X-REQUEST-METHOD: ' . $request_method);
|
127 |
+
echo $request_method;
|
128 |
+
exit;
|
129 |
+
} elseif ($test === 'request_uri') {
|
130 |
+
echo $_SERVER['REQUEST_URI'];
|
131 |
+
exit;
|
132 |
+
} elseif ($test === 'cookiejar') {
|
133 |
+
setcookie('mycookie', 'yum');
|
134 |
+
exit;
|
135 |
+
} elseif ($test === 'multiple_cookie') {
|
136 |
+
setcookie('cookie1', 'scrumptious');
|
137 |
+
setcookie('cookie2', 'mouthwatering');
|
138 |
+
exit;
|
139 |
+
} elseif ($test === 'response_header') {
|
140 |
+
header('Content-Type: application/json');
|
141 |
+
header('ETag: ' . md5('worldpeace'));
|
142 |
+
exit;
|
143 |
+
} elseif ($test === 'response_body') {
|
144 |
+
echo 'OK';
|
145 |
+
exit;
|
146 |
+
} elseif ($test === 'json_response') {
|
147 |
+
if ($request_method === 'POST') {
|
148 |
+
$key = $_POST['key'];
|
149 |
+
$value = $_POST['value'];
|
150 |
+
header($key . ': ' . $value);
|
151 |
+
} else {
|
152 |
+
header('Content-Type: application/json');
|
153 |
+
}
|
154 |
+
echo json_encode(array(
|
155 |
+
'null' => null,
|
156 |
+
'true' => true,
|
157 |
+
'false' => false,
|
158 |
+
'integer' => 1,
|
159 |
+
'float' => 3.14,
|
160 |
+
'empty' => '',
|
161 |
+
'string' => 'string',
|
162 |
+
));
|
163 |
+
exit;
|
164 |
+
} elseif ($test === 'xml_response') {
|
165 |
+
$key = $_POST['key'];
|
166 |
+
$value = $_POST['value'];
|
167 |
+
header($key . ': ' . $value);
|
168 |
+
$doc = new DOMDocument();
|
169 |
+
$doc->formatOutput = true;
|
170 |
+
$rss = $doc->appendChild($doc->createElement('rss'));
|
171 |
+
$rss->setAttribute('version', '2.0');
|
172 |
+
$channel = $doc->createElement('channel');
|
173 |
+
$title = $doc->createElement('title');
|
174 |
+
$title->appendChild($doc->createTextNode('Title'));
|
175 |
+
$channel->appendChild($title);
|
176 |
+
$link = $doc->createElement('link');
|
177 |
+
$link->appendChild($doc->createTextNode('Link'));
|
178 |
+
$channel->appendChild($link);
|
179 |
+
$description = $doc->createElement('description');
|
180 |
+
$description->appendChild($doc->createTextNode('Description'));
|
181 |
+
$channel->appendChild($description);
|
182 |
+
$rss->appendChild($channel);
|
183 |
+
echo $doc->saveXML();
|
184 |
+
exit;
|
185 |
+
} elseif ($test === 'xml_with_cdata_response') {
|
186 |
+
header('Content-Type: text/xml');
|
187 |
+
echo '<?xml version="1.0" encoding="UTF-8"?>
|
188 |
+
<rss>
|
189 |
+
<items>
|
190 |
+
<item>
|
191 |
+
<id>1</id>
|
192 |
+
<ref>33ee7e1eb504b6619c1b445ca1442c21</ref>
|
193 |
+
<title><![CDATA[The Title]]></title>
|
194 |
+
<description><![CDATA[The description.]]></description>
|
195 |
+
<link><![CDATA[https://www.example.com/page.html?foo=bar&baz=wibble#hash]]></link>
|
196 |
+
</item>
|
197 |
+
<item>
|
198 |
+
<id>2</id>
|
199 |
+
<ref>b5c0b187fe309af0f4d35982fd961d7e</ref>
|
200 |
+
<title><![CDATA[Another Title]]></title>
|
201 |
+
<description><![CDATA[Some description.]]></description>
|
202 |
+
<link><![CDATA[https://www.example.org/image.png?w=1265.73&h=782.26]]></link>
|
203 |
+
</item>
|
204 |
+
</items>
|
205 |
+
</rss>';
|
206 |
+
exit;
|
207 |
+
} elseif ($test === 'upload_response') {
|
208 |
+
$tmp_filename = tempnam('/tmp', 'php-curl-class.');
|
209 |
+
move_uploaded_file($_FILES['image']['tmp_name'], $tmp_filename);
|
210 |
+
header('Content-Type: application/json');
|
211 |
+
header('ETag: ' . md5_file($tmp_filename));
|
212 |
+
echo json_encode(array(
|
213 |
+
'file_path' => $tmp_filename,
|
214 |
+
));
|
215 |
+
exit;
|
216 |
+
} elseif ($test === 'upload_cleanup') {
|
217 |
+
$unsafe_file_path = $_POST['file_path'];
|
218 |
+
echo var_export(unlink($unsafe_file_path), true);
|
219 |
+
exit;
|
220 |
+
} elseif ($test === 'download_response') {
|
221 |
+
$unsafe_file_path = $_GET['file_path'];
|
222 |
+
header('Content-Type: image/png');
|
223 |
+
header('Content-Disposition: attachment; filename="image.png"');
|
224 |
+
header('Content-Length: ' . filesize($unsafe_file_path));
|
225 |
+
header('ETag: ' . md5_file($unsafe_file_path));
|
226 |
+
readfile($unsafe_file_path);
|
227 |
+
exit;
|
228 |
+
} elseif ($test === 'timeout') {
|
229 |
+
$unsafe_seconds = $_GET['seconds'];
|
230 |
+
$start = time();
|
231 |
+
while (true) {
|
232 |
+
echo '.';
|
233 |
+
ob_flush();
|
234 |
+
flush();
|
235 |
+
sleep(1);
|
236 |
+
$elapsed = time() - $start;
|
237 |
+
if ($elapsed >= $unsafe_seconds) {
|
238 |
+
break;
|
239 |
+
}
|
240 |
+
}
|
241 |
+
exit;
|
242 |
+
} elseif ($test === 'error_message') {
|
243 |
+
if (function_exists('http_response_code')) {
|
244 |
+
http_response_code(401);
|
245 |
+
} else {
|
246 |
+
header('HTTP/1.1 401 Unauthorized');
|
247 |
+
}
|
248 |
+
exit;
|
249 |
+
} elseif ($test === 'redirect') {
|
250 |
+
if (!isset($_GET['redirect'])) {
|
251 |
+
header('Location: ?redirect');
|
252 |
+
exit;
|
253 |
+
}
|
254 |
+
|
255 |
+
echo 'OK';
|
256 |
+
exit;
|
257 |
+
} elseif ($test === 'delete_with_body') {
|
258 |
+
header('Content-Type: application/json');
|
259 |
+
echo json_encode(array(
|
260 |
+
'get' => $_GET,
|
261 |
+
'delete' => $_DELETE,
|
262 |
+
));
|
263 |
+
exit;
|
264 |
+
} elseif ($test === 'data_values') {
|
265 |
+
header('Content-Type: application/json');
|
266 |
+
echo json_encode($data_values);
|
267 |
+
exit;
|
268 |
+
} elseif ($test === 'post_redirect_get') {
|
269 |
+
if (isset($_GET['redirect'])) {
|
270 |
+
echo "Redirected: $request_method";
|
271 |
+
} else {
|
272 |
+
if ($request_method === 'POST') {
|
273 |
+
if (function_exists('http_response_code')) {
|
274 |
+
http_response_code(303);
|
275 |
+
} else {
|
276 |
+
header('HTTP/1.1 303 See Other');
|
277 |
+
}
|
278 |
+
|
279 |
+
header('Location: ?redirect');
|
280 |
+
} else {
|
281 |
+
echo "Request method is $request_method, but POST was expected";
|
282 |
+
}
|
283 |
+
}
|
284 |
+
|
285 |
+
exit;
|
286 |
+
}
|
287 |
+
|
288 |
+
header('Content-Type: text/plain');
|
289 |
+
|
290 |
+
$data_mapping = array(
|
291 |
+
'cookie' => $_COOKIE,
|
292 |
+
'delete' => $_GET,
|
293 |
+
'get' => $_GET,
|
294 |
+
'patch' => $_PATCH,
|
295 |
+
'post' => $_POST,
|
296 |
+
'put' => $_PUT,
|
297 |
+
'server' => $_SERVER,
|
298 |
+
);
|
299 |
+
|
300 |
+
if (!empty($test)) {
|
301 |
+
$data = $data_mapping[$test];
|
302 |
+
if (empty($key)) {
|
303 |
+
// Return all values when a key is not specified.
|
304 |
+
$value = http_build_query($data);
|
305 |
+
} else {
|
306 |
+
// Return individual value when a key is specified.
|
307 |
+
$value = isset($data[$key]) ? $data[$key] : '';
|
308 |
+
}
|
309 |
+
echo $value;
|
310 |
+
}
|
app/code/community/Pay/Payment/vendor/php-curl-class/php-curl-class/tests/before_script.sh
ADDED
@@ -0,0 +1,64 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
set -x
|
2 |
+
echo "TRAVIS_PHP_VERSION: ${TRAVIS_PHP_VERSION}"
|
3 |
+
|
4 |
+
composer self-update
|
5 |
+
composer install --prefer-source --no-interaction
|
6 |
+
|
7 |
+
if [[ "${TRAVIS_PHP_VERSION}" == "5.3" ]]; then
|
8 |
+
sudo add-apt-repository -y ppa:nginx/development
|
9 |
+
sudo apt-get update
|
10 |
+
sudo apt-get install -y nginx
|
11 |
+
sudo apt-get install -y php5-fpm
|
12 |
+
root="$(pwd)/tests/PHPCurlClass"
|
13 |
+
sudo tee /etc/nginx/sites-enabled/default <<EOF
|
14 |
+
server {
|
15 |
+
listen 8000 default_server;
|
16 |
+
root ${root};
|
17 |
+
index index.php;
|
18 |
+
server_name localhost;
|
19 |
+
location / {
|
20 |
+
rewrite ^ /index.php last;
|
21 |
+
}
|
22 |
+
location ~ \.php$ {
|
23 |
+
fastcgi_split_path_info ^(.+\.php)(/.+)$;
|
24 |
+
fastcgi_pass 127.0.0.1:9000;
|
25 |
+
fastcgi_index index.php;
|
26 |
+
include fastcgi_params;
|
27 |
+
fastcgi_param SCRIPT_FILENAME \$document_root\$fastcgi_script_name;
|
28 |
+
}
|
29 |
+
}
|
30 |
+
EOF
|
31 |
+
sudo /etc/init.d/nginx restart
|
32 |
+
elif [[ "${TRAVIS_PHP_VERSION}" == "5.4" ]]; then
|
33 |
+
php -S 127.0.0.1:8000 -t tests/PHPCurlClass/ &
|
34 |
+
elif [[ "${TRAVIS_PHP_VERSION}" == "5.5" ]]; then
|
35 |
+
php -S 127.0.0.1:8000 -t tests/PHPCurlClass/ &
|
36 |
+
elif [[ "${TRAVIS_PHP_VERSION}" == "5.6" ]]; then
|
37 |
+
php -S 127.0.0.1:8000 -t tests/PHPCurlClass/ &
|
38 |
+
elif [[ "${TRAVIS_PHP_VERSION}" == "7.0" ]]; then
|
39 |
+
php -S 127.0.0.1:8000 -t tests/PHPCurlClass/ &
|
40 |
+
elif [[ "${TRAVIS_PHP_VERSION}" == "hhvm" ]]; then
|
41 |
+
sudo add-apt-repository -y ppa:nginx/stable
|
42 |
+
sudo apt-get update
|
43 |
+
sudo apt-get install -y nginx
|
44 |
+
root="$(pwd)/tests/PHPCurlClass"
|
45 |
+
sudo tee /etc/nginx/sites-enabled/default <<EOF
|
46 |
+
server {
|
47 |
+
listen 8000 default_server;
|
48 |
+
root ${root};
|
49 |
+
index index.php;
|
50 |
+
server_name localhost;
|
51 |
+
location / {
|
52 |
+
rewrite ^ /index.php last;
|
53 |
+
}
|
54 |
+
}
|
55 |
+
EOF
|
56 |
+
sudo /usr/share/hhvm/install_fastcgi.sh
|
57 |
+
sudo /etc/init.d/hhvm restart
|
58 |
+
sleep 5
|
59 |
+
sudo service nginx stop
|
60 |
+
sleep 5
|
61 |
+
sudo service nginx start
|
62 |
+
elif [[ "${TRAVIS_PHP_VERSION}" == "nightly" ]]; then
|
63 |
+
php -S 127.0.0.1:8000 -t tests/PHPCurlClass/ &
|
64 |
+
fi
|
app/code/community/Pay/Payment/vendor/php-curl-class/php-curl-class/tests/check_syntax.sh
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
phpcs --standard=PSR2 --extensions=php ..
|
app/code/community/Pay/Payment/vendor/php-curl-class/php-curl-class/tests/phpunit.xml
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<phpunit bootstrap="../vendor/autoload.php" colors="true">
|
2 |
+
<testsuites>
|
3 |
+
<testsuite name="PHPCurlClass">
|
4 |
+
<directory suffix=".php">./PHPCurlClass/</directory>
|
5 |
+
</testsuite>
|
6 |
+
</testsuites>
|
7 |
+
</phpunit>
|
app/code/community/Pay/Payment/vendor/php-curl-class/php-curl-class/tests/run.sh
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
set -x
|
2 |
+
php -S 127.0.0.1:8000 -t PHPCurlClass/ &> /dev/null &
|
3 |
+
pid="${!}"
|
4 |
+
phpunit \
|
5 |
+
--configuration phpunit.xml \
|
6 |
+
--debug \
|
7 |
+
--verbose
|
8 |
+
kill "${pid}"
|
app/code/community/Pay/Payment/vendor/php-curl-class/php-curl-class/tests/script.sh
ADDED
@@ -0,0 +1,101 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Check syntax in php files.
|
2 |
+
find . -type "f" -iname "*.php" ! -path "*/vendor/*" -exec php -l {} \;
|
3 |
+
|
4 |
+
errors=0
|
5 |
+
|
6 |
+
# Run tests.
|
7 |
+
phpunit --configuration tests/phpunit.xml
|
8 |
+
if [[ "${?}" -ne 0 ]]; then
|
9 |
+
((errors++))
|
10 |
+
fi
|
11 |
+
|
12 |
+
# Enforce line ending consistency in php files.
|
13 |
+
crlf_file=$(find . -type "f" -iname "*.php" ! -path "*/vendor/*" -exec grep --files-with-matches $'\r' {} \;)
|
14 |
+
if [[ ! -z "${crlf_file}" ]]; then
|
15 |
+
echo "${crlf_file}" | perl -pe 's/(.*)/CRLF line terminators found in \1/'
|
16 |
+
((errors++))
|
17 |
+
fi
|
18 |
+
|
19 |
+
# Enforce indentation character consistency in php files.
|
20 |
+
tab_char=$(find . -type "f" -iname "*.php" ! -path "*/vendor/*" -exec grep --line-number -H --perl-regexp "\t" {} \;)
|
21 |
+
if [[ ! -z "${tab_char}" ]]; then
|
22 |
+
echo -e "${tab_char}" | perl -pe 's/^(.*)$/Tab character found in \1/'
|
23 |
+
((errors++))
|
24 |
+
fi
|
25 |
+
|
26 |
+
# Enforce indentation consistency in php files.
|
27 |
+
find_invalid_indentation() {
|
28 |
+
filename="${1}"
|
29 |
+
script=$(cat <<'EOF'
|
30 |
+
$filename = $argv['1'];
|
31 |
+
$lines = explode("\n", file_get_contents($filename));
|
32 |
+
$line_number = 0;
|
33 |
+
foreach ($lines as $line) {
|
34 |
+
$line_number += 1;
|
35 |
+
$leading_space_count = strspn($line, ' ');
|
36 |
+
$remainder = $leading_space_count % 4;
|
37 |
+
if (!($remainder === 0)) {
|
38 |
+
// Allow doc comments.
|
39 |
+
if (substr(ltrim($line), 0, 1) === '*') {
|
40 |
+
continue;
|
41 |
+
}
|
42 |
+
$add_count = 4 - $remainder;
|
43 |
+
$remove_count = $remainder;
|
44 |
+
echo 'Invalid indentation found in ' . $filename . ':' . $line_number .
|
45 |
+
' (' . $leading_space_count . ':+' . $add_count . '/-' . $remove_count . ')' . "\n";
|
46 |
+
}
|
47 |
+
}
|
48 |
+
EOF
|
49 |
+
)
|
50 |
+
php --run "${script}" "${filename}"
|
51 |
+
}
|
52 |
+
# Skip hhvm "Notice: File could not be loaded: ..."
|
53 |
+
if [[ "${TRAVIS_PHP_VERSION}" != "hhvm" ]]; then
|
54 |
+
export -f "find_invalid_indentation"
|
55 |
+
invalid_indentation=$(find . -type "f" -iname "*.php" ! -path "*/vendor/*" -exec bash -c 'find_invalid_indentation "{}"' \;)
|
56 |
+
if [[ ! -z "${invalid_indentation}" ]]; then
|
57 |
+
echo "${invalid_indentation}"
|
58 |
+
((errors++))
|
59 |
+
fi
|
60 |
+
fi
|
61 |
+
|
62 |
+
# Prohibit trailing whitespace in php files.
|
63 |
+
trailing_whitespace=$(find . -type "f" -iname "*.php" ! -path "*/vendor/*" -exec egrep --line-number -H " +$" {} \;)
|
64 |
+
if [[ ! -z "${trailing_whitespace}" ]]; then
|
65 |
+
echo -e "${trailing_whitespace}" | perl -pe 's/^(.*)$/Trailing whitespace found in \1/'
|
66 |
+
((errors++))
|
67 |
+
fi
|
68 |
+
|
69 |
+
# Prohibit long lines in php files.
|
70 |
+
long_lines=$(find . -type "f" -iname "*.php" ! -path "*/vendor/*" -exec awk '{print FILENAME":"NR" "length}' {} \; | awk '$2 > 120')
|
71 |
+
if [[ ! -z "${long_lines}" ]]; then
|
72 |
+
echo -e "${long_lines}" | perl -pe 's/^(.*)$/Long lines found in \1/'
|
73 |
+
((errors++))
|
74 |
+
fi
|
75 |
+
|
76 |
+
# Prohibit @author in php files.
|
77 |
+
at_author=$(find . -type "f" -iname "*.php" ! -path "*/vendor/*" -exec egrep --line-number -H "@author" {} \;)
|
78 |
+
if [[ ! -z "${at_author}" ]]; then
|
79 |
+
echo -e "${at_author}" | perl -pe 's/^(.*)$/\@author found in \1/'
|
80 |
+
((errors++))
|
81 |
+
fi
|
82 |
+
|
83 |
+
# Prohibit screaming caps notation in php files.
|
84 |
+
caps=$(find . -type "f" -iname "*.php" ! -path "*/vendor/*" -exec egrep --color=always --line-number -H -e "FALSE[^']" -e "NULL" -e "TRUE" {} \;)
|
85 |
+
if [[ ! -z "${caps}" ]]; then
|
86 |
+
echo -e "${caps}" | perl -pe 's/^(.*)$/All caps found in \1/'
|
87 |
+
((errors++))
|
88 |
+
fi
|
89 |
+
|
90 |
+
# Require identical comparison operators (===, not ==) in php files.
|
91 |
+
equal=$(find . -type "f" -iname "*.php" ! -path "*/vendor/*" -exec egrep --color=always --line-number -H "[^!=]==[^=]" {} \;)
|
92 |
+
if [[ ! -z "${equal}" ]]; then
|
93 |
+
echo -e "${equal}" | perl -pe 's/^(.*)$/Non-identical comparison operator found in \1/'
|
94 |
+
((errors++))
|
95 |
+
fi
|
96 |
+
|
97 |
+
if [ $errors -eq 0 ]; then
|
98 |
+
exit 0
|
99 |
+
else
|
100 |
+
exit 1
|
101 |
+
fi
|
app/design/adminhtml/base/default/template/pay/payment/form/instore.phtml
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
$_code=$this->getMethodCode();
|
3 |
+
|
4 |
+
$terminals = $this->getTerminals();
|
5 |
+
?>
|
6 |
+
<ul class="form-list" id="payment_form_<?php echo $_code ?>" style="display:none;">
|
7 |
+
<li>
|
8 |
+
<label for="pay_terminal">Kies de pinterminal</label>
|
9 |
+
<select id="pay_terminal" name='payment[terminalId]' >
|
10 |
+
<?php
|
11 |
+
foreach($terminals as $terminal){
|
12 |
+
echo "<option value='".$terminal->getOptionSubId()."'>".$terminal->getName()."</option>";
|
13 |
+
}?>
|
14 |
+
|
15 |
+
</select>
|
16 |
+
</li>
|
17 |
+
</ul>
|
18 |
+
<div>
|
19 |
+
<?php echo $this->getMethod()->getConfigData('message');?>
|
20 |
+
</div>
|
app/design/adminhtml/base/default/template/pay/payment/form/paylink.phtml
CHANGED
@@ -2,6 +2,7 @@
|
|
2 |
$_code = $this->getMethodCode();
|
3 |
?>
|
4 |
<ul id="payment_form_<?php echo $_code ?>" style="display:none;">
|
|
|
5 |
<li>
|
6 |
<div class="input-box">
|
7 |
|
2 |
$_code = $this->getMethodCode();
|
3 |
?>
|
4 |
<ul id="payment_form_<?php echo $_code ?>" style="display:none;">
|
5 |
+
<li><strong>Let op! Er wordt geen email verstuurd, de betaallink vind je in de notities bij de order</strong></li>
|
6 |
<li>
|
7 |
<div class="input-box">
|
8 |
|
app/design/adminhtml/base/default/template/pay/payment/mark.phtml
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
<img src="<?php echo $this->escapeHtml($this->getPaymentMethodImageSrc())?>" alt="<?php echo $this->getPaymentMethodName() ?>" class="v-middle" style="padding-right:10px;" />
|
app/design/frontend/base/default/template/pay/payment/form/instore.phtml
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
$_code=$this->getMethodCode();
|
3 |
+
|
4 |
+
$terminals = $this->getTerminals();
|
5 |
+
?>
|
6 |
+
<ul class="form-list" id="payment_form_<?php echo $_code ?>" style="display:none;">
|
7 |
+
<li><label for="pay_terminal">Kies de pinterminal</label>
|
8 |
+
<select id="pay_terminal" name='payment[terminalId]' >
|
9 |
+
<?php
|
10 |
+
foreach($terminals as $terminal){
|
11 |
+
echo "<option value='".$terminal->getOptionSubId()."'>".$terminal->getName()."</option>";
|
12 |
+
}?>
|
13 |
+
|
14 |
+
</select>
|
15 |
+
</li>
|
16 |
+
|
17 |
+
</ul>
|
18 |
+
<div>
|
19 |
+
<?php echo $this->getMethod()->getConfigData('message');?>
|
20 |
+
</div>
|
app/design/frontend/base/default/template/pay/payment/form/yehhpay.phtml
ADDED
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
$_code = $this->getMethodCode();
|
3 |
+
|
4 |
+
$dob = $this->getDob();
|
5 |
+
/** @var Mage_Sales_Model_Quote $quote */
|
6 |
+
$quote = $this->getQuote();
|
7 |
+
|
8 |
+
list($dobYear, $dobMonth, $dobDay) = explode('-', $dob);
|
9 |
+
|
10 |
+
?>
|
11 |
+
|
12 |
+
|
13 |
+
<ul class="form-list" id="payment_form_<?php echo $_code ?>" style="display:none;">
|
14 |
+
<li><?php echo $this->__('Date of Birth'); ?></li>
|
15 |
+
<li>
|
16 |
+
<div class="input-box customer-dob">
|
17 |
+
<div class="dob-day">
|
18 |
+
<input type="text" id="day" name="payment[birthday_day]" value="<?php echo $dobDay; ?>" title="Day"
|
19 |
+
class="input-text">
|
20 |
+
<label for="day">DD</label>
|
21 |
+
</div>
|
22 |
+
<div class="dob-month">
|
23 |
+
<input type="text" id="month" name="payment[birthday_month]" value="<?php echo $dobMonth; ?>"
|
24 |
+
title="Month"
|
25 |
+
class="input-text">
|
26 |
+
<label for="month">MM</label>
|
27 |
+
</div>
|
28 |
+
<div class="dob-year">
|
29 |
+
<input type="text" id="year" name="payment[birthday_year]" value="<?php echo $dobYear; ?>" title="Year"
|
30 |
+
class="input-text" autocomplete="off">
|
31 |
+
<label for="year">YYYY</label>
|
32 |
+
</div>
|
33 |
+
</li>
|
34 |
+
</ul>
|
35 |
+
<div>
|
36 |
+
<?php echo $this->getMethod()->getConfigData('message'); ?>
|
37 |
+
</div>
|
package.xml
CHANGED
@@ -1,21 +1,20 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Pay_NL</name>
|
4 |
-
<version>3.
|
5 |
<stability>stable</stability>
|
6 |
<license>Pay</license>
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
<summary>Betaalmethoden van pay.nl</summary>
|
10 |
<description>Magento plugin voor betaalmethoden van pay.nl</description>
|
11 |
-
<notes>
|
12 |
-
|
13 |
-
|
14 |
-
Small fix for PHP 5.4 compatibility</notes>
|
15 |
<authors><author><name>Andy Pieters</name><user>andy</user><email>andy@pay.nl</email></author></authors>
|
16 |
-
<date>2017-
|
17 |
-
<time>
|
18 |
-
<contents><target name="mageetc"><dir name="modules"><file name="Pay_Payment.xml" hash="035161a836b38119a3deee9a53aa0493"/></dir></target><target name="magecommunity"><dir name="Pay"><dir name="Payment"><dir name="Block"><dir name="Adminhtml"><file name="Paymentmethods.php" hash="388fd5b8c91b469989956a44d3747981"/><dir name="Sales"><dir name="Order"><dir name="Creditmemo"><file name="Totals.php" hash="efa170c6d6373db23cbbc431dfd16dd1"/></dir><dir name="Invoice"><file name="Totals.php" hash="660af963b2284d67f2a7d2fed81547f5"/></dir><file name="Totals.php" hash="6e1b2e3ff405dd6b71b3fcad4b7aa6dd"/></dir><file name="Totals.php" hash="53f1e18fa57da728bb7ae8391099322a"/></dir></dir><dir name="Form"><file name="Abstract.php" hash="3a88ab9907aa9729c9224a136e4ef17c"/><file name="Afterpay.php" hash="60e7120d92a35479229dc8686965170f"/><file name="Afterpayem.php" hash="81d7859343d26234ae897cf236acb3c9"/><file name="Amex.php" hash="9c4945bb3577d56002dc7cd24ce00fd3"/><file name="Billink.php" hash="c700934ea3e0438828093602e3ac9455"/><file name="Bitcoin.php" hash="f3a40f1d2691aed2f9e7f3477b5deb1c"/><file name="Capayable.php" hash="1fb8d87532881f98ba65c46215910cdd"/><file name="CapayableGespreid.php" hash="082ca172c67f29185b21e935e32c9c1e"/><file name="Cartebleue.php" hash="db7da62ea79ae9e8a15998b91618c7cb"/><file name="Fashioncheque.php" hash="7c1a9727da5d3fccd0a07abb7424f296"/><file name="Focum.php" hash="174b8123191d98dd2328de887c9450df"/><file name="Gezondheidsbon.php" hash="33fcf9147f239a604bd4fba78ea2cba4"/><file name="Giropay.php" hash="b2f52e1b1e3340950238bde715f8f963"/><file name="Givacard.php" hash="d2dc92a3b66236a302a54049a08840e0"/><file name="Ideal.php" hash="fef986eaba046584083e36f3609a0013"/><file name="Incasso.php" hash="aebe891d50b69970bd46f59d23814edb"/><file name="Klarna.php" hash="5af95f201b4318cf8d35441a735ba513"/><file name="Maestro.php" hash="82b16a17cd78e1ad6f46fe751da7c8e4"/><file name="Mistercash.php" hash="ed955716ad3c8ad4bc00f374cd0cfd8c"/><file name="Mybank.php" hash="057c8079eebde684e9227ab2d7e14405"/><file name="Overboeking.php" hash="f4be14559a4a8c3e2daec114f45bcdd2"/><file name="Paylink.php" hash="88aa76f66dd6de2c1edbaa8fa2f82848"/><file name="Paypal.php" hash="f9579c1c34eb4436e53f761c2dee258a"/><file name="Paysafecard.php" hash="6df3b810346618d9161a8e9cac559deb"/><file name="Podiumkadokaart.php" hash="eeac3bafc861cffb016b9a2b2e3826a9"/><file name="Postepay.php" hash="7aa30da423bf38cfdf4a4deb6b628d1d"/><file name="Sofortbanking.php" hash="6900b858d9081ba94c1eb2d543672891"/><file name="Telefoon.php" hash="54c8520b21e1c999b52c54e93b542df8"/><file name="Visamastercard.php" hash="ce3a7868f9b8860acaaf176fc153896f"/><file name="Vvvgiftcard.php" hash="4830f8b4d221316ecdcb28b419799d23"/><file name="Webshopgiftcard.php" hash="3061340972cc57c3baf5a372a1fd7b61"/><file name="Wijncadeau.php" hash="72b1003d47bf7d03c8c14f3a04919e17"/><file name="Yourgift.php" hash="4a2fafa29ca7d860e99529dd7f2cbff4"/></dir><dir name="Sales"><dir name="Order"><dir name="Creditmemo"><file name="Totals.php" hash="ed22b3a323eafbea1e211ce7b8babf5d"/></dir><dir name="Invoice"><file name="Totals.php" hash="f609b1022bf81824e8863548bb97ca70"/></dir><file name="Totals.php" hash="cdb66b39cea22a6ed2aef9454c90c4b7"/></dir></dir></dir><file name="Exception.php" hash="a200bf2c08b9b9ee4d126feb40abbd19"/><dir name="Helper"><dir name="Api"><file name="Capture.php" hash="cf258c8163f5d82b2c19587e58924c6e"/><file name="Exception.php" hash="4b4bc19e5aa40cafa38807e9a59661b3"/><file name="Getservice.php" hash="19172bd4aa57980d7cb7a38f3c6e9c39"/><file name="Info.php" hash="fe2f4855d9085e38e4b4a59ee521462e"/><file name="Ispayserverip.php" hash="17500fbea806c329192d8f01c58b682e"/><file name="Refund.php" hash="b7200111390ce8b5cd22074af1191300"/><file name="Start.php" hash="d6386f799cb5cb5b77bfe43865741fc2"/><file name="Void.php" hash="68c1308cd415b88d735fc7b7b6d5da05"/></dir><file name="Api.php" hash="f5791a80907f09cd1d0bd7ed3a874db1"/><file name="Data.php" hash="621e9535872821ffa23f4bed752f66e7"/><file name="Order.php" hash="041ce7f4fc014510e514f7555f9cb601"/><file name="Total.php" hash="0a7d2b69cd75323c38d69de9073db4c0"/></dir><dir name="Model"><dir name="Backend"><file name="Trim.php" hash="a232e48f459a6556c393f4da7a0d4139"/></dir><dir name="Mysql4"><dir name="Option"><file name="Collection.php" hash="54034bcf55cc7586e3d9cea66a267ed0"/></dir><file name="Option.php" hash="70563149e562bb27cee0f8041e170fce"/><dir name="Optionsub"><file name="Collection.php" hash="90f32544532471e2fb2dcd5a54b66be8"/></dir><file name="Optionsub.php" hash="20838820f4dc50ca04c8faf79597aea0"/><dir name="Transaction"><file name="Collection.php" hash="289e4368ab9d03e36bec938f9b3c9666"/></dir><file name="Transaction.php" hash="cb2787ab540acf82e94daef0ba07235e"/></dir><file name="Option.php" hash="2a42d9bb5040b1f2964c146149cb1afd"/><file name="Optionsub.php" hash="acc178145aec8aa3f813055188cec3b5"/><dir name="Paymentmethod"><file name="Afterpay.php" hash="ad86753b77f5ba38f9f487a21b5dd740"/><file name="Afterpayem.php" hash="0e46d05dbd0e50568ce501f015a4bef9"/><file name="Amex.php" hash="7b4157754d63950c3896a516db92e8f2"/><file name="Billink.php" hash="16c12d733d8a1e22e92a4e8ee7dcffd1"/><file name="Bitcoin.php" hash="496ec9c7912b8b284168e93640528ed6"/><file name="Capayable.php" hash="60f67926b2921a8b88b5b00766ae4694"/><file name="CapayableGespreid.php" hash="cf13bf9b313b1e73afc66ca9953291cf"/><file name="Cartebleue.php" hash="9c7582f774e76a5932a58a8b9ec9e51a"/><file name="Fashioncheque.php" hash="68355c9aaaf281b47d805dd09a29a2e4"/><file name="Focum.php" hash="8f7e4b3dfde76bf83a5a72d38cd276c3"/><file name="Gezondheidsbon.php" hash="9eb4a0560499cfa77bfeb0caf2721880"/><file name="Giropay.php" hash="0c1a03865705abf36a515f4ce853fe79"/><file name="Givacard.php" hash="674b31ad7ec22621b57093da2944dec0"/><file name="Ideal.php" hash="05ed867fc3608b9d68eeec798d3a1c9d"/><file name="Incasso.php" hash="201b14ae2b7ca0c3ca57c10c7f63539f"/><file name="Klarna.php" hash="2dfd0a195c79fc74903f81c363d4e6c6"/><file name="Maestro.php" hash="eaa24f85ca579779f8f48d0b55dbf41f"/><file name="Mistercash.php" hash="f731220c7c1b1bef18632d2463d9a1a7"/><file name="Mybank.php" hash="15343fcf04a43da6209a2d68e530ed8d"/><file name="Overboeking.php" hash="9d2829863036d3990a1e1e650fa651b3"/><file name="Paylink.php" hash="ec687bb450cc96b1e1620e0d83c1fa48"/><file name="Paypal.php" hash="cab6b68d26e84407fa33089df7ac54c8"/><file name="Paysafecard.php" hash="932534b552ea0668aa7923c931dd546a"/><file name="Podiumkadokaart.php" hash="98e0fda57978ac23f8ccac603a62c55d"/><file name="Postepay.php" hash="b98826f7a81a1631227de202ed769e1d"/><file name="Sofortbanking.php" hash="989478f44af7f829d5566734bfae96c3"/><file name="Telefoon.php" hash="8744b545ef8c5f55cc6c3d209c27e8af"/><file name="Visamastercard.php" hash="db8cf0d660bd13a52ed79822350bbcc5"/><file name="Vvvgiftcard.php" hash="a726dbdf43590afec40b898797c6e90c"/><file name="Webshopgiftcard.php" hash="746e512f5421e465010afe85a3db88fc"/><file name="Wijncadeau.php" hash="f5de786cd19fc9dc9ce82e15a2c78c2d"/><file name="Yourgift.php" hash="dd5f2c77dd2a2c473d9153fb243cf454"/></dir><file name="Paymentmethod.php" hash="e82bfa297d7dcd2dc0a1b7eda8fe39f6"/><dir name="Paypal"><file name="Cart.php" hash="4e2c74c4f744ddc613023ebeea924a25"/></dir><dir name="Resource"><file name="Setup.php" hash="4bf6f4eb88b06047e021f55077898312"/></dir><dir name="Sales"><dir name="Order"><dir name="Creditmemo"><dir name="Total"><file name="Paymentcharge.php" hash="619284bfb8096b8077e1db0d5706d258"/></dir></dir><dir name="Invoice"><dir name="Total"><file name="Paymentcharge.php" hash="c20ce4be3936651db99074c21a9135d6"/></dir></dir></dir><dir name="Quote"><dir name="Address"><dir name="Total"><file name="Paymentcharge.php" hash="4476aaa1f0bf6ea3ba4e028b698b1767"/></dir></dir></dir></dir><dir name="Source"><file name="Gateway.php" hash="78d710bc4415e9872f270cd15b30551d"/><file name="Iconsize.php" hash="6e3d674afb63ddcc8f30a968b8a9dd71"/><file name="Language.php" hash="53db4f77dcf223a1afd260c565150bfe"/><dir name="Paymentmethod"><file name="Active.php" hash="ee0210654744b696b79a95f1c4747be1"/><dir name="Afterpay"><file name="Active.php" hash="631b79947d92cf932c80eca13f53afe9"/></dir><dir name="Afterpayem"><file name="Active.php" hash="1d049374372537c86e2c593e452889d1"/></dir><dir name="Amex"><file name="Active.php" hash="bc1e611d56d0372959a4b66f172cd1e0"/></dir><dir name="Billink"><file name="Active.php" hash="18d119c4720809e1cd82a51e95dd8a77"/></dir><dir name="Bitcoin"><file name="Active.php" hash="fc89631b3cda4a656d9b7f3973849eae"/></dir><dir name="Capayable"><file name="Active.php" hash="65d3e8a72527f75942e6054192965aa7"/></dir><dir name="CapayableGespreid"><file name="Active.php" hash="a471a6a2c7a3a59780c89a67ed8a6924"/></dir><dir name="Cartebleue"><file name="Active.php" hash="bcf8c51ecfbc8d44c9f49a39dc764bd4"/></dir><dir name="Fashioncheque"><file name="Active.php" hash="c5fa9deac7ffd651b049ffb72133163f"/></dir><dir name="Focum"><file name="Active.php" hash="418942b5cf3a48d515cf3589b00637e6"/></dir><dir name="Gezondheidsbon"><file name="Active.php" hash="f24be4a3c557a717634e9d874c442d02"/></dir><dir name="Giropay"><file name="Active.php" hash="1552d5fc9fbb84a2d2f3871a55ac4ec6"/></dir><dir name="Givacard"><file name="Active.php" hash="c69157dff1c3dc4572d693c63140969b"/></dir><dir name="Ideal"><file name="Active.php" hash="85d0fcdfa9d3258d6ff5bceae5b0042f"/><file name="Selecttype.php" hash="37e19c073cf39469efe1ce9d7548a4b7"/></dir><dir name="Incasso"><file name="Active.php" hash="d99d1c2538d021f126243b738564fc4a"/></dir><dir name="Klarna"><file name="Active.php" hash="c16af8dbed563f8eb0c0794428955283"/></dir><dir name="Maestro"><file name="Active.php" hash="c33b890119ecfcbc4f67044ac8750f42"/></dir><dir name="Mistercash"><file name="Active.php" hash="24633712262b195c058abb08b7468ee6"/></dir><dir name="Mybank"><file name="Active.php" hash="d29339a25c6a1bd4c02e0609ad3668cf"/></dir><dir name="Overboeking"><file name="Active.php" hash="10c1163ece5af584568e7cc8a2aa6975"/></dir><dir name="Paypal"><file name="Active.php" hash="626755f8781e02fdc5693b4f21a43be3"/></dir><dir name="Paysafecard"><file name="Active.php" hash="498f7ca442b0b640a40917b9e891664c"/></dir><dir name="Podiumkadokaart"><file name="Active.php" hash="2836dfcb49fb6e267c169ea0f1a8e011"/></dir><dir name="Postepay"><file name="Active.php" hash="40101c5b929e5c652b7c73d38bd55b00"/></dir><dir name="Sofortbanking"><file name="Active.php" hash="6090cc3aa35ba5655e1c3766c22d73a8"/></dir><dir name="Telefoon"><file name="Active.php" hash="e48b97faa7bf1744787e3ac60c0f178c"/></dir><dir name="Visamastercard"><file name="Active.php" hash="89130148898e2cf60e97630820ab8958"/></dir><dir name="Vvvgiftcard"><file name="Active.php" hash="ed0258c05c2e16ea189dfbd221a45b51"/></dir><dir name="Webshopgiftcard"><file name="Active.php" hash="4340b8530118937df32caa2a53294b5b"/></dir><dir name="Wijncadeau"><file name="Active.php" hash="b0b9a73e470a188731c6121b642c3710"/></dir><dir name="Yourgift"><file name="Active.php" hash="2e277ce8b3407f037468c17b818f4144"/></dir></dir><file name="Sendmail.php" hash="626c01900a480ecd790bf56324e4590c"/><file name="Showfee.php" hash="1203dc1beb95867f232e0945a1728146"/><dir name="Status"><file name="PendingPayment.php" hash="9358466304af44f3a22f77fec7630be1"/><file name="Processing.php" hash="aea6f58cfb750a93f03ae4b435c59766"/></dir></dir><dir name="System"><dir name="Config"><dir name="Source"><file name="Chargetype.php" hash="82c781472b46ae466f2ec6d6b0251df3"/></dir></dir></dir><file name="Transaction.php" hash="8bb6b623b503640d605cde5b27af50e8"/></dir><dir name="controllers"><file name="CheckoutController.php" hash="6849f3776bb57f743b11a0a67827f5fa"/><file name="OrderController.php" hash="62d45c4fe59a730923afd203985252ab"/></dir><dir name="etc"><file name="config.xml" hash="c35df8c1e059ea063769411a8f25d074"/><file name="system.xml" hash="3bb3f5c545aa922f9146b70530564e7f"/></dir><dir name="sql"><dir name="pay_payment_setup"><file name="install-3.1.2.8.php" hash="7191d2eae22bede77c14292f81241707"/><file name="upgrade-3.0.0-3.1.0.php" hash="4b76b4f06ca7d3ffcec5e55a72773340"/><file name="upgrade-3.1.2.2-3.1.2.4.php" hash="aa75d3330b6d6db8d41a33404c6ca923"/><file name="upgrade-3.1.2.7-3.1.2.8.php" hash="22882b3a6a6977d1cb2b29cecb5a792f"/><file name="upgrade-3.2.1-3.2.2.php" hash="6bcb9d73a61bea4081c02b3f21a7c84e"/><file name="upgrade-3.2.13-3.2.14.php" hash="4fa59649ffc6a7cc6af3050e5f2a9700"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="pay"><dir name="payment"><dir name="form"><file name="billink.phtml" hash="7fa7d3e113b911744ba130a9084a6b87"/><file name="default.phtml" hash="d41d8cd98f00b204e9800998ecf8427e"/><file name="focum.phtml" hash="d5e55377466c3fcc5b45a4104fbc020d"/><file name="ideal.phtml" hash="6cfa69a8773dfc091e055b531bbf31dc"/><file name="idealSelect.phtml" hash="13936d975af0083512378f5936a5896d"/><file name="klarna.phtml" hash="b154ba769fd50ece09109f8780ba3b5b"/></dir><file name="mark.phtml" hash="ab61d728f0d237a34f78300554d8ba0f"/></dir></dir></dir></dir></dir></dir><dir name="adminhtml"><dir name="base"><dir name="default"><dir name="template"><dir name="pay"><dir name="payment"><dir name="form"><file name="billink.phtml" hash="7fa7d3e113b911744ba130a9084a6b87"/><file name="default.phtml" hash="d41d8cd98f00b204e9800998ecf8427e"/><file name="focum.phtml" hash="d5e55377466c3fcc5b45a4104fbc020d"/><file name="ideal.phtml" hash="6cfa69a8773dfc091e055b531bbf31dc"/><file name="idealSelect.phtml" hash="13936d975af0083512378f5936a5896d"/><file name="klarna.phtml" hash="1a496f7ebb8bd1361332519a3331faaa"/><file name="paylink.phtml" hash="76084a190aa5fec205d2648f4dbc9f78"/></dir></dir></dir></dir></dir></dir></dir></target><target name="magemedia"><dir name="pay_payment"><file name="logo.png" hash="b45a2ccf5e85a713b786d85c1059afee"/></dir></target></contents>
|
19 |
<compatible/>
|
20 |
<dependencies><required><php><min>5.1.0</min><max>7.2.99</max></php><extension><name>curl</name><min/><max/></extension></required></dependencies>
|
21 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Pay_NL</name>
|
4 |
+
<version>3.7.0</version>
|
5 |
<stability>stable</stability>
|
6 |
<license>Pay</license>
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
<summary>Betaalmethoden van pay.nl</summary>
|
10 |
<description>Magento plugin voor betaalmethoden van pay.nl</description>
|
11 |
+
<notes>Now using the paynl SDK
|
12 |
+
Added instore payments (PIN)
|
13 |
+
Added Yehhpay</notes>
|
|
|
14 |
<authors><author><name>Andy Pieters</name><user>andy</user><email>andy@pay.nl</email></author></authors>
|
15 |
+
<date>2017-04-04</date>
|
16 |
+
<time>13:51:18</time>
|
17 |
+
<contents><target name="mageetc"><dir name="modules"><file name="Pay_Payment.xml" hash="035161a836b38119a3deee9a53aa0493"/></dir></target><target name="magecommunity"><dir name="Pay"><dir name="Payment"><dir name="Block"><dir name="Adminhtml"><file name="Paymentmethods.php" hash="388fd5b8c91b469989956a44d3747981"/><dir name="Sales"><dir name="Order"><dir name="Creditmemo"><file name="Totals.php" hash="efa170c6d6373db23cbbc431dfd16dd1"/></dir><dir name="Invoice"><file name="Totals.php" hash="660af963b2284d67f2a7d2fed81547f5"/></dir><file name="Totals.php" hash="6e1b2e3ff405dd6b71b3fcad4b7aa6dd"/></dir><file name="Totals.php" hash="53f1e18fa57da728bb7ae8391099322a"/></dir></dir><dir name="Form"><file name="Abstract.php" hash="3a88ab9907aa9729c9224a136e4ef17c"/><file name="Afterpay.php" hash="60e7120d92a35479229dc8686965170f"/><file name="Afterpayem.php" hash="81d7859343d26234ae897cf236acb3c9"/><file name="Amex.php" hash="9c4945bb3577d56002dc7cd24ce00fd3"/><file name="Billink.php" hash="c700934ea3e0438828093602e3ac9455"/><file name="Bitcoin.php" hash="f3a40f1d2691aed2f9e7f3477b5deb1c"/><file name="Capayable.php" hash="1fb8d87532881f98ba65c46215910cdd"/><file name="CapayableGespreid.php" hash="082ca172c67f29185b21e935e32c9c1e"/><file name="Cartebleue.php" hash="db7da62ea79ae9e8a15998b91618c7cb"/><file name="Fashioncheque.php" hash="7c1a9727da5d3fccd0a07abb7424f296"/><file name="Focum.php" hash="174b8123191d98dd2328de887c9450df"/><file name="Gezondheidsbon.php" hash="33fcf9147f239a604bd4fba78ea2cba4"/><file name="Giropay.php" hash="b2f52e1b1e3340950238bde715f8f963"/><file name="Givacard.php" hash="d2dc92a3b66236a302a54049a08840e0"/><file name="Ideal.php" hash="fef986eaba046584083e36f3609a0013"/><file name="Incasso.php" hash="aebe891d50b69970bd46f59d23814edb"/><file name="Instore.php" hash="f175a59da6a95ce976a2b516cd12ed82"/><file name="Klarna.php" hash="5af95f201b4318cf8d35441a735ba513"/><file name="Maestro.php" hash="82b16a17cd78e1ad6f46fe751da7c8e4"/><file name="Mistercash.php" hash="ed955716ad3c8ad4bc00f374cd0cfd8c"/><file name="Mybank.php" hash="057c8079eebde684e9227ab2d7e14405"/><file name="Overboeking.php" hash="f4be14559a4a8c3e2daec114f45bcdd2"/><file name="Paylink.php" hash="88aa76f66dd6de2c1edbaa8fa2f82848"/><file name="Paypal.php" hash="f9579c1c34eb4436e53f761c2dee258a"/><file name="Paysafecard.php" hash="6df3b810346618d9161a8e9cac559deb"/><file name="Podiumkadokaart.php" hash="eeac3bafc861cffb016b9a2b2e3826a9"/><file name="Postepay.php" hash="7aa30da423bf38cfdf4a4deb6b628d1d"/><file name="Sofortbanking.php" hash="6900b858d9081ba94c1eb2d543672891"/><file name="Telefoon.php" hash="54c8520b21e1c999b52c54e93b542df8"/><file name="Visamastercard.php" hash="ce3a7868f9b8860acaaf176fc153896f"/><file name="Vvvgiftcard.php" hash="4830f8b4d221316ecdcb28b419799d23"/><file name="Webshopgiftcard.php" hash="3061340972cc57c3baf5a372a1fd7b61"/><file name="Wijncadeau.php" hash="72b1003d47bf7d03c8c14f3a04919e17"/><file name="Yehhpay.php" hash="1dfaa01621b4a366a6a83c92471c4dfd"/><file name="Yourgift.php" hash="4a2fafa29ca7d860e99529dd7f2cbff4"/></dir><dir name="Sales"><dir name="Order"><dir name="Creditmemo"><file name="Totals.php" hash="ed22b3a323eafbea1e211ce7b8babf5d"/></dir><dir name="Invoice"><file name="Totals.php" hash="f609b1022bf81824e8863548bb97ca70"/></dir><file name="Totals.php" hash="cdb66b39cea22a6ed2aef9454c90c4b7"/></dir></dir></dir><file name="Exception.php" hash="a200bf2c08b9b9ee4d126feb40abbd19"/><dir name="Helper"><file name="Data.php" hash="7a85d020f0d905b3036fc4283230b45c"/><file name="Order.php" hash="4c9403a8af8d532e7a1f61a22f701d3f"/><file name="Total.php" hash="0a7d2b69cd75323c38d69de9073db4c0"/></dir><dir name="Model"><dir name="Backend"><file name="Trim.php" hash="a232e48f459a6556c393f4da7a0d4139"/></dir><dir name="Mysql4"><dir name="Option"><file name="Collection.php" hash="54034bcf55cc7586e3d9cea66a267ed0"/></dir><file name="Option.php" hash="70563149e562bb27cee0f8041e170fce"/><dir name="Optionsub"><file name="Collection.php" hash="90f32544532471e2fb2dcd5a54b66be8"/></dir><file name="Optionsub.php" hash="20838820f4dc50ca04c8faf79597aea0"/><dir name="Transaction"><file name="Collection.php" hash="289e4368ab9d03e36bec938f9b3c9666"/></dir><file name="Transaction.php" hash="cb2787ab540acf82e94daef0ba07235e"/></dir><file name="Observer.php" hash="12fe99ed9392d34d11f8dd3c5c142914"/><file name="Option.php" hash="2a42d9bb5040b1f2964c146149cb1afd"/><file name="Optionsub.php" hash="acc178145aec8aa3f813055188cec3b5"/><dir name="Paymentmethod"><file name="Afterpay.php" hash="ad86753b77f5ba38f9f487a21b5dd740"/><file name="Afterpayem.php" hash="0e46d05dbd0e50568ce501f015a4bef9"/><file name="Amex.php" hash="7b4157754d63950c3896a516db92e8f2"/><file name="Billink.php" hash="16c12d733d8a1e22e92a4e8ee7dcffd1"/><file name="Bitcoin.php" hash="496ec9c7912b8b284168e93640528ed6"/><file name="Capayable.php" hash="60f67926b2921a8b88b5b00766ae4694"/><file name="CapayableGespreid.php" hash="cf13bf9b313b1e73afc66ca9953291cf"/><file name="Cartebleue.php" hash="9c7582f774e76a5932a58a8b9ec9e51a"/><file name="Fashioncheque.php" hash="68355c9aaaf281b47d805dd09a29a2e4"/><file name="Focum.php" hash="8f7e4b3dfde76bf83a5a72d38cd276c3"/><file name="Gezondheidsbon.php" hash="9eb4a0560499cfa77bfeb0caf2721880"/><file name="Giropay.php" hash="0c1a03865705abf36a515f4ce853fe79"/><file name="Givacard.php" hash="674b31ad7ec22621b57093da2944dec0"/><file name="Ideal.php" hash="ce91a44aae3943e0f17fbd2fed5bf3c9"/><file name="Incasso.php" hash="201b14ae2b7ca0c3ca57c10c7f63539f"/><file name="Instore.php" hash="b5753b82c481db4dd20df558b1466137"/><file name="Klarna.php" hash="2acd614cae4e98808af233b67e72091f"/><file name="Maestro.php" hash="eaa24f85ca579779f8f48d0b55dbf41f"/><file name="Mistercash.php" hash="f731220c7c1b1bef18632d2463d9a1a7"/><file name="Mybank.php" hash="15343fcf04a43da6209a2d68e530ed8d"/><file name="Overboeking.php" hash="9d2829863036d3990a1e1e650fa651b3"/><file name="Paylink.php" hash="9817ea9b14aa5be1e236758e354ce554"/><file name="Paypal.php" hash="cab6b68d26e84407fa33089df7ac54c8"/><file name="Paysafecard.php" hash="932534b552ea0668aa7923c931dd546a"/><file name="Podiumkadokaart.php" hash="98e0fda57978ac23f8ccac603a62c55d"/><file name="Postepay.php" hash="b98826f7a81a1631227de202ed769e1d"/><file name="Sofortbanking.php" hash="989478f44af7f829d5566734bfae96c3"/><file name="Telefoon.php" hash="8744b545ef8c5f55cc6c3d209c27e8af"/><file name="Visamastercard.php" hash="db8cf0d660bd13a52ed79822350bbcc5"/><file name="Vvvgiftcard.php" hash="a726dbdf43590afec40b898797c6e90c"/><file name="Webshopgiftcard.php" hash="746e512f5421e465010afe85a3db88fc"/><file name="Wijncadeau.php" hash="f5de786cd19fc9dc9ce82e15a2c78c2d"/><file name="Yehhpay.php" hash="f5c4a4b71fd35237479370e7a91647dc"/><file name="Yourgift.php" hash="dd5f2c77dd2a2c473d9153fb243cf454"/></dir><file name="Paymentmethod.php" hash="22fdf0f16389f5b71e1b961a49bed664"/><dir name="Paypal"><file name="Cart.php" hash="4e2c74c4f744ddc613023ebeea924a25"/></dir><dir name="Resource"><file name="Setup.php" hash="4bf6f4eb88b06047e021f55077898312"/></dir><dir name="Sales"><dir name="Order"><dir name="Creditmemo"><dir name="Total"><file name="Paymentcharge.php" hash="619284bfb8096b8077e1db0d5706d258"/></dir></dir><dir name="Invoice"><dir name="Total"><file name="Paymentcharge.php" hash="c20ce4be3936651db99074c21a9135d6"/></dir></dir></dir><dir name="Quote"><dir name="Address"><dir name="Total"><file name="Paymentcharge.php" hash="4476aaa1f0bf6ea3ba4e028b698b1767"/></dir></dir></dir></dir><dir name="Source"><file name="Gateway.php" hash="78d710bc4415e9872f270cd15b30551d"/><file name="Iconsize.php" hash="6e3d674afb63ddcc8f30a968b8a9dd71"/><file name="Language.php" hash="53db4f77dcf223a1afd260c565150bfe"/><dir name="Paymentmethod"><file name="Active.php" hash="ee0210654744b696b79a95f1c4747be1"/><dir name="Afterpay"><file name="Active.php" hash="631b79947d92cf932c80eca13f53afe9"/></dir><dir name="Afterpayem"><file name="Active.php" hash="1d049374372537c86e2c593e452889d1"/></dir><dir name="Amex"><file name="Active.php" hash="bc1e611d56d0372959a4b66f172cd1e0"/></dir><dir name="Billink"><file name="Active.php" hash="18d119c4720809e1cd82a51e95dd8a77"/></dir><dir name="Bitcoin"><file name="Active.php" hash="fc89631b3cda4a656d9b7f3973849eae"/></dir><dir name="Capayable"><file name="Active.php" hash="65d3e8a72527f75942e6054192965aa7"/></dir><dir name="CapayableGespreid"><file name="Active.php" hash="a471a6a2c7a3a59780c89a67ed8a6924"/></dir><dir name="Cartebleue"><file name="Active.php" hash="bcf8c51ecfbc8d44c9f49a39dc764bd4"/></dir><dir name="Fashioncheque"><file name="Active.php" hash="c5fa9deac7ffd651b049ffb72133163f"/></dir><dir name="Focum"><file name="Active.php" hash="418942b5cf3a48d515cf3589b00637e6"/></dir><dir name="Gezondheidsbon"><file name="Active.php" hash="f24be4a3c557a717634e9d874c442d02"/></dir><dir name="Giropay"><file name="Active.php" hash="1552d5fc9fbb84a2d2f3871a55ac4ec6"/></dir><dir name="Givacard"><file name="Active.php" hash="c69157dff1c3dc4572d693c63140969b"/></dir><dir name="Ideal"><file name="Active.php" hash="85d0fcdfa9d3258d6ff5bceae5b0042f"/><file name="Selecttype.php" hash="37e19c073cf39469efe1ce9d7548a4b7"/></dir><dir name="Incasso"><file name="Active.php" hash="d99d1c2538d021f126243b738564fc4a"/></dir><dir name="Instore"><file name="Active.php" hash="3a6bc8939693c22823e0a9c9c67ef22a"/></dir><dir name="Klarna"><file name="Active.php" hash="c16af8dbed563f8eb0c0794428955283"/></dir><dir name="Maestro"><file name="Active.php" hash="c33b890119ecfcbc4f67044ac8750f42"/></dir><dir name="Mistercash"><file name="Active.php" hash="24633712262b195c058abb08b7468ee6"/></dir><dir name="Mybank"><file name="Active.php" hash="d29339a25c6a1bd4c02e0609ad3668cf"/></dir><dir name="Overboeking"><file name="Active.php" hash="10c1163ece5af584568e7cc8a2aa6975"/></dir><dir name="Paypal"><file name="Active.php" hash="626755f8781e02fdc5693b4f21a43be3"/></dir><dir name="Paysafecard"><file name="Active.php" hash="498f7ca442b0b640a40917b9e891664c"/></dir><dir name="Podiumkadokaart"><file name="Active.php" hash="2836dfcb49fb6e267c169ea0f1a8e011"/></dir><dir name="Postepay"><file name="Active.php" hash="40101c5b929e5c652b7c73d38bd55b00"/></dir><dir name="Sofortbanking"><file name="Active.php" hash="6090cc3aa35ba5655e1c3766c22d73a8"/></dir><dir name="Telefoon"><file name="Active.php" hash="e48b97faa7bf1744787e3ac60c0f178c"/></dir><dir name="Visamastercard"><file name="Active.php" hash="89130148898e2cf60e97630820ab8958"/></dir><dir name="Vvvgiftcard"><file name="Active.php" hash="ed0258c05c2e16ea189dfbd221a45b51"/></dir><dir name="Webshopgiftcard"><file name="Active.php" hash="4340b8530118937df32caa2a53294b5b"/></dir><dir name="Wijncadeau"><file name="Active.php" hash="b0b9a73e470a188731c6121b642c3710"/></dir><dir name="Yehhpay"><file name="Active.php" hash="bea1e10dcd469224e5f356864a691de2"/></dir><dir name="Yourgift"><file name="Active.php" hash="2e277ce8b3407f037468c17b818f4144"/></dir></dir><file name="Sendmail.php" hash="626c01900a480ecd790bf56324e4590c"/><file name="Showfee.php" hash="1203dc1beb95867f232e0945a1728146"/><dir name="Status"><file name="PendingPayment.php" hash="9358466304af44f3a22f77fec7630be1"/><file name="Processing.php" hash="aea6f58cfb750a93f03ae4b435c59766"/></dir></dir><dir name="System"><dir name="Config"><dir name="Source"><file name="Chargetype.php" hash="82c781472b46ae466f2ec6d6b0251df3"/></dir></dir></dir><dir name="Transaction"><file name="LockException.php" hash="57054928500c8bac587bb93f631e14fc"/></dir><file name="Transaction.php" hash="8bb6b623b503640d605cde5b27af50e8"/></dir><file name="composer.json" hash="6c8823e38701d6ad4db0d02873530de2"/><file name="composer.lock" hash="dccb41623004068bd6cfef8fe4919092"/><dir name="controllers"><file name="CheckoutController.php" hash="e49b7563e4c080ea8db8e307f50d5780"/><file name="OrderController.php" hash="e2da5c7341641a0db70c744f3c1d16a3"/></dir><dir name="etc"><file name="config.xml" hash="7e85e98d2ff1df87bb6bea9d8986c686"/><file name="system.xml" hash="e11dfaf8590ddd5f4480ad047cbde738"/></dir><dir name="sql"><dir name="pay_payment_setup"><file name="install-3.7.0.php" hash="b8dead7d2b7f40e567a620468783b342"/><file name="upgrade-3.0.0-3.1.0.php" hash="4b76b4f06ca7d3ffcec5e55a72773340"/><file name="upgrade-3.1.2.2-3.1.2.4.php" hash="aa75d3330b6d6db8d41a33404c6ca923"/><file name="upgrade-3.1.2.7-3.1.2.8.php" hash="22882b3a6a6977d1cb2b29cecb5a792f"/><file name="upgrade-3.2.1-3.2.2.php" hash="c30b9d725fc24bc00ce1548a7cb23137"/><file name="upgrade-3.2.13-3.2.14.php" hash="4fa59649ffc6a7cc6af3050e5f2a9700"/><file name="upgrade-3.6.5-3.6.6.php" hash="9c181eca48b537f84910292982b99c02"/><file name="upgrade-3.6.6-3.7.0.php" hash="6dc3deaa1086c87ef9d994ac6f7f7ea3"/></dir></dir><dir name="vendor"><file name="autoload.php" hash="fdadd3ab9e39bfd346c019dd4a6ca188"/><dir name="composer"><file name="ClassLoader.php" hash="c67ebce5ff31e99311ceb750202adf2e"/><file name="LICENSE" hash="efa04e84182a9053f7563cf94064966f"/><file name="autoload_classmap.php" hash="8645d3a4e3ad87e7cf4d88a46717aab4"/><file name="autoload_namespaces.php" hash="35e12c7d76c4a81633bcf547c0e229a9"/><file name="autoload_psr4.php" hash="8fb5e4874e376f6218f954feb91d329f"/><file name="autoload_real.php" hash="29aed176b804fbe46a2756c54e7d2547"/><file name="autoload_static.php" hash="fed89d87b7ac73ef219dafa263bd3be9"/><file name="installed.json" hash="4ce976d508cdad595fcc7266b3bc7b38"/></dir><dir name="paynl"><dir name="sdk"><file name="README.md" hash="ad26dbf74651fecbe208de7cbe336bd0"/><file name="composer.json" hash="8d66100746c7a72daae2eabbafa624b3"/><dir name="samples"><file name="config.sample.php" hash="4fab7308ade8623b5335732a9904e9bd"/><dir name="directDebit"><file name="add.php" hash="4034615d2c1c9b4dd3990749fe2fcb1d"/><file name="get.php" hash="5e5f3bf39602bd7f9a24a6bafdc4d85e"/><dir name="mandate"><file name="add.php" hash="7bc185514dd6b3727b058a8ee8f410bd"/><file name="addTransaction.php" hash="f8fa8c889c4878c4f31a586b00e78c9e"/><file name="get.php" hash="418ee427a180237a7a259cedd349e74c"/></dir><dir name="recurring"><file name="add.php" hash="7292977cd9de5da0e35569e5a3dc3a13"/><file name="get.php" hash="b96da3f0716a43625b1cc918edf90f7f"/></dir></dir><file name="exchange.php" hash="ece154591da8abd7f167635adbb84a3d"/><dir name="instore"><file name="confirmPayment.php" hash="0dc20bbab68f5ad8014d1627417c74b2"/><file name="getAllTerminals.php" hash="248a1c34de92cb4b26928e12eac7a24d"/><file name="getReceipt.php" hash="22f9736437a47f88d2c9ac8ad991c311"/><file name="payment.php" hash="e2895873daef84ef859a9251f62e7910"/><file name="status.php" hash="76172816339a3342beacbd90a46644b3"/></dir><file name="return.php" hash="7aa22326d6a8bd68b633e202fd85a487"/><dir name="service"><file name="getPaylinkUrl.php" hash="95962291c6feab31089be6d324f79283"/></dir><dir name="transaction"><file name="capture.php" hash="16d94830ef9737004c1704d31025e64a"/><file name="paymentMethods.php" hash="bb61b10cc5fd28db8708bb3c337aa7a8"/><file name="refund.php" hash="3ff5fe3329078bae5b70957317b077fc"/><file name="start.php" hash="520eb67c540d80688c046752c40342cd"/><file name="void.php" hash="13ae46719190684c9749069f70a38bcd"/></dir><dir name="validate"><file name="isPayServerIp.php" hash="19058a723db11ddeed3c52a3ba917ce6"/></dir></dir><dir name="src"><dir name="Api"><file name="Api.php" hash="f85c4cf757986c8dd1f858646fdb0438"/><dir name="Currency"><file name="Currency.php" hash="89ae7fd4e4095e374f33ba66f7d7ca32"/><file name="GetAll.php" hash="2fdc83ffbb9671d88dc583890118b6ef"/></dir><dir name="DirectDebit"><file name="DebitAdd.php" hash="7199518dc836d34144ad72711d435bbe"/><file name="DebitGet.php" hash="04115c7e84d216396a5f2f1b844a6e0f"/><file name="Delete.php" hash="851f6abc00869821aeceaebf78ce2f80"/><file name="DirectDebit.php" hash="b11c24151503c2402f6c696b2dab90af"/><file name="MandateAdd.php" hash="e92716cd8eeddab5ac0e28666a5ddd61"/><file name="MandateDebit.php" hash="ae09eb661936b125a3bca5bba39ca375"/><file name="MandateGet.php" hash="5e53cf099612a0b82a89f3516ec55d17"/><file name="RecurringAdd.php" hash="167a30314a8713bbfaa6906ae72aad57"/><file name="RecurringGet.php" hash="db7d5d73370b0428f86667e1f6b92101"/><file name="Update.php" hash="6ee552228f2fd98990eb453204b8506a"/></dir><dir name="Instore"><file name="ConfirmPayment.php" hash="f8dad4880859a66e605209155459df01"/><file name="GetAllTerminals.php" hash="17f824a8519736ac04f63829f2d83edb"/><file name="GetTransactionTicket.php" hash="57e956e4bfef63a853b03759d13f8174"/><file name="Instore.php" hash="a4ebe56c07aabf875fa2975929a33f21"/><file name="Payment.php" hash="da4ee88b3b6992f7a4b438d4c2991330"/><file name="Status.php" hash="0507f8028097860e3145dee82f364297"/></dir><dir name="Refund"><file name="Add.php" hash="3dc8bf8b3c7be9f28982188276fcd74c"/><file name="Refund.php" hash="7d237e5128a9c1063ba70e705cca3c37"/></dir><dir name="Service"><file name="GetPayLinkUrl.php" hash="a290b8533f30b871b46f3a0295c41dad"/><file name="Service.php" hash="1e664edea598d318466b050144ba6880"/></dir><dir name="Transaction"><file name="Approve.php" hash="d1709966f1f042b41d1bc44926f27dee"/><file name="Capture.php" hash="604738b3fe9b4451d5802de1c07fc9ba"/><file name="Decline.php" hash="0a6c37c859560af8bef2ec37edc64450"/><file name="GetService.php" hash="0bca117078f4ff5e705e0577fb70c586"/><file name="Info.php" hash="7a9f8568b606c096984c0a7da7916e11"/><file name="Refund.php" hash="d4e01fbcb8abba8df170498c0dd56168"/><file name="Start.php" hash="8cd62ceeaedd845378c9d2c714aca19c"/><file name="Transaction.php" hash="d80ebf3623abd560e8ecd4ae8c92639a"/><file name="Void.php" hash="e76c3dc2432e51db9c7d785ee4f0dbd5"/></dir><dir name="Validate"><file name="IsPayServerIp.php" hash="c403fb225d08b6b011edf866c9d43156"/><file name="Validate.php" hash="d3feb1fa0edb37bbee86ef935d149f38"/></dir><dir name="Voucher"><file name="Activate.php" hash="7932b7899e9770821e712b59e952e3b5"/><file name="Balance.php" hash="5e4cf8999d7e353d98006c8b068ca069"/><file name="Charge.php" hash="525d1e8491418c49e705d08f907aabdc"/><file name="Voucher.php" hash="ba71c6cd712fb89c6682a70b03f550f3"/></dir></dir><file name="Config.php" hash="e73385a4fc039062d12d406435a9716b"/><dir name="Curl"><file name="Dummy.php" hash="1745478bcae3d5081f9b12cc81f1e0ca"/></dir><file name="Currency.php" hash="49f1340a25d7a9b1cfdfb3073104e92c"/><dir name="DirectDebit"><file name="Mandate.php" hash="6b778ce4c44d2d2d4db66f6dcea08e29"/><file name="Recurring.php" hash="821065f96b13bda3d0f835638a745ee0"/></dir><file name="DirectDebit.php" hash="329bd85db112da942644a766b79802f0"/><dir name="Error"><file name="Api.php" hash="bbe509d6742ba5ac54e67db2865b9d59"/><file name="Error.php" hash="63a453baf90355604d24ddf015df7a34"/><file name="NotFound.php" hash="115ec3c5650244dd84c9e71ada3945ed"/><dir name="Required"><file name="ApiToken.php" hash="0485882225b6e0679e0f6c974b1b7aeb"/><file name="ServiceId.php" hash="8e17bb932fa9b03c265512143c57dd5d"/></dir><file name="Required.php" hash="37f246dd05e95cb5a5793ec80b618f32"/></dir><file name="Helper.php" hash="5b327f622fcc7b6dcc601761283956d2"/><file name="Instore.php" hash="a114c542769c3ead1521ee52bfab58e7"/><file name="Paymentmethods.php" hash="e27a873550b7f9b0e86b4b0b079abbdc"/><file name="Refund.php" hash="ab8011579f035c5529f71e1af32ee816"/><dir name="Result"><dir name="DirectDebit"><file name="Add.php" hash="710be2f5e0c263226de6ddcc12b5160f"/><file name="Get.php" hash="044463d71af40ef9f8022bf9aa54394c"/><dir name="Mandate"><file name="Add.php" hash="28c1cd015980a69a0827509222b13922"/><file name="AddTransaction.php" hash="60d92d48c11921d03f036aa6b3b3425e"/><file name="Get.php" hash="e27eda30346c16512d74d2682c8542b0"/></dir><dir name="Recurring"><file name="Add.php" hash="5a317db77bccf59ec7ec3b5604ec53ba"/><file name="Get.php" hash="ed4c97826dd6af0144e415d93535d61d"/></dir></dir><dir name="Instore"><file name="ConfirmPayment.php" hash="c40673aa1b0986581f20c64c03be9e5e"/><file name="Payment.php" hash="4cebf421c4fc05ec86d3adfef5ec8261"/><file name="Receipt.php" hash="93363b372e01a7125335d574d8634760"/><file name="Status.php" hash="9a53d172946cd5760d058370d52ba2c7"/><file name="Terminals.php" hash="865b4b8afd074f70c4e2201bc11f4771"/></dir><dir name="Refund"><file name="Add.php" hash="d055da637564eef29e804a1faef1dbf8"/></dir><file name="Result.php" hash="4175022c91a50bdbd91ffe438b043d2b"/><dir name="Transaction"><file name="Refund.php" hash="3e22f2aa8f531a6eb07fde33047ed82e"/><file name="Start.php" hash="7200ebdb50cf149ceea8c013c82c6eab"/><file name="Transaction.php" hash="351737022ccf57de09e75d25fb7eedfd"/></dir><dir name="Voucher"><file name="Voucher.php" hash="d3d991fac30467cce37b0de53a615ae1"/></dir></dir><file name="Service.php" hash="bcfb8d540a089363ddd8db69d09c8b60"/><file name="Transaction.php" hash="4f459a95471b40ee742f0d78cef3a740"/><file name="Validate.php" hash="8469564f78184177934295ce28b96a54"/><file name="Voucher.php" hash="d6e202d522ffd37692aad50989f001ec"/></dir><dir name="tests"><file name="ConfigTest.php" hash="b7f00c625a9df9718d97b3bf6b688c99"/><file name="CurrencyTest.php" hash="e9cfe5bb2bc4371321fb408fc53f83d8"/><file name="HelperTest.php" hash="61f43eaa726ad662ab47f9a718438983"/><file name="PaymentmethodsTest.php" hash="eec5b50c78f43edac925cfb9f89b33cd"/><file name="RefundTest.php" hash="8a93fe0d1eb2ffe13c14214d4cd0109a"/><file name="TransactionTest.php" hash="85318b09514abc0432dcda91c647187f"/><file name="ValidateTest.php" hash="b5090dd8ee903face24f21a9bdce2c95"/><dir name="dummyData"><dir name="Refund"><file name="refund.json" hash="f9e4da66248a64f964723b4ed6c7ffdf"/><file name="refundError.json" hash="c71c384b2cfae94c429ccfb8d28fd4e1"/></dir><dir name="Transaction"><dir name="Result"><file name="approve.json" hash="cca7667c9092cae77189660118f45aaa"/><file name="decline.json" hash="cca7667c9092cae77189660118f45aaa"/><file name="refund.json" hash="f9e4da66248a64f964723b4ed6c7ffdf"/><file name="refundError.json" hash="c71c384b2cfae94c429ccfb8d28fd4e1"/><file name="transactionPaid.json" hash="938a9e79081292a6ebaf2163175d64ec"/><file name="transactionVerify.json" hash="a04928cef5af76fa2d3cd23662517d89"/></dir><file name="startOk.json" hash="0fea5cb9fa6a59dba6226942053648fb"/></dir><dir name="Validate"><file name="isPayServerIpNo.json" hash="476b4edbf5412cdfb318c74fc21a11d8"/><file name="isPayServerIpYes.json" hash="6ce66f3fb6a06d6b77059803d4fef7c0"/></dir><file name="currencies.json" hash="103b88f54e43ff2585d42a70b6370c67"/><file name="getService.json" hash="345a55bdadb305146b121b7996f4b9c0"/></dir></dir><file name=".gitignore" hash="54b761861a00672137da5cf9fe00e2de"/><file name=".travis.yml" hash="ccf7c0d24624132428b4b9539b78ecf3"/></dir></dir><dir name="php-curl-class"><dir name="php-curl-class"><file name="LICENSE" hash="7246f848faa4e9c9fc0ea91122d6e680"/><file name="README.md" hash="f2eeff9b53b4824b6fd88b2be85e4dcc"/><file name="composer.json" hash="c27df8073014d0fea654e916009f8466"/><dir name="docs"><file name="Makefile" hash="1b19a74bb48c433ab52d7c381b78dc7e"/><file name="README.md" hash="9e9a36f20f8c03c734345beaa2edb0a5"/><dir name="source"><file name="conf.py" hash="98412cfa8535eb2749a53b6d88371635"/><file name="faq.rst" hash="fc97af6348e454000aca799cab6d0053"/><file name="index.rst" hash="d8e3e63cc6a63f60721bc1a1c3f5001c"/><file name="overview.rst" hash="1e62e027121ef9aaa19bdd317d44ede2"/></dir><file name=".gitignore" hash="2529e845806d223afb1ff7dcdeab55d4"/></dir><dir name="examples"><file name="README.md" hash="944a15e05bd22c875d6698a6389399c8"/><file name="coinbase_account_balance.php" hash="06c04fad60f4fa6670f674165003e9af"/><file name="coinbase_spot_rate.php" hash="27bb3b0f5387e019ff906fe3d13bf2c4"/><file name="deviant_art_rss.php" hash="fa0151454eb0de60483bfbf2649b8f8a"/><file name="download_file.php" hash="c1cced0f90217042812e29db6ac0c10d"/><file name="download_file_with_callback.php" hash="3ea9b3feebbc3bd83f77ed52a18de05d"/><file name="flickr.class.php" hash="43179dade7dd33508981ee478002a2f5"/><file name="flickr_photo_search.php" hash="26d02cb1ccdfb7a7a3ec39b6c59d4971"/><file name="flickr_upload_photo.php" hash="0d11e5ba8f41398fec8e6cc977b55c82"/><file name="get.php" hash="c47177bc4f87f84b1502f35ba0e6d1e6"/><file name="get_base_url_1.php" hash="9ed7f693187b90ce9ee1aa4b420ffe52"/><file name="get_base_url_2.php" hash="8b499939e897066c0885928ff475b44b"/><file name="github_create_gist.php" hash="3192e4063a43dce6bf3901d782c4ac40"/><file name="gmail_send_email.php" hash="5e4411eb80b16d4d42f2b94053f32c30"/><file name="google_maps_geocode_address.php" hash="f150e2ec72013094a774092b2696d670"/><file name="google_plus_profile.php" hash="ab6e6cf7b33945fda76fe7c2ed66c540"/><file name="gratipay_send_tip.php" hash="05ea71d33448196288445feb14d431d6"/><file name="instagram_popular_media.php" hash="f7266d36e6fa96ac7594654a6918abf5"/><file name="instagram_search_photos.php" hash="f8d44579efe04a7ed739e45a5af26bdd"/><file name="mailchimp_subscribe_email_address.php" hash="1bd4d2508a06096a33088943c539d643"/><file name="multi_curl_before_send.php" hash="98f002a915261b6375e2a8cbf033c624"/><file name="multi_curl_delete.php" hash="2384ea09bff8b031565e63e75e313040"/><file name="multi_curl_download.php" hash="8701601b7192d1671ed834020684480d"/><file name="multi_curl_download_with_callback.php" hash="f68cffed4c903407320396188604f422"/><file name="multi_curl_get.php" hash="f4b8b67ca9d8370a48ca791b9cd37328"/><file name="multi_curl_get_callbacks.php" hash="b8af5ee91e9c24a2cf1f1440a244b3ce"/><file name="multi_curl_patch.php" hash="9237e7c26a7f0cd45034bf55e602c256"/><file name="multi_curl_post.php" hash="1f7a00588adde05f39e1f93d3840d7ed"/><file name="multi_curl_put.php" hash="5ba9ddeae279a4089f7f7eaad942aa95"/><file name="post.php" hash="5414eda7a246263ddeb5920ee7c45bc3"/><file name="post_json.php" hash="0a5fdb77bc668ba5d841eca3fb2ab75c"/><file name="post_redirect_get.php" hash="042d70bc4d0bf463b89c602b20776bec"/><file name="progress.php" hash="279aa9284556d014fc78e96c1b75cd50"/><file name="progress_advanced.php" hash="c3d91329a1fc927bab54c10bed176408"/><file name="proxy.php" hash="e3acfff828e3949c2e984fe860fa479f"/><file name="put.php" hash="7d75554c8c4b2195bd2598c77c952838"/><file name="reddit_top_pics.php" hash="7fda200709ea7ec03df2c8a53a485892"/><file name="set_cookie.php" hash="2600096ebec5c6583156c9280955a7e2"/><file name="set_url_1.php" hash="fabbe1c29525b92888a0936485691d29"/><file name="set_url_2.php" hash="3c71c517455f994a06cb08d2e94ce0c8"/><file name="twitter_post_tweet.php" hash="a252660e9bffd0641381a0ad0813fa78"/><file name="twitter_trending_topics.php" hash="23053d5dfd766c98182378f3a1249e5d"/><file name="upload_file.php" hash="05050db0aa963192e9d85171b77ae341"/><file name="youtube_list_playlist_videos.php" hash="6c5ae3f3cdf6dcb5c5fe360624d47bef"/><file name="youtube_video_count.php" hash="f9d7598ab61717f719b99d9b076b2ca4"/></dir><dir name="scripts"><file name="bump_major_version.php" hash="f930cf07539423734d5f7378fa5646de"/><file name="bump_minor_version.php" hash="03754135acff395b4ecca040471b509e"/><file name="bump_patch_version.php" hash="df1d6bdffd08a3972878fa9096ca8982"/><file name="update_readme_methods.sh" hash="6a84cc9cb7e74303a854104201333e0e"/><file name="v4_migration.php" hash="1204efd398ee5562283229f9e12250c3"/></dir><dir name="src"><dir name="Curl"><file name="CaseInsensitiveArray.php" hash="517e786b03deb69d055072059a6f6589"/><file name="Curl.php" hash="f80a854bc7e74bd2a9960dd95483fadd"/><file name="MultiCurl.php" hash="9030703db3afaf9ff3851454dca961b3"/></dir></dir><dir name="tests"><dir name="PHPCurlClass"><file name="Helper.php" hash="a90668ebc6045420e86582fd30c3c11c"/><file name="PHPCurlClassTest.php" hash="b1c186f447b184fdebd5b44b280ea820"/><file name="PHPMultiCurlClassTest.php" hash="80cbe86949f4c0a2fa9002c1135bbada"/><file name="server.php" hash="69ed2817f2a3d5fc91ccfc2b0a35d5fa"/></dir><file name="before_script.sh" hash="9662ccee85ad2a2d6756bc9042f1a972"/><file name="check_syntax.sh" hash="bcec868d19007801e7a6d97a8a352d30"/><file name="phpunit.xml" hash="02538f4dc944563d09cb7c8503304f6c"/><file name="run.sh" hash="b480ddd83c3c09ec768a25ed8ca53e02"/><file name="script.sh" hash="fc29b81395c851a876531d73a2591b55"/></dir><dir name=".github"><file name="CONTRIBUTING.md" hash="8ddd43058158bea44998b574a271fe64"/><file name="ISSUE_TEMPLATE.md" hash="2249b43c827634a6b3616cfabd9f51f2"/></dir><file name=".gitignore" hash="62f86c4700c6fd118d837d9b9cb369ae"/><file name=".travis.yml" hash="3da971d2cee55f305f06c243db0179fb"/></dir></dir></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="pay"><dir name="payment"><dir name="form"><file name="billink.phtml" hash="7fa7d3e113b911744ba130a9084a6b87"/><file name="default.phtml" hash="d41d8cd98f00b204e9800998ecf8427e"/><file name="focum.phtml" hash="d5e55377466c3fcc5b45a4104fbc020d"/><file name="ideal.phtml" hash="6cfa69a8773dfc091e055b531bbf31dc"/><file name="idealSelect.phtml" hash="13936d975af0083512378f5936a5896d"/><file name="instore.phtml" hash="5299cf1294e69a744c6a87405859c7fd"/><file name="klarna.phtml" hash="b154ba769fd50ece09109f8780ba3b5b"/><file name="yehhpay.phtml" hash="b154ba769fd50ece09109f8780ba3b5b"/></dir><file name="mark.phtml" hash="ab61d728f0d237a34f78300554d8ba0f"/></dir></dir></dir></dir></dir></dir><dir name="adminhtml"><dir name="base"><dir name="default"><dir name="template"><dir name="pay"><dir name="payment"><dir name="form"><file name="billink.phtml" hash="7fa7d3e113b911744ba130a9084a6b87"/><file name="default.phtml" hash="d41d8cd98f00b204e9800998ecf8427e"/><file name="focum.phtml" hash="d5e55377466c3fcc5b45a4104fbc020d"/><file name="ideal.phtml" hash="6cfa69a8773dfc091e055b531bbf31dc"/><file name="idealSelect.phtml" hash="13936d975af0083512378f5936a5896d"/><file name="instore.phtml" hash="5a93eefb7c592c05478681dce9d16b3b"/><file name="klarna.phtml" hash="1a496f7ebb8bd1361332519a3331faaa"/><file name="paylink.phtml" hash="1f030c00390300cac93e347872c560cf"/></dir><file name="mark.phtml" hash="ab61d728f0d237a34f78300554d8ba0f"/></dir></dir></dir></dir></dir></dir></target><target name="magemedia"><dir name="pay_payment"><file name="logo.png" hash="b45a2ccf5e85a713b786d85c1059afee"/></dir></target></contents>
|
18 |
<compatible/>
|
19 |
<dependencies><required><php><min>5.1.0</min><max>7.2.99</max></php><extension><name>curl</name><min/><max/></extension></required></dependencies>
|
20 |
</package>
|