WooCommerce PayPal Powered by Braintree Payment Gateway - Version 2.6.2

Version Description

  • 2021-11-16 =
  • Feature - Add support for disabling funding methods
  • Feature - Allow updating of expiration dates for credit cards in 'My Account'
  • Tweak - Update 'device data' capture inner workings

See changelog for all versions.

=

Download this release

Release Info

Developer automattic
Plugin Icon 128x128 WooCommerce PayPal Powered by Braintree Payment Gateway
Version 2.6.2
Comparing to
See all releases

Code changes from version 2.6.1 to 2.6.2

DEVELOPER.md DELETED
@@ -1,62 +0,0 @@
1
- # DEVELOPER.md
2
-
3
- ## Test cases
4
-
5
- * Complete a purchase for a simple product using the Credit Card subflow
6
- * Complete a purchase for a simple product using the PayPal subflow
7
-
8
- * Complete a purchase for a simple subscription using the Credit Card subflow
9
- * Using WCS_DEBUG and Tools > Scheduled Actions, run woocommerce_scheduled_subscription_payment for that subscription
10
-
11
- * Complete a purchase for a simple subscription using the PayPal subflow
12
- * Using WCS_DEBUG and Tools > Scheduled Actions, run woocommerce_scheduled_subscription_payment for that subscription
13
-
14
- ## Checkout Form Logic
15
-
16
- * Since the payment methods can be refreshed as the user enters their billing and
17
- shipping information, the extension's `script.js` periodically checks the state of the
18
- form ( using `wcCheckPaypalBraintree` ) and loads ( `wcLoadPaypalBraintree` ) and
19
- unloads ( `wcUnloadPaypalBraintree` ) PayPal Braintree as necessary.
20
-
21
- ### Hosted Fields Flow
22
-
23
- * The credit card number, CVV and expiration date fields on the checkout form are emitted as
24
- simple DIVs by WC_Gateway_Paypal_Braintree::payment_fields, and then the extension's `script.js`
25
- wcLoadPaypalBraintree function calls `braintree.js` braintree.setup to take them over.
26
-
27
- * braintree.setup replaces each of those three fields with a "hosted" iframe served by
28
- braintreegateway.com - this means that the credit card number, CVV and expiration date entries
29
- cannot be seen by the merchant's site's javascript and thus supports PCI compliance.
30
-
31
- * When the user clicks the **Place Order** button on the checkout form, `braintree.js` intercepts
32
- the click and requests a nonce (basically a payment token) for the credit card data the
33
- user has entered. We detect that click as well and interrupt the form submittal that
34
- would happen. Then, when the nonce request returns from Braintree, the nonce is saved
35
- in a form hidden field ( `#paypalbraintree_nonce` ) and we submit the form.
36
-
37
- ### PayPal Button on Checkout Form (Checkout with PayPal) Flow
38
-
39
- * If the customer would rather not enter their credit card, exp and CVV values, a PayPal
40
- button is also injected into the form by `braintree.js`
41
- * When the user clicks on the **PayPal** button on the checkout form, `braintree.js` intercepts
42
- the click and displays a modal for the customer to sign in to PayPal to complete their payment. When
43
- the customer completes sign in, a nonce is saved in a form hidden field ( `#paypalbraintree_nonce` )
44
- and we submit the form.
45
- * **NOTE: The currencies supported for Checkout with PayPal are limited compared to the Hosted Fields
46
- flow. See https://developers.braintreepayments.com/guides/paypal/checkout-with-paypal/javascript/v2#currency-support **
47
-
48
- ## Debugging
49
-
50
- ### Checkout with PayPal Button Style Problems
51
-
52
- * Unlike the hosted fields, the PayPal Button can pick up styles from the theme. The extension's
53
- `styles.css` resets a few that Storefront was setting, in the context of the PayPal button, but
54
- other themes may need additional styles to be reset.
55
-
56
- ### Errors during the PayPal Button on Checkout Form Flow
57
-
58
- * If you get a 'Sorry we cannot connect to PayPal. Please try again in a few minutes. Try Again?' message
59
- after clicking on the PayPal Button and signing in, open the Network tab in the browser's Developer Tools
60
- and then click 'Try Again?' You will see a more detailed error message in the response to the GET request
61
- there.
62
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
assets/css/frontend/wc-braintree.min.css CHANGED
@@ -1 +1 @@
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(../../../vendor/skyverge/wc-plugin-framework/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(../../../vendor/skyverge/wc-plugin-framework/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(../../../vendor/skyverge/wc-plugin-framework/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(../../../vendor/skyverge/wc-plugin-framework/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(../../../vendor/skyverge/wc-plugin-framework/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(../../../vendor/skyverge/wc-plugin-framework/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(../../../vendor/skyverge/wc-plugin-framework/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(../../../vendor/skyverge/wc-plugin-framework/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(../../../vendor/skyverge/wc-plugin-framework/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(../../../vendor/skyverge/wc-plugin-framework/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(../../../vendor/skyverge/wc-plugin-framework/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(../../../vendor/skyverge/wc-plugin-framework/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(../../../vendor/skyverge/wc-plugin-framework/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(../../../vendor/skyverge/wc-plugin-framework/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(../../../vendor/skyverge/wc-plugin-framework/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(../../../vendor/skyverge/wc-plugin-framework/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(../../../vendor/skyverge/wc-plugin-framework/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(../../../vendor/skyverge/wc-plugin-framework/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}table.woocommerce-MyAccount-paymentMethods td.woocommerce-PaymentMethod--expires .edit.wc-braintree input{width:60px}
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-my-payment-methods.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}}();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(){jQuery(document).ready(function(n){var a;function t(e){_classCallCheck(this,t);e=_possibleConstructorReturn(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return e.save_method=e.save_method.bind(e),e}return a=window.WC_Braintree_My_Payment_Methods_Handler=(_inherits(t,SV_WC_Payment_Methods_Handler_v5_10_7),_createClass(t,[{key:"save_method",value:function(e){var t,r,o=this;if(!function(e,t){if(!(e instanceof t))throw new Error("Bound instance method accessed before binding")}(this,a),e.preventDefault(),t=n(e.currentTarget),0!==(r=t.parents("tr")).find("input[name=plugin-id][value="+this.slug+"]").length)return this.block_ui(),r.next(".error").remove(),e={action:"wc_"+this.id+"_save_payment_method",nonce:this.ajax_nonce,token_id:r.find("input[name=token-id]").val(),data:r.find("input[name]").serialize()},n.post(this.ajax_url,e).done(function(e){return e.success?(null!=e.data.title&&r.find(".woocommerce-PaymentMethod--method").html(e.data.title),null!=e.data.expires&&r.find(".woocommerce-PaymentMethod--expires").html(e.data.expires),null!=e.data.nonce&&(o.ajax_nonce=e.data.nonce),t.siblings(".cancel-edit").removeClass("cancel-edit").addClass("edit").text(o.i18n.edit_button).addClass("button"),o.disable_editing_ui()):o.display_error(r,e.data)}).fail(function(e,t,n){return o.display_error(r,n)}).always(function(){return o.unblock_ui()})}}]),t),n(document.body).trigger("wc_braintree_my_payment_methods_handler_loaded")})}).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){if("value"in i)return i.value;i=i.get;return void 0!==i?i.call(r):void 0}t=Object.getPrototypeOf(t);if(null!==t)return e(t,n,r)},_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(){function u(e,t){if(!(e instanceof t))throw new Error("Bound instance method accessed before binding")}var c=[].indexOf;jQuery(document).ready(function(s){var e,n,i;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}function a(e){_classCallCheck(this,a);var t=_possibleConstructorReturn(this,(a.__proto__||Object.getPrototypeOf(a)).call(this,e));return 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}function r(e){_classCallCheck(this,r);var t=_possibleConstructorReturn(this,(r.__proto__||Object.getPrototypeOf(r)).call(this,e));return t.do_integration_ready=t.do_integration_ready.bind(t),t.on_approve=t.on_approve.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_pay_later_enabled=e.is_paypal_pay_later_enabled,t.is_paypal_card_enabled=e.is_paypal_card_enabled,t.disabled_funding_options=e.paypal_disabled_funding_options,t.force_buyer_country=e.force_buyer_country,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.paypal_intent=e.paypal_intent,t.init(),t}function o(e){_classCallCheck(this,o);var t=_possibleConstructorReturn(this,(o.__proto__||Object.getPrototypeOf(o)).call(this,e));return t.is_paypal_card_enabled=!1,t.set_payment_method_nonce=e.set_payment_method_nonce,t.cart_handler_url=e.cart_handler_url,t.form=s("form.woocommerce-cart-form"),t.form_ui_selector="",t.setup_braintree(),s(document.body).on("updated_cart_totals",function(){return t.setup_braintree()}),t}function _(e){_classCallCheck(this,_);var t=_possibleConstructorReturn(this,(_.__proto__||Object.getPrototypeOf(_)).call(this,e));return t.do_integration_ready=t.do_integration_ready.bind(t),t.validate_product_button=t.validate_product_button.bind(t),t.validate_product_data=t.validate_product_data.bind(t),t.is_paypal_card_enabled=!1,t.product_checkout_nonce=e.product_checkout_nonce,t.product_checkout_url=e.product_checkout_url,t.is_product_page=e.is_product_page,t.validate_product_url=e.validate_product_url,t.validate_product_nonce=e.validate_product_nonce,t.should_validate_product_data=e.should_validate_product_data,t.form=s("form.woocommerce-cart-form"),t.form_ui_selector="",t.is_product_page&&t.handle_product_page(),t.setup_braintree(),s(document.body).on("updated_cart_totals",function(){return t.setup_braintree()}),t}return window.WC_Braintree_Payment_Form_Handler=(_createClass(t,[{key:"init",value:function(){return this.is_sdk_ready()?s("form.checkout").length?this.handle_checkout_page():s("form#order_review").length?this.handle_pay_page():s("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=s("form.checkout"),this.form_ui_selector=".woocommerce-checkout-payment",s(document.body).on("updated_checkout",function(){if(!e.setting_up)return s('iframe[name^="braintree-"]').remove(),e.setup_braintree()}),s(document.body).on("updated_checkout",function(){return e.handle_saved_payment_methods()}),s(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=s("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=s("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 s("input[name=wc_"+this.id+"_payment_nonce]").val(e),this.form.submit()}},{key:"handle_saved_payment_methods",value:function(){var n=this,e=s("div.js-wc-"+this.id_dasherized+"-new-payment-method-form");if(s("input.js-wc-"+this.id_dasherized+"-payment-token").change(function(){return s("input.js-wc-"+n.id_dasherized+"-payment-token:checked").val()?e.slideUp(200):e.slideDown(200)}).change(),s("input#createaccount").change(function(e){var t=s("input.js-wc-"+n.id_dasherized+"-tokenize-payment-method").closest("p.form-row");return s(e.target).is(":checked")?(t.slideDown(),t.next().show()):(t.hide(),t.next().hide())}),!s("input#createaccount").is(":checked"))return s("input#createaccount").change()}},{key:"setup_braintree",value:function(){if(!s("#wc-"+this.id_dasherized+"-account-number-hosted iframe").data("ready"))return this.setting_up=!0,this.block_ui(),s("input[name=wc_"+this.id+"_payment_nonce]").val(""),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}),r.unblock_ui()})}},{key:"get_client_token",value:function(){this.id;var e={action:"wc_"+this.id+"_get_client_token",nonce:this.client_token_nonce};return s.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(),s("#wc-"+t.id_dasherized+"-account-number-hosted iframe").data("ready",!0),t.do_integration_ready(),s(document).trigger("wc_"+t.id+"_integration_ready",t.integration),t.log("Integration ready."),t.setting_up=!1}).catch(function(e){return t.handle_integration_error(e),t.unblock_ui(),t.setting_up=!1})}},{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&&!this.tearing_down&&!this.setting_up)return this.log("Tearing down integration."),this.tearing_down=!0,this.block_ui(),this.integration.teardown(function(){return e.integration=null,e.tearing_down=!1,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 s(".woocommerce-error, .woocommerce-message").remove(),this.form.prepend('<div class="woocommerce-error">'+e+"</div>").removeClass("processing").unblock(),s("html, body").animate({scrollTop:this.form.offset().top-100},1e3),s("input[name=wc_"+this.id+"_payment_nonce]").val(""),this.form.trigger("wc_"+this.id+"_rendered_error"),s(document.body).trigger("checkout_error"),this.unblock_ui()}},{key:"get_user_message",value:function(){return this.payment_error_message}},{key:"show_integration_ui",value:function(){if(s("div.js-wc-"+this.id_dasherized+"-new-payment-method-form").find(".woocommerce-error").remove(),s("input#createaccount").length&&s("input#createaccount").is(":checked"))return s("div.js-wc-"+this.id_dasherized+"-new-payment-method-form").find(".form-row").show()}},{key:"hide_integration_ui",value:function(){return s("div.js-wc-"+this.id_dasherized+"-new-payment-method-form").prepend('<div class="woocommerce-error">'+this.integration_error_message+"</div>"),s("div.js-wc-"+this.id_dasherized+"-new-payment-method-form").find(".form-row").hide()}},{key:"block_ui",value:function(){return s(this.form_ui_selector).block({message:null,overlayCSS:{background:"#fff",opacity:.6}})}},{key:"unblock_ui",value:function(){return s(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){t=1<arguments.length&&void 0!==t?t:null;if(this.debug)return console.log(this.name+": "+e),t?console.log(t):void 0}}]),t),s(document.body).trigger("wc_braintree_payment_form_handler_loaded"),e=window.WC_Braintree_Credit_Card_Payment_Form_Handler=(_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),s("input[name=wc_"+this.id+"_payment_nonce]").val(""),s("input[name=wc-"+this.id_dasherized+"-card-type]").val(""),s("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=s("input.js-wc-braintree-credit-card-payment-token:checked"),this.should_verify_3d_secure_token(e)?(this.verify_3d_secure(e.data("nonce"),null,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&&null!=e.details&&null!=e.details.bin)return t.should_verify_3d_secure(e)?t.verify_3d_secure(e.nonce,e.details.bin):t.submit_form(e.nonce)}).catch(function(e){return t.handle_payment_error(e)})}},{key:"get_integration_options",value:function(){var e={client:this.client,fields:{number:{selector:"#wc-braintree-credit-card-account-number-hosted",placeholder:s("#wc-braintree-credit-card-account-number-hosted").data("placeholder")},cvv:{selector:"#wc-braintree-credit-card-csc-hosted",placeholder:s("#wc-braintree-credit-card-csc-hosted").data("placeholder")},expirationDate:{selector:"#wc-braintree-credit-card-expiry-hosted",placeholder:s("#wc-braintree-credit-card-expiry-hosted").data("placeholder")}},styles:this.hosted_fields_styles};return 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&&s("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=s("div.js-wc-braintree-credit-card-new-payment-method-form"),e=s("div.wc-braintree-hosted-field-card-csc-parent"),s("input.js-wc-braintree-credit-card-payment-token").change(function(){return s("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("CUSTOMER"===e.type)switch(e.code){case"HOSTED_FIELDS_FIELDS_EMPTY":this.csc_required&&i.push(this.params.cvv_missing),this.using_payment_token()||(i.push(this.params.card_number_missing),i.push(this.params.card_exp_date_invalid));break;case"HOSTED_FIELDS_FIELDS_INVALID":if(null!=e.details)for(t=0,n=(r=e.details.invalidFieldKeys).length;t<n;t++)switch(r[t]){case"number":i.push(this.params.card_number_invalid);break;case"cvv":i.push(this.params.cvv_length_invalid);break;case"expirationDate":i.push(this.params.card_exp_date_invalid)}}else"NETWORK"===e.type&&null!=e.details.originalError.error.message&&(e=e.details.originalError.error.message,/given name format is invalid/.test(e)&&i.push(this.params.first_name_unsupported_characters),/surname format is invalid/.test(e)&&i.push(this.params.last_name_unsupported_characters));return i.length?i.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;if(null!=e.cards)return(t=s("#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],s("input[name=wc-"+this.id_dasherized+"-card-type]").val(n.type),null!=n.type&&(e=n.type,0<=c.call(this.enabled_card_types,e))?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()?(s("input[name=wc-"+this.id_dasherized+"-3d-secure-enabled]").val(1),this.threeDSecure&&this.threeDSecure.teardown(),braintree.threeDSecure.create({version:2,client:this.client}).then(function(e){return t.threeDSecure=e,s(document.body).on("click","#wc-braintree-credit-card-3dsecure-container",function(e){return s(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=e.details.cardType;return this.is_3d_secure_enabled()&&"CreditCard"===e.type&&0<=c.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,t,n){var r=this,i=2<arguments.length&&void 0!==n?n:null,a=s("#billing_state").val(),o=s("#billing_country").val(),_=s("#shipping_state").val(),n=s("#shipping_country").val(),o=s("input[name=billing_first_name]").val()?{givenName:s("input[name=billing_first_name]").val().latinise(),surname:s("input[name=billing_last_name]").val().latinise(),phoneNumber:s("input[name=billing_phone]").val(),streetAddress:s("input[name=billing_address_1]").val(),extendedAddress:s("input[name=billing_address_2]").val(),locality:s("#billing_city").val(),region:"string"==typeof a&&a.length<=2?a:"",postalCode:s("input[name=billing_postcode]").val(),countryCodeAlpha2:"string"==typeof o&&o.length<=2?o:""}:{},n=s("input[name=shipping_first_name]").val()?{shippingGivenName:s("input[name=shipping_first_name]").val().latinise(),shippingSurname:s("input[name=shipping_last_name]").val().latinise(),shippingAddress:{streetAddress:s("input[name=shipping_address_1]").val(),extendedAddress:s("input[name=shipping_address_2]").val(),locality:s("input[name=shipping_city]").val(),region:"string"==typeof _&&_.length<=2?_:"",postalCode:s("input[name=shipping_postcode]").val(),countryCodeAlpha2:"string"==typeof n&&n.length<=2?n:""}}:{},n={nonce:e,amount:s("input[name=wc-"+this.id_dasherized+"-3d-secure-order-total]").val(),email:s("input[name=billing_email]").val(),billingAddress:o,additionalInformation:n,onLookupComplete:function(e,t){r.log("3D Secure lookup complete.",e);try{return t()}catch(e){return r.handle_payment_error(e)}}};return"1"===s("input[name=wc-"+this.id_dasherized+"-cart-contains-subscription]").val()&&(n.challengeRequested=!0),this.log("Verifying 3D Secure.",n),this.threeDSecure.verifyCard(n).then(function(e){return r.log("3D Secure response received.",e),r.threeds.liability_shift_always_required&&!e.liabilityShifted?r.render_error(r.threeds.failure_message):(null!=i&&i.data("verified",!0),s("input[name=wc-"+r.id_dasherized+"-3d-secure-verified]").val(1),r.submit_form(e.nonce))}).catch(function(e){return r.handle_payment_error(e)})}},{key:"show_integration_ui",value:function(){return u(this,e),_get(a.prototype.__proto__||Object.getPrototypeOf(a.prototype),"show_integration_ui",this).call(this),s(".wc-braintree-hosted-field-parent").show()}},{key:"hide_integration_ui",value:function(){return u(this,e),_get(a.prototype.__proto__||Object.getPrototypeOf(a.prototype),"hide_integration_ui",this).call(this),s(".wc-braintree-hosted-field-parent").hide()}}]),a),s(document.body).trigger("wc_braintree_credit_card_payment_form_handler_loaded"),n=window.WC_Braintree_PayPal_Payment_Form_Handler=(_inherits(r,WC_Braintree_Payment_Form_Handler),_createClass(r,[{key:"init",value:function(){var t=this;return _get(r.prototype.__proto__||Object.getPrototypeOf(r.prototype),"init",this).call(this),s("input[name=wc_"+this.id+"_payment_nonce]").val(this.cart_payment_nonce),s(document.body).on("click",'input[name="payment_method"], input.js-wc-braintree-paypal-payment-token',function(){return t.toggle_order_button()}),s(document.body).on("payment_method_selected",function(){return t.toggle_order_button()}),s(document.body).on("click",".wc-braintree-paypal-account .cancel",function(e){return e.preventDefault(),s(e.currentTarget).parent().remove(),t.setup_braintree()}),s(document.body).on("update_checkout",function(e){return t.teardown_braintree()})}},{key:"toggle_order_button",value:function(){return!this.is_selected()||this.has_payment_nonce()||this.using_payment_token()?s("#place_order").show():s("#place_order").hide()}},{key:"verify_form",value:function(){var e=_get(r.prototype.__proto__||Object.getPrototypeOf(r.prototype),"verify_form",this).call(this);return 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(r.prototype.__proto__||Object.getPrototypeOf(r.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(r.prototype.__proto__||Object.getPrototypeOf(r.prototype),"setup_braintree",this).call(this),s("input.js-wc-braintree-paypal-tokenize-payment-method").prop("disabled",!1),this.toggle_order_button())}},{key:"do_integration_ready",value:function(){return u(this,n),this.cart_payment_nonce?this.unblock_ui():(this.load_paypal_sdk(),this.set_device_data())}},{key:"load_paypal_sdk",value:function(){var e,t=this,n=this.get_sdk_options();return this.paypal_sdk_loaded&&this.previous_paypal_sdk_options&&JSON.stringify(this.previous_paypal_sdk_options)===JSON.stringify(n)?this.do_paypal_sdk_loaded():(e=n,this.paypal_sdk_messages_component_loaded&&(e.components="buttons"),this.integration.loadPayPalSDK(e,function(){return t.paypal_sdk_loaded=!0,t.previous_paypal_sdk_options=n,paypal.Messages&&(t.paypal_sdk_messages_component_loaded=!0),t.do_paypal_sdk_loaded()}))}},{key:"do_paypal_sdk_loaded",value:function(){var t=this,e=this.is_single_use()?"checkout":"vault";return this.render_pay_later_messaging(),this.render_button(this.integration.createPayment({flow:e,intent:this.is_single_use()?this.paypal_intent:"tokenize",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"undefined"===t.get_button_styles().height&&s("#wc_braintree_paypal_container").css({width:"100%"}),t.unblock_ui()}).catch(function(e){return t.log("Could not render the PayPal button. "+e.message,e),t.hide_integration_ui(),t.unblock_ui()})}},{key:"render_pay_later_messaging",value:function(){var t=this,e=s("#wc_braintree_paypal_pay_later_messaging_container");if(e.length)return paypal.Messages?paypal.Messages({amount:this.get_order_amount()}).render("#wc_braintree_paypal_pay_later_messaging_container").catch(function(e){return t.log("Could not render the PayPal Pay Later messeging. "+e.message,e)}):e.hide()}},{key:"render_button",value:function(e,t,n){var r=this;return s(n).html(""),t={env:this.is_test_environment?"sandbox":"production",commit:this.button_is_pay_now(),style:t,onApprove:function(e,t){return r.on_approve(e,t)},onError:function(e){return r.handle_integration_error(e)}},this.is_single_use()?t.createOrder=function(){return e}:t.createBillingAgreement=function(){return e},paypal.Buttons(t).render(n)}},{key:"button_is_pay_now",value:function(){return!s("form#add_payment_method").length}},{key:"get_button_styles",value:function(){return this.button_styles}},{key:"on_approve",value:function(e){var t=this;return u(this,n),this.block_ui(),this.integration.tokenizePayment(e).then(function(e){return t.log("Payment method tokenized.",e),t.set_payment_method(e)}).catch(function(e){return t.handle_payment_error(e),t.unblock_ui()})}},{key:"set_payment_method",value:function(e){return s("input[name=wc_"+this.id+"_payment_nonce]").val(e.nonce),s("#wc_braintree_paypal_container").html(this.get_linked_account_html(e.details)),this.is_single_use()&&s("input.js-wc-braintree-paypal-tokenize-payment-method").prop("disabled",!0),s("#place_order").show(),this.form.submit()}},{key:"handle_saved_payment_methods",value:function(){var t=this;return _get(r.prototype.__proto__||Object.getPrototypeOf(r.prototype),"handle_saved_payment_methods",this).call(this),s("input.js-wc-braintree-paypal-tokenize-payment-method").change(function(e){if(null!=t.integration&&s(e.target).is(":visible"))return t.block_ui(),t.do_integration_ready()}).change()}},{key:"get_linked_account_html",value:function(e){var t;return u(this,n),t=s("<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=s("input[name=wc-braintree-paypal-tokenize-payment-method]");return 0===e.length||("checkbox"===e.attr("type")?!e.is(":checked"):!e.val())}},{key:"get_order_amount",value:function(){return s("input[name=wc_braintree_paypal_amount]").val()}},{key:"get_store_currency",value:function(){return s("input[name=wc_braintree_paypal_currency]").val()}},{key:"get_store_locale",value:function(){return s("input[name=wc_braintree_paypal_locale]").val()}},{key:"get_sdk_options",value:function(){var e=[[],this.disabled_funding_options],t=e[0],n=e[1];return this.is_paypal_card_enabled||n.push("card"),(this.is_paypal_pay_later_enabled?t:n).push("paylater"),e={components:this.is_paypal_pay_later_enabled?"buttons,messages":"buttons",currency:this.get_store_currency(),intent:this.is_single_use()?this.paypal_intent:"tokenize",vault:!this.is_single_use(),commit:this.button_is_pay_now()},this.force_buyer_country&&(e["buyer-country"]=this.force_buyer_country),t.length&&(e["enable-funding"]=t.join(",")),n.length&&(e["disable-funding"]=n.join(",")),e}},{key:"set_device_data",value:function(){if(braintree&&braintree.dataCollector)return braintree.dataCollector.create({client:this.client,paypal:!0}).then(function(e){if(e&&e.deviceData)return s("#wc_braintree_paypal_device_data").val(e.deviceData)})}}]),r),s(document.body).trigger("wc_braintree_paypal_payment_form_handler_loaded"),window.WC_Braintree_PayPal_Cart_Handler=(_inherits(o,WC_Braintree_PayPal_Payment_Form_Handler),_createClass(o,[{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,s.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"===s("input[name=wc_braintree_paypal_single_use]").val()}},{key:"has_payment_nonce",value:function(){return!1}}]),o),s(document.body).trigger("wc_braintree_paypal_cart_handler_loaded"),i=window.WC_Braintree_PayPal_Product_Button_Handler=(_inherits(_,WC_Braintree_PayPal_Payment_Form_Handler),_createClass(_,[{key:"handle_product_page",value:function(){return this.product_form={element:s("form.cart"),is_variable:s("form.cart").hasClass("variations_form")},this.should_validate_product_data&&this.product_form.element.on("change",this.validate_product_button),this.product_form.is_variable&&s(document.body).on("woocommerce_variation_has_changed",this.validate_product_button),this.validate_product_button()}},{key:"do_integration_ready",value:function(){if(u(this,i),_get(_.prototype.__proto__||Object.getPrototypeOf(_.prototype),"do_integration_ready",this).call(this),this.is_product_page)return this.validate_product_button()}},{key:"validate_product_button",value:function(){if(u(this,i),this.product_form.is_variable&&this.product_form.element.find(".single_add_to_cart_button").is(".disabled"))this.hide_button();else{if(!this.should_validate_product_data)return this.show_button();this.validate_product_data(this.show_button,this.hide_button)}}},{key:"validate_product_data",value:function(t,n){var r=this;return u(this,i),s.ajax({type:"POST",url:this.validate_product_url,data:{wp_nonce:this.validate_product_nonce,product_id:s("input[name=wc_braintree_paypal_product_id]").val(),cart_form:s("form.cart").serialize()}}).done(function(e){return e.data.is_valid?(e.data.order_amount&&r.maybe_update_order_amount(e.data.order_amount),t()):n()}).fail(n)}},{key:"hide_button",value:function(){return s("#wc_braintree_paypal_container, #wc_braintree_paypal_pay_later_messaging_container").slideUp()}},{key:"show_button",value:function(){return s("#wc_braintree_paypal_container, #wc_braintree_paypal_pay_later_messaging_container").slideDown()}},{key:"maybe_update_order_amount",value:function(e){if(parseFloat(e)!==parseFloat(this.get_order_amount()))return s('[name="wc_braintree_paypal_amount"]').val(e),this.refresh_braintree()}},{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=e).wp_nonce=this.product_checkout_nonce,e.product_id=s("input[name=wc_braintree_paypal_product_id]").val(),e.cart_form=s("form.cart").serialize(),s.ajax({type:"POST",url:this.product_checkout_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"===s("input[name=wc_braintree_paypal_single_use]").val()}},{key:"has_payment_nonce",value:function(){return!1}}]),_),s(document.body).trigger("wc_braintree_paypal_product_button_handler_loaded")})}).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){if("value"in i)return i.value;i=i.get;return void 0!==i?i.call(r):void 0}t=Object.getPrototypeOf(t);if(null!==t)return e(t,n,r)},_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(){function u(e,t){if(!(e instanceof t))throw new Error("Bound instance method accessed before binding")}var c=[].indexOf;jQuery(document).ready(function(s){var e,n,i;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}function a(e){_classCallCheck(this,a);var t=_possibleConstructorReturn(this,(a.__proto__||Object.getPrototypeOf(a)).call(this,e));return 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}function r(e){_classCallCheck(this,r);var t=_possibleConstructorReturn(this,(r.__proto__||Object.getPrototypeOf(r)).call(this,e));return t.do_integration_ready=t.do_integration_ready.bind(t),t.on_approve=t.on_approve.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_pay_later_enabled=e.is_paypal_pay_later_enabled,t.is_paypal_card_enabled=e.is_paypal_card_enabled,t.disabled_funding_options=e.paypal_disabled_funding_options,t.force_buyer_country=e.force_buyer_country,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.paypal_intent=e.paypal_intent,t.init(),t}function o(e){_classCallCheck(this,o);var t=_possibleConstructorReturn(this,(o.__proto__||Object.getPrototypeOf(o)).call(this,e));return t.is_paypal_card_enabled=!1,t.set_payment_method_nonce=e.set_payment_method_nonce,t.cart_handler_url=e.cart_handler_url,t.form=s("form.woocommerce-cart-form"),t.form_ui_selector="",t.setup_braintree(),s(document.body).on("updated_cart_totals",function(){return t.setup_braintree()}),t}function _(e){_classCallCheck(this,_);var t=_possibleConstructorReturn(this,(_.__proto__||Object.getPrototypeOf(_)).call(this,e));return t.do_integration_ready=t.do_integration_ready.bind(t),t.validate_product_button=t.validate_product_button.bind(t),t.validate_product_data=t.validate_product_data.bind(t),t.is_paypal_card_enabled=!1,t.product_checkout_nonce=e.product_checkout_nonce,t.product_checkout_url=e.product_checkout_url,t.is_product_page=e.is_product_page,t.validate_product_url=e.validate_product_url,t.validate_product_nonce=e.validate_product_nonce,t.should_validate_product_data=e.should_validate_product_data,t.form=s("form.woocommerce-cart-form"),t.form_ui_selector="",t.is_product_page&&t.handle_product_page(),t.setup_braintree(),s(document.body).on("updated_cart_totals",function(){return t.setup_braintree()}),t}return window.WC_Braintree_Payment_Form_Handler=(_createClass(t,[{key:"init",value:function(){return this.is_sdk_ready()?s("form.checkout").length?this.handle_checkout_page():s("form#order_review").length?this.handle_pay_page():s("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=s("form.checkout"),this.form_ui_selector=".woocommerce-checkout-payment",s(document.body).on("updated_checkout",function(){if(!e.setting_up)return s('iframe[name^="braintree-"]').remove(),e.setup_braintree()}),s(document.body).on("updated_checkout",function(){return e.handle_saved_payment_methods()}),s(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=s("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=s("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 s("input[name=wc_"+this.id+"_payment_nonce]").val(e),this.form.submit()}},{key:"handle_saved_payment_methods",value:function(){var n=this,e=s("div.js-wc-"+this.id_dasherized+"-new-payment-method-form");if(s("input.js-wc-"+this.id_dasherized+"-payment-token").change(function(){return s("input.js-wc-"+n.id_dasherized+"-payment-token:checked").val()?e.slideUp(200):e.slideDown(200)}).change(),s("input#createaccount").change(function(e){var t=s("input.js-wc-"+n.id_dasherized+"-tokenize-payment-method").closest("p.form-row");return s(e.target).is(":checked")?(t.slideDown(),t.next().show()):(t.hide(),t.next().hide())}),!s("input#createaccount").is(":checked"))return s("input#createaccount").change()}},{key:"setup_braintree",value:function(){if(!s("#wc-"+this.id_dasherized+"-account-number-hosted iframe").data("ready"))return this.setting_up=!0,this.block_ui(),s("input[name=wc_"+this.id+"_payment_nonce]").val(""),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}),r.unblock_ui()})}},{key:"get_client_token",value:function(){this.id;var e={action:"wc_"+this.id+"_get_client_token",nonce:this.client_token_nonce};return s.post(this.ajax_url,e)}},{key:"setup_integration",value:function(){var t=this;return this.set_device_data(),this.log("Creating integration."),this.get_integration_class().create(this.get_integration_options()).then(function(e){return t.integration=e,t.show_integration_ui(),s("#wc-"+t.id_dasherized+"-account-number-hosted iframe").data("ready",!0),t.do_integration_ready(),s(document).trigger("wc_"+t.id+"_integration_ready",t.integration),t.log("Integration ready."),t.setting_up=!1}).catch(function(e){return t.handle_integration_error(e),t.unblock_ui(),t.setting_up=!1})}},{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&&!this.tearing_down&&!this.setting_up)return this.log("Tearing down integration."),this.tearing_down=!0,this.block_ui(),this.integration.teardown(function(){return e.integration=null,e.tearing_down=!1,e.unblock_ui()})}},{key:"set_device_data",value:function(){if(braintree&&braintree.dataCollector)return braintree.dataCollector.create({client:this.client}).then(function(e){if(e&&e.deviceData)return s("input[id*='wc_braintree_device_data']").val(e.deviceData)})}},{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 s(".woocommerce-error, .woocommerce-message").remove(),this.form.prepend('<div class="woocommerce-error">'+e+"</div>").removeClass("processing").unblock(),s("html, body").animate({scrollTop:this.form.offset().top-100},1e3),s("input[name=wc_"+this.id+"_payment_nonce]").val(""),this.form.trigger("wc_"+this.id+"_rendered_error"),s(document.body).trigger("checkout_error"),this.unblock_ui()}},{key:"get_user_message",value:function(){return this.payment_error_message}},{key:"show_integration_ui",value:function(){if(s("div.js-wc-"+this.id_dasherized+"-new-payment-method-form").find(".woocommerce-error").remove(),s("input#createaccount").length&&s("input#createaccount").is(":checked"))return s("div.js-wc-"+this.id_dasherized+"-new-payment-method-form").find(".form-row").show()}},{key:"hide_integration_ui",value:function(){return s("div.js-wc-"+this.id_dasherized+"-new-payment-method-form").prepend('<div class="woocommerce-error">'+this.integration_error_message+"</div>"),s("div.js-wc-"+this.id_dasherized+"-new-payment-method-form").find(".form-row").hide()}},{key:"block_ui",value:function(){return s(this.form_ui_selector).block({message:null,overlayCSS:{background:"#fff",opacity:.6}})}},{key:"unblock_ui",value:function(){return s(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){t=1<arguments.length&&void 0!==t?t:null;if(this.debug)return console.log(this.name+": "+e),t?console.log(t):void 0}}]),t),s(document.body).trigger("wc_braintree_payment_form_handler_loaded"),e=window.WC_Braintree_Credit_Card_Payment_Form_Handler=(_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),s("input[name=wc_"+this.id+"_payment_nonce]").val(""),s("input[name=wc-"+this.id_dasherized+"-card-type]").val(""),s("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=s("input.js-wc-braintree-credit-card-payment-token:checked"),this.should_verify_3d_secure_token(e)?(this.verify_3d_secure(e.data("nonce"),null,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&&null!=e.details&&null!=e.details.bin)return t.should_verify_3d_secure(e)?t.verify_3d_secure(e.nonce,e.details.bin):t.submit_form(e.nonce)}).catch(function(e){return t.handle_payment_error(e)})}},{key:"get_integration_options",value:function(){var e={client:this.client,fields:{number:{selector:"#wc-braintree-credit-card-account-number-hosted",placeholder:s("#wc-braintree-credit-card-account-number-hosted").data("placeholder")},cvv:{selector:"#wc-braintree-credit-card-csc-hosted",placeholder:s("#wc-braintree-credit-card-csc-hosted").data("placeholder")},expirationDate:{selector:"#wc-braintree-credit-card-expiry-hosted",placeholder:s("#wc-braintree-credit-card-expiry-hosted").data("placeholder")}},styles:this.hosted_fields_styles};return 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&&s("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=s("div.js-wc-braintree-credit-card-new-payment-method-form"),e=s("div.wc-braintree-hosted-field-card-csc-parent"),s("input.js-wc-braintree-credit-card-payment-token").change(function(){return s("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("CUSTOMER"===e.type)switch(e.code){case"HOSTED_FIELDS_FIELDS_EMPTY":this.csc_required&&i.push(this.params.cvv_missing),this.using_payment_token()||(i.push(this.params.card_number_missing),i.push(this.params.card_exp_date_invalid));break;case"HOSTED_FIELDS_FIELDS_INVALID":if(null!=e.details)for(t=0,n=(r=e.details.invalidFieldKeys).length;t<n;t++)switch(r[t]){case"number":i.push(this.params.card_number_invalid);break;case"cvv":i.push(this.params.cvv_length_invalid);break;case"expirationDate":i.push(this.params.card_exp_date_invalid)}}else"NETWORK"===e.type&&null!=e.details.originalError.error.message&&(e=e.details.originalError.error.message,/given name format is invalid/.test(e)&&i.push(this.params.first_name_unsupported_characters),/surname format is invalid/.test(e)&&i.push(this.params.last_name_unsupported_characters));return i.length?i.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;if(null!=e.cards)return(t=s("#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],s("input[name=wc-"+this.id_dasherized+"-card-type]").val(n.type),null!=n.type&&(e=n.type,0<=c.call(this.enabled_card_types,e))?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()?(s("input[name=wc-"+this.id_dasherized+"-3d-secure-enabled]").val(1),this.threeDSecure&&this.threeDSecure.teardown(),braintree.threeDSecure.create({version:2,client:this.client}).then(function(e){return t.threeDSecure=e,s(document.body).on("click","#wc-braintree-credit-card-3dsecure-container",function(e){return s(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=e.details.cardType;return this.is_3d_secure_enabled()&&"CreditCard"===e.type&&0<=c.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,t,n){var r=this,i=2<arguments.length&&void 0!==n?n:null,a=s("#billing_state").val(),o=s("#billing_country").val(),_=s("#shipping_state").val(),n=s("#shipping_country").val(),o=s("input[name=billing_first_name]").val()?{givenName:s("input[name=billing_first_name]").val().latinise(),surname:s("input[name=billing_last_name]").val().latinise(),phoneNumber:s("input[name=billing_phone]").val(),streetAddress:s("input[name=billing_address_1]").val(),extendedAddress:s("input[name=billing_address_2]").val(),locality:s("#billing_city").val(),region:"string"==typeof a&&a.length<=2?a:"",postalCode:s("input[name=billing_postcode]").val(),countryCodeAlpha2:"string"==typeof o&&o.length<=2?o:""}:{},n=s("input[name=shipping_first_name]").val()?{shippingGivenName:s("input[name=shipping_first_name]").val().latinise(),shippingSurname:s("input[name=shipping_last_name]").val().latinise(),shippingAddress:{streetAddress:s("input[name=shipping_address_1]").val(),extendedAddress:s("input[name=shipping_address_2]").val(),locality:s("input[name=shipping_city]").val(),region:"string"==typeof _&&_.length<=2?_:"",postalCode:s("input[name=shipping_postcode]").val(),countryCodeAlpha2:"string"==typeof n&&n.length<=2?n:""}}:{},n={nonce:e,amount:s("input[name=wc-"+this.id_dasherized+"-3d-secure-order-total]").val(),email:s("input[name=billing_email]").val(),billingAddress:o,additionalInformation:n,onLookupComplete:function(e,t){r.log("3D Secure lookup complete.",e);try{return t()}catch(e){return r.handle_payment_error(e)}}};return"1"===s("input[name=wc-"+this.id_dasherized+"-cart-contains-subscription]").val()&&(n.challengeRequested=!0),this.log("Verifying 3D Secure.",n),this.threeDSecure.verifyCard(n).then(function(e){return r.log("3D Secure response received.",e),r.threeds.liability_shift_always_required&&!e.liabilityShifted?r.render_error(r.threeds.failure_message):(null!=i&&i.data("verified",!0),s("input[name=wc-"+r.id_dasherized+"-3d-secure-verified]").val(1),r.submit_form(e.nonce))}).catch(function(e){return r.handle_payment_error(e)})}},{key:"show_integration_ui",value:function(){return u(this,e),_get(a.prototype.__proto__||Object.getPrototypeOf(a.prototype),"show_integration_ui",this).call(this),s(".wc-braintree-hosted-field-parent").show()}},{key:"hide_integration_ui",value:function(){return u(this,e),_get(a.prototype.__proto__||Object.getPrototypeOf(a.prototype),"hide_integration_ui",this).call(this),s(".wc-braintree-hosted-field-parent").hide()}}]),a),s(document.body).trigger("wc_braintree_credit_card_payment_form_handler_loaded"),n=window.WC_Braintree_PayPal_Payment_Form_Handler=(_inherits(r,WC_Braintree_Payment_Form_Handler),_createClass(r,[{key:"init",value:function(){var t=this;return _get(r.prototype.__proto__||Object.getPrototypeOf(r.prototype),"init",this).call(this),s("input[name=wc_"+this.id+"_payment_nonce]").val(this.cart_payment_nonce),s(document.body).on("click",'input[name="payment_method"], input.js-wc-braintree-paypal-payment-token',function(){return t.toggle_order_button()}),s(document.body).on("payment_method_selected",function(){return t.toggle_order_button()}),s(document.body).on("click",".wc-braintree-paypal-account .cancel",function(e){return e.preventDefault(),s(e.currentTarget).parent().remove(),t.setup_braintree()}),s(document.body).on("update_checkout",function(e){return t.teardown_braintree()})}},{key:"toggle_order_button",value:function(){return!this.is_selected()||this.has_payment_nonce()||this.using_payment_token()?s("#place_order").show():s("#place_order").hide()}},{key:"verify_form",value:function(){var e=_get(r.prototype.__proto__||Object.getPrototypeOf(r.prototype),"verify_form",this).call(this);return 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(r.prototype.__proto__||Object.getPrototypeOf(r.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(r.prototype.__proto__||Object.getPrototypeOf(r.prototype),"setup_braintree",this).call(this),s("input.js-wc-braintree-paypal-tokenize-payment-method").prop("disabled",!1),this.toggle_order_button())}},{key:"do_integration_ready",value:function(){return u(this,n),this.cart_payment_nonce?this.unblock_ui():this.load_paypal_sdk()}},{key:"load_paypal_sdk",value:function(){var e,t=this,n=this.get_sdk_options();return this.paypal_sdk_loaded&&this.previous_paypal_sdk_options&&JSON.stringify(this.previous_paypal_sdk_options)===JSON.stringify(n)?this.do_paypal_sdk_loaded():(e=n,this.paypal_sdk_messages_component_loaded&&(e.components="buttons"),this.integration.loadPayPalSDK(e,function(){return t.paypal_sdk_loaded=!0,t.previous_paypal_sdk_options=n,paypal.Messages&&(t.paypal_sdk_messages_component_loaded=!0),t.do_paypal_sdk_loaded()}))}},{key:"do_paypal_sdk_loaded",value:function(){var t=this,e=this.is_single_use()?"checkout":"vault";return this.render_pay_later_messaging(),this.render_button(this.integration.createPayment({flow:e,intent:this.is_single_use()?this.paypal_intent:"tokenize",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"undefined"===t.get_button_styles().height&&s("#wc_braintree_paypal_container").css({width:"100%"}),t.unblock_ui()}).catch(function(e){return t.log("Could not render the PayPal button. "+e.message,e),t.hide_integration_ui(),t.unblock_ui()})}},{key:"render_pay_later_messaging",value:function(){var t=this,e=s("#wc_braintree_paypal_pay_later_messaging_container");if(e.length)return paypal.Messages?paypal.Messages({amount:this.get_order_amount()}).render("#wc_braintree_paypal_pay_later_messaging_container").catch(function(e){return t.log("Could not render the PayPal Pay Later messeging. "+e.message,e)}):e.hide()}},{key:"render_button",value:function(e,t,n){var r=this;return s(n).html(""),t={env:this.is_test_environment?"sandbox":"production",commit:this.button_is_pay_now(),style:t,onApprove:function(e,t){return r.on_approve(e,t)},onError:function(e){return r.handle_integration_error(e)}},this.is_single_use()?t.createOrder=function(){return e}:t.createBillingAgreement=function(){return e},paypal.Buttons(t).render(n)}},{key:"button_is_pay_now",value:function(){return!s("form#add_payment_method").length}},{key:"get_button_styles",value:function(){return this.button_styles}},{key:"on_approve",value:function(e){var t=this;return u(this,n),this.block_ui(),this.integration.tokenizePayment(e).then(function(e){return t.log("Payment method tokenized.",e),t.set_payment_method(e)}).catch(function(e){return t.handle_payment_error(e),t.unblock_ui()})}},{key:"set_payment_method",value:function(e){return s("input[name=wc_"+this.id+"_payment_nonce]").val(e.nonce),s("#wc_braintree_paypal_container").html(this.get_linked_account_html(e.details)),this.is_single_use()&&s("input.js-wc-braintree-paypal-tokenize-payment-method").prop("disabled",!0),s("#place_order").show(),this.form.submit()}},{key:"handle_saved_payment_methods",value:function(){var t=this;return _get(r.prototype.__proto__||Object.getPrototypeOf(r.prototype),"handle_saved_payment_methods",this).call(this),s("input.js-wc-braintree-paypal-tokenize-payment-method").change(function(e){if(null!=t.integration&&s(e.target).is(":visible"))return t.block_ui(),t.do_integration_ready()}).change()}},{key:"get_linked_account_html",value:function(e){var t;return u(this,n),t=s("<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=s("input[name=wc-braintree-paypal-tokenize-payment-method]");return 0===e.length||("checkbox"===e.attr("type")?!e.is(":checked"):!e.val())}},{key:"get_order_amount",value:function(){return s("input[name=wc_braintree_paypal_amount]").val()}},{key:"get_store_currency",value:function(){return s("input[name=wc_braintree_paypal_currency]").val()}},{key:"get_store_locale",value:function(){return s("input[name=wc_braintree_paypal_locale]").val()}},{key:"get_sdk_options",value:function(){var e=[[],this.disabled_funding_options],t=e[0],n=e[1];return this.is_paypal_card_enabled||n.push("card"),(this.is_paypal_pay_later_enabled?t:n).push("paylater"),e={components:this.is_paypal_pay_later_enabled?"buttons,messages":"buttons",currency:this.get_store_currency(),intent:this.is_single_use()?this.paypal_intent:"tokenize",vault:!this.is_single_use(),commit:this.button_is_pay_now()},this.force_buyer_country&&(e["buyer-country"]=this.force_buyer_country),t.length&&(e["enable-funding"]=t.join(",")),n.length&&(e["disable-funding"]=n.join(",")),e}}]),r),s(document.body).trigger("wc_braintree_paypal_payment_form_handler_loaded"),window.WC_Braintree_PayPal_Cart_Handler=(_inherits(o,WC_Braintree_PayPal_Payment_Form_Handler),_createClass(o,[{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,s.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"===s("input[name=wc_braintree_paypal_single_use]").val()}},{key:"has_payment_nonce",value:function(){return!1}}]),o),s(document.body).trigger("wc_braintree_paypal_cart_handler_loaded"),i=window.WC_Braintree_PayPal_Product_Button_Handler=(_inherits(_,WC_Braintree_PayPal_Payment_Form_Handler),_createClass(_,[{key:"handle_product_page",value:function(){return this.product_form={element:s("form.cart"),is_variable:s("form.cart").hasClass("variations_form")},this.should_validate_product_data&&this.product_form.element.on("change",this.validate_product_button),this.product_form.is_variable&&s(document.body).on("woocommerce_variation_has_changed",this.validate_product_button),this.validate_product_button()}},{key:"do_integration_ready",value:function(){if(u(this,i),_get(_.prototype.__proto__||Object.getPrototypeOf(_.prototype),"do_integration_ready",this).call(this),this.is_product_page)return this.validate_product_button()}},{key:"validate_product_button",value:function(){if(u(this,i),this.product_form.is_variable&&this.product_form.element.find(".single_add_to_cart_button").is(".disabled"))this.hide_button();else{if(!this.should_validate_product_data)return this.show_button();this.validate_product_data(this.show_button,this.hide_button)}}},{key:"validate_product_data",value:function(t,n){var r=this;return u(this,i),s.ajax({type:"POST",url:this.validate_product_url,data:{wp_nonce:this.validate_product_nonce,product_id:s("input[name=wc_braintree_paypal_product_id]").val(),cart_form:s("form.cart").serialize()}}).done(function(e){return e.data.is_valid?(e.data.order_amount&&r.maybe_update_order_amount(e.data.order_amount),t()):n()}).fail(n)}},{key:"hide_button",value:function(){return s("#wc_braintree_paypal_container, #wc_braintree_paypal_pay_later_messaging_container").slideUp()}},{key:"show_button",value:function(){return s("#wc_braintree_paypal_container, #wc_braintree_paypal_pay_later_messaging_container").slideDown()}},{key:"maybe_update_order_amount",value:function(e){if(parseFloat(e)!==parseFloat(this.get_order_amount()))return s('[name="wc_braintree_paypal_amount"]').val(e),this.refresh_braintree()}},{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=e).wp_nonce=this.product_checkout_nonce,e.product_id=s("input[name=wc_braintree_paypal_product_id]").val(),e.cart_form=s("form.cart").serialize(),s.ajax({type:"POST",url:this.product_checkout_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"===s("input[name=wc_braintree_paypal_single_use]").val()}},{key:"has_payment_nonce",value:function(){return!1}}]),_),s(document.body).trigger("wc_braintree_paypal_product_button_handler_loaded")})}).call(void 0);
changelog.txt ADDED
@@ -0,0 +1,249 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ *** Changelog ***
2
+
3
+ = 2.6.2 - 2021-11-16 =
4
+ * Feature - Add support for disabling funding methods
5
+ * Feature - Allow updating of expiration dates for credit cards in 'My Account'
6
+ * Tweak - Update 'device data' capture inner workings
7
+
8
+ = 2.6.1 - 2021-05-27 =
9
+ * Fix - Address an uncaught exception when getting the payment methods for a customer
10
+
11
+ = 2.6.0 - 2021-04-19 =
12
+ * Tweak - Add a filter to allow customizing the disabled funding PayPal options
13
+ * Fix - Prevent a PHP notice triggered while trying to access the cart object too early in a request
14
+
15
+ = 2.5.0 - 2021-03-18 =
16
+ * Feature - Upgrade to the latest Braintree JavaScript SDK and add support to show PayPal Pay Later offers to eligible buyers
17
+ * Tweak - Add Kount support for US based merchants who are using API keys to connect to Braintree
18
+ * Misc - Include device data for all customer-initiated PayPal transactions to increase the accuracy of the Advanced Fraud Management Tools in determining when a transaction is fraudulent
19
+ * Misc - Update the SkyVerge plugin framework to 5.10.5
20
+
21
+ = 2.4.3 - 2020-10-22 =
22
+ * Fix - Fix a checkout error that removes the CSC field when a saved payment method is selected and the billing country is changed
23
+
24
+ = 2.4.2 - 2020-10-14 =
25
+ * Fix - Address a possible race condition when loading Braintree device data scripts in front end
26
+
27
+ = 2.4.1 - 2020-09-28 =
28
+ * Fix - Fix a fatal error in some server environments with no case sensitive file systems while WooCommerce Product Add-ons is active
29
+
30
+ = 2.4.0 - 2020-08-12 =
31
+ * Fix - Halt plugin loading and display a notice if cURL is not available on the server
32
+ * Misc - The plugin name is updated to Braintree for WooCommerce
33
+ * Misc - Add support for WooCommerce 4.3
34
+ * Misc - Update the SkyVerge plugin framework to v5.7.1
35
+ * Misc - Require PHP 5.6+
36
+ * Dev - Classes in the WC_Braintree\Plugin_Framework namespace are now deprecated, use the namespace for the included version of the SkyVerge plugin framework (SkyVerge\WooCommerce\PluginFramework\v5_7_1)
37
+
38
+ = 2.3.11 - 2020-06-03 =
39
+ * Tweak - New users and users who disconnect should use API keys to connect to Braintree - no changes required for users already connected via Braintree Auth
40
+
41
+ = 2.3.10 - 2020-05-04 =
42
+ * Misc - Add support for WooCommerce 4.1
43
+
44
+ = 2.3.9 - 2020-04-20 =
45
+ * Fix - Fix fatal error in PHP < 5.4
46
+
47
+ = 2.3.8 - 2020-03-10 =
48
+ * Misc - Add support for WooCommerce 4.0
49
+
50
+ = 2.3.7 - 2020-02-05 =
51
+ * Fix - Prevent error with payment fields shown in the Checkout page on WooCommerce 3.9 when the address fields are updated
52
+
53
+ = 2.3.6 - 2020-01-05 =
54
+ * Misc - Add support for WooCommerce 3.9
55
+
56
+ = 2.3.5 - 2019-12-12 =
57
+ * Fix - Fix redirect URL encoding when connecting via Braintree Auth
58
+
59
+ = 2.3.4 - 2019-12-10 =
60
+ * Tweak - Display informative message when 3D Secure fails due to unsupported characters in the customer name
61
+
62
+ = 2.3.3 - 2019-11-28 =
63
+ * Fix - Catch CardinalCommerce JS errors in unsupported browsers to prevent hung checkouts
64
+
65
+ = 2.3.2 - 2019-10-21 =
66
+ * Misc - Add support for WooCommerce 3.8
67
+
68
+ = 2.3.1 - 2019-10-16 =
69
+ * Fix - Prevent 3D Secure errors trying to purchase free trial subscriptions
70
+ * Fix - Fix a bug with regular expressions being used in PHP 7.3+
71
+
72
+ = 2.3.0 - 2019-10-03 =
73
+ * Feature - PayPal buy-now buttons can now be added to product pages
74
+ * Tweak - Enable PayPal Credit by default on new installs
75
+ * Fix - Fix a styling issue with the merchant account ID field in settings
76
+ * Fix - Fix a bug with a regular expression being used in PHP 7.3+
77
+
78
+ = 2.2.7 - 2019-09-12 =
79
+ * Fix - Fix JavaScript error blocking payments with 3D Secure from the Pay Order page
80
+
81
+ = 2.2.6 - 2019-08-07 =
82
+ * Tweak - Add support for 3D Secure 2.0
83
+ * Misc - Add support for WooCommerce 3.7
84
+
85
+ = 2.2.5 - 2019-06-06 =
86
+ * Fix - Regenerate client tokens on checkout refresh to use the customer's latest currency
87
+ * Fix - Ensure saved PayPal accounts display their associated email address if no nickname is set
88
+
89
+ = 2.2.4 - 2019-04-01 =
90
+ * Fix - Prevent an error when completing pre-orders that were placed using the PayPal gateway
91
+
92
+ = 2.2.3 - 2019-03-20 =
93
+ * Fix - Ensure Kount merchant ID is set in device data for stores using advanced fraud tools via Kount
94
+
95
+ = 2.2.2 - 2019-02-28 =
96
+ * Fix - Prevent JS errors when reloading the payment form in IE and Edge
97
+
98
+ = 2.2.1 - 2019-02-06 =
99
+ * Fix - Ensure updated order totals are used for validating 3D Secure when the checkout is refreshed
100
+ * Fix - Prevent 3D Secure errors when non-US region codes are used during validation
101
+ * Fix - Ensure payment forms are available for orders that start at $0 but require payment after shipping selection
102
+ * Fix - Update the recurring flag for new API requirements when processing subscription payments
103
+ * Misc - Reorder manual connection setting inputs to match documentation
104
+
105
+ = 2.2.0 - 2018-11-12 =
106
+ * Feature - Add Apple Pay support for iOS users to quickly place orders from the product, cart, and checkout pages
107
+ * Feature - Allow the PayPal button to be customized from the plugin settings
108
+ * Feature - Add PayPal Credit support
109
+ * Feature - Add support for auto-capturing orders when changed to a paid status
110
+ * Feature - Customers can now label their saved payment methods for easier identification when choosing how to pay
111
+ * Tweak - Improve the My Account Payment Methods table on desktop and mobile
112
+ * Tweak - Automatically enable 3D Secure when enabled in the merchant account
113
+ * Tweak - Allow users to set the card types that should process 3D Secure
114
+ * Tweak - Allow users to set the 3D Secure level and block transactions where liability is not shifted
115
+ * Fix - Fix an issue where duplicate addresses were added when processing transactions with a previously saved payment method
116
+ * Fix - Ensure the payment forms are re-created after shipping method selection
117
+ * Misc - Remove support for WooCommerce 2.5
118
+
119
+ = 2.1.4 - 2018-10-17 =
120
+ * Misc - Add support for WooCommerce 3.5
121
+
122
+ = 2.1.3 - 2018-08-01 =
123
+ * Tweak - Generalize the PayPal link error to allow for different PayPal button colors
124
+ * Fix - Ensure PayPal charges can still be captured when the Credit Card gateway is disabled
125
+ * Fix - Prevent stalled checkout when PayPal is cancelled or closed
126
+ * Fix - Prevent duplicate PayPal buttons when checkout is refreshed
127
+ * Fix - Don't reset the "Create Account" form when the checkout is refreshed
128
+
129
+ = 2.1.2 =
130
+ * Tweak - Add payment details to the customer data export and remove it for erasure requests
131
+ * Tweak - Remove payment tokens for customer data erasure requests
132
+ * Misc - Add support for WooCommerce 3.4
133
+
134
+ = 2.1.1 =
135
+ * Fix - Fix the payment form JavaScript compatibility with IE 11
136
+
137
+ = 2.1.0 =
138
+ * Feature - Upgrade to the latest Braintree JavaScript SDK for improved customer experience, reliability, and error handling
139
+ * Tweak - Add placeholder text for credit card inputs
140
+ * Tweak - Add responsive sizing to the PayPal buttons and update to the recommended styling for the Cart and Checkout pages
141
+ * Tweak - Add setting and filter to disable PayPal on the cart page
142
+ * Tweak - Update all translatable strings to the same text domain
143
+ * Tweak - Hide Kount as a fraud tool option for US-based stores as it's not currently supported
144
+ * Tweak - Only load the Braintree scripts when required on payment pages
145
+ * Fix - Ensure that new customers have their billing address stored in the vault on their first transaction
146
+ * Fix - Prevent linked PayPal accounts from being cleared if there are address errors at checkout
147
+ * Fix - Fix some deprecated function notices
148
+
149
+ = 2.0.4 =
150
+ * Fix - Prevent a fatal error when completing pre-orders
151
+ * Fix - Prevent JavaScript errors when applying a 100%-off coupon at checkout
152
+
153
+ = 2.0.3 =
154
+ * Fix - Add a missing namespace that could cause JavaScript issues with some configurations
155
+
156
+ = 2.0.2 =
157
+ * Fix - Ensure refunds succeed for legacy orders that are missing the necessary meta data
158
+ * Fix - Add fallbacks for certain subscriptions upgrades after WooCommerce 3.0 compatibility issues
159
+ * Fix - Default set the Require CSC setting for legacy upgrades to avoid inaccurate error notices at checkout
160
+ * Fix - Prevent PayPal JavaScript errors in certain cases
161
+ * Fix - Ensure subscriptions are not affected if Change Payment fails due to declines or other problems
162
+ * Fix - Ensure old payment methods can be removed by the customer after changing subscription payment to a new method
163
+
164
+ = 2.0.1 =
165
+ * Fix - Purchasing a subscription with PayPal could lead to a blank order note being added
166
+ * Fix - Ensure all upgrade routines run for users who have used both the SkyVerge Braintree and PayPal Powered by Braintree v1 in the past
167
+ * Fix - Issue where existing subscriptions in some cases couldn't switch to using a new PayPal account
168
+ * Fix - Ensure "Place Order" button always remains visible for PayPal when accepting terms
169
+
170
+ = 2.0.0 =
171
+ * Feature - Now supports non-USA Braintree merchant accounts! Bonjour, hola, hallo, and g'day :)
172
+ * Feature - Supports WooCommerce Pre-Orders plugin
173
+ * Feature - Credit cards and PayPal gateways can be enabled individually
174
+ * Feature - Customers can opt to save cards or link a PayPal account at checkout for future use, or use saved methods during checkout
175
+ * Feature - Customers can manage or add new payment methods from the account area
176
+ * Feature - Uses an enhanced payment form with retina icons
177
+ * Feature - Add multiple merchant IDs to support multi-currency shops (requires a currency switcher)
178
+ * Feature - Supports Advanced Fraud tools and Kount Direct
179
+ * Feature - Supports 3D Secure for Visa / MasterCard transactions
180
+ * Feature - Add dynamic descriptors to be displayed for the transaction on customer's credit card statements
181
+ * Feature - Can show detailed decline messages at checkout to better inform customers of transaction decline reasons
182
+ * Feature - Allows bulk action to capture charges
183
+ * Feature - Orders with only virtual items can now force a charge instead of authorization
184
+ * Tweak - Capturing a charge now moves order status to "processing" automatically
185
+ * Tweak - Voided orders are now marked as "cancelled" instead of "refunded"
186
+ * Tweak - Admins can now manually update Subscription payment methods and view payment tokens
187
+ * Fix - Subscription orders will no longer force a charge and allow an authorization depending on settings
188
+ * Fix - Handle Subscriptions renewal failures by failing the order
189
+ * Fix - Customers can switch Subscriptions payment methods on their own from the account
190
+ * Fix - Stores sandbox and live customer tokens separately to avoid `Customer ID is invalid.` messages
191
+ * Fix - Ensures that payment can be made from the "My Account" page for pending orders
192
+ * Misc - Adds support for WooCommerce 3.0+
193
+ * Misc - Removes support for WooCommerce 2.4 and lower
194
+ * Misc - Added upgrade routine from SkyVerge Braintree plugin to allow for migrating existing tokens and subscriptions
195
+ * Misc - Refactor for improved performance and stability
196
+ * Misc - Other small fixes and improvements
197
+
198
+ = 1.2.7 =
199
+ * Fix - If you connected but did not save the settings, the enabled value would not be set and scripts would not enqueue
200
+ * Fix - Disable customer initiated payment method changes - PayPal Braintree does not support zero amount transactions
201
+ * Tweak - On new installs, debug messages are no longer sent to the WooCommerce System Status log by default
202
+
203
+ = 1.2.6 =
204
+ * Fix - Issue where buyer unable to change subscription payment method with free-trial (order total is 0).
205
+
206
+ = 1.2.5 =
207
+ * Fix - Prevent void on unsettled transaction when refunding partially.
208
+ * Tweak - Add filter wc_gateway_paypal_braintree_sale_args to filter arguments passed to sale call.
209
+
210
+ = 1.2.4 =
211
+ * Fix - Free subscription trails not allowed.
212
+ * Fix - Subscription recurring billing after free trial not working.
213
+
214
+ = 1.2.3 =
215
+ * Fix - Handle uncaught exceptions thrown by Braintree SDK. API calls from SDK may throws exception, thus it need to be handled properly in try/catch block.
216
+ * Fix - Issue where deactivating WooCommerce might throws an error
217
+
218
+ = 1.2.2 =
219
+ * Tweak - Updated FAQ that emphasizes this plugin only works in the U.S. currently
220
+ * Fix - Updated JS SDK to 2.24.1 which should fixes issue where credit card fields working intermittently
221
+ * Tweak - Add filter on credit card icons
222
+ * Tweak - Provide default title for cards and PayPal account methods
223
+
224
+ = 1.2.1 =
225
+ * Fix - Issue where Subscriptions with free trial was not processed
226
+ * Fix - Missing "Change Payment" button in "My Subscriptions" section
227
+ * Tweak - Make enabled option default to 'yes'
228
+ * Tweak - Add adnmin notice to setup / connect after plugin is activated
229
+ * Fix - Consider more statuses (settling, submitted_for_settlement, settlement_pending) to mark order as in-processing
230
+ * Fix - Issue where settings section rendered twice
231
+
232
+ = 1.2.0 =
233
+ * Replace array initialization code that causes a fatal error on PHP 5.2 or earlier. PHP 5.4+ is still required, but this code prevented the compatibility check from running and displaying the version requirements
234
+ * Update to the latest Braintree SDK (3.8.0)
235
+ * Add authorize/capture feature, allowing delayed settlement
236
+ * Pre-fill certain merchant and store details when connecting
237
+ * Fix missing gateway title and transaction URL when order in-hold
238
+
239
+ = 1.1.0 =
240
+ * Fixed a bug which would cause the gateway settings to report that the gateway was enabled when it actually was not fully enabled.
241
+ * Updated contributors list
242
+
243
+ = 1.0.1 =
244
+ * Remove duplicate SSL warnings
245
+ * Update environment check to also check after activation for environment problems
246
+ * Fix link in enabled-but-not-connected notice
247
+
248
+ = 1.0.0 =
249
+ * Initial release
class-wc-braintree.php CHANGED
@@ -35,7 +35,7 @@ class WC_Braintree extends Framework\SV_WC_Payment_Gateway_Plugin {
35
 
36
 
37
  /** plugin version number */
38
- const VERSION = '2.6.1';
39
 
40
  /** Braintree JS SDK version */
41
  const BRAINTREE_JS_SDK_VERSION = '3.73.1';
@@ -123,6 +123,7 @@ class WC_Braintree extends Framework\SV_WC_Payment_Gateway_Plugin {
123
  require_once( $this->get_plugin_path() . '/includes/class-wc-payment-token-braintree-paypal.php' );
124
  require_once( $this->get_plugin_path() . '/includes/class-wc-braintree-payment-method-handler.php' );
125
  require_once( $this->get_plugin_path() . '/includes/class-wc-braintree-payment-method.php' );
 
126
 
127
  // payment forms
128
  require_once( $this->get_plugin_path() . '/includes/payment-forms/abstract-wc-braintree-payment-form.php' );
@@ -622,6 +623,15 @@ class WC_Braintree extends Framework\SV_WC_Payment_Gateway_Plugin {
622
  return $this->frontend;
623
  }
624
 
 
 
 
 
 
 
 
 
 
625
 
626
  /**
627
  * Returns the plugin name, localized
35
 
36
 
37
  /** plugin version number */
38
+ const VERSION = '2.6.2';
39
 
40
  /** Braintree JS SDK version */
41
  const BRAINTREE_JS_SDK_VERSION = '3.73.1';
123
  require_once( $this->get_plugin_path() . '/includes/class-wc-payment-token-braintree-paypal.php' );
124
  require_once( $this->get_plugin_path() . '/includes/class-wc-braintree-payment-method-handler.php' );
125
  require_once( $this->get_plugin_path() . '/includes/class-wc-braintree-payment-method.php' );
126
+ require_once( $this->get_plugin_path() . '/includes/class-wc-braintree-my-payment-methods.php' );
127
 
128
  // payment forms
129
  require_once( $this->get_plugin_path() . '/includes/payment-forms/abstract-wc-braintree-payment-form.php' );
623
  return $this->frontend;
624
  }
625
 
626
+ /**
627
+ * Overrides the default SV framework implementation of payment methods in My Account.
628
+ *
629
+ * @since 2.6.2
630
+ * @return \WC_Braintree_My_Payment_Methods
631
+ */
632
+ public function get_my_payment_methods_instance() {
633
+ return new WC_Braintree_My_Payment_Methods( $this );
634
+ }
635
 
636
  /**
637
  * Returns the plugin name, localized
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 Braintree for WooCommerce Payment Gateway package.
3
  msgid ""
4
  msgstr ""
5
- "Project-Id-Version: Braintree for WooCommerce Payment Gateway 2.6.1\n"
6
  "Report-Msgid-Bugs-To: "
7
  "https://woocommerce.com/my-account/marketplace-ticket-form/\n"
8
- "POT-Creation-Date: 2021-05-27 10:31:52+00:00\n"
9
  "MIME-Version: 1.0\n"
10
  "Content-Type: text/plain; charset=utf-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
@@ -13,52 +13,52 @@ msgstr ""
13
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
14
  "Language-Team: LANGUAGE <LL@li.org>\n"
15
 
16
- #: class-wc-braintree.php:310
17
  msgid "Connected successfully."
18
  msgstr ""
19
 
20
- #: class-wc-braintree.php:313
21
  msgid "There was an error connecting your Braintree account. Please try again."
22
  msgstr ""
23
 
24
- #: class-wc-braintree.php:343
25
  msgid "Invalid connection request"
26
  msgstr ""
27
 
28
- #: class-wc-braintree.php:385
29
  msgid "Disconnected successfully."
30
  msgstr ""
31
 
32
- #: class-wc-braintree.php:410
33
  msgid "Invalid disconnect request"
34
  msgstr ""
35
 
36
- #: class-wc-braintree.php:503
37
  msgid ""
38
  "Heads up! You've enabled advanced fraud tools for Braintree. Please make "
39
  "sure that advanced fraud tools are also enabled in your Braintree account. "
40
  "Need help? See the %1$sdocumentation%2$s."
41
  msgstr ""
42
 
43
- #: class-wc-braintree.php:521
44
  msgid ""
45
  "Braintree for WooCommerce is almost ready. To get started, %1$sconnect your "
46
  "Braintree account%2$s."
47
  msgstr ""
48
 
49
- #: class-wc-braintree.php:533
50
  msgid ""
51
  "Upgrade successful! WooCommerce Braintree deactivated, and Braintree for "
52
  "WooCommerce has been %1$sconfigured with your previous settings%2$s."
53
  msgstr ""
54
 
55
- #: class-wc-braintree.php:546
56
  msgid ""
57
  "WooCommerce is not being forced over SSL -- Using PayPal with Braintree "
58
  "requires that checkout to be forced over SSL."
59
  msgstr ""
60
 
61
- #: class-wc-braintree.php:581
62
  #. translators: Placeholders: %1$s - payment gateway name tag, %2$s - <a> tag,
63
  #. %3$s - </a> tag
64
  msgid ""
@@ -70,11 +70,11 @@ msgstr ""
70
  msgid "Braintree for WooCommerce Payment Gateway"
71
  msgstr ""
72
 
73
- #: class-wc-braintree.php:687
74
  msgid "Configure Credit Card"
75
  msgstr ""
76
 
77
- #: class-wc-braintree.php:687
78
  msgid "Configure PayPal"
79
  msgstr ""
80
 
@@ -98,33 +98,33 @@ msgstr ""
98
  msgid "The CSC for the transaction was invalid or incorrect."
99
  msgstr ""
100
 
101
- #: includes/api/class-wc-braintree-api.php:557
102
  msgid ""
103
  "Invalid Credentials, please double-check your API credentials (Merchant ID, "
104
  "Public Key, Private Key, and Merchant Account ID) and try again."
105
  msgstr ""
106
 
107
- #: includes/api/class-wc-braintree-api.php:561
108
  msgid ""
109
  "Authorization Failed, please verify the user for the API credentials "
110
  "provided can perform transactions and that the request data is correct."
111
  msgstr ""
112
 
113
- #: includes/api/class-wc-braintree-api.php:565
114
  msgid "Braintree is currently down for maintenance, please try again later."
115
  msgstr ""
116
 
117
- #: includes/api/class-wc-braintree-api.php:569
118
  msgid "The record cannot be found, please contact support."
119
  msgstr ""
120
 
121
- #: includes/api/class-wc-braintree-api.php:573
122
  msgid ""
123
  "Braintree encountered an error when processing your request, please try "
124
  "again later or contact support."
125
  msgstr ""
126
 
127
- #: includes/api/class-wc-braintree-api.php:577
128
  msgid ""
129
  "Braintree cannot verify your server's SSL certificate. Please contact your "
130
  "hosting provider or try again later."
@@ -422,51 +422,61 @@ msgstr ""
422
  msgid "Allow customers to check out with PayPal from the Cart page"
423
  msgstr ""
424
 
425
- #: includes/class-wc-gateway-braintree-paypal.php:408
 
 
 
 
 
 
 
 
 
 
426
  msgid "Preview"
427
  msgstr ""
428
 
429
- #: includes/class-wc-gateway-braintree-paypal.php:565
430
  #. translators: Placeholders: %1$s - payment method title (e.g. PayPal), %2$s -
431
  #. transaction environment (either Sandbox or blank string), %3$s - type of
432
  #. transaction (either Authorization or Payment)
433
  msgid "%1$s %2$s %3$s Approved"
434
  msgstr ""
435
 
436
- #: includes/class-wc-gateway-braintree-paypal.php:567
437
  #: includes/class-wc-gateway-braintree.php:1464
438
  msgid "Sandbox"
439
  msgstr ""
440
 
441
- #: includes/class-wc-gateway-braintree-paypal.php:568
442
  msgid "Authorization"
443
  msgstr ""
444
 
445
- #: includes/class-wc-gateway-braintree-paypal.php:568
446
  msgid "Payment"
447
  msgstr ""
448
 
449
- #: includes/class-wc-gateway-braintree-paypal.php:574
450
  #: includes/integrations/Pre_Orders.php:109
451
  #. translators: Placeholders: %s - transaction ID
452
  msgid "(Transaction ID %s)"
453
  msgstr ""
454
 
455
- #: includes/class-wc-gateway-braintree-paypal.php:595
456
  msgid "PayPal Account Saved: %s"
457
  msgstr ""
458
 
459
- #: includes/class-wc-gateway-braintree-paypal.php:702
460
  msgid "PayPal"
461
  msgstr ""
462
 
463
- #: includes/class-wc-gateway-braintree-paypal.php:716
464
  msgid ""
465
  "Click the PayPal icon below to sign into your PayPal account and pay "
466
  "securely."
467
  msgstr ""
468
 
469
- #: includes/class-wc-gateway-braintree-paypal.php:1137
470
  msgid ""
471
  "Displays Pay Later messaging for available offers. Vaulted payment/billing "
472
  "agreement integrations and some merchant categories are not eligible to "
@@ -475,7 +485,7 @@ msgid ""
475
  "action in accordance with the User agreement."
476
  msgstr ""
477
 
478
- #: includes/class-wc-gateway-braintree-paypal.php:1147
479
  msgid ""
480
  "Displays Pay Later messaging for available offers. Restrictions apply. "
481
  "%1$sClick here to learn more.%2$s"
@@ -766,4 +776,64 @@ msgstr ""
766
  #: includes/class-wc-gateway-braintree-paypal.php:316
767
  msgctxt "button shape option"
768
  msgid "Rectangle"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
769
  msgstr ""
2
  # This file is distributed under the same license as the Braintree for WooCommerce Payment Gateway package.
3
  msgid ""
4
  msgstr ""
5
+ "Project-Id-Version: Braintree for WooCommerce Payment Gateway 2.6.2\n"
6
  "Report-Msgid-Bugs-To: "
7
  "https://woocommerce.com/my-account/marketplace-ticket-form/\n"
8
+ "POT-Creation-Date: 2021-11-16 17:55:11+00:00\n"
9
  "MIME-Version: 1.0\n"
10
  "Content-Type: text/plain; charset=utf-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
13
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
14
  "Language-Team: LANGUAGE <LL@li.org>\n"
15
 
16
+ #: class-wc-braintree.php:311
17
  msgid "Connected successfully."
18
  msgstr ""
19
 
20
+ #: class-wc-braintree.php:314
21
  msgid "There was an error connecting your Braintree account. Please try again."
22
  msgstr ""
23
 
24
+ #: class-wc-braintree.php:344
25
  msgid "Invalid connection request"
26
  msgstr ""
27
 
28
+ #: class-wc-braintree.php:386
29
  msgid "Disconnected successfully."
30
  msgstr ""
31
 
32
+ #: class-wc-braintree.php:411
33
  msgid "Invalid disconnect request"
34
  msgstr ""
35
 
36
+ #: class-wc-braintree.php:504
37
  msgid ""
38
  "Heads up! You've enabled advanced fraud tools for Braintree. Please make "
39
  "sure that advanced fraud tools are also enabled in your Braintree account. "
40
  "Need help? See the %1$sdocumentation%2$s."
41
  msgstr ""
42
 
43
+ #: class-wc-braintree.php:522
44
  msgid ""
45
  "Braintree for WooCommerce is almost ready. To get started, %1$sconnect your "
46
  "Braintree account%2$s."
47
  msgstr ""
48
 
49
+ #: class-wc-braintree.php:534
50
  msgid ""
51
  "Upgrade successful! WooCommerce Braintree deactivated, and Braintree for "
52
  "WooCommerce has been %1$sconfigured with your previous settings%2$s."
53
  msgstr ""
54
 
55
+ #: class-wc-braintree.php:547
56
  msgid ""
57
  "WooCommerce is not being forced over SSL -- Using PayPal with Braintree "
58
  "requires that checkout to be forced over SSL."
59
  msgstr ""
60
 
61
+ #: class-wc-braintree.php:582
62
  #. translators: Placeholders: %1$s - payment gateway name tag, %2$s - <a> tag,
63
  #. %3$s - </a> tag
64
  msgid ""
70
  msgid "Braintree for WooCommerce Payment Gateway"
71
  msgstr ""
72
 
73
+ #: class-wc-braintree.php:697
74
  msgid "Configure Credit Card"
75
  msgstr ""
76
 
77
+ #: class-wc-braintree.php:697
78
  msgid "Configure PayPal"
79
  msgstr ""
80
 
98
  msgid "The CSC for the transaction was invalid or incorrect."
99
  msgstr ""
100
 
101
+ #: includes/api/class-wc-braintree-api.php:575
102
  msgid ""
103
  "Invalid Credentials, please double-check your API credentials (Merchant ID, "
104
  "Public Key, Private Key, and Merchant Account ID) and try again."
105
  msgstr ""
106
 
107
+ #: includes/api/class-wc-braintree-api.php:579
108
  msgid ""
109
  "Authorization Failed, please verify the user for the API credentials "
110
  "provided can perform transactions and that the request data is correct."
111
  msgstr ""
112
 
113
+ #: includes/api/class-wc-braintree-api.php:583
114
  msgid "Braintree is currently down for maintenance, please try again later."
115
  msgstr ""
116
 
117
+ #: includes/api/class-wc-braintree-api.php:587
118
  msgid "The record cannot be found, please contact support."
119
  msgstr ""
120
 
121
+ #: includes/api/class-wc-braintree-api.php:591
122
  msgid ""
123
  "Braintree encountered an error when processing your request, please try "
124
  "again later or contact support."
125
  msgstr ""
126
 
127
+ #: includes/api/class-wc-braintree-api.php:595
128
  msgid ""
129
  "Braintree cannot verify your server's SSL certificate. Please contact your "
130
  "hosting provider or try again later."
422
  msgid "Allow customers to check out with PayPal from the Cart page"
423
  msgstr ""
424
 
425
+ #: includes/class-wc-gateway-braintree-paypal.php:390
426
+ msgid "Disable funding sources"
427
+ msgstr ""
428
+
429
+ #: includes/class-wc-gateway-braintree-paypal.php:395
430
+ msgid ""
431
+ "By default all possible funding sources will be shown. You can disable some "
432
+ "sources, if you wish."
433
+ msgstr ""
434
+
435
+ #: includes/class-wc-gateway-braintree-paypal.php:434
436
  msgid "Preview"
437
  msgstr ""
438
 
439
+ #: includes/class-wc-gateway-braintree-paypal.php:591
440
  #. translators: Placeholders: %1$s - payment method title (e.g. PayPal), %2$s -
441
  #. transaction environment (either Sandbox or blank string), %3$s - type of
442
  #. transaction (either Authorization or Payment)
443
  msgid "%1$s %2$s %3$s Approved"
444
  msgstr ""
445
 
446
+ #: includes/class-wc-gateway-braintree-paypal.php:593
447
  #: includes/class-wc-gateway-braintree.php:1464
448
  msgid "Sandbox"
449
  msgstr ""
450
 
451
+ #: includes/class-wc-gateway-braintree-paypal.php:594
452
  msgid "Authorization"
453
  msgstr ""
454
 
455
+ #: includes/class-wc-gateway-braintree-paypal.php:594
456
  msgid "Payment"
457
  msgstr ""
458
 
459
+ #: includes/class-wc-gateway-braintree-paypal.php:600
460
  #: includes/integrations/Pre_Orders.php:109
461
  #. translators: Placeholders: %s - transaction ID
462
  msgid "(Transaction ID %s)"
463
  msgstr ""
464
 
465
+ #: includes/class-wc-gateway-braintree-paypal.php:621
466
  msgid "PayPal Account Saved: %s"
467
  msgstr ""
468
 
469
+ #: includes/class-wc-gateway-braintree-paypal.php:728
470
  msgid "PayPal"
471
  msgstr ""
472
 
473
+ #: includes/class-wc-gateway-braintree-paypal.php:742
474
  msgid ""
475
  "Click the PayPal icon below to sign into your PayPal account and pay "
476
  "securely."
477
  msgstr ""
478
 
479
+ #: includes/class-wc-gateway-braintree-paypal.php:1171
480
  msgid ""
481
  "Displays Pay Later messaging for available offers. Vaulted payment/billing "
482
  "agreement integrations and some merchant categories are not eligible to "
485
  "action in accordance with the User agreement."
486
  msgstr ""
487
 
488
+ #: includes/class-wc-gateway-braintree-paypal.php:1181
489
  msgid ""
490
  "Displays Pay Later messaging for available offers. Restrictions apply. "
491
  "%1$sClick here to learn more.%2$s"
776
  #: includes/class-wc-gateway-braintree-paypal.php:316
777
  msgctxt "button shape option"
778
  msgid "Rectangle"
779
+ msgstr ""
780
+
781
+ #: includes/class-wc-gateway-braintree-paypal.php:400
782
+ msgctxt "Name of payment method"
783
+ msgid "Credit or debit cards"
784
+ msgstr ""
785
+
786
+ #: includes/class-wc-gateway-braintree-paypal.php:401
787
+ msgctxt "Name of payment method"
788
+ msgid "BLIK"
789
+ msgstr ""
790
+
791
+ #: includes/class-wc-gateway-braintree-paypal.php:402
792
+ msgctxt "Name of payment method"
793
+ msgid "SEPA-Lastschrift"
794
+ msgstr ""
795
+
796
+ #: includes/class-wc-gateway-braintree-paypal.php:403
797
+ msgctxt "Name of payment method"
798
+ msgid "Bancontact"
799
+ msgstr ""
800
+
801
+ #: includes/class-wc-gateway-braintree-paypal.php:404
802
+ msgctxt "Name of payment method"
803
+ msgid "eps"
804
+ msgstr ""
805
+
806
+ #: includes/class-wc-gateway-braintree-paypal.php:405
807
+ msgctxt "Name of payment method"
808
+ msgid "giropay"
809
+ msgstr ""
810
+
811
+ #: includes/class-wc-gateway-braintree-paypal.php:406
812
+ msgctxt "Name of payment method"
813
+ msgid "iDEAL"
814
+ msgstr ""
815
+
816
+ #: includes/class-wc-gateway-braintree-paypal.php:407
817
+ msgctxt "Name of payment method"
818
+ msgid "Mercado Pago"
819
+ msgstr ""
820
+
821
+ #: includes/class-wc-gateway-braintree-paypal.php:408
822
+ msgctxt "Name of payment method"
823
+ msgid "MyBank"
824
+ msgstr ""
825
+
826
+ #: includes/class-wc-gateway-braintree-paypal.php:409
827
+ msgctxt "Name of payment method"
828
+ msgid "Przelewy24"
829
+ msgstr ""
830
+
831
+ #: includes/class-wc-gateway-braintree-paypal.php:410
832
+ msgctxt "Name of payment method"
833
+ msgid "Sofort"
834
+ msgstr ""
835
+
836
+ #: includes/class-wc-gateway-braintree-paypal.php:411
837
+ msgctxt "Name of payment method"
838
+ msgid "Venmo"
839
  msgstr ""
includes/api/class-wc-braintree-api.php CHANGED
@@ -379,6 +379,24 @@ class WC_Braintree_API extends Framework\SV_WC_API_Base implements Framework\SV_
379
  return false;
380
  }
381
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
382
 
383
  /**
384
  * Remove the given tokenized payment method for the customer
379
  return false;
380
  }
381
 
382
+ /**
383
+ * Updates a credit card token expiration date.
384
+ *
385
+ * @since 2.6.2
386
+ * @param string $token the payment method token.
387
+ * @param string $expiration_date the expiration date in MM/YY format.
388
+ */
389
+ public function update_cc_token_expiration_date( $token, $expiration_date ) {
390
+ $request = $this->get_new_request(
391
+ array(
392
+ 'type' => 'payment-method',
393
+ )
394
+ );
395
+ $request->update_expiration_date( $token, $expiration_date );
396
+
397
+ return $this->perform_request( $request );
398
+ }
399
+
400
 
401
  /**
402
  * Remove the given tokenized payment method for the customer
includes/api/requests/class-wc-braintree-api-payment-method-request.php CHANGED
@@ -111,5 +111,22 @@ class WC_Braintree_API_Payment_Method_Request extends WC_Braintree_API_Vault_Req
111
  $this->request_data = array( $token, $update_data );
112
  }
113
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
114
 
115
  }
111
  $this->request_data = array( $token, $update_data );
112
  }
113
 
114
+ /**
115
+ * @since 2.6.2
116
+ * @param string $token existing payment method token.
117
+ * @param string $expiration_date expiration date in MM/YY format.
118
+ */
119
+ public function update_expiration_date( $token, $expiration_date ) {
120
+ $this->set_resource( 'paymentMethod' );
121
+ $this->set_callback( 'update' );
122
+
123
+ $update_data = array(
124
+ 'expirationDate' => $expiration_date,
125
+ );
126
+
127
+ $this->request_data = array( $token, $update_data );
128
+ }
129
+
130
+
131
 
132
  }
includes/class-wc-braintree-my-payment-methods.php ADDED
@@ -0,0 +1,222 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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_Methods
20
+ * @author WooCommerce
21
+ * @copyright Copyright: (c) 2016-2020, Automattic, Inc.
22
+ * @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
23
+ */
24
+
25
+ use SkyVerge\WooCommerce\PluginFramework\v5_10_7 as Framework;
26
+
27
+ defined( 'ABSPATH' ) or exit;
28
+
29
+ /**
30
+ * My Payment Methods Class
31
+ *
32
+ * Renders the My Payment Methods table on the My Account page and handles
33
+ * any associated actions (deleting a payment method, etc).
34
+ * Overrides the default implementation in the SkyVerge framework.
35
+ *
36
+ * @since 2.6.2
37
+ */
38
+ class WC_Braintree_My_Payment_Methods extends Framework\SV_WC_Payment_Gateway_My_Payment_Methods {
39
+
40
+ /**
41
+ * Returns the JS handler class name. Overrides the one in the SV framework.
42
+ *
43
+ * @since 2.6.2
44
+ * @return string
45
+ */
46
+ protected function get_js_handler_class_name() {
47
+ return 'WC_Braintree_My_Payment_Methods_Handler';
48
+ }
49
+
50
+ /**
51
+ * Enqueue frontend CSS/JS.
52
+ *
53
+ * @since 2.6.2
54
+ */
55
+ public function maybe_enqueue_styles_scripts() {
56
+ parent::maybe_enqueue_styles_scripts();
57
+
58
+ wp_enqueue_script( 'wc-braintree-my-payment-methods', $this->plugin->get_plugin_url() . '/assets/js/frontend/wc-braintree-my-payment-methods.min.js', array( 'jquery-tiptip', 'jquery' ), $this->plugin->get_version() );
59
+ }
60
+
61
+ /**
62
+ * Initializes the My Payment Methods table.
63
+ *
64
+ * @since 2.6.2
65
+ */
66
+ public function init() {
67
+ parent::init();
68
+
69
+ if ( ! $this->is_payment_methods_page() ) {
70
+ return;
71
+ }
72
+
73
+ add_action( 'woocommerce_account_payment_methods_column_expires', [ $this, 'add_payment_method_expires' ] );
74
+ }
75
+
76
+ /**
77
+ * Adds the Expires column content.
78
+ *
79
+ * @since 2.6.2
80
+ * @param array $method Payment method.
81
+ */
82
+ public function add_payment_method_expires( $method ) {
83
+ $token = ( ! empty( $method['token'] ) ) ? $this->plugin->get_gateway( $this->plugin::CREDIT_CARD_GATEWAY_ID )->get_payment_tokens_handler()->get_token( get_current_user_id(), $method['token'] ) : null;
84
+
85
+ if ( ! $token ) {
86
+ return;
87
+ }
88
+
89
+ echo $this->get_payment_method_expires_html( $token );
90
+ }
91
+
92
+ /**
93
+ * Returns a token's expiration date HTML.
94
+ *
95
+ * @since 2.6.2
96
+ * @internal
97
+ * @param Framework\SV_WC_Payment_Gateway_Payment_Token $token Token object.
98
+ * @return string
99
+ */
100
+ protected function get_payment_method_expires_html( $token ) {
101
+ $html = '';
102
+ $html .= '<div class="view">';
103
+ $html .= esc_html( $token->get_exp_date() );
104
+ $html .= '</div>';
105
+ $html .= '<div class="edit wc-braintree" style="display: none;">';
106
+ $html .= '<input type="text" class="expires" name="expires" placeholder="MM/YY" value="' . esc_attr( $token->get_exp_date() ) . '" />';
107
+ $html .= '</div>';
108
+
109
+ return $html;
110
+ }
111
+
112
+ /**
113
+ * Saves a payment method via AJAX.
114
+ *
115
+ * @since 5.1.0
116
+ * @internal
117
+ */
118
+ public function ajax_save_payment_method() {
119
+ check_ajax_referer( 'wc_' . $this->get_plugin()->get_id() . '_save_payment_method', 'nonce' );
120
+
121
+ try {
122
+
123
+ $this->load_tokens();
124
+
125
+ $token_id = Framework\SV_WC_Helper::get_posted_value( 'token_id' );
126
+
127
+ if ( empty( $this->tokens[ $token_id ] ) || ! $this->tokens[ $token_id ] instanceof Framework\SV_WC_Payment_Gateway_Payment_Token ) {
128
+ throw new Framework\SV_WC_Payment_Gateway_Exception( 'Invalid token ID' );
129
+ }
130
+
131
+ $user_id = get_current_user_id();
132
+ $token = $this->tokens[ $token_id ];
133
+ $gateway = $this->get_plugin()->get_gateway_from_token( $user_id, $token );
134
+
135
+ // bail if the gateway or token couldn't be found for this user
136
+ if ( ! $gateway || ! $gateway->get_payment_tokens_handler()->user_has_token( $user_id, $token ) ) {
137
+ throw new Framework\SV_WC_Payment_Gateway_Exception( 'Invalid token' );
138
+ }
139
+
140
+ $data = array();
141
+
142
+ parse_str( Framework\SV_WC_Helper::get_posted_value( 'data' ), $data );
143
+
144
+ // set the data
145
+ $token = $this->save_token_data( $token, $data );
146
+
147
+ // persist the data
148
+ $gateway->get_payment_tokens_handler()->update_token( $user_id, $token );
149
+
150
+ wp_send_json_success( [
151
+ 'title' => $this->get_payment_method_title_html( $token ),
152
+ 'expires' => $this->get_payment_method_expires_html( $token ),
153
+ 'nonce' => wp_create_nonce( 'wc_' . $this->get_plugin()->get_id() . '_save_payment_method' ),
154
+ ] );
155
+
156
+ } catch ( Framework\SV_WC_Payment_Gateway_Exception $e ) {
157
+
158
+ wp_send_json_error( $e->getMessage() );
159
+ }
160
+ }
161
+
162
+ /**
163
+ * Saves data to a token.
164
+ * Overrides the method in the parent class to add support for editing expiration dates.
165
+ *
166
+ * @since 2.6.2
167
+ * @param Framework\SV_WC_Payment_Gateway_Payment_Token $token Token object.
168
+ * @param array $data New data to store for the token.
169
+ * @return Framework\SV_WC_Payment_Gateway_Payment_Token
170
+ */
171
+ protected function save_token_data( Framework\SV_WC_Payment_Gateway_Payment_Token $token, array $data ) {
172
+ $token = parent::save_token_data( $token, $data );
173
+ $exp_date = $this->prepare_expiration_date( isset( $data['expires'] ) ? $data['expires'] : '' );
174
+
175
+ if ( ! $exp_date ) {
176
+ throw new Framework\SV_WC_Payment_Gateway_Exception( 'Invalid expiration date' );
177
+ }
178
+
179
+ if ( $token->get_exp_date() === $exp_date['month'] . '/' . $exp_date['year'] ) {
180
+ return $token;
181
+ }
182
+
183
+ $token->set_exp_month( $exp_date['month'] );
184
+ $token->set_exp_year( $exp_date['year'] );
185
+
186
+ $api = $this->plugin->get_gateway( $this->plugin::CREDIT_CARD_GATEWAY_ID )->get_api();
187
+ if ( ! $api instanceof WC_Braintree_API ) {
188
+ throw new Framework\SV_WC_Payment_Gateway_Exception( 'Invalid token gateway' );
189
+ }
190
+
191
+ $response = $api->update_cc_token_expiration_date( $token->get_id(), $token->get_exp_date() );
192
+
193
+ if ( ! $response->transaction_approved() ) {
194
+ throw new Framework\SV_WC_Payment_Gateway_Exception( 'Could not update token' );
195
+ }
196
+
197
+ return $token;
198
+ }
199
+
200
+ /**
201
+ * Validates and splits an expiration date in format MM/YY into month and year parts.
202
+ *
203
+ * @param string $expiration_date The expiration date in MM/YY format.
204
+ * @return array|null NULL if expiration date is invalid. Otherwise, array with keys 'month' and 'year'.
205
+ */
206
+ protected function prepare_expiration_date( $expiration_date ) {
207
+ $expiration_date = trim( $expiration_date );
208
+
209
+ if ( false === strstr( $expiration_date, '/' ) || 5 !== strlen( $expiration_date ) ) {
210
+ return null;
211
+ }
212
+
213
+ list( $month, $year ) = array_map( 'strval', explode( '/', $expiration_date ) );
214
+
215
+ if ( (int) $month < 1 || (int) $month > 12 ) {
216
+ return null;
217
+ }
218
+
219
+ return compact( 'month', 'year' );
220
+ }
221
+
222
+ }
includes/class-wc-gateway-braintree-credit-card.php CHANGED
@@ -131,7 +131,7 @@ class WC_Gateway_Braintree_Credit_Card extends WC_Gateway_Braintree {
131
  if ( $this->is_advanced_fraud_tool_enabled() ) {
132
 
133
  // enqueue braintree-data.js library
134
- wp_enqueue_script( 'braintree-data', 'https://js.braintreegateway.com/v1/braintree-data.js', array( 'braintree-js-client' ), WC_Braintree::VERSION, true );
135
 
136
  // adjust the script tag to add async attribute
137
  add_filter( 'clean_url', array( $this, 'adjust_fraud_script_tag' ) );
131
  if ( $this->is_advanced_fraud_tool_enabled() ) {
132
 
133
  // enqueue braintree-data.js library
134
+ wp_enqueue_script( 'braintree-js-data-collector', 'https://js.braintreegateway.com/web/' . WC_Braintree::BRAINTREE_JS_SDK_VERSION . '/js/data-collector.min.js', array( 'braintree-js-client' ), WC_Braintree::VERSION, true );
135
 
136
  // adjust the script tag to add async attribute
137
  add_filter( 'clean_url', array( $this, 'adjust_fraud_script_tag' ) );
includes/class-wc-gateway-braintree-paypal.php CHANGED
@@ -155,7 +155,7 @@ class WC_Gateway_Braintree_PayPal extends WC_Gateway_Braintree {
155
 
156
  wp_enqueue_script( 'braintree-js-paypal-client', 'https://js.braintreegateway.com/web/' . WC_Braintree::BRAINTREE_JS_SDK_VERSION . '/js/client.min.js', [], WC_Braintree::VERSION, true );
157
  wp_enqueue_script( 'braintree-js-paypal-checkout', 'https://js.braintreegateway.com/web/' . WC_Braintree::BRAINTREE_JS_SDK_VERSION . '/js/paypal-checkout.min.js', [], WC_Braintree::VERSION, true );
158
- wp_enqueue_script( 'braintree-js-paypal-data-collector', 'https://js.braintreegateway.com/web/' . WC_Braintree::BRAINTREE_JS_SDK_VERSION . '/js/data-collector.min.js', [], WC_Braintree::VERSION, true );
159
  }
160
  }
161
 
@@ -386,6 +386,32 @@ class WC_Gateway_Braintree_PayPal extends WC_Gateway_Braintree {
386
  'default' => 'yes',
387
  );
388
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
389
  return parent::add_authorization_charge_form_fields( $form_fields );
390
  }
391
 
@@ -890,6 +916,23 @@ class WC_Gateway_Braintree_PayPal extends WC_Gateway_Braintree {
890
  }
891
 
892
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
893
  /**
894
  * Determines whether PayPal Debit/Credit Card option should be offered to customers.
895
  *
@@ -994,15 +1037,6 @@ class WC_Gateway_Braintree_PayPal extends WC_Gateway_Braintree {
994
 
995
  $order = parent::get_order( $order );
996
 
997
- // gets the PayPal specific device data
998
- $device_data = Framework\SV_WC_Helper::get_posted_value( 'wc_' . wc_braintree()::PAYPAL_GATEWAY_ID . '_device_data' );
999
-
1000
- if ( ! empty( $device_data ) ) {
1001
-
1002
- // fraud tool data as a JSON string, unslashed as WP slashes $_POST data which breaks the JSON
1003
- $order->payment->device_data = wp_unslash( $device_data );
1004
- }
1005
-
1006
  return $order;
1007
  }
1008
 
155
 
156
  wp_enqueue_script( 'braintree-js-paypal-client', 'https://js.braintreegateway.com/web/' . WC_Braintree::BRAINTREE_JS_SDK_VERSION . '/js/client.min.js', [], WC_Braintree::VERSION, true );
157
  wp_enqueue_script( 'braintree-js-paypal-checkout', 'https://js.braintreegateway.com/web/' . WC_Braintree::BRAINTREE_JS_SDK_VERSION . '/js/paypal-checkout.min.js', [], WC_Braintree::VERSION, true );
158
+ wp_enqueue_script( 'braintree-js-data-collector', 'https://js.braintreegateway.com/web/' . WC_Braintree::BRAINTREE_JS_SDK_VERSION . '/js/data-collector.min.js', array( 'braintree-js-client' ), WC_Braintree::VERSION, true );
159
  }
160
  }
161
 
386
  'default' => 'yes',
387
  );
388
 
389
+ $form_fields['disable_funding'] = array(
390
+ 'title' => __( 'Disable funding sources', 'woocommerce-gateway-paypal-powered-by-braintree' ),
391
+ 'type' => 'multiselect',
392
+ 'class' => 'wc-enhanced-select',
393
+ 'default' => array(),
394
+ 'desc_tip' => true,
395
+ 'description' => __(
396
+ 'By default all possible funding sources will be shown. You can disable some sources, if you wish.',
397
+ 'woocommerce-paypal-payments'
398
+ ),
399
+ 'options' => array(
400
+ 'card' => _x( 'Credit or debit cards', 'Name of payment method', 'woocommerce-paypal-payments' ),
401
+ 'blik' => _x( 'BLIK', 'Name of payment method', 'woocommerce-paypal-payments' ),
402
+ 'sepa' => _x( 'SEPA-Lastschrift', 'Name of payment method', 'woocommerce-paypal-payments' ),
403
+ 'bancontact' => _x( 'Bancontact', 'Name of payment method', 'woocommerce-paypal-payments' ),
404
+ 'eps' => _x( 'eps', 'Name of payment method', 'woocommerce-paypal-payments' ),
405
+ 'giropay' => _x( 'giropay', 'Name of payment method', 'woocommerce-paypal-payments' ),
406
+ 'ideal' => _x( 'iDEAL', 'Name of payment method', 'woocommerce-paypal-payments' ),
407
+ 'mercadopago'=> _x( 'Mercado Pago', 'Name of payment method', 'woocommerce-paypal-payments' ),
408
+ 'mybank' => _x( 'MyBank', 'Name of payment method', 'woocommerce-paypal-payments' ),
409
+ 'p24' => _x( 'Przelewy24', 'Name of payment method', 'woocommerce-paypal-payments' ),
410
+ 'sofort' => _x( 'Sofort', 'Name of payment method', 'woocommerce-paypal-payments' ),
411
+ 'venmo' => _x( 'Venmo', 'Name of payment method', 'woocommerce-paypal-payments' ),
412
+ )
413
+ );
414
+
415
  return parent::add_authorization_charge_form_fields( $form_fields );
416
  }
417
 
916
  }
917
 
918
 
919
+ /**
920
+ * Gets disabled funding sources that should not be offer to customers
921
+ *
922
+ * @since 2.6.1
923
+ *
924
+ * @return array
925
+ */
926
+ public function get_disabled_funding_sources() {
927
+ $disabled_funding = $this->get_option( 'disable_funding' );
928
+
929
+ if ( !$disabled_funding ) {
930
+ return array();
931
+ }
932
+ return $disabled_funding;
933
+ }
934
+
935
+
936
  /**
937
  * Determines whether PayPal Debit/Credit Card option should be offered to customers.
938
  *
1037
 
1038
  $order = parent::get_order( $order );
1039
 
 
 
 
 
 
 
 
 
 
1040
  return $order;
1041
  }
1042
 
includes/class-wc-gateway-braintree.php CHANGED
@@ -263,7 +263,7 @@ class WC_Gateway_Braintree extends Framework\SV_WC_Payment_Gateway_Direct {
263
  }
264
 
265
  // fraud tool data as a JSON string, unslashed as WP slashes $_POST data which breaks the JSON
266
- $order->payment->device_data = wp_unslash( Framework\SV_WC_Helper::get_posted_value( 'device_data' ) );
267
 
268
  // merchant account ID
269
  if ( $merchant_account_id = $this->get_merchant_account_id( $order->get_currency() ) ) {
263
  }
264
 
265
  // fraud tool data as a JSON string, unslashed as WP slashes $_POST data which breaks the JSON
266
+ $order->payment->device_data = wp_unslash( Framework\SV_WC_Helper::get_posted_value( 'wc_braintree_device_data' ) );
267
 
268
  // merchant account ID
269
  if ( $merchant_account_id = $this->get_merchant_account_id( $order->get_currency() ) ) {
includes/payment-forms/abstract-wc-braintree-payment-form.php CHANGED
@@ -119,20 +119,20 @@ abstract class WC_Braintree_Payment_Form extends Framework\SV_WC_Payment_Gateway
119
 
120
 
121
  /**
122
- * Render a hidden input for the payment nonce before the credit card/PayPal
123
- * fields. This is populated by the payment form javascript when it receives
124
- * a nonce from Braintree.
125
  *
126
  * @since 3.0.0
127
  */
128
  public function render_payment_fields() {
129
 
130
  ?><input type="hidden" id="<?php echo esc_attr( 'wc_' . $this->get_gateway()->get_id() . '_payment_nonce' ); ?>" name="<?php echo esc_attr( 'wc_' . $this->get_gateway()->get_id() . '_payment_nonce' ); ?>" /><?php
 
131
 
132
  parent::render_payment_fields();
133
  }
134
 
135
-
136
  /**
137
  * Get gateway-specific JS params that are passed to the payment form handler script
138
  *
119
 
120
 
121
  /**
122
+ * Render a hidden input for the payment nonce and device_data before the
123
+ * credit card/PayPal fields. This is populated by the payment form javascript
124
+ * when it receives a nonce from Braintree.
125
  *
126
  * @since 3.0.0
127
  */
128
  public function render_payment_fields() {
129
 
130
  ?><input type="hidden" id="<?php echo esc_attr( 'wc_' . $this->get_gateway()->get_id() . '_payment_nonce' ); ?>" name="<?php echo esc_attr( 'wc_' . $this->get_gateway()->get_id() . '_payment_nonce' ); ?>" /><?php
131
+ ?><input type="hidden" id="<?php echo esc_attr( 'wc_braintree_device_data' ); ?>" name="<?php echo esc_attr( 'wc_braintree_device_data' ); ?>" /><?php
132
 
133
  parent::render_payment_fields();
134
  }
135
 
 
136
  /**
137
  * Get gateway-specific JS params that are passed to the payment form handler script
138
  *
includes/payment-forms/class-wc-braintree-paypal-payment-form.php CHANGED
@@ -163,8 +163,6 @@ class WC_Braintree_PayPal_Payment_Form extends WC_Braintree_Payment_Form {
163
  if ( ! $this->is_checkout_confirmation() ) {
164
  parent::render_payment_form_description();
165
  }
166
-
167
- ?><input type="hidden" id="<?php echo esc_attr( 'wc_' . wc_braintree()::PAYPAL_GATEWAY_ID . '_device_data' ); ?>" name="<?php echo esc_attr( 'wc_' . wc_braintree()::PAYPAL_GATEWAY_ID . '_device_data' ); ?>" /><?php
168
  }
169
 
170
 
@@ -285,7 +283,7 @@ class WC_Braintree_PayPal_Payment_Form extends WC_Braintree_Payment_Form {
285
  * @param array $disabled_funding_options list of current disabled funding options
286
  * @param \WC_Braintree_PayPal_Payment_Form $this payment form instance
287
  */
288
- return apply_filters( 'wc_' . $this->get_gateway()->get_id() . '_disabled_funding_options', [], $this );
289
  }
290
 
291
 
163
  if ( ! $this->is_checkout_confirmation() ) {
164
  parent::render_payment_form_description();
165
  }
 
 
166
  }
167
 
168
 
283
  * @param array $disabled_funding_options list of current disabled funding options
284
  * @param \WC_Braintree_PayPal_Payment_Form $this payment form instance
285
  */
286
+ return apply_filters( 'wc_' . $this->get_gateway()->get_id() . '_disabled_funding_options', $this->get_gateway()->get_disabled_funding_sources(), $this );
287
  }
288
 
289
 
lib/ssl/api_braintreegateway_com.ca.crt CHANGED
File without changes
readme.txt CHANGED
@@ -4,7 +4,7 @@ Tags: ecommerce, e-commerce, commerce, woothemes, wordpress ecommerce, store, sa
4
  Requires at least: 4.4
5
  Tested up to: 5.7.2
6
  Requires PHP: 5.4
7
- Stable tag: 2.6.1
8
  License: GPLv3
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
@@ -107,248 +107,12 @@ If not, please get in touch with us through the [plugin forums](https://wordpres
107
 
108
  == Changelog ==
109
 
110
- = 2021.05.27 - version 2.6.1
111
- * Fix - Address an uncaught exception when getting the payment methods for a customer
 
 
112
 
113
- = 2021.04.19 - version 2.6.0 =
114
- * Tweak - Add a filter to allow customizing the disabled funding PayPal options
115
- * Fix - Prevent a PHP notice triggered while trying to access the cart object too early in a request
116
-
117
- = 2021.03.18 - version 2.5.0 =
118
- * Feature - Upgrade to the latest Braintree JavaScript SDK and add support to show PayPal Pay Later offers to eligible buyers
119
- * Tweak - Add Kount support for US based merchants who are using API keys to connect to Braintree
120
- * Misc - Include device data for all customer-initiated PayPal transactions to increase the accuracy of the Advanced Fraud Management Tools in determining when a transaction is fraudulent
121
- * Misc - Update the SkyVerge plugin framework to 5.10.5
122
-
123
- = 2020.10.22 - version 2.4.3 =
124
- * Fix - Fix a checkout error that removes the CSC field when a saved payment method is selected and the billing country is changed
125
-
126
- = 2020.10.14 - version 2.4.2 =
127
- * Fix - Address a possible race condition when loading Braintree device data scripts in front end
128
-
129
- = 2020.09.28 - version 2.4.1 =
130
- * Fix - Fix a fatal error in some server environments with no case sensitive file systems while WooCommerce Product Add-ons is active
131
-
132
- = 2020.08.12 - version 2.4.0 =
133
- * Fix - Halt plugin loading and display a notice if cURL is not available on the server
134
- * Misc - The plugin name is updated to Braintree for WooCommerce
135
- * Misc - Add support for WooCommerce 4.3
136
- * Misc - Update the SkyVerge plugin framework to v5.7.1
137
- * Misc - Require PHP 5.6+
138
- * Dev - Classes in the WC_Braintree\Plugin_Framework namespace are now deprecated, use the namespace for the included version of the SkyVerge plugin framework (SkyVerge\WooCommerce\PluginFramework\v5_7_1)
139
-
140
- = 2020.06.03 - version 2.3.11 =
141
- * Tweak - New users and users who disconnect should use API keys to connect to Braintree - no changes required for users already connected via Braintree Auth
142
-
143
- = 2020.05.04 - version 2.3.10 =
144
- * Misc - Add support for WooCommerce 4.1
145
-
146
- = 2020.04.20 - version 2.3.9 =
147
- * Fix - Fix fatal error in PHP < 5.4
148
-
149
- = 2020.03.10 - version 2.3.8 =
150
- * Misc - Add support for WooCommerce 4.0
151
-
152
- = 2020.02.05 - version 2.3.7 =
153
- * Fix - Prevent error with payment fields shown in the Checkout page on WooCommerce 3.9 when the address fields are updated
154
-
155
- = 2020.01.05 - version 2.3.6 =
156
- * Misc - Add support for WooCommerce 3.9
157
-
158
- = 2019.12.12 - version 2.3.5 =
159
- * Fix - Fix redirect URL encoding when connecting via Braintree Auth
160
-
161
- = 2019.12.10 - version 2.3.4 =
162
- * Tweak - Display informative message when 3D Secure fails due to unsupported characters in the customer name
163
-
164
- = 2019.11.28 - version 2.3.3 =
165
- * Fix - Catch CardinalCommerce JS errors in unsupported browsers to prevent hung checkouts
166
-
167
- = 2019.10.21 - version 2.3.2 =
168
- * Misc - Add support for WooCommerce 3.8
169
-
170
- = 2019.10.16 - version 2.3.1 =
171
- * Fix - Prevent 3D Secure errors trying to purchase free trial subscriptions
172
- * Fix - Fix a bug with regular expressions being used in PHP 7.3+
173
-
174
- = 2019.10.03 - version 2.3.0 =
175
- * Feature - PayPal buy-now buttons can now be added to product pages
176
- * Tweak - Enable PayPal Credit by default on new installs
177
- * Fix - Fix a styling issue with the merchant account ID field in settings
178
- * Fix - Fix a bug with a regular expression being used in PHP 7.3+
179
-
180
- = 2019.09.12 - version 2.2.7 =
181
- * Fix - Fix JavaScript error blocking payments with 3D Secure from the Pay Order page
182
-
183
- = 2019.08.07 - version 2.2.6 =
184
- * Tweak - Add support for 3D Secure 2.0
185
- * Misc - Add support for WooCommerce 3.7
186
-
187
- = 2019.06.06 - version 2.2.5 =
188
- * Fix - Regenerate client tokens on checkout refresh to use the customer's latest currency
189
- * Fix - Ensure saved PayPal accounts display their associated email address if no nickname is set
190
-
191
- = 2019.04.01 - version 2.2.4 =
192
- * Fix - Prevent an error when completing pre-orders that were placed using the PayPal gateway
193
-
194
- = 2019.03.20 - version 2.2.3 =
195
- * Fix - Ensure Kount merchant ID is set in device data for stores using advanced fraud tools via Kount
196
-
197
- = 2019.02.28 - version 2.2.2 =
198
- * Fix - Prevent JS errors when reloading the payment form in IE and Edge
199
-
200
- = 2019.02.06 - version 2.2.1 =
201
- * Fix - Ensure updated order totals are used for validating 3D Secure when the checkout is refreshed
202
- * Fix - Prevent 3D Secure errors when non-US region codes are used during validation
203
- * Fix - Ensure payment forms are available for orders that start at $0 but require payment after shipping selection
204
- * Fix - Update the recurring flag for new API requirements when processing subscription payments
205
- * Misc - Reorder manual connection setting inputs to match documentation
206
-
207
- = 2018.11.12 - version 2.2.0 =
208
- * Feature - Add Apple Pay support for iOS users to quickly place orders from the product, cart, and checkout pages
209
- * Feature - Allow the PayPal button to be customized from the plugin settings
210
- * Feature - Add PayPal Credit support
211
- * Feature - Add support for auto-capturing orders when changed to a paid status
212
- * Feature - Customers can now label their saved payment methods for easier identification when choosing how to pay
213
- * Tweak - Improve the My Account Payment Methods table on desktop and mobile
214
- * Tweak - Automatically enable 3D Secure when enabled in the merchant account
215
- * Tweak - Allow users to set the card types that should process 3D Secure
216
- * Tweak - Allow users to set the 3D Secure level and block transactions where liability is not shifted
217
- * Fix - Fix an issue where duplicate addresses were added when processing transactions with a previously saved payment method
218
- * Fix - Ensure the payment forms are re-created after shipping method selection
219
- * Misc - Remove support for WooCommerce 2.5
220
-
221
- = 2018.10.17 - version 2.1.4 =
222
- * Misc - Add support for WooCommerce 3.5
223
-
224
- = 2018.08.01 - version 2.1.3 =
225
- * Tweak - Generalize the PayPal link error to allow for different PayPal button colors
226
- * Fix - Ensure PayPal charges can still be captured when the Credit Card gateway is disabled
227
- * Fix - Prevent stalled checkout when PayPal is cancelled or closed
228
- * Fix - Prevent duplicate PayPal buttons when checkout is refreshed
229
- * Fix - Don't reset the "Create Account" form when the checkout is refreshed
230
-
231
- = 2.1.2 =
232
- * Tweak - Add payment details to the customer data export and remove it for erasure requests
233
- * Tweak - Remove payment tokens for customer data erasure requests
234
- * Misc - Add support for WooCommerce 3.4
235
-
236
- = 2.1.1 =
237
- * Fix - Fix the payment form JavaScript compatibility with IE 11
238
-
239
- = 2.1.0 =
240
- * Feature - Upgrade to the latest Braintree JavaScript SDK for improved customer experience, reliability, and error handling
241
- * Tweak - Add placeholder text for credit card inputs
242
- * Tweak - Add responsive sizing to the PayPal buttons and update to the recommended styling for the Cart and Checkout pages
243
- * Tweak - Add setting and filter to disable PayPal on the cart page
244
- * Tweak - Update all translatable strings to the same text domain
245
- * Tweak - Hide Kount as a fraud tool option for US-based stores as it's not currently supported
246
- * Tweak - Only load the Braintree scripts when required on payment pages
247
- * Fix - Ensure that new customers have their billing address stored in the vault on their first transaction
248
- * Fix - Prevent linked PayPal accounts from being cleared if there are address errors at checkout
249
- * Fix - Fix some deprecated function notices
250
-
251
- = 2.0.4 =
252
- * Fix - Prevent a fatal error when completing pre-orders
253
- * Fix - Prevent JavaScript errors when applying a 100%-off coupon at checkout
254
-
255
- = 2.0.3 =
256
- * Fix - Add a missing namespace that could cause JavaScript issues with some configurations
257
-
258
- = 2.0.2 =
259
- * Fix - Ensure refunds succeed for legacy orders that are missing the necessary meta data
260
- * Fix - Add fallbacks for certain subscriptions upgrades after WooCommerce 3.0 compatibility issues
261
- * Fix - Default set the Require CSC setting for legacy upgrades to avoid inaccurate error notices at checkout
262
- * Fix - Prevent PayPal JavaScript errors in certain cases
263
- * Fix - Ensure subscriptions are not affected if Change Payment fails due to declines or other problems
264
- * Fix - Ensure old payment methods can be removed by the customer after changing subscription payment to a new method
265
-
266
- = 2.0.1 =
267
- * Fix - Purchasing a subscription with PayPal could lead to a blank order note being added
268
- * Fix - Ensure all upgrade routines run for users who have used both the SkyVerge Braintree and PayPal Powered by Braintree v1 in the past
269
- * Fix - Issue where existing subscriptions in some cases couldn't switch to using a new PayPal account
270
- * Fix - Ensure "Place Order" button always remains visible for PayPal when accepting terms
271
-
272
- = 2.0.0 =
273
- * Feature - Now supports non-USA Braintree merchant accounts! Bonjour, hola, hallo, and g'day :)
274
- * Feature - Supports WooCommerce Pre-Orders plugin
275
- * Feature - Credit cards and PayPal gateways can be enabled individually
276
- * Feature - Customers can opt to save cards or link a PayPal account at checkout for future use, or use saved methods during checkout
277
- * Feature - Customers can manage or add new payment methods from the account area
278
- * Feature - Uses an enhanced payment form with retina icons
279
- * Feature - Add multiple merchant IDs to support multi-currency shops (requires a currency switcher)
280
- * Feature - Supports Advanced Fraud tools and Kount Direct
281
- * Feature - Supports 3D Secure for Visa / MasterCard transactions
282
- * Feature - Add dynamic descriptors to be displayed for the transaction on customer's credit card statements
283
- * Feature - Can show detailed decline messages at checkout to better inform customers of transaction decline reasons
284
- * Feature - Allows bulk action to capture charges
285
- * Feature - Orders with only virtual items can now force a charge instead of authorization
286
- * Tweak - Capturing a charge now moves order status to "processing" automatically
287
- * Tweak - Voided orders are now marked as "cancelled" instead of "refunded"
288
- * Tweak - Admins can now manually update Subscription payment methods and view payment tokens
289
- * Fix - Subscription orders will no longer force a charge and allow an authorization depending on settings
290
- * Fix - Handle Subscriptions renewal failures by failing the order
291
- * Fix - Customers can switch Subscriptions payment methods on their own from the account
292
- * Fix - Stores sandbox and live customer tokens separately to avoid `Customer ID is invalid.` messages
293
- * Fix - Ensures that payment can be made from the "My Account" page for pending orders
294
- * Misc - Adds support for WooCommerce 3.0+
295
- * Misc - Removes support for WooCommerce 2.4 and lower
296
- * Misc - Added upgrade routine from SkyVerge Braintree plugin to allow for migrating existing tokens and subscriptions
297
- * Misc - Refactor for improved performance and stability
298
- * Misc - Other small fixes and improvements
299
-
300
- = 1.2.7 =
301
- * Fix - If you connected but did not save the settings, the enabled value would not be set and scripts would not enqueue
302
- * Fix - Disable customer initiated payment method changes - PayPal Braintree does not support zero amount transactions
303
- * Tweak - On new installs, debug messages are no longer sent to the WooCommerce System Status log by default
304
-
305
- = 1.2.6 =
306
- * Fix - Issue where buyer unable to change subscription payment method with free-trial (order total is 0).
307
-
308
- = 1.2.5 =
309
- * Fix - Prevent void on unsettled transaction when refunding partially.
310
- * Tweak - Add filter wc_gateway_paypal_braintree_sale_args to filter arguments passed to sale call.
311
-
312
- = 1.2.4 =
313
- * Fix - Free subscription trails not allowed.
314
- * Fix - Subscription recurring billing after free trial not working.
315
-
316
- = 1.2.3 =
317
- * Fix - Handle uncaught exceptions thrown by Braintree SDK. API calls from SDK may throws exception, thus it need to be handled properly in try/catch block.
318
- * Fix - Issue where deactivating WooCommerce might throws an error
319
-
320
- = 1.2.2 =
321
- * Tweak - Updated FAQ that emphasizes this plugin only works in the U.S. currently
322
- * Fix - Updated JS SDK to 2.24.1 which should fixes issue where credit card fields working intermittently
323
- * Tweak - Add filter on credit card icons
324
- * Tweak - Provide default title for cards and PayPal account methods
325
-
326
- = 1.2.1 =
327
- * Fix - Issue where Subscriptions with free trial was not processed
328
- * Fix - Missing "Change Payment" button in "My Subscriptions" section
329
- * Tweak - Make enabled option default to 'yes'
330
- * Tweak - Add adnmin notice to setup / connect after plugin is activated
331
- * Fix - Consider more statuses (settling, submitted_for_settlement, settlement_pending) to mark order as in-processing
332
- * Fix - Issue where settings section rendered twice
333
-
334
- = 1.2.0 =
335
- * Replace array initialization code that causes a fatal error on PHP 5.2 or earlier. PHP 5.4+ is still required, but this code prevented the compatibility check from running and displaying the version requirements
336
- * Update to the latest Braintree SDK (3.8.0)
337
- * Add authorize/capture feature, allowing delayed settlement
338
- * Pre-fill certain merchant and store details when connecting
339
- * Fix missing gateway title and transaction URL when order in-hold
340
-
341
- = 1.1.0 =
342
- * Fixed a bug which would cause the gateway settings to report that the gateway was enabled when it actually was not fully enabled.
343
- * Updated contributors list
344
-
345
- = 1.0.1 =
346
- * Remove duplicate SSL warnings
347
- * Update environment check to also check after activation for environment problems
348
- * Fix link in enabled-but-not-connected notice
349
-
350
- = 1.0.0 =
351
- * Initial release
352
 
353
  == Upgrade Notice ==
354
 
4
  Requires at least: 4.4
5
  Tested up to: 5.7.2
6
  Requires PHP: 5.4
7
+ Stable tag: 2.6.2
8
  License: GPLv3
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
107
 
108
  == Changelog ==
109
 
110
+ = 2.6.2 - 2021-11-16 =
111
+ * Feature - Add support for disabling funding methods
112
+ * Feature - Allow updating of expiration dates for credit cards in 'My Account'
113
+ * Tweak - Update 'device data' capture inner workings
114
 
115
+ [See changelog for all versions](https://plugins.svn.wordpress.org/woocommerce-gateway-paypal-powered-by-braintree/trunk/changelog.txt).
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
116
 
117
  == Upgrade Notice ==
118
 
vendor/autoload.php CHANGED
@@ -4,4 +4,4 @@
4
 
5
  require_once __DIR__ . '/composer/autoload_real.php';
6
 
7
- return ComposerAutoloaderInitf37bec5afd2a7aa6257c0f78fd20af7b::getLoader();
4
 
5
  require_once __DIR__ . '/composer/autoload_real.php';
6
 
7
+ return ComposerAutoloaderInit9b2474036b822a585558437604722fc9::getLoader();
vendor/composer/ClassLoader.php CHANGED
@@ -37,26 +37,80 @@ namespace Composer\Autoload;
37
  *
38
  * @author Fabien Potencier <fabien@symfony.com>
39
  * @author Jordi Boggiano <j.boggiano@seld.be>
40
- * @see http://www.php-fig.org/psr/psr-0/
41
- * @see http://www.php-fig.org/psr/psr-4/
42
  */
43
  class ClassLoader
44
  {
 
 
 
45
  // PSR-4
 
 
 
 
46
  private $prefixLengthsPsr4 = array();
 
 
 
 
47
  private $prefixDirsPsr4 = array();
 
 
 
 
48
  private $fallbackDirsPsr4 = array();
49
 
50
  // PSR-0
 
 
 
 
51
  private $prefixesPsr0 = array();
 
 
 
 
52
  private $fallbackDirsPsr0 = array();
53
 
 
54
  private $useIncludePath = false;
 
 
 
 
 
55
  private $classMap = array();
 
 
56
  private $classMapAuthoritative = false;
 
 
 
 
 
57
  private $missingClasses = array();
 
 
58
  private $apcuPrefix;
59
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
60
  public function getPrefixes()
61
  {
62
  if (!empty($this->prefixesPsr0)) {
@@ -66,28 +120,47 @@ class ClassLoader
66
  return array();
67
  }
68
 
 
 
 
 
69
  public function getPrefixesPsr4()
70
  {
71
  return $this->prefixDirsPsr4;
72
  }
73
 
 
 
 
 
74
  public function getFallbackDirs()
75
  {
76
  return $this->fallbackDirsPsr0;
77
  }
78
 
 
 
 
 
79
  public function getFallbackDirsPsr4()
80
  {
81
  return $this->fallbackDirsPsr4;
82
  }
83
 
 
 
 
 
84
  public function getClassMap()
85
  {
86
  return $this->classMap;
87
  }
88
 
89
  /**
90
- * @param array $classMap Class to filename map
 
 
 
91
  */
92
  public function addClassMap(array $classMap)
93
  {
@@ -102,9 +175,11 @@ class ClassLoader
102
  * Registers a set of PSR-0 directories for a given prefix, either
103
  * appending or prepending to the ones previously set for this prefix.
104
  *
105
- * @param string $prefix The prefix
106
- * @param array|string $paths The PSR-0 root directories
107
- * @param bool $prepend Whether to prepend the directories
 
 
108
  */
109
  public function add($prefix, $paths, $prepend = false)
110
  {
@@ -147,11 +222,13 @@ class ClassLoader
147
  * Registers a set of PSR-4 directories for a given namespace, either
148
  * appending or prepending to the ones previously set for this namespace.
149
  *
150
- * @param string $prefix The prefix/namespace, with trailing '\\'
151
- * @param array|string $paths The PSR-4 base directories
152
- * @param bool $prepend Whether to prepend the directories
153
  *
154
  * @throws \InvalidArgumentException
 
 
155
  */
156
  public function addPsr4($prefix, $paths, $prepend = false)
157
  {
@@ -195,8 +272,10 @@ class ClassLoader
195
  * Registers a set of PSR-0 directories for a given prefix,
196
  * replacing any others previously set for this prefix.
197
  *
198
- * @param string $prefix The prefix
199
- * @param array|string $paths The PSR-0 base directories
 
 
200
  */
201
  public function set($prefix, $paths)
202
  {
@@ -211,10 +290,12 @@ class ClassLoader
211
  * Registers a set of PSR-4 directories for a given namespace,
212
  * replacing any others previously set for this namespace.
213
  *
214
- * @param string $prefix The prefix/namespace, with trailing '\\'
215
- * @param array|string $paths The PSR-4 base directories
216
  *
217
  * @throws \InvalidArgumentException
 
 
218
  */
219
  public function setPsr4($prefix, $paths)
220
  {
@@ -234,6 +315,8 @@ class ClassLoader
234
  * Turns on searching the include path for class files.
235
  *
236
  * @param bool $useIncludePath
 
 
237
  */
238
  public function setUseIncludePath($useIncludePath)
239
  {
@@ -256,6 +339,8 @@ class ClassLoader
256
  * that have not been registered with the class map.
257
  *
258
  * @param bool $classMapAuthoritative
 
 
259
  */
260
  public function setClassMapAuthoritative($classMapAuthoritative)
261
  {
@@ -276,6 +361,8 @@ class ClassLoader
276
  * APCu prefix to use to cache found/not-found classes, if the extension is enabled.
277
  *
278
  * @param string|null $apcuPrefix
 
 
279
  */
280
  public function setApcuPrefix($apcuPrefix)
281
  {
@@ -296,25 +383,44 @@ class ClassLoader
296
  * Registers this instance as an autoloader.
297
  *
298
  * @param bool $prepend Whether to prepend the autoloader or not
 
 
299
  */
300
  public function register($prepend = false)
301
  {
302
  spl_autoload_register(array($this, 'loadClass'), true, $prepend);
 
 
 
 
 
 
 
 
 
 
 
303
  }
304
 
305
  /**
306
  * Unregisters this instance as an autoloader.
 
 
307
  */
308
  public function unregister()
309
  {
310
  spl_autoload_unregister(array($this, 'loadClass'));
 
 
 
 
311
  }
312
 
313
  /**
314
  * Loads the given class or interface.
315
  *
316
  * @param string $class The name of the class
317
- * @return bool|null True if loaded, null otherwise
318
  */
319
  public function loadClass($class)
320
  {
@@ -323,6 +429,8 @@ class ClassLoader
323
 
324
  return true;
325
  }
 
 
326
  }
327
 
328
  /**
@@ -367,6 +475,21 @@ class ClassLoader
367
  return $file;
368
  }
369
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
370
  private function findFileWithExtension($class, $ext)
371
  {
372
  // PSR-4 lookup
@@ -438,6 +561,10 @@ class ClassLoader
438
  * Scope isolated include.
439
  *
440
  * Prevents access to $this/self from included files.
 
 
 
 
441
  */
442
  function includeFile($file)
443
  {
37
  *
38
  * @author Fabien Potencier <fabien@symfony.com>
39
  * @author Jordi Boggiano <j.boggiano@seld.be>
40
+ * @see https://www.php-fig.org/psr/psr-0/
41
+ * @see https://www.php-fig.org/psr/psr-4/
42
  */
43
  class ClassLoader
44
  {
45
+ /** @var ?string */
46
+ private $vendorDir;
47
+
48
  // PSR-4
49
+ /**
50
+ * @var array[]
51
+ * @psalm-var array<string, array<string, int>>
52
+ */
53
  private $prefixLengthsPsr4 = array();
54
+ /**
55
+ * @var array[]
56
+ * @psalm-var array<string, array<int, string>>
57
+ */
58
  private $prefixDirsPsr4 = array();
59
+ /**
60
+ * @var array[]
61
+ * @psalm-var array<string, string>
62
+ */
63
  private $fallbackDirsPsr4 = array();
64
 
65
  // PSR-0
66
+ /**
67
+ * @var array[]
68
+ * @psalm-var array<string, array<string, string[]>>
69
+ */
70
  private $prefixesPsr0 = array();
71
+ /**
72
+ * @var array[]
73
+ * @psalm-var array<string, string>
74
+ */
75
  private $fallbackDirsPsr0 = array();
76
 
77
+ /** @var bool */
78
  private $useIncludePath = false;
79
+
80
+ /**
81
+ * @var string[]
82
+ * @psalm-var array<string, string>
83
+ */
84
  private $classMap = array();
85
+
86
+ /** @var bool */
87
  private $classMapAuthoritative = false;
88
+
89
+ /**
90
+ * @var bool[]
91
+ * @psalm-var array<string, bool>
92
+ */
93
  private $missingClasses = array();
94
+
95
+ /** @var ?string */
96
  private $apcuPrefix;
97
 
98
+ /**
99
+ * @var self[]
100
+ */
101
+ private static $registeredLoaders = array();
102
+
103
+ /**
104
+ * @param ?string $vendorDir
105
+ */
106
+ public function __construct($vendorDir = null)
107
+ {
108
+ $this->vendorDir = $vendorDir;
109
+ }
110
+
111
+ /**
112
+ * @return string[]
113
+ */
114
  public function getPrefixes()
115
  {
116
  if (!empty($this->prefixesPsr0)) {
120
  return array();
121
  }
122
 
123
+ /**
124
+ * @return array[]
125
+ * @psalm-return array<string, array<int, string>>
126
+ */
127
  public function getPrefixesPsr4()
128
  {
129
  return $this->prefixDirsPsr4;
130
  }
131
 
132
+ /**
133
+ * @return array[]
134
+ * @psalm-return array<string, string>
135
+ */
136
  public function getFallbackDirs()
137
  {
138
  return $this->fallbackDirsPsr0;
139
  }
140
 
141
+ /**
142
+ * @return array[]
143
+ * @psalm-return array<string, string>
144
+ */
145
  public function getFallbackDirsPsr4()
146
  {
147
  return $this->fallbackDirsPsr4;
148
  }
149
 
150
+ /**
151
+ * @return string[] Array of classname => path
152
+ * @psalm-var array<string, string>
153
+ */
154
  public function getClassMap()
155
  {
156
  return $this->classMap;
157
  }
158
 
159
  /**
160
+ * @param string[] $classMap Class to filename map
161
+ * @psalm-param array<string, string> $classMap
162
+ *
163
+ * @return void
164
  */
165
  public function addClassMap(array $classMap)
166
  {
175
  * Registers a set of PSR-0 directories for a given prefix, either
176
  * appending or prepending to the ones previously set for this prefix.
177
  *
178
+ * @param string $prefix The prefix
179
+ * @param string[]|string $paths The PSR-0 root directories
180
+ * @param bool $prepend Whether to prepend the directories
181
+ *
182
+ * @return void
183
  */
184
  public function add($prefix, $paths, $prepend = false)
185
  {
222
  * Registers a set of PSR-4 directories for a given namespace, either
223
  * appending or prepending to the ones previously set for this namespace.
224
  *
225
+ * @param string $prefix The prefix/namespace, with trailing '\\'
226
+ * @param string[]|string $paths The PSR-4 base directories
227
+ * @param bool $prepend Whether to prepend the directories
228
  *
229
  * @throws \InvalidArgumentException
230
+ *
231
+ * @return void
232
  */
233
  public function addPsr4($prefix, $paths, $prepend = false)
234
  {
272
  * Registers a set of PSR-0 directories for a given prefix,
273
  * replacing any others previously set for this prefix.
274
  *
275
+ * @param string $prefix The prefix
276
+ * @param string[]|string $paths The PSR-0 base directories
277
+ *
278
+ * @return void
279
  */
280
  public function set($prefix, $paths)
281
  {
290
  * Registers a set of PSR-4 directories for a given namespace,
291
  * replacing any others previously set for this namespace.
292
  *
293
+ * @param string $prefix The prefix/namespace, with trailing '\\'
294
+ * @param string[]|string $paths The PSR-4 base directories
295
  *
296
  * @throws \InvalidArgumentException
297
+ *
298
+ * @return void
299
  */
300
  public function setPsr4($prefix, $paths)
301
  {
315
  * Turns on searching the include path for class files.
316
  *
317
  * @param bool $useIncludePath
318
+ *
319
+ * @return void
320
  */
321
  public function setUseIncludePath($useIncludePath)
322
  {
339
  * that have not been registered with the class map.
340
  *
341
  * @param bool $classMapAuthoritative
342
+ *
343
+ * @return void
344
  */
345
  public function setClassMapAuthoritative($classMapAuthoritative)
346
  {
361
  * APCu prefix to use to cache found/not-found classes, if the extension is enabled.
362
  *
363
  * @param string|null $apcuPrefix
364
+ *
365
+ * @return void
366
  */
367
  public function setApcuPrefix($apcuPrefix)
368
  {
383
  * Registers this instance as an autoloader.
384
  *
385
  * @param bool $prepend Whether to prepend the autoloader or not
386
+ *
387
+ * @return void
388
  */
389
  public function register($prepend = false)
390
  {
391
  spl_autoload_register(array($this, 'loadClass'), true, $prepend);
392
+
393
+ if (null === $this->vendorDir) {
394
+ return;
395
+ }
396
+
397
+ if ($prepend) {
398
+ self::$registeredLoaders = array($this->vendorDir => $this) + self::$registeredLoaders;
399
+ } else {
400
+ unset(self::$registeredLoaders[$this->vendorDir]);
401
+ self::$registeredLoaders[$this->vendorDir] = $this;
402
+ }
403
  }
404
 
405
  /**
406
  * Unregisters this instance as an autoloader.
407
+ *
408
+ * @return void
409
  */
410
  public function unregister()
411
  {
412
  spl_autoload_unregister(array($this, 'loadClass'));
413
+
414
+ if (null !== $this->vendorDir) {
415
+ unset(self::$registeredLoaders[$this->vendorDir]);
416
+ }
417
  }
418
 
419
  /**
420
  * Loads the given class or interface.
421
  *
422
  * @param string $class The name of the class
423
+ * @return true|null True if loaded, null otherwise
424
  */
425
  public function loadClass($class)
426
  {
429
 
430
  return true;
431
  }
432
+
433
+ return null;
434
  }
435
 
436
  /**
475
  return $file;
476
  }
477
 
478
+ /**
479
+ * Returns the currently registered loaders indexed by their corresponding vendor directories.
480
+ *
481
+ * @return self[]
482
+ */
483
+ public static function getRegisteredLoaders()
484
+ {
485
+ return self::$registeredLoaders;
486
+ }
487
+
488
+ /**
489
+ * @param string $class
490
+ * @param string $ext
491
+ * @return string|false
492
+ */
493
  private function findFileWithExtension($class, $ext)
494
  {
495
  // PSR-4 lookup
561
  * Scope isolated include.
562
  *
563
  * Prevents access to $this/self from included files.
564
+ *
565
+ * @param string $file
566
+ * @return void
567
+ * @private
568
  */
569
  function includeFile($file)
570
  {
vendor/composer/InstalledVersions.php CHANGED
@@ -1,237 +1,350 @@
1
  <?php
2
 
3
-
4
-
5
-
6
-
7
-
8
-
9
-
10
-
11
-
12
 
13
  namespace Composer;
14
 
 
15
  use Composer\Semver\VersionParser;
16
 
17
-
18
-
19
-
20
-
21
-
 
 
22
  class InstalledVersions
23
  {
24
- private static $installed = array (
25
- 'root' =>
26
- array (
27
- 'pretty_version' => 'dev-master',
28
- 'version' => 'dev-master',
29
- 'aliases' =>
30
- array (
31
- ),
32
- 'reference' => 'af5e91b6ee08f98909e134e48180de218afa133b',
33
- 'name' => '__root__',
34
- ),
35
- 'versions' =>
36
- array (
37
- '__root__' =>
38
- array (
39
- 'pretty_version' => 'dev-master',
40
- 'version' => 'dev-master',
41
- 'aliases' =>
42
- array (
43
- ),
44
- 'reference' => 'af5e91b6ee08f98909e134e48180de218afa133b',
45
- ),
46
- 'braintree/braintree_php' =>
47
- array (
48
- 'pretty_version' => '3.34.0',
49
- 'version' => '3.34.0.0',
50
- 'aliases' =>
51
- array (
52
- ),
53
- 'reference' => 'fd55c466d0d0088c67705d7ba0b3876d9767bfda',
54
- ),
55
- 'skyverge/wc-plugin-framework' =>
56
- array (
57
- 'pretty_version' => '5.10.4',
58
- 'version' => '5.10.4.0',
59
- 'aliases' =>
60
- array (
61
- ),
62
- 'reference' => '70956c8f3fa621867af1af91f3cde0d17ae884fc',
63
- ),
64
- ),
65
- );
66
-
67
-
68
-
69
-
70
-
71
-
72
-
73
- public static function getInstalledPackages()
74
- {
75
- return array_keys(self::$installed['versions']);
76
- }
77
-
78
-
79
-
80
-
81
-
82
-
83
-
84
-
85
-
86
- public static function isInstalled($packageName)
87
- {
88
- return isset(self::$installed['versions'][$packageName]);
89
- }
90
-
91
-
92
-
93
-
94
-
95
-
96
-
97
-
98
-
99
-
100
-
101
-
102
-
103
-
104
- public static function satisfies(VersionParser $parser, $packageName, $constraint)
105
- {
106
- $constraint = $parser->parseConstraints($constraint);
107
- $provided = $parser->parseConstraints(self::getVersionRanges($packageName));
108
-
109
- return $provided->matches($constraint);
110
- }
111
-
112
-
113
-
114
-
115
-
116
-
117
-
118
-
119
-
120
-
121
- public static function getVersionRanges($packageName)
122
- {
123
- if (!isset(self::$installed['versions'][$packageName])) {
124
- throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
125
- }
126
-
127
- $ranges = array();
128
- if (isset(self::$installed['versions'][$packageName]['pretty_version'])) {
129
- $ranges[] = self::$installed['versions'][$packageName]['pretty_version'];
130
- }
131
- if (array_key_exists('aliases', self::$installed['versions'][$packageName])) {
132
- $ranges = array_merge($ranges, self::$installed['versions'][$packageName]['aliases']);
133
- }
134
- if (array_key_exists('replaced', self::$installed['versions'][$packageName])) {
135
- $ranges = array_merge($ranges, self::$installed['versions'][$packageName]['replaced']);
136
- }
137
- if (array_key_exists('provided', self::$installed['versions'][$packageName])) {
138
- $ranges = array_merge($ranges, self::$installed['versions'][$packageName]['provided']);
139
- }
140
-
141
- return implode(' || ', $ranges);
142
- }
143
-
144
-
145
-
146
-
147
-
148
- public static function getVersion($packageName)
149
- {
150
- if (!isset(self::$installed['versions'][$packageName])) {
151
- throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
152
- }
153
-
154
- if (!isset(self::$installed['versions'][$packageName]['version'])) {
155
- return null;
156
- }
157
-
158
- return self::$installed['versions'][$packageName]['version'];
159
- }
160
-
161
-
162
-
163
-
164
-
165
- public static function getPrettyVersion($packageName)
166
- {
167
- if (!isset(self::$installed['versions'][$packageName])) {
168
- throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
169
- }
170
-
171
- if (!isset(self::$installed['versions'][$packageName]['pretty_version'])) {
172
- return null;
173
- }
174
-
175
- return self::$installed['versions'][$packageName]['pretty_version'];
176
- }
177
-
178
-
179
-
180
-
181
-
182
- public static function getReference($packageName)
183
- {
184
- if (!isset(self::$installed['versions'][$packageName])) {
185
- throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
186
- }
187
-
188
- if (!isset(self::$installed['versions'][$packageName]['reference'])) {
189
- return null;
190
- }
191
-
192
- return self::$installed['versions'][$packageName]['reference'];
193
- }
194
-
195
-
196
-
197
-
198
-
199
- public static function getRootPackage()
200
- {
201
- return self::$installed['root'];
202
- }
203
-
204
-
205
-
206
-
207
-
208
-
209
-
210
- public static function getRawData()
211
- {
212
- return self::$installed;
213
- }
214
-
215
-
216
-
217
-
218
-
219
-
220
-
221
-
222
-
223
-
224
-
225
-
226
-
227
-
228
-
229
-
230
-
231
-
232
-
233
- public static function reload($data)
234
- {
235
- self::$installed = $data;
236
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
237
  }
1
  <?php
2
 
3
+ /*
4
+ * This file is part of Composer.
5
+ *
6
+ * (c) Nils Adermann <naderman@naderman.de>
7
+ * Jordi Boggiano <j.boggiano@seld.be>
8
+ *
9
+ * For the full copyright and license information, please view the LICENSE
10
+ * file that was distributed with this source code.
11
+ */
12
 
13
  namespace Composer;
14
 
15
+ use Composer\Autoload\ClassLoader;
16
  use Composer\Semver\VersionParser;
17
 
18
+ /**
19
+ * This class is copied in every Composer installed project and available to all
20
+ *
21
+ * See also https://getcomposer.org/doc/07-runtime.md#installed-versions
22
+ *
23
+ * To require its presence, you can require `composer-runtime-api ^2.0`
24
+ */
25
  class InstalledVersions
26
  {
27
+ /**
28
+ * @var mixed[]|null
29
+ * @psalm-var array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>}|array{}|null
30
+ */
31
+ private static $installed;
32
+
33
+ /**
34
+ * @var bool|null
35
+ */
36
+ private static $canGetVendors;
37
+
38
+ /**
39
+ * @var array[]
40
+ * @psalm-var array<string, array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>}>
41
+ */
42
+ private static $installedByVendor = array();
43
+
44
+ /**
45
+ * Returns a list of all package names which are present, either by being installed, replaced or provided
46
+ *
47
+ * @return string[]
48
+ * @psalm-return list<string>
49
+ */
50
+ public static function getInstalledPackages()
51
+ {
52
+ $packages = array();
53
+ foreach (self::getInstalled() as $installed) {
54
+ $packages[] = array_keys($installed['versions']);
55
+ }
56
+
57
+ if (1 === \count($packages)) {
58
+ return $packages[0];
59
+ }
60
+
61
+ return array_keys(array_flip(\call_user_func_array('array_merge', $packages)));
62
+ }
63
+
64
+ /**
65
+ * Returns a list of all package names with a specific type e.g. 'library'
66
+ *
67
+ * @param string $type
68
+ * @return string[]
69
+ * @psalm-return list<string>
70
+ */
71
+ public static function getInstalledPackagesByType($type)
72
+ {
73
+ $packagesByType = array();
74
+
75
+ foreach (self::getInstalled() as $installed) {
76
+ foreach ($installed['versions'] as $name => $package) {
77
+ if (isset($package['type']) && $package['type'] === $type) {
78
+ $packagesByType[] = $name;
79
+ }
80
+ }
81
+ }
82
+
83
+ return $packagesByType;
84
+ }
85
+
86
+ /**
87
+ * Checks whether the given package is installed
88
+ *
89
+ * This also returns true if the package name is provided or replaced by another package
90
+ *
91
+ * @param string $packageName
92
+ * @param bool $includeDevRequirements
93
+ * @return bool
94
+ */
95
+ public static function isInstalled($packageName, $includeDevRequirements = true)
96
+ {
97
+ foreach (self::getInstalled() as $installed) {
98
+ if (isset($installed['versions'][$packageName])) {
99
+ return $includeDevRequirements || empty($installed['versions'][$packageName]['dev_requirement']);
100
+ }
101
+ }
102
+
103
+ return false;
104
+ }
105
+
106
+ /**
107
+ * Checks whether the given package satisfies a version constraint
108
+ *
109
+ * e.g. If you want to know whether version 2.3+ of package foo/bar is installed, you would call:
110
+ *
111
+ * Composer\InstalledVersions::satisfies(new VersionParser, 'foo/bar', '^2.3')
112
+ *
113
+ * @param VersionParser $parser Install composer/semver to have access to this class and functionality
114
+ * @param string $packageName
115
+ * @param string|null $constraint A version constraint to check for, if you pass one you have to make sure composer/semver is required by your package
116
+ * @return bool
117
+ */
118
+ public static function satisfies(VersionParser $parser, $packageName, $constraint)
119
+ {
120
+ $constraint = $parser->parseConstraints($constraint);
121
+ $provided = $parser->parseConstraints(self::getVersionRanges($packageName));
122
+
123
+ return $provided->matches($constraint);
124
+ }
125
+
126
+ /**
127
+ * Returns a version constraint representing all the range(s) which are installed for a given package
128
+ *
129
+ * It is easier to use this via isInstalled() with the $constraint argument if you need to check
130
+ * whether a given version of a package is installed, and not just whether it exists
131
+ *
132
+ * @param string $packageName
133
+ * @return string Version constraint usable with composer/semver
134
+ */
135
+ public static function getVersionRanges($packageName)
136
+ {
137
+ foreach (self::getInstalled() as $installed) {
138
+ if (!isset($installed['versions'][$packageName])) {
139
+ continue;
140
+ }
141
+
142
+ $ranges = array();
143
+ if (isset($installed['versions'][$packageName]['pretty_version'])) {
144
+ $ranges[] = $installed['versions'][$packageName]['pretty_version'];
145
+ }
146
+ if (array_key_exists('aliases', $installed['versions'][$packageName])) {
147
+ $ranges = array_merge($ranges, $installed['versions'][$packageName]['aliases']);
148
+ }
149
+ if (array_key_exists('replaced', $installed['versions'][$packageName])) {
150
+ $ranges = array_merge($ranges, $installed['versions'][$packageName]['replaced']);
151
+ }
152
+ if (array_key_exists('provided', $installed['versions'][$packageName])) {
153
+ $ranges = array_merge($ranges, $installed['versions'][$packageName]['provided']);
154
+ }
155
+
156
+ return implode(' || ', $ranges);
157
+ }
158
+
159
+ throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
160
+ }
161
+
162
+ /**
163
+ * @param string $packageName
164
+ * @return string|null If the package is being replaced or provided but is not really installed, null will be returned as version, use satisfies or getVersionRanges if you need to know if a given version is present
165
+ */
166
+ public static function getVersion($packageName)
167
+ {
168
+ foreach (self::getInstalled() as $installed) {
169
+ if (!isset($installed['versions'][$packageName])) {
170
+ continue;
171
+ }
172
+
173
+ if (!isset($installed['versions'][$packageName]['version'])) {
174
+ return null;
175
+ }
176
+
177
+ return $installed['versions'][$packageName]['version'];
178
+ }
179
+
180
+ throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
181
+ }
182
+
183
+ /**
184
+ * @param string $packageName
185
+ * @return string|null If the package is being replaced or provided but is not really installed, null will be returned as version, use satisfies or getVersionRanges if you need to know if a given version is present
186
+ */
187
+ public static function getPrettyVersion($packageName)
188
+ {
189
+ foreach (self::getInstalled() as $installed) {
190
+ if (!isset($installed['versions'][$packageName])) {
191
+ continue;
192
+ }
193
+
194
+ if (!isset($installed['versions'][$packageName]['pretty_version'])) {
195
+ return null;
196
+ }
197
+
198
+ return $installed['versions'][$packageName]['pretty_version'];
199
+ }
200
+
201
+ throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
202
+ }
203
+
204
+ /**
205
+ * @param string $packageName
206
+ * @return string|null If the package is being replaced or provided but is not really installed, null will be returned as reference
207
+ */
208
+ public static function getReference($packageName)
209
+ {
210
+ foreach (self::getInstalled() as $installed) {
211
+ if (!isset($installed['versions'][$packageName])) {
212
+ continue;
213
+ }
214
+
215
+ if (!isset($installed['versions'][$packageName]['reference'])) {
216
+ return null;
217
+ }
218
+
219
+ return $installed['versions'][$packageName]['reference'];
220
+ }
221
+
222
+ throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
223
+ }
224
+
225
+ /**
226
+ * @param string $packageName
227
+ * @return string|null If the package is being replaced or provided but is not really installed, null will be returned as install path. Packages of type metapackages also have a null install path.
228
+ */
229
+ public static function getInstallPath($packageName)
230
+ {
231
+ foreach (self::getInstalled() as $installed) {
232
+ if (!isset($installed['versions'][$packageName])) {
233
+ continue;
234
+ }
235
+
236
+ return isset($installed['versions'][$packageName]['install_path']) ? $installed['versions'][$packageName]['install_path'] : null;
237
+ }
238
+
239
+ throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
240
+ }
241
+
242
+ /**
243
+ * @return array
244
+ * @psalm-return array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}
245
+ */
246
+ public static function getRootPackage()
247
+ {
248
+ $installed = self::getInstalled();
249
+
250
+ return $installed[0]['root'];
251
+ }
252
+
253
+ /**
254
+ * Returns the raw installed.php data for custom implementations
255
+ *
256
+ * @deprecated Use getAllRawData() instead which returns all datasets for all autoloaders present in the process. getRawData only returns the first dataset loaded, which may not be what you expect.
257
+ * @return array[]
258
+ * @psalm-return array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>}
259
+ */
260
+ public static function getRawData()
261
+ {
262
+ @trigger_error('getRawData only returns the first dataset loaded, which may not be what you expect. Use getAllRawData() instead which returns all datasets for all autoloaders present in the process.', E_USER_DEPRECATED);
263
+
264
+ if (null === self::$installed) {
265
+ // only require the installed.php file if this file is loaded from its dumped location,
266
+ // and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937
267
+ if (substr(__DIR__, -8, 1) !== 'C') {
268
+ self::$installed = include __DIR__ . '/installed.php';
269
+ } else {
270
+ self::$installed = array();
271
+ }
272
+ }
273
+
274
+ return self::$installed;
275
+ }
276
+
277
+ /**
278
+ * Returns the raw data of all installed.php which are currently loaded for custom implementations
279
+ *
280
+ * @return array[]
281
+ * @psalm-return list<array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>}>
282
+ */
283
+ public static function getAllRawData()
284
+ {
285
+ return self::getInstalled();
286
+ }
287
+
288
+ /**
289
+ * Lets you reload the static array from another file
290
+ *
291
+ * This is only useful for complex integrations in which a project needs to use
292
+ * this class but then also needs to execute another project's autoloader in process,
293
+ * and wants to ensure both projects have access to their version of installed.php.
294
+ *
295
+ * A typical case would be PHPUnit, where it would need to make sure it reads all
296
+ * the data it needs from this class, then call reload() with
297
+ * `require $CWD/vendor/composer/installed.php` (or similar) as input to make sure
298
+ * the project in which it runs can then also use this class safely, without
299
+ * interference between PHPUnit's dependencies and the project's dependencies.
300
+ *
301
+ * @param array[] $data A vendor/composer/installed.php data set
302
+ * @return void
303
+ *
304
+ * @psalm-param array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>} $data
305
+ */
306
+ public static function reload($data)
307
+ {
308
+ self::$installed = $data;
309
+ self::$installedByVendor = array();
310
+ }
311
+
312
+ /**
313
+ * @return array[]
314
+ * @psalm-return list<array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>}>
315
+ */
316
+ private static function getInstalled()
317
+ {
318
+ if (null === self::$canGetVendors) {
319
+ self::$canGetVendors = method_exists('Composer\Autoload\ClassLoader', 'getRegisteredLoaders');
320
+ }
321
+
322
+ $installed = array();
323
+
324
+ if (self::$canGetVendors) {
325
+ foreach (ClassLoader::getRegisteredLoaders() as $vendorDir => $loader) {
326
+ if (isset(self::$installedByVendor[$vendorDir])) {
327
+ $installed[] = self::$installedByVendor[$vendorDir];
328
+ } elseif (is_file($vendorDir.'/composer/installed.php')) {
329
+ $installed[] = self::$installedByVendor[$vendorDir] = require $vendorDir.'/composer/installed.php';
330
+ if (null === self::$installed && strtr($vendorDir.'/composer', '\\', '/') === strtr(__DIR__, '\\', '/')) {
331
+ self::$installed = $installed[count($installed) - 1];
332
+ }
333
+ }
334
+ }
335
+ }
336
+
337
+ if (null === self::$installed) {
338
+ // only require the installed.php file if this file is loaded from its dumped location,
339
+ // and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937
340
+ if (substr(__DIR__, -8, 1) !== 'C') {
341
+ self::$installed = require __DIR__ . '/installed.php';
342
+ } else {
343
+ self::$installed = array();
344
+ }
345
+ }
346
+ $installed[] = self::$installed;
347
+
348
+ return $installed;
349
+ }
350
  }
vendor/composer/autoload_classmap.php CHANGED
@@ -6,4 +6,5 @@ $vendorDir = dirname(dirname(__FILE__));
6
  $baseDir = dirname($vendorDir);
7
 
8
  return array(
 
9
  );
6
  $baseDir = dirname($vendorDir);
7
 
8
  return array(
9
+ 'Composer\\InstalledVersions' => $vendorDir . '/composer/InstalledVersions.php',
10
  );
vendor/composer/autoload_real.php CHANGED
@@ -2,7 +2,7 @@
2
 
3
  // autoload_real.php @generated by Composer
4
 
5
- class ComposerAutoloaderInitf37bec5afd2a7aa6257c0f78fd20af7b
6
  {
7
  private static $loader;
8
 
@@ -22,15 +22,17 @@ class ComposerAutoloaderInitf37bec5afd2a7aa6257c0f78fd20af7b
22
  return self::$loader;
23
  }
24
 
25
- spl_autoload_register(array('ComposerAutoloaderInitf37bec5afd2a7aa6257c0f78fd20af7b', 'loadClassLoader'), true, true);
26
- self::$loader = $loader = new \Composer\Autoload\ClassLoader();
27
- spl_autoload_unregister(array('ComposerAutoloaderInitf37bec5afd2a7aa6257c0f78fd20af7b', 'loadClassLoader'));
 
 
28
 
29
  $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
30
  if ($useStaticLoader) {
31
- require_once __DIR__ . '/autoload_static.php';
32
 
33
- call_user_func(\Composer\Autoload\ComposerStaticInitf37bec5afd2a7aa6257c0f78fd20af7b::getInitializer($loader));
34
  } else {
35
  $map = require __DIR__ . '/autoload_namespaces.php';
36
  foreach ($map as $namespace => $path) {
2
 
3
  // autoload_real.php @generated by Composer
4
 
5
+ class ComposerAutoloaderInit9b2474036b822a585558437604722fc9
6
  {
7
  private static $loader;
8
 
22
  return self::$loader;
23
  }
24
 
25
+ require __DIR__ . '/platform_check.php';
26
+
27
+ spl_autoload_register(array('ComposerAutoloaderInit9b2474036b822a585558437604722fc9', 'loadClassLoader'), true, true);
28
+ self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__)));
29
+ spl_autoload_unregister(array('ComposerAutoloaderInit9b2474036b822a585558437604722fc9', 'loadClassLoader'));
30
 
31
  $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
32
  if ($useStaticLoader) {
33
+ require __DIR__ . '/autoload_static.php';
34
 
35
+ call_user_func(\Composer\Autoload\ComposerStaticInit9b2474036b822a585558437604722fc9::getInitializer($loader));
36
  } else {
37
  $map = require __DIR__ . '/autoload_namespaces.php';
38
  foreach ($map as $namespace => $path) {
vendor/composer/autoload_static.php CHANGED
@@ -4,7 +4,7 @@
4
 
5
  namespace Composer\Autoload;
6
 
7
- class ComposerStaticInitf37bec5afd2a7aa6257c0f78fd20af7b
8
  {
9
  public static $prefixLengthsPsr4 = array (
10
  'B' =>
@@ -30,12 +30,17 @@ class ComposerStaticInitf37bec5afd2a7aa6257c0f78fd20af7b
30
  ),
31
  );
32
 
 
 
 
 
33
  public static function getInitializer(ClassLoader $loader)
34
  {
35
  return \Closure::bind(function () use ($loader) {
36
- $loader->prefixLengthsPsr4 = ComposerStaticInitf37bec5afd2a7aa6257c0f78fd20af7b::$prefixLengthsPsr4;
37
- $loader->prefixDirsPsr4 = ComposerStaticInitf37bec5afd2a7aa6257c0f78fd20af7b::$prefixDirsPsr4;
38
- $loader->prefixesPsr0 = ComposerStaticInitf37bec5afd2a7aa6257c0f78fd20af7b::$prefixesPsr0;
 
39
 
40
  }, null, ClassLoader::class);
41
  }
4
 
5
  namespace Composer\Autoload;
6
 
7
+ class ComposerStaticInit9b2474036b822a585558437604722fc9
8
  {
9
  public static $prefixLengthsPsr4 = array (
10
  'B' =>
30
  ),
31
  );
32
 
33
+ public static $classMap = array (
34
+ 'Composer\\InstalledVersions' => __DIR__ . '/..' . '/composer/InstalledVersions.php',
35
+ );
36
+
37
  public static function getInitializer(ClassLoader $loader)
38
  {
39
  return \Closure::bind(function () use ($loader) {
40
+ $loader->prefixLengthsPsr4 = ComposerStaticInit9b2474036b822a585558437604722fc9::$prefixLengthsPsr4;
41
+ $loader->prefixDirsPsr4 = ComposerStaticInit9b2474036b822a585558437604722fc9::$prefixDirsPsr4;
42
+ $loader->prefixesPsr0 = ComposerStaticInit9b2474036b822a585558437604722fc9::$prefixesPsr0;
43
+ $loader->classMap = ComposerStaticInit9b2474036b822a585558437604722fc9::$classMap;
44
 
45
  }, null, ClassLoader::class);
46
  }
vendor/composer/installed.json CHANGED
@@ -1,86 +1,92 @@
1
- [
2
- {
3
- "name": "braintree/braintree_php",
4
- "version": "3.34.0",
5
- "version_normalized": "3.34.0.0",
6
- "source": {
7
- "type": "git",
8
- "url": "https://github.com/braintree/braintree_php.git",
9
- "reference": "fd55c466d0d0088c67705d7ba0b3876d9767bfda"
10
- },
11
- "dist": {
12
- "type": "zip",
13
- "url": "https://api.github.com/repos/braintree/braintree_php/zipball/fd55c466d0d0088c67705d7ba0b3876d9767bfda",
14
- "reference": "fd55c466d0d0088c67705d7ba0b3876d9767bfda",
15
- "shasum": ""
16
- },
17
- "require": {
18
- "ext-curl": "*",
19
- "ext-dom": "*",
20
- "ext-hash": "*",
21
- "ext-openssl": "*",
22
- "ext-xmlwriter": "*",
23
- "php": ">=5.4.0"
24
- },
25
- "require-dev": {
26
- "phpunit/phpunit": "3.7.*"
27
- },
28
- "time": "2018-05-21T18:14:47+00:00",
29
- "type": "library",
30
- "installation-source": "dist",
31
- "autoload": {
32
- "psr-0": {
33
- "Braintree": "lib/"
34
  },
35
- "psr-4": {
36
- "Braintree\\": "lib/Braintree"
37
- }
38
- },
39
- "notification-url": "https://packagist.org/downloads/",
40
- "license": [
41
- "MIT"
42
- ],
43
- "authors": [
44
- {
45
- "name": "Braintree",
46
- "homepage": "https://www.braintreepayments.com"
47
- }
48
- ],
49
- "description": "Braintree PHP Client Library",
50
- "support": {
51
- "issues": "https://github.com/braintree/braintree_php/issues",
52
- "source": "https://github.com/braintree/braintree_php/tree/3.34.0"
53
- }
54
- },
55
- {
56
- "name": "skyverge/wc-plugin-framework",
57
- "version": "5.10.7",
58
- "version_normalized": "5.10.7.0",
59
- "source": {
60
- "type": "git",
61
- "url": "https://github.com/skyverge/wc-plugin-framework.git",
62
- "reference": "3a2c8cb4af31bd2c5e1af38647c249c37575db2c"
63
- },
64
- "dist": {
65
- "type": "zip",
66
- "url": "https://api.github.com/repos/skyverge/wc-plugin-framework/zipball/3a2c8cb4af31bd2c5e1af38647c249c37575db2c",
67
- "reference": "3a2c8cb4af31bd2c5e1af38647c249c37575db2c",
68
- "shasum": ""
69
- },
70
- "require-dev": {
71
- "codeception/module-asserts": "^1.3",
72
- "codeception/module-db": "^1.0",
73
- "codeception/module-phpbrowser": "^1.0",
74
- "lucatume/wp-browser": "3.0.5",
75
- "phpcompatibility/php-compatibility": "9.3.5"
 
 
 
76
  },
77
- "time": "2021-04-15T18:24:53+00:00",
78
- "type": "library",
79
- "installation-source": "source",
80
- "description": "The official SkyVerge WooCommerce plugin framework",
81
- "support": {
82
- "source": "https://github.com/skyverge/wc-plugin-framework/tree/5.10.7",
83
- "issues": "https://github.com/skyverge/wc-plugin-framework/issues"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
84
  }
85
- }
86
- ]
 
 
1
+ {
2
+ "packages": [
3
+ {
4
+ "name": "braintree/braintree_php",
5
+ "version": "3.34.0",
6
+ "version_normalized": "3.34.0.0",
7
+ "source": {
8
+ "type": "git",
9
+ "url": "https://github.com/braintree/braintree_php.git",
10
+ "reference": "fd55c466d0d0088c67705d7ba0b3876d9767bfda"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11
  },
12
+ "dist": {
13
+ "type": "zip",
14
+ "url": "https://api.github.com/repos/braintree/braintree_php/zipball/fd55c466d0d0088c67705d7ba0b3876d9767bfda",
15
+ "reference": "fd55c466d0d0088c67705d7ba0b3876d9767bfda",
16
+ "shasum": ""
17
+ },
18
+ "require": {
19
+ "ext-curl": "*",
20
+ "ext-dom": "*",
21
+ "ext-hash": "*",
22
+ "ext-openssl": "*",
23
+ "ext-xmlwriter": "*",
24
+ "php": ">=5.4.0"
25
+ },
26
+ "require-dev": {
27
+ "phpunit/phpunit": "3.7.*"
28
+ },
29
+ "time": "2018-05-21T18:14:47+00:00",
30
+ "type": "library",
31
+ "installation-source": "dist",
32
+ "autoload": {
33
+ "psr-0": {
34
+ "Braintree": "lib/"
35
+ },
36
+ "psr-4": {
37
+ "Braintree\\": "lib/Braintree"
38
+ }
39
+ },
40
+ "notification-url": "https://packagist.org/downloads/",
41
+ "license": [
42
+ "MIT"
43
+ ],
44
+ "authors": [
45
+ {
46
+ "name": "Braintree",
47
+ "homepage": "https://www.braintreepayments.com"
48
+ }
49
+ ],
50
+ "description": "Braintree PHP Client Library",
51
+ "support": {
52
+ "issues": "https://github.com/braintree/braintree_php/issues",
53
+ "source": "https://github.com/braintree/braintree_php/tree/3.34.0"
54
+ },
55
+ "install-path": "../braintree/braintree_php"
56
  },
57
+ {
58
+ "name": "skyverge/wc-plugin-framework",
59
+ "version": "5.10.7",
60
+ "version_normalized": "5.10.7.0",
61
+ "source": {
62
+ "type": "git",
63
+ "url": "https://github.com/skyverge/wc-plugin-framework.git",
64
+ "reference": "3a2c8cb4af31bd2c5e1af38647c249c37575db2c"
65
+ },
66
+ "dist": {
67
+ "type": "zip",
68
+ "url": "https://api.github.com/repos/skyverge/wc-plugin-framework/zipball/3a2c8cb4af31bd2c5e1af38647c249c37575db2c",
69
+ "reference": "3a2c8cb4af31bd2c5e1af38647c249c37575db2c",
70
+ "shasum": ""
71
+ },
72
+ "require-dev": {
73
+ "codeception/module-asserts": "^1.3",
74
+ "codeception/module-db": "^1.0",
75
+ "codeception/module-phpbrowser": "^1.0",
76
+ "lucatume/wp-browser": "3.0.5",
77
+ "phpcompatibility/php-compatibility": "9.3.5"
78
+ },
79
+ "time": "2021-04-15T18:24:53+00:00",
80
+ "type": "library",
81
+ "installation-source": "dist",
82
+ "description": "The official SkyVerge WooCommerce plugin framework",
83
+ "support": {
84
+ "source": "https://github.com/skyverge/wc-plugin-framework/tree/5.10.7",
85
+ "issues": "https://github.com/skyverge/wc-plugin-framework/issues"
86
+ },
87
+ "install-path": "../skyverge/wc-plugin-framework"
88
  }
89
+ ],
90
+ "dev": false,
91
+ "dev-package-names": []
92
+ }
vendor/composer/installed.php CHANGED
@@ -1,42 +1,41 @@
1
- <?php return array (
2
- 'root' =>
3
- array (
4
- 'pretty_version' => 'dev-master',
5
- 'version' => 'dev-master',
6
- 'aliases' =>
7
- array (
 
 
 
8
  ),
9
- 'reference' => 'af5e91b6ee08f98909e134e48180de218afa133b',
10
- 'name' => '__root__',
11
- ),
12
- 'versions' =>
13
- array (
14
- '__root__' =>
15
- array (
16
- 'pretty_version' => 'dev-master',
17
- 'version' => 'dev-master',
18
- 'aliases' =>
19
- array (
20
- ),
21
- 'reference' => 'af5e91b6ee08f98909e134e48180de218afa133b',
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
22
  ),
23
- 'braintree/braintree_php' =>
24
- array (
25
- 'pretty_version' => '3.34.0',
26
- 'version' => '3.34.0.0',
27
- 'aliases' =>
28
- array (
29
- ),
30
- 'reference' => 'fd55c466d0d0088c67705d7ba0b3876d9767bfda',
31
- ),
32
- 'skyverge/wc-plugin-framework' =>
33
- array (
34
- 'pretty_version' => '5.10.4',
35
- 'version' => '5.10.4.0',
36
- 'aliases' =>
37
- array (
38
- ),
39
- 'reference' => '70956c8f3fa621867af1af91f3cde0d17ae884fc',
40
- ),
41
- ),
42
  );
1
+ <?php return array(
2
+ 'root' => array(
3
+ 'pretty_version' => 'dev-trunk',
4
+ 'version' => 'dev-trunk',
5
+ 'type' => 'library',
6
+ 'install_path' => __DIR__ . '/../../',
7
+ 'aliases' => array(),
8
+ 'reference' => '0139998a60a7e682cbc751d55ea24bd227063b41',
9
+ 'name' => '__root__',
10
+ 'dev' => false,
11
  ),
12
+ 'versions' => array(
13
+ '__root__' => array(
14
+ 'pretty_version' => 'dev-trunk',
15
+ 'version' => 'dev-trunk',
16
+ 'type' => 'library',
17
+ 'install_path' => __DIR__ . '/../../',
18
+ 'aliases' => array(),
19
+ 'reference' => '0139998a60a7e682cbc751d55ea24bd227063b41',
20
+ 'dev_requirement' => false,
21
+ ),
22
+ 'braintree/braintree_php' => array(
23
+ 'pretty_version' => '3.34.0',
24
+ 'version' => '3.34.0.0',
25
+ 'type' => 'library',
26
+ 'install_path' => __DIR__ . '/../braintree/braintree_php',
27
+ 'aliases' => array(),
28
+ 'reference' => 'fd55c466d0d0088c67705d7ba0b3876d9767bfda',
29
+ 'dev_requirement' => false,
30
+ ),
31
+ 'skyverge/wc-plugin-framework' => array(
32
+ 'pretty_version' => '5.10.7',
33
+ 'version' => '5.10.7.0',
34
+ 'type' => 'library',
35
+ 'install_path' => __DIR__ . '/../skyverge/wc-plugin-framework',
36
+ 'aliases' => array(),
37
+ 'reference' => '3a2c8cb4af31bd2c5e1af38647c249c37575db2c',
38
+ 'dev_requirement' => false,
39
+ ),
40
  ),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
41
  );
woocommerce-gateway-paypal-powered-by-braintree.php CHANGED
@@ -6,7 +6,7 @@
6
  * Description: Receive credit card or PayPal payments using Braintree for WooCommerce. A server with cURL, SSL support, and a valid SSL certificate is required (for security reasons) for this gateway to function. Requires PHP 5.4+
7
  * Author: WooCommerce
8
  * Author URI: http://woocommerce.com/
9
- * Version: 2.6.1
10
  * Text Domain: woocommerce-gateway-paypal-powered-by-braintree
11
  * Domain Path: /i18n/languages/
12
  *
6
  * Description: Receive credit card or PayPal payments using Braintree for WooCommerce. A server with cURL, SSL support, and a valid SSL certificate is required (for security reasons) for this gateway to function. Requires PHP 5.4+
7
  * Author: WooCommerce
8
  * Author URI: http://woocommerce.com/
9
+ * Version: 2.6.2
10
  * Text Domain: woocommerce-gateway-paypal-powered-by-braintree
11
  * Domain Path: /i18n/languages/
12
  *