Version Description
Download this release
Release Info
Developer | SkyVerge |
Plugin | WooCommerce PayPal Powered by Braintree Payment Gateway |
Version | 2.2.0 |
Comparing to | |
See all releases |
Code changes from version 2.1.4 to 2.2.0
- assets/css/frontend/wc-braintree.min.css +1 -1
- assets/images/button/connect-braintree.png +0 -0
- assets/images/button/connect-braintree@2x.png +0 -0
- assets/images/button/connect-braintree@3x.png +0 -0
- assets/js/frontend/wc-braintree-apple-pay.min.js +1 -0
- assets/js/frontend/wc-braintree.min.js +1 -1
- class-wc-braintree.php +59 -257
- i18n/languages/woocommerce-gateway-paypal-powered-by-braintree.pot +202 -117
- includes/api/class-wc-braintree-api-response-message-helper.php +1 -1
- includes/api/class-wc-braintree-api.php +39 -3
- includes/api/requests/abstract-wc-braintree-api-request.php +39 -8
- includes/api/requests/class-wc-braintree-api-customer-request.php +1 -1
- includes/api/requests/class-wc-braintree-api-payment-method-request.php +4 -0
- includes/api/requests/class-wc-braintree-api-transaction-request.php +1 -1
- includes/api/responses/abstract-wc-braintree-api-response.php +1 -1
- includes/api/responses/abstract-wc-braintree-api-transaction-response.php +1 -1
- includes/api/responses/abstract-wc-braintree-api-vault-response.php +1 -1
- includes/api/responses/class-wc-braintree-api-client-token-response.php +1 -1
- includes/api/responses/class-wc-braintree-api-credit-card-transaction-response.php +1 -1
- includes/api/responses/class-wc-braintree-api-customer-response.php +1 -1
- includes/api/responses/class-wc-braintree-api-merchant-configuration-response.php +54 -0
- includes/api/responses/class-wc-braintree-api-payment-method-nonce-response.php +26 -6
- includes/api/responses/class-wc-braintree-api-payment-method-response.php +1 -1
- includes/api/responses/class-wc-braintree-api-paypal-transaction-response.php +1 -1
- includes/apple-pay/api/class-wc-braintree-apple-pay-api-payment-response.php +52 -0
- includes/apple-pay/class-wc-braintree-apple-pay-frontend.php +96 -0
- includes/apple-pay/class-wc-braintree-apple-pay.php +118 -0
- includes/class-wc-braintree-capture.php +82 -0
- includes/class-wc-braintree-frontend.php +4 -14
- includes/class-wc-braintree-lifecycle.php +292 -0
- includes/class-wc-braintree-payment-method-handler.php +1 -1
- includes/class-wc-braintree-payment-method.php +1 -1
- includes/class-wc-braintree-paypal-cart.php +15 -17
- includes/class-wc-gateway-braintree-credit-card.php +252 -30
- includes/class-wc-gateway-braintree-paypal.php +214 -21
- includes/class-wc-gateway-braintree.php +24 -80
- includes/payment-forms/abstract-wc-braintree-payment-form.php +12 -3
- includes/payment-forms/class-wc-braintree-hosted-fields-payment-form.php +33 -22
- includes/payment-forms/class-wc-braintree-paypal-payment-form.php +21 -8
- lib/skyverge/license.txt +1 -1
- lib/skyverge/woocommerce/Addresses/Address.php +290 -0
- lib/skyverge/woocommerce/Addresses/Customer_Address.php +154 -0
- lib/skyverge/woocommerce/Lifecycle.php +511 -0
- lib/skyverge/woocommerce/admin/abstract-sv-wc-plugin-admin-setup-wizard.php +1303 -0
- lib/skyverge/woocommerce/api/abstract-sv-wc-api-json-request.php +133 -0
- lib/skyverge/woocommerce/api/abstract-sv-wc-api-json-response.php +104 -0
- lib/skyverge/woocommerce/api/abstract-sv-wc-api-xml-request.php +213 -0
- lib/skyverge/woocommerce/api/abstract-sv-wc-api-xml-response.php +136 -0
- lib/skyverge/woocommerce/api/class-sv-wc-api-base.php +45 -21
- lib/skyverge/woocommerce/api/class-sv-wc-api-exception.php +3 -3
- lib/skyverge/woocommerce/api/interface-sv-wc-api-request.php +23 -3
- lib/skyverge/woocommerce/api/interface-sv-wc-api-response.php +3 -3
- lib/skyverge/woocommerce/assets/css/admin/sv-wc-plugin-admin-setup-wizard.min.css +1 -0
- lib/skyverge/woocommerce/assets/css/admin/sv-wc-plugin-admin-setup-wizard.min.css.map +7 -0
- lib/skyverge/woocommerce/assets/css/mixins.scss +0 -0
- lib/skyverge/woocommerce/assets/images/ajax-loader.gif +0 -0
- lib/skyverge/woocommerce/assets/js/admin/sv-wc-plugin-admin-setup-wizard.min.js +1 -0
- lib/skyverge/woocommerce/assets/js/admin/sv-wc-plugin-admin-setup-wizard.min.js.map +10 -0
- lib/skyverge/woocommerce/assets/js/admin/sv-wp-admin-job-batch-handler.min.js +1 -0
- lib/skyverge/woocommerce/assets/js/admin/sv-wp-admin-job-batch-handler.min.js.map +10 -0
- lib/skyverge/woocommerce/changelog.txt +93 -1
- lib/skyverge/woocommerce/class-sv-wc-admin-notice-handler.php +15 -28
- lib/skyverge/woocommerce/class-sv-wc-helper.php +59 -4
- lib/skyverge/woocommerce/class-sv-wc-hook-deprecator.php +3 -3
- lib/skyverge/woocommerce/class-sv-wc-plugin-compatibility.php +94 -129
- lib/skyverge/woocommerce/class-sv-wc-plugin-dependencies.php +476 -0
- lib/skyverge/woocommerce/class-sv-wc-plugin-exception.php +3 -3
- lib/skyverge/woocommerce/class-sv-wc-plugin.php +532 -472
- lib/skyverge/woocommerce/class-sv-wp-admin-message-handler.php +132 -7
- lib/skyverge/woocommerce/compatibility/abstract-sv-wc-data-compatibility.php +3 -3
- lib/skyverge/woocommerce/compatibility/class-sv-wc-datetime.php +4 -4
- lib/skyverge/woocommerce/compatibility/class-sv-wc-order-compatibility.php +24 -5
- lib/skyverge/woocommerce/compatibility/class-sv-wc-product-compatibility.php +13 -3
- lib/skyverge/woocommerce/i18n/languages/woocommerce-plugin-framework-et.mo +0 -0
- lib/skyverge/woocommerce/i18n/languages/woocommerce-plugin-framework-et.po +2082 -0
- lib/skyverge/woocommerce/i18n/languages/woocommerce-plugin-framework.pot +1886 -0
- lib/skyverge/woocommerce/index.php +1 -1
- lib/skyverge/woocommerce/payment-gateway/Handlers/Capture.php +424 -0
- lib/skyverge/woocommerce/payment-gateway/admin/abstract-sv-wc-payment-gateway-plugin-admin-setup-wizard.php +67 -0
- lib/skyverge/woocommerce/payment-gateway/admin/class-sv-wc-payment-gateway-admin-order.php +523 -0
- lib/skyverge/woocommerce/payment-gateway/admin/class-sv-wc-payment-gateway-admin-payment-token-editor.php +54 -16
- lib/skyverge/woocommerce/payment-gateway/admin/class-sv-wc-payment-gateway-admin-user-handler.php +21 -9
- lib/skyverge/woocommerce/payment-gateway/admin/views/html-admin-gateway-status.php +1 -1
- lib/skyverge/woocommerce/payment-gateway/admin/views/html-order-partial-capture.php +70 -0
- lib/skyverge/woocommerce/payment-gateway/admin/views/html-user-payment-token-editor-token.php +8 -3
- lib/skyverge/woocommerce/payment-gateway/admin/views/html-user-payment-token-editor.php +1 -1
- lib/skyverge/woocommerce/payment-gateway/admin/views/html-user-profile-field-customer-id.php +1 -1
- lib/skyverge/woocommerce/payment-gateway/admin/views/html-user-profile-section.php +1 -1
- lib/skyverge/woocommerce/payment-gateway/api/class-sv-wc-payment-gateway-api-response-message-helper.php +3 -3
- lib/skyverge/woocommerce/payment-gateway/api/interface-sv-wc-payment-gateway-api-authorization-response.php +3 -3
- lib/skyverge/woocommerce/payment-gateway/api/interface-sv-wc-payment-gateway-api-create-payment-token-response.php +3 -3
- lib/skyverge/woocommerce/payment-gateway/api/interface-sv-wc-payment-gateway-api-customer-response.php +3 -3
- lib/skyverge/woocommerce/payment-gateway/api/interface-sv-wc-payment-gateway-api-get-tokenized-payment-methods-response.php +3 -3
- lib/skyverge/woocommerce/payment-gateway/api/interface-sv-wc-payment-gateway-api-payment-notification-credit-card-response.php +71 -0
- lib/skyverge/woocommerce/payment-gateway/api/interface-sv-wc-payment-gateway-api-payment-notification-echeck-response.php +62 -0
- lib/skyverge/woocommerce/payment-gateway/api/interface-sv-wc-payment-gateway-api-payment-notification-response.php +82 -0
- lib/skyverge/woocommerce/payment-gateway/api/interface-sv-wc-payment-gateway-api-payment-notification-tokenization-response.php +173 -0
- lib/skyverge/woocommerce/payment-gateway/api/interface-sv-wc-payment-gateway-api-request.php +3 -3
- lib/skyverge/woocommerce/payment-gateway/api/interface-sv-wc-payment-gateway-api-response.php +7 -8
- lib/skyverge/woocommerce/payment-gateway/api/interface-sv-wc-payment-gateway-api.php +51 -13
- lib/skyverge/woocommerce/payment-gateway/apple-pay/api/class-sv-wc-payment-gateway-apple-pay-api-request.php +111 -0
- lib/skyverge/woocommerce/payment-gateway/apple-pay/api/class-sv-wc-payment-gateway-apple-pay-api-response.php +110 -0
- lib/skyverge/woocommerce/payment-gateway/apple-pay/api/class-sv-wc-payment-gateway-apple-pay-api.php +194 -0
- lib/skyverge/woocommerce/payment-gateway/apple-pay/api/class-sv-wc-payment-gateway-apple-pay-payment-response.php +205 -0
- lib/skyverge/woocommerce/payment-gateway/apple-pay/class-sv-wc-payment-gateway-apple-pay-admin.php +415 -0
- lib/skyverge/woocommerce/payment-gateway/apple-pay/class-sv-wc-payment-gateway-apple-pay-ajax.php +274 -0
- lib/skyverge/woocommerce/payment-gateway/apple-pay/class-sv-wc-payment-gateway-apple-pay-frontend.php +486 -0
- lib/skyverge/woocommerce/payment-gateway/apple-pay/class-sv-wc-payment-gateway-apple-pay-orders.php +196 -0
- lib/skyverge/woocommerce/payment-gateway/apple-pay/class-sv-wc-payment-gateway-apple-pay.php +1126 -0
- lib/skyverge/woocommerce/payment-gateway/assets/css/admin/sv-wc-payment-gateway-admin-order.min.css +1 -0
- lib/skyverge/woocommerce/payment-gateway/assets/css/admin/sv-wc-payment-gateway-admin-order.min.css.map +7 -0
- lib/skyverge/woocommerce/payment-gateway/assets/css/admin/sv-wc-payment-gateway-admin-order.scss +27 -0
- lib/skyverge/woocommerce/payment-gateway/assets/css/admin/sv-wc-payment-gateway-token-editor.min.css +0 -0
- lib/skyverge/woocommerce/payment-gateway/assets/css/admin/sv-wc-payment-gateway-token-editor.min.css.map +0 -0
- lib/skyverge/woocommerce/payment-gateway/assets/css/admin/sv-wc-payment-gateway-token-editor.scss +2 -2
- lib/skyverge/woocommerce/payment-gateway/assets/css/frontend/sv-wc-payment-gateway-apple-pay.css +121 -0
- lib/skyverge/woocommerce/payment-gateway/assets/css/frontend/sv-wc-payment-gateway-my-payment-methods.min.css +1 -1
- lib/skyverge/woocommerce/payment-gateway/assets/css/frontend/sv-wc-payment-gateway-my-payment-methods.min.css.map +1 -1
- lib/skyverge/woocommerce/payment-gateway/assets/css/frontend/sv-wc-payment-gateway-my-payment-methods.scss +103 -37
- lib/skyverge/woocommerce/payment-gateway/assets/css/frontend/sv-wc-payment-gateway-payment-form.min.css +1 -1
- lib/skyverge/woocommerce/payment-gateway/assets/css/frontend/sv-wc-payment-gateway-payment-form.min.css.map +7 -0
- lib/skyverge/woocommerce/payment-gateway/assets/css/frontend/sv-wc-payment-gateway-payment-form.scss +15 -5
- lib/skyverge/woocommerce/payment-gateway/assets/images/card-amazon.png +0 -0
- lib/skyverge/woocommerce/payment-gateway/assets/images/card-amazon.svg +0 -0
- lib/skyverge/woocommerce/payment-gateway/assets/images/card-amex.png +0 -0
- lib/skyverge/woocommerce/payment-gateway/assets/images/card-amex.svg +0 -0
- lib/skyverge/woocommerce/payment-gateway/assets/images/card-cartebleue.png +0 -0
- lib/skyverge/woocommerce/payment-gateway/assets/images/card-cartebleue.svg +0 -0
- lib/skyverge/woocommerce/payment-gateway/assets/images/card-cc-invalid.png +0 -0
- lib/skyverge/woocommerce/payment-gateway/assets/images/card-cc-invalid.svg +0 -0
- lib/skyverge/woocommerce/payment-gateway/assets/images/card-cc-plain.png +0 -0
- lib/skyverge/woocommerce/payment-gateway/assets/images/card-cc-plain.svg +0 -0
- lib/skyverge/woocommerce/payment-gateway/assets/images/card-cirrus.png +0 -0
- lib/skyverge/woocommerce/payment-gateway/assets/images/card-cirrus.svg +0 -0
- lib/skyverge/woocommerce/payment-gateway/assets/images/card-dinersclub.png +0 -0
- lib/skyverge/woocommerce/payment-gateway/assets/images/card-dinersclub.svg +0 -0
- lib/skyverge/woocommerce/payment-gateway/assets/images/card-discover.png +0 -0
- lib/skyverge/woocommerce/payment-gateway/assets/images/card-discover.svg +0 -0
- lib/skyverge/woocommerce/payment-gateway/assets/images/card-echeck.png +0 -0
- lib/skyverge/woocommerce/payment-gateway/assets/images/card-echeck.svg +0 -0
- lib/skyverge/woocommerce/payment-gateway/assets/images/card-google.png +0 -0
- lib/skyverge/woocommerce/payment-gateway/assets/images/card-google.svg +0 -0
- lib/skyverge/woocommerce/payment-gateway/assets/images/card-jcb.png +0 -0
- lib/skyverge/woocommerce/payment-gateway/assets/images/card-jcb.svg +0 -0
- lib/skyverge/woocommerce/payment-gateway/assets/images/card-laser.png +0 -0
- lib/skyverge/woocommerce/payment-gateway/assets/images/card-laser.svg +0 -0
- lib/skyverge/woocommerce/payment-gateway/assets/images/card-maestro.png +0 -0
- lib/skyverge/woocommerce/payment-gateway/assets/images/card-maestro.svg +0 -0
- lib/skyverge/woocommerce/payment-gateway/assets/images/card-mastercard.png +0 -0
- lib/skyverge/woocommerce/payment-gateway/assets/images/card-mastercard.svg +0 -0
- lib/skyverge/woocommerce/payment-gateway/assets/images/card-moneybookers.png +0 -0
- lib/skyverge/woocommerce/payment-gateway/assets/images/card-moneybookers.svg +0 -0
- lib/skyverge/woocommerce/payment-gateway/assets/images/card-paypal.png +0 -0
- lib/skyverge/woocommerce/payment-gateway/assets/images/card-paypal.svg +0 -0
- lib/skyverge/woocommerce/payment-gateway/assets/images/card-solo.png +0 -0
- lib/skyverge/woocommerce/payment-gateway/assets/images/card-solo.svg +0 -0
- lib/skyverge/woocommerce/payment-gateway/assets/images/card-switch.png +0 -0
- lib/skyverge/woocommerce/payment-gateway/assets/images/card-switch.svg +0 -0
- lib/skyverge/woocommerce/payment-gateway/assets/images/card-visa-debit.png +0 -0
- lib/skyverge/woocommerce/payment-gateway/assets/images/card-visa-debit.svg +0 -0
- lib/skyverge/woocommerce/payment-gateway/assets/images/card-visa-electron.png +0 -0
- lib/skyverge/woocommerce/payment-gateway/assets/images/card-visa-electron.svg +0 -0
- lib/skyverge/woocommerce/payment-gateway/assets/images/card-visa.png +0 -0
- lib/skyverge/woocommerce/payment-gateway/assets/images/card-visa.svg +0 -0
- lib/skyverge/woocommerce/payment-gateway/assets/images/license.txt +0 -0
- lib/skyverge/woocommerce/payment-gateway/assets/images/sample-check.png +0 -0
- lib/skyverge/woocommerce/payment-gateway/assets/js/admin/sv-wc-payment-gateway-admin-order.coffee +103 -0
- lib/skyverge/woocommerce/payment-gateway/assets/js/admin/sv-wc-payment-gateway-admin-order.min.js +1 -0
- lib/skyverge/woocommerce/payment-gateway/assets/js/admin/sv-wc-payment-gateway-admin-order.min.js.map +10 -0
- lib/skyverge/woocommerce/payment-gateway/assets/js/admin/sv-wc-payment-gateway-token-editor.coffee +55 -23
- lib/skyverge/woocommerce/payment-gateway/assets/js/admin/sv-wc-payment-gateway-token-editor.min.js +1 -1
- lib/skyverge/woocommerce/payment-gateway/assets/js/admin/sv-wc-payment-gateway-token-editor.min.js.map +1 -1
- lib/skyverge/woocommerce/payment-gateway/assets/js/frontend/sv-wc-payment-gateway-apple-pay.coffee +431 -0
- lib/skyverge/woocommerce/payment-gateway/assets/js/frontend/sv-wc-payment-gateway-apple-pay.min.js +1 -0
- lib/skyverge/woocommerce/payment-gateway/assets/js/frontend/sv-wc-payment-gateway-frontend.min.map +1 -0
- lib/skyverge/woocommerce/payment-gateway/assets/js/frontend/sv-wc-payment-gateway-my-payment-methods.coffee +218 -0
- lib/skyverge/woocommerce/payment-gateway/assets/js/frontend/sv-wc-payment-gateway-my-payment-methods.min.js +1 -0
- lib/skyverge/woocommerce/payment-gateway/assets/js/frontend/sv-wc-payment-gateway-payment-form.coffee +21 -14
- lib/skyverge/woocommerce/payment-gateway/assets/js/frontend/sv-wc-payment-gateway-payment-form.min.js +1 -1
- lib/skyverge/woocommerce/payment-gateway/class-sv-wc-payment-gateway-direct.php +144 -401
- lib/skyverge/woocommerce/payment-gateway/class-sv-wc-payment-gateway-helper.php +5 -12
- lib/skyverge/woocommerce/payment-gateway/class-sv-wc-payment-gateway-hosted.php +922 -0
- lib/skyverge/woocommerce/payment-gateway/class-sv-wc-payment-gateway-my-payment-methods.php +438 -173
- lib/skyverge/woocommerce/payment-gateway/class-sv-wc-payment-gateway-payment-form.php +26 -23
- lib/skyverge/woocommerce/payment-gateway/class-sv-wc-payment-gateway-plugin.php +371 -317
- lib/skyverge/woocommerce/payment-gateway/class-sv-wc-payment-gateway-privacy.php +22 -16
- lib/skyverge/woocommerce/payment-gateway/class-sv-wc-payment-gateway.php +813 -195
assets/css/frontend/wc-braintree.min.css
CHANGED
@@ -1 +1 @@
|
|
1 |
-
.woocommerce #wc_braintree_paypal_container #braintree-paypal-button,.woocommerce #wc_braintree_paypal_container button{box-shadow:none;margin-bottom:10px;background:none;border:none}.woocommerce #wc_braintree_paypal_container img{float:none!important;max-height:100%!important}.woocommerce #wc_braintree_paypal_container .wc-braintree-paypal-account{padding:1em 0;border-top:1px solid #bbb;border-bottom:1px solid #bbb}.woocommerce #wc_braintree_paypal_container .wc-braintree-paypal-account .name{display:inline-block;margin-right:.5em;font-weight:700}.woocommerce #wc_braintree_paypal_container .wc-braintree-paypal-account .email{opacity:.5}.woocommerce #wc_braintree_paypal_container .wc-braintree-paypal-account .cancel{float:right}.woocommerce #payment div.payment_method_braintree_credit_card label.sv-wc-payment-gateway-payment-form-saved-payment-method,.woocommerce #payment div.payment_method_braintree_credit_card label[for=wc-braintree-credit-card-use-new-payment-method],.woocommerce #payment div.payment_method_braintree_credit_card label[for=wc-braintree-paypal-use-new-payment-method],.woocommerce #payment div.payment_method_braintree_paypal label.sv-wc-payment-gateway-payment-form-saved-payment-method,.woocommerce #payment div.payment_method_braintree_paypal label[for=wc-braintree-credit-card-use-new-payment-method],.woocommerce #payment div.payment_method_braintree_paypal label[for=wc-braintree-paypal-use-new-payment-method]{margin-left:3px}.woocommerce #payment div.payment_method_braintree_credit_card iframe{margin:0 0 0 6px}.woocommerce #payment div.payment_method_braintree_credit_card div.form-row{padding:3px}.woocommerce #payment div.payment_method_braintree_credit_card .wc-braintree-hosted-field{height:3em;padding:3px;border:1px solid #ccc;border-radius:3px;transition:border-color .16s;-webkit-transition:border-color .16s;background-color:#fff}.woocommerce #payment div.payment_method_braintree_credit_card .wc-braintree-hosted-field-card-number{background-image:url(../../../lib/skyverge/woocommerce/payment-gateway/assets/images/card-cc-plain.svg);background-repeat:no-repeat;background-position:99%;background-size:50px 31px}.woocommerce #payment div.payment_method_braintree_credit_card .wc-braintree-hosted-field-card-number.card-type-visa{background-image:url(../../../lib/skyverge/woocommerce/payment-gateway/assets/images/card-visa.svg)}.woocommerce #payment div.payment_method_braintree_credit_card .wc-braintree-hosted-field-card-number.card-type-master-card{background-image:url(../../../lib/skyverge/woocommerce/payment-gateway/assets/images/card-mastercard.svg)}.woocommerce #payment div.payment_method_braintree_credit_card .wc-braintree-hosted-field-card-number.card-type-american-express{background-image:url(../../../lib/skyverge/woocommerce/payment-gateway/assets/images/card-amex.svg)}.woocommerce #payment div.payment_method_braintree_credit_card .wc-braintree-hosted-field-card-number.card-type-diners-club{background-image:url(../../../lib/skyverge/woocommerce/payment-gateway/assets/images/card-dinersclub.svg)}.woocommerce #payment div.payment_method_braintree_credit_card .wc-braintree-hosted-field-card-number.card-type-maestro{background-image:url(../../../lib/skyverge/woocommerce/payment-gateway/assets/images/card-maestro.svg)}.woocommerce #payment div.payment_method_braintree_credit_card .wc-braintree-hosted-field-card-number.card-type-jcb{background-image:url(../../../lib/skyverge/woocommerce/payment-gateway/assets/images/card-jcb.svg)}.woocommerce #payment div.payment_method_braintree_credit_card .wc-braintree-hosted-field-card-number.card-type-discover{background-image:url(../../../lib/skyverge/woocommerce/payment-gateway/assets/images/card-discover.svg)}.woocommerce #payment div.payment_method_braintree_credit_card .wc-braintree-hosted-field-card-number.card-type-invalid{background-image:url(../../../lib/skyverge/woocommerce/payment-gateway/assets/images/card-cc-invalid.svg)}@media only screen and (max-width:320px){.woocommerce #payment div.payment_method_braintree_credit_card .wc-braintree-hosted-field-card-number{background-image:none}}.woocommerce #payment div.payment_method_braintree_credit_card .braintree-hosted-fields-focused{box-shadow:0 0 .1875em #3498db}.woocommerce #payment div.payment_method_braintree_credit_card .braintree-hosted-fields-focused.braintree-hosted-fields-invalid,.woocommerce #payment div.payment_method_braintree_credit_card .braintree-hosted-fields-focused.braintree-hosted-fields-valid{box-shadow:0 0 .1875em #69bf29}.woocommerce #payment div.payment_method_braintree_credit_card .braintree-hosted-fields-valid{border-color:#69bf29}.woocommerce #payment div.payment_method_braintree_credit_card .braintree-hosted-fields-invalid{border-color:#a00}#wc-braintree-credit-card-3dsecure-container{display:none;position:fixed;top:0;left:0;bottom:0;right:0;background:rgba(0,0,0,.7);z-index:3000;cursor:pointer}#wc-braintree-credit-card-3dsecure-container iframe{overflow:auto;margin:auto;position:absolute;top:0;left:0;bottom:0;right:0;background:#fff;padding:1em;box-sizing:content-box;border-radius:5px}#add_payment_method ul.payment_methods li{list-style-type:none}#add_payment_method ul.payment_methods li label[for=payment_method_braintree_credit_card],#add_payment_method ul.payment_methods li label[for=payment_method_braintree_paypal]{line-height:2.3em}#add_payment_method ul.payment_methods li input[type=radio]#payment_method_braintree_credit_card,#add_payment_method ul.payment_methods li input[type=radio]#payment_method_braintree_paypal{margin-left:5px}#add_payment_method ul.payment_methods li img{vertical-align:middle;margin:3px 0 0 .5em;padding:0;position:relative;box-shadow:none}#add_payment_method ul.payment_methods li img+img{margin-left:2px}#add_payment_method ul.payment_methods li #braintree-paypal-loggedout img{max-height:none;margin:0}
|
1 |
+
.woocommerce #wc_braintree_paypal_container,.woocommerce #wc_braintree_paypal_credit_container{margin-bottom:1em}.woocommerce #wc_braintree_paypal_container #braintree-paypal-button,.woocommerce #wc_braintree_paypal_container button,.woocommerce #wc_braintree_paypal_credit_container #braintree-paypal-button,.woocommerce #wc_braintree_paypal_credit_container button{box-shadow:none;margin-bottom:10px;background:none;border:none}.woocommerce #wc_braintree_paypal_container img,.woocommerce #wc_braintree_paypal_credit_container img{float:none!important;max-height:100%!important}.woocommerce #wc_braintree_paypal_container .wc-braintree-paypal-account,.woocommerce #wc_braintree_paypal_credit_container .wc-braintree-paypal-account{padding:1em 0;border-top:1px solid #bbb;border-bottom:1px solid #bbb}.woocommerce #wc_braintree_paypal_container .wc-braintree-paypal-account .name,.woocommerce #wc_braintree_paypal_credit_container .wc-braintree-paypal-account .name{display:inline-block;margin-right:.5em;font-weight:700}.woocommerce #wc_braintree_paypal_container .wc-braintree-paypal-account .email,.woocommerce #wc_braintree_paypal_credit_container .wc-braintree-paypal-account .email{opacity:.5}.woocommerce #wc_braintree_paypal_container .wc-braintree-paypal-account .cancel,.woocommerce #wc_braintree_paypal_credit_container .wc-braintree-paypal-account .cancel{float:right}.woocommerce #payment div.payment_method_braintree_credit_card label.sv-wc-payment-gateway-payment-form-saved-payment-method,.woocommerce #payment div.payment_method_braintree_credit_card label[for=wc-braintree-credit-card-use-new-payment-method],.woocommerce #payment div.payment_method_braintree_credit_card label[for=wc-braintree-paypal-use-new-payment-method],.woocommerce #payment div.payment_method_braintree_paypal label.sv-wc-payment-gateway-payment-form-saved-payment-method,.woocommerce #payment div.payment_method_braintree_paypal label[for=wc-braintree-credit-card-use-new-payment-method],.woocommerce #payment div.payment_method_braintree_paypal label[for=wc-braintree-paypal-use-new-payment-method]{margin-left:3px}.woocommerce #payment div.payment_method_braintree_credit_card iframe{margin:0 0 0 6px}.woocommerce #payment div.payment_method_braintree_credit_card div.form-row{padding:3px}.woocommerce #payment div.payment_method_braintree_credit_card .wc-braintree-hosted-field{height:3em;padding:3px;border:1px solid #ccc;border-radius:3px;transition:border-color .16s;-webkit-transition:border-color .16s;background-color:#fff}.woocommerce #payment div.payment_method_braintree_credit_card .wc-braintree-hosted-field-card-number{background-image:url(../../../lib/skyverge/woocommerce/payment-gateway/assets/images/card-cc-plain.svg);background-repeat:no-repeat;background-position:99%;background-size:50px 31px}.woocommerce #payment div.payment_method_braintree_credit_card .wc-braintree-hosted-field-card-number.card-type-visa{background-image:url(../../../lib/skyverge/woocommerce/payment-gateway/assets/images/card-visa.svg)}.woocommerce #payment div.payment_method_braintree_credit_card .wc-braintree-hosted-field-card-number.card-type-master-card{background-image:url(../../../lib/skyverge/woocommerce/payment-gateway/assets/images/card-mastercard.svg)}.woocommerce #payment div.payment_method_braintree_credit_card .wc-braintree-hosted-field-card-number.card-type-american-express{background-image:url(../../../lib/skyverge/woocommerce/payment-gateway/assets/images/card-amex.svg)}.woocommerce #payment div.payment_method_braintree_credit_card .wc-braintree-hosted-field-card-number.card-type-diners-club{background-image:url(../../../lib/skyverge/woocommerce/payment-gateway/assets/images/card-dinersclub.svg)}.woocommerce #payment div.payment_method_braintree_credit_card .wc-braintree-hosted-field-card-number.card-type-maestro{background-image:url(../../../lib/skyverge/woocommerce/payment-gateway/assets/images/card-maestro.svg)}.woocommerce #payment div.payment_method_braintree_credit_card .wc-braintree-hosted-field-card-number.card-type-jcb{background-image:url(../../../lib/skyverge/woocommerce/payment-gateway/assets/images/card-jcb.svg)}.woocommerce #payment div.payment_method_braintree_credit_card .wc-braintree-hosted-field-card-number.card-type-discover{background-image:url(../../../lib/skyverge/woocommerce/payment-gateway/assets/images/card-discover.svg)}.woocommerce #payment div.payment_method_braintree_credit_card .wc-braintree-hosted-field-card-number.card-type-invalid{background-image:url(../../../lib/skyverge/woocommerce/payment-gateway/assets/images/card-cc-invalid.svg)}@media only screen and (max-width:320px){.woocommerce #payment div.payment_method_braintree_credit_card .wc-braintree-hosted-field-card-number{background-image:none}}.woocommerce #payment div.payment_method_braintree_credit_card .braintree-hosted-fields-focused{box-shadow:0 0 .1875em #3498db}.woocommerce #payment div.payment_method_braintree_credit_card .braintree-hosted-fields-focused.braintree-hosted-fields-invalid,.woocommerce #payment div.payment_method_braintree_credit_card .braintree-hosted-fields-focused.braintree-hosted-fields-valid{box-shadow:0 0 .1875em #69bf29}.woocommerce #payment div.payment_method_braintree_credit_card .braintree-hosted-fields-valid{border-color:#69bf29}.woocommerce #payment div.payment_method_braintree_credit_card .braintree-hosted-fields-invalid{border-color:#a00}#wc-braintree-credit-card-3dsecure-container{display:none;position:fixed;top:0;left:0;bottom:0;right:0;background:rgba(0,0,0,.7);z-index:3000;cursor:pointer}#wc-braintree-credit-card-3dsecure-container iframe{overflow:auto;margin:auto;position:absolute;top:0;left:0;bottom:0;right:0;background:#fff;padding:1em;box-sizing:content-box;border-radius:5px}#add_payment_method ul.payment_methods li{list-style-type:none}#add_payment_method ul.payment_methods li label[for=payment_method_braintree_credit_card],#add_payment_method ul.payment_methods li label[for=payment_method_braintree_paypal]{line-height:2.3em}#add_payment_method ul.payment_methods li input[type=radio]#payment_method_braintree_credit_card,#add_payment_method ul.payment_methods li input[type=radio]#payment_method_braintree_paypal{margin-left:5px}#add_payment_method ul.payment_methods li img{vertical-align:middle;margin:3px 0 0 .5em;padding:0;position:relative;box-shadow:none}#add_payment_method ul.payment_methods li img+img{margin-left:2px}#add_payment_method ul.payment_methods li #braintree-paypal-loggedout img{max-height:none;margin:0}
|
assets/images/button/connect-braintree.png
CHANGED
File without changes
|
assets/images/button/connect-braintree@2x.png
CHANGED
File without changes
|
assets/images/button/connect-braintree@3x.png
CHANGED
File without changes
|
assets/js/frontend/wc-braintree-apple-pay.min.js
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
"use strict";var _createClass=function(){function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(e,t,n){return t&&r(e.prototype,t),n&&r(e,n),e}}(),_get=function e(t,n,r){null===t&&(t=Function.prototype);var o=Object.getOwnPropertyDescriptor(t,n);if(void 0===o){var i=Object.getPrototypeOf(t);return null===i?void 0:e(i,n,r)}if("value"in o)return o.value;var a=o.get;return void 0!==a?a.call(r):void 0};function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function _inherits(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(function(){var i=function(e,t){if(!(e instanceof t))throw new Error("Bound instance method accessed before binding")};jQuery(document).ready(function(t){var o;return o=window.WC_Braintree_Apple_Pay_Handler=function(e){function r(e){_classCallCheck(this,r);var t=_possibleConstructorReturn(this,(r.__proto__||Object.getPrototypeOf(r)).call(this,e));return t.on_validate_merchant=t.on_validate_merchant.bind(t),t.process_authorization=t.process_authorization.bind(t),t.store_name=e.store_name,t.client_token_nonce=e.client_token_nonce,t}return _inherits(r,SV_WC_Apple_Pay_Handler),_createClass(r,[{key:"is_available",value:function(){return window.ApplePaySession&&ApplePaySession.canMakePayments()}},{key:"init",value:function(){if(this.is_available())return this.instance?_get(r.prototype.__proto__||Object.getPrototypeOf(r.prototype),"init",this).call(this):this.create_client()}},{key:"create_client",value:function(){var t=this;return this.get_client_token().done(function(e){if(e.success)return braintree.client.create({authorization:e.data}).then(function(e){return t.client=e,t.create_instance()}).catch(function(e){return console.error("Could not create Braintree client"),console.error(e)})}).fail(function(e,t,n){return console.error("Could not retrieve the client token via AJAX: "+n)})}},{key:"get_client_token",value:function(){var e;return e={action:"wc_"+this.gateway_id+"_get_client_token",nonce:this.client_token_nonce},t.post(this.ajax_url,e)}},{key:"create_instance",value:function(){var t=this;return braintree.applePay.create({client:this.client}).then(function(e){return t.instance=e,ApplePaySession.canMakePaymentsWithActiveCard(e.merchantIdentifier).then(function(e){if(e)return t.init()})}).catch(function(e){return console.error("Could not create Braintree Apple Pay instance. "+e.message),console.error(e)})}},{key:"get_new_session",value:function(e){var t;return t=this.instance.createPaymentRequest(e),_get(r.prototype.__proto__||Object.getPrototypeOf(r.prototype),"get_new_session",this).call(this,t)}},{key:"on_validate_merchant",value:function(e){var t=this;return i(this,o),this.instance.performValidation({validationURL:e.validationURL,displayName:this.store_name}).then(function(e){return t.session.completeMerchantValidation(e)}).catch(function(e){return t.session.abort(),t.fail_payment("Merchant could not be validated. "+e.message)})}},{key:"process_authorization",value:function(t){var n=this;return i(this,o),this.instance.tokenize({token:t.token}).then(function(e){return t.braintree_nonce=e.nonce,_get(r.prototype.__proto__||Object.getPrototypeOf(r.prototype),"process_authorization",n).call(n,t)}).catch(function(e){return n.set_payment_status(!1),n.fail_payment("Payment could not be processed. "+e)})}}]),r}()})}).call(void 0);
|
assets/js/frontend/wc-braintree.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
"use strict";var _get=function e(t,n,r){null===t&&(t=Function.prototype);var i=Object.getOwnPropertyDescriptor(t,n);if(void 0===i){var a=Object.getPrototypeOf(t);return null===a?void 0:e(a,n,r)}if("value"in i)return i.value;var o=i.get;return void 0!==o?o.call(r):void 0},_createClass=function(){function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(e,t,n){return t&&r(e.prototype,t),n&&r(e,n),e}}();function _possibleConstructorReturn(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function _inherits(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(function(){var o=[].indexOf,_=function(e,t){if(!(e instanceof t))throw new Error("Bound instance method accessed before binding")};jQuery(document).ready(function(i){var r,a;return window.WC_Braintree_Payment_Form_Handler=function(){function t(e){_classCallCheck(this,t),this.show_integration_ui=this.show_integration_ui.bind(this),this.hide_integration_ui=this.hide_integration_ui.bind(this),this.id=e.id,this.id_dasherized=e.id_dasherized,this.type=e.type,this.debug=e.debug,this.client_token_nonce=e.client_token_nonce,this.params=window.wc_braintree_params}return _createClass(t,[{key:"init",value:function(){return this.is_sdk_ready()?i("form.checkout").length?this.handle_checkout_page():i("form#order_review").length?this.handle_pay_page():i("form#add_payment_method").length?this.handle_add_payment_method_page():void 0:console.error("Braintree SDK is missing.")}},{key:"handle_checkout_page",value:function(){var e=this;return this.form=i("form.checkout"),this.form_ui_selector=".woocommerce-checkout-payment",i(document.body).on("updated_checkout",function(){return e.setup_braintree()}),i(document.body).on("updated_checkout",function(){return e.handle_saved_payment_methods()}),i(document.body).on("checkout_error",function(){return e.handle_checkout_error()}),this.form.on("checkout_place_order_"+this.id,function(){if(e.is_selected())return e.block_ui(),e.verify_form()})}},{key:"handle_checkout_error",value:function(){return this.unblock_ui()}},{key:"handle_pay_page",value:function(){var e=this;return this.form=i("form#order_review"),this.form_ui_selector="#payment",this.handle_saved_payment_methods(),this.setup_braintree(),this.form.submit(function(){if(e.is_selected())return e.block_ui(),e.verify_form()})}},{key:"handle_add_payment_method_page",value:function(){var e=this;return this.form=i("form#add_payment_method"),this.form_ui_selector="#payment",this.setup_braintree(),this.form.submit(function(){if(e.is_selected())return e.block_ui(),e.verify_form()})}},{key:"verify_form",value:function(){return!!this.using_payment_token()||!!this.has_payment_nonce()&&void 0}},{key:"submit_form",value:function(e){return i("input[name=wc_"+this.id+"_payment_nonce]").val(e),this.form.submit()}},{key:"handle_saved_payment_methods",value:function(){var e,n=this;if(e=i("div.js-wc-"+this.id_dasherized+"-new-payment-method-form"),i("input.js-wc-"+this.id_dasherized+"-payment-token").change(function(){return i("input.js-wc-"+n.id_dasherized+"-payment-token:checked").val()?e.slideUp(200):e.slideDown(200)}).change(),i("input#createaccount").change(function(e){var t;return t=i("input.js-wc-"+n.id_dasherized+"-tokenize-payment-method").closest("p.form-row"),i(e.target).is(":checked")?(t.slideDown(),t.next().show()):(t.hide(),t.next().hide())}),!i("input#createaccount").is(":checked"))return i("input#createaccount").change()}},{key:"setup_braintree",value:function(){return this.block_ui(),i("input[name=wc_"+this.id+"_payment_nonce]").val(""),null!=this.client?this.setup_integration():this.create_client()}},{key:"create_client",value:function(){var r=this;return this.get_client_token().done(function(e){return e.success?braintree.client.create({authorization:e.data}).then(function(e){return r.client=e,r.setup_integration()}).catch(function(e){return r.handle_integration_error(e),r.unblock_ui()}):r.handle_integration_error(e.data)}).fail(function(e,t,n){return r.handle_integration_error({message:"Could not retrieve the client token via AJAX: "+n})}).always(function(){return r.unblock_ui()})}},{key:"get_client_token",value:function(){var e;return this.id+"_client_token_nonce",e={action:"wc_"+this.id+"_get_client_token",nonce:this.client_token_nonce},i.post(this.params.ajax_url,e)}},{key:"setup_integration",value:function(){var t=this;return this.get_integration_class().create(this.get_integration_options()).then(function(e){return t.integration=e,t.show_integration_ui(),t.do_integration_ready(),i(document).trigger("wc_"+t.id+"_integration_ready",t.integration)},function(e){return t.handle_integration_error(e),t.unblock_ui()})}},{key:"refresh_braintree",value:function(){var e=this;if(null!=this.integration)return this.block_ui(),this.integration.teardown(function(){return e.integration=null,e.setup_braintree()})}},{key:"teardown_braintree",value:function(){var e=this;if(null!=this.integration)return this.block_ui(),this.integration.teardown(function(){return e.integration=null,e.unblock_ui()})}},{key:"do_integration_ready",value:function(){}},{key:"get_integration_options",value:function(){return{client:this.client}}},{key:"get_integration_class",value:function(){}},{key:"handle_integration_error",value:function(e){return this.log("Integration error: "+e.message,e),this.hide_integration_ui(),this.unblock_ui()}},{key:"handle_payment_error",value:function(e){return this.log("Payment error: "+e.message,e),this.render_error(this.get_user_message(e)),this.unblock_ui()}},{key:"render_error",value:function(e){return i(".woocommerce-error, .woocommerce-message").remove(),this.form.prepend('<div class="woocommerce-error">'+e+"</div>").removeClass("processing").unblock(),i("html, body").animate({scrollTop:this.form.offset().top-100},1e3),i("input[name=wc_"+this.id+"_payment_nonce]").val(""),this.form.trigger("wc_"+this.id+"_rendered_error"),this.unblock_ui()}},{key:"get_user_message",value:function(e){return this.params.payment_error_message}},{key:"show_integration_ui",value:function(){if(i("div.js-wc-"+this.id_dasherized+"-new-payment-method-form").find(".woocommerce-error").remove(),i("input#createaccount").length&&i("input#createaccount").is(":checked"))return i("div.js-wc-"+this.id_dasherized+"-new-payment-method-form").find(".form-row").show()}},{key:"hide_integration_ui",value:function(){return i("div.js-wc-"+this.id_dasherized+"-new-payment-method-form").prepend('<div class="woocommerce-error">'+this.params.integration_error_message+"</div>"),i("div.js-wc-"+this.id_dasherized+"-new-payment-method-form").find(".form-row").hide()}},{key:"block_ui",value:function(){return i(this.form_ui_selector).block({message:null,overlayCSS:{background:"#fff",opacity:.6}})}},{key:"unblock_ui",value:function(){return i(this.form_ui_selector).unblock()}},{key:"is_selected",value:function(){return this.get_selected_gateway_id()===this.id}},{key:"is_sdk_ready",value:function(){return"undefined"!=typeof braintree&&null!==braintree&&null!=braintree.client&&null!=this.get_integration_class()}},{key:"has_payment_nonce",value:function(){return this.form.find("input[name=wc_"+this.id+"_payment_nonce]").val()}},{key:"using_payment_token",value:function(){return this.form.find("input.js-wc-"+this.id_dasherized+"-payment-token:checked").val()}},{key:"get_selected_gateway_id",value:function(){return this.form.find("input[name=payment_method]:checked").val()}},{key:"log",value:function(e,t){if(this.debug)return console.log("[Braintree] "+e),console.log(t)}}]),t}(),r=window.WC_Braintree_Credit_Card_Payment_Form_Handler=function(e){function a(e){_classCallCheck(this,a);var t=_possibleConstructorReturn(this,(a.__proto__||Object.getPrototypeOf(a)).call(this,e));return t.add_3ds_ui=t.add_3ds_ui.bind(t),t.remove_3ds_ui=t.remove_3ds_ui.bind(t),t.show_integration_ui=t.show_integration_ui.bind(t),t.hide_integration_ui=t.hide_integration_ui.bind(t),t.csc_required=e.csc_required,t.hosted_fields_styles=e.hosted_fields_styles,t.threeds=e.threeds,t.enabled_card_types=e.enabled_card_types,t.init(),t}return _inherits(a,WC_Braintree_Payment_Form_Handler),_createClass(a,[{key:"handle_checkout_error",value:function(){return _get(a.prototype.__proto__||Object.getPrototypeOf(a.prototype),"handle_checkout_error",this).call(this),i("input[name=wc_"+this.id+"_payment_nonce]").val("")}},{key:"verify_form",value:function(){var e;return this.has_payment_nonce()||!this.csc_required&&this.using_payment_token()?(e=i("input.js-wc-braintree-credit-card-payment-token:checked"),this.should_verify_3d_secure_token(e)?(this.verify_3d_secure(e.data("nonce"),e),!1):_get(a.prototype.__proto__||Object.getPrototypeOf(a.prototype),"verify_form",this).call(this)):(this.tokenize_payment(),!1)}},{key:"tokenize_payment",value:function(){var t=this;return this.integration.tokenize().then(function(e){if(t.log("payment method received",e),null!=e.nonce)return t.should_verify_3d_secure(e)?t.verify_3d_secure(e.nonce):t.submit_form(e.nonce)}).catch(function(e){return t.handle_payment_error(e)})}},{key:"get_integration_options",value:function(){var e;return e={client:this.client,fields:{number:{selector:"#wc-braintree-credit-card-account-number-hosted",placeholder:i("#wc-braintree-credit-card-account-number-hosted").data("placeholder")},cvv:{selector:"#wc-braintree-credit-card-csc-hosted",placeholder:i("#wc-braintree-credit-card-csc-hosted").data("placeholder")},expirationDate:{selector:"#wc-braintree-credit-card-expiry-hosted",placeholder:i("#wc-braintree-credit-card-expiry-hosted").data("placeholder")}},styles:this.hosted_fields_styles},this.csc_required&&this.using_payment_token()&&(delete e.fields.number,delete e.fields.expirationDate),this.csc_required||delete e.fields.cvv,e}},{key:"get_integration_class",value:function(){return braintree.hostedFields}},{key:"do_integration_ready",value:function(){var t=this;return this.integration.on("cardTypeChange",function(e){return t.on_card_type_change(e)}),!this.csc_required&&i("input.js-wc-braintree-credit-card-payment-token:checked").val()&&this.teardown_braintree(),this.unblock_ui()}},{key:"handle_saved_payment_methods",value:function(){var e,t,n=this;return _get(a.prototype.__proto__||Object.getPrototypeOf(a.prototype),"handle_saved_payment_methods",this).call(this),t=i("div.js-wc-braintree-credit-card-new-payment-method-form"),e=i("div.wc-braintree-hosted-field-card-csc-parent"),i("input.js-wc-braintree-credit-card-payment-token").change(function(){return i("input.js-wc-braintree-credit-card-payment-token:checked").val()?n.csc_required&&e.hasClass("form-row-last")?(e.removeClass("form-row-last").addClass("form-row-first"),t.after(e),n.refresh_braintree()):void 0:(n.csc_required&&e.hasClass("form-row-first")&&(e.removeClass("form-row-first").addClass("form-row-last"),t.find("div.wc-braintree-hosted-field-card-expiry-parent").after(e)),n.refresh_braintree())}).change()}},{key:"get_user_message",value:function(e){var t,n,r,i;if(r=[],"CUSTOMER"===e.type)switch(e.code){case"HOSTED_FIELDS_FIELDS_EMPTY":this.csc_required&&r.push(this.params.cvv_missing),this.using_payment_token()||(r.push(this.params.card_number_missing),r.push(this.params.card_exp_date_invalid));break;case"HOSTED_FIELDS_FIELDS_INVALID":if(null!=e.details)for(t=0,n=(i=e.details.invalidFieldKeys).length;t<n;t++)switch(i[t]){case"number":r.push(this.params.card_number_invalid);break;case"cvv":r.push(this.params.cvv_length_invalid);break;case"expirationDate":r.push(this.params.card_exp_date_invalid)}}return r.length?r.join("<br/>"):_get(a.prototype.__proto__||Object.getPrototypeOf(a.prototype),"get_user_message",this).call(this)}},{key:"on_card_type_change",value:function(e){var t,n,r;if(null!=e.cards)return(t=i("#wc-braintree-credit-card-account-number-hosted")).attr("class",function(e,t){return t.replace(/(^|\s)card-type-\S+/g,"")}),e.cards.length?1===e.cards.length?null!=(n=e.cards[0]).type&&(r=n.type,0<=o.call(this.enabled_card_types,r))?t.addClass("card-type-"+n.type):t.addClass("card-type-invalid"):void 0:t.addClass("card-type-invalid")}},{key:"is_3d_secure_enabled",value:function(){return this.threeds.enabled&&null!=braintree.threeDSecure}},{key:"setup_integration",value:function(){var t=this;return this.is_3d_secure_enabled()?braintree.threeDSecure.create({client:this.client}).then(function(e){return t.threeDSecure=e,i(document.body).on("click","#wc-braintree-credit-card-3dsecure-container",function(e){return i(e.currentTarget).fadeOut(200),t.threeDSecure.cancelVerifyCard(),t.unblock_ui()}),_get(a.prototype.__proto__||Object.getPrototypeOf(a.prototype),"setup_integration",t).call(t)}).catch(function(e){return t.handle_integration_error(e)}):_get(a.prototype.__proto__||Object.getPrototypeOf(a.prototype),"setup_integration",this).call(this)}},{key:"should_verify_3d_secure",value:function(e){var t;return t=e.details.cardType,this.is_3d_secure_enabled()&&"CreditCard"===e.type&&("Visa"===t||"MasterCard"===t)}},{key:"should_verify_3d_secure_token",value:function(e){if(e.val()&&e.data("nonce")&&!e.data("verified"))return!0}},{key:"verify_3d_secure",value:function(e){var n=this,t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:null;return this.threeDSecure.verifyCard({nonce:e,amount:i("input[name=wc_braintree_credit_card_3d_secure_order_total]").val(),addFrame:function(e,t){return n.add_3ds_ui(e,t)},removeFrame:function(){return n.remove_3ds_ui()}}).then(function(e){return n.log("3DS response",e),n.threeds.liability_shift_always_required&&!e.liabilityShifted&&n.render_error(n.threeds.failure_message),e.liabilityShiftPossible&&!e.liabilityShifted&&n.render_error(n.threeds.failure_message),null!=t&&t.data("verified",!0),i("input[name=wc_braintree_credit_card_3d_secure_verified]").val(1),n.submit_form(e.nonce)}).catch(function(e){return n.handle_payment_error(e)})}},{key:"add_3ds_ui",value:function(e,t){var n;return _(this,r),e?this.handle_payment_error(e):((n=i("<div>",{id:"wc-"+this.id_dasherized+"-3dsecure-container"})).html(t),i(document.body).append(n),n.fadeIn(400))}},{key:"remove_3ds_ui",value:function(){return _(this,r),i("#wc-"+this.id_dasherized+"-3dsecure-container").fadeOut(400,function(e){return i(this).remove()})}},{key:"show_integration_ui",value:function(){return _(this,r),_get(a.prototype.__proto__||Object.getPrototypeOf(a.prototype),"show_integration_ui",this).call(this),i(".wc-braintree-hosted-field-parent").show()}},{key:"hide_integration_ui",value:function(){return _(this,r),_get(a.prototype.__proto__||Object.getPrototypeOf(a.prototype),"hide_integration_ui",this).call(this),i(".wc-braintree-hosted-field-parent").hide()}}]),a}(),a=window.WC_Braintree_PayPal_Payment_Form_Handler=function(e){function n(e){_classCallCheck(this,n);var t=_possibleConstructorReturn(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,e));return t.do_integration_ready=t.do_integration_ready.bind(t),t.on_authorize=t.on_authorize.bind(t),t.get_linked_account_html=t.get_linked_account_html.bind(t),t.is_test_environment=e.is_test_environment,t.must_login_message=e.must_login_message,t.must_login_add_method_message=e.must_login_add_method_message,t.button_styles=e.button_styles,t.init(),t}return _inherits(n,WC_Braintree_Payment_Form_Handler),_createClass(n,[{key:"init",value:function(){var t=this;return _get(n.prototype.__proto__||Object.getPrototypeOf(n.prototype),"init",this).call(this),i("input[name=wc_"+this.id+"_payment_nonce]").val(this.params.cart_payment_nonce),i(document.body).on("click",'input[name="payment_method"], input.js-wc-braintree-paypal-payment-token',function(){return t.toggle_order_button()}),i(document.body).on("payment_method_selected",function(){return t.toggle_order_button()}),i(document.body).on("click",".wc-braintree-paypal-account .cancel",function(e){return e.preventDefault(),i(e.currentTarget).parent().remove(),t.setup_braintree()})}},{key:"toggle_order_button",value:function(){return!this.is_selected()||this.has_payment_nonce()||this.using_payment_token()?i("#place_order").show():i("#place_order").hide()}},{key:"verify_form",value:function(){var e;return e=_get(n.prototype.__proto__||Object.getPrototypeOf(n.prototype),"verify_form",this).call(this),this.has_payment_nonce()||this.using_payment_token()||this.render_error(this.must_login_message),e}},{key:"handle_payment_error",value:function(e){return _get(n.prototype.__proto__||Object.getPrototypeOf(n.prototype),"handle_payment_error",this).call(this,e),this.params.cart_payment_nonce=!1,this.setup_braintree()}},{key:"get_integration_class",value:function(){return braintree.paypalCheckout}},{key:"setup_braintree",value:function(){return this.params.cart_payment_nonce?this.unblock_ui():(_get(n.prototype.__proto__||Object.getPrototypeOf(n.prototype),"setup_braintree",this).call(this),i("input.js-wc-braintree-paypal-tokenize-payment-method").prop("disabled",!1),this.toggle_order_button())}},{key:"do_integration_ready",value:function(){var e,t=this;return _(this,a),this.params.cart_payment_nonce?this.unblock_ui():(e=this.is_single_use()?"checkout":"vault",this.integration.createPayment({flow:e,amount:this.get_order_amount(),currency:this.get_store_currency(),locale:this.get_store_locale()}).then(function(e){return t.render_button(e)}).then(function(){return i("#wc_braintree_paypal_container").css({width:"100%"}),t.unblock_ui()}).catch(function(e){return t.handle_integration_error(e),t.unblock_ui()}))}},{key:"render_button",value:function(e){var t,n=this;return i("#wc_braintree_paypal_container").html(""),t={env:this.is_test_environment?"sandbox":"production",commit:this.button_is_pay_now(),style:this.get_button_styles(),payment:function(){return e},onAuthorize:function(e,t){return n.on_authorize(e,t)},onError:function(e){return n.handle_integration_error(e)}},paypal.Button.render(t,"#wc_braintree_paypal_container")}},{key:"button_is_pay_now",value:function(){return!i("form#add_payment_method").length}},{key:"get_button_styles",value:function(){return this.button_styles}},{key:"on_authorize",value:function(e,t){var n=this;return _(this,a),this.block_ui(),this.integration.tokenizePayment(e).then(function(e){return n.log("PayPal method tokenized.",e),n.set_payment_method(e)}).catch(function(e){return n.handle_payment_error(e),n.unblock_ui()})}},{key:"set_payment_method",value:function(e){return i("input[name=wc_"+this.id+"_payment_nonce]").val(e.nonce),i("#wc_braintree_paypal_container").html(this.get_linked_account_html(e.details)),this.is_single_use()&&i("input.js-wc-braintree-paypal-tokenize-payment-method").prop("disabled",!0),i("#place_order").show(),this.form.submit()}},{key:"handle_saved_payment_methods",value:function(){var t=this;return _get(n.prototype.__proto__||Object.getPrototypeOf(n.prototype),"handle_saved_payment_methods",this).call(this),i("input.js-wc-braintree-paypal-tokenize-payment-method").change(function(e){if(null!=t.integration&&i(e.target).is(":visible"))return t.block_ui(),t.do_integration_ready()}).change()}},{key:"get_linked_account_html",value:function(e){var t;return _(this,a),t=i("<div class='wc-"+this.id_dasherized+"-account'></div>"),null!=e.firstName&&null!=e.lastName&&t.append("<span class='name'>"+e.firstName+" "+e.lastName+"</span>"),t.append("<span class='email'>"+e.email+"</span>"),t.append("<a href='#' class='cancel'>Cancel</a>"),t}},{key:"is_single_use",value:function(){var e;return 0===(e=i("input[name=wc-braintree-paypal-tokenize-payment-method]")).length||("checkbox"===e.attr("type")?!e.is(":checked"):!e.val())}},{key:"get_order_amount",value:function(){return i("input[name=wc_braintree_paypal_amount]").val()}},{key:"get_store_currency",value:function(){return i("input[name=wc_braintree_paypal_currency]").val()}},{key:"get_store_locale",value:function(){return i("input[name=wc_braintree_paypal_locale]").val()}},{key:"is_sdk_ready",value:function(){return _get(n.prototype.__proto__||Object.getPrototypeOf(n.prototype),"is_sdk_ready",this).call(this)&&"undefined"!=typeof paypal&&null!==paypal}}]),n}(),window.WC_Braintree_PayPal_Cart_Handler=function(e){function n(e){_classCallCheck(this,n);var t=_possibleConstructorReturn(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,e));return t.form=i("form.woocommerce-cart-form"),t.form_ui_selector="",t.setup_braintree(),i(document.body).on("updated_cart_totals",function(){return t.setup_braintree()}),t}return _inherits(n,WC_Braintree_PayPal_Payment_Form_Handler),_createClass(n,[{key:"button_is_pay_now",value:function(){return!1}},{key:"set_payment_method",value:function(e){var t=this;if(null!=e.nonce)return e.wp_nonce=this.params.cart_nonce,i.ajax({type:"POST",url:this.params.cart_handler_url,data:e,dataType:"json"}).done(function(e){if(t.log("PayPal Cart response",e),null!=e.redirect_url)return window.location=e.redirect_url}).fail(function(e){return t.log("Error setting the PayPal cart data.",e)}).always(function(){return t.unblock_ui()})}},{key:"is_single_use",value:function(){return"1"===i("input[name=wc_braintree_paypal_single_use]").val()}},{key:"has_payment_nonce",value:function(){return!1}}]),n}()})}).call(void 0);
|
1 |
+
"use strict";var _get=function e(t,n,r){null===t&&(t=Function.prototype);var i=Object.getOwnPropertyDescriptor(t,n);if(void 0===i){var a=Object.getPrototypeOf(t);return null===a?void 0:e(a,n,r)}if("value"in i)return i.value;var o=i.get;return void 0!==o?o.call(r):void 0},_createClass=function(){function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(e,t,n){return t&&r(e.prototype,t),n&&r(e,n),e}}();function _possibleConstructorReturn(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function _inherits(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(function(){var s=[].indexOf,_=function(e,t){if(!(e instanceof t))throw new Error("Bound instance method accessed before binding")};jQuery(document).ready(function(o){var r,i;return window.WC_Braintree_Payment_Form_Handler=function(){function t(e){_classCallCheck(this,t),this.show_integration_ui=this.show_integration_ui.bind(this),this.hide_integration_ui=this.hide_integration_ui.bind(this),this.id=e.id,this.id_dasherized=e.id_dasherized,this.name=e.name,this.type=e.type,this.debug=e.debug,this.client_token_nonce=e.client_token_nonce,this.ajax_url=e.ajax_url,this.integration_error_message=e.integration_error_message,this.payment_error_message=e.payment_error_message,this.params=window.sv_wc_payment_gateway_payment_form_params}return _createClass(t,[{key:"init",value:function(){return this.is_sdk_ready()?o("form.checkout").length?this.handle_checkout_page():o("form#order_review").length?this.handle_pay_page():o("form#add_payment_method").length?this.handle_add_payment_method_page():void 0:console.error("Braintree SDK is missing.")}},{key:"handle_checkout_page",value:function(){var e=this;return this.form=o("form.checkout"),this.form_ui_selector=".woocommerce-checkout-payment",o(document.body).on("updated_checkout",function(){if(!e.setting_up)return e.setup_braintree()}),o(document.body).on("updated_checkout",function(){return e.handle_saved_payment_methods()}),o(document.body).on("checkout_error",function(){return e.handle_checkout_error()}),this.form.on("checkout_place_order_"+this.id,function(){if(e.is_selected())return e.block_ui(),e.verify_form()})}},{key:"handle_checkout_error",value:function(){return this.unblock_ui()}},{key:"handle_pay_page",value:function(){var e=this;return this.form=o("form#order_review"),this.form_ui_selector="#payment",this.handle_saved_payment_methods(),this.setup_braintree(),this.form.submit(function(){if(e.is_selected())return e.block_ui(),e.verify_form()})}},{key:"handle_add_payment_method_page",value:function(){var e=this;return this.form=o("form#add_payment_method"),this.form_ui_selector="#payment",this.setup_braintree(),this.form.submit(function(){if(e.is_selected())return e.block_ui(),e.verify_form()})}},{key:"verify_form",value:function(){return!!this.using_payment_token()||!!this.has_payment_nonce()&&void 0}},{key:"submit_form",value:function(e){return o("input[name=wc_"+this.id+"_payment_nonce]").val(e),this.form.submit()}},{key:"handle_saved_payment_methods",value:function(){var e,n=this;if(e=o("div.js-wc-"+this.id_dasherized+"-new-payment-method-form"),o("input.js-wc-"+this.id_dasherized+"-payment-token").change(function(){return o("input.js-wc-"+n.id_dasherized+"-payment-token:checked").val()?e.slideUp(200):e.slideDown(200)}).change(),o("input#createaccount").change(function(e){var t;return t=o("input.js-wc-"+n.id_dasherized+"-tokenize-payment-method").closest("p.form-row"),o(e.target).is(":checked")?(t.slideDown(),t.next().show()):(t.hide(),t.next().hide())}),!o("input#createaccount").is(":checked"))return o("input#createaccount").change()}},{key:"setup_braintree",value:function(){return this.setting_up=!0,this.block_ui(),o("input[name=wc_"+this.id+"_payment_nonce]").val(""),null!=this.client?this.setup_integration():this.create_client()}},{key:"create_client",value:function(){var r=this;return this.log("Creating client."),this.get_client_token().done(function(e){return e.success?braintree.client.create({authorization:e.data}).then(function(e){return r.client=e,r.log("Client ready."),r.setup_integration()}).catch(function(e){return r.handle_integration_error(e),r.unblock_ui()}):r.handle_integration_error(e.data)}).fail(function(e,t,n){return r.handle_integration_error({message:"Could not retrieve the client token via AJAX: "+n})}).always(function(){return r.unblock_ui()})}},{key:"get_client_token",value:function(){var e;return this.id+"_client_token_nonce",e={action:"wc_"+this.id+"_get_client_token",nonce:this.client_token_nonce},o.post(this.ajax_url,e)}},{key:"setup_integration",value:function(){var t=this;return this.log("Creating integration."),this.get_integration_class().create(this.get_integration_options()).then(function(e){return t.integration=e,t.show_integration_ui(),t.do_integration_ready(),t.setting_up=!1,o(document).trigger("wc_"+t.id+"_integration_ready",t.integration),t.log("Integration ready.")},function(e){return t.handle_integration_error(e),t.unblock_ui()})}},{key:"refresh_braintree",value:function(){var e=this;if(null!=this.integration&&!this.refreshing&&!this.setting_up)return this.log("Refreshing integration."),this.refreshing=!0,this.block_ui(),this.integration.teardown(function(){return e.integration=null,e.refreshing=!1,e.setup_braintree()})}},{key:"teardown_braintree",value:function(){var e=this;if(null!=this.integration)return this.block_ui(),this.integration.teardown(function(){return e.integration=null,e.unblock_ui()})}},{key:"do_integration_ready",value:function(){}},{key:"get_integration_options",value:function(){return{client:this.client}}},{key:"get_integration_class",value:function(){}},{key:"handle_integration_error",value:function(e){return this.log("Integration error. "+e.message,e,"error"),this.hide_integration_ui(),this.unblock_ui()}},{key:"handle_payment_error",value:function(e){return this.log("Payment error. "+e.message,e,"error"),this.render_error(this.get_user_message(e)),this.unblock_ui()}},{key:"render_error",value:function(e){return o(".woocommerce-error, .woocommerce-message").remove(),this.form.prepend('<div class="woocommerce-error">'+e+"</div>").removeClass("processing").unblock(),o("html, body").animate({scrollTop:this.form.offset().top-100},1e3),o("input[name=wc_"+this.id+"_payment_nonce]").val(""),this.form.trigger("wc_"+this.id+"_rendered_error"),o(document.body).trigger("checkout_error"),this.unblock_ui()}},{key:"get_user_message",value:function(e){return this.payment_error_message}},{key:"show_integration_ui",value:function(){if(o("div.js-wc-"+this.id_dasherized+"-new-payment-method-form").find(".woocommerce-error").remove(),o("input#createaccount").length&&o("input#createaccount").is(":checked"))return o("div.js-wc-"+this.id_dasherized+"-new-payment-method-form").find(".form-row").show()}},{key:"hide_integration_ui",value:function(){return o("div.js-wc-"+this.id_dasherized+"-new-payment-method-form").prepend('<div class="woocommerce-error">'+this.integration_error_message+"</div>"),o("div.js-wc-"+this.id_dasherized+"-new-payment-method-form").find(".form-row").hide()}},{key:"block_ui",value:function(){return o(this.form_ui_selector).block({message:null,overlayCSS:{background:"#fff",opacity:.6}})}},{key:"unblock_ui",value:function(){return o(this.form_ui_selector).unblock()}},{key:"is_selected",value:function(){return this.get_selected_gateway_id()===this.id}},{key:"is_sdk_ready",value:function(){return"undefined"!=typeof braintree&&null!==braintree&&null!=braintree.client&&null!=this.get_integration_class()}},{key:"has_payment_nonce",value:function(){return this.form.find("input[name=wc_"+this.id+"_payment_nonce]").val()}},{key:"using_payment_token",value:function(){return this.form.find("input.js-wc-"+this.id_dasherized+"-payment-token:checked").val()}},{key:"get_selected_gateway_id",value:function(){return this.form.find("input[name=payment_method]:checked").val()}},{key:"log",value:function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:null;2<arguments.length&&void 0!==arguments[2]&&arguments[2];if(this.debug)return console.log(this.name+": "+e),t?console.log(t):void 0}}]),t}(),r=window.WC_Braintree_Credit_Card_Payment_Form_Handler=function(e){function a(e){_classCallCheck(this,a);var t=_possibleConstructorReturn(this,(a.__proto__||Object.getPrototypeOf(a)).call(this,e));return t.add_3ds_ui=t.add_3ds_ui.bind(t),t.remove_3ds_ui=t.remove_3ds_ui.bind(t),t.show_integration_ui=t.show_integration_ui.bind(t),t.hide_integration_ui=t.hide_integration_ui.bind(t),t.csc_required=e.csc_required,t.hosted_fields_styles=e.hosted_fields_styles,t.threeds=e.threeds,t.enabled_card_types=e.enabled_card_types,t.init(),t}return _inherits(a,WC_Braintree_Payment_Form_Handler),_createClass(a,[{key:"handle_checkout_error",value:function(){return _get(a.prototype.__proto__||Object.getPrototypeOf(a.prototype),"handle_checkout_error",this).call(this),o("input[name=wc_"+this.id+"_payment_nonce]").val(""),o("input[name=wc-"+this.id_dasherized+"-card-type]").val(""),o("input[name=wc-"+this.id_dasherized+"-3d-secure-verified]").val(0)}},{key:"verify_form",value:function(){var e;return this.has_payment_nonce()||!this.csc_required&&this.using_payment_token()?(e=o("input.js-wc-braintree-credit-card-payment-token:checked"),this.should_verify_3d_secure_token(e)?(this.verify_3d_secure(e.data("nonce"),e),!1):_get(a.prototype.__proto__||Object.getPrototypeOf(a.prototype),"verify_form",this).call(this)):(this.tokenize_payment(),!1)}},{key:"tokenize_payment",value:function(){var t=this;return this.integration.tokenize().then(function(e){if(t.log("Payment method received.",e),null!=e.nonce)return t.should_verify_3d_secure(e)?t.verify_3d_secure(e.nonce):t.submit_form(e.nonce)}).catch(function(e){return t.handle_payment_error(e)})}},{key:"get_integration_options",value:function(){var e;return e={client:this.client,fields:{number:{selector:"#wc-braintree-credit-card-account-number-hosted",placeholder:o("#wc-braintree-credit-card-account-number-hosted").data("placeholder")},cvv:{selector:"#wc-braintree-credit-card-csc-hosted",placeholder:o("#wc-braintree-credit-card-csc-hosted").data("placeholder")},expirationDate:{selector:"#wc-braintree-credit-card-expiry-hosted",placeholder:o("#wc-braintree-credit-card-expiry-hosted").data("placeholder")}},styles:this.hosted_fields_styles},this.csc_required&&this.using_payment_token()&&(delete e.fields.number,delete e.fields.expirationDate),this.csc_required||delete e.fields.cvv,e}},{key:"get_integration_class",value:function(){return braintree.hostedFields}},{key:"do_integration_ready",value:function(){var t=this;return this.integration.on("cardTypeChange",function(e){return t.on_card_type_change(e)}),!this.csc_required&&o("input.js-wc-braintree-credit-card-payment-token:checked").val()&&this.teardown_braintree(),this.unblock_ui()}},{key:"handle_saved_payment_methods",value:function(){var e,t,n=this;return _get(a.prototype.__proto__||Object.getPrototypeOf(a.prototype),"handle_saved_payment_methods",this).call(this),t=o("div.js-wc-braintree-credit-card-new-payment-method-form"),e=o("div.wc-braintree-hosted-field-card-csc-parent"),o("input.js-wc-braintree-credit-card-payment-token").change(function(){return o("input.js-wc-braintree-credit-card-payment-token:checked").val()?n.csc_required&&e.hasClass("form-row-last")?(e.removeClass("form-row-last").addClass("form-row-first"),t.after(e),n.refresh_braintree()):void 0:(n.csc_required&&e.hasClass("form-row-first")&&(e.removeClass("form-row-first").addClass("form-row-last"),t.find("div.wc-braintree-hosted-field-card-expiry-parent").after(e)),n.refresh_braintree())}).change()}},{key:"get_user_message",value:function(e){var t,n,r,i;if(r=[],"CUSTOMER"===e.type)switch(e.code){case"HOSTED_FIELDS_FIELDS_EMPTY":this.csc_required&&r.push(this.params.cvv_missing),this.using_payment_token()||(r.push(this.params.card_number_missing),r.push(this.params.card_exp_date_invalid));break;case"HOSTED_FIELDS_FIELDS_INVALID":if(null!=e.details)for(t=0,n=(i=e.details.invalidFieldKeys).length;t<n;t++)switch(i[t]){case"number":r.push(this.params.card_number_invalid);break;case"cvv":r.push(this.params.cvv_length_invalid);break;case"expirationDate":r.push(this.params.card_exp_date_invalid)}}return r.length?r.join("<br/>"):_get(a.prototype.__proto__||Object.getPrototypeOf(a.prototype),"get_user_message",this).call(this)}},{key:"on_card_type_change",value:function(e){var t,n,r;if(null!=e.cards)return(t=o("#wc-braintree-credit-card-account-number-hosted")).attr("class",function(e,t){return t.replace(/(^|\s)card-type-\S+/g,"")}),e.cards.length?1===e.cards.length?(n=e.cards[0],o("input[name=wc-"+this.id_dasherized+"-card-type]").val(n.type),null!=n.type&&(r=n.type,0<=s.call(this.enabled_card_types,r))?t.addClass("card-type-"+n.type):t.addClass("card-type-invalid")):void 0:t.addClass("card-type-invalid")}},{key:"is_3d_secure_enabled",value:function(){return this.threeds.enabled&&null!=braintree.threeDSecure}},{key:"setup_integration",value:function(){var t=this;return this.threeds.enabled&&(this.threeds.enabled=this.client.getConfiguration().gatewayConfiguration.threeDSecureEnabled),this.is_3d_secure_enabled()?(o("input[name=wc-"+this.id_dasherized+"-3d-secure-enabled]").val(1),braintree.threeDSecure.create({client:this.client}).then(function(e){return t.threeDSecure=e,o(document.body).on("click","#wc-braintree-credit-card-3dsecure-container",function(e){return o(e.currentTarget).fadeOut(200),t.threeDSecure.cancelVerifyCard(),t.unblock_ui()}),_get(a.prototype.__proto__||Object.getPrototypeOf(a.prototype),"setup_integration",t).call(t)}).catch(function(e){return t.handle_integration_error(e)})):_get(a.prototype.__proto__||Object.getPrototypeOf(a.prototype),"setup_integration",this).call(this)}},{key:"should_verify_3d_secure",value:function(e){var t;return t=e.details.cardType,this.is_3d_secure_enabled()&&"CreditCard"===e.type&&0<=s.call(this.threeds.card_types,t)}},{key:"should_verify_3d_secure_token",value:function(e){if(this.is_3d_secure_enabled()&&e.val()&&e.data("nonce")&&!e.data("verified"))return!0}},{key:"verify_3d_secure",value:function(e){var t,n=this,r=1<arguments.length&&void 0!==arguments[1]?arguments[1]:null;return t={billingAddress:{firstName:o("input[name=billing_first_name]").val(),lastName:o("input[name=billing_last_name]").val(),streetAddress:o("input[name=billing_address_1]").val(),extendedAddress:o("input[name=billing_address_2]").val(),locality:o("#billing_city").val(),region:o("#billing_state").val(),postalCode:o("input[name=billing_postcode]").val(),countryCodeAlpha2:o("#billing_country").val()}},this.threeDSecure.verifyCard({nonce:e,amount:this.threeds.order_total,customer:t,addFrame:function(e,t){return n.add_3ds_ui(e,t)},removeFrame:function(){return n.remove_3ds_ui()}}).then(function(e){return n.log("3D Secure response received.",e),n.threeds.liability_shift_always_required&&!e.liabilityShifted?n.render_error(n.threeds.failure_message):(null!=r&&r.data("verified",!0),o("input[name=wc-"+n.id_dasherized+"-3d-secure-verified]").val(1),n.submit_form(e.nonce))}).catch(function(e){return n.handle_payment_error(e)})}},{key:"add_3ds_ui",value:function(e,t){var n;return _(this,r),e?this.handle_payment_error(e):((n=o("<div>",{id:"wc-"+this.id_dasherized+"-3dsecure-container"})).html(t),o(document.body).append(n),n.fadeIn(400))}},{key:"remove_3ds_ui",value:function(){return _(this,r),o("#wc-"+this.id_dasherized+"-3dsecure-container").fadeOut(400,function(e){return o(this).remove()})}},{key:"show_integration_ui",value:function(){return _(this,r),_get(a.prototype.__proto__||Object.getPrototypeOf(a.prototype),"show_integration_ui",this).call(this),o(".wc-braintree-hosted-field-parent").show()}},{key:"hide_integration_ui",value:function(){return _(this,r),_get(a.prototype.__proto__||Object.getPrototypeOf(a.prototype),"hide_integration_ui",this).call(this),o(".wc-braintree-hosted-field-parent").hide()}}]),a}(),i=window.WC_Braintree_PayPal_Payment_Form_Handler=function(e){function n(e){_classCallCheck(this,n);var t=_possibleConstructorReturn(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,e));return t.do_integration_ready=t.do_integration_ready.bind(t),t.on_authorize=t.on_authorize.bind(t),t.get_linked_account_html=t.get_linked_account_html.bind(t),t.is_test_environment=e.is_test_environment,t.is_paypal_credit_enabled=e.is_paypal_credit_enabled,t.must_login_message=e.must_login_message,t.must_login_add_method_message=e.must_login_add_method_message,t.button_styles=e.button_styles,t.cart_payment_nonce=e.cart_payment_nonce,t.init(),t}return _inherits(n,WC_Braintree_Payment_Form_Handler),_createClass(n,[{key:"init",value:function(){var t=this;return _get(n.prototype.__proto__||Object.getPrototypeOf(n.prototype),"init",this).call(this),o("input[name=wc_"+this.id+"_payment_nonce]").val(this.cart_payment_nonce),o(document.body).on("click",'input[name="payment_method"], input.js-wc-braintree-paypal-payment-token',function(){return t.toggle_order_button()}),o(document.body).on("payment_method_selected",function(){return t.toggle_order_button()}),o(document.body).on("click",".wc-braintree-paypal-account .cancel",function(e){return e.preventDefault(),o(e.currentTarget).parent().remove(),t.setup_braintree()})}},{key:"toggle_order_button",value:function(){return!this.is_selected()||this.has_payment_nonce()||this.using_payment_token()?o("#place_order").show():o("#place_order").hide()}},{key:"verify_form",value:function(){var e;return e=_get(n.prototype.__proto__||Object.getPrototypeOf(n.prototype),"verify_form",this).call(this),this.has_payment_nonce()||this.using_payment_token()||this.render_error(this.must_login_message),e}},{key:"handle_payment_error",value:function(e){return _get(n.prototype.__proto__||Object.getPrototypeOf(n.prototype),"handle_payment_error",this).call(this,e),this.cart_payment_nonce=!1,this.setup_braintree()}},{key:"get_integration_class",value:function(){return braintree.paypalCheckout}},{key:"setup_braintree",value:function(){return this.cart_payment_nonce?this.unblock_ui():(_get(n.prototype.__proto__||Object.getPrototypeOf(n.prototype),"setup_braintree",this).call(this),o("input.js-wc-braintree-paypal-tokenize-payment-method").prop("disabled",!1),this.toggle_order_button())}},{key:"do_integration_ready",value:function(){var e,t=this;return _(this,i),this.cart_payment_nonce?this.unblock_ui():(e=this.is_single_use()?"checkout":"vault",this.render_button(this.integration.createPayment({flow:e,amount:this.get_order_amount(),currency:this.get_store_currency(),locale:this.get_store_locale()}),this.get_button_styles(),"#wc_braintree_paypal_container").then(function(){return o("#wc_braintree_paypal_container").css({width:"100%"})}).catch(function(e){return t.log("Could not render the PayPal button. "+e.message,e),t.hide_integration_ui()}).finally(function(){return t.unblock_ui()}))}},{key:"render_button",value:function(e,t,n){var r,i,a=this;return o(n).html(""),r=this.is_paypal_credit_enabled&&"USD"===this.get_store_currency()?{allowed:[paypal.FUNDING.CREDIT]}:{disallowed:[paypal.FUNDING.CREDIT]},i={env:this.is_test_environment?"sandbox":"production",commit:this.button_is_pay_now(),style:t,funding:r,payment:function(){return e},onAuthorize:function(e,t){return a.on_authorize(e,t)},onError:function(e){return a.handle_integration_error(e)}},paypal.Button.render(i,n)}},{key:"button_is_pay_now",value:function(){return!o("form#add_payment_method").length}},{key:"get_button_styles",value:function(){return this.button_styles}},{key:"on_authorize",value:function(e,t){var n=this;return _(this,i),this.block_ui(),this.integration.tokenizePayment(e).then(function(e){return n.log("Payment method tokenized.",e),n.set_payment_method(e)}).catch(function(e){return n.handle_payment_error(e),n.unblock_ui()})}},{key:"set_payment_method",value:function(e){return o("input[name=wc_"+this.id+"_payment_nonce]").val(e.nonce),o("#wc_braintree_paypal_container").html(this.get_linked_account_html(e.details)),this.is_single_use()&&o("input.js-wc-braintree-paypal-tokenize-payment-method").prop("disabled",!0),o("#place_order").show(),this.form.submit()}},{key:"handle_saved_payment_methods",value:function(){var t=this;return _get(n.prototype.__proto__||Object.getPrototypeOf(n.prototype),"handle_saved_payment_methods",this).call(this),o("input.js-wc-braintree-paypal-tokenize-payment-method").change(function(e){if(null!=t.integration&&o(e.target).is(":visible"))return t.block_ui(),t.do_integration_ready()}).change()}},{key:"get_linked_account_html",value:function(e){var t;return _(this,i),t=o("<div class='wc-"+this.id_dasherized+"-account'></div>"),null!=e.firstName&&null!=e.lastName&&t.append("<span class='name'>"+e.firstName+" "+e.lastName+"</span>"),t.append("<span class='email'>"+e.email+"</span>"),t.append("<a href='#' class='cancel'>Cancel</a>"),t}},{key:"is_single_use",value:function(){var e;return 0===(e=o("input[name=wc-braintree-paypal-tokenize-payment-method]")).length||("checkbox"===e.attr("type")?!e.is(":checked"):!e.val())}},{key:"get_order_amount",value:function(){return o("input[name=wc_braintree_paypal_amount]").val()}},{key:"get_store_currency",value:function(){return o("input[name=wc_braintree_paypal_currency]").val()}},{key:"get_store_locale",value:function(){return o("input[name=wc_braintree_paypal_locale]").val()}},{key:"is_sdk_ready",value:function(){return _get(n.prototype.__proto__||Object.getPrototypeOf(n.prototype),"is_sdk_ready",this).call(this)&&"undefined"!=typeof paypal&&null!==paypal}}]),n}(),window.WC_Braintree_PayPal_Cart_Handler=function(e){function n(e){_classCallCheck(this,n);var t=_possibleConstructorReturn(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,e));return t.set_payment_method_nonce=e.set_payment_method_nonce,t.cart_handler_url=e.cart_handler_url,t.form=o("form.woocommerce-cart-form"),t.form_ui_selector="",t.setup_braintree(),o(document.body).on("updated_cart_totals",function(){return t.setup_braintree()}),t}return _inherits(n,WC_Braintree_PayPal_Payment_Form_Handler),_createClass(n,[{key:"button_is_pay_now",value:function(){return!1}},{key:"set_payment_method",value:function(e){var t=this;if(null!=e.nonce)return e.wp_nonce=this.set_payment_method_nonce,o.ajax({type:"POST",url:this.cart_handler_url,data:e,dataType:"json"}).done(function(e){if(t.log("Cart response received.",e),null!=e.redirect_url)return window.location=e.redirect_url}).fail(function(e){return t.log("Error setting the PayPal cart data.",e,"error")}).always(function(){return t.unblock_ui()})}},{key:"is_single_use",value:function(){return"1"===o("input[name=wc_braintree_paypal_single_use]").val()}},{key:"has_payment_nonce",value:function(){return!1}}]),n}()})}).call(void 0);
|
class-wc-braintree.php
CHANGED
@@ -22,7 +22,7 @@
|
|
22 |
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
|
23 |
*/
|
24 |
|
25 |
-
use \
|
26 |
|
27 |
defined( 'ABSPATH' ) or exit;
|
28 |
|
@@ -88,7 +88,10 @@ class WC_Braintree extends WC_Braintree_Framework\SV_WC_Payment_Gateway_Plugin {
|
|
88 |
|
89 |
|
90 |
/** plugin version number */
|
91 |
-
const VERSION = '2.
|
|
|
|
|
|
|
92 |
|
93 |
/** @var WC_Braintree single instance of this plugin */
|
94 |
protected static $instance;
|
@@ -137,7 +140,9 @@ class WC_Braintree extends WC_Braintree_Framework\SV_WC_Payment_Gateway_Plugin {
|
|
137 |
self::FEATURE_MY_PAYMENT_METHODS,
|
138 |
self::FEATURE_CUSTOMER_ID,
|
139 |
),
|
140 |
-
'dependencies' =>
|
|
|
|
|
141 |
)
|
142 |
);
|
143 |
|
@@ -214,6 +219,19 @@ class WC_Braintree extends WC_Braintree_Framework\SV_WC_Payment_Gateway_Plugin {
|
|
214 |
}
|
215 |
|
216 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
217 |
/**
|
218 |
* Handles the Braintree Auth connection response.
|
219 |
*
|
@@ -371,6 +389,43 @@ class WC_Braintree extends WC_Braintree_Framework\SV_WC_Payment_Gateway_Plugin {
|
|
371 |
}
|
372 |
|
373 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
374 |
/** Admin methods ******************************************************/
|
375 |
|
376 |
|
@@ -431,7 +486,7 @@ class WC_Braintree extends WC_Braintree_Framework\SV_WC_Payment_Gateway_Plugin {
|
|
431 |
if ( isset( $paypal_settings['enabled'] ) && 'yes' == $paypal_settings['enabled'] ) {
|
432 |
if ( isset( $paypal_settings['environment'] ) && 'production' == $paypal_settings['environment'] ) {
|
433 |
|
434 |
-
if ( !
|
435 |
|
436 |
$this->get_admin_notice_handler()->add_admin_notice( __( 'WooCommerce is not being forced over SSL -- Using PayPal with Braintree requires that checkout to be forced over SSL.', 'woocommerce-gateway-paypal-powered-by-braintree' ), 'ssl-recommended-notice' );
|
437 |
}
|
@@ -579,259 +634,6 @@ class WC_Braintree extends WC_Braintree_Framework\SV_WC_Payment_Gateway_Plugin {
|
|
579 |
}
|
580 |
|
581 |
|
582 |
-
/** Lifecycle methods ******************************************************/
|
583 |
-
|
584 |
-
|
585 |
-
/**
|
586 |
-
* Handles installing or upgrading the plugin.
|
587 |
-
*
|
588 |
-
* @since 2.0.0
|
589 |
-
*/
|
590 |
-
public function do_install() {
|
591 |
-
|
592 |
-
$installed_version = get_option( $this->get_plugin_version_name() );
|
593 |
-
|
594 |
-
// if installing from the retired WooCommerce Braintree plugin (higher version number)
|
595 |
-
if ( version_compare( $installed_version, $this->get_version(), '>' ) ) {
|
596 |
-
|
597 |
-
$this->migrate_from_sv();
|
598 |
-
|
599 |
-
// if upgrading from 1.x, which won't have a version number set
|
600 |
-
} elseif ( ! $installed_version && ( get_option( 'woocommerce_paypalbraintree_cards_settings' ) || get_option( 'wc_paypal_braintree_merchant_access_token' ) ) ) {
|
601 |
-
|
602 |
-
// set the version number
|
603 |
-
update_option( $this->get_plugin_version_name(), '1.2.7' );
|
604 |
-
}
|
605 |
-
|
606 |
-
parent::do_install();
|
607 |
-
}
|
608 |
-
|
609 |
-
|
610 |
-
/**
|
611 |
-
* Perform any version-related changes.
|
612 |
-
*
|
613 |
-
* @since 2.0
|
614 |
-
* @param int $installed_version the currently installed version of the plugin
|
615 |
-
*/
|
616 |
-
protected function upgrade( $installed_version ) {
|
617 |
-
|
618 |
-
// upgrade to 2.0.0
|
619 |
-
if ( version_compare( $installed_version, '2.0.0', '<' ) ) {
|
620 |
-
|
621 |
-
global $wpdb;
|
622 |
-
|
623 |
-
$this->log( 'Starting upgrade to 2.0.0' );
|
624 |
-
|
625 |
-
$environment = ( 'sandbox' === get_option( 'wc_paypal_braintree_environment' ) ) ? WC_Gateway_Braintree::ENVIRONMENT_SANDBOX : WC_Gateway_Braintree::ENVIRONMENT_PRODUCTION;
|
626 |
-
$merchant_id = get_option( 'wc_paypal_braintree_merchant_id', '' );
|
627 |
-
|
628 |
-
// Begin settings upgrade
|
629 |
-
$this->log( 'Upgrading settings' );
|
630 |
-
|
631 |
-
// we need to parse args here because it's possible that the legacy
|
632 |
-
// gateway was connected & processing payments but the settings were
|
633 |
-
// never saved.
|
634 |
-
$legacy_settings = wp_parse_args( get_option( 'woocommerce_paypalbraintree_cards_settings', array() ), array(
|
635 |
-
'enabled' => ( get_option( 'wc_paypal_braintree_merchant_access_token' ) ) ? 'yes' : 'no',
|
636 |
-
'capture' => 'yes',
|
637 |
-
'debug' => 'no',
|
638 |
-
'title_cards' => 'Credit Card',
|
639 |
-
'description_cards' => 'Pay securely using your credit card.',
|
640 |
-
'title_paypal' => 'PayPal',
|
641 |
-
'description_paypal' => 'Click the PayPal icon below to sign into your PayPal account and pay securely.',
|
642 |
-
) );
|
643 |
-
|
644 |
-
$common_settings = array(
|
645 |
-
'enabled' => $legacy_settings['enabled'],
|
646 |
-
'transaction_type' => ( 'yes' === $legacy_settings['capture'] ) ? WC_Gateway_Braintree::TRANSACTION_TYPE_CHARGE : WC_Gateway_Braintree::TRANSACTION_TYPE_AUTHORIZATION,
|
647 |
-
'tokenization' => 'yes',
|
648 |
-
'environment' => $environment,
|
649 |
-
'debug_mode' => ( 'yes' === $legacy_settings['debug'] ) ? WC_Gateway_Braintree::DEBUG_MODE_LOG : WC_Gateway_Braintree::DEBUG_MODE_OFF,
|
650 |
-
'connect_manually' => 'no',
|
651 |
-
'inherit_settings' => 'no',
|
652 |
-
);
|
653 |
-
|
654 |
-
if ( $environment === WC_Gateway_Braintree::ENVIRONMENT_PRODUCTION ) {
|
655 |
-
$common_settings['merchant_id'] = $merchant_id;
|
656 |
-
} else {
|
657 |
-
$common_settings[ $environment . '_merchant_id'] = $merchant_id;
|
658 |
-
}
|
659 |
-
|
660 |
-
$credit_card_settings = array(
|
661 |
-
'title' => $legacy_settings['title_cards'],
|
662 |
-
'description' => $legacy_settings['description_cards'],
|
663 |
-
'require_csc' => 'yes', // no option to disable this in v1, so enable by default
|
664 |
-
'card_types' => array( 'VISA', 'MC', 'AMEX', 'DISC', 'DINERS', 'JCB', ),
|
665 |
-
);
|
666 |
-
|
667 |
-
update_option( 'woocommerce_braintree_credit_card_settings', array_merge( $common_settings, $credit_card_settings ) );
|
668 |
-
|
669 |
-
$paypal_settings = array(
|
670 |
-
'title' => $legacy_settings['title_paypal'],
|
671 |
-
'description' => $legacy_settings['description_paypal'],
|
672 |
-
);
|
673 |
-
|
674 |
-
update_option( 'woocommerce_braintree_paypal_settings', array_merge( $common_settings, $paypal_settings ) );
|
675 |
-
|
676 |
-
// the Braintree Auth options
|
677 |
-
$wpdb->update( $wpdb->options, array( 'option_name' => 'wc_braintree_auth_access_token' ), array( 'option_name' => 'wc_paypal_braintree_merchant_access_token' ) );
|
678 |
-
$wpdb->update( $wpdb->options, array( 'option_name' => 'wc_braintree_auth_environment' ), array( 'option_name' => 'wc_paypal_braintree_environment' ) );
|
679 |
-
$wpdb->update( $wpdb->options, array( 'option_name' => 'wc_braintree_auth_merchant_id' ), array( 'option_name' => 'wc_paypal_braintree_merchant_id' ) );
|
680 |
-
|
681 |
-
$this->log( 'Settings upgraded' );
|
682 |
-
|
683 |
-
// update the legacy order & user meta
|
684 |
-
$this->update_legacy_meta();
|
685 |
-
|
686 |
-
// flush the options cache to ensure notices are displayed correctly
|
687 |
-
wp_cache_flush();
|
688 |
-
|
689 |
-
$this->log( 'Completed upgrade for 2.0.0' );
|
690 |
-
|
691 |
-
} elseif ( version_compare( $installed_version, '2.0.1', '<' ) ) {
|
692 |
-
|
693 |
-
// update meta again for those that may be seeing the legacy migration issue from previous installs
|
694 |
-
$this->update_legacy_meta();
|
695 |
-
}
|
696 |
-
|
697 |
-
// upgrade to v2.0.2
|
698 |
-
if ( version_compare( $installed_version, '2.0.2', '<' ) ) {
|
699 |
-
|
700 |
-
$this->log( 'Starting upgrade to 2.0.2' );
|
701 |
-
|
702 |
-
$cc_settings = get_option( 'woocommerce_braintree_credit_card_settings', array() );
|
703 |
-
|
704 |
-
// if the require CSC setting was never set, set it to avoid various false error notices
|
705 |
-
if ( ! empty( $cc_settings ) && empty( $cc_settings['require_csc'] ) ) {
|
706 |
-
|
707 |
-
$this->log( 'Updating missing CSC setting' );
|
708 |
-
|
709 |
-
$cc_settings['require_csc'] = 'yes';
|
710 |
-
|
711 |
-
update_option( 'woocommerce_braintree_credit_card_settings', $cc_settings );
|
712 |
-
}
|
713 |
-
|
714 |
-
$this->log( 'Completed upgrade for 2.0.2' );
|
715 |
-
}
|
716 |
-
}
|
717 |
-
|
718 |
-
|
719 |
-
/**
|
720 |
-
* Migrate the necessary settings from the retired plugin.
|
721 |
-
*
|
722 |
-
* @since 2.0.0
|
723 |
-
*/
|
724 |
-
protected function migrate_from_sv() {
|
725 |
-
|
726 |
-
$this->log( 'Starting migration to ' . $this->get_plugin_name() );
|
727 |
-
|
728 |
-
// set the version number
|
729 |
-
update_option( $this->get_plugin_version_name(), $this->get_version() );
|
730 |
-
|
731 |
-
foreach ( $this->get_gateway_ids() as $gateway_id ) {
|
732 |
-
|
733 |
-
$settings = $this->get_gateway_settings( $gateway_id );
|
734 |
-
|
735 |
-
// if the API credentials have been previously configured
|
736 |
-
if ( 'yes' === $settings['inherit_settings'] || ( ! empty( $settings['public_key'] ) && ! empty( $settings['private_key'] ) && ! empty( $settings['merchant_id'] ) ) || ( ! empty( $settings['sandbox_public_key'] ) && ! empty( $settings['sandbox_private_key'] ) && ! empty( $settings['sandbox_merchant_id'] ) ) ) {
|
737 |
-
|
738 |
-
$settings['connect_manually'] = 'yes';
|
739 |
-
|
740 |
-
update_option( $this->get_gateway_settings_name( $gateway_id ), $settings );
|
741 |
-
}
|
742 |
-
}
|
743 |
-
|
744 |
-
update_option( 'wc_braintree_legacy_migrated', 'yes' );
|
745 |
-
|
746 |
-
// update legacy meta in case users had previously switched to v1 from
|
747 |
-
// the SkyVerge plugin prior to this migration
|
748 |
-
$this->update_legacy_meta();
|
749 |
-
|
750 |
-
$this->log( 'Completed migration to ' . $this->get_plugin_name() );
|
751 |
-
}
|
752 |
-
|
753 |
-
|
754 |
-
/**
|
755 |
-
* Migrates Braintree legacy order, subscription, and user meta to v2.
|
756 |
-
*
|
757 |
-
* @since 2.0.1
|
758 |
-
*/
|
759 |
-
protected function update_legacy_meta() {
|
760 |
-
global $wpdb;
|
761 |
-
|
762 |
-
$this->log( 'Updating legacy meta' );
|
763 |
-
|
764 |
-
$order_meta = array(
|
765 |
-
'_wc_paypal_braintree_customer_id' => 'customer_id',
|
766 |
-
'_wc_paypal_braintree_payment_method_token' => 'payment_token',
|
767 |
-
'_pp_braintree_charge_captured' => 'charge_captured',
|
768 |
-
);
|
769 |
-
|
770 |
-
$count = 0;
|
771 |
-
|
772 |
-
foreach ( $order_meta as $legacy_key => $new_suffix ) {
|
773 |
-
|
774 |
-
// update for the credit card gateway
|
775 |
-
$rows = $wpdb->query(
|
776 |
-
$wpdb->prepare(
|
777 |
-
"
|
778 |
-
UPDATE {$wpdb->postmeta} meta1, {$wpdb->postmeta} meta2
|
779 |
-
SET meta1.meta_key = %s
|
780 |
-
WHERE meta1.meta_key = %s
|
781 |
-
AND meta2.meta_key = '_payment_method'
|
782 |
-
AND meta2.meta_value = 'paypalbraintree_cards'
|
783 |
-
AND meta1.post_id = meta2.post_id
|
784 |
-
",
|
785 |
-
[
|
786 |
-
'_wc_braintree_credit_card_' . $new_suffix,
|
787 |
-
$legacy_key,
|
788 |
-
]
|
789 |
-
)
|
790 |
-
);
|
791 |
-
|
792 |
-
$count += $rows;
|
793 |
-
|
794 |
-
// update for the paypal gateway
|
795 |
-
$rows = $wpdb->query(
|
796 |
-
$wpdb->prepare(
|
797 |
-
"
|
798 |
-
UPDATE {$wpdb->postmeta} meta1, {$wpdb->postmeta} meta2
|
799 |
-
SET meta1.meta_key = %s
|
800 |
-
WHERE meta1.meta_key = %s
|
801 |
-
AND meta2.meta_key = '_payment_method'
|
802 |
-
AND meta2.meta_value = 'paypalbraintree_paypal'
|
803 |
-
AND meta1.post_id = meta2.post_id
|
804 |
-
",
|
805 |
-
[
|
806 |
-
'_wc_braintree_paypal_' . $new_suffix,
|
807 |
-
$legacy_key,
|
808 |
-
]
|
809 |
-
)
|
810 |
-
);
|
811 |
-
|
812 |
-
$count += $rows;
|
813 |
-
}
|
814 |
-
|
815 |
-
if ( $rows = $wpdb->update( $wpdb->postmeta, array( 'meta_value' => 'braintree_credit_card' ), array( 'meta_key' => '_payment_method', 'meta_value' => 'paypalbraintree_cards' ) ) ) {
|
816 |
-
$count += $rows;
|
817 |
-
}
|
818 |
-
if ( $rows = $wpdb->update( $wpdb->postmeta, array( 'meta_value' => 'braintree_paypal' ), array( 'meta_key' => '_payment_method', 'meta_value' => 'paypalbraintree_paypal' ) ) ) {
|
819 |
-
$count += $rows;
|
820 |
-
}
|
821 |
-
|
822 |
-
if ( $count ) {
|
823 |
-
$this->log( sprintf( '%d rows of order meta data updated.', $count ) );
|
824 |
-
}
|
825 |
-
|
826 |
-
// Customer IDs
|
827 |
-
// old key: _wc_paypal_braintree_customer_id
|
828 |
-
// new key: wc_braintree_customer_id
|
829 |
-
if ( $rows = $wpdb->update( $wpdb->usermeta, array( 'meta_key' => 'wc_braintree_customer_id' ), array( 'meta_key' => '_wc_paypal_braintree_customer_id' ) ) ) {
|
830 |
-
$this->log( sprintf( '%d user customer IDs updated.', $rows ) );
|
831 |
-
}
|
832 |
-
}
|
833 |
-
|
834 |
-
|
835 |
/**
|
836 |
* Determines if WooCommerce is active.
|
837 |
*
|
22 |
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
|
23 |
*/
|
24 |
|
25 |
+
use WC_Braintree\Plugin_Framework as WC_Braintree_Framework;
|
26 |
|
27 |
defined( 'ABSPATH' ) or exit;
|
28 |
|
88 |
|
89 |
|
90 |
/** plugin version number */
|
91 |
+
const VERSION = '2.2.0';
|
92 |
+
|
93 |
+
/** Braintree JS SDK version */
|
94 |
+
const BRAINTREE_JS_SDK_VERSION = '3.38.0';
|
95 |
|
96 |
/** @var WC_Braintree single instance of this plugin */
|
97 |
protected static $instance;
|
140 |
self::FEATURE_MY_PAYMENT_METHODS,
|
141 |
self::FEATURE_CUSTOMER_ID,
|
142 |
),
|
143 |
+
'dependencies' => [
|
144 |
+
'php_extensions' => [ 'curl', 'dom', 'hash', 'openssl', 'SimpleXML', 'xmlwriter' ],
|
145 |
+
],
|
146 |
)
|
147 |
);
|
148 |
|
219 |
}
|
220 |
|
221 |
|
222 |
+
/**
|
223 |
+
* Initializes the plugin lifecycle handler.
|
224 |
+
*
|
225 |
+
* @since 2.2.0
|
226 |
+
*/
|
227 |
+
public function init_lifecycle_handler() {
|
228 |
+
|
229 |
+
require_once( $this->get_plugin_path() . '/includes/class-wc-braintree-lifecycle.php' );
|
230 |
+
|
231 |
+
$this->lifecycle_handler = new \WC_Braintree\Lifecycle( $this );
|
232 |
+
}
|
233 |
+
|
234 |
+
|
235 |
/**
|
236 |
* Handles the Braintree Auth connection response.
|
237 |
*
|
389 |
}
|
390 |
|
391 |
|
392 |
+
/** Apple Pay Methods *********************************************************************************************/
|
393 |
+
|
394 |
+
|
395 |
+
/**
|
396 |
+
* Initializes the Apple Pay feature.
|
397 |
+
*
|
398 |
+
* The framework requires this be enabled by filter due to the complicated setup that's usually required. Braintree
|
399 |
+
* makes the process a bit easier, so let's enable it by default.
|
400 |
+
*
|
401 |
+
* @since 2.2.0
|
402 |
+
*/
|
403 |
+
public function maybe_init_apple_pay() {
|
404 |
+
|
405 |
+
add_filter( 'wc_payment_gateway_' . $this->get_id() . '_activate_apple_pay', '__return_true' );
|
406 |
+
|
407 |
+
parent::maybe_init_apple_pay();
|
408 |
+
}
|
409 |
+
|
410 |
+
|
411 |
+
/**
|
412 |
+
* Builds the Apple Pay handler instance.
|
413 |
+
*
|
414 |
+
* @since 2.2.0
|
415 |
+
*
|
416 |
+
* @return \WC_Braintree\Apple_Pay
|
417 |
+
*/
|
418 |
+
protected function build_apple_pay_instance() {
|
419 |
+
|
420 |
+
// include the overridden handler classes
|
421 |
+
require_once( $this->get_plugin_path() . '/includes/apple-pay/class-wc-braintree-apple-pay.php' );
|
422 |
+
require_once( $this->get_plugin_path() . '/includes/apple-pay/class-wc-braintree-apple-pay-frontend.php' );
|
423 |
+
require_once( $this->get_plugin_path() . '/includes/apple-pay/api/class-wc-braintree-apple-pay-api-payment-response.php' );
|
424 |
+
|
425 |
+
return new \WC_Braintree\Apple_Pay( $this );
|
426 |
+
}
|
427 |
+
|
428 |
+
|
429 |
/** Admin methods ******************************************************/
|
430 |
|
431 |
|
486 |
if ( isset( $paypal_settings['enabled'] ) && 'yes' == $paypal_settings['enabled'] ) {
|
487 |
if ( isset( $paypal_settings['environment'] ) && 'production' == $paypal_settings['environment'] ) {
|
488 |
|
489 |
+
if ( ! wc_checkout_is_https() && ! $this->get_admin_notice_handler()->is_notice_dismissed( 'ssl-recommended-notice' ) ) {
|
490 |
|
491 |
$this->get_admin_notice_handler()->add_admin_notice( __( 'WooCommerce is not being forced over SSL -- Using PayPal with Braintree requires that checkout to be forced over SSL.', 'woocommerce-gateway-paypal-powered-by-braintree' ), 'ssl-recommended-notice' );
|
492 |
}
|
634 |
}
|
635 |
|
636 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
637 |
/**
|
638 |
* Determines if WooCommerce is active.
|
639 |
*
|
i18n/languages/woocommerce-gateway-paypal-powered-by-braintree.pot
CHANGED
@@ -2,10 +2,10 @@
|
|
2 |
# This file is distributed under the same license as the WooCommerce PayPal Powered by Braintree Gateway package.
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
-
"Project-Id-Version: WooCommerce PayPal Powered by Braintree Gateway 2.
|
6 |
"Report-Msgid-Bugs-To: "
|
7 |
"https://woocommerce.com/my-account/marketplace-ticket-form/\n"
|
8 |
-
"POT-Creation-Date: 2018-
|
9 |
"MIME-Version: 1.0\n"
|
10 |
"Content-Type: text/plain; charset=utf-8\n"
|
11 |
"Content-Transfer-Encoding: 8bit\n"
|
@@ -19,52 +19,52 @@ msgid ""
|
|
19 |
"not installed."
|
20 |
msgstr ""
|
21 |
|
22 |
-
#: class-wc-braintree.php:
|
23 |
msgid "Connected successfully."
|
24 |
msgstr ""
|
25 |
|
26 |
-
#: class-wc-braintree.php:
|
27 |
msgid "There was an error connecting your Braintree account. Please try again."
|
28 |
msgstr ""
|
29 |
|
30 |
-
#: class-wc-braintree.php:
|
31 |
msgid "Invalid connection request"
|
32 |
msgstr ""
|
33 |
|
34 |
-
#: class-wc-braintree.php:
|
35 |
msgid "Disconnected successfully."
|
36 |
msgstr ""
|
37 |
|
38 |
-
#: class-wc-braintree.php:
|
39 |
msgid "Invalid disconnect request"
|
40 |
msgstr ""
|
41 |
|
42 |
-
#: class-wc-braintree.php:
|
43 |
msgid ""
|
44 |
"Heads up! You've enabled advanced fraud tools for Braintree. Please make "
|
45 |
"sure that advanced fraud tools are also enabled in your Braintree account. "
|
46 |
"Need help? See the %1$sdocumentation%2$s."
|
47 |
msgstr ""
|
48 |
|
49 |
-
#: class-wc-braintree.php:
|
50 |
msgid ""
|
51 |
"PayPal powered by Braintree is almost ready. To get started, %1$sconnect "
|
52 |
"your Braintree account%2$s."
|
53 |
msgstr ""
|
54 |
|
55 |
-
#: class-wc-braintree.php:
|
56 |
msgid ""
|
57 |
"Upgrade successful! WooCommerce Braintree deactivated, and PayPal Powered "
|
58 |
"by Braintree has been %1$sconfigured with your previous settings%2$s."
|
59 |
msgstr ""
|
60 |
|
61 |
-
#: class-wc-braintree.php:
|
62 |
msgid ""
|
63 |
"WooCommerce is not being forced over SSL -- Using PayPal with Braintree "
|
64 |
"requires that checkout to be forced over SSL."
|
65 |
msgstr ""
|
66 |
|
67 |
-
#: class-wc-braintree.php:
|
68 |
#. translators: Placeholders: %1$s - payment gateway name tag, %2$s - <a> tag,
|
69 |
#. %3$s - </a> tag
|
70 |
msgid ""
|
@@ -76,11 +76,11 @@ msgstr ""
|
|
76 |
msgid "WooCommerce PayPal Powered by Braintree Gateway"
|
77 |
msgstr ""
|
78 |
|
79 |
-
#: class-wc-braintree.php:
|
80 |
msgid "Configure Credit Card"
|
81 |
msgstr ""
|
82 |
|
83 |
-
#: class-wc-braintree.php:
|
84 |
msgid "Configure PayPal"
|
85 |
msgstr ""
|
86 |
|
@@ -91,41 +91,41 @@ msgid ""
|
|
91 |
"method."
|
92 |
msgstr ""
|
93 |
|
94 |
-
#: includes/api/class-wc-braintree-api.php:
|
95 |
msgid "The billing address for this transaction does not match the cardholders."
|
96 |
msgstr ""
|
97 |
|
98 |
-
#: includes/api/class-wc-braintree-api.php:
|
99 |
msgid "The CSC for the transaction was invalid or incorrect."
|
100 |
msgstr ""
|
101 |
|
102 |
-
#: includes/api/class-wc-braintree-api.php:
|
103 |
msgid ""
|
104 |
"Invalid Credentials, please double-check your API credentials (Merchant ID, "
|
105 |
"Public Key, Private Key, and Merchant Account ID) and try again."
|
106 |
msgstr ""
|
107 |
|
108 |
-
#: includes/api/class-wc-braintree-api.php:
|
109 |
msgid ""
|
110 |
"Authorization Failed, please verify the user for the API credentials "
|
111 |
"provided can perform transactions and that the request data is correct."
|
112 |
msgstr ""
|
113 |
|
114 |
-
#: includes/api/class-wc-braintree-api.php:
|
115 |
msgid "Braintree is currently down for maintenance, please try again later."
|
116 |
msgstr ""
|
117 |
|
118 |
-
#: includes/api/class-wc-braintree-api.php:
|
119 |
msgid "The record cannot be found, please contact support."
|
120 |
msgstr ""
|
121 |
|
122 |
-
#: includes/api/class-wc-braintree-api.php:
|
123 |
msgid ""
|
124 |
"Braintree encountered an error when processing your request, please try "
|
125 |
"again later or contact support."
|
126 |
msgstr ""
|
127 |
|
128 |
-
#: includes/api/class-wc-braintree-api.php:
|
129 |
msgid ""
|
130 |
"Braintree cannot verify your server's SSL certificate. Please contact your "
|
131 |
"hosting provider or try again later."
|
@@ -139,12 +139,12 @@ msgstr ""
|
|
139 |
msgid "Required PayPal token is missing or empty!"
|
140 |
msgstr ""
|
141 |
|
142 |
-
#: includes/class-wc-braintree-frontend.php:
|
143 |
#. translators: %s - last four digits of a card/account
|
144 |
msgid "ending in %s"
|
145 |
msgstr ""
|
146 |
|
147 |
-
#: includes/class-wc-braintree-frontend.php:
|
148 |
msgid "(default)"
|
149 |
msgstr ""
|
150 |
|
@@ -154,39 +154,39 @@ msgstr ""
|
|
154 |
msgid "%1$s Account Saved: %2$s"
|
155 |
msgstr ""
|
156 |
|
157 |
-
#: includes/class-wc-braintree-paypal-cart.php:
|
158 |
msgid "Cancel"
|
159 |
msgstr ""
|
160 |
|
161 |
-
#: includes/class-wc-gateway-braintree-credit-card.php:
|
162 |
msgid "Braintree (Credit Card)"
|
163 |
msgstr ""
|
164 |
|
165 |
-
#: includes/class-wc-gateway-braintree-credit-card.php:
|
166 |
msgid "Allow customers to securely pay using their credit card via Braintree."
|
167 |
msgstr ""
|
168 |
|
169 |
-
#: includes/class-wc-gateway-braintree-credit-card.php:
|
170 |
msgid "Basic"
|
171 |
msgstr ""
|
172 |
|
173 |
-
#: includes/class-wc-gateway-braintree-credit-card.php:
|
174 |
msgid "Advanced"
|
175 |
msgstr ""
|
176 |
|
177 |
-
#: includes/class-wc-gateway-braintree-credit-card.php:
|
178 |
msgid "Kount Direct"
|
179 |
msgstr ""
|
180 |
|
181 |
-
#: includes/class-wc-gateway-braintree-credit-card.php:
|
182 |
msgid "Fraud Settings"
|
183 |
msgstr ""
|
184 |
|
185 |
-
#: includes/class-wc-gateway-braintree-credit-card.php:
|
186 |
msgid "Fraud Tool"
|
187 |
msgstr ""
|
188 |
|
189 |
-
#: includes/class-wc-gateway-braintree-credit-card.php:
|
190 |
msgid ""
|
191 |
"Select the fraud tool you want to use. Basic is enabled by default and "
|
192 |
"requires no additional configuration. Advanced requires you to enable "
|
@@ -194,206 +194,273 @@ msgid ""
|
|
194 |
"you must contact Braintree support."
|
195 |
msgstr ""
|
196 |
|
197 |
-
#: includes/class-wc-gateway-braintree-credit-card.php:
|
198 |
msgid "Kount merchant ID"
|
199 |
msgstr ""
|
200 |
|
201 |
-
#: includes/class-wc-gateway-braintree-credit-card.php:
|
202 |
msgid "Speak with your account management team at Braintree to get this."
|
203 |
msgstr ""
|
204 |
|
205 |
-
#: includes/class-wc-gateway-braintree-credit-card.php:
|
206 |
-
msgid "3D Secure
|
207 |
msgstr ""
|
208 |
|
209 |
-
#: includes/class-wc-gateway-braintree-credit-card.php:
|
210 |
msgid ""
|
211 |
"3D Secure benefits cardholders and merchants by providing an additional "
|
212 |
-
"layer of verification
|
|
|
213 |
msgstr ""
|
214 |
|
215 |
-
#: includes/class-wc-gateway-braintree-credit-card.php:
|
216 |
-
msgid "
|
217 |
msgstr ""
|
218 |
|
219 |
-
#: includes/class-wc-gateway-braintree-credit-card.php:
|
220 |
-
msgid "
|
221 |
msgstr ""
|
222 |
|
223 |
-
#: includes/class-wc-gateway-braintree-credit-card.php:
|
224 |
-
msgid ""
|
225 |
-
"You must contact Braintree support to add this feature to your Braintree "
|
226 |
-
"account before enabling this option."
|
227 |
msgstr ""
|
228 |
|
229 |
-
#: includes/class-wc-gateway-braintree-credit-card.php:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
230 |
msgid "Card Verification (CSC)"
|
231 |
msgstr ""
|
232 |
|
233 |
-
#: includes/class-wc-gateway-braintree-credit-card.php:
|
234 |
msgid "Display and Require the Card Security Code (CVV/CID) field on checkout"
|
235 |
msgstr ""
|
236 |
|
237 |
-
#: includes/class-wc-gateway-braintree-credit-card.php:
|
238 |
-
#: includes/payment-forms/class-wc-braintree-hosted-fields-payment-form.php:
|
239 |
msgid ""
|
240 |
"We cannot process your order with the payment information that you "
|
241 |
"provided. Please use an alternate payment method."
|
242 |
msgstr ""
|
243 |
|
244 |
-
#: includes/class-wc-gateway-braintree-credit-card.php:
|
245 |
-
#: includes/class-wc-gateway-braintree.php:
|
246 |
msgid ""
|
247 |
"Oops, there was a temporary payment error. Please try another payment "
|
248 |
"method or contact us to complete your transaction."
|
249 |
msgstr ""
|
250 |
|
251 |
-
#: includes/class-wc-gateway-braintree-paypal.php:
|
252 |
msgid "Braintree (PayPal)"
|
253 |
msgstr ""
|
254 |
|
255 |
-
#: includes/class-wc-gateway-braintree-paypal.php:
|
256 |
msgid "Allow customers to securely pay using their PayPal account via Braintree."
|
257 |
msgstr ""
|
258 |
|
259 |
-
#: includes/class-wc-gateway-braintree-paypal.php:
|
260 |
msgid "Token ID"
|
261 |
msgstr ""
|
262 |
|
263 |
-
#: includes/class-wc-gateway-braintree-paypal.php:
|
264 |
msgid "Email"
|
265 |
msgstr ""
|
266 |
|
267 |
-
#: includes/class-wc-gateway-braintree-paypal.php:
|
268 |
msgid "Use a new PayPal account"
|
269 |
msgstr ""
|
270 |
|
271 |
-
#: includes/class-wc-gateway-braintree-paypal.php:
|
272 |
msgid "PayPal Accounts"
|
273 |
msgstr ""
|
274 |
|
275 |
-
#: includes/class-wc-gateway-braintree-paypal.php:
|
276 |
msgid "Unlink"
|
277 |
msgstr ""
|
278 |
|
279 |
-
#: includes/class-wc-gateway-braintree-paypal.php:
|
280 |
-
msgid "
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
281 |
msgstr ""
|
282 |
|
283 |
#: includes/class-wc-gateway-braintree-paypal.php:249
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
284 |
msgid "Allow customers to check out with PayPal from the Cart page"
|
285 |
msgstr ""
|
286 |
|
287 |
-
#: includes/class-wc-gateway-braintree-paypal.php:
|
|
|
|
|
|
|
|
|
288 |
#. translators: Placeholders: %1$s - payment method title (e.g. PayPal), %2$s -
|
289 |
#. transaction environment (either Sandbox or blank string), %3$s - type of
|
290 |
#. transaction (either Authorization or Payment)
|
291 |
msgid "%1$s %2$s %3$s Approved"
|
292 |
msgstr ""
|
293 |
|
294 |
-
#: includes/class-wc-gateway-braintree-paypal.php:
|
295 |
-
#: includes/class-wc-gateway-braintree.php:
|
296 |
msgid "Sandbox"
|
297 |
msgstr ""
|
298 |
|
299 |
-
#: includes/class-wc-gateway-braintree-paypal.php:
|
300 |
msgid "Authorization"
|
301 |
msgstr ""
|
302 |
|
303 |
-
#: includes/class-wc-gateway-braintree-paypal.php:
|
304 |
msgid "Payment"
|
305 |
msgstr ""
|
306 |
|
307 |
-
#: includes/class-wc-gateway-braintree-paypal.php:
|
308 |
#. translators: Placeholders: %s - transaction ID
|
309 |
msgid "(Transaction ID %s)"
|
310 |
msgstr ""
|
311 |
|
312 |
-
#: includes/class-wc-gateway-braintree-paypal.php:
|
313 |
msgid "PayPal Account Saved: %s"
|
314 |
msgstr ""
|
315 |
|
316 |
-
#: includes/class-wc-gateway-braintree-paypal.php:
|
317 |
msgid "PayPal"
|
318 |
msgstr ""
|
319 |
|
320 |
-
#: includes/class-wc-gateway-braintree-paypal.php:
|
321 |
msgid ""
|
322 |
"Click the PayPal icon below to sign into your PayPal account and pay "
|
323 |
"securely."
|
324 |
msgstr ""
|
325 |
|
326 |
-
#: includes/class-wc-gateway-braintree.php:
|
327 |
-
msgid "Currently unavailable. Please try a different payment method."
|
328 |
-
msgstr ""
|
329 |
-
|
330 |
-
#: includes/class-wc-gateway-braintree.php:128
|
331 |
-
msgid "Oops, something went wrong. Please try a different payment method."
|
332 |
-
msgstr ""
|
333 |
-
|
334 |
-
#: includes/class-wc-gateway-braintree.php:381
|
335 |
msgid "Public Key"
|
336 |
msgstr ""
|
337 |
|
338 |
-
#: includes/class-wc-gateway-braintree.php:
|
339 |
msgid "The Public Key for your Braintree account."
|
340 |
msgstr ""
|
341 |
|
342 |
-
#: includes/class-wc-gateway-braintree.php:
|
343 |
msgid "Private Key"
|
344 |
msgstr ""
|
345 |
|
346 |
-
#: includes/class-wc-gateway-braintree.php:
|
347 |
msgid "The Private Key for your Braintree account."
|
348 |
msgstr ""
|
349 |
|
350 |
-
#: includes/class-wc-gateway-braintree.php:
|
351 |
msgid "Merchant ID"
|
352 |
msgstr ""
|
353 |
|
354 |
-
#: includes/class-wc-gateway-braintree.php:
|
355 |
msgid "The Merchant ID for your Braintree account."
|
356 |
msgstr ""
|
357 |
|
358 |
-
#: includes/class-wc-gateway-braintree.php:
|
359 |
msgid "Sandbox Public Key"
|
360 |
msgstr ""
|
361 |
|
362 |
-
#: includes/class-wc-gateway-braintree.php:
|
363 |
msgid "The Public Key for your Braintree sandbox account."
|
364 |
msgstr ""
|
365 |
|
366 |
-
#: includes/class-wc-gateway-braintree.php:
|
367 |
msgid "Sandbox Private Key"
|
368 |
msgstr ""
|
369 |
|
370 |
-
#: includes/class-wc-gateway-braintree.php:
|
371 |
msgid "The Private Key for your Braintree sandbox account."
|
372 |
msgstr ""
|
373 |
|
374 |
-
#: includes/class-wc-gateway-braintree.php:
|
375 |
msgid "Sandbox Merchant ID"
|
376 |
msgstr ""
|
377 |
|
378 |
-
#: includes/class-wc-gateway-braintree.php:
|
379 |
msgid "The Merchant ID for your Braintree sandbox account."
|
380 |
msgstr ""
|
381 |
|
382 |
-
#: includes/class-wc-gateway-braintree.php:
|
383 |
msgid "Merchant Account IDs"
|
384 |
msgstr ""
|
385 |
|
386 |
-
#: includes/class-wc-gateway-braintree.php:
|
387 |
msgid ""
|
388 |
"Enter additional merchant account IDs if you do not want to use your "
|
389 |
"Braintree account default. %1$sLearn more about merchant account IDs%2$s"
|
390 |
msgstr ""
|
391 |
|
392 |
-
#: includes/class-wc-gateway-braintree.php:
|
393 |
msgid "Dynamic Descriptors"
|
394 |
msgstr ""
|
395 |
|
396 |
-
#: includes/class-wc-gateway-braintree.php:
|
397 |
#. translators: Placeholders: %1$s - <p> tag, %2$s - </p> tag, %3$s - <a> tag,
|
398 |
#. %4$s - </a> tag
|
399 |
msgid ""
|
@@ -403,11 +470,11 @@ msgid ""
|
|
403 |
"dynamic descriptors%4$s and are using an accepted format.%2$s"
|
404 |
msgstr ""
|
405 |
|
406 |
-
#: includes/class-wc-gateway-braintree.php:
|
407 |
msgid "Name"
|
408 |
msgstr ""
|
409 |
|
410 |
-
#: includes/class-wc-gateway-braintree.php:
|
411 |
msgid ""
|
412 |
"The value in the business name field of a customer's statement. Company "
|
413 |
"name/DBA section must be either 3, 7 or 12 characters and the product "
|
@@ -415,91 +482,99 @@ msgid ""
|
|
415 |
"between for a total descriptor name of 22 characters)."
|
416 |
msgstr ""
|
417 |
|
418 |
-
#: includes/class-wc-gateway-braintree.php:
|
419 |
msgid "Phone"
|
420 |
msgstr ""
|
421 |
|
422 |
-
#: includes/class-wc-gateway-braintree.php:
|
423 |
msgid ""
|
424 |
"The value in the phone number field of a customer's statement. Phone must "
|
425 |
"be exactly 10 characters and can only contain numbers, dashes, parentheses "
|
426 |
"and periods."
|
427 |
msgstr ""
|
428 |
|
429 |
-
#: includes/class-wc-gateway-braintree.php:
|
430 |
msgid "URL"
|
431 |
msgstr ""
|
432 |
|
433 |
-
#: includes/class-wc-gateway-braintree.php:
|
434 |
msgid ""
|
435 |
"The value in the URL/web address field of a customer's statement. The URL "
|
436 |
"must be 13 characters or less."
|
437 |
msgstr ""
|
438 |
|
439 |
-
#: includes/class-wc-gateway-braintree.php:
|
440 |
msgid "Enter connection credentials manually"
|
441 |
msgstr ""
|
442 |
|
443 |
-
#: includes/class-wc-gateway-braintree.php:
|
444 |
msgid "Disabled because the other gateway is not connected manually."
|
445 |
msgstr ""
|
446 |
|
447 |
-
#: includes/class-wc-gateway-braintree.php:
|
448 |
msgid ""
|
449 |
"You just connected your Braintree account to WooCommerce. You can start "
|
450 |
"taking payments now."
|
451 |
msgstr ""
|
452 |
|
453 |
-
#: includes/class-wc-gateway-braintree.php:
|
454 |
msgid ""
|
455 |
"Once you have processed a payment, PayPal will review your application for "
|
456 |
"final approval. Before you ship any goods make sure you have received a "
|
457 |
"final approval for your Braintree account."
|
458 |
msgstr ""
|
459 |
|
460 |
-
#: includes/class-wc-gateway-braintree.php:
|
461 |
msgid "Questions? We are a phone call away: 1-855-489-0345."
|
462 |
msgstr ""
|
463 |
|
464 |
-
#: includes/class-wc-gateway-braintree.php:
|
465 |
msgid "Click button to create an account with Braintree and start transacting."
|
466 |
msgstr ""
|
467 |
|
468 |
-
#: includes/class-wc-gateway-braintree.php:
|
469 |
msgid "Add merchant account ID for %s"
|
470 |
msgstr ""
|
471 |
|
472 |
-
#: includes/class-wc-gateway-braintree.php:
|
473 |
msgid "Add merchant account ID for "
|
474 |
msgstr ""
|
475 |
|
476 |
-
#: includes/class-wc-gateway-braintree.php:
|
477 |
msgid "Merchant Account ID (%s)"
|
478 |
msgstr ""
|
479 |
|
480 |
-
#: includes/class-wc-gateway-braintree.php:
|
481 |
msgid "Enter merchant account ID"
|
482 |
msgstr ""
|
483 |
|
484 |
-
#: includes/class-wc-gateway-braintree.php:
|
485 |
msgid "Remove this merchant account ID"
|
486 |
msgstr ""
|
487 |
|
488 |
-
#: includes/class-wc-gateway-braintree.php:
|
489 |
msgid "Production"
|
490 |
msgstr ""
|
491 |
|
492 |
-
#: includes/payment-forms/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
493 |
msgid "Expiration (MMYY)"
|
494 |
msgstr ""
|
495 |
|
496 |
-
#: includes/payment-forms/class-wc-braintree-paypal-payment-form.php:
|
497 |
msgid ""
|
498 |
"Please click the \"PayPal\" button below to log into your PayPal account "
|
499 |
"before placing your order."
|
500 |
msgstr ""
|
501 |
|
502 |
-
#: includes/payment-forms/class-wc-braintree-paypal-payment-form.php:
|
503 |
msgid ""
|
504 |
"Please click the \"PayPal\" button below to log into your PayPal account "
|
505 |
"before adding your payment method."
|
@@ -550,7 +625,17 @@ msgstr ""
|
|
550 |
msgid "http://woocommerce.com/"
|
551 |
msgstr ""
|
552 |
|
553 |
-
#: includes/class-wc-braintree-frontend.php:
|
554 |
msgctxt "Payment Method Type"
|
555 |
msgid "Type"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
556 |
msgstr ""
|
2 |
# This file is distributed under the same license as the WooCommerce PayPal Powered by Braintree Gateway package.
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
+
"Project-Id-Version: WooCommerce PayPal Powered by Braintree Gateway 2.2.0\n"
|
6 |
"Report-Msgid-Bugs-To: "
|
7 |
"https://woocommerce.com/my-account/marketplace-ticket-form/\n"
|
8 |
+
"POT-Creation-Date: 2018-11-12 21:00:33+00:00\n"
|
9 |
"MIME-Version: 1.0\n"
|
10 |
"Content-Type: text/plain; charset=utf-8\n"
|
11 |
"Content-Transfer-Encoding: 8bit\n"
|
19 |
"not installed."
|
20 |
msgstr ""
|
21 |
|
22 |
+
#: class-wc-braintree.php:251
|
23 |
msgid "Connected successfully."
|
24 |
msgstr ""
|
25 |
|
26 |
+
#: class-wc-braintree.php:254
|
27 |
msgid "There was an error connecting your Braintree account. Please try again."
|
28 |
msgstr ""
|
29 |
|
30 |
+
#: class-wc-braintree.php:284
|
31 |
msgid "Invalid connection request"
|
32 |
msgstr ""
|
33 |
|
34 |
+
#: class-wc-braintree.php:326
|
35 |
msgid "Disconnected successfully."
|
36 |
msgstr ""
|
37 |
|
38 |
+
#: class-wc-braintree.php:351
|
39 |
msgid "Invalid disconnect request"
|
40 |
msgstr ""
|
41 |
|
42 |
+
#: class-wc-braintree.php:448
|
43 |
msgid ""
|
44 |
"Heads up! You've enabled advanced fraud tools for Braintree. Please make "
|
45 |
"sure that advanced fraud tools are also enabled in your Braintree account. "
|
46 |
"Need help? See the %1$sdocumentation%2$s."
|
47 |
msgstr ""
|
48 |
|
49 |
+
#: class-wc-braintree.php:466
|
50 |
msgid ""
|
51 |
"PayPal powered by Braintree is almost ready. To get started, %1$sconnect "
|
52 |
"your Braintree account%2$s."
|
53 |
msgstr ""
|
54 |
|
55 |
+
#: class-wc-braintree.php:478
|
56 |
msgid ""
|
57 |
"Upgrade successful! WooCommerce Braintree deactivated, and PayPal Powered "
|
58 |
"by Braintree has been %1$sconfigured with your previous settings%2$s."
|
59 |
msgstr ""
|
60 |
|
61 |
+
#: class-wc-braintree.php:491
|
62 |
msgid ""
|
63 |
"WooCommerce is not being forced over SSL -- Using PayPal with Braintree "
|
64 |
"requires that checkout to be forced over SSL."
|
65 |
msgstr ""
|
66 |
|
67 |
+
#: class-wc-braintree.php:526
|
68 |
#. translators: Placeholders: %1$s - payment gateway name tag, %2$s - <a> tag,
|
69 |
#. %3$s - </a> tag
|
70 |
msgid ""
|
76 |
msgid "WooCommerce PayPal Powered by Braintree Gateway"
|
77 |
msgstr ""
|
78 |
|
79 |
+
#: class-wc-braintree.php:632
|
80 |
msgid "Configure Credit Card"
|
81 |
msgstr ""
|
82 |
|
83 |
+
#: class-wc-braintree.php:632
|
84 |
msgid "Configure PayPal"
|
85 |
msgstr ""
|
86 |
|
91 |
"method."
|
92 |
msgstr ""
|
93 |
|
94 |
+
#: includes/api/class-wc-braintree-api.php:198
|
95 |
msgid "The billing address for this transaction does not match the cardholders."
|
96 |
msgstr ""
|
97 |
|
98 |
+
#: includes/api/class-wc-braintree-api.php:202
|
99 |
msgid "The CSC for the transaction was invalid or incorrect."
|
100 |
msgstr ""
|
101 |
|
102 |
+
#: includes/api/class-wc-braintree-api.php:544
|
103 |
msgid ""
|
104 |
"Invalid Credentials, please double-check your API credentials (Merchant ID, "
|
105 |
"Public Key, Private Key, and Merchant Account ID) and try again."
|
106 |
msgstr ""
|
107 |
|
108 |
+
#: includes/api/class-wc-braintree-api.php:548
|
109 |
msgid ""
|
110 |
"Authorization Failed, please verify the user for the API credentials "
|
111 |
"provided can perform transactions and that the request data is correct."
|
112 |
msgstr ""
|
113 |
|
114 |
+
#: includes/api/class-wc-braintree-api.php:552
|
115 |
msgid "Braintree is currently down for maintenance, please try again later."
|
116 |
msgstr ""
|
117 |
|
118 |
+
#: includes/api/class-wc-braintree-api.php:556
|
119 |
msgid "The record cannot be found, please contact support."
|
120 |
msgstr ""
|
121 |
|
122 |
+
#: includes/api/class-wc-braintree-api.php:560
|
123 |
msgid ""
|
124 |
"Braintree encountered an error when processing your request, please try "
|
125 |
"again later or contact support."
|
126 |
msgstr ""
|
127 |
|
128 |
+
#: includes/api/class-wc-braintree-api.php:564
|
129 |
msgid ""
|
130 |
"Braintree cannot verify your server's SSL certificate. Please contact your "
|
131 |
"hosting provider or try again later."
|
139 |
msgid "Required PayPal token is missing or empty!"
|
140 |
msgstr ""
|
141 |
|
142 |
+
#: includes/class-wc-braintree-frontend.php:102
|
143 |
#. translators: %s - last four digits of a card/account
|
144 |
msgid "ending in %s"
|
145 |
msgstr ""
|
146 |
|
147 |
+
#: includes/class-wc-braintree-frontend.php:108
|
148 |
msgid "(default)"
|
149 |
msgstr ""
|
150 |
|
154 |
msgid "%1$s Account Saved: %2$s"
|
155 |
msgstr ""
|
156 |
|
157 |
+
#: includes/class-wc-braintree-paypal-cart.php:391
|
158 |
msgid "Cancel"
|
159 |
msgstr ""
|
160 |
|
161 |
+
#: includes/class-wc-gateway-braintree-credit-card.php:77
|
162 |
msgid "Braintree (Credit Card)"
|
163 |
msgstr ""
|
164 |
|
165 |
+
#: includes/class-wc-gateway-braintree-credit-card.php:78
|
166 |
msgid "Allow customers to securely pay using their credit card via Braintree."
|
167 |
msgstr ""
|
168 |
|
169 |
+
#: includes/class-wc-gateway-braintree-credit-card.php:180
|
170 |
msgid "Basic"
|
171 |
msgstr ""
|
172 |
|
173 |
+
#: includes/class-wc-gateway-braintree-credit-card.php:181
|
174 |
msgid "Advanced"
|
175 |
msgstr ""
|
176 |
|
177 |
+
#: includes/class-wc-gateway-braintree-credit-card.php:186
|
178 |
msgid "Kount Direct"
|
179 |
msgstr ""
|
180 |
|
181 |
+
#: includes/class-wc-gateway-braintree-credit-card.php:193
|
182 |
msgid "Fraud Settings"
|
183 |
msgstr ""
|
184 |
|
185 |
+
#: includes/class-wc-gateway-braintree-credit-card.php:197
|
186 |
msgid "Fraud Tool"
|
187 |
msgstr ""
|
188 |
|
189 |
+
#: includes/class-wc-gateway-braintree-credit-card.php:200
|
190 |
msgid ""
|
191 |
"Select the fraud tool you want to use. Basic is enabled by default and "
|
192 |
"requires no additional configuration. Advanced requires you to enable "
|
194 |
"you must contact Braintree support."
|
195 |
msgstr ""
|
196 |
|
197 |
+
#: includes/class-wc-gateway-braintree-credit-card.php:204
|
198 |
msgid "Kount merchant ID"
|
199 |
msgstr ""
|
200 |
|
201 |
+
#: includes/class-wc-gateway-braintree-credit-card.php:207
|
202 |
msgid "Speak with your account management team at Braintree to get this."
|
203 |
msgstr ""
|
204 |
|
205 |
+
#: includes/class-wc-gateway-braintree-credit-card.php:239
|
206 |
+
msgid "3D Secure"
|
207 |
msgstr ""
|
208 |
|
209 |
+
#: includes/class-wc-gateway-braintree-credit-card.php:241
|
210 |
msgid ""
|
211 |
"3D Secure benefits cardholders and merchants by providing an additional "
|
212 |
+
"layer of verification using Verified by Visa, MasterCard SecureCode, and "
|
213 |
+
"American Express SafeKey. %1$sLearn more about 3D Secure%2$s."
|
214 |
msgstr ""
|
215 |
|
216 |
+
#: includes/class-wc-gateway-braintree-credit-card.php:244
|
217 |
+
msgid "Level"
|
218 |
msgstr ""
|
219 |
|
220 |
+
#: includes/class-wc-gateway-braintree-credit-card.php:246
|
221 |
+
msgid "Only accept payments when the liability is shifted"
|
222 |
msgstr ""
|
223 |
|
224 |
+
#: includes/class-wc-gateway-braintree-credit-card.php:249
|
225 |
+
msgid "Standard"
|
|
|
|
|
226 |
msgstr ""
|
227 |
|
228 |
+
#: includes/class-wc-gateway-braintree-credit-card.php:250
|
229 |
+
msgid "Strict"
|
230 |
+
msgstr ""
|
231 |
+
|
232 |
+
#: includes/class-wc-gateway-braintree-credit-card.php:254
|
233 |
+
msgid "Supported Card Types"
|
234 |
+
msgstr ""
|
235 |
+
|
236 |
+
#: includes/class-wc-gateway-braintree-credit-card.php:257
|
237 |
+
msgid "3D Secure validation will only occur for these cards."
|
238 |
+
msgstr ""
|
239 |
+
|
240 |
+
#: includes/class-wc-gateway-braintree-credit-card.php:279
|
241 |
msgid "Card Verification (CSC)"
|
242 |
msgstr ""
|
243 |
|
244 |
+
#: includes/class-wc-gateway-braintree-credit-card.php:280
|
245 |
msgid "Display and Require the Card Security Code (CVV/CID) field on checkout"
|
246 |
msgstr ""
|
247 |
|
248 |
+
#: includes/class-wc-gateway-braintree-credit-card.php:926
|
249 |
+
#: includes/payment-forms/class-wc-braintree-hosted-fields-payment-form.php:139
|
250 |
msgid ""
|
251 |
"We cannot process your order with the payment information that you "
|
252 |
"provided. Please use an alternate payment method."
|
253 |
msgstr ""
|
254 |
|
255 |
+
#: includes/class-wc-gateway-braintree-credit-card.php:934
|
256 |
+
#: includes/class-wc-gateway-braintree.php:155
|
257 |
msgid ""
|
258 |
"Oops, there was a temporary payment error. Please try another payment "
|
259 |
"method or contact us to complete your transaction."
|
260 |
msgstr ""
|
261 |
|
262 |
+
#: includes/class-wc-gateway-braintree-paypal.php:68
|
263 |
msgid "Braintree (PayPal)"
|
264 |
msgstr ""
|
265 |
|
266 |
+
#: includes/class-wc-gateway-braintree-paypal.php:69
|
267 |
msgid "Allow customers to securely pay using their PayPal account via Braintree."
|
268 |
msgstr ""
|
269 |
|
270 |
+
#: includes/class-wc-gateway-braintree-paypal.php:150
|
271 |
msgid "Token ID"
|
272 |
msgstr ""
|
273 |
|
274 |
+
#: includes/class-wc-gateway-braintree-paypal.php:155
|
275 |
msgid "Email"
|
276 |
msgstr ""
|
277 |
|
278 |
+
#: includes/class-wc-gateway-braintree-paypal.php:194
|
279 |
msgid "Use a new PayPal account"
|
280 |
msgstr ""
|
281 |
|
282 |
+
#: includes/class-wc-gateway-braintree-paypal.php:198
|
283 |
msgid "PayPal Accounts"
|
284 |
msgstr ""
|
285 |
|
286 |
+
#: includes/class-wc-gateway-braintree-paypal.php:219
|
287 |
msgid "Unlink"
|
288 |
msgstr ""
|
289 |
|
290 |
+
#: includes/class-wc-gateway-braintree-paypal.php:241
|
291 |
+
msgid "Button Appearance"
|
292 |
+
msgstr ""
|
293 |
+
|
294 |
+
#: includes/class-wc-gateway-braintree-paypal.php:246
|
295 |
+
msgid "Button Color"
|
296 |
+
msgstr ""
|
297 |
+
|
298 |
+
#: includes/class-wc-gateway-braintree-paypal.php:248
|
299 |
+
msgid "Gold"
|
300 |
msgstr ""
|
301 |
|
302 |
#: includes/class-wc-gateway-braintree-paypal.php:249
|
303 |
+
msgid "Blue"
|
304 |
+
msgstr ""
|
305 |
+
|
306 |
+
#: includes/class-wc-gateway-braintree-paypal.php:250
|
307 |
+
msgid "Silver"
|
308 |
+
msgstr ""
|
309 |
+
|
310 |
+
#: includes/class-wc-gateway-braintree-paypal.php:251
|
311 |
+
msgid "White"
|
312 |
+
msgstr ""
|
313 |
+
|
314 |
+
#: includes/class-wc-gateway-braintree-paypal.php:252
|
315 |
+
msgid "Black"
|
316 |
+
msgstr ""
|
317 |
+
|
318 |
+
#: includes/class-wc-gateway-braintree-paypal.php:259
|
319 |
+
msgid "Button Size"
|
320 |
+
msgstr ""
|
321 |
+
|
322 |
+
#: includes/class-wc-gateway-braintree-paypal.php:261
|
323 |
+
msgid "Medium"
|
324 |
+
msgstr ""
|
325 |
+
|
326 |
+
#: includes/class-wc-gateway-braintree-paypal.php:262
|
327 |
+
msgid "Large"
|
328 |
+
msgstr ""
|
329 |
+
|
330 |
+
#: includes/class-wc-gateway-braintree-paypal.php:263
|
331 |
+
msgid "Responsive"
|
332 |
+
msgstr ""
|
333 |
+
|
334 |
+
#: includes/class-wc-gateway-braintree-paypal.php:270
|
335 |
+
msgid "Button Shape"
|
336 |
+
msgstr ""
|
337 |
+
|
338 |
+
#: includes/class-wc-gateway-braintree-paypal.php:279
|
339 |
+
msgid "PayPal Credit"
|
340 |
+
msgstr ""
|
341 |
+
|
342 |
+
#: includes/class-wc-gateway-braintree-paypal.php:282
|
343 |
+
msgid "Show the PayPal credit button beneath the standard PayPal button"
|
344 |
+
msgstr ""
|
345 |
+
|
346 |
+
#: includes/class-wc-gateway-braintree-paypal.php:283
|
347 |
+
msgid "Currently disabled because PayPal Credit is only available for US merchants"
|
348 |
+
msgstr ""
|
349 |
+
|
350 |
+
#: includes/class-wc-gateway-braintree-paypal.php:292
|
351 |
+
msgid "Enable Cart Checkout"
|
352 |
+
msgstr ""
|
353 |
+
|
354 |
+
#: includes/class-wc-gateway-braintree-paypal.php:294
|
355 |
msgid "Allow customers to check out with PayPal from the Cart page"
|
356 |
msgstr ""
|
357 |
|
358 |
+
#: includes/class-wc-gateway-braintree-paypal.php:373
|
359 |
+
msgid "Preview"
|
360 |
+
msgstr ""
|
361 |
+
|
362 |
+
#: includes/class-wc-gateway-braintree-paypal.php:497
|
363 |
#. translators: Placeholders: %1$s - payment method title (e.g. PayPal), %2$s -
|
364 |
#. transaction environment (either Sandbox or blank string), %3$s - type of
|
365 |
#. transaction (either Authorization or Payment)
|
366 |
msgid "%1$s %2$s %3$s Approved"
|
367 |
msgstr ""
|
368 |
|
369 |
+
#: includes/class-wc-gateway-braintree-paypal.php:499
|
370 |
+
#: includes/class-wc-gateway-braintree.php:1333
|
371 |
msgid "Sandbox"
|
372 |
msgstr ""
|
373 |
|
374 |
+
#: includes/class-wc-gateway-braintree-paypal.php:500
|
375 |
msgid "Authorization"
|
376 |
msgstr ""
|
377 |
|
378 |
+
#: includes/class-wc-gateway-braintree-paypal.php:500
|
379 |
msgid "Payment"
|
380 |
msgstr ""
|
381 |
|
382 |
+
#: includes/class-wc-gateway-braintree-paypal.php:506
|
383 |
#. translators: Placeholders: %s - transaction ID
|
384 |
msgid "(Transaction ID %s)"
|
385 |
msgstr ""
|
386 |
|
387 |
+
#: includes/class-wc-gateway-braintree-paypal.php:527
|
388 |
msgid "PayPal Account Saved: %s"
|
389 |
msgstr ""
|
390 |
|
391 |
+
#: includes/class-wc-gateway-braintree-paypal.php:606
|
392 |
msgid "PayPal"
|
393 |
msgstr ""
|
394 |
|
395 |
+
#: includes/class-wc-gateway-braintree-paypal.php:620
|
396 |
msgid ""
|
397 |
"Click the PayPal icon below to sign into your PayPal account and pay "
|
398 |
"securely."
|
399 |
msgstr ""
|
400 |
|
401 |
+
#: includes/class-wc-gateway-braintree.php:324
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
402 |
msgid "Public Key"
|
403 |
msgstr ""
|
404 |
|
405 |
+
#: includes/class-wc-gateway-braintree.php:327
|
406 |
msgid "The Public Key for your Braintree account."
|
407 |
msgstr ""
|
408 |
|
409 |
+
#: includes/class-wc-gateway-braintree.php:331
|
410 |
msgid "Private Key"
|
411 |
msgstr ""
|
412 |
|
413 |
+
#: includes/class-wc-gateway-braintree.php:334
|
414 |
msgid "The Private Key for your Braintree account."
|
415 |
msgstr ""
|
416 |
|
417 |
+
#: includes/class-wc-gateway-braintree.php:338
|
418 |
msgid "Merchant ID"
|
419 |
msgstr ""
|
420 |
|
421 |
+
#: includes/class-wc-gateway-braintree.php:341
|
422 |
msgid "The Merchant ID for your Braintree account."
|
423 |
msgstr ""
|
424 |
|
425 |
+
#: includes/class-wc-gateway-braintree.php:346
|
426 |
msgid "Sandbox Public Key"
|
427 |
msgstr ""
|
428 |
|
429 |
+
#: includes/class-wc-gateway-braintree.php:349
|
430 |
msgid "The Public Key for your Braintree sandbox account."
|
431 |
msgstr ""
|
432 |
|
433 |
+
#: includes/class-wc-gateway-braintree.php:353
|
434 |
msgid "Sandbox Private Key"
|
435 |
msgstr ""
|
436 |
|
437 |
+
#: includes/class-wc-gateway-braintree.php:356
|
438 |
msgid "The Private Key for your Braintree sandbox account."
|
439 |
msgstr ""
|
440 |
|
441 |
+
#: includes/class-wc-gateway-braintree.php:360
|
442 |
msgid "Sandbox Merchant ID"
|
443 |
msgstr ""
|
444 |
|
445 |
+
#: includes/class-wc-gateway-braintree.php:363
|
446 |
msgid "The Merchant ID for your Braintree sandbox account."
|
447 |
msgstr ""
|
448 |
|
449 |
+
#: includes/class-wc-gateway-braintree.php:368
|
450 |
msgid "Merchant Account IDs"
|
451 |
msgstr ""
|
452 |
|
453 |
+
#: includes/class-wc-gateway-braintree.php:371
|
454 |
msgid ""
|
455 |
"Enter additional merchant account IDs if you do not want to use your "
|
456 |
"Braintree account default. %1$sLearn more about merchant account IDs%2$s"
|
457 |
msgstr ""
|
458 |
|
459 |
+
#: includes/class-wc-gateway-braintree.php:380
|
460 |
msgid "Dynamic Descriptors"
|
461 |
msgstr ""
|
462 |
|
463 |
+
#: includes/class-wc-gateway-braintree.php:383
|
464 |
#. translators: Placeholders: %1$s - <p> tag, %2$s - </p> tag, %3$s - <a> tag,
|
465 |
#. %4$s - </a> tag
|
466 |
msgid ""
|
470 |
"dynamic descriptors%4$s and are using an accepted format.%2$s"
|
471 |
msgstr ""
|
472 |
|
473 |
+
#: includes/class-wc-gateway-braintree.php:387
|
474 |
msgid "Name"
|
475 |
msgstr ""
|
476 |
|
477 |
+
#: includes/class-wc-gateway-braintree.php:390
|
478 |
msgid ""
|
479 |
"The value in the business name field of a customer's statement. Company "
|
480 |
"name/DBA section must be either 3, 7 or 12 characters and the product "
|
482 |
"between for a total descriptor name of 22 characters)."
|
483 |
msgstr ""
|
484 |
|
485 |
+
#: includes/class-wc-gateway-braintree.php:395
|
486 |
msgid "Phone"
|
487 |
msgstr ""
|
488 |
|
489 |
+
#: includes/class-wc-gateway-braintree.php:398
|
490 |
msgid ""
|
491 |
"The value in the phone number field of a customer's statement. Phone must "
|
492 |
"be exactly 10 characters and can only contain numbers, dashes, parentheses "
|
493 |
"and periods."
|
494 |
msgstr ""
|
495 |
|
496 |
+
#: includes/class-wc-gateway-braintree.php:403
|
497 |
msgid "URL"
|
498 |
msgstr ""
|
499 |
|
500 |
+
#: includes/class-wc-gateway-braintree.php:406
|
501 |
msgid ""
|
502 |
"The value in the URL/web address field of a customer's statement. The URL "
|
503 |
"must be 13 characters or less."
|
504 |
msgstr ""
|
505 |
|
506 |
+
#: includes/class-wc-gateway-braintree.php:439
|
507 |
msgid "Enter connection credentials manually"
|
508 |
msgstr ""
|
509 |
|
510 |
+
#: includes/class-wc-gateway-braintree.php:463
|
511 |
msgid "Disabled because the other gateway is not connected manually."
|
512 |
msgstr ""
|
513 |
|
514 |
+
#: includes/class-wc-gateway-braintree.php:482
|
515 |
msgid ""
|
516 |
"You just connected your Braintree account to WooCommerce. You can start "
|
517 |
"taking payments now."
|
518 |
msgstr ""
|
519 |
|
520 |
+
#: includes/class-wc-gateway-braintree.php:483
|
521 |
msgid ""
|
522 |
"Once you have processed a payment, PayPal will review your application for "
|
523 |
"final approval. Before you ship any goods make sure you have received a "
|
524 |
"final approval for your Braintree account."
|
525 |
msgstr ""
|
526 |
|
527 |
+
#: includes/class-wc-gateway-braintree.php:484
|
528 |
msgid "Questions? We are a phone call away: 1-855-489-0345."
|
529 |
msgstr ""
|
530 |
|
531 |
+
#: includes/class-wc-gateway-braintree.php:489
|
532 |
msgid "Click button to create an account with Braintree and start transacting."
|
533 |
msgstr ""
|
534 |
|
535 |
+
#: includes/class-wc-gateway-braintree.php:604
|
536 |
msgid "Add merchant account ID for %s"
|
537 |
msgstr ""
|
538 |
|
539 |
+
#: includes/class-wc-gateway-braintree.php:709
|
540 |
msgid "Add merchant account ID for "
|
541 |
msgstr ""
|
542 |
|
543 |
+
#: includes/class-wc-gateway-braintree.php:807
|
544 |
msgid "Merchant Account ID (%s)"
|
545 |
msgstr ""
|
546 |
|
547 |
+
#: includes/class-wc-gateway-braintree.php:818
|
548 |
msgid "Enter merchant account ID"
|
549 |
msgstr ""
|
550 |
|
551 |
+
#: includes/class-wc-gateway-braintree.php:819
|
552 |
msgid "Remove this merchant account ID"
|
553 |
msgstr ""
|
554 |
|
555 |
+
#: includes/class-wc-gateway-braintree.php:1333
|
556 |
msgid "Production"
|
557 |
msgstr ""
|
558 |
|
559 |
+
#: includes/payment-forms/abstract-wc-braintree-payment-form.php:94
|
560 |
+
msgid "Currently unavailable. Please try a different payment method."
|
561 |
+
msgstr ""
|
562 |
+
|
563 |
+
#: includes/payment-forms/abstract-wc-braintree-payment-form.php:95
|
564 |
+
msgid "Oops, something went wrong. Please try a different payment method."
|
565 |
+
msgstr ""
|
566 |
+
|
567 |
+
#: includes/payment-forms/class-wc-braintree-hosted-fields-payment-form.php:86
|
568 |
msgid "Expiration (MMYY)"
|
569 |
msgstr ""
|
570 |
|
571 |
+
#: includes/payment-forms/class-wc-braintree-paypal-payment-form.php:82
|
572 |
msgid ""
|
573 |
"Please click the \"PayPal\" button below to log into your PayPal account "
|
574 |
"before placing your order."
|
575 |
msgstr ""
|
576 |
|
577 |
+
#: includes/payment-forms/class-wc-braintree-paypal-payment-form.php:83
|
578 |
msgid ""
|
579 |
"Please click the \"PayPal\" button below to log into your PayPal account "
|
580 |
"before adding your payment method."
|
625 |
msgid "http://woocommerce.com/"
|
626 |
msgstr ""
|
627 |
|
628 |
+
#: includes/class-wc-braintree-frontend.php:53
|
629 |
msgctxt "Payment Method Type"
|
630 |
msgid "Type"
|
631 |
+
msgstr ""
|
632 |
+
|
633 |
+
#: includes/class-wc-gateway-braintree-paypal.php:272
|
634 |
+
msgctxt "button shape option"
|
635 |
+
msgid "Pill"
|
636 |
+
msgstr ""
|
637 |
+
|
638 |
+
#: includes/class-wc-gateway-braintree-paypal.php:273
|
639 |
+
msgctxt "button shape option"
|
640 |
+
msgid "Rectangle"
|
641 |
msgstr ""
|
includes/api/class-wc-braintree-api-response-message-helper.php
CHANGED
@@ -22,7 +22,7 @@
|
|
22 |
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
|
23 |
*/
|
24 |
|
25 |
-
use \
|
26 |
|
27 |
defined( 'ABSPATH' ) or exit;
|
28 |
|
22 |
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
|
23 |
*/
|
24 |
|
25 |
+
use WC_Braintree\Plugin_Framework as WC_Braintree_Framework;
|
26 |
|
27 |
defined( 'ABSPATH' ) or exit;
|
28 |
|
includes/api/class-wc-braintree-api.php
CHANGED
@@ -22,7 +22,7 @@
|
|
22 |
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
|
23 |
*/
|
24 |
|
25 |
-
use \
|
26 |
|
27 |
defined( 'ABSPATH' ) or exit;
|
28 |
|
@@ -68,6 +68,29 @@ class WC_Braintree_API extends WC_Braintree_Framework\SV_WC_API_Base implements
|
|
68 |
/** API Methods ***********************************************************/
|
69 |
|
70 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
71 |
/**
|
72 |
* Get a client token for initializing the hosted fields or PayPal forms
|
73 |
*
|
@@ -333,6 +356,19 @@ class WC_Braintree_API extends WC_Braintree_Framework\SV_WC_API_Base implements
|
|
333 |
}
|
334 |
|
335 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
336 |
/**
|
337 |
* Remove the given tokenized payment method for the customer
|
338 |
*
|
@@ -383,7 +419,7 @@ class WC_Braintree_API extends WC_Braintree_Framework\SV_WC_API_Base implements
|
|
383 |
* @since 3.0.0
|
384 |
* @param string $nonce payment nonce
|
385 |
* @return \WC_Braintree_API_Payment_Method_Nonce_Response
|
386 |
-
* @throws \
|
387 |
*/
|
388 |
public function get_payment_method_from_nonce( $nonce ) {
|
389 |
|
@@ -402,7 +438,7 @@ class WC_Braintree_API extends WC_Braintree_Framework\SV_WC_API_Base implements
|
|
402 |
* @since 3.0.0
|
403 |
* @param string $token payment method token ID
|
404 |
* @return \WC_Braintree_API_Payment_Method_Nonce_Response
|
405 |
-
* @throws \
|
406 |
*/
|
407 |
public function get_nonce_from_payment_token( $token ) {
|
408 |
|
22 |
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
|
23 |
*/
|
24 |
|
25 |
+
use WC_Braintree\Plugin_Framework as WC_Braintree_Framework;
|
26 |
|
27 |
defined( 'ABSPATH' ) or exit;
|
28 |
|
68 |
/** API Methods ***********************************************************/
|
69 |
|
70 |
|
71 |
+
/**
|
72 |
+
* Gets the merchant account configuration.
|
73 |
+
*
|
74 |
+
* @since 2.2.0
|
75 |
+
*
|
76 |
+
* @return WC_Braintree_API_Merchant_Configuration_Response
|
77 |
+
* @throws WC_Braintree_Framework\SV_WC_API_Exception
|
78 |
+
*/
|
79 |
+
public function get_merchant_configuration() {
|
80 |
+
|
81 |
+
$response = $this->get_client_token( [ 'merchantAccountId' => '' ] );
|
82 |
+
|
83 |
+
$data = base64_decode( $response->get_client_token() );
|
84 |
+
|
85 |
+
// sanity check that the client key has valid JSON to decode
|
86 |
+
if ( ! json_decode( $data ) ) {
|
87 |
+
throw new WC_Braintree_Framework\SV_WC_API_Exception( 'The client key contained invalid JSON.', 500 );
|
88 |
+
}
|
89 |
+
|
90 |
+
return new WC_Braintree_API_Merchant_Configuration_Response( $data );
|
91 |
+
}
|
92 |
+
|
93 |
+
|
94 |
/**
|
95 |
* Get a client token for initializing the hosted fields or PayPal forms
|
96 |
*
|
356 |
}
|
357 |
|
358 |
|
359 |
+
/**
|
360 |
+
* Determines whether updating tokenized methods is supported.
|
361 |
+
*
|
362 |
+
* @since 2.2.0
|
363 |
+
*
|
364 |
+
* @return bool
|
365 |
+
*/
|
366 |
+
public function supports_update_tokenized_payment_method() {
|
367 |
+
|
368 |
+
return false;
|
369 |
+
}
|
370 |
+
|
371 |
+
|
372 |
/**
|
373 |
* Remove the given tokenized payment method for the customer
|
374 |
*
|
419 |
* @since 3.0.0
|
420 |
* @param string $nonce payment nonce
|
421 |
* @return \WC_Braintree_API_Payment_Method_Nonce_Response
|
422 |
+
* @throws WC_Braintree_Framework\SV_WC_Plugin_Exception
|
423 |
*/
|
424 |
public function get_payment_method_from_nonce( $nonce ) {
|
425 |
|
438 |
* @since 3.0.0
|
439 |
* @param string $token payment method token ID
|
440 |
* @return \WC_Braintree_API_Payment_Method_Nonce_Response
|
441 |
+
* @throws WC_Braintree_Framework\SV_WC_Plugin_Exception
|
442 |
*/
|
443 |
public function get_nonce_from_payment_token( $token ) {
|
444 |
|
includes/api/requests/abstract-wc-braintree-api-request.php
CHANGED
@@ -22,7 +22,7 @@
|
|
22 |
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
|
23 |
*/
|
24 |
|
25 |
-
use \
|
26 |
|
27 |
defined( 'ABSPATH' ) or exit;
|
28 |
|
@@ -123,11 +123,11 @@ abstract class WC_Braintree_API_Request implements WC_Braintree_Framework\SV_WC_
|
|
123 |
case 'submitForSettlement':
|
124 |
case 'refund':
|
125 |
case 'update':
|
126 |
-
return $this->
|
127 |
|
128 |
// all others use a single callback param
|
129 |
default:
|
130 |
-
return array( $this->
|
131 |
}
|
132 |
}
|
133 |
|
@@ -140,7 +140,7 @@ abstract class WC_Braintree_API_Request implements WC_Braintree_Framework\SV_WC_
|
|
140 |
*/
|
141 |
public function to_string() {
|
142 |
|
143 |
-
return print_r( $this->
|
144 |
}
|
145 |
|
146 |
|
@@ -159,13 +159,13 @@ abstract class WC_Braintree_API_Request implements WC_Braintree_Framework\SV_WC_
|
|
159 |
|
160 |
|
161 |
/**
|
162 |
-
*
|
163 |
-
*
|
|
|
164 |
*
|
165 |
-
* @since 3.0.0
|
166 |
* @return array
|
167 |
*/
|
168 |
-
public function
|
169 |
|
170 |
/**
|
171 |
* Braintree API Request Data.
|
@@ -173,6 +173,7 @@ abstract class WC_Braintree_API_Request implements WC_Braintree_Framework\SV_WC_
|
|
173 |
* Allow actors to modify the request data before it's sent to Braintree
|
174 |
*
|
175 |
* @since 3.0.0
|
|
|
176 |
* @param array|mixed $data request data to be filtered
|
177 |
* @param \WC_Order $order order instance
|
178 |
* @param \WC_Braintree_API_Request $this, API request class instance
|
@@ -185,6 +186,23 @@ abstract class WC_Braintree_API_Request implements WC_Braintree_Framework\SV_WC_
|
|
185 |
}
|
186 |
|
187 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
188 |
/**
|
189 |
* Remove null or blank string values from the request data (up to 2 levels deep)
|
190 |
*
|
@@ -265,4 +283,17 @@ abstract class WC_Braintree_API_Request implements WC_Braintree_Framework\SV_WC_
|
|
265 |
public function get_path() { }
|
266 |
|
267 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
268 |
}
|
22 |
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
|
23 |
*/
|
24 |
|
25 |
+
use WC_Braintree\Plugin_Framework as WC_Braintree_Framework;
|
26 |
|
27 |
defined( 'ABSPATH' ) or exit;
|
28 |
|
123 |
case 'submitForSettlement':
|
124 |
case 'refund':
|
125 |
case 'update':
|
126 |
+
return $this->get_data();
|
127 |
|
128 |
// all others use a single callback param
|
129 |
default:
|
130 |
+
return array( $this->get_data() );
|
131 |
}
|
132 |
}
|
133 |
|
140 |
*/
|
141 |
public function to_string() {
|
142 |
|
143 |
+
return print_r( $this->get_data(), true );
|
144 |
}
|
145 |
|
146 |
|
159 |
|
160 |
|
161 |
/**
|
162 |
+
* Gets the request data.
|
163 |
+
*
|
164 |
+
* @since 2.2.0
|
165 |
*
|
|
|
166 |
* @return array
|
167 |
*/
|
168 |
+
public function get_data() {
|
169 |
|
170 |
/**
|
171 |
* Braintree API Request Data.
|
173 |
* Allow actors to modify the request data before it's sent to Braintree
|
174 |
*
|
175 |
* @since 3.0.0
|
176 |
+
*
|
177 |
* @param array|mixed $data request data to be filtered
|
178 |
* @param \WC_Order $order order instance
|
179 |
* @param \WC_Braintree_API_Request $this, API request class instance
|
186 |
}
|
187 |
|
188 |
|
189 |
+
/**
|
190 |
+
* Get the request data which is the 1st parameter passed to the static callback
|
191 |
+
* set
|
192 |
+
*
|
193 |
+
* @since 3.0.0
|
194 |
+
* @deprecated 2.2.0
|
195 |
+
*
|
196 |
+
* @return array
|
197 |
+
*/
|
198 |
+
public function get_request_data() {
|
199 |
+
|
200 |
+
WC_Braintree_Framework\SV_WC_Plugin_Compatibility::wc_deprecated_function( __FUNCTION__, '2.2.0', 'WC_Braintree_API_Request::get_data' );
|
201 |
+
|
202 |
+
return $this->get_data();
|
203 |
+
}
|
204 |
+
|
205 |
+
|
206 |
/**
|
207 |
* Remove null or blank string values from the request data (up to 2 levels deep)
|
208 |
*
|
283 |
public function get_path() { }
|
284 |
|
285 |
|
286 |
+
/**
|
287 |
+
* Braintree requests do not require any query params.
|
288 |
+
*
|
289 |
+
* @since 2.2.0
|
290 |
+
*
|
291 |
+
* @return array
|
292 |
+
*/
|
293 |
+
public function get_params() {
|
294 |
+
|
295 |
+
return array();
|
296 |
+
}
|
297 |
+
|
298 |
+
|
299 |
}
|
includes/api/requests/class-wc-braintree-api-customer-request.php
CHANGED
@@ -22,7 +22,7 @@
|
|
22 |
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
|
23 |
*/
|
24 |
|
25 |
-
use \
|
26 |
|
27 |
defined( 'ABSPATH' ) or exit;
|
28 |
|
22 |
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
|
23 |
*/
|
24 |
|
25 |
+
use WC_Braintree\Plugin_Framework as WC_Braintree_Framework;
|
26 |
|
27 |
defined( 'ABSPATH' ) or exit;
|
28 |
|
includes/api/requests/class-wc-braintree-api-payment-method-request.php
CHANGED
@@ -104,6 +104,10 @@ class WC_Braintree_API_Payment_Method_Request extends WC_Braintree_API_Vault_Req
|
|
104 |
),
|
105 |
);
|
106 |
|
|
|
|
|
|
|
|
|
107 |
$this->request_data = array( $token, $update_data );
|
108 |
}
|
109 |
|
104 |
),
|
105 |
);
|
106 |
|
107 |
+
$update_data['billingAddress']['options'] = array(
|
108 |
+
'updateExisting' => true,
|
109 |
+
);
|
110 |
+
|
111 |
$this->request_data = array( $token, $update_data );
|
112 |
}
|
113 |
|
includes/api/requests/class-wc-braintree-api-transaction-request.php
CHANGED
@@ -22,7 +22,7 @@
|
|
22 |
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
|
23 |
*/
|
24 |
|
25 |
-
use \
|
26 |
|
27 |
defined( 'ABSPATH' ) or exit;
|
28 |
|
22 |
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
|
23 |
*/
|
24 |
|
25 |
+
use WC_Braintree\Plugin_Framework as WC_Braintree_Framework;
|
26 |
|
27 |
defined( 'ABSPATH' ) or exit;
|
28 |
|
includes/api/responses/abstract-wc-braintree-api-response.php
CHANGED
@@ -22,7 +22,7 @@
|
|
22 |
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
|
23 |
*/
|
24 |
|
25 |
-
use \
|
26 |
|
27 |
defined( 'ABSPATH' ) or exit;
|
28 |
|
22 |
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
|
23 |
*/
|
24 |
|
25 |
+
use WC_Braintree\Plugin_Framework as WC_Braintree_Framework;
|
26 |
|
27 |
defined( 'ABSPATH' ) or exit;
|
28 |
|
includes/api/responses/abstract-wc-braintree-api-transaction-response.php
CHANGED
@@ -22,7 +22,7 @@
|
|
22 |
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
|
23 |
*/
|
24 |
|
25 |
-
use \
|
26 |
|
27 |
defined( 'ABSPATH' ) or exit;
|
28 |
|
22 |
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
|
23 |
*/
|
24 |
|
25 |
+
use WC_Braintree\Plugin_Framework as WC_Braintree_Framework;
|
26 |
|
27 |
defined( 'ABSPATH' ) or exit;
|
28 |
|
includes/api/responses/abstract-wc-braintree-api-vault-response.php
CHANGED
@@ -22,7 +22,7 @@
|
|
22 |
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
|
23 |
*/
|
24 |
|
25 |
-
use \
|
26 |
|
27 |
defined( 'ABSPATH' ) or exit;
|
28 |
|
22 |
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
|
23 |
*/
|
24 |
|
25 |
+
use WC_Braintree\Plugin_Framework as WC_Braintree_Framework;
|
26 |
|
27 |
defined( 'ABSPATH' ) or exit;
|
28 |
|
includes/api/responses/class-wc-braintree-api-client-token-response.php
CHANGED
@@ -22,7 +22,7 @@
|
|
22 |
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
|
23 |
*/
|
24 |
|
25 |
-
use \
|
26 |
|
27 |
defined( 'ABSPATH' ) or exit;
|
28 |
|
22 |
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
|
23 |
*/
|
24 |
|
25 |
+
use WC_Braintree\Plugin_Framework as WC_Braintree_Framework;
|
26 |
|
27 |
defined( 'ABSPATH' ) or exit;
|
28 |
|
includes/api/responses/class-wc-braintree-api-credit-card-transaction-response.php
CHANGED
@@ -22,7 +22,7 @@
|
|
22 |
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
|
23 |
*/
|
24 |
|
25 |
-
use \
|
26 |
|
27 |
defined( 'ABSPATH' ) or exit;
|
28 |
|
22 |
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
|
23 |
*/
|
24 |
|
25 |
+
use WC_Braintree\Plugin_Framework as WC_Braintree_Framework;
|
26 |
|
27 |
defined( 'ABSPATH' ) or exit;
|
28 |
|
includes/api/responses/class-wc-braintree-api-customer-response.php
CHANGED
@@ -22,7 +22,7 @@
|
|
22 |
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
|
23 |
*/
|
24 |
|
25 |
-
use \
|
26 |
|
27 |
defined( 'ABSPATH' ) or exit;
|
28 |
|
22 |
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
|
23 |
*/
|
24 |
|
25 |
+
use WC_Braintree\Plugin_Framework as WC_Braintree_Framework;
|
26 |
|
27 |
defined( 'ABSPATH' ) or exit;
|
28 |
|
includes/api/responses/class-wc-braintree-api-merchant-configuration-response.php
ADDED
@@ -0,0 +1,54 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* WooCommerce Braintree Gateway
|
4 |
+
*
|
5 |
+
* This source file is subject to the GNU General Public License v3.0
|
6 |
+
* that is bundled with this package in the file license.txt.
|
7 |
+
* It is also available through the world-wide-web at this URL:
|
8 |
+
* http://www.gnu.org/licenses/gpl-3.0.html
|
9 |
+
* If you did not receive a copy of the license and are unable to
|
10 |
+
* obtain it through the world-wide-web, please send an email
|
11 |
+
* to license@woocommerce.com so we can send you a copy immediately.
|
12 |
+
*
|
13 |
+
* DISCLAIMER
|
14 |
+
*
|
15 |
+
* Do not edit or add to this file if you wish to upgrade WooCommerce Braintree Gateway to newer
|
16 |
+
* versions in the future. If you wish to customize WooCommerce Braintree Gateway for your
|
17 |
+
* needs please refer to http://docs.woocommerce.com/document/braintree/
|
18 |
+
*
|
19 |
+
* @package WC-Braintree/Gateway/API/Requests/Client-Token
|
20 |
+
* @author WooCommerce
|
21 |
+
* @copyright Copyright: (c) 2016-2018, Automattic, Inc.
|
22 |
+
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
|
23 |
+
*/
|
24 |
+
|
25 |
+
use WC_Braintree\Plugin_Framework as Framework;
|
26 |
+
|
27 |
+
defined( 'ABSPATH' ) or exit;
|
28 |
+
|
29 |
+
/**
|
30 |
+
* Braintree API Merchant configuration response.
|
31 |
+
*
|
32 |
+
* This is always preceded by a client token request, as that contains all of the information necessary for the
|
33 |
+
* merchant account.
|
34 |
+
*
|
35 |
+
* @since 2.2.0
|
36 |
+
*/
|
37 |
+
class WC_Braintree_API_Merchant_Configuration_Response extends Framework\SV_WC_API_JSON_Response {
|
38 |
+
|
39 |
+
|
40 |
+
/**
|
41 |
+
* Determines if 3D Secure is enabled for the merchant account.
|
42 |
+
*
|
43 |
+
* @since 2.2.0
|
44 |
+
*
|
45 |
+
* @return bool
|
46 |
+
*/
|
47 |
+
public function is_3d_secure_enabled() {
|
48 |
+
|
49 |
+
return (bool) $this->threeDSecureEnabled;
|
50 |
+
}
|
51 |
+
|
52 |
+
|
53 |
+
// TODO: we should be able to check for PayPal & Apple Pay too
|
54 |
+
}
|
includes/api/responses/class-wc-braintree-api-payment-method-nonce-response.php
CHANGED
@@ -44,7 +44,9 @@ class WC_Braintree_API_Payment_Method_Nonce_Response extends WC_Braintree_API_Re
|
|
44 |
*/
|
45 |
public function get_nonce() {
|
46 |
|
47 |
-
|
|
|
|
|
48 |
}
|
49 |
|
50 |
|
@@ -56,7 +58,9 @@ class WC_Braintree_API_Payment_Method_Nonce_Response extends WC_Braintree_API_Re
|
|
56 |
*/
|
57 |
public function has_3d_secure_info() {
|
58 |
|
59 |
-
|
|
|
|
|
60 |
}
|
61 |
|
62 |
|
@@ -70,7 +74,7 @@ class WC_Braintree_API_Payment_Method_Nonce_Response extends WC_Braintree_API_Re
|
|
70 |
*/
|
71 |
public function get_3d_secure_status() {
|
72 |
|
73 |
-
return $this->has_3d_secure_info() ? $this->
|
74 |
}
|
75 |
|
76 |
|
@@ -84,7 +88,7 @@ class WC_Braintree_API_Payment_Method_Nonce_Response extends WC_Braintree_API_Re
|
|
84 |
*/
|
85 |
public function get_3d_secure_liability_shifted() {
|
86 |
|
87 |
-
return $this->has_3d_secure_info() ? $this->
|
88 |
}
|
89 |
|
90 |
|
@@ -98,7 +102,7 @@ class WC_Braintree_API_Payment_Method_Nonce_Response extends WC_Braintree_API_Re
|
|
98 |
*/
|
99 |
public function get_3d_secure_liability_shift_possible() {
|
100 |
|
101 |
-
return $this->has_3d_secure_info() ? $this->
|
102 |
}
|
103 |
|
104 |
|
@@ -112,7 +116,23 @@ class WC_Braintree_API_Payment_Method_Nonce_Response extends WC_Braintree_API_Re
|
|
112 |
*/
|
113 |
public function get_3d_secure_enrollment() {
|
114 |
|
115 |
-
return $this->has_3d_secure_info() && 'Y' === $this->
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
116 |
}
|
117 |
|
118 |
|
44 |
*/
|
45 |
public function get_nonce() {
|
46 |
|
47 |
+
$payment_method = $this->get_payment_method();
|
48 |
+
|
49 |
+
return ! empty( $payment_method ) ? $payment_method->nonce : null;
|
50 |
}
|
51 |
|
52 |
|
58 |
*/
|
59 |
public function has_3d_secure_info() {
|
60 |
|
61 |
+
$payment_method = $this->get_payment_method();
|
62 |
+
|
63 |
+
return ! empty( $payment_method ) && ! empty( $payment_method->threeDSecureInfo );
|
64 |
}
|
65 |
|
66 |
|
74 |
*/
|
75 |
public function get_3d_secure_status() {
|
76 |
|
77 |
+
return $this->has_3d_secure_info() ? $this->get_payment_method()->threeDSecureInfo->status : null;
|
78 |
}
|
79 |
|
80 |
|
88 |
*/
|
89 |
public function get_3d_secure_liability_shifted() {
|
90 |
|
91 |
+
return $this->has_3d_secure_info() ? $this->get_payment_method()->threeDSecureInfo->liabilityShifted : null;
|
92 |
}
|
93 |
|
94 |
|
102 |
*/
|
103 |
public function get_3d_secure_liability_shift_possible() {
|
104 |
|
105 |
+
return $this->has_3d_secure_info() ? $this->get_payment_method()->threeDSecureInfo->liabilityShiftPossible : null;
|
106 |
}
|
107 |
|
108 |
|
116 |
*/
|
117 |
public function get_3d_secure_enrollment() {
|
118 |
|
119 |
+
return $this->has_3d_secure_info() && 'Y' === $this->get_payment_method()->threeDSecureInfo->enrolled;
|
120 |
+
}
|
121 |
+
|
122 |
+
|
123 |
+
/**
|
124 |
+
* Gets the payment method data.
|
125 |
+
*
|
126 |
+
* Some API requests will return the object directly, and others return it inside `paymentMethodNonce` so we need to
|
127 |
+
* check for that.
|
128 |
+
*
|
129 |
+
* @since 2.2.0
|
130 |
+
*
|
131 |
+
* @return object|null
|
132 |
+
*/
|
133 |
+
protected function get_payment_method() {
|
134 |
+
|
135 |
+
return isset( $this->response->paymentMethodNonce ) ? $this->response->paymentMethodNonce : $this->response;
|
136 |
}
|
137 |
|
138 |
|
includes/api/responses/class-wc-braintree-api-payment-method-response.php
CHANGED
@@ -22,7 +22,7 @@
|
|
22 |
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
|
23 |
*/
|
24 |
|
25 |
-
use \
|
26 |
|
27 |
defined( 'ABSPATH' ) or exit;
|
28 |
|
22 |
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
|
23 |
*/
|
24 |
|
25 |
+
use WC_Braintree\Plugin_Framework as WC_Braintree_Framework;
|
26 |
|
27 |
defined( 'ABSPATH' ) or exit;
|
28 |
|
includes/api/responses/class-wc-braintree-api-paypal-transaction-response.php
CHANGED
@@ -22,7 +22,7 @@
|
|
22 |
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
|
23 |
*/
|
24 |
|
25 |
-
use \
|
26 |
|
27 |
defined( 'ABSPATH' ) or exit;
|
28 |
|
22 |
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
|
23 |
*/
|
24 |
|
25 |
+
use WC_Braintree\Plugin_Framework as WC_Braintree_Framework;
|
26 |
|
27 |
defined( 'ABSPATH' ) or exit;
|
28 |
|
includes/apple-pay/api/class-wc-braintree-apple-pay-api-payment-response.php
ADDED
@@ -0,0 +1,52 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* WooCommerce Braintree Gateway
|
4 |
+
*
|
5 |
+
* This source file is subject to the GNU General Public License v3.0
|
6 |
+
* that is bundled with this package in the file license.txt.
|
7 |
+
* It is also available through the world-wide-web at this URL:
|
8 |
+
* http://www.gnu.org/licenses/gpl-3.0.html
|
9 |
+
* If you did not receive a copy of the license and are unable to
|
10 |
+
* obtain it through the world-wide-web, please send an email
|
11 |
+
* to license@woocommerce.com so we can send you a copy immediately.
|
12 |
+
*
|
13 |
+
* DISCLAIMER
|
14 |
+
*
|
15 |
+
* Do not edit or add to this file if you wish to upgrade WooCommerce Braintree Gateway to newer
|
16 |
+
* versions in the future. If you wish to customize WooCommerce Braintree Gateway for your
|
17 |
+
* needs please refer to http://docs.woocommerce.com/document/braintree/
|
18 |
+
*
|
19 |
+
* @package WC-Braintree/Gateway/Credit-Card
|
20 |
+
* @author WooCommerce
|
21 |
+
* @copyright Copyright: (c) 2016-2018, Automattic, Inc.
|
22 |
+
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
|
23 |
+
*/
|
24 |
+
|
25 |
+
namespace WC_Braintree\Apple_Pay\API;
|
26 |
+
|
27 |
+
use WC_Braintree\Plugin_Framework as WC_Braintree_Framework;
|
28 |
+
|
29 |
+
defined( 'ABSPATH' ) or exit;
|
30 |
+
|
31 |
+
/**
|
32 |
+
* The Braintree Apple Pay payment response class.
|
33 |
+
*
|
34 |
+
* @since 2.2.0
|
35 |
+
*/
|
36 |
+
class Payment_Response extends WC_Braintree_Framework\SV_WC_Payment_Gateway_Apple_Pay_Payment_Response {
|
37 |
+
|
38 |
+
|
39 |
+
/**
|
40 |
+
* Gets the associated Braintree nonce.
|
41 |
+
*
|
42 |
+
* @since 2.2.0
|
43 |
+
*
|
44 |
+
* @return string
|
45 |
+
*/
|
46 |
+
public function get_braintree_nonce() {
|
47 |
+
|
48 |
+
return (string) $this->braintree_nonce;
|
49 |
+
}
|
50 |
+
|
51 |
+
|
52 |
+
}
|
includes/apple-pay/class-wc-braintree-apple-pay-frontend.php
ADDED
@@ -0,0 +1,96 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* WooCommerce Braintree Gateway
|
4 |
+
*
|
5 |
+
* This source file is subject to the GNU General Public License v3.0
|
6 |
+
* that is bundled with this package in the file license.txt.
|
7 |
+
* It is also available through the world-wide-web at this URL:
|
8 |
+
* http://www.gnu.org/licenses/gpl-3.0.html
|
9 |
+
* If you did not receive a copy of the license and are unable to
|
10 |
+
* obtain it through the world-wide-web, please send an email
|
11 |
+
* to license@woocommerce.com so we can send you a copy immediately.
|
12 |
+
*
|
13 |
+
* DISCLAIMER
|
14 |
+
*
|
15 |
+
* Do not edit or add to this file if you wish to upgrade WooCommerce Braintree Gateway to newer
|
16 |
+
* versions in the future. If you wish to customize WooCommerce Braintree Gateway for your
|
17 |
+
* needs please refer to http://docs.woocommerce.com/document/braintree/
|
18 |
+
*
|
19 |
+
* @package WC-Braintree/Gateway/Credit-Card
|
20 |
+
* @author WooCommerce
|
21 |
+
* @copyright Copyright: (c) 2016-2018, Automattic, Inc.
|
22 |
+
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
|
23 |
+
*/
|
24 |
+
|
25 |
+
namespace WC_Braintree\Apple_Pay;
|
26 |
+
|
27 |
+
use WC_Braintree\Plugin_Framework as WC_Braintree_Framework;
|
28 |
+
|
29 |
+
defined( 'ABSPATH' ) or exit;
|
30 |
+
|
31 |
+
/**
|
32 |
+
* The Braintree Apple Pay frontend handler.
|
33 |
+
*
|
34 |
+
* @since 2.2.0
|
35 |
+
*/
|
36 |
+
class Frontend extends WC_Braintree_Framework\SV_WC_Payment_Gateway_Apple_Pay_Frontend {
|
37 |
+
|
38 |
+
|
39 |
+
/**
|
40 |
+
* Enqueues the scripts.
|
41 |
+
*
|
42 |
+
* @see WC_Braintree_Framework\SV_WC_Payment_Gateway_Apple_Pay_Frontend::enqueue_scripts()
|
43 |
+
*
|
44 |
+
* @since 2.2.0
|
45 |
+
*/
|
46 |
+
public function enqueue_scripts() {
|
47 |
+
|
48 |
+
parent::enqueue_scripts();
|
49 |
+
|
50 |
+
// braintree.js library
|
51 |
+
wp_enqueue_script( 'braintree-js-client', 'https://js.braintreegateway.com/web/' . \WC_Braintree::BRAINTREE_JS_SDK_VERSION . '/js/client.min.js', array(), \WC_Braintree::VERSION, true );
|
52 |
+
|
53 |
+
wp_enqueue_script( 'braintree-js-apple-pay', 'https://js.braintreegateway.com/web/' . \WC_Braintree::BRAINTREE_JS_SDK_VERSION . '/js/apple-pay.min.js', array( 'braintree-js-client' ), \WC_Braintree::VERSION, true );
|
54 |
+
|
55 |
+
wp_enqueue_script( 'wc-braintree-apple-pay-js', $this->get_plugin()->get_plugin_url() . '/assets/js/frontend/wc-braintree-apple-pay.min.js', array( 'jquery' ), $this->get_plugin()->get_version(), true );
|
56 |
+
}
|
57 |
+
|
58 |
+
|
59 |
+
/**
|
60 |
+
* Gets the JS handler name.
|
61 |
+
*
|
62 |
+
* Braintree requires its own JS handler that extends the FW implementation.
|
63 |
+
*
|
64 |
+
* @see WC_Braintree_Framework\SV_WC_Payment_Gateway_Apple_Pay_Frontend::get_js_handler_name()
|
65 |
+
*
|
66 |
+
* @since 2.2.0
|
67 |
+
*
|
68 |
+
* @return string
|
69 |
+
*/
|
70 |
+
protected function get_js_handler_name() {
|
71 |
+
|
72 |
+
return 'WC_Braintree_Apple_Pay_Handler';
|
73 |
+
}
|
74 |
+
|
75 |
+
|
76 |
+
/**
|
77 |
+
* Gets the parameters to be passed to the JS handler.
|
78 |
+
*
|
79 |
+
* @see WC_Braintree_Framework\SV_WC_Payment_Gateway_Apple_Pay_Frontend::get_js_handler_params()
|
80 |
+
*
|
81 |
+
* @since 2.2.0
|
82 |
+
*
|
83 |
+
* @return array
|
84 |
+
*/
|
85 |
+
protected function get_js_handler_params() {
|
86 |
+
|
87 |
+
$params = parent::get_js_handler_params();
|
88 |
+
|
89 |
+
$params['store_name'] = get_bloginfo( 'name' );
|
90 |
+
$params['client_token_nonce'] = wp_create_nonce( 'wc_' . $this->get_gateway()->get_id() . '_get_client_token' );
|
91 |
+
|
92 |
+
return $params;
|
93 |
+
}
|
94 |
+
|
95 |
+
|
96 |
+
}
|
includes/apple-pay/class-wc-braintree-apple-pay.php
ADDED
@@ -0,0 +1,118 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* WooCommerce Braintree Gateway
|
4 |
+
*
|
5 |
+
* This source file is subject to the GNU General Public License v3.0
|
6 |
+
* that is bundled with this package in the file license.txt.
|
7 |
+
* It is also available through the world-wide-web at this URL:
|
8 |
+
* http://www.gnu.org/licenses/gpl-3.0.html
|
9 |
+
* If you did not receive a copy of the license and are unable to
|
10 |
+
* obtain it through the world-wide-web, please send an email
|
11 |
+
* to license@woocommerce.com so we can send you a copy immediately.
|
12 |
+
*
|
13 |
+
* DISCLAIMER
|
14 |
+
*
|
15 |
+
* Do not edit or add to this file if you wish to upgrade WooCommerce Braintree Gateway to newer
|
16 |
+
* versions in the future. If you wish to customize WooCommerce Braintree Gateway for your
|
17 |
+
* needs please refer to http://docs.woocommerce.com/document/braintree/
|
18 |
+
*
|
19 |
+
* @package WC-Braintree/Gateway/Credit-Card
|
20 |
+
* @author WooCommerce
|
21 |
+
* @copyright Copyright: (c) 2016-2018, Automattic, Inc.
|
22 |
+
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
|
23 |
+
*/
|
24 |
+
|
25 |
+
namespace WC_Braintree;
|
26 |
+
|
27 |
+
use WC_Braintree\Plugin_Framework as WC_Braintree_Framework;
|
28 |
+
|
29 |
+
defined( 'ABSPATH' ) or exit;
|
30 |
+
|
31 |
+
/**
|
32 |
+
* The Braintree Apple Pay base handler.
|
33 |
+
*
|
34 |
+
* @since 2.2.0
|
35 |
+
*/
|
36 |
+
class Apple_Pay extends WC_Braintree_Framework\SV_WC_Payment_Gateway_Apple_Pay {
|
37 |
+
|
38 |
+
|
39 |
+
/**
|
40 |
+
* Initializes the frontend handler.
|
41 |
+
*
|
42 |
+
* @since 2.2.0
|
43 |
+
*/
|
44 |
+
protected function init_frontend() {
|
45 |
+
|
46 |
+
$this->frontend = new Apple_Pay\Frontend( $this->get_plugin(), $this );
|
47 |
+
}
|
48 |
+
|
49 |
+
|
50 |
+
/**
|
51 |
+
* Builds a new payment request.
|
52 |
+
*
|
53 |
+
* Overridden to remove some properties that are set by Braintree from account configuration.
|
54 |
+
*
|
55 |
+
* @since 2.2.0
|
56 |
+
*
|
57 |
+
* @param float|int $amount payment amount
|
58 |
+
* @param array $args payment args
|
59 |
+
* @return array
|
60 |
+
*/
|
61 |
+
public function build_payment_request( $amount, $args = array() ) {
|
62 |
+
|
63 |
+
$request = parent::build_payment_request( $amount, $args );
|
64 |
+
|
65 |
+
// these values are populated by the Braintree SDK
|
66 |
+
unset(
|
67 |
+
$request['currencyCode'],
|
68 |
+
$request['countryCode'],
|
69 |
+
$request['merchantCapabilities'],
|
70 |
+
$request['supportedNetworks']
|
71 |
+
);
|
72 |
+
|
73 |
+
return $request;
|
74 |
+
}
|
75 |
+
|
76 |
+
|
77 |
+
/**
|
78 |
+
* Builds a payment response object based on an array of data.
|
79 |
+
*
|
80 |
+
* @since 2.2.0
|
81 |
+
*
|
82 |
+
* @param string $data response data as a JSON string
|
83 |
+
*
|
84 |
+
* @return Apple_Pay\API\Payment_Response
|
85 |
+
*/
|
86 |
+
protected function build_payment_response( $data ) {
|
87 |
+
|
88 |
+
return new Apple_Pay\API\Payment_Response( $data );
|
89 |
+
}
|
90 |
+
|
91 |
+
|
92 |
+
/**
|
93 |
+
* Determines if a local Apple Pay certificate is required.
|
94 |
+
*
|
95 |
+
* @since 2.2.0
|
96 |
+
*
|
97 |
+
* @return bool
|
98 |
+
*/
|
99 |
+
public function requires_certificate() {
|
100 |
+
|
101 |
+
return false;
|
102 |
+
}
|
103 |
+
|
104 |
+
|
105 |
+
/**
|
106 |
+
* Determines if a merchant ID is required.
|
107 |
+
*
|
108 |
+
* @since 2.2.0
|
109 |
+
*
|
110 |
+
* @return bool
|
111 |
+
*/
|
112 |
+
public function requires_merchant_id() {
|
113 |
+
|
114 |
+
return false;
|
115 |
+
}
|
116 |
+
|
117 |
+
|
118 |
+
}
|
includes/class-wc-braintree-capture.php
ADDED
@@ -0,0 +1,82 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* WooCommerce Braintree Gateway
|
4 |
+
*
|
5 |
+
* This source file is subject to the GNU General Public License v3.0
|
6 |
+
* that is bundled with this package in the file license.txt.
|
7 |
+
* It is also available through the world-wide-web at this URL:
|
8 |
+
* http://www.gnu.org/licenses/gpl-3.0.html
|
9 |
+
* If you did not receive a copy of the license and are unable to
|
10 |
+
* obtain it through the world-wide-web, please send an email
|
11 |
+
* to license@woocommerce.com so we can send you a copy immediately.
|
12 |
+
*
|
13 |
+
* DISCLAIMER
|
14 |
+
*
|
15 |
+
* Do not edit or add to this file if you wish to upgrade WooCommerce Braintree Gateway to newer
|
16 |
+
* versions in the future. If you wish to customize WooCommerce Braintree Gateway for your
|
17 |
+
* needs please refer to http://docs.woocommerce.com/document/braintree/
|
18 |
+
*
|
19 |
+
* @package WC-Braintree/Gateway/Payment-Method
|
20 |
+
* @author WooCommerce
|
21 |
+
* @copyright Copyright: (c) 2016-2018, Automattic, Inc.
|
22 |
+
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
|
23 |
+
*/
|
24 |
+
|
25 |
+
namespace WC_Braintree;
|
26 |
+
|
27 |
+
use WC_Braintree\Plugin_Framework as WC_Braintree_Framework;
|
28 |
+
|
29 |
+
defined( 'ABSPATH' ) or exit;
|
30 |
+
|
31 |
+
/**
|
32 |
+
* The Braintree capture handler.
|
33 |
+
*
|
34 |
+
* @since 2.2.0
|
35 |
+
*/
|
36 |
+
class Capture extends WC_Braintree_Framework\Payment_Gateway\Handlers\Capture {
|
37 |
+
|
38 |
+
|
39 |
+
/**
|
40 |
+
* Determines if an order's authorization has expired.
|
41 |
+
*
|
42 |
+
* @since 2.2.0
|
43 |
+
*
|
44 |
+
* @param \WC_Order $order
|
45 |
+
* @return bool
|
46 |
+
*/
|
47 |
+
public function has_order_authorization_expired( \WC_Order $order ) {
|
48 |
+
|
49 |
+
if ( ! $this->get_gateway()->get_order_meta( $order, 'trans_id' ) ) {
|
50 |
+
$this->get_gateway()->update_order_meta( $order, 'trans_id', WC_Braintree_Framework\SV_WC_Order_Compatibility::get_prop( $order, 'transaction_id' ) );
|
51 |
+
}
|
52 |
+
|
53 |
+
$date_created = WC_Braintree_Framework\SV_WC_Order_Compatibility::get_date_created( $order );
|
54 |
+
|
55 |
+
if ( ! $this->get_gateway()->get_order_meta( $order, 'trans_date' ) && $date_created ) {
|
56 |
+
$this->get_gateway()->update_order_meta( $order, 'trans_date', $date_created->date( 'Y-m-d H:i:s' ) );
|
57 |
+
}
|
58 |
+
|
59 |
+
return parent::has_order_authorization_expired( $order );
|
60 |
+
}
|
61 |
+
|
62 |
+
|
63 |
+
/**
|
64 |
+
* Determines if an order is eligible for capture.
|
65 |
+
*
|
66 |
+
* @since 2.2.0
|
67 |
+
*
|
68 |
+
* @param \WC_Order $order order object
|
69 |
+
* @return bool
|
70 |
+
*/
|
71 |
+
public function order_can_be_captured( \WC_Order $order ) {
|
72 |
+
|
73 |
+
// if v1 never set the capture status, assume it has been captured
|
74 |
+
if ( ! in_array( $this->get_gateway()->get_order_meta( $order, 'charge_captured' ), array( 'yes', 'no' ), true ) ) {
|
75 |
+
$this->get_gateway()->update_order_meta( $order, 'charge_captured', 'yes' );
|
76 |
+
}
|
77 |
+
|
78 |
+
return parent::order_can_be_captured( $order );
|
79 |
+
}
|
80 |
+
|
81 |
+
|
82 |
+
}
|
includes/class-wc-braintree-frontend.php
CHANGED
@@ -37,24 +37,11 @@ defined( 'ABSPATH' ) or exit;
|
|
37 |
class WC_Braintree_Frontend {
|
38 |
|
39 |
|
40 |
-
/**
|
41 |
-
* WC_Braintree_Frontend constructor.
|
42 |
-
*
|
43 |
-
* @since 2.0.0
|
44 |
-
*/
|
45 |
-
public function __construct() {
|
46 |
-
|
47 |
-
// add hooks to modify the payment table output
|
48 |
-
add_filter( 'wc_braintree_my_payment_methods_table_headers', array( $this, 'modify_table_headers' ) );
|
49 |
-
add_filter( 'wc_braintree_my_payment_methods_table_body_row_data', array( $this, 'add_card_icon_cell' ), 10, 2 );
|
50 |
-
add_filter( 'wc_braintree_my_payment_methods_table_method_title', array( $this, 'remove_card_icon_from_title' ), 10, 2 );
|
51 |
-
}
|
52 |
-
|
53 |
-
|
54 |
/**
|
55 |
* Modifies the "My Payment Methods" table headers.
|
56 |
*
|
57 |
* @since 2.0.0
|
|
|
58 |
*
|
59 |
* @param string[] $headers the table headers
|
60 |
* @return string[] updated headers
|
@@ -74,6 +61,7 @@ class WC_Braintree_Frontend {
|
|
74 |
* Adds a new table cell for the card icon, e.g. an Amex logo.
|
75 |
*
|
76 |
* @since 2.0.0
|
|
|
77 |
*
|
78 |
* @param string[] $methods {
|
79 |
* @type string $title payment method title
|
@@ -96,6 +84,7 @@ class WC_Braintree_Frontend {
|
|
96 |
* Note: the textdomain is intentionally different here, which allows for existing framework translations to remain.
|
97 |
*
|
98 |
* @since 2.0.0
|
|
|
99 |
*
|
100 |
* @param string $html the method title html
|
101 |
* @param \SV_WC_Payment_Gateway_Payment_Token $token token
|
@@ -127,6 +116,7 @@ class WC_Braintree_Frontend {
|
|
127 |
* Get the payment method icon for a given token, e.g.: the Amex logo.
|
128 |
*
|
129 |
* @since 2.0.0
|
|
|
130 |
*
|
131 |
* @param \SV_WC_Payment_Gateway_Payment_Token $token token
|
132 |
* @return string payment method icon html
|
37 |
class WC_Braintree_Frontend {
|
38 |
|
39 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
40 |
/**
|
41 |
* Modifies the "My Payment Methods" table headers.
|
42 |
*
|
43 |
* @since 2.0.0
|
44 |
+
* @deprecated 2.2.0
|
45 |
*
|
46 |
* @param string[] $headers the table headers
|
47 |
* @return string[] updated headers
|
61 |
* Adds a new table cell for the card icon, e.g. an Amex logo.
|
62 |
*
|
63 |
* @since 2.0.0
|
64 |
+
* @deprecated 2.2.0
|
65 |
*
|
66 |
* @param string[] $methods {
|
67 |
* @type string $title payment method title
|
84 |
* Note: the textdomain is intentionally different here, which allows for existing framework translations to remain.
|
85 |
*
|
86 |
* @since 2.0.0
|
87 |
+
* @deprecated 2.2.0
|
88 |
*
|
89 |
* @param string $html the method title html
|
90 |
* @param \SV_WC_Payment_Gateway_Payment_Token $token token
|
116 |
* Get the payment method icon for a given token, e.g.: the Amex logo.
|
117 |
*
|
118 |
* @since 2.0.0
|
119 |
+
* @deprecated 2.2.0
|
120 |
*
|
121 |
* @param \SV_WC_Payment_Gateway_Payment_Token $token token
|
122 |
* @return string payment method icon html
|
includes/class-wc-braintree-lifecycle.php
ADDED
@@ -0,0 +1,292 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* WooCommerce Braintree Gateway
|
4 |
+
*
|
5 |
+
* This source file is subject to the GNU General Public License v3.0
|
6 |
+
* that is bundled with this package in the file license.txt.
|
7 |
+
* It is also available through the world-wide-web at this URL:
|
8 |
+
* http://www.gnu.org/licenses/gpl-3.0.html
|
9 |
+
* If you did not receive a copy of the license and are unable to
|
10 |
+
* obtain it through the world-wide-web, please send an email
|
11 |
+
* to license@woocommerce.com so we can send you a copy immediately.
|
12 |
+
*
|
13 |
+
* DISCLAIMER
|
14 |
+
*
|
15 |
+
* Do not edit or add to this file if you wish to upgrade WooCommerce Braintree Gateway to newer
|
16 |
+
* versions in the future. If you wish to customize WooCommerce Braintree Gateway for your
|
17 |
+
* needs please refer to http://docs.woocommerce.com/document/braintree/
|
18 |
+
*
|
19 |
+
* @package WC-Braintree/Gateway/Payment-Method
|
20 |
+
* @author WooCommerce
|
21 |
+
* @copyright Copyright: (c) 2016-2018, Automattic, Inc.
|
22 |
+
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
|
23 |
+
*/
|
24 |
+
|
25 |
+
namespace WC_Braintree;
|
26 |
+
|
27 |
+
use WC_Braintree\Plugin_Framework as WC_Braintree_Framework;
|
28 |
+
|
29 |
+
defined( 'ABSPATH' ) or exit;
|
30 |
+
|
31 |
+
/**
|
32 |
+
* The lifecycle handler class.
|
33 |
+
*
|
34 |
+
* @since 2.2.0
|
35 |
+
*
|
36 |
+
* @method \WC_Braintree get_plugin()
|
37 |
+
*/
|
38 |
+
class Lifecycle extends WC_Braintree_Framework\Plugin\Lifecycle {
|
39 |
+
|
40 |
+
|
41 |
+
/**
|
42 |
+
* Initializes the plugin lifecycle.
|
43 |
+
*
|
44 |
+
* @since 2.2.0
|
45 |
+
*/
|
46 |
+
public function init() {
|
47 |
+
|
48 |
+
$installed_version = $this->get_installed_version();
|
49 |
+
|
50 |
+
// if installing from the retired WooCommerce Braintree plugin (higher version number)
|
51 |
+
if ( version_compare( $installed_version, $this->get_plugin()->get_version(), '>' ) ) {
|
52 |
+
|
53 |
+
$this->migrate_from_sv();
|
54 |
+
|
55 |
+
// if upgrading from 1.x, which won't have a version number set
|
56 |
+
} elseif ( ! $installed_version && ( get_option( 'woocommerce_paypalbraintree_cards_settings' ) || get_option( 'wc_paypal_braintree_merchant_access_token' ) ) ) {
|
57 |
+
|
58 |
+
// set the version number
|
59 |
+
$this->set_installed_version( '1.2.7' );
|
60 |
+
}
|
61 |
+
|
62 |
+
parent::init();
|
63 |
+
}
|
64 |
+
|
65 |
+
|
66 |
+
/**
|
67 |
+
* Performs any upgrade tasks based on the provided installed version.
|
68 |
+
*
|
69 |
+
* @since 2.2.0
|
70 |
+
*
|
71 |
+
* @param string $installed_version currently installed version
|
72 |
+
*/
|
73 |
+
protected function upgrade( $installed_version ) {
|
74 |
+
|
75 |
+
// upgrade to 2.0.0
|
76 |
+
if ( version_compare( $installed_version, '2.0.0', '<' ) ) {
|
77 |
+
|
78 |
+
global $wpdb;
|
79 |
+
|
80 |
+
$this->get_plugin()->log( 'Starting upgrade to 2.0.0' );
|
81 |
+
|
82 |
+
$environment = ( 'sandbox' === get_option( 'wc_paypal_braintree_environment' ) ) ? \WC_Gateway_Braintree::ENVIRONMENT_SANDBOX : \WC_Gateway_Braintree::ENVIRONMENT_PRODUCTION;
|
83 |
+
$merchant_id = get_option( 'wc_paypal_braintree_merchant_id', '' );
|
84 |
+
|
85 |
+
// Begin settings upgrade
|
86 |
+
$this->get_plugin()->log( 'Upgrading settings' );
|
87 |
+
|
88 |
+
// we need to parse args here because it's possible that the legacy
|
89 |
+
// gateway was connected & processing payments but the settings were
|
90 |
+
// never saved.
|
91 |
+
$legacy_settings = wp_parse_args( get_option( 'woocommerce_paypalbraintree_cards_settings', array() ), array(
|
92 |
+
'enabled' => ( get_option( 'wc_paypal_braintree_merchant_access_token' ) ) ? 'yes' : 'no',
|
93 |
+
'capture' => 'yes',
|
94 |
+
'debug' => 'no',
|
95 |
+
'title_cards' => 'Credit Card',
|
96 |
+
'description_cards' => 'Pay securely using your credit card.',
|
97 |
+
'title_paypal' => 'PayPal',
|
98 |
+
'description_paypal' => 'Click the PayPal icon below to sign into your PayPal account and pay securely.',
|
99 |
+
) );
|
100 |
+
|
101 |
+
$common_settings = array(
|
102 |
+
'enabled' => $legacy_settings['enabled'],
|
103 |
+
'transaction_type' => ( 'yes' === $legacy_settings['capture'] ) ? \WC_Gateway_Braintree::TRANSACTION_TYPE_CHARGE : \WC_Gateway_Braintree::TRANSACTION_TYPE_AUTHORIZATION,
|
104 |
+
'tokenization' => 'yes',
|
105 |
+
'environment' => $environment,
|
106 |
+
'debug_mode' => ( 'yes' === $legacy_settings['debug'] ) ? \WC_Gateway_Braintree::DEBUG_MODE_LOG : \WC_Gateway_Braintree::DEBUG_MODE_OFF,
|
107 |
+
'connect_manually' => 'no',
|
108 |
+
'inherit_settings' => 'no',
|
109 |
+
);
|
110 |
+
|
111 |
+
if ( $environment === \WC_Gateway_Braintree::ENVIRONMENT_PRODUCTION ) {
|
112 |
+
$common_settings['merchant_id'] = $merchant_id;
|
113 |
+
} else {
|
114 |
+
$common_settings[ $environment . '_merchant_id'] = $merchant_id;
|
115 |
+
}
|
116 |
+
|
117 |
+
$credit_card_settings = array(
|
118 |
+
'title' => $legacy_settings['title_cards'],
|
119 |
+
'description' => $legacy_settings['description_cards'],
|
120 |
+
'require_csc' => 'yes', // no option to disable this in v1, so enable by default
|
121 |
+
'card_types' => array( 'VISA', 'MC', 'AMEX', 'DISC', 'DINERS', 'JCB', ),
|
122 |
+
);
|
123 |
+
|
124 |
+
update_option( 'woocommerce_braintree_credit_card_settings', array_merge( $common_settings, $credit_card_settings ) );
|
125 |
+
|
126 |
+
$paypal_settings = array(
|
127 |
+
'title' => $legacy_settings['title_paypal'],
|
128 |
+
'description' => $legacy_settings['description_paypal'],
|
129 |
+
);
|
130 |
+
|
131 |
+
update_option( 'woocommerce_braintree_paypal_settings', array_merge( $common_settings, $paypal_settings ) );
|
132 |
+
|
133 |
+
// the Braintree Auth options
|
134 |
+
$wpdb->update( $wpdb->options, array( 'option_name' => 'wc_braintree_auth_access_token' ), array( 'option_name' => 'wc_paypal_braintree_merchant_access_token' ) );
|
135 |
+
$wpdb->update( $wpdb->options, array( 'option_name' => 'wc_braintree_auth_environment' ), array( 'option_name' => 'wc_paypal_braintree_environment' ) );
|
136 |
+
$wpdb->update( $wpdb->options, array( 'option_name' => 'wc_braintree_auth_merchant_id' ), array( 'option_name' => 'wc_paypal_braintree_merchant_id' ) );
|
137 |
+
|
138 |
+
$this->get_plugin()->log( 'Settings upgraded' );
|
139 |
+
|
140 |
+
// update the legacy order & user meta
|
141 |
+
$this->update_legacy_meta();
|
142 |
+
|
143 |
+
// flush the options cache to ensure notices are displayed correctly
|
144 |
+
wp_cache_flush();
|
145 |
+
|
146 |
+
$this->get_plugin()->log( 'Completed upgrade for 2.0.0' );
|
147 |
+
|
148 |
+
} elseif ( version_compare( $installed_version, '2.0.1', '<' ) ) {
|
149 |
+
|
150 |
+
// update meta again for those that may be seeing the legacy migration issue from previous installs
|
151 |
+
$this->update_legacy_meta();
|
152 |
+
}
|
153 |
+
|
154 |
+
// upgrade to v2.0.2
|
155 |
+
if ( version_compare( $installed_version, '2.0.2', '<' ) ) {
|
156 |
+
|
157 |
+
$this->get_plugin()->log( 'Starting upgrade to 2.0.2' );
|
158 |
+
|
159 |
+
$cc_settings = get_option( 'woocommerce_braintree_credit_card_settings', array() );
|
160 |
+
|
161 |
+
// if the require CSC setting was never set, set it to avoid various false error notices
|
162 |
+
if ( ! empty( $cc_settings ) && empty( $cc_settings['require_csc'] ) ) {
|
163 |
+
|
164 |
+
$this->get_plugin()->log( 'Updating missing CSC setting' );
|
165 |
+
|
166 |
+
$cc_settings['require_csc'] = 'yes';
|
167 |
+
|
168 |
+
update_option( 'woocommerce_braintree_credit_card_settings', $cc_settings );
|
169 |
+
}
|
170 |
+
|
171 |
+
$this->get_plugin()->log( 'Completed upgrade for 2.0.2' );
|
172 |
+
}
|
173 |
+
}
|
174 |
+
|
175 |
+
|
176 |
+
/**
|
177 |
+
* Migrate the necessary settings from the retired plugin.
|
178 |
+
*
|
179 |
+
* @since 2.2.0
|
180 |
+
*/
|
181 |
+
protected function migrate_from_sv() {
|
182 |
+
|
183 |
+
$this->get_plugin()->log( 'Starting migration to ' . $this->get_plugin()->get_plugin_name() );
|
184 |
+
|
185 |
+
// set the version number
|
186 |
+
$this->set_installed_version( $this->get_plugin()->get_version() );
|
187 |
+
|
188 |
+
foreach ( $this->get_plugin()->get_gateway_ids() as $gateway_id ) {
|
189 |
+
|
190 |
+
$settings = $this->get_plugin()->get_gateway_settings( $gateway_id );
|
191 |
+
|
192 |
+
// if the API credentials have been previously configured
|
193 |
+
if ( 'yes' === $settings['inherit_settings'] || ( ! empty( $settings['public_key'] ) && ! empty( $settings['private_key'] ) && ! empty( $settings['merchant_id'] ) ) || ( ! empty( $settings['sandbox_public_key'] ) && ! empty( $settings['sandbox_private_key'] ) && ! empty( $settings['sandbox_merchant_id'] ) ) ) {
|
194 |
+
|
195 |
+
$settings['connect_manually'] = 'yes';
|
196 |
+
|
197 |
+
update_option( $this->get_plugin()->get_gateway_settings_name( $gateway_id ), $settings );
|
198 |
+
}
|
199 |
+
}
|
200 |
+
|
201 |
+
update_option( 'wc_braintree_legacy_migrated', 'yes' );
|
202 |
+
|
203 |
+
// update legacy meta in case users had previously switched to v1 from
|
204 |
+
// the SkyVerge plugin prior to this migration
|
205 |
+
$this->update_legacy_meta();
|
206 |
+
|
207 |
+
$this->get_plugin()->log( 'Completed migration to ' . $this->get_plugin()->get_plugin_name() );
|
208 |
+
}
|
209 |
+
|
210 |
+
|
211 |
+
/**
|
212 |
+
* Migrates Braintree legacy order, subscription, and user meta to v2.
|
213 |
+
*
|
214 |
+
* @since 2.2.0
|
215 |
+
*/
|
216 |
+
protected function update_legacy_meta() {
|
217 |
+
global $wpdb;
|
218 |
+
|
219 |
+
$this->get_plugin()->log( 'Updating legacy meta' );
|
220 |
+
|
221 |
+
$order_meta = array(
|
222 |
+
'_wc_paypal_braintree_customer_id' => 'customer_id',
|
223 |
+
'_wc_paypal_braintree_payment_method_token' => 'payment_token',
|
224 |
+
'_pp_braintree_charge_captured' => 'charge_captured',
|
225 |
+
);
|
226 |
+
|
227 |
+
$count = 0;
|
228 |
+
|
229 |
+
foreach ( $order_meta as $legacy_key => $new_suffix ) {
|
230 |
+
|
231 |
+
// update for the credit card gateway
|
232 |
+
$rows = $wpdb->query(
|
233 |
+
$wpdb->prepare(
|
234 |
+
"
|
235 |
+
UPDATE {$wpdb->postmeta} meta1, {$wpdb->postmeta} meta2
|
236 |
+
SET meta1.meta_key = %s
|
237 |
+
WHERE meta1.meta_key = %s
|
238 |
+
AND meta2.meta_key = '_payment_method'
|
239 |
+
AND meta2.meta_value = 'paypalbraintree_cards'
|
240 |
+
AND meta1.post_id = meta2.post_id
|
241 |
+
",
|
242 |
+
[
|
243 |
+
'_wc_braintree_credit_card_' . $new_suffix,
|
244 |
+
$legacy_key,
|
245 |
+
]
|
246 |
+
)
|
247 |
+
);
|
248 |
+
|
249 |
+
$count += $rows;
|
250 |
+
|
251 |
+
// update for the paypal gateway
|
252 |
+
$rows = $wpdb->query(
|
253 |
+
$wpdb->prepare(
|
254 |
+
"
|
255 |
+
UPDATE {$wpdb->postmeta} meta1, {$wpdb->postmeta} meta2
|
256 |
+
SET meta1.meta_key = %s
|
257 |
+
WHERE meta1.meta_key = %s
|
258 |
+
AND meta2.meta_key = '_payment_method'
|
259 |
+
AND meta2.meta_value = 'paypalbraintree_paypal'
|
260 |
+
AND meta1.post_id = meta2.post_id
|
261 |
+
",
|
262 |
+
[
|
263 |
+
'_wc_braintree_paypal_' . $new_suffix,
|
264 |
+
$legacy_key,
|
265 |
+
]
|
266 |
+
)
|
267 |
+
);
|
268 |
+
|
269 |
+
$count += $rows;
|
270 |
+
}
|
271 |
+
|
272 |
+
if ( $rows = $wpdb->update( $wpdb->postmeta, array( 'meta_value' => 'braintree_credit_card' ), array( 'meta_key' => '_payment_method', 'meta_value' => 'paypalbraintree_cards' ) ) ) {
|
273 |
+
$count += $rows;
|
274 |
+
}
|
275 |
+
if ( $rows = $wpdb->update( $wpdb->postmeta, array( 'meta_value' => 'braintree_paypal' ), array( 'meta_key' => '_payment_method', 'meta_value' => 'paypalbraintree_paypal' ) ) ) {
|
276 |
+
$count += $rows;
|
277 |
+
}
|
278 |
+
|
279 |
+
if ( $count ) {
|
280 |
+
$this->get_plugin()->log( sprintf( '%d rows of order meta data updated.', $count ) );
|
281 |
+
}
|
282 |
+
|
283 |
+
// Customer IDs
|
284 |
+
// old key: _wc_paypal_braintree_customer_id
|
285 |
+
// new key: wc_braintree_customer_id
|
286 |
+
if ( $rows = $wpdb->update( $wpdb->usermeta, array( 'meta_key' => 'wc_braintree_customer_id' ), array( 'meta_key' => '_wc_paypal_braintree_customer_id' ) ) ) {
|
287 |
+
$this->get_plugin()->log( sprintf( '%d user customer IDs updated.', $rows ) );
|
288 |
+
}
|
289 |
+
}
|
290 |
+
|
291 |
+
|
292 |
+
}
|
includes/class-wc-braintree-payment-method-handler.php
CHANGED
@@ -22,7 +22,7 @@
|
|
22 |
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
|
23 |
*/
|
24 |
|
25 |
-
use \
|
26 |
|
27 |
defined( 'ABSPATH' ) or exit;
|
28 |
|
22 |
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
|
23 |
*/
|
24 |
|
25 |
+
use WC_Braintree\Plugin_Framework as WC_Braintree_Framework;
|
26 |
|
27 |
defined( 'ABSPATH' ) or exit;
|
28 |
|
includes/class-wc-braintree-payment-method.php
CHANGED
@@ -22,7 +22,7 @@
|
|
22 |
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
|
23 |
*/
|
24 |
|
25 |
-
use \
|
26 |
|
27 |
defined( 'ABSPATH' ) or exit;
|
28 |
|
22 |
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
|
23 |
*/
|
24 |
|
25 |
+
use WC_Braintree\Plugin_Framework as WC_Braintree_Framework;
|
26 |
|
27 |
defined( 'ABSPATH' ) or exit;
|
28 |
|
includes/class-wc-braintree-paypal-cart.php
CHANGED
@@ -22,7 +22,7 @@
|
|
22 |
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
|
23 |
*/
|
24 |
|
25 |
-
use \
|
26 |
|
27 |
defined( 'ABSPATH' ) or exit;
|
28 |
|
@@ -140,12 +140,9 @@ class WC_Braintree_PayPal_Cart {
|
|
140 |
*/
|
141 |
public function render_js() {
|
142 |
|
143 |
-
$
|
144 |
-
|
145 |
-
|
146 |
-
'shape' => 'pill',
|
147 |
-
'color' => 'gold',
|
148 |
-
);
|
149 |
|
150 |
/**
|
151 |
* Filters the PayPal cart button style parameters.
|
@@ -156,16 +153,17 @@ class WC_Braintree_PayPal_Cart {
|
|
156 |
*
|
157 |
* @param array $styles style parameters
|
158 |
*/
|
159 |
-
$button_styles = apply_filters( 'wc_' . $this->get_gateway()->get_id() . '_cart_button_styles', $
|
160 |
-
|
161 |
-
$params =
|
162 |
-
'id'
|
163 |
-
'id_dasherized'
|
164 |
-
'
|
165 |
-
'
|
166 |
-
'client_token_nonce'
|
167 |
-
'
|
168 |
-
|
|
|
169 |
|
170 |
wc_enqueue_js( sprintf( 'window.wc_%1$s_handler = new WC_Braintree_PayPal_Cart_Handler( %2$s );', esc_js( $this->get_gateway()->get_id() ), json_encode( $params ) ) );
|
171 |
}
|
22 |
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
|
23 |
*/
|
24 |
|
25 |
+
use WC_Braintree\Plugin_Framework as WC_Braintree_Framework;
|
26 |
|
27 |
defined( 'ABSPATH' ) or exit;
|
28 |
|
140 |
*/
|
141 |
public function render_js() {
|
142 |
|
143 |
+
$params = $this->get_gateway()->get_payment_form_instance()->get_payment_form_handler_js_params();
|
144 |
+
|
145 |
+
$params['button_styles']['label'] = 'checkout';
|
|
|
|
|
|
|
146 |
|
147 |
/**
|
148 |
* Filters the PayPal cart button style parameters.
|
153 |
*
|
154 |
* @param array $styles style parameters
|
155 |
*/
|
156 |
+
$params['button_styles'] = (array) apply_filters( 'wc_' . $this->get_gateway()->get_id() . '_cart_button_styles', $params['button_styles'] );
|
157 |
+
|
158 |
+
$params = array_merge( [
|
159 |
+
'id' => $this->get_gateway()->get_id(),
|
160 |
+
'id_dasherized' => $this->get_gateway()->get_id_dasherized(),
|
161 |
+
'name' => $this->get_gateway()->get_method_title(),
|
162 |
+
'debug' => $this->get_gateway()->debug_log(),
|
163 |
+
'client_token_nonce' => wp_create_nonce( 'wc_' . $this->get_gateway()->get_id() . '_get_client_token' ),
|
164 |
+
'set_payment_method_nonce' => wp_create_nonce( 'wc_' . $this->get_gateway()->get_id() . '_cart_set_payment_method' ),
|
165 |
+
'cart_handler_url' => add_query_arg( 'wc-api', get_class( $this->get_gateway() ), home_url() )
|
166 |
+
], $params );
|
167 |
|
168 |
wc_enqueue_js( sprintf( 'window.wc_%1$s_handler = new WC_Braintree_PayPal_Cart_Handler( %2$s );', esc_js( $this->get_gateway()->get_id() ), json_encode( $params ) ) );
|
169 |
}
|
includes/class-wc-gateway-braintree-credit-card.php
CHANGED
@@ -22,7 +22,7 @@
|
|
22 |
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
|
23 |
*/
|
24 |
|
25 |
-
use \
|
26 |
|
27 |
defined( 'ABSPATH' ) or exit;
|
28 |
|
@@ -34,6 +34,13 @@ defined( 'ABSPATH' ) or exit;
|
|
34 |
class WC_Gateway_Braintree_Credit_Card extends WC_Gateway_Braintree {
|
35 |
|
36 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
37 |
/** @var string require CSC field */
|
38 |
protected $require_csc;
|
39 |
|
@@ -46,6 +53,15 @@ class WC_Gateway_Braintree_Credit_Card extends WC_Gateway_Braintree {
|
|
46 |
/** @var string 3D Secure enabled */
|
47 |
protected $threed_secure_enabled;
|
48 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
49 |
|
50 |
/**
|
51 |
* Initialize the gateway
|
@@ -75,6 +91,7 @@ class WC_Gateway_Braintree_Credit_Card extends WC_Gateway_Braintree {
|
|
75 |
self::FEATURE_CUSTOMER_ID,
|
76 |
self::FEATURE_ADD_PAYMENT_METHOD,
|
77 |
self::FEATURE_TOKEN_EDITOR,
|
|
|
78 |
),
|
79 |
'payment_type' => self::PAYMENT_TYPE_CREDIT_CARD,
|
80 |
'environments' => $this->get_braintree_environments(),
|
@@ -107,7 +124,6 @@ class WC_Gateway_Braintree_Credit_Card extends WC_Gateway_Braintree {
|
|
107 |
*
|
108 |
* @since 3.0.0
|
109 |
* @see SV_WC_Payment_Gateway::enqueue_gateway_assets()
|
110 |
-
* @return bool
|
111 |
*/
|
112 |
public function enqueue_gateway_assets() {
|
113 |
|
@@ -128,10 +144,10 @@ class WC_Gateway_Braintree_Credit_Card extends WC_Gateway_Braintree {
|
|
128 |
|
129 |
parent::enqueue_gateway_assets();
|
130 |
|
131 |
-
wp_enqueue_script( 'braintree-js-hosted-fields', 'https://js.braintreegateway.com/web/
|
132 |
|
133 |
if ( $this->is_3d_secure_enabled() ) {
|
134 |
-
wp_enqueue_script( 'braintree-js-3d-secure', 'https://js.braintreegateway.com/web/
|
135 |
}
|
136 |
}
|
137 |
}
|
@@ -190,23 +206,61 @@ class WC_Gateway_Braintree_Credit_Card extends WC_Gateway_Braintree {
|
|
190 |
'class' => 'js-kount-merchant-id',
|
191 |
'desc_tip' => __( 'Speak with your account management team at Braintree to get this.', 'woocommerce-gateway-paypal-powered-by-braintree' ),
|
192 |
),
|
|
|
|
|
|
|
193 |
|
194 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
195 |
'threed_secure_title' => array(
|
196 |
-
'title' => __( '3D Secure
|
197 |
'type' => 'title',
|
198 |
-
'description' => sprintf( __( '3D Secure benefits cardholders and merchants by providing an additional layer of verification. %1$sLearn more about 3D Secure%2$s.', 'woocommerce-gateway-paypal-powered-by-braintree' ), '<a href="' . esc_url( $this->get_plugin()->get_documentation_url() ) . '#3d-secure' . '">', '</a>' ),
|
199 |
),
|
200 |
-
'
|
201 |
-
'title' => __( '
|
202 |
-
'type' => '
|
203 |
-
'label' => __( '
|
204 |
-
'
|
205 |
-
'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
206 |
),
|
207 |
);
|
208 |
|
209 |
-
return
|
210 |
}
|
211 |
|
212 |
|
@@ -284,6 +338,18 @@ class WC_Gateway_Braintree_Credit_Card extends WC_Gateway_Braintree {
|
|
284 |
<?php
|
285 |
|
286 |
wc_enqueue_js( ob_get_clean() );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
287 |
}
|
288 |
|
289 |
|
@@ -330,9 +396,14 @@ class WC_Gateway_Braintree_Credit_Card extends WC_Gateway_Braintree {
|
|
330 |
|
331 |
$order = parent::get_order( $order );
|
332 |
|
|
|
|
|
|
|
|
|
|
|
333 |
// add information for 3DS transactions, note that server-side verification
|
334 |
// has already been checked in validate_fields() and passed
|
335 |
-
if ( $this->is_3d_secure_enabled() ) {
|
336 |
|
337 |
// indicate if 3DS should be required for every transaction -- note
|
338 |
// this will result in a gateway rejection for *every* transaction
|
@@ -342,7 +413,7 @@ class WC_Gateway_Braintree_Credit_Card extends WC_Gateway_Braintree {
|
|
342 |
// when using a saved payment method for a transaction that has been
|
343 |
// 3DS verified, indicate the nonce should be used instead, which
|
344 |
// passes the 3DS verification details to Braintree
|
345 |
-
if ( WC_Braintree_Framework\SV_WC_Helper::get_post( '
|
346 |
$order->payment->use_3ds_nonce = true;
|
347 |
}
|
348 |
}
|
@@ -362,6 +433,7 @@ class WC_Gateway_Braintree_Credit_Card extends WC_Gateway_Braintree {
|
|
362 |
* @param WC_Order $order the order object
|
363 |
* @param \WC_Braintree_API_Credit_Card_Transaction_Response $response optional credit card transaction response
|
364 |
* @return \WC_Braintree_API_Credit_Card_Transaction_Response
|
|
|
365 |
*/
|
366 |
protected function do_credit_card_transaction( $order, $response = null ) {
|
367 |
|
@@ -409,6 +481,28 @@ class WC_Gateway_Braintree_Credit_Card extends WC_Gateway_Braintree {
|
|
409 |
}
|
410 |
|
411 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
412 |
/** Refund/Void feature ***************************************************/
|
413 |
|
414 |
|
@@ -609,15 +703,86 @@ class WC_Gateway_Braintree_Credit_Card extends WC_Gateway_Braintree {
|
|
609 |
|
610 |
|
611 |
/**
|
612 |
-
*
|
613 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
614 |
*
|
615 |
-
* @since 3.0.0
|
616 |
* @return bool
|
617 |
*/
|
618 |
public function is_3d_secure_enabled() {
|
619 |
|
620 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
621 |
}
|
622 |
|
623 |
|
@@ -626,7 +791,8 @@ class WC_Gateway_Braintree_Credit_Card extends WC_Gateway_Braintree {
|
|
626 |
* transaction (even for those where liability shift wasn't possible, e.g.
|
627 |
* the cardholder was not enrolled)
|
628 |
*
|
629 |
-
* @since
|
|
|
630 |
* @return bool
|
631 |
*/
|
632 |
public function is_3d_secure_liability_shift_always_required() {
|
@@ -637,12 +803,42 @@ class WC_Gateway_Braintree_Credit_Card extends WC_Gateway_Braintree {
|
|
637 |
* Allow actors to require a liability shift for every 3DS-eligible
|
638 |
* transaction, regardless of whether it was possible or not.
|
639 |
*
|
640 |
-
* @since
|
|
|
641 |
* @param bool $require
|
642 |
* @param \WC_Gateway_Braintree_Credit_Card $this instance
|
643 |
* @return bool true to require the liability shift
|
644 |
*/
|
645 |
-
return apply_filters( 'wc_' . $this->get_id() . '_always_require_3ds_liability_shift', false, $this );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
646 |
}
|
647 |
|
648 |
|
@@ -652,7 +848,8 @@ class WC_Gateway_Braintree_Credit_Card extends WC_Gateway_Braintree {
|
|
652 |
*
|
653 |
* @link https://developers.braintreepayments.com/guides/3d-secure/server-side/php#vaulted-credit-card-nonces
|
654 |
*
|
655 |
-
* @since
|
|
|
656 |
* @param \WC_Braintree_Payment_Method $token payment method
|
657 |
* @return string nonce
|
658 |
*/
|
@@ -689,8 +886,16 @@ class WC_Gateway_Braintree_Credit_Card extends WC_Gateway_Braintree {
|
|
689 |
|
690 |
$is_valid = parent::validate_fields();
|
691 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
692 |
// nonce must always be present for validation
|
693 |
-
if (
|
694 |
|
695 |
$error = false;
|
696 |
|
@@ -698,11 +903,28 @@ class WC_Gateway_Braintree_Credit_Card extends WC_Gateway_Braintree {
|
|
698 |
|
699 |
$payment_method = $this->get_api()->get_payment_method_from_nonce( WC_Braintree_Framework\SV_WC_Helper::get_post( 'wc_braintree_credit_card_payment_nonce' ) );
|
700 |
|
701 |
-
|
702 |
-
|
703 |
-
|
704 |
-
|
705 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
706 |
}
|
707 |
|
708 |
} catch ( WC_Braintree_Framework\SV_WC_Plugin_Exception $e ) {
|
22 |
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
|
23 |
*/
|
24 |
|
25 |
+
use WC_Braintree\Plugin_Framework as WC_Braintree_Framework;
|
26 |
|
27 |
defined( 'ABSPATH' ) or exit;
|
28 |
|
34 |
class WC_Gateway_Braintree_Credit_Card extends WC_Gateway_Braintree {
|
35 |
|
36 |
|
37 |
+
/** @var string 3D Secure standard mode */
|
38 |
+
const THREED_SECURE_MODE_STANDARD = 'standard';
|
39 |
+
|
40 |
+
/** @var string 3D Secure strict mode */
|
41 |
+
const THREED_SECURE_MODE_STRICT = 'strict';
|
42 |
+
|
43 |
+
|
44 |
/** @var string require CSC field */
|
45 |
protected $require_csc;
|
46 |
|
53 |
/** @var string 3D Secure enabled */
|
54 |
protected $threed_secure_enabled;
|
55 |
|
56 |
+
/** @var string 3D Secure mode, standard or strict */
|
57 |
+
protected $threed_secure_mode;
|
58 |
+
|
59 |
+
/** @var array 3D Secure card types */
|
60 |
+
protected $threed_secure_card_types = array();
|
61 |
+
|
62 |
+
/** @var bool 3D Secure available */
|
63 |
+
protected $threed_secure_available;
|
64 |
+
|
65 |
|
66 |
/**
|
67 |
* Initialize the gateway
|
91 |
self::FEATURE_CUSTOMER_ID,
|
92 |
self::FEATURE_ADD_PAYMENT_METHOD,
|
93 |
self::FEATURE_TOKEN_EDITOR,
|
94 |
+
self::FEATURE_APPLE_PAY,
|
95 |
),
|
96 |
'payment_type' => self::PAYMENT_TYPE_CREDIT_CARD,
|
97 |
'environments' => $this->get_braintree_environments(),
|
124 |
*
|
125 |
* @since 3.0.0
|
126 |
* @see SV_WC_Payment_Gateway::enqueue_gateway_assets()
|
|
|
127 |
*/
|
128 |
public function enqueue_gateway_assets() {
|
129 |
|
144 |
|
145 |
parent::enqueue_gateway_assets();
|
146 |
|
147 |
+
wp_enqueue_script( 'braintree-js-hosted-fields', 'https://js.braintreegateway.com/web/' . WC_Braintree::BRAINTREE_JS_SDK_VERSION . '/js/hosted-fields.min.js', array(), WC_Braintree::VERSION, true );
|
148 |
|
149 |
if ( $this->is_3d_secure_enabled() ) {
|
150 |
+
wp_enqueue_script( 'braintree-js-3d-secure', 'https://js.braintreegateway.com/web/' . WC_Braintree::BRAINTREE_JS_SDK_VERSION . '/js/three-d-secure.min.js', array(), WC_Braintree::VERSION, true );
|
151 |
}
|
152 |
}
|
153 |
}
|
206 |
'class' => 'js-kount-merchant-id',
|
207 |
'desc_tip' => __( 'Speak with your account management team at Braintree to get this.', 'woocommerce-gateway-paypal-powered-by-braintree' ),
|
208 |
),
|
209 |
+
);
|
210 |
+
|
211 |
+
$fields = array_merge( $fields, $this->get_3d_secure_fields() );
|
212 |
|
213 |
+
return array_merge( parent::get_method_form_fields(), $fields );
|
214 |
+
}
|
215 |
+
|
216 |
+
|
217 |
+
/**
|
218 |
+
* Gets the 3D Secure settings fields.
|
219 |
+
*
|
220 |
+
* @since 2.2.0
|
221 |
+
*
|
222 |
+
* @return array
|
223 |
+
*/
|
224 |
+
protected function get_3d_secure_fields() {
|
225 |
+
|
226 |
+
// Braintree declares 3D Secure support for AMEX, Maestro, MasterCard, and Visa
|
227 |
+
$card_types = $default_card_types = array(
|
228 |
+
WC_Braintree_Framework\SV_WC_Payment_Gateway_Helper::CARD_TYPE_AMEX => WC_Braintree_Framework\SV_WC_Payment_Gateway_Helper::payment_type_to_name( WC_Braintree_Framework\SV_WC_Payment_Gateway_Helper::CARD_TYPE_AMEX ),
|
229 |
+
WC_Braintree_Framework\SV_WC_Payment_Gateway_Helper::CARD_TYPE_MAESTRO => WC_Braintree_Framework\SV_WC_Payment_Gateway_Helper::payment_type_to_name( WC_Braintree_Framework\SV_WC_Payment_Gateway_Helper::CARD_TYPE_MAESTRO ),
|
230 |
+
WC_Braintree_Framework\SV_WC_Payment_Gateway_Helper::CARD_TYPE_MASTERCARD => WC_Braintree_Framework\SV_WC_Payment_Gateway_Helper::payment_type_to_name( WC_Braintree_Framework\SV_WC_Payment_Gateway_Helper::CARD_TYPE_MASTERCARD ),
|
231 |
+
WC_Braintree_Framework\SV_WC_Payment_Gateway_Helper::CARD_TYPE_VISA => WC_Braintree_Framework\SV_WC_Payment_Gateway_Helper::payment_type_to_name( WC_Braintree_Framework\SV_WC_Payment_Gateway_Helper::CARD_TYPE_VISA ),
|
232 |
+
);
|
233 |
+
|
234 |
+
// exclude American Express by default, since that requires additional merchant configuration, but still let people enabled it
|
235 |
+
unset( $default_card_types[ WC_Braintree_Framework\SV_WC_Payment_Gateway_Helper::CARD_TYPE_AMEX ] );
|
236 |
+
|
237 |
+
$fields = array(
|
238 |
'threed_secure_title' => array(
|
239 |
+
'title' => __( '3D Secure', 'woocommerce-gateway-paypal-powered-by-braintree' ),
|
240 |
'type' => 'title',
|
241 |
+
'description' => sprintf( __( '3D Secure benefits cardholders and merchants by providing an additional layer of verification using Verified by Visa, MasterCard SecureCode, and American Express SafeKey. %1$sLearn more about 3D Secure%2$s.', 'woocommerce-gateway-paypal-powered-by-braintree' ), '<a href="' . esc_url( $this->get_plugin()->get_documentation_url() ) . '#3d-secure' . '">', '</a>' ),
|
242 |
),
|
243 |
+
'threed_secure_mode' => array(
|
244 |
+
'title' => __( 'Level', 'woocommerce-gateway-paypal-powered-by-braintree' ),
|
245 |
+
'type' => 'select',
|
246 |
+
'label' => __( 'Only accept payments when the liability is shifted', 'woocommerce-gateway-paypal-powered-by-braintree' ),
|
247 |
+
'default' => self::THREED_SECURE_MODE_STANDARD,
|
248 |
+
'options' => array(
|
249 |
+
self::THREED_SECURE_MODE_STANDARD => __( 'Standard', 'woocommerce-gateway-paypal-powered-by-braintree' ),
|
250 |
+
self::THREED_SECURE_MODE_STRICT => __( 'Strict', 'woocommerce-gateway-paypal-powered-by-braintree' ),
|
251 |
+
),
|
252 |
+
),
|
253 |
+
'threed_secure_card_types' => array(
|
254 |
+
'title' => __( 'Supported Card Types', 'woocommerce-gateway-paypal-powered-by-braintree' ),
|
255 |
+
'type' => 'multiselect',
|
256 |
+
'class' => 'wc-enhanced-select',
|
257 |
+
'description' => __( '3D Secure validation will only occur for these cards.', 'woocommerce-gateway-paypal-powered-by-braintree' ),
|
258 |
+
'default' => array_keys( $default_card_types ),
|
259 |
+
'options' => $card_types,
|
260 |
),
|
261 |
);
|
262 |
|
263 |
+
return $fields;
|
264 |
}
|
265 |
|
266 |
|
338 |
<?php
|
339 |
|
340 |
wc_enqueue_js( ob_get_clean() );
|
341 |
+
|
342 |
+
// 3D Secure setting handler
|
343 |
+
ob_start();
|
344 |
+
?>
|
345 |
+
|
346 |
+
if ( ! <?php echo (int) $this->is_3d_secure_available(); ?> ) {
|
347 |
+
$( '#woocommerce_braintree_credit_card_threed_secure_title' ).hide().next( 'p' ).hide().next( 'table' ).hide();
|
348 |
+
}
|
349 |
+
|
350 |
+
<?php
|
351 |
+
|
352 |
+
wc_enqueue_js( ob_get_clean() );
|
353 |
}
|
354 |
|
355 |
|
396 |
|
397 |
$order = parent::get_order( $order );
|
398 |
|
399 |
+
// ensure the card type is normalized to FW format
|
400 |
+
if ( empty( $order->payment->card_type ) ) {
|
401 |
+
$order->payment->card_type = WC_Braintree_Framework\SV_WC_Payment_Gateway_Helper::normalize_card_type( WC_Braintree_Framework\SV_WC_Helper::get_post( 'wc-' . $this->get_id_dasherized() . '-card-type' ) );
|
402 |
+
}
|
403 |
+
|
404 |
// add information for 3DS transactions, note that server-side verification
|
405 |
// has already been checked in validate_fields() and passed
|
406 |
+
if ( $this->is_3d_secure_enabled() && WC_Braintree_Framework\SV_WC_Helper::get_post( 'wc-' . $this->get_id_dasherized() . '-3d-secure-enabled' ) && ( ! $order->payment->card_type || $this->card_type_supports_3d_secure( $order->payment->card_type ) ) ) {
|
407 |
|
408 |
// indicate if 3DS should be required for every transaction -- note
|
409 |
// this will result in a gateway rejection for *every* transaction
|
413 |
// when using a saved payment method for a transaction that has been
|
414 |
// 3DS verified, indicate the nonce should be used instead, which
|
415 |
// passes the 3DS verification details to Braintree
|
416 |
+
if ( WC_Braintree_Framework\SV_WC_Helper::get_post( 'wc-' . $this->get_id_dasherized() . '-3d-secure-verified' ) && ! empty( $order->payment->token ) && ! empty( $order->payment->nonce ) ) {
|
417 |
$order->payment->use_3ds_nonce = true;
|
418 |
}
|
419 |
}
|
433 |
* @param WC_Order $order the order object
|
434 |
* @param \WC_Braintree_API_Credit_Card_Transaction_Response $response optional credit card transaction response
|
435 |
* @return \WC_Braintree_API_Credit_Card_Transaction_Response
|
436 |
+
* @throws WC_Braintree_Framework\SV_WC_Plugin_Exception
|
437 |
*/
|
438 |
protected function do_credit_card_transaction( $order, $response = null ) {
|
439 |
|
481 |
}
|
482 |
|
483 |
|
484 |
+
/** Apple Pay Methods *********************************************************************************************/
|
485 |
+
|
486 |
+
|
487 |
+
/**
|
488 |
+
* Gets the order for Apple Pay transactions.
|
489 |
+
*
|
490 |
+
* @since 2.2.0
|
491 |
+
*
|
492 |
+
* @param \WC_Order $order order object
|
493 |
+
* @param WC_Braintree_Framework\SV_WC_Payment_Gateway_Apple_Pay_Payment_Response $response
|
494 |
+
* @return \WC_Order
|
495 |
+
*/
|
496 |
+
public function get_order_for_apple_pay( \WC_Order $order, WC_Braintree_Framework\SV_WC_Payment_Gateway_Apple_Pay_Payment_Response $response ) {
|
497 |
+
|
498 |
+
$order = parent::get_order_for_apple_pay( $order, $response );
|
499 |
+
|
500 |
+
$order->payment->nonce = $response->get_braintree_nonce();
|
501 |
+
|
502 |
+
return $order;
|
503 |
+
}
|
504 |
+
|
505 |
+
|
506 |
/** Refund/Void feature ***************************************************/
|
507 |
|
508 |
|
703 |
|
704 |
|
705 |
/**
|
706 |
+
* Determines if 3D Secure is available for the merchant account.
|
707 |
+
*
|
708 |
+
* @since 2.2.0
|
709 |
+
*
|
710 |
+
* @return bool
|
711 |
+
*/
|
712 |
+
public function is_3d_secure_available() {
|
713 |
+
|
714 |
+
if ( null === $this->threed_secure_available ) {
|
715 |
+
|
716 |
+
// we assume this is true so users aren't locked out when there are API issues
|
717 |
+
$this->threed_secure_available = true;
|
718 |
+
|
719 |
+
if ( $this->is_configured() ) {
|
720 |
+
|
721 |
+
// try and get the remote merchant configuration so the settings accurately display which services are available
|
722 |
+
try {
|
723 |
+
|
724 |
+
$response = $this->get_api()->get_merchant_configuration();
|
725 |
+
|
726 |
+
$this->threed_secure_available = $response->is_3d_secure_enabled();
|
727 |
+
|
728 |
+
} catch ( WC_Braintree_Framework\SV_WC_API_Exception $exception ) {
|
729 |
+
|
730 |
+
// there was a problem with the API, so nothing we can do but log the issues
|
731 |
+
$this->add_debug_message( "Could not determine the merchant's 3D Secure configuration. {$exception->getMessage()}" );
|
732 |
+
}
|
733 |
+
}
|
734 |
+
}
|
735 |
+
|
736 |
+
return $this->threed_secure_available;
|
737 |
+
}
|
738 |
+
|
739 |
+
|
740 |
+
/**
|
741 |
+
* Determines if 3D secure is enabled.
|
742 |
+
*
|
743 |
+
* We've removed the 3D Secure setting, and its availability is determined by the connected account, however this
|
744 |
+
* allows users to disable it completely via a filter should they want to.
|
745 |
+
*
|
746 |
+
* @since 2.0.0
|
747 |
*
|
|
|
748 |
* @return bool
|
749 |
*/
|
750 |
public function is_3d_secure_enabled() {
|
751 |
|
752 |
+
/**
|
753 |
+
* Filters whether 3D Secure is enabled.
|
754 |
+
*
|
755 |
+
* @since 2.2.0
|
756 |
+
*
|
757 |
+
* @param bool $enabled whether 3D Secure is enabled
|
758 |
+
*/
|
759 |
+
return apply_filters( 'wc_' . $this->get_id() . '_enable_3d_secure', true );
|
760 |
+
}
|
761 |
+
|
762 |
+
|
763 |
+
/**
|
764 |
+
* Determines if 3D Secure is in strict mode.
|
765 |
+
*
|
766 |
+
* @since 2.2.0
|
767 |
+
*
|
768 |
+
* @return bool
|
769 |
+
*/
|
770 |
+
public function is_3d_secure_strict() {
|
771 |
+
|
772 |
+
return self::THREED_SECURE_MODE_STRICT === $this->get_3d_secure_mode();
|
773 |
+
}
|
774 |
+
|
775 |
+
|
776 |
+
/**
|
777 |
+
* Gets the currently configured 3D Secure mode.
|
778 |
+
*
|
779 |
+
* @since 2.2.0
|
780 |
+
*
|
781 |
+
* @return string
|
782 |
+
*/
|
783 |
+
public function get_3d_secure_mode() {
|
784 |
+
|
785 |
+
return $this->threed_secure_mode;
|
786 |
}
|
787 |
|
788 |
|
791 |
* transaction (even for those where liability shift wasn't possible, e.g.
|
792 |
* the cardholder was not enrolled)
|
793 |
*
|
794 |
+
* @since 2.0.0
|
795 |
+
*
|
796 |
* @return bool
|
797 |
*/
|
798 |
public function is_3d_secure_liability_shift_always_required() {
|
803 |
* Allow actors to require a liability shift for every 3DS-eligible
|
804 |
* transaction, regardless of whether it was possible or not.
|
805 |
*
|
806 |
+
* @since 2.0.0
|
807 |
+
*
|
808 |
* @param bool $require
|
809 |
* @param \WC_Gateway_Braintree_Credit_Card $this instance
|
810 |
* @return bool true to require the liability shift
|
811 |
*/
|
812 |
+
return (bool) apply_filters( 'wc_' . $this->get_id() . '_always_require_3ds_liability_shift', false, $this );
|
813 |
+
}
|
814 |
+
|
815 |
+
|
816 |
+
/**
|
817 |
+
* Determines if the passed card type supports 3D Secure.
|
818 |
+
*
|
819 |
+
* This checks the card types configured in the settings.
|
820 |
+
*
|
821 |
+
* @since 2.2.0
|
822 |
+
*
|
823 |
+
* @param string $card_type card type
|
824 |
+
* @return bool
|
825 |
+
*/
|
826 |
+
public function card_type_supports_3d_secure( $card_type ) {
|
827 |
+
|
828 |
+
return in_array( WC_Braintree_Framework\SV_WC_Payment_Gateway_Helper::normalize_card_type( $card_type ), $this->get_3d_secure_card_types(), true );
|
829 |
+
}
|
830 |
+
|
831 |
+
|
832 |
+
/**
|
833 |
+
* Gets the card types to validate with 3D Secure.
|
834 |
+
*
|
835 |
+
* @since 2.2.0
|
836 |
+
*
|
837 |
+
* @return array
|
838 |
+
*/
|
839 |
+
public function get_3d_secure_card_types() {
|
840 |
+
|
841 |
+
return (array) $this->get_option( 'threed_secure_card_types' );
|
842 |
}
|
843 |
|
844 |
|
848 |
*
|
849 |
* @link https://developers.braintreepayments.com/guides/3d-secure/server-side/php#vaulted-credit-card-nonces
|
850 |
*
|
851 |
+
* @since 2.0.0
|
852 |
+
*
|
853 |
* @param \WC_Braintree_Payment_Method $token payment method
|
854 |
* @return string nonce
|
855 |
*/
|
886 |
|
887 |
$is_valid = parent::validate_fields();
|
888 |
|
889 |
+
// no additional validation if 3D Secure was disabled
|
890 |
+
// we check both the gateway method (filtered) and if the client-side JS validated 3D Secure (hidden input)
|
891 |
+
if ( ! $is_valid || ! $this->is_3d_secure_enabled() || ! WC_Braintree_Framework\SV_WC_Helper::get_post( 'wc-' . $this->get_id_dasherized() . '-3d-secure-enabled' ) ) {
|
892 |
+
return $is_valid;
|
893 |
+
}
|
894 |
+
|
895 |
+
$card_type = WC_Braintree_Framework\SV_WC_Helper::get_post( 'wc-' . $this->get_id_dasherized() . '-card-type' );
|
896 |
+
|
897 |
// nonce must always be present for validation
|
898 |
+
if ( WC_Braintree_Framework\SV_WC_Helper::get_post( 'wc_braintree_credit_card_payment_nonce' ) && ( ! $card_type || $this->card_type_supports_3d_secure( $card_type ) ) ) {
|
899 |
|
900 |
$error = false;
|
901 |
|
903 |
|
904 |
$payment_method = $this->get_api()->get_payment_method_from_nonce( WC_Braintree_Framework\SV_WC_Helper::get_post( 'wc_braintree_credit_card_payment_nonce' ) );
|
905 |
|
906 |
+
if ( $payment_method->has_3d_secure_info() ) {
|
907 |
+
|
908 |
+
$decline_statuses = [
|
909 |
+
'authenticate_signature_verification_failed',
|
910 |
+
'authenticate_failed',
|
911 |
+
];
|
912 |
+
|
913 |
+
if ( $this->is_3d_secure_strict() ) {
|
914 |
+
|
915 |
+
$decline_statuses = array_merge( $decline_statuses, [
|
916 |
+
'unsupported_card',
|
917 |
+
'lookup_error',
|
918 |
+
'lookup_not_enrolled',
|
919 |
+
'authentication_unavailable',
|
920 |
+
'authenticate_unable_to_authenticate',
|
921 |
+
'authenticate_error',
|
922 |
+
] );
|
923 |
+
}
|
924 |
+
|
925 |
+
if ( in_array( $payment_method->get_3d_secure_status(), $decline_statuses, true ) ) {
|
926 |
+
$error = __( 'We cannot process your order with the payment information that you provided. Please use an alternate payment method.', 'woocommerce-gateway-paypal-powered-by-braintree' );
|
927 |
+
}
|
928 |
}
|
929 |
|
930 |
} catch ( WC_Braintree_Framework\SV_WC_Plugin_Exception $e ) {
|
includes/class-wc-gateway-braintree-paypal.php
CHANGED
@@ -22,7 +22,7 @@
|
|
22 |
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
|
23 |
*/
|
24 |
|
25 |
-
use \
|
26 |
|
27 |
defined( 'ABSPATH' ) or exit;
|
28 |
|
@@ -41,6 +41,18 @@ class WC_Gateway_Braintree_PayPal extends WC_Gateway_Braintree {
|
|
41 |
/** @var bool whether cart checkout is enabled */
|
42 |
protected $enable_cart_checkout;
|
43 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
44 |
|
45 |
/**
|
46 |
* Initialize the gateway
|
@@ -108,27 +120,8 @@ class WC_Gateway_Braintree_PayPal extends WC_Gateway_Braintree {
|
|
108 |
parent::enqueue_gateway_assets();
|
109 |
|
110 |
wp_enqueue_script( 'braintree-js-paypal', 'https://www.paypalobjects.com/api/checkout.js', array(), WC_Braintree::VERSION, true );
|
111 |
-
wp_enqueue_script( 'braintree-js-paypal-checkout', 'https://js.braintreegateway.com/web/
|
112 |
-
}
|
113 |
-
}
|
114 |
-
|
115 |
-
|
116 |
-
/**
|
117 |
-
* Gets the gateway JS localized parameters.
|
118 |
-
*
|
119 |
-
* @since 2.0.0
|
120 |
-
* @return array
|
121 |
-
*/
|
122 |
-
protected function get_gateway_js_localized_script_params() {
|
123 |
-
|
124 |
-
$params = parent::get_gateway_js_localized_script_params();
|
125 |
-
|
126 |
-
if ( is_cart() ) {
|
127 |
-
$params['cart_nonce'] = wp_create_nonce( 'wc_' . $this->get_id() . '_cart_set_payment_method' );
|
128 |
-
$params['cart_handler_url'] = add_query_arg( 'wc-api', get_class( $this ), home_url() );
|
129 |
}
|
130 |
-
|
131 |
-
return $params;
|
132 |
}
|
133 |
|
134 |
|
@@ -243,6 +236,58 @@ class WC_Gateway_Braintree_PayPal extends WC_Gateway_Braintree {
|
|
243 |
*/
|
244 |
protected function add_authorization_charge_form_fields( $form_fields ) {
|
245 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
246 |
$form_fields['enable_cart_checkout'] = array(
|
247 |
'title' => __( 'Enable Cart Checkout', 'woocommerce-gateway-paypal-powered-by-braintree' ),
|
248 |
'type' => 'checkbox',
|
@@ -254,6 +299,89 @@ class WC_Gateway_Braintree_PayPal extends WC_Gateway_Braintree {
|
|
254 |
}
|
255 |
|
256 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
257 |
/**
|
258 |
* Add PayPal method specific form fields, currently:
|
259 |
*
|
@@ -565,4 +693,69 @@ class WC_Gateway_Braintree_PayPal extends WC_Gateway_Braintree {
|
|
565 |
}
|
566 |
|
567 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
568 |
}
|
22 |
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
|
23 |
*/
|
24 |
|
25 |
+
use WC_Braintree\Plugin_Framework as WC_Braintree_Framework;
|
26 |
|
27 |
defined( 'ABSPATH' ) or exit;
|
28 |
|
41 |
/** @var bool whether cart checkout is enabled */
|
42 |
protected $enable_cart_checkout;
|
43 |
|
44 |
+
/** @var bool whether paypal credit is enabled */
|
45 |
+
protected $enable_paypal_credit;
|
46 |
+
|
47 |
+
/** @var string button color */
|
48 |
+
protected $button_color;
|
49 |
+
|
50 |
+
/** @var string button size */
|
51 |
+
protected $button_size;
|
52 |
+
|
53 |
+
/** @var string button shape */
|
54 |
+
protected $button_shape;
|
55 |
+
|
56 |
|
57 |
/**
|
58 |
* Initialize the gateway
|
120 |
parent::enqueue_gateway_assets();
|
121 |
|
122 |
wp_enqueue_script( 'braintree-js-paypal', 'https://www.paypalobjects.com/api/checkout.js', array(), WC_Braintree::VERSION, true );
|
123 |
+
wp_enqueue_script( 'braintree-js-paypal-checkout', 'https://js.braintreegateway.com/web/' . WC_Braintree::BRAINTREE_JS_SDK_VERSION . '/js/paypal-checkout.min.js', array(), WC_Braintree::VERSION, true );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
124 |
}
|
|
|
|
|
125 |
}
|
126 |
|
127 |
|
236 |
*/
|
237 |
protected function add_authorization_charge_form_fields( $form_fields ) {
|
238 |
|
239 |
+
$form_fields['button_appearance_title'] = [
|
240 |
+
'type' => 'title',
|
241 |
+
'title' => __( 'Button Appearance', 'woocommerce-gateway-paypal-powered-by-braintree' ),
|
242 |
+
];
|
243 |
+
|
244 |
+
$form_fields['button_color'] = [
|
245 |
+
'type' => 'select',
|
246 |
+
'title' => __( 'Button Color', 'woocommerce-gateway-paypal-powered-by-braintree' ),
|
247 |
+
'options' => [
|
248 |
+
'gold' => __( 'Gold', 'woocommerce-gateway-paypal-powered-by-braintree' ),
|
249 |
+
'blue' => __( 'Blue', 'woocommerce-gateway-paypal-powered-by-braintree' ),
|
250 |
+
'silver' => __( 'Silver', 'woocommerce-gateway-paypal-powered-by-braintree' ),
|
251 |
+
'white' => __( 'White', 'woocommerce-gateway-paypal-powered-by-braintree' ),
|
252 |
+
'black' => __( 'Black', 'woocommerce-gateway-paypal-powered-by-braintree' ),
|
253 |
+
],
|
254 |
+
'default' => 'gold',
|
255 |
+
];
|
256 |
+
|
257 |
+
$form_fields['button_size'] = [
|
258 |
+
'type' => 'select',
|
259 |
+
'title' => __( 'Button Size', 'woocommerce-gateway-paypal-powered-by-braintree' ),
|
260 |
+
'options' => [
|
261 |
+
'medium' => __( 'Medium', 'woocommerce-gateway-paypal-powered-by-braintree' ),
|
262 |
+
'large' => __( 'Large', 'woocommerce-gateway-paypal-powered-by-braintree' ),
|
263 |
+
'responsive' => __( 'Responsive', 'woocommerce-gateway-paypal-powered-by-braintree' ),
|
264 |
+
],
|
265 |
+
'default' => 'responsive',
|
266 |
+
];
|
267 |
+
|
268 |
+
$form_fields['button_shape'] = [
|
269 |
+
'type' => 'select',
|
270 |
+
'title' => __( 'Button Shape', 'woocommerce-gateway-paypal-powered-by-braintree' ),
|
271 |
+
'options' => [
|
272 |
+
'pill' => _x( 'Pill', 'button shape option', 'woocommerce-gateway-paypal-powered-by-braintree' ),
|
273 |
+
'rect' => _x( 'Rectangle', 'button shape option', 'woocommerce-gateway-paypal-powered-by-braintree' ),
|
274 |
+
],
|
275 |
+
'default' => 'pill',
|
276 |
+
];
|
277 |
+
|
278 |
+
$form_fields['enable_paypal_credit'] = array(
|
279 |
+
'title' => __( 'PayPal Credit', 'woocommerce-gateway-paypal-powered-by-braintree' ),
|
280 |
+
'type' => 'checkbox',
|
281 |
+
'disabled' => ! $this->is_paypal_credit_supported(),
|
282 |
+
'label' => __( 'Show the PayPal credit button beneath the standard PayPal button', 'woocommerce-gateway-paypal-powered-by-braintree' ),
|
283 |
+
'description' => ! $this->is_paypal_credit_supported() ? __( 'Currently disabled because PayPal Credit is only available for US merchants', 'woocommerce-gateway-paypal-powered-by-braintree' ) : '',
|
284 |
+
'default' => 'no',
|
285 |
+
);
|
286 |
+
|
287 |
+
$form_fields['button_preview'] = [
|
288 |
+
'type' => 'button_preview',
|
289 |
+
];
|
290 |
+
|
291 |
$form_fields['enable_cart_checkout'] = array(
|
292 |
'title' => __( 'Enable Cart Checkout', 'woocommerce-gateway-paypal-powered-by-braintree' ),
|
293 |
'type' => 'checkbox',
|
299 |
}
|
300 |
|
301 |
|
302 |
+
/**
|
303 |
+
* Generates HTML for the PayPal button preview.
|
304 |
+
*
|
305 |
+
* @since 2.2.0
|
306 |
+
*
|
307 |
+
* @return string
|
308 |
+
*/
|
309 |
+
protected function generate_button_preview_html() {
|
310 |
+
|
311 |
+
wp_enqueue_script( 'braintree-js-paypal', 'https://www.paypalobjects.com/api/checkout.js', array(), WC_Braintree::VERSION, true );
|
312 |
+
|
313 |
+
$button_js = '
|
314 |
+
|
315 |
+
var funding = {};
|
316 |
+
|
317 |
+
if ( offer_credit ) {
|
318 |
+
funding.allowed = [ paypal.FUNDING.CREDIT ];
|
319 |
+
} else {
|
320 |
+
funding.disallowed = [ paypal.FUNDING.CREDIT ];
|
321 |
+
}
|
322 |
+
|
323 |
+
paypal.Button.render( {
|
324 |
+
env: "sandbox",
|
325 |
+
style: {
|
326 |
+
label: "pay",
|
327 |
+
color: color,
|
328 |
+
size: size,
|
329 |
+
shape: shape,
|
330 |
+
layout: "vertical",
|
331 |
+
tagline: false,
|
332 |
+
},
|
333 |
+
funding: funding,
|
334 |
+
client: {
|
335 |
+
sandbox: "sandbox",
|
336 |
+
},
|
337 |
+
payment: function( data, actions ) {
|
338 |
+
return actions.payment.create( {
|
339 |
+
payment: {
|
340 |
+
transactions: [
|
341 |
+
{
|
342 |
+
amount: { total: "0.01", currency: "USD" }
|
343 |
+
}
|
344 |
+
]
|
345 |
+
}
|
346 |
+
} );
|
347 |
+
},
|
348 |
+
onAuthorize: function( data, actions ) {}
|
349 |
+
}, "#wc_braintree_paypal_button_preview" );
|
350 |
+
';
|
351 |
+
|
352 |
+
wc_enqueue_js( '
|
353 |
+
|
354 |
+
$( "#woocommerce_braintree_paypal_button_color, #woocommerce_braintree_paypal_button_size, #woocommerce_braintree_paypal_button_shape, #woocommerce_braintree_paypal_enable_paypal_credit" ).on( "change", function() {
|
355 |
+
|
356 |
+
$( "#wc_braintree_paypal_button_preview" ).empty();
|
357 |
+
|
358 |
+
var color = $( "#woocommerce_braintree_paypal_button_color" ).val();
|
359 |
+
var size = $( "#woocommerce_braintree_paypal_button_size" ).val();
|
360 |
+
var shape = $( "#woocommerce_braintree_paypal_button_shape" ).val();
|
361 |
+
var offer_credit = $( "#woocommerce_braintree_paypal_enable_paypal_credit" ).is( ":checked" );
|
362 |
+
|
363 |
+
' . $button_js . '
|
364 |
+
|
365 |
+
} ).change();
|
366 |
+
|
367 |
+
' );
|
368 |
+
|
369 |
+
ob_start();
|
370 |
+
?>
|
371 |
+
<tr valign="top">
|
372 |
+
<th scope="row" class="titledesc">
|
373 |
+
<?php esc_html_e( 'Preview', 'woocommerce-gateway-paypal-powered-by-braintree' ); ?>
|
374 |
+
</th>
|
375 |
+
<td class="forminp">
|
376 |
+
<div id="wc_braintree_paypal_button_preview" style="max-width:400px; pointer-events:none;"></div>
|
377 |
+
</td>
|
378 |
+
</tr>
|
379 |
+
<?php
|
380 |
+
|
381 |
+
return ob_get_clean();
|
382 |
+
}
|
383 |
+
|
384 |
+
|
385 |
/**
|
386 |
* Add PayPal method specific form fields, currently:
|
387 |
*
|
693 |
}
|
694 |
|
695 |
|
696 |
+
/**
|
697 |
+
* Determines if PayPal Credit is enabled.
|
698 |
+
*
|
699 |
+
* @since 2.2.0
|
700 |
+
*
|
701 |
+
* @return bool
|
702 |
+
*/
|
703 |
+
public function is_paypal_credit_enabled() {
|
704 |
+
|
705 |
+
return $this->is_paypal_credit_supported() && 'yes' === $this->enable_paypal_credit;
|
706 |
+
}
|
707 |
+
|
708 |
+
|
709 |
+
/**
|
710 |
+
* Determines if PayPal Credit is supported.
|
711 |
+
*
|
712 |
+
* @since 2.2.0
|
713 |
+
*
|
714 |
+
* @return bool
|
715 |
+
*/
|
716 |
+
public function is_paypal_credit_supported() {
|
717 |
+
|
718 |
+
return 'US' === WC()->countries->get_base_country();
|
719 |
+
}
|
720 |
+
|
721 |
+
|
722 |
+
/**
|
723 |
+
* Gets the configured button color.
|
724 |
+
*
|
725 |
+
* @since 2.2.0
|
726 |
+
*
|
727 |
+
* @return string
|
728 |
+
*/
|
729 |
+
public function get_button_color() {
|
730 |
+
|
731 |
+
return $this->get_option( 'button_color' );
|
732 |
+
}
|
733 |
+
|
734 |
+
|
735 |
+
/**
|
736 |
+
* Gets the configured button size.
|
737 |
+
*
|
738 |
+
* @since 2.2.0
|
739 |
+
*
|
740 |
+
* @return string
|
741 |
+
*/
|
742 |
+
public function get_button_size() {
|
743 |
+
|
744 |
+
return $this->get_option( 'button_size' );
|
745 |
+
}
|
746 |
+
|
747 |
+
|
748 |
+
/**
|
749 |
+
* Gets the configured button shape.
|
750 |
+
*
|
751 |
+
* @since 2.2.0
|
752 |
+
*
|
753 |
+
* @return string
|
754 |
+
*/
|
755 |
+
public function get_button_shape() {
|
756 |
+
|
757 |
+
return $this->get_option( 'button_shape' );
|
758 |
+
}
|
759 |
+
|
760 |
+
|
761 |
}
|
includes/class-wc-gateway-braintree.php
CHANGED
@@ -22,7 +22,7 @@
|
|
22 |
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
|
23 |
*/
|
24 |
|
25 |
-
use \
|
26 |
|
27 |
defined( 'ABSPATH' ) or exit;
|
28 |
|
@@ -84,7 +84,7 @@ class WC_Gateway_Braintree extends WC_Braintree_Framework\SV_WC_Payment_Gateway_
|
|
84 |
*
|
85 |
* @since 2.0.0
|
86 |
*/
|
87 |
-
|
88 |
|
89 |
parent::load_settings();
|
90 |
|
@@ -105,40 +105,13 @@ class WC_Gateway_Braintree extends WC_Braintree_Framework\SV_WC_Payment_Gateway_
|
|
105 |
if ( $this->is_available() ) {
|
106 |
|
107 |
// braintree.js library
|
108 |
-
wp_enqueue_script( 'braintree-js-client', 'https://js.braintreegateway.com/web/
|
109 |
|
110 |
parent::enqueue_gateway_assets();
|
111 |
}
|
112 |
}
|
113 |
|
114 |
|
115 |
-
/**
|
116 |
-
* Add the braintree client token to the localized script params
|
117 |
-
*
|
118 |
-
* @since 3.0.0
|
119 |
-
* @return array
|
120 |
-
*/
|
121 |
-
protected function get_gateway_js_localized_script_params() {
|
122 |
-
|
123 |
-
$params = $this->get_payment_form_js_localized_script_params();
|
124 |
-
|
125 |
-
if ( $this->is_payment_form_page() ) {
|
126 |
-
|
127 |
-
$params['integration_error_message'] = __( 'Currently unavailable. Please try a different payment method.', 'woocommerce-gateway-paypal-powered-by-braintree' );
|
128 |
-
$params['payment_error_message'] = __( 'Oops, something went wrong. Please try a different payment method.', 'woocommerce-gateway-paypal-powered-by-braintree' );
|
129 |
-
|
130 |
-
$params['ajax_url'] = admin_url( 'admin-ajax.php' );
|
131 |
-
}
|
132 |
-
|
133 |
-
// add a cart payment nonce if available
|
134 |
-
if ( $this->get_plugin()->get_paypal_cart_instance() ) {
|
135 |
-
$params['cart_payment_nonce'] = $this->get_plugin()->get_paypal_cart_instance()->get_cart_nonce();
|
136 |
-
}
|
137 |
-
|
138 |
-
return $params;
|
139 |
-
}
|
140 |
-
|
141 |
-
|
142 |
/**
|
143 |
* Gets a client authorization token via AJAX.
|
144 |
*
|
@@ -203,7 +176,11 @@ class WC_Gateway_Braintree extends WC_Braintree_Framework\SV_WC_Payment_Gateway_
|
|
203 |
|
204 |
$order = parent::get_order( $order );
|
205 |
|
206 |
-
|
|
|
|
|
|
|
|
|
207 |
$order->payment->tokenize = $this->get_payment_tokens_handler()->should_tokenize();
|
208 |
|
209 |
// billing address ID if using existing payment token
|
@@ -261,55 +238,6 @@ class WC_Gateway_Braintree extends WC_Braintree_Framework\SV_WC_Payment_Gateway_
|
|
261 |
}
|
262 |
|
263 |
|
264 |
-
/**
|
265 |
-
* Determines if the authorization for an order is valid for capture.
|
266 |
-
*
|
267 |
-
* Overridden to add the capture status to legacy orders since the v1 plugin
|
268 |
-
* may not have set it.
|
269 |
-
*
|
270 |
-
* @see \SkyVerge\Plugin_Framework\SV_WC_Payment_Gateway::has_authorization_expired()
|
271 |
-
* @since 2.0.2
|
272 |
-
* @param \WC_Order $order order object
|
273 |
-
* @return bool
|
274 |
-
*/
|
275 |
-
public function authorization_valid_for_capture( $order ) {
|
276 |
-
|
277 |
-
// if v1 never set the capture status, assume it has been captured
|
278 |
-
if ( ! in_array( $this->get_order_meta( $order, 'charge_captured' ), array( 'yes', 'no' ), true ) ) {
|
279 |
-
$this->update_order_meta( $order, 'charge_captured', 'yes' );
|
280 |
-
}
|
281 |
-
|
282 |
-
return parent::authorization_valid_for_capture( $order );
|
283 |
-
}
|
284 |
-
|
285 |
-
|
286 |
-
/**
|
287 |
-
* Determines if the authorization for an order has expired.
|
288 |
-
*
|
289 |
-
* Overridden to add the transaction date to legacy orders since the v1.x
|
290 |
-
* plugin didn't set its own transaction date meta.
|
291 |
-
*
|
292 |
-
* @see \SkyVerge\Plugin_Framework\SV_WC_Payment_Gateway::has_authorization_expired()
|
293 |
-
* @since 2.0.0
|
294 |
-
* @param \WC_Order $order the order object
|
295 |
-
* @return bool
|
296 |
-
*/
|
297 |
-
public function has_authorization_expired( $order ) {
|
298 |
-
|
299 |
-
if ( ! $this->get_order_meta( $order, 'trans_id' ) ) {
|
300 |
-
$this->update_order_meta( $order, 'trans_id', WC_Braintree_Framework\SV_WC_Order_Compatibility::get_prop( $order, 'transaction_id' ) );
|
301 |
-
}
|
302 |
-
|
303 |
-
$date_created = WC_Braintree_Framework\SV_WC_Order_Compatibility::get_date_created( $order );
|
304 |
-
|
305 |
-
if ( ! $this->get_order_meta( $order, 'trans_date' ) && $date_created ) {
|
306 |
-
$this->update_order_meta( $order, 'trans_date', $date_created->date( 'Y-m-d H:i:s' ) );
|
307 |
-
}
|
308 |
-
|
309 |
-
return parent::has_authorization_expired( $order );
|
310 |
-
}
|
311 |
-
|
312 |
-
|
313 |
/**
|
314 |
* Gets the order object with data added to process a refund.
|
315 |
*
|
@@ -336,6 +264,21 @@ class WC_Gateway_Braintree extends WC_Braintree_Framework\SV_WC_Payment_Gateway_
|
|
336 |
}
|
337 |
|
338 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
339 |
/** Tokenization methods **************************************************/
|
340 |
|
341 |
|
@@ -1199,6 +1142,7 @@ class WC_Gateway_Braintree extends WC_Braintree_Framework\SV_WC_Payment_Gateway_
|
|
1199 |
require_once( $includes_path . '/api/responses/class-wc-braintree-api-customer-response.php' );
|
1200 |
require_once( $includes_path . '/api/responses/class-wc-braintree-api-payment-method-response.php' );
|
1201 |
require_once( $includes_path . '/api/responses/class-wc-braintree-api-payment-method-nonce-response.php' );
|
|
|
1202 |
|
1203 |
return $this->api = new WC_Braintree_API( $this );
|
1204 |
}
|
22 |
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
|
23 |
*/
|
24 |
|
25 |
+
use WC_Braintree\Plugin_Framework as WC_Braintree_Framework;
|
26 |
|
27 |
defined( 'ABSPATH' ) or exit;
|
28 |
|
84 |
*
|
85 |
* @since 2.0.0
|
86 |
*/
|
87 |
+
public function load_settings() {
|
88 |
|
89 |
parent::load_settings();
|
90 |
|
105 |
if ( $this->is_available() ) {
|
106 |
|
107 |
// braintree.js library
|
108 |
+
wp_enqueue_script( 'braintree-js-client', 'https://js.braintreegateway.com/web/' . WC_Braintree::BRAINTREE_JS_SDK_VERSION . '/js/client.min.js', array(), WC_Braintree::VERSION, true );
|
109 |
|
110 |
parent::enqueue_gateway_assets();
|
111 |
}
|
112 |
}
|
113 |
|
114 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
115 |
/**
|
116 |
* Gets a client authorization token via AJAX.
|
117 |
*
|
176 |
|
177 |
$order = parent::get_order( $order );
|
178 |
|
179 |
+
// nonce may be previously populated by Apple Pay
|
180 |
+
if ( empty( $order->payment->nonce ) ) {
|
181 |
+
$order->payment->nonce = WC_Braintree_Framework\SV_WC_Helper::get_post( 'wc_'. $this->get_id() . '_payment_nonce' );
|
182 |
+
}
|
183 |
+
|
184 |
$order->payment->tokenize = $this->get_payment_tokens_handler()->should_tokenize();
|
185 |
|
186 |
// billing address ID if using existing payment token
|
238 |
}
|
239 |
|
240 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
241 |
/**
|
242 |
* Gets the order object with data added to process a refund.
|
243 |
*
|
264 |
}
|
265 |
|
266 |
|
267 |
+
/**
|
268 |
+
* Gets the capture handler.
|
269 |
+
*
|
270 |
+
* @since 2.2.0
|
271 |
+
*
|
272 |
+
* @return \WC_Braintree\Capture
|
273 |
+
*/
|
274 |
+
public function get_capture_handler() {
|
275 |
+
|
276 |
+
require_once( $this->get_plugin()->get_plugin_path() . '/includes/class-wc-braintree-capture.php' );
|
277 |
+
|
278 |
+
return new \WC_Braintree\Capture( $this );
|
279 |
+
}
|
280 |
+
|
281 |
+
|
282 |
/** Tokenization methods **************************************************/
|
283 |
|
284 |
|
1142 |
require_once( $includes_path . '/api/responses/class-wc-braintree-api-customer-response.php' );
|
1143 |
require_once( $includes_path . '/api/responses/class-wc-braintree-api-payment-method-response.php' );
|
1144 |
require_once( $includes_path . '/api/responses/class-wc-braintree-api-payment-method-nonce-response.php' );
|
1145 |
+
require_once( $includes_path . '/api/responses/class-wc-braintree-api-merchant-configuration-response.php' );
|
1146 |
|
1147 |
return $this->api = new WC_Braintree_API( $this );
|
1148 |
}
|
includes/payment-forms/abstract-wc-braintree-payment-form.php
CHANGED
@@ -22,7 +22,7 @@
|
|
22 |
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
|
23 |
*/
|
24 |
|
25 |
-
use \
|
26 |
|
27 |
defined( 'ABSPATH' ) or exit;
|
28 |
|
@@ -84,10 +84,18 @@ abstract class WC_Braintree_Payment_Form extends WC_Braintree_Framework\SV_WC_Pa
|
|
84 |
/**
|
85 |
* Get gateway-specific JS params that are passed to the payment form handler script
|
86 |
*
|
87 |
-
* @since
|
|
|
88 |
* @return array
|
89 |
*/
|
90 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
91 |
|
92 |
|
93 |
/**
|
@@ -103,6 +111,7 @@ abstract class WC_Braintree_Payment_Form extends WC_Braintree_Framework\SV_WC_Pa
|
|
103 |
$params = array_merge( array(
|
104 |
'id' => $this->get_gateway()->get_id(),
|
105 |
'id_dasherized' => $this->get_gateway()->get_id_dasherized(),
|
|
|
106 |
'debug' => $this->get_gateway()->debug_log(),
|
107 |
'type' => str_replace( '-', '_', $this->get_gateway()->get_payment_type() ),
|
108 |
'client_token_nonce' => wp_create_nonce( 'wc_' . $this->get_gateway()->get_id() . '_get_client_token' ),
|
22 |
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
|
23 |
*/
|
24 |
|
25 |
+
use WC_Braintree\Plugin_Framework as WC_Braintree_Framework;
|
26 |
|
27 |
defined( 'ABSPATH' ) or exit;
|
28 |
|
84 |
/**
|
85 |
* Get gateway-specific JS params that are passed to the payment form handler script
|
86 |
*
|
87 |
+
* @since 2.0.0
|
88 |
+
*
|
89 |
* @return array
|
90 |
*/
|
91 |
+
protected function get_payment_form_handler_js_params() {
|
92 |
+
|
93 |
+
return [
|
94 |
+
'integration_error_message' => __( 'Currently unavailable. Please try a different payment method.', 'woocommerce-gateway-paypal-powered-by-braintree' ),
|
95 |
+
'payment_error_message' => __( 'Oops, something went wrong. Please try a different payment method.', 'woocommerce-gateway-paypal-powered-by-braintree' ),
|
96 |
+
'ajax_url' => admin_url( 'admin-ajax.php' ),
|
97 |
+
];
|
98 |
+
}
|
99 |
|
100 |
|
101 |
/**
|
111 |
$params = array_merge( array(
|
112 |
'id' => $this->get_gateway()->get_id(),
|
113 |
'id_dasherized' => $this->get_gateway()->get_id_dasherized(),
|
114 |
+
'name' => $this->get_gateway()->get_method_title(),
|
115 |
'debug' => $this->get_gateway()->debug_log(),
|
116 |
'type' => str_replace( '-', '_', $this->get_gateway()->get_payment_type() ),
|
117 |
'client_token_nonce' => wp_create_nonce( 'wc_' . $this->get_gateway()->get_id() . '_get_client_token' ),
|
includes/payment-forms/class-wc-braintree-hosted-fields-payment-form.php
CHANGED
@@ -22,7 +22,7 @@
|
|
22 |
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
|
23 |
*/
|
24 |
|
25 |
-
use \
|
26 |
|
27 |
defined( 'ABSPATH' ) or exit;
|
28 |
|
@@ -30,6 +30,8 @@ defined( 'ABSPATH' ) or exit;
|
|
30 |
* Braintree Hosted Fields Payment Form
|
31 |
*
|
32 |
* @since 3.0.0
|
|
|
|
|
33 |
*/
|
34 |
class WC_Braintree_Hosted_Fields_Payment_Form extends WC_Braintree_Payment_Form {
|
35 |
|
@@ -47,11 +49,10 @@ class WC_Braintree_Hosted_Fields_Payment_Form extends WC_Braintree_Payment_Form
|
|
47 |
|
48 |
$html = parent::get_saved_payment_method_html( $token );
|
49 |
|
50 |
-
if (
|
51 |
|
52 |
if ( $nonce = $this->get_gateway()->get_3d_secure_nonce_for_token( $token ) ) {
|
53 |
-
|
54 |
-
$html = str_replace( 'name="wc-braintree-credit-card-payment-token"', 'name="wc-braintree-credit-card-payment-token" data-nonce="' . $nonce . '"', $html );
|
55 |
}
|
56 |
}
|
57 |
|
@@ -116,16 +117,32 @@ class WC_Braintree_Hosted_Fields_Payment_Form extends WC_Braintree_Payment_Form
|
|
116 |
*/
|
117 |
protected function get_payment_form_handler_js_params() {
|
118 |
|
119 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
120 |
'csc_required' => $this->get_gateway()->is_csc_required(),
|
121 |
'threeds' => array(
|
122 |
-
'enabled' => is_add_payment_method_page()
|
123 |
'liability_shift_always_required' => $this->get_gateway()->is_3d_secure_liability_shift_always_required(),
|
|
|
|
|
124 |
'failure_message' => __( 'We cannot process your order with the payment information that you provided. Please use an alternate payment method.', 'woocommerce-gateway-paypal-powered-by-braintree' ),
|
125 |
),
|
126 |
'hosted_fields_styles' => $this->get_hosted_fields_styles(),
|
127 |
'enabled_card_types' => $this->get_enabled_card_types(),
|
128 |
-
);
|
|
|
|
|
129 |
}
|
130 |
|
131 |
|
@@ -138,7 +155,7 @@ class WC_Braintree_Hosted_Fields_Payment_Form extends WC_Braintree_Payment_Form
|
|
138 |
*/
|
139 |
protected function get_enabled_card_types() {
|
140 |
|
141 |
-
$types = array_map( array( '\\
|
142 |
|
143 |
// The Braintree SDK has its own strings for a few card types that we need to match
|
144 |
$types = str_replace( array(
|
@@ -188,26 +205,20 @@ class WC_Braintree_Hosted_Fields_Payment_Form extends WC_Braintree_Payment_Form
|
|
188 |
|
189 |
|
190 |
/**
|
191 |
-
*
|
192 |
-
*
|
193 |
-
* 1) the order total, which is needed during the verification process client-side.
|
194 |
-
* While this can be modified client-side, the order total is later verified server-side.
|
195 |
-
*
|
196 |
-
* 2) a flag to indicate client-side verification passed and server-side validations
|
197 |
-
* should be performed
|
198 |
*
|
199 |
* @since 3.0.0
|
200 |
*/
|
201 |
public function render_payment_fields() {
|
202 |
|
203 |
-
|
204 |
-
|
205 |
-
|
|
|
|
|
206 |
|
207 |
-
|
208 |
-
|
209 |
-
<input type="hidden" name="wc_braintree_credit_card_3d_secure_verified" value="0" />
|
210 |
-
<?php
|
211 |
}
|
212 |
|
213 |
parent::render_payment_fields();
|
22 |
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
|
23 |
*/
|
24 |
|
25 |
+
use WC_Braintree\Plugin_Framework as WC_Braintree_Framework;
|
26 |
|
27 |
defined( 'ABSPATH' ) or exit;
|
28 |
|
30 |
* Braintree Hosted Fields Payment Form
|
31 |
*
|
32 |
* @since 3.0.0
|
33 |
+
*
|
34 |
+
* @method \WC_Gateway_Braintree_Credit_Card get_gateway()
|
35 |
*/
|
36 |
class WC_Braintree_Hosted_Fields_Payment_Form extends WC_Braintree_Payment_Form {
|
37 |
|
49 |
|
50 |
$html = parent::get_saved_payment_method_html( $token );
|
51 |
|
52 |
+
if ( ! WC_Braintree_Framework\SV_WC_Helper::str_exists( $html, 'data-nonce' ) && in_array( WC_Braintree_Framework\SV_WC_Payment_Gateway_Helper::normalize_card_type( $token->get_card_type() ), $this->get_gateway()->get_3d_secure_card_types(), true ) ) {
|
53 |
|
54 |
if ( $nonce = $this->get_gateway()->get_3d_secure_nonce_for_token( $token ) ) {
|
55 |
+
$html = str_replace( 'name="wc-braintree-credit-card-payment-token"', 'name="wc-braintree-credit-card-payment-token" data-nonce="' . esc_attr( $nonce ) . '"', $html );
|
|
|
56 |
}
|
57 |
}
|
58 |
|
117 |
*/
|
118 |
protected function get_payment_form_handler_js_params() {
|
119 |
|
120 |
+
$params = parent::get_payment_form_handler_js_params();
|
121 |
+
|
122 |
+
// Braintree JS only returns the full names, so ensure they're correctly formatted from settings
|
123 |
+
$braintree_card_types = array(
|
124 |
+
'American Express' => WC_Braintree_Framework\SV_WC_Payment_Gateway_Helper::CARD_TYPE_AMEX ,
|
125 |
+
'MasterCard' => WC_Braintree_Framework\SV_WC_Payment_Gateway_Helper::CARD_TYPE_MASTERCARD,
|
126 |
+
'Visa' => WC_Braintree_Framework\SV_WC_Payment_Gateway_Helper::CARD_TYPE_VISA,
|
127 |
+
'Maestro' => WC_Braintree_Framework\SV_WC_Payment_Gateway_Helper::CARD_TYPE_MAESTRO,
|
128 |
+
);
|
129 |
+
|
130 |
+
$card_types = array_keys( array_intersect( $braintree_card_types, $this->get_gateway()->get_3d_secure_card_types() ) );
|
131 |
+
|
132 |
+
$params = array_merge( $params, [
|
133 |
'csc_required' => $this->get_gateway()->is_csc_required(),
|
134 |
'threeds' => array(
|
135 |
+
'enabled' => ! is_add_payment_method_page() && $this->get_gateway()->is_3d_secure_enabled(), // setting this to false overrides any account configuration
|
136 |
'liability_shift_always_required' => $this->get_gateway()->is_3d_secure_liability_shift_always_required(),
|
137 |
+
'card_types' => $card_types,
|
138 |
+
'order_total' => WC_Braintree_Framework\SV_WC_Helper::number_format( $this->get_order_total() ),
|
139 |
'failure_message' => __( 'We cannot process your order with the payment information that you provided. Please use an alternate payment method.', 'woocommerce-gateway-paypal-powered-by-braintree' ),
|
140 |
),
|
141 |
'hosted_fields_styles' => $this->get_hosted_fields_styles(),
|
142 |
'enabled_card_types' => $this->get_enabled_card_types(),
|
143 |
+
] );
|
144 |
+
|
145 |
+
return $params;
|
146 |
}
|
147 |
|
148 |
|
155 |
*/
|
156 |
protected function get_enabled_card_types() {
|
157 |
|
158 |
+
$types = array_map( array( '\\WC_Braintree\\Plugin_Framework\\SV_WC_Payment_Gateway_Helper', 'normalize_card_type' ), $this->get_gateway()->get_card_types() );
|
159 |
|
160 |
// The Braintree SDK has its own strings for a few card types that we need to match
|
161 |
$types = str_replace( array(
|
205 |
|
206 |
|
207 |
/**
|
208 |
+
* Renders hidden inputs for the handling 3D Secure transactions.
|
|
|
|
|
|
|
|
|
|
|
|
|
209 |
*
|
210 |
* @since 3.0.0
|
211 |
*/
|
212 |
public function render_payment_fields() {
|
213 |
|
214 |
+
$fields = [
|
215 |
+
'card-type',
|
216 |
+
'3d-secure-enabled',
|
217 |
+
'3d-secure-verified',
|
218 |
+
];
|
219 |
|
220 |
+
foreach ( $fields as $field ) {
|
221 |
+
echo '<input type="hidden" name="wc-' . $this->get_gateway()->get_id_dasherized() . '-' . esc_attr( $field ) . '" value="" />';
|
|
|
|
|
222 |
}
|
223 |
|
224 |
parent::render_payment_fields();
|
includes/payment-forms/class-wc-braintree-paypal-payment-form.php
CHANGED
@@ -22,7 +22,7 @@
|
|
22 |
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
|
23 |
*/
|
24 |
|
25 |
-
use \
|
26 |
|
27 |
defined( 'ABSPATH' ) or exit;
|
28 |
|
@@ -41,13 +41,17 @@ class WC_Braintree_PayPal_Payment_Form extends WC_Braintree_Payment_Form {
|
|
41 |
* @see WC_Braintree_Payment_Form::get_payment_form_handler_js_params()
|
42 |
* @return array
|
43 |
*/
|
44 |
-
|
|
|
|
|
45 |
|
46 |
$default_button_styles = array(
|
47 |
-
'label'
|
48 |
-
'size'
|
49 |
-
'shape'
|
50 |
-
'color'
|
|
|
|
|
51 |
);
|
52 |
|
53 |
// tweak the styles a bit for better display on the Add Payment Method page
|
@@ -67,12 +71,21 @@ class WC_Braintree_PayPal_Payment_Form extends WC_Braintree_Payment_Form {
|
|
67 |
*/
|
68 |
$button_styles = apply_filters( 'wc_' . $this->get_gateway()->get_id() . '_button_styles', $default_button_styles );
|
69 |
|
70 |
-
|
|
|
|
|
|
|
|
|
|
|
71 |
'is_test_environment' => $this->get_gateway()->is_test_environment(),
|
|
|
72 |
'must_login_message' => __( 'Please click the "PayPal" button below to log into your PayPal account before placing your order.', 'woocommerce-gateway-paypal-powered-by-braintree' ),
|
73 |
'must_login_add_method_message' => __( 'Please click the "PayPal" button below to log into your PayPal account before adding your payment method.', 'woocommerce-gateway-paypal-powered-by-braintree' ),
|
74 |
'button_styles' => wp_parse_args( $button_styles, $default_button_styles ), // ensure all expected parameters are present after filtering to avoid JS errors
|
75 |
-
|
|
|
|
|
|
|
76 |
}
|
77 |
|
78 |
|
22 |
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
|
23 |
*/
|
24 |
|
25 |
+
use WC_Braintree\Plugin_Framework as WC_Braintree_Framework;
|
26 |
|
27 |
defined( 'ABSPATH' ) or exit;
|
28 |
|
41 |
* @see WC_Braintree_Payment_Form::get_payment_form_handler_js_params()
|
42 |
* @return array
|
43 |
*/
|
44 |
+
public function get_payment_form_handler_js_params() {
|
45 |
+
|
46 |
+
$params = parent::get_payment_form_handler_js_params();
|
47 |
|
48 |
$default_button_styles = array(
|
49 |
+
'label' => 'pay',
|
50 |
+
'size' => $this->get_gateway()->get_button_size(),
|
51 |
+
'shape' => $this->get_gateway()->get_button_shape(),
|
52 |
+
'color' => $this->get_gateway()->get_button_color(),
|
53 |
+
'layout' => 'vertical',
|
54 |
+
'tagline' => false,
|
55 |
);
|
56 |
|
57 |
// tweak the styles a bit for better display on the Add Payment Method page
|
71 |
*/
|
72 |
$button_styles = apply_filters( 'wc_' . $this->get_gateway()->get_id() . '_button_styles', $default_button_styles );
|
73 |
|
74 |
+
// PayPal requires at least medium-size buttons for the vertical layout, so force that to prevent JS errors after filtering
|
75 |
+
if ( isset( $button_styles['layout'], $button_styles['size'] ) && 'vertical' === $button_styles['layout'] && 'small' === $button_styles['size'] ) {
|
76 |
+
$button_styles['size'] = 'medium';
|
77 |
+
}
|
78 |
+
|
79 |
+
$params = array_merge( $params, [
|
80 |
'is_test_environment' => $this->get_gateway()->is_test_environment(),
|
81 |
+
'is_paypal_credit_enabled' => $this->get_gateway()->is_paypal_credit_enabled(),
|
82 |
'must_login_message' => __( 'Please click the "PayPal" button below to log into your PayPal account before placing your order.', 'woocommerce-gateway-paypal-powered-by-braintree' ),
|
83 |
'must_login_add_method_message' => __( 'Please click the "PayPal" button below to log into your PayPal account before adding your payment method.', 'woocommerce-gateway-paypal-powered-by-braintree' ),
|
84 |
'button_styles' => wp_parse_args( $button_styles, $default_button_styles ), // ensure all expected parameters are present after filtering to avoid JS errors
|
85 |
+
'cart_payment_nonce' => $this->get_gateway()->get_plugin()->get_paypal_cart_instance()->get_cart_nonce(),
|
86 |
+
] );
|
87 |
+
|
88 |
+
return $params;
|
89 |
}
|
90 |
|
91 |
|
lib/skyverge/license.txt
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
WooCommerce Plugin Framework
|
2 |
|
3 |
-
Copyright 2013-
|
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
|
1 |
WooCommerce Plugin Framework
|
2 |
|
3 |
+
Copyright 2013-2018, SkyVerge, Inc.
|
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
|
lib/skyverge/woocommerce/Addresses/Address.php
ADDED
@@ -0,0 +1,290 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* WooCommerce Plugin Framework
|
4 |
+
*
|
5 |
+
* This source file is subject to the GNU General Public License v3.0
|
6 |
+
* that is bundled with this package in the file license.txt.
|
7 |
+
* It is also available through the world-wide-web at this URL:
|
8 |
+
* http://www.gnu.org/licenses/gpl-3.0.html
|
9 |
+
* If you did not receive a copy of the license and are unable to
|
10 |
+
* obtain it through the world-wide-web, please send an email
|
11 |
+
* to license@skyverge.com so we can send you a copy immediately.
|
12 |
+
*
|
13 |
+
* DISCLAIMER
|
14 |
+
*
|
15 |
+
* Do not edit or add to this file if you wish to upgrade the plugin to newer
|
16 |
+
* versions in the future. If you wish to customize the plugin for your
|
17 |
+
* needs please refer to http://www.skyverge.com
|
18 |
+
*
|
19 |
+
* @package SkyVerge/WooCommerce/Plugin/Classes
|
20 |
+
* @author SkyVerge
|
21 |
+
* @copyright Copyright (c) 2013-2018, SkyVerge, Inc.
|
22 |
+
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
|
23 |
+
*/
|
24 |
+
|
25 |
+
namespace WC_Braintree\Plugin_Framework\Addresses;
|
26 |
+
|
27 |
+
defined( 'ABSPATH' ) or exit;
|
28 |
+
|
29 |
+
if ( ! class_exists( '\\WC_Braintree\\Plugin_Framework\\Addresses\\Address' ) ) :
|
30 |
+
|
31 |
+
/**
|
32 |
+
* The base address data class.
|
33 |
+
*
|
34 |
+
* This serves as a standard address object to be passed around by plugins whenever dealing with address data, and
|
35 |
+
* eliminates the need to rely on WooCommerce's address arrays.
|
36 |
+
*
|
37 |
+
* @since 5.3.0-dev
|
38 |
+
*/
|
39 |
+
class Address {
|
40 |
+
|
41 |
+
|
42 |
+
/** @var string line 1 of the street address */
|
43 |
+
protected $line_1 = '';
|
44 |
+
|
45 |
+
/** @var string line 2 of the street address */
|
46 |
+
protected $line_2 = '';
|
47 |
+
|
48 |
+
/** @var string line 3 of the street address */
|
49 |
+
protected $line_3 = '';
|
50 |
+
|
51 |
+
/** @var string address locality (city) */
|
52 |
+
protected $locality = '';
|
53 |
+
|
54 |
+
/** @var string address region (state) */
|
55 |
+
protected $region = '';
|
56 |
+
|
57 |
+
/** @var string address country */
|
58 |
+
protected $country = '';
|
59 |
+
|
60 |
+
/** @var string address postcode */
|
61 |
+
protected $postcode = '';
|
62 |
+
|
63 |
+
|
64 |
+
/** Getter methods ************************************************************************************************/
|
65 |
+
|
66 |
+
|
67 |
+
/**
|
68 |
+
* Gets line 1 of the street address.
|
69 |
+
*
|
70 |
+
* @since 5.3.0-dev
|
71 |
+
*
|
72 |
+
* @return string
|
73 |
+
*/
|
74 |
+
public function get_line_1() {
|
75 |
+
|
76 |
+
return $this->line_1;
|
77 |
+
}
|
78 |
+
|
79 |
+
|
80 |
+
/**
|
81 |
+
* Gets line 2 of the street address.
|
82 |
+
*
|
83 |
+
* @since 5.3.0-dev
|
84 |
+
*
|
85 |
+
* @return string
|
86 |
+
*/
|
87 |
+
public function get_line_2() {
|
88 |
+
|
89 |
+
return $this->line_2;
|
90 |
+
}
|
91 |
+
|
92 |
+
|
93 |
+
/**
|
94 |
+
* Gets line 3 of the street address.
|
95 |
+
*
|
96 |
+
* @since 5.3.0-dev
|
97 |
+
*
|
98 |
+
* @return string
|
99 |
+
*/
|
100 |
+
public function get_line_3() {
|
101 |
+
|
102 |
+
return $this->line_3;
|
103 |
+
}
|
104 |
+
|
105 |
+
|
106 |
+
/**
|
107 |
+
* Gets the locality or city.
|
108 |
+
*
|
109 |
+
* @since 5.3.0-dev
|
110 |
+
*
|
111 |
+
* @return string
|
112 |
+
*/
|
113 |
+
public function get_locality() {
|
114 |
+
|
115 |
+
return $this->locality;
|
116 |
+
}
|
117 |
+
|
118 |
+
|
119 |
+
/**
|
120 |
+
* Gets the region or state.
|
121 |
+
*
|
122 |
+
* @since 5.3.0-dev
|
123 |
+
*
|
124 |
+
* @return string
|
125 |
+
*/
|
126 |
+
public function get_region() {
|
127 |
+
|
128 |
+
return $this->region;
|
129 |
+
}
|
130 |
+
|
131 |
+
|
132 |
+
/**
|
133 |
+
* Gets the country.
|
134 |
+
*
|
135 |
+
* @since 5.3.0-dev
|
136 |
+
*
|
137 |
+
* @return string
|
138 |
+
*/
|
139 |
+
public function get_country() {
|
140 |
+
|
141 |
+
return $this->country;
|
142 |
+
}
|
143 |
+
|
144 |
+
|
145 |
+
/**
|
146 |
+
* Gets the postcode.
|
147 |
+
*
|
148 |
+
* @since 5.3.0-dev
|
149 |
+
*
|
150 |
+
* @return string
|
151 |
+
*/
|
152 |
+
public function get_postcode() {
|
153 |
+
|
154 |
+
return $this->postcode;
|
155 |
+
}
|
156 |
+
|
157 |
+
|
158 |
+
/**
|
159 |
+
* Gets the hash representation of this address.
|
160 |
+
*
|
161 |
+
* @see Address::get_hash_data()
|
162 |
+
*
|
163 |
+
* @since 5.3.0-dev
|
164 |
+
*
|
165 |
+
* @return string
|
166 |
+
*/
|
167 |
+
public function get_hash() {
|
168 |
+
|
169 |
+
return md5( json_encode( $this->get_hash_data() ) );
|
170 |
+
}
|
171 |
+
|
172 |
+
|
173 |
+
/**
|
174 |
+
* Gets the data used to generate a hash for the address.
|
175 |
+
*
|
176 |
+
* @since 5.3.0-dev
|
177 |
+
*
|
178 |
+
* @return string[]
|
179 |
+
*/
|
180 |
+
protected function get_hash_data() {
|
181 |
+
|
182 |
+
return array(
|
183 |
+
$this->get_line_1(),
|
184 |
+
$this->get_line_2(),
|
185 |
+
$this->get_line_3(),
|
186 |
+
$this->get_locality(),
|
187 |
+
$this->get_region(),
|
188 |
+
$this->get_country(),
|
189 |
+
$this->get_postcode(),
|
190 |
+
);
|
191 |
+
}
|
192 |
+
|
193 |
+
|
194 |
+
/** Setter methods ************************************************************************************************/
|
195 |
+
|
196 |
+
|
197 |
+
/**
|
198 |
+
* Sets line 1 of the street address.
|
199 |
+
*
|
200 |
+
* @since 5.3.0-dev
|
201 |
+
*
|
202 |
+
* @param string $value line 1 value
|
203 |
+
*/
|
204 |
+
public function set_line_1( $value ) {
|
205 |
+
|
206 |
+
$this->line_1 = $value;
|
207 |
+
}
|
208 |
+
|
209 |
+
|
210 |
+
/**
|
211 |
+
* Sets line 2 of the street address.
|
212 |
+
*
|
213 |
+
* @since 5.3.0-dev
|
214 |
+
*
|
215 |
+
* @param string $value line 2 value
|
216 |
+
*/
|
217 |
+
public function set_line_2( $value ) {
|
218 |
+
|
219 |
+
$this->line_2 = $value;
|
220 |
+
}
|
221 |
+
|
222 |
+
|
223 |
+
/**
|
224 |
+
* Gets line 3 of the street address.
|
225 |
+
*
|
226 |
+
* @since 5.3.0-dev
|
227 |
+
*
|
228 |
+
* @param string $value line 3 value
|
229 |
+
*/
|
230 |
+
public function set_line_3( $value ) {
|
231 |
+
|
232 |
+
$this->line_3 = $value;
|
233 |
+
}
|
234 |
+
|
235 |
+
|
236 |
+
/**
|
237 |
+
* Gets the locality or city.
|
238 |
+
*
|
239 |
+
* @since 5.3.0-dev
|
240 |
+
*
|
241 |
+
* @param string $value locality value
|
242 |
+
*/
|
243 |
+
public function set_locality( $value ) {
|
244 |
+
|
245 |
+
$this->locality = $value;
|
246 |
+
}
|
247 |
+
|
248 |
+
|
249 |
+
/**
|
250 |
+
* Gets the region or state.
|
251 |
+
*
|
252 |
+
* @since 5.3.0-dev
|
253 |
+
*
|
254 |
+
* @param string $value region value
|
255 |
+
*/
|
256 |
+
public function set_region( $value ) {
|
257 |
+
|
258 |
+
$this->region = $value;
|
259 |
+
}
|
260 |
+
|
261 |
+
|
262 |
+
/**
|
263 |
+
* Sets the country.
|
264 |
+
*
|
265 |
+
* @since 5.3.0-dev
|
266 |
+
*
|
267 |
+
* @param string $value country value
|
268 |
+
*/
|
269 |
+
public function set_country( $value ) {
|
270 |
+
|
271 |
+
$this->country = $value;
|
272 |
+
}
|
273 |
+
|
274 |
+
|
275 |
+
/**
|
276 |
+
* Sets the postcode.
|
277 |
+
*
|
278 |
+
* @since 5.3.0-dev
|
279 |
+
*
|
280 |
+
* @param string $value postcode value
|
281 |
+
*/
|
282 |
+
public function set_postcode( $value ) {
|
283 |
+
|
284 |
+
$this->postcode = $value;
|
285 |
+
}
|
286 |
+
|
287 |
+
|
288 |
+
}
|
289 |
+
|
290 |
+
endif;
|
lib/skyverge/woocommerce/Addresses/Customer_Address.php
ADDED
@@ -0,0 +1,154 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* WooCommerce Plugin Framework
|
4 |
+
*
|
5 |
+
* This source file is subject to the GNU General Public License v3.0
|
6 |
+
* that is bundled with this package in the file license.txt.
|
7 |
+
* It is also available through the world-wide-web at this URL:
|
8 |
+
* http://www.gnu.org/licenses/gpl-3.0.html
|
9 |
+
* If you did not receive a copy of the license and are unable to
|
10 |
+
* obtain it through the world-wide-web, please send an email
|
11 |
+
* to license@skyverge.com so we can send you a copy immediately.
|
12 |
+
*
|
13 |
+
* DISCLAIMER
|
14 |
+
*
|
15 |
+
* Do not edit or add to this file if you wish to upgrade the plugin to newer
|
16 |
+
* versions in the future. If you wish to customize the plugin for your
|
17 |
+
* needs please refer to http://www.skyverge.com
|
18 |
+
*
|
19 |
+
* @package SkyVerge/WooCommerce/Plugin/Classes
|
20 |
+
* @author SkyVerge
|
21 |
+
* @copyright Copyright (c) 2013-2018, SkyVerge, Inc.
|
22 |
+
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
|
23 |
+
*/
|
24 |
+
|
25 |
+
namespace WC_Braintree\Plugin_Framework\Addresses;
|
26 |
+
use WC_Braintree\Plugin_Framework as Framework;
|
27 |
+
|
28 |
+
defined( 'ABSPATH' ) or exit;
|
29 |
+
|
30 |
+
if ( ! class_exists( '\\WC_Braintree\\Plugin_Framework\\Addresses\\Customer_Address' ) ) :
|
31 |
+
|
32 |
+
/**
|
33 |
+
* The customer address data class.
|
34 |
+
*
|
35 |
+
* Adds customer-specific data to a base address, as used for a billing or shipping address that can include first
|
36 |
+
* and last name.
|
37 |
+
*
|
38 |
+
* @see Address
|
39 |
+
*
|
40 |
+
* @since 5.3.0-dev
|
41 |
+
*/
|
42 |
+
class Customer_Address extends Address {
|
43 |
+
|
44 |
+
|
45 |
+
/** @var string customer first name */
|
46 |
+
protected $first_name = '';
|
47 |
+
|
48 |
+
/** @var string customer last name */
|
49 |
+
protected $last_name = '';
|
50 |
+
|
51 |
+
|
52 |
+
/** Getter Methods ************************************************************************************************/
|
53 |
+
|
54 |
+
|
55 |
+
/**
|
56 |
+
* Gets the customer first name.
|
57 |
+
*
|
58 |
+
* @since 5.3.0-dev
|
59 |
+
*
|
60 |
+
* @return string
|
61 |
+
*/
|
62 |
+
public function get_first_name() {
|
63 |
+
|
64 |
+
return $this->first_name;
|
65 |
+
}
|
66 |
+
|
67 |
+
|
68 |
+
/**
|
69 |
+
* Gets the customer first name.
|
70 |
+
*
|
71 |
+
* @since 5.3.0-dev
|
72 |
+
*
|
73 |
+
* @return string
|
74 |
+
*/
|
75 |
+
public function get_last_name() {
|
76 |
+
|
77 |
+
return $this->last_name;
|
78 |
+
}
|
79 |
+
|
80 |
+
|
81 |
+
/**
|
82 |
+
* Gets the data used to generate a hash for the address.
|
83 |
+
*
|
84 |
+
* @see Address::get_hash_data()
|
85 |
+
*
|
86 |
+
* @since 5.3.0-dev
|
87 |
+
*
|
88 |
+
* @return string[]
|
89 |
+
*/
|
90 |
+
protected function get_hash_data() {
|
91 |
+
|
92 |
+
// add the first & last name to data used to generate the hash
|
93 |
+
$data = array_merge( array(
|
94 |
+
$this->get_first_name(),
|
95 |
+
$this->get_last_name(),
|
96 |
+
), parent::get_hash_data() );
|
97 |
+
|
98 |
+
return $data;
|
99 |
+
}
|
100 |
+
|
101 |
+
|
102 |
+
/** Setter Methods ************************************************************************************************/
|
103 |
+
|
104 |
+
|
105 |
+
/**
|
106 |
+
* Sets the customer first name.
|
107 |
+
*
|
108 |
+
* @since 5.3.0-dev
|
109 |
+
*
|
110 |
+
* @param string $value first name value
|
111 |
+
*/
|
112 |
+
public function set_first_name( $value ) {
|
113 |
+
|
114 |
+
$this->first_name = $value;
|
115 |
+
}
|
116 |
+
|
117 |
+
|
118 |
+
/**
|
119 |
+
* Sets the customer last name.
|
120 |
+
*
|
121 |
+
* @since 5.3.0-dev
|
122 |
+
*
|
123 |
+
* @param string $value first name value
|
124 |
+
*/
|
125 |
+
public function set_last_name( $value ) {
|
126 |
+
|
127 |
+
$this->last_name = $value;
|
128 |
+
}
|
129 |
+
|
130 |
+
|
131 |
+
/**
|
132 |
+
* Sets the full address based on a WooCommerce order.
|
133 |
+
*
|
134 |
+
* @since 5.3.0-dev
|
135 |
+
*
|
136 |
+
* @param \WC_Order $order WooCommerce order object
|
137 |
+
* @param string $type address type, like billing or shipping
|
138 |
+
*/
|
139 |
+
public function set_from_order( \WC_Order $order, $type = 'billing' ) {
|
140 |
+
|
141 |
+
$this->set_first_name( Framework\SV_WC_Order_Compatibility::get_prop( $order, "{$type}_first_name" ) );
|
142 |
+
$this->set_last_name( Framework\SV_WC_Order_Compatibility::get_prop( $order, "{$type}_last_name" ) );
|
143 |
+
$this->set_line_1( Framework\SV_WC_Order_Compatibility::get_prop( $order, "{$type}_address_1" ) );
|
144 |
+
$this->set_line_2( Framework\SV_WC_Order_Compatibility::get_prop( $order, "{$type}_address_2" ) );
|
145 |
+
$this->set_locality( Framework\SV_WC_Order_Compatibility::get_prop( $order, "{$type}_city" ) );
|
146 |
+
$this->set_region( Framework\SV_WC_Order_Compatibility::get_prop( $order, "{$type}_state" ) );
|
147 |
+
$this->set_country( Framework\SV_WC_Order_Compatibility::get_prop( $order, "{$type}_country" ) );
|
148 |
+
$this->set_postcode( Framework\SV_WC_Order_Compatibility::get_prop( $order, "{$type}_postcode" ) );
|
149 |
+
}
|
150 |
+
|
151 |
+
|
152 |
+
}
|
153 |
+
|
154 |
+
endif;
|
lib/skyverge/woocommerce/Lifecycle.php
ADDED
@@ -0,0 +1,511 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* WooCommerce Plugin Framework
|
4 |
+
*
|
5 |
+
* This source file is subject to the GNU General Public License v3.0
|
6 |
+
* that is bundled with this package in the file license.txt.
|
7 |
+
* It is also available through the world-wide-web at this URL:
|
8 |
+
* http://www.gnu.org/licenses/gpl-3.0.html
|
9 |
+
* If you did not receive a copy of the license and are unable to
|
10 |
+
* obtain it through the world-wide-web, please send an email
|
11 |
+
* to license@skyverge.com so we can send you a copy immediately.
|
12 |
+
*
|
13 |
+
* DISCLAIMER
|
14 |
+
*
|
15 |
+
* Do not edit or add to this file if you wish to upgrade the plugin to newer
|
16 |
+
* versions in the future. If you wish to customize the plugin for your
|
17 |
+
* needs please refer to http://www.skyverge.com
|
18 |
+
*
|
19 |
+
* @package SkyVerge/WooCommerce/Plugin/Classes
|
20 |
+
* @author SkyVerge
|
21 |
+
* @copyright Copyright (c) 2013-2018, SkyVerge, Inc.
|
22 |
+
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
|
23 |
+
*/
|
24 |
+
|
25 |
+
namespace WC_Braintree\Plugin_Framework\Plugin;
|
26 |
+
|
27 |
+
defined( 'ABSPATH' ) or exit;
|
28 |
+
|
29 |
+
if ( ! class_exists( '\\WC_Braintree\\Plugin_Framework\\Plugin\\Lifecycle' ) ) :
|
30 |
+
|
31 |
+
/**
|
32 |
+
* Plugin lifecycle handler.
|
33 |
+
*
|
34 |
+
* Registers and displays milestone notice prompts and eventually the plugin
|
35 |
+
* install, upgrade, activation, and deactivation routines.
|
36 |
+
*
|
37 |
+
* @since 5.1.0
|
38 |
+
*/
|
39 |
+
class Lifecycle {
|
40 |
+
|
41 |
+
|
42 |
+
/** @var string minimum milestone version */
|
43 |
+
private $milestone_version;
|
44 |
+
|
45 |
+
/** @var \WC_Braintree\Plugin_Framework\SV_WC_Plugin plugin instance */
|
46 |
+
private $plugin;
|
47 |
+
|
48 |
+
|
49 |
+
/**
|
50 |
+
* Constructs the class.
|
51 |
+
*
|
52 |
+
* @since 5.1.0
|
53 |
+
*
|
54 |
+
* @param \WC_Braintree\Plugin_Framework\SV_WC_Plugin $plugin plugin instance
|
55 |
+
*/
|
56 |
+
public function __construct( \WC_Braintree\Plugin_Framework\SV_WC_Plugin $plugin ) {
|
57 |
+
|
58 |
+
$this->plugin = $plugin;
|
59 |
+
|
60 |
+
$this->add_hooks();
|
61 |
+
}
|
62 |
+
|
63 |
+
|
64 |
+
/**
|
65 |
+
* Adds the action & filter hooks.
|
66 |
+
*
|
67 |
+
* @since 5.1.0
|
68 |
+
*/
|
69 |
+
protected function add_hooks() {
|
70 |
+
|
71 |
+
// handle activation
|
72 |
+
add_action( 'admin_init', array( $this, 'handle_activation' ) );
|
73 |
+
|
74 |
+
// handle deactivation
|
75 |
+
add_action( 'deactivate_' . $this->get_plugin()->get_plugin_file(), array( $this, 'handle_deactivation' ) );
|
76 |
+
|
77 |
+
if ( is_admin() && ! is_ajax() ) {
|
78 |
+
|
79 |
+
// initialize the plugin lifecycle
|
80 |
+
add_action( 'wp_loaded', array( $this, 'init' ) );
|
81 |
+
|
82 |
+
// add the admin notices
|
83 |
+
add_action( 'init', array( $this, 'add_admin_notices' ) );
|
84 |
+
}
|
85 |
+
|
86 |
+
// catch any milestones triggered by action
|
87 |
+
add_action( 'wc_' . $this->get_plugin()->get_id() . '_milestone_reached', array( $this, 'trigger_milestone' ), 10, 3 );
|
88 |
+
}
|
89 |
+
|
90 |
+
|
91 |
+
/**
|
92 |
+
* Initializes the plugin lifecycle.
|
93 |
+
*
|
94 |
+
* @since 5.2.0
|
95 |
+
*/
|
96 |
+
public function init() {
|
97 |
+
|
98 |
+
// potentially handle a new activation
|
99 |
+
$this->handle_activation();
|
100 |
+
|
101 |
+
$installed_version = $this->get_installed_version();
|
102 |
+
$plugin_version = $this->get_plugin()->get_version();
|
103 |
+
|
104 |
+
// installed version lower than plugin version?
|
105 |
+
if ( version_compare( $installed_version, $plugin_version, '<' ) ) {
|
106 |
+
|
107 |
+
if ( ! $installed_version ) {
|
108 |
+
|
109 |
+
$this->install();
|
110 |
+
|
111 |
+
/**
|
112 |
+
* Fires after the plugin has been installed.
|
113 |
+
*
|
114 |
+
* @since 5.1.0
|
115 |
+
*/
|
116 |
+
do_action( 'wc_' . $this->get_plugin()->get_id() . '_installed' );
|
117 |
+
|
118 |
+
} else {
|
119 |
+
|
120 |
+
$this->upgrade( $installed_version );
|
121 |
+
|
122 |
+
// if the plugin never had any previous milestones, consider them all reached so their notices aren't displayed
|
123 |
+
if ( ! $this->get_milestone_version() ) {
|
124 |
+
$this->set_milestone_version( $plugin_version );
|
125 |
+
}
|
126 |
+
|
127 |
+
/**
|
128 |
+
* Fires after the plugin has been updated.
|
129 |
+
*
|
130 |
+
* @since 5.1.0
|
131 |
+
*
|
132 |
+
* @param string $installed_version previously installed version
|
133 |
+
*/
|
134 |
+
do_action( 'wc_' . $this->get_plugin()->get_id() . '_updated', $installed_version );
|
135 |
+
}
|
136 |
+
|
137 |
+
// new version number
|
138 |
+
$this->set_installed_version( $plugin_version );
|
139 |
+
}
|
140 |
+
}
|
141 |
+
|
142 |
+
|
143 |
+
/**
|
144 |
+
* Triggers plugin activation.
|
145 |
+
*
|
146 |
+
* We don't use register_activation_hook() as that can't be called inside
|
147 |
+
* the 'plugins_loaded' action. Instead, we rely on setting to track the
|
148 |
+
* plugin's activation status.
|
149 |
+
*
|
150 |
+
* @internal
|
151 |
+
*
|
152 |
+
* @link https://developer.wordpress.org/reference/functions/register_activation_hook/#comment-2100
|
153 |
+
*
|
154 |
+
* @since 5.2.0
|
155 |
+
*/
|
156 |
+
public function handle_activation() {
|
157 |
+
|
158 |
+
if ( ! get_option( 'wc_' . $this->get_plugin()->get_id() . '_is_active', false ) ) {
|
159 |
+
|
160 |
+
$this->activate();
|
161 |
+
|
162 |
+
/**
|
163 |
+
* Fires when the plugin is activated.
|
164 |
+
*
|
165 |
+
* @since 5.2.0
|
166 |
+
*/
|
167 |
+
do_action( 'wc_' . $this->get_plugin()->get_id() . '_activated' );
|
168 |
+
|
169 |
+
update_option( 'wc_' . $this->get_plugin()->get_id() . '_is_active', 'yes' );
|
170 |
+
}
|
171 |
+
}
|
172 |
+
|
173 |
+
|
174 |
+
/**
|
175 |
+
* Triggers plugin deactivation.
|
176 |
+
*
|
177 |
+
* @internal
|
178 |
+
*
|
179 |
+
* @since 5.2.0
|
180 |
+
*/
|
181 |
+
public function handle_deactivation() {
|
182 |
+
|
183 |
+
$this->deactivate();
|
184 |
+
|
185 |
+
/**
|
186 |
+
* Fires when the plugin is deactivated.
|
187 |
+
*
|
188 |
+
* @since 5.2.0
|
189 |
+
*/
|
190 |
+
do_action( 'wc_' . $this->get_plugin()->get_id() . '_deactivated' );
|
191 |
+
|
192 |
+
delete_option( 'wc_' . $this->get_plugin()->get_id() . '_is_active' );
|
193 |
+
}
|
194 |
+
|
195 |
+
|
196 |
+
/**
|
197 |
+
* Handles plugin activation.
|
198 |
+
*
|
199 |
+
* Plugins can override this to run their own activation tasks.
|
200 |
+
*
|
201 |
+
* Important Note: operations here should never be destructive for existing
|
202 |
+
* data. Since we rely on an option to track activation, it's possible for
|
203 |
+
* this to run outside of genuine activations.
|
204 |
+
*
|
205 |
+
* @since 5.2.0
|
206 |
+
*/
|
207 |
+
public function activate() {
|
208 |
+
|
209 |
+
// stub
|
210 |
+
}
|
211 |
+
|
212 |
+
|
213 |
+
/**
|
214 |
+
* Handles plugin deactivation.
|
215 |
+
*
|
216 |
+
* Plugins can override this to run their own deactivation tasks.
|
217 |
+
*
|
218 |
+
* @since 5.2.0
|
219 |
+
*/
|
220 |
+
public function deactivate() {
|
221 |
+
|
222 |
+
// stub
|
223 |
+
}
|
224 |
+
|
225 |
+
|
226 |
+
/**
|
227 |
+
* Helper method to install default settings for a plugin.
|
228 |
+
*
|
229 |
+
* @since 5.2.0
|
230 |
+
*
|
231 |
+
* @param array $settings settings in format required by WC_Admin_Settings
|
232 |
+
*/
|
233 |
+
public function install_default_settings( array $settings ) {
|
234 |
+
|
235 |
+
foreach ( $settings as $setting ) {
|
236 |
+
|
237 |
+
if ( isset( $setting['id'] ) && isset( $setting['default'] ) ) {
|
238 |
+
|
239 |
+
update_option( $setting['id'], $setting['default'] );
|
240 |
+
}
|
241 |
+
}
|
242 |
+
}
|
243 |
+
|
244 |
+
|
245 |
+
/**
|
246 |
+
* Performs any install tasks.
|
247 |
+
*
|
248 |
+
* @since 5.2.0
|
249 |
+
*/
|
250 |
+
protected function install() {
|
251 |
+
|
252 |
+
// stub
|
253 |
+
}
|
254 |
+
|
255 |
+
|
256 |
+
/**
|
257 |
+
* Performs any upgrade tasks based on the provided installed version.
|
258 |
+
*
|
259 |
+
* @since 5.2.0
|
260 |
+
*
|
261 |
+
* @param string $installed_version installed version
|
262 |
+
*/
|
263 |
+
protected function upgrade( $installed_version ) {
|
264 |
+
|
265 |
+
// stub
|
266 |
+
}
|
267 |
+
|
268 |
+
|
269 |
+
/**
|
270 |
+
* Adds any lifecycle admin notices.
|
271 |
+
*
|
272 |
+
* @since 5.1.0
|
273 |
+
*/
|
274 |
+
public function add_admin_notices() {
|
275 |
+
|
276 |
+
// display any milestone notices
|
277 |
+
foreach ( $this->get_milestone_messages() as $id => $message ) {
|
278 |
+
|
279 |
+
// bail if this notice was already dismissed
|
280 |
+
if ( ! $this->get_plugin()->get_admin_notice_handler()->should_display_notice( $id ) ) {
|
281 |
+
continue;
|
282 |
+
}
|
283 |
+
|
284 |
+
/**
|
285 |
+
* Filters a milestone notice message.
|
286 |
+
*
|
287 |
+
* @since 5.1.0
|
288 |
+
*
|
289 |
+
* @param string $message message text to be used for the milestone notice
|
290 |
+
* @param string $id milestone ID
|
291 |
+
*/
|
292 |
+
$message = apply_filters( 'wc_' . $this->get_plugin()->get_id() . '_milestone_message', $this->generate_milestone_notice_message( $message ), $id );
|
293 |
+
|
294 |
+
if ( $message ) {
|
295 |
+
|
296 |
+
$this->get_plugin()->get_admin_notice_handler()->add_admin_notice( $message, $id, array(
|
297 |
+
'always_show_on_settings' => false,
|
298 |
+
) );
|
299 |
+
|
300 |
+
// only display one notice at a time
|
301 |
+
break;
|
302 |
+
}
|
303 |
+
}
|
304 |
+
}
|
305 |
+
|
306 |
+
|
307 |
+
/** Milestone Methods *****************************************************/
|
308 |
+
|
309 |
+
|
310 |
+
/**
|
311 |
+
* Triggers a milestone.
|
312 |
+
*
|
313 |
+
* This will only be triggered if the install's "milestone version" is lower
|
314 |
+
* than $since. Plugins can specify $since as the version at which a
|
315 |
+
* milestone's feature was added. This prevents existing installs from
|
316 |
+
* triggering notices for milestones that have long passed, like a payment
|
317 |
+
* gateway's first successful payment. Omitting $since will assume the
|
318 |
+
* milestone has always existed and should only trigger for fresh installs.
|
319 |
+
*
|
320 |
+
* @since 5.1.0
|
321 |
+
*
|
322 |
+
* @param string $id milestone ID
|
323 |
+
* @param string $message message to display to the user
|
324 |
+
* @param string $since the version since this milestone has existed in the plugin
|
325 |
+
* @return bool
|
326 |
+
*/
|
327 |
+
public function trigger_milestone( $id, $message, $since = '1.0.0' ) {
|
328 |
+
|
329 |
+
// if the plugin was had milestones before this milestone was added, don't trigger it
|
330 |
+
if ( version_compare( $this->get_milestone_version(), $since, '>' ) ) {
|
331 |
+
return false;
|
332 |
+
}
|
333 |
+
|
334 |
+
return $this->register_milestone_message( $id, $message );
|
335 |
+
}
|
336 |
+
|
337 |
+
|
338 |
+
/**
|
339 |
+
* Generates a milestone notice message.
|
340 |
+
*
|
341 |
+
* @since 5.1.0
|
342 |
+
*
|
343 |
+
* @param string $custom_message custom text that notes what milestone was completed.
|
344 |
+
* @return string
|
345 |
+
*/
|
346 |
+
protected function generate_milestone_notice_message( $custom_message ) {
|
347 |
+
|
348 |
+
$message = '';
|
349 |
+
|
350 |
+
if ( $this->get_plugin()->get_reviews_url() ) {
|
351 |
+
|
352 |
+
// to be prepended at random to each milestone notice
|
353 |
+
$exclamations = array(
|
354 |
+
__( 'Awesome', 'woocommerce-gateway-paypal-powered-by-braintree' ),
|
355 |
+
__( 'Fantastic', 'woocommerce-gateway-paypal-powered-by-braintree' ),
|
356 |
+
__( 'Cowabunga', 'woocommerce-gateway-paypal-powered-by-braintree' ),
|
357 |
+
__( 'Congratulations', 'woocommerce-gateway-paypal-powered-by-braintree' ),
|
358 |
+
__( 'Hot dog', 'woocommerce-gateway-paypal-powered-by-braintree' ),
|
359 |
+
);
|
360 |
+
|
361 |
+
$message = $exclamations[ array_rand( $exclamations ) ] . ', ' . esc_html( $custom_message ) . ' ';
|
362 |
+
|
363 |
+
$message .= sprintf(
|
364 |
+
/* translators: Placeholders: %1$s - plugin name, %2$s - <a> tag, %3$s - </a> tag, %4$s - <a> tag, %5$s - </a> tag */
|
365 |
+
__( 'Are you having a great experience with %1$s so far? Please consider %2$sleaving a review%3$s! If things aren\'t going quite as expected, we\'re happy to help -- please %4$sreach out to our support team%5$s.', 'woocommerce-gateway-paypal-powered-by-braintree' ),
|
366 |
+
'<strong>' . esc_html( $this->get_plugin()->get_plugin_name() ) . '</strong>',
|
367 |
+
'<a href="' . esc_url( $this->get_plugin()->get_reviews_url() ) . '">', '</a>',
|
368 |
+
'<a href="' . esc_url( $this->get_plugin()->get_support_url() ) . '">', '</a>'
|
369 |
+
);
|
370 |
+
}
|
371 |
+
|
372 |
+
return $message;
|
373 |
+
}
|
374 |
+
|
375 |
+
|
376 |
+
/**
|
377 |
+
* Registers a milestone message to be displayed in the admin.
|
378 |
+
*
|
379 |
+
* @since 5.1.0
|
380 |
+
* @see Lifecycle::generate_milestone_notice_message()
|
381 |
+
*
|
382 |
+
* @param string $id milestone ID
|
383 |
+
* @param string $message message to display to the user
|
384 |
+
* @return bool whether the message was successfully registered
|
385 |
+
*/
|
386 |
+
public function register_milestone_message( $id, $message ) {
|
387 |
+
|
388 |
+
$milestone_messages = $this->get_milestone_messages();
|
389 |
+
$dismissed_notices = array_keys( $this->get_plugin()->get_admin_notice_handler()->get_dismissed_notices() );
|
390 |
+
|
391 |
+
// get the total number of dismissed milestone messages
|
392 |
+
$dismissed_milestone_messages = array_intersect( array_keys( $milestone_messages ), $dismissed_notices );
|
393 |
+
|
394 |
+
// if the user has dismissed more than three milestone messages already, don't add any more
|
395 |
+
if ( count( $dismissed_milestone_messages ) > 3 ) {
|
396 |
+
return false;
|
397 |
+
}
|
398 |
+
|
399 |
+
$milestone_messages[ $id ] = $message;
|
400 |
+
|
401 |
+
return update_option( 'wc_' . $this->get_plugin()->get_id() . '_milestone_messages', $milestone_messages );
|
402 |
+
}
|
403 |
+
|
404 |
+
|
405 |
+
/** Utility Methods *******************************************************/
|
406 |
+
|
407 |
+
|
408 |
+
/**
|
409 |
+
* Gets the registered milestone messages.
|
410 |
+
*
|
411 |
+
* @since 5.1.0
|
412 |
+
*
|
413 |
+
* @return array
|
414 |
+
*/
|
415 |
+
protected function get_milestone_messages() {
|
416 |
+
|
417 |
+
return get_option( 'wc_' . $this->get_plugin()->get_id() . '_milestone_messages', array() );
|
418 |
+
}
|
419 |
+
|
420 |
+
|
421 |
+
/**
|
422 |
+
* Sets the milestone version.
|
423 |
+
*
|
424 |
+
* @since 5.1.0
|
425 |
+
*
|
426 |
+
* @param string $version plugin version
|
427 |
+
* @return bool
|
428 |
+
*/
|
429 |
+
public function set_milestone_version( $version ) {
|
430 |
+
|
431 |
+
$this->milestone_version = $version;
|
432 |
+
|
433 |
+
return update_option( 'wc_' . $this->get_plugin()->get_id() . '_milestone_version', $version );
|
434 |
+
}
|
435 |
+
|
436 |
+
|
437 |
+
/**
|
438 |
+
* Gets the milestone version.
|
439 |
+
*
|
440 |
+
* @since 5.1.0
|
441 |
+
*
|
442 |
+
* @return string
|
443 |
+
*/
|
444 |
+
public function get_milestone_version() {
|
445 |
+
|
446 |
+
if ( ! $this->milestone_version ) {
|
447 |
+
$this->milestone_version = get_option( 'wc_' . $this->get_plugin()->get_id() . '_milestone_version', '' );
|
448 |
+
}
|
449 |
+
|
450 |
+
return $this->milestone_version;
|
451 |
+
}
|
452 |
+
|
453 |
+
|
454 |
+
/**
|
455 |
+
* Gets the currently installed plugin version.
|
456 |
+
*
|
457 |
+
* @since 5.2.0
|
458 |
+
*
|
459 |
+
* @return string
|
460 |
+
*/
|
461 |
+
protected function get_installed_version() {
|
462 |
+
|
463 |
+
return get_option( $this->get_plugin()->get_plugin_version_name() );
|
464 |
+
}
|
465 |
+
|
466 |
+
|
467 |
+
/**
|
468 |
+
* Sets the installed plugin version.
|
469 |
+
*
|
470 |
+
* @since 5.2.0
|
471 |
+
*
|
472 |
+
* @param string $version version to set
|
473 |
+
*/
|
474 |
+
protected function set_installed_version( $version ) {
|
475 |
+
|
476 |
+
update_option( $this->get_plugin()->get_plugin_version_name(), $version );
|
477 |
+
}
|
478 |
+
|
479 |
+
|
480 |
+
/**
|
481 |
+
* Gets the plugin instance.
|
482 |
+
*
|
483 |
+
* @since 5.1.0
|
484 |
+
*
|
485 |
+
* @return \WC_Braintree\Plugin_Framework\SV_WC_Plugin
|
486 |
+
*/
|
487 |
+
protected function get_plugin() {
|
488 |
+
|
489 |
+
return $this->plugin;
|
490 |
+
}
|
491 |
+
|
492 |
+
|
493 |
+
/** Deprecated methods ****************************************************/
|
494 |
+
|
495 |
+
|
496 |
+
/**
|
497 |
+
* Handles tasks after the plugin has been updated.
|
498 |
+
*
|
499 |
+
* @internal
|
500 |
+
*
|
501 |
+
* @since 5.1.0
|
502 |
+
*/
|
503 |
+
public function do_update() {
|
504 |
+
|
505 |
+
SV_WC_Plugin_Compatibility::wc_deprecated_function( __METHOD__, '5.2.0' );
|
506 |
+
}
|
507 |
+
|
508 |
+
|
509 |
+
}
|
510 |
+
|
511 |
+
endif;
|
lib/skyverge/woocommerce/admin/abstract-sv-wc-plugin-admin-setup-wizard.php
ADDED
@@ -0,0 +1,1303 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* WooCommerce Plugin Framework
|
4 |
+
*
|
5 |
+
* This source file is subject to the GNU General Public License v3.0
|
6 |
+
* that is bundled with this package in the file license.txt.
|
7 |
+
* It is also available through the world-wide-web at this URL:
|
8 |
+
* http://www.gnu.org/licenses/gpl-3.0.html
|
9 |
+
* If you did not receive a copy of the license and are unable to
|
10 |
+
* obtain it through the world-wide-web, please send an email
|
11 |
+
* to license@skyverge.com so we can send you a copy immediately.
|
12 |
+
*
|
13 |
+
* DISCLAIMER
|
14 |
+
*
|
15 |
+
* Do not edit or add to this file if you wish to upgrade the plugin to newer
|
16 |
+
* versions in the future. If you wish to customize the plugin for your
|
17 |
+
* needs please refer to http://www.skyverge.com
|
18 |
+
*
|
19 |
+
* @author SkyVerge
|
20 |
+
* @copyright Copyright (c) 2013-2018, SkyVerge, Inc.
|
21 |
+
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
|
22 |
+
*/
|
23 |
+
|
24 |
+
namespace WC_Braintree\Plugin_Framework\Admin;
|
25 |
+
|
26 |
+
defined( 'ABSPATH' ) or exit;
|
27 |
+
|
28 |
+
use WC_Braintree\Plugin_Framework as Framework;
|
29 |
+
|
30 |
+
if ( ! class_exists( '\\WC_Braintree\\Plugin_Framework\\Admin\\Setup_Wizard' ) ) :
|
31 |
+
|
32 |
+
/**
|
33 |
+
* The plugin Setup Wizard class.
|
34 |
+
*
|
35 |
+
* This creates a setup wizard so that plugins can provide a user-friendly
|
36 |
+
* step-by-step interaction for configuring critical plugin options.
|
37 |
+
*
|
38 |
+
* Based on WooCommerce's \WC_Admin_Setup_Wizard
|
39 |
+
*
|
40 |
+
* @since 5.2.2
|
41 |
+
*/
|
42 |
+
abstract class Setup_Wizard {
|
43 |
+
|
44 |
+
|
45 |
+
/** the "finish" step ID */
|
46 |
+
const ACTION_FINISH = 'finish';
|
47 |
+
|
48 |
+
|
49 |
+
/** @var string the user capability required to use this wizard */
|
50 |
+
protected $required_capability = 'manage_woocommerce';
|
51 |
+
|
52 |
+
/** @var string the current step ID */
|
53 |
+
protected $current_step = '';
|
54 |
+
|
55 |
+
/** @var array registered steps to be displayed */
|
56 |
+
protected $steps = array();
|
57 |
+
|
58 |
+
/** @var string setup handler ID */
|
59 |
+
private $id;
|
60 |
+
|
61 |
+
/** @var Framework\SV_WC_Plugin plugin instance */
|
62 |
+
private $plugin;
|
63 |
+
|
64 |
+
|
65 |
+
/**
|
66 |
+
* Constructs the class.
|
67 |
+
*
|
68 |
+
* @param Framework\SV_WC_Plugin $plugin plugin instance
|
69 |
+
*/
|
70 |
+
public function __construct( Framework\SV_WC_Plugin $plugin ) {
|
71 |
+
|
72 |
+
// sanity check for admin and permissions
|
73 |
+
if ( ! is_admin() || ! current_user_can( $this->required_capability ) ) {
|
74 |
+
return;
|
75 |
+
}
|
76 |
+
|
77 |
+
$this->id = $plugin->get_id();
|
78 |
+
$this->plugin = $plugin;
|
79 |
+
|
80 |
+
// register the steps
|
81 |
+
$this->register_steps();
|
82 |
+
|
83 |
+
/**
|
84 |
+
* Filters the registered setup wizard steps.
|
85 |
+
*
|
86 |
+
* @since 5.2.2
|
87 |
+
*
|
88 |
+
* @param array $steps registered steps
|
89 |
+
*/
|
90 |
+
$this->steps = apply_filters( "wc_{$this->id}_setup_wizard_steps", $this->steps, $this );
|
91 |
+
|
92 |
+
// only continue if there are registered steps
|
93 |
+
if ( $this->has_steps() ) {
|
94 |
+
|
95 |
+
// if requesting the wizard
|
96 |
+
if ( $this->is_setup_page() ) {
|
97 |
+
|
98 |
+
$this->init_setup();
|
99 |
+
|
100 |
+
// otherwise, add the hooks for customizing the regular admin
|
101 |
+
} else {
|
102 |
+
|
103 |
+
$this->add_hooks();
|
104 |
+
|
105 |
+
// mark the wizard as complete if specifically requested
|
106 |
+
if ( Framework\SV_WC_Helper::get_request( "wc_{$this->id}_setup_wizard_complete" ) ) {
|
107 |
+
$this->complete_setup();
|
108 |
+
}
|
109 |
+
}
|
110 |
+
}
|
111 |
+
}
|
112 |
+
|
113 |
+
|
114 |
+
/**
|
115 |
+
* Registers the setup steps.
|
116 |
+
*
|
117 |
+
* Plugins should extend this to register their own steps.
|
118 |
+
*
|
119 |
+
* @since 5.2.2
|
120 |
+
*/
|
121 |
+
abstract protected function register_steps();
|
122 |
+
|
123 |
+
|
124 |
+
/**
|
125 |
+
* Adds the action & filter hooks.
|
126 |
+
*
|
127 |
+
* @since 5.2.2
|
128 |
+
*/
|
129 |
+
protected function add_hooks() {
|
130 |
+
|
131 |
+
// add any admin notices
|
132 |
+
add_action( 'admin_notices', array( $this, 'add_admin_notices' ) );
|
133 |
+
|
134 |
+
// add a 'Setup' link to the plugin action links if the wizard hasn't been completed
|
135 |
+
if ( ! $this->is_complete() ) {
|
136 |
+
add_filter( 'plugin_action_links_' . plugin_basename( $this->get_plugin()->get_plugin_file() ), array( $this, 'add_setup_link' ), 20 );
|
137 |
+
}
|
138 |
+
}
|
139 |
+
|
140 |
+
|
141 |
+
/**
|
142 |
+
* Adds any admin notices.
|
143 |
+
*
|
144 |
+
* @since 5.2.2
|
145 |
+
*/
|
146 |
+
public function add_admin_notices() {
|
147 |
+
|
148 |
+
$current_screen = get_current_screen();
|
149 |
+
|
150 |
+
if ( ( $current_screen && 'plugins' === $current_screen->id ) || $this->get_plugin()->is_plugin_settings() ) {
|
151 |
+
|
152 |
+
if ( $this->is_complete() && $this->get_documentation_notice_message() ) {
|
153 |
+
$notice_id = "wc_{$this->id}_docs";
|
154 |
+
$message = $this->get_documentation_notice_message();
|
155 |
+
} else {
|
156 |
+
$notice_id = "wc_{$this->id}_setup";
|
157 |
+
$message = $this->get_setup_notice_message();
|
158 |
+
}
|
159 |
+
|
160 |
+
$this->get_plugin()->get_admin_notice_handler()->add_admin_notice( $message, $notice_id, array(
|
161 |
+
'always_show_on_settings' => false,
|
162 |
+
) );
|
163 |
+
}
|
164 |
+
}
|
165 |
+
|
166 |
+
|
167 |
+
/**
|
168 |
+
* Gets the new installation documentation notice message.
|
169 |
+
*
|
170 |
+
* This prompts users to read the docs and is displayed if the wizard has
|
171 |
+
* already been completed.
|
172 |
+
*
|
173 |
+
* @since 5.2.2
|
174 |
+
*
|
175 |
+
* @return string
|
176 |
+
*/
|
177 |
+
protected function get_documentation_notice_message() {
|
178 |
+
|
179 |
+
if ( $this->get_plugin()->get_documentation_url() ) {
|
180 |
+
|
181 |
+
$message = sprintf(
|
182 |
+
/** translators: Placeholders: %1$s - plugin name, %2$s - <a> tag, %3$s - </a> tag */
|
183 |
+
__( 'Thanks for installing %1$s! To get started, take a minute to %2$sread the documentation%3$s :)', 'woocommerce-gateway-paypal-powered-by-braintree' ),
|
184 |
+
esc_html( $this->get_plugin()->get_plugin_name() ),
|
185 |
+
'<a href="' . esc_url( $this->get_plugin()->get_documentation_url() ) . '" target="_blank">', '</a>'
|
186 |
+
);
|
187 |
+
|
188 |
+
} else {
|
189 |
+
|
190 |
+
$message = '';
|
191 |
+
}
|
192 |
+
|
193 |
+
return $message;
|
194 |
+
}
|
195 |
+
|
196 |
+
|
197 |
+
/**
|
198 |
+
* Gets the new installation setup notice message.
|
199 |
+
*
|
200 |
+
* This prompts users to start the setup wizard and is displayed if the
|
201 |
+
* wizard has not yet been completed.
|
202 |
+
*
|
203 |
+
* @since 5.2.2
|
204 |
+
*
|
205 |
+
* @return string
|
206 |
+
*/
|
207 |
+
protected function get_setup_notice_message() {
|
208 |
+
|
209 |
+
return sprintf(
|
210 |
+
/** translators: Placeholders: %1$s - plugin name, %2$s - <a> tag, %3$s - </a> tag */
|
211 |
+
__( 'Thanks for installing %1$s! To get started, take a minute to complete these %2$squick and easy setup steps%3$s :)', 'woocommerce-gateway-paypal-powered-by-braintree' ),
|
212 |
+
esc_html( $this->get_plugin()->get_plugin_name() ),
|
213 |
+
'<a href="' . esc_url( $this->get_setup_url() ) . '">', '</a>'
|
214 |
+
);
|
215 |
+
}
|
216 |
+
|
217 |
+
|
218 |
+
/**
|
219 |
+
* Adds a 'Setup' link to the plugin action links if the wizard hasn't been completed.
|
220 |
+
*
|
221 |
+
* This will override the plugin's standard "Configure" link with a link to this setup wizard.
|
222 |
+
*
|
223 |
+
* @internal
|
224 |
+
*
|
225 |
+
* @since 5.2.2
|
226 |
+
*
|
227 |
+
* @param array $action_links plugin action links
|
228 |
+
* @return array
|
229 |
+
*/
|
230 |
+
public function add_setup_link( $action_links ) {
|
231 |
+
|
232 |
+
// remove the standard plugin "Configure" link
|
233 |
+
unset( $action_links['configure'] );
|
234 |
+
|
235 |
+
$setup_link = array(
|
236 |
+
'setup' => sprintf( '<a href="%s">%s</a>', $this->get_setup_url(), esc_html__( 'Setup', 'woocommerce-gateway-paypal-powered-by-braintree' ) ),
|
237 |
+
);
|
238 |
+
|
239 |
+
return array_merge( $setup_link, $action_links );
|
240 |
+
}
|
241 |
+
|
242 |
+
|
243 |
+
/**
|
244 |
+
* Initializes setup.
|
245 |
+
*
|
246 |
+
* @since 5.2.2
|
247 |
+
*/
|
248 |
+
protected function init_setup() {
|
249 |
+
|
250 |
+
// get a step ID from $_GET
|
251 |
+
$current_step = sanitize_key( Framework\SV_WC_Helper::get_request( 'step' ) );
|
252 |
+
$current_action = sanitize_key( Framework\SV_WC_Helper::get_request( 'action' ) );
|
253 |
+
|
254 |
+
if ( ! $current_action ) {
|
255 |
+
|
256 |
+
if ( $this->has_step( $current_step ) ) {
|
257 |
+
$this->current_step = $current_step;
|
258 |
+
} elseif ( $first_step_url = $this->get_step_url( key( $this->steps ) ) ) {
|
259 |
+
wp_safe_redirect( $first_step_url );
|
260 |
+
exit;
|
261 |
+
} else {
|
262 |
+
wp_safe_redirect( $this->get_dashboard_url() );
|
263 |
+
exit;
|
264 |
+
}
|
265 |
+
}
|
266 |
+
|
267 |
+
// add the page to WP core
|
268 |
+
add_action( 'admin_menu', array( $this, 'add_page' ) );
|
269 |
+
|
270 |
+
// renders the entire setup page markup
|
271 |
+
add_action( 'admin_init', array( $this, 'render_page' ) );
|
272 |
+
}
|
273 |
+
|
274 |
+
|
275 |
+
/**
|
276 |
+
* Adds the page to WordPress core.
|
277 |
+
*
|
278 |
+
* While this doesn't output any markup/menu items, it is essential to officially register the page to avoid permissions issues.
|
279 |
+
*
|
280 |
+
* @internal
|
281 |
+
*
|
282 |
+
* @since 5.2.2
|
283 |
+
*/
|
284 |
+
public function add_page() {
|
285 |
+
|
286 |
+
add_dashboard_page( '', '', $this->required_capability, $this->get_slug(), '' );
|
287 |
+
}
|
288 |
+
|
289 |
+
|
290 |
+
/**
|
291 |
+
* Renders the entire setup page markup.
|
292 |
+
*
|
293 |
+
* @internal
|
294 |
+
*
|
295 |
+
* @since 5.2.2
|
296 |
+
*/
|
297 |
+
public function render_page() {
|
298 |
+
|
299 |
+
// maybe save and move onto the next step
|
300 |
+
$error_message = Framework\SV_WC_Helper::get_post( 'save_step' ) ? $this->save_step( $this->current_step ) : '';
|
301 |
+
|
302 |
+
$page_title = sprintf(
|
303 |
+
/* translators: Placeholders: %s - plugin name */
|
304 |
+
__( '%s › Setup', 'woocommerce-gateway-paypal-powered-by-braintree' ),
|
305 |
+
$this->get_plugin()->get_plugin_name()
|
306 |
+
);
|
307 |
+
|
308 |
+
// add the step name to the page title
|
309 |
+
if ( ! empty( $this->steps[ $this->current_step ]['name'] ) ) {
|
310 |
+
$page_title .= " › {$this->steps[ $this->current_step ]['name']}";
|
311 |
+
}
|
312 |
+
|
313 |
+
$this->load_scripts_styles();
|
314 |
+
|
315 |
+
ob_start();
|
316 |
+
|
317 |
+
?>
|
318 |
+
<!DOCTYPE html>
|
319 |
+
<html <?php language_attributes(); ?>>
|
320 |
+
<head>
|
321 |
+
<meta name="viewport" content="width=device-width" />
|
322 |
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
323 |
+
<title><?php echo esc_html( $page_title ); ?></title>
|
324 |
+
<?php wp_print_scripts( 'wc-setup' ); ?>
|
325 |
+
<?php do_action( 'admin_print_scripts' ); ?>
|
326 |
+
<?php do_action( 'admin_print_styles' ); ?>
|
327 |
+
<?php do_action( 'admin_head' ); ?>
|
328 |
+
</head>
|
329 |
+
<body class="wc-setup wp-core-ui <?php echo esc_attr( $this->get_slug() ); ?>">
|
330 |
+
<?php $this->render_header(); ?>
|
331 |
+
<?php $this->render_steps(); ?>
|
332 |
+
<?php $this->render_content( $error_message ); ?>
|
333 |
+
<?php $this->render_footer(); ?>
|
334 |
+
</body>
|
335 |
+
</html>
|
336 |
+
<?php
|
337 |
+
|
338 |
+
exit;
|
339 |
+
}
|
340 |
+
|
341 |
+
|
342 |
+
/**
|
343 |
+
* Saves a step.
|
344 |
+
*
|
345 |
+
* @since 5.2.2
|
346 |
+
*
|
347 |
+
* @param string $step_id the step ID being saved
|
348 |
+
* @return void|string redirects upon success, returns an error message upon failure
|
349 |
+
*/
|
350 |
+
protected function save_step( $step_id ) {
|
351 |
+
|
352 |
+
$error_message = __( 'Oops! An error occurred, please try again.', 'woocommerce-gateway-paypal-powered-by-braintree' );
|
353 |
+
|
354 |
+
try {
|
355 |
+
|
356 |
+
// bail early if the nonce is bad
|
357 |
+
if ( ! wp_verify_nonce( Framework\SV_WC_Helper::get_post( 'nonce' ), "wc_{$this->id}_setup_wizard_save" ) ) {
|
358 |
+
throw new Framework\SV_WC_Plugin_Exception( $error_message );
|
359 |
+
}
|
360 |
+
|
361 |
+
if ( $this->has_step( $step_id ) ) {
|
362 |
+
|
363 |
+
// if the step has a saving callback defined, save the form fields
|
364 |
+
if ( is_callable( $this->steps[ $step_id ]['save'] ) ) {
|
365 |
+
call_user_func( $this->steps[ $step_id ]['save'], $this );
|
366 |
+
}
|
367 |
+
|
368 |
+
// move to the next step
|
369 |
+
wp_safe_redirect( $this->get_next_step_url( $step_id ) );
|
370 |
+
exit;
|
371 |
+
}
|
372 |
+
|
373 |
+
} catch ( Framework\SV_WC_Plugin_Exception $exception ) {
|
374 |
+
|
375 |
+
return $exception->getMessage() ? $exception->getMessage() : $error_message;
|
376 |
+
}
|
377 |
+
}
|
378 |
+
|
379 |
+
|
380 |
+
/**
|
381 |
+
* Registers and enqueues the wizard's scripts and styles.
|
382 |
+
*
|
383 |
+
* @since 5.2.2
|
384 |
+
*/
|
385 |
+
protected function load_scripts_styles() {
|
386 |
+
|
387 |
+
// block UI
|
388 |
+
wp_register_script( 'jquery-blockui', WC()->plugin_url() . '/assets/js/jquery-blockui/jquery.blockUI.min.js', array( 'jquery' ), '2.70', true );
|
389 |
+
|
390 |
+
// enhanced dropdowns
|
391 |
+
wp_register_script( 'selectWoo', WC()->plugin_url() . '/assets/js/selectWoo/selectWoo.full.min.js', array( 'jquery' ), '1.0.0' );
|
392 |
+
wp_register_script( 'wc-enhanced-select', WC()->plugin_url() . '/assets/js/admin/wc-enhanced-select.min.js', array( 'jquery', 'selectWoo' ), $this->get_plugin()->get_version() );
|
393 |
+
wp_localize_script(
|
394 |
+
'wc-enhanced-select',
|
395 |
+
'wc_enhanced_select_params',
|
396 |
+
array(
|
397 |
+
'i18n_no_matches' => _x( 'No matches found', 'enhanced select', 'woocommerce-gateway-paypal-powered-by-braintree' ),
|
398 |
+
'i18n_ajax_error' => _x( 'Loading failed', 'enhanced select', 'woocommerce-gateway-paypal-powered-by-braintree' ),
|
399 |
+
'i18n_input_too_short_1' => _x( 'Please enter 1 or more characters', 'enhanced select', 'woocommerce-gateway-paypal-powered-by-braintree' ),
|
400 |
+
'i18n_input_too_short_n' => _x( 'Please enter %qty% or more characters', 'enhanced select', 'woocommerce-gateway-paypal-powered-by-braintree' ),
|
401 |
+
'i18n_input_too_long_1' => _x( 'Please delete 1 character', 'enhanced select', 'woocommerce-gateway-paypal-powered-by-braintree' ),
|
402 |
+
'i18n_input_too_long_n' => _x( 'Please delete %qty% characters', 'enhanced select', 'woocommerce-gateway-paypal-powered-by-braintree' ),
|
403 |
+
'i18n_selection_too_long_1' => _x( 'You can only select 1 item', 'enhanced select', 'woocommerce-gateway-paypal-powered-by-braintree' ),
|
404 |
+
'i18n_selection_too_long_n' => _x( 'You can only select %qty% items', 'enhanced select', 'woocommerce-gateway-paypal-powered-by-braintree' ),
|
405 |
+
'i18n_load_more' => _x( 'Loading more results…', 'enhanced select', 'woocommerce-gateway-paypal-powered-by-braintree' ),
|
406 |
+
'i18n_searching' => _x( 'Searching…', 'enhanced select', 'woocommerce-gateway-paypal-powered-by-braintree' ),
|
407 |
+
'ajax_url' => admin_url( 'admin-ajax.php' ),
|
408 |
+
'search_products_nonce' => wp_create_nonce( 'search-products' ),
|
409 |
+
'search_customers_nonce' => wp_create_nonce( 'search-customers' ),
|
410 |
+
)
|
411 |
+
);
|
412 |
+
|
413 |
+
// WooCommerce Setup core scripts
|
414 |
+
wp_register_script( 'wc-setup', WC()->plugin_url() . '/assets/js/admin/wc-setup.min.js', array( 'jquery', 'wc-enhanced-select', 'jquery-blockui' ), $this->get_plugin()->get_version() );
|
415 |
+
|
416 |
+
// WooCommerce Setup core styles
|
417 |
+
wp_enqueue_style( 'woocommerce_admin_styles', WC()->plugin_url() . '/assets/css/admin.css', array(), $this->get_plugin()->get_version() );
|
418 |
+
wp_enqueue_style( 'wc-setup', WC()->plugin_url() . '/assets/css/wc-setup.css', array( 'dashicons', 'install' ), $this->get_plugin()->get_version() );
|
419 |
+
|
420 |
+
// framework bundled styles
|
421 |
+
wp_enqueue_style( 'sv-wc-admin-setup', $this->get_plugin()->get_framework_assets_url() . '/css/admin/sv-wc-plugin-admin-setup-wizard.min.css', array( 'wc-setup' ), $this->get_plugin()->get_version() );
|
422 |
+
wp_enqueue_script( 'sv-wc-admin-setup', $this->get_plugin()->get_framework_assets_url() . '/js/admin/sv-wc-plugin-admin-setup-wizard.min.js', array( 'wc-setup' ), $this->get_plugin()->get_version() );
|
423 |
+
}
|
424 |
+
|
425 |
+
|
426 |
+
/** Header Methods ************************************************************************************************/
|
427 |
+
|
428 |
+
|
429 |
+
/**
|
430 |
+
* Renders the header markup.
|
431 |
+
*
|
432 |
+
* @since 5.2.2
|
433 |
+
*/
|
434 |
+
protected function render_header() {
|
435 |
+
|
436 |
+
$title = $this->get_plugin()->get_plugin_name();
|
437 |
+
$link_url = $this->get_plugin()->get_sales_page_url();
|
438 |
+
$image_url = $this->get_header_image_url();
|
439 |
+
|
440 |
+
$header_content = $image_url ? '<img src="' . esc_url( $image_url ) . '" alt="' . esc_attr( $title ) . '" />' : $title;
|
441 |
+
|
442 |
+
?>
|
443 |
+
<h1 id="wc-logo" class="sv-wc-plugin-logo <?php echo esc_attr( 'wc-' . $this->get_plugin()->get_id_dasherized() . '-logo' ); ?>">
|
444 |
+
<?php if ( $link_url ) : ?>
|
445 |
+
<a href="<?php echo esc_url( $link_url ); ?>" target="_blank"><?php echo $header_content; ?></a>
|
446 |
+
<?php else : ?>
|
447 |
+
<?php echo esc_html( $header_content ); ?>
|
448 |
+
<?php endif; ?>
|
449 |
+
</h1>
|
450 |
+
<?php
|
451 |
+
}
|
452 |
+
|
453 |
+
|
454 |
+
/**
|
455 |
+
* Gets the header image URL.
|
456 |
+
*
|
457 |
+
* Plugins can override this to point to their own branding image URL.
|
458 |
+
*
|
459 |
+
* @since 5.2.2
|
460 |
+
*
|
461 |
+
* @return string
|
462 |
+
*/
|
463 |
+
protected function get_header_image_url() {
|
464 |
+
|
465 |
+
return '';
|
466 |
+
}
|
467 |
+
|
468 |
+
|
469 |
+
/**
|
470 |
+
* Renders the step list.
|
471 |
+
*
|
472 |
+
* This displays a list of steps, marking them as complete or upcoming as sort of a progress bar.
|
473 |
+
*
|
474 |
+
* @since 5.2.2
|
475 |
+
*/
|
476 |
+
protected function render_steps() {
|
477 |
+
|
478 |
+
?>
|
479 |
+
<ol class="wc-setup-steps">
|
480 |
+
|
481 |
+
<?php foreach ( $this->steps as $id => $step ) : ?>
|
482 |
+
|
483 |
+
<?php if ( $id === $this->current_step ) : ?>
|
484 |
+
<li class="active"><?php echo esc_html( $step['name'] ); ?></li>
|
485 |
+
<?php elseif ( $this->is_step_complete( $id ) ) : ?>
|
486 |
+
<li class="done"><a href="<?php echo esc_url( $this->get_step_url( $id ) ); ?>"><?php echo esc_html( $step['name'] ); ?></a></li>
|
487 |
+
<?php else : ?>
|
488 |
+
<li><?php echo esc_html( $step['name'] ); ?></li>
|
489 |
+
<?php endif;?>
|
490 |
+
|
491 |
+
<?php endforeach; ?>
|
492 |
+
|
493 |
+
<li class="<?php echo $this->is_finished() ? 'done' : ''; ?>"><?php esc_html_e( 'Ready!', 'woocommerce-gateway-paypal-powered-by-braintree' ); ?></li>
|
494 |
+
|
495 |
+
</ol>
|
496 |
+
<?php
|
497 |
+
}
|
498 |
+
|
499 |
+
|
500 |
+
/** Content Methods ***********************************************************************************************/
|
501 |
+
|
502 |
+
|
503 |
+
/**
|
504 |
+
* Renders the setup content.
|
505 |
+
*
|
506 |
+
* This will display the welcome screen, finished screen, or a specific step's markup.
|
507 |
+
*
|
508 |
+
* @since 5.2.2
|
509 |
+
*
|
510 |
+
* @param string $error_message custom error message
|
511 |
+
*/
|
512 |
+
protected function render_content( $error_message = '' ) {
|
513 |
+
|
514 |
+
?>
|
515 |
+
<div class="wc-setup-content sv-wc-plugin-admin-setup-content <?php echo esc_attr( $this->get_slug() ) . '-content'; ?>">
|
516 |
+
|
517 |
+
<?php if ( $this->is_finished() ) : ?>
|
518 |
+
|
519 |
+
<?php $this->render_finished(); ?>
|
520 |
+
|
521 |
+
<?php $this->complete_setup(); ?>
|
522 |
+
|
523 |
+
<?php else : ?>
|
524 |
+
|
525 |
+
<?php // render a welcome message if the current is the first step ?>
|
526 |
+
<?php if ( $this->is_started() ) : ?>
|
527 |
+
<?php $this->render_welcome(); ?>
|
528 |
+
<?php endif; ?>
|
529 |
+
|
530 |
+
<?php // render any error message from a previous save ?>
|
531 |
+
<?php if ( ! empty( $error_message ) ) : ?>
|
532 |
+
<?php $this->render_error( $error_message ); ?>
|
533 |
+
<?php endif; ?>
|
534 |
+
|
535 |
+
<form method="post">
|
536 |
+
<?php $this->render_step( $this->current_step ); ?>
|
537 |
+
<?php wp_nonce_field( "wc_{$this->id}_setup_wizard_save", 'nonce' ); ?>
|
538 |
+
</form>
|
539 |
+
|
540 |
+
<?php endif; ?>
|
541 |
+
|
542 |
+
</div>
|
543 |
+
<?php
|
544 |
+
}
|
545 |
+
|
546 |
+
|
547 |
+
/**
|
548 |
+
* Renders a save error.
|
549 |
+
*
|
550 |
+
* @since 5.2.2
|
551 |
+
*
|
552 |
+
* @param string $message error message to render
|
553 |
+
*/
|
554 |
+
protected function render_error( $message ) {
|
555 |
+
|
556 |
+
if ( ! empty( $message ) ) {
|
557 |
+
|
558 |
+
printf( '<p class="error">%s</p>', esc_html( $message ) );
|
559 |
+
}
|
560 |
+
}
|
561 |
+
|
562 |
+
|
563 |
+
/**
|
564 |
+
* Renders a default welcome note.
|
565 |
+
*
|
566 |
+
* @since 5.2.2
|
567 |
+
*/
|
568 |
+
protected function render_welcome() {
|
569 |
+
|
570 |
+
?>
|
571 |
+
<h1><?php $this->render_welcome_heading()?></h1>
|
572 |
+
<p class="welcome"><?php $this->render_welcome_text(); ?></p>
|
573 |
+
<?php
|
574 |
+
}
|
575 |
+
|
576 |
+
|
577 |
+
/**
|
578 |
+
* Renders the default welcome note heading.
|
579 |
+
*
|
580 |
+
* @since 5.2.2
|
581 |
+
*/
|
582 |
+
protected function render_welcome_heading() {
|
583 |
+
|
584 |
+
printf(
|
585 |
+
/* translators: Placeholder: %s - plugin name */
|
586 |
+
esc_html__( 'Welcome to %s!', 'woocommerce-gateway-paypal-powered-by-braintree' ),
|
587 |
+
$this->get_plugin()->get_plugin_name()
|
588 |
+
);
|
589 |
+
}
|
590 |
+
|
591 |
+
|
592 |
+
/**
|
593 |
+
* Renders the default welcome note text.
|
594 |
+
*
|
595 |
+
* @since 5.2.2
|
596 |
+
*/
|
597 |
+
protected function render_welcome_text() {
|
598 |
+
|
599 |
+
esc_html_e( 'This quick setup wizard will help you configure the basic settings and get you started.', 'woocommerce-gateway-paypal-powered-by-braintree' );
|
600 |
+
}
|
601 |
+
|
602 |
+
|
603 |
+
/**
|
604 |
+
* Renders the finished screen markup.
|
605 |
+
*
|
606 |
+
* This is what gets displayed after all of the steps have been completed or skipped.
|
607 |
+
*
|
608 |
+
* @since 5.2.2
|
609 |
+
*/
|
610 |
+
protected function render_finished() {
|
611 |
+
|
612 |
+
?>
|
613 |
+
<h1><?php printf( esc_html__( '%s is ready!', 'woocommerce-gateway-paypal-powered-by-braintree' ), esc_html( $this->get_plugin()->get_plugin_name() ) ); ?></h1>
|
614 |
+
<?php $this->render_before_next_steps(); ?>
|
615 |
+
<?php $this->render_next_steps(); ?>
|
616 |
+
<?php $this->render_after_next_steps(); ?>
|
617 |
+
<?php
|
618 |
+
}
|
619 |
+
|
620 |
+
|
621 |
+
/**
|
622 |
+
* Renders HTML before the next steps in the finished step screen.
|
623 |
+
*
|
624 |
+
* Plugins can implement this method to output additional HTML before the next steps are printed.
|
625 |
+
*
|
626 |
+
* @since 5.2.2
|
627 |
+
*/
|
628 |
+
protected function render_before_next_steps() {
|
629 |
+
// stub method
|
630 |
+
}
|
631 |
+
|
632 |
+
|
633 |
+
/**
|
634 |
+
* Renders HTML after the next steps in the finished step screen.
|
635 |
+
*
|
636 |
+
* Plugins can implement this method to output additional HTML after the next steps are printed.
|
637 |
+
*
|
638 |
+
* @since 5.2.2
|
639 |
+
*/
|
640 |
+
protected function render_after_next_steps() {
|
641 |
+
// stub method
|
642 |
+
}
|
643 |
+
|
644 |
+
|
645 |
+
/**
|
646 |
+
* Renders the next steps.
|
647 |
+
*
|
648 |
+
* @since 5.2.2
|
649 |
+
*/
|
650 |
+
protected function render_next_steps() {
|
651 |
+
|
652 |
+
$next_steps = $this->get_next_steps();
|
653 |
+
$additional_actions = $this->get_additional_actions();
|
654 |
+
|
655 |
+
if ( ! empty( $next_steps ) || ! empty( $additional_actions ) ) :
|
656 |
+
|
657 |
+
?>
|
658 |
+
<ul class="wc-wizard-next-steps">
|
659 |
+
|
660 |
+
<?php foreach ( $next_steps as $step ) : ?>
|
661 |
+
|
662 |
+
<li class="wc-wizard-next-step-item">
|
663 |
+
<div class="wc-wizard-next-step-description">
|
664 |
+
|
665 |
+
<p class="next-step-heading"><?php esc_html_e( 'Next step', 'woocommerce-gateway-paypal-powered-by-braintree' ); ?></p>
|
666 |
+
<h3 class="next-step-description"><?php echo esc_html( $step['label'] ); ?></h3>
|
667 |
+
|
668 |
+
<?php if ( ! empty( $step['description'] ) ) : ?>
|
669 |
+
<p class="next-step-extra-info"><?php echo esc_html( $step['description'] ); ?></p>
|
670 |
+
<?php endif; ?>
|
671 |
+
|
672 |
+
</div>
|
673 |
+
|
674 |
+
<div class="wc-wizard-next-step-action">
|
675 |
+
<p class="wc-setup-actions step">
|
676 |
+
<?php $button_class = isset( $step['button_class'] ) ? $step['button_class'] : 'button button-primary button-large'; ?>
|
677 |
+
<?php $button_class = is_string( $button_class ) || is_array( $button_class ) ? array_map( 'sanitize_html_class', explode( ' ', implode( ' ', (array) $button_class ) ) ) : ''; ?>
|
678 |
+
<a class="<?php echo implode( ' ', $button_class ); ?>" href="<?php echo esc_url( $step['url'] ); ?>">
|
679 |
+
<?php echo esc_html( $step['name'] ); ?>
|
680 |
+
</a>
|
681 |
+
</p>
|
682 |
+
</div>
|
683 |
+
</li>
|
684 |
+
|
685 |
+
<?php endforeach; ?>
|
686 |
+
|
687 |
+
<?php if ( ! empty( $additional_actions ) ) : ?>
|
688 |
+
|
689 |
+
<li class="wc-wizard-additional-steps">
|
690 |
+
<div class="wc-wizard-next-step-description">
|
691 |
+
<p class="next-step-heading"><?php esc_html_e( 'You can also:', 'woocommerce-gateway-paypal-powered-by-braintree' ); ?></p>
|
692 |
+
</div>
|
693 |
+
<div class="wc-wizard-next-step-action">
|
694 |
+
|
695 |
+
<p class="wc-setup-actions step">
|
696 |
+
|
697 |
+
<?php foreach ( $additional_actions as $name => $url ) : ?>
|
698 |
+
|
699 |
+
<a class="button button-large" href="<?php echo esc_url( $url ); ?>">
|
700 |
+
<?php echo esc_html( $name ); ?>
|
701 |
+
</a>
|
702 |
+
|
703 |
+
<?php endforeach; ?>
|
704 |
+
|
705 |
+
</p>
|
706 |
+
</div>
|
707 |
+
</li>
|
708 |
+
|
709 |
+
<?php endif; ?>
|
710 |
+
|
711 |
+
</ul>
|
712 |
+
<?php
|
713 |
+
|
714 |
+
endif;
|
715 |
+
}
|
716 |
+
|
717 |
+
|
718 |
+
/**
|
719 |
+
* Gets the next steps.
|
720 |
+
*
|
721 |
+
* These are major actions a user can take after finishing the setup wizard.
|
722 |
+
* For instance, things like "Create your first Add-On" could go here.
|
723 |
+
*
|
724 |
+
* @since 5.2.2
|
725 |
+
*
|
726 |
+
* @return array
|
727 |
+
*/
|
728 |
+
protected function get_next_steps() {
|
729 |
+
|
730 |
+
$steps = array();
|
731 |
+
|
732 |
+
if ( $this->get_plugin()->get_documentation_url() ) {
|
733 |
+
|
734 |
+
$steps['view-docs'] = array(
|
735 |
+
'name' => __( 'View the Docs', 'woocommerce-gateway-paypal-powered-by-braintree' ),
|
736 |
+
'label' => __( 'See more setup options', 'woocommerce-gateway-paypal-powered-by-braintree' ),
|
737 |
+
'description' => __( 'Learn more about customizing the plugin', 'woocommerce-gateway-paypal-powered-by-braintree' ),
|
738 |
+
'url' => $this->get_plugin()->get_documentation_url(),
|
739 |
+
);
|
740 |
+
}
|
741 |
+
|
742 |
+
return $steps;
|
743 |
+
}
|
744 |
+
|
745 |
+
|
746 |
+
/**
|
747 |
+
* Gets the additional steps.
|
748 |
+
*
|
749 |
+
* These are secondary actions.
|
750 |
+
*
|
751 |
+
* @since 5.2.2
|
752 |
+
*
|
753 |
+
* @return array
|
754 |
+
*/
|
755 |
+
protected function get_additional_actions() {
|
756 |
+
|
757 |
+
$next_steps = $this->get_next_steps();
|
758 |
+
$actions = array();
|
759 |
+
|
760 |
+
if ( $this->get_plugin()->get_settings_url() ) {
|
761 |
+
$actions[ __( 'Review Your Settings', 'woocommerce-gateway-paypal-powered-by-braintree' ) ] = $this->get_plugin()->get_settings_url();
|
762 |
+
}
|
763 |
+
|
764 |
+
if ( empty( $next_steps['view-docs'] ) && $this->get_plugin()->get_documentation_url() ) {
|
765 |
+
$actions[ __( 'View the Docs', 'woocommerce-gateway-paypal-powered-by-braintree' ) ] = $this->get_plugin()->get_documentation_url();
|
766 |
+
}
|
767 |
+
|
768 |
+
if ( $this->get_plugin()->get_reviews_url() ) {
|
769 |
+
$actions[ __( 'Leave a Review', 'woocommerce-gateway-paypal-powered-by-braintree' ) ] = $this->get_plugin()->get_reviews_url();
|
770 |
+
}
|
771 |
+
|
772 |
+
return $actions;
|
773 |
+
}
|
774 |
+
|
775 |
+
|
776 |
+
/**
|
777 |
+
* Renders a given step's markup.
|
778 |
+
*
|
779 |
+
* This will display a title, whatever get's rendered by the step's view
|
780 |
+
* callback, then the navigation buttons.
|
781 |
+
*
|
782 |
+
* @since 5.2.2
|
783 |
+
*
|
784 |
+
* @param string $step_id step ID to render
|
785 |
+
*/
|
786 |
+
protected function render_step( $step_id ) {
|
787 |
+
|
788 |
+
call_user_func( $this->steps[ $step_id ]['view'], $this );
|
789 |
+
|
790 |
+
?>
|
791 |
+
<p class="wc-setup-actions step">
|
792 |
+
|
793 |
+
<?php $label = __( 'Continue', 'woocommerce-gateway-paypal-powered-by-braintree' ); ?>
|
794 |
+
|
795 |
+
<?php if ( is_callable( $this->steps[ $step_id ]['save'] ) ) : ?>
|
796 |
+
|
797 |
+
<button
|
798 |
+
type="submit"
|
799 |
+
name="save_step"
|
800 |
+
class="button-primary button button-large button-next"
|
801 |
+
value="<?php echo esc_attr( $label ); ?>">
|
802 |
+
<?php echo esc_html( $label ); ?>
|
803 |
+
</button>
|
804 |
+
|
805 |
+
<?php else : ?>
|
806 |
+
|
807 |
+
<a class="button-primary button button-large button-next" href="<?php echo esc_url( $this->get_next_step_url( $step_id ) ); ?>"><?php echo esc_html( $label ); ?></a>
|
808 |
+
|
809 |
+
<?php endif; ?>
|
810 |
+
</p>
|
811 |
+
<?php
|
812 |
+
}
|
813 |
+
|
814 |
+
|
815 |
+
/**
|
816 |
+
* Renders a form field.
|
817 |
+
*
|
818 |
+
* Call this in the same way as woocommerce_form_field().
|
819 |
+
*
|
820 |
+
* @since 5.2.2
|
821 |
+
*
|
822 |
+
* @param string $key field key
|
823 |
+
* @param array $args field args - @see woocommerce_form_field()
|
824 |
+
* @param string|null $value field value
|
825 |
+
*/
|
826 |
+
protected function render_form_field( $key, $args, $value = null ) {
|
827 |
+
|
828 |
+
if ( ! isset( $args['class'] ) ) {
|
829 |
+
$args['class'] = array();
|
830 |
+
} else {
|
831 |
+
$args['class'] = (array) $args['class'];
|
832 |
+
}
|
833 |
+
|
834 |
+
// the base wrapper class for our styling
|
835 |
+
$args['class'][] = 'sv-wc-plugin-admin-setup-control';
|
836 |
+
|
837 |
+
// add the "required" HTML attribute for browser form validation
|
838 |
+
if ( ! empty( $args['required'] ) ) {
|
839 |
+
$args['custom_attributes']['required'] = true;
|
840 |
+
}
|
841 |
+
|
842 |
+
// all dropdowns are treated as enhanced selects
|
843 |
+
if ( isset( $args['type'] ) && 'select' === $args['type'] ) {
|
844 |
+
$args['input_class'][] = 'wc-enhanced-select';
|
845 |
+
}
|
846 |
+
|
847 |
+
// always echo the field
|
848 |
+
$args['return'] = false;
|
849 |
+
|
850 |
+
if ( isset( $args['type'] ) && 'toggle' === $args['type'] ) {
|
851 |
+
$this->render_toggle_form_field( $key, $args, $value );
|
852 |
+
} else {
|
853 |
+
woocommerce_form_field( $key, $args, $value );
|
854 |
+
}
|
855 |
+
}
|
856 |
+
|
857 |
+
|
858 |
+
/**
|
859 |
+
* Renders the toggle form field.
|
860 |
+
*
|
861 |
+
* This requires special markup for the toggle UI.
|
862 |
+
*
|
863 |
+
* @since 5.2.2
|
864 |
+
*
|
865 |
+
* @param string $key field key
|
866 |
+
* @param array $args field args - @see woocommerce_form_field()
|
867 |
+
* @param string|null $value field value
|
868 |
+
*/
|
869 |
+
public function render_toggle_form_field( $key, $args, $value ) {
|
870 |
+
|
871 |
+
$args = wp_parse_args( $args, array(
|
872 |
+
'type' => 'text',
|
873 |
+
'label' => '',
|
874 |
+
'description' => '',
|
875 |
+
'required' => false,
|
876 |
+
'id' => $key,
|
877 |
+
'class' => array(),
|
878 |
+
'label_class' => array(),
|
879 |
+
'input_class' => array(),
|
880 |
+
'custom_attributes' => array(),
|
881 |
+
'default' => false,
|
882 |
+
'allow_html' => false,
|
883 |
+
) );
|
884 |
+
|
885 |
+
$args['class'][] = 'toggle';
|
886 |
+
|
887 |
+
if ( $args['required'] ) {
|
888 |
+
$args['class'][] = 'validate-required';
|
889 |
+
}
|
890 |
+
|
891 |
+
if ( null === $value ) {
|
892 |
+
$value = $args['default'];
|
893 |
+
}
|
894 |
+
|
895 |
+
$custom_attributes = array();
|
896 |
+
$args['custom_attributes'] = array_filter( (array) $args['custom_attributes'], 'strlen' );
|
897 |
+
|
898 |
+
if ( $args['description'] ) {
|
899 |
+
$args['custom_attributes']['aria-describedby'] = $args['id'] . '-description';
|
900 |
+
}
|
901 |
+
|
902 |
+
if ( ! empty( $args['custom_attributes'] ) && is_array( $args['custom_attributes'] ) ) {
|
903 |
+
foreach ( $args['custom_attributes'] as $attribute => $attribute_value ) {
|
904 |
+
$custom_attributes[] = esc_attr( $attribute ) . '="' . esc_attr( $attribute_value ) . '"';
|
905 |
+
}
|
906 |
+
}
|
907 |
+
|
908 |
+
$enabled = $value || $args['default'];
|
909 |
+
|
910 |
+
if ( $enabled ) {
|
911 |
+
$args['class'][] = 'enabled';
|
912 |
+
}
|
913 |
+
|
914 |
+
?>
|
915 |
+
<div class="form-row <?php echo esc_attr( implode( ' ', $args['class'] ) ); ?>">
|
916 |
+
|
917 |
+
<p class="name"><?php echo true === $args['allow_html'] ? $args['label'] : esc_html( $args['label'] ); ?></p>
|
918 |
+
|
919 |
+
<?php if ( true === $args['allow_html'] ) : ?>
|
920 |
+
<div class="content"><p class="description"><?php echo $args['description']; ?></p></div>
|
921 |
+
<?php else : ?>
|
922 |
+
<p class="content description"><?php echo esc_html( $args['description'] ); ?></p>
|
923 |
+
<?php endif; ?>
|
924 |
+
|
925 |
+
<div class="enable">
|
926 |
+
<span class="toggle <?php echo $enabled ? '' : 'disabled'; ?>">
|
927 |
+
<input
|
928 |
+
id="<?php echo esc_attr( $args['id'] ); ?>"
|
929 |
+
type="checkbox"
|
930 |
+
class="input-checkbox <?php echo esc_attr( implode( ' ', $args['input_class'] ) ); ?>"
|
931 |
+
name="<?php echo esc_attr( $key ); ?>"
|
932 |
+
value="yes" <?php checked( true, $value ); ?>
|
933 |
+
<?php echo implode( ' ', $custom_attributes ); ?>
|
934 |
+
/>
|
935 |
+
<label for="<?php echo esc_attr( $args['id'] ); ?>" class="<?php implode( ' ', (array) $args['label_class'] ); ?>">
|
936 |
+
</span>
|
937 |
+
</div>
|
938 |
+
|
939 |
+
</div>
|
940 |
+
<?php
|
941 |
+
}
|
942 |
+
|
943 |
+
|
944 |
+
/**
|
945 |
+
* Renders the setup footer.
|
946 |
+
*
|
947 |
+
* @since 5.2.2
|
948 |
+
*/
|
949 |
+
protected function render_footer() {
|
950 |
+
|
951 |
+
?>
|
952 |
+
<?php if ( $this->is_finished() ) : ?>
|
953 |
+
<a class="wc-setup-footer-links" href="<?php echo esc_url( $this->get_dashboard_url() ); ?>"><?php esc_html_e( 'Return to the WordPress Dashboard', 'woocommerce-gateway-paypal-powered-by-braintree' ); ?></a>
|
954 |
+
<?php elseif ( $this->is_started() ) : ?>
|
955 |
+
<a class="wc-setup-footer-links" href="<?php echo esc_url( $this->get_dashboard_url() ); ?>"><?php esc_html_e( 'Not right now', 'woocommerce-gateway-paypal-powered-by-braintree' ); ?></a>
|
956 |
+
<?php else : ?>
|
957 |
+
<a class="wc-setup-footer-links" href="<?php echo esc_url( $this->get_next_step_url() ); ?>"><?php esc_html_e( 'Skip this step', 'woocommerce-gateway-paypal-powered-by-braintree' ); ?></a>
|
958 |
+
<?php endif; ?>
|
959 |
+
<?php
|
960 |
+
|
961 |
+
do_action( 'wp_print_footer_scripts' );
|
962 |
+
}
|
963 |
+
|
964 |
+
|
965 |
+
/** Helper Methods ************************************************************************************************/
|
966 |
+
|
967 |
+
|
968 |
+
/**
|
969 |
+
* Registers a step.
|
970 |
+
*
|
971 |
+
* @since 5.2.2
|
972 |
+
*
|
973 |
+
* @param string $id unique step ID
|
974 |
+
* @param string $name step name for display
|
975 |
+
* @param string|array $view_callback callback to render the step's content HTML
|
976 |
+
* @param string|array|null $save_callback callback to save the step's form values
|
977 |
+
* @return bool whether the step was successfully added
|
978 |
+
*/
|
979 |
+
public function register_step( $id, $name, $view_callback, $save_callback = null ) {
|
980 |
+
|
981 |
+
try {
|
982 |
+
|
983 |
+
// invalid ID
|
984 |
+
if ( ! is_string( $id ) || empty( $id ) || $this->has_step( $id ) ) {
|
985 |
+
throw new Framework\SV_WC_Plugin_Exception( 'Invalid step ID' );
|
986 |
+
}
|
987 |
+
|
988 |
+
// invalid name
|
989 |
+
if ( ! is_string( $name ) || empty( $name ) ) {
|
990 |
+
throw new Framework\SV_WC_Plugin_Exception( 'Invalid step name' );
|
991 |
+
}
|
992 |
+
|
993 |
+
// invalid view callback
|
994 |
+
if ( ! is_callable( $view_callback ) ) {
|
995 |
+
throw new Framework\SV_WC_Plugin_Exception( 'Invalid view callback' );
|
996 |
+
}
|
997 |
+
|
998 |
+
// invalid save callback
|
999 |
+
if ( null !== $save_callback && ! is_callable( $save_callback ) ) {
|
1000 |
+
throw new Framework\SV_WC_Plugin_Exception( 'Invalid save callback' );
|
1001 |
+
}
|
1002 |
+
|
1003 |
+
$this->steps[ $id ] = array(
|
1004 |
+
'name' => $name,
|
1005 |
+
'view' => $view_callback,
|
1006 |
+
'save' => $save_callback,
|
1007 |
+
);
|
1008 |
+
|
1009 |
+
return true;
|
1010 |
+
|
1011 |
+
} catch ( Framework\SV_WC_Plugin_Exception $exception ) {
|
1012 |
+
|
1013 |
+
Framework\SV_WC_Plugin_Compatibility::wc_doing_it_wrong( __METHOD__, $exception->getMessage(), '5.2.2' );
|
1014 |
+
|
1015 |
+
return false;
|
1016 |
+
}
|
1017 |
+
}
|
1018 |
+
|
1019 |
+
|
1020 |
+
/**
|
1021 |
+
* Marks the setup as complete.
|
1022 |
+
*
|
1023 |
+
* @since 5.2.2
|
1024 |
+
*
|
1025 |
+
* @return bool
|
1026 |
+
*/
|
1027 |
+
public function complete_setup() {
|
1028 |
+
|
1029 |
+
return update_option( "wc_{$this->id}_setup_wizard_complete", 'yes' );
|
1030 |
+
}
|
1031 |
+
|
1032 |
+
|
1033 |
+
/** Conditional Methods *******************************************************************************************/
|
1034 |
+
|
1035 |
+
|
1036 |
+
/**
|
1037 |
+
* Determines if the current page is the setup wizard page.
|
1038 |
+
*
|
1039 |
+
* @since 5.2.2
|
1040 |
+
*
|
1041 |
+
* @return bool
|
1042 |
+
*/
|
1043 |
+
public function is_setup_page() {
|
1044 |
+
|
1045 |
+
return is_admin() && $this->get_slug() === Framework\SV_WC_Helper::get_request( 'page' );
|
1046 |
+
}
|
1047 |
+
|
1048 |
+
|
1049 |
+
/**
|
1050 |
+
* Determines if a step is the current one displayed.
|
1051 |
+
*
|
1052 |
+
* @since 5.2.2
|
1053 |
+
*
|
1054 |
+
* @param string $step_id step ID
|
1055 |
+
* @return bool
|
1056 |
+
*/
|
1057 |
+
public function is_current_step( $step_id ) {
|
1058 |
+
|
1059 |
+
return $this->current_step === $step_id;
|
1060 |
+
}
|
1061 |
+
|
1062 |
+
|
1063 |
+
/**
|
1064 |
+
* Determines if setup has started.
|
1065 |
+
*
|
1066 |
+
* @since 5.2.2
|
1067 |
+
*
|
1068 |
+
* @return bool
|
1069 |
+
*/
|
1070 |
+
public function is_started() {
|
1071 |
+
|
1072 |
+
$steps = array_keys( $this->steps );
|
1073 |
+
|
1074 |
+
return $this->current_step && $this->current_step === reset( $steps );
|
1075 |
+
}
|
1076 |
+
|
1077 |
+
|
1078 |
+
/**
|
1079 |
+
* Determines if setup has completed all of the steps.
|
1080 |
+
*
|
1081 |
+
* @since 5.2.2
|
1082 |
+
*
|
1083 |
+
* @return bool
|
1084 |
+
*/
|
1085 |
+
public function is_finished() {
|
1086 |
+
|
1087 |
+
return self::ACTION_FINISH === Framework\SV_WC_Helper::get_request( 'action' );
|
1088 |
+
}
|
1089 |
+
|
1090 |
+
|
1091 |
+
/**
|
1092 |
+
* Determines if the setup wizard has been completed.
|
1093 |
+
*
|
1094 |
+
* This will be true if any user has been redirected back to the regular
|
1095 |
+
* WordPress dashboard, either manually or after finishing the steps.
|
1096 |
+
*
|
1097 |
+
* @since 5.2.2
|
1098 |
+
*
|
1099 |
+
* @return bool
|
1100 |
+
*/
|
1101 |
+
public function is_complete() {
|
1102 |
+
|
1103 |
+
return 'yes' === get_option( "wc_{$this->id}_setup_wizard_complete", 'no' );
|
1104 |
+
}
|
1105 |
+
|
1106 |
+
|
1107 |
+
/**
|
1108 |
+
* Determines if the given step has been completed.
|
1109 |
+
*
|
1110 |
+
* @since 5.2.2
|
1111 |
+
*
|
1112 |
+
* @param string $step_id step ID to check
|
1113 |
+
* @return bool
|
1114 |
+
*/
|
1115 |
+
public function is_step_complete( $step_id ) {
|
1116 |
+
|
1117 |
+
return array_search( $this->current_step, array_keys( $this->steps ), true ) > array_search( $step_id, array_keys( $this->steps ), true ) || $this->is_finished();
|
1118 |
+
}
|
1119 |
+
|
1120 |
+
|
1121 |
+
/**
|
1122 |
+
* Determines if the wizard has steps to display.
|
1123 |
+
*
|
1124 |
+
* @since 5.2.2
|
1125 |
+
*
|
1126 |
+
* @return bool
|
1127 |
+
*/
|
1128 |
+
public function has_steps() {
|
1129 |
+
|
1130 |
+
return is_array( $this->steps ) && ! empty( $this->steps );
|
1131 |
+
}
|
1132 |
+
|
1133 |
+
|
1134 |
+
/**
|
1135 |
+
* Determines if this setup handler has a given step.
|
1136 |
+
*
|
1137 |
+
* @since 5.2.2
|
1138 |
+
*
|
1139 |
+
* @param string $step_id step ID to check
|
1140 |
+
* @return bool
|
1141 |
+
*/
|
1142 |
+
public function has_step( $step_id ) {
|
1143 |
+
|
1144 |
+
return ! empty( $this->steps[ $step_id ] );
|
1145 |
+
}
|
1146 |
+
|
1147 |
+
|
1148 |
+
/** Getter Methods ************************************************************************************************/
|
1149 |
+
|
1150 |
+
|
1151 |
+
/**
|
1152 |
+
* Gets a given step's title.
|
1153 |
+
*
|
1154 |
+
* @since 5.2.2
|
1155 |
+
*
|
1156 |
+
* @param string $step_id step ID (optional: will assume the current step if unspecified)
|
1157 |
+
* @return string
|
1158 |
+
*/
|
1159 |
+
public function get_step_title( $step_id = '' ) {
|
1160 |
+
|
1161 |
+
$step_title = '';
|
1162 |
+
|
1163 |
+
if ( ! $step_id ) {
|
1164 |
+
$step_id = $this->current_step;
|
1165 |
+
}
|
1166 |
+
|
1167 |
+
if ( isset( $this->steps[ $step_id ]['name'] ) ) {
|
1168 |
+
$step_title = $this->steps[ $step_id ]['name'];
|
1169 |
+
}
|
1170 |
+
|
1171 |
+
return $step_title;
|
1172 |
+
}
|
1173 |
+
|
1174 |
+
|
1175 |
+
/**
|
1176 |
+
* Gets the Setup Wizard URL.
|
1177 |
+
*
|
1178 |
+
* @since 5.2.2
|
1179 |
+
*
|
1180 |
+
* @return string
|
1181 |
+
*/
|
1182 |
+
public function get_setup_url() {
|
1183 |
+
|
1184 |
+
return add_query_arg( 'page', $this->get_slug(), admin_url( 'index.php' ) );
|
1185 |
+
}
|
1186 |
+
|
1187 |
+
|
1188 |
+
/**
|
1189 |
+
* Gets the URL for the next step based on a current step.
|
1190 |
+
*
|
1191 |
+
* @since 5.2.2
|
1192 |
+
*
|
1193 |
+
* @param string $step_id step ID to base "next" off of - defaults to this class's internal pointer
|
1194 |
+
* @return string
|
1195 |
+
*/
|
1196 |
+
public function get_next_step_url( $step_id = '' ) {
|
1197 |
+
|
1198 |
+
if ( ! $step_id ) {
|
1199 |
+
$step_id = $this->current_step;
|
1200 |
+
}
|
1201 |
+
|
1202 |
+
$steps = array_keys( $this->steps );
|
1203 |
+
|
1204 |
+
// if on the last step, next is the final finish step
|
1205 |
+
if ( end( $steps ) === $step_id ) {
|
1206 |
+
|
1207 |
+
$url = $this->get_finish_url();
|
1208 |
+
|
1209 |
+
} else {
|
1210 |
+
|
1211 |
+
$step_index = array_search( $step_id, $steps, true );
|
1212 |
+
|
1213 |
+
// if the current step is found, use the next in the array. otherwise, the first
|
1214 |
+
$step = false !== $step_index ? $steps[ $step_index + 1 ] : reset( $steps );
|
1215 |
+
|
1216 |
+
$url = add_query_arg( 'step', $step );
|
1217 |
+
}
|
1218 |
+
|
1219 |
+
return $url;
|
1220 |
+
}
|
1221 |
+
|
1222 |
+
|
1223 |
+
/**
|
1224 |
+
* Gets a given step's URL.
|
1225 |
+
*
|
1226 |
+
* @since 5.2.2
|
1227 |
+
*
|
1228 |
+
* @param string $step_id step ID
|
1229 |
+
* @return string|false
|
1230 |
+
*/
|
1231 |
+
public function get_step_url( $step_id ) {
|
1232 |
+
|
1233 |
+
$url = false;
|
1234 |
+
|
1235 |
+
if ( $this->has_step( $step_id ) ) {
|
1236 |
+
$url = add_query_arg( 'step', $step_id, remove_query_arg( 'action' ) );
|
1237 |
+
}
|
1238 |
+
|
1239 |
+
return $url;
|
1240 |
+
}
|
1241 |
+
|
1242 |
+
|
1243 |
+
/**
|
1244 |
+
* Gets the "finish" action URL.
|
1245 |
+
*
|
1246 |
+
* @since 5.2.2
|
1247 |
+
*
|
1248 |
+
* @return string
|
1249 |
+
*/
|
1250 |
+
protected function get_finish_url() {
|
1251 |
+
|
1252 |
+
return add_query_arg( 'action', self::ACTION_FINISH, remove_query_arg( 'step' ) );
|
1253 |
+
}
|
1254 |
+
|
1255 |
+
|
1256 |
+
/**
|
1257 |
+
* Gets the return URL.
|
1258 |
+
*
|
1259 |
+
* Can be used to return the user to the dashboard. The plugin's settings URL
|
1260 |
+
* will be used if it exists, otherwise the general dashboard URL.
|
1261 |
+
*
|
1262 |
+
* @since 5.2.2
|
1263 |
+
*
|
1264 |
+
* @return string
|
1265 |
+
*/
|
1266 |
+
protected function get_dashboard_url() {
|
1267 |
+
|
1268 |
+
$settings_url = $this->get_plugin()->get_settings_url();
|
1269 |
+
$dashboard_url = ! empty( $settings_url ) ? $settings_url : admin_url();
|
1270 |
+
|
1271 |
+
return add_query_arg( "wc_{$this->id}_setup_wizard_complete", true, $dashboard_url );
|
1272 |
+
}
|
1273 |
+
|
1274 |
+
|
1275 |
+
/**
|
1276 |
+
* Gets the setup setup handler's slug.
|
1277 |
+
*
|
1278 |
+
* @since 5.2.2
|
1279 |
+
*
|
1280 |
+
* @return string
|
1281 |
+
*/
|
1282 |
+
protected function get_slug() {
|
1283 |
+
|
1284 |
+
return 'wc-' . $this->get_plugin()->get_id_dasherized() . '-setup';
|
1285 |
+
}
|
1286 |
+
|
1287 |
+
|
1288 |
+
/**
|
1289 |
+
* Gets the plugin instance.
|
1290 |
+
*
|
1291 |
+
* @since 5.2.2
|
1292 |
+
*
|
1293 |
+
* @return Framework\SV_WC_Plugin
|
1294 |
+
*/
|
1295 |
+
protected function get_plugin() {
|
1296 |
+
|
1297 |
+
return $this->plugin;
|
1298 |
+
}
|
1299 |
+
|
1300 |
+
|
1301 |
+
}
|
1302 |
+
|
1303 |
+
endif;
|
lib/skyverge/woocommerce/api/abstract-sv-wc-api-json-request.php
ADDED
@@ -0,0 +1,133 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* WooCommerce Plugin Framework
|
4 |
+
*
|
5 |
+
* This source file is subject to the GNU General Public License v3.0
|
6 |
+
* that is bundled with this package in the file license.txt.
|
7 |
+
* It is also available through the world-wide-web at this URL:
|
8 |
+
* http://www.gnu.org/licenses/gpl-3.0.html
|
9 |
+
* If you did not receive a copy of the license and are unable to
|
10 |
+
* obtain it through the world-wide-web, please send an email
|
11 |
+
* to license@skyverge.com so we can send you a copy immediately.
|
12 |
+
*
|
13 |
+
* DISCLAIMER
|
14 |
+
*
|
15 |
+
* Do not edit or add to this file if you wish to upgrade the plugin to newer
|
16 |
+
* versions in the future. If you wish to customize the plugin for your
|
17 |
+
* needs please refer to http://www.skyverge.com
|
18 |
+
*
|
19 |
+
* @package SkyVerge/WooCommerce/API/Request
|
20 |
+
* @author SkyVerge
|
21 |
+
* @copyright Copyright (c) 2013-2018, SkyVerge, Inc.
|
22 |
+
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
|
23 |
+
*/
|
24 |
+
|
25 |
+
namespace WC_Braintree\Plugin_Framework;
|
26 |
+
|
27 |
+
defined( 'ABSPATH' ) or exit;
|
28 |
+
|
29 |
+
if ( ! class_exists( '\\WC_Braintree\\Plugin_Framework\\SV_WC_API_JSON_Request' ) ) :
|
30 |
+
|
31 |
+
/**
|
32 |
+
* Base JSON API request class.
|
33 |
+
*
|
34 |
+
* @since 4.3.0
|
35 |
+
*/
|
36 |
+
abstract class SV_WC_API_JSON_Request implements SV_WC_API_Request {
|
37 |
+
|
38 |
+
|
39 |
+
/** @var string The request method, one of HEAD, GET, PUT, PATCH, POST, DELETE */
|
40 |
+
protected $method;
|
41 |
+
|
42 |
+
/** @var string The request path */
|
43 |
+
protected $path;
|
44 |
+
|
45 |
+
/** @var array The request parameters, if any */
|
46 |
+
protected $params = array();
|
47 |
+
|
48 |
+
/** @var array the request data */
|
49 |
+
protected $data = array();
|
50 |
+
|
51 |
+
|
52 |
+
/**
|
53 |
+
* Get the request method.
|
54 |
+
*
|
55 |
+
* @since 4.3.0
|
56 |
+
* @see SV_WC_API_Request::get_method()
|
57 |
+
* @return string
|
58 |
+
*/
|
59 |
+
public function get_method() {
|
60 |
+
return $this->method;
|
61 |
+
}
|
62 |
+
|
63 |
+
|
64 |
+
/**
|
65 |
+
* Get the request path.
|
66 |
+
*
|
67 |
+
* @since 4.3.0
|
68 |
+
* @see SV_WC_API_Request::get_path()
|
69 |
+
* @return string
|
70 |
+
*/
|
71 |
+
public function get_path() {
|
72 |
+
return $this->path;
|
73 |
+
}
|
74 |
+
|
75 |
+
|
76 |
+
/**
|
77 |
+
* Get the request parameters.
|
78 |
+
*
|
79 |
+
* @since 4.3.0
|
80 |
+
* @see SV_WC_API_Request::get_params()
|
81 |
+
* @return array
|
82 |
+
*/
|
83 |
+
public function get_params() {
|
84 |
+
return $this->params;
|
85 |
+
}
|
86 |
+
|
87 |
+
|
88 |
+
/**
|
89 |
+
* Get the request data.
|
90 |
+
*
|
91 |
+
* @since 4.5.0
|
92 |
+
* @return array
|
93 |
+
*/
|
94 |
+
public function get_data() {
|
95 |
+
return $this->data;
|
96 |
+
}
|
97 |
+
|
98 |
+
|
99 |
+
/** API Helper Methods ******************************************************/
|
100 |
+
|
101 |
+
|
102 |
+
/**
|
103 |
+
* Get the string representation of this request.
|
104 |
+
*
|
105 |
+
* @since 4.3.0
|
106 |
+
* @see SV_WC_API_Request::to_string()
|
107 |
+
* @return string
|
108 |
+
*/
|
109 |
+
public function to_string() {
|
110 |
+
|
111 |
+
$data = $this->get_data();
|
112 |
+
|
113 |
+
return ! empty( $data ) ? json_encode( $data ) : '';
|
114 |
+
}
|
115 |
+
|
116 |
+
|
117 |
+
/**
|
118 |
+
* Get the string representation of this request with any and all sensitive elements masked
|
119 |
+
* or removed.
|
120 |
+
*
|
121 |
+
* @since 4.3.0
|
122 |
+
* @see SV_WC_API_Request::to_string_safe()
|
123 |
+
* @return string
|
124 |
+
*/
|
125 |
+
public function to_string_safe() {
|
126 |
+
|
127 |
+
return $this->to_string();
|
128 |
+
}
|
129 |
+
|
130 |
+
|
131 |
+
}
|
132 |
+
|
133 |
+
endif; // class exists check
|
lib/skyverge/woocommerce/api/abstract-sv-wc-api-json-response.php
ADDED
@@ -0,0 +1,104 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* WooCommerce Plugin Framework
|
4 |
+
*
|
5 |
+
* This source file is subject to the GNU General Public License v3.0
|
6 |
+
* that is bundled with this package in the file license.txt.
|
7 |
+
* It is also available through the world-wide-web at this URL:
|
8 |
+
* http://www.gnu.org/licenses/gpl-3.0.html
|
9 |
+
* If you did not receive a copy of the license and are unable to
|
10 |
+
* obtain it through the world-wide-web, please send an email
|
11 |
+
* to license@skyverge.com so we can send you a copy immediately.
|
12 |
+
*
|
13 |
+
* DISCLAIMER
|
14 |
+
*
|
15 |
+
* Do not edit or add to this file if you wish to upgrade the plugin to newer
|
16 |
+
* versions in the future. If you wish to customize the plugin for your
|
17 |
+
* needs please refer to http://www.skyverge.com
|
18 |
+
*
|
19 |
+
* @package SkyVerge/WooCommerce/API/Response
|
20 |
+
* @author SkyVerge
|
21 |
+
* @copyright Copyright (c) 2013-2018, SkyVerge, Inc.
|
22 |
+
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
|
23 |
+
*/
|
24 |
+
|
25 |
+
namespace WC_Braintree\Plugin_Framework;
|
26 |
+
|
27 |
+
defined( 'ABSPATH' ) or exit;
|
28 |
+
|
29 |
+
if ( ! class_exists( '\\WC_Braintree\\Plugin_Framework\\SV_WC_API_JSON_Response' ) ) :
|
30 |
+
|
31 |
+
|
32 |
+
/**
|
33 |
+
* Base JSON API response class.
|
34 |
+
*
|
35 |
+
* @since 4.3.0
|
36 |
+
*/
|
37 |
+
abstract class SV_WC_API_JSON_Response implements SV_WC_API_Response {
|
38 |
+
|
39 |
+
|
40 |
+
/** @var string string representation of this response */
|
41 |
+
protected $raw_response_json;
|
42 |
+
|
43 |
+
/** @var mixed decoded response data */
|
44 |
+
public $response_data;
|
45 |
+
|
46 |
+
|
47 |
+
/**
|
48 |
+
* Build the data object from the raw JSON.
|
49 |
+
*
|
50 |
+
* @since 4.3.0
|
51 |
+
* @param string $raw_response_json The raw JSON
|
52 |
+
*/
|
53 |
+
public function __construct( $raw_response_json ) {
|
54 |
+
|
55 |
+
$this->raw_response_json = $raw_response_json;
|
56 |
+
|
57 |
+
$this->response_data = json_decode( $raw_response_json );
|
58 |
+
}
|
59 |
+
|
60 |
+
|
61 |
+
/**
|
62 |
+
* Magic accessor for response data attributes
|
63 |
+
*
|
64 |
+
* @since 4.3.0
|
65 |
+
* @param string $name The attribute name to get.
|
66 |
+
* @return mixed The attribute value
|
67 |
+
*/
|
68 |
+
public function __get( $name ) {
|
69 |
+
|
70 |
+
// accessing the response_data object indirectly via attribute (useful when it's a class)
|
71 |
+
return isset( $this->response_data->$name ) ? $this->response_data->$name : null;
|
72 |
+
}
|
73 |
+
|
74 |
+
|
75 |
+
/**
|
76 |
+
* Get the string representation of this response.
|
77 |
+
*
|
78 |
+
* @since 4.3.0
|
79 |
+
* @see SV_WC_API_Response::to_string()
|
80 |
+
* @return string
|
81 |
+
*/
|
82 |
+
public function to_string() {
|
83 |
+
|
84 |
+
return $this->raw_response_json;
|
85 |
+
}
|
86 |
+
|
87 |
+
|
88 |
+
/**
|
89 |
+
* Get the string representation of this response with any and all sensitive elements masked
|
90 |
+
* or removed.
|
91 |
+
*
|
92 |
+
* @since 4.3.0
|
93 |
+
* @see SV_WC_API_Response::to_string_safe()
|
94 |
+
* @return string
|
95 |
+
*/
|
96 |
+
public function to_string_safe() {
|
97 |
+
|
98 |
+
return $this->to_string();
|
99 |
+
}
|
100 |
+
|
101 |
+
|
102 |
+
}
|
103 |
+
|
104 |
+
endif; // class exists check
|
lib/skyverge/woocommerce/api/abstract-sv-wc-api-xml-request.php
ADDED
@@ -0,0 +1,213 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* WooCommerce Plugin Framework
|
4 |
+
*
|
5 |
+
* This source file is subject to the GNU General Public License v3.0
|
6 |
+
* that is bundled with this package in the file license.txt.
|
7 |
+
* It is also available through the world-wide-web at this URL:
|
8 |
+
* http://www.gnu.org/licenses/gpl-3.0.html
|
9 |
+
* If you did not receive a copy of the license and are unable to
|
10 |
+
* obtain it through the world-wide-web, please send an email
|
11 |
+
* to license@skyverge.com so we can send you a copy immediately.
|
12 |
+
*
|
13 |
+
* DISCLAIMER
|
14 |
+
*
|
15 |
+
* Do not edit or add to this file if you wish to upgrade the plugin to newer
|
16 |
+
* versions in the future. If you wish to customize the plugin for your
|
17 |
+
* needs please refer to http://www.skyverge.com
|
18 |
+
*
|
19 |
+
* @package SkyVerge/WooCommerce/API/Request
|
20 |
+
* @author SkyVerge
|
21 |
+
* @copyright Copyright (c) 2013-2018, SkyVerge, Inc.
|
22 |
+
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
|
23 |
+
*/
|
24 |
+
|
25 |
+
namespace WC_Braintree\Plugin_Framework;
|
26 |
+
|
27 |
+
defined( 'ABSPATH' ) or exit;
|
28 |
+
|
29 |
+
if ( ! class_exists( '\\WC_Braintree\\Plugin_Framework\\SV_WC_API_XML_Request' ) ) :
|
30 |
+
|
31 |
+
/**
|
32 |
+
* Base XML API request class.
|
33 |
+
*
|
34 |
+
* @since 4.3.0
|
35 |
+
*/
|
36 |
+
abstract class SV_WC_API_XML_Request implements SV_WC_API_Request {
|
37 |
+
|
38 |
+
/** @var string the request method, one of HEAD, GET, PUT, PATCH, POST, DELETE */
|
39 |
+
protected $method;
|
40 |
+
|
41 |
+
/** @var string the request path */
|
42 |
+
protected $path = '';
|
43 |
+
|
44 |
+
/** @var array the request parameters */
|
45 |
+
protected $params = array();
|
46 |
+
|
47 |
+
/** @var array request data */
|
48 |
+
protected $request_data;
|
49 |
+
|
50 |
+
/** @var string root element for XML */
|
51 |
+
protected $root_element;
|
52 |
+
|
53 |
+
/** @var \XMLWriter $xml object */
|
54 |
+
protected $xml;
|
55 |
+
|
56 |
+
/** @var string complete request XML */
|
57 |
+
protected $request_xml;
|
58 |
+
|
59 |
+
|
60 |
+
/**
|
61 |
+
* Get the method for this request.
|
62 |
+
*
|
63 |
+
* @since 4.3.0
|
64 |
+
* @see SV_WC_API_Request::get_method()
|
65 |
+
* @return null|string
|
66 |
+
*/
|
67 |
+
public function get_method() {
|
68 |
+
return $this->method;
|
69 |
+
}
|
70 |
+
|
71 |
+
|
72 |
+
/**
|
73 |
+
* Get the path for this request.
|
74 |
+
*
|
75 |
+
* @since 4.3.0
|
76 |
+
* @see SV_WC_API_Request::get_path()
|
77 |
+
* @return string
|
78 |
+
*/
|
79 |
+
public function get_path() {
|
80 |
+
return $this->path;
|
81 |
+
}
|
82 |
+
|
83 |
+
|
84 |
+
/**
|
85 |
+
* Get the request parameters.
|
86 |
+
*
|
87 |
+
* @since 4.5.0
|
88 |
+
* @return array
|
89 |
+
*/
|
90 |
+
public function get_params() {
|
91 |
+
return $this->params;
|
92 |
+
}
|
93 |
+
|
94 |
+
|
95 |
+
/**
|
96 |
+
* Convert the request data into XML.
|
97 |
+
*
|
98 |
+
* @since 4.3.0
|
99 |
+
* @return string
|
100 |
+
*/
|
101 |
+
protected function to_xml() {
|
102 |
+
|
103 |
+
if ( ! empty( $this->request_xml ) ) {
|
104 |
+
return $this->request_xml;
|
105 |
+
}
|
106 |
+
|
107 |
+
$this->xml = new \XMLWriter();
|
108 |
+
|
109 |
+
// Create XML document in memory
|
110 |
+
$this->xml->openMemory();
|
111 |
+
|
112 |
+
// Set XML version & encoding
|
113 |
+
$this->xml->startDocument( '1.0', 'UTF-8' );
|
114 |
+
|
115 |
+
$request_data = $this->get_data();
|
116 |
+
|
117 |
+
SV_WC_Helper::array_to_xml( $this->xml, $this->get_root_element(), $request_data[ $this->get_root_element() ] );
|
118 |
+
|
119 |
+
$this->xml->endDocument();
|
120 |
+
|
121 |
+
return $this->request_xml = $this->xml->outputMemory();
|
122 |
+
}
|
123 |
+
|
124 |
+
|
125 |
+
/**
|
126 |
+
* Gets the request data to be converted to XML.
|
127 |
+
*
|
128 |
+
* @since 4.3.0
|
129 |
+
* @deprecated 5.0.0
|
130 |
+
*
|
131 |
+
* @return array
|
132 |
+
*/
|
133 |
+
public function get_request_data() {
|
134 |
+
|
135 |
+
SV_WC_Plugin_Compatibility::wc_deprecated_function( __FUNCTION__, '5.0.0', 'SV_WC_API_XML_Request::get_data' );
|
136 |
+
|
137 |
+
return $this->get_data();
|
138 |
+
}
|
139 |
+
|
140 |
+
|
141 |
+
/**
|
142 |
+
* Gets the request data to be converted to XML.
|
143 |
+
*
|
144 |
+
* @since 5.0.0
|
145 |
+
* @return array
|
146 |
+
*/
|
147 |
+
public function get_data() {
|
148 |
+
|
149 |
+
return $this->request_data;
|
150 |
+
}
|
151 |
+
|
152 |
+
|
153 |
+
/**
|
154 |
+
* Get the string representation of this request
|
155 |
+
*
|
156 |
+
* @since 4.3.0
|
157 |
+
* @see SV_WC_API_Request::to_string()
|
158 |
+
* @return string
|
159 |
+
*/
|
160 |
+
public function to_string() {
|
161 |
+
|
162 |
+
return $this->to_xml();
|
163 |
+
}
|
164 |
+
|
165 |
+
|
166 |
+
/**
|
167 |
+
* Get the string representation of this request with any and all sensitive elements masked
|
168 |
+
* or removed.
|
169 |
+
*
|
170 |
+
* @since 4.3.0
|
171 |
+
* @see SV_WC_API_Request::to_string_safe()
|
172 |
+
* @return string
|
173 |
+
*/
|
174 |
+
public function to_string_safe() {
|
175 |
+
|
176 |
+
return $this->prettify_xml( $this->to_string() );
|
177 |
+
}
|
178 |
+
|
179 |
+
|
180 |
+
/**
|
181 |
+
* Helper method for making XML pretty, suitable for logging or rendering
|
182 |
+
*
|
183 |
+
* @since 4.3.0
|
184 |
+
* @param string $xml_string ugly XML string
|
185 |
+
* @return string
|
186 |
+
*/
|
187 |
+
public function prettify_xml( $xml_string ) {
|
188 |
+
|
189 |
+
$dom = new \DOMDocument();
|
190 |
+
|
191 |
+
// suppress errors for invalid XML syntax issues
|
192 |
+
if ( @$dom->loadXML( $xml_string ) ) {
|
193 |
+
$dom->formatOutput = true;
|
194 |
+
$xml_string = $dom->saveXML();
|
195 |
+
}
|
196 |
+
|
197 |
+
return $xml_string;
|
198 |
+
}
|
199 |
+
|
200 |
+
|
201 |
+
/**
|
202 |
+
* Concrete classes must implement this method to return the root element
|
203 |
+
* for the XML document
|
204 |
+
*
|
205 |
+
* @since 4.3.0
|
206 |
+
* @return string
|
207 |
+
*/
|
208 |
+
abstract protected function get_root_element();
|
209 |
+
|
210 |
+
|
211 |
+
}
|
212 |
+
|
213 |
+
endif; // class exists check
|
lib/skyverge/woocommerce/api/abstract-sv-wc-api-xml-response.php
ADDED
@@ -0,0 +1,136 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* WooCommerce Plugin Framework
|
4 |
+
*
|
5 |
+
* This source file is subject to the GNU General Public License v3.0
|
6 |
+
* that is bundled with this package in the file license.txt.
|
7 |
+
* It is also available through the world-wide-web at this URL:
|
8 |
+
* http://www.gnu.org/licenses/gpl-3.0.html
|
9 |
+
* If you did not receive a copy of the license and are unable to
|
10 |
+
* obtain it through the world-wide-web, please send an email
|
11 |
+
* to license@skyverge.com so we can send you a copy immediately.
|
12 |
+
*
|
13 |
+
* DISCLAIMER
|
14 |
+
*
|
15 |
+
* Do not edit or add to this file if you wish to upgrade the plugin to newer
|
16 |
+
* versions in the future. If you wish to customize the plugin for your
|
17 |
+
* needs please refer to http://www.skyverge.com
|
18 |
+
*
|
19 |
+
* @package SkyVerge/WooCommerce/API/Response
|
20 |
+
* @author SkyVerge
|
21 |
+
* @copyright Copyright (c) 2013-2018, SkyVerge, Inc.
|
22 |
+
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
|
23 |
+
*/
|
24 |
+
|
25 |
+
namespace WC_Braintree\Plugin_Framework;
|
26 |
+
|
27 |
+
defined( 'ABSPATH' ) or exit;
|
28 |
+
|
29 |
+
if ( ! class_exists( '\\WC_Braintree\\Plugin_Framework\\SV_WC_API_XML_Response' ) ) :
|
30 |
+
|
31 |
+
/**
|
32 |
+
* Base XML API response class.
|
33 |
+
*
|
34 |
+
* @since 4.3.0
|
35 |
+
*/
|
36 |
+
abstract class SV_WC_API_XML_Response implements SV_WC_API_Response {
|
37 |
+
|
38 |
+
|
39 |
+
/** @var string string representation of this response */
|
40 |
+
protected $raw_response_xml;
|
41 |
+
|
42 |
+
/** @var SimpleXMLElement XML object */
|
43 |
+
protected $response_xml;
|
44 |
+
|
45 |
+
/** @var array|mixed|object XML data after conversion into an usable object */
|
46 |
+
protected $response_data;
|
47 |
+
|
48 |
+
|
49 |
+
/**
|
50 |
+
* Build an XML object from the raw response.
|
51 |
+
*
|
52 |
+
* @since 4.3.0
|
53 |
+
* @param string $raw_response_xml The raw response XML
|
54 |
+
*/
|
55 |
+
public function __construct( $raw_response_xml ) {
|
56 |
+
|
57 |
+
$this->raw_response_xml = $raw_response_xml;
|
58 |
+
|
59 |
+
// LIBXML_NOCDATA ensures that any XML fields wrapped in [CDATA] will be included as text nodes
|
60 |
+
$this->response_xml = new \SimpleXMLElement( $raw_response_xml, LIBXML_NOCDATA );
|
61 |
+
|
62 |
+
/**
|
63 |
+
* workaround to convert the horrible data structure that SimpleXMLElement returns
|
64 |
+
* and provide a nice array of stdClass objects. Note there is some fidelity lost
|
65 |
+
* in the conversion (such as attributes), but implementing classes can access
|
66 |
+
* the response_xml member directly to retrieve them as needed.
|
67 |
+
*/
|
68 |
+
$this->response_data = json_decode( json_encode( $this->response_xml ) );
|
69 |
+
}
|
70 |
+
|
71 |
+
|
72 |
+
/**
|
73 |
+
* Magic method for getting XML element data. Note the response data has
|
74 |
+
* already been casted into simple data types (string,int,array) and does not
|
75 |
+
* require further casting in order to use.
|
76 |
+
*
|
77 |
+
* @since 4.3.0
|
78 |
+
* @param string $key
|
79 |
+
* @return mixed
|
80 |
+
*/
|
81 |
+
public function __get( $key ) {
|
82 |
+
|
83 |
+
if ( ! isset( $this->response_data->$key ) ) {
|
84 |
+
return null;
|
85 |
+
}
|
86 |
+
|
87 |
+
// array cast & empty check prevents fataling on empty stdClass objects
|
88 |
+
$array = (array) $this->response_data->$key;
|
89 |
+
|
90 |
+
if ( empty( $array ) ) {
|
91 |
+
return null;
|
92 |
+
}
|
93 |
+
|
94 |
+
return $this->response_data->$key;
|
95 |
+
}
|
96 |
+
|
97 |
+
|
98 |
+
/**
|
99 |
+
* Get the string representation of this response.
|
100 |
+
*
|
101 |
+
* @since 4.3.0
|
102 |
+
* @return string
|
103 |
+
*/
|
104 |
+
public function to_string() {
|
105 |
+
|
106 |
+
$response = $this->raw_response_xml;
|
107 |
+
|
108 |
+
$dom = new \DOMDocument();
|
109 |
+
|
110 |
+
// suppress errors for invalid XML syntax issues
|
111 |
+
if ( @$dom->loadXML( $response ) ) {
|
112 |
+
$dom->formatOutput = true;
|
113 |
+
$response = $dom->saveXML();
|
114 |
+
}
|
115 |
+
|
116 |
+
return $response;
|
117 |
+
}
|
118 |
+
|
119 |
+
|
120 |
+
/**
|
121 |
+
* Get the string representation of this response with any and all sensitive elements masked
|
122 |
+
* or removed.
|
123 |
+
*
|
124 |
+
* @since 4.3.0
|
125 |
+
* @see SV_WC_API_Response::to_string_safe()
|
126 |
+
* @return string
|
127 |
+
*/
|
128 |
+
public function to_string_safe() {
|
129 |
+
|
130 |
+
return $this->to_string();
|
131 |
+
}
|
132 |
+
|
133 |
+
|
134 |
+
}
|
135 |
+
|
136 |
+
endif; // class exists check
|
lib/skyverge/woocommerce/api/class-sv-wc-api-base.php
CHANGED
@@ -18,15 +18,15 @@
|
|
18 |
*
|
19 |
* @package SkyVerge/WooCommerce/API
|
20 |
* @author SkyVerge
|
21 |
-
* @copyright Copyright (c) 2013-
|
22 |
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
|
23 |
*/
|
24 |
|
25 |
-
namespace
|
26 |
|
27 |
defined( 'ABSPATH' ) or exit;
|
28 |
|
29 |
-
if ( ! class_exists( '
|
30 |
|
31 |
/**
|
32 |
* # WooCommerce Plugin Framework API Base Class
|
@@ -98,7 +98,7 @@ abstract class SV_WC_API_Base {
|
|
98 |
|
99 |
$start_time = microtime( true );
|
100 |
|
101 |
-
//
|
102 |
if ( $this->require_tls_1_2() ) {
|
103 |
add_action( 'http_api_curl', array( $this, 'set_tls_1_2_request' ), 10, 3 );
|
104 |
}
|
@@ -368,15 +368,17 @@ abstract class SV_WC_API_Base {
|
|
368 |
* Gets the request URL query.
|
369 |
*
|
370 |
* @since 4.5.0
|
|
|
371 |
* @return string
|
372 |
*/
|
373 |
protected function get_request_query() {
|
374 |
|
375 |
-
$query
|
|
|
376 |
|
377 |
-
if (
|
378 |
|
379 |
-
$params =
|
380 |
|
381 |
if ( ! empty( $params ) ) {
|
382 |
$query = http_build_query( $params, '', '&' );
|
@@ -773,19 +775,6 @@ abstract class SV_WC_API_Base {
|
|
773 |
return;
|
774 |
}
|
775 |
|
776 |
-
$versions = curl_version();
|
777 |
-
$curl_version = $versions['version'];
|
778 |
-
|
779 |
-
// Get the SSL details
|
780 |
-
list( $ssl_type, $ssl_version ) = explode( '/', $versions['ssl_version'] );
|
781 |
-
|
782 |
-
$ssl_version = substr( $ssl_version, 0, -1 );
|
783 |
-
|
784 |
-
// If cURL and/or OpenSSL aren't up to the challenge, bail
|
785 |
-
if ( ! version_compare( $curl_version, '7.34.0', '>=' ) || ( 'OpenSSL' === $ssl_type && ! version_compare( $ssl_version, '1.0.1', '>=' ) ) ) {
|
786 |
-
return;
|
787 |
-
}
|
788 |
-
|
789 |
curl_setopt( $handle, CURLOPT_SSLVERSION, 6 );
|
790 |
}
|
791 |
|
@@ -798,11 +787,46 @@ abstract class SV_WC_API_Base {
|
|
798 |
* @since 4.4.0
|
799 |
* @return bool
|
800 |
*/
|
801 |
-
|
802 |
return false;
|
803 |
}
|
804 |
|
805 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
806 |
}
|
807 |
|
808 |
endif;
|
18 |
*
|
19 |
* @package SkyVerge/WooCommerce/API
|
20 |
* @author SkyVerge
|
21 |
+
* @copyright Copyright (c) 2013-2018, SkyVerge, Inc.
|
22 |
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
|
23 |
*/
|
24 |
|
25 |
+
namespace WC_Braintree\Plugin_Framework;
|
26 |
|
27 |
defined( 'ABSPATH' ) or exit;
|
28 |
|
29 |
+
if ( ! class_exists( '\\WC_Braintree\\Plugin_Framework\\SV_WC_API_Base' ) ) :
|
30 |
|
31 |
/**
|
32 |
* # WooCommerce Plugin Framework API Base Class
|
98 |
|
99 |
$start_time = microtime( true );
|
100 |
|
101 |
+
// if this API requires TLS v1.2, force it
|
102 |
if ( $this->require_tls_1_2() ) {
|
103 |
add_action( 'http_api_curl', array( $this, 'set_tls_1_2_request' ), 10, 3 );
|
104 |
}
|
368 |
* Gets the request URL query.
|
369 |
*
|
370 |
* @since 4.5.0
|
371 |
+
*
|
372 |
* @return string
|
373 |
*/
|
374 |
protected function get_request_query() {
|
375 |
|
376 |
+
$query = '';
|
377 |
+
$request = $this->get_request();
|
378 |
|
379 |
+
if ( $request && in_array( strtoupper( $this->get_request_method() ), array( 'GET', 'HEAD' ), true ) ) {
|
380 |
|
381 |
+
$params = $request->get_params();
|
382 |
|
383 |
if ( ! empty( $params ) ) {
|
384 |
$query = http_build_query( $params, '', '&' );
|
775 |
return;
|
776 |
}
|
777 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
778 |
curl_setopt( $handle, CURLOPT_SSLVERSION, 6 );
|
779 |
}
|
780 |
|
787 |
* @since 4.4.0
|
788 |
* @return bool
|
789 |
*/
|
790 |
+
public function require_tls_1_2() {
|
791 |
return false;
|
792 |
}
|
793 |
|
794 |
|
795 |
+
/**
|
796 |
+
* Determines if TLS 1.2 is available.
|
797 |
+
*
|
798 |
+
* @since 4.6.5
|
799 |
+
*
|
800 |
+
* @return bool
|
801 |
+
*/
|
802 |
+
public function is_tls_1_2_available() {
|
803 |
+
|
804 |
+
// assume availability to avoid notices for unknown SSL types
|
805 |
+
$is_available = true;
|
806 |
+
|
807 |
+
// check the cURL version if installed
|
808 |
+
if ( is_callable( 'curl_version' ) ) {
|
809 |
+
|
810 |
+
$versions = curl_version();
|
811 |
+
|
812 |
+
// cURL 7.34.0 is considered the minimum version that supports TLS 1.2
|
813 |
+
if ( version_compare( $versions['version'], '7.34.0', '<' ) ) {
|
814 |
+
$is_available = false;
|
815 |
+
}
|
816 |
+
}
|
817 |
+
|
818 |
+
/**
|
819 |
+
* Filters whether TLS 1.2 is available.
|
820 |
+
*
|
821 |
+
* @since 4.7.1
|
822 |
+
*
|
823 |
+
* @param bool $is_available whether TLS 1.2 is available
|
824 |
+
* @param \SV_WC_API_Base $api API class instance
|
825 |
+
*/
|
826 |
+
return apply_filters( 'wc_' . $this->get_plugin()->get_id() . '_api_is_tls_1_2_available', $is_available, $this );
|
827 |
+
}
|
828 |
+
|
829 |
+
|
830 |
}
|
831 |
|
832 |
endif;
|
lib/skyverge/woocommerce/api/class-sv-wc-api-exception.php
CHANGED
@@ -18,15 +18,15 @@
|
|
18 |
*
|
19 |
* @package SkyVerge/WooCommerce/API/Exceptions
|
20 |
* @author SkyVerge
|
21 |
-
* @copyright Copyright (c) 2013-
|
22 |
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
|
23 |
*/
|
24 |
|
25 |
-
namespace
|
26 |
|
27 |
defined( 'ABSPATH' ) or exit;
|
28 |
|
29 |
-
if ( ! class_exists( '
|
30 |
|
31 |
/**
|
32 |
* Plugin Framework API Exception - generic API Exception
|
18 |
*
|
19 |
* @package SkyVerge/WooCommerce/API/Exceptions
|
20 |
* @author SkyVerge
|
21 |
+
* @copyright Copyright (c) 2013-2018, SkyVerge, Inc.
|
22 |
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
|
23 |
*/
|
24 |
|
25 |
+
namespace WC_Braintree\Plugin_Framework;
|
26 |
|
27 |
defined( 'ABSPATH' ) or exit;
|
28 |
|
29 |
+
if ( ! class_exists( '\\WC_Braintree\\Plugin_Framework\\SV_WC_API_Exception' ) ) :
|
30 |
|
31 |
/**
|
32 |
* Plugin Framework API Exception - generic API Exception
|
lib/skyverge/woocommerce/api/interface-sv-wc-api-request.php
CHANGED
@@ -18,15 +18,15 @@
|
|
18 |
*
|
19 |
* @package SkyVerge/WooCommerce/API/Request
|
20 |
* @author SkyVerge
|
21 |
-
* @copyright Copyright (c) 2013-
|
22 |
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
|
23 |
*/
|
24 |
|
25 |
-
namespace
|
26 |
|
27 |
defined( 'ABSPATH' ) or exit;
|
28 |
|
29 |
-
if ( ! interface_exists( '
|
30 |
|
31 |
/**
|
32 |
* API Request
|
@@ -52,6 +52,26 @@ interface SV_WC_API_Request {
|
|
52 |
public function get_path();
|
53 |
|
54 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
55 |
/**
|
56 |
* Returns the string representation of this request
|
57 |
*
|
18 |
*
|
19 |
* @package SkyVerge/WooCommerce/API/Request
|
20 |
* @author SkyVerge
|
21 |
+
* @copyright Copyright (c) 2013-2018, SkyVerge, Inc.
|
22 |
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
|
23 |
*/
|
24 |
|
25 |
+
namespace WC_Braintree\Plugin_Framework;
|
26 |
|
27 |
defined( 'ABSPATH' ) or exit;
|
28 |
|
29 |
+
if ( ! interface_exists( '\\WC_Braintree\\Plugin_Framework\\SV_WC_API_Request' ) ) :
|
30 |
|
31 |
/**
|
32 |
* API Request
|
52 |
public function get_path();
|
53 |
|
54 |
|
55 |
+
/**
|
56 |
+
* Gets the request query params.
|
57 |
+
*
|
58 |
+
* @since 5.0.0
|
59 |
+
*
|
60 |
+
* @return array
|
61 |
+
*/
|
62 |
+
public function get_params();
|
63 |
+
|
64 |
+
|
65 |
+
/**
|
66 |
+
* Gets the request data.
|
67 |
+
*
|
68 |
+
* @since 5.0.0
|
69 |
+
*
|
70 |
+
* @return array
|
71 |
+
*/
|
72 |
+
public function get_data();
|
73 |
+
|
74 |
+
|
75 |
/**
|
76 |
* Returns the string representation of this request
|
77 |
*
|
lib/skyverge/woocommerce/api/interface-sv-wc-api-response.php
CHANGED
@@ -18,15 +18,15 @@
|
|
18 |
*
|
19 |
* @package SkyVerge/WooCommerce/API/Request
|
20 |
* @author SkyVerge
|
21 |
-
* @copyright Copyright (c) 2013-
|
22 |
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
|
23 |
*/
|
24 |
|
25 |
-
namespace
|
26 |
|
27 |
defined( 'ABSPATH' ) or exit;
|
28 |
|
29 |
-
if ( ! interface_exists( '
|
30 |
|
31 |
/**
|
32 |
* API Response
|
18 |
*
|
19 |
* @package SkyVerge/WooCommerce/API/Request
|
20 |
* @author SkyVerge
|
21 |
+
* @copyright Copyright (c) 2013-2018, SkyVerge, Inc.
|
22 |
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
|
23 |
*/
|
24 |
|
25 |
+
namespace WC_Braintree\Plugin_Framework;
|
26 |
|
27 |
defined( 'ABSPATH' ) or exit;
|
28 |
|
29 |
+
if ( ! interface_exists( '\\WC_Braintree\\Plugin_Framework\\SV_WC_API_Response' ) ) :
|
30 |
|
31 |
/**
|
32 |
* API Response
|
lib/skyverge/woocommerce/assets/css/admin/sv-wc-plugin-admin-setup-wizard.min.css
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
h1#wc-logo.sv-wc-plugin-logo{font-size:28px;font-weight:bold}h1#wc-logo.sv-wc-plugin-logo a{color:#444444;text-decoration:none}h1#wc-logo.sv-wc-plugin-logo a:hover{color:#222222;text-decoration:none}.sv-wc-plugin-admin-setup-content .error{background:#dc3232;border-radius:5px;color:#fff;padding:1em}.sv-wc-plugin-admin-setup-content .error a{color:#fff;text-decoration:none}.sv-wc-plugin-admin-setup-content .error a:hover{text-decoration:underline}.sv-wc-plugin-admin-setup-content .sv-wc-plugin-admin-setup-control{margin-bottom:20px}.sv-wc-plugin-admin-setup-content .sv-wc-plugin-admin-setup-control label{color:#666;display:inline-block;font-size:15px;font-weight:500;margin-top:.85em;margin-bottom:.5em}.sv-wc-plugin-admin-setup-content .sv-wc-plugin-admin-setup-control input[type="text"],.sv-wc-plugin-admin-setup-content .sv-wc-plugin-admin-setup-control input[type="number"],.sv-wc-plugin-admin-setup-content .sv-wc-plugin-admin-setup-control input[type="password"],.sv-wc-plugin-admin-setup-content .sv-wc-plugin-admin-setup-control select{background-color:#fff;border:1px solid #ddd;border-radius:4px;color:#444;display:inline-block;font-size:16px;height:30px;padding:0 24px 0 8px;width:calc(100% - 8px - 24px - 2px)}.sv-wc-plugin-admin-setup-content .sv-wc-plugin-admin-setup-control select{width:100%}.sv-wc-plugin-admin-setup-content .sv-wc-plugin-admin-setup-control textarea{background-color:#fff;border:1px solid #ddd;border-radius:4px;color:#444;font-size:16px;padding:10px}.sv-wc-plugin-admin-setup-content .sv-wc-plugin-admin-setup-control .description{color:#888;font-size:13px;margin:5px 0 0}.sv-wc-plugin-admin-setup-content .sv-wc-plugin-admin-setup-control.toggle{display:flex;flex-wrap:nowrap;justify-content:space-between;padding:0;border-bottom:1px solid #eee;color:#666;align-items:top}.sv-wc-plugin-admin-setup-content .sv-wc-plugin-admin-setup-control.toggle:last-child{border-bottom:0}.sv-wc-plugin-admin-setup-content .sv-wc-plugin-admin-setup-control.toggle .name{flex-basis:0;min-width:160px;text-align:center;font-weight:bold;align-self:stretch;display:flex;align-items:baseline}.sv-wc-plugin-admin-setup-content .sv-wc-plugin-admin-setup-control.toggle .content{flex-grow:1;padding:20px}.sv-wc-plugin-admin-setup-content .sv-wc-plugin-admin-setup-control.toggle .content p{margin-bottom:1em}.sv-wc-plugin-admin-setup-content .sv-wc-plugin-admin-setup-control.toggle .content p:last-child{margin-bottom:0}.sv-wc-plugin-admin-setup-content .sv-wc-plugin-admin-setup-control.toggle .enable{flex-basis:0;min-width:75px;text-align:center;cursor:pointer;padding:2em 0;position:relative;max-height:1.5em;align-self:flex-start}.sv-wc-plugin-admin-setup-content .sv-wc-plugin-admin-setup-control.toggle .toggle{height:16px;width:32px;border:2px solid #935687;background-color:#935687;display:inline-block;text-indent:-9999px;border-radius:10em;position:relative}.sv-wc-plugin-admin-setup-content .sv-wc-plugin-admin-setup-control.toggle .toggle input[type=checkbox]{display:none}.sv-wc-plugin-admin-setup-content .sv-wc-plugin-admin-setup-control.toggle .toggle:before{content:"";display:block;width:16px;height:16px;background:#fff;position:absolute;top:0;right:0;border-radius:100%}.sv-wc-plugin-admin-setup-content .sv-wc-plugin-admin-setup-control.toggle .toggle.disabled{border-color:#999;background-color:#999}.sv-wc-plugin-admin-setup-content .sv-wc-plugin-admin-setup-control.toggle .toggle.disabled:before{right:auto;left:0}
|
lib/skyverge/woocommerce/assets/css/admin/sv-wc-plugin-admin-setup-wizard.min.css.map
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"version": 3,
|
3 |
+
"mappings": "AAAA,4BAA6B,CAE5B,SAAS,CAAE,IAAI,CACf,WAAW,CAAE,IAAI,CAEjB,8BAAE,CAED,KAAK,CAAE,OAAO,CACd,eAAe,CAAE,IAAI,CAErB,oCAAQ,CACP,KAAK,CAAE,OAAO,CACd,eAAe,CAAE,IAAI,CAOvB,wCAAO,CAEN,UAAU,CAAE,OAAO,CACnB,aAAa,CAAE,GAAG,CAClB,KAAK,CAAE,IAAI,CACX,OAAO,CAAE,GAAG,CAEZ,0CAAE,CACD,KAAK,CAAE,IAAI,CACX,eAAe,CAAE,IAAI,CACrB,gDAAQ,CACP,eAAe,CAAE,SAAS,CAK7B,mEAAkC,CAEjC,aAAa,CAAE,IAAI,CAEnB,yEAAM,CACL,KAAK,CAAE,IAAI,CACX,OAAO,CAAE,YAAY,CACrB,SAAS,CAAE,IAAI,CACf,WAAW,CAAE,GAAG,CAChB,UAAU,CAAE,KAAK,CACjB,aAAa,CAAE,IAAI,CAGpB,qVAGO,CACN,gBAAgB,CAAE,IAAI,CACtB,MAAM,CAAE,cAAc,CACtB,aAAa,CAAE,GAAG,CAClB,KAAK,CAAE,IAAI,CACX,OAAO,CAAE,YAAY,CACrB,SAAS,CAAE,IAAI,CACf,MAAM,CAAE,IAAI,CACZ,OAAO,CAAE,YAAY,CACrB,KAAK,CAAE,6BAA6B,CAGrC,0EAAO,CACN,KAAK,CAAE,IAAI,CAGZ,4EAAS,CACR,gBAAgB,CAAE,IAAI,CACtB,MAAM,CAAE,cAAc,CACtB,aAAa,CAAE,GAAG,CAClB,KAAK,CAAE,IAAI,CACX,SAAS,CAAE,IAAI,CACf,OAAO,CAAE,IAAI,CAGd,gFAAa,CACZ,KAAK,CAAE,IAAI,CACX,SAAS,CAAE,IAAI,CACf,MAAM,CAAE,OAAO,CAGhB,0EAAS,CACR,OAAO,CAAE,IAAI,CACb,SAAS,CAAE,MAAM,CACjB,eAAe,CAAE,aAAa,CAC9B,OAAO,CAAE,CAAC,CACV,aAAa,CAAE,cAAc,CAC7B,KAAK,CAAE,IAAI,CACX,WAAW,CAAE,GAAG,CAEhB,qFAAa,CACZ,aAAa,CAAE,CAAC,CAGjB,gFAAM,CACL,UAAU,CAAE,CAAC,CACb,SAAS,CAAE,KAAK,CAChB,UAAU,CAAE,MAAM,CAClB,WAAW,CAAE,IAAI,CACjB,UAAU,CAAE,OAAO,CACnB,OAAO,CAAE,IAAI,CACb,WAAW,CAAE,QAAQ,CAGtB,mFAAS,CACR,SAAS,CAAE,CAAC,CACZ,OAAO,CAAE,IAAI,CAEb,qFAAE,CACD,aAAa,CAAE,GAAG,CAGnB,gGAAa,CACZ,aAAa,CAAE,CAAC,CAIlB,kFAAQ,CACP,UAAU,CAAE,CAAC,CACb,SAAS,CAAE,IAAI,CACf,UAAU,CAAE,MAAM,CAClB,MAAM,CAAE,OAAO,CACf,OAAO,CAAE,KAAK,CACd,QAAQ,CAAE,QAAQ,CAClB,UAAU,CAAE,KAAK,CACjB,UAAU,CAAE,UAAU,CAGvB,kFAAQ,CACP,MAAM,CAAE,IAAI,CACZ,KAAK,CAAE,IAAI,CACX,MAAM,CAAE,iBAAiB,CACzB,gBAAgB,CAAE,OAAO,CACzB,OAAO,CAAE,YAAY,CACrB,WAAW,CAAE,OAAO,CACpB,aAAa,CAAE,IAAI,CACnB,QAAQ,CAAE,QAAQ,CAElB,uGAAqB,CACpB,OAAO,CAAE,IAAI,CAGd,yFAAS,CACR,OAAO,CAAE,EAAE,CACX,OAAO,CAAE,KAAK,CACd,KAAK,CAAE,IAAI,CACX,MAAM,CAAE,IAAI,CACZ,UAAU,CAAE,IAAI,CAChB,QAAQ,CAAE,QAAQ,CAClB,GAAG,CAAE,CAAC,CACN,KAAK,CAAE,CAAC,CACR,aAAa,CAAE,IAAI,CAGpB,2FAAW,CACV,YAAY,CAAE,IAAI,CAClB,gBAAgB,CAAE,IAAI,CAEtB,kGAAS,CACR,KAAK,CAAE,IAAI,CACX,IAAI,CAAE,CAAC",
|
4 |
+
"sources": ["sv-wc-plugin-admin-setup-wizard.scss"],
|
5 |
+
"names": [],
|
6 |
+
"file": "sv-wc-plugin-admin-setup-wizard.min.css"
|
7 |
+
}
|
lib/skyverge/woocommerce/assets/css/mixins.scss
CHANGED
File without changes
|
lib/skyverge/woocommerce/assets/images/ajax-loader.gif
CHANGED
File without changes
|
lib/skyverge/woocommerce/assets/js/admin/sv-wc-plugin-admin-setup-wizard.min.js
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
(function() { "use strict"; /** * WooCommerce Plugin Framework Setup Wizard scripts. * * @since 5.3.0-dev */ jQuery(document).ready(function($) { $('.sv-wc-plugin-admin-setup-control').on('change', '.enable input', function() { if ($(this).is(':checked')) { return $(this).closest('.toggle').removeClass('disabled'); } else { return $(this).closest('.toggle').addClass('disabled'); } }); return $('.sv-wc-plugin-admin-setup-control').on('click', '.enable', function(e) { var $checkbox; if ($(e.target).is('input')) { e.stopPropagation(); return; } $checkbox = $(this).find('input[type="checkbox"]'); return $checkbox.prop('checked', !$checkbox.is(':checked')).change(); }); });}).call(this);
|
lib/skyverge/woocommerce/assets/js/admin/sv-wc-plugin-admin-setup-wizard.min.js.map
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"version": 3,
|
3 |
+
"file": "sv-wc-plugin-admin-setup-wizard.min.js",
|
4 |
+
"sourceRoot": "",
|
5 |
+
"sources": [
|
6 |
+
"sv-wc-plugin-admin-setup-wizard.coffee"
|
7 |
+
],
|
8 |
+
"names": [],
|
9 |
+
"mappings": "AAAA;EAAA;;AAEA;;;;;EAKA,MAAA,CAAQ,QAAR,CAAkB,CAAC,KAAnB,CAAyB,SAAE,CAAF;IAIxB,CAAA,CAAG,mCAAH,CAAwC,CAAC,EAAzC,CAA6C,QAA7C,EAAuD,eAAvD,EAAwE,SAAA;MACvE,IAAK,CAAA,CAAG,IAAH,CAAS,CAAC,EAAV,CAAc,UAAd,CAAL;eACC,CAAA,CAAG,IAAH,CAAS,CAAC,OAAV,CAAmB,SAAnB,CAA8B,CAAC,WAA/B,CAA4C,UAA5C,EADD;OAAA,MAAA;eAGC,CAAA,CAAG,IAAH,CAAS,CAAC,OAAV,CAAmB,SAAnB,CAA8B,CAAC,QAA/B,CAAyC,UAAzC,EAHD;;IADuE,CAAxE;WAQA,CAAA,CAAG,mCAAH,CAAwC,CAAC,EAAzC,CAA6C,OAA7C,EAAsD,SAAtD,EAAiE,SAAE,CAAF;AAEhE,UAAA;MAAA,IAAK,CAAA,CAAG,CAAC,CAAC,MAAL,CAAa,CAAC,EAAd,CAAkB,OAAlB,CAAL;QACC,CAAC,CAAC,eAAF,CAAA;AACA,eAFD;;MAIA,SAAA,GAAY,CAAA,CAAG,IAAH,CAAS,CAAC,IAAV,CAAgB,wBAAhB;aAEZ,SAAS,CAAC,IAAV,CAAgB,SAAhB,EAA2B,CAAE,SAAS,CAAC,EAAV,CAAc,UAAd,CAA7B,CAAyD,CAAC,MAA1D,CAAA;IARgE,CAAjE;EAZwB,CAAzB;AAPA"
|
10 |
+
}
|
lib/skyverge/woocommerce/assets/js/admin/sv-wp-admin-job-batch-handler.min.js
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
/** * WordPress Batch Job Handler * * @since 4.8.0 */(function() { var bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }; jQuery(document).ready(function($) { 'use strict'; return window.SV_WP_Job_Batch_Handler = (function() { function SV_WP_Job_Batch_Handler(args) { this.process_job = bind(this.process_job, this); this.id = args.id; this.process_nonce = args.process_nonce; this.cancel_nonce = args.cancel_nonce; this.cancelled = false; } SV_WP_Job_Batch_Handler.prototype.process_job = function(job_id) { return new Promise((function(_this) { return function(resolve, reject) { var data; if (_this.cancelled === job_id) { return _this.cancel_job(job_id); } data = { action: _this.id + "_process_batch", security: _this.process_nonce, job_id: job_id }; return $.post(ajaxurl, data).done(function(response) { if (!(response.success && (response.data != null))) { return reject(response); } if (response.data.status !== 'processing') { return resolve(response); } $(document).trigger(_this.id + "_batch_progress_" + response.data.id, { percentage: response.data.percentage, progress: response.data.progress, total: response.data.total }); return resolve(_this.process_job(response.data.id)); }).fail(function(jqXHR, textStatus, error) { return reject(error); }); }; })(this)); }; SV_WP_Job_Batch_Handler.prototype.cancel_job = function(job_id) { return new Promise((function(_this) { return function(resolve, reject) { var data; _this.cancelled = false; data = { action: _this.id + "_cancel_job", security: _this.cancel_nonce, job_id: job_id }; return $.post(ajaxurl, data).done(function(response) { if (!response.success) { return reject(response); } return resolve(response); }).fail(function(jqXHR, textStatus, error) { return reject(error); }); }; })(this)); }; return SV_WP_Job_Batch_Handler; })(); });}).call(this);
|
lib/skyverge/woocommerce/assets/js/admin/sv-wp-admin-job-batch-handler.min.js.map
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"version": 3,
|
3 |
+
"file": "sv-wp-admin-job-batch-handler.min.js",
|
4 |
+
"sourceRoot": "",
|
5 |
+
"sources": [
|
6 |
+
"sv-wp-admin-job-batch-handler.coffee"
|
7 |
+
],
|
8 |
+
"names": [],
|
9 |
+
"mappings": ";AAAA;;;;;;AAAA;AAAA,MAAA;;EAMA,MAAA,CAAQ,QAAR,CAAkB,CAAC,KAAnB,CAAyB,SAAE,CAAF;IACxB;WAMM,MAAM,CAAC;MAUC,iCAAE,IAAF;;QAEZ,IAAC,CAAA,EAAD,GAAiB,IAAI,CAAC;QACtB,IAAC,CAAA,aAAD,GAAiB,IAAI,CAAC;QACtB,IAAC,CAAA,YAAD,GAAiB,IAAI,CAAC;QACtB,IAAC,CAAA,SAAD,GAAiB;MALL;;wCAcb,WAAA,GAAa,SAAE,MAAF;eAAkB,IAAA,OAAA,CAAQ,CAAA,SAAA,KAAA;iBAAA,SAAE,OAAF,EAAW,MAAX;AAGtC,gBAAA;YAAA,IAAoC,KAAC,CAAA,SAAD,KAAc,MAAlD;AAAA,qBAAO,KAAI,CAAC,UAAL,CAAiB,MAAjB,EAAP;;YAEA,IAAA,GACC;cAAA,MAAA,EAAa,KAAC,CAAA,EAAF,GAAK,gBAAjB;cACA,QAAA,EAAU,KAAC,CAAA,aADX;cAEA,MAAA,EAAU,MAFV;;mBAID,CAAC,CAAC,IAAF,CAAQ,OAAR,EAAiB,IAAjB,CAEC,CAAC,IAFF,CAEO,SAAE,QAAF;cAGL,IAAA,CAAA,CAA8B,QAAQ,CAAC,OAAT,IAAqB,uBAAnD,CAAA;AAAA,uBAAO,MAAA,CAAO,QAAP,EAAP;;cAGA,IAA+B,QAAQ,CAAC,IAAI,CAAC,MAAd,KAAwB,YAAvD;AAAA,uBAAO,OAAA,CAAQ,QAAR,EAAP;;cAGA,CAAA,CAAG,QAAH,CAAa,CAAC,OAAd,CAAyB,KAAC,CAAA,EAAF,GAAK,kBAAL,GAAuB,QAAQ,CAAC,IAAI,CAAC,EAA7D,EACC;gBAAA,UAAA,EAAY,QAAQ,CAAC,IAAI,CAAC,UAA1B;gBACA,QAAA,EAAY,QAAQ,CAAC,IAAI,CAAC,QAD1B;gBAEA,KAAA,EAAY,QAAQ,CAAC,IAAI,CAAC,KAF1B;eADD;AAMA,qBAAO,OAAA,CAAQ,KAAI,CAAC,WAAL,CAAkB,QAAQ,CAAC,IAAI,CAAC,EAAhC,CAAR;YAfF,CAFP,CAmBC,CAAC,IAnBF,CAmBO,SAAE,KAAF,EAAS,UAAT,EAAqB,KAArB;qBAEL,MAAA,CAAO,KAAP;YAFK,CAnBP;UAVsC;QAAA,CAAA,CAAA,CAAA,IAAA,CAAR;MAAlB;;wCAwCb,UAAA,GAAY,SAAE,MAAF;eAAkB,IAAA,OAAA,CAAQ,CAAA,SAAA,KAAA;iBAAA,SAAE,OAAF,EAAW,MAAX;AAErC,gBAAA;YAAA,KAAC,CAAA,SAAD,GAAa;YAEb,IAAA,GACC;cAAA,MAAA,EAAa,KAAC,CAAA,EAAF,GAAK,aAAjB;cACA,QAAA,EAAU,KAAC,CAAA,YADX;cAEA,MAAA,EAAU,MAFV;;mBAID,CAAC,CAAC,IAAF,CAAQ,OAAR,EAAiB,IAAjB,CAEC,CAAC,IAFF,CAEO,SAAE,QAAF;cAEL,IAAA,CAA8B,QAAQ,CAAC,OAAvC;AAAA,uBAAO,MAAA,CAAO,QAAP,EAAP;;AAEA,qBAAO,OAAA,CAAQ,QAAR;YAJF,CAFP,CAQC,CAAC,IARF,CAQO,SAAE,KAAF,EAAS,UAAT,EAAqB,KAArB;qBAEL,MAAA,CAAO,KAAP;YAFK,CARP;UATqC;QAAA,CAAA,CAAA,CAAA,IAAA,CAAR;MAAlB;;;;;EAvEW,CAAzB;AANA"
|
10 |
+
}
|
lib/skyverge/woocommerce/changelog.txt
CHANGED
@@ -1,5 +1,97 @@
|
|
1 |
*** SkyVerge WooCommerce Plugin Framework Changelog ***
|
2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
2017.09.12 - version 4.7.2
|
4 |
* Fix - Ensure failed Pre-Orders can be paid with a new method by bypassing the failed order's stored token
|
5 |
* Fix - Use the parameters passed to SV_WP_Admin_Message_Handler::show_messages()
|
@@ -91,7 +183,7 @@
|
|
91 |
|
92 |
2016.01.13 - version 4.2.0
|
93 |
* Feature - Greatly improved compatibility with multi-language/translation plugins
|
94 |
-
* Misc - Switched to using a separate text domain for the framework strings - 'woocommerce-
|
95 |
* Misc - Added support for WooCommerce 2.5
|
96 |
* Misc - Removed support for WooCommerce 2.2
|
97 |
|
1 |
*** SkyVerge WooCommerce Plugin Framework Changelog ***
|
2 |
|
3 |
+
2018.09.25 - version 5.3.0
|
4 |
+
* Feature - Add support for updating payment methods via API on payment
|
5 |
+
* Tweak - Refactor capture handling and add a dedicated handling class
|
6 |
+
* Tweak - Add an admin notice for gateways when debug logging is enabled in production mode
|
7 |
+
* Fix - Ensure orders are automatically captured when the status is changes via the REST API if enabled
|
8 |
+
* Fix - Ensure the gateway capture UI is only displayed for regular orders
|
9 |
+
* Fix - Prevent capture JS errors when multiple gateways running the same framework version are activated
|
10 |
+
* Fix - Strip price HTML from the admin capture alert
|
11 |
+
* Dev - Add the wc_{gateway_id}_held_order_status filter
|
12 |
+
|
13 |
+
2018.09.04 - version 5.2.2
|
14 |
+
* Tweak - Provide an abstract Setup Wizard for plugins to implement for easier onboarding
|
15 |
+
|
16 |
+
2018.08.21 - version 5.2.1
|
17 |
+
* Fix - Prevent errors when triggering payment gateway payment and refund milestones
|
18 |
+
* Fix - Add escaping to some admin notice messages
|
19 |
+
|
20 |
+
2018.07.24 - version 5.2.0
|
21 |
+
* Fix - Use the order currency for the gateway capture message currency symbol
|
22 |
+
* Dev - Introduce dedicated plugin methods for loading after init
|
23 |
+
* Dev - Move plugin lifecycle methods to the Lifecycle handler
|
24 |
+
* Dev - Introduce a dependency handler for PHP compatibility notices
|
25 |
+
* Dev - Introduce a REST API handler base
|
26 |
+
* Misc - Add default plugin and gateway data to the WooCommerce REST API System Status response
|
27 |
+
|
28 |
+
2018.06.25 - version 5.1.5
|
29 |
+
* Fix - Ensure exceptions are caught for Subscriptions "change payment" and Pre-Orders tokenization failures
|
30 |
+
|
31 |
+
2018.05.22 - version 5.1.4
|
32 |
+
* Tweak - Add a gateway privacy handler to export or remove order payment data and payment tokens on request
|
33 |
+
* Tweak - Add a warning for WooCommerce 2.6 installs that 3.0 will soon be required
|
34 |
+
* Misc - Add support for WooCommerce 3.4
|
35 |
+
|
36 |
+
2018.04.17 - version 5.1.3
|
37 |
+
* Tweak - Add a method for gateways to call during failing captures
|
38 |
+
|
39 |
+
2018.04.02 - version 5.1.2
|
40 |
+
* Fix - Prevent warnings in PHP 7.2 when building the gateway settings
|
41 |
+
* Fix - Fix namespaces in the Apple Pay framework
|
42 |
+
|
43 |
+
2018.03.27 - version 5.1.1
|
44 |
+
* Tweak - Disable the Add Payment Method button when editing a method
|
45 |
+
* Fix - Ensure customers can't delete subscription payment methods from gateways that use integer token IDs
|
46 |
+
* Fix - Always pass user email to gateways when adding a payment method
|
47 |
+
|
48 |
+
2018.02.27 - version 5.1.0
|
49 |
+
* Feature - Add payment method editing support
|
50 |
+
* Feature - Allow users to set nicknames for their payment methods
|
51 |
+
* Feature - Add support for auto-capturing orders when changed to a paid status
|
52 |
+
* Feature - Add a Milestones API for plugins to trigger milestone messages and prompt users for feedback after key plugin events
|
53 |
+
* Tweak - Improve the My Account Payment Methods table on desktop and mobile
|
54 |
+
* Tweak - Let gateway handle their own API errors when deleting payment methods
|
55 |
+
* Tweak - Improve the admin token editor with better error handling and improved display
|
56 |
+
* Tweak - Let plugins define a "reviews" URL to be displayed with the plugin action links
|
57 |
+
* Tweak - Adjust the gateway "Accepted Cards" setting wording to clarify that it doesn't affect payment processor card support
|
58 |
+
* Tweak - Support warning and info message types in the Admin Message Handler
|
59 |
+
* Fix - Prevent duplicate admin notices when running alongside legacy framework versions
|
60 |
+
|
61 |
+
2018.01.17 - version 5.0.1
|
62 |
+
* Misc - Remove support for WooCommerce 2.5
|
63 |
+
* Misc - Require WordPress 4.4 or higher
|
64 |
+
|
65 |
+
2018.01.11 - version 5.0.0
|
66 |
+
* Feature - Partial capture - add a UI for multiple partial captures in supported gateways
|
67 |
+
* Feature - Add CSC setting to enable or disable the field for tokenized methods
|
68 |
+
* Tweak - Improve the My Payment Methods table styling on mobile
|
69 |
+
* Dev - Add versioned namespaces
|
70 |
+
* Dev - Add a sample plugin loader class
|
71 |
+
* Dev - Add action hooks for My Payment Method actions
|
72 |
+
* Misc - Drop WooCommerce 2.5 support
|
73 |
+
* Misc - Drop Subscriptions 1.x support
|
74 |
+
|
75 |
+
2017.12.11 - version 4.8.3
|
76 |
+
* Fix - Ensure failed order token meta is only copied to the parent subscription when a successful payment has occurred
|
77 |
+
* Fix - Don't reset the checkout password field if it's already visible
|
78 |
+
|
79 |
+
2017.12.01 - version 4.8.2
|
80 |
+
* Fix - Fix a possible race condition when performing background processing health checks
|
81 |
+
* Fix - Account for possible false negatives when testing loopback connections in certain environments
|
82 |
+
|
83 |
+
2017.11.27 - version 4.8.1
|
84 |
+
* Fix - Fix Apple Pay compatibility with WooCommerce 3.2+
|
85 |
+
|
86 |
+
2017.10.31 - version 4.8.0
|
87 |
+
* Feature - Add a framework for batch job handling for when background processing is unavailable
|
88 |
+
* Feature - Debug tool for testing the site's environment for loopback connection support
|
89 |
+
|
90 |
+
2017.10.05 - version 4.7.3
|
91 |
+
* Tweak - Add new methods for checking for specific WooCommerce versions
|
92 |
+
* Tweak - Adjust the PHP version notice to check for 5.6 by May 2018 and adjust the messaging when that date has passed
|
93 |
+
* Fix - Conflict with WooCommerce filtering of nonce checks for background jobs
|
94 |
+
|
95 |
2017.09.12 - version 4.7.2
|
96 |
* Fix - Ensure failed Pre-Orders can be paid with a new method by bypassing the failed order's stored token
|
97 |
* Fix - Use the parameters passed to SV_WP_Admin_Message_Handler::show_messages()
|
183 |
|
184 |
2016.01.13 - version 4.2.0
|
185 |
* Feature - Greatly improved compatibility with multi-language/translation plugins
|
186 |
+
* Misc - Switched to using a separate text domain for the framework strings - 'woocommerce-gateway-paypal-powered-by-braintree'
|
187 |
* Misc - Added support for WooCommerce 2.5
|
188 |
* Misc - Removed support for WooCommerce 2.2
|
189 |
|
lib/skyverge/woocommerce/class-sv-wc-admin-notice-handler.php
CHANGED
@@ -18,14 +18,16 @@
|
|
18 |
*
|
19 |
* @package SkyVerge/WooCommerce/Plugin/Classes
|
20 |
* @author SkyVerge
|
21 |
-
* @copyright Copyright (c) 2013-
|
22 |
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
|
23 |
*/
|
24 |
|
25 |
-
namespace
|
26 |
|
27 |
defined( 'ABSPATH' ) or exit;
|
28 |
|
|
|
|
|
29 |
/**
|
30 |
* SkyVerge Admin Notice Handler Class
|
31 |
*
|
@@ -169,7 +171,7 @@ class SV_WC_Admin_Notice_Handler {
|
|
169 |
|
170 |
if ( $is_visible && ! self::$admin_notice_placeholder_rendered ) {
|
171 |
// placeholder for moving delayed notices up into place
|
172 |
-
echo '<div class="js-wc-
|
173 |
self::$admin_notice_placeholder_rendered = true;
|
174 |
}
|
175 |
|
@@ -212,34 +214,15 @@ class SV_WC_Admin_Notice_Handler {
|
|
212 |
) );
|
213 |
|
214 |
$classes = array(
|
|
|
215 |
'js-wc-plugin-framework-admin-notice',
|
216 |
$params['notice_class'],
|
217 |
);
|
218 |
|
219 |
-
//
|
220 |
-
//
|
221 |
-
|
222 |
-
|
223 |
-
if ( version_compare( get_bloginfo( 'version' ), '4.2', '>=' ) ) {
|
224 |
-
|
225 |
-
$classes[] = 'notice';
|
226 |
-
|
227 |
-
if ( $dismissible ) {
|
228 |
-
$classes[] = 'is-dismissible';
|
229 |
-
}
|
230 |
-
|
231 |
-
} else {
|
232 |
-
|
233 |
-
if ( $dismissible ) {
|
234 |
-
|
235 |
-
/* translators: this is an action that dismisses a message */
|
236 |
-
$dismiss_link = sprintf(
|
237 |
-
'<a href="#" class="js-wc-plugin-framework-notice-dismiss" style="float: right;">%s</a>',
|
238 |
-
esc_html__( 'Dismiss', 'woocommerce-gateway-paypal-powered-by-braintree' )
|
239 |
-
);
|
240 |
-
|
241 |
-
$message .= ' ' . $dismiss_link;
|
242 |
-
}
|
243 |
}
|
244 |
|
245 |
echo sprintf(
|
@@ -265,6 +248,8 @@ class SV_WC_Admin_Notice_Handler {
|
|
265 |
return;
|
266 |
}
|
267 |
|
|
|
|
|
268 |
self::$admin_notice_js_rendered = true;
|
269 |
|
270 |
ob_start();
|
@@ -310,7 +295,7 @@ class SV_WC_Admin_Notice_Handler {
|
|
310 |
}
|
311 |
|
312 |
// move any delayed notices up into position .show();
|
313 |
-
$( '.js-wc-plugin-framework-admin-notice:hidden' ).insertAfter( '.js-wc
|
314 |
<?php
|
315 |
$javascript = ob_get_clean();
|
316 |
|
@@ -442,3 +427,5 @@ class SV_WC_Admin_Notice_Handler {
|
|
442 |
}
|
443 |
|
444 |
}
|
|
|
|
18 |
*
|
19 |
* @package SkyVerge/WooCommerce/Plugin/Classes
|
20 |
* @author SkyVerge
|
21 |
+
* @copyright Copyright (c) 2013-2018, SkyVerge, Inc.
|
22 |
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
|
23 |
*/
|
24 |
|
25 |
+
namespace WC_Braintree\Plugin_Framework;
|
26 |
|
27 |
defined( 'ABSPATH' ) or exit;
|
28 |
|
29 |
+
if ( ! class_exists( '\\WC_Braintree\\Plugin_Framework\\SV_WC_Admin_Notice_Handler' ) ) :
|
30 |
+
|
31 |
/**
|
32 |
* SkyVerge Admin Notice Handler Class
|
33 |
*
|
171 |
|
172 |
if ( $is_visible && ! self::$admin_notice_placeholder_rendered ) {
|
173 |
// placeholder for moving delayed notices up into place
|
174 |
+
echo '<div class="js-wc-' . esc_attr( $this->get_plugin()->get_id_dasherized() ) . '-admin-notice-placeholder"></div>';
|
175 |
self::$admin_notice_placeholder_rendered = true;
|
176 |
}
|
177 |
|
214 |
) );
|
215 |
|
216 |
$classes = array(
|
217 |
+
'notice',
|
218 |
'js-wc-plugin-framework-admin-notice',
|
219 |
$params['notice_class'],
|
220 |
);
|
221 |
|
222 |
+
// maybe make this notice dismissible
|
223 |
+
// uses a WP core class which handles the markup and styling
|
224 |
+
if ( $params['dismissible'] && ( ! $params['always_show_on_settings'] || ! $this->get_plugin()->is_plugin_settings() ) ) {
|
225 |
+
$classes[] = 'is-dismissible';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
226 |
}
|
227 |
|
228 |
echo sprintf(
|
248 |
return;
|
249 |
}
|
250 |
|
251 |
+
$plugin_slug = $this->get_plugin()->get_id_dasherized();
|
252 |
+
|
253 |
self::$admin_notice_js_rendered = true;
|
254 |
|
255 |
ob_start();
|
295 |
}
|
296 |
|
297 |
// move any delayed notices up into position .show();
|
298 |
+
$( '.js-wc-plugin-framework-admin-notice:hidden' ).insertAfter( '.js-wc-<?php echo esc_js( $plugin_slug ); ?>-admin-notice-placeholder' ).show();
|
299 |
<?php
|
300 |
$javascript = ob_get_clean();
|
301 |
|
427 |
}
|
428 |
|
429 |
}
|
430 |
+
|
431 |
+
endif; // Class exists check
|
lib/skyverge/woocommerce/class-sv-wc-helper.php
CHANGED
@@ -18,15 +18,15 @@
|
|
18 |
*
|
19 |
* @package SkyVerge/WooCommerce/Plugin/Classes
|
20 |
* @author SkyVerge
|
21 |
-
* @copyright Copyright (c) 2013-
|
22 |
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
|
23 |
*/
|
24 |
|
25 |
-
namespace
|
26 |
|
27 |
defined( 'ABSPATH' ) or exit;
|
28 |
|
29 |
-
if ( ! class_exists( '
|
30 |
|
31 |
/**
|
32 |
* SkyVerge Helper Class
|
@@ -388,6 +388,44 @@ if ( ! class_exists( '\SkyVerge\Plugin_Framework\SV_WC_Helper' ) ) :
|
|
388 |
}
|
389 |
|
390 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
391 |
/** Number helper functions *******************************************/
|
392 |
|
393 |
|
@@ -436,7 +474,7 @@ if ( ! class_exists( '\SkyVerge\Plugin_Framework\SV_WC_Helper' ) ) :
|
|
436 |
|
437 |
$line_item = new \stdClass();
|
438 |
|
439 |
-
// TODO: remove when WC 3.0
|
440 |
$name = $item instanceof \WC_Order_Item_Product ? $item->get_name() : $item['name'];
|
441 |
$quantity = $item instanceof \WC_Order_Item_Product ? $item->get_quantity() : $item['qty'];
|
442 |
|
@@ -991,6 +1029,23 @@ if ( ! class_exists( '\SkyVerge\Plugin_Framework\SV_WC_Helper' ) ) :
|
|
991 |
}
|
992 |
|
993 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
994 |
/**
|
995 |
* Triggers a PHP error.
|
996 |
*
|
18 |
*
|
19 |
* @package SkyVerge/WooCommerce/Plugin/Classes
|
20 |
* @author SkyVerge
|
21 |
+
* @copyright Copyright (c) 2013-2018, SkyVerge, Inc.
|
22 |
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
|
23 |
*/
|
24 |
|
25 |
+
namespace WC_Braintree\Plugin_Framework;
|
26 |
|
27 |
defined( 'ABSPATH' ) or exit;
|
28 |
|
29 |
+
if ( ! class_exists( '\\WC_Braintree\\Plugin_Framework\\SV_WC_Helper' ) ) :
|
30 |
|
31 |
/**
|
32 |
* SkyVerge Helper Class
|
388 |
}
|
389 |
|
390 |
|
391 |
+
/**
|
392 |
+
* Lists an array as text.
|
393 |
+
*
|
394 |
+
* Takes an array and returns a list like "one, two, three, and four"
|
395 |
+
* with a (mandatory) oxford comma.
|
396 |
+
*
|
397 |
+
* @since 5.2.0
|
398 |
+
*
|
399 |
+
* @param array $items items to list
|
400 |
+
* @param string|null $conjunction coordinating conjunction, like "or" or "and"
|
401 |
+
* @param string $separator list separator, like a comma
|
402 |
+
* @return string
|
403 |
+
*/
|
404 |
+
public static function list_array_items( array $items, $conjunction = null, $separator = '' ) {
|
405 |
+
|
406 |
+
if ( ! is_string( $conjunction ) ) {
|
407 |
+
$conjunction = _x( 'and', 'coordinating conjunction for a list of items: a, b, and c', 'woocommerce-gateway-paypal-powered-by-braintree' );
|
408 |
+
}
|
409 |
+
|
410 |
+
// append the conjunction to the last item
|
411 |
+
if ( count( $items ) > 1 ) {
|
412 |
+
|
413 |
+
$last_item = array_pop( $items );
|
414 |
+
|
415 |
+
array_push( $items, trim( "{$conjunction} {$last_item}" ) );
|
416 |
+
|
417 |
+
// only use a comma if needed and no separator was passed
|
418 |
+
if ( count( $items ) < 3 ) {
|
419 |
+
$separator = ' ';
|
420 |
+
} elseif ( ! is_string( $separator ) || '' === $separator ) {
|
421 |
+
$separator = ', ';
|
422 |
+
}
|
423 |
+
}
|
424 |
+
|
425 |
+
return implode( $separator, $items );
|
426 |
+
}
|
427 |
+
|
428 |
+
|
429 |
/** Number helper functions *******************************************/
|
430 |
|
431 |
|
474 |
|
475 |
$line_item = new \stdClass();
|
476 |
|
477 |
+
// TODO: remove when WC 3.0 can be required
|
478 |
$name = $item instanceof \WC_Order_Item_Product ? $item->get_name() : $item['name'];
|
479 |
$quantity = $item instanceof \WC_Order_Item_Product ? $item->get_quantity() : $item['qty'];
|
480 |
|
1029 |
}
|
1030 |
|
1031 |
|
1032 |
+
/**
|
1033 |
+
* Displays a notice if the provided hook has not yet run.
|
1034 |
+
*
|
1035 |
+
* @since 5.2.0
|
1036 |
+
*
|
1037 |
+
* @param string $hook action hook to check
|
1038 |
+
* @param string $method method/function name
|
1039 |
+
* @param string $version version the notice was added
|
1040 |
+
*/
|
1041 |
+
public static function maybe_doing_it_early( $hook, $method, $version ) {
|
1042 |
+
|
1043 |
+
if ( ! did_action( $hook ) ) {
|
1044 |
+
SV_WC_Plugin_Compatibility::wc_doing_it_wrong( $method, "This should only be called after '{$hook}'", $version );
|
1045 |
+
}
|
1046 |
+
}
|
1047 |
+
|
1048 |
+
|
1049 |
/**
|
1050 |
* Triggers a PHP error.
|
1051 |
*
|
lib/skyverge/woocommerce/class-sv-wc-hook-deprecator.php
CHANGED
@@ -18,15 +18,15 @@
|
|
18 |
*
|
19 |
* @package SkyVerge/WooCommerce/Plugin/Classes
|
20 |
* @author SkyVerge
|
21 |
-
* @copyright Copyright (c) 2013-
|
22 |
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
|
23 |
*/
|
24 |
|
25 |
-
namespace
|
26 |
|
27 |
defined( 'ABSPATH' ) or exit;
|
28 |
|
29 |
-
if ( ! class_exists( '
|
30 |
|
31 |
/**
|
32 |
* SkyVerge Hook Deprecator Class
|
18 |
*
|
19 |
* @package SkyVerge/WooCommerce/Plugin/Classes
|
20 |
* @author SkyVerge
|
21 |
+
* @copyright Copyright (c) 2013-2018, SkyVerge, Inc.
|
22 |
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
|
23 |
*/
|
24 |
|
25 |
+
namespace WC_Braintree\Plugin_Framework;
|
26 |
|
27 |
defined( 'ABSPATH' ) or exit;
|
28 |
|
29 |
+
if ( ! class_exists( '\\WC_Braintree\\Plugin_Framework\\SV_WC_Hook_Deprecator' ) ) :
|
30 |
|
31 |
/**
|
32 |
* SkyVerge Hook Deprecator Class
|
lib/skyverge/woocommerce/class-sv-wc-plugin-compatibility.php
CHANGED
@@ -18,15 +18,15 @@
|
|
18 |
*
|
19 |
* @package SkyVerge/WooCommerce/Plugin/Classes
|
20 |
* @author SkyVerge
|
21 |
-
* @copyright Copyright (c) 2013-
|
22 |
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
|
23 |
*/
|
24 |
|
25 |
-
namespace
|
26 |
|
27 |
defined( 'ABSPATH' ) or exit;
|
28 |
|
29 |
-
if ( ! class_exists( '
|
30 |
|
31 |
/**
|
32 |
* WooCommerce Compatibility Utility Class
|
@@ -40,8 +40,8 @@ if ( ! class_exists( '\SkyVerge\Plugin_Framework\SV_WC_Plugin_Compatibility' ) )
|
|
40 |
* are dropped.
|
41 |
*
|
42 |
* Current Compatibility
|
43 |
-
* + Core 2.
|
44 |
-
* + Subscriptions
|
45 |
*
|
46 |
* // TODO: move to /compatibility
|
47 |
*
|
@@ -51,118 +51,113 @@ class SV_WC_Plugin_Compatibility {
|
|
51 |
|
52 |
|
53 |
/**
|
54 |
-
*
|
55 |
-
*
|
56 |
-
* Backports WC 3.0's wc_format_datetime() to older versions.
|
57 |
*
|
58 |
-
* @since
|
59 |
*
|
60 |
-
* @
|
61 |
-
* @param string $format date format
|
62 |
-
* @return string
|
63 |
*/
|
64 |
-
public static function
|
65 |
|
66 |
if ( self::is_wc_version_gte_3_0() ) {
|
67 |
-
|
68 |
-
return wc_format_datetime( $date, $format );
|
69 |
-
|
70 |
} else {
|
71 |
-
|
72 |
-
if ( ! $format ) {
|
73 |
-
$format = wc_date_format();
|
74 |
-
}
|
75 |
-
|
76 |
-
if ( ! is_a( $date, '\SkyVerge\Plugin_Framework\SV_WC_DateTime' ) ) {
|
77 |
-
return '';
|
78 |
-
}
|
79 |
-
|
80 |
-
return $date->date_i18n( $format );
|
81 |
}
|
82 |
}
|
83 |
|
84 |
|
85 |
/**
|
86 |
-
*
|
87 |
*
|
88 |
-
*
|
89 |
-
*
|
|
|
|
|
|
|
|
|
|
|
90 |
*/
|
91 |
-
public static function
|
92 |
|
93 |
-
if ( self::
|
94 |
|
95 |
-
|
96 |
|
97 |
} else {
|
98 |
|
99 |
-
|
100 |
-
}
|
101 |
-
}
|
102 |
-
|
103 |
-
|
104 |
-
/**
|
105 |
-
* Backports WC_Product::get_id() method to 2.4.x
|
106 |
-
*
|
107 |
-
* @link https://github.com/woothemes/woocommerce/pull/9765
|
108 |
-
*
|
109 |
-
* @since 4.2.0
|
110 |
-
* @param \WC_Product $product product object
|
111 |
-
* @return string|int product ID
|
112 |
-
*/
|
113 |
-
public static function product_get_id( \WC_Product $product ) {
|
114 |
|
115 |
-
|
116 |
|
117 |
-
|
|
|
118 |
|
119 |
-
|
120 |
|
121 |
-
|
|
|
122 |
}
|
123 |
}
|
124 |
|
125 |
|
126 |
/**
|
127 |
-
*
|
128 |
*
|
129 |
-
*
|
130 |
-
*
|
|
|
|
|
|
|
|
|
|
|
131 |
*/
|
132 |
-
public static function
|
133 |
|
134 |
-
if ( self::
|
135 |
|
136 |
-
return
|
137 |
|
138 |
} else {
|
139 |
|
140 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
141 |
}
|
142 |
}
|
143 |
|
144 |
|
145 |
/**
|
146 |
-
*
|
147 |
*
|
148 |
-
* @
|
149 |
*
|
150 |
-
* @
|
151 |
-
* @param
|
152 |
-
* @param
|
153 |
-
* @return string help tip HTML, a <span> in WC 2.5, <img> in WC 2.4
|
154 |
*/
|
155 |
-
public static function
|
156 |
|
157 |
-
if ( self::
|
158 |
|
159 |
-
|
160 |
|
161 |
} else {
|
162 |
|
163 |
-
|
164 |
-
|
165 |
-
|
|
|
|
|
|
|
|
|
|
|
166 |
}
|
167 |
}
|
168 |
|
@@ -173,58 +168,14 @@ class SV_WC_Plugin_Compatibility {
|
|
173 |
* @since 3.0.0
|
174 |
* @return string woocommerce version number or null
|
175 |
*/
|
176 |
-
|
177 |
|
178 |
return defined( 'WC_VERSION' ) && WC_VERSION ? WC_VERSION : null;
|
179 |
}
|
180 |
|
181 |
|
182 |
/**
|
183 |
-
* Determines if the installed version of WooCommerce is
|
184 |
-
*
|
185 |
-
* @since 4.2.0
|
186 |
-
* @return bool
|
187 |
-
*/
|
188 |
-
public static function is_wc_version_gte_2_5() {
|
189 |
-
return self::get_wc_version() && version_compare( self::get_wc_version(), '2.5', '>=' );
|
190 |
-
}
|
191 |
-
|
192 |
-
|
193 |
-
/**
|
194 |
-
* Determines if the installed version of WooCommerce is less than 2.5.0
|
195 |
-
*
|
196 |
-
* @since 4.2.0
|
197 |
-
* @return bool
|
198 |
-
*/
|
199 |
-
public static function is_wc_version_lt_2_5() {
|
200 |
-
return self::get_wc_version() && version_compare( self::get_wc_version(), '2.5', '<' );
|
201 |
-
}
|
202 |
-
|
203 |
-
|
204 |
-
/**
|
205 |
-
* Determines if the installed version of WooCommerce is 2.6.0 or greater.
|
206 |
-
*
|
207 |
-
* @since 4.4.0
|
208 |
-
* @return bool
|
209 |
-
*/
|
210 |
-
public static function is_wc_version_gte_2_6() {
|
211 |
-
return self::get_wc_version() && version_compare( self::get_wc_version(), '2.6', '>=' );
|
212 |
-
}
|
213 |
-
|
214 |
-
|
215 |
-
/**
|
216 |
-
* Determines if the installed version of WooCommerce is less than 2.6.0
|
217 |
-
*
|
218 |
-
* @since 4.4.0
|
219 |
-
* @return bool
|
220 |
-
*/
|
221 |
-
public static function is_wc_version_lt_2_6() {
|
222 |
-
return self::get_wc_version() && version_compare( self::get_wc_version(), '2.6', '<' );
|
223 |
-
}
|
224 |
-
|
225 |
-
|
226 |
-
/**
|
227 |
-
* Determines if the installed version of WooCommerce is 3.0.0 or greater.
|
228 |
*
|
229 |
* @since 4.6.0
|
230 |
* @return bool
|
@@ -235,7 +186,7 @@ class SV_WC_Plugin_Compatibility {
|
|
235 |
|
236 |
|
237 |
/**
|
238 |
-
* Determines if the installed version of WooCommerce is less than 3.0.
|
239 |
*
|
240 |
* @since 4.6.0
|
241 |
* @return bool
|
@@ -268,28 +219,42 @@ class SV_WC_Plugin_Compatibility {
|
|
268 |
|
269 |
|
270 |
/**
|
271 |
-
*
|
|
|
272 |
*
|
273 |
-
* @since
|
274 |
-
*
|
275 |
-
* @
|
|
|
276 |
*/
|
277 |
-
public static function
|
278 |
-
return self::get_wc_version() && version_compare( self::get_wc_version(), $version, '
|
279 |
}
|
280 |
|
281 |
|
282 |
/**
|
283 |
-
* Determines if the installed version of WooCommerce
|
284 |
* passed version.
|
285 |
*
|
286 |
-
* @since
|
287 |
*
|
288 |
* @param string $version version number to compare
|
289 |
* @return bool
|
290 |
*/
|
291 |
-
public static function
|
292 |
-
return self::get_wc_version() && version_compare( self::get_wc_version(), $version, '
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
293 |
}
|
294 |
|
295 |
|
@@ -337,11 +302,11 @@ class SV_WC_Plugin_Compatibility {
|
|
337 |
* Subscriptions
|
338 |
*
|
339 |
* @since 4.1.0
|
340 |
-
* @return string
|
341 |
*/
|
342 |
protected static function get_wc_subscriptions_version() {
|
343 |
|
344 |
-
return class_exists( '
|
345 |
}
|
346 |
|
347 |
|
18 |
*
|
19 |
* @package SkyVerge/WooCommerce/Plugin/Classes
|
20 |
* @author SkyVerge
|
21 |
+
* @copyright Copyright (c) 2013-2018, SkyVerge, Inc.
|
22 |
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
|
23 |
*/
|
24 |
|
25 |
+
namespace WC_Braintree\Plugin_Framework;
|
26 |
|
27 |
defined( 'ABSPATH' ) or exit;
|
28 |
|
29 |
+
if ( ! class_exists( '\\WC_Braintree\\Plugin_Framework\\SV_WC_Plugin_Compatibility' ) ) :
|
30 |
|
31 |
/**
|
32 |
* WooCommerce Compatibility Utility Class
|
40 |
* are dropped.
|
41 |
*
|
42 |
* Current Compatibility
|
43 |
+
* + Core 2.6.14 - 3.3.x
|
44 |
+
* + Subscriptions 2.2.x
|
45 |
*
|
46 |
* // TODO: move to /compatibility
|
47 |
*
|
51 |
|
52 |
|
53 |
/**
|
54 |
+
* Gets the statuses that are considered "paid".
|
|
|
|
|
55 |
*
|
56 |
+
* @since 5.1.0
|
57 |
*
|
58 |
+
* @return array
|
|
|
|
|
59 |
*/
|
60 |
+
public static function wc_get_is_paid_statuses() {
|
61 |
|
62 |
if ( self::is_wc_version_gte_3_0() ) {
|
63 |
+
return wc_get_is_paid_statuses();
|
|
|
|
|
64 |
} else {
|
65 |
+
return (array) apply_filters( 'woocommerce_order_is_paid_statuses', array( 'processing', 'completed' ) );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
66 |
}
|
67 |
}
|
68 |
|
69 |
|
70 |
/**
|
71 |
+
* Logs a doing_it_wrong message.
|
72 |
*
|
73 |
+
* Backports wc_doing_it_wrong() to WC 2.6.
|
74 |
+
*
|
75 |
+
* @since 5.0.1
|
76 |
+
*
|
77 |
+
* @param string $function function used
|
78 |
+
* @param string $message message to log
|
79 |
+
* @param string $version version the message was added in
|
80 |
*/
|
81 |
+
public static function wc_doing_it_wrong( $function, $message, $version ) {
|
82 |
|
83 |
+
if ( self::is_wc_version_gte( '3.0' ) ) {
|
84 |
|
85 |
+
wc_doing_it_wrong( $function, $message, $version );
|
86 |
|
87 |
} else {
|
88 |
|
89 |
+
$message .= ' Backtrace: ' . wp_debug_backtrace_summary();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
90 |
|
91 |
+
if ( is_ajax() ) {
|
92 |
|
93 |
+
do_action( 'doing_it_wrong_run', $function, $message, $version );
|
94 |
+
error_log( "{$function} was called incorrectly. {$message}. This message was added in version {$version}." );
|
95 |
|
96 |
+
} else {
|
97 |
|
98 |
+
_doing_it_wrong( $function, $message, $version );
|
99 |
+
}
|
100 |
}
|
101 |
}
|
102 |
|
103 |
|
104 |
/**
|
105 |
+
* Formats a date for output.
|
106 |
*
|
107 |
+
* Backports WC 3.0.0's wc_format_datetime() to older versions.
|
108 |
+
*
|
109 |
+
* @since 4.6.0
|
110 |
+
*
|
111 |
+
* @param \WC_DateTime|\SV_WC_DateTime $date date object
|
112 |
+
* @param string $format date format
|
113 |
+
* @return string
|
114 |
*/
|
115 |
+
public static function wc_format_datetime( $date, $format = '' ) {
|
116 |
|
117 |
+
if ( self::is_wc_version_gte_3_0() ) {
|
118 |
|
119 |
+
return wc_format_datetime( $date, $format );
|
120 |
|
121 |
} else {
|
122 |
|
123 |
+
if ( ! $format ) {
|
124 |
+
$format = wc_date_format();
|
125 |
+
}
|
126 |
+
|
127 |
+
if ( ! is_a( $date, '\\WC_Braintree\\Plugin_Framework\\SV_WC_DateTime' ) ) { // TODO: verify this {CW 2017-07-18}
|
128 |
+
return '';
|
129 |
+
}
|
130 |
+
|
131 |
+
return $date->date_i18n( $format );
|
132 |
}
|
133 |
}
|
134 |
|
135 |
|
136 |
/**
|
137 |
+
* Logs a deprecated function notice.
|
138 |
*
|
139 |
+
* @since 5.0.0
|
140 |
*
|
141 |
+
* @param string $function deprecated function name
|
142 |
+
* @param string $version deprecated-since version
|
143 |
+
* @param string $replacement replacement function name
|
|
|
144 |
*/
|
145 |
+
public static function wc_deprecated_function( $function, $version, $replacement = null ) {
|
146 |
|
147 |
+
if ( self::is_wc_version_gte_3_0() ) {
|
148 |
|
149 |
+
wc_deprecated_function( $function, $version, $replacement );
|
150 |
|
151 |
} else {
|
152 |
|
153 |
+
if ( is_ajax() ) {
|
154 |
+
do_action( 'deprecated_function_run', $function, $replacement, $version );
|
155 |
+
$log_string = "The {$function} function is deprecated since version {$version}.";
|
156 |
+
$log_string .= $replacement ? " Replace with {$replacement}." : '';
|
157 |
+
error_log( $log_string );
|
158 |
+
} else {
|
159 |
+
_deprecated_function( $function, $version, $replacement );
|
160 |
+
}
|
161 |
}
|
162 |
}
|
163 |
|
168 |
* @since 3.0.0
|
169 |
* @return string woocommerce version number or null
|
170 |
*/
|
171 |
+
public static function get_wc_version() {
|
172 |
|
173 |
return defined( 'WC_VERSION' ) && WC_VERSION ? WC_VERSION : null;
|
174 |
}
|
175 |
|
176 |
|
177 |
/**
|
178 |
+
* Determines if the installed version of WooCommerce is 3.0 or greater.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
179 |
*
|
180 |
* @since 4.6.0
|
181 |
* @return bool
|
186 |
|
187 |
|
188 |
/**
|
189 |
+
* Determines if the installed version of WooCommerce is less than 3.0.
|
190 |
*
|
191 |
* @since 4.6.0
|
192 |
* @return bool
|
219 |
|
220 |
|
221 |
/**
|
222 |
+
* Determines if the installed version of WooCommerce meets or exceeds the
|
223 |
+
* passed version.
|
224 |
*
|
225 |
+
* @since 4.7.3
|
226 |
+
*
|
227 |
+
* @param string $version version number to compare
|
228 |
+
* @return bool
|
229 |
*/
|
230 |
+
public static function is_wc_version_gte( $version ) {
|
231 |
+
return self::get_wc_version() && version_compare( self::get_wc_version(), $version, '>=' );
|
232 |
}
|
233 |
|
234 |
|
235 |
/**
|
236 |
+
* Determines if the installed version of WooCommerce is lower than the
|
237 |
* passed version.
|
238 |
*
|
239 |
+
* @since 4.7.3
|
240 |
*
|
241 |
* @param string $version version number to compare
|
242 |
* @return bool
|
243 |
*/
|
244 |
+
public static function is_wc_version_lt( $version ) {
|
245 |
+
return self::get_wc_version() && version_compare( self::get_wc_version(), $version, '<' );
|
246 |
+
}
|
247 |
+
|
248 |
+
|
249 |
+
/**
|
250 |
+
* Returns true if the installed version of WooCommerce is greater than $version
|
251 |
+
*
|
252 |
+
* @since 2.0.0
|
253 |
+
* @param string $version the version to compare
|
254 |
+
* @return boolean true if the installed version of WooCommerce is > $version
|
255 |
+
*/
|
256 |
+
public static function is_wc_version_gt( $version ) {
|
257 |
+
return self::get_wc_version() && version_compare( self::get_wc_version(), $version, '>' );
|
258 |
}
|
259 |
|
260 |
|
302 |
* Subscriptions
|
303 |
*
|
304 |
* @since 4.1.0
|
305 |
+
* @return string WooCommerce Subscriptions version number or null if not found.
|
306 |
*/
|
307 |
protected static function get_wc_subscriptions_version() {
|
308 |
|
309 |
+
return class_exists( 'WC_Subscriptions' ) && ! empty( \WC_Subscriptions::$version ) ? \WC_Subscriptions::$version : null;
|
310 |
}
|
311 |
|
312 |
|
lib/skyverge/woocommerce/class-sv-wc-plugin-dependencies.php
ADDED
@@ -0,0 +1,476 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* WooCommerce Plugin Framework
|
4 |
+
*
|
5 |
+
* This source file is subject to the GNU General Public License v3.0
|
6 |
+
* that is bundled with this package in the file license.txt.
|
7 |
+
* It is also available through the world-wide-web at this URL:
|
8 |
+
* http://www.gnu.org/licenses/gpl-3.0.html
|
9 |
+
* If you did not receive a copy of the license and are unable to
|
10 |
+
* obtain it through the world-wide-web, please send an email
|
11 |
+
* to license@skyverge.com so we can send you a copy immediately.
|
12 |
+
*
|
13 |
+
* DISCLAIMER
|
14 |
+
*
|
15 |
+
* Do not edit or add to this file if you wish to upgrade the plugin to newer
|
16 |
+
* versions in the future. If you wish to customize the plugin for your
|
17 |
+
* needs please refer to http://www.skyverge.com
|
18 |
+
*
|
19 |
+
* @package SkyVerge/WooCommerce/Plugin/Classes
|
20 |
+
* @author SkyVerge
|
21 |
+
* @copyright Copyright (c) 2013-2018, SkyVerge, Inc.
|
22 |
+
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
|
23 |
+
*/
|
24 |
+
|
25 |
+
namespace WC_Braintree\Plugin_Framework;
|
26 |
+
|
27 |
+
defined( 'ABSPATH' ) or exit;
|
28 |
+
|
29 |
+
if ( ! class_exists( '\\WC_Braintree\\Plugin_Framework\\SV_WC_Plugin_Dependencies' ) ) :
|
30 |
+
|
31 |
+
class SV_WC_Plugin_Dependencies {
|
32 |
+
|
33 |
+
|
34 |
+
/** @var array required PHP extensions */
|
35 |
+
protected $php_extensions = array();
|
36 |
+
|
37 |
+
/** @var array required PHP functions */
|
38 |
+
protected $php_functions = array();
|
39 |
+
|
40 |
+
/** @var array required PHP settings */
|
41 |
+
protected $php_settings = array();
|
42 |
+
|
43 |
+
/** @var SV_WC_Plugin plugin instance */
|
44 |
+
protected $plugin;
|
45 |
+
|
46 |
+
|
47 |
+
/**
|
48 |
+
* Constructs the class.
|
49 |
+
*
|
50 |
+
* @param SV_WC_Plugin $plugin plugin instance
|
51 |
+
* @param array $args {
|
52 |
+
* PHP extension, function, and settings dependencies
|
53 |
+
*
|
54 |
+
* @type array $php_extensions PHP extension dependencies
|
55 |
+
* @type array $php_functions PHP function dependencies
|
56 |
+
* @type array $php_settings PHP settings dependencies
|
57 |
+
* }
|
58 |
+
*/
|
59 |
+
public function __construct( SV_WC_Plugin $plugin, $args = array() ) {
|
60 |
+
|
61 |
+
$this->plugin = $plugin;
|
62 |
+
|
63 |
+
$dependencies = $this->parse_dependencies( $args );
|
64 |
+
|
65 |
+
$this->php_extensions = (array) $dependencies['php_extensions'];
|
66 |
+
$this->php_functions = (array) $dependencies['php_functions'];
|
67 |
+
$this->php_settings = (array) $dependencies['php_settings'];
|
68 |
+
|
69 |
+
// add the action & filter hooks
|
70 |
+
$this->add_hooks();
|
71 |
+
}
|
72 |
+
|
73 |
+
|
74 |
+
/**
|
75 |
+
* Parses the dependency arguments and sets defaults.
|
76 |
+
*
|
77 |
+
* @since 5.2.0
|
78 |
+
*
|
79 |
+
* @param array $args dependency args
|
80 |
+
* @return array
|
81 |
+
*/
|
82 |
+
private function parse_dependencies( $args ) {
|
83 |
+
|
84 |
+
$dependencies = wp_parse_args( $args, array(
|
85 |
+
'php_extensions' => array(),
|
86 |
+
'php_functions' => array(),
|
87 |
+
'php_settings' => array(),
|
88 |
+
) );
|
89 |
+
|
90 |
+
$default_settings = array(
|
91 |
+
'suhosin.post.max_array_index_length' => 256,
|
92 |
+
'suhosin.post.max_totalname_length' => 65535,
|
93 |
+
'suhosin.post.max_vars' => 1024,
|
94 |
+
'suhosin.request.max_array_index_length' => 256,
|
95 |
+
'suhosin.request.max_totalname_length' => 65535,
|
96 |
+
'suhosin.request.max_vars' => 1024,
|
97 |
+
);
|
98 |
+
|
99 |
+
// override any default settings requirements if the plugin specifies them
|
100 |
+
if ( ! empty( $dependencies['php_settings'] ) ) {
|
101 |
+
$dependencies['php_settings'] = array_merge( $default_settings, $dependencies['php_settings'] );
|
102 |
+
}
|
103 |
+
|
104 |
+
return $dependencies;
|
105 |
+
}
|
106 |
+
|
107 |
+
|
108 |
+
/**
|
109 |
+
* Adds the action & filter hooks.
|
110 |
+
*
|
111 |
+
* @since 5.2.0
|
112 |
+
*/
|
113 |
+
protected function add_hooks() {
|
114 |
+
|
115 |
+
// add the admin dependency notices
|
116 |
+
add_action( 'admin_init', array( $this, 'add_admin_notices' ) );
|
117 |
+
}
|
118 |
+
|
119 |
+
|
120 |
+
/**
|
121 |
+
* Adds the admin dependency notices.
|
122 |
+
*
|
123 |
+
* @since 5.2.0
|
124 |
+
*/
|
125 |
+
public function add_admin_notices() {
|
126 |
+
|
127 |
+
$this->add_php_extension_notices();
|
128 |
+
$this->add_php_function_notices();
|
129 |
+
$this->add_php_settings_notices();
|
130 |
+
|
131 |
+
$this->add_deprecated_notices();
|
132 |
+
}
|
133 |
+
|
134 |
+
|
135 |
+
/**
|
136 |
+
* Adds notices for any missing PHP extensions.
|
137 |
+
*
|
138 |
+
* @since 5.2.0
|
139 |
+
*/
|
140 |
+
public function add_php_extension_notices() {
|
141 |
+
|
142 |
+
$missing_extensions = $this->get_missing_php_extensions();
|
143 |
+
|
144 |
+
if ( count( $missing_extensions ) > 0 ) {
|
145 |
+
|
146 |
+
$message = sprintf(
|
147 |
+
/* translators: Placeholders: %1$s - plugin name, %2$s - a PHP extension/comma-separated list of PHP extensions */
|
148 |
+
_n(
|
149 |
+
'%1$s requires the %2$s PHP extension to function. Contact your host or server administrator to install and configure the missing extension.',
|
150 |
+
'%1$s requires the following PHP extensions to function: %2$s. Contact your host or server administrator to install and configure the missing extensions.',
|
151 |
+
count( $missing_extensions ),
|
152 |
+
'woocommerce-gateway-paypal-powered-by-braintree'
|
153 |
+
),
|
154 |
+
esc_html( $this->get_plugin()->get_plugin_name() ),
|
155 |
+
'<strong>' . implode( ', ', $missing_extensions ) . '</strong>'
|
156 |
+
);
|
157 |
+
|
158 |
+
$this->add_admin_notice( 'wc-' . $this->get_plugin()->get_id_dasherized() . '-missing-extensions', $message, 'error' );
|
159 |
+
}
|
160 |
+
}
|
161 |
+
|
162 |
+
|
163 |
+
/**
|
164 |
+
* Adds notices for any missing PHP functions.
|
165 |
+
*
|
166 |
+
* @since 5.2.0
|
167 |
+
*/
|
168 |
+
public function add_php_function_notices() {
|
169 |
+
|
170 |
+
$missing_functions = $this->get_missing_php_functions();
|
171 |
+
|
172 |
+
if ( count( $missing_functions ) > 0 ) {
|
173 |
+
|
174 |
+
$message = sprintf(
|
175 |
+
/* translators: Placeholders: %1$s - plugin name, %2$s - a PHP function/comma-separated list of PHP functions */
|
176 |
+
_n(
|
177 |
+
'%1$s requires the %2$s PHP function to exist. Contact your host or server administrator to install and configure the missing function.',
|
178 |
+
'%1$s requires the following PHP functions to exist: %2$s. Contact your host or server administrator to install and configure the missing functions.',
|
179 |
+
count( $missing_functions ),
|
180 |
+
'woocommerce-gateway-paypal-powered-by-braintree'
|
181 |
+
),
|
182 |
+
esc_html( $this->get_plugin()->get_plugin_name() ),
|
183 |
+
'<strong>' . implode( ', ', $missing_functions ) . '</strong>'
|
184 |
+
);
|
185 |
+
|
186 |
+
$this->add_admin_notice( 'wc-' . $this->get_plugin()->get_id_dasherized() . '-missing-functions', $message, 'error' );
|
187 |
+
}
|
188 |
+
}
|
189 |
+
|
190 |
+
|
191 |
+
/**
|
192 |
+
* Adds notices for any incompatible PHP settings.
|
193 |
+
*
|
194 |
+
* @since 5.2.0
|
195 |
+
*/
|
196 |
+
public function add_php_settings_notices() {
|
197 |
+
|
198 |
+
if ( isset( $_GET['page'] ) && 'wc-settings' === $_GET['page'] ) {
|
199 |
+
|
200 |
+
$bad_settings = $this->get_incompatible_php_settings();
|
201 |
+
|
202 |
+
if ( count( $bad_settings ) > 0 ) {
|
203 |
+
|
204 |
+
$message = sprintf(
|
205 |
+
/* translators: Placeholders: %s - plugin name */
|
206 |
+
__( '%s may behave unexpectedly because the following PHP configuration settings are required:' ),
|
207 |
+
'<strong>' . esc_html( $this->get_plugin()->get_plugin_name() ) . '</strong>'
|
208 |
+
);
|
209 |
+
|
210 |
+
$message .= '<ul>';
|
211 |
+
|
212 |
+
foreach ( $bad_settings as $setting => $values ) {
|
213 |
+
|
214 |
+
$setting_message = '<code>' . $setting . ' = ' . $values['expected'] . '</code>';
|
215 |
+
|
216 |
+
if ( ! empty( $values['type'] ) && 'min' === $values['type'] ) {
|
217 |
+
|
218 |
+
$setting_message = sprintf(
|
219 |
+
/** translators: Placeholders: %s - a PHP setting value */
|
220 |
+
__( '%s or higher', 'woocommerce-gateway-paypal-powered-by-braintree' ),
|
221 |
+
$setting_message
|
222 |
+
);
|
223 |
+
}
|
224 |
+
|
225 |
+
$message .= '<li>' . $setting_message . '</li>';
|
226 |
+
}
|
227 |
+
|
228 |
+
$message .= '</ul>';
|
229 |
+
|
230 |
+
$message .= __( 'Please contact your hosting provider or server administrator to configure these settings.', 'woocommerce-gateway-paypal-powered-by-braintree' );
|
231 |
+
|
232 |
+
$this->add_admin_notice( 'wc-' . $this->get_plugin()->get_id_dasherized() . '-incompatibile-php-settings', $message, 'warning' );
|
233 |
+
}
|
234 |
+
}
|
235 |
+
}
|
236 |
+
|
237 |
+
|
238 |
+
/**
|
239 |
+
* Gets any deprecated warning notices.
|
240 |
+
*
|
241 |
+
* @since 5.2.0
|
242 |
+
*/
|
243 |
+
protected function add_deprecated_notices() {
|
244 |
+
|
245 |
+
// add a notice for PHP < 5.6
|
246 |
+
if ( version_compare( PHP_VERSION, '5.6.0', '<' ) ) {
|
247 |
+
|
248 |
+
$message = '<p>';
|
249 |
+
|
250 |
+
$message .= sprintf(
|
251 |
+
/* translators: Placeholders: %1$s - <strong>, %2$s - </strong> */
|
252 |
+
__( 'Hey there! We\'ve noticed that your server is running %1$san outdated version of PHP%2$s, which is the programming language that WooCommerce and its extensions are built on.
|
253 |
+
The PHP version that is currently used for your site is no longer maintained, nor %1$sreceives security updates%2$s; newer versions are faster and more secure.
|
254 |
+
As a result, %3$s no longer supports this version and you should upgrade PHP as soon as possible.
|
255 |
+
Your hosting provider can do this for you. %4$sHere are some resources to help you upgrade%5$s and to explain PHP versions further.', 'woocommerce-gateway-paypal-powered-by-braintree' ),
|
256 |
+
'<strong>', '</strong>',
|
257 |
+
esc_html( $this->get_plugin()->get_plugin_name() ),
|
258 |
+
'<a href="http://skyver.ge/upgradephp">', '</a>'
|
259 |
+
);
|
260 |
+
|
261 |
+
$message .= '</p>';
|
262 |
+
|
263 |
+
$this->add_admin_notice( 'sv-wc-deprecated-php-version', $message, 'error' );
|
264 |
+
}
|
265 |
+
|
266 |
+
// display a notice that WC < 3.0 support will soon be dropped
|
267 |
+
if ( isset( $_GET['page'] ) && 'wc-settings' === $_GET['page'] && SV_WC_Plugin_Compatibility::is_wc_version_lt( '3.0' ) ) {
|
268 |
+
|
269 |
+
$message = sprintf(
|
270 |
+
/* translators: Placeholders: %1$s - WooCommerce version number, %2$s - <strong>, %3$s - </strong>, %4$s - Plugin name, %5$s - <a> tag, %6$s - </a> tag */
|
271 |
+
__( 'Hey there! We\'ve noticed that your site is running version %1$s of WooCommerce, but %2$sWooCommerce 3.0 or higher will soon be required%3$s by %4$s. We recommend you %5$supdate WooCommerce%6$s to the latest version as soon as possible.', 'woocommerce-gateway-paypal-powered-by-braintree' ),
|
272 |
+
esc_html( SV_WC_Plugin_Compatibility::get_wc_version() ),
|
273 |
+
'<strong>', '</strong>',
|
274 |
+
esc_html( $this->get_plugin()->get_plugin_name() ),
|
275 |
+
'<a href="' . esc_url( admin_url( 'update-core.php' ) ) . '">', '</a>'
|
276 |
+
);
|
277 |
+
|
278 |
+
$this->add_admin_notice( 'sv-wc-deprecated-wc-version', $message, 'warning' );
|
279 |
+
}
|
280 |
+
}
|
281 |
+
|
282 |
+
|
283 |
+
/**
|
284 |
+
* Adds an admin notice.
|
285 |
+
*
|
286 |
+
* @since 5.2.0
|
287 |
+
*
|
288 |
+
* @param string $id notice ID
|
289 |
+
* @param string $message notice message
|
290 |
+
* @param string $type notice type
|
291 |
+
*/
|
292 |
+
protected function add_admin_notice( $id, $message, $type = 'info' ) {
|
293 |
+
|
294 |
+
$notice_class = $type;
|
295 |
+
|
296 |
+
// translate the types into WP notice classes
|
297 |
+
switch ( $type ) {
|
298 |
+
|
299 |
+
case 'error':
|
300 |
+
$notice_class = 'notice-error';
|
301 |
+
break;
|
302 |
+
|
303 |
+
case 'warning':
|
304 |
+
$notice_class = 'notice-warning';
|
305 |
+
break;
|
306 |
+
|
307 |
+
case 'info':
|
308 |
+
$notice_class = 'notice-info';
|
309 |
+
break;
|
310 |
+
|
311 |
+
case 'success':
|
312 |
+
$notice_class = 'notice-success';
|
313 |
+
break;
|
314 |
+
}
|
315 |
+
|
316 |
+
$this->get_plugin()->get_admin_notice_handler()->add_admin_notice( $message, $id, array(
|
317 |
+
'notice_class' => $notice_class,
|
318 |
+
) );
|
319 |
+
}
|
320 |
+
|
321 |
+
|
322 |
+
/** Getter methods ********************************************************/
|
323 |
+
|
324 |
+
|
325 |
+
/**
|
326 |
+
* Gets any missing PHP extensions.
|
327 |
+
*
|
328 |
+
* @since 5.2.0
|
329 |
+
*
|
330 |
+
* @return array
|
331 |
+
*/
|
332 |
+
public function get_missing_php_extensions() {
|
333 |
+
|
334 |
+
$missing_extensions = array();
|
335 |
+
|
336 |
+
foreach ( $this->get_php_extensions() as $extension ) {
|
337 |
+
|
338 |
+
if ( ! extension_loaded( $extension ) ) {
|
339 |
+
$missing_extensions[] = $extension;
|
340 |
+
}
|
341 |
+
}
|
342 |
+
|
343 |
+
return $missing_extensions;
|
344 |
+
}
|
345 |
+
|
346 |
+
|
347 |
+
/**
|
348 |
+
* Gets the required PHP extensions.
|
349 |
+
*
|
350 |
+
* @since 5.2.0
|
351 |
+
*
|
352 |
+
* @return array
|
353 |
+
*/
|
354 |
+
public function get_php_extensions() {
|
355 |
+
|
356 |
+
return $this->php_extensions;
|
357 |
+
}
|
358 |
+
|
359 |
+
|
360 |
+
/**
|
361 |
+
* Gets any missing PHP functions.
|
362 |
+
*
|
363 |
+
* @since 5.2.0
|
364 |
+
*
|
365 |
+
* @return array
|
366 |
+
*/
|
367 |
+
public function get_missing_php_functions() {
|
368 |
+
|
369 |
+
$missing_functions = array();
|
370 |
+
|
371 |
+
foreach ( $this->get_php_functions() as $function ) {
|
372 |
+
|
373 |
+
if ( ! extension_loaded( $function ) ) {
|
374 |
+
$missing_functions[] = $function;
|
375 |
+
}
|
376 |
+
}
|
377 |
+
|
378 |
+
return $missing_functions;
|
379 |
+
}
|
380 |
+
|
381 |
+
|
382 |
+
/**
|
383 |
+
* Gets the required PHP functions.
|
384 |
+
*
|
385 |
+
* @since 5.2.0
|
386 |
+
*
|
387 |
+
* @return array
|
388 |
+
*/
|
389 |
+
public function get_php_functions() {
|
390 |
+
|
391 |
+
return $this->php_functions;
|
392 |
+
}
|
393 |
+
|
394 |
+
|
395 |
+
/**
|
396 |
+
* Gets any incompatible PHP settings.
|
397 |
+
*
|
398 |
+
* @since 5.2.0
|
399 |
+
*
|
400 |
+
* @return array
|
401 |
+
*/
|
402 |
+
public function get_incompatible_php_settings() {
|
403 |
+
|
404 |
+
$incompatible_settings = array();
|
405 |
+
|
406 |
+
$dependences = $this->get_php_settings();
|
407 |
+
|
408 |
+
if ( function_exists( 'ini_get' ) ) {
|
409 |
+
|
410 |
+
foreach ( $this->get_php_settings() as $setting => $expected ) {
|
411 |
+
|
412 |
+
$actual = ini_get( $setting );
|
413 |
+
|
414 |
+
if ( ! $actual ) {
|
415 |
+
continue;
|
416 |
+
}
|
417 |
+
|
418 |
+
if ( is_integer( $expected ) ) {
|
419 |
+
|
420 |
+
// determine if this is a size string, like "10MB"
|
421 |
+
$is_size = ! is_numeric( substr( $actual, -1 ) );
|
422 |
+
|
423 |
+
$actual_num = $is_size ? wc_let_to_num( $actual ) : $actual;
|
424 |
+
|
425 |
+
if ( $actual_num < $expected ) {
|
426 |
+
|
427 |
+
$incompatible_settings[ $setting ] = array(
|
428 |
+
'expected' => $is_size ? size_format( $expected ) : $expected,
|
429 |
+
'actual' => $is_size ? size_format( $actual_num ) : $actual,
|
430 |
+
'type' => 'min',
|
431 |
+
);
|
432 |
+
}
|
433 |
+
|
434 |
+
} elseif ( $actual !== $expected ) {
|
435 |
+
|
436 |
+
$incompatible_settings[ $setting ] = array(
|
437 |
+
'expected' => $expected,
|
438 |
+
'actual' => $actual,
|
439 |
+
);
|
440 |
+
}
|
441 |
+
}
|
442 |
+
}
|
443 |
+
|
444 |
+
return $incompatible_settings;
|
445 |
+
}
|
446 |
+
|
447 |
+
|
448 |
+
/**
|
449 |
+
* Gets the required PHP settings.
|
450 |
+
*
|
451 |
+
* @since 5.2.0
|
452 |
+
*
|
453 |
+
* @return array
|
454 |
+
*/
|
455 |
+
public function get_php_settings() {
|
456 |
+
|
457 |
+
return $this->php_settings;
|
458 |
+
}
|
459 |
+
|
460 |
+
|
461 |
+
/**
|
462 |
+
* Gets the plugin instance.
|
463 |
+
*
|
464 |
+
* @since 5.2.0
|
465 |
+
*
|
466 |
+
* @return SV_WC_Plugin
|
467 |
+
*/
|
468 |
+
protected function get_plugin() {
|
469 |
+
|
470 |
+
return $this->plugin;
|
471 |
+
}
|
472 |
+
|
473 |
+
|
474 |
+
}
|
475 |
+
|
476 |
+
endif;
|
lib/skyverge/woocommerce/class-sv-wc-plugin-exception.php
CHANGED
@@ -18,15 +18,15 @@
|
|
18 |
*
|
19 |
* @package SkyVerge/WooCommerce/Exceptions
|
20 |
* @author SkyVerge
|
21 |
-
* @copyright Copyright (c) 2013-
|
22 |
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
|
23 |
*/
|
24 |
|
25 |
-
namespace
|
26 |
|
27 |
defined( 'ABSPATH' ) or exit;
|
28 |
|
29 |
-
if ( ! class_exists( '
|
30 |
|
31 |
/**
|
32 |
* Plugin Framework Exception - generic Exception
|
18 |
*
|
19 |
* @package SkyVerge/WooCommerce/Exceptions
|
20 |
* @author SkyVerge
|
21 |
+
* @copyright Copyright (c) 2013-2018, SkyVerge, Inc.
|
22 |
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
|
23 |
*/
|
24 |
|
25 |
+
namespace WC_Braintree\Plugin_Framework;
|
26 |
|
27 |
defined( 'ABSPATH' ) or exit;
|
28 |
|
29 |
+
if ( ! class_exists( '\\WC_Braintree\\Plugin_Framework\\SV_WC_Plugin_Exception' ) ) :
|
30 |
|
31 |
/**
|
32 |
* Plugin Framework Exception - generic Exception
|
lib/skyverge/woocommerce/class-sv-wc-plugin.php
CHANGED
@@ -18,14 +18,16 @@
|
|
18 |
*
|
19 |
* @package SkyVerge/WooCommerce/Plugin/Classes
|
20 |
* @author SkyVerge
|
21 |
-
* @copyright Copyright (c) 2013-
|
22 |
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
|
23 |
*/
|
24 |
|
25 |
-
namespace
|
26 |
|
27 |
defined( 'ABSPATH' ) or exit;
|
28 |
|
|
|
|
|
29 |
/**
|
30 |
* # WooCommerce Plugin Framework
|
31 |
*
|
@@ -34,13 +36,13 @@ defined( 'ABSPATH' ) or exit;
|
|
34 |
* plugin. This class handles all the "non-feature" support tasks such
|
35 |
* as verifying dependencies are met, loading the text domain, etc.
|
36 |
*
|
37 |
-
* @version
|
38 |
*/
|
39 |
abstract class SV_WC_Plugin {
|
40 |
|
41 |
|
42 |
/** Plugin Framework Version */
|
43 |
-
const VERSION = '
|
44 |
|
45 |
/** @var object single instance of plugin */
|
46 |
protected static $instance;
|
@@ -60,18 +62,30 @@ abstract class SV_WC_Plugin {
|
|
60 |
/** @var \WC_Logger instance */
|
61 |
private $logger;
|
62 |
|
63 |
-
/** @var
|
64 |
private $message_handler;
|
65 |
|
66 |
-
/** @var array string names of required PHP extensions */
|
67 |
-
private $dependencies = array();
|
68 |
-
|
69 |
-
/** @var array string names of required PHP functions */
|
70 |
-
private $function_dependencies = array();
|
71 |
-
|
72 |
/** @var string the plugin text domain */
|
73 |
private $text_domain;
|
74 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
75 |
/** @var SV_WC_Admin_Notice_Handler the admin notice handler class */
|
76 |
private $admin_notice_handler;
|
77 |
|
@@ -82,6 +96,7 @@ abstract class SV_WC_Plugin {
|
|
82 |
* Child plugin classes may add their own optional arguments.
|
83 |
*
|
84 |
* @since 2.0.0
|
|
|
85 |
* @param string $id plugin id
|
86 |
* @param string $version plugin version number
|
87 |
* @param array $args {
|
@@ -89,69 +104,117 @@ abstract class SV_WC_Plugin {
|
|
89 |
*
|
90 |
* @type string $text_domain the plugin textdomain, used to set up translations
|
91 |
* @type array $dependencies {
|
92 |
-
*
|
93 |
*
|
94 |
-
*
|
95 |
-
*
|
96 |
-
*
|
97 |
-
* String values are treated with direct
|
98 |
-
* comparison, integers as minimums
|
99 |
* }
|
100 |
* }
|
101 |
*/
|
102 |
public function __construct( $id, $version, $args = array() ) {
|
103 |
|
104 |
// required params
|
105 |
-
$this->id
|
106 |
-
$this->version
|
107 |
|
108 |
-
$
|
|
|
|
|
|
|
109 |
|
110 |
-
|
111 |
-
|
112 |
-
$dependencies['functions'] = $args['function_dependencies'];
|
113 |
-
}
|
114 |
-
|
115 |
-
$this->set_dependencies( $dependencies );
|
116 |
-
|
117 |
-
if ( isset( $args['text_domain'] ) ) {
|
118 |
-
$this->text_domain = $args['text_domain'];
|
119 |
-
}
|
120 |
|
121 |
// includes that are required to be available at all times
|
122 |
$this->includes();
|
123 |
|
124 |
-
|
|
|
|
|
125 |
|
126 |
-
$this->load_hook_deprecator();
|
127 |
|
128 |
-
|
129 |
-
|
|
|
|
|
|
|
|
|
130 |
|
131 |
-
|
132 |
-
require_once( $this->get_framework_path() . '/class-sv-wp-admin-message-handler.php' );
|
133 |
|
134 |
-
|
135 |
-
|
136 |
-
add_action( 'admin_footer', array( $this, 'add_delayed_admin_notices' ), 10 );
|
137 |
|
138 |
-
|
139 |
-
|
|
|
140 |
|
141 |
-
|
142 |
-
|
143 |
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
148 |
|
149 |
-
// automatically log HTTP requests from SV_WC_API_Base
|
150 |
-
$this->add_api_request_logging();
|
151 |
|
152 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
153 |
add_action( 'init', array( $this, 'load_translations' ) );
|
154 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
155 |
// add any PHP incompatibilities to the system status report
|
156 |
if ( SV_WC_Plugin_Compatibility::is_wc_version_gte_3_0() ) {
|
157 |
add_filter( 'woocommerce_system_status_environment_rows', array( $this, 'add_system_status_php_information' ) );
|
@@ -161,29 +224,170 @@ abstract class SV_WC_Plugin {
|
|
161 |
}
|
162 |
|
163 |
|
|
|
|
|
|
|
164 |
/**
|
165 |
-
*
|
166 |
*
|
167 |
-
* @
|
|
|
|
|
168 |
*/
|
169 |
-
public function
|
170 |
-
|
171 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
172 |
}
|
173 |
|
|
|
174 |
/**
|
175 |
-
*
|
176 |
*
|
177 |
-
* @since
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
178 |
*/
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
}
|
183 |
|
184 |
|
185 |
/**
|
186 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
187 |
*
|
188 |
* @since 4.2.0
|
189 |
*/
|
@@ -193,13 +397,7 @@ abstract class SV_WC_Plugin {
|
|
193 |
|
194 |
// if this plugin passes along its text domain, load its translation files
|
195 |
if ( $this->text_domain ) {
|
196 |
-
|
197 |
$this->load_plugin_textdomain();
|
198 |
-
|
199 |
-
// otherwise, use the backwards compatibile method
|
200 |
-
} elseif ( is_callable( array( $this, 'load_translation' ) ) ) {
|
201 |
-
|
202 |
-
$this->load_translation();
|
203 |
}
|
204 |
}
|
205 |
|
@@ -210,7 +408,7 @@ abstract class SV_WC_Plugin {
|
|
210 |
* @since 4.5.0
|
211 |
*/
|
212 |
protected function load_framework_textdomain() {
|
213 |
-
$this->load_textdomain( 'woocommerce-
|
214 |
}
|
215 |
|
216 |
|
@@ -220,7 +418,7 @@ abstract class SV_WC_Plugin {
|
|
220 |
* @since 4.5.0
|
221 |
*/
|
222 |
protected function load_plugin_textdomain() {
|
223 |
-
$this->load_textdomain( $this->text_domain, dirname( plugin_basename( $this->
|
224 |
}
|
225 |
|
226 |
|
@@ -233,7 +431,10 @@ abstract class SV_WC_Plugin {
|
|
233 |
*/
|
234 |
protected function load_textdomain( $textdomain, $path ) {
|
235 |
|
236 |
-
|
|
|
|
|
|
|
237 |
|
238 |
load_textdomain( $textdomain, WP_LANG_DIR . '/' . $textdomain . '/' . $textdomain . '-' . $locale . '.mo' );
|
239 |
|
@@ -242,61 +443,24 @@ abstract class SV_WC_Plugin {
|
|
242 |
|
243 |
|
244 |
/**
|
245 |
-
*
|
246 |
-
*
|
247 |
-
* @since 2.0.0
|
248 |
-
*/
|
249 |
-
public function lib_includes() {
|
250 |
-
|
251 |
-
if ( is_admin() ) {
|
252 |
-
// instantiate the admin notice handler
|
253 |
-
$this->get_admin_notice_handler();
|
254 |
-
}
|
255 |
-
}
|
256 |
-
|
257 |
-
|
258 |
-
/**
|
259 |
-
* Include any critical files which must be available as early as possible
|
260 |
*
|
261 |
-
* @since
|
262 |
*/
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
// common exception class
|
268 |
-
require_once( $framework_path . '/class-sv-wc-plugin-exception.php' );
|
269 |
-
|
270 |
-
// common utility methods
|
271 |
-
require_once( $framework_path . '/class-sv-wc-helper.php' );
|
272 |
-
|
273 |
-
// backwards compatibility for older WC versions
|
274 |
-
require_once( $framework_path . '/class-sv-wc-plugin-compatibility.php' );
|
275 |
-
require_once( $framework_path . '/compatibility/abstract-sv-wc-data-compatibility.php' );
|
276 |
-
require_once( $framework_path . '/compatibility/class-sv-wc-order-compatibility.php' );
|
277 |
-
require_once( $framework_path . '/compatibility/class-sv-wc-product-compatibility.php' );
|
278 |
-
|
279 |
-
// TODO: Remove this when WC 3.x can be required {CW 2017-03-16}
|
280 |
-
require_once( $framework_path . '/compatibility/class-sv-wc-datetime.php' );
|
281 |
-
|
282 |
-
// generic API base
|
283 |
-
require_once( $framework_path . '/api/class-sv-wc-api-exception.php' );
|
284 |
-
require_once( $framework_path . '/api/class-sv-wc-api-base.php' );
|
285 |
-
require_once( $framework_path . '/api/interface-sv-wc-api-request.php' );
|
286 |
-
require_once( $framework_path . '/api/interface-sv-wc-api-response.php' );
|
287 |
}
|
288 |
|
289 |
|
290 |
/**
|
291 |
-
*
|
292 |
*
|
293 |
-
* @since
|
294 |
*/
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
$this->hook_deprecator = new SV_WC_Hook_Deprecator( $this->get_plugin_name(), $this->get_deprecated_hooks() );
|
300 |
}
|
301 |
|
302 |
|
@@ -345,8 +509,7 @@ abstract class SV_WC_Plugin {
|
|
345 |
*/
|
346 |
public function add_admin_notices() {
|
347 |
|
348 |
-
|
349 |
-
$this->add_dependencies_admin_notices();
|
350 |
}
|
351 |
|
352 |
|
@@ -361,104 +524,6 @@ abstract class SV_WC_Plugin {
|
|
361 |
}
|
362 |
|
363 |
|
364 |
-
/**
|
365 |
-
* Checks if required PHP extensions are not loaded and adds a dismissible admin
|
366 |
-
* notice if so. Notice will not be rendered to the admin user once dismissed
|
367 |
-
* unless on the plugin settings page, if any
|
368 |
-
*
|
369 |
-
* @since 3.0.0
|
370 |
-
*/
|
371 |
-
protected function add_dependencies_admin_notices() {
|
372 |
-
|
373 |
-
// report any missing extensions
|
374 |
-
$missing_extensions = $this->get_missing_extension_dependencies();
|
375 |
-
|
376 |
-
if ( count( $missing_extensions ) > 0 ) {
|
377 |
-
|
378 |
-
$message = sprintf(
|
379 |
-
/* translators: Placeholders: %1$s - plugin name, %2$s - a PHP extension/comma-separated list of PHP extensions */
|
380 |
-
_n(
|
381 |
-
'%1$s requires the %2$s PHP extension to function. Contact your host or server administrator to configure and install the missing extension.',
|
382 |
-
'%1$s requires the following PHP extensions to function: %2$s. Contact your host or server administrator to configure and install the missing extensions.',
|
383 |
-
count( $missing_extensions ),
|
384 |
-
'woocommerce-plugin-framework'
|
385 |
-
),
|
386 |
-
$this->get_plugin_name(),
|
387 |
-
'<strong>' . implode( ', ', $missing_extensions ) . '</strong>'
|
388 |
-
);
|
389 |
-
|
390 |
-
$this->get_admin_notice_handler()->add_admin_notice( $message, 'missing-extensions', array(
|
391 |
-
'notice_class' => 'error',
|
392 |
-
) );
|
393 |
-
|
394 |
-
}
|
395 |
-
|
396 |
-
// report any missing functions
|
397 |
-
$missing_functions = $this->get_missing_function_dependencies();
|
398 |
-
|
399 |
-
if ( count( $missing_functions ) > 0 ) {
|
400 |
-
|
401 |
-
$message = sprintf(
|
402 |
-
/* translators: Placeholders: %1$s - plugin name, %2$s - a PHP function/comma-separated list of PHP functions */
|
403 |
-
_n(
|
404 |
-
'%1$s requires the %2$s PHP function to exist. Contact your host or server administrator to configure and install the missing function.',
|
405 |
-
'%1$s requires the following PHP functions to exist: %2$s. Contact your host or server administrator to configure and install the missing functions.',
|
406 |
-
count( $missing_functions ),
|
407 |
-
'woocommerce-plugin-framework'
|
408 |
-
),
|
409 |
-
$this->get_plugin_name(),
|
410 |
-
'<strong>' . implode( ', ', $missing_functions ) . '</strong>'
|
411 |
-
);
|
412 |
-
|
413 |
-
$this->get_admin_notice_handler()->add_admin_notice( $message, 'missing-functions', array(
|
414 |
-
'notice_class' => 'error',
|
415 |
-
) );
|
416 |
-
|
417 |
-
}
|
418 |
-
|
419 |
-
// if on the settings page, report any incompatible PHP settings
|
420 |
-
if ( $this->is_plugin_settings() || ( ! $this->get_settings_url() && $this->is_general_configuration_page() ) ) {
|
421 |
-
|
422 |
-
$bad_settings = $this->get_incompatible_php_settings();
|
423 |
-
|
424 |
-
if ( count( $bad_settings ) > 0 ) {
|
425 |
-
|
426 |
-
$message = sprintf(
|
427 |
-
/* translators: Placeholders: %s - plugin name */
|
428 |
-
__( '%s may behave unexpectedly because the following PHP configuration settings are required:' ),
|
429 |
-
'<strong>' . $this->get_plugin_name() . '</strong>'
|
430 |
-
);
|
431 |
-
|
432 |
-
$message .= '<ul>';
|
433 |
-
|
434 |
-
foreach ( $bad_settings as $setting => $values ) {
|
435 |
-
|
436 |
-
$setting_message = '<code>' . $setting . ' = ' . $values['expected'] . '</code>';
|
437 |
-
|
438 |
-
if ( ! empty( $values['type'] ) && 'min' === $values['type'] ) {
|
439 |
-
|
440 |
-
$setting_message = sprintf(
|
441 |
-
/** translators: Placeholders: %s - a PHP setting value */
|
442 |
-
__( '%s or higher', 'woocommerce-gateway-paypal-powered-by-braintree' ),
|
443 |
-
$setting_message
|
444 |
-
);
|
445 |
-
}
|
446 |
-
|
447 |
-
$message .= '<li>' . $setting_message . '</li>';
|
448 |
-
}
|
449 |
-
|
450 |
-
$message .= '</ul>';
|
451 |
-
|
452 |
-
$message .= __( 'Please contact your hosting provider or server administrator to configure these settings.', 'woocommerce-gateway-paypal-powered-by-braintree' );
|
453 |
-
|
454 |
-
$this->get_admin_notice_handler()->add_admin_notice( $message, 'bad-php-configuration', array(
|
455 |
-
'notice_class' => 'error',
|
456 |
-
) );
|
457 |
-
}
|
458 |
-
}
|
459 |
-
}
|
460 |
-
|
461 |
-
|
462 |
/**
|
463 |
* Return the plugin action links. This will only be called if the plugin
|
464 |
* is active.
|
@@ -487,6 +552,11 @@ abstract class SV_WC_Plugin {
|
|
487 |
$custom_actions['support'] = sprintf( '<a href="%s">%s</a>', $this->get_support_url(), esc_html_x( 'Support', 'noun', 'woocommerce-gateway-paypal-powered-by-braintree' ) );
|
488 |
}
|
489 |
|
|
|
|
|
|
|
|
|
|
|
490 |
// add the links to the front of the actions list
|
491 |
return array_merge( $custom_actions, $actions );
|
492 |
}
|
@@ -519,140 +589,32 @@ abstract class SV_WC_Plugin {
|
|
519 |
*/
|
520 |
public function log_api_request( $request, $response, $log_id = null ) {
|
521 |
|
522 |
-
$this->log( "Request\n" . $this->get_api_log_message( $request ), $log_id );
|
523 |
-
|
524 |
-
if ( ! empty( $response ) ) {
|
525 |
-
$this->log( "Response\n" . $this->get_api_log_message( $response ), $log_id );
|
526 |
-
}
|
527 |
-
}
|
528 |
-
|
529 |
-
|
530 |
-
/**
|
531 |
-
* Transform the API request/response data into a string suitable for logging
|
532 |
-
*
|
533 |
-
* @since 2.2.0
|
534 |
-
* @param array $data
|
535 |
-
* @return string
|
536 |
-
*/
|
537 |
-
public function get_api_log_message( $data ) {
|
538 |
-
|
539 |
-
$messages = array();
|
540 |
-
|
541 |
-
$messages[] = isset( $data['uri'] ) && $data['uri'] ? 'Request' : 'Response';
|
542 |
-
|
543 |
-
foreach ( (array) $data as $key => $value ) {
|
544 |
-
$messages[] = trim( sprintf( '%s: %s', $key, is_array( $value ) || ( is_object( $value ) && '\stdClass' == get_class( $value ) ) ? print_r( (array) $value, true ) : $value ) );
|
545 |
-
}
|
546 |
-
|
547 |
-
return implode( "\n", $messages ) . "\n";
|
548 |
-
}
|
549 |
-
|
550 |
-
|
551 |
-
/**
|
552 |
-
* Gets the string name of any required PHP extensions that are not loaded.
|
553 |
-
*
|
554 |
-
* @deprecated since 4.5.0
|
555 |
-
*
|
556 |
-
* @since 2.0.0
|
557 |
-
* @return array of missing dependencies
|
558 |
-
*/
|
559 |
-
public function get_missing_dependencies() {
|
560 |
-
|
561 |
-
return $this->get_missing_extension_dependencies();
|
562 |
-
}
|
563 |
-
|
564 |
-
|
565 |
-
/**
|
566 |
-
* Gets the string name of any required PHP extensions that are not loaded
|
567 |
-
*
|
568 |
-
* @since 4.5.0
|
569 |
-
* @return array of missing dependencies
|
570 |
-
*/
|
571 |
-
public function get_missing_extension_dependencies() {
|
572 |
-
|
573 |
-
$missing_extensions = array();
|
574 |
-
|
575 |
-
foreach ( $this->get_extension_dependencies() as $ext ) {
|
576 |
-
|
577 |
-
if ( ! extension_loaded( $ext ) ) {
|
578 |
-
$missing_extensions[] = $ext;
|
579 |
-
}
|
580 |
-
}
|
581 |
-
|
582 |
-
return $missing_extensions;
|
583 |
-
}
|
584 |
-
|
585 |
-
|
586 |
-
/**
|
587 |
-
* Gets the string name of any required PHP functions that are not loaded
|
588 |
-
*
|
589 |
-
* @since 2.1.0
|
590 |
-
* @return array of missing functions
|
591 |
-
*/
|
592 |
-
public function get_missing_function_dependencies() {
|
593 |
-
|
594 |
-
$missing_functions = array();
|
595 |
-
|
596 |
-
foreach ( $this->get_function_dependencies() as $fcn ) {
|
597 |
|
598 |
-
|
599 |
-
|
600 |
-
}
|
601 |
}
|
602 |
-
|
603 |
-
return $missing_functions;
|
604 |
}
|
605 |
|
606 |
|
607 |
/**
|
608 |
-
*
|
609 |
*
|
610 |
-
* @since
|
611 |
-
* @
|
|
|
612 |
*/
|
613 |
-
public function
|
614 |
-
|
615 |
-
$incompatible_settings = array();
|
616 |
-
|
617 |
-
$dependences = $this->get_php_settings_dependencies();
|
618 |
-
|
619 |
-
if ( function_exists( 'ini_get' ) && ! empty( $dependences ) ) {
|
620 |
-
|
621 |
-
foreach ( $dependences as $setting => $expected ) {
|
622 |
-
|
623 |
-
$actual = ini_get( $setting );
|
624 |
-
|
625 |
-
if ( ! $actual ) {
|
626 |
-
continue;
|
627 |
-
}
|
628 |
-
|
629 |
-
if ( is_integer( $expected ) ) {
|
630 |
-
|
631 |
-
// determine if this is a size string, like "10MB"
|
632 |
-
$is_size = ! is_numeric( substr( $actual, -1 ) );
|
633 |
-
|
634 |
-
$actual_num = $is_size ? wc_let_to_num( $actual ) : $actual;
|
635 |
-
|
636 |
-
if ( $actual_num < $expected ) {
|
637 |
|
638 |
-
|
639 |
-
'expected' => $is_size ? size_format( $expected ) : $expected,
|
640 |
-
'actual' => $is_size ? size_format( $actual_num ) : $actual,
|
641 |
-
'type' => 'min',
|
642 |
-
);
|
643 |
-
}
|
644 |
|
645 |
-
|
646 |
|
647 |
-
|
648 |
-
|
649 |
-
'actual' => $actual,
|
650 |
-
);
|
651 |
-
}
|
652 |
-
}
|
653 |
}
|
654 |
|
655 |
-
return $
|
656 |
}
|
657 |
|
658 |
|
@@ -660,10 +622,13 @@ abstract class SV_WC_Plugin {
|
|
660 |
* Adds any PHP incompatibilities to the system status report.
|
661 |
*
|
662 |
* @since 4.5.0
|
|
|
|
|
|
|
663 |
*/
|
664 |
public function add_system_status_php_information( $rows ) {
|
665 |
|
666 |
-
foreach ( $this->get_incompatible_php_settings() as $setting => $values ) {
|
667 |
|
668 |
if ( isset( $values['type'] ) && 'min' === $values['type'] ) {
|
669 |
|
@@ -698,43 +663,6 @@ abstract class SV_WC_Plugin {
|
|
698 |
}
|
699 |
|
700 |
|
701 |
-
/**
|
702 |
-
* Sets the plugin dependencies.
|
703 |
-
*
|
704 |
-
* @since 4.5.0
|
705 |
-
* @param array $dependencies the environment dependencies
|
706 |
-
*/
|
707 |
-
protected function set_dependencies( $dependencies = array() ) {
|
708 |
-
|
709 |
-
$default_dependencies = array(
|
710 |
-
'extensions' => array(),
|
711 |
-
'functions' => array(),
|
712 |
-
'settings' => array(
|
713 |
-
'suhosin.post.max_array_index_length' => 256,
|
714 |
-
'suhosin.post.max_totalname_length' => 65535,
|
715 |
-
'suhosin.post.max_vars' => 1024,
|
716 |
-
'suhosin.request.max_array_index_length' => 256,
|
717 |
-
'suhosin.request.max_totalname_length' => 65535,
|
718 |
-
'suhosin.request.max_vars' => 1024,
|
719 |
-
),
|
720 |
-
);
|
721 |
-
|
722 |
-
if ( isset( $dependencies[0] ) ) {
|
723 |
-
|
724 |
-
$dependencies = array(
|
725 |
-
'extensions' => $dependencies,
|
726 |
-
);
|
727 |
-
}
|
728 |
-
|
729 |
-
// override any default settings requirements if the plugin specifies them
|
730 |
-
if ( ! empty( $dependencies['settings'] ) ) {
|
731 |
-
$dependencies['settings'] = array_merge( $default_dependencies['settings'], $dependencies['settings'] );
|
732 |
-
}
|
733 |
-
|
734 |
-
$this->dependencies = wp_parse_args( $dependencies, $default_dependencies );
|
735 |
-
}
|
736 |
-
|
737 |
-
|
738 |
/**
|
739 |
* Saves errors or messages to WooCommerce Log (woocommerce/logs/plugin-id-xxx.txt)
|
740 |
*
|
@@ -775,6 +703,21 @@ abstract class SV_WC_Plugin {
|
|
775 |
/** Getter methods ******************************************************/
|
776 |
|
777 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
778 |
/**
|
779 |
* The implementation for this abstract method should simply be:
|
780 |
*
|
@@ -819,86 +762,94 @@ abstract class SV_WC_Plugin {
|
|
819 |
abstract public function get_plugin_name();
|
820 |
|
821 |
|
|
|
|
|
|
|
822 |
/**
|
823 |
-
*
|
824 |
*
|
825 |
-
* @since
|
|
|
|
|
826 |
*/
|
827 |
-
public function
|
828 |
-
|
829 |
-
if ( ! is_null( $this->admin_notice_handler ) ) {
|
830 |
-
return $this->admin_notice_handler;
|
831 |
-
}
|
832 |
-
|
833 |
-
require_once( $this->get_framework_path() . '/class-sv-wc-admin-notice-handler.php' );
|
834 |
|
835 |
-
return $this->
|
836 |
}
|
837 |
|
838 |
|
839 |
/**
|
840 |
-
*
|
841 |
*
|
842 |
-
* @since
|
843 |
-
*
|
|
|
844 |
*/
|
845 |
-
|
846 |
-
|
|
|
847 |
}
|
848 |
|
849 |
|
850 |
/**
|
851 |
-
*
|
852 |
*
|
853 |
-
* @since
|
854 |
-
*
|
|
|
855 |
*/
|
856 |
-
public function
|
857 |
-
|
|
|
858 |
}
|
859 |
|
860 |
|
861 |
/**
|
862 |
-
*
|
863 |
*
|
864 |
* @since 2.0.0
|
865 |
-
*
|
|
|
866 |
*/
|
867 |
-
|
868 |
-
|
|
|
869 |
}
|
870 |
|
871 |
|
872 |
/**
|
873 |
-
*
|
874 |
*
|
875 |
-
* @since
|
876 |
-
*
|
|
|
877 |
*/
|
878 |
-
|
879 |
-
|
|
|
880 |
}
|
881 |
|
882 |
|
883 |
/**
|
884 |
-
*
|
885 |
*
|
886 |
-
* @since 2.
|
887 |
-
* @return
|
888 |
*/
|
889 |
-
|
890 |
-
|
|
|
891 |
}
|
892 |
|
893 |
|
894 |
/**
|
895 |
-
*
|
896 |
*
|
897 |
-
* @since
|
898 |
-
* @return
|
899 |
*/
|
900 |
-
|
901 |
-
return $this->
|
902 |
}
|
903 |
|
904 |
|
@@ -951,7 +902,7 @@ abstract class SV_WC_Plugin {
|
|
951 |
*/
|
952 |
public function is_general_configuration_page() {
|
953 |
|
954 |
-
return isset( $_GET['page'] ) && 'wc-settings'
|
955 |
}
|
956 |
|
957 |
|
@@ -991,6 +942,34 @@ abstract class SV_WC_Plugin {
|
|
991 |
}
|
992 |
|
993 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
994 |
/**
|
995 |
* Returns the plugin's path without a trailing slash, i.e.
|
996 |
* /path/to/wp-content/plugins/plugin-directory
|
@@ -1088,24 +1067,6 @@ abstract class SV_WC_Plugin {
|
|
1088 |
}
|
1089 |
|
1090 |
|
1091 |
-
/**
|
1092 |
-
* Returns the WP Admin Message Handler instance for use with
|
1093 |
-
* setting/displaying admin messages & errors
|
1094 |
-
*
|
1095 |
-
* @since 2.0.0
|
1096 |
-
* @return SV_WP_Admin_Message_Handler
|
1097 |
-
*/
|
1098 |
-
public function get_message_handler() {
|
1099 |
-
|
1100 |
-
if ( is_object( $this->message_handler ) ) {
|
1101 |
-
|
1102 |
-
return $this->message_handler;
|
1103 |
-
}
|
1104 |
-
|
1105 |
-
return $this->message_handler = new SV_WP_Admin_Message_Handler( $this->get_id() );
|
1106 |
-
}
|
1107 |
-
|
1108 |
-
|
1109 |
/**
|
1110 |
* Helper function to determine whether a plugin is active
|
1111 |
*
|
@@ -1143,91 +1104,190 @@ abstract class SV_WC_Plugin {
|
|
1143 |
}
|
1144 |
|
1145 |
|
1146 |
-
/**
|
1147 |
|
1148 |
|
1149 |
/**
|
1150 |
-
* Handles version checking
|
1151 |
*
|
1152 |
* @since 2.0.0
|
|
|
1153 |
*/
|
1154 |
public function do_install() {
|
1155 |
|
1156 |
-
|
1157 |
-
|
1158 |
-
// installed version lower than plugin version?
|
1159 |
-
if ( version_compare( $installed_version, $this->get_version(), '<' ) ) {
|
1160 |
-
|
1161 |
-
if ( ! $installed_version ) {
|
1162 |
-
$this->install();
|
1163 |
-
} else {
|
1164 |
-
$this->upgrade( $installed_version );
|
1165 |
-
}
|
1166 |
|
1167 |
-
|
1168 |
-
update_option( $this->get_plugin_version_name(), $this->get_version() );
|
1169 |
-
}
|
1170 |
}
|
1171 |
|
1172 |
|
1173 |
/**
|
1174 |
-
* Helper method to install default settings for a plugin
|
1175 |
*
|
1176 |
* @since 4.2.0
|
|
|
|
|
1177 |
* @param array $settings array of settings in format required by WC_Admin_Settings
|
1178 |
*/
|
1179 |
public function install_default_settings( array $settings ) {
|
1180 |
|
1181 |
-
|
|
|
|
|
|
|
1182 |
|
1183 |
-
if ( isset( $setting['id'] ) && isset( $setting['default'] ) ) {
|
1184 |
|
1185 |
-
|
1186 |
-
|
1187 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1188 |
}
|
1189 |
|
1190 |
|
1191 |
/**
|
1192 |
-
*
|
1193 |
*
|
1194 |
-
* @since
|
|
|
|
|
|
|
1195 |
*/
|
1196 |
-
|
1197 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1198 |
}
|
1199 |
|
1200 |
|
1201 |
/**
|
1202 |
-
*
|
1203 |
*
|
1204 |
* @since 2.0.0
|
1205 |
-
* @
|
|
|
|
|
1206 |
*/
|
1207 |
-
protected function
|
1208 |
-
|
|
|
|
|
|
|
1209 |
}
|
1210 |
|
1211 |
|
1212 |
/**
|
1213 |
-
*
|
1214 |
-
* Note that this _does not_ run during upgrades.
|
1215 |
*
|
1216 |
-
* @since 4.
|
|
|
|
|
|
|
1217 |
*/
|
1218 |
-
|
1219 |
-
|
|
|
|
|
|
|
1220 |
}
|
1221 |
|
1222 |
|
1223 |
/**
|
1224 |
-
*
|
1225 |
*
|
1226 |
-
* @since
|
|
|
|
|
|
|
1227 |
*/
|
1228 |
-
|
1229 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1230 |
}
|
1231 |
|
1232 |
|
1233 |
}
|
|
|
|
18 |
*
|
19 |
* @package SkyVerge/WooCommerce/Plugin/Classes
|
20 |
* @author SkyVerge
|
21 |
+
* @copyright Copyright (c) 2013-2018, SkyVerge, Inc.
|
22 |
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
|
23 |
*/
|
24 |
|
25 |
+
namespace WC_Braintree\Plugin_Framework;
|
26 |
|
27 |
defined( 'ABSPATH' ) or exit;
|
28 |
|
29 |
+
if ( ! class_exists( '\\WC_Braintree\\Plugin_Framework\\SV_WC_Plugin' ) ) :
|
30 |
+
|
31 |
/**
|
32 |
* # WooCommerce Plugin Framework
|
33 |
*
|
36 |
* plugin. This class handles all the "non-feature" support tasks such
|
37 |
* as verifying dependencies are met, loading the text domain, etc.
|
38 |
*
|
39 |
+
* @version 5.3.0
|
40 |
*/
|
41 |
abstract class SV_WC_Plugin {
|
42 |
|
43 |
|
44 |
/** Plugin Framework Version */
|
45 |
+
const VERSION = '5.3.0';
|
46 |
|
47 |
/** @var object single instance of plugin */
|
48 |
protected static $instance;
|
62 |
/** @var \WC_Logger instance */
|
63 |
private $logger;
|
64 |
|
65 |
+
/** @var SV_WP_Admin_Message_Handler instance */
|
66 |
private $message_handler;
|
67 |
|
|
|
|
|
|
|
|
|
|
|
|
|
68 |
/** @var string the plugin text domain */
|
69 |
private $text_domain;
|
70 |
|
71 |
+
/** @var string the plugin dependencies */
|
72 |
+
private $dependencies;
|
73 |
+
|
74 |
+
/** @var SV_WC_Plugin_Dependencies dependency handler instance */
|
75 |
+
private $dependency_handler;
|
76 |
+
|
77 |
+
/** @var SV_WC_Hook_Deprecator hook deprecator instance */
|
78 |
+
private $hook_deprecator;
|
79 |
+
|
80 |
+
/** @var Plugin\Lifecycle lifecycle handler instance */
|
81 |
+
protected $lifecycle_handler;
|
82 |
+
|
83 |
+
/** @var REST_API REST API handler instance */
|
84 |
+
protected $rest_api_handler;
|
85 |
+
|
86 |
+
/** @var Admin\Setup_Wizard handler instance */
|
87 |
+
protected $setup_wizard_handler;
|
88 |
+
|
89 |
/** @var SV_WC_Admin_Notice_Handler the admin notice handler class */
|
90 |
private $admin_notice_handler;
|
91 |
|
96 |
* Child plugin classes may add their own optional arguments.
|
97 |
*
|
98 |
* @since 2.0.0
|
99 |
+
*
|
100 |
* @param string $id plugin id
|
101 |
* @param string $version plugin version number
|
102 |
* @param array $args {
|
104 |
*
|
105 |
* @type string $text_domain the plugin textdomain, used to set up translations
|
106 |
* @type array $dependencies {
|
107 |
+
* PHP extension, function, and settings dependencies
|
108 |
*
|
109 |
+
* @type array $php_extensions PHP extension dependencies
|
110 |
+
* @type array $php_functions PHP function dependencies
|
111 |
+
* @type array $php_settings PHP settings dependencies
|
|
|
|
|
112 |
* }
|
113 |
* }
|
114 |
*/
|
115 |
public function __construct( $id, $version, $args = array() ) {
|
116 |
|
117 |
// required params
|
118 |
+
$this->id = $id;
|
119 |
+
$this->version = $version;
|
120 |
|
121 |
+
$args = wp_parse_args( $args, array(
|
122 |
+
'text_domain' => '',
|
123 |
+
'dependencies' => array(),
|
124 |
+
) );
|
125 |
|
126 |
+
$this->text_domain = $args['text_domain'];
|
127 |
+
$this->dependencies = $args['dependencies'];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
128 |
|
129 |
// includes that are required to be available at all times
|
130 |
$this->includes();
|
131 |
|
132 |
+
// add the action & filter hooks
|
133 |
+
$this->add_hooks();
|
134 |
+
}
|
135 |
|
|
|
136 |
|
137 |
+
/**
|
138 |
+
* Include any critical files which must be available as early as possible,
|
139 |
+
*
|
140 |
+
* @since 2.0.0
|
141 |
+
*/
|
142 |
+
private function includes() {
|
143 |
|
144 |
+
$framework_path = $this->get_framework_path();
|
|
|
145 |
|
146 |
+
// common exception class
|
147 |
+
require_once( $framework_path . '/class-sv-wc-plugin-exception.php' );
|
|
|
148 |
|
149 |
+
// addresses
|
150 |
+
require_once( $framework_path . '/Addresses/Address.php' );
|
151 |
+
require_once( $framework_path . '/Addresses/Customer_Address.php' );
|
152 |
|
153 |
+
// common utility methods
|
154 |
+
require_once( $framework_path . '/class-sv-wc-helper.php' );
|
155 |
|
156 |
+
// backwards compatibility for older WC versions
|
157 |
+
require_once( $framework_path . '/class-sv-wc-plugin-compatibility.php' );
|
158 |
+
require_once( $framework_path . '/compatibility/abstract-sv-wc-data-compatibility.php' );
|
159 |
+
require_once( $framework_path . '/compatibility/class-sv-wc-order-compatibility.php' );
|
160 |
+
require_once( $framework_path . '/compatibility/class-sv-wc-product-compatibility.php' );
|
161 |
+
|
162 |
+
// TODO: Remove this when WC 3.x can be required {CW 2017-03-16}
|
163 |
+
require_once( $framework_path . '/compatibility/class-sv-wc-datetime.php' );
|
164 |
+
|
165 |
+
// generic API base
|
166 |
+
require_once( $framework_path . '/api/class-sv-wc-api-exception.php' );
|
167 |
+
require_once( $framework_path . '/api/class-sv-wc-api-base.php' );
|
168 |
+
require_once( $framework_path . '/api/interface-sv-wc-api-request.php' );
|
169 |
+
require_once( $framework_path . '/api/interface-sv-wc-api-response.php' );
|
170 |
+
|
171 |
+
// XML API base
|
172 |
+
require_once( $framework_path . '/api/abstract-sv-wc-api-xml-request.php' );
|
173 |
+
require_once( $framework_path . '/api/abstract-sv-wc-api-xml-response.php' );
|
174 |
+
|
175 |
+
// JSON API base
|
176 |
+
require_once( $framework_path . '/api/abstract-sv-wc-api-json-request.php' );
|
177 |
+
require_once( $framework_path . '/api/abstract-sv-wc-api-json-response.php' );
|
178 |
+
|
179 |
+
// Handlers
|
180 |
+
require_once( $framework_path . '/class-sv-wc-plugin-dependencies.php' );
|
181 |
+
require_once( $framework_path . '/class-sv-wc-hook-deprecator.php' );
|
182 |
+
require_once( $framework_path . '/class-sv-wp-admin-message-handler.php' );
|
183 |
+
require_once( $framework_path . '/class-sv-wc-admin-notice-handler.php' );
|
184 |
+
require_once( $framework_path . '/Lifecycle.php' );
|
185 |
+
require_once( $framework_path . '/rest-api/class-sv-wc-plugin-rest-api.php' );
|
186 |
+
}
|
187 |
|
|
|
|
|
188 |
|
189 |
+
/**
|
190 |
+
* Adds the action & filter hooks.
|
191 |
+
*
|
192 |
+
* @since 5.2.0
|
193 |
+
*/
|
194 |
+
private function add_hooks() {
|
195 |
+
|
196 |
+
// initialize the handlers
|
197 |
+
add_action( 'plugins_loaded', array( $this, 'init_handlers' ), 11 );
|
198 |
+
|
199 |
+
// initialize the plugin
|
200 |
+
add_action( 'plugins_loaded', array( $this, 'init_plugin' ), 15 );
|
201 |
+
|
202 |
+
// initialize the plugin admin
|
203 |
+
add_action( 'admin_init', array( $this, 'init_admin' ), 0 );
|
204 |
+
|
205 |
+
// hook for translations seperately to ensure they're loaded
|
206 |
add_action( 'init', array( $this, 'load_translations' ) );
|
207 |
|
208 |
+
// add the admin notices
|
209 |
+
add_action( 'admin_notices', array( $this, 'add_admin_notices' ) );
|
210 |
+
add_action( 'admin_footer', array( $this, 'add_delayed_admin_notices' ) );
|
211 |
+
|
212 |
+
// add a 'Configure' link to the plugin action links
|
213 |
+
add_filter( 'plugin_action_links_' . plugin_basename( $this->get_plugin_file() ), array( $this, 'plugin_action_links' ) );
|
214 |
+
|
215 |
+
// automatically log HTTP requests from SV_WC_API_Base
|
216 |
+
$this->add_api_request_logging();
|
217 |
+
|
218 |
// add any PHP incompatibilities to the system status report
|
219 |
if ( SV_WC_Plugin_Compatibility::is_wc_version_gte_3_0() ) {
|
220 |
add_filter( 'woocommerce_system_status_environment_rows', array( $this, 'add_system_status_php_information' ) );
|
224 |
}
|
225 |
|
226 |
|
227 |
+
/** Init methods **********************************************************/
|
228 |
+
|
229 |
+
|
230 |
/**
|
231 |
+
* Initializes the various handlers.
|
232 |
*
|
233 |
+
* @internal
|
234 |
+
*
|
235 |
+
* @since 5.3.0
|
236 |
*/
|
237 |
+
public function init_handlers() {
|
238 |
+
|
239 |
+
// initialize the dependencies manager
|
240 |
+
$this->init_dependencies( $this->dependencies );
|
241 |
+
|
242 |
+
// build the admin message handler instance
|
243 |
+
$this->init_admin_message_handler();
|
244 |
+
|
245 |
+
// build the admin notice handler instance
|
246 |
+
$this->init_admin_notice_handler();
|
247 |
+
|
248 |
+
// build the hook deprecator instance
|
249 |
+
$this->init_hook_deprecator();
|
250 |
+
|
251 |
+
// build the lifecycle handler instance
|
252 |
+
$this->init_lifecycle_handler();
|
253 |
+
|
254 |
+
// build the REST API handler instance
|
255 |
+
$this->init_rest_api_handler();
|
256 |
+
|
257 |
+
// build the setup handler instance
|
258 |
+
$this->init_setup_wizard_handler();
|
259 |
}
|
260 |
|
261 |
+
|
262 |
/**
|
263 |
+
* Initializes the plugin dependency handler.
|
264 |
*
|
265 |
+
* @since 5.2.0
|
266 |
+
*
|
267 |
+
* @param array $dependencies {
|
268 |
+
* PHP extension, function, and settings dependencies
|
269 |
+
*
|
270 |
+
* @type array $php_extensions PHP extension dependencies
|
271 |
+
* @type array $php_functions PHP function dependencies
|
272 |
+
* @type array $php_settings PHP settings dependencies
|
273 |
+
* }
|
274 |
*/
|
275 |
+
protected function init_dependencies( $dependencies ) {
|
276 |
+
|
277 |
+
$this->dependency_handler = new SV_WC_Plugin_Dependencies( $this, $dependencies );
|
278 |
}
|
279 |
|
280 |
|
281 |
/**
|
282 |
+
* Builds the admin message handler instance.
|
283 |
+
*
|
284 |
+
* Plugins can override this with their own handler.
|
285 |
+
*
|
286 |
+
* @since 5.2.0
|
287 |
+
*/
|
288 |
+
protected function init_admin_message_handler() {
|
289 |
+
|
290 |
+
$this->message_handler = new SV_WP_Admin_Message_Handler( $this->get_id() );
|
291 |
+
}
|
292 |
+
|
293 |
+
|
294 |
+
/**
|
295 |
+
* Builds the admin notice handler instance.
|
296 |
+
*
|
297 |
+
* Plugins can override this with their own handler.
|
298 |
+
*
|
299 |
+
* @since 5.2.0
|
300 |
+
*/
|
301 |
+
protected function init_admin_notice_handler() {
|
302 |
+
|
303 |
+
$this->admin_notice_handler = new SV_WC_Admin_Notice_Handler( $this );
|
304 |
+
}
|
305 |
+
|
306 |
+
|
307 |
+
/**
|
308 |
+
* Builds the hook deprecator instance.
|
309 |
+
*
|
310 |
+
* Plugins can override this with their own handler.
|
311 |
+
*
|
312 |
+
* @since 5.2.0
|
313 |
+
*/
|
314 |
+
protected function init_hook_deprecator() {
|
315 |
+
|
316 |
+
$this->hook_deprecator = new SV_WC_Hook_Deprecator( $this->get_plugin_name(), $this->get_deprecated_hooks() );
|
317 |
+
}
|
318 |
+
|
319 |
+
|
320 |
+
/**
|
321 |
+
* Builds the lifecycle handler instance.
|
322 |
+
*
|
323 |
+
* Plugins can override this with their own handler to perform install and
|
324 |
+
* upgrade routines.
|
325 |
+
*
|
326 |
+
* @since 5.2.0
|
327 |
+
*/
|
328 |
+
protected function init_lifecycle_handler() {
|
329 |
+
|
330 |
+
$this->lifecycle_handler = new Plugin\Lifecycle( $this );
|
331 |
+
}
|
332 |
+
|
333 |
+
|
334 |
+
/**
|
335 |
+
* Builds the REST API handler instance.
|
336 |
+
*
|
337 |
+
* Plugins can override this to add their own data and/or routes.
|
338 |
+
*
|
339 |
+
* @since 5.2.0
|
340 |
+
*/
|
341 |
+
protected function init_rest_api_handler() {
|
342 |
+
|
343 |
+
$this->rest_api_handler = new REST_API( $this );
|
344 |
+
}
|
345 |
+
|
346 |
+
|
347 |
+
/**
|
348 |
+
* Builds the Setup Wizard handler instance.
|
349 |
+
*
|
350 |
+
* Plugins can override and extend this method to add their own setup wizard.
|
351 |
+
*
|
352 |
+
* @since 5.3.0-dev
|
353 |
+
*/
|
354 |
+
protected function init_setup_wizard_handler() {
|
355 |
+
|
356 |
+
require_once( $this->get_framework_path() . '/admin/abstract-sv-wc-plugin-admin-setup-wizard.php' );
|
357 |
+
}
|
358 |
+
|
359 |
+
|
360 |
+
/**
|
361 |
+
* Initializes the plugin.
|
362 |
+
*
|
363 |
+
* Plugins can override this to set up any handlers after WordPress is ready.
|
364 |
+
*
|
365 |
+
* @since 5.2.0
|
366 |
+
*/
|
367 |
+
public function init_plugin() {
|
368 |
+
|
369 |
+
// stub
|
370 |
+
}
|
371 |
+
|
372 |
+
|
373 |
+
/**
|
374 |
+
* Initializes the plugin admin.
|
375 |
+
*
|
376 |
+
* Plugins can override this to set up any handlers after the WordPress
|
377 |
+
* admin is ready.
|
378 |
+
*
|
379 |
+
* @since 5.2.0
|
380 |
+
*/
|
381 |
+
public function init_admin() {
|
382 |
+
|
383 |
+
// stub
|
384 |
+
}
|
385 |
+
|
386 |
+
|
387 |
+
/**
|
388 |
+
* Load plugin & framework text domains.
|
389 |
+
*
|
390 |
+
* @internal
|
391 |
*
|
392 |
* @since 4.2.0
|
393 |
*/
|
397 |
|
398 |
// if this plugin passes along its text domain, load its translation files
|
399 |
if ( $this->text_domain ) {
|
|
|
400 |
$this->load_plugin_textdomain();
|
|
|
|
|
|
|
|
|
|
|
401 |
}
|
402 |
}
|
403 |
|
408 |
* @since 4.5.0
|
409 |
*/
|
410 |
protected function load_framework_textdomain() {
|
411 |
+
$this->load_textdomain( 'woocommerce-gateway-paypal-powered-by-braintree', dirname( plugin_basename( $this->get_framework_file() ) ) );
|
412 |
}
|
413 |
|
414 |
|
418 |
* @since 4.5.0
|
419 |
*/
|
420 |
protected function load_plugin_textdomain() {
|
421 |
+
$this->load_textdomain( $this->text_domain, dirname( plugin_basename( $this->get_plugin_file() ) ) );
|
422 |
}
|
423 |
|
424 |
|
431 |
*/
|
432 |
protected function load_textdomain( $textdomain, $path ) {
|
433 |
|
434 |
+
// user's locale if in the admin for WP 4.7+, or the site locale otherwise
|
435 |
+
$locale = is_admin() && is_callable( 'get_user_locale' ) ? get_user_locale() : get_locale();
|
436 |
+
|
437 |
+
$locale = apply_filters( 'plugin_locale', $locale, $textdomain );
|
438 |
|
439 |
load_textdomain( $textdomain, WP_LANG_DIR . '/' . $textdomain . '/' . $textdomain . '-' . $locale . '.mo' );
|
440 |
|
443 |
|
444 |
|
445 |
/**
|
446 |
+
* Cloning instances is forbidden due to singleton pattern.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
447 |
*
|
448 |
+
* @since 3.1.0
|
449 |
*/
|
450 |
+
public function __clone() {
|
451 |
+
/* translators: Placeholders: %s - plugin name */
|
452 |
+
_doing_it_wrong( __FUNCTION__, sprintf( esc_html__( 'You cannot clone instances of %s.', 'woocommerce-gateway-paypal-powered-by-braintree' ), esc_html( $this->get_plugin_name() ) ), '3.1.0' );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
453 |
}
|
454 |
|
455 |
|
456 |
/**
|
457 |
+
* Unserializing instances is forbidden due to singleton pattern.
|
458 |
*
|
459 |
+
* @since 3.1.0
|
460 |
*/
|
461 |
+
public function __wakeup() {
|
462 |
+
/* translators: Placeholders: %s - plugin name */
|
463 |
+
_doing_it_wrong( __FUNCTION__, sprintf( esc_html__( 'You cannot unserialize instances of %s.', 'woocommerce-gateway-paypal-powered-by-braintree' ), esc_html( $this->get_plugin_name() ) ), '3.1.0' );
|
|
|
|
|
464 |
}
|
465 |
|
466 |
|
509 |
*/
|
510 |
public function add_admin_notices() {
|
511 |
|
512 |
+
|
|
|
513 |
}
|
514 |
|
515 |
|
524 |
}
|
525 |
|
526 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
527 |
/**
|
528 |
* Return the plugin action links. This will only be called if the plugin
|
529 |
* is active.
|
552 |
$custom_actions['support'] = sprintf( '<a href="%s">%s</a>', $this->get_support_url(), esc_html_x( 'Support', 'noun', 'woocommerce-gateway-paypal-powered-by-braintree' ) );
|
553 |
}
|
554 |
|
555 |
+
// review url if any
|
556 |
+
if ( $this->get_reviews_url() ) {
|
557 |
+
$custom_actions['review'] = sprintf( '<a href="%s">%s</a>', $this->get_reviews_url(), esc_html_x( 'Review', 'verb', 'woocommerce-gateway-paypal-powered-by-braintree' ) );
|
558 |
+
}
|
559 |
+
|
560 |
// add the links to the front of the actions list
|
561 |
return array_merge( $custom_actions, $actions );
|
562 |
}
|
589 |
*/
|
590 |
public function log_api_request( $request, $response, $log_id = null ) {
|
591 |
|
592 |
+
$this->log( "Request\n" . $this->get_api_log_message( $request ), $log_id );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
593 |
|
594 |
+
if ( ! empty( $response ) ) {
|
595 |
+
$this->log( "Response\n" . $this->get_api_log_message( $response ), $log_id );
|
|
|
596 |
}
|
|
|
|
|
597 |
}
|
598 |
|
599 |
|
600 |
/**
|
601 |
+
* Transform the API request/response data into a string suitable for logging
|
602 |
*
|
603 |
+
* @since 2.2.0
|
604 |
+
* @param array $data
|
605 |
+
* @return string
|
606 |
*/
|
607 |
+
public function get_api_log_message( $data ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
608 |
|
609 |
+
$messages = array();
|
|
|
|
|
|
|
|
|
|
|
610 |
|
611 |
+
$messages[] = isset( $data['uri'] ) && $data['uri'] ? 'Request' : 'Response';
|
612 |
|
613 |
+
foreach ( (array) $data as $key => $value ) {
|
614 |
+
$messages[] = trim( sprintf( '%s: %s', $key, is_array( $value ) || ( is_object( $value ) && 'stdClass' == get_class( $value ) ) ? print_r( (array) $value, true ) : $value ) );
|
|
|
|
|
|
|
|
|
615 |
}
|
616 |
|
617 |
+
return implode( "\n", $messages ) . "\n";
|
618 |
}
|
619 |
|
620 |
|
622 |
* Adds any PHP incompatibilities to the system status report.
|
623 |
*
|
624 |
* @since 4.5.0
|
625 |
+
*
|
626 |
+
* @param array $rows WooCommerce system status rows
|
627 |
+
* @return array
|
628 |
*/
|
629 |
public function add_system_status_php_information( $rows ) {
|
630 |
|
631 |
+
foreach ( $this->get_dependency_handler()->get_incompatible_php_settings() as $setting => $values ) {
|
632 |
|
633 |
if ( isset( $values['type'] ) && 'min' === $values['type'] ) {
|
634 |
|
663 |
}
|
664 |
|
665 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
666 |
/**
|
667 |
* Saves errors or messages to WooCommerce Log (woocommerce/logs/plugin-id-xxx.txt)
|
668 |
*
|
703 |
/** Getter methods ******************************************************/
|
704 |
|
705 |
|
706 |
+
/**
|
707 |
+
* Gets the main plugin file.
|
708 |
+
*
|
709 |
+
* @since 5.0.0
|
710 |
+
*
|
711 |
+
* @return string
|
712 |
+
*/
|
713 |
+
public function get_plugin_file() {
|
714 |
+
|
715 |
+
$slug = dirname( plugin_basename( $this->get_file() ) );
|
716 |
+
|
717 |
+
return trailingslashit( $slug ) . $slug . '.php';
|
718 |
+
}
|
719 |
+
|
720 |
+
|
721 |
/**
|
722 |
* The implementation for this abstract method should simply be:
|
723 |
*
|
762 |
abstract public function get_plugin_name();
|
763 |
|
764 |
|
765 |
+
/** Handler methods *******************************************************/
|
766 |
+
|
767 |
+
|
768 |
/**
|
769 |
+
* Gets the dependency handler.
|
770 |
*
|
771 |
+
* @since 5.2.0.1
|
772 |
+
*
|
773 |
+
* @return SV_WC_Plugin_Dependencies
|
774 |
*/
|
775 |
+
public function get_dependency_handler() {
|
|
|
|
|
|
|
|
|
|
|
|
|
776 |
|
777 |
+
return $this->dependency_handler;
|
778 |
}
|
779 |
|
780 |
|
781 |
/**
|
782 |
+
* Gets the lifecycle handler instance.
|
783 |
*
|
784 |
+
* @since 5.1.0
|
785 |
+
*
|
786 |
+
* @return Plugin\Lifecycle
|
787 |
*/
|
788 |
+
public function get_lifecycle_handler() {
|
789 |
+
|
790 |
+
return $this->lifecycle_handler;
|
791 |
}
|
792 |
|
793 |
|
794 |
/**
|
795 |
+
* Gets the Setup Wizard handler instance.
|
796 |
*
|
797 |
+
* @since 5.3.0-dev
|
798 |
+
*
|
799 |
+
* @return null|Admin\Setup_Wizard
|
800 |
*/
|
801 |
+
public function get_setup_wizard_handler() {
|
802 |
+
|
803 |
+
return $this->setup_wizard_handler;
|
804 |
}
|
805 |
|
806 |
|
807 |
/**
|
808 |
+
* Gets the admin message handler.
|
809 |
*
|
810 |
* @since 2.0.0
|
811 |
+
*
|
812 |
+
* @return SV_WP_Admin_Message_Handler
|
813 |
*/
|
814 |
+
public function get_message_handler() {
|
815 |
+
|
816 |
+
return $this->message_handler;
|
817 |
}
|
818 |
|
819 |
|
820 |
/**
|
821 |
+
* Gets the admin notice handler instance.
|
822 |
*
|
823 |
+
* @since 3.0.0
|
824 |
+
*
|
825 |
+
* @return SV_WC_Admin_Notice_Handler
|
826 |
*/
|
827 |
+
public function get_admin_notice_handler() {
|
828 |
+
|
829 |
+
return $this->admin_notice_handler;
|
830 |
}
|
831 |
|
832 |
|
833 |
/**
|
834 |
+
* Returns the plugin version name. Defaults to wc_{plugin id}_version
|
835 |
*
|
836 |
+
* @since 2.0.0
|
837 |
+
* @return string the plugin version name
|
838 |
*/
|
839 |
+
public function get_plugin_version_name() {
|
840 |
+
|
841 |
+
return 'wc_' . $this->get_id() . '_version';
|
842 |
}
|
843 |
|
844 |
|
845 |
/**
|
846 |
+
* Returns the current version of the plugin
|
847 |
*
|
848 |
+
* @since 2.0.0
|
849 |
+
* @return string plugin version
|
850 |
*/
|
851 |
+
public function get_version() {
|
852 |
+
return $this->version;
|
853 |
}
|
854 |
|
855 |
|
902 |
*/
|
903 |
public function is_general_configuration_page() {
|
904 |
|
905 |
+
return isset( $_GET['page'] ) && 'wc-settings' === $_GET['page'] && ( ! isset( $_GET['tab'] ) || 'general' === $_GET['tab'] );
|
906 |
}
|
907 |
|
908 |
|
942 |
}
|
943 |
|
944 |
|
945 |
+
/**
|
946 |
+
* Gets the plugin sales page URL.
|
947 |
+
*
|
948 |
+
* @since 5.1.0
|
949 |
+
*
|
950 |
+
* @return string
|
951 |
+
*/
|
952 |
+
public function get_sales_page_url() {
|
953 |
+
|
954 |
+
return '';
|
955 |
+
}
|
956 |
+
|
957 |
+
|
958 |
+
/**
|
959 |
+
* Gets the plugin reviews page URL.
|
960 |
+
*
|
961 |
+
* Used for the 'Reviews' plugin action and review prompts.
|
962 |
+
*
|
963 |
+
* @since 5.1.0
|
964 |
+
*
|
965 |
+
* @return string
|
966 |
+
*/
|
967 |
+
public function get_reviews_url() {
|
968 |
+
|
969 |
+
return $this->get_sales_page_url() ? $this->get_sales_page_url() . '#comments' : '';
|
970 |
+
}
|
971 |
+
|
972 |
+
|
973 |
/**
|
974 |
* Returns the plugin's path without a trailing slash, i.e.
|
975 |
* /path/to/wp-content/plugins/plugin-directory
|
1067 |
}
|
1068 |
|
1069 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1070 |
/**
|
1071 |
* Helper function to determine whether a plugin is active
|
1072 |
*
|
1104 |
}
|
1105 |
|
1106 |
|
1107 |
+
/** Deprecated methods ****************************************************/
|
1108 |
|
1109 |
|
1110 |
/**
|
1111 |
+
* Handles version checking.
|
1112 |
*
|
1113 |
* @since 2.0.0
|
1114 |
+
* @deprecated 5.2.0
|
1115 |
*/
|
1116 |
public function do_install() {
|
1117 |
|
1118 |
+
SV_WC_Plugin_Compatibility::wc_deprecated_function( __METHOD__, '5.2.0', get_class( $this->get_lifecycle_handler() ) . '::init()' );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1119 |
|
1120 |
+
$this->get_lifecycle_handler()->init();
|
|
|
|
|
1121 |
}
|
1122 |
|
1123 |
|
1124 |
/**
|
1125 |
+
* Helper method to install default settings for a plugin.
|
1126 |
*
|
1127 |
* @since 4.2.0
|
1128 |
+
* @deprecated 5.2.0
|
1129 |
+
*
|
1130 |
* @param array $settings array of settings in format required by WC_Admin_Settings
|
1131 |
*/
|
1132 |
public function install_default_settings( array $settings ) {
|
1133 |
|
1134 |
+
SV_WC_Plugin_Compatibility::wc_deprecated_function( __METHOD__, '5.2.0', get_class( $this->get_lifecycle_handler() ) . '::install_default_settings()' );
|
1135 |
+
|
1136 |
+
$this->get_lifecycle_handler()->install_default_settings( $settings );
|
1137 |
+
}
|
1138 |
|
|
|
1139 |
|
1140 |
+
/**
|
1141 |
+
* Plugin activated method. Perform any activation tasks here.
|
1142 |
+
* Note that this _does not_ run during upgrades.
|
1143 |
+
*
|
1144 |
+
* @since 4.2.0
|
1145 |
+
* @deprecated 5.2.0
|
1146 |
+
*/
|
1147 |
+
public function activate() {
|
1148 |
+
|
1149 |
+
SV_WC_Plugin_Compatibility::wc_deprecated_function( __METHOD__, '5.2.0' );
|
1150 |
+
}
|
1151 |
+
|
1152 |
+
|
1153 |
+
/**
|
1154 |
+
* Plugin deactivation method. Perform any deactivation tasks here.
|
1155 |
+
*
|
1156 |
+
* @since 4.2.0
|
1157 |
+
* @deprecated 5.2.0
|
1158 |
+
*/
|
1159 |
+
public function deactivate() {
|
1160 |
+
|
1161 |
+
SV_WC_Plugin_Compatibility::wc_deprecated_function( __METHOD__, '5.2.0' );
|
1162 |
}
|
1163 |
|
1164 |
|
1165 |
/**
|
1166 |
+
* Gets the string name of any required PHP extensions that are not loaded.
|
1167 |
*
|
1168 |
+
* @since 4.5.0
|
1169 |
+
* @deprecated 5.2.0
|
1170 |
+
*
|
1171 |
+
* @return array
|
1172 |
*/
|
1173 |
+
public function get_missing_extension_dependencies() {
|
1174 |
+
|
1175 |
+
SV_WC_Plugin_Compatibility::wc_deprecated_function( __METHOD__, '5.2.0', get_class( $this->get_dependency_handler() ) . '::get_missing_php_extensions()' );
|
1176 |
+
|
1177 |
+
return $this->get_dependency_handler()->get_missing_php_extensions();
|
1178 |
+
}
|
1179 |
+
|
1180 |
+
|
1181 |
+
/**
|
1182 |
+
* Gets the string name of any required PHP functions that are not loaded.
|
1183 |
+
*
|
1184 |
+
* @since 2.1.0
|
1185 |
+
* @deprecated 5.2.0
|
1186 |
+
*
|
1187 |
+
* @return array
|
1188 |
+
*/
|
1189 |
+
public function get_missing_function_dependencies() {
|
1190 |
+
|
1191 |
+
SV_WC_Plugin_Compatibility::wc_deprecated_function( __METHOD__, '5.2.0', get_class( $this->get_dependency_handler() ) . '::get_missing_php_functions()' );
|
1192 |
+
|
1193 |
+
return $this->get_dependency_handler()->get_missing_php_functions();
|
1194 |
+
}
|
1195 |
+
|
1196 |
+
|
1197 |
+
/**
|
1198 |
+
* Gets the string name of any required PHP extensions that are not loaded.
|
1199 |
+
*
|
1200 |
+
* @since 4.5.0
|
1201 |
+
* @deprecated 5.2.0
|
1202 |
+
*
|
1203 |
+
* @return array
|
1204 |
+
*/
|
1205 |
+
public function get_incompatible_php_settings() {
|
1206 |
+
|
1207 |
+
SV_WC_Plugin_Compatibility::wc_deprecated_function( __METHOD__, '5.2.0', get_class( $this->get_dependency_handler() ) . '::get_incompatible_php_settings()' );
|
1208 |
+
|
1209 |
+
return $this->get_dependency_handler()->get_incompatible_php_settings();
|
1210 |
}
|
1211 |
|
1212 |
|
1213 |
/**
|
1214 |
+
* Gets the PHP dependencies.
|
1215 |
*
|
1216 |
* @since 2.0.0
|
1217 |
+
* @deprecated 5.2.0
|
1218 |
+
*
|
1219 |
+
* @return array
|
1220 |
*/
|
1221 |
+
protected function get_dependencies() {
|
1222 |
+
|
1223 |
+
SV_WC_Plugin_Compatibility::wc_deprecated_function( __METHOD__, '5.2.0' );
|
1224 |
+
|
1225 |
+
return array();
|
1226 |
}
|
1227 |
|
1228 |
|
1229 |
/**
|
1230 |
+
* Gets the PHP extension dependencies.
|
|
|
1231 |
*
|
1232 |
+
* @since 4.5.0
|
1233 |
+
* @deprecated 5.2.0
|
1234 |
+
*
|
1235 |
+
* @return array
|
1236 |
*/
|
1237 |
+
protected function get_extension_dependencies() {
|
1238 |
+
|
1239 |
+
SV_WC_Plugin_Compatibility::wc_deprecated_function( __METHOD__, '5.2.0', get_class( $this->get_dependency_handler() ) . '::get_php_extensions()' );
|
1240 |
+
|
1241 |
+
return $this->get_dependency_handler()->get_php_extensions();
|
1242 |
}
|
1243 |
|
1244 |
|
1245 |
/**
|
1246 |
+
* Gets the PHP function dependencies.
|
1247 |
*
|
1248 |
+
* @since 2.1.0
|
1249 |
+
* @deprecated 5.2.0
|
1250 |
+
*
|
1251 |
+
* @return array
|
1252 |
*/
|
1253 |
+
protected function get_function_dependencies() {
|
1254 |
+
|
1255 |
+
SV_WC_Plugin_Compatibility::wc_deprecated_function( __METHOD__, '5.2.0', get_class( $this->get_dependency_handler() ) . '::get_php_functions()' );
|
1256 |
+
|
1257 |
+
return $this->get_dependency_handler()->get_php_functions();
|
1258 |
+
}
|
1259 |
+
|
1260 |
+
|
1261 |
+
/**
|
1262 |
+
* Gets the PHP settings dependencies.
|
1263 |
+
*
|
1264 |
+
* @since 4.5.0
|
1265 |
+
* @deprecated 5.2.0
|
1266 |
+
*
|
1267 |
+
* @return array
|
1268 |
+
*/
|
1269 |
+
protected function get_php_settings_dependencies() {
|
1270 |
+
|
1271 |
+
SV_WC_Plugin_Compatibility::wc_deprecated_function( __METHOD__, '5.2.0', get_class( $this->get_dependency_handler() ) . '::get_php_settings()' );
|
1272 |
+
|
1273 |
+
return $this->get_dependency_handler()->get_php_settings();
|
1274 |
+
}
|
1275 |
+
|
1276 |
+
|
1277 |
+
/**
|
1278 |
+
* Sets the plugin dependencies.
|
1279 |
+
*
|
1280 |
+
* @since 4.5.0
|
1281 |
+
* @deprecated 5.2.0
|
1282 |
+
*
|
1283 |
+
* @param array $dependencies the environment dependencies
|
1284 |
+
*/
|
1285 |
+
protected function set_dependencies( $dependencies = array() ) {
|
1286 |
+
|
1287 |
+
SV_WC_Plugin_Compatibility::wc_deprecated_function( __METHOD__, '5.2.0' );
|
1288 |
}
|
1289 |
|
1290 |
|
1291 |
}
|
1292 |
+
|
1293 |
+
endif; // Class exists check
|
lib/skyverge/woocommerce/class-sv-wp-admin-message-handler.php
CHANGED
@@ -18,15 +18,15 @@
|
|
18 |
*
|
19 |
* @package SkyVerge/WordPress/WP-Admin-Message-Handler
|
20 |
* @author SkyVerge
|
21 |
-
* @copyright Copyright (c) 2013-
|
22 |
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
|
23 |
*/
|
24 |
|
25 |
-
namespace
|
26 |
|
27 |
defined( 'ABSPATH' ) or exit;
|
28 |
|
29 |
-
if ( ! class_exists( '
|
30 |
|
31 |
/**
|
32 |
* # WordPress Admin Message Handler Class
|
@@ -53,12 +53,14 @@ if ( ! class_exists( '\SkyVerge\Plugin_Framework\SV_WP_Admin_Message_Handler' )
|
|
53 |
*/
|
54 |
class SV_WP_Admin_Message_Handler {
|
55 |
|
|
|
56 |
/** transient message prefix */
|
57 |
const MESSAGE_TRANSIENT_PREFIX = '_wp_admin_message_';
|
58 |
|
59 |
/** the message id GET name */
|
60 |
const MESSAGE_ID_GET_NAME = 'wpamhid';
|
61 |
|
|
|
62 |
/** @var string unique message identifier, defaults to __FILE__ unless otherwise set */
|
63 |
private $message_id;
|
64 |
|
@@ -68,6 +70,12 @@ class SV_WP_Admin_Message_Handler {
|
|
68 |
/** @var array array of error messages */
|
69 |
private $errors = array();
|
70 |
|
|
|
|
|
|
|
|
|
|
|
|
|
71 |
|
72 |
/**
|
73 |
* Construct and initialize the admin message handler class
|
@@ -96,11 +104,16 @@ class SV_WP_Admin_Message_Handler {
|
|
96 |
public function set_messages() {
|
97 |
|
98 |
// any messages to persist?
|
99 |
-
if ( $this->message_count() > 0 || $this->error_count() > 0 ) {
|
100 |
|
101 |
set_transient(
|
102 |
self::MESSAGE_TRANSIENT_PREFIX . $this->get_message_id(),
|
103 |
-
array(
|
|
|
|
|
|
|
|
|
|
|
104 |
60 * 60
|
105 |
);
|
106 |
|
@@ -123,6 +136,8 @@ class SV_WP_Admin_Message_Handler {
|
|
123 |
$memo = get_transient( self::MESSAGE_TRANSIENT_PREFIX . $_GET[ self::MESSAGE_ID_GET_NAME ] );
|
124 |
|
125 |
if ( isset( $memo['errors'] ) ) $this->errors = $memo['errors'];
|
|
|
|
|
126 |
if ( isset( $memo['messages'] ) ) $this->messages = $memo['messages'];
|
127 |
|
128 |
$this->clear_messages( $_GET[ self::MESSAGE_ID_GET_NAME ] );
|
@@ -152,6 +167,30 @@ class SV_WP_Admin_Message_Handler {
|
|
152 |
}
|
153 |
|
154 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
155 |
/**
|
156 |
* Add a message.
|
157 |
*
|
@@ -174,6 +213,30 @@ class SV_WP_Admin_Message_Handler {
|
|
174 |
}
|
175 |
|
176 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
177 |
/**
|
178 |
* Get message count.
|
179 |
*
|
@@ -208,6 +271,56 @@ class SV_WP_Admin_Message_Handler {
|
|
208 |
}
|
209 |
|
210 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
211 |
/**
|
212 |
* Get messages
|
213 |
*
|
@@ -262,13 +375,25 @@ class SV_WP_Admin_Message_Handler {
|
|
262 |
return;
|
263 |
}
|
264 |
|
|
|
|
|
265 |
if ( $this->error_count() > 0 ) {
|
266 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
267 |
}
|
268 |
|
269 |
if ( $this->message_count() > 0 ) {
|
270 |
-
|
271 |
}
|
|
|
|
|
272 |
}
|
273 |
|
274 |
|
18 |
*
|
19 |
* @package SkyVerge/WordPress/WP-Admin-Message-Handler
|
20 |
* @author SkyVerge
|
21 |
+
* @copyright Copyright (c) 2013-2018, SkyVerge, Inc.
|
22 |
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
|
23 |
*/
|
24 |
|
25 |
+
namespace WC_Braintree\Plugin_Framework;
|
26 |
|
27 |
defined( 'ABSPATH' ) or exit;
|
28 |
|
29 |
+
if ( ! class_exists( '\\WC_Braintree\\Plugin_Framework\\SV_WP_Admin_Message_Handler' ) ) :
|
30 |
|
31 |
/**
|
32 |
* # WordPress Admin Message Handler Class
|
53 |
*/
|
54 |
class SV_WP_Admin_Message_Handler {
|
55 |
|
56 |
+
|
57 |
/** transient message prefix */
|
58 |
const MESSAGE_TRANSIENT_PREFIX = '_wp_admin_message_';
|
59 |
|
60 |
/** the message id GET name */
|
61 |
const MESSAGE_ID_GET_NAME = 'wpamhid';
|
62 |
|
63 |
+
|
64 |
/** @var string unique message identifier, defaults to __FILE__ unless otherwise set */
|
65 |
private $message_id;
|
66 |
|
70 |
/** @var array array of error messages */
|
71 |
private $errors = array();
|
72 |
|
73 |
+
/** @var array array of warning messages */
|
74 |
+
private $warnings = array();
|
75 |
+
|
76 |
+
/** @var array array of info messages */
|
77 |
+
private $infos = array();
|
78 |
+
|
79 |
|
80 |
/**
|
81 |
* Construct and initialize the admin message handler class
|
104 |
public function set_messages() {
|
105 |
|
106 |
// any messages to persist?
|
107 |
+
if ( $this->message_count() > 0 || $this->info_count() > 0 || $this->warning_count() > 0 || $this->error_count() > 0 ) {
|
108 |
|
109 |
set_transient(
|
110 |
self::MESSAGE_TRANSIENT_PREFIX . $this->get_message_id(),
|
111 |
+
array(
|
112 |
+
'errors' => $this->errors,
|
113 |
+
'warnings' => $this->warnings,
|
114 |
+
'infos' => $this->infos,
|
115 |
+
'messages' => $this->messages,
|
116 |
+
),
|
117 |
60 * 60
|
118 |
);
|
119 |
|
136 |
$memo = get_transient( self::MESSAGE_TRANSIENT_PREFIX . $_GET[ self::MESSAGE_ID_GET_NAME ] );
|
137 |
|
138 |
if ( isset( $memo['errors'] ) ) $this->errors = $memo['errors'];
|
139 |
+
if ( isset( $memo['warnings'] ) ) $this->warnings = $memo['warnings'];
|
140 |
+
if ( isset( $memo['infos'] ) ) $this->infos = $memo['infos'];
|
141 |
if ( isset( $memo['messages'] ) ) $this->messages = $memo['messages'];
|
142 |
|
143 |
$this->clear_messages( $_GET[ self::MESSAGE_ID_GET_NAME ] );
|
167 |
}
|
168 |
|
169 |
|
170 |
+
/**
|
171 |
+
* Adds a warning message.
|
172 |
+
*
|
173 |
+
* @since 5.1.0
|
174 |
+
*
|
175 |
+
* @param string $message warning message to add
|
176 |
+
*/
|
177 |
+
public function add_warning( $message ) {
|
178 |
+
$this->warnings[] = $message;
|
179 |
+
}
|
180 |
+
|
181 |
+
|
182 |
+
/**
|
183 |
+
* Adds a info message.
|
184 |
+
*
|
185 |
+
* @since 5.1.0
|
186 |
+
*
|
187 |
+
* @param string $message info message to add
|
188 |
+
*/
|
189 |
+
public function add_info( $message ) {
|
190 |
+
$this->infos[] = $message;
|
191 |
+
}
|
192 |
+
|
193 |
+
|
194 |
/**
|
195 |
* Add a message.
|
196 |
*
|
213 |
}
|
214 |
|
215 |
|
216 |
+
/**
|
217 |
+
* Gets the warning message count.
|
218 |
+
*
|
219 |
+
* @since 5.1.0
|
220 |
+
*
|
221 |
+
* @return int warning message count
|
222 |
+
*/
|
223 |
+
public function warning_count() {
|
224 |
+
return sizeof( $this->warnings );
|
225 |
+
}
|
226 |
+
|
227 |
+
|
228 |
+
/**
|
229 |
+
* Gets the info message count.
|
230 |
+
*
|
231 |
+
* @since 5.1.0
|
232 |
+
*
|
233 |
+
* @return int info message count
|
234 |
+
*/
|
235 |
+
public function info_count() {
|
236 |
+
return sizeof( $this->infos );
|
237 |
+
}
|
238 |
+
|
239 |
+
|
240 |
/**
|
241 |
* Get message count.
|
242 |
*
|
271 |
}
|
272 |
|
273 |
|
274 |
+
/**
|
275 |
+
* Gets all warning messages.
|
276 |
+
*
|
277 |
+
* @since 5.1.0
|
278 |
+
*
|
279 |
+
* @return array
|
280 |
+
*/
|
281 |
+
public function get_warnings() {
|
282 |
+
return $this->warnings;
|
283 |
+
}
|
284 |
+
|
285 |
+
|
286 |
+
/**
|
287 |
+
* Gets a specific warning message.
|
288 |
+
*
|
289 |
+
* @since 5.1.0
|
290 |
+
*
|
291 |
+
* @param int $index warning message index
|
292 |
+
* @return string
|
293 |
+
*/
|
294 |
+
public function get_warning( $index ) {
|
295 |
+
return isset( $this->warnings[ $index ] ) ? $this->warnings[ $index ] : '';
|
296 |
+
}
|
297 |
+
|
298 |
+
|
299 |
+
/**
|
300 |
+
* Gets all info messages.
|
301 |
+
*
|
302 |
+
* @since 5.1.0
|
303 |
+
*
|
304 |
+
* @return array
|
305 |
+
*/
|
306 |
+
public function get_infos() {
|
307 |
+
return $this->infos;
|
308 |
+
}
|
309 |
+
|
310 |
+
|
311 |
+
/**
|
312 |
+
* Gets a specific info message.
|
313 |
+
*
|
314 |
+
* @since 5.0.0
|
315 |
+
*
|
316 |
+
* @param int $index info message index
|
317 |
+
* @return string
|
318 |
+
*/
|
319 |
+
public function get_info( $index ) {
|
320 |
+
return isset( $this->infos[ $index ] ) ? $this->infos[ $index ] : '';
|
321 |
+
}
|
322 |
+
|
323 |
+
|
324 |
/**
|
325 |
* Get messages
|
326 |
*
|
375 |
return;
|
376 |
}
|
377 |
|
378 |
+
$output = '';
|
379 |
+
|
380 |
if ( $this->error_count() > 0 ) {
|
381 |
+
$output .= '<div id="wp-admin-message-handler-error" class="notice-error notice"><ul><li><strong>' . implode( '</strong></li><li><strong>', $this->get_errors() ) . '</strong></li></ul></div>';
|
382 |
+
}
|
383 |
+
|
384 |
+
if ( $this->warning_count() > 0 ) {
|
385 |
+
$output .= '<div id="wp-admin-message-handler-warning" class="notice-warning notice"><ul><li><strong>' . implode( '</strong></li><li><strong>', $this->get_warnings() ) . '</strong></li></ul></div>';
|
386 |
+
}
|
387 |
+
|
388 |
+
if ( $this->info_count() > 0 ) {
|
389 |
+
$output .= '<div id="wp-admin-message-handler-warning" class="notice-info notice"><ul><li><strong>' . implode( '</strong></li><li><strong>', $this->get_infos() ) . '</strong></li></ul></div>';
|
390 |
}
|
391 |
|
392 |
if ( $this->message_count() > 0 ) {
|
393 |
+
$output .= '<div id="wp-admin-message-handler-message" class="notice-success notice"><ul><li><strong>' . implode( '</strong></li><li><strong>', $this->get_messages() ) . '</strong></li></ul></div>';
|
394 |
}
|
395 |
+
|
396 |
+
echo wp_kses_post( $output );
|
397 |
}
|
398 |
|
399 |
|
lib/skyverge/woocommerce/compatibility/abstract-sv-wc-data-compatibility.php
CHANGED
@@ -18,15 +18,15 @@
|
|
18 |
*
|
19 |
* @package SkyVerge/WooCommerce/Compatibility
|
20 |
* @author SkyVerge
|
21 |
-
* @copyright Copyright (c) 2013-
|
22 |
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
|
23 |
*/
|
24 |
|
25 |
-
namespace
|
26 |
|
27 |
defined( 'ABSPATH' ) or exit;
|
28 |
|
29 |
-
if ( ! class_exists( '
|
30 |
|
31 |
/**
|
32 |
* WooCommerce data compatibility class.
|
18 |
*
|
19 |
* @package SkyVerge/WooCommerce/Compatibility
|
20 |
* @author SkyVerge
|
21 |
+
* @copyright Copyright (c) 2013-2018, SkyVerge, Inc.
|
22 |
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
|
23 |
*/
|
24 |
|
25 |
+
namespace WC_Braintree\Plugin_Framework;
|
26 |
|
27 |
defined( 'ABSPATH' ) or exit;
|
28 |
|
29 |
+
if ( ! class_exists( '\\WC_Braintree\\Plugin_Framework\\SV_WC_Data_Compatibility' ) ) :
|
30 |
|
31 |
/**
|
32 |
* WooCommerce data compatibility class.
|
lib/skyverge/woocommerce/compatibility/class-sv-wc-datetime.php
CHANGED
@@ -18,18 +18,18 @@
|
|
18 |
*
|
19 |
* @package SkyVerge/WooCommerce/Compatibility
|
20 |
* @author SkyVerge
|
21 |
-
* @copyright Copyright (c) 2013-
|
22 |
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
|
23 |
*/
|
24 |
|
25 |
-
namespace
|
26 |
|
27 |
defined( 'ABSPATH' ) or exit;
|
28 |
|
29 |
-
if ( ! class_exists( '
|
30 |
|
31 |
/**
|
32 |
-
* Backports the \WC_DateTime class to WooCommerce pre-3.0.
|
33 |
*
|
34 |
* TODO: Remove this when WC 3.x can be required {CW 2017-03-16}
|
35 |
*
|
18 |
*
|
19 |
* @package SkyVerge/WooCommerce/Compatibility
|
20 |
* @author SkyVerge
|
21 |
+
* @copyright Copyright (c) 2013-2018, SkyVerge, Inc.
|
22 |
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
|
23 |
*/
|
24 |
|
25 |
+
namespace WC_Braintree\Plugin_Framework;
|
26 |
|
27 |
defined( 'ABSPATH' ) or exit;
|
28 |
|
29 |
+
if ( ! class_exists( '\\WC_Braintree\\Plugin_Framework\\SV_WC_DateTime' ) ) :
|
30 |
|
31 |
/**
|
32 |
+
* Backports the \WC_DateTime class to WooCommerce pre-3.0.0
|
33 |
*
|
34 |
* TODO: Remove this when WC 3.x can be required {CW 2017-03-16}
|
35 |
*
|
lib/skyverge/woocommerce/compatibility/class-sv-wc-order-compatibility.php
CHANGED
@@ -18,15 +18,15 @@
|
|
18 |
*
|
19 |
* @package SkyVerge/WooCommerce/Compatibility
|
20 |
* @author SkyVerge
|
21 |
-
* @copyright Copyright (c) 2013-
|
22 |
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
|
23 |
*/
|
24 |
|
25 |
-
namespace
|
26 |
|
27 |
defined( 'ABSPATH' ) or exit;
|
28 |
|
29 |
-
if ( ! class_exists( '
|
30 |
|
31 |
/**
|
32 |
* WooCommerce order compatibility class.
|
@@ -78,7 +78,7 @@ class SV_WC_Order_Compatibility extends SV_WC_Data_Compatibility {
|
|
78 |
*
|
79 |
* @return \WC_DateTime|null
|
80 |
*/
|
81 |
-
public static function get_date_modified( WC_Order $order, $context = 'edit' ) {
|
82 |
|
83 |
return self::get_date_prop( $order, 'modified', $context );
|
84 |
}
|
@@ -131,6 +131,7 @@ class SV_WC_Order_Compatibility extends SV_WC_Data_Compatibility {
|
|
131 |
*/
|
132 |
public static function get_date_prop( \WC_Order $order, $type, $context = 'edit' ) {
|
133 |
|
|
|
134 |
$prop = "date_{$type}";
|
135 |
|
136 |
if ( SV_WC_Plugin_Compatibility::is_wc_version_gte_3_0() ) {
|
@@ -399,7 +400,7 @@ class SV_WC_Order_Compatibility extends SV_WC_Data_Compatibility {
|
|
399 |
|
400 |
} else {
|
401 |
|
402 |
-
// convert 3.0+ args for backwards compatibility
|
403 |
if ( isset( $args['discount'] ) ) {
|
404 |
$args['discount_amount'] = $args['discount'];
|
405 |
}
|
@@ -549,6 +550,24 @@ class SV_WC_Order_Compatibility extends SV_WC_Data_Compatibility {
|
|
549 |
}
|
550 |
|
551 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
552 |
}
|
553 |
|
554 |
|
18 |
*
|
19 |
* @package SkyVerge/WooCommerce/Compatibility
|
20 |
* @author SkyVerge
|
21 |
+
* @copyright Copyright (c) 2013-2018, SkyVerge, Inc.
|
22 |
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
|
23 |
*/
|
24 |
|
25 |
+
namespace WC_Braintree\Plugin_Framework;
|
26 |
|
27 |
defined( 'ABSPATH' ) or exit;
|
28 |
|
29 |
+
if ( ! class_exists( '\\WC_Braintree\\Plugin_Framework\\SV_WC_Order_Compatibility' ) ) :
|
30 |
|
31 |
/**
|
32 |
* WooCommerce order compatibility class.
|
78 |
*
|
79 |
* @return \WC_DateTime|null
|
80 |
*/
|
81 |
+
public static function get_date_modified( \WC_Order $order, $context = 'edit' ) {
|
82 |
|
83 |
return self::get_date_prop( $order, 'modified', $context );
|
84 |
}
|
131 |
*/
|
132 |
public static function get_date_prop( \WC_Order $order, $type, $context = 'edit' ) {
|
133 |
|
134 |
+
$date = null;
|
135 |
$prop = "date_{$type}";
|
136 |
|
137 |
if ( SV_WC_Plugin_Compatibility::is_wc_version_gte_3_0() ) {
|
400 |
|
401 |
} else {
|
402 |
|
403 |
+
// convert WC 3.0+ args for backwards compatibility
|
404 |
if ( isset( $args['discount'] ) ) {
|
405 |
$args['discount_amount'] = $args['discount'];
|
406 |
}
|
550 |
}
|
551 |
|
552 |
|
553 |
+
/**
|
554 |
+
* Gets the admin Edit screen URL for an order.
|
555 |
+
*
|
556 |
+
* @since 5.0.1
|
557 |
+
*
|
558 |
+
* @param \WC_Order $order order object
|
559 |
+
* @return string
|
560 |
+
*/
|
561 |
+
public static function get_edit_order_url( \WC_Order $order ) {
|
562 |
+
|
563 |
+
if ( self::is_wc_version_gte( '3.3' ) ) {
|
564 |
+
return $order->get_edit_order_url();
|
565 |
+
} else {
|
566 |
+
return apply_filters( 'woocommerce_get_edit_order_url', get_admin_url( null, 'post.php?post=' . self::get_prop( $order, 'id' ) . '&action=edit' ), $order );
|
567 |
+
}
|
568 |
+
}
|
569 |
+
|
570 |
+
|
571 |
}
|
572 |
|
573 |
|
lib/skyverge/woocommerce/compatibility/class-sv-wc-product-compatibility.php
CHANGED
@@ -18,15 +18,15 @@
|
|
18 |
*
|
19 |
* @package SkyVerge/WooCommerce/Compatibility
|
20 |
* @author SkyVerge
|
21 |
-
* @copyright Copyright (c) 2013-
|
22 |
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
|
23 |
*/
|
24 |
|
25 |
-
namespace
|
26 |
|
27 |
defined( 'ABSPATH' ) or exit;
|
28 |
|
29 |
-
if ( ! class_exists( '
|
30 |
|
31 |
/**
|
32 |
* WooCommerce product compatibility class.
|
@@ -50,6 +50,7 @@ class SV_WC_Product_Compatibility extends SV_WC_Data_Compatibility {
|
|
50 |
* Gets a product property.
|
51 |
*
|
52 |
* @since 4.6.0
|
|
|
53 |
* @param \WC_Product $object the product object
|
54 |
* @param string $prop the property name
|
55 |
* @param string $context if 'view' then the value will be filtered
|
@@ -73,6 +74,7 @@ class SV_WC_Product_Compatibility extends SV_WC_Data_Compatibility {
|
|
73 |
* Note that this does not save any data to the database.
|
74 |
*
|
75 |
* @since 4.6.0
|
|
|
76 |
* @param \WC_Product $object the product object
|
77 |
* @param array $props the new properties as $key => $value
|
78 |
* @return \WC_Product
|
@@ -87,6 +89,7 @@ class SV_WC_Product_Compatibility extends SV_WC_Data_Compatibility {
|
|
87 |
* Gets a product's parent product.
|
88 |
*
|
89 |
* @since 4.6.0
|
|
|
90 |
* @param \WC_Product $product the product object
|
91 |
* @return \WC_Product|bool
|
92 |
*/
|
@@ -106,6 +109,7 @@ class SV_WC_Product_Compatibility extends SV_WC_Data_Compatibility {
|
|
106 |
* Backports wc_update_product_stock() to pre-3.0.
|
107 |
*
|
108 |
* @since 4.6.0
|
|
|
109 |
* @param \WC_Product $product the product object
|
110 |
* @param int $amount Optional. The new stock quantity
|
111 |
* @param string $mode Optional. Can be set, add, or subtract
|
@@ -125,6 +129,7 @@ class SV_WC_Product_Compatibility extends SV_WC_Data_Compatibility {
|
|
125 |
* Backports wc_get_price_html_from_text() to pre-3.0.
|
126 |
*
|
127 |
* @since 4.6.0
|
|
|
128 |
* @param \WC_Product $product the product object
|
129 |
* @return string
|
130 |
*/
|
@@ -142,6 +147,7 @@ class SV_WC_Product_Compatibility extends SV_WC_Data_Compatibility {
|
|
142 |
* Backports wc_get_price_including_tax() to pre-3.0.
|
143 |
*
|
144 |
* @since 4.6.0
|
|
|
145 |
* @param \WC_Product $product the product object
|
146 |
* @param int $qty Optional. The quantity
|
147 |
* @param string $price Optional. The product price
|
@@ -167,6 +173,7 @@ class SV_WC_Product_Compatibility extends SV_WC_Data_Compatibility {
|
|
167 |
* Backports wc_get_price_excluding_tax() to pre-3.0.
|
168 |
*
|
169 |
* @since 4.6.0
|
|
|
170 |
* @param \WC_Product $product the product object
|
171 |
* @param int $qty Optional. The quantity
|
172 |
* @param string $price Optional. The product price
|
@@ -192,6 +199,7 @@ class SV_WC_Product_Compatibility extends SV_WC_Data_Compatibility {
|
|
192 |
* Backports wc_get_price_to_display() to pre-3.0.
|
193 |
*
|
194 |
* @since 4.6.0
|
|
|
195 |
* @param \WC_Product $product the product object
|
196 |
* @param string $price Optional. The product price
|
197 |
* @param int $qty Optional. The quantity
|
@@ -217,6 +225,7 @@ class SV_WC_Product_Compatibility extends SV_WC_Data_Compatibility {
|
|
217 |
* Backports wc_get_product_category_list() to pre-3.0.
|
218 |
*
|
219 |
* @since 4.6.0
|
|
|
220 |
* @param \WC_Product $product the product object
|
221 |
* @param string $sep Optional. The list separator
|
222 |
* @param string $before Optional. To display before the list
|
@@ -242,6 +251,7 @@ class SV_WC_Product_Compatibility extends SV_WC_Data_Compatibility {
|
|
242 |
* Backports wc_get_rating_html() to pre-3.0.
|
243 |
*
|
244 |
* @since 4.6.0
|
|
|
245 |
* @param \WC_Product $product the product object
|
246 |
* @param string $rating Optional. The product rating
|
247 |
* @return string
|
18 |
*
|
19 |
* @package SkyVerge/WooCommerce/Compatibility
|
20 |
* @author SkyVerge
|
21 |
+
* @copyright Copyright (c) 2013-2018, SkyVerge, Inc.
|
22 |
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
|
23 |
*/
|
24 |
|
25 |
+
namespace WC_Braintree\Plugin_Framework;
|
26 |
|
27 |
defined( 'ABSPATH' ) or exit;
|
28 |
|
29 |
+
if ( ! class_exists( '\\WC_Braintree\\Plugin_Framework\\SV_WC_Product_Compatibility' ) ) :
|
30 |
|
31 |
/**
|
32 |
* WooCommerce product compatibility class.
|
50 |
* Gets a product property.
|
51 |
*
|
52 |
* @since 4.6.0
|
53 |
+
*
|
54 |
* @param \WC_Product $object the product object
|
55 |
* @param string $prop the property name
|
56 |
* @param string $context if 'view' then the value will be filtered
|
74 |
* Note that this does not save any data to the database.
|
75 |
*
|
76 |
* @since 4.6.0
|
77 |
+
*
|
78 |
* @param \WC_Product $object the product object
|
79 |
* @param array $props the new properties as $key => $value
|
80 |
* @return \WC_Product
|
89 |
* Gets a product's parent product.
|
90 |
*
|
91 |
* @since 4.6.0
|
92 |
+
*
|
93 |
* @param \WC_Product $product the product object
|
94 |
* @return \WC_Product|bool
|
95 |
*/
|
109 |
* Backports wc_update_product_stock() to pre-3.0.
|
110 |
*
|
111 |
* @since 4.6.0
|
112 |
+
*
|
113 |
* @param \WC_Product $product the product object
|
114 |
* @param int $amount Optional. The new stock quantity
|
115 |
* @param string $mode Optional. Can be set, add, or subtract
|
129 |
* Backports wc_get_price_html_from_text() to pre-3.0.
|
130 |
*
|
131 |
* @since 4.6.0
|
132 |
+
*
|
133 |
* @param \WC_Product $product the product object
|
134 |
* @return string
|
135 |
*/
|
147 |
* Backports wc_get_price_including_tax() to pre-3.0.
|
148 |
*
|
149 |
* @since 4.6.0
|
150 |
+
*
|
151 |
* @param \WC_Product $product the product object
|
152 |
* @param int $qty Optional. The quantity
|
153 |
* @param string $price Optional. The product price
|
173 |
* Backports wc_get_price_excluding_tax() to pre-3.0.
|
174 |
*
|
175 |
* @since 4.6.0
|
176 |
+
*
|
177 |
* @param \WC_Product $product the product object
|
178 |
* @param int $qty Optional. The quantity
|
179 |
* @param string $price Optional. The product price
|
199 |
* Backports wc_get_price_to_display() to pre-3.0.
|
200 |
*
|
201 |
* @since 4.6.0
|
202 |
+
*
|
203 |
* @param \WC_Product $product the product object
|
204 |
* @param string $price Optional. The product price
|
205 |
* @param int $qty Optional. The quantity
|
225 |
* Backports wc_get_product_category_list() to pre-3.0.
|
226 |
*
|
227 |
* @since 4.6.0
|
228 |
+
*
|
229 |
* @param \WC_Product $product the product object
|
230 |
* @param string $sep Optional. The list separator
|
231 |
* @param string $before Optional. To display before the list
|
251 |
* Backports wc_get_rating_html() to pre-3.0.
|
252 |
*
|
253 |
* @since 4.6.0
|
254 |
+
*
|
255 |
* @param \WC_Product $product the product object
|
256 |
* @param string $rating Optional. The product rating
|
257 |
* @return string
|
lib/skyverge/woocommerce/i18n/languages/woocommerce-plugin-framework-et.mo
ADDED
Binary file
|
lib/skyverge/woocommerce/i18n/languages/woocommerce-plugin-framework-et.po
ADDED
@@ -0,0 +1,2082 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Copyright (C) 2015
|
2 |
+
# This file is distributed under the same license as the package.
|
3 |
+
# Translators:
|
4 |
+
# Illimar Tambek <illimar.tambek@gmail.com>, 2015
|
5 |
+
msgid ""
|
6 |
+
msgstr ""
|
7 |
+
"Project-Id-Version: WC Plugin Framework\n"
|
8 |
+
"Report-Msgid-Bugs-To: https://support.woocommerce.com/hc/\n"
|
9 |
+
"POT-Creation-Date: 2015-07-22 12:09:16+00:00\n"
|
10 |
+
"PO-Revision-Date: 2017-03-27 11:59-0700\n"
|
11 |
+
"Last-Translator: Illimar Tambek <illimar.tambek@gmail.com>\n"
|
12 |
+
"Language-Team: Estonian (http://www.transifex.com/projects/p/wc-plugin-"
|
13 |
+
"framework/language/et/)\n"
|
14 |
+
"Language: et\n"
|
15 |
+
"MIME-Version: 1.0\n"
|
16 |
+
"Content-Type: text/plain; charset=UTF-8\n"
|
17 |
+
"Content-Transfer-Encoding: 8bit\n"
|
18 |
+
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
19 |
+
"X-Generator: Poedit 1.8.11\n"
|
20 |
+
|
21 |
+
#: Lifecycle.php:354
|
22 |
+
msgid "Awesome"
|
23 |
+
msgstr ""
|
24 |
+
|
25 |
+
#: Lifecycle.php:355
|
26 |
+
msgid "Fantastic"
|
27 |
+
msgstr ""
|
28 |
+
|
29 |
+
#: Lifecycle.php:356
|
30 |
+
msgid "Cowabunga"
|
31 |
+
msgstr ""
|
32 |
+
|
33 |
+
#: Lifecycle.php:357
|
34 |
+
msgid "Congratulations"
|
35 |
+
msgstr ""
|
36 |
+
|
37 |
+
#: Lifecycle.php:358
|
38 |
+
msgid "Hot dog"
|
39 |
+
msgstr ""
|
40 |
+
|
41 |
+
#. translators: Placeholders: %1$s - plugin name, %2$s - <a> tag, %3$s - </a>
|
42 |
+
#. tag, %4$s - <a> tag, %5$s - </a> tag
|
43 |
+
#: Lifecycle.php:365
|
44 |
+
msgid ""
|
45 |
+
"Are you having a great experience with %1$s so far? Please consider "
|
46 |
+
"%2$sleaving a review%3$s! If things aren't going quite as expected, we're "
|
47 |
+
"happy to help -- please %4$sreach out to our support team%5$s."
|
48 |
+
msgstr ""
|
49 |
+
|
50 |
+
#: admin/abstract-sv-wc-plugin-admin-setup-wizard.php:183
|
51 |
+
msgid ""
|
52 |
+
"Thanks for installing %1$s! To get started, take a minute to %2$sread the "
|
53 |
+
"documentation%3$s :)"
|
54 |
+
msgstr ""
|
55 |
+
|
56 |
+
#: admin/abstract-sv-wc-plugin-admin-setup-wizard.php:211
|
57 |
+
msgid ""
|
58 |
+
"Thanks for installing %1$s! To get started, take a minute to complete these "
|
59 |
+
"%2$squick and easy setup steps%3$s :)"
|
60 |
+
msgstr ""
|
61 |
+
|
62 |
+
#: admin/abstract-sv-wc-plugin-admin-setup-wizard.php:236
|
63 |
+
msgid "Setup"
|
64 |
+
msgstr ""
|
65 |
+
|
66 |
+
#. translators: Placeholders: %s - plugin name
|
67 |
+
#: admin/abstract-sv-wc-plugin-admin-setup-wizard.php:304
|
68 |
+
msgid "%s › Setup"
|
69 |
+
msgstr ""
|
70 |
+
|
71 |
+
#: admin/abstract-sv-wc-plugin-admin-setup-wizard.php:352
|
72 |
+
#, fuzzy
|
73 |
+
msgid "Oops! An error occurred, please try again."
|
74 |
+
msgstr "Sinu päringuga esines viga, palun proovi uuesti."
|
75 |
+
|
76 |
+
#: admin/abstract-sv-wc-plugin-admin-setup-wizard.php:493
|
77 |
+
msgid "Done!"
|
78 |
+
msgstr ""
|
79 |
+
|
80 |
+
#. translators: Placeholder: %s - plugin name
|
81 |
+
#: admin/abstract-sv-wc-plugin-admin-setup-wizard.php:586
|
82 |
+
msgid "Welcome to %s!"
|
83 |
+
msgstr ""
|
84 |
+
|
85 |
+
#: admin/abstract-sv-wc-plugin-admin-setup-wizard.php:599
|
86 |
+
msgid ""
|
87 |
+
"This quick setup wizard will help you configure the basic settings and get "
|
88 |
+
"you started."
|
89 |
+
msgstr ""
|
90 |
+
|
91 |
+
#: admin/abstract-sv-wc-plugin-admin-setup-wizard.php:616
|
92 |
+
msgid "%s is ready!"
|
93 |
+
msgstr ""
|
94 |
+
|
95 |
+
#: admin/abstract-sv-wc-plugin-admin-setup-wizard.php:644
|
96 |
+
msgid "Next step"
|
97 |
+
msgstr ""
|
98 |
+
|
99 |
+
#: admin/abstract-sv-wc-plugin-admin-setup-wizard.php:668
|
100 |
+
msgid "You can also:"
|
101 |
+
msgstr ""
|
102 |
+
|
103 |
+
#: admin/abstract-sv-wc-plugin-admin-setup-wizard.php:712
|
104 |
+
#: admin/abstract-sv-wc-plugin-admin-setup-wizard.php:742
|
105 |
+
msgid "View the Docs"
|
106 |
+
msgstr ""
|
107 |
+
|
108 |
+
#: admin/abstract-sv-wc-plugin-admin-setup-wizard.php:713
|
109 |
+
msgid "See more setup options"
|
110 |
+
msgstr ""
|
111 |
+
|
112 |
+
#: admin/abstract-sv-wc-plugin-admin-setup-wizard.php:714
|
113 |
+
msgid "Learn more about customizing the plugin"
|
114 |
+
msgstr ""
|
115 |
+
|
116 |
+
#: admin/abstract-sv-wc-plugin-admin-setup-wizard.php:738
|
117 |
+
msgid "Review Your Settings"
|
118 |
+
msgstr ""
|
119 |
+
|
120 |
+
#: admin/abstract-sv-wc-plugin-admin-setup-wizard.php:746
|
121 |
+
msgid "Leave a Review"
|
122 |
+
msgstr ""
|
123 |
+
|
124 |
+
#: admin/abstract-sv-wc-plugin-admin-setup-wizard.php:770
|
125 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:651
|
126 |
+
msgid "Continue"
|
127 |
+
msgstr "Jätka"
|
128 |
+
|
129 |
+
#: admin/abstract-sv-wc-plugin-admin-setup-wizard.php:930
|
130 |
+
msgid "Return to the WordPress Dashboard"
|
131 |
+
msgstr ""
|
132 |
+
|
133 |
+
#: admin/abstract-sv-wc-plugin-admin-setup-wizard.php:932
|
134 |
+
msgid "Not right now"
|
135 |
+
msgstr ""
|
136 |
+
|
137 |
+
#: admin/abstract-sv-wc-plugin-admin-setup-wizard.php:934
|
138 |
+
msgid "Skip this step"
|
139 |
+
msgstr ""
|
140 |
+
|
141 |
+
#: class-sv-wc-framework-bootstrap.php:268
|
142 |
+
msgid ""
|
143 |
+
"The following plugin is disabled because it is out of date and incompatible "
|
144 |
+
"with newer plugins on your site:"
|
145 |
+
msgid_plural ""
|
146 |
+
"The following plugins are disabled because they are out of date and "
|
147 |
+
"incompatible with newer plugins on your site:"
|
148 |
+
msgstr[0] ""
|
149 |
+
msgstr[1] ""
|
150 |
+
|
151 |
+
#: class-sv-wc-framework-bootstrap.php:282
|
152 |
+
msgid ""
|
153 |
+
"To resolve this, please %1$supdate%2$s (recommended) %3$sor%4$s "
|
154 |
+
"%5$sdeactivate%6$s the above plugin, or %7$sdeactivate the following%8$s:"
|
155 |
+
msgid_plural ""
|
156 |
+
"To resolve this, please %1$supdate%2$s (recommended) %3$sor%4$s "
|
157 |
+
"%5$sdeactivate%6$s the above plugins, or %7$sdeactivate the following%8$s:"
|
158 |
+
msgstr[0] ""
|
159 |
+
msgstr[1] ""
|
160 |
+
|
161 |
+
#: class-sv-wc-framework-bootstrap.php:303
|
162 |
+
msgid ""
|
163 |
+
"The following plugins are inactive because they require a newer version of "
|
164 |
+
"WooCommerce:"
|
165 |
+
msgstr ""
|
166 |
+
"Järgnevad pluginad ei ole aktiivsed, kuna vajavad korrektselt töötamiseks "
|
167 |
+
"uuemat WooCommerce'i versiooni:"
|
168 |
+
|
169 |
+
#: class-sv-wc-framework-bootstrap.php:303
|
170 |
+
msgid ""
|
171 |
+
"The following plugin is inactive because it requires a newer version of "
|
172 |
+
"WooCommerce:"
|
173 |
+
msgstr ""
|
174 |
+
"Järgnev plugin ei ole aktiivne, kuna vajab korrektselt töötamiseks uuemat "
|
175 |
+
"WooCommerce'i versiooni:"
|
176 |
+
|
177 |
+
#. translators: Placeholders: %1$s - plugin name, %2$s - WooCommerce version
|
178 |
+
#. number
|
179 |
+
#: class-sv-wc-framework-bootstrap.php:308
|
180 |
+
msgid "%1$s requires WooCommerce %2$s or newer"
|
181 |
+
msgstr "%1$s vajab WooCommerce'i versiooni %2$s või uuemat"
|
182 |
+
|
183 |
+
#. translators: Placeholders: %1$s - <a> tag, %2$s - </a> tag
|
184 |
+
#: class-sv-wc-framework-bootstrap.php:312
|
185 |
+
msgid "Please %1$supdate WooCommerce%2$s"
|
186 |
+
msgstr "Palun %1$suuenda WooCommerce'i%2$s"
|
187 |
+
|
188 |
+
#: class-sv-wc-plugin-compatibility.php:278
|
189 |
+
msgid "WooCommerce"
|
190 |
+
msgstr ""
|
191 |
+
|
192 |
+
#. translators: Placeholders: %1$s - plugin name, %2$s - a PHP
|
193 |
+
#. extension/comma-separated list of PHP extensions
|
194 |
+
#: class-sv-wc-plugin-dependencies.php:148
|
195 |
+
msgid ""
|
196 |
+
"%1$s requires the %2$s PHP extension to function. Contact your host or "
|
197 |
+
"server administrator to install and configure the missing extension."
|
198 |
+
msgid_plural ""
|
199 |
+
"%1$s requires the following PHP extensions to function: %2$s. Contact your "
|
200 |
+
"host or server administrator to install and configure the missing extensions."
|
201 |
+
msgstr[0] ""
|
202 |
+
msgstr[1] ""
|
203 |
+
|
204 |
+
#. translators: Placeholders: %1$s - plugin name, %2$s - a PHP
|
205 |
+
#. function/comma-separated list of PHP functions
|
206 |
+
#: class-sv-wc-plugin-dependencies.php:176
|
207 |
+
msgid ""
|
208 |
+
"%1$s requires the %2$s PHP function to exist. Contact your host or server "
|
209 |
+
"administrator to install and configure the missing function."
|
210 |
+
msgid_plural ""
|
211 |
+
"%1$s requires the following PHP functions to exist: %2$s. Contact your host "
|
212 |
+
"or server administrator to install and configure the missing functions."
|
213 |
+
msgstr[0] ""
|
214 |
+
msgstr[1] ""
|
215 |
+
|
216 |
+
#. translators: Placeholders: %s - plugin name
|
217 |
+
#: class-sv-wc-plugin-dependencies.php:206
|
218 |
+
msgid ""
|
219 |
+
"%s may behave unexpectedly because the following PHP configuration settings "
|
220 |
+
"are required:"
|
221 |
+
msgstr ""
|
222 |
+
|
223 |
+
#: class-sv-wc-plugin-dependencies.php:220
|
224 |
+
msgid "%s or higher"
|
225 |
+
msgstr ""
|
226 |
+
|
227 |
+
#: class-sv-wc-plugin-dependencies.php:230
|
228 |
+
msgid ""
|
229 |
+
"Please contact your hosting provider or server administrator to configure "
|
230 |
+
"these settings."
|
231 |
+
msgstr ""
|
232 |
+
|
233 |
+
#. translators: Placeholders: %1$s - <strong>, %2$s - </strong>
|
234 |
+
#: class-sv-wc-plugin-dependencies.php:252
|
235 |
+
msgid ""
|
236 |
+
"Hey there! We've noticed that your server is running %1$san outdated version "
|
237 |
+
"of PHP%2$s, which is the programming language that WooCommerce and its "
|
238 |
+
"extensions are built on.\n"
|
239 |
+
"\t\t\t\t\tThe PHP version that is currently used for your site is no longer "
|
240 |
+
"maintained, nor %1$sreceives security updates%2$s; newer versions are faster "
|
241 |
+
"and more secure.\n"
|
242 |
+
"\t\t\t\t\tAs a result, %3$s no longer supports this version and you should "
|
243 |
+
"upgrade PHP as soon as possible.\n"
|
244 |
+
"\t\t\t\t\tYour hosting provider can do this for you. %4$sHere are some "
|
245 |
+
"resources to help you upgrade%5$s and to explain PHP versions further."
|
246 |
+
msgstr ""
|
247 |
+
|
248 |
+
#. translators: Placeholders: %1$s - WooCommerce version number, %2$s -
|
249 |
+
#. <strong>, %3$s - </strong>, %4$s - Plugin name, %5$s - <a> tag, %6$s - </a>
|
250 |
+
#. tag
|
251 |
+
#: class-sv-wc-plugin-dependencies.php:271
|
252 |
+
msgid ""
|
253 |
+
"Hey there! We've noticed that your site is running version %1$s of "
|
254 |
+
"WooCommerce, but %2$sWooCommerce 3.0 or higher will soon be required%3$s by "
|
255 |
+
"%4$s. We recommend you %5$supdate WooCommerce%6$s to the latest version as "
|
256 |
+
"soon as possible."
|
257 |
+
msgstr ""
|
258 |
+
|
259 |
+
#. translators: Placeholders: %s - plugin name
|
260 |
+
#: class-sv-wc-plugin.php:297
|
261 |
+
msgid "You cannot clone instances of %s."
|
262 |
+
msgstr "%s eksemplari ei saa kloonida."
|
263 |
+
|
264 |
+
#. translators: Placeholders: %s - plugin name
|
265 |
+
#: class-sv-wc-plugin.php:308
|
266 |
+
msgid "You cannot unserialize instances of %s."
|
267 |
+
msgstr "%s eksemplari ei saa deserialiseerida (unserialize)."
|
268 |
+
|
269 |
+
#. translators: Docs as in Documentation
|
270 |
+
#: class-sv-wc-plugin.php:525
|
271 |
+
msgid "Docs"
|
272 |
+
msgstr "Dokumentatsioon"
|
273 |
+
|
274 |
+
#: class-sv-wc-plugin.php:618
|
275 |
+
msgid "%1$s - A minimum of %2$s is required."
|
276 |
+
msgstr ""
|
277 |
+
|
278 |
+
#: class-sv-wc-plugin.php:627
|
279 |
+
msgid "Set as %1$s - %2$s is required."
|
280 |
+
msgstr ""
|
281 |
+
|
282 |
+
#: class-sv-wc-plugin.php:850
|
283 |
+
msgid "Configure"
|
284 |
+
msgstr "Seadista"
|
285 |
+
|
286 |
+
#: payment-gateway/admin/class-sv-wc-payment-gateway-admin-order.php:98
|
287 |
+
#, fuzzy
|
288 |
+
msgid ""
|
289 |
+
"Are you sure you wish to process this capture? The action cannot be undone."
|
290 |
+
msgstr ""
|
291 |
+
"Oled kindel, et soovid seda teha? Muudatust ei rakendata enne kui klikid "
|
292 |
+
"\"Uuenda\""
|
293 |
+
|
294 |
+
#: payment-gateway/admin/class-sv-wc-payment-gateway-admin-order.php:101
|
295 |
+
msgid ""
|
296 |
+
"Something went wrong, and the capture could no be completed. Please try "
|
297 |
+
"again."
|
298 |
+
msgstr ""
|
299 |
+
|
300 |
+
#. translators: verb, as in "Capture credit card charge". Used when an
|
301 |
+
#. amount has been pre-authorized before, but funds have not yet been captured
|
302 |
+
#. (taken) from the card. Capturing the charge will take the money from the
|
303 |
+
#. credit card and put it in the merchant's pockets.
|
304 |
+
#: payment-gateway/admin/class-sv-wc-payment-gateway-admin-order.php:146
|
305 |
+
#: payment-gateway/admin/class-sv-wc-payment-gateway-admin-order.php:219
|
306 |
+
#: payment-gateway/admin/class-sv-wc-payment-gateway-admin-order.php:281
|
307 |
+
msgid "Capture Charge"
|
308 |
+
msgstr "Teosta makse"
|
309 |
+
|
310 |
+
#: payment-gateway/admin/class-sv-wc-payment-gateway-admin-order.php:271
|
311 |
+
msgid "This charge has been fully captured."
|
312 |
+
msgstr ""
|
313 |
+
|
314 |
+
#: payment-gateway/admin/class-sv-wc-payment-gateway-admin-order.php:273
|
315 |
+
msgid "This charge can no longer be captured."
|
316 |
+
msgstr ""
|
317 |
+
|
318 |
+
#: payment-gateway/admin/class-sv-wc-payment-gateway-admin-order.php:275
|
319 |
+
msgid "This charge cannot be captured."
|
320 |
+
msgstr ""
|
321 |
+
|
322 |
+
#: payment-gateway/admin/class-sv-wc-payment-gateway-admin-payment-token-editor.php:89
|
323 |
+
msgid "Are you sure you want to remove this token?"
|
324 |
+
msgstr ""
|
325 |
+
|
326 |
+
#: payment-gateway/admin/class-sv-wc-payment-gateway-admin-payment-token-editor.php:99
|
327 |
+
msgid "Invalid token data"
|
328 |
+
msgstr ""
|
329 |
+
|
330 |
+
#: payment-gateway/admin/class-sv-wc-payment-gateway-admin-payment-token-editor.php:103
|
331 |
+
#, fuzzy
|
332 |
+
msgid "An error occurred. Please try again."
|
333 |
+
msgstr "Sinu päringuga esines viga, palun proovi uuesti."
|
334 |
+
|
335 |
+
#: payment-gateway/admin/class-sv-wc-payment-gateway-admin-payment-token-editor.php:451
|
336 |
+
#: payment-gateway/admin/class-sv-wc-payment-gateway-admin-user-handler.php:302
|
337 |
+
msgid "(%s)"
|
338 |
+
msgstr ""
|
339 |
+
|
340 |
+
#: payment-gateway/admin/class-sv-wc-payment-gateway-admin-payment-token-editor.php:480
|
341 |
+
#: payment-gateway/class-sv-wc-payment-gateway-my-payment-methods.php:650
|
342 |
+
msgid "Default"
|
343 |
+
msgstr ""
|
344 |
+
|
345 |
+
#: payment-gateway/admin/class-sv-wc-payment-gateway-admin-payment-token-editor.php:515
|
346 |
+
#: payment-gateway/admin/class-sv-wc-payment-gateway-admin-payment-token-editor.php:548
|
347 |
+
msgid "Token ID"
|
348 |
+
msgstr ""
|
349 |
+
|
350 |
+
#: payment-gateway/admin/class-sv-wc-payment-gateway-admin-payment-token-editor.php:520
|
351 |
+
#: payment-gateway/class-sv-wc-payment-gateway-privacy.php:299
|
352 |
+
msgid "Card Type"
|
353 |
+
msgstr "Kaardi tüüp"
|
354 |
+
|
355 |
+
#: payment-gateway/admin/class-sv-wc-payment-gateway-admin-payment-token-editor.php:525
|
356 |
+
#: payment-gateway/admin/class-sv-wc-payment-gateway-admin-payment-token-editor.php:561
|
357 |
+
#: payment-gateway/class-sv-wc-payment-gateway-privacy.php:191
|
358 |
+
#: payment-gateway/class-sv-wc-payment-gateway-privacy.php:297
|
359 |
+
msgid "Last Four"
|
360 |
+
msgstr "Viimased 4 numbrit"
|
361 |
+
|
362 |
+
#: payment-gateway/admin/class-sv-wc-payment-gateway-admin-payment-token-editor.php:532
|
363 |
+
#: payment-gateway/class-sv-wc-payment-gateway-payment-form.php:313
|
364 |
+
msgid "Expiration (MM/YY)"
|
365 |
+
msgstr "Aegub (KK/AA)"
|
366 |
+
|
367 |
+
#. translators: e-check account type, HTML form field label
|
368 |
+
#: payment-gateway/admin/class-sv-wc-payment-gateway-admin-payment-token-editor.php:553
|
369 |
+
#: payment-gateway/class-sv-wc-payment-gateway-payment-form.php:419
|
370 |
+
#: payment-gateway/class-sv-wc-payment-gateway-privacy.php:298
|
371 |
+
msgid "Account Type"
|
372 |
+
msgstr "Konto tüüp"
|
373 |
+
|
374 |
+
#: payment-gateway/admin/class-sv-wc-payment-gateway-admin-payment-token-editor.php:556
|
375 |
+
msgid "Checking"
|
376 |
+
msgstr ""
|
377 |
+
|
378 |
+
#: payment-gateway/admin/class-sv-wc-payment-gateway-admin-payment-token-editor.php:557
|
379 |
+
msgid "Savings"
|
380 |
+
msgstr ""
|
381 |
+
|
382 |
+
#: payment-gateway/admin/class-sv-wc-payment-gateway-admin-payment-token-editor.php:657
|
383 |
+
msgid "Refresh"
|
384 |
+
msgstr ""
|
385 |
+
|
386 |
+
#: payment-gateway/admin/class-sv-wc-payment-gateway-admin-payment-token-editor.php:659
|
387 |
+
msgid "Add New"
|
388 |
+
msgstr ""
|
389 |
+
|
390 |
+
#: payment-gateway/admin/class-sv-wc-payment-gateway-admin-payment-token-editor.php:662
|
391 |
+
#: payment-gateway/class-sv-wc-payment-gateway-my-payment-methods.php:745
|
392 |
+
msgid "Save"
|
393 |
+
msgstr ""
|
394 |
+
|
395 |
+
#: payment-gateway/admin/class-sv-wc-payment-gateway-admin-payment-token-editor.php:684
|
396 |
+
msgid "Remove"
|
397 |
+
msgstr ""
|
398 |
+
|
399 |
+
#: payment-gateway/admin/class-sv-wc-payment-gateway-admin-user-handler.php:221
|
400 |
+
#: payment-gateway/class-sv-wc-payment-gateway-privacy.php:208
|
401 |
+
msgid "%s Payment Tokens"
|
402 |
+
msgstr "%s maksevahendid"
|
403 |
+
|
404 |
+
#: payment-gateway/admin/class-sv-wc-payment-gateway-admin-user-handler.php:299
|
405 |
+
#: payment-gateway/integrations/class-sv-wc-payment-gateway-integration-subscriptions.php:660
|
406 |
+
msgid "Customer ID"
|
407 |
+
msgstr "Kliendi ID"
|
408 |
+
|
409 |
+
#: payment-gateway/admin/views/html-admin-gateway-status.php:32
|
410 |
+
msgid "This section contains configuration settings for this gateway."
|
411 |
+
msgstr ""
|
412 |
+
|
413 |
+
#. translators: environment as in a software environment (test/production)
|
414 |
+
#: payment-gateway/admin/views/html-admin-gateway-status.php:52
|
415 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:1256
|
416 |
+
msgid "Environment"
|
417 |
+
msgstr "Keskkond"
|
418 |
+
|
419 |
+
#: payment-gateway/admin/views/html-admin-gateway-status.php:53
|
420 |
+
msgid "The transaction environment for this gateway."
|
421 |
+
msgstr ""
|
422 |
+
|
423 |
+
#: payment-gateway/admin/views/html-admin-gateway-status.php:60
|
424 |
+
msgid "Tokenization Enabled"
|
425 |
+
msgstr ""
|
426 |
+
|
427 |
+
#: payment-gateway/admin/views/html-admin-gateway-status.php:61
|
428 |
+
msgid "Displays whether or not tokenization is enabled for this gateway."
|
429 |
+
msgstr ""
|
430 |
+
|
431 |
+
#: payment-gateway/admin/views/html-admin-gateway-status.php:74
|
432 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:1186
|
433 |
+
msgid "Debug Mode"
|
434 |
+
msgstr "Veaotsingu režiim"
|
435 |
+
|
436 |
+
#: payment-gateway/admin/views/html-admin-gateway-status.php:75
|
437 |
+
msgid "Displays whether or not debug logging is enabled for this gateway."
|
438 |
+
msgstr ""
|
439 |
+
|
440 |
+
#: payment-gateway/admin/views/html-admin-gateway-status.php:78
|
441 |
+
msgid "Display at Checkout & Log"
|
442 |
+
msgstr ""
|
443 |
+
|
444 |
+
#: payment-gateway/admin/views/html-admin-gateway-status.php:80
|
445 |
+
msgid "Display at Checkout"
|
446 |
+
msgstr ""
|
447 |
+
|
448 |
+
#: payment-gateway/admin/views/html-admin-gateway-status.php:82
|
449 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:1194
|
450 |
+
msgid "Save to Log"
|
451 |
+
msgstr "Salvesta logifaili"
|
452 |
+
|
453 |
+
#: payment-gateway/admin/views/html-admin-gateway-status.php:84
|
454 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:1192
|
455 |
+
msgid "Off"
|
456 |
+
msgstr "Välja lülitatud"
|
457 |
+
|
458 |
+
#: payment-gateway/admin/views/html-order-partial-capture.php:30
|
459 |
+
#, fuzzy
|
460 |
+
msgid "Authorization total"
|
461 |
+
msgstr "Autoriseerimine"
|
462 |
+
|
463 |
+
#: payment-gateway/admin/views/html-order-partial-capture.php:34
|
464 |
+
msgid "Amount already captured"
|
465 |
+
msgstr ""
|
466 |
+
|
467 |
+
#: payment-gateway/admin/views/html-order-partial-capture.php:40
|
468 |
+
msgid "Remaining order total"
|
469 |
+
msgstr ""
|
470 |
+
|
471 |
+
#: payment-gateway/admin/views/html-order-partial-capture.php:46
|
472 |
+
#, fuzzy
|
473 |
+
msgid "Capture amount"
|
474 |
+
msgstr "Teosta makse"
|
475 |
+
|
476 |
+
#: payment-gateway/admin/views/html-order-partial-capture.php:53
|
477 |
+
msgid "Comment (optional):"
|
478 |
+
msgstr ""
|
479 |
+
|
480 |
+
#: payment-gateway/admin/views/html-order-partial-capture.php:65
|
481 |
+
#, fuzzy
|
482 |
+
msgid "Capture %s"
|
483 |
+
msgstr "Teosta makse"
|
484 |
+
|
485 |
+
#: payment-gateway/admin/views/html-order-partial-capture.php:66
|
486 |
+
#: payment-gateway/class-sv-wc-payment-gateway-my-payment-methods.php:225
|
487 |
+
#, fuzzy
|
488 |
+
msgid "Cancel"
|
489 |
+
msgstr "Tühista tellimus"
|
490 |
+
|
491 |
+
#: payment-gateway/admin/views/html-user-payment-token-editor-token.php:48
|
492 |
+
msgid "-- Select an option --"
|
493 |
+
msgstr ""
|
494 |
+
|
495 |
+
#: payment-gateway/admin/views/html-user-payment-token-editor.php:59
|
496 |
+
msgid "No saved payment tokens"
|
497 |
+
msgstr ""
|
498 |
+
|
499 |
+
#: payment-gateway/admin/views/html-user-profile-field-customer-id.php:30
|
500 |
+
msgid "The gateway customer ID for the user. Only edit this if necessary."
|
501 |
+
msgstr ""
|
502 |
+
"Kasutajale makseviisi poolt määratud kliendi tunnus. Muuda seda ainult siis, "
|
503 |
+
"kui tõesti vajalik."
|
504 |
+
|
505 |
+
#: payment-gateway/api/class-sv-wc-payment-gateway-api-response-message-helper.php:97
|
506 |
+
#: payment-gateway/apple-pay/class-sv-wc-payment-gateway-apple-pay-frontend.php:131
|
507 |
+
msgid "An error occurred, please try again or try an alternate form of payment"
|
508 |
+
msgstr "Esines viga, palun proovi uuesti või kasuta teistsugust makseviisi"
|
509 |
+
|
510 |
+
#: payment-gateway/api/class-sv-wc-payment-gateway-api-response-message-helper.php:98
|
511 |
+
msgid ""
|
512 |
+
"We cannot process your order with the payment information that you provided. "
|
513 |
+
"Please use a different payment account or an alternate payment method."
|
514 |
+
msgstr ""
|
515 |
+
"Me ei saa sinu tellimust antud makseinfo alusel töödelda. Palun kasuta teist "
|
516 |
+
"maksekontot või teistsugust makseviisi."
|
517 |
+
|
518 |
+
#: payment-gateway/api/class-sv-wc-payment-gateway-api-response-message-helper.php:99
|
519 |
+
msgid ""
|
520 |
+
"This order is being placed on hold for review. Please contact us to complete "
|
521 |
+
"the transaction."
|
522 |
+
msgstr ""
|
523 |
+
"Tellimus on pandud ülevaatuseks ootele. Tehingu sooritamiseks võta palun "
|
524 |
+
"meiega ühendust."
|
525 |
+
|
526 |
+
#: payment-gateway/api/class-sv-wc-payment-gateway-api-response-message-helper.php:104
|
527 |
+
msgid ""
|
528 |
+
"This order is being placed on hold for review due to an incorrect card "
|
529 |
+
"verification number. You may contact the store to complete the transaction."
|
530 |
+
msgstr ""
|
531 |
+
"Tellimus pandi ootele, kuna kaardi turvakood oli vale. Tehingu "
|
532 |
+
"lõpuleviimiseks võid poega ühendust võtta."
|
533 |
+
|
534 |
+
#: payment-gateway/api/class-sv-wc-payment-gateway-api-response-message-helper.php:105
|
535 |
+
msgid "The card verification number is invalid, please try again."
|
536 |
+
msgstr "Kaardi turvakood on vale, palun proovi uuesti."
|
537 |
+
|
538 |
+
#: payment-gateway/api/class-sv-wc-payment-gateway-api-response-message-helper.php:106
|
539 |
+
msgid "Please enter your card verification number and try again."
|
540 |
+
msgstr "Palun sisesta oma kaardi turvakood ja proovi uuesti."
|
541 |
+
|
542 |
+
#: payment-gateway/api/class-sv-wc-payment-gateway-api-response-message-helper.php:109
|
543 |
+
msgid ""
|
544 |
+
"That card type is not accepted, please use an alternate card or other form "
|
545 |
+
"of payment."
|
546 |
+
msgstr ""
|
547 |
+
"Sellist tüüpi kaarti ei võeta vastu, palun proovi mõnda teist kaarti või "
|
548 |
+
"teistsugust makseviisi."
|
549 |
+
|
550 |
+
#: payment-gateway/api/class-sv-wc-payment-gateway-api-response-message-helper.php:110
|
551 |
+
#: payment-gateway/api/class-sv-wc-payment-gateway-api-response-message-helper.php:114
|
552 |
+
msgid ""
|
553 |
+
"The card type is invalid or does not correlate with the credit card number. "
|
554 |
+
"Please try again or use an alternate card or other form of payment."
|
555 |
+
msgstr ""
|
556 |
+
"Kaardi tüüp on vigane või ei vasta kaardi numbrile. Palun proovi uuesti, "
|
557 |
+
"proovi mõnda teist kaarti või teistsugust makseviisi."
|
558 |
+
|
559 |
+
#: payment-gateway/api/class-sv-wc-payment-gateway-api-response-message-helper.php:111
|
560 |
+
msgid "Please select the card type and try again."
|
561 |
+
msgstr "Palun vali kaardi tüüp ja proovi uuesti."
|
562 |
+
|
563 |
+
#: payment-gateway/api/class-sv-wc-payment-gateway-api-response-message-helper.php:115
|
564 |
+
msgid "The card number is invalid, please re-enter and try again."
|
565 |
+
msgstr "Kaardi number on vigane, palun sisesta uuesti ja proovi veelkord."
|
566 |
+
|
567 |
+
#: payment-gateway/api/class-sv-wc-payment-gateway-api-response-message-helper.php:116
|
568 |
+
msgid "Please enter your card number and try again."
|
569 |
+
msgstr "Palun sisesta oma kaardi number ja proovi uuesti."
|
570 |
+
|
571 |
+
#: payment-gateway/api/class-sv-wc-payment-gateway-api-response-message-helper.php:119
|
572 |
+
msgid "The card expiration date is invalid, please re-enter and try again."
|
573 |
+
msgstr ""
|
574 |
+
"Kaardi aegumiskuupäev on vale, palun sisesta uuesti ja proovi veelkord."
|
575 |
+
|
576 |
+
#: payment-gateway/api/class-sv-wc-payment-gateway-api-response-message-helper.php:120
|
577 |
+
msgid "The card expiration month is invalid, please re-enter and try again."
|
578 |
+
msgstr "Kaardi aegumise kuu on vale, palun sisesta uuesti ja proovi veelkord."
|
579 |
+
|
580 |
+
#: payment-gateway/api/class-sv-wc-payment-gateway-api-response-message-helper.php:121
|
581 |
+
msgid "The card expiration year is invalid, please re-enter and try again."
|
582 |
+
msgstr ""
|
583 |
+
"Kaardi aegumise aasta on vale, palun sisesta uuesti ja proovi veelkord."
|
584 |
+
|
585 |
+
#: payment-gateway/api/class-sv-wc-payment-gateway-api-response-message-helper.php:122
|
586 |
+
msgid "Please enter your card expiration date and try again."
|
587 |
+
msgstr "Palun sisesta oma kaardi aegumiskuupäev ja proovi uuesti."
|
588 |
+
|
589 |
+
#: payment-gateway/api/class-sv-wc-payment-gateway-api-response-message-helper.php:125
|
590 |
+
msgid "The bank routing number is invalid, please re-enter and try again."
|
591 |
+
msgstr ""
|
592 |
+
"Panga suunakood ei ole korrektne, palun sisesta uuesti ja proovi veelkord."
|
593 |
+
|
594 |
+
#: payment-gateway/api/class-sv-wc-payment-gateway-api-response-message-helper.php:126
|
595 |
+
msgid "The bank account number is invalid, please re-enter and try again."
|
596 |
+
msgstr ""
|
597 |
+
"Pangakonto number ei ole korrektne, palun sisesta uuesti ja proovi veelkord."
|
598 |
+
|
599 |
+
#: payment-gateway/api/class-sv-wc-payment-gateway-api-response-message-helper.php:129
|
600 |
+
msgid ""
|
601 |
+
"The provided card is expired, please use an alternate card or other form of "
|
602 |
+
"payment."
|
603 |
+
msgstr ""
|
604 |
+
"Antud kaart on aegunud, palun kasuta mõnda teist kaarti või teistsugust "
|
605 |
+
"makseviisi."
|
606 |
+
|
607 |
+
#: payment-gateway/api/class-sv-wc-payment-gateway-api-response-message-helper.php:130
|
608 |
+
msgid ""
|
609 |
+
"The provided card was declined, please use an alternate card or other form "
|
610 |
+
"of payment."
|
611 |
+
msgstr ""
|
612 |
+
"Antud kaart klükati tagasi, palun kasuta mõnda teist kaarti või teistsugust "
|
613 |
+
"makseviisi."
|
614 |
+
|
615 |
+
#: payment-gateway/api/class-sv-wc-payment-gateway-api-response-message-helper.php:131
|
616 |
+
msgid ""
|
617 |
+
"Insufficient funds in account, please use an alternate card or other form of "
|
618 |
+
"payment."
|
619 |
+
msgstr ""
|
620 |
+
"Kontol pole piisavalt vahendeid, palun kasuta mõnda teist kaarti või "
|
621 |
+
"teistsugust makseviisi."
|
622 |
+
|
623 |
+
#: payment-gateway/api/class-sv-wc-payment-gateway-api-response-message-helper.php:132
|
624 |
+
msgid ""
|
625 |
+
"The card is inactivate or not authorized for card-not-present transactions, "
|
626 |
+
"please use an alternate card or other form of payment."
|
627 |
+
msgstr ""
|
628 |
+
"Antud kaart ei ole aktiveeritud või ei ole sellega internetimaksed lubatud. "
|
629 |
+
"Palun kasuta mõnda teist kaarti või teistsugust makseviisi."
|
630 |
+
|
631 |
+
#: payment-gateway/api/class-sv-wc-payment-gateway-api-response-message-helper.php:133
|
632 |
+
msgid ""
|
633 |
+
"The credit limit for the card has been reached, please use an alternate card "
|
634 |
+
"or other form of payment."
|
635 |
+
msgstr ""
|
636 |
+
"Kaardi krediitilimiit on ära kasutatud, palun kasuta mõnda teist kaarti või "
|
637 |
+
"teistsugust makseviisi."
|
638 |
+
|
639 |
+
#: payment-gateway/api/class-sv-wc-payment-gateway-api-response-message-helper.php:134
|
640 |
+
msgid ""
|
641 |
+
"The card verification number does not match. Please re-enter and try again."
|
642 |
+
msgstr "Kaardi turvakood ei klapi. Palun sisesta uuesti ja proovi veelkord."
|
643 |
+
|
644 |
+
#: payment-gateway/api/class-sv-wc-payment-gateway-api-response-message-helper.php:135
|
645 |
+
msgid ""
|
646 |
+
"The provided address does not match the billing address for cardholder. "
|
647 |
+
"Please verify the address and try again."
|
648 |
+
msgstr ""
|
649 |
+
"Antud aadress ei kattu kaardi omaniku aadressiga. Palun kontrolli, et "
|
650 |
+
"sisestaid õige aadressi ning proovi uuesti."
|
651 |
+
|
652 |
+
#: payment-gateway/apple-pay/class-sv-wc-payment-gateway-apple-pay-admin.php:81
|
653 |
+
#: payment-gateway/apple-pay/class-sv-wc-payment-gateway-apple-pay-admin.php:99
|
654 |
+
msgid "Apple Pay"
|
655 |
+
msgstr ""
|
656 |
+
|
657 |
+
#: payment-gateway/apple-pay/class-sv-wc-payment-gateway-apple-pay-admin.php:105
|
658 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:1132
|
659 |
+
msgid "Enable / Disable"
|
660 |
+
msgstr "Luba / Keela"
|
661 |
+
|
662 |
+
#: payment-gateway/apple-pay/class-sv-wc-payment-gateway-apple-pay-admin.php:106
|
663 |
+
msgid "Accept Apple Pay"
|
664 |
+
msgstr ""
|
665 |
+
|
666 |
+
#: payment-gateway/apple-pay/class-sv-wc-payment-gateway-apple-pay-admin.php:113
|
667 |
+
msgid "Allow Apple Pay on"
|
668 |
+
msgstr ""
|
669 |
+
|
670 |
+
#: payment-gateway/apple-pay/class-sv-wc-payment-gateway-apple-pay-admin.php:123
|
671 |
+
msgid "Button Style"
|
672 |
+
msgstr ""
|
673 |
+
|
674 |
+
#: payment-gateway/apple-pay/class-sv-wc-payment-gateway-apple-pay-admin.php:126
|
675 |
+
msgid "Black"
|
676 |
+
msgstr ""
|
677 |
+
|
678 |
+
#: payment-gateway/apple-pay/class-sv-wc-payment-gateway-apple-pay-admin.php:127
|
679 |
+
msgid "White"
|
680 |
+
msgstr ""
|
681 |
+
|
682 |
+
#: payment-gateway/apple-pay/class-sv-wc-payment-gateway-apple-pay-admin.php:128
|
683 |
+
msgid "White with outline"
|
684 |
+
msgstr ""
|
685 |
+
|
686 |
+
#: payment-gateway/apple-pay/class-sv-wc-payment-gateway-apple-pay-admin.php:140
|
687 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:1307
|
688 |
+
msgid "Connection Settings"
|
689 |
+
msgstr ""
|
690 |
+
|
691 |
+
#: payment-gateway/apple-pay/class-sv-wc-payment-gateway-apple-pay-admin.php:146
|
692 |
+
msgid "Apple Merchant ID"
|
693 |
+
msgstr ""
|
694 |
+
|
695 |
+
#: payment-gateway/apple-pay/class-sv-wc-payment-gateway-apple-pay-admin.php:150
|
696 |
+
msgid "This is found in your %1$sApple developer account%2$s"
|
697 |
+
msgstr ""
|
698 |
+
|
699 |
+
#: payment-gateway/apple-pay/class-sv-wc-payment-gateway-apple-pay-admin.php:157
|
700 |
+
msgid "Certificate Path"
|
701 |
+
msgstr ""
|
702 |
+
|
703 |
+
#. translators: Placeholders: %s - the server's web root path
|
704 |
+
#: payment-gateway/apple-pay/class-sv-wc-payment-gateway-apple-pay-admin.php:162
|
705 |
+
msgid "For reference, your current web root path is: %s"
|
706 |
+
msgstr ""
|
707 |
+
|
708 |
+
#: payment-gateway/apple-pay/class-sv-wc-payment-gateway-apple-pay-admin.php:175
|
709 |
+
#: payment-gateway/apple-pay/class-sv-wc-payment-gateway-apple-pay-admin.php:185
|
710 |
+
msgid "Processing Gateway"
|
711 |
+
msgstr ""
|
712 |
+
|
713 |
+
#: payment-gateway/apple-pay/class-sv-wc-payment-gateway-apple-pay-admin.php:193
|
714 |
+
#, fuzzy
|
715 |
+
msgid "Test Mode"
|
716 |
+
msgstr "Veaotsingu režiim"
|
717 |
+
|
718 |
+
#: payment-gateway/apple-pay/class-sv-wc-payment-gateway-apple-pay-admin.php:194
|
719 |
+
msgid ""
|
720 |
+
"Enable to test Apple Pay functionality throughout your sites without "
|
721 |
+
"processing real payments."
|
722 |
+
msgstr ""
|
723 |
+
|
724 |
+
#: payment-gateway/apple-pay/class-sv-wc-payment-gateway-apple-pay-admin.php:306
|
725 |
+
msgid "Your site must be served over HTTPS with a valid SSL certificate."
|
726 |
+
msgstr ""
|
727 |
+
|
728 |
+
#. translators: Placeholders: %1$s - plugin name, %2$s - a
|
729 |
+
#. currency/comma-separated list of currencies, %3$s - <a> tag, %4$s - </a> tag
|
730 |
+
#: payment-gateway/apple-pay/class-sv-wc-payment-gateway-apple-pay-admin.php:316
|
731 |
+
msgid ""
|
732 |
+
"Accepts payment in %1$s only. %2$sConfigure%3$s WooCommerce to accept %1$s "
|
733 |
+
"to enable Apple Pay."
|
734 |
+
msgid_plural ""
|
735 |
+
"Accepts payment in one of %1$s only. %2$sConfigure%3$s WooCommerce to accept "
|
736 |
+
"one of %1$s to enable Apple Pay."
|
737 |
+
msgstr[0] ""
|
738 |
+
msgstr[1] ""
|
739 |
+
|
740 |
+
#: payment-gateway/apple-pay/class-sv-wc-payment-gateway-apple-pay-admin.php:335
|
741 |
+
msgid ""
|
742 |
+
"Your %1$sMerchant Identity Certificate%2$s cannot be found. Please check "
|
743 |
+
"your path configuration."
|
744 |
+
msgstr ""
|
745 |
+
|
746 |
+
#: payment-gateway/apple-pay/class-sv-wc-payment-gateway-apple-pay-admin.php:342
|
747 |
+
msgid "Apple Pay is disabled."
|
748 |
+
msgstr ""
|
749 |
+
|
750 |
+
#: payment-gateway/apple-pay/class-sv-wc-payment-gateway-apple-pay-admin.php:381
|
751 |
+
msgid "Single products"
|
752 |
+
msgstr ""
|
753 |
+
|
754 |
+
#: payment-gateway/apple-pay/class-sv-wc-payment-gateway-apple-pay-admin.php:382
|
755 |
+
msgid "Cart"
|
756 |
+
msgstr ""
|
757 |
+
|
758 |
+
#: payment-gateway/apple-pay/class-sv-wc-payment-gateway-apple-pay-admin.php:383
|
759 |
+
#, fuzzy
|
760 |
+
msgid "Checkout"
|
761 |
+
msgstr "E-tšekk"
|
762 |
+
|
763 |
+
#: payment-gateway/apple-pay/class-sv-wc-payment-gateway-apple-pay-frontend.php:168
|
764 |
+
msgid "Buy with"
|
765 |
+
msgstr ""
|
766 |
+
|
767 |
+
#: payment-gateway/apple-pay/class-sv-wc-payment-gateway-apple-pay-frontend.php:302
|
768 |
+
#, fuzzy
|
769 |
+
msgid "Pay with"
|
770 |
+
msgstr "Maksa"
|
771 |
+
|
772 |
+
#: payment-gateway/apple-pay/class-sv-wc-payment-gateway-apple-pay-frontend.php:308
|
773 |
+
msgid "or"
|
774 |
+
msgstr ""
|
775 |
+
|
776 |
+
#: payment-gateway/apple-pay/class-sv-wc-payment-gateway-apple-pay-orders.php:85
|
777 |
+
#: payment-gateway/apple-pay/class-sv-wc-payment-gateway-apple-pay-orders.php:92
|
778 |
+
#: payment-gateway/apple-pay/class-sv-wc-payment-gateway-apple-pay-orders.php:105
|
779 |
+
#: payment-gateway/apple-pay/class-sv-wc-payment-gateway-apple-pay-orders.php:114
|
780 |
+
#: payment-gateway/apple-pay/class-sv-wc-payment-gateway-apple-pay-orders.php:126
|
781 |
+
#: payment-gateway/apple-pay/class-sv-wc-payment-gateway-apple-pay-orders.php:171
|
782 |
+
#: payment-gateway/apple-pay/class-sv-wc-payment-gateway-apple-pay-orders.php:181
|
783 |
+
#: payment-gateway/apple-pay/class-sv-wc-payment-gateway-apple-pay-orders.php:183
|
784 |
+
msgid "Error %d: Unable to create order. Please try again."
|
785 |
+
msgstr ""
|
786 |
+
|
787 |
+
#: payment-gateway/apple-pay/class-sv-wc-payment-gateway-apple-pay.php:120
|
788 |
+
msgid "Apple Pay payment authorized."
|
789 |
+
msgstr ""
|
790 |
+
|
791 |
+
#: payment-gateway/apple-pay/class-sv-wc-payment-gateway-apple-pay.php:156
|
792 |
+
#, fuzzy
|
793 |
+
msgid "Apple Pay payment failed. %s"
|
794 |
+
msgstr "%1$s: makse ebaõnnestus (%2$s)"
|
795 |
+
|
796 |
+
#: payment-gateway/apple-pay/class-sv-wc-payment-gateway-apple-pay.php:547
|
797 |
+
msgid "Subtotal"
|
798 |
+
msgstr ""
|
799 |
+
|
800 |
+
#: payment-gateway/apple-pay/class-sv-wc-payment-gateway-apple-pay.php:557
|
801 |
+
#, fuzzy
|
802 |
+
msgid "Discount"
|
803 |
+
msgstr "Konto"
|
804 |
+
|
805 |
+
#: payment-gateway/apple-pay/class-sv-wc-payment-gateway-apple-pay.php:567
|
806 |
+
msgid "Shipping"
|
807 |
+
msgstr ""
|
808 |
+
|
809 |
+
#: payment-gateway/apple-pay/class-sv-wc-payment-gateway-apple-pay.php:577
|
810 |
+
msgid "Fees"
|
811 |
+
msgstr ""
|
812 |
+
|
813 |
+
#: payment-gateway/apple-pay/class-sv-wc-payment-gateway-apple-pay.php:587
|
814 |
+
msgid "Taxes"
|
815 |
+
msgstr ""
|
816 |
+
|
817 |
+
#: payment-gateway/class-sv-wc-payment-gateway-direct.php:60
|
818 |
+
msgid ""
|
819 |
+
"Payment error, please try another payment method or contact us to complete "
|
820 |
+
"your transaction."
|
821 |
+
msgstr ""
|
822 |
+
"Viga maksega, palun proovi teistsugust makseviisi või võta meiega ühendust."
|
823 |
+
|
824 |
+
#: payment-gateway/class-sv-wc-payment-gateway-direct.php:160
|
825 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:471
|
826 |
+
msgid "Card expiration date is invalid"
|
827 |
+
msgstr "Kaardi aegumiskuupäev ei ole korrektne"
|
828 |
+
|
829 |
+
#: payment-gateway/class-sv-wc-payment-gateway-direct.php:184
|
830 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:464
|
831 |
+
msgid "Card number is missing"
|
832 |
+
msgstr "Kaardi number on puudu"
|
833 |
+
|
834 |
+
#: payment-gateway/class-sv-wc-payment-gateway-direct.php:190
|
835 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:467
|
836 |
+
msgid "Card number is invalid (wrong length)"
|
837 |
+
msgstr "Kaardi number ei ole korrektne (pikkus on vale)"
|
838 |
+
|
839 |
+
#: payment-gateway/class-sv-wc-payment-gateway-direct.php:195
|
840 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:466
|
841 |
+
msgid "Card number is invalid (only digits allowed)"
|
842 |
+
msgstr "Kaardi number ei ole korrektne (lubatud on ainult numbrid)"
|
843 |
+
|
844 |
+
#: payment-gateway/class-sv-wc-payment-gateway-direct.php:200
|
845 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:465
|
846 |
+
msgid "Card number is invalid"
|
847 |
+
msgstr "Kaardi number ei ole korrektne"
|
848 |
+
|
849 |
+
#: payment-gateway/class-sv-wc-payment-gateway-direct.php:227
|
850 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:469
|
851 |
+
msgid "Card security code is invalid (only digits are allowed)"
|
852 |
+
msgstr "Kaardi turvakood ei ole korrektne (lubatud on ainult numbrid)"
|
853 |
+
|
854 |
+
#: payment-gateway/class-sv-wc-payment-gateway-direct.php:233
|
855 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:470
|
856 |
+
msgid "Card security code is invalid (must be 3 or 4 digits)"
|
857 |
+
msgstr "Kaardi turvakood ei ole korrektne (peab olema 3 või 4 numbrit)"
|
858 |
+
|
859 |
+
#: payment-gateway/class-sv-wc-payment-gateway-direct.php:239
|
860 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:468
|
861 |
+
msgid "Card security code is missing"
|
862 |
+
msgstr "Kaardi turvakood on puudu"
|
863 |
+
|
864 |
+
#: payment-gateway/class-sv-wc-payment-gateway-direct.php:266
|
865 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:480
|
866 |
+
msgid "Routing Number is missing"
|
867 |
+
msgstr "Suunakood on puudu"
|
868 |
+
|
869 |
+
#: payment-gateway/class-sv-wc-payment-gateway-direct.php:273
|
870 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:481
|
871 |
+
msgid "Routing Number is invalid (only digits are allowed)"
|
872 |
+
msgstr "Suunakood ei ole korrektne (lubatud on ainult numbrid)"
|
873 |
+
|
874 |
+
#: payment-gateway/class-sv-wc-payment-gateway-direct.php:279
|
875 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:482
|
876 |
+
msgid "Routing number is invalid (must be 9 digits)"
|
877 |
+
msgstr "Suunakood ei ole korrektne (peab olemas 9 numbrit)"
|
878 |
+
|
879 |
+
#: payment-gateway/class-sv-wc-payment-gateway-direct.php:288
|
880 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:477
|
881 |
+
msgid "Account Number is missing"
|
882 |
+
msgstr "Konto number on puudu"
|
883 |
+
|
884 |
+
#: payment-gateway/class-sv-wc-payment-gateway-direct.php:295
|
885 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:478
|
886 |
+
msgid "Account Number is invalid (only digits are allowed)"
|
887 |
+
msgstr "Konto number ei ole korrektne (lubatud on ainult numbrid)"
|
888 |
+
|
889 |
+
#: payment-gateway/class-sv-wc-payment-gateway-direct.php:301
|
890 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:479
|
891 |
+
msgid "Account number is invalid (must be between 5 and 17 digits)"
|
892 |
+
msgstr "Konto number ei ole korrektne (peab olemas 5-17 numbrit)"
|
893 |
+
|
894 |
+
#: payment-gateway/class-sv-wc-payment-gateway-direct.php:308
|
895 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:476
|
896 |
+
msgid "Drivers license number is invalid"
|
897 |
+
msgstr "Juhiloa number ei ole korrektne"
|
898 |
+
|
899 |
+
#: payment-gateway/class-sv-wc-payment-gateway-direct.php:314
|
900 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:472
|
901 |
+
msgid "Check Number is invalid (only digits are allowed)"
|
902 |
+
msgstr "Tšeki number ei ole korrektne (lubatud on ainult numbrid)"
|
903 |
+
|
904 |
+
#. translators: Placeholders: %1$s - payment method title, %2$s - payment
|
905 |
+
#. account type (savings/checking) (may or may not be available), %3$s - last
|
906 |
+
#. four digits of the account
|
907 |
+
#: payment-gateway/class-sv-wc-payment-gateway-direct.php:564
|
908 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:2724
|
909 |
+
msgid "%1$s Check Transaction Approved: %2$s account ending in %3$s"
|
910 |
+
msgstr "%1$s: tšeki tehing vastu võetud: %2$s konto, lõpeb numbritega %3$s"
|
911 |
+
|
912 |
+
#. translators: Placeholders: %s - check number
|
913 |
+
#: payment-gateway/class-sv-wc-payment-gateway-direct.php:569
|
914 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:2729
|
915 |
+
msgid "Check number %s"
|
916 |
+
msgstr "Tšeki number %s"
|
917 |
+
|
918 |
+
#. translators: Placeholders: %s - transaction ID
|
919 |
+
#: payment-gateway/class-sv-wc-payment-gateway-direct.php:574
|
920 |
+
#: payment-gateway/class-sv-wc-payment-gateway-direct.php:658
|
921 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:1770
|
922 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:2162
|
923 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:2383
|
924 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:2690
|
925 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:2734
|
926 |
+
#: payment-gateway/integrations/class-sv-wc-payment-gateway-integration-pre-orders.php:340
|
927 |
+
msgid "(Transaction ID %s)"
|
928 |
+
msgstr "(Tehingu ID %s)"
|
929 |
+
|
930 |
+
#. translators: Placeholders: %1$s - payment method title, %2$s - environment
|
931 |
+
#. ("Test"), %3$s - transaction type (authorization/charge), %4$s - card type
|
932 |
+
#. (mastercard, visa, ...), %5$s - last four digits of the card
|
933 |
+
#: payment-gateway/class-sv-wc-payment-gateway-direct.php:637
|
934 |
+
#, fuzzy
|
935 |
+
msgid "%1$s %2$s %3$s Approved: %4$s ending in %5$s"
|
936 |
+
msgstr "%1$s %2$s: %3$s kinnitatud: %4$s lõpeb numbritega %5$s (aegub %6$s)"
|
937 |
+
|
938 |
+
#. translators: Placeholders: %s - expiry date
|
939 |
+
#: payment-gateway/class-sv-wc-payment-gateway-direct.php:650
|
940 |
+
#: payment-gateway/class-sv-wc-payment-gateway-payment-form.php:661
|
941 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:2682
|
942 |
+
msgid "(expires %s)"
|
943 |
+
msgstr "(aegub %s)"
|
944 |
+
|
945 |
+
#. translators: Placeholders: %s - failure message
|
946 |
+
#: payment-gateway/class-sv-wc-payment-gateway-direct.php:720
|
947 |
+
msgid "Tokenization Request Failed: %s"
|
948 |
+
msgstr "Maksevahendi salvestamise päring ebaõnnestus: %s"
|
949 |
+
|
950 |
+
#. translators: Placeholders: %1$s - payment method title, %2$s - failure
|
951 |
+
#. message
|
952 |
+
#: payment-gateway/class-sv-wc-payment-gateway-direct.php:731
|
953 |
+
msgid "%1$s Tokenization Request Failed: %2$s"
|
954 |
+
msgstr "%1$s: maksevahendi salvestamise päring ebaõnnestus: %2$s"
|
955 |
+
|
956 |
+
#. translators: This is a message describing that the transaction in question
|
957 |
+
#. only performed a credit card authorization and did not capture any funds.
|
958 |
+
#: payment-gateway/class-sv-wc-payment-gateway-direct.php:752
|
959 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:1718
|
960 |
+
#: payment-gateway/integrations/class-sv-wc-payment-gateway-integration-pre-orders.php:357
|
961 |
+
msgid "Authorization only transaction"
|
962 |
+
msgstr "Autoriseerimise tehing"
|
963 |
+
|
964 |
+
#. translators: Placeholders: %s - failure message. Payment method as in a
|
965 |
+
#. specific credit card, e-check or bank account
|
966 |
+
#: payment-gateway/class-sv-wc-payment-gateway-direct.php:789
|
967 |
+
msgid "Oops, adding your new payment method failed: %s"
|
968 |
+
msgstr "Oih, sinu maksevahendi lisamine ebaõnnestus: %s"
|
969 |
+
|
970 |
+
#. translators: Payment method as in a specific credit card. Placeholders: %1$s
|
971 |
+
#. - card type (visa, mastercard, ...), %2$s - last four digits of the card,
|
972 |
+
#. %3$s - card expiry date
|
973 |
+
#: payment-gateway/class-sv-wc-payment-gateway-direct.php:830
|
974 |
+
msgid "Nice! New payment method added: %1$s ending in %2$s (expires %3$s)"
|
975 |
+
msgstr ""
|
976 |
+
"Lahe! Uus maksevahend lisatud: %1$s, lõpeb numbritega %2$s (aegub %3$s)"
|
977 |
+
|
978 |
+
#. translators: Payment method as in a specific e-check account. Placeholders:
|
979 |
+
#. %1$s - account type (checking/savings), %2$s - last four digits of the
|
980 |
+
#. account
|
981 |
+
#: payment-gateway/class-sv-wc-payment-gateway-direct.php:840
|
982 |
+
msgid "Nice! New payment method added: %1$s account ending in %2$s"
|
983 |
+
msgstr "Lahe! Uus maksevahend lisatud: %1$s konto, lõpeb numbritega %2$s"
|
984 |
+
|
985 |
+
#. translators: Payment method as in a specific credit card, e-check or bank
|
986 |
+
#. account
|
987 |
+
#: payment-gateway/class-sv-wc-payment-gateway-direct.php:847
|
988 |
+
msgid "Nice! New payment method added."
|
989 |
+
msgstr "Lahe! Uus maksevahend lisatud."
|
990 |
+
|
991 |
+
#. translators: Placeholders: %1$s - site title, %2$s - customer email. Payment
|
992 |
+
#. method as in a specific credit card, e-check or bank account
|
993 |
+
#: payment-gateway/class-sv-wc-payment-gateway-direct.php:967
|
994 |
+
msgid "%1$s - Add Payment Method for %2$s"
|
995 |
+
msgstr "%1$s - Lisa maksevahend kliendile %2$s"
|
996 |
+
|
997 |
+
#: payment-gateway/class-sv-wc-payment-gateway-helper.php:179
|
998 |
+
msgid "PayPal"
|
999 |
+
msgstr "PayPal"
|
1000 |
+
|
1001 |
+
#: payment-gateway/class-sv-wc-payment-gateway-helper.php:180
|
1002 |
+
msgid "Checking Account"
|
1003 |
+
msgstr "Tšekikonto"
|
1004 |
+
|
1005 |
+
#: payment-gateway/class-sv-wc-payment-gateway-helper.php:181
|
1006 |
+
msgid "Savings Account"
|
1007 |
+
msgstr "Hoiuarve"
|
1008 |
+
|
1009 |
+
#: payment-gateway/class-sv-wc-payment-gateway-helper.php:182
|
1010 |
+
msgid "Credit / Debit Card"
|
1011 |
+
msgstr "Deebet- või krediitkaart"
|
1012 |
+
|
1013 |
+
#: payment-gateway/class-sv-wc-payment-gateway-helper.php:183
|
1014 |
+
msgid "Bank Account"
|
1015 |
+
msgstr "Pangakonto"
|
1016 |
+
|
1017 |
+
#: payment-gateway/class-sv-wc-payment-gateway-hosted.php:294
|
1018 |
+
msgid "Thank you for your order, please click the button below to pay."
|
1019 |
+
msgstr "Aitäh tellimuse eest. Palun kliki maksmiseks alloleval nupul."
|
1020 |
+
|
1021 |
+
#: payment-gateway/class-sv-wc-payment-gateway-hosted.php:295
|
1022 |
+
msgid ""
|
1023 |
+
"Thank you for your order. We are now redirecting you to complete payment."
|
1024 |
+
msgstr "Aitäh tellimuse eest. Makse teostamiseks suunatakse sind nüüd edasi."
|
1025 |
+
|
1026 |
+
#: payment-gateway/class-sv-wc-payment-gateway-hosted.php:296
|
1027 |
+
msgid "Pay Now"
|
1028 |
+
msgstr "Maksa"
|
1029 |
+
|
1030 |
+
#: payment-gateway/class-sv-wc-payment-gateway-hosted.php:297
|
1031 |
+
msgid "Cancel Order"
|
1032 |
+
msgstr "Tühista tellimus"
|
1033 |
+
|
1034 |
+
#. translators: Placeholders: %s - a WooCommerce order ID
|
1035 |
+
#: payment-gateway/class-sv-wc-payment-gateway-hosted.php:436
|
1036 |
+
msgid "Could not find order %s"
|
1037 |
+
msgstr ""
|
1038 |
+
|
1039 |
+
#. translators: Placeholders: %s - payment gateway title (such as
|
1040 |
+
#. Authorize.net, Braintree, etc)
|
1041 |
+
#: payment-gateway/class-sv-wc-payment-gateway-hosted.php:500
|
1042 |
+
msgid "%s duplicate transaction received"
|
1043 |
+
msgstr "%s: duplikaattehing"
|
1044 |
+
|
1045 |
+
#: payment-gateway/class-sv-wc-payment-gateway-hosted.php:503
|
1046 |
+
msgid "Order %s is already paid for."
|
1047 |
+
msgstr ""
|
1048 |
+
|
1049 |
+
#. translators: Placeholders: %1$s - payment gateway title (such as
|
1050 |
+
#. Authorize.net, Braintree, etc), %2$s - payment method name (mastercard, bank
|
1051 |
+
#. account, etc), %3$s - last four digits of the card/account, %4$s -
|
1052 |
+
#. card/account expiry date
|
1053 |
+
#: payment-gateway/class-sv-wc-payment-gateway-hosted.php:586
|
1054 |
+
#: payment-gateway/payment-tokens/class-sv-wc-payment-gateway-payment-tokens-handler.php:795
|
1055 |
+
msgid "%1$s Payment Method Saved: %2$s ending in %3$s (expires %4$s)"
|
1056 |
+
msgstr ""
|
1057 |
+
"%1$s: maksevahend salvestatud: %2$s lõpeb numbritega in %3$s (aegub %4$s)"
|
1058 |
+
|
1059 |
+
#. translators: Placeholders: %1$s - payment gateway title (such as CyberSouce,
|
1060 |
+
#. NETbilling, etc), %2$s - account type (checking/savings - may or may not be
|
1061 |
+
#. available), %3$s - last four digits of the account
|
1062 |
+
#: payment-gateway/class-sv-wc-payment-gateway-hosted.php:597
|
1063 |
+
#: payment-gateway/payment-tokens/class-sv-wc-payment-gateway-payment-tokens-handler.php:806
|
1064 |
+
msgid "%1$s eCheck Payment Method Saved: %2$s account ending in %3$s"
|
1065 |
+
msgstr ""
|
1066 |
+
"%1$s: e-tšeki maksevahend salvestatud: %2$s konto, lõpeb numbritega %3$s"
|
1067 |
+
|
1068 |
+
#. translators: Placeholders: %s - payment gateway title (such as CyberSouce,
|
1069 |
+
#. NETbilling, etc)
|
1070 |
+
#: payment-gateway/class-sv-wc-payment-gateway-hosted.php:606
|
1071 |
+
#, fuzzy
|
1072 |
+
msgid "%s Payment Method Saved"
|
1073 |
+
msgstr "Minu maksevahendid."
|
1074 |
+
|
1075 |
+
#. translators: Placeholders: %s - a failed tokenization API error
|
1076 |
+
#: payment-gateway/class-sv-wc-payment-gateway-hosted.php:615
|
1077 |
+
#, fuzzy
|
1078 |
+
msgid "Tokenization failed. %s"
|
1079 |
+
msgstr "Maksevahendi salvestamise päring ebaõnnestus: %s"
|
1080 |
+
|
1081 |
+
#: payment-gateway/class-sv-wc-payment-gateway-my-payment-methods.php:224
|
1082 |
+
#: payment-gateway/class-sv-wc-payment-gateway-my-payment-methods.php:744
|
1083 |
+
msgid "Edit"
|
1084 |
+
msgstr ""
|
1085 |
+
|
1086 |
+
#: payment-gateway/class-sv-wc-payment-gateway-my-payment-methods.php:226
|
1087 |
+
#, fuzzy
|
1088 |
+
msgid ""
|
1089 |
+
"Oops, there was an error updating your payment method. Please try again."
|
1090 |
+
msgstr "Sinu päringuga esines viga, palun proovi uuesti."
|
1091 |
+
|
1092 |
+
#: payment-gateway/class-sv-wc-payment-gateway-my-payment-methods.php:227
|
1093 |
+
msgid "Are you sure you want to delete this payment method?"
|
1094 |
+
msgstr "Oled sa kindel, et soovid selle maksevahendi kustutada?"
|
1095 |
+
|
1096 |
+
#. translators: Payment method as in a specific credit card, eCheck or bank
|
1097 |
+
#. account
|
1098 |
+
#: payment-gateway/class-sv-wc-payment-gateway-my-payment-methods.php:284
|
1099 |
+
msgid "You do not have any saved payment methods."
|
1100 |
+
msgstr "Sul ei ole salvestatud maksevahendeid."
|
1101 |
+
|
1102 |
+
#. translators: Payment method as in a specific credit card, eCheck or bank
|
1103 |
+
#. account
|
1104 |
+
#: payment-gateway/class-sv-wc-payment-gateway-my-payment-methods.php:321
|
1105 |
+
msgid "My Payment Methods"
|
1106 |
+
msgstr "Minu maksevahendid."
|
1107 |
+
|
1108 |
+
#. translators: Payment method as in a specific credit card, e-check or bank
|
1109 |
+
#. account
|
1110 |
+
#: payment-gateway/class-sv-wc-payment-gateway-my-payment-methods.php:329
|
1111 |
+
msgid "Add New Payment Method"
|
1112 |
+
msgstr "Lisa uus maksevahend"
|
1113 |
+
|
1114 |
+
#: payment-gateway/class-sv-wc-payment-gateway-my-payment-methods.php:414
|
1115 |
+
msgid "Method"
|
1116 |
+
msgstr "Maksevahend"
|
1117 |
+
|
1118 |
+
#: payment-gateway/class-sv-wc-payment-gateway-my-payment-methods.php:415
|
1119 |
+
msgid "Details"
|
1120 |
+
msgstr ""
|
1121 |
+
|
1122 |
+
#: payment-gateway/class-sv-wc-payment-gateway-my-payment-methods.php:416
|
1123 |
+
msgid "Expires"
|
1124 |
+
msgstr "Aegub"
|
1125 |
+
|
1126 |
+
#: payment-gateway/class-sv-wc-payment-gateway-my-payment-methods.php:417
|
1127 |
+
#, fuzzy
|
1128 |
+
msgid "Default?"
|
1129 |
+
msgstr "(vaikimisi)"
|
1130 |
+
|
1131 |
+
#: payment-gateway/class-sv-wc-payment-gateway-my-payment-methods.php:418
|
1132 |
+
msgid "Actions"
|
1133 |
+
msgstr ""
|
1134 |
+
|
1135 |
+
#: payment-gateway/class-sv-wc-payment-gateway-my-payment-methods.php:454
|
1136 |
+
msgid "Credit/Debit Cards"
|
1137 |
+
msgstr "Deebet- ja krediitkaardid"
|
1138 |
+
|
1139 |
+
#: payment-gateway/class-sv-wc-payment-gateway-my-payment-methods.php:463
|
1140 |
+
msgid "Bank Accounts"
|
1141 |
+
msgstr "Pangakontod"
|
1142 |
+
|
1143 |
+
#: payment-gateway/class-sv-wc-payment-gateway-my-payment-methods.php:515
|
1144 |
+
msgid "N/A"
|
1145 |
+
msgstr "-"
|
1146 |
+
|
1147 |
+
#: payment-gateway/class-sv-wc-payment-gateway-my-payment-methods.php:624
|
1148 |
+
#: payment-gateway/class-sv-wc-payment-gateway-privacy.php:199
|
1149 |
+
msgid "Nickname"
|
1150 |
+
msgstr ""
|
1151 |
+
|
1152 |
+
#: payment-gateway/class-sv-wc-payment-gateway-my-payment-methods.php:805
|
1153 |
+
msgid "Delete"
|
1154 |
+
msgstr "Kustuta"
|
1155 |
+
|
1156 |
+
#: payment-gateway/class-sv-wc-payment-gateway-my-payment-methods.php:959
|
1157 |
+
msgid "Oops, you took too long, please try again."
|
1158 |
+
msgstr "Oih, sul läks liiga kaua aega - palun proovi uuesti."
|
1159 |
+
|
1160 |
+
#: payment-gateway/class-sv-wc-payment-gateway-my-payment-methods.php:972
|
1161 |
+
msgid "There was an error with your request, please try again."
|
1162 |
+
msgstr "Sinu päringuga esines viga, palun proovi uuesti."
|
1163 |
+
|
1164 |
+
#. translators: Payment method as in a specific credit card, e-check or bank
|
1165 |
+
#. account
|
1166 |
+
#: payment-gateway/class-sv-wc-payment-gateway-my-payment-methods.php:985
|
1167 |
+
msgid "Error removing payment method"
|
1168 |
+
msgstr "Viga maksevahendi eemaldamisel"
|
1169 |
+
|
1170 |
+
#. translators: Payment method as in a specific credit card, e-check or bank
|
1171 |
+
#. account
|
1172 |
+
#: payment-gateway/class-sv-wc-payment-gateway-my-payment-methods.php:990
|
1173 |
+
msgid "Payment method deleted."
|
1174 |
+
msgstr "Maksevahend kustutatud."
|
1175 |
+
|
1176 |
+
#: payment-gateway/class-sv-wc-payment-gateway-payment-form.php:295
|
1177 |
+
msgid "Card Number"
|
1178 |
+
msgstr "Kaardi number"
|
1179 |
+
|
1180 |
+
#: payment-gateway/class-sv-wc-payment-gateway-payment-form.php:316
|
1181 |
+
msgid "MM / YY"
|
1182 |
+
msgstr "KK / AA"
|
1183 |
+
|
1184 |
+
#: payment-gateway/class-sv-wc-payment-gateway-payment-form.php:334
|
1185 |
+
msgid "Card Security Code"
|
1186 |
+
msgstr "Kaardi turvakood"
|
1187 |
+
|
1188 |
+
#: payment-gateway/class-sv-wc-payment-gateway-payment-form.php:337
|
1189 |
+
msgid "CSC"
|
1190 |
+
msgstr "Turvakood"
|
1191 |
+
|
1192 |
+
#: payment-gateway/class-sv-wc-payment-gateway-payment-form.php:376
|
1193 |
+
msgid "Where do I find this?"
|
1194 |
+
msgstr "Kust ma selle leian?"
|
1195 |
+
|
1196 |
+
#. translators: e-check routing number, HTML form field label,
|
1197 |
+
#. https:en.wikipedia.org/wiki/Routing_transit_number
|
1198 |
+
#: payment-gateway/class-sv-wc-payment-gateway-payment-form.php:382
|
1199 |
+
msgid "Routing Number"
|
1200 |
+
msgstr "Suunakood"
|
1201 |
+
|
1202 |
+
#. translators: e-check account number, HTML form field label
|
1203 |
+
#: payment-gateway/class-sv-wc-payment-gateway-payment-form.php:401
|
1204 |
+
msgid "Account Number"
|
1205 |
+
msgstr "Kontonumber"
|
1206 |
+
|
1207 |
+
#. translators: Test mode refers to the current software environment
|
1208 |
+
#: payment-gateway/class-sv-wc-payment-gateway-payment-form.php:466
|
1209 |
+
msgid "TEST MODE ENABLED"
|
1210 |
+
msgstr "TESTREŽIIM SISSE LÜLITATUD"
|
1211 |
+
|
1212 |
+
#. translators: Payment method as in a specific credit card, eCheck or bank
|
1213 |
+
#. account
|
1214 |
+
#: payment-gateway/class-sv-wc-payment-gateway-payment-form.php:565
|
1215 |
+
msgid "Manage Payment Methods"
|
1216 |
+
msgstr "Halda maksevahendeid"
|
1217 |
+
|
1218 |
+
#: payment-gateway/class-sv-wc-payment-gateway-payment-form.php:699
|
1219 |
+
msgid "Use a new card"
|
1220 |
+
msgstr "Kasuta uut kaarti"
|
1221 |
+
|
1222 |
+
#: payment-gateway/class-sv-wc-payment-gateway-payment-form.php:699
|
1223 |
+
msgid "Use a new bank account"
|
1224 |
+
msgstr "Kasuta uut pangakontot"
|
1225 |
+
|
1226 |
+
#. translators: account as in customer's account on the eCommerce site
|
1227 |
+
#: payment-gateway/class-sv-wc-payment-gateway-payment-form.php:761
|
1228 |
+
msgid "Securely Save to Account"
|
1229 |
+
msgstr "Salvesta turvaliselt oma kontole"
|
1230 |
+
|
1231 |
+
#. translators: Placeholders: %s - plugin name
|
1232 |
+
#: payment-gateway/class-sv-wc-payment-gateway-plugin.php:578
|
1233 |
+
msgid ""
|
1234 |
+
"%s: WooCommerce is not being forced over SSL; your customer's payment data "
|
1235 |
+
"may be at risk."
|
1236 |
+
msgstr ""
|
1237 |
+
"%s: WooCommerce'i ei sunnita SSLi kasutama; sinu klientide andmed võivad "
|
1238 |
+
"olla ohus."
|
1239 |
+
|
1240 |
+
#. translators: Placeholders: %s - payment gateway name
|
1241 |
+
#: payment-gateway/class-sv-wc-payment-gateway-plugin.php:591
|
1242 |
+
msgid ""
|
1243 |
+
"%s will soon require TLS 1.2 support to process transactions and your server "
|
1244 |
+
"environment may need to be updated. Please contact your hosting provider to "
|
1245 |
+
"confirm that your site can send and receive TLS 1.2 connections and request "
|
1246 |
+
"they make any necessary updates."
|
1247 |
+
msgstr ""
|
1248 |
+
|
1249 |
+
#. translators: Placeholders: %1$s - plugin name, %2$s - a
|
1250 |
+
#. currency/comma-separated list of currencies, %3$s - <a> tag, %4$s - </a> tag
|
1251 |
+
#: payment-gateway/class-sv-wc-payment-gateway-plugin.php:645
|
1252 |
+
msgid ""
|
1253 |
+
"%1$s accepts payment in %2$s only. %3$sConfigure%4$s WooCommerce to accept "
|
1254 |
+
"%2$s to enable this gateway for checkout."
|
1255 |
+
msgid_plural ""
|
1256 |
+
"%1$s accepts payment in one of %2$s only. %3$sConfigure%4$s WooCommerce to "
|
1257 |
+
"accept one of %2$s to enable this gateway for checkout."
|
1258 |
+
msgstr[0] ""
|
1259 |
+
msgstr[1] ""
|
1260 |
+
|
1261 |
+
#. translators: Placeholders: %1$s - payment gateway title (such as
|
1262 |
+
#. Authorize.net, Braintree, etc), %2$s - <a> tag, %3$s - </a> tag
|
1263 |
+
#: payment-gateway/class-sv-wc-payment-gateway-plugin.php:689
|
1264 |
+
msgid ""
|
1265 |
+
"%1$s is inactive for subscription transactions. Please %2$senable "
|
1266 |
+
"tokenization%3$s to activate %1$s for Subscriptions."
|
1267 |
+
msgstr ""
|
1268 |
+
"%1$s ei ole korduvtellimuste jaoks kasutatav. Palun %2$slülita "
|
1269 |
+
"maksevahendite salvestamine%3$s sisse, et aktiveerida %1$s Korduvellimuste "
|
1270 |
+
"(Subscriptions) jaoks."
|
1271 |
+
|
1272 |
+
#. translators: Placeholders: %1$s - payment gateway title (such as
|
1273 |
+
#. Authorize.net, Braintree, etc), %2$s - <a> tag, %3$s - </a> tag
|
1274 |
+
#: payment-gateway/class-sv-wc-payment-gateway-plugin.php:707
|
1275 |
+
msgid ""
|
1276 |
+
"%1$s is inactive for pre-order transactions. Please %2$senable tokenization"
|
1277 |
+
"%3$s to activate %1$s for Pre-Orders."
|
1278 |
+
msgstr ""
|
1279 |
+
"%1$s ei ole eeltellimuste maksete jaoks kasutatav. Palun %2$slülita "
|
1280 |
+
"maksevahendite salvestamine%3$s sisse, et aktiveerida %1$s Eeltellimuste "
|
1281 |
+
"(Pre-Orders) jaoks."
|
1282 |
+
|
1283 |
+
#: payment-gateway/class-sv-wc-payment-gateway-plugin.php:743
|
1284 |
+
msgid ""
|
1285 |
+
"You must enable tokenization for this gateway in order to support automatic "
|
1286 |
+
"renewal payments with the WooCommerce Subscriptions extension."
|
1287 |
+
msgstr ""
|
1288 |
+
|
1289 |
+
#: payment-gateway/class-sv-wc-payment-gateway-plugin.php:744
|
1290 |
+
msgid "Inactive"
|
1291 |
+
msgstr ""
|
1292 |
+
|
1293 |
+
#: payment-gateway/class-sv-wc-payment-gateway-privacy.php:114
|
1294 |
+
#, fuzzy
|
1295 |
+
msgid "%s Customer ID"
|
1296 |
+
msgstr "Kliendi ID"
|
1297 |
+
|
1298 |
+
#: payment-gateway/class-sv-wc-payment-gateway-privacy.php:183
|
1299 |
+
#, fuzzy
|
1300 |
+
msgid "Type"
|
1301 |
+
msgstr "Kaardi tüüp"
|
1302 |
+
|
1303 |
+
#: payment-gateway/class-sv-wc-payment-gateway-privacy.php:253
|
1304 |
+
msgid "Removed payment token \"%d\""
|
1305 |
+
msgstr ""
|
1306 |
+
|
1307 |
+
#: payment-gateway/class-sv-wc-payment-gateway-privacy.php:300
|
1308 |
+
#, fuzzy
|
1309 |
+
msgid "Expiry Date"
|
1310 |
+
msgstr "Aegumiskuupäev (01/%s)"
|
1311 |
+
|
1312 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:332
|
1313 |
+
msgid "you successfully processed a payment!"
|
1314 |
+
msgstr ""
|
1315 |
+
|
1316 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:337
|
1317 |
+
msgid "you successfully processed a refund!"
|
1318 |
+
msgstr ""
|
1319 |
+
|
1320 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:473
|
1321 |
+
msgid "Check Number is missing"
|
1322 |
+
msgstr "Tšeki number on puudu"
|
1323 |
+
|
1324 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:474
|
1325 |
+
msgid "Drivers license state is missing"
|
1326 |
+
msgstr "Juhiloa osariik on puudu"
|
1327 |
+
|
1328 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:475
|
1329 |
+
msgid "Drivers license number is missing"
|
1330 |
+
msgstr "Juhiloa number on puudu"
|
1331 |
+
|
1332 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:651
|
1333 |
+
msgid "Place order"
|
1334 |
+
msgstr "Esita tellimus"
|
1335 |
+
|
1336 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:683
|
1337 |
+
msgid "Thank you for your order."
|
1338 |
+
msgstr "Aitäh tellimuse eest."
|
1339 |
+
|
1340 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:1091
|
1341 |
+
msgid "Credit Card"
|
1342 |
+
msgstr "Krediitkaart"
|
1343 |
+
|
1344 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:1093
|
1345 |
+
msgid "eCheck"
|
1346 |
+
msgstr "E-tšekk"
|
1347 |
+
|
1348 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:1111
|
1349 |
+
msgid "Pay securely using your credit card."
|
1350 |
+
msgstr "Maksa turvaliselt oma krediitkaardiga."
|
1351 |
+
|
1352 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:1113
|
1353 |
+
msgid "Pay securely using your checking account."
|
1354 |
+
msgstr "Maksa turvaliselt oma tšekikontoga."
|
1355 |
+
|
1356 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:1133
|
1357 |
+
msgid "Enable this gateway"
|
1358 |
+
msgstr "Lülita see makseviis sisse"
|
1359 |
+
|
1360 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:1139
|
1361 |
+
msgid "Title"
|
1362 |
+
msgstr "Nimetus"
|
1363 |
+
|
1364 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:1141
|
1365 |
+
msgid "Payment method title that the customer will see during checkout."
|
1366 |
+
msgstr "Kliendile kassas nähtav makseviisi nimetus."
|
1367 |
+
|
1368 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:1146
|
1369 |
+
msgid "Description"
|
1370 |
+
msgstr "Kirjeldus"
|
1371 |
+
|
1372 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:1148
|
1373 |
+
msgid "Payment method description that the customer will see during checkout."
|
1374 |
+
msgstr "Kliendile kassas nähtav makseviisi kirjeldus."
|
1375 |
+
|
1376 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:1177
|
1377 |
+
msgid "Detailed Decline Messages"
|
1378 |
+
msgstr "Täpsemad maksest keeldumise teated"
|
1379 |
+
|
1380 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:1179
|
1381 |
+
msgid ""
|
1382 |
+
"Check to enable detailed decline messages to the customer during checkout "
|
1383 |
+
"when possible, rather than a generic decline message."
|
1384 |
+
msgstr ""
|
1385 |
+
"Lülita see valik sisse, kui soovid klientidele üldise maksest keeldumise "
|
1386 |
+
"teate asemel näidata võimaluse korral täpsemaid põhjusi."
|
1387 |
+
|
1388 |
+
#. translators: Placeholders: %1$s - <a> tag, %2$s - </a> tag
|
1389 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:1189
|
1390 |
+
msgid ""
|
1391 |
+
"Show Detailed Error Messages and API requests/responses on the checkout page "
|
1392 |
+
"and/or save them to the %1$sdebug log%2$s"
|
1393 |
+
msgstr ""
|
1394 |
+
"Näita üksikasjalikke veateateud ja API päringuid/vastuseid kassas ja/või "
|
1395 |
+
"salvesta need %1$slogifaili%2$s"
|
1396 |
+
|
1397 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:1193
|
1398 |
+
msgid "Show on Checkout Page"
|
1399 |
+
msgstr "Näita kassas"
|
1400 |
+
|
1401 |
+
#. translators: show debugging information on both checkout page and in the log
|
1402 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:1196
|
1403 |
+
msgid "Both"
|
1404 |
+
msgstr "Mõlemad"
|
1405 |
+
|
1406 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:1259
|
1407 |
+
msgid "Select the gateway environment to use for transactions."
|
1408 |
+
msgstr "Vali makseviisi tehingute teostamise keskkond."
|
1409 |
+
|
1410 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:1313
|
1411 |
+
msgid "Share connection settings"
|
1412 |
+
msgstr "Jaga ühenduse andmeid"
|
1413 |
+
|
1414 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:1315
|
1415 |
+
msgid "Use connection/authentication settings from other gateway"
|
1416 |
+
msgstr "Kasuta teise makseviisi ühenduse/autentimise seadeid"
|
1417 |
+
|
1418 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:1318
|
1419 |
+
msgid "Disabled because the other gateway is using these settings"
|
1420 |
+
msgstr "Ei saa muuta, kuna teine makseviis kasutab neid seadeid"
|
1421 |
+
|
1422 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:1335
|
1423 |
+
msgid "Card Verification (CSC)"
|
1424 |
+
msgstr "Kaardi turvakood (CSC)"
|
1425 |
+
|
1426 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:1336
|
1427 |
+
msgid "Display the Card Security Code (CV2) field on checkout"
|
1428 |
+
msgstr "Näita kassas kaardi turvakoodi (CV2) välja"
|
1429 |
+
|
1430 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:1344
|
1431 |
+
#, fuzzy
|
1432 |
+
msgid "Saved Card Verification"
|
1433 |
+
msgstr "Kaardi turvakood (CSC)"
|
1434 |
+
|
1435 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:1345
|
1436 |
+
#, fuzzy
|
1437 |
+
msgid "Display the Card Security Code field when paying with a saved card"
|
1438 |
+
msgstr "Näita kassas kaardi turvakoodi (CV2) välja"
|
1439 |
+
|
1440 |
+
#. translators: Placeholders: %1$s - site title, %2$s - order number
|
1441 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:1673
|
1442 |
+
msgid "%1$s - Order %2$s"
|
1443 |
+
msgstr "%1$s - Tellimus %2$s"
|
1444 |
+
|
1445 |
+
#. translators: Placeholders: %1$s - payment gateway title (such as
|
1446 |
+
#. Authorize.net, Braintree, etc), %2$s - transaction amount. Definitions:
|
1447 |
+
#. Capture, as in capture funds from a credit card.
|
1448 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:1763
|
1449 |
+
msgid "%1$s Capture of %2$s Approved"
|
1450 |
+
msgstr "%1$s: tasumine summas %2$s kinnitatud"
|
1451 |
+
|
1452 |
+
#. translators: Placeholders: %1$s - payment gateway title (such as
|
1453 |
+
#. Authorize.net, Braintree, etc), %2$s - transaction amount, %3$s -
|
1454 |
+
#. transaction status message. Definitions: Capture, as in capture funds from a
|
1455 |
+
#. credit card.
|
1456 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:1802
|
1457 |
+
msgid "%1$s Capture Failed: %2$s - %3$s"
|
1458 |
+
msgstr "%1$s: tasumine ebaõnnestus: %2$s - %3$s"
|
1459 |
+
|
1460 |
+
#. translators: Placeholders: %1$s - payment gateway title (such as
|
1461 |
+
#. Authorize.net, Braintree, etc), %2$s - failure message. Definitions:
|
1462 |
+
#. "capture" as in capturing funds from a credit card.
|
1463 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:1820
|
1464 |
+
msgid "%1$s Capture Failed: %2$s"
|
1465 |
+
msgstr "%1$s: makse teostamine ebaõnnestus: %2$s"
|
1466 |
+
|
1467 |
+
#. translators: Placeholders: %1$s - site title, %2$s - order number.
|
1468 |
+
#. Definitions: Capture as in capture funds from a credit card.
|
1469 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:1884
|
1470 |
+
msgid "%1$s - Capture for Order %2$s"
|
1471 |
+
msgstr "%1$s - Tasumine tellimuse %2$s eest"
|
1472 |
+
|
1473 |
+
#. translators: Placeholders: %1$s - site title, %2$s - order number
|
1474 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:2092
|
1475 |
+
msgid "%1$s - Refund for Order %2$s"
|
1476 |
+
msgstr "%1$s - Tagasimakse tellimuse %2$s eest"
|
1477 |
+
|
1478 |
+
#. translators: Placeholders: %1$s - payment gateway title (such as
|
1479 |
+
#. Authorize.net, Braintree, etc), %2$s - a monetary amount
|
1480 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:2155
|
1481 |
+
msgid "%1$s Refund in the amount of %2$s approved."
|
1482 |
+
msgstr "%1$s: tagasimakse summas %2$s kinnitatud."
|
1483 |
+
|
1484 |
+
#. translators: Placeholders: %1$s - payment gateway title (such as
|
1485 |
+
#. Authorize.net, Braintree, etc), %2$s - error code, %3$s - error message
|
1486 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:2182
|
1487 |
+
msgid "%1$s Refund Failed: %2$s - %3$s"
|
1488 |
+
msgstr "%1$s: tagasimakse ebaõnnestus: %2$s - %3$s"
|
1489 |
+
|
1490 |
+
#. translators: Placeholders: %1$s - payment gateway title (such as
|
1491 |
+
#. Authorize.net, Braintree, etc), %2$s - error message
|
1492 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:2190
|
1493 |
+
msgid "%1$s Refund Failed: %2$s"
|
1494 |
+
msgstr "%1$s: tagasimakse ebaõnnestus: %2$s"
|
1495 |
+
|
1496 |
+
#. translators: Placeholders: %s - payment gateway title (such as
|
1497 |
+
#. Authorize.net, Braintree, etc)
|
1498 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:2210
|
1499 |
+
msgid "%s Order completely refunded."
|
1500 |
+
msgstr "%s: tellimus täielikult tagasi makstud."
|
1501 |
+
|
1502 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:2263
|
1503 |
+
msgid ""
|
1504 |
+
"Oops, you cannot partially void this order. Please use the full order amount."
|
1505 |
+
msgstr ""
|
1506 |
+
"Oih, sa ei saa seda tellimust osaliselt tühistada. Palun kasuta tellimuse "
|
1507 |
+
"täissummat."
|
1508 |
+
|
1509 |
+
#. translators: Placeholders: %1$s - payment gateway title, %2$s - error code,
|
1510 |
+
#. %3$s - error message. Void as in to void an order.
|
1511 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:2347
|
1512 |
+
msgid "%1$s Void Failed: %2$s - %3$s"
|
1513 |
+
msgstr "%1$s: tühistamine ebaõnnestus: %2$s - %3$s"
|
1514 |
+
|
1515 |
+
#. translators: Placeholders: %1$s - payment gateway title, %2$s - error
|
1516 |
+
#. message. Void as in to void an order.
|
1517 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:2355
|
1518 |
+
msgid "%1$s Void Failed: %2$s"
|
1519 |
+
msgstr "%1$s: tühistamine ebaõnnestus: %2$s"
|
1520 |
+
|
1521 |
+
#. translators: Placeholders: %1$s - payment gateway title, %2$s - a monetary
|
1522 |
+
#. amount. Void as in to void an order.
|
1523 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:2376
|
1524 |
+
msgid "%1$s Void in the amount of %2$s approved."
|
1525 |
+
msgstr "%1$s: tühistamine summas %2$s kinnitatud."
|
1526 |
+
|
1527 |
+
#. translators: Placeholders: %1$s - status code, %2$s - status message
|
1528 |
+
#. translators: Placeholders: %1$s - payment request response status code, %2$s
|
1529 |
+
#. - payment request response status message
|
1530 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:2471
|
1531 |
+
#: payment-gateway/payment-tokens/class-sv-wc-payment-gateway-payment-tokens-handler.php:149
|
1532 |
+
msgid "Status code %1$s: %2$s"
|
1533 |
+
msgstr "Staatuse kood %1$s: %2$s"
|
1534 |
+
|
1535 |
+
#. translators: Placeholders: %s - status code
|
1536 |
+
#. translators: Placeholders: %s - payment request response status code
|
1537 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:2474
|
1538 |
+
#: payment-gateway/payment-tokens/class-sv-wc-payment-gateway-payment-tokens-handler.php:152
|
1539 |
+
msgid "Status code: %s"
|
1540 |
+
msgstr "Staatuse kood: %s"
|
1541 |
+
|
1542 |
+
#. translators: Placeholders; %s - status message
|
1543 |
+
#. translators: Placeholders: %s - payment request response status message
|
1544 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:2477
|
1545 |
+
#: payment-gateway/payment-tokens/class-sv-wc-payment-gateway-payment-tokens-handler.php:155
|
1546 |
+
msgid "Status message: %s"
|
1547 |
+
msgstr "Staatuse teade: %s"
|
1548 |
+
|
1549 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:2482
|
1550 |
+
#: payment-gateway/payment-tokens/class-sv-wc-payment-gateway-payment-tokens-handler.php:162
|
1551 |
+
msgid "Transaction ID %s"
|
1552 |
+
msgstr "Tehingu ID %s"
|
1553 |
+
|
1554 |
+
#. translators: Placeholders: %1$s - payment method title, %2$s - environment
|
1555 |
+
#. ("Test"), %3$s - transaction type (authorization/charge)
|
1556 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:2661
|
1557 |
+
#, fuzzy
|
1558 |
+
msgid "%1$s %2$s %3$s Approved"
|
1559 |
+
msgstr "%1$s: %2$s tehing kinnitatud"
|
1560 |
+
|
1561 |
+
#. translators: Placeholders: %1$s - credit card type (MasterCard, Visa,
|
1562 |
+
#. etc...), %2$s - last four digits of the card
|
1563 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:2671
|
1564 |
+
msgid "%1$s ending in %2$s"
|
1565 |
+
msgstr ""
|
1566 |
+
|
1567 |
+
#. translators: Placeholders: %1$s - payment gateway title, %2$s - message
|
1568 |
+
#. (probably reason for the transaction being held for review)
|
1569 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:2765
|
1570 |
+
msgid "%1$s Transaction Held for Review (%2$s)"
|
1571 |
+
msgstr "%1$s: tehning pandi ülevaatuseks ootele (%2$s)"
|
1572 |
+
|
1573 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:2796
|
1574 |
+
msgid ""
|
1575 |
+
"Your order has been received and is being reviewed. Thank you for your "
|
1576 |
+
"business."
|
1577 |
+
msgstr ""
|
1578 |
+
"Sinu tellimus on vastu võetud ja on ülevaatamisel. Täname koostöö eest."
|
1579 |
+
|
1580 |
+
#. translators: Placeholders: %1$s - payment gateway title, %2$s - error
|
1581 |
+
#. message; e.g. Order Note: [Payment method] Payment failed [error]
|
1582 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:2841
|
1583 |
+
msgid "%1$s Payment Failed (%2$s)"
|
1584 |
+
msgstr "%1$s: makse ebaõnnestus (%2$s)"
|
1585 |
+
|
1586 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:2858
|
1587 |
+
#: payment-gateway/integrations/class-sv-wc-payment-gateway-integration-subscriptions.php:375
|
1588 |
+
msgid ""
|
1589 |
+
"An error occurred, please try again or try an alternate form of payment."
|
1590 |
+
msgstr "Esines viga, palun proovi uuesti või kasuta teistsugust makseviisi."
|
1591 |
+
|
1592 |
+
#. translators: Placeholders: %1$s - payment gateway title, %2$s -
|
1593 |
+
#. message/error
|
1594 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:2875
|
1595 |
+
msgid "%1$s Transaction Cancelled (%2$s)"
|
1596 |
+
msgstr "%1$s: tehing tühistatud (%2$s)"
|
1597 |
+
|
1598 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:3119
|
1599 |
+
msgid "Transaction Type"
|
1600 |
+
msgstr "Tehingu tüüp"
|
1601 |
+
|
1602 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:3121
|
1603 |
+
msgid ""
|
1604 |
+
"Select how transactions should be processed. Charge submits all transactions "
|
1605 |
+
"for settlement, Authorization simply authorizes the order total for capture "
|
1606 |
+
"later."
|
1607 |
+
msgstr ""
|
1608 |
+
"Vali, kuidas peaks tehinguid töötlema. \"Makse\" saadab kõik tehingud "
|
1609 |
+
"koheselt tasumisele, \"Autoriseerimine\" lihtsalt autoriseerib tellimuse "
|
1610 |
+
"summa hilisemaks tasumiseks."
|
1611 |
+
|
1612 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:3132
|
1613 |
+
msgid "Charge Virtual-Only Orders"
|
1614 |
+
msgstr ""
|
1615 |
+
|
1616 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:3134
|
1617 |
+
msgid ""
|
1618 |
+
"If the order contains exclusively virtual items, enable this to immediately "
|
1619 |
+
"charge, rather than authorize, the transaction."
|
1620 |
+
msgstr ""
|
1621 |
+
|
1622 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:3142
|
1623 |
+
#, fuzzy
|
1624 |
+
msgid "Enable Partial Capture"
|
1625 |
+
msgstr "Lülita see makseviis sisse"
|
1626 |
+
|
1627 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:3144
|
1628 |
+
msgid "Allow orders to be partially captured multiple times."
|
1629 |
+
msgstr ""
|
1630 |
+
|
1631 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:3154
|
1632 |
+
#, fuzzy
|
1633 |
+
msgid "Capture Paid Orders"
|
1634 |
+
msgstr "Teosta makse"
|
1635 |
+
|
1636 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:3157
|
1637 |
+
msgid "Automatically capture orders when they are changed to %s."
|
1638 |
+
msgstr ""
|
1639 |
+
|
1640 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:3158
|
1641 |
+
msgid "a paid status"
|
1642 |
+
msgstr ""
|
1643 |
+
|
1644 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:3427
|
1645 |
+
#, fuzzy
|
1646 |
+
msgid "Accepted Card Logos"
|
1647 |
+
msgstr "Vastuvõetavad kaardid"
|
1648 |
+
|
1649 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:3429
|
1650 |
+
#, fuzzy
|
1651 |
+
msgid ""
|
1652 |
+
"These are the card logos that are displayed to customers as accepted during "
|
1653 |
+
"checkout."
|
1654 |
+
msgstr "Kliendile kassas nähtav makseviisi nimetus."
|
1655 |
+
|
1656 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:3430
|
1657 |
+
msgid ""
|
1658 |
+
"This can be configured to match those accepted by your payment processor, "
|
1659 |
+
"but does not change your merchant account configuration."
|
1660 |
+
msgstr ""
|
1661 |
+
|
1662 |
+
#. translators:
|
1663 |
+
#. http:www.cybersource.com/products/payment_security/payment_tokenization/ and
|
1664 |
+
#. https:en.wikipedia.org/wiki/Tokenization_(data_security)
|
1665 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:3518
|
1666 |
+
msgid "Tokenization"
|
1667 |
+
msgstr "Maksevahendite salvestamine"
|
1668 |
+
|
1669 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:3519
|
1670 |
+
msgid ""
|
1671 |
+
"Allow customers to securely save their payment details for future checkout."
|
1672 |
+
msgstr ""
|
1673 |
+
"Võimalda klientidel oma makseandmeid edaspidisteks tehinguteks turvaliselt "
|
1674 |
+
"talletada."
|
1675 |
+
|
1676 |
+
#: payment-gateway/integrations/class-sv-wc-payment-gateway-integration-pre-orders.php:250
|
1677 |
+
msgid "Pre-Order Tokenization attempt failed (%s)"
|
1678 |
+
msgstr ""
|
1679 |
+
|
1680 |
+
#: payment-gateway/integrations/class-sv-wc-payment-gateway-integration-pre-orders.php:294
|
1681 |
+
msgid "%s - Pre-Order Release Payment for Order %s"
|
1682 |
+
msgstr ""
|
1683 |
+
|
1684 |
+
#: payment-gateway/integrations/class-sv-wc-payment-gateway-integration-pre-orders.php:298
|
1685 |
+
msgid "Payment token missing/invalid."
|
1686 |
+
msgstr "Maksevahend on puudu või vigane."
|
1687 |
+
|
1688 |
+
#: payment-gateway/integrations/class-sv-wc-payment-gateway-integration-pre-orders.php:323
|
1689 |
+
msgid "%s %s Pre-Order Release Payment Approved: %s ending in %s (expires %s)"
|
1690 |
+
msgstr ""
|
1691 |
+
|
1692 |
+
#: payment-gateway/integrations/class-sv-wc-payment-gateway-integration-pre-orders.php:334
|
1693 |
+
msgid "%s eCheck Pre-Order Release Payment Approved: %s ending in %s"
|
1694 |
+
msgstr ""
|
1695 |
+
|
1696 |
+
#: payment-gateway/integrations/class-sv-wc-payment-gateway-integration-pre-orders.php:376
|
1697 |
+
msgid "Pre-Order Release Payment Failed: %s"
|
1698 |
+
msgstr "Eeltellimuse väljastamise makse ebaõnnestus: %s"
|
1699 |
+
|
1700 |
+
#: payment-gateway/integrations/class-sv-wc-payment-gateway-integration-subscriptions.php:212
|
1701 |
+
msgid "Subscription Renewal: payment token is missing/invalid."
|
1702 |
+
msgstr ""
|
1703 |
+
|
1704 |
+
#: payment-gateway/integrations/class-sv-wc-payment-gateway-integration-subscriptions.php:238
|
1705 |
+
msgid "%1$s - Subscription Renewal Order %2$s"
|
1706 |
+
msgstr ""
|
1707 |
+
|
1708 |
+
#. translators: Placeholders: %1$s - payment gateway title, %2$s - error
|
1709 |
+
#. message; e.g. Order Note: [Payment method] Payment Change failed [error]
|
1710 |
+
#: payment-gateway/integrations/class-sv-wc-payment-gateway-integration-subscriptions.php:370
|
1711 |
+
#, fuzzy
|
1712 |
+
msgid "%1$s Payment Change Failed (%2$s)"
|
1713 |
+
msgstr "%1$s: makse ebaõnnestus (%2$s)"
|
1714 |
+
|
1715 |
+
#: payment-gateway/integrations/class-sv-wc-payment-gateway-integration-subscriptions.php:510
|
1716 |
+
msgid "Via %s ending in %s"
|
1717 |
+
msgstr ""
|
1718 |
+
|
1719 |
+
#: payment-gateway/integrations/class-sv-wc-payment-gateway-integration-subscriptions.php:537
|
1720 |
+
msgid "Subscriptions"
|
1721 |
+
msgstr ""
|
1722 |
+
|
1723 |
+
#: payment-gateway/integrations/class-sv-wc-payment-gateway-integration-subscriptions.php:605
|
1724 |
+
msgid ""
|
1725 |
+
"This payment method is tied to a subscription and cannot be deleted. Please "
|
1726 |
+
"switch the subscription to another method first."
|
1727 |
+
msgstr ""
|
1728 |
+
|
1729 |
+
#: payment-gateway/integrations/class-sv-wc-payment-gateway-integration-subscriptions.php:656
|
1730 |
+
msgid "Payment Token"
|
1731 |
+
msgstr ""
|
1732 |
+
|
1733 |
+
#: payment-gateway/integrations/class-sv-wc-payment-gateway-integration-subscriptions.php:684
|
1734 |
+
#: payment-gateway/integrations/class-sv-wc-payment-gateway-integration-subscriptions.php:689
|
1735 |
+
msgid "%s is required."
|
1736 |
+
msgstr ""
|
1737 |
+
|
1738 |
+
#: payment-gateway/payment-tokens/class-sv-wc-payment-gateway-payment-tokens-handler.php:157
|
1739 |
+
msgid "Unknown Error"
|
1740 |
+
msgstr "Esines tundmatu viga"
|
1741 |
+
|
1742 |
+
#: utilities/class-sv-wp-background-job-handler.php:640
|
1743 |
+
msgid "Job data key \"%s\" not set"
|
1744 |
+
msgstr ""
|
1745 |
+
|
1746 |
+
#: utilities/class-sv-wp-background-job-handler.php:644
|
1747 |
+
msgid "Job data key \"%s\" is not an array"
|
1748 |
+
msgstr ""
|
1749 |
+
|
1750 |
+
#: utilities/class-sv-wp-background-job-handler.php:877
|
1751 |
+
msgid "Every %d Minutes"
|
1752 |
+
msgstr ""
|
1753 |
+
|
1754 |
+
#: utilities/class-sv-wp-background-job-handler.php:1040
|
1755 |
+
msgid "Background Processing Test"
|
1756 |
+
msgstr ""
|
1757 |
+
|
1758 |
+
#: utilities/class-sv-wp-background-job-handler.php:1041
|
1759 |
+
#, fuzzy
|
1760 |
+
msgid "Run Test"
|
1761 |
+
msgstr "test"
|
1762 |
+
|
1763 |
+
#: utilities/class-sv-wp-background-job-handler.php:1042
|
1764 |
+
msgid ""
|
1765 |
+
"This tool will test whether your server is capable of processing background "
|
1766 |
+
"jobs."
|
1767 |
+
msgstr ""
|
1768 |
+
|
1769 |
+
#: utilities/class-sv-wp-background-job-handler.php:1060
|
1770 |
+
msgid "Success! You should be able to process background jobs."
|
1771 |
+
msgstr ""
|
1772 |
+
|
1773 |
+
#: utilities/class-sv-wp-background-job-handler.php:1063
|
1774 |
+
msgid ""
|
1775 |
+
"Could not connect. Please ask your hosting company to ensure your server has "
|
1776 |
+
"loopback connections enabled."
|
1777 |
+
msgstr ""
|
1778 |
+
|
1779 |
+
#: admin/abstract-sv-wc-plugin-admin-setup-wizard.php:397
|
1780 |
+
msgctxt "enhanced select"
|
1781 |
+
msgid "No matches found"
|
1782 |
+
msgstr ""
|
1783 |
+
|
1784 |
+
#: admin/abstract-sv-wc-plugin-admin-setup-wizard.php:398
|
1785 |
+
msgctxt "enhanced select"
|
1786 |
+
msgid "Loading failed"
|
1787 |
+
msgstr ""
|
1788 |
+
|
1789 |
+
#: admin/abstract-sv-wc-plugin-admin-setup-wizard.php:399
|
1790 |
+
msgctxt "enhanced select"
|
1791 |
+
msgid "Please enter 1 or more characters"
|
1792 |
+
msgstr ""
|
1793 |
+
|
1794 |
+
#: admin/abstract-sv-wc-plugin-admin-setup-wizard.php:400
|
1795 |
+
msgctxt "enhanced select"
|
1796 |
+
msgid "Please enter %qty% or more characters"
|
1797 |
+
msgstr ""
|
1798 |
+
|
1799 |
+
#: admin/abstract-sv-wc-plugin-admin-setup-wizard.php:401
|
1800 |
+
msgctxt "enhanced select"
|
1801 |
+
msgid "Please delete 1 character"
|
1802 |
+
msgstr ""
|
1803 |
+
|
1804 |
+
#: admin/abstract-sv-wc-plugin-admin-setup-wizard.php:402
|
1805 |
+
msgctxt "enhanced select"
|
1806 |
+
msgid "Please delete %qty% characters"
|
1807 |
+
msgstr ""
|
1808 |
+
|
1809 |
+
#: admin/abstract-sv-wc-plugin-admin-setup-wizard.php:403
|
1810 |
+
msgctxt "enhanced select"
|
1811 |
+
msgid "You can only select 1 item"
|
1812 |
+
msgstr ""
|
1813 |
+
|
1814 |
+
#: admin/abstract-sv-wc-plugin-admin-setup-wizard.php:404
|
1815 |
+
msgctxt "enhanced select"
|
1816 |
+
msgid "You can only select %qty% items"
|
1817 |
+
msgstr ""
|
1818 |
+
|
1819 |
+
#: admin/abstract-sv-wc-plugin-admin-setup-wizard.php:405
|
1820 |
+
msgctxt "enhanced select"
|
1821 |
+
msgid "Loading more results…"
|
1822 |
+
msgstr ""
|
1823 |
+
|
1824 |
+
#: admin/abstract-sv-wc-plugin-admin-setup-wizard.php:406
|
1825 |
+
msgctxt "enhanced select"
|
1826 |
+
msgid "Searching…"
|
1827 |
+
msgstr ""
|
1828 |
+
|
1829 |
+
#: class-sv-wc-helper.php:407
|
1830 |
+
msgctxt "coordinating conjunction for a list of items: a, b, and c"
|
1831 |
+
msgid "and"
|
1832 |
+
msgstr ""
|
1833 |
+
|
1834 |
+
#: class-sv-wc-plugin.php:530
|
1835 |
+
msgctxt "noun"
|
1836 |
+
msgid "Support"
|
1837 |
+
msgstr "Kasutajatugi"
|
1838 |
+
|
1839 |
+
#: class-sv-wc-plugin.php:535
|
1840 |
+
msgctxt "verb"
|
1841 |
+
msgid "Review"
|
1842 |
+
msgstr ""
|
1843 |
+
|
1844 |
+
#: payment-gateway/class-sv-wc-payment-gateway-direct.php:639
|
1845 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:2663
|
1846 |
+
msgctxt "noun, software environment"
|
1847 |
+
msgid "Test"
|
1848 |
+
msgstr "test"
|
1849 |
+
|
1850 |
+
#: payment-gateway/class-sv-wc-payment-gateway-direct.php:640
|
1851 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:2664
|
1852 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:3125
|
1853 |
+
msgctxt "credit card transaction type"
|
1854 |
+
msgid "Authorization"
|
1855 |
+
msgstr "Autoriseerimine"
|
1856 |
+
|
1857 |
+
#: payment-gateway/class-sv-wc-payment-gateway-direct.php:640
|
1858 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:2664
|
1859 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:3124
|
1860 |
+
msgctxt "noun, credit card transaction type"
|
1861 |
+
msgid "Charge"
|
1862 |
+
msgstr "Makse"
|
1863 |
+
|
1864 |
+
#: payment-gateway/class-sv-wc-payment-gateway-helper.php:192
|
1865 |
+
msgctxt "payment method type"
|
1866 |
+
msgid "Account"
|
1867 |
+
msgstr "Konto"
|
1868 |
+
|
1869 |
+
#: payment-gateway/class-sv-wc-payment-gateway-helper.php:227
|
1870 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:3455
|
1871 |
+
msgctxt "credit card type"
|
1872 |
+
msgid "Visa"
|
1873 |
+
msgstr "Visa"
|
1874 |
+
|
1875 |
+
#: payment-gateway/class-sv-wc-payment-gateway-helper.php:231
|
1876 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:3456
|
1877 |
+
msgctxt "credit card type"
|
1878 |
+
msgid "MasterCard"
|
1879 |
+
msgstr "MasterCard"
|
1880 |
+
|
1881 |
+
#: payment-gateway/class-sv-wc-payment-gateway-helper.php:235
|
1882 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:3457
|
1883 |
+
msgctxt "credit card type"
|
1884 |
+
msgid "American Express"
|
1885 |
+
msgstr "American Express"
|
1886 |
+
|
1887 |
+
#: payment-gateway/class-sv-wc-payment-gateway-helper.php:239
|
1888 |
+
msgctxt "credit card type"
|
1889 |
+
msgid "Diners Club"
|
1890 |
+
msgstr ""
|
1891 |
+
|
1892 |
+
#: payment-gateway/class-sv-wc-payment-gateway-helper.php:243
|
1893 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:3458
|
1894 |
+
msgctxt "credit card type"
|
1895 |
+
msgid "Discover"
|
1896 |
+
msgstr "Discover"
|
1897 |
+
|
1898 |
+
#: payment-gateway/class-sv-wc-payment-gateway-helper.php:247
|
1899 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:3460
|
1900 |
+
msgctxt "credit card type"
|
1901 |
+
msgid "JCB"
|
1902 |
+
msgstr "JCB"
|
1903 |
+
|
1904 |
+
#: payment-gateway/class-sv-wc-payment-gateway-helper.php:251
|
1905 |
+
msgctxt "credit card type"
|
1906 |
+
msgid "CarteBleue"
|
1907 |
+
msgstr "CarteBleue"
|
1908 |
+
|
1909 |
+
#: payment-gateway/class-sv-wc-payment-gateway-helper.php:255
|
1910 |
+
msgctxt "credit card type"
|
1911 |
+
msgid "Maestro"
|
1912 |
+
msgstr ""
|
1913 |
+
|
1914 |
+
#: payment-gateway/class-sv-wc-payment-gateway-helper.php:259
|
1915 |
+
msgctxt "credit card type"
|
1916 |
+
msgid "Laser"
|
1917 |
+
msgstr ""
|
1918 |
+
|
1919 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:3459
|
1920 |
+
msgctxt "credit card type"
|
1921 |
+
msgid "Diners"
|
1922 |
+
msgstr "Diners"
|
1923 |
+
|
1924 |
+
#. translators: http:www.investopedia.com/terms/c/checkingaccount.asp
|
1925 |
+
#: payment-gateway/class-sv-wc-payment-gateway-payment-form.php:427
|
1926 |
+
msgctxt "account type"
|
1927 |
+
msgid "Checking"
|
1928 |
+
msgstr "Tšekikonto"
|
1929 |
+
|
1930 |
+
#. translators: http:www.investopedia.com/terms/s/savingsaccount.asp
|
1931 |
+
#: payment-gateway/class-sv-wc-payment-gateway-payment-form.php:429
|
1932 |
+
msgctxt "account type"
|
1933 |
+
msgid "Savings"
|
1934 |
+
msgstr "Hoiuarve"
|
1935 |
+
|
1936 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:2450
|
1937 |
+
msgctxt "hash before order number"
|
1938 |
+
msgid "#"
|
1939 |
+
msgstr "#"
|
1940 |
+
|
1941 |
+
#: payment-gateway/integrations/class-sv-wc-payment-gateway-integration-subscriptions.php:567
|
1942 |
+
msgctxt "hash before order number"
|
1943 |
+
msgid "#%s"
|
1944 |
+
msgstr ""
|
1945 |
+
|
1946 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:3151
|
1947 |
+
msgctxt ""
|
1948 |
+
"coordinating conjunction for a list of order statuses: on-hold, processing, "
|
1949 |
+
"or completed"
|
1950 |
+
msgid "or"
|
1951 |
+
msgstr ""
|
1952 |
+
|
1953 |
+
#. translators: https:www.skyverge.com/for-translators-environments/
|
1954 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:4055
|
1955 |
+
msgctxt "software environment"
|
1956 |
+
msgid "Production"
|
1957 |
+
msgstr "Töö/avalik"
|
1958 |
+
|
1959 |
+
#~ msgid "Dismiss"
|
1960 |
+
#~ msgstr "Loobu"
|
1961 |
+
|
1962 |
+
#~ msgid "(check number %s)"
|
1963 |
+
#~ msgstr "(tšeki number %s)"
|
1964 |
+
|
1965 |
+
#~ msgid "Make Default"
|
1966 |
+
#~ msgstr "Määra vaikimisi valikuks"
|
1967 |
+
|
1968 |
+
#~ msgid "ending in %s"
|
1969 |
+
#~ msgstr "lõpeb numbritega %s"
|
1970 |
+
|
1971 |
+
#~ msgid "Default payment method updated."
|
1972 |
+
#~ msgstr "Vaikimisi maksevahend muudetud."
|
1973 |
+
|
1974 |
+
#~ msgid "Select which card types you accept."
|
1975 |
+
#~ msgstr "Vali, millist tüüpi kaarte soovid vastu võtta."
|
1976 |
+
|
1977 |
+
#~ msgid ""
|
1978 |
+
#~ "The following plugins are inactive because they require a newer version "
|
1979 |
+
#~ "to function properly:"
|
1980 |
+
#~ msgstr ""
|
1981 |
+
#~ "Järgnevad pluginad ei ole aktiivsed ja vajavad toimimiseks uuendamist:"
|
1982 |
+
|
1983 |
+
#~ msgid ""
|
1984 |
+
#~ "The following plugin is inactive because it requires a newer version to "
|
1985 |
+
#~ "function properly:"
|
1986 |
+
#~ msgstr "Järgnev plugin ei ole aktiivne ja vajab toimimiseks uuendamist:"
|
1987 |
+
|
1988 |
+
#~ msgid ""
|
1989 |
+
#~ "To reactivate these plugins, please %1$supdate now (recommended)%2$s "
|
1990 |
+
#~ "%3$sor%4$s %5$sdeactivate the following%6$s:"
|
1991 |
+
#~ msgstr ""
|
1992 |
+
#~ "Et neid pluginaid taas sisse lülitada, %1$suuenda palun kohe "
|
1993 |
+
#~ "(soovitatud)%2$s %3$svõi%4$s %5$slülita järgnevad välja%6$s:"
|
1994 |
+
|
1995 |
+
#~ msgid ""
|
1996 |
+
#~ "To reactivate this plugin, please %1$supdate now (recommended)%2$s %3$sor"
|
1997 |
+
#~ "%4$s %5$sdeactivate the following%6$s:"
|
1998 |
+
#~ msgstr ""
|
1999 |
+
#~ "Et see plugin taas sisse lülitada, %1$suuenda palun kohe (soovitatud)%2$s "
|
2000 |
+
#~ "%3$svõi%4$s %5$slülita järgnevad välja%6$s:"
|
2001 |
+
|
2002 |
+
#~ msgid "%s Customer Details"
|
2003 |
+
#~ msgstr "%s: kliendi andmed"
|
2004 |
+
|
2005 |
+
#~ msgid "Customer ID (%s)"
|
2006 |
+
#~ msgstr "Kliendi ID (%s)"
|
2007 |
+
|
2008 |
+
#~ msgid ""
|
2009 |
+
#~ "The gateway customer ID for the user in the %s environment. Only edit "
|
2010 |
+
#~ "this if necessary."
|
2011 |
+
#~ msgstr ""
|
2012 |
+
#~ "Kasutajale makseviisi poolt määratud kliendi tunnus %s keskkonnas. Muuda "
|
2013 |
+
#~ "seda ainult siis, kui tõesti vajalik."
|
2014 |
+
|
2015 |
+
#~ msgid "Payment Tokens"
|
2016 |
+
#~ msgstr "Maksevahendid"
|
2017 |
+
|
2018 |
+
#~ msgid "This customer has no saved payment tokens"
|
2019 |
+
#~ msgstr "Sel kliendil ei ole salvestatud maksevahendeid"
|
2020 |
+
|
2021 |
+
#~ msgid "Default card"
|
2022 |
+
#~ msgstr "Vaikimisi kaart"
|
2023 |
+
|
2024 |
+
#~ msgid "Add a Payment Token"
|
2025 |
+
#~ msgstr "Lisa maksevahend"
|
2026 |
+
|
2027 |
+
#~ msgid "Token"
|
2028 |
+
#~ msgstr "Vahend"
|
2029 |
+
|
2030 |
+
#~ msgid "%s Subscription Renewal Approved"
|
2031 |
+
#~ msgstr "Korduvtellimus summas %s uuendus kinnitatud"
|
2032 |
+
|
2033 |
+
#~ msgid "Subscription Renewal: Payment Token or User ID is missing/invalid."
|
2034 |
+
#~ msgstr ""
|
2035 |
+
#~ "Korduvtellimuse uuendus: maksevahend või kasutajatunnus on puudu või "
|
2036 |
+
#~ "vigane."
|
2037 |
+
|
2038 |
+
#~ msgid ""
|
2039 |
+
#~ "%1$s %2$s Subscription Renewal Payment Approved: %3$s ending in %4$s "
|
2040 |
+
#~ "(expires %5$s)"
|
2041 |
+
#~ msgstr ""
|
2042 |
+
#~ "%1$s: %2$s korduvtellimuse uuendamise makse kinnitatud: %3$s lõpeb "
|
2043 |
+
#~ "numbritega %4$s (aegub %5$s)"
|
2044 |
+
|
2045 |
+
#~ msgid ""
|
2046 |
+
#~ "%1$s Check Subscription Renewal Payment Approved: %2$s account ending in "
|
2047 |
+
#~ "%3$s"
|
2048 |
+
#~ msgstr ""
|
2049 |
+
#~ "%1$s: tšekiga tasutav korduvtellimuse uuendamise makse kinnitatud: %2$s "
|
2050 |
+
#~ "konto, lõpeb numbritega %3$s"
|
2051 |
+
|
2052 |
+
#~ msgid "Via %1$s ending in %2$s"
|
2053 |
+
#~ msgstr "%1$s, lõpeb numbritega %2$s"
|
2054 |
+
|
2055 |
+
#~ msgid "%1$s Pre-Order Tokenization attempt failed (%2$s)"
|
2056 |
+
#~ msgstr ""
|
2057 |
+
#~ "%1$s: eeltellimuse maksevahendi salvestamise katse ebaõnnestus (%2$s)"
|
2058 |
+
|
2059 |
+
#~ msgid "%1$s - Pre-Order Release Payment for Order %2$s"
|
2060 |
+
#~ msgstr "%1$s - Eeltellimuse väljastamise makse tellimuse %2$s eest"
|
2061 |
+
|
2062 |
+
#~ msgid ""
|
2063 |
+
#~ "%1$s %2$s Pre-Order Release Payment Approved: %3$s ending in %4$s "
|
2064 |
+
#~ "(expires %5$s)"
|
2065 |
+
#~ msgstr ""
|
2066 |
+
#~ "%1$s: %2$s eeltellimuse väljastamise makse vastu kinnitatud: %3$s lõpeb "
|
2067 |
+
#~ "numbritega %4$s (aegub %5$s)"
|
2068 |
+
|
2069 |
+
#~ msgid "%1$s eCheck Pre-Order Release Payment Approved: %2$s ending in %3$s"
|
2070 |
+
#~ msgstr ""
|
2071 |
+
#~ "%1$s: e-tšeki eeltellimuse väljastamise makse kinnitatud: %2$s lõpeb "
|
2072 |
+
#~ "numbritega %3$s"
|
2073 |
+
|
2074 |
+
#~ msgid "IPN processing error: %s duplicate transaction received"
|
2075 |
+
#~ msgstr "IPN töötlemise viga: %s duplikaattehing"
|
2076 |
+
|
2077 |
+
#~ msgid "%1$s %2$s Transaction Approved: %3$s ending in %4$s"
|
2078 |
+
#~ msgstr "%1$s: %2$s tehing kinnitatud: %3$s lõpeb numbritega %4$s"
|
2079 |
+
|
2080 |
+
#~ msgctxt "Supports capture charge"
|
2081 |
+
#~ msgid "Capture Charge"
|
2082 |
+
#~ msgstr "Makse "
|
lib/skyverge/woocommerce/i18n/languages/woocommerce-plugin-framework.pot
ADDED
@@ -0,0 +1,1886 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Copyright (C) 2018
|
2 |
+
# This file is distributed under the same license as the package.
|
3 |
+
msgid ""
|
4 |
+
msgstr ""
|
5 |
+
"Project-Id-Version: WooCommerce Plugin Framework 5.3.0\n"
|
6 |
+
"Report-Msgid-Bugs-To: https://support.woocommerce.com/hc/\n"
|
7 |
+
"POT-Creation-Date: 2015-07-22 12:09:16+00:00\n"
|
8 |
+
"MIME-Version: 1.0\n"
|
9 |
+
"Content-Type: text/plain; charset=utf-8\n"
|
10 |
+
"Content-Transfer-Encoding: 8bit\n"
|
11 |
+
"PO-Revision-Date: 2018-MO-DA HO:MI+ZONE\n"
|
12 |
+
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
13 |
+
"Language-Team: LANGUAGE <LL@li.org>\n"
|
14 |
+
|
15 |
+
#: Lifecycle.php:354
|
16 |
+
msgid "Awesome"
|
17 |
+
msgstr ""
|
18 |
+
|
19 |
+
#: Lifecycle.php:355
|
20 |
+
msgid "Fantastic"
|
21 |
+
msgstr ""
|
22 |
+
|
23 |
+
#: Lifecycle.php:356
|
24 |
+
msgid "Cowabunga"
|
25 |
+
msgstr ""
|
26 |
+
|
27 |
+
#: Lifecycle.php:357
|
28 |
+
msgid "Congratulations"
|
29 |
+
msgstr ""
|
30 |
+
|
31 |
+
#: Lifecycle.php:358
|
32 |
+
msgid "Hot dog"
|
33 |
+
msgstr ""
|
34 |
+
|
35 |
+
#: Lifecycle.php:365
|
36 |
+
#. translators: Placeholders: %1$s - plugin name, %2$s - <a> tag, %3$s - </a>
|
37 |
+
#. tag, %4$s - <a> tag, %5$s - </a> tag
|
38 |
+
msgid ""
|
39 |
+
"Are you having a great experience with %1$s so far? Please consider "
|
40 |
+
"%2$sleaving a review%3$s! If things aren't going quite as expected, we're "
|
41 |
+
"happy to help -- please %4$sreach out to our support team%5$s."
|
42 |
+
msgstr ""
|
43 |
+
|
44 |
+
#: admin/abstract-sv-wc-plugin-admin-setup-wizard.php:183
|
45 |
+
msgid ""
|
46 |
+
"Thanks for installing %1$s! To get started, take a minute to %2$sread the "
|
47 |
+
"documentation%3$s :)"
|
48 |
+
msgstr ""
|
49 |
+
|
50 |
+
#: admin/abstract-sv-wc-plugin-admin-setup-wizard.php:211
|
51 |
+
msgid ""
|
52 |
+
"Thanks for installing %1$s! To get started, take a minute to complete these "
|
53 |
+
"%2$squick and easy setup steps%3$s :)"
|
54 |
+
msgstr ""
|
55 |
+
|
56 |
+
#: admin/abstract-sv-wc-plugin-admin-setup-wizard.php:236
|
57 |
+
msgid "Setup"
|
58 |
+
msgstr ""
|
59 |
+
|
60 |
+
#: admin/abstract-sv-wc-plugin-admin-setup-wizard.php:304
|
61 |
+
#. translators: Placeholders: %s - plugin name
|
62 |
+
msgid "%s › Setup"
|
63 |
+
msgstr ""
|
64 |
+
|
65 |
+
#: admin/abstract-sv-wc-plugin-admin-setup-wizard.php:352
|
66 |
+
msgid "Oops! An error occurred, please try again."
|
67 |
+
msgstr ""
|
68 |
+
|
69 |
+
#: admin/abstract-sv-wc-plugin-admin-setup-wizard.php:493
|
70 |
+
msgid "Ready!"
|
71 |
+
msgstr ""
|
72 |
+
|
73 |
+
#: admin/abstract-sv-wc-plugin-admin-setup-wizard.php:586
|
74 |
+
#. translators: Placeholder: %s - plugin name
|
75 |
+
msgid "Welcome to %s!"
|
76 |
+
msgstr ""
|
77 |
+
|
78 |
+
#: admin/abstract-sv-wc-plugin-admin-setup-wizard.php:599
|
79 |
+
msgid ""
|
80 |
+
"This quick setup wizard will help you configure the basic settings and get "
|
81 |
+
"you started."
|
82 |
+
msgstr ""
|
83 |
+
|
84 |
+
#: admin/abstract-sv-wc-plugin-admin-setup-wizard.php:613
|
85 |
+
msgid "%s is ready!"
|
86 |
+
msgstr ""
|
87 |
+
|
88 |
+
#: admin/abstract-sv-wc-plugin-admin-setup-wizard.php:665
|
89 |
+
msgid "Next step"
|
90 |
+
msgstr ""
|
91 |
+
|
92 |
+
#: admin/abstract-sv-wc-plugin-admin-setup-wizard.php:691
|
93 |
+
msgid "You can also:"
|
94 |
+
msgstr ""
|
95 |
+
|
96 |
+
#: admin/abstract-sv-wc-plugin-admin-setup-wizard.php:735
|
97 |
+
#: admin/abstract-sv-wc-plugin-admin-setup-wizard.php:765
|
98 |
+
msgid "View the Docs"
|
99 |
+
msgstr ""
|
100 |
+
|
101 |
+
#: admin/abstract-sv-wc-plugin-admin-setup-wizard.php:736
|
102 |
+
msgid "See more setup options"
|
103 |
+
msgstr ""
|
104 |
+
|
105 |
+
#: admin/abstract-sv-wc-plugin-admin-setup-wizard.php:737
|
106 |
+
msgid "Learn more about customizing the plugin"
|
107 |
+
msgstr ""
|
108 |
+
|
109 |
+
#: admin/abstract-sv-wc-plugin-admin-setup-wizard.php:761
|
110 |
+
msgid "Review Your Settings"
|
111 |
+
msgstr ""
|
112 |
+
|
113 |
+
#: admin/abstract-sv-wc-plugin-admin-setup-wizard.php:769
|
114 |
+
msgid "Leave a Review"
|
115 |
+
msgstr ""
|
116 |
+
|
117 |
+
#: admin/abstract-sv-wc-plugin-admin-setup-wizard.php:793
|
118 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:659
|
119 |
+
msgid "Continue"
|
120 |
+
msgstr ""
|
121 |
+
|
122 |
+
#: admin/abstract-sv-wc-plugin-admin-setup-wizard.php:953
|
123 |
+
msgid "Return to the WordPress Dashboard"
|
124 |
+
msgstr ""
|
125 |
+
|
126 |
+
#: admin/abstract-sv-wc-plugin-admin-setup-wizard.php:955
|
127 |
+
msgid "Not right now"
|
128 |
+
msgstr ""
|
129 |
+
|
130 |
+
#: admin/abstract-sv-wc-plugin-admin-setup-wizard.php:957
|
131 |
+
msgid "Skip this step"
|
132 |
+
msgstr ""
|
133 |
+
|
134 |
+
#: class-sv-wc-framework-bootstrap.php:268
|
135 |
+
msgid ""
|
136 |
+
"The following plugin is disabled because it is out of date and incompatible "
|
137 |
+
"with newer plugins on your site:"
|
138 |
+
msgid_plural ""
|
139 |
+
"The following plugins are disabled because they are out of date and "
|
140 |
+
"incompatible with newer plugins on your site:"
|
141 |
+
msgstr[0] ""
|
142 |
+
msgstr[1] ""
|
143 |
+
|
144 |
+
#: class-sv-wc-framework-bootstrap.php:282
|
145 |
+
msgid ""
|
146 |
+
"To resolve this, please %1$supdate%2$s (recommended) %3$sor%4$s "
|
147 |
+
"%5$sdeactivate%6$s the above plugin, or %7$sdeactivate the following%8$s:"
|
148 |
+
msgid_plural ""
|
149 |
+
"To resolve this, please %1$supdate%2$s (recommended) %3$sor%4$s "
|
150 |
+
"%5$sdeactivate%6$s the above plugins, or %7$sdeactivate the following%8$s:"
|
151 |
+
msgstr[0] ""
|
152 |
+
msgstr[1] ""
|
153 |
+
|
154 |
+
#: class-sv-wc-framework-bootstrap.php:303
|
155 |
+
msgid ""
|
156 |
+
"The following plugins are inactive because they require a newer version of "
|
157 |
+
"WooCommerce:"
|
158 |
+
msgstr ""
|
159 |
+
|
160 |
+
#: class-sv-wc-framework-bootstrap.php:303
|
161 |
+
msgid ""
|
162 |
+
"The following plugin is inactive because it requires a newer version of "
|
163 |
+
"WooCommerce:"
|
164 |
+
msgstr ""
|
165 |
+
|
166 |
+
#: class-sv-wc-framework-bootstrap.php:308
|
167 |
+
#. translators: Placeholders: %1$s - plugin name, %2$s - WooCommerce version
|
168 |
+
#. number
|
169 |
+
msgid "%1$s requires WooCommerce %2$s or newer"
|
170 |
+
msgstr ""
|
171 |
+
|
172 |
+
#: class-sv-wc-framework-bootstrap.php:312
|
173 |
+
#. translators: Placeholders: %1$s - <a> tag, %2$s - </a> tag
|
174 |
+
msgid "Please %1$supdate WooCommerce%2$s"
|
175 |
+
msgstr ""
|
176 |
+
|
177 |
+
#: class-sv-wc-plugin-compatibility.php:278
|
178 |
+
msgid "WooCommerce"
|
179 |
+
msgstr ""
|
180 |
+
|
181 |
+
#: class-sv-wc-plugin-dependencies.php:148
|
182 |
+
#. translators: Placeholders: %1$s - plugin name, %2$s - a PHP
|
183 |
+
#. extension/comma-separated list of PHP extensions
|
184 |
+
msgid ""
|
185 |
+
"%1$s requires the %2$s PHP extension to function. Contact your host or "
|
186 |
+
"server administrator to install and configure the missing extension."
|
187 |
+
msgid_plural ""
|
188 |
+
"%1$s requires the following PHP extensions to function: %2$s. Contact your "
|
189 |
+
"host or server administrator to install and configure the missing "
|
190 |
+
"extensions."
|
191 |
+
msgstr[0] ""
|
192 |
+
msgstr[1] ""
|
193 |
+
|
194 |
+
#: class-sv-wc-plugin-dependencies.php:176
|
195 |
+
#. translators: Placeholders: %1$s - plugin name, %2$s - a PHP
|
196 |
+
#. function/comma-separated list of PHP functions
|
197 |
+
msgid ""
|
198 |
+
"%1$s requires the %2$s PHP function to exist. Contact your host or server "
|
199 |
+
"administrator to install and configure the missing function."
|
200 |
+
msgid_plural ""
|
201 |
+
"%1$s requires the following PHP functions to exist: %2$s. Contact your "
|
202 |
+
"host or server administrator to install and configure the missing functions."
|
203 |
+
msgstr[0] ""
|
204 |
+
msgstr[1] ""
|
205 |
+
|
206 |
+
#: class-sv-wc-plugin-dependencies.php:206
|
207 |
+
#. translators: Placeholders: %s - plugin name
|
208 |
+
msgid ""
|
209 |
+
"%s may behave unexpectedly because the following PHP configuration settings "
|
210 |
+
"are required:"
|
211 |
+
msgstr ""
|
212 |
+
|
213 |
+
#: class-sv-wc-plugin-dependencies.php:220
|
214 |
+
msgid "%s or higher"
|
215 |
+
msgstr ""
|
216 |
+
|
217 |
+
#: class-sv-wc-plugin-dependencies.php:230
|
218 |
+
msgid ""
|
219 |
+
"Please contact your hosting provider or server administrator to configure "
|
220 |
+
"these settings."
|
221 |
+
msgstr ""
|
222 |
+
|
223 |
+
#: class-sv-wc-plugin-dependencies.php:252
|
224 |
+
#. translators: Placeholders: %1$s - <strong>, %2$s - </strong>
|
225 |
+
msgid ""
|
226 |
+
"Hey there! We've noticed that your server is running %1$san outdated "
|
227 |
+
"version of PHP%2$s, which is the programming language that WooCommerce and "
|
228 |
+
"its extensions are built on.\n"
|
229 |
+
"\t\t\t\t\tThe PHP version that is currently used for your site is no longer "
|
230 |
+
"maintained, nor %1$sreceives security updates%2$s; newer versions are "
|
231 |
+
"faster and more secure.\n"
|
232 |
+
"\t\t\t\t\tAs a result, %3$s no longer supports this version and you should "
|
233 |
+
"upgrade PHP as soon as possible.\n"
|
234 |
+
"\t\t\t\t\tYour hosting provider can do this for you. %4$sHere are some "
|
235 |
+
"resources to help you upgrade%5$s and to explain PHP versions further."
|
236 |
+
msgstr ""
|
237 |
+
|
238 |
+
#: class-sv-wc-plugin-dependencies.php:271
|
239 |
+
#. translators: Placeholders: %1$s - WooCommerce version number, %2$s -
|
240 |
+
#. <strong>, %3$s - </strong>, %4$s - Plugin name, %5$s - <a> tag, %6$s - </a>
|
241 |
+
#. tag
|
242 |
+
msgid ""
|
243 |
+
"Hey there! We've noticed that your site is running version %1$s of "
|
244 |
+
"WooCommerce, but %2$sWooCommerce 3.0 or higher will soon be required%3$s by "
|
245 |
+
"%4$s. We recommend you %5$supdate WooCommerce%6$s to the latest version as "
|
246 |
+
"soon as possible."
|
247 |
+
msgstr ""
|
248 |
+
|
249 |
+
#: class-sv-wc-plugin.php:297
|
250 |
+
#. translators: Placeholders: %s - plugin name
|
251 |
+
msgid "You cannot clone instances of %s."
|
252 |
+
msgstr ""
|
253 |
+
|
254 |
+
#: class-sv-wc-plugin.php:308
|
255 |
+
#. translators: Placeholders: %s - plugin name
|
256 |
+
msgid "You cannot unserialize instances of %s."
|
257 |
+
msgstr ""
|
258 |
+
|
259 |
+
#: class-sv-wc-plugin.php:529
|
260 |
+
#. translators: Docs as in Documentation
|
261 |
+
msgid "Docs"
|
262 |
+
msgstr ""
|
263 |
+
|
264 |
+
#: class-sv-wc-plugin.php:622
|
265 |
+
msgid "%1$s - A minimum of %2$s is required."
|
266 |
+
msgstr ""
|
267 |
+
|
268 |
+
#: class-sv-wc-plugin.php:631
|
269 |
+
msgid "Set as %1$s - %2$s is required."
|
270 |
+
msgstr ""
|
271 |
+
|
272 |
+
#: class-sv-wc-plugin.php:854
|
273 |
+
msgid "Configure"
|
274 |
+
msgstr ""
|
275 |
+
|
276 |
+
#: payment-gateway/Handlers/Capture.php:157
|
277 |
+
msgid "Order cannot be captured"
|
278 |
+
msgstr ""
|
279 |
+
|
280 |
+
#: payment-gateway/Handlers/Capture.php:162
|
281 |
+
msgid "Transaction authorization has expired"
|
282 |
+
msgstr ""
|
283 |
+
|
284 |
+
#: payment-gateway/Handlers/Capture.php:167
|
285 |
+
msgid "Transaction has already been fully captured"
|
286 |
+
msgstr ""
|
287 |
+
|
288 |
+
#: payment-gateway/Handlers/Capture.php:172
|
289 |
+
msgid "Transaction cannot be captured"
|
290 |
+
msgstr ""
|
291 |
+
|
292 |
+
#: payment-gateway/Handlers/Capture.php:188
|
293 |
+
#. translators: Placeholders: %1$s - payment gateway title (such as
|
294 |
+
#. Authorize.net, Braintree, etc), %2$s - transaction amount. Definitions:
|
295 |
+
#. Capture, as in capture funds from a credit card.
|
296 |
+
msgid "%1$s Capture of %2$s Approved"
|
297 |
+
msgstr ""
|
298 |
+
|
299 |
+
#: payment-gateway/Handlers/Capture.php:195
|
300 |
+
#: payment-gateway/class-sv-wc-payment-gateway-direct.php:668
|
301 |
+
#: payment-gateway/class-sv-wc-payment-gateway-direct.php:752
|
302 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:2018
|
303 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:2239
|
304 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:2546
|
305 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:2590
|
306 |
+
#: payment-gateway/integrations/class-sv-wc-payment-gateway-integration-pre-orders.php:340
|
307 |
+
#. translators: Placeholders: %s - transaction ID
|
308 |
+
msgid "(Transaction ID %s)"
|
309 |
+
msgstr ""
|
310 |
+
|
311 |
+
#: payment-gateway/Handlers/Capture.php:226
|
312 |
+
#. translators: Placeholders: %1$s - payment gateway title (such as
|
313 |
+
#. Authorize.net, Braintree, etc), %2$s - failure message. Definitions:
|
314 |
+
#. "capture" as in capturing funds from a credit card.
|
315 |
+
msgid "%1$s Capture Failed: %2$s"
|
316 |
+
msgstr ""
|
317 |
+
|
318 |
+
#: payment-gateway/admin/class-sv-wc-payment-gateway-admin-order.php:119
|
319 |
+
msgid "Are you sure you wish to process this capture? The action cannot be undone."
|
320 |
+
msgstr ""
|
321 |
+
|
322 |
+
#: payment-gateway/admin/class-sv-wc-payment-gateway-admin-order.php:122
|
323 |
+
msgid ""
|
324 |
+
"Something went wrong, and the capture could no be completed. Please try "
|
325 |
+
"again."
|
326 |
+
msgstr ""
|
327 |
+
|
328 |
+
#: payment-gateway/admin/class-sv-wc-payment-gateway-admin-order.php:166
|
329 |
+
#: payment-gateway/admin/class-sv-wc-payment-gateway-admin-order.php:241
|
330 |
+
#: payment-gateway/admin/class-sv-wc-payment-gateway-admin-order.php:304
|
331 |
+
#. translators: verb, as in "Capture credit card charge". Used when an
|
332 |
+
#. amount has been pre-authorized before, but funds have not yet been captured
|
333 |
+
#. (taken) from the card. Capturing the charge will take the money from the
|
334 |
+
#. credit card and put it in the merchant's pockets.
|
335 |
+
msgid "Capture Charge"
|
336 |
+
msgstr ""
|
337 |
+
|
338 |
+
#: payment-gateway/admin/class-sv-wc-payment-gateway-admin-order.php:294
|
339 |
+
msgid "This charge has been fully captured."
|
340 |
+
msgstr ""
|
341 |
+
|
342 |
+
#: payment-gateway/admin/class-sv-wc-payment-gateway-admin-order.php:296
|
343 |
+
msgid "This charge can no longer be captured."
|
344 |
+
msgstr ""
|
345 |
+
|
346 |
+
#: payment-gateway/admin/class-sv-wc-payment-gateway-admin-order.php:298
|
347 |
+
msgid "This charge cannot be captured."
|
348 |
+
msgstr ""
|
349 |
+
|
350 |
+
#: payment-gateway/admin/class-sv-wc-payment-gateway-admin-payment-token-editor.php:89
|
351 |
+
msgid "Are you sure you want to remove this token?"
|
352 |
+
msgstr ""
|
353 |
+
|
354 |
+
#: payment-gateway/admin/class-sv-wc-payment-gateway-admin-payment-token-editor.php:99
|
355 |
+
msgid "Invalid token data"
|
356 |
+
msgstr ""
|
357 |
+
|
358 |
+
#: payment-gateway/admin/class-sv-wc-payment-gateway-admin-payment-token-editor.php:103
|
359 |
+
msgid "An error occurred. Please try again."
|
360 |
+
msgstr ""
|
361 |
+
|
362 |
+
#: payment-gateway/admin/class-sv-wc-payment-gateway-admin-payment-token-editor.php:451
|
363 |
+
#: payment-gateway/admin/class-sv-wc-payment-gateway-admin-user-handler.php:302
|
364 |
+
msgid "(%s)"
|
365 |
+
msgstr ""
|
366 |
+
|
367 |
+
#: payment-gateway/admin/class-sv-wc-payment-gateway-admin-payment-token-editor.php:480
|
368 |
+
#: payment-gateway/class-sv-wc-payment-gateway-my-payment-methods.php:650
|
369 |
+
msgid "Default"
|
370 |
+
msgstr ""
|
371 |
+
|
372 |
+
#: payment-gateway/admin/class-sv-wc-payment-gateway-admin-payment-token-editor.php:515
|
373 |
+
#: payment-gateway/admin/class-sv-wc-payment-gateway-admin-payment-token-editor.php:548
|
374 |
+
msgid "Token ID"
|
375 |
+
msgstr ""
|
376 |
+
|
377 |
+
#: payment-gateway/admin/class-sv-wc-payment-gateway-admin-payment-token-editor.php:520
|
378 |
+
#: payment-gateway/class-sv-wc-payment-gateway-privacy.php:299
|
379 |
+
msgid "Card Type"
|
380 |
+
msgstr ""
|
381 |
+
|
382 |
+
#: payment-gateway/admin/class-sv-wc-payment-gateway-admin-payment-token-editor.php:525
|
383 |
+
#: payment-gateway/admin/class-sv-wc-payment-gateway-admin-payment-token-editor.php:561
|
384 |
+
#: payment-gateway/class-sv-wc-payment-gateway-privacy.php:191
|
385 |
+
#: payment-gateway/class-sv-wc-payment-gateway-privacy.php:297
|
386 |
+
msgid "Last Four"
|
387 |
+
msgstr ""
|
388 |
+
|
389 |
+
#: payment-gateway/admin/class-sv-wc-payment-gateway-admin-payment-token-editor.php:532
|
390 |
+
#: payment-gateway/class-sv-wc-payment-gateway-payment-form.php:313
|
391 |
+
msgid "Expiration (MM/YY)"
|
392 |
+
msgstr ""
|
393 |
+
|
394 |
+
#: payment-gateway/admin/class-sv-wc-payment-gateway-admin-payment-token-editor.php:553
|
395 |
+
#: payment-gateway/class-sv-wc-payment-gateway-payment-form.php:419
|
396 |
+
#: payment-gateway/class-sv-wc-payment-gateway-privacy.php:298
|
397 |
+
#. translators: e-check account type, HTML form field label
|
398 |
+
msgid "Account Type"
|
399 |
+
msgstr ""
|
400 |
+
|
401 |
+
#: payment-gateway/admin/class-sv-wc-payment-gateway-admin-payment-token-editor.php:556
|
402 |
+
msgid "Checking"
|
403 |
+
msgstr ""
|
404 |
+
|
405 |
+
#: payment-gateway/admin/class-sv-wc-payment-gateway-admin-payment-token-editor.php:557
|
406 |
+
msgid "Savings"
|
407 |
+
msgstr ""
|
408 |
+
|
409 |
+
#: payment-gateway/admin/class-sv-wc-payment-gateway-admin-payment-token-editor.php:657
|
410 |
+
msgid "Refresh"
|
411 |
+
msgstr ""
|
412 |
+
|
413 |
+
#: payment-gateway/admin/class-sv-wc-payment-gateway-admin-payment-token-editor.php:659
|
414 |
+
msgid "Add New"
|
415 |
+
msgstr ""
|
416 |
+
|
417 |
+
#: payment-gateway/admin/class-sv-wc-payment-gateway-admin-payment-token-editor.php:662
|
418 |
+
#: payment-gateway/class-sv-wc-payment-gateway-my-payment-methods.php:745
|
419 |
+
msgid "Save"
|
420 |
+
msgstr ""
|
421 |
+
|
422 |
+
#: payment-gateway/admin/class-sv-wc-payment-gateway-admin-payment-token-editor.php:684
|
423 |
+
msgid "Remove"
|
424 |
+
msgstr ""
|
425 |
+
|
426 |
+
#: payment-gateway/admin/class-sv-wc-payment-gateway-admin-user-handler.php:221
|
427 |
+
#: payment-gateway/class-sv-wc-payment-gateway-privacy.php:208
|
428 |
+
msgid "%s Payment Tokens"
|
429 |
+
msgstr ""
|
430 |
+
|
431 |
+
#: payment-gateway/admin/class-sv-wc-payment-gateway-admin-user-handler.php:299
|
432 |
+
#: payment-gateway/integrations/class-sv-wc-payment-gateway-integration-subscriptions.php:660
|
433 |
+
msgid "Customer ID"
|
434 |
+
msgstr ""
|
435 |
+
|
436 |
+
#: payment-gateway/admin/views/html-admin-gateway-status.php:32
|
437 |
+
msgid "This section contains configuration settings for this gateway."
|
438 |
+
msgstr ""
|
439 |
+
|
440 |
+
#: payment-gateway/admin/views/html-admin-gateway-status.php:52
|
441 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:1264
|
442 |
+
#. translators: environment as in a software environment (test/production)
|
443 |
+
msgid "Environment"
|
444 |
+
msgstr ""
|
445 |
+
|
446 |
+
#: payment-gateway/admin/views/html-admin-gateway-status.php:53
|
447 |
+
msgid "The transaction environment for this gateway."
|
448 |
+
msgstr ""
|
449 |
+
|
450 |
+
#: payment-gateway/admin/views/html-admin-gateway-status.php:60
|
451 |
+
msgid "Tokenization Enabled"
|
452 |
+
msgstr ""
|
453 |
+
|
454 |
+
#: payment-gateway/admin/views/html-admin-gateway-status.php:61
|
455 |
+
msgid "Displays whether or not tokenization is enabled for this gateway."
|
456 |
+
msgstr ""
|
457 |
+
|
458 |
+
#: payment-gateway/admin/views/html-admin-gateway-status.php:74
|
459 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:1194
|
460 |
+
msgid "Debug Mode"
|
461 |
+
msgstr ""
|
462 |
+
|
463 |
+
#: payment-gateway/admin/views/html-admin-gateway-status.php:75
|
464 |
+
msgid "Displays whether or not debug logging is enabled for this gateway."
|
465 |
+
msgstr ""
|
466 |
+
|
467 |
+
#: payment-gateway/admin/views/html-admin-gateway-status.php:78
|
468 |
+
msgid "Display at Checkout & Log"
|
469 |
+
msgstr ""
|
470 |
+
|
471 |
+
#: payment-gateway/admin/views/html-admin-gateway-status.php:80
|
472 |
+
msgid "Display at Checkout"
|
473 |
+
msgstr ""
|
474 |
+
|
475 |
+
#: payment-gateway/admin/views/html-admin-gateway-status.php:82
|
476 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:1202
|
477 |
+
msgid "Save to Log"
|
478 |
+
msgstr ""
|
479 |
+
|
480 |
+
#: payment-gateway/admin/views/html-admin-gateway-status.php:84
|
481 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:1200
|
482 |
+
msgid "Off"
|
483 |
+
msgstr ""
|
484 |
+
|
485 |
+
#: payment-gateway/admin/views/html-order-partial-capture.php:30
|
486 |
+
msgid "Authorization total"
|
487 |
+
msgstr ""
|
488 |
+
|
489 |
+
#: payment-gateway/admin/views/html-order-partial-capture.php:34
|
490 |
+
msgid "Amount already captured"
|
491 |
+
msgstr ""
|
492 |
+
|
493 |
+
#: payment-gateway/admin/views/html-order-partial-capture.php:40
|
494 |
+
msgid "Remaining order total"
|
495 |
+
msgstr ""
|
496 |
+
|
497 |
+
#: payment-gateway/admin/views/html-order-partial-capture.php:46
|
498 |
+
msgid "Capture amount"
|
499 |
+
msgstr ""
|
500 |
+
|
501 |
+
#: payment-gateway/admin/views/html-order-partial-capture.php:53
|
502 |
+
msgid "Comment (optional):"
|
503 |
+
msgstr ""
|
504 |
+
|
505 |
+
#: payment-gateway/admin/views/html-order-partial-capture.php:65
|
506 |
+
msgid "Capture %s"
|
507 |
+
msgstr ""
|
508 |
+
|
509 |
+
#: payment-gateway/admin/views/html-order-partial-capture.php:66
|
510 |
+
#: payment-gateway/class-sv-wc-payment-gateway-my-payment-methods.php:225
|
511 |
+
msgid "Cancel"
|
512 |
+
msgstr ""
|
513 |
+
|
514 |
+
#: payment-gateway/admin/views/html-user-payment-token-editor-token.php:48
|
515 |
+
msgid "-- Select an option --"
|
516 |
+
msgstr ""
|
517 |
+
|
518 |
+
#: payment-gateway/admin/views/html-user-payment-token-editor.php:59
|
519 |
+
msgid "No saved payment tokens"
|
520 |
+
msgstr ""
|
521 |
+
|
522 |
+
#: payment-gateway/admin/views/html-user-profile-field-customer-id.php:30
|
523 |
+
msgid "The gateway customer ID for the user. Only edit this if necessary."
|
524 |
+
msgstr ""
|
525 |
+
|
526 |
+
#: payment-gateway/api/class-sv-wc-payment-gateway-api-response-message-helper.php:97
|
527 |
+
#: payment-gateway/apple-pay/class-sv-wc-payment-gateway-apple-pay-frontend.php:131
|
528 |
+
msgid "An error occurred, please try again or try an alternate form of payment"
|
529 |
+
msgstr ""
|
530 |
+
|
531 |
+
#: payment-gateway/api/class-sv-wc-payment-gateway-api-response-message-helper.php:98
|
532 |
+
msgid ""
|
533 |
+
"We cannot process your order with the payment information that you "
|
534 |
+
"provided. Please use a different payment account or an alternate payment "
|
535 |
+
"method."
|
536 |
+
msgstr ""
|
537 |
+
|
538 |
+
#: payment-gateway/api/class-sv-wc-payment-gateway-api-response-message-helper.php:99
|
539 |
+
msgid ""
|
540 |
+
"This order is being placed on hold for review. Please contact us to "
|
541 |
+
"complete the transaction."
|
542 |
+
msgstr ""
|
543 |
+
|
544 |
+
#: payment-gateway/api/class-sv-wc-payment-gateway-api-response-message-helper.php:104
|
545 |
+
msgid ""
|
546 |
+
"This order is being placed on hold for review due to an incorrect card "
|
547 |
+
"verification number. You may contact the store to complete the transaction."
|
548 |
+
msgstr ""
|
549 |
+
|
550 |
+
#: payment-gateway/api/class-sv-wc-payment-gateway-api-response-message-helper.php:105
|
551 |
+
msgid "The card verification number is invalid, please try again."
|
552 |
+
msgstr ""
|
553 |
+
|
554 |
+
#: payment-gateway/api/class-sv-wc-payment-gateway-api-response-message-helper.php:106
|
555 |
+
msgid "Please enter your card verification number and try again."
|
556 |
+
msgstr ""
|
557 |
+
|
558 |
+
#: payment-gateway/api/class-sv-wc-payment-gateway-api-response-message-helper.php:109
|
559 |
+
msgid ""
|
560 |
+
"That card type is not accepted, please use an alternate card or other form "
|
561 |
+
"of payment."
|
562 |
+
msgstr ""
|
563 |
+
|
564 |
+
#: payment-gateway/api/class-sv-wc-payment-gateway-api-response-message-helper.php:110
|
565 |
+
#: payment-gateway/api/class-sv-wc-payment-gateway-api-response-message-helper.php:114
|
566 |
+
msgid ""
|
567 |
+
"The card type is invalid or does not correlate with the credit card number. "
|
568 |
+
" Please try again or use an alternate card or other form of payment."
|
569 |
+
msgstr ""
|
570 |
+
|
571 |
+
#: payment-gateway/api/class-sv-wc-payment-gateway-api-response-message-helper.php:111
|
572 |
+
msgid "Please select the card type and try again."
|
573 |
+
msgstr ""
|
574 |
+
|
575 |
+
#: payment-gateway/api/class-sv-wc-payment-gateway-api-response-message-helper.php:115
|
576 |
+
msgid "The card number is invalid, please re-enter and try again."
|
577 |
+
msgstr ""
|
578 |
+
|
579 |
+
#: payment-gateway/api/class-sv-wc-payment-gateway-api-response-message-helper.php:116
|
580 |
+
msgid "Please enter your card number and try again."
|
581 |
+
msgstr ""
|
582 |
+
|
583 |
+
#: payment-gateway/api/class-sv-wc-payment-gateway-api-response-message-helper.php:119
|
584 |
+
msgid "The card expiration date is invalid, please re-enter and try again."
|
585 |
+
msgstr ""
|
586 |
+
|
587 |
+
#: payment-gateway/api/class-sv-wc-payment-gateway-api-response-message-helper.php:120
|
588 |
+
msgid "The card expiration month is invalid, please re-enter and try again."
|
589 |
+
msgstr ""
|
590 |
+
|
591 |
+
#: payment-gateway/api/class-sv-wc-payment-gateway-api-response-message-helper.php:121
|
592 |
+
msgid "The card expiration year is invalid, please re-enter and try again."
|
593 |
+
msgstr ""
|
594 |
+
|
595 |
+
#: payment-gateway/api/class-sv-wc-payment-gateway-api-response-message-helper.php:122
|
596 |
+
msgid "Please enter your card expiration date and try again."
|
597 |
+
msgstr ""
|
598 |
+
|
599 |
+
#: payment-gateway/api/class-sv-wc-payment-gateway-api-response-message-helper.php:125
|
600 |
+
msgid "The bank routing number is invalid, please re-enter and try again."
|
601 |
+
msgstr ""
|
602 |
+
|
603 |
+
#: payment-gateway/api/class-sv-wc-payment-gateway-api-response-message-helper.php:126
|
604 |
+
msgid "The bank account number is invalid, please re-enter and try again."
|
605 |
+
msgstr ""
|
606 |
+
|
607 |
+
#: payment-gateway/api/class-sv-wc-payment-gateway-api-response-message-helper.php:129
|
608 |
+
msgid ""
|
609 |
+
"The provided card is expired, please use an alternate card or other form of "
|
610 |
+
"payment."
|
611 |
+
msgstr ""
|
612 |
+
|
613 |
+
#: payment-gateway/api/class-sv-wc-payment-gateway-api-response-message-helper.php:130
|
614 |
+
msgid ""
|
615 |
+
"The provided card was declined, please use an alternate card or other form "
|
616 |
+
"of payment."
|
617 |
+
msgstr ""
|
618 |
+
|
619 |
+
#: payment-gateway/api/class-sv-wc-payment-gateway-api-response-message-helper.php:131
|
620 |
+
msgid ""
|
621 |
+
"Insufficient funds in account, please use an alternate card or other form "
|
622 |
+
"of payment."
|
623 |
+
msgstr ""
|
624 |
+
|
625 |
+
#: payment-gateway/api/class-sv-wc-payment-gateway-api-response-message-helper.php:132
|
626 |
+
msgid ""
|
627 |
+
"The card is inactivate or not authorized for card-not-present transactions, "
|
628 |
+
"please use an alternate card or other form of payment."
|
629 |
+
msgstr ""
|
630 |
+
|
631 |
+
#: payment-gateway/api/class-sv-wc-payment-gateway-api-response-message-helper.php:133
|
632 |
+
msgid ""
|
633 |
+
"The credit limit for the card has been reached, please use an alternate "
|
634 |
+
"card or other form of payment."
|
635 |
+
msgstr ""
|
636 |
+
|
637 |
+
#: payment-gateway/api/class-sv-wc-payment-gateway-api-response-message-helper.php:134
|
638 |
+
msgid "The card verification number does not match. Please re-enter and try again."
|
639 |
+
msgstr ""
|
640 |
+
|
641 |
+
#: payment-gateway/api/class-sv-wc-payment-gateway-api-response-message-helper.php:135
|
642 |
+
msgid ""
|
643 |
+
"The provided address does not match the billing address for cardholder. "
|
644 |
+
"Please verify the address and try again."
|
645 |
+
msgstr ""
|
646 |
+
|
647 |
+
#: payment-gateway/apple-pay/class-sv-wc-payment-gateway-apple-pay-admin.php:81
|
648 |
+
#: payment-gateway/apple-pay/class-sv-wc-payment-gateway-apple-pay-admin.php:99
|
649 |
+
msgid "Apple Pay"
|
650 |
+
msgstr ""
|
651 |
+
|
652 |
+
#: payment-gateway/apple-pay/class-sv-wc-payment-gateway-apple-pay-admin.php:105
|
653 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:1140
|
654 |
+
msgid "Enable / Disable"
|
655 |
+
msgstr ""
|
656 |
+
|
657 |
+
#: payment-gateway/apple-pay/class-sv-wc-payment-gateway-apple-pay-admin.php:106
|
658 |
+
msgid "Accept Apple Pay"
|
659 |
+
msgstr ""
|
660 |
+
|
661 |
+
#: payment-gateway/apple-pay/class-sv-wc-payment-gateway-apple-pay-admin.php:113
|
662 |
+
msgid "Allow Apple Pay on"
|
663 |
+
msgstr ""
|
664 |
+
|
665 |
+
#: payment-gateway/apple-pay/class-sv-wc-payment-gateway-apple-pay-admin.php:123
|
666 |
+
msgid "Button Style"
|
667 |
+
msgstr ""
|
668 |
+
|
669 |
+
#: payment-gateway/apple-pay/class-sv-wc-payment-gateway-apple-pay-admin.php:126
|
670 |
+
msgid "Black"
|
671 |
+
msgstr ""
|
672 |
+
|
673 |
+
#: payment-gateway/apple-pay/class-sv-wc-payment-gateway-apple-pay-admin.php:127
|
674 |
+
msgid "White"
|
675 |
+
msgstr ""
|
676 |
+
|
677 |
+
#: payment-gateway/apple-pay/class-sv-wc-payment-gateway-apple-pay-admin.php:128
|
678 |
+
msgid "White with outline"
|
679 |
+
msgstr ""
|
680 |
+
|
681 |
+
#: payment-gateway/apple-pay/class-sv-wc-payment-gateway-apple-pay-admin.php:140
|
682 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:1315
|
683 |
+
msgid "Connection Settings"
|
684 |
+
msgstr ""
|
685 |
+
|
686 |
+
#: payment-gateway/apple-pay/class-sv-wc-payment-gateway-apple-pay-admin.php:146
|
687 |
+
msgid "Apple Merchant ID"
|
688 |
+
msgstr ""
|
689 |
+
|
690 |
+
#: payment-gateway/apple-pay/class-sv-wc-payment-gateway-apple-pay-admin.php:150
|
691 |
+
msgid "This is found in your %1$sApple developer account%2$s"
|
692 |
+
msgstr ""
|
693 |
+
|
694 |
+
#: payment-gateway/apple-pay/class-sv-wc-payment-gateway-apple-pay-admin.php:157
|
695 |
+
msgid "Certificate Path"
|
696 |
+
msgstr ""
|
697 |
+
|
698 |
+
#: payment-gateway/apple-pay/class-sv-wc-payment-gateway-apple-pay-admin.php:162
|
699 |
+
#. translators: Placeholders: %s - the server's web root path
|
700 |
+
msgid "For reference, your current web root path is: %s"
|
701 |
+
msgstr ""
|
702 |
+
|
703 |
+
#: payment-gateway/apple-pay/class-sv-wc-payment-gateway-apple-pay-admin.php:175
|
704 |
+
#: payment-gateway/apple-pay/class-sv-wc-payment-gateway-apple-pay-admin.php:185
|
705 |
+
msgid "Processing Gateway"
|
706 |
+
msgstr ""
|
707 |
+
|
708 |
+
#: payment-gateway/apple-pay/class-sv-wc-payment-gateway-apple-pay-admin.php:193
|
709 |
+
msgid "Test Mode"
|
710 |
+
msgstr ""
|
711 |
+
|
712 |
+
#: payment-gateway/apple-pay/class-sv-wc-payment-gateway-apple-pay-admin.php:194
|
713 |
+
msgid ""
|
714 |
+
"Enable to test Apple Pay functionality throughout your sites without "
|
715 |
+
"processing real payments."
|
716 |
+
msgstr ""
|
717 |
+
|
718 |
+
#: payment-gateway/apple-pay/class-sv-wc-payment-gateway-apple-pay-admin.php:306
|
719 |
+
msgid "Your site must be served over HTTPS with a valid SSL certificate."
|
720 |
+
msgstr ""
|
721 |
+
|
722 |
+
#: payment-gateway/apple-pay/class-sv-wc-payment-gateway-apple-pay-admin.php:316
|
723 |
+
#. translators: Placeholders: %1$s - plugin name, %2$s - a
|
724 |
+
#. currency/comma-separated list of currencies, %3$s - <a> tag, %4$s - </a> tag
|
725 |
+
msgid ""
|
726 |
+
"Accepts payment in %1$s only. %2$sConfigure%3$s WooCommerce to accept %1$s "
|
727 |
+
"to enable Apple Pay."
|
728 |
+
msgid_plural ""
|
729 |
+
"Accepts payment in one of %1$s only. %2$sConfigure%3$s WooCommerce to "
|
730 |
+
"accept one of %1$s to enable Apple Pay."
|
731 |
+
msgstr[0] ""
|
732 |
+
msgstr[1] ""
|
733 |
+
|
734 |
+
#: payment-gateway/apple-pay/class-sv-wc-payment-gateway-apple-pay-admin.php:335
|
735 |
+
msgid ""
|
736 |
+
"Your %1$sMerchant Identity Certificate%2$s cannot be found. Please check "
|
737 |
+
"your path configuration."
|
738 |
+
msgstr ""
|
739 |
+
|
740 |
+
#: payment-gateway/apple-pay/class-sv-wc-payment-gateway-apple-pay-admin.php:342
|
741 |
+
msgid "Apple Pay is disabled."
|
742 |
+
msgstr ""
|
743 |
+
|
744 |
+
#: payment-gateway/apple-pay/class-sv-wc-payment-gateway-apple-pay-admin.php:381
|
745 |
+
msgid "Single products"
|
746 |
+
msgstr ""
|
747 |
+
|
748 |
+
#: payment-gateway/apple-pay/class-sv-wc-payment-gateway-apple-pay-admin.php:382
|
749 |
+
msgid "Cart"
|
750 |
+
msgstr ""
|
751 |
+
|
752 |
+
#: payment-gateway/apple-pay/class-sv-wc-payment-gateway-apple-pay-admin.php:383
|
753 |
+
msgid "Checkout"
|
754 |
+
msgstr ""
|
755 |
+
|
756 |
+
#: payment-gateway/apple-pay/class-sv-wc-payment-gateway-apple-pay-frontend.php:168
|
757 |
+
msgid "Buy with"
|
758 |
+
msgstr ""
|
759 |
+
|
760 |
+
#: payment-gateway/apple-pay/class-sv-wc-payment-gateway-apple-pay-frontend.php:302
|
761 |
+
msgid "Pay with"
|
762 |
+
msgstr ""
|
763 |
+
|
764 |
+
#: payment-gateway/apple-pay/class-sv-wc-payment-gateway-apple-pay-frontend.php:308
|
765 |
+
msgid "or"
|
766 |
+
msgstr ""
|
767 |
+
|
768 |
+
#: payment-gateway/apple-pay/class-sv-wc-payment-gateway-apple-pay-orders.php:85
|
769 |
+
#: payment-gateway/apple-pay/class-sv-wc-payment-gateway-apple-pay-orders.php:92
|
770 |
+
#: payment-gateway/apple-pay/class-sv-wc-payment-gateway-apple-pay-orders.php:105
|
771 |
+
#: payment-gateway/apple-pay/class-sv-wc-payment-gateway-apple-pay-orders.php:114
|
772 |
+
#: payment-gateway/apple-pay/class-sv-wc-payment-gateway-apple-pay-orders.php:126
|
773 |
+
#: payment-gateway/apple-pay/class-sv-wc-payment-gateway-apple-pay-orders.php:171
|
774 |
+
#: payment-gateway/apple-pay/class-sv-wc-payment-gateway-apple-pay-orders.php:181
|
775 |
+
#: payment-gateway/apple-pay/class-sv-wc-payment-gateway-apple-pay-orders.php:183
|
776 |
+
msgid "Error %d: Unable to create order. Please try again."
|
777 |
+
msgstr ""
|
778 |
+
|
779 |
+
#: payment-gateway/apple-pay/class-sv-wc-payment-gateway-apple-pay.php:120
|
780 |
+
msgid "Apple Pay payment authorized."
|
781 |
+
msgstr ""
|
782 |
+
|
783 |
+
#: payment-gateway/apple-pay/class-sv-wc-payment-gateway-apple-pay.php:156
|
784 |
+
msgid "Apple Pay payment failed. %s"
|
785 |
+
msgstr ""
|
786 |
+
|
787 |
+
#: payment-gateway/apple-pay/class-sv-wc-payment-gateway-apple-pay.php:547
|
788 |
+
msgid "Subtotal"
|
789 |
+
msgstr ""
|
790 |
+
|
791 |
+
#: payment-gateway/apple-pay/class-sv-wc-payment-gateway-apple-pay.php:557
|
792 |
+
msgid "Discount"
|
793 |
+
msgstr ""
|
794 |
+
|
795 |
+
#: payment-gateway/apple-pay/class-sv-wc-payment-gateway-apple-pay.php:567
|
796 |
+
msgid "Shipping"
|
797 |
+
msgstr ""
|
798 |
+
|
799 |
+
#: payment-gateway/apple-pay/class-sv-wc-payment-gateway-apple-pay.php:577
|
800 |
+
msgid "Fees"
|
801 |
+
msgstr ""
|
802 |
+
|
803 |
+
#: payment-gateway/apple-pay/class-sv-wc-payment-gateway-apple-pay.php:587
|
804 |
+
msgid "Taxes"
|
805 |
+
msgstr ""
|
806 |
+
|
807 |
+
#: payment-gateway/class-sv-wc-payment-gateway-direct.php:60
|
808 |
+
msgid ""
|
809 |
+
"Payment error, please try another payment method or contact us to complete "
|
810 |
+
"your transaction."
|
811 |
+
msgstr ""
|
812 |
+
|
813 |
+
#: payment-gateway/class-sv-wc-payment-gateway-direct.php:160
|
814 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:479
|
815 |
+
msgid "Card expiration date is invalid"
|
816 |
+
msgstr ""
|
817 |
+
|
818 |
+
#: payment-gateway/class-sv-wc-payment-gateway-direct.php:184
|
819 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:472
|
820 |
+
msgid "Card number is missing"
|
821 |
+
msgstr ""
|
822 |
+
|
823 |
+
#: payment-gateway/class-sv-wc-payment-gateway-direct.php:190
|
824 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:475
|
825 |
+
msgid "Card number is invalid (wrong length)"
|
826 |
+
msgstr ""
|
827 |
+
|
828 |
+
#: payment-gateway/class-sv-wc-payment-gateway-direct.php:195
|
829 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:474
|
830 |
+
msgid "Card number is invalid (only digits allowed)"
|
831 |
+
msgstr ""
|
832 |
+
|
833 |
+
#: payment-gateway/class-sv-wc-payment-gateway-direct.php:200
|
834 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:473
|
835 |
+
msgid "Card number is invalid"
|
836 |
+
msgstr ""
|
837 |
+
|
838 |
+
#: payment-gateway/class-sv-wc-payment-gateway-direct.php:227
|
839 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:477
|
840 |
+
msgid "Card security code is invalid (only digits are allowed)"
|
841 |
+
msgstr ""
|
842 |
+
|
843 |
+
#: payment-gateway/class-sv-wc-payment-gateway-direct.php:233
|
844 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:478
|
845 |
+
msgid "Card security code is invalid (must be 3 or 4 digits)"
|
846 |
+
msgstr ""
|
847 |
+
|
848 |
+
#: payment-gateway/class-sv-wc-payment-gateway-direct.php:239
|
849 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:476
|
850 |
+
msgid "Card security code is missing"
|
851 |
+
msgstr ""
|
852 |
+
|
853 |
+
#: payment-gateway/class-sv-wc-payment-gateway-direct.php:266
|
854 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:488
|
855 |
+
msgid "Routing Number is missing"
|
856 |
+
msgstr ""
|
857 |
+
|
858 |
+
#: payment-gateway/class-sv-wc-payment-gateway-direct.php:273
|
859 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:489
|
860 |
+
msgid "Routing Number is invalid (only digits are allowed)"
|
861 |
+
msgstr ""
|
862 |
+
|
863 |
+
#: payment-gateway/class-sv-wc-payment-gateway-direct.php:279
|
864 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:490
|
865 |
+
msgid "Routing number is invalid (must be 9 digits)"
|
866 |
+
msgstr ""
|
867 |
+
|
868 |
+
#: payment-gateway/class-sv-wc-payment-gateway-direct.php:288
|
869 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:485
|
870 |
+
msgid "Account Number is missing"
|
871 |
+
msgstr ""
|
872 |
+
|
873 |
+
#: payment-gateway/class-sv-wc-payment-gateway-direct.php:295
|
874 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:486
|
875 |
+
msgid "Account Number is invalid (only digits are allowed)"
|
876 |
+
msgstr ""
|
877 |
+
|
878 |
+
#: payment-gateway/class-sv-wc-payment-gateway-direct.php:301
|
879 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:487
|
880 |
+
msgid "Account number is invalid (must be between 5 and 17 digits)"
|
881 |
+
msgstr ""
|
882 |
+
|
883 |
+
#: payment-gateway/class-sv-wc-payment-gateway-direct.php:308
|
884 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:484
|
885 |
+
msgid "Drivers license number is invalid"
|
886 |
+
msgstr ""
|
887 |
+
|
888 |
+
#: payment-gateway/class-sv-wc-payment-gateway-direct.php:314
|
889 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:480
|
890 |
+
msgid "Check Number is invalid (only digits are allowed)"
|
891 |
+
msgstr ""
|
892 |
+
|
893 |
+
#: payment-gateway/class-sv-wc-payment-gateway-direct.php:482
|
894 |
+
msgid "Unknown error"
|
895 |
+
msgstr ""
|
896 |
+
|
897 |
+
#: payment-gateway/class-sv-wc-payment-gateway-direct.php:491
|
898 |
+
msgid "Payment method address could not be updated. %s"
|
899 |
+
msgstr ""
|
900 |
+
|
901 |
+
#: payment-gateway/class-sv-wc-payment-gateway-direct.php:658
|
902 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:2580
|
903 |
+
#. translators: Placeholders: %1$s - payment method title, %2$s - payment
|
904 |
+
#. account type (savings/checking) (may or may not be available), %3$s - last
|
905 |
+
#. four digits of the account
|
906 |
+
msgid "%1$s Check Transaction Approved: %2$s account ending in %3$s"
|
907 |
+
msgstr ""
|
908 |
+
|
909 |
+
#: payment-gateway/class-sv-wc-payment-gateway-direct.php:663
|
910 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:2585
|
911 |
+
#. translators: Placeholders: %s - check number
|
912 |
+
msgid "Check number %s"
|
913 |
+
msgstr ""
|
914 |
+
|
915 |
+
#: payment-gateway/class-sv-wc-payment-gateway-direct.php:731
|
916 |
+
#. translators: Placeholders: %1$s - payment method title, %2$s - environment
|
917 |
+
#. ("Test"), %3$s - transaction type (authorization/charge), %4$s - card type
|
918 |
+
#. (mastercard, visa, ...), %5$s - last four digits of the card
|
919 |
+
msgid "%1$s %2$s %3$s Approved: %4$s ending in %5$s"
|
920 |
+
msgstr ""
|
921 |
+
|
922 |
+
#: payment-gateway/class-sv-wc-payment-gateway-direct.php:744
|
923 |
+
#: payment-gateway/class-sv-wc-payment-gateway-payment-form.php:661
|
924 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:2538
|
925 |
+
#. translators: Placeholders: %s - expiry date
|
926 |
+
msgid "(expires %s)"
|
927 |
+
msgstr ""
|
928 |
+
|
929 |
+
#: payment-gateway/class-sv-wc-payment-gateway-direct.php:815
|
930 |
+
#. translators: Placeholders: %s - failure message
|
931 |
+
msgid "Tokenization Request Failed: %s"
|
932 |
+
msgstr ""
|
933 |
+
|
934 |
+
#: payment-gateway/class-sv-wc-payment-gateway-direct.php:826
|
935 |
+
#. translators: Placeholders: %1$s - payment method title, %2$s - failure
|
936 |
+
#. message
|
937 |
+
msgid "%1$s Tokenization Request Failed: %2$s"
|
938 |
+
msgstr ""
|
939 |
+
|
940 |
+
#: payment-gateway/class-sv-wc-payment-gateway-direct.php:847
|
941 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:1726
|
942 |
+
#: payment-gateway/integrations/class-sv-wc-payment-gateway-integration-pre-orders.php:357
|
943 |
+
#. translators: This is a message describing that the transaction in question
|
944 |
+
#. only performed a credit card authorization and did not capture any funds.
|
945 |
+
msgid "Authorization only transaction"
|
946 |
+
msgstr ""
|
947 |
+
|
948 |
+
#: payment-gateway/class-sv-wc-payment-gateway-direct.php:884
|
949 |
+
#. translators: Placeholders: %s - failure message. Payment method as in a
|
950 |
+
#. specific credit card, e-check or bank account
|
951 |
+
msgid "Oops, adding your new payment method failed: %s"
|
952 |
+
msgstr ""
|
953 |
+
|
954 |
+
#: payment-gateway/class-sv-wc-payment-gateway-direct.php:925
|
955 |
+
#. translators: Payment method as in a specific credit card. Placeholders: %1$s
|
956 |
+
#. - card type (visa, mastercard, ...), %2$s - last four digits of the card,
|
957 |
+
#. %3$s - card expiry date
|
958 |
+
msgid "Nice! New payment method added: %1$s ending in %2$s (expires %3$s)"
|
959 |
+
msgstr ""
|
960 |
+
|
961 |
+
#: payment-gateway/class-sv-wc-payment-gateway-direct.php:935
|
962 |
+
#. translators: Payment method as in a specific e-check account. Placeholders:
|
963 |
+
#. %1$s - account type (checking/savings), %2$s - last four digits of the
|
964 |
+
#. account
|
965 |
+
msgid "Nice! New payment method added: %1$s account ending in %2$s"
|
966 |
+
msgstr ""
|
967 |
+
|
968 |
+
#: payment-gateway/class-sv-wc-payment-gateway-direct.php:942
|
969 |
+
#. translators: Payment method as in a specific credit card, e-check or bank
|
970 |
+
#. account
|
971 |
+
msgid "Nice! New payment method added."
|
972 |
+
msgstr ""
|
973 |
+
|
974 |
+
#: payment-gateway/class-sv-wc-payment-gateway-direct.php:1062
|
975 |
+
#. translators: Placeholders: %1$s - site title, %2$s - customer email. Payment
|
976 |
+
#. method as in a specific credit card, e-check or bank account
|
977 |
+
msgid "%1$s - Add Payment Method for %2$s"
|
978 |
+
msgstr ""
|
979 |
+
|
980 |
+
#: payment-gateway/class-sv-wc-payment-gateway-helper.php:179
|
981 |
+
msgid "PayPal"
|
982 |
+
msgstr ""
|
983 |
+
|
984 |
+
#: payment-gateway/class-sv-wc-payment-gateway-helper.php:180
|
985 |
+
msgid "Checking Account"
|
986 |
+
msgstr ""
|
987 |
+
|
988 |
+
#: payment-gateway/class-sv-wc-payment-gateway-helper.php:181
|
989 |
+
msgid "Savings Account"
|
990 |
+
msgstr ""
|
991 |
+
|
992 |
+
#: payment-gateway/class-sv-wc-payment-gateway-helper.php:182
|
993 |
+
msgid "Credit / Debit Card"
|
994 |
+
msgstr ""
|
995 |
+
|
996 |
+
#: payment-gateway/class-sv-wc-payment-gateway-helper.php:183
|
997 |
+
msgid "Bank Account"
|
998 |
+
msgstr ""
|
999 |
+
|
1000 |
+
#: payment-gateway/class-sv-wc-payment-gateway-hosted.php:294
|
1001 |
+
msgid "Thank you for your order, please click the button below to pay."
|
1002 |
+
msgstr ""
|
1003 |
+
|
1004 |
+
#: payment-gateway/class-sv-wc-payment-gateway-hosted.php:295
|
1005 |
+
msgid "Thank you for your order. We are now redirecting you to complete payment."
|
1006 |
+
msgstr ""
|
1007 |
+
|
1008 |
+
#: payment-gateway/class-sv-wc-payment-gateway-hosted.php:296
|
1009 |
+
msgid "Pay Now"
|
1010 |
+
msgstr ""
|
1011 |
+
|
1012 |
+
#: payment-gateway/class-sv-wc-payment-gateway-hosted.php:297
|
1013 |
+
msgid "Cancel Order"
|
1014 |
+
msgstr ""
|
1015 |
+
|
1016 |
+
#: payment-gateway/class-sv-wc-payment-gateway-hosted.php:436
|
1017 |
+
#. translators: Placeholders: %s - a WooCommerce order ID
|
1018 |
+
msgid "Could not find order %s"
|
1019 |
+
msgstr ""
|
1020 |
+
|
1021 |
+
#: payment-gateway/class-sv-wc-payment-gateway-hosted.php:500
|
1022 |
+
#. translators: Placeholders: %s - payment gateway title (such as
|
1023 |
+
#. Authorize.net, Braintree, etc)
|
1024 |
+
msgid "%s duplicate transaction received"
|
1025 |
+
msgstr ""
|
1026 |
+
|
1027 |
+
#: payment-gateway/class-sv-wc-payment-gateway-hosted.php:503
|
1028 |
+
msgid "Order %s is already paid for."
|
1029 |
+
msgstr ""
|
1030 |
+
|
1031 |
+
#: payment-gateway/class-sv-wc-payment-gateway-hosted.php:586
|
1032 |
+
#: payment-gateway/payment-tokens/class-sv-wc-payment-gateway-payment-tokens-handler.php:832
|
1033 |
+
#. translators: Placeholders: %1$s - payment gateway title (such as
|
1034 |
+
#. Authorize.net, Braintree, etc), %2$s - payment method name (mastercard, bank
|
1035 |
+
#. account, etc), %3$s - last four digits of the card/account, %4$s -
|
1036 |
+
#. card/account expiry date
|
1037 |
+
msgid "%1$s Payment Method Saved: %2$s ending in %3$s (expires %4$s)"
|
1038 |
+
msgstr ""
|
1039 |
+
|
1040 |
+
#: payment-gateway/class-sv-wc-payment-gateway-hosted.php:597
|
1041 |
+
#: payment-gateway/payment-tokens/class-sv-wc-payment-gateway-payment-tokens-handler.php:843
|
1042 |
+
#. translators: Placeholders: %1$s - payment gateway title (such as CyberSouce,
|
1043 |
+
#. NETbilling, etc), %2$s - account type (checking/savings - may or may not be
|
1044 |
+
#. available), %3$s - last four digits of the account
|
1045 |
+
msgid "%1$s eCheck Payment Method Saved: %2$s account ending in %3$s"
|
1046 |
+
msgstr ""
|
1047 |
+
|
1048 |
+
#: payment-gateway/class-sv-wc-payment-gateway-hosted.php:606
|
1049 |
+
#. translators: Placeholders: %s - payment gateway title (such as CyberSouce,
|
1050 |
+
#. NETbilling, etc)
|
1051 |
+
msgid "%s Payment Method Saved"
|
1052 |
+
msgstr ""
|
1053 |
+
|
1054 |
+
#: payment-gateway/class-sv-wc-payment-gateway-hosted.php:615
|
1055 |
+
#. translators: Placeholders: %s - a failed tokenization API error
|
1056 |
+
msgid "Tokenization failed. %s"
|
1057 |
+
msgstr ""
|
1058 |
+
|
1059 |
+
#: payment-gateway/class-sv-wc-payment-gateway-my-payment-methods.php:224
|
1060 |
+
#: payment-gateway/class-sv-wc-payment-gateway-my-payment-methods.php:744
|
1061 |
+
msgid "Edit"
|
1062 |
+
msgstr ""
|
1063 |
+
|
1064 |
+
#: payment-gateway/class-sv-wc-payment-gateway-my-payment-methods.php:226
|
1065 |
+
msgid "Oops, there was an error updating your payment method. Please try again."
|
1066 |
+
msgstr ""
|
1067 |
+
|
1068 |
+
#: payment-gateway/class-sv-wc-payment-gateway-my-payment-methods.php:227
|
1069 |
+
msgid "Are you sure you want to delete this payment method?"
|
1070 |
+
msgstr ""
|
1071 |
+
|
1072 |
+
#: payment-gateway/class-sv-wc-payment-gateway-my-payment-methods.php:284
|
1073 |
+
#. translators: Payment method as in a specific credit card, eCheck or bank
|
1074 |
+
#. account
|
1075 |
+
msgid "You do not have any saved payment methods."
|
1076 |
+
msgstr ""
|
1077 |
+
|
1078 |
+
#: payment-gateway/class-sv-wc-payment-gateway-my-payment-methods.php:321
|
1079 |
+
#. translators: Payment method as in a specific credit card, eCheck or bank
|
1080 |
+
#. account
|
1081 |
+
msgid "My Payment Methods"
|
1082 |
+
msgstr ""
|
1083 |
+
|
1084 |
+
#: payment-gateway/class-sv-wc-payment-gateway-my-payment-methods.php:329
|
1085 |
+
#. translators: Payment method as in a specific credit card, e-check or bank
|
1086 |
+
#. account
|
1087 |
+
msgid "Add New Payment Method"
|
1088 |
+
msgstr ""
|
1089 |
+
|
1090 |
+
#: payment-gateway/class-sv-wc-payment-gateway-my-payment-methods.php:414
|
1091 |
+
msgid "Method"
|
1092 |
+
msgstr ""
|
1093 |
+
|
1094 |
+
#: payment-gateway/class-sv-wc-payment-gateway-my-payment-methods.php:415
|
1095 |
+
msgid "Details"
|
1096 |
+
msgstr ""
|
1097 |
+
|
1098 |
+
#: payment-gateway/class-sv-wc-payment-gateway-my-payment-methods.php:416
|
1099 |
+
msgid "Expires"
|
1100 |
+
msgstr ""
|
1101 |
+
|
1102 |
+
#: payment-gateway/class-sv-wc-payment-gateway-my-payment-methods.php:417
|
1103 |
+
msgid "Default?"
|
1104 |
+
msgstr ""
|
1105 |
+
|
1106 |
+
#: payment-gateway/class-sv-wc-payment-gateway-my-payment-methods.php:418
|
1107 |
+
msgid "Actions"
|
1108 |
+
msgstr ""
|
1109 |
+
|
1110 |
+
#: payment-gateway/class-sv-wc-payment-gateway-my-payment-methods.php:454
|
1111 |
+
msgid "Credit/Debit Cards"
|
1112 |
+
msgstr ""
|
1113 |
+
|
1114 |
+
#: payment-gateway/class-sv-wc-payment-gateway-my-payment-methods.php:463
|
1115 |
+
msgid "Bank Accounts"
|
1116 |
+
msgstr ""
|
1117 |
+
|
1118 |
+
#: payment-gateway/class-sv-wc-payment-gateway-my-payment-methods.php:515
|
1119 |
+
msgid "N/A"
|
1120 |
+
msgstr ""
|
1121 |
+
|
1122 |
+
#: payment-gateway/class-sv-wc-payment-gateway-my-payment-methods.php:624
|
1123 |
+
#: payment-gateway/class-sv-wc-payment-gateway-privacy.php:199
|
1124 |
+
msgid "Nickname"
|
1125 |
+
msgstr ""
|
1126 |
+
|
1127 |
+
#: payment-gateway/class-sv-wc-payment-gateway-my-payment-methods.php:805
|
1128 |
+
msgid "Delete"
|
1129 |
+
msgstr ""
|
1130 |
+
|
1131 |
+
#: payment-gateway/class-sv-wc-payment-gateway-my-payment-methods.php:959
|
1132 |
+
msgid "Oops, you took too long, please try again."
|
1133 |
+
msgstr ""
|
1134 |
+
|
1135 |
+
#: payment-gateway/class-sv-wc-payment-gateway-my-payment-methods.php:972
|
1136 |
+
msgid "There was an error with your request, please try again."
|
1137 |
+
msgstr ""
|
1138 |
+
|
1139 |
+
#: payment-gateway/class-sv-wc-payment-gateway-my-payment-methods.php:985
|
1140 |
+
#. translators: Payment method as in a specific credit card, e-check or bank
|
1141 |
+
#. account
|
1142 |
+
msgid "Error removing payment method"
|
1143 |
+
msgstr ""
|
1144 |
+
|
1145 |
+
#: payment-gateway/class-sv-wc-payment-gateway-my-payment-methods.php:990
|
1146 |
+
#. translators: Payment method as in a specific credit card, e-check or bank
|
1147 |
+
#. account
|
1148 |
+
msgid "Payment method deleted."
|
1149 |
+
msgstr ""
|
1150 |
+
|
1151 |
+
#: payment-gateway/class-sv-wc-payment-gateway-payment-form.php:295
|
1152 |
+
msgid "Card Number"
|
1153 |
+
msgstr ""
|
1154 |
+
|
1155 |
+
#: payment-gateway/class-sv-wc-payment-gateway-payment-form.php:316
|
1156 |
+
msgid "MM / YY"
|
1157 |
+
msgstr ""
|
1158 |
+
|
1159 |
+
#: payment-gateway/class-sv-wc-payment-gateway-payment-form.php:334
|
1160 |
+
msgid "Card Security Code"
|
1161 |
+
msgstr ""
|
1162 |
+
|
1163 |
+
#: payment-gateway/class-sv-wc-payment-gateway-payment-form.php:337
|
1164 |
+
msgid "CSC"
|
1165 |
+
msgstr ""
|
1166 |
+
|
1167 |
+
#: payment-gateway/class-sv-wc-payment-gateway-payment-form.php:376
|
1168 |
+
msgid "Where do I find this?"
|
1169 |
+
msgstr ""
|
1170 |
+
|
1171 |
+
#: payment-gateway/class-sv-wc-payment-gateway-payment-form.php:382
|
1172 |
+
#. translators: e-check routing number, HTML form field label,
|
1173 |
+
#. https:en.wikipedia.org/wiki/Routing_transit_number
|
1174 |
+
msgid "Routing Number"
|
1175 |
+
msgstr ""
|
1176 |
+
|
1177 |
+
#: payment-gateway/class-sv-wc-payment-gateway-payment-form.php:401
|
1178 |
+
#. translators: e-check account number, HTML form field label
|
1179 |
+
msgid "Account Number"
|
1180 |
+
msgstr ""
|
1181 |
+
|
1182 |
+
#: payment-gateway/class-sv-wc-payment-gateway-payment-form.php:466
|
1183 |
+
#. translators: Test mode refers to the current software environment
|
1184 |
+
msgid "TEST MODE ENABLED"
|
1185 |
+
msgstr ""
|
1186 |
+
|
1187 |
+
#: payment-gateway/class-sv-wc-payment-gateway-payment-form.php:565
|
1188 |
+
#. translators: Payment method as in a specific credit card, eCheck or bank
|
1189 |
+
#. account
|
1190 |
+
msgid "Manage Payment Methods"
|
1191 |
+
msgstr ""
|
1192 |
+
|
1193 |
+
#: payment-gateway/class-sv-wc-payment-gateway-payment-form.php:699
|
1194 |
+
msgid "Use a new card"
|
1195 |
+
msgstr ""
|
1196 |
+
|
1197 |
+
#: payment-gateway/class-sv-wc-payment-gateway-payment-form.php:699
|
1198 |
+
msgid "Use a new bank account"
|
1199 |
+
msgstr ""
|
1200 |
+
|
1201 |
+
#: payment-gateway/class-sv-wc-payment-gateway-payment-form.php:761
|
1202 |
+
#. translators: account as in customer's account on the eCommerce site
|
1203 |
+
msgid "Securely Save to Account"
|
1204 |
+
msgstr ""
|
1205 |
+
|
1206 |
+
#: payment-gateway/class-sv-wc-payment-gateway-plugin.php:601
|
1207 |
+
#. translators: Placeholders: %s - plugin name
|
1208 |
+
msgid ""
|
1209 |
+
"%s: WooCommerce is not being forced over SSL; your customer's payment data "
|
1210 |
+
"may be at risk."
|
1211 |
+
msgstr ""
|
1212 |
+
|
1213 |
+
#: payment-gateway/class-sv-wc-payment-gateway-plugin.php:614
|
1214 |
+
#. translators: Placeholders: %s - payment gateway name
|
1215 |
+
msgid ""
|
1216 |
+
"%s will soon require TLS 1.2 support to process transactions and your "
|
1217 |
+
"server environment may need to be updated. Please contact your hosting "
|
1218 |
+
"provider to confirm that your site can send and receive TLS 1.2 connections "
|
1219 |
+
"and request they make any necessary updates."
|
1220 |
+
msgstr ""
|
1221 |
+
|
1222 |
+
#: payment-gateway/class-sv-wc-payment-gateway-plugin.php:670
|
1223 |
+
#. translators: Placeholders: %1$s - plugin name, %2$s - a
|
1224 |
+
#. currency/comma-separated list of currencies, %3$s - <a> tag, %4$s - </a> tag
|
1225 |
+
msgid ""
|
1226 |
+
"%1$s accepts payment in %2$s only. %3$sConfigure%4$s WooCommerce to accept "
|
1227 |
+
"%2$s to enable this gateway for checkout."
|
1228 |
+
msgid_plural ""
|
1229 |
+
"%1$s accepts payment in one of %2$s only. %3$sConfigure%4$s WooCommerce to "
|
1230 |
+
"accept one of %2$s to enable this gateway for checkout."
|
1231 |
+
msgstr[0] ""
|
1232 |
+
msgstr[1] ""
|
1233 |
+
|
1234 |
+
#: payment-gateway/class-sv-wc-payment-gateway-plugin.php:705
|
1235 |
+
#. translators: Placeholders: %1$s - payment gateway name, %2$s - opening <a>
|
1236 |
+
#. tag, %3$s - closing </a> tag
|
1237 |
+
msgid ""
|
1238 |
+
"Heads up! %1$s is currently configured to log transaction data for "
|
1239 |
+
"debugging purposes. If you are not experiencing any problems with payment "
|
1240 |
+
"processing, we recommend %2$sturning off Debug Mode%3$s"
|
1241 |
+
msgstr ""
|
1242 |
+
|
1243 |
+
#: payment-gateway/class-sv-wc-payment-gateway-plugin.php:744
|
1244 |
+
#. translators: Placeholders: %1$s - payment gateway title (such as
|
1245 |
+
#. Authorize.net, Braintree, etc), %2$s - <a> tag, %3$s - </a> tag
|
1246 |
+
msgid ""
|
1247 |
+
"%1$s is inactive for subscription transactions. Please %2$senable "
|
1248 |
+
"tokenization%3$s to activate %1$s for Subscriptions."
|
1249 |
+
msgstr ""
|
1250 |
+
|
1251 |
+
#: payment-gateway/class-sv-wc-payment-gateway-plugin.php:762
|
1252 |
+
#. translators: Placeholders: %1$s - payment gateway title (such as
|
1253 |
+
#. Authorize.net, Braintree, etc), %2$s - <a> tag, %3$s - </a> tag
|
1254 |
+
msgid ""
|
1255 |
+
"%1$s is inactive for pre-order transactions. Please %2$senable "
|
1256 |
+
"tokenization%3$s to activate %1$s for Pre-Orders."
|
1257 |
+
msgstr ""
|
1258 |
+
|
1259 |
+
#: payment-gateway/class-sv-wc-payment-gateway-plugin.php:799
|
1260 |
+
msgid ""
|
1261 |
+
"You must enable tokenization for this gateway in order to support automatic "
|
1262 |
+
"renewal payments with the WooCommerce Subscriptions extension."
|
1263 |
+
msgstr ""
|
1264 |
+
|
1265 |
+
#: payment-gateway/class-sv-wc-payment-gateway-plugin.php:800
|
1266 |
+
msgid "Inactive"
|
1267 |
+
msgstr ""
|
1268 |
+
|
1269 |
+
#: payment-gateway/class-sv-wc-payment-gateway-privacy.php:114
|
1270 |
+
msgid "%s Customer ID"
|
1271 |
+
msgstr ""
|
1272 |
+
|
1273 |
+
#: payment-gateway/class-sv-wc-payment-gateway-privacy.php:183
|
1274 |
+
msgid "Type"
|
1275 |
+
msgstr ""
|
1276 |
+
|
1277 |
+
#: payment-gateway/class-sv-wc-payment-gateway-privacy.php:253
|
1278 |
+
msgid "Removed payment token \"%d\""
|
1279 |
+
msgstr ""
|
1280 |
+
|
1281 |
+
#: payment-gateway/class-sv-wc-payment-gateway-privacy.php:300
|
1282 |
+
msgid "Expiry Date"
|
1283 |
+
msgstr ""
|
1284 |
+
|
1285 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:340
|
1286 |
+
msgid "you successfully processed a payment!"
|
1287 |
+
msgstr ""
|
1288 |
+
|
1289 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:345
|
1290 |
+
msgid "you successfully processed a refund!"
|
1291 |
+
msgstr ""
|
1292 |
+
|
1293 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:481
|
1294 |
+
msgid "Check Number is missing"
|
1295 |
+
msgstr ""
|
1296 |
+
|
1297 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:482
|
1298 |
+
msgid "Drivers license state is missing"
|
1299 |
+
msgstr ""
|
1300 |
+
|
1301 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:483
|
1302 |
+
msgid "Drivers license number is missing"
|
1303 |
+
msgstr ""
|
1304 |
+
|
1305 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:659
|
1306 |
+
msgid "Place order"
|
1307 |
+
msgstr ""
|
1308 |
+
|
1309 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:691
|
1310 |
+
msgid "Thank you for your order."
|
1311 |
+
msgstr ""
|
1312 |
+
|
1313 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:1099
|
1314 |
+
msgid "Credit Card"
|
1315 |
+
msgstr ""
|
1316 |
+
|
1317 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:1101
|
1318 |
+
msgid "eCheck"
|
1319 |
+
msgstr ""
|
1320 |
+
|
1321 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:1119
|
1322 |
+
msgid "Pay securely using your credit card."
|
1323 |
+
msgstr ""
|
1324 |
+
|
1325 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:1121
|
1326 |
+
msgid "Pay securely using your checking account."
|
1327 |
+
msgstr ""
|
1328 |
+
|
1329 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:1141
|
1330 |
+
msgid "Enable this gateway"
|
1331 |
+
msgstr ""
|
1332 |
+
|
1333 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:1147
|
1334 |
+
msgid "Title"
|
1335 |
+
msgstr ""
|
1336 |
+
|
1337 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:1149
|
1338 |
+
msgid "Payment method title that the customer will see during checkout."
|
1339 |
+
msgstr ""
|
1340 |
+
|
1341 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:1154
|
1342 |
+
msgid "Description"
|
1343 |
+
msgstr ""
|
1344 |
+
|
1345 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:1156
|
1346 |
+
msgid "Payment method description that the customer will see during checkout."
|
1347 |
+
msgstr ""
|
1348 |
+
|
1349 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:1185
|
1350 |
+
msgid "Detailed Decline Messages"
|
1351 |
+
msgstr ""
|
1352 |
+
|
1353 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:1187
|
1354 |
+
msgid ""
|
1355 |
+
"Check to enable detailed decline messages to the customer during checkout "
|
1356 |
+
"when possible, rather than a generic decline message."
|
1357 |
+
msgstr ""
|
1358 |
+
|
1359 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:1197
|
1360 |
+
#. translators: Placeholders: %1$s - <a> tag, %2$s - </a> tag
|
1361 |
+
msgid ""
|
1362 |
+
"Show Detailed Error Messages and API requests/responses on the checkout "
|
1363 |
+
"page and/or save them to the %1$sdebug log%2$s"
|
1364 |
+
msgstr ""
|
1365 |
+
|
1366 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:1201
|
1367 |
+
msgid "Show on Checkout Page"
|
1368 |
+
msgstr ""
|
1369 |
+
|
1370 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:1204
|
1371 |
+
#. translators: show debugging information on both checkout page and in the log
|
1372 |
+
msgid "Both"
|
1373 |
+
msgstr ""
|
1374 |
+
|
1375 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:1267
|
1376 |
+
msgid "Select the gateway environment to use for transactions."
|
1377 |
+
msgstr ""
|
1378 |
+
|
1379 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:1321
|
1380 |
+
msgid "Share connection settings"
|
1381 |
+
msgstr ""
|
1382 |
+
|
1383 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:1323
|
1384 |
+
msgid "Use connection/authentication settings from other gateway"
|
1385 |
+
msgstr ""
|
1386 |
+
|
1387 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:1326
|
1388 |
+
msgid "Disabled because the other gateway is using these settings"
|
1389 |
+
msgstr ""
|
1390 |
+
|
1391 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:1343
|
1392 |
+
msgid "Card Verification (CSC)"
|
1393 |
+
msgstr ""
|
1394 |
+
|
1395 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:1344
|
1396 |
+
msgid "Display the Card Security Code (CV2) field on checkout"
|
1397 |
+
msgstr ""
|
1398 |
+
|
1399 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:1352
|
1400 |
+
msgid "Saved Card Verification"
|
1401 |
+
msgstr ""
|
1402 |
+
|
1403 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:1353
|
1404 |
+
msgid "Display the Card Security Code field when paying with a saved card"
|
1405 |
+
msgstr ""
|
1406 |
+
|
1407 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:1681
|
1408 |
+
#. translators: Placeholders: %1$s - site title, %2$s - order number
|
1409 |
+
msgid "%1$s - Order %2$s"
|
1410 |
+
msgstr ""
|
1411 |
+
|
1412 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:1807
|
1413 |
+
#. translators: Placeholders: %1$s - site title, %2$s - order number.
|
1414 |
+
#. Definitions: Capture as in capture funds from a credit card.
|
1415 |
+
msgid "%1$s - Capture for Order %2$s"
|
1416 |
+
msgstr ""
|
1417 |
+
|
1418 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:1948
|
1419 |
+
#. translators: Placeholders: %1$s - site title, %2$s - order number
|
1420 |
+
msgid "%1$s - Refund for Order %2$s"
|
1421 |
+
msgstr ""
|
1422 |
+
|
1423 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:2011
|
1424 |
+
#. translators: Placeholders: %1$s - payment gateway title (such as
|
1425 |
+
#. Authorize.net, Braintree, etc), %2$s - a monetary amount
|
1426 |
+
msgid "%1$s Refund in the amount of %2$s approved."
|
1427 |
+
msgstr ""
|
1428 |
+
|
1429 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:2038
|
1430 |
+
#. translators: Placeholders: %1$s - payment gateway title (such as
|
1431 |
+
#. Authorize.net, Braintree, etc), %2$s - error code, %3$s - error message
|
1432 |
+
msgid "%1$s Refund Failed: %2$s - %3$s"
|
1433 |
+
msgstr ""
|
1434 |
+
|
1435 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:2046
|
1436 |
+
#. translators: Placeholders: %1$s - payment gateway title (such as
|
1437 |
+
#. Authorize.net, Braintree, etc), %2$s - error message
|
1438 |
+
msgid "%1$s Refund Failed: %2$s"
|
1439 |
+
msgstr ""
|
1440 |
+
|
1441 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:2066
|
1442 |
+
#. translators: Placeholders: %s - payment gateway title (such as
|
1443 |
+
#. Authorize.net, Braintree, etc)
|
1444 |
+
msgid "%s Order completely refunded."
|
1445 |
+
msgstr ""
|
1446 |
+
|
1447 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:2119
|
1448 |
+
msgid ""
|
1449 |
+
"Oops, you cannot partially void this order. Please use the full order "
|
1450 |
+
"amount."
|
1451 |
+
msgstr ""
|
1452 |
+
|
1453 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:2203
|
1454 |
+
#. translators: Placeholders: %1$s - payment gateway title, %2$s - error code,
|
1455 |
+
#. %3$s - error message. Void as in to void an order.
|
1456 |
+
msgid "%1$s Void Failed: %2$s - %3$s"
|
1457 |
+
msgstr ""
|
1458 |
+
|
1459 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:2211
|
1460 |
+
#. translators: Placeholders: %1$s - payment gateway title, %2$s - error
|
1461 |
+
#. message. Void as in to void an order.
|
1462 |
+
msgid "%1$s Void Failed: %2$s"
|
1463 |
+
msgstr ""
|
1464 |
+
|
1465 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:2232
|
1466 |
+
#. translators: Placeholders: %1$s - payment gateway title, %2$s - a monetary
|
1467 |
+
#. amount. Void as in to void an order.
|
1468 |
+
msgid "%1$s Void in the amount of %2$s approved."
|
1469 |
+
msgstr ""
|
1470 |
+
|
1471 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:2327
|
1472 |
+
#: payment-gateway/payment-tokens/class-sv-wc-payment-gateway-payment-tokens-handler.php:163
|
1473 |
+
#. translators: Placeholders: %1$s - status code, %2$s - status message
|
1474 |
+
#. translators: Placeholders: %1$s - payment request response status code, %2$s
|
1475 |
+
#. - payment request response status message
|
1476 |
+
msgid "Status code %1$s: %2$s"
|
1477 |
+
msgstr ""
|
1478 |
+
|
1479 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:2330
|
1480 |
+
#: payment-gateway/payment-tokens/class-sv-wc-payment-gateway-payment-tokens-handler.php:166
|
1481 |
+
#. translators: Placeholders: %s - status code
|
1482 |
+
#. translators: Placeholders: %s - payment request response status code
|
1483 |
+
msgid "Status code: %s"
|
1484 |
+
msgstr ""
|
1485 |
+
|
1486 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:2333
|
1487 |
+
#: payment-gateway/payment-tokens/class-sv-wc-payment-gateway-payment-tokens-handler.php:169
|
1488 |
+
#. translators: Placeholders; %s - status message
|
1489 |
+
#. translators: Placeholders: %s - payment request response status message
|
1490 |
+
msgid "Status message: %s"
|
1491 |
+
msgstr ""
|
1492 |
+
|
1493 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:2338
|
1494 |
+
#: payment-gateway/payment-tokens/class-sv-wc-payment-gateway-payment-tokens-handler.php:176
|
1495 |
+
msgid "Transaction ID %s"
|
1496 |
+
msgstr ""
|
1497 |
+
|
1498 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:2517
|
1499 |
+
#. translators: Placeholders: %1$s - payment method title, %2$s - environment
|
1500 |
+
#. ("Test"), %3$s - transaction type (authorization/charge)
|
1501 |
+
msgid "%1$s %2$s %3$s Approved"
|
1502 |
+
msgstr ""
|
1503 |
+
|
1504 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:2527
|
1505 |
+
#. translators: Placeholders: %1$s - credit card type (MasterCard, Visa,
|
1506 |
+
#. etc...), %2$s - last four digits of the card
|
1507 |
+
msgid "%1$s ending in %2$s"
|
1508 |
+
msgstr ""
|
1509 |
+
|
1510 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:2621
|
1511 |
+
#. translators: Placeholders: %1$s - payment gateway title, %2$s - message
|
1512 |
+
#. (probably reason for the transaction being held for review)
|
1513 |
+
msgid "%1$s Transaction Held for Review (%2$s)"
|
1514 |
+
msgstr ""
|
1515 |
+
|
1516 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:2663
|
1517 |
+
msgid ""
|
1518 |
+
"Your order has been received and is being reviewed. Thank you for your "
|
1519 |
+
"business."
|
1520 |
+
msgstr ""
|
1521 |
+
|
1522 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:2708
|
1523 |
+
#. translators: Placeholders: %1$s - payment gateway title, %2$s - error
|
1524 |
+
#. message; e.g. Order Note: [Payment method] Payment failed [error]
|
1525 |
+
msgid "%1$s Payment Failed (%2$s)"
|
1526 |
+
msgstr ""
|
1527 |
+
|
1528 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:2725
|
1529 |
+
#: payment-gateway/integrations/class-sv-wc-payment-gateway-integration-subscriptions.php:375
|
1530 |
+
msgid "An error occurred, please try again or try an alternate form of payment."
|
1531 |
+
msgstr ""
|
1532 |
+
|
1533 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:2742
|
1534 |
+
#. translators: Placeholders: %1$s - payment gateway title, %2$s -
|
1535 |
+
#. message/error
|
1536 |
+
msgid "%1$s Transaction Cancelled (%2$s)"
|
1537 |
+
msgstr ""
|
1538 |
+
|
1539 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:2986
|
1540 |
+
msgid "Transaction Type"
|
1541 |
+
msgstr ""
|
1542 |
+
|
1543 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:2988
|
1544 |
+
msgid ""
|
1545 |
+
"Select how transactions should be processed. Charge submits all "
|
1546 |
+
"transactions for settlement, Authorization simply authorizes the order "
|
1547 |
+
"total for capture later."
|
1548 |
+
msgstr ""
|
1549 |
+
|
1550 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:2999
|
1551 |
+
msgid "Charge Virtual-Only Orders"
|
1552 |
+
msgstr ""
|
1553 |
+
|
1554 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:3001
|
1555 |
+
msgid ""
|
1556 |
+
"If the order contains exclusively virtual items, enable this to immediately "
|
1557 |
+
"charge, rather than authorize, the transaction."
|
1558 |
+
msgstr ""
|
1559 |
+
|
1560 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:3009
|
1561 |
+
msgid "Enable Partial Capture"
|
1562 |
+
msgstr ""
|
1563 |
+
|
1564 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:3011
|
1565 |
+
msgid "Allow orders to be partially captured multiple times."
|
1566 |
+
msgstr ""
|
1567 |
+
|
1568 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:3023
|
1569 |
+
msgid "Capture Paid Orders"
|
1570 |
+
msgstr ""
|
1571 |
+
|
1572 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:3026
|
1573 |
+
msgid "Automatically capture orders when they are changed to %s."
|
1574 |
+
msgstr ""
|
1575 |
+
|
1576 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:3027
|
1577 |
+
msgid "a paid status"
|
1578 |
+
msgstr ""
|
1579 |
+
|
1580 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:3216
|
1581 |
+
msgid "Accepted Card Logos"
|
1582 |
+
msgstr ""
|
1583 |
+
|
1584 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:3218
|
1585 |
+
msgid ""
|
1586 |
+
"These are the card logos that are displayed to customers as accepted during "
|
1587 |
+
"checkout."
|
1588 |
+
msgstr ""
|
1589 |
+
|
1590 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:3219
|
1591 |
+
msgid ""
|
1592 |
+
"This can be configured to match those accepted by your payment processor, "
|
1593 |
+
"but does not change your merchant account configuration."
|
1594 |
+
msgstr ""
|
1595 |
+
|
1596 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:3307
|
1597 |
+
#. translators:
|
1598 |
+
#. http:www.cybersource.com/products/payment_security/payment_tokenization/ and
|
1599 |
+
#. https:en.wikipedia.org/wiki/Tokenization_(data_security)
|
1600 |
+
msgid "Tokenization"
|
1601 |
+
msgstr ""
|
1602 |
+
|
1603 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:3308
|
1604 |
+
msgid "Allow customers to securely save their payment details for future checkout."
|
1605 |
+
msgstr ""
|
1606 |
+
|
1607 |
+
#: payment-gateway/integrations/class-sv-wc-payment-gateway-integration-pre-orders.php:250
|
1608 |
+
msgid "Pre-Order Tokenization attempt failed (%s)"
|
1609 |
+
msgstr ""
|
1610 |
+
|
1611 |
+
#: payment-gateway/integrations/class-sv-wc-payment-gateway-integration-pre-orders.php:294
|
1612 |
+
msgid "%s - Pre-Order Release Payment for Order %s"
|
1613 |
+
msgstr ""
|
1614 |
+
|
1615 |
+
#: payment-gateway/integrations/class-sv-wc-payment-gateway-integration-pre-orders.php:298
|
1616 |
+
msgid "Payment token missing/invalid."
|
1617 |
+
msgstr ""
|
1618 |
+
|
1619 |
+
#: payment-gateway/integrations/class-sv-wc-payment-gateway-integration-pre-orders.php:323
|
1620 |
+
msgid "%s %s Pre-Order Release Payment Approved: %s ending in %s (expires %s)"
|
1621 |
+
msgstr ""
|
1622 |
+
|
1623 |
+
#: payment-gateway/integrations/class-sv-wc-payment-gateway-integration-pre-orders.php:334
|
1624 |
+
msgid "%s eCheck Pre-Order Release Payment Approved: %s ending in %s"
|
1625 |
+
msgstr ""
|
1626 |
+
|
1627 |
+
#: payment-gateway/integrations/class-sv-wc-payment-gateway-integration-pre-orders.php:376
|
1628 |
+
msgid "Pre-Order Release Payment Failed: %s"
|
1629 |
+
msgstr ""
|
1630 |
+
|
1631 |
+
#: payment-gateway/integrations/class-sv-wc-payment-gateway-integration-subscriptions.php:212
|
1632 |
+
msgid "Subscription Renewal: payment token is missing/invalid."
|
1633 |
+
msgstr ""
|
1634 |
+
|
1635 |
+
#: payment-gateway/integrations/class-sv-wc-payment-gateway-integration-subscriptions.php:238
|
1636 |
+
msgid "%1$s - Subscription Renewal Order %2$s"
|
1637 |
+
msgstr ""
|
1638 |
+
|
1639 |
+
#: payment-gateway/integrations/class-sv-wc-payment-gateway-integration-subscriptions.php:370
|
1640 |
+
#. translators: Placeholders: %1$s - payment gateway title, %2$s - error
|
1641 |
+
#. message; e.g. Order Note: [Payment method] Payment Change failed [error]
|
1642 |
+
msgid "%1$s Payment Change Failed (%2$s)"
|
1643 |
+
msgstr ""
|
1644 |
+
|
1645 |
+
#: payment-gateway/integrations/class-sv-wc-payment-gateway-integration-subscriptions.php:510
|
1646 |
+
msgid "Via %s ending in %s"
|
1647 |
+
msgstr ""
|
1648 |
+
|
1649 |
+
#: payment-gateway/integrations/class-sv-wc-payment-gateway-integration-subscriptions.php:537
|
1650 |
+
msgid "Subscriptions"
|
1651 |
+
msgstr ""
|
1652 |
+
|
1653 |
+
#: payment-gateway/integrations/class-sv-wc-payment-gateway-integration-subscriptions.php:605
|
1654 |
+
msgid ""
|
1655 |
+
"This payment method is tied to a subscription and cannot be deleted. Please "
|
1656 |
+
"switch the subscription to another method first."
|
1657 |
+
msgstr ""
|
1658 |
+
|
1659 |
+
#: payment-gateway/integrations/class-sv-wc-payment-gateway-integration-subscriptions.php:656
|
1660 |
+
msgid "Payment Token"
|
1661 |
+
msgstr ""
|
1662 |
+
|
1663 |
+
#: payment-gateway/integrations/class-sv-wc-payment-gateway-integration-subscriptions.php:684
|
1664 |
+
#: payment-gateway/integrations/class-sv-wc-payment-gateway-integration-subscriptions.php:689
|
1665 |
+
msgid "%s is required."
|
1666 |
+
msgstr ""
|
1667 |
+
|
1668 |
+
#: payment-gateway/payment-tokens/class-sv-wc-payment-gateway-payment-tokens-handler.php:171
|
1669 |
+
msgid "Unknown Error"
|
1670 |
+
msgstr ""
|
1671 |
+
|
1672 |
+
#: utilities/class-sv-wp-background-job-handler.php:640
|
1673 |
+
msgid "Job data key \"%s\" not set"
|
1674 |
+
msgstr ""
|
1675 |
+
|
1676 |
+
#: utilities/class-sv-wp-background-job-handler.php:644
|
1677 |
+
msgid "Job data key \"%s\" is not an array"
|
1678 |
+
msgstr ""
|
1679 |
+
|
1680 |
+
#: utilities/class-sv-wp-background-job-handler.php:877
|
1681 |
+
msgid "Every %d Minutes"
|
1682 |
+
msgstr ""
|
1683 |
+
|
1684 |
+
#: utilities/class-sv-wp-background-job-handler.php:1040
|
1685 |
+
msgid "Background Processing Test"
|
1686 |
+
msgstr ""
|
1687 |
+
|
1688 |
+
#: utilities/class-sv-wp-background-job-handler.php:1041
|
1689 |
+
msgid "Run Test"
|
1690 |
+
msgstr ""
|
1691 |
+
|
1692 |
+
#: utilities/class-sv-wp-background-job-handler.php:1042
|
1693 |
+
msgid ""
|
1694 |
+
"This tool will test whether your server is capable of processing background "
|
1695 |
+
"jobs."
|
1696 |
+
msgstr ""
|
1697 |
+
|
1698 |
+
#: utilities/class-sv-wp-background-job-handler.php:1060
|
1699 |
+
msgid "Success! You should be able to process background jobs."
|
1700 |
+
msgstr ""
|
1701 |
+
|
1702 |
+
#: utilities/class-sv-wp-background-job-handler.php:1063
|
1703 |
+
msgid ""
|
1704 |
+
"Could not connect. Please ask your hosting company to ensure your server "
|
1705 |
+
"has loopback connections enabled."
|
1706 |
+
msgstr ""
|
1707 |
+
|
1708 |
+
#: admin/abstract-sv-wc-plugin-admin-setup-wizard.php:397
|
1709 |
+
msgctxt "enhanced select"
|
1710 |
+
msgid "No matches found"
|
1711 |
+
msgstr ""
|
1712 |
+
|
1713 |
+
#: admin/abstract-sv-wc-plugin-admin-setup-wizard.php:398
|
1714 |
+
msgctxt "enhanced select"
|
1715 |
+
msgid "Loading failed"
|
1716 |
+
msgstr ""
|
1717 |
+
|
1718 |
+
#: admin/abstract-sv-wc-plugin-admin-setup-wizard.php:399
|
1719 |
+
msgctxt "enhanced select"
|
1720 |
+
msgid "Please enter 1 or more characters"
|
1721 |
+
msgstr ""
|
1722 |
+
|
1723 |
+
#: admin/abstract-sv-wc-plugin-admin-setup-wizard.php:400
|
1724 |
+
msgctxt "enhanced select"
|
1725 |
+
msgid "Please enter %qty% or more characters"
|
1726 |
+
msgstr ""
|
1727 |
+
|
1728 |
+
#: admin/abstract-sv-wc-plugin-admin-setup-wizard.php:401
|
1729 |
+
msgctxt "enhanced select"
|
1730 |
+
msgid "Please delete 1 character"
|
1731 |
+
msgstr ""
|
1732 |
+
|
1733 |
+
#: admin/abstract-sv-wc-plugin-admin-setup-wizard.php:402
|
1734 |
+
msgctxt "enhanced select"
|
1735 |
+
msgid "Please delete %qty% characters"
|
1736 |
+
msgstr ""
|
1737 |
+
|
1738 |
+
#: admin/abstract-sv-wc-plugin-admin-setup-wizard.php:403
|
1739 |
+
msgctxt "enhanced select"
|
1740 |
+
msgid "You can only select 1 item"
|
1741 |
+
msgstr ""
|
1742 |
+
|
1743 |
+
#: admin/abstract-sv-wc-plugin-admin-setup-wizard.php:404
|
1744 |
+
msgctxt "enhanced select"
|
1745 |
+
msgid "You can only select %qty% items"
|
1746 |
+
msgstr ""
|
1747 |
+
|
1748 |
+
#: admin/abstract-sv-wc-plugin-admin-setup-wizard.php:405
|
1749 |
+
msgctxt "enhanced select"
|
1750 |
+
msgid "Loading more results…"
|
1751 |
+
msgstr ""
|
1752 |
+
|
1753 |
+
#: admin/abstract-sv-wc-plugin-admin-setup-wizard.php:406
|
1754 |
+
msgctxt "enhanced select"
|
1755 |
+
msgid "Searching…"
|
1756 |
+
msgstr ""
|
1757 |
+
|
1758 |
+
#: class-sv-wc-helper.php:407
|
1759 |
+
msgctxt "coordinating conjunction for a list of items: a, b, and c"
|
1760 |
+
msgid "and"
|
1761 |
+
msgstr ""
|
1762 |
+
|
1763 |
+
#: class-sv-wc-plugin.php:534
|
1764 |
+
msgctxt "noun"
|
1765 |
+
msgid "Support"
|
1766 |
+
msgstr ""
|
1767 |
+
|
1768 |
+
#: class-sv-wc-plugin.php:539
|
1769 |
+
msgctxt "verb"
|
1770 |
+
msgid "Review"
|
1771 |
+
msgstr ""
|
1772 |
+
|
1773 |
+
#: payment-gateway/class-sv-wc-payment-gateway-direct.php:733
|
1774 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:2519
|
1775 |
+
msgctxt "noun, software environment"
|
1776 |
+
msgid "Test"
|
1777 |
+
msgstr ""
|
1778 |
+
|
1779 |
+
#: payment-gateway/class-sv-wc-payment-gateway-direct.php:734
|
1780 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:2520
|
1781 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:2992
|
1782 |
+
msgctxt "credit card transaction type"
|
1783 |
+
msgid "Authorization"
|
1784 |
+
msgstr ""
|
1785 |
+
|
1786 |
+
#: payment-gateway/class-sv-wc-payment-gateway-direct.php:734
|
1787 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:2520
|
1788 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:2991
|
1789 |
+
msgctxt "noun, credit card transaction type"
|
1790 |
+
msgid "Charge"
|
1791 |
+
msgstr ""
|
1792 |
+
|
1793 |
+
#: payment-gateway/class-sv-wc-payment-gateway-helper.php:192
|
1794 |
+
msgctxt "payment method type"
|
1795 |
+
msgid "Account"
|
1796 |
+
msgstr ""
|
1797 |
+
|
1798 |
+
#: payment-gateway/class-sv-wc-payment-gateway-helper.php:227
|
1799 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:3244
|
1800 |
+
msgctxt "credit card type"
|
1801 |
+
msgid "Visa"
|
1802 |
+
msgstr ""
|
1803 |
+
|
1804 |
+
#: payment-gateway/class-sv-wc-payment-gateway-helper.php:231
|
1805 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:3245
|
1806 |
+
msgctxt "credit card type"
|
1807 |
+
msgid "MasterCard"
|
1808 |
+
msgstr ""
|
1809 |
+
|
1810 |
+
#: payment-gateway/class-sv-wc-payment-gateway-helper.php:235
|
1811 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:3246
|
1812 |
+
msgctxt "credit card type"
|
1813 |
+
msgid "American Express"
|
1814 |
+
msgstr ""
|
1815 |
+
|
1816 |
+
#: payment-gateway/class-sv-wc-payment-gateway-helper.php:239
|
1817 |
+
msgctxt "credit card type"
|
1818 |
+
msgid "Diners Club"
|
1819 |
+
msgstr ""
|
1820 |
+
|
1821 |
+
#: payment-gateway/class-sv-wc-payment-gateway-helper.php:243
|
1822 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:3247
|
1823 |
+
msgctxt "credit card type"
|
1824 |
+
msgid "Discover"
|
1825 |
+
msgstr ""
|
1826 |
+
|
1827 |
+
#: payment-gateway/class-sv-wc-payment-gateway-helper.php:247
|
1828 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:3249
|
1829 |
+
msgctxt "credit card type"
|
1830 |
+
msgid "JCB"
|
1831 |
+
msgstr ""
|
1832 |
+
|
1833 |
+
#: payment-gateway/class-sv-wc-payment-gateway-helper.php:251
|
1834 |
+
msgctxt "credit card type"
|
1835 |
+
msgid "CarteBleue"
|
1836 |
+
msgstr ""
|
1837 |
+
|
1838 |
+
#: payment-gateway/class-sv-wc-payment-gateway-helper.php:255
|
1839 |
+
msgctxt "credit card type"
|
1840 |
+
msgid "Maestro"
|
1841 |
+
msgstr ""
|
1842 |
+
|
1843 |
+
#: payment-gateway/class-sv-wc-payment-gateway-helper.php:259
|
1844 |
+
msgctxt "credit card type"
|
1845 |
+
msgid "Laser"
|
1846 |
+
msgstr ""
|
1847 |
+
|
1848 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:3248
|
1849 |
+
msgctxt "credit card type"
|
1850 |
+
msgid "Diners"
|
1851 |
+
msgstr ""
|
1852 |
+
|
1853 |
+
#: payment-gateway/class-sv-wc-payment-gateway-payment-form.php:427
|
1854 |
+
#. translators: http:www.investopedia.com/terms/c/checkingaccount.asp
|
1855 |
+
msgctxt "account type"
|
1856 |
+
msgid "Checking"
|
1857 |
+
msgstr ""
|
1858 |
+
|
1859 |
+
#: payment-gateway/class-sv-wc-payment-gateway-payment-form.php:429
|
1860 |
+
#. translators: http:www.investopedia.com/terms/s/savingsaccount.asp
|
1861 |
+
msgctxt "account type"
|
1862 |
+
msgid "Savings"
|
1863 |
+
msgstr ""
|
1864 |
+
|
1865 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:2306
|
1866 |
+
msgctxt "hash before order number"
|
1867 |
+
msgid "#"
|
1868 |
+
msgstr ""
|
1869 |
+
|
1870 |
+
#: payment-gateway/integrations/class-sv-wc-payment-gateway-integration-subscriptions.php:567
|
1871 |
+
msgctxt "hash before order number"
|
1872 |
+
msgid "#%s"
|
1873 |
+
msgstr ""
|
1874 |
+
|
1875 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:3020
|
1876 |
+
msgctxt ""
|
1877 |
+
"coordinating conjunction for a list of order statuses: on-hold, processing, "
|
1878 |
+
"or completed"
|
1879 |
+
msgid "or"
|
1880 |
+
msgstr ""
|
1881 |
+
|
1882 |
+
#: payment-gateway/class-sv-wc-payment-gateway.php:3844
|
1883 |
+
#. translators: https:www.skyverge.com/for-translators-environments/
|
1884 |
+
msgctxt "software environment"
|
1885 |
+
msgid "Production"
|
1886 |
+
msgstr ""
|
lib/skyverge/woocommerce/index.php
CHANGED
@@ -18,7 +18,7 @@
|
|
18 |
*
|
19 |
* @package SkyVerge/WooCommerce
|
20 |
* @author SkyVerge
|
21 |
-
* @copyright Copyright (c) 2013-
|
22 |
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
|
23 |
*/
|
24 |
|
18 |
*
|
19 |
* @package SkyVerge/WooCommerce
|
20 |
* @author SkyVerge
|
21 |
+
* @copyright Copyright (c) 2013-2018, SkyVerge, Inc.
|
22 |
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
|
23 |
*/
|
24 |
|
lib/skyverge/woocommerce/payment-gateway/Handlers/Capture.php
ADDED
@@ -0,0 +1,424 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* WooCommerce Payment Gateway Framework
|
4 |
+
*
|
5 |
+
* This source file is subject to the GNU General Public License v3.0
|
6 |
+
* that is bundled with this package in the file license.txt.
|
7 |
+
* It is also available through the world-wide-web at this URL:
|
8 |
+
* http://www.gnu.org/licenses/gpl-3.0.html
|
9 |
+
* If you did not receive a copy of the license and are unable to
|
10 |
+
* obtain it through the world-wide-web, please send an email
|
11 |
+
* to license@skyverge.com so we can send you a copy immediately.
|
12 |
+
*
|
13 |
+
* DISCLAIMER
|
14 |
+
*
|
15 |
+
* Do not edit or add to this file if you wish to upgrade the plugin to newer
|
16 |
+
* versions in the future. If you wish to customize the plugin for your
|
17 |
+
* needs please refer to http://www.skyverge.com
|
18 |
+
*
|
19 |
+
* @package SkyVerge/WooCommerce/Payment-Gateway/Admin
|
20 |
+
* @author SkyVerge
|
21 |
+
* @copyright Copyright (c) 2013-2018, SkyVerge, Inc.
|
22 |
+
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
|
23 |
+
*/
|
24 |
+
|
25 |
+
namespace WC_Braintree\Plugin_Framework\Payment_Gateway\Handlers;
|
26 |
+
|
27 |
+
use WC_Braintree\Plugin_Framework as Framework;
|
28 |
+
|
29 |
+
defined( 'ABSPATH' ) or exit;
|
30 |
+
|
31 |
+
if ( ! class_exists( '\\WC_Braintree\\Plugin_Framework\\Payment_Gateway\\Handlers\\Capture' ) ) :
|
32 |
+
|
33 |
+
/**
|
34 |
+
* The transaction capture handler.
|
35 |
+
*
|
36 |
+
* @since 5.3.0-dev
|
37 |
+
*/
|
38 |
+
class Capture {
|
39 |
+
|
40 |
+
|
41 |
+
/** @var Framework\SV_WC_Payment_Gateway payment gateway instance */
|
42 |
+
private $gateway;
|
43 |
+
|
44 |
+
|
45 |
+
/**
|
46 |
+
* Capture constructor.
|
47 |
+
*
|
48 |
+
* @since 5.3.0-dev
|
49 |
+
*
|
50 |
+
* @param Framework\SV_WC_Payment_Gateway $gateway payment gateway instance
|
51 |
+
*/
|
52 |
+
public function __construct( Framework\SV_WC_Payment_Gateway $gateway ) {
|
53 |
+
|
54 |
+
$this->gateway = $gateway;
|
55 |
+
|
56 |
+
// auto-capture on order status change if enabled
|
57 |
+
if ( $gateway->supports_credit_card_capture() && $gateway->is_paid_capture_enabled() ) {
|
58 |
+
add_action( 'woocommerce_order_status_changed', array( $this, 'maybe_capture_paid_order' ), 10, 3 );
|
59 |
+
}
|
60 |
+
}
|
61 |
+
|
62 |
+
|
63 |
+
/**
|
64 |
+
* Captures an order on status change to a "paid" status.
|
65 |
+
*
|
66 |
+
* @internal
|
67 |
+
*
|
68 |
+
* @since 5.3.0-dev
|
69 |
+
*
|
70 |
+
* @param int $order_id order ID
|
71 |
+
* @param string $old_status status being changed
|
72 |
+
* @param string $new_status new order status
|
73 |
+
*/
|
74 |
+
public function maybe_capture_paid_order( $order_id, $old_status, $new_status ) {
|
75 |
+
|
76 |
+
$paid_statuses = Framework\SV_WC_Plugin_Compatibility::wc_get_is_paid_statuses();
|
77 |
+
|
78 |
+
// bail if changing to a non-paid status or from a paid status
|
79 |
+
if ( ! in_array( $new_status, $paid_statuses, true ) || in_array( $old_status, $paid_statuses, true ) ) {
|
80 |
+
return;
|
81 |
+
}
|
82 |
+
|
83 |
+
$order = wc_get_order( $order_id );
|
84 |
+
|
85 |
+
if ( ! $order ) {
|
86 |
+
return;
|
87 |
+
}
|
88 |
+
|
89 |
+
$payment_method = Framework\SV_WC_Order_Compatibility::get_prop( $order, 'payment_method' );
|
90 |
+
|
91 |
+
if ( $payment_method !== $this->get_gateway()->get_id() ) {
|
92 |
+
return;
|
93 |
+
}
|
94 |
+
|
95 |
+
$this->maybe_perform_capture( $order );
|
96 |
+
}
|
97 |
+
|
98 |
+
|
99 |
+
/**
|
100 |
+
* Perform a capture on an order if it can be captured.
|
101 |
+
*
|
102 |
+
* This acts as a wrapper for when the process should just bail without logging any errors or order notes, like when
|
103 |
+
* performing capture via bulk action.
|
104 |
+
*
|
105 |
+
* @since 5.3.0-dev
|
106 |
+
*
|
107 |
+
* @param \WC_Order $order order object
|
108 |
+
* @param float|null $amount amount to capture
|
109 |
+
* @return bool
|
110 |
+
*/
|
111 |
+
public function maybe_perform_capture( \WC_Order $order, $amount = null ) {
|
112 |
+
|
113 |
+
// don't log any errors for for orders that can't be captured
|
114 |
+
if ( ! $this->order_can_be_captured( $order ) ) {
|
115 |
+
return false;
|
116 |
+
}
|
117 |
+
|
118 |
+
$result = $this->perform_capture( $order, $amount );
|
119 |
+
|
120 |
+
return ! empty( $result['success'] );
|
121 |
+
}
|
122 |
+
|
123 |
+
|
124 |
+
/**
|
125 |
+
* Performs a credit card capture for an order.
|
126 |
+
*
|
127 |
+
* @since 5.3.0-dev
|
128 |
+
*
|
129 |
+
* @param \WC_Order $order WooCommerce order object
|
130 |
+
* @param float|null $amount amount to capture
|
131 |
+
* @return array {
|
132 |
+
* Capture transaction results
|
133 |
+
*
|
134 |
+
* @type bool $success whether the capture was successful
|
135 |
+
* @type int $code result code
|
136 |
+
* @type string $message result message
|
137 |
+
* }
|
138 |
+
*/
|
139 |
+
public function perform_capture( \WC_Order $order, $amount = null ) {
|
140 |
+
|
141 |
+
$order = $this->get_gateway()->get_order_for_capture( $order, $amount );
|
142 |
+
|
143 |
+
try {
|
144 |
+
|
145 |
+
// notify if the gateway doesn't support captures when this is called directly
|
146 |
+
if ( ! $this->get_gateway()->supports_credit_card_capture() ) {
|
147 |
+
|
148 |
+
$message = "{$this->get_gateway()->get_method_title()} does not support payment captures";
|
149 |
+
|
150 |
+
Framework\SV_WC_Plugin_Compatibility::wc_doing_it_wrong( __METHOD__, $message, '5.3.0-dev' );
|
151 |
+
|
152 |
+
throw new Framework\SV_WC_Payment_Gateway_Exception( $message, 500 );
|
153 |
+
}
|
154 |
+
|
155 |
+
// don't try to capture cancelled/fully refunded transactions
|
156 |
+
if ( ! $this->is_order_ready_for_capture( $order ) ) {
|
157 |
+
throw new Framework\SV_WC_Payment_Gateway_Exception( __( 'Order cannot be captured', 'woocommerce-gateway-paypal-powered-by-braintree' ), 400 );
|
158 |
+
}
|
159 |
+
|
160 |
+
// don't re-capture fully captured orders
|
161 |
+
if ( $this->has_order_authorization_expired( $order ) ) {
|
162 |
+
throw new Framework\SV_WC_Payment_Gateway_Exception( __( 'Transaction authorization has expired', 'woocommerce-gateway-paypal-powered-by-braintree' ), 400 );
|
163 |
+
}
|
164 |
+
|
165 |
+
// don't re-capture fully captured orders
|
166 |
+
if ( $this->is_order_fully_captured( $order ) ) {
|
167 |
+
throw new Framework\SV_WC_Payment_Gateway_Exception( __( 'Transaction has already been fully captured', 'woocommerce-gateway-paypal-powered-by-braintree' ), 400 );
|
168 |
+
}
|
169 |
+
|
170 |
+
// generally unavailable
|
171 |
+
if ( ! $this->order_can_be_captured( $order ) ) {
|
172 |
+
throw new Framework\SV_WC_Payment_Gateway_Exception( __( 'Transaction cannot be captured', 'woocommerce-gateway-paypal-powered-by-braintree' ), 400 );
|
173 |
+
}
|
174 |
+
|
175 |
+
// attempt the capture
|
176 |
+
$response = $this->get_gateway()->get_api()->credit_card_capture( $order );
|
177 |
+
|
178 |
+
// bail early if the capture wasn't approved
|
179 |
+
if ( ! $response->transaction_approved() ) {
|
180 |
+
|
181 |
+
$this->do_capture_failed( $order, $response );
|
182 |
+
|
183 |
+
throw new Framework\SV_WC_Payment_Gateway_Exception( $response->get_status_code() . ' - ' . $response->get_status_message() );
|
184 |
+
}
|
185 |
+
|
186 |
+
$message = sprintf(
|
187 |
+
/* translators: Placeholders: %1$s - payment gateway title (such as Authorize.net, Braintree, etc), %2$s - transaction amount. Definitions: Capture, as in capture funds from a credit card. */
|
188 |
+
__( '%1$s Capture of %2$s Approved', 'woocommerce-gateway-paypal-powered-by-braintree' ),
|
189 |
+
$this->get_gateway()->get_method_title(),
|
190 |
+
wc_price( $order->capture->amount, array( 'currency' => Framework\SV_WC_Order_Compatibility::get_prop( $order, 'currency', 'view' ) ) )
|
191 |
+
);
|
192 |
+
|
193 |
+
// adds the transaction id (if any) to the order note
|
194 |
+
if ( $response->get_transaction_id() ) {
|
195 |
+
$message .= ' ' . sprintf( esc_html__( '(Transaction ID %s)', 'woocommerce-gateway-paypal-powered-by-braintree' ), $response->get_transaction_id() );
|
196 |
+
}
|
197 |
+
|
198 |
+
$order->add_order_note( $message );
|
199 |
+
|
200 |
+
// add the standard capture data to the order
|
201 |
+
$this->do_capture_success( $order, $response );
|
202 |
+
|
203 |
+
// if the original auth amount has been captured, complete payment
|
204 |
+
if ( $this->get_gateway()->get_order_meta( $order, 'capture_total' ) >= Framework\SV_WC_Helper::number_format( $this->get_order_authorization_amount( $order ) ) ) {
|
205 |
+
|
206 |
+
// prevent stock from being reduced when payment is completed as this is done when the charge was authorized
|
207 |
+
add_filter( 'woocommerce_payment_complete_reduce_order_stock', '__return_false', 100 );
|
208 |
+
|
209 |
+
// complete the order
|
210 |
+
$order->payment_complete();
|
211 |
+
}
|
212 |
+
|
213 |
+
return array(
|
214 |
+
'success' => true,
|
215 |
+
'code' => 200,
|
216 |
+
'message' => $message,
|
217 |
+
);
|
218 |
+
|
219 |
+
} catch ( Framework\SV_WC_Plugin_Exception $exception ) {
|
220 |
+
|
221 |
+
// add an order note if this isn't a general error
|
222 |
+
if ( 500 !== $exception->getCode() ) {
|
223 |
+
|
224 |
+
$note_message = sprintf(
|
225 |
+
/* translators: Placeholders: %1$s - payment gateway title (such as Authorize.net, Braintree, etc), %2$s - failure message. Definitions: "capture" as in capturing funds from a credit card. */
|
226 |
+
__( '%1$s Capture Failed: %2$s', 'woocommerce-gateway-paypal-powered-by-braintree' ),
|
227 |
+
$this->get_gateway()->get_method_title(),
|
228 |
+
$exception->getMessage()
|
229 |
+
);
|
230 |
+
|
231 |
+
$order->add_order_note( $note_message );
|
232 |
+
}
|
233 |
+
|
234 |
+
return array(
|
235 |
+
'success' => false,
|
236 |
+
'code' => $exception->getCode(),
|
237 |
+
'message' => $exception->getMessage(),
|
238 |
+
);
|
239 |
+
}
|
240 |
+
}
|
241 |
+
|
242 |
+
|
243 |
+
/**
|
244 |
+
* Adds the standard capture data to an order.
|
245 |
+
*
|
246 |
+
* @since 5.3.0-dev
|
247 |
+
*
|
248 |
+
* @param \WC_Order $order the order object
|
249 |
+
* @param Framework\SV_WC_Payment_Gateway_API_Response $response transaction response
|
250 |
+
*/
|
251 |
+
public function do_capture_success( \WC_Order $order, Framework\SV_WC_Payment_Gateway_API_Response $response ) {
|
252 |
+
|
253 |
+
$total_captured = (float) $this->get_gateway()->get_order_meta( $order, 'capture_total' ) + (float) $order->capture->amount;
|
254 |
+
|
255 |
+
$this->get_gateway()->update_order_meta( $order, 'capture_total', Framework\SV_WC_Helper::number_format( $total_captured ) );
|
256 |
+
$this->get_gateway()->update_order_meta( $order, 'charge_captured', $this->get_gateway()->supports_credit_card_partial_capture() && $this->get_gateway()->is_partial_capture_enabled() && $total_captured < (float) $this->get_order_capture_maximum( $order ) ? 'partial' : 'yes' );
|
257 |
+
|
258 |
+
// add capture transaction ID
|
259 |
+
if ( $response && $response->get_transaction_id() ) {
|
260 |
+
$this->get_gateway()->update_order_meta( $order, 'capture_trans_id', $response->get_transaction_id() );
|
261 |
+
}
|
262 |
+
}
|
263 |
+
|
264 |
+
|
265 |
+
/**
|
266 |
+
* Lets gateways handle any specific capture failure results for the order.
|
267 |
+
*
|
268 |
+
* @since 5.3.0-dev
|
269 |
+
*
|
270 |
+
* @param \WC_Order $order WooCommerce order object
|
271 |
+
* @param Framework\SV_WC_Payment_Gateway_API_Response $response API response object
|
272 |
+
*/
|
273 |
+
public function do_capture_failed( \WC_Order $order, Framework\SV_WC_Payment_Gateway_API_Response $response ) { }
|
274 |
+
|
275 |
+
|
276 |
+
/** Conditional Methods *******************************************************************************************/
|
277 |
+
|
278 |
+
|
279 |
+
/**
|
280 |
+
* Determines if an order is eligible for capture.
|
281 |
+
*
|
282 |
+
* @since 5.3.0-dev
|
283 |
+
*
|
284 |
+
* @param \WC_Order $order order object
|
285 |
+
* @return bool
|
286 |
+
*/
|
287 |
+
public function order_can_be_captured( \WC_Order $order ) {
|
288 |
+
|
289 |
+
// check whether the charge has already been captured by this gateway
|
290 |
+
if ( ! $this->is_order_ready_for_capture( $order ) || $this->is_order_fully_captured( $order ) ) {
|
291 |
+
return false;
|
292 |
+
}
|
293 |
+
|
294 |
+
// if for any reason the authorization can not be captured
|
295 |
+
if ( 'no' === $this->get_gateway()->get_order_meta( $order, 'auth_can_be_captured' ) ) {
|
296 |
+
return false;
|
297 |
+
}
|
298 |
+
|
299 |
+
// authorization hasn't already been captured, but has it expired?
|
300 |
+
return ! $this->has_order_authorization_expired( $order );
|
301 |
+
}
|
302 |
+
|
303 |
+
|
304 |
+
/**
|
305 |
+
* Determines if an order is ready for capture.
|
306 |
+
*
|
307 |
+
* @since 5.3.0-dev
|
308 |
+
*
|
309 |
+
* @param \WC_Order $order order object
|
310 |
+
* @return bool
|
311 |
+
*/
|
312 |
+
public function is_order_ready_for_capture( \WC_Order $order ) {
|
313 |
+
|
314 |
+
return ! in_array( $order->get_status(), array( 'cancelled', 'refunded' ), true );
|
315 |
+
}
|
316 |
+
|
317 |
+
|
318 |
+
/**
|
319 |
+
* Determines if an order has been fully captured
|
320 |
+
*
|
321 |
+
* @since 5.3.0-dev
|
322 |
+
*
|
323 |
+
* @param \WC_Order $order
|
324 |
+
* @return bool
|
325 |
+
*/
|
326 |
+
public function is_order_fully_captured( \WC_Order $order ) {
|
327 |
+
|
328 |
+
$captured = 'yes' === $this->get_gateway()->get_order_meta( $order, 'charge_captured' );
|
329 |
+
|
330 |
+
if ( ! $captured && $this->get_gateway()->supports_credit_card_partial_capture() && $this->get_gateway()->is_partial_capture_enabled() ) {
|
331 |
+
$captured = (float) $this->get_gateway()->get_order_meta( $order, 'capture_total' ) >= (float) $this->get_order_capture_maximum( $order );
|
332 |
+
}
|
333 |
+
|
334 |
+
return $captured;
|
335 |
+
}
|
336 |
+
|
337 |
+
|
338 |
+
/**
|
339 |
+
* Determines if an order's authorization has expired.
|
340 |
+
*
|
341 |
+
* @since 5.3.0-dev
|
342 |
+
*
|
343 |
+
* @param \WC_Order $order
|
344 |
+
* @return bool
|
345 |
+
*/
|
346 |
+
public function has_order_authorization_expired( \WC_Order $order ) {
|
347 |
+
|
348 |
+
$transaction_date = $this->get_gateway()->get_order_meta( Framework\SV_WC_Order_Compatibility::get_prop( $order, 'id' ), 'trans_date' );
|
349 |
+
|
350 |
+
$transaction_time = strtotime( $transaction_date );
|
351 |
+
|
352 |
+
return $transaction_date && floor( ( time() - $transaction_time ) / 3600 ) > $this->get_gateway()->get_authorization_time_window();
|
353 |
+
}
|
354 |
+
|
355 |
+
|
356 |
+
/**
|
357 |
+
* Determines if an order's authorization has been captured, even partially.
|
358 |
+
*
|
359 |
+
* @since 5.3.0-dev
|
360 |
+
*
|
361 |
+
* @param \WC_Order $order order object
|
362 |
+
* @return bool
|
363 |
+
*/
|
364 |
+
public function is_order_captured( \WC_Order $order ) {
|
365 |
+
|
366 |
+
return in_array( $this->get_gateway()->get_order_meta( $order, 'charge_captured' ), array( 'yes', 'partial' ), true );
|
367 |
+
}
|
368 |
+
|
369 |
+
|
370 |
+
/** Getter Methods ************************************************************************************************/
|
371 |
+
|
372 |
+
|
373 |
+
/**
|
374 |
+
* Gets the maximum amount that can be captured from an order.
|
375 |
+
*
|
376 |
+
* Gateways can override this for an value above or below the order total.
|
377 |
+
* For instance, some processors allow capturing an amount a certain
|
378 |
+
* percentage higher than the payment total.
|
379 |
+
*
|
380 |
+
* @since 5.3.0-dev
|
381 |
+
*
|
382 |
+
* @param \WC_Order $order WooCommerce order object
|
383 |
+
* @return float
|
384 |
+
*/
|
385 |
+
public function get_order_capture_maximum( \WC_Order $order ) {
|
386 |
+
|
387 |
+
return $this->get_order_authorization_amount( $order );
|
388 |
+
}
|
389 |
+
|
390 |
+
|
391 |
+
/**
|
392 |
+
* Gets the amount originally authorized for an order.
|
393 |
+
*
|
394 |
+
* @since 5.3.0-dev
|
395 |
+
*
|
396 |
+
* @param \WC_Order $order order object
|
397 |
+
* @return float
|
398 |
+
*/
|
399 |
+
public function get_order_authorization_amount( \WC_Order $order ) {
|
400 |
+
|
401 |
+
// if a specific auth amount was stored, use it
|
402 |
+
// otherwise, use the order total
|
403 |
+
$amount = $this->get_gateway()->get_order_meta( $order, 'authorization_amount' ) ?: $order->get_total();
|
404 |
+
|
405 |
+
return (float) $amount;
|
406 |
+
}
|
407 |
+
|
408 |
+
|
409 |
+
/**
|
410 |
+
* Gets the payment gateway instance.
|
411 |
+
*
|
412 |
+
* @since 5.3.0-dev
|
413 |
+
*
|
414 |
+
* @return Framework\SV_WC_Payment_Gateway
|
415 |
+
*/
|
416 |
+
protected function get_gateway() {
|
417 |
+
|
418 |
+
return $this->gateway;
|
419 |
+
}
|
420 |
+
|
421 |
+
|
422 |
+
}
|
423 |
+
|
424 |
+
endif;
|
lib/skyverge/woocommerce/payment-gateway/admin/abstract-sv-wc-payment-gateway-plugin-admin-setup-wizard.php
ADDED
@@ -0,0 +1,67 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* WooCommerce Plugin Framework
|
4 |
+
*
|
5 |
+
* This source file is subject to the GNU General Public License v3.0
|
6 |
+
* that is bundled with this package in the file license.txt.
|
7 |
+
* It is also available through the world-wide-web at this URL:
|
8 |
+
* http://www.gnu.org/licenses/gpl-3.0.html
|
9 |
+
* If you did not receive a copy of the license and are unable to
|
10 |
+
* obtain it through the world-wide-web, please send an email
|
11 |
+
* to license@skyverge.com so we can send you a copy immediately.
|
12 |
+
*
|
13 |
+
* DISCLAIMER
|
14 |
+
*
|
15 |
+
* Do not edit or add to this file if you wish to upgrade the plugin to newer
|
16 |
+
* versions in the future. If you wish to customize the plugin for your
|
17 |
+
* needs please refer to http://www.skyverge.com
|
18 |
+
*
|
19 |
+
* @author SkyVerge
|
20 |
+
* @copyright Copyright (c) 2013-2018, SkyVerge, Inc.
|
21 |
+
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
|
22 |
+
*/
|
23 |
+
|
24 |
+
namespace WC_Braintree\Plugin_Framework\Payment_Gateway\Admin;
|
25 |
+
|
26 |
+
defined( 'ABSPATH' ) or exit;
|
27 |
+
|
28 |
+
use WC_Braintree\Plugin_Framework as Framework;
|
29 |
+
|
30 |
+
if ( ! class_exists( '\\WC_Braintree\\Plugin_Framework\\Payment_Gateway\\Admin\\Setup_Wizard' ) ) :
|
31 |
+
|
32 |
+
/**
|
33 |
+
* The payment gateway plugin Setup Wizard class.
|
34 |
+
*
|
35 |
+
* Extends the base plugin class to add common gateway functionality.
|
36 |
+
*
|
37 |
+
* @since 5.2.2
|
38 |
+
*/
|
39 |
+
abstract class Setup_Wizard extends Framework\Admin\Setup_Wizard {
|
40 |
+
|
41 |
+
|
42 |
+
/**
|
43 |
+
* Adds a 'Setup' link to the plugin action links if the wizard hasn't been completed.
|
44 |
+
*
|
45 |
+
* This will override the plugin's standard "Configure {gateway}" links with a link to
|
46 |
+
* this setup wizard.
|
47 |
+
*
|
48 |
+
* @internal
|
49 |
+
*
|
50 |
+
* @since 5.2.2
|
51 |
+
*
|
52 |
+
* @param array $action_links plugin action links
|
53 |
+
* @return array
|
54 |
+
*/
|
55 |
+
public function add_setup_link( $action_links ) {
|
56 |
+
|
57 |
+
foreach ( $this->get_plugin()->get_gateways() as $gateway ) {
|
58 |
+
unset( $action_links[ 'configure_' . $gateway->get_id() ] );
|
59 |
+
}
|
60 |
+
|
61 |
+
return parent::add_setup_link( $action_links );
|
62 |
+
}
|
63 |
+
|
64 |
+
|
65 |
+
}
|
66 |
+
|
67 |
+
endif;
|
lib/skyverge/woocommerce/payment-gateway/admin/class-sv-wc-payment-gateway-admin-order.php
ADDED
@@ -0,0 +1,523 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* WooCommerce Payment Gateway Framework
|
4 |
+
*
|
5 |
+
* This source file is subject to the GNU General Public License v3.0
|
6 |
+
* that is bundled with this package in the file license.txt.
|
7 |
+
* It is also available through the world-wide-web at this URL:
|
8 |
+
* http://www.gnu.org/licenses/gpl-3.0.html
|
9 |
+
* If you did not receive a copy of the license and are unable to
|
10 |
+
* obtain it through the world-wide-web, please send an email
|
11 |
+
* to license@skyverge.com so we can send you a copy immediately.
|
12 |
+
*
|
13 |
+
* DISCLAIMER
|
14 |
+
*
|
15 |
+
* Do not edit or add to this file if you wish to upgrade the plugin to newer
|
16 |
+
* versions in the future. If you wish to customize the plugin for your
|
17 |
+
* needs please refer to http://www.skyverge.com
|
18 |
+
*
|
19 |
+
* @package SkyVerge/WooCommerce/Payment-Gateway/Admin
|
20 |
+
* @author SkyVerge
|
21 |
+
* @copyright Copyright (c) 2013-2018, SkyVerge, Inc.
|
22 |
+
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
|
23 |
+
*/
|
24 |
+
|
25 |
+
namespace WC_Braintree\Plugin_Framework;
|
26 |
+
|
27 |
+
defined( 'ABSPATH' ) or exit;
|
28 |
+
|
29 |
+
if ( ! class_exists( '\\WC_Braintree\\Plugin_Framework\\SV_WC_Payment_Gateway_Admin_Order' ) ) :
|
30 |
+
|
31 |
+
/**
|
32 |
+
* Handle the admin order screens.
|
33 |
+
*
|
34 |
+
* @since 5.0.0
|
35 |
+
*/
|
36 |
+
class SV_WC_Payment_Gateway_Admin_Order {
|
37 |
+
|
38 |
+
|
39 |
+
/** @var SV_WC_Payment_Gateway_Plugin the plugin instance **/
|
40 |
+
protected $plugin;
|
41 |
+
|
42 |
+
|
43 |
+
/**
|
44 |
+
* Constructs the class.
|
45 |
+
*
|
46 |
+
* @since 5.0.0
|
47 |
+
*
|
48 |
+
* @param SV_WC_Payment_Gateway_Plugin The plugin instance
|
49 |
+
*/
|
50 |
+
public function __construct( SV_WC_Payment_Gateway_Plugin $plugin ) {
|
51 |
+
|
52 |
+
$this->plugin = $plugin;
|
53 |
+
|
54 |
+
add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
|
55 |
+
|
56 |
+
// capture feature
|
57 |
+
if ( $this->get_plugin()->supports_capture_charge() ) {
|
58 |
+
|
59 |
+
add_action( 'woocommerce_order_item_add_action_buttons', array( $this, 'add_capture_button' ) );
|
60 |
+
|
61 |
+
add_action( 'wp_ajax_wc_' . $this->get_plugin()->get_id() . '_capture_charge', array( $this, 'ajax_process_capture' ) );
|
62 |
+
|
63 |
+
// bulk capture order action
|
64 |
+
add_action( 'admin_footer-edit.php', array( $this, 'maybe_add_capture_charge_bulk_order_action' ) );
|
65 |
+
add_action( 'load-edit.php', array( $this, 'process_capture_charge_bulk_order_action' ) );
|
66 |
+
}
|
67 |
+
}
|
68 |
+
|
69 |
+
|
70 |
+
/**
|
71 |
+
* Enqueues the scripts and styles.
|
72 |
+
*
|
73 |
+
* @internal
|
74 |
+
*
|
75 |
+
* @since 5.0.0
|
76 |
+
*
|
77 |
+
* @param string $hook_suffix page hook suffix
|
78 |
+
*/
|
79 |
+
public function enqueue_scripts( $hook_suffix ) {
|
80 |
+
|
81 |
+
// Order screen assets
|
82 |
+
if ( 'shop_order' === get_post_type() ) {
|
83 |
+
|
84 |
+
// Edit Order screen assets
|
85 |
+
if ( 'post.php' === $hook_suffix ) {
|
86 |
+
|
87 |
+
$order = wc_get_order( SV_WC_Helper::get_request( 'post' ) );
|
88 |
+
|
89 |
+
if ( ! $order ) {
|
90 |
+
return;
|
91 |
+
}
|
92 |
+
|
93 |
+
// bail if the order payment method doesn't belong to this plugin
|
94 |
+
if ( ! $this->get_order_gateway( $order ) ) {
|
95 |
+
return;
|
96 |
+
}
|
97 |
+
|
98 |
+
$this->enqueue_edit_order_assets( $order );
|
99 |
+
}
|
100 |
+
}
|
101 |
+
}
|
102 |
+
|
103 |
+
|
104 |
+
/**
|
105 |
+
* Enqueues the assets for the Edit Order screen.
|
106 |
+
*
|
107 |
+
* @since 5.3.0-dev
|
108 |
+
*
|
109 |
+
* @param \WC_Order $order order object
|
110 |
+
*/
|
111 |
+
protected function enqueue_edit_order_assets( \WC_Order $order ) {
|
112 |
+
|
113 |
+
wp_enqueue_script( 'sv-wc-payment-gateway-admin-order', $this->get_plugin()->get_payment_gateway_framework_assets_url() . '/js/admin/sv-wc-payment-gateway-admin-order.min.js', array( 'jquery' ), SV_WC_Plugin::VERSION, true );
|
114 |
+
|
115 |
+
wp_localize_script( 'sv-wc-payment-gateway-admin-order', 'sv_wc_payment_gateway_admin_order', array(
|
116 |
+
'ajax_url' => admin_url( 'admin-ajax.php' ),
|
117 |
+
'gateway_id' => SV_WC_Order_Compatibility::get_prop( $order, 'payment_method' ),
|
118 |
+
'order_id' => SV_WC_Order_Compatibility::get_prop( $order, 'id' ),
|
119 |
+
'capture_ays' => __( 'Are you sure you wish to process this capture? The action cannot be undone.', 'woocommerce-gateway-paypal-powered-by-braintree' ),
|
120 |
+
'capture_action' => 'wc_' . $this->get_plugin()->get_id() . '_capture_charge',
|
121 |
+
'capture_nonce' => wp_create_nonce( 'wc_' . $this->get_plugin()->get_id() . '_capture_charge' ),
|
122 |
+
'capture_error' => __( 'Something went wrong, and the capture could no be completed. Please try again.', 'woocommerce-gateway-paypal-powered-by-braintree' ),
|
123 |
+
) );
|
124 |
+
|
125 |
+
wp_enqueue_style( 'sv-wc-payment-gateway-admin-order', $this->get_plugin()->get_payment_gateway_framework_assets_url() . '/css/admin/sv-wc-payment-gateway-admin-order.min.css', SV_WC_Plugin::VERSION );
|
126 |
+
}
|
127 |
+
|
128 |
+
|
129 |
+
/** Capture Charge Feature ******************************************************/
|
130 |
+
|
131 |
+
|
132 |
+
/**
|
133 |
+
* Adds 'Capture charge' to the Orders screen bulk action select.
|
134 |
+
*
|
135 |
+
* @since 5.0.0
|
136 |
+
*/
|
137 |
+
public function maybe_add_capture_charge_bulk_order_action() {
|
138 |
+
global $post_type, $post_status;
|
139 |
+
|
140 |
+
if ( ! current_user_can( 'edit_shop_orders' ) ) {
|
141 |
+
return;
|
142 |
+
}
|
143 |
+
|
144 |
+
if ( $post_type === 'shop_order' && $post_status !== 'trash' ) {
|
145 |
+
|
146 |
+
$can_capture_charge = false;
|
147 |
+
|
148 |
+
// ensure at least one gateway supports capturing charge
|
149 |
+
foreach ( $this->get_plugin()->get_gateways() as $gateway ) {
|
150 |
+
|
151 |
+
// ensure that it supports captures
|
152 |
+
if ( $gateway->supports_credit_card_capture() ) {
|
153 |
+
|
154 |
+
$can_capture_charge = true;
|
155 |
+
break;
|
156 |
+
}
|
157 |
+
}
|
158 |
+
|
159 |
+
if ( $can_capture_charge ) {
|
160 |
+
|
161 |
+
?>
|
162 |
+
<script type="text/javascript">
|
163 |
+
jQuery( document ).ready( function ( $ ) {
|
164 |
+
if ( 0 == $( 'select[name^=action] option[value=wc_capture_charge]' ).size() ) {
|
165 |
+
$( 'select[name^=action]' ).append(
|
166 |
+
$( '<option>' ).val( '<?php echo esc_js( 'wc_capture_charge' ); ?>' ).text( '<?php _e( 'Capture Charge', 'woocommerce-gateway-paypal-powered-by-braintree' ); ?>' )
|
167 |
+
);
|
168 |
+
}
|
169 |
+
});
|
170 |
+
</script>
|
171 |
+
<?php
|
172 |
+
}
|
173 |
+
}
|
174 |
+
}
|
175 |
+
|
176 |
+
|
177 |
+
/**
|
178 |
+
* Processes the 'Capture Charge' custom bulk action.
|
179 |
+
*
|
180 |
+
* @since 5.0.0
|
181 |
+
*/
|
182 |
+
public function process_capture_charge_bulk_order_action() {
|
183 |
+
global $typenow;
|
184 |
+
|
185 |
+
if ( 'shop_order' === $typenow ) {
|
186 |
+
|
187 |
+
// get the action
|
188 |
+
$wp_list_table = _get_list_table( 'WP_Posts_List_Table' );
|
189 |
+
$action = $wp_list_table->current_action();
|
190 |
+
|
191 |
+
// bail if not processing a capture
|
192 |
+
if ( 'wc_capture_charge' !== $action ) {
|
193 |
+
return;
|
194 |
+
}
|
195 |
+
|
196 |
+
if ( ! current_user_can( 'edit_shop_orders' ) ) {
|
197 |
+
return;
|
198 |
+
}
|
199 |
+
|
200 |
+
// security check
|
201 |
+
check_admin_referer( 'bulk-posts' );
|
202 |
+
|
203 |
+
// make sure order IDs are submitted
|
204 |
+
if ( isset( $_REQUEST['post'] ) ) {
|
205 |
+
$order_ids = array_map( 'absint', $_REQUEST['post'] );
|
206 |
+
}
|
207 |
+
|
208 |
+
// return if there are no orders to export
|
209 |
+
if ( empty( $order_ids ) ) {
|
210 |
+
return;
|
211 |
+
}
|
212 |
+
|
213 |
+
// give ourselves an unlimited timeout if possible
|
214 |
+
@set_time_limit( 0 );
|
215 |
+
|
216 |
+
foreach ( $order_ids as $order_id ) {
|
217 |
+
|
218 |
+
$order = wc_get_order( $order_id );
|
219 |
+
|
220 |
+
if ( $order && ( $gateway = $this->get_order_gateway( $order ) ) ) {
|
221 |
+
$gateway->get_capture_handler()->maybe_perform_capture( $order );
|
222 |
+
}
|
223 |
+
}
|
224 |
+
}
|
225 |
+
}
|
226 |
+
|
227 |
+
|
228 |
+
/**
|
229 |
+
* Adds a "Capture Charge" action to the admin Order Edit screen
|
230 |
+
*
|
231 |
+
* @since 5.0.0
|
232 |
+
*
|
233 |
+
* @param array $actions available order actions
|
234 |
+
* @return array
|
235 |
+
*/
|
236 |
+
public function add_order_action_charge_action( $actions ) {
|
237 |
+
|
238 |
+
/* translators: verb, as in "Capture credit card charge".
|
239 |
+
Used when an amount has been pre-authorized before, but funds have not yet been captured (taken) from the card.
|
240 |
+
Capturing the charge will take the money from the credit card and put it in the merchant's pockets. */
|
241 |
+
$actions[ 'wc_' . $this->get_plugin()->get_id() . '_capture_charge' ] = esc_html__( 'Capture Charge', 'woocommerce-gateway-paypal-powered-by-braintree' );
|
242 |
+
|
243 |
+
return $actions;
|
244 |
+
}
|
245 |
+
|
246 |
+
|
247 |
+
/**
|
248 |
+
* Adds the capture charge button to the order UI.
|
249 |
+
*
|
250 |
+
* @internal
|
251 |
+
*
|
252 |
+
* @since 5.0.0
|
253 |
+
*
|
254 |
+
* @param \WC_Order $order order object
|
255 |
+
*/
|
256 |
+
public function add_capture_button( $order ) {
|
257 |
+
|
258 |
+
// only display the button for core orders
|
259 |
+
if ( ! $order instanceof \WC_Order || 'shop_order' !== get_post_type( SV_WC_Order_Compatibility::get_prop( $order, 'id' ) ) ) {
|
260 |
+
return;
|
261 |
+
}
|
262 |
+
|
263 |
+
$gateway = $this->get_order_gateway( $order );
|
264 |
+
|
265 |
+
if ( ! $gateway ) {
|
266 |
+
return;
|
267 |
+
}
|
268 |
+
|
269 |
+
if ( ! $gateway->get_capture_handler()->is_order_ready_for_capture( $order ) ) {
|
270 |
+
return;
|
271 |
+
}
|
272 |
+
|
273 |
+
$tooltip = '';
|
274 |
+
$classes = array(
|
275 |
+
'button',
|
276 |
+
'sv-wc-payment-gateway-capture',
|
277 |
+
'wc-' . $gateway->get_id_dasherized() . '-capture',
|
278 |
+
);
|
279 |
+
|
280 |
+
// indicate if the partial-capture UI can be shown
|
281 |
+
if ( $gateway->supports_credit_card_partial_capture() && $gateway->is_partial_capture_enabled() ) {
|
282 |
+
$classes[] = 'partial-capture';
|
283 |
+
} elseif ( $gateway->get_capture_handler()->order_can_be_captured( $order ) ) {
|
284 |
+
$classes[] = 'button-primary';
|
285 |
+
}
|
286 |
+
|
287 |
+
// ensure that the authorization is still valid for capture
|
288 |
+
if ( ! $gateway->get_capture_handler()->order_can_be_captured( $order ) ) {
|
289 |
+
|
290 |
+
$classes[] = 'tips disabled';
|
291 |
+
|
292 |
+
// add some tooltip wording explaining why this cannot be captured
|
293 |
+
if ( $gateway->get_capture_handler()->is_order_fully_captured( $order ) ) {
|
294 |
+
$tooltip = __( 'This charge has been fully captured.', 'woocommerce-gateway-paypal-powered-by-braintree' );
|
295 |
+
} elseif ( $gateway->get_order_meta( $order, 'trans_date' ) && $gateway->get_capture_handler()->has_order_authorization_expired( $order ) ) {
|
296 |
+
$tooltip = __( 'This charge can no longer be captured.', 'woocommerce-gateway-paypal-powered-by-braintree' );
|
297 |
+
} else {
|
298 |
+
$tooltip = __( 'This charge cannot be captured.', 'woocommerce-gateway-paypal-powered-by-braintree' );
|
299 |
+
}
|
300 |
+
}
|
301 |
+
|
302 |
+
?>
|
303 |
+
|
304 |
+
<button type="button" class="<?php echo esc_attr( implode( ' ', $classes ) ); ?>" <?php echo ( $tooltip ) ? 'data-tip="' . esc_html( $tooltip ) . '"' : ''; ?>><?php _e( 'Capture Charge', 'woocommerce-gateway-paypal-powered-by-braintree' ); ?></button>
|
305 |
+
|
306 |
+
<?php
|
307 |
+
|
308 |
+
// add the partial capture UI HTML
|
309 |
+
if ( $gateway->supports_credit_card_partial_capture() && $gateway->is_partial_capture_enabled() ) {
|
310 |
+
$this->output_partial_capture_html( $order, $gateway );
|
311 |
+
}
|
312 |
+
}
|
313 |
+
|
314 |
+
|
315 |
+
/**
|
316 |
+
* Outputs the partial capture UI HTML.
|
317 |
+
*
|
318 |
+
* @since 5.0.0
|
319 |
+
*
|
320 |
+
* @param \WC_Order $order order object
|
321 |
+
* @param SV_WC_Payment_Gateway $gateway gateway instance
|
322 |
+
*/
|
323 |
+
protected function output_partial_capture_html( \WC_Order $order, SV_WC_Payment_Gateway $gateway ) {
|
324 |
+
|
325 |
+
$authorization_total = $gateway->get_capture_handler()->get_order_authorization_amount( $order );
|
326 |
+
$total_captured = $gateway->get_order_meta( $order, 'capture_total' );
|
327 |
+
$remaining_total = SV_WC_Helper::number_format( (float) $order->get_total() - (float) $total_captured );
|
328 |
+
|
329 |
+
include( $this->get_plugin()->get_payment_gateway_framework_path() . '/admin/views/html-order-partial-capture.php' );
|
330 |
+
}
|
331 |
+
|
332 |
+
|
333 |
+
/**
|
334 |
+
* Processes a capture via AJAX.
|
335 |
+
*
|
336 |
+
* @internal
|
337 |
+
*
|
338 |
+
* @since 5.0.0
|
339 |
+
*/
|
340 |
+
public function ajax_process_capture() {
|
341 |
+
|
342 |
+
check_ajax_referer( 'wc_' . $this->get_plugin()->get_id() . '_capture_charge', 'nonce' );
|
343 |
+
|
344 |
+
$gateway_id = SV_WC_Helper::get_request( 'gateway_id' );
|
345 |
+
|
346 |
+
if ( ! $this->get_plugin()->has_gateway( $gateway_id ) ) {
|
347 |
+
die();
|
348 |
+
}
|
349 |
+
|
350 |
+
$gateway = $this->get_plugin()->get_gateway( $gateway_id );
|
351 |
+
|
352 |
+
try {
|
353 |
+
|
354 |
+
$order_id = SV_WC_Helper::get_request( 'order_id' );
|
355 |
+
$order = wc_get_order( $order_id );
|
356 |
+
|
357 |
+
if ( ! $order ) {
|
358 |
+
throw new SV_WC_Payment_Gateway_Exception( 'Invalid order ID' );
|
359 |
+
}
|
360 |
+
|
361 |
+
if ( ! current_user_can( 'edit_shop_order', $order_id ) ) {
|
362 |
+
throw new SV_WC_Payment_Gateway_Exception( 'Invalid permissions' );
|
363 |
+
}
|
364 |
+
|
365 |
+
if ( SV_WC_Order_Compatibility::get_prop( $order, 'payment_method' ) !== $gateway->get_id() ) {
|
366 |
+
throw new SV_WC_Payment_Gateway_Exception( 'Invalid payment method' );
|
367 |
+
}
|
368 |
+
|
369 |
+
$amount_captured = (float) $gateway->get_order_meta( $order, 'capture_total' );
|
370 |
+
|
371 |
+
if ( SV_WC_Helper::get_request( 'amount' ) ) {
|
372 |
+
$amount = (float) SV_WC_Helper::get_request( 'amount' );
|
373 |
+
} else {
|
374 |
+
$amount = $order->get_total();
|
375 |
+
}
|
376 |
+
|
377 |
+
$result = $gateway->get_capture_handler()->perform_capture( $order, $amount );
|
378 |
+
|
379 |
+
if ( empty( $result['success'] ) ) {
|
380 |
+
throw new SV_WC_Payment_Gateway_Exception( $result['message'] );
|
381 |
+
}
|
382 |
+
|
383 |
+
wp_send_json_success( array(
|
384 |
+
'message' => html_entity_decode( wp_strip_all_tags( $result['message'] ) ), // ensure any HTML tags are removed and the currency symbol entity is decoded
|
385 |
+
) );
|
386 |
+
|
387 |
+
} catch ( SV_WC_Payment_Gateway_Exception $e ) {
|
388 |
+
|
389 |
+
wp_send_json_error( array(
|
390 |
+
'message' => $e->getMessage(),
|
391 |
+
) );
|
392 |
+
}
|
393 |
+
}
|
394 |
+
|
395 |
+
|
396 |
+
/**
|
397 |
+
* Gets the gateway object from an order.
|
398 |
+
*
|
399 |
+
* @since 5.0.0
|
400 |
+
*
|
401 |
+
* @param \WC_Order $order order object
|
402 |
+
* @return SV_WC_Payment_Gateway
|
403 |
+
*/
|
404 |
+
protected function get_order_gateway( \WC_Order $order ) {
|
405 |
+
|
406 |
+
$capture_gateway = null;
|
407 |
+
|
408 |
+
$payment_method = SV_WC_Order_Compatibility::get_prop( $order, 'payment_method' );
|
409 |
+
|
410 |
+
if ( $this->get_plugin()->has_gateway( $payment_method ) ) {
|
411 |
+
|
412 |
+
$gateway = $this->get_plugin()->get_gateway( $payment_method );
|
413 |
+
|
414 |
+
// ensure that it supports captures
|
415 |
+
if ( $gateway->supports_credit_card_capture() ) {
|
416 |
+
$capture_gateway = $gateway;
|
417 |
+
}
|
418 |
+
}
|
419 |
+
|
420 |
+
return $capture_gateway;
|
421 |
+
}
|
422 |
+
|
423 |
+
|
424 |
+
/**
|
425 |
+
* Gets the plugin instance.
|
426 |
+
*
|
427 |
+
* @since 5.0.0
|
428 |
+
*
|
429 |
+
* @return SV_WC_Payment_Gateway_Plugin the plugin instance
|
430 |
+
*/
|
431 |
+
protected function get_plugin() {
|
432 |
+
|
433 |
+
return $this->plugin;
|
434 |
+
}
|
435 |
+
|
436 |
+
|
437 |
+
/** Deprecated Methods ********************************************************************************************/
|
438 |
+
|
439 |
+
|
440 |
+
/**
|
441 |
+
* Capture a credit card charge for a prior authorization if this payment
|
442 |
+
* method was used for the given order, the charge hasn't already been
|
443 |
+
* captured, and the gateway supports issuing a capture request
|
444 |
+
*
|
445 |
+
* @since 5.0.0
|
446 |
+
* @deprecated 5.3.0-dev
|
447 |
+
*
|
448 |
+
* @param \WC_Order|int $order the order identifier or order object
|
449 |
+
* @param float|null $amount capture amount
|
450 |
+
*/
|
451 |
+
protected function maybe_capture_charge( $order, $amount = null ) {
|
452 |
+
|
453 |
+
SV_WC_Plugin_Compatibility::wc_deprecated_function( __METHOD__, '5.3.0-dev' );
|
454 |
+
|
455 |
+
if ( ! is_object( $order ) ) {
|
456 |
+
$order = wc_get_order( $order );
|
457 |
+
}
|
458 |
+
|
459 |
+
$gateway = $this->get_order_gateway( $order );
|
460 |
+
|
461 |
+
if ( ! $gateway ) {
|
462 |
+
return;
|
463 |
+
}
|
464 |
+
|
465 |
+
// don't try to capture cancelled/fully refunded transactions
|
466 |
+
if ( ! $gateway->get_capture_handler()->is_order_ready_for_capture( $order ) ) {
|
467 |
+
return;
|
468 |
+
}
|
469 |
+
|
470 |
+
// since a capture results in an update to the post object (by updating
|
471 |
+
// the paid date) we need to unhook the meta box save action, otherwise we
|
472 |
+
// can get boomeranged and change the status back to on-hold
|
473 |
+
remove_action( 'woocommerce_process_shop_order_meta', 'WC_Meta_Box_Order_Data::save', 40 );
|
474 |
+
|
475 |
+
// perform the capture
|
476 |
+
$gateway->get_capture_handler()->maybe_perform_capture( $order, $amount );
|
477 |
+
}
|
478 |
+
|
479 |
+
|
480 |
+
/**
|
481 |
+
* Captures an order on status change to a "paid" status.
|
482 |
+
*
|
483 |
+
* @internal
|
484 |
+
*
|
485 |
+
* @since 5.0.1-dev
|
486 |
+
* @deprecated 5.3.0-dev
|
487 |
+
*
|
488 |
+
* @param int $order_id order ID
|
489 |
+
* @param string $old_status status being changed
|
490 |
+
* @param string $new_status new order status
|
491 |
+
*/
|
492 |
+
public function maybe_capture_paid_order( $order_id, $old_status, $new_status ) {
|
493 |
+
|
494 |
+
SV_WC_Plugin_Compatibility::wc_deprecated_function( __METHOD__, '5.3.0-dev' );
|
495 |
+
}
|
496 |
+
|
497 |
+
|
498 |
+
/**
|
499 |
+
* Determines if an order is ready for capture.
|
500 |
+
*
|
501 |
+
* @since 5.0.0
|
502 |
+
* @deprecated 5.3.0-dev
|
503 |
+
*
|
504 |
+
* @param \WC_Order $order order object
|
505 |
+
* @return bool
|
506 |
+
*/
|
507 |
+
protected function is_order_ready_for_capture( \WC_Order $order ) {
|
508 |
+
|
509 |
+
SV_WC_Plugin_Compatibility::wc_deprecated_function( __METHOD__, '5.3.0-dev' );
|
510 |
+
|
511 |
+
$gateway = $this->get_order_gateway( $order );
|
512 |
+
|
513 |
+
if ( ! $gateway ) {
|
514 |
+
return false;
|
515 |
+
}
|
516 |
+
|
517 |
+
return $gateway->get_capture_handler()->is_order_ready_for_capture( $order );
|
518 |
+
}
|
519 |
+
|
520 |
+
|
521 |
+
}
|
522 |
+
|
523 |
+
endif;
|
lib/skyverge/woocommerce/payment-gateway/admin/class-sv-wc-payment-gateway-admin-payment-token-editor.php
CHANGED
@@ -18,14 +18,16 @@
|
|
18 |
*
|
19 |
* @package SkyVerge/WooCommerce/Payment-Gateway/Admin
|
20 |
* @author SkyVerge
|
21 |
-
* @copyright Copyright (c) 2013-
|
22 |
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
|
23 |
*/
|
24 |
|
25 |
-
namespace
|
26 |
|
27 |
defined( 'ABSPATH' ) or exit;
|
28 |
|
|
|
|
|
29 |
/**
|
30 |
* The token editor.
|
31 |
*
|
@@ -97,6 +99,9 @@ class SV_WC_Payment_Gateway_Admin_Payment_Token_Editor {
|
|
97 |
'error' => __( 'Invalid token data', 'woocommerce-gateway-paypal-powered-by-braintree' ),
|
98 |
),
|
99 |
),
|
|
|
|
|
|
|
100 |
) );
|
101 |
}
|
102 |
|
@@ -228,15 +233,32 @@ class SV_WC_Payment_Gateway_Admin_Payment_Token_Editor {
|
|
228 |
*/
|
229 |
public function ajax_remove_token() {
|
230 |
|
231 |
-
|
|
|
|
|
|
|
|
|
232 |
|
233 |
-
|
234 |
-
|
235 |
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
240 |
}
|
241 |
}
|
242 |
|
@@ -248,11 +270,17 @@ class SV_WC_Payment_Gateway_Admin_Payment_Token_Editor {
|
|
248 |
*/
|
249 |
public function ajax_refresh_tokens() {
|
250 |
|
251 |
-
|
|
|
|
|
|
|
|
|
252 |
|
253 |
-
|
254 |
|
255 |
-
|
|
|
|
|
256 |
|
257 |
ob_start();
|
258 |
|
@@ -262,9 +290,9 @@ class SV_WC_Payment_Gateway_Admin_Payment_Token_Editor {
|
|
262 |
|
263 |
wp_send_json_success( trim( $html ) );
|
264 |
|
265 |
-
}
|
266 |
|
267 |
-
wp_send_json_error();
|
268 |
}
|
269 |
}
|
270 |
|
@@ -373,8 +401,16 @@ class SV_WC_Payment_Gateway_Admin_Payment_Token_Editor {
|
|
373 |
// Clear any cached tokens
|
374 |
$this->get_gateway()->get_payment_tokens_handler()->clear_transient( $user_id );
|
375 |
|
376 |
-
|
377 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
378 |
|
379 |
foreach( $stored_tokens as $token ) {
|
380 |
|
@@ -669,3 +705,5 @@ class SV_WC_Payment_Gateway_Admin_Payment_Token_Editor {
|
|
669 |
return $this->gateway;
|
670 |
}
|
671 |
}
|
|
|
|
18 |
*
|
19 |
* @package SkyVerge/WooCommerce/Payment-Gateway/Admin
|
20 |
* @author SkyVerge
|
21 |
+
* @copyright Copyright (c) 2013-2018, SkyVerge, Inc.
|
22 |
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
|
23 |
*/
|
24 |
|
25 |
+
namespace WC_Braintree\Plugin_Framework;
|
26 |
|
27 |
defined( 'ABSPATH' ) or exit;
|
28 |
|
29 |
+
if ( ! class_exists( '\\WC_Braintree\\Plugin_Framework\\SV_WC_Payment_Gateway_Admin_Payment_Token_Editor' ) ) :
|
30 |
+
|
31 |
/**
|
32 |
* The token editor.
|
33 |
*
|
99 |
'error' => __( 'Invalid token data', 'woocommerce-gateway-paypal-powered-by-braintree' ),
|
100 |
),
|
101 |
),
|
102 |
+
'i18n' => array(
|
103 |
+
'general_error' => __( 'An error occurred. Please try again.', 'woocommerce-gateway-paypal-powered-by-braintree' ),
|
104 |
+
),
|
105 |
) );
|
106 |
}
|
107 |
|
233 |
*/
|
234 |
public function ajax_remove_token() {
|
235 |
|
236 |
+
try {
|
237 |
+
|
238 |
+
if ( ! check_ajax_referer( 'wc_payment_gateway_admin_remove_payment_token', 'security' ) ) {
|
239 |
+
throw new SV_WC_Payment_Gateway_Exception( 'Invalid nonce' );
|
240 |
+
}
|
241 |
|
242 |
+
$user_id = SV_WC_Helper::get_request( 'user_id' );
|
243 |
+
$token_id = SV_WC_Helper::get_request( 'token_id' );
|
244 |
|
245 |
+
if ( ! $user_id ) {
|
246 |
+
throw new SV_WC_Payment_Gateway_Exception( 'User ID is missing' );
|
247 |
+
}
|
248 |
+
|
249 |
+
if ( ! $token_id ) {
|
250 |
+
throw new SV_WC_Payment_Gateway_Exception( 'Token ID is missing' );
|
251 |
+
}
|
252 |
+
|
253 |
+
if ( $this->remove_token( $user_id, $token_id ) ) {
|
254 |
+
wp_send_json_success();
|
255 |
+
} else {
|
256 |
+
throw new SV_WC_Payment_Gateway_Exception( 'Could not remove token' );
|
257 |
+
}
|
258 |
+
|
259 |
+
} catch ( SV_WC_Plugin_Exception $e ) {
|
260 |
+
|
261 |
+
wp_send_json_error( $e->getMessage() );
|
262 |
}
|
263 |
}
|
264 |
|
270 |
*/
|
271 |
public function ajax_refresh_tokens() {
|
272 |
|
273 |
+
try {
|
274 |
+
|
275 |
+
if ( ! check_ajax_referer( 'wc_payment_gateway_admin_refresh_payment_tokens', 'security', false ) ) {
|
276 |
+
throw new SV_WC_Payment_Gateway_Exception( 'Invalid nonce' );
|
277 |
+
}
|
278 |
|
279 |
+
$user_id = SV_WC_Helper::get_request( 'user_id' );
|
280 |
|
281 |
+
if ( ! $user_id ) {
|
282 |
+
throw new SV_WC_Payment_Gateway_Exception( 'User ID is missing' );
|
283 |
+
}
|
284 |
|
285 |
ob_start();
|
286 |
|
290 |
|
291 |
wp_send_json_success( trim( $html ) );
|
292 |
|
293 |
+
} catch ( SV_WC_Payment_Gateway_Exception $e ) {
|
294 |
|
295 |
+
wp_send_json_error( $e->getMessage() );
|
296 |
}
|
297 |
}
|
298 |
|
401 |
// Clear any cached tokens
|
402 |
$this->get_gateway()->get_payment_tokens_handler()->clear_transient( $user_id );
|
403 |
|
404 |
+
// get the customer ID separately so it's never auto-created from the admin
|
405 |
+
$customer_id = $this->get_gateway()->get_customer_id( $user_id, array(
|
406 |
+
'autocreate' => false,
|
407 |
+
) );
|
408 |
+
|
409 |
+
$stored_tokens = $this->get_gateway()->get_payment_tokens_handler()->get_tokens( $user_id, array(
|
410 |
+
'customer_id' => $customer_id,
|
411 |
+
) );
|
412 |
+
|
413 |
+
$tokens = array();
|
414 |
|
415 |
foreach( $stored_tokens as $token ) {
|
416 |
|
705 |
return $this->gateway;
|
706 |
}
|
707 |
}
|
708 |
+
|
709 |
+
endif;
|
lib/skyverge/woocommerce/payment-gateway/admin/class-sv-wc-payment-gateway-admin-user-handler.php
CHANGED
@@ -18,14 +18,16 @@
|
|
18 |
*
|
19 |
* @package SkyVerge/WooCommerce/Payment-Gateway/Admin
|
20 |
* @author SkyVerge
|
21 |
-
* @copyright Copyright (c) 2013-
|
22 |
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
|
23 |
*/
|
24 |
|
25 |
-
namespace
|
26 |
|
27 |
defined( 'ABSPATH' ) or exit;
|
28 |
|
|
|
|
|
29 |
/**
|
30 |
* Handle the admin user profile settings.
|
31 |
*
|
@@ -33,7 +35,7 @@ defined( 'ABSPATH' ) or exit;
|
|
33 |
*/
|
34 |
class SV_WC_Payment_Gateway_Admin_User_Handler {
|
35 |
|
36 |
-
/** @var \
|
37 |
protected $plugin;
|
38 |
|
39 |
/** @var array the token editor for each gateway **/
|
@@ -43,7 +45,7 @@ class SV_WC_Payment_Gateway_Admin_User_Handler {
|
|
43 |
* Construct the user handler.
|
44 |
*
|
45 |
* @since 4.3.0
|
46 |
-
* @param \
|
47 |
*/
|
48 |
public function __construct( SV_WC_Payment_Gateway_Plugin $plugin ) {
|
49 |
|
@@ -81,7 +83,7 @@ class SV_WC_Payment_Gateway_Admin_User_Handler {
|
|
81 |
continue;
|
82 |
}
|
83 |
|
84 |
-
$this->token_editors[] = $gateway->get_payment_tokens_handler()->get_token_editor();
|
85 |
}
|
86 |
}
|
87 |
|
@@ -116,6 +118,14 @@ class SV_WC_Payment_Gateway_Admin_User_Handler {
|
|
116 |
public function display_token_editors( $user ) {
|
117 |
|
118 |
foreach ( $this->get_token_editors() as $gateway_id => $editor ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
119 |
$editor->display( $user->ID );
|
120 |
}
|
121 |
}
|
@@ -215,7 +225,7 @@ class SV_WC_Payment_Gateway_Admin_User_Handler {
|
|
215 |
*
|
216 |
* @since 4.3.0
|
217 |
* @param string $title The section title
|
218 |
-
* @param \
|
219 |
*/
|
220 |
return apply_filters( 'wc_payment_gateway_admin_user_profile_title', $title, $this->get_plugin() );
|
221 |
}
|
@@ -234,7 +244,7 @@ class SV_WC_Payment_Gateway_Admin_User_Handler {
|
|
234 |
*
|
235 |
* @since 4.3.0
|
236 |
* @param string $description The section description
|
237 |
-
* @param \
|
238 |
*/
|
239 |
return apply_filters( 'wc_payment_gateway_admin_user_profile_description', '', $this->get_plugin() );
|
240 |
}
|
@@ -365,7 +375,7 @@ class SV_WC_Payment_Gateway_Admin_User_Handler {
|
|
365 |
*
|
366 |
* @since 4.3.0
|
367 |
* @param bool $display
|
368 |
-
* @param \
|
369 |
*/
|
370 |
return apply_filters( 'wc_payment_gateway_' . $this->get_plugin()->get_id() . '_display_user_profile', ! empty( $gateways ), $this->get_plugin() );
|
371 |
}
|
@@ -386,9 +396,11 @@ class SV_WC_Payment_Gateway_Admin_User_Handler {
|
|
386 |
* Get the plugin instance.
|
387 |
*
|
388 |
* @since 4.3.0
|
389 |
-
* @return \
|
390 |
*/
|
391 |
protected function get_plugin() {
|
392 |
return $this->plugin;
|
393 |
}
|
394 |
}
|
|
|
|
18 |
*
|
19 |
* @package SkyVerge/WooCommerce/Payment-Gateway/Admin
|
20 |
* @author SkyVerge
|
21 |
+
* @copyright Copyright (c) 2013-2018, SkyVerge, Inc.
|
22 |
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
|
23 |
*/
|
24 |
|
25 |
+
namespace WC_Braintree\Plugin_Framework;
|
26 |
|
27 |
defined( 'ABSPATH' ) or exit;
|
28 |
|
29 |
+
if ( ! class_exists( '\\WC_Braintree\\Plugin_Framework\\SV_WC_Payment_Gateway_Admin_User_Handler' ) ) :
|
30 |
+
|
31 |
/**
|
32 |
* Handle the admin user profile settings.
|
33 |
*
|
35 |
*/
|
36 |
class SV_WC_Payment_Gateway_Admin_User_Handler {
|
37 |
|
38 |
+
/** @var \SV_WC_Payment_Gateway_Plugin the plugin instance **/
|
39 |
protected $plugin;
|
40 |
|
41 |
/** @var array the token editor for each gateway **/
|
45 |
* Construct the user handler.
|
46 |
*
|
47 |
* @since 4.3.0
|
48 |
+
* @param \SV_WC_Payment_Gateway_Plugin The plugin instance
|
49 |
*/
|
50 |
public function __construct( SV_WC_Payment_Gateway_Plugin $plugin ) {
|
51 |
|
83 |
continue;
|
84 |
}
|
85 |
|
86 |
+
$this->token_editors[ $gateway->get_id() ] = $gateway->get_payment_tokens_handler()->get_token_editor();
|
87 |
}
|
88 |
}
|
89 |
|
118 |
public function display_token_editors( $user ) {
|
119 |
|
120 |
foreach ( $this->get_token_editors() as $gateway_id => $editor ) {
|
121 |
+
|
122 |
+
$gateway = $this->get_plugin()->get_gateway( $gateway_id );
|
123 |
+
|
124 |
+
// if the gateway supports a customer ID but none is saved, don't display the token tables
|
125 |
+
if ( $gateway && $gateway->supports_customer_id() && ! $gateway->get_customer_id( $user->ID, array( 'autocreate' => false ) ) ) {
|
126 |
+
continue;
|
127 |
+
}
|
128 |
+
|
129 |
$editor->display( $user->ID );
|
130 |
}
|
131 |
}
|
225 |
*
|
226 |
* @since 4.3.0
|
227 |
* @param string $title The section title
|
228 |
+
* @param \SV_WC_Payment_Gateway_Plugin $plugin The gateway plugin instance
|
229 |
*/
|
230 |
return apply_filters( 'wc_payment_gateway_admin_user_profile_title', $title, $this->get_plugin() );
|
231 |
}
|
244 |
*
|
245 |
* @since 4.3.0
|
246 |
* @param string $description The section description
|
247 |
+
* @param \SV_WC_Payment_Gateway_Plugin $plugin The gateway plugin instance
|
248 |
*/
|
249 |
return apply_filters( 'wc_payment_gateway_admin_user_profile_description', '', $this->get_plugin() );
|
250 |
}
|
375 |
*
|
376 |
* @since 4.3.0
|
377 |
* @param bool $display
|
378 |
+
* @param \SV_WC_Payment_Gateway_Plugin $plugin the gateway plugin instance
|
379 |
*/
|
380 |
return apply_filters( 'wc_payment_gateway_' . $this->get_plugin()->get_id() . '_display_user_profile', ! empty( $gateways ), $this->get_plugin() );
|
381 |
}
|
396 |
* Get the plugin instance.
|
397 |
*
|
398 |
* @since 4.3.0
|
399 |
+
* @return \SV_WC_Payment_Gateway_Plugin the plugin instance
|
400 |
*/
|
401 |
protected function get_plugin() {
|
402 |
return $this->plugin;
|
403 |
}
|
404 |
}
|
405 |
+
|
406 |
+
endif;
|
lib/skyverge/woocommerce/payment-gateway/admin/views/html-admin-gateway-status.php
CHANGED
@@ -18,7 +18,7 @@
|
|
18 |
*
|
19 |
* @package SkyVerge/WooCommerce/Plugin/Gateway/Admin/Views
|
20 |
* @author SkyVerge
|
21 |
-
* @copyright Copyright (c) 2013-
|
22 |
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
|
23 |
*/
|
24 |
?>
|
18 |
*
|
19 |
* @package SkyVerge/WooCommerce/Plugin/Gateway/Admin/Views
|
20 |
* @author SkyVerge
|
21 |
+
* @copyright Copyright (c) 2013-2018, SkyVerge, Inc.
|
22 |
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
|
23 |
*/
|
24 |
?>
|
lib/skyverge/woocommerce/payment-gateway/admin/views/html-order-partial-capture.php
ADDED
@@ -0,0 +1,70 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* WooCommerce Plugin Framework
|
4 |
+
*
|
5 |
+
* This source file is subject to the GNU General Public License v3.0
|
6 |
+
* that is bundled with this package in the file license.txt.
|
7 |
+
* It is also available through the world-wide-web at this URL:
|
8 |
+
* http://www.gnu.org/licenses/gpl-3.0.html
|
9 |
+
* If you did not receive a copy of the license and are unable to
|
10 |
+
* obtain it through the world-wide-web, please send an email
|
11 |
+
* to license@skyverge.com so we can send you a copy immediately.
|
12 |
+
*
|
13 |
+
* DISCLAIMER
|
14 |
+
*
|
15 |
+
* Do not edit or add to this file if you wish to upgrade the plugin to newer
|
16 |
+
* versions in the future. If you wish to customize the plugin for your
|
17 |
+
* needs please refer to http://www.skyverge.com
|
18 |
+
*
|
19 |
+
* @package SkyVerge/WooCommerce/Plugin/Gateway/Admin/Views
|
20 |
+
* @author SkyVerge
|
21 |
+
* @copyright Copyright (c) 2013-2018, SkyVerge, Inc.
|
22 |
+
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
|
23 |
+
*/
|
24 |
+
?>
|
25 |
+
|
26 |
+
<div class="wc-order-data-row wc-order-data-row-toggle sv-wc-payment-gateway-partial-capture wc-<?php echo esc_attr( $gateway->get_id_dasherized() ); ?>-partial-capture" style="display:none;">
|
27 |
+
<table class="wc-order-totals">
|
28 |
+
|
29 |
+
<tr>
|
30 |
+
<td class="label"><?php esc_html_e( 'Authorization total', 'woocommerce-gateway-paypal-powered-by-braintree' ); ?>:</td>
|
31 |
+
<td class="total"><?php echo wc_price( $authorization_total, array( 'currency' => $order->get_currency() ) ); ?></td>
|
32 |
+
</tr>
|
33 |
+
<tr>
|
34 |
+
<td class="label"><?php esc_html_e( 'Amount already captured', 'woocommerce-gateway-paypal-powered-by-braintree' ); ?>:</td>
|
35 |
+
<td class="total"><?php echo wc_price( $total_captured, array( 'currency' => $order->get_currency() ) ); ?></td>
|
36 |
+
</tr>
|
37 |
+
|
38 |
+
<?php if ( $remaining_total > 0 ) : ?>
|
39 |
+
<tr>
|
40 |
+
<td class="label"><?php esc_html_e( 'Remaining order total', 'woocommerce-gateway-paypal-powered-by-braintree' ); ?>:</td>
|
41 |
+
<td class="total"><?php echo wc_price( $remaining_total, array( 'currency' => $order->get_currency() ) ); ?></td>
|
42 |
+
</tr>
|
43 |
+
<?php endif; ?>
|
44 |
+
|
45 |
+
<tr>
|
46 |
+
<td class="label"><label for="capture_amount"><?php esc_html_e( 'Capture amount', 'woocommerce-gateway-paypal-powered-by-braintree' ); ?>:</label></td>
|
47 |
+
<td class="total">
|
48 |
+
<input type="text" class="text" id="capture_amount" name="capture_amount" class="wc_input_price" />
|
49 |
+
<div class="clear"></div>
|
50 |
+
</td>
|
51 |
+
</tr>
|
52 |
+
<tr>
|
53 |
+
<td class="label"><label for="capture_comment"><?php esc_html_e( 'Comment (optional):', 'woocommerce-gateway-paypal-powered-by-braintree' ); ?></label></td>
|
54 |
+
<td class="total">
|
55 |
+
<input type="text" class="text" id="capture_comment" name="capture_comment" />
|
56 |
+
<div class="clear"></div>
|
57 |
+
</td>
|
58 |
+
</tr>
|
59 |
+
</table>
|
60 |
+
<div class="clear"></div>
|
61 |
+
<div class="capture-actions">
|
62 |
+
|
63 |
+
<?php $amount = '<span class="capture-amount">' . wc_price( 0, array( 'currency' => $order->get_currency() ) ) . '</span>'; ?>
|
64 |
+
|
65 |
+
<button type="button" class="button button-primary capture-action" disabled="disabled"><?php printf( esc_html__( 'Capture %s', 'woocommerce-gateway-paypal-powered-by-braintree' ), $amount ); ?></button>
|
66 |
+
<button type="button" class="button cancel-action"><?php _e( 'Cancel', 'woocommerce-gateway-paypal-powered-by-braintree' ); ?></button>
|
67 |
+
|
68 |
+
<div class="clear"></div>
|
69 |
+
</div>
|
70 |
+
</div>
|
lib/skyverge/woocommerce/payment-gateway/admin/views/html-user-payment-token-editor-token.php
CHANGED
@@ -18,7 +18,7 @@
|
|
18 |
*
|
19 |
* @package SkyVerge/WooCommerce/Plugin/Gateway/Admin/Views
|
20 |
* @author SkyVerge
|
21 |
-
* @copyright Copyright (c) 2013-
|
22 |
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
|
23 |
*/
|
24 |
?>
|
@@ -29,14 +29,19 @@
|
|
29 |
|
30 |
<?php foreach ( $fields as $field_id => $field ) : ?>
|
31 |
|
|
|
|
|
32 |
<td class="token-<?php echo esc_attr( $field_id ); ?>">
|
33 |
|
34 |
<?php if ( ! $field['editable'] ) : ?>
|
35 |
|
36 |
-
|
|
|
|
|
|
|
37 |
<input name="<?php echo esc_attr( $token_input_name ); ?>[<?php echo esc_attr( $field_id ); ?>]" value="<?php echo esc_attr( $token[ $field_id ] ); ?>" type="hidden" />
|
38 |
|
39 |
-
<?php elseif (
|
40 |
|
41 |
<select name="<?php echo esc_attr( $token_input_name ); ?>[<?php echo esc_attr( $field_id ); ?>]">
|
42 |
|
18 |
*
|
19 |
* @package SkyVerge/WooCommerce/Plugin/Gateway/Admin/Views
|
20 |
* @author SkyVerge
|
21 |
+
* @copyright Copyright (c) 2013-2018, SkyVerge, Inc.
|
22 |
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
|
23 |
*/
|
24 |
?>
|
29 |
|
30 |
<?php foreach ( $fields as $field_id => $field ) : ?>
|
31 |
|
32 |
+
<?php $is_select = 'select' === $field['type'] && isset( $field['options'] ) && ! empty( $field['options'] ); ?>
|
33 |
+
|
34 |
<td class="token-<?php echo esc_attr( $field_id ); ?>">
|
35 |
|
36 |
<?php if ( ! $field['editable'] ) : ?>
|
37 |
|
38 |
+
<?php $display_value = $is_select && ! empty( $field['options'][ $token[ $field_id ] ] ) ? $field['options'][ $token[ $field_id ] ] : $token[ $field_id ]; ?>
|
39 |
+
|
40 |
+
<span class="token-<?php echo esc_attr( $field_id ); ?> token-attribute"><?php echo esc_attr( $display_value ); ?></span>
|
41 |
+
|
42 |
<input name="<?php echo esc_attr( $token_input_name ); ?>[<?php echo esc_attr( $field_id ); ?>]" value="<?php echo esc_attr( $token[ $field_id ] ); ?>" type="hidden" />
|
43 |
|
44 |
+
<?php elseif ( $is_select ) : ?>
|
45 |
|
46 |
<select name="<?php echo esc_attr( $token_input_name ); ?>[<?php echo esc_attr( $field_id ); ?>]">
|
47 |
|
lib/skyverge/woocommerce/payment-gateway/admin/views/html-user-payment-token-editor.php
CHANGED
@@ -18,7 +18,7 @@
|
|
18 |
*
|
19 |
* @package SkyVerge/WooCommerce/Plugin/Gateway/Admin/Views
|
20 |
* @author SkyVerge
|
21 |
-
* @copyright Copyright (c) 2013-
|
22 |
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
|
23 |
*/
|
24 |
?>
|
18 |
*
|
19 |
* @package SkyVerge/WooCommerce/Plugin/Gateway/Admin/Views
|
20 |
* @author SkyVerge
|
21 |
+
* @copyright Copyright (c) 2013-2018, SkyVerge, Inc.
|
22 |
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
|
23 |
*/
|
24 |
?>
|
lib/skyverge/woocommerce/payment-gateway/admin/views/html-user-profile-field-customer-id.php
CHANGED
@@ -18,7 +18,7 @@
|
|
18 |
*
|
19 |
* @package SkyVerge/WooCommerce/Plugin/Gateway/Admin/Views
|
20 |
* @author SkyVerge
|
21 |
-
* @copyright Copyright (c) 2013-
|
22 |
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
|
23 |
*/
|
24 |
?>
|
18 |
*
|
19 |
* @package SkyVerge/WooCommerce/Plugin/Gateway/Admin/Views
|
20 |
* @author SkyVerge
|
21 |
+
* @copyright Copyright (c) 2013-2018, SkyVerge, Inc.
|
22 |
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
|
23 |
*/
|
24 |
?>
|
lib/skyverge/woocommerce/payment-gateway/admin/views/html-user-profile-section.php
CHANGED
@@ -18,7 +18,7 @@
|
|
18 |
*
|
19 |
* @package SkyVerge/WooCommerce/Plugin/Gateway/Admin/Views
|
20 |
* @author SkyVerge
|
21 |
-
* @copyright Copyright (c) 2013-
|
22 |
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
|
23 |
*/
|
24 |
?>
|
18 |
*
|
19 |
* @package SkyVerge/WooCommerce/Plugin/Gateway/Admin/Views
|
20 |
* @author SkyVerge
|
21 |
+
* @copyright Copyright (c) 2013-2018, SkyVerge, Inc.
|
22 |
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
|
23 |
*/
|
24 |
?>
|
lib/skyverge/woocommerce/payment-gateway/api/class-sv-wc-payment-gateway-api-response-message-helper.php
CHANGED
@@ -18,15 +18,15 @@
|
|
18 |
*
|
19 |
* @package SkyVerge/WooCommerce/Payment-Gateway/API
|
20 |
* @author SkyVerge
|
21 |
-
* @copyright Copyright (c) 2013-
|
22 |
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
|
23 |
*/
|
24 |
|
25 |
-
namespace
|
26 |
|
27 |
defined( 'ABSPATH' ) or exit;
|
28 |
|
29 |
-
if ( ! class_exists( '
|
30 |
|
31 |
/**
|
32 |
* WooCommerce Payment Gateway API Response Message Helper
|
18 |
*
|
19 |
* @package SkyVerge/WooCommerce/Payment-Gateway/API
|
20 |
* @author SkyVerge
|
21 |
+
* @copyright Copyright (c) 2013-2018, SkyVerge, Inc.
|
22 |
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
|
23 |
*/
|
24 |
|
25 |
+
namespace WC_Braintree\Plugin_Framework;
|
26 |
|
27 |
defined( 'ABSPATH' ) or exit;
|
28 |
|
29 |
+
if ( ! class_exists( '\\WC_Braintree\\Plugin_Framework\\SV_WC_Payment_Gateway_API_Response_Message_Helper' ) ) :
|
30 |
|
31 |
/**
|
32 |
* WooCommerce Payment Gateway API Response Message Helper
|
lib/skyverge/woocommerce/payment-gateway/api/interface-sv-wc-payment-gateway-api-authorization-response.php
CHANGED
@@ -18,15 +18,15 @@
|
|
18 |
*
|
19 |
* @package SkyVerge/WooCommerce/Payment-Gateway/API
|
20 |
* @author SkyVerge
|
21 |
-
* @copyright Copyright (c) 2013-
|
22 |
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
|
23 |
*/
|
24 |
|
25 |
-
namespace
|
26 |
|
27 |
defined( 'ABSPATH' ) or exit;
|
28 |
|
29 |
-
if ( ! interface_exists( '
|
30 |
|
31 |
/**
|
32 |
* WooCommerce Direct Payment Gateway API Authorization Response
|
18 |
*
|
19 |
* @package SkyVerge/WooCommerce/Payment-Gateway/API
|
20 |
* @author SkyVerge
|
21 |
+
* @copyright Copyright (c) 2013-2018, SkyVerge, Inc.
|
22 |
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
|
23 |
*/
|
24 |
|
25 |
+
namespace WC_Braintree\Plugin_Framework;
|
26 |
|
27 |
defined( 'ABSPATH' ) or exit;
|
28 |
|
29 |
+
if ( ! interface_exists( '\\WC_Braintree\\Plugin_Framework\\SV_WC_Payment_Gateway_API_Authorization_Response' ) ) :
|
30 |
|
31 |
/**
|
32 |
* WooCommerce Direct Payment Gateway API Authorization Response
|
lib/skyverge/woocommerce/payment-gateway/api/interface-sv-wc-payment-gateway-api-create-payment-token-response.php
CHANGED
@@ -18,15 +18,15 @@
|
|
18 |
*
|
19 |
* @package SkyVerge/WooCommerce/Payment-Gateway/API
|
20 |
* @author SkyVerge
|
21 |
-
* @copyright Copyright (c) 2013-
|
22 |
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
|
23 |
*/
|
24 |
|
25 |
-
namespace
|
26 |
|
27 |
defined( 'ABSPATH' ) or exit;
|
28 |
|
29 |
-
if ( ! interface_exists( '
|
30 |
|
31 |
/**
|
32 |
* WooCommerce Direct Payment Gateway API Create Payment Token Response
|
18 |
*
|
19 |
* @package SkyVerge/WooCommerce/Payment-Gateway/API
|
20 |
* @author SkyVerge
|
21 |
+
* @copyright Copyright (c) 2013-2018, SkyVerge, Inc.
|
22 |
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
|
23 |
*/
|
24 |
|
25 |
+
namespace WC_Braintree\Plugin_Framework;
|
26 |
|
27 |
defined( 'ABSPATH' ) or exit;
|
28 |
|
29 |
+
if ( ! interface_exists( '\\WC_Braintree\\Plugin_Framework\\SV_WC_Payment_Gateway_API_Create_Payment_Token_Response' ) ) :
|
30 |
|
31 |
/**
|
32 |
* WooCommerce Direct Payment Gateway API Create Payment Token Response
|
lib/skyverge/woocommerce/payment-gateway/api/interface-sv-wc-payment-gateway-api-customer-response.php
CHANGED
@@ -18,15 +18,15 @@
|
|
18 |
*
|
19 |
* @package SkyVerge/WooCommerce/Payment-Gateway/API
|
20 |
* @author SkyVerge
|
21 |
-
* @copyright Copyright (c) 2013-
|
22 |
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
|
23 |
*/
|
24 |
|
25 |
-
namespace
|
26 |
|
27 |
defined( 'ABSPATH' ) or exit;
|
28 |
|
29 |
-
if ( ! interface_exists( '
|
30 |
|
31 |
/**
|
32 |
* WooCommerce Direct Payment Gateway API Customer Response
|
18 |
*
|
19 |
* @package SkyVerge/WooCommerce/Payment-Gateway/API
|
20 |
* @author SkyVerge
|
21 |
+
* @copyright Copyright (c) 2013-2018, SkyVerge, Inc.
|
22 |
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
|
23 |
*/
|
24 |
|
25 |
+
namespace WC_Braintree\Plugin_Framework;
|
26 |
|
27 |
defined( 'ABSPATH' ) or exit;
|
28 |
|
29 |
+
if ( ! interface_exists( '\\WC_Braintree\\Plugin_Framework\\SV_WC_Payment_Gateway_API_Customer_Response' ) ) :
|
30 |
|
31 |
/**
|
32 |
* WooCommerce Direct Payment Gateway API Customer Response
|
lib/skyverge/woocommerce/payment-gateway/api/interface-sv-wc-payment-gateway-api-get-tokenized-payment-methods-response.php
CHANGED
@@ -18,15 +18,15 @@
|
|
18 |
*
|
19 |
* @package SkyVerge/WooCommerce/Payment-Gateway/API
|
20 |
* @author SkyVerge
|
21 |
-
* @copyright Copyright (c) 2013-
|
22 |
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
|
23 |
*/
|
24 |
|
25 |
-
namespace
|
26 |
|
27 |
defined( 'ABSPATH' ) or exit;
|
28 |
|
29 |
-
if ( ! interface_exists( '
|
30 |
|
31 |
/**
|
32 |
* WooCommerce Direct Payment Gateway API Create Payment Token Response
|
18 |
*
|
19 |
* @package SkyVerge/WooCommerce/Payment-Gateway/API
|
20 |
* @author SkyVerge
|
21 |
+
* @copyright Copyright (c) 2013-2018, SkyVerge, Inc.
|
22 |
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
|
23 |
*/
|
24 |
|
25 |
+
namespace WC_Braintree\Plugin_Framework;
|
26 |
|
27 |
defined( 'ABSPATH' ) or exit;
|
28 |
|
29 |
+
if ( ! interface_exists( '\\WC_Braintree\\Plugin_Framework\\SV_WC_API_Get_Tokenized_Payment_Methods_Response' ) ) :
|
30 |
|
31 |
/**
|
32 |
* WooCommerce Direct Payment Gateway API Create Payment Token Response
|
lib/skyverge/woocommerce/payment-gateway/api/interface-sv-wc-payment-gateway-api-payment-notification-credit-card-response.php
ADDED
@@ -0,0 +1,71 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* WooCommerce Payment Gateway Framework
|
4 |
+
*
|
5 |
+
* This source file is subject to the GNU General Public License v3.0
|
6 |
+
* that is bundled with this package in the file license.txt.
|
7 |
+
* It is also available through the world-wide-web at this URL:
|
8 |
+
* http://www.gnu.org/licenses/gpl-3.0.html
|
9 |
+
* If you did not receive a copy of the license and are unable to
|
10 |
+
* obtain it through the world-wide-web, please send an email
|
11 |
+
* to license@skyverge.com so we can send you a copy immediately.
|
12 |
+
*
|
13 |
+
* DISCLAIMER
|
14 |
+
*
|
15 |
+
* Do not edit or add to this file if you wish to upgrade the plugin to newer
|
16 |
+
* versions in the future. If you wish to customize the plugin for your
|
17 |
+
* needs please refer to http://www.skyverge.com
|
18 |
+
*
|
19 |
+
* @package SkyVerge/WooCommerce/Payment-Gateway/API
|
20 |
+
* @author SkyVerge
|
21 |
+
* @copyright Copyright (c) 2013-2018, SkyVerge, Inc.
|
22 |
+
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
|
23 |
+
*/
|
24 |
+
|
25 |
+
namespace WC_Braintree\Plugin_Framework;
|
26 |
+
|
27 |
+
defined( 'ABSPATH' ) or exit;
|
28 |
+
|
29 |
+
if ( ! interface_exists( '\\WC_Braintree\\Plugin_Framework\\SV_WC_Payment_Gateway_API_Payment_Notification_Credit_Card_Response' ) ) :
|
30 |
+
|
31 |
+
/**
|
32 |
+
* WooCommerce Payment Gateway API Payment Credit Card Notification Response
|
33 |
+
*
|
34 |
+
* Represents an IPN or redirect-back credit card request response
|
35 |
+
*
|
36 |
+
* @since 2.2.0
|
37 |
+
*/
|
38 |
+
interface SV_WC_Payment_Gateway_API_Payment_Notification_Credit_Card_Response extends SV_WC_Payment_Gateway_API_Payment_Notification_Response, SV_WC_Payment_Gateway_API_Authorization_Response {
|
39 |
+
|
40 |
+
|
41 |
+
/**
|
42 |
+
* Returns the card type, if available, i.e., 'visa', 'mastercard', etc
|
43 |
+
*
|
44 |
+
* @since 2.2.0
|
45 |
+
* @see SV_WC_Payment_Gateway_Helper::payment_type_to_name()
|
46 |
+
* @return string card type or null if not available
|
47 |
+
*/
|
48 |
+
public function get_card_type();
|
49 |
+
|
50 |
+
|
51 |
+
/**
|
52 |
+
* Returns the card expiration month with leading zero, if available
|
53 |
+
*
|
54 |
+
* @since 2.2.0
|
55 |
+
* @return string card expiration month or null if not available
|
56 |
+
*/
|
57 |
+
public function get_exp_month();
|
58 |
+
|
59 |
+
|
60 |
+
/**
|
61 |
+
* Returns the card expiration year with four digits, if available
|
62 |
+
*
|
63 |
+
* @since 2.2.0
|
64 |
+
* @return string card expiration year or null if not available
|
65 |
+
*/
|
66 |
+
public function get_exp_year();
|
67 |
+
|
68 |
+
|
69 |
+
}
|
70 |
+
|
71 |
+
endif; // interface exists check
|
lib/skyverge/woocommerce/payment-gateway/api/interface-sv-wc-payment-gateway-api-payment-notification-echeck-response.php
ADDED
@@ -0,0 +1,62 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* WooCommerce Payment Gateway Framework
|
4 |
+
*
|
5 |
+
* This source file is subject to the GNU General Public License v3.0
|
6 |
+
* that is bundled with this package in the file license.txt.
|
7 |
+
* It is also available through the world-wide-web at this URL:
|
8 |
+
* http://www.gnu.org/licenses/gpl-3.0.html
|
9 |
+
* If you did not receive a copy of the license and are unable to
|
10 |
+
* obtain it through the world-wide-web, please send an email
|
11 |
+
* to license@skyverge.com so we can send you a copy immediately.
|
12 |
+
*
|
13 |
+
* DISCLAIMER
|
14 |
+
*
|
15 |
+
* Do not edit or add to this file if you wish to upgrade the plugin to newer
|
16 |
+
* versions in the future. If you wish to customize the plugin for your
|
17 |
+
* needs please refer to http://www.skyverge.com
|
18 |
+
*
|
19 |
+
* @package SkyVerge/WooCommerce/Payment-Gateway/API
|
20 |
+
* @author SkyVerge
|
21 |
+
* @copyright Copyright (c) 2013-2018, SkyVerge, Inc.
|
22 |
+
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
|
23 |
+
*/
|
24 |
+
|
25 |
+
namespace WC_Braintree\Plugin_Framework;
|
26 |
+
|
27 |
+
defined( 'ABSPATH' ) or exit;
|
28 |
+
|
29 |
+
if ( ! interface_exists( '\\WC_Braintree\\Plugin_Framework\\SV_WC_Payment_Gateway_API_Payment_Notification_eCheck_Response' ) ) :
|
30 |
+
|
31 |
+
/**
|
32 |
+
* WooCommerce Payment Gateway API Payment eCheck Notification Response
|
33 |
+
*
|
34 |
+
* Represents an IPN or redirect-back eCheck request response
|
35 |
+
*
|
36 |
+
* @since 2.2.0
|
37 |
+
*/
|
38 |
+
interface SV_WC_Payment_Gateway_API_Payment_Notification_eCheck_Response extends SV_WC_Payment_Gateway_API_Payment_Notification_Response {
|
39 |
+
|
40 |
+
|
41 |
+
|
42 |
+
/**
|
43 |
+
* Returns the account type, one of 'checking' or 'savings', if available
|
44 |
+
*
|
45 |
+
* @since 2.2.0
|
46 |
+
* @return string account type, one of 'checking' or 'savings'
|
47 |
+
*/
|
48 |
+
public function get_account_type();
|
49 |
+
|
50 |
+
|
51 |
+
/**
|
52 |
+
* Returns the check number used, if available
|
53 |
+
*
|
54 |
+
* @since 2.2.0
|
55 |
+
* @return int check number, or null
|
56 |
+
*/
|
57 |
+
public function get_check_number();
|
58 |
+
|
59 |
+
|
60 |
+
}
|
61 |
+
|
62 |
+
endif; // interface exists check
|
lib/skyverge/woocommerce/payment-gateway/api/interface-sv-wc-payment-gateway-api-payment-notification-response.php
ADDED
@@ -0,0 +1,82 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* WooCommerce Payment Gateway Framework
|
4 |
+
*
|
5 |
+
* This source file is subject to the GNU General Public License v3.0
|
6 |
+
* that is bundled with this package in the file license.txt.
|
7 |
+
* It is also available through the world-wide-web at this URL:
|
8 |
+
* http://www.gnu.org/licenses/gpl-3.0.html
|
9 |
+
* If you did not receive a copy of the license and are unable to
|
10 |
+
* obtain it through the world-wide-web, please send an email
|
11 |
+
* to license@skyverge.com so we can send you a copy immediately.
|
12 |
+
*
|
13 |
+
* DISCLAIMER
|
14 |
+
*
|
15 |
+
* Do not edit or add to this file if you wish to upgrade the plugin to newer
|
16 |
+
* versions in the future. If you wish to customize the plugin for your
|
17 |
+
* needs please refer to http://www.skyverge.com
|
18 |
+
*
|
19 |
+
* @package SkyVerge/WooCommerce/Payment-Gateway/API
|
20 |
+
* @author SkyVerge
|
21 |
+
* @copyright Copyright (c) 2013-2018, SkyVerge, Inc.
|
22 |
+
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
|
23 |
+
*/
|
24 |
+
|
25 |
+
namespace WC_Braintree\Plugin_Framework;
|
26 |
+
|
27 |
+
defined( 'ABSPATH' ) or exit;
|
28 |
+
|
29 |
+
if ( ! interface_exists( '\\WC_Braintree\\Plugin_Framework\\SV_WC_Payment_Gateway_API_Payment_Notification_Response' ) ) :
|
30 |
+
|
31 |
+
/**
|
32 |
+
* WooCommerce Payment Gateway API Payment Notification Response
|
33 |
+
*
|
34 |
+
* Represents an IPN or redirect-back request response
|
35 |
+
*
|
36 |
+
* @since 2.1.0
|
37 |
+
*/
|
38 |
+
interface SV_WC_Payment_Gateway_API_Payment_Notification_Response extends SV_WC_Payment_Gateway_API_Response {
|
39 |
+
|
40 |
+
|
41 |
+
/**
|
42 |
+
* Returns the order id associated with this response
|
43 |
+
*
|
44 |
+
* @since 2.1.0
|
45 |
+
* @return int the order id associated with this response, or null if it could not be determined
|
46 |
+
* @throws Exception if there was a serious error finding the order id
|
47 |
+
*/
|
48 |
+
public function get_order_id();
|
49 |
+
|
50 |
+
|
51 |
+
/**
|
52 |
+
* Returns true if the transaction was cancelled, false otherwise
|
53 |
+
*
|
54 |
+
* @since 2.1.0
|
55 |
+
* @return bool true if cancelled, false otherwise
|
56 |
+
*/
|
57 |
+
public function transaction_cancelled();
|
58 |
+
|
59 |
+
|
60 |
+
/**
|
61 |
+
* Returns the card PAN or checking account number, if available
|
62 |
+
*
|
63 |
+
* @since 2.2.0
|
64 |
+
* @return string PAN or account number or null if not available
|
65 |
+
*/
|
66 |
+
public function get_account_number();
|
67 |
+
|
68 |
+
|
69 |
+
/**
|
70 |
+
* Determine if this is an IPN response.
|
71 |
+
*
|
72 |
+
* Intentionally commented out to prevent fatal errors in older plugins
|
73 |
+
*
|
74 |
+
* @since 4.3.0
|
75 |
+
* @return bool
|
76 |
+
*/
|
77 |
+
public function is_ipn();
|
78 |
+
|
79 |
+
|
80 |
+
}
|
81 |
+
|
82 |
+
endif; // interface exists check
|
lib/skyverge/woocommerce/payment-gateway/api/interface-sv-wc-payment-gateway-api-payment-notification-tokenization-response.php
ADDED
@@ -0,0 +1,173 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* WooCommerce Payment Gateway Framework
|
4 |
+
*
|
5 |
+
* This source file is subject to the GNU General Public License v3.0
|
6 |
+
* that is bundled with this package in the file license.txt.
|
7 |
+
* It is also available through the world-wide-web at this URL:
|
8 |
+
* http://www.gnu.org/licenses/gpl-3.0.html
|
9 |
+
* If you did not receive a copy of the license and are unable to
|
10 |
+
* obtain it through the world-wide-web, please send an email
|
11 |
+
* to license@skyverge.com so we can send you a copy immediately.
|
12 |
+
*
|
13 |
+
* DISCLAIMER
|
14 |
+
*
|
15 |
+
* Do not edit or add to this file if you wish to upgrade the plugin to newer
|
16 |
+
* versions in the future. If you wish to customize the plugin for your
|
17 |
+
* needs please refer to http://www.skyverge.com
|
18 |
+
*
|
19 |
+
* @package SkyVerge/WooCommerce/Payment-Gateway/API
|
20 |
+
* @author SkyVerge
|
21 |
+
* @copyright Copyright (c) 2013-2018, SkyVerge, Inc.
|
22 |
+
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
|
23 |
+
*/
|
24 |
+
|
25 |
+
namespace WC_Braintree\Plugin_Framework;
|
26 |
+
|
27 |
+
defined( 'ABSPATH' ) or exit;
|
28 |
+
|
29 |
+
if ( ! interface_exists( '\\WC_Braintree\\Plugin_Framework\\SV_WC_Payment_Gateway_Payment_Notification_Tokenization_Response' ) ) :
|
30 |
+
|
31 |
+
/**
|
32 |
+
* WooCommerce Payment Gateway API Payment Credit Card Notification Response
|
33 |
+
*
|
34 |
+
* Represents an IPN or redirect-back credit card request response
|
35 |
+
*
|
36 |
+
* @since 2.2.0
|
37 |
+
*/
|
38 |
+
interface SV_WC_Payment_Gateway_Payment_Notification_Tokenization_Response extends SV_WC_Payment_Gateway_API_Create_Payment_Token_Response {
|
39 |
+
|
40 |
+
|
41 |
+
/** Response Message Methods **********************************************/
|
42 |
+
|
43 |
+
|
44 |
+
/**
|
45 |
+
* Gets the overall result message for a new payment method tokenization
|
46 |
+
* and/or customer creation.
|
47 |
+
*
|
48 |
+
* @since 5.0.0
|
49 |
+
*
|
50 |
+
* @return string
|
51 |
+
*/
|
52 |
+
public function get_tokenization_message();
|
53 |
+
|
54 |
+
|
55 |
+
/**
|
56 |
+
* Gets the result message for a new customer creation.
|
57 |
+
*
|
58 |
+
* @since 5.0.0
|
59 |
+
*
|
60 |
+
* @return string
|
61 |
+
*/
|
62 |
+
public function get_customer_created_message();
|
63 |
+
|
64 |
+
|
65 |
+
/**
|
66 |
+
* Gets the result message for a new payment method tokenization.
|
67 |
+
*
|
68 |
+
* @since 5.0.0
|
69 |
+
*
|
70 |
+
* @return string
|
71 |
+
*/
|
72 |
+
public function get_payment_method_tokenized_message();
|
73 |
+
|
74 |
+
|
75 |
+
/** Response Code Methods *************************************************/
|
76 |
+
|
77 |
+
|
78 |
+
/**
|
79 |
+
* Gets the result code for a new customer creation.
|
80 |
+
*
|
81 |
+
* @since 5.0.0
|
82 |
+
*
|
83 |
+
* @return string
|
84 |
+
*/
|
85 |
+
public function get_customer_created_code();
|
86 |
+
|
87 |
+
|
88 |
+
/**
|
89 |
+
* Gets the result code for a new payment method tokenization.
|
90 |
+
*
|
91 |
+
* @since 5.0.0
|
92 |
+
*
|
93 |
+
* @return string
|
94 |
+
*/
|
95 |
+
public function get_payment_method_tokenized_code();
|
96 |
+
|
97 |
+
|
98 |
+
/**
|
99 |
+
* Determines whether a new customer was created.
|
100 |
+
*
|
101 |
+
* @since 5.0.0
|
102 |
+
*
|
103 |
+
* @return bool
|
104 |
+
*/
|
105 |
+
public function customer_created();
|
106 |
+
|
107 |
+
|
108 |
+
/**
|
109 |
+
* Determines whether a new payment method was tokenized.
|
110 |
+
*
|
111 |
+
* @since 5.0.0
|
112 |
+
*
|
113 |
+
* @return bool
|
114 |
+
*/
|
115 |
+
public function payment_method_tokenized();
|
116 |
+
|
117 |
+
|
118 |
+
/**
|
119 |
+
* Determines whether the overall payment tokenization was successful.
|
120 |
+
*
|
121 |
+
* Gatewways can check that the payment method was tokenized, and if a new
|
122 |
+
* customer was created, that was successful.
|
123 |
+
*
|
124 |
+
* @since 5.0.0
|
125 |
+
*
|
126 |
+
* @return bool
|
127 |
+
*/
|
128 |
+
public function tokenization_successful();
|
129 |
+
|
130 |
+
|
131 |
+
/**
|
132 |
+
* Determines whether the customer was successfully created.
|
133 |
+
*
|
134 |
+
* @since 5.0.0
|
135 |
+
*
|
136 |
+
* @return bool
|
137 |
+
*/
|
138 |
+
public function customer_creation_successful();
|
139 |
+
|
140 |
+
|
141 |
+
/**
|
142 |
+
* Determines whether the payment method was successfully tokenized.
|
143 |
+
*
|
144 |
+
* @since 5.0.0
|
145 |
+
*
|
146 |
+
* @return bool
|
147 |
+
*/
|
148 |
+
public function payment_method_tokenization_successful();
|
149 |
+
|
150 |
+
|
151 |
+
/**
|
152 |
+
* Gets any payment tokens that were edited on the hosted pay page.
|
153 |
+
*
|
154 |
+
* @since 5.0.0
|
155 |
+
*
|
156 |
+
* @return array
|
157 |
+
*/
|
158 |
+
public function get_edited_payment_tokens();
|
159 |
+
|
160 |
+
|
161 |
+
/**
|
162 |
+
* Gets any payment tokens that were deleted on the hosted pay page.
|
163 |
+
*
|
164 |
+
* @since 5.0.0
|
165 |
+
*
|
166 |
+
* @return array
|
167 |
+
*/
|
168 |
+
public function get_deleted_payment_tokens();
|
169 |
+
|
170 |
+
|
171 |
+
}
|
172 |
+
|
173 |
+
endif; // interface exists check
|
lib/skyverge/woocommerce/payment-gateway/api/interface-sv-wc-payment-gateway-api-request.php
CHANGED
@@ -18,15 +18,15 @@
|
|
18 |
*
|
19 |
* @package SkyVerge/WooCommerce/Payment-Gateway/API
|
20 |
* @author SkyVerge
|
21 |
-
* @copyright Copyright (c) 2013-
|
22 |
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
|
23 |
*/
|
24 |
|
25 |
-
namespace
|
26 |
|
27 |
defined( 'ABSPATH' ) or exit;
|
28 |
|
29 |
-
if ( ! interface_exists( '
|
30 |
|
31 |
/**
|
32 |
* WooCommerce Direct Payment Gateway API Request
|
18 |
*
|
19 |
* @package SkyVerge/WooCommerce/Payment-Gateway/API
|
20 |
* @author SkyVerge
|
21 |
+
* @copyright Copyright (c) 2013-2018, SkyVerge, Inc.
|
22 |
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
|
23 |
*/
|
24 |
|
25 |
+
namespace WC_Braintree\Plugin_Framework;
|
26 |
|
27 |
defined( 'ABSPATH' ) or exit;
|
28 |
|
29 |
+
if ( ! interface_exists( '\\WC_Braintree\\Plugin_Framework\\SV_WC_Payment_Gateway_API_Request' ) ) :
|
30 |
|
31 |
/**
|
32 |
* WooCommerce Direct Payment Gateway API Request
|
lib/skyverge/woocommerce/payment-gateway/api/interface-sv-wc-payment-gateway-api-response.php
CHANGED
@@ -18,15 +18,15 @@
|
|
18 |
*
|
19 |
* @package SkyVerge/WooCommerce/Payment-Gateway/API
|
20 |
* @author SkyVerge
|
21 |
-
* @copyright Copyright (c) 2013-
|
22 |
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
|
23 |
*/
|
24 |
|
25 |
-
namespace
|
26 |
|
27 |
defined( 'ABSPATH' ) or exit;
|
28 |
|
29 |
-
if ( ! interface_exists( '
|
30 |
|
31 |
/**
|
32 |
* WooCommerce Direct Payment Gateway API Response
|
@@ -85,14 +85,13 @@ interface SV_WC_Payment_Gateway_API_Response extends SV_WC_API_Response {
|
|
85 |
|
86 |
|
87 |
/**
|
88 |
-
*
|
89 |
*
|
90 |
-
*
|
91 |
*
|
92 |
-
* @
|
93 |
-
* @return string payment type or null if not available
|
94 |
*/
|
95 |
-
|
96 |
|
97 |
|
98 |
/**
|
18 |
*
|
19 |
* @package SkyVerge/WooCommerce/Payment-Gateway/API
|
20 |
* @author SkyVerge
|
21 |
+
* @copyright Copyright (c) 2013-2018, SkyVerge, Inc.
|
22 |
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
|
23 |
*/
|
24 |
|
25 |
+
namespace WC_Braintree\Plugin_Framework;
|
26 |
|
27 |
defined( 'ABSPATH' ) or exit;
|
28 |
|
29 |
+
if ( ! interface_exists( '\\WC_Braintree\\Plugin_Framework\\SV_WC_Payment_Gateway_API_Response' ) ) :
|
30 |
|
31 |
/**
|
32 |
* WooCommerce Direct Payment Gateway API Response
|
85 |
|
86 |
|
87 |
/**
|
88 |
+
* Gets the payment type: 'credit-card', 'echeck', etc...
|
89 |
*
|
90 |
+
* @since 5.0.0
|
91 |
*
|
92 |
+
* @return string
|
|
|
93 |
*/
|
94 |
+
public function get_payment_type();
|
95 |
|
96 |
|
97 |
/**
|
lib/skyverge/woocommerce/payment-gateway/api/interface-sv-wc-payment-gateway-api.php
CHANGED
@@ -18,15 +18,15 @@
|
|
18 |
*
|
19 |
* @package SkyVerge/WooCommerce/Payment-Gateway/API
|
20 |
* @author SkyVerge
|
21 |
-
* @copyright Copyright (c) 2013-
|
22 |
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
|
23 |
*/
|
24 |
|
25 |
-
namespace
|
26 |
|
27 |
defined( 'ABSPATH' ) or exit;
|
28 |
|
29 |
-
if ( ! interface_exists( '
|
30 |
|
31 |
/**
|
32 |
* WooCommerce Direct Payment Gateway API
|
@@ -40,7 +40,8 @@ interface SV_WC_Payment_Gateway_API {
|
|
40 |
* If the gateway does not support credit card authorizations, this method can be a no-op.
|
41 |
*
|
42 |
* @since 1.0.0
|
43 |
-
*
|
|
|
44 |
* @return SV_WC_Payment_Gateway_API_Response credit card charge response
|
45 |
* @throws SV_WC_Payment_Gateway_Exception network timeouts, etc
|
46 |
*/
|
@@ -53,7 +54,8 @@ interface SV_WC_Payment_Gateway_API {
|
|
53 |
* If the gateway does not support credit card charges, this method can be a no-op.
|
54 |
*
|
55 |
* @since 1.0.0
|
56 |
-
*
|
|
|
57 |
* @return SV_WC_Payment_Gateway_API_Response credit card charge response
|
58 |
* @throws SV_WC_Payment_Gateway_Exception network timeouts, etc
|
59 |
*/
|
@@ -66,7 +68,8 @@ interface SV_WC_Payment_Gateway_API {
|
|
66 |
* If the gateway does not support credit card capture, this method can be a no-op.
|
67 |
*
|
68 |
* @since 1.0.0
|
69 |
-
*
|
|
|
70 |
* @return SV_WC_Payment_Gateway_API_Response credit card capture response
|
71 |
* @throws SV_WC_Payment_Gateway_Exception network timeouts, etc
|
72 |
*/
|
@@ -79,7 +82,8 @@ interface SV_WC_Payment_Gateway_API {
|
|
79 |
* If the gateway does not support check debits, this method can be a no-op.
|
80 |
*
|
81 |
* @since 1.0.0
|
82 |
-
*
|
|
|
83 |
* @return SV_WC_Payment_Gateway_API_Response check debit response
|
84 |
* @throws SV_WC_Payment_Gateway_Exception network timeouts, etc
|
85 |
*/
|
@@ -92,7 +96,8 @@ interface SV_WC_Payment_Gateway_API {
|
|
92 |
* If the gateway does not support refunds, this method can be a no-op.
|
93 |
*
|
94 |
* @since 3.1.0
|
95 |
-
*
|
|
|
96 |
* @return SV_WC_Payment_Gateway_API_Response refund response
|
97 |
* @throws SV_WC_Payment_Gateway_Exception network timeouts, etc
|
98 |
*/
|
@@ -105,7 +110,8 @@ interface SV_WC_Payment_Gateway_API {
|
|
105 |
* If the gateway does not support voids, this method can be a no-op.
|
106 |
*
|
107 |
* @since 3.1.0
|
108 |
-
*
|
|
|
109 |
* @return SV_WC_Payment_Gateway_API_Response void response
|
110 |
* @throws SV_WC_Payment_Gateway_Exception network timeouts, etc
|
111 |
*/
|
@@ -118,13 +124,38 @@ interface SV_WC_Payment_Gateway_API {
|
|
118 |
* If the gateway does not support tokenization, this method can be a no-op.
|
119 |
*
|
120 |
* @since 1.0.0
|
121 |
-
*
|
|
|
122 |
* @return SV_WC_Payment_Gateway_API_Create_Payment_Token_Response payment method tokenization response
|
123 |
* @throws SV_WC_Payment_Gateway_Exception network timeouts, etc
|
124 |
*/
|
125 |
public function tokenize_payment_method( \WC_Order $order );
|
126 |
|
127 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
128 |
/**
|
129 |
* Removes the tokenized payment method. This method should not be invoked
|
130 |
* unless supports_remove_tokenized_payment_method() returns true, otherwise
|
@@ -132,6 +163,7 @@ interface SV_WC_Payment_Gateway_API {
|
|
132 |
*
|
133 |
* @since 1.0.0
|
134 |
* @see SV_WC_Payment_Gateway_API::supports_remove_tokenized_payment_method()
|
|
|
135 |
* @param string $token the payment method token
|
136 |
* @param string $customer_id unique customer id for gateways that support it
|
137 |
* @return SV_WC_Payment_Gateway_API_Response remove tokenized payment method response
|
@@ -147,6 +179,7 @@ interface SV_WC_Payment_Gateway_API {
|
|
147 |
*
|
148 |
* @since 1.0.0
|
149 |
* @see SV_WC_Payment_Gateway_API::remove_tokenized_payment_method()
|
|
|
150 |
* @return boolean true if this API supports a "remove tokenized payment method" request, false otherwise
|
151 |
*/
|
152 |
public function supports_remove_tokenized_payment_method();
|
@@ -159,8 +192,9 @@ interface SV_WC_Payment_Gateway_API {
|
|
159 |
*
|
160 |
* @since 1.0.0
|
161 |
* @see SV_WC_Payment_Gateway_API::supports_get_tokenized_payment_methods()
|
|
|
162 |
* @param string $customer_id unique customer id
|
163 |
-
* @return
|
164 |
* @throws SV_WC_Payment_Gateway_Exception network timeouts, etc
|
165 |
*/
|
166 |
public function get_tokenized_payment_methods( $customer_id );
|
@@ -173,6 +207,7 @@ interface SV_WC_Payment_Gateway_API {
|
|
173 |
*
|
174 |
* @since 1.0.0
|
175 |
* @see SV_WC_Payment_Gateway_API::get_tokenized_payment_methods()
|
|
|
176 |
* @return boolean true if this API supports a "get tokenized payment methods" request, false otherwise
|
177 |
*/
|
178 |
public function supports_get_tokenized_payment_methods();
|
@@ -182,7 +217,8 @@ interface SV_WC_Payment_Gateway_API {
|
|
182 |
* Returns the most recent request object
|
183 |
*
|
184 |
* @since 1.0.0
|
185 |
-
*
|
|
|
186 |
*/
|
187 |
public function get_request();
|
188 |
|
@@ -191,7 +227,8 @@ interface SV_WC_Payment_Gateway_API {
|
|
191 |
* Returns the most recent response object
|
192 |
*
|
193 |
* @since 1.0.0
|
194 |
-
*
|
|
|
195 |
*/
|
196 |
public function get_response();
|
197 |
|
@@ -200,6 +237,7 @@ interface SV_WC_Payment_Gateway_API {
|
|
200 |
* Returns the WC_Order object associated with the request, if any
|
201 |
*
|
202 |
* @since 4.1.0
|
|
|
203 |
* @return \WC_Order
|
204 |
*/
|
205 |
public function get_order();
|
18 |
*
|
19 |
* @package SkyVerge/WooCommerce/Payment-Gateway/API
|
20 |
* @author SkyVerge
|
21 |
+
* @copyright Copyright (c) 2013-2018, SkyVerge, Inc.
|
22 |
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
|
23 |
*/
|
24 |
|
25 |
+
namespace WC_Braintree\Plugin_Framework;
|
26 |
|
27 |
defined( 'ABSPATH' ) or exit;
|
28 |
|
29 |
+
if ( ! interface_exists( '\\WC_Braintree\\Plugin_Framework\\SV_WC_Payment_Gateway_API' ) ) :
|
30 |
|
31 |
/**
|
32 |
* WooCommerce Direct Payment Gateway API
|
40 |
* If the gateway does not support credit card authorizations, this method can be a no-op.
|
41 |
*
|
42 |
* @since 1.0.0
|
43 |
+
*
|
44 |
+
* @param \WC_Order $order the order
|
45 |
* @return SV_WC_Payment_Gateway_API_Response credit card charge response
|
46 |
* @throws SV_WC_Payment_Gateway_Exception network timeouts, etc
|
47 |
*/
|
54 |
* If the gateway does not support credit card charges, this method can be a no-op.
|
55 |
*
|
56 |
* @since 1.0.0
|
57 |
+
*
|
58 |
+
* @param \WC_Order $order the order
|
59 |
* @return SV_WC_Payment_Gateway_API_Response credit card charge response
|
60 |
* @throws SV_WC_Payment_Gateway_Exception network timeouts, etc
|
61 |
*/
|
68 |
* If the gateway does not support credit card capture, this method can be a no-op.
|
69 |
*
|
70 |
* @since 1.0.0
|
71 |
+
*
|
72 |
+
* @param \WC_Order $order the order
|
73 |
* @return SV_WC_Payment_Gateway_API_Response credit card capture response
|
74 |
* @throws SV_WC_Payment_Gateway_Exception network timeouts, etc
|
75 |
*/
|
82 |
* If the gateway does not support check debits, this method can be a no-op.
|
83 |
*
|
84 |
* @since 1.0.0
|
85 |
+
*
|
86 |
+
* @param \WC_Order $order the order
|
87 |
* @return SV_WC_Payment_Gateway_API_Response check debit response
|
88 |
* @throws SV_WC_Payment_Gateway_Exception network timeouts, etc
|
89 |
*/
|
96 |
* If the gateway does not support refunds, this method can be a no-op.
|
97 |
*
|
98 |
* @since 3.1.0
|
99 |
+
*
|
100 |
+
* @param \WC_Order $order order object
|
101 |
* @return SV_WC_Payment_Gateway_API_Response refund response
|
102 |
* @throws SV_WC_Payment_Gateway_Exception network timeouts, etc
|
103 |
*/
|
110 |
* If the gateway does not support voids, this method can be a no-op.
|
111 |
*
|
112 |
* @since 3.1.0
|
113 |
+
*
|
114 |
+
* @param \WC_Order $order order object
|
115 |
* @return SV_WC_Payment_Gateway_API_Response void response
|
116 |
* @throws SV_WC_Payment_Gateway_Exception network timeouts, etc
|
117 |
*/
|
124 |
* If the gateway does not support tokenization, this method can be a no-op.
|
125 |
*
|
126 |
* @since 1.0.0
|
127 |
+
*
|
128 |
+
* @param \WC_Order $order the order
|
129 |
* @return SV_WC_Payment_Gateway_API_Create_Payment_Token_Response payment method tokenization response
|
130 |
* @throws SV_WC_Payment_Gateway_Exception network timeouts, etc
|
131 |
*/
|
132 |
public function tokenize_payment_method( \WC_Order $order );
|
133 |
|
134 |
|
135 |
+
/**
|
136 |
+
* Updates a tokenized payment method.
|
137 |
+
*
|
138 |
+
* @since 5.3.0-dev
|
139 |
+
*
|
140 |
+
* @param \WC_Order $order order object
|
141 |
+
* @return SV_WC_Payment_Gateway_API_Response
|
142 |
+
* @throws SV_WC_Plugin_Exception
|
143 |
+
*/
|
144 |
+
public function update_tokenized_payment_method( \WC_Order $order );
|
145 |
+
|
146 |
+
|
147 |
+
/**
|
148 |
+
* Determines if this API supports updating tokenized payment methods.
|
149 |
+
*
|
150 |
+
* @see SV_WC_Payment_Gateway_API::update_tokenized_payment_method()
|
151 |
+
*
|
152 |
+
* @since 5.3.0-dev
|
153 |
+
*
|
154 |
+
* @return bool
|
155 |
+
*/
|
156 |
+
public function supports_update_tokenized_payment_method();
|
157 |
+
|
158 |
+
|
159 |
/**
|
160 |
* Removes the tokenized payment method. This method should not be invoked
|
161 |
* unless supports_remove_tokenized_payment_method() returns true, otherwise
|
163 |
*
|
164 |
* @since 1.0.0
|
165 |
* @see SV_WC_Payment_Gateway_API::supports_remove_tokenized_payment_method()
|
166 |
+
*
|
167 |
* @param string $token the payment method token
|
168 |
* @param string $customer_id unique customer id for gateways that support it
|
169 |
* @return SV_WC_Payment_Gateway_API_Response remove tokenized payment method response
|
179 |
*
|
180 |
* @since 1.0.0
|
181 |
* @see SV_WC_Payment_Gateway_API::remove_tokenized_payment_method()
|
182 |
+
*
|
183 |
* @return boolean true if this API supports a "remove tokenized payment method" request, false otherwise
|
184 |
*/
|
185 |
public function supports_remove_tokenized_payment_method();
|
192 |
*
|
193 |
* @since 1.0.0
|
194 |
* @see SV_WC_Payment_Gateway_API::supports_get_tokenized_payment_methods()
|
195 |
+
*
|
196 |
* @param string $customer_id unique customer id
|
197 |
+
* @return SV_WC_Payment_Gateway_API_Get_Tokenized_Payment_Methods_Response response containing any payment tokens for the customer
|
198 |
* @throws SV_WC_Payment_Gateway_Exception network timeouts, etc
|
199 |
*/
|
200 |
public function get_tokenized_payment_methods( $customer_id );
|
207 |
*
|
208 |
* @since 1.0.0
|
209 |
* @see SV_WC_Payment_Gateway_API::get_tokenized_payment_methods()
|
210 |
+
*
|
211 |
* @return boolean true if this API supports a "get tokenized payment methods" request, false otherwise
|
212 |
*/
|
213 |
public function supports_get_tokenized_payment_methods();
|
217 |
* Returns the most recent request object
|
218 |
*
|
219 |
* @since 1.0.0
|
220 |
+
*
|
221 |
+
* @return SV_WC_Payment_Gateway_API_Request the most recent request object
|
222 |
*/
|
223 |
public function get_request();
|
224 |
|
227 |
* Returns the most recent response object
|
228 |
*
|
229 |
* @since 1.0.0
|
230 |
+
*
|
231 |
+
* @return SV_WC_Payment_Gateway_API_Response the most recent response object
|
232 |
*/
|
233 |
public function get_response();
|
234 |
|
237 |
* Returns the WC_Order object associated with the request, if any
|
238 |
*
|
239 |
* @since 4.1.0
|
240 |
+
*
|
241 |
* @return \WC_Order
|
242 |
*/
|
243 |
public function get_order();
|
lib/skyverge/woocommerce/payment-gateway/apple-pay/api/class-sv-wc-payment-gateway-apple-pay-api-request.php
ADDED
@@ -0,0 +1,111 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* WooCommerce Payment Gateway Framework
|
4 |
+
*
|
5 |
+
* This source file is subject to the GNU General Public License v3.0
|
6 |
+
* that is bundled with this package in the file license.txt.
|
7 |
+
* It is also available through the world-wide-web at this URL:
|
8 |
+
* http://www.gnu.org/licenses/gpl-3.0.html
|
9 |
+
* If you did not receive a copy of the license and are unable to
|
10 |
+
* obtain it through the world-wide-web, please send an email
|
11 |
+
* to license@skyverge.com so we can send you a copy immediately.
|
12 |
+
*
|
13 |
+
* DISCLAIMER
|
14 |
+
*
|
15 |
+
* Do not edit or add to this file if you wish to upgrade the plugin to newer
|
16 |
+
* versions in the future. If you wish to customize the plugin for your
|
17 |
+
* needs please refer to http://www.skyverge.com
|
18 |
+
*
|
19 |
+
* @package SkyVerge/WooCommerce/Payment-Gateway/Apple-Pay
|
20 |
+
* @author SkyVerge
|
21 |
+
* @copyright Copyright (c) 2013-2016, SkyVerge, Inc.
|
22 |
+
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
|
23 |
+
*/
|
24 |
+
|
25 |
+
namespace WC_Braintree\Plugin_Framework;
|
26 |
+
|
27 |
+
defined( 'ABSPATH' ) or exit;
|
28 |
+
|
29 |
+
if ( ! class_exists( '\\WC_Braintree\\Plugin_Framework\\SV_WC_Payment_Gateway_Apple_Pay_API_Request' ) ) :
|
30 |
+
|
31 |
+
/**
|
32 |
+
* The Apple Pay API request object.
|
33 |
+
*
|
34 |
+
* @since 4.7.0
|
35 |
+
*/
|
36 |
+
class SV_WC_Payment_Gateway_Apple_Pay_API_Request extends SV_WC_API_JSON_Request {
|
37 |
+
|
38 |
+
|
39 |
+
/** @var \SV_WC_Payment_Gateway $gateway the gateway instance */
|
40 |
+
protected $gateway;
|
41 |
+
|
42 |
+
|
43 |
+
/**
|
44 |
+
* Constructs the request.
|
45 |
+
*
|
46 |
+
* @since 4.7.0
|
47 |
+
*
|
48 |
+
* @param \SV_WC_Payment_Gateway $gateway the gateway instance
|
49 |
+
*/
|
50 |
+
public function __construct( SV_WC_Payment_Gateway $gateway ) {
|
51 |
+
|
52 |
+
$this->gateway = $gateway;
|
53 |
+
}
|
54 |
+
|
55 |
+
|
56 |
+
/**
|
57 |
+
* Sets the data for merchant validation.
|
58 |
+
*
|
59 |
+
* @since 4.7.0
|
60 |
+
*
|
61 |
+
* @param string $merchant_id the merchant ID to validate
|
62 |
+
* @param string $domain_name the verified domain name
|
63 |
+
* @param string $display_name the merchant display name
|
64 |
+
*/
|
65 |
+
public function set_merchant_data( $merchant_id, $domain_name, $display_name ) {
|
66 |
+
|
67 |
+
$data = array(
|
68 |
+
'merchantIdentifier' => $merchant_id,
|
69 |
+
'domainName' => str_replace( array( 'http://', 'https://' ), '', $domain_name ),
|
70 |
+
'displayName' => $display_name,
|
71 |
+
);
|
72 |
+
|
73 |
+
/**
|
74 |
+
* Filters the data for merchant validation.
|
75 |
+
*
|
76 |
+
* @since 4.7.0
|
77 |
+
*
|
78 |
+
* @param array $data {
|
79 |
+
* The merchant data.
|
80 |
+
*
|
81 |
+
* @var string $merchantIdentifier the merchant ID
|
82 |
+
* @var string $domainName the verified domain name
|
83 |
+
* @var string $displayName the merchant display name
|
84 |
+
* }
|
85 |
+
* @param \SV_WC_Payment_Gateway_Apple_Pay_API_Request the request object
|
86 |
+
*/
|
87 |
+
$this->data = apply_filters( 'sv_wc_apple_pay_api_merchant_data', $data, $this );
|
88 |
+
}
|
89 |
+
|
90 |
+
|
91 |
+
/**
|
92 |
+
* Get the string representation of this response with any and all sensitive
|
93 |
+
* elements masked or removed.
|
94 |
+
*
|
95 |
+
* @since 4.7.0
|
96 |
+
* @see SV_WC_API_Response::to_string_safe()
|
97 |
+
*
|
98 |
+
* @return string
|
99 |
+
*/
|
100 |
+
public function to_string_safe() {
|
101 |
+
|
102 |
+
// mask the merchant ID
|
103 |
+
$string = str_replace( $this->data['merchantIdentifier'], str_repeat( '*', strlen( $this->data['merchantIdentifier'] ) ), $this->to_string() );
|
104 |
+
|
105 |
+
return $string;
|
106 |
+
}
|
107 |
+
|
108 |
+
|
109 |
+
}
|
110 |
+
|
111 |
+
endif;
|
lib/skyverge/woocommerce/payment-gateway/apple-pay/api/class-sv-wc-payment-gateway-apple-pay-api-response.php
ADDED
@@ -0,0 +1,110 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* WooCommerce Payment Gateway Framework
|
4 |
+
*
|
5 |
+
* This source file is subject to the GNU General Public License v3.0
|
6 |
+
* that is bundled with this package in the file license.txt.
|
7 |
+
* It is also available through the world-wide-web at this URL:
|
8 |
+
* http://www.gnu.org/licenses/gpl-3.0.html
|
9 |
+
* If you did not receive a copy of the license and are unable to
|
10 |
+
* obtain it through the world-wide-web, please send an email
|
11 |
+
* to license@skyverge.com so we can send you a copy immediately.
|
12 |
+
*
|
13 |
+
* DISCLAIMER
|
14 |
+
*
|
15 |
+
* Do not edit or add to this file if you wish to upgrade the plugin to newer
|
16 |
+
* versions in the future. If you wish to customize the plugin for your
|
17 |
+
* needs please refer to http://www.skyverge.com
|
18 |
+
*
|
19 |
+
* @package SkyVerge/WooCommerce/Payment-Gateway/Apple-Pay
|
20 |
+
* @author SkyVerge
|
21 |
+
* @copyright Copyright (c) 2013-2016, SkyVerge, Inc.
|
22 |
+
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
|
23 |
+
*/
|
24 |
+
|
25 |
+
namespace WC_Braintree\Plugin_Framework;
|
26 |
+
|
27 |
+
defined( 'ABSPATH' ) or exit;
|
28 |
+
|
29 |
+
if ( ! class_exists( '\\WC_Braintree\\Plugin_Framework\\SV_WC_Payment_Gateway_Apple_Pay_API_Response' ) ) :
|
30 |
+
|
31 |
+
/**
|
32 |
+
* The Apple Pay API response object.
|
33 |
+
*
|
34 |
+
* @since 4.7.0
|
35 |
+
*/
|
36 |
+
class SV_WC_Payment_Gateway_Apple_Pay_API_Response extends SV_WC_API_JSON_Response {
|
37 |
+
|
38 |
+
|
39 |
+
/**
|
40 |
+
* Gets the status code.
|
41 |
+
*
|
42 |
+
* @since 4.7.0
|
43 |
+
*
|
44 |
+
* @return string
|
45 |
+
*/
|
46 |
+
public function get_status_code() {
|
47 |
+
|
48 |
+
return $this->statusCode;
|
49 |
+
}
|
50 |
+
|
51 |
+
|
52 |
+
/**
|
53 |
+
* Gets the status message.
|
54 |
+
*
|
55 |
+
* @since 4.7.0
|
56 |
+
*
|
57 |
+
* @return string
|
58 |
+
*/
|
59 |
+
public function get_status_message() {
|
60 |
+
|
61 |
+
return $this->statusMessage;
|
62 |
+
}
|
63 |
+
|
64 |
+
|
65 |
+
/**
|
66 |
+
* Gets the validated merchant session.
|
67 |
+
*
|
68 |
+
* @since 4.7.0
|
69 |
+
*
|
70 |
+
* @return array
|
71 |
+
*/
|
72 |
+
public function get_merchant_session() {
|
73 |
+
|
74 |
+
return $this->raw_response_json;
|
75 |
+
}
|
76 |
+
|
77 |
+
|
78 |
+
/**
|
79 |
+
* Get the string representation of this response with any and all sensitive
|
80 |
+
* elements masked or removed.
|
81 |
+
*
|
82 |
+
* No strong indication from the Apple documentation that these _need_ to be
|
83 |
+
* masked, but they don't provide any useful info and only make the debug
|
84 |
+
* logs unnecessarily huge.
|
85 |
+
*
|
86 |
+
* @since 4.7.0
|
87 |
+
* @see SV_WC_API_Response::to_string_safe()
|
88 |
+
*
|
89 |
+
* @return string
|
90 |
+
*/
|
91 |
+
public function to_string_safe() {
|
92 |
+
|
93 |
+
$string = $this->to_string();
|
94 |
+
|
95 |
+
// mask the merchant session ID
|
96 |
+
$string = str_replace( $this->merchantSessionIdentifier, str_repeat( '*', 10 ), $string );
|
97 |
+
|
98 |
+
// mask the merchant ID
|
99 |
+
$string = str_replace( $this->merchantIdentifier, str_repeat( '*', 10 ), $string );
|
100 |
+
|
101 |
+
// mask the signature
|
102 |
+
$string = str_replace( $this->signature, str_repeat( '*', 10 ), $string );
|
103 |
+
|
104 |
+
return $string;
|
105 |
+
}
|
106 |
+
|
107 |
+
|
108 |
+
}
|
109 |
+
|
110 |
+
endif;
|
lib/skyverge/woocommerce/payment-gateway/apple-pay/api/class-sv-wc-payment-gateway-apple-pay-api.php
ADDED
@@ -0,0 +1,194 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* WooCommerce Payment Gateway Framework
|
4 |
+
*
|
5 |
+
* This source file is subject to the GNU General Public License v3.0
|
6 |
+
* that is bundled with this package in the file license.txt.
|
7 |
+
* It is also available through the world-wide-web at this URL:
|
8 |
+
* http://www.gnu.org/licenses/gpl-3.0.html
|
9 |
+
* If you did not receive a copy of the license and are unable to
|
10 |
+
* obtain it through the world-wide-web, please send an email
|
11 |
+
* to license@skyverge.com so we can send you a copy immediately.
|
12 |
+
*
|
13 |
+
* DISCLAIMER
|
14 |
+
*
|
15 |
+
* Do not edit or add to this file if you wish to upgrade the plugin to newer
|
16 |
+
* versions in the future. If you wish to customize the plugin for your
|
17 |
+
* needs please refer to http://www.skyverge.com
|
18 |
+
*
|
19 |
+
* @package SkyVerge/WooCommerce/Payment-Gateway/Apple-Pay
|
20 |
+
* @author SkyVerge
|
21 |
+
* @copyright Copyright (c) 2013-2016, SkyVerge, Inc.
|
22 |
+
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
|
23 |
+
*/
|
24 |
+
|
25 |
+
namespace WC_Braintree\Plugin_Framework;
|
26 |
+
|
27 |
+
defined( 'ABSPATH' ) or exit;
|
28 |
+
|
29 |
+
if ( ! class_exists( '\\WC_Braintree\\Plugin_Framework\\SV_WC_Payment_Gateway_Apple_Pay_API' ) ) :
|
30 |
+
|
31 |
+
/**
|
32 |
+
* Sets up the Apple Pay API.
|
33 |
+
*
|
34 |
+
* @since 4.7.0
|
35 |
+
*/
|
36 |
+
class SV_WC_Payment_Gateway_Apple_Pay_API extends SV_WC_API_Base {
|
37 |
+
|
38 |
+
|
39 |
+
/** @var SV_WC_Payment_Gateway the gateway instance */
|
40 |
+
protected $gateway;
|
41 |
+
|
42 |
+
|
43 |
+
/**
|
44 |
+
* Constructs the class.
|
45 |
+
*
|
46 |
+
* @since 4.7.0
|
47 |
+
*
|
48 |
+
* @param SV_WC_Payment_Gateway the gateway instance
|
49 |
+
*/
|
50 |
+
public function __construct( SV_WC_Payment_Gateway $gateway ) {
|
51 |
+
|
52 |
+
$this->gateway = $gateway;
|
53 |
+
|
54 |
+
$this->request_uri = 'https://apple-pay-gateway-cert.apple.com/paymentservices/startSession';
|
55 |
+
|
56 |
+
$this->set_request_content_type_header( 'application/json' );
|
57 |
+
$this->set_request_accept_header( 'application/json' );
|
58 |
+
|
59 |
+
$this->set_response_handler( '\\WC_Braintree\\Plugin_Framework\\SV_WC_Payment_Gateway_Apple_Pay_API_Response' );
|
60 |
+
}
|
61 |
+
|
62 |
+
|
63 |
+
/**
|
64 |
+
* Validates the Apple Pay merchant.
|
65 |
+
*
|
66 |
+
* @since 4.7.0
|
67 |
+
*
|
68 |
+
* @param string $url the validation URL
|
69 |
+
* @param string $merchant_id the merchant ID to validate
|
70 |
+
* @param string $domain_name the verified domain name
|
71 |
+
* @param string $display_name the merchant display name
|
72 |
+
* @return SV_WC_Payment_Gateway_Apple_Pay_API_Response the response object
|
73 |
+
*
|
74 |
+
* @throws SV_WC_API_Exception
|
75 |
+
*/
|
76 |
+
public function validate_merchant( $url, $merchant_id, $domain_name, $display_name ) {
|
77 |
+
|
78 |
+
$this->request_uri = $url;
|
79 |
+
|
80 |
+
$request = $this->get_new_request();
|
81 |
+
|
82 |
+
$request->set_merchant_data( $merchant_id, $domain_name, $display_name );
|
83 |
+
|
84 |
+
return $this->perform_request( $request );
|
85 |
+
}
|
86 |
+
|
87 |
+
|
88 |
+
/**
|
89 |
+
* Performs the request and return the parsed response.
|
90 |
+
*
|
91 |
+
* @since 4.7.0
|
92 |
+
*
|
93 |
+
* @param SV_WC_API_Request
|
94 |
+
* @return SV_WC_API_Response
|
95 |
+
* @throws SV_WC_API_Exception
|
96 |
+
*/
|
97 |
+
protected function perform_request( $request ) {
|
98 |
+
|
99 |
+
// set PEM file cert for requests
|
100 |
+
add_action( 'http_api_curl', array( $this, 'set_cert_file' ) );
|
101 |
+
|
102 |
+
return parent::perform_request( $request );
|
103 |
+
}
|
104 |
+
|
105 |
+
|
106 |
+
/**
|
107 |
+
* Sets the PEM file required for authentication.
|
108 |
+
*
|
109 |
+
* @internal
|
110 |
+
*
|
111 |
+
* @since 4.7.0
|
112 |
+
*
|
113 |
+
* @param resource $curl_handle
|
114 |
+
*/
|
115 |
+
public function set_cert_file( $curl_handle ) {
|
116 |
+
|
117 |
+
if ( ! $curl_handle ) {
|
118 |
+
return;
|
119 |
+
}
|
120 |
+
|
121 |
+
curl_setopt( $curl_handle, CURLOPT_SSLCERT, get_option( 'sv_wc_apple_pay_cert_path' ) );
|
122 |
+
}
|
123 |
+
|
124 |
+
|
125 |
+
/** Validation methods ****************************************************/
|
126 |
+
|
127 |
+
|
128 |
+
/**
|
129 |
+
* Validates the post-parsed response.
|
130 |
+
*
|
131 |
+
* @since 4.7.0
|
132 |
+
*
|
133 |
+
* @return bool
|
134 |
+
*
|
135 |
+
* @throws SV_WC_API_Exception
|
136 |
+
*/
|
137 |
+
protected function do_post_parse_response_validation() {
|
138 |
+
|
139 |
+
$response = $this->get_response();
|
140 |
+
|
141 |
+
if ( $response->get_status_code() && 200 !== $response->get_status_code() ) {
|
142 |
+
throw new SV_WC_API_Exception( $response->get_status_message() );
|
143 |
+
}
|
144 |
+
|
145 |
+
return true;
|
146 |
+
}
|
147 |
+
|
148 |
+
|
149 |
+
/** Helper methods ********************************************************/
|
150 |
+
|
151 |
+
|
152 |
+
/**
|
153 |
+
* Gets a new request object.
|
154 |
+
*
|
155 |
+
* @since 4.7.0
|
156 |
+
*
|
157 |
+
* @param array $type Optional. The desired request type
|
158 |
+
* @return SV_WC_Payment_Gateway_Apple_Pay_API_Request the request object
|
159 |
+
*/
|
160 |
+
protected function get_new_request( $type = array() ) {
|
161 |
+
|
162 |
+
return new SV_WC_Payment_Gateway_Apple_Pay_API_Request( $this->get_gateway() );
|
163 |
+
}
|
164 |
+
|
165 |
+
|
166 |
+
/**
|
167 |
+
* Gets the gateway instance.
|
168 |
+
*
|
169 |
+
* @since 4.7.0
|
170 |
+
*
|
171 |
+
* @return SV_WC_Payment_Gateway
|
172 |
+
*/
|
173 |
+
protected function get_gateway() {
|
174 |
+
|
175 |
+
return $this->gateway;
|
176 |
+
}
|
177 |
+
|
178 |
+
|
179 |
+
/**
|
180 |
+
* Gets the plugin instance.
|
181 |
+
*
|
182 |
+
* @since 4.7.0
|
183 |
+
*
|
184 |
+
* @return SV_WC_Payment_Gateway_Plugin
|
185 |
+
*/
|
186 |
+
protected function get_plugin() {
|
187 |
+
|
188 |
+
return $this->get_gateway()->get_plugin();
|
189 |
+
}
|
190 |
+
|
191 |
+
|
192 |
+
}
|
193 |
+
|
194 |
+
endif;
|
lib/skyverge/woocommerce/payment-gateway/apple-pay/api/class-sv-wc-payment-gateway-apple-pay-payment-response.php
ADDED
@@ -0,0 +1,205 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* WooCommerce Payment Gateway Framework
|
4 |
+
*
|
5 |
+
* This source file is subject to the GNU General Public License v3.0
|
6 |
+
* that is bundled with this package in the file license.txt.
|
7 |
+
* It is also available through the world-wide-web at this URL:
|
8 |
+
* http://www.gnu.org/licenses/gpl-3.0.html
|
9 |
+
* If you did not receive a copy of the license and are unable to
|
10 |
+
* obtain it through the world-wide-web, please send an email
|
11 |
+
* to license@skyverge.com so we can send you a copy immediately.
|
12 |
+
*
|
13 |
+
* DISCLAIMER
|
14 |
+
*
|
15 |
+
* Do not edit or add to this file if you wish to upgrade the plugin to newer
|
16 |
+
* versions in the future. If you wish to customize the plugin for your
|
17 |
+
* needs please refer to http://www.skyverge.com
|
18 |
+
*
|
19 |
+
* @package SkyVerge/WooCommerce/Payment-Gateway/Apple-Pay
|
20 |
+
* @author SkyVerge
|
21 |
+
* @copyright Copyright (c) 2013-2016, SkyVerge, Inc.
|
22 |
+
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
|
23 |
+
*/
|
24 |
+
|
25 |
+
namespace WC_Braintree\Plugin_Framework;
|
26 |
+
|
27 |
+
defined( 'ABSPATH' ) or exit;
|
28 |
+
|
29 |
+
if ( ! class_exists( '\\WC_Braintree\\Plugin_Framework\\SV_WC_Payment_Gateway_Apple_Pay_Payment_Response' ) ) :
|
30 |
+
|
31 |
+
/**
|
32 |
+
* The Apple Pay payment response object.
|
33 |
+
*
|
34 |
+
* @since 4.7.0
|
35 |
+
*/
|
36 |
+
class SV_WC_Payment_Gateway_Apple_Pay_Payment_Response extends SV_WC_API_JSON_Response {
|
37 |
+
|
38 |
+
|
39 |
+
/**
|
40 |
+
* Gets the authorized payment data.
|
41 |
+
*
|
42 |
+
* @since 4.7.0
|
43 |
+
*
|
44 |
+
* @return object
|
45 |
+
*/
|
46 |
+
public function get_payment_data() {
|
47 |
+
|
48 |
+
return ! empty( $this->token->paymentData ) ? (array) $this->token->paymentData : array();
|
49 |
+
}
|
50 |
+
|
51 |
+
|
52 |
+
/**
|
53 |
+
* Gets the authorization transaction ID.
|
54 |
+
*
|
55 |
+
* @since 4.7.0
|
56 |
+
*
|
57 |
+
* @return string
|
58 |
+
*/
|
59 |
+
public function get_transaction_id() {
|
60 |
+
|
61 |
+
return ! empty( $this->token->transactionIdentifier ) ? $this->token->transactionIdentifier : '';
|
62 |
+
}
|
63 |
+
|
64 |
+
|
65 |
+
/**
|
66 |
+
* Gets the authorized card type.
|
67 |
+
*
|
68 |
+
* @since 4.7.0
|
69 |
+
*
|
70 |
+
* @return string
|
71 |
+
*/
|
72 |
+
public function get_card_type() {
|
73 |
+
|
74 |
+
$card_type = ! empty( $this->token->paymentMethod->network ) ? $this->token->paymentMethod->network : 'card';
|
75 |
+
|
76 |
+
return SV_WC_Payment_Gateway_Helper::normalize_card_type( $card_type );
|
77 |
+
}
|
78 |
+
|
79 |
+
|
80 |
+
/**
|
81 |
+
* Gets the last four digits of the authorized card.
|
82 |
+
*
|
83 |
+
* @since 4.7.0
|
84 |
+
*
|
85 |
+
* @return string
|
86 |
+
*/
|
87 |
+
public function get_last_four() {
|
88 |
+
|
89 |
+
$last_four = '';
|
90 |
+
|
91 |
+
if ( ! empty( $this->token->paymentMethod->displayName ) ) {
|
92 |
+
$last_four = substr( $this->token->paymentMethod->displayName, -4 );
|
93 |
+
}
|
94 |
+
|
95 |
+
return $last_four;
|
96 |
+
}
|
97 |
+
|
98 |
+
|
99 |
+
/**
|
100 |
+
* Gets the billing address.
|
101 |
+
*
|
102 |
+
* @since 4.7.0
|
103 |
+
*
|
104 |
+
* @return array
|
105 |
+
*/
|
106 |
+
public function get_billing_address() {
|
107 |
+
|
108 |
+
$address = ! empty( $this->response_data->billingContact ) ? $this->response_data->billingContact : null;
|
109 |
+
|
110 |
+
$billing_address = $this->prepare_address( $address );
|
111 |
+
|
112 |
+
// set the billing email
|
113 |
+
if ( ! empty( $this->response_data->shippingContact->emailAddress ) ) {
|
114 |
+
$billing_address['email'] = $this->shippingContact->emailAddress;
|
115 |
+
}
|
116 |
+
|
117 |
+
// set the billing phone number
|
118 |
+
if ( ! empty( $this->response_data->shippingContact->phoneNumber ) ) {
|
119 |
+
$billing_address['phone'] = $this->shippingContact->phoneNumber;
|
120 |
+
}
|
121 |
+
|
122 |
+
return $billing_address;
|
123 |
+
}
|
124 |
+
|
125 |
+
|
126 |
+
/**
|
127 |
+
* Gets the shipping address.
|
128 |
+
*
|
129 |
+
* @since 4.7.0
|
130 |
+
*
|
131 |
+
* @return array
|
132 |
+
*/
|
133 |
+
public function get_shipping_address() {
|
134 |
+
|
135 |
+
$address = ! empty( $this->response_data->shippingContact ) ? $this->response_data->shippingContact : null;
|
136 |
+
|
137 |
+
$shipping_address = $this->prepare_address( $address );
|
138 |
+
|
139 |
+
return $shipping_address;
|
140 |
+
}
|
141 |
+
|
142 |
+
|
143 |
+
/**
|
144 |
+
* Prepare an address to WC formatting.
|
145 |
+
*
|
146 |
+
* @since 4.7.0
|
147 |
+
*
|
148 |
+
* @param object $contact the address to prepare
|
149 |
+
* @return array
|
150 |
+
*/
|
151 |
+
protected function prepare_address( $contact ) {
|
152 |
+
|
153 |
+
$address = array(
|
154 |
+
'first_name' => isset( $contact->givenName ) ? $contact->givenName : '',
|
155 |
+
'last_name' => isset( $contact->familyName ) ? $contact->familyName : '',
|
156 |
+
'address_1' => isset( $contact->addressLines[0] ) ? $contact->addressLines[0] : '',
|
157 |
+
'address_2' => '',
|
158 |
+
'city' => isset( $contact->locality ) ? $contact->locality : '',
|
159 |
+
'state' => isset( $contact->administrativeArea ) ? $contact->administrativeArea : '',
|
160 |
+
'postcode' => isset( $contact->postalCode ) ? $contact->postalCode : '',
|
161 |
+
'country' => isset( $contact->countryCode ) ? $contact->countryCode : '',
|
162 |
+
);
|
163 |
+
|
164 |
+
if ( ! empty( $contact->addressLines[1] ) ) {
|
165 |
+
$address['address_2'] = $contact->addressLines[1];
|
166 |
+
}
|
167 |
+
|
168 |
+
$address['country'] = strtoupper( $address['country'] );
|
169 |
+
|
170 |
+
return $address;
|
171 |
+
}
|
172 |
+
|
173 |
+
|
174 |
+
/**
|
175 |
+
* Get the string representation of this response with any and all sensitive
|
176 |
+
* elements masked or removed.
|
177 |
+
*
|
178 |
+
* No strong indication from the Apple documentation that these _need_ to be
|
179 |
+
* masked, but they don't provide any useful info and only make the debug
|
180 |
+
* logs unnecessarily huge.
|
181 |
+
*
|
182 |
+
* @since 4.7.0
|
183 |
+
*
|
184 |
+
* @see SV_WC_API_Response::to_string_safe()
|
185 |
+
* @return string
|
186 |
+
*/
|
187 |
+
public function to_string_safe() {
|
188 |
+
|
189 |
+
$string = $this->to_string();
|
190 |
+
|
191 |
+
if ( ! empty( $this->token->paymentData->data ) ) {
|
192 |
+
$string = str_replace( $this->token->paymentData->data, str_repeat( '*', 10 ), $string );
|
193 |
+
}
|
194 |
+
|
195 |
+
if ( ! empty( $this->token->paymentData->signature ) ) {
|
196 |
+
$string = str_replace( $this->token->paymentData->signature, str_repeat( '*', 10 ), $string );
|
197 |
+
}
|
198 |
+
|
199 |
+
return $string;
|
200 |
+
}
|
201 |
+
|
202 |
+
|
203 |
+
}
|
204 |
+
|
205 |
+
endif;
|
lib/skyverge/woocommerce/payment-gateway/apple-pay/class-sv-wc-payment-gateway-apple-pay-admin.php
ADDED
@@ -0,0 +1,415 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* WooCommerce Payment Gateway Framework
|
4 |
+
*
|
5 |
+
* This source file is subject to the GNU General Public License v3.0
|
6 |
+
* that is bundled with this package in the file license.txt.
|
7 |
+
* It is also available through the world-wide-web at this URL:
|
8 |
+
* http://www.gnu.org/licenses/gpl-3.0.html
|
9 |
+
* If you did not receive a copy of the license and are unable to
|
10 |
+
* obtain it through the world-wide-web, please send an email
|
11 |
+
* to license@skyverge.com so we can send you a copy immediately.
|
12 |
+
*
|
13 |
+
* DISCLAIMER
|
14 |
+
*
|
15 |
+
* Do not edit or add to this file if you wish to upgrade the plugin to newer
|
16 |
+
* versions in the future. If you wish to customize the plugin for your
|
17 |
+
* needs please refer to http://www.skyverge.com
|
18 |
+
*
|
19 |
+
* @package SkyVerge/WooCommerce/Payment-Gateway/Apple-Pay
|
20 |
+
* @author SkyVerge
|
21 |
+
* @copyright Copyright (c) 2013-2016, SkyVerge, Inc.
|
22 |
+
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
|
23 |
+
*/
|
24 |
+
|
25 |
+
namespace WC_Braintree\Plugin_Framework;
|
26 |
+
|
27 |
+
defined( 'ABSPATH' ) or exit;
|
28 |
+
|
29 |
+
if ( ! class_exists( '\\WC_Braintree\\Plugin_Framework\\SV_WC_Payment_Gateway_Apple_Pay_Admin' ) ) :
|
30 |
+
|
31 |
+
/**
|
32 |
+
* Sets up the Apple Pay settings screen.
|
33 |
+
*
|
34 |
+
* @since 4.7.0
|
35 |
+
*/
|
36 |
+
class SV_WC_Payment_Gateway_Apple_Pay_Admin {
|
37 |
+
|
38 |
+
|
39 |
+
/** @var SV_WC_Payment_Gateway_Apple_Pay the Apple Pay handler instance */
|
40 |
+
protected $handler;
|
41 |
+
|
42 |
+
|
43 |
+
/**
|
44 |
+
* Construct the class.
|
45 |
+
*
|
46 |
+
* @since 4.7.0
|
47 |
+
*/
|
48 |
+
public function __construct( $handler ) {
|
49 |
+
|
50 |
+
$this->handler = $handler;
|
51 |
+
|
52 |
+
// add Apple Pay to the checkout settings sections
|
53 |
+
add_filter( 'woocommerce_get_sections_checkout', array( $this, 'add_settings_section' ), 99 );
|
54 |
+
|
55 |
+
// output the settings
|
56 |
+
add_action( 'woocommerce_settings_checkout', array( $this, 'add_settings' ) );
|
57 |
+
|
58 |
+
// render the special "static" gateway select
|
59 |
+
add_action( 'woocommerce_admin_field_static', array( $this, 'render_static_setting' ) );
|
60 |
+
|
61 |
+
// save the settings
|
62 |
+
add_action( 'woocommerce_settings_save_checkout', array( $this, 'save_settings' ) );
|
63 |
+
|
64 |
+
// add admin notices for configuration options that need attention
|
65 |
+
add_action( 'admin_footer', array( $this, 'add_admin_notices' ), 10 );
|
66 |
+
}
|
67 |
+
|
68 |
+
|
69 |
+
/**
|
70 |
+
* Adds Apple Pay to the checkout settings sections.
|
71 |
+
*
|
72 |
+
* @internal
|
73 |
+
*
|
74 |
+
* @since 4.7.0
|
75 |
+
*
|
76 |
+
* @param array $sections the existing sections
|
77 |
+
* @return array
|
78 |
+
*/
|
79 |
+
public function add_settings_section( $sections ) {
|
80 |
+
|
81 |
+
$sections['apple-pay'] = __( 'Apple Pay', 'woocommerce-gateway-paypal-powered-by-braintree' );
|
82 |
+
|
83 |
+
return $sections;
|
84 |
+
}
|
85 |
+
|
86 |
+
|
87 |
+
/**
|
88 |
+
* Gets all of the combined settings.
|
89 |
+
*
|
90 |
+
* @since 4.7.0
|
91 |
+
*
|
92 |
+
* @return array $settings The combined settings.
|
93 |
+
*/
|
94 |
+
public function get_settings() {
|
95 |
+
|
96 |
+
$settings = array(
|
97 |
+
|
98 |
+
array(
|
99 |
+
'title' => __( 'Apple Pay', 'woocommerce-gateway-paypal-powered-by-braintree' ),
|
100 |
+
'type' => 'title',
|
101 |
+
),
|
102 |
+
|
103 |
+
array(
|
104 |
+
'id' => 'sv_wc_apple_pay_enabled',
|
105 |
+
'title' => __( 'Enable / Disable', 'woocommerce-gateway-paypal-powered-by-braintree' ),
|
106 |
+
'desc' => __( 'Accept Apple Pay', 'woocommerce-gateway-paypal-powered-by-braintree' ),
|
107 |
+
'type' => 'checkbox',
|
108 |
+
'default' => 'no',
|
109 |
+
),
|
110 |
+
|
111 |
+
array(
|
112 |
+
'id' => 'sv_wc_apple_pay_display_locations',
|
113 |
+
'title' => __( 'Allow Apple Pay on', 'woocommerce-gateway-paypal-powered-by-braintree' ),
|
114 |
+
'type' => 'multiselect',
|
115 |
+
'class' => 'wc-enhanced-select',
|
116 |
+
'css' => 'width: 350px;',
|
117 |
+
'options' => $this->get_display_location_options(),
|
118 |
+
'default' => array_keys( $this->get_display_location_options() ),
|
119 |
+
),
|
120 |
+
|
121 |
+
array(
|
122 |
+
'id' => 'sv_wc_apple_pay_button_style',
|
123 |
+
'title' => __( 'Button Style', 'woocommerce-gateway-paypal-powered-by-braintree' ),
|
124 |
+
'type' => 'select',
|
125 |
+
'options' => array(
|
126 |
+
'black' => __( 'Black', 'woocommerce-gateway-paypal-powered-by-braintree' ),
|
127 |
+
'white' => __( 'White', 'woocommerce-gateway-paypal-powered-by-braintree' ),
|
128 |
+
'white-with-line' => __( 'White with outline', 'woocommerce-gateway-paypal-powered-by-braintree' ),
|
129 |
+
),
|
130 |
+
'default' => 'black',
|
131 |
+
),
|
132 |
+
|
133 |
+
array(
|
134 |
+
'type' => 'sectionend',
|
135 |
+
),
|
136 |
+
);
|
137 |
+
|
138 |
+
$connection_settings = array(
|
139 |
+
array(
|
140 |
+
'title' => __( 'Connection Settings', 'woocommerce-gateway-paypal-powered-by-braintree' ),
|
141 |
+
'type' => 'title',
|
142 |
+
),
|
143 |
+
);
|
144 |
+
|
145 |
+
if ( $this->handler->requires_merchant_id() ) {
|
146 |
+
|
147 |
+
$connection_settings[] = array(
|
148 |
+
'id' => 'sv_wc_apple_pay_merchant_id',
|
149 |
+
'title' => __( 'Apple Merchant ID', 'woocommerce-gateway-paypal-powered-by-braintree' ),
|
150 |
+
'type' => 'text',
|
151 |
+
'desc' => sprintf(
|
152 |
+
/** translators: Placeholders: %1$s - <a> tag, %2$s - </a> tag */
|
153 |
+
__( 'This is found in your %1$sApple developer account%2$s', 'woocommerce-gateway-paypal-powered-by-braintree' ),
|
154 |
+
'<a href="https://developer.apple.com" target="_blank">', '</a>'
|
155 |
+
),
|
156 |
+
);
|
157 |
+
}
|
158 |
+
|
159 |
+
if ( $this->handler->requires_certificate() ) {
|
160 |
+
|
161 |
+
$connection_settings[] = array(
|
162 |
+
'id' => 'sv_wc_apple_pay_cert_path',
|
163 |
+
'title' => __( 'Certificate Path', 'woocommerce-gateway-paypal-powered-by-braintree' ),
|
164 |
+
'type' => 'text',
|
165 |
+
'desc_tip' => 'The full system path to your certificate file from Apple. For security reasons you should store this outside of your web root.',
|
166 |
+
'desc' => sprintf(
|
167 |
+
/* translators: Placeholders: %s - the server's web root path */
|
168 |
+
__( 'For reference, your current web root path is: %s', 'woocommerce-gateway-paypal-powered-by-braintree' ),
|
169 |
+
'<code>' . ABSPATH . '</code>'
|
170 |
+
),
|
171 |
+
);
|
172 |
+
}
|
173 |
+
|
174 |
+
$gateway_setting_id = 'sv_wc_apple_pay_payment_gateway';
|
175 |
+
$gateway_options = $this->get_gateway_options();
|
176 |
+
|
177 |
+
if ( 1 === count( $gateway_options ) ) {
|
178 |
+
|
179 |
+
$connection_settings[] = array(
|
180 |
+
'id' => $gateway_setting_id,
|
181 |
+
'title' => __( 'Processing Gateway', 'woocommerce-gateway-paypal-powered-by-braintree' ),
|
182 |
+
'type' => 'static',
|
183 |
+
'value' => key( $gateway_options ),
|
184 |
+
'label' => current( $gateway_options ),
|
185 |
+
);
|
186 |
+
|
187 |
+
} else {
|
188 |
+
|
189 |
+
$connection_settings[] = array(
|
190 |
+
'id' => $gateway_setting_id,
|
191 |
+
'title' => __( 'Processing Gateway', 'woocommerce-gateway-paypal-powered-by-braintree' ),
|
192 |
+
'type' => 'select',
|
193 |
+
'options' => $this->get_gateway_options(),
|
194 |
+
);
|
195 |
+
}
|
196 |
+
|
197 |
+
$connection_settings[] = array(
|
198 |
+
'id' => 'sv_wc_apple_pay_test_mode',
|
199 |
+
'title' => __( 'Test Mode', 'woocommerce-gateway-paypal-powered-by-braintree' ),
|
200 |
+
'desc' => __( 'Enable to test Apple Pay functionality throughout your sites without processing real payments.', 'woocommerce-gateway-paypal-powered-by-braintree' ),
|
201 |
+
'type' => 'checkbox',
|
202 |
+
'default' => 'no',
|
203 |
+
);
|
204 |
+
|
205 |
+
$connection_settings[] = array(
|
206 |
+
'type' => 'sectionend',
|
207 |
+
);
|
208 |
+
|
209 |
+
$settings = array_merge( $settings, $connection_settings );
|
210 |
+
|
211 |
+
/**
|
212 |
+
* Filter the combined settings.
|
213 |
+
*
|
214 |
+
* @since 1.0.0
|
215 |
+
* @param array $settings The combined settings.
|
216 |
+
*/
|
217 |
+
return apply_filters( 'woocommerce_get_settings_apple_pay', $settings );
|
218 |
+
}
|
219 |
+
|
220 |
+
|
221 |
+
/**
|
222 |
+
* Outputs the settings fields.
|
223 |
+
*
|
224 |
+
* @internal
|
225 |
+
*
|
226 |
+
* @since 4.7.0
|
227 |
+
*
|
228 |
+
* @return array
|
229 |
+
*/
|
230 |
+
public function add_settings() {
|
231 |
+
global $current_section;
|
232 |
+
|
233 |
+
if ( 'apple-pay' === $current_section ) {
|
234 |
+
\WC_Admin_Settings::output_fields( $this->get_settings() );
|
235 |
+
}
|
236 |
+
}
|
237 |
+
|
238 |
+
|
239 |
+
/**
|
240 |
+
* Saves the settings.
|
241 |
+
*
|
242 |
+
* @internal
|
243 |
+
*
|
244 |
+
* @since 4.7.0
|
245 |
+
*
|
246 |
+
* @global string $current_section The current settings section.
|
247 |
+
*/
|
248 |
+
public function save_settings() {
|
249 |
+
|
250 |
+
global $current_section;
|
251 |
+
|
252 |
+
// Output the general settings
|
253 |
+
if ( 'apple-pay' == $current_section ) {
|
254 |
+
|
255 |
+
\WC_Admin_Settings::save_fields( $this->get_settings() );
|
256 |
+
}
|
257 |
+
}
|
258 |
+
|
259 |
+
|
260 |
+
/**
|
261 |
+
* Renders a static setting.
|
262 |
+
*
|
263 |
+
* This "setting" just displays simple text instead of a <select> with only
|
264 |
+
* one option.
|
265 |
+
*
|
266 |
+
* @since 4.7.0
|
267 |
+
*
|
268 |
+
* @param array $setting
|
269 |
+
*/
|
270 |
+
public function render_static_setting( $setting ) {
|
271 |
+
|
272 |
+
?>
|
273 |
+
|
274 |
+
<tr valign="top">
|
275 |
+
<th scope="row" class="titledesc">
|
276 |
+
<label for="<?php echo esc_attr( $setting['id'] ); ?>"><?php echo esc_html( $setting['title'] ); ?></label>
|
277 |
+
</th>
|
278 |
+
<td class="forminp forminp-<?php echo sanitize_title( $setting['type'] ) ?>">
|
279 |
+
<?php echo esc_html( $setting['label'] ); ?>
|
280 |
+
<input
|
281 |
+
name="<?php echo esc_attr( $setting['id'] ); ?>"
|
282 |
+
id="<?php echo esc_attr( $setting['id'] ); ?>"
|
283 |
+
value="<?php echo esc_html( $setting['value'] ); ?>"
|
284 |
+
type="hidden"
|
285 |
+
>
|
286 |
+
</td>
|
287 |
+
</tr><?php
|
288 |
+
}
|
289 |
+
|
290 |
+
|
291 |
+
/**
|
292 |
+
* Adds admin notices for configuration options that need attention.
|
293 |
+
*
|
294 |
+
* @since 4.7.0
|
295 |
+
*/
|
296 |
+
public function add_admin_notices() {
|
297 |
+
|
298 |
+
// if the feature is not enabled, bail
|
299 |
+
if ( ! $this->handler->is_enabled() ) {
|
300 |
+
return;
|
301 |
+
}
|
302 |
+
|
303 |
+
// if not on the settings screen, bail
|
304 |
+
if ( ! $this->is_settings_screen() ) {
|
305 |
+
return;
|
306 |
+
}
|
307 |
+
|
308 |
+
$errors = array();
|
309 |
+
|
310 |
+
// HTTPS notice
|
311 |
+
if ( ! wc_site_is_https() ) {
|
312 |
+
$errors[] = __( 'Your site must be served over HTTPS with a valid SSL certificate.', 'woocommerce-gateway-paypal-powered-by-braintree' );
|
313 |
+
}
|
314 |
+
|
315 |
+
// Currency notice
|
316 |
+
if ( ! in_array( get_woocommerce_currency(), $this->handler->get_accepted_currencies(), true ) ) {
|
317 |
+
|
318 |
+
$accepted_currencies = $this->handler->get_accepted_currencies();
|
319 |
+
|
320 |
+
$errors[] = sprintf(
|
321 |
+
/* translators: Placeholders: %1$s - plugin name, %2$s - a currency/comma-separated list of currencies, %3$s - <a> tag, %4$s - </a> tag */
|
322 |
+
_n(
|
323 |
+
'Accepts payment in %1$s only. %2$sConfigure%3$s WooCommerce to accept %1$s to enable Apple Pay.',
|
324 |
+
'Accepts payment in one of %1$s only. %2$sConfigure%3$s WooCommerce to accept one of %1$s to enable Apple Pay.',
|
325 |
+
count( $accepted_currencies ),
|
326 |
+
'woocommerce-gateway-paypal-powered-by-braintree'
|
327 |
+
),
|
328 |
+
'<strong>' . implode( ', ', $accepted_currencies ) . '</strong>',
|
329 |
+
'<a href="' . esc_url( admin_url( 'admin.php?page=wc-settings&tab=general' ) ) . '">',
|
330 |
+
'</a>'
|
331 |
+
);
|
332 |
+
}
|
333 |
+
|
334 |
+
// bad cert config notice
|
335 |
+
// this first checks if the option has been set so the notice is not
|
336 |
+
// displayed without the user having the chance to set it.
|
337 |
+
if ( false !== $this->handler->get_cert_path() && ! $this->handler->is_cert_configured() ) {
|
338 |
+
|
339 |
+
$errors[] = sprintf(
|
340 |
+
/** translators: Placeholders: %1$s - <strong> tag, %2$s - </strong> tag */
|
341 |
+
__( 'Your %1$sMerchant Identity Certificate%2$s cannot be found. Please check your path configuration.', 'woocommerce-gateway-paypal-powered-by-braintree' ),
|
342 |
+
'<strong>', '</strong>'
|
343 |
+
);
|
344 |
+
}
|
345 |
+
|
346 |
+
if ( ! empty( $errors ) ) {
|
347 |
+
|
348 |
+
$message = '<strong>' . __( 'Apple Pay is disabled.', 'woocommerce-gateway-paypal-powered-by-braintree' ) . '</strong>';
|
349 |
+
|
350 |
+
if ( 1 === count( $errors ) ) {
|
351 |
+
$message .= ' ' . current( $errors );
|
352 |
+
} else {
|
353 |
+
$message .= '<ul><li>' . implode( '</li><li>', $errors ) . '</li></ul>';
|
354 |
+
}
|
355 |
+
|
356 |
+
$this->handler->get_plugin()->get_admin_notice_handler()->add_admin_notice( $message, 'apple-pay-https-required', array(
|
357 |
+
'notice_class' => 'error',
|
358 |
+
'dismissible' => false,
|
359 |
+
) );
|
360 |
+
}
|
361 |
+
}
|
362 |
+
|
363 |
+
|
364 |
+
/**
|
365 |
+
* Determines if the user is currently on the settings screen.
|
366 |
+
*
|
367 |
+
* @since 4.7.0
|
368 |
+
*
|
369 |
+
* @return bool
|
370 |
+
*/
|
371 |
+
protected function is_settings_screen() {
|
372 |
+
|
373 |
+
return 'wc-settings' === SV_WC_Helper::get_request( 'page' ) && 'apple-pay' === SV_WC_Helper::get_request( 'section' );
|
374 |
+
}
|
375 |
+
|
376 |
+
|
377 |
+
/**
|
378 |
+
* Gets the available display location options.
|
379 |
+
*
|
380 |
+
* @since 4.7.0
|
381 |
+
*
|
382 |
+
* @return array
|
383 |
+
*/
|
384 |
+
protected function get_display_location_options() {
|
385 |
+
|
386 |
+
return array(
|
387 |
+
'product' => __( 'Single products', 'woocommerce-gateway-paypal-powered-by-braintree' ),
|
388 |
+
'cart' => __( 'Cart', 'woocommerce-gateway-paypal-powered-by-braintree' ),
|
389 |
+
'checkout' => __( 'Checkout', 'woocommerce-gateway-paypal-powered-by-braintree' ),
|
390 |
+
);
|
391 |
+
}
|
392 |
+
|
393 |
+
|
394 |
+
/**
|
395 |
+
* Gets the available gateway options.
|
396 |
+
*
|
397 |
+
* @since 4.7.0
|
398 |
+
*
|
399 |
+
* @return array
|
400 |
+
*/
|
401 |
+
protected function get_gateway_options() {
|
402 |
+
|
403 |
+
$gateways = $this->handler->get_supporting_gateways();
|
404 |
+
|
405 |
+
foreach ( $gateways as $id => $gateway ) {
|
406 |
+
$gateways[ $id ] = $gateway->get_method_title();
|
407 |
+
}
|
408 |
+
|
409 |
+
return $gateways;
|
410 |
+
}
|
411 |
+
|
412 |
+
|
413 |
+
}
|
414 |
+
|
415 |
+
endif;
|
lib/skyverge/woocommerce/payment-gateway/apple-pay/class-sv-wc-payment-gateway-apple-pay-ajax.php
ADDED
@@ -0,0 +1,274 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* WooCommerce Payment Gateway Framework
|
4 |
+
*
|
5 |
+
* This source file is subject to the GNU General Public License v3.0
|
6 |
+
* that is bundled with this package in the file license.txt.
|
7 |
+
* It is also available through the world-wide-web at this URL:
|
8 |
+
* http://www.gnu.org/licenses/gpl-3.0.html
|
9 |
+
* If you did not receive a copy of the license and are unable to
|
10 |
+
* obtain it through the world-wide-web, please send an email
|
11 |
+
* to license@skyverge.com so we can send you a copy immediately.
|
12 |
+
*
|
13 |
+
* DISCLAIMER
|
14 |
+
*
|
15 |
+
* Do not edit or add to this file if you wish to upgrade the plugin to newer
|
16 |
+
* versions in the future. If you wish to customize the plugin for your
|
17 |
+
* needs please refer to http://www.skyverge.com
|
18 |
+
*
|
19 |
+
* @package SkyVerge/WooCommerce/Payment-Gateway/Apple-Pay
|
20 |
+
* @author SkyVerge
|
21 |
+
* @copyright Copyright (c) 2013-2016, SkyVerge, Inc.
|
22 |
+
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
|
23 |
+
*/
|
24 |
+
|
25 |
+
namespace WC_Braintree\Plugin_Framework;
|
26 |
+
|
27 |
+
defined( 'ABSPATH' ) or exit;
|
28 |
+
|
29 |
+
if ( ! class_exists( '\\WC_Braintree\\Plugin_Framework\\SV_WC_Payment_Gateway_Apple_Pay_AJAX' ) ) :
|
30 |
+
|
31 |
+
/**
|
32 |
+
* The Apple Pay AJAX handler.
|
33 |
+
*
|
34 |
+
* @since 4.7.0
|
35 |
+
*/
|
36 |
+
class SV_WC_Payment_Gateway_Apple_Pay_AJAX {
|
37 |
+
|
38 |
+
|
39 |
+
/** @var SV_WC_Payment_Gateway_Apple_Pay $handler the Apple Pay handler instance */
|
40 |
+
protected $handler;
|
41 |
+
|
42 |
+
|
43 |
+
/**
|
44 |
+
* Constructs the class.
|
45 |
+
*
|
46 |
+
* @since 4.7.0
|
47 |
+
*
|
48 |
+
* @param SV_WC_Payment_Gateway_Apple_Pay $handler the Apple Pay handler instance
|
49 |
+
*/
|
50 |
+
public function __construct( SV_WC_Payment_Gateway_Apple_Pay $handler ) {
|
51 |
+
|
52 |
+
$this->handler = $handler;
|
53 |
+
|
54 |
+
if ( $this->get_handler()->is_available() ) {
|
55 |
+
$this->add_hooks();
|
56 |
+
}
|
57 |
+
}
|
58 |
+
|
59 |
+
|
60 |
+
/**
|
61 |
+
* Adds the action & filter hooks.
|
62 |
+
*
|
63 |
+
* @since 5.3.0
|
64 |
+
*/
|
65 |
+
protected function add_hooks() {
|
66 |
+
|
67 |
+
$gateway_id = $this->get_handler()->get_processing_gateway()->get_id();
|
68 |
+
|
69 |
+
add_action( "wp_ajax_wc_{$gateway_id}_apple_pay_get_payment_request", array( $this, 'get_payment_request' ) );
|
70 |
+
add_action( "wp_ajax_nopriv_wc_{$gateway_id}_apple_pay_get_payment_request", array( $this, 'get_payment_request' ) );
|
71 |
+
|
72 |
+
// validate the merchant
|
73 |
+
add_action( "wp_ajax_wc_{$gateway_id}_apple_pay_validate_merchant", array( $this, 'validate_merchant' ) );
|
74 |
+
add_action( "wp_ajax_nopriv_wc_{$gateway_id}_apple_pay_validate_merchant", array( $this, 'validate_merchant' ) );
|
75 |
+
|
76 |
+
// recalculate the payment request totals
|
77 |
+
add_action( "wp_ajax_wc_{$gateway_id}_apple_pay_recalculate_totals", array( $this, 'recalculate_totals' ) );
|
78 |
+
add_action( "wp_ajax_nopriv_wc_{$gateway_id}_apple_pay_recalculate_totals", array( $this, 'recalculate_totals' ) );
|
79 |
+
|
80 |
+
// process the payment
|
81 |
+
add_action( "wp_ajax_wc_{$gateway_id}_apple_pay_process_payment", array( $this, 'process_payment' ) );
|
82 |
+
add_action( "wp_ajax_nopriv_wc_{$gateway_id}_apple_pay_process_payment", array( $this, 'process_payment' ) );
|
83 |
+
}
|
84 |
+
|
85 |
+
|
86 |
+
/**
|
87 |
+
* Gets a payment request.
|
88 |
+
*
|
89 |
+
* @internal
|
90 |
+
*
|
91 |
+
* @since 4.7.0
|
92 |
+
*/
|
93 |
+
public function get_payment_request() {
|
94 |
+
|
95 |
+
$this->get_handler()->log( 'Getting payment request' );
|
96 |
+
|
97 |
+
try {
|
98 |
+
|
99 |
+
$request = $this->get_handler()->get_cart_payment_request( WC()->cart );
|
100 |
+
|
101 |
+
$this->get_handler()->log( "Payment Request:\n" . print_r( $request, true ) );
|
102 |
+
|
103 |
+
wp_send_json_success( json_encode( $request ) );
|
104 |
+
|
105 |
+
} catch ( SV_WC_Payment_Gateway_Exception $e ) {
|
106 |
+
|
107 |
+
$this->get_handler()->log( 'Could not build payment request. ' . $e->getMessage() );
|
108 |
+
|
109 |
+
wp_send_json_error( array(
|
110 |
+
'message' => $e->getMessage(),
|
111 |
+
'code' => $e->getCode(),
|
112 |
+
) );
|
113 |
+
}
|
114 |
+
}
|
115 |
+
|
116 |
+
|
117 |
+
/**
|
118 |
+
* Validates the merchant.
|
119 |
+
*
|
120 |
+
* @internal
|
121 |
+
*
|
122 |
+
* @since 4.7.0
|
123 |
+
*/
|
124 |
+
public function validate_merchant() {
|
125 |
+
|
126 |
+
$this->get_handler()->log( 'Validating merchant' );
|
127 |
+
|
128 |
+
check_ajax_referer( 'wc_' . $this->get_handler()->get_processing_gateway()->get_id() . '_apple_pay_validate_merchant', 'nonce' );
|
129 |
+
|
130 |
+
$merchant_id = SV_WC_Helper::get_post( 'merchant_id' );
|
131 |
+
$url = SV_WC_Helper::get_post( 'url' );
|
132 |
+
|
133 |
+
try {
|
134 |
+
|
135 |
+
$response = $this->get_handler()->get_api()->validate_merchant( $url, $merchant_id, home_url(), get_bloginfo( 'name' ) );
|
136 |
+
|
137 |
+
wp_send_json_success( $response->get_merchant_session() );
|
138 |
+
|
139 |
+
} catch ( SV_WC_Plugin_Exception $e ) {
|
140 |
+
|
141 |
+
$this->get_handler()->log( 'Could not validate merchant. ' . $e->getMessage() );
|
142 |
+
|
143 |
+
wp_send_json_error( array(
|
144 |
+
'message' => $e->getMessage(),
|
145 |
+
'code' => $e->getCode(),
|
146 |
+
) );
|
147 |
+
}
|
148 |
+
}
|
149 |
+
|
150 |
+
|
151 |
+
/**
|
152 |
+
* Recalculates the totals for the current payment request.
|
153 |
+
*
|
154 |
+
* @internal
|
155 |
+
*
|
156 |
+
* @since 4.7.0
|
157 |
+
*/
|
158 |
+
public function recalculate_totals() {
|
159 |
+
|
160 |
+
$this->get_handler()->log( 'Recalculating totals' );
|
161 |
+
|
162 |
+
check_ajax_referer( 'wc_' . $this->get_handler()->get_processing_gateway()->get_id() . '_apple_pay_recalculate_totals', 'nonce' );
|
163 |
+
|
164 |
+
try {
|
165 |
+
|
166 |
+
// if a contact is passed, set the customer address data
|
167 |
+
if ( isset( $_REQUEST['contact'] ) && is_array( $_REQUEST['contact'] ) ) {
|
168 |
+
|
169 |
+
$contact = wp_parse_args( $_REQUEST['contact'], array(
|
170 |
+
'administrativeArea' => null,
|
171 |
+
'countryCode' => null,
|
172 |
+
'locality' => null,
|
173 |
+
'postalCode' => null,
|
174 |
+
) );
|
175 |
+
|
176 |
+
$state = $contact['administrativeArea'];
|
177 |
+
$country = strtoupper( $contact['countryCode'] );
|
178 |
+
$city = $contact['locality'];
|
179 |
+
$postcode = $contact['postalCode'];
|
180 |
+
|
181 |
+
WC()->customer->set_shipping_city( $city );
|
182 |
+
WC()->customer->set_shipping_state( $state );
|
183 |
+
WC()->customer->set_shipping_country( $country );
|
184 |
+
WC()->customer->set_shipping_postcode( $postcode );
|
185 |
+
|
186 |
+
if ( $country ) {
|
187 |
+
|
188 |
+
if ( SV_WC_Plugin_Compatibility::is_wc_version_gte_3_0() ) {
|
189 |
+
WC()->customer->set_calculated_shipping( true );
|
190 |
+
} else {
|
191 |
+
WC()->customer->calculated_shipping( true );
|
192 |
+
}
|
193 |
+
}
|
194 |
+
}
|
195 |
+
|
196 |
+
$chosen_shipping_methods = ( $method = SV_WC_Helper::get_request( 'method' ) ) ? array( wc_clean( $method ) ) : array();
|
197 |
+
|
198 |
+
WC()->session->set( 'chosen_shipping_methods', $chosen_shipping_methods );
|
199 |
+
|
200 |
+
$payment_request = $this->get_handler()->recalculate_totals();
|
201 |
+
|
202 |
+
$data = array(
|
203 |
+
'shipping_methods' => $payment_request['shippingMethods'],
|
204 |
+
'line_items' => array_values( $payment_request['lineItems'] ),
|
205 |
+
'total' => $payment_request['total'],
|
206 |
+
);
|
207 |
+
|
208 |
+
$this->get_handler()->log( "New totals:\n" . print_r( $data, true ) );
|
209 |
+
|
210 |
+
wp_send_json_success( $data );
|
211 |
+
|
212 |
+
} catch ( SV_WC_Payment_Gateway_Exception $e ) {
|
213 |
+
|
214 |
+
$this->get_handler()->log( $e->getMessage() );
|
215 |
+
|
216 |
+
wp_send_json_error( array(
|
217 |
+
'message' => $e->getMessage(),
|
218 |
+
'code' => $e->getCode(),
|
219 |
+
) );
|
220 |
+
}
|
221 |
+
}
|
222 |
+
|
223 |
+
|
224 |
+
/**
|
225 |
+
* Processes the payment after the Apple Pay authorization.
|
226 |
+
*
|
227 |
+
* @internal
|
228 |
+
*
|
229 |
+
* @since 4.7.0
|
230 |
+
*/
|
231 |
+
public function process_payment() {
|
232 |
+
|
233 |
+
$this->get_handler()->log( 'Processing payment' );
|
234 |
+
|
235 |
+
check_ajax_referer( 'wc_' . $this->get_handler()->get_processing_gateway()->get_id() . '_apple_pay_process_payment', 'nonce' );
|
236 |
+
|
237 |
+
$response = stripslashes( SV_WC_Helper::get_post( 'payment' ) );
|
238 |
+
|
239 |
+
$this->get_handler()->store_payment_response( $response );
|
240 |
+
|
241 |
+
try {
|
242 |
+
|
243 |
+
$result = $this->get_handler()->process_payment();
|
244 |
+
|
245 |
+
wp_send_json_success( $result );
|
246 |
+
|
247 |
+
} catch ( \Exception $e ) {
|
248 |
+
|
249 |
+
$this->get_handler()->log( 'Payment failed. ' . $e->getMessage() );
|
250 |
+
|
251 |
+
wp_send_json_error( array(
|
252 |
+
'message' => $e->getMessage(),
|
253 |
+
'code' => $e->getCode(),
|
254 |
+
) );
|
255 |
+
}
|
256 |
+
}
|
257 |
+
|
258 |
+
|
259 |
+
/**
|
260 |
+
* Gets the Apple Pay handler instance.
|
261 |
+
*
|
262 |
+
* @since 4.7.0
|
263 |
+
*
|
264 |
+
* @return SV_WC_Payment_Gateway_Apple_Pay
|
265 |
+
*/
|
266 |
+
protected function get_handler() {
|
267 |
+
|
268 |
+
return $this->handler;
|
269 |
+
}
|
270 |
+
|
271 |
+
|
272 |
+
}
|
273 |
+
|
274 |
+
endif;
|
lib/skyverge/woocommerce/payment-gateway/apple-pay/class-sv-wc-payment-gateway-apple-pay-frontend.php
ADDED
@@ -0,0 +1,486 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* WooCommerce Payment Gateway Framework
|
4 |
+
*
|
5 |
+
* This source file is subject to the GNU General Public License v3.0
|
6 |
+
* that is bundled with this package in the file license.txt.
|
7 |
+
* It is also available through the world-wide-web at this URL:
|
8 |
+
* http://www.gnu.org/licenses/gpl-3.0.html
|
9 |
+
* If you did not receive a copy of the license and are unable to
|
10 |
+
* obtain it through the world-wide-web, please send an email
|
11 |
+
* to license@skyverge.com so we can send you a copy immediately.
|
12 |
+
*
|
13 |
+
* DISCLAIMER
|
14 |
+
*
|
15 |
+
* Do not edit or add to this file if you wish to upgrade the plugin to newer
|
16 |
+
* versions in the future. If you wish to customize the plugin for your
|
17 |
+
* needs please refer to http://www.skyverge.com
|
18 |
+
*
|
19 |
+
* @package SkyVerge/WooCommerce/Payment-Gateway/Apple-Pay
|
20 |
+
* @author SkyVerge
|
21 |
+
* @copyright Copyright (c) 2013-2016, SkyVerge, Inc.
|
22 |
+
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
|
23 |
+
*/
|
24 |
+
|
25 |
+
namespace WC_Braintree\Plugin_Framework;
|
26 |
+
|
27 |
+
defined( 'ABSPATH' ) or exit;
|
28 |
+
|
29 |
+
if ( ! class_exists( '\\WC_Braintree\\Plugin_Framework\\SV_WC_Payment_Gateway_Apple_Pay_Frontend' ) ) :
|
30 |
+
|
31 |
+
/**
|
32 |
+
* Sets up the Apple Pay front-end functionality.
|
33 |
+
*
|
34 |
+
* @since 4.7.0
|
35 |
+
*/
|
36 |
+
class SV_WC_Payment_Gateway_Apple_Pay_Frontend {
|
37 |
+
|
38 |
+
|
39 |
+
/** @var SV_WC_Payment_Gateway_Plugin $plugin the gateway plugin instance */
|
40 |
+
protected $plugin;
|
41 |
+
|
42 |
+
/** @var SV_WC_Payment_Gateway_Apple_Pay $handler the Apple Pay handler instance */
|
43 |
+
protected $handler;
|
44 |
+
|
45 |
+
/** @var SV_WC_Payment_Gateway $gateway the gateway instance */
|
46 |
+
protected $gateway;
|
47 |
+
|
48 |
+
|
49 |
+
/**
|
50 |
+
* Constructs the class.
|
51 |
+
*
|
52 |
+
* @since 4.7.0
|
53 |
+
*
|
54 |
+
* @param SV_WC_Payment_Gateway_Plugin $plugin the gateway plugin instance
|
55 |
+
* @param SV_WC_Payment_Gateway_Apple_Pay $handler the Apple Pay handler instance
|
56 |
+
*/
|
57 |
+
public function __construct( SV_WC_Payment_Gateway_Plugin $plugin, SV_WC_Payment_Gateway_Apple_Pay $handler ) {
|
58 |
+
|
59 |
+
$this->plugin = $plugin;
|
60 |
+
|
61 |
+
$this->handler = $handler;
|
62 |
+
|
63 |
+
$this->gateway = $this->get_handler()->get_processing_gateway();
|
64 |
+
|
65 |
+
if ( $this->get_handler()->is_available() ) {
|
66 |
+
|
67 |
+
add_action( 'wp', array( $this, 'init' ) );
|
68 |
+
|
69 |
+
add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
|
70 |
+
}
|
71 |
+
}
|
72 |
+
|
73 |
+
|
74 |
+
/**
|
75 |
+
* Initializes the scripts and hooks.
|
76 |
+
*
|
77 |
+
* @since 4.7.0
|
78 |
+
*/
|
79 |
+
public function init() {
|
80 |
+
|
81 |
+
$locations = $this->get_display_locations();
|
82 |
+
|
83 |
+
if ( is_product() && in_array( 'product', $locations, true ) ) {
|
84 |
+
$this->init_product();
|
85 |
+
} else if ( is_cart() && in_array( 'cart', $locations, true ) ) {
|
86 |
+
$this->init_cart();
|
87 |
+
} else if ( is_checkout() && in_array( 'checkout', $locations, true ) ) {
|
88 |
+
$this->init_checkout();
|
89 |
+
}
|
90 |
+
}
|
91 |
+
|
92 |
+
|
93 |
+
/**
|
94 |
+
* Gets the configured display locations.
|
95 |
+
*
|
96 |
+
* @since 4.7.0
|
97 |
+
*
|
98 |
+
* @return array
|
99 |
+
*/
|
100 |
+
protected function get_display_locations() {
|
101 |
+
|
102 |
+
return get_option( 'sv_wc_apple_pay_display_locations', array() );
|
103 |
+
}
|
104 |
+
|
105 |
+
|
106 |
+
/**
|
107 |
+
* Enqueues the scripts.
|
108 |
+
*
|
109 |
+
* @since 4.7.0
|
110 |
+
*/
|
111 |
+
public function enqueue_scripts() {
|
112 |
+
|
113 |
+
wp_enqueue_style( 'sv-wc-apple-pay', $this->get_plugin()->get_payment_gateway_framework_assets_url() . '/css/frontend/sv-wc-payment-gateway-apple-pay.css', array(), $this->get_plugin()->get_version() ); // TODO: min
|
114 |
+
|
115 |
+
wp_enqueue_script( 'sv-wc-apple-pay', $this->get_plugin()->get_payment_gateway_framework_assets_url() . '/js/frontend/sv-wc-payment-gateway-apple-pay.min.js', array( 'jquery' ), $this->get_plugin()->get_version(), true );
|
116 |
+
}
|
117 |
+
|
118 |
+
|
119 |
+
/**
|
120 |
+
* Gets the general JS handler params.
|
121 |
+
*
|
122 |
+
* @since 5.3.0
|
123 |
+
*
|
124 |
+
* @return array
|
125 |
+
*/
|
126 |
+
protected function get_js_handler_params() {
|
127 |
+
|
128 |
+
/**
|
129 |
+
* Filters the Apple Pay JS handler params.
|
130 |
+
*
|
131 |
+
* @since 4.7.0
|
132 |
+
*
|
133 |
+
* @param array $params the JS params
|
134 |
+
*/
|
135 |
+
return (array) apply_filters( 'wc_' . $this->get_gateway()->get_id() . '_apple_pay_js_handler_params', array(
|
136 |
+
'gateway_id' => $this->get_gateway()->get_id(),
|
137 |
+
'gateway_id_dasherized' => $this->get_gateway()->get_id_dasherized(),
|
138 |
+
'merchant_id' => $this->get_handler()->get_merchant_id(),
|
139 |
+
'ajax_url' => admin_url( 'admin-ajax.php' ),
|
140 |
+
'validate_nonce' => wp_create_nonce( 'wc_' . $this->get_gateway()->get_id() . '_apple_pay_validate_merchant' ),
|
141 |
+
'recalculate_totals_nonce' => wp_create_nonce( 'wc_' . $this->get_gateway()->get_id() . '_apple_pay_recalculate_totals' ),
|
142 |
+
'process_nonce' => wp_create_nonce( 'wc_' . $this->get_gateway()->get_id() . '_apple_pay_process_payment' ),
|
143 |
+
'generic_error' => __( 'An error occurred, please try again or try an alternate form of payment', 'woocommerce-gateway-paypal-powered-by-braintree' ),
|
144 |
+
) );
|
145 |
+
}
|
146 |
+
|
147 |
+
|
148 |
+
/**
|
149 |
+
* Enqueues an Apple Pay JS handler.
|
150 |
+
*
|
151 |
+
* @since 5.3.0
|
152 |
+
*
|
153 |
+
* @param array $args handler arguments
|
154 |
+
* @param string $object_name JS object name
|
155 |
+
* @param string $handler_name handler class name
|
156 |
+
*/
|
157 |
+
protected function enqueue_js_handler( array $args, $object_name = '', $handler_name = '' ) {
|
158 |
+
|
159 |
+
if ( ! $object_name ) {
|
160 |
+
$object_name = 'wc_' . $this->get_gateway()->get_id() . '_apple_pay_handler';
|
161 |
+
}
|
162 |
+
|
163 |
+
if ( ! $handler_name ) {
|
164 |
+
$handler_name = $this->get_js_handler_name();
|
165 |
+
}
|
166 |
+
|
167 |
+
$args = array_merge( $args, $this->get_js_handler_params() );
|
168 |
+
|
169 |
+
wc_enqueue_js(
|
170 |
+
sprintf(
|
171 |
+
'window.%1$s = new %2$s(%3$s); window.%1$s.init()',
|
172 |
+
esc_attr( $object_name ),
|
173 |
+
esc_attr( $handler_name ),
|
174 |
+
json_encode( $args )
|
175 |
+
)
|
176 |
+
);
|
177 |
+
}
|
178 |
+
|
179 |
+
|
180 |
+
/**
|
181 |
+
* Gets the JS handler class name.
|
182 |
+
*
|
183 |
+
* Concrete implementations can override this with their own handler.
|
184 |
+
*
|
185 |
+
* @since 5.3.0
|
186 |
+
*
|
187 |
+
* @return string
|
188 |
+
*/
|
189 |
+
protected function get_js_handler_name() {
|
190 |
+
|
191 |
+
return 'SV_WC_Apple_Pay_Handler';
|
192 |
+
}
|
193 |
+
|
194 |
+
|
195 |
+
/**
|
196 |
+
* Renders an Apple Pay button.
|
197 |
+
*
|
198 |
+
* @since 4.7.0
|
199 |
+
*/
|
200 |
+
public function render_button() {
|
201 |
+
|
202 |
+
$button_text = '';
|
203 |
+
$classes = array(
|
204 |
+
'sv-wc-apple-pay-button',
|
205 |
+
);
|
206 |
+
|
207 |
+
switch ( $this->get_handler()->get_button_style() ) {
|
208 |
+
|
209 |
+
case 'black':
|
210 |
+
$classes[] = 'apple-pay-button-black';
|
211 |
+
break;
|
212 |
+
|
213 |
+
case 'white':
|
214 |
+
$classes[] = 'apple-pay-button-white';
|
215 |
+
break;
|
216 |
+
|
217 |
+
case 'white-with-line':
|
218 |
+
$classes[] = 'apple-pay-button-white-with-line';
|
219 |
+
break;
|
220 |
+
}
|
221 |
+
|
222 |
+
// if on the single product page, add some text
|
223 |
+
if ( is_product() ) {
|
224 |
+
$classes[] = 'apple-pay-button-buy-now';
|
225 |
+
$button_text = __( 'Buy with', 'woocommerce-gateway-paypal-powered-by-braintree' );
|
226 |
+
}
|
227 |
+
|
228 |
+
if ( $button_text ) {
|
229 |
+
$classes[] = 'apple-pay-button-with-text';
|
230 |
+
}
|
231 |
+
|
232 |
+
echo '<button class="' . implode( ' ', array_map( 'sanitize_html_class', $classes ) ) . '" lang="' . esc_attr( substr( get_locale(), 0, 2 ) ) . '">';
|
233 |
+
|
234 |
+
if ( $button_text ) {
|
235 |
+
echo '<span class="text">' . esc_html( $button_text ) . '</span><span class="logo"></span>';
|
236 |
+
}
|
237 |
+
|
238 |
+
echo '</button>';
|
239 |
+
}
|
240 |
+
|
241 |
+
|
242 |
+
/**
|
243 |
+
* Initializes Apple Pay on the single product page.
|
244 |
+
*
|
245 |
+
* @since 4.7.0
|
246 |
+
*/
|
247 |
+
public function init_product() {
|
248 |
+
|
249 |
+
$product = wc_get_product( get_the_ID() );
|
250 |
+
|
251 |
+
if ( ! $product ) {
|
252 |
+
return;
|
253 |
+
}
|
254 |
+
|
255 |
+
$this->enqueue_js_handler( $this->get_product_js_handler_args( $product ) );
|
256 |
+
|
257 |
+
add_action( 'woocommerce_before_add_to_cart_button', array( $this, 'render_button' ) );
|
258 |
+
}
|
259 |
+
|
260 |
+
|
261 |
+
/**
|
262 |
+
* Gets the args passed to the product JS handler.
|
263 |
+
*
|
264 |
+
* @since 5.3.0
|
265 |
+
*
|
266 |
+
* @param \WC_Product $product product object
|
267 |
+
* @return array
|
268 |
+
*/
|
269 |
+
protected function get_product_js_handler_args( \WC_Product $product ) {
|
270 |
+
|
271 |
+
$args = array();
|
272 |
+
|
273 |
+
try {
|
274 |
+
|
275 |
+
$payment_request = $this->get_handler()->get_product_payment_request( $product );
|
276 |
+
|
277 |
+
$args['payment_request'] = $payment_request;
|
278 |
+
|
279 |
+
} catch ( SV_WC_Payment_Gateway_Exception $e ) {
|
280 |
+
|
281 |
+
$this->get_handler()->log( 'Could not initialize Apple Pay. ' . $e->getMessage() );
|
282 |
+
}
|
283 |
+
|
284 |
+
/**
|
285 |
+
* Filters the Apple Pay product handler args.
|
286 |
+
*
|
287 |
+
* @since 4.7.0
|
288 |
+
* @deprecated 5.3.0
|
289 |
+
*
|
290 |
+
* @param array $args JS handler arguments
|
291 |
+
*/
|
292 |
+
$args = (array) apply_filters( 'sv_wc_apple_pay_product_handler_args', $args );
|
293 |
+
|
294 |
+
/**
|
295 |
+
* Filters the gateway Apple Pay cart handler args.
|
296 |
+
*
|
297 |
+
* @since 5.3.0
|
298 |
+
*
|
299 |
+
* @param array $args JS handler arguments
|
300 |
+
* @param \WC_Product $product product object
|
301 |
+
*/
|
302 |
+
return (array) apply_filters( 'wc_' . $this->get_gateway()->get_id() . '_apple_pay_product_js_handler_args', $args, $product );
|
303 |
+
}
|
304 |
+
|
305 |
+
|
306 |
+
/** Cart functionality ****************************************************/
|
307 |
+
|
308 |
+
|
309 |
+
/**
|
310 |
+
* Initializes Apple Pay on the cart page.
|
311 |
+
*
|
312 |
+
* @since 4.7.0
|
313 |
+
*/
|
314 |
+
public function init_cart() {
|
315 |
+
|
316 |
+
// bail if the cart is missing or empty
|
317 |
+
if ( ! WC()->cart || WC()->cart->is_empty() ) {
|
318 |
+
return;
|
319 |
+
}
|
320 |
+
|
321 |
+
$this->enqueue_js_handler( $this->get_cart_js_handler_args( WC()->cart ) );
|
322 |
+
|
323 |
+
add_action( 'woocommerce_proceed_to_checkout', array( $this, 'render_button' ) );
|
324 |
+
}
|
325 |
+
|
326 |
+
|
327 |
+
/**
|
328 |
+
* Gets the args passed to the cart JS handler.
|
329 |
+
*
|
330 |
+
* @since 5.3.0
|
331 |
+
*
|
332 |
+
* @param \WC_Cart $cart cart object
|
333 |
+
* @return array
|
334 |
+
*/
|
335 |
+
protected function get_cart_js_handler_args( \WC_Cart $cart ) {
|
336 |
+
|
337 |
+
$args = array();
|
338 |
+
|
339 |
+
try {
|
340 |
+
|
341 |
+
$payment_request = $this->get_handler()->get_cart_payment_request( $cart );
|
342 |
+
|
343 |
+
$args['payment_request'] = $payment_request;
|
344 |
+
|
345 |
+
} catch ( SV_WC_Payment_Gateway_Exception $e ) {
|
346 |
+
|
347 |
+
$args['payment_request'] = false;
|
348 |
+
}
|
349 |
+
|
350 |
+
/**
|
351 |
+
* Filters the Apple Pay cart handler args.
|
352 |
+
*
|
353 |
+
* @since 4.7.0
|
354 |
+
* @deprecated 5.3.0
|
355 |
+
*
|
356 |
+
* @param array $args JS handler arguments
|
357 |
+
*/
|
358 |
+
$args = (array) apply_filters( 'sv_wc_apple_pay_cart_handler_args', $args );
|
359 |
+
|
360 |
+
/**
|
361 |
+
* Filters the gateway Apple Pay cart handler args.
|
362 |
+
*
|
363 |
+
* @since 5.3.0
|
364 |
+
*
|
365 |
+
* @param array $args JS handler arguments
|
366 |
+
* @param \WC_Cart $cart cart object
|
367 |
+
*/
|
368 |
+
return (array) apply_filters( 'wc_' . $this->get_gateway()->get_id() . '_apple_pay_cart_js_handler_args', $args, $cart );
|
369 |
+
}
|
370 |
+
|
371 |
+
|
372 |
+
/** Checkout functionality ************************************************/
|
373 |
+
|
374 |
+
|
375 |
+
/**
|
376 |
+
* Initializes Apple Pay on the checkout page.
|
377 |
+
*
|
378 |
+
* @since 4.7.0
|
379 |
+
*/
|
380 |
+
public function init_checkout() {
|
381 |
+
|
382 |
+
$this->enqueue_js_handler( $this->get_checkout_js_handler_args() );
|
383 |
+
|
384 |
+
if ( $this->get_plugin()->is_plugin_active( 'woocommerce-checkout-add-ons.php' ) ) {
|
385 |
+
add_action( 'woocommerce_review_order_before_payment', array( $this, 'render_button' ) );
|
386 |
+
} else {
|
387 |
+
add_action( 'woocommerce_before_checkout_form', array( $this, 'render_checkout_button' ), 15 );
|
388 |
+
}
|
389 |
+
}
|
390 |
+
|
391 |
+
|
392 |
+
/**
|
393 |
+
* Gets the args passed to the checkout JS handler.
|
394 |
+
*
|
395 |
+
* @since 5.3.0
|
396 |
+
*
|
397 |
+
* @return array
|
398 |
+
*/
|
399 |
+
protected function get_checkout_js_handler_args() {
|
400 |
+
|
401 |
+
/**
|
402 |
+
* Filters the Apple Pay checkout handler args.
|
403 |
+
*
|
404 |
+
* @since 4.7.0
|
405 |
+
* @deprecated 5.3.0
|
406 |
+
*
|
407 |
+
* @param array $args JS handler arguments
|
408 |
+
*/
|
409 |
+
$args = (array) apply_filters( 'sv_wc_apple_pay_checkout_handler_args', array() );
|
410 |
+
|
411 |
+
/**
|
412 |
+
* Filters the gateway Apple Pay checkout handler args.
|
413 |
+
*
|
414 |
+
* @since 5.3.0
|
415 |
+
*
|
416 |
+
* @param array $args JS handler arguments
|
417 |
+
*/
|
418 |
+
return (array) apply_filters( 'wc_' . $this->get_gateway()->get_id() . '_apple_pay_checkout_js_handler_args', $args );
|
419 |
+
}
|
420 |
+
|
421 |
+
|
422 |
+
/**
|
423 |
+
* Renders the Apple Pay button for checkout.
|
424 |
+
*
|
425 |
+
* @since 4.7.0
|
426 |
+
*/
|
427 |
+
public function render_checkout_button() {
|
428 |
+
|
429 |
+
?>
|
430 |
+
|
431 |
+
<div class="sv-wc-apply-pay-checkout">
|
432 |
+
|
433 |
+
<?php $this->render_button(); ?>
|
434 |
+
|
435 |
+
<span class="divider">
|
436 |
+
<?php /** translators: "or" as in "Pay with Apple Pay [or] regular checkout" */
|
437 |
+
esc_html_e( 'or', 'woocommerce-gateway-paypal-powered-by-braintree' ); ?>
|
438 |
+
</span>
|
439 |
+
|
440 |
+
</div>
|
441 |
+
|
442 |
+
<?php
|
443 |
+
}
|
444 |
+
|
445 |
+
|
446 |
+
/**
|
447 |
+
* Gets the gateway instance.
|
448 |
+
*
|
449 |
+
* @since 4.7.0
|
450 |
+
*
|
451 |
+
* @return SV_WC_Payment_Gateway
|
452 |
+
*/
|
453 |
+
protected function get_gateway() {
|
454 |
+
|
455 |
+
return $this->gateway;
|
456 |
+
}
|
457 |
+
|
458 |
+
|
459 |
+
/**
|
460 |
+
* Gets the gateway plugin instance.
|
461 |
+
*
|
462 |
+
* @since 4.7.0
|
463 |
+
*
|
464 |
+
* @return SV_WC_Payment_Gateway_Plugin
|
465 |
+
*/
|
466 |
+
protected function get_plugin() {
|
467 |
+
|
468 |
+
return $this->plugin;
|
469 |
+
}
|
470 |
+
|
471 |
+
/**
|
472 |
+
* Gets the Apple Pay handler instance.
|
473 |
+
*
|
474 |
+
* @since 4.7.0
|
475 |
+
*
|
476 |
+
* @return SV_WC_Payment_Gateway_Apple_Pay
|
477 |
+
*/
|
478 |
+
protected function get_handler() {
|
479 |
+
|
480 |
+
return $this->handler;
|
481 |
+
}
|
482 |
+
|
483 |
+
|
484 |
+
}
|
485 |
+
|
486 |
+
endif;
|
lib/skyverge/woocommerce/payment-gateway/apple-pay/class-sv-wc-payment-gateway-apple-pay-orders.php
ADDED
@@ -0,0 +1,196 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* WooCommerce Payment Gateway Framework
|
4 |
+
*
|
5 |
+
* This source file is subject to the GNU General Public License v3.0
|
6 |
+
* that is bundled with this package in the file license.txt.
|
7 |
+
* It is also available through the world-wide-web at this URL:
|
8 |
+
* http://www.gnu.org/licenses/gpl-3.0.html
|
9 |
+
* If you did not receive a copy of the license and are unable to
|
10 |
+
* obtain it through the world-wide-web, please send an email
|
11 |
+
* to license@skyverge.com so we can send you a copy immediately.
|
12 |
+
*
|
13 |
+
* DISCLAIMER
|
14 |
+
*
|
15 |
+
* Do not edit or add to this file if you wish to upgrade the plugin to newer
|
16 |
+
* versions in the future. If you wish to customize the plugin for your
|
17 |
+
* needs please refer to http://www.skyverge.com
|
18 |
+
*
|
19 |
+
* @package SkyVerge/WooCommerce/Payment-Gateway/Apple-Pay
|
20 |
+
* @author SkyVerge
|
21 |
+
* @copyright Copyright (c) 2013-2016, SkyVerge, Inc.
|
22 |
+
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
|
23 |
+
*/
|
24 |
+
|
25 |
+
namespace WC_Braintree\Plugin_Framework;
|
26 |
+
|
27 |
+
defined( 'ABSPATH' ) or exit;
|
28 |
+
|
29 |
+
if ( ! class_exists( '\\WC_Braintree\\Plugin_Framework\\SV_WC_Payment_Gateway_Apple_Pay_Orders' ) ) :
|
30 |
+
|
31 |
+
/**
|
32 |
+
* The Apple Pay order handler.
|
33 |
+
*
|
34 |
+
* @since 4.7.0
|
35 |
+
*/
|
36 |
+
class SV_WC_Payment_Gateway_Apple_Pay_Orders {
|
37 |
+
|
38 |
+
|
39 |
+
/**
|
40 |
+
* Creates an order from a cart.
|
41 |
+
*
|
42 |
+
* @since 4.7.0
|
43 |
+
*
|
44 |
+
* @param \WC_Cart $cart cart object
|
45 |
+
*
|
46 |
+
* @throws \SV_WC_Payment_Gateway_Exception
|
47 |
+
*/
|
48 |
+
public static function create_order( \WC_Cart $cart ) {
|
49 |
+
|
50 |
+
// ensure totals are fully calculated by simulating checkout in WC 3.1 or lower
|
51 |
+
// TODO: remove this when WC 3.2+ can be required {CW 2017-11-17}
|
52 |
+
if ( SV_WC_Plugin_Compatibility::is_wc_version_lt( '3.2' ) && ! defined( 'WOOCOMMERCE_CHECKOUT' ) ) {
|
53 |
+
define( 'WOOCOMMERCE_CHECKOUT', true );
|
54 |
+
}
|
55 |
+
|
56 |
+
$cart->calculate_totals();
|
57 |
+
|
58 |
+
try {
|
59 |
+
|
60 |
+
wc_transaction_query( 'start' );
|
61 |
+
|
62 |
+
$order_data = array(
|
63 |
+
'status' => apply_filters( 'woocommerce_default_order_status', 'pending' ),
|
64 |
+
'customer_id' => get_current_user_id(),
|
65 |
+
'cart_hash' => md5( json_encode( wc_clean( $cart->get_cart_for_session() ) ) . $cart->total ),
|
66 |
+
'created_via' => 'apple_pay',
|
67 |
+
);
|
68 |
+
|
69 |
+
$order = self::get_order_object( $order_data );
|
70 |
+
|
71 |
+
foreach ( $cart->get_cart() as $cart_item_key => $item ) {
|
72 |
+
|
73 |
+
$args = array(
|
74 |
+
'variation' => $item['variation'],
|
75 |
+
'totals' => array(
|
76 |
+
'subtotal' => $item['line_subtotal'],
|
77 |
+
'subtotal_tax' => $item['line_subtotal_tax'],
|
78 |
+
'total' => $item['line_total'],
|
79 |
+
'tax' => $item['line_tax'],
|
80 |
+
'tax_data' => $item['line_tax_data']
|
81 |
+
),
|
82 |
+
);
|
83 |
+
|
84 |
+
if ( ! $order->add_product( $item['data'], $item['quantity'], $args ) ) {
|
85 |
+
throw new SV_WC_Payment_Gateway_Exception( sprintf( __( 'Error %d: Unable to create order. Please try again.', 'woocommerce-gateway-paypal-powered-by-braintree' ), 525 ) );
|
86 |
+
}
|
87 |
+
}
|
88 |
+
|
89 |
+
foreach ( $cart->get_coupons() as $code => $coupon ) {
|
90 |
+
|
91 |
+
if ( ! SV_WC_Order_Compatibility::add_coupon( $order, $code, $cart->get_coupon_discount_amount( $code ), $cart->get_coupon_discount_tax_amount( $code ) ) ) {
|
92 |
+
throw new SV_WC_Payment_Gateway_Exception( sprintf( __( 'Error %d: Unable to create order. Please try again.', 'woocommerce-gateway-paypal-powered-by-braintree' ), 529 ) );
|
93 |
+
}
|
94 |
+
}
|
95 |
+
|
96 |
+
$chosen_methods = WC()->session->get( 'chosen_shipping_methods', array() );
|
97 |
+
|
98 |
+
foreach ( WC()->shipping->get_packages() as $key => $package ) {
|
99 |
+
|
100 |
+
if ( isset( $package['rates'][ $chosen_methods[ $key ] ] ) ) {
|
101 |
+
|
102 |
+
$method = $package['rates'][ $chosen_methods[ $key ] ];
|
103 |
+
|
104 |
+
if ( ! SV_WC_Order_Compatibility::add_shipping( $order, $method ) ) {
|
105 |
+
throw new SV_WC_Payment_Gateway_Exception( sprintf( __( 'Error %d: Unable to create order. Please try again.', 'woocommerce-gateway-paypal-powered-by-braintree' ), 527 ) );
|
106 |
+
}
|
107 |
+
}
|
108 |
+
}
|
109 |
+
|
110 |
+
// add fees
|
111 |
+
foreach ( $cart->get_fees() as $key => $fee ) {
|
112 |
+
|
113 |
+
if ( ! SV_WC_Order_Compatibility::add_fee( $order, $fee ) ) {
|
114 |
+
throw new SV_WC_Payment_Gateway_Exception( sprintf( __( 'Error %d: Unable to create order. Please try again.', 'woocommerce-gateway-paypal-powered-by-braintree' ), 526 ) );
|
115 |
+
}
|
116 |
+
}
|
117 |
+
|
118 |
+
$cart_taxes = SV_WC_Plugin_Compatibility::is_wc_version_gte( '3.2' ) ? $cart->get_cart_contents_taxes() : $cart->taxes;
|
119 |
+
$shipping_taxes = SV_WC_Plugin_Compatibility::is_wc_version_gte( '3.2' ) ? $cart->get_shipping_taxes() : $cart->shipping_taxes;
|
120 |
+
|
121 |
+
foreach ( array_keys( $cart_taxes + $shipping_taxes ) as $rate_id ) {
|
122 |
+
|
123 |
+
if ( $rate_id && apply_filters( 'woocommerce_cart_remove_taxes_zero_rate_id', 'zero-rated' ) !== $rate_id ) {
|
124 |
+
|
125 |
+
if ( ! SV_WC_Order_Compatibility::add_tax( $order, $rate_id, $cart->get_tax_amount( $rate_id ), $cart->get_shipping_tax_amount( $rate_id ) ) ) {
|
126 |
+
throw new SV_WC_Payment_Gateway_Exception( sprintf( __( 'Error %d: Unable to create order. Please try again.', 'woocommerce-gateway-paypal-powered-by-braintree' ), 526 ) );
|
127 |
+
}
|
128 |
+
}
|
129 |
+
}
|
130 |
+
|
131 |
+
wc_transaction_query( 'commit' );
|
132 |
+
|
133 |
+
$order->update_taxes();
|
134 |
+
|
135 |
+
$order->calculate_totals( false ); // false to skip recalculating taxes
|
136 |
+
|
137 |
+
do_action( 'woocommerce_checkout_update_order_meta', SV_WC_Order_Compatibility::get_prop( $order, 'id' ), array() );
|
138 |
+
|
139 |
+
return $order;
|
140 |
+
|
141 |
+
} catch ( SV_WC_Payment_Gateway_Exception $e ) {
|
142 |
+
|
143 |
+
wc_transaction_query( 'rollback' );
|
144 |
+
|
145 |
+
throw $e;
|
146 |
+
}
|
147 |
+
}
|
148 |
+
|
149 |
+
|
150 |
+
/**
|
151 |
+
* Gets an order object for payment.
|
152 |
+
*
|
153 |
+
* @since 4.7.0
|
154 |
+
*
|
155 |
+
* @param array $order_data the order data
|
156 |
+
* @return \WC_Order
|
157 |
+
*
|
158 |
+
* @throws \SV_WC_Payment_Gateway_Exception
|
159 |
+
*/
|
160 |
+
public static function get_order_object( $order_data ) {
|
161 |
+
|
162 |
+
$order_id = (int) WC()->session->get( 'order_awaiting_payment', 0 );
|
163 |
+
|
164 |
+
if ( $order_id && $order_data['cart_hash'] === get_post_meta( $order_id, '_cart_hash', true ) && ( $order = wc_get_order( $order_id ) ) && $order->has_status( array( 'pending', 'failed' ) ) ) {
|
165 |
+
|
166 |
+
$order_data['order_id'] = $order_id;
|
167 |
+
|
168 |
+
$order = wc_update_order( $order_data );
|
169 |
+
|
170 |
+
if ( is_wp_error( $order ) ) {
|
171 |
+
throw new SV_WC_Payment_Gateway_Exception( sprintf( __( 'Error %d: Unable to create order. Please try again.', 'woocommerce-gateway-paypal-powered-by-braintree' ), 522 ) );
|
172 |
+
} else {
|
173 |
+
$order->remove_order_items();
|
174 |
+
}
|
175 |
+
|
176 |
+
} else {
|
177 |
+
|
178 |
+
$order = wc_create_order( $order_data );
|
179 |
+
|
180 |
+
if ( is_wp_error( $order ) ) {
|
181 |
+
throw new SV_WC_Payment_Gateway_Exception( sprintf( __( 'Error %d: Unable to create order. Please try again.', 'woocommerce-gateway-paypal-powered-by-braintree' ), 520 ) );
|
182 |
+
} elseif ( false === $order ) {
|
183 |
+
throw new SV_WC_Payment_Gateway_Exception( sprintf( __( 'Error %d: Unable to create order. Please try again.', 'woocommerce-gateway-paypal-powered-by-braintree' ), 521 ) );
|
184 |
+
}
|
185 |
+
|
186 |
+
// set the new order ID so it can be resumed in case of failure
|
187 |
+
WC()->session->set( 'order_awaiting_payment', SV_WC_Order_Compatibility::get_prop( $order, 'id' ) );
|
188 |
+
}
|
189 |
+
|
190 |
+
return $order;
|
191 |
+
}
|
192 |
+
|
193 |
+
|
194 |
+
}
|
195 |
+
|
196 |
+
endif;
|
lib/skyverge/woocommerce/payment-gateway/apple-pay/class-sv-wc-payment-gateway-apple-pay.php
ADDED
@@ -0,0 +1,1126 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* WooCommerce Payment Gateway Framework
|
4 |
+
*
|
5 |
+
* This source file is subject to the GNU General Public License v3.0
|
6 |
+
* that is bundled with this package in the file license.txt.
|
7 |
+
* It is also available through the world-wide-web at this URL:
|
8 |
+
* http://www.gnu.org/licenses/gpl-3.0.html
|
9 |
+
* If you did not receive a copy of the license and are unable to
|
10 |
+
* obtain it through the world-wide-web, please send an email
|
11 |
+
* to license@skyverge.com so we can send you a copy immediately.
|
12 |
+
*
|
13 |
+
* DISCLAIMER
|
14 |
+
*
|
15 |
+
* Do not edit or add to this file if you wish to upgrade the plugin to newer
|
16 |
+
* versions in the future. If you wish to customize the plugin for your
|
17 |
+
* needs please refer to http://www.skyverge.com
|
18 |
+
*
|
19 |
+
* @package SkyVerge/WooCommerce/Payment-Gateway/Apple-Pay
|
20 |
+
* @author SkyVerge
|
21 |
+
* @copyright Copyright (c) 2013-2016, SkyVerge, Inc.
|
22 |
+
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
|
23 |
+
*/
|
24 |
+
|
25 |
+
namespace WC_Braintree\Plugin_Framework;
|
26 |
+
|
27 |
+
defined( 'ABSPATH' ) or exit;
|
28 |
+
|
29 |
+
if ( ! class_exists( '\\WC_Braintree\\Plugin_Framework\\SV_WC_Payment_Gateway_Apple_Pay' ) ) :
|
30 |
+
|
31 |
+
/**
|
32 |
+
* Sets up Apple Pay support.
|
33 |
+
*
|
34 |
+
* @since 4.7.0
|
35 |
+
*/
|
36 |
+
class SV_WC_Payment_Gateway_Apple_Pay {
|
37 |
+
|
38 |
+
|
39 |
+
/** @var SV_WC_Payment_Gateway_Apple_Pay_Admin the admin instance */
|
40 |
+
protected $admin;
|
41 |
+
|
42 |
+
/** @var SV_WC_Payment_Gateway_Apple_Pay_Frontend the frontend instance */
|
43 |
+
protected $frontend;
|
44 |
+
|
45 |
+
/** @var SV_WC_Payment_Gateway_Apple_Pay_AJAX the AJAX instance */
|
46 |
+
protected $ajax;
|
47 |
+
|
48 |
+
/** @var SV_WC_Payment_Gateway_Plugin the plugin instance */
|
49 |
+
protected $plugin;
|
50 |
+
|
51 |
+
/** @var SV_WC_Payment_Gateway_Apple_Pay_API the Apple Pay API */
|
52 |
+
protected $api;
|
53 |
+
|
54 |
+
|
55 |
+
/**
|
56 |
+
* Constructs the class.
|
57 |
+
*
|
58 |
+
* @since 4.7.0
|
59 |
+
*
|
60 |
+
* @param SV_WC_Payment_Gateway_Plugin $plugin the plugin instance
|
61 |
+
*/
|
62 |
+
public function __construct( SV_WC_Payment_Gateway_Plugin $plugin ) {
|
63 |
+
|
64 |
+
$this->plugin = $plugin;
|
65 |
+
|
66 |
+
$this->init();
|
67 |
+
|
68 |
+
if ( $this->is_available() ) {
|
69 |
+
add_filter( 'woocommerce_customer_taxable_address', array( $this, 'set_customer_taxable_address' ) );
|
70 |
+
}
|
71 |
+
}
|
72 |
+
|
73 |
+
|
74 |
+
/**
|
75 |
+
* Initializes the Apple Pay handlers.
|
76 |
+
*
|
77 |
+
* @since 4.7.0
|
78 |
+
*/
|
79 |
+
protected function init() {
|
80 |
+
|
81 |
+
if ( is_admin() && ! is_ajax() ) {
|
82 |
+
$this->init_admin();
|
83 |
+
} else {
|
84 |
+
$this->init_ajax();
|
85 |
+
$this->init_frontend();
|
86 |
+
}
|
87 |
+
}
|
88 |
+
|
89 |
+
|
90 |
+
/**
|
91 |
+
* Initializes the admin handler.
|
92 |
+
*
|
93 |
+
* @since 5.3.0
|
94 |
+
*/
|
95 |
+
protected function init_admin() {
|
96 |
+
|
97 |
+
$this->admin = new SV_WC_Payment_Gateway_Apple_Pay_Admin( $this );
|
98 |
+
}
|
99 |
+
|
100 |
+
|
101 |
+
/**
|
102 |
+
* Initializes the AJAX handler.
|
103 |
+
*
|
104 |
+
* @since 5.3.0
|
105 |
+
*/
|
106 |
+
protected function init_ajax() {
|
107 |
+
|
108 |
+
$this->ajax = new SV_WC_Payment_Gateway_Apple_Pay_AJAX( $this );
|
109 |
+
}
|
110 |
+
|
111 |
+
|
112 |
+
/**
|
113 |
+
* Initializes the frontend handler.
|
114 |
+
*
|
115 |
+
* @since 5.3.0
|
116 |
+
*/
|
117 |
+
protected function init_frontend() {
|
118 |
+
|
119 |
+
$this->frontend = new SV_WC_Payment_Gateway_Apple_Pay_Frontend( $this->get_plugin(), $this );
|
120 |
+
}
|
121 |
+
|
122 |
+
|
123 |
+
/**
|
124 |
+
* Processes the payment after an Apple Pay authorization.
|
125 |
+
*
|
126 |
+
* This method creates a new order and calls the gateway for processing.
|
127 |
+
*
|
128 |
+
* @since 4.7.0
|
129 |
+
*
|
130 |
+
* @return array
|
131 |
+
* @throws \Exception
|
132 |
+
*/
|
133 |
+
public function process_payment() {
|
134 |
+
|
135 |
+
$order = null;
|
136 |
+
|
137 |
+
try {
|
138 |
+
|
139 |
+
$payment_response = $this->get_stored_payment_response();
|
140 |
+
|
141 |
+
if ( ! $payment_response ) {
|
142 |
+
throw new SV_WC_Payment_Gateway_Exception( 'Invalid payment response data' );
|
143 |
+
}
|
144 |
+
|
145 |
+
$this->log( "Payment Response:\n" . $payment_response->to_string_safe() . "\n" );
|
146 |
+
|
147 |
+
$order = SV_WC_Payment_Gateway_Apple_Pay_Orders::create_order( WC()->cart );
|
148 |
+
|
149 |
+
$order->set_payment_method( $this->get_processing_gateway() );
|
150 |
+
|
151 |
+
// if we got to this point, the payment was authorized by Apple Pay
|
152 |
+
// from here on out, it's up to the gateway to not screw things up.
|
153 |
+
$order->add_order_note( __( 'Apple Pay payment authorized.', 'woocommerce-gateway-paypal-powered-by-braintree' ) );
|
154 |
+
|
155 |
+
$order->set_address( $payment_response->get_billing_address(), 'billing' );
|
156 |
+
$order->set_address( $payment_response->get_shipping_address(), 'shipping' );
|
157 |
+
|
158 |
+
if ( SV_WC_Plugin_Compatibility::is_wc_version_gte_3_0() ) {
|
159 |
+
$order->save();
|
160 |
+
}
|
161 |
+
|
162 |
+
// add Apple Pay response data to the order
|
163 |
+
add_filter( 'wc_payment_gateway_' . $this->get_processing_gateway()->get_id() . '_get_order', array( $this, 'add_order_data' ) );
|
164 |
+
|
165 |
+
if ( $this->is_test_mode() ) {
|
166 |
+
$result = $this->process_test_payment( $order );
|
167 |
+
} else {
|
168 |
+
$result = $this->get_processing_gateway()->process_payment( SV_WC_Order_Compatibility::get_prop( $order, 'id' ) );
|
169 |
+
}
|
170 |
+
|
171 |
+
if ( empty( $result['result'] ) || 'success' !== $result['result'] ) {
|
172 |
+
throw new SV_WC_Payment_Gateway_Exception( 'Gateway processing error.' );
|
173 |
+
}
|
174 |
+
|
175 |
+
if ( $user_id = $order->get_user_id() ) {
|
176 |
+
$this->update_customer_addresses( $user_id, $payment_response );
|
177 |
+
}
|
178 |
+
|
179 |
+
$this->clear_payment_data();
|
180 |
+
|
181 |
+
return $result;
|
182 |
+
|
183 |
+
} catch ( \Exception $e ) {
|
184 |
+
|
185 |
+
if ( $order ) {
|
186 |
+
|
187 |
+
$order->add_order_note( sprintf(
|
188 |
+
/** translators: Placeholders: %s - the error message */
|
189 |
+
__( 'Apple Pay payment failed. %s', 'woocommerce-gateway-paypal-powered-by-braintree' ),
|
190 |
+
$e->getMessage()
|
191 |
+
) );
|
192 |
+
}
|
193 |
+
|
194 |
+
throw $e;
|
195 |
+
}
|
196 |
+
}
|
197 |
+
|
198 |
+
|
199 |
+
/**
|
200 |
+
* Updates a customer's stored billing & shipping addresses based on the
|
201 |
+
* Apple Pay payment response.
|
202 |
+
*
|
203 |
+
* @since 4.7.0
|
204 |
+
*
|
205 |
+
* @param int $user_id WordPress user ID
|
206 |
+
* @param SV_WC_Payment_Gateway_Apple_Pay_Payment_Response $payment_response payment response object
|
207 |
+
*/
|
208 |
+
protected function update_customer_addresses( $user_id, SV_WC_Payment_Gateway_Apple_Pay_Payment_Response $payment_response ) {
|
209 |
+
|
210 |
+
foreach ( $payment_response->get_billing_address() as $key => $value ) {
|
211 |
+
update_user_meta( $user_id, 'billing_' . $key, $value );
|
212 |
+
}
|
213 |
+
|
214 |
+
$shipping_address = $payment_response->get_shipping_address();
|
215 |
+
|
216 |
+
if ( ! empty( $shipping_address['address_1'] ) ) {
|
217 |
+
|
218 |
+
foreach ( $payment_response->get_shipping_address() as $key => $value ) {
|
219 |
+
update_user_meta( $user_id, 'shipping_' . $key, $value );
|
220 |
+
}
|
221 |
+
}
|
222 |
+
}
|
223 |
+
|
224 |
+
|
225 |
+
/**
|
226 |
+
* Simulates a successful gateway payment response.
|
227 |
+
*
|
228 |
+
* This provides an easy way for merchants to test that their certificates
|
229 |
+
* and other settings are correctly configured and communicating with Apple
|
230 |
+
* without processing actual payments to test.
|
231 |
+
*
|
232 |
+
* @since 4.7.0
|
233 |
+
*
|
234 |
+
* @param \WC_Order $order order object
|
235 |
+
* @return array
|
236 |
+
*/
|
237 |
+
protected function process_test_payment( \WC_Order $order ) {
|
238 |
+
|
239 |
+
$order->payment_complete();
|
240 |
+
|
241 |
+
WC()->cart->empty_cart();
|
242 |
+
|
243 |
+
return array(
|
244 |
+
'result' => 'success',
|
245 |
+
'redirect' => $this->get_processing_gateway()->get_return_url( $order ),
|
246 |
+
);
|
247 |
+
}
|
248 |
+
|
249 |
+
|
250 |
+
/**
|
251 |
+
* Gets a single product payment request.
|
252 |
+
*
|
253 |
+
* @since 4.7.0
|
254 |
+
* @see \SV_WC_Payment_Gateway_Apple_Pay::build_payment_request()
|
255 |
+
*
|
256 |
+
* @param \WC_Product $product product object
|
257 |
+
* @param bool $in_cart whether to generate a cart for this request
|
258 |
+
* @return array
|
259 |
+
*
|
260 |
+
* @throws SV_WC_Payment_Gateway_Exception
|
261 |
+
*/
|
262 |
+
public function get_product_payment_request( \WC_Product $product, $in_cart = false ) {
|
263 |
+
|
264 |
+
if ( ! is_user_logged_in() ) {
|
265 |
+
WC()->session->set_customer_session_cookie( true );
|
266 |
+
}
|
267 |
+
|
268 |
+
// no subscription products
|
269 |
+
if ( $this->get_plugin()->is_subscriptions_active() && \WC_Subscriptions_Product::is_subscription( $product ) ) {
|
270 |
+
throw new SV_WC_Payment_Gateway_Exception( 'Not available for subscription products.' );
|
271 |
+
}
|
272 |
+
|
273 |
+
// no pre-order "charge upon release" products
|
274 |
+
if ( $this->get_plugin()->is_pre_orders_active() && \WC_Pre_Orders_Product::product_is_charged_upon_release( $product ) ) {
|
275 |
+
throw new SV_WC_Payment_Gateway_Exception( 'Not available for pre-order products that are set to charge upon release.' );
|
276 |
+
}
|
277 |
+
|
278 |
+
// only simple products
|
279 |
+
if ( ! $product->is_type( 'simple' ) ) {
|
280 |
+
throw new SV_WC_Payment_Gateway_Exception( 'Buy Now is only available for simple products' );
|
281 |
+
}
|
282 |
+
|
283 |
+
// if this product can't be purchased, bail
|
284 |
+
if ( ! $product->is_purchasable() || ! $product->is_in_stock() || ! $product->has_enough_stock( 1 ) ) {
|
285 |
+
throw new SV_WC_Payment_Gateway_Exception( 'Product is not available for purchase.' );
|
286 |
+
}
|
287 |
+
|
288 |
+
if ( $in_cart ) {
|
289 |
+
|
290 |
+
WC()->cart->empty_cart();
|
291 |
+
|
292 |
+
WC()->cart->add_to_cart( $product->get_id() );
|
293 |
+
|
294 |
+
$request = $this->get_cart_payment_request( WC()->cart );
|
295 |
+
|
296 |
+
} else {
|
297 |
+
|
298 |
+
$request = $this->build_payment_request( $product->get_price(), array( 'needs_shipping' => $product->needs_shipping() ) );
|
299 |
+
|
300 |
+
$stored_request = $this->get_stored_payment_request();
|
301 |
+
|
302 |
+
$stored_request['product_id'] = $product->get_id();
|
303 |
+
|
304 |
+
$this->store_payment_request( $stored_request );
|
305 |
+
}
|
306 |
+
|
307 |
+
/**
|
308 |
+
* Filters the Apple Pay Buy Now JS payment request.
|
309 |
+
*
|
310 |
+
* @since 4.7.0
|
311 |
+
* @param array $request request data
|
312 |
+
* @param \WC_Product $product product object
|
313 |
+
*/
|
314 |
+
return apply_filters( 'sv_wc_apple_pay_buy_now_payment_request', $request, $product );
|
315 |
+
}
|
316 |
+
|
317 |
+
|
318 |
+
/**
|
319 |
+
* Gets a payment request based on WooCommerce cart data.
|
320 |
+
*
|
321 |
+
* @since 4.7.0
|
322 |
+
* @see \SV_WC_Payment_Gateway_Apple_Pay::build_payment_request()
|
323 |
+
*
|
324 |
+
* @param \WC_Cart $cart cart object
|
325 |
+
* @return array
|
326 |
+
*
|
327 |
+
* @throws SV_WC_Payment_Gateway_Exception
|
328 |
+
*/
|
329 |
+
public function get_cart_payment_request( \WC_Cart $cart ) {
|
330 |
+
|
331 |
+
if ( $this->get_plugin()->is_subscriptions_active() && \WC_Subscriptions_Cart::cart_contains_subscription() ) {
|
332 |
+
throw new SV_WC_Payment_Gateway_Exception( 'Cart contains subscriptions.' );
|
333 |
+
}
|
334 |
+
|
335 |
+
if ( $this->get_plugin()->is_pre_orders_active() && \WC_Pre_Orders_Cart::cart_contains_pre_order() ) {
|
336 |
+
throw new SV_WC_Payment_Gateway_Exception( 'Cart contains pre-orders.' );
|
337 |
+
}
|
338 |
+
|
339 |
+
// ensure totals are fully calculated by simulating checkout in WC 3.1 or lower
|
340 |
+
// TODO: remove this when WC 3.2+ can be required {CW 2017-11-17}
|
341 |
+
if ( SV_WC_Plugin_Compatibility::is_wc_version_lt( '3.2' ) && ! defined( 'WOOCOMMERCE_CHECKOUT' ) ) {
|
342 |
+
define( 'WOOCOMMERCE_CHECKOUT', true );
|
343 |
+
}
|
344 |
+
|
345 |
+
$cart->calculate_totals();
|
346 |
+
|
347 |
+
if ( count( WC()->shipping->get_packages() ) > 1 ) {
|
348 |
+
throw new SV_WC_Payment_Gateway_Exception( 'Apple Pay cannot be used for multiple shipments.' );
|
349 |
+
}
|
350 |
+
|
351 |
+
$args = array(
|
352 |
+
'line_totals' => $this->get_cart_totals( $cart ),
|
353 |
+
'needs_shipping' => $cart->needs_shipping(),
|
354 |
+
);
|
355 |
+
|
356 |
+
// build it!
|
357 |
+
$request = $this->build_payment_request( $cart->total, $args );
|
358 |
+
|
359 |
+
/**
|
360 |
+
* Filters the Apple Pay cart JS payment request.
|
361 |
+
*
|
362 |
+
* @since 4.7.0
|
363 |
+
* @param array $args the cart JS payment request
|
364 |
+
* @param \WC_Cart $cart the cart object
|
365 |
+
*/
|
366 |
+
return apply_filters( 'sv_wc_apple_pay_cart_payment_request', $request, $cart );
|
367 |
+
}
|
368 |
+
|
369 |
+
|
370 |
+
/**
|
371 |
+
* Recalculates the lines and totals for the current payment request.
|
372 |
+
*
|
373 |
+
* @since 4.7.0
|
374 |
+
*
|
375 |
+
* @return array
|
376 |
+
*
|
377 |
+
* @throws SV_WC_Payment_Gateway_Exception
|
378 |
+
*/
|
379 |
+
public function recalculate_totals() {
|
380 |
+
|
381 |
+
$payment_request = $this->get_stored_payment_request();
|
382 |
+
|
383 |
+
if ( empty( $payment_request ) ){
|
384 |
+
throw new SV_WC_Payment_Gateway_Exception( 'Payment request data is missing.' );
|
385 |
+
}
|
386 |
+
|
387 |
+
// if this is a single product request, make sure the cart gets populated
|
388 |
+
if ( ! empty( $payment_request['product_id'] ) && $product = wc_get_product( $payment_request['product_id'] ) ) {
|
389 |
+
$payment_request = $this->get_product_payment_request( $product, true );
|
390 |
+
}
|
391 |
+
|
392 |
+
if ( ! WC()->cart ) {
|
393 |
+
throw new SV_WC_Payment_Gateway_Exception( 'Cart data is missing.' );
|
394 |
+
}
|
395 |
+
|
396 |
+
$totals = $this->get_cart_totals( WC()->cart );
|
397 |
+
|
398 |
+
$payment_request['lineItems'] = $this->build_payment_request_lines( $totals );
|
399 |
+
$payment_request['shippingMethods'] = array();
|
400 |
+
|
401 |
+
$packages = WC()->shipping->get_packages();
|
402 |
+
|
403 |
+
if ( ! empty( $packages ) ) {
|
404 |
+
|
405 |
+
foreach ( $packages[0]['rates'] as $method ) {
|
406 |
+
|
407 |
+
/**
|
408 |
+
* Filters a shipping method's description for the Apple Pay payment card.
|
409 |
+
*
|
410 |
+
* @since 4.7.0
|
411 |
+
*
|
412 |
+
* @param string $detail shipping method detail, such as delivery estimation
|
413 |
+
* @param object $method shipping method object
|
414 |
+
*/
|
415 |
+
$method_detail = apply_filters( 'wc_payment_gateway_apple_pay_shipping_method_detail', '', $method );
|
416 |
+
|
417 |
+
$payment_request['shippingMethods'][] = array(
|
418 |
+
'label' => $method->get_label(),
|
419 |
+
'detail' => $method_detail,
|
420 |
+
'amount' => $this->format_price( $method->cost ),
|
421 |
+
'identifier' => $method->id,
|
422 |
+
);
|
423 |
+
}
|
424 |
+
}
|
425 |
+
|
426 |
+
// reset the order total based on the new line items
|
427 |
+
$payment_request['total']['amount'] = $this->format_price( array_sum( wp_list_pluck( $payment_request['lineItems'], 'amount' ) ) );
|
428 |
+
|
429 |
+
// update the stored payment request session with the new line items & totals
|
430 |
+
$this->store_payment_request( $payment_request );
|
431 |
+
|
432 |
+
return $payment_request;
|
433 |
+
}
|
434 |
+
|
435 |
+
|
436 |
+
/**
|
437 |
+
* Gets the line totals for a cart.
|
438 |
+
*
|
439 |
+
* @since 4.7.0
|
440 |
+
* @see SV_WC_Payment_Gateway_Apple_Pay::build_payment_request_lines()
|
441 |
+
*
|
442 |
+
* @param \WC_Cart $cart cart object
|
443 |
+
* @return array
|
444 |
+
*/
|
445 |
+
protected function get_cart_totals( \WC_Cart $cart ) {
|
446 |
+
|
447 |
+
// ensure totals are fully calculated by simulating checkout in WC 3.1 or lower
|
448 |
+
// TODO: remove this when WC 3.2+ can be required {CW 2017-11-17}
|
449 |
+
if ( SV_WC_Plugin_Compatibility::is_wc_version_lt( '3.2' ) && ! defined( 'WOOCOMMERCE_CHECKOUT' ) ) {
|
450 |
+
define( 'WOOCOMMERCE_CHECKOUT', true );
|
451 |
+
}
|
452 |
+
|
453 |
+
$cart->calculate_totals();
|
454 |
+
|
455 |
+
return array(
|
456 |
+
'subtotal' => $cart->subtotal_ex_tax,
|
457 |
+
'discount' => $cart->get_cart_discount_total(),
|
458 |
+
'shipping' => $cart->shipping_total,
|
459 |
+
'fees' => $cart->fee_total,
|
460 |
+
'taxes' => $cart->tax_total + $cart->shipping_tax_total,
|
461 |
+
);
|
462 |
+
}
|
463 |
+
|
464 |
+
|
465 |
+
/**
|
466 |
+
* Builds a payment request for the Apple Pay JS.
|
467 |
+
*
|
468 |
+
* This contains all of the data necessary to complete a payment.
|
469 |
+
*
|
470 |
+
* @since 4.7.0
|
471 |
+
*
|
472 |
+
* @param float|int $amount amount to be charged by Apple Pay
|
473 |
+
* @param array $args {
|
474 |
+
* Optional. The payment request args.
|
475 |
+
*
|
476 |
+
* @type string $currency_code Payment currency code. Defaults to the shop currency.
|
477 |
+
* @type string $country_code Payment country code. Defaults to the shop base country.
|
478 |
+
* @type string $merchant_name Merchant name. Defaults to the shop name.
|
479 |
+
* @type array $merchant_capabilities merchant capabilities
|
480 |
+
* @type array $supported_networks supported networks or card types
|
481 |
+
* @type bool $needs_shipping whether the payment needs shipping
|
482 |
+
* @type array $line_totals request line totals. @see \SV_WC_Payment_Gateway_Apple_Pay::build_payment_request_lines()
|
483 |
+
* }
|
484 |
+
*
|
485 |
+
* @return array
|
486 |
+
*/
|
487 |
+
public function build_payment_request( $amount, $args = array() ) {
|
488 |
+
|
489 |
+
$args = wp_parse_args( $args, array(
|
490 |
+
'currency_code' => get_woocommerce_currency(),
|
491 |
+
'country_code' => get_option( 'woocommerce_default_country' ),
|
492 |
+
'merchant_name' => get_bloginfo( 'name', 'display' ),
|
493 |
+
'merchant_capabilities' => $this->get_capabilities(),
|
494 |
+
'supported_networks' => $this->get_supported_networks(),
|
495 |
+
'line_totals' => array(),
|
496 |
+
'needs_shipping' => false,
|
497 |
+
) );
|
498 |
+
|
499 |
+
// set the base required defaults
|
500 |
+
$request = array(
|
501 |
+
'currencyCode' => $args['currency_code'],
|
502 |
+
'countryCode' => substr( $args['country_code'], 0, 2 ),
|
503 |
+
'merchantCapabilities' => $args['merchant_capabilities'],
|
504 |
+
'supportedNetworks' => $args['supported_networks'],
|
505 |
+
'requiredBillingContactFields' => array( 'postalAddress' ),
|
506 |
+
'requiredShippingContactFields' => array(
|
507 |
+
'phone',
|
508 |
+
'email',
|
509 |
+
'name',
|
510 |
+
),
|
511 |
+
);
|
512 |
+
|
513 |
+
if ( $args['needs_shipping'] ) {
|
514 |
+
$request['requiredShippingContactFields'][] = 'postalAddress';
|
515 |
+
}
|
516 |
+
|
517 |
+
if ( is_array( $args['line_totals'] ) && ! empty( $args['line_totals'] ) ) {
|
518 |
+
$request['lineItems'] = $this->build_payment_request_lines( $args['line_totals'] );
|
519 |
+
}
|
520 |
+
|
521 |
+
// order total
|
522 |
+
$request['total'] = array(
|
523 |
+
'type' => 'final',
|
524 |
+
'label' => $args['merchant_name'],
|
525 |
+
'amount' => $this->format_price( $amount ),
|
526 |
+
);
|
527 |
+
|
528 |
+
$this->store_payment_request( $request );
|
529 |
+
|
530 |
+
// remove line item keys that are only useful for us later
|
531 |
+
if ( ! empty( $request['lineItems'] ) ) {
|
532 |
+
$request['lineItems'] = array_values( $request['lineItems'] );
|
533 |
+
}
|
534 |
+
|
535 |
+
return $request;
|
536 |
+
}
|
537 |
+
|
538 |
+
|
539 |
+
/**
|
540 |
+
* Builds payment request lines for the Apple Pay JS.
|
541 |
+
*
|
542 |
+
* Apple guidelines prefer that the "lines" displayed on the Apple Pay card
|
543 |
+
* should be overall order totals, instead of listing actual product lines.
|
544 |
+
* This method standardizes the main breakdowns which are:
|
545 |
+
* + Subtotal
|
546 |
+
* + Discounts (represented as a single negative amount)
|
547 |
+
* + Shipping
|
548 |
+
* + Fees
|
549 |
+
* + Taxes
|
550 |
+
*
|
551 |
+
* @since 4.7.0
|
552 |
+
*
|
553 |
+
* @param array $totals {
|
554 |
+
* Payment line totals.
|
555 |
+
*
|
556 |
+
* @type float $subtotal items subtotal
|
557 |
+
* @type float $discount discounts total
|
558 |
+
* @type float $shipping shipping total
|
559 |
+
* @type float $fees fees total
|
560 |
+
* @type float $taxes tax total
|
561 |
+
* }
|
562 |
+
* @return array
|
563 |
+
*/
|
564 |
+
public function build_payment_request_lines( $totals ) {
|
565 |
+
|
566 |
+
$totals = wp_parse_args( $totals, array(
|
567 |
+
'subtotal' => 0.00,
|
568 |
+
'discount' => 0.00,
|
569 |
+
'shipping' => 0.00,
|
570 |
+
'fees' => 0.00,
|
571 |
+
'taxes' => 0.00,
|
572 |
+
) );
|
573 |
+
|
574 |
+
$lines = array();
|
575 |
+
|
576 |
+
// subtotal
|
577 |
+
if ( $totals['subtotal'] > 0 ) {
|
578 |
+
|
579 |
+
$lines['subtotal'] = array(
|
580 |
+
'type' => 'final',
|
581 |
+
'label' => __( 'Subtotal', 'woocommerce-gateway-paypal-powered-by-braintree' ),
|
582 |
+
'amount' => $this->format_price( $totals['subtotal'] ),
|
583 |
+
);
|
584 |
+
}
|
585 |
+
|
586 |
+
// discounts
|
587 |
+
if ( $totals['discount'] > 0 ) {
|
588 |
+
|
589 |
+
$lines['discount'] = array(
|
590 |
+
'type' => 'final',
|
591 |
+
'label' => __( 'Discount', 'woocommerce-gateway-paypal-powered-by-braintree' ),
|
592 |
+
'amount' => abs( $this->format_price( $totals['discount'] ) ) * -1,
|
593 |
+
);
|
594 |
+
}
|
595 |
+
|
596 |
+
// shipping
|
597 |
+
if ( $totals['shipping'] > 0 ) {
|
598 |
+
|
599 |
+
$lines['shipping'] = array(
|
600 |
+
'type' => 'final',
|
601 |
+
'label' => __( 'Shipping', 'woocommerce-gateway-paypal-powered-by-braintree' ),
|
602 |
+
'amount' => $this->format_price( $totals['shipping'] ),
|
603 |
+
);
|
604 |
+
}
|
605 |
+
|
606 |
+
// fees
|
607 |
+
if ( $totals['fees'] > 0 ) {
|
608 |
+
|
609 |
+
$lines['fees'] = array(
|
610 |
+
'type' => 'final',
|
611 |
+
'label' => __( 'Fees', 'woocommerce-gateway-paypal-powered-by-braintree' ),
|
612 |
+
'amount' => $this->format_price( $totals['fees'] ),
|
613 |
+
);
|
614 |
+
}
|
615 |
+
|
616 |
+
// taxes
|
617 |
+
if ( $totals['taxes'] > 0 ) {
|
618 |
+
|
619 |
+
$lines['taxes'] = array(
|
620 |
+
'type' => 'final',
|
621 |
+
'label' => __( 'Taxes', 'woocommerce-gateway-paypal-powered-by-braintree' ),
|
622 |
+
'amount' => $this->format_price( $totals['taxes'] ),
|
623 |
+
);
|
624 |
+
}
|
625 |
+
|
626 |
+
return $lines;
|
627 |
+
}
|
628 |
+
|
629 |
+
|
630 |
+
/**
|
631 |
+
* Formats a total price for use with Apple Pay JS.
|
632 |
+
*
|
633 |
+
* @since 4.7.0
|
634 |
+
*
|
635 |
+
* @param string|float $price the price to format
|
636 |
+
* @return string
|
637 |
+
*/
|
638 |
+
protected function format_price( $price ) {
|
639 |
+
|
640 |
+
return wc_format_decimal( $price, 2 );
|
641 |
+
}
|
642 |
+
|
643 |
+
|
644 |
+
/**
|
645 |
+
* Gets the stored payment request data.
|
646 |
+
*
|
647 |
+
* @since 4.7.0
|
648 |
+
*
|
649 |
+
* @return array
|
650 |
+
*/
|
651 |
+
public function get_stored_payment_request() {
|
652 |
+
|
653 |
+
return WC()->session->get( 'apple_pay_payment_request', array() );
|
654 |
+
}
|
655 |
+
|
656 |
+
|
657 |
+
/**
|
658 |
+
* Gets the stored payment response data.
|
659 |
+
*
|
660 |
+
* @since 4.7.0
|
661 |
+
*
|
662 |
+
* @return SV_WC_Payment_Gateway_Apple_Pay_Payment_Response|false
|
663 |
+
*/
|
664 |
+
public function get_stored_payment_response() {
|
665 |
+
|
666 |
+
$response_data = WC()->session->get( 'apple_pay_payment_response', array() );
|
667 |
+
$response = null;
|
668 |
+
|
669 |
+
if ( ! empty( $response_data ) ) {
|
670 |
+
$response = $this->build_payment_response( $response_data );
|
671 |
+
}
|
672 |
+
|
673 |
+
return $response instanceof SV_WC_Payment_Gateway_Apple_Pay_Payment_Response ? $response : false;
|
674 |
+
}
|
675 |
+
|
676 |
+
|
677 |
+
/**
|
678 |
+
* Builds a payment response object from an array of data.
|
679 |
+
*
|
680 |
+
* @since 5.3.0
|
681 |
+
*
|
682 |
+
* @param string $data response data, as a JSON string
|
683 |
+
* @return SV_WC_Payment_Gateway_Apple_Pay_Payment_Response
|
684 |
+
*/
|
685 |
+
protected function build_payment_response( $data ) {
|
686 |
+
|
687 |
+
return new SV_WC_Payment_Gateway_Apple_Pay_Payment_Response( $data );
|
688 |
+
}
|
689 |
+
|
690 |
+
|
691 |
+
/**
|
692 |
+
* Stores payment request data for later use.
|
693 |
+
*
|
694 |
+
* @since 4.7.0
|
695 |
+
*/
|
696 |
+
public function store_payment_request( $data ) {
|
697 |
+
|
698 |
+
WC()->session->set( 'apple_pay_payment_request', $data );
|
699 |
+
}
|
700 |
+
|
701 |
+
|
702 |
+
/**
|
703 |
+
* Stores payment response data for later use.
|
704 |
+
*
|
705 |
+
* @since 4.7.0
|
706 |
+
*/
|
707 |
+
public function store_payment_response( $data ) {
|
708 |
+
|
709 |
+
WC()->session->set( 'apple_pay_payment_response', $data );
|
710 |
+
}
|
711 |
+
|
712 |
+
|
713 |
+
/**
|
714 |
+
* Clears all payment request & response data from the session.
|
715 |
+
*
|
716 |
+
* @since 4.7.0
|
717 |
+
*/
|
718 |
+
public function clear_payment_data() {
|
719 |
+
|
720 |
+
unset( WC()->session->apple_pay_payment_request );
|
721 |
+
unset( WC()->session->apple_pay_payment_response );
|
722 |
+
unset( WC()->session->order_awaiting_payment );
|
723 |
+
}
|
724 |
+
|
725 |
+
|
726 |
+
/**
|
727 |
+
* Filters and sets the customer's taxable address.
|
728 |
+
*
|
729 |
+
* This is necessary because Apple Pay doesn't ever provide a billing
|
730 |
+
* address until after payment is complete. If the shop is set to calculate
|
731 |
+
* tax based on the billing address, we need to use the shipping address
|
732 |
+
* to at least get some rates for new customers.
|
733 |
+
*
|
734 |
+
* @internal
|
735 |
+
*
|
736 |
+
* @since 4.7.0
|
737 |
+
*
|
738 |
+
* @param array $address taxable address
|
739 |
+
* @return array
|
740 |
+
*/
|
741 |
+
public function set_customer_taxable_address( $address ) {
|
742 |
+
|
743 |
+
$billing_country = SV_WC_Plugin_Compatibility::is_wc_version_gte_3_0() ? WC()->customer->get_billing_country() : WC()->customer->get_country();
|
744 |
+
|
745 |
+
// set to the shipping address provided by Apple Pay if:
|
746 |
+
// 1. shipping is available
|
747 |
+
// 2. billing is not available
|
748 |
+
// 3. taxes aren't configured to use the shop base
|
749 |
+
if ( WC()->customer->get_shipping_country() && ! $billing_country && $address[0] !== WC()->countries->get_base_country() ) {
|
750 |
+
|
751 |
+
$address = array(
|
752 |
+
WC()->customer->get_shipping_country(),
|
753 |
+
WC()->customer->get_shipping_state(),
|
754 |
+
WC()->customer->get_shipping_postcode(),
|
755 |
+
WC()->customer->get_shipping_city(),
|
756 |
+
);
|
757 |
+
}
|
758 |
+
|
759 |
+
return $address;
|
760 |
+
}
|
761 |
+
|
762 |
+
|
763 |
+
/**
|
764 |
+
* Allows the processing gateway to add Apple Pay details to the payment data.
|
765 |
+
*
|
766 |
+
* @internal
|
767 |
+
*
|
768 |
+
* @since 4.7.0
|
769 |
+
*
|
770 |
+
* @param \WC_Order $order the order object
|
771 |
+
* @return \WC_Order
|
772 |
+
*/
|
773 |
+
public function add_order_data( $order ) {
|
774 |
+
|
775 |
+
if ( $response = $this->get_stored_payment_response() ) {
|
776 |
+
$order = $this->get_processing_gateway()->get_order_for_apple_pay( $order, $response );
|
777 |
+
}
|
778 |
+
|
779 |
+
return $order;
|
780 |
+
}
|
781 |
+
|
782 |
+
|
783 |
+
/**
|
784 |
+
* Gets the Apple Pay API.
|
785 |
+
*
|
786 |
+
* @since 4.7.0
|
787 |
+
*
|
788 |
+
* @return SV_WC_Payment_Gateway_Apple_Pay_API
|
789 |
+
*/
|
790 |
+
public function get_api() {
|
791 |
+
|
792 |
+
if ( ! $this->api instanceof SV_WC_Payment_Gateway_Apple_Pay_API ) {
|
793 |
+
|
794 |
+
require_once( $this->get_plugin()->get_payment_gateway_framework_path() . '/apple-pay/api/class-sv-wc-payment-gateway-apple-pay-api.php');
|
795 |
+
require_once( $this->get_plugin()->get_payment_gateway_framework_path() . '/apple-pay/api/class-sv-wc-payment-gateway-apple-pay-api-request.php');
|
796 |
+
require_once( $this->get_plugin()->get_payment_gateway_framework_path() . '/apple-pay/api/class-sv-wc-payment-gateway-apple-pay-api-response.php');
|
797 |
+
|
798 |
+
$this->api = new SV_WC_Payment_Gateway_Apple_Pay_API( $this->get_processing_gateway() );
|
799 |
+
}
|
800 |
+
|
801 |
+
return $this->api;
|
802 |
+
}
|
803 |
+
|
804 |
+
|
805 |
+
/**
|
806 |
+
* Adds a log entry to the gateway's debug log.
|
807 |
+
*
|
808 |
+
* @since 4.7.0
|
809 |
+
*
|
810 |
+
* @param string $message the log message to add
|
811 |
+
*/
|
812 |
+
public function log( $message ) {
|
813 |
+
|
814 |
+
$gateway = $this->get_processing_gateway();
|
815 |
+
|
816 |
+
if ( ! $gateway ) {
|
817 |
+
return;
|
818 |
+
}
|
819 |
+
|
820 |
+
if ( $gateway->debug_log() ) {
|
821 |
+
$gateway->get_plugin()->log( '[Apple Pay] ' . $message, $gateway->get_id() );
|
822 |
+
}
|
823 |
+
}
|
824 |
+
|
825 |
+
|
826 |
+
/**
|
827 |
+
* Determines if Apple Pay is available.
|
828 |
+
*
|
829 |
+
* This does not indicate browser support or a user's ability, but rather
|
830 |
+
* that Apple Pay is properly configured and ready to be initiated by the
|
831 |
+
* Apple Pay JS.
|
832 |
+
*
|
833 |
+
* @since 4.7.0
|
834 |
+
*
|
835 |
+
* @return bool
|
836 |
+
*/
|
837 |
+
public function is_available() {
|
838 |
+
|
839 |
+
$is_available = wc_site_is_https() && $this->is_configured();
|
840 |
+
|
841 |
+
$is_available = $is_available && in_array( get_woocommerce_currency(), $this->get_accepted_currencies(), true );
|
842 |
+
|
843 |
+
/**
|
844 |
+
* Filters whether Apple Pay should be made available to users.
|
845 |
+
*
|
846 |
+
* @since 4.7.0
|
847 |
+
* @param bool $is_available
|
848 |
+
*/
|
849 |
+
return apply_filters( 'sv_wc_apple_pay_is_available', $is_available );
|
850 |
+
}
|
851 |
+
|
852 |
+
|
853 |
+
/**
|
854 |
+
* Determines if Apple Pay settings are properly configured.
|
855 |
+
*
|
856 |
+
* @since 4.7.0
|
857 |
+
*
|
858 |
+
* @return bool
|
859 |
+
*/
|
860 |
+
public function is_configured() {
|
861 |
+
|
862 |
+
if ( ! $this->get_processing_gateway() ) {
|
863 |
+
return false;
|
864 |
+
}
|
865 |
+
|
866 |
+
$is_configured = $this->is_enabled() && $this->get_processing_gateway()->is_enabled();
|
867 |
+
|
868 |
+
if ( $this->requires_merchant_id() ) {
|
869 |
+
$is_configured = $is_configured && (bool) $this->get_merchant_id();
|
870 |
+
}
|
871 |
+
|
872 |
+
if ( $this->requires_certificate() ) {
|
873 |
+
$is_configured = $is_configured && $this->is_cert_configured();
|
874 |
+
}
|
875 |
+
|
876 |
+
return $is_configured;
|
877 |
+
}
|
878 |
+
|
879 |
+
|
880 |
+
/**
|
881 |
+
* Determines if the certification path is set and valid.
|
882 |
+
*
|
883 |
+
* @since 4.7.0
|
884 |
+
*
|
885 |
+
* @return bool
|
886 |
+
*/
|
887 |
+
public function is_cert_configured() {
|
888 |
+
|
889 |
+
return is_readable( $this->get_cert_path() );
|
890 |
+
}
|
891 |
+
|
892 |
+
|
893 |
+
/**
|
894 |
+
* Determines if Apple Pay is enabled.
|
895 |
+
*
|
896 |
+
* @since 4.7.0
|
897 |
+
*
|
898 |
+
* @return bool
|
899 |
+
*/
|
900 |
+
public function is_enabled() {
|
901 |
+
|
902 |
+
return 'yes' === get_option( 'sv_wc_apple_pay_enabled' );
|
903 |
+
}
|
904 |
+
|
905 |
+
|
906 |
+
/**
|
907 |
+
* Determines if test mode is enabled.
|
908 |
+
*
|
909 |
+
* @since 4.7.0
|
910 |
+
*
|
911 |
+
* @return bool
|
912 |
+
*/
|
913 |
+
public function is_test_mode() {
|
914 |
+
|
915 |
+
return 'yes' === get_option( 'sv_wc_apple_pay_test_mode' );
|
916 |
+
}
|
917 |
+
|
918 |
+
|
919 |
+
/**
|
920 |
+
* Determines if a merchant ID is required for configuration.
|
921 |
+
*
|
922 |
+
* @since 5.3.0
|
923 |
+
*
|
924 |
+
* @return bool
|
925 |
+
*/
|
926 |
+
public function requires_merchant_id() {
|
927 |
+
|
928 |
+
return true;
|
929 |
+
}
|
930 |
+
|
931 |
+
|
932 |
+
/**
|
933 |
+
* Determines if a local Apple Pay certificate is required for configuration.
|
934 |
+
*
|
935 |
+
* @since 5.3.0
|
936 |
+
*
|
937 |
+
* @return bool
|
938 |
+
*/
|
939 |
+
public function requires_certificate() {
|
940 |
+
|
941 |
+
return true;
|
942 |
+
}
|
943 |
+
|
944 |
+
|
945 |
+
/**
|
946 |
+
* Gets the configured Apple merchant ID.
|
947 |
+
*
|
948 |
+
* @since 4.7.0
|
949 |
+
* @return string
|
950 |
+
*/
|
951 |
+
public function get_merchant_id() {
|
952 |
+
|
953 |
+
return get_option( 'sv_wc_apple_pay_merchant_id' );
|
954 |
+
}
|
955 |
+
|
956 |
+
|
957 |
+
/**
|
958 |
+
* Gets the certificate file path.
|
959 |
+
*
|
960 |
+
* @since 4.7.0
|
961 |
+
*
|
962 |
+
* @return string
|
963 |
+
*/
|
964 |
+
public function get_cert_path() {
|
965 |
+
|
966 |
+
return get_option( 'sv_wc_apple_pay_cert_path' );
|
967 |
+
}
|
968 |
+
|
969 |
+
|
970 |
+
/**
|
971 |
+
* Gets the currencies accepted by the gateway's Apple Pay integration.
|
972 |
+
*
|
973 |
+
* @since 4.7.0
|
974 |
+
*
|
975 |
+
* @return array
|
976 |
+
*/
|
977 |
+
public function get_accepted_currencies() {
|
978 |
+
|
979 |
+
$currencies = ( $this->get_processing_gateway() ) ? $this->get_processing_gateway()->get_apple_pay_currencies() : array();
|
980 |
+
|
981 |
+
/**
|
982 |
+
* Filters the currencies accepted by the gateway's Apple Pay integration.
|
983 |
+
*
|
984 |
+
* @since 4.7.0
|
985 |
+
* @return array
|
986 |
+
*/
|
987 |
+
return apply_filters( 'sv_wc_apple_pay_accepted_currencies', $currencies );
|
988 |
+
}
|
989 |
+
|
990 |
+
|
991 |
+
/**
|
992 |
+
* Gets the gateway's Apple Pay capabilities.
|
993 |
+
*
|
994 |
+
* @since 4.7.0
|
995 |
+
*
|
996 |
+
* @return array
|
997 |
+
*/
|
998 |
+
public function get_capabilities() {
|
999 |
+
|
1000 |
+
$valid_capabilities = array(
|
1001 |
+
'supports3DS',
|
1002 |
+
'supportsEMV',
|
1003 |
+
'supportsCredit',
|
1004 |
+
'supportsDebit',
|
1005 |
+
);
|
1006 |
+
|
1007 |
+
$gateway_capabilities = ( $this->get_processing_gateway() ) ? $this->get_processing_gateway()->get_apple_pay_capabilities() : array();
|
1008 |
+
|
1009 |
+
$capabilities = array_intersect( $valid_capabilities, $gateway_capabilities );
|
1010 |
+
|
1011 |
+
/**
|
1012 |
+
* Filters the gateway's Apple Pay capabilities.
|
1013 |
+
*
|
1014 |
+
* @since 4.7.0
|
1015 |
+
*
|
1016 |
+
* @param array $capabilities the gateway capabilities
|
1017 |
+
* @param SV_WC_Payment_Gateway_Apple_Pay $handler the Apple Pay handler
|
1018 |
+
*/
|
1019 |
+
return apply_filters( 'sv_wc_apple_pay_capabilities', array_values( $capabilities ), $this );
|
1020 |
+
}
|
1021 |
+
|
1022 |
+
|
1023 |
+
/**
|
1024 |
+
* Gets the supported networks for Apple Pay.
|
1025 |
+
*
|
1026 |
+
* @since 4.7.0
|
1027 |
+
*
|
1028 |
+
* @return array
|
1029 |
+
*/
|
1030 |
+
public function get_supported_networks() {
|
1031 |
+
|
1032 |
+
$accepted_card_types = ( $this->get_processing_gateway() ) ? $this->get_processing_gateway()->get_card_types() : array();
|
1033 |
+
|
1034 |
+
$accepted_card_types = array_map( '\\WC_Braintree\\Plugin_Framework\\SV_WC_Payment_Gateway_Helper::normalize_card_type', $accepted_card_types );
|
1035 |
+
|
1036 |
+
$valid_networks = array(
|
1037 |
+
SV_WC_Payment_Gateway_Helper::CARD_TYPE_AMEX => 'amex',
|
1038 |
+
SV_WC_Payment_Gateway_Helper::CARD_TYPE_DISCOVER => 'discover',
|
1039 |
+
SV_WC_Payment_Gateway_Helper::CARD_TYPE_MASTERCARD => 'masterCard',
|
1040 |
+
SV_WC_Payment_Gateway_Helper::CARD_TYPE_VISA => 'visa',
|
1041 |
+
'privateLabel' => 'privateLabel', // ?
|
1042 |
+
);
|
1043 |
+
|
1044 |
+
$networks = array_intersect_key( $valid_networks, array_flip( $accepted_card_types ) );
|
1045 |
+
|
1046 |
+
/**
|
1047 |
+
* Filters the supported Apple Pay networks (card types).
|
1048 |
+
*
|
1049 |
+
* @since 4.7.0
|
1050 |
+
*
|
1051 |
+
* @param array $networks the supported networks
|
1052 |
+
* @param SV_WC_Payment_Gateway_Apple_Pay $handler the Apple Pay handler
|
1053 |
+
*/
|
1054 |
+
return apply_filters( 'sv_wc_apple_pay_supported_networks', array_values( $networks ), $this );
|
1055 |
+
}
|
1056 |
+
|
1057 |
+
|
1058 |
+
/**
|
1059 |
+
* Gets the gateways that declare Apple Pay support.
|
1060 |
+
*
|
1061 |
+
* @since 4.7.0
|
1062 |
+
*
|
1063 |
+
* @return array the supporting gateways as `$gateway_id => SV_WC_Payment_Gateway`
|
1064 |
+
*/
|
1065 |
+
public function get_supporting_gateways() {
|
1066 |
+
|
1067 |
+
$available_gateways = $this->get_plugin()->get_gateways();
|
1068 |
+
$supporting_gateways = array();
|
1069 |
+
|
1070 |
+
foreach ( $available_gateways as $key => $gateway ) {
|
1071 |
+
|
1072 |
+
if ( $gateway->supports_apple_pay() ) {
|
1073 |
+
$supporting_gateways[ $gateway->get_id() ] = $gateway;
|
1074 |
+
}
|
1075 |
+
}
|
1076 |
+
|
1077 |
+
return $supporting_gateways;
|
1078 |
+
}
|
1079 |
+
|
1080 |
+
|
1081 |
+
/**
|
1082 |
+
* Gets the gateway set to process Apple Pay transactions.
|
1083 |
+
*
|
1084 |
+
* @since 4.7.0
|
1085 |
+
*
|
1086 |
+
* @return SV_WC_Payment_Gateway|null
|
1087 |
+
*/
|
1088 |
+
public function get_processing_gateway() {
|
1089 |
+
|
1090 |
+
$gateways = $this->get_supporting_gateways();
|
1091 |
+
|
1092 |
+
$gateway_id = get_option( 'sv_wc_apple_pay_payment_gateway' );
|
1093 |
+
|
1094 |
+
return isset( $gateways[ $gateway_id ] ) ? $gateways[ $gateway_id ] : null;
|
1095 |
+
}
|
1096 |
+
|
1097 |
+
|
1098 |
+
/**
|
1099 |
+
* Gets the Apple Pay button style.
|
1100 |
+
*
|
1101 |
+
* @since 4.7.0
|
1102 |
+
*
|
1103 |
+
* @return string
|
1104 |
+
*/
|
1105 |
+
public function get_button_style() {
|
1106 |
+
|
1107 |
+
return get_option( 'sv_wc_apple_pay_button_style', 'black' );
|
1108 |
+
}
|
1109 |
+
|
1110 |
+
|
1111 |
+
/**
|
1112 |
+
* Gets the gateway plugin instance.
|
1113 |
+
*
|
1114 |
+
* @since 4.7.0
|
1115 |
+
*
|
1116 |
+
* @return SV_WC_Payment_Gateway_Plugin
|
1117 |
+
*/
|
1118 |
+
public function get_plugin() {
|
1119 |
+
|
1120 |
+
return $this->plugin;
|
1121 |
+
}
|
1122 |
+
|
1123 |
+
|
1124 |
+
}
|
1125 |
+
|
1126 |
+
endif;
|
lib/skyverge/woocommerce/payment-gateway/assets/css/admin/sv-wc-payment-gateway-admin-order.min.css
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
#woocommerce-order-items .sv-wc-payment-gateway-partial-capture .capture-actions{margin-top:5px;padding-top:12px;border-top:1px solid #dfdfdf}#woocommerce-order-items .sv-wc-payment-gateway-partial-capture .capture-actions .button{float:right;margin-left:4px}#woocommerce-order-items .sv-wc-payment-gateway-partial-capture .capture-actions .cancel-action{float:left;margin-left:0}
|
lib/skyverge/woocommerce/payment-gateway/assets/css/admin/sv-wc-payment-gateway-admin-order.min.css.map
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"version": 3,
|
3 |
+
"mappings": "AAWC,gFAAwD,CACvD,UAAU,CAAE,GAAG,CACf,WAAW,CAAE,IAAI,CACjB,UAAU,CAAE,iBAAiB,CAE7B,wFAAQ,CACP,KAAK,CAAE,KAAK,CACZ,WAAW,CAAE,GAAG,CAGjB,+FAAe,CACd,KAAK,CAAE,IAAI,CACX,WAAW,CAAE,CAAC",
|
4 |
+
"sources": ["sv-wc-payment-gateway-admin-order.scss"],
|
5 |
+
"names": [],
|
6 |
+
"file": "sv-wc-payment-gateway-admin-order.min.css"
|
7 |
+
}
|
lib/skyverge/woocommerce/payment-gateway/assets/css/admin/sv-wc-payment-gateway-admin-order.scss
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/*
|
2 |
+
WooCommerce SkyVerge Payment Gateway Framework Order Admin SCSS
|
3 |
+
Version 5.0.0
|
4 |
+
|
5 |
+
Copyright (c) 2016-2018, SkyVerge, Inc.
|
6 |
+
Licensed under the GNU General Public License v3.0
|
7 |
+
http://www.gnu.org/licenses/gpl-3.0.html
|
8 |
+
*/
|
9 |
+
|
10 |
+
#woocommerce-order-items {
|
11 |
+
|
12 |
+
.sv-wc-payment-gateway-partial-capture .capture-actions {
|
13 |
+
margin-top: 5px;
|
14 |
+
padding-top: 12px;
|
15 |
+
border-top: 1px solid #dfdfdf;
|
16 |
+
|
17 |
+
.button {
|
18 |
+
float: right;
|
19 |
+
margin-left: 4px;
|
20 |
+
}
|
21 |
+
|
22 |
+
.cancel-action {
|
23 |
+
float: left;
|
24 |
+
margin-left: 0;
|
25 |
+
}
|
26 |
+
}
|
27 |
+
}
|
lib/skyverge/woocommerce/payment-gateway/assets/css/admin/sv-wc-payment-gateway-token-editor.min.css
CHANGED
File without changes
|
lib/skyverge/woocommerce/payment-gateway/assets/css/admin/sv-wc-payment-gateway-token-editor.min.css.map
CHANGED
File without changes
|
lib/skyverge/woocommerce/payment-gateway/assets/css/admin/sv-wc-payment-gateway-token-editor.scss
CHANGED
@@ -1,8 +1,8 @@
|
|
1 |
/*
|
2 |
WooCommerce SkyVerge Payment Gateway Framework Token Editor SCSS
|
3 |
-
Version 4.3.0
|
4 |
|
5 |
-
Copyright (c) 2016, SkyVerge, Inc.
|
6 |
Licensed under the GNU General Public License v3.0
|
7 |
http://www.gnu.org/licenses/gpl-3.0.html
|
8 |
*/
|
1 |
/*
|
2 |
WooCommerce SkyVerge Payment Gateway Framework Token Editor SCSS
|
3 |
+
Version 4.3.0
|
4 |
|
5 |
+
Copyright (c) 2016-2018, SkyVerge, Inc.
|
6 |
Licensed under the GNU General Public License v3.0
|
7 |
http://www.gnu.org/licenses/gpl-3.0.html
|
8 |
*/
|
lib/skyverge/woocommerce/payment-gateway/assets/css/frontend/sv-wc-payment-gateway-apple-pay.css
ADDED
@@ -0,0 +1,121 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
.sv-wc-apple-pay-button {
|
2 |
+
display: none;
|
3 |
+
width: 100%;
|
4 |
+
height: 44px;
|
5 |
+
margin: 0 0 1em 0;
|
6 |
+
}
|
7 |
+
|
8 |
+
@supports ( -webkit-appearance: -apple-pay-button ) {
|
9 |
+
|
10 |
+
.sv-wc-apple-pay-button {
|
11 |
+
-webkit-appearance: -apple-pay-button;
|
12 |
+
}
|
13 |
+
|
14 |
+
.sv-wc-apple-pay-button.apple-pay-button-black {
|
15 |
+
-apple-pay-button-style: black;
|
16 |
+
}
|
17 |
+
|
18 |
+
.sv-wc-apple-pay-button.apple-pay-button-white {
|
19 |
+
-apple-pay-button-style: white;
|
20 |
+
}
|
21 |
+
|
22 |
+
.sv-wc-apple-pay-button.apple-pay-button-white-with-line {
|
23 |
+
-apple-pay-button-style: white-outline;
|
24 |
+
}
|
25 |
+
|
26 |
+
.sv-wc-apple-pay-button.apple-pay-button-buy-now {
|
27 |
+
-apple-pay-button-type: buy;
|
28 |
+
}
|
29 |
+
|
30 |
+
.sv-wc-apple-pay-button.apple-pay-button-buy-now > * {
|
31 |
+
display: none;
|
32 |
+
}
|
33 |
+
}
|
34 |
+
|
35 |
+
@supports not ( -webkit-appearance: -apple-pay-button ) {
|
36 |
+
|
37 |
+
.sv-wc-apple-pay-button {
|
38 |
+
background-size: 100% 60%;
|
39 |
+
background-repeat: no-repeat;
|
40 |
+
background-position: 50% 50%;
|
41 |
+
border-radius: 5px;
|
42 |
+
padding: 0px;
|
43 |
+
box-sizing: border-box;
|
44 |
+
min-width: 100px;
|
45 |
+
min-height: 40px;
|
46 |
+
max-height: 64px;
|
47 |
+
width: 100%;
|
48 |
+
}
|
49 |
+
|
50 |
+
.sv-wc-apple-pay-button.apple-pay-button-black {
|
51 |
+
background-image: -webkit-named-image( apple-pay-logo-white );
|
52 |
+
background-color: black;
|
53 |
+
color: white;
|
54 |
+
}
|
55 |
+
|
56 |
+
.sv-wc-apple-pay-button.apple-pay-button-white,
|
57 |
+
.sv-wc-apple-pay-button.apple-pay-button-white-with-line {
|
58 |
+
background-image: -webkit-named-image( apple-pay-logo-black );
|
59 |
+
background-color: white;
|
60 |
+
color: black;
|
61 |
+
}
|
62 |
+
|
63 |
+
.sv-wc-apple-pay-button.apple-pay-button-white-with-line {
|
64 |
+
border: .5px solid black;
|
65 |
+
}
|
66 |
+
|
67 |
+
.sv-wc-apple-pay-button.apple-pay-button-with-text {
|
68 |
+
--apple-pay-scale: 1; /* (height / 32) */
|
69 |
+
justify-content: center;
|
70 |
+
font-size: 12px;
|
71 |
+
background: none;
|
72 |
+
}
|
73 |
+
|
74 |
+
.sv-wc-apple-pay-button.apple-pay-button-with-text > .text {
|
75 |
+
font-family: -apple-system;
|
76 |
+
font-size: calc( 1em * var( --apple-pay-scale ) );
|
77 |
+
font-weight: 300;
|
78 |
+
align-self: center;
|
79 |
+
margin-right: calc( 2px * var( --apple-pay-scale ) );
|
80 |
+
}
|
81 |
+
|
82 |
+
.sv-wc-apple-pay-button.apple-pay-button-with-text > .logo {
|
83 |
+
width: calc( 35px * var( --scale ) );
|
84 |
+
height: 100%;
|
85 |
+
background-size: 100% 60%;
|
86 |
+
background-repeat: no-repeat;
|
87 |
+
background-position: 0 50%;
|
88 |
+
margin-left: calc( 2px * var( --apple-pay-scale ) );
|
89 |
+
border: none;
|
90 |
+
}
|
91 |
+
|
92 |
+
.sv-wc-apple-pay-button.apple-pay-button-black .apple-pay-button-with-text > .logo {
|
93 |
+
background-image: -webkit-named-image( apple-pay-logo-white );
|
94 |
+
background-color: black;
|
95 |
+
}
|
96 |
+
|
97 |
+
.sv-wc-apple-pay-button.apple-pay-button-white .apple-pay-button-with-text > .logo,
|
98 |
+
.sv-wc-apple-pay-button.apple-pay-button-white-with-line .apple-pay-button-with-text > .logo {
|
99 |
+
background-image: -webkit-named-image( apple-pay-logo-black );
|
100 |
+
background-color: white;
|
101 |
+
}
|
102 |
+
}
|
103 |
+
|
104 |
+
.sv-wc-apply-pay-checkout {
|
105 |
+
display: none;
|
106 |
+
max-width: 510px;
|
107 |
+
margin: 0 auto 2em;
|
108 |
+
text-align: center;
|
109 |
+
}
|
110 |
+
.sv-wc-apply-pay-checkout .sv-wc-apple-pay-button {
|
111 |
+
display: block;
|
112 |
+
}
|
113 |
+
.sv-wc-apply-pay-checkout .divider {
|
114 |
+
font-size: 1.15em;
|
115 |
+
font-style: italic;
|
116 |
+
text-transform: uppercase;
|
117 |
+
}
|
118 |
+
.sv-wc-apply-pay-checkout .divider::before,
|
119 |
+
.sv-wc-apply-pay-checkout .divider::after {
|
120 |
+
content: "\2014";
|
121 |
+
}
|
lib/skyverge/woocommerce/payment-gateway/assets/css/frontend/sv-wc-payment-gateway-my-payment-methods.min.css
CHANGED
@@ -1 +1 @@
|
|
1 |
-
.sv-wc-payment-gateway-my-payment-methods-table-
|
1 |
+
table.sv-wc-payment-gateway-my-payment-methods-table{font-size:0.85em}table.sv-wc-payment-gateway-my-payment-methods-table th,table.sv-wc-payment-gateway-my-payment-methods-table td{vertical-align:middle}table.sv-wc-payment-gateway-my-payment-methods-table .button{white-space:nowrap}table.sv-wc-payment-gateway-my-payment-methods-table .sv-wc-payment-gateway-payment-method-header-details span,table.sv-wc-payment-gateway-my-payment-methods-table .sv-wc-payment-gateway-payment-method-header-default span,table.sv-wc-payment-gateway-my-payment-methods-table .sv-wc-payment-gateway-payment-method-header-actions span{display:none}table.sv-wc-payment-gateway-my-payment-methods-table .sv-wc-payment-gateway-payment-method-header-expiry,table.sv-wc-payment-gateway-my-payment-methods-table .sv-wc-payment-gateway-payment-method-header-default{text-align:center}table.sv-wc-payment-gateway-my-payment-methods-table .sv-wc-payment-gateway-payment-method-header-actions{text-align:right}table.sv-wc-payment-gateway-my-payment-methods-table .sv-wc-payment-gateway-my-payment-methods-method .sv-wc-payment-gateway-payment-method-title input{width:100%}table.sv-wc-payment-gateway-my-payment-methods-table .sv-wc-payment-gateway-my-payment-methods-method .sv-wc-payment-gateway-payment-method-details{white-space:nowrap}table.sv-wc-payment-gateway-my-payment-methods-table .sv-wc-payment-gateway-my-payment-methods-method .sv-wc-payment-gateway-payment-method-details img{width:40px;height:25px;margin-right:0.5em;vertical-align:middle;display:inline !important}table.sv-wc-payment-gateway-my-payment-methods-table .sv-wc-payment-gateway-my-payment-methods-method .sv-wc-payment-gateway-payment-method-expiry{text-align:center}table.sv-wc-payment-gateway-my-payment-methods-table .sv-wc-payment-gateway-my-payment-methods-method .sv-wc-payment-gateway-payment-method-default{text-align:center}table.sv-wc-payment-gateway-my-payment-methods-table .sv-wc-payment-gateway-my-payment-methods-method .sv-wc-payment-gateway-payment-method-default mark{display:inline-block;color:white;background-color:#3d9cd2;font-size:0.75em;text-transform:uppercase;padding:2px 4px;border-radius:2px}table.sv-wc-payment-gateway-my-payment-methods-table .sv-wc-payment-gateway-my-payment-methods-method .sv-wc-payment-gateway-payment-method-actions{text-align:right}table.sv-wc-payment-gateway-my-payment-methods-table .sv-wc-payment-gateway-my-payment-methods-method .sv-wc-payment-gateway-payment-method-actions .button{margin:.125em 0 .125em .25em}table.sv-wc-payment-gateway-my-payment-methods-table .sv-wc-payment-gateway-my-payment-methods-method .sv-wc-payment-gateway-payment-method-actions .button.disabled.tip:hover{cursor:help}table.sv-wc-payment-gateway-my-payment-methods-table .sv-wc-payment-gateway-my-payment-methods-method .cancel-edit-payment-method{margin-right:0.5em}table.sv-wc-payment-gateway-my-payment-methods-table.editing .sv-wc-payment-gateway-payment-method-header-default span{display:inline}table.sv-wc-payment-gateway-my-payment-methods-table.editing .sv-wc-payment-gateway-my-payment-methods-method:not(.editing),table.sv-wc-payment-gateway-my-payment-methods-table.editing .sv-wc-payment-gateway-my-payment-methods-type-divider{opacity:0.5}table.sv-wc-payment-gateway-my-payment-methods-table.editing .sv-wc-payment-gateway-my-payment-methods-method:hover{opacity:1}table.sv-wc-payment-gateway-my-payment-methods-table tr.sv-wc-payment-gateway-my-payment-methods-type-divider td{font-weight:700}table.sv-wc-payment-gateway-my-payment-methods-table .error td{color:white;text-align:center;background-color:#e26838;border-radius:0 0 3px 3px;padding:5px}#tiptip_holder{display:none;position:absolute;top:0;left:0;z-index:99999}#tiptip_holder.tip_top{padding-bottom:5px}#tiptip_holder.tip_top #tiptip_arrow_inner{margin-top:-7px;margin-left:-6px;border-top-color:#464646}#tiptip_holder.tip_bottom{padding-top:5px}#tiptip_holder.tip_bottom #tiptip_arrow_inner{margin-top:-5px;margin-left:-6px;border-bottom-color:#464646}#tiptip_holder.tip_right{padding-left:5px}#tiptip_holder.tip_right #tiptip_arrow_inner{margin-top:-6px;margin-left:-5px;border-right-color:#464646}#tiptip_holder.tip_left{padding-right:5px}#tiptip_holder.tip_left #tiptip_arrow_inner{margin-top:-6px;margin-left:-7px;border-left-color:#464646}#tiptip_content,.chart-tooltip{font-size:11px;color:#fff;padding:.5em .5em;background:#464646;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px;-webkit-box-shadow:1px 1px 3px rgba(0,0,0,0.1);-moz-box-shadow:1px 1px 3px rgba(0,0,0,0.1);box-shadow:1px 1px 3px rgba(0,0,0,0.1);text-align:center;max-width:150px}#tiptip_content code,.chart-tooltip code{background:#888;padding:1px}#tiptip_arrow,#tiptip_arrow_inner{position:absolute;border-color:transparent;border-style:solid;border-width:6px;height:0;width:0}@media screen and (max-width: 768px){table.sv-wc-payment-gateway-my-payment-methods-table .sv-wc-payment-gateway-my-payment-methods-method .sv-wc-payment-gateway-payment-method-expiry,table.sv-wc-payment-gateway-my-payment-methods-table .sv-wc-payment-gateway-my-payment-methods-method .sv-wc-payment-gateway-payment-method-default{text-align:right}table.sv-wc-payment-gateway-my-payment-methods-table .sv-wc-payment-gateway-my-payment-methods-method .sv-wc-payment-gateway-payment-method-actions{text-align:right}table.sv-wc-payment-gateway-my-payment-methods-table .sv-wc-payment-gateway-my-payment-methods-method .sv-wc-payment-gateway-payment-method-actions:before{display:none}table.sv-wc-payment-gateway-my-payment-methods-table .sv-wc-payment-gateway-my-payment-methods-method .sv-wc-payment-gateway-payment-method-actions .button{float:none;margin:.125em .25em .125em 0}table.sv-wc-payment-gateway-my-payment-methods-table .sv-wc-payment-gateway-my-payment-methods-type-divider td:before{display:none}}
|
lib/skyverge/woocommerce/payment-gateway/assets/css/frontend/sv-wc-payment-gateway-my-payment-methods.min.css.map
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
{
|
2 |
"version": 3,
|
3 |
-
"mappings": "
|
4 |
"sources": ["sv-wc-payment-gateway-my-payment-methods.scss"],
|
5 |
"names": [],
|
6 |
"file": "sv-wc-payment-gateway-my-payment-methods.min.css"
|
1 |
{
|
2 |
"version": 3,
|
3 |
+
"mappings": "AAWA,oDAAqD,CACpD,SAAS,CAAE,MAAM,CAEjB,+GAAO,CACN,cAAc,CAAE,MAAM,CAGvB,4DAAQ,CACP,WAAW,CAAE,MAAM,CAGpB,4UAE0D,CACzD,OAAO,CAAE,IAAI,CAGd,kNACqD,CACpD,UAAU,CAAE,MAAM,CAGnB,yGAAqD,CACpD,UAAU,CAAE,KAAK,CAKjB,uJAAkD,CACjD,KAAK,CAAE,IAAI,CAGZ,mJAA8C,CAC7C,WAAW,CAAE,MAAM,CAEnB,uJAAI,CACH,KAAK,CAAE,IAAI,CACX,MAAM,CAAE,IAAI,CACZ,YAAY,CAAE,KAAK,CACnB,cAAc,CAAE,MAAM,CACtB,OAAO,CAAE,iBAAiB,CAI5B,kJAA6C,CAC5C,UAAU,CAAE,MAAM,CAGnB,mJAA8C,CAC7C,UAAU,CAAE,MAAM,CAElB,wJAAK,CACJ,OAAO,CAAE,YAAY,CACrB,KAAK,CAAE,KAAK,CACZ,gBAAgB,CAAE,OAAO,CACzB,SAAS,CAAE,MAAM,CACjB,cAAc,CAAE,SAAS,CACzB,OAAO,CAAE,OAAO,CAChB,aAAa,CAAE,GAAG,CAIpB,mJAA8C,CAC7C,UAAU,CAAE,KAAK,CAEjB,2JAAQ,CACP,MAAM,CAAE,qBAAqB,CAE7B,8KAAqB,CACpB,MAAM,CAAE,IAAI,CAKf,iIAA4B,CAC3B,YAAY,CAAE,KAAK,CAMpB,sHAA0D,CACzD,OAAO,CAAE,MAAM,CAGhB,+OACuD,CACtD,OAAO,CAAE,GAAG,CAGb,mHAAuD,CACtD,OAAO,CAAE,CAAC,CAIZ,gHAA4D,CAC3D,WAAW,CAAE,GAAG,CAGjB,8DAAU,CACT,KAAK,CAAE,KAAK,CACZ,UAAU,CAAE,MAAM,CAClB,gBAAgB,CAAE,OAAO,CACzB,aAAa,CAAE,WAAW,CAC1B,OAAO,CAAE,GAAG,CAId,cAAe,CACd,OAAO,CAAE,IAAI,CACb,QAAQ,CAAE,QAAQ,CAClB,GAAG,CAAE,CAAC,CACN,IAAI,CAAE,CAAC,CACP,OAAO,CAAE,KAAK,CAEd,sBAAU,CACT,cAAc,CAAE,GAAG,CAEnB,0CAAoB,CACnB,UAAU,CAAE,IAAI,CAChB,WAAW,CAAE,IAAI,CACjB,gBAAgB,CAAE,OAAO,CAI3B,yBAAa,CACZ,WAAW,CAAE,GAAG,CAEhB,6CAAoB,CACnB,UAAU,CAAE,IAAI,CAChB,WAAW,CAAE,IAAI,CACjB,mBAAmB,CAAE,OAAO,CAI9B,wBAAY,CACX,YAAY,CAAE,GAAG,CAEjB,4CAAoB,CACnB,UAAU,CAAE,IAAI,CAChB,WAAW,CAAE,IAAI,CACjB,kBAAkB,CAAE,OAAO,CAI7B,uBAAW,CACV,aAAa,CAAE,GAAG,CAElB,2CAAoB,CACnB,UAAU,CAAE,IAAI,CAChB,WAAW,CAAE,IAAI,CACjB,iBAAiB,CAAE,OAAO,CAK7B,8BACe,CACd,SAAS,CAAC,IAAI,CACd,KAAK,CAAC,IAAI,CACV,OAAO,CAAC,SAAS,CACjB,UAAU,CAAC,OAAO,CAClB,qBAAqB,CAAC,GAAG,CACzB,kBAAkB,CAAC,GAAG,CACtB,aAAa,CAAC,GAAG,CACjB,kBAAkB,CAAC,2BAA2B,CAC9C,eAAe,CAAC,2BAA2B,CAC3C,UAAU,CAAC,2BAA2B,CACtC,UAAU,CAAC,MAAM,CACjB,SAAS,CAAC,KAAK,CAEhB,wCACoB,CACnB,UAAU,CAAC,IAAI,CACf,OAAO,CAAC,GAAG,CAEZ,iCACoB,CACnB,QAAQ,CAAC,QAAQ,CACjB,YAAY,CAAC,WAAW,CACxB,YAAY,CAAC,KAAK,CAClB,YAAY,CAAC,GAAG,CAChB,MAAM,CAAC,CAAC,CACR,KAAK,CAAC,CAAC,CAGR,oCAAqC,CAMlC,sSAC8C,CAC7C,UAAU,CAAE,KAAK,CAGlB,mJAA8C,CAC7C,UAAU,CAAE,KAAK,CAEjB,0JAAS,CACR,OAAO,CAAE,IAAI,CAGd,2JAAQ,CACP,KAAK,CAAE,IAAI,CACX,MAAM,CAAE,qBAAqB,CAKhC,qHAAiE,CAChE,OAAO,CAAE,IAAI",
|
4 |
"sources": ["sv-wc-payment-gateway-my-payment-methods.scss"],
|
5 |
"names": [],
|
6 |
"file": "sv-wc-payment-gateway-my-payment-methods.min.css"
|
lib/skyverge/woocommerce/payment-gateway/assets/css/frontend/sv-wc-payment-gateway-my-payment-methods.scss
CHANGED
@@ -1,27 +1,13 @@
|
|
1 |
/*
|
2 |
WooCommerce SkyVerge Payment Gateway Framework My Payment Methods SCSS
|
3 |
-
Version 4.3.0
|
4 |
|
5 |
-
Copyright (c) 2015-
|
6 |
Licensed under the GNU General Public License v3.0
|
7 |
http://www.gnu.org/licenses/gpl-3.0.html
|
8 |
*/
|
9 |
-
|
10 |
-
|
11 |
-
margin: 1.5em 0;
|
12 |
-
h2 {
|
13 |
-
display: inline;
|
14 |
-
}
|
15 |
-
a.button {
|
16 |
-
float: right;
|
17 |
-
line-height: 1.5;
|
18 |
-
padding-left: .8em;
|
19 |
-
padding-right: .8em;
|
20 |
-
&:before {
|
21 |
-
margin-right: 5px;
|
22 |
-
}
|
23 |
-
}
|
24 |
-
}
|
25 |
|
26 |
table.sv-wc-payment-gateway-my-payment-methods-table {
|
27 |
font-size: 0.85em;
|
@@ -34,29 +20,101 @@ table.sv-wc-payment-gateway-my-payment-methods-table {
|
|
34 |
white-space: nowrap;
|
35 |
}
|
36 |
|
37 |
-
.sv-wc-payment-gateway-payment-method-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
|
|
|
|
|
|
43 |
}
|
44 |
|
45 |
-
|
46 |
text-align: right;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
47 |
|
48 |
-
.
|
49 |
-
|
50 |
|
51 |
-
|
52 |
-
|
|
|
|
|
|
|
|
|
53 |
}
|
54 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
55 |
}
|
56 |
|
57 |
tr.sv-wc-payment-gateway-my-payment-methods-type-divider td {
|
58 |
font-weight: 700;
|
59 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
60 |
}
|
61 |
|
62 |
#tiptip_holder {
|
@@ -141,20 +199,28 @@ table.sv-wc-payment-gateway-my-payment-methods-table {
|
|
141 |
|
142 |
table.sv-wc-payment-gateway-my-payment-methods-table {
|
143 |
|
144 |
-
|
145 |
-
text-align: left;
|
146 |
|
147 |
-
|
148 |
-
|
|
|
149 |
}
|
150 |
|
151 |
-
.
|
152 |
-
|
153 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
154 |
}
|
155 |
}
|
156 |
|
157 |
-
|
158 |
display: none;
|
159 |
}
|
160 |
}
|
1 |
/*
|
2 |
WooCommerce SkyVerge Payment Gateway Framework My Payment Methods SCSS
|
3 |
+
Version 4.3.0
|
4 |
|
5 |
+
Copyright (c) 2015-2018, SkyVerge, Inc.
|
6 |
Licensed under the GNU General Public License v3.0
|
7 |
http://www.gnu.org/licenses/gpl-3.0.html
|
8 |
*/
|
9 |
+
|
10 |
+
@import '../../../../assets/css/mixins';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
11 |
|
12 |
table.sv-wc-payment-gateway-my-payment-methods-table {
|
13 |
font-size: 0.85em;
|
20 |
white-space: nowrap;
|
21 |
}
|
22 |
|
23 |
+
.sv-wc-payment-gateway-payment-method-header-details span,
|
24 |
+
.sv-wc-payment-gateway-payment-method-header-default span,
|
25 |
+
.sv-wc-payment-gateway-payment-method-header-actions span {
|
26 |
+
display: none;
|
27 |
+
}
|
28 |
+
|
29 |
+
.sv-wc-payment-gateway-payment-method-header-expiry,
|
30 |
+
.sv-wc-payment-gateway-payment-method-header-default {
|
31 |
+
text-align: center;
|
32 |
}
|
33 |
|
34 |
+
.sv-wc-payment-gateway-payment-method-header-actions {
|
35 |
text-align: right;
|
36 |
+
}
|
37 |
+
|
38 |
+
.sv-wc-payment-gateway-my-payment-methods-method {
|
39 |
+
|
40 |
+
.sv-wc-payment-gateway-payment-method-title input {
|
41 |
+
width: 100%;
|
42 |
+
}
|
43 |
+
|
44 |
+
.sv-wc-payment-gateway-payment-method-details {
|
45 |
+
white-space: nowrap;
|
46 |
+
|
47 |
+
img {
|
48 |
+
width: 40px;
|
49 |
+
height: 25px;
|
50 |
+
margin-right: 0.5em;
|
51 |
+
vertical-align: middle;
|
52 |
+
display: inline !important;
|
53 |
+
}
|
54 |
+
}
|
55 |
+
|
56 |
+
.sv-wc-payment-gateway-payment-method-expiry {
|
57 |
+
text-align: center;
|
58 |
+
}
|
59 |
+
|
60 |
+
.sv-wc-payment-gateway-payment-method-default {
|
61 |
+
text-align: center;
|
62 |
+
|
63 |
+
mark {
|
64 |
+
display: inline-block;
|
65 |
+
color: white;
|
66 |
+
background-color: #3d9cd2;
|
67 |
+
font-size: 0.75em;
|
68 |
+
text-transform: uppercase;
|
69 |
+
padding: 2px 4px;
|
70 |
+
border-radius: 2px;
|
71 |
+
}
|
72 |
+
}
|
73 |
|
74 |
+
.sv-wc-payment-gateway-payment-method-actions {
|
75 |
+
text-align: right;
|
76 |
|
77 |
+
.button {
|
78 |
+
margin: .125em 0 .125em .25em;
|
79 |
+
|
80 |
+
&.disabled.tip:hover {
|
81 |
+
cursor: help;
|
82 |
+
}
|
83 |
}
|
84 |
}
|
85 |
+
|
86 |
+
.cancel-edit-payment-method {
|
87 |
+
margin-right: 0.5em;
|
88 |
+
}
|
89 |
+
}
|
90 |
+
|
91 |
+
&.editing {
|
92 |
+
|
93 |
+
.sv-wc-payment-gateway-payment-method-header-default span {
|
94 |
+
display: inline;
|
95 |
+
}
|
96 |
+
|
97 |
+
.sv-wc-payment-gateway-my-payment-methods-method:not(.editing),
|
98 |
+
.sv-wc-payment-gateway-my-payment-methods-type-divider {
|
99 |
+
opacity: 0.5;
|
100 |
+
}
|
101 |
+
|
102 |
+
.sv-wc-payment-gateway-my-payment-methods-method:hover {
|
103 |
+
opacity: 1;
|
104 |
+
}
|
105 |
}
|
106 |
|
107 |
tr.sv-wc-payment-gateway-my-payment-methods-type-divider td {
|
108 |
font-weight: 700;
|
109 |
}
|
110 |
+
|
111 |
+
.error td {
|
112 |
+
color: white;
|
113 |
+
text-align: center;
|
114 |
+
background-color: #e26838;
|
115 |
+
border-radius: 0 0 3px 3px;
|
116 |
+
padding: 5px;
|
117 |
+
}
|
118 |
}
|
119 |
|
120 |
#tiptip_holder {
|
199 |
|
200 |
table.sv-wc-payment-gateway-my-payment-methods-table {
|
201 |
|
202 |
+
.sv-wc-payment-gateway-my-payment-methods-method {
|
|
|
203 |
|
204 |
+
.sv-wc-payment-gateway-payment-method-expiry,
|
205 |
+
.sv-wc-payment-gateway-payment-method-default {
|
206 |
+
text-align: right;
|
207 |
}
|
208 |
|
209 |
+
.sv-wc-payment-gateway-payment-method-actions {
|
210 |
+
text-align: right;
|
211 |
+
|
212 |
+
&:before {
|
213 |
+
display: none;
|
214 |
+
}
|
215 |
+
|
216 |
+
.button {
|
217 |
+
float: none;
|
218 |
+
margin: .125em .25em .125em 0;
|
219 |
+
}
|
220 |
}
|
221 |
}
|
222 |
|
223 |
+
.sv-wc-payment-gateway-my-payment-methods-type-divider td:before {
|
224 |
display: none;
|
225 |
}
|
226 |
}
|
lib/skyverge/woocommerce/payment-gateway/assets/css/frontend/sv-wc-payment-gateway-payment-form.min.css
CHANGED
@@ -1 +1 @@
|
|
1 |
-
|
1 |
+
.woocommerce-checkout #payment div.payment_box .sv-wc-payment-gateway-payment-form-manage-payment-methods,#add_payment_method .sv-wc-payment-gateway-payment-form-manage-payment-methods{display:block;margin:1em 0;text-align:center}.woocommerce-checkout #payment div.payment_box .sv-wc-payment-gateway-payment-form-saved-payment-method,#add_payment_method .sv-wc-payment-gateway-payment-form-saved-payment-method{display:inline-block;margin-bottom:.5em}.woocommerce-checkout #payment div.payment_box .sv-wc-payment-gateway-payment-form-saved-payment-method .nickname,#add_payment_method .sv-wc-payment-gateway-payment-form-saved-payment-method .nickname{margin-right:.5em}.woocommerce-checkout #payment div.payment_box .sv-wc-payment-gateway-payment-form-saved-payment-method img,#add_payment_method .sv-wc-payment-gateway-payment-form-saved-payment-method img{float:none;width:30px;height:20px;display:inline-block;margin-right:.5em;vertical-align:middle}.woocommerce-checkout #payment div.payment_box input.js-sv-wc-payment-gateway-credit-card-form-input[type="tel"],.woocommerce-checkout #payment div.payment_box input.js-sv-wc-payment-gateway-credit-card-form-input[type="text"],.woocommerce-checkout #payment div.payment_box input.js-sv-wc-payment-gateway-echeck-form-input[type="tel"],.woocommerce-checkout #payment div.payment_box input.js-sv-wc-payment-gateway-echeck-form-input[type="text"],.woocommerce-checkout #payment div.payment_box input.js-sv-wc-payment-gateway-form-nickname,#add_payment_method input.js-sv-wc-payment-gateway-credit-card-form-input[type="tel"],#add_payment_method input.js-sv-wc-payment-gateway-credit-card-form-input[type="text"],#add_payment_method input.js-sv-wc-payment-gateway-echeck-form-input[type="tel"],#add_payment_method input.js-sv-wc-payment-gateway-echeck-form-input[type="text"],#add_payment_method input.js-sv-wc-payment-gateway-form-nickname{font-size:1.5em;padding:8px}.woocommerce-checkout #payment div.payment_box input.js-sv-wc-payment-gateway-credit-card-form-input[type="tel"]:focus,.woocommerce-checkout #payment div.payment_box input.js-sv-wc-payment-gateway-credit-card-form-input[type="text"]:focus,#add_payment_method input.js-sv-wc-payment-gateway-credit-card-form-input[type="tel"]:focus,#add_payment_method input.js-sv-wc-payment-gateway-credit-card-form-input[type="text"]:focus{box-shadow:0 0 .1875em #3498db}.woocommerce-checkout #payment div.payment_box input.js-sv-wc-payment-gateway-credit-card-form-input[type="tel"].identified,.woocommerce-checkout #payment div.payment_box input.js-sv-wc-payment-gateway-credit-card-form-input[type="text"].identified,#add_payment_method input.js-sv-wc-payment-gateway-credit-card-form-input[type="tel"].identified,#add_payment_method input.js-sv-wc-payment-gateway-credit-card-form-input[type="text"].identified{border-color:#69bf29}.woocommerce-checkout #payment div.payment_box input.js-sv-wc-payment-gateway-credit-card-form-input[type="tel"].identified:focus,.woocommerce-checkout #payment div.payment_box input.js-sv-wc-payment-gateway-credit-card-form-input[type="text"].identified:focus,#add_payment_method input.js-sv-wc-payment-gateway-credit-card-form-input[type="tel"].identified:focus,#add_payment_method input.js-sv-wc-payment-gateway-credit-card-form-input[type="text"].identified:focus{box-shadow:0 0 .1875em #69bf29}.woocommerce-checkout #payment div.payment_box input.js-sv-wc-payment-gateway-credit-card-form-account-number,#add_payment_method input.js-sv-wc-payment-gateway-credit-card-form-account-number{background-image:url("../../images/card-cc-plain.svg");background-repeat:no-repeat;background-position:right 10px center;background-size:50px 31px}.woocommerce-checkout #payment div.payment_box input.js-sv-wc-payment-gateway-credit-card-form-account-number.visa,#add_payment_method input.js-sv-wc-payment-gateway-credit-card-form-account-number.visa{background-image:url("../../images/card-visa.svg")}.woocommerce-checkout #payment div.payment_box input.js-sv-wc-payment-gateway-credit-card-form-account-number.mastercard,#add_payment_method input.js-sv-wc-payment-gateway-credit-card-form-account-number.mastercard{background-image:url("../../images/card-mastercard.svg")}.woocommerce-checkout #payment div.payment_box input.js-sv-wc-payment-gateway-credit-card-form-account-number.dinersclub,#add_payment_method input.js-sv-wc-payment-gateway-credit-card-form-account-number.dinersclub{background-image:url("../../images/card-dinersclub.svg")}.woocommerce-checkout #payment div.payment_box input.js-sv-wc-payment-gateway-credit-card-form-account-number.maestro,#add_payment_method input.js-sv-wc-payment-gateway-credit-card-form-account-number.maestro{background-image:url("../../images/card-maestro.svg")}.woocommerce-checkout #payment div.payment_box input.js-sv-wc-payment-gateway-credit-card-form-account-number.jcb,#add_payment_method input.js-sv-wc-payment-gateway-credit-card-form-account-number.jcb{background-image:url("../../images/card-jcb.svg")}.woocommerce-checkout #payment div.payment_box input.js-sv-wc-payment-gateway-credit-card-form-account-number.amex,#add_payment_method input.js-sv-wc-payment-gateway-credit-card-form-account-number.amex{background-image:url("../../images/card-amex.svg")}.woocommerce-checkout #payment div.payment_box input.js-sv-wc-payment-gateway-credit-card-form-account-number.discover,#add_payment_method input.js-sv-wc-payment-gateway-credit-card-form-account-number.discover{background-image:url("../../images/card-discover.svg")}.woocommerce-checkout #payment div.payment_box input.js-sv-wc-payment-gateway-credit-card-form-account-number.visaelectron,#add_payment_method input.js-sv-wc-payment-gateway-credit-card-form-account-number.visaelectron{background-image:url("../../images/card-visa-electron.svg")}.woocommerce-checkout #payment div.payment_box input.js-sv-wc-payment-gateway-credit-card-form-account-number.invalid-card-type,#add_payment_method input.js-sv-wc-payment-gateway-credit-card-form-account-number.invalid-card-type{background-image:url("../../images/card-cc-invalid.svg")}.woocommerce-checkout #payment div.payment_box .js-sv-wc-payment-gateway-echeck-form-check-hint,#add_payment_method .js-sv-wc-payment-gateway-echeck-form-check-hint{margin:0 0 3px 2px;cursor:pointer}.woocommerce-checkout #payment div.payment_box .js-sv-wc-payment-gateway-echeck-form-sample-check,#add_payment_method .js-sv-wc-payment-gateway-echeck-form-sample-check{margin:1em}.woocommerce-checkout #payment div.payment_box .js-sv-wc-payment-gateway-echeck-form-sample-check img,#add_payment_method .js-sv-wc-payment-gateway-echeck-form-sample-check img{min-height:135px}#add_payment_method ul.payment_methods li{list-style-type:none}#add_payment_method ul.payment_methods li img{vertical-align:middle;margin:-2px 0 0 .5em;padding:0;position:relative;box-shadow:none}#add_payment_method ul.payment_methods li img+img{margin-left:2px}
|
lib/skyverge/woocommerce/payment-gateway/assets/css/frontend/sv-wc-payment-gateway-payment-form.min.css.map
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"version": 3,
|
3 |
+
"mappings": "AAYC,wLAA2D,CAC1D,OAAO,CAAE,KAAK,CACd,MAAM,CAAE,KAAK,CACb,UAAU,CAAE,MAAM,CAGnB,oLAAyD,CACxD,OAAO,CAAE,YAAY,CACrB,aAAa,CAAE,IAAI,CAEnB,wMAAU,CACT,YAAY,CAAE,IAAI,CAGnB,4LAAI,CACH,KAAK,CAAE,IAAI,CACX,KAAK,CAAE,IAAI,CACX,MAAM,CAAE,IAAI,CACZ,OAAO,CAAE,YAAY,CACrB,YAAY,CAAE,IAAI,CAClB,cAAc,CAAE,MAAM,CAKxB,w6BAI6C,CAC5C,SAAS,CAAE,KAAK,CAChB,OAAO,CAAE,GAAG,CAOZ,uaAAQ,CACP,UAAU,CAAE,mBAAmB,CAGhC,2bAAa,CACZ,YAAY,CAAE,OAAO,CACrB,mdAAQ,CACP,UAAU,CAAE,mBAAmB,CAMlC,gMAA+D,CAE9D,gBAAgB,CAAE,qCAAqC,CACvD,iBAAiB,CAAE,SAAS,CAC5B,mBAAmB,CAAE,iBAAiB,CACtC,eAAe,CAAE,SAAS,CAE1B,0MAAO,CACN,gBAAgB,CAAE,iCAAiC,CAGpD,sNAAa,CACZ,gBAAgB,CAAE,uCAAuC,CAG1D,sNAAa,CACZ,gBAAgB,CAAE,uCAAuC,CAG1D,gNAAU,CACT,gBAAgB,CAAE,oCAAoC,CAGvD,wMAAM,CACL,gBAAgB,CAAE,gCAAgC,CAGnD,0MAAO,CACN,gBAAgB,CAAE,iCAAiC,CAGpD,kNAAW,CACV,gBAAgB,CAAE,qCAAqC,CAGxD,0NAAe,CACd,gBAAgB,CAAE,0CAA0C,CAG7D,oOAAoB,CACnB,gBAAgB,CAAE,uCAAuC,CAI3D,oKAAiD,CAChD,MAAM,CAAE,WAAW,CACnB,MAAM,CAAE,OAAO,CAGhB,wKAAmD,CAClD,MAAM,CAAE,GAAG,CACX,gLAAI,CACH,UAAU,CAAE,KAAK,CAOnB,yCAAsB,CACrB,eAAe,CAAE,IAAI,CACrB,6CAAI,CACH,cAAc,CAAE,MAAM,CACtB,MAAM,CAAE,aAAa,CACrB,OAAO,CAAE,CAAC,CACV,QAAQ,CAAE,QAAQ,CAClB,UAAU,CAAE,IAAI,CAChB,iDAAQ,CACP,WAAW,CAAE,GAAG",
|
4 |
+
"sources": ["sv-wc-payment-gateway-payment-form.scss"],
|
5 |
+
"names": [],
|
6 |
+
"file": "sv-wc-payment-gateway-payment-form.min.css"
|
7 |
+
}
|
lib/skyverge/woocommerce/payment-gateway/assets/css/frontend/sv-wc-payment-gateway-payment-form.scss
CHANGED
@@ -1,8 +1,8 @@
|
|
1 |
/*
|
2 |
WooCommerce SkyVerge Payment Gateway Framework Payment Form SCSS
|
3 |
-
Version 4.3.0
|
4 |
|
5 |
-
Copyright (c) 2015-
|
6 |
Licensed under the GNU General Public License v3.0
|
7 |
http://www.gnu.org/licenses/gpl-3.0.html
|
8 |
*/
|
@@ -12,16 +12,25 @@ http://www.gnu.org/licenses/gpl-3.0.html
|
|
12 |
|
13 |
.sv-wc-payment-gateway-payment-form-manage-payment-methods {
|
14 |
display: block;
|
15 |
-
margin:
|
16 |
text-align: center;
|
17 |
}
|
18 |
|
19 |
.sv-wc-payment-gateway-payment-form-saved-payment-method {
|
20 |
-
display: inline;
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
img {
|
|
|
22 |
width: 30px;
|
23 |
height: 20px;
|
|
|
24 |
margin-right: .5em;
|
|
|
25 |
}
|
26 |
}
|
27 |
|
@@ -29,7 +38,8 @@ http://www.gnu.org/licenses/gpl-3.0.html
|
|
29 |
input.js-sv-wc-payment-gateway-credit-card-form-input[type="tel"],
|
30 |
input.js-sv-wc-payment-gateway-credit-card-form-input[type="text"],
|
31 |
input.js-sv-wc-payment-gateway-echeck-form-input[type="tel"],
|
32 |
-
input.js-sv-wc-payment-gateway-echeck-form-input[type="text"]
|
|
|
33 |
font-size: 1.5em;
|
34 |
padding: 8px;
|
35 |
}
|
1 |
/*
|
2 |
WooCommerce SkyVerge Payment Gateway Framework Payment Form SCSS
|
3 |
+
Version 4.3.0
|
4 |
|
5 |
+
Copyright (c) 2015-2018, SkyVerge, Inc.
|
6 |
Licensed under the GNU General Public License v3.0
|
7 |
http://www.gnu.org/licenses/gpl-3.0.html
|
8 |
*/
|
12 |
|
13 |
.sv-wc-payment-gateway-payment-form-manage-payment-methods {
|
14 |
display: block;
|
15 |
+
margin: 1em 0;
|
16 |
text-align: center;
|
17 |
}
|
18 |
|
19 |
.sv-wc-payment-gateway-payment-form-saved-payment-method {
|
20 |
+
display: inline-block;
|
21 |
+
margin-bottom: .5em;
|
22 |
+
|
23 |
+
.nickname {
|
24 |
+
margin-right: .5em;
|
25 |
+
}
|
26 |
+
|
27 |
img {
|
28 |
+
float: none;
|
29 |
width: 30px;
|
30 |
height: 20px;
|
31 |
+
display: inline-block;
|
32 |
margin-right: .5em;
|
33 |
+
vertical-align: middle;
|
34 |
}
|
35 |
}
|
36 |
|
38 |
input.js-sv-wc-payment-gateway-credit-card-form-input[type="tel"],
|
39 |
input.js-sv-wc-payment-gateway-credit-card-form-input[type="text"],
|
40 |
input.js-sv-wc-payment-gateway-echeck-form-input[type="tel"],
|
41 |
+
input.js-sv-wc-payment-gateway-echeck-form-input[type="text"],
|
42 |
+
input.js-sv-wc-payment-gateway-form-nickname {
|
43 |
font-size: 1.5em;
|
44 |
padding: 8px;
|
45 |
}
|
lib/skyverge/woocommerce/payment-gateway/assets/images/card-amazon.png
CHANGED
File without changes
|
lib/skyverge/woocommerce/payment-gateway/assets/images/card-amazon.svg
CHANGED
File without changes
|
lib/skyverge/woocommerce/payment-gateway/assets/images/card-amex.png
CHANGED
File without changes
|
lib/skyverge/woocommerce/payment-gateway/assets/images/card-amex.svg
CHANGED
File without changes
|
lib/skyverge/woocommerce/payment-gateway/assets/images/card-cartebleue.png
CHANGED
File without changes
|
lib/skyverge/woocommerce/payment-gateway/assets/images/card-cartebleue.svg
CHANGED
File without changes
|
lib/skyverge/woocommerce/payment-gateway/assets/images/card-cc-invalid.png
CHANGED
File without changes
|
lib/skyverge/woocommerce/payment-gateway/assets/images/card-cc-invalid.svg
CHANGED
File without changes
|
lib/skyverge/woocommerce/payment-gateway/assets/images/card-cc-plain.png
CHANGED
File without changes
|
lib/skyverge/woocommerce/payment-gateway/assets/images/card-cc-plain.svg
CHANGED
File without changes
|
lib/skyverge/woocommerce/payment-gateway/assets/images/card-cirrus.png
CHANGED
File without changes
|
lib/skyverge/woocommerce/payment-gateway/assets/images/card-cirrus.svg
CHANGED
File without changes
|
lib/skyverge/woocommerce/payment-gateway/assets/images/card-dinersclub.png
CHANGED
File without changes
|
lib/skyverge/woocommerce/payment-gateway/assets/images/card-dinersclub.svg
CHANGED
File without changes
|
lib/skyverge/woocommerce/payment-gateway/assets/images/card-discover.png
CHANGED
File without changes
|
lib/skyverge/woocommerce/payment-gateway/assets/images/card-discover.svg
CHANGED
File without changes
|
lib/skyverge/woocommerce/payment-gateway/assets/images/card-echeck.png
CHANGED
File without changes
|
lib/skyverge/woocommerce/payment-gateway/assets/images/card-echeck.svg
CHANGED
File without changes
|
lib/skyverge/woocommerce/payment-gateway/assets/images/card-google.png
CHANGED
File without changes
|
lib/skyverge/woocommerce/payment-gateway/assets/images/card-google.svg
CHANGED
File without changes
|
lib/skyverge/woocommerce/payment-gateway/assets/images/card-jcb.png
CHANGED
File without changes
|
lib/skyverge/woocommerce/payment-gateway/assets/images/card-jcb.svg
CHANGED
File without changes
|
lib/skyverge/woocommerce/payment-gateway/assets/images/card-laser.png
CHANGED
File without changes
|
lib/skyverge/woocommerce/payment-gateway/assets/images/card-laser.svg
CHANGED
File without changes
|
lib/skyverge/woocommerce/payment-gateway/assets/images/card-maestro.png
CHANGED
File without changes
|
lib/skyverge/woocommerce/payment-gateway/assets/images/card-maestro.svg
CHANGED
File without changes
|
lib/skyverge/woocommerce/payment-gateway/assets/images/card-mastercard.png
CHANGED
File without changes
|
lib/skyverge/woocommerce/payment-gateway/assets/images/card-mastercard.svg
CHANGED
File without changes
|
lib/skyverge/woocommerce/payment-gateway/assets/images/card-moneybookers.png
CHANGED
File without changes
|
lib/skyverge/woocommerce/payment-gateway/assets/images/card-moneybookers.svg
CHANGED
File without changes
|
lib/skyverge/woocommerce/payment-gateway/assets/images/card-paypal.png
CHANGED
File without changes
|
lib/skyverge/woocommerce/payment-gateway/assets/images/card-paypal.svg
CHANGED
File without changes
|
lib/skyverge/woocommerce/payment-gateway/assets/images/card-solo.png
CHANGED
File without changes
|
lib/skyverge/woocommerce/payment-gateway/assets/images/card-solo.svg
CHANGED
File without changes
|
lib/skyverge/woocommerce/payment-gateway/assets/images/card-switch.png
CHANGED
File without changes
|
lib/skyverge/woocommerce/payment-gateway/assets/images/card-switch.svg
CHANGED
File without changes
|
lib/skyverge/woocommerce/payment-gateway/assets/images/card-visa-debit.png
CHANGED
File without changes
|
lib/skyverge/woocommerce/payment-gateway/assets/images/card-visa-debit.svg
CHANGED
File without changes
|
lib/skyverge/woocommerce/payment-gateway/assets/images/card-visa-electron.png
CHANGED
File without changes
|
lib/skyverge/woocommerce/payment-gateway/assets/images/card-visa-electron.svg
CHANGED
File without changes
|
lib/skyverge/woocommerce/payment-gateway/assets/images/card-visa.png
CHANGED
File without changes
|
lib/skyverge/woocommerce/payment-gateway/assets/images/card-visa.svg
CHANGED
File without changes
|
lib/skyverge/woocommerce/payment-gateway/assets/images/license.txt
CHANGED
File without changes
|
lib/skyverge/woocommerce/payment-gateway/assets/images/sample-check.png
CHANGED
File without changes
|
lib/skyverge/woocommerce/payment-gateway/assets/js/admin/sv-wc-payment-gateway-admin-order.coffee
ADDED
@@ -0,0 +1,103 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
###
|
2 |
+
WooCommerce SkyVerge Payment Gateway Framework Order Admin CoffeeScript
|
3 |
+
Version 5.0.0
|
4 |
+
|
5 |
+
Copyright (c) 2017-2018, SkyVerge, Inc.
|
6 |
+
Licensed under the GNU General Public License v3.0
|
7 |
+
http://www.gnu.org/licenses/gpl-3.0.html
|
8 |
+
###
|
9 |
+
|
10 |
+
jQuery( document ).ready ($) ->
|
11 |
+
"use strict"
|
12 |
+
|
13 |
+
sv_wc_payment_gateway_admin_order = window.sv_wc_payment_gateway_admin_order ? {}
|
14 |
+
woocommerce_admin = window.woocommerce_admin ? {}
|
15 |
+
woocommerce_admin_meta_boxes = window.woocommerce_admin_meta_boxes ? {}
|
16 |
+
accounting = window.accounting ? {}
|
17 |
+
|
18 |
+
# this is ugly, but there are no actions to output this HTML where it belongs
|
19 |
+
$( '.sv-wc-payment-gateway-partial-capture' ).appendTo( '#woocommerce-order-items .inside' )
|
20 |
+
|
21 |
+
|
22 |
+
$( '#woocommerce-order-items' ).on 'click', '.sv-wc-payment-gateway-capture:not(.disabled)', ( e ) ->
|
23 |
+
|
24 |
+
e.preventDefault()
|
25 |
+
|
26 |
+
if ( $( @ ).hasClass( 'partial-capture' ) )
|
27 |
+
|
28 |
+
$( 'div.sv-wc-payment-gateway-partial-capture' ).slideDown();
|
29 |
+
$( 'div.wc-order-data-row-toggle' ).not( 'div.sv-wc-payment-gateway-partial-capture' ).slideUp();
|
30 |
+
$( 'div.wc-order-totals-items' ).slideUp();
|
31 |
+
|
32 |
+
else
|
33 |
+
|
34 |
+
submitCapture()
|
35 |
+
|
36 |
+
|
37 |
+
$( '.sv-wc-payment-gateway-partial-capture' ).on 'change keyup', '#capture_amount', ( e ) ->
|
38 |
+
|
39 |
+
total = accounting.unformat( $( @ ).val(), woocommerce_admin.mon_decimal_point );
|
40 |
+
|
41 |
+
if ( total )
|
42 |
+
$( 'button.capture-action' ).removeAttr( 'disabled' )
|
43 |
+
else
|
44 |
+
$( 'button.capture-action' ).attr( 'disabled', 'disabled' )
|
45 |
+
|
46 |
+
$( 'button .capture-amount .amount' ).text( accounting.formatMoney( total, {
|
47 |
+
symbol: woocommerce_admin_meta_boxes.currency_format_symbol,
|
48 |
+
decimal: woocommerce_admin_meta_boxes.currency_format_decimal_sep,
|
49 |
+
thousand: woocommerce_admin_meta_boxes.currency_format_thousand_sep,
|
50 |
+
precision: woocommerce_admin_meta_boxes.currency_format_num_decimals,
|
51 |
+
format: woocommerce_admin_meta_boxes.currency_format
|
52 |
+
} ) )
|
53 |
+
|
54 |
+
|
55 |
+
$( '.sv-wc-payment-gateway-partial-capture' ).on 'click', '.capture-action', ( e ) ->
|
56 |
+
|
57 |
+
e.preventDefault()
|
58 |
+
|
59 |
+
amount = $( '.sv-wc-payment-gateway-partial-capture #capture_amount' ).val()
|
60 |
+
comment = $( '.sv-wc-payment-gateway-partial-capture #capture_comment' ).val()
|
61 |
+
|
62 |
+
submitCapture( amount, comment )
|
63 |
+
|
64 |
+
|
65 |
+
submitCapture = ( amount = '', comment = '' ) ->
|
66 |
+
|
67 |
+
if ( confirm( sv_wc_payment_gateway_admin_order.capture_ays ) )
|
68 |
+
|
69 |
+
$( '#woocommerce-order-items' ).block( {
|
70 |
+
message: null
|
71 |
+
overlayCSS: {
|
72 |
+
background: '#fff'
|
73 |
+
opacity: 0.6
|
74 |
+
}
|
75 |
+
} )
|
76 |
+
|
77 |
+
data =
|
78 |
+
action: sv_wc_payment_gateway_admin_order.capture_action
|
79 |
+
nonce: sv_wc_payment_gateway_admin_order.capture_nonce
|
80 |
+
gateway_id: sv_wc_payment_gateway_admin_order.gateway_id
|
81 |
+
order_id: sv_wc_payment_gateway_admin_order.order_id
|
82 |
+
amount: amount
|
83 |
+
comment: comment
|
84 |
+
|
85 |
+
$.ajax(
|
86 |
+
url: sv_wc_payment_gateway_admin_order.ajax_url
|
87 |
+
data: data
|
88 |
+
).done( ( response ) ->
|
89 |
+
|
90 |
+
alert( response.data.message ) if response.data? and response.data.message?
|
91 |
+
|
92 |
+
location.reload() if response.success
|
93 |
+
|
94 |
+
).fail( ->
|
95 |
+
|
96 |
+
# connection error
|
97 |
+
alert( sv_wc_payment_gateway_admin_order.capture_error )
|
98 |
+
|
99 |
+
).always( ->
|
100 |
+
|
101 |
+
# never leave the UI blocked
|
102 |
+
$( '#woocommerce-order-items' ).unblock()
|
103 |
+
)
|
lib/skyverge/woocommerce/payment-gateway/assets/js/admin/sv-wc-payment-gateway-admin-order.min.js
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
/* WooCommerce SkyVerge Payment Gateway Framework Order Admin CoffeeScript Version 5.0.0 Copyright (c) 2017-2018, SkyVerge, Inc. Licensed under the GNU General Public License v3.0 http://www.gnu.org/licenses/gpl-3.0.html */(function() { jQuery(document).ready(function($) { "use strict"; var accounting, ref, ref1, ref2, ref3, submitCapture, sv_wc_payment_gateway_admin_order, woocommerce_admin, woocommerce_admin_meta_boxes; sv_wc_payment_gateway_admin_order = (ref = window.sv_wc_payment_gateway_admin_order) != null ? ref : {}; woocommerce_admin = (ref1 = window.woocommerce_admin) != null ? ref1 : {}; woocommerce_admin_meta_boxes = (ref2 = window.woocommerce_admin_meta_boxes) != null ? ref2 : {}; accounting = (ref3 = window.accounting) != null ? ref3 : {}; $('.sv-wc-payment-gateway-partial-capture').appendTo('#woocommerce-order-items .inside'); $('#woocommerce-order-items').on('click', '.sv-wc-payment-gateway-capture:not(.disabled)', function(e) { e.preventDefault(); if ($(this).hasClass('partial-capture')) { $('div.sv-wc-payment-gateway-partial-capture').slideDown(); $('div.wc-order-data-row-toggle').not('div.sv-wc-payment-gateway-partial-capture').slideUp(); return $('div.wc-order-totals-items').slideUp(); } else { return submitCapture(); } }); $('.sv-wc-payment-gateway-partial-capture').on('change keyup', '#capture_amount', function(e) { var total; total = accounting.unformat($(this).val(), woocommerce_admin.mon_decimal_point); if (total) { $('button.capture-action').removeAttr('disabled'); } else { $('button.capture-action').attr('disabled', 'disabled'); } return $('button .capture-amount .amount').text(accounting.formatMoney(total, { symbol: woocommerce_admin_meta_boxes.currency_format_symbol, decimal: woocommerce_admin_meta_boxes.currency_format_decimal_sep, thousand: woocommerce_admin_meta_boxes.currency_format_thousand_sep, precision: woocommerce_admin_meta_boxes.currency_format_num_decimals, format: woocommerce_admin_meta_boxes.currency_format })); }); $('.sv-wc-payment-gateway-partial-capture').on('click', '.capture-action', function(e) { var amount, comment; e.preventDefault(); amount = $('.sv-wc-payment-gateway-partial-capture #capture_amount').val(); comment = $('.sv-wc-payment-gateway-partial-capture #capture_comment').val(); return submitCapture(amount, comment); }); return submitCapture = function(amount, comment) { var data; if (amount == null) { amount = ''; } if (comment == null) { comment = ''; } if (confirm(sv_wc_payment_gateway_admin_order.capture_ays)) { $('#woocommerce-order-items').block({ message: null, overlayCSS: { background: '#fff', opacity: 0.6 } }); data = { action: sv_wc_payment_gateway_admin_order.capture_action, nonce: sv_wc_payment_gateway_admin_order.capture_nonce, gateway_id: sv_wc_payment_gateway_admin_order.gateway_id, order_id: sv_wc_payment_gateway_admin_order.order_id, amount: amount, comment: comment }; return $.ajax({ url: sv_wc_payment_gateway_admin_order.ajax_url, data: data }).done(function(response) { if ((response.data != null) && (response.data.message != null)) { alert(response.data.message); } if (response.success) { return location.reload(); } }).fail(function() { return alert(sv_wc_payment_gateway_admin_order.capture_error); }).always(function() { return $('#woocommerce-order-items').unblock(); }); } }; });}).call(this);
|
lib/skyverge/woocommerce/payment-gateway/assets/js/admin/sv-wc-payment-gateway-admin-order.min.js.map
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"version": 3,
|
3 |
+
"file": "sv-wc-payment-gateway-admin-order.min.js",
|
4 |
+
"sourceRoot": "",
|
5 |
+
"sources": [
|
6 |
+
"sv-wc-payment-gateway-admin-order.coffee"
|
7 |
+
],
|
8 |
+
"names": [],
|
9 |
+
"mappings": ";AAAA;;;;;;;;;AAAA;EASA,MAAA,CAAQ,QAAR,CAAkB,CAAC,KAAnB,CAAyB,SAAC,CAAD;IACxB;AAAA,QAAA;IAEA,iCAAA,oEAA+E;IAC/E,iBAAA,sDAA+D;IAC/D,4BAAA,iEAA0E;IAC1E,UAAA,+CAAwD;IAGxD,CAAA,CAAG,wCAAH,CAA6C,CAAC,QAA9C,CAAwD,kCAAxD;IAGA,CAAA,CAAG,0BAAH,CAA+B,CAAC,EAAhC,CAAmC,OAAnC,EAA4C,+CAA5C,EAA6F,SAAE,CAAF;MAE5F,CAAC,CAAC,cAAF,CAAA;MAEA,IAAK,CAAA,CAAG,IAAH,CAAM,CAAC,QAAP,CAAiB,iBAAjB,CAAL;QAEC,CAAA,CAAG,2CAAH,CAAgD,CAAC,SAAjD,CAAA;QACA,CAAA,CAAG,8BAAH,CAAmC,CAAC,GAApC,CAAyC,2CAAzC,CAAsF,CAAC,OAAvF,CAAA;eACA,CAAA,CAAG,2BAAH,CAAgC,CAAC,OAAjC,CAAA,EAJD;OAAA,MAAA;eAQC,aAAA,CAAA,EARD;;IAJ4F,CAA7F;IAeA,CAAA,CAAG,wCAAH,CAA6C,CAAC,EAA9C,CAAiD,cAAjD,EAAiE,iBAAjE,EAAoF,SAAE,CAAF;AAEnF,UAAA;MAAA,KAAA,GAAQ,UAAU,CAAC,QAAX,CAAqB,CAAA,CAAG,IAAH,CAAM,CAAC,GAAP,CAAA,CAArB,EAAmC,iBAAiB,CAAC,iBAArD;MAER,IAAK,KAAL;QACC,CAAA,CAAG,uBAAH,CAA4B,CAAC,UAA7B,CAAyC,UAAzC,EADD;OAAA,MAAA;QAGC,CAAA,CAAG,uBAAH,CAA4B,CAAC,IAA7B,CAAmC,UAAnC,EAA+C,UAA/C,EAHD;;aAKA,CAAA,CAAG,gCAAH,CAAqC,CAAC,IAAtC,CAA4C,UAAU,CAAC,WAAX,CAAwB,KAAxB,EAA+B;QAC1E,MAAA,EAAW,4BAA4B,CAAC,sBADkC;QAE1E,OAAA,EAAW,4BAA4B,CAAC,2BAFkC;QAG1E,QAAA,EAAW,4BAA4B,CAAC,4BAHkC;QAI1E,SAAA,EAAW,4BAA4B,CAAC,4BAJkC;QAK1E,MAAA,EAAW,4BAA4B,CAAC,eALkC;OAA/B,CAA5C;IATmF,CAApF;IAkBA,CAAA,CAAG,wCAAH,CAA6C,CAAC,EAA9C,CAAiD,OAAjD,EAA0D,iBAA1D,EAA6E,SAAE,CAAF;AAE5E,UAAA;MAAA,CAAC,CAAC,cAAF,CAAA;MAEA,MAAA,GAAU,CAAA,CAAG,wDAAH,CAA6D,CAAC,GAA9D,CAAA;MACV,OAAA,GAAU,CAAA,CAAG,yDAAH,CAA8D,CAAC,GAA/D,CAAA;aAEV,aAAA,CAAe,MAAf,EAAuB,OAAvB;IAP4E,CAA7E;WAUA,aAAA,GAAgB,SAAE,MAAF,EAAe,OAAf;AAEf,UAAA;;QAFiB,SAAS;;;QAAI,UAAU;;MAExC,IAAK,OAAA,CAAS,iCAAiC,CAAC,WAA3C,CAAL;QAEC,CAAA,CAAG,0BAAH,CAA+B,CAAC,KAAhC,CAAuC;UACtC,OAAA,EAAS,IAD6B;UAEtC,UAAA,EAAY;YACX,UAAA,EAAY,MADD;YAEX,OAAA,EAAS,GAFE;WAF0B;SAAvC;QAQA,IAAA,GACC;UAAA,MAAA,EAAY,iCAAiC,CAAC,cAA9C;UACA,KAAA,EAAY,iCAAiC,CAAC,aAD9C;UAEA,UAAA,EAAY,iCAAiC,CAAC,UAF9C;UAGA,QAAA,EAAY,iCAAiC,CAAC,QAH9C;UAIA,MAAA,EAAY,MAJZ;UAKA,OAAA,EAAY,OALZ;;eAOD,CAAC,CAAC,IAAF,CACC;UAAA,GAAA,EAAM,iCAAiC,CAAC,QAAxC;UACA,IAAA,EAAM,IADN;SADD,CAGC,CAAC,IAHF,CAGQ,SAAE,QAAF;UAEP,IAAkC,uBAAA,IAAmB,+BAArD;YAAA,KAAA,CAAO,QAAQ,CAAC,IAAI,CAAC,OAArB,EAAA;;UAEA,IAAqB,QAAQ,CAAC,OAA9B;mBAAA,QAAQ,CAAC,MAAT,CAAA,EAAA;;QAJO,CAHR,CASC,CAAC,IATF,CASQ,SAAA;iBAGP,KAAA,CAAO,iCAAiC,CAAC,aAAzC;QAHO,CATR,CAcC,CAAC,MAdF,CAcU,SAAA;iBAGT,CAAA,CAAG,0BAAH,CAA+B,CAAC,OAAhC,CAAA;QAHS,CAdV,EAlBD;;IAFe;EAvDQ,CAAzB;AATA"
|
10 |
+
}
|
lib/skyverge/woocommerce/payment-gateway/assets/js/admin/sv-wc-payment-gateway-token-editor.coffee
CHANGED
@@ -16,7 +16,7 @@ jQuery( document ).ready ($) ->
|
|
16 |
|
17 |
tokens = $( this ).find( 'tr.token' )
|
18 |
|
19 |
-
if ( tokens.length
|
20 |
$( this ).find( 'tr.no-tokens' ).show()
|
21 |
else
|
22 |
$( this ).find( 'tr.no-tokens' ).hide()
|
@@ -27,37 +27,47 @@ jQuery( document ).ready ($) ->
|
|
27 |
|
28 |
e.preventDefault()
|
29 |
|
|
|
|
|
30 |
editor = $( this ).closest( 'table' )
|
31 |
|
32 |
editor.block( message: null, overlayCSS: background: '#fff',opacity: 0.6 )
|
33 |
|
34 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
35 |
|
36 |
-
|
37 |
|
38 |
-
|
39 |
-
|
|
|
40 |
|
41 |
-
|
42 |
|
43 |
-
|
44 |
-
else
|
45 |
|
46 |
-
|
47 |
-
action: 'wc_payment_gateway_' + editor.data( 'gateway-id' ) + '_admin_remove_payment_token'
|
48 |
-
user_id: $( this ).data( 'user-id' )
|
49 |
-
token_id: $( this ).data( 'token-id' )
|
50 |
-
security: wc_payment_gateway_token_editor.actions.remove_token.nonce
|
51 |
|
52 |
-
|
53 |
|
54 |
-
if response.success is true then $( row ).remove()
|
55 |
|
56 |
-
# No more tokens? Display a message
|
57 |
-
if ( editor.find( 'tr.token' ).length == 0 )
|
58 |
-
editor.find( 'tr.no-tokens' ).show()
|
59 |
|
60 |
-
editor.unblock()
|
61 |
|
62 |
# Add a new (blank) token
|
63 |
$( 'table.sv_wc_payment_gateway_token_editor' ).on 'click', '.button[data-action="add-new"]', ( e ) ->
|
@@ -94,6 +104,8 @@ jQuery( document ).ready ($) ->
|
|
94 |
|
95 |
editor.block( message: null, overlayCSS: background: '#fff',opacity: 0.6 )
|
96 |
|
|
|
|
|
97 |
body = editor.find( 'tbody.tokens' )
|
98 |
count = body.find( 'tr.token' ).length
|
99 |
|
@@ -102,18 +114,26 @@ jQuery( document ).ready ($) ->
|
|
102 |
user_id: $( this ).data( 'user-id' )
|
103 |
security: wc_payment_gateway_token_editor.actions.refresh.nonce
|
104 |
|
105 |
-
$.post wc_payment_gateway_token_editor.ajax_url, data
|
|
|
|
|
106 |
|
107 |
-
|
108 |
|
109 |
-
if
|
110 |
editor.find( 'tr.no-tokens' ).hide()
|
111 |
body.html( response.data )
|
112 |
else
|
113 |
body.empty()
|
114 |
editor.find( 'tr.no-tokens' ).show()
|
115 |
|
116 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
117 |
|
118 |
# Save the tokens
|
119 |
$( 'table.sv_wc_payment_gateway_token_editor' ).on 'click', '.sv-wc-payment-gateway-token-editor-action-button[data-action="save"]', ( e ) ->
|
@@ -152,3 +172,15 @@ jQuery( document ).ready ($) ->
|
|
152 |
focused = true
|
153 |
|
154 |
editor.unblock()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
16 |
|
17 |
tokens = $( this ).find( 'tr.token' )
|
18 |
|
19 |
+
if ( tokens.length is 0 )
|
20 |
$( this ).find( 'tr.no-tokens' ).show()
|
21 |
else
|
22 |
$( this ).find( 'tr.no-tokens' ).hide()
|
27 |
|
28 |
e.preventDefault()
|
29 |
|
30 |
+
return unless confirm( wc_payment_gateway_token_editor.actions.remove_token.ays )
|
31 |
+
|
32 |
editor = $( this ).closest( 'table' )
|
33 |
|
34 |
editor.block( message: null, overlayCSS: background: '#fff',opacity: 0.6 )
|
35 |
|
36 |
+
editor.find( '.error' ).remove()
|
37 |
+
|
38 |
+
row = $( this ).closest( 'tr' )
|
39 |
+
|
40 |
+
# if this is an unsaved token, just remove the row
|
41 |
+
return row.remove() if row.hasClass( 'new-token' )
|
42 |
+
|
43 |
+
data =
|
44 |
+
action: 'wc_payment_gateway_' + editor.data( 'gateway-id' ) + '_admin_remove_payment_token'
|
45 |
+
user_id: $( this ).data( 'user-id' )
|
46 |
+
token_id: $( this ).data( 'token-id' )
|
47 |
+
security: wc_payment_gateway_token_editor.actions.remove_token.nonce
|
48 |
+
|
49 |
+
$.post wc_payment_gateway_token_editor.ajax_url, data
|
50 |
+
|
51 |
+
.done ( response ) =>
|
52 |
+
|
53 |
+
return handleError( editor, response.data ) unless response.success
|
54 |
|
55 |
+
$( row ).remove()
|
56 |
|
57 |
+
# no more tokens? Display a message
|
58 |
+
if ( editor.find( 'tr.token' ).length is 0 )
|
59 |
+
editor.find( 'tr.no-tokens' ).show()
|
60 |
|
61 |
+
.fail ( jqXHR, textStatus, error ) =>
|
62 |
|
63 |
+
handleError( editor, textStatus + ': ' + error )
|
|
|
64 |
|
65 |
+
.always =>
|
|
|
|
|
|
|
|
|
66 |
|
67 |
+
editor.unblock()
|
68 |
|
|
|
69 |
|
|
|
|
|
|
|
70 |
|
|
|
71 |
|
72 |
# Add a new (blank) token
|
73 |
$( 'table.sv_wc_payment_gateway_token_editor' ).on 'click', '.button[data-action="add-new"]', ( e ) ->
|
104 |
|
105 |
editor.block( message: null, overlayCSS: background: '#fff',opacity: 0.6 )
|
106 |
|
107 |
+
editor.find( '.error' ).remove()
|
108 |
+
|
109 |
body = editor.find( 'tbody.tokens' )
|
110 |
count = body.find( 'tr.token' ).length
|
111 |
|
114 |
user_id: $( this ).data( 'user-id' )
|
115 |
security: wc_payment_gateway_token_editor.actions.refresh.nonce
|
116 |
|
117 |
+
$.post wc_payment_gateway_token_editor.ajax_url, data
|
118 |
+
|
119 |
+
.done ( response ) =>
|
120 |
|
121 |
+
return handleError( editor, response.data ) unless response.success
|
122 |
|
123 |
+
if response.data?
|
124 |
editor.find( 'tr.no-tokens' ).hide()
|
125 |
body.html( response.data )
|
126 |
else
|
127 |
body.empty()
|
128 |
editor.find( 'tr.no-tokens' ).show()
|
129 |
|
130 |
+
.fail ( jqXHR, textStatus, error ) =>
|
131 |
+
|
132 |
+
handleError( editor, textStatus + ': ' + error )
|
133 |
+
|
134 |
+
.always =>
|
135 |
+
|
136 |
+
editor.unblock()
|
137 |
|
138 |
# Save the tokens
|
139 |
$( 'table.sv_wc_payment_gateway_token_editor' ).on 'click', '.sv-wc-payment-gateway-token-editor-action-button[data-action="save"]', ( e ) ->
|
172 |
focused = true
|
173 |
|
174 |
editor.unblock()
|
175 |
+
|
176 |
+
|
177 |
+
# Handles any AJAX errors.
|
178 |
+
#
|
179 |
+
# @since 5.1.0
|
180 |
+
handleError = ( editor, error, message = '' ) ->
|
181 |
+
|
182 |
+
console.error error
|
183 |
+
|
184 |
+
message = wc_payment_gateway_token_editor.i18n.general_error unless message
|
185 |
+
|
186 |
+
editor.find( 'th.actions' ).prepend( '<span class="error">' + message + '</span>' )
|
lib/skyverge/woocommerce/payment-gateway/assets/js/admin/sv-wc-payment-gateway-token-editor.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
/* WooCommerce SkyVerge Payment Gateway Framework Token Editor CoffeeScript Version 4.3.0-beta Copyright (c) 2016, SkyVerge, Inc. Licensed under the GNU General Public License v3.0 http://www.gnu.org/licenses/gpl-3.0.html */(function() { jQuery(document).ready(function($) { "use strict"; var ref, wc_payment_gateway_token_editor; wc_payment_gateway_token_editor = (ref = window.wc_payment_gateway_token_editor) != null ? ref : {}; $('.sv_wc_payment_gateway_token_editor').each(function() { var tokens; tokens = $(this).find('tr.token'); if (tokens.length === 0) { return $(this).find('tr.no-tokens').show(); } else { return $(this).find('tr.no-tokens').hide(); } }); $('.sv_wc_payment_gateway_token_editor').on('click', '.button[data-action="remove"]', function(e) { var data, editor, row; e.preventDefault(); editor = $(this).closest('table'); editor.block({ message: null, overlayCSS: { background: '#fff', opacity: 0.6 } });
|
1 |
+
/* WooCommerce SkyVerge Payment Gateway Framework Token Editor CoffeeScript Version 4.3.0-beta Copyright (c) 2016, SkyVerge, Inc. Licensed under the GNU General Public License v3.0 http://www.gnu.org/licenses/gpl-3.0.html */(function() { jQuery(document).ready(function($) { "use strict"; var handleError, ref, wc_payment_gateway_token_editor; wc_payment_gateway_token_editor = (ref = window.wc_payment_gateway_token_editor) != null ? ref : {}; $('.sv_wc_payment_gateway_token_editor').each(function() { var tokens; tokens = $(this).find('tr.token'); if (tokens.length === 0) { return $(this).find('tr.no-tokens').show(); } else { return $(this).find('tr.no-tokens').hide(); } }); $('.sv_wc_payment_gateway_token_editor').on('click', '.button[data-action="remove"]', function(e) { var data, editor, row; e.preventDefault(); if (!confirm(wc_payment_gateway_token_editor.actions.remove_token.ays)) { return; } editor = $(this).closest('table'); editor.block({ message: null, overlayCSS: { background: '#fff', opacity: 0.6 } }); editor.find('.error').remove(); row = $(this).closest('tr'); if (row.hasClass('new-token')) { return row.remove(); } data = { action: 'wc_payment_gateway_' + editor.data('gateway-id') + '_admin_remove_payment_token', user_id: $(this).data('user-id'), token_id: $(this).data('token-id'), security: wc_payment_gateway_token_editor.actions.remove_token.nonce }; return $.post(wc_payment_gateway_token_editor.ajax_url, data).done((function(_this) { return function(response) { if (!response.success) { return handleError(editor, response.data); } $(row).remove(); if (editor.find('tr.token').length === 0) { return editor.find('tr.no-tokens').show(); } }; })(this)).fail((function(_this) { return function(jqXHR, textStatus, error) { return handleError(editor, textStatus + ': ' + error); }; })(this)).always((function(_this) { return function() { return editor.unblock(); }; })(this)); }); $('table.sv_wc_payment_gateway_token_editor').on('click', '.button[data-action="add-new"]', function(e) { var body, count, data, editor; e.preventDefault(); editor = $(this).closest('table'); editor.block({ message: null, overlayCSS: { background: '#fff', opacity: 0.6 } }); body = editor.find('tbody.tokens'); count = body.find('tr.token').length; data = { action: 'wc_payment_gateway_' + editor.data('gateway-id') + '_admin_get_blank_payment_token', index: count + 1, security: wc_payment_gateway_token_editor.actions.add_token.nonce }; return $.post(wc_payment_gateway_token_editor.ajax_url, data, function(response) { if (response.success === true) { body.append(response.data); } editor.find('tr.no-tokens').hide(); return editor.unblock(); }); }); $('table.sv_wc_payment_gateway_token_editor').on('click', '.button[data-action="refresh"]', function(e) { var body, count, data, editor; e.preventDefault(); editor = $(this).closest('table'); editor.block({ message: null, overlayCSS: { background: '#fff', opacity: 0.6 } }); editor.find('.error').remove(); body = editor.find('tbody.tokens'); count = body.find('tr.token').length; data = { action: 'wc_payment_gateway_' + editor.data('gateway-id') + '_admin_refresh_payment_tokens', user_id: $(this).data('user-id'), security: wc_payment_gateway_token_editor.actions.refresh.nonce }; return $.post(wc_payment_gateway_token_editor.ajax_url, data).done((function(_this) { return function(response) { if (!response.success) { return handleError(editor, response.data); } if (response.data != null) { editor.find('tr.no-tokens').hide(); return body.html(response.data); } else { body.empty(); return editor.find('tr.no-tokens').show(); } }; })(this)).fail((function(_this) { return function(jqXHR, textStatus, error) { return handleError(editor, textStatus + ': ' + error); }; })(this)).always((function(_this) { return function() { return editor.unblock(); }; })(this)); }); $('table.sv_wc_payment_gateway_token_editor').on('click', '.sv-wc-payment-gateway-token-editor-action-button[data-action="save"]', function(e) { var actions_row, editor, focused, inputs; editor = $(this).closest('table'); actions_row = editor.find('tfoot th'); editor.block({ message: null, overlayCSS: { background: '#fff', opacity: 0.6 } }); actions_row.find('.error, .success').remove(); inputs = editor.find('tbody.tokens tr.token input[type="text"]'); focused = false; return inputs.each(function(index) { var pattern, required, value; $(this).removeClass('error'); value = $(this).val(); required = $(this).prop('required'); pattern = $(this).attr('pattern'); if (!(required || value)) { return; } if (!value.match(pattern) || (required && !value)) { e.preventDefault(); $(this).addClass('error'); if (!focused) { actions_row.prepend('<span class="error">' + wc_payment_gateway_token_editor.actions.save.error + '</span>'); $(this).focus(); focused = true; } return editor.unblock(); } }); }); return handleError = function(editor, error, message) { if (message == null) { message = ''; } console.error(error); if (!message) { message = wc_payment_gateway_token_editor.i18n.general_error; } return editor.find('th.actions').prepend('<span class="error">' + message + '</span>'); }; });}).call(this);
|
lib/skyverge/woocommerce/payment-gateway/assets/js/admin/sv-wc-payment-gateway-token-editor.min.js.map
CHANGED
@@ -6,5 +6,5 @@
|
|
6 |
"sv-wc-payment-gateway-token-editor.coffee"
|
7 |
],
|
8 |
"names": [],
|
9 |
-
"mappings": ";AAAA;;;;;;;;;AAAA;EAQA,MAAA,CAAQ,QAAR,CAAkB,CAAC,KAAnB,CAAyB,SAAC,CAAD;IACxB;AAAA,QAAA;IAEA,+BAAA,kEAA2E;IAG3E,CAAA,CAAG,qCAAH,CAA0C,CAAC,IAA3C,CAAgD,SAAA;AAE/C,UAAA;MAAA,MAAA,GAAS,CAAA,CAAG,IAAH,CAAS,CAAC,IAAV,CAAgB,UAAhB;MAET,IAAK,MAAM,CAAC,MAAP,KAAiB,CAAtB;eACC,CAAA,CAAG,IAAH,CAAS,CAAC,IAAV,CAAgB,cAAhB,CAAgC,CAAC,IAAjC,CAAA,EADD;OAAA,MAAA;eAGC,CAAA,CAAG,IAAH,CAAS,CAAC,IAAV,CAAgB,cAAhB,CAAgC,CAAC,IAAjC,CAAA,EAHD;;IAJ+C,CAAhD;IAWA,CAAA,CAAG,qCAAH,CAA0C,CAAC,EAA3C,CAA8C,OAA9C,EAAuD,+BAAvD,EAAwF,SAAE,CAAF;AAEvF,UAAA;MAAA,CAAC,CAAC,cAAF,CAAA;MAEA,MAAA,GAAS,CAAA,CAAG,IAAH,CAAS,CAAC,OAAV,CAAmB,OAAnB;MAET,MAAM,CAAC,KAAP,CAAc;QAAA,OAAA,EAAS,IAAT;QAAe,UAAA,EAAY;UAAA,UAAA,EAAY,MAAZ;UAAmB,OAAA,EAAS,GAA5B;SAA3B;OAAd;MAEA,
|
10 |
}
|
6 |
"sv-wc-payment-gateway-token-editor.coffee"
|
7 |
],
|
8 |
"names": [],
|
9 |
+
"mappings": ";AAAA;;;;;;;;;AAAA;EAQA,MAAA,CAAQ,QAAR,CAAkB,CAAC,KAAnB,CAAyB,SAAC,CAAD;IACxB;AAAA,QAAA;IAEA,+BAAA,kEAA2E;IAG3E,CAAA,CAAG,qCAAH,CAA0C,CAAC,IAA3C,CAAgD,SAAA;AAE/C,UAAA;MAAA,MAAA,GAAS,CAAA,CAAG,IAAH,CAAS,CAAC,IAAV,CAAgB,UAAhB;MAET,IAAK,MAAM,CAAC,MAAP,KAAiB,CAAtB;eACC,CAAA,CAAG,IAAH,CAAS,CAAC,IAAV,CAAgB,cAAhB,CAAgC,CAAC,IAAjC,CAAA,EADD;OAAA,MAAA;eAGC,CAAA,CAAG,IAAH,CAAS,CAAC,IAAV,CAAgB,cAAhB,CAAgC,CAAC,IAAjC,CAAA,EAHD;;IAJ+C,CAAhD;IAWA,CAAA,CAAG,qCAAH,CAA0C,CAAC,EAA3C,CAA8C,OAA9C,EAAuD,+BAAvD,EAAwF,SAAE,CAAF;AAEvF,UAAA;MAAA,CAAC,CAAC,cAAF,CAAA;MAEA,IAAA,CAAc,OAAA,CAAS,+BAA+B,CAAC,OAAO,CAAC,YAAY,CAAC,GAA9D,CAAd;AAAA,eAAA;;MAEA,MAAA,GAAS,CAAA,CAAG,IAAH,CAAS,CAAC,OAAV,CAAmB,OAAnB;MAET,MAAM,CAAC,KAAP,CAAc;QAAA,OAAA,EAAS,IAAT;QAAe,UAAA,EAAY;UAAA,UAAA,EAAY,MAAZ;UAAmB,OAAA,EAAS,GAA5B;SAA3B;OAAd;MAEA,MAAM,CAAC,IAAP,CAAa,QAAb,CAAuB,CAAC,MAAxB,CAAA;MAEA,GAAA,GAAM,CAAA,CAAG,IAAH,CAAS,CAAC,OAAV,CAAmB,IAAnB;MAGN,IAAuB,GAAG,CAAC,QAAJ,CAAc,WAAd,CAAvB;AAAA,eAAO,GAAG,CAAC,MAAJ,CAAA,EAAP;;MAEA,IAAA,GACC;QAAA,MAAA,EAAU,qBAAA,GAAwB,MAAM,CAAC,IAAP,CAAa,YAAb,CAAxB,GAAsD,6BAAhE;QACA,OAAA,EAAU,CAAA,CAAG,IAAH,CAAS,CAAC,IAAV,CAAgB,SAAhB,CADV;QAEA,QAAA,EAAU,CAAA,CAAG,IAAH,CAAS,CAAC,IAAV,CAAgB,UAAhB,CAFV;QAGA,QAAA,EAAU,+BAA+B,CAAC,OAAO,CAAC,YAAY,CAAC,KAH/D;;aAKD,CAAC,CAAC,IAAF,CAAO,+BAA+B,CAAC,QAAvC,EAAiD,IAAjD,CAEC,CAAC,IAFF,CAEO,CAAA,SAAA,KAAA;eAAA,SAAE,QAAF;UAEL,IAAA,CAAmD,QAAQ,CAAC,OAA5D;AAAA,mBAAO,WAAA,CAAa,MAAb,EAAqB,QAAQ,CAAC,IAA9B,EAAP;;UAEA,CAAA,CAAG,GAAH,CAAQ,CAAC,MAAT,CAAA;UAGA,IAAK,MAAM,CAAC,IAAP,CAAa,UAAb,CAAyB,CAAC,MAA1B,KAAoC,CAAzC;mBACC,MAAM,CAAC,IAAP,CAAa,cAAb,CAA6B,CAAC,IAA9B,CAAA,EADD;;QAPK;MAAA,CAAA,CAAA,CAAA,IAAA,CAFP,CAYC,CAAC,IAZF,CAYO,CAAA,SAAA,KAAA;eAAA,SAAE,KAAF,EAAS,UAAT,EAAqB,KAArB;iBAEL,WAAA,CAAa,MAAb,EAAqB,UAAA,GAAa,IAAb,GAAoB,KAAzC;QAFK;MAAA,CAAA,CAAA,CAAA,IAAA,CAZP,CAgBC,CAAC,MAhBF,CAgBS,CAAA,SAAA,KAAA;eAAA,SAAA;iBAEP,MAAM,CAAC,OAAP,CAAA;QAFO;MAAA,CAAA,CAAA,CAAA,IAAA,CAhBT;IAvBuF,CAAxF;IA+CA,CAAA,CAAG,0CAAH,CAA+C,CAAC,EAAhD,CAAmD,OAAnD,EAA4D,gCAA5D,EAA8F,SAAE,CAAF;AAE7F,UAAA;MAAA,CAAC,CAAC,cAAF,CAAA;MAEA,MAAA,GAAS,CAAA,CAAG,IAAH,CAAS,CAAC,OAAV,CAAmB,OAAnB;MAET,MAAM,CAAC,KAAP,CAAc;QAAA,OAAA,EAAS,IAAT;QAAe,UAAA,EAAY;UAAA,UAAA,EAAY,MAAZ;UAAmB,OAAA,EAAS,GAA5B;SAA3B;OAAd;MAEA,IAAA,GAAQ,MAAM,CAAC,IAAP,CAAa,cAAb;MACR,KAAA,GAAQ,IAAI,CAAC,IAAL,CAAW,UAAX,CAAuB,CAAC;MAEhC,IAAA,GACC;QAAA,MAAA,EAAU,qBAAA,GAAwB,MAAM,CAAC,IAAP,CAAa,YAAb,CAAxB,GAAsD,gCAAhE;QACA,KAAA,EAAU,KAAA,GAAQ,CADlB;QAEA,QAAA,EAAU,+BAA+B,CAAC,OAAO,CAAC,SAAS,CAAC,KAF5D;;aAID,CAAC,CAAC,IAAF,CAAO,+BAA+B,CAAC,QAAvC,EAAiD,IAAjD,EAAuD,SAAE,QAAF;QAEtD,IAAG,QAAQ,CAAC,OAAT,KAAoB,IAAvB;UAAiC,IAAI,CAAC,MAAL,CAAa,QAAQ,CAAC,IAAtB,EAAjC;;QAEA,MAAM,CAAC,IAAP,CAAa,cAAb,CAA6B,CAAC,IAA9B,CAAA;eAEA,MAAM,CAAC,OAAP,CAAA;MANsD,CAAvD;IAhB6F,CAA9F;IA0BA,CAAA,CAAG,0CAAH,CAA+C,CAAC,EAAhD,CAAmD,OAAnD,EAA4D,gCAA5D,EAA8F,SAAE,CAAF;AAE7F,UAAA;MAAA,CAAC,CAAC,cAAF,CAAA;MAEA,MAAA,GAAS,CAAA,CAAG,IAAH,CAAS,CAAC,OAAV,CAAmB,OAAnB;MAET,MAAM,CAAC,KAAP,CAAc;QAAA,OAAA,EAAS,IAAT;QAAe,UAAA,EAAY;UAAA,UAAA,EAAY,MAAZ;UAAmB,OAAA,EAAS,GAA5B;SAA3B;OAAd;MAEA,MAAM,CAAC,IAAP,CAAa,QAAb,CAAuB,CAAC,MAAxB,CAAA;MAEA,IAAA,GAAQ,MAAM,CAAC,IAAP,CAAa,cAAb;MACR,KAAA,GAAQ,IAAI,CAAC,IAAL,CAAW,UAAX,CAAuB,CAAC;MAEhC,IAAA,GACC;QAAA,MAAA,EAAU,qBAAA,GAAwB,MAAM,CAAC,IAAP,CAAa,YAAb,CAAxB,GAAsD,+BAAhE;QACA,OAAA,EAAU,CAAA,CAAG,IAAH,CAAS,CAAC,IAAV,CAAgB,SAAhB,CADV;QAEA,QAAA,EAAU,+BAA+B,CAAC,OAAO,CAAC,OAAO,CAAC,KAF1D;;aAID,CAAC,CAAC,IAAF,CAAO,+BAA+B,CAAC,QAAvC,EAAiD,IAAjD,CAEC,CAAC,IAFF,CAEO,CAAA,SAAA,KAAA;eAAA,SAAE,QAAF;UAEL,IAAA,CAAmD,QAAQ,CAAC,OAA5D;AAAA,mBAAO,WAAA,CAAa,MAAb,EAAqB,QAAQ,CAAC,IAA9B,EAAP;;UAEA,IAAG,qBAAH;YACC,MAAM,CAAC,IAAP,CAAa,cAAb,CAA6B,CAAC,IAA9B,CAAA;mBACA,IAAI,CAAC,IAAL,CAAW,QAAQ,CAAC,IAApB,EAFD;WAAA,MAAA;YAIC,IAAI,CAAC,KAAL,CAAA;mBACA,MAAM,CAAC,IAAP,CAAa,cAAb,CAA6B,CAAC,IAA9B,CAAA,EALD;;QAJK;MAAA,CAAA,CAAA,CAAA,IAAA,CAFP,CAaC,CAAC,IAbF,CAaO,CAAA,SAAA,KAAA;eAAA,SAAE,KAAF,EAAS,UAAT,EAAqB,KAArB;iBAEL,WAAA,CAAa,MAAb,EAAqB,UAAA,GAAa,IAAb,GAAoB,KAAzC;QAFK;MAAA,CAAA,CAAA,CAAA,IAAA,CAbP,CAiBC,CAAC,MAjBF,CAiBS,CAAA,SAAA,KAAA;eAAA,SAAA;iBAEP,MAAM,CAAC,OAAP,CAAA;QAFO;MAAA,CAAA,CAAA,CAAA,IAAA,CAjBT;IAlB6F,CAA9F;IAwCA,CAAA,CAAG,0CAAH,CAA+C,CAAC,EAAhD,CAAmD,OAAnD,EAA4D,uEAA5D,EAAqI,SAAE,CAAF;AAEpI,UAAA;MAAA,MAAA,GAAc,CAAA,CAAG,IAAH,CAAS,CAAC,OAAV,CAAmB,OAAnB;MACd,WAAA,GAAc,MAAM,CAAC,IAAP,CAAa,UAAb;MAEd,MAAM,CAAC,KAAP,CAAc;QAAA,OAAA,EAAS,IAAT;QAAe,UAAA,EAAY;UAAA,UAAA,EAAY,MAAZ;UAAmB,OAAA,EAAS,GAA5B;SAA3B;OAAd;MAEA,WAAW,CAAC,IAAZ,CAAkB,kBAAlB,CAAsC,CAAC,MAAvC,CAAA;MAIA,MAAA,GAAU,MAAM,CAAC,IAAP,CAAa,0CAAb;MACV,OAAA,GAAU;aAEV,MAAM,CAAC,IAAP,CAAY,SAAE,KAAF;AAEX,YAAA;QAAA,CAAA,CAAG,IAAH,CAAS,CAAC,WAAV,CAAuB,OAAvB;QAEA,KAAA,GAAW,CAAA,CAAG,IAAH,CAAS,CAAC,GAAV,CAAA;QACX,QAAA,GAAW,CAAA,CAAG,IAAH,CAAS,CAAC,IAAV,CAAgB,UAAhB;QACX,OAAA,GAAW,CAAA,CAAG,IAAH,CAAS,CAAC,IAAV,CAAgB,SAAhB;QAEX,IAAA,CAAA,CAAc,QAAA,IAAY,KAA1B,CAAA;AAAA,iBAAA;;QAEA,IAAK,CAAE,KAAK,CAAC,KAAN,CAAa,OAAb,CAAF,IAA4B,CAAE,QAAA,IAAa,CAAE,KAAjB,CAAjC;UAEC,CAAC,CAAC,cAAF,CAAA;UAEA,CAAA,CAAG,IAAH,CAAS,CAAC,QAAV,CAAoB,OAApB;UAEA,IAAK,CAAE,OAAP;YACC,WAAW,CAAC,OAAZ,CAAqB,sBAAA,GAAyB,+BAA+B,CAAC,OAAO,CAAC,IAAI,CAAC,KAAtE,GAA8E,SAAnG;YACA,CAAA,CAAG,IAAH,CAAS,CAAC,KAAV,CAAA;YACA,OAAA,GAAU,KAHX;;iBAKA,MAAM,CAAC,OAAP,CAAA,EAXD;;MAVW,CAAZ;IAdoI,CAArI;WAyCA,WAAA,GAAc,SAAE,MAAF,EAAU,KAAV,EAAiB,OAAjB;;QAAiB,UAAU;;MAExC,OAAO,CAAC,KAAR,CAAc,KAAd;MAEA,IAAA,CAAoE,OAApE;QAAA,OAAA,GAAU,+BAA+B,CAAC,IAAI,CAAC,cAA/C;;aAEA,MAAM,CAAC,IAAP,CAAa,YAAb,CAA2B,CAAC,OAA5B,CAAqC,sBAAA,GAAyB,OAAzB,GAAmC,SAAxE;IANa;EA3KU,CAAzB;AARA"
|
10 |
}
|
lib/skyverge/woocommerce/payment-gateway/assets/js/frontend/sv-wc-payment-gateway-apple-pay.coffee
ADDED
@@ -0,0 +1,431 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
###
|
2 |
+
WooCommerce Apple Pay Handler
|
3 |
+
Version 4.7.0
|
4 |
+
|
5 |
+
Copyright (c) 2016, SkyVerge, Inc.
|
6 |
+
Licensed under the GNU General Public License v3.0
|
7 |
+
http://www.gnu.org/licenses/gpl-3.0.html
|
8 |
+
###
|
9 |
+
|
10 |
+
jQuery( document ).ready ($) ->
|
11 |
+
|
12 |
+
"use strict"
|
13 |
+
|
14 |
+
# The WooCommerce Apple Pay handler base class.
|
15 |
+
#
|
16 |
+
# @since 4.7.0
|
17 |
+
class window.SV_WC_Apple_Pay_Handler
|
18 |
+
|
19 |
+
|
20 |
+
# Constructs the handler.
|
21 |
+
#
|
22 |
+
# @since 4.7.0
|
23 |
+
constructor: (args) ->
|
24 |
+
|
25 |
+
@gateway_id = args.gateway_id
|
26 |
+
@gateway_slug = args.gateway_slug
|
27 |
+
@merchant_id = args.merchant_id
|
28 |
+
@ajax_url = args.ajax_url
|
29 |
+
@validate_nonce = args.validate_nonce
|
30 |
+
@recalculate_totals_nonce = args.recalculate_totals_nonce
|
31 |
+
@process_nonce = args.process_nonce
|
32 |
+
@payment_request = args.payment_request
|
33 |
+
@generic_error = args.generic_error
|
34 |
+
|
35 |
+
@buttons = '.sv-wc-apple-pay-button'
|
36 |
+
|
37 |
+
|
38 |
+
# Determines if Apple Pay is available.
|
39 |
+
#
|
40 |
+
# @since 4.7.0
|
41 |
+
# @return bool
|
42 |
+
is_available: ->
|
43 |
+
|
44 |
+
return false unless window.ApplePaySession
|
45 |
+
|
46 |
+
ApplePaySession.canMakePaymentsWithActiveCard( @merchant_id ).then ( canMakePayments ) =>
|
47 |
+
|
48 |
+
return canMakePayments
|
49 |
+
|
50 |
+
|
51 |
+
# Initializes the handler.
|
52 |
+
#
|
53 |
+
# @since 4.7.0
|
54 |
+
init: ->
|
55 |
+
|
56 |
+
return unless this.is_available()
|
57 |
+
|
58 |
+
# initialize for the various pages
|
59 |
+
if $( 'form.cart' ).length
|
60 |
+
this.init_product_page()
|
61 |
+
else if $( 'form.woocommerce-cart-form' ).length
|
62 |
+
this.init_cart_page()
|
63 |
+
else if $( 'form.woocommerce-checkout' ).length
|
64 |
+
this.init_checkout_page()
|
65 |
+
|
66 |
+
# bail if no UI was initialized
|
67 |
+
return unless @ui_element
|
68 |
+
|
69 |
+
if @payment_request
|
70 |
+
$( @buttons ).show()
|
71 |
+
|
72 |
+
$( document.body ).on 'click', '.sv-wc-apple-pay-button', ( e ) =>
|
73 |
+
|
74 |
+
e.preventDefault()
|
75 |
+
|
76 |
+
this.block_ui()
|
77 |
+
|
78 |
+
try
|
79 |
+
|
80 |
+
@session = this.get_new_session( @payment_request )
|
81 |
+
|
82 |
+
# set the payment card events
|
83 |
+
@session.onvalidatemerchant = ( event ) => this.on_validate_merchant( event )
|
84 |
+
@session.onpaymentmethodselected = ( event ) => this.on_payment_method_selected( event )
|
85 |
+
@session.onshippingcontactselected = ( event ) => this.on_shipping_contact_selected( event )
|
86 |
+
@session.onshippingmethodselected = ( event ) => this.on_shipping_method_selected( event )
|
87 |
+
@session.onpaymentauthorized = ( event ) => this.on_payment_authorized( event )
|
88 |
+
@session.oncancel = ( event ) => this.on_cancel_payment( event )
|
89 |
+
|
90 |
+
@session.begin()
|
91 |
+
|
92 |
+
catch error
|
93 |
+
|
94 |
+
this.fail_payment( error )
|
95 |
+
|
96 |
+
|
97 |
+
# Initializes the product page.
|
98 |
+
#
|
99 |
+
# @since 5.3.0
|
100 |
+
init_product_page: =>
|
101 |
+
|
102 |
+
@ui_element = $( 'form.cart' )
|
103 |
+
|
104 |
+
|
105 |
+
# Initializes the cart page.
|
106 |
+
#
|
107 |
+
# @since 5.3.0
|
108 |
+
init_cart_page: =>
|
109 |
+
|
110 |
+
@ui_element = $( 'form.woocommerce-cart-form' ).parents( 'div.woocommerce' )
|
111 |
+
|
112 |
+
# re-init if the cart totals are updated
|
113 |
+
$( document.body ).on 'updated_cart_totals', =>
|
114 |
+
|
115 |
+
this.reset_payment_request()
|
116 |
+
|
117 |
+
|
118 |
+
# Initializes the checkout page.
|
119 |
+
#
|
120 |
+
# @since 5.3.0
|
121 |
+
init_checkout_page: =>
|
122 |
+
|
123 |
+
@ui_element = $( 'form.woocommerce-checkout' )
|
124 |
+
@buttons = '.sv-wc-apply-pay-checkout'
|
125 |
+
|
126 |
+
$( document.body ).on 'updated_checkout', =>
|
127 |
+
|
128 |
+
# re-init if the checkout is updated
|
129 |
+
this.reset_payment_request()
|
130 |
+
|
131 |
+
|
132 |
+
# Gets a new Apple Pay session.
|
133 |
+
#
|
134 |
+
# @since 5.3.0
|
135 |
+
#
|
136 |
+
# @param [Object] payment_request payment request object
|
137 |
+
# @return ApplePaySession
|
138 |
+
get_new_session: ( payment_request ) ->
|
139 |
+
|
140 |
+
return new ApplePaySession( this.get_sdk_version(), payment_request )
|
141 |
+
|
142 |
+
|
143 |
+
# Gets the Apple SDK version to use.
|
144 |
+
#
|
145 |
+
# @since 5.3.0
|
146 |
+
# @return int
|
147 |
+
get_sdk_version: ->
|
148 |
+
|
149 |
+
return 2
|
150 |
+
|
151 |
+
|
152 |
+
# The callback for after the merchant data is validated.
|
153 |
+
#
|
154 |
+
# @since 4.7.0
|
155 |
+
on_validate_merchant: ( event ) =>
|
156 |
+
|
157 |
+
this.validate_merchant( event.validationURL ).then ( merchant_session ) =>
|
158 |
+
|
159 |
+
merchant_session = $.parseJSON( merchant_session )
|
160 |
+
|
161 |
+
@session.completeMerchantValidation( merchant_session )
|
162 |
+
|
163 |
+
, ( response ) =>
|
164 |
+
|
165 |
+
@session.abort()
|
166 |
+
|
167 |
+
this.fail_payment 'Merchant could no be validated. ' + response.message
|
168 |
+
|
169 |
+
|
170 |
+
# Validates the merchant data.
|
171 |
+
#
|
172 |
+
# @since 4.7.0
|
173 |
+
# @return object
|
174 |
+
validate_merchant: ( url ) => new Promise ( resolve, reject ) =>
|
175 |
+
|
176 |
+
data = {
|
177 |
+
'action': "wc_#{ @gateway_id }_apple_pay_validate_merchant",
|
178 |
+
'nonce': @validate_nonce,
|
179 |
+
'merchant_id': @merchant_id,
|
180 |
+
'url': url
|
181 |
+
}
|
182 |
+
|
183 |
+
# retrieve a payment request object
|
184 |
+
$.post @ajax_url, data, ( response ) =>
|
185 |
+
|
186 |
+
if response.success
|
187 |
+
resolve response.data
|
188 |
+
else
|
189 |
+
reject response.data
|
190 |
+
|
191 |
+
|
192 |
+
# Fires after a payment method has been selected.
|
193 |
+
#
|
194 |
+
# @since 4.7.0
|
195 |
+
on_payment_method_selected: ( event ) =>
|
196 |
+
|
197 |
+
new Promise ( resolve, reject ) =>
|
198 |
+
|
199 |
+
data = {
|
200 |
+
'action': "wc_#{ @gateway_id }_apple_pay_recalculate_totals",
|
201 |
+
'nonce': @recalculate_totals_nonce,
|
202 |
+
}
|
203 |
+
|
204 |
+
# retrieve a payment request object
|
205 |
+
$.post @ajax_url, data, ( response ) =>
|
206 |
+
|
207 |
+
if response.success
|
208 |
+
|
209 |
+
data = response.data
|
210 |
+
|
211 |
+
resolve @session.completePaymentMethodSelection( data.total, data.line_items )
|
212 |
+
|
213 |
+
else
|
214 |
+
|
215 |
+
console.error '[Apple Pay] Error selecting a shipping contact. ' + response.data.message
|
216 |
+
|
217 |
+
reject @session.completePaymentMethodSelection( @payment_request.total, @payment_request.lineItems )
|
218 |
+
|
219 |
+
|
220 |
+
# Fires after a shipping contact has been selected.
|
221 |
+
#
|
222 |
+
# @since 4.7.0
|
223 |
+
on_shipping_contact_selected: ( event ) =>
|
224 |
+
|
225 |
+
new Promise ( resolve, reject ) =>
|
226 |
+
|
227 |
+
data = {
|
228 |
+
'action': "wc_#{ @gateway_id }_apple_pay_recalculate_totals",
|
229 |
+
'nonce': @recalculate_totals_nonce,
|
230 |
+
'contact': event.shippingContact
|
231 |
+
}
|
232 |
+
|
233 |
+
# retrieve a payment request object
|
234 |
+
$.post @ajax_url, data, ( response ) =>
|
235 |
+
|
236 |
+
if response.success
|
237 |
+
|
238 |
+
data = response.data
|
239 |
+
|
240 |
+
resolve @session.completeShippingContactSelection( ApplePaySession.STATUS_SUCCESS, data.shipping_methods, data.total, data.line_items )
|
241 |
+
|
242 |
+
else
|
243 |
+
|
244 |
+
console.error '[Apple Pay] Error selecting a shipping contact. ' + response.data.message
|
245 |
+
|
246 |
+
reject @session.completeShippingContactSelection( ApplePaySession.STATUS_FAILURE, [], @payment_request.total, @payment_request.lineItems )
|
247 |
+
|
248 |
+
|
249 |
+
# Fires after a shipping method has been selected.
|
250 |
+
#
|
251 |
+
# @since 4.7.0
|
252 |
+
on_shipping_method_selected: ( event ) =>
|
253 |
+
|
254 |
+
new Promise ( resolve, reject ) =>
|
255 |
+
|
256 |
+
data = {
|
257 |
+
'action': "wc_#{ @gateway_id }_apple_pay_recalculate_totals",
|
258 |
+
'nonce': @recalculate_totals_nonce,
|
259 |
+
'method': event.shippingMethod.identifier
|
260 |
+
}
|
261 |
+
|
262 |
+
# retrieve a payment request object
|
263 |
+
$.post @ajax_url, data, ( response ) =>
|
264 |
+
|
265 |
+
if response.success
|
266 |
+
|
267 |
+
data = response.data
|
268 |
+
|
269 |
+
resolve @session.completeShippingMethodSelection( ApplePaySession.STATUS_SUCCESS, data.total, data.line_items )
|
270 |
+
|
271 |
+
else
|
272 |
+
|
273 |
+
console.error '[Apple Pay] Error selecting a shipping method. ' + response.data.message
|
274 |
+
|
275 |
+
reject @session.completeShippingMethodSelection( ApplePaySession.STATUS_FAILURE, @payment_request.total, @payment_request.lineItems )
|
276 |
+
|
277 |
+
|
278 |
+
# The callback for after the payment data is authorized.
|
279 |
+
#
|
280 |
+
# @since 4.7.0
|
281 |
+
on_payment_authorized: ( event ) =>
|
282 |
+
|
283 |
+
this.process_authorization( event.payment ).then ( response ) =>
|
284 |
+
|
285 |
+
this.set_payment_status( true )
|
286 |
+
|
287 |
+
this.complete_purchase( response )
|
288 |
+
|
289 |
+
, ( response ) =>
|
290 |
+
|
291 |
+
this.set_payment_status( false )
|
292 |
+
|
293 |
+
this.fail_payment 'Payment could no be processed. ' + response.message
|
294 |
+
|
295 |
+
|
296 |
+
# Processes the transaction data.
|
297 |
+
#
|
298 |
+
# @since 4.7.0
|
299 |
+
process_authorization: ( payment ) => new Promise ( resolve, reject ) =>
|
300 |
+
|
301 |
+
data = {
|
302 |
+
action: "wc_#{ @gateway_id }_apple_pay_process_payment",
|
303 |
+
nonce: @process_nonce,
|
304 |
+
payment: JSON.stringify( payment )
|
305 |
+
}
|
306 |
+
|
307 |
+
$.post @ajax_url, data, ( response ) =>
|
308 |
+
|
309 |
+
if response.success
|
310 |
+
resolve response.data
|
311 |
+
else
|
312 |
+
reject response.data
|
313 |
+
|
314 |
+
|
315 |
+
# The callback for when the payment card is cancelled/dismissed.
|
316 |
+
#
|
317 |
+
# @since 4.7.0
|
318 |
+
on_cancel_payment: ( event ) =>
|
319 |
+
|
320 |
+
this.unblock_ui()
|
321 |
+
|
322 |
+
|
323 |
+
# Completes the purchase based on the gateway result.
|
324 |
+
#
|
325 |
+
# @since 4.7.0
|
326 |
+
complete_purchase: ( response ) ->
|
327 |
+
|
328 |
+
window.location = response.redirect
|
329 |
+
|
330 |
+
|
331 |
+
# Fails the purchase based on the gateway result.
|
332 |
+
#
|
333 |
+
# @since 4.7.0
|
334 |
+
fail_payment: ( error ) ->
|
335 |
+
|
336 |
+
console.error '[Apple Pay] ' + error
|
337 |
+
|
338 |
+
this.unblock_ui()
|
339 |
+
|
340 |
+
this.render_errors( [ @generic_error ] )
|
341 |
+
|
342 |
+
|
343 |
+
# Sets the Apple Pay payment status depending on the gateway result.
|
344 |
+
#
|
345 |
+
# @since 4.7.0
|
346 |
+
set_payment_status: ( success ) ->
|
347 |
+
|
348 |
+
if success
|
349 |
+
status = ApplePaySession.STATUS_SUCCESS
|
350 |
+
else
|
351 |
+
status = ApplePaySession.STATUS_FAILURE
|
352 |
+
|
353 |
+
@session.completePayment( status )
|
354 |
+
|
355 |
+
# Optional, for resetting the request data
|
356 |
+
|
357 |
+
|
358 |
+
# Resets the payment request via AJAX.
|
359 |
+
#
|
360 |
+
# Extending handlers can call this on change events to refresh the data.
|
361 |
+
#
|
362 |
+
# @since 4.7.0
|
363 |
+
reset_payment_request: ( data = {} ) =>
|
364 |
+
|
365 |
+
this.block_ui()
|
366 |
+
|
367 |
+
this.get_payment_request( data ).then ( response ) =>
|
368 |
+
|
369 |
+
$( @buttons ).show()
|
370 |
+
|
371 |
+
@payment_request = $.parseJSON( response )
|
372 |
+
|
373 |
+
this.unblock_ui()
|
374 |
+
|
375 |
+
, ( response ) =>
|
376 |
+
|
377 |
+
console.error '[Apple Pay] Could not build payment request. ' + response.message
|
378 |
+
|
379 |
+
$( @buttons ).hide()
|
380 |
+
|
381 |
+
this.unblock_ui()
|
382 |
+
|
383 |
+
|
384 |
+
# Gets the payment request via AJAX.
|
385 |
+
#
|
386 |
+
# @since 4.7.0
|
387 |
+
get_payment_request: ( data ) => new Promise ( resolve, reject ) =>
|
388 |
+
|
389 |
+
base_data = {
|
390 |
+
'action': "wc_#{ @gateway_id }_apple_pay_get_payment_request"
|
391 |
+
}
|
392 |
+
|
393 |
+
$.extend data, base_data
|
394 |
+
|
395 |
+
# retrieve a payment request object
|
396 |
+
$.post @ajax_url, data, ( response ) =>
|
397 |
+
|
398 |
+
if response.success
|
399 |
+
resolve response.data
|
400 |
+
else
|
401 |
+
reject response.data
|
402 |
+
|
403 |
+
|
404 |
+
# Renders any new errors and bring them into the viewport.
|
405 |
+
#
|
406 |
+
# @since 4.7.0
|
407 |
+
render_errors: ( errors ) ->
|
408 |
+
|
409 |
+
# hide and remove any previous errors
|
410 |
+
$( '.woocommerce-error, .woocommerce-message' ).remove()
|
411 |
+
|
412 |
+
# add errors
|
413 |
+
@ui_element.prepend '<ul class="woocommerce-error"><li>' + errors.join( '</li><li>' ) + '</li></ul>'
|
414 |
+
|
415 |
+
# unblock UI
|
416 |
+
@ui_element.removeClass( 'processing' ).unblock()
|
417 |
+
|
418 |
+
# scroll to top
|
419 |
+
$( 'html, body' ).animate( { scrollTop: @ui_element.offset().top - 100 }, 1000 )
|
420 |
+
|
421 |
+
|
422 |
+
# Blocks the payment form UI.
|
423 |
+
#
|
424 |
+
# @since 4.7.0
|
425 |
+
block_ui: -> @ui_element.block( message: null, overlayCSS: background: '#fff', opacity: 0.6 )
|
426 |
+
|
427 |
+
|
428 |
+
# Unblocks the payment form UI.
|
429 |
+
#
|
430 |
+
# @since 4.7.0
|
431 |
+
unblock_ui: -> @ui_element.unblock()
|
lib/skyverge/woocommerce/payment-gateway/assets/js/frontend/sv-wc-payment-gateway-apple-pay.min.js
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
/* WooCommerce Apple Pay Handler Version 4.7.0 Copyright (c) 2016, SkyVerge, Inc. Licensed under the GNU General Public License v3.0 http://www.gnu.org/licenses/gpl-3.0.html */(function() { var bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }; jQuery(document).ready(function($) { "use strict"; return window.SV_WC_Apple_Pay_Handler = (function() { function SV_WC_Apple_Pay_Handler(args) { this.get_payment_request = bind(this.get_payment_request, this); this.reset_payment_request = bind(this.reset_payment_request, this); this.on_cancel_payment = bind(this.on_cancel_payment, this); this.process_authorization = bind(this.process_authorization, this); this.on_payment_authorized = bind(this.on_payment_authorized, this); this.on_shipping_method_selected = bind(this.on_shipping_method_selected, this); this.on_shipping_contact_selected = bind(this.on_shipping_contact_selected, this); this.on_payment_method_selected = bind(this.on_payment_method_selected, this); this.validate_merchant = bind(this.validate_merchant, this); this.on_validate_merchant = bind(this.on_validate_merchant, this); this.init_checkout_page = bind(this.init_checkout_page, this); this.init_cart_page = bind(this.init_cart_page, this); this.init_product_page = bind(this.init_product_page, this); this.gateway_id = args.gateway_id; this.gateway_slug = args.gateway_slug; this.merchant_id = args.merchant_id; this.ajax_url = args.ajax_url; this.validate_nonce = args.validate_nonce; this.recalculate_totals_nonce = args.recalculate_totals_nonce; this.process_nonce = args.process_nonce; this.payment_request = args.payment_request; this.generic_error = args.generic_error; this.buttons = '.sv-wc-apple-pay-button'; } SV_WC_Apple_Pay_Handler.prototype.is_available = function() { if (!window.ApplePaySession) { return false; } return ApplePaySession.canMakePaymentsWithActiveCard(this.merchant_id).then((function(_this) { return function(canMakePayments) { return canMakePayments; }; })(this)); }; SV_WC_Apple_Pay_Handler.prototype.init = function() { if (!this.is_available()) { return; } if ($('form.cart').length) { this.init_product_page(); } else if ($('form.woocommerce-cart-form').length) { this.init_cart_page(); } else if ($('form.woocommerce-checkout').length) { this.init_checkout_page(); } if (!this.ui_element) { return; } if (this.payment_request) { $(this.buttons).show(); } return $(document.body).on('click', '.sv-wc-apple-pay-button', (function(_this) { return function(e) { var error; e.preventDefault(); _this.block_ui(); try { _this.session = _this.get_new_session(_this.payment_request); _this.session.onvalidatemerchant = function(event) { return _this.on_validate_merchant(event); }; _this.session.onpaymentmethodselected = function(event) { return _this.on_payment_method_selected(event); }; _this.session.onshippingcontactselected = function(event) { return _this.on_shipping_contact_selected(event); }; _this.session.onshippingmethodselected = function(event) { return _this.on_shipping_method_selected(event); }; _this.session.onpaymentauthorized = function(event) { return _this.on_payment_authorized(event); }; _this.session.oncancel = function(event) { return _this.on_cancel_payment(event); }; return _this.session.begin(); } catch (_error) { error = _error; return _this.fail_payment(error); } }; })(this)); }; SV_WC_Apple_Pay_Handler.prototype.init_product_page = function() { return this.ui_element = $('form.cart'); }; SV_WC_Apple_Pay_Handler.prototype.init_cart_page = function() { this.ui_element = $('form.woocommerce-cart-form').parents('div.woocommerce'); return $(document.body).on('updated_cart_totals', (function(_this) { return function() { return _this.reset_payment_request(); }; })(this)); }; SV_WC_Apple_Pay_Handler.prototype.init_checkout_page = function() { this.ui_element = $('form.woocommerce-checkout'); this.buttons = '.sv-wc-apply-pay-checkout'; return $(document.body).on('updated_checkout', (function(_this) { return function() { return _this.reset_payment_request(); }; })(this)); }; SV_WC_Apple_Pay_Handler.prototype.get_new_session = function(payment_request) { return new ApplePaySession(this.get_sdk_version(), payment_request); }; SV_WC_Apple_Pay_Handler.prototype.get_sdk_version = function() { return 2; }; SV_WC_Apple_Pay_Handler.prototype.on_validate_merchant = function(event) { return this.validate_merchant(event.validationURL).then((function(_this) { return function(merchant_session) { merchant_session = $.parseJSON(merchant_session); return _this.session.completeMerchantValidation(merchant_session); }; })(this), (function(_this) { return function(response) { _this.session.abort(); return _this.fail_payment('Merchant could no be validated. ' + response.message); }; })(this)); }; SV_WC_Apple_Pay_Handler.prototype.validate_merchant = function(url) { return new Promise((function(_this) { return function(resolve, reject) { var data; data = { 'action': "wc_" + _this.gateway_id + "_apple_pay_validate_merchant", 'nonce': _this.validate_nonce, 'merchant_id': _this.merchant_id, 'url': url }; return $.post(_this.ajax_url, data, function(response) { if (response.success) { return resolve(response.data); } else { return reject(response.data); } }); }; })(this)); }; SV_WC_Apple_Pay_Handler.prototype.on_payment_method_selected = function(event) { return new Promise((function(_this) { return function(resolve, reject) { var data; data = { 'action': "wc_" + _this.gateway_id + "_apple_pay_recalculate_totals", 'nonce': _this.recalculate_totals_nonce }; return $.post(_this.ajax_url, data, function(response) { if (response.success) { data = response.data; return resolve(_this.session.completePaymentMethodSelection(data.total, data.line_items)); } else { console.error('[Apple Pay] Error selecting a shipping contact. ' + response.data.message); return reject(_this.session.completePaymentMethodSelection(_this.payment_request.total, _this.payment_request.lineItems)); } }); }; })(this)); }; SV_WC_Apple_Pay_Handler.prototype.on_shipping_contact_selected = function(event) { return new Promise((function(_this) { return function(resolve, reject) { var data; data = { 'action': "wc_" + _this.gateway_id + "_apple_pay_recalculate_totals", 'nonce': _this.recalculate_totals_nonce, 'contact': event.shippingContact }; return $.post(_this.ajax_url, data, function(response) { if (response.success) { data = response.data; return resolve(_this.session.completeShippingContactSelection(ApplePaySession.STATUS_SUCCESS, data.shipping_methods, data.total, data.line_items)); } else { console.error('[Apple Pay] Error selecting a shipping contact. ' + response.data.message); return reject(_this.session.completeShippingContactSelection(ApplePaySession.STATUS_FAILURE, [], _this.payment_request.total, _this.payment_request.lineItems)); } }); }; })(this)); }; SV_WC_Apple_Pay_Handler.prototype.on_shipping_method_selected = function(event) { return new Promise((function(_this) { return function(resolve, reject) { var data; data = { 'action': "wc_" + _this.gateway_id + "_apple_pay_recalculate_totals", 'nonce': _this.recalculate_totals_nonce, 'method': event.shippingMethod.identifier }; return $.post(_this.ajax_url, data, function(response) { if (response.success) { data = response.data; return resolve(_this.session.completeShippingMethodSelection(ApplePaySession.STATUS_SUCCESS, data.total, data.line_items)); } else { console.error('[Apple Pay] Error selecting a shipping method. ' + response.data.message); return reject(_this.session.completeShippingMethodSelection(ApplePaySession.STATUS_FAILURE, _this.payment_request.total, _this.payment_request.lineItems)); } }); }; })(this)); }; SV_WC_Apple_Pay_Handler.prototype.on_payment_authorized = function(event) { return this.process_authorization(event.payment).then((function(_this) { return function(response) { _this.set_payment_status(true); return _this.complete_purchase(response); }; })(this), (function(_this) { return function(response) { _this.set_payment_status(false); return _this.fail_payment('Payment could no be processed. ' + response.message); }; })(this)); }; SV_WC_Apple_Pay_Handler.prototype.process_authorization = function(payment) { return new Promise((function(_this) { return function(resolve, reject) { var data; data = { action: "wc_" + _this.gateway_id + "_apple_pay_process_payment", nonce: _this.process_nonce, payment: JSON.stringify(payment) }; return $.post(_this.ajax_url, data, function(response) { if (response.success) { return resolve(response.data); } else { return reject(response.data); } }); }; })(this)); }; SV_WC_Apple_Pay_Handler.prototype.on_cancel_payment = function(event) { return this.unblock_ui(); }; SV_WC_Apple_Pay_Handler.prototype.complete_purchase = function(response) { return window.location = response.redirect; }; SV_WC_Apple_Pay_Handler.prototype.fail_payment = function(error) { console.error('[Apple Pay] ' + error); this.unblock_ui(); return this.render_errors([this.generic_error]); }; SV_WC_Apple_Pay_Handler.prototype.set_payment_status = function(success) { var status; if (success) { status = ApplePaySession.STATUS_SUCCESS; } else { status = ApplePaySession.STATUS_FAILURE; } return this.session.completePayment(status); }; SV_WC_Apple_Pay_Handler.prototype.reset_payment_request = function(data) { if (data == null) { data = {}; } this.block_ui(); return this.get_payment_request(data).then((function(_this) { return function(response) { $(_this.buttons).show(); _this.payment_request = $.parseJSON(response); return _this.unblock_ui(); }; })(this), (function(_this) { return function(response) { console.error('[Apple Pay] Could not build payment request. ' + response.message); $(_this.buttons).hide(); return _this.unblock_ui(); }; })(this)); }; SV_WC_Apple_Pay_Handler.prototype.get_payment_request = function(data) { return new Promise((function(_this) { return function(resolve, reject) { var base_data; base_data = { 'action': "wc_" + _this.gateway_id + "_apple_pay_get_payment_request" }; $.extend(data, base_data); return $.post(_this.ajax_url, data, function(response) { if (response.success) { return resolve(response.data); } else { return reject(response.data); } }); }; })(this)); }; SV_WC_Apple_Pay_Handler.prototype.render_errors = function(errors) { $('.woocommerce-error, .woocommerce-message').remove(); this.ui_element.prepend('<ul class="woocommerce-error"><li>' + errors.join('</li><li>') + '</li></ul>'); this.ui_element.removeClass('processing').unblock(); return $('html, body').animate({ scrollTop: this.ui_element.offset().top - 100 }, 1000); }; SV_WC_Apple_Pay_Handler.prototype.block_ui = function() { return this.ui_element.block({ message: null, overlayCSS: { background: '#fff', opacity: 0.6 } }); }; SV_WC_Apple_Pay_Handler.prototype.unblock_ui = function() { return this.ui_element.unblock(); }; return SV_WC_Apple_Pay_Handler; })(); });}).call(this);
|
lib/skyverge/woocommerce/payment-gateway/assets/js/frontend/sv-wc-payment-gateway-frontend.min.map
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
{"version":3,"sources":["sv-wc-payment-gateway-frontend.coffee"],"names":["jQuery","document","ready","$","window","SV_WC_Payment_Form_Handler","args","this","id","id_dasherized","plugin_id","type","csc_required","length","form","handle_checkout_page","handle_pay_page","console","log","handle_add_payment_method_page","params","on","_this","handle_sample_check_hint","trigger","instance","body","format_credit_card_inputs","set_payment_fields","handle_saved_payment_methods","validate_payment_data","submit","val","payment_fields","tokenized_payment_method_selected","is","find","validate_card_data","validate_account_data","payment","change","do_inline_credit_card_validation","$csc","$expiry","validateCardExpiry","addClass","removeClass","validateCardCVC","account_number","csc","errors","expiry","cardExpiryVal","replace","push","card_number_length_invalid","test","card_number_digits_invalid","validateCardNumber","card_number_invalid","card_number_missing","card_exp_date_invalid","cvv_digits_invalid","cvv_length_invalid","cvv_missing","render_errors","routing_number","routing_number_length_invalid","routing_number_digits_invalid","routing_number_missing","account_number_length_invalid","account_number_invalid","account_number_missing","remove","prepend","join","unblock","blur","animate","scrollTop","offset","top","$csc_field","$new_payment_method_selection","parent","slideUp","after","slideDown","$parent_row","closest","next","show","hide","$sample_check"],"mappings":"CAAA,WAQAA,OAAQC,UAAWC,MAAM,SAACC,GACzB,mBAGMC,QAAOC,2BAAA,WAaC,QAAAA,GAACC,GASb,GAPAC,KAACC,GAAgBF,EAAKE,GACtBD,KAACE,cAAgBH,EAAKG,cACtBF,KAACG,UAAgBJ,EAAKI,UACtBH,KAACI,KAAgBL,EAAKK,KACtBJ,KAACK,aAAgBN,EAAKM,aAGnBT,EAAG,iBAAkBU,OACvBN,KAACO,KAAOX,EAAG,iBACXI,KAAKQ,2BAED,IAAGZ,EAAG,qBAAsBU,OAChCN,KAACO,KAAOX,EAAG,qBACXI,KAAKS,sBAED,CAAA,IAAGb,EAAG,2BAA4BU,OAMtC,WADAI,SAAQC,IAAK,yBAJbX,MAACO,KAAOX,EAAG,2BACXI,KAAKY,iCAONZ,KAACa,OAAShB,OAAYG,KAACG,UAAW,WAG0I,WAATH,KAACI,MAApKJ,KAACO,KAAKO,GAAI,QAAS,uGAAwG,SAAAC,SAAA,kBAAGA,GAAKC,6BAARhB,OAE3HJ,EAAGF,UAAWuB,QAAS,mCAAqChB,GAAID,KAACC,GAAIiB,SAAUlB,0BAMhFQ,qBAAsB,iBAGwE,gBAATR,KAACI,MAArFR,EAAGF,SAASyB,MAAOL,GAAI,mBAAoB,SAAAC,SAAA,kBAAGA,GAAKK,8BAARpB,OAG3CJ,EAAGF,SAASyB,MAAOL,GAAI,mBAAoB,SAAAC,SAAA,kBAAGA,GAAKM,uBAARrB,OAK3CJ,EAAGF,SAASyB,MAAOL,GAAI,mBAAoB,SAAAC,SAAA,kBAAGA,GAAKO,iCAARtB,OAG3CA,KAACO,KAAKO,GAAI,wBAAyBd,KAACC,GAAO,SAAAc,SAAA,kBAAGA,GAAKQ,0BAARvB,oBAM5CS,gBAAiB,iBAEhBT,MAAKqB,qBAGO,gBAATrB,KAACI,MACHJ,KAAKoB,4BAGNpB,KAAKsB,+BAGLtB,KAACO,KAAKiB,OAAO,SAAAT,SAAA,YAGZ,MAAuCnB,GAAG,oDAAqD6B,QAASV,EAACd,GAAlGc,EAAKQ,wBAAZ,SAHYvB,oBASdY,+BAAgC,iBAE/BZ,MAAKqB,qBAGO,gBAATrB,KAACI,MACHJ,KAAKoB,4BAGNpB,KAACO,KAAKiB,OAAO,SAAAT,SAAA,YAGZ,MAAuCnB,GAAG,0DAA2D6B,QAASV,EAACd,GAAxGc,EAAKQ,wBAAZ,SAHYvB,oBAWdqB,mBAAoB,iBACnBrB,MAAC0B,eAAiB9B,EAAG,mBAAoBI,KAACC,iBAM3CsB,sBAAuB,WAGtB,GAAAI,EAAA,OAAgB3B,MAACO,KAAKqB,GAAI,gBAAnB,GAEPD,EAAoC3B,KAAC0B,eAAeG,KAAM,mDAAoDJ,MAG/FE,GAAR,EAGK,gBAAT3B,KAACI,KACIJ,KAAK8B,qBAEL9B,KAAK+B,sCAMdX,0BAA2B,iBAC1BxB,GAAG,6DAA8DoC,QAAS,oBAAqBC,SAC/FrC,EAAG,qDAAsDoC,QAAS,oBAAqBC,SACvFrC,EAAG,kDAAmDoC,QAAS,iBAAkBC,SAGjFrC,EAAG,oDAAqDkB,GAAI,qBAAsB,SAAAC,SAAA,kBAAGA,GAAKmB,qCAARlC,oBAMnFkC,iCAAkC,WAEjC,GAAAC,GAAAC,CAQA,OARAA,GAAUxC,EAAG,qDACbuC,EAAUvC,EAAG,kDAEVA,EAAEoC,QAAQK,mBAAoBD,EAAQJ,QAAS,kBACjDI,EAAQE,SAAU,cAElBF,EAAQG,YAAa,cAEnB3C,EAAEoC,QAAQQ,gBAAiBL,EAAKV,OAClCU,EAAKG,SAAU,cAEfH,EAAKI,YAAa,2BAMpBT,mBAAoB,WACnB,GAAAW,GAAAC,EAAAC,EAAAC,CA6BA,OA7BAD,MAEAF,EAAiBzC,KAAC0B,eAAeG,KAAM,6DAA8DJ,MACrGmB,EAAiBhD,EAAEoC,QAAQa,cAAe7C,KAAC0B,eAAeG,KAAM,qDAAsDJ,OACtHiB,EAAiB1C,KAAC0B,eAAeG,KAAM,kDAAmDJ,MAG1FgB,EAAiBA,EAAeK,QAAS,QAAS,IAG3CL,IAG+CA,EAAenC,OAAS,IAAMmC,EAAenC,OAAS,KAA3GqC,EAAOI,KAAM/C,KAACa,OAAOmC,4BACgC,KAAKC,KAAMR,IAAhEE,EAAOI,KAAM/C,KAACa,OAAOqC,4BAC6BtD,EAAEoC,QAAQmB,mBAAoBV,IAAhFE,EAAOI,KAAM/C,KAACa,OAAOuC,sBAJrBT,EAAOI,KAAM/C,KAACa,OAAOwC,qBAO8BzD,EAAEoC,QAAQK,mBAAoBO,IAAlFD,EAAOI,KAAM/C,KAACa,OAAOyC,uBAGlB,MAAAZ,IAEKA,GAGuC,KAAKO,KAAMP,IAAxDC,EAAOI,KAAM/C,KAACa,OAAO0C,qBACwBb,EAAIpC,OAAS,GAAKoC,EAAIpC,OAAS,IAA5EqC,EAAOI,KAAM/C,KAACa,OAAO2C,qBAHrBb,EAAOI,KAAM/C,KAACa,OAAO4C,cAKpBd,EAAOrC,OAAS,GAClBN,KAAK0D,cAAef,IACb,IAGP3C,KAAC0B,eAAeG,KAAM,6DAA8DJ,IAAKgB,IAClF,gBAMTV,sBAAuB,WACtB,GAAAU,GAAAE,EAAAgB,CAmBA,OAnBAhB,MAEAgB,EAAiB3D,KAAC0B,eAAeG,KAAK,wDAAwDJ,MAC9FgB,EAAiBzC,KAAC0B,eAAeG,KAAK,wDAAwDJ,MAGvFkC,GAGkD,IAAKA,EAAerD,QAA5EqC,EAAOI,KAAM/C,KAACa,OAAO+C,+BACmC,KAAKX,KAAMU,IAAnEhB,EAAOI,KAAM/C,KAACa,OAAOgD,gCAHrBlB,EAAOI,KAAM/C,KAACa,OAAOiD,wBAMfrB,IAGkDA,EAAenC,OAAS,GAAKmC,EAAenC,OAAS,KAA7GqC,EAAOI,KAAM/C,KAACa,OAAOkD,+BAC4B,KAAKd,KAAMR,IAA5DE,EAAOI,KAAM/C,KAACa,OAAOmD,yBAHrBrB,EAAOI,KAAM/C,KAACa,OAAOoD,wBAKnBtB,EAAOrC,OAAS,GAClBN,KAAK0D,cAAef,IACb,IAGP3C,KAAC0B,eAAeG,KAAM,wDAAyDJ,IAAKgB,IAC7E,gBAMTiB,cAAe,SAACf,SAGf/C,GAAG,4CAA6CsE,SAGhDlE,KAACO,KAAK4D,QAAQ,qCAAuCxB,EAAOyB,KAAM,aAAgB,cAGlFpE,KAACO,KAAKgC,YAAa,cAAe8B,UAClCrE,KAACO,KAAKsB,KAAM,uBAAwByC,OAGpC1E,EAAG,cAAe2E,SAAWC,UAAWxE,KAACO,KAAKkE,SAASC,IAAM,KAAO,kBAMrEpD,6BAA8B,WAG7B,GAAAqD,GAAAC,EAAAvE,EAAAH,QAAAA,GAAgBF,KAACE,cACjBG,EAAgBL,KAACK,aACjBuE,EAAgChF,EAAG,aAAcM,EAAe,4BAChEyE,EAAaC,EAA8B/C,KAAM,kDAAmDgD,SAGpGjF,EAAG,eAAgBI,KAACE,cAAe,kBAAkB+B,OAAO,WAC3D,GAAAN,EAEA,IAFAA,EAAoC/B,EAAG,eAAgBM,EAAe,0BAA0BuB,OAQ/F,GAHAmD,EAA8BE,QAAS,KAGpCzE,QACFsE,GAAWpC,YAAa,iBAAkBD,SAAU,kBACpDsC,EAA8BG,MAAOJ,OAOtC,IAHAC,EAA8BI,UAAW,KAGtC3E,QACFsE,GAAWpC,YAAa,kBAAmBD,SAAU,iBACrDsC,EAA8B/C,KAAM,qDAAsDgD,SAASE,MAAOJ,KAC5G1C,SAIDrC,EAAG,uBAAwBqC,OAAO,WACjC,GAAAgD,EAEA,OAFAA,GAAcrF,EAAG,eAAgBM,EAAe,4BAA4BgF,QAAS,cAElFtF,EAAGI,MAAO4B,GAAI,aAChBqD,EAAYD,YACZC,EAAYE,OAAOC,SAEnBH,EAAYI,OACZJ,EAAYE,OAAOE,UACpBpD,sBAMFjB,yBAA0B,WAEzB,GAAAsE,EAEA,OAFAA,GAAgBtF,KAAC0B,eAAeG,KAAM,sDAEnCyD,EAAc1D,GAAI,YAAkB0D,EAAcR,UAAeQ,EAAcN;AAvUrF;;;;;;;;;AAAA;EAQA,MAAA,CAAQ,QAAR,CAAkB,CAAC,KAAnB,CAAyB,SAAC,CAAD;IACxB;WAGM,MAAM,CAAC;MAaC,oCAAC,IAAD;QAEZ,IAAC,CAAA,EAAD,GAAiB,IAAI,CAAC;QACtB,IAAC,CAAA,aAAD,GAAiB,IAAI,CAAC;QACtB,IAAC,CAAA,SAAD,GAAiB,IAAI,CAAC;QACtB,IAAC,CAAA,IAAD,GAAiB,IAAI,CAAC;QACtB,IAAC,CAAA,YAAD,GAAiB,IAAI,CAAC;QAGtB,IAAG,CAAA,CAAG,eAAH,CAAoB,CAAC,MAAxB;UACC,IAAC,CAAA,IAAD,GAAQ,CAAA,CAAG,eAAH;UACR,IAAI,CAAC,oBAAL,CAAA,EAFD;SAAA,MAIK,IAAG,CAAA,CAAG,mBAAH,CAAwB,CAAC,MAA5B;UACJ,IAAC,CAAA,IAAD,GAAQ,CAAA,CAAG,mBAAH;UACR,IAAI,CAAC,eAAL,CAAA,EAFI;SAAA,MAIA,IAAG,CAAA,CAAG,yBAAH,CAA8B,CAAC,MAAlC;UACJ,IAAC,CAAA,IAAD,GAAQ,CAAA,CAAG,yBAAH;UACR,IAAI,CAAC,8BAAL,CAAA,EAFI;SAAA,MAAA;UAKJ,OAAO,CAAC,GAAR,CAAa,wBAAb;AACA,iBANI;;QASL,IAAC,CAAA,MAAD,GAAU,MAAQ,CAAI,IAAC,CAAA,SAAH,GAAc,SAAhB;QAGlB,IAAmK,IAAC,CAAA,IAAD,KAAS,QAA5K;UAAA,IAAC,CAAA,IAAI,CAAC,EAAN,CAAU,OAAV,EAAmB,sGAAnB,EAA2H,CAAA,SAAA,KAAA;mBAAA,SAAA;qBAAG,KAAI,CAAC,wBAAL,CAAA;YAAH;UAAA,CAAA,CAAA,CAAA,IAAA,CAA3H,EAAA;;QAEA,CAAA,CAAG,QAAH,CAAa,CAAC,OAAd,CAAuB,iCAAvB,EAA0D;UAAE,EAAA,EAAI,IAAC,CAAA,EAAP;UAAW,QAAA,EAAU,IAArB;SAA1D;MA/BY;;2CAqCb,oBAAA,GAAsB,SAAA;QAGrB,IAAoF,IAAC,CAAA,IAAD,KAAS,aAA7F;UAAA,CAAA,CAAG,QAAQ,CAAC,IAAZ,CAAkB,CAAC,EAAnB,CAAuB,kBAAvB,EAA2C,CAAA,SAAA,KAAA;mBAAA,SAAA;qBAAG,KAAI,CAAC,yBAAL,CAAA;YAAH;UAAA,CAAA,CAAA,CAAA,IAAA,CAA3C,EAAA;;QAGA,CAAA,CAAG,QAAQ,CAAC,IAAZ,CAAkB,CAAC,EAAnB,CAAuB,kBAAvB,EAA2C,CAAA,SAAA,KAAA;iBAAA,SAAA;mBAAG,KAAI,CAAC,kBAAL,CAAA;UAAH;QAAA,CAAA,CAAA,CAAA,IAAA,CAA3C;QAKA,CAAA,CAAG,QAAQ,CAAC,IAAZ,CAAkB,CAAC,EAAnB,CAAuB,kBAAvB,EAA2C,CAAA,SAAA,KAAA;iBAAA,SAAA;mBAAG,KAAI,CAAC,4BAAL,CAAA;UAAH;QAAA,CAAA,CAAA,CAAA,IAAA,CAA3C;eAGA,IAAC,CAAA,IAAI,CAAC,EAAN,CAAU,uBAAA,GAAyB,IAAC,CAAA,EAApC,EAA2C,CAAA,SAAA,KAAA;iBAAA,SAAA;mBAAG,KAAI,CAAC,qBAAL,CAAA;UAAH;QAAA,CAAA,CAAA,CAAA,IAAA,CAA3C;MAdqB;;2CAoBtB,eAAA,GAAiB,SAAA;QAEhB,IAAI,CAAC,kBAAL,CAAA;QAGA,IAAG,IAAC,CAAA,IAAD,KAAS,aAAZ;UACC,IAAI,CAAC,yBAAL,CAAA,EADD;;QAIA,IAAI,CAAC,4BAAL,CAAA;eAGA,IAAC,CAAA,IAAI,CAAC,MAAN,CAAa,CAAA,SAAA,KAAA;iBAAA,SAAA;YAGZ,IAAuC,CAAA,CAAG,kDAAH,CAAuD,CAAC,GAAxD,CAAA,CAAA,KAAiE,KAAC,CAAA,EAAzG;AAAA,qBAAO,KAAI,CAAC,qBAAL,CAAA,EAAP;;UAHY;QAAA,CAAA,CAAA,CAAA,IAAA,CAAb;MAZgB;;2CAqBjB,8BAAA,GAAgC,SAAA;QAE/B,IAAI,CAAC,kBAAL,CAAA;QAGA,IAAG,IAAC,CAAA,IAAD,KAAS,aAAZ;UACC,IAAI,CAAC,yBAAL,CAAA,EADD;;eAIA,IAAC,CAAA,IAAI,CAAC,MAAN,CAAa,CAAA,SAAA,KAAA;iBAAA,SAAA;YAGZ,IAAuC,CAAA,CAAG,wDAAH,CAA6D,CAAC,GAA9D,CAAA,CAAA,KAAuE,KAAC,CAAA,EAA/G;AAAA,qBAAO,KAAI,CAAC,qBAAL,CAAA,EAAP;;UAHY;QAAA,CAAA,CAAA,CAAA,IAAA,CAAb;MAT+B;;2CAoBhC,kBAAA,GAAoB,SAAA;eACnB,IAAC,CAAA,cAAD,GAAkB,CAAA,CAAG,kBAAA,GAAoB,IAAC,CAAA,EAAxB;MADC;;2CAOpB,qBAAA,GAAuB,SAAA;AAGtB,YAAA;QAAA,IAAgB,IAAC,CAAA,IAAI,CAAC,EAAN,CAAU,aAAV,CAAhB;AAAA,iBAAO,MAAP;;QAEA,iCAAA,GAAoC,IAAC,CAAA,cAAc,CAAC,IAAhB,CAAsB,iDAAtB,CAAyE,CAAC,GAA1E,CAAA;QAGpC,IAAe,iCAAf;AAAA,iBAAO,KAAP;;QAGA,IAAG,IAAC,CAAA,IAAD,KAAS,aAAZ;AACC,iBAAO,IAAI,CAAC,kBAAL,CAAA,EADR;SAAA,MAAA;AAGC,iBAAO,IAAI,CAAC,qBAAL,CAAA,EAHR;;MAXsB;;2CAoBvB,yBAAA,GAA2B,SAAA;QAC1B,CAAA,CAAG,2DAAH,CAAgE,CAAC,OAAjE,CAA0E,kBAA1E,CAA8F,CAAC,MAA/F,CAAA;QACA,CAAA,CAAG,mDAAH,CAAwD,CAAC,OAAzD,CAAkE,kBAAlE,CAAsF,CAAC,MAAvF,CAAA;QACA,CAAA,CAAG,gDAAH,CAAqD,CAAC,OAAtD,CAA+D,eAA/D,CAAgF,CAAC,MAAjF,CAAA;eAGA,CAAA,CAAG,kDAAH,CAAuD,CAAC,EAAxD,CAA4D,oBAA5D,EAAkF,CAAA,SAAA,KAAA;iBAAA,SAAA;mBAAG,KAAI,CAAC,gCAAL,CAAA;UAAH;QAAA,CAAA,CAAA,CAAA,IAAA,CAAlF;MAN0B;;2CAY3B,gCAAA,GAAkC,SAAA;AAEjC,YAAA;QAAA,OAAA,GAAU,CAAA,CAAG,mDAAH;QACV,IAAA,GAAU,CAAA,CAAG,gDAAH;QAEV,IAAG,CAAC,CAAC,OAAO,CAAC,kBAAV,CAA8B,OAAO,CAAC,OAAR,CAAiB,eAAjB,CAA9B,CAAH;UACC,OAAO,CAAC,QAAR,CAAkB,YAAlB,EADD;SAAA,MAAA;UAGC,OAAO,CAAC,WAAR,CAAqB,YAArB,EAHD;;QAKA,IAAG,CAAC,CAAC,OAAO,CAAC,eAAV,CAA2B,IAAI,CAAC,GAAL,CAAA,CAA3B,CAAH;iBACC,IAAI,CAAC,QAAL,CAAe,YAAf,EADD;SAAA,MAAA;iBAGC,IAAI,CAAC,WAAL,CAAkB,YAAlB,EAHD;;MAViC;;2CAmBlC,kBAAA,GAAoB,SAAA;AACnB,YAAA;QAAA,MAAA,GAAS;QAET,cAAA,GAAiB,IAAC,CAAA,cAAc,CAAC,IAAhB,CAAsB,2DAAtB,CAAmF,CAAC,GAApF,CAAA;QACjB,MAAA,GAAiB,CAAC,CAAC,OAAO,CAAC,aAAV,CAAyB,IAAC,CAAA,cAAc,CAAC,IAAhB,CAAsB,mDAAtB,CAA2E,CAAC,GAA5E,CAAA,CAAzB;QACjB,GAAA,GAAiB,IAAC,CAAA,cAAc,CAAC,IAAhB,CAAsB,gDAAtB,CAAwE,CAAC,GAAzE,CAAA;QAGjB,cAAA,GAAiB,cAAc,CAAC,OAAf,CAAwB,OAAxB,EAAiC,EAAjC;QAGjB,IAAG,CAAI,cAAP;UACC,MAAM,CAAC,IAAP,CAAa,IAAC,CAAA,MAAM,CAAC,mBAArB,EADD;SAAA,MAAA;UAGC,IAAqD,cAAc,CAAC,MAAf,GAAwB,EAAxB,IAA8B,cAAc,CAAC,MAAf,GAAwB,EAA3G;YAAA,MAAM,CAAC,IAAP,CAAa,IAAC,CAAA,MAAM,CAAC,0BAArB,EAAA;;UACA,IAAqD,IAAI,CAAC,IAAL,CAAW,cAAX,CAArD;YAAA,MAAM,CAAC,IAAP,CAAa,IAAC,CAAA,MAAM,CAAC,0BAArB,EAAA;;UACA,IAAA,CAAkD,CAAC,CAAC,OAAO,CAAC,kBAAV,CAA8B,cAA9B,CAAlD;YAAA,MAAM,CAAC,IAAP,CAAa,IAAC,CAAA,MAAM,CAAC,mBAArB,EAAA;WALD;;QAQA,IAAA,CAAoD,CAAC,CAAC,OAAO,CAAC,kBAAV,CAA8B,MAA9B,CAApD;UAAA,MAAM,CAAC,IAAP,CAAa,IAAC,CAAA,MAAM,CAAC,qBAArB,EAAA;;QAGA,IAAG,WAAH;UAEC,IAAG,CAAI,GAAP;YACC,MAAM,CAAC,IAAP,CAAa,IAAC,CAAA,MAAM,CAAC,WAArB,EADD;WAAA,MAAA;YAGC,IAA6C,IAAI,CAAC,IAAL,CAAW,GAAX,CAA7C;cAAA,MAAM,CAAC,IAAP,CAAa,IAAC,CAAA,MAAM,CAAC,kBAArB,EAAA;;YACA,IAA6C,GAAG,CAAC,MAAJ,GAAa,CAAb,IAAkB,GAAG,CAAC,MAAJ,GAAa,CAA5E;cAAA,MAAM,CAAC,IAAP,CAAa,IAAC,CAAA,MAAM,CAAC,kBAArB,EAAA;aAJD;WAFD;;QAQA,IAAG,MAAM,CAAC,MAAP,GAAgB,CAAnB;UACC,IAAI,CAAC,aAAL,CAAoB,MAApB;AACA,iBAAO,MAFR;SAAA,MAAA;UAKC,IAAC,CAAA,cAAc,CAAC,IAAhB,CAAsB,2DAAtB,CAAmF,CAAC,GAApF,CAAyF,cAAzF;AACA,iBAAO,KANR;;MA9BmB;;2CA0CpB,qBAAA,GAAuB,SAAA;AACtB,YAAA;QAAA,MAAA,GAAS;QAET,cAAA,GAAiB,IAAC,CAAA,cAAc,CAAC,IAAhB,CAAqB,sDAArB,CAA4E,CAAC,GAA7E,CAAA;QACjB,cAAA,GAAiB,IAAC,CAAA,cAAc,CAAC,IAAhB,CAAqB,sDAArB,CAA4E,CAAC,GAA7E,CAAA;QAGjB,IAAG,CAAI,cAAP;UACC,MAAM,CAAC,IAAP,CAAa,IAAC,CAAA,MAAM,CAAC,sBAArB,EADD;SAAA,MAAA;UAGC,IAAwD,CAAA,KAAK,cAAc,CAAC,MAA5E;YAAA,MAAM,CAAC,IAAP,CAAa,IAAC,CAAA,MAAM,CAAC,6BAArB,EAAA;;UACA,IAAwD,IAAI,CAAC,IAAL,CAAW,cAAX,CAAxD;YAAA,MAAM,CAAC,IAAP,CAAa,IAAC,CAAA,MAAM,CAAC,6BAArB,EAAA;WAJD;;QAOA,IAAG,CAAI,cAAP;UACC,MAAM,CAAC,IAAP,CAAa,IAAC,CAAA,MAAM,CAAC,sBAArB,EADD;SAAA,MAAA;UAGC,IAAwD,cAAc,CAAC,MAAf,GAAwB,CAAxB,IAA6B,cAAc,CAAC,MAAf,GAAwB,EAA7G;YAAA,MAAM,CAAC,IAAP,CAAa,IAAC,CAAA,MAAM,CAAC,6BAArB,EAAA;;UACA,IAAiD,IAAI,CAAC,IAAL,CAAW,cAAX,CAAjD;YAAA,MAAM,CAAC,IAAP,CAAa,IAAC,CAAA,MAAM,CAAC,sBAArB,EAAA;WAJD;;QAMA,IAAG,MAAM,CAAC,MAAP,GAAgB,CAAnB;UACC,IAAI,CAAC,aAAL,CAAoB,MAApB;AACA,iBAAO,MAFR;SAAA,MAAA;UAKC,IAAC,CAAA,cAAc,CAAC,IAAhB,CAAsB,sDAAtB,CAA8E,CAAC,GAA/E,CAAoF,cAApF;AACA,iBAAO,KANR;;MApBsB;;2CAgCvB,aAAA,GAAe,SAAC,MAAD;QAGd,CAAA,CAAG,0CAAH,CAA+C,CAAC,MAAhD,CAAA;QAGA,IAAC,CAAA,IAAI,CAAC,OAAN,CAAc,oCAAA,GAAuC,MAAM,CAAC,IAAP,CAAa,WAAb,CAAvC,GAAoE,YAAlF;QAGA,IAAC,CAAA,IAAI,CAAC,WAAN,CAAmB,YAAnB,CAAiC,CAAC,OAAlC,CAAA;QACA,IAAC,CAAA,IAAI,CAAC,IAAN,CAAY,qBAAZ,CAAmC,CAAC,IAApC,CAAA;eAGA,CAAA,CAAG,YAAH,CAAiB,CAAC,OAAlB,CAA2B;UAAE,SAAA,EAAW,IAAC,CAAA,IAAI,CAAC,MAAN,CAAA,CAAc,CAAC,GAAf,GAAqB,GAAlC;SAA3B,EAAoE,IAApE;MAbc;;2CAmBf,4BAAA,GAA8B,SAAA;AAG7B,YAAA;QAAA,aAAA,GAAgB,IAAC,CAAA;QACjB,YAAA,GAAgB,IAAC,CAAA;QACjB,6BAAA,GAAgC,CAAA,CAAG,YAAA,GAAc,aAAd,GAA6B,0BAAhC;QAChC,UAAA,GAAa,6BAA6B,CAAC,IAA9B,CAAoC,gDAApC,CAAsF,CAAC,MAAvF,CAAA;QAGb,CAAA,CAAG,cAAA,GAAgB,IAAC,CAAA,aAAjB,GAAgC,gBAAnC,CAAoD,CAAC,MAArD,CAA4D,SAAA;AAC3D,cAAA;UAAA,iCAAA,GAAoC,CAAA,CAAG,cAAA,GAAgB,aAAhB,GAA+B,wBAAlC,CAA2D,CAAC,GAA5D,CAAA;UAEpC,IAAG,iCAAH;YAGC,6BAA6B,CAAC,OAA9B,CAAuC,GAAvC;YAGA,IAAG,YAAH;cACC,UAAU,CAAC,WAAX,CAAwB,eAAxB,CAAyC,CAAC,QAA1C,CAAoD,gBAApD;qBACA,6BAA6B,CAAC,KAA9B,CAAqC,UAArC,EAFD;aAND;WAAA,MAAA;YAYC,6BAA6B,CAAC,SAA9B,CAAyC,GAAzC;YAGA,IAAG,YAAH;cACC,UAAU,CAAC,WAAX,CAAwB,gBAAxB,CAA0C,CAAC,QAA3C,CAAqD,eAArD;qBACA,6BAA6B,CAAC,IAA9B,CAAoC,mDAApC,CAAyF,CAAC,MAA1F,CAAA,CAAkG,CAAC,KAAnG,CAA0G,UAA1G,EAFD;aAfD;;QAH2D,CAA5D,CAqBA,CAAC,MArBD,CAAA;eAyBA,CAAA,CAAG,qBAAH,CAA0B,CAAC,MAA3B,CAAkC,SAAA;AACjC,cAAA;UAAA,WAAA,GAAc,CAAA,CAAG,cAAA,GAAgB,aAAhB,GAA+B,0BAAlC,CAA6D,CAAC,OAA9D,CAAuE,YAAvE;UAEd,IAAG,CAAA,CAAG,IAAH,CAAS,CAAC,EAAV,CAAc,UAAd,CAAH;YACC,WAAW,CAAC,SAAZ,CAAA;mBACA,WAAW,CAAC,IAAZ,CAAA,CAAkB,CAAC,IAAnB,CAAA,EAFD;WAAA,MAAA;YAIC,WAAW,CAAC,IAAZ,CAAA;mBACA,WAAW,CAAC,IAAZ,CAAA,CAAkB,CAAC,IAAnB,CAAA,EALD;;QAHiC,CAAlC,CASA,CAAC,MATD,CAAA;MAlC6B;;2CAiD9B,wBAAA,GAA0B,SAAA;AAEzB,YAAA;QAAA,aAAA,GAAgB,IAAC,CAAA,cAAc,CAAC,IAAhB,CAAsB,oDAAtB;QAEhB,IAAG,aAAa,CAAC,EAAd,CAAkB,UAAlB,CAAH;iBAAuC,aAAa,CAAC,OAAd,CAAA,EAAvC;SAAA,MAAA;iBAAoE,aAAa,CAAC,SAAd,CAAA,EAApE;;MAJyB;;;;;EA3TH,CAAzB;AARA","file":"sv-wc-payment-gateway-frontend.min.js","sourceRoot":"","sourcesContent":[null]}
|
lib/skyverge/woocommerce/payment-gateway/assets/js/frontend/sv-wc-payment-gateway-my-payment-methods.coffee
ADDED
@@ -0,0 +1,218 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
###
|
2 |
+
WooCommerce SkyVerge Payment Gateway My Payment Methods CoffeeScript
|
3 |
+
Version 5.1.0
|
4 |
+
|
5 |
+
Copyright (c) 2014-2018, SkyVerge, Inc.
|
6 |
+
Licensed under the GNU General Public License v3.0
|
7 |
+
http://www.gnu.org/licenses/gpl-3.0.html
|
8 |
+
###
|
9 |
+
jQuery( document ).ready ($) ->
|
10 |
+
"use strict"
|
11 |
+
|
12 |
+
# The My Payment Methods handler.
|
13 |
+
#
|
14 |
+
# @since 5.1.0
|
15 |
+
class window.SV_WC_Payment_Methods_Handler
|
16 |
+
|
17 |
+
|
18 |
+
# Constructs the class.
|
19 |
+
#
|
20 |
+
# @since 5.1.0
|
21 |
+
#
|
22 |
+
# @param [Object] args, with the properties:
|
23 |
+
# id: [String] plugin ID
|
24 |
+
# slug: [String] plugin slug or dasherized ID
|
25 |
+
# i18n: [Object] localized text strings
|
26 |
+
# ajax_url: [String] URL for AJAX requests
|
27 |
+
# ajax_nonce: [String] nonce for AJAX requests
|
28 |
+
constructor: ( args ) ->
|
29 |
+
|
30 |
+
@id = args.id
|
31 |
+
@slug = args.slug
|
32 |
+
@i18n = args.i18n
|
33 |
+
@ajax_url = args.ajax_url
|
34 |
+
@ajax_nonce = args.ajax_nonce
|
35 |
+
|
36 |
+
# hide the core "No methods" message
|
37 |
+
$( ".wc-#{@slug}-my-payment-methods" ).prev( ".woocommerce-Message.woocommerce-Message--info" ).hide() unless args.has_core_tokens
|
38 |
+
|
39 |
+
# init tipTip
|
40 |
+
$( ".wc-#{@slug}-payment-method-actions .button.tip" ).tipTip()
|
41 |
+
|
42 |
+
# handle the edit action
|
43 |
+
$( ".wc-#{@slug}-my-payment-methods" ).on( 'click', ".wc-#{@slug}-payment-method-actions .edit-payment-method", ( event ) => this.edit_method( event ) )
|
44 |
+
|
45 |
+
# handle the save action
|
46 |
+
$( ".wc-#{@slug}-my-payment-methods" ).on( 'click', ".wc-#{@slug}-payment-method-actions .save-payment-method", ( event ) => this.save_method( event ) )
|
47 |
+
|
48 |
+
# handle the cancel action
|
49 |
+
$( ".wc-#{@slug}-my-payment-methods" ).on( 'click', ".wc-#{@slug}-payment-method-actions .cancel-edit-payment-method", ( event ) => this.cancel_edit( event ) )
|
50 |
+
|
51 |
+
# handle the delete action
|
52 |
+
$( ".wc-#{@slug}-my-payment-methods" ).on( 'click', ".wc-#{@slug}-payment-method-actions .delete-payment-method", ( event ) =>
|
53 |
+
|
54 |
+
if $( event.currentTarget ).hasClass( 'disabled' ) or not confirm( @i18n.delete_ays )
|
55 |
+
event.preventDefault()
|
56 |
+
|
57 |
+
)
|
58 |
+
|
59 |
+
# don't follow the Add Payment Method button URL if it's disabled
|
60 |
+
$( '.button[href*="add-payment-method"]' ).click ( event ) ->
|
61 |
+
event.preventDefault() if $( this ).hasClass( 'disabled' )
|
62 |
+
|
63 |
+
|
64 |
+
# Edits a payment method.
|
65 |
+
#
|
66 |
+
# @since 5.1.0
|
67 |
+
#
|
68 |
+
# @param [Object] event jQuery event object
|
69 |
+
edit_method: ( event ) =>
|
70 |
+
|
71 |
+
event.preventDefault()
|
72 |
+
|
73 |
+
button = $( event.currentTarget )
|
74 |
+
row = button.parents( 'tr' )
|
75 |
+
|
76 |
+
row.find( '.view' ).hide()
|
77 |
+
row.find( '.edit' ).show()
|
78 |
+
row.addClass( 'editing' )
|
79 |
+
|
80 |
+
# change the Edit button to "Cancel"
|
81 |
+
button.text( @i18n.cancel_button ).removeClass( 'edit-payment-method' ).addClass( 'cancel-edit-payment-method' ).removeClass( 'button' )
|
82 |
+
|
83 |
+
button.siblings( '.save-payment-method' ).show()
|
84 |
+
button.siblings( '.delete-payment-method' ).hide()
|
85 |
+
|
86 |
+
this.enable_editing_ui()
|
87 |
+
|
88 |
+
|
89 |
+
# Saves a payment method.
|
90 |
+
#
|
91 |
+
# @since 5.1.0
|
92 |
+
#
|
93 |
+
# @param [Object] event jQuery event object
|
94 |
+
save_method: ( event ) =>
|
95 |
+
|
96 |
+
event.preventDefault()
|
97 |
+
|
98 |
+
button = $( event.currentTarget )
|
99 |
+
row = button.parents( 'tr' )
|
100 |
+
|
101 |
+
this.block_ui()
|
102 |
+
|
103 |
+
# remove any previous errors
|
104 |
+
row.next( '.error' ).remove()
|
105 |
+
|
106 |
+
data =
|
107 |
+
action: "wc_#{@id}_save_payment_method"
|
108 |
+
nonce: @ajax_nonce
|
109 |
+
token_id: row.data( 'token-id' )
|
110 |
+
data: row.find( 'input[name]' ).serialize()
|
111 |
+
|
112 |
+
$.post( @ajax_url, data )
|
113 |
+
|
114 |
+
.done ( response ) =>
|
115 |
+
|
116 |
+
return this.display_error( row, response.data ) unless response.success
|
117 |
+
|
118 |
+
# remove other methods' "Default" badges if this was set as default
|
119 |
+
if response.data.is_default
|
120 |
+
row.siblings().find( ".wc-#{@slug}-payment-method-default .view" ).empty().siblings( '.edit' ).find( 'input' ).prop( 'checked', false )
|
121 |
+
|
122 |
+
if response.data.html?
|
123 |
+
row.replaceWith( response.data.html )
|
124 |
+
|
125 |
+
if response.data.nonce?
|
126 |
+
@ajax_nonce = response.data.nonce
|
127 |
+
|
128 |
+
this.disable_editing_ui()
|
129 |
+
|
130 |
+
.fail ( jqXHR, textStatus, error ) =>
|
131 |
+
|
132 |
+
this.display_error( row, error )
|
133 |
+
|
134 |
+
.always =>
|
135 |
+
|
136 |
+
this.unblock_ui()
|
137 |
+
|
138 |
+
|
139 |
+
# Cancels editing a payment method.
|
140 |
+
#
|
141 |
+
# @since 5.1.0
|
142 |
+
#
|
143 |
+
# @param [Object] event jQuery event object
|
144 |
+
cancel_edit: ( event ) =>
|
145 |
+
|
146 |
+
event.preventDefault()
|
147 |
+
|
148 |
+
button = $( event.currentTarget )
|
149 |
+
row = button.parents( 'tr' )
|
150 |
+
|
151 |
+
row.find( '.view' ).show()
|
152 |
+
row.find( '.edit' ).hide()
|
153 |
+
row.removeClass( 'editing' )
|
154 |
+
|
155 |
+
# change the "Cancel" button back to "Edit"
|
156 |
+
button.removeClass( 'cancel-edit-payment-method' ).addClass( 'edit-payment-method' ).text( @i18n.edit_button ).addClass( 'button' )
|
157 |
+
|
158 |
+
button.siblings( '.save-payment-method' ).hide()
|
159 |
+
button.siblings( '.delete-payment-method' ).show()
|
160 |
+
|
161 |
+
this.disable_editing_ui()
|
162 |
+
|
163 |
+
|
164 |
+
# Sets the page UI to the "editing" state.
|
165 |
+
#
|
166 |
+
# This brings proper focus to the method being edited and prevents
|
167 |
+
# other available buttons/actions until the editing is finished or cancelled.
|
168 |
+
#
|
169 |
+
# @since 5.1.1
|
170 |
+
enable_editing_ui: ->
|
171 |
+
|
172 |
+
# set the methods table as 'editing'
|
173 |
+
$( ".wc-#{@slug}-my-payment-methods" ).addClass( 'editing' )
|
174 |
+
|
175 |
+
# disable the Add Payment Method button
|
176 |
+
$( '.button[href*="add-payment-method"]' ).addClass( 'disabled' )
|
177 |
+
|
178 |
+
|
179 |
+
# Sets the page UI back to the default state.
|
180 |
+
#
|
181 |
+
# @since 5.1.1
|
182 |
+
disable_editing_ui: ->
|
183 |
+
|
184 |
+
# removes the methods table's "editing" status
|
185 |
+
$( ".wc-#{@slug}-my-payment-methods" ).removeClass( 'editing' )
|
186 |
+
|
187 |
+
# re-enable the Add Payment Method button
|
188 |
+
$( '.button[href*="add-payment-method"]' ).removeClass( 'disabled' )
|
189 |
+
|
190 |
+
|
191 |
+
# Blocks the payment methods table UI.
|
192 |
+
#
|
193 |
+
# @since 5.1.0
|
194 |
+
block_ui: -> $( ".wc-#{@slug}-my-payment-methods" ).parent( 'div' ).block( message: null, overlayCSS: background: '#fff', opacity: 0.6 )
|
195 |
+
|
196 |
+
|
197 |
+
# Unblocks the payment methods table UI.
|
198 |
+
#
|
199 |
+
# @since 5.1.0
|
200 |
+
unblock_ui: -> $( ".wc-#{@slug}-my-payment-methods" ).parent( 'div' ).unblock()
|
201 |
+
|
202 |
+
|
203 |
+
# Displays an error message to the user.
|
204 |
+
#
|
205 |
+
# @since 5.1.0
|
206 |
+
#
|
207 |
+
# @param [Object] row payment method table row
|
208 |
+
# @param [String] error raw error message
|
209 |
+
# @param [String] message user error message
|
210 |
+
display_error: ( row, error, message = '' ) ->
|
211 |
+
|
212 |
+
console.error( error )
|
213 |
+
|
214 |
+
message = @i18n.save_error unless message
|
215 |
+
|
216 |
+
columns = $( ".wc-#{@slug}-my-payment-methods thead tr th" ).size()
|
217 |
+
|
218 |
+
$( '<tr class="error"><td colspan="' + columns + '">' + message + '</td></tr>' ).insertAfter( row ).find( 'td' ).delay( 8000 ).slideUp( 200 )
|
lib/skyverge/woocommerce/payment-gateway/assets/js/frontend/sv-wc-payment-gateway-my-payment-methods.min.js
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
/* WooCommerce SkyVerge Payment Gateway My Payment Methods CoffeeScript Version 5.1.0 Copyright (c) 2014-2018, SkyVerge, Inc. Licensed under the GNU General Public License v3.0 http://www.gnu.org/licenses/gpl-3.0.html */(function() { var bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }; jQuery(document).ready(function($) { "use strict"; return window.SV_WC_Payment_Methods_Handler = (function() { function SV_WC_Payment_Methods_Handler(args) { this.cancel_edit = bind(this.cancel_edit, this); this.save_method = bind(this.save_method, this); this.edit_method = bind(this.edit_method, this); this.id = args.id; this.slug = args.slug; this.i18n = args.i18n; this.ajax_url = args.ajax_url; this.ajax_nonce = args.ajax_nonce; if (!args.has_core_tokens) { $(".wc-" + this.slug + "-my-payment-methods").prev(".woocommerce-Message.woocommerce-Message--info").hide(); } $(".wc-" + this.slug + "-payment-method-actions .button.tip").tipTip(); $(".wc-" + this.slug + "-my-payment-methods").on('click', ".wc-" + this.slug + "-payment-method-actions .edit-payment-method", (function(_this) { return function(event) { return _this.edit_method(event); }; })(this)); $(".wc-" + this.slug + "-my-payment-methods").on('click', ".wc-" + this.slug + "-payment-method-actions .save-payment-method", (function(_this) { return function(event) { return _this.save_method(event); }; })(this)); $(".wc-" + this.slug + "-my-payment-methods").on('click', ".wc-" + this.slug + "-payment-method-actions .cancel-edit-payment-method", (function(_this) { return function(event) { return _this.cancel_edit(event); }; })(this)); $(".wc-" + this.slug + "-my-payment-methods").on('click', ".wc-" + this.slug + "-payment-method-actions .delete-payment-method", (function(_this) { return function(event) { if ($(event.currentTarget).hasClass('disabled') || !confirm(_this.i18n.delete_ays)) { return event.preventDefault(); } }; })(this)); $('.button[href*="add-payment-method"]').click(function(event) { if ($(this).hasClass('disabled')) { return event.preventDefault(); } }); } SV_WC_Payment_Methods_Handler.prototype.edit_method = function(event) { var button, row; event.preventDefault(); button = $(event.currentTarget); row = button.parents('tr'); row.find('.view').hide(); row.find('.edit').show(); row.addClass('editing'); button.text(this.i18n.cancel_button).removeClass('edit-payment-method').addClass('cancel-edit-payment-method').removeClass('button'); button.siblings('.save-payment-method').show(); button.siblings('.delete-payment-method').hide(); return this.enable_editing_ui(); }; SV_WC_Payment_Methods_Handler.prototype.save_method = function(event) { var button, data, row; event.preventDefault(); button = $(event.currentTarget); row = button.parents('tr'); this.block_ui(); row.next('.error').remove(); data = { action: "wc_" + this.id + "_save_payment_method", nonce: this.ajax_nonce, token_id: row.data('token-id'), data: row.find('input[name]').serialize() }; return $.post(this.ajax_url, data).done((function(_this) { return function(response) { if (!response.success) { return _this.display_error(row, response.data); } if (response.data.is_default) { row.siblings().find(".wc-" + _this.slug + "-payment-method-default .view").empty().siblings('.edit').find('input').prop('checked', false); } if (response.data.html != null) { row.replaceWith(response.data.html); } if (response.data.nonce != null) { _this.ajax_nonce = response.data.nonce; } return _this.disable_editing_ui(); }; })(this)).fail((function(_this) { return function(jqXHR, textStatus, error) { return _this.display_error(row, error); }; })(this)).always((function(_this) { return function() { return _this.unblock_ui(); }; })(this)); }; SV_WC_Payment_Methods_Handler.prototype.cancel_edit = function(event) { var button, row; event.preventDefault(); button = $(event.currentTarget); row = button.parents('tr'); row.find('.view').show(); row.find('.edit').hide(); row.removeClass('editing'); button.removeClass('cancel-edit-payment-method').addClass('edit-payment-method').text(this.i18n.edit_button).addClass('button'); button.siblings('.save-payment-method').hide(); button.siblings('.delete-payment-method').show(); return this.disable_editing_ui(); }; SV_WC_Payment_Methods_Handler.prototype.enable_editing_ui = function() { $(".wc-" + this.slug + "-my-payment-methods").addClass('editing'); return $('.button[href*="add-payment-method"]').addClass('disabled'); }; SV_WC_Payment_Methods_Handler.prototype.disable_editing_ui = function() { $(".wc-" + this.slug + "-my-payment-methods").removeClass('editing'); return $('.button[href*="add-payment-method"]').removeClass('disabled'); }; SV_WC_Payment_Methods_Handler.prototype.block_ui = function() { return $(".wc-" + this.slug + "-my-payment-methods").parent('div').block({ message: null, overlayCSS: { background: '#fff', opacity: 0.6 } }); }; SV_WC_Payment_Methods_Handler.prototype.unblock_ui = function() { return $(".wc-" + this.slug + "-my-payment-methods").parent('div').unblock(); }; SV_WC_Payment_Methods_Handler.prototype.display_error = function(row, error, message) { var columns; if (message == null) { message = ''; } console.error(error); if (!message) { message = this.i18n.save_error; } columns = $(".wc-" + this.slug + "-my-payment-methods thead tr th").size(); return $('<tr class="error"><td colspan="' + columns + '">' + message + '</td></tr>').insertAfter(row).find('td').delay(8000).slideUp(200); }; return SV_WC_Payment_Methods_Handler; })(); });}).call(this);
|
lib/skyverge/woocommerce/payment-gateway/assets/js/frontend/sv-wc-payment-gateway-payment-form.coffee
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
WooCommerce SkyVerge Payment Gateway Framework Payment Form CoffeeScript
|
3 |
Version 4.3.0-beta
|
4 |
|
5 |
-
Copyright (c) 2014-
|
6 |
Licensed under the GNU General Public License v3.0
|
7 |
http://www.gnu.org/licenses/gpl-3.0.html
|
8 |
###
|
@@ -25,12 +25,13 @@ jQuery( document ).ready ($) ->
|
|
25 |
# Returns SV_WC_Payment_Form_Handler instance
|
26 |
constructor: (args) ->
|
27 |
|
28 |
-
@id
|
29 |
-
@id_dasherized
|
30 |
-
@plugin_id
|
31 |
-
@type
|
32 |
-
@csc_required
|
33 |
-
@
|
|
|
34 |
|
35 |
# which payment form?
|
36 |
if $( 'form.checkout' ).length
|
@@ -200,7 +201,8 @@ jQuery( document ).ready ($) ->
|
|
200 |
errors.push( @params.cvv_digits_invalid ) if /\D/.test( csc )
|
201 |
errors.push( @params.cvv_length_invalid ) if csc.length < 3 || csc.length > 4
|
202 |
else if @csc_required
|
203 |
-
|
|
|
204 |
|
205 |
# Only validate the other CC fields if necessary
|
206 |
if not @saved_payment_method_selected
|
@@ -292,12 +294,16 @@ jQuery( document ).ready ($) ->
|
|
292 |
|
293 |
# make available inside change events
|
294 |
id_dasherized = @id_dasherized
|
295 |
-
|
|
|
|
|
|
|
296 |
$new_payment_method_selection = $( "div.js-wc-#{ id_dasherized }-new-payment-method-form" )
|
297 |
-
$csc_field = $new_payment_method_selection.find( '.js-sv-wc-payment-gateway-credit-card-form-csc' ).
|
298 |
|
299 |
# show/hide the saved payment methods when a saved payment method is de-selected/selected
|
300 |
$( "input.js-wc-#{ @id_dasherized }-payment-token" ).change ->
|
|
|
301 |
tokenized_payment_method_selected = $( "input.js-wc-#{ id_dasherized }-payment-token:checked" ).val()
|
302 |
|
303 |
if tokenized_payment_method_selected
|
@@ -306,7 +312,7 @@ jQuery( document ).ready ($) ->
|
|
306 |
$new_payment_method_selection.slideUp( 200 )
|
307 |
|
308 |
# move the CSC field out of the 'new method' fields so it can be used with the tokenized transaction
|
309 |
-
if
|
310 |
$csc_field.removeClass( 'form-row-last' ).addClass( 'form-row-first' )
|
311 |
$new_payment_method_selection.after( $csc_field )
|
312 |
|
@@ -315,9 +321,9 @@ jQuery( document ).ready ($) ->
|
|
315 |
$new_payment_method_selection.slideDown( 200 )
|
316 |
|
317 |
# move the CSC field back into its regular spot
|
318 |
-
if
|
319 |
$csc_field.removeClass( 'form-row-first' ).addClass( 'form-row-last' )
|
320 |
-
$new_payment_method_selection.find( '.js-sv-wc-payment-gateway-credit-card-form-expiry' ).
|
321 |
.change()
|
322 |
|
323 |
# display the 'save payment method' option for guest checkouts if the 'create account' option is checked
|
@@ -331,7 +337,8 @@ jQuery( document ).ready ($) ->
|
|
331 |
else
|
332 |
$parent_row.hide()
|
333 |
$parent_row.next().hide()
|
334 |
-
|
|
|
335 |
|
336 |
|
337 |
# Public: Handle showing/hiding the sample check image
|
2 |
WooCommerce SkyVerge Payment Gateway Framework Payment Form CoffeeScript
|
3 |
Version 4.3.0-beta
|
4 |
|
5 |
+
Copyright (c) 2014-2018, SkyVerge, Inc.
|
6 |
Licensed under the GNU General Public License v3.0
|
7 |
http://www.gnu.org/licenses/gpl-3.0.html
|
8 |
###
|
25 |
# Returns SV_WC_Payment_Form_Handler instance
|
26 |
constructor: (args) ->
|
27 |
|
28 |
+
@id = args.id
|
29 |
+
@id_dasherized = args.id_dasherized
|
30 |
+
@plugin_id = args.plugin_id
|
31 |
+
@type = args.type
|
32 |
+
@csc_required = args.csc_required
|
33 |
+
@csc_required_for_tokens = args.csc_required_for_tokens
|
34 |
+
@enabled_card_types = args.enabled_card_types
|
35 |
|
36 |
# which payment form?
|
37 |
if $( 'form.checkout' ).length
|
201 |
errors.push( @params.cvv_digits_invalid ) if /\D/.test( csc )
|
202 |
errors.push( @params.cvv_length_invalid ) if csc.length < 3 || csc.length > 4
|
203 |
else if @csc_required
|
204 |
+
if not @saved_payment_method_selected or @csc_required_for_tokens
|
205 |
+
errors.push( @params.cvv_missing )
|
206 |
|
207 |
# Only validate the other CC fields if necessary
|
208 |
if not @saved_payment_method_selected
|
294 |
|
295 |
# make available inside change events
|
296 |
id_dasherized = @id_dasherized
|
297 |
+
|
298 |
+
csc_required = @csc_required
|
299 |
+
csc_required_for_tokens = @csc_required_for_tokens
|
300 |
+
|
301 |
$new_payment_method_selection = $( "div.js-wc-#{ id_dasherized }-new-payment-method-form" )
|
302 |
+
$csc_field = $new_payment_method_selection.find( '.js-sv-wc-payment-gateway-credit-card-form-csc' ).closest( '.form-row' )
|
303 |
|
304 |
# show/hide the saved payment methods when a saved payment method is de-selected/selected
|
305 |
$( "input.js-wc-#{ @id_dasherized }-payment-token" ).change ->
|
306 |
+
|
307 |
tokenized_payment_method_selected = $( "input.js-wc-#{ id_dasherized }-payment-token:checked" ).val()
|
308 |
|
309 |
if tokenized_payment_method_selected
|
312 |
$new_payment_method_selection.slideUp( 200 )
|
313 |
|
314 |
# move the CSC field out of the 'new method' fields so it can be used with the tokenized transaction
|
315 |
+
if csc_required_for_tokens
|
316 |
$csc_field.removeClass( 'form-row-last' ).addClass( 'form-row-first' )
|
317 |
$new_payment_method_selection.after( $csc_field )
|
318 |
|
321 |
$new_payment_method_selection.slideDown( 200 )
|
322 |
|
323 |
# move the CSC field back into its regular spot
|
324 |
+
if csc_required_for_tokens
|
325 |
$csc_field.removeClass( 'form-row-first' ).addClass( 'form-row-last' )
|
326 |
+
$new_payment_method_selection.find( '.js-sv-wc-payment-gateway-credit-card-form-expiry' ).closest( '.form-row' ).after( $csc_field )
|
327 |
.change()
|
328 |
|
329 |
# display the 'save payment method' option for guest checkouts if the 'create account' option is checked
|
337 |
else
|
338 |
$parent_row.hide()
|
339 |
$parent_row.next().hide()
|
340 |
+
|
341 |
+
$( 'input#createaccount' ).change() unless $( 'input#createaccount' ).is( ':checked' )
|
342 |
|
343 |
|
344 |
# Public: Handle showing/hiding the sample check image
|
lib/skyverge/woocommerce/payment-gateway/assets/js/frontend/sv-wc-payment-gateway-payment-form.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
/* WooCommerce SkyVerge Payment Gateway Framework Payment Form CoffeeScript Version 4.3.0-beta Copyright (c) 2014-2016, SkyVerge, Inc. Licensed under the GNU General Public License v3.0 http://www.gnu.org/licenses/gpl-3.0.html */(function() { var indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; }; jQuery(document).ready(function($) { "use strict"; return window.SV_WC_Payment_Form_Handler = (function() { function SV_WC_Payment_Form_Handler(args) { this.id = args.id; this.id_dasherized = args.id_dasherized; this.plugin_id = args.plugin_id; this.type = args.type; this.csc_required = args.csc_required; this.enabled_card_types = args.enabled_card_types; if ($('form.checkout').length) { this.form = $('form.checkout'); this.handle_checkout_page(); } else if ($('form#order_review').length) { this.form = $('form#order_review'); this.handle_pay_page(); } else if ($('form#add_payment_method').length) { this.form = $('form#add_payment_method'); this.handle_add_payment_method_page(); } else { console.log('No payment form found!'); return; } this.params = window["sv_wc_payment_gateway_payment_form_params"]; if (this.type === 'echeck') { this.form.on('click', '.js-sv-wc-payment-gateway-echeck-form-check-hint, .js-sv-wc-payment-gateway-echeck-form-sample-check', (function(_this) { return function() { return _this.handle_sample_check_hint(); }; })(this)); } $(document).trigger('sv_wc_payment_form_handler_init', { id: this.id, instance: this }); } SV_WC_Payment_Form_Handler.prototype.handle_checkout_page = function() { if (this.type === 'credit-card') { $(document.body).on('updated_checkout', (function(_this) { return function() { return _this.format_credit_card_inputs(); }; })(this)); } $(document.body).on('updated_checkout', (function(_this) { return function() { return _this.set_payment_fields(); }; })(this)); $(document.body).on('updated_checkout', (function(_this) { return function() { return _this.handle_saved_payment_methods(); }; })(this)); return this.form.on("checkout_place_order_" + this.id, (function(_this) { return function() { return _this.validate_payment_data(); }; })(this)); }; SV_WC_Payment_Form_Handler.prototype.handle_pay_page = function() { this.set_payment_fields(); if (this.type === 'credit-card') { this.format_credit_card_inputs(); } this.handle_saved_payment_methods(); return this.form.submit((function(_this) { return function() { if ($('#order_review input[name=payment_method]:checked').val() === _this.id) { return _this.validate_payment_data(); } }; })(this)); }; SV_WC_Payment_Form_Handler.prototype.handle_add_payment_method_page = function() { this.set_payment_fields(); if (this.type === 'credit-card') { this.format_credit_card_inputs(); } return this.form.submit((function(_this) { return function() { if ($('#add_payment_method input[name=payment_method]:checked').val() === _this.id) { return _this.validate_payment_data(); } }; })(this)); }; SV_WC_Payment_Form_Handler.prototype.set_payment_fields = function() { return this.payment_fields = $(".payment_method_" + this.id); }; SV_WC_Payment_Form_Handler.prototype.validate_payment_data = function() { var handler, valid; if (this.form.is('.processing')) { return false; } this.saved_payment_method_selected = this.payment_fields.find('.js-sv-wc-payment-gateway-payment-token:checked').val(); valid = this.type === 'credit-card' ? this.validate_card_data() : this.validate_account_data(); handler = $(document.body).triggerHandler('sv_wc_payment_form_valid_payment_data', { payment_form: this, passed_validation: valid }) !== false; return valid && handler; }; SV_WC_Payment_Form_Handler.prototype.format_credit_card_inputs = function() { $('.js-sv-wc-payment-gateway-credit-card-form-account-number').payment('formatCardNumber').change(); $('.js-sv-wc-payment-gateway-credit-card-form-expiry').payment('formatCardExpiry').change(); $('.js-sv-wc-payment-gateway-credit-card-form-csc').payment('formatCardCVC').change(); return $('.js-sv-wc-payment-gateway-credit-card-form-input').on('change paste keyup', (function(_this) { return function() { return _this.do_inline_credit_card_validation(); }; })(this)); }; SV_WC_Payment_Form_Handler.prototype.do_inline_credit_card_validation = function() { var $card_number, $card_type, $csc, $expiry; $card_number = $('.js-sv-wc-payment-gateway-credit-card-form-account-number'); $expiry = $('.js-sv-wc-payment-gateway-credit-card-form-expiry'); $csc = $('.js-sv-wc-payment-gateway-credit-card-form-csc'); $card_type = $.payment.cardType($card_number.val()); if (indexOf.call(this.enabled_card_types, $card_type) < 0) { $card_number.addClass('invalid-card-type'); } else { $card_number.removeClass('invalid-card-type'); } if ($.payment.validateCardExpiry($expiry.payment('cardExpiryVal'))) { $expiry.addClass('identified'); } else { $expiry.removeClass('identified'); } if ($.payment.validateCardCVC($csc.val())) { return $csc.addClass('identified'); } else { return $csc.removeClass('identified'); } }; SV_WC_Payment_Form_Handler.prototype.validate_card_data = function() { var account_number, csc, errors, expiry; errors = []; csc = this.payment_fields.find('.js-sv-wc-payment-gateway-credit-card-form-csc').val(); if (csc != null) { if (csc) { if (/\D/.test(csc)) { errors.push(this.params.cvv_digits_invalid); } if (csc.length < 3 || csc.length > 4) { errors.push(this.params.cvv_length_invalid); } } else if (this.csc_required) { errors.push(this.params.cvv_missing); } } if (!this.saved_payment_method_selected) { account_number = this.payment_fields.find('.js-sv-wc-payment-gateway-credit-card-form-account-number').val(); expiry = $.payment.cardExpiryVal(this.payment_fields.find('.js-sv-wc-payment-gateway-credit-card-form-expiry').val()); account_number = account_number.replace(/-|\s/g, ''); if (!account_number) { errors.push(this.params.card_number_missing); } else { if (account_number.length < 12 || account_number.length > 19) { errors.push(this.params.card_number_length_invalid); } if (/\D/.test(account_number)) { errors.push(this.params.card_number_digits_invalid); } if (!$.payment.validateCardNumber(account_number)) { errors.push(this.params.card_number_invalid); } } if (!$.payment.validateCardExpiry(expiry)) { errors.push(this.params.card_exp_date_invalid); } } if (errors.length > 0) { this.render_errors(errors); return false; } else { this.payment_fields.find('.js-sv-wc-payment-gateway-credit-card-form-account-number').val(account_number); return true; } }; SV_WC_Payment_Form_Handler.prototype.validate_account_data = function() { var account_number, errors, routing_number; if (this.saved_payment_method_selected) { return true; } errors = []; routing_number = this.payment_fields.find('.js-sv-wc-payment-gateway-echeck-form-routing-number').val(); account_number = this.payment_fields.find('.js-sv-wc-payment-gateway-echeck-form-account-number').val(); if (!routing_number) { errors.push(this.params.routing_number_missing); } else { if (9 !== routing_number.length) { errors.push(this.params.routing_number_length_invalid); } if (/\D/.test(routing_number)) { errors.push(this.params.routing_number_digits_invalid); } } if (!account_number) { errors.push(this.params.account_number_missing); } else { if (account_number.length < 3 || account_number.length > 17) { errors.push(this.params.account_number_length_invalid); } if (/\D/.test(account_number)) { errors.push(this.params.account_number_invalid); } } if (errors.length > 0) { this.render_errors(errors); return false; } else { this.payment_fields.find('.js-sv-wc-payment-gateway-echeck-form-account-number').val(account_number); return true; } }; SV_WC_Payment_Form_Handler.prototype.render_errors = function(errors) { $('.woocommerce-error, .woocommerce-message').remove(); this.form.prepend('<ul class="woocommerce-error"><li>' + errors.join('</li><li>') + '</li></ul>'); this.form.removeClass('processing').unblock(); this.form.find('.input-text, select').blur(); return $('html, body').animate({ scrollTop: this.form.offset().top - 100 }, 1000); }; SV_WC_Payment_Form_Handler.prototype.handle_saved_payment_methods = function() { var $csc_field, $new_payment_method_selection, csc_required, id_dasherized; id_dasherized = this.id_dasherized; csc_required = this.csc_required; $new_payment_method_selection = $("div.js-wc-" + id_dasherized + "-new-payment-method-form"); $csc_field = $new_payment_method_selection.find('.js-sv-wc-payment-gateway-credit-card-form-csc').parent(); $("input.js-wc-" + this.id_dasherized + "-payment-token").change(function() { var tokenized_payment_method_selected; tokenized_payment_method_selected = $("input.js-wc-" + id_dasherized + "-payment-token:checked").val(); if (tokenized_payment_method_selected) { $new_payment_method_selection.slideUp(200); if (csc_required) { $csc_field.removeClass('form-row-last').addClass('form-row-first'); return $new_payment_method_selection.after($csc_field); } } else { $new_payment_method_selection.slideDown(200); if (csc_required) { $csc_field.removeClass('form-row-first').addClass('form-row-last'); return $new_payment_method_selection.find('.js-sv-wc-payment-gateway-credit-card-form-expiry').parent().after($csc_field); } } }).change(); return $('input#createaccount').change(function() { var $parent_row; $parent_row = $("input.js-wc-" + id_dasherized + "-tokenize-payment-method").closest('p.form-row'); if ($(this).is(':checked')) { $parent_row.slideDown(); return $parent_row.next().show(); } else { $parent_row.hide(); return $parent_row.next().hide(); } }).change(); }; SV_WC_Payment_Form_Handler.prototype.handle_sample_check_hint = function() { var $sample_check; $sample_check = this.payment_fields.find('.js-sv-wc-payment-gateway-echeck-form-sample-check'); if ($sample_check.is(":visible")) { return $sample_check.slideUp(); } else { return $sample_check.slideDown(); } }; SV_WC_Payment_Form_Handler.prototype.block_ui = function() { return this.form.block({ message: null, overlayCSS: { background: '#fff', opacity: 0.6 } }); }; SV_WC_Payment_Form_Handler.prototype.unblock_ui = function() { return this.form.unblock(); }; return SV_WC_Payment_Form_Handler; })(); });}).call(this);
|
1 |
+
/* WooCommerce SkyVerge Payment Gateway Framework Payment Form CoffeeScript Version 4.3.0-beta Copyright (c) 2014-2018, SkyVerge, Inc. Licensed under the GNU General Public License v3.0 http://www.gnu.org/licenses/gpl-3.0.html */(function() { var indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; }; jQuery(document).ready(function($) { "use strict"; return window.SV_WC_Payment_Form_Handler = (function() { function SV_WC_Payment_Form_Handler(args) { this.id = args.id; this.id_dasherized = args.id_dasherized; this.plugin_id = args.plugin_id; this.type = args.type; this.csc_required = args.csc_required; this.csc_required_for_tokens = args.csc_required_for_tokens; this.enabled_card_types = args.enabled_card_types; if ($('form.checkout').length) { this.form = $('form.checkout'); this.handle_checkout_page(); } else if ($('form#order_review').length) { this.form = $('form#order_review'); this.handle_pay_page(); } else if ($('form#add_payment_method').length) { this.form = $('form#add_payment_method'); this.handle_add_payment_method_page(); } else { console.log('No payment form found!'); return; } this.params = window["sv_wc_payment_gateway_payment_form_params"]; if (this.type === 'echeck') { this.form.on('click', '.js-sv-wc-payment-gateway-echeck-form-check-hint, .js-sv-wc-payment-gateway-echeck-form-sample-check', (function(_this) { return function() { return _this.handle_sample_check_hint(); }; })(this)); } $(document).trigger('sv_wc_payment_form_handler_init', { id: this.id, instance: this }); } SV_WC_Payment_Form_Handler.prototype.handle_checkout_page = function() { if (this.type === 'credit-card') { $(document.body).on('updated_checkout', (function(_this) { return function() { return _this.format_credit_card_inputs(); }; })(this)); } $(document.body).on('updated_checkout', (function(_this) { return function() { return _this.set_payment_fields(); }; })(this)); $(document.body).on('updated_checkout', (function(_this) { return function() { return _this.handle_saved_payment_methods(); }; })(this)); return this.form.on("checkout_place_order_" + this.id, (function(_this) { return function() { return _this.validate_payment_data(); }; })(this)); }; SV_WC_Payment_Form_Handler.prototype.handle_pay_page = function() { this.set_payment_fields(); if (this.type === 'credit-card') { this.format_credit_card_inputs(); } this.handle_saved_payment_methods(); return this.form.submit((function(_this) { return function() { if ($('#order_review input[name=payment_method]:checked').val() === _this.id) { return _this.validate_payment_data(); } }; })(this)); }; SV_WC_Payment_Form_Handler.prototype.handle_add_payment_method_page = function() { this.set_payment_fields(); if (this.type === 'credit-card') { this.format_credit_card_inputs(); } return this.form.submit((function(_this) { return function() { if ($('#add_payment_method input[name=payment_method]:checked').val() === _this.id) { return _this.validate_payment_data(); } }; })(this)); }; SV_WC_Payment_Form_Handler.prototype.set_payment_fields = function() { return this.payment_fields = $(".payment_method_" + this.id); }; SV_WC_Payment_Form_Handler.prototype.validate_payment_data = function() { var handler, valid; if (this.form.is('.processing')) { return false; } this.saved_payment_method_selected = this.payment_fields.find('.js-sv-wc-payment-gateway-payment-token:checked').val(); valid = this.type === 'credit-card' ? this.validate_card_data() : this.validate_account_data(); handler = $(document.body).triggerHandler('sv_wc_payment_form_valid_payment_data', { payment_form: this, passed_validation: valid }) !== false; return valid && handler; }; SV_WC_Payment_Form_Handler.prototype.format_credit_card_inputs = function() { $('.js-sv-wc-payment-gateway-credit-card-form-account-number').payment('formatCardNumber').change(); $('.js-sv-wc-payment-gateway-credit-card-form-expiry').payment('formatCardExpiry').change(); $('.js-sv-wc-payment-gateway-credit-card-form-csc').payment('formatCardCVC').change(); return $('.js-sv-wc-payment-gateway-credit-card-form-input').on('change paste keyup', (function(_this) { return function() { return _this.do_inline_credit_card_validation(); }; })(this)); }; SV_WC_Payment_Form_Handler.prototype.do_inline_credit_card_validation = function() { var $card_number, $card_type, $csc, $expiry; $card_number = $('.js-sv-wc-payment-gateway-credit-card-form-account-number'); $expiry = $('.js-sv-wc-payment-gateway-credit-card-form-expiry'); $csc = $('.js-sv-wc-payment-gateway-credit-card-form-csc'); $card_type = $.payment.cardType($card_number.val()); if (indexOf.call(this.enabled_card_types, $card_type) < 0) { $card_number.addClass('invalid-card-type'); } else { $card_number.removeClass('invalid-card-type'); } if ($.payment.validateCardExpiry($expiry.payment('cardExpiryVal'))) { $expiry.addClass('identified'); } else { $expiry.removeClass('identified'); } if ($.payment.validateCardCVC($csc.val())) { return $csc.addClass('identified'); } else { return $csc.removeClass('identified'); } }; SV_WC_Payment_Form_Handler.prototype.validate_card_data = function() { var account_number, csc, errors, expiry; errors = []; csc = this.payment_fields.find('.js-sv-wc-payment-gateway-credit-card-form-csc').val(); if (csc != null) { if (csc) { if (/\D/.test(csc)) { errors.push(this.params.cvv_digits_invalid); } if (csc.length < 3 || csc.length > 4) { errors.push(this.params.cvv_length_invalid); } } else if (this.csc_required) { if (!this.saved_payment_method_selected || this.csc_required_for_tokens) { errors.push(this.params.cvv_missing); } } } if (!this.saved_payment_method_selected) { account_number = this.payment_fields.find('.js-sv-wc-payment-gateway-credit-card-form-account-number').val(); expiry = $.payment.cardExpiryVal(this.payment_fields.find('.js-sv-wc-payment-gateway-credit-card-form-expiry').val()); account_number = account_number.replace(/-|\s/g, ''); if (!account_number) { errors.push(this.params.card_number_missing); } else { if (account_number.length < 12 || account_number.length > 19) { errors.push(this.params.card_number_length_invalid); } if (/\D/.test(account_number)) { errors.push(this.params.card_number_digits_invalid); } if (!$.payment.validateCardNumber(account_number)) { errors.push(this.params.card_number_invalid); } } if (!$.payment.validateCardExpiry(expiry)) { errors.push(this.params.card_exp_date_invalid); } } if (errors.length > 0) { this.render_errors(errors); return false; } else { this.payment_fields.find('.js-sv-wc-payment-gateway-credit-card-form-account-number').val(account_number); return true; } }; SV_WC_Payment_Form_Handler.prototype.validate_account_data = function() { var account_number, errors, routing_number; if (this.saved_payment_method_selected) { return true; } errors = []; routing_number = this.payment_fields.find('.js-sv-wc-payment-gateway-echeck-form-routing-number').val(); account_number = this.payment_fields.find('.js-sv-wc-payment-gateway-echeck-form-account-number').val(); if (!routing_number) { errors.push(this.params.routing_number_missing); } else { if (9 !== routing_number.length) { errors.push(this.params.routing_number_length_invalid); } if (/\D/.test(routing_number)) { errors.push(this.params.routing_number_digits_invalid); } } if (!account_number) { errors.push(this.params.account_number_missing); } else { if (account_number.length < 3 || account_number.length > 17) { errors.push(this.params.account_number_length_invalid); } if (/\D/.test(account_number)) { errors.push(this.params.account_number_invalid); } } if (errors.length > 0) { this.render_errors(errors); return false; } else { this.payment_fields.find('.js-sv-wc-payment-gateway-echeck-form-account-number').val(account_number); return true; } }; SV_WC_Payment_Form_Handler.prototype.render_errors = function(errors) { $('.woocommerce-error, .woocommerce-message').remove(); this.form.prepend('<ul class="woocommerce-error"><li>' + errors.join('</li><li>') + '</li></ul>'); this.form.removeClass('processing').unblock(); this.form.find('.input-text, select').blur(); return $('html, body').animate({ scrollTop: this.form.offset().top - 100 }, 1000); }; SV_WC_Payment_Form_Handler.prototype.handle_saved_payment_methods = function() { var $csc_field, $new_payment_method_selection, csc_required, csc_required_for_tokens, id_dasherized; id_dasherized = this.id_dasherized; csc_required = this.csc_required; csc_required_for_tokens = this.csc_required_for_tokens; $new_payment_method_selection = $("div.js-wc-" + id_dasherized + "-new-payment-method-form"); $csc_field = $new_payment_method_selection.find('.js-sv-wc-payment-gateway-credit-card-form-csc').closest('.form-row'); $("input.js-wc-" + this.id_dasherized + "-payment-token").change(function() { var tokenized_payment_method_selected; tokenized_payment_method_selected = $("input.js-wc-" + id_dasherized + "-payment-token:checked").val(); if (tokenized_payment_method_selected) { $new_payment_method_selection.slideUp(200); if (csc_required_for_tokens) { $csc_field.removeClass('form-row-last').addClass('form-row-first'); return $new_payment_method_selection.after($csc_field); } } else { $new_payment_method_selection.slideDown(200); if (csc_required_for_tokens) { $csc_field.removeClass('form-row-first').addClass('form-row-last'); return $new_payment_method_selection.find('.js-sv-wc-payment-gateway-credit-card-form-expiry').closest('.form-row').after($csc_field); } } }).change(); $('input#createaccount').change(function() { var $parent_row; $parent_row = $("input.js-wc-" + id_dasherized + "-tokenize-payment-method").closest('p.form-row'); if ($(this).is(':checked')) { $parent_row.slideDown(); return $parent_row.next().show(); } else { $parent_row.hide(); return $parent_row.next().hide(); } }); if (!$('input#createaccount').is(':checked')) { return $('input#createaccount').change(); } }; SV_WC_Payment_Form_Handler.prototype.handle_sample_check_hint = function() { var $sample_check; $sample_check = this.payment_fields.find('.js-sv-wc-payment-gateway-echeck-form-sample-check'); if ($sample_check.is(":visible")) { return $sample_check.slideUp(); } else { return $sample_check.slideDown(); } }; SV_WC_Payment_Form_Handler.prototype.block_ui = function() { return this.form.block({ message: null, overlayCSS: { background: '#fff', opacity: 0.6 } }); }; SV_WC_Payment_Form_Handler.prototype.unblock_ui = function() { return this.form.unblock(); }; return SV_WC_Payment_Form_Handler; })(); });}).call(this);
|
lib/skyverge/woocommerce/payment-gateway/class-sv-wc-payment-gateway-direct.php
CHANGED
@@ -18,15 +18,15 @@
|
|
18 |
*
|
19 |
* @package SkyVerge/WooCommerce/Payment-Gateway/Classes
|
20 |
* @author SkyVerge
|
21 |
-
* @copyright Copyright (c) 2013-
|
22 |
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
|
23 |
*/
|
24 |
|
25 |
-
namespace
|
26 |
|
27 |
defined( 'ABSPATH' ) or exit;
|
28 |
|
29 |
-
if ( ! class_exists( '
|
30 |
|
31 |
/**
|
32 |
* # WooCommerce Payment Gateway Framework Direct Gateway
|
@@ -36,47 +36,6 @@ if ( ! class_exists( '\SkyVerge\Plugin_Framework\SV_WC_Payment_Gateway_Direct' )
|
|
36 |
abstract class SV_WC_Payment_Gateway_Direct extends SV_WC_Payment_Gateway {
|
37 |
|
38 |
|
39 |
-
/** Add new payment method feature */
|
40 |
-
const FEATURE_ADD_PAYMENT_METHOD = 'add_payment_method';
|
41 |
-
|
42 |
-
/** Admin token editor feature */
|
43 |
-
const FEATURE_TOKEN_EDITOR = 'token_editor';
|
44 |
-
|
45 |
-
/** Subscriptions integration ID */
|
46 |
-
const INTEGRATION_SUBSCRIPTIONS = 'subscriptions';
|
47 |
-
|
48 |
-
/** Pre-orders integration ID */
|
49 |
-
const INTEGRATION_PRE_ORDERS = 'pre_orders';
|
50 |
-
|
51 |
-
/** @var \SV_WC_Payment_Gateway_Payment_Tokens_Handler payment tokens handler instance */
|
52 |
-
protected $payment_tokens_handler;
|
53 |
-
|
54 |
-
/** @var array of SV_WC_Payment_Gateway_Integration objects for Subscriptions, Pre-Orders, etc. */
|
55 |
-
protected $integrations;
|
56 |
-
|
57 |
-
|
58 |
-
/**
|
59 |
-
* Initialize the gateway
|
60 |
-
*
|
61 |
-
* See parent constructor for full method documentation
|
62 |
-
*
|
63 |
-
* @since 1.0.0
|
64 |
-
* @see SV_WC_Payment_Gateway::__construct()
|
65 |
-
* @param string $id the gateway id
|
66 |
-
* @param SV_WC_Payment_Gateway_Plugin $plugin the parent plugin class
|
67 |
-
* @param array $args gateway arguments
|
68 |
-
*/
|
69 |
-
public function __construct( $id, $plugin, $args ) {
|
70 |
-
|
71 |
-
// parent constructor
|
72 |
-
parent::__construct( $id, $plugin, $args );
|
73 |
-
|
74 |
-
$this->init_payment_tokens_handler();
|
75 |
-
|
76 |
-
$this->init_integrations();
|
77 |
-
}
|
78 |
-
|
79 |
-
|
80 |
/**
|
81 |
* Validate the payment fields when processing the checkout
|
82 |
*
|
@@ -103,7 +62,7 @@ abstract class SV_WC_Payment_Gateway_Direct extends SV_WC_Payment_Gateway {
|
|
103 |
}
|
104 |
|
105 |
// Check the CSC if enabled
|
106 |
-
if ( $this->is_credit_card_gateway() && $this->
|
107 |
$is_valid = $this->validate_csc( SV_WC_Helper::get_post( 'wc-' . $this->get_id_dasherized() . '-csc' ) ) && $is_valid;
|
108 |
}
|
109 |
|
@@ -391,7 +350,7 @@ abstract class SV_WC_Payment_Gateway_Direct extends SV_WC_Payment_Gateway {
|
|
391 |
* @since 1.0.0
|
392 |
* @param bool $result default true
|
393 |
* @param int|string $order_id order ID for the payment
|
394 |
-
* @param
|
395 |
*/
|
396 |
if ( is_array( $result = apply_filters( 'wc_payment_gateway_' . $this->get_id() . '_process_payment', true, $order_id, $this ) ) ) {
|
397 |
return $result;
|
@@ -402,10 +361,19 @@ abstract class SV_WC_Payment_Gateway_Direct extends SV_WC_Payment_Gateway {
|
|
402 |
|
403 |
try {
|
404 |
|
405 |
-
//
|
406 |
-
if ( $this->supports_tokenization() && 0
|
407 |
-
|
408 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
409 |
}
|
410 |
|
411 |
// payment failures are handled internally by do_transaction()
|
@@ -418,7 +386,18 @@ abstract class SV_WC_Payment_Gateway_Direct extends SV_WC_Payment_Gateway {
|
|
418 |
$this->add_transaction_data( $order );
|
419 |
}
|
420 |
|
421 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
422 |
SV_WC_Order_Compatibility::reduce_stock_levels( $order ); // reduce stock for held orders, but don't complete payment
|
423 |
} else {
|
424 |
$order->payment_complete(); // mark order as having received payment
|
@@ -436,7 +415,7 @@ abstract class SV_WC_Payment_Gateway_Direct extends SV_WC_Payment_Gateway {
|
|
436 |
*
|
437 |
* @since 4.1.0
|
438 |
* @param \WC_Order $order order object
|
439 |
-
* @param
|
440 |
*/
|
441 |
do_action( 'wc_payment_gateway_' . $this->get_id() . '_payment_processed', $order, $this );
|
442 |
|
@@ -460,6 +439,80 @@ abstract class SV_WC_Payment_Gateway_Direct extends SV_WC_Payment_Gateway {
|
|
460 |
}
|
461 |
|
462 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
463 |
/**
|
464 |
* Add payment and transaction information as class members of WC_Order
|
465 |
* instance. The standard information that can be added includes:
|
@@ -488,7 +541,7 @@ abstract class SV_WC_Payment_Gateway_Direct extends SV_WC_Payment_Gateway {
|
|
488 |
* @since 1.0.0
|
489 |
* @see SV_WC_Payment_Gateway::get_order()
|
490 |
* @param int|\WC_Order $order_id order ID being processed
|
491 |
-
* @return WC_Order object with payment and transaction information attached
|
492 |
*/
|
493 |
public function get_order( $order_id ) {
|
494 |
|
@@ -550,7 +603,7 @@ abstract class SV_WC_Payment_Gateway_Direct extends SV_WC_Payment_Gateway {
|
|
550 |
$order->payment->exp_month = $token->get_exp_month();
|
551 |
$order->payment->exp_year = $token->get_exp_year();
|
552 |
|
553 |
-
if ( $this->
|
554 |
$order->payment->csc = SV_WC_Helper::get_post( 'wc-' . $this->get_id_dasherized() . '-csc' );
|
555 |
}
|
556 |
|
@@ -589,7 +642,7 @@ abstract class SV_WC_Payment_Gateway_Direct extends SV_WC_Payment_Gateway {
|
|
589 |
* @since 1.0.0
|
590 |
* @param WC_Order $order the order object
|
591 |
* @return SV_WC_Payment_Gateway_API_Response the response
|
592 |
-
* @throws
|
593 |
*/
|
594 |
protected function do_check_transaction( $order ) {
|
595 |
|
@@ -646,7 +699,7 @@ abstract class SV_WC_Payment_Gateway_Direct extends SV_WC_Payment_Gateway {
|
|
646 |
* @param WC_Order $order the order object
|
647 |
* @param SV_WC_Payment_Gateway_API_Response $response optional credit card transaction response
|
648 |
* @return SV_WC_Payment_Gateway_API_Response the response
|
649 |
-
* @throws
|
650 |
*/
|
651 |
protected function do_credit_card_transaction( $order, $response = null ) {
|
652 |
|
@@ -674,16 +727,25 @@ abstract class SV_WC_Payment_Gateway_Direct extends SV_WC_Payment_Gateway {
|
|
674 |
|
675 |
// credit card order note
|
676 |
$message = sprintf(
|
677 |
-
/* translators: Placeholders: %1$s - payment method title, %2$s - environment ("Test"), %3$s - transaction type (authorization/charge), %4$s - card type (mastercard, visa, ...), %5$s - last four digits of the card
|
678 |
-
esc_html__( '%1$s %2$s %3$s Approved: %4$s ending in %5$s
|
679 |
$this->get_method_title(),
|
680 |
$this->is_test_environment() ? esc_html_x( 'Test', 'noun, software environment', 'woocommerce-gateway-paypal-powered-by-braintree' ) : '',
|
681 |
$this->perform_credit_card_authorization( $order ) ? esc_html_x( 'Authorization', 'credit card transaction type', 'woocommerce-gateway-paypal-powered-by-braintree' ) : esc_html_x( 'Charge', 'noun, credit card transaction type', 'woocommerce-gateway-paypal-powered-by-braintree' ),
|
682 |
SV_WC_Payment_Gateway_Helper::payment_type_to_name( $card_type ),
|
683 |
-
$last_four
|
684 |
-
$order->payment->exp_month . '/' . substr( $order->payment->exp_year, -2 )
|
685 |
);
|
686 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
687 |
// adds the transaction id (if any) to the order note
|
688 |
if ( $response->get_transaction_id() ) {
|
689 |
/* translators: Placeholders: %s - transaction ID */
|
@@ -714,12 +776,13 @@ abstract class SV_WC_Payment_Gateway_Direct extends SV_WC_Payment_Gateway {
|
|
714 |
|
715 |
|
716 |
/**
|
717 |
-
* Create a transaction
|
718 |
*
|
719 |
* @since 1.0.0
|
720 |
-
*
|
721 |
-
* @
|
722 |
-
* @
|
|
|
723 |
*/
|
724 |
protected function do_transaction( $order ) {
|
725 |
|
@@ -794,331 +857,9 @@ abstract class SV_WC_Payment_Gateway_Direct extends SV_WC_Payment_Gateway {
|
|
794 |
}
|
795 |
|
796 |
|
797 |
-
/**
|
798 |
-
* Adds the standard transaction data to the order
|
799 |
-
*
|
800 |
-
* @since 1.0.0
|
801 |
-
* @see SV_WC_Payment_Gateway::add_transaction_data()
|
802 |
-
* @param WC_Order $order the order object
|
803 |
-
* @param SV_WC_Payment_Gateway_API_Response|null $response optional transaction response
|
804 |
-
*/
|
805 |
-
public function add_transaction_data( $order, $response = null ) {
|
806 |
-
|
807 |
-
// add parent transaction data
|
808 |
-
parent::add_transaction_data( $order, $response );
|
809 |
-
|
810 |
-
// payment info
|
811 |
-
if ( isset( $order->payment->token ) && $order->payment->token ) {
|
812 |
-
$this->update_order_meta( $order, 'payment_token', $order->payment->token );
|
813 |
-
}
|
814 |
-
|
815 |
-
// account number
|
816 |
-
if ( isset( $order->payment->account_number ) && $order->payment->account_number ) {
|
817 |
-
$this->update_order_meta( $order, 'account_four', substr( $order->payment->account_number, -4 ) );
|
818 |
-
}
|
819 |
-
|
820 |
-
if ( $this->is_credit_card_gateway() ) {
|
821 |
-
|
822 |
-
// credit card gateway data
|
823 |
-
if ( $response && $response instanceof SV_WC_Payment_Gateway_API_Authorization_Response ) {
|
824 |
-
|
825 |
-
if ( $response->get_authorization_code() ) {
|
826 |
-
$this->update_order_meta( $order, 'authorization_code', $response->get_authorization_code() );
|
827 |
-
}
|
828 |
-
|
829 |
-
if ( $order->payment_total > 0 ) {
|
830 |
-
// mark as captured
|
831 |
-
if ( $this->perform_credit_card_charge( $order ) ) {
|
832 |
-
$captured = 'yes';
|
833 |
-
} else {
|
834 |
-
$captured = 'no';
|
835 |
-
}
|
836 |
-
$this->update_order_meta( $order, 'charge_captured', $captured );
|
837 |
-
}
|
838 |
-
|
839 |
-
}
|
840 |
-
|
841 |
-
if ( isset( $order->payment->exp_year ) && $order->payment->exp_year && isset( $order->payment->exp_month ) && $order->payment->exp_month ) {
|
842 |
-
$this->update_order_meta( $order, 'card_expiry_date', $order->payment->exp_year . '-' . $order->payment->exp_month );
|
843 |
-
}
|
844 |
-
|
845 |
-
if ( isset( $order->payment->card_type ) && $order->payment->card_type ) {
|
846 |
-
$this->update_order_meta( $order, 'card_type', $order->payment->card_type );
|
847 |
-
}
|
848 |
-
|
849 |
-
} elseif ( $this->is_echeck_gateway() ) {
|
850 |
-
|
851 |
-
// checking gateway data
|
852 |
-
|
853 |
-
// optional account type (checking/savings)
|
854 |
-
if ( isset( $order->payment->account_type ) && $order->payment->account_type ) {
|
855 |
-
$this->update_order_meta( $order, 'account_type', $order->payment->account_type );
|
856 |
-
}
|
857 |
-
|
858 |
-
// optional check number
|
859 |
-
if ( isset( $order->payment->check_number ) && $order->payment->check_number ) {
|
860 |
-
$this->update_order_meta( $order, 'check_number', $order->payment->check_number );
|
861 |
-
}
|
862 |
-
}
|
863 |
-
}
|
864 |
-
|
865 |
-
|
866 |
-
/** Tokenization **************************************************/
|
867 |
-
|
868 |
-
|
869 |
-
/**
|
870 |
-
* Initialize payment tokens handler.
|
871 |
-
*
|
872 |
-
* @since 4.3.0
|
873 |
-
*/
|
874 |
-
protected function init_payment_tokens_handler() {
|
875 |
-
|
876 |
-
$this->payment_tokens_handler = $this->build_payment_tokens_handler();
|
877 |
-
}
|
878 |
-
|
879 |
-
|
880 |
-
/**
|
881 |
-
* Return the Payment Tokens Handler class instance. Concrete classes
|
882 |
-
* can override this method to return a custom implementation.
|
883 |
-
*
|
884 |
-
* @since 4.3.0
|
885 |
-
* @return \SV_WC_Payment_Gateway_Payment_Tokens_Handler
|
886 |
-
*/
|
887 |
-
protected function build_payment_tokens_handler() {
|
888 |
-
|
889 |
-
return new SV_WC_Payment_Gateway_Payment_Tokens_Handler( $this );
|
890 |
-
}
|
891 |
-
|
892 |
-
|
893 |
-
/**
|
894 |
-
* Get the payment tokens handler instance.
|
895 |
-
*
|
896 |
-
* @since 4.3.0
|
897 |
-
* @return \SV_WC_Payment_Gateway_Payment_Tokens_Handler
|
898 |
-
*/
|
899 |
-
public function get_payment_tokens_handler() {
|
900 |
-
|
901 |
-
return $this->payment_tokens_handler;
|
902 |
-
}
|
903 |
-
|
904 |
-
|
905 |
-
/**
|
906 |
-
* Returns true if tokenization takes place prior authorization/charge
|
907 |
-
* transaction.
|
908 |
-
*
|
909 |
-
* Defaults to false but can be overridden by child gateway class
|
910 |
-
*
|
911 |
-
* @since 2.1.0
|
912 |
-
* @return boolean true if there is a tokenization request that is issued
|
913 |
-
* before a authorization/charge transaction
|
914 |
-
*/
|
915 |
-
public function tokenize_before_sale() {
|
916 |
-
return false;
|
917 |
-
}
|
918 |
-
|
919 |
-
|
920 |
-
/**
|
921 |
-
* Returns true if authorization/charge requests also tokenize the payment
|
922 |
-
* method. False if this gateway has a separate "tokenize" method which
|
923 |
-
* is always used.
|
924 |
-
*
|
925 |
-
* Defaults to false but can be overridden by child gateway class
|
926 |
-
*
|
927 |
-
* @since 2.0.0
|
928 |
-
* @return boolean true if tokenization is combined with sales, false if
|
929 |
-
* there is a special request for tokenization
|
930 |
-
*/
|
931 |
-
public function tokenize_with_sale() {
|
932 |
-
return false;
|
933 |
-
}
|
934 |
-
|
935 |
-
|
936 |
-
/**
|
937 |
-
* Returns true if tokenization takes place after an authorization/charge
|
938 |
-
* transaction.
|
939 |
-
*
|
940 |
-
* Defaults to false but can be overridden by child gateway class
|
941 |
-
*
|
942 |
-
* @since 2.1.0
|
943 |
-
* @return boolean true if there is a tokenization request that is issued
|
944 |
-
* after an authorization/charge transaction
|
945 |
-
*/
|
946 |
-
public function tokenize_after_sale() {
|
947 |
-
return false;
|
948 |
-
}
|
949 |
-
|
950 |
-
|
951 |
-
/**
|
952 |
-
* Determine if the gateway supports the admin token editor feature.
|
953 |
-
*
|
954 |
-
* @since 4.3.0
|
955 |
-
* @return boolean
|
956 |
-
*/
|
957 |
-
public function supports_token_editor() {
|
958 |
-
return $this->supports( self::FEATURE_TOKEN_EDITOR );
|
959 |
-
}
|
960 |
-
|
961 |
-
|
962 |
-
/** Integrations Feature **************************************************/
|
963 |
-
|
964 |
-
|
965 |
-
/**
|
966 |
-
* Initialize supported integrations
|
967 |
-
*
|
968 |
-
* @since 4.1.0
|
969 |
-
*/
|
970 |
-
public function init_integrations() {
|
971 |
-
|
972 |
-
if ( $this->supports_subscriptions() ) {
|
973 |
-
$this->integrations[ self::INTEGRATION_SUBSCRIPTIONS ] = $this->build_subscriptions_integration();
|
974 |
-
}
|
975 |
-
|
976 |
-
if ( $this->supports_pre_orders() ) {
|
977 |
-
$this->integrations[ self::INTEGRATION_PRE_ORDERS ] = $this->build_pre_orders_integration();
|
978 |
-
}
|
979 |
-
|
980 |
-
/**
|
981 |
-
* Payment Gateway Integrations Initialized Action.
|
982 |
-
*
|
983 |
-
* Fired when integrations (Subscriptons/Pre-Orders) have been loaded and
|
984 |
-
* initialized.
|
985 |
-
*
|
986 |
-
* @since 4.1.0
|
987 |
-
* @param \SV_WC_Payment_Gateway_Direct $this instance
|
988 |
-
*/
|
989 |
-
do_action( 'wc_payment_gateway_' . $this->get_id() . '_init_integrations', $this );
|
990 |
-
}
|
991 |
-
|
992 |
-
|
993 |
-
/**
|
994 |
-
* Return an array of available integration objects
|
995 |
-
*
|
996 |
-
* @since 4.1.0
|
997 |
-
* @return array
|
998 |
-
*/
|
999 |
-
public function get_integrations() {
|
1000 |
-
|
1001 |
-
return $this->integrations;
|
1002 |
-
}
|
1003 |
-
|
1004 |
-
|
1005 |
-
/**
|
1006 |
-
* Get the integration object for the given ID
|
1007 |
-
*
|
1008 |
-
* @since 4.1.0
|
1009 |
-
* @param string $id the integration ID, e.g. subscriptions
|
1010 |
-
* @return \SV_WC_Payment_Gateway_Integration|null
|
1011 |
-
*/
|
1012 |
-
public function get_integration( $id ) {
|
1013 |
-
|
1014 |
-
return isset( $this->integrations[ $id ] ) ? $this->integrations[ $id ] : null;
|
1015 |
-
}
|
1016 |
-
|
1017 |
-
|
1018 |
-
/**
|
1019 |
-
* A factory method to build and return the Subscriptions class instance.
|
1020 |
-
* Concrete classes can override this method to return a custom
|
1021 |
-
* implementation.
|
1022 |
-
*
|
1023 |
-
* @since 4.1.0
|
1024 |
-
* @return \SV_WC_Payment_Gateway_Integration_Subscriptions
|
1025 |
-
*/
|
1026 |
-
protected function build_subscriptions_integration() {
|
1027 |
-
|
1028 |
-
return new SV_WC_Payment_Gateway_Integration_Subscriptions( $this );
|
1029 |
-
}
|
1030 |
-
|
1031 |
-
|
1032 |
-
/**
|
1033 |
-
* Get the Subscriptions integration class instance
|
1034 |
-
*
|
1035 |
-
* @since 4.1.0
|
1036 |
-
* @return \SV_WC_Payment_Gateway_Integration_Subscriptions|null
|
1037 |
-
*/
|
1038 |
-
public function get_subscriptions_integration() {
|
1039 |
-
|
1040 |
-
return isset( $this->integrations[ self::INTEGRATION_SUBSCRIPTIONS ] ) ? $this->integrations[ self::INTEGRATION_SUBSCRIPTIONS ] : null;
|
1041 |
-
}
|
1042 |
-
|
1043 |
-
|
1044 |
-
/**
|
1045 |
-
* A factory method to build and return the Pre-Orders class instance.
|
1046 |
-
* Concrete classes can override this method to return a custom
|
1047 |
-
* implementation.
|
1048 |
-
*
|
1049 |
-
* @since 4.1.0
|
1050 |
-
* @return \SV_WC_Payment_Gateway_Integration_Pre_Orders
|
1051 |
-
*/
|
1052 |
-
protected function build_pre_orders_integration() {
|
1053 |
-
|
1054 |
-
return new SV_WC_Payment_Gateway_Integration_Pre_Orders( $this );
|
1055 |
-
}
|
1056 |
-
|
1057 |
-
|
1058 |
-
/**
|
1059 |
-
* Get the Pre-Orders integration class instance
|
1060 |
-
*
|
1061 |
-
* @since 4.1.0
|
1062 |
-
* @return \SV_WC_Payment_Gateway_Integration_Pre_Orders|null
|
1063 |
-
*/
|
1064 |
-
public function get_pre_orders_integration() {
|
1065 |
-
|
1066 |
-
return isset( $this->integrations[ self::INTEGRATION_PRE_ORDERS ] ) ? $this->integrations[ self::INTEGRATION_PRE_ORDERS ] : null;
|
1067 |
-
}
|
1068 |
-
|
1069 |
-
|
1070 |
-
/**
|
1071 |
-
* A gateway supports Subscriptions if all of the following are true:
|
1072 |
-
*
|
1073 |
-
* + Subscriptions is active
|
1074 |
-
* + tokenization is supported
|
1075 |
-
* + tokenization is enabled
|
1076 |
-
*
|
1077 |
-
* Concrete gateways can override this to conditionally support Subscriptions
|
1078 |
-
* based on certain settings (e.g. only when CSC is not required, etc.)
|
1079 |
-
*
|
1080 |
-
* @since 1.0.0
|
1081 |
-
* @return boolean true if the gateway supports subscriptions
|
1082 |
-
*/
|
1083 |
-
public function supports_subscriptions() {
|
1084 |
-
|
1085 |
-
return $this->get_plugin()->is_subscriptions_active() && $this->supports_tokenization() && $this->tokenization_enabled();
|
1086 |
-
}
|
1087 |
-
|
1088 |
-
|
1089 |
-
/**
|
1090 |
-
* A gateway supports Pre-Orders if all of the following are true:
|
1091 |
-
*
|
1092 |
-
* + Pre-Orders is active
|
1093 |
-
* + tokenization is supported
|
1094 |
-
* + tokenization is enabled
|
1095 |
-
*
|
1096 |
-
* Concrete gateways can override this to conditionally support Pre-Orders
|
1097 |
-
* based on certain settings (e.g. only when CSC is not required, etc.)
|
1098 |
-
*
|
1099 |
-
* @since 1.0.0
|
1100 |
-
* @return boolean true if the gateway supports pre-orders
|
1101 |
-
*/
|
1102 |
-
public function supports_pre_orders() {
|
1103 |
-
|
1104 |
-
return $this->get_plugin()->is_pre_orders_active() && $this->supports_tokenization() && $this->tokenization_enabled();
|
1105 |
-
}
|
1106 |
-
|
1107 |
-
|
1108 |
/** Add Payment Method feature ********************************************/
|
1109 |
|
1110 |
|
1111 |
-
/**
|
1112 |
-
* Returns true if the gateway supports the add payment method feature
|
1113 |
-
*
|
1114 |
-
* @since 4.0.0
|
1115 |
-
* @return boolean true if the gateway supports add payment method feature
|
1116 |
-
*/
|
1117 |
-
public function supports_add_payment_method() {
|
1118 |
-
return $this->supports( self::FEATURE_ADD_PAYMENT_METHOD );
|
1119 |
-
}
|
1120 |
-
|
1121 |
-
|
1122 |
/**
|
1123 |
* Entry method for the Add Payment Method feature flow. Note this is *not*
|
1124 |
* stubbed in the WC_Payment_Gateway abstract class, but is called if the
|
@@ -1147,20 +888,8 @@ abstract class SV_WC_Payment_Gateway_Direct extends SV_WC_Payment_Gateway {
|
|
1147 |
|
1148 |
SV_WC_Helper::wc_add_notice( $result['message'], $result['success'] ? 'success' : 'error' );
|
1149 |
|
1150 |
-
// if successful, redirect to the newly added method
|
1151 |
if ( $result['success'] ) {
|
1152 |
-
|
1153 |
-
// if this is WooCommerce 2.5.5 or older, redirect to the My Account page
|
1154 |
-
if ( SV_WC_Plugin_Compatibility::is_wc_version_lt_2_6() ) {
|
1155 |
-
|
1156 |
-
$redirect_url = wc_get_page_permalink( 'myaccount' );
|
1157 |
-
|
1158 |
-
// otherwise, redirect to the Payment Methods page (WC 2.6+)
|
1159 |
-
} else {
|
1160 |
-
$redirect_url = wc_get_account_endpoint_url( 'payment-methods' );
|
1161 |
-
}
|
1162 |
-
|
1163 |
-
// otherwise, back to the Add Payment Method page
|
1164 |
} else {
|
1165 |
$redirect_url = wc_get_endpoint_url( 'add-payment-method' );
|
1166 |
}
|
@@ -1176,6 +905,7 @@ abstract class SV_WC_Payment_Gateway_Direct extends SV_WC_Payment_Gateway {
|
|
1176 |
*
|
1177 |
* @since 4.0.0
|
1178 |
* @return array result with success/error message and request status (success/failure)
|
|
|
1179 |
*/
|
1180 |
protected function do_add_payment_method_transaction( \WC_Order $order ) {
|
1181 |
|
@@ -1218,6 +948,17 @@ abstract class SV_WC_Payment_Gateway_Direct extends SV_WC_Payment_Gateway {
|
|
1218 |
// add customer data, primarily customer ID to user meta
|
1219 |
$this->add_add_payment_method_customer_data( $order, $response );
|
1220 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1221 |
$result = array( 'message' => $message, 'success' => true );
|
1222 |
|
1223 |
} else {
|
@@ -1305,8 +1046,10 @@ abstract class SV_WC_Payment_Gateway_Direct extends SV_WC_Payment_Gateway {
|
|
1305 |
|
1306 |
foreach ( $defaults as $prop => $value ) {
|
1307 |
|
1308 |
-
|
1309 |
-
|
|
|
|
|
1310 |
}
|
1311 |
}
|
1312 |
|
18 |
*
|
19 |
* @package SkyVerge/WooCommerce/Payment-Gateway/Classes
|
20 |
* @author SkyVerge
|
21 |
+
* @copyright Copyright (c) 2013-2018, SkyVerge, Inc.
|
22 |
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
|
23 |
*/
|
24 |
|
25 |
+
namespace WC_Braintree\Plugin_Framework;
|
26 |
|
27 |
defined( 'ABSPATH' ) or exit;
|
28 |
|
29 |
+
if ( ! class_exists( '\\WC_Braintree\\Plugin_Framework\\SV_WC_Payment_Gateway_Direct' ) ) :
|
30 |
|
31 |
/**
|
32 |
* # WooCommerce Payment Gateway Framework Direct Gateway
|
36 |
abstract class SV_WC_Payment_Gateway_Direct extends SV_WC_Payment_Gateway {
|
37 |
|
38 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
39 |
/**
|
40 |
* Validate the payment fields when processing the checkout
|
41 |
*
|
62 |
}
|
63 |
|
64 |
// Check the CSC if enabled
|
65 |
+
if ( $this->is_credit_card_gateway() && $this->csc_enabled_for_tokens() ) {
|
66 |
$is_valid = $this->validate_csc( SV_WC_Helper::get_post( 'wc-' . $this->get_id_dasherized() . '-csc' ) ) && $is_valid;
|
67 |
}
|
68 |
|
350 |
* @since 1.0.0
|
351 |
* @param bool $result default true
|
352 |
* @param int|string $order_id order ID for the payment
|
353 |
+
* @param SV_WC_Payment_Gateway_Direct $this instance
|
354 |
*/
|
355 |
if ( is_array( $result = apply_filters( 'wc_payment_gateway_' . $this->get_id() . '_process_payment', true, $order_id, $this ) ) ) {
|
356 |
return $result;
|
361 |
|
362 |
try {
|
363 |
|
364 |
+
// handle creating or updating a payment method for registered customers if tokenization is enabled
|
365 |
+
if ( $this->supports_tokenization() && 0 !== (int) $order->get_user_id() ) {
|
366 |
+
|
367 |
+
// if already paying with an existing method, try and updated it locally and remotely
|
368 |
+
if ( ! empty( $order->payment->token ) ) {
|
369 |
+
|
370 |
+
$this->update_transaction_payment_method( $order );
|
371 |
+
|
372 |
+
// otherwise, create a new token if desired
|
373 |
+
} elseif ( $this->get_payment_tokens_handler()->should_tokenize() && ( '0.00' === $order->payment_total || $this->tokenize_before_sale() ) ) {
|
374 |
+
|
375 |
+
$order = $this->get_payment_tokens_handler()->create_token( $order );
|
376 |
+
}
|
377 |
}
|
378 |
|
379 |
// payment failures are handled internally by do_transaction()
|
386 |
$this->add_transaction_data( $order );
|
387 |
}
|
388 |
|
389 |
+
/**
|
390 |
+
* Filters the order status that's considered to be "held".
|
391 |
+
*
|
392 |
+
* @since 5.3.0-dev
|
393 |
+
*
|
394 |
+
* @param string $status held order status
|
395 |
+
* @param \WC_Order $order order object
|
396 |
+
* @param SV_WC_Payment_Gateway_API_Response|null $response API response object, if any
|
397 |
+
*/
|
398 |
+
$held_order_status = apply_filters( 'wc_' . $this->get_id() . '_held_order_status', 'on-hold', $order, null );
|
399 |
+
|
400 |
+
if ( $order->has_status( $held_order_status ) ) {
|
401 |
SV_WC_Order_Compatibility::reduce_stock_levels( $order ); // reduce stock for held orders, but don't complete payment
|
402 |
} else {
|
403 |
$order->payment_complete(); // mark order as having received payment
|
415 |
*
|
416 |
* @since 4.1.0
|
417 |
* @param \WC_Order $order order object
|
418 |
+
* @param SV_WC_Payment_Gateway_Direct $this instance
|
419 |
*/
|
420 |
do_action( 'wc_payment_gateway_' . $this->get_id() . '_payment_processed', $order, $this );
|
421 |
|
439 |
}
|
440 |
|
441 |
|
442 |
+
/**
|
443 |
+
* Handles updating a user's payment method during payment.
|
444 |
+
*
|
445 |
+
* This allows us to check the billing address against the last used so we can determine if it needs an update.
|
446 |
+
*
|
447 |
+
* @since 5.3.0-dev
|
448 |
+
*
|
449 |
+
* @param \WC_Order $order
|
450 |
+
* @return \WC_Order
|
451 |
+
*/
|
452 |
+
protected function update_transaction_payment_method( \WC_Order $order ) {
|
453 |
+
|
454 |
+
$token = $this->get_payment_tokens_handler()->get_token( $order->get_user_id(), $order->payment->token );
|
455 |
+
$address = new Addresses\Customer_Address();
|
456 |
+
$address->set_from_order( $order );
|
457 |
+
|
458 |
+
$new_billing_hash = $address->get_hash();
|
459 |
+
|
460 |
+
// if the address & token hash don't match, update
|
461 |
+
if ( $token->get_billing_hash() !== $new_billing_hash ) {
|
462 |
+
|
463 |
+
// if the API supports it, update remotely
|
464 |
+
if ( $this->get_api()->supports_update_tokenized_payment_method() ) {
|
465 |
+
|
466 |
+
$response = null;
|
467 |
+
|
468 |
+
try {
|
469 |
+
|
470 |
+
$response = $this->get_api()->update_tokenized_payment_method( $order );
|
471 |
+
|
472 |
+
// if an address was passed and the token was updated remotely, update the billing hash
|
473 |
+
if ( $response->transaction_approved() ) {
|
474 |
+
|
475 |
+
$token->set_billing_hash( $new_billing_hash );
|
476 |
+
|
477 |
+
} else {
|
478 |
+
|
479 |
+
if ( $response->get_status_message() ) {
|
480 |
+
$message = $response->get_status_code() ? $response->get_status_code() . ' - ' . $response->get_status_message() : $response->get_status_message();
|
481 |
+
} else {
|
482 |
+
$message = __( 'Unknown error', 'woocommerce-gateway-paypal-powered-by-braintree' );
|
483 |
+
}
|
484 |
+
|
485 |
+
throw new SV_WC_Plugin_Exception( $message );
|
486 |
+
}
|
487 |
+
|
488 |
+
} catch ( SV_WC_Plugin_Exception $exception ) {
|
489 |
+
|
490 |
+
$message = sprintf(
|
491 |
+
__( 'Payment method address could not be updated. %s', 'woocommerce-gateway-paypal-powered-by-braintree' ),
|
492 |
+
$exception->getMessage()
|
493 |
+
);
|
494 |
+
|
495 |
+
$order->add_order_note( $message );
|
496 |
+
|
497 |
+
if ( $this->debug_log() ) {
|
498 |
+
$this->get_plugin()->log( $message, $this->get_id() );
|
499 |
+
}
|
500 |
+
}
|
501 |
+
|
502 |
+
} else {
|
503 |
+
|
504 |
+
// updating remotely isn't supported, so just update the hash locally
|
505 |
+
$token->set_billing_hash( $new_billing_hash );
|
506 |
+
}
|
507 |
+
}
|
508 |
+
|
509 |
+
// don't halt payment if this fails
|
510 |
+
$this->get_payment_tokens_handler()->update_token( $order->get_user_id(), $token );
|
511 |
+
|
512 |
+
return $order;
|
513 |
+
}
|
514 |
+
|
515 |
+
|
516 |
/**
|
517 |
* Add payment and transaction information as class members of WC_Order
|
518 |
* instance. The standard information that can be added includes:
|
541 |
* @since 1.0.0
|
542 |
* @see SV_WC_Payment_Gateway::get_order()
|
543 |
* @param int|\WC_Order $order_id order ID being processed
|
544 |
+
* @return \WC_Order object with payment and transaction information attached
|
545 |
*/
|
546 |
public function get_order( $order_id ) {
|
547 |
|
603 |
$order->payment->exp_month = $token->get_exp_month();
|
604 |
$order->payment->exp_year = $token->get_exp_year();
|
605 |
|
606 |
+
if ( $this->csc_enabled_for_tokens() ) {
|
607 |
$order->payment->csc = SV_WC_Helper::get_post( 'wc-' . $this->get_id_dasherized() . '-csc' );
|
608 |
}
|
609 |
|
642 |
* @since 1.0.0
|
643 |
* @param WC_Order $order the order object
|
644 |
* @return SV_WC_Payment_Gateway_API_Response the response
|
645 |
+
* @throws SV_WC_Plugin_Exception network timeouts, etc
|
646 |
*/
|
647 |
protected function do_check_transaction( $order ) {
|
648 |
|
699 |
* @param WC_Order $order the order object
|
700 |
* @param SV_WC_Payment_Gateway_API_Response $response optional credit card transaction response
|
701 |
* @return SV_WC_Payment_Gateway_API_Response the response
|
702 |
+
* @throws SV_WC_Plugin_Exception network timeouts, etc
|
703 |
*/
|
704 |
protected function do_credit_card_transaction( $order, $response = null ) {
|
705 |
|
727 |
|
728 |
// credit card order note
|
729 |
$message = sprintf(
|
730 |
+
/* translators: Placeholders: %1$s - payment method title, %2$s - environment ("Test"), %3$s - transaction type (authorization/charge), %4$s - card type (mastercard, visa, ...), %5$s - last four digits of the card */
|
731 |
+
esc_html__( '%1$s %2$s %3$s Approved: %4$s ending in %5$s', 'woocommerce-gateway-paypal-powered-by-braintree' ),
|
732 |
$this->get_method_title(),
|
733 |
$this->is_test_environment() ? esc_html_x( 'Test', 'noun, software environment', 'woocommerce-gateway-paypal-powered-by-braintree' ) : '',
|
734 |
$this->perform_credit_card_authorization( $order ) ? esc_html_x( 'Authorization', 'credit card transaction type', 'woocommerce-gateway-paypal-powered-by-braintree' ) : esc_html_x( 'Charge', 'noun, credit card transaction type', 'woocommerce-gateway-paypal-powered-by-braintree' ),
|
735 |
SV_WC_Payment_Gateway_Helper::payment_type_to_name( $card_type ),
|
736 |
+
$last_four
|
|
|
737 |
);
|
738 |
|
739 |
+
// add the expiry date if it is available
|
740 |
+
if ( ! empty( $order->payment->exp_month ) && ! empty( $order->payment->exp_year ) ) {
|
741 |
+
|
742 |
+
$message .= ' ' . sprintf(
|
743 |
+
/** translators: Placeholders: %s - credit card expiry date */
|
744 |
+
__( '(expires %s)', 'woocommerce-gateway-paypal-powered-by-braintree' ),
|
745 |
+
$order->payment->exp_month . '/' . substr( $order->payment->exp_year, -2 )
|
746 |
+
);
|
747 |
+
}
|
748 |
+
|
749 |
// adds the transaction id (if any) to the order note
|
750 |
if ( $response->get_transaction_id() ) {
|
751 |
/* translators: Placeholders: %s - transaction ID */
|
776 |
|
777 |
|
778 |
/**
|
779 |
+
* Create a transaction.
|
780 |
*
|
781 |
* @since 1.0.0
|
782 |
+
*
|
783 |
+
* @param \WC_Order $order the order object
|
784 |
+
* @return bool
|
785 |
+
* @throws SV_WC_Plugin_Exception
|
786 |
*/
|
787 |
protected function do_transaction( $order ) {
|
788 |
|
857 |
}
|
858 |
|
859 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
860 |
/** Add Payment Method feature ********************************************/
|
861 |
|
862 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
863 |
/**
|
864 |
* Entry method for the Add Payment Method feature flow. Note this is *not*
|
865 |
* stubbed in the WC_Payment_Gateway abstract class, but is called if the
|
888 |
|
889 |
SV_WC_Helper::wc_add_notice( $result['message'], $result['success'] ? 'success' : 'error' );
|
890 |
|
|
|
891 |
if ( $result['success'] ) {
|
892 |
+
$redirect_url = wc_get_account_endpoint_url( 'payment-methods' );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
893 |
} else {
|
894 |
$redirect_url = wc_get_endpoint_url( 'add-payment-method' );
|
895 |
}
|
905 |
*
|
906 |
* @since 4.0.0
|
907 |
* @return array result with success/error message and request status (success/failure)
|
908 |
+
* @throws SV_WC_Plugin_Exception
|
909 |
*/
|
910 |
protected function do_add_payment_method_transaction( \WC_Order $order ) {
|
911 |
|
948 |
// add customer data, primarily customer ID to user meta
|
949 |
$this->add_add_payment_method_customer_data( $order, $response );
|
950 |
|
951 |
+
/**
|
952 |
+
* Fires after a new payment method is added by a customer.
|
953 |
+
*
|
954 |
+
* @since 5.0.0
|
955 |
+
*
|
956 |
+
* @param string $token_id new token ID
|
957 |
+
* @param int $user_id user ID
|
958 |
+
* @param \SV_WC_Payment_Gateway_API_Response $response API response object
|
959 |
+
*/
|
960 |
+
do_action( 'wc_payment_gateway_' . $this->get_id() . '_payment_method_added', $token->get_id(), $order->get_user_id(), $response );
|
961 |
+
|
962 |
$result = array( 'message' => $message, 'success' => true );
|
963 |
|
964 |
} else {
|
1046 |
|
1047 |
foreach ( $defaults as $prop => $value ) {
|
1048 |
|
1049 |
+
$value = ! empty( $user->$prop ) ? $user->$prop : $value;
|
1050 |
+
|
1051 |
+
if ( ! empty( $value ) ) {
|
1052 |
+
$properties[ $prop ] = $value;
|
1053 |
}
|
1054 |
}
|
1055 |
|
lib/skyverge/woocommerce/payment-gateway/class-sv-wc-payment-gateway-helper.php
CHANGED
@@ -18,15 +18,15 @@
|
|
18 |
*
|
19 |
* @package SkyVerge/WooCommerce/Plugin/Classes
|
20 |
* @author SkyVerge
|
21 |
-
* @copyright Copyright (c) 2013-
|
22 |
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
|
23 |
*/
|
24 |
|
25 |
-
namespace
|
26 |
|
27 |
defined( 'ABSPATH' ) or exit;
|
28 |
|
29 |
-
if ( ! class_exists( '
|
30 |
|
31 |
/**
|
32 |
* SkyVerge Payment Gateway Helper Class
|
@@ -138,13 +138,6 @@ class SV_WC_Payment_Gateway_Helper {
|
|
138 |
|
139 |
// card type regex patterns from https://github.com/stripe/jquery.payment/blob/master/src/jquery.payment.coffee
|
140 |
$types = array(
|
141 |
-
|
142 |
-
// these are kept for backwards compatibility since some gateways check
|
143 |
-
// against this method's returned value.
|
144 |
-
// TODO: remove these once the offending gateways use the below constants {CW 2016-09-29}
|
145 |
-
'mc' => '/^(5[1-5]|2[2-7])/',
|
146 |
-
'diners' => '/^(36|38|30[0-5])/',
|
147 |
-
|
148 |
self::CARD_TYPE_VISA => '/^4/',
|
149 |
self::CARD_TYPE_MASTERCARD => '/^(5[1-5]|2[2-7])/',
|
150 |
self::CARD_TYPE_AMEX => '/^3[47]/',
|
@@ -236,11 +229,11 @@ class SV_WC_Payment_Gateway_Helper {
|
|
236 |
),
|
237 |
self::CARD_TYPE_MASTERCARD => array(
|
238 |
'name' => esc_html_x( 'MasterCard', 'credit card type', 'woocommerce-gateway-paypal-powered-by-braintree' ),
|
239 |
-
'variations' => array( 'mc' ),
|
240 |
),
|
241 |
self::CARD_TYPE_AMEX => array(
|
242 |
'name' => esc_html_x( 'American Express', 'credit card type', 'woocommerce-gateway-paypal-powered-by-braintree' ),
|
243 |
-
'variations' => array(),
|
244 |
),
|
245 |
self::CARD_TYPE_DINERSCLUB => array(
|
246 |
'name' => esc_html_x( 'Diners Club', 'credit card type', 'woocommerce-gateway-paypal-powered-by-braintree' ),
|
18 |
*
|
19 |
* @package SkyVerge/WooCommerce/Plugin/Classes
|
20 |
* @author SkyVerge
|
21 |
+
* @copyright Copyright (c) 2013-2018, SkyVerge, Inc.
|
22 |
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
|
23 |
*/
|
24 |
|
25 |
+
namespace WC_Braintree\Plugin_Framework;
|
26 |
|
27 |
defined( 'ABSPATH' ) or exit;
|
28 |
|
29 |
+
if ( ! class_exists( '\\WC_Braintree\\Plugin_Framework\\SV_WC_Payment_Gateway_Helper' ) ) :
|
30 |
|
31 |
/**
|
32 |
* SkyVerge Payment Gateway Helper Class
|
138 |
|
139 |
// card type regex patterns from https://github.com/stripe/jquery.payment/blob/master/src/jquery.payment.coffee
|
140 |
$types = array(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
141 |
self::CARD_TYPE_VISA => '/^4/',
|
142 |
self::CARD_TYPE_MASTERCARD => '/^(5[1-5]|2[2-7])/',
|
143 |
self::CARD_TYPE_AMEX => '/^3[47]/',
|
229 |
),
|
230 |
self::CARD_TYPE_MASTERCARD => array(
|
231 |
'name' => esc_html_x( 'MasterCard', 'credit card type', 'woocommerce-gateway-paypal-powered-by-braintree' ),
|
232 |
+
'variations' => array( 'mc', 'master-card' ),
|
233 |
),
|
234 |
self::CARD_TYPE_AMEX => array(
|
235 |
'name' => esc_html_x( 'American Express', 'credit card type', 'woocommerce-gateway-paypal-powered-by-braintree' ),
|
236 |
+
'variations' => array( 'americanexpress' ),
|
237 |
),
|
238 |
self::CARD_TYPE_DINERSCLUB => array(
|
239 |
'name' => esc_html_x( 'Diners Club', 'credit card type', 'woocommerce-gateway-paypal-powered-by-braintree' ),
|
lib/skyverge/woocommerce/payment-gateway/class-sv-wc-payment-gateway-hosted.php
ADDED
@@ -0,0 +1,922 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* WooCommerce Payment Gateway Framework
|
4 |
+
*
|
5 |
+
* This source file is subject to the GNU General Public License v3.0
|
6 |
+
* that is bundled with this package in the file license.txt.
|
7 |
+
* It is also available through the world-wide-web at this URL:
|
8 |
+
* http://www.gnu.org/licenses/gpl-3.0.html
|
9 |
+
* If you did not receive a copy of the license and are unable to
|
10 |
+
* obtain it through the world-wide-web, please send an email
|
11 |
+
* to license@skyverge.com so we can send you a copy immediately.
|
12 |
+
*
|
13 |
+
* DISCLAIMER
|
14 |
+
*
|
15 |
+
* Do not edit or add to this file if you wish to upgrade the plugin to newer
|
16 |
+
* versions in the future. If you wish to customize the plugin for your
|
17 |
+
* needs please refer to http://www.skyverge.com
|
18 |
+
*
|
19 |
+
* @package SkyVerge/WooCommerce/Payment-Gateway/Classes
|
20 |
+
* @author SkyVerge
|
21 |
+
* @copyright Copyright (c) 2013-2018, SkyVerge, Inc.
|
22 |
+
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
|
23 |
+
*/
|
24 |
+
|
25 |
+
namespace WC_Braintree\Plugin_Framework;
|
26 |
+
|
27 |
+
defined( 'ABSPATH' ) or exit;
|
28 |
+
|
29 |
+
if ( ! class_exists( '\\WC_Braintree\\Plugin_Framework\\SV_WC_Payment_Gateway_Hosted' ) ) :
|
30 |
+
|
31 |
+
/**
|
32 |
+
* # WooCommerce Payment Gateway Framework Hosted Gateway
|
33 |
+
*
|
34 |
+
* Implement the following methods:
|
35 |
+
*
|
36 |
+
* + `get_hosted_pay_page_url()` - Return the hosted pay page url
|
37 |
+
* + `get_hosted_pay_page_params()` - Return any hosted pay page parameters (optional)
|
38 |
+
* + `get_transaction_response()` - Return the transaction response object on redirect-back/IPN
|
39 |
+
*
|
40 |
+
* @since 1.0.0
|
41 |
+
*/
|
42 |
+
abstract class SV_WC_Payment_Gateway_Hosted extends SV_WC_Payment_Gateway {
|
43 |
+
|
44 |
+
|
45 |
+
/** @var string the WC API url, used for the IPN and/or redirect-back handler */
|
46 |
+
protected $transaction_response_handler_url;
|
47 |
+
|
48 |
+
|
49 |
+
/**
|
50 |
+
* Initialize the gateway
|
51 |
+
*
|
52 |
+
* See parent constructor for full method documentation
|
53 |
+
*
|
54 |
+
* @since 2.1.0
|
55 |
+
* @see SV_WC_Payment_Gateway::__construct()
|
56 |
+
* @param string $id the gateway id
|
57 |
+
* @param SV_WC_Payment_Gateway_Plugin $plugin the parent plugin class
|
58 |
+
* @param array $args gateway arguments
|
59 |
+
*/
|
60 |
+
public function __construct( $id, $plugin, $args ) {
|
61 |
+
|
62 |
+
// parent constructor
|
63 |
+
parent::__construct( $id, $plugin, $args );
|
64 |
+
|
65 |
+
// payment notification listener hook
|
66 |
+
if ( ! has_action( 'woocommerce_api_' . strtolower( get_class( $this ) ), array( $this, 'handle_transaction_response_request' ) ) ) {
|
67 |
+
add_action( 'woocommerce_api_' . strtolower( get_class( $this ) ), array( $this, 'handle_transaction_response_request' ) );
|
68 |
+
}
|
69 |
+
}
|
70 |
+
|
71 |
+
|
72 |
+
/**
|
73 |
+
* Display the payment fields on the checkout page
|
74 |
+
*
|
75 |
+
* @since 1.0.0
|
76 |
+
* @see WC_Payment_Gateway::payment_fields()
|
77 |
+
*/
|
78 |
+
public function payment_fields() {
|
79 |
+
|
80 |
+
parent::payment_fields();
|
81 |
+
?><style type="text/css">#payment ul.payment_methods li label[for='payment_method_<?php echo $this->get_id(); ?>'] img:nth-child(n+2) { margin-left:1px; }</style><?php
|
82 |
+
}
|
83 |
+
|
84 |
+
|
85 |
+
/**
|
86 |
+
* Process the payment by redirecting customer to the WooCommerce pay page
|
87 |
+
* or the gatway hosted pay page
|
88 |
+
*
|
89 |
+
* @since 1.0.0
|
90 |
+
* @see WC_Payment_Gateway::process_payment()
|
91 |
+
* @param int $order_id the order to process
|
92 |
+
* @return array with keys 'result' and 'redirect'
|
93 |
+
* @throws \SV_WC_Payment_Gateway_Exception if payment processing must be halted, and a message displayed to the customer
|
94 |
+
*/
|
95 |
+
public function process_payment( $order_id ) {
|
96 |
+
|
97 |
+
$payment_url = $this->get_payment_url( $order_id );
|
98 |
+
|
99 |
+
if ( ! $payment_url ) {
|
100 |
+
// be sure to have either set a notice via `wc_add_notice` to be
|
101 |
+
// displayed, or have thrown an exception with a message
|
102 |
+
return array( 'result' => 'failure' );
|
103 |
+
}
|
104 |
+
|
105 |
+
if ( $this->empty_cart_before_redirect() && is_callable( array( WC()->cart, 'empty_cart' ) ) ) {
|
106 |
+
WC()->cart->empty_cart();
|
107 |
+
}
|
108 |
+
|
109 |
+
return array(
|
110 |
+
'result' => 'success',
|
111 |
+
'redirect' => $payment_url,
|
112 |
+
);
|
113 |
+
}
|
114 |
+
|
115 |
+
|
116 |
+
/**
|
117 |
+
* Gets the payment URL: the checkout pay page
|
118 |
+
*
|
119 |
+
* @since 2.1.0
|
120 |
+
* @param int $order_id the order id
|
121 |
+
* @return string the payment URL, or false if unavailable
|
122 |
+
*/
|
123 |
+
protected function get_payment_url( $order_id ) {
|
124 |
+
|
125 |
+
if ( $this->use_form_post() ) {
|
126 |
+
// the checkout pay page
|
127 |
+
$order = wc_get_order( $order_id );
|
128 |
+
return $order->get_checkout_payment_url( true );
|
129 |
+
} else {
|
130 |
+
|
131 |
+
// setup the order object
|
132 |
+
$order = $this->get_order( $order_id );
|
133 |
+
|
134 |
+
// direct-redirect, so append the hosted pay page params to the hosted pay page url
|
135 |
+
$pay_page_url = $this->get_hosted_pay_page_url( $order );
|
136 |
+
|
137 |
+
if ( $pay_page_url ) {
|
138 |
+
return add_query_arg( $this->get_hosted_pay_page_params( $order ), $pay_page_url );
|
139 |
+
}
|
140 |
+
}
|
141 |
+
|
142 |
+
return false;
|
143 |
+
}
|
144 |
+
|
145 |
+
|
146 |
+
/**
|
147 |
+
* Determines if the customers cart should be emptied before redirecting to the payment form, after the order is created.
|
148 |
+
*
|
149 |
+
* Gateways can set this to false if they want the cart to remain intact until a successful payment is made.
|
150 |
+
*
|
151 |
+
* @since 5.0.0
|
152 |
+
*
|
153 |
+
* @return bool
|
154 |
+
*/
|
155 |
+
protected function empty_cart_before_redirect() {
|
156 |
+
|
157 |
+
return true;
|
158 |
+
}
|
159 |
+
|
160 |
+
|
161 |
+
/**
|
162 |
+
* Render the payment page for gateways that use a form post method
|
163 |
+
*
|
164 |
+
* @since 2.1.0
|
165 |
+
* @see SV_WC_Payment_Gateway::payment_page()
|
166 |
+
* @see SV_WC_Payment_Gateway_Hosted::use_form_post()
|
167 |
+
* @see SV_WC_Payment_Gateway_Hosted::add_pay_page_handler()
|
168 |
+
* @param int $order_id identifies the order
|
169 |
+
*/
|
170 |
+
public function payment_page( $order_id ) {
|
171 |
+
|
172 |
+
if ( ! $this->use_form_post() ) {
|
173 |
+
// default behavior: pay page is not used, direct-redirect from checkout
|
174 |
+
parent::payment_page( $order_id );
|
175 |
+
} else {
|
176 |
+
$this->generate_pay_form( $order_id );
|
177 |
+
}
|
178 |
+
}
|
179 |
+
|
180 |
+
|
181 |
+
/**
|
182 |
+
* Generates the POST pay form. Some inline javascript will attempt to
|
183 |
+
* auto-submit this pay form, so as to make the checkout process as
|
184 |
+
* seamless as possile
|
185 |
+
*
|
186 |
+
* @since 2.1.0
|
187 |
+
* @param int $order_id the order identifier
|
188 |
+
*/
|
189 |
+
public function generate_pay_form( $order_id ) {
|
190 |
+
|
191 |
+
// setup the order object
|
192 |
+
$order = $this->get_order( $order_id );
|
193 |
+
|
194 |
+
$request_params = $this->get_hosted_pay_page_params( $order );
|
195 |
+
|
196 |
+
// standardized request data, for logging purposes
|
197 |
+
$request = array(
|
198 |
+
'method' => 'POST',
|
199 |
+
'uri' => $this->get_hosted_pay_page_url( $order ),
|
200 |
+
'body' => print_r( $request_params, true ),
|
201 |
+
);
|
202 |
+
|
203 |
+
// log the request
|
204 |
+
$this->log_hosted_pay_page_request( $request );
|
205 |
+
|
206 |
+
// render the appropriate content
|
207 |
+
if ( $this->use_auto_form_post() ) {
|
208 |
+
$this->render_auto_post_form( $order, $request_params );
|
209 |
+
} else {
|
210 |
+
$this->render_pay_page_form( $order, $request_params );
|
211 |
+
}
|
212 |
+
}
|
213 |
+
|
214 |
+
|
215 |
+
/**
|
216 |
+
* Renders the gateway pay page direct post form. This is used by gateways
|
217 |
+
* that collect some or all payment information on-site, and POST the
|
218 |
+
* entered information to a remote server for processing
|
219 |
+
*
|
220 |
+
* @since 2.2.0
|
221 |
+
* @see SV_WC_Payment_Gateway_Hosted::use_auto_form_post()
|
222 |
+
* @param WC_Order $order the order object
|
223 |
+
* @param array $request_params associative array of request parameters
|
224 |
+
*/
|
225 |
+
public function render_pay_page_form( $order, $request_params ) {
|
226 |
+
// implemented by concrete class
|
227 |
+
}
|
228 |
+
|
229 |
+
|
230 |
+
/**
|
231 |
+
* Renders the gateway auto post form. This is used for gateways that
|
232 |
+
* collect no payment information on-site, but must POST parameters to a
|
233 |
+
* hosted payment page where payment information is entered.
|
234 |
+
*
|
235 |
+
* @since 2.2.0
|
236 |
+
* @see SV_WC_Payment_Gateway_Hosted::use_auto_form_post()
|
237 |
+
*
|
238 |
+
* @param \WC_Order $order the order object
|
239 |
+
* @param array $request_params associative array of request parameters
|
240 |
+
*/
|
241 |
+
public function render_auto_post_form( \WC_Order $order, $request_params ) {
|
242 |
+
|
243 |
+
$args = $this->get_auto_post_form_args( $order );
|
244 |
+
|
245 |
+
// attempt to automatically submit the form and redirect
|
246 |
+
wc_enqueue_js('
|
247 |
+
$( "body" ).block( {
|
248 |
+
message: "<img src=\"' . esc_url( $this->get_plugin()->get_framework_assets_url() . '/images/ajax-loader.gif' ) . '\" alt=\"Redirecting…\" style=\"float:left; margin-right: 10px;\" />' . esc_html( $args['thanks_message'] ) . '",
|
249 |
+
overlayCSS: {
|
250 |
+
background: "#fff",
|
251 |
+
opacity: 0.6
|
252 |
+
},
|
253 |
+
css: {
|
254 |
+
padding: 20,
|
255 |
+
textAlign: "center",
|
256 |
+
color: "#555",
|
257 |
+
border: "3px solid #aaa",
|
258 |
+
backgroundColor: "#fff",
|
259 |
+
cursor: "wait",
|
260 |
+
lineHeight: "32px"
|
261 |
+
}
|
262 |
+
} );
|
263 |
+
|
264 |
+
$( "#submit_' . $this->get_id() . '_payment_form" ).click();
|
265 |
+
');
|
266 |
+
|
267 |
+
echo '<p>' . esc_html( $args['message'] ) . '</p>';
|
268 |
+
echo '<form action="' . esc_url( $args['submit_url'] ) . '" method="post">';
|
269 |
+
|
270 |
+
// Output the param inputs
|
271 |
+
echo $this->get_auto_post_form_params_html( $request_params );
|
272 |
+
|
273 |
+
echo '<input type="submit" class="button alt button-alt" id="submit_' . $this->get_id() . '_payment_form" value="' . esc_attr( $args['button_text'] ) . '" />';
|
274 |
+
echo '<a class="button cancel" href="' . esc_url( $args['cancel_url'] ) . '">' . esc_html( $args['cancel_text'] ) . '</a>';
|
275 |
+
|
276 |
+
echo '</form>';
|
277 |
+
}
|
278 |
+
|
279 |
+
|
280 |
+
/**
|
281 |
+
* Get the auto post form display arguments.
|
282 |
+
*
|
283 |
+
* @since 4.3.0
|
284 |
+
* @see SV_WC_Payment_Gateway_Hosted::render_auto_post_form() for args
|
285 |
+
*
|
286 |
+
* @param \WC_Order $order the order object
|
287 |
+
* @return array
|
288 |
+
*/
|
289 |
+
protected function get_auto_post_form_args( \WC_Order $order ) {
|
290 |
+
|
291 |
+
$args = array(
|
292 |
+
'submit_url' => $this->get_hosted_pay_page_url( $order ),
|
293 |
+
'cancel_url' => $order->get_cancel_order_url(),
|
294 |
+
'message' => __( 'Thank you for your order, please click the button below to pay.', 'woocommerce-gateway-paypal-powered-by-braintree' ),
|
295 |
+
'thanks_message' => __( 'Thank you for your order. We are now redirecting you to complete payment.', 'woocommerce-gateway-paypal-powered-by-braintree' ),
|
296 |
+
'button_text' => __( 'Pay Now', 'woocommerce-gateway-paypal-powered-by-braintree' ),
|
297 |
+
'cancel_text' => __( 'Cancel Order', 'woocommerce-gateway-paypal-powered-by-braintree' ),
|
298 |
+
);
|
299 |
+
|
300 |
+
/**
|
301 |
+
* Filter the auto post form display arguments.
|
302 |
+
*
|
303 |
+
* @since 4.3.0
|
304 |
+
* @param array $args {
|
305 |
+
* The form display arguments.
|
306 |
+
*
|
307 |
+
* @type string $submit_url Form submit URL
|
308 |
+
* @type string $cancel_url Cancel payment URL
|
309 |
+
* @type string $message The message before the form
|
310 |
+
* @type string $thanks_message The message displayed when the form is submitted
|
311 |
+
* @type string $button_text Submit button text
|
312 |
+
* @type string $cancel_text Cancel link text
|
313 |
+
* }
|
314 |
+
* @param \WC_Order $order the order object
|
315 |
+
*/
|
316 |
+
return (array) apply_filters( 'wc_payment_gateway_' . $this->get_id() . '_auto_post_form_args', $args, $order );
|
317 |
+
}
|
318 |
+
|
319 |
+
|
320 |
+
/**
|
321 |
+
* Get the auto post form params HTML.
|
322 |
+
*
|
323 |
+
* This can be overridden by concrete gateways to support more complex param arrays.
|
324 |
+
*
|
325 |
+
* @since 4.3.0
|
326 |
+
* @param array $request_params The request params
|
327 |
+
* @return string
|
328 |
+
*/
|
329 |
+
protected function get_auto_post_form_params_html( $request_params = array() ) {
|
330 |
+
|
331 |
+
$html = '';
|
332 |
+
|
333 |
+
foreach ( $request_params as $key => $value ) {
|
334 |
+
|
335 |
+
foreach ( (array) $value as $field_value ) {
|
336 |
+
$html .= '<input type="hidden" name="' . esc_attr( $key ) . '" value="' . esc_attr( $field_value ) . '" />';
|
337 |
+
}
|
338 |
+
}
|
339 |
+
|
340 |
+
return $html;
|
341 |
+
}
|
342 |
+
|
343 |
+
|
344 |
+
/**
|
345 |
+
* Returns the gateway hosted pay page parameters, if any
|
346 |
+
*
|
347 |
+
* @since 2.1.0
|
348 |
+
* @param WC_Order $order the order object
|
349 |
+
* @return array associative array of name-value parameters
|
350 |
+
*/
|
351 |
+
protected function get_hosted_pay_page_params( $order ) {
|
352 |
+
// stub method
|
353 |
+
return array();
|
354 |
+
}
|
355 |
+
|
356 |
+
|
357 |
+
/**
|
358 |
+
* Gets the hosted pay page url to redirect to, to allow the customer to
|
359 |
+
* remit payment. This is generally the bare URL, without any query params.
|
360 |
+
*
|
361 |
+
* This method may be called more than once during a single request.
|
362 |
+
*
|
363 |
+
* @since 2.1.0
|
364 |
+
* @see SV_WC_Payment_Gateway_Hosted::get_hosted_pay_page_params()
|
365 |
+
* @param WC_Order $order optional order object, defaults to null
|
366 |
+
* @return string hosted pay page url, or false if it could not be determined
|
367 |
+
*/
|
368 |
+
abstract public function get_hosted_pay_page_url( $order = null );
|
369 |
+
|
370 |
+
|
371 |
+
/**
|
372 |
+
* Handle a payment notification request.
|
373 |
+
*
|
374 |
+
* @since 4.3.0
|
375 |
+
*/
|
376 |
+
public function handle_transaction_response_request() {
|
377 |
+
|
378 |
+
$order = null;
|
379 |
+
$response = null;
|
380 |
+
|
381 |
+
try {
|
382 |
+
|
383 |
+
// get the transaction response object for the current request
|
384 |
+
$response = $this->get_transaction_response( $_REQUEST );
|
385 |
+
|
386 |
+
// log the request
|
387 |
+
$this->log_transaction_response_request( $response->to_string_safe() );
|
388 |
+
|
389 |
+
// get the associated order, or die trying
|
390 |
+
$order = $this->get_order_from_response( $response );
|
391 |
+
|
392 |
+
// Validate the response data such as order ID and payment status
|
393 |
+
$this->validate_transaction_response( $order, $response );
|
394 |
+
|
395 |
+
// Handle the order based on the response
|
396 |
+
$this->process_transaction_response( $order, $response );
|
397 |
+
|
398 |
+
} catch ( SV_WC_Payment_Gateway_Exception $e ) {
|
399 |
+
|
400 |
+
if ( $order && $order->needs_payment() ) {
|
401 |
+
$this->mark_order_as_failed( $order, $e->getMessage(), $response );
|
402 |
+
}
|
403 |
+
|
404 |
+
if ( $this->debug_log() ) {
|
405 |
+
|
406 |
+
$this->get_plugin()->log(
|
407 |
+
/* translators: Placeholders: %1$s - transaction request type such as IPN or Redirect-back, %2$s - the error message */
|
408 |
+
sprintf( '%1$s processing error: %2$s',
|
409 |
+
( $response && $response->is_ipn() ) ? 'IPN' : 'Redirect-back',
|
410 |
+
$e->getMessage()
|
411 |
+
), $this->get_id() );
|
412 |
+
}
|
413 |
+
|
414 |
+
$this->do_invalid_transaction_response( $order, $response );
|
415 |
+
}
|
416 |
+
}
|
417 |
+
|
418 |
+
|
419 |
+
/**
|
420 |
+
* Gets the order object with transaction data.
|
421 |
+
*
|
422 |
+
* @since 5.0.0
|
423 |
+
*
|
424 |
+
* @param SV_WC_Payment_Gateway_API_Payment_Notification_Response $response response object
|
425 |
+
* @return \WC_Order
|
426 |
+
*/
|
427 |
+
protected function get_order_from_response( $response ) {
|
428 |
+
|
429 |
+
$order = wc_get_order( $response->get_order_id() );
|
430 |
+
|
431 |
+
// If the order is invalid, bail
|
432 |
+
if ( ! $order ) {
|
433 |
+
|
434 |
+
throw new SV_WC_Payment_Gateway_Exception( sprintf(
|
435 |
+
/* translators: Placeholders: %s - a WooCommerce order ID */
|
436 |
+
__( 'Could not find order %s', 'woocommerce-gateway-paypal-powered-by-braintree' ),
|
437 |
+
$response->get_order_id()
|
438 |
+
) );
|
439 |
+
}
|
440 |
+
|
441 |
+
$order = $this->get_order( $order );
|
442 |
+
|
443 |
+
$order->payment->account_number = $response->get_account_number();
|
444 |
+
|
445 |
+
if ( self::PAYMENT_TYPE_CREDIT_CARD == $response->get_payment_type() ) {
|
446 |
+
|
447 |
+
$order->payment->exp_month = $response->get_exp_month();
|
448 |
+
$order->payment->exp_year = $response->get_exp_year();
|
449 |
+
$order->payment->card_type = $response->get_card_type();
|
450 |
+
|
451 |
+
} elseif ( self::PAYMENT_TYPE_ECHECK == $response->get_payment_type() ) {
|
452 |
+
|
453 |
+
$order->payment->account_type = $response->get_account_type();
|
454 |
+
$order->payment->check_number = $response->get_check_number();
|
455 |
+
}
|
456 |
+
|
457 |
+
return $order;
|
458 |
+
}
|
459 |
+
|
460 |
+
|
461 |
+
/**
|
462 |
+
* Gets the order object with payment data added.
|
463 |
+
*
|
464 |
+
* @since 5.0.0
|
465 |
+
* @see SV_WC_Payment_Gateway::get_order()
|
466 |
+
*
|
467 |
+
* @param int|\WC_Order $order_id order ID or object
|
468 |
+
* @return \WC_Order
|
469 |
+
*/
|
470 |
+
public function get_order( $order_id ) {
|
471 |
+
|
472 |
+
$order = parent::get_order( $order_id );
|
473 |
+
|
474 |
+
/**
|
475 |
+
* Filters the order object after adding gateway data.
|
476 |
+
*
|
477 |
+
* @since 5.0.0
|
478 |
+
*
|
479 |
+
* @param \WC_Order $order order object
|
480 |
+
* @param SV_WC_Payment_Gateway $gateway gateway object
|
481 |
+
*/
|
482 |
+
return apply_filters( 'wc_payment_gateway_' . $this->get_id() . '_get_order', $order, $this );
|
483 |
+
}
|
484 |
+
|
485 |
+
|
486 |
+
/**
|
487 |
+
* Validate a transaction response.
|
488 |
+
*
|
489 |
+
* @since 4.3.0
|
490 |
+
* @param \WC_Order $order the order object
|
491 |
+
* @param \SV_WC_Payment_Gateway_API_Payment_Notification_Response the response object
|
492 |
+
* @throws \SV_WC_Payment_Gateway_Exception
|
493 |
+
*/
|
494 |
+
protected function validate_transaction_response( $order, $response ) {
|
495 |
+
|
496 |
+
// If the order has already been completed, bail
|
497 |
+
if ( ! $order->needs_payment() ) {
|
498 |
+
|
499 |
+
/* translators: Placeholders: %s - payment gateway title (such as Authorize.net, Braintree, etc) */
|
500 |
+
$order->add_order_note( sprintf( esc_html__( '%s duplicate transaction received', 'woocommerce-gateway-paypal-powered-by-braintree' ), $this->get_method_title() ) );
|
501 |
+
|
502 |
+
throw new SV_WC_Payment_Gateway_Exception( sprintf(
|
503 |
+
__( 'Order %s is already paid for.', 'woocommerce-gateway-paypal-powered-by-braintree' ),
|
504 |
+
$order->get_order_number()
|
505 |
+
) );
|
506 |
+
}
|
507 |
+
}
|
508 |
+
|
509 |
+
|
510 |
+
/**
|
511 |
+
* Process the transaction response for the given order
|
512 |
+
*
|
513 |
+
* @since 2.1.0
|
514 |
+
*
|
515 |
+
* @param \WC_Order $order the order
|
516 |
+
* @param SV_WC_Payment_Gateway_API_Payment_Notification_Response transaction response
|
517 |
+
*/
|
518 |
+
protected function process_transaction_response( $order, $response ) {
|
519 |
+
|
520 |
+
if ( $response->transaction_approved() || $response->transaction_held() ) {
|
521 |
+
|
522 |
+
// if tokenization is supported, process any token data that might have come back in the response
|
523 |
+
if ( $this->supports_tokenization() && $this->tokenization_enabled() && $response instanceof SV_WC_Payment_Gateway_Payment_Notification_Tokenization_Response ) {
|
524 |
+
$order = $this->process_tokenization_response( $order, $response );
|
525 |
+
}
|
526 |
+
|
527 |
+
// always add transasaction data to the order for approved and held transactions
|
528 |
+
$this->add_transaction_data( $order, $response );
|
529 |
+
|
530 |
+
// let gateways easily add their own data
|
531 |
+
$this->add_payment_gateway_transaction_data( $order, $response );
|
532 |
+
|
533 |
+
// handle the order status, etc...
|
534 |
+
$this->complete_payment( $order, $response );
|
535 |
+
|
536 |
+
// do the final transaction action, like a redirect
|
537 |
+
if ( $response->transaction_approved() ) {
|
538 |
+
$this->do_transaction_approved( $order, $response );
|
539 |
+
} elseif ( $response->transaction_held() ) {
|
540 |
+
$this->do_transaction_held( $order, $response );
|
541 |
+
}
|
542 |
+
|
543 |
+
} elseif ( $response->transaction_cancelled() ) {
|
544 |
+
|
545 |
+
$this->mark_order_as_cancelled( $order, $response->get_status_message(), $response );
|
546 |
+
|
547 |
+
$this->do_transaction_cancelled( $order, $response );
|
548 |
+
|
549 |
+
} else {
|
550 |
+
|
551 |
+
// Add the order note and debug info
|
552 |
+
$this->do_transaction_failed_result( $order, $response );
|
553 |
+
|
554 |
+
$this->do_transaction_failed( $order, $response );
|
555 |
+
}
|
556 |
+
}
|
557 |
+
|
558 |
+
|
559 |
+
/**
|
560 |
+
* Processes a transaction response's token data, if any.
|
561 |
+
*
|
562 |
+
* @since 5.0.0
|
563 |
+
*
|
564 |
+
* @param \WC_Order $order order object
|
565 |
+
* @param SV_WC_Payment_Gateway_Payment_Notification_Tokenization_Response $response response object
|
566 |
+
* @return \WC_Order order object
|
567 |
+
*/
|
568 |
+
protected function process_tokenization_response( \WC_Order $order, $response ) {
|
569 |
+
|
570 |
+
if ( is_callable( array( $response, 'get_customer_id' ) ) && $response->get_customer_id() ) {
|
571 |
+
$order->customer_id = $response->get_customer_id();
|
572 |
+
}
|
573 |
+
|
574 |
+
$token = $response->get_payment_token();
|
575 |
+
|
576 |
+
if ( $order->get_user_id() ) {
|
577 |
+
|
578 |
+
if ( $response->payment_method_tokenized() ) {
|
579 |
+
|
580 |
+
if ( $response->tokenization_successful() && $this->get_payment_tokens_handler()->add_token( $order->get_user_id(), $token ) ) {
|
581 |
+
|
582 |
+
// order note based on gateway type
|
583 |
+
if ( $token->is_credit_card() ) {
|
584 |
+
|
585 |
+
/* translators: Placeholders: %1$s - payment gateway title (such as Authorize.net, Braintree, etc), %2$s - payment method name (mastercard, bank account, etc), %3$s - last four digits of the card/account, %4$s - card/account expiry date */
|
586 |
+
$order->add_order_note( sprintf( __( '%1$s Payment Method Saved: %2$s ending in %3$s (expires %4$s)', 'woocommerce-gateway-paypal-powered-by-braintree' ),
|
587 |
+
$this->get_method_title(),
|
588 |
+
$token->get_type_full(),
|
589 |
+
$token->get_last_four(),
|
590 |
+
$token->get_exp_date()
|
591 |
+
) );
|
592 |
+
|
593 |
+
} elseif ( $token->is_echeck() ) {
|
594 |
+
|
595 |
+
// account type (checking/savings) may or may not be available, which is fine
|
596 |
+
/* translators: Placeholders: %1$s - payment gateway title (such as CyberSouce, NETbilling, etc), %2$s - account type (checking/savings - may or may not be available), %3$s - last four digits of the account */
|
597 |
+
$order->add_order_note( sprintf( __( '%1$s eCheck Payment Method Saved: %2$s account ending in %3$s', 'woocommerce-gateway-paypal-powered-by-braintree' ),
|
598 |
+
$this->get_method_title(),
|
599 |
+
$token->get_account_type(),
|
600 |
+
$token->get_last_four()
|
601 |
+
) );
|
602 |
+
|
603 |
+
} else {
|
604 |
+
|
605 |
+
/* translators: Placeholders: %s - payment gateway title (such as CyberSouce, NETbilling, etc) */
|
606 |
+
$order->add_order_note( sprintf( __( '%s Payment Method Saved', 'woocommerce-gateway-paypal-powered-by-braintree' ),
|
607 |
+
$this->get_method_title()
|
608 |
+
) );
|
609 |
+
}
|
610 |
+
|
611 |
+
} else {
|
612 |
+
|
613 |
+
$message = sprintf(
|
614 |
+
/* translators: Placeholders: %s - a failed tokenization API error */
|
615 |
+
__( 'Tokenization failed. %s', 'woocommerce-gateway-paypal-powered-by-braintree' ),
|
616 |
+
$response->get_tokenization_message()
|
617 |
+
);
|
618 |
+
|
619 |
+
$this->mark_order_as_held( $order, $message, $response );
|
620 |
+
}
|
621 |
+
}
|
622 |
+
|
623 |
+
// get a fresh copy of the token object just in case the response doesn't include all of the method details
|
624 |
+
$token = $this->get_payment_tokens_handler()->get_token( $order->get_user_id(), $token->get_id() );
|
625 |
+
}
|
626 |
+
|
627 |
+
// add the payment method order data
|
628 |
+
if ( $token ) {
|
629 |
+
|
630 |
+
$order->payment->token = $token->get_id();
|
631 |
+
$order->payment->account_number = $token->get_last_four();
|
632 |
+
$order->payment->last_four = $token->get_last_four();
|
633 |
+
|
634 |
+
if ( $token->is_credit_card() ) {
|
635 |
+
|
636 |
+
$order->payment->exp_month = $token->get_exp_month();
|
637 |
+
$order->payment->exp_year = $token->get_exp_year();
|
638 |
+
$order->payment->card_type = $token->get_card_type();
|
639 |
+
|
640 |
+
} elseif ( $token->is_echeck() ) {
|
641 |
+
|
642 |
+
$order->payment->account_type = $token->get_account_type();
|
643 |
+
$order->payment->check_number = $token->get_check_number();
|
644 |
+
}
|
645 |
+
}
|
646 |
+
|
647 |
+
// remove any tokens that were deleted on the hosted pay page
|
648 |
+
foreach ( $response->get_deleted_payment_tokens() as $token_id ) {
|
649 |
+
|
650 |
+
$tokens = $this->get_payment_tokens_handler()->get_tokens( $order->get_user_id() );
|
651 |
+
|
652 |
+
unset( $tokens[ $token_id ] );
|
653 |
+
|
654 |
+
$this->get_payment_tokens_handler()->update_tokens( $order->get_user_id(), $tokens );
|
655 |
+
}
|
656 |
+
|
657 |
+
return $order;
|
658 |
+
}
|
659 |
+
|
660 |
+
|
661 |
+
/**
|
662 |
+
* Adds an order note, along with anything else required after an approved
|
663 |
+
* transaction. This is a generic, default approved handler.
|
664 |
+
*
|
665 |
+
* @since 2.1.0
|
666 |
+
*
|
667 |
+
* @param \WC_Order $order the order object
|
668 |
+
* @param \WC_Paytrail_API_Payment_Response $response the response object
|
669 |
+
*/
|
670 |
+
protected function do_transaction_approved( \WC_Order $order, $response ) {
|
671 |
+
|
672 |
+
// Die or redirect
|
673 |
+
if ( $response->is_ipn() ) {
|
674 |
+
|
675 |
+
status_header( 200 );
|
676 |
+
die;
|
677 |
+
|
678 |
+
} else {
|
679 |
+
|
680 |
+
wp_redirect( $this->get_return_url( $order ) );
|
681 |
+
exit;
|
682 |
+
}
|
683 |
+
}
|
684 |
+
|
685 |
+
|
686 |
+
/**
|
687 |
+
* Handle a held transaction response.
|
688 |
+
*
|
689 |
+
* @since 4.3.0
|
690 |
+
*
|
691 |
+
* @param \WC_Order $order the order object
|
692 |
+
* @param \SV_WC_Payment_Gateway_API_Payment_Notification_Response $response the response object
|
693 |
+
*/
|
694 |
+
protected function do_transaction_held( \WC_Order $order, $response ) {
|
695 |
+
|
696 |
+
if ( $response->is_ipn() ) {
|
697 |
+
|
698 |
+
status_header( 200 );
|
699 |
+
die;
|
700 |
+
|
701 |
+
} else {
|
702 |
+
|
703 |
+
wp_redirect( $this->get_return_url( $order ) );
|
704 |
+
exit;
|
705 |
+
}
|
706 |
+
}
|
707 |
+
|
708 |
+
|
709 |
+
/**
|
710 |
+
* Handle a cancelled transaction response.
|
711 |
+
*
|
712 |
+
* @since 4.3.0
|
713 |
+
*
|
714 |
+
* @param \WC_Order $order the order object
|
715 |
+
* @param \SV_WC_Payment_Gateway_API_Payment_Notification_Response $response the response object
|
716 |
+
*/
|
717 |
+
protected function do_transaction_cancelled( \WC_Order $order, $response ) {
|
718 |
+
|
719 |
+
if ( $response->is_ipn() ) {
|
720 |
+
|
721 |
+
status_header( 200 );
|
722 |
+
die;
|
723 |
+
|
724 |
+
} else {
|
725 |
+
|
726 |
+
wp_redirect( $order->get_cancel_order_url() );
|
727 |
+
exit;
|
728 |
+
}
|
729 |
+
}
|
730 |
+
|
731 |
+
|
732 |
+
/**
|
733 |
+
* Handle a failed transaction response.
|
734 |
+
*
|
735 |
+
* @since 4.3.0
|
736 |
+
*
|
737 |
+
* @param \WC_Order $order the order object
|
738 |
+
* @param \SV_WC_Payment_Gateway_API_Payment_Notification_Response $response the response object
|
739 |
+
*/
|
740 |
+
protected function do_transaction_failed( \WC_Order $order, $response ) {
|
741 |
+
|
742 |
+
if ( $response->is_ipn() ) {
|
743 |
+
|
744 |
+
status_header( 200 );
|
745 |
+
die;
|
746 |
+
|
747 |
+
} else {
|
748 |
+
|
749 |
+
wp_redirect( $order->get_checkout_payment_url( $this->use_form_post() && ! $this->use_auto_form_post() ) );
|
750 |
+
exit;
|
751 |
+
}
|
752 |
+
}
|
753 |
+
|
754 |
+
|
755 |
+
/**
|
756 |
+
* Handle an invalid transaction response.
|
757 |
+
*
|
758 |
+
* i.e. the order has already been paid or was not found
|
759 |
+
*
|
760 |
+
* @since 4.3.0
|
761 |
+
* @param \WC_Order $order Optional. The order object
|
762 |
+
* @param \SV_WC_Payment_Gateway_API_Payment_Notification_Response $response the response object
|
763 |
+
*/
|
764 |
+
protected function do_invalid_transaction_response( $order = null, $response ) {
|
765 |
+
|
766 |
+
if ( $response->is_ipn() ) {
|
767 |
+
|
768 |
+
status_header( 200 );
|
769 |
+
die();
|
770 |
+
|
771 |
+
} else {
|
772 |
+
|
773 |
+
if ( $order ) {
|
774 |
+
wp_redirect( $this->get_return_url( $order ) );
|
775 |
+
exit;
|
776 |
+
} else {
|
777 |
+
wp_redirect( get_home_url( null, '' ) );
|
778 |
+
exit;
|
779 |
+
}
|
780 |
+
}
|
781 |
+
}
|
782 |
+
|
783 |
+
|
784 |
+
/**
|
785 |
+
* Returns an API response object for the current response request
|
786 |
+
*
|
787 |
+
* @since 2.1.0
|
788 |
+
* @param array $request_response_data the current request response data
|
789 |
+
* @return SV_WC_Payment_Gateway_API_Payment_Notification_Response the response object
|
790 |
+
*/
|
791 |
+
abstract protected function get_transaction_response( $request_response_data );
|
792 |
+
|
793 |
+
|
794 |
+
/** Helper methods ******************************************************/
|
795 |
+
|
796 |
+
|
797 |
+
/**
|
798 |
+
* Returns the WC API URL for this gateway, based on the current protocol
|
799 |
+
*
|
800 |
+
* @since 2.1.0
|
801 |
+
* @return string the WC API URL for this server
|
802 |
+
*/
|
803 |
+
public function get_transaction_response_handler_url() {
|
804 |
+
|
805 |
+
if ( $this->transaction_response_handler_url ) {
|
806 |
+
return $this->transaction_response_handler_url;
|
807 |
+
}
|
808 |
+
|
809 |
+
$this->transaction_response_handler_url = add_query_arg( 'wc-api', get_class( $this ), home_url( '/' ) );
|
810 |
+
|
811 |
+
// make ssl if needed
|
812 |
+
if ( wc_checkout_is_https() ) {
|
813 |
+
$this->transaction_response_handler_url = str_replace( 'http:', 'https:', $this->transaction_response_handler_url );
|
814 |
+
}
|
815 |
+
|
816 |
+
return $this->transaction_response_handler_url;
|
817 |
+
}
|
818 |
+
|
819 |
+
|
820 |
+
/**
|
821 |
+
* Returns true if currently doing a transaction response request
|
822 |
+
*
|
823 |
+
* @since 2.1.0
|
824 |
+
* @return boolean true if currently doing a transaction response request
|
825 |
+
*/
|
826 |
+
public function doing_transaction_response_handler() {
|
827 |
+
return isset( $_REQUEST['wc-api'] ) && get_class( $this ) == $_REQUEST['wc-api'];
|
828 |
+
}
|
829 |
+
|
830 |
+
|
831 |
+
/**
|
832 |
+
* Log pay page form submission request
|
833 |
+
*
|
834 |
+
* @since 2.1.0
|
835 |
+
* @param array $request the request data associative array, which should
|
836 |
+
* include members 'method', 'uri', 'body'
|
837 |
+
* @param object $response optional response object
|
838 |
+
*/
|
839 |
+
public function log_hosted_pay_page_request( $request ) {
|
840 |
+
|
841 |
+
$this->add_debug_message(
|
842 |
+
sprintf( "Request Method: %s\nRequest URI: %s\nRequest Body: %s",
|
843 |
+
$request['method'],
|
844 |
+
$request['uri'],
|
845 |
+
$request['body']
|
846 |
+
),
|
847 |
+
'message'
|
848 |
+
);
|
849 |
+
}
|
850 |
+
|
851 |
+
|
852 |
+
/**
|
853 |
+
* Log IPN/redirect-back transaction response request to the log file
|
854 |
+
*
|
855 |
+
* @since 2.1.0
|
856 |
+
* @param array $response the request data
|
857 |
+
* @param string $message optional message string with a %s to hold the
|
858 |
+
* response data. Defaults to 'Request %s'
|
859 |
+
* $response
|
860 |
+
*/
|
861 |
+
public function log_transaction_response_request( $response, $message = null ) {
|
862 |
+
|
863 |
+
// add log message to WC logger if log/both is enabled
|
864 |
+
if ( $this->debug_log() ) {
|
865 |
+
|
866 |
+
// if a message wasn't provided, make our best effort
|
867 |
+
if ( is_null( $message ) ) {
|
868 |
+
$message = 'Request: %s';
|
869 |
+
}
|
870 |
+
|
871 |
+
$this->get_plugin()->log( sprintf( $message, print_r( $response, true ) ), $this->get_id() );
|
872 |
+
}
|
873 |
+
}
|
874 |
+
|
875 |
+
|
876 |
+
/** Getters ******************************************************/
|
877 |
+
|
878 |
+
|
879 |
+
/**
|
880 |
+
* Returns true if this is a hosted type gateway
|
881 |
+
*
|
882 |
+
* @since 1.0.0
|
883 |
+
* @return boolean true if this is a hosted payment gateway
|
884 |
+
*/
|
885 |
+
public function is_hosted_gateway() {
|
886 |
+
return true;
|
887 |
+
}
|
888 |
+
|
889 |
+
|
890 |
+
/**
|
891 |
+
* Returns true if this gateway uses a form-post from the pay
|
892 |
+
* page to "redirect" to a hosted payment page
|
893 |
+
*
|
894 |
+
* @since 2.1.0
|
895 |
+
* @return boolean true if this gateway uses a form post, false if it
|
896 |
+
* redirects directly to the hosted pay page from checkout
|
897 |
+
*/
|
898 |
+
public function use_form_post() {
|
899 |
+
return false;
|
900 |
+
}
|
901 |
+
|
902 |
+
|
903 |
+
/**
|
904 |
+
* Returns true if this gateway uses an automatic form-post from the pay
|
905 |
+
* page to "redirect" to the hosted payment page where payment information
|
906 |
+
* is securely entered. Return false if payment information is collected
|
907 |
+
* on the pay page and then posted to a remote server.
|
908 |
+
*
|
909 |
+
* This method has no effect if use_form_post() returns false
|
910 |
+
*
|
911 |
+
* @since 2.2.0
|
912 |
+
* @see SV_WC_Payment_Gateway_Hosted::use_form_post()
|
913 |
+
* @return boolean true if this gateway automatically posts to the remote
|
914 |
+
* processor server from the pay page
|
915 |
+
*/
|
916 |
+
public function use_auto_form_post() {
|
917 |
+
return $this->use_form_post() && true;
|
918 |
+
}
|
919 |
+
|
920 |
+
}
|
921 |
+
|
922 |
+
endif; // class exists check
|
lib/skyverge/woocommerce/payment-gateway/class-sv-wc-payment-gateway-my-payment-methods.php
CHANGED
@@ -18,15 +18,15 @@
|
|
18 |
*
|
19 |
* @package SkyVerge/WooCommerce/Payment-Gateway/Classes
|
20 |
* @author SkyVerge
|
21 |
-
* @copyright Copyright (c) 2013-
|
22 |
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
|
23 |
*/
|
24 |
|
25 |
-
namespace
|
26 |
|
27 |
defined( 'ABSPATH' ) or exit;
|
28 |
|
29 |
-
if ( ! class_exists( '
|
30 |
|
31 |
/**
|
32 |
* My Payment Methods Class
|
@@ -67,22 +67,35 @@ class SV_WC_Payment_Gateway_My_Payment_Methods {
|
|
67 |
|
68 |
$this->plugin = $plugin;
|
69 |
|
70 |
-
|
71 |
-
$this->load_tokens();
|
72 |
|
73 |
-
|
|
|
|
|
74 |
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
|
|
|
|
|
|
|
|
81 |
}
|
82 |
|
|
|
|
|
|
|
83 |
// styles/scripts
|
84 |
add_action( 'wp_enqueue_scripts', array( $this, 'maybe_enqueue_styles_scripts' ) );
|
85 |
|
|
|
|
|
|
|
|
|
|
|
86 |
// handle payment method deletion, etc.
|
87 |
$this->handle_payment_method_actions();
|
88 |
}
|
@@ -97,32 +110,14 @@ class SV_WC_Payment_Gateway_My_Payment_Methods {
|
|
97 |
|
98 |
$handle = 'sv-wc-payment-gateway-my-payment-methods';
|
99 |
|
100 |
-
wp_enqueue_style( $handle, $this->get_plugin()->get_payment_gateway_framework_assets_url() . '/css/frontend/' . $handle . '.min.css', array(), SV_WC_Plugin::VERSION );
|
101 |
-
|
102 |
-
wp_enqueue_style( 'dashicons' );
|
103 |
-
|
104 |
// if there are tokens to display, add the custom JS
|
105 |
if ( $this->has_tokens ) {
|
106 |
|
107 |
-
|
108 |
-
// TODO: remove this when we fully support the core payment methods table {CW 2016-05-17}
|
109 |
-
if ( SV_WC_Plugin_Compatibility::is_wc_version_gte_2_6() && ! (bool) wc_get_customer_saved_methods_list( get_current_user_id() ) ) {
|
110 |
-
wc_enqueue_js( '$( "table.wc-' . $this->get_plugin()->get_id_dasherized() . '-my-payment-methods" ).prev( ".woocommerce-Message.woocommerce-Message--info" ).hide();' );
|
111 |
-
}
|
112 |
-
|
113 |
-
wp_enqueue_script( 'jquery-tiptip', WC()->plugin_url() . '/assets/js/jquery-tiptip/jquery.tipTip.min.js', array( 'jquery' ), WC_VERSION, true );
|
114 |
-
|
115 |
-
// add confirm javascript when deleting payment methods
|
116 |
-
wc_enqueue_js( '
|
117 |
|
118 |
-
|
119 |
|
120 |
-
|
121 |
-
if ( $( this ).hasClass( "disabled" ) || ! confirm( "' . esc_js( /* translators: Payment method as in a specific credit card, e-check or bank account */ esc_html__( 'Are you sure you want to delete this payment method?', 'woocommerce-gateway-paypal-powered-by-braintree' ) ) . '" ) ) {
|
122 |
-
e.preventDefault();
|
123 |
-
}
|
124 |
-
} );
|
125 |
-
' );
|
126 |
}
|
127 |
}
|
128 |
|
@@ -167,7 +162,13 @@ class SV_WC_Payment_Gateway_My_Payment_Methods {
|
|
167 |
}
|
168 |
}
|
169 |
|
170 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
171 |
}
|
172 |
|
173 |
|
@@ -207,30 +208,57 @@ class SV_WC_Payment_Gateway_My_Payment_Methods {
|
|
207 |
|
208 |
|
209 |
/**
|
210 |
-
*
|
211 |
*
|
212 |
-
* @since
|
213 |
*/
|
214 |
-
public function
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
|
|
|
|
|
|
|
|
|
|
224 |
|
225 |
-
|
226 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
227 |
|
228 |
-
} else {
|
229 |
|
230 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
231 |
|
232 |
-
|
233 |
-
}
|
234 |
}
|
235 |
|
236 |
|
@@ -356,8 +384,7 @@ class SV_WC_Payment_Gateway_My_Payment_Methods {
|
|
356 |
$html = '<thead><tr>';
|
357 |
|
358 |
foreach ( $this->get_table_headers() as $key => $title ) {
|
359 |
-
|
360 |
-
$html .= sprintf( '<th class="sv-wc-payment-gateway-my-payment-method-table-header wc-%s-payment-method-%s"><span class="nobr">%s</span></th>', sanitize_html_class( $this->get_plugin()->get_id_dasherized() ), sanitize_html_class( $key ), esc_html( $title ) );
|
361 |
}
|
362 |
|
363 |
$html .= '</tr></thead>';
|
@@ -384,9 +411,11 @@ class SV_WC_Payment_Gateway_My_Payment_Methods {
|
|
384 |
protected function get_table_headers() {
|
385 |
|
386 |
$headers = array(
|
387 |
-
'title' =>
|
388 |
-
'
|
389 |
-
'
|
|
|
|
|
390 |
);
|
391 |
|
392 |
/**
|
@@ -418,14 +447,20 @@ class SV_WC_Payment_Gateway_My_Payment_Methods {
|
|
418 |
|
419 |
if ( $this->credit_card_tokens && $this->echeck_tokens ) {
|
420 |
|
421 |
-
$html .= sprintf(
|
422 |
-
|
|
|
|
|
|
|
423 |
);
|
424 |
|
425 |
$html .= $this->get_table_body_row_html( $this->credit_card_tokens );
|
426 |
|
427 |
-
$html .= sprintf(
|
428 |
-
|
|
|
|
|
|
|
429 |
);
|
430 |
|
431 |
$html .= $this->get_table_body_row_html( $this->echeck_tokens );
|
@@ -467,7 +502,12 @@ class SV_WC_Payment_Gateway_My_Payment_Methods {
|
|
467 |
|
468 |
$method = $this->get_table_body_row_data( $token );
|
469 |
|
470 |
-
$html .= sprintf(
|
|
|
|
|
|
|
|
|
|
|
471 |
|
472 |
// Display the row data in the order of the headers
|
473 |
foreach ( $headers as $attribute => $attribute_title ) {
|
@@ -509,109 +549,285 @@ class SV_WC_Payment_Gateway_My_Payment_Methods {
|
|
509 |
*/
|
510 |
protected function get_table_body_row_data( $token ) {
|
511 |
|
512 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
513 |
|
514 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
515 |
|
516 |
-
|
517 |
-
|
518 |
|
519 |
-
|
520 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
521 |
|
522 |
$classes[] = 'tip';
|
523 |
|
524 |
-
$attributes['title'] = $
|
525 |
}
|
526 |
|
527 |
-
//
|
528 |
foreach ( $attributes as $attribute => $value ) {
|
529 |
$attributes[] = esc_attr( $attribute ) . '="' . esc_attr( $value ) . '"';
|
530 |
unset( $attributes[ $attribute ] );
|
531 |
}
|
532 |
|
533 |
-
//
|
534 |
$actions[] = sprintf(
|
535 |
( in_array( 'disabled', $classes ) ) ? '<a class="button %2$s" %3$s>%4$s</a>' : '<a href="%1$s" class="button %2$s" %3$s>%4$s</a>',
|
536 |
-
esc_url( $
|
537 |
implode( ' ', array_map( 'sanitize_html_class', $classes ) ),
|
538 |
implode( ' ', $attributes ),
|
539 |
-
esc_html( $
|
540 |
);
|
541 |
}
|
542 |
|
543 |
-
$
|
544 |
-
'title' => $this->get_payment_method_title( $token ),
|
545 |
-
'actions' => implode( '', $actions ),
|
546 |
-
);
|
547 |
-
|
548 |
-
// Add the expiration date if applicable
|
549 |
-
if ( $token->get_exp_month() && $token->get_exp_year() ) {
|
550 |
-
$method['expiry'] = esc_html( $token->get_exp_date() );
|
551 |
-
}
|
552 |
|
553 |
/**
|
554 |
-
*
|
555 |
*
|
556 |
-
*
|
557 |
*
|
558 |
-
* @
|
559 |
-
* @param
|
560 |
-
* @type string $title payment method title
|
561 |
-
* @type string $expiry payment method expiry
|
562 |
-
* @type string $actions actions for payment method
|
563 |
-
* }
|
564 |
-
* @param array $token simple array of SV_WC_Payment_Gateway_Payment_Token objects
|
565 |
-
* @param \SV_WC_Payment_Gateway_My_Payment_Methods $this instance
|
566 |
*/
|
567 |
-
return apply_filters( 'wc_' . $this->get_plugin()->get_id() . '
|
568 |
}
|
569 |
|
570 |
|
571 |
/**
|
572 |
-
*
|
573 |
-
*
|
574 |
-
* `make-default` - available if the token isn't already the default token
|
575 |
-
* `delete` - delete the token
|
576 |
*
|
577 |
* @since 4.0.0
|
578 |
-
*
|
579 |
-
* @
|
|
|
580 |
*/
|
581 |
protected function get_payment_method_actions( $token ) {
|
582 |
|
583 |
-
$actions = array(
|
|
|
|
|
|
|
|
|
584 |
|
585 |
-
|
586 |
-
if ( ! $token->is_default() ) {
|
587 |
|
588 |
-
$
|
589 |
-
|
590 |
-
|
591 |
-
|
592 |
-
|
593 |
-
|
594 |
-
|
595 |
-
'
|
|
|
596 |
);
|
597 |
}
|
598 |
|
599 |
-
// delete
|
600 |
-
$actions['delete'] = array(
|
601 |
-
'url' => wp_nonce_url( add_query_arg( array(
|
602 |
-
'wc-' . $this->get_plugin()->get_id_dasherized() . '-token' => $token->get_id(),
|
603 |
-
'wc-' . $this->get_plugin()->get_id_dasherized() . '-action' => 'delete'
|
604 |
-
) ), 'wc-' . $this->get_plugin()->get_id_dasherized() . '-token-action' ),
|
605 |
-
'class' => array( 'delete-payment-method' ),
|
606 |
-
'name' => esc_html__( 'Delete', 'woocommerce-gateway-paypal-powered-by-braintree' ),
|
607 |
-
);
|
608 |
-
|
609 |
/**
|
610 |
* My Payment Methods Table Method Actions Filter.
|
611 |
*
|
612 |
* Allow actors to modify the table method actions.
|
613 |
*
|
614 |
* @since 4.0.0
|
|
|
615 |
* @param $actions array {
|
616 |
* @type string $url action URL
|
617 |
* @type string $class action button class
|
@@ -624,60 +840,99 @@ class SV_WC_Payment_Gateway_My_Payment_Methods {
|
|
624 |
}
|
625 |
|
626 |
|
|
|
|
|
|
|
627 |
/**
|
628 |
-
*
|
629 |
*
|
630 |
-
*
|
631 |
*
|
632 |
-
* @since
|
633 |
-
* @param SV_WC_Payment_Gateway_Payment_Token $token token
|
634 |
-
* @return string payment method title
|
635 |
*/
|
636 |
-
|
637 |
|
638 |
-
|
639 |
-
$last_four = $token->get_last_four();
|
640 |
-
$type = $token->get_type_full();
|
641 |
|
642 |
-
|
643 |
|
644 |
-
|
645 |
-
$title = sprintf( '<img src="%1$s" alt="%2$s" title="%2$s" width="40" height="25" />%3$s', esc_url( $image_url ), esc_attr__( $type, 'woocommerce-gateway-paypal-powered-by-braintree' ), esc_html__( $type, 'woocommerce-gateway-paypal-powered-by-braintree' ) );
|
646 |
|
647 |
-
|
648 |
|
649 |
-
|
650 |
-
|
651 |
-
|
652 |
|
653 |
-
|
654 |
-
|
|
|
655 |
|
656 |
-
|
657 |
-
|
658 |
-
|
|
|
659 |
|
660 |
-
|
661 |
-
if ( $token->is_default() ) {
|
662 |
|
663 |
-
|
664 |
-
}
|
665 |
|
666 |
-
|
667 |
-
|
668 |
-
|
669 |
-
|
670 |
-
|
671 |
-
|
672 |
-
|
673 |
-
|
674 |
-
|
675 |
-
|
676 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
677 |
}
|
678 |
|
679 |
|
680 |
-
/**
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
681 |
|
682 |
|
683 |
/**
|
@@ -733,16 +988,18 @@ class SV_WC_Payment_Gateway_My_Payment_Methods {
|
|
733 |
|
734 |
/* translators: Payment method as in a specific credit card, e-check or bank account */
|
735 |
SV_WC_Helper::wc_add_notice( esc_html__( 'Payment method deleted.', 'woocommerce-gateway-paypal-powered-by-braintree' ) );
|
736 |
-
}
|
737 |
|
738 |
-
|
739 |
-
|
740 |
-
|
741 |
-
|
742 |
-
|
|
|
|
|
|
|
|
|
|
|
743 |
|
744 |
-
/* translators: Payment method as in a specific credit card, e-check or bank account */
|
745 |
-
SV_WC_Helper::wc_add_notice( esc_html__( 'Default payment method updated.', 'woocommerce-gateway-paypal-powered-by-braintree' ) );
|
746 |
break;
|
747 |
|
748 |
// custom actions
|
@@ -772,13 +1029,7 @@ class SV_WC_Payment_Gateway_My_Payment_Methods {
|
|
772 |
*/
|
773 |
protected function redirect_to_my_account() {
|
774 |
|
775 |
-
|
776 |
-
$url = wc_get_page_permalink( 'myaccount' );
|
777 |
-
} else {
|
778 |
-
$url = wc_get_account_endpoint_url( 'payment-methods' );
|
779 |
-
}
|
780 |
-
|
781 |
-
wp_redirect( $url );
|
782 |
exit;
|
783 |
}
|
784 |
|
@@ -788,7 +1039,7 @@ class SV_WC_Payment_Gateway_My_Payment_Methods {
|
|
788 |
* using filters
|
789 |
*
|
790 |
* @since 4.0.0
|
791 |
-
* @return \
|
792 |
*/
|
793 |
public function get_plugin() {
|
794 |
return $this->plugin;
|
@@ -815,6 +1066,20 @@ class SV_WC_Payment_Gateway_My_Payment_Methods {
|
|
815 |
}
|
816 |
|
817 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
818 |
}
|
819 |
|
820 |
endif; // class exists check
|
18 |
*
|
19 |
* @package SkyVerge/WooCommerce/Payment-Gateway/Classes
|
20 |
* @author SkyVerge
|
21 |
+
* @copyright Copyright (c) 2013-2018, SkyVerge, Inc.
|
22 |
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
|
23 |
*/
|
24 |
|
25 |
+
namespace WC_Braintree\Plugin_Framework;
|
26 |
|
27 |
defined( 'ABSPATH' ) or exit;
|
28 |
|
29 |
+
if ( ! class_exists( '\\WC_Braintree\\Plugin_Framework\\SV_WC_Payment_Gateway_My_Payment_Methods' ) ) :
|
30 |
|
31 |
/**
|
32 |
* My Payment Methods Class
|
67 |
|
68 |
$this->plugin = $plugin;
|
69 |
|
70 |
+
add_action( 'wp', array( $this, 'init' ) );
|
|
|
71 |
|
72 |
+
// save a payment method via AJAX
|
73 |
+
add_action( 'wp_ajax_wc_' . $this->get_plugin()->get_id() . '_save_payment_method', array( $this, 'ajax_save_payment_method' ) );
|
74 |
+
}
|
75 |
|
76 |
+
|
77 |
+
/**
|
78 |
+
* Initializes the My Payment Methods table
|
79 |
+
*
|
80 |
+
* @since 5.1.0
|
81 |
+
*/
|
82 |
+
public function init() {
|
83 |
+
|
84 |
+
if ( ! $this->is_payment_methods_page() ) {
|
85 |
+
return;
|
86 |
}
|
87 |
|
88 |
+
// load all tokens for the given plugin
|
89 |
+
$this->load_tokens();
|
90 |
+
|
91 |
// styles/scripts
|
92 |
add_action( 'wp_enqueue_scripts', array( $this, 'maybe_enqueue_styles_scripts' ) );
|
93 |
|
94 |
+
// render the My Payment Methods section
|
95 |
+
// TODO: merge our payment methods data into the core table and remove this in a future version {CW 2016-05-17}
|
96 |
+
add_action( 'woocommerce_after_account_payment_methods', array( $this, 'render' ) );
|
97 |
+
add_action( 'woocommerce_after_account_payment_methods', array( $this, 'render_js' ) );
|
98 |
+
|
99 |
// handle payment method deletion, etc.
|
100 |
$this->handle_payment_method_actions();
|
101 |
}
|
110 |
|
111 |
$handle = 'sv-wc-payment-gateway-my-payment-methods';
|
112 |
|
|
|
|
|
|
|
|
|
113 |
// if there are tokens to display, add the custom JS
|
114 |
if ( $this->has_tokens ) {
|
115 |
|
116 |
+
wp_register_script( 'jquery-tiptip', WC()->plugin_url() . '/assets/js/jquery-tiptip/jquery.tipTip.min.js', array( 'jquery' ), WC_VERSION, true );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
117 |
|
118 |
+
wp_enqueue_style( $handle, $this->get_plugin()->get_payment_gateway_framework_assets_url() . '/css/frontend/' . $handle . '.min.css', array( 'dashicons' ), SV_WC_Plugin::VERSION );
|
119 |
|
120 |
+
wp_enqueue_script( $handle, $this->get_plugin()->get_payment_gateway_framework_assets_url() . '/js/frontend/' . $handle . '.min.js', array( 'jquery-tiptip', 'jquery' ), SV_WC_Plugin::VERSION );
|
|
|
|
|
|
|
|
|
|
|
121 |
}
|
122 |
}
|
123 |
|
162 |
}
|
163 |
}
|
164 |
|
165 |
+
// we don't use array_merge here since the indexes could be numeric
|
166 |
+
// and cause the indexes to be reset
|
167 |
+
$this->tokens = $this->credit_card_tokens + $this->echeck_tokens;
|
168 |
+
|
169 |
+
$this->has_tokens = ! empty( $this->tokens );
|
170 |
+
|
171 |
+
return $this->tokens;
|
172 |
}
|
173 |
|
174 |
|
208 |
|
209 |
|
210 |
/**
|
211 |
+
* Renders the JavaScript.
|
212 |
*
|
213 |
+
* @since 5.1.0
|
214 |
*/
|
215 |
+
public function render_js() {
|
216 |
+
|
217 |
+
$args = array(
|
218 |
+
'id' => $this->get_plugin()->get_id(),
|
219 |
+
'slug' => $this->get_plugin()->get_id_dasherized(),
|
220 |
+
'has_core_tokens' => (bool) wc_get_customer_saved_methods_list( get_current_user_id() ),
|
221 |
+
'ajax_url' => admin_url( 'admin-ajax.php' ),
|
222 |
+
'ajax_nonce' => wp_create_nonce( 'wc_' . $this->get_plugin()->get_id() . '_save_payment_method' ),
|
223 |
+
'i18n' => array(
|
224 |
+
'edit_button' => esc_html__( 'Edit', 'woocommerce-gateway-paypal-powered-by-braintree' ),
|
225 |
+
'cancel_button' => esc_html__( 'Cancel', 'woocommerce-gateway-paypal-powered-by-braintree' ),
|
226 |
+
'save_error' => esc_html__( 'Oops, there was an error updating your payment method. Please try again.', 'woocommerce-gateway-paypal-powered-by-braintree' ),
|
227 |
+
'delete_ays' => esc_html__( 'Are you sure you want to delete this payment method?', 'woocommerce-gateway-paypal-powered-by-braintree' ),
|
228 |
+
),
|
229 |
+
);
|
230 |
|
231 |
+
/**
|
232 |
+
* Filters the payment gateway payment methods JavaScript args.
|
233 |
+
*
|
234 |
+
* @since 5.1.0
|
235 |
+
*
|
236 |
+
* @param array $args arguments
|
237 |
+
* @param SV_WC_Payment_Gateway_My_Payment_Methods $handler payment methods handler
|
238 |
+
*/
|
239 |
+
$args = apply_filters( 'wc_payment_gateway_' . $this->get_plugin()->get_id() . '_payment_methods_js_args', $args, $this );
|
240 |
+
|
241 |
+
wc_enqueue_js( sprintf(
|
242 |
+
'window.wc_%1$s_payment_methods_handler = new %2$s( %3$s );',
|
243 |
+
esc_js( $this->get_plugin()->get_id() ),
|
244 |
+
esc_js( $this->get_js_handler_class() ),
|
245 |
+
json_encode( $args )
|
246 |
+
) );
|
247 |
+
}
|
248 |
|
|
|
249 |
|
250 |
+
/**
|
251 |
+
* Gets the JS handler class name.
|
252 |
+
*
|
253 |
+
* Plugins can override this for their own JS implementations.
|
254 |
+
*
|
255 |
+
* @since 5.1.0
|
256 |
+
*
|
257 |
+
* @return string
|
258 |
+
*/
|
259 |
+
protected function get_js_handler_class() {
|
260 |
|
261 |
+
return 'SV_WC_Payment_Methods_Handler';
|
|
|
262 |
}
|
263 |
|
264 |
|
384 |
$html = '<thead><tr>';
|
385 |
|
386 |
foreach ( $this->get_table_headers() as $key => $title ) {
|
387 |
+
$html .= sprintf( '<th class="sv-wc-payment-gateway-my-payment-method-table-header sv-wc-payment-gateway-payment-method-header-%1$s wc-%2$s-payment-method-%1$s"><span class="nobr">%3$s</span></th>', sanitize_html_class( $key ), sanitize_html_class( $this->get_plugin()->get_id_dasherized() ), esc_html( $title ) );
|
|
|
388 |
}
|
389 |
|
390 |
$html .= '</tr></thead>';
|
411 |
protected function get_table_headers() {
|
412 |
|
413 |
$headers = array(
|
414 |
+
'title' => __( 'Method', 'woocommerce-gateway-paypal-powered-by-braintree' ),
|
415 |
+
'details' => __( 'Details', 'woocommerce-gateway-paypal-powered-by-braintree' ),
|
416 |
+
'expiry' => __( 'Expires', 'woocommerce-gateway-paypal-powered-by-braintree' ),
|
417 |
+
'default' => __( 'Default?', 'woocommerce-gateway-paypal-powered-by-braintree' ),
|
418 |
+
'actions' => __( 'Actions', 'woocommerce-gateway-paypal-powered-by-braintree' ),
|
419 |
);
|
420 |
|
421 |
/**
|
447 |
|
448 |
if ( $this->credit_card_tokens && $this->echeck_tokens ) {
|
449 |
|
450 |
+
$html .= sprintf(
|
451 |
+
'<tr class="sv-wc-payment-gateway-my-payment-methods-type-divider wc-%s-my-payment-methods-type-divider"><td colspan="%d">%s</td></tr>',
|
452 |
+
sanitize_html_class( $this->get_plugin()->get_id_dasherized() ),
|
453 |
+
count( $this->get_table_headers() ),
|
454 |
+
esc_html__( 'Credit/Debit Cards', 'woocommerce-gateway-paypal-powered-by-braintree' )
|
455 |
);
|
456 |
|
457 |
$html .= $this->get_table_body_row_html( $this->credit_card_tokens );
|
458 |
|
459 |
+
$html .= sprintf(
|
460 |
+
'<tr class="sv-wc-payment-gateway-my-payment-methods-type-divider wc-%s-my-payment-methods-type-divider"><td colspan="%d">%s</td></tr>',
|
461 |
+
sanitize_html_class( $this->get_plugin()->get_id_dasherized() ),
|
462 |
+
count( $this->get_table_headers() ),
|
463 |
+
esc_html__( 'Bank Accounts', 'woocommerce-gateway-paypal-powered-by-braintree' )
|
464 |
);
|
465 |
|
466 |
$html .= $this->get_table_body_row_html( $this->echeck_tokens );
|
502 |
|
503 |
$method = $this->get_table_body_row_data( $token );
|
504 |
|
505 |
+
$html .= sprintf(
|
506 |
+
'<tr class="sv-wc-payment-gateway-my-payment-methods-method wc-%1$s-my-payment-methods-method %2$s" data-token-id="%3$s">',
|
507 |
+
sanitize_html_class( $this->get_plugin()->get_id_dasherized() ),
|
508 |
+
$token->is_default() ? 'default' : '',
|
509 |
+
esc_attr( $token->get_id() )
|
510 |
+
);
|
511 |
|
512 |
// Display the row data in the order of the headers
|
513 |
foreach ( $headers as $attribute => $attribute_title ) {
|
549 |
*/
|
550 |
protected function get_table_body_row_data( $token ) {
|
551 |
|
552 |
+
$method = array(
|
553 |
+
'title' => $this->get_payment_method_title_html( $token ),
|
554 |
+
'default' => $this->get_payment_method_default_html( $token ),
|
555 |
+
'details' => $this->get_payment_method_details_html( $token ),
|
556 |
+
'actions' => $this->get_payment_method_actions_html( $token ),
|
557 |
+
);
|
558 |
+
|
559 |
+
// add the expiration date if applicable
|
560 |
+
if ( $token->get_exp_month() && $token->get_exp_year() ) {
|
561 |
+
$method['expiry'] = $this->get_payment_method_expiry_html( $token );
|
562 |
+
}
|
563 |
+
|
564 |
+
/**
|
565 |
+
* My Payment Methods Table Body Row Data Filter.
|
566 |
+
*
|
567 |
+
* Allow actors to modify the table body row data.
|
568 |
+
*
|
569 |
+
* @since 4.0.0
|
570 |
+
* @param array $methods {
|
571 |
+
* @type string $title payment method title
|
572 |
+
* @type string $expiry payment method expiry
|
573 |
+
* @type string $actions actions for payment method
|
574 |
+
* }
|
575 |
+
* @param array $token simple array of SV_WC_Payment_Gateway_Payment_Token objects
|
576 |
+
* @param \SV_WC_Payment_Gateway_My_Payment_Methods $this instance
|
577 |
+
*/
|
578 |
+
return apply_filters( 'wc_' . $this->get_plugin()->get_id() . '_my_payment_methods_table_body_row_data', $method, $token, $this );
|
579 |
+
}
|
580 |
+
|
581 |
|
582 |
+
/**
|
583 |
+
* Get the payment method title for a given token.
|
584 |
+
*
|
585 |
+
* @since 4.0.0
|
586 |
+
* @deprecated 5.1.0
|
587 |
+
*
|
588 |
+
* @param SV_WC_Payment_Gateway_Payment_Token $token token object
|
589 |
+
* @return string
|
590 |
+
*/
|
591 |
+
protected function get_payment_method_title( $token ) {
|
592 |
|
593 |
+
return $this->get_payment_method_title_html( $token );
|
594 |
+
}
|
595 |
|
596 |
+
|
597 |
+
/**
|
598 |
+
* Get a token's payment method title HTML.
|
599 |
+
*
|
600 |
+
* @since 5.1.0
|
601 |
+
*
|
602 |
+
* @param SV_WC_Payment_Gateway_Payment_Token $token token object
|
603 |
+
* @return string
|
604 |
+
*/
|
605 |
+
protected function get_payment_method_title_html( SV_WC_Payment_Gateway_Payment_Token $token ) {
|
606 |
+
|
607 |
+
$nickname = $token->get_nickname();
|
608 |
+
$title = $token->get_nickname() ? $token->get_nickname() : $token->get_type_full();
|
609 |
+
|
610 |
+
/**
|
611 |
+
* Filter a token's payment method title.
|
612 |
+
*
|
613 |
+
* @since 4.0.0
|
614 |
+
*
|
615 |
+
* @param string $title payment method title
|
616 |
+
* @param SV_WC_Payment_Gateway_Payment_Token $token token object
|
617 |
+
*/
|
618 |
+
$title = apply_filters( 'wc_' . $this->get_plugin()->get_id() . '_my_payment_methods_table_method_title', $title, $token, $this );
|
619 |
+
|
620 |
+
$html = '<div class="view">' . esc_html( $title ) . '</div>';
|
621 |
+
|
622 |
+
// add the edit context input
|
623 |
+
$html .= '<div class="edit" style="display:none;">';
|
624 |
+
$html .= '<input type="text" class="nickname" name="nickname" value="' . esc_html( $token->get_nickname() ) . '" placeholder="' . esc_attr( __( 'Nickname', 'woocommerce-gateway-paypal-powered-by-braintree' ) ) . '" />';
|
625 |
+
$html .= '</div>';
|
626 |
+
|
627 |
+
/**
|
628 |
+
* Filter a token's payment method title HTML.
|
629 |
+
*
|
630 |
+
* @since 5.1.0
|
631 |
+
*
|
632 |
+
* @param string $html title HTML
|
633 |
+
* @param SV_WC_Payment_Gateway_Payment_Token $token token object
|
634 |
+
*/
|
635 |
+
return apply_filters( 'wc_' . $this->get_plugin()->get_id() . '_my_payment_methods_table_method_title_html', $html, $token );
|
636 |
+
}
|
637 |
+
|
638 |
+
|
639 |
+
/**
|
640 |
+
* Get a token's payment method "default" flag HTML.
|
641 |
+
*
|
642 |
+
* @since 5.1.0
|
643 |
+
*
|
644 |
+
* @param SV_WC_Payment_Gateway_Payment_Token $token token object
|
645 |
+
* @return string
|
646 |
+
*/
|
647 |
+
protected function get_payment_method_default_html( SV_WC_Payment_Gateway_Payment_Token $token ) {
|
648 |
+
|
649 |
+
$html = '<div class="view">';
|
650 |
+
$html .= $token->is_default() ? '<mark class="default">' . esc_html__( 'Default', 'woocommerce-gateway-paypal-powered-by-braintree' ) . '</mark>' : '';
|
651 |
+
$html .= '</div>';
|
652 |
+
|
653 |
+
// add the edit context input
|
654 |
+
$html .= '<div class="edit" style="display:none;">';
|
655 |
+
$html .= '<input type="checkbox" class="default" name="default" value="yes" ' . checked( true, $token->is_default(), false ) . ' />';
|
656 |
+
$html .= '</div>';
|
657 |
+
|
658 |
+
/**
|
659 |
+
* Filter a token's payment method "default" flag HTML.
|
660 |
+
*
|
661 |
+
* @since 5.1.0
|
662 |
+
*
|
663 |
+
* @param string $html "default" flag HTML
|
664 |
+
* @param SV_WC_Payment_Gateway_Payment_Token $token token object
|
665 |
+
*/
|
666 |
+
return apply_filters( 'wc_' . $this->get_plugin()->get_id() . '_my_payment_methods_table_method_default_html', $html, $token );
|
667 |
+
}
|
668 |
+
|
669 |
+
|
670 |
+
/**
|
671 |
+
* Gets a token's payment method details HTML.
|
672 |
+
*
|
673 |
+
* This includes the method type icon, last four digits, and "default"
|
674 |
+
* badge if applicable. Example:
|
675 |
+
*
|
676 |
+
* [icon] * * * 1234 [default]
|
677 |
+
*
|
678 |
+
* @since 5.1.0
|
679 |
+
*
|
680 |
+
* @param SV_WC_Payment_Gateway_Payment_Token $token token object
|
681 |
+
* @return array
|
682 |
+
*/
|
683 |
+
protected function get_payment_method_details_html( SV_WC_Payment_Gateway_Payment_Token $token ) {
|
684 |
+
|
685 |
+
$html = '';
|
686 |
+
|
687 |
+
if ( $image_url = $token->get_image_url() ) {
|
688 |
+
$html .= sprintf( '<img src="%1$s" alt="%2$s" title="%2$s" width="40" height="25" />', esc_url( $image_url ), esc_attr( $token->get_type_full() ) );
|
689 |
+
}
|
690 |
+
|
691 |
+
if ( $last_four = $token->get_last_four() ) {
|
692 |
+
$html .= "• • • {$last_four}";
|
693 |
+
}
|
694 |
+
|
695 |
+
/**
|
696 |
+
* Filters a token's payment method details HTML.
|
697 |
+
*
|
698 |
+
* @since 5.1.0
|
699 |
+
*
|
700 |
+
* @param string $html details HTML
|
701 |
+
* @param SV_WC_Payment_Gateway_Payment_Token $token token object
|
702 |
+
*/
|
703 |
+
return apply_filters( 'wc_' . $this->get_plugin()->get_id() . '_my_payment_methods_table_details_html', $html, $token );
|
704 |
+
}
|
705 |
+
|
706 |
+
|
707 |
+
/**
|
708 |
+
* Get a token's payment method expiration date HTML.
|
709 |
+
*
|
710 |
+
* @since 5.1.0
|
711 |
+
*
|
712 |
+
* @param SV_WC_Payment_Gateway_Payment_Token $token token object
|
713 |
+
* @return string
|
714 |
+
*/
|
715 |
+
protected function get_payment_method_expiry_html( SV_WC_Payment_Gateway_Payment_Token $token ) {
|
716 |
+
|
717 |
+
$html = esc_html( $token->get_exp_date() );
|
718 |
+
|
719 |
+
// TODO: add edit support {CW 2018-01-30}
|
720 |
+
|
721 |
+
/**
|
722 |
+
* Filter a token's payment method expiration date HTML.
|
723 |
+
*
|
724 |
+
* @since 5.1.0
|
725 |
+
*
|
726 |
+
* @param string $html expiration date HTML
|
727 |
+
* @param SV_WC_Payment_Gateway_Payment_Token $token token object
|
728 |
+
*/
|
729 |
+
return apply_filters( 'wc_' . $this->get_plugin()->get_id() . '_my_payment_methods_table_method_expiry_html', $html, $token );
|
730 |
+
}
|
731 |
+
|
732 |
+
|
733 |
+
/**
|
734 |
+
* Get a token's payment method actions HTML.
|
735 |
+
*
|
736 |
+
* @since 5.1.0
|
737 |
+
*
|
738 |
+
* @param SV_WC_Payment_Gateway_Payment_Token $token token object
|
739 |
+
* @return string
|
740 |
+
*/
|
741 |
+
protected function get_payment_method_actions_html( SV_WC_Payment_Gateway_Payment_Token $token ) {
|
742 |
+
|
743 |
+
$actions = array(
|
744 |
+
'<a href="#" class="edit-payment-method button">' . esc_html__( 'Edit', 'woocommerce-gateway-paypal-powered-by-braintree' ) . '</a>',
|
745 |
+
'<a href="#" class="save-payment-method button" style="display:none">' . esc_html__( 'Save', 'woocommerce-gateway-paypal-powered-by-braintree' ) . '</a>',
|
746 |
+
);
|
747 |
+
|
748 |
+
foreach ( $this->get_payment_method_actions( $token ) as $action => $details ) {
|
749 |
+
|
750 |
+
$classes = isset( $details['class'] ) ? (array) $details['class'] : array();
|
751 |
+
$attributes = isset( $details['attributes'] ) ? (array) $details['attributes'] : array();
|
752 |
+
|
753 |
+
$attributes['data-token-id'] = $token->get_id();
|
754 |
+
$attributes['data-action'] = $action;
|
755 |
+
|
756 |
+
// if the action has a tooltip set
|
757 |
+
if ( ! empty( $details['tip'] ) ) {
|
758 |
|
759 |
$classes[] = 'tip';
|
760 |
|
761 |
+
$attributes['title'] = $details['tip'];
|
762 |
}
|
763 |
|
764 |
+
// build the attributes
|
765 |
foreach ( $attributes as $attribute => $value ) {
|
766 |
$attributes[] = esc_attr( $attribute ) . '="' . esc_attr( $value ) . '"';
|
767 |
unset( $attributes[ $attribute ] );
|
768 |
}
|
769 |
|
770 |
+
// build the button
|
771 |
$actions[] = sprintf(
|
772 |
( in_array( 'disabled', $classes ) ) ? '<a class="button %2$s" %3$s>%4$s</a>' : '<a href="%1$s" class="button %2$s" %3$s>%4$s</a>',
|
773 |
+
! empty( $details['url'] ) ? esc_url( $details['url'] ) : '#',
|
774 |
implode( ' ', array_map( 'sanitize_html_class', $classes ) ),
|
775 |
implode( ' ', $attributes ),
|
776 |
+
esc_html( $details['name'] )
|
777 |
);
|
778 |
}
|
779 |
|
780 |
+
$html = implode( '', $actions );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
781 |
|
782 |
/**
|
783 |
+
* Filters a token's payment method actions HTML.
|
784 |
*
|
785 |
+
* @since 5.1.0
|
786 |
*
|
787 |
+
* @param string $html actions HTML
|
788 |
+
* @param SV_WC_Payment_Gateway_Payment_Token $token token object
|
|
|
|
|
|
|
|
|
|
|
|
|
789 |
*/
|
790 |
+
return apply_filters( 'wc_' . $this->get_plugin()->get_id() . '_my_payment_methods_table_actions_html', $html, $token );
|
791 |
}
|
792 |
|
793 |
|
794 |
/**
|
795 |
+
* Gets the actions for the given payment method token.
|
|
|
|
|
|
|
796 |
*
|
797 |
* @since 4.0.0
|
798 |
+
*
|
799 |
+
* @param SV_WC_Payment_Gateway_Payment_Token $token token object
|
800 |
+
* @return array
|
801 |
*/
|
802 |
protected function get_payment_method_actions( $token ) {
|
803 |
|
804 |
+
$actions = array(
|
805 |
+
'delete' => __( 'Delete', 'woocommerce-gateway-paypal-powered-by-braintree' ),
|
806 |
+
);
|
807 |
+
|
808 |
+
$plugin_slug = $this->get_plugin()->get_id_dasherized();
|
809 |
|
810 |
+
foreach ( $actions as $action => $label ) {
|
|
|
811 |
|
812 |
+
$url = add_query_arg( array(
|
813 |
+
"wc-{$plugin_slug}-token" => $token->get_id(),
|
814 |
+
"wc-{$plugin_slug}-action" => $action,
|
815 |
+
) );
|
816 |
+
|
817 |
+
$actions[ $action ] = array(
|
818 |
+
'name' => $label,
|
819 |
+
'url' => wp_nonce_url( $url, "wc-{$plugin_slug}-token-action" ),
|
820 |
+
'class' => "{$action}-payment-method",
|
821 |
);
|
822 |
}
|
823 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
824 |
/**
|
825 |
* My Payment Methods Table Method Actions Filter.
|
826 |
*
|
827 |
* Allow actors to modify the table method actions.
|
828 |
*
|
829 |
* @since 4.0.0
|
830 |
+
*
|
831 |
* @param $actions array {
|
832 |
* @type string $url action URL
|
833 |
* @type string $class action button class
|
840 |
}
|
841 |
|
842 |
|
843 |
+
/** Payment Method actions ************************************************/
|
844 |
+
|
845 |
+
|
846 |
/**
|
847 |
+
* Saves a payment method via AJAX.
|
848 |
*
|
849 |
+
* @internal
|
850 |
*
|
851 |
+
* @since 5.1.0
|
|
|
|
|
852 |
*/
|
853 |
+
public function ajax_save_payment_method() {
|
854 |
|
855 |
+
check_ajax_referer( 'wc_' . $this->get_plugin()->get_id() . '_save_payment_method', 'nonce' );
|
|
|
|
|
856 |
|
857 |
+
try {
|
858 |
|
859 |
+
$this->load_tokens();
|
|
|
860 |
|
861 |
+
$token_id = SV_WC_Helper::get_post( 'token_id' );
|
862 |
|
863 |
+
if ( empty( $this->tokens[ $token_id ] ) || ! $this->tokens[ $token_id ] instanceof SV_WC_Payment_Gateway_Payment_Token ) {
|
864 |
+
throw new SV_WC_Payment_Gateway_Exception( 'Invalid token ID' );
|
865 |
+
}
|
866 |
|
867 |
+
$user_id = get_current_user_id();
|
868 |
+
$token = $this->tokens[ $token_id ];
|
869 |
+
$gateway = $this->get_plugin()->get_gateway_from_token( $user_id, $token );
|
870 |
|
871 |
+
// bail if the gateway or token couldn't be found for this user
|
872 |
+
if ( ! $gateway || ! $gateway->get_payment_tokens_handler()->user_has_token( $user_id, $token ) ) {
|
873 |
+
throw new SV_WC_Payment_Gateway_Exception( 'Invalid token' );
|
874 |
+
}
|
875 |
|
876 |
+
$data = array();
|
|
|
877 |
|
878 |
+
parse_str( SV_WC_Helper::get_post( 'data' ), $data );
|
|
|
879 |
|
880 |
+
// set the data
|
881 |
+
$token = $this->save_token_data( $token, $data );
|
882 |
+
|
883 |
+
// use the handler so other methods don't remain default
|
884 |
+
if ( $token->is_default() ) {
|
885 |
+
$gateway->get_payment_tokens_handler()->set_default_token( $user_id, $token );
|
886 |
+
}
|
887 |
+
|
888 |
+
// persist the data
|
889 |
+
$gateway->get_payment_tokens_handler()->update_token( $user_id, $token );
|
890 |
+
|
891 |
+
wp_send_json_success( array(
|
892 |
+
'html' => $this->get_table_body_row_html( array( $token ) ),
|
893 |
+
'is_default' => $token->is_default(),
|
894 |
+
'nonce' => wp_create_nonce( 'wc_' . $this->get_plugin()->get_id() . '_save_payment_method' ),
|
895 |
+
) );
|
896 |
+
|
897 |
+
} catch ( SV_WC_Payment_Gateway_Exception $e ) {
|
898 |
+
|
899 |
+
wp_send_json_error( $e->getMessage() );
|
900 |
+
}
|
901 |
}
|
902 |
|
903 |
|
904 |
+
/**
|
905 |
+
* Saves data to a token.
|
906 |
+
*
|
907 |
+
* Gateways can override this to set their own data if they add custom Edit
|
908 |
+
* fields. Note that this does not persist the data to the db, but only sets
|
909 |
+
* it for the object.
|
910 |
+
*
|
911 |
+
* @since 5.1.0
|
912 |
+
*
|
913 |
+
* @param SV_WC_Payment_Gateway_Payment_Token $token token object
|
914 |
+
* @param array $data {
|
915 |
+
* new data to store for the token
|
916 |
+
*
|
917 |
+
* @type string $nickname method nickname
|
918 |
+
* @type string $default whether the method should be set as default
|
919 |
+
* }
|
920 |
+
* @return SV_WC_Payment_Gateway_Payment_Token
|
921 |
+
*/
|
922 |
+
protected function save_token_data( SV_WC_Payment_Gateway_Payment_Token $token, array $data ) {
|
923 |
+
|
924 |
+
$raw_nickname = ! empty( $data['nickname'] ) ? $data['nickname'] : '';
|
925 |
+
$clean_nickname = wc_clean( $raw_nickname );
|
926 |
+
|
927 |
+
// only set the nickname if there is a clean value, or it was deliberately cleared
|
928 |
+
if ( $clean_nickname || ! $raw_nickname ) {
|
929 |
+
$token->set_nickname( $clean_nickname );
|
930 |
+
}
|
931 |
+
|
932 |
+
$token->set_default( isset( $data['default'] ) && 'yes' === $data['default'] );
|
933 |
+
|
934 |
+
return $token;
|
935 |
+
}
|
936 |
|
937 |
|
938 |
/**
|
988 |
|
989 |
/* translators: Payment method as in a specific credit card, e-check or bank account */
|
990 |
SV_WC_Helper::wc_add_notice( esc_html__( 'Payment method deleted.', 'woocommerce-gateway-paypal-powered-by-braintree' ) );
|
|
|
991 |
|
992 |
+
/**
|
993 |
+
* Fires after a new payment method is deleted by a customer.
|
994 |
+
*
|
995 |
+
* @since 5.0.0
|
996 |
+
*
|
997 |
+
* @param string $token_id ID of the deleted token
|
998 |
+
* @param int $user_id user ID
|
999 |
+
*/
|
1000 |
+
do_action( 'wc_payment_gateway_' . $gateway->get_id() . '_payment_method_deleted', $token, $user_id );
|
1001 |
+
}
|
1002 |
|
|
|
|
|
1003 |
break;
|
1004 |
|
1005 |
// custom actions
|
1029 |
*/
|
1030 |
protected function redirect_to_my_account() {
|
1031 |
|
1032 |
+
wp_redirect( wc_get_account_endpoint_url( 'payment-methods' ) );
|
|
|
|
|
|
|
|
|
|
|
|
|
1033 |
exit;
|
1034 |
}
|
1035 |
|
1039 |
* using filters
|
1040 |
*
|
1041 |
* @since 4.0.0
|
1042 |
+
* @return \SV_WC_Payment_Gateway_Plugin
|
1043 |
*/
|
1044 |
public function get_plugin() {
|
1045 |
return $this->plugin;
|
1066 |
}
|
1067 |
|
1068 |
|
1069 |
+
/**
|
1070 |
+
* Determines if we're viewing the My Account -> Payment Methods page.
|
1071 |
+
*
|
1072 |
+
* @since 5.1.0
|
1073 |
+
*
|
1074 |
+
* @return bool
|
1075 |
+
*/
|
1076 |
+
protected function is_payment_methods_page() {
|
1077 |
+
global $wp;
|
1078 |
+
|
1079 |
+
return is_user_logged_in() && is_account_page() && isset( $wp->query_vars['payment-methods'] );
|
1080 |
+
}
|
1081 |
+
|
1082 |
+
|
1083 |
}
|
1084 |
|
1085 |
endif; // class exists check
|
lib/skyverge/woocommerce/payment-gateway/class-sv-wc-payment-gateway-payment-form.php
CHANGED
@@ -18,15 +18,15 @@
|
|
18 |
*
|
19 |
* @package SkyVerge/WooCommerce/Payment-Gateway/Classes
|
20 |
* @author SkyVerge
|
21 |
-
* @copyright Copyright (c) 2013-
|
22 |
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
|
23 |
*/
|
24 |
|
25 |
-
namespace
|
26 |
|
27 |
defined( 'ABSPATH' ) or exit;
|
28 |
|
29 |
-
if ( ! class_exists( '
|
30 |
|
31 |
/**
|
32 |
* Payment Form Class
|
@@ -335,7 +335,7 @@ class SV_WC_Payment_Gateway_Payment_Form {
|
|
335 |
'id' => 'wc-' . $this->get_gateway()->get_id_dasherized() . '-csc',
|
336 |
'name' => 'wc-' . $this->get_gateway()->get_id_dasherized() . '-csc',
|
337 |
'placeholder' => esc_html__( 'CSC', 'woocommerce-gateway-paypal-powered-by-braintree' ),
|
338 |
-
'required' =>
|
339 |
'class' => array( 'form-row-last' ),
|
340 |
'input_class' => array( 'js-sv-wc-payment-gateway-credit-card-form-input js-sv-wc-payment-gateway-credit-card-form-csc' ),
|
341 |
'maxlength' => 4,
|
@@ -548,11 +548,7 @@ class SV_WC_Payment_Gateway_Payment_Form {
|
|
548 |
*/
|
549 |
protected function get_manage_payment_methods_button_html() {
|
550 |
|
551 |
-
|
552 |
-
$url = wc_get_page_permalink( 'myaccount' ) . '#wc-' . $this->get_gateway()->get_plugin()->get_id_dasherized() . '-my-payment-methods';
|
553 |
-
} else {
|
554 |
-
$url = wc_get_endpoint_url( 'payment-methods', '', wc_get_page_permalink( 'myaccount' ) );
|
555 |
-
}
|
556 |
|
557 |
/**
|
558 |
* Payment Form Manage Payment Methods Button Text Filter.
|
@@ -563,7 +559,7 @@ class SV_WC_Payment_Gateway_Payment_Form {
|
|
563 |
* @since 4.0.0
|
564 |
* @param string $button_text button text
|
565 |
*/
|
566 |
-
$html = sprintf( '<a class="sv-wc-payment-gateway-payment-form-manage-payment-methods
|
567 |
esc_url( $url ),
|
568 |
/* translators: Payment method as in a specific credit card, eCheck or bank account */
|
569 |
wp_kses_post( apply_filters( 'wc_' . $this->get_gateway()->get_id() . '_manage_payment_methods_text', esc_html__( 'Manage Payment Methods', 'woocommerce-gateway-paypal-powered-by-braintree' ) ) )
|
@@ -594,7 +590,7 @@ class SV_WC_Payment_Gateway_Payment_Form {
|
|
594 |
protected function get_saved_payment_method_html( $token ) {
|
595 |
|
596 |
// input
|
597 |
-
$html = sprintf( '<input type="radio" id="wc-%1$s-payment-token-%2$s" name="wc-%1$s-payment-token" class="js-sv-wc-payment-gateway-payment-token js-wc-%1$s-payment-token" style="width:auto;" value="%2$s" %3$s/>',
|
598 |
esc_attr( $this->get_gateway()->get_id_dasherized() ),
|
599 |
esc_attr( $token->get_id() ),
|
600 |
checked( $token->is_default(), true, false )
|
@@ -636,22 +632,26 @@ class SV_WC_Payment_Gateway_Payment_Form {
|
|
636 |
$last_four = $token->get_last_four();
|
637 |
$type = $token->get_type_full();
|
638 |
|
|
|
|
|
|
|
|
|
|
|
|
|
639 |
if ( $image_url ) {
|
640 |
|
641 |
// format like "<Amex logo image> American Express"
|
642 |
-
$title
|
643 |
|
644 |
} else {
|
645 |
|
646 |
// missing payment method image, format like "American Express"
|
647 |
-
$title
|
648 |
}
|
649 |
|
650 |
// add "ending in XXXX" if available
|
651 |
if ( $last_four ) {
|
652 |
-
|
653 |
-
/* translators: Placeholders: %s - last four digits of card/account */
|
654 |
-
$title .= ' ' . sprintf( esc_html__( 'ending in %s', 'woocommerce-gateway-paypal-powered-by-braintree' ), $last_four );
|
655 |
}
|
656 |
|
657 |
// add "(expires MM/YY)" if available
|
@@ -661,6 +661,8 @@ class SV_WC_Payment_Gateway_Payment_Form {
|
|
661 |
$title .= ' ' . sprintf( esc_html__( '(expires %s)', 'woocommerce-gateway-paypal-powered-by-braintree' ), $token->get_exp_date() );
|
662 |
}
|
663 |
|
|
|
|
|
664 |
/**
|
665 |
* Payment Gateway Payment Form Payment Method Title.
|
666 |
*
|
@@ -686,7 +688,7 @@ class SV_WC_Payment_Gateway_Payment_Form {
|
|
686 |
protected function get_use_new_payment_method_input_html() {
|
687 |
|
688 |
// input
|
689 |
-
$html = sprintf( '<input type="radio" id="wc-%1$s-use-new-payment-method" name="wc-%1$s-payment-token" class="js-sv-wc-payment-token js-wc-%1$s-payment-token" style="width:auto;" value="" %2$s />',
|
690 |
esc_attr( $this->get_gateway()->get_id_dasherized() ),
|
691 |
checked( $this->default_new_payment_method(), true, false )
|
692 |
);
|
@@ -946,15 +948,16 @@ class SV_WC_Payment_Gateway_Payment_Form {
|
|
946 |
public function render_js() {
|
947 |
|
948 |
$args = array(
|
949 |
-
'plugin_id'
|
950 |
-
'id'
|
951 |
-
'id_dasherized'
|
952 |
-
'type'
|
953 |
-
'csc_required'
|
|
|
954 |
);
|
955 |
|
956 |
if ( $this->get_gateway()->supports_card_types() ) {
|
957 |
-
$args['enabled_card_types'] = array_map( array( 'SV_WC_Payment_Gateway_Helper', 'normalize_card_type' ), $this->get_gateway()->get_card_types() );
|
958 |
}
|
959 |
|
960 |
/**
|
18 |
*
|
19 |
* @package SkyVerge/WooCommerce/Payment-Gateway/Classes
|
20 |
* @author SkyVerge
|
21 |
+
* @copyright Copyright (c) 2013-2018, SkyVerge, Inc.
|
22 |
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
|
23 |
*/
|
24 |
|
25 |
+
namespace WC_Braintree\Plugin_Framework;
|
26 |
|
27 |
defined( 'ABSPATH' ) or exit;
|
28 |
|
29 |
+
if ( ! class_exists( '\\WC_Braintree\\Plugin_Framework\\SV_WC_Payment_Gateway_Payment_Form' ) ) :
|
30 |
|
31 |
/**
|
32 |
* Payment Form Class
|
335 |
'id' => 'wc-' . $this->get_gateway()->get_id_dasherized() . '-csc',
|
336 |
'name' => 'wc-' . $this->get_gateway()->get_id_dasherized() . '-csc',
|
337 |
'placeholder' => esc_html__( 'CSC', 'woocommerce-gateway-paypal-powered-by-braintree' ),
|
338 |
+
'required' => true,
|
339 |
'class' => array( 'form-row-last' ),
|
340 |
'input_class' => array( 'js-sv-wc-payment-gateway-credit-card-form-input js-sv-wc-payment-gateway-credit-card-form-csc' ),
|
341 |
'maxlength' => 4,
|
548 |
*/
|
549 |
protected function get_manage_payment_methods_button_html() {
|
550 |
|
551 |
+
$url = wc_get_account_endpoint_url( 'payment-methods' );
|
|
|
|
|
|
|
|
|
552 |
|
553 |
/**
|
554 |
* Payment Form Manage Payment Methods Button Text Filter.
|
559 |
* @since 4.0.0
|
560 |
* @param string $button_text button text
|
561 |
*/
|
562 |
+
$html = sprintf( '<a class="button sv-wc-payment-gateway-payment-form-manage-payment-methods" href="%s">%s</a>',
|
563 |
esc_url( $url ),
|
564 |
/* translators: Payment method as in a specific credit card, eCheck or bank account */
|
565 |
wp_kses_post( apply_filters( 'wc_' . $this->get_gateway()->get_id() . '_manage_payment_methods_text', esc_html__( 'Manage Payment Methods', 'woocommerce-gateway-paypal-powered-by-braintree' ) ) )
|
590 |
protected function get_saved_payment_method_html( $token ) {
|
591 |
|
592 |
// input
|
593 |
+
$html = sprintf( '<input type="radio" id="wc-%1$s-payment-token-%2$s" name="wc-%1$s-payment-token" class="js-sv-wc-payment-gateway-payment-token js-wc-%1$s-payment-token" style="width:auto; margin-right:.5em;" value="%2$s" %3$s/>',
|
594 |
esc_attr( $this->get_gateway()->get_id_dasherized() ),
|
595 |
esc_attr( $token->get_id() ),
|
596 |
checked( $token->is_default(), true, false )
|
632 |
$last_four = $token->get_last_four();
|
633 |
$type = $token->get_type_full();
|
634 |
|
635 |
+
$title = '<span class="title">';
|
636 |
+
|
637 |
+
if ( $token->get_nickname() ) {
|
638 |
+
$title .= '<span class="nickname">' . $token->get_nickname() . '</span>';
|
639 |
+
}
|
640 |
+
|
641 |
if ( $image_url ) {
|
642 |
|
643 |
// format like "<Amex logo image> American Express"
|
644 |
+
$title .= sprintf( '<img src="%1$s" alt="%2$s" title="%2$s" width="30" height="20" style="width: 30px; height: 20px;" />', esc_url( $image_url ), esc_attr( $type ) );
|
645 |
|
646 |
} else {
|
647 |
|
648 |
// missing payment method image, format like "American Express"
|
649 |
+
$title .= esc_html( $type );
|
650 |
}
|
651 |
|
652 |
// add "ending in XXXX" if available
|
653 |
if ( $last_four ) {
|
654 |
+
$title .= '• • • ' . esc_html( $last_four );
|
|
|
|
|
655 |
}
|
656 |
|
657 |
// add "(expires MM/YY)" if available
|
661 |
$title .= ' ' . sprintf( esc_html__( '(expires %s)', 'woocommerce-gateway-paypal-powered-by-braintree' ), $token->get_exp_date() );
|
662 |
}
|
663 |
|
664 |
+
$title .= '</span>';
|
665 |
+
|
666 |
/**
|
667 |
* Payment Gateway Payment Form Payment Method Title.
|
668 |
*
|
688 |
protected function get_use_new_payment_method_input_html() {
|
689 |
|
690 |
// input
|
691 |
+
$html = sprintf( '<input type="radio" id="wc-%1$s-use-new-payment-method" name="wc-%1$s-payment-token" class="js-sv-wc-payment-token js-wc-%1$s-payment-token" style="width:auto; margin-right: .5em;" value="" %2$s />',
|
692 |
esc_attr( $this->get_gateway()->get_id_dasherized() ),
|
693 |
checked( $this->default_new_payment_method(), true, false )
|
694 |
);
|
948 |
public function render_js() {
|
949 |
|
950 |
$args = array(
|
951 |
+
'plugin_id' => $this->get_gateway()->get_plugin()->get_id(),
|
952 |
+
'id' => $this->get_gateway()->get_id(),
|
953 |
+
'id_dasherized' => $this->get_gateway()->get_id_dasherized(),
|
954 |
+
'type' => $this->get_gateway()->get_payment_type(),
|
955 |
+
'csc_required' => $this->get_gateway()->csc_enabled(),
|
956 |
+
'csc_required_for_tokens' => $this->get_gateway()->csc_enabled_for_tokens(),
|
957 |
);
|
958 |
|
959 |
if ( $this->get_gateway()->supports_card_types() ) {
|
960 |
+
$args['enabled_card_types'] = array_map( array( 'WC_Braintree\Plugin_Framework\SV_WC_Payment_Gateway_Helper', 'normalize_card_type' ), $this->get_gateway()->get_card_types() );
|
961 |
}
|
962 |
|
963 |
/**
|
lib/skyverge/woocommerce/payment-gateway/class-sv-wc-payment-gateway-plugin.php
CHANGED
@@ -18,15 +18,15 @@
|
|
18 |
*
|
19 |
* @package SkyVerge/WooCommerce/Payment-Gateway/Classes
|
20 |
* @author SkyVerge
|
21 |
-
* @copyright Copyright (c) 2013-
|
22 |
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
|
23 |
*/
|
24 |
|
25 |
-
namespace
|
26 |
|
27 |
defined( 'ABSPATH' ) or exit;
|
28 |
|
29 |
-
if ( ! class_exists( '
|
30 |
|
31 |
/**
|
32 |
* # WooCommerce Payment Gateway Plugin Framework
|
@@ -87,18 +87,21 @@ abstract class SV_WC_Payment_Gateway_Plugin extends SV_WC_Plugin {
|
|
87 |
/** @var SV_WC_Payment_Gateway_Privacy payment gateway privacy handler instance */
|
88 |
protected $privacy_handler;
|
89 |
|
90 |
-
/** @var
|
91 |
-
|
92 |
|
93 |
-
/** @var
|
94 |
protected $admin_user_handler;
|
95 |
|
96 |
/** @var SV_WC_Payment_Gateway_My_Payment_Methods adds My Payment Method functionality */
|
97 |
private $my_payment_methods;
|
98 |
|
|
|
|
|
|
|
99 |
|
100 |
/**
|
101 |
-
*
|
102 |
*
|
103 |
* Optional args:
|
104 |
*
|
@@ -108,6 +111,7 @@ abstract class SV_WC_Payment_Gateway_Plugin extends SV_WC_Plugin {
|
|
108 |
* + `supports` - array named features that this gateway supports, including 'tokenization', 'transaction_link', 'customer_id', 'capture_charge'
|
109 |
*
|
110 |
* @since 1.0.0
|
|
|
111 |
* @see SV_WC_Plugin::__construct()
|
112 |
* @param string $id plugin id
|
113 |
* @param string $version plugin version number
|
@@ -117,67 +121,103 @@ abstract class SV_WC_Payment_Gateway_Plugin extends SV_WC_Plugin {
|
|
117 |
|
118 |
parent::__construct( $id, $version, $args );
|
119 |
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
}
|
127 |
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
if ( isset( $args['supports'] ) ) {
|
132 |
-
$this->supports = $args['supports'];
|
133 |
-
}
|
134 |
-
if ( isset( $args['require_ssl'] ) ) {
|
135 |
-
$this->require_ssl = $args['require_ssl'];
|
136 |
}
|
137 |
|
138 |
-
|
139 |
-
|
|
|
140 |
|
141 |
-
|
142 |
-
|
143 |
|
144 |
-
//
|
145 |
-
|
|
|
146 |
|
147 |
-
if ( $this->supports( self::FEATURE_CAPTURE_CHARGE ) ) {
|
148 |
|
149 |
-
|
150 |
-
|
151 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
152 |
|
153 |
-
|
154 |
-
add_action( 'admin_footer-edit.php', array( $this, 'maybe_add_capture_charge_bulk_order_action' ) );
|
155 |
-
add_action( 'load-edit.php', array( $this, 'process_capture_charge_bulk_order_action' ) );
|
156 |
-
}
|
157 |
|
158 |
-
|
|
|
159 |
|
160 |
-
// filter the payment gateway table on the checkout settings screen to indicate if a gateway can support Subscriptions but requires tokenization to be enabled
|
161 |
-
add_action( 'admin_print_styles', array( $this, 'subscriptions_add_renewal_support_status_inline_style' ) );
|
162 |
-
add_filter( 'woocommerce_payment_gateways_renewal_support_status_html', array( $this, 'subscriptions_maybe_edit_renewal_support_status' ), 10, 2 );
|
163 |
-
}
|
164 |
|
165 |
-
|
166 |
-
|
167 |
-
|
|
|
|
|
|
|
168 |
|
169 |
-
//
|
170 |
add_filter( 'woocommerce_payment_gateways', array( $this, 'load_gateways' ) );
|
171 |
|
172 |
-
//
|
173 |
add_filter( 'woocommerce_available_payment_gateways', array( $this, 'adjust_available_gateways' ) );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
174 |
}
|
175 |
|
176 |
|
177 |
/**
|
178 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
179 |
*
|
180 |
* @since 1.0.0
|
|
|
181 |
* @param array $gateways
|
182 |
* @return array $gateways
|
183 |
*/
|
@@ -191,6 +231,7 @@ abstract class SV_WC_Payment_Gateway_Plugin extends SV_WC_Plugin {
|
|
191 |
* Adjust the available gateways in certain cases.
|
192 |
*
|
193 |
* @since 4.4.0
|
|
|
194 |
* @param array $available_gateways the available payment gateways
|
195 |
* @return array
|
196 |
*/
|
@@ -212,14 +253,13 @@ abstract class SV_WC_Payment_Gateway_Plugin extends SV_WC_Plugin {
|
|
212 |
|
213 |
|
214 |
/**
|
215 |
-
* Include required
|
|
|
|
|
216 |
*
|
217 |
* @since 1.0.0
|
218 |
-
* @see SV_WC_Plugin::lib_includes()
|
219 |
*/
|
220 |
-
|
221 |
-
|
222 |
-
parent::lib_includes();
|
223 |
|
224 |
$payment_gateway_framework_path = $this->get_payment_gateway_framework_path();
|
225 |
|
@@ -230,6 +270,10 @@ abstract class SV_WC_Payment_Gateway_Plugin extends SV_WC_Plugin {
|
|
230 |
require_once( $payment_gateway_framework_path . '/api/interface-sv-wc-payment-gateway-api-authorization-response.php' );
|
231 |
require_once( $payment_gateway_framework_path . '/api/interface-sv-wc-payment-gateway-api-create-payment-token-response.php' );
|
232 |
require_once( $payment_gateway_framework_path . '/api/interface-sv-wc-payment-gateway-api-get-tokenized-payment-methods-response.php' );
|
|
|
|
|
|
|
|
|
233 |
require_once( $payment_gateway_framework_path . '/api/interface-sv-wc-payment-gateway-api-customer-response.php' );
|
234 |
|
235 |
// exceptions
|
@@ -238,9 +282,21 @@ abstract class SV_WC_Payment_Gateway_Plugin extends SV_WC_Plugin {
|
|
238 |
// gateway
|
239 |
require_once( $payment_gateway_framework_path . '/class-sv-wc-payment-gateway.php' );
|
240 |
require_once( $payment_gateway_framework_path . '/class-sv-wc-payment-gateway-direct.php' );
|
|
|
241 |
require_once( $payment_gateway_framework_path . '/class-sv-wc-payment-gateway-payment-form.php' );
|
242 |
require_once( $payment_gateway_framework_path . '/class-sv-wc-payment-gateway-my-payment-methods.php' );
|
243 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
244 |
// payment tokens
|
245 |
require_once( $payment_gateway_framework_path . '/payment-tokens/class-sv-wc-payment-gateway-payment-token.php' );
|
246 |
require_once( $payment_gateway_framework_path . '/payment-tokens/class-sv-wc-payment-gateway-payment-tokens-handler.php' );
|
@@ -249,6 +305,12 @@ abstract class SV_WC_Payment_Gateway_Plugin extends SV_WC_Plugin {
|
|
249 |
require_once( $payment_gateway_framework_path . '/api/class-sv-wc-payment-gateway-api-response-message-helper.php' );
|
250 |
require_once( $payment_gateway_framework_path . '/class-sv-wc-payment-gateway-helper.php' );
|
251 |
|
|
|
|
|
|
|
|
|
|
|
|
|
252 |
// integrations
|
253 |
require_once( $payment_gateway_framework_path . '/integrations/abstract-sv-wc-payment-gateway-integration.php' );
|
254 |
|
@@ -263,17 +325,10 @@ abstract class SV_WC_Payment_Gateway_Plugin extends SV_WC_Plugin {
|
|
263 |
}
|
264 |
|
265 |
// privacy
|
266 |
-
if ( SV_WC_Plugin_Compatibility::is_wc_version_gte( '3.4' )
|
267 |
require_once( "{$payment_gateway_framework_path}/class-sv-wc-payment-gateway-privacy.php" );
|
268 |
$this->privacy_handler = new SV_WC_Payment_Gateway_Privacy( $this );
|
269 |
}
|
270 |
-
|
271 |
-
// Admin user handler
|
272 |
-
if ( is_admin() ) {
|
273 |
-
require_once( $payment_gateway_framework_path . '/admin/class-sv-wc-payment-gateway-admin-user-handler.php' );
|
274 |
-
require_once( $payment_gateway_framework_path . '/admin/class-sv-wc-payment-gateway-admin-payment-token-editor.php' );
|
275 |
-
$this->admin_user_handler = new SV_WC_Payment_Gateway_Admin_User_Handler( $this );
|
276 |
-
}
|
277 |
}
|
278 |
|
279 |
|
@@ -283,14 +338,20 @@ abstract class SV_WC_Payment_Gateway_Plugin extends SV_WC_Plugin {
|
|
283 |
/**
|
284 |
* Instantiates the My Payment Methods table class instance when a user is
|
285 |
* logged in on an account page and tokenization is enabled for at least
|
286 |
-
* one of the active gateways
|
|
|
|
|
287 |
*
|
288 |
* @since 4.0.0
|
289 |
*/
|
290 |
public function maybe_init_my_payment_methods() {
|
291 |
|
292 |
-
|
|
|
|
|
|
|
293 |
|
|
|
294 |
$this->my_payment_methods = $this->get_my_payment_methods_instance();
|
295 |
}
|
296 |
}
|
@@ -301,6 +362,7 @@ abstract class SV_WC_Payment_Gateway_Plugin extends SV_WC_Plugin {
|
|
301 |
* active gateway
|
302 |
*
|
303 |
* @since 4.2.0
|
|
|
304 |
* @return bool
|
305 |
*/
|
306 |
public function tokenization_enabled() {
|
@@ -317,11 +379,13 @@ abstract class SV_WC_Payment_Gateway_Plugin extends SV_WC_Plugin {
|
|
317 |
|
318 |
|
319 |
/**
|
320 |
-
*
|
321 |
-
*
|
|
|
322 |
*
|
323 |
* @since 4.0.0
|
324 |
-
*
|
|
|
325 |
*/
|
326 |
protected function get_my_payment_methods_instance() {
|
327 |
|
@@ -329,17 +393,106 @@ abstract class SV_WC_Payment_Gateway_Plugin extends SV_WC_Plugin {
|
|
329 |
}
|
330 |
|
331 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
332 |
/** Admin methods ******************************************************/
|
333 |
|
334 |
|
335 |
/**
|
336 |
-
*
|
337 |
-
* is active.
|
338 |
*
|
339 |
-
* @since 1.0.0
|
340 |
* @see SV_WC_Plugin::plugin_action_links()
|
341 |
-
*
|
342 |
-
* @
|
|
|
|
|
|
|
343 |
*/
|
344 |
public function plugin_action_links( $actions ) {
|
345 |
|
@@ -363,12 +516,14 @@ abstract class SV_WC_Payment_Gateway_Plugin extends SV_WC_Plugin {
|
|
363 |
|
364 |
|
365 |
/**
|
366 |
-
*
|
|
|
367 |
* Multi-gateway plugins will return true if on either settings page
|
368 |
*
|
369 |
* @since 2.0.0
|
|
|
370 |
* @see SV_WC_Plugin::is_plugin_settings()
|
371 |
-
* @return
|
372 |
*/
|
373 |
public function is_plugin_settings() {
|
374 |
|
@@ -384,15 +539,22 @@ abstract class SV_WC_Payment_Gateway_Plugin extends SV_WC_Plugin {
|
|
384 |
|
385 |
/**
|
386 |
* Convenience method to add delayed admin notices, which may depend upon
|
387 |
-
* some setting being saved prior to determining whether to render
|
388 |
*
|
389 |
* @since 3.0.0
|
|
|
390 |
* @see SV_WC_Plugin::add_delayed_admin_notices()
|
391 |
*/
|
392 |
public function add_delayed_admin_notices() {
|
393 |
|
394 |
parent::add_delayed_admin_notices();
|
395 |
|
|
|
|
|
|
|
|
|
|
|
|
|
396 |
// notices for ssl requirement
|
397 |
$this->add_ssl_admin_notices();
|
398 |
|
@@ -401,57 +563,76 @@ abstract class SV_WC_Payment_Gateway_Plugin extends SV_WC_Plugin {
|
|
401 |
|
402 |
// notices for subscriptions/pre-orders
|
403 |
$this->add_integration_requires_tokenization_notices();
|
|
|
|
|
|
|
404 |
}
|
405 |
|
406 |
|
407 |
/**
|
|
|
|
|
408 |
* Checks if SSL is required and not available and adds a dismissible admin
|
409 |
-
* notice if so.
|
410 |
-
* unless on the plugin settings page, if any
|
411 |
*
|
412 |
* @since 3.0.0
|
|
|
413 |
* @see SV_WC_Payment_Gateway_Plugin::add_admin_notices()
|
414 |
*/
|
415 |
protected function add_ssl_admin_notices() {
|
416 |
|
417 |
-
|
418 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
419 |
|
420 |
-
|
|
|
421 |
|
422 |
-
$
|
423 |
|
424 |
-
|
|
|
425 |
|
426 |
-
|
|
|
|
|
427 |
|
428 |
-
|
429 |
-
|
|
|
430 |
|
431 |
-
|
432 |
-
$message = sprintf( esc_html__( "%s: WooCommerce is not being forced over SSL; your customer's payment data may be at risk.", 'woocommerce-gateway-paypal-powered-by-braintree' ), '<strong>' . $this->get_plugin_name() . '</strong>' );
|
433 |
|
434 |
-
|
435 |
-
|
436 |
-
) );
|
437 |
|
438 |
-
|
439 |
-
|
440 |
-
|
|
|
441 |
|
442 |
-
|
443 |
-
|
444 |
}
|
445 |
}
|
446 |
}
|
447 |
|
448 |
|
449 |
/**
|
|
|
|
|
450 |
* Checks if a particular currency is required and not being used and adds a
|
451 |
-
* dismissible admin notice if so.
|
452 |
-
* user once dismissed unless on the plugin settings page, if any
|
453 |
*
|
454 |
* @since 3.0.0
|
|
|
455 |
* @see SV_WC_Payment_Gateway_Plugin::render_admin_notices()
|
456 |
*/
|
457 |
protected function add_currency_admin_notices() {
|
@@ -490,7 +671,7 @@ abstract class SV_WC_Payment_Gateway_Plugin extends SV_WC_Plugin {
|
|
490 |
'%1$s accepts payment in %2$s only. %3$sConfigure%4$s WooCommerce to accept %2$s to enable this gateway for checkout.',
|
491 |
'%1$s accepts payment in one of %2$s only. %3$sConfigure%4$s WooCommerce to accept one of %2$s to enable this gateway for checkout.',
|
492 |
count( $accepted_currencies ),
|
493 |
-
'woocommerce-
|
494 |
),
|
495 |
$name,
|
496 |
'<strong>' . implode( ', ', $accepted_currencies ) . '</strong>',
|
@@ -506,6 +687,36 @@ abstract class SV_WC_Payment_Gateway_Plugin extends SV_WC_Plugin {
|
|
506 |
}
|
507 |
|
508 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
509 |
/** Integration methods ***************************************************/
|
510 |
|
511 |
|
@@ -571,8 +782,9 @@ abstract class SV_WC_Payment_Gateway_Plugin extends SV_WC_Plugin {
|
|
571 |
* is not enabled
|
572 |
*
|
573 |
* @since 4.1.0
|
|
|
574 |
* @param string $html column content
|
575 |
-
* @param \WC_Payment_Gateway
|
576 |
* @return string html
|
577 |
*/
|
578 |
public function subscriptions_maybe_edit_renewal_support_status( $html, $gateway ) {
|
@@ -610,200 +822,6 @@ abstract class SV_WC_Payment_Gateway_Plugin extends SV_WC_Plugin {
|
|
610 |
}
|
611 |
|
612 |
|
613 |
-
/** Capture Charge Feature ******************************************************/
|
614 |
-
|
615 |
-
|
616 |
-
/**
|
617 |
-
* Capture a credit card charge for a prior authorization if this payment
|
618 |
-
* method was used for the given order, the charge hasn't already been
|
619 |
-
* captured, and the gateway supports issuing a capture request
|
620 |
-
*
|
621 |
-
* @since 1.0.0
|
622 |
-
* @param \WC_Order|int $order the order identifier or order object
|
623 |
-
*/
|
624 |
-
public function maybe_capture_charge( $order ) {
|
625 |
-
|
626 |
-
if ( ! is_object( $order ) ) {
|
627 |
-
$order = wc_get_order( $order );
|
628 |
-
}
|
629 |
-
|
630 |
-
$payment_method = SV_WC_Order_Compatibility::get_prop( $order, 'payment_method' );
|
631 |
-
|
632 |
-
// bail if the order wasn't paid for with this gateway
|
633 |
-
if ( ! $this->has_gateway( $payment_method ) ) {
|
634 |
-
return;
|
635 |
-
}
|
636 |
-
|
637 |
-
$gateway = $this->get_gateway( $payment_method );
|
638 |
-
|
639 |
-
// ensure that it supports captures
|
640 |
-
if ( ! $this->can_capture_charge( $gateway ) ) {
|
641 |
-
return;
|
642 |
-
}
|
643 |
-
|
644 |
-
// ensure the authorization is still valid for capture
|
645 |
-
if ( ! $gateway->authorization_valid_for_capture( $order ) ) {
|
646 |
-
return;
|
647 |
-
}
|
648 |
-
|
649 |
-
// remove order status change actions, otherwise we get a whole bunch of capture calls and errors
|
650 |
-
remove_action( 'woocommerce_order_action_wc_' . $this->get_id() . '_capture_charge', array( $this, 'maybe_capture_charge' ) );
|
651 |
-
|
652 |
-
// since a capture results in an update to the post object (by updating
|
653 |
-
// the paid date) we need to unhook the meta box save action, otherwise we
|
654 |
-
// can get boomeranged and change the status back to on-hold
|
655 |
-
remove_action( 'woocommerce_process_shop_order_meta', 'WC_Meta_Box_Order_Data::save', 40 );
|
656 |
-
|
657 |
-
// perform the capture
|
658 |
-
$gateway->do_credit_card_capture( $order );
|
659 |
-
}
|
660 |
-
|
661 |
-
|
662 |
-
/**
|
663 |
-
* Add a "Capture Charge" action to the Admin Order Edit Order
|
664 |
-
* Actions select if there is an authorization awaiting capture
|
665 |
-
*
|
666 |
-
* @since 1.0.0
|
667 |
-
* @param array $actions available order actions
|
668 |
-
* @return array actions
|
669 |
-
*/
|
670 |
-
public function maybe_add_capture_charge_order_action( $actions ) {
|
671 |
-
|
672 |
-
// bail adding a new order from the admin
|
673 |
-
if ( ! isset( $_REQUEST['post'] ) ) {
|
674 |
-
return $actions;
|
675 |
-
}
|
676 |
-
|
677 |
-
$order = wc_get_order( $_REQUEST['post'] );
|
678 |
-
|
679 |
-
$payment_method = SV_WC_Order_Compatibility::get_prop( $order, 'payment_method' );
|
680 |
-
|
681 |
-
// bail if the order wasn't paid for with this gateway
|
682 |
-
if ( ! $this->has_gateway( $payment_method ) ) {
|
683 |
-
return $actions;
|
684 |
-
}
|
685 |
-
|
686 |
-
$gateway = $this->get_gateway( $payment_method );
|
687 |
-
|
688 |
-
// ensure that it supports captures
|
689 |
-
if ( ! $this->can_capture_charge( $gateway ) ) {
|
690 |
-
return $actions;
|
691 |
-
}
|
692 |
-
|
693 |
-
// ensure that the authorization is still valid for capture
|
694 |
-
if ( ! $gateway->authorization_valid_for_capture( $order ) ) {
|
695 |
-
return $actions;
|
696 |
-
}
|
697 |
-
|
698 |
-
return $this->add_order_action_charge_action( $actions );
|
699 |
-
}
|
700 |
-
|
701 |
-
|
702 |
-
/**
|
703 |
-
* Adds 'Capture charge' to the Orders screen bulk action select
|
704 |
-
*
|
705 |
-
* @since 3.0.0
|
706 |
-
*/
|
707 |
-
public function maybe_add_capture_charge_bulk_order_action() {
|
708 |
-
global $post_type, $post_status;
|
709 |
-
|
710 |
-
if ( $post_type == 'shop_order' && $post_status != 'trash' ) {
|
711 |
-
|
712 |
-
// ensure at least one gateway supports capturing charge
|
713 |
-
$can_capture_charge = false;
|
714 |
-
foreach ( $this->get_gateways() as $gateway ) {
|
715 |
-
|
716 |
-
// ensure that it supports captures
|
717 |
-
if ( $this->can_capture_charge( $gateway ) ) {
|
718 |
-
$can_capture_charge = true;
|
719 |
-
break;
|
720 |
-
}
|
721 |
-
}
|
722 |
-
|
723 |
-
if ( ! $can_capture_charge ) {
|
724 |
-
return;
|
725 |
-
}
|
726 |
-
|
727 |
-
?>
|
728 |
-
<script type="text/javascript">
|
729 |
-
jQuery( document ).ready( function ( $ ) {
|
730 |
-
if ( 0 == $( 'select[name^=action] option[value=wc_capture_charge]' ).size() ) {
|
731 |
-
$( 'select[name^=action]' ).append(
|
732 |
-
$( '<option>' ).val( '<?php echo esc_js( 'wc_capture_charge' ); ?>' ).text( '<?php _e( 'Capture Charge', 'woocommerce-gateway-paypal-powered-by-braintree' ); ?>' )
|
733 |
-
);
|
734 |
-
}
|
735 |
-
});
|
736 |
-
</script>
|
737 |
-
<?php
|
738 |
-
}
|
739 |
-
}
|
740 |
-
|
741 |
-
|
742 |
-
/**
|
743 |
-
* Process the 'Capture Charge' custom bulk action on the Orders screen
|
744 |
-
* bulk action select
|
745 |
-
*
|
746 |
-
* @since 2.1.0
|
747 |
-
*/
|
748 |
-
public function process_capture_charge_bulk_order_action() {
|
749 |
-
global $typenow;
|
750 |
-
|
751 |
-
if ( 'shop_order' == $typenow ) {
|
752 |
-
|
753 |
-
// get the action
|
754 |
-
$wp_list_table = _get_list_table( 'WP_Posts_List_Table' );
|
755 |
-
$action = $wp_list_table->current_action();
|
756 |
-
|
757 |
-
// bail if not processing a capture
|
758 |
-
if ( 'wc_capture_charge' !== $action ) {
|
759 |
-
return;
|
760 |
-
}
|
761 |
-
|
762 |
-
// security check
|
763 |
-
check_admin_referer( 'bulk-posts' );
|
764 |
-
|
765 |
-
// make sure order IDs are submitted
|
766 |
-
if ( isset( $_REQUEST['post'] ) ) {
|
767 |
-
$order_ids = array_map( 'absint', $_REQUEST['post'] );
|
768 |
-
}
|
769 |
-
|
770 |
-
// return if there are no orders to export
|
771 |
-
if ( empty( $order_ids ) ) {
|
772 |
-
return;
|
773 |
-
}
|
774 |
-
|
775 |
-
// give ourselves an unlimited timeout if possible
|
776 |
-
@set_time_limit( 0 );
|
777 |
-
|
778 |
-
foreach ( $order_ids as $order_id ) {
|
779 |
-
|
780 |
-
$order = wc_get_order( $order_id );
|
781 |
-
|
782 |
-
$this->maybe_capture_charge( $order );
|
783 |
-
}
|
784 |
-
}
|
785 |
-
}
|
786 |
-
|
787 |
-
|
788 |
-
/**
|
789 |
-
* Add a "Capture Charge" action to the Admin Order Edit Order
|
790 |
-
* Actions dropdown
|
791 |
-
*
|
792 |
-
* @since 2.1.0
|
793 |
-
* @param array $actions available order actions
|
794 |
-
* @return array actions
|
795 |
-
*/
|
796 |
-
public function add_order_action_charge_action( $actions ) {
|
797 |
-
|
798 |
-
/* translators: verb, as in "Capture credit card charge".
|
799 |
-
Used when an amount has been pre-authorized before, but funds have not yet been captured (taken) from the card.
|
800 |
-
Capturing the charge will take the money from the credit card and put it in the merchant's pockets. */
|
801 |
-
$actions[ 'wc_' . $this->get_id() . '_capture_charge' ] = esc_html__( 'Capture Charge', 'woocommerce-gateway-paypal-powered-by-braintree' );
|
802 |
-
|
803 |
-
return $actions;
|
804 |
-
}
|
805 |
-
|
806 |
-
|
807 |
/**
|
808 |
* Add gateway information to the system status report.
|
809 |
*
|
@@ -829,27 +847,27 @@ abstract class SV_WC_Payment_Gateway_Plugin extends SV_WC_Plugin {
|
|
829 |
|
830 |
|
831 |
/**
|
832 |
-
*
|
833 |
*
|
834 |
-
* @since
|
835 |
-
*
|
836 |
-
* @return
|
837 |
*/
|
838 |
-
public function
|
839 |
-
|
|
|
840 |
}
|
841 |
|
842 |
|
843 |
/**
|
844 |
-
* Returns true if the gateway supports the
|
845 |
-
* can be invoked
|
846 |
*
|
847 |
* @since 1.0.0
|
848 |
-
* @param
|
849 |
-
* @return boolean true if the
|
850 |
*/
|
851 |
-
public function
|
852 |
-
return
|
853 |
}
|
854 |
|
855 |
|
@@ -859,7 +877,7 @@ abstract class SV_WC_Payment_Gateway_Plugin extends SV_WC_Plugin {
|
|
859 |
/**
|
860 |
* Gets the privacy handler instance.
|
861 |
*
|
862 |
-
* @since
|
863 |
*
|
864 |
* @return SV_WC_Payment_Gateway_Privacy
|
865 |
*/
|
@@ -869,11 +887,24 @@ abstract class SV_WC_Payment_Gateway_Plugin extends SV_WC_Plugin {
|
|
869 |
}
|
870 |
|
871 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
872 |
/**
|
873 |
* Get the admin user handler instance.
|
874 |
*
|
875 |
* @since 4.3.0
|
876 |
-
*
|
|
|
877 |
*/
|
878 |
public function get_admin_user_handler() {
|
879 |
return $this->admin_user_handler;
|
@@ -885,10 +916,11 @@ abstract class SV_WC_Payment_Gateway_Plugin extends SV_WC_Plugin {
|
|
885 |
* Defaults to woocommerce_{gateway id}_settings
|
886 |
*
|
887 |
* @since 1.0.0
|
|
|
888 |
* @param string $gateway_id
|
889 |
* @return string the gateway settings option name
|
890 |
*/
|
891 |
-
|
892 |
|
893 |
return 'woocommerce_' . $gateway_id . '_settings';
|
894 |
|
@@ -900,6 +932,7 @@ abstract class SV_WC_Payment_Gateway_Plugin extends SV_WC_Plugin {
|
|
900 |
* will not include any defaults if the gateway has yet to be saved
|
901 |
*
|
902 |
* @since 1.0.0
|
|
|
903 |
* @param string $gateway_id gateway identifier
|
904 |
* @return array settings array
|
905 |
*/
|
@@ -913,6 +946,7 @@ abstract class SV_WC_Payment_Gateway_Plugin extends SV_WC_Plugin {
|
|
913 |
* Returns true if this plugin requires SSL to function properly
|
914 |
*
|
915 |
* @since 1.0.0
|
|
|
916 |
* @return boolean true if this plugin requires ssl
|
917 |
*/
|
918 |
protected function requires_ssl() {
|
@@ -924,6 +958,7 @@ abstract class SV_WC_Payment_Gateway_Plugin extends SV_WC_Plugin {
|
|
924 |
* Gets the plugin configuration URL
|
925 |
*
|
926 |
* @since 1.0.0
|
|
|
927 |
* @see SV_WC_Plugin::get_settings_url()
|
928 |
* @param string $gateway_id the gateway identifier
|
929 |
* @return string gateway settings URL
|
@@ -944,12 +979,13 @@ abstract class SV_WC_Payment_Gateway_Plugin extends SV_WC_Plugin {
|
|
944 |
* Returns the admin configuration url for a gateway
|
945 |
*
|
946 |
* @since 3.0.0
|
|
|
947 |
* @param string $gateway_id the gateway ID
|
948 |
* @return string admin configuration url for the gateway
|
949 |
*/
|
950 |
public function get_payment_gateway_configuration_url( $gateway_id ) {
|
951 |
|
952 |
-
return admin_url( 'admin.php?page=wc-settings&tab=checkout§ion=' . $
|
953 |
}
|
954 |
|
955 |
|
@@ -957,6 +993,7 @@ abstract class SV_WC_Payment_Gateway_Plugin extends SV_WC_Plugin {
|
|
957 |
* Returns true if the current page is the admin configuration page for a gateway
|
958 |
*
|
959 |
* @since 3.0.0
|
|
|
960 |
* @param string $gateway_id the gateway ID
|
961 |
* @return boolean true if the current page is the admin configuration page for the gateway
|
962 |
*/
|
@@ -964,27 +1001,27 @@ abstract class SV_WC_Payment_Gateway_Plugin extends SV_WC_Plugin {
|
|
964 |
|
965 |
return isset( $_GET['page'] ) && 'wc-settings' == $_GET['page'] &&
|
966 |
isset( $_GET['tab'] ) && 'checkout' == $_GET['tab'] &&
|
967 |
-
isset( $_GET['section'] ) && $
|
968 |
}
|
969 |
|
970 |
|
971 |
/**
|
972 |
* Get a gateway's settings screen section ID.
|
973 |
*
|
|
|
|
|
|
|
974 |
* @since 4.4.0
|
|
|
|
|
975 |
* @param string $gateway_id the gateway ID
|
976 |
* @return string
|
977 |
*/
|
978 |
public function get_payment_gateway_configuration_section( $gateway_id ) {
|
979 |
|
980 |
-
|
981 |
-
if ( SV_WC_Plugin_Compatibility::is_wc_version_lt_2_6() ) {
|
982 |
-
$section = $this->get_gateway_class_name( $gateway_id );
|
983 |
-
} else {
|
984 |
-
$section = $gateway_id;
|
985 |
-
}
|
986 |
|
987 |
-
return strtolower( $
|
988 |
}
|
989 |
|
990 |
|
@@ -993,6 +1030,7 @@ abstract class SV_WC_Payment_Gateway_Plugin extends SV_WC_Plugin {
|
|
993 |
* supported by this plugin
|
994 |
*
|
995 |
* @since 1.0.0
|
|
|
996 |
* @param string $gateway_id the gateway identifier
|
997 |
* @param string $gateway_class_name the corresponding gateway class name
|
998 |
*/
|
@@ -1007,6 +1045,7 @@ abstract class SV_WC_Payment_Gateway_Plugin extends SV_WC_Plugin {
|
|
1007 |
* unless the plugin supports credit card and echeck variations
|
1008 |
*
|
1009 |
* @since 1.0.0
|
|
|
1010 |
* @return array of string gateway class names
|
1011 |
*/
|
1012 |
public function get_gateway_class_names() {
|
@@ -1027,6 +1066,7 @@ abstract class SV_WC_Payment_Gateway_Plugin extends SV_WC_Plugin {
|
|
1027 |
* Gets the gateway class name for the given gateway id
|
1028 |
*
|
1029 |
* @since 1.0.0
|
|
|
1030 |
* @param string $gateway_id the gateway identifier
|
1031 |
* @return string gateway class name
|
1032 |
*/
|
@@ -1043,7 +1083,8 @@ abstract class SV_WC_Payment_Gateway_Plugin extends SV_WC_Plugin {
|
|
1043 |
* unless the plugin supports credit card and echeck variations
|
1044 |
*
|
1045 |
* @since 1.0.0
|
1046 |
-
*
|
|
|
1047 |
*/
|
1048 |
public function get_gateways() {
|
1049 |
|
@@ -1063,6 +1104,7 @@ abstract class SV_WC_Payment_Gateway_Plugin extends SV_WC_Plugin {
|
|
1063 |
* Adds the given $gateway to the internal gateways store
|
1064 |
*
|
1065 |
* @since 2.2.0
|
|
|
1066 |
* @param string $gateway_id the gateway identifier
|
1067 |
* @param SV_WC_Payment_Gateway $gateway the gateway object
|
1068 |
*/
|
@@ -1075,6 +1117,7 @@ abstract class SV_WC_Payment_Gateway_Plugin extends SV_WC_Plugin {
|
|
1075 |
* Returns the identified gateway object
|
1076 |
*
|
1077 |
* @since 1.0.0
|
|
|
1078 |
* @param string $gateway_id optional gateway identifier, defaults to first gateway, which will be the credit card gateway in plugins with support for both credit cards and echecks
|
1079 |
* @return SV_WC_Payment_Gateway the gateway object
|
1080 |
*/
|
@@ -1101,6 +1144,7 @@ abstract class SV_WC_Payment_Gateway_Plugin extends SV_WC_Plugin {
|
|
1101 |
* Returns true if the plugin supports this gateway
|
1102 |
*
|
1103 |
* @since 1.0.0
|
|
|
1104 |
* @param string $gateway_id the gateway identifier
|
1105 |
* @return boolean true if the plugin has this gateway available, false otherwise
|
1106 |
*/
|
@@ -1113,6 +1157,7 @@ abstract class SV_WC_Payment_Gateway_Plugin extends SV_WC_Plugin {
|
|
1113 |
* Returns all available gateway ids for the plugin
|
1114 |
*
|
1115 |
* @since 1.0.0
|
|
|
1116 |
* @return array of gateway id strings
|
1117 |
*/
|
1118 |
public function get_gateway_ids() {
|
@@ -1127,9 +1172,10 @@ abstract class SV_WC_Payment_Gateway_Plugin extends SV_WC_Plugin {
|
|
1127 |
* Returns the gateway for a given token
|
1128 |
*
|
1129 |
* @since 4.0.0
|
|
|
1130 |
* @param string|int $user_id the user ID associated with the token
|
1131 |
* @param string $token the token string
|
1132 |
-
* @return
|
1133 |
*/
|
1134 |
public function get_gateway_from_token( $user_id, $token ) {
|
1135 |
|
@@ -1150,6 +1196,7 @@ abstract class SV_WC_Payment_Gateway_Plugin extends SV_WC_Plugin {
|
|
1150 |
* files separated by gateway ID
|
1151 |
*
|
1152 |
* @see SV_WC_Plugin::add_api_request_logging()
|
|
|
1153 |
* @since 2.2.0
|
1154 |
*/
|
1155 |
public function add_api_request_logging() { }
|
@@ -1161,6 +1208,7 @@ abstract class SV_WC_Payment_Gateway_Plugin extends SV_WC_Plugin {
|
|
1161 |
* any gateways this plugin supports.
|
1162 |
*
|
1163 |
* @since 1.0.0
|
|
|
1164 |
* @return array of accepted currencies
|
1165 |
*/
|
1166 |
public function get_accepted_currencies() {
|
@@ -1172,6 +1220,7 @@ abstract class SV_WC_Payment_Gateway_Plugin extends SV_WC_Plugin {
|
|
1172 |
* Checks is WooCommerce Subscriptions is active
|
1173 |
*
|
1174 |
* @since 1.0.0
|
|
|
1175 |
* @return bool true if the WooCommerce Subscriptions plugin is active, false if not active
|
1176 |
*/
|
1177 |
public function is_subscriptions_active() {
|
@@ -1188,6 +1237,7 @@ abstract class SV_WC_Payment_Gateway_Plugin extends SV_WC_Plugin {
|
|
1188 |
* Checks is WooCommerce Pre-Orders is active
|
1189 |
*
|
1190 |
* @since 1.0.0
|
|
|
1191 |
* @return bool true if WC Pre-Orders is active, false if not active
|
1192 |
*/
|
1193 |
public function is_pre_orders_active() {
|
@@ -1204,6 +1254,7 @@ abstract class SV_WC_Payment_Gateway_Plugin extends SV_WC_Plugin {
|
|
1204 |
* Returns the loaded payment gateway framework __FILE__
|
1205 |
*
|
1206 |
* @since 4.0.0
|
|
|
1207 |
* @return string
|
1208 |
*/
|
1209 |
public function get_payment_gateway_framework_file() {
|
@@ -1219,6 +1270,7 @@ abstract class SV_WC_Payment_Gateway_Plugin extends SV_WC_Plugin {
|
|
1219 |
* the bootstrap.
|
1220 |
*
|
1221 |
* @since 4.0.0
|
|
|
1222 |
* @return string
|
1223 |
*/
|
1224 |
public function get_payment_gateway_framework_path() {
|
@@ -1232,6 +1284,7 @@ abstract class SV_WC_Payment_Gateway_Plugin extends SV_WC_Plugin {
|
|
1232 |
* directory, without a trailing slash
|
1233 |
*
|
1234 |
* @since 4.0.0
|
|
|
1235 |
* @return string relative path to framework image directory
|
1236 |
*/
|
1237 |
public function get_payment_gateway_framework_assets_path() {
|
@@ -1244,6 +1297,7 @@ abstract class SV_WC_Payment_Gateway_Plugin extends SV_WC_Plugin {
|
|
1244 |
* Returns the loaded payment gateway framework assets URL, without a trailing slash
|
1245 |
*
|
1246 |
* @since 4.0.0
|
|
|
1247 |
* @return string
|
1248 |
*/
|
1249 |
public function get_payment_gateway_framework_assets_url() {
|
18 |
*
|
19 |
* @package SkyVerge/WooCommerce/Payment-Gateway/Classes
|
20 |
* @author SkyVerge
|
21 |
+
* @copyright Copyright (c) 2013-2018, SkyVerge, Inc.
|
22 |
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
|
23 |
*/
|
24 |
|
25 |
+
namespace WC_Braintree\Plugin_Framework;
|
26 |
|
27 |
defined( 'ABSPATH' ) or exit;
|
28 |
|
29 |
+
if ( ! class_exists( '\\WC_Braintree\\Plugin_Framework\\SV_WC_Payment_Gateway_Plugin' ) ) :
|
30 |
|
31 |
/**
|
32 |
* # WooCommerce Payment Gateway Plugin Framework
|
87 |
/** @var SV_WC_Payment_Gateway_Privacy payment gateway privacy handler instance */
|
88 |
protected $privacy_handler;
|
89 |
|
90 |
+
/** @var SV_WC_Payment_Gateway_Admin_Order order handler instance */
|
91 |
+
protected $admin_order_handler;
|
92 |
|
93 |
+
/** @var SV_WC_Payment_Gateway_Admin_User_Handler user handler instance */
|
94 |
protected $admin_user_handler;
|
95 |
|
96 |
/** @var SV_WC_Payment_Gateway_My_Payment_Methods adds My Payment Method functionality */
|
97 |
private $my_payment_methods;
|
98 |
|
99 |
+
/** @var SV_WC_Payment_Gateway_Apple_Pay the Apple Pay handler instance */
|
100 |
+
private $apple_pay;
|
101 |
+
|
102 |
|
103 |
/**
|
104 |
+
* Initializes the plugin.
|
105 |
*
|
106 |
* Optional args:
|
107 |
*
|
111 |
* + `supports` - array named features that this gateway supports, including 'tokenization', 'transaction_link', 'customer_id', 'capture_charge'
|
112 |
*
|
113 |
* @since 1.0.0
|
114 |
+
*
|
115 |
* @see SV_WC_Plugin::__construct()
|
116 |
* @param string $id plugin id
|
117 |
* @param string $version plugin version number
|
121 |
|
122 |
parent::__construct( $id, $version, $args );
|
123 |
|
124 |
+
$args = wp_parse_args( $args, array(
|
125 |
+
'gateways' => array(),
|
126 |
+
'currencies' => array(),
|
127 |
+
'supports' => array(),
|
128 |
+
'require_ssl' => false,
|
129 |
+
) );
|
|
|
130 |
|
131 |
+
// add each gateway
|
132 |
+
foreach ( $args['gateways'] as $gateway_id => $gateway_class_name ) {
|
133 |
+
$this->add_gateway( $gateway_id, $gateway_class_name );
|
|
|
|
|
|
|
|
|
|
|
134 |
}
|
135 |
|
136 |
+
$this->currencies = (array) $args['currencies'];
|
137 |
+
$this->supports = (array) $args['supports'];
|
138 |
+
$this->require_ssl = (array) $args['require_ssl'];
|
139 |
|
140 |
+
// require the files
|
141 |
+
$this->includes();
|
142 |
|
143 |
+
// add the action & filter hooks
|
144 |
+
$this->add_hooks();
|
145 |
+
}
|
146 |
|
|
|
147 |
|
148 |
+
/**
|
149 |
+
* Builds the REST API handler instance.
|
150 |
+
*
|
151 |
+
* Gateway plugins can override this to add their own data and/or routes.
|
152 |
+
*
|
153 |
+
* @see SV_WC_Plugin::init_rest_api_handler()
|
154 |
+
*
|
155 |
+
* @since 5.2.0
|
156 |
+
*/
|
157 |
+
protected function init_rest_api_handler() {
|
158 |
|
159 |
+
require_once( $this->get_payment_gateway_framework_path() . '/rest-api/class-sv-wc-payment-gateway-plugin-rest-api.php' );
|
|
|
|
|
|
|
160 |
|
161 |
+
$this->rest_api_handler = new Payment_Gateway\REST_API( $this );
|
162 |
+
}
|
163 |
|
|
|
|
|
|
|
|
|
164 |
|
165 |
+
/**
|
166 |
+
* Adds the action & filter hooks.
|
167 |
+
*
|
168 |
+
* @since 5.2.0
|
169 |
+
*/
|
170 |
+
private function add_hooks() {
|
171 |
|
172 |
+
// add classes to WC Payment Methods
|
173 |
add_filter( 'woocommerce_payment_gateways', array( $this, 'load_gateways' ) );
|
174 |
|
175 |
+
// adjust the available gateways in certain cases
|
176 |
add_filter( 'woocommerce_available_payment_gateways', array( $this, 'adjust_available_gateways' ) );
|
177 |
+
|
178 |
+
// my payment methods feature
|
179 |
+
add_action( 'init', array( $this, 'maybe_init_my_payment_methods' ) );
|
180 |
+
|
181 |
+
// apple pay feature
|
182 |
+
add_action( 'init', array( $this, 'maybe_init_apple_pay' ) );
|
183 |
+
|
184 |
+
// TODO: move these to Subscriptions integration
|
185 |
+
if ( $this->is_subscriptions_active() ) {
|
186 |
+
|
187 |
+
// filter the payment gateway table on the checkout settings screen to indicate if a gateway can support Subscriptions but requires tokenization to be enabled
|
188 |
+
add_action( 'admin_print_styles', array( $this, 'subscriptions_add_renewal_support_status_inline_style' ) );
|
189 |
+
add_filter( 'woocommerce_payment_gateways_renewal_support_status_html', array( $this, 'subscriptions_maybe_edit_renewal_support_status' ), 10, 2 );
|
190 |
+
}
|
191 |
+
|
192 |
+
// add gateway information to the system status report
|
193 |
+
add_action( 'woocommerce_system_status_report', array( $this, 'add_system_status_information' ) );
|
194 |
}
|
195 |
|
196 |
|
197 |
/**
|
198 |
+
* Initializes the plugin admin.
|
199 |
+
*
|
200 |
+
* @internal
|
201 |
+
* @see SV_WC_Plugin::init_admin()
|
202 |
+
*
|
203 |
+
* @since 5.2.0
|
204 |
+
*/
|
205 |
+
public function init_admin() {
|
206 |
+
|
207 |
+
parent::init_admin();
|
208 |
+
|
209 |
+
$this->admin_order_handler = new SV_WC_Payment_Gateway_Admin_Order( $this );
|
210 |
+
$this->admin_user_handler = new SV_WC_Payment_Gateway_Admin_User_Handler( $this );
|
211 |
+
}
|
212 |
+
|
213 |
+
|
214 |
+
/**
|
215 |
+
* Adds any gateways supported by this plugin to the list of available payment gateways.
|
216 |
+
*
|
217 |
+
* @internal
|
218 |
*
|
219 |
* @since 1.0.0
|
220 |
+
*
|
221 |
* @param array $gateways
|
222 |
* @return array $gateways
|
223 |
*/
|
231 |
* Adjust the available gateways in certain cases.
|
232 |
*
|
233 |
* @since 4.4.0
|
234 |
+
*
|
235 |
* @param array $available_gateways the available payment gateways
|
236 |
* @return array
|
237 |
*/
|
253 |
|
254 |
|
255 |
/**
|
256 |
+
* Include required files.
|
257 |
+
*
|
258 |
+
* @internal
|
259 |
*
|
260 |
* @since 1.0.0
|
|
|
261 |
*/
|
262 |
+
private function includes() {
|
|
|
|
|
263 |
|
264 |
$payment_gateway_framework_path = $this->get_payment_gateway_framework_path();
|
265 |
|
270 |
require_once( $payment_gateway_framework_path . '/api/interface-sv-wc-payment-gateway-api-authorization-response.php' );
|
271 |
require_once( $payment_gateway_framework_path . '/api/interface-sv-wc-payment-gateway-api-create-payment-token-response.php' );
|
272 |
require_once( $payment_gateway_framework_path . '/api/interface-sv-wc-payment-gateway-api-get-tokenized-payment-methods-response.php' );
|
273 |
+
require_once( $payment_gateway_framework_path . '/api/interface-sv-wc-payment-gateway-api-payment-notification-response.php' );
|
274 |
+
require_once( $payment_gateway_framework_path . '/api/interface-sv-wc-payment-gateway-api-payment-notification-credit-card-response.php' );
|
275 |
+
require_once( $payment_gateway_framework_path . '/api/interface-sv-wc-payment-gateway-api-payment-notification-echeck-response.php' );
|
276 |
+
require_once( $payment_gateway_framework_path . '/api/interface-sv-wc-payment-gateway-api-payment-notification-tokenization-response.php' );
|
277 |
require_once( $payment_gateway_framework_path . '/api/interface-sv-wc-payment-gateway-api-customer-response.php' );
|
278 |
|
279 |
// exceptions
|
282 |
// gateway
|
283 |
require_once( $payment_gateway_framework_path . '/class-sv-wc-payment-gateway.php' );
|
284 |
require_once( $payment_gateway_framework_path . '/class-sv-wc-payment-gateway-direct.php' );
|
285 |
+
require_once( $payment_gateway_framework_path . '/class-sv-wc-payment-gateway-hosted.php' );
|
286 |
require_once( $payment_gateway_framework_path . '/class-sv-wc-payment-gateway-payment-form.php' );
|
287 |
require_once( $payment_gateway_framework_path . '/class-sv-wc-payment-gateway-my-payment-methods.php' );
|
288 |
|
289 |
+
// handlers
|
290 |
+
require_once( $payment_gateway_framework_path . '/Handlers/Capture.php' );
|
291 |
+
|
292 |
+
// apple pay
|
293 |
+
require_once( "{$payment_gateway_framework_path}/apple-pay/class-sv-wc-payment-gateway-apple-pay.php" );
|
294 |
+
require_once( "{$payment_gateway_framework_path}/apple-pay/class-sv-wc-payment-gateway-apple-pay-admin.php" );
|
295 |
+
require_once( "{$payment_gateway_framework_path}/apple-pay/class-sv-wc-payment-gateway-apple-pay-frontend.php" );
|
296 |
+
require_once( "{$payment_gateway_framework_path}/apple-pay/class-sv-wc-payment-gateway-apple-pay-ajax.php" );
|
297 |
+
require_once( "{$payment_gateway_framework_path}/apple-pay/class-sv-wc-payment-gateway-apple-pay-orders.php" );
|
298 |
+
require_once( "{$payment_gateway_framework_path}/apple-pay/api/class-sv-wc-payment-gateway-apple-pay-payment-response.php" );
|
299 |
+
|
300 |
// payment tokens
|
301 |
require_once( $payment_gateway_framework_path . '/payment-tokens/class-sv-wc-payment-gateway-payment-token.php' );
|
302 |
require_once( $payment_gateway_framework_path . '/payment-tokens/class-sv-wc-payment-gateway-payment-tokens-handler.php' );
|
305 |
require_once( $payment_gateway_framework_path . '/api/class-sv-wc-payment-gateway-api-response-message-helper.php' );
|
306 |
require_once( $payment_gateway_framework_path . '/class-sv-wc-payment-gateway-helper.php' );
|
307 |
|
308 |
+
// admin
|
309 |
+
require_once( $payment_gateway_framework_path . '/admin/class-sv-wc-payment-gateway-admin-order.php' );
|
310 |
+
require_once( $payment_gateway_framework_path . '/admin/class-sv-wc-payment-gateway-admin-user-handler.php' );
|
311 |
+
require_once( $payment_gateway_framework_path . '/admin/class-sv-wc-payment-gateway-admin-payment-token-editor.php' );
|
312 |
+
|
313 |
+
|
314 |
// integrations
|
315 |
require_once( $payment_gateway_framework_path . '/integrations/abstract-sv-wc-payment-gateway-integration.php' );
|
316 |
|
325 |
}
|
326 |
|
327 |
// privacy
|
328 |
+
if ( SV_WC_Plugin_Compatibility::is_wc_version_gte( '3.4' ) ) {
|
329 |
require_once( "{$payment_gateway_framework_path}/class-sv-wc-payment-gateway-privacy.php" );
|
330 |
$this->privacy_handler = new SV_WC_Payment_Gateway_Privacy( $this );
|
331 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
332 |
}
|
333 |
|
334 |
|
338 |
/**
|
339 |
* Instantiates the My Payment Methods table class instance when a user is
|
340 |
* logged in on an account page and tokenization is enabled for at least
|
341 |
+
* one of the active gateways.
|
342 |
+
*
|
343 |
+
* @internal
|
344 |
*
|
345 |
* @since 4.0.0
|
346 |
*/
|
347 |
public function maybe_init_my_payment_methods() {
|
348 |
|
349 |
+
// bail if not frontend or an AJAX request
|
350 |
+
if ( is_admin() && ! is_ajax() ) {
|
351 |
+
return;
|
352 |
+
}
|
353 |
|
354 |
+
if ( $this->supports_my_payment_methods() && $this->tokenization_enabled() && is_user_logged_in() ) {
|
355 |
$this->my_payment_methods = $this->get_my_payment_methods_instance();
|
356 |
}
|
357 |
}
|
362 |
* active gateway
|
363 |
*
|
364 |
* @since 4.2.0
|
365 |
+
*
|
366 |
* @return bool
|
367 |
*/
|
368 |
public function tokenization_enabled() {
|
379 |
|
380 |
|
381 |
/**
|
382 |
+
* Gets the My Payment Methods table instance.
|
383 |
+
*
|
384 |
+
* Overrideable by concrete gateway plugins to return a custom instance as needed
|
385 |
*
|
386 |
* @since 4.0.0
|
387 |
+
*
|
388 |
+
* @return SV_WC_Payment_Gateway_My_Payment_Methods
|
389 |
*/
|
390 |
protected function get_my_payment_methods_instance() {
|
391 |
|
393 |
}
|
394 |
|
395 |
|
396 |
+
/**
|
397 |
+
* Determines whether the My Payment Methods feature is supported.
|
398 |
+
*
|
399 |
+
* @since 5.1.0
|
400 |
+
*
|
401 |
+
* @return bool
|
402 |
+
*/
|
403 |
+
public function supports_my_payment_methods() {
|
404 |
+
|
405 |
+
return $this->supports( self::FEATURE_MY_PAYMENT_METHODS );
|
406 |
+
}
|
407 |
+
|
408 |
+
|
409 |
+
/** Apple Pay *************************************************************/
|
410 |
+
|
411 |
+
|
412 |
+
/**
|
413 |
+
* Initializes Apple Pay if it's supported.
|
414 |
+
*
|
415 |
+
* @since 4.7.0
|
416 |
+
*/
|
417 |
+
public function maybe_init_apple_pay() {
|
418 |
+
|
419 |
+
/**
|
420 |
+
* Filters whether Apple Pay is activated.
|
421 |
+
*
|
422 |
+
* @since 4.7.0
|
423 |
+
*
|
424 |
+
* @param bool $activated whether Apple Pay is activated
|
425 |
+
*/
|
426 |
+
$activated = (bool) apply_filters( 'wc_payment_gateway_' . $this->get_id() . '_activate_apple_pay', false );
|
427 |
+
|
428 |
+
if ( $this->supports_apple_pay() && $activated ) {
|
429 |
+
$this->apple_pay = $this->build_apple_pay_instance();
|
430 |
+
}
|
431 |
+
}
|
432 |
+
|
433 |
+
|
434 |
+
/**
|
435 |
+
* Builds the Apple Pay handler instance.
|
436 |
+
*
|
437 |
+
* Gateways can override this to define their own Apple Pay class.
|
438 |
+
*
|
439 |
+
* @since 4.7.0
|
440 |
+
*
|
441 |
+
* @return SV_WC_Payment_Gateway_Apple_Pay
|
442 |
+
*/
|
443 |
+
protected function build_apple_pay_instance() {
|
444 |
+
|
445 |
+
return new SV_WC_Payment_Gateway_Apple_Pay( $this );
|
446 |
+
}
|
447 |
+
|
448 |
+
|
449 |
+
/**
|
450 |
+
* Gets the Apple Pay handler instance.
|
451 |
+
*
|
452 |
+
* @since 4.7.0
|
453 |
+
*
|
454 |
+
* @return SV_WC_Payment_Gateway_Apple_Pay
|
455 |
+
*/
|
456 |
+
public function get_apple_pay_instance() {
|
457 |
+
|
458 |
+
return $this->apple_pay;
|
459 |
+
}
|
460 |
+
|
461 |
+
|
462 |
+
/**
|
463 |
+
* Determines if this plugin has any gateways with Apple Pay support.
|
464 |
+
*
|
465 |
+
* @since 4.7.0
|
466 |
+
*
|
467 |
+
* @return bool
|
468 |
+
*/
|
469 |
+
public function supports_apple_pay() {
|
470 |
+
|
471 |
+
$is_supported = false;
|
472 |
+
|
473 |
+
foreach ( $this->get_gateways() as $gateway ) {
|
474 |
+
|
475 |
+
if ( $gateway->supports_apple_pay() ) {
|
476 |
+
$is_supported = true;
|
477 |
+
}
|
478 |
+
}
|
479 |
+
|
480 |
+
return $is_supported;
|
481 |
+
}
|
482 |
+
|
483 |
+
|
484 |
/** Admin methods ******************************************************/
|
485 |
|
486 |
|
487 |
/**
|
488 |
+
* Adds the gateway plugin action links.
|
|
|
489 |
*
|
|
|
490 |
* @see SV_WC_Plugin::plugin_action_links()
|
491 |
+
*
|
492 |
+
* @since 1.0.0
|
493 |
+
*
|
494 |
+
* @param string[] $actions associative array of action names to anchor tags
|
495 |
+
* @return string[]
|
496 |
*/
|
497 |
public function plugin_action_links( $actions ) {
|
498 |
|
516 |
|
517 |
|
518 |
/**
|
519 |
+
* Determines if on the admin gateway settings screen for this plugin.
|
520 |
+
*
|
521 |
* Multi-gateway plugins will return true if on either settings page
|
522 |
*
|
523 |
* @since 2.0.0
|
524 |
+
*
|
525 |
* @see SV_WC_Plugin::is_plugin_settings()
|
526 |
+
* @return bool
|
527 |
*/
|
528 |
public function is_plugin_settings() {
|
529 |
|
539 |
|
540 |
/**
|
541 |
* Convenience method to add delayed admin notices, which may depend upon
|
542 |
+
* some setting being saved prior to determining whether to render.
|
543 |
*
|
544 |
* @since 3.0.0
|
545 |
+
*
|
546 |
* @see SV_WC_Plugin::add_delayed_admin_notices()
|
547 |
*/
|
548 |
public function add_delayed_admin_notices() {
|
549 |
|
550 |
parent::add_delayed_admin_notices();
|
551 |
|
552 |
+
// reload all gateway settings so notices are correct after saving the settings
|
553 |
+
foreach ( $this->get_gateways() as $gateway ) {
|
554 |
+
$gateway->init_settings();
|
555 |
+
$gateway->load_settings();
|
556 |
+
}
|
557 |
+
|
558 |
// notices for ssl requirement
|
559 |
$this->add_ssl_admin_notices();
|
560 |
|
563 |
|
564 |
// notices for subscriptions/pre-orders
|
565 |
$this->add_integration_requires_tokenization_notices();
|
566 |
+
|
567 |
+
// add notices about enabled debug logging
|
568 |
+
$this->add_debug_setting_notices();
|
569 |
}
|
570 |
|
571 |
|
572 |
/**
|
573 |
+
* Adds any SSL admin notices.
|
574 |
+
*
|
575 |
* Checks if SSL is required and not available and adds a dismissible admin
|
576 |
+
* notice if so.
|
|
|
577 |
*
|
578 |
* @since 3.0.0
|
579 |
+
*
|
580 |
* @see SV_WC_Payment_Gateway_Plugin::add_admin_notices()
|
581 |
*/
|
582 |
protected function add_ssl_admin_notices() {
|
583 |
|
584 |
+
if ( ! $this->requires_ssl() ) {
|
585 |
+
return;
|
586 |
+
}
|
587 |
+
|
588 |
+
foreach ( $this->get_gateways() as $gateway ) {
|
589 |
+
|
590 |
+
// don't display any notices for disabled gateways
|
591 |
+
if ( ! $gateway->is_enabled() ) {
|
592 |
+
continue;
|
593 |
+
}
|
594 |
|
595 |
+
// SSL check if gateway enabled/production mode
|
596 |
+
if ( ! wc_checkout_is_https() ) {
|
597 |
|
598 |
+
if ( $gateway->is_production_environment() && $this->get_admin_notice_handler()->should_display_notice( 'ssl-required' ) ) {
|
599 |
|
600 |
+
/* translators: Placeholders: %s - plugin name */
|
601 |
+
$message = sprintf( esc_html__( "%s: WooCommerce is not being forced over SSL; your customer's payment data may be at risk.", 'woocommerce-gateway-paypal-powered-by-braintree' ), '<strong>' . $this->get_plugin_name() . '</strong>' );
|
602 |
|
603 |
+
$this->get_admin_notice_handler()->add_admin_notice( $message, 'ssl-required', array(
|
604 |
+
'notice_class' => 'error',
|
605 |
+
) );
|
606 |
|
607 |
+
// just show the message once for plugins with multiple gateway support
|
608 |
+
break;
|
609 |
+
}
|
610 |
|
611 |
+
} elseif ( $gateway->get_api() && is_callable( array( $gateway->get_api(), 'require_tls_1_2' ) ) && is_callable( array( $gateway->get_api(), 'is_tls_1_2_available' ) ) && $gateway->get_api()->require_tls_1_2() && ! $gateway->get_api()->is_tls_1_2_available() ) {
|
|
|
612 |
|
613 |
+
/* translators: Placeholders: %s - payment gateway name */
|
614 |
+
$message = sprintf( esc_html__( "%s will soon require TLS 1.2 support to process transactions and your server environment may need to be updated. Please contact your hosting provider to confirm that your site can send and receive TLS 1.2 connections and request they make any necessary updates.", 'woocommerce-gateway-paypal-powered-by-braintree' ), '<strong>' . $gateway->get_method_title() . '</strong>' );
|
|
|
615 |
|
616 |
+
$this->get_admin_notice_handler()->add_admin_notice( $message, 'tls-1-2-required', array(
|
617 |
+
'notice_class' => 'notice-warning',
|
618 |
+
'always_show_on_settings' => false,
|
619 |
+
) );
|
620 |
|
621 |
+
// just show the message once for plugins with multiple gateway support
|
622 |
+
break;
|
623 |
}
|
624 |
}
|
625 |
}
|
626 |
|
627 |
|
628 |
/**
|
629 |
+
* Adds any currency admin notices.
|
630 |
+
*
|
631 |
* Checks if a particular currency is required and not being used and adds a
|
632 |
+
* dismissible admin notice if so.
|
|
|
633 |
*
|
634 |
* @since 3.0.0
|
635 |
+
*
|
636 |
* @see SV_WC_Payment_Gateway_Plugin::render_admin_notices()
|
637 |
*/
|
638 |
protected function add_currency_admin_notices() {
|
671 |
'%1$s accepts payment in %2$s only. %3$sConfigure%4$s WooCommerce to accept %2$s to enable this gateway for checkout.',
|
672 |
'%1$s accepts payment in one of %2$s only. %3$sConfigure%4$s WooCommerce to accept one of %2$s to enable this gateway for checkout.',
|
673 |
count( $accepted_currencies ),
|
674 |
+
'woocommerce-gateway-paypal-powered-by-braintree'
|
675 |
),
|
676 |
$name,
|
677 |
'<strong>' . implode( ', ', $accepted_currencies ) . '</strong>',
|
687 |
}
|
688 |
|
689 |
|
690 |
+
/**
|
691 |
+
* Adds notices about enabled debug logging.
|
692 |
+
*
|
693 |
+
* @since 5.3.0-dev
|
694 |
+
*/
|
695 |
+
protected function add_debug_setting_notices() {
|
696 |
+
|
697 |
+
foreach ( $this->get_gateways() as $gateway ) {
|
698 |
+
|
699 |
+
if ( $gateway->is_enabled() && $gateway->is_production_environment() && ! $gateway->debug_off() ) {
|
700 |
+
|
701 |
+
$is_gateway_settings = $this->is_payment_gateway_configuration_page( $gateway->get_id() );
|
702 |
+
|
703 |
+
$message = sprintf(
|
704 |
+
/* translators: Placeholders: %1$s - payment gateway name, %2$s - opening <a> tag, %3$s - closing </a> tag */
|
705 |
+
__( 'Heads up! %1$s is currently configured to log transaction data for debugging purposes. If you are not experiencing any problems with payment processing, we recommend %2$sturning off Debug Mode%3$s', 'woocommerce-gateway-paypal-powered-by-braintree' ),
|
706 |
+
$gateway->get_method_title(),
|
707 |
+
! $is_gateway_settings ? '<a href="' . esc_url( $this->get_payment_gateway_configuration_url( $gateway->get_id() ) ) . '">' : '', ! $is_gateway_settings ? ' »</a>' : ''
|
708 |
+
);
|
709 |
+
|
710 |
+
$this->get_admin_notice_handler()->add_admin_notice( $message, 'debug-in-production', array(
|
711 |
+
'notice_class' => 'notice-warning',
|
712 |
+
) );
|
713 |
+
|
714 |
+
break;
|
715 |
+
}
|
716 |
+
}
|
717 |
+
}
|
718 |
+
|
719 |
+
|
720 |
/** Integration methods ***************************************************/
|
721 |
|
722 |
|
782 |
* is not enabled
|
783 |
*
|
784 |
* @since 4.1.0
|
785 |
+
*
|
786 |
* @param string $html column content
|
787 |
+
* @param \WC_Payment_Gateway|SV_WC_Payment_Gateway $gateway payment gateway being checked for support
|
788 |
* @return string html
|
789 |
*/
|
790 |
public function subscriptions_maybe_edit_renewal_support_status( $html, $gateway ) {
|
822 |
}
|
823 |
|
824 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
825 |
/**
|
826 |
* Add gateway information to the system status report.
|
827 |
*
|
847 |
|
848 |
|
849 |
/**
|
850 |
+
* Determines if the plugin supports the capture charge feature.
|
851 |
*
|
852 |
+
* @since 5.0.0
|
853 |
+
*
|
854 |
+
* @return bool
|
855 |
*/
|
856 |
+
public function supports_capture_charge() {
|
857 |
+
|
858 |
+
return $this->supports( self::FEATURE_CAPTURE_CHARGE );
|
859 |
}
|
860 |
|
861 |
|
862 |
/**
|
863 |
+
* Returns true if the gateway supports the named feature
|
|
|
864 |
*
|
865 |
* @since 1.0.0
|
866 |
+
* @param string $feature the feature
|
867 |
+
* @return boolean true if the named feature is supported
|
868 |
*/
|
869 |
+
public function supports( $feature ) {
|
870 |
+
return in_array( $feature, $this->supports );
|
871 |
}
|
872 |
|
873 |
|
877 |
/**
|
878 |
* Gets the privacy handler instance.
|
879 |
*
|
880 |
+
* @since 5.1.4
|
881 |
*
|
882 |
* @return SV_WC_Payment_Gateway_Privacy
|
883 |
*/
|
887 |
}
|
888 |
|
889 |
|
890 |
+
/**
|
891 |
+
* Get the admin order handler instance.
|
892 |
+
*
|
893 |
+
* @since 5.0.0
|
894 |
+
*
|
895 |
+
* @return SV_WC_Payment_Gateway_Admin_Order
|
896 |
+
*/
|
897 |
+
public function get_admin_order_handler() {
|
898 |
+
return $this->admin_order_handler;
|
899 |
+
}
|
900 |
+
|
901 |
+
|
902 |
/**
|
903 |
* Get the admin user handler instance.
|
904 |
*
|
905 |
* @since 4.3.0
|
906 |
+
*
|
907 |
+
* @return SV_WC_Payment_Gateway_Admin_User_Handler
|
908 |
*/
|
909 |
public function get_admin_user_handler() {
|
910 |
return $this->admin_user_handler;
|
916 |
* Defaults to woocommerce_{gateway id}_settings
|
917 |
*
|
918 |
* @since 1.0.0
|
919 |
+
*
|
920 |
* @param string $gateway_id
|
921 |
* @return string the gateway settings option name
|
922 |
*/
|
923 |
+
public function get_gateway_settings_name( $gateway_id ) {
|
924 |
|
925 |
return 'woocommerce_' . $gateway_id . '_settings';
|
926 |
|
932 |
* will not include any defaults if the gateway has yet to be saved
|
933 |
*
|
934 |
* @since 1.0.0
|
935 |
+
*
|
936 |
* @param string $gateway_id gateway identifier
|
937 |
* @return array settings array
|
938 |
*/
|
946 |
* Returns true if this plugin requires SSL to function properly
|
947 |
*
|
948 |
* @since 1.0.0
|
949 |
+
*
|
950 |
* @return boolean true if this plugin requires ssl
|
951 |
*/
|
952 |
protected function requires_ssl() {
|
958 |
* Gets the plugin configuration URL
|
959 |
*
|
960 |
* @since 1.0.0
|
961 |
+
*
|
962 |
* @see SV_WC_Plugin::get_settings_url()
|
963 |
* @param string $gateway_id the gateway identifier
|
964 |
* @return string gateway settings URL
|
979 |
* Returns the admin configuration url for a gateway
|
980 |
*
|
981 |
* @since 3.0.0
|
982 |
+
*
|
983 |
* @param string $gateway_id the gateway ID
|
984 |
* @return string admin configuration url for the gateway
|
985 |
*/
|
986 |
public function get_payment_gateway_configuration_url( $gateway_id ) {
|
987 |
|
988 |
+
return admin_url( 'admin.php?page=wc-settings&tab=checkout§ion=' . $gateway_id );
|
989 |
}
|
990 |
|
991 |
|
993 |
* Returns true if the current page is the admin configuration page for a gateway
|
994 |
*
|
995 |
* @since 3.0.0
|
996 |
+
*
|
997 |
* @param string $gateway_id the gateway ID
|
998 |
* @return boolean true if the current page is the admin configuration page for the gateway
|
999 |
*/
|
1001 |
|
1002 |
return isset( $_GET['page'] ) && 'wc-settings' == $_GET['page'] &&
|
1003 |
isset( $_GET['tab'] ) && 'checkout' == $_GET['tab'] &&
|
1004 |
+
isset( $_GET['section'] ) && $gateway_id === $_GET['section'];
|
1005 |
}
|
1006 |
|
1007 |
|
1008 |
/**
|
1009 |
* Get a gateway's settings screen section ID.
|
1010 |
*
|
1011 |
+
* This was used as a helper method for WC 2.5 compatibility, but is no
|
1012 |
+
* longer needed and now deprecated.
|
1013 |
+
*
|
1014 |
* @since 4.4.0
|
1015 |
+
* @deprecated 5.0.1
|
1016 |
+
*
|
1017 |
* @param string $gateway_id the gateway ID
|
1018 |
* @return string
|
1019 |
*/
|
1020 |
public function get_payment_gateway_configuration_section( $gateway_id ) {
|
1021 |
|
1022 |
+
SV_WC_Plugin_Compatibility::wc_doing_it_wrong( 'SV_WC_Payment_Gateway_Plugin::get_payment_gateway_configuration_section()', 'Deprecated! Use the plain gateway ID instead.', '5.0.1' );
|
|
|
|
|
|
|
|
|
|
|
1023 |
|
1024 |
+
return strtolower( $gateway_id );
|
1025 |
}
|
1026 |
|
1027 |
|
1030 |
* supported by this plugin
|
1031 |
*
|
1032 |
* @since 1.0.0
|
1033 |
+
*
|
1034 |
* @param string $gateway_id the gateway identifier
|
1035 |
* @param string $gateway_class_name the corresponding gateway class name
|
1036 |
*/
|
1045 |
* unless the plugin supports credit card and echeck variations
|
1046 |
*
|
1047 |
* @since 1.0.0
|
1048 |
+
*
|
1049 |
* @return array of string gateway class names
|
1050 |
*/
|
1051 |
public function get_gateway_class_names() {
|
1066 |
* Gets the gateway class name for the given gateway id
|
1067 |
*
|
1068 |
* @since 1.0.0
|
1069 |
+
*
|
1070 |
* @param string $gateway_id the gateway identifier
|
1071 |
* @return string gateway class name
|
1072 |
*/
|
1083 |
* unless the plugin supports credit card and echeck variations
|
1084 |
*
|
1085 |
* @since 1.0.0
|
1086 |
+
*
|
1087 |
+
* @return SV_WC_Payment_Gateway[]
|
1088 |
*/
|
1089 |
public function get_gateways() {
|
1090 |
|
1104 |
* Adds the given $gateway to the internal gateways store
|
1105 |
*
|
1106 |
* @since 2.2.0
|
1107 |
+
*
|
1108 |
* @param string $gateway_id the gateway identifier
|
1109 |
* @param SV_WC_Payment_Gateway $gateway the gateway object
|
1110 |
*/
|
1117 |
* Returns the identified gateway object
|
1118 |
*
|
1119 |
* @since 1.0.0
|
1120 |
+
*
|
1121 |
* @param string $gateway_id optional gateway identifier, defaults to first gateway, which will be the credit card gateway in plugins with support for both credit cards and echecks
|
1122 |
* @return SV_WC_Payment_Gateway the gateway object
|
1123 |
*/
|
1144 |
* Returns true if the plugin supports this gateway
|
1145 |
*
|
1146 |
* @since 1.0.0
|
1147 |
+
*
|
1148 |
* @param string $gateway_id the gateway identifier
|
1149 |
* @return boolean true if the plugin has this gateway available, false otherwise
|
1150 |
*/
|
1157 |
* Returns all available gateway ids for the plugin
|
1158 |
*
|
1159 |
* @since 1.0.0
|
1160 |
+
*
|
1161 |
* @return array of gateway id strings
|
1162 |
*/
|
1163 |
public function get_gateway_ids() {
|
1172 |
* Returns the gateway for a given token
|
1173 |
*
|
1174 |
* @since 4.0.0
|
1175 |
+
*
|
1176 |
* @param string|int $user_id the user ID associated with the token
|
1177 |
* @param string $token the token string
|
1178 |
+
* @return SV_WC_Payment_Gateway|null gateway if found, null otherwise
|
1179 |
*/
|
1180 |
public function get_gateway_from_token( $user_id, $token ) {
|
1181 |
|
1196 |
* files separated by gateway ID
|
1197 |
*
|
1198 |
* @see SV_WC_Plugin::add_api_request_logging()
|
1199 |
+
*
|
1200 |
* @since 2.2.0
|
1201 |
*/
|
1202 |
public function add_api_request_logging() { }
|
1208 |
* any gateways this plugin supports.
|
1209 |
*
|
1210 |
* @since 1.0.0
|
1211 |
+
*
|
1212 |
* @return array of accepted currencies
|
1213 |
*/
|
1214 |
public function get_accepted_currencies() {
|
1220 |
* Checks is WooCommerce Subscriptions is active
|
1221 |
*
|
1222 |
* @since 1.0.0
|
1223 |
+
*
|
1224 |
* @return bool true if the WooCommerce Subscriptions plugin is active, false if not active
|
1225 |
*/
|
1226 |
public function is_subscriptions_active() {
|
1237 |
* Checks is WooCommerce Pre-Orders is active
|
1238 |
*
|
1239 |
* @since 1.0.0
|
1240 |
+
*
|
1241 |
* @return bool true if WC Pre-Orders is active, false if not active
|
1242 |
*/
|
1243 |
public function is_pre_orders_active() {
|
1254 |
* Returns the loaded payment gateway framework __FILE__
|
1255 |
*
|
1256 |
* @since 4.0.0
|
1257 |
+
*
|
1258 |
* @return string
|
1259 |
*/
|
1260 |
public function get_payment_gateway_framework_file() {
|
1270 |
* the bootstrap.
|
1271 |
*
|
1272 |
* @since 4.0.0
|
1273 |
+
*
|
1274 |
* @return string
|
1275 |
*/
|
1276 |
public function get_payment_gateway_framework_path() {
|
1284 |
* directory, without a trailing slash
|
1285 |
*
|
1286 |
* @since 4.0.0
|
1287 |
+
*
|
1288 |
* @return string relative path to framework image directory
|
1289 |
*/
|
1290 |
public function get_payment_gateway_framework_assets_path() {
|
1297 |
* Returns the loaded payment gateway framework assets URL, without a trailing slash
|
1298 |
*
|
1299 |
* @since 4.0.0
|
1300 |
+
*
|
1301 |
* @return string
|
1302 |
*/
|
1303 |
public function get_payment_gateway_framework_assets_url() {
|
lib/skyverge/woocommerce/payment-gateway/class-sv-wc-payment-gateway-privacy.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* WooCommerce
|
4 |
*
|
5 |
* This source file is subject to the GNU General Public License v3.0
|
6 |
* that is bundled with this package in the file license.txt.
|
@@ -16,22 +16,22 @@
|
|
16 |
* versions in the future. If you wish to customize the plugin for your
|
17 |
* needs please refer to http://www.skyverge.com
|
18 |
*
|
19 |
-
* @package SkyVerge/WooCommerce/
|
20 |
* @author SkyVerge
|
21 |
-
* @copyright Copyright (c) 2013-
|
22 |
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
|
23 |
*/
|
24 |
|
25 |
-
namespace
|
26 |
|
27 |
defined( 'ABSPATH' ) or exit;
|
28 |
|
29 |
-
if ( ! class_exists( '
|
30 |
|
31 |
/**
|
32 |
* The payment gateway privacy handler class.
|
33 |
*
|
34 |
-
* @since
|
35 |
*/
|
36 |
class SV_WC_Payment_Gateway_Privacy extends \WC_Abstract_Privacy {
|
37 |
|
@@ -43,7 +43,7 @@ class SV_WC_Payment_Gateway_Privacy extends \WC_Abstract_Privacy {
|
|
43 |
/**
|
44 |
* Constructs the class.
|
45 |
*
|
46 |
-
* @since
|
47 |
*
|
48 |
* @param SV_WC_Payment_Gateway_Plugin payment gateway plugin instance
|
49 |
*/
|
@@ -65,7 +65,7 @@ class SV_WC_Payment_Gateway_Privacy extends \WC_Abstract_Privacy {
|
|
65 |
/**
|
66 |
* Adds the action & filter hooks.
|
67 |
*
|
68 |
-
* @since
|
69 |
*/
|
70 |
protected function add_hooks() {
|
71 |
|
@@ -91,7 +91,7 @@ class SV_WC_Payment_Gateway_Privacy extends \WC_Abstract_Privacy {
|
|
91 |
*
|
92 |
* @internal
|
93 |
*
|
94 |
-
* @since
|
95 |
*
|
96 |
* @param array $data customer personal data to export
|
97 |
* @param \WC_Customer $customer customer object
|
@@ -125,7 +125,7 @@ class SV_WC_Payment_Gateway_Privacy extends \WC_Abstract_Privacy {
|
|
125 |
/**
|
126 |
* Removes the gateway data during an order data erasure.
|
127 |
*
|
128 |
-
* @since
|
129 |
*
|
130 |
* @param array $response customer data erasure response
|
131 |
* @param \WC_Customer $customer customer object
|
@@ -193,6 +193,14 @@ class SV_WC_Payment_Gateway_Privacy extends \WC_Abstract_Privacy {
|
|
193 |
);
|
194 |
}
|
195 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
196 |
if ( ! empty( $token_data ) ) {
|
197 |
|
198 |
$data[] = array(
|
@@ -270,7 +278,7 @@ class SV_WC_Payment_Gateway_Privacy extends \WC_Abstract_Privacy {
|
|
270 |
*
|
271 |
* @internal
|
272 |
*
|
273 |
-
* @since
|
274 |
*
|
275 |
* @param array $data order personal data to export
|
276 |
* @param \WC_Order $order order object
|
@@ -290,7 +298,6 @@ class SV_WC_Payment_Gateway_Privacy extends \WC_Abstract_Privacy {
|
|
290 |
'account_type' => __( 'Account Type', 'woocommerce-gateway-paypal-powered-by-braintree' ),
|
291 |
'card_type' => __( 'Card Type', 'woocommerce-gateway-paypal-powered-by-braintree' ),
|
292 |
'card_expiry_date' => __( 'Expiry Date', 'woocommerce-gateway-paypal-powered-by-braintree' ),
|
293 |
-
'payer_email' => __( 'Payer Email', 'woocommerce-gateway-paypal-powered-by-braintree' ),
|
294 |
);
|
295 |
|
296 |
foreach ( $meta_to_export as $key => $label ) {
|
@@ -312,7 +319,7 @@ class SV_WC_Payment_Gateway_Privacy extends \WC_Abstract_Privacy {
|
|
312 |
/**
|
313 |
* Removes the gateway data during an order data erasure.
|
314 |
*
|
315 |
-
* @since
|
316 |
*
|
317 |
* @param \WC_Order $order order object
|
318 |
*/
|
@@ -330,13 +337,12 @@ class SV_WC_Payment_Gateway_Privacy extends \WC_Abstract_Privacy {
|
|
330 |
'account_type' => '',
|
331 |
'card_type' => '',
|
332 |
'card_expiry_date' => 'XXXX',
|
333 |
-
'payer_email' => '',
|
334 |
);
|
335 |
|
336 |
/**
|
337 |
* Filters the personal order meta data to remove during a customer erasure request.
|
338 |
*
|
339 |
-
* @since
|
340 |
*
|
341 |
* @param array $meta_keys personal order meta data to remove during a customer erasure request, in the form of $meta_key => $anonymized_value
|
342 |
* @param \WC_Order $order order object
|
@@ -368,7 +374,7 @@ class SV_WC_Payment_Gateway_Privacy extends \WC_Abstract_Privacy {
|
|
368 |
/**
|
369 |
* Gets the payment gateway plugin instance.
|
370 |
*
|
371 |
-
* @since
|
372 |
*
|
373 |
* @return SV_WC_Payment_Gateway_Plugin
|
374 |
*/
|
1 |
<?php
|
2 |
/**
|
3 |
+
* WooCommerce Plugin Framework
|
4 |
*
|
5 |
* This source file is subject to the GNU General Public License v3.0
|
6 |
* that is bundled with this package in the file license.txt.
|
16 |
* versions in the future. If you wish to customize the plugin for your
|
17 |
* needs please refer to http://www.skyverge.com
|
18 |
*
|
19 |
+
* @package SkyVerge/WooCommerce/Plugin/Classes
|
20 |
* @author SkyVerge
|
21 |
+
* @copyright Copyright (c) 2013-2018, SkyVerge, Inc.
|
22 |
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
|
23 |
*/
|
24 |
|
25 |
+
namespace WC_Braintree\Plugin_Framework;
|
26 |
|
27 |
defined( 'ABSPATH' ) or exit;
|
28 |
|
29 |
+
if ( ! class_exists( '\\WC_Braintree\\Plugin_Framework\\SV_WC_Payment_Gateway_Privacy' ) ) :
|
30 |
|
31 |
/**
|
32 |
* The payment gateway privacy handler class.
|
33 |
*
|
34 |
+
* @since 5.1.4
|
35 |
*/
|
36 |
class SV_WC_Payment_Gateway_Privacy extends \WC_Abstract_Privacy {
|
37 |
|
43 |
/**
|
44 |
* Constructs the class.
|
45 |
*
|
46 |
+
* @since 5.1.4
|
47 |
*
|
48 |
* @param SV_WC_Payment_Gateway_Plugin payment gateway plugin instance
|
49 |
*/
|
65 |
/**
|
66 |
* Adds the action & filter hooks.
|
67 |
*
|
68 |
+
* @since 5.1.4
|
69 |
*/
|
70 |
protected function add_hooks() {
|
71 |
|
91 |
*
|
92 |
* @internal
|
93 |
*
|
94 |
+
* @since 5.1.4
|
95 |
*
|
96 |
* @param array $data customer personal data to export
|
97 |
* @param \WC_Customer $customer customer object
|
125 |
/**
|
126 |
* Removes the gateway data during an order data erasure.
|
127 |
*
|
128 |
+
* @since 5.1.4
|
129 |
*
|
130 |
* @param array $response customer data erasure response
|
131 |
* @param \WC_Customer $customer customer object
|
193 |
);
|
194 |
}
|
195 |
|
196 |
+
if ( $token->get_nickname() ) {
|
197 |
+
|
198 |
+
$token_data[] = array(
|
199 |
+
'name' => __( 'Nickname', 'woocommerce-gateway-paypal-powered-by-braintree' ),
|
200 |
+
'value' => $token->get_nickname(),
|
201 |
+
);
|
202 |
+
}
|
203 |
+
|
204 |
if ( ! empty( $token_data ) ) {
|
205 |
|
206 |
$data[] = array(
|
278 |
*
|
279 |
* @internal
|
280 |
*
|
281 |
+
* @since 5.1.4
|
282 |
*
|
283 |
* @param array $data order personal data to export
|
284 |
* @param \WC_Order $order order object
|
298 |
'account_type' => __( 'Account Type', 'woocommerce-gateway-paypal-powered-by-braintree' ),
|
299 |
'card_type' => __( 'Card Type', 'woocommerce-gateway-paypal-powered-by-braintree' ),
|
300 |
'card_expiry_date' => __( 'Expiry Date', 'woocommerce-gateway-paypal-powered-by-braintree' ),
|
|
|
301 |
);
|
302 |
|
303 |
foreach ( $meta_to_export as $key => $label ) {
|
319 |
/**
|
320 |
* Removes the gateway data during an order data erasure.
|
321 |
*
|
322 |
+
* @since 5.1.4
|
323 |
*
|
324 |
* @param \WC_Order $order order object
|
325 |
*/
|
337 |
'account_type' => '',
|
338 |
'card_type' => '',
|
339 |
'card_expiry_date' => 'XXXX',
|
|
|
340 |
);
|
341 |
|
342 |
/**
|
343 |
* Filters the personal order meta data to remove during a customer erasure request.
|
344 |
*
|
345 |
+
* @since 5.1.4
|
346 |
*
|
347 |
* @param array $meta_keys personal order meta data to remove during a customer erasure request, in the form of $meta_key => $anonymized_value
|
348 |
* @param \WC_Order $order order object
|
374 |
/**
|
375 |
* Gets the payment gateway plugin instance.
|
376 |
*
|
377 |
+
* @since 5.1.4
|
378 |
*
|
379 |
* @return SV_WC_Payment_Gateway_Plugin
|
380 |
*/
|
lib/skyverge/woocommerce/payment-gateway/class-sv-wc-payment-gateway.php
CHANGED
@@ -18,15 +18,15 @@
|
|
18 |
*
|
19 |
* @package SkyVerge/WooCommerce/Payment-Gateway/Classes
|
20 |
* @author SkyVerge
|
21 |
-
* @copyright Copyright (c) 2013-
|
22 |
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
|
23 |
*/
|
24 |
|
25 |
-
namespace
|
26 |
|
27 |
defined( 'ABSPATH' ) or exit;
|
28 |
|
29 |
-
if ( ! class_exists( '
|
30 |
|
31 |
/**
|
32 |
* WooCommerce Payment Gateway Framework
|
@@ -99,6 +99,9 @@ abstract class SV_WC_Payment_Gateway extends \WC_Payment_Gateway {
|
|
99 |
/** Credit Card capture charge transaction feature */
|
100 |
const FEATURE_CREDIT_CARD_CAPTURE = 'capture_charge';
|
101 |
|
|
|
|
|
|
|
102 |
/** Display detailed customer decline messages on checkout */
|
103 |
const FEATURE_DETAILED_CUSTOMER_DECLINE_MESSAGES = 'customer_decline_messages';
|
104 |
|
@@ -114,6 +117,21 @@ abstract class SV_WC_Payment_Gateway extends \WC_Payment_Gateway {
|
|
114 |
/** Customer ID feature */
|
115 |
const FEATURE_CUSTOMER_ID = 'customer_id';
|
116 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
117 |
/** @var SV_WC_Payment_Gateway_Plugin the parent plugin class */
|
118 |
private $plugin;
|
119 |
|
@@ -138,12 +156,21 @@ abstract class SV_WC_Payment_Gateway extends \WC_Payment_Gateway {
|
|
138 |
/** @var string configuration option: whether transactions should always be charged if the order is virtual-only, defaults to 'no' */
|
139 |
private $charge_virtual_orders;
|
140 |
|
|
|
|
|
|
|
|
|
|
|
|
|
141 |
/** @var array configuration option: card types to show images for */
|
142 |
private $card_types;
|
143 |
|
144 |
/** @var string configuration option: indicates whether a Card Security Code field will be presented on checkout, either 'yes' or 'no' */
|
145 |
private $enable_csc;
|
146 |
|
|
|
|
|
|
|
147 |
/** @var array configuration option: supported echeck fields, one of 'check_number', 'account_type' */
|
148 |
private $supported_check_fields;
|
149 |
|
@@ -162,6 +189,15 @@ abstract class SV_WC_Payment_Gateway extends \WC_Payment_Gateway {
|
|
162 |
/** @var array of shared setting names, if any. This can be used for instance when a single plugin supports both credit card and echeck payments, and the same credentials can be used for both gateways */
|
163 |
private $shared_settings = array();
|
164 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
165 |
|
166 |
/**
|
167 |
* Initialize the gateway
|
@@ -259,6 +295,13 @@ abstract class SV_WC_Payment_Gateway extends \WC_Payment_Gateway {
|
|
259 |
|
260 |
$this->load_settings();
|
261 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
262 |
// pay page fallback
|
263 |
$this->add_pay_page_handler();
|
264 |
|
@@ -277,6 +320,30 @@ abstract class SV_WC_Payment_Gateway extends \WC_Payment_Gateway {
|
|
277 |
|
278 |
// add API request logging
|
279 |
$this->add_api_request_logging();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
280 |
}
|
281 |
|
282 |
|
@@ -285,7 +352,7 @@ abstract class SV_WC_Payment_Gateway extends \WC_Payment_Gateway {
|
|
285 |
*
|
286 |
* @since 1.0.0
|
287 |
*/
|
288 |
-
|
289 |
|
290 |
// define user set variables
|
291 |
foreach ( $this->settings as $setting_key => $setting ) {
|
@@ -699,23 +766,322 @@ abstract class SV_WC_Payment_Gateway extends \WC_Payment_Gateway {
|
|
699 |
}
|
700 |
|
701 |
|
|
|
|
|
|
|
702 |
/**
|
703 |
-
*
|
704 |
*
|
705 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
706 |
*
|
707 |
-
*
|
708 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
709 |
*/
|
710 |
-
public function
|
|
|
|
|
711 |
|
712 |
-
$title = parent::get_title();
|
713 |
|
714 |
-
|
715 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
716 |
}
|
717 |
|
718 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
719 |
}
|
720 |
|
721 |
|
@@ -980,6 +1346,16 @@ abstract class SV_WC_Payment_Gateway extends \WC_Payment_Gateway {
|
|
980 |
'default' => 'yes',
|
981 |
);
|
982 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
983 |
return $form_fields;
|
984 |
}
|
985 |
|
@@ -998,6 +1374,28 @@ abstract class SV_WC_Payment_Gateway extends \WC_Payment_Gateway {
|
|
998 |
<style type="text/css">.nowrap { white-space: nowrap; }</style>
|
999 |
<?php
|
1000 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1001 |
// if transaction types are supported, show/hide the "charge virtual-only" setting
|
1002 |
if ( isset( $this->form_fields['transaction_type'] ) ) {
|
1003 |
|
@@ -1007,12 +1405,12 @@ abstract class SV_WC_Payment_Gateway extends \WC_Payment_Gateway {
|
|
1007 |
$( '#woocommerce_<?php echo esc_js( $this->get_id() ); ?>_transaction_type' ).change( function() {
|
1008 |
|
1009 |
var transaction_type = $( this ).val();
|
1010 |
-
var
|
1011 |
|
1012 |
if ( '<?php echo esc_js( self::TRANSACTION_TYPE_AUTHORIZATION ); ?>' === transaction_type ) {
|
1013 |
-
$(
|
1014 |
} else {
|
1015 |
-
$(
|
1016 |
}
|
1017 |
|
1018 |
} ).change();
|
@@ -1105,7 +1503,7 @@ abstract class SV_WC_Payment_Gateway extends \WC_Payment_Gateway {
|
|
1105 |
}
|
1106 |
|
1107 |
// all plugin dependencies met
|
1108 |
-
if ( count( $this->get_plugin()->
|
1109 |
$is_available = false;
|
1110 |
}
|
1111 |
|
@@ -1298,102 +1696,96 @@ abstract class SV_WC_Payment_Gateway extends \WC_Payment_Gateway {
|
|
1298 |
}
|
1299 |
|
1300 |
|
1301 |
-
/** Capture feature *******************************************************/
|
1302 |
-
|
1303 |
-
|
1304 |
/**
|
1305 |
-
*
|
1306 |
*
|
1307 |
-
*
|
1308 |
-
*
|
1309 |
-
* @
|
|
|
|
|
|
|
1310 |
*/
|
1311 |
-
|
1312 |
-
|
1313 |
-
$order = $this->get_order_for_capture( $order );
|
1314 |
-
|
1315 |
-
try {
|
1316 |
|
1317 |
-
|
|
|
|
|
|
|
|
|
1318 |
|
1319 |
-
|
1320 |
|
1321 |
-
|
1322 |
-
|
1323 |
-
|
1324 |
-
|
1325 |
-
get_woocommerce_currency_symbol() . wc_format_decimal( $order->capture_total )
|
1326 |
-
);
|
1327 |
|
1328 |
-
|
1329 |
-
if ( $response->get_transaction_id() ) {
|
1330 |
-
$message .= ' ' . sprintf( esc_html__( '(Transaction ID %s)', 'woocommerce-gateway-paypal-powered-by-braintree' ), $response->get_transaction_id() );
|
1331 |
-
}
|
1332 |
|
1333 |
-
|
1334 |
|
1335 |
-
|
1336 |
-
add_filter( 'woocommerce_payment_complete_reduce_order_stock', '__return_false', 100 );
|
1337 |
|
1338 |
-
|
1339 |
-
$order->payment_complete();
|
1340 |
|
1341 |
-
|
1342 |
-
$this->add_capture_data( $order, $response );
|
1343 |
|
1344 |
-
|
1345 |
-
|
1346 |
|
1347 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1348 |
|
1349 |
-
$message = sprintf(
|
1350 |
-
/* translators: Placeholders: %1$s - payment gateway title (such as Authorize.net, Braintree, etc), %2$s - transaction amount, %3$s - transaction status message. Definitions: Capture, as in capture funds from a credit card. */
|
1351 |
-
esc_html__( '%1$s Capture Failed: %2$s - %3$s', 'woocommerce-gateway-paypal-powered-by-braintree' ),
|
1352 |
-
$this->get_method_title(),
|
1353 |
-
$response->get_status_code(),
|
1354 |
-
$response->get_status_message()
|
1355 |
-
);
|
1356 |
|
1357 |
-
|
1358 |
|
1359 |
-
}
|
1360 |
|
1361 |
-
|
|
|
|
|
|
|
|
|
|
|
1362 |
|
1363 |
-
|
|
|
1364 |
|
1365 |
-
$message = sprintf(
|
1366 |
-
/* translators: Placeholders: %1$s - payment gateway title (such as Authorize.net, Braintree, etc), %2$s - failure message. Definitions: "capture" as in capturing funds from a credit card. */
|
1367 |
-
esc_html__( '%1$s Capture Failed: %2$s', 'woocommerce-gateway-paypal-powered-by-braintree' ),
|
1368 |
-
$this->get_method_title(),
|
1369 |
-
$e->getMessage()
|
1370 |
-
);
|
1371 |
|
1372 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1373 |
|
1374 |
-
|
1375 |
-
}
|
1376 |
}
|
1377 |
|
1378 |
|
1379 |
/**
|
1380 |
-
* Gets an order object with payment data added for use in credit card
|
1381 |
-
* capture transactions. Standard information can include:
|
1382 |
-
*
|
1383 |
-
* $order->capture->amount - amount to capture (partial captures are not supported by the framework yet)
|
1384 |
-
* $order->capture->description - capture description
|
1385 |
-
* $order->capture->trans_id - transaction ID for the order being captured
|
1386 |
*
|
1387 |
-
*
|
1388 |
-
*
|
1389 |
-
* $order->capture_total
|
1390 |
-
* $order->description
|
1391 |
*
|
1392 |
* @since 4.5.0
|
|
|
1393 |
* @param \WC_Order|int $order the order being processed
|
|
|
1394 |
* @return \WC_Order
|
1395 |
*/
|
1396 |
-
|
1397 |
|
1398 |
if ( is_numeric( $order ) ) {
|
1399 |
$order = wc_get_order( $order );
|
@@ -1401,15 +1793,20 @@ abstract class SV_WC_Payment_Gateway extends \WC_Payment_Gateway {
|
|
1401 |
|
1402 |
// add capture info
|
1403 |
$order->capture = new \stdClass();
|
1404 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1405 |
/* translators: Placeholders: %1$s - site title, %2$s - order number. Definitions: Capture as in capture funds from a credit card. */
|
1406 |
$order->capture->description = sprintf( esc_html__( '%1$s - Capture for Order %2$s', 'woocommerce-gateway-paypal-powered-by-braintree' ), wp_specialchars_decode( SV_WC_Helper::get_site_name() ), $order->get_order_number() );
|
1407 |
$order->capture->trans_id = $this->get_order_meta( SV_WC_Order_Compatibility::get_prop( $order, 'id' ), 'trans_id' );
|
1408 |
|
1409 |
-
// backwards compat for 4.1 and earlier
|
1410 |
-
$order->capture_total = $order->capture->amount;
|
1411 |
-
$order->description = $order->capture->description;
|
1412 |
-
|
1413 |
/**
|
1414 |
* Direct Gateway Capture Get Order Filter.
|
1415 |
*
|
@@ -1417,41 +1814,12 @@ abstract class SV_WC_Payment_Gateway extends \WC_Payment_Gateway {
|
|
1417 |
*
|
1418 |
* @since 2.0.0
|
1419 |
* @param \WC_Order $order order object
|
1420 |
-
* @param
|
1421 |
*/
|
1422 |
return apply_filters( 'wc_payment_gateway_' . $this->get_id() . '_get_order_for_capture', $order, $this );
|
1423 |
}
|
1424 |
|
1425 |
|
1426 |
-
/**
|
1427 |
-
* Adds the standard capture data to an order.
|
1428 |
-
*
|
1429 |
-
* @since 4.5.0
|
1430 |
-
* @param \WC_Order $order the order object
|
1431 |
-
* @param \SV_WC_Payment_Gateway_API_Response $response the transaction response
|
1432 |
-
*/
|
1433 |
-
protected function add_capture_data( $order, $response ) {
|
1434 |
-
|
1435 |
-
// mark the order as captured
|
1436 |
-
$this->update_order_meta( $order, 'charge_captured', 'yes' );
|
1437 |
-
|
1438 |
-
// add capture transaction ID
|
1439 |
-
if ( $response && $response->get_transaction_id() ) {
|
1440 |
-
$this->update_order_meta( $order, 'capture_trans_id', $response->get_transaction_id() );
|
1441 |
-
}
|
1442 |
-
}
|
1443 |
-
|
1444 |
-
|
1445 |
-
/**
|
1446 |
-
* Adds any gateway-specific data to the order after a capture is performed.
|
1447 |
-
*
|
1448 |
-
* @since 4.5.0
|
1449 |
-
* @param \WC_Order $order the order object
|
1450 |
-
* @param \SV_WC_Payment_Gateway_API_Response $response the transaction response
|
1451 |
-
*/
|
1452 |
-
protected function add_payment_gateway_capture_data( $order, $response ) { }
|
1453 |
-
|
1454 |
-
|
1455 |
/** Refund feature ********************************************************/
|
1456 |
|
1457 |
|
@@ -1487,7 +1855,7 @@ abstract class SV_WC_Payment_Gateway extends \WC_Payment_Gateway {
|
|
1487 |
}
|
1488 |
|
1489 |
// if captures are supported and the order has an authorized, but not captured charge, void it instead
|
1490 |
-
if ( $this->supports_voids() && $this->
|
1491 |
return $this->process_void( $order );
|
1492 |
}
|
1493 |
|
@@ -1517,6 +1885,16 @@ abstract class SV_WC_Payment_Gateway extends \WC_Payment_Gateway {
|
|
1517 |
$this->mark_order_as_refunded( $order );
|
1518 |
}
|
1519 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1520 |
return true;
|
1521 |
|
1522 |
} else {
|
@@ -1996,6 +2374,62 @@ abstract class SV_WC_Payment_Gateway extends \WC_Payment_Gateway {
|
|
1996 |
$this->add_customer_data( $order, $response );
|
1997 |
}
|
1998 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1999 |
/**
|
2000 |
* Payment Gateway Add Transaction Data Action.
|
2001 |
*
|
@@ -2024,35 +2458,151 @@ abstract class SV_WC_Payment_Gateway extends \WC_Payment_Gateway {
|
|
2024 |
|
2025 |
|
2026 |
/**
|
2027 |
-
* Add customer data to an order/user if the gateway supports the customer ID
|
2028 |
-
* response
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2029 |
*
|
2030 |
-
* @since
|
2031 |
-
*
|
2032 |
-
* @param \
|
|
|
|
|
2033 |
*/
|
2034 |
-
|
2035 |
-
|
2036 |
-
$user_id = $order->get_user_id();
|
2037 |
|
2038 |
-
|
2039 |
-
|
2040 |
-
$order->customer_id = $customer_id = $response->get_customer_id();
|
2041 |
|
2042 |
-
|
|
|
|
|
2043 |
|
2044 |
-
|
2045 |
-
|
|
|
|
|
2046 |
}
|
2047 |
|
2048 |
-
//
|
2049 |
-
|
2050 |
-
|
2051 |
-
|
2052 |
-
// update the user
|
2053 |
-
if ( 0 != $user_id ) {
|
2054 |
-
$this->update_customer_id( $user_id, $customer_id );
|
2055 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2056 |
}
|
2057 |
|
2058 |
|
@@ -2061,7 +2611,7 @@ abstract class SV_WC_Payment_Gateway extends \WC_Payment_Gateway {
|
|
2061 |
* to the customer
|
2062 |
*
|
2063 |
* @since 1.0.0
|
2064 |
-
* @param WC_Order $order the order
|
2065 |
* @param string $message a message to display within the order note
|
2066 |
* @param SV_WC_Payment_Gateway_API_Response $response optional, the transaction response object
|
2067 |
*/
|
@@ -2073,18 +2623,29 @@ abstract class SV_WC_Payment_Gateway extends \WC_Payment_Gateway {
|
|
2073 |
/**
|
2074 |
* Held Order Status Filter.
|
2075 |
*
|
2076 |
-
*
|
2077 |
-
* status should be marked as held. Held orders are usually a result of an
|
2078 |
-
* authorize-only transaction.
|
2079 |
*
|
2080 |
* @since 4.0.1
|
|
|
|
|
2081 |
* @param string $order_status 'on-hold' by default
|
2082 |
* @param \WC_Order $order WC order
|
2083 |
-
* @param
|
2084 |
-
* @param
|
2085 |
*/
|
2086 |
$order_status = apply_filters( 'wc_payment_gateway_' . $this->get_id() . '_held_order_status', 'on-hold', $order, $response, $this );
|
2087 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2088 |
// mark order as held
|
2089 |
if ( ! $order->has_status( $order_status ) ) {
|
2090 |
$order->update_status( $order_status, $order_note );
|
@@ -2397,6 +2958,18 @@ abstract class SV_WC_Payment_Gateway extends \WC_Payment_Gateway {
|
|
2397 |
}
|
2398 |
|
2399 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2400 |
/**
|
2401 |
* Adds any credit card authorization/charge admin fields, allowing the
|
2402 |
* administrator to choose between performing authorizations or charges
|
@@ -2430,52 +3003,34 @@ abstract class SV_WC_Payment_Gateway extends \WC_Payment_Gateway {
|
|
2430 |
);
|
2431 |
}
|
2432 |
|
2433 |
-
|
2434 |
-
}
|
2435 |
-
|
2436 |
-
|
2437 |
-
/**
|
2438 |
-
* Returns true if the authorization for $order is still valid for capture
|
2439 |
-
*
|
2440 |
-
* @since 2.0.0
|
2441 |
-
* @param WC_Order $order the order
|
2442 |
-
* @return boolean true if the authorization is valid for capture, false otherwise
|
2443 |
-
*/
|
2444 |
-
public function authorization_valid_for_capture( $order ) {
|
2445 |
-
|
2446 |
-
$order_id = SV_WC_Order_Compatibility::get_prop( $order, 'id' );
|
2447 |
-
|
2448 |
-
// check whether the charge has already been captured by this gateway
|
2449 |
-
$charge_captured = $this->get_order_meta( $order_id, 'charge_captured' );
|
2450 |
-
|
2451 |
-
if ( 'yes' == $charge_captured ) {
|
2452 |
-
return false;
|
2453 |
-
}
|
2454 |
-
|
2455 |
-
// if for any reason the authorization can not be captured
|
2456 |
-
$auth_can_be_captured = $this->get_order_meta( $order_id, 'auth_can_be_captured' );
|
2457 |
|
2458 |
-
|
2459 |
-
|
|
|
|
|
|
|
|
|
2460 |
}
|
2461 |
|
2462 |
-
|
2463 |
-
return ! $this->has_authorization_expired( $order );
|
2464 |
-
}
|
2465 |
-
|
2466 |
|
2467 |
-
|
2468 |
-
|
2469 |
-
|
2470 |
-
* @since 2.0.0
|
2471 |
-
* @param WC_Order $order the order
|
2472 |
-
* @return boolean true if the authorization has expired, false otherwise
|
2473 |
-
*/
|
2474 |
-
public function has_authorization_expired( $order ) {
|
2475 |
|
2476 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2477 |
|
2478 |
-
return
|
2479 |
}
|
2480 |
|
2481 |
|
@@ -2489,7 +3044,7 @@ abstract class SV_WC_Payment_Gateway extends \WC_Payment_Gateway {
|
|
2489 |
* @since 2.2.0
|
2490 |
* @return int hours
|
2491 |
*/
|
2492 |
-
|
2493 |
|
2494 |
return 720;
|
2495 |
}
|
@@ -2551,6 +3106,69 @@ abstract class SV_WC_Payment_Gateway extends \WC_Payment_Gateway {
|
|
2551 |
}
|
2552 |
|
2553 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2554 |
/** Card Types feature ******************************************************/
|
2555 |
|
2556 |
|
@@ -2595,13 +3213,14 @@ abstract class SV_WC_Payment_Gateway extends \WC_Payment_Gateway {
|
|
2595 |
assert( $this->supports_card_types() );
|
2596 |
|
2597 |
$form_fields['card_types'] = array(
|
2598 |
-
'title'
|
2599 |
-
'type'
|
2600 |
-
'desc_tip'
|
2601 |
-
'
|
2602 |
-
'
|
2603 |
-
'
|
2604 |
-
'
|
|
|
2605 |
);
|
2606 |
|
2607 |
return $form_fields;
|
@@ -2872,7 +3491,6 @@ abstract class SV_WC_Payment_Gateway extends \WC_Payment_Gateway {
|
|
2872 |
}
|
2873 |
|
2874 |
foreach ( $order->get_items() as $item ) {
|
2875 |
-
$product = $order->get_product_from_item( $item );
|
2876 |
|
2877 |
if ( SV_WC_Plugin_Compatibility::is_wc_version_gte_3_0() ) {
|
2878 |
$product = $item->get_product();
|
@@ -3030,7 +3648,7 @@ abstract class SV_WC_Payment_Gateway extends \WC_Payment_Gateway {
|
|
3030 |
* Returns the parent plugin object
|
3031 |
*
|
3032 |
* @since 1.0.0
|
3033 |
-
* @return
|
3034 |
*/
|
3035 |
public function get_plugin() {
|
3036 |
return $this->plugin;
|
@@ -3042,7 +3660,7 @@ abstract class SV_WC_Payment_Gateway extends \WC_Payment_Gate
|
18 |
*
|
19 |
* @package SkyVerge/WooCommerce/Payment-Gateway/Classes
|
20 |
* @author SkyVerge
|
21 |
+
* @copyright Copyright (c) 2013-2018, SkyVerge, Inc.
|
22 |
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
|
23 |
*/
|
24 |
|
25 |
+
namespace WC_Braintree\Plugin_Framework;
|
26 |
|
27 |
defined( 'ABSPATH' ) or exit;
|
28 |
|
29 |
+
if ( ! class_exists( '\\WC_Braintree\\Plugin_Framework\\SV_WC_Payment_Gateway' ) ) :
|
30 |
|
31 |
/**
|
32 |
* WooCommerce Payment Gateway Framework
|
99 |
/** Credit Card capture charge transaction feature */
|
100 |
const FEATURE_CREDIT_CARD_CAPTURE = 'capture_charge';
|
101 |
|
102 |
+
/** Credit Card partial capture transaction feature */
|
103 |
+
const FEATURE_CREDIT_CARD_PARTIAL_CAPTURE = 'partial_capture';
|
104 |
+
|
105 |
/** Display detailed customer decline messages on checkout */
|
106 |
const FEATURE_DETAILED_CUSTOMER_DECLINE_MESSAGES = 'customer_decline_messages';
|
107 |
|
117 |
/** Customer ID feature */
|
118 |
const FEATURE_CUSTOMER_ID = 'customer_id';
|
119 |
|
120 |
+
/** Add new payment method feature */
|
121 |
+
const FEATURE_ADD_PAYMENT_METHOD = 'add_payment_method';
|
122 |
+
|
123 |
+
/** Apple Pay feature */
|
124 |
+
const FEATURE_APPLE_PAY = 'apple_pay';
|
125 |
+
|
126 |
+
/** Admin token editor feature */
|
127 |
+
const FEATURE_TOKEN_EDITOR = 'token_editor';
|
128 |
+
|
129 |
+
/** Subscriptions integration ID */
|
130 |
+
const INTEGRATION_SUBSCRIPTIONS = 'subscriptions';
|
131 |
+
|
132 |
+
/** Pre-orders integration ID */
|
133 |
+
const INTEGRATION_PRE_ORDERS = 'pre_orders';
|
134 |
+
|
135 |
/** @var SV_WC_Payment_Gateway_Plugin the parent plugin class */
|
136 |
private $plugin;
|
137 |
|
156 |
/** @var string configuration option: whether transactions should always be charged if the order is virtual-only, defaults to 'no' */
|
157 |
private $charge_virtual_orders;
|
158 |
|
159 |
+
/** @var string configuration option: whether orders can be partially captured multiple times */
|
160 |
+
private $enable_partial_capture;
|
161 |
+
|
162 |
+
/** @var string configuration option: whether orders are captured when switched to a "paid" status */
|
163 |
+
private $enable_paid_capture;
|
164 |
+
|
165 |
/** @var array configuration option: card types to show images for */
|
166 |
private $card_types;
|
167 |
|
168 |
/** @var string configuration option: indicates whether a Card Security Code field will be presented on checkout, either 'yes' or 'no' */
|
169 |
private $enable_csc;
|
170 |
|
171 |
+
/** @var string configuration option: indicates whether a Card Security Code field will be presented for saved cards at checkout, either 'yes' or 'no' */
|
172 |
+
private $enable_token_csc;
|
173 |
+
|
174 |
/** @var array configuration option: supported echeck fields, one of 'check_number', 'account_type' */
|
175 |
private $supported_check_fields;
|
176 |
|
189 |
/** @var array of shared setting names, if any. This can be used for instance when a single plugin supports both credit card and echeck payments, and the same credentials can be used for both gateways */
|
190 |
private $shared_settings = array();
|
191 |
|
192 |
+
/** @var SV_WC_Payment_Gateway_Payment_Tokens_Handler payment tokens handler instance */
|
193 |
+
protected $payment_tokens_handler;
|
194 |
+
|
195 |
+
/** @var Payment_Gateway\Handlers\Capture capture handler instance */
|
196 |
+
protected $capture_handler;
|
197 |
+
|
198 |
+
/** @var array of SV_WC_Payment_Gateway_Integration objects for Subscriptions, Pre-Orders, etc. */
|
199 |
+
protected $integrations;
|
200 |
+
|
201 |
|
202 |
/**
|
203 |
* Initialize the gateway
|
295 |
|
296 |
$this->load_settings();
|
297 |
|
298 |
+
$this->init_payment_tokens_handler();
|
299 |
+
|
300 |
+
$this->init_integrations();
|
301 |
+
|
302 |
+
// initialize the capture handler
|
303 |
+
$this->init_capture_handler();
|
304 |
+
|
305 |
// pay page fallback
|
306 |
$this->add_pay_page_handler();
|
307 |
|
320 |
|
321 |
// add API request logging
|
322 |
$this->add_api_request_logging();
|
323 |
+
|
324 |
+
// add milestone action hooks
|
325 |
+
$this->add_milestone_hooks();
|
326 |
+
}
|
327 |
+
|
328 |
+
|
329 |
+
/**
|
330 |
+
* Adds the various milestone hooks like "payment processed".
|
331 |
+
*
|
332 |
+
* @since 5.1.0
|
333 |
+
*/
|
334 |
+
protected function add_milestone_hooks() {
|
335 |
+
|
336 |
+
$plugin = $this->get_plugin();
|
337 |
+
|
338 |
+
// first successful payment
|
339 |
+
add_action( 'wc_payment_gateway_' . $this->get_id() . '_payment_processed', function( $order ) use ( &$plugin ) {
|
340 |
+
$plugin->get_lifecycle_handler()->trigger_milestone( 'payment-processed', __( 'you successfully processed a payment!', 'woocommerce-gateway-paypal-powered-by-braintree' ) );
|
341 |
+
} );
|
342 |
+
|
343 |
+
// first successful refund
|
344 |
+
add_action( 'wc_payment_gateway_' . $this->get_id() . '_refund_processed', function( $order ) use ( &$plugin ) {
|
345 |
+
$plugin->get_lifecycle_handler()->trigger_milestone( 'refund-processed', __( 'you successfully processed a refund!', 'woocommerce-gateway-paypal-powered-by-braintree' ) );
|
346 |
+
} );
|
347 |
}
|
348 |
|
349 |
|
352 |
*
|
353 |
* @since 1.0.0
|
354 |
*/
|
355 |
+
public function load_settings() {
|
356 |
|
357 |
// define user set variables
|
358 |
foreach ( $this->settings as $setting_key => $setting ) {
|
766 |
}
|
767 |
|
768 |
|
769 |
+
/** Tokenization **************************************************/
|
770 |
+
|
771 |
+
|
772 |
/**
|
773 |
+
* Initialize payment tokens handler.
|
774 |
*
|
775 |
+
* @since 5.0.0
|
776 |
+
*/
|
777 |
+
protected function init_payment_tokens_handler() {
|
778 |
+
|
779 |
+
$this->payment_tokens_handler = $this->build_payment_tokens_handler();
|
780 |
+
}
|
781 |
+
|
782 |
+
|
783 |
+
/**
|
784 |
+
* Gets the payment tokens handler instance.
|
785 |
*
|
786 |
+
* Concrete classes can override this method to return a custom implementation.
|
787 |
+
*
|
788 |
+
* @since 5.0.0
|
789 |
+
*
|
790 |
+
* @return SV_WC_Payment_Gateway_Payment_Tokens_Handler
|
791 |
+
*/
|
792 |
+
protected function build_payment_tokens_handler() {
|
793 |
+
|
794 |
+
return new SV_WC_Payment_Gateway_Payment_Tokens_Handler( $this );
|
795 |
+
}
|
796 |
+
|
797 |
+
|
798 |
+
/**
|
799 |
+
* Gets the payment tokens handler instance.
|
800 |
+
*
|
801 |
+
* @since 5.0.0
|
802 |
+
*
|
803 |
+
* @return SV_WC_Payment_Gateway_Payment_Tokens_Handler
|
804 |
+
*/
|
805 |
+
public function get_payment_tokens_handler() {
|
806 |
+
|
807 |
+
return $this->payment_tokens_handler;
|
808 |
+
}
|
809 |
+
|
810 |
+
|
811 |
+
/**
|
812 |
+
* Determines if tokenization takes place prior to transaction processing.
|
813 |
+
*
|
814 |
+
* @since 5.0.0
|
815 |
+
*
|
816 |
+
* @return bool
|
817 |
+
*/
|
818 |
+
public function tokenize_before_sale() {
|
819 |
+
return false;
|
820 |
+
}
|
821 |
+
|
822 |
+
|
823 |
+
/**
|
824 |
+
* Determines tokenization takes place during a transaction request.
|
825 |
+
*
|
826 |
+
* @since 5.0.0
|
827 |
+
*
|
828 |
+
* @return bool
|
829 |
+
*/
|
830 |
+
public function tokenize_with_sale() {
|
831 |
+
return false;
|
832 |
+
}
|
833 |
+
|
834 |
+
|
835 |
+
/**
|
836 |
+
* Determines tokenization takes place after a transaction request.
|
837 |
+
*
|
838 |
+
* @since 5.0.0
|
839 |
+
*
|
840 |
+
* @return bool
|
841 |
*/
|
842 |
+
public function tokenize_after_sale() {
|
843 |
+
return false;
|
844 |
+
}
|
845 |
|
|
|
846 |
|
847 |
+
/**
|
848 |
+
* Determines if the gateway supports the admin token editor feature.
|
849 |
+
*
|
850 |
+
* @since 5.0.0
|
851 |
+
*
|
852 |
+
* @return bool
|
853 |
+
*/
|
854 |
+
public function supports_token_editor() {
|
855 |
+
return $this->supports( self::FEATURE_TOKEN_EDITOR );
|
856 |
+
}
|
857 |
+
|
858 |
+
|
859 |
+
/** Integrations Feature **************************************************/
|
860 |
+
|
861 |
+
|
862 |
+
/**
|
863 |
+
* Initializes supported integrations.
|
864 |
+
*
|
865 |
+
* @since 5.0.0
|
866 |
+
*/
|
867 |
+
public function init_integrations() {
|
868 |
+
|
869 |
+
if ( $this->supports_subscriptions() ) {
|
870 |
+
$this->integrations[ self::INTEGRATION_SUBSCRIPTIONS ] = $this->build_subscriptions_integration();
|
871 |
}
|
872 |
|
873 |
+
if ( $this->supports_pre_orders() ) {
|
874 |
+
$this->integrations[ self::INTEGRATION_PRE_ORDERS ] = $this->build_pre_orders_integration();
|
875 |
+
}
|
876 |
+
|
877 |
+
/**
|
878 |
+
* Payment Gateway Integrations Initialized Action.
|
879 |
+
*
|
880 |
+
* Fired when integrations (Subscriptons/Pre-Orders) have been loaded and
|
881 |
+
* initialized.
|
882 |
+
*
|
883 |
+
* @since 4.1.0
|
884 |
+
* @param \SV_WC_Payment_Gateway_Direct $this instance
|
885 |
+
*/
|
886 |
+
do_action( 'wc_payment_gateway_' . $this->get_id() . '_init_integrations', $this );
|
887 |
+
}
|
888 |
+
|
889 |
+
|
890 |
+
/**
|
891 |
+
* Gets an array of available integration objects
|
892 |
+
*
|
893 |
+
* @since 5.0.0
|
894 |
+
* @return array
|
895 |
+
*/
|
896 |
+
public function get_integrations() {
|
897 |
+
|
898 |
+
return $this->integrations;
|
899 |
+
}
|
900 |
+
|
901 |
+
|
902 |
+
/**
|
903 |
+
* Gets the integration object for the given ID.
|
904 |
+
*
|
905 |
+
* @since 5.0.0
|
906 |
+
*
|
907 |
+
* @param string $id the integration ID, e.g. subscriptions
|
908 |
+
* @return \SV_WC_Payment_Gateway_Integration|null
|
909 |
+
*/
|
910 |
+
public function get_integration( $id ) {
|
911 |
+
|
912 |
+
return isset( $this->integrations[ $id ] ) ? $this->integrations[ $id ] : null;
|
913 |
+
}
|
914 |
+
|
915 |
+
|
916 |
+
/**
|
917 |
+
* Builds the Subscriptions integration class instance.
|
918 |
+
*
|
919 |
+
* Concrete classes can override this method to return a custom implementation.
|
920 |
+
*
|
921 |
+
* @since 5.0.0
|
922 |
+
*
|
923 |
+
* @return \SV_WC_Payment_Gateway_Integration_Subscriptions
|
924 |
+
*/
|
925 |
+
protected function build_subscriptions_integration() {
|
926 |
+
|
927 |
+
return new SV_WC_Payment_Gateway_Integration_Subscriptions( $this );
|
928 |
+
}
|
929 |
+
|
930 |
+
|
931 |
+
/**
|
932 |
+
* Gets the Subscriptions integration class instance.
|
933 |
+
*
|
934 |
+
* @since 5.0.0
|
935 |
+
*
|
936 |
+
* @return \SV_WC_Payment_Gateway_Integration_Subscriptions|null
|
937 |
+
*/
|
938 |
+
public function get_subscriptions_integration() {
|
939 |
+
|
940 |
+
return isset( $this->integrations[ self::INTEGRATION_SUBSCRIPTIONS ] ) ? $this->integrations[ self::INTEGRATION_SUBSCRIPTIONS ] : null;
|
941 |
+
}
|
942 |
+
|
943 |
+
|
944 |
+
/**
|
945 |
+
* Builds the Pre-Orders integration class instance.
|
946 |
+
*
|
947 |
+
* Concrete classes can override this method to return a custom implementation.
|
948 |
+
*
|
949 |
+
* @since 5.0.0
|
950 |
+
*
|
951 |
+
* @return \SV_WC_Payment_Gateway_Integration_Pre_Orders
|
952 |
+
*/
|
953 |
+
protected function build_pre_orders_integration() {
|
954 |
+
|
955 |
+
return new SV_WC_Payment_Gateway_Integration_Pre_Orders( $this );
|
956 |
+
}
|
957 |
+
|
958 |
+
|
959 |
+
/**
|
960 |
+
* Gets the Pre-Orders integration class instance.
|
961 |
+
*
|
962 |
+
* @since 5.0.0
|
963 |
+
*
|
964 |
+
* @return \SV_WC_Payment_Gateway_Integration_Pre_Orders|null
|
965 |
+
*/
|
966 |
+
public function get_pre_orders_integration() {
|
967 |
+
|
968 |
+
return isset( $this->integrations[ self::INTEGRATION_PRE_ORDERS ] ) ? $this->integrations[ self::INTEGRATION_PRE_ORDERS ] : null;
|
969 |
+
}
|
970 |
+
|
971 |
+
|
972 |
+
/**
|
973 |
+
* Determines if the gateway supports Subscriptions.
|
974 |
+
*
|
975 |
+
* A gateway supports Subscriptions if all of the following are true:
|
976 |
+
*
|
977 |
+
* + Subscriptions is active
|
978 |
+
* + tokenization is supported
|
979 |
+
* + tokenization is enabled
|
980 |
+
*
|
981 |
+
* Concrete gateways can override this to conditionally support Subscriptions
|
982 |
+
* based on certain settings (e.g. only when CSC is not required, etc.)
|
983 |
+
*
|
984 |
+
* @since 5.0.0
|
985 |
+
*
|
986 |
+
* @return bool
|
987 |
+
*/
|
988 |
+
public function supports_subscriptions() {
|
989 |
+
|
990 |
+
return $this->get_plugin()->is_subscriptions_active() && $this->supports_tokenization() && $this->tokenization_enabled();
|
991 |
+
}
|
992 |
+
|
993 |
+
|
994 |
+
/**
|
995 |
+
* Determines if the gateway supports Pre-Orders.
|
996 |
+
*
|
997 |
+
* A gateway supports Pre-Orders if all of the following are true:
|
998 |
+
*
|
999 |
+
* + Pre-Orders is active
|
1000 |
+
* + tokenization is supported
|
1001 |
+
* + tokenization is enabled
|
1002 |
+
*
|
1003 |
+
* Concrete gateways can override this to conditionally support Pre-Orders
|
1004 |
+
* based on certain settings (e.g. only when CSC is not required, etc.)
|
1005 |
+
*
|
1006 |
+
* @since 5.0.0
|
1007 |
+
*
|
1008 |
+
* @return bool
|
1009 |
+
*/
|
1010 |
+
public function supports_pre_orders() {
|
1011 |
+
|
1012 |
+
return $this->get_plugin()->is_pre_orders_active() && $this->supports_tokenization() && $this->tokenization_enabled();
|
1013 |
+
}
|
1014 |
+
|
1015 |
+
|
1016 |
+
/** Apple Pay Feature *****************************************************/
|
1017 |
+
|
1018 |
+
|
1019 |
+
/**
|
1020 |
+
* Determines whether this gateway supports Apple Pay.
|
1021 |
+
*
|
1022 |
+
* @since 4.7.0
|
1023 |
+
*
|
1024 |
+
* @return bool
|
1025 |
+
*/
|
1026 |
+
public function supports_apple_pay() {
|
1027 |
+
|
1028 |
+
return $this->supports( self::FEATURE_APPLE_PAY );
|
1029 |
+
}
|
1030 |
+
|
1031 |
+
|
1032 |
+
/**
|
1033 |
+
* Gets the Apple Pay gateway capabilities.
|
1034 |
+
*
|
1035 |
+
* Gateways should override this if they have more or less capabilities than
|
1036 |
+
* the default. See https://developer.apple.com/reference/applepayjs/paymentrequest/1916123-merchantcapabilities
|
1037 |
+
* for valid values.
|
1038 |
+
*
|
1039 |
+
* @since 4.7.0
|
1040 |
+
*
|
1041 |
+
* @return array
|
1042 |
+
*/
|
1043 |
+
public function get_apple_pay_capabilities() {
|
1044 |
+
|
1045 |
+
return array(
|
1046 |
+
'supports3DS',
|
1047 |
+
'supportsCredit',
|
1048 |
+
'supportsDebit',
|
1049 |
+
);
|
1050 |
+
}
|
1051 |
+
|
1052 |
+
|
1053 |
+
/**
|
1054 |
+
* Gets the currencies supported by Apple Pay.
|
1055 |
+
*
|
1056 |
+
* @since 4.7.0
|
1057 |
+
*
|
1058 |
+
* @return array
|
1059 |
+
*/
|
1060 |
+
public function get_apple_pay_currencies() {
|
1061 |
+
|
1062 |
+
return array( 'USD' );
|
1063 |
+
}
|
1064 |
+
|
1065 |
+
|
1066 |
+
/**
|
1067 |
+
* Adds the Apple Pay payment data to the order object.
|
1068 |
+
*
|
1069 |
+
* Gateways should override this to set the appropriate values depending on
|
1070 |
+
* how their processing API needs to handle the data.
|
1071 |
+
*
|
1072 |
+
* @since 4.7.0
|
1073 |
+
*
|
1074 |
+
* @param \WC_Order the order object
|
1075 |
+
* @param \SV_WC_Payment_Gateway_Apple_Pay_Payment_Response authorized payment response
|
1076 |
+
* @return \WC_Order
|
1077 |
+
*/
|
1078 |
+
public function get_order_for_apple_pay( \WC_Order $order, SV_WC_Payment_Gateway_Apple_Pay_Payment_Response $response ) {
|
1079 |
+
|
1080 |
+
$order->payment->account_number = $response->get_last_four();
|
1081 |
+
$order->payment->last_four = $response->get_last_four();
|
1082 |
+
$order->payment->card_type = $response->get_card_type();
|
1083 |
+
|
1084 |
+
return $order;
|
1085 |
}
|
1086 |
|
1087 |
|
1346 |
'default' => 'yes',
|
1347 |
);
|
1348 |
|
1349 |
+
if ( $this->supports_tokenization() ) {
|
1350 |
+
|
1351 |
+
$form_fields['enable_token_csc'] = array(
|
1352 |
+
'title' => esc_html__( 'Saved Card Verification', 'woocommerce-gateway-paypal-powered-by-braintree' ),
|
1353 |
+
'label' => esc_html__( 'Display the Card Security Code field when paying with a saved card', 'woocommerce-gateway-paypal-powered-by-braintree' ),
|
1354 |
+
'type' => 'checkbox',
|
1355 |
+
'default' => 'yes',
|
1356 |
+
);
|
1357 |
+
}
|
1358 |
+
|
1359 |
return $form_fields;
|
1360 |
}
|
1361 |
|
1374 |
<style type="text/css">.nowrap { white-space: nowrap; }</style>
|
1375 |
<?php
|
1376 |
|
1377 |
+
if ( isset( $this->form_fields['enable_csc'] ) ) {
|
1378 |
+
|
1379 |
+
// add inline javascript to show/hide any shared settings fields as needed
|
1380 |
+
ob_start();
|
1381 |
+
?>
|
1382 |
+
$( '#woocommerce_<?php echo $this->get_id(); ?>_enable_csc' ).change( function() {
|
1383 |
+
|
1384 |
+
var enabled = $( this ).is( ':checked' );
|
1385 |
+
|
1386 |
+
if ( enabled ) {
|
1387 |
+
$( '#woocommerce_<?php echo $this->get_id(); ?>_enable_token_csc' ).closest( 'tr' ).show();
|
1388 |
+
} else {
|
1389 |
+
$( '#woocommerce_<?php echo $this->get_id(); ?>_enable_token_csc' ).closest( 'tr' ).hide();
|
1390 |
+
}
|
1391 |
+
|
1392 |
+
} ).change();
|
1393 |
+
<?php
|
1394 |
+
|
1395 |
+
wc_enqueue_js( ob_get_clean() );
|
1396 |
+
|
1397 |
+
}
|
1398 |
+
|
1399 |
// if transaction types are supported, show/hide the "charge virtual-only" setting
|
1400 |
if ( isset( $this->form_fields['transaction_type'] ) ) {
|
1401 |
|
1405 |
$( '#woocommerce_<?php echo esc_js( $this->get_id() ); ?>_transaction_type' ).change( function() {
|
1406 |
|
1407 |
var transaction_type = $( this ).val();
|
1408 |
+
var hidden_settings = $( '#woocommerce_<?php echo esc_js( $this->get_id() ); ?>_charge_virtual_orders, #woocommerce_<?php echo esc_js( $this->get_id() ); ?>_enable_partial_capture, #woocommerce_<?php echo esc_js( $this->get_id() ); ?>_enable_paid_capture' ).closest( 'tr' );
|
1409 |
|
1410 |
if ( '<?php echo esc_js( self::TRANSACTION_TYPE_AUTHORIZATION ); ?>' === transaction_type ) {
|
1411 |
+
$( hidden_settings ).show();
|
1412 |
} else {
|
1413 |
+
$( hidden_settings ).hide();
|
1414 |
}
|
1415 |
|
1416 |
} ).change();
|
1503 |
}
|
1504 |
|
1505 |
// all plugin dependencies met
|
1506 |
+
if ( count( $this->get_plugin()->get_dependency_handler()->get_missing_php_extensions() ) > 0 ) {
|
1507 |
$is_available = false;
|
1508 |
}
|
1509 |
|
1696 |
}
|
1697 |
|
1698 |
|
|
|
|
|
|
|
1699 |
/**
|
1700 |
+
* Completes an order payment.
|
1701 |
*
|
1702 |
+
* This method marks the order with an appropriate status, and adds a relevant order note.
|
1703 |
+
*
|
1704 |
+
* @since 5.0.0
|
1705 |
+
*
|
1706 |
+
* @param \WC_Order $order order object
|
1707 |
+
* @param SV_WC_Payment_Gateway_API_Response $response response object
|
1708 |
*/
|
1709 |
+
protected function complete_payment( \WC_Order $order, SV_WC_Payment_Gateway_API_Response $response ) {
|
|
|
|
|
|
|
|
|
1710 |
|
1711 |
+
if ( self::PAYMENT_TYPE_CREDIT_CARD == $response->get_payment_type() ) {
|
1712 |
+
$order->add_order_note( $this->get_credit_card_transaction_approved_message( $order, $response ) );
|
1713 |
+
} elseif ( self::PAYMENT_TYPE_ECHECK == $response->get_payment_type() ) {
|
1714 |
+
$order->add_order_note( $this->get_echeck_transaction_approved_message( $order, $response ) );
|
1715 |
+
} else {
|
1716 |
|
1717 |
+
$message_method = 'get_' . $response->get_payment_type() . '_transaction_approved_message';
|
1718 |
|
1719 |
+
if ( is_callable( array( $this, $message_method ) ) ) {
|
1720 |
+
$order->add_order_note( $this->$message_method( $order, $response ) );
|
1721 |
+
}
|
1722 |
+
}
|
|
|
|
|
1723 |
|
1724 |
+
if ( $response->transaction_held() || ( $this->supports_credit_card_authorization() && $this->perform_credit_card_authorization( $order ) ) ) {
|
|
|
|
|
|
|
1725 |
|
1726 |
+
$message = $this->supports_credit_card_authorization() && $this->perform_credit_card_authorization( $order ) ? __( 'Authorization only transaction', 'woocommerce-gateway-paypal-powered-by-braintree' ) : $response->get_status_message();
|
1727 |
|
1728 |
+
$this->mark_order_as_held( $order, $message, $response );
|
|
|
1729 |
|
1730 |
+
SV_WC_Order_Compatibility::reduce_stock_levels( $order );
|
|
|
1731 |
|
1732 |
+
} else {
|
|
|
1733 |
|
1734 |
+
$order->payment_complete();
|
1735 |
+
}
|
1736 |
|
1737 |
+
/**
|
1738 |
+
* Fires after a payment transaction is successfully completed.
|
1739 |
+
*
|
1740 |
+
* @since 5.0.0
|
1741 |
+
*
|
1742 |
+
* @param \WC_Order $order order object
|
1743 |
+
* @param SV_WC_Payment_Gateway $gateway gateway object
|
1744 |
+
*/
|
1745 |
+
do_action( 'wc_payment_gateway_' . $this->get_id() . '_complete_payment', $order, $this );
|
1746 |
+
}
|
1747 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1748 |
|
1749 |
+
/** Capture Methods ***********************************************************************************************/
|
1750 |
|
|
|
1751 |
|
1752 |
+
/**
|
1753 |
+
* Builds the capture handler instance.
|
1754 |
+
*
|
1755 |
+
* @since 5.3.0-dev
|
1756 |
+
*/
|
1757 |
+
public function init_capture_handler() {
|
1758 |
|
1759 |
+
$this->capture_handler = new Payment_Gateway\Handlers\Capture( $this );
|
1760 |
+
}
|
1761 |
|
|
|
|
|
|
|
|
|
|
|
|
|
1762 |
|
1763 |
+
/**
|
1764 |
+
* Gets the capture handler instance.
|
1765 |
+
*
|
1766 |
+
* @since 5.3.0-dev
|
1767 |
+
*
|
1768 |
+
* @return Payment_Gateway\Handlers\Capture
|
1769 |
+
*/
|
1770 |
+
public function get_capture_handler() {
|
1771 |
|
1772 |
+
return $this->capture_handler;
|
|
|
1773 |
}
|
1774 |
|
1775 |
|
1776 |
/**
|
1777 |
+
* Gets an order object with payment data added for use in credit card capture transactions.
|
|
|
|
|
|
|
|
|
|
|
1778 |
*
|
1779 |
+
* This was intentionally not moved to the capture handler since we'll likely be refactoring how this information is
|
1780 |
+
* set in the future, and plenty of gateways override it.
|
|
|
|
|
1781 |
*
|
1782 |
* @since 4.5.0
|
1783 |
+
*
|
1784 |
* @param \WC_Order|int $order the order being processed
|
1785 |
+
* @param float|null $amount amount to capture or null for the full order amount
|
1786 |
* @return \WC_Order
|
1787 |
*/
|
1788 |
+
public function get_order_for_capture( $order, $amount = null ) {
|
1789 |
|
1790 |
if ( is_numeric( $order ) ) {
|
1791 |
$order = wc_get_order( $order );
|
1793 |
|
1794 |
// add capture info
|
1795 |
$order->capture = new \stdClass();
|
1796 |
+
|
1797 |
+
$total_captured = $this->get_order_meta( $order, 'capture_total' );
|
1798 |
+
|
1799 |
+
// if no amount is specified, as in a bulk capture situation, always use the amount remaining
|
1800 |
+
if ( ! $amount ) {
|
1801 |
+
$amount = (float) $order->get_total() - (float) $total_captured;
|
1802 |
+
}
|
1803 |
+
|
1804 |
+
$order->capture->amount = SV_WC_Helper::number_format( $amount );
|
1805 |
+
|
1806 |
/* translators: Placeholders: %1$s - site title, %2$s - order number. Definitions: Capture as in capture funds from a credit card. */
|
1807 |
$order->capture->description = sprintf( esc_html__( '%1$s - Capture for Order %2$s', 'woocommerce-gateway-paypal-powered-by-braintree' ), wp_specialchars_decode( SV_WC_Helper::get_site_name() ), $order->get_order_number() );
|
1808 |
$order->capture->trans_id = $this->get_order_meta( SV_WC_Order_Compatibility::get_prop( $order, 'id' ), 'trans_id' );
|
1809 |
|
|
|
|
|
|
|
|
|
1810 |
/**
|
1811 |
* Direct Gateway Capture Get Order Filter.
|
1812 |
*
|
1814 |
*
|
1815 |
* @since 2.0.0
|
1816 |
* @param \WC_Order $order order object
|
1817 |
+
* @param SV_WC_Payment_Gateway $this instance
|
1818 |
*/
|
1819 |
return apply_filters( 'wc_payment_gateway_' . $this->get_id() . '_get_order_for_capture', $order, $this );
|
1820 |
}
|
1821 |
|
1822 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1823 |
/** Refund feature ********************************************************/
|
1824 |
|
1825 |
|
1855 |
}
|
1856 |
|
1857 |
// if captures are supported and the order has an authorized, but not captured charge, void it instead
|
1858 |
+
if ( $this->supports_voids() && ! $this->get_capture_handler()->is_order_captured( $order ) ) {
|
1859 |
return $this->process_void( $order );
|
1860 |
}
|
1861 |
|
1885 |
$this->mark_order_as_refunded( $order );
|
1886 |
}
|
1887 |
|
1888 |
+
/**
|
1889 |
+
* Fires after a refund is successfully processed.
|
1890 |
+
*
|
1891 |
+
* @since 5.1.0
|
1892 |
+
*
|
1893 |
+
* @param \WC_Order $order order object
|
1894 |
+
* @param SV_WC_Payment_Gateway $gateway payment gateway instance
|
1895 |
+
*/
|
1896 |
+
do_action( 'wc_payment_gateway_' . $this->get_id() . '_refund_processed', $order, $this );
|
1897 |
+
|
1898 |
return true;
|
1899 |
|
1900 |
} else {
|
2374 |
$this->add_customer_data( $order, $response );
|
2375 |
}
|
2376 |
|
2377 |
+
if ( isset( $order->payment->token ) && $order->payment->token ) {
|
2378 |
+
$this->update_order_meta( $order, 'payment_token', $order->payment->token );
|
2379 |
+
}
|
2380 |
+
|
2381 |
+
// account number
|
2382 |
+
if ( isset( $order->payment->account_number ) && $order->payment->account_number ) {
|
2383 |
+
$this->update_order_meta( $order, 'account_four', substr( $order->payment->account_number, -4 ) );
|
2384 |
+
}
|
2385 |
+
|
2386 |
+
if ( $this->is_credit_card_gateway() ) {
|
2387 |
+
|
2388 |
+
// credit card gateway data
|
2389 |
+
if ( $response && $response instanceof SV_WC_Payment_Gateway_API_Authorization_Response ) {
|
2390 |
+
|
2391 |
+
$this->update_order_meta( $order, 'authorization_amount', $order->payment_total );
|
2392 |
+
|
2393 |
+
if ( $response->get_authorization_code() ) {
|
2394 |
+
$this->update_order_meta( $order, 'authorization_code', $response->get_authorization_code() );
|
2395 |
+
}
|
2396 |
+
|
2397 |
+
if ( $order->payment_total > 0 ) {
|
2398 |
+
|
2399 |
+
// mark as captured
|
2400 |
+
if ( $this->perform_credit_card_charge( $order ) ) {
|
2401 |
+
$captured = 'yes';
|
2402 |
+
} else {
|
2403 |
+
$captured = 'no';
|
2404 |
+
}
|
2405 |
+
|
2406 |
+
$this->update_order_meta( $order, 'charge_captured', $captured );
|
2407 |
+
}
|
2408 |
+
}
|
2409 |
+
|
2410 |
+
if ( isset( $order->payment->exp_year ) && $order->payment->exp_year && isset( $order->payment->exp_month ) && $order->payment->exp_month ) {
|
2411 |
+
$this->update_order_meta( $order, 'card_expiry_date', $order->payment->exp_year . '-' . $order->payment->exp_month );
|
2412 |
+
}
|
2413 |
+
|
2414 |
+
if ( isset( $order->payment->card_type ) && $order->payment->card_type ) {
|
2415 |
+
$this->update_order_meta( $order, 'card_type', $order->payment->card_type );
|
2416 |
+
}
|
2417 |
+
|
2418 |
+
} elseif ( $this->is_echeck_gateway() ) {
|
2419 |
+
|
2420 |
+
// checking gateway data
|
2421 |
+
|
2422 |
+
// optional account type (checking/savings)
|
2423 |
+
if ( isset( $order->payment->account_type ) && $order->payment->account_type ) {
|
2424 |
+
$this->update_order_meta( $order, 'account_type', $order->payment->account_type );
|
2425 |
+
}
|
2426 |
+
|
2427 |
+
// optional check number
|
2428 |
+
if ( isset( $order->payment->check_number ) && $order->payment->check_number ) {
|
2429 |
+
$this->update_order_meta( $order, 'check_number', $order->payment->check_number );
|
2430 |
+
}
|
2431 |
+
}
|
2432 |
+
|
2433 |
/**
|
2434 |
* Payment Gateway Add Transaction Data Action.
|
2435 |
*
|
2458 |
|
2459 |
|
2460 |
/**
|
2461 |
+
* Add customer data to an order/user if the gateway supports the customer ID
|
2462 |
+
* response
|
2463 |
+
*
|
2464 |
+
* @since 4.0.0
|
2465 |
+
* @param \WC_Order $order order
|
2466 |
+
* @param \SV_WC_Payment_Gateway_API_Customer_Response $response
|
2467 |
+
*/
|
2468 |
+
protected function add_customer_data( $order, $response = null ) {
|
2469 |
+
|
2470 |
+
$user_id = $order->get_user_id();
|
2471 |
+
|
2472 |
+
if ( $response && method_exists( $response, 'get_customer_id' ) && $response->get_customer_id() ) {
|
2473 |
+
|
2474 |
+
$order->customer_id = $customer_id = $response->get_customer_id();
|
2475 |
+
|
2476 |
+
} else {
|
2477 |
+
|
2478 |
+
// default to the customer ID set on the order
|
2479 |
+
$customer_id = $order->customer_id;
|
2480 |
+
}
|
2481 |
+
|
2482 |
+
// update the order with the customer ID, note environment is not appended here because it's already available
|
2483 |
+
// on the `environment` order meta
|
2484 |
+
$this->update_order_meta( $order, 'customer_id', $customer_id );
|
2485 |
+
|
2486 |
+
// update the user
|
2487 |
+
if ( 0 != $user_id ) {
|
2488 |
+
$this->update_customer_id( $user_id, $customer_id );
|
2489 |
+
}
|
2490 |
+
}
|
2491 |
+
|
2492 |
+
|
2493 |
+
/**
|
2494 |
+
* Gets the order note message for approved credit card transactions.
|
2495 |
+
*
|
2496 |
+
* @since 5.0.0
|
2497 |
+
*
|
2498 |
+
* @param \WC_Order $order order object
|
2499 |
+
* @param SV_WC_Payment_Gateway_API_Response $response response object
|
2500 |
+
* @return string
|
2501 |
+
*/
|
2502 |
+
public function get_credit_card_transaction_approved_message( \WC_Order $order, $response ) {
|
2503 |
+
|
2504 |
+
$last_four = ! empty( $order->payment->last_four ) ? $order->payment->last_four : substr( $order->payment->account_number, -4 );
|
2505 |
+
|
2506 |
+
// use direct card type if set, or try to guess it from card number
|
2507 |
+
if ( ! empty( $order->payment->card_type ) ) {
|
2508 |
+
$card_type = $order->payment->card_type;
|
2509 |
+
} elseif ( $first_four = substr( $order->payment->account_number, 0, 4 ) ) {
|
2510 |
+
$card_type = SV_WC_Payment_Gateway_Helper::card_type_from_account_number( $first_four );
|
2511 |
+
} else {
|
2512 |
+
$card_type = 'card';
|
2513 |
+
}
|
2514 |
+
|
2515 |
+
$message = sprintf(
|
2516 |
+
/* translators: Placeholders: %1$s - payment method title, %2$s - environment ("Test"), %3$s - transaction type (authorization/charge) */
|
2517 |
+
__( '%1$s %2$s %3$s Approved', 'woocommerce-gateway-paypal-powered-by-braintree' ),
|
2518 |
+
$this->get_method_title(),
|
2519 |
+
$this->is_test_environment() ? esc_html_x( 'Test', 'noun, software environment', 'woocommerce-gateway-paypal-powered-by-braintree' ) : '',
|
2520 |
+
$this->perform_credit_card_authorization( $order ) ? esc_html_x( 'Authorization', 'credit card transaction type', 'woocommerce-gateway-paypal-powered-by-braintree' ) : esc_html_x( 'Charge', 'noun, credit card transaction type', 'woocommerce-gateway-paypal-powered-by-braintree' )
|
2521 |
+
);
|
2522 |
+
|
2523 |
+
if ( $last_four ) {
|
2524 |
+
|
2525 |
+
$message .= ': ' . sprintf(
|
2526 |
+
/* translators: Placeholders: %1$s - credit card type (MasterCard, Visa, etc...), %2$s - last four digits of the card */
|
2527 |
+
__( '%1$s ending in %2$s', 'woocommerce-gateway-paypal-powered-by-braintree' ),
|
2528 |
+
SV_WC_Payment_Gateway_Helper::payment_type_to_name( $card_type ),
|
2529 |
+
$last_four
|
2530 |
+
);
|
2531 |
+
}
|
2532 |
+
|
2533 |
+
// add the expiry date if it is available
|
2534 |
+
if ( ! empty( $order->payment->exp_month ) && ! empty( $order->payment->exp_year ) ) {
|
2535 |
+
|
2536 |
+
$message .= ' ' . sprintf(
|
2537 |
+
/** translators: Placeholders: %s - credit card expiry date */
|
2538 |
+
__( '(expires %s)', 'woocommerce-gateway-paypal-powered-by-braintree' ),
|
2539 |
+
$order->payment->exp_month . '/' . substr( $order->payment->exp_year, -2 )
|
2540 |
+
);
|
2541 |
+
}
|
2542 |
+
|
2543 |
+
// adds the transaction id (if any) to the order note
|
2544 |
+
if ( $response->get_transaction_id() ) {
|
2545 |
+
/* translators: Placeholders: %s - transaction ID */
|
2546 |
+
$message .= ' ' . sprintf( esc_html__( '(Transaction ID %s)', 'woocommerce-gateway-paypal-powered-by-braintree' ), $response->get_transaction_id() );
|
2547 |
+
}
|
2548 |
+
|
2549 |
+
/**
|
2550 |
+
* Direct Gateway Credit Card Transaction Approved Order Note Filter.
|
2551 |
+
*
|
2552 |
+
* Allow actors to modify the order note added when a Credit Card transaction
|
2553 |
+
* is approved.
|
2554 |
+
*
|
2555 |
+
* @since 4.1.0
|
2556 |
+
* @param string $message order note
|
2557 |
+
* @param \WC_Order $order order object
|
2558 |
+
* @param \SV_WC_Payment_Gateway_API_Response $response transaction response
|
2559 |
+
* @param \SV_WC_Payment_Gateway_Direct $this instance
|
2560 |
+
*/
|
2561 |
+
return apply_filters( 'wc_payment_gateway_' . $this->get_id() . '_credit_card_transaction_approved_order_note', $message, $order, $response, $this );
|
2562 |
+
}
|
2563 |
+
|
2564 |
+
|
2565 |
+
/**
|
2566 |
+
* Gets the order note message for approved eCheck transactions.
|
2567 |
*
|
2568 |
+
* @since 5.0.0
|
2569 |
+
*
|
2570 |
+
* @param \WC_Order $order order object
|
2571 |
+
* @param SV_WC_Payment_Gateway_API_Response $response response object
|
2572 |
+
* @return string
|
2573 |
*/
|
2574 |
+
public function get_echeck_transaction_approved_message( \WC_Order $order, SV_WC_Payment_Gateway_API_Response $response ) {
|
|
|
|
|
2575 |
|
2576 |
+
$last_four = ! empty( $order->payment->last_four ) ? $order->payment->last_four : substr( $order->payment->account_number, -4 );
|
|
|
|
|
2577 |
|
2578 |
+
// check order note. there may not be an account_type available, but that's fine
|
2579 |
+
/* translators: Placeholders: %1$s - payment method title, %2$s - payment account type (savings/checking) (may or may not be available), %3$s - last four digits of the account */
|
2580 |
+
$message = sprintf( __( '%1$s Check Transaction Approved: %2$s account ending in %3$s', 'woocommerce-gateway-paypal-powered-by-braintree' ), $this->get_method_title(), $order->payment->account_type, $last_four );
|
2581 |
|
2582 |
+
// optional check number
|
2583 |
+
if ( ! empty( $order->payment->check_number ) ) {
|
2584 |
+
/* translators: Placeholders: %s - check number */
|
2585 |
+
$message .= '. ' . sprintf( esc_html__( 'Check number %s', 'woocommerce-gateway-paypal-powered-by-braintree' ), $order->payment->check_number );
|
2586 |
}
|
2587 |
|
2588 |
+
// adds the transaction id (if any) to the order note
|
2589 |
+
if ( $response->get_transaction_id() ) {
|
2590 |
+
$message .= ' ' . sprintf( esc_html__( '(Transaction ID %s)', 'woocommerce-gateway-paypal-powered-by-braintree' ), $response->get_transaction_id() );
|
|
|
|
|
|
|
|
|
2591 |
}
|
2592 |
+
|
2593 |
+
/**
|
2594 |
+
* Direct Gateway eCheck Transaction Approved Order Note Filter.
|
2595 |
+
*
|
2596 |
+
* Allow actors to modify the order note added when an eCheck transaction
|
2597 |
+
* is approved.
|
2598 |
+
*
|
2599 |
+
* @since 4.1.0
|
2600 |
+
* @param string $message order note
|
2601 |
+
* @param \WC_Order $order order object
|
2602 |
+
* @param \SV_WC_Payment_Gateway_API_Response $response transaction response
|
2603 |
+
* @param \SV_WC_Payment_Gateway_Direct $this instance
|
2604 |
+
*/
|
2605 |
+
return apply_filters( 'wc_payment_gateway_' . $this->get_id() . '_check_transaction_approved_order_note', $message, $order, $response, $this );
|
2606 |
}
|
2607 |
|
2608 |
|
2611 |
* to the customer
|
2612 |
*
|
2613 |
* @since 1.0.0
|
2614 |
+
* @param \WC_Order $order the order
|
2615 |
* @param string $message a message to display within the order note
|
2616 |
* @param SV_WC_Payment_Gateway_API_Response $response optional, the transaction response object
|
2617 |
*/
|
2623 |
/**
|
2624 |
* Held Order Status Filter.
|
2625 |
*
|
2626 |
+
* This filter is deprecated. Use wc_<gateway_id>_held_order_status instead.
|
|
|
|
|
2627 |
*
|
2628 |
* @since 4.0.1
|
2629 |
+
* @deprecated 5.3.0-dev
|
2630 |
+
*
|
2631 |
* @param string $order_status 'on-hold' by default
|
2632 |
* @param \WC_Order $order WC order
|
2633 |
+
* @param SV_WC_Payment_Gateway_API_Response $response instance
|
2634 |
+
* @param SV_WC_Payment_Gateway $gateway gateway instance
|
2635 |
*/
|
2636 |
$order_status = apply_filters( 'wc_payment_gateway_' . $this->get_id() . '_held_order_status', 'on-hold', $order, $response, $this );
|
2637 |
|
2638 |
+
/**
|
2639 |
+
* Filters the order status that's considered to be "held".
|
2640 |
+
*
|
2641 |
+
* @since 5.3.0-dev
|
2642 |
+
*
|
2643 |
+
* @param string $status held order status
|
2644 |
+
* @param \WC_Order $order order object
|
2645 |
+
* @param SV_WC_Payment_Gateway_API_Response|null $response API response object, if any
|
2646 |
+
*/
|
2647 |
+
$order_status = apply_filters( 'wc_' . $this->get_id() . '_held_order_status', $order_status, $order, $response );
|
2648 |
+
|
2649 |
// mark order as held
|
2650 |
if ( ! $order->has_status( $order_status ) ) {
|
2651 |
$order->update_status( $order_status, $order_note );
|
2958 |
}
|
2959 |
|
2960 |
|
2961 |
+
/**
|
2962 |
+
* Determines if the gateway supports capturing a partial charge.
|
2963 |
+
*
|
2964 |
+
* @since 5.0.0
|
2965 |
+
*
|
2966 |
+
* @return bool
|
2967 |
+
*/
|
2968 |
+
public function supports_credit_card_partial_capture() {
|
2969 |
+
return $this->supports_credit_card_capture() && $this->supports( self::FEATURE_CREDIT_CARD_PARTIAL_CAPTURE );
|
2970 |
+
}
|
2971 |
+
|
2972 |
+
|
2973 |
/**
|
2974 |
* Adds any credit card authorization/charge admin fields, allowing the
|
2975 |
* administrator to choose between performing authorizations or charges
|
3003 |
);
|
3004 |
}
|
3005 |
|
3006 |
+
if ( $this->supports_credit_card_partial_capture() ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3007 |
|
3008 |
+
$form_fields['enable_partial_capture'] = array(
|
3009 |
+
'label' => esc_html__( 'Enable Partial Capture', 'woocommerce-gateway-paypal-powered-by-braintree' ),
|
3010 |
+
'type' => 'checkbox',
|
3011 |
+
'description' => esc_html__( 'Allow orders to be partially captured multiple times.', 'woocommerce-gateway-paypal-powered-by-braintree' ),
|
3012 |
+
'default' => 'no',
|
3013 |
+
);
|
3014 |
}
|
3015 |
|
3016 |
+
if ( $this->supports_credit_card_capture() ) {
|
|
|
|
|
|
|
3017 |
|
3018 |
+
// get a list of the "paid" status names
|
3019 |
+
$paid_statuses = array_map( 'wc_get_order_status_name', (array) SV_WC_Plugin_Compatibility::wc_get_is_paid_statuses() );
|
3020 |
+
$conjuction = _x( 'or', 'coordinating conjunction for a list of order statuses: on-hold, processing, or completed', 'woocommerce-gateway-paypal-powered-by-braintree' );
|
|
|
|
|
|
|
|
|
|
|
3021 |
|
3022 |
+
$form_fields['enable_paid_capture'] = array(
|
3023 |
+
'label' => __( 'Capture Paid Orders', 'woocommerce-gateway-paypal-powered-by-braintree' ),
|
3024 |
+
'type' => 'checkbox',
|
3025 |
+
'description' => sprintf(
|
3026 |
+
__( 'Automatically capture orders when they are changed to %s.', 'woocommerce-gateway-paypal-powered-by-braintree' ),
|
3027 |
+
esc_html( ! empty( $paid_statuses ) ? SV_WC_Helper::list_array_items( $paid_statuses, $conjuction ) : __( 'a paid status', 'woocommerce-gateway-paypal-powered-by-braintree' ) )
|
3028 |
+
),
|
3029 |
+
'default' => 'no',
|
3030 |
+
);
|
3031 |
+
}
|
3032 |
|
3033 |
+
return $form_fields;
|
3034 |
}
|
3035 |
|
3036 |
|
3044 |
* @since 2.2.0
|
3045 |
* @return int hours
|
3046 |
*/
|
3047 |
+
public function get_authorization_time_window() {
|
3048 |
|
3049 |
return 720;
|
3050 |
}
|
3106 |
}
|
3107 |
|
3108 |
|
3109 |
+
/**
|
3110 |
+
* Determines if partial capture is enabled.
|
3111 |
+
*
|
3112 |
+
* @since 5.0.0
|
3113 |
+
*
|
3114 |
+
* @return bool
|
3115 |
+
*/
|
3116 |
+
public function is_partial_capture_enabled() {
|
3117 |
+
|
3118 |
+
assert( $this->supports_credit_card_partial_capture() );
|
3119 |
+
|
3120 |
+
/**
|
3121 |
+
* Filters whether partial capture is enabled.
|
3122 |
+
*
|
3123 |
+
* @since 5.0.0
|
3124 |
+
*
|
3125 |
+
* @param bool $enabled whether partial capture is enabled
|
3126 |
+
* @param SV_WC_Payment_Gateway $gateway gateway object
|
3127 |
+
*/
|
3128 |
+
return apply_filters( 'wc_' . $this->get_id() . '_partial_capture_enabled', 'yes' === $this->enable_partial_capture, $this );
|
3129 |
+
}
|
3130 |
+
|
3131 |
+
|
3132 |
+
/**
|
3133 |
+
* Determines if orders should be captured when switched to a "paid" status.
|
3134 |
+
*
|
3135 |
+
* @since 5.0.1-dev
|
3136 |
+
*
|
3137 |
+
* @return bool
|
3138 |
+
*/
|
3139 |
+
public function is_paid_capture_enabled() {
|
3140 |
+
|
3141 |
+
/**
|
3142 |
+
* Filters whether orders should be captured when switched to a "paid" status.
|
3143 |
+
*
|
3144 |
+
* @since 5.0.1-dev
|
3145 |
+
*
|
3146 |
+
* @param bool $enabled whether "paid" capture is enabled
|
3147 |
+
* @param SV_WC_Payment_Gateway $gateway gateway object
|
3148 |
+
*/
|
3149 |
+
return apply_filters( 'wc_' . $this->get_id() . '_paid_capture_enabled', 'yes' === $this->enable_paid_capture, $this );
|
3150 |
+
}
|
3151 |
+
|
3152 |
+
|
3153 |
+
/** Add Payment Method feature ********************************************/
|
3154 |
+
|
3155 |
+
|
3156 |
+
/**
|
3157 |
+
* Determines if the gateway supports the add payment method feature.
|
3158 |
+
*
|
3159 |
+
* @since 5.0.0
|
3160 |
+
*
|
3161 |
+
* @return bool
|
3162 |
+
*/
|
3163 |
+
public function supports_add_payment_method() {
|
3164 |
+
|
3165 |
+
return $this->supports( self::FEATURE_ADD_PAYMENT_METHOD );
|
3166 |
+
}
|
3167 |
+
|
3168 |
+
|
3169 |
+
// TODO: generalize the direct methods
|
3170 |
+
|
3171 |
+
|
3172 |
/** Card Types feature ******************************************************/
|
3173 |
|
3174 |
|
3213 |
assert( $this->supports_card_types() );
|
3214 |
|
3215 |
$form_fields['card_types'] = array(
|
3216 |
+
'title' => esc_html__( 'Accepted Card Logos', 'woocommerce-gateway-paypal-powered-by-braintree' ),
|
3217 |
+
'type' => 'multiselect',
|
3218 |
+
'desc_tip' => __( 'These are the card logos that are displayed to customers as accepted during checkout.', 'woocommerce-gateway-paypal-powered-by-braintree' ),
|
3219 |
+
'description' => __( 'This can be configured to match those accepted by your payment processor, but does not change your merchant account configuration.', 'woocommerce-gateway-paypal-powered-by-braintree' ),
|
3220 |
+
'default' => array_keys( $this->get_available_card_types() ),
|
3221 |
+
'class' => 'wc-enhanced-select',
|
3222 |
+
'css' => 'width: 350px;',
|
3223 |
+
'options' => $this->get_available_card_types(),
|
3224 |
);
|
3225 |
|
3226 |
return $form_fields;
|
3491 |
}
|
3492 |
|
3493 |
foreach ( $order->get_items() as $item ) {
|
|
|
3494 |
|
3495 |
if ( SV_WC_Plugin_Compatibility::is_wc_version_gte_3_0() ) {
|
3496 |
$product = $item->get_product();
|
3648 |
* Returns the parent plugin object
|
3649 |
*
|
3650 |
* @since 1.0.0
|
3651 |
+
* @return SV_WC_Payment_Gateway_Plugin the parent plugin object
|
3652 |
*/
|
3653 |
public function get_plugin() {
|
3654 |
return $this->plugin;
|