Version Description
- Fix - Ensure refunds succeed for legacy orders that are missing the necessary meta data
- Fix - Add fallbacks for certain subscriptions upgrades after WooCommerce 3.0 compatibility issues
- Fix - Default set the Require CSC setting for legacy upgrades to avoid inaccurate error notices at checkout
- Fix - Prevent PayPal JavaScript errors in certain cases
- Fix - Ensure subscriptions are not affected if Change Payment fails due to declines or other problems
- Fix - Ensure old payment methods can be removed by the customer after changing subscription payment to a new method
Download this release
Release Info
Developer | royho |
Plugin | WooCommerce PayPal Powered by Braintree Payment Gateway |
Version | 2.0.2 |
Comparing to | |
See all releases |
Code changes from version 2.0.1 to 2.0.2
- assets/js/frontend/wc-braintree.min.js +1 -1
- class-wc-braintree.php +22 -1
- i18n/languages/woocommerce-gateway-paypal-powered-by-braintree.pot +50 -50
- includes/api/responses/abstract-wc-braintree-api-response.php +1 -1
- includes/class-wc-gateway-braintree-paypal.php +0 -3
- includes/class-wc-gateway-braintree.php +84 -3
- includes/payment-forms/class-wc-braintree-paypal-payment-form.php +8 -23
- lib/skyverge/woocommerce/payment-gateway/class-sv-wc-payment-gateway.php +1 -1
- lib/skyverge/woocommerce/payment-gateway/integrations/class-sv-wc-payment-gateway-integration-subscriptions.php +72 -2
- readme.txt +13 -7
- 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(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?b("input[name=wc_"+a.id+"_payment_nonce]").val(a.params.cart_payment_nonce):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("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)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;
|
@@ -616,6 +616,7 @@ class WC_Braintree extends WC_Braintree_Framework\SV_WC_Payment_Gateway_Plugin {
|
|
616 |
$credit_card_settings = array(
|
617 |
'title' => $legacy_settings['title_cards'],
|
618 |
'description' => $legacy_settings['description_cards'],
|
|
|
619 |
'card_types' => array( 'VISA', 'MC', 'AMEX', 'DISC', 'DINERS', 'JCB', ),
|
620 |
);
|
621 |
|
@@ -648,6 +649,26 @@ class WC_Braintree extends WC_Braintree_Framework\SV_WC_Payment_Gateway_Plugin {
|
|
648 |
// update meta again for those that may be seeing the legacy migration issue from previous installs
|
649 |
$this->update_legacy_meta();
|
650 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
651 |
}
|
652 |
|
653 |
|
88 |
|
89 |
|
90 |
/** plugin version number */
|
91 |
+
const VERSION = '2.0.2';
|
92 |
|
93 |
/** @var WC_Braintree single instance of this plugin */
|
94 |
protected static $instance;
|
616 |
$credit_card_settings = array(
|
617 |
'title' => $legacy_settings['title_cards'],
|
618 |
'description' => $legacy_settings['description_cards'],
|
619 |
+
'require_csc' => 'yes', // no option to disable this in v1, so enable by default
|
620 |
'card_types' => array( 'VISA', 'MC', 'AMEX', 'DISC', 'DINERS', 'JCB', ),
|
621 |
);
|
622 |
|
649 |
// update meta again for those that may be seeing the legacy migration issue from previous installs
|
650 |
$this->update_legacy_meta();
|
651 |
}
|
652 |
+
|
653 |
+
// upgrade to v2.0.2
|
654 |
+
if ( version_compare( $installed_version, '2.0.2', '<' ) ) {
|
655 |
+
|
656 |
+
$this->log( 'Starting upgrade to 2.0.2' );
|
657 |
+
|
658 |
+
$cc_settings = get_option( 'woocommerce_braintree_credit_card_settings', array() );
|
659 |
+
|
660 |
+
// if the require CSC setting was never set, set it to avoid various false error notices
|
661 |
+
if ( ! empty( $cc_settings ) && empty( $cc_settings['require_csc'] ) ) {
|
662 |
+
|
663 |
+
$this->log( 'Updating missing CSC setting' );
|
664 |
+
|
665 |
+
$cc_settings['require_csc'] = 'yes';
|
666 |
+
|
667 |
+
update_option( 'woocommerce_braintree_credit_card_settings', $cc_settings );
|
668 |
+
}
|
669 |
+
|
670 |
+
$this->log( 'Completed upgrade for 2.0.2' );
|
671 |
+
}
|
672 |
}
|
673 |
|
674 |
|
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"
|
@@ -235,7 +235,7 @@ msgid ""
|
|
235 |
msgstr ""
|
236 |
|
237 |
#: includes/class-wc-gateway-braintree-credit-card.php:684
|
238 |
-
#: includes/class-wc-gateway-braintree.php:
|
239 |
msgid ""
|
240 |
"Oops, there was a temporary payment error. Please try another payment "
|
241 |
"method or contact us to complete your transaction."
|
@@ -249,60 +249,60 @@ msgstr ""
|
|
249 |
msgid "Allow customers to securely pay using their PayPal account via Braintree."
|
250 |
msgstr ""
|
251 |
|
252 |
-
#: includes/class-wc-gateway-braintree-paypal.php:
|
253 |
msgid "Token ID"
|
254 |
msgstr ""
|
255 |
|
256 |
-
#: includes/class-wc-gateway-braintree-paypal.php:
|
257 |
msgid "Email"
|
258 |
msgstr ""
|
259 |
|
260 |
-
#: includes/class-wc-gateway-braintree-paypal.php:
|
261 |
msgid "Use a new PayPal account"
|
262 |
msgstr ""
|
263 |
|
264 |
-
#: includes/class-wc-gateway-braintree-paypal.php:
|
265 |
msgid "PayPal Accounts"
|
266 |
msgstr ""
|
267 |
|
268 |
-
#: includes/class-wc-gateway-braintree-paypal.php:
|
269 |
msgid "Unlink"
|
270 |
msgstr ""
|
271 |
|
272 |
-
#: includes/class-wc-gateway-braintree-paypal.php:
|
273 |
#. translators: Placeholders: %1$s - payment method title (e.g. PayPal), %2$s -
|
274 |
#. transaction environment (either Sandbox or blank string), %3$s - type of
|
275 |
#. transaction (either Authorization or Payment)
|
276 |
msgid "%1$s %2$s %3$s Approved"
|
277 |
msgstr ""
|
278 |
|
279 |
-
#: includes/class-wc-gateway-braintree-paypal.php:
|
280 |
-
#: includes/class-wc-gateway-braintree.php:
|
281 |
msgid "Sandbox"
|
282 |
msgstr ""
|
283 |
|
284 |
-
#: includes/class-wc-gateway-braintree-paypal.php:
|
285 |
msgid "Authorization"
|
286 |
msgstr ""
|
287 |
|
288 |
-
#: includes/class-wc-gateway-braintree-paypal.php:
|
289 |
msgid "Payment"
|
290 |
msgstr ""
|
291 |
|
292 |
-
#: includes/class-wc-gateway-braintree-paypal.php:
|
293 |
#. translators: Placeholders: %s - transaction ID
|
294 |
msgid "(Transaction ID %s)"
|
295 |
msgstr ""
|
296 |
|
297 |
-
#: includes/class-wc-gateway-braintree-paypal.php:
|
298 |
msgid "PayPal Account Saved: %s"
|
299 |
msgstr ""
|
300 |
|
301 |
-
#: includes/class-wc-gateway-braintree-paypal.php:
|
302 |
msgid "PayPal"
|
303 |
msgstr ""
|
304 |
|
305 |
-
#: includes/class-wc-gateway-braintree-paypal.php:
|
306 |
msgid ""
|
307 |
"Click the PayPal icon below to sign into your PayPal account and pay "
|
308 |
"securely."
|
@@ -312,69 +312,69 @@ msgstr ""
|
|
312 |
msgid "Oops, something went wrong. Please try a different payment method."
|
313 |
msgstr ""
|
314 |
|
315 |
-
#: includes/class-wc-gateway-braintree.php:
|
316 |
msgid "Public Key"
|
317 |
msgstr ""
|
318 |
|
319 |
-
#: includes/class-wc-gateway-braintree.php:
|
320 |
msgid "The Public Key for your Braintree account."
|
321 |
msgstr ""
|
322 |
|
323 |
-
#: includes/class-wc-gateway-braintree.php:
|
324 |
msgid "Private Key"
|
325 |
msgstr ""
|
326 |
|
327 |
-
#: includes/class-wc-gateway-braintree.php:
|
328 |
msgid "The Private Key for your Braintree account."
|
329 |
msgstr ""
|
330 |
|
331 |
-
#: includes/class-wc-gateway-braintree.php:
|
332 |
msgid "Merchant ID"
|
333 |
msgstr ""
|
334 |
|
335 |
-
#: includes/class-wc-gateway-braintree.php:
|
336 |
msgid "The Merchant ID for your Braintree account."
|
337 |
msgstr ""
|
338 |
|
339 |
-
#: includes/class-wc-gateway-braintree.php:
|
340 |
msgid "Sandbox Public Key"
|
341 |
msgstr ""
|
342 |
|
343 |
-
#: includes/class-wc-gateway-braintree.php:
|
344 |
msgid "The Public Key for your Braintree sandbox account."
|
345 |
msgstr ""
|
346 |
|
347 |
-
#: includes/class-wc-gateway-braintree.php:
|
348 |
msgid "Sandbox Private Key"
|
349 |
msgstr ""
|
350 |
|
351 |
-
#: includes/class-wc-gateway-braintree.php:
|
352 |
msgid "The Private Key for your Braintree sandbox account."
|
353 |
msgstr ""
|
354 |
|
355 |
-
#: includes/class-wc-gateway-braintree.php:
|
356 |
msgid "Sandbox Merchant ID"
|
357 |
msgstr ""
|
358 |
|
359 |
-
#: includes/class-wc-gateway-braintree.php:
|
360 |
msgid "The Merchant ID for your Braintree sandbox account."
|
361 |
msgstr ""
|
362 |
|
363 |
-
#: includes/class-wc-gateway-braintree.php:
|
364 |
msgid "Merchant Account IDs"
|
365 |
msgstr ""
|
366 |
|
367 |
-
#: includes/class-wc-gateway-braintree.php:
|
368 |
msgid ""
|
369 |
"Enter additional merchant account IDs if you do not want to use your "
|
370 |
"Braintree account default. %1$sLearn more about merchant account IDs%2$s"
|
371 |
msgstr ""
|
372 |
|
373 |
-
#: includes/class-wc-gateway-braintree.php:
|
374 |
msgid "Dynamic Descriptors"
|
375 |
msgstr ""
|
376 |
|
377 |
-
#: includes/class-wc-gateway-braintree.php:
|
378 |
#. translators: Placeholders: %1$s - <p> tag, %2$s - </p> tag, %3$s - <a> tag,
|
379 |
#. %4$s - </a> tag
|
380 |
msgid ""
|
@@ -384,11 +384,11 @@ msgid ""
|
|
384 |
"dynamic descriptors%4$s and are using an accepted format.%2$s"
|
385 |
msgstr ""
|
386 |
|
387 |
-
#: includes/class-wc-gateway-braintree.php:
|
388 |
msgid "Name"
|
389 |
msgstr ""
|
390 |
|
391 |
-
#: includes/class-wc-gateway-braintree.php:
|
392 |
msgid ""
|
393 |
"The value in the business name field of a customer's statement. Company "
|
394 |
"name/DBA section must be either 3, 7 or 12 characters and the product "
|
@@ -396,77 +396,77 @@ msgid ""
|
|
396 |
"between for a total descriptor name of 22 characters)."
|
397 |
msgstr ""
|
398 |
|
399 |
-
#: includes/class-wc-gateway-braintree.php:
|
400 |
msgid "Phone"
|
401 |
msgstr ""
|
402 |
|
403 |
-
#: includes/class-wc-gateway-braintree.php:
|
404 |
msgid ""
|
405 |
"The value in the phone number field of a customer's statement. Phone must "
|
406 |
"be exactly 10 characters and can only contain numbers, dashes, parentheses "
|
407 |
"and periods."
|
408 |
msgstr ""
|
409 |
|
410 |
-
#: includes/class-wc-gateway-braintree.php:
|
411 |
msgid "URL"
|
412 |
msgstr ""
|
413 |
|
414 |
-
#: includes/class-wc-gateway-braintree.php:
|
415 |
msgid ""
|
416 |
"The value in the URL/web address field of a customer's statement. The URL "
|
417 |
"must be 13 characters or less."
|
418 |
msgstr ""
|
419 |
|
420 |
-
#: includes/class-wc-gateway-braintree.php:
|
421 |
msgid "Enter connection credentials manually"
|
422 |
msgstr ""
|
423 |
|
424 |
-
#: includes/class-wc-gateway-braintree.php:
|
425 |
msgid "Disabled because the other gateway is not connected manually."
|
426 |
msgstr ""
|
427 |
|
428 |
-
#: includes/class-wc-gateway-braintree.php:
|
429 |
msgid ""
|
430 |
"You just connected your Braintree account to WooCommerce. You can start "
|
431 |
"taking payments now."
|
432 |
msgstr ""
|
433 |
|
434 |
-
#: includes/class-wc-gateway-braintree.php:
|
435 |
msgid ""
|
436 |
"Once you have processed a payment, PayPal will review your application for "
|
437 |
"final approval. Before you ship any goods make sure you have received a "
|
438 |
"final approval for your Braintree account."
|
439 |
msgstr ""
|
440 |
|
441 |
-
#: includes/class-wc-gateway-braintree.php:
|
442 |
msgid "Questions? We are a phone call away: 1-855-489-0345."
|
443 |
msgstr ""
|
444 |
|
445 |
-
#: includes/class-wc-gateway-braintree.php:
|
446 |
msgid "Click button to create an account with Braintree and start transacting."
|
447 |
msgstr ""
|
448 |
|
449 |
-
#: includes/class-wc-gateway-braintree.php:
|
450 |
msgid "Add merchant account ID for %s"
|
451 |
msgstr ""
|
452 |
|
453 |
-
#: includes/class-wc-gateway-braintree.php:
|
454 |
msgid "Add merchant account ID for "
|
455 |
msgstr ""
|
456 |
|
457 |
-
#: includes/class-wc-gateway-braintree.php:
|
458 |
msgid "Merchant Account ID (%s)"
|
459 |
msgstr ""
|
460 |
|
461 |
-
#: includes/class-wc-gateway-braintree.php:
|
462 |
msgid "Enter merchant account ID"
|
463 |
msgstr ""
|
464 |
|
465 |
-
#: includes/class-wc-gateway-braintree.php:
|
466 |
msgid "Remove this merchant account ID"
|
467 |
msgstr ""
|
468 |
|
469 |
-
#: includes/class-wc-gateway-braintree.php:
|
470 |
msgid "Production"
|
471 |
msgstr ""
|
472 |
|
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.2\n"
|
6 |
"Report-Msgid-Bugs-To: "
|
7 |
"https://wordpress.org/support/plugin/woocommerce-gateway-paypal-powered-by-"
|
8 |
"braintree/\n"
|
235 |
msgstr ""
|
236 |
|
237 |
#: includes/class-wc-gateway-braintree-credit-card.php:684
|
238 |
+
#: includes/class-wc-gateway-braintree.php:163
|
239 |
msgid ""
|
240 |
"Oops, there was a temporary payment error. Please try another payment "
|
241 |
"method or contact us to complete your transaction."
|
249 |
msgid "Allow customers to securely pay using their PayPal account via Braintree."
|
250 |
msgstr ""
|
251 |
|
252 |
+
#: includes/class-wc-gateway-braintree-paypal.php:119
|
253 |
msgid "Token ID"
|
254 |
msgstr ""
|
255 |
|
256 |
+
#: includes/class-wc-gateway-braintree-paypal.php:124
|
257 |
msgid "Email"
|
258 |
msgstr ""
|
259 |
|
260 |
+
#: includes/class-wc-gateway-braintree-paypal.php:163
|
261 |
msgid "Use a new PayPal account"
|
262 |
msgstr ""
|
263 |
|
264 |
+
#: includes/class-wc-gateway-braintree-paypal.php:167
|
265 |
msgid "PayPal Accounts"
|
266 |
msgstr ""
|
267 |
|
268 |
+
#: includes/class-wc-gateway-braintree-paypal.php:188
|
269 |
msgid "Unlink"
|
270 |
msgstr ""
|
271 |
|
272 |
+
#: includes/class-wc-gateway-braintree-paypal.php:333
|
273 |
#. translators: Placeholders: %1$s - payment method title (e.g. PayPal), %2$s -
|
274 |
#. transaction environment (either Sandbox or blank string), %3$s - type of
|
275 |
#. transaction (either Authorization or Payment)
|
276 |
msgid "%1$s %2$s %3$s Approved"
|
277 |
msgstr ""
|
278 |
|
279 |
+
#: includes/class-wc-gateway-braintree-paypal.php:335
|
280 |
+
#: includes/class-wc-gateway-braintree.php:1348
|
281 |
msgid "Sandbox"
|
282 |
msgstr ""
|
283 |
|
284 |
+
#: includes/class-wc-gateway-braintree-paypal.php:336
|
285 |
msgid "Authorization"
|
286 |
msgstr ""
|
287 |
|
288 |
+
#: includes/class-wc-gateway-braintree-paypal.php:336
|
289 |
msgid "Payment"
|
290 |
msgstr ""
|
291 |
|
292 |
+
#: includes/class-wc-gateway-braintree-paypal.php:342
|
293 |
#. translators: Placeholders: %s - transaction ID
|
294 |
msgid "(Transaction ID %s)"
|
295 |
msgstr ""
|
296 |
|
297 |
+
#: includes/class-wc-gateway-braintree-paypal.php:363
|
298 |
msgid "PayPal Account Saved: %s"
|
299 |
msgstr ""
|
300 |
|
301 |
+
#: includes/class-wc-gateway-braintree-paypal.php:442
|
302 |
msgid "PayPal"
|
303 |
msgstr ""
|
304 |
|
305 |
+
#: includes/class-wc-gateway-braintree-paypal.php:456
|
306 |
msgid ""
|
307 |
"Click the PayPal icon below to sign into your PayPal account and pay "
|
308 |
"securely."
|
312 |
msgid "Oops, something went wrong. Please try a different payment method."
|
313 |
msgstr ""
|
314 |
|
315 |
+
#: includes/class-wc-gateway-braintree.php:340
|
316 |
msgid "Public Key"
|
317 |
msgstr ""
|
318 |
|
319 |
+
#: includes/class-wc-gateway-braintree.php:343
|
320 |
msgid "The Public Key for your Braintree account."
|
321 |
msgstr ""
|
322 |
|
323 |
+
#: includes/class-wc-gateway-braintree.php:347
|
324 |
msgid "Private Key"
|
325 |
msgstr ""
|
326 |
|
327 |
+
#: includes/class-wc-gateway-braintree.php:350
|
328 |
msgid "The Private Key for your Braintree account."
|
329 |
msgstr ""
|
330 |
|
331 |
+
#: includes/class-wc-gateway-braintree.php:354
|
332 |
msgid "Merchant ID"
|
333 |
msgstr ""
|
334 |
|
335 |
+
#: includes/class-wc-gateway-braintree.php:357
|
336 |
msgid "The Merchant ID for your Braintree account."
|
337 |
msgstr ""
|
338 |
|
339 |
+
#: includes/class-wc-gateway-braintree.php:362
|
340 |
msgid "Sandbox Public Key"
|
341 |
msgstr ""
|
342 |
|
343 |
+
#: includes/class-wc-gateway-braintree.php:365
|
344 |
msgid "The Public Key for your Braintree sandbox account."
|
345 |
msgstr ""
|
346 |
|
347 |
+
#: includes/class-wc-gateway-braintree.php:369
|
348 |
msgid "Sandbox Private Key"
|
349 |
msgstr ""
|
350 |
|
351 |
+
#: includes/class-wc-gateway-braintree.php:372
|
352 |
msgid "The Private Key for your Braintree sandbox account."
|
353 |
msgstr ""
|
354 |
|
355 |
+
#: includes/class-wc-gateway-braintree.php:376
|
356 |
msgid "Sandbox Merchant ID"
|
357 |
msgstr ""
|
358 |
|
359 |
+
#: includes/class-wc-gateway-braintree.php:379
|
360 |
msgid "The Merchant ID for your Braintree sandbox account."
|
361 |
msgstr ""
|
362 |
|
363 |
+
#: includes/class-wc-gateway-braintree.php:384
|
364 |
msgid "Merchant Account IDs"
|
365 |
msgstr ""
|
366 |
|
367 |
+
#: includes/class-wc-gateway-braintree.php:387
|
368 |
msgid ""
|
369 |
"Enter additional merchant account IDs if you do not want to use your "
|
370 |
"Braintree account default. %1$sLearn more about merchant account IDs%2$s"
|
371 |
msgstr ""
|
372 |
|
373 |
+
#: includes/class-wc-gateway-braintree.php:396
|
374 |
msgid "Dynamic Descriptors"
|
375 |
msgstr ""
|
376 |
|
377 |
+
#: includes/class-wc-gateway-braintree.php:399
|
378 |
#. translators: Placeholders: %1$s - <p> tag, %2$s - </p> tag, %3$s - <a> tag,
|
379 |
#. %4$s - </a> tag
|
380 |
msgid ""
|
384 |
"dynamic descriptors%4$s and are using an accepted format.%2$s"
|
385 |
msgstr ""
|
386 |
|
387 |
+
#: includes/class-wc-gateway-braintree.php:403
|
388 |
msgid "Name"
|
389 |
msgstr ""
|
390 |
|
391 |
+
#: includes/class-wc-gateway-braintree.php:406
|
392 |
msgid ""
|
393 |
"The value in the business name field of a customer's statement. Company "
|
394 |
"name/DBA section must be either 3, 7 or 12 characters and the product "
|
396 |
"between for a total descriptor name of 22 characters)."
|
397 |
msgstr ""
|
398 |
|
399 |
+
#: includes/class-wc-gateway-braintree.php:411
|
400 |
msgid "Phone"
|
401 |
msgstr ""
|
402 |
|
403 |
+
#: includes/class-wc-gateway-braintree.php:414
|
404 |
msgid ""
|
405 |
"The value in the phone number field of a customer's statement. Phone must "
|
406 |
"be exactly 10 characters and can only contain numbers, dashes, parentheses "
|
407 |
"and periods."
|
408 |
msgstr ""
|
409 |
|
410 |
+
#: includes/class-wc-gateway-braintree.php:419
|
411 |
msgid "URL"
|
412 |
msgstr ""
|
413 |
|
414 |
+
#: includes/class-wc-gateway-braintree.php:422
|
415 |
msgid ""
|
416 |
"The value in the URL/web address field of a customer's statement. The URL "
|
417 |
"must be 13 characters or less."
|
418 |
msgstr ""
|
419 |
|
420 |
+
#: includes/class-wc-gateway-braintree.php:455
|
421 |
msgid "Enter connection credentials manually"
|
422 |
msgstr ""
|
423 |
|
424 |
+
#: includes/class-wc-gateway-braintree.php:479
|
425 |
msgid "Disabled because the other gateway is not connected manually."
|
426 |
msgstr ""
|
427 |
|
428 |
+
#: includes/class-wc-gateway-braintree.php:498
|
429 |
msgid ""
|
430 |
"You just connected your Braintree account to WooCommerce. You can start "
|
431 |
"taking payments now."
|
432 |
msgstr ""
|
433 |
|
434 |
+
#: includes/class-wc-gateway-braintree.php:499
|
435 |
msgid ""
|
436 |
"Once you have processed a payment, PayPal will review your application for "
|
437 |
"final approval. Before you ship any goods make sure you have received a "
|
438 |
"final approval for your Braintree account."
|
439 |
msgstr ""
|
440 |
|
441 |
+
#: includes/class-wc-gateway-braintree.php:500
|
442 |
msgid "Questions? We are a phone call away: 1-855-489-0345."
|
443 |
msgstr ""
|
444 |
|
445 |
+
#: includes/class-wc-gateway-braintree.php:505
|
446 |
msgid "Click button to create an account with Braintree and start transacting."
|
447 |
msgstr ""
|
448 |
|
449 |
+
#: includes/class-wc-gateway-braintree.php:620
|
450 |
msgid "Add merchant account ID for %s"
|
451 |
msgstr ""
|
452 |
|
453 |
+
#: includes/class-wc-gateway-braintree.php:725
|
454 |
msgid "Add merchant account ID for "
|
455 |
msgstr ""
|
456 |
|
457 |
+
#: includes/class-wc-gateway-braintree.php:823
|
458 |
msgid "Merchant Account ID (%s)"
|
459 |
msgstr ""
|
460 |
|
461 |
+
#: includes/class-wc-gateway-braintree.php:834
|
462 |
msgid "Enter merchant account ID"
|
463 |
msgstr ""
|
464 |
|
465 |
+
#: includes/class-wc-gateway-braintree.php:835
|
466 |
msgid "Remove this merchant account ID"
|
467 |
msgstr ""
|
468 |
|
469 |
+
#: includes/class-wc-gateway-braintree.php:1348
|
470 |
msgid "Production"
|
471 |
msgstr ""
|
472 |
|
includes/api/responses/abstract-wc-braintree-api-response.php
CHANGED
@@ -203,7 +203,7 @@ abstract class WC_Braintree_API_Response implements WC_Braintree_Framework\SV_WC
|
|
203 |
default:
|
204 |
$status = array(
|
205 |
'code' => $transaction->status,
|
206 |
-
'message' => $this->response->message,
|
207 |
);
|
208 |
}
|
209 |
|
203 |
default:
|
204 |
$status = array(
|
205 |
'code' => $transaction->status,
|
206 |
+
'message' => isset( $this->response->message ) ? $this->response->message : '',
|
207 |
);
|
208 |
}
|
209 |
|
includes/class-wc-gateway-braintree-paypal.php
CHANGED
@@ -102,9 +102,6 @@ class WC_Gateway_Braintree_PayPal extends WC_Gateway_Braintree {
|
|
102 |
$params['cart_handler_url'] = add_query_arg( 'wc-api', get_class( $this ), home_url() );
|
103 |
}
|
104 |
|
105 |
-
// add a cart payment nonce if available
|
106 |
-
$params['cart_payment_nonce'] = $this->get_plugin()->get_paypal_cart_instance()->get_cart_nonce();
|
107 |
-
|
108 |
return $params;
|
109 |
}
|
110 |
|
102 |
$params['cart_handler_url'] = add_query_arg( 'wc-api', get_class( $this ), home_url() );
|
103 |
}
|
104 |
|
|
|
|
|
|
|
105 |
return $params;
|
106 |
}
|
107 |
|
includes/class-wc-gateway-braintree.php
CHANGED
@@ -139,6 +139,11 @@ class WC_Gateway_Braintree extends WC_Braintree_Framework\SV_WC_Payment_Gateway_
|
|
139 |
}
|
140 |
}
|
141 |
|
|
|
|
|
|
|
|
|
|
|
142 |
return $params;
|
143 |
}
|
144 |
|
@@ -215,13 +220,35 @@ class WC_Gateway_Braintree extends WC_Braintree_Framework\SV_WC_Payment_Gateway_
|
|
215 |
}
|
216 |
|
217 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
218 |
/**
|
219 |
* Determines if the authorization for an order has expired.
|
220 |
*
|
221 |
* Overridden to add the transaction date to legacy orders since the v1.x
|
222 |
* plugin didn't set its own transaction date meta.
|
223 |
*
|
224 |
-
* @see \SV_WC_Payment_Gateway::has_authorization_expired()
|
225 |
* @since 2.0.0
|
226 |
* @param \WC_Order $order the order object
|
227 |
* @return bool
|
@@ -232,8 +259,10 @@ class WC_Gateway_Braintree extends WC_Braintree_Framework\SV_WC_Payment_Gateway_
|
|
232 |
$this->update_order_meta( $order, 'trans_id', WC_Braintree_Framework\SV_WC_Order_Compatibility::get_prop( $order, 'transaction_id' ) );
|
233 |
}
|
234 |
|
235 |
-
|
236 |
-
|
|
|
|
|
237 |
}
|
238 |
|
239 |
return parent::has_authorization_expired( $order );
|
@@ -868,6 +897,58 @@ class WC_Gateway_Braintree extends WC_Braintree_Framework\SV_WC_Payment_Gateway_
|
|
868 |
/** Getters ***************************************************************/
|
869 |
|
870 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
871 |
/**
|
872 |
* Returns the customer ID for the given user ID. Braintree provides a customer
|
873 |
* ID after creation.
|
139 |
}
|
140 |
}
|
141 |
|
142 |
+
// add a cart payment nonce if available
|
143 |
+
if ( $this->get_plugin()->get_paypal_cart_instance() ) {
|
144 |
+
$params['cart_payment_nonce'] = $this->get_plugin()->get_paypal_cart_instance()->get_cart_nonce();
|
145 |
+
}
|
146 |
+
|
147 |
return $params;
|
148 |
}
|
149 |
|
220 |
}
|
221 |
|
222 |
|
223 |
+
/**
|
224 |
+
* Determines if the authorization for an order is valid for capture.
|
225 |
+
*
|
226 |
+
* Overridden to add the capture status to legacy orders since the v1 plugin
|
227 |
+
* may not have set it.
|
228 |
+
*
|
229 |
+
* @see \SkyVerge\Plugin_Framework\SV_WC_Payment_Gateway::has_authorization_expired()
|
230 |
+
* @since 2.0.2
|
231 |
+
* @param \WC_Order $order order object
|
232 |
+
* @return bool
|
233 |
+
*/
|
234 |
+
public function authorization_valid_for_capture( $order ) {
|
235 |
+
|
236 |
+
// if v1 never set the capture status, assume it has been captured
|
237 |
+
if ( ! in_array( $this->get_order_meta( $order, 'charge_captured' ), array( 'yes', 'no' ), true ) ) {
|
238 |
+
$this->update_order_meta( $order, 'charge_captured', 'yes' );
|
239 |
+
}
|
240 |
+
|
241 |
+
return parent::authorization_valid_for_capture( $order );
|
242 |
+
}
|
243 |
+
|
244 |
+
|
245 |
/**
|
246 |
* Determines if the authorization for an order has expired.
|
247 |
*
|
248 |
* Overridden to add the transaction date to legacy orders since the v1.x
|
249 |
* plugin didn't set its own transaction date meta.
|
250 |
*
|
251 |
+
* @see \SkyVerge\Plugin_Framework\SV_WC_Payment_Gateway::has_authorization_expired()
|
252 |
* @since 2.0.0
|
253 |
* @param \WC_Order $order the order object
|
254 |
* @return bool
|
259 |
$this->update_order_meta( $order, 'trans_id', WC_Braintree_Framework\SV_WC_Order_Compatibility::get_prop( $order, 'transaction_id' ) );
|
260 |
}
|
261 |
|
262 |
+
$date_created = WC_Braintree_Framework\SV_WC_Order_Compatibility::get_date_created( $order );
|
263 |
+
|
264 |
+
if ( ! $this->get_order_meta( $order, 'trans_date' ) && $date_created ) {
|
265 |
+
$this->update_order_meta( $order, 'trans_date', $date_created->date( 'Y-m-d H:i:s' ) );
|
266 |
}
|
267 |
|
268 |
return parent::has_authorization_expired( $order );
|
897 |
/** Getters ***************************************************************/
|
898 |
|
899 |
|
900 |
+
/**
|
901 |
+
* Gets order meta.
|
902 |
+
*
|
903 |
+
* Overridden to account for some straggling meta that may be leftover from
|
904 |
+
* the v1 in certain cases when WC was updated to 3.0 before Subscriptions.
|
905 |
+
*
|
906 |
+
* @since 2.0.2
|
907 |
+
*
|
908 |
+
* @param \WC_Order|int $order order object or ID
|
909 |
+
* @param string $key meta key to get
|
910 |
+
* @return mixed meta value
|
911 |
+
*/
|
912 |
+
public function get_order_meta( $order, $key ) {
|
913 |
+
|
914 |
+
if ( is_numeric( $order ) ) {
|
915 |
+
$order = wc_get_order( $order );
|
916 |
+
}
|
917 |
+
|
918 |
+
if ( ! $order ) {
|
919 |
+
return false;
|
920 |
+
}
|
921 |
+
|
922 |
+
$order_id = WC_Braintree_Framework\SV_WC_Order_Compatibility::get_prop( $order, 'id' );
|
923 |
+
|
924 |
+
// update a legacy payment token if it exists
|
925 |
+
if ( 'payment_token' === $key && metadata_exists( 'post', $order_id, '_wc_paypal_braintree_payment_method_token' ) && ! get_post_meta( $order_id, $this->get_order_meta_prefix() . $key, true ) && $this->get_id() === get_post_meta( $order_id, '_payment_method', true ) ) {
|
926 |
+
|
927 |
+
$legacy_token = get_post_meta( $order_id, '_wc_paypal_braintree_payment_method_token', true );
|
928 |
+
|
929 |
+
update_post_meta( $order_id, $this->get_order_meta_prefix() . $key, $legacy_token );
|
930 |
+
|
931 |
+
delete_post_meta( $order_id, '_wc_paypal_braintree_payment_method_token' );
|
932 |
+
|
933 |
+
return $legacy_token;
|
934 |
+
}
|
935 |
+
|
936 |
+
// update a legacy customer ID if it exists
|
937 |
+
if ( 'customer_id' === $key && metadata_exists( 'post', $order_id, '_wc_paypal_braintree_customer_id' ) && ! get_post_meta( $order_id, $this->get_order_meta_prefix() . $key, true ) && $this->get_id() === get_post_meta( $order_id, '_payment_method', true ) ) {
|
938 |
+
|
939 |
+
$legacy_customer_id = get_post_meta( $order_id, '_wc_paypal_braintree_customer_id', true );
|
940 |
+
|
941 |
+
update_post_meta( $order_id, $this->get_order_meta_prefix() . $key, $legacy_customer_id );
|
942 |
+
|
943 |
+
delete_post_meta( $order_id, '_wc_paypal_braintree_customer_id' );
|
944 |
+
|
945 |
+
return $legacy_customer_id;
|
946 |
+
}
|
947 |
+
|
948 |
+
return parent::get_order_meta( $order, $key );
|
949 |
+
}
|
950 |
+
|
951 |
+
|
952 |
/**
|
953 |
* Returns the customer ID for the given user ID. Braintree provides a customer
|
954 |
* ID after creation.
|
includes/payment-forms/class-wc-braintree-paypal-payment-form.php
CHANGED
@@ -104,33 +104,18 @@ class WC_Braintree_PayPal_Payment_Form extends WC_Braintree_Payment_Form {
|
|
104 |
*/
|
105 |
public function render_payment_fields() {
|
106 |
|
107 |
-
|
108 |
|
109 |
-
|
110 |
-
if ( $cart_handler->is_checkout_confirmation() ) {
|
111 |
|
112 |
-
|
113 |
-
type="hidden"
|
114 |
-
id="' . esc_attr( 'wc_' . $this->get_gateway()->get_id() . '_payment_nonce' ) . '"
|
115 |
-
name="' . esc_attr( 'wc_' . $this->get_gateway()->get_id() . '_payment_nonce' ) . '"
|
116 |
-
value="' . esc_attr( $cart_handler->get_cart_nonce() ) . '"
|
117 |
-
/>';
|
118 |
|
119 |
-
|
|
|
|
|
|
|
120 |
|
121 |
-
|
122 |
-
|
123 |
-
$order_total = $this->get_order_total();
|
124 |
-
|
125 |
-
?>
|
126 |
-
|
127 |
-
<div id="wc_braintree_paypal_container"></div>
|
128 |
-
<input type="hidden" name="wc_braintree_paypal_amount" value="<?php echo esc_attr( WC_Braintree_Framework\SV_WC_Helper::number_format( $order_total, 2 ) ); ?>" />
|
129 |
-
<input type="hidden" name="wc_braintree_paypal_currency" value="<?php echo esc_attr( get_woocommerce_currency() ); ?>" />
|
130 |
-
<input type="hidden" name="wc_braintree_paypal_locale" value="<?php echo esc_attr( $this->get_gateway()->get_safe_locale() ); ?>" />
|
131 |
-
|
132 |
-
<?php
|
133 |
-
}
|
134 |
}
|
135 |
|
136 |
|
104 |
*/
|
105 |
public function render_payment_fields() {
|
106 |
|
107 |
+
parent::render_payment_fields();
|
108 |
|
109 |
+
$order_total = $this->get_order_total();
|
|
|
110 |
|
111 |
+
?>
|
|
|
|
|
|
|
|
|
|
|
112 |
|
113 |
+
<div id="wc_braintree_paypal_container"></div>
|
114 |
+
<input type="hidden" name="wc_braintree_paypal_amount" value="<?php echo esc_attr( WC_Braintree_Framework\SV_WC_Helper::number_format( $order_total, 2 ) ); ?>" />
|
115 |
+
<input type="hidden" name="wc_braintree_paypal_currency" value="<?php echo esc_attr( get_woocommerce_currency() ); ?>" />
|
116 |
+
<input type="hidden" name="wc_braintree_paypal_locale" value="<?php echo esc_attr( $this->get_gateway()->get_safe_locale() ); ?>" />
|
117 |
|
118 |
+
<?php
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
119 |
}
|
120 |
|
121 |
|
lib/skyverge/woocommerce/payment-gateway/class-sv-wc-payment-gateway.php
CHANGED
@@ -589,7 +589,7 @@ abstract class SV_WC_Payment_Gateway extends \WC_Payment_Gateway {
|
|
589 |
*/
|
590 |
protected function get_order_button_text() {
|
591 |
|
592 |
-
$text = $this->is_hosted_gateway() ? esc_html__( 'Continue', 'woocommerce-plugin-framework' ) :
|
593 |
|
594 |
/**
|
595 |
* Payment Gateway Place Order Button Text Filter.
|
589 |
*/
|
590 |
protected function get_order_button_text() {
|
591 |
|
592 |
+
$text = $this->is_hosted_gateway() ? esc_html__( 'Continue', 'woocommerce-plugin-framework' ) : '';
|
593 |
|
594 |
/**
|
595 |
* Payment Gateway Place Order Button Text Filter.
|
lib/skyverge/woocommerce/payment-gateway/integrations/class-sv-wc-payment-gateway-integration-subscriptions.php
CHANGED
@@ -95,6 +95,9 @@ class SV_WC_Payment_Gateway_Integration_Subscriptions extends SV_WC_Payment_Gate
|
|
95 |
// don't copy over order-specific meta to the WC_Subscription object during renewal processing
|
96 |
add_filter( 'wcs_renewal_order_meta', array( $this, 'do_not_copy_order_meta' ) );
|
97 |
|
|
|
|
|
|
|
98 |
// remove order-specific meta from the Subscription object after the change payment method action
|
99 |
add_filter( 'woocommerce_subscriptions_process_payment_for_change_method_via_pay_shortcode', array( $this, 'remove_order_meta_from_change_payment' ), 10, 2 );
|
100 |
|
@@ -327,6 +330,70 @@ class SV_WC_Payment_Gateway_Integration_Subscriptions extends SV_WC_Payment_Gate
|
|
327 |
}
|
328 |
|
329 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
330 |
/**
|
331 |
* Remove order meta (like trans ID) that's added to a Subscription object
|
332 |
* during the change payment method flow, which uses WC_Payment_Gateway::process_payment(),
|
@@ -346,7 +413,7 @@ class SV_WC_Payment_Gateway_Integration_Subscriptions extends SV_WC_Payment_Gate
|
|
346 |
}
|
347 |
|
348 |
$old_payment_method = SV_WC_Order_Compatibility::get_meta( $subscription, '_old_payment_method' );
|
349 |
-
$new_payment_method = SV_WC_Order_Compatibility::
|
350 |
|
351 |
// if the payment method has been changed to another gateway, additionally remove the old payment token and customer ID meta
|
352 |
if ( $new_payment_method !== $this->get_gateway()->get_id() && $old_payment_method === $this->get_gateway()->get_id() ) {
|
@@ -571,7 +638,10 @@ class SV_WC_Payment_Gateway_Integration_Subscriptions extends SV_WC_Payment_Gate
|
|
571 |
|
572 |
foreach ( $subscriptions as $key => $subscription ) {
|
573 |
|
574 |
-
|
|
|
|
|
|
|
575 |
unset( $subscriptions[ $key ] );
|
576 |
}
|
577 |
}
|
95 |
// don't copy over order-specific meta to the WC_Subscription object during renewal processing
|
96 |
add_filter( 'wcs_renewal_order_meta', array( $this, 'do_not_copy_order_meta' ) );
|
97 |
|
98 |
+
// process the Change Payment "transaction"
|
99 |
+
add_filter( 'wc_payment_gateway_' . $this->get_gateway()->get_id() . '_process_payment', array( $this, 'process_change_payment' ), 10, 3 );
|
100 |
+
|
101 |
// remove order-specific meta from the Subscription object after the change payment method action
|
102 |
add_filter( 'woocommerce_subscriptions_process_payment_for_change_method_via_pay_shortcode', array( $this, 'remove_order_meta_from_change_payment' ), 10, 2 );
|
103 |
|
330 |
}
|
331 |
|
332 |
|
333 |
+
/**
|
334 |
+
* Processes a Change Payment transaction.
|
335 |
+
*
|
336 |
+
* This hooks in before standard payment processing to simply add or create
|
337 |
+
* token data and avoid certain failure conditions affecting the subscription
|
338 |
+
* object.
|
339 |
+
*
|
340 |
+
* @internal
|
341 |
+
*
|
342 |
+
* @since 4.6.4
|
343 |
+
*
|
344 |
+
* @param bool|array $result result from any others filtering this
|
345 |
+
* @param int $order_id an order or subscription ID
|
346 |
+
* @param \SV_WC_Payment_Gateway_Direct $gateway gateway object
|
347 |
+
* @return array $result change payment result
|
348 |
+
*/
|
349 |
+
public function process_change_payment( $result, $order_id, $gateway ) {
|
350 |
+
|
351 |
+
// if this is not a subscription and not changing payment, bail for normal order processing
|
352 |
+
if ( ! wcs_is_subscription( $order_id ) || ! did_action( 'woocommerce_subscription_change_payment_method_via_pay_shortcode' ) ) {
|
353 |
+
return $result;
|
354 |
+
}
|
355 |
+
|
356 |
+
$subscription = $gateway->get_order( $order_id );
|
357 |
+
|
358 |
+
try {
|
359 |
+
|
360 |
+
// if using a saved method, just add the data
|
361 |
+
if ( isset( $subscription->payment->token ) && $subscription->payment->token ) {
|
362 |
+
|
363 |
+
$gateway->add_transaction_data( $subscription );
|
364 |
+
|
365 |
+
// otherwise...tokenize
|
366 |
+
} else {
|
367 |
+
|
368 |
+
$subscription = $gateway->get_payment_tokens_handler()->create_token( $subscription );
|
369 |
+
}
|
370 |
+
|
371 |
+
$result = array(
|
372 |
+
'result' => 'success',
|
373 |
+
'redirect' => $subscription->get_view_order_url(),
|
374 |
+
);
|
375 |
+
|
376 |
+
} catch( SV_WC_Payment_Gateway_Exception $e ) {
|
377 |
+
|
378 |
+
/* translators: Placeholders: %1$s - payment gateway title, %2$s - error message; e.g. Order Note: [Payment method] Payment Change failed [error] */
|
379 |
+
$note = sprintf( __( '%1$s Payment Change Failed (%2$s)', 'woocommerce-plugin-framework' ), $gateway->get_method_title(), $e->getMessage() );
|
380 |
+
|
381 |
+
// add a subscription note to keep track of failures
|
382 |
+
$subscription->add_order_note( $note );
|
383 |
+
|
384 |
+
SV_WC_Helper::wc_add_notice( __( 'An error occurred, please try again or try an alternate form of payment.', 'woocommerce-plugin-framework' ), 'error' );
|
385 |
+
|
386 |
+
// this isn't used by Subscriptions, but return a failure result anyway
|
387 |
+
$result = array(
|
388 |
+
'result' => 'failure',
|
389 |
+
'message' => $e->getMessage(),
|
390 |
+
);
|
391 |
+
}
|
392 |
+
|
393 |
+
return $result;
|
394 |
+
}
|
395 |
+
|
396 |
+
|
397 |
/**
|
398 |
* Remove order meta (like trans ID) that's added to a Subscription object
|
399 |
* during the change payment method flow, which uses WC_Payment_Gateway::process_payment(),
|
413 |
}
|
414 |
|
415 |
$old_payment_method = SV_WC_Order_Compatibility::get_meta( $subscription, '_old_payment_method' );
|
416 |
+
$new_payment_method = SV_WC_Order_Compatibility::get_prop( $subscription, 'payment_method' );
|
417 |
|
418 |
// if the payment method has been changed to another gateway, additionally remove the old payment token and customer ID meta
|
419 |
if ( $new_payment_method !== $this->get_gateway()->get_id() && $old_payment_method === $this->get_gateway()->get_id() ) {
|
638 |
|
639 |
foreach ( $subscriptions as $key => $subscription ) {
|
640 |
|
641 |
+
$payment_method = SV_WC_Order_Compatibility::get_prop( $subscription, 'payment_method' );
|
642 |
+
$stored_token_id = $this->get_gateway()->get_order_meta( SV_WC_Order_Compatibility::get_prop( $subscription, 'id' ), 'payment_token' );
|
643 |
+
|
644 |
+
if ( $stored_token_id !== $token->get_id() || $payment_method !== $this->get_gateway()->get_id() ) {
|
645 |
unset( $subscriptions[ $key ] );
|
646 |
}
|
647 |
}
|
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.7.
|
6 |
-
Stable tag: 2.0.
|
7 |
License: GPLv3
|
8 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
9 |
|
@@ -122,6 +122,14 @@ New feature requests and bugs reports can be made in the plugin forum.
|
|
122 |
|
123 |
== Changelog ==
|
124 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
125 |
= 2.0.1 =
|
126 |
* Fix - Purchasing a subscription with PayPal could lead to a blank order note being added
|
127 |
* Fix - Ensure all upgrade routines run for users who have used both the SkyVerge Braintree and PayPal Powered by Braintree v1 in the past
|
@@ -211,8 +219,6 @@ New feature requests and bugs reports can be made in the plugin forum.
|
|
211 |
|
212 |
== Upgrade Notice ==
|
213 |
|
214 |
-
= 2.
|
215 |
-
* Fix -
|
216 |
-
* Fix -
|
217 |
-
* Fix - Issue where existing subscriptions in some cases couldn't switch to using a new PayPal account
|
218 |
-
* Fix - Ensure "Place Order" button always remains visible for PayPal when accepting terms
|
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.7.5
|
6 |
+
Stable tag: 2.0.2
|
7 |
License: GPLv3
|
8 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
9 |
|
122 |
|
123 |
== Changelog ==
|
124 |
|
125 |
+
= 2.0.2 =
|
126 |
+
* Fix - Ensure refunds succeed for legacy orders that are missing the necessary meta data
|
127 |
+
* Fix - Add fallbacks for certain subscriptions upgrades after WooCommerce 3.0 compatibility issues
|
128 |
+
* Fix - Default set the Require CSC setting for legacy upgrades to avoid inaccurate error notices at checkout
|
129 |
+
* Fix - Prevent PayPal JavaScript errors in certain cases
|
130 |
+
* Fix - Ensure subscriptions are not affected if Change Payment fails due to declines or other problems
|
131 |
+
* Fix - Ensure old payment methods can be removed by the customer after changing subscription payment to a new method
|
132 |
+
|
133 |
= 2.0.1 =
|
134 |
* Fix - Purchasing a subscription with PayPal could lead to a blank order note being added
|
135 |
* Fix - Ensure all upgrade routines run for users who have used both the SkyVerge Braintree and PayPal Powered by Braintree v1 in the past
|
219 |
|
220 |
== Upgrade Notice ==
|
221 |
|
222 |
+
= 1.2.4 =
|
223 |
+
* Fix - Free subscription trials not allowed.
|
224 |
+
* 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.2
|
9 |
*
|
10 |
* Copyright (c) 2016-2017, Automattic, Inc.
|
11 |
*
|