Payment Plugins for Stripe WooCommerce - Version 3.0.4

Version Description

  • Added - Bootstrap form added
  • Updated - WC 3.8.1
  • Fixed - Check for customer object in Admin pages for local payment methods
Download this release

Release Info

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

Code changes from version 3.0.3 to 3.0.4

assets/css/stripe.css CHANGED
@@ -153,6 +153,7 @@ input.wc-stripe-klarna-category:checked+label.wc-stripe-label-klarna-category:be
153
  background-color: white;
154
  display: block;
155
  border-radius: 3px;
 
156
  }
157
  .wc-stripe_cc-container .save-source-checkbox:after{
158
  content: "";
@@ -162,7 +163,7 @@ input.wc-stripe-klarna-category:checked+label.wc-stripe-label-klarna-category:be
162
  }
163
  .wc-stripe_cc-container .wc-stripe-save-source input[type="checkbox"]:checked + .save-source-checkbox:after{
164
  left: 6px;
165
- top: 3px;
166
  width: 7px;
167
  height: 12px;
168
  border: solid #2196F3;
@@ -170,6 +171,9 @@ input.wc-stripe-klarna-category:checked+label.wc-stripe-label-klarna-category:be
170
  -webkit-transform: rotate(45deg);
171
  -ms-transform: rotate(45deg);
172
  transform: rotate(45deg);
 
 
 
173
  }
174
  li.payment_method_stripe_googlepay,
175
  li.payment_method_stripe_applepay,
@@ -356,12 +360,14 @@ li.banner_payment_method_stripe_payment_request .StripeElement{
356
  background-color: transparent !important;
357
  }
358
  #wc-stripe-card{
359
- position: absolute;
360
  top: 50%;
361
  right: 8px;
362
  transform: translatey(-50%);
363
  width: 23px;
364
  height: 15px;
 
 
365
  }
366
  #wc-stripe-card.active{
367
  width: 32px;
153
  background-color: white;
154
  display: block;
155
  border-radius: 3px;
156
+ border: 1px solid #bababa;
157
  }
158
  .wc-stripe_cc-container .save-source-checkbox:after{
159
  content: "";
163
  }
164
  .wc-stripe_cc-container .wc-stripe-save-source input[type="checkbox"]:checked + .save-source-checkbox:after{
165
  left: 6px;
166
+ top: 2px;
167
  width: 7px;
168
  height: 12px;
169
  border: solid #2196F3;
171
  -webkit-transform: rotate(45deg);
172
  -ms-transform: rotate(45deg);
173
  transform: rotate(45deg);
174
+ -webkit-box-sizing: border-box;
175
+ -moz-box-sizing: border-box;
176
+ box-sizing: border-box
177
  }
178
  li.payment_method_stripe_googlepay,
179
  li.payment_method_stripe_applepay,
360
  background-color: transparent !important;
361
  }
362
  #wc-stripe-card{
363
+ position: absolute !important;
364
  top: 50%;
365
  right: 8px;
366
  transform: translatey(-50%);
367
  width: 23px;
368
  height: 15px;
369
+ padding: 0px;
370
+ border: none;
371
  }
372
  #wc-stripe-card.active{
373
  width: 32px;
assets/js/frontend/credit-card.js CHANGED
@@ -58,6 +58,12 @@
58
  style: this.params.style,
59
  classes: elementClasses
60
  });
 
 
 
 
 
 
61
  $(document.body).on('change', '#billing_postcode', function(e) {
62
  var val = $('#billing_postcode').val();
63
  $('#stripe-postal-code').val(val).trigger('keyup');
@@ -75,6 +81,36 @@
75
  setInterval(this.create_card_element.bind(this), 2000);
76
  }
77
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
78
  /**
79
  *
80
  */
@@ -105,6 +141,7 @@
105
  $('#stripe-postal-code').removeClass('empty');
106
  }
107
  }.bind(this))
 
108
  $('#stripe-postal-code').trigger('keyup');
109
  }
110
  }
@@ -120,6 +157,11 @@
120
  }
121
  }
122
  }
 
 
 
 
 
123
  }
124
 
125
  /**
@@ -244,6 +286,13 @@
244
  this.create_card_element();
245
  }
246
 
 
 
 
 
 
 
 
247
  CC.prototype.show_payment_button = function() {
248
  wc_stripe.CheckoutGateway.prototype.show_place_order.apply(this, arguments);
249
  }
@@ -291,6 +340,15 @@
291
  $('#wc-stripe-card').attr('src', this.params.cards[data.brand]);
292
  }
293
 
 
 
 
 
 
 
 
 
 
294
  new CC();
295
 
296
  }(jQuery, window.wc_stripe))
58
  style: this.params.style,
59
  classes: elementClasses
60
  });
61
+ if ($('#billing_postcode').length && '' !== $('#billing_postcode').val()) {
62
+ if ($('#stripe-postal-code').length > 0) {
63
+ $('#stripe-postal-code').val($('#billing_postcode').val());
64
+ this.validate_postal_field();
65
+ }
66
+ }
67
  $(document.body).on('change', '#billing_postcode', function(e) {
68
  var val = $('#billing_postcode').val();
69
  $('#stripe-postal-code').val(val).trigger('keyup');
81
  setInterval(this.create_card_element.bind(this), 2000);
82
  }
83
 
84
+ CC.prototype.validate_postal_field = function() {
85
+ if ($('#billing_postcode').length && $('#stripe-postal-code').length) {
86
+ // validate postal code
87
+ if (this.params.postal_regex[$('#billing_country').val()]) {
88
+ var regex = this.params.postal_regex[$('#billing_country').val()],
89
+ postal = $('#stripe-postal-code').val(),
90
+ regExp = new RegExp(regex, "i");
91
+ if (postal !== "") {
92
+ if (regExp.exec(postal) !== null) {
93
+ $('#stripe-postal-code').addClass('StripeElement--complete').removeClass('invalid');
94
+ } else {
95
+ $('#stripe-postal-code').removeClass('StripeElement--complete').addClass('invalid');
96
+ }
97
+ } else {
98
+ $('#stripe-postal-code').removeClass('StripeElement--complete').removeClass('invalid');
99
+ }
100
+ } else {
101
+ if ($('#stripe-postal-code').val() != 0) {
102
+ $('#stripe-postal-code').addClass('StripeElement--complete');
103
+ } else {
104
+ $('#stripe-postal-code').removeClass('StripeElement--complete');
105
+ }
106
+ }
107
+ } else if ($('#stripe-postal-code').length) {
108
+ if ($('#stripe-postal-code').val() != 0) {
109
+ $('#stripe-postal-code').addClass('StripeElement--complete');
110
+ }
111
+ }
112
+ }
113
+
114
  /**
115
  *
116
  */
141
  $('#stripe-postal-code').removeClass('empty');
142
  }
143
  }.bind(this))
144
+ $('#stripe-postal-code').on('change', this.validate_postal_field.bind(this));
145
  $('#stripe-postal-code').trigger('keyup');
146
  }
147
  }
157
  }
158
  }
159
  }
160
+ if ($(this.container).outerWidth(true) < 450) {
161
+ $(this.container).addClass('stripe-small-container');
162
+ } else {
163
+ $(this.container).removeClass('stripe-small-container');
164
+ }
165
  }
166
 
167
  /**
286
  this.create_card_element();
287
  }
288
 
289
+ /**
290
+ *
291
+ */
292
+ CC.prototype.update_checkout = function() {
293
+ this.clear_card_elements();
294
+ }
295
+
296
  CC.prototype.show_payment_button = function() {
297
  wc_stripe.CheckoutGateway.prototype.show_place_order.apply(this, arguments);
298
  }
340
  $('#wc-stripe-card').attr('src', this.params.cards[data.brand]);
341
  }
342
 
343
+ CC.prototype.clear_card_elements = function() {
344
+ var elements = ['cardNumber', 'cardExpiry', 'cardCvc'];
345
+ for (var i = 0; i < elements.length; i++) {
346
+ if (this[elements[i]]) {
347
+ this[elements[i]].clear();
348
+ }
349
+ }
350
+ }
351
+
352
  new CC();
353
 
354
  }(jQuery, window.wc_stripe))
assets/js/frontend/wc-stripe.js CHANGED
@@ -692,6 +692,7 @@
692
  wc_stripe.CheckoutGateway = function() {
693
  this.container = this.message_container = 'li.payment_method_' + this.gateway_id;
694
  this.banner_container = 'li.banner_payment_method_' + this.gateway_id;
 
695
  $(document.body).on('updated_checkout', this.updated_checkout.bind(this));
696
  $(document.body).on('checkout_error', this.checkout_error.bind(this));
697
  $(this.token_selector).closest('form').on('checkout_place_order_' + this.gateway_id, this.checkout_place_order.bind(this));
@@ -729,6 +730,11 @@
729
  */
730
  wc_stripe.CheckoutGateway.prototype.updated_checkout = function() {}
731
 
 
 
 
 
 
732
  /**
733
  * Called on the WC checkout_error event
734
  */
692
  wc_stripe.CheckoutGateway = function() {
693
  this.container = this.message_container = 'li.payment_method_' + this.gateway_id;
694
  this.banner_container = 'li.banner_payment_method_' + this.gateway_id;
695
+ $(document.body).on('update_checkout', this.update_checkout.bind(this));
696
  $(document.body).on('updated_checkout', this.updated_checkout.bind(this));
697
  $(document.body).on('checkout_error', this.checkout_error.bind(this));
698
  $(this.token_selector).closest('form').on('checkout_place_order_' + this.gateway_id, this.checkout_place_order.bind(this));
730
  */
731
  wc_stripe.CheckoutGateway.prototype.updated_checkout = function() {}
732
 
733
+ /**
734
+ * Called on the WC update_checkout event
735
+ */
736
+ wc_stripe.CheckoutGateway.prototype.update_checkout = function() {}
737
+
738
  /**
739
  * Called on the WC checkout_error event
740
  */
assets/js/frontend/wc-stripe.min.js CHANGED
@@ -1 +1 @@
1
- !function(t,e){t.wc_stripe={};var i=Stripe(wc_stripe_params.api_key);wc_stripe.BaseGateway=function(t){this.params=t,this.gateway_id=this.params.gateway_id,this.token_selector=this.params.token_selector,this.saved_method_selector=this.params.saved_method_selector,this.payment_intent_selector=this.params.payment_intent_selector,this.payment_token_received=!1,this.stripe=i,this.elements=i.elements(e.extend({},{locale:"auto"},this.get_element_options())),this.initialize()},wc_stripe.BaseGateway.prototype.set_nonce=function(t){e(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 e('[name="payment_method"]:checked').val()===this.gateway_id},wc_stripe.BaseGateway.prototype.is_saved_method_selected=function(){return this.is_gateway_selected()&&"saved"===e('[name="'+this.gateway_id+'_payment_type_key"]:checked').val()},wc_stripe.BaseGateway.prototype.has_checkout_error=function(){return e("#wc_stripe_checkout_error").length>0&&this.is_gateway_selected()},wc_stripe.BaseGateway.prototype.submit_error=function(t){-1==t.indexOf("</ul>")&&(t='<div class="woocommerce-error">'+t+"</div>"),this.submit_message(t)},wc_stripe.BaseGateway.prototype.submit_error_code=function(t){},wc_stripe.BaseGateway.prototype.submit_message=function(t){e(".woocommerce-error, .woocommerce-message, .woocommerce-info").remove();var i=e(this.message_container);i.closest("form").length&&(i=i.closest("form")),i.prepend(t),i.removeClass("processing").unblock(),i.find(".input-text, select, input:checkbox").blur(),e("html, body").animate({scrollTop:i.offset().top-100},1e3)},wc_stripe.BaseGateway.prototype.get_first_name=function(t){return e("#"+t+"_first_name").val()},wc_stripe.BaseGateway.prototype.get_last_name=function(t){return e("#"+t+"_last_name").val()},wc_stripe.BaseGateway.prototype.should_save_method=function(){return e("#"+this.gateway_id+"_save_source_key").is(":checked")},wc_stripe.BaseGateway.prototype.is_add_payment_method_page=function(){return e(document.body).hasClass("woocommerce-add-payment-method")},wc_stripe.BaseGateway.prototype.get_selected_payment_method=function(){return e(this.saved_method_selector).val()},wc_stripe.BaseGateway.prototype.needs_shipping=function(){return"1"===this.params.needs_shipping},wc_stripe.BaseGateway.prototype.get_currency=function(){return e("#wc_stripe_currency").val()},wc_stripe.BaseGateway.prototype.get_country=function(){return e("#wc_stripe_country").val()},wc_stripe.BaseGateway.prototype.get_customer_name=function(t){return e(t+"_first_name").val()+" "+e(t+"_last_name").val()},wc_stripe.BaseGateway.prototype.get_customer_email=function(){return e("#billing_email").val()},wc_stripe.BaseGateway.prototype.get_address_field_hash=function(t){for(var i=["_first_name","_last_name","_address_1","_address_2","_postcode","_city","_state","_country"],a="",n=0;n<i.length;n++)a+=e(t+i[n]).val()+"_";return a},wc_stripe.BaseGateway.prototype.block=function(){e.blockUI({message:null,overlayCSS:{background:"#fff",opacity:.6}})},wc_stripe.BaseGateway.prototype.unblock=function(){e.unblockUI()},wc_stripe.BaseGateway.prototype.get_form=function(){return e(this.token_selector).closest("form")},wc_stripe.BaseGateway.prototype.get_total_price=function(){return e("#wc_stripe_order_total").data("amount")},wc_stripe.BaseGateway.prototype.get_total_price_cents=function(){return e("#wc_stripe_order_total_cents").data("amount")},wc_stripe.BaseGateway.prototype.set_total_price=function(t){e("#wc_stripe_order_total").data("amount",t)},wc_stripe.BaseGateway.prototype.set_total_price_cents=function(t){e("#wc_stripe_order_total_cents").data("amount",t)},wc_stripe.BaseGateway.prototype.set_payment_method=function(t){e('[name="payment_method"][value="'+t+'"]').prop("checked",!0).trigger("click")},wc_stripe.BaseGateway.prototype.set_selected_shipping_methods=function(t){if(t&&e('[name^="shipping_method"]').length)for(var i in t){var a=t[i];e('[name="shipping_method['+i+']"][value="'+a+'"]').prop("checked",!0).trigger("change")}},wc_stripe.BaseGateway.prototype.on_token_received=function(t){this.payment_token_received=!0,e(this.token_selector).val(t.id),this.process_checkout()},wc_stripe.BaseGateway.prototype.createPaymentRequest=function(){this.paymentRequest=i.paymentRequest(this.get_payment_request_options()),this.needs_shipping()&&(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))},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:!0,requestPayerEmail:!0,requestPayerPhone:!0,requestShipping:this.needs_shipping()},e=this.get_display_items(),i=this.get_shipping_options();return e&&(t.displayItems=e),this.needs_shipping()&&i&&(t.shippingOptions=i),t},wc_stripe.BaseGateway.prototype.get_payment_request_update=function(t){var i={currency:this.get_currency().toLowerCase(),total:{amount:parseInt(this.get_total_price_cents()),label:this.params.total_label,pending:!0}},a=this.get_display_items(),n=this.get_shipping_options();return a&&(i.displayItems=a),this.needs_shipping()&&n&&(i.shippingOptions=n),t&&(i=e.extend(!0,{},i,t)),i},wc_stripe.BaseGateway.prototype.get_display_items=function(){return e("#wc_stripe_display_items").data("items")},wc_stripe.BaseGateway.prototype.set_display_items=function(t){e("#wc_stripe_display_items").data("items",t)},wc_stripe.BaseGateway.prototype.get_shipping_options=function(){return e("#wc_stripe_shipping_options").data("items")},wc_stripe.BaseGateway.prototype.set_shipping_options=function(t){e("#wc_stripe_shipping_options").data("items",t)},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(e){try{this.payment_response=e,this.populate_checkout_fields(e),e.complete("success"),this.on_token_received(e.paymentMethod)}catch(e){t.alert(e)}},wc_stripe.BaseGateway.prototype.populate_checkout_fields=function(t){e(this.token_selector).val(t.paymentMethod.id),this.populate_address_fields(t)},wc_stripe.BaseGateway.prototype.populate_address_fields=function(t){var i=this.address_mappings();if(t.payerName&&i.payerName.set(t.payerName),t.payerEmail&&i.payerEmail.set(t.payerEmail),t.payerPhone&&i.payerPhone.set(t.payerPhone),t.shippingAddress){var a=t.shippingAddress;for(var n in a)i[n]&&i[n].set.call(this,a[n],"#shipping")}if(t.paymentMethod.billing_details.address){a=t.paymentMethod.billing_details.address;for(var n in a)i[n]&&i[n].set.call(this,a[n],"#billing")}this.maybe_set_ship_to_different(),e('[name="billing_country"]').trigger("change")},wc_stripe.BaseGateway.prototype.address_mappings=function(){return{payerName:{set:function(t,i){var a=t.split(" ");a.length>0&&e("#billing_first_name").val(a[0]),a.length>1&&e("#billing_last_name").val(a[1])},get:function(t){return e("#billing_first_name").val()+" "+e("#billing_last_name").val()}},payerEmail:{set:function(t){e("#billing_email").val(t)},get:function(){return e("#billing_email").val()}},payerPhone:{set:function(t){e("#billing_phone").val(t)},get:function(){return e("#billing_phone").val()}},recipient:{set:function(t,i){var a=t.split(" ");a.length>0&&e(i+"_first_name").val(a[0]),a.length>1&&e(i+"_last_name").val(a[1])},get:function(t){return e(t+"_first_name").val()+" "+e(t+"_last_name").val()}},country:{set:function(t,i){e(i+"_country").val(t)},get:function(t){return e(t+"_country").val()}},addressLine:{set:function(t,i){t.length>0&&e(i+"_address_1").val(t[0]),t.length>1&&e(i+"_address_2").val(t[1])},get:function(t){return[e(t+"_address_1").val(),e(t+"_address_2").val()]}},line1:{set:function(t,i){e(i+"_address_1").val(t)},get:function(t){return e(t+"_address_1").val()}},line2:{set:function(t,i){e(i+"_address_2").val(t)},get:function(t){return e(t+"_address_2").val()}},region:{set:function(t,i){e(i+"_state").val(t)},get:function(t){e(t+"_state").val()}},state:{set:function(t,i){e(i+"_state").val(t)},get:function(t){e(t+"_state").val()}},city:{set:function(t,i){e(i+"_city").val(t)},get:function(t){e(t+"_city").val()}},postalCode:{set:function(t,i){e(i+"_postcode").val(t)},get:function(t){e(t+"_postcode").val()}},postal_code:{set:function(t,i){e(i+"_postcode").val(t)},get:function(t){e(t+"_postcode").val()}}}},wc_stripe.BaseGateway.prototype.process_checkout=function(){return new Promise(function(i,a){this.block(),e.ajax({url:this.params.routes.checkout,method:"POST",dataType:"json",data:e.extend({},this.serialize_form(this.get_form()),{payment_method:this.gateway_id}),beforeSend:function(t){t.setRequestHeader("X-WP-Nonce",this.params.rest_nonce)}.bind(this)}).done(function(e){e.reload?t.location.reload():"success"===e.result?t.location=e.redirect:(e.messages&&this.submit_error(e.messages),this.unblock())}.bind(this)).fail(function(t,e,i){this.unblock(),this.submit_error(i)}.bind(this))}.bind(this))},wc_stripe.BaseGateway.prototype.serialize_form=function(t){var i=t.find("input").filter(function(t,i){return!e(i).is('[name^="add-to-cart"]')}.bind(this)).serializeArray(),a={};for(var n in i){var s=i[n];a[s.name]=s.value}return a.payment_method=this.gateway_id,a},wc_stripe.BaseGateway.prototype.map_shipping_methods=function(t){var e={};if("default"!==t){var i=t.match(/^(\d):(.+)$/);i.length>1&&(e[i[1]]=i[2])}return e},wc_stripe.BaseGateway.prototype.maybe_set_ship_to_different=function(){e('[name="ship_to_different_address"]').length&&e('[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(t){return new Promise(function(i,a){e.ajax({url:this.params.routes.shipping_address,method:"POST",dataType:"json",data:{address:this.map_address(t.shippingAddress),payment_method:this.gateway_id},beforeSend:function(t){t.setRequestHeader("X-WP-Nonce",this.params.rest_nonce)}.bind(this)}).done(function(e){e.code?(t.updateWith(e.data.newData),a(e.data)):(t.updateWith(e.data.newData),i(e.data))}.bind(this)).fail(function(t,e,i){}.bind(this))}.bind(this))},wc_stripe.BaseGateway.prototype.update_shipping_method=function(t){return new Promise(function(i,a){e.ajax({url:this.params.routes.shipping_method,method:"POST",dataType:"json",data:{shipping_methods:this.map_shipping_methods(t.shippingOption.id),payment_method:this.gateway_id},beforeSend:function(t){t.setRequestHeader("X-WP-Nonce",this.params.rest_nonce)}.bind(this)}).done(function(e){e.code?(t.updateWith(e.data.newData),a(e.data)):(this.set_selected_shipping_methods(e.data.shipping_methods),t.updateWith(e.data.newData),i(e.data))}.bind(this)).fail(function(t,e,i){this.submit_error(i)}.bind(this))}.bind(this))},wc_stripe.CheckoutGateway=function(){this.container=this.message_container="li.payment_method_"+this.gateway_id,this.banner_container="li.banner_payment_method_"+this.gateway_id,e(document.body).on("updated_checkout",this.updated_checkout.bind(this)),e(document.body).on("checkout_error",this.checkout_error.bind(this)),e(this.token_selector).closest("form").on("checkout_place_order_"+this.gateway_id,this.checkout_place_order.bind(this)),e(document.body).on("wc_stripe_new_method_"+this.gateway_id,this.on_show_new_methods.bind(this)),e(document.body).on("wc_stripe_saved_method_"+this.gateway_id,this.on_show_saved_methods.bind(this)),e(document.body).on("wc_stripe_payment_method_selected",this.on_payment_method_selected.bind(this)),this.banner_enabled()&&e(".woocommerce-billing-fields").length&&e(this.banner_container).css("max-width",e(".woocommerce-billing-fields").outerWidth(!0)),this.order_review()},wc_stripe.CheckoutGateway.prototype.order_review=function(){var e=t.location.href.match(/order_review.+payment_method=([\w]+).+payment_nonce=(.+)/);if(e&&e.length>1){var i=e[1],a=e[2];this.gateway_id===i&&(this.payment_token_received=!0,this.set_nonce(a),this.set_use_new_option(!0))}},wc_stripe.CheckoutGateway.prototype.updated_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!(e('[name="terms"]').length&&!e('[name="terms"]').is(":checked"))},wc_stripe.CheckoutGateway.prototype.get_payment_method=function(){return e('[name="payment_method"]:checked').val()},wc_stripe.CheckoutGateway.prototype.set_use_new_option=function(t){e("#"+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,e(this.token_selector).val(t.id),this.hide_payment_button(),this.show_place_order()},wc_stripe.CheckoutGateway.prototype.block=function(){e("form.checkout").block({message:null,overlayCSS:{background:"#fff",opacity:.6}})},wc_stripe.CheckoutGateway.prototype.unblock=function(){e("form.checkout").unblock()},wc_stripe.CheckoutGateway.prototype.hide_place_order=function(){e("#place_order").addClass("wc-stripe-hide")},wc_stripe.CheckoutGateway.prototype.show_place_order=function(){e("#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,e('[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.ProductGateway=function(){this.container="li.payment_method_"+this.gateway_id,this.message_container="div.product",e(document.body).on("wc_stripe_updated_rest_nonce",this.set_rest_nonce.bind(this)),e("form.cart").on("found_variation",this.found_variation.bind(this)),e("form.cart").on("reset_data",this.reset_variation_data.bind(this)),this.buttonWidth=e("div.quantity").outerWidth(!0)+e(".single_add_to_cart_button").outerWidth(),e(this.container).css("max-width",this.buttonWidth+"px")},wc_stripe.ProductGateway.prototype.get_quantity=function(){return parseInt(e('[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_product_data();i.price=e.display_price,i.needs_shipping=!e.is_virtual,this.set_product_data(i),this.enable_payment_button()},wc_stripe.ProductGateway.prototype.reset_variation_data=function(){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 e('[name="variation_id"]').length>0},wc_stripe.ProductGateway.prototype.needs_shipping=function(){return this.get_product_data().needs_shipping},wc_stripe.ProductGateway.prototype.get_product_data=function(){return e("#wc_stripe_product_data").data("product")},wc_stripe.ProductGateway.prototype.set_product_data=function(t){e("#wc_stripe_product_data").data("product",t)},wc_stripe.ProductGateway.prototype.add_to_cart=function(){return new Promise(function(t,i){this.block(),e.ajax({url:this.params.routes.add_to_cart,method:"POST",dataType:"json",data:{product_id:e("#product_id").val(),variation_id:this.is_variable_product()?e('[name="variation_id"]').val():0,qty:e('[name="quantity"]').val(),payment_method:this.gateway_id},beforeSend:function(t){t.setRequestHeader("X-WP-Nonce",this.params.rest_nonce)}.bind(this)}).done(function(a,n,s){this.unblock(),e(document.body).triggerHandler("wc_stripe_updated_rest_nonce",s.getResponseHeader("X-WP-Nonce")),a.code?(this.submit_error(a.message),i(a)):(this.set_total_price(a.data.total),this.set_total_price_cents(a.data.totalCents),this.set_display_items(a.data.displayItems),t(a.data))}.bind(this)).fail(function(t,e,i){this.unblock(),this.submit_error(i)}.bind(this))}.bind(this))},wc_stripe.CartGateway=function(){this.container="li.payment_method_"+this.gateway_id,this.message_container="div.woocommerce",e(document.body).on("updated_wc_div",this.updated_html.bind(this)),e(document.body).on("updated_cart_totals",this.updated_html.bind(this))},wc_stripe.CartGateway.prototype.needs_shipping=function(){return 1===e("#wc_stripe_needs_shipping").data("value")},wc_stripe.CartGateway.prototype.submit_error=function(t){this.submit_message(t)},wc_stripe.CartGateway.prototype.updated_html=function(t){},wc_stripe.GooglePay=function(){};const a={apiVersion:2,apiVersionMinor:0},n={type:"CARD",parameters:{allowedAuthMethods:["PAN_ONLY"],allowedCardNetworks:["AMEX","DISCOVER","INTERAC","JCB","MASTERCARD","VISA"]}};wc_stripe.GooglePay.prototype.address_mappings=function(t){return{name:{set:function(t,i){var a=t.split(" ");e(i+"_first_name").val(a[0]),e(i+"_last_name").val(a[1])},get:function(t){return e(t+"_first_name").val()+e(t+"_last_name").val()}},postalCode:{set:function(t,i){e(i+"_postcode").val(t)},get:function(t){return e(t+"_postcode").val()}},countryCode:{set:function(t,i){e(i+"_country").val(t)},get:function(t){return e(t+"_country").val()}},phoneNumber:{set:function(t,i){e("#billing_phone").val(t)},get:function(){return"#billing_phone".val()}},address1:{set:function(t,i){e(i+"_address_1").val(t)},get:function(t){return e(t+"_address_1").val()}},address2:{set:function(t,i){e(i+"_address_2").val(t)},get:function(t){return e(t+"_address_2").val()}},locality:{set:function(t,i){e(i+"_city").val(t)},get:function(t){return e(t+"_city").val()}},administrativeArea:{set:function(t,i){e(i+"_state").val(t)},get:function(t){return e(t+"_state").val()}}}},wc_stripe.GooglePay.prototype.serialize_form=function(t){return e.extend({},wc_stripe.BaseGateway.prototype.serialize_form.apply(this,arguments),{order_review:!this.dynamic_price_enabled()})},wc_stripe.GooglePay.prototype.populate_address_fields=function(t){var i=t.paymentMethodData.info.billingAddress,a=this.address_mappings();for(var n in i)a[n]&&a[n].set.call(this,i[n],"#billing");if(t.shippingAddress)for(var n in t.shippingAddress)a[n]&&a[n].set.call(this,t.shippingAddress[n],"#shipping");t.email&&e("#billing_email").val(t.email),this.maybe_set_ship_to_different(),e('[name="billing_country"]').trigger("change")},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(t){return new Promise(function(i,a){e.when(e.ajax({url:this.params.routes.payment_data,dataType:"json",method:"POST",data:{shipping_address:this.map_address(t.shippingAddress),shipping_methods:this.map_shipping_methods(t.shippingOptionData.id),shipping_method_id:t.shippingOptionData.id},beforeSend:function(t){t.setRequestHeader("X-WP-Nonce",this.params.rest_nonce)}.bind(this)})).done(function(t){t.code?a(t.data.data):i(t.data)}.bind(this)).fail(function(){a()}.bind(this))}.bind(this))},wc_stripe.GooglePay.prototype.on_payment_data_changed=function(t){return new Promise(function(e,i){this.update_payment_data(t).then(function(i){e(i.paymentRequestUpdate),this.set_selected_shipping_methods(i.shipping_methods),this.payment_data_updated(i,t)}.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_googlepay_display_items=function(){return e("#googlepay_display_items").data("items")},wc_stripe.GooglePay.prototype.set_googlepay_display_items=function(t){e("#googlepay_display_items").data("items",t)},wc_stripe.GooglePay.prototype.get_shipping_options=function(){return e("#googlepay_shipping_options").data("items")},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.dynamic_price_enabled=function(){return"1"===this.params.dynamic_price},wc_stripe.GooglePay.prototype.get_payment_options=function(){var t={environment:this.params.environment,merchantInfo:this.get_merchant_info()};return this.dynamic_price_enabled()&&(this.needs_shipping()&&this.get_total_price_cents()>0?t.paymentDataCallbacks={onPaymentDataChanged:this.on_payment_data_changed.bind(this),onPaymentAuthorized:function(t){return new Promise(function(t,e){t({transactionState:"SUCCESS"})}.bind(this))}.bind(this)}:t.paymentDataCallbacks={onPaymentAuthorized:function(t){return new Promise(function(t,e){t({transactionState:"SUCCESS"})}.bind(this))}}),t},wc_stripe.GooglePay.prototype.build_payment_request=function(){var t=e.extend({},a,{emailRequired:!0,merchantInfo:this.get_merchant_info(),allowedPaymentMethods:[e.extend({type:"CARD",tokenizationSpecification:{type:"PAYMENT_GATEWAY",parameters:{gateway:"stripe","stripe:version":"2018-10-31","stripe:publishableKey":this.params.api_key}}},n)],shippingAddressRequired:this.needs_shipping()&&this.get_total_price_cents()>0,transactionInfo:{currencyCode:this.get_currency(),totalPriceStatus:"ESTIMATED",totalPrice:this.get_total_price().toString(),displayItems:this.get_googlepay_display_items(),totalPriceLabel:this.params.total_price_label}});return t.allowedPaymentMethods[0].parameters.billingAddressRequired=!0,t.allowedPaymentMethods[0].parameters.billingAddressParameters={format:"FULL",phoneNumberRequired:e("#billing_phone").length>0},this.dynamic_price_enabled()&&(this.needs_shipping()&&this.get_total_price_cents()>0?(t.shippingAddressParameters={},t.shippingOptionRequired=!0,t.shippingOptionParameters={shippingOptions:this.get_shipping_options()},t.callbackIntents=["SHIPPING_ADDRESS","SHIPPING_OPTION","PAYMENT_AUTHORIZATION"]):t.callbackIntents=["PAYMENT_AUTHORIZATION"]),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 i=e.extend({},a);i.allowedPaymentMethods=[n],this.paymentsClient.isReadyToPay(i).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=e(this.paymentsClient.createButton({onClick:this.start.bind(this),buttonColor:this.params.button_color,buttonType:this.params.button_style})),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.populate_address_fields(t),this.on_token_received(e)}.bind(this)).catch(function(t){"CANCELED"!==t.statusCode&&(t.statusMessage&&t.statusMessage.indexOf("paymentDataRequest.callbackIntent")>-1?this.submit_error_code("DEVELOPER_ERROR_WHITELIST"):this.submit_error(t.statusMessage))}.bind(this))},wc_stripe.ApplePay=function(){},wc_stripe.ApplePay.prototype.initialize=function(){e(document.body).on("click",".apple-pay-button",this.start.bind(this)),this.createPaymentRequest(),this.canMakePayment()},wc_stripe.ApplePay.prototype.create_button=function(){this.$button&&this.$button.remove(),this.$button=e(this.params.button),this.append_button()},wc_stripe.ApplePay.prototype.canMakePayment=function(){return new Promise(function(t,i){this.paymentRequest.canMakePayment().then(function(i){i&&i.applePay&&(this.can_pay=!0,this.create_button(),e(this.container).show(),t(i))}.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.canMakePayment(),this.paymentRequestButton=this.createPaymentRequestButton(),this.paymentRequestButton.on("click",this.button_click.bind(this))},wc_stripe.PaymentRequest.prototype.button_click=function(t){},wc_stripe.PaymentRequest.prototype.createPaymentRequestButton=function(){return 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(t,i){this.paymentRequest.canMakePayment().then(function(i){i&&!i.applePay&&(this.can_pay=!0,this.create_button(),e(this.container).show(),t(i))}.bind(this))}.bind(this))},wc_stripe.PaymentRequest.prototype.create_button=function(){this.paymentRequestButton.mount("#wc-stripe-payment-request-container")}}(window,jQuery);
1
+ !function(t,e){t.wc_stripe={};var i=Stripe(wc_stripe_params.api_key);wc_stripe.BaseGateway=function(t){this.params=t,this.gateway_id=this.params.gateway_id,this.token_selector=this.params.token_selector,this.saved_method_selector=this.params.saved_method_selector,this.payment_intent_selector=this.params.payment_intent_selector,this.payment_token_received=!1,this.stripe=i,this.elements=i.elements(e.extend({},{locale:"auto"},this.get_element_options())),this.initialize()},wc_stripe.BaseGateway.prototype.set_nonce=function(t){e(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 e('[name="payment_method"]:checked').val()===this.gateway_id},wc_stripe.BaseGateway.prototype.is_saved_method_selected=function(){return this.is_gateway_selected()&&"saved"===e('[name="'+this.gateway_id+'_payment_type_key"]:checked').val()},wc_stripe.BaseGateway.prototype.has_checkout_error=function(){return e("#wc_stripe_checkout_error").length>0&&this.is_gateway_selected()},wc_stripe.BaseGateway.prototype.submit_error=function(t){-1==t.indexOf("</ul>")&&(t='<div class="woocommerce-error">'+t+"</div>"),this.submit_message(t)},wc_stripe.BaseGateway.prototype.submit_error_code=function(t){},wc_stripe.BaseGateway.prototype.submit_message=function(t){e(".woocommerce-error, .woocommerce-message, .woocommerce-info").remove();var i=e(this.message_container);i.closest("form").length&&(i=i.closest("form")),i.prepend(t),i.removeClass("processing").unblock(),i.find(".input-text, select, input:checkbox").blur(),e("html, body").animate({scrollTop:i.offset().top-100},1e3)},wc_stripe.BaseGateway.prototype.get_first_name=function(t){return e("#"+t+"_first_name").val()},wc_stripe.BaseGateway.prototype.get_last_name=function(t){return e("#"+t+"_last_name").val()},wc_stripe.BaseGateway.prototype.should_save_method=function(){return e("#"+this.gateway_id+"_save_source_key").is(":checked")},wc_stripe.BaseGateway.prototype.is_add_payment_method_page=function(){return e(document.body).hasClass("woocommerce-add-payment-method")},wc_stripe.BaseGateway.prototype.get_selected_payment_method=function(){return e(this.saved_method_selector).val()},wc_stripe.BaseGateway.prototype.needs_shipping=function(){return"1"===this.params.needs_shipping},wc_stripe.BaseGateway.prototype.get_currency=function(){return e("#wc_stripe_currency").val()},wc_stripe.BaseGateway.prototype.get_country=function(){return e("#wc_stripe_country").val()},wc_stripe.BaseGateway.prototype.get_customer_name=function(t){return e(t+"_first_name").val()+" "+e(t+"_last_name").val()},wc_stripe.BaseGateway.prototype.get_customer_email=function(){return e("#billing_email").val()},wc_stripe.BaseGateway.prototype.get_address_field_hash=function(t){for(var i=["_first_name","_last_name","_address_1","_address_2","_postcode","_city","_state","_country"],a="",n=0;n<i.length;n++)a+=e(t+i[n]).val()+"_";return a},wc_stripe.BaseGateway.prototype.block=function(){e.blockUI({message:null,overlayCSS:{background:"#fff",opacity:.6}})},wc_stripe.BaseGateway.prototype.unblock=function(){e.unblockUI()},wc_stripe.BaseGateway.prototype.get_form=function(){return e(this.token_selector).closest("form")},wc_stripe.BaseGateway.prototype.get_total_price=function(){return e("#wc_stripe_order_total").data("amount")},wc_stripe.BaseGateway.prototype.get_total_price_cents=function(){return e("#wc_stripe_order_total_cents").data("amount")},wc_stripe.BaseGateway.prototype.set_total_price=function(t){e("#wc_stripe_order_total").data("amount",t)},wc_stripe.BaseGateway.prototype.set_total_price_cents=function(t){e("#wc_stripe_order_total_cents").data("amount",t)},wc_stripe.BaseGateway.prototype.set_payment_method=function(t){e('[name="payment_method"][value="'+t+'"]').prop("checked",!0).trigger("click")},wc_stripe.BaseGateway.prototype.set_selected_shipping_methods=function(t){if(t&&e('[name^="shipping_method"]').length)for(var i in t){var a=t[i];e('[name="shipping_method['+i+']"][value="'+a+'"]').prop("checked",!0).trigger("change")}},wc_stripe.BaseGateway.prototype.on_token_received=function(t){this.payment_token_received=!0,e(this.token_selector).val(t.id),this.process_checkout()},wc_stripe.BaseGateway.prototype.createPaymentRequest=function(){this.paymentRequest=i.paymentRequest(this.get_payment_request_options()),this.needs_shipping()&&(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))},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:!0,requestPayerEmail:!0,requestPayerPhone:!0,requestShipping:this.needs_shipping()},e=this.get_display_items(),i=this.get_shipping_options();return e&&(t.displayItems=e),this.needs_shipping()&&i&&(t.shippingOptions=i),t},wc_stripe.BaseGateway.prototype.get_payment_request_update=function(t){var i={currency:this.get_currency().toLowerCase(),total:{amount:parseInt(this.get_total_price_cents()),label:this.params.total_label,pending:!0}},a=this.get_display_items(),n=this.get_shipping_options();return a&&(i.displayItems=a),this.needs_shipping()&&n&&(i.shippingOptions=n),t&&(i=e.extend(!0,{},i,t)),i},wc_stripe.BaseGateway.prototype.get_display_items=function(){return e("#wc_stripe_display_items").data("items")},wc_stripe.BaseGateway.prototype.set_display_items=function(t){e("#wc_stripe_display_items").data("items",t)},wc_stripe.BaseGateway.prototype.get_shipping_options=function(){return e("#wc_stripe_shipping_options").data("items")},wc_stripe.BaseGateway.prototype.set_shipping_options=function(t){e("#wc_stripe_shipping_options").data("items",t)},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(e){try{this.payment_response=e,this.populate_checkout_fields(e),e.complete("success"),this.on_token_received(e.paymentMethod)}catch(e){t.alert(e)}},wc_stripe.BaseGateway.prototype.populate_checkout_fields=function(t){e(this.token_selector).val(t.paymentMethod.id),this.populate_address_fields(t)},wc_stripe.BaseGateway.prototype.populate_address_fields=function(t){var i=this.address_mappings();if(t.payerName&&i.payerName.set(t.payerName),t.payerEmail&&i.payerEmail.set(t.payerEmail),t.payerPhone&&i.payerPhone.set(t.payerPhone),t.shippingAddress){var a=t.shippingAddress;for(var n in a)i[n]&&i[n].set.call(this,a[n],"#shipping")}if(t.paymentMethod.billing_details.address){a=t.paymentMethod.billing_details.address;for(var n in a)i[n]&&i[n].set.call(this,a[n],"#billing")}this.maybe_set_ship_to_different(),e('[name="billing_country"]').trigger("change")},wc_stripe.BaseGateway.prototype.address_mappings=function(){return{payerName:{set:function(t,i){var a=t.split(" ");a.length>0&&e("#billing_first_name").val(a[0]),a.length>1&&e("#billing_last_name").val(a[1])},get:function(t){return e("#billing_first_name").val()+" "+e("#billing_last_name").val()}},payerEmail:{set:function(t){e("#billing_email").val(t)},get:function(){return e("#billing_email").val()}},payerPhone:{set:function(t){e("#billing_phone").val(t)},get:function(){return e("#billing_phone").val()}},recipient:{set:function(t,i){var a=t.split(" ");a.length>0&&e(i+"_first_name").val(a[0]),a.length>1&&e(i+"_last_name").val(a[1])},get:function(t){return e(t+"_first_name").val()+" "+e(t+"_last_name").val()}},country:{set:function(t,i){e(i+"_country").val(t)},get:function(t){return e(t+"_country").val()}},addressLine:{set:function(t,i){t.length>0&&e(i+"_address_1").val(t[0]),t.length>1&&e(i+"_address_2").val(t[1])},get:function(t){return[e(t+"_address_1").val(),e(t+"_address_2").val()]}},line1:{set:function(t,i){e(i+"_address_1").val(t)},get:function(t){return e(t+"_address_1").val()}},line2:{set:function(t,i){e(i+"_address_2").val(t)},get:function(t){return e(t+"_address_2").val()}},region:{set:function(t,i){e(i+"_state").val(t)},get:function(t){e(t+"_state").val()}},state:{set:function(t,i){e(i+"_state").val(t)},get:function(t){e(t+"_state").val()}},city:{set:function(t,i){e(i+"_city").val(t)},get:function(t){e(t+"_city").val()}},postalCode:{set:function(t,i){e(i+"_postcode").val(t)},get:function(t){e(t+"_postcode").val()}},postal_code:{set:function(t,i){e(i+"_postcode").val(t)},get:function(t){e(t+"_postcode").val()}}}},wc_stripe.BaseGateway.prototype.process_checkout=function(){return new Promise(function(i,a){this.block(),e.ajax({url:this.params.routes.checkout,method:"POST",dataType:"json",data:e.extend({},this.serialize_form(this.get_form()),{payment_method:this.gateway_id}),beforeSend:function(t){t.setRequestHeader("X-WP-Nonce",this.params.rest_nonce)}.bind(this)}).done(function(e){e.reload?t.location.reload():"success"===e.result?t.location=e.redirect:(e.messages&&this.submit_error(e.messages),this.unblock())}.bind(this)).fail(function(t,e,i){this.unblock(),this.submit_error(i)}.bind(this))}.bind(this))},wc_stripe.BaseGateway.prototype.serialize_form=function(t){var i=t.find("input").filter(function(t,i){return!e(i).is('[name^="add-to-cart"]')}.bind(this)).serializeArray(),a={};for(var n in i){var s=i[n];a[s.name]=s.value}return a.payment_method=this.gateway_id,a},wc_stripe.BaseGateway.prototype.map_shipping_methods=function(t){var e={};if("default"!==t){var i=t.match(/^(\d):(.+)$/);i.length>1&&(e[i[1]]=i[2])}return e},wc_stripe.BaseGateway.prototype.maybe_set_ship_to_different=function(){e('[name="ship_to_different_address"]').length&&e('[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(t){return new Promise(function(i,a){e.ajax({url:this.params.routes.shipping_address,method:"POST",dataType:"json",data:{address:this.map_address(t.shippingAddress),payment_method:this.gateway_id},beforeSend:function(t){t.setRequestHeader("X-WP-Nonce",this.params.rest_nonce)}.bind(this)}).done(function(e){e.code?(t.updateWith(e.data.newData),a(e.data)):(t.updateWith(e.data.newData),i(e.data))}.bind(this)).fail(function(t,e,i){}.bind(this))}.bind(this))},wc_stripe.BaseGateway.prototype.update_shipping_method=function(t){return new Promise(function(i,a){e.ajax({url:this.params.routes.shipping_method,method:"POST",dataType:"json",data:{shipping_methods:this.map_shipping_methods(t.shippingOption.id),payment_method:this.gateway_id},beforeSend:function(t){t.setRequestHeader("X-WP-Nonce",this.params.rest_nonce)}.bind(this)}).done(function(e){e.code?(t.updateWith(e.data.newData),a(e.data)):(this.set_selected_shipping_methods(e.data.shipping_methods),t.updateWith(e.data.newData),i(e.data))}.bind(this)).fail(function(t,e,i){this.submit_error(i)}.bind(this))}.bind(this))},wc_stripe.CheckoutGateway=function(){this.container=this.message_container="li.payment_method_"+this.gateway_id,this.banner_container="li.banner_payment_method_"+this.gateway_id,e(document.body).on("update_checkout",this.update_checkout.bind(this)),e(document.body).on("updated_checkout",this.updated_checkout.bind(this)),e(document.body).on("checkout_error",this.checkout_error.bind(this)),e(this.token_selector).closest("form").on("checkout_place_order_"+this.gateway_id,this.checkout_place_order.bind(this)),e(document.body).on("wc_stripe_new_method_"+this.gateway_id,this.on_show_new_methods.bind(this)),e(document.body).on("wc_stripe_saved_method_"+this.gateway_id,this.on_show_saved_methods.bind(this)),e(document.body).on("wc_stripe_payment_method_selected",this.on_payment_method_selected.bind(this)),this.banner_enabled()&&e(".woocommerce-billing-fields").length&&e(this.banner_container).css("max-width",e(".woocommerce-billing-fields").outerWidth(!0)),this.order_review()},wc_stripe.CheckoutGateway.prototype.order_review=function(){var e=t.location.href.match(/order_review.+payment_method=([\w]+).+payment_nonce=(.+)/);if(e&&e.length>1){var i=e[1],a=e[2];this.gateway_id===i&&(this.payment_token_received=!0,this.set_nonce(a),this.set_use_new_option(!0))}},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!(e('[name="terms"]').length&&!e('[name="terms"]').is(":checked"))},wc_stripe.CheckoutGateway.prototype.get_payment_method=function(){return e('[name="payment_method"]:checked').val()},wc_stripe.CheckoutGateway.prototype.set_use_new_option=function(t){e("#"+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,e(this.token_selector).val(t.id),this.hide_payment_button(),this.show_place_order()},wc_stripe.CheckoutGateway.prototype.block=function(){e("form.checkout").block({message:null,overlayCSS:{background:"#fff",opacity:.6}})},wc_stripe.CheckoutGateway.prototype.unblock=function(){e("form.checkout").unblock()},wc_stripe.CheckoutGateway.prototype.hide_place_order=function(){e("#place_order").addClass("wc-stripe-hide")},wc_stripe.CheckoutGateway.prototype.show_place_order=function(){e("#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,e('[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.ProductGateway=function(){this.container="li.payment_method_"+this.gateway_id,this.message_container="div.product",e(document.body).on("wc_stripe_updated_rest_nonce",this.set_rest_nonce.bind(this)),e("form.cart").on("found_variation",this.found_variation.bind(this)),e("form.cart").on("reset_data",this.reset_variation_data.bind(this)),this.buttonWidth=e("div.quantity").outerWidth(!0)+e(".single_add_to_cart_button").outerWidth(),e(this.container).css("max-width",this.buttonWidth+"px")},wc_stripe.ProductGateway.prototype.get_quantity=function(){return parseInt(e('[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_product_data();i.price=e.display_price,i.needs_shipping=!e.is_virtual,this.set_product_data(i),this.enable_payment_button()},wc_stripe.ProductGateway.prototype.reset_variation_data=function(){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 e('[name="variation_id"]').length>0},wc_stripe.ProductGateway.prototype.needs_shipping=function(){return this.get_product_data().needs_shipping},wc_stripe.ProductGateway.prototype.get_product_data=function(){return e("#wc_stripe_product_data").data("product")},wc_stripe.ProductGateway.prototype.set_product_data=function(t){e("#wc_stripe_product_data").data("product",t)},wc_stripe.ProductGateway.prototype.add_to_cart=function(){return new Promise(function(t,i){this.block(),e.ajax({url:this.params.routes.add_to_cart,method:"POST",dataType:"json",data:{product_id:e("#product_id").val(),variation_id:this.is_variable_product()?e('[name="variation_id"]').val():0,qty:e('[name="quantity"]').val(),payment_method:this.gateway_id},beforeSend:function(t){t.setRequestHeader("X-WP-Nonce",this.params.rest_nonce)}.bind(this)}).done(function(a,n,s){this.unblock(),e(document.body).triggerHandler("wc_stripe_updated_rest_nonce",s.getResponseHeader("X-WP-Nonce")),a.code?(this.submit_error(a.message),i(a)):(this.set_total_price(a.data.total),this.set_total_price_cents(a.data.totalCents),this.set_display_items(a.data.displayItems),t(a.data))}.bind(this)).fail(function(t,e,i){this.unblock(),this.submit_error(i)}.bind(this))}.bind(this))},wc_stripe.CartGateway=function(){this.container="li.payment_method_"+this.gateway_id,this.message_container="div.woocommerce",e(document.body).on("updated_wc_div",this.updated_html.bind(this)),e(document.body).on("updated_cart_totals",this.updated_html.bind(this))},wc_stripe.CartGateway.prototype.needs_shipping=function(){return 1===e("#wc_stripe_needs_shipping").data("value")},wc_stripe.CartGateway.prototype.submit_error=function(t){this.submit_message(t)},wc_stripe.CartGateway.prototype.updated_html=function(t){},wc_stripe.GooglePay=function(){};const a={apiVersion:2,apiVersionMinor:0},n={type:"CARD",parameters:{allowedAuthMethods:["PAN_ONLY"],allowedCardNetworks:["AMEX","DISCOVER","INTERAC","JCB","MASTERCARD","VISA"]}};wc_stripe.GooglePay.prototype.address_mappings=function(t){return{name:{set:function(t,i){var a=t.split(" ");e(i+"_first_name").val(a[0]),e(i+"_last_name").val(a[1])},get:function(t){return e(t+"_first_name").val()+e(t+"_last_name").val()}},postalCode:{set:function(t,i){e(i+"_postcode").val(t)},get:function(t){return e(t+"_postcode").val()}},countryCode:{set:function(t,i){e(i+"_country").val(t)},get:function(t){return e(t+"_country").val()}},phoneNumber:{set:function(t,i){e("#billing_phone").val(t)},get:function(){return"#billing_phone".val()}},address1:{set:function(t,i){e(i+"_address_1").val(t)},get:function(t){return e(t+"_address_1").val()}},address2:{set:function(t,i){e(i+"_address_2").val(t)},get:function(t){return e(t+"_address_2").val()}},locality:{set:function(t,i){e(i+"_city").val(t)},get:function(t){return e(t+"_city").val()}},administrativeArea:{set:function(t,i){e(i+"_state").val(t)},get:function(t){return e(t+"_state").val()}}}},wc_stripe.GooglePay.prototype.serialize_form=function(t){return e.extend({},wc_stripe.BaseGateway.prototype.serialize_form.apply(this,arguments),{order_review:!this.dynamic_price_enabled()})},wc_stripe.GooglePay.prototype.populate_address_fields=function(t){var i=t.paymentMethodData.info.billingAddress,a=this.address_mappings();for(var n in i)a[n]&&a[n].set.call(this,i[n],"#billing");if(t.shippingAddress)for(var n in t.shippingAddress)a[n]&&a[n].set.call(this,t.shippingAddress[n],"#shipping");t.email&&e("#billing_email").val(t.email),this.maybe_set_ship_to_different(),e('[name="billing_country"]').trigger("change")},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(t){return new Promise(function(i,a){e.when(e.ajax({url:this.params.routes.payment_data,dataType:"json",method:"POST",data:{shipping_address:this.map_address(t.shippingAddress),shipping_methods:this.map_shipping_methods(t.shippingOptionData.id),shipping_method_id:t.shippingOptionData.id},beforeSend:function(t){t.setRequestHeader("X-WP-Nonce",this.params.rest_nonce)}.bind(this)})).done(function(t){t.code?a(t.data.data):i(t.data)}.bind(this)).fail(function(){a()}.bind(this))}.bind(this))},wc_stripe.GooglePay.prototype.on_payment_data_changed=function(t){return new Promise(function(e,i){this.update_payment_data(t).then(function(i){e(i.paymentRequestUpdate),this.set_selected_shipping_methods(i.shipping_methods),this.payment_data_updated(i,t)}.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_googlepay_display_items=function(){return e("#googlepay_display_items").data("items")},wc_stripe.GooglePay.prototype.set_googlepay_display_items=function(t){e("#googlepay_display_items").data("items",t)},wc_stripe.GooglePay.prototype.get_shipping_options=function(){return e("#googlepay_shipping_options").data("items")},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.dynamic_price_enabled=function(){return"1"===this.params.dynamic_price},wc_stripe.GooglePay.prototype.get_payment_options=function(){var t={environment:this.params.environment,merchantInfo:this.get_merchant_info()};return this.dynamic_price_enabled()&&(this.needs_shipping()&&this.get_total_price_cents()>0?t.paymentDataCallbacks={onPaymentDataChanged:this.on_payment_data_changed.bind(this),onPaymentAuthorized:function(t){return new Promise(function(t,e){t({transactionState:"SUCCESS"})}.bind(this))}.bind(this)}:t.paymentDataCallbacks={onPaymentAuthorized:function(t){return new Promise(function(t,e){t({transactionState:"SUCCESS"})}.bind(this))}}),t},wc_stripe.GooglePay.prototype.build_payment_request=function(){var t=e.extend({},a,{emailRequired:!0,merchantInfo:this.get_merchant_info(),allowedPaymentMethods:[e.extend({type:"CARD",tokenizationSpecification:{type:"PAYMENT_GATEWAY",parameters:{gateway:"stripe","stripe:version":"2018-10-31","stripe:publishableKey":this.params.api_key}}},n)],shippingAddressRequired:this.needs_shipping()&&this.get_total_price_cents()>0,transactionInfo:{currencyCode:this.get_currency(),totalPriceStatus:"ESTIMATED",totalPrice:this.get_total_price().toString(),displayItems:this.get_googlepay_display_items(),totalPriceLabel:this.params.total_price_label}});return t.allowedPaymentMethods[0].parameters.billingAddressRequired=!0,t.allowedPaymentMethods[0].parameters.billingAddressParameters={format:"FULL",phoneNumberRequired:e("#billing_phone").length>0},this.dynamic_price_enabled()&&(this.needs_shipping()&&this.get_total_price_cents()>0?(t.shippingAddressParameters={},t.shippingOptionRequired=!0,t.shippingOptionParameters={shippingOptions:this.get_shipping_options()},t.callbackIntents=["SHIPPING_ADDRESS","SHIPPING_OPTION","PAYMENT_AUTHORIZATION"]):t.callbackIntents=["PAYMENT_AUTHORIZATION"]),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 i=e.extend({},a);i.allowedPaymentMethods=[n],this.paymentsClient.isReadyToPay(i).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=e(this.paymentsClient.createButton({onClick:this.start.bind(this),buttonColor:this.params.button_color,buttonType:this.params.button_style})),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.populate_address_fields(t),this.on_token_received(e)}.bind(this)).catch(function(t){"CANCELED"!==t.statusCode&&(t.statusMessage&&t.statusMessage.indexOf("paymentDataRequest.callbackIntent")>-1?this.submit_error_code("DEVELOPER_ERROR_WHITELIST"):this.submit_error(t.statusMessage))}.bind(this))},wc_stripe.ApplePay=function(){},wc_stripe.ApplePay.prototype.initialize=function(){e(document.body).on("click",".apple-pay-button",this.start.bind(this)),this.createPaymentRequest(),this.canMakePayment()},wc_stripe.ApplePay.prototype.create_button=function(){this.$button&&this.$button.remove(),this.$button=e(this.params.button),this.append_button()},wc_stripe.ApplePay.prototype.canMakePayment=function(){return new Promise(function(t,i){this.paymentRequest.canMakePayment().then(function(i){i&&i.applePay&&(this.can_pay=!0,this.create_button(),e(this.container).show(),t(i))}.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.canMakePayment(),this.paymentRequestButton=this.createPaymentRequestButton(),this.paymentRequestButton.on("click",this.button_click.bind(this))},wc_stripe.PaymentRequest.prototype.button_click=function(t){},wc_stripe.PaymentRequest.prototype.createPaymentRequestButton=function(){return 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(t,i){this.paymentRequest.canMakePayment().then(function(i){i&&!i.applePay&&(this.can_pay=!0,this.create_button(),e(this.container).show(),t(i))}.bind(this))}.bind(this))},wc_stripe.PaymentRequest.prototype.create_button=function(){this.paymentRequestButton.mount("#wc-stripe-payment-request-container")}}(window,jQuery);
i18n/languages/woo-stripe-payment.pot CHANGED
@@ -2,7 +2,7 @@
2
  msgid ""
3
  msgstr ""
4
  "Project-Id-Version: woo-stripe-payment\n"
5
- "POT-Creation-Date: 2019-11-25 13:29-0800\n"
6
  "PO-Revision-Date: 2019-08-16 14:27-0700\n"
7
  "Last-Translator: \n"
8
  "Language-Team: \n"
@@ -19,77 +19,79 @@ msgstr ""
19
  "X-Poedit-SearchPath-2: stripe-payments.php\n"
20
 
21
  #: includes/abstract/abstract-wc-payment-gateway-stripe-charge.php:64
 
 
22
  #, php-format
23
  msgid "Error processing payment. Reason: %s"
24
  msgstr ""
25
 
26
- #: includes/abstract/abstract-wc-payment-gateway-stripe-charge.php:65
27
  #, php-format
28
  msgid "Error processing payment. Reason: %s. Code: %s"
29
  msgstr ""
30
 
31
- #: includes/abstract/abstract-wc-payment-gateway-stripe-charge.php:76
32
  #, php-format
33
  msgid "Order charge successful in Stripe. Charge: %s. Payment Method: %s"
34
  msgstr ""
35
 
36
- #: includes/abstract/abstract-wc-payment-gateway-stripe-charge.php:120
37
- #: includes/abstract/abstract-wc-payment-gateway-stripe-payment-intent.php:192
38
  #, php-format
39
  msgid "Order amount captured in Stripe. Amount: %s"
40
  msgstr ""
41
 
42
- #: includes/abstract/abstract-wc-payment-gateway-stripe-charge.php:124
43
- #: includes/abstract/abstract-wc-payment-gateway-stripe-payment-intent.php:196
44
  #, php-format
45
  msgid "Error capturing charge in Stripe. Reason: %s"
46
  msgstr ""
47
 
48
- #: includes/abstract/abstract-wc-payment-gateway-stripe-charge.php:136
49
- #: includes/abstract/abstract-wc-payment-gateway-stripe-payment-intent.php:217
50
  #, php-format
51
  msgid "Error voiding charge. Reason: %s"
52
  msgstr ""
53
 
54
- #: includes/abstract/abstract-wc-payment-gateway-stripe-charge.php:138
55
- #: includes/abstract/abstract-wc-payment-gateway-stripe-payment-intent.php:219
56
  msgid "Charge voided in Stripe."
57
  msgstr ""
58
 
59
- #: includes/abstract/abstract-wc-payment-gateway-stripe-charge.php:165
60
  #, php-format
61
  msgid ""
62
  "Recurring payment for subscription failed. Reason: %s. Payment method: %s"
63
  msgstr ""
64
 
65
- #: includes/abstract/abstract-wc-payment-gateway-stripe-charge.php:169
66
- #: includes/abstract/abstract-wc-payment-gateway-stripe-payment-intent.php:258
67
  #, php-format
68
  msgid "Recurring payment captured in Stripe. Payment method: %s"
69
  msgstr ""
70
 
71
- #: includes/abstract/abstract-wc-payment-gateway-stripe-charge.php:171
72
- #: includes/abstract/abstract-wc-payment-gateway-stripe-charge.php:209
73
- #: includes/abstract/abstract-wc-payment-gateway-stripe-payment-intent.php:260
74
- #: includes/abstract/abstract-wc-payment-gateway-stripe-payment-intent.php:326
75
  #, php-format
76
  msgid "Recurring payment authorized in Stripe. Payment method: %s"
77
  msgstr ""
78
 
79
- #: includes/abstract/abstract-wc-payment-gateway-stripe-charge.php:183
80
- #: includes/abstract/abstract-wc-payment-gateway-stripe-payment-intent.php:292
81
  #, php-format
82
  msgid "Error deleting Stripe card. Token Id: %s"
83
  msgstr ""
84
 
85
- #: includes/abstract/abstract-wc-payment-gateway-stripe-charge.php:203
86
  #, php-format
87
  msgid ""
88
  "Pre-order payment for subscription failed. Reason: %s. Payment method: %s"
89
  msgstr ""
90
 
91
- #: includes/abstract/abstract-wc-payment-gateway-stripe-charge.php:207
92
- #: includes/abstract/abstract-wc-payment-gateway-stripe-payment-intent.php:324
93
  #, php-format
94
  msgid "Pre-order payment captured in Stripe. Payment method: %s"
95
  msgstr ""
@@ -114,35 +116,35 @@ msgstr ""
114
  msgid " & billing country is <strong>%s</strong>"
115
  msgstr ""
116
 
117
- #: includes/abstract/abstract-wc-payment-gateway-stripe-payment-intent.php:86
118
  #, php-format
119
  msgid "Order %s successful in Stripe. Charge: %s. Payment Method: %s"
120
  msgstr ""
121
 
122
- #: includes/abstract/abstract-wc-payment-gateway-stripe-payment-intent.php:86
123
  msgid "charge"
124
  msgstr ""
125
 
126
- #: includes/abstract/abstract-wc-payment-gateway-stripe-payment-intent.php:86
127
  msgid "authorization"
128
  msgstr ""
129
 
130
- #: includes/abstract/abstract-wc-payment-gateway-stripe-payment-intent.php:114
131
  msgid "A new payment method is required."
132
  msgstr ""
133
 
134
- #: includes/abstract/abstract-wc-payment-gateway-stripe-payment-intent.php:247
135
  #, php-format
136
  msgid "Recurring payment for order failed. Reason: %s"
137
  msgstr ""
138
 
139
- #: includes/abstract/abstract-wc-payment-gateway-stripe-payment-intent.php:264
140
- #: includes/abstract/abstract-wc-payment-gateway-stripe-payment-intent.php:330
141
  #, php-format
142
  msgid "Customer must manually complete payment for payment method %s"
143
  msgstr ""
144
 
145
- #: includes/abstract/abstract-wc-payment-gateway-stripe-payment-intent.php:313
146
  #, php-format
147
  msgid "Pre-order payment for order failed. Reason: %s"
148
  msgstr ""
@@ -329,6 +331,7 @@ msgid "Type"
329
  msgstr ""
330
 
331
  #: includes/admin/meta-boxes/views/html-charge-data-subview.php:56
 
332
  msgid "Exp"
333
  msgstr ""
334
 
@@ -457,9 +460,11 @@ msgid "Webhook Secret"
457
  msgstr ""
458
 
459
  #: includes/admin/settings/class-wc-stripe-api-settings.php:92
 
460
  msgid ""
461
  "The webhook secret is used to authenticate webhooks sent from Stripe. It "
462
- "ensures no 3rd party can send you events, pretending to be Stripe."
 
463
  msgstr ""
464
 
465
  #: includes/admin/settings/class-wc-stripe-api-settings.php:95
@@ -1489,14 +1494,18 @@ msgid "Please enter a valid postcode / ZIP."
1489
  msgstr ""
1490
 
1491
  #: includes/wc-stripe-functions.php:638
 
 
 
 
1492
  msgid "Simple form"
1493
  msgstr ""
1494
 
1495
- #: includes/wc-stripe-functions.php:671
1496
  msgid "Inline Form"
1497
  msgstr ""
1498
 
1499
- #: includes/wc-stripe-functions.php:707
1500
  msgid "Rounded Form"
1501
  msgstr ""
1502
 
@@ -1509,22 +1518,25 @@ msgstr ""
1509
  msgid "or"
1510
  msgstr ""
1511
 
1512
- #: templates/cc-forms/inline.php:10 templates/cc-forms/simple.php:12
 
1513
  msgid "Card Number"
1514
  msgstr ""
1515
 
1516
- #: templates/cc-forms/inline.php:14
1517
- msgid "Exp Date"
1518
- msgstr ""
1519
-
1520
- #: templates/cc-forms/inline.php:18 templates/cc-forms/simple.php:26
1521
  msgid "CVC"
1522
  msgstr ""
1523
 
1524
- #: templates/cc-forms/inline.php:23 templates/cc-forms/simple.php:34
 
1525
  msgid "ZIP"
1526
  msgstr ""
1527
 
 
 
 
 
1528
  #: templates/cc-forms/simple.php:20
1529
  msgid "Expiration"
1530
  msgstr ""
2
  msgid ""
3
  msgstr ""
4
  "Project-Id-Version: woo-stripe-payment\n"
5
+ "POT-Creation-Date: 2019-12-05 13:48-0800\n"
6
  "PO-Revision-Date: 2019-08-16 14:27-0700\n"
7
  "Last-Translator: \n"
8
  "Language-Team: \n"
19
  "X-Poedit-SearchPath-2: stripe-payments.php\n"
20
 
21
  #: includes/abstract/abstract-wc-payment-gateway-stripe-charge.php:64
22
+ #: includes/abstract/abstract-wc-payment-gateway-stripe-payment-intent.php:53
23
+ #: includes/abstract/abstract-wc-payment-gateway-stripe-payment-intent.php:71
24
  #, php-format
25
  msgid "Error processing payment. Reason: %s"
26
  msgstr ""
27
 
28
+ #: includes/abstract/abstract-wc-payment-gateway-stripe-charge.php:66
29
  #, php-format
30
  msgid "Error processing payment. Reason: %s. Code: %s"
31
  msgstr ""
32
 
33
+ #: includes/abstract/abstract-wc-payment-gateway-stripe-charge.php:77
34
  #, php-format
35
  msgid "Order charge successful in Stripe. Charge: %s. Payment Method: %s"
36
  msgstr ""
37
 
38
+ #: includes/abstract/abstract-wc-payment-gateway-stripe-charge.php:121
39
+ #: includes/abstract/abstract-wc-payment-gateway-stripe-payment-intent.php:196
40
  #, php-format
41
  msgid "Order amount captured in Stripe. Amount: %s"
42
  msgstr ""
43
 
44
+ #: includes/abstract/abstract-wc-payment-gateway-stripe-charge.php:125
45
+ #: includes/abstract/abstract-wc-payment-gateway-stripe-payment-intent.php:200
46
  #, php-format
47
  msgid "Error capturing charge in Stripe. Reason: %s"
48
  msgstr ""
49
 
50
+ #: includes/abstract/abstract-wc-payment-gateway-stripe-charge.php:137
51
+ #: includes/abstract/abstract-wc-payment-gateway-stripe-payment-intent.php:221
52
  #, php-format
53
  msgid "Error voiding charge. Reason: %s"
54
  msgstr ""
55
 
56
+ #: includes/abstract/abstract-wc-payment-gateway-stripe-charge.php:139
57
+ #: includes/abstract/abstract-wc-payment-gateway-stripe-payment-intent.php:223
58
  msgid "Charge voided in Stripe."
59
  msgstr ""
60
 
61
+ #: includes/abstract/abstract-wc-payment-gateway-stripe-charge.php:166
62
  #, php-format
63
  msgid ""
64
  "Recurring payment for subscription failed. Reason: %s. Payment method: %s"
65
  msgstr ""
66
 
67
+ #: includes/abstract/abstract-wc-payment-gateway-stripe-charge.php:170
68
+ #: includes/abstract/abstract-wc-payment-gateway-stripe-payment-intent.php:262
69
  #, php-format
70
  msgid "Recurring payment captured in Stripe. Payment method: %s"
71
  msgstr ""
72
 
73
+ #: includes/abstract/abstract-wc-payment-gateway-stripe-charge.php:172
74
+ #: includes/abstract/abstract-wc-payment-gateway-stripe-charge.php:210
75
+ #: includes/abstract/abstract-wc-payment-gateway-stripe-payment-intent.php:264
76
+ #: includes/abstract/abstract-wc-payment-gateway-stripe-payment-intent.php:330
77
  #, php-format
78
  msgid "Recurring payment authorized in Stripe. Payment method: %s"
79
  msgstr ""
80
 
81
+ #: includes/abstract/abstract-wc-payment-gateway-stripe-charge.php:184
82
+ #: includes/abstract/abstract-wc-payment-gateway-stripe-payment-intent.php:296
83
  #, php-format
84
  msgid "Error deleting Stripe card. Token Id: %s"
85
  msgstr ""
86
 
87
+ #: includes/abstract/abstract-wc-payment-gateway-stripe-charge.php:204
88
  #, php-format
89
  msgid ""
90
  "Pre-order payment for subscription failed. Reason: %s. Payment method: %s"
91
  msgstr ""
92
 
93
+ #: includes/abstract/abstract-wc-payment-gateway-stripe-charge.php:208
94
+ #: includes/abstract/abstract-wc-payment-gateway-stripe-payment-intent.php:328
95
  #, php-format
96
  msgid "Pre-order payment captured in Stripe. Payment method: %s"
97
  msgstr ""
116
  msgid " & billing country is <strong>%s</strong>"
117
  msgstr ""
118
 
119
+ #: includes/abstract/abstract-wc-payment-gateway-stripe-payment-intent.php:90
120
  #, php-format
121
  msgid "Order %s successful in Stripe. Charge: %s. Payment Method: %s"
122
  msgstr ""
123
 
124
+ #: includes/abstract/abstract-wc-payment-gateway-stripe-payment-intent.php:90
125
  msgid "charge"
126
  msgstr ""
127
 
128
+ #: includes/abstract/abstract-wc-payment-gateway-stripe-payment-intent.php:90
129
  msgid "authorization"
130
  msgstr ""
131
 
132
+ #: includes/abstract/abstract-wc-payment-gateway-stripe-payment-intent.php:118
133
  msgid "A new payment method is required."
134
  msgstr ""
135
 
136
+ #: includes/abstract/abstract-wc-payment-gateway-stripe-payment-intent.php:251
137
  #, php-format
138
  msgid "Recurring payment for order failed. Reason: %s"
139
  msgstr ""
140
 
141
+ #: includes/abstract/abstract-wc-payment-gateway-stripe-payment-intent.php:268
142
+ #: includes/abstract/abstract-wc-payment-gateway-stripe-payment-intent.php:334
143
  #, php-format
144
  msgid "Customer must manually complete payment for payment method %s"
145
  msgstr ""
146
 
147
+ #: includes/abstract/abstract-wc-payment-gateway-stripe-payment-intent.php:317
148
  #, php-format
149
  msgid "Pre-order payment for order failed. Reason: %s"
150
  msgstr ""
331
  msgstr ""
332
 
333
  #: includes/admin/meta-boxes/views/html-charge-data-subview.php:56
334
+ #: templates/cc-forms/bootstrap.php:16
335
  msgid "Exp"
336
  msgstr ""
337
 
460
  msgstr ""
461
 
462
  #: includes/admin/settings/class-wc-stripe-api-settings.php:92
463
+ #, php-format
464
  msgid ""
465
  "The webhook secret is used to authenticate webhooks sent from Stripe. It "
466
+ "ensures no 3rd party can send you events, pretending to be Stripe. %sWebhook "
467
+ "guide%s"
468
  msgstr ""
469
 
470
  #: includes/admin/settings/class-wc-stripe-api-settings.php:95
1494
  msgstr ""
1495
 
1496
  #: includes/wc-stripe-functions.php:638
1497
+ msgid "Bootstrap form"
1498
+ msgstr ""
1499
+
1500
+ #: includes/wc-stripe-functions.php:672
1501
  msgid "Simple form"
1502
  msgstr ""
1503
 
1504
+ #: includes/wc-stripe-functions.php:705
1505
  msgid "Inline Form"
1506
  msgstr ""
1507
 
1508
+ #: includes/wc-stripe-functions.php:741
1509
  msgid "Rounded Form"
1510
  msgstr ""
1511
 
1518
  msgid "or"
1519
  msgstr ""
1520
 
1521
+ #: templates/cc-forms/bootstrap.php:10 templates/cc-forms/inline.php:10
1522
+ #: templates/cc-forms/simple.php:12
1523
  msgid "Card Number"
1524
  msgstr ""
1525
 
1526
+ #: templates/cc-forms/bootstrap.php:20 templates/cc-forms/inline.php:18
1527
+ #: templates/cc-forms/simple.php:26
 
 
 
1528
  msgid "CVC"
1529
  msgstr ""
1530
 
1531
+ #: templates/cc-forms/bootstrap.php:25 templates/cc-forms/inline.php:23
1532
+ #: templates/cc-forms/simple.php:34
1533
  msgid "ZIP"
1534
  msgstr ""
1535
 
1536
+ #: templates/cc-forms/inline.php:14
1537
+ msgid "Exp Date"
1538
+ msgstr ""
1539
+
1540
  #: templates/cc-forms/simple.php:20
1541
  msgid "Expiration"
1542
  msgstr ""
includes/abstract/abstract-wc-payment-gateway-stripe-charge.php CHANGED
@@ -62,6 +62,7 @@ abstract class WC_Payment_Gateway_Stripe_Charge extends WC_Payment_Gateway_Strip
62
  wc_stripe_log_info ( 'Stripe charge: ' . print_r ( $charge, true ) );
63
  if (is_wp_error ( $charge )) {
64
  wc_add_notice ( sprintf ( __ ( 'Error processing payment. Reason: %s', 'woo-stripe-payment' ), $charge->get_error_message () ), 'error' );
 
65
  $order->add_order_note ( sprintf ( __ ( 'Error processing payment. Reason: %s. Code: %s', 'woo-stripe-payment' ), $charge->get_error_message (), $charge->get_error_code () ) );
66
  return $this->order_error ();
67
  }
62
  wc_stripe_log_info ( 'Stripe charge: ' . print_r ( $charge, true ) );
63
  if (is_wp_error ( $charge )) {
64
  wc_add_notice ( sprintf ( __ ( 'Error processing payment. Reason: %s', 'woo-stripe-payment' ), $charge->get_error_message () ), 'error' );
65
+ $order->update_status ( 'failed' );
66
  $order->add_order_note ( sprintf ( __ ( 'Error processing payment. Reason: %s. Code: %s', 'woo-stripe-payment' ), $charge->get_error_message (), $charge->get_error_code () ) );
67
  return $this->order_error ();
68
  }
includes/abstract/abstract-wc-payment-gateway-stripe-local-payment.php CHANGED
@@ -74,6 +74,7 @@ abstract class WC_Payment_Gateway_Stripe_Local_Payment extends WC_Payment_Gatewa
74
 
75
  if (is_wp_error ( $source )) {
76
  wc_add_notice ( sprintf ( __ ( 'Error creating payment source. Reason: %s', 'woo-stripe-payment' ), $source->get_error_message () ), 'error' );
 
77
  return $this->order_error ();
78
  }
79
 
@@ -191,7 +192,7 @@ abstract class WC_Payment_Gateway_Stripe_Local_Payment extends WC_Payment_Gatewa
191
  return in_array ( get_woocommerce_currency (), $this->currencies );
192
  } else {
193
  $customer = WC ()->customer;
194
- return in_array ( get_woocommerce_currency (), $this->currencies ) && in_array ( $customer->get_billing_country (), $this->countries );
195
  }
196
  }
197
 
74
 
75
  if (is_wp_error ( $source )) {
76
  wc_add_notice ( sprintf ( __ ( 'Error creating payment source. Reason: %s', 'woo-stripe-payment' ), $source->get_error_message () ), 'error' );
77
+ $order->update_status ( 'failed', sprintf ( __ ( 'Error creating payment source. Reason: %s', 'woo-stripe-payment' ), $source->get_error_message () ) );
78
  return $this->order_error ();
79
  }
80
 
192
  return in_array ( get_woocommerce_currency (), $this->currencies );
193
  } else {
194
  $customer = WC ()->customer;
195
+ return $customer && in_array ( get_woocommerce_currency (), $this->currencies ) && in_array ( $customer->get_billing_country (), $this->countries );
196
  }
197
  }
198
 
includes/abstract/abstract-wc-payment-gateway-stripe-payment-intent.php CHANGED
@@ -50,6 +50,7 @@ abstract class WC_Payment_Gateway_Stripe_Payment_Intent extends WC_Payment_Gatew
50
 
51
  if (is_wp_error ( $intent )) {
52
  wc_add_notice ( $intent->get_error_message (), 'error' );
 
53
  return $this->order_error ();
54
  }
55
 
@@ -65,6 +66,9 @@ abstract class WC_Payment_Gateway_Stripe_Payment_Intent extends WC_Payment_Gatew
65
  $intent = $this->gateway->confirm_payment_intent ( $intent );
66
  if (is_wp_error ( $intent )) {
67
  wc_add_notice ( $intent->get_error_message (), 'error' );
 
 
 
68
  return $this->order_error ();
69
  }
70
  }
50
 
51
  if (is_wp_error ( $intent )) {
52
  wc_add_notice ( $intent->get_error_message (), 'error' );
53
+ $order->update_status ( 'failed', sprintf ( __ ( 'Error processing payment. Reason: %s', 'woo-stripe-payment' ), $intent->get_error_message () ) );
54
  return $this->order_error ();
55
  }
56
 
66
  $intent = $this->gateway->confirm_payment_intent ( $intent );
67
  if (is_wp_error ( $intent )) {
68
  wc_add_notice ( $intent->get_error_message (), 'error' );
69
+ $order->update_status ( 'failed' );
70
+ // manually add note because if status is already failed then the note won't get included
71
+ $order->add_order_note ( sprintf ( __ ( 'Error processing payment. Reason: %s', 'woo-stripe-payment' ), $intent->get_error_message () ) );
72
  return $this->order_error ();
73
  }
74
  }
includes/admin/settings/class-wc-stripe-api-settings.php CHANGED
@@ -84,12 +84,12 @@ class WC_Stripe_API_Settings extends WC_Stripe_Settings_API {
84
  'title' => __ ( 'Webhook url', 'woo-stripe-payment' ),
85
  'class' => 'wc-stripe-webhook',
86
  'text' => wc_stripe ()->rest_api->webhook->rest_url ( 'webhook' ),
87
- 'description' => sprintf ( __ ( '<strong>Important:</strong> the webhook url is called by Stripe when events occur in your account, like a source becomes chargeable. You must add this webhook to your Stripe Dashboard if you are using any of the local gateways. %sWebhook guide%s', 'woo-stripe-payment' ), '<a target="_blank" href="https://docs.paymentplugins.com/wc-stripe/config/#/webhooks?id=confgure-webooks">', '</a>' )
88
  ),
89
  'webhook_secret' => array(
90
  'type' => 'password',
91
  'title' => __ ( 'Webhook Secret', 'woo-stripe-payment' ),
92
- 'description' => __ ( 'The webhook secret is used to authenticate webhooks sent from Stripe. It ensures no 3rd party can send you events, pretending to be Stripe.', 'woo-stripe-payment' )
93
  ),
94
  'debug_log' => array(
95
  'title' => __ ( 'Debug Log', 'woo-stripe-payment' ),
84
  'title' => __ ( 'Webhook url', 'woo-stripe-payment' ),
85
  'class' => 'wc-stripe-webhook',
86
  'text' => wc_stripe ()->rest_api->webhook->rest_url ( 'webhook' ),
87
+ 'description' => sprintf ( __ ( '<strong>Important:</strong> the webhook url is called by Stripe when events occur in your account, like a source becomes chargeable. You must add this webhook to your Stripe Dashboard if you are using any of the local gateways. %sWebhook guide%s', 'woo-stripe-payment' ), '<a target="_blank" href="https://docs.paymentplugins.com/wc-stripe/config/#/webhooks?id=configure-webhooks">', '</a>' )
88
  ),
89
  'webhook_secret' => array(
90
  'type' => 'password',
91
  'title' => __ ( 'Webhook Secret', 'woo-stripe-payment' ),
92
+ 'description' => sprintf(__ ( 'The webhook secret is used to authenticate webhooks sent from Stripe. It ensures no 3rd party can send you events, pretending to be Stripe. %sWebhook guide%s', 'woo-stripe-payment' ), '<a target="_blank" href="https://docs.paymentplugins.com/wc-stripe/config/#/webhooks?id=configure-webhooks">', '</a>')
93
  ),
94
  'debug_log' => array(
95
  'title' => __ ( 'Debug Log', 'woo-stripe-payment' ),
includes/class-stripe.php CHANGED
@@ -21,7 +21,7 @@ class WC_Stripe_Manager {
21
  *
22
  * @var string
23
  */
24
- public $version = '3.0.3';
25
 
26
  /**
27
  *
21
  *
22
  * @var string
23
  */
24
+ public $version = '3.0.4';
25
 
26
  /**
27
  *
includes/gateways/class-wc-payment-gateway-stripe-cc.php CHANGED
@@ -54,7 +54,8 @@ class WC_Payment_Gateway_Stripe_CC extends WC_Payment_Gateway_Stripe_Payment_Int
54
  'jcb' => wc_stripe ()->assets_url ( 'img/cards/jcb.svg' ),
55
  'unionpay' => wc_stripe ()->assets_url ( 'img/cards/china_union_pay.svg' ),
56
  'unknown' => $this->get_custom_form ()[ 'cardBrand' ]
57
- ]
 
58
  ) );
59
  }
60
 
@@ -124,4 +125,24 @@ class WC_Payment_Gateway_Stripe_CC extends WC_Payment_Gateway_Stripe_Payment_Int
124
  public function cvv_enabled() {
125
  return $this->is_active ( 'cvv_enabled' );
126
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
127
  }
54
  'jcb' => wc_stripe ()->assets_url ( 'img/cards/jcb.svg' ),
55
  'unionpay' => wc_stripe ()->assets_url ( 'img/cards/china_union_pay.svg' ),
56
  'unknown' => $this->get_custom_form ()[ 'cardBrand' ]
57
+ ],
58
+ 'postal_regex' => $this->get_postal_code_regex ()
59
  ) );
60
  }
61
 
125
  public function cvv_enabled() {
126
  return $this->is_active ( 'cvv_enabled' );
127
  }
128
+
129
+ public function get_postal_code_regex() {
130
+ return [ 'AT' => '^([0-9]{4})$',
131
+ 'BR' => '^([0-9]{5})([-])?([0-9]{3})$',
132
+ 'CH' => '^([0-9]{4})$',
133
+ 'DE' => '^([0]{1}[1-9]{1}|[1-9]{1}[0-9]{1})[0-9]{3}$',
134
+ 'ES' => '^([0-9]{5})$',
135
+ 'FR' => '^([0-9]{5})$',
136
+ 'IT' => '^([0-9]{5})$/i',
137
+ 'IE' => '([AC-FHKNPRTV-Y]\d{2}|D6W)[0-9AC-FHKNPRTV-Y]{4}',
138
+ 'JP' => '^([0-9]{3})([-])([0-9]{4})$',
139
+ 'PT' => '^([0-9]{4})([-])([0-9]{3})$',
140
+ 'US' => '^([0-9]{5})(-[0-9]{4})?$',
141
+ 'CA' => '^([ABCEGHJKLMNPRSTVXY]\d[ABCEGHJKLMNPRSTVWXYZ])([\ ])?(\d[ABCEGHJKLMNPRSTVWXYZ]\d)$',
142
+ 'PL' => '^([0-9]{2})([-])([0-9]{3})',
143
+ 'CZ' => '^([0-9]{3})(\s?)([0-9]{2})$',
144
+ 'SK' => '^([0-9]{3})(\s?)([0-9]{2})$',
145
+ 'NL' => '^([1-9][0-9]{3})(\s?)(?!SA|SD|SS)[A-Z]{2}$'
146
+ ];
147
+ }
148
  }
includes/gateways/class-wc-payment-gateway-stripe-klarna.php CHANGED
@@ -144,7 +144,6 @@ class WC_Payment_Gateway_Stripe_Klarna extends WC_Payment_Gateway_Stripe_Local_P
144
  * have to be populated.
145
  */
146
  if ($order->get_shipping_address_1 ()) {
147
- unset ( $args[ 'owner' ][ 'name' ] );
148
  $args[ 'klarna' ][ 'shipping_first_name' ] = $order->get_shipping_first_name ();
149
  $args[ 'klarna' ][ 'shipping_last_name' ] = $order->get_shipping_last_name ();
150
  $args[ 'source_order' ][ 'shipping' ][ 'address' ] = [
144
  * have to be populated.
145
  */
146
  if ($order->get_shipping_address_1 ()) {
 
147
  $args[ 'klarna' ][ 'shipping_first_name' ] = $order->get_shipping_first_name ();
148
  $args[ 'klarna' ][ 'shipping_last_name' ] = $order->get_shipping_last_name ();
149
  $args[ 'source_order' ][ 'shipping' ][ 'address' ] = [
includes/gateways/settings/cc-settings.php CHANGED
@@ -93,7 +93,7 @@ return array(
93
  'title' => __ ( 'Custom Form', 'woo-stripe-payment' ),
94
  'type' => 'select',
95
  'options' => wp_list_pluck ( wc_stripe_get_custom_forms (), 'label' ),
96
- 'default' => 'simple',
97
  'description' => __ ( 'The design of the credit card form.', 'woo-stripe-payment' ),
98
  'desc_tip' => true,
99
  'custom_attributes' => array(
@@ -104,7 +104,7 @@ return array(
104
  ),
105
  'postal_enabled' => array(
106
  'title' => __ ( 'Postal Code', 'woo-stripe-payment' ),
107
- 'type' => 'checkbox', 'default' => 'yes',
108
  'description' => __ ( 'If enabled, the CC form will show the postal code on the checkout page. If disabled, the billing field\'s postal code will be used. The postal code will show on the Add Payment Method page for security reasons.', 'woo-stripe-payment' ),
109
  'desc_tip' => true,
110
  'custom_attributes' => array(
93
  'title' => __ ( 'Custom Form', 'woo-stripe-payment' ),
94
  'type' => 'select',
95
  'options' => wp_list_pluck ( wc_stripe_get_custom_forms (), 'label' ),
96
+ 'default' => 'bootstrap',
97
  'description' => __ ( 'The design of the credit card form.', 'woo-stripe-payment' ),
98
  'desc_tip' => true,
99
  'custom_attributes' => array(
104
  ),
105
  'postal_enabled' => array(
106
  'title' => __ ( 'Postal Code', 'woo-stripe-payment' ),
107
+ 'type' => 'checkbox', 'default' => 'no',
108
  'description' => __ ( 'If enabled, the CC form will show the postal code on the checkout page. If disabled, the billing field\'s postal code will be used. The postal code will show on the Add Payment Method page for security reasons.', 'woo-stripe-payment' ),
109
  'desc_tip' => true,
110
  'custom_attributes' => array(
includes/wc-stripe-functions.php CHANGED
@@ -633,6 +633,40 @@ function wc_stripe_add_number_precision($value, $round = true) {
633
  */
634
  function wc_stripe_get_custom_forms() {
635
  return apply_filters ( 'wc_stripe_get_custom_forms', [
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
636
  'simple' => [
637
  'template' => 'cc-forms/simple.php',
638
  'label' => __ ( 'Simple form', 'woo-stripe-payment' ),
633
  */
634
  function wc_stripe_get_custom_forms() {
635
  return apply_filters ( 'wc_stripe_get_custom_forms', [
636
+ 'bootstrap' => [
637
+ 'template' => 'cc-forms/bootstrap.php',
638
+ 'label' => __ ( 'Bootstrap form', 'woo-stripe-payment' ),
639
+ 'cardBrand' => wc_stripe ()->assets_url ( 'img/card_brand2.svg' ),
640
+ 'elementStyles' => [
641
+ 'base' => [
642
+ 'color' => '#495057',
643
+ 'fontWeight' => 300,
644
+ 'fontFamily' => 'Roboto, sans-serif, Source Code Pro, Consolas, Menlo, monospace',
645
+ 'fontSize' => '16px',
646
+ 'fontSmoothing' => 'antialiased',
647
+ '::placeholder' => [
648
+ 'color' => '#fff' ,
649
+ 'fontSize' => '0px'
650
+ ],
651
+ ':-webkit-autofill' => [
652
+ 'color' => '#e39f48'
653
+ ]
654
+ ],
655
+ 'invalid' => [
656
+ 'color' => '#E25950',
657
+ '::placeholder' => [
658
+ 'color' => '#757575'
659
+ ]
660
+ ]
661
+ ],
662
+ 'elementOptions' => [
663
+ 'fonts' => [
664
+ [
665
+ 'cssSrc' => 'https://fonts.googleapis.com/css?family=Source+Code+Pro'
666
+ ]
667
+ ]
668
+ ]
669
+ ],
670
  'simple' => [
671
  'template' => 'cc-forms/simple.php',
672
  'label' => __ ( 'Simple form', 'woo-stripe-payment' ),
readme.txt CHANGED
@@ -4,7 +4,7 @@ Tags: stripe, klarna, credit card, apple pay, google pay, ideal, sepa, sofort
4
  Requires at least: 3.0.1
5
  Tested up to: 5.3.0
6
  Requires PHP: 5.4
7
- Stable tag: 3.0.3
8
  Copyright: Payment Plugins
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
@@ -51,6 +51,10 @@ If you're site is not loading over https, then Stripe won't render the Payment R
51
  7. Payment options at top of checkout page for easy one click checkout
52
 
53
  == Changelog ==
 
 
 
 
54
  = 3.0.3 =
55
  * Fixed - Check added to wc_stripe_order_status_completed function to ensure capture charge is only called when Stripe is the payment gateway for the order.
56
  * Updated - Stripe API version to 2019-11-05
4
  Requires at least: 3.0.1
5
  Tested up to: 5.3.0
6
  Requires PHP: 5.4
7
+ Stable tag: 3.0.4
8
  Copyright: Payment Plugins
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
51
  7. Payment options at top of checkout page for easy one click checkout
52
 
53
  == Changelog ==
54
+ = 3.0.4 =
55
+ * Added - Bootstrap form added
56
+ * Updated - WC 3.8.1
57
+ * Fixed - Check for customer object in Admin pages for local payment methods
58
  = 3.0.3 =
59
  * Fixed - Check added to wc_stripe_order_status_completed function to ensure capture charge is only called when Stripe is the payment gateway for the order.
60
  * Updated - Stripe API version to 2019-11-05
stripe-payments.php CHANGED
@@ -4,13 +4,13 @@
4
  * Plugin Name: Stripe For WooCommerce
5
  * Plugin URI: https://docs.paymentplugins.com/wc-stripe/config/
6
  * Description: Accept credit cards, Google Pay, & Apple Pay, Klarna and more using Stripe.
7
- * Version: 3.0.3
8
  * Author: Payment Plugins, support@paymentplugins.com
9
  * Text Domain: woo-stripe-payment
10
  * Domain Path: /i18n/languages/
11
  * Tested up to: 5.3.0
12
  * WC requires at least: 3.0.0
13
- * WC tested up to: 3.8.0
14
  */
15
  function wc_stripe_php_version_notice() {
16
  $message = sprintf ( __ ( 'Your PHP version is %s but Stripe requires version 5.4+.', 'woo-stripe-payment' ), PHP_VERSION );
4
  * Plugin Name: Stripe For WooCommerce
5
  * Plugin URI: https://docs.paymentplugins.com/wc-stripe/config/
6
  * Description: Accept credit cards, Google Pay, & Apple Pay, Klarna and more using Stripe.
7
+ * Version: 3.0.4
8
  * Author: Payment Plugins, support@paymentplugins.com
9
  * Text Domain: woo-stripe-payment
10
  * Domain Path: /i18n/languages/
11
  * Tested up to: 5.3.0
12
  * WC requires at least: 3.0.0
13
+ * WC tested up to: 3.8.1
14
  */
15
  function wc_stripe_php_version_notice() {
16
  $message = sprintf ( __ ( 'Your PHP version is %s but Stripe requires version 5.4+.', 'woo-stripe-payment' ), PHP_VERSION );
templates/cc-forms/bootstrap.php ADDED
@@ -0,0 +1,218 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @version 3.0.4
4
+ */
5
+ ?>
6
+ <div class="wc-stripe-bootstrap-form">
7
+ <div class="row">
8
+ <div class="col-md-12 mb-3">
9
+ <div id="stripe-card-number" class="md-form md-outline stripe-input"></div>
10
+ <label for="stripe-card-number"><?php _e('Card Number', 'woo-stripe-payment')?></label>
11
+ </div>
12
+ </div>
13
+ <div class="row">
14
+ <div class="col-md-4 mb-3">
15
+ <div id="stripe-exp" class="md-form md-outline stripe-input"></div>
16
+ <label for="stripe-cvv"><?php _e('Exp', 'woo-stripe-payment')?></label>
17
+ </div>
18
+ <div class="col-md-4 mb-3">
19
+ <div id="stripe-cvv" class="md-form md-outline stripe-input"></div>
20
+ <label for="stripe-cvv"><?php _e('CVC', 'woo-stripe-payment')?></label>
21
+ </div>
22
+ <?php if($gateway->postal_enabled()):?>
23
+ <div class="col-md-4 mb-3">
24
+ <input id="stripe-postal-code" class="md-form md-outline stripe-input"/>
25
+ <label for="stripe-postal-code"><?php _e('ZIP', 'woo-stripe-payment')?></label>
26
+ </div>
27
+ <?php endif;?>
28
+ </div>
29
+ </div>
30
+ <style>
31
+ .wc-stripe-bootstrap-form #stripe-postal-code{
32
+ width: 100%;
33
+ padding: 10px 12px;
34
+ min-height: 41px;
35
+ font-weight: 500;
36
+ font-size: 16px;
37
+ line-height: normal;
38
+ color: #495057;
39
+ -webkit-appearance: none;
40
+ }
41
+ #stripe-postal-code:focused{
42
+ background: transparent;
43
+ }
44
+ .wc-stripe-bootstrap-form input[id=stripe-postal-code]:not(.StripeElement--complete):not(.invalid):focus{
45
+ box-shadow: inset 0 0 0 1.25px #4285f4;
46
+ -webkit-box-shadow: inset 0 0 0 1.25px #4285f4;
47
+ -moz-box-shadow: inset 0 0 0 1.25px #4285f4;
48
+ }
49
+ .wc-stripe-bootstrap-form input[id=stripe-postal-code].StripeElement--complete.focused{
50
+ border-color: #1b9404;
51
+ box-shadow: inset 0 0 0 1.25px #1b9404;
52
+ -webkit-box-shadow: inset 0 0 0 1.25px #1b9404;
53
+ }
54
+ .wc-stripe-bootstrap-form #stripe-postal-code:not(.empty)+label{
55
+ -webkit-transform: translateY(-150%);
56
+ -ms-transform: translateY(-150%);
57
+ transform: translateY(-150%);
58
+ background: #fff;
59
+ font-weight: 500;
60
+ padding-right: 5px;
61
+ padding-left: 5px;
62
+ font-size: 12px;
63
+ left: 20px;
64
+ font-weight: 500;
65
+ }
66
+ .payment_box.payment_method_stripe_cc,
67
+ li.payment_method_stripe_cc .payment_box{
68
+ background: #fff !important;
69
+ }
70
+ .wc-stripe-bootstrap-form{
71
+ background: #fff !important;
72
+ }
73
+ .wc-stripe-bootstrap-form .row {
74
+ display: -ms-flexbox;
75
+ display: flex;
76
+ -ms-flex-wrap: wrap;
77
+ flex-wrap: wrap;
78
+ margin-right: -15px;
79
+ margin-left: -15px;
80
+ margin-bottom: 0px;
81
+ margin-top: 0px;
82
+ }
83
+ .wc-stripe-bootstrap-form .mb-2, .my-2 {
84
+ margin-bottom: .5rem!important;
85
+ }
86
+ .wc-stripe-bootstrap-form .mb-3,
87
+ .wc-stripe-bootstrap-form .my-3 {
88
+ margin-bottom: 1rem !important;
89
+ }
90
+ .wc-stripe-bootstrap-form .col-md-3,
91
+ .wc-stripe-bootstrap-form .col-md-4,
92
+ .wc-stripe-bootstrap-form .col-md-6,
93
+ .wc-stripe-bootstrap-form .col-md-9,
94
+ .wc-stripe-bootstrap-form .col-md-12 {
95
+ position: relative;
96
+ width: 100%;
97
+ padding-right: 15px;
98
+ padding-left: 15px;
99
+ }
100
+ .wc-stripe-bootstrap-form .md-form+label {
101
+ position: absolute;
102
+ top: .65rem;
103
+ left: 15px;
104
+ -webkit-transition: .2s ease-out;
105
+ -o-transition: .2s ease-out;
106
+ transition: .2s ease-out;
107
+ cursor: text;
108
+ color: #757575;
109
+ }
110
+ .wc-stripe-bootstrap-form .md-form.md-outline+label {
111
+ font-size: 16px;
112
+ position: absolute;
113
+ top: 50%;
114
+ transform: translateY(-50%);
115
+ -webkit-transform: translateY(-50%);
116
+ -ms-transform: translateY(-50%);
117
+ -moz-transform: translateY(-50%);
118
+ padding-left: 12px;
119
+ -webkit-transition: .2s ease-out;
120
+ -o-transition: .2s ease-out;
121
+ transition: .2s ease-out;
122
+ cursor: text;
123
+ color: #495057;
124
+ font-weight: 300;
125
+ margin: 0;
126
+ }
127
+ .wc-stripe-bootstrap-form .md-form.md-outline.focused+label{
128
+ color: #4285f4
129
+ }
130
+ .wc-stripe-bootstrap-form .md-form.md-outline.focused+label,
131
+ .wc-stripe-bootstrap-form .md-form.md-outline.invalid+label,
132
+ .wc-stripe-bootstrap-form .md-form.md-outline.StripeElement--complete+label {
133
+ -webkit-transform: translateY(-150%);
134
+ -ms-transform: translateY(-150%);
135
+ transform: translateY(-150%);
136
+ background: #fff;
137
+ font-weight: 500;
138
+ padding-right: 5px;
139
+ padding-left: 5px;
140
+ font-size: 12px;
141
+ left: 20px;
142
+ font-weight: 500;
143
+ }
144
+ .wc-stripe-bootstrap-form .md-form.md-outline.invalid+label{
145
+ color: #E25950;
146
+ }
147
+ .wc-stripe-bootstrap-form .md-form.md-outline.StripeElement--complete+label{
148
+ color: #1b9404;
149
+ }
150
+ .wc-stripe-bootstrap-form .md-form.md-outline {
151
+ position: relative;
152
+ }
153
+ .wc-stripe-bootstrap-form .stripe-input{
154
+ -webkit-transition: all .3s;
155
+ -o-transition: all .3s;
156
+ transition: all .3s;
157
+ outline: 0;
158
+ -webkit-box-shadow: none;
159
+ box-shadow: none;
160
+ border: 1px solid #dadce0;
161
+ -webkit-border-radius: 4px;
162
+ border-radius: 4px;
163
+ background-color: #fff !important;
164
+ -webkit-box-sizing: border-box;
165
+ box-sizing: border-box;
166
+ padding: 10px 12px;
167
+ height: 40px;
168
+ }
169
+ .wc-stripe-bootstrap-form .stripe-input.focused,
170
+ .wc-stripe-bootstrap-form .stripe-input.invalid{
171
+ border-color: #4285f4;
172
+ -webkit-box-shadow: inset 0 0 0 0.5px #4285f4;
173
+ box-shadow: inset 0 0 0 0.5px #4285f4
174
+ }
175
+ .wc-stripe-bootstrap-form .stripe-input.invalid{
176
+ border-color: #E25950;
177
+ box-shadow: inset 0 0 0 0.5px #E25950;
178
+ }
179
+ .wc-stripe-bootstrap-form .stripe-input.StripeElement--complete{
180
+ border-color: #1b9404;
181
+ box-shadow: inset 0 0 0 0.5px #1b9404;
182
+ -webkit-box-shadow: inset 0 0 0 0.5px #1b9404;
183
+ }
184
+ @media (min-width: 768px){
185
+ .wc-stripe-bootstrap-form .col-md-3 {
186
+ -ms-flex: 0 0 25%;
187
+ flex: 0 0 25%;
188
+ max-width: 25%;
189
+ }
190
+ .wc-stripe-bootstrap-form .col-md-4{
191
+ -webkit-box-flex: 0;
192
+ -ms-flex: 0 0 33.33%;
193
+ flex: 0 0 33.33%;
194
+ max-width: 33.33%;
195
+ }
196
+ .wc-stripe-bootstrap-form .col-md-9{
197
+ -webkit-box-flex: 0;
198
+ -ms-flex: 0 0 75%;
199
+ flex: 0 0 75%;
200
+ max-width: 75%;
201
+ }
202
+ .wc-stripe-bootstrap-form .col-md-12{
203
+ -webkit-box-flex: 0;
204
+ -ms-flex: 0 0 100%;
205
+ flex: 0 0 100%;
206
+ max-width: 100%;
207
+ }
208
+ }
209
+ .stripe-small-container .wc-stripe-bootstrap-form .col-md-3,
210
+ .stripe-small-container .wc-stripe-bootstrap-form .col-md-4,
211
+ .stripe-small-container .wc-stripe-bootstrap-form .col-md-6,
212
+ .stripe-small-container .wc-stripe-bootstrap-form .col-md-9,
213
+ .stripe-small-container .wc-stripe-bootstrap-form .col-md-12{
214
+ -ms-flex: 0 0 100%;
215
+ flex: 0 0 100%;
216
+ max-width: 100%;
217
+ }
218
+ </style>
templates/cc-forms/inline.php CHANGED
@@ -139,6 +139,9 @@
139
  box-shadow: 0 6px 9px rgba(50, 50, 93, 0.06), 0 2px 5px rgba(0, 0, 0, 0.08),
140
  inset 0 1px 0 #e298d8;
141
  }
 
 
 
142
 
143
  .wc-stripe-inline-form .error svg .base {
144
  fill: #fff;
139
  box-shadow: 0 6px 9px rgba(50, 50, 93, 0.06), 0 2px 5px rgba(0, 0, 0, 0.08),
140
  inset 0 1px 0 #e298d8;
141
  }
142
+ #stripe-postal-code:focus{
143
+ background: transparent;
144
+ }
145
 
146
  .wc-stripe-inline-form .error svg .base {
147
  fill: #fff;