WooCommerce PayPal Powered by Braintree Payment Gateway - Version 2.3.11

Version Description

Download this release

Release Info

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

Code changes from version 2.3.10 to 2.3.11

assets/js/frontend/wc-braintree-apple-pay.min.js CHANGED
@@ -1 +1 @@
1
- "use strict";var _createClass=function(){function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(e,t,n){return t&&r(e.prototype,t),n&&r(e,n),e}}(),_get=function e(t,n,r){null===t&&(t=Function.prototype);var o=Object.getOwnPropertyDescriptor(t,n);if(void 0===o){var i=Object.getPrototypeOf(t);return null===i?void 0:e(i,n,r)}if("value"in o)return o.value;var a=o.get;return void 0!==a?a.call(r):void 0};function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function _inherits(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(function(){function i(e,t){if(!(e instanceof t))throw new Error("Bound instance method accessed before binding")}jQuery(document).ready(function(t){var r;return r=window.WC_Braintree_Apple_Pay_Handler=(_inherits(o,SV_WC_Apple_Pay_Handler),_createClass(o,[{key:"is_available",value:function(){return window.ApplePaySession&&ApplePaySession.canMakePayments()}},{key:"init",value:function(){if(this.is_available())return this.instance?_get(o.prototype.__proto__||Object.getPrototypeOf(o.prototype),"init",this).call(this):this.create_client()}},{key:"create_client",value:function(){var t=this;return this.get_client_token().done(function(e){if(e.success)return braintree.client.create({authorization:e.data}).then(function(e){return t.client=e,t.create_instance()}).catch(function(e){return console.error("Could not create Braintree client"),console.error(e)})}).fail(function(e,t,n){return console.error("Could not retrieve the client token via AJAX: "+n)})}},{key:"get_client_token",value:function(){var e;return e={action:"wc_"+this.gateway_id+"_get_client_token",nonce:this.client_token_nonce},t.post(this.ajax_url,e)}},{key:"create_instance",value:function(){var t=this;return braintree.applePay.create({client:this.client}).then(function(e){return t.instance=e,ApplePaySession.canMakePaymentsWithActiveCard(e.merchantIdentifier).then(function(e){if(e)return t.init()})}).catch(function(e){return console.error("Could not create Braintree Apple Pay instance. "+e.message),console.error(e)})}},{key:"get_new_session",value:function(e){var t;return t=this.instance.createPaymentRequest(e),_get(o.prototype.__proto__||Object.getPrototypeOf(o.prototype),"get_new_session",this).call(this,t)}},{key:"on_validate_merchant",value:function(e){var t=this;return i(this,r),this.instance.performValidation({validationURL:e.validationURL,displayName:this.store_name}).then(function(e){return t.session.completeMerchantValidation(e)}).catch(function(e){return t.session.abort(),t.fail_payment("Merchant could not be validated. "+e.message)})}},{key:"process_authorization",value:function(t){var n=this;return i(this,r),this.instance.tokenize({token:t.token}).then(function(e){return t.braintree_nonce=e.nonce,_get(o.prototype.__proto__||Object.getPrototypeOf(o.prototype),"process_authorization",n).call(n,t)}).catch(function(e){return n.set_payment_status(!1),n.fail_payment("Payment could not be processed. "+e)})}}]),o);function o(e){_classCallCheck(this,o);var t=_possibleConstructorReturn(this,(o.__proto__||Object.getPrototypeOf(o)).call(this,e));return t.on_validate_merchant=t.on_validate_merchant.bind(t),t.process_authorization=t.process_authorization.bind(t),t.store_name=e.store_name,t.client_token_nonce=e.client_token_nonce,t}})}).call(void 0);
1
+ "use strict";var _createClass=function(){function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(e,t,n){return t&&r(e.prototype,t),n&&r(e,n),e}}(),_get=function e(t,n,r){null===t&&(t=Function.prototype);var o=Object.getOwnPropertyDescriptor(t,n);if(void 0===o){var i=Object.getPrototypeOf(t);return null===i?void 0:e(i,n,r)}if("value"in o)return o.value;var a=o.get;return void 0!==a?a.call(r):void 0};function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function _inherits(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(function(){function i(e,t){if(!(e instanceof t))throw new Error("Bound instance method accessed before binding")}jQuery(document).ready(function(t){var r;return r=window.WC_Braintree_Apple_Pay_Handler=(_inherits(o,SV_WC_Apple_Pay_Handler),_createClass(o,[{key:"is_available",value:function(){return window.ApplePaySession&&ApplePaySession.canMakePayments()}},{key:"init",value:function(){if(this.is_available())return this.instance?_get(o.prototype.__proto__||Object.getPrototypeOf(o.prototype),"init",this).call(this):this.create_client()}},{key:"create_client",value:function(){var t=this;return this.get_client_token().done(function(e){if(e.success)return braintree.client.create({authorization:e.data}).then(function(e){return t.client=e,t.create_instance()}).catch(function(e){return console.error("Could not create Braintree client"),console.error(e)})}).fail(function(e,t,n){return console.error("Could not retrieve the client token via AJAX: "+n)})}},{key:"get_client_token",value:function(){var e={action:"wc_"+this.gateway_id+"_get_client_token",nonce:this.client_token_nonce};return t.post(this.ajax_url,e)}},{key:"create_instance",value:function(){var t=this;return braintree.applePay.create({client:this.client}).then(function(e){return t.instance=e,ApplePaySession.canMakePaymentsWithActiveCard(e.merchantIdentifier).then(function(e){if(e)return t.init()})}).catch(function(e){return console.error("Could not create Braintree Apple Pay instance. "+e.message),console.error(e)})}},{key:"get_new_session",value:function(e){var t=this.instance.createPaymentRequest(e);return _get(o.prototype.__proto__||Object.getPrototypeOf(o.prototype),"get_new_session",this).call(this,t)}},{key:"on_validate_merchant",value:function(e){var t=this;return i(this,r),this.instance.performValidation({validationURL:e.validationURL,displayName:this.store_name}).then(function(e){return t.session.completeMerchantValidation(e)}).catch(function(e){return t.session.abort(),t.fail_payment("Merchant could not be validated. "+e.message)})}},{key:"process_authorization",value:function(t){var n=this;return i(this,r),this.instance.tokenize({token:t.token}).then(function(e){return t.braintree_nonce=e.nonce,_get(o.prototype.__proto__||Object.getPrototypeOf(o.prototype),"process_authorization",n).call(n,t)}).catch(function(e){return n.set_payment_status(!1),n.fail_payment("Payment could not be processed. "+e)})}}]),o);function o(e){_classCallCheck(this,o);var t=_possibleConstructorReturn(this,(o.__proto__||Object.getPrototypeOf(o)).call(this,e));return t.on_validate_merchant=t.on_validate_merchant.bind(t),t.process_authorization=t.process_authorization.bind(t),t.store_name=e.store_name,t.client_token_nonce=e.client_token_nonce,t}})}).call(void 0);
assets/js/frontend/wc-braintree.min.js CHANGED
@@ -1 +1 @@
1
- "use strict";var _get=function e(t,n,r){null===t&&(t=Function.prototype);var i=Object.getOwnPropertyDescriptor(t,n);if(void 0===i){var a=Object.getPrototypeOf(t);return null===a?void 0:e(a,n,r)}if("value"in i)return i.value;var o=i.get;return void 0!==o?o.call(r):void 0},_createClass=function(){function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(e,t,n){return t&&r(e.prototype,t),n&&r(e,n),e}}();function _possibleConstructorReturn(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function _inherits(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(function(){function s(e,t){if(!(e instanceof t))throw new Error("Bound instance method accessed before binding")}var u=[].indexOf;jQuery(document).ready(function(d){var e,n,r;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 o(e){_classCallCheck(this,o);var t=_possibleConstructorReturn(this,(o.__proto__||Object.getPrototypeOf(o)).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 i(e){_classCallCheck(this,i);var t=_possibleConstructorReturn(this,(i.__proto__||Object.getPrototypeOf(i)).call(this,e));return t.do_integration_ready=t.do_integration_ready.bind(t),t.on_authorize=t.on_authorize.bind(t),t.get_linked_account_html=t.get_linked_account_html.bind(t),t.is_test_environment=e.is_test_environment,t.is_paypal_credit_enabled=e.is_paypal_credit_enabled,t.must_login_message=e.must_login_message,t.must_login_add_method_message=e.must_login_add_method_message,t.button_styles=e.button_styles,t.cart_payment_nonce=e.cart_payment_nonce,t.init(),t}function a(e){_classCallCheck(this,a);var t=_possibleConstructorReturn(this,(a.__proto__||Object.getPrototypeOf(a)).call(this,e));return t.set_payment_method_nonce=e.set_payment_method_nonce,t.cart_handler_url=e.cart_handler_url,t.form=d("form.woocommerce-cart-form"),t.form_ui_selector="",t.setup_braintree(),d(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()?d("form.checkout").length?this.handle_checkout_page():d("form#order_review").length?this.handle_pay_page():d("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=d("form.checkout"),this.form_ui_selector=".woocommerce-checkout-payment",d(document.body).on("updated_checkout",function(){if(!e.setting_up)return e.setup_braintree()}),d(document.body).on("updated_checkout",function(){return e.handle_saved_payment_methods()}),d(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=d("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=d("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 d("input[name=wc_"+this.id+"_payment_nonce]").val(e),this.form.submit()}},{key:"handle_saved_payment_methods",value:function(){var e,n=this;if(e=d("div.js-wc-"+this.id_dasherized+"-new-payment-method-form"),d("input.js-wc-"+this.id_dasherized+"-payment-token").change(function(){return d("input.js-wc-"+n.id_dasherized+"-payment-token:checked").val()?e.slideUp(200):e.slideDown(200)}).change(),d("input#createaccount").change(function(e){var t;return t=d("input.js-wc-"+n.id_dasherized+"-tokenize-payment-method").closest("p.form-row"),d(e.target).is(":checked")?(t.slideDown(),t.next().show()):(t.hide(),t.next().hide())}),!d("input#createaccount").is(":checked"))return d("input#createaccount").change()}},{key:"setup_braintree",value:function(){if(!d("#wc-"+this.id_dasherized+"-account-number-hosted iframe").data("ready"))return this.setting_up=!0,this.block_ui(),d("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(){var e;return this.id,e={action:"wc_"+this.id+"_get_client_token",nonce:this.client_token_nonce},d.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(),d("#wc-"+t.id_dasherized+"-account-number-hosted iframe").data("ready",!0),t.do_integration_ready(),d(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)return this.block_ui(),this.integration.teardown(function(){return e.integration=null,e.unblock_ui()})}},{key:"do_integration_ready",value:function(){}},{key:"get_integration_options",value:function(){return{client:this.client}}},{key:"get_integration_class",value:function(){}},{key:"handle_integration_error",value:function(e){return this.log("Integration error. "+e.message,e,"error"),this.hide_integration_ui(),this.unblock_ui()}},{key:"handle_payment_error",value:function(e){return this.log("Payment error. "+e.message,e,"error"),this.render_error(this.get_user_message(e)),this.unblock_ui()}},{key:"render_error",value:function(e){return d(".woocommerce-error, .woocommerce-message").remove(),this.form.prepend('<div class="woocommerce-error">'+e+"</div>").removeClass("processing").unblock(),d("html, body").animate({scrollTop:this.form.offset().top-100},1e3),d("input[name=wc_"+this.id+"_payment_nonce]").val(""),this.form.trigger("wc_"+this.id+"_rendered_error"),d(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(d("div.js-wc-"+this.id_dasherized+"-new-payment-method-form").find(".woocommerce-error").remove(),d("input#createaccount").length&&d("input#createaccount").is(":checked"))return d("div.js-wc-"+this.id_dasherized+"-new-payment-method-form").find(".form-row").show()}},{key:"hide_integration_ui",value:function(){return d("div.js-wc-"+this.id_dasherized+"-new-payment-method-form").prepend('<div class="woocommerce-error">'+this.integration_error_message+"</div>"),d("div.js-wc-"+this.id_dasherized+"-new-payment-method-form").find(".form-row").hide()}},{key:"block_ui",value:function(){return d(this.form_ui_selector).block({message:null,overlayCSS:{background:"#fff",opacity:.6}})}},{key:"unblock_ui",value:function(){return d(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,n){var r=1<arguments.length&&void 0!==t?t:null;if(this.debug)return console.log(this.name+": "+e),r?console.log(r):void 0}}]),t),e=window.WC_Braintree_Credit_Card_Payment_Form_Handler=(_inherits(o,WC_Braintree_Payment_Form_Handler),_createClass(o,[{key:"handle_checkout_error",value:function(){return _get(o.prototype.__proto__||Object.getPrototypeOf(o.prototype),"handle_checkout_error",this).call(this),d("input[name=wc_"+this.id+"_payment_nonce]").val(""),d("input[name=wc-"+this.id_dasherized+"-card-type]").val(""),d("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=d("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(o.prototype.__proto__||Object.getPrototypeOf(o.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;return e={client:this.client,fields:{number:{selector:"#wc-braintree-credit-card-account-number-hosted",placeholder:d("#wc-braintree-credit-card-account-number-hosted").data("placeholder")},cvv:{selector:"#wc-braintree-credit-card-csc-hosted",placeholder:d("#wc-braintree-credit-card-csc-hosted").data("placeholder")},expirationDate:{selector:"#wc-braintree-credit-card-expiry-hosted",placeholder:d("#wc-braintree-credit-card-expiry-hosted").data("placeholder")}},styles:this.hosted_fields_styles},this.csc_required&&this.using_payment_token()&&(delete e.fields.number,delete e.fields.expirationDate),this.csc_required||delete e.fields.cvv,e}},{key:"get_integration_class",value:function(){return braintree.hostedFields}},{key:"do_integration_ready",value:function(){var t=this;return this.integration.on("cardTypeChange",function(e){return t.on_card_type_change(e)}),!this.csc_required&&d("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(o.prototype.__proto__||Object.getPrototypeOf(o.prototype),"handle_saved_payment_methods",this).call(this),t=d("div.js-wc-braintree-credit-card-new-payment-method-form"),e=d("div.wc-braintree-hosted-field-card-csc-parent"),d("input.js-wc-braintree-credit-card-payment-token").change(function(){return d("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,a;if(i=[],"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=(a=e.details.invalidFieldKeys).length;t<n;t++)switch(a[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&&(r=e.details.originalError.error.message,/given name format is invalid/.test(r)&&i.push(this.params.first_name_unsupported_characters),/surname format is invalid/.test(r)&&i.push(this.params.last_name_unsupported_characters));return i.length?i.join("<br/>"):_get(o.prototype.__proto__||Object.getPrototypeOf(o.prototype),"get_user_message",this).call(this)}},{key:"on_card_type_change",value:function(e){var t,n,r;if(null!=e.cards)return(t=d("#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],d("input[name=wc-"+this.id_dasherized+"-card-type]").val(n.type),null!=n.type&&(r=n.type,0<=u.call(this.enabled_card_types,r))?t.addClass("card-type-"+n.type):t.addClass("card-type-invalid")):void 0:t.addClass("card-type-invalid")}},{key:"is_3d_secure_enabled",value:function(){return this.threeds.enabled&&null!=braintree.threeDSecure}},{key:"setup_integration",value:function(){var t=this;return this.threeds.enabled&&(this.threeds.enabled=this.client.getConfiguration().gatewayConfiguration.threeDSecureEnabled),this.is_3d_secure_enabled()?(d("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,d(document.body).on("click","#wc-braintree-credit-card-3dsecure-container",function(e){return d(e.currentTarget).fadeOut(200),t.threeDSecure.cancelVerifyCard(),t.unblock_ui()}),_get(o.prototype.__proto__||Object.getPrototypeOf(o.prototype),"setup_integration",t).call(t)}).catch(function(e){return t.handle_integration_error(e)})):_get(o.prototype.__proto__||Object.getPrototypeOf(o.prototype),"setup_integration",this).call(this)}},{key:"should_verify_3d_secure",value:function(e){var t;return t=e.details.cardType,this.is_3d_secure_enabled()&&"CreditCard"===e.type&&0<=u.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,i,a,o,_,s,u,c=this,l=2<arguments.length&&void 0!==n?n:null;return o=d("#billing_state").val(),a=d("#billing_country").val(),s=d("#shipping_state").val(),_=d("#shipping_country").val(),i=d("input[name=billing_first_name]").val()?{givenName:d("input[name=billing_first_name]").val().latinise(),surname:d("input[name=billing_last_name]").val().latinise(),phoneNumber:d("input[name=billing_phone]").val(),streetAddress:d("input[name=billing_address_1]").val(),extendedAddress:d("input[name=billing_address_2]").val(),locality:d("#billing_city").val(),region:"string"==typeof o&&o.length<=2?o:"",postalCode:d("input[name=billing_postcode]").val(),countryCodeAlpha2:"string"==typeof a&&a.length<=2?a:""}:{},r=d("input[name=shipping_first_name]").val()?{shippingGivenName:d("input[name=shipping_first_name]").val().latinise(),shippingSurname:d("input[name=shipping_last_name]").val().latinise(),shippingAddress:{streetAddress:d("input[name=shipping_address_1]").val(),extendedAddress:d("input[name=shipping_address_2]").val(),locality:d("input[name=shipping_city]").val(),region:"string"==typeof s&&s.length<=2?s:"",postalCode:d("input[name=shipping_postcode]").val(),countryCodeAlpha2:"string"==typeof _&&_.length<=2?_:""}}:{},u={nonce:e,amount:d("input[name=wc-"+this.id_dasherized+"-3d-secure-order-total]").val(),email:d("input[name=billing_email]").val(),billingAddress:i,additionalInformation:r,onLookupComplete:function(e,t){c.log("3D Secure lookup complete.",e);try{return t()}catch(e){return c.handle_payment_error(e)}}},"1"===d("input[name=wc-"+this.id_dasherized+"-cart-contains-subscription]").val()&&(u.challengeRequested=!0),this.log("Verifying 3D Secure.",u),this.threeDSecure.verifyCard(u).then(function(e){return c.log("3D Secure response received.",e),c.threeds.liability_shift_always_required&&!e.liabilityShifted?c.render_error(c.threeds.failure_message):(null!=l&&l.data("verified",!0),d("input[name=wc-"+c.id_dasherized+"-3d-secure-verified]").val(1),c.submit_form(e.nonce))}).catch(function(e){return c.handle_payment_error(e)})}},{key:"show_integration_ui",value:function(){return s(this,e),_get(o.prototype.__proto__||Object.getPrototypeOf(o.prototype),"show_integration_ui",this).call(this),d(".wc-braintree-hosted-field-parent").show()}},{key:"hide_integration_ui",value:function(){return s(this,e),_get(o.prototype.__proto__||Object.getPrototypeOf(o.prototype),"hide_integration_ui",this).call(this),d(".wc-braintree-hosted-field-parent").hide()}}]),o),n=window.WC_Braintree_PayPal_Payment_Form_Handler=(_inherits(i,WC_Braintree_Payment_Form_Handler),_createClass(i,[{key:"init",value:function(){var t=this;return _get(i.prototype.__proto__||Object.getPrototypeOf(i.prototype),"init",this).call(this),d("input[name=wc_"+this.id+"_payment_nonce]").val(this.cart_payment_nonce),d(document.body).on("click",'input[name="payment_method"], input.js-wc-braintree-paypal-payment-token',function(){return t.toggle_order_button()}),d(document.body).on("payment_method_selected",function(){return t.toggle_order_button()}),d(document.body).on("click",".wc-braintree-paypal-account .cancel",function(e){return e.preventDefault(),d(e.currentTarget).parent().remove(),t.setup_braintree()})}},{key:"toggle_order_button",value:function(){return!this.is_selected()||this.has_payment_nonce()||this.using_payment_token()?d("#place_order").show():d("#place_order").hide()}},{key:"verify_form",value:function(){var e;return e=_get(i.prototype.__proto__||Object.getPrototypeOf(i.prototype),"verify_form",this).call(this),this.has_payment_nonce()||this.using_payment_token()||this.render_error(this.must_login_message),e}},{key:"handle_payment_error",value:function(e){return _get(i.prototype.__proto__||Object.getPrototypeOf(i.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(i.prototype.__proto__||Object.getPrototypeOf(i.prototype),"setup_braintree",this).call(this),d("input.js-wc-braintree-paypal-tokenize-payment-method").prop("disabled",!1),this.toggle_order_button())}},{key:"do_integration_ready",value:function(){var e,t=this;return s(this,n),this.cart_payment_nonce?this.unblock_ui():(e=this.is_single_use()?"checkout":"vault",this.render_button(this.integration.createPayment({flow:e,amount:this.get_order_amount(),currency:this.get_store_currency(),locale:this.get_store_locale()}),this.get_button_styles(),"#wc_braintree_paypal_container").then(function(){return d("#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_button",value:function(e,t,n){var r,i,a=this;return d(n).html(""),r=this.is_paypal_credit_enabled&&"USD"===this.get_store_currency()?{allowed:[paypal.FUNDING.CREDIT]}:{disallowed:[paypal.FUNDING.CREDIT]},i={env:this.is_test_environment?"sandbox":"production",commit:this.button_is_pay_now(),style:t,funding:r,payment:function(){return e},onAuthorize:function(e,t){return a.on_authorize(e,t)},onError:function(e){return a.handle_integration_error(e)}},paypal.Button.render(i,n)}},{key:"button_is_pay_now",value:function(){return!d("form#add_payment_method").length}},{key:"get_button_styles",value:function(){return this.button_styles}},{key:"on_authorize",value:function(e){var t=this;return s(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 d("input[name=wc_"+this.id+"_payment_nonce]").val(e.nonce),d("#wc_braintree_paypal_container").html(this.get_linked_account_html(e.details)),this.is_single_use()&&d("input.js-wc-braintree-paypal-tokenize-payment-method").prop("disabled",!0),d("#place_order").show(),this.form.submit()}},{key:"handle_saved_payment_methods",value:function(){var t=this;return _get(i.prototype.__proto__||Object.getPrototypeOf(i.prototype),"handle_saved_payment_methods",this).call(this),d("input.js-wc-braintree-paypal-tokenize-payment-method").change(function(e){if(null!=t.integration&&d(e.target).is(":visible"))return t.block_ui(),t.do_integration_ready()}).change()}},{key:"get_linked_account_html",value:function(e){var t;return s(this,n),t=d("<div class='wc-"+this.id_dasherized+"-account'></div>"),null!=e.firstName&&null!=e.lastName&&t.append("<span class='name'>"+e.firstName+" "+e.lastName+"</span>"),t.append("<span class='email'>"+e.email+"</span>"),t.append("<a href='#' class='cancel'>Cancel</a>"),t}},{key:"is_single_use",value:function(){var e;return 0===(e=d("input[name=wc-braintree-paypal-tokenize-payment-method]")).length||("checkbox"===e.attr("type")?!e.is(":checked"):!e.val())}},{key:"get_order_amount",value:function(){return d("input[name=wc_braintree_paypal_amount]").val()}},{key:"get_store_currency",value:function(){return d("input[name=wc_braintree_paypal_currency]").val()}},{key:"get_store_locale",value:function(){return d("input[name=wc_braintree_paypal_locale]").val()}},{key:"is_sdk_ready",value:function(){return _get(i.prototype.__proto__||Object.getPrototypeOf(i.prototype),"is_sdk_ready",this).call(this)&&"undefined"!=typeof paypal&&null!==paypal}}]),i),window.WC_Braintree_PayPal_Cart_Handler=(_inherits(a,WC_Braintree_PayPal_Payment_Form_Handler),_createClass(a,[{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,d.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"===d("input[name=wc_braintree_paypal_single_use]").val()}},{key:"has_payment_nonce",value:function(){return!1}}]),a),r=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:d("form.cart"),is_variable:d("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&&d(document.body).on("woocommerce_variation_has_changed",this.validate_product_button),this.validate_product_button()}},{key:"do_integration_ready",value:function(){if(s(this,r),_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(s(this,r),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){return s(this,r),d.ajax({type:"POST",url:this.validate_product_url,data:{wp_nonce:this.validate_product_nonce,product_id:d("input[name=wc_braintree_paypal_product_id]").val(),cart_form:d("form.cart").serialize()}}).done(function(e){return(e.data.is_valid?t:n)()}).fail(n)}},{key:"hide_button",value:function(){return d("#wc_braintree_paypal_container").slideUp()}},{key:"show_button",value:function(){return d("#wc_braintree_paypal_container").slideDown()}},{key:"button_is_pay_now",value:function(){return!1}},{key:"set_payment_method",value:function(e){var t,n=this;if(null!=e.nonce)return(t=e).wp_nonce=this.product_checkout_nonce,t.product_id=d("input[name=wc_braintree_paypal_product_id]").val(),t.cart_form=d("form.cart").serialize(),d.ajax({type:"POST",url:this.product_checkout_url,data:t,dataType:"json"}).done(function(e){if(n.log("Cart response received.",e),null!=e.redirect_url)return window.location=e.redirect_url}).fail(function(e){return n.log("Error setting the PayPal cart data.",e,"error")}).always(function(){return n.unblock_ui()})}},{key:"is_single_use",value:function(){return"1"===d("input[name=wc_braintree_paypal_single_use]").val()}},{key:"has_payment_nonce",value:function(){return!1}}]),_);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.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=d("form.woocommerce-cart-form"),t.form_ui_selector="",t.is_product_page&&t.handle_product_page(),t.setup_braintree(),d(document.body).on("updated_cart_totals",function(){return t.setup_braintree()}),t}})}).call(void 0);
1
+ "use strict";var _get=function e(t,n,r){null===t&&(t=Function.prototype);var i=Object.getOwnPropertyDescriptor(t,n);if(void 0===i){var a=Object.getPrototypeOf(t);return null===a?void 0:e(a,n,r)}if("value"in i)return i.value;var o=i.get;return void 0!==o?o.call(r):void 0},_createClass=function(){function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(e,t,n){return t&&r(e.prototype,t),n&&r(e,n),e}}();function _possibleConstructorReturn(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function _inherits(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(function(){function s(e,t){if(!(e instanceof t))throw new Error("Bound instance method accessed before binding")}var u=[].indexOf;jQuery(document).ready(function(d){var e,n,r;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 o(e){_classCallCheck(this,o);var t=_possibleConstructorReturn(this,(o.__proto__||Object.getPrototypeOf(o)).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 i(e){_classCallCheck(this,i);var t=_possibleConstructorReturn(this,(i.__proto__||Object.getPrototypeOf(i)).call(this,e));return t.do_integration_ready=t.do_integration_ready.bind(t),t.on_authorize=t.on_authorize.bind(t),t.get_linked_account_html=t.get_linked_account_html.bind(t),t.is_test_environment=e.is_test_environment,t.is_paypal_credit_enabled=e.is_paypal_credit_enabled,t.must_login_message=e.must_login_message,t.must_login_add_method_message=e.must_login_add_method_message,t.button_styles=e.button_styles,t.cart_payment_nonce=e.cart_payment_nonce,t.init(),t}function a(e){_classCallCheck(this,a);var t=_possibleConstructorReturn(this,(a.__proto__||Object.getPrototypeOf(a)).call(this,e));return t.set_payment_method_nonce=e.set_payment_method_nonce,t.cart_handler_url=e.cart_handler_url,t.form=d("form.woocommerce-cart-form"),t.form_ui_selector="",t.setup_braintree(),d(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()?d("form.checkout").length?this.handle_checkout_page():d("form#order_review").length?this.handle_pay_page():d("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=d("form.checkout"),this.form_ui_selector=".woocommerce-checkout-payment",d(document.body).on("updated_checkout",function(){if(!e.setting_up)return e.setup_braintree()}),d(document.body).on("updated_checkout",function(){return e.handle_saved_payment_methods()}),d(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=d("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=d("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 d("input[name=wc_"+this.id+"_payment_nonce]").val(e),this.form.submit()}},{key:"handle_saved_payment_methods",value:function(){var n=this,e=d("div.js-wc-"+this.id_dasherized+"-new-payment-method-form");if(d("input.js-wc-"+this.id_dasherized+"-payment-token").change(function(){return d("input.js-wc-"+n.id_dasherized+"-payment-token:checked").val()?e.slideUp(200):e.slideDown(200)}).change(),d("input#createaccount").change(function(e){var t=d("input.js-wc-"+n.id_dasherized+"-tokenize-payment-method").closest("p.form-row");return d(e.target).is(":checked")?(t.slideDown(),t.next().show()):(t.hide(),t.next().hide())}),!d("input#createaccount").is(":checked"))return d("input#createaccount").change()}},{key:"setup_braintree",value:function(){if(!d("#wc-"+this.id_dasherized+"-account-number-hosted iframe").data("ready"))return this.setting_up=!0,this.block_ui(),d("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 d.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(),d("#wc-"+t.id_dasherized+"-account-number-hosted iframe").data("ready",!0),t.do_integration_ready(),d(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)return this.block_ui(),this.integration.teardown(function(){return e.integration=null,e.unblock_ui()})}},{key:"do_integration_ready",value:function(){}},{key:"get_integration_options",value:function(){return{client:this.client}}},{key:"get_integration_class",value:function(){}},{key:"handle_integration_error",value:function(e){return this.log("Integration error. "+e.message,e,"error"),this.hide_integration_ui(),this.unblock_ui()}},{key:"handle_payment_error",value:function(e){return this.log("Payment error. "+e.message,e,"error"),this.render_error(this.get_user_message(e)),this.unblock_ui()}},{key:"render_error",value:function(e){return d(".woocommerce-error, .woocommerce-message").remove(),this.form.prepend('<div class="woocommerce-error">'+e+"</div>").removeClass("processing").unblock(),d("html, body").animate({scrollTop:this.form.offset().top-100},1e3),d("input[name=wc_"+this.id+"_payment_nonce]").val(""),this.form.trigger("wc_"+this.id+"_rendered_error"),d(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(d("div.js-wc-"+this.id_dasherized+"-new-payment-method-form").find(".woocommerce-error").remove(),d("input#createaccount").length&&d("input#createaccount").is(":checked"))return d("div.js-wc-"+this.id_dasherized+"-new-payment-method-form").find(".form-row").show()}},{key:"hide_integration_ui",value:function(){return d("div.js-wc-"+this.id_dasherized+"-new-payment-method-form").prepend('<div class="woocommerce-error">'+this.integration_error_message+"</div>"),d("div.js-wc-"+this.id_dasherized+"-new-payment-method-form").find(".form-row").hide()}},{key:"block_ui",value:function(){return d(this.form_ui_selector).block({message:null,overlayCSS:{background:"#fff",opacity:.6}})}},{key:"unblock_ui",value:function(){return d(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,n){var r=1<arguments.length&&void 0!==t?t:null;if(this.debug)return console.log(this.name+": "+e),r?console.log(r):void 0}}]),t),e=window.WC_Braintree_Credit_Card_Payment_Form_Handler=(_inherits(o,WC_Braintree_Payment_Form_Handler),_createClass(o,[{key:"handle_checkout_error",value:function(){return _get(o.prototype.__proto__||Object.getPrototypeOf(o.prototype),"handle_checkout_error",this).call(this),d("input[name=wc_"+this.id+"_payment_nonce]").val(""),d("input[name=wc-"+this.id_dasherized+"-card-type]").val(""),d("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=d("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(o.prototype.__proto__||Object.getPrototypeOf(o.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:d("#wc-braintree-credit-card-account-number-hosted").data("placeholder")},cvv:{selector:"#wc-braintree-credit-card-csc-hosted",placeholder:d("#wc-braintree-credit-card-csc-hosted").data("placeholder")},expirationDate:{selector:"#wc-braintree-credit-card-expiry-hosted",placeholder:d("#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&&d("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(o.prototype.__proto__||Object.getPrototypeOf(o.prototype),"handle_saved_payment_methods",this).call(this),t=d("div.js-wc-braintree-credit-card-new-payment-method-form"),e=d("div.wc-braintree-hosted-field-card-csc-parent"),d("input.js-wc-braintree-credit-card-payment-token").change(function(){return d("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,a=[];if("CUSTOMER"===e.type)switch(e.code){case"HOSTED_FIELDS_FIELDS_EMPTY":this.csc_required&&a.push(this.params.cvv_missing),this.using_payment_token()||(a.push(this.params.card_number_missing),a.push(this.params.card_exp_date_invalid));break;case"HOSTED_FIELDS_FIELDS_INVALID":if(null!=e.details)for(t=0,n=(i=e.details.invalidFieldKeys).length;t<n;t++)switch(i[t]){case"number":a.push(this.params.card_number_invalid);break;case"cvv":a.push(this.params.cvv_length_invalid);break;case"expirationDate":a.push(this.params.card_exp_date_invalid)}}else"NETWORK"===e.type&&null!=e.details.originalError.error.message&&(r=e.details.originalError.error.message,/given name format is invalid/.test(r)&&a.push(this.params.first_name_unsupported_characters),/surname format is invalid/.test(r)&&a.push(this.params.last_name_unsupported_characters));return a.length?a.join("<br/>"):_get(o.prototype.__proto__||Object.getPrototypeOf(o.prototype),"get_user_message",this).call(this)}},{key:"on_card_type_change",value:function(e){var t,n,r;if(null!=e.cards)return(t=d("#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],d("input[name=wc-"+this.id_dasherized+"-card-type]").val(n.type),null!=n.type&&(r=n.type,0<=u.call(this.enabled_card_types,r))?t.addClass("card-type-"+n.type):t.addClass("card-type-invalid")):void 0:t.addClass("card-type-invalid")}},{key:"is_3d_secure_enabled",value:function(){return this.threeds.enabled&&null!=braintree.threeDSecure}},{key:"setup_integration",value:function(){var t=this;return this.threeds.enabled&&(this.threeds.enabled=this.client.getConfiguration().gatewayConfiguration.threeDSecureEnabled),this.is_3d_secure_enabled()?(d("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,d(document.body).on("click","#wc-braintree-credit-card-3dsecure-container",function(e){return d(e.currentTarget).fadeOut(200),t.threeDSecure.cancelVerifyCard(),t.unblock_ui()}),_get(o.prototype.__proto__||Object.getPrototypeOf(o.prototype),"setup_integration",t).call(t)}).catch(function(e){return t.handle_integration_error(e)})):_get(o.prototype.__proto__||Object.getPrototypeOf(o.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<=u.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=d("#billing_state").val(),o=d("#billing_country").val(),_=d("#shipping_state").val(),s=d("#shipping_country").val(),u=d("input[name=billing_first_name]").val()?{givenName:d("input[name=billing_first_name]").val().latinise(),surname:d("input[name=billing_last_name]").val().latinise(),phoneNumber:d("input[name=billing_phone]").val(),streetAddress:d("input[name=billing_address_1]").val(),extendedAddress:d("input[name=billing_address_2]").val(),locality:d("#billing_city").val(),region:"string"==typeof a&&a.length<=2?a:"",postalCode:d("input[name=billing_postcode]").val(),countryCodeAlpha2:"string"==typeof o&&o.length<=2?o:""}:{},c=d("input[name=shipping_first_name]").val()?{shippingGivenName:d("input[name=shipping_first_name]").val().latinise(),shippingSurname:d("input[name=shipping_last_name]").val().latinise(),shippingAddress:{streetAddress:d("input[name=shipping_address_1]").val(),extendedAddress:d("input[name=shipping_address_2]").val(),locality:d("input[name=shipping_city]").val(),region:"string"==typeof _&&_.length<=2?_:"",postalCode:d("input[name=shipping_postcode]").val(),countryCodeAlpha2:"string"==typeof s&&s.length<=2?s:""}}:{},l={nonce:e,amount:d("input[name=wc-"+this.id_dasherized+"-3d-secure-order-total]").val(),email:d("input[name=billing_email]").val(),billingAddress:u,additionalInformation:c,onLookupComplete:function(e,t){r.log("3D Secure lookup complete.",e);try{return t()}catch(e){return r.handle_payment_error(e)}}};return"1"===d("input[name=wc-"+this.id_dasherized+"-cart-contains-subscription]").val()&&(l.challengeRequested=!0),this.log("Verifying 3D Secure.",l),this.threeDSecure.verifyCard(l).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),d("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 s(this,e),_get(o.prototype.__proto__||Object.getPrototypeOf(o.prototype),"show_integration_ui",this).call(this),d(".wc-braintree-hosted-field-parent").show()}},{key:"hide_integration_ui",value:function(){return s(this,e),_get(o.prototype.__proto__||Object.getPrototypeOf(o.prototype),"hide_integration_ui",this).call(this),d(".wc-braintree-hosted-field-parent").hide()}}]),o),n=window.WC_Braintree_PayPal_Payment_Form_Handler=(_inherits(i,WC_Braintree_Payment_Form_Handler),_createClass(i,[{key:"init",value:function(){var t=this;return _get(i.prototype.__proto__||Object.getPrototypeOf(i.prototype),"init",this).call(this),d("input[name=wc_"+this.id+"_payment_nonce]").val(this.cart_payment_nonce),d(document.body).on("click",'input[name="payment_method"], input.js-wc-braintree-paypal-payment-token',function(){return t.toggle_order_button()}),d(document.body).on("payment_method_selected",function(){return t.toggle_order_button()}),d(document.body).on("click",".wc-braintree-paypal-account .cancel",function(e){return e.preventDefault(),d(e.currentTarget).parent().remove(),t.setup_braintree()})}},{key:"toggle_order_button",value:function(){return!this.is_selected()||this.has_payment_nonce()||this.using_payment_token()?d("#place_order").show():d("#place_order").hide()}},{key:"verify_form",value:function(){var e=_get(i.prototype.__proto__||Object.getPrototypeOf(i.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(i.prototype.__proto__||Object.getPrototypeOf(i.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(i.prototype.__proto__||Object.getPrototypeOf(i.prototype),"setup_braintree",this).call(this),d("input.js-wc-braintree-paypal-tokenize-payment-method").prop("disabled",!1),this.toggle_order_button())}},{key:"do_integration_ready",value:function(){var e,t=this;return s(this,n),this.cart_payment_nonce?this.unblock_ui():(e=this.is_single_use()?"checkout":"vault",this.render_button(this.integration.createPayment({flow:e,amount:this.get_order_amount(),currency:this.get_store_currency(),locale:this.get_store_locale()}),this.get_button_styles(),"#wc_braintree_paypal_container").then(function(){return d("#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_button",value:function(e,t,n){var r,i,a=this;return d(n).html(""),r=this.is_paypal_credit_enabled&&"USD"===this.get_store_currency()?{allowed:[paypal.FUNDING.CREDIT]}:{disallowed:[paypal.FUNDING.CREDIT]},i={env:this.is_test_environment?"sandbox":"production",commit:this.button_is_pay_now(),style:t,funding:r,payment:function(){return e},onAuthorize:function(e,t){return a.on_authorize(e,t)},onError:function(e){return a.handle_integration_error(e)}},paypal.Button.render(i,n)}},{key:"button_is_pay_now",value:function(){return!d("form#add_payment_method").length}},{key:"get_button_styles",value:function(){return this.button_styles}},{key:"on_authorize",value:function(e){var t=this;return s(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 d("input[name=wc_"+this.id+"_payment_nonce]").val(e.nonce),d("#wc_braintree_paypal_container").html(this.get_linked_account_html(e.details)),this.is_single_use()&&d("input.js-wc-braintree-paypal-tokenize-payment-method").prop("disabled",!0),d("#place_order").show(),this.form.submit()}},{key:"handle_saved_payment_methods",value:function(){var t=this;return _get(i.prototype.__proto__||Object.getPrototypeOf(i.prototype),"handle_saved_payment_methods",this).call(this),d("input.js-wc-braintree-paypal-tokenize-payment-method").change(function(e){if(null!=t.integration&&d(e.target).is(":visible"))return t.block_ui(),t.do_integration_ready()}).change()}},{key:"get_linked_account_html",value:function(e){var t;return s(this,n),t=d("<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=d("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 d("input[name=wc_braintree_paypal_amount]").val()}},{key:"get_store_currency",value:function(){return d("input[name=wc_braintree_paypal_currency]").val()}},{key:"get_store_locale",value:function(){return d("input[name=wc_braintree_paypal_locale]").val()}},{key:"is_sdk_ready",value:function(){return _get(i.prototype.__proto__||Object.getPrototypeOf(i.prototype),"is_sdk_ready",this).call(this)&&"undefined"!=typeof paypal&&null!==paypal}}]),i),window.WC_Braintree_PayPal_Cart_Handler=(_inherits(a,WC_Braintree_PayPal_Payment_Form_Handler),_createClass(a,[{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,d.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"===d("input[name=wc_braintree_paypal_single_use]").val()}},{key:"has_payment_nonce",value:function(){return!1}}]),a),r=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:d("form.cart"),is_variable:d("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&&d(document.body).on("woocommerce_variation_has_changed",this.validate_product_button),this.validate_product_button()}},{key:"do_integration_ready",value:function(){if(s(this,r),_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(s(this,r),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){return s(this,r),d.ajax({type:"POST",url:this.validate_product_url,data:{wp_nonce:this.validate_product_nonce,product_id:d("input[name=wc_braintree_paypal_product_id]").val(),cart_form:d("form.cart").serialize()}}).done(function(e){return(e.data.is_valid?t:n)()}).fail(n)}},{key:"hide_button",value:function(){return d("#wc_braintree_paypal_container").slideUp()}},{key:"show_button",value:function(){return d("#wc_braintree_paypal_container").slideDown()}},{key:"button_is_pay_now",value:function(){return!1}},{key:"set_payment_method",value:function(e){var t,n=this;if(null!=e.nonce)return(t=e).wp_nonce=this.product_checkout_nonce,t.product_id=d("input[name=wc_braintree_paypal_product_id]").val(),t.cart_form=d("form.cart").serialize(),d.ajax({type:"POST",url:this.product_checkout_url,data:t,dataType:"json"}).done(function(e){if(n.log("Cart response received.",e),null!=e.redirect_url)return window.location=e.redirect_url}).fail(function(e){return n.log("Error setting the PayPal cart data.",e,"error")}).always(function(){return n.unblock_ui()})}},{key:"is_single_use",value:function(){return"1"===d("input[name=wc_braintree_paypal_single_use]").val()}},{key:"has_payment_nonce",value:function(){return!1}}]),_);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.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=d("form.woocommerce-cart-form"),t.form_ui_selector="",t.is_product_page&&t.handle_product_page(),t.setup_braintree(),d(document.body).on("updated_cart_totals",function(){return t.setup_braintree()}),t}})}).call(void 0);
class-wc-braintree.php CHANGED
@@ -88,7 +88,7 @@ class WC_Braintree extends WC_Braintree_Framework\SV_WC_Payment_Gateway_Plugin {
88
 
89
 
90
  /** plugin version number */
91
- const VERSION = '2.3.10';
92
 
93
  /** Braintree JS SDK version */
94
  const BRAINTREE_JS_SDK_VERSION = '3.48.0';
88
 
89
 
90
  /** plugin version number */
91
+ const VERSION = '2.3.11';
92
 
93
  /** Braintree JS SDK version */
94
  const BRAINTREE_JS_SDK_VERSION = '3.48.0';
i18n/languages/woocommerce-gateway-paypal-powered-by-braintree.pot CHANGED
@@ -2,10 +2,10 @@
2
  # This file is distributed under the same license as the WooCommerce PayPal Powered by Braintree Gateway package.
3
  msgid ""
4
  msgstr ""
5
- "Project-Id-Version: WooCommerce PayPal Powered by Braintree Gateway 2.3.10\n"
6
  "Report-Msgid-Bugs-To: "
7
  "https://woocommerce.com/my-account/marketplace-ticket-form/\n"
8
- "POT-Creation-Date: 2020-05-05 03:28:45+00:00\n"
9
  "MIME-Version: 1.0\n"
10
  "Content-Type: text/plain; charset=utf-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
@@ -85,6 +85,7 @@ msgid "Configure PayPal"
85
  msgstr ""
86
 
87
  #: includes/PayPal/Buttons/Abstract_Button.php:510
 
88
  msgid "Cancel"
89
  msgstr ""
90
 
@@ -261,7 +262,7 @@ msgid ""
261
  msgstr ""
262
 
263
  #: includes/class-wc-gateway-braintree-credit-card.php:958
264
- #: includes/class-wc-gateway-braintree.php:157
265
  msgid ""
266
  "Oops, there was a temporary payment error. Please try another payment "
267
  "method or contact us to complete your transaction."
@@ -383,7 +384,7 @@ msgid "%1$s %2$s %3$s Approved"
383
  msgstr ""
384
 
385
  #: includes/class-wc-gateway-braintree-paypal.php:538
386
- #: includes/class-wc-gateway-braintree.php:1336
387
  msgid "Sandbox"
388
  msgstr ""
389
 
@@ -414,69 +415,69 @@ msgid ""
414
  "securely."
415
  msgstr ""
416
 
417
- #: includes/class-wc-gateway-braintree.php:327
418
  msgid "Merchant ID"
419
  msgstr ""
420
 
421
- #: includes/class-wc-gateway-braintree.php:330
422
  msgid "The Merchant ID for your Braintree account."
423
  msgstr ""
424
 
425
- #: includes/class-wc-gateway-braintree.php:334
426
  msgid "Public Key"
427
  msgstr ""
428
 
429
- #: includes/class-wc-gateway-braintree.php:337
430
  msgid "The Public Key for your Braintree account."
431
  msgstr ""
432
 
433
- #: includes/class-wc-gateway-braintree.php:341
434
  msgid "Private Key"
435
  msgstr ""
436
 
437
- #: includes/class-wc-gateway-braintree.php:344
438
  msgid "The Private Key for your Braintree account."
439
  msgstr ""
440
 
441
- #: includes/class-wc-gateway-braintree.php:349
442
  msgid "Sandbox Merchant ID"
443
  msgstr ""
444
 
445
- #: includes/class-wc-gateway-braintree.php:352
446
  msgid "The Merchant ID for your Braintree sandbox account."
447
  msgstr ""
448
 
449
- #: includes/class-wc-gateway-braintree.php:356
450
  msgid "Sandbox Public Key"
451
  msgstr ""
452
 
453
- #: includes/class-wc-gateway-braintree.php:359
454
  msgid "The Public Key for your Braintree sandbox account."
455
  msgstr ""
456
 
457
- #: includes/class-wc-gateway-braintree.php:363
458
  msgid "Sandbox Private Key"
459
  msgstr ""
460
 
461
- #: includes/class-wc-gateway-braintree.php:366
462
  msgid "The Private Key for your Braintree sandbox account."
463
  msgstr ""
464
 
465
- #: includes/class-wc-gateway-braintree.php:371
466
  msgid "Merchant Account IDs"
467
  msgstr ""
468
 
469
- #: includes/class-wc-gateway-braintree.php:374
470
  msgid ""
471
  "Enter additional merchant account IDs if you do not want to use your "
472
  "Braintree account default. %1$sLearn more about merchant account IDs%2$s"
473
  msgstr ""
474
 
475
- #: includes/class-wc-gateway-braintree.php:383
476
  msgid "Dynamic Descriptors"
477
  msgstr ""
478
 
479
- #: includes/class-wc-gateway-braintree.php:386
480
  #. translators: Placeholders: %1$s - <p> tag, %2$s - </p> tag, %3$s - <a> tag,
481
  #. %4$s - </a> tag
482
  msgid ""
@@ -486,11 +487,11 @@ msgid ""
486
  "dynamic descriptors%4$s and are using an accepted format.%2$s"
487
  msgstr ""
488
 
489
- #: includes/class-wc-gateway-braintree.php:390
490
  msgid "Name"
491
  msgstr ""
492
 
493
- #: includes/class-wc-gateway-braintree.php:393
494
  msgid ""
495
  "The value in the business name field of a customer's statement. Company "
496
  "name/DBA section must be either 3, 7 or 12 characters and the product "
@@ -498,81 +499,101 @@ msgid ""
498
  "between for a total descriptor name of 22 characters)."
499
  msgstr ""
500
 
501
- #: includes/class-wc-gateway-braintree.php:398
502
  msgid "Phone"
503
  msgstr ""
504
 
505
- #: includes/class-wc-gateway-braintree.php:401
506
  msgid ""
507
  "The value in the phone number field of a customer's statement. Phone must "
508
  "be exactly 10 characters and can only contain numbers, dashes, parentheses "
509
  "and periods."
510
  msgstr ""
511
 
512
- #: includes/class-wc-gateway-braintree.php:406
513
  msgid "URL"
514
  msgstr ""
515
 
516
- #: includes/class-wc-gateway-braintree.php:409
517
  msgid ""
518
  "The value in the URL/web address field of a customer's statement. The URL "
519
  "must be 13 characters or less."
520
  msgstr ""
521
 
522
- #: includes/class-wc-gateway-braintree.php:442
523
  msgid "Enter connection credentials manually"
524
  msgstr ""
525
 
526
- #: includes/class-wc-gateway-braintree.php:466
527
- msgid "Disabled because the other gateway is not connected manually."
528
  msgstr ""
529
 
530
- #: includes/class-wc-gateway-braintree.php:485
531
  msgid ""
532
  "You just connected your Braintree account to WooCommerce. You can start "
533
  "taking payments now."
534
  msgstr ""
535
 
536
- #: includes/class-wc-gateway-braintree.php:486
537
  msgid ""
538
  "Once you have processed a payment, PayPal will review your application for "
539
  "final approval. Before you ship any goods make sure you have received a "
540
  "final approval for your Braintree account."
541
  msgstr ""
542
 
543
- #: includes/class-wc-gateway-braintree.php:487
544
  msgid "Questions? We are a phone call away: 1-855-489-0345."
545
  msgstr ""
546
 
547
- #: includes/class-wc-gateway-braintree.php:492
548
- msgid "Click button to create an account with Braintree and start transacting."
 
 
 
 
 
 
 
 
549
  msgstr ""
550
 
551
- #: includes/class-wc-gateway-braintree.php:606
 
 
 
 
 
 
 
 
 
 
 
 
552
  msgid "Add merchant account ID for %s"
553
  msgstr ""
554
 
555
- #: includes/class-wc-gateway-braintree.php:613
556
  msgid "Add merchant account ID"
557
  msgstr ""
558
 
559
- #: includes/class-wc-gateway-braintree.php:712
560
  msgid "Add merchant account ID for "
561
  msgstr ""
562
 
563
- #: includes/class-wc-gateway-braintree.php:810
564
  msgid "Merchant Account ID (%s)"
565
  msgstr ""
566
 
567
- #: includes/class-wc-gateway-braintree.php:821
568
  msgid "Enter merchant account ID"
569
  msgstr ""
570
 
571
- #: includes/class-wc-gateway-braintree.php:822
572
  msgid "Remove this merchant account ID"
573
  msgstr ""
574
 
575
- #: includes/class-wc-gateway-braintree.php:1336
576
  msgid "Production"
577
  msgstr ""
578
 
@@ -600,18 +621,6 @@ msgid ""
600
  "before adding your payment method."
601
  msgstr ""
602
 
603
- #: includes/views/admin-html-braintree-auth.php:32
604
- msgid "Connect/Disconnect"
605
- msgstr ""
606
-
607
- #: includes/views/admin-html-braintree-auth.php:40
608
- msgid "Disconnect from PayPal Powered by Braintree"
609
- msgstr ""
610
-
611
- #: includes/views/admin-html-braintree-auth.php:48
612
- msgid "Not ready to accept live payments? Click here to connect using sandbox mode."
613
- msgstr ""
614
-
615
  #: woocommerce-gateway-paypal-powered-by-braintree.php:118
616
  msgid ""
617
  "WooCommerce PayPal powered by Braintree is inactive. Please deactivate the "
2
  # This file is distributed under the same license as the WooCommerce PayPal Powered by Braintree Gateway package.
3
  msgid ""
4
  msgstr ""
5
+ "Project-Id-Version: WooCommerce PayPal Powered by Braintree Gateway 2.3.11\n"
6
  "Report-Msgid-Bugs-To: "
7
  "https://woocommerce.com/my-account/marketplace-ticket-form/\n"
8
+ "POT-Creation-Date: 2020-06-03 21:19:24+00:00\n"
9
  "MIME-Version: 1.0\n"
10
  "Content-Type: text/plain; charset=utf-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
85
  msgstr ""
86
 
87
  #: includes/PayPal/Buttons/Abstract_Button.php:510
88
+ #: includes/class-wc-gateway-braintree.php:565
89
  msgid "Cancel"
90
  msgstr ""
91
 
262
  msgstr ""
263
 
264
  #: includes/class-wc-gateway-braintree-credit-card.php:958
265
+ #: includes/class-wc-gateway-braintree.php:188
266
  msgid ""
267
  "Oops, there was a temporary payment error. Please try another payment "
268
  "method or contact us to complete your transaction."
384
  msgstr ""
385
 
386
  #: includes/class-wc-gateway-braintree-paypal.php:538
387
+ #: includes/class-wc-gateway-braintree.php:1427
388
  msgid "Sandbox"
389
  msgstr ""
390
 
415
  "securely."
416
  msgstr ""
417
 
418
+ #: includes/class-wc-gateway-braintree.php:358
419
  msgid "Merchant ID"
420
  msgstr ""
421
 
422
+ #: includes/class-wc-gateway-braintree.php:361
423
  msgid "The Merchant ID for your Braintree account."
424
  msgstr ""
425
 
426
+ #: includes/class-wc-gateway-braintree.php:365
427
  msgid "Public Key"
428
  msgstr ""
429
 
430
+ #: includes/class-wc-gateway-braintree.php:368
431
  msgid "The Public Key for your Braintree account."
432
  msgstr ""
433
 
434
+ #: includes/class-wc-gateway-braintree.php:372
435
  msgid "Private Key"
436
  msgstr ""
437
 
438
+ #: includes/class-wc-gateway-braintree.php:375
439
  msgid "The Private Key for your Braintree account."
440
  msgstr ""
441
 
442
+ #: includes/class-wc-gateway-braintree.php:380
443
  msgid "Sandbox Merchant ID"
444
  msgstr ""
445
 
446
+ #: includes/class-wc-gateway-braintree.php:383
447
  msgid "The Merchant ID for your Braintree sandbox account."
448
  msgstr ""
449
 
450
+ #: includes/class-wc-gateway-braintree.php:387
451
  msgid "Sandbox Public Key"
452
  msgstr ""
453
 
454
+ #: includes/class-wc-gateway-braintree.php:390
455
  msgid "The Public Key for your Braintree sandbox account."
456
  msgstr ""
457
 
458
+ #: includes/class-wc-gateway-braintree.php:394
459
  msgid "Sandbox Private Key"
460
  msgstr ""
461
 
462
+ #: includes/class-wc-gateway-braintree.php:397
463
  msgid "The Private Key for your Braintree sandbox account."
464
  msgstr ""
465
 
466
+ #: includes/class-wc-gateway-braintree.php:402
467
  msgid "Merchant Account IDs"
468
  msgstr ""
469
 
470
+ #: includes/class-wc-gateway-braintree.php:405
471
  msgid ""
472
  "Enter additional merchant account IDs if you do not want to use your "
473
  "Braintree account default. %1$sLearn more about merchant account IDs%2$s"
474
  msgstr ""
475
 
476
+ #: includes/class-wc-gateway-braintree.php:414
477
  msgid "Dynamic Descriptors"
478
  msgstr ""
479
 
480
+ #: includes/class-wc-gateway-braintree.php:417
481
  #. translators: Placeholders: %1$s - <p> tag, %2$s - </p> tag, %3$s - <a> tag,
482
  #. %4$s - </a> tag
483
  msgid ""
487
  "dynamic descriptors%4$s and are using an accepted format.%2$s"
488
  msgstr ""
489
 
490
+ #: includes/class-wc-gateway-braintree.php:421
491
  msgid "Name"
492
  msgstr ""
493
 
494
+ #: includes/class-wc-gateway-braintree.php:424
495
  msgid ""
496
  "The value in the business name field of a customer's statement. Company "
497
  "name/DBA section must be either 3, 7 or 12 characters and the product "
499
  "between for a total descriptor name of 22 characters)."
500
  msgstr ""
501
 
502
+ #: includes/class-wc-gateway-braintree.php:429
503
  msgid "Phone"
504
  msgstr ""
505
 
506
+ #: includes/class-wc-gateway-braintree.php:432
507
  msgid ""
508
  "The value in the phone number field of a customer's statement. Phone must "
509
  "be exactly 10 characters and can only contain numbers, dashes, parentheses "
510
  "and periods."
511
  msgstr ""
512
 
513
+ #: includes/class-wc-gateway-braintree.php:437
514
  msgid "URL"
515
  msgstr ""
516
 
517
+ #: includes/class-wc-gateway-braintree.php:440
518
  msgid ""
519
  "The value in the URL/web address field of a customer's statement. The URL "
520
  "must be 13 characters or less."
521
  msgstr ""
522
 
523
+ #: includes/class-wc-gateway-braintree.php:480
524
  msgid "Enter connection credentials manually"
525
  msgstr ""
526
 
527
+ #: includes/class-wc-gateway-braintree.php:522
528
+ msgid "Connect/Disconnect"
529
  msgstr ""
530
 
531
+ #: includes/class-wc-gateway-braintree.php:526
532
  msgid ""
533
  "You just connected your Braintree account to WooCommerce. You can start "
534
  "taking payments now."
535
  msgstr ""
536
 
537
+ #: includes/class-wc-gateway-braintree.php:527
538
  msgid ""
539
  "Once you have processed a payment, PayPal will review your application for "
540
  "final approval. Before you ship any goods make sure you have received a "
541
  "final approval for your Braintree account."
542
  msgstr ""
543
 
544
+ #: includes/class-wc-gateway-braintree.php:528
545
  msgid "Questions? We are a phone call away: 1-855-489-0345."
546
  msgstr ""
547
 
548
+ #: includes/class-wc-gateway-braintree.php:539
549
+ msgid "Disconnect from PayPal Powered by Braintree"
550
+ msgstr ""
551
+
552
+ #: includes/class-wc-gateway-braintree.php:549
553
+ msgid "PayPal Powered by Braintree"
554
+ msgstr ""
555
+
556
+ #: includes/class-wc-gateway-braintree.php:551
557
+ msgid "Close modal panel and cancel"
558
  msgstr ""
559
 
560
+ #: includes/class-wc-gateway-braintree.php:557
561
+ #. translators: Placeholders %1$s - opening HTML <a> link tag, closing HTML
562
+ #. </a> link tag
563
+ msgid ""
564
+ "Heads up! Once you disconnect, you'll need to use your %1$sBraintree API "
565
+ "keys%2$s to reconnect. Do you want to proceed with disconnecting?"
566
+ msgstr ""
567
+
568
+ #: includes/class-wc-gateway-braintree.php:569
569
+ msgid "Disconnect"
570
+ msgstr ""
571
+
572
+ #: includes/class-wc-gateway-braintree.php:699
573
  msgid "Add merchant account ID for %s"
574
  msgstr ""
575
 
576
+ #: includes/class-wc-gateway-braintree.php:706
577
  msgid "Add merchant account ID"
578
  msgstr ""
579
 
580
+ #: includes/class-wc-gateway-braintree.php:803
581
  msgid "Add merchant account ID for "
582
  msgstr ""
583
 
584
+ #: includes/class-wc-gateway-braintree.php:901
585
  msgid "Merchant Account ID (%s)"
586
  msgstr ""
587
 
588
+ #: includes/class-wc-gateway-braintree.php:912
589
  msgid "Enter merchant account ID"
590
  msgstr ""
591
 
592
+ #: includes/class-wc-gateway-braintree.php:913
593
  msgid "Remove this merchant account ID"
594
  msgstr ""
595
 
596
+ #: includes/class-wc-gateway-braintree.php:1427
597
  msgid "Production"
598
  msgstr ""
599
 
621
  "before adding your payment method."
622
  msgstr ""
623
 
 
 
 
 
 
 
 
 
 
 
 
 
624
  #: woocommerce-gateway-paypal-powered-by-braintree.php:118
625
  msgid ""
626
  "WooCommerce PayPal powered by Braintree is inactive. Please deactivate the "
includes/class-wc-gateway-braintree.php CHANGED
@@ -79,6 +79,37 @@ class WC_Gateway_Braintree extends WC_Braintree_Framework\SV_WC_Payment_Gateway_
79
  protected $shared_settings_names = array( 'public_key', 'private_key', 'merchant_id', 'sandbox_public_key', 'sandbox_private_key', 'sandbox_merchant_id', 'name_dynamic_descriptor' );
80
 
81
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
82
  /**
83
  * Loads the plugin configuration settings
84
  *
@@ -417,6 +448,7 @@ class WC_Gateway_Braintree extends WC_Braintree_Framework\SV_WC_Payment_Gateway_
417
  * Adds the shared settings form fields.
418
  *
419
  * @since 2.0.0
 
420
  * @param array $form_fields
421
  * @return array
422
  */
@@ -431,39 +463,29 @@ class WC_Gateway_Braintree extends WC_Braintree_Framework\SV_WC_Payment_Gateway_
431
  return $form_fields;
432
  }
433
 
434
- // used to move the environment field below
435
- $environment_field = $form_fields['environment'];
436
- unset( $form_fields['environment'] );
437
-
438
- $form_fields = WC_Braintree_Framework\SV_WC_Helper::array_insert_after( $form_fields, 'connection_settings', array(
439
- 'braintree_auth' => array( 'type' => 'braintree_auth' ),
440
- 'connect_manually' => array(
441
- 'type' => 'checkbox',
442
- 'label' => __( 'Enter connection credentials manually', 'woocommerce-gateway-paypal-powered-by-braintree' ),
443
- 'default' => ( ! $this->get_option( 'connect_manually' ) && $this->is_connected_manually() ) ? 'yes' : 'no',
444
- ),
445
- 'environment' => $environment_field,
446
- ) );
447
-
448
- // get any sibling gateways
449
- $other_gateway_ids = array_diff( $this->get_plugin()->get_gateway_ids(), array( $this->get_id() ) );
450
- $connect_manually_other_gateway_ids = array();
451
-
452
- // determine if any sibling gateways have configured manual connection
453
- foreach ( $other_gateway_ids as $other_gateway_id ) {
454
 
455
- $other_gateway_settings = $this->get_plugin()->get_gateway_settings( $other_gateway_id );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
456
 
457
- // add the gateway to the list if manual connection is set
458
- if ( isset( $other_gateway_settings['connect_manually'] ) && 'yes' === $other_gateway_settings['connect_manually'] ) {
459
- $connect_manually_other_gateway_ids[] = $other_gateway_id;
460
- }
461
- }
462
 
463
- // if no sibling gateways are manually connected, disable the inherit settings checkbox
464
- if ( empty( $connect_manually_other_gateway_ids ) ) {
465
- $form_fields['inherit_settings']['disabled'] = true;
466
- $form_fields['inherit_settings']['description'] = __( 'Disabled because the other gateway is not connected manually.', 'woocommerce-gateway' );
467
  }
468
 
469
  return $form_fields;
@@ -473,36 +495,107 @@ class WC_Gateway_Braintree extends WC_Braintree_Framework\SV_WC_Payment_Gateway_
473
  /**
474
  * Generates the Braintree Auth connection HTML.
475
  *
 
 
 
 
 
476
  * @since 2.0.0
477
- * @return string
 
 
478
  */
479
  public function generate_braintree_auth_html() {
480
 
481
- if ( $this->is_connected() ) {
 
 
 
482
 
483
- $help_tip = sprintf(
484
- '%s<br><br>%s<br><br>%s',
485
- __( 'You just connected your Braintree account to WooCommerce. You can start taking payments now.', 'woocommerce-gateway-paypal-powered-by-braintree' ),
486
- __( 'Once you have processed a payment, PayPal will review your application for final approval. Before you ship any goods make sure you have received a final approval for your Braintree account.', 'woocommerce-gateway-paypal-powered-by-braintree' ),
487
- __( 'Questions? We are a phone call away: 1-855-489-0345.', 'woocommerce-gateway-paypal-powered-by-braintree' )
488
- );
489
 
490
- } else {
 
 
 
491
 
492
- $help_tip = __( 'Click button to create an account with Braintree and start transacting.', 'woocommerce-gateway-paypal-powered-by-braintree' );
493
- }
494
 
495
- $button_image_url = $this->get_plugin()->get_plugin_url() . '/assets/images/button/connect-braintree.png';
496
- $is_connected = $this->is_connected();
497
- $connect_url = $this->get_connect_url();
498
- $sandbox_connect_url = $this->get_connect_url( self::ENVIRONMENT_SANDBOX );
499
- $disconnect_url = $this->get_disconnect_url();
 
500
 
501
- ob_start();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
502
 
503
- include( $this->get_plugin()->get_plugin_path() . '/includes/views/admin-html-braintree-auth.php' );
 
 
504
 
505
- return ob_get_clean();
 
 
 
 
 
 
 
 
506
  }
507
 
508
 
@@ -650,6 +743,7 @@ class WC_Gateway_Braintree extends WC_Braintree_Framework\SV_WC_Payment_Gateway_
650
  public function admin_options() {
651
 
652
  parent::admin_options();
 
653
  ?>
654
  <style type="text/css">
655
 
@@ -664,10 +758,8 @@ class WC_Gateway_Braintree extends WC_Braintree_Framework\SV_WC_Payment_Gateway_
664
  }
665
 
666
  </style>
667
- <?php
668
 
669
- ob_start();
670
- ?>
671
 
672
  $( document.body ).on( 'click', '.wc-braintree-auth.disabled .wc-braintree-connect-button', function( e ) {
673
  e.preventDefault();
@@ -681,7 +773,6 @@ class WC_Gateway_Braintree extends WC_Braintree_Framework\SV_WC_Payment_Gateway_
681
  $( '#woocommerce_<?php echo esc_js( $this->get_id() ); ?>_connect_manually' ).change( function() {
682
 
683
  var $environment = $( '#woocommerce_<?php echo esc_js( $this->get_id() ); ?>_environment' ).val();
684
-
685
  var $environmentFields = $( '.' + $environment + '-field' );
686
 
687
  if ( $( this ).is( ':checked' ) ) {
79
  protected $shared_settings_names = array( 'public_key', 'private_key', 'merchant_id', 'sandbox_public_key', 'sandbox_private_key', 'sandbox_merchant_id', 'name_dynamic_descriptor' );
80
 
81
 
82
+ /**
83
+ * WC_Gateway_Braintree constructor.
84
+ *
85
+ * @param string $id the gateway id
86
+ * @param WC_Braintree_Framework\SV_WC_Payment_Gateway_Plugin $plugin the parent plugin class
87
+ * @param array $args gateway arguments
88
+ */
89
+ public function __construct( $id, $plugin, $args ) {
90
+
91
+ parent::__construct( $id, $plugin, $args );
92
+
93
+ add_action( 'admin_enqueue_scripts', [ $this, 'enqueue_admin_scripts'] );
94
+ }
95
+
96
+
97
+ /**
98
+ * Enqueues admin scripts.
99
+ *
100
+ * @internal
101
+ *
102
+ * @since 2.3.11
103
+ */
104
+ public function enqueue_admin_scripts() {
105
+
106
+ if ( $this->get_plugin()->is_plugin_settings() ) {
107
+
108
+ wp_enqueue_script( 'wc-backbone-modal', null, [ 'backbone' ] );
109
+ }
110
+ }
111
+
112
+
113
  /**
114
  * Loads the plugin configuration settings
115
  *
448
  * Adds the shared settings form fields.
449
  *
450
  * @since 2.0.0
451
+ *
452
  * @param array $form_fields
453
  * @return array
454
  */
463
  return $form_fields;
464
  }
465
 
466
+ // only show this option when connected via auth flow
467
+ if ( $this->is_connected() && ! $this->is_connected_manually() ) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
468
 
469
+ // used to move the environment field below
470
+ $environment_field = $form_fields['environment'];
471
+ unset( $form_fields['environment'] );
472
+
473
+ $form_fields = WC_Braintree_Framework\SV_WC_Helper::array_insert_after( $form_fields, 'connection_settings', [
474
+ 'braintree_auth' => [
475
+ /** @see \WC_Gateway_Braintree::generate_braintree_auth_html() */
476
+ 'type' => 'braintree_auth'
477
+ ],
478
+ 'connect_manually' => [
479
+ 'type' => 'checkbox',
480
+ 'label' => __( 'Enter connection credentials manually', 'woocommerce-gateway-paypal-powered-by-braintree' ),
481
+ 'default' => 'no',
482
+ ],
483
+ 'environment' => $environment_field,
484
+ ] );
485
 
486
+ } else {
 
 
 
 
487
 
488
+ $this->connect_manually = true;
 
 
 
489
  }
490
 
491
  return $form_fields;
495
  /**
496
  * Generates the Braintree Auth connection HTML.
497
  *
498
+ * This method will be phased out as the manual connection is the preferred setup method.
499
+ * @see \WC_Gateway_Braintree::add_shared_settings_form_fields()
500
+ *
501
+ * @internal
502
+ *
503
  * @since 2.0.0
504
+ * @deprecated since 2.3.11
505
+ *
506
+ * @return string HTML
507
  */
508
  public function generate_braintree_auth_html() {
509
 
510
+ // no long connect via auth for new merchants or merchants that have already connected manually
511
+ if ( ! $this->is_connected() || $this->is_connected_manually() ) {
512
+ return '';
513
+ }
514
 
515
+ ob_start();
 
 
 
 
 
516
 
517
+ ?>
518
+ <tr class="wc-braintree-auth">
519
+ <th>
520
+ <?php
521
 
522
+ esc_html_e( 'Connect/Disconnect', 'woocommerce-gateway-paypal-powered-by-braintree' );
 
523
 
524
+ echo wc_help_tip( sprintf(
525
+ '%s<br><br>%s<br><br>%s',
526
+ __( 'You just connected your Braintree account to WooCommerce. You can start taking payments now.', 'woocommerce-gateway-paypal-powered-by-braintree' ),
527
+ __( 'Once you have processed a payment, PayPal will review your application for final approval. Before you ship any goods make sure you have received a final approval for your Braintree account.', 'woocommerce-gateway-paypal-powered-by-braintree' ),
528
+ __( 'Questions? We are a phone call away: 1-855-489-0345.', 'woocommerce-gateway-paypal-powered-by-braintree' )
529
+ ) );
530
 
531
+ ?>
532
+ </th>
533
+ <td>
534
+ <a
535
+ href="<?php echo esc_url( $this->get_disconnect_url() ); ?>"
536
+ id="wc-braintree-auth-disconnect"
537
+ class="button-primary"
538
+ ><?php
539
+ echo esc_html__( 'Disconnect from PayPal Powered by Braintree', 'woocommerce-gateway-paypal-powered-by-braintree' );
540
+ ?></a>
541
+ </td>
542
+ </tr>
543
+
544
+ <script type="text/template" id="tmpl-wc-braintree-auth-disconnect-modal">
545
+ <div class="wc-backbone-modal wc-braintree-auth-disconnect-modal">
546
+ <div class="wc-backbone-modal-content">
547
+ <section class="wc-backbone-modal-main" role="main">
548
+ <header class="wc-backbone-modal-header">
549
+ <h1><?php esc_html_e( 'PayPal Powered by Braintree', 'woocommerce-gateway-paypal-powered-by-braintree' ); ?></h1>
550
+ <button class="modal-close modal-close-link dashicons dashicons-no-alt">
551
+ <span class="screen-reader-text"><?php esc_html_e( 'Close modal panel and cancel', 'woocommerce-gateway-paypal-powered-by-braintree' ); ?></span>
552
+ </button>
553
+ </header>
554
+ <article>
555
+ <p><?php printf(
556
+ /* translators: Placeholders %1$s - opening HTML <a> link tag, closing HTML </a> link tag */
557
+ esc_html__( 'Heads up! Once you disconnect, you\'ll need to use your %1$sBraintree API keys%2$s to reconnect. Do you want to proceed with disconnecting?', 'woocommerce-gateway-paypal-powered-by-braintree' ),
558
+ '<a href="https://docs.woocommerce.com/document/woocommerce-gateway-paypal-powered-by-braintree/#setup" target="_blank">',
559
+ '</a>'
560
+ ); ?></p>
561
+ </article>
562
+ <footer style="text-align: right;">
563
+ <button
564
+ class="button"
565
+ ><?php esc_html_e( 'Cancel', 'woocommerce-gateway-paypal-powered-by-braintree' ); ?></button>
566
+ <a
567
+ href="<?php echo esc_url( $this->get_disconnect_url() ); ?>"
568
+ class="button button-primary"
569
+ ><?php esc_html_e( 'Disconnect', 'woocommerce-gateway-paypal-powered-by-braintree' ); ?></a>
570
+ </footer>
571
+ </section>
572
+ </div>
573
+ </div>
574
+ <div class="wc-backbone-modal-backdrop modal-close"></div>
575
+ </script>
576
+ <?php
577
+
578
+ $field = ob_get_clean();
579
+
580
+ wc_enqueue_js( "
581
+ $( '#wc-braintree-auth-disconnect' ).on( 'click', function( e ) {
582
+ e.preventDefault();
583
+
584
+ $( '#wc-backbone-modal-dialog .modal-close' ).trigger( 'click' );
585
 
586
+ new $.WCBackboneModal.View( {
587
+ target: 'wc-braintree-auth-disconnect-modal'
588
+ } );
589
 
590
+ $( '.wc-braintree-auth-disconnect-modal .button' ).on( 'click', function( e ) {
591
+ if ( ! $( this ).hasClass( 'button-primary' ) ) {
592
+ $( '.wc-braintree-auth-disconnect-modal button.modal-close' ).trigger( 'click' );
593
+ }
594
+ } );
595
+ } )
596
+ " );
597
+
598
+ return $field;
599
  }
600
 
601
 
743
  public function admin_options() {
744
 
745
  parent::admin_options();
746
+
747
  ?>
748
  <style type="text/css">
749
 
758
  }
759
 
760
  </style>
 
761
 
762
+ <?php ob_start(); ?>
 
763
 
764
  $( document.body ).on( 'click', '.wc-braintree-auth.disabled .wc-braintree-connect-button', function( e ) {
765
  e.preventDefault();
773
  $( '#woocommerce_<?php echo esc_js( $this->get_id() ); ?>_connect_manually' ).change( function() {
774
 
775
  var $environment = $( '#woocommerce_<?php echo esc_js( $this->get_id() ); ?>_environment' ).val();
 
776
  var $environmentFields = $( '.' + $environment + '-field' );
777
 
778
  if ( $( this ).is( ':checked' ) ) {
includes/views/admin-html-braintree-auth.php DELETED
@@ -1,52 +0,0 @@
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/Auth
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
- defined( 'ABSPATH' ) or exit;
26
-
27
- ?>
28
-
29
- <tr class="wc-braintree-auth">
30
- <th>
31
-
32
- <?php esc_html_e( 'Connect/Disconnect', 'woocommerce-gateway-paypal-powered-by-braintree' ); ?>
33
-
34
- <?php echo wc_help_tip( $help_tip ); ?>
35
- </th>
36
- <td>
37
- <?php if ( $is_connected ) : ?>
38
-
39
- <a href="<?php echo esc_url( $disconnect_url ); ?>" class='button-primary'>
40
- <?php echo esc_html__( 'Disconnect from PayPal Powered by Braintree', 'woocommerce-gateway-paypal-powered-by-braintree' ); ?>
41
- </a>
42
-
43
- <?php else : ?>
44
-
45
- <a href="<?php echo esc_url( $connect_url ); ?>" class="wc-braintree-connect-button"><img src="<?php echo esc_url( $button_image_url ); ?>"/></a>
46
- <br />
47
- <br />
48
- <a href="<?php echo esc_url( $sandbox_connect_url ); ?>" class="wc-braintree-connect-button"><?php esc_html_e( 'Not ready to accept live payments? Click here to connect using sandbox mode.', 'woocommerce-gateway-paypal-powered-by-braintree' ); ?></a>
49
-
50
- <?php endif; ?>
51
- </td>
52
- </tr>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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.4.1
6
  Requires PHP: 5.4
7
- Stable tag: 2.3.10
8
  License: GPLv3
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
@@ -124,6 +124,9 @@ New feature requests and bugs reports can be made in the plugin forum.
124
 
125
  == Changelog ==
126
 
 
 
 
127
  = 2020.05.04 - version 2.3.10 =
128
  * Misc - Add support for WooCommerce 4.1
129
 
4
  Requires at least: 4.4
5
  Tested up to: 5.4.1
6
  Requires PHP: 5.4
7
+ Stable tag: 2.3.11
8
  License: GPLv3
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
124
 
125
  == Changelog ==
126
 
127
+ = 2020.06.03 - version 2.3.11 =
128
+ * 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
129
+
130
  = 2020.05.04 - version 2.3.10 =
131
  * Misc - Add support for WooCommerce 4.1
132
 
vendor/autoload.php CHANGED
@@ -4,4 +4,4 @@
4
 
5
  require_once __DIR__ . '/composer/autoload_real.php';
6
 
7
- return ComposerAutoloaderInitcb51060af19e85d59e44f4e7d0f5fb26::getLoader();
4
 
5
  require_once __DIR__ . '/composer/autoload_real.php';
6
 
7
+ return ComposerAutoloaderInit78ba8a3ab3ee78c6e37de8c092dbb23d::getLoader();
vendor/composer/autoload_real.php CHANGED
@@ -2,7 +2,7 @@
2
 
3
  // autoload_real.php @generated by Composer
4
 
5
- class ComposerAutoloaderInitcb51060af19e85d59e44f4e7d0f5fb26
6
  {
7
  private static $loader;
8
 
@@ -22,15 +22,15 @@ class ComposerAutoloaderInitcb51060af19e85d59e44f4e7d0f5fb26
22
  return self::$loader;
23
  }
24
 
25
- spl_autoload_register(array('ComposerAutoloaderInitcb51060af19e85d59e44f4e7d0f5fb26', 'loadClassLoader'), true, true);
26
  self::$loader = $loader = new \Composer\Autoload\ClassLoader();
27
- spl_autoload_unregister(array('ComposerAutoloaderInitcb51060af19e85d59e44f4e7d0f5fb26', '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\ComposerStaticInitcb51060af19e85d59e44f4e7d0f5fb26::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 ComposerAutoloaderInit78ba8a3ab3ee78c6e37de8c092dbb23d
6
  {
7
  private static $loader;
8
 
22
  return self::$loader;
23
  }
24
 
25
+ spl_autoload_register(array('ComposerAutoloaderInit78ba8a3ab3ee78c6e37de8c092dbb23d', 'loadClassLoader'), true, true);
26
  self::$loader = $loader = new \Composer\Autoload\ClassLoader();
27
+ spl_autoload_unregister(array('ComposerAutoloaderInit78ba8a3ab3ee78c6e37de8c092dbb23d', '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\ComposerStaticInit78ba8a3ab3ee78c6e37de8c092dbb23d::getInitializer($loader));
34
  } else {
35
  $map = require __DIR__ . '/autoload_namespaces.php';
36
  foreach ($map as $namespace => $path) {
vendor/composer/autoload_static.php CHANGED
@@ -4,7 +4,7 @@
4
 
5
  namespace Composer\Autoload;
6
 
7
- class ComposerStaticInitcb51060af19e85d59e44f4e7d0f5fb26
8
  {
9
  public static $prefixLengthsPsr4 = array (
10
  'B' =>
@@ -33,9 +33,9 @@ class ComposerStaticInitcb51060af19e85d59e44f4e7d0f5fb26
33
  public static function getInitializer(ClassLoader $loader)
34
  {
35
  return \Closure::bind(function () use ($loader) {
36
- $loader->prefixLengthsPsr4 = ComposerStaticInitcb51060af19e85d59e44f4e7d0f5fb26::$prefixLengthsPsr4;
37
- $loader->prefixDirsPsr4 = ComposerStaticInitcb51060af19e85d59e44f4e7d0f5fb26::$prefixDirsPsr4;
38
- $loader->prefixesPsr0 = ComposerStaticInitcb51060af19e85d59e44f4e7d0f5fb26::$prefixesPsr0;
39
 
40
  }, null, ClassLoader::class);
41
  }
4
 
5
  namespace Composer\Autoload;
6
 
7
+ class ComposerStaticInit78ba8a3ab3ee78c6e37de8c092dbb23d
8
  {
9
  public static $prefixLengthsPsr4 = array (
10
  'B' =>
33
  public static function getInitializer(ClassLoader $loader)
34
  {
35
  return \Closure::bind(function () use ($loader) {
36
+ $loader->prefixLengthsPsr4 = ComposerStaticInit78ba8a3ab3ee78c6e37de8c092dbb23d::$prefixLengthsPsr4;
37
+ $loader->prefixDirsPsr4 = ComposerStaticInit78ba8a3ab3ee78c6e37de8c092dbb23d::$prefixDirsPsr4;
38
+ $loader->prefixesPsr0 = ComposerStaticInit78ba8a3ab3ee78c6e37de8c092dbb23d::$prefixesPsr0;
39
 
40
  }, null, ClassLoader::class);
41
  }
woocommerce-gateway-paypal-powered-by-braintree.php CHANGED
@@ -5,12 +5,12 @@
5
  * Description: Receive credit card or PayPal payments using Paypal Powered by Braintree. 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+
6
  * Author: WooCommerce
7
  * Author URI: http://woocommerce.com/
8
- * Version: 2.3.10
9
  * Text Domain: woocommerce-gateway-paypal-powered-by-braintree
10
  * Domain Path: /i18n/languages/
11
  *
12
  * WC requires at least: 2.6.14
13
- * WC tested up to: 4.1.0
14
  *
15
  * Copyright (c) 2016-2020, Automattic, Inc.
16
  *
5
  * Description: Receive credit card or PayPal payments using Paypal Powered by Braintree. 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+
6
  * Author: WooCommerce
7
  * Author URI: http://woocommerce.com/
8
+ * Version: 2.3.11
9
  * Text Domain: woocommerce-gateway-paypal-powered-by-braintree
10
  * Domain Path: /i18n/languages/
11
  *
12
  * WC requires at least: 2.6.14
13
+ * WC tested up to: 4.2.0
14
  *
15
  * Copyright (c) 2016-2020, Automattic, Inc.
16
  *