Payment Plugins for Stripe WooCommerce - Version 3.3.6

Version Description

  • Added - WooFunnels integration that supports credit cards, Apple Pay, GPay, and Payment Request gateway
  • Added - Support for "WooCommerce All Products For Subscriptions" plugin
  • Added - Round GPay totals to 2 decimals points since GPay will only accept a maximum of 2 decimals
  • Fixed - Klarna ensure item totals always add up to order total to prevent "Bad Value" error.
Download this release

Release Info

Developer mr.clayton
Plugin Icon wp plugin Payment Plugins for Stripe WooCommerce
Version 3.3.6
Comparing to
See all releases

Code changes from version 3.3.5 to 3.3.6

assets/js/frontend/wc-stripe.js CHANGED
@@ -997,7 +997,7 @@
997
 
998
 
999
  wc_stripe.CheckoutGateway.prototype.is_valid_checkout = function () {
1000
- if ($('[name="terms"]').length) {
1001
  if (!$('[name="terms"]').is(':checked')) {
1002
  return false;
1003
  }
@@ -1281,21 +1281,32 @@
1281
  this.set_gateway_data(data);
1282
  };
1283
 
 
 
 
 
1284
  wc_stripe.ProductGateway.prototype.add_to_cart = function () {
1285
  return new Promise(function (resolve, reject) {
1286
  this.block();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1287
  $.ajax({
1288
  url: this.params.routes.add_to_cart,
1289
  method: 'POST',
1290
  dataType: 'json',
1291
- data: $.extend({}, {
1292
- product_id: this.get_product_data().id,
1293
- variation_id: this.is_variable_product() ? $('[name="variation_id"]').val() : 0,
1294
- qty: $('[name="quantity"]').val(),
1295
- payment_method: this.gateway_id,
1296
- currency: this.get_currency(),
1297
- page_id: this.get_page()
1298
- }, this.get_product_variations()),
1299
  beforeSend: this.ajax_before_send.bind(this)
1300
  }).done(function (response) {
1301
  this.unblock();
997
 
998
 
999
  wc_stripe.CheckoutGateway.prototype.is_valid_checkout = function () {
1000
+ if ($('[name="terms"]').length && $('[name="terms"]').is(':visible')) {
1001
  if (!$('[name="terms"]').is(':checked')) {
1002
  return false;
1003
  }
1281
  this.set_gateway_data(data);
1282
  };
1283
 
1284
+ wc_stripe.ProductGateway.prototype.get_form = function () {
1285
+ return $(this.container).closest('form');
1286
+ }
1287
+
1288
  wc_stripe.ProductGateway.prototype.add_to_cart = function () {
1289
  return new Promise(function (resolve, reject) {
1290
  this.block();
1291
+ var data = {
1292
+ product_id: this.get_product_data().id,
1293
+ variation_id: this.is_variable_product() ? $('[name="variation_id"]').val() : 0,
1294
+ qty: $('[name="quantity"]').val(),
1295
+ payment_method: this.gateway_id,
1296
+ currency: this.get_currency(),
1297
+ page_id: this.get_page()
1298
+ };
1299
+ var fields = this.get_form().find(':not([name="add-to-cart"],[name="quantity"],[name^="attribute_"],[name="variation_id"])').serializeArray();
1300
+ if (fields) {
1301
+ for (var i in fields) {
1302
+ data[fields[i].name] = fields[i].value;
1303
+ }
1304
+ }
1305
  $.ajax({
1306
  url: this.params.routes.add_to_cart,
1307
  method: 'POST',
1308
  dataType: 'json',
1309
+ data: $.extend({}, data, this.get_product_variations()),
 
 
 
 
 
 
 
1310
  beforeSend: this.ajax_before_send.bind(this)
1311
  }).done(function (response) {
1312
  this.unblock();
assets/js/frontend/wc-stripe.min.js CHANGED
@@ -1 +1 @@
1
- !function(a,o){a.wc_stripe={};var i=null;"undefined"==typeof wc_stripe_checkout_fields&&(a.wc_stripe_checkout_fields=[]),wc_stripe.BaseGateway=function(t,e){this.params=t,this.gateway_id=this.params.gateway_id,this.container=void 0===e?"li.payment_method_".concat(this.gateway_id):e,o(this.container).length||(this.container=".payment_method_".concat(this.gateway_id)),this.token_selector=this.params.token_selector,this.saved_method_selector=this.params.saved_method_selector,this.payment_token_received=!1,this.stripe=i,this.fields=r,this.elements=i.elements(o.extend({},{locale:"auto"},this.get_element_options())),this.initialize()},wc_stripe.BaseGateway.prototype.get_page=function(){var t=wc_stripe_params_v3.page;return"cart"===t&&o(document.body).is(".woocommerce-checkout")&&(t="checkout"),t},wc_stripe.BaseGateway.prototype.set_nonce=function(t){this.fields.set(this.gateway_id+"_token_key",t),o(this.token_selector).val(t)},wc_stripe.BaseGateway.prototype.get_element_options=function(){return{}},wc_stripe.BaseGateway.prototype.initialize=function(){},wc_stripe.BaseGateway.prototype.create_button=function(){},wc_stripe.BaseGateway.prototype.is_gateway_selected=function(){return o('[name="payment_method"]:checked').val()===this.gateway_id},wc_stripe.BaseGateway.prototype.is_saved_method_selected=function(){return this.is_gateway_selected()&&"saved"===o('[name="'+this.gateway_id+'_payment_type_key"]:checked').val()},wc_stripe.BaseGateway.prototype.has_checkout_error=function(){return 0<o("#wc_stripe_checkout_error").length&&this.is_gateway_selected()},wc_stripe.BaseGateway.prototype.submit_error=function(t){var e=this.get_error_message(t);e.indexOf("</ul>")<0&&(e='<div class="'+function(){var t="woocommerce-NoticeGroup";return this.is_current_page("checkout")&&(t+=" woocommerce-NoticeGroup-checkout"),t}.bind(this)()+'"><ul class="woocommerce-error"><li>'+e+"</li></ul></div>");t=o(document.body).triggerHandler("wc_stripe_submit_error",[e,t,this]);e=void 0===t?e:t,this.submit_message(e)},wc_stripe.BaseGateway.prototype.submit_error_code=function(t){console.log(t)},wc_stripe.BaseGateway.prototype.get_error_message=function(t){return"object"==typeof t&&(t=t.code&&wc_stripe_messages[t.code]?wc_stripe_messages[t.code]:t.message),t},wc_stripe.BaseGateway.prototype.submit_message=function(t){o(".woocommerce-error, .woocommerce-message, .woocommerce-info").remove();var e=o(this.message_container);e.closest("form").length&&(e=e.closest("form")),e.prepend(t),e.removeClass("processing").unblock(),e.find(".input-text, select, input:checkbox").blur(),o.scroll_to_notices?o.scroll_to_notices(e):o("html, body").animate({scrollTop:e.offset().top-100},1e3)},wc_stripe.BaseGateway.prototype.get_billing_details=function(){var t={name:this.get_customer_name("billing"),address:{city:this.fields.get("billing_city",null),country:this.fields.get("billing_country",null),line1:this.fields.get("billing_address_1",null),line2:this.fields.get("billing_address_2",null),postal_code:this.fields.get("billing_postcode",null),state:this.fields.get("billing_state",null)}};return t.name&&" "!==t.name||delete t.name,""!=this.fields.get("billing_email")&&(t.email=this.fields.get("billing_email")),""!=this.fields.get("billing_phone")&&(t.phone=this.fields.get("billing_phone")),t},wc_stripe.BaseGateway.prototype.get_first_name=function(t){return o("#"+t+"_first_name").val()},wc_stripe.BaseGateway.prototype.get_last_name=function(t){return o("#"+t+"_last_name").val()},wc_stripe.BaseGateway.prototype.get_shipping_prefix=function(){return this.needs_shipping()&&0<o('[name="ship_to_different_address"]').length&&o('[name="ship_to_different_address"]').is(":checked")?"shipping":"billing"},wc_stripe.BaseGateway.prototype.should_save_method=function(){return o("#"+this.gateway_id+"_save_source_key").is(":checked")},wc_stripe.BaseGateway.prototype.is_add_payment_method_page=function(){return"add_payment_method"===this.get_page()||o(document.body).hasClass("woocommerce-add-payment-method")},wc_stripe.BaseGateway.prototype.is_change_payment_method=function(){return"change_payment_method"===this.get_page()},wc_stripe.BaseGateway.prototype.get_selected_payment_method=function(){return o(this.saved_method_selector).val()},wc_stripe.BaseGateway.prototype.needs_shipping=function(){return this.get_gateway_data().needs_shipping},wc_stripe.BaseGateway.prototype.get_currency=function(){return this.get_gateway_data().currency},wc_stripe.BaseGateway.prototype.get_gateway_data=function(){var t=o(this.container).find(".woocommerce_".concat(this.gateway_id,"_gateway_data")).data("gateway");return void 0===t&&this.is_current_page("checkout")&&void 0===(t=o("form.checkout").find(".woocommerce_".concat(this.gateway_id,"_gateway_data")).data("gateway"))&&(t=o(".woocommerce_"+this.gateway_id+"_gateway_data").data("gateway")),t},wc_stripe.BaseGateway.prototype.set_gateway_data=function(t){o(this.container).find(".woocommerce_".concat(this.gateway_id,"_gateway_data")).data("gateway",t)},wc_stripe.BaseGateway.prototype.get_customer_name=function(t){return this.fields.get(t+"_first_name")+" "+this.fields.get(t+"_last_name")},wc_stripe.BaseGateway.prototype.get_customer_email=function(){return this.fields.get("billing_email")},wc_stripe.BaseGateway.prototype.get_address_field_hash=function(t){for(var e=["_first_name","_last_name","_address_1","_address_2","_postcode","_city","_state","_country"],i="",s=0;s<e.length;s++)i+=this.fields.get(t+e[s])+"_";return i},wc_stripe.BaseGateway.prototype.block=function(){o().block&&o.blockUI({message:null,overlayCSS:{background:"#fff",opacity:.6}})},wc_stripe.BaseGateway.prototype.unblock=function(){o().block&&o.unblockUI()},wc_stripe.BaseGateway.prototype.get_form=function(){return o(this.token_selector).closest("form")},wc_stripe.BaseGateway.prototype.get_total_price=function(){return this.get_gateway_data().total},wc_stripe.BaseGateway.prototype.get_total_price_cents=function(){return this.get_gateway_data().total_cents},wc_stripe.BaseGateway.prototype.set_total_price=function(t){var e=this.get_gateway_data();e.total=t,this.set_gateway_data(e)},wc_stripe.BaseGateway.prototype.set_total_price_cents=function(t){var e=this.get_gateway_data();e.total_cents=t,this.set_gateway_data(e)},wc_stripe.BaseGateway.prototype.set_payment_method=function(t){o('[name="payment_method"][value="'+t+'"]').prop("checked",!0).trigger("click")},wc_stripe.BaseGateway.prototype.set_selected_shipping_methods=function(t){if(this.fields.set("shipping_method",t),t&&o('[name^="shipping_method"]').length)for(var e in t){var i=t[e];o('[name="shipping_method['+e+']"][value="'+i+'"]').prop("checked",!0).trigger("change")}},wc_stripe.BaseGateway.prototype.on_token_received=function(t){this.payment_token_received=!0,this.set_nonce(t.id),this.process_checkout()},wc_stripe.BaseGateway.prototype.createPaymentRequest=function(){try{this.payment_request_options=this.get_payment_request_options(),this.paymentRequest=i.paymentRequest(this.payment_request_options),this.payment_request_options.requestShipping&&(this.paymentRequest.on("shippingaddresschange",this.update_shipping_address.bind(this)),this.paymentRequest.on("shippingoptionchange",this.update_shipping_method.bind(this))),this.paymentRequest.on("paymentmethod",this.on_payment_method_received.bind(this))}catch(t){return void this.submit_error(t.message)}},wc_stripe.BaseGateway.prototype.get_payment_request_options=function(){var t={country:this.params.country_code,currency:this.get_currency().toLowerCase(),total:{amount:this.get_total_price_cents(),label:this.params.total_label,pending:!0},requestPayerName:function(){return!this.is_current_page("checkout")||!this.is_valid_address(this.get_address_object("billing"),"billing",["email","phone"])}.bind(this)(),requestPayerEmail:this.fields.requestFieldInWallet("billing_email"),requestPayerPhone:this.fields.requestFieldInWallet("billing_phone"),requestShipping:function(){if(this.needs_shipping()){var t=this.get_shipping_prefix();if(this.is_current_page("checkout")&&!this.is_valid_address(this.get_address_object(t),t,["email","phone"])||!this.is_current_page("checkout"))return!0}return!1}.bind(this)()},e=this.get_display_items(),i=this.get_shipping_options();return e&&(t.displayItems=e),t.requestShipping&&i&&(t.shippingOptions=i),t},wc_stripe.BaseGateway.prototype.get_payment_request_update=function(t){var e={currency:this.get_currency().toLowerCase(),total:{amount:parseInt(this.get_total_price_cents()),label:this.params.total_label,pending:!0}},i=this.get_display_items(),s=this.get_shipping_options();return i&&(e.displayItems=i),this.payment_request_options.requestShipping&&s&&(e.shippingOptions=s),t&&(e=o.extend(!0,{},e,t)),e},wc_stripe.BaseGateway.prototype.get_display_items=function(){return this.get_gateway_data().items},wc_stripe.BaseGateway.prototype.set_display_items=function(t){var e=this.get_gateway_data();e.items=t,this.set_gateway_data(e)},wc_stripe.BaseGateway.prototype.get_shipping_options=function(){return this.get_gateway_data().shipping_options},wc_stripe.BaseGateway.prototype.set_shipping_options=function(t){var e=this.get_gateway_data();e.shipping_options=t,this.set_gateway_data(e)},wc_stripe.BaseGateway.prototype.map_address=function(t){return{city:t.city,postcode:t.postalCode,state:t.region,country:t.country}},wc_stripe.BaseGateway.prototype.on_payment_method_received=function(t){try{this.payment_response=t,this.populate_checkout_fields(t),t.complete("success"),this.on_token_received(t.paymentMethod)}catch(e){a.alert(e)}},wc_stripe.BaseGateway.prototype.populate_checkout_fields=function(t){this.set_nonce(t.paymentMethod.id),this.update_addresses(t)},wc_stripe.BaseGateway.prototype.update_addresses=function(t){t.payerName&&this.fields.set("name",t.payerName,"billing"),t.payerEmail&&this.fields.set("email",t.payerEmail,"billing"),t.payerPhone&&(this.fields.set("phone",t.payerPhone,"billing"),this.fields.exists("shipping_phone")&&this.fields.isEmpty("shipping_phone")&&this.fields.set("shipping_phone",t.payerPhone)),t.shippingAddress&&this.populate_shipping_fields(t.shippingAddress),t.paymentMethod.billing_details.address&&this.populate_billing_fields(t.paymentMethod.billing_details.address)},wc_stripe.BaseGateway.prototype.populate_address_fields=function(t,e){for(var i in t)null!==t[i]&&this.fields.set(i,t[i],e)},wc_stripe.BaseGateway.prototype.populate_billing_fields=function(t){this.populate_address_fields(t,"billing")},wc_stripe.BaseGateway.prototype.populate_shipping_fields=function(t){this.populate_address_fields(t,"shipping")},wc_stripe.BaseGateway.prototype.get_address_fields=function(){return["first_name","last_name","country","address_1","address_2","city","state","postcode","phone","email"]},wc_stripe.BaseGateway.prototype.get_address_object=function(e){var i={};return this.get_address_fields().forEach(function(t){i[t]=this.fields.get(t,e)}.bind(this)),i},wc_stripe.BaseGateway.prototype.is_current_page=function(t){return this.get_page()===t},wc_stripe.BaseGateway.prototype.is_valid_address=function(t,e,i){if(o.isEmptyObject(t))return!1;var s=this.get_address_fields();void 0!==i&&i.forEach(function(t){-1<s.indexOf(t)&&s.splice(s.indexOf(t),1)});for(var a=0;a<s.length;a++){var n=s[a];if(this.fields.required(e+"_"+n)&&(!t[n]||"undefined"==typeof t[n]||!this.fields.isValid(n,t[n],t)))return!1}return!0},wc_stripe.BaseGateway.prototype.ajax_before_send=function(t){0<this.params.user_id&&t.setRequestHeader("X-WP-Nonce",this.params.rest_nonce)},wc_stripe.BaseGateway.prototype.process_checkout=function(){return new Promise(function(){this.block(),o.ajax({url:this.params.routes.checkout,method:"POST",dataType:"json",data:o.extend({},this.serialize_fields(),{payment_method:this.gateway_id,page_id:this.get_page(),currency:this.get_currency()}),beforeSend:this.ajax_before_send.bind(this)}).done(function(t){t.reload?a.location.reload():"success"===t.result?a.location=t.redirect:(t.messages&&this.submit_error(t.messages),this.unblock())}.bind(this)).fail(function(t,e,i){this.unblock(),this.submit_error(i)}.bind(this))}.bind(this))},wc_stripe.BaseGateway.prototype.process_payment=function(t,e){o.ajax({method:"POST",url:this.params.routes.checkout_payment,dataType:"json",data:o.extend({},this.fields.toJson(),{order_id:t,order_key:e}),beforeSend:this.ajax_before_send.bind(this)}).done(function(t){if(t.result&&"success"===t.result)a.location=t.redirect;else{if(t.reload)return a.location.reload();t.messages?(this.payment_token_received=!1,this.submit_error(t.messages)):this.submit_error(wc_checkout_params.i18n_checkout_error)}}.bind(this)).fail(function(){}.bind(this))},wc_stripe.BaseGateway.prototype.handle_card_action=function(e){try{return this.stripe.handleCardAction(e.client_secret).then(function(t){if(t.error)return this.payment_token_received=!1,this.submit_error(t.error),void this.sync_payment_intent(e.order_id,e.client_secret)["catch"](function(t){this.submit_error(t.message)}.bind(this));this.is_current_page("order_pay")?this.get_form().submit():this.process_payment(e.order_id,e.order_key)}.bind(this))["catch"](function(t){this.submit_error(t.message)}.bind(this)),!1}catch(t){}},wc_stripe.BaseGateway.prototype.hashchange=function(t){var e=t.newURL.match(/response=(.*)/);if(e)try{var i=JSON.parse(a.atob(decodeURIComponent(e[1])));i&&i.hasOwnProperty("client_secret")&&i.gateway_id===this.gateway_id&&(history.pushState({},"",a.location.pathname),this.handle_card_action(i))}catch(s){}return!0},wc_stripe.BaseGateway.prototype.sync_payment_intent=function(t,s){return new Promise(function(e,i){o.when(o.ajax({method:"POST",dataType:"json",url:this.params.routes.sync_intent,data:{order_id:t,client_secret:s},beforeSend:this.ajax_before_send.bind(this)})).done(function(t){(t.code?i:e)(t)}).fail(function(t,e,i){this.submit_error(i)}.bind(this))}.bind(this))},wc_stripe.BaseGateway.prototype.serialize_form=function(t){var e,i=t.find("input").filter(function(t,e){return!o(e).is('[name^="add-to-cart"]')}.bind(this)).serializeArray(),s={};for(e in i){var a=i[e];s[a.name]=a.value}return s.payment_method=this.gateway_id,s},wc_stripe.BaseGateway.prototype.serialize_fields=function(){return o.extend({},this.fields.toJson(),o(document.body).triggerHandler("wc_stripe_process_checkout_data",[this,this.fields]))},wc_stripe.BaseGateway.prototype.map_shipping_methods=function(t){var e={};return"default"===t||1<(t=t.match(/^([\w+]):(.+)$/)).length&&(e[t[1]]=t[2]),e},wc_stripe.BaseGateway.prototype.maybe_set_ship_to_different=function(){o('[name="ship_to_different_address"]').length&&o('[name="ship_to_different_address"]').prop("checked",this.get_address_field_hash("billing")!==this.get_address_field_hash("shipping")).trigger("change")},wc_stripe.BaseGateway.prototype.update_shipping_address=function(s){return new Promise(function(e,i){o.ajax({url:this.params.routes.shipping_address,method:"POST",dataType:"json",data:{address:this.map_address(s.shippingAddress),payment_method:this.gateway_id,page_id:this.get_page(),currency:this.get_currency()},beforeSend:this.ajax_before_send.bind(this)}).done(function(t){t.code?(s.updateWith(t.data.newData),i(t.data)):(s.updateWith(t.data.newData),this.fields.set("shipping_method",t.data.shipping_method),e(t.data))}.bind(this)).fail(function(){}.bind(this))}.bind(this))},wc_stripe.BaseGateway.prototype.update_shipping_method=function(s){return new Promise(function(e,i){o.ajax({url:this.params.routes.shipping_method,method:"POST",dataType:"json",data:{shipping_method:s.shippingOption.id,payment_method:this.gateway_id,currency:this.get_currency(),page_id:this.get_page()},beforeSend:this.ajax_before_send.bind(this)}).done(function(t){t.code?(s.updateWith(t.data.newData),i(t.data)):(this.set_selected_shipping_methods(t.data.shipping_methods),s.updateWith(t.data.newData),e(t.data))}.bind(this)).fail(function(t,e,i){this.submit_error(i)}.bind(this))}.bind(this))},wc_stripe.CheckoutGateway=function(){this.message_container="li.payment_method_"+this.gateway_id,this.banner_container="li.banner_payment_method_"+this.gateway_id,o(document.body).on("update_checkout",this.update_checkout.bind(this)),o(document.body).on("updated_checkout",this.updated_checkout.bind(this)),o(document.body).on("updated_checkout",this.container_styles.bind(this)),o(document.body).on("checkout_error",this.checkout_error.bind(this)),o(this.token_selector).closest("form").on("checkout_place_order_"+this.gateway_id,this.checkout_place_order.bind(this)),o(document.body).on("wc_stripe_new_method_"+this.gateway_id,this.on_show_new_methods.bind(this)),o(document.body).on("wc_stripe_saved_method_"+this.gateway_id,this.on_show_saved_methods.bind(this)),o(document.body).on("wc_stripe_payment_method_selected",this.on_payment_method_selected.bind(this)),this.banner_enabled()&&o(".woocommerce-billing-fields").length&&o(".wc-stripe-banner-checkout").css("max-width",o(".woocommerce-billing-fields").outerWidth(!0)),this.container_styles(),this.hasOrderReviewParams()},wc_stripe.CheckoutGateway.prototype.container_styles=function(){this.params.description||o(this.container).addClass("wc-stripe-no-desc"),o(this.container).find(".wc-stripe-saved-methods").length||o(this.container).find(".payment_box").addClass("wc-stripe-no-methods")},wc_stripe.CheckoutGateway.prototype.hasOrderReviewParams=function(){var t=a.location.search.match(/_stripe_order_review=(.+)/);if(t&&1<t.length)try{var e=JSON.parse(a.atob(decodeURIComponent(t[1])));this.gateway_id===e.payment_method&&(o(function(){this.payment_token_received=!0,this.set_nonce(e.payment_nonce),this.set_use_new_option(!0)}.bind(this)),history.pushState({},"",a.location.pathname))}catch(i){}},wc_stripe.CheckoutGateway.prototype.has3DSecureParams=function(){if((this.is_current_page("order_pay")||this.is_change_payment_method())&&a.location.hash&&"string"==typeof a.location.hash){var t=a.location.hash.match(/response=(.*)/);if(t)try{var e=JSON.parse(a.atob(decodeURIComponent(t[1])));e&&e.hasOwnProperty("client_secret")&&e.gateway_id===this.gateway_id&&(o(function(){this.set_payment_method(this.gateway_id),this.set_use_new_option(!0),this.set_nonce(e.pm),!0===e.save_method&&this.set_save_payment_method(!0),o('[name="terms"]').prop("checked",!0)}.bind(this)),history.pushState({},"",a.location.pathname+a.location.search),this.handle_card_action(e))}catch(i){}}},wc_stripe.CheckoutGateway.prototype.update_shipping_address=function(){return wc_stripe.BaseGateway.prototype.update_shipping_address.apply(this,arguments).then(function(t){this.populate_address_fields(t.address,this.get_shipping_prefix()),this.fields.toFormFields({update_shipping_method:!1})}.bind(this))},wc_stripe.CheckoutGateway.prototype.updated_checkout=function(){},wc_stripe.CheckoutGateway.prototype.update_checkout=function(){},wc_stripe.CheckoutGateway.prototype.checkout_error=function(){this.has_checkout_error()&&(this.payment_token_received=!1,this.payment_response=null,this.show_payment_button(),this.hide_place_order())},wc_stripe.CheckoutGateway.prototype.is_valid_checkout=function(){return!(o('[name="terms"]').length&&!o('[name="terms"]').is(":checked"))},wc_stripe.CheckoutGateway.prototype.get_payment_method=function(){return o('[name="payment_method"]:checked').val()},wc_stripe.CheckoutGateway.prototype.set_use_new_option=function(t){o("#"+this.gateway_id+"_use_new").prop("checked",t).trigger("change")},wc_stripe.CheckoutGateway.prototype.checkout_place_order=function(){return this.is_valid_checkout()?!!this.is_saved_method_selected()||this.payment_token_received:(this.submit_error(this.params.messages.terms),!1)},wc_stripe.CheckoutGateway.prototype.on_token_received=function(t){this.payment_token_received=!0,this.set_nonce(t.id),this.hide_payment_button(),this.show_place_order()},wc_stripe.CheckoutGateway.prototype.block=function(){o().block&&o("form.checkout").block({message:null,overlayCSS:{background:"#fff",opacity:.6}})},wc_stripe.CheckoutGateway.prototype.unblock=function(){o().block&&o("form.checkout").unblock()},wc_stripe.CheckoutGateway.prototype.hide_place_order=function(){o("#place_order").addClass("wc-stripe-hide")},wc_stripe.CheckoutGateway.prototype.show_place_order=function(){o("#place_order").removeClass("wc-stripe-hide")},wc_stripe.CheckoutGateway.prototype.on_show_new_methods=function(){this.payment_token_received?(this.show_place_order(),this.hide_payment_button()):(this.hide_place_order(),this.show_payment_button())},wc_stripe.CheckoutGateway.prototype.on_show_saved_methods=function(){this.hide_payment_button(),this.show_place_order()},wc_stripe.CheckoutGateway.prototype.show_payment_button=function(){this.$button&&this.$button.show()},wc_stripe.CheckoutGateway.prototype.hide_payment_button=function(){this.$button&&this.$button.hide()},wc_stripe.CheckoutGateway.prototype.trigger_payment_method_selected=function(){this.on_payment_method_selected(null,o('[name="payment_method"]:checked').val())},wc_stripe.CheckoutGateway.prototype.on_payment_method_selected=function(t,e){e===this.gateway_id?this.payment_token_received||this.is_saved_method_selected()?(this.hide_payment_button(),this.show_place_order()):(this.show_payment_button(),this.hide_place_order()):(this.hide_payment_button(),e.indexOf("stripe_")<0&&this.show_place_order())},wc_stripe.CheckoutGateway.prototype.banner_enabled=function(){return"1"===this.params.banner_enabled},wc_stripe.CheckoutGateway.prototype.checkout_fields_valid=function(){if(["checkout","order_pay"].indexOf(this.get_page())<0)return!0;var t=!0;return(t=this.fields.validateFields("billing"))?this.needs_shipping()&&o("#ship-to-different-address-checkbox").is(":checked")?(t=this.fields.validateFields("shipping"))||this.submit_error(this.params.messages.required_field):(t=this.is_valid_checkout())||this.submit_error(this.params.messages.terms):this.submit_error(this.params.messages.required_field),t},wc_stripe.CheckoutGateway.prototype.cart_contains_subscription=function(){return"undefined"!=typeof wc_stripe_cart_contains_subscription&&!0===wc_stripe_cart_contains_subscription},wc_stripe.CheckoutGateway.prototype.set_save_payment_method=function(t){o('[name="'+this.gateway_id+'_save_source_key"]').prop("checked",t)},wc_stripe.ProductGateway=function(){this.message_container="div.product",o("form.cart").on("found_variation",this.found_variation.bind(this)),o("form.cart").on("reset_data",this.reset_variation_data.bind(this)),this.buttonWidth=o("form.cart div.quantity").outerWidth(!0)+o(".single_add_to_cart_button").outerWidth();var t=o(".single_add_to_cart_button").css("marginLeft");t&&(this.buttonWidth+=parseInt(t.replace("px",""))),o(this.container).css("max-width",this.buttonWidth+"px")},wc_stripe.ProductGateway.prototype.get_quantity=function(){return parseInt(o('[name="quantity"]').val())},wc_stripe.ProductGateway.prototype.set_rest_nonce=function(t,e){this.params.rest_nonce=e},wc_stripe.ProductGateway.prototype.found_variation=function(t,e){var i=this.get_gateway_data();i.product.price=e.display_price,i.needs_shipping=!e.is_virtual,i.product.variation=e,this.set_gateway_data(i)},wc_stripe.ProductGateway.prototype.reset_variation_data=function(){var t=this.get_product_data();t.variation=!1,this.set_product_data(t),this.disable_payment_button()},wc_stripe.ProductGateway.prototype.disable_payment_button=function(){this.$button&&this.get_button().prop("disabled",!0).addClass("disabled")},wc_stripe.ProductGateway.prototype.enable_payment_button=function(){this.$button&&this.get_button().prop("disabled",!1).removeClass("disabled")},wc_stripe.ProductGateway.prototype.get_button=function(){return this.$button},wc_stripe.ProductGateway.prototype.is_variable_product=function(){return 0<o('[name="variation_id"]').length},wc_stripe.ProductGateway.prototype.variable_product_selected=function(){var t=o('input[name="variation_id"]').val();return!!t&&"0"!=t},wc_stripe.ProductGateway.prototype.get_product_data=function(){return this.get_gateway_data().product},wc_stripe.ProductGateway.prototype.set_product_data=function(t){var e=this.get_gateway_data();e.product=t,this.set_gateway_data(e)},wc_stripe.ProductGateway.prototype.add_to_cart=function(){return new Promise(function(e,i){this.block(),o.ajax({url:this.params.routes.add_to_cart,method:"POST",dataType:"json",data:o.extend({},{product_id:this.get_product_data().id,variation_id:this.is_variable_product()?o('[name="variation_id"]').val():0,qty:o('[name="quantity"]').val(),payment_method:this.gateway_id,currency:this.get_currency(),page_id:this.get_page()},this.get_product_variations()),beforeSend:this.ajax_before_send.bind(this)}).done(function(t){this.unblock(),t.code?(this.submit_error(t.message),i(t)):(this.set_total_price(t.data.total),this.set_total_price_cents(t.data.totalCents),this.set_display_items(t.data.displayItems),e(t.data))}.bind(this)).fail(function(t,e,i){this.unblock(),this.submit_error(i)}.bind(this))}.bind(this))},wc_stripe.ProductGateway.prototype.cart_calculation=function(t){return new Promise(function(e,i){o.ajax({url:this.params.routes.cart_calculation,method:"POST",dataType:"json",data:o.extend({},{product_id:this.get_product_data().id,variation_id:this.is_variable_product()&&t?t:0,qty:o('[name="quantity"]').val(),currency:this.get_currency(),payment_method:this.gateway_id},this.get_product_variations()),beforeSend:this.ajax_before_send.bind(this)}).done(function(t){t.code?(this.cart_calculation_error=!0,i(t)):(this.set_total_price(t.data.total),this.set_total_price_cents(t.data.totalCents),this.set_display_items(t.data.displayItems),e(t.data))}.bind(this)).fail(function(){}.bind(this))}.bind(this))},wc_stripe.ProductGateway.prototype.get_product_variations=function(){var s={};return this.is_variable_product()&&o('.variations [name^="attribute_"]').each(function(t,e){var i=o(e),e=i.data("attribute_name")||i.attr("name");s[e]=i.val()}),s},wc_stripe.CartGateway=function(){this.message_container="div.woocommerce",o(document.body).on("updated_wc_div",this.updated_html.bind(this)),o(document.body).on("updated_cart_totals",this.updated_html.bind(this)),o(document.body).on("wc_cart_emptied",this.cart_emptied.bind(this))},wc_stripe.CartGateway.prototype.submit_error=function(t){this.submit_message(this.get_error_message(t))},wc_stripe.CartGateway.prototype.updated_html=function(t){},wc_stripe.CartGateway.prototype.cart_emptied=function(t){},wc_stripe.CartGateway.prototype.add_cart_totals_class=function(){o(".cart_totals").addClass("stripe_cart_gateway_active")},wc_stripe.GooglePay=function(){};var s={apiVersion:2,apiVersionMinor:0},n={type:"CARD",parameters:{allowedAuthMethods:["PAN_ONLY"],allowedCardNetworks:["AMEX","DISCOVER","INTERAC","JCB","MASTERCARD","VISA"],assuranceDetailsRequired:!0}};wc_stripe.GooglePay.prototype.update_addresses=function(t){var e;t.paymentMethodData.info.billingAddress&&(e=t.paymentMethodData.info.billingAddress,this.is_current_page("checkout")&&this.is_valid_address(this.billing_address_object,"billing",["phone","email"])&&(e={phoneNumber:e.phoneNumber}),this.populate_billing_fields(e),e.phoneNumber&&this.fields.exists("shipping_phone")&&this.fields.isEmpty("shipping_phone")&&this.fields.set("shipping_phone",e.phoneNumber)),t.shippingAddress&&this.populate_shipping_fields(t.shippingAddress),t.email&&this.fields.set("email",t.email,"billing")},wc_stripe.GooglePay.prototype.map_address=function(t){return{city:t.locality,postcode:t.postalCode,state:t.administrativeArea,country:t.countryCode}},wc_stripe.GooglePay.prototype.update_payment_data=function(s){return new Promise(function(e,i){var t="default"==s.shippingOptionData.id?null:s.shippingOptionData.id;o.when(o.ajax({url:this.params.routes.payment_data,dataType:"json",method:"POST",data:{address:this.map_address(s.shippingAddress),shipping_method:t,page_id:this.get_page(),currency:this.get_currency()},beforeSend:this.ajax_before_send.bind(this)})).done(function(t){t.code?i(t.data.data):e(t.data)}.bind(this)).fail(function(){i()}.bind(this))}.bind(this))},wc_stripe.GooglePay.prototype.on_payment_data_changed=function(i){return new Promise(function(e){this.update_payment_data(i).then(function(t){e(t.paymentRequestUpdate),this.set_selected_shipping_methods(t.shipping_methods),this.payment_data_updated(t,i)}.bind(this))["catch"](function(t){e(t)}.bind(this))}.bind(this))},wc_stripe.GooglePay.prototype.payment_data_updated=function(t){},wc_stripe.GooglePay.prototype.get_merchant_info=function(){var t={merchantId:this.params.merchant_id,merchantName:this.params.merchant_name};return"TEST"===this.params.environment&&delete t.merchantId,t},wc_stripe.GooglePay.prototype.get_payment_options=function(){var t,e={environment:this.params.environment,merchantInfo:this.get_merchant_info(),paymentDataCallbacks:{onPaymentAuthorized:function(){return new Promise(function(t){t({transactionState:"SUCCESS"})}.bind(this))}}};return this.needs_shipping()&&(t=this.get_shipping_prefix(),(!this.is_current_page("checkout")||this.is_valid_address(this.get_address_object(t),t,["email","phone"]))&&this.is_current_page("checkout")||(e.paymentDataCallbacks.onPaymentDataChanged=this.on_payment_data_changed.bind(this))),e},wc_stripe.GooglePay.prototype.build_payment_request=function(){var t=o.extend({},s,{emailRequired:this.fields.requestFieldInWallet("billing_email"),merchantInfo:this.get_merchant_info(),allowedPaymentMethods:[o.extend({type:"CARD",tokenizationSpecification:{type:"PAYMENT_GATEWAY",parameters:{gateway:"stripe","stripe:version":"2018-10-31","stripe:publishableKey":this.params.api_key}}},n)],shippingAddressRequired:function(){if(this.needs_shipping()){var t=this.get_shipping_prefix();if(this.is_current_page("checkout")&&!this.is_valid_address(this.get_address_object(t),t,["email","phone"])||!this.is_current_page("checkout"))return!0}return!1}.bind(this)(),transactionInfo:{countryCode:this.params.processing_country,currencyCode:this.get_currency(),totalPriceStatus:"ESTIMATED",totalPrice:this.get_total_price().toString(),displayItems:this.get_display_items(),totalPriceLabel:this.params.total_price_label}});return t.allowedPaymentMethods[0].parameters.billingAddressRequired=function(){if(this.is_current_page("checkout")){var t=this.billing_address_object=this.get_address_object("billing");return this.fields.requestFieldInWallet("billing_phone")||!this.is_valid_address(t,"billing",["email"])?!0:!1}return!0}.bind(this)(),t.allowedPaymentMethods[0].parameters.billingAddressRequired&&(t.allowedPaymentMethods[0].parameters.billingAddressParameters={format:"FULL",phoneNumberRequired:this.fields.requestFieldInWallet("billing_phone")}),t.shippingAddressRequired?(t.shippingAddressParameters={},t.shippingOptionRequired=!0,t.shippingOptionParameters={shippingOptions:this.get_shipping_options()},t.callbackIntents=["SHIPPING_ADDRESS","SHIPPING_OPTION","PAYMENT_AUTHORIZATION"]):t.callbackIntents=["PAYMENT_AUTHORIZATION"],this.payment_request_options=t},wc_stripe.GooglePay.prototype.createPaymentsClient=function(){this.paymentsClient=new google.payments.api.PaymentsClient(this.get_payment_options())},wc_stripe.GooglePay.prototype.isReadyToPay=function(){return new Promise(function(t){var e=o.extend({},s);e.allowedPaymentMethods=[n],this.paymentsClient.isReadyToPay(e).then(function(){this.can_pay=!0,this.create_button(),t()}.bind(this))["catch"](function(t){this.submit_error(t)}.bind(this))}.bind(this))},wc_stripe.GooglePay.prototype.create_button=function(){this.$button&&this.$button.remove(),this.$button=o(this.paymentsClient.createButton({onClick:this.start.bind(this),buttonColor:this.params.button_color,buttonType:this.params.button_style,buttonSizeMode:this.params.button_size_mode})),this.$button.addClass("gpay-button-container")},wc_stripe.GooglePay.prototype.start=function(){this.createPaymentsClient(),this.paymentsClient.loadPaymentData(this.build_payment_request()).then(function(t){var e=JSON.parse(t.paymentMethodData.tokenizationData.token);this.update_addresses(t),this.stripe.createPaymentMethod({type:"card",card:{token:e.id},billing_details:this.get_billing_details()}).then(function(t){if(t.error)return this.submit_error(t.error);this.on_token_received(t.paymentMethod)}.bind(this))}.bind(this))["catch"](function(t){"CANCELED"!==t.statusCode&&(t.statusMessage&&-1<t.statusMessage.indexOf("paymentDataRequest.callbackIntent")?this.submit_error_code("DEVELOPER_ERROR_WHITELIST"):this.submit_error(t.statusMessage))}.bind(this))},wc_stripe.ApplePay=function(){},wc_stripe.ApplePay.prototype.initialize=function(){this.createPaymentRequest(),this.canMakePayment()},wc_stripe.ApplePay.prototype.get_payment_request_options=function(){return o.extend({},wc_stripe.BaseGateway.prototype.get_payment_request_options.apply(this,arguments),{disableWallets:["googlePay"]})},wc_stripe.ApplePay.prototype.create_button=function(){this.$button&&this.$button.remove(),this.$button=o(this.params.button),this.$button.on("click",this.start.bind(this)),this.append_button()},wc_stripe.ApplePay.prototype.canMakePayment=function(){return new Promise(function(e){this.paymentRequest.canMakePayment().then(function(t){t&&t.applePay&&(this.can_pay=!0,this.create_button(),o(this.container).show(),e(t))}.bind(this))}.bind(this))},wc_stripe.ApplePay.prototype.start=function(t){t.preventDefault(),this.paymentRequest.update(this.get_payment_request_update({total:{pending:!1}})),this.paymentRequest.show()},wc_stripe.PaymentRequest=function(){},wc_stripe.PaymentRequest.prototype.initialize=function(){this.createPaymentRequest(),this.createPaymentRequestButton(),this.canMakePayment(),this.paymentRequestButton.on("click",this.button_click.bind(this))},wc_stripe.PaymentRequest.prototype.button_click=function(t){},wc_stripe.PaymentRequest.prototype.createPaymentRequestButton=function(){this.paymentRequestButton&&this.paymentRequestButton.destroy(),this.paymentRequestButton=this.elements.create("paymentRequestButton",{paymentRequest:this.paymentRequest,style:{paymentRequestButton:{type:this.params.button.type,theme:this.params.button.theme,height:this.params.button.height}}})},wc_stripe.PaymentRequest.prototype.canMakePayment=function(){return new Promise(function(e){this.paymentRequest.canMakePayment().then(function(t){t&&!t.applePay&&(this.can_pay=!0,this.create_button(),o(this.container).show(),e(t))}.bind(this))}.bind(this))},wc_stripe.PaymentRequest.prototype.create_button=function(){this.paymentRequestButton.mount("#wc-stripe-payment-request-container")},wc_stripe.Afterpay=function(){},wc_stripe.Afterpay.prototype.is_eligible=function(t){return this.needs_shipping()&&t>this.get_min()&&t<this.get_max()},wc_stripe.Afterpay.prototype.get_min=function(){var t=this.get_currency(),t=this.params.requirements[t];return t?t[1]:0},wc_stripe.Afterpay.prototype.get_max=function(){var t=this.get_currency(),t=this.params.requirements[t];return t?t[2]:0},wc_stripe.Afterpay.prototype.add_eligibility=function(t,e){o(t).length&&(this.is_eligible(e)?o(t).removeClass("afterpay-ineligible"):this.hide_ineligible_active()&&o(t).addClass("afterpay-ineligible"))},wc_stripe.Afterpay.prototype.hide_ineligible_active=function(){return"yes"===this.params.hide_ineligible},wc_stripe.CheckoutFields=function(t,e){this.params=t,this.page=e,this.session_values=this.supportsSessionStorage()&&sessionStorage.getItem("wc_stripe_checkout_fields")?JSON.parse(sessionStorage.getItem("wc_stripe_checkout_fields")):{},this.fields=new Map(Object.keys(this.params).map(function(t){return null===this.params[t].value&&(t in this.session_values&&null!==this.session_values[t]?this.params[t].value=this.session_values[t]:this.params[t].value=""),[t,this.params[t].value]}.bind(this))),("checkout"===e||"cart"===e&&o(document.body).is(".woocommerce-checkout"))&&(o(document.body).on("updated_checkout",this.updated_checkout.bind(this)),o("form.checkout").on("change",".input-text, select",this.onChange.bind(this)),o("form.checkout").on("change",'[name="ship_to_different_address"]',this.on_ship_to_address_change.bind(this)),this.init_i18n(),o('[name="ship_to_different_address"]').is(":checked")?this.update_required_fields(o("#shipping_country").val(),"shipping_country"):this.update_required_fields(o("#billing_country").val(),"billing_country"))},wc_stripe.CheckoutFields.prototype.supportsSessionStorage=function(){return"sessionStorage"in a&&null!==a.sessionStorage&&["getItem","setItem"].reduce(function(t,e){return t&&e in sessionStorage}.bind(this),!0)},wc_stripe.CheckoutFields.prototype.init_i18n=function(){"undefined"!=typeof wc_address_i18n_params?this.locales=JSON.parse(wc_address_i18n_params.locale.replace(/&quot;/g,'"')):this.locales=null},wc_stripe.CheckoutFields.prototype.updated_checkout=function(){this.syncCheckoutFieldsWithDOM()},wc_stripe.CheckoutFields.prototype.syncCheckoutFieldsWithDOM=function(){for(var t in this.params)o("#"+t).length&&this.fields.set(t,o("#"+t).val())},wc_stripe.CheckoutFields.prototype.onChange=function(t){try{var e=t.currentTarget.name,i=t.currentTarget.value;this.fields.set(e,i),"billing_country"!==e&&"shipping_country"!==e||this.update_required_fields(i,e),this.supportsSessionStorage()&&sessionStorage.setItem("wc_stripe_checkout_fields",JSON.stringify(this.toJson()))}catch(s){console.log(s)}},wc_stripe.CheckoutFields.prototype.update_required_fields=function(t,e){if(this.locales){var i,s=-1<e.indexOf("billing_")?"billing_":"shipping_",t="undefined"!=typeof this.locales[t]?this.locales[t]:this.locales["default"],a=o.extend(!0,{},this.locales["default"],t);for(i in a){var n=s+i;this.params[n]&&(this.params[n]=o.extend(!0,{},this.params[n],a[i]))}}},wc_stripe.CheckoutFields.prototype.on_ship_to_address_change=function(t){o(t.currentTarget).is(":checked")&&this.update_required_fields(o("#shipping_country").val(),"shipping_country")},wc_stripe.CheckoutFields.prototype.requestFieldInWallet=function(t){return"checkout"===this.page?this.required(t)&&this.isEmpty(t):"order_pay"!==this.page&&this.required(t)},wc_stripe.CheckoutFields.prototype.set=function(t,e,i){this[t]&&"function"==typeof this[t]?this[t]().set.call(this,e,i):this.fields.set(t,e)},wc_stripe.CheckoutFields.prototype.get=function(t,e){var i;return this[t]&&"function"==typeof this[t]?i=this[t]().get.call(this,e):null!=(i=this.fields.get(t))&&""!==i||void 0!==e&&(i=e),void 0===i?"":i},wc_stripe.CheckoutFields.prototype.required=function(t){return!(!this.params[t]||"undefined"==typeof this.params[t].required)&&this.params[t].required},wc_stripe.CheckoutFields.prototype.exists=function(t){return t in this.params},wc_stripe.CheckoutFields.prototype.isEmpty=function(t){if(this.fields.has(t)){t=this.fields.get(t);return null==t||"string"==typeof t&&0===t.trim().length}return!0},wc_stripe.CheckoutFields.prototype.isValid=function(t){if(this[t]&&"function"==typeof this[t])return this[t]().isValid.apply(this,Array.prototype.slice.call(arguments,1))},wc_stripe.CheckoutFields.prototype.first_name=function(){return{set:function(t,e){this.fields.set(e+"_first_name",t)},get:function(t){return this.fields.get(t+"_first_name")},isValid:function(t){return"string"==typeof t&&0<t.length}}},wc_stripe.CheckoutFields.prototype.last_name=function(){return{set:function(t,e){this.fields.set(e+"_last_name",t)},get:function(t){return this.fields.get(t+"_last_name")},isValid:function(t){return"string"==typeof t&&0<t.length}}},wc_stripe.CheckoutFields.prototype.address_1=function(){return{set:function(t,e){this.fields.set(e+"_address_1",t)},get:function(t){return this.fields.get(t+"_address_1")},isValid:function(t){return"string"==typeof t&&0<t.length}}},wc_stripe.CheckoutFields.prototype.address_2=function(){return{set:function(t,e){this.fields.set(e+"_address_2",t)},get:function(t){return this.fields.get(t+"_address_2")},isValid:function(t){return"string"==typeof t&&0<t.length}}},wc_stripe.CheckoutFields.prototype.name=function(){return{set:function(t,e){this.fields.set(e+"_full_name",t);var i=t.split(" ");1<i.length?(t=i.pop(),this.fields.set(e+"_first_name",i.join(" ")),this.fields.set(e+"_last_name",t)):1==i.length&&this.fields.set(e+"_first_name",i[0])},get:function(t){return this.fields.get(t+"_first_name")+" "+this.fields.get(t+"_last_name")}}},wc_stripe.CheckoutFields.prototype.email=function(){return{set:function(t,e){this.fields.set(e+"_email",t)},get:function(t){return this.fields.get(t+"_email")},isValid:function(t){return"string"==typeof t&&0<t.length}}},wc_stripe.CheckoutFields.prototype.phone=function(){return{set:function(t,e){this.fields.set(e+"_phone",t)},get:function(t){return this.fields.get(t+"_phone")},isValid:function(t){return"string"==typeof t&&0<t.length}}},wc_stripe.CheckoutFields.prototype.country=function(){return{set:function(t,e){this.fields.set(e+"_country",t)},get:function(t){return this.fields.get(t+"_country")},isValid:function(t){return"string"==typeof t&&2===t.length}}},wc_stripe.CheckoutFields.prototype.state=function(){return{set:function(i,t){2<(i=i.toUpperCase()).length&&"checkout"===this.page&&o("#"+t+"_state option").each(function(){var t=o(this),e=t.text().toUpperCase();i===e&&(i=t.val())}),this.fields.set(t+"_state",i)},get:function(t){return this.fields.get(t+"_state")},isValid:function(t){return"string"==typeof t&&0<t.length}}},wc_stripe.CheckoutFields.prototype.city=function(){return{set:function(t,e){this.fields.set(e+"_city",t)},get:function(t){return this.fields.get(t+"_city")},isValid:function(t){return"string"==typeof t&&0<t.length}}},wc_stripe.CheckoutFields.prototype.postcode=function(){return{set:function(t,e){this.fields.set(e+"_postcode",t)},get:function(t){return this.fields.get(t+"_postcode")},isValid:function(t){return"string"==typeof t&&0<t.length}}},wc_stripe.CheckoutFields.prototype.recipient=function(){return wc_stripe.CheckoutFields.prototype.name.apply(this,arguments)},wc_stripe.CheckoutFields.prototype.payerName=function(){return wc_stripe.CheckoutFields.prototype.name.apply(this,arguments)},wc_stripe.CheckoutFields.prototype.payerEmail=function(){return wc_stripe.CheckoutFields.prototype.email.apply(this,arguments)},wc_stripe.CheckoutFields.prototype.payerPhone=function(){return wc_stripe.CheckoutFields.prototype.phone.apply(this,arguments)},wc_stripe.CheckoutFields.prototype.phoneNumber=function(){return wc_stripe.CheckoutFields.prototype.phone.apply(this,arguments)},wc_stripe.CheckoutFields.prototype.countryCode=function(){return wc_stripe.CheckoutFields.prototype.country.apply(this,arguments)},wc_stripe.CheckoutFields.prototype.address1=function(){return wc_stripe.CheckoutFields.prototype.address_1.apply(this,arguments)},wc_stripe.CheckoutFields.prototype.address2=function(){return wc_stripe.CheckoutFields.prototype.address_2.apply(this,arguments)},wc_stripe.CheckoutFields.prototype.line1=function(){return wc_stripe.CheckoutFields.prototype.address_1.apply(this,arguments)},wc_stripe.CheckoutFields.prototype.line2=function(){return wc_stripe.CheckoutFields.prototype.address_2.apply(this,arguments)},wc_stripe.CheckoutFields.prototype.addressLine=function(){return{set:function(t,e){0<t.length&&this.fields.set(e+"_address_1",t[0]),1<t.length&&this.fields.set(e+"_address_2",t[1])},get:function(t){return[this.fields.get(t+"_address_1"),this.fields.get(t+"_address_2")]},isValid:function(t){return 0<t.length&&("string"==typeof t[0]&&0<t[0].length)}}},wc_stripe.CheckoutFields.prototype.region=function(){return wc_stripe.CheckoutFields.prototype.state.apply(this,arguments)},wc_stripe.CheckoutFields.prototype.administrativeArea=function(){return wc_stripe.CheckoutFields.prototype.state.apply(this,arguments)},wc_stripe.CheckoutFields.prototype.locality=function(){return wc_stripe.CheckoutFields.prototype.city.apply(this,arguments)},wc_stripe.CheckoutFields.prototype.postal_code=function(){return wc_stripe.CheckoutFields.prototype.postcode.apply(this,arguments)},wc_stripe.CheckoutFields.prototype.postalCode=function(){return wc_stripe.CheckoutFields.prototype.postcode.apply(this,arguments)},wc_stripe.CheckoutFields.prototype.toJson=function(){var i={};return this.fields.forEach(function(t,e){i[e]=t}),i},wc_stripe.CheckoutFields.prototype.toFormFields=function(t){var i=[];this.fields.forEach(function(t,e){e='[name="'+e+'"]';o(e).length&&""!==t&&(o(e).val()!==t&&o(e).is("select")&&i.push(e),o(e).val(t))}),0<i.length&&o(i.join(",")).trigger("change"),void 0!==t&&o(document.body).trigger("update_checkout",t)},wc_stripe.CheckoutFields.prototype.validateFields=function(t){for(var e in this.params){var i=this.params[e];if(-1<e.indexOf(t)&&i.required&&o("#"+e).length&&o("#"+e).is(":visible")){i=o("#"+e).val();if(null==i||0===i.length)return!1}}return!0};try{i=Stripe(wc_stripe_params_v3.api_key,"test"===wc_stripe_params_v3.mode&&""===wc_stripe_params_v3.account?{}:{stripeAccount:wc_stripe_params_v3.account})}catch(t){return a.alert(t),console.log(t)}var r=new wc_stripe.CheckoutFields(wc_stripe_checkout_fields,wc_stripe_params_v3.page)}(window,jQuery);
1
+ !function(a,o){a.wc_stripe={};var i=null;"undefined"==typeof wc_stripe_checkout_fields&&(a.wc_stripe_checkout_fields=[]),wc_stripe.BaseGateway=function(t,e){this.params=t,this.gateway_id=this.params.gateway_id,this.container=void 0===e?"li.payment_method_".concat(this.gateway_id):e,o(this.container).length||(this.container=".payment_method_".concat(this.gateway_id)),this.token_selector=this.params.token_selector,this.saved_method_selector=this.params.saved_method_selector,this.payment_token_received=!1,this.stripe=i,this.fields=r,this.elements=i.elements(o.extend({},{locale:"auto"},this.get_element_options())),this.initialize()},wc_stripe.BaseGateway.prototype.get_page=function(){var t=wc_stripe_params_v3.page;return"cart"===t&&o(document.body).is(".woocommerce-checkout")&&(t="checkout"),t},wc_stripe.BaseGateway.prototype.set_nonce=function(t){this.fields.set(this.gateway_id+"_token_key",t),o(this.token_selector).val(t)},wc_stripe.BaseGateway.prototype.get_element_options=function(){return{}},wc_stripe.BaseGateway.prototype.initialize=function(){},wc_stripe.BaseGateway.prototype.create_button=function(){},wc_stripe.BaseGateway.prototype.is_gateway_selected=function(){return o('[name="payment_method"]:checked').val()===this.gateway_id},wc_stripe.BaseGateway.prototype.is_saved_method_selected=function(){return this.is_gateway_selected()&&"saved"===o('[name="'+this.gateway_id+'_payment_type_key"]:checked').val()},wc_stripe.BaseGateway.prototype.has_checkout_error=function(){return 0<o("#wc_stripe_checkout_error").length&&this.is_gateway_selected()},wc_stripe.BaseGateway.prototype.submit_error=function(t){var e=this.get_error_message(t);e.indexOf("</ul>")<0&&(e='<div class="'+function(){var t="woocommerce-NoticeGroup";return this.is_current_page("checkout")&&(t+=" woocommerce-NoticeGroup-checkout"),t}.bind(this)()+'"><ul class="woocommerce-error"><li>'+e+"</li></ul></div>");t=o(document.body).triggerHandler("wc_stripe_submit_error",[e,t,this]);e=void 0===t?e:t,this.submit_message(e)},wc_stripe.BaseGateway.prototype.submit_error_code=function(t){console.log(t)},wc_stripe.BaseGateway.prototype.get_error_message=function(t){return"object"==typeof t&&(t=t.code&&wc_stripe_messages[t.code]?wc_stripe_messages[t.code]:t.message),t},wc_stripe.BaseGateway.prototype.submit_message=function(t){o(".woocommerce-error, .woocommerce-message, .woocommerce-info").remove();var e=o(this.message_container);e.closest("form").length&&(e=e.closest("form")),e.prepend(t),e.removeClass("processing").unblock(),e.find(".input-text, select, input:checkbox").blur(),o.scroll_to_notices?o.scroll_to_notices(e):o("html, body").animate({scrollTop:e.offset().top-100},1e3)},wc_stripe.BaseGateway.prototype.get_billing_details=function(){var t={name:this.get_customer_name("billing"),address:{city:this.fields.get("billing_city",null),country:this.fields.get("billing_country",null),line1:this.fields.get("billing_address_1",null),line2:this.fields.get("billing_address_2",null),postal_code:this.fields.get("billing_postcode",null),state:this.fields.get("billing_state",null)}};return t.name&&" "!==t.name||delete t.name,""!=this.fields.get("billing_email")&&(t.email=this.fields.get("billing_email")),""!=this.fields.get("billing_phone")&&(t.phone=this.fields.get("billing_phone")),t},wc_stripe.BaseGateway.prototype.get_first_name=function(t){return o("#"+t+"_first_name").val()},wc_stripe.BaseGateway.prototype.get_last_name=function(t){return o("#"+t+"_last_name").val()},wc_stripe.BaseGateway.prototype.get_shipping_prefix=function(){return this.needs_shipping()&&0<o('[name="ship_to_different_address"]').length&&o('[name="ship_to_different_address"]').is(":checked")?"shipping":"billing"},wc_stripe.BaseGateway.prototype.should_save_method=function(){return o("#"+this.gateway_id+"_save_source_key").is(":checked")},wc_stripe.BaseGateway.prototype.is_add_payment_method_page=function(){return"add_payment_method"===this.get_page()||o(document.body).hasClass("woocommerce-add-payment-method")},wc_stripe.BaseGateway.prototype.is_change_payment_method=function(){return"change_payment_method"===this.get_page()},wc_stripe.BaseGateway.prototype.get_selected_payment_method=function(){return o(this.saved_method_selector).val()},wc_stripe.BaseGateway.prototype.needs_shipping=function(){return this.get_gateway_data().needs_shipping},wc_stripe.BaseGateway.prototype.get_currency=function(){return this.get_gateway_data().currency},wc_stripe.BaseGateway.prototype.get_gateway_data=function(){var t=o(this.container).find(".woocommerce_".concat(this.gateway_id,"_gateway_data")).data("gateway");return void 0===t&&this.is_current_page("checkout")&&void 0===(t=o("form.checkout").find(".woocommerce_".concat(this.gateway_id,"_gateway_data")).data("gateway"))&&(t=o(".woocommerce_"+this.gateway_id+"_gateway_data").data("gateway")),t},wc_stripe.BaseGateway.prototype.set_gateway_data=function(t){o(this.container).find(".woocommerce_".concat(this.gateway_id,"_gateway_data")).data("gateway",t)},wc_stripe.BaseGateway.prototype.get_customer_name=function(t){return this.fields.get(t+"_first_name")+" "+this.fields.get(t+"_last_name")},wc_stripe.BaseGateway.prototype.get_customer_email=function(){return this.fields.get("billing_email")},wc_stripe.BaseGateway.prototype.get_address_field_hash=function(t){for(var e=["_first_name","_last_name","_address_1","_address_2","_postcode","_city","_state","_country"],i="",s=0;s<e.length;s++)i+=this.fields.get(t+e[s])+"_";return i},wc_stripe.BaseGateway.prototype.block=function(){o().block&&o.blockUI({message:null,overlayCSS:{background:"#fff",opacity:.6}})},wc_stripe.BaseGateway.prototype.unblock=function(){o().block&&o.unblockUI()},wc_stripe.BaseGateway.prototype.get_form=function(){return o(this.token_selector).closest("form")},wc_stripe.BaseGateway.prototype.get_total_price=function(){return this.get_gateway_data().total},wc_stripe.BaseGateway.prototype.get_total_price_cents=function(){return this.get_gateway_data().total_cents},wc_stripe.BaseGateway.prototype.set_total_price=function(t){var e=this.get_gateway_data();e.total=t,this.set_gateway_data(e)},wc_stripe.BaseGateway.prototype.set_total_price_cents=function(t){var e=this.get_gateway_data();e.total_cents=t,this.set_gateway_data(e)},wc_stripe.BaseGateway.prototype.set_payment_method=function(t){o('[name="payment_method"][value="'+t+'"]').prop("checked",!0).trigger("click")},wc_stripe.BaseGateway.prototype.set_selected_shipping_methods=function(t){if(this.fields.set("shipping_method",t),t&&o('[name^="shipping_method"]').length)for(var e in t){var i=t[e];o('[name="shipping_method['+e+']"][value="'+i+'"]').prop("checked",!0).trigger("change")}},wc_stripe.BaseGateway.prototype.on_token_received=function(t){this.payment_token_received=!0,this.set_nonce(t.id),this.process_checkout()},wc_stripe.BaseGateway.prototype.createPaymentRequest=function(){try{this.payment_request_options=this.get_payment_request_options(),this.paymentRequest=i.paymentRequest(this.payment_request_options),this.payment_request_options.requestShipping&&(this.paymentRequest.on("shippingaddresschange",this.update_shipping_address.bind(this)),this.paymentRequest.on("shippingoptionchange",this.update_shipping_method.bind(this))),this.paymentRequest.on("paymentmethod",this.on_payment_method_received.bind(this))}catch(t){return void this.submit_error(t.message)}},wc_stripe.BaseGateway.prototype.get_payment_request_options=function(){var t={country:this.params.country_code,currency:this.get_currency().toLowerCase(),total:{amount:this.get_total_price_cents(),label:this.params.total_label,pending:!0},requestPayerName:function(){return!this.is_current_page("checkout")||!this.is_valid_address(this.get_address_object("billing"),"billing",["email","phone"])}.bind(this)(),requestPayerEmail:this.fields.requestFieldInWallet("billing_email"),requestPayerPhone:this.fields.requestFieldInWallet("billing_phone"),requestShipping:function(){if(this.needs_shipping()){var t=this.get_shipping_prefix();if(this.is_current_page("checkout")&&!this.is_valid_address(this.get_address_object(t),t,["email","phone"])||!this.is_current_page("checkout"))return!0}return!1}.bind(this)()},e=this.get_display_items(),i=this.get_shipping_options();return e&&(t.displayItems=e),t.requestShipping&&i&&(t.shippingOptions=i),t},wc_stripe.BaseGateway.prototype.get_payment_request_update=function(t){var e={currency:this.get_currency().toLowerCase(),total:{amount:parseInt(this.get_total_price_cents()),label:this.params.total_label,pending:!0}},i=this.get_display_items(),s=this.get_shipping_options();return i&&(e.displayItems=i),this.payment_request_options.requestShipping&&s&&(e.shippingOptions=s),t&&(e=o.extend(!0,{},e,t)),e},wc_stripe.BaseGateway.prototype.get_display_items=function(){return this.get_gateway_data().items},wc_stripe.BaseGateway.prototype.set_display_items=function(t){var e=this.get_gateway_data();e.items=t,this.set_gateway_data(e)},wc_stripe.BaseGateway.prototype.get_shipping_options=function(){return this.get_gateway_data().shipping_options},wc_stripe.BaseGateway.prototype.set_shipping_options=function(t){var e=this.get_gateway_data();e.shipping_options=t,this.set_gateway_data(e)},wc_stripe.BaseGateway.prototype.map_address=function(t){return{city:t.city,postcode:t.postalCode,state:t.region,country:t.country}},wc_stripe.BaseGateway.prototype.on_payment_method_received=function(t){try{this.payment_response=t,this.populate_checkout_fields(t),t.complete("success"),this.on_token_received(t.paymentMethod)}catch(e){a.alert(e)}},wc_stripe.BaseGateway.prototype.populate_checkout_fields=function(t){this.set_nonce(t.paymentMethod.id),this.update_addresses(t)},wc_stripe.BaseGateway.prototype.update_addresses=function(t){t.payerName&&this.fields.set("name",t.payerName,"billing"),t.payerEmail&&this.fields.set("email",t.payerEmail,"billing"),t.payerPhone&&(this.fields.set("phone",t.payerPhone,"billing"),this.fields.exists("shipping_phone")&&this.fields.isEmpty("shipping_phone")&&this.fields.set("shipping_phone",t.payerPhone)),t.shippingAddress&&this.populate_shipping_fields(t.shippingAddress),t.paymentMethod.billing_details.address&&this.populate_billing_fields(t.paymentMethod.billing_details.address)},wc_stripe.BaseGateway.prototype.populate_address_fields=function(t,e){for(var i in t)null!==t[i]&&this.fields.set(i,t[i],e)},wc_stripe.BaseGateway.prototype.populate_billing_fields=function(t){this.populate_address_fields(t,"billing")},wc_stripe.BaseGateway.prototype.populate_shipping_fields=function(t){this.populate_address_fields(t,"shipping")},wc_stripe.BaseGateway.prototype.get_address_fields=function(){return["first_name","last_name","country","address_1","address_2","city","state","postcode","phone","email"]},wc_stripe.BaseGateway.prototype.get_address_object=function(e){var i={};return this.get_address_fields().forEach(function(t){i[t]=this.fields.get(t,e)}.bind(this)),i},wc_stripe.BaseGateway.prototype.is_current_page=function(t){return this.get_page()===t},wc_stripe.BaseGateway.prototype.is_valid_address=function(t,e,i){if(o.isEmptyObject(t))return!1;var s=this.get_address_fields();void 0!==i&&i.forEach(function(t){-1<s.indexOf(t)&&s.splice(s.indexOf(t),1)});for(var a=0;a<s.length;a++){var n=s[a];if(this.fields.required(e+"_"+n)&&(!t[n]||"undefined"==typeof t[n]||!this.fields.isValid(n,t[n],t)))return!1}return!0},wc_stripe.BaseGateway.prototype.ajax_before_send=function(t){0<this.params.user_id&&t.setRequestHeader("X-WP-Nonce",this.params.rest_nonce)},wc_stripe.BaseGateway.prototype.process_checkout=function(){return new Promise(function(){this.block(),o.ajax({url:this.params.routes.checkout,method:"POST",dataType:"json",data:o.extend({},this.serialize_fields(),{payment_method:this.gateway_id,page_id:this.get_page(),currency:this.get_currency()}),beforeSend:this.ajax_before_send.bind(this)}).done(function(t){t.reload?a.location.reload():"success"===t.result?a.location=t.redirect:(t.messages&&this.submit_error(t.messages),this.unblock())}.bind(this)).fail(function(t,e,i){this.unblock(),this.submit_error(i)}.bind(this))}.bind(this))},wc_stripe.BaseGateway.prototype.process_payment=function(t,e){o.ajax({method:"POST",url:this.params.routes.checkout_payment,dataType:"json",data:o.extend({},this.fields.toJson(),{order_id:t,order_key:e}),beforeSend:this.ajax_before_send.bind(this)}).done(function(t){if(t.result&&"success"===t.result)a.location=t.redirect;else{if(t.reload)return a.location.reload();t.messages?(this.payment_token_received=!1,this.submit_error(t.messages)):this.submit_error(wc_checkout_params.i18n_checkout_error)}}.bind(this)).fail(function(){}.bind(this))},wc_stripe.BaseGateway.prototype.handle_card_action=function(e){try{return this.stripe.handleCardAction(e.client_secret).then(function(t){if(t.error)return this.payment_token_received=!1,this.submit_error(t.error),void this.sync_payment_intent(e.order_id,e.client_secret)["catch"](function(t){this.submit_error(t.message)}.bind(this));this.is_current_page("order_pay")?this.get_form().submit():this.process_payment(e.order_id,e.order_key)}.bind(this))["catch"](function(t){this.submit_error(t.message)}.bind(this)),!1}catch(t){}},wc_stripe.BaseGateway.prototype.hashchange=function(t){var e=t.newURL.match(/response=(.*)/);if(e)try{var i=JSON.parse(a.atob(decodeURIComponent(e[1])));i&&i.hasOwnProperty("client_secret")&&i.gateway_id===this.gateway_id&&(history.pushState({},"",a.location.pathname),this.handle_card_action(i))}catch(s){}return!0},wc_stripe.BaseGateway.prototype.sync_payment_intent=function(t,s){return new Promise(function(e,i){o.when(o.ajax({method:"POST",dataType:"json",url:this.params.routes.sync_intent,data:{order_id:t,client_secret:s},beforeSend:this.ajax_before_send.bind(this)})).done(function(t){(t.code?i:e)(t)}).fail(function(t,e,i){this.submit_error(i)}.bind(this))}.bind(this))},wc_stripe.BaseGateway.prototype.serialize_form=function(t){var e,i=t.find("input").filter(function(t,e){return!o(e).is('[name^="add-to-cart"]')}.bind(this)).serializeArray(),s={};for(e in i){var a=i[e];s[a.name]=a.value}return s.payment_method=this.gateway_id,s},wc_stripe.BaseGateway.prototype.serialize_fields=function(){return o.extend({},this.fields.toJson(),o(document.body).triggerHandler("wc_stripe_process_checkout_data",[this,this.fields]))},wc_stripe.BaseGateway.prototype.map_shipping_methods=function(t){var e={};return"default"===t||1<(t=t.match(/^([\w+]):(.+)$/)).length&&(e[t[1]]=t[2]),e},wc_stripe.BaseGateway.prototype.maybe_set_ship_to_different=function(){o('[name="ship_to_different_address"]').length&&o('[name="ship_to_different_address"]').prop("checked",this.get_address_field_hash("billing")!==this.get_address_field_hash("shipping")).trigger("change")},wc_stripe.BaseGateway.prototype.update_shipping_address=function(s){return new Promise(function(e,i){o.ajax({url:this.params.routes.shipping_address,method:"POST",dataType:"json",data:{address:this.map_address(s.shippingAddress),payment_method:this.gateway_id,page_id:this.get_page(),currency:this.get_currency()},beforeSend:this.ajax_before_send.bind(this)}).done(function(t){t.code?(s.updateWith(t.data.newData),i(t.data)):(s.updateWith(t.data.newData),this.fields.set("shipping_method",t.data.shipping_method),e(t.data))}.bind(this)).fail(function(){}.bind(this))}.bind(this))},wc_stripe.BaseGateway.prototype.update_shipping_method=function(s){return new Promise(function(e,i){o.ajax({url:this.params.routes.shipping_method,method:"POST",dataType:"json",data:{shipping_method:s.shippingOption.id,payment_method:this.gateway_id,currency:this.get_currency(),page_id:this.get_page()},beforeSend:this.ajax_before_send.bind(this)}).done(function(t){t.code?(s.updateWith(t.data.newData),i(t.data)):(this.set_selected_shipping_methods(t.data.shipping_methods),s.updateWith(t.data.newData),e(t.data))}.bind(this)).fail(function(t,e,i){this.submit_error(i)}.bind(this))}.bind(this))},wc_stripe.CheckoutGateway=function(){this.message_container="li.payment_method_"+this.gateway_id,this.banner_container="li.banner_payment_method_"+this.gateway_id,o(document.body).on("update_checkout",this.update_checkout.bind(this)),o(document.body).on("updated_checkout",this.updated_checkout.bind(this)),o(document.body).on("updated_checkout",this.container_styles.bind(this)),o(document.body).on("checkout_error",this.checkout_error.bind(this)),o(this.token_selector).closest("form").on("checkout_place_order_"+this.gateway_id,this.checkout_place_order.bind(this)),o(document.body).on("wc_stripe_new_method_"+this.gateway_id,this.on_show_new_methods.bind(this)),o(document.body).on("wc_stripe_saved_method_"+this.gateway_id,this.on_show_saved_methods.bind(this)),o(document.body).on("wc_stripe_payment_method_selected",this.on_payment_method_selected.bind(this)),this.banner_enabled()&&o(".woocommerce-billing-fields").length&&o(".wc-stripe-banner-checkout").css("max-width",o(".woocommerce-billing-fields").outerWidth(!0)),this.container_styles(),this.hasOrderReviewParams()},wc_stripe.CheckoutGateway.prototype.container_styles=function(){this.params.description||o(this.container).addClass("wc-stripe-no-desc"),o(this.container).find(".wc-stripe-saved-methods").length||o(this.container).find(".payment_box").addClass("wc-stripe-no-methods")},wc_stripe.CheckoutGateway.prototype.hasOrderReviewParams=function(){var t=a.location.search.match(/_stripe_order_review=(.+)/);if(t&&1<t.length)try{var e=JSON.parse(a.atob(decodeURIComponent(t[1])));this.gateway_id===e.payment_method&&(o(function(){this.payment_token_received=!0,this.set_nonce(e.payment_nonce),this.set_use_new_option(!0)}.bind(this)),history.pushState({},"",a.location.pathname))}catch(i){}},wc_stripe.CheckoutGateway.prototype.has3DSecureParams=function(){if((this.is_current_page("order_pay")||this.is_change_payment_method())&&a.location.hash&&"string"==typeof a.location.hash){var t=a.location.hash.match(/response=(.*)/);if(t)try{var e=JSON.parse(a.atob(decodeURIComponent(t[1])));e&&e.hasOwnProperty("client_secret")&&e.gateway_id===this.gateway_id&&(o(function(){this.set_payment_method(this.gateway_id),this.set_use_new_option(!0),this.set_nonce(e.pm),!0===e.save_method&&this.set_save_payment_method(!0),o('[name="terms"]').prop("checked",!0)}.bind(this)),history.pushState({},"",a.location.pathname+a.location.search),this.handle_card_action(e))}catch(i){}}},wc_stripe.CheckoutGateway.prototype.update_shipping_address=function(){return wc_stripe.BaseGateway.prototype.update_shipping_address.apply(this,arguments).then(function(t){this.populate_address_fields(t.address,this.get_shipping_prefix()),this.fields.toFormFields({update_shipping_method:!1})}.bind(this))},wc_stripe.CheckoutGateway.prototype.updated_checkout=function(){},wc_stripe.CheckoutGateway.prototype.update_checkout=function(){},wc_stripe.CheckoutGateway.prototype.checkout_error=function(){this.has_checkout_error()&&(this.payment_token_received=!1,this.payment_response=null,this.show_payment_button(),this.hide_place_order())},wc_stripe.CheckoutGateway.prototype.is_valid_checkout=function(){return!(o('[name="terms"]').length&&o('[name="terms"]').is(":visible")&&!o('[name="terms"]').is(":checked"))},wc_stripe.CheckoutGateway.prototype.get_payment_method=function(){return o('[name="payment_method"]:checked').val()},wc_stripe.CheckoutGateway.prototype.set_use_new_option=function(t){o("#"+this.gateway_id+"_use_new").prop("checked",t).trigger("change")},wc_stripe.CheckoutGateway.prototype.checkout_place_order=function(){return this.is_valid_checkout()?!!this.is_saved_method_selected()||this.payment_token_received:(this.submit_error(this.params.messages.terms),!1)},wc_stripe.CheckoutGateway.prototype.on_token_received=function(t){this.payment_token_received=!0,this.set_nonce(t.id),this.hide_payment_button(),this.show_place_order()},wc_stripe.CheckoutGateway.prototype.block=function(){o().block&&o("form.checkout").block({message:null,overlayCSS:{background:"#fff",opacity:.6}})},wc_stripe.CheckoutGateway.prototype.unblock=function(){o().block&&o("form.checkout").unblock()},wc_stripe.CheckoutGateway.prototype.hide_place_order=function(){o("#place_order").addClass("wc-stripe-hide")},wc_stripe.CheckoutGateway.prototype.show_place_order=function(){o("#place_order").removeClass("wc-stripe-hide")},wc_stripe.CheckoutGateway.prototype.on_show_new_methods=function(){this.payment_token_received?(this.show_place_order(),this.hide_payment_button()):(this.hide_place_order(),this.show_payment_button())},wc_stripe.CheckoutGateway.prototype.on_show_saved_methods=function(){this.hide_payment_button(),this.show_place_order()},wc_stripe.CheckoutGateway.prototype.show_payment_button=function(){this.$button&&this.$button.show()},wc_stripe.CheckoutGateway.prototype.hide_payment_button=function(){this.$button&&this.$button.hide()},wc_stripe.CheckoutGateway.prototype.trigger_payment_method_selected=function(){this.on_payment_method_selected(null,o('[name="payment_method"]:checked').val())},wc_stripe.CheckoutGateway.prototype.on_payment_method_selected=function(t,e){e===this.gateway_id?this.payment_token_received||this.is_saved_method_selected()?(this.hide_payment_button(),this.show_place_order()):(this.show_payment_button(),this.hide_place_order()):(this.hide_payment_button(),e.indexOf("stripe_")<0&&this.show_place_order())},wc_stripe.CheckoutGateway.prototype.banner_enabled=function(){return"1"===this.params.banner_enabled},wc_stripe.CheckoutGateway.prototype.checkout_fields_valid=function(){if(["checkout","order_pay"].indexOf(this.get_page())<0)return!0;var t=!0;return(t=this.fields.validateFields("billing"))?this.needs_shipping()&&o("#ship-to-different-address-checkbox").is(":checked")?(t=this.fields.validateFields("shipping"))||this.submit_error(this.params.messages.required_field):(t=this.is_valid_checkout())||this.submit_error(this.params.messages.terms):this.submit_error(this.params.messages.required_field),t},wc_stripe.CheckoutGateway.prototype.cart_contains_subscription=function(){return"undefined"!=typeof wc_stripe_cart_contains_subscription&&!0===wc_stripe_cart_contains_subscription},wc_stripe.CheckoutGateway.prototype.set_save_payment_method=function(t){o('[name="'+this.gateway_id+'_save_source_key"]').prop("checked",t)},wc_stripe.ProductGateway=function(){this.message_container="div.product",o("form.cart").on("found_variation",this.found_variation.bind(this)),o("form.cart").on("reset_data",this.reset_variation_data.bind(this)),this.buttonWidth=o("form.cart div.quantity").outerWidth(!0)+o(".single_add_to_cart_button").outerWidth();var t=o(".single_add_to_cart_button").css("marginLeft");t&&(this.buttonWidth+=parseInt(t.replace("px",""))),o(this.container).css("max-width",this.buttonWidth+"px")},wc_stripe.ProductGateway.prototype.get_quantity=function(){return parseInt(o('[name="quantity"]').val())},wc_stripe.ProductGateway.prototype.set_rest_nonce=function(t,e){this.params.rest_nonce=e},wc_stripe.ProductGateway.prototype.found_variation=function(t,e){var i=this.get_gateway_data();i.product.price=e.display_price,i.needs_shipping=!e.is_virtual,i.product.variation=e,this.set_gateway_data(i)},wc_stripe.ProductGateway.prototype.reset_variation_data=function(){var t=this.get_product_data();t.variation=!1,this.set_product_data(t),this.disable_payment_button()},wc_stripe.ProductGateway.prototype.disable_payment_button=function(){this.$button&&this.get_button().prop("disabled",!0).addClass("disabled")},wc_stripe.ProductGateway.prototype.enable_payment_button=function(){this.$button&&this.get_button().prop("disabled",!1).removeClass("disabled")},wc_stripe.ProductGateway.prototype.get_button=function(){return this.$button},wc_stripe.ProductGateway.prototype.is_variable_product=function(){return 0<o('[name="variation_id"]').length},wc_stripe.ProductGateway.prototype.variable_product_selected=function(){var t=o('input[name="variation_id"]').val();return!!t&&"0"!=t},wc_stripe.ProductGateway.prototype.get_product_data=function(){return this.get_gateway_data().product},wc_stripe.ProductGateway.prototype.set_product_data=function(t){var e=this.get_gateway_data();e.product=t,this.set_gateway_data(e)},wc_stripe.ProductGateway.prototype.get_form=function(){return o(this.container).closest("form")},wc_stripe.ProductGateway.prototype.add_to_cart=function(){return new Promise(function(e,i){this.block();var t={product_id:this.get_product_data().id,variation_id:this.is_variable_product()?o('[name="variation_id"]').val():0,qty:o('[name="quantity"]').val(),payment_method:this.gateway_id,currency:this.get_currency(),page_id:this.get_page()},s=this.get_form().find(':not([name="add-to-cart"],[name="quantity"],[name^="attribute_"],[name="variation_id"])').serializeArray();if(s)for(var a in s)t[s[a].name]=s[a].value;o.ajax({url:this.params.routes.add_to_cart,method:"POST",dataType:"json",data:o.extend({},t,this.get_product_variations()),beforeSend:this.ajax_before_send.bind(this)}).done(function(t){this.unblock(),t.code?(this.submit_error(t.message),i(t)):(this.set_total_price(t.data.total),this.set_total_price_cents(t.data.totalCents),this.set_display_items(t.data.displayItems),e(t.data))}.bind(this)).fail(function(t,e,i){this.unblock(),this.submit_error(i)}.bind(this))}.bind(this))},wc_stripe.ProductGateway.prototype.cart_calculation=function(t){return new Promise(function(e,i){o.ajax({url:this.params.routes.cart_calculation,method:"POST",dataType:"json",data:o.extend({},{product_id:this.get_product_data().id,variation_id:this.is_variable_product()&&t?t:0,qty:o('[name="quantity"]').val(),currency:this.get_currency(),payment_method:this.gateway_id},this.get_product_variations()),beforeSend:this.ajax_before_send.bind(this)}).done(function(t){t.code?(this.cart_calculation_error=!0,i(t)):(this.set_total_price(t.data.total),this.set_total_price_cents(t.data.totalCents),this.set_display_items(t.data.displayItems),e(t.data))}.bind(this)).fail(function(){}.bind(this))}.bind(this))},wc_stripe.ProductGateway.prototype.get_product_variations=function(){var s={};return this.is_variable_product()&&o('.variations [name^="attribute_"]').each(function(t,e){var i=o(e),e=i.data("attribute_name")||i.attr("name");s[e]=i.val()}),s},wc_stripe.CartGateway=function(){this.message_container="div.woocommerce",o(document.body).on("updated_wc_div",this.updated_html.bind(this)),o(document.body).on("updated_cart_totals",this.updated_html.bind(this)),o(document.body).on("wc_cart_emptied",this.cart_emptied.bind(this))},wc_stripe.CartGateway.prototype.submit_error=function(t){this.submit_message(this.get_error_message(t))},wc_stripe.CartGateway.prototype.updated_html=function(t){},wc_stripe.CartGateway.prototype.cart_emptied=function(t){},wc_stripe.CartGateway.prototype.add_cart_totals_class=function(){o(".cart_totals").addClass("stripe_cart_gateway_active")},wc_stripe.GooglePay=function(){};var s={apiVersion:2,apiVersionMinor:0},n={type:"CARD",parameters:{allowedAuthMethods:["PAN_ONLY"],allowedCardNetworks:["AMEX","DISCOVER","INTERAC","JCB","MASTERCARD","VISA"],assuranceDetailsRequired:!0}};wc_stripe.GooglePay.prototype.update_addresses=function(t){var e;t.paymentMethodData.info.billingAddress&&(e=t.paymentMethodData.info.billingAddress,this.is_current_page("checkout")&&this.is_valid_address(this.billing_address_object,"billing",["phone","email"])&&(e={phoneNumber:e.phoneNumber}),this.populate_billing_fields(e),e.phoneNumber&&this.fields.exists("shipping_phone")&&this.fields.isEmpty("shipping_phone")&&this.fields.set("shipping_phone",e.phoneNumber)),t.shippingAddress&&this.populate_shipping_fields(t.shippingAddress),t.email&&this.fields.set("email",t.email,"billing")},wc_stripe.GooglePay.prototype.map_address=function(t){return{city:t.locality,postcode:t.postalCode,state:t.administrativeArea,country:t.countryCode}},wc_stripe.GooglePay.prototype.update_payment_data=function(s){return new Promise(function(e,i){var t="default"==s.shippingOptionData.id?null:s.shippingOptionData.id;o.when(o.ajax({url:this.params.routes.payment_data,dataType:"json",method:"POST",data:{address:this.map_address(s.shippingAddress),shipping_method:t,page_id:this.get_page(),currency:this.get_currency()},beforeSend:this.ajax_before_send.bind(this)})).done(function(t){t.code?i(t.data.data):e(t.data)}.bind(this)).fail(function(){i()}.bind(this))}.bind(this))},wc_stripe.GooglePay.prototype.on_payment_data_changed=function(i){return new Promise(function(e){this.update_payment_data(i).then(function(t){e(t.paymentRequestUpdate),this.set_selected_shipping_methods(t.shipping_methods),this.payment_data_updated(t,i)}.bind(this))["catch"](function(t){e(t)}.bind(this))}.bind(this))},wc_stripe.GooglePay.prototype.payment_data_updated=function(t){},wc_stripe.GooglePay.prototype.get_merchant_info=function(){var t={merchantId:this.params.merchant_id,merchantName:this.params.merchant_name};return"TEST"===this.params.environment&&delete t.merchantId,t},wc_stripe.GooglePay.prototype.get_payment_options=function(){var t,e={environment:this.params.environment,merchantInfo:this.get_merchant_info(),paymentDataCallbacks:{onPaymentAuthorized:function(){return new Promise(function(t){t({transactionState:"SUCCESS"})}.bind(this))}}};return this.needs_shipping()&&(t=this.get_shipping_prefix(),(!this.is_current_page("checkout")||this.is_valid_address(this.get_address_object(t),t,["email","phone"]))&&this.is_current_page("checkout")||(e.paymentDataCallbacks.onPaymentDataChanged=this.on_payment_data_changed.bind(this))),e},wc_stripe.GooglePay.prototype.build_payment_request=function(){var t=o.extend({},s,{emailRequired:this.fields.requestFieldInWallet("billing_email"),merchantInfo:this.get_merchant_info(),allowedPaymentMethods:[o.extend({type:"CARD",tokenizationSpecification:{type:"PAYMENT_GATEWAY",parameters:{gateway:"stripe","stripe:version":"2018-10-31","stripe:publishableKey":this.params.api_key}}},n)],shippingAddressRequired:function(){if(this.needs_shipping()){var t=this.get_shipping_prefix();if(this.is_current_page("checkout")&&!this.is_valid_address(this.get_address_object(t),t,["email","phone"])||!this.is_current_page("checkout"))return!0}return!1}.bind(this)(),transactionInfo:{countryCode:this.params.processing_country,currencyCode:this.get_currency(),totalPriceStatus:"ESTIMATED",totalPrice:this.get_total_price().toString(),displayItems:this.get_display_items(),totalPriceLabel:this.params.total_price_label}});return t.allowedPaymentMethods[0].parameters.billingAddressRequired=function(){if(this.is_current_page("checkout")){var t=this.billing_address_object=this.get_address_object("billing");return this.fields.requestFieldInWallet("billing_phone")||!this.is_valid_address(t,"billing",["email"])?!0:!1}return!0}.bind(this)(),t.allowedPaymentMethods[0].parameters.billingAddressRequired&&(t.allowedPaymentMethods[0].parameters.billingAddressParameters={format:"FULL",phoneNumberRequired:this.fields.requestFieldInWallet("billing_phone")}),t.shippingAddressRequired?(t.shippingAddressParameters={},t.shippingOptionRequired=!0,t.shippingOptionParameters={shippingOptions:this.get_shipping_options()},t.callbackIntents=["SHIPPING_ADDRESS","SHIPPING_OPTION","PAYMENT_AUTHORIZATION"]):t.callbackIntents=["PAYMENT_AUTHORIZATION"],this.payment_request_options=t},wc_stripe.GooglePay.prototype.createPaymentsClient=function(){this.paymentsClient=new google.payments.api.PaymentsClient(this.get_payment_options())},wc_stripe.GooglePay.prototype.isReadyToPay=function(){return new Promise(function(t){var e=o.extend({},s);e.allowedPaymentMethods=[n],this.paymentsClient.isReadyToPay(e).then(function(){this.can_pay=!0,this.create_button(),t()}.bind(this))["catch"](function(t){this.submit_error(t)}.bind(this))}.bind(this))},wc_stripe.GooglePay.prototype.create_button=function(){this.$button&&this.$button.remove(),this.$button=o(this.paymentsClient.createButton({onClick:this.start.bind(this),buttonColor:this.params.button_color,buttonType:this.params.button_style,buttonSizeMode:this.params.button_size_mode})),this.$button.addClass("gpay-button-container")},wc_stripe.GooglePay.prototype.start=function(){this.createPaymentsClient(),this.paymentsClient.loadPaymentData(this.build_payment_request()).then(function(t){var e=JSON.parse(t.paymentMethodData.tokenizationData.token);this.update_addresses(t),this.stripe.createPaymentMethod({type:"card",card:{token:e.id},billing_details:this.get_billing_details()}).then(function(t){if(t.error)return this.submit_error(t.error);this.on_token_received(t.paymentMethod)}.bind(this))}.bind(this))["catch"](function(t){"CANCELED"!==t.statusCode&&(t.statusMessage&&-1<t.statusMessage.indexOf("paymentDataRequest.callbackIntent")?this.submit_error_code("DEVELOPER_ERROR_WHITELIST"):this.submit_error(t.statusMessage))}.bind(this))},wc_stripe.ApplePay=function(){},wc_stripe.ApplePay.prototype.initialize=function(){this.createPaymentRequest(),this.canMakePayment()},wc_stripe.ApplePay.prototype.get_payment_request_options=function(){return o.extend({},wc_stripe.BaseGateway.prototype.get_payment_request_options.apply(this,arguments),{disableWallets:["googlePay"]})},wc_stripe.ApplePay.prototype.create_button=function(){this.$button&&this.$button.remove(),this.$button=o(this.params.button),this.$button.on("click",this.start.bind(this)),this.append_button()},wc_stripe.ApplePay.prototype.canMakePayment=function(){return new Promise(function(e){this.paymentRequest.canMakePayment().then(function(t){t&&t.applePay&&(this.can_pay=!0,this.create_button(),o(this.container).show(),e(t))}.bind(this))}.bind(this))},wc_stripe.ApplePay.prototype.start=function(t){t.preventDefault(),this.paymentRequest.update(this.get_payment_request_update({total:{pending:!1}})),this.paymentRequest.show()},wc_stripe.PaymentRequest=function(){},wc_stripe.PaymentRequest.prototype.initialize=function(){this.createPaymentRequest(),this.createPaymentRequestButton(),this.canMakePayment(),this.paymentRequestButton.on("click",this.button_click.bind(this))},wc_stripe.PaymentRequest.prototype.button_click=function(t){},wc_stripe.PaymentRequest.prototype.createPaymentRequestButton=function(){this.paymentRequestButton&&this.paymentRequestButton.destroy(),this.paymentRequestButton=this.elements.create("paymentRequestButton",{paymentRequest:this.paymentRequest,style:{paymentRequestButton:{type:this.params.button.type,theme:this.params.button.theme,height:this.params.button.height}}})},wc_stripe.PaymentRequest.prototype.canMakePayment=function(){return new Promise(function(e){this.paymentRequest.canMakePayment().then(function(t){t&&!t.applePay&&(this.can_pay=!0,this.create_button(),o(this.container).show(),e(t))}.bind(this))}.bind(this))},wc_stripe.PaymentRequest.prototype.create_button=function(){this.paymentRequestButton.mount("#wc-stripe-payment-request-container")},wc_stripe.Afterpay=function(){},wc_stripe.Afterpay.prototype.is_eligible=function(t){return this.needs_shipping()&&t>this.get_min()&&t<this.get_max()},wc_stripe.Afterpay.prototype.get_min=function(){var t=this.get_currency(),t=this.params.requirements[t];return t?t[1]:0},wc_stripe.Afterpay.prototype.get_max=function(){var t=this.get_currency(),t=this.params.requirements[t];return t?t[2]:0},wc_stripe.Afterpay.prototype.add_eligibility=function(t,e){o(t).length&&(this.is_eligible(e)?o(t).removeClass("afterpay-ineligible"):this.hide_ineligible_active()&&o(t).addClass("afterpay-ineligible"))},wc_stripe.Afterpay.prototype.hide_ineligible_active=function(){return"yes"===this.params.hide_ineligible},wc_stripe.CheckoutFields=function(t,e){this.params=t,this.page=e,this.session_values=this.supportsSessionStorage()&&sessionStorage.getItem("wc_stripe_checkout_fields")?JSON.parse(sessionStorage.getItem("wc_stripe_checkout_fields")):{},this.fields=new Map(Object.keys(this.params).map(function(t){return null===this.params[t].value&&(t in this.session_values&&null!==this.session_values[t]?this.params[t].value=this.session_values[t]:this.params[t].value=""),[t,this.params[t].value]}.bind(this))),("checkout"===e||"cart"===e&&o(document.body).is(".woocommerce-checkout"))&&(o(document.body).on("updated_checkout",this.updated_checkout.bind(this)),o("form.checkout").on("change",".input-text, select",this.onChange.bind(this)),o("form.checkout").on("change",'[name="ship_to_different_address"]',this.on_ship_to_address_change.bind(this)),this.init_i18n(),o('[name="ship_to_different_address"]').is(":checked")?this.update_required_fields(o("#shipping_country").val(),"shipping_country"):this.update_required_fields(o("#billing_country").val(),"billing_country"))},wc_stripe.CheckoutFields.prototype.supportsSessionStorage=function(){return"sessionStorage"in a&&null!==a.sessionStorage&&["getItem","setItem"].reduce(function(t,e){return t&&e in sessionStorage}.bind(this),!0)},wc_stripe.CheckoutFields.prototype.init_i18n=function(){"undefined"!=typeof wc_address_i18n_params?this.locales=JSON.parse(wc_address_i18n_params.locale.replace(/&quot;/g,'"')):this.locales=null},wc_stripe.CheckoutFields.prototype.updated_checkout=function(){this.syncCheckoutFieldsWithDOM()},wc_stripe.CheckoutFields.prototype.syncCheckoutFieldsWithDOM=function(){for(var t in this.params)o("#"+t).length&&this.fields.set(t,o("#"+t).val())},wc_stripe.CheckoutFields.prototype.onChange=function(t){try{var e=t.currentTarget.name,i=t.currentTarget.value;this.fields.set(e,i),"billing_country"!==e&&"shipping_country"!==e||this.update_required_fields(i,e),this.supportsSessionStorage()&&sessionStorage.setItem("wc_stripe_checkout_fields",JSON.stringify(this.toJson()))}catch(s){console.log(s)}},wc_stripe.CheckoutFields.prototype.update_required_fields=function(t,e){if(this.locales){var i,s=-1<e.indexOf("billing_")?"billing_":"shipping_",t="undefined"!=typeof this.locales[t]?this.locales[t]:this.locales["default"],a=o.extend(!0,{},this.locales["default"],t);for(i in a){var n=s+i;this.params[n]&&(this.params[n]=o.extend(!0,{},this.params[n],a[i]))}}},wc_stripe.CheckoutFields.prototype.on_ship_to_address_change=function(t){o(t.currentTarget).is(":checked")&&this.update_required_fields(o("#shipping_country").val(),"shipping_country")},wc_stripe.CheckoutFields.prototype.requestFieldInWallet=function(t){return"checkout"===this.page?this.required(t)&&this.isEmpty(t):"order_pay"!==this.page&&this.required(t)},wc_stripe.CheckoutFields.prototype.set=function(t,e,i){this[t]&&"function"==typeof this[t]?this[t]().set.call(this,e,i):this.fields.set(t,e)},wc_stripe.CheckoutFields.prototype.get=function(t,e){var i;return this[t]&&"function"==typeof this[t]?i=this[t]().get.call(this,e):null!=(i=this.fields.get(t))&&""!==i||void 0!==e&&(i=e),void 0===i?"":i},wc_stripe.CheckoutFields.prototype.required=function(t){return!(!this.params[t]||"undefined"==typeof this.params[t].required)&&this.params[t].required},wc_stripe.CheckoutFields.prototype.exists=function(t){return t in this.params},wc_stripe.CheckoutFields.prototype.isEmpty=function(t){if(this.fields.has(t)){t=this.fields.get(t);return null==t||"string"==typeof t&&0===t.trim().length}return!0},wc_stripe.CheckoutFields.prototype.isValid=function(t){if(this[t]&&"function"==typeof this[t])return this[t]().isValid.apply(this,Array.prototype.slice.call(arguments,1))},wc_stripe.CheckoutFields.prototype.first_name=function(){return{set:function(t,e){this.fields.set(e+"_first_name",t)},get:function(t){return this.fields.get(t+"_first_name")},isValid:function(t){return"string"==typeof t&&0<t.length}}},wc_stripe.CheckoutFields.prototype.last_name=function(){return{set:function(t,e){this.fields.set(e+"_last_name",t)},get:function(t){return this.fields.get(t+"_last_name")},isValid:function(t){return"string"==typeof t&&0<t.length}}},wc_stripe.CheckoutFields.prototype.address_1=function(){return{set:function(t,e){this.fields.set(e+"_address_1",t)},get:function(t){return this.fields.get(t+"_address_1")},isValid:function(t){return"string"==typeof t&&0<t.length}}},wc_stripe.CheckoutFields.prototype.address_2=function(){return{set:function(t,e){this.fields.set(e+"_address_2",t)},get:function(t){return this.fields.get(t+"_address_2")},isValid:function(t){return"string"==typeof t&&0<t.length}}},wc_stripe.CheckoutFields.prototype.name=function(){return{set:function(t,e){this.fields.set(e+"_full_name",t);var i=t.split(" ");1<i.length?(t=i.pop(),this.fields.set(e+"_first_name",i.join(" ")),this.fields.set(e+"_last_name",t)):1==i.length&&this.fields.set(e+"_first_name",i[0])},get:function(t){return this.fields.get(t+"_first_name")+" "+this.fields.get(t+"_last_name")}}},wc_stripe.CheckoutFields.prototype.email=function(){return{set:function(t,e){this.fields.set(e+"_email",t)},get:function(t){return this.fields.get(t+"_email")},isValid:function(t){return"string"==typeof t&&0<t.length}}},wc_stripe.CheckoutFields.prototype.phone=function(){return{set:function(t,e){this.fields.set(e+"_phone",t)},get:function(t){return this.fields.get(t+"_phone")},isValid:function(t){return"string"==typeof t&&0<t.length}}},wc_stripe.CheckoutFields.prototype.country=function(){return{set:function(t,e){this.fields.set(e+"_country",t)},get:function(t){return this.fields.get(t+"_country")},isValid:function(t){return"string"==typeof t&&2===t.length}}},wc_stripe.CheckoutFields.prototype.state=function(){return{set:function(i,t){2<(i=i.toUpperCase()).length&&"checkout"===this.page&&o("#"+t+"_state option").each(function(){var t=o(this),e=t.text().toUpperCase();i===e&&(i=t.val())}),this.fields.set(t+"_state",i)},get:function(t){return this.fields.get(t+"_state")},isValid:function(t){return"string"==typeof t&&0<t.length}}},wc_stripe.CheckoutFields.prototype.city=function(){return{set:function(t,e){this.fields.set(e+"_city",t)},get:function(t){return this.fields.get(t+"_city")},isValid:function(t){return"string"==typeof t&&0<t.length}}},wc_stripe.CheckoutFields.prototype.postcode=function(){return{set:function(t,e){this.fields.set(e+"_postcode",t)},get:function(t){return this.fields.get(t+"_postcode")},isValid:function(t){return"string"==typeof t&&0<t.length}}},wc_stripe.CheckoutFields.prototype.recipient=function(){return wc_stripe.CheckoutFields.prototype.name.apply(this,arguments)},wc_stripe.CheckoutFields.prototype.payerName=function(){return wc_stripe.CheckoutFields.prototype.name.apply(this,arguments)},wc_stripe.CheckoutFields.prototype.payerEmail=function(){return wc_stripe.CheckoutFields.prototype.email.apply(this,arguments)},wc_stripe.CheckoutFields.prototype.payerPhone=function(){return wc_stripe.CheckoutFields.prototype.phone.apply(this,arguments)},wc_stripe.CheckoutFields.prototype.phoneNumber=function(){return wc_stripe.CheckoutFields.prototype.phone.apply(this,arguments)},wc_stripe.CheckoutFields.prototype.countryCode=function(){return wc_stripe.CheckoutFields.prototype.country.apply(this,arguments)},wc_stripe.CheckoutFields.prototype.address1=function(){return wc_stripe.CheckoutFields.prototype.address_1.apply(this,arguments)},wc_stripe.CheckoutFields.prototype.address2=function(){return wc_stripe.CheckoutFields.prototype.address_2.apply(this,arguments)},wc_stripe.CheckoutFields.prototype.line1=function(){return wc_stripe.CheckoutFields.prototype.address_1.apply(this,arguments)},wc_stripe.CheckoutFields.prototype.line2=function(){return wc_stripe.CheckoutFields.prototype.address_2.apply(this,arguments)},wc_stripe.CheckoutFields.prototype.addressLine=function(){return{set:function(t,e){0<t.length&&this.fields.set(e+"_address_1",t[0]),1<t.length&&this.fields.set(e+"_address_2",t[1])},get:function(t){return[this.fields.get(t+"_address_1"),this.fields.get(t+"_address_2")]},isValid:function(t){return 0<t.length&&("string"==typeof t[0]&&0<t[0].length)}}},wc_stripe.CheckoutFields.prototype.region=function(){return wc_stripe.CheckoutFields.prototype.state.apply(this,arguments)},wc_stripe.CheckoutFields.prototype.administrativeArea=function(){return wc_stripe.CheckoutFields.prototype.state.apply(this,arguments)},wc_stripe.CheckoutFields.prototype.locality=function(){return wc_stripe.CheckoutFields.prototype.city.apply(this,arguments)},wc_stripe.CheckoutFields.prototype.postal_code=function(){return wc_stripe.CheckoutFields.prototype.postcode.apply(this,arguments)},wc_stripe.CheckoutFields.prototype.postalCode=function(){return wc_stripe.CheckoutFields.prototype.postcode.apply(this,arguments)},wc_stripe.CheckoutFields.prototype.toJson=function(){var i={};return this.fields.forEach(function(t,e){i[e]=t}),i},wc_stripe.CheckoutFields.prototype.toFormFields=function(t){var i=[];this.fields.forEach(function(t,e){e='[name="'+e+'"]';o(e).length&&""!==t&&(o(e).val()!==t&&o(e).is("select")&&i.push(e),o(e).val(t))}),0<i.length&&o(i.join(",")).trigger("change"),void 0!==t&&o(document.body).trigger("update_checkout",t)},wc_stripe.CheckoutFields.prototype.validateFields=function(t){for(var e in this.params){var i=this.params[e];if(-1<e.indexOf(t)&&i.required&&o("#"+e).length&&o("#"+e).is(":visible")){i=o("#"+e).val();if(null==i||0===i.length)return!1}}return!0};try{i=Stripe(wc_stripe_params_v3.api_key,"test"===wc_stripe_params_v3.mode&&""===wc_stripe_params_v3.account?{}:{stripeAccount:wc_stripe_params_v3.account})}catch(t){return a.alert(t),console.log(t)}var r=new wc_stripe.CheckoutFields(wc_stripe_checkout_fields,wc_stripe_params_v3.page)}(window,jQuery);
i18n/languages/woo-stripe-payment.pot CHANGED
@@ -2,14 +2,14 @@
2
  # This file is distributed under the same license as the Stripe For WooCommerce plugin.
3
  msgid ""
4
  msgstr ""
5
- "Project-Id-Version: Stripe For WooCommerce 3.3.5\n"
6
  "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/woo-stripe-payment\n"
7
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
8
  "Language-Team: LANGUAGE <LL@li.org>\n"
9
  "MIME-Version: 1.0\n"
10
  "Content-Type: text/plain; charset=UTF-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
12
- "POT-Creation-Date: 2021-07-10T20:35:22+00:00\n"
13
  "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
14
  "X-Generator: WP-CLI 2.4.0\n"
15
  "X-Domain: woo-stripe-payment\n"
@@ -207,7 +207,7 @@ msgid "Customer must manually complete payment for payment method %s"
207
  msgstr ""
208
 
209
  #: includes/abstract/abstract-wc-payment-gateway-stripe.php:1157
210
- #: includes/abstract/abstract-wc-stripe-payment.php:227
211
  msgid "Order %1$s from %2$s"
212
  msgstr ""
213
 
@@ -235,8 +235,6 @@ msgstr ""
235
  #: includes/abstract/abstract-wc-payment-gateway-stripe.php:1587
236
  #: includes/gateways/class-wc-payment-gateway-stripe-klarna.php:230
237
  #: includes/gateways/class-wc-payment-gateway-stripe-klarna.php:291
238
- #: includes/wc-stripe-functions.php:424
239
- #: includes/wc-stripe-functions.php:489
240
  msgid "Shipping"
241
  msgstr ""
242
 
@@ -244,20 +242,16 @@ msgstr ""
244
  #: includes/abstract/abstract-wc-payment-gateway-stripe.php:1590
245
  #: includes/gateways/class-wc-payment-gateway-stripe-klarna.php:240
246
  #: includes/gateways/class-wc-payment-gateway-stripe-klarna.php:301
247
- #: includes/wc-stripe-functions.php:441
248
- #: includes/wc-stripe-functions.php:497
249
  msgid "Discount"
250
  msgstr ""
251
 
252
  #: includes/abstract/abstract-wc-payment-gateway-stripe.php:1567
253
  #: includes/gateways/class-wc-payment-gateway-stripe-klarna.php:258
254
  #: includes/gateways/class-wc-payment-gateway-stripe-klarna.php:323
255
- #: includes/wc-stripe-functions.php:449
256
  msgid "Tax"
257
  msgstr ""
258
 
259
  #: includes/abstract/abstract-wc-payment-gateway-stripe.php:1597
260
- #: includes/wc-stripe-functions.php:508
261
  msgid "Fees"
262
  msgstr ""
263
 
@@ -281,11 +275,11 @@ msgstr ""
281
  msgid "authorization"
282
  msgstr ""
283
 
284
- #: includes/abstract/abstract-wc-stripe-payment.php:127
285
  msgid "Transaction Id cannot be empty."
286
  msgstr ""
287
 
288
- #: includes/abstract/abstract-wc-stripe-payment.php:294
289
  #: includes/gateways/class-wc-payment-gateway-stripe-ach.php:121
290
  msgid "Error processing payment. Reason: %s"
291
  msgstr ""
@@ -1907,234 +1901,234 @@ msgstr ""
1907
  msgid "Kind Regards,"
1908
  msgstr ""
1909
 
1910
- #: includes/wc-stripe-functions.php:850
1911
  msgid "Bootstrap form"
1912
  msgstr ""
1913
 
1914
- #: includes/wc-stripe-functions.php:876
1915
  msgid "Simple form"
1916
  msgstr ""
1917
 
1918
- #: includes/wc-stripe-functions.php:899
1919
  msgid "Minimalist form"
1920
  msgstr ""
1921
 
1922
- #: includes/wc-stripe-functions.php:925
1923
  msgid "Inline Form"
1924
  msgstr ""
1925
 
1926
- #: includes/wc-stripe-functions.php:947
1927
  msgid "Rounded Form"
1928
  msgstr ""
1929
 
1930
- #: includes/wc-stripe-functions.php:1165
1931
  msgid "There was an error processing your credit card."
1932
  msgstr ""
1933
 
1934
- #: includes/wc-stripe-functions.php:1166
1935
  msgid "Your card number is incomplete."
1936
  msgstr ""
1937
 
1938
- #: includes/wc-stripe-functions.php:1167
1939
  msgid "Your card's expiration date is incomplete."
1940
  msgstr ""
1941
 
1942
- #: includes/wc-stripe-functions.php:1168
1943
  msgid "Your card's security code is incomplete."
1944
  msgstr ""
1945
 
1946
- #: includes/wc-stripe-functions.php:1169
1947
  msgid "Your card's zip code is incomplete."
1948
  msgstr ""
1949
 
1950
- #: includes/wc-stripe-functions.php:1170
1951
  msgid "The card number is incorrect. Check the card's number or use a different card."
1952
  msgstr ""
1953
 
1954
- #: includes/wc-stripe-functions.php:1171
1955
  msgid "The card's security code is incorrect. Check the card's security code or use a different card."
1956
  msgstr ""
1957
 
1958
- #: includes/wc-stripe-functions.php:1172
1959
  msgid "The card's ZIP code is incorrect. Check the card's ZIP code or use a different card."
1960
  msgstr ""
1961
 
1962
- #: includes/wc-stripe-functions.php:1173
1963
- #: includes/wc-stripe-functions.php:1178
1964
  msgid "The card number is invalid. Check the card details or use a different card."
1965
  msgstr ""
1966
 
1967
- #: includes/wc-stripe-functions.php:1174
1968
  msgid "This value provided to the field contains characters that are unsupported by the field."
1969
  msgstr ""
1970
 
1971
- #: includes/wc-stripe-functions.php:1175
1972
  msgid "The card's security code is invalid. Check the card's security code or use a different card."
1973
  msgstr ""
1974
 
1975
- #: includes/wc-stripe-functions.php:1176
1976
  msgid "The card's expiration month is incorrect. Check the expiration date or use a different card."
1977
  msgstr ""
1978
 
1979
- #: includes/wc-stripe-functions.php:1177
1980
  msgid "The card's expiration year is incorrect. Check the expiration date or use a different card."
1981
  msgstr ""
1982
 
1983
- #: includes/wc-stripe-functions.php:1179
1984
  msgid "The card's address is incorrect. Check the card's address or use a different card."
1985
  msgstr ""
1986
 
1987
- #: includes/wc-stripe-functions.php:1180
1988
  msgid "The card has expired. Check the expiration date or use a different card."
1989
  msgstr ""
1990
 
1991
- #: includes/wc-stripe-functions.php:1181
1992
  msgid "The card has been declined."
1993
  msgstr ""
1994
 
1995
- #: includes/wc-stripe-functions.php:1182
1996
  msgid "Your card's expiration year is in the past."
1997
  msgstr ""
1998
 
1999
- #: includes/wc-stripe-functions.php:1183
2000
  msgid "The bank account number provided is invalid (e.g., missing digits). Bank account information varies from country to country. We recommend creating validations in your entry forms based on the bank account formats we provide."
2001
  msgstr ""
2002
 
2003
- #: includes/wc-stripe-functions.php:1184
2004
  msgid "The specified amount is greater than the maximum amount allowed. Use a lower amount and try again."
2005
  msgstr ""
2006
 
2007
- #: includes/wc-stripe-functions.php:1185
2008
  msgid "The specified amount is less than the minimum amount allowed. Use a higher amount and try again."
2009
  msgstr ""
2010
 
2011
- #: includes/wc-stripe-functions.php:1186
2012
  msgid "The payment requires authentication to proceed. If your customer is off session, notify your customer to return to your application and complete the payment. If you provided the error_on_requires_action parameter, then your customer should try another card that does not require authentication."
2013
  msgstr ""
2014
 
2015
- #: includes/wc-stripe-functions.php:1187
2016
  msgid "The transfer or payout could not be completed because the associated account does not have a sufficient balance available. Create a new transfer or payout using an amount less than or equal to the account's available balance."
2017
  msgstr ""
2018
 
2019
- #: includes/wc-stripe-functions.php:1188
2020
  msgid "The bank account provided can not be used to charge, either because it is not verified yet or it is not supported."
2021
  msgstr ""
2022
 
2023
- #: includes/wc-stripe-functions.php:1189
2024
  msgid "The bank account provided already exists on the specified Customer object. If the bank account should also be attached to a different customer, include the correct customer ID when making the request again."
2025
  msgstr ""
2026
 
2027
- #: includes/wc-stripe-functions.php:1190
2028
  msgid "The bank account provided cannot be used for payouts. A different bank account must be used."
2029
  msgstr ""
2030
 
2031
- #: includes/wc-stripe-functions.php:1191
2032
  msgid "Your Connect platform is attempting to share an unverified bank account with a connected account."
2033
  msgstr ""
2034
 
2035
- #: includes/wc-stripe-functions.php:1192
2036
  msgid "The bank account cannot be verified, either because the microdeposit amounts provided do not match the actual amounts, or because verification has failed too many times."
2037
  msgstr ""
2038
 
2039
- #: includes/wc-stripe-functions.php:1193
2040
  msgid "This card has been declined too many times. You can try to charge this card again after 24 hours. We suggest reaching out to your customer to make sure they have entered all of their information correctly and that there are no issues with their card."
2041
  msgstr ""
2042
 
2043
- #: includes/wc-stripe-functions.php:1194
2044
  msgid "The charge you're attempting to capture has already been captured. Update the request with an uncaptured charge ID."
2045
  msgstr ""
2046
 
2047
- #: includes/wc-stripe-functions.php:1195
2048
  msgid "The charge you're attempting to refund has already been refunded. Update the request to use the ID of a charge that has not been refunded."
2049
  msgstr ""
2050
 
2051
- #: includes/wc-stripe-functions.php:1196
2052
  msgid "The charge you're attempting to refund has been charged back. Check the disputes documentation to learn how to respond to the dispute."
2053
  msgstr ""
2054
 
2055
- #: includes/wc-stripe-functions.php:1197
2056
  msgid "This charge would cause you to exceed your rolling-window processing limit for this source type. Please retry the charge later, or contact us to request a higher processing limit."
2057
  msgstr ""
2058
 
2059
- #: includes/wc-stripe-functions.php:1198
2060
  msgid "The charge cannot be captured as the authorization has expired. Auth and capture charges must be captured within seven days."
2061
  msgstr ""
2062
 
2063
- #: includes/wc-stripe-functions.php:1199
2064
  msgid "One or more provided parameters was not allowed for the given operation on the Charge. Check our API reference or the returned error message to see which values were not correct for that Charge."
2065
  msgstr ""
2066
 
2067
- #: includes/wc-stripe-functions.php:1200
2068
  msgid "The email address is invalid (e.g., not properly formatted). Check that the email address is properly formatted and only includes allowed characters."
2069
  msgstr ""
2070
 
2071
- #: includes/wc-stripe-functions.php:1201
2072
  msgid "The idempotency key provided is currently being used in another request. This occurs if your integration is making duplicate requests simultaneously."
2073
  msgstr ""
2074
 
2075
- #: includes/wc-stripe-functions.php:1202
2076
  msgid "The specified amount is invalid. The charge amount must be a positive integer in the smallest currency unit, and not exceed the minimum or maximum amount."
2077
  msgstr ""
2078
 
2079
- #: includes/wc-stripe-functions.php:1203
2080
  msgid "The source cannot be used because it is not in the correct state (e.g., a charge request is trying to use a source with a pending, failed, or consumed source). Check the status of the source you are attempting to use."
2081
  msgstr ""
2082
 
2083
- #: includes/wc-stripe-functions.php:1204
2084
  msgid "Both a customer and source ID have been provided, but the source has not been saved to the customer. To create a charge for a customer with a specified source, you must first save the card details."
2085
  msgstr ""
2086
 
2087
- #: includes/wc-stripe-functions.php:1205
2088
  msgid "The ZIP code provided was incorrect."
2089
  msgstr ""
2090
 
2091
- #: includes/wc-stripe-functions.php:1206
2092
  msgid "An error occurred while processing the card. Try again later or with a different payment method."
2093
  msgstr ""
2094
 
2095
- #: includes/wc-stripe-functions.php:1207
2096
  msgid "The card does not support this type of purchase."
2097
  msgstr ""
2098
 
2099
- #: includes/wc-stripe-functions.php:1208
2100
- #: includes/wc-stripe-functions.php:1211
2101
- #: includes/wc-stripe-functions.php:1213
2102
  msgid "The card has been declined for an unknown reason."
2103
  msgstr ""
2104
 
2105
- #: includes/wc-stripe-functions.php:1209
2106
  msgid "The customer has exceeded the balance or credit limit available on their card."
2107
  msgstr ""
2108
 
2109
- #: includes/wc-stripe-functions.php:1210
2110
  msgid "The card does not support the specified currency."
2111
  msgstr ""
2112
 
2113
- #: includes/wc-stripe-functions.php:1212
2114
  msgid "The payment has been declined as Stripe suspects it is fraudulent."
2115
  msgstr ""
2116
 
2117
- #: includes/wc-stripe-functions.php:1214
2118
  msgid "The PIN entered is incorrect. "
2119
  msgstr ""
2120
 
2121
- #: includes/wc-stripe-functions.php:1215
2122
  msgid "The card has insufficient funds to complete the purchase."
2123
  msgstr ""
2124
 
2125
- #: includes/wc-stripe-functions.php:1216
2126
  msgid "Please select a payment method before proceeding."
2127
  msgstr ""
2128
 
2129
- #: includes/wc-stripe-functions.php:1217
2130
  msgid "Please enter your IBAN before proceeding."
2131
  msgstr ""
2132
 
2133
- #: includes/wc-stripe-functions.php:1218
2134
  msgid "Please select a bank before proceeding"
2135
  msgstr ""
2136
 
2137
- #: includes/wc-stripe-functions.php:1219
2138
  msgid "The IBAN you entered is incomplete."
2139
  msgstr ""
2140
 
@@ -2151,6 +2145,10 @@ msgstr ""
2151
  msgid "Save Card"
2152
  msgstr ""
2153
 
 
 
 
 
2154
  #: stripe-payments.php:17
2155
  msgid "Your PHP version is %s but Stripe requires version 5.6+."
2156
  msgstr ""
2
  # This file is distributed under the same license as the Stripe For WooCommerce plugin.
3
  msgid ""
4
  msgstr ""
5
+ "Project-Id-Version: Stripe For WooCommerce 3.3.6\n"
6
  "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/woo-stripe-payment\n"
7
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
8
  "Language-Team: LANGUAGE <LL@li.org>\n"
9
  "MIME-Version: 1.0\n"
10
  "Content-Type: text/plain; charset=UTF-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
12
+ "POT-Creation-Date: 2021-07-23T02:27:54+00:00\n"
13
  "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
14
  "X-Generator: WP-CLI 2.4.0\n"
15
  "X-Domain: woo-stripe-payment\n"
207
  msgstr ""
208
 
209
  #: includes/abstract/abstract-wc-payment-gateway-stripe.php:1157
210
+ #: includes/abstract/abstract-wc-stripe-payment.php:232
211
  msgid "Order %1$s from %2$s"
212
  msgstr ""
213
 
235
  #: includes/abstract/abstract-wc-payment-gateway-stripe.php:1587
236
  #: includes/gateways/class-wc-payment-gateway-stripe-klarna.php:230
237
  #: includes/gateways/class-wc-payment-gateway-stripe-klarna.php:291
 
 
238
  msgid "Shipping"
239
  msgstr ""
240
 
242
  #: includes/abstract/abstract-wc-payment-gateway-stripe.php:1590
243
  #: includes/gateways/class-wc-payment-gateway-stripe-klarna.php:240
244
  #: includes/gateways/class-wc-payment-gateway-stripe-klarna.php:301
 
 
245
  msgid "Discount"
246
  msgstr ""
247
 
248
  #: includes/abstract/abstract-wc-payment-gateway-stripe.php:1567
249
  #: includes/gateways/class-wc-payment-gateway-stripe-klarna.php:258
250
  #: includes/gateways/class-wc-payment-gateway-stripe-klarna.php:323
 
251
  msgid "Tax"
252
  msgstr ""
253
 
254
  #: includes/abstract/abstract-wc-payment-gateway-stripe.php:1597
 
255
  msgid "Fees"
256
  msgstr ""
257
 
275
  msgid "authorization"
276
  msgstr ""
277
 
278
+ #: includes/abstract/abstract-wc-stripe-payment.php:132
279
  msgid "Transaction Id cannot be empty."
280
  msgstr ""
281
 
282
+ #: includes/abstract/abstract-wc-stripe-payment.php:299
283
  #: includes/gateways/class-wc-payment-gateway-stripe-ach.php:121
284
  msgid "Error processing payment. Reason: %s"
285
  msgstr ""
1901
  msgid "Kind Regards,"
1902
  msgstr ""
1903
 
1904
+ #: includes/wc-stripe-functions.php:726
1905
  msgid "Bootstrap form"
1906
  msgstr ""
1907
 
1908
+ #: includes/wc-stripe-functions.php:752
1909
  msgid "Simple form"
1910
  msgstr ""
1911
 
1912
+ #: includes/wc-stripe-functions.php:775
1913
  msgid "Minimalist form"
1914
  msgstr ""
1915
 
1916
+ #: includes/wc-stripe-functions.php:801
1917
  msgid "Inline Form"
1918
  msgstr ""
1919
 
1920
+ #: includes/wc-stripe-functions.php:823
1921
  msgid "Rounded Form"
1922
  msgstr ""
1923
 
1924
+ #: includes/wc-stripe-functions.php:1048
1925
  msgid "There was an error processing your credit card."
1926
  msgstr ""
1927
 
1928
+ #: includes/wc-stripe-functions.php:1049
1929
  msgid "Your card number is incomplete."
1930
  msgstr ""
1931
 
1932
+ #: includes/wc-stripe-functions.php:1050
1933
  msgid "Your card's expiration date is incomplete."
1934
  msgstr ""
1935
 
1936
+ #: includes/wc-stripe-functions.php:1051
1937
  msgid "Your card's security code is incomplete."
1938
  msgstr ""
1939
 
1940
+ #: includes/wc-stripe-functions.php:1052
1941
  msgid "Your card's zip code is incomplete."
1942
  msgstr ""
1943
 
1944
+ #: includes/wc-stripe-functions.php:1053
1945
  msgid "The card number is incorrect. Check the card's number or use a different card."
1946
  msgstr ""
1947
 
1948
+ #: includes/wc-stripe-functions.php:1054
1949
  msgid "The card's security code is incorrect. Check the card's security code or use a different card."
1950
  msgstr ""
1951
 
1952
+ #: includes/wc-stripe-functions.php:1055
1953
  msgid "The card's ZIP code is incorrect. Check the card's ZIP code or use a different card."
1954
  msgstr ""
1955
 
1956
+ #: includes/wc-stripe-functions.php:1056
1957
+ #: includes/wc-stripe-functions.php:1061
1958
  msgid "The card number is invalid. Check the card details or use a different card."
1959
  msgstr ""
1960
 
1961
+ #: includes/wc-stripe-functions.php:1057
1962
  msgid "This value provided to the field contains characters that are unsupported by the field."
1963
  msgstr ""
1964
 
1965
+ #: includes/wc-stripe-functions.php:1058
1966
  msgid "The card's security code is invalid. Check the card's security code or use a different card."
1967
  msgstr ""
1968
 
1969
+ #: includes/wc-stripe-functions.php:1059
1970
  msgid "The card's expiration month is incorrect. Check the expiration date or use a different card."
1971
  msgstr ""
1972
 
1973
+ #: includes/wc-stripe-functions.php:1060
1974
  msgid "The card's expiration year is incorrect. Check the expiration date or use a different card."
1975
  msgstr ""
1976
 
1977
+ #: includes/wc-stripe-functions.php:1062
1978
  msgid "The card's address is incorrect. Check the card's address or use a different card."
1979
  msgstr ""
1980
 
1981
+ #: includes/wc-stripe-functions.php:1063
1982
  msgid "The card has expired. Check the expiration date or use a different card."
1983
  msgstr ""
1984
 
1985
+ #: includes/wc-stripe-functions.php:1064
1986
  msgid "The card has been declined."
1987
  msgstr ""
1988
 
1989
+ #: includes/wc-stripe-functions.php:1065
1990
  msgid "Your card's expiration year is in the past."
1991
  msgstr ""
1992
 
1993
+ #: includes/wc-stripe-functions.php:1066
1994
  msgid "The bank account number provided is invalid (e.g., missing digits). Bank account information varies from country to country. We recommend creating validations in your entry forms based on the bank account formats we provide."
1995
  msgstr ""
1996
 
1997
+ #: includes/wc-stripe-functions.php:1067
1998
  msgid "The specified amount is greater than the maximum amount allowed. Use a lower amount and try again."
1999
  msgstr ""
2000
 
2001
+ #: includes/wc-stripe-functions.php:1068
2002
  msgid "The specified amount is less than the minimum amount allowed. Use a higher amount and try again."
2003
  msgstr ""
2004
 
2005
+ #: includes/wc-stripe-functions.php:1069
2006
  msgid "The payment requires authentication to proceed. If your customer is off session, notify your customer to return to your application and complete the payment. If you provided the error_on_requires_action parameter, then your customer should try another card that does not require authentication."
2007
  msgstr ""
2008
 
2009
+ #: includes/wc-stripe-functions.php:1070
2010
  msgid "The transfer or payout could not be completed because the associated account does not have a sufficient balance available. Create a new transfer or payout using an amount less than or equal to the account's available balance."
2011
  msgstr ""
2012
 
2013
+ #: includes/wc-stripe-functions.php:1071
2014
  msgid "The bank account provided can not be used to charge, either because it is not verified yet or it is not supported."
2015
  msgstr ""
2016
 
2017
+ #: includes/wc-stripe-functions.php:1072
2018
  msgid "The bank account provided already exists on the specified Customer object. If the bank account should also be attached to a different customer, include the correct customer ID when making the request again."
2019
  msgstr ""
2020
 
2021
+ #: includes/wc-stripe-functions.php:1073
2022
  msgid "The bank account provided cannot be used for payouts. A different bank account must be used."
2023
  msgstr ""
2024
 
2025
+ #: includes/wc-stripe-functions.php:1074
2026
  msgid "Your Connect platform is attempting to share an unverified bank account with a connected account."
2027
  msgstr ""
2028
 
2029
+ #: includes/wc-stripe-functions.php:1075
2030
  msgid "The bank account cannot be verified, either because the microdeposit amounts provided do not match the actual amounts, or because verification has failed too many times."
2031
  msgstr ""
2032
 
2033
+ #: includes/wc-stripe-functions.php:1076
2034
  msgid "This card has been declined too many times. You can try to charge this card again after 24 hours. We suggest reaching out to your customer to make sure they have entered all of their information correctly and that there are no issues with their card."
2035
  msgstr ""
2036
 
2037
+ #: includes/wc-stripe-functions.php:1077
2038
  msgid "The charge you're attempting to capture has already been captured. Update the request with an uncaptured charge ID."
2039
  msgstr ""
2040
 
2041
+ #: includes/wc-stripe-functions.php:1078
2042
  msgid "The charge you're attempting to refund has already been refunded. Update the request to use the ID of a charge that has not been refunded."
2043
  msgstr ""
2044
 
2045
+ #: includes/wc-stripe-functions.php:1079
2046
  msgid "The charge you're attempting to refund has been charged back. Check the disputes documentation to learn how to respond to the dispute."
2047
  msgstr ""
2048
 
2049
+ #: includes/wc-stripe-functions.php:1080
2050
  msgid "This charge would cause you to exceed your rolling-window processing limit for this source type. Please retry the charge later, or contact us to request a higher processing limit."
2051
  msgstr ""
2052
 
2053
+ #: includes/wc-stripe-functions.php:1081
2054
  msgid "The charge cannot be captured as the authorization has expired. Auth and capture charges must be captured within seven days."
2055
  msgstr ""
2056
 
2057
+ #: includes/wc-stripe-functions.php:1082
2058
  msgid "One or more provided parameters was not allowed for the given operation on the Charge. Check our API reference or the returned error message to see which values were not correct for that Charge."
2059
  msgstr ""
2060
 
2061
+ #: includes/wc-stripe-functions.php:1083
2062
  msgid "The email address is invalid (e.g., not properly formatted). Check that the email address is properly formatted and only includes allowed characters."
2063
  msgstr ""
2064
 
2065
+ #: includes/wc-stripe-functions.php:1084
2066
  msgid "The idempotency key provided is currently being used in another request. This occurs if your integration is making duplicate requests simultaneously."
2067
  msgstr ""
2068
 
2069
+ #: includes/wc-stripe-functions.php:1085
2070
  msgid "The specified amount is invalid. The charge amount must be a positive integer in the smallest currency unit, and not exceed the minimum or maximum amount."
2071
  msgstr ""
2072
 
2073
+ #: includes/wc-stripe-functions.php:1086
2074
  msgid "The source cannot be used because it is not in the correct state (e.g., a charge request is trying to use a source with a pending, failed, or consumed source). Check the status of the source you are attempting to use."
2075
  msgstr ""
2076
 
2077
+ #: includes/wc-stripe-functions.php:1087
2078
  msgid "Both a customer and source ID have been provided, but the source has not been saved to the customer. To create a charge for a customer with a specified source, you must first save the card details."
2079
  msgstr ""
2080
 
2081
+ #: includes/wc-stripe-functions.php:1088
2082
  msgid "The ZIP code provided was incorrect."
2083
  msgstr ""
2084
 
2085
+ #: includes/wc-stripe-functions.php:1089
2086
  msgid "An error occurred while processing the card. Try again later or with a different payment method."
2087
  msgstr ""
2088
 
2089
+ #: includes/wc-stripe-functions.php:1090
2090
  msgid "The card does not support this type of purchase."
2091
  msgstr ""
2092
 
2093
+ #: includes/wc-stripe-functions.php:1091
2094
+ #: includes/wc-stripe-functions.php:1094
2095
+ #: includes/wc-stripe-functions.php:1096
2096
  msgid "The card has been declined for an unknown reason."
2097
  msgstr ""
2098
 
2099
+ #: includes/wc-stripe-functions.php:1092
2100
  msgid "The customer has exceeded the balance or credit limit available on their card."
2101
  msgstr ""
2102
 
2103
+ #: includes/wc-stripe-functions.php:1093
2104
  msgid "The card does not support the specified currency."
2105
  msgstr ""
2106
 
2107
+ #: includes/wc-stripe-functions.php:1095
2108
  msgid "The payment has been declined as Stripe suspects it is fraudulent."
2109
  msgstr ""
2110
 
2111
+ #: includes/wc-stripe-functions.php:1097
2112
  msgid "The PIN entered is incorrect. "
2113
  msgstr ""
2114
 
2115
+ #: includes/wc-stripe-functions.php:1098
2116
  msgid "The card has insufficient funds to complete the purchase."
2117
  msgstr ""
2118
 
2119
+ #: includes/wc-stripe-functions.php:1099
2120
  msgid "Please select a payment method before proceeding."
2121
  msgstr ""
2122
 
2123
+ #: includes/wc-stripe-functions.php:1100
2124
  msgid "Please enter your IBAN before proceeding."
2125
  msgstr ""
2126
 
2127
+ #: includes/wc-stripe-functions.php:1101
2128
  msgid "Please select a bank before proceeding"
2129
  msgstr ""
2130
 
2131
+ #: includes/wc-stripe-functions.php:1102
2132
  msgid "The IBAN you entered is incomplete."
2133
  msgstr ""
2134
 
2145
  msgid "Save Card"
2146
  msgstr ""
2147
 
2148
+ #: packages/woofunnels/src/PaymentGateways/BasePaymentGateway.php:162
2149
+ msgid "%1$s - Order %2$s - One Time offer"
2150
+ msgstr ""
2151
+
2152
  #: stripe-payments.php:17
2153
  msgid "Your PHP version is %s but Stripe requires version 5.6+."
2154
  msgstr ""
includes/abstract/abstract-wc-payment-gateway-stripe.php CHANGED
@@ -886,7 +886,7 @@ abstract class WC_Payment_Gateway_Stripe extends WC_Payment_Gateway {
886
  return ! WC_Pre_Orders_Product::product_is_charged_upon_release( WC_Pre_Orders_Cart::get_pre_order_product() );
887
  }
888
 
889
- return is_user_logged_in() && $this->is_active( 'save_card_enabled' );
890
  } elseif ( in_array( $page, array( 'add_payment_method', 'change_payment_method' ) ) ) {
891
  return false;
892
  } elseif ( 'order_pay' === $page ) {
@@ -1453,7 +1453,7 @@ abstract class WC_Payment_Gateway_Stripe extends WC_Payment_Gateway {
1453
  $data = wp_parse_args( $data, array(
1454
  'items' => $this->has_digital_wallet ? $this->get_display_items( $page ) : array(),
1455
  'shipping_options' => $this->has_digital_wallet ? $this->get_formatted_shipping_methods() : array(),
1456
- 'total' => WC()->cart->total,
1457
  'total_cents' => wc_stripe_add_number_precision( WC()->cart->total, get_woocommerce_currency() ),
1458
  'currency' => get_woocommerce_currency()
1459
  ) );
886
  return ! WC_Pre_Orders_Product::product_is_charged_upon_release( WC_Pre_Orders_Cart::get_pre_order_product() );
887
  }
888
 
889
+ return apply_filters( 'wc_stripe_cc_show_save_source', is_user_logged_in() && $this->is_active( 'save_card_enabled' ) );
890
  } elseif ( in_array( $page, array( 'add_payment_method', 'change_payment_method' ) ) ) {
891
  return false;
892
  } elseif ( 'order_pay' === $page ) {
1453
  $data = wp_parse_args( $data, array(
1454
  'items' => $this->has_digital_wallet ? $this->get_display_items( $page ) : array(),
1455
  'shipping_options' => $this->has_digital_wallet ? $this->get_formatted_shipping_methods() : array(),
1456
+ 'total' => wc_format_decimal( WC()->cart->total, 2 ),
1457
  'total_cents' => wc_stripe_add_number_precision( WC()->cart->total, get_woocommerce_currency() ),
1458
  'currency' => get_woocommerce_currency()
1459
  ) );
includes/abstract/abstract-wc-stripe-payment.php CHANGED
@@ -111,6 +111,11 @@ abstract class WC_Stripe_Payment {
111
  }
112
  $order->add_order_note( sprintf( __( 'Order %1$s successful in Stripe. Charge: %2$s. Payment Method: %3$s', 'woo-stripe-payment' ), $charge->captured ? __( 'charge', 'woo-stripe-payment' ) : __( 'authorization', 'woo-stripe-payment' ), $order->get_transaction_id(), $order->get_payment_method_title() ) );
113
  }
 
 
 
 
 
114
  }
115
 
116
  /**
@@ -186,7 +191,7 @@ abstract class WC_Stripe_Payment {
186
  */
187
  public function add_order_metadata( &$args, $order ) {
188
  $meta_data = array(
189
- 'gateway_id' => $this->payment_method->id,
190
  'order_id' => $order->get_id(),
191
  'user_id' => $order->get_user_id(),
192
  'ip_address' => $order->get_customer_ip_address(),
111
  }
112
  $order->add_order_note( sprintf( __( 'Order %1$s successful in Stripe. Charge: %2$s. Payment Method: %3$s', 'woo-stripe-payment' ), $charge->captured ? __( 'charge', 'woo-stripe-payment' ) : __( 'authorization', 'woo-stripe-payment' ), $order->get_transaction_id(), $order->get_payment_method_title() ) );
113
  }
114
+
115
+ /**
116
+ * @since 3.3.6
117
+ */
118
+ do_action( 'wc_stripe_order_payment_complete', $charge, $order );
119
  }
120
 
121
  /**
191
  */
192
  public function add_order_metadata( &$args, $order ) {
193
  $meta_data = array(
194
+ 'gateway_id' => $order->get_payment_method(),
195
  'order_id' => $order->get_id(),
196
  'user_id' => $order->get_user_id(),
197
  'ip_address' => $order->get_customer_ip_address(),
includes/class-stripe.php CHANGED
@@ -25,7 +25,7 @@ class WC_Stripe_Manager {
25
  *
26
  * @var string
27
  */
28
- public $version = '3.3.5';
29
 
30
  /**
31
  *
@@ -139,6 +139,7 @@ class WC_Stripe_Manager {
139
  }
140
 
141
  \PaymentPlugins\CartFlows\Stripe\Main::init();
 
142
  }
143
 
144
  /**
25
  *
26
  * @var string
27
  */
28
+ public $version = '3.3.6';
29
 
30
  /**
31
  *
139
  }
140
 
141
  \PaymentPlugins\CartFlows\Stripe\Main::init();
142
+ \PaymentPlugins\WooFunnels\Stripe\Main::init();
143
  }
144
 
145
  /**
includes/class-wc-stripe-redirect-handler.php CHANGED
@@ -47,7 +47,7 @@ class WC_Stripe_Redirect_Handler {
47
  * @var WC_Payment_Gateway_Stripe_Local_Payment $payment_method
48
  */
49
  $payment_method = WC()->payment_gateways()->payment_gateways()[ $order->get_payment_method() ];
50
- $redirect = $order->get_checkout_order_received_url();
51
 
52
  if ( in_array( $result->status, array( 'requires_action', 'pending' ) ) ) {
53
  $order->update_status( 'on-hold' );
47
  * @var WC_Payment_Gateway_Stripe_Local_Payment $payment_method
48
  */
49
  $payment_method = WC()->payment_gateways()->payment_gateways()[ $order->get_payment_method() ];
50
+ $redirect = $payment_method->get_return_url( $order );
51
 
52
  if ( in_array( $result->status, array( 'requires_action', 'pending' ) ) ) {
53
  $order->update_status( 'on-hold' );
includes/controllers/class-wc-stripe-controller-cart.php CHANGED
@@ -233,9 +233,9 @@ class WC_Stripe_Controller_Cart extends WC_Stripe_Rest_Controller {
233
  *
234
  * @var WC_Payment_Gateway_Stripe $gateway
235
  */
236
- $gateway = WC()->payment_gateways()->payment_gateways()[ $payment_method ];
237
-
238
- list( $product_id, $qty, $variation_id, $variation ) = $this->get_add_to_cart_args( $request );
239
 
240
  // stash cart so clean calculation can be performed.
241
  wc_stripe_stash_cart( WC()->cart, false );
@@ -262,7 +262,7 @@ class WC_Stripe_Controller_Cart extends WC_Stripe_Rest_Controller {
262
  )
263
  );
264
  // save the product cart so it can be used for shipping calculations etc.
265
- wc_stripe_stash_product_cart( WC()->cart );
266
  // put cart contents back to how they were before.
267
  wc_stripe_restore_cart( WC()->cart );
268
 
@@ -278,9 +278,10 @@ class WC_Stripe_Controller_Cart extends WC_Stripe_Rest_Controller {
278
  public function cart_calculation( $request ) {
279
  wc_maybe_define_constant( 'WOOCOMMERCE_CART', true );
280
 
281
- list( $product_id, $qty, $variation_id, $variation ) = $this->get_add_to_cart_args( $request );
 
282
 
283
- wc_stripe_stash_cart( WC()->cart, false );
284
 
285
  if ( WC()->cart->add_to_cart( $product_id, $qty, $variation_id, $variation ) ) {
286
  $payment_method = $request->get_param( 'payment_method' );
@@ -310,7 +311,7 @@ class WC_Stripe_Controller_Cart extends WC_Stripe_Rest_Controller {
310
  } else {
311
  $response = new WP_Error( 'cart-error', $this->get_error_messages(), array( 'status' => 200 ) );
312
  }
313
- wc_stripe_stash_product_cart( WC()->cart );
314
  wc_stripe_restore_cart( WC()->cart );
315
  wc_clear_notices();
316
 
@@ -370,9 +371,9 @@ class WC_Stripe_Controller_Cart extends WC_Stripe_Rest_Controller {
370
  */
371
  private function get_add_to_cart_args( $request ) {
372
  $args = array(
373
- $request->get_param( 'product_id' ),
374
- $request->get_param( 'qty' ),
375
- $request->get_param( 'variation_id' )
376
  );
377
  $variation = array();
378
  if ( $request->get_param( 'variation_id' ) ) {
@@ -386,4 +387,12 @@ class WC_Stripe_Controller_Cart extends WC_Stripe_Rest_Controller {
386
 
387
  return $args;
388
  }
 
 
 
 
 
 
 
 
389
  }
233
  *
234
  * @var WC_Payment_Gateway_Stripe $gateway
235
  */
236
+ $gateway = WC()->payment_gateways()->payment_gateways()[ $payment_method ];
237
+ $cart_args = $this->get_add_to_cart_args( $request );
238
+ list( $product_id, $qty, $variation_id, $variation ) = array_values( $cart_args );
239
 
240
  // stash cart so clean calculation can be performed.
241
  wc_stripe_stash_cart( WC()->cart, false );
262
  )
263
  );
264
  // save the product cart so it can be used for shipping calculations etc.
265
+ wc_stripe_stash_product_cart( WC()->cart, $this->filtered_body_params( $request->get_body_params(), array_keys( $cart_args ) ) );
266
  // put cart contents back to how they were before.
267
  wc_stripe_restore_cart( WC()->cart );
268
 
278
  public function cart_calculation( $request ) {
279
  wc_maybe_define_constant( 'WOOCOMMERCE_CART', true );
280
 
281
+ $cart_args = $this->get_add_to_cart_args( $request );
282
+ list( $product_id, $qty, $variation_id, $variation ) = array_values( $cart_args );
283
 
284
+ wc_stripe_stash_cart( WC()->cart, false, $this->filtered_body_params( $request->get_body_params(), array_keys( $cart_args ) ) );
285
 
286
  if ( WC()->cart->add_to_cart( $product_id, $qty, $variation_id, $variation ) ) {
287
  $payment_method = $request->get_param( 'payment_method' );
311
  } else {
312
  $response = new WP_Error( 'cart-error', $this->get_error_messages(), array( 'status' => 200 ) );
313
  }
314
+ wc_stripe_stash_product_cart( WC()->cart, $this->filtered_body_params( $request->get_body_params(), array_keys( $cart_args ) ) );
315
  wc_stripe_restore_cart( WC()->cart );
316
  wc_clear_notices();
317
 
371
  */
372
  private function get_add_to_cart_args( $request ) {
373
  $args = array(
374
+ 'product_id' => $request->get_param( 'product_id' ),
375
+ 'qty' => $request->get_param( 'qty' ),
376
+ 'variation_id' => $request->get_param( 'variation_id' )
377
  );
378
  $variation = array();
379
  if ( $request->get_param( 'variation_id' ) ) {
387
 
388
  return $args;
389
  }
390
+
391
+ private function filtered_body_params( $params, $filter_keys ) {
392
+ $filter_keys = array_merge( array_filter( $filter_keys ), array( 'payment_method', 'currency', 'page_id' ) );
393
+
394
+ return array_filter( $params, function ( $key ) use ( $filter_keys ) {
395
+ return ! in_array( $key, $filter_keys, true );
396
+ }, ARRAY_FILTER_USE_KEY );
397
+ }
398
  }
includes/wc-stripe-functions.php CHANGED
@@ -392,139 +392,9 @@ function wc_stripe_shipping_address_serviceable( $packages = array() ) {
392
  * @deprecated
393
  */
394
  function wc_stripe_get_display_items( $page = 'cart', $order = null ) {
395
- // first argument used to be $encode param so make sure it's a string now
396
- $page = false === $page ? 'cart' : $page;
397
- $items = array();
398
- if ( in_array( $page, array( 'cart', 'checkout' ) ) ) {
399
- $cart = WC()->cart;
400
- $incl_tax = wc_stripe_display_prices_including_tax();
401
-
402
- foreach ( $cart->get_cart() as $cart_item ) {
403
- /**
404
- *
405
- * @var WC_Product $product
406
- */
407
- $product = $cart_item['data'];
408
- $qty = $cart_item['quantity'];
409
- $items[] = array(
410
- 'label' => $qty > 1 ? sprintf( '%s X %s', $product->get_name(), $qty ) : $product->get_name(),
411
- 'pending' => false,
412
- 'amount' => wc_stripe_add_number_precision(
413
- $incl_tax ? wc_get_price_including_tax( $product, array( 'qty' => $qty ) ) : wc_get_price_excluding_tax(
414
- $product,
415
- array(
416
- 'qty' => $qty,
417
- )
418
- )
419
- ),
420
- );
421
- }
422
- if ( $cart->needs_shipping() ) {
423
- $items[] = array(
424
- 'label' => __( 'Shipping', 'woo-stripe-payment' ),
425
- 'pending' => false,
426
- 'amount' => wc_stripe_add_number_precision( $incl_tax ? $cart->shipping_total + $cart->shipping_tax_total : $cart->shipping_total ),
427
- );
428
- }
429
-
430
- // fees
431
- foreach ( $cart->get_fees() as $fee ) {
432
- $items[] = array(
433
- 'label' => $fee->name,
434
- 'pending' => false,
435
- 'amount' => wc_stripe_add_number_precision( $incl_tax ? $fee->total + $fee->tax : $fee->total ),
436
- );
437
- }
438
- // coupons
439
- if ( 0 < $cart->discount_cart ) {
440
- $items[] = array(
441
- 'label' => __( 'Discount', 'woo-stripe-payment' ),
442
- 'pending' => false,
443
- 'amount' => wc_stripe_add_number_precision( - 1 * abs( $incl_tax ? $cart->discount_cart + $cart->discount_cart_tax : $cart->discount_cart ) ),
444
- );
445
- }
446
 
447
- if ( ! $incl_tax && wc_tax_enabled() ) {
448
- $item = array(
449
- 'label' => __( 'Tax', 'woo-stripe-payment' ),
450
- 'pending' => false,
451
- 'amount' => wc_stripe_add_number_precision( $cart->get_taxes_total() ),
452
- );
453
- if ( 'itemized' === get_option( 'woocommerce_tax_total_display' ) ) {
454
- if ( 0 < WC()->cart->get_taxes_total() ) {
455
- $items[] = $item;
456
- }
457
- } else {
458
- $items[] = $item;
459
- }
460
- }
461
- } elseif ( 'product' === $page ) {
462
- global $product;
463
- $items[] = array(
464
- 'amount' => wc_stripe_add_number_precision( $product->get_price() ),
465
- 'label' => esc_attr( $product->get_name() ),
466
- 'pending' => true,
467
- );
468
- } elseif ( 'order_pay' === $page ) {
469
- global $wp;
470
- $order = ! $order ? wc_get_order( absint( $wp->query_vars['order-pay'] ) ) : $order;
471
- $currency = $order->get_currency();
472
- // add all order items
473
- foreach ( $order->get_items() as $item ) {
474
- /**
475
- *
476
- * @var WC_Order_Item_Product $item
477
- */
478
- $qty = $item->get_quantity();
479
-
480
- $items[] = array(
481
- 'label' => $qty > 1 ? sprintf( '%s X %s', $item->get_name(), $qty ) : $item->get_name(),
482
- 'pending' => false,
483
- 'amount' => wc_stripe_add_number_precision( $item->get_subtotal(), $currency ),
484
- );
485
- }
486
- // shipping total
487
- if ( 0 < $order->get_shipping_total() ) {
488
- $items[] = array(
489
- 'label' => __( 'Shipping', 'woo-stripe-payment' ),
490
- 'pending' => false,
491
- 'amount' => wc_stripe_add_number_precision( $order->get_shipping_total(), $currency ),
492
- );
493
- }
494
- // discount total
495
- if ( 0 < $order->get_total_discount() ) {
496
- $items[] = array(
497
- 'label' => __( 'Discount', 'woo-stripe-payment' ),
498
- 'pending' => false,
499
- 'amount' => wc_stripe_add_number_precision( - 1 * $order->get_total_discount(), $currency ),
500
- );
501
- }
502
- if ( 0 < $order->get_fees() ) {
503
- $fee_total = 0;
504
- foreach ( $order->get_fees() as $fee ) {
505
- $fee_total += $fee->get_total();
506
- }
507
- $items[] = array(
508
- 'label' => __( 'Fees', 'woo-stripe-payment' ),
509
- 'pending' => false,
510
- 'amount' => wc_stripe_add_number_precision( $fee_total, $currency ),
511
- );
512
- }
513
- // tax total
514
- if ( 0 < $order->get_total_tax() ) {
515
- $items[] = array(
516
- 'label' => __( 'Tax', 'woocommerce' ),
517
- 'pending' => false,
518
- 'amount' => wc_stripe_add_number_precision( $order->get_total_tax(), $currency ),
519
- );
520
- }
521
- }
522
-
523
- /**
524
- * @param array $items
525
- * @param WC_Order $order
526
- */
527
- return apply_filters( 'wc_stripe_get_display_items', $items, $order );
528
  }
529
 
530
  /**
@@ -801,12 +671,18 @@ function wc_stripe_add_number_precision( $value, $currency = '', $round = true )
801
  if ( ! is_numeric( $value ) ) {
802
  $value = 0;
803
  }
 
 
 
 
 
 
804
  $currency = empty( $currency ) ? get_woocommerce_currency() : $currency;
805
  $currencies = wc_stripe_get_currencies();
806
  $exp = isset( $currencies[ $currency ] ) ? $currencies[ $currency ] : 2;
807
  $cent_precision = pow( 10, $exp );
808
  $value = $value * $cent_precision;
809
- $value = $round ? round( $value, wc_get_rounding_precision() - wc_get_price_decimals() ) : $value;
810
 
811
  if ( is_numeric( $value ) && floor( $value ) != $value ) {
812
  // there are some decimal points that need to be removed.
@@ -1049,6 +925,7 @@ function wc_stripe_get_order_from_transaction( $transaction_id ) {
1049
  * to the cart.
1050
  *
1051
  * @param WC_Cart $cart
 
1052
  *
1053
  * @package Stripe/Functions
1054
  * @todo Maybe empty cart silently so actions are not triggered that cause session data to be removed
@@ -1062,6 +939,12 @@ function wc_stripe_stash_cart( $cart, $product_cart = true ) {
1062
  WC()->session->set( 'wc_stripe_cart', $data );
1063
  $cart->empty_cart( false );
1064
  if ( $product_cart && isset( $data['product_cart'] ) ) {
 
 
 
 
 
 
1065
  foreach ( $data['product_cart'] as $cart_item ) {
1066
  $cart->add_to_cart( $cart_item['product_id'], $cart_item['quantity'], $cart_item['variation_id'], $cart_item['variation'] );
1067
  }
@@ -1070,16 +953,16 @@ function wc_stripe_stash_cart( $cart, $product_cart = true ) {
1070
 
1071
  /**
1072
  *
1073
- * @param number $product_id
1074
- * @param number $qty
1075
- * @param number $variation_id
1076
  *
1077
  * @package Stripe/Functions
1078
  * @since 3.0.6
1079
  */
1080
- function wc_stripe_stash_product_cart( $cart ) {
1081
- $data = WC()->session->get( 'wc_stripe_cart', array() );
1082
- $data['product_cart'] = $cart->get_cart_for_session();
 
1083
  WC()->session->set( 'wc_stripe_cart', $data );
1084
  WC()->cart->set_session();
1085
  }
392
  * @deprecated
393
  */
394
  function wc_stripe_get_display_items( $page = 'cart', $order = null ) {
395
+ wc_deprecated_function( 'wc_stripe_get_display_items', '3.1.0', 'WC_Payment_Gateway_Stripe::get_display_items()' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
396
 
397
+ return array();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
398
  }
399
 
400
  /**
671
  if ( ! is_numeric( $value ) ) {
672
  $value = 0;
673
  }
674
+ /**
675
+ * @since 3.3.6 - Get the number of decimals that the amount should be rounded to.
676
+ * round before performing precision calculation
677
+ */
678
+ $decimals = wc_get_price_decimals();
679
+ $value = round( $value, $decimals );
680
  $currency = empty( $currency ) ? get_woocommerce_currency() : $currency;
681
  $currencies = wc_stripe_get_currencies();
682
  $exp = isset( $currencies[ $currency ] ) ? $currencies[ $currency ] : 2;
683
  $cent_precision = pow( 10, $exp );
684
  $value = $value * $cent_precision;
685
+ $value = $round ? round( $value, wc_get_rounding_precision() - $decimals ) : $value;
686
 
687
  if ( is_numeric( $value ) && floor( $value ) != $value ) {
688
  // there are some decimal points that need to be removed.
925
  * to the cart.
926
  *
927
  * @param WC_Cart $cart
928
+ * @param bool $product_cart
929
  *
930
  * @package Stripe/Functions
931
  * @todo Maybe empty cart silently so actions are not triggered that cause session data to be removed
939
  WC()->session->set( 'wc_stripe_cart', $data );
940
  $cart->empty_cart( false );
941
  if ( $product_cart && isset( $data['product_cart'] ) ) {
942
+ // if there are args, map them to the request
943
+ if ( isset( $data['request_params'] ) ) {
944
+ foreach ( $data['request_params'] as $key => $value ) {
945
+ $_REQUEST[ $key ] = $value;
946
+ }
947
+ }
948
  foreach ( $data['product_cart'] as $cart_item ) {
949
  $cart->add_to_cart( $cart_item['product_id'], $cart_item['quantity'], $cart_item['variation_id'], $cart_item['variation'] );
950
  }
953
 
954
  /**
955
  *
956
+ * @param WC_Cart $cart
957
+ * @param array $params
 
958
  *
959
  * @package Stripe/Functions
960
  * @since 3.0.6
961
  */
962
+ function wc_stripe_stash_product_cart( $cart, $params = array() ) {
963
+ $data = WC()->session->get( 'wc_stripe_cart', array() );
964
+ $data['product_cart'] = $cart->get_cart_for_session();
965
+ $data['request_params'] = $params;
966
  WC()->session->set( 'wc_stripe_cart', $data );
967
  WC()->cart->set_session();
968
  }
packages/woofunnels/assets/js/index.js ADDED
@@ -0,0 +1,76 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import {loadStripe} from '@stripe/stripe-js';
2
+ import $ from 'jquery';
3
+
4
+ let stripe;
5
+
6
+ let data = {};
7
+
8
+ const initialize = () => {
9
+ $(document).on('wfocu_external', onHandleSubmit);
10
+ window.addEventListener('hashchange', handleHashChange);
11
+ wfocuCommons.addFilter('wfocu_front_charge_data', addChargeData);
12
+ loadStripe(getData('publishableKey', (() => {
13
+ if (getData('account')) {
14
+ return {stripeAccount: getData('account')};
15
+ }
16
+ return {};
17
+ })())).then((client) => {
18
+ stripe = client;
19
+ }).catch(error => {
20
+ });
21
+ }
22
+
23
+ const onBucketCreated = (e, bucket) => {
24
+ data = window?.wfocu_vars?.stripeData;
25
+ setData('bucket', bucket);
26
+ initialize();
27
+ }
28
+
29
+ const onHandleSubmit = (e, bucket) => {
30
+ setData('bucket', bucket);
31
+ }
32
+
33
+ const handleHashChange = (e) => {
34
+ var match = e.newURL.match(/response=(.*)/);
35
+ if (match) {
36
+ const obj = JSON.parse(window.atob(decodeURIComponent(match[1])));
37
+ getData('bucket')?.swal?.hide();
38
+ setData('paymentIntent', obj.payment_intent);
39
+ history.pushState({}, '', window.location.pathname + window.location.search);
40
+ stripe.confirmCardPayment(obj.client_secret).then(response => {
41
+ if (response.error) {
42
+ // display message
43
+ resetPaymentProcess();
44
+ } else {
45
+ setData('paymentComplete', true);
46
+ getData('bucket').sendBucket();
47
+ }
48
+ }).catch(error => {
49
+ console.log(error);
50
+ });
51
+ }
52
+ }
53
+
54
+ const addChargeData = (e) => {
55
+ e['_payment_intent'] = getData('paymentIntent');
56
+ return e;
57
+ }
58
+
59
+ const getData = (key, defaultValue = null) => {
60
+ if (!data.hasOwnProperty(key)) {
61
+ data[key] = defaultValue;
62
+ }
63
+ return data[key];
64
+ }
65
+
66
+ const setData = (key, value) => {
67
+ data[key] = value;
68
+ }
69
+
70
+ const resetPaymentProcess = () => {
71
+ getData('bucket').inOfferTransaction = false;
72
+ getData('bucket').EnableButtonState();
73
+ getData('bucket').HasEventRunning = false;
74
+ }
75
+
76
+ $(document).on('wfocuBucketCreated', onBucketCreated);
packages/woofunnels/build/wc-stripe-woofunnels.asset.php ADDED
@@ -0,0 +1 @@
 
1
+ <?php return array('dependencies' => array('jquery'), 'version' => 'c96b9b16d88aa70ec06e052472f2d731');
packages/woofunnels/build/wc-stripe-woofunnels.js ADDED
@@ -0,0 +1,2 @@
 
 
1
+ (()=>{var e,t,n,r,o,i,a,c,u,s,l,d={318:e=>{e.exports=function(e){return e&&e.__esModule?e:{default:e}}},465:(e,t,n)=>{"use strict";n.r(t),n.d(t,{loadStripe:()=>l});var r="https://js.stripe.com/v3",o=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/,i="loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used",a=null,c=function(e,t,n){if(null===e)return null;var r=e.apply(void 0,t);return function(e,t){e&&e._registerWrapper&&e._registerWrapper({name:"stripe-js",version:"1.12.1",startTime:t})}(r,n),r},u=Promise.resolve().then((function(){return e=null,null!==a?a:a=new Promise((function(t,n){if("undefined"!=typeof window)if(window.Stripe&&e&&console.warn(i),window.Stripe)t(window.Stripe);else try{var a=function(){for(var e=document.querySelectorAll('script[src^="'.concat(r,'"]')),t=0;t<e.length;t++){var n=e[t];if(o.test(n.src))return n}return null}();a&&e?console.warn(i):a||(a=function(e){var t=e&&!e.advancedFraudSignals?"?advancedFraudSignals=false":"",n=document.createElement("script");n.src="".concat(r).concat(t);var o=document.head||document.body;if(!o)throw new Error("Expected document.body not to be null. Stripe.js requires a <body> element.");return o.appendChild(n),n}(e)),a.addEventListener("load",(function(){window.Stripe?t(window.Stripe):n(new Error("Stripe.js not available"))})),a.addEventListener("error",(function(){n(new Error("Failed to load Stripe.js"))}))}catch(e){return void n(e)}else t(null)}));var e})),s=!1;u.catch((function(e){s||console.warn(e)}));var l=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];s=!0;var r=Date.now();return u.then((function(e){return c(e,t,r)}))}},609:e=>{"use strict";e.exports=window.jQuery}},p={};function f(e){if(p[e])return p[e].exports;var t=p[e]={exports:{}};return d[e](t,t.exports,f),t.exports}f.d=(e,t)=>{for(var n in t)f.o(t,n)&&!f.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},f.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),f.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},t=f(318),n=f(465),r=t(f(609)),o={},i=function(e,t){s("bucket",t)},a=function(t){var n=t.newURL.match(/response=(.*)/);if(n){var r,o,i=JSON.parse(window.atob(decodeURIComponent(n[1])));null===(r=u("bucket"))||void 0===r||null===(o=r.swal)||void 0===o||o.hide(),s("paymentIntent",i.payment_intent),history.pushState({},"",window.location.pathname+window.location.search),e.confirmCardPayment(i.client_secret).then((function(e){e.error?l():(s("paymentComplete",!0),u("bucket").sendBucket())})).catch((function(e){console.log(e)}))}},c=function(e){return e._payment_intent=u("paymentIntent"),e},u=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return o.hasOwnProperty(e)||(o[e]=t),o[e]},s=function(e,t){o[e]=t},l=function(){u("bucket").inOfferTransaction=!1,u("bucket").EnableButtonState(),u("bucket").HasEventRunning=!1},(0,r.default)(document).on("wfocuBucketCreated",(function(t,l){var d,p;o=null===(d=window)||void 0===d||null===(p=d.wfocu_vars)||void 0===p?void 0:p.stripeData,s("bucket",l),(0,r.default)(document).on("wfocu_external",i),window.addEventListener("hashchange",a),wfocuCommons.addFilter("wfocu_front_charge_data",c),(0,n.loadStripe)(u("publishableKey",u("account")?{stripeAccount:u("account")}:{})).then((function(t){e=t})).catch((function(e){}))})),(this.wc_stripe=this.wc_stripe||{})["wc-stripe-woofunnels"]={}})();
2
+ //# sourceMappingURL=wc-stripe-woofunnels.js.map
packages/woofunnels/build/wc-stripe-woofunnels.js.map ADDED
@@ -0,0 +1 @@
 
1
+ {"version":3,"sources":["webpack://wc_stripe.[name]/./packages/woofunnels/assets/js/index.js","webpack://wc_stripe.[name]/./node_modules/@babel/runtime/helpers/interopRequireDefault.js","webpack://wc_stripe.[name]/./node_modules/@stripe/stripe-js/dist/stripe.esm.js","webpack://wc_stripe.[name]/external \"jQuery\"","webpack://wc_stripe.[name]/webpack/bootstrap","webpack://wc_stripe.[name]/webpack/runtime/define property getters","webpack://wc_stripe.[name]/webpack/runtime/hasOwnProperty shorthand","webpack://wc_stripe.[name]/webpack/runtime/make namespace object"],"names":["stripe","data","onHandleSubmit","handleHashChange","addChargeData","getData","setData","resetPaymentProcess","module","exports","obj","__esModule","V3_URL","V3_URL_REGEX","EXISTING_SCRIPT_MESSAGE","stripePromise","initStripe","maybeStripe","args","startTime","apply","undefined","_registerWrapper","name","version","registerWrapper","stripePromise$1","Promise","resolve","then","params","reject","window","Stripe","console","warn","script","scripts","document","querySelectorAll","concat","i","length","test","src","findScript","queryString","advancedFraudSignals","createElement","headOrBody","head","body","Error","appendChild","injectScript","addEventListener","error","loadCalled","err","loadStripe","_len","arguments","Array","_key","Date","now","__webpack_module_cache__","__webpack_require__","moduleId","__webpack_modules__","d","definition","key","o","Object","defineProperty","enumerable","get","prop","prototype","hasOwnProperty","call","r","Symbol","toStringTag","value","e","bucket","match","newURL","JSON","parse","atob","decodeURIComponent","swal","hide","payment_intent","history","pushState","location","pathname","search","confirmCardPayment","client_secret","response","sendBucket","catch","log","defaultValue","inOfferTransaction","EnableButtonState","HasEventRunning","on","wfocu_vars","stripeData","wfocuCommons","addFilter","stripeAccount","client"],"mappings":"UAGIA,E,EAHJ,EACA,EAIIC,EAuBEC,EAIAC,EAqBAC,EAKAC,EAOAC,EAIAC,E,WC/DNC,EAAOC,QANP,SAAgCC,GAC9B,OAAOA,GAAOA,EAAIC,WAAaD,EAAM,CACnC,QAAWA,K,4DCFf,IAAIE,EAAS,2BACTC,EAAe,4CACfC,EAA0B,mJA2C1BC,EAAgB,KAkDhBC,EAAa,SAAoBC,EAAaC,EAAMC,GACtD,GAAoB,OAAhBF,EACF,OAAO,KAGT,IAAIjB,EAASiB,EAAYG,WAAMC,EAAWH,GAE1C,OArEoB,SAAyBlB,EAAQmB,GAChDnB,GAAWA,EAAOsB,kBAIvBtB,EAAOsB,iBAAiB,CACtBC,KAAM,YACNC,QAAS,SACTL,UAAWA,IA4DbM,CAAgBzB,EAAQmB,GACjBnB,GAKL0B,EAAkBC,QAAQC,UAAUC,MAAK,WAC3C,OA9DmCC,EA8DjB,KA5DI,OAAlBf,EACKA,EAGTA,EAAgB,IAAIY,SAAQ,SAAUC,EAASG,GAC7C,GAAsB,oBAAXC,OAWX,GAJIA,OAAOC,QAAUH,GACnBI,QAAQC,KAAKrB,GAGXkB,OAAOC,OACTL,EAAQI,OAAOC,aAIjB,IACE,IAAIG,EAnEO,WAGf,IAFA,IAAIC,EAAUC,SAASC,iBAAiB,gBAAiBC,OAAO5B,EAAQ,OAE/D6B,EAAI,EAAGA,EAAIJ,EAAQK,OAAQD,IAAK,CACvC,IAAIL,EAASC,EAAQI,GAErB,GAAK5B,EAAa8B,KAAKP,EAAOQ,KAI9B,OAAOR,EAGT,OAAO,KAsDUS,GAETT,GAAUN,EACZI,QAAQC,KAAKrB,GACHsB,IACVA,EAxDW,SAAsBN,GACvC,IAAIgB,EAAchB,IAAWA,EAAOiB,qBAAuB,8BAAgC,GACvFX,EAASE,SAASU,cAAc,UACpCZ,EAAOQ,IAAM,GAAGJ,OAAO5B,GAAQ4B,OAAOM,GACtC,IAAIG,EAAaX,SAASY,MAAQZ,SAASa,KAE3C,IAAKF,EACH,MAAM,IAAIG,MAAM,+EAIlB,OADAH,EAAWI,YAAYjB,GAChBA,EA6CQkB,CAAaxB,IAGxBM,EAAOmB,iBAAiB,QAAQ,WAC1BvB,OAAOC,OACTL,EAAQI,OAAOC,QAEfF,EAAO,IAAIqB,MAAM,+BAGrBhB,EAAOmB,iBAAiB,SAAS,WAC/BxB,EAAO,IAAIqB,MAAM,gCAEnB,MAAOI,GAEP,YADAzB,EAAOyB,QAjCP5B,EAAQ,SAVG,IAAoBE,KAgEjC2B,GAAa,EACjB/B,EAAuB,OAAE,SAAUgC,GAC5BD,GACHvB,QAAQC,KAAKuB,MAGjB,IAAIC,EAAa,WACf,IAAK,IAAIC,EAAOC,UAAUnB,OAAQxB,EAAO,IAAI4C,MAAMF,GAAOG,EAAO,EAAGA,EAAOH,EAAMG,IAC/E7C,EAAK6C,GAAQF,UAAUE,GAGzBN,GAAa,EACb,IAAItC,EAAY6C,KAAKC,MACrB,OAAOvC,EAAgBG,MAAK,SAAUZ,GACpC,OAAOD,EAAWC,EAAaC,EAAMC,Q,qBC5HzCX,EAAOC,QAAUuB,OAAe,SCC5BkC,EAA2B,GAG/B,SAASC,EAAoBC,GAE5B,GAAGF,EAAyBE,GAC3B,OAAOF,EAAyBE,GAAU3D,QAG3C,IAAID,EAAS0D,EAAyBE,GAAY,CAGjD3D,QAAS,IAOV,OAHA4D,EAAoBD,GAAU5D,EAAQA,EAAOC,QAAS0D,GAG/C3D,EAAOC,QCnBf0D,EAAoBG,EAAI,CAAC7D,EAAS8D,KACjC,IAAI,IAAIC,KAAOD,EACXJ,EAAoBM,EAAEF,EAAYC,KAASL,EAAoBM,EAAEhE,EAAS+D,IAC5EE,OAAOC,eAAelE,EAAS+D,EAAK,CAAEI,YAAY,EAAMC,IAAKN,EAAWC,MCJ3EL,EAAoBM,EAAI,CAAC/D,EAAKoE,IAAUJ,OAAOK,UAAUC,eAAeC,KAAKvE,EAAKoE,GCClFX,EAAoBe,EAAKzE,IACH,oBAAX0E,QAA0BA,OAAOC,aAC1CV,OAAOC,eAAelE,EAAS0E,OAAOC,YAAa,CAAEC,MAAO,WAE7DX,OAAOC,eAAelE,EAAS,aAAc,CAAE4E,OAAO,K,SPLvD,SACA,YAIIpF,EAAO,GAuBLC,EAAiB,SAACoF,EAAGC,GACvBjF,EAAQ,SAAUiF,IAGhBpF,EAAmB,SAACmF,GACtB,IAAIE,EAAQF,EAAEG,OAAOD,MAAM,iBAC3B,GAAIA,EAAO,SACD9E,EAAMgF,KAAKC,MAAM3D,OAAO4D,KAAKC,mBAAmBL,EAAM,MAC5D,UAAAnF,EAAQ,iBAAR,mBAAmByF,YAAnB,SAAyBC,OACzBzF,EAAQ,gBAAiBI,EAAIsF,gBAC7BC,QAAQC,UAAU,GAAI,GAAIlE,OAAOmE,SAASC,SAAWpE,OAAOmE,SAASE,QACrErG,EAAOsG,mBAAmB5F,EAAI6F,eAAe1E,MAAK,SAAA2E,GAC1CA,EAAShD,MAETjD,KAEAD,EAAQ,mBAAmB,GAC3BD,EAAQ,UAAUoG,iBAEvBC,OAAM,SAAAlD,GACLtB,QAAQyE,IAAInD,QAKlBpD,EAAgB,SAACkF,GAEnB,OADAA,EAAC,gBAAsBjF,EAAQ,iBACxBiF,GAGLjF,EAAU,SAACmE,GAA6B,IAAxBoC,EAAwB,uDAAT,KAIjC,OAHK3G,EAAK+E,eAAeR,KACrBvE,EAAKuE,GAAOoC,GAET3G,EAAKuE,IAGVlE,EAAU,SAACkE,EAAKa,GAClBpF,EAAKuE,GAAOa,GAGV9E,EAAsB,WACxBF,EAAQ,UAAUwG,oBAAqB,EACvCxG,EAAQ,UAAUyG,oBAClBzG,EAAQ,UAAU0G,iBAAkB,IAGxC,aAAEzE,UAAU0E,GAAG,sBArDS,SAAC1B,EAAGC,GAAW,QACnCtF,EAAI,UAAG+B,cAAH,iBAAG,EAAQiF,kBAAX,aAAG,EAAoBC,WAC3B5G,EAAQ,SAAUiF,IAhBlB,aAAEjD,UAAU0E,GAAG,iBAAkB9G,GACjC8B,OAAOuB,iBAAiB,aAAcpD,GACtCgH,aAAaC,UAAU,0BAA2BhH,IAClD,IAAAuD,YAAWtD,EAAQ,iBACXA,EAAQ,WACD,CAACgH,cAAehH,EAAQ,YAE5B,KACJwB,MAAK,SAACyF,GACTtH,EAASsH,KACVZ,OAAM,SAAAlD,W","file":"wc-stripe-woofunnels.js","sourcesContent":["import {loadStripe} from '@stripe/stripe-js';\r\nimport $ from 'jquery';\r\n\r\nlet stripe;\r\n\r\nlet data = {};\r\n\r\nconst initialize = () => {\r\n $(document).on('wfocu_external', onHandleSubmit);\r\n window.addEventListener('hashchange', handleHashChange);\r\n wfocuCommons.addFilter('wfocu_front_charge_data', addChargeData);\r\n loadStripe(getData('publishableKey', (() => {\r\n if (getData('account')) {\r\n return {stripeAccount: getData('account')};\r\n }\r\n return {};\r\n })())).then((client) => {\r\n stripe = client;\r\n }).catch(error => {\r\n });\r\n}\r\n\r\nconst onBucketCreated = (e, bucket) => {\r\n data = window?.wfocu_vars?.stripeData;\r\n setData('bucket', bucket);\r\n initialize();\r\n}\r\n\r\nconst onHandleSubmit = (e, bucket) => {\r\n setData('bucket', bucket);\r\n}\r\n\r\nconst handleHashChange = (e) => {\r\n var match = e.newURL.match(/response=(.*)/);\r\n if (match) {\r\n const obj = JSON.parse(window.atob(decodeURIComponent(match[1])));\r\n getData('bucket')?.swal?.hide();\r\n setData('paymentIntent', obj.payment_intent);\r\n history.pushState({}, '', window.location.pathname + window.location.search);\r\n stripe.confirmCardPayment(obj.client_secret).then(response => {\r\n if (response.error) {\r\n // display message\r\n resetPaymentProcess();\r\n } else {\r\n setData('paymentComplete', true);\r\n getData('bucket').sendBucket();\r\n }\r\n }).catch(error => {\r\n console.log(error);\r\n });\r\n }\r\n}\r\n\r\nconst addChargeData = (e) => {\r\n e['_payment_intent'] = getData('paymentIntent');\r\n return e;\r\n}\r\n\r\nconst getData = (key, defaultValue = null) => {\r\n if (!data.hasOwnProperty(key)) {\r\n data[key] = defaultValue;\r\n }\r\n return data[key];\r\n}\r\n\r\nconst setData = (key, value) => {\r\n data[key] = value;\r\n}\r\n\r\nconst resetPaymentProcess = () => {\r\n getData('bucket').inOfferTransaction = false;\r\n getData('bucket').EnableButtonState();\r\n getData('bucket').HasEventRunning = false;\r\n}\r\n\r\n$(document).on('wfocuBucketCreated', onBucketCreated);","function _interopRequireDefault(obj) {\n return obj && obj.__esModule ? obj : {\n \"default\": obj\n };\n}\n\nmodule.exports = _interopRequireDefault;","var V3_URL = 'https://js.stripe.com/v3';\nvar V3_URL_REGEX = /^https:\\/\\/js\\.stripe\\.com\\/v3\\/?(\\?.*)?$/;\nvar EXISTING_SCRIPT_MESSAGE = 'loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used';\nvar findScript = function findScript() {\n var scripts = document.querySelectorAll(\"script[src^=\\\"\".concat(V3_URL, \"\\\"]\"));\n\n for (var i = 0; i < scripts.length; i++) {\n var script = scripts[i];\n\n if (!V3_URL_REGEX.test(script.src)) {\n continue;\n }\n\n return script;\n }\n\n return null;\n};\n\nvar injectScript = function injectScript(params) {\n var queryString = params && !params.advancedFraudSignals ? '?advancedFraudSignals=false' : '';\n var script = document.createElement('script');\n script.src = \"\".concat(V3_URL).concat(queryString);\n var headOrBody = document.head || document.body;\n\n if (!headOrBody) {\n throw new Error('Expected document.body not to be null. Stripe.js requires a <body> element.');\n }\n\n headOrBody.appendChild(script);\n return script;\n};\n\nvar registerWrapper = function registerWrapper(stripe, startTime) {\n if (!stripe || !stripe._registerWrapper) {\n return;\n }\n\n stripe._registerWrapper({\n name: 'stripe-js',\n version: \"1.12.1\",\n startTime: startTime\n });\n};\n\nvar stripePromise = null;\nvar loadScript = function loadScript(params) {\n // Ensure that we only attempt to load Stripe.js at most once\n if (stripePromise !== null) {\n return stripePromise;\n }\n\n stripePromise = new Promise(function (resolve, reject) {\n if (typeof window === 'undefined') {\n // Resolve to null when imported server side. This makes the module\n // safe to import in an isomorphic code base.\n resolve(null);\n return;\n }\n\n if (window.Stripe && params) {\n console.warn(EXISTING_SCRIPT_MESSAGE);\n }\n\n if (window.Stripe) {\n resolve(window.Stripe);\n return;\n }\n\n try {\n var script = findScript();\n\n if (script && params) {\n console.warn(EXISTING_SCRIPT_MESSAGE);\n } else if (!script) {\n script = injectScript(params);\n }\n\n script.addEventListener('load', function () {\n if (window.Stripe) {\n resolve(window.Stripe);\n } else {\n reject(new Error('Stripe.js not available'));\n }\n });\n script.addEventListener('error', function () {\n reject(new Error('Failed to load Stripe.js'));\n });\n } catch (error) {\n reject(error);\n return;\n }\n });\n return stripePromise;\n};\nvar initStripe = function initStripe(maybeStripe, args, startTime) {\n if (maybeStripe === null) {\n return null;\n }\n\n var stripe = maybeStripe.apply(undefined, args);\n registerWrapper(stripe, startTime);\n return stripe;\n};\n\n// own script injection.\n\nvar stripePromise$1 = Promise.resolve().then(function () {\n return loadScript(null);\n});\nvar loadCalled = false;\nstripePromise$1[\"catch\"](function (err) {\n if (!loadCalled) {\n console.warn(err);\n }\n});\nvar loadStripe = function loadStripe() {\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n loadCalled = true;\n var startTime = Date.now();\n return stripePromise$1.then(function (maybeStripe) {\n return initStripe(maybeStripe, args, startTime);\n });\n};\n\nexport { loadStripe };\n","module.exports = window[\"jQuery\"];","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tif(__webpack_module_cache__[moduleId]) {\n\t\treturn __webpack_module_cache__[moduleId].exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};"],"sourceRoot":""}
packages/woofunnels/src/Constants.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+
4
+ namespace PaymentPlugins\WooFunnels\Stripe;
5
+
6
+
7
+ class Constants {
8
+
9
+ const PAYMENT_INTENT_ID = '_';
10
+ }
packages/woofunnels/src/Main.php ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+
4
+ namespace PaymentPlugins\WooFunnels\Stripe;
5
+
6
+
7
+ class Main {
8
+
9
+ public static function init() {
10
+ if ( self::enabled() ) {
11
+ new PaymentGateways();
12
+ }
13
+ }
14
+
15
+ private static function enabled() {
16
+ return function_exists( 'WFOCU_Core' );
17
+ }
18
+ }
packages/woofunnels/src/PaymentGateways.php ADDED
@@ -0,0 +1,123 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+
4
+ namespace PaymentPlugins\WooFunnels\Stripe;
5
+
6
+
7
+ class PaymentGateways {
8
+
9
+ public function __construct() {
10
+ $this->initialize();
11
+ }
12
+
13
+ private function initialize() {
14
+ add_action( 'init', [ $this, 'initialize_gateways' ] );
15
+ add_filter( 'wfocu_wc_get_supported_gateways', [ $this, 'add_supported_gateways' ] );
16
+ add_filter( 'wc_stripe_force_save_payment_method', [ $this, 'maybe_set_save_payment_method' ], 10, 3 );
17
+ add_action( 'wc_stripe_order_payment_complete', [ $this, 'maybe_setup_upsell' ], 10, 2 );
18
+ add_action( 'wfocu_offer_new_order_created_before_complete', [ $this, 'add_new_order_data' ] );
19
+ add_action( 'wfocu_footer_before_print_scripts', [ $this, 'add_scripts' ] );
20
+ add_filter( 'wfocu_localized_data', [ $this, 'add_data' ] );
21
+ }
22
+
23
+ public function initialize_gateways() {
24
+ foreach ( $this->get_payment_gateways() as $clazz ) {
25
+ call_user_func( [ $clazz, 'get_instance' ] );
26
+ }
27
+ }
28
+
29
+ public function add_supported_gateways( $gateways ) {
30
+ return array_merge( $gateways, $this->get_payment_gateways() );
31
+ }
32
+
33
+ private function get_payment_gateways() {
34
+ return [
35
+ 'stripe_cc' => 'PaymentPlugins\WooFunnels\Stripe\PaymentGateways\CreditCardGateway',
36
+ 'stripe_googlepay' => 'PaymentPlugins\WooFunnels\Stripe\PaymentGateways\GooglePayGateway',
37
+ 'stripe_applepay' => 'PaymentPlugins\WooFunnels\Stripe\PaymentGateways\ApplePayGateway',
38
+ 'stripe_payment_request' => 'PaymentPlugins\WooFunnels\Stripe\PaymentGateways\PaymentRequestGateway'
39
+ ];
40
+ }
41
+
42
+ private function is_supported_gateway( $id ) {
43
+ return isset( $this->get_payment_gateways()[ $id ] );
44
+ }
45
+
46
+ /**
47
+ * @param $id
48
+ *
49
+ * @return bool|\WFOCU_Gateway|\WFOCU_Gateways
50
+ */
51
+ public function get_wfocu_payment_gateway( $id ) {
52
+ return WFOCU_Core()->gateways->get_integration( $id );
53
+ }
54
+
55
+ /**
56
+ * @param $bool
57
+ * @param \WC_Order $order
58
+ * @param \WC_Payment_Gateway_Stripe $payment_method
59
+ *
60
+ * @return bool
61
+ */
62
+ public function maybe_set_save_payment_method( $bool, \WC_Order $order, \WC_Payment_Gateway_Stripe $payment_method ) {
63
+ if ( ! $bool ) {
64
+ $payment_gateway = $this->get_wfocu_payment_gateway( $order->get_payment_method() );
65
+ if ( $payment_gateway && $payment_gateway->should_tokenize() && ! $payment_method->use_saved_source() ) {
66
+ $bool = true;
67
+ }
68
+ }
69
+
70
+ return $bool;
71
+ }
72
+
73
+ /**
74
+ * Maybe setup the WooFunnels upsell if the charge has not been captured.
75
+ *
76
+ * @param \Stripe\Charge $charge
77
+ * @param \WC_Order $order
78
+ */
79
+ public function maybe_setup_upsell( \Stripe\Charge $charge, \WC_Order $order ) {
80
+ $payment_method = $order->get_payment_method();
81
+ if ( ! $charge->captured && $this->is_supported_gateway( $payment_method ) ) {
82
+ $payment_gateway = $this->get_wfocu_payment_gateway( $payment_method );
83
+ if ( $payment_gateway && $payment_gateway->should_tokenize() ) {
84
+ WFOCU_Core()->public->maybe_setup_upsell( $order->get_id() );
85
+ }
86
+ }
87
+ }
88
+
89
+ public function add_new_order_data( \WC_Order $order ) {
90
+ $payment_method = $order->get_payment_method();
91
+ if ( $this->is_supported_gateway( $payment_method ) ) {
92
+ $order->update_meta_data( \WC_Stripe_Constants::MODE, wc_stripe_mode() );
93
+ }
94
+ }
95
+
96
+ public function add_data( $data ) {
97
+ $data['stripeData'] = [
98
+ 'publishableKey' => wc_stripe_get_publishable_key(),
99
+ 'account' => wc_stripe_get_account_id()
100
+ ];
101
+
102
+ return $data;
103
+ }
104
+
105
+ public function add_scripts() {
106
+ if ( ! \WFOCU_Core()->public->if_is_offer() || WFOCU_Core()->public->if_is_preview() ) {
107
+ return true;
108
+ }
109
+ $order = WFOCU_Core()->data->get_current_order();
110
+ if ( ! $order instanceof \WC_Order ) {
111
+ return;
112
+ }
113
+ $payment_method = $order->get_payment_method();
114
+
115
+ if ( in_array( $payment_method, array_keys( $this->get_payment_gateways() ) ) ) {
116
+ global $wp_scripts;
117
+ $assets_url = plugin_dir_url( __DIR__ ) . 'build/';
118
+ $params = require_once dirname( __DIR__ ) . '/build/wc-stripe-woofunnels.asset.php';
119
+ wp_enqueue_script( 'wc-stripe-woofunnels', $assets_url . 'wc-stripe-woofunnels.js', $params['dependencies'], $params['version'], true );
120
+ $wp_scripts->do_items( [ 'wc-stripe-woofunnels' ] );
121
+ }
122
+ }
123
+ }
packages/woofunnels/src/PaymentGateways/ApplePayGateway.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+
4
+ namespace PaymentPlugins\WooFunnels\Stripe\PaymentGateways;
5
+
6
+
7
+ class ApplePayGateway extends BasePaymentGateway {
8
+
9
+ protected $key = 'stripe_applepay';
10
+ }
packages/woofunnels/src/PaymentGateways/BasePaymentGateway.php ADDED
@@ -0,0 +1,201 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+
4
+ namespace PaymentPlugins\WooFunnels\Stripe\PaymentGateways;
5
+
6
+ use PaymentPlugins\WooFunnels\Stripe\Constants;
7
+
8
+ /**
9
+ * Class BaseGateway
10
+ * @package PaymentPlugins\WooFunnels\Stripe\PaymentGateways
11
+ */
12
+ class BasePaymentGateway extends \WFOCU_Gateway {
13
+
14
+ public $refund_supported = true;
15
+
16
+ /**
17
+ * @var \WFOCU_Logger
18
+ */
19
+ private $logger;
20
+
21
+ private $client;
22
+
23
+ private $payment;
24
+
25
+ public function __construct( \WC_Stripe_Gateway $client, \WC_Stripe_Payment $payment, \WFOCU_Logger $logger ) {
26
+ $this->client = $client;
27
+ $this->payment = $payment;
28
+ $this->logger = $logger;
29
+ $this->initialize();
30
+ }
31
+
32
+ public static function get_instance() {
33
+ static $instance;
34
+ if ( ! $instance ) {
35
+ $instance = new static( \WC_Stripe_Gateway::load(), new \WC_Stripe_Payment_Intent( null, null ), WFOCU_Core()->log );
36
+ }
37
+
38
+ return $instance;
39
+ }
40
+
41
+ public function initialize() {
42
+ }
43
+
44
+ /**
45
+ * @param \WC_Order $order
46
+ *
47
+ * @return false|true|void
48
+ */
49
+ public function process_charge( $order ) {
50
+ $this->handle_client_error();
51
+ $intent = isset( $_POST['_payment_intent'] ) ? $_POST['_payment_intent'] : null;
52
+ // check if payment intent exists.
53
+ if ( $intent ) {
54
+ $intent = $this->client->paymentIntents->retrieve( $intent );
55
+ } else {
56
+ // If there is no customer ID, create one
57
+ $customer_id = $order->get_meta( \WC_Stripe_Constants::CUSTOMER_ID );
58
+ if ( ! $customer_id && ! is_user_logged_in() ) {
59
+ $this->create_stripe_customer( WC()->customer, $order );
60
+ } elseif ( is_user_logged_in() ) {
61
+ $order->update_meta_data( \WC_Stripe_Constants::CUSTOMER_ID, wc_stripe_get_customer_id( $order->get_customer_id() ) );
62
+ $order->save();
63
+ }
64
+ // create the payment intent
65
+ $intent = $this->create_payment_intent( $order );
66
+ }
67
+ if ( $intent->status === \WC_Stripe_Constants::REQUIRES_PAYMENT_METHOD ) {
68
+ $intent = $this->client->paymentIntents->update( $intent->id, [ 'payment_method' => $order->get_meta( \WC_Stripe_Constants::PAYMENT_METHOD_TOKEN ) ] );
69
+ if ( is_wp_error( $intent ) ) {
70
+ throw new \WFOCU_Payment_Gateway_Exception( $intent->get_error_message() );
71
+ }
72
+ }
73
+ if ( $intent->status === \WC_Stripe_Constants::REQUIRES_CONFIRMATION ) {
74
+ $intent = $this->client->paymentIntents->confirm( $intent->id );
75
+ if ( is_wp_error( $intent ) ) {
76
+ throw new \WFOCU_Payment_Gateway_Exception( $intent->get_error_message() );
77
+ }
78
+ }
79
+ if ( $intent->status === \WC_Stripe_Constants::REQUIRES_ACTION ) {
80
+ // send back response
81
+ return \wp_send_json( [
82
+ 'success' => true,
83
+ 'data' => [ 'redirect_url' => $this->get_payment_intent_redirect_url( $intent ) ]
84
+ ] );
85
+ }
86
+ WFOCU_Core()->data->set( '_transaction_id', $intent->charges->data[0]->id );
87
+
88
+ return $this->handle_result( true );
89
+ }
90
+
91
+ /**
92
+ * @param \WC_Order $order
93
+ *
94
+ * @return bool
95
+ */
96
+ public function process_refund_offer( $order ) {
97
+ $charge = isset( $_POST['txn_id'] ) ? $_POST['txn_id'] : false;
98
+ $amount = isset( $_POST['amt'] ) ? round( $_POST['amt'], 2 ) : false;
99
+ $mode = wc_stripe_order_mode( $order );
100
+ $result = $this->client->refunds->mode( $mode )->create( [
101
+ 'charge' => $charge,
102
+ 'amount' => wc_stripe_add_number_precision( $amount, $order->get_currency() ),
103
+ 'metadata' => array(
104
+ 'order_id' => $order->get_id(),
105
+ 'created_via' => 'woocommerce'
106
+ )
107
+ ] );
108
+ if ( is_wp_error( $result ) ) {
109
+ $this->logger->log( sprintf( 'Error refunding charge %s. Reason: %s', $charge, $result->get_error_message() ) );
110
+
111
+ return false;
112
+ } else {
113
+ $this->logger->log( sprintf( 'Charge %s refunded n Stripe.', $charge ) );
114
+ }
115
+
116
+ return $result->id;
117
+ }
118
+
119
+ public function get_transaction_link( $transaction_id, $order_id ) {
120
+ $order = wc_get_order( $order_id );
121
+ $mode = wc_stripe_order_mode( $order );
122
+ $url = 'https://dashboard.stripe.com/payments/%s';
123
+ if ( $mode === 'test' ) {
124
+ $url = 'https://dashboard.stripe.com/test/payments/%s';
125
+ }
126
+
127
+ return sprintf( $url, $transaction_id );
128
+ }
129
+
130
+ public function handle_client_error() {
131
+ $package = WFOCU_Core()->data->get( '_upsell_package' );
132
+ if ( $package && isset( $package['_client_error'] ) ) {
133
+ $this->logger->log( sprintf( 'Stripe client error: %s', sanitize_text_field( $package['_client_error'] ) ) );
134
+ }
135
+ }
136
+
137
+ /**
138
+ * @param \WC_Customer $customer
139
+ *
140
+ * @throws \WFOCU_Payment_Gateway_Exception
141
+ */
142
+ private function create_stripe_customer( \WC_Customer $customer, \WC_Order $order ) {
143
+ $result = \WC_Stripe_Customer_Manager::instance()->create_customer( $customer );
144
+ if ( ! is_wp_error( $result ) ) {
145
+ $order->update_meta_data( \WC_Stripe_Constants::CUSTOMER_ID, $result->id );
146
+ $order->save();
147
+
148
+ // now that we have a customer created, attach the payment method
149
+ $payment_method = $order->get_meta( \WC_Stripe_Constants::PAYMENT_METHOD_TOKEN );
150
+
151
+ return $this->client->paymentMethods->attach( $payment_method, [ 'customer' => $result->id ] );
152
+ }
153
+
154
+ throw new \WFOCU_Payment_Gateway_Exception( $result->get_error_message() );
155
+ }
156
+
157
+ private function create_payment_intent( \WC_Order $order ) {
158
+ $package = WFOCU_Core()->data->get( '_upsell_package' );
159
+ $payment_method = $this->get_wc_gateway();
160
+ $params = array(
161
+ 'amount' => wc_stripe_add_number_precision( $package['total'], $order->get_currency() ),
162
+ 'description' => sprintf( __( '%1$s - Order %2$s - One Time offer', 'woo-stripe-payment' ), wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES ), $order->get_order_number() ),
163
+ 'payment_method' => $order->get_meta( \WC_Stripe_Constants::PAYMENT_METHOD_TOKEN ),
164
+ 'confirmation_method' => 'automatic', //$payment_method->get_confirmation_method( $order ),
165
+ 'capture_method' => $payment_method->get_option( 'charge_type' ) === 'capture' ? 'automatic' : 'manual',
166
+ 'confirm' => false,
167
+ 'payment_method_types' => [ $payment_method->get_payment_method_type() ],
168
+ 'customer' => $order->get_meta( \WC_Stripe_Constants::CUSTOMER_ID )
169
+ );
170
+ $this->payment->add_order_metadata( $params, $order );
171
+ $this->payment->add_order_currency( $params, $order );
172
+ $this->payment->add_order_shipping_address( $params, $order );
173
+
174
+ $result = $this->client->paymentIntents->mode( wc_stripe_order_mode( $order ) )->create( $params );
175
+ if ( is_wp_error( $result ) ) {
176
+ throw new \WFOCU_Payment_Gateway_Exception( $result->get_error_message() );
177
+ }
178
+
179
+ return $result;
180
+ }
181
+
182
+ public function has_token( $order ) {
183
+ $payment_token = $order->get_meta( \WC_Stripe_Constants::PAYMENT_METHOD_TOKEN );
184
+
185
+ return ! empty( $payment_token );
186
+ }
187
+
188
+ /**
189
+ * @param \Stripe\PaymentIntent $intent
190
+ *
191
+ * @return string
192
+ */
193
+ protected function get_payment_intent_redirect_url( \Stripe\PaymentIntent $intent ) {
194
+ return sprintf( '#response=%s', rawurlencode( base64_encode(
195
+ wp_json_encode( [
196
+ 'payment_intent' => $intent->id,
197
+ 'client_secret' => $intent->client_secret
198
+ ]
199
+ ) ) ) );
200
+ }
201
+ }
packages/woofunnels/src/PaymentGateways/CreditCardGateway.php ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+
4
+ namespace PaymentPlugins\WooFunnels\Stripe\PaymentGateways;
5
+
6
+
7
+ class CreditCardGateway extends BasePaymentGateway {
8
+
9
+ protected $key = 'stripe_cc';
10
+
11
+ public function initialize() {
12
+ add_filter( 'wc_stripe_cc_show_save_source', [ $this, 'show_save_source' ] );
13
+ }
14
+
15
+ public function show_save_source( $bool ) {
16
+ if ( $bool ) {
17
+ $bool = ! $this->should_tokenize();
18
+ }
19
+
20
+ return $bool;
21
+ }
22
+ }
packages/woofunnels/src/PaymentGateways/GooglePayGateway.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+
4
+ namespace PaymentPlugins\WooFunnels\Stripe\PaymentGateways;
5
+
6
+
7
+ class GooglePayGateway extends BasePaymentGateway {
8
+
9
+ protected $key = 'stripe_googlepay';
10
+ }
packages/woofunnels/src/PaymentGateways/PaymentRequestGateway.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+
4
+ namespace PaymentPlugins\WooFunnels\Stripe\PaymentGateways;
5
+
6
+
7
+ class PaymentRequestGateway extends BasePaymentGateway {
8
+
9
+ protected $key = 'stripe_payment_request';
10
+ }
readme.txt CHANGED
@@ -2,9 +2,9 @@
2
  Contributors: mr.clayton
3
  Tags: stripe, ach, klarna, credit card, apple pay, google pay, ideal, sepa, sofort
4
  Requires at least: 3.0.1
5
- Tested up to: 5.7
6
  Requires PHP: 5.6
7
- Stable tag: 3.3.5
8
  Copyright: Payment Plugins
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
@@ -60,6 +60,11 @@ If you're site is not loading over https, then Stripe won't render the Payment R
60
  8. Edit payment gateways on the product page
61
 
62
  == Changelog ==
 
 
 
 
 
63
  = 3.3.5 =
64
  * Fixed - BECS not always redirecting to the order received thank you page
65
  * Fixed - Mini-cart issue where GPay button wasn't rendering due to styling change
2
  Contributors: mr.clayton
3
  Tags: stripe, ach, klarna, credit card, apple pay, google pay, ideal, sepa, sofort
4
  Requires at least: 3.0.1
5
+ Tested up to: 5.8
6
  Requires PHP: 5.6
7
+ Stable tag: 3.3.6
8
  Copyright: Payment Plugins
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
60
  8. Edit payment gateways on the product page
61
 
62
  == Changelog ==
63
+ = 3.3.6 =
64
+ * Added - WooFunnels integration that supports credit cards, Apple Pay, GPay, and Payment Request gateway
65
+ * Added - Support for "WooCommerce All Products For Subscriptions" plugin
66
+ * Added - Round GPay totals to 2 decimals points since GPay will only accept a maximum of 2 decimals
67
+ * Fixed - Klarna ensure item totals always add up to order total to prevent "Bad Value" error.
68
  = 3.3.5 =
69
  * Fixed - BECS not always redirecting to the order received thank you page
70
  * Fixed - Mini-cart issue where GPay button wasn't rendering due to styling change
stripe-payments.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: Stripe For WooCommerce
4
  * Plugin URI: https://docs.paymentplugins.com/wc-stripe/config/
5
  * Description: Accept Credit Cards, Google Pay, Apple Pay, ACH, Klarna and more using Stripe.
6
- * Version: 3.3.5
7
  * Author: Payment Plugins, support@paymentplugins.com
8
  * Text Domain: woo-stripe-payment
9
  * Domain Path: /i18n/languages/
3
  * Plugin Name: Stripe For WooCommerce
4
  * Plugin URI: https://docs.paymentplugins.com/wc-stripe/config/
5
  * Description: Accept Credit Cards, Google Pay, Apple Pay, ACH, Klarna and more using Stripe.
6
+ * Version: 3.3.6
7
  * Author: Payment Plugins, support@paymentplugins.com
8
  * Text Domain: woo-stripe-payment
9
  * Domain Path: /i18n/languages/
vendor/composer/autoload_psr4.php CHANGED
@@ -7,6 +7,7 @@ $baseDir = dirname($vendorDir);
7
 
8
  return array(
9
  'Stripe\\' => array($vendorDir . '/stripe/stripe-php/lib'),
 
10
  'PaymentPlugins\\CartFlows\\Stripe\\' => array($baseDir . '/packages/cartflows/src'),
11
  'PaymentPlugins\\Blocks\\Stripe\\' => array($baseDir . '/packages/blocks/src'),
12
  );
7
 
8
  return array(
9
  'Stripe\\' => array($vendorDir . '/stripe/stripe-php/lib'),
10
+ 'PaymentPlugins\\WooFunnels\\Stripe\\' => array($baseDir . '/packages/woofunnels/src'),
11
  'PaymentPlugins\\CartFlows\\Stripe\\' => array($baseDir . '/packages/cartflows/src'),
12
  'PaymentPlugins\\Blocks\\Stripe\\' => array($baseDir . '/packages/blocks/src'),
13
  );
vendor/composer/autoload_static.php CHANGED
@@ -13,6 +13,7 @@ class ComposerStaticInit5768cfd8cdeac9b8b5d68cdcb14472ce
13
  ),
14
  'P' =>
15
  array (
 
16
  'PaymentPlugins\\CartFlows\\Stripe\\' => 32,
17
  'PaymentPlugins\\Blocks\\Stripe\\' => 29,
18
  ),
@@ -23,6 +24,10 @@ class ComposerStaticInit5768cfd8cdeac9b8b5d68cdcb14472ce
23
  array (
24
  0 => __DIR__ . '/..' . '/stripe/stripe-php/lib',
25
  ),
 
 
 
 
26
  'PaymentPlugins\\CartFlows\\Stripe\\' =>
27
  array (
28
  0 => __DIR__ . '/../..' . '/packages/cartflows/src',
13
  ),
14
  'P' =>
15
  array (
16
+ 'PaymentPlugins\\WooFunnels\\Stripe\\' => 33,
17
  'PaymentPlugins\\CartFlows\\Stripe\\' => 32,
18
  'PaymentPlugins\\Blocks\\Stripe\\' => 29,
19
  ),
24
  array (
25
  0 => __DIR__ . '/..' . '/stripe/stripe-php/lib',
26
  ),
27
+ 'PaymentPlugins\\WooFunnels\\Stripe\\' =>
28
+ array (
29
+ 0 => __DIR__ . '/../..' . '/packages/woofunnels/src',
30
+ ),
31
  'PaymentPlugins\\CartFlows\\Stripe\\' =>
32
  array (
33
  0 => __DIR__ . '/../..' . '/packages/cartflows/src',