Version Description
- Fix - Prevent a fatal error when completing pre-orders
- Fix - Prevent JavaScript errors when applying a 100%-off coupon at checkout
Download this release
Release Info
Developer | royho |
Plugin | WooCommerce PayPal Powered by Braintree Payment Gateway |
Version | 2.0.4 |
Comparing to | |
See all releases |
Code changes from version 2.0.3 to 2.0.4
- assets/js/frontend/wc-braintree.min.js +1 -1
- class-wc-braintree.php +1 -1
- i18n/languages/woocommerce-gateway-paypal-powered-by-braintree.pot +1 -1
- lib/skyverge/woocommerce/payment-gateway/integrations/class-sv-wc-payment-gateway-integration-pre-orders.php +4 -1
- readme.txt +10 -2
- woocommerce-gateway-paypal-powered-by-braintree.php +1 -1
assets/js/frontend/wc-braintree.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
(function(){var a=function(a,c){function d(){this.constructor=a}for(var e in c)b.call(c,e)&&(a[e]=c[e]);return d.prototype=c.prototype,a.prototype=new d,a.__super__=c.prototype,a},b={}.hasOwnProperty;jQuery(document).ready(function(b){"use strict";return window.WC_Braintree_Payment_Form_Handler=function(){function a(a){this.id=a.id,this.id_dasherized=a.id_dasherized,this.type=a.type,this.debug=a.debug,this.params=window.wc_braintree_params,"undefined"!=typeof braintree&&null!==braintree&&(b("form.checkout").length?this.handle_checkout_page():b("form#order_review").length?this.handle_pay_page():b("form#add_payment_method").length&&this.handle_add_payment_method_page())}return a.prototype.handle_checkout_page=function(){return this.form=b("form.checkout"),this.form_ui_selector=".woocommerce-checkout-payment",b(document.body).on("updated_checkout",function(a){return function(){return a.setup_braintree()}}(this)),b(document.body).on("updated_checkout",function(a){return function(){return a.handle_saved_payment_methods()}}(this)),b(document.body).on("checkout_error",function(a){return function(){return a.unblock_ui(),b("input[name=wc_"+a.id+"_payment_nonce]").val("")}}(this)),this.form.on("checkout_place_order_"+this.id,function(a){return function(){return a.block_ui(),a.verify_form()}}(this))},a.prototype.handle_pay_page=function(){return this.form=b("form#order_review"),this.form_ui_selector="#payment",this.handle_saved_payment_methods(),this.setup_braintree(),this.form.submit(function(a){return function(){if(a.block_ui(),!1!==a.verify_form())return HTMLFormElement.prototype.submit.call(a.form[0])}}(this))},a.prototype.handle_add_payment_method_page=function(){return this.form=b("form#add_payment_method"),this.form_ui_selector="#payment",this.setup_braintree(),this.form.submit(function(a){return function(){return!(a.is_braintree_selected()&&!a.has_payment_nonce())&&HTMLFormElement.prototype.submit.call(a.form[0])}}(this))},a.prototype.verify_form=function(){return!this.is_braintree_selected()||(!!this.using_payment_token()||!!this.has_payment_nonce()&&void 0)},a.prototype.submit_form=function(a){return b("input[name=wc_"+this.id+"_payment_nonce]").val(a),this.form.submit()},a.prototype.handle_saved_payment_methods=function(){var a;return a=b("div.js-wc-"+this.id_dasherized+"-new-payment-method-form"),b("input.js-wc-"+this.id_dasherized+"-payment-token").change(function(c){return function(){var d;return d=b("input.js-wc-"+c.id_dasherized+"-payment-token:checked").val(),d?a.slideUp(200):a.slideDown(200)}}(this)).change(),b("input#createaccount").change(function(a){return function(c){var d;return d=b("input.js-wc-"+a.id_dasherized+"-tokenize-payment-method").closest("p.form-row"),b(c.target).is(":checked")?(d.slideDown(),d.next().show()):(d.hide(),d.next().hide())}}(this)).change()},a.prototype.setup_braintree=function(){},a.prototype.refresh_braintree=function(){if(null!=this.integration)return this.block_ui(),this.integration.teardown(function(a){return function(){return a.integration=null,a.setup_braintree()}}(this))},a.prototype.teardown_braintree=function(){if(null!=this.integration)return this.block_ui(),this.integration.teardown(function(a){return function(){return a.integration=null,a.unblock_ui()}}(this))},a.prototype.on_payment_method_received=function(a){},a.prototype.on_error=function(a){if("VALIDATION"===a.type){if(!this.is_braintree_selected())return;if(this.id!==this.get_selected_gateway_id())return;this.render_error(this.get_error_message(a))}else this.log("configuration error",a.message);return this.unblock_ui()},a.prototype.get_error_message=function(a){},a.prototype.on_ready=function(a){return this.unblock_ui(),this.integration=a},a.prototype.block_ui=function(){return b(this.form_ui_selector).block({message:null,overlayCSS:{background:"#fff",opacity:.6}})},a.prototype.unblock_ui=function(){return b(this.form_ui_selector).unblock()},a.prototype.render_error=function(a){return b(".woocommerce-error, .woocommerce-message").remove(),this.form.prepend('<div class="woocommerce-error">'+a+"</div>").removeClass("processing").unblock(),b("html, body").animate({scrollTop:this.form.offset().top-100},1e3),b("input[name=wc_"+this.id+"_payment_nonce]").val(""),this.form.trigger("wc_"+this.id+"_rendered_error"),this.unblock_ui()},a.prototype.has_payment_nonce=function(){return this.form.find("input[name=wc_"+this.get_selected_gateway_id()+"_payment_nonce]").val()},a.prototype.using_payment_token=function(){return this.form.find("input.js-wc-"+this.get_selected_gateway_id_dasherized()+"-payment-token:checked").val()},a.prototype.get_selected_gateway_id=function(){return this.form.find("input[name=payment_method]:checked").val()},a.prototype.get_selected_gateway_id_dasherized=function(){return this.get_selected_gateway_id().replace(/_/g,"-")},a.prototype.is_braintree_selected=function(){var a;return"braintree_credit_card"===(a=this.form.find("input[name=payment_method]:checked").val())||"braintree_paypal"===a},a.prototype.is_credit_card_selected=function(){return"braintree_credit_card"===this.get_selected_gateway_id()},a.prototype.is_paypal_selected=function(){return"braintree_paypal"===this.get_selected_gateway_id()},a.prototype.log=function(a,b){if(this.debug)return console.log(a),console.log(b)},a}(),window.WC_Braintree_Credit_Card_Payment_Form_Handler=function(c){function d(a){this.csc_required=a.csc_required,this.hosted_fields_styles=a.hosted_fields_styles,this.threeds=a.threeds,d.__super__.constructor.call(this,a),this.is_3d_secure_enabled()&&this.setup_3d_secure()}return a(d,c),d.prototype.verify_form=function(){var a,c;return!this.is_braintree_selected()||(c=d.__super__.verify_form.call(this),!(this.csc_required&&!this.has_payment_nonce())&&(a=b("input.js-wc-braintree-credit-card-payment-token:checked"),this.should_verify_3d_secure_token(a)&&(this.verify_3d_secure(a.data("nonce"),a),c=!1),c))},d.prototype.setup_braintree=function(){var a;return this.integration?this.refresh_braintree():(this.block_ui(),a={number:{selector:"#wc-braintree-credit-card-account-number-hosted"},cvv:{selector:"#wc-braintree-credit-card-csc-hosted"},expirationDate:{selector:"#wc-braintree-credit-card-expiry-hosted"},styles:this.hosted_fields_styles,onFieldEvent:function(a){return function(b){return a.on_hosted_field_event(b)}}(this)},this.csc_required&&this.form.find("input.js-wc-"+this.id_dasherized+"-payment-token:checked").val()&&(delete a.number,delete a.expirationDate),this.csc_required||delete a.cvv,braintree.setup(this.params.client_token,"custom",{id:this.form[0],hostedFields:a,onPaymentMethodReceived:function(a){return function(b){return a.on_payment_method_received(b)}}(this),onError:function(a){return function(b){return a.on_error(b)}}(this),onReady:function(a){return function(b){return a.on_ready(b)}}(this)}))},d.prototype.on_ready=function(a){if(d.__super__.on_ready.call(this,a),!this.csc_required&&b("input.js-wc-braintree-credit-card-payment-token:checked").val())return this.teardown_braintree()},d.prototype.handle_saved_payment_methods=function(){var a,c;return d.__super__.handle_saved_payment_methods.call(this),c=b("div.js-wc-braintree-credit-card-new-payment-method-form"),a=b("div.wc-braintree-hosted-field-card-csc-parent"),b("input.js-wc-braintree-credit-card-payment-token").change(function(d){return function(){var e;return e=b("input.js-wc-braintree-credit-card-payment-token:checked").val(),e?d.csc_required&&a.hasClass("form-row-last")?(a.removeClass("form-row-last").addClass("form-row-first"),c.after(a),d.refresh_braintree()):void 0:d.csc_required&&a.hasClass("form-row-first")?(a.removeClass("form-row-first").addClass("form-row-last"),c.find("div.wc-braintree-hosted-field-card-expiry-parent").after(a),d.refresh_braintree()):d.setup_braintree()}}(this)).change()},d.prototype.get_error_message=function(a){var b,c,d,e;if(d=[],null!=a.details)for(e=a.details.invalidFieldKeys,b=0,c=e.length;b<c;b++)switch(e[b]){case"number":d.push(this.params.card_number_invalid);break;case"cvv":d.push(this.params.cvv_length_invalid);break;case"expirationDate":d.push(this.params.card_exp_date_invalid)}else switch(a.message){case"User did not enter a payment method":this.csc_required?this.using_payment_token()?d.push(this.params.cvv_missing):d.push(this.params.card_number_missing,this.params.card_exp_date_invalid,this.params.cvv_missing):d.push(this.params.card_number_missing,this.params.card_exp_date_invalid)}return d.length||d.push(a.message),d.join("<br/>")},d.prototype.on_payment_method_received=function(a){if(this.log("payment method received",a),null!=a.nonce)return this.should_verify_3d_secure(a)?this.verify_3d_secure(a.nonce):this.submit_form(a.nonce)},d.prototype.on_hosted_field_event=function(a){var c;if(c=b(".wc-braintree-hosted-field-card-number"),c.attr("class",function(a,b){return b.replace(/(^|\s)card-type-\S+/g,"")}),null!=a.card)return c.addClass("card-type-"+a.card.type)},d.prototype.is_3d_secure_enabled=function(){return this.threeds.enabled},d.prototype.setup_3d_secure=function(){return this.client=new braintree.api.Client({clientToken:this.params.client_token})},d.prototype.should_verify_3d_secure=function(a){var b;return b=a.details.cardType,this.is_3d_secure_enabled()&&"CreditCard"===a.type&&("Visa"===b||"MasterCard"===b)},d.prototype.should_verify_3d_secure_token=function(a){if(a.val()&&a.data("nonce")&&!a.data("verified"))return!0},d.prototype.verify_3d_secure=function(a,c){var d;return null==c&&(c=null),d=b("input[name=wc_braintree_credit_card_3d_secure_order_total]").val(),this.client.verify3DS({amount:d,creditCard:a},function(a){return function(d,e){return d?(a.render_error(d.message),a.log("3DS error",d)):(a.log("3DS response",e),a.threeds.liability_shift_always_required&&!e.verificationDetails.liabilityShifted&&a.render_error(a.threeds.failure_message),e.verificationDetails.liabilityShiftPossible&&!e.verificationDetails.liabilityShifted&&a.render_error(a.threeds.failure_message),null!=c&&c.data("verified",!0),b("input[name=wc_braintree_credit_card_3d_secure_verified]").val(1),a.submit_form(e.nonce))}}(this))},d}(WC_Braintree_Payment_Form_Handler),window.WC_Braintree_PayPal_Payment_Form_Handler=function(c){function d(a){this.must_login_message=a.must_login_message,this.must_login_add_method_message=a.must_login_add_method_message,d.__super__.constructor.call(this,a),b("input[name=wc_"+this.id+"_payment_nonce]").val(this.params.cart_payment_nonce),b(document.body).on("click",'input[name="payment_method"], input.js-wc-braintree-paypal-payment-token',function(a){return function(){return!a.is_paypal_selected()||a.has_payment_nonce()||a.using_payment_token()?b("#place_order").show():b("#place_order").hide()}}(this))}return a(d,c),d.prototype.handle_checkout_page=function(){return d.__super__.handle_checkout_page.call(this),b(document.body).on("checkout_error",function(a){return function(){return a.params.cart_payment_nonce=!1,a.setup_braintree()}}(this))},d.prototype.verify_form=function(){var a;return!this.is_braintree_selected()||(a=d.__super__.verify_form.call(this),this.has_payment_nonce()||this.using_payment_token()||this.render_error(this.must_login_message),a)},d.prototype.handle_add_payment_method_page=function(){return this.form=b("form#add_payment_method"),this.form_ui_selector="#payment",this.setup_braintree(),this.form.submit(function(a){return function(){return a.is_paypal_selected()&&(a.has_payment_nonce()||a.render_error(a.must_login_add_method_message)),!(a.is_braintree_selected()&&!a.has_payment_nonce())&&HTMLFormElement.prototype.submit.call(a.form[0])}}(this))},d.prototype.setup_braintree=function(){if(!this.params.cart_payment_nonce)return b(".payment_method_braintree_paypal fieldset").show(),b("input[name=wc_braintree_paypal_payment_nonce]").val(""),this.integration?this.refresh_braintree():(this.block_ui(),braintree.setup(this.params.client_token,"paypal",{container:"wc_braintree_paypal_container",singleUse:this.is_single_use(),amount:this.get_order_amount(),currency:this.get_store_currency(),locale:this.get_store_locale(),onPaymentMethodReceived:function(a){return function(b){return a.on_payment_method_received(b)}}(this),onError:function(a){return function(b){return a.on_error(b)}}(this),onReady:function(a){return function(b){return a.on_ready(b)}}(this),onCancelled:function(a){return function(){return a.on_cancelled()}}(this),onUnsupported:function(a){return function(b){return a.on_unsupported(b)}}(this)}))},d.prototype.on_cancelled=function(){if(b("input.js-wc-braintree-paypal-tokenize-payment-method").prop("disabled",!1),b("input[name=wc_braintree_paypal_payment_nonce]").val(""),this.is_paypal_selected())return b("#place_order").hide()},d.prototype.on_unsupported=function(a){return this.log("PayPal error",a),this.render_error(this.params.generic_error_message)},d.prototype.handle_saved_payment_methods=function(){return d.__super__.handle_saved_payment_methods.call(this),b("input.js-wc-braintree-paypal-tokenize-payment-method").change(function(a){return function(c){if(b(c.target).is(":visible"))return a.refresh_braintree()}}(this)).change()},d.prototype.on_payment_method_received=function(a){if(this.log("payment method received",a),null!=a.nonce)return this.is_single_use()&&b("input.js-wc-braintree-paypal-tokenize-payment-method").prop("disabled",!0),b("input[name=wc_braintree_paypal_payment_nonce]").val(a.nonce),b("#place_order").show()},d.prototype.is_single_use=function(){var a;return a=b("input[name=wc-braintree-paypal-tokenize-payment-method]"),0===a.length||("checkbox"===a.attr("type")?!a.is(":checked"):!a.val())},d.prototype.get_order_amount=function(){return b("input[name=wc_braintree_paypal_amount]").val()},d.prototype.get_store_currency=function(){return b("input[name=wc_braintree_paypal_currency]").val()},d.prototype.get_store_locale=function(){return b("input[name=wc_braintree_paypal_locale]").val()},d}(WC_Braintree_Payment_Form_Handler),window.WC_Braintree_PayPal_Cart_Handler=function(c){function d(a){d.__super__.constructor.call(this,a),this.form=b("form.woocommerce-cart-form"),this.form_ui_selector=".cart_totals",this.setup_braintree(),b(document.body).on("updated_cart_totals",function(a){return function(){return a.setup_braintree()}}(this))}return a(d,c),d.prototype.on_payment_method_received=function(a){if(this.log("payment method received",a),null!=a.nonce)return a.wp_nonce=this.params.cart_nonce,b.ajax({type:"POST",url:this.params.cart_handler_url,data:a,dataType:"json"}).done(function(a){return window.location=a.redirect_url})},d.prototype.on_error=function(a){return this.log("PayPal error",a.message),this.unblock_ui()},d.prototype.on_unsupported=function(a){return console.log(a),this.unblock_ui()},d.prototype.is_single_use=function(){return"1"===b("input[name=wc_braintree_paypal_single_use]").val()},d.prototype.has_payment_nonce=function(){return!1},d}(WC_Braintree_PayPal_Payment_Form_Handler)})}).call(this);
|
1 |
+
(function(){var a=function(a,c){function d(){this.constructor=a}for(var e in c)b.call(c,e)&&(a[e]=c[e]);return d.prototype=c.prototype,a.prototype=new d,a.__super__=c.prototype,a},b={}.hasOwnProperty;jQuery(document).ready(function(b){"use strict";return window.WC_Braintree_Payment_Form_Handler=function(){function a(a){this.id=a.id,this.id_dasherized=a.id_dasherized,this.type=a.type,this.debug=a.debug,this.params=window.wc_braintree_params,"undefined"!=typeof braintree&&null!==braintree&&(b("form.checkout").length?this.handle_checkout_page():b("form#order_review").length?this.handle_pay_page():b("form#add_payment_method").length&&this.handle_add_payment_method_page())}return a.prototype.handle_checkout_page=function(){return this.form=b("form.checkout"),this.form_ui_selector=".woocommerce-checkout-payment",b(document.body).on("updated_checkout",function(a){return function(){return a.setup_braintree()}}(this)),b(document.body).on("updated_checkout",function(a){return function(){return a.handle_saved_payment_methods()}}(this)),b(document.body).on("checkout_error",function(a){return function(){return a.unblock_ui(),b("input[name=wc_"+a.id+"_payment_nonce]").val("")}}(this)),this.form.on("checkout_place_order_"+this.id,function(a){return function(){return a.block_ui(),a.verify_form()}}(this))},a.prototype.handle_pay_page=function(){return this.form=b("form#order_review"),this.form_ui_selector="#payment",this.handle_saved_payment_methods(),this.setup_braintree(),this.form.submit(function(a){return function(){if(a.block_ui(),!1!==a.verify_form())return HTMLFormElement.prototype.submit.call(a.form[0])}}(this))},a.prototype.handle_add_payment_method_page=function(){return this.form=b("form#add_payment_method"),this.form_ui_selector="#payment",this.setup_braintree(),this.form.submit(function(a){return function(){return!(a.is_braintree_selected()&&!a.has_payment_nonce())&&HTMLFormElement.prototype.submit.call(a.form[0])}}(this))},a.prototype.verify_form=function(){return!this.is_braintree_selected()||(!!this.using_payment_token()||!!this.has_payment_nonce()&&void 0)},a.prototype.submit_form=function(a){return b("input[name=wc_"+this.id+"_payment_nonce]").val(a),this.form.submit()},a.prototype.handle_saved_payment_methods=function(){var a;return a=b("div.js-wc-"+this.id_dasherized+"-new-payment-method-form"),b("input.js-wc-"+this.id_dasherized+"-payment-token").change(function(c){return function(){var d;return d=b("input.js-wc-"+c.id_dasherized+"-payment-token:checked").val(),d?a.slideUp(200):a.slideDown(200)}}(this)).change(),b("input#createaccount").change(function(a){return function(c){var d;return d=b("input.js-wc-"+a.id_dasherized+"-tokenize-payment-method").closest("p.form-row"),b(c.target).is(":checked")?(d.slideDown(),d.next().show()):(d.hide(),d.next().hide())}}(this)).change()},a.prototype.setup_braintree=function(){},a.prototype.refresh_braintree=function(){if(null!=this.integration)return this.block_ui(),this.integration.teardown(function(a){return function(){return a.integration=null,a.setup_braintree()}}(this))},a.prototype.teardown_braintree=function(){if(null!=this.integration)return this.block_ui(),this.integration.teardown(function(a){return function(){return a.integration=null,a.unblock_ui()}}(this))},a.prototype.on_payment_method_received=function(a){},a.prototype.on_error=function(a){if("VALIDATION"===a.type){if(!this.is_braintree_selected())return;if(this.id!==this.get_selected_gateway_id())return;this.render_error(this.get_error_message(a))}else this.log("configuration error",a.message);return this.unblock_ui()},a.prototype.get_error_message=function(a){},a.prototype.on_ready=function(a){return this.unblock_ui(),this.integration=a},a.prototype.block_ui=function(){return b(this.form_ui_selector).block({message:null,overlayCSS:{background:"#fff",opacity:.6}})},a.prototype.unblock_ui=function(){return b(this.form_ui_selector).unblock()},a.prototype.render_error=function(a){return b(".woocommerce-error, .woocommerce-message").remove(),this.form.prepend('<div class="woocommerce-error">'+a+"</div>").removeClass("processing").unblock(),b("html, body").animate({scrollTop:this.form.offset().top-100},1e3),b("input[name=wc_"+this.id+"_payment_nonce]").val(""),this.form.trigger("wc_"+this.id+"_rendered_error"),this.unblock_ui()},a.prototype.has_payment_nonce=function(){return this.form.find("input[name=wc_"+this.get_selected_gateway_id()+"_payment_nonce]").val()},a.prototype.using_payment_token=function(){return this.form.find("input.js-wc-"+this.get_selected_gateway_id_dasherized()+"-payment-token:checked").val()},a.prototype.get_selected_gateway_id=function(){return this.form.find("input[name=payment_method]:checked").val()},a.prototype.get_selected_gateway_id_dasherized=function(){return this.get_selected_gateway_id().replace(/_/g,"-")},a.prototype.is_braintree_selected=function(){var a;return"braintree_credit_card"===(a=this.form.find("input[name=payment_method]:checked").val())||"braintree_paypal"===a},a.prototype.is_credit_card_selected=function(){return"braintree_credit_card"===this.get_selected_gateway_id()},a.prototype.is_paypal_selected=function(){return"braintree_paypal"===this.get_selected_gateway_id()},a.prototype.log=function(a,b){if(this.debug)return console.log(a),console.log(b)},a}(),window.WC_Braintree_Credit_Card_Payment_Form_Handler=function(c){function d(a){this.csc_required=a.csc_required,this.hosted_fields_styles=a.hosted_fields_styles,this.threeds=a.threeds,d.__super__.constructor.call(this,a),this.is_3d_secure_enabled()&&this.setup_3d_secure()}return a(d,c),d.prototype.verify_form=function(){var a,c;return!this.is_braintree_selected()||(c=d.__super__.verify_form.call(this),!(this.csc_required&&!this.has_payment_nonce())&&(a=b("input.js-wc-braintree-credit-card-payment-token:checked"),this.should_verify_3d_secure_token(a)&&(this.verify_3d_secure(a.data("nonce"),a),c=!1),c))},d.prototype.setup_braintree=function(){var a;return this.integration?this.refresh_braintree():(this.block_ui(),a={number:{selector:"#wc-braintree-credit-card-account-number-hosted"},cvv:{selector:"#wc-braintree-credit-card-csc-hosted"},expirationDate:{selector:"#wc-braintree-credit-card-expiry-hosted"},styles:this.hosted_fields_styles,onFieldEvent:function(a){return function(b){return a.on_hosted_field_event(b)}}(this)},this.csc_required&&this.form.find("input.js-wc-"+this.id_dasherized+"-payment-token:checked").val()&&(delete a.number,delete a.expirationDate),this.csc_required||delete a.cvv,braintree.setup(this.params.client_token,"custom",{id:this.form[0],hostedFields:a,onPaymentMethodReceived:function(a){return function(b){return a.on_payment_method_received(b)}}(this),onError:function(a){return function(b){return a.on_error(b)}}(this),onReady:function(a){return function(b){return a.on_ready(b)}}(this)}))},d.prototype.on_ready=function(a){if(d.__super__.on_ready.call(this,a),!this.csc_required&&b("input.js-wc-braintree-credit-card-payment-token:checked").val())return this.teardown_braintree()},d.prototype.handle_saved_payment_methods=function(){var a,c;return d.__super__.handle_saved_payment_methods.call(this),c=b("div.js-wc-braintree-credit-card-new-payment-method-form"),a=b("div.wc-braintree-hosted-field-card-csc-parent"),b("input.js-wc-braintree-credit-card-payment-token").change(function(d){return function(){var e;return e=b("input.js-wc-braintree-credit-card-payment-token:checked").val(),e?d.csc_required&&a.hasClass("form-row-last")?(a.removeClass("form-row-last").addClass("form-row-first"),c.after(a),d.refresh_braintree()):void 0:d.csc_required&&a.hasClass("form-row-first")?(a.removeClass("form-row-first").addClass("form-row-last"),c.find("div.wc-braintree-hosted-field-card-expiry-parent").after(a),d.refresh_braintree()):d.setup_braintree()}}(this)).change()},d.prototype.get_error_message=function(a){var b,c,d,e;if(d=[],null!=a.details)for(e=a.details.invalidFieldKeys,b=0,c=e.length;b<c;b++)switch(e[b]){case"number":d.push(this.params.card_number_invalid);break;case"cvv":d.push(this.params.cvv_length_invalid);break;case"expirationDate":d.push(this.params.card_exp_date_invalid)}else switch(a.message){case"User did not enter a payment method":this.csc_required?this.using_payment_token()?d.push(this.params.cvv_missing):d.push(this.params.card_number_missing,this.params.card_exp_date_invalid,this.params.cvv_missing):d.push(this.params.card_number_missing,this.params.card_exp_date_invalid)}return d.length||d.push(a.message),d.join("<br/>")},d.prototype.on_payment_method_received=function(a){if(this.log("payment method received",a),null!=a.nonce)return this.should_verify_3d_secure(a)?this.verify_3d_secure(a.nonce):this.submit_form(a.nonce)},d.prototype.on_hosted_field_event=function(a){var c;if(c=b(".wc-braintree-hosted-field-card-number"),c.attr("class",function(a,b){return b.replace(/(^|\s)card-type-\S+/g,"")}),null!=a.card)return c.addClass("card-type-"+a.card.type)},d.prototype.is_3d_secure_enabled=function(){return this.threeds.enabled},d.prototype.setup_3d_secure=function(){return this.client=new braintree.api.Client({clientToken:this.params.client_token})},d.prototype.should_verify_3d_secure=function(a){var b;return b=a.details.cardType,this.is_3d_secure_enabled()&&"CreditCard"===a.type&&("Visa"===b||"MasterCard"===b)},d.prototype.should_verify_3d_secure_token=function(a){if(a.val()&&a.data("nonce")&&!a.data("verified"))return!0},d.prototype.verify_3d_secure=function(a,c){var d;return null==c&&(c=null),d=b("input[name=wc_braintree_credit_card_3d_secure_order_total]").val(),this.client.verify3DS({amount:d,creditCard:a},function(a){return function(d,e){return d?(a.render_error(d.message),a.log("3DS error",d)):(a.log("3DS response",e),a.threeds.liability_shift_always_required&&!e.verificationDetails.liabilityShifted&&a.render_error(a.threeds.failure_message),e.verificationDetails.liabilityShiftPossible&&!e.verificationDetails.liabilityShifted&&a.render_error(a.threeds.failure_message),null!=c&&c.data("verified",!0),b("input[name=wc_braintree_credit_card_3d_secure_verified]").val(1),a.submit_form(e.nonce))}}(this))},d}(WC_Braintree_Payment_Form_Handler),window.WC_Braintree_PayPal_Payment_Form_Handler=function(c){function d(a){this.must_login_message=a.must_login_message,this.must_login_add_method_message=a.must_login_add_method_message,d.__super__.constructor.call(this,a),b("input[name=wc_"+this.id+"_payment_nonce]").val(this.params.cart_payment_nonce),b(document.body).on("click",'input[name="payment_method"], input.js-wc-braintree-paypal-payment-token',function(a){return function(){return!a.is_paypal_selected()||a.has_payment_nonce()||a.using_payment_token()?b("#place_order").show():b("#place_order").hide()}}(this))}return a(d,c),d.prototype.handle_checkout_page=function(){return d.__super__.handle_checkout_page.call(this),b(document.body).on("checkout_error",function(a){return function(){return a.params.cart_payment_nonce=!1,a.setup_braintree()}}(this))},d.prototype.verify_form=function(){var a;return!this.is_braintree_selected()||(a=d.__super__.verify_form.call(this),this.has_payment_nonce()||this.using_payment_token()||this.render_error(this.must_login_message),a)},d.prototype.handle_add_payment_method_page=function(){return this.form=b("form#add_payment_method"),this.form_ui_selector="#payment",this.setup_braintree(),this.form.submit(function(a){return function(){return a.is_paypal_selected()&&(a.has_payment_nonce()||a.render_error(a.must_login_add_method_message)),!(a.is_braintree_selected()&&!a.has_payment_nonce())&&HTMLFormElement.prototype.submit.call(a.form[0])}}(this))},d.prototype.setup_braintree=function(){if(!this.params.cart_payment_nonce&&b("#wc_braintree_paypal_container").length)return b(".payment_method_braintree_paypal fieldset").show(),b("input[name=wc_braintree_paypal_payment_nonce]").val(""),this.integration?this.refresh_braintree():(this.block_ui(),braintree.setup(this.params.client_token,"paypal",{container:"wc_braintree_paypal_container",singleUse:this.is_single_use(),amount:this.get_order_amount(),currency:this.get_store_currency(),locale:this.get_store_locale(),onPaymentMethodReceived:function(a){return function(b){return a.on_payment_method_received(b)}}(this),onError:function(a){return function(b){return a.on_error(b)}}(this),onReady:function(a){return function(b){return a.on_ready(b)}}(this),onCancelled:function(a){return function(){return a.on_cancelled()}}(this),onUnsupported:function(a){return function(b){return a.on_unsupported(b)}}(this)}))},d.prototype.on_cancelled=function(){if(b("input.js-wc-braintree-paypal-tokenize-payment-method").prop("disabled",!1),b("input[name=wc_braintree_paypal_payment_nonce]").val(""),this.is_paypal_selected())return b("#place_order").hide()},d.prototype.on_unsupported=function(a){return this.log("PayPal error",a),this.render_error(this.params.generic_error_message)},d.prototype.handle_saved_payment_methods=function(){return d.__super__.handle_saved_payment_methods.call(this),b("input.js-wc-braintree-paypal-tokenize-payment-method").change(function(a){return function(c){if(b(c.target).is(":visible"))return a.refresh_braintree()}}(this)).change()},d.prototype.on_payment_method_received=function(a){if(this.log("payment method received",a),null!=a.nonce)return this.is_single_use()&&b("input.js-wc-braintree-paypal-tokenize-payment-method").prop("disabled",!0),b("input[name=wc_braintree_paypal_payment_nonce]").val(a.nonce),b("#place_order").show()},d.prototype.is_single_use=function(){var a;return a=b("input[name=wc-braintree-paypal-tokenize-payment-method]"),0===a.length||("checkbox"===a.attr("type")?!a.is(":checked"):!a.val())},d.prototype.get_order_amount=function(){return b("input[name=wc_braintree_paypal_amount]").val()},d.prototype.get_store_currency=function(){return b("input[name=wc_braintree_paypal_currency]").val()},d.prototype.get_store_locale=function(){return b("input[name=wc_braintree_paypal_locale]").val()},d}(WC_Braintree_Payment_Form_Handler),window.WC_Braintree_PayPal_Cart_Handler=function(c){function d(a){d.__super__.constructor.call(this,a),this.form=b("form.woocommerce-cart-form"),this.form_ui_selector=".cart_totals",this.setup_braintree(),b(document.body).on("updated_cart_totals",function(a){return function(){return a.setup_braintree()}}(this))}return a(d,c),d.prototype.on_payment_method_received=function(a){if(this.log("payment method received",a),null!=a.nonce)return a.wp_nonce=this.params.cart_nonce,b.ajax({type:"POST",url:this.params.cart_handler_url,data:a,dataType:"json"}).done(function(a){return window.location=a.redirect_url})},d.prototype.on_error=function(a){return this.log("PayPal error",a.message),this.unblock_ui()},d.prototype.on_unsupported=function(a){return console.log(a),this.unblock_ui()},d.prototype.is_single_use=function(){return"1"===b("input[name=wc_braintree_paypal_single_use]").val()},d.prototype.has_payment_nonce=function(){return!1},d}(WC_Braintree_PayPal_Payment_Form_Handler)})}).call(this);
|
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.0.
|
92 |
|
93 |
/** @var WC_Braintree single instance of this plugin */
|
94 |
protected static $instance;
|
88 |
|
89 |
|
90 |
/** plugin version number */
|
91 |
+
const VERSION = '2.0.4';
|
92 |
|
93 |
/** @var WC_Braintree single instance of this plugin */
|
94 |
protected static $instance;
|
i18n/languages/woocommerce-gateway-paypal-powered-by-braintree.pot
CHANGED
@@ -2,7 +2,7 @@
|
|
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.0.
|
6 |
"Report-Msgid-Bugs-To: "
|
7 |
"https://wordpress.org/support/plugin/woocommerce-gateway-paypal-powered-by-"
|
8 |
"braintree/\n"
|
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.0.4\n"
|
6 |
"Report-Msgid-Bugs-To: "
|
7 |
"https://wordpress.org/support/plugin/woocommerce-gateway-paypal-powered-by-"
|
8 |
"braintree/\n"
|
lib/skyverge/woocommerce/payment-gateway/integrations/class-sv-wc-payment-gateway-integration-pre-orders.php
CHANGED
@@ -274,7 +274,7 @@ class SV_WC_Payment_Gateway_Integration_Pre_Orders extends SV_WC_Payment_Gateway
|
|
274 |
}
|
275 |
|
276 |
// perform the transaction
|
277 |
-
if ( $this->get_gateway()->is_credit_card_gateway() ) {
|
278 |
|
279 |
if ( $this->get_gateway()->perform_credit_card_charge( $order ) ) {
|
280 |
$response = $this->get_gateway()->get_api()->credit_card_charge( $order );
|
@@ -308,6 +308,9 @@ class SV_WC_Payment_Gateway_Integration_Pre_Orders extends SV_WC_Payment_Gateway
|
|
308 |
// account type (checking/savings) may or may not be available, which is fine
|
309 |
$message = sprintf( __( '%s eCheck Pre-Order Release Payment Approved: %s ending in %s', 'woocommerce-plugin-framework' ), $this->get_gateway()->get_method_title(), SV_WC_Payment_Gateway_Helper::payment_type_to_name( ( ! empty( $order->payment->account_type ) ? $order->payment->account_type : 'bank' ) ), $last_four );
|
310 |
|
|
|
|
|
|
|
311 |
}
|
312 |
|
313 |
// adds the transaction id (if any) to the order note
|
274 |
}
|
275 |
|
276 |
// perform the transaction
|
277 |
+
if ( $this->get_gateway()->is_credit_card_gateway() || $this->get_gateway()->is_paypal_gateway() ) {
|
278 |
|
279 |
if ( $this->get_gateway()->perform_credit_card_charge( $order ) ) {
|
280 |
$response = $this->get_gateway()->get_api()->credit_card_charge( $order );
|
308 |
// account type (checking/savings) may or may not be available, which is fine
|
309 |
$message = sprintf( __( '%s eCheck Pre-Order Release Payment Approved: %s ending in %s', 'woocommerce-plugin-framework' ), $this->get_gateway()->get_method_title(), SV_WC_Payment_Gateway_Helper::payment_type_to_name( ( ! empty( $order->payment->account_type ) ? $order->payment->account_type : 'bank' ) ), $last_four );
|
310 |
|
311 |
+
} else {
|
312 |
+
|
313 |
+
$message = sprintf( __( '%s Pre-Order Release Payment Approved', 'woocommerce-plugin-framework' ), $this->get_gateway()->get_method_title() );
|
314 |
}
|
315 |
|
316 |
// adds the transaction id (if any) to the order note
|
readme.txt
CHANGED
@@ -2,8 +2,8 @@
|
|
2 |
Contributors: automattic, akeda, allendav, royho, slash1andy, woosteve, spraveenitpro, mikedmoore, fernashes, shellbeezy, danieldudzic, dsmithweb, fullysupportedphil, corsonr, zandyring, skyverge
|
3 |
Tags: ecommerce, e-commerce, commerce, woothemes, wordpress ecommerce, store, sales, sell, shop, shopping, cart, checkout, configurable, paypal, braintree
|
4 |
Requires at least: 4.4
|
5 |
-
Tested up to: 4.
|
6 |
-
Stable tag: 2.0.
|
7 |
License: GPLv3
|
8 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
9 |
|
@@ -122,6 +122,10 @@ New feature requests and bugs reports can be made in the plugin forum.
|
|
122 |
|
123 |
== Changelog ==
|
124 |
|
|
|
|
|
|
|
|
|
125 |
= 2.0.3 =
|
126 |
* Fix - Add a missing namespace that could cause JavaScript issues with some configurations
|
127 |
|
@@ -222,6 +226,10 @@ New feature requests and bugs reports can be made in the plugin forum.
|
|
222 |
|
223 |
== Upgrade Notice ==
|
224 |
|
|
|
|
|
|
|
|
|
225 |
= 1.2.4 =
|
226 |
* Fix - Free subscription trials not allowed.
|
227 |
* Fix - Subscription recurring billing after free trial not working.
|
2 |
Contributors: automattic, akeda, allendav, royho, slash1andy, woosteve, spraveenitpro, mikedmoore, fernashes, shellbeezy, danieldudzic, dsmithweb, fullysupportedphil, corsonr, zandyring, skyverge
|
3 |
Tags: ecommerce, e-commerce, commerce, woothemes, wordpress ecommerce, store, sales, sell, shop, shopping, cart, checkout, configurable, paypal, braintree
|
4 |
Requires at least: 4.4
|
5 |
+
Tested up to: 4.8
|
6 |
+
Stable tag: 2.0.4
|
7 |
License: GPLv3
|
8 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
9 |
|
122 |
|
123 |
== Changelog ==
|
124 |
|
125 |
+
= 2.0.4 =
|
126 |
+
* Fix - Prevent a fatal error when completing pre-orders
|
127 |
+
* Fix - Prevent JavaScript errors when applying a 100%-off coupon at checkout
|
128 |
+
|
129 |
= 2.0.3 =
|
130 |
* Fix - Add a missing namespace that could cause JavaScript issues with some configurations
|
131 |
|
226 |
|
227 |
== Upgrade Notice ==
|
228 |
|
229 |
+
= 2.0.4 =
|
230 |
+
* Fix - Prevent a fatal error when completing pre-orders
|
231 |
+
* Fix - Prevent JavaScript errors when applying a 100%-off coupon at checkout
|
232 |
+
|
233 |
= 1.2.4 =
|
234 |
* Fix - Free subscription trials not allowed.
|
235 |
* Fix - Subscription recurring billing after free trial not working.
|
woocommerce-gateway-paypal-powered-by-braintree.php
CHANGED
@@ -5,7 +5,7 @@
|
|
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.0.
|
9 |
*
|
10 |
* Copyright (c) 2016-2017, Automattic, Inc.
|
11 |
*
|
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.0.4
|
9 |
*
|
10 |
* Copyright (c) 2016-2017, Automattic, Inc.
|
11 |
*
|