Payment Plugins for Stripe WooCommerce - Version 3.2.0

Version Description

  • Fixed - Conflict with Checkout Field Editor for WooCommerce and JS checkout field variable
  • Fixed - Mini-cart html
  • Fixed - SEPA JS error on checkout page
  • Added - WC tested to 4.4.1
  • Updated - removed selectWoo as form-handler.js dependency
Download this release

Release Info

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

Code changes from version 3.1.9 to 3.2.0

assets/css/stripe.css CHANGED
@@ -290,7 +290,7 @@ li.payment_method_stripe_payment_request {
290
  padding: 0px;
291
  }
292
 
293
- #wc-stripe-cart-form {
294
  margin: 0;
295
  padding: 0;
296
  clear: both;
@@ -388,9 +388,10 @@ li.payment_method_stripe_ach label:first-of-type img {
388
 
389
  @supports (-webkit-appearance: -apple-pay-button) {
390
  .apple-pay-button {
391
- display: inline-block;
392
  -webkit-appearance: -apple-pay-button;
393
  width: 100%;
 
394
  min-width: 200px;
395
  height: 40px;
396
  max-height: 40px;
@@ -415,6 +416,10 @@ li.payment_method_stripe_ach label:first-of-type img {
415
  .woocommerce-checkout-payment .apple-pay-button {
416
  max-width: 240px;
417
  }
 
 
 
 
418
  }
419
 
420
  .wc-stripe-banner-checkout {
@@ -549,7 +554,7 @@ ul.payment_methods li.payment_method_stripe_sofort img {
549
  }
550
 
551
  ul.payment_methods li.payment_method_stripe_bancontact img,
552
- label[for=payment_method_braintree_bancontact] img {
553
  width: 60px;
554
  height: 42px;
555
  max-width: 60px;
@@ -763,17 +768,38 @@ li.payment_method_stripe_wechat {
763
  .widget_shopping_cart_content .wc-stripe-mini-cart-payment-methods li{
764
  margin: 0;
765
  }
766
- .widget_shopping_cart_content .payment_method_stripe_googlepay.active,
767
- .widget_shopping_cart_content .payment_method_stripe_applepay.active,
768
- .widget_shopping_cart_content .payment_method_stripe_payment_request.active{
769
- display: block;
 
 
 
770
  }
771
- .wc-stripe-gpay-mini-cart .gpay-button-container .gpay-button{
 
772
  width: 100%;
 
773
  }
774
  .wc-stripe-payment-request-mini-cart.StripeElement{
775
  padding: 0;
776
  background: transparent;
777
  border: none;
778
  width: 100%;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
779
  }
290
  padding: 0px;
291
  }
292
 
293
+ .wc-stripe-cart-checkout-container {
294
  margin: 0;
295
  padding: 0;
296
  clear: both;
388
 
389
  @supports (-webkit-appearance: -apple-pay-button) {
390
  .apple-pay-button {
391
+ display: block;
392
  -webkit-appearance: -apple-pay-button;
393
  width: 100%;
394
+ max-width: 100%;
395
  min-width: 200px;
396
  height: 40px;
397
  max-height: 40px;
416
  .woocommerce-checkout-payment .apple-pay-button {
417
  max-width: 240px;
418
  }
419
+
420
+ body.single-product div.product form.cart .wc_stripe_product_payment_methods .apple-pay-button{
421
+ max-width: 100%;
422
+ }
423
  }
424
 
425
  .wc-stripe-banner-checkout {
554
  }
555
 
556
  ul.payment_methods li.payment_method_stripe_bancontact img,
557
+ label[for=payment_method_stripe_bancontact] img {
558
  width: 60px;
559
  height: 42px;
560
  max-width: 60px;
768
  .widget_shopping_cart_content .wc-stripe-mini-cart-payment-methods li{
769
  margin: 0;
770
  }
771
+
772
+ .widget_shopping_cart_content a.wc-stripe-gpay-mini-cart,
773
+ .widget_shopping_cart_content a.wc-stripe-applepay-mini-cart,
774
+ .widget_shopping_cart_content a.wc-stripe-payment-request-mini-cart{
775
+ background: transparent;
776
+ padding: 0;
777
+ border: none;
778
  }
779
+ a.wc-stripe-gpay-mini-cart .gpay-button,
780
+ a.wc-stripe-applepay-mini-cart .apple-pay-button{
781
  width: 100%;
782
+ margin: 0;
783
  }
784
  .wc-stripe-payment-request-mini-cart.StripeElement{
785
  padding: 0;
786
  background: transparent;
787
  border: none;
788
  width: 100%;
789
+ }
790
+ .wc-stripe-payment-request-mini-cart.StripeElement .__PrivateStripeElement{
791
+ width: 100%;
792
+ }
793
+
794
+ .widget_shopping_cart_content .wc-stripe-overlay{
795
+ display: none !important;
796
+ position: absolute;
797
+ background: rgba(255, 255, 255, 0.75);
798
+ height: 100%;
799
+ width: 100%;
800
+ z-index: -1;
801
+ }
802
+ .widget_shopping_cart_content .wc-stripe-overlay.active{
803
+ display: block !important;
804
+ z-index: 9999;
805
  }
assets/js/frontend/credit-card.js CHANGED
@@ -58,9 +58,9 @@
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
  }
@@ -71,9 +71,9 @@
71
  } else {
72
  this.card = this.elements.create('card', {
73
  value: {
74
- postalCode: $('#billing_postcode').val()
75
  },
76
- hidePostalCode: $('#billing_postcode').length > 0,
77
  style: this.params.style,
78
  iconStyle: 'default'
79
  });
@@ -82,9 +82,6 @@
82
  this.card.update({value: $('#billing_postcode').val()});
83
  }
84
  }.bind(this));
85
- this.card.addEventListener('change', function (event) {
86
-
87
- }.bind(this))
88
  }
89
  // setup a timeout so CC element is always rendered.
90
  setInterval(this.create_card_element.bind(this), 2000);
@@ -93,11 +90,11 @@
93
  CC.prototype.validate_postal_field = function () {
94
  if ($('#billing_postcode').length && $('#stripe-postal-code').length) {
95
  // validate postal code
96
- if (this.params.postal_regex[$('#billing_country').val()]) {
97
- var regex = this.params.postal_regex[$('#billing_country').val()],
98
  postal = $('#stripe-postal-code').val(),
99
  regExp = new RegExp(regex, "i");
100
- if (postal !== "") {
101
  if (regExp.exec(postal) !== null) {
102
  $('#stripe-postal-code').addClass('StripeElement--complete').removeClass('invalid');
103
  } else {
@@ -160,8 +157,9 @@
160
  this.card.mount('#wc-stripe-card-element');
161
  this.card.update({
162
  value: {
163
- postalCode: $('#billing_postcode').val()
164
- }
 
165
  });
166
  }
167
  }
@@ -369,9 +367,9 @@
369
  if ($('#stripe-postal-code').length > 0) {
370
  return $('#stripe-postal-code').val();
371
  }
372
- return $('#billing_postcode').val();
373
  }
374
- return $('#billing_postcode').val();
375
  }
376
 
377
  CC.prototype.card_number_change = function (data) {
@@ -401,21 +399,24 @@
401
 
402
  CC.prototype.get_billing_details = function () {
403
  var details = {
404
- name: this.get_customer_name('#billing'),
405
  address: {
406
- city: $('#billing_city').val(),
407
- country: $('#billing_country').val(),
408
- line1: $('#billing_address_1').val(),
409
- line2: $('#billing_address_2').val(),
410
  postal_code: this.get_postal_code(),
411
- state: $('#billing_state').val()
412
  }
413
  }
414
- if ($('#billing_email').length && $('#billing_email').val() != '') {
415
- details.email = $('#billing_email').val();
 
 
 
416
  }
417
- if ($('#billing_phone').length && $('#billing_phone').val() != '') {
418
- details.phone = $('#billing_phone').val();
419
  }
420
  return details;
421
  }
58
  style: this.params.style,
59
  classes: elementClasses
60
  });
61
+ if (this.fields.required('billing_postcode') && '' !== this.fields.get('billing_postcode')) {
62
  if ($('#stripe-postal-code').length > 0) {
63
+ $('#stripe-postal-code').val(this.fields.get('billing_postcode'));
64
  this.validate_postal_field();
65
  }
66
  }
71
  } else {
72
  this.card = this.elements.create('card', {
73
  value: {
74
+ postalCode: this.fields.get('billing_postcode', '')
75
  },
76
+ hidePostalCode: this.fields.required('billing_postcode'),
77
  style: this.params.style,
78
  iconStyle: 'default'
79
  });
82
  this.card.update({value: $('#billing_postcode').val()});
83
  }
84
  }.bind(this));
 
 
 
85
  }
86
  // setup a timeout so CC element is always rendered.
87
  setInterval(this.create_card_element.bind(this), 2000);
90
  CC.prototype.validate_postal_field = function () {
91
  if ($('#billing_postcode').length && $('#stripe-postal-code').length) {
92
  // validate postal code
93
+ if (this.params.postal_regex[this.fields.get('billing_country')]) {
94
+ var regex = this.params.postal_regex[this.fields.get('billing_country')],
95
  postal = $('#stripe-postal-code').val(),
96
  regExp = new RegExp(regex, "i");
97
+ if (postal !== '') {
98
  if (regExp.exec(postal) !== null) {
99
  $('#stripe-postal-code').addClass('StripeElement--complete').removeClass('invalid');
100
  } else {
157
  this.card.mount('#wc-stripe-card-element');
158
  this.card.update({
159
  value: {
160
+ postalCode: this.fields.get('billing_postcode', '')
161
+ },
162
+ hidePostalCode: this.fields.required('billing_postcode')
163
  });
164
  }
165
  }
367
  if ($('#stripe-postal-code').length > 0) {
368
  return $('#stripe-postal-code').val();
369
  }
370
+ return this.fields.get('billing_postcode', null);
371
  }
372
+ return this.fields.get('billing_postcode', null);
373
  }
374
 
375
  CC.prototype.card_number_change = function (data) {
399
 
400
  CC.prototype.get_billing_details = function () {
401
  var details = {
402
+ name: this.get_customer_name('billing'),
403
  address: {
404
+ city: this.fields.get('billing_city', null),
405
+ country: this.fields.get('billing_country', null),
406
+ line1: this.fields.get('billing_address_1', null),
407
+ line2: this.fields.get('billing_address_2', null),
408
  postal_code: this.get_postal_code(),
409
+ state: this.fields.get('billing_state', null)
410
  }
411
  }
412
+ if (!details.name || details.name === ' ') {
413
+ delete details.name;
414
+ }
415
+ if (this.fields.get('billing_email') != '') {
416
+ details.email = this.fields.get('billing_email');
417
  }
418
+ if (this.fields.get('billing_phone') != '') {
419
+ details.phone = this.fields.get('billing_phone');
420
  }
421
  return details;
422
  }
assets/js/frontend/form-handler.js CHANGED
@@ -1,4 +1,4 @@
1
- (function($) {
2
 
3
  /**
4
  * @constructor
@@ -133,4 +133,4 @@
133
 
134
  new Handler();
135
 
136
- }(jQuery))
1
+ jQuery(function($) {
2
 
3
  /**
4
  * @constructor
133
 
134
  new Handler();
135
 
136
+ })
assets/js/frontend/local-payment.js CHANGED
@@ -137,8 +137,8 @@
137
  amount: this.get_total_price_cents(),
138
  currency: this.get_currency(),
139
  owner: {
140
- name: this.get_customer_name('#billing'),
141
- email: $('#billing_email').val()
142
  },
143
  redirect: {
144
  return_url: this.params.return_url
@@ -419,7 +419,7 @@
419
 
420
  BECS.prototype.get_confirmation_args = function (obj) {
421
  var args = LocalPayment.prototype.get_confirmation_args.apply(this, arguments);
422
- args.payment_method.billing_details.email = $('#billing_email').val();
423
  return args;
424
  }
425
 
137
  amount: this.get_total_price_cents(),
138
  currency: this.get_currency(),
139
  owner: {
140
+ name: this.get_customer_name('billing'),
141
+ email: this.fields.get('billing_email', null)
142
  },
143
  redirect: {
144
  return_url: this.params.return_url
419
 
420
  BECS.prototype.get_confirmation_args = function (obj) {
421
  var args = LocalPayment.prototype.get_confirmation_args.apply(this, arguments);
422
+ args.payment_method.billing_details.email = this.fields.get('billing_email');
423
  return args;
424
  }
425
 
assets/js/frontend/mini-cart.js CHANGED
@@ -18,10 +18,6 @@
18
  return 'cart';
19
  }
20
 
21
- MiniCart.prototype.add_gateway_active_class = function () {
22
- $(this.container).addClass('active');
23
- }
24
-
25
  MiniCart.prototype.init_events = function () {
26
 
27
  }
@@ -34,6 +30,19 @@
34
  $(this.container).find('#' + this.gateway_id + '_' + this.get_page() + '_data').data('gateway', data);
35
  }
36
 
 
 
 
 
 
 
 
 
 
 
 
 
 
37
  /*------------------------- GPay -------------------------*/
38
  function GPay(params) {
39
  MiniCart.apply(this, arguments);
@@ -42,7 +51,7 @@
42
  GPay.prototype = Object.assign({}, wc_stripe.BaseGateway.prototype, MiniCart.prototype, wc_stripe.GooglePay.prototype);
43
 
44
  GPay.prototype.initialize = function () {
45
- this.container = container + ' ' + this.container;
46
  this.createPaymentsClient();
47
  this.isReadyToPay().then(function () {
48
  this.$button.find('.gpay-button').addClass('button');
@@ -55,13 +64,13 @@
55
  */
56
  GPay.prototype.create_button = function () {
57
  wc_stripe.GooglePay.prototype.create_button.apply(this, arguments);
 
 
58
  }
59
 
60
  GPay.prototype.append_button = function () {
61
- if (this.$button && $(this.container).find('.wc-stripe-gpay-mini-cart').is(':empty')) {
62
- $(this.container).find('.wc-stripe-gpay-mini-cart').append(this.$button);
63
- this.add_gateway_active_class();
64
- }
65
  }
66
 
67
  /*------------------------- ApplePay -------------------------*/
@@ -73,16 +82,13 @@
73
 
74
 
75
  ApplePay.prototype.initialize = function () {
76
- this.container = container + ' ' + this.container;
77
  wc_stripe.ApplePay.prototype.initialize.apply(this, arguments);
78
  }
79
 
80
  ApplePay.prototype.append_button = function () {
81
- if (this.$button && $(this.container).find('.wc-stripe-applepay-mini-cart').is(':empty')) {
82
- $(this.container).find('.wc-stripe-applepay-mini-cart').append(this.$button);
83
- this.$button.addClass('button');
84
- this.add_gateway_active_class();
85
- }
86
  }
87
 
88
  /*------------------------- PaymentRequest -------------------------*/
@@ -93,7 +99,7 @@
93
  PaymentRequest.prototype = Object.assign({}, wc_stripe.BaseGateway.prototype, MiniCart.prototype, wc_stripe.PaymentRequest.prototype);
94
 
95
  PaymentRequest.prototype.initialize = function () {
96
- this.container = container + ' ' + this.container;
97
  wc_stripe.PaymentRequest.prototype.initialize.apply(this, arguments);
98
  }
99
 
@@ -102,11 +108,8 @@
102
  }
103
 
104
  PaymentRequest.prototype.append_button = function () {
105
- if ($(this.container).find('.wc-stripe-payment-request-mini-cart').is(':empty')) {
106
- this.paymentRequestButton.mount($(this.container).find('.wc-stripe-payment-request-mini-cart').first()[0]);
107
- $(this.container).find('.wc-stripe-payment-request-mini-cart').addClass('button');
108
- this.add_gateway_active_class();
109
- }
110
  }
111
 
112
  /*-------------------------------------------------------------------------*/
@@ -125,12 +128,13 @@
125
 
126
  function load_mini_cart() {
127
  $('.widget_shopping_cart_content').not(':empty').each(function (idx, el) {
128
- if ($(el).find('.wc-stripe-mini-cart-payment-methods').length) {
129
  var $parent = $(el).parent();
130
  if ($parent.length) {
131
  var class_name = 'wc-stripe-mini-cart-idx-' + idx;
132
  $parent.addClass(class_name);
133
- container = '.' + class_name + ' .widget_shopping_cart_content';
 
134
  gateways.forEach(function (gateway) {
135
  new gateway[0](gateway[1]);
136
  })
18
  return 'cart';
19
  }
20
 
 
 
 
 
21
  MiniCart.prototype.init_events = function () {
22
 
23
  }
30
  $(this.container).find('#' + this.gateway_id + '_' + this.get_page() + '_data').data('gateway', data);
31
  }
32
 
33
+ MiniCart.prototype.on_token_received = function () {
34
+ this.block();
35
+ wc_stripe.BaseGateway.prototype.on_token_received.apply(this, arguments);
36
+ }
37
+
38
+ MiniCart.prototype.block = function () {
39
+ $(this.container).closest('.widget_shopping_cart_content').find('.wc-stripe-overlay').addClass('active');
40
+ }
41
+
42
+ MiniCart.prototype.unblock = function () {
43
+ $(this.container).closest('.widget_shopping_cart_content').find('.wc-stripe-overlay').addClass('active');
44
+ }
45
+
46
  /*------------------------- GPay -------------------------*/
47
  function GPay(params) {
48
  MiniCart.apply(this, arguments);
51
  GPay.prototype = Object.assign({}, wc_stripe.BaseGateway.prototype, MiniCart.prototype, wc_stripe.GooglePay.prototype);
52
 
53
  GPay.prototype.initialize = function () {
54
+ this.container = container;
55
  this.createPaymentsClient();
56
  this.isReadyToPay().then(function () {
57
  this.$button.find('.gpay-button').addClass('button');
64
  */
65
  GPay.prototype.create_button = function () {
66
  wc_stripe.GooglePay.prototype.create_button.apply(this, arguments);
67
+ this.$button = this.$button.find('.gpay-button');
68
+ this.append_button();
69
  }
70
 
71
  GPay.prototype.append_button = function () {
72
+ $(this.container).find('.wc-stripe-gpay-mini-cart').empty();
73
+ $(this.container).find('.wc-stripe-gpay-mini-cart').append(this.$button).show();
 
 
74
  }
75
 
76
  /*------------------------- ApplePay -------------------------*/
82
 
83
 
84
  ApplePay.prototype.initialize = function () {
85
+ this.container = container;
86
  wc_stripe.ApplePay.prototype.initialize.apply(this, arguments);
87
  }
88
 
89
  ApplePay.prototype.append_button = function () {
90
+ $(this.container).find('.wc-stripe-applepay-mini-cart').empty();
91
+ $(this.container).find('.wc-stripe-applepay-mini-cart').append(this.$button).show();
 
 
 
92
  }
93
 
94
  /*------------------------- PaymentRequest -------------------------*/
99
  PaymentRequest.prototype = Object.assign({}, wc_stripe.BaseGateway.prototype, MiniCart.prototype, wc_stripe.PaymentRequest.prototype);
100
 
101
  PaymentRequest.prototype.initialize = function () {
102
+ this.container = container;
103
  wc_stripe.PaymentRequest.prototype.initialize.apply(this, arguments);
104
  }
105
 
108
  }
109
 
110
  PaymentRequest.prototype.append_button = function () {
111
+ $(this.container).find('.wc-stripe-payment-request-mini-cart').empty().show();
112
+ this.paymentRequestButton.mount($(this.container).find('.wc-stripe-payment-request-mini-cart').first()[0]);
 
 
 
113
  }
114
 
115
  /*-------------------------------------------------------------------------*/
128
 
129
  function load_mini_cart() {
130
  $('.widget_shopping_cart_content').not(':empty').each(function (idx, el) {
131
+ if ($(el).find('.wc_stripe_mini_cart_payment_methods').length) {
132
  var $parent = $(el).parent();
133
  if ($parent.length) {
134
  var class_name = 'wc-stripe-mini-cart-idx-' + idx;
135
  $parent.addClass(class_name);
136
+ $parent.find('.widget_shopping_cart_content').prepend('<div class="wc-stripe-overlay"></div>');
137
+ container = '.' + class_name + ' .widget_shopping_cart_content p.buttons';
138
  gateways.forEach(function (gateway) {
139
  new gateway[0](gateway[1]);
140
  })
assets/js/frontend/wc-stripe.js CHANGED
@@ -18,7 +18,7 @@
18
  this.payment_token_received = false;
19
  this.stripe = stripe;
20
  this.elements = stripe.elements($.extend({}, {locale: 'auto'}, this.get_element_options()));
21
- this.mappings = new wc_stripe.CheckoutFields(wc_stripe_checkout_fields);
22
  this.initialize();
23
  }
24
 
@@ -27,7 +27,7 @@
27
  }
28
 
29
  wc_stripe.BaseGateway.prototype.set_nonce = function (value) {
30
- this.mappings.set(this.gateway_id + '_token_key', value);
31
  $(this.token_selector).val(value);
32
  }
33
 
@@ -166,18 +166,18 @@
166
 
167
  /**
168
  * [get_customer_name description]
169
- * @return {[type]} [description]
170
  */
171
  wc_stripe.BaseGateway.prototype.get_customer_name = function (prefix) {
172
- return $(prefix + '_first_name').val() + ' ' + $(prefix + '_last_name').val();
173
  }
174
 
175
  /**
176
  * [get_customer_email description]
177
- * @return {[type]} [description]
178
  */
179
  wc_stripe.BaseGateway.prototype.get_customer_email = function () {
180
- return $('#billing_email').val();
181
  }
182
 
183
  /**
@@ -189,7 +189,7 @@
189
  var params = ['_first_name', '_last_name', '_address_1', '_address_2', '_postcode', '_city', '_state', '_country',];
190
  var hash = "";
191
  for (var i = 0; i < params.length; i++) {
192
- hash += this.mappings.get(prefix + params[i]) + '_';
193
  }
194
  return hash;
195
  }
@@ -309,8 +309,8 @@
309
  pending: true
310
  },
311
  requestPayerName: true,
312
- requestPayerEmail: this.mappings.required('billing_email'),
313
- requestPayerPhone: this.mappings.required('billing_phone'),
314
  requestShipping: this.needs_shipping()
315
  }
316
  var displayItems = this.get_display_items(),
@@ -427,29 +427,29 @@
427
  */
428
  wc_stripe.BaseGateway.prototype.populate_address_fields = function (data) {
429
  if (data.payerName) {
430
- this.mappings.set('name', data.payerName, 'billing');
431
  }
432
  if (data.payerEmail) {
433
- this.mappings.set('email', data.payerEmail, 'billing');
434
  }
435
  if (data.payerPhone) {
436
- this.mappings.set('phone', data.payerPhone, 'billing');
437
  }
438
  if (data.shippingAddress) {
439
  var address = data.shippingAddress;
440
  for (var k in address) {
441
- this.mappings.set(k, address[k], 'shipping');
442
  }
443
  }
444
  if (data.paymentMethod.billing_details.address) {
445
  var address = data.paymentMethod.billing_details.address;
446
  for (var k in address) {
447
- this.mappings.set(k, address[k], 'billing');
448
  }
449
  }
450
  if ('checkout' === this.get_page()) {
451
  this.maybe_set_ship_to_different();
452
- this.mappings.toFormFields();
453
  $('[name="billing_country"]').trigger('change');
454
  }
455
  }
@@ -523,7 +523,7 @@
523
  }
524
 
525
  wc_stripe.BaseGateway.prototype.serialize_fields = function () {
526
- return this.mappings.toJson();
527
  }
528
 
529
  /**
@@ -623,6 +623,7 @@
623
  this.banner_container = 'li.banner_payment_method_' + this.gateway_id;
624
  $(document.body).on('update_checkout', this.update_checkout.bind(this));
625
  $(document.body).on('updated_checkout', this.updated_checkout.bind(this));
 
626
  $(document.body).on('checkout_error', this.checkout_error.bind(this));
627
  $(this.token_selector).closest('form').on('checkout_place_order_' + this.gateway_id, this.checkout_place_order.bind(this));
628
 
@@ -1114,19 +1115,19 @@
1114
  wc_stripe.GooglePay.prototype.populate_address_fields = function (paymentData) {
1115
  var billingAddress = paymentData.paymentMethodData.info.billingAddress;
1116
  for (var k in billingAddress) {
1117
- this.mappings.set(k, billingAddress[k], 'billing');
1118
  }
1119
  if (paymentData.shippingAddress) {
1120
  for (var k in paymentData.shippingAddress) {
1121
- this.mappings.set(k, paymentData.shippingAddress[k], "shipping");
1122
  }
1123
  }
1124
  if (paymentData.email) {
1125
- this.mappings.set('email', paymentData.email, 'billing');
1126
  }
1127
  if ('checkout' === this.get_page()) {
1128
  this.maybe_set_ship_to_different();
1129
- this.mappings.toFormFields();
1130
  $('[name="billing_country"]').trigger('change');
1131
  }
1132
  }
@@ -1221,7 +1222,7 @@
1221
  environment: this.params.environment,
1222
  merchantInfo: this.get_merchant_info()
1223
  }
1224
- if (this.needs_shipping() && (this.get_total_price_cents() > 0)) {
1225
  options.paymentDataCallbacks = {
1226
  onPaymentDataChanged: this.on_payment_data_changed.bind(this),
1227
  onPaymentAuthorized: function (data) {
@@ -1247,7 +1248,7 @@
1247
  */
1248
  wc_stripe.GooglePay.prototype.build_payment_request = function () {
1249
  var request = $.extend({}, googlePayBaseRequest, {
1250
- emailRequired: this.mappings.required('billing_email'),
1251
  merchantInfo: this.get_merchant_info(),
1252
  allowedPaymentMethods: [$.extend({
1253
  type: "CARD",
@@ -1260,7 +1261,7 @@
1260
  }
1261
  }
1262
  }, baseCardPaymentMethod)],
1263
- shippingAddressRequired: this.needs_shipping() && this.get_total_price_cents() > 0,
1264
  transactionInfo: {
1265
  currencyCode: this.get_currency(),
1266
  totalPriceStatus: "ESTIMATED",
@@ -1272,9 +1273,9 @@
1272
  request.allowedPaymentMethods[0].parameters['billingAddressRequired'] = true;
1273
  request.allowedPaymentMethods[0].parameters['billingAddressParameters'] = {
1274
  format: "FULL",
1275
- phoneNumberRequired: this.mappings.required('billing_phone')
1276
  }
1277
- if (this.needs_shipping() && (this.get_total_price_cents() > 0)) {
1278
  request['shippingAddressParameters'] = {};
1279
  request['shippingOptionRequired'] = true;
1280
  request['shippingOptionParameters'] = {
@@ -1471,11 +1472,57 @@
1471
  this.paymentRequestButton.mount('#wc-stripe-payment-request-container');
1472
  }
1473
 
1474
- wc_stripe.CheckoutFields = function (params) {
1475
  this.params = params;
1476
  this.fields = new Map(Object.keys(this.params).map(function (k) {
1477
  return [k, this.params[k].value];
1478
  }.bind(this)));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1479
  }
1480
 
1481
  wc_stripe.CheckoutFields.prototype.set = function (k, v, prefix) {
@@ -1488,19 +1535,30 @@
1488
 
1489
  wc_stripe.CheckoutFields.prototype.get = function (k, prefix) {
1490
  if (this[k] && typeof this[k] === 'function') {
1491
- return this[k]().get.call(this, prefix);
1492
  } else {
1493
- return this.fields.get(k);
 
 
 
 
 
1494
  }
 
1495
  }
1496
 
1497
  /**
1498
  * Return true if the field is required
1499
  * @param k
1500
- * @returns bool
1501
  */
1502
  wc_stripe.CheckoutFields.prototype.required = function (k) {
1503
- return this.params[k] && this.params[k].required;
 
 
 
 
 
1504
  }
1505
 
1506
  wc_stripe.CheckoutFields.prototype.name = function () {
@@ -1715,4 +1773,6 @@
1715
  return;
1716
  }
1717
 
 
 
1718
  }(window, jQuery))
18
  this.payment_token_received = false;
19
  this.stripe = stripe;
20
  this.elements = stripe.elements($.extend({}, {locale: 'auto'}, this.get_element_options()));
21
+ this.fields = checkoutFields;
22
  this.initialize();
23
  }
24
 
27
  }
28
 
29
  wc_stripe.BaseGateway.prototype.set_nonce = function (value) {
30
+ this.fields.set(this.gateway_id + '_token_key', value);
31
  $(this.token_selector).val(value);
32
  }
33
 
166
 
167
  /**
168
  * [get_customer_name description]
169
+ * @return String
170
  */
171
  wc_stripe.BaseGateway.prototype.get_customer_name = function (prefix) {
172
+ return this.fields.get(prefix + '_first_name') + ' ' + this.fields.get(prefix + '_last_name');
173
  }
174
 
175
  /**
176
  * [get_customer_email description]
177
+ * @return {String} [description]
178
  */
179
  wc_stripe.BaseGateway.prototype.get_customer_email = function () {
180
+ return this.fields.get('billing_email');
181
  }
182
 
183
  /**
189
  var params = ['_first_name', '_last_name', '_address_1', '_address_2', '_postcode', '_city', '_state', '_country',];
190
  var hash = "";
191
  for (var i = 0; i < params.length; i++) {
192
+ hash += this.fields.get(prefix + params[i]) + '_';
193
  }
194
  return hash;
195
  }
309
  pending: true
310
  },
311
  requestPayerName: true,
312
+ requestPayerEmail: this.fields.required('billing_email'),
313
+ requestPayerPhone: this.fields.required('billing_phone'),
314
  requestShipping: this.needs_shipping()
315
  }
316
  var displayItems = this.get_display_items(),
427
  */
428
  wc_stripe.BaseGateway.prototype.populate_address_fields = function (data) {
429
  if (data.payerName) {
430
+ this.fields.set('name', data.payerName, 'billing');
431
  }
432
  if (data.payerEmail) {
433
+ this.fields.set('email', data.payerEmail, 'billing');
434
  }
435
  if (data.payerPhone) {
436
+ this.fields.set('phone', data.payerPhone, 'billing');
437
  }
438
  if (data.shippingAddress) {
439
  var address = data.shippingAddress;
440
  for (var k in address) {
441
+ this.fields.set(k, address[k], 'shipping');
442
  }
443
  }
444
  if (data.paymentMethod.billing_details.address) {
445
  var address = data.paymentMethod.billing_details.address;
446
  for (var k in address) {
447
+ this.fields.set(k, address[k], 'billing');
448
  }
449
  }
450
  if ('checkout' === this.get_page()) {
451
  this.maybe_set_ship_to_different();
452
+ this.fields.toFormFields();
453
  $('[name="billing_country"]').trigger('change');
454
  }
455
  }
523
  }
524
 
525
  wc_stripe.BaseGateway.prototype.serialize_fields = function () {
526
+ return this.fields.toJson();
527
  }
528
 
529
  /**
623
  this.banner_container = 'li.banner_payment_method_' + this.gateway_id;
624
  $(document.body).on('update_checkout', this.update_checkout.bind(this));
625
  $(document.body).on('updated_checkout', this.updated_checkout.bind(this));
626
+ $(document.body).on('cfw_updated_checkout', this.updated_checkout.bind(this));
627
  $(document.body).on('checkout_error', this.checkout_error.bind(this));
628
  $(this.token_selector).closest('form').on('checkout_place_order_' + this.gateway_id, this.checkout_place_order.bind(this));
629
 
1115
  wc_stripe.GooglePay.prototype.populate_address_fields = function (paymentData) {
1116
  var billingAddress = paymentData.paymentMethodData.info.billingAddress;
1117
  for (var k in billingAddress) {
1118
+ this.fields.set(k, billingAddress[k], 'billing');
1119
  }
1120
  if (paymentData.shippingAddress) {
1121
  for (var k in paymentData.shippingAddress) {
1122
+ this.fields.set(k, paymentData.shippingAddress[k], "shipping");
1123
  }
1124
  }
1125
  if (paymentData.email) {
1126
+ this.fields.set('email', paymentData.email, 'billing');
1127
  }
1128
  if ('checkout' === this.get_page()) {
1129
  this.maybe_set_ship_to_different();
1130
+ this.fields.toFormFields();
1131
  $('[name="billing_country"]').trigger('change');
1132
  }
1133
  }
1222
  environment: this.params.environment,
1223
  merchantInfo: this.get_merchant_info()
1224
  }
1225
+ if (this.needs_shipping()) {
1226
  options.paymentDataCallbacks = {
1227
  onPaymentDataChanged: this.on_payment_data_changed.bind(this),
1228
  onPaymentAuthorized: function (data) {
1248
  */
1249
  wc_stripe.GooglePay.prototype.build_payment_request = function () {
1250
  var request = $.extend({}, googlePayBaseRequest, {
1251
+ emailRequired: this.fields.required('billing_email'),
1252
  merchantInfo: this.get_merchant_info(),
1253
  allowedPaymentMethods: [$.extend({
1254
  type: "CARD",
1261
  }
1262
  }
1263
  }, baseCardPaymentMethod)],
1264
+ shippingAddressRequired: this.needs_shipping(),
1265
  transactionInfo: {
1266
  currencyCode: this.get_currency(),
1267
  totalPriceStatus: "ESTIMATED",
1273
  request.allowedPaymentMethods[0].parameters['billingAddressRequired'] = true;
1274
  request.allowedPaymentMethods[0].parameters['billingAddressParameters'] = {
1275
  format: "FULL",
1276
+ phoneNumberRequired: this.fields.required('billing_phone')
1277
  }
1278
+ if (this.needs_shipping()) {
1279
  request['shippingAddressParameters'] = {};
1280
  request['shippingOptionRequired'] = true;
1281
  request['shippingOptionParameters'] = {
1472
  this.paymentRequestButton.mount('#wc-stripe-payment-request-container');
1473
  }
1474
 
1475
+ wc_stripe.CheckoutFields = function (params, page) {
1476
  this.params = params;
1477
  this.fields = new Map(Object.keys(this.params).map(function (k) {
1478
  return [k, this.params[k].value];
1479
  }.bind(this)));
1480
+ if ('checkout' === page) {
1481
+ $('form.checkout').on('change', '.input-text, select', this.onChange.bind(this));
1482
+ $('form.checkout').on('change', '[name="ship_to_different_address"]', this.on_ship_to_address_change.bind(this));
1483
+ this.init_i18n();
1484
+ }
1485
+ }
1486
+
1487
+ wc_stripe.CheckoutFields.prototype.init_i18n = function () {
1488
+ if (typeof wc_address_i18n_params !== 'undefined') {
1489
+ this.locales = $.parseJSON(wc_address_i18n_params.locale.replace(/&quot;/g, '"'));
1490
+ } else {
1491
+ this.locales = null;
1492
+ }
1493
+ }
1494
+
1495
+ wc_stripe.CheckoutFields.prototype.onChange = function (e) {
1496
+ try {
1497
+ var name = e.currentTarget.name, value = e.currentTarget.value;
1498
+ this.fields.set(name, value);
1499
+
1500
+ if (name === 'billing_country' || name === 'shipping_country') {
1501
+ this.update_required_fields(value, name);
1502
+ }
1503
+ } catch (err) {
1504
+ console.log(err);
1505
+ }
1506
+ }
1507
+
1508
+ wc_stripe.CheckoutFields.prototype.update_required_fields = function (country, name) {
1509
+ if (this.locales) {
1510
+ var prefix = name.indexOf('billing_') > -1 ? 'billing_' : 'shipping_';
1511
+ var locale = typeof this.locales[country] !== 'undefined' ? this.locales[country] : this.locales['default'];
1512
+ var fields = $.extend(true, {}, this.locales['default'], locale);
1513
+ for (var k in fields) {
1514
+ var k2 = prefix + k;
1515
+ if (this.params[k2]) {
1516
+ this.params[k2] = $.extend(true, {}, this.params[k2], fields[k]);
1517
+ }
1518
+ }
1519
+ }
1520
+ }
1521
+
1522
+ wc_stripe.CheckoutFields.prototype.on_ship_to_address_change = function (e) {
1523
+ if ($(e.currentTarget).is(':checked')) {
1524
+ this.update_required_fields($('shipping_country'), 'shipping_country');
1525
+ }
1526
  }
1527
 
1528
  wc_stripe.CheckoutFields.prototype.set = function (k, v, prefix) {
1535
 
1536
  wc_stripe.CheckoutFields.prototype.get = function (k, prefix) {
1537
  if (this[k] && typeof this[k] === 'function') {
1538
+ var value = this[k]().get.call(this, prefix);
1539
  } else {
1540
+ var value = this.fields.get(k);
1541
+ if (typeof value === 'undefined' || value === null || value === '') {
1542
+ if (typeof prefix !== 'undefined') {
1543
+ value = prefix;
1544
+ }
1545
+ }
1546
  }
1547
+ return typeof value === 'undefined' ? '' : value;
1548
  }
1549
 
1550
  /**
1551
  * Return true if the field is required
1552
  * @param k
1553
+ * @returns boolean
1554
  */
1555
  wc_stripe.CheckoutFields.prototype.required = function (k) {
1556
+ if (this.params[k]) {
1557
+ if (typeof this.params[k].required !== 'undefined') {
1558
+ return this.params[k].required;
1559
+ }
1560
+ }
1561
+ return false;
1562
  }
1563
 
1564
  wc_stripe.CheckoutFields.prototype.name = function () {
1773
  return;
1774
  }
1775
 
1776
+ var checkoutFields = new wc_stripe.CheckoutFields(wc_stripe_checkout_fields, wc_stripe_params_v3.page);
1777
+
1778
  }(window, jQuery))
assets/js/frontend/wc-stripe.min.js CHANGED
@@ -1 +1 @@
1
- !function(t,e){t.wc_stripe={};var i=null;"undefined"==typeof wc_stripe_checkout_fields&&(wc_stripe_checkout_fields=[]),wc_stripe.BaseGateway=function(t){this.params=t,this.gateway_id=this.params.gateway_id,this.container="li.payment_method_"+this.gateway_id,this.token_selector=this.params.token_selector,this.saved_method_selector=this.params.saved_method_selector,this.payment_token_received=!1,this.stripe=i,this.elements=i.elements(e.extend({},{locale:"auto"},this.get_element_options())),this.mappings=new wc_stripe.CheckoutFields(wc_stripe_checkout_fields),this.initialize()},wc_stripe.BaseGateway.prototype.get_page=function(){return wc_stripe_params_v3.page},wc_stripe.BaseGateway.prototype.set_nonce=function(t){this.mappings.set(this.gateway_id+"_token_key",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=this.get_error_message(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.get_error_message=function(t){return"object"==typeof t&&t.code&&(t=wc_stripe_messages[t.code]?wc_stripe_messages[t.code]:t.message),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.scroll_to_notices?e.scroll_to_notices(i):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"add_payment_method"===this.get_page()||e(document.body).hasClass("woocommerce-add-payment-method")},wc_stripe.BaseGateway.prototype.is_change_payment_method=function(){return"change_payment_method"===this.get_page()},wc_stripe.BaseGateway.prototype.get_selected_payment_method=function(){return e(this.saved_method_selector).val()},wc_stripe.BaseGateway.prototype.needs_shipping=function(){return this.get_gateway_data().needs_shipping},wc_stripe.BaseGateway.prototype.get_currency=function(){return this.get_gateway_data().currency},wc_stripe.BaseGateway.prototype.get_gateway_data=function(){return e("#"+this.gateway_id+"_"+this.get_page()+"_data").data("gateway")},wc_stripe.BaseGateway.prototype.set_gateway_data=function(t){e("#"+this.gateway_id+"_"+this.get_page()+"_data").data("gateway",t)},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 e=["_first_name","_last_name","_address_1","_address_2","_postcode","_city","_state","_country"],i="",s=0;s<e.length;s++)i+=this.mappings.get(t+e[s])+"_";return i},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 this.get_gateway_data().total},wc_stripe.BaseGateway.prototype.get_total_price_cents=function(){return this.get_gateway_data().total_cents},wc_stripe.BaseGateway.prototype.set_total_price=function(t){var e=this.get_gateway_data();e.total=t,this.set_gateway_data(e)},wc_stripe.BaseGateway.prototype.set_total_price_cents=function(t){var e=this.get_gateway_data();e.total_cents=t,this.set_gateway_data(e)},wc_stripe.BaseGateway.prototype.set_payment_method=function(t){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 s=t[i];e('[name="shipping_method['+i+']"][value="'+s+'"]').prop("checked",!0).trigger("change")}},wc_stripe.BaseGateway.prototype.on_token_received=function(t){this.payment_token_received=!0,this.set_nonce(t.id),this.process_checkout()},wc_stripe.BaseGateway.prototype.createPaymentRequest=function(){try{this.paymentRequest=i.paymentRequest(this.get_payment_request_options())}catch(t){return void this.submit_error(t.message)}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:this.mappings.required("billing_email"),requestPayerPhone:this.mappings.required("billing_phone"),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}},s=this.get_display_items(),a=this.get_shipping_options();return s&&(i.displayItems=s),this.needs_shipping()&&a&&(i.shippingOptions=a),t&&(i=e.extend(!0,{},i,t)),i},wc_stripe.BaseGateway.prototype.get_display_items=function(){return this.get_gateway_data().items},wc_stripe.BaseGateway.prototype.set_display_items=function(t){var e=this.get_gateway_data();e.items=t,this.set_gateway_data(e)},wc_stripe.BaseGateway.prototype.get_shipping_options=function(){return this.get_gateway_data().shipping_options},wc_stripe.BaseGateway.prototype.set_shipping_options=function(t){var e=this.get_gateway_data();e.shipping_options=t,this.set_gateway_data(e)},wc_stripe.BaseGateway.prototype.map_address=function(t){return{city:t.city,postcode:t.postalCode,state:t.region,country:t.country}},wc_stripe.BaseGateway.prototype.on_payment_method_received=function(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){this.set_nonce(t.paymentMethod.id),this.populate_address_fields(t)},wc_stripe.BaseGateway.prototype.populate_address_fields=function(t){if(t.payerName&&this.mappings.set("name",t.payerName,"billing"),t.payerEmail&&this.mappings.set("email",t.payerEmail,"billing"),t.payerPhone&&this.mappings.set("phone",t.payerPhone,"billing"),t.shippingAddress){var i=t.shippingAddress;for(var s in i)this.mappings.set(s,i[s],"shipping")}if(t.paymentMethod.billing_details.address){i=t.paymentMethod.billing_details.address;for(var s in i)this.mappings.set(s,i[s],"billing")}"checkout"===this.get_page()&&(this.maybe_set_ship_to_different(),this.mappings.toFormFields(),e('[name="billing_country"]').trigger("change"))},wc_stripe.BaseGateway.prototype.address_mappings=function(){return new wc_stripe.CheckoutFields},wc_stripe.BaseGateway.prototype.ajax_before_send=function(t){this.params.user_id>0&&t.setRequestHeader("X-WP-Nonce",this.params.rest_nonce)},wc_stripe.BaseGateway.prototype.process_checkout=function(){return new Promise(function(i,s){this.block(),e.ajax({url:this.params.routes.checkout,method:"POST",dataType:"json",data:e.extend({},this.serialize_fields(),{payment_method:this.gateway_id,page_id:this.get_page()}),beforeSend:this.ajax_before_send.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(),s={};for(var a in i){var n=i[a];s[n.name]=n.value}return s.payment_method=this.gateway_id,s},wc_stripe.BaseGateway.prototype.serialize_fields=function(){return this.mappings.toJson()},wc_stripe.BaseGateway.prototype.map_shipping_methods=function(t){var e={};if("default"!==t){var i=t.match(/^([\w+]):(.+)$/);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,s){e.ajax({url:this.params.routes.shipping_address,method:"POST",dataType:"json",data:{address:this.map_address(t.shippingAddress),payment_method:this.gateway_id,page_id:this.get_page()},beforeSend:this.ajax_before_send.bind(this)}).done(function(e){e.code?(t.updateWith(e.data.newData),s(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,s){e.ajax({url:this.params.routes.shipping_method,method:"POST",dataType:"json",data:{shipping_method:t.shippingOption.id,payment_method:this.gateway_id,page_id:this.get_page()},beforeSend:this.ajax_before_send.bind(this)}).done(function(e){e.code?(t.updateWith(e.data.newData),s(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.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(".wc-stripe-banner-checkout").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],s=e[2];this.gateway_id===i&&(this.payment_token_received=!0,this.set_nonce(s),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,this.set_nonce(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.CheckoutGateway.prototype.checkout_fields_valid=function(){if("undefined"==typeof wc_stripe_checkout_fields||"checkout"!==this.get_page())return!0;function t(t,i){for(var s in i){var a=i[s];if(s.indexOf(t)>-1&&a.required&&e("#"+s).length){var n=e("#"+s).val();if(void 0===n||0==n.length)return void(valid=!1)}}}return valid=!0,t("billing",wc_stripe_checkout_fields),this.needs_shipping()&&e("#ship-to-different-address-checkbox").is(":checked")&&t("shipping",wc_stripe_checkout_fields),valid&&(valid=this.is_valid_checkout()),valid},wc_stripe.ProductGateway=function(){this.message_container="div.product",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();var t=e(".single_add_to_cart_button").css("marginLeft");t&&(this.buttonWidth+=parseInt(t.replace("px",""))),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_gateway_data();i.product.price=e.display_price,i.needs_shipping=!e.is_virtual,i.product.variation=e,this.set_gateway_data(i),this.enable_payment_button()},wc_stripe.ProductGateway.prototype.reset_variation_data=function(){var t=this.get_product_data();t.variation=!1,this.set_product_data(t),this.disable_payment_button()},wc_stripe.ProductGateway.prototype.disable_payment_button=function(){this.$button&&this.get_button().prop("disabled",!0).addClass("disabled")},wc_stripe.ProductGateway.prototype.enable_payment_button=function(){this.$button&&this.get_button().prop("disabled",!1).removeClass("disabled")},wc_stripe.ProductGateway.prototype.get_button=function(){return this.$button},wc_stripe.ProductGateway.prototype.is_variable_product=function(){return e('[name="variation_id"]').length>0},wc_stripe.ProductGateway.prototype.variable_product_selected=function(){return!1!==this.get_product_data().variation},wc_stripe.ProductGateway.prototype.get_product_data=function(){return this.get_gateway_data().product},wc_stripe.ProductGateway.prototype.set_product_data=function(t){var e=this.get_gateway_data();e.product=t,this.set_gateway_data(e)},wc_stripe.ProductGateway.prototype.add_to_cart=function(){return new Promise(function(t,i){this.block(),e.ajax({url:this.params.routes.add_to_cart,method:"POST",dataType:"json",data:{product_id:this.get_product_data().id,variation_id:this.is_variable_product()?e('[name="variation_id"]').val():0,qty:e('[name="quantity"]').val(),payment_method:this.gateway_id,page_id:this.get_page()},beforeSend:this.ajax_before_send.bind(this)}).done(function(e,s,a){this.unblock(),e.code?(this.submit_error(e.message),i(e)):(this.set_total_price(e.data.total),this.set_total_price_cents(e.data.totalCents),this.set_display_items(e.data.displayItems),t(e.data))}.bind(this)).fail(function(t,e,i){this.unblock(),this.submit_error(i)}.bind(this))}.bind(this))},wc_stripe.ProductGateway.prototype.cart_calculation=function(t){return new Promise(function(i,s){e.ajax({url:this.params.routes.cart_calculation,method:"POST",dataType:"json",data:{product_id:this.get_product_data().id,variation_id:this.is_variable_product()&&t?t:0,qty:e('[name="quantity"]').val(),payment_method:this.gateway_id},beforeSend:this.ajax_before_send.bind(this)}).done(function(t,e,a){t.code?(this.cart_calculation_error=!0,s(t)):(this.set_total_price(t.data.total),this.set_total_price_cents(t.data.totalCents),this.set_display_items(t.data.displayItems),i(t.data))}.bind(this)).fail(function(t,e,i){}.bind(this))}.bind(this))},wc_stripe.CartGateway=function(){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)),e(document.body).on("wc_cart_emptied",this.cart_emptied.bind(this))},wc_stripe.CartGateway.prototype.submit_error=function(t){this.submit_message(this.get_error_message(t))},wc_stripe.CartGateway.prototype.updated_html=function(t){},wc_stripe.CartGateway.prototype.cart_emptied=function(t){},wc_stripe.CartGateway.prototype.add_cart_totals_class=function(){e(".cart_totals").addClass("stripe_cart_gateway_active")},wc_stripe.GooglePay=function(){};const s={apiVersion:2,apiVersionMinor:0},a={type:"CARD",parameters:{allowedAuthMethods:["PAN_ONLY"],allowedCardNetworks:["AMEX","DISCOVER","INTERAC","JCB","MASTERCARD","VISA"]}};wc_stripe.GooglePay.prototype.populate_address_fields=function(t){var i=t.paymentMethodData.info.billingAddress;for(var s in i)this.mappings.set(s,i[s],"billing");if(t.shippingAddress)for(var s in t.shippingAddress)this.mappings.set(s,t.shippingAddress[s],"shipping");t.email&&this.mappings.set("email",t.email,"billing"),"checkout"===this.get_page()&&(this.maybe_set_ship_to_different(),this.mappings.toFormFields(),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,s){var a="default"==t.shippingOptionData.id?null:t.shippingOptionData.id;e.when(e.ajax({url:this.params.routes.payment_data,dataType:"json",method:"POST",data:{shipping_address:this.map_address(t.shippingAddress),shipping_method:a,page_id:this.get_page()},beforeSend:this.ajax_before_send.bind(this)})).done(function(t){t.code?s(t.data.data):i(t.data)}.bind(this)).fail(function(){s()}.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_merchant_info=function(){var t={merchantId:this.params.merchant_id,merchantName:this.params.merchant_name};return"TEST"===this.params.environment&&delete t.merchantId,t},wc_stripe.GooglePay.prototype.get_payment_options=function(){var t={environment:this.params.environment,merchantInfo:this.get_merchant_info()};return 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({},s,{emailRequired:this.mappings.required("billing_email"),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}}},a)],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_display_items(),totalPriceLabel:this.params.total_price_label}});return t.allowedPaymentMethods[0].parameters.billingAddressRequired=!0,t.allowedPaymentMethods[0].parameters.billingAddressParameters={format:"FULL",phoneNumberRequired:this.mappings.required("billing_phone")},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({},s);i.allowedPaymentMethods=[a],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(){var t=".apple-pay-button";["checkout","order_pay"].indexOf(this.get_page())<0&&(t=this.container+" .apple-pay-button"),e(document.body).on("click",t,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")},wc_stripe.CheckoutFields=function(t){this.params=t,this.fields=new Map(Object.keys(this.params).map(function(t){return[t,this.params[t].value]}.bind(this)))},wc_stripe.CheckoutFields.prototype.set=function(t,e,i){this[t]&&"function"==typeof this[t]?this[t]().set.call(this,e,i):this.fields.set(t,e)},wc_stripe.CheckoutFields.prototype.get=function(t,e){return this[t]&&"function"==typeof this[t]?this[t]().get.call(this,e):this.fields.get(t)},wc_stripe.CheckoutFields.prototype.required=function(t){return this.params[t]&&this.params[t].required},wc_stripe.CheckoutFields.prototype.name=function(){return{set:function(t,e){var i=t.split(" ");this.fields.set(e+"_first_name",i[0]),this.fields.set(e+"_last_name",i[1])},get:function(t){return this.fields.get(t+"_first_name")+" "+this.fields.get(t+"_last_name")}}},wc_stripe.CheckoutFields.prototype.payerName=function(){return wc_stripe.CheckoutFields.prototype.name.apply(this,arguments)},wc_stripe.CheckoutFields.prototype.email=function(){return{set:function(t,e){this.fields.set(e+"_email",t)},get:function(t){return this.fields.get(t+"_email")}}},wc_stripe.CheckoutFields.prototype.payerEmail=function(){return wc_stripe.CheckoutFields.prototype.email.apply(this,arguments)},wc_stripe.CheckoutFields.prototype.phone=function(){return{set:function(t,e){this.fields.set(e+"_phone",t)},get:function(t){return this.fields.get(t+"_phone")}}},wc_stripe.CheckoutFields.prototype.payerPhone=function(){return wc_stripe.CheckoutFields.prototype.phone.apply(this,arguments)},wc_stripe.CheckoutFields.prototype.phoneNumber=function(){return wc_stripe.CheckoutFields.prototype.phone.apply(this,arguments)},wc_stripe.CheckoutFields.prototype.recipient=function(){return{set:function(t,e){var i=t.split(" ");i.length>0&&this.fields.set(e+"_first_name",i[0]),i.length>1&&this.fields.set(e+"_last_name",i[1])},get:function(t){return this.fields.get(t+"_first_name")+" "+this.fields.get(t+"_last_name")}}},wc_stripe.CheckoutFields.prototype.country=function(){return{set:function(t,e){this.fields.set(e+"_country",t)},get:function(t){return this.fields.get(t+"_country")}}},wc_stripe.CheckoutFields.prototype.countryCode=function(){return wc_stripe.CheckoutFields.prototype.country.apply(this,arguments)},wc_stripe.CheckoutFields.prototype.address1=function(){return{set:function(t,e){this.fields.set(e+"_address_1",t)},get:function(t){return this.fields.get(t+"_address_1")}}},wc_stripe.CheckoutFields.prototype.address2=function(){return{set:function(t,e){this.fields.set(e+"_address_2",t)},get:function(t){this.fields.get(t+"_address_2")}}},wc_stripe.CheckoutFields.prototype.line1=function(){return wc_stripe.CheckoutFields.prototype.address1.apply(this,arguments)},wc_stripe.CheckoutFields.prototype.line2=function(){return wc_stripe.CheckoutFields.prototype.address2.apply(this,arguments)},wc_stripe.CheckoutFields.prototype.addressLine=function(){return{set:function(t,e){t.length>0&&this.fields.set(e+"_address_1",t[0]),t.length>1&&this.fields.set(e+"_address_2",t[1])},get:function(t){return[this.fields.get(t+"_address_1"),this.fields.get(t+"_address_2")]}}},wc_stripe.CheckoutFields.prototype.state=function(){return{set:function(t,e){this.fields.set(e+"_state",t)},get:function(t){return this.fields.get(t+"_state")}}},wc_stripe.CheckoutFields.prototype.region=function(){return wc_stripe.CheckoutFields.prototype.state.apply(this,arguments)},wc_stripe.CheckoutFields.prototype.administrativeArea=function(){return wc_stripe.CheckoutFields.prototype.state.apply(this,arguments)},wc_stripe.CheckoutFields.prototype.city=function(){return{set:function(t,e){this.fields.set(e+"_city",t)},get:function(t){this.fields.get(t+"_city")}}},wc_stripe.CheckoutFields.prototype.locality=function(){return wc_stripe.CheckoutFields.prototype.city.apply(this,arguments)},wc_stripe.CheckoutFields.prototype.postal_code=function(){return{set:function(t,e){this.fields.set(e+"_postcode",t)},get:function(t){this.fields.get(t+"_postcode")}}},wc_stripe.CheckoutFields.prototype.postalCode=function(){return wc_stripe.CheckoutFields.prototype.postal_code.apply(this,arguments)},wc_stripe.CheckoutFields.prototype.toJson=function(){var t={};return this.fields.forEach(function(e,i){t[i]=e}),t},wc_stripe.CheckoutFields.prototype.toFormFields=function(){this.fields.forEach(function(t,i){e(i='[name="'+i+'"]').length&&""!==t&&e(i).val(t)})};try{i=Stripe(wc_stripe_params_v3.api_key,{stripeAccount:wc_stripe_params_v3.account})}catch(e){return t.alert(e),void console.log(e)}}(window,jQuery);
1
+ !function(t,e){t.wc_stripe={};var i=null;"undefined"==typeof wc_stripe_checkout_fields&&(wc_stripe_checkout_fields=[]),wc_stripe.BaseGateway=function(t){this.params=t,this.gateway_id=this.params.gateway_id,this.container="li.payment_method_"+this.gateway_id,this.token_selector=this.params.token_selector,this.saved_method_selector=this.params.saved_method_selector,this.payment_token_received=!1,this.stripe=i,this.elements=i.elements(e.extend({},{locale:"auto"},this.get_element_options())),this.fields=o,this.initialize()},wc_stripe.BaseGateway.prototype.get_page=function(){return wc_stripe_params_v3.page},wc_stripe.BaseGateway.prototype.set_nonce=function(t){this.fields.set(this.gateway_id+"_token_key",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=this.get_error_message(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.get_error_message=function(t){return"object"==typeof t&&t.code&&(t=wc_stripe_messages[t.code]?wc_stripe_messages[t.code]:t.message),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.scroll_to_notices?e.scroll_to_notices(i):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"add_payment_method"===this.get_page()||e(document.body).hasClass("woocommerce-add-payment-method")},wc_stripe.BaseGateway.prototype.is_change_payment_method=function(){return"change_payment_method"===this.get_page()},wc_stripe.BaseGateway.prototype.get_selected_payment_method=function(){return e(this.saved_method_selector).val()},wc_stripe.BaseGateway.prototype.needs_shipping=function(){return this.get_gateway_data().needs_shipping},wc_stripe.BaseGateway.prototype.get_currency=function(){return this.get_gateway_data().currency},wc_stripe.BaseGateway.prototype.get_gateway_data=function(){return e("#"+this.gateway_id+"_"+this.get_page()+"_data").data("gateway")},wc_stripe.BaseGateway.prototype.set_gateway_data=function(t){e("#"+this.gateway_id+"_"+this.get_page()+"_data").data("gateway",t)},wc_stripe.BaseGateway.prototype.get_customer_name=function(t){return this.fields.get(t+"_first_name")+" "+this.fields.get(t+"_last_name")},wc_stripe.BaseGateway.prototype.get_customer_email=function(){return this.fields.get("billing_email")},wc_stripe.BaseGateway.prototype.get_address_field_hash=function(t){for(var e=["_first_name","_last_name","_address_1","_address_2","_postcode","_city","_state","_country"],i="",s=0;s<e.length;s++)i+=this.fields.get(t+e[s])+"_";return i},wc_stripe.BaseGateway.prototype.block=function(){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 this.get_gateway_data().total},wc_stripe.BaseGateway.prototype.get_total_price_cents=function(){return this.get_gateway_data().total_cents},wc_stripe.BaseGateway.prototype.set_total_price=function(t){var e=this.get_gateway_data();e.total=t,this.set_gateway_data(e)},wc_stripe.BaseGateway.prototype.set_total_price_cents=function(t){var e=this.get_gateway_data();e.total_cents=t,this.set_gateway_data(e)},wc_stripe.BaseGateway.prototype.set_payment_method=function(t){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 s=t[i];e('[name="shipping_method['+i+']"][value="'+s+'"]').prop("checked",!0).trigger("change")}},wc_stripe.BaseGateway.prototype.on_token_received=function(t){this.payment_token_received=!0,this.set_nonce(t.id),this.process_checkout()},wc_stripe.BaseGateway.prototype.createPaymentRequest=function(){try{this.paymentRequest=i.paymentRequest(this.get_payment_request_options())}catch(t){return void this.submit_error(t.message)}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:this.fields.required("billing_email"),requestPayerPhone:this.fields.required("billing_phone"),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}},s=this.get_display_items(),a=this.get_shipping_options();return s&&(i.displayItems=s),this.needs_shipping()&&a&&(i.shippingOptions=a),t&&(i=e.extend(!0,{},i,t)),i},wc_stripe.BaseGateway.prototype.get_display_items=function(){return this.get_gateway_data().items},wc_stripe.BaseGateway.prototype.set_display_items=function(t){var e=this.get_gateway_data();e.items=t,this.set_gateway_data(e)},wc_stripe.BaseGateway.prototype.get_shipping_options=function(){return this.get_gateway_data().shipping_options},wc_stripe.BaseGateway.prototype.set_shipping_options=function(t){var e=this.get_gateway_data();e.shipping_options=t,this.set_gateway_data(e)},wc_stripe.BaseGateway.prototype.map_address=function(t){return{city:t.city,postcode:t.postalCode,state:t.region,country:t.country}},wc_stripe.BaseGateway.prototype.on_payment_method_received=function(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){this.set_nonce(t.paymentMethod.id),this.populate_address_fields(t)},wc_stripe.BaseGateway.prototype.populate_address_fields=function(t){if(t.payerName&&this.fields.set("name",t.payerName,"billing"),t.payerEmail&&this.fields.set("email",t.payerEmail,"billing"),t.payerPhone&&this.fields.set("phone",t.payerPhone,"billing"),t.shippingAddress){var i=t.shippingAddress;for(var s in i)this.fields.set(s,i[s],"shipping")}if(t.paymentMethod.billing_details.address){i=t.paymentMethod.billing_details.address;for(var s in i)this.fields.set(s,i[s],"billing")}"checkout"===this.get_page()&&(this.maybe_set_ship_to_different(),this.fields.toFormFields(),e('[name="billing_country"]').trigger("change"))},wc_stripe.BaseGateway.prototype.address_mappings=function(){return new wc_stripe.CheckoutFields},wc_stripe.BaseGateway.prototype.ajax_before_send=function(t){this.params.user_id>0&&t.setRequestHeader("X-WP-Nonce",this.params.rest_nonce)},wc_stripe.BaseGateway.prototype.process_checkout=function(){return new Promise(function(i,s){this.block(),e.ajax({url:this.params.routes.checkout,method:"POST",dataType:"json",data:e.extend({},this.serialize_fields(),{payment_method:this.gateway_id,page_id:this.get_page()}),beforeSend:this.ajax_before_send.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(),s={};for(var a in i){var o=i[a];s[o.name]=o.value}return s.payment_method=this.gateway_id,s},wc_stripe.BaseGateway.prototype.serialize_fields=function(){return this.fields.toJson()},wc_stripe.BaseGateway.prototype.map_shipping_methods=function(t){var e={};if("default"!==t){var i=t.match(/^([\w+]):(.+)$/);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,s){e.ajax({url:this.params.routes.shipping_address,method:"POST",dataType:"json",data:{address:this.map_address(t.shippingAddress),payment_method:this.gateway_id,page_id:this.get_page()},beforeSend:this.ajax_before_send.bind(this)}).done(function(e){e.code?(t.updateWith(e.data.newData),s(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,s){e.ajax({url:this.params.routes.shipping_method,method:"POST",dataType:"json",data:{shipping_method:t.shippingOption.id,payment_method:this.gateway_id,page_id:this.get_page()},beforeSend:this.ajax_before_send.bind(this)}).done(function(e){e.code?(t.updateWith(e.data.newData),s(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.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("cfw_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(".wc-stripe-banner-checkout").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],s=e[2];this.gateway_id===i&&(this.payment_token_received=!0,this.set_nonce(s),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,this.set_nonce(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.CheckoutGateway.prototype.checkout_fields_valid=function(){if("undefined"==typeof wc_stripe_checkout_fields||"checkout"!==this.get_page())return!0;function t(t,i){for(var s in i){var a=i[s];if(s.indexOf(t)>-1&&a.required&&e("#"+s).length){var o=e("#"+s).val();if(void 0===o||0==o.length)return void(valid=!1)}}}return valid=!0,t("billing",wc_stripe_checkout_fields),this.needs_shipping()&&e("#ship-to-different-address-checkbox").is(":checked")&&t("shipping",wc_stripe_checkout_fields),valid&&(valid=this.is_valid_checkout()),valid},wc_stripe.ProductGateway=function(){this.message_container="div.product",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();var t=e(".single_add_to_cart_button").css("marginLeft");t&&(this.buttonWidth+=parseInt(t.replace("px",""))),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_gateway_data();i.product.price=e.display_price,i.needs_shipping=!e.is_virtual,i.product.variation=e,this.set_gateway_data(i),this.enable_payment_button()},wc_stripe.ProductGateway.prototype.reset_variation_data=function(){var t=this.get_product_data();t.variation=!1,this.set_product_data(t),this.disable_payment_button()},wc_stripe.ProductGateway.prototype.disable_payment_button=function(){this.$button&&this.get_button().prop("disabled",!0).addClass("disabled")},wc_stripe.ProductGateway.prototype.enable_payment_button=function(){this.$button&&this.get_button().prop("disabled",!1).removeClass("disabled")},wc_stripe.ProductGateway.prototype.get_button=function(){return this.$button},wc_stripe.ProductGateway.prototype.is_variable_product=function(){return e('[name="variation_id"]').length>0},wc_stripe.ProductGateway.prototype.variable_product_selected=function(){return!1!==this.get_product_data().variation},wc_stripe.ProductGateway.prototype.get_product_data=function(){return this.get_gateway_data().product},wc_stripe.ProductGateway.prototype.set_product_data=function(t){var e=this.get_gateway_data();e.product=t,this.set_gateway_data(e)},wc_stripe.ProductGateway.prototype.add_to_cart=function(){return new Promise(function(t,i){this.block(),e.ajax({url:this.params.routes.add_to_cart,method:"POST",dataType:"json",data:{product_id:this.get_product_data().id,variation_id:this.is_variable_product()?e('[name="variation_id"]').val():0,qty:e('[name="quantity"]').val(),payment_method:this.gateway_id,page_id:this.get_page()},beforeSend:this.ajax_before_send.bind(this)}).done(function(e,s,a){this.unblock(),e.code?(this.submit_error(e.message),i(e)):(this.set_total_price(e.data.total),this.set_total_price_cents(e.data.totalCents),this.set_display_items(e.data.displayItems),t(e.data))}.bind(this)).fail(function(t,e,i){this.unblock(),this.submit_error(i)}.bind(this))}.bind(this))},wc_stripe.ProductGateway.prototype.cart_calculation=function(t){return new Promise(function(i,s){e.ajax({url:this.params.routes.cart_calculation,method:"POST",dataType:"json",data:{product_id:this.get_product_data().id,variation_id:this.is_variable_product()&&t?t:0,qty:e('[name="quantity"]').val(),payment_method:this.gateway_id},beforeSend:this.ajax_before_send.bind(this)}).done(function(t,e,a){t.code?(this.cart_calculation_error=!0,s(t)):(this.set_total_price(t.data.total),this.set_total_price_cents(t.data.totalCents),this.set_display_items(t.data.displayItems),i(t.data))}.bind(this)).fail(function(t,e,i){}.bind(this))}.bind(this))},wc_stripe.CartGateway=function(){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)),e(document.body).on("wc_cart_emptied",this.cart_emptied.bind(this))},wc_stripe.CartGateway.prototype.submit_error=function(t){this.submit_message(this.get_error_message(t))},wc_stripe.CartGateway.prototype.updated_html=function(t){},wc_stripe.CartGateway.prototype.cart_emptied=function(t){},wc_stripe.CartGateway.prototype.add_cart_totals_class=function(){e(".cart_totals").addClass("stripe_cart_gateway_active")},wc_stripe.GooglePay=function(){};const s={apiVersion:2,apiVersionMinor:0},a={type:"CARD",parameters:{allowedAuthMethods:["PAN_ONLY"],allowedCardNetworks:["AMEX","DISCOVER","INTERAC","JCB","MASTERCARD","VISA"]}};wc_stripe.GooglePay.prototype.populate_address_fields=function(t){var i=t.paymentMethodData.info.billingAddress;for(var s in i)this.fields.set(s,i[s],"billing");if(t.shippingAddress)for(var s in t.shippingAddress)this.fields.set(s,t.shippingAddress[s],"shipping");t.email&&this.fields.set("email",t.email,"billing"),"checkout"===this.get_page()&&(this.maybe_set_ship_to_different(),this.fields.toFormFields(),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,s){var a="default"==t.shippingOptionData.id?null:t.shippingOptionData.id;e.when(e.ajax({url:this.params.routes.payment_data,dataType:"json",method:"POST",data:{shipping_address:this.map_address(t.shippingAddress),shipping_method:a,page_id:this.get_page()},beforeSend:this.ajax_before_send.bind(this)})).done(function(t){t.code?s(t.data.data):i(t.data)}.bind(this)).fail(function(){s()}.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_merchant_info=function(){var t={merchantId:this.params.merchant_id,merchantName:this.params.merchant_name};return"TEST"===this.params.environment&&delete t.merchantId,t},wc_stripe.GooglePay.prototype.get_payment_options=function(){var t={environment:this.params.environment,merchantInfo:this.get_merchant_info()};return this.needs_shipping()?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({},s,{emailRequired:this.fields.required("billing_email"),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}}},a)],shippingAddressRequired:this.needs_shipping(),transactionInfo:{currencyCode:this.get_currency(),totalPriceStatus:"ESTIMATED",totalPrice:this.get_total_price().toString(),displayItems:this.get_display_items(),totalPriceLabel:this.params.total_price_label}});return t.allowedPaymentMethods[0].parameters.billingAddressRequired=!0,t.allowedPaymentMethods[0].parameters.billingAddressParameters={format:"FULL",phoneNumberRequired:this.fields.required("billing_phone")},this.needs_shipping()?(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({},s);i.allowedPaymentMethods=[a],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(){var t=".apple-pay-button";["checkout","order_pay"].indexOf(this.get_page())<0&&(t=this.container+" .apple-pay-button"),e(document.body).on("click",t,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")},wc_stripe.CheckoutFields=function(t,i){this.params=t,this.fields=new Map(Object.keys(this.params).map(function(t){return[t,this.params[t].value]}.bind(this))),"checkout"===i&&(e("form.checkout").on("change",".input-text, select",this.onChange.bind(this)),e("form.checkout").on("change",'[name="ship_to_different_address"]',this.on_ship_to_address_change.bind(this)),this.init_i18n())},wc_stripe.CheckoutFields.prototype.init_i18n=function(){"undefined"!=typeof wc_address_i18n_params?this.locales=e.parseJSON(wc_address_i18n_params.locale.replace(/&quot;/g,'"')):this.locales=null},wc_stripe.CheckoutFields.prototype.onChange=function(t){try{var e=t.currentTarget.name,i=t.currentTarget.value;this.fields.set(e,i),"billing_country"!==e&&"shipping_country"!==e||this.update_required_fields(i,e)}catch(t){console.log(t)}},wc_stripe.CheckoutFields.prototype.update_required_fields=function(t,i){if(this.locales){var s=i.indexOf("billing_")>-1?"billing_":"shipping_",a=void 0!==this.locales[t]?this.locales[t]:this.locales.default,o=e.extend(!0,{},this.locales.default,a);for(var n in o){var r=s+n;this.params[r]&&(this.params[r]=e.extend(!0,{},this.params[r],o[n]))}}},wc_stripe.CheckoutFields.prototype.on_ship_to_address_change=function(t){e(t.currentTarget).is(":checked")&&this.update_required_fields(e("shipping_country"),"shipping_country")},wc_stripe.CheckoutFields.prototype.set=function(t,e,i){this[t]&&"function"==typeof this[t]?this[t]().set.call(this,e,i):this.fields.set(t,e)},wc_stripe.CheckoutFields.prototype.get=function(t,e){if(this[t]&&"function"==typeof this[t])var i=this[t]().get.call(this,e);else null!=(i=this.fields.get(t))&&""!==i||void 0!==e&&(i=e);return void 0===i?"":i},wc_stripe.CheckoutFields.prototype.required=function(t){return!(!this.params[t]||void 0===this.params[t].required)&&this.params[t].required},wc_stripe.CheckoutFields.prototype.name=function(){return{set:function(t,e){var i=t.split(" ");this.fields.set(e+"_first_name",i[0]),this.fields.set(e+"_last_name",i[1])},get:function(t){return this.fields.get(t+"_first_name")+" "+this.fields.get(t+"_last_name")}}},wc_stripe.CheckoutFields.prototype.payerName=function(){return wc_stripe.CheckoutFields.prototype.name.apply(this,arguments)},wc_stripe.CheckoutFields.prototype.email=function(){return{set:function(t,e){this.fields.set(e+"_email",t)},get:function(t){return this.fields.get(t+"_email")}}},wc_stripe.CheckoutFields.prototype.payerEmail=function(){return wc_stripe.CheckoutFields.prototype.email.apply(this,arguments)},wc_stripe.CheckoutFields.prototype.phone=function(){return{set:function(t,e){this.fields.set(e+"_phone",t)},get:function(t){return this.fields.get(t+"_phone")}}},wc_stripe.CheckoutFields.prototype.payerPhone=function(){return wc_stripe.CheckoutFields.prototype.phone.apply(this,arguments)},wc_stripe.CheckoutFields.prototype.phoneNumber=function(){return wc_stripe.CheckoutFields.prototype.phone.apply(this,arguments)},wc_stripe.CheckoutFields.prototype.recipient=function(){return{set:function(t,e){var i=t.split(" ");i.length>0&&this.fields.set(e+"_first_name",i[0]),i.length>1&&this.fields.set(e+"_last_name",i[1])},get:function(t){return this.fields.get(t+"_first_name")+" "+this.fields.get(t+"_last_name")}}},wc_stripe.CheckoutFields.prototype.country=function(){return{set:function(t,e){this.fields.set(e+"_country",t)},get:function(t){return this.fields.get(t+"_country")}}},wc_stripe.CheckoutFields.prototype.countryCode=function(){return wc_stripe.CheckoutFields.prototype.country.apply(this,arguments)},wc_stripe.CheckoutFields.prototype.address1=function(){return{set:function(t,e){this.fields.set(e+"_address_1",t)},get:function(t){return this.fields.get(t+"_address_1")}}},wc_stripe.CheckoutFields.prototype.address2=function(){return{set:function(t,e){this.fields.set(e+"_address_2",t)},get:function(t){this.fields.get(t+"_address_2")}}},wc_stripe.CheckoutFields.prototype.line1=function(){return wc_stripe.CheckoutFields.prototype.address1.apply(this,arguments)},wc_stripe.CheckoutFields.prototype.line2=function(){return wc_stripe.CheckoutFields.prototype.address2.apply(this,arguments)},wc_stripe.CheckoutFields.prototype.addressLine=function(){return{set:function(t,e){t.length>0&&this.fields.set(e+"_address_1",t[0]),t.length>1&&this.fields.set(e+"_address_2",t[1])},get:function(t){return[this.fields.get(t+"_address_1"),this.fields.get(t+"_address_2")]}}},wc_stripe.CheckoutFields.prototype.state=function(){return{set:function(t,e){this.fields.set(e+"_state",t)},get:function(t){return this.fields.get(t+"_state")}}},wc_stripe.CheckoutFields.prototype.region=function(){return wc_stripe.CheckoutFields.prototype.state.apply(this,arguments)},wc_stripe.CheckoutFields.prototype.administrativeArea=function(){return wc_stripe.CheckoutFields.prototype.state.apply(this,arguments)},wc_stripe.CheckoutFields.prototype.city=function(){return{set:function(t,e){this.fields.set(e+"_city",t)},get:function(t){this.fields.get(t+"_city")}}},wc_stripe.CheckoutFields.prototype.locality=function(){return wc_stripe.CheckoutFields.prototype.city.apply(this,arguments)},wc_stripe.CheckoutFields.prototype.postal_code=function(){return{set:function(t,e){this.fields.set(e+"_postcode",t)},get:function(t){this.fields.get(t+"_postcode")}}},wc_stripe.CheckoutFields.prototype.postalCode=function(){return wc_stripe.CheckoutFields.prototype.postal_code.apply(this,arguments)},wc_stripe.CheckoutFields.prototype.toJson=function(){var t={};return this.fields.forEach(function(e,i){t[i]=e}),t},wc_stripe.CheckoutFields.prototype.toFormFields=function(){this.fields.forEach(function(t,i){e(i='[name="'+i+'"]').length&&""!==t&&e(i).val(t)})};try{i=Stripe(wc_stripe_params_v3.api_key,{stripeAccount:wc_stripe_params_v3.account})}catch(e){return t.alert(e),void console.log(e)}var o=new wc_stripe.CheckoutFields(wc_stripe_checkout_fields,wc_stripe_params_v3.page)}(window,jQuery);
i18n/languages/woo-stripe-payment.pot CHANGED
@@ -2,14 +2,14 @@
2
  # This file is distributed under the same license as the Stripe For WooCommerce plugin.
3
  msgid ""
4
  msgstr ""
5
- "Project-Id-Version: Stripe For WooCommerce 3.1.8\n"
6
  "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/woo-stripe-payment\n"
7
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
8
  "Language-Team: LANGUAGE <LL@li.org>\n"
9
  "MIME-Version: 1.0\n"
10
  "Content-Type: text/plain; charset=UTF-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
12
- "POT-Creation-Date: 2020-08-12T01:31:30+00:00\n"
13
  "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
14
  "X-Generator: WP-CLI 2.4.0\n"
15
  "X-Domain: woo-stripe-payment\n"
@@ -98,119 +98,119 @@ msgstr ""
98
  msgid " & billing country is <strong>%s</strong>"
99
  msgstr ""
100
 
101
- #: includes/abstract/abstract-wc-payment-gateway-stripe.php:423
102
- #: includes/controllers/class-wc-stripe-controller-cart.php:132
103
- #: includes/controllers/class-wc-stripe-controller-cart.php:195
104
- #: includes/controllers/class-wc-stripe-controller-googlepay.php:133
105
  #: includes/gateways/class-wc-payment-gateway-stripe-googlepay.php:103
106
  msgid "Total"
107
  msgstr ""
108
 
109
- #: includes/abstract/abstract-wc-payment-gateway-stripe.php:483
110
  msgid "User must be logged in."
111
  msgstr ""
112
 
113
- #: includes/abstract/abstract-wc-payment-gateway-stripe.php:495
114
  msgid "Error saving your payment method. Reason: %s"
115
  msgstr ""
116
 
117
- #: includes/abstract/abstract-wc-payment-gateway-stripe.php:510
118
  msgid "Error saving payment method. Reason: %s"
119
  msgstr ""
120
 
121
- #: includes/abstract/abstract-wc-payment-gateway-stripe.php:529
122
  msgid "Order refunded in Stripe. Amount: %s"
123
  msgstr ""
124
 
125
- #: includes/abstract/abstract-wc-payment-gateway-stripe.php:567
126
  msgid "Order amount captured in Stripe. Amount: %s"
127
  msgstr ""
128
 
129
- #: includes/abstract/abstract-wc-payment-gateway-stripe.php:577
130
  msgid "Error capturing charge in Stripe. Reason: %s"
131
  msgstr ""
132
 
133
- #: includes/abstract/abstract-wc-payment-gateway-stripe.php:598
134
  msgid "Error voiding charge. Reason: %s"
135
  msgstr ""
136
 
137
- #: includes/abstract/abstract-wc-payment-gateway-stripe.php:600
138
  msgid "Charge voided in Stripe."
139
  msgstr ""
140
 
141
- #: includes/abstract/abstract-wc-payment-gateway-stripe.php:770
142
  msgid "n/a"
143
  msgstr ""
144
 
145
- #: includes/abstract/abstract-wc-payment-gateway-stripe.php:798
146
  #: includes/admin/meta-boxes/views/html-order-pay.php:42
147
  msgid "New Card"
148
  msgstr ""
149
 
150
- #: includes/abstract/abstract-wc-payment-gateway-stripe.php:802
151
  #: includes/admin/meta-boxes/views/html-order-pay.php:30
152
  msgid "Saved Cards"
153
  msgstr ""
154
 
155
- #: includes/abstract/abstract-wc-payment-gateway-stripe.php:987
156
  msgid "Attemp to save payment method failed. Reason: %s"
157
  msgstr ""
158
 
159
- #: includes/abstract/abstract-wc-payment-gateway-stripe.php:1009
160
  msgid "We were not able to save your payment method. To prevent billing issues with your subscription, please add a payment method to the subscription."
161
  msgstr ""
162
 
163
- #: includes/abstract/abstract-wc-payment-gateway-stripe.php:1011
164
  msgid "We were not able to save your payment method. Reason: %s"
165
  msgstr ""
166
 
167
- #: includes/abstract/abstract-wc-payment-gateway-stripe.php:1045
168
  msgid "Payment Method Token"
169
  msgstr ""
170
 
171
- #: includes/abstract/abstract-wc-payment-gateway-stripe.php:1065
172
  msgid "Recurring payment for order failed. Reason: %s"
173
  msgstr ""
174
 
175
- #: includes/abstract/abstract-wc-payment-gateway-stripe.php:1078
176
  msgid "Recurring payment captured in Stripe. Payment method: %s"
177
  msgstr ""
178
 
179
- #: includes/abstract/abstract-wc-payment-gateway-stripe.php:1080
180
  msgid "Recurring payment authorized in Stripe. Payment method: %s"
181
  msgstr ""
182
 
183
- #: includes/abstract/abstract-wc-payment-gateway-stripe.php:1083
184
- #: includes/abstract/abstract-wc-payment-gateway-stripe.php:1342
185
  msgid "Customer must manually complete payment for payment method %s"
186
  msgstr ""
187
 
188
- #: includes/abstract/abstract-wc-payment-gateway-stripe.php:1099
189
  msgid "Error saving payment method for subscription. Reason: %s"
190
  msgstr ""
191
 
192
- #: includes/abstract/abstract-wc-payment-gateway-stripe.php:1160
193
  #: includes/abstract/abstract-wc-stripe-payment.php:219
194
  msgid "Order %1$s from %2$s"
195
  msgstr ""
196
 
197
- #: includes/abstract/abstract-wc-payment-gateway-stripe.php:1329
198
  msgid "Pre-order payment for order failed. Reason: %s"
199
  msgstr ""
200
 
201
- #: includes/abstract/abstract-wc-payment-gateway-stripe.php:1337
202
  msgid "Pre-order payment captured in Stripe. Payment method: %s"
203
  msgstr ""
204
 
205
- #: includes/abstract/abstract-wc-payment-gateway-stripe.php:1339
206
  msgid "Pre-order payment authorized in Stripe. Payment method: %s"
207
  msgstr ""
208
 
209
- #: includes/abstract/abstract-wc-payment-gateway-stripe.php:1411
210
  msgid "Cannot process payment"
211
  msgstr ""
212
 
213
- #: includes/abstract/abstract-wc-payment-gateway-stripe.php:1419
214
  msgid "Increase your conversion rate by offering %1$s on your Product and Cart pages, or at the top of the checkout page. <br/><strong>Note:</strong> you can control which products display %s by going to the product edit page."
215
  msgstr ""
216
 
@@ -325,7 +325,7 @@ msgstr ""
325
 
326
  #: includes/admin/meta-boxes/views/html-charge-data-subview.php:25
327
  #: includes/admin/settings/class-wc-stripe-api-settings.php:38
328
- #: includes/controllers/class-wc-stripe-controller-gateway-settings.php:193
329
  msgid "Live"
330
  msgstr ""
331
 
@@ -483,7 +483,7 @@ msgid "API Settings"
483
  msgstr ""
484
 
485
  #: includes/admin/settings/class-wc-stripe-api-settings.php:37
486
- #: includes/controllers/class-wc-stripe-controller-gateway-settings.php:193
487
  msgid "Test"
488
  msgstr ""
489
 
@@ -638,7 +638,7 @@ msgstr ""
638
  msgid "Your payment is being processed and your order status will be updated once the funds are received."
639
  msgstr ""
640
 
641
- #: includes/class-wc-stripe-frontend-scripts.php:65
642
  msgid "No matches found"
643
  msgstr ""
644
 
@@ -666,52 +666,52 @@ msgstr ""
666
  msgid "Thank you for updating Stripe for WooCommerce to version %1$s."
667
  msgstr ""
668
 
669
- #: includes/controllers/class-wc-stripe-controller-cart.php:88
670
  msgid "Quantity must be greater than zero."
671
  msgstr ""
672
 
673
- #: includes/controllers/class-wc-stripe-controller-checkout.php:231
674
  msgid "Some required fields were missing. Please click %1$shere%2$s to complete your payment."
675
  msgstr ""
676
 
677
- #: includes/controllers/class-wc-stripe-controller-checkout.php:280
678
  msgid "Please review your order details then click Place Order."
679
  msgstr ""
680
 
681
- #: includes/controllers/class-wc-stripe-controller-gateway-settings.php:91
682
  msgid "You cannot register your domain until you have configured your Live API keys."
683
  msgstr ""
684
 
685
- #: includes/controllers/class-wc-stripe-controller-gateway-settings.php:120
686
  msgid "Domain registered successfully. You can confirm in your Stripe Dashboard at https://dashboard.stripe.com/account/apple_pay."
687
  msgstr ""
688
 
689
- #: includes/controllers/class-wc-stripe-controller-gateway-settings.php:144
690
  msgid "You must configure your secret key before creating webhooks."
691
  msgstr ""
692
 
693
- #: includes/controllers/class-wc-stripe-controller-gateway-settings.php:157
694
  msgid "There is already a webhook configured for this site. If you want to delete the webhook, login to your Stripe Dashboard."
695
  msgstr ""
696
 
697
- #: includes/controllers/class-wc-stripe-controller-gateway-settings.php:191
698
  msgid "Webhook created in Stripe for %s environment. You can test your webhook by logging in to the Stripe dashboard"
699
  msgstr ""
700
 
701
- #: includes/controllers/class-wc-stripe-controller-gateway-settings.php:214
702
  msgid "Mode: %s. Invalid secret key. Please check your entry."
703
  msgstr ""
704
 
705
- #: includes/controllers/class-wc-stripe-controller-gateway-settings.php:226
706
- #: includes/controllers/class-wc-stripe-controller-gateway-settings.php:229
707
  msgid "Mode: %s. Invalid publishable key. Please check your entry."
708
  msgstr ""
709
 
710
- #: includes/controllers/class-wc-stripe-controller-gateway-settings.php:235
711
  msgid "Connection test to Stripe was successful. Mode: %s."
712
  msgstr ""
713
 
714
- #: includes/controllers/class-wc-stripe-controller-googlepay.php:86
715
  msgid "Your shipping address is not serviceable."
716
  msgstr ""
717
 
@@ -732,20 +732,20 @@ msgstr ""
732
  msgid "Order customer Id and payment method customer Id do not match."
733
  msgstr ""
734
 
735
- #: includes/controllers/class-wc-stripe-controller-payment-intent.php:56
736
  msgid "Error creating payment intent. Reason: %s"
737
  msgstr ""
738
 
739
- #: includes/controllers/class-wc-stripe-controller-payment-intent.php:72
740
  msgid "Invalid order id provided"
741
  msgstr ""
742
 
743
- #: includes/controllers/class-wc-stripe-controller-payment-intent.php:78
744
  msgid "You are not authorized to update this order."
745
  msgstr ""
746
 
 
747
  #: includes/controllers/class-wc-stripe-controller-webhook.php:52
748
- #: includes/controllers/class-wc-stripe-controller-webhook.php:53
749
  msgid "Invalid signature received. Verify that your webhook secret is correct."
750
  msgstr ""
751
 
@@ -911,27 +911,27 @@ msgstr ""
911
  #: includes/gateways/class-wc-payment-gateway-stripe-googlepay.php:154
912
  #: includes/gateways/class-wc-payment-gateway-stripe-googlepay.php:217
913
  #: includes/gateways/class-wc-payment-gateway-stripe-klarna.php:189
914
- #: includes/wc-stripe-functions.php:403
915
- #: includes/wc-stripe-functions.php:468
916
  msgid "Shipping"
917
  msgstr ""
918
 
919
  #: includes/gateways/class-wc-payment-gateway-stripe-googlepay.php:162
920
  #: includes/gateways/class-wc-payment-gateway-stripe-googlepay.php:239
921
  #: includes/gateways/class-wc-payment-gateway-stripe-klarna.php:199
922
- #: includes/wc-stripe-functions.php:420
923
- #: includes/wc-stripe-functions.php:476
924
  msgid "Discount"
925
  msgstr ""
926
 
927
  #: includes/gateways/class-wc-payment-gateway-stripe-googlepay.php:173
928
- #: includes/wc-stripe-functions.php:487
929
  msgid "Fees"
930
  msgstr ""
931
 
932
  #: includes/gateways/class-wc-payment-gateway-stripe-googlepay.php:253
933
  #: includes/gateways/class-wc-payment-gateway-stripe-klarna.php:221
934
- #: includes/wc-stripe-functions.php:428
935
  msgid "Tax"
936
  msgstr ""
937
 
@@ -1640,218 +1640,218 @@ msgstr ""
1640
  msgid "Kind Regards,"
1641
  msgstr ""
1642
 
1643
- #: includes/wc-stripe-functions.php:810
1644
  msgid "Bootstrap form"
1645
  msgstr ""
1646
 
1647
- #: includes/wc-stripe-functions.php:836
1648
  msgid "Simple form"
1649
  msgstr ""
1650
 
1651
- #: includes/wc-stripe-functions.php:859
1652
  msgid "Minimalist form"
1653
  msgstr ""
1654
 
1655
- #: includes/wc-stripe-functions.php:885
1656
  msgid "Inline Form"
1657
  msgstr ""
1658
 
1659
- #: includes/wc-stripe-functions.php:907
1660
  msgid "Rounded Form"
1661
  msgstr ""
1662
 
1663
- #: includes/wc-stripe-functions.php:1122
1664
  msgid "There was an error processing your credit card."
1665
  msgstr ""
1666
 
1667
- #: includes/wc-stripe-functions.php:1123
1668
  msgid "Your card number is incomplete."
1669
  msgstr ""
1670
 
1671
- #: includes/wc-stripe-functions.php:1124
1672
  msgid "The card number is incorrect. Check the card's number or use a different card."
1673
  msgstr ""
1674
 
1675
- #: includes/wc-stripe-functions.php:1125
1676
  msgid "The card's security code is incorrect. Check the card's security code or use a different card."
1677
  msgstr ""
1678
 
1679
- #: includes/wc-stripe-functions.php:1126
1680
  msgid "The card's ZIP code is incorrect. Check the card's ZIP code or use a different card."
1681
  msgstr ""
1682
 
1683
- #: includes/wc-stripe-functions.php:1127
1684
- #: includes/wc-stripe-functions.php:1132
1685
  msgid "The card number is invalid. Check the card details or use a different card."
1686
  msgstr ""
1687
 
1688
- #: includes/wc-stripe-functions.php:1128
1689
  msgid "This value provided to the field contains characters that are unsupported by the field."
1690
  msgstr ""
1691
 
1692
- #: includes/wc-stripe-functions.php:1129
1693
  msgid "The card's security code is invalid. Check the card's security code or use a different card."
1694
  msgstr ""
1695
 
1696
- #: includes/wc-stripe-functions.php:1130
1697
  msgid "The card's expiration month is incorrect. Check the expiration date or use a different card."
1698
  msgstr ""
1699
 
1700
- #: includes/wc-stripe-functions.php:1131
1701
  msgid "The card's expiration year is incorrect. Check the expiration date or use a different card."
1702
  msgstr ""
1703
 
1704
- #: includes/wc-stripe-functions.php:1133
1705
  msgid "The card's address is incorrect. Check the card's address or use a different card."
1706
  msgstr ""
1707
 
1708
- #: includes/wc-stripe-functions.php:1134
1709
  msgid "The card has expired. Check the expiration date or use a different card."
1710
  msgstr ""
1711
 
1712
- #: includes/wc-stripe-functions.php:1135
1713
  msgid "The card has been declined."
1714
  msgstr ""
1715
 
1716
- #: includes/wc-stripe-functions.php:1136
1717
  msgid "Your card's expiration year is in the past."
1718
  msgstr ""
1719
 
1720
- #: includes/wc-stripe-functions.php:1137
1721
  msgid "The bank account number provided is invalid (e.g., missing digits). Bank account information varies from country to country. We recommend creating validations in your entry forms based on the bank account formats we provide."
1722
  msgstr ""
1723
 
1724
- #: includes/wc-stripe-functions.php:1138
1725
  msgid "The specified amount is greater than the maximum amount allowed. Use a lower amount and try again."
1726
  msgstr ""
1727
 
1728
- #: includes/wc-stripe-functions.php:1139
1729
  msgid "The specified amount is less than the minimum amount allowed. Use a higher amount and try again."
1730
  msgstr ""
1731
 
1732
- #: includes/wc-stripe-functions.php:1140
1733
  msgid "The payment requires authentication to proceed. If your customer is off session, notify your customer to return to your application and complete the payment. If you provided the error_on_requires_action parameter, then your customer should try another card that does not require authentication."
1734
  msgstr ""
1735
 
1736
- #: includes/wc-stripe-functions.php:1141
1737
  msgid "The transfer or payout could not be completed because the associated account does not have a sufficient balance available. Create a new transfer or payout using an amount less than or equal to the account's available balance."
1738
  msgstr ""
1739
 
1740
- #: includes/wc-stripe-functions.php:1142
1741
  msgid "The bank account provided can not be used to charge, either because it is not verified yet or it is not supported."
1742
  msgstr ""
1743
 
1744
- #: includes/wc-stripe-functions.php:1143
1745
  msgid "The bank account provided already exists on the specified Customer object. If the bank account should also be attached to a different customer, include the correct customer ID when making the request again."
1746
  msgstr ""
1747
 
1748
- #: includes/wc-stripe-functions.php:1144
1749
  msgid "The bank account provided cannot be used for payouts. A different bank account must be used."
1750
  msgstr ""
1751
 
1752
- #: includes/wc-stripe-functions.php:1145
1753
  msgid "Your Connect platform is attempting to share an unverified bank account with a connected account."
1754
  msgstr ""
1755
 
1756
- #: includes/wc-stripe-functions.php:1146
1757
  msgid "The bank account cannot be verified, either because the microdeposit amounts provided do not match the actual amounts, or because verification has failed too many times."
1758
  msgstr ""
1759
 
1760
- #: includes/wc-stripe-functions.php:1147
1761
  msgid "This card has been declined too many times. You can try to charge this card again after 24 hours. We suggest reaching out to your customer to make sure they have entered all of their information correctly and that there are no issues with their card."
1762
  msgstr ""
1763
 
1764
- #: includes/wc-stripe-functions.php:1148
1765
  msgid "The charge you're attempting to capture has already been captured. Update the request with an uncaptured charge ID."
1766
  msgstr ""
1767
 
1768
- #: includes/wc-stripe-functions.php:1149
1769
  msgid "The charge you're attempting to refund has already been refunded. Update the request to use the ID of a charge that has not been refunded."
1770
  msgstr ""
1771
 
1772
- #: includes/wc-stripe-functions.php:1150
1773
  msgid "The charge you're attempting to refund has been charged back. Check the disputes documentation to learn how to respond to the dispute."
1774
  msgstr ""
1775
 
1776
- #: includes/wc-stripe-functions.php:1151
1777
  msgid "This charge would cause you to exceed your rolling-window processing limit for this source type. Please retry the charge later, or contact us to request a higher processing limit."
1778
  msgstr ""
1779
 
1780
- #: includes/wc-stripe-functions.php:1152
1781
  msgid "The charge cannot be captured as the authorization has expired. Auth and capture charges must be captured within seven days."
1782
  msgstr ""
1783
 
1784
- #: includes/wc-stripe-functions.php:1153
1785
  msgid "One or more provided parameters was not allowed for the given operation on the Charge. Check our API reference or the returned error message to see which values were not correct for that Charge."
1786
  msgstr ""
1787
 
1788
- #: includes/wc-stripe-functions.php:1154
1789
  msgid "The email address is invalid (e.g., not properly formatted). Check that the email address is properly formatted and only includes allowed characters."
1790
  msgstr ""
1791
 
1792
- #: includes/wc-stripe-functions.php:1155
1793
  msgid "The idempotency key provided is currently being used in another request. This occurs if your integration is making duplicate requests simultaneously."
1794
  msgstr ""
1795
 
1796
- #: includes/wc-stripe-functions.php:1156
1797
  msgid "The specified amount is invalid. The charge amount must be a positive integer in the smallest currency unit, and not exceed the minimum or maximum amount."
1798
  msgstr ""
1799
 
1800
- #: includes/wc-stripe-functions.php:1157
1801
  msgid "The source cannot be used because it is not in the correct state (e.g., a charge request is trying to use a source with a pending, failed, or consumed source). Check the status of the source you are attempting to use."
1802
  msgstr ""
1803
 
1804
- #: includes/wc-stripe-functions.php:1158
1805
  msgid "Both a customer and source ID have been provided, but the source has not been saved to the customer. To create a charge for a customer with a specified source, you must first save the card details."
1806
  msgstr ""
1807
 
1808
- #: includes/wc-stripe-functions.php:1159
1809
  msgid "The ZIP code provided was incorrect."
1810
  msgstr ""
1811
 
1812
- #: includes/wc-stripe-functions.php:1160
1813
  msgid "An error occurred while processing the card. Try again later or with a different payment method."
1814
  msgstr ""
1815
 
1816
- #: includes/wc-stripe-functions.php:1161
1817
  msgid "The card does not support this type of purchase."
1818
  msgstr ""
1819
 
1820
- #: includes/wc-stripe-functions.php:1162
1821
- #: includes/wc-stripe-functions.php:1165
1822
- #: includes/wc-stripe-functions.php:1167
1823
  msgid "The card has been declined for an unknown reason."
1824
  msgstr ""
1825
 
1826
- #: includes/wc-stripe-functions.php:1163
1827
  msgid "The customer has exceeded the balance or credit limit available on their card."
1828
  msgstr ""
1829
 
1830
- #: includes/wc-stripe-functions.php:1164
1831
  msgid "The card does not support the specified currency."
1832
  msgstr ""
1833
 
1834
- #: includes/wc-stripe-functions.php:1166
1835
  msgid "The payment has been declined as Stripe suspects it is fraudulent."
1836
  msgstr ""
1837
 
1838
- #: includes/wc-stripe-functions.php:1168
1839
  msgid "The PIN entered is incorrect. "
1840
  msgstr ""
1841
 
1842
- #: includes/wc-stripe-functions.php:1169
1843
  msgid "The card has insufficient funds to complete the purchase."
1844
  msgstr ""
1845
 
1846
- #: includes/wc-stripe-functions.php:1170
1847
  msgid "Please select a payment method before proceeding."
1848
  msgstr ""
1849
 
1850
- #: includes/wc-stripe-functions.php:1171
1851
  msgid "Please enter your IBAN before proceeding."
1852
  msgstr ""
1853
 
1854
- #: includes/wc-stripe-functions.php:1172
1855
  msgid "Please select a bank before proceeding"
1856
  msgstr ""
1857
 
2
  # This file is distributed under the same license as the Stripe For WooCommerce plugin.
3
  msgid ""
4
  msgstr ""
5
+ "Project-Id-Version: Stripe For WooCommerce 3.2.0\n"
6
  "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/woo-stripe-payment\n"
7
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
8
  "Language-Team: LANGUAGE <LL@li.org>\n"
9
  "MIME-Version: 1.0\n"
10
  "Content-Type: text/plain; charset=UTF-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
12
+ "POT-Creation-Date: 2020-08-19T05:32:27+00:00\n"
13
  "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
14
  "X-Generator: WP-CLI 2.4.0\n"
15
  "X-Domain: woo-stripe-payment\n"
98
  msgid " & billing country is <strong>%s</strong>"
99
  msgstr ""
100
 
101
+ #: includes/abstract/abstract-wc-payment-gateway-stripe.php:421
102
+ #: includes/controllers/class-wc-stripe-controller-cart.php:136
103
+ #: includes/controllers/class-wc-stripe-controller-cart.php:199
104
+ #: includes/controllers/class-wc-stripe-controller-googlepay.php:136
105
  #: includes/gateways/class-wc-payment-gateway-stripe-googlepay.php:103
106
  msgid "Total"
107
  msgstr ""
108
 
109
+ #: includes/abstract/abstract-wc-payment-gateway-stripe.php:481
110
  msgid "User must be logged in."
111
  msgstr ""
112
 
113
+ #: includes/abstract/abstract-wc-payment-gateway-stripe.php:493
114
  msgid "Error saving your payment method. Reason: %s"
115
  msgstr ""
116
 
117
+ #: includes/abstract/abstract-wc-payment-gateway-stripe.php:508
118
  msgid "Error saving payment method. Reason: %s"
119
  msgstr ""
120
 
121
+ #: includes/abstract/abstract-wc-payment-gateway-stripe.php:527
122
  msgid "Order refunded in Stripe. Amount: %s"
123
  msgstr ""
124
 
125
+ #: includes/abstract/abstract-wc-payment-gateway-stripe.php:565
126
  msgid "Order amount captured in Stripe. Amount: %s"
127
  msgstr ""
128
 
129
+ #: includes/abstract/abstract-wc-payment-gateway-stripe.php:575
130
  msgid "Error capturing charge in Stripe. Reason: %s"
131
  msgstr ""
132
 
133
+ #: includes/abstract/abstract-wc-payment-gateway-stripe.php:596
134
  msgid "Error voiding charge. Reason: %s"
135
  msgstr ""
136
 
137
+ #: includes/abstract/abstract-wc-payment-gateway-stripe.php:598
138
  msgid "Charge voided in Stripe."
139
  msgstr ""
140
 
141
+ #: includes/abstract/abstract-wc-payment-gateway-stripe.php:768
142
  msgid "n/a"
143
  msgstr ""
144
 
145
+ #: includes/abstract/abstract-wc-payment-gateway-stripe.php:796
146
  #: includes/admin/meta-boxes/views/html-order-pay.php:42
147
  msgid "New Card"
148
  msgstr ""
149
 
150
+ #: includes/abstract/abstract-wc-payment-gateway-stripe.php:800
151
  #: includes/admin/meta-boxes/views/html-order-pay.php:30
152
  msgid "Saved Cards"
153
  msgstr ""
154
 
155
+ #: includes/abstract/abstract-wc-payment-gateway-stripe.php:985
156
  msgid "Attemp to save payment method failed. Reason: %s"
157
  msgstr ""
158
 
159
+ #: includes/abstract/abstract-wc-payment-gateway-stripe.php:1007
160
  msgid "We were not able to save your payment method. To prevent billing issues with your subscription, please add a payment method to the subscription."
161
  msgstr ""
162
 
163
+ #: includes/abstract/abstract-wc-payment-gateway-stripe.php:1009
164
  msgid "We were not able to save your payment method. Reason: %s"
165
  msgstr ""
166
 
167
+ #: includes/abstract/abstract-wc-payment-gateway-stripe.php:1043
168
  msgid "Payment Method Token"
169
  msgstr ""
170
 
171
+ #: includes/abstract/abstract-wc-payment-gateway-stripe.php:1063
172
  msgid "Recurring payment for order failed. Reason: %s"
173
  msgstr ""
174
 
175
+ #: includes/abstract/abstract-wc-payment-gateway-stripe.php:1076
176
  msgid "Recurring payment captured in Stripe. Payment method: %s"
177
  msgstr ""
178
 
179
+ #: includes/abstract/abstract-wc-payment-gateway-stripe.php:1078
180
  msgid "Recurring payment authorized in Stripe. Payment method: %s"
181
  msgstr ""
182
 
183
+ #: includes/abstract/abstract-wc-payment-gateway-stripe.php:1081
184
+ #: includes/abstract/abstract-wc-payment-gateway-stripe.php:1340
185
  msgid "Customer must manually complete payment for payment method %s"
186
  msgstr ""
187
 
188
+ #: includes/abstract/abstract-wc-payment-gateway-stripe.php:1097
189
  msgid "Error saving payment method for subscription. Reason: %s"
190
  msgstr ""
191
 
192
+ #: includes/abstract/abstract-wc-payment-gateway-stripe.php:1158
193
  #: includes/abstract/abstract-wc-stripe-payment.php:219
194
  msgid "Order %1$s from %2$s"
195
  msgstr ""
196
 
197
+ #: includes/abstract/abstract-wc-payment-gateway-stripe.php:1327
198
  msgid "Pre-order payment for order failed. Reason: %s"
199
  msgstr ""
200
 
201
+ #: includes/abstract/abstract-wc-payment-gateway-stripe.php:1335
202
  msgid "Pre-order payment captured in Stripe. Payment method: %s"
203
  msgstr ""
204
 
205
+ #: includes/abstract/abstract-wc-payment-gateway-stripe.php:1337
206
  msgid "Pre-order payment authorized in Stripe. Payment method: %s"
207
  msgstr ""
208
 
209
+ #: includes/abstract/abstract-wc-payment-gateway-stripe.php:1409
210
  msgid "Cannot process payment"
211
  msgstr ""
212
 
213
+ #: includes/abstract/abstract-wc-payment-gateway-stripe.php:1417
214
  msgid "Increase your conversion rate by offering %1$s on your Product and Cart pages, or at the top of the checkout page. <br/><strong>Note:</strong> you can control which products display %s by going to the product edit page."
215
  msgstr ""
216
 
325
 
326
  #: includes/admin/meta-boxes/views/html-charge-data-subview.php:25
327
  #: includes/admin/settings/class-wc-stripe-api-settings.php:38
328
+ #: includes/controllers/class-wc-stripe-controller-gateway-settings.php:184
329
  msgid "Live"
330
  msgstr ""
331
 
483
  msgstr ""
484
 
485
  #: includes/admin/settings/class-wc-stripe-api-settings.php:37
486
+ #: includes/controllers/class-wc-stripe-controller-gateway-settings.php:184
487
  msgid "Test"
488
  msgstr ""
489
 
638
  msgid "Your payment is being processed and your order status will be updated once the funds are received."
639
  msgstr ""
640
 
641
+ #: includes/class-wc-stripe-frontend-scripts.php:74
642
  msgid "No matches found"
643
  msgstr ""
644
 
666
  msgid "Thank you for updating Stripe for WooCommerce to version %1$s."
667
  msgstr ""
668
 
669
+ #: includes/controllers/class-wc-stripe-controller-cart.php:92
670
  msgid "Quantity must be greater than zero."
671
  msgstr ""
672
 
673
+ #: includes/controllers/class-wc-stripe-controller-checkout.php:228
674
  msgid "Some required fields were missing. Please click %1$shere%2$s to complete your payment."
675
  msgstr ""
676
 
677
+ #: includes/controllers/class-wc-stripe-controller-checkout.php:277
678
  msgid "Please review your order details then click Place Order."
679
  msgstr ""
680
 
681
+ #: includes/controllers/class-wc-stripe-controller-gateway-settings.php:82
682
  msgid "You cannot register your domain until you have configured your Live API keys."
683
  msgstr ""
684
 
685
+ #: includes/controllers/class-wc-stripe-controller-gateway-settings.php:111
686
  msgid "Domain registered successfully. You can confirm in your Stripe Dashboard at https://dashboard.stripe.com/account/apple_pay."
687
  msgstr ""
688
 
689
+ #: includes/controllers/class-wc-stripe-controller-gateway-settings.php:135
690
  msgid "You must configure your secret key before creating webhooks."
691
  msgstr ""
692
 
693
+ #: includes/controllers/class-wc-stripe-controller-gateway-settings.php:148
694
  msgid "There is already a webhook configured for this site. If you want to delete the webhook, login to your Stripe Dashboard."
695
  msgstr ""
696
 
697
+ #: includes/controllers/class-wc-stripe-controller-gateway-settings.php:182
698
  msgid "Webhook created in Stripe for %s environment. You can test your webhook by logging in to the Stripe dashboard"
699
  msgstr ""
700
 
701
+ #: includes/controllers/class-wc-stripe-controller-gateway-settings.php:205
702
  msgid "Mode: %s. Invalid secret key. Please check your entry."
703
  msgstr ""
704
 
705
+ #: includes/controllers/class-wc-stripe-controller-gateway-settings.php:217
706
+ #: includes/controllers/class-wc-stripe-controller-gateway-settings.php:220
707
  msgid "Mode: %s. Invalid publishable key. Please check your entry."
708
  msgstr ""
709
 
710
+ #: includes/controllers/class-wc-stripe-controller-gateway-settings.php:226
711
  msgid "Connection test to Stripe was successful. Mode: %s."
712
  msgstr ""
713
 
714
+ #: includes/controllers/class-wc-stripe-controller-googlepay.php:87
715
  msgid "Your shipping address is not serviceable."
716
  msgstr ""
717
 
732
  msgid "Order customer Id and payment method customer Id do not match."
733
  msgstr ""
734
 
735
+ #: includes/controllers/class-wc-stripe-controller-payment-intent.php:58
736
  msgid "Error creating payment intent. Reason: %s"
737
  msgstr ""
738
 
739
+ #: includes/controllers/class-wc-stripe-controller-payment-intent.php:74
740
  msgid "Invalid order id provided"
741
  msgstr ""
742
 
743
+ #: includes/controllers/class-wc-stripe-controller-payment-intent.php:80
744
  msgid "You are not authorized to update this order."
745
  msgstr ""
746
 
747
+ #: includes/controllers/class-wc-stripe-controller-webhook.php:50
748
  #: includes/controllers/class-wc-stripe-controller-webhook.php:52
 
749
  msgid "Invalid signature received. Verify that your webhook secret is correct."
750
  msgstr ""
751
 
911
  #: includes/gateways/class-wc-payment-gateway-stripe-googlepay.php:154
912
  #: includes/gateways/class-wc-payment-gateway-stripe-googlepay.php:217
913
  #: includes/gateways/class-wc-payment-gateway-stripe-klarna.php:189
914
+ #: includes/wc-stripe-functions.php:404
915
+ #: includes/wc-stripe-functions.php:469
916
  msgid "Shipping"
917
  msgstr ""
918
 
919
  #: includes/gateways/class-wc-payment-gateway-stripe-googlepay.php:162
920
  #: includes/gateways/class-wc-payment-gateway-stripe-googlepay.php:239
921
  #: includes/gateways/class-wc-payment-gateway-stripe-klarna.php:199
922
+ #: includes/wc-stripe-functions.php:421
923
+ #: includes/wc-stripe-functions.php:477
924
  msgid "Discount"
925
  msgstr ""
926
 
927
  #: includes/gateways/class-wc-payment-gateway-stripe-googlepay.php:173
928
+ #: includes/wc-stripe-functions.php:488
929
  msgid "Fees"
930
  msgstr ""
931
 
932
  #: includes/gateways/class-wc-payment-gateway-stripe-googlepay.php:253
933
  #: includes/gateways/class-wc-payment-gateway-stripe-klarna.php:221
934
+ #: includes/wc-stripe-functions.php:429
935
  msgid "Tax"
936
  msgstr ""
937
 
1640
  msgid "Kind Regards,"
1641
  msgstr ""
1642
 
1643
+ #: includes/wc-stripe-functions.php:811
1644
  msgid "Bootstrap form"
1645
  msgstr ""
1646
 
1647
+ #: includes/wc-stripe-functions.php:837
1648
  msgid "Simple form"
1649
  msgstr ""
1650
 
1651
+ #: includes/wc-stripe-functions.php:860
1652
  msgid "Minimalist form"
1653
  msgstr ""
1654
 
1655
+ #: includes/wc-stripe-functions.php:886
1656
  msgid "Inline Form"
1657
  msgstr ""
1658
 
1659
+ #: includes/wc-stripe-functions.php:908
1660
  msgid "Rounded Form"
1661
  msgstr ""
1662
 
1663
+ #: includes/wc-stripe-functions.php:1126
1664
  msgid "There was an error processing your credit card."
1665
  msgstr ""
1666
 
1667
+ #: includes/wc-stripe-functions.php:1127
1668
  msgid "Your card number is incomplete."
1669
  msgstr ""
1670
 
1671
+ #: includes/wc-stripe-functions.php:1128
1672
  msgid "The card number is incorrect. Check the card's number or use a different card."
1673
  msgstr ""
1674
 
1675
+ #: includes/wc-stripe-functions.php:1129
1676
  msgid "The card's security code is incorrect. Check the card's security code or use a different card."
1677
  msgstr ""
1678
 
1679
+ #: includes/wc-stripe-functions.php:1130
1680
  msgid "The card's ZIP code is incorrect. Check the card's ZIP code or use a different card."
1681
  msgstr ""
1682
 
1683
+ #: includes/wc-stripe-functions.php:1131
1684
+ #: includes/wc-stripe-functions.php:1136
1685
  msgid "The card number is invalid. Check the card details or use a different card."
1686
  msgstr ""
1687
 
1688
+ #: includes/wc-stripe-functions.php:1132
1689
  msgid "This value provided to the field contains characters that are unsupported by the field."
1690
  msgstr ""
1691
 
1692
+ #: includes/wc-stripe-functions.php:1133
1693
  msgid "The card's security code is invalid. Check the card's security code or use a different card."
1694
  msgstr ""
1695
 
1696
+ #: includes/wc-stripe-functions.php:1134
1697
  msgid "The card's expiration month is incorrect. Check the expiration date or use a different card."
1698
  msgstr ""
1699
 
1700
+ #: includes/wc-stripe-functions.php:1135
1701
  msgid "The card's expiration year is incorrect. Check the expiration date or use a different card."
1702
  msgstr ""
1703
 
1704
+ #: includes/wc-stripe-functions.php:1137
1705
  msgid "The card's address is incorrect. Check the card's address or use a different card."
1706
  msgstr ""
1707
 
1708
+ #: includes/wc-stripe-functions.php:1138
1709
  msgid "The card has expired. Check the expiration date or use a different card."
1710
  msgstr ""
1711
 
1712
+ #: includes/wc-stripe-functions.php:1139
1713
  msgid "The card has been declined."
1714
  msgstr ""
1715
 
1716
+ #: includes/wc-stripe-functions.php:1140
1717
  msgid "Your card's expiration year is in the past."
1718
  msgstr ""
1719
 
1720
+ #: includes/wc-stripe-functions.php:1141
1721
  msgid "The bank account number provided is invalid (e.g., missing digits). Bank account information varies from country to country. We recommend creating validations in your entry forms based on the bank account formats we provide."
1722
  msgstr ""
1723
 
1724
+ #: includes/wc-stripe-functions.php:1142
1725
  msgid "The specified amount is greater than the maximum amount allowed. Use a lower amount and try again."
1726
  msgstr ""
1727
 
1728
+ #: includes/wc-stripe-functions.php:1143
1729
  msgid "The specified amount is less than the minimum amount allowed. Use a higher amount and try again."
1730
  msgstr ""
1731
 
1732
+ #: includes/wc-stripe-functions.php:1144
1733
  msgid "The payment requires authentication to proceed. If your customer is off session, notify your customer to return to your application and complete the payment. If you provided the error_on_requires_action parameter, then your customer should try another card that does not require authentication."
1734
  msgstr ""
1735
 
1736
+ #: includes/wc-stripe-functions.php:1145
1737
  msgid "The transfer or payout could not be completed because the associated account does not have a sufficient balance available. Create a new transfer or payout using an amount less than or equal to the account's available balance."
1738
  msgstr ""
1739
 
1740
+ #: includes/wc-stripe-functions.php:1146
1741
  msgid "The bank account provided can not be used to charge, either because it is not verified yet or it is not supported."
1742
  msgstr ""
1743
 
1744
+ #: includes/wc-stripe-functions.php:1147
1745
  msgid "The bank account provided already exists on the specified Customer object. If the bank account should also be attached to a different customer, include the correct customer ID when making the request again."
1746
  msgstr ""
1747
 
1748
+ #: includes/wc-stripe-functions.php:1148
1749
  msgid "The bank account provided cannot be used for payouts. A different bank account must be used."
1750
  msgstr ""
1751
 
1752
+ #: includes/wc-stripe-functions.php:1149
1753
  msgid "Your Connect platform is attempting to share an unverified bank account with a connected account."
1754
  msgstr ""
1755
 
1756
+ #: includes/wc-stripe-functions.php:1150
1757
  msgid "The bank account cannot be verified, either because the microdeposit amounts provided do not match the actual amounts, or because verification has failed too many times."
1758
  msgstr ""
1759
 
1760
+ #: includes/wc-stripe-functions.php:1151
1761
  msgid "This card has been declined too many times. You can try to charge this card again after 24 hours. We suggest reaching out to your customer to make sure they have entered all of their information correctly and that there are no issues with their card."
1762
  msgstr ""
1763
 
1764
+ #: includes/wc-stripe-functions.php:1152
1765
  msgid "The charge you're attempting to capture has already been captured. Update the request with an uncaptured charge ID."
1766
  msgstr ""
1767
 
1768
+ #: includes/wc-stripe-functions.php:1153
1769
  msgid "The charge you're attempting to refund has already been refunded. Update the request to use the ID of a charge that has not been refunded."
1770
  msgstr ""
1771
 
1772
+ #: includes/wc-stripe-functions.php:1154
1773
  msgid "The charge you're attempting to refund has been charged back. Check the disputes documentation to learn how to respond to the dispute."
1774
  msgstr ""
1775
 
1776
+ #: includes/wc-stripe-functions.php:1155
1777
  msgid "This charge would cause you to exceed your rolling-window processing limit for this source type. Please retry the charge later, or contact us to request a higher processing limit."
1778
  msgstr ""
1779
 
1780
+ #: includes/wc-stripe-functions.php:1156
1781
  msgid "The charge cannot be captured as the authorization has expired. Auth and capture charges must be captured within seven days."
1782
  msgstr ""
1783
 
1784
+ #: includes/wc-stripe-functions.php:1157
1785
  msgid "One or more provided parameters was not allowed for the given operation on the Charge. Check our API reference or the returned error message to see which values were not correct for that Charge."
1786
  msgstr ""
1787
 
1788
+ #: includes/wc-stripe-functions.php:1158
1789
  msgid "The email address is invalid (e.g., not properly formatted). Check that the email address is properly formatted and only includes allowed characters."
1790
  msgstr ""
1791
 
1792
+ #: includes/wc-stripe-functions.php:1159
1793
  msgid "The idempotency key provided is currently being used in another request. This occurs if your integration is making duplicate requests simultaneously."
1794
  msgstr ""
1795
 
1796
+ #: includes/wc-stripe-functions.php:1160
1797
  msgid "The specified amount is invalid. The charge amount must be a positive integer in the smallest currency unit, and not exceed the minimum or maximum amount."
1798
  msgstr ""
1799
 
1800
+ #: includes/wc-stripe-functions.php:1161
1801
  msgid "The source cannot be used because it is not in the correct state (e.g., a charge request is trying to use a source with a pending, failed, or consumed source). Check the status of the source you are attempting to use."
1802
  msgstr ""
1803
 
1804
+ #: includes/wc-stripe-functions.php:1162
1805
  msgid "Both a customer and source ID have been provided, but the source has not been saved to the customer. To create a charge for a customer with a specified source, you must first save the card details."
1806
  msgstr ""
1807
 
1808
+ #: includes/wc-stripe-functions.php:1163
1809
  msgid "The ZIP code provided was incorrect."
1810
  msgstr ""
1811
 
1812
+ #: includes/wc-stripe-functions.php:1164
1813
  msgid "An error occurred while processing the card. Try again later or with a different payment method."
1814
  msgstr ""
1815
 
1816
+ #: includes/wc-stripe-functions.php:1165
1817
  msgid "The card does not support this type of purchase."
1818
  msgstr ""
1819
 
1820
+ #: includes/wc-stripe-functions.php:1166
1821
+ #: includes/wc-stripe-functions.php:1169
1822
+ #: includes/wc-stripe-functions.php:1171
1823
  msgid "The card has been declined for an unknown reason."
1824
  msgstr ""
1825
 
1826
+ #: includes/wc-stripe-functions.php:1167
1827
  msgid "The customer has exceeded the balance or credit limit available on their card."
1828
  msgstr ""
1829
 
1830
+ #: includes/wc-stripe-functions.php:1168
1831
  msgid "The card does not support the specified currency."
1832
  msgstr ""
1833
 
1834
+ #: includes/wc-stripe-functions.php:1170
1835
  msgid "The payment has been declined as Stripe suspects it is fraudulent."
1836
  msgstr ""
1837
 
1838
+ #: includes/wc-stripe-functions.php:1172
1839
  msgid "The PIN entered is incorrect. "
1840
  msgstr ""
1841
 
1842
+ #: includes/wc-stripe-functions.php:1173
1843
  msgid "The card has insufficient funds to complete the purchase."
1844
  msgstr ""
1845
 
1846
+ #: includes/wc-stripe-functions.php:1174
1847
  msgid "Please select a payment method before proceeding."
1848
  msgstr ""
1849
 
1850
+ #: includes/wc-stripe-functions.php:1175
1851
  msgid "Please enter your IBAN before proceeding."
1852
  msgstr ""
1853
 
1854
+ #: includes/wc-stripe-functions.php:1176
1855
  msgid "Please select a bank before proceeding"
1856
  msgstr ""
1857
 
includes/abstract/abstract-wc-payment-gateway-stripe.php CHANGED
@@ -214,9 +214,7 @@ abstract class WC_Payment_Gateway_Stripe extends WC_Payment_Gateway {
214
  $this->enqueue_frontend_scripts();
215
  wc_stripe_token_field( $this );
216
  wc_stripe_payment_intent_field( $this );
217
- if ( $this->has_digital_wallet ) {
218
- $this->output_display_items( 'checkout' );
219
- }
220
  wc_stripe_get_template(
221
  'checkout/stripe-payment-method.php',
222
  array(
@@ -233,7 +231,6 @@ abstract class WC_Payment_Gateway_Stripe extends WC_Payment_Gateway {
233
  global $product;
234
  $this->enqueue_frontend_scripts( 'product' );
235
  $this->output_display_items( 'product' );
236
- wc_stripe_token_field( $this );
237
  wc_stripe_get_template(
238
  'product/' . $this->template_name,
239
  array(
@@ -245,13 +242,11 @@ abstract class WC_Payment_Gateway_Stripe extends WC_Payment_Gateway {
245
 
246
  public function cart_fields() {
247
  $this->enqueue_frontend_scripts( 'cart' );
248
- wc_stripe_token_field( $this );
249
  $this->output_display_items( 'cart' );
250
  wc_stripe_get_template( 'cart/' . $this->template_name, array( 'gateway' => $this ) );
251
  }
252
 
253
  public function mini_cart_fields() {
254
- wc_stripe_token_field( $this );
255
  $this->output_display_items( 'cart' );
256
  wc_stripe_get_template( 'mini-cart/' . $this->template_name, array( 'gateway' => $this ) );
257
  }
@@ -290,7 +285,6 @@ abstract class WC_Payment_Gateway_Stripe extends WC_Payment_Gateway {
290
  }
291
  }
292
  if ( ! empty( wc_stripe()->scripts()->enqueued_scripts ) ) {
293
- wc_stripe()->scripts()->enqueue_script( 'form-handler' );
294
  wp_enqueue_style( wc_stripe()->scripts()->prefix . 'styles', wc_stripe()->assets_url( 'css/stripe.css' ), array(), wc_stripe()->version() );
295
  }
296
  }
@@ -1421,13 +1415,15 @@ abstract class WC_Payment_Gateway_Stripe extends WC_Payment_Gateway {
1421
 
1422
  /**
1423
  * Outputs fields required by Google Pay to render the payment wallet.
 
 
1424
  */
1425
  public function output_display_items( $page = 'checkout' ) {
1426
  global $wp;
1427
  $order = null;
1428
  $data = array(
1429
- 'items' => $this->get_display_items( $page ),
1430
- 'shipping_options' => $this->get_shipping_methods(),
1431
  'total' => WC()->cart->total,
1432
  'total_cents' => wc_stripe_add_number_precision( WC()->cart->total, get_woocommerce_currency() ),
1433
  'currency' => get_woocommerce_currency()
@@ -1436,7 +1432,7 @@ abstract class WC_Payment_Gateway_Stripe extends WC_Payment_Gateway {
1436
  $order = wc_get_order( absint( $wp->query_vars['order-pay'] ) );
1437
  $page = 'order_pay';
1438
  $data['needs_shipping'] = false;
1439
- $data['items'] = $this->get_display_items( $page, $order );
1440
  $data['total'] = $order->get_total();
1441
  $data['total_cents'] = wc_stripe_add_number_precision( $order->get_total(), $order->get_currency() );
1442
  $data['currency'] = $order->get_currency();
@@ -1450,6 +1446,9 @@ abstract class WC_Payment_Gateway_Stripe extends WC_Payment_Gateway {
1450
  );
1451
  } elseif ( in_array( $page, array( 'checkout', 'cart' ) ) ) {
1452
  $data['needs_shipping'] = WC()->cart->needs_shipping();
 
 
 
1453
  }
1454
  /**
1455
  * @param array $data
@@ -1471,4 +1470,28 @@ abstract class WC_Payment_Gateway_Stripe extends WC_Payment_Gateway {
1471
  public function get_mini_cart_dependencies( $deps, $scripts ) {
1472
  return $deps;
1473
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1474
  }
214
  $this->enqueue_frontend_scripts();
215
  wc_stripe_token_field( $this );
216
  wc_stripe_payment_intent_field( $this );
217
+ $this->output_display_items( 'checkout' );
 
 
218
  wc_stripe_get_template(
219
  'checkout/stripe-payment-method.php',
220
  array(
231
  global $product;
232
  $this->enqueue_frontend_scripts( 'product' );
233
  $this->output_display_items( 'product' );
 
234
  wc_stripe_get_template(
235
  'product/' . $this->template_name,
236
  array(
242
 
243
  public function cart_fields() {
244
  $this->enqueue_frontend_scripts( 'cart' );
 
245
  $this->output_display_items( 'cart' );
246
  wc_stripe_get_template( 'cart/' . $this->template_name, array( 'gateway' => $this ) );
247
  }
248
 
249
  public function mini_cart_fields() {
 
250
  $this->output_display_items( 'cart' );
251
  wc_stripe_get_template( 'mini-cart/' . $this->template_name, array( 'gateway' => $this ) );
252
  }
285
  }
286
  }
287
  if ( ! empty( wc_stripe()->scripts()->enqueued_scripts ) ) {
 
288
  wp_enqueue_style( wc_stripe()->scripts()->prefix . 'styles', wc_stripe()->assets_url( 'css/stripe.css' ), array(), wc_stripe()->version() );
289
  }
290
  }
1415
 
1416
  /**
1417
  * Outputs fields required by Google Pay to render the payment wallet.
1418
+ *
1419
+ * @param string $page
1420
  */
1421
  public function output_display_items( $page = 'checkout' ) {
1422
  global $wp;
1423
  $order = null;
1424
  $data = array(
1425
+ 'items' => $this->has_digital_wallet ? $this->get_display_items( $page ) : array(),
1426
+ 'shipping_options' => $this->has_digital_wallet ? $this->get_shipping_methods() : array(),
1427
  'total' => WC()->cart->total,
1428
  'total_cents' => wc_stripe_add_number_precision( WC()->cart->total, get_woocommerce_currency() ),
1429
  'currency' => get_woocommerce_currency()
1432
  $order = wc_get_order( absint( $wp->query_vars['order-pay'] ) );
1433
  $page = 'order_pay';
1434
  $data['needs_shipping'] = false;
1435
+ $data['items'] = $this->has_digital_wallet ? $this->get_display_items( $page, $order ) : array();
1436
  $data['total'] = $order->get_total();
1437
  $data['total_cents'] = wc_stripe_add_number_precision( $order->get_total(), $order->get_currency() );
1438
  $data['currency'] = $order->get_currency();
1446
  );
1447
  } elseif ( in_array( $page, array( 'checkout', 'cart' ) ) ) {
1448
  $data['needs_shipping'] = WC()->cart->needs_shipping();
1449
+ if ( is_add_payment_method_page() ) {
1450
+ $page = 'add_payment_method';
1451
+ }
1452
  }
1453
  /**
1454
  * @param array $data
1470
  public function get_mini_cart_dependencies( $deps, $scripts ) {
1471
  return $deps;
1472
  }
1473
+
1474
+ /**
1475
+ * @return array
1476
+ * @since 3.2.0
1477
+ */
1478
+ public function get_shipping_packages() {
1479
+ $packages = WC()->shipping()->get_packages();
1480
+ if ( empty( $packages ) && wcs_stripe_active() && WC_Subscriptions_Cart::cart_contains_free_trial() ) {
1481
+ // there is a subscription with a free trial in the cart. Shipping packages will be in the recurring cart.
1482
+ WC_Subscriptions_Cart::set_calculation_type( 'recurring_total' );
1483
+ $count = 0;
1484
+ if ( isset( WC()->cart->recurring_carts ) ) {
1485
+ foreach ( WC()->cart->recurring_carts as $recurring_cart_key => $recurring_cart ) {
1486
+ foreach ( $recurring_cart->get_shipping_packages() as $i => $base_package ) {
1487
+ $packages[ $recurring_cart_key . '_' . $count ] = WC_Subscriptions_Cart::get_calculated_shipping_for_package( $base_package );
1488
+ }
1489
+ $count ++;
1490
+ }
1491
+ }
1492
+ WC_Subscriptions_Cart::set_calculation_type( 'none' );
1493
+ }
1494
+
1495
+ return $packages;
1496
+ }
1497
  }
includes/class-stripe.php CHANGED
@@ -25,7 +25,7 @@ class WC_Stripe_Manager {
25
  *
26
  * @var string
27
  */
28
- public $version = '3.1.9';
29
 
30
  /**
31
  *
25
  *
26
  * @var string
27
  */
28
+ public $version = '3.2.0';
29
 
30
  /**
31
  *
includes/class-wc-stripe-field-manager.php CHANGED
@@ -108,8 +108,6 @@ class WC_Stripe_Field_Manager {
108
  }
109
  }
110
  if ( ! empty( $gateways ) ) {
111
- echo '<form id="wc-stripe-cart-form">';
112
-
113
  wc_stripe_get_template(
114
  'cart/payment-methods.php',
115
  array(
@@ -118,7 +116,6 @@ class WC_Stripe_Field_Manager {
118
  'cart_total' => WC()->cart->total,
119
  )
120
  );
121
- echo '</form>';
122
  }
123
  }
124
 
108
  }
109
  }
110
  if ( ! empty( $gateways ) ) {
 
 
111
  wc_stripe_get_template(
112
  'cart/payment-methods.php',
113
  array(
116
  'cart_total' => WC()->cart->total,
117
  )
118
  );
 
119
  }
120
  }
121
 
includes/class-wc-stripe-frontend-scripts.php CHANGED
@@ -40,16 +40,17 @@ class WC_Stripe_Frontend_Scripts {
40
  $this->register_script( $handle, $src );
41
  }
42
 
 
 
43
  // register scripts that aren't part of gateways
44
  $this->register_script( 'wc-stripe', $this->assets_url( 'js/frontend/wc-stripe' . $this->get_min() . '.js' ),
45
  array(
46
  'jquery',
47
  $this->get_handle( 'external' ),
48
- 'woocommerce'
 
49
  ) );
50
 
51
- $this->register_script( 'form-handler', $this->assets_url( 'js/frontend/form-handler.js' ), array( 'selectWoo' ) );
52
-
53
  // mini cart is not relevant on cart and checkout page.
54
  if ( ! is_checkout() && ! is_cart() ) {
55
  foreach ( WC()->payment_gateways()->payment_gateways() as $gateway ) {
40
  $this->register_script( $handle, $src );
41
  }
42
 
43
+ $this->register_script( 'form-handler', $this->assets_url( 'js/frontend/form-handler.js' ), array( 'jquery' ) );
44
+
45
  // register scripts that aren't part of gateways
46
  $this->register_script( 'wc-stripe', $this->assets_url( 'js/frontend/wc-stripe' . $this->get_min() . '.js' ),
47
  array(
48
  'jquery',
49
  $this->get_handle( 'external' ),
50
+ 'woocommerce',
51
+ $this->get_handle( 'form-handler' )
52
  ) );
53
 
 
 
54
  // mini cart is not relevant on cart and checkout page.
55
  if ( ! is_checkout() && ! is_cart() ) {
56
  foreach ( WC()->payment_gateways()->payment_gateways() as $gateway ) {
includes/controllers/class-wc-stripe-controller-cart.php CHANGED
@@ -137,7 +137,7 @@ class WC_Stripe_Controller_Cart extends WC_Stripe_Rest_Controller {
137
  'pending' => false,
138
  ),
139
  'displayItems' => wc_stripe_get_display_items(),
140
- 'shippingOptions' => wc_stripe_get_shipping_options(),
141
  ),
142
  'shipping_methods' => WC()->session->get(
143
  'chosen_shipping_methods',
@@ -182,7 +182,7 @@ class WC_Stripe_Controller_Cart extends WC_Stripe_Rest_Controller {
182
  WC()->cart->calculate_totals();
183
  }
184
 
185
- if ( ! $this->has_shipping_methods( WC()->shipping()->get_packages() ) ) {
186
  throw new Exception( 'No valid shipping methods.' );
187
  }
188
 
@@ -200,7 +200,7 @@ class WC_Stripe_Controller_Cart extends WC_Stripe_Rest_Controller {
200
  'pending' => false,
201
  ),
202
  'displayItems' => wc_stripe_get_display_items(),
203
- 'shippingOptions' => wc_stripe_get_shipping_options(),
204
  ),
205
  )
206
  ),
137
  'pending' => false,
138
  ),
139
  'displayItems' => wc_stripe_get_display_items(),
140
+ 'shippingOptions' => wc_stripe_get_shipping_options( null, $gateway->get_shipping_packages() ),
141
  ),
142
  'shipping_methods' => WC()->session->get(
143
  'chosen_shipping_methods',
182
  WC()->cart->calculate_totals();
183
  }
184
 
185
+ if ( ! $this->has_shipping_methods( $gateway->get_shipping_packages() ) ) {
186
  throw new Exception( 'No valid shipping methods.' );
187
  }
188
 
200
  'pending' => false,
201
  ),
202
  'displayItems' => wc_stripe_get_display_items(),
203
+ 'shippingOptions' => wc_stripe_get_shipping_options( null, $gateway->get_shipping_packages() ),
204
  ),
205
  )
206
  ),
includes/controllers/class-wc-stripe-controller-googlepay.php CHANGED
@@ -19,7 +19,7 @@ class WC_Stripe_Controller_GooglePay extends WC_Stripe_Rest_Controller {
19
 
20
  /**
21
  *
22
- * @var WC_Payment_Gateway_Stripe
23
  */
24
  private $gateway;
25
 
@@ -82,7 +82,7 @@ class WC_Stripe_Controller_GooglePay extends WC_Stripe_Rest_Controller {
82
  WC()->cart->calculate_totals();
83
 
84
  // if shipping address is not serviceable, throw an error.
85
- if ( ! wc_stripe_shipping_address_serviceable() ) {
86
  $this->reason_code = 'SHIPPING_ADDRESS_UNSERVICEABLE';
87
  throw new Exception( __( 'Your shipping address is not serviceable.', 'woo-stripe-payment' ) );
88
  }
@@ -125,6 +125,8 @@ class WC_Stripe_Controller_GooglePay extends WC_Stripe_Rest_Controller {
125
  * Return a formatted array of response data required by the Google payment sheet.
126
  */
127
  public function get_payment_response_data() {
 
 
128
  return array(
129
  'newTransactionInfo' => array(
130
  'currencyCode' => get_woocommerce_currency(),
@@ -134,8 +136,8 @@ class WC_Stripe_Controller_GooglePay extends WC_Stripe_Rest_Controller {
134
  'totalPriceLabel' => __( 'Total', 'woo-stripe-payment' ),
135
  ),
136
  'newShippingOptionParameters' => array(
137
- 'shippingOptions' => $this->gateway->get_shipping_methods(),
138
- 'defaultSelectedOptionId' => $this->get_default_shipping_method(),
139
  ),
140
  );
141
  }
@@ -149,13 +151,17 @@ class WC_Stripe_Controller_GooglePay extends WC_Stripe_Rest_Controller {
149
  *
150
  * @return string
151
  */
152
- private function get_default_shipping_method() {
153
  $chosen_shipping_methods = WC()->session->get( 'chosen_shipping_methods', array() );
154
- if ( ! empty( $chosen_shipping_methods ) ) {
155
- reset( $chosen_shipping_methods );
156
- $key = key( $chosen_shipping_methods );
157
-
158
- return sprintf( '%s:%s', $key, $chosen_shipping_methods[ $key ] );
 
 
 
 
159
  }
160
 
161
  return $this->shipping_method_id;
19
 
20
  /**
21
  *
22
+ * @var WC_Payment_Gateway_Stripe_GooglePay
23
  */
24
  private $gateway;
25
 
82
  WC()->cart->calculate_totals();
83
 
84
  // if shipping address is not serviceable, throw an error.
85
+ if ( ! wc_stripe_shipping_address_serviceable( $this->gateway->get_shipping_packages() ) ) {
86
  $this->reason_code = 'SHIPPING_ADDRESS_UNSERVICEABLE';
87
  throw new Exception( __( 'Your shipping address is not serviceable.', 'woo-stripe-payment' ) );
88
  }
125
  * Return a formatted array of response data required by the Google payment sheet.
126
  */
127
  public function get_payment_response_data() {
128
+ $shipping_options = $this->gateway->get_shipping_methods();
129
+
130
  return array(
131
  'newTransactionInfo' => array(
132
  'currencyCode' => get_woocommerce_currency(),
136
  'totalPriceLabel' => __( 'Total', 'woo-stripe-payment' ),
137
  ),
138
  'newShippingOptionParameters' => array(
139
+ 'shippingOptions' => $shipping_options,
140
+ 'defaultSelectedOptionId' => $this->get_default_shipping_method( $shipping_options ),
141
  ),
142
  );
143
  }
151
  *
152
  * @return string
153
  */
154
+ private function get_default_shipping_method( $methods ) {
155
  $chosen_shipping_methods = WC()->session->get( 'chosen_shipping_methods', array() );
156
+ $method_ids = wp_list_pluck( $methods, 'id' );
157
+ foreach ( $chosen_shipping_methods as $idx => $method ) {
158
+ $method_id = sprintf( '%s:%s', $idx, $method );
159
+ if ( in_array( $method_id, $method_ids ) ) {
160
+ $this->shipping_method_id = $method_id;
161
+ }
162
+ }
163
+ if ( ! $this->shipping_method_id ) {
164
+ $this->shipping_method_id = current( $method_ids );
165
  }
166
 
167
  return $this->shipping_method_id;
includes/gateways/class-wc-payment-gateway-stripe-googlepay.php CHANGED
@@ -269,7 +269,7 @@ class WC_Payment_Gateway_Stripe_GooglePay extends WC_Payment_Gateway_Stripe {
269
  $methods = array();
270
  } else {
271
  $methods = array();
272
- $packages = WC()->shipping()->get_packages();
273
  foreach ( $packages as $i => $package ) {
274
  foreach ( $package['rates'] as $rate ) {
275
  /**
269
  $methods = array();
270
  } else {
271
  $methods = array();
272
+ $packages = $this->get_shipping_packages();
273
  foreach ( $packages as $i => $package ) {
274
  foreach ( $package['rates'] as $rate ) {
275
  /**
includes/wc-stripe-functions.php CHANGED
@@ -345,12 +345,13 @@ function wc_stripe_update_shipping_methods( $methods ) {
345
  /**
346
  * Return true if there are shipping packages that contain rates.
347
  *
 
 
348
  * @return boolean
349
  * @package Stripe/Functions
350
  * @since 3.0.0
351
  */
352
- function wc_stripe_shipping_address_serviceable() {
353
- $packages = WC()->shipping()->get_packages();
354
  if ( $packages ) {
355
  foreach ( $packages as $package ) {
356
  if ( count( $package['rates'] ) > 0 ) {
@@ -508,19 +509,19 @@ function wc_stripe_get_display_items( $page = 'cart', $order = null ) {
508
 
509
  /**
510
  *
511
- * @param bool $encode
512
  * @param WC_Order $order
 
513
  *
514
  * @return mixed
515
  * @package Stripe/Functions
516
  * @since 3.0.0
517
  */
518
- function wc_stripe_get_shipping_options( $order = null ) {
519
  $methods = array();
520
  $incl_tax = wc_stripe_display_prices_including_tax();
521
  $ids = array();
522
  $chosen_shipping_methods = WC()->session->get( 'chosen_shipping_methods', array() );
523
- $packages = WC()->shipping()->get_packages();
524
  foreach ( $packages as $i => $package ) {
525
  foreach ( $package['rates'] as $rate ) {
526
  /**
@@ -957,6 +958,9 @@ function wc_stripe_display_prices_including_tax() {
957
  if ( method_exists( $cart, 'display_prices_including_tax' ) ) {
958
  return $cart->display_prices_including_tax();
959
  }
 
 
 
960
 
961
  return 'incl' == $cart->tax_display_cart && ( WC()->customer && ! WC()->customer->is_vat_exempt() );
962
  }
@@ -1250,15 +1254,35 @@ function wc_stripe_remove_order_locks() {
1250
  * @since 3.1.8
1251
  */
1252
  function wc_stripe_get_checkout_fields() {
 
1253
  $fields = array();
 
 
 
 
1254
  foreach ( array( 'billing', 'shipping' ) as $key ) {
1255
  if ( ( $field_set = WC()->checkout()->get_checkout_fields( $key ) ) ) {
1256
  $fields = array_merge( $fields, $field_set );
1257
  }
1258
  }
1259
  // loop through fields and assign their value to the field.
1260
- array_walk( $fields, function ( &$field, $key ) {
1261
- $field['value'] = WC()->checkout()->get_value( $key );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1262
  } );
1263
 
1264
  return $fields;
345
  /**
346
  * Return true if there are shipping packages that contain rates.
347
  *
348
+ * @param array $packages
349
+ *
350
  * @return boolean
351
  * @package Stripe/Functions
352
  * @since 3.0.0
353
  */
354
+ function wc_stripe_shipping_address_serviceable( $packages = array() ) {
 
355
  if ( $packages ) {
356
  foreach ( $packages as $package ) {
357
  if ( count( $package['rates'] ) > 0 ) {
509
 
510
  /**
511
  *
 
512
  * @param WC_Order $order
513
+ * @param array $packages
514
  *
515
  * @return mixed
516
  * @package Stripe/Functions
517
  * @since 3.0.0
518
  */
519
+ function wc_stripe_get_shipping_options( $order = null, $packages = array() ) {
520
  $methods = array();
521
  $incl_tax = wc_stripe_display_prices_including_tax();
522
  $ids = array();
523
  $chosen_shipping_methods = WC()->session->get( 'chosen_shipping_methods', array() );
524
+ $packages = empty( $packages ) ? WC()->shipping()->get_packages() : $packages;
525
  foreach ( $packages as $i => $package ) {
526
  foreach ( $package['rates'] as $rate ) {
527
  /**
958
  if ( method_exists( $cart, 'display_prices_including_tax' ) ) {
959
  return $cart->display_prices_including_tax();
960
  }
961
+ if ( is_callable( array( $cart, 'get_tax_price_display_mode' ) ) ) {
962
+ return 'incl' == $cart->get_tax_price_display_mode() && ( WC()->customer && ! WC()->customer->is_vat_exempt() );
963
+ }
964
 
965
  return 'incl' == $cart->tax_display_cart && ( WC()->customer && ! WC()->customer->is_vat_exempt() );
966
  }
1254
  * @since 3.1.8
1255
  */
1256
  function wc_stripe_get_checkout_fields() {
1257
+ global $wp;
1258
  $fields = array();
1259
+ $order = false;
1260
+ if ( ! empty( $wp->query_vars['order-pay'] ) ) {
1261
+ $order = wc_get_order( absint( ( $wp->query_vars['order-pay'] ) ) );
1262
+ }
1263
  foreach ( array( 'billing', 'shipping' ) as $key ) {
1264
  if ( ( $field_set = WC()->checkout()->get_checkout_fields( $key ) ) ) {
1265
  $fields = array_merge( $fields, $field_set );
1266
  }
1267
  }
1268
  // loop through fields and assign their value to the field.
1269
+ array_walk( $fields, function ( &$field, $key ) use ( $order ) {
1270
+ if ( $order ) {
1271
+ if ( is_callable( array( $order, "get_{$key}" ) ) ) {
1272
+ $field['value'] = $order->{"get_{$key}"}();
1273
+ } else {
1274
+ $field['value'] = WC()->checkout()->get_value( $key );
1275
+ }
1276
+ } else {
1277
+ $field['value'] = WC()->checkout()->get_value( $key );
1278
+ }
1279
+ /**
1280
+ * Some 3rd party plugins hook in to WC filters and alter the expected
1281
+ * type for required. This ensures it's converted back to a boolean.
1282
+ */
1283
+ if ( isset( $field['required'] ) && ! is_bool( $field['required'] ) ) {
1284
+ $field['required'] = (bool) $field['required'];
1285
+ }
1286
  } );
1287
 
1288
  return $fields;
readme.txt CHANGED
@@ -4,7 +4,7 @@ Tags: stripe, ach, klarna, credit card, apple pay, google pay, ideal, sepa, sofo
4
  Requires at least: 3.0.1
5
  Tested up to: 5.5
6
  Requires PHP: 5.6
7
- Stable tag: 3.1.9
8
  Copyright: Payment Plugins
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
@@ -58,6 +58,12 @@ If you're site is not loading over https, then Stripe won't render the Payment R
58
  8. Edit payment gateways on the product page
59
 
60
  == Changelog ==
 
 
 
 
 
 
61
  = 3.1.9 =
62
  * Fixed - WP 5.5 rest permission_callback notice
63
  * Fixed - Conflict with SG Optimizer plugin
4
  Requires at least: 3.0.1
5
  Tested up to: 5.5
6
  Requires PHP: 5.6
7
+ Stable tag: 3.2.0
8
  Copyright: Payment Plugins
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
58
  8. Edit payment gateways on the product page
59
 
60
  == Changelog ==
61
+ = 3.2.0 =
62
+ * Fixed - Conflict with Checkout Field Editor for WooCommerce and JS checkout field variable
63
+ * Fixed - Mini-cart html
64
+ * Fixed - SEPA JS error on checkout page
65
+ * Added - WC tested to 4.4.1
66
+ * Updated - removed selectWoo as form-handler.js dependency
67
  = 3.1.9 =
68
  * Fixed - WP 5.5 rest permission_callback notice
69
  * Fixed - Conflict with SG Optimizer plugin
stripe-payments.php CHANGED
@@ -3,13 +3,13 @@
3
  * Plugin Name: Stripe For WooCommerce
4
  * Plugin URI: https://docs.paymentplugins.com/wc-stripe/config/
5
  * Description: Accept credit cards, Google Pay, Apple Pay, ACH, Klarna and more using Stripe.
6
- * Version: 3.1.9
7
  * Author: Payment Plugins, support@paymentplugins.com
8
  * Text Domain: woo-stripe-payment
9
  * Domain Path: /i18n/languages/
10
  * Tested up to: 5.5
11
  * WC requires at least: 3.0.0
12
- * WC tested up to: 4.3.2
13
  */
14
  defined( 'ABSPATH' ) || exit ();
15
 
3
  * Plugin Name: Stripe For WooCommerce
4
  * Plugin URI: https://docs.paymentplugins.com/wc-stripe/config/
5
  * Description: Accept credit cards, Google Pay, Apple Pay, ACH, Klarna and more using Stripe.
6
+ * Version: 3.2.0
7
  * Author: Payment Plugins, support@paymentplugins.com
8
  * Text Domain: woo-stripe-payment
9
  * Domain Path: /i18n/languages/
10
  * Tested up to: 5.5
11
  * WC requires at least: 3.0.0
12
+ * WC tested up to: 4.4.1
13
  */
14
  defined( 'ABSPATH' ) || exit ();
15
 
templates/mini-cart/applepay.php CHANGED
@@ -5,4 +5,4 @@
5
  * @var WC_Payment_Gateway_Stripe $gateway
6
  */
7
  ?>
8
- <div class="wc-stripe-applepay-mini-cart"></div>
5
  * @var WC_Payment_Gateway_Stripe $gateway
6
  */
7
  ?>
8
+ <a class="wc-stripe-applepay-mini-cart button" style="display: none"></a>
templates/mini-cart/googlepay.php CHANGED
@@ -3,4 +3,4 @@
3
  * @version 3.1.8
4
  */
5
  ?>
6
- <div class="wc-stripe-gpay-mini-cart"></div>
3
  * @version 3.1.8
4
  */
5
  ?>
6
+ <a class="wc-stripe-gpay-mini-cart button" style="display: none"></a>
templates/mini-cart/payment-methods.php CHANGED
@@ -1,15 +1,13 @@
1
  <?php
2
  /**
3
- * @version 3.1.8
4
  * @var WC_Payment_Gateway_Stripe[] $gateways
5
  */
6
  ?>
7
- <ul class="wc-stripe-mini-cart-payment-methods">
8
- <?php foreach ( $gateways as $gateway ) : ?>
9
- <li class="payment_method_<?php echo $gateway->id ?>">
10
- <?php $gateway->mini_cart_fields() ?>
11
- </li>
12
- <?php endforeach; ?>
13
- </ul>
14
 
15
 
1
  <?php
2
  /**
3
+ * @version 3.2.0
4
  * @var WC_Payment_Gateway_Stripe[] $gateways
5
  */
6
  ?>
7
+ <input type="hidden" class="wc_stripe_mini_cart_payment_methods"/>
8
+ <?php foreach ( $gateways as $gateway ) : ?>
9
+ <?php $gateway->mini_cart_fields() ?>
10
+ <?php endforeach; ?>
11
+
 
 
12
 
13
 
templates/mini-cart/payment-request.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
  /**
3
- * @version 3.1.8
4
  */
5
  ?>
6
- <div class="wc-stripe-payment-request-mini-cart"></div>
1
  <?php
2
  /**
3
+ * @version 3.2.0
4
  */
5
  ?>
6
+ <a class="wc-stripe-payment-request-mini-cart button" style="display: none"></a>