Payment Plugins for Stripe WooCommerce - Version 3.0.8

Version Description

  • Updated - billing phone and email check added for card payment
  • Updated - template checkout/payment-method.php name changed to checkout/stripe-payment-method.php
  • Updated - cart checkout button styling
  • Added - Connection test in admin API settings
  • Misc - WC 3.9.1
Download this release

Release Info

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

Code changes from version 3.0.7 to 3.0.8

Files changed (33) hide show
  1. assets/css/stripe.css +66 -2
  2. assets/js/admin/admin-settings.js +29 -0
  3. assets/js/frontend/applepay-cart.js +2 -0
  4. assets/js/frontend/applepay-checkout.js +7 -0
  5. assets/js/frontend/applepay-product.js +11 -0
  6. assets/js/frontend/credit-card.js +32 -14
  7. assets/js/frontend/form-handler.js +17 -0
  8. assets/js/frontend/googlepay-cart.js +2 -0
  9. assets/js/frontend/googlepay-checkout.js +7 -0
  10. assets/js/frontend/payment-request.js +12 -5
  11. assets/js/frontend/wc-stripe.js +31 -0
  12. assets/js/frontend/wc-stripe.min.js +1 -1
  13. i18n/languages/woo-stripe-payment.pot +104 -68
  14. includes/abstract/abstract-wc-payment-gateway-stripe.php +2 -2
  15. includes/abstract/abstract-wc-payment-token-stripe.php +2 -1
  16. includes/abstract/abstract-wc-stripe-settings.php +1 -0
  17. includes/admin/class-wc-stripe-admin-assets.php +2 -1
  18. includes/admin/settings/class-wc-stripe-api-settings.php +23 -0
  19. includes/class-stripe.php +1 -1
  20. includes/class-wc-stripe-field-manager.php +6 -1
  21. includes/class-wc-stripe-gateway.php +24 -3
  22. includes/controllers/class-wc-stripe-controller-gateway-settings.php +62 -0
  23. includes/controllers/class-wc-stripe-controller-order-actions.php +2 -3
  24. includes/gateways/class-wc-payment-gateway-stripe-applepay.php +4 -2
  25. includes/gateways/settings/applepay-settings.php +0 -14
  26. includes/gateways/settings/googlepay-settings.php +1 -25
  27. includes/gateways/settings/payment-request-settings.php +0 -14
  28. includes/wc-stripe-functions.php +2 -2
  29. readme.txt +7 -1
  30. stripe-payments.php +2 -2
  31. templates/card-icons.php +2 -2
  32. templates/cart/payment-methods.php +2 -2
  33. templates/checkout/stripe-payment-method.php +31 -0
assets/css/stripe.css CHANGED
@@ -3,6 +3,20 @@
3
  float: right;
4
  display: inline-block;
5
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6
  li.payment_method_stripe_cc .wc-stripe-card-icons-container img.wc-stripe-card-icon,
7
  li.payment_method_stripe_payment_request .wc-stripe-paymentRequest-icons-container img{
8
  max-width: 44px;
@@ -202,6 +216,11 @@ li.payment_method_stripe_payment_request{
202
  margin: 0px;
203
  padding: 0px;
204
  }
 
 
 
 
 
205
  .wc-stripe-cart-checkout-container ul.wc_stripe_cart_payment_methods{
206
  margin-bottom: 1.5em;
207
  }
@@ -217,6 +236,10 @@ li.payment_method_stripe_payment_request{
217
  .wc_stripe_product_payment_methods .disabled{
218
  opacity: 0.45;
219
  }
 
 
 
 
220
  .wc-stripe-cart-or{
221
  margin: 1em 0;
222
  text-align: center;
@@ -226,6 +249,9 @@ li.wc-stripe-payment-method.or{
226
  }
227
  .wc-stripe-cart-checkout-container ul.wc_stripe_cart_payment_methods.active li.wc-stripe-payment-method.or{
228
  display: block;
 
 
 
229
  margin: 0;
230
  }
231
  li[class*=payment_method_stripe_].active ~ li.wc-stripe-payment-method.or{
@@ -291,7 +317,7 @@ li.payment_method_stripe_ach label:first-of-type img{
291
  }
292
  }
293
  .wc-stripe-banner-checkout{
294
- padding: 1em 15px 0 15px;
295
  border: 1px solid #d1d1d1;
296
  border-width: 0 0 1px;
297
  position: relative;
@@ -329,7 +355,7 @@ li.payment_method_stripe_ach label:first-of-type img{
329
  padding: 0;
330
  }
331
  .wc-stripe-banner-checkout ul.wc_stripe_checkout_banner_gateways li.wc-stripe-checkout-banner-gateway{
332
- margin: 0 0 1em 0;
333
  display: none;
334
  }
335
  .wc-stripe-banner-checkout ul.wc_stripe_checkout_banner_gateways li.wc-stripe-checkout-banner-gateway .gpay-button{
@@ -441,6 +467,7 @@ div.postalCode:focus{
441
  }
442
  li[class*="payment_method_stripe"] .select2-container .select2-selection--single{
443
  height: 42px;
 
444
  }
445
  li[class*="payment_method_stripe"] .select2-container--default .select2-selection--single .select2-selection__arrow{
446
  height: 42px;
@@ -457,4 +484,41 @@ li[class*="payment_method_stripe"] .select2-container--default .select2-selectio
457
  }
458
  .select2-container .select2-selection--single .wc-stripe-select2-container.wc-stripe-ach:before{
459
  display: none;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
460
  }
3
  float: right;
4
  display: inline-block;
5
  }
6
+ ul.payment_methods li[class*=payment_method]{
7
+ margin: 0;
8
+ padding: 0;
9
+ }
10
+ li[class*=payment_method] input[type=radio]{
11
+ margin: 0 10px 0 5px;
12
+ }
13
+ li[class*=payment_method] input[type=radio] + label:not(.wc-stripe-label-payment-type){
14
+ margin: 0;
15
+ }
16
+ .woocommerce-checkout #payment ul.payment_methods li[class*=payment_method_stripe_]:nth-child(n + 2),
17
+ ul.payment_methods li[class*=payment_method_stripe_]:nth-child(n + 2){
18
+ margin: 0;
19
+ }
20
  li.payment_method_stripe_cc .wc-stripe-card-icons-container img.wc-stripe-card-icon,
21
  li.payment_method_stripe_payment_request .wc-stripe-paymentRequest-icons-container img{
22
  max-width: 44px;
216
  margin: 0px;
217
  padding: 0px;
218
  }
219
+ #wc-stripe-cart-form{
220
+ margin: 0;
221
+ padding: 0;
222
+ clear: both;
223
+ }
224
  .wc-stripe-cart-checkout-container ul.wc_stripe_cart_payment_methods{
225
  margin-bottom: 1.5em;
226
  }
236
  .wc_stripe_product_payment_methods .disabled{
237
  opacity: 0.45;
238
  }
239
+ .woocommerce-cart .stripe_cart_gateway_active .wc-proceed-to-checkout .checkout-button,
240
+ .stripe_cart_gateway_active .checkout-button{
241
+ margin-bottom: 0px;
242
+ }
243
  .wc-stripe-cart-or{
244
  margin: 1em 0;
245
  text-align: center;
249
  }
250
  .wc-stripe-cart-checkout-container ul.wc_stripe_cart_payment_methods.active li.wc-stripe-payment-method.or{
251
  display: block;
252
+ margin: 15px 0;
253
+ }
254
+ .wc-stripe-cart-checkout-container ul.wc_stripe_cart_payment_methods.active li.wc-stripe-payment-method.or p{
255
  margin: 0;
256
  }
257
  li[class*=payment_method_stripe_].active ~ li.wc-stripe-payment-method.or{
317
  }
318
  }
319
  .wc-stripe-banner-checkout{
320
+ padding: 20px 15px 0 15px;
321
  border: 1px solid #d1d1d1;
322
  border-width: 0 0 1px;
323
  position: relative;
355
  padding: 0;
356
  }
357
  .wc-stripe-banner-checkout ul.wc_stripe_checkout_banner_gateways li.wc-stripe-checkout-banner-gateway{
358
+ margin: 0 0 20px 0;
359
  display: none;
360
  }
361
  .wc-stripe-banner-checkout ul.wc_stripe_checkout_banner_gateways li.wc-stripe-checkout-banner-gateway .gpay-button{
467
  }
468
  li[class*="payment_method_stripe"] .select2-container .select2-selection--single{
469
  height: 42px;
470
+ padding: 0 5px;
471
  }
472
  li[class*="payment_method_stripe"] .select2-container--default .select2-selection--single .select2-selection__arrow{
473
  height: 42px;
484
  }
485
  .select2-container .select2-selection--single .wc-stripe-select2-container.wc-stripe-ach:before{
486
  display: none;
487
+ }
488
+ ul.wc_stripe_cart_payment_methods li.wc-stripe-payment-method button,
489
+ ul.wc_stripe_product_payment_methods li[class*=payment_method_stripe_] button,
490
+ ul.wc_stripe_checkout_banner_gateways li button{
491
+ margin: 0;
492
+ }
493
+ ul.payment_methods li[class*=payment_method]{
494
+ margin: 0;
495
+ padding: 10px 0;
496
+ }
497
+ ul.payment_methods li[class*=payment_method] input[name=payment_method]{
498
+ margin: 0 10px 0 5px;
499
+ float: none;
500
+ }
501
+ ul.payment_methods li[class*=payment_method] > input[name=payment_method] + label{
502
+ padding: 0px;
503
+ }
504
+ ul.payment_methods li[class*=payment_method] .payment_box{
505
+ margin-top: 10px;
506
+ }
507
+
508
+ ul.payment_methods li[class*=payment_method_stripe_]:not([class*=stripe_cc]) .wc-stripe-gateway-desc:not(.has_tokens) p{
509
+ margin: 0;
510
+ }
511
+ ul.payment_methods{
512
+ list-style: none;
513
+ }
514
+ ul.payment_methods li[class*=payment_method_stripe_] .wc-stripe_cc-new-method-container label:before{
515
+ display: none;
516
+ }
517
+ .wc-stripe_cc-container .wc-stripe-save-source label.checkbox{
518
+ padding: 0 !important;
519
+ margin: 0px;
520
+ }
521
+ .wc-stripe_cc-container .wc-stripe-save-source .save-source-label{
522
+ padding: 0;
523
+ margin-bottom: 5px;
524
  }
assets/js/admin/admin-settings.js CHANGED
@@ -19,6 +19,8 @@ jQuery(function($) {
19
 
20
  $('.wc-stripe-create-webhook').on('click', this.create_webhook.bind(this));
21
 
 
 
22
  this.display_children();
23
  }
24
 
@@ -119,6 +121,33 @@ jQuery(function($) {
119
  }.bind(this))
120
  }
121
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
122
  /**
123
  * [block description]
124
  * @param {[type]} $el [description]
19
 
20
  $('.wc-stripe-create-webhook').on('click', this.create_webhook.bind(this));
21
 
22
+ $('.wc-stripe-connection-test').on('click', this.do_connection_test.bind(this));
23
+
24
  this.display_children();
25
  }
26
 
121
  }.bind(this))
122
  }
123
 
124
+ Settings.prototype.do_connection_test = function(e) {
125
+ e.preventDefault();
126
+ this.block();
127
+ var mode = $('#woocommerce_stripe_api_mode').val();
128
+ $.ajax({
129
+ url: this.params.routes.connection_test,
130
+ dataType: 'json',
131
+ method: 'POST',
132
+ data: {
133
+ _wpnonce: this.params.rest_nonce,
134
+ mode: mode,
135
+ secret_key: $('#woocommerce_stripe_api_secret_key_' + mode).val(),
136
+ publishable_key: $('#woocommerce_stripe_api_publishable_key_' + mode).val()
137
+ }
138
+ }).done(function(response) {
139
+ this.unblock();
140
+ if (response.code) {
141
+ window.alert(response.message);
142
+ } else {
143
+ window.alert(response.message);
144
+ }
145
+ }.bind(this)).fail(function(xhr, textStatus, errorThrown) {
146
+ this.unblock();
147
+ window.alert(errorThrown);
148
+ }.bind(this))
149
+ }
150
+
151
  /**
152
  * [block description]
153
  * @param {[type]} $el [description]
assets/js/frontend/applepay-cart.js CHANGED
@@ -8,6 +8,7 @@
8
  wc_stripe.CartGateway.call(this);
9
  this.canMakePayment().then(function() {
10
  $(this.container).addClass('active').parent().addClass('active');
 
11
  }.bind(this));
12
 
13
  }
@@ -32,6 +33,7 @@
32
  if (this.can_pay) {
33
  this.create_button();
34
  $(this.container).show().addClass('active').parent().addClass('active');
 
35
  }
36
  }
37
 
8
  wc_stripe.CartGateway.call(this);
9
  this.canMakePayment().then(function() {
10
  $(this.container).addClass('active').parent().addClass('active');
11
+ this.add_cart_totals_class();
12
  }.bind(this));
13
 
14
  }
33
  if (this.can_pay) {
34
  this.create_button();
35
  $(this.container).show().addClass('active').parent().addClass('active');
36
+ this.add_cart_totals_class();
37
  }
38
  }
39
 
assets/js/frontend/applepay-checkout.js CHANGED
@@ -52,6 +52,13 @@
52
  wc_stripe.ApplePay.prototype.start.apply(this, arguments);
53
  }
54
 
 
 
 
 
 
 
 
55
  new ApplePay();
56
 
57
  }(jQuery, window.wc_stripe))
52
  wc_stripe.ApplePay.prototype.start.apply(this, arguments);
53
  }
54
 
55
+ ApplePay.prototype.on_token_received = function() {
56
+ wc_stripe.CheckoutGateway.prototype.on_token_received.apply(this, arguments);
57
+ if (this.checkout_fields_valid()) {
58
+ this.get_form().submit();
59
+ }
60
+ }
61
+
62
  new ApplePay();
63
 
64
  }(jQuery, window.wc_stripe))
assets/js/frontend/applepay-product.js CHANGED
@@ -3,6 +3,7 @@
3
  function ApplePay() {
4
  wc_stripe.BaseGateway.call(this, wc_stripe_applepay_product_params);
5
  wc_stripe.ProductGateway.call(this);
 
6
  }
7
 
8
  /**
@@ -76,6 +77,16 @@
76
  }
77
  }
78
 
 
 
 
 
 
 
 
 
 
 
79
  new ApplePay();
80
 
81
  }(jQuery, wc_stripe))
3
  function ApplePay() {
4
  wc_stripe.BaseGateway.call(this, wc_stripe_applepay_product_params);
5
  wc_stripe.ProductGateway.call(this);
6
+ this.old_qty = this.get_quantity();
7
  }
8
 
9
  /**
77
  }
78
  }
79
 
80
+ ApplePay.prototype.add_to_cart = function(e) {
81
+ if (this.$button.is('.disabled') && this.can_pay) {
82
+ $('[name="quantity"]').val(this.old_qty);
83
+ this.submit_error(this.params.messages.choose_product);
84
+ return;
85
+ }
86
+ this.old_qty = this.get_quantity();
87
+ wc_stripe.ProductGateway.prototype.add_to_cart.apply(this, arguments);
88
+ }
89
+
90
  new ApplePay();
91
 
92
  }(jQuery, wc_stripe))
assets/js/frontend/credit-card.js CHANGED
@@ -221,20 +221,10 @@
221
  } else {
222
  if (!this.payment_token_received && !this.is_saved_method_selected()) {
223
  e.preventDefault();
224
- this.stripe.createPaymentMethod('card', this.is_custom_form() ? this.cardNumber : this.card, {
225
- billing_details: {
226
- name: $('#billing_first_name').val() + ' ' + $('#billing_last_name').val(),
227
- email: $('#billing_email').val(),
228
- phone: $('#billing_phone').val(),
229
- address: {
230
- city: $('#billing_city').val(),
231
- country: $('#billing_country').val(),
232
- line1: $('#billing_address_1').val(),
233
- line2: $('#billing_address_2').val(),
234
- postal_code: this.get_postal_code(),
235
- state: $('#billing_state').val()
236
- }
237
- }
238
  }).then(function(result) {
239
  if (result.error) {
240
  this.submit_error(result.error.message);
@@ -360,6 +350,34 @@
360
  }
361
  }
362
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
363
  new CC();
364
 
365
  }(jQuery, window.wc_stripe))
221
  } else {
222
  if (!this.payment_token_received && !this.is_saved_method_selected()) {
223
  e.preventDefault();
224
+ this.stripe.createPaymentMethod({
225
+ type: 'card',
226
+ card: this.is_custom_form() ? this.cardNumber : this.card,
227
+ billing_details: this.get_billing_details()
 
 
 
 
 
 
 
 
 
 
228
  }).then(function(result) {
229
  if (result.error) {
230
  this.submit_error(result.error.message);
350
  }
351
  }
352
 
353
+ CC.prototype.checkout_error = function() {
354
+ if (this.is_gateway_selected()) {
355
+ this.payment_token_received = false;
356
+ }
357
+ wc_stripe.CheckoutGateway.prototype.checkout_error.call(this);
358
+ }
359
+
360
+ CC.prototype.get_billing_details = function() {
361
+ var details = {
362
+ name: $('#billing_first_name').val() + ' ' + $('#billing_last_name').val(),
363
+ address: {
364
+ city: $('#billing_city').val(),
365
+ country: $('#billing_country').val(),
366
+ line1: $('#billing_address_1').val(),
367
+ line2: $('#billing_address_2').val(),
368
+ postal_code: this.get_postal_code(),
369
+ state: $('#billing_state').val()
370
+ }
371
+ }
372
+ if ($('#billing_email').length && $('#billing_email').val() != '') {
373
+ details.email = $('#billing_email').val();
374
+ }
375
+ if ($('#billing_phone').length && $('#billing_phone').val() != '') {
376
+ details.phone = $('#billing_phone').val();
377
+ }
378
+ return details;
379
+ }
380
+
381
  new CC();
382
 
383
  }(jQuery, window.wc_stripe))
assets/js/frontend/form-handler.js CHANGED
@@ -18,8 +18,14 @@
18
  $(document.body).on('change', '[name="payment_method"]', this.payment_method_selected.bind(this));
19
  $(document.body).on('updated_checkout', this.updated_checkout.bind(this));
20
  $(document.body).on('change', '.wc-stripe-payment-type', this.payment_type_change.bind(this));
 
21
 
22
  this.saved_payment_methods();
 
 
 
 
 
23
  }
24
 
25
 
@@ -109,6 +115,17 @@
109
  return data.text;
110
  }
111
 
 
 
 
 
 
 
 
 
 
 
 
112
  new Handler();
113
 
114
  }(jQuery))
18
  $(document.body).on('change', '[name="payment_method"]', this.payment_method_selected.bind(this));
19
  $(document.body).on('updated_checkout', this.updated_checkout.bind(this));
20
  $(document.body).on('change', '.wc-stripe-payment-type', this.payment_type_change.bind(this));
21
+ $(document.body).on('updated_wc_div, updated_cart_totals', this.cart_html.bind(this));
22
 
23
  this.saved_payment_methods();
24
+
25
+ if ($(document.body).is('.woocommerce-cart')) {
26
+ $(window).on('resize', this.cart_html);
27
+ this.cart_html();
28
+ }
29
  }
30
 
31
 
115
  return data.text;
116
  }
117
 
118
+ Handler.prototype.cart_html = function() {
119
+ var $button = $('.checkout-button'),
120
+ width = $button.outerWidth();
121
+ if (width && $('.wc_stripe_cart_payment_methods').length) {
122
+ $('.wc_stripe_cart_payment_methods ').width(width);
123
+ }
124
+ if ($button.css('float') !== 'none') {
125
+ $('.wc_stripe_cart_payment_methods ').css('float', $button.css('float'));
126
+ }
127
+ }
128
+
129
  new Handler();
130
 
131
  }(jQuery))
assets/js/frontend/googlepay-cart.js CHANGED
@@ -21,6 +21,7 @@
21
  this.createPaymentsClient();
22
  this.isReadyToPay().then(function() {
23
  $(this.container).show().addClass('active').parent().addClass('active');
 
24
  }.bind(this))
25
  }
26
 
@@ -39,6 +40,7 @@
39
  if (this.can_pay) {
40
  this.create_button();
41
  $(this.container).show().addClass('active').parent().addClass('active');
 
42
  }
43
  }
44
 
21
  this.createPaymentsClient();
22
  this.isReadyToPay().then(function() {
23
  $(this.container).show().addClass('active').parent().addClass('active');
24
+ this.add_cart_totals_class();
25
  }.bind(this))
26
  }
27
 
40
  if (this.can_pay) {
41
  this.create_button();
42
  $(this.container).show().addClass('active').parent().addClass('active');
43
+ this.add_cart_totals_class();
44
  }
45
  }
46
 
assets/js/frontend/googlepay-checkout.js CHANGED
@@ -65,6 +65,13 @@
65
  wc_stripe.GooglePay.prototype.start.apply(this, arguments);
66
  }
67
 
 
 
 
 
 
 
 
68
  new GPay();
69
 
70
  }(jQuery, window.wc_stripe))
65
  wc_stripe.GooglePay.prototype.start.apply(this, arguments);
66
  }
67
 
68
+ GPay.prototype.on_token_received = function() {
69
+ wc_stripe.CheckoutGateway.prototype.on_token_received.apply(this, arguments);
70
+ if (this.checkout_fields_valid()) {
71
+ this.get_form().submit();
72
+ }
73
+ }
74
+
75
  new GPay();
76
 
77
  }(jQuery, window.wc_stripe))
assets/js/frontend/payment-request.js CHANGED
@@ -8,6 +8,7 @@
8
  function PaymentRequest() {
9
  wc_stripe.BaseGateway.call(this, wc_stripe_payment_request_params);
10
  wc_stripe.ProductGateway.call(this);
 
11
  }
12
 
13
  PaymentRequest.prototype = $.extend({}, wc_stripe.BaseGateway.prototype, wc_stripe.ProductGateway.prototype, wc_stripe.PaymentRequest.prototype);
@@ -18,7 +19,6 @@
18
  */
19
  PaymentRequest.prototype.canMakePayment = function() {
20
  wc_stripe.PaymentRequest.prototype.canMakePayment.apply(this, arguments).then(function(result) {
21
- //$('[name="quantity"]').val(0);
22
  $(document.body).on('change', '[name="quantity"]', this.add_to_cart.bind(this));
23
  if (!this.is_variable_product()) {
24
  this.cart_calculation().then(function() {
@@ -28,7 +28,7 @@
28
  }
29
  }));
30
  }.bind(this)).catch(function() {
31
- $('[name="quantity"]').val(0);
32
  }.bind(this))
33
  } else {
34
  if (this.$button.not('.disabled')) {
@@ -55,12 +55,13 @@
55
  /**
56
  * [add_to_cart description]
57
  */
58
- PaymentRequest.prototype.add_to_cart = function() {
59
  if (this.$button.is('.disabled') && this.can_pay) {
60
- $('[name="quantity"]').val(0);
61
  this.submit_error(this.params.messages.choose_product);
62
  return;
63
  }
 
64
  this.adding_to_cart = true;
65
  wc_stripe.ProductGateway.prototype.add_to_cart.apply(this, arguments).then(function() {
66
  this.paymentRequest.update(this.get_payment_request_update({
@@ -85,7 +86,6 @@
85
  }
86
  }.bind(this)).catch(function() {
87
  wc_stripe.ProductGateway.prototype.found_variation.call(this, e, variation);
88
- $('[name="quantity"]').val(0);
89
  }.bind(this))
90
  }
91
  }
@@ -224,6 +224,13 @@
224
  this.set_payment_method(this.gateway_id);
225
  this.set_use_new_option(true);
226
  }
 
 
 
 
 
 
 
227
  }
228
 
229
  new PaymentRequest();
8
  function PaymentRequest() {
9
  wc_stripe.BaseGateway.call(this, wc_stripe_payment_request_params);
10
  wc_stripe.ProductGateway.call(this);
11
+ this.old_qty = this.get_quantity();
12
  }
13
 
14
  PaymentRequest.prototype = $.extend({}, wc_stripe.BaseGateway.prototype, wc_stripe.ProductGateway.prototype, wc_stripe.PaymentRequest.prototype);
19
  */
20
  PaymentRequest.prototype.canMakePayment = function() {
21
  wc_stripe.PaymentRequest.prototype.canMakePayment.apply(this, arguments).then(function(result) {
 
22
  $(document.body).on('change', '[name="quantity"]', this.add_to_cart.bind(this));
23
  if (!this.is_variable_product()) {
24
  this.cart_calculation().then(function() {
28
  }
29
  }));
30
  }.bind(this)).catch(function() {
31
+
32
  }.bind(this))
33
  } else {
34
  if (this.$button.not('.disabled')) {
55
  /**
56
  * [add_to_cart description]
57
  */
58
+ PaymentRequest.prototype.add_to_cart = function(e) {
59
  if (this.$button.is('.disabled') && this.can_pay) {
60
+ $('[name="quantity"]').val(this.old_qty);
61
  this.submit_error(this.params.messages.choose_product);
62
  return;
63
  }
64
+ this.old_qty = this.get_quantity();
65
  this.adding_to_cart = true;
66
  wc_stripe.ProductGateway.prototype.add_to_cart.apply(this, arguments).then(function() {
67
  this.paymentRequest.update(this.get_payment_request_update({
86
  }
87
  }.bind(this)).catch(function() {
88
  wc_stripe.ProductGateway.prototype.found_variation.call(this, e, variation);
 
89
  }.bind(this))
90
  }
91
  }
224
  this.set_payment_method(this.gateway_id);
225
  this.set_use_new_option(true);
226
  }
227
+
228
+ PaymentRequest.prototype.on_token_received = function() {
229
+ wc_stripe.CheckoutGateway.prototype.on_token_received.apply(this, arguments);
230
+ if (this.checkout_fields_valid()) {
231
+ this.get_form().submit();
232
+ }
233
+ }
234
  }
235
 
236
  new PaymentRequest();
assets/js/frontend/wc-stripe.js CHANGED
@@ -915,6 +915,33 @@
915
  return this.params.banner_enabled === "1";
916
  }
917
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
918
  /************** Product Gateway ***************/
919
 
920
  wc_stripe.ProductGateway = function() {
@@ -1123,6 +1150,10 @@
1123
 
1124
  }
1125
 
 
 
 
 
1126
  /************* Google Pay Mixins **************/
1127
 
1128
  wc_stripe.GooglePay = function() {}
915
  return this.params.banner_enabled === "1";
916
  }
917
 
918
+ wc_stripe.CheckoutGateway.prototype.checkout_fields_valid = function() {
919
+ var billing = Object.keys(wc_stripe_checkout_fields.billing),
920
+ shipping = Object.keys(wc_stripe_checkout_fields.shipping);
921
+ valid = true;
922
+
923
+ function validateFields(keys, fields) {
924
+ for (var i = 0; i < keys.length; i++) {
925
+ var field = fields[keys[i]];
926
+ if (field.required) {
927
+ var val = $('#' + keys[i]).val();
928
+ if ((typeof val == 'undefined' || val.length == 0)) {
929
+ valid = false;
930
+ return
931
+ }
932
+ }
933
+ }
934
+ }
935
+
936
+ validateFields(billing, wc_stripe_checkout_fields.billing);
937
+
938
+ if (this.needs_shipping() && $('#ship-to-different-address-checkbox').is(':checked')) {
939
+ validateFields(shipping, wc_stripe_checkout_fields.shipping);
940
+ }
941
+ valid = this.is_valid_checkout();
942
+ return valid;
943
+ }
944
+
945
  /************** Product Gateway ***************/
946
 
947
  wc_stripe.ProductGateway = function() {
1150
 
1151
  }
1152
 
1153
+ wc_stripe.CartGateway.prototype.add_cart_totals_class = function() {
1154
+ $('.cart_totals').addClass('stripe_cart_gateway_active');
1155
+ }
1156
+
1157
  /************* Google Pay Mixins **************/
1158
 
1159
  wc_stripe.GooglePay = function() {}
assets/js/frontend/wc-stripe.min.js CHANGED
@@ -1 +1 @@
1
- !function(t,e){t.wc_stripe={};var i=Stripe(wc_stripe_params_v3.api_key);wc_stripe.BaseGateway=function(t){this.params=t,this.gateway_id=this.params.gateway_id,this.token_selector=this.params.token_selector,this.saved_method_selector=this.params.saved_method_selector,this.payment_intent_selector=this.params.payment_intent_selector,this.payment_token_received=!1,this.stripe=i,this.elements=i.elements(e.extend({},{locale:"auto"},this.get_element_options())),this.initialize()},wc_stripe.BaseGateway.prototype.get_page=function(){return wc_stripe_params_v3.page},wc_stripe.BaseGateway.prototype.set_nonce=function(t){e(this.token_selector).val(t)},wc_stripe.BaseGateway.prototype.get_element_options=function(){return{}},wc_stripe.BaseGateway.prototype.initialize=function(){},wc_stripe.BaseGateway.prototype.create_button=function(){},wc_stripe.BaseGateway.prototype.is_gateway_selected=function(){return e('[name="payment_method"]:checked').val()===this.gateway_id},wc_stripe.BaseGateway.prototype.is_saved_method_selected=function(){return this.is_gateway_selected()&&"saved"===e('[name="'+this.gateway_id+'_payment_type_key"]:checked').val()},wc_stripe.BaseGateway.prototype.has_checkout_error=function(){return e("#wc_stripe_checkout_error").length>0&&this.is_gateway_selected()},wc_stripe.BaseGateway.prototype.submit_error=function(t){-1==t.indexOf("</ul>")&&(t='<div class="woocommerce-error">'+t+"</div>"),this.submit_message(t)},wc_stripe.BaseGateway.prototype.submit_error_code=function(t){},wc_stripe.BaseGateway.prototype.submit_message=function(t){e(".woocommerce-error, .woocommerce-message, .woocommerce-info").remove();var i=e(this.message_container);i.closest("form").length&&(i=i.closest("form")),i.prepend(t),i.removeClass("processing").unblock(),i.find(".input-text, select, input:checkbox").blur(),e("html, body").animate({scrollTop:i.offset().top-100},1e3)},wc_stripe.BaseGateway.prototype.get_first_name=function(t){return e("#"+t+"_first_name").val()},wc_stripe.BaseGateway.prototype.get_last_name=function(t){return e("#"+t+"_last_name").val()},wc_stripe.BaseGateway.prototype.should_save_method=function(){return e("#"+this.gateway_id+"_save_source_key").is(":checked")},wc_stripe.BaseGateway.prototype.is_add_payment_method_page=function(){return e(document.body).hasClass("woocommerce-add-payment-method")},wc_stripe.BaseGateway.prototype.get_selected_payment_method=function(){return e(this.saved_method_selector).val()},wc_stripe.BaseGateway.prototype.needs_shipping=function(){return"1"===this.params.needs_shipping},wc_stripe.BaseGateway.prototype.get_currency=function(){return e("#wc_stripe_currency").val()},wc_stripe.BaseGateway.prototype.get_country=function(){return e("#wc_stripe_country").val()},wc_stripe.BaseGateway.prototype.get_customer_name=function(t){return e(t+"_first_name").val()+" "+e(t+"_last_name").val()},wc_stripe.BaseGateway.prototype.get_customer_email=function(){return e("#billing_email").val()},wc_stripe.BaseGateway.prototype.get_address_field_hash=function(t){for(var i=["_first_name","_last_name","_address_1","_address_2","_postcode","_city","_state","_country"],a="",n=0;n<i.length;n++)a+=e(t+i[n]).val()+"_";return a},wc_stripe.BaseGateway.prototype.block=function(){e.blockUI({message:null,overlayCSS:{background:"#fff",opacity:.6}})},wc_stripe.BaseGateway.prototype.unblock=function(){e.unblockUI()},wc_stripe.BaseGateway.prototype.get_form=function(){return e(this.token_selector).closest("form")},wc_stripe.BaseGateway.prototype.get_total_price=function(){return e("#wc_stripe_order_total").data("amount")},wc_stripe.BaseGateway.prototype.get_total_price_cents=function(){return e("#wc_stripe_order_total_cents").data("amount")},wc_stripe.BaseGateway.prototype.set_total_price=function(t){e("#wc_stripe_order_total").data("amount",t)},wc_stripe.BaseGateway.prototype.set_total_price_cents=function(t){e("#wc_stripe_order_total_cents").data("amount",t)},wc_stripe.BaseGateway.prototype.set_payment_method=function(t){e('[name="payment_method"][value="'+t+'"]').prop("checked",!0).trigger("click")},wc_stripe.BaseGateway.prototype.set_selected_shipping_methods=function(t){if(t&&e('[name^="shipping_method"]').length)for(var i in t){var a=t[i];e('[name="shipping_method['+i+']"][value="'+a+'"]').prop("checked",!0).trigger("change")}},wc_stripe.BaseGateway.prototype.on_token_received=function(t){this.payment_token_received=!0,e(this.token_selector).val(t.id),this.process_checkout()},wc_stripe.BaseGateway.prototype.createPaymentRequest=function(){this.paymentRequest=i.paymentRequest(this.get_payment_request_options()),this.needs_shipping()&&(this.paymentRequest.on("shippingaddresschange",this.update_shipping_address.bind(this)),this.paymentRequest.on("shippingoptionchange",this.update_shipping_method.bind(this))),this.paymentRequest.on("paymentmethod",this.on_payment_method_received.bind(this))},wc_stripe.BaseGateway.prototype.get_payment_request_options=function(){var t={country:this.params.country_code,currency:this.get_currency().toLowerCase(),total:{amount:this.get_total_price_cents(),label:this.params.total_label,pending:!0},requestPayerName:!0,requestPayerEmail:!0,requestPayerPhone:!0,requestShipping:this.needs_shipping()},e=this.get_display_items(),i=this.get_shipping_options();return e&&(t.displayItems=e),this.needs_shipping()&&i&&(t.shippingOptions=i),t},wc_stripe.BaseGateway.prototype.get_payment_request_update=function(t){var i={currency:this.get_currency().toLowerCase(),total:{amount:parseInt(this.get_total_price_cents()),label:this.params.total_label,pending:!0}},a=this.get_display_items(),n=this.get_shipping_options();return a&&(i.displayItems=a),this.needs_shipping()&&n&&(i.shippingOptions=n),t&&(i=e.extend(!0,{},i,t)),i},wc_stripe.BaseGateway.prototype.get_display_items=function(){return e("#wc_stripe_display_items").data("items")},wc_stripe.BaseGateway.prototype.set_display_items=function(t){e("#wc_stripe_display_items").data("items",t)},wc_stripe.BaseGateway.prototype.get_shipping_options=function(){return e("#wc_stripe_shipping_options").data("items")},wc_stripe.BaseGateway.prototype.set_shipping_options=function(t){e("#wc_stripe_shipping_options").data("items",t)},wc_stripe.BaseGateway.prototype.map_address=function(t){return{city:t.city,postcode:t.postalCode,state:t.region,country:t.country}},wc_stripe.BaseGateway.prototype.on_payment_method_received=function(e){try{this.payment_response=e,this.populate_checkout_fields(e),e.complete("success"),this.on_token_received(e.paymentMethod)}catch(e){t.alert(e)}},wc_stripe.BaseGateway.prototype.populate_checkout_fields=function(t){e(this.token_selector).val(t.paymentMethod.id),this.populate_address_fields(t)},wc_stripe.BaseGateway.prototype.populate_address_fields=function(t){var i=this.address_mappings();if(t.payerName&&i.payerName.set(t.payerName),t.payerEmail&&i.payerEmail.set(t.payerEmail),t.payerPhone&&i.payerPhone.set(t.payerPhone),t.shippingAddress){var a=t.shippingAddress;for(var n in a)i[n]&&i[n].set.call(this,a[n],"#shipping")}if(t.paymentMethod.billing_details.address){a=t.paymentMethod.billing_details.address;for(var n in a)i[n]&&i[n].set.call(this,a[n],"#billing")}this.maybe_set_ship_to_different(),e('[name="billing_country"]').trigger("change")},wc_stripe.BaseGateway.prototype.address_mappings=function(){return{payerName:{set:function(t,i){var a=t.split(" ");a.length>0&&e("#billing_first_name").val(a[0]),a.length>1&&e("#billing_last_name").val(a[1])},get:function(t){return e("#billing_first_name").val()+" "+e("#billing_last_name").val()}},payerEmail:{set:function(t){e("#billing_email").val(t)},get:function(){return e("#billing_email").val()}},payerPhone:{set:function(t){e("#billing_phone").val(t)},get:function(){return e("#billing_phone").val()}},recipient:{set:function(t,i){var a=t.split(" ");a.length>0&&e(i+"_first_name").val(a[0]),a.length>1&&e(i+"_last_name").val(a[1])},get:function(t){return e(t+"_first_name").val()+" "+e(t+"_last_name").val()}},country:{set:function(t,i){e(i+"_country").val(t)},get:function(t){return e(t+"_country").val()}},addressLine:{set:function(t,i){t.length>0&&e(i+"_address_1").val(t[0]),t.length>1&&e(i+"_address_2").val(t[1])},get:function(t){return[e(t+"_address_1").val(),e(t+"_address_2").val()]}},line1:{set:function(t,i){e(i+"_address_1").val(t)},get:function(t){return e(t+"_address_1").val()}},line2:{set:function(t,i){e(i+"_address_2").val(t)},get:function(t){return e(t+"_address_2").val()}},region:{set:function(t,i){e(i+"_state").val(t)},get:function(t){e(t+"_state").val()}},state:{set:function(t,i){e(i+"_state").val(t)},get:function(t){e(t+"_state").val()}},city:{set:function(t,i){e(i+"_city").val(t)},get:function(t){e(t+"_city").val()}},postalCode:{set:function(t,i){e(i+"_postcode").val(t)},get:function(t){e(t+"_postcode").val()}},postal_code:{set:function(t,i){e(i+"_postcode").val(t)},get:function(t){e(t+"_postcode").val()}}}},wc_stripe.BaseGateway.prototype.process_checkout=function(){return new Promise(function(i,a){this.block(),e.ajax({url:this.params.routes.checkout,method:"POST",dataType:"json",data:e.extend({},this.serialize_form(this.get_form()),{payment_method:this.gateway_id,page_id:this.get_page()}),beforeSend:function(t){t.setRequestHeader("X-WP-Nonce",this.params.rest_nonce)}.bind(this)}).done(function(e){e.reload?t.location.reload():"success"===e.result?t.location=e.redirect:(e.messages&&this.submit_error(e.messages),this.unblock())}.bind(this)).fail(function(t,e,i){this.unblock(),this.submit_error(i)}.bind(this))}.bind(this))},wc_stripe.BaseGateway.prototype.serialize_form=function(t){var i=t.find("input").filter(function(t,i){return!e(i).is('[name^="add-to-cart"]')}.bind(this)).serializeArray(),a={};for(var n in i){var s=i[n];a[s.name]=s.value}return a.payment_method=this.gateway_id,a},wc_stripe.BaseGateway.prototype.map_shipping_methods=function(t){var e={};if("default"!==t){var i=t.match(/^(\d):(.+)$/);i.length>1&&(e[i[1]]=i[2])}return e},wc_stripe.BaseGateway.prototype.maybe_set_ship_to_different=function(){e('[name="ship_to_different_address"]').length&&e('[name="ship_to_different_address"]').prop("checked",this.get_address_field_hash("#billing")!==this.get_address_field_hash("#shipping")).trigger("change")},wc_stripe.BaseGateway.prototype.update_shipping_address=function(t){return new Promise(function(i,a){e.ajax({url:this.params.routes.shipping_address,method:"POST",dataType:"json",data:{address:this.map_address(t.shippingAddress),payment_method:this.gateway_id,page_id:this.get_page()},beforeSend:function(t){t.setRequestHeader("X-WP-Nonce",this.params.rest_nonce)}.bind(this)}).done(function(e){e.code?(t.updateWith(e.data.newData),a(e.data)):(t.updateWith(e.data.newData),i(e.data))}.bind(this)).fail(function(t,e,i){}.bind(this))}.bind(this))},wc_stripe.BaseGateway.prototype.update_shipping_method=function(t){return new Promise(function(i,a){e.ajax({url:this.params.routes.shipping_method,method:"POST",dataType:"json",data:{shipping_methods:this.map_shipping_methods(t.shippingOption.id),payment_method:this.gateway_id,page_id:this.get_page()},beforeSend:function(t){t.setRequestHeader("X-WP-Nonce",this.params.rest_nonce)}.bind(this)}).done(function(e){e.code?(t.updateWith(e.data.newData),a(e.data)):(this.set_selected_shipping_methods(e.data.shipping_methods),t.updateWith(e.data.newData),i(e.data))}.bind(this)).fail(function(t,e,i){this.submit_error(i)}.bind(this))}.bind(this))},wc_stripe.CheckoutGateway=function(){this.container=this.message_container="li.payment_method_"+this.gateway_id,this.banner_container="li.banner_payment_method_"+this.gateway_id,e(document.body).on("update_checkout",this.update_checkout.bind(this)),e(document.body).on("updated_checkout",this.updated_checkout.bind(this)),e(document.body).on("checkout_error",this.checkout_error.bind(this)),e(this.token_selector).closest("form").on("checkout_place_order_"+this.gateway_id,this.checkout_place_order.bind(this)),e(document.body).on("wc_stripe_new_method_"+this.gateway_id,this.on_show_new_methods.bind(this)),e(document.body).on("wc_stripe_saved_method_"+this.gateway_id,this.on_show_saved_methods.bind(this)),e(document.body).on("wc_stripe_payment_method_selected",this.on_payment_method_selected.bind(this)),this.banner_enabled()&&e(".woocommerce-billing-fields").length&&e(".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],a=e[2];this.gateway_id===i&&(this.payment_token_received=!0,this.set_nonce(a),this.set_use_new_option(!0))}},wc_stripe.CheckoutGateway.prototype.updated_checkout=function(){},wc_stripe.CheckoutGateway.prototype.update_checkout=function(){},wc_stripe.CheckoutGateway.prototype.checkout_error=function(){this.has_checkout_error()&&(this.payment_token_received=!1,this.payment_response=null,this.show_payment_button(),this.hide_place_order())},wc_stripe.CheckoutGateway.prototype.is_valid_checkout=function(){return!(e('[name="terms"]').length&&!e('[name="terms"]').is(":checked"))},wc_stripe.CheckoutGateway.prototype.get_payment_method=function(){return e('[name="payment_method"]:checked').val()},wc_stripe.CheckoutGateway.prototype.set_use_new_option=function(t){e("#"+this.gateway_id+"_use_new").prop("checked",t).trigger("change")},wc_stripe.CheckoutGateway.prototype.checkout_place_order=function(){return this.is_valid_checkout()?!!this.is_saved_method_selected()||this.payment_token_received:(this.submit_error(this.params.messages.terms),!1)},wc_stripe.CheckoutGateway.prototype.on_token_received=function(t){this.payment_token_received=!0,e(this.token_selector).val(t.id),this.hide_payment_button(),this.show_place_order()},wc_stripe.CheckoutGateway.prototype.block=function(){e("form.checkout").block({message:null,overlayCSS:{background:"#fff",opacity:.6}})},wc_stripe.CheckoutGateway.prototype.unblock=function(){e("form.checkout").unblock()},wc_stripe.CheckoutGateway.prototype.hide_place_order=function(){e("#place_order").addClass("wc-stripe-hide")},wc_stripe.CheckoutGateway.prototype.show_place_order=function(){e("#place_order").removeClass("wc-stripe-hide")},wc_stripe.CheckoutGateway.prototype.on_show_new_methods=function(){this.payment_token_received?(this.show_place_order(),this.hide_payment_button()):(this.hide_place_order(),this.show_payment_button())},wc_stripe.CheckoutGateway.prototype.on_show_saved_methods=function(){this.hide_payment_button(),this.show_place_order()},wc_stripe.CheckoutGateway.prototype.show_payment_button=function(){this.$button&&this.$button.show()},wc_stripe.CheckoutGateway.prototype.hide_payment_button=function(){this.$button&&this.$button.hide()},wc_stripe.CheckoutGateway.prototype.trigger_payment_method_selected=function(){this.on_payment_method_selected(null,e('[name="payment_method"]:checked').val())},wc_stripe.CheckoutGateway.prototype.on_payment_method_selected=function(t,e){e===this.gateway_id?this.payment_token_received||this.is_saved_method_selected()?(this.hide_payment_button(),this.show_place_order()):(this.show_payment_button(),this.hide_place_order()):(this.hide_payment_button(),e.indexOf("stripe_")<0&&this.show_place_order())},wc_stripe.CheckoutGateway.prototype.banner_enabled=function(){return"1"===this.params.banner_enabled},wc_stripe.ProductGateway=function(){this.container="li.payment_method_"+this.gateway_id,this.message_container="div.product",e(document.body).on("wc_stripe_updated_rest_nonce",this.set_rest_nonce.bind(this)),e("form.cart").on("found_variation",this.found_variation.bind(this)),e("form.cart").on("reset_data",this.reset_variation_data.bind(this)),this.buttonWidth=e("div.quantity").outerWidth(!0)+e(".single_add_to_cart_button").outerWidth(),e(this.container).css("max-width",this.buttonWidth+"px")},wc_stripe.ProductGateway.prototype.get_quantity=function(){return parseInt(e('[name="quantity"]').val())},wc_stripe.ProductGateway.prototype.set_rest_nonce=function(t,e){this.params.rest_nonce=e},wc_stripe.ProductGateway.prototype.found_variation=function(t,e){var i=this.get_product_data();i.price=e.display_price,i.needs_shipping=!e.is_virtual,i.variation=e,this.set_product_data(i),this.enable_payment_button()},wc_stripe.ProductGateway.prototype.reset_variation_data=function(){this.disable_payment_button()},wc_stripe.ProductGateway.prototype.disable_payment_button=function(){this.$button&&this.get_button().prop("disabled",!0).addClass("disabled")},wc_stripe.ProductGateway.prototype.enable_payment_button=function(){this.$button&&this.get_button().prop("disabled",!1).removeClass("disabled")},wc_stripe.ProductGateway.prototype.get_button=function(){return this.$button},wc_stripe.ProductGateway.prototype.is_variable_product=function(){return e('[name="variation_id"]').length>0},wc_stripe.ProductGateway.prototype.needs_shipping=function(){return this.get_product_data().needs_shipping},wc_stripe.ProductGateway.prototype.get_product_data=function(){return e("#wc_stripe_product_data").data("product")},wc_stripe.ProductGateway.prototype.set_product_data=function(t){e("#wc_stripe_product_data").data("product",t)},wc_stripe.ProductGateway.prototype.add_to_cart=function(){return new Promise(function(t,i){this.block(),e.ajax({url:this.params.routes.add_to_cart,method:"POST",dataType:"json",data:{product_id:e("#product_id").val(),variation_id:this.is_variable_product()?e('[name="variation_id"]').val():0,qty:e('[name="quantity"]').val(),payment_method:this.gateway_id,page_id:this.get_page()},beforeSend:function(t){t.setRequestHeader("X-WP-Nonce",this.params.rest_nonce)}.bind(this)}).done(function(a,n,s){this.unblock(),e(document.body).triggerHandler("wc_stripe_updated_rest_nonce",s.getResponseHeader("X-WP-Nonce")),a.code?(this.submit_error(a.message),i(a)):(this.set_total_price(a.data.total),this.set_total_price_cents(a.data.totalCents),this.set_display_items(a.data.displayItems),t(a.data))}.bind(this)).fail(function(t,e,i){this.unblock(),this.submit_error(i)}.bind(this))}.bind(this))},wc_stripe.ProductGateway.prototype.cart_calculation=function(t){return new Promise(function(i,a){e.ajax({url:this.params.routes.cart_calculation,method:"POST",dataType:"json",data:{product_id:e("#product_id").val(),variation_id:this.is_variable_product()&&t?t:0,qty:e('[name="quantity"]').val(),payment_method:this.gateway_id},beforeSend:function(t){t.setRequestHeader("X-WP-Nonce",this.params.rest_nonce)}.bind(this)}).done(function(t,a,n){e(document.body).triggerHandler("wc_stripe_updated_rest_nonce",n.getResponseHeader("X-WP-Nonce")),t.code?this.cart_calculation_error=!0:(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.container="li.payment_method_"+this.gateway_id,this.message_container="div.woocommerce",e(document.body).on("updated_wc_div",this.updated_html.bind(this)),e(document.body).on("updated_cart_totals",this.updated_html.bind(this))},wc_stripe.CartGateway.prototype.needs_shipping=function(){return 1===e("#wc_stripe_needs_shipping").data("value")},wc_stripe.CartGateway.prototype.submit_error=function(t){this.submit_message(t)},wc_stripe.CartGateway.prototype.updated_html=function(t){},wc_stripe.GooglePay=function(){};const a={apiVersion:2,apiVersionMinor:0},n={type:"CARD",parameters:{allowedAuthMethods:["PAN_ONLY"],allowedCardNetworks:["AMEX","DISCOVER","INTERAC","JCB","MASTERCARD","VISA"]}};wc_stripe.GooglePay.prototype.address_mappings=function(t){return{name:{set:function(t,i){var a=t.split(" ");e(i+"_first_name").val(a[0]),e(i+"_last_name").val(a[1])},get:function(t){return e(t+"_first_name").val()+e(t+"_last_name").val()}},postalCode:{set:function(t,i){e(i+"_postcode").val(t)},get:function(t){return e(t+"_postcode").val()}},countryCode:{set:function(t,i){e(i+"_country").val(t)},get:function(t){return e(t+"_country").val()}},phoneNumber:{set:function(t,i){e("#billing_phone").val(t)},get:function(){return"#billing_phone".val()}},address1:{set:function(t,i){e(i+"_address_1").val(t)},get:function(t){return e(t+"_address_1").val()}},address2:{set:function(t,i){e(i+"_address_2").val(t)},get:function(t){return e(t+"_address_2").val()}},locality:{set:function(t,i){e(i+"_city").val(t)},get:function(t){return e(t+"_city").val()}},administrativeArea:{set:function(t,i){e(i+"_state").val(t)},get:function(t){return e(t+"_state").val()}}}},wc_stripe.GooglePay.prototype.serialize_form=function(t){return e.extend({},wc_stripe.BaseGateway.prototype.serialize_form.apply(this,arguments),{order_review:!this.dynamic_price_enabled()})},wc_stripe.GooglePay.prototype.populate_address_fields=function(t){var i=t.paymentMethodData.info.billingAddress,a=this.address_mappings();for(var n in i)a[n]&&a[n].set.call(this,i[n],"#billing");if(t.shippingAddress)for(var n in t.shippingAddress)a[n]&&a[n].set.call(this,t.shippingAddress[n],"#shipping");t.email&&e("#billing_email").val(t.email),this.maybe_set_ship_to_different(),e('[name="billing_country"]').trigger("change")},wc_stripe.GooglePay.prototype.map_address=function(t){return{city:t.locality,postcode:t.postalCode,state:t.administrativeArea,country:t.countryCode}},wc_stripe.GooglePay.prototype.update_payment_data=function(t){return new Promise(function(i,a){e.when(e.ajax({url:this.params.routes.payment_data,dataType:"json",method:"POST",data:{shipping_address:this.map_address(t.shippingAddress),shipping_methods:this.map_shipping_methods(t.shippingOptionData.id),shipping_method_id:t.shippingOptionData.id,page_id:this.get_page()},beforeSend:function(t){t.setRequestHeader("X-WP-Nonce",this.params.rest_nonce)}.bind(this)})).done(function(t){t.code?a(t.data.data):i(t.data)}.bind(this)).fail(function(){a()}.bind(this))}.bind(this))},wc_stripe.GooglePay.prototype.on_payment_data_changed=function(t){return new Promise(function(e,i){this.update_payment_data(t).then(function(i){e(i.paymentRequestUpdate),this.set_selected_shipping_methods(i.shipping_methods),this.payment_data_updated(i,t)}.bind(this)).catch(function(t){e(t)}.bind(this))}.bind(this))},wc_stripe.GooglePay.prototype.payment_data_updated=function(t){},wc_stripe.GooglePay.prototype.get_googlepay_display_items=function(){return e("#googlepay_display_items").data("items")},wc_stripe.GooglePay.prototype.set_googlepay_display_items=function(t){e("#googlepay_display_items").data("items",t)},wc_stripe.GooglePay.prototype.get_shipping_options=function(){return e("#googlepay_shipping_options").data("items")},wc_stripe.GooglePay.prototype.get_merchant_info=function(){var t={merchantId:this.params.merchant_id,merchantName:this.params.merchant_name};return"TEST"===this.params.environment&&delete t.merchantId,t},wc_stripe.GooglePay.prototype.dynamic_price_enabled=function(){return"1"===this.params.dynamic_price},wc_stripe.GooglePay.prototype.get_payment_options=function(){var t={environment:this.params.environment,merchantInfo:this.get_merchant_info()};return this.dynamic_price_enabled()&&(this.needs_shipping()&&this.get_total_price_cents()>0?t.paymentDataCallbacks={onPaymentDataChanged:this.on_payment_data_changed.bind(this),onPaymentAuthorized:function(t){return new Promise(function(t,e){t({transactionState:"SUCCESS"})}.bind(this))}.bind(this)}:t.paymentDataCallbacks={onPaymentAuthorized:function(t){return new Promise(function(t,e){t({transactionState:"SUCCESS"})}.bind(this))}}),t},wc_stripe.GooglePay.prototype.build_payment_request=function(){var t=e.extend({},a,{emailRequired:!0,merchantInfo:this.get_merchant_info(),allowedPaymentMethods:[e.extend({type:"CARD",tokenizationSpecification:{type:"PAYMENT_GATEWAY",parameters:{gateway:"stripe","stripe:version":"2018-10-31","stripe:publishableKey":this.params.api_key}}},n)],shippingAddressRequired:this.needs_shipping()&&this.get_total_price_cents()>0,transactionInfo:{currencyCode:this.get_currency(),totalPriceStatus:"ESTIMATED",totalPrice:this.get_total_price().toString(),displayItems:this.get_googlepay_display_items(),totalPriceLabel:this.params.total_price_label}});return t.allowedPaymentMethods[0].parameters.billingAddressRequired=!0,t.allowedPaymentMethods[0].parameters.billingAddressParameters={format:"FULL",phoneNumberRequired:e("#billing_phone").length>0},this.dynamic_price_enabled()&&(this.needs_shipping()&&this.get_total_price_cents()>0?(t.shippingAddressParameters={},t.shippingOptionRequired=!0,t.shippingOptionParameters={shippingOptions:this.get_shipping_options()},t.callbackIntents=["SHIPPING_ADDRESS","SHIPPING_OPTION","PAYMENT_AUTHORIZATION"]):t.callbackIntents=["PAYMENT_AUTHORIZATION"]),t},wc_stripe.GooglePay.prototype.createPaymentsClient=function(){this.paymentsClient=new google.payments.api.PaymentsClient(this.get_payment_options())},wc_stripe.GooglePay.prototype.isReadyToPay=function(){return new Promise(function(t){var i=e.extend({},a);i.allowedPaymentMethods=[n],this.paymentsClient.isReadyToPay(i).then(function(){this.can_pay=!0,this.create_button(),t()}.bind(this)).catch(function(t){this.submit_error(t)}.bind(this))}.bind(this))},wc_stripe.GooglePay.prototype.create_button=function(){this.$button&&this.$button.remove(),this.$button=e(this.paymentsClient.createButton({onClick:this.start.bind(this),buttonColor:this.params.button_color,buttonType:this.params.button_style})),this.$button.addClass("gpay-button-container")},wc_stripe.GooglePay.prototype.start=function(){this.createPaymentsClient(),this.paymentsClient.loadPaymentData(this.build_payment_request()).then(function(t){var e=JSON.parse(t.paymentMethodData.tokenizationData.token);this.populate_address_fields(t),this.on_token_received(e)}.bind(this)).catch(function(t){"CANCELED"!==t.statusCode&&(t.statusMessage&&t.statusMessage.indexOf("paymentDataRequest.callbackIntent")>-1?this.submit_error_code("DEVELOPER_ERROR_WHITELIST"):this.submit_error(t.statusMessage))}.bind(this))},wc_stripe.ApplePay=function(){},wc_stripe.ApplePay.prototype.initialize=function(){e(document.body).on("click",".apple-pay-button",this.start.bind(this)),this.createPaymentRequest(),this.canMakePayment()},wc_stripe.ApplePay.prototype.create_button=function(){this.$button&&this.$button.remove(),this.$button=e(this.params.button),this.append_button()},wc_stripe.ApplePay.prototype.canMakePayment=function(){return new Promise(function(t,i){this.paymentRequest.canMakePayment().then(function(i){i&&i.applePay&&(this.can_pay=!0,this.create_button(),e(this.container).show(),t(i))}.bind(this))}.bind(this))},wc_stripe.ApplePay.prototype.start=function(t){t.preventDefault(),this.paymentRequest.update(this.get_payment_request_update({total:{pending:!1}})),this.paymentRequest.show()},wc_stripe.PaymentRequest=function(){},wc_stripe.PaymentRequest.prototype.initialize=function(){this.createPaymentRequest(),this.canMakePayment(),this.paymentRequestButton=this.createPaymentRequestButton(),this.paymentRequestButton.on("click",this.button_click.bind(this))},wc_stripe.PaymentRequest.prototype.button_click=function(t){},wc_stripe.PaymentRequest.prototype.createPaymentRequestButton=function(){return this.elements.create("paymentRequestButton",{paymentRequest:this.paymentRequest,style:{paymentRequestButton:{type:this.params.button.type,theme:this.params.button.theme,height:this.params.button.height}}})},wc_stripe.PaymentRequest.prototype.canMakePayment=function(){return new Promise(function(t,i){this.paymentRequest.canMakePayment().then(function(i){i&&!i.applePay&&(this.can_pay=!0,this.create_button(),e(this.container).show(),t(i))}.bind(this))}.bind(this))},wc_stripe.PaymentRequest.prototype.create_button=function(){this.paymentRequestButton.mount("#wc-stripe-payment-request-container")}}(window,jQuery);
1
+ !function(t,e){t.wc_stripe={};var i=Stripe(wc_stripe_params_v3.api_key);wc_stripe.BaseGateway=function(t){this.params=t,this.gateway_id=this.params.gateway_id,this.token_selector=this.params.token_selector,this.saved_method_selector=this.params.saved_method_selector,this.payment_intent_selector=this.params.payment_intent_selector,this.payment_token_received=!1,this.stripe=i,this.elements=i.elements(e.extend({},{locale:"auto"},this.get_element_options())),this.initialize()},wc_stripe.BaseGateway.prototype.get_page=function(){return wc_stripe_params_v3.page},wc_stripe.BaseGateway.prototype.set_nonce=function(t){e(this.token_selector).val(t)},wc_stripe.BaseGateway.prototype.get_element_options=function(){return{}},wc_stripe.BaseGateway.prototype.initialize=function(){},wc_stripe.BaseGateway.prototype.create_button=function(){},wc_stripe.BaseGateway.prototype.is_gateway_selected=function(){return e('[name="payment_method"]:checked').val()===this.gateway_id},wc_stripe.BaseGateway.prototype.is_saved_method_selected=function(){return this.is_gateway_selected()&&"saved"===e('[name="'+this.gateway_id+'_payment_type_key"]:checked').val()},wc_stripe.BaseGateway.prototype.has_checkout_error=function(){return e("#wc_stripe_checkout_error").length>0&&this.is_gateway_selected()},wc_stripe.BaseGateway.prototype.submit_error=function(t){-1==t.indexOf("</ul>")&&(t='<div class="woocommerce-error">'+t+"</div>"),this.submit_message(t)},wc_stripe.BaseGateway.prototype.submit_error_code=function(t){},wc_stripe.BaseGateway.prototype.submit_message=function(t){e(".woocommerce-error, .woocommerce-message, .woocommerce-info").remove();var i=e(this.message_container);i.closest("form").length&&(i=i.closest("form")),i.prepend(t),i.removeClass("processing").unblock(),i.find(".input-text, select, input:checkbox").blur(),e("html, body").animate({scrollTop:i.offset().top-100},1e3)},wc_stripe.BaseGateway.prototype.get_first_name=function(t){return e("#"+t+"_first_name").val()},wc_stripe.BaseGateway.prototype.get_last_name=function(t){return e("#"+t+"_last_name").val()},wc_stripe.BaseGateway.prototype.should_save_method=function(){return e("#"+this.gateway_id+"_save_source_key").is(":checked")},wc_stripe.BaseGateway.prototype.is_add_payment_method_page=function(){return e(document.body).hasClass("woocommerce-add-payment-method")},wc_stripe.BaseGateway.prototype.get_selected_payment_method=function(){return e(this.saved_method_selector).val()},wc_stripe.BaseGateway.prototype.needs_shipping=function(){return"1"===this.params.needs_shipping},wc_stripe.BaseGateway.prototype.get_currency=function(){return e("#wc_stripe_currency").val()},wc_stripe.BaseGateway.prototype.get_country=function(){return e("#wc_stripe_country").val()},wc_stripe.BaseGateway.prototype.get_customer_name=function(t){return e(t+"_first_name").val()+" "+e(t+"_last_name").val()},wc_stripe.BaseGateway.prototype.get_customer_email=function(){return e("#billing_email").val()},wc_stripe.BaseGateway.prototype.get_address_field_hash=function(t){for(var i=["_first_name","_last_name","_address_1","_address_2","_postcode","_city","_state","_country"],a="",n=0;n<i.length;n++)a+=e(t+i[n]).val()+"_";return a},wc_stripe.BaseGateway.prototype.block=function(){e.blockUI({message:null,overlayCSS:{background:"#fff",opacity:.6}})},wc_stripe.BaseGateway.prototype.unblock=function(){e.unblockUI()},wc_stripe.BaseGateway.prototype.get_form=function(){return e(this.token_selector).closest("form")},wc_stripe.BaseGateway.prototype.get_total_price=function(){return e("#wc_stripe_order_total").data("amount")},wc_stripe.BaseGateway.prototype.get_total_price_cents=function(){return e("#wc_stripe_order_total_cents").data("amount")},wc_stripe.BaseGateway.prototype.set_total_price=function(t){e("#wc_stripe_order_total").data("amount",t)},wc_stripe.BaseGateway.prototype.set_total_price_cents=function(t){e("#wc_stripe_order_total_cents").data("amount",t)},wc_stripe.BaseGateway.prototype.set_payment_method=function(t){e('[name="payment_method"][value="'+t+'"]').prop("checked",!0).trigger("click")},wc_stripe.BaseGateway.prototype.set_selected_shipping_methods=function(t){if(t&&e('[name^="shipping_method"]').length)for(var i in t){var a=t[i];e('[name="shipping_method['+i+']"][value="'+a+'"]').prop("checked",!0).trigger("change")}},wc_stripe.BaseGateway.prototype.on_token_received=function(t){this.payment_token_received=!0,e(this.token_selector).val(t.id),this.process_checkout()},wc_stripe.BaseGateway.prototype.createPaymentRequest=function(){this.paymentRequest=i.paymentRequest(this.get_payment_request_options()),this.needs_shipping()&&(this.paymentRequest.on("shippingaddresschange",this.update_shipping_address.bind(this)),this.paymentRequest.on("shippingoptionchange",this.update_shipping_method.bind(this))),this.paymentRequest.on("paymentmethod",this.on_payment_method_received.bind(this))},wc_stripe.BaseGateway.prototype.get_payment_request_options=function(){var t={country:this.params.country_code,currency:this.get_currency().toLowerCase(),total:{amount:this.get_total_price_cents(),label:this.params.total_label,pending:!0},requestPayerName:!0,requestPayerEmail:!0,requestPayerPhone:!0,requestShipping:this.needs_shipping()},e=this.get_display_items(),i=this.get_shipping_options();return e&&(t.displayItems=e),this.needs_shipping()&&i&&(t.shippingOptions=i),t},wc_stripe.BaseGateway.prototype.get_payment_request_update=function(t){var i={currency:this.get_currency().toLowerCase(),total:{amount:parseInt(this.get_total_price_cents()),label:this.params.total_label,pending:!0}},a=this.get_display_items(),n=this.get_shipping_options();return a&&(i.displayItems=a),this.needs_shipping()&&n&&(i.shippingOptions=n),t&&(i=e.extend(!0,{},i,t)),i},wc_stripe.BaseGateway.prototype.get_display_items=function(){return e("#wc_stripe_display_items").data("items")},wc_stripe.BaseGateway.prototype.set_display_items=function(t){e("#wc_stripe_display_items").data("items",t)},wc_stripe.BaseGateway.prototype.get_shipping_options=function(){return e("#wc_stripe_shipping_options").data("items")},wc_stripe.BaseGateway.prototype.set_shipping_options=function(t){e("#wc_stripe_shipping_options").data("items",t)},wc_stripe.BaseGateway.prototype.map_address=function(t){return{city:t.city,postcode:t.postalCode,state:t.region,country:t.country}},wc_stripe.BaseGateway.prototype.on_payment_method_received=function(e){try{this.payment_response=e,this.populate_checkout_fields(e),e.complete("success"),this.on_token_received(e.paymentMethod)}catch(e){t.alert(e)}},wc_stripe.BaseGateway.prototype.populate_checkout_fields=function(t){e(this.token_selector).val(t.paymentMethod.id),this.populate_address_fields(t)},wc_stripe.BaseGateway.prototype.populate_address_fields=function(t){var i=this.address_mappings();if(t.payerName&&i.payerName.set(t.payerName),t.payerEmail&&i.payerEmail.set(t.payerEmail),t.payerPhone&&i.payerPhone.set(t.payerPhone),t.shippingAddress){var a=t.shippingAddress;for(var n in a)i[n]&&i[n].set.call(this,a[n],"#shipping")}if(t.paymentMethod.billing_details.address){a=t.paymentMethod.billing_details.address;for(var n in a)i[n]&&i[n].set.call(this,a[n],"#billing")}this.maybe_set_ship_to_different(),e('[name="billing_country"]').trigger("change")},wc_stripe.BaseGateway.prototype.address_mappings=function(){return{payerName:{set:function(t,i){var a=t.split(" ");a.length>0&&e("#billing_first_name").val(a[0]),a.length>1&&e("#billing_last_name").val(a[1])},get:function(t){return e("#billing_first_name").val()+" "+e("#billing_last_name").val()}},payerEmail:{set:function(t){e("#billing_email").val(t)},get:function(){return e("#billing_email").val()}},payerPhone:{set:function(t){e("#billing_phone").val(t)},get:function(){return e("#billing_phone").val()}},recipient:{set:function(t,i){var a=t.split(" ");a.length>0&&e(i+"_first_name").val(a[0]),a.length>1&&e(i+"_last_name").val(a[1])},get:function(t){return e(t+"_first_name").val()+" "+e(t+"_last_name").val()}},country:{set:function(t,i){e(i+"_country").val(t)},get:function(t){return e(t+"_country").val()}},addressLine:{set:function(t,i){t.length>0&&e(i+"_address_1").val(t[0]),t.length>1&&e(i+"_address_2").val(t[1])},get:function(t){return[e(t+"_address_1").val(),e(t+"_address_2").val()]}},line1:{set:function(t,i){e(i+"_address_1").val(t)},get:function(t){return e(t+"_address_1").val()}},line2:{set:function(t,i){e(i+"_address_2").val(t)},get:function(t){return e(t+"_address_2").val()}},region:{set:function(t,i){e(i+"_state").val(t)},get:function(t){e(t+"_state").val()}},state:{set:function(t,i){e(i+"_state").val(t)},get:function(t){e(t+"_state").val()}},city:{set:function(t,i){e(i+"_city").val(t)},get:function(t){e(t+"_city").val()}},postalCode:{set:function(t,i){e(i+"_postcode").val(t)},get:function(t){e(t+"_postcode").val()}},postal_code:{set:function(t,i){e(i+"_postcode").val(t)},get:function(t){e(t+"_postcode").val()}}}},wc_stripe.BaseGateway.prototype.process_checkout=function(){return new Promise(function(i,a){this.block(),e.ajax({url:this.params.routes.checkout,method:"POST",dataType:"json",data:e.extend({},this.serialize_form(this.get_form()),{payment_method:this.gateway_id,page_id:this.get_page()}),beforeSend:function(t){t.setRequestHeader("X-WP-Nonce",this.params.rest_nonce)}.bind(this)}).done(function(e){e.reload?t.location.reload():"success"===e.result?t.location=e.redirect:(e.messages&&this.submit_error(e.messages),this.unblock())}.bind(this)).fail(function(t,e,i){this.unblock(),this.submit_error(i)}.bind(this))}.bind(this))},wc_stripe.BaseGateway.prototype.serialize_form=function(t){var i=t.find("input").filter(function(t,i){return!e(i).is('[name^="add-to-cart"]')}.bind(this)).serializeArray(),a={};for(var n in i){var s=i[n];a[s.name]=s.value}return a.payment_method=this.gateway_id,a},wc_stripe.BaseGateway.prototype.map_shipping_methods=function(t){var e={};if("default"!==t){var i=t.match(/^(\d):(.+)$/);i.length>1&&(e[i[1]]=i[2])}return e},wc_stripe.BaseGateway.prototype.maybe_set_ship_to_different=function(){e('[name="ship_to_different_address"]').length&&e('[name="ship_to_different_address"]').prop("checked",this.get_address_field_hash("#billing")!==this.get_address_field_hash("#shipping")).trigger("change")},wc_stripe.BaseGateway.prototype.update_shipping_address=function(t){return new Promise(function(i,a){e.ajax({url:this.params.routes.shipping_address,method:"POST",dataType:"json",data:{address:this.map_address(t.shippingAddress),payment_method:this.gateway_id,page_id:this.get_page()},beforeSend:function(t){t.setRequestHeader("X-WP-Nonce",this.params.rest_nonce)}.bind(this)}).done(function(e){e.code?(t.updateWith(e.data.newData),a(e.data)):(t.updateWith(e.data.newData),i(e.data))}.bind(this)).fail(function(t,e,i){}.bind(this))}.bind(this))},wc_stripe.BaseGateway.prototype.update_shipping_method=function(t){return new Promise(function(i,a){e.ajax({url:this.params.routes.shipping_method,method:"POST",dataType:"json",data:{shipping_methods:this.map_shipping_methods(t.shippingOption.id),payment_method:this.gateway_id,page_id:this.get_page()},beforeSend:function(t){t.setRequestHeader("X-WP-Nonce",this.params.rest_nonce)}.bind(this)}).done(function(e){e.code?(t.updateWith(e.data.newData),a(e.data)):(this.set_selected_shipping_methods(e.data.shipping_methods),t.updateWith(e.data.newData),i(e.data))}.bind(this)).fail(function(t,e,i){this.submit_error(i)}.bind(this))}.bind(this))},wc_stripe.CheckoutGateway=function(){this.container=this.message_container="li.payment_method_"+this.gateway_id,this.banner_container="li.banner_payment_method_"+this.gateway_id,e(document.body).on("update_checkout",this.update_checkout.bind(this)),e(document.body).on("updated_checkout",this.updated_checkout.bind(this)),e(document.body).on("checkout_error",this.checkout_error.bind(this)),e(this.token_selector).closest("form").on("checkout_place_order_"+this.gateway_id,this.checkout_place_order.bind(this)),e(document.body).on("wc_stripe_new_method_"+this.gateway_id,this.on_show_new_methods.bind(this)),e(document.body).on("wc_stripe_saved_method_"+this.gateway_id,this.on_show_saved_methods.bind(this)),e(document.body).on("wc_stripe_payment_method_selected",this.on_payment_method_selected.bind(this)),this.banner_enabled()&&e(".woocommerce-billing-fields").length&&e(".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],a=e[2];this.gateway_id===i&&(this.payment_token_received=!0,this.set_nonce(a),this.set_use_new_option(!0))}},wc_stripe.CheckoutGateway.prototype.updated_checkout=function(){},wc_stripe.CheckoutGateway.prototype.update_checkout=function(){},wc_stripe.CheckoutGateway.prototype.checkout_error=function(){this.has_checkout_error()&&(this.payment_token_received=!1,this.payment_response=null,this.show_payment_button(),this.hide_place_order())},wc_stripe.CheckoutGateway.prototype.is_valid_checkout=function(){return!(e('[name="terms"]').length&&!e('[name="terms"]').is(":checked"))},wc_stripe.CheckoutGateway.prototype.get_payment_method=function(){return e('[name="payment_method"]:checked').val()},wc_stripe.CheckoutGateway.prototype.set_use_new_option=function(t){e("#"+this.gateway_id+"_use_new").prop("checked",t).trigger("change")},wc_stripe.CheckoutGateway.prototype.checkout_place_order=function(){return this.is_valid_checkout()?!!this.is_saved_method_selected()||this.payment_token_received:(this.submit_error(this.params.messages.terms),!1)},wc_stripe.CheckoutGateway.prototype.on_token_received=function(t){this.payment_token_received=!0,e(this.token_selector).val(t.id),this.hide_payment_button(),this.show_place_order()},wc_stripe.CheckoutGateway.prototype.block=function(){e("form.checkout").block({message:null,overlayCSS:{background:"#fff",opacity:.6}})},wc_stripe.CheckoutGateway.prototype.unblock=function(){e("form.checkout").unblock()},wc_stripe.CheckoutGateway.prototype.hide_place_order=function(){e("#place_order").addClass("wc-stripe-hide")},wc_stripe.CheckoutGateway.prototype.show_place_order=function(){e("#place_order").removeClass("wc-stripe-hide")},wc_stripe.CheckoutGateway.prototype.on_show_new_methods=function(){this.payment_token_received?(this.show_place_order(),this.hide_payment_button()):(this.hide_place_order(),this.show_payment_button())},wc_stripe.CheckoutGateway.prototype.on_show_saved_methods=function(){this.hide_payment_button(),this.show_place_order()},wc_stripe.CheckoutGateway.prototype.show_payment_button=function(){this.$button&&this.$button.show()},wc_stripe.CheckoutGateway.prototype.hide_payment_button=function(){this.$button&&this.$button.hide()},wc_stripe.CheckoutGateway.prototype.trigger_payment_method_selected=function(){this.on_payment_method_selected(null,e('[name="payment_method"]:checked').val())},wc_stripe.CheckoutGateway.prototype.on_payment_method_selected=function(t,e){e===this.gateway_id?this.payment_token_received||this.is_saved_method_selected()?(this.hide_payment_button(),this.show_place_order()):(this.show_payment_button(),this.hide_place_order()):(this.hide_payment_button(),e.indexOf("stripe_")<0&&this.show_place_order())},wc_stripe.CheckoutGateway.prototype.banner_enabled=function(){return"1"===this.params.banner_enabled},wc_stripe.CheckoutGateway.prototype.checkout_fields_valid=function(){var t=Object.keys(wc_stripe_checkout_fields.billing),i=Object.keys(wc_stripe_checkout_fields.shipping);function a(t,i){for(var a=0;a<t.length;a++){if(i[t[a]].required){var n=e("#"+t[a]).val();if(void 0===n||0==n.length)return void(valid=!1)}}}return valid=!0,a(t,wc_stripe_checkout_fields.billing),this.needs_shipping()&&e("#ship-to-different-address-checkbox").is(":checked")&&a(i,wc_stripe_checkout_fields.shipping),valid=this.is_valid_checkout(),valid},wc_stripe.ProductGateway=function(){this.container="li.payment_method_"+this.gateway_id,this.message_container="div.product",e(document.body).on("wc_stripe_updated_rest_nonce",this.set_rest_nonce.bind(this)),e("form.cart").on("found_variation",this.found_variation.bind(this)),e("form.cart").on("reset_data",this.reset_variation_data.bind(this)),this.buttonWidth=e("div.quantity").outerWidth(!0)+e(".single_add_to_cart_button").outerWidth(),e(this.container).css("max-width",this.buttonWidth+"px")},wc_stripe.ProductGateway.prototype.get_quantity=function(){return parseInt(e('[name="quantity"]').val())},wc_stripe.ProductGateway.prototype.set_rest_nonce=function(t,e){this.params.rest_nonce=e},wc_stripe.ProductGateway.prototype.found_variation=function(t,e){var i=this.get_product_data();i.price=e.display_price,i.needs_shipping=!e.is_virtual,i.variation=e,this.set_product_data(i),this.enable_payment_button()},wc_stripe.ProductGateway.prototype.reset_variation_data=function(){this.disable_payment_button()},wc_stripe.ProductGateway.prototype.disable_payment_button=function(){this.$button&&this.get_button().prop("disabled",!0).addClass("disabled")},wc_stripe.ProductGateway.prototype.enable_payment_button=function(){this.$button&&this.get_button().prop("disabled",!1).removeClass("disabled")},wc_stripe.ProductGateway.prototype.get_button=function(){return this.$button},wc_stripe.ProductGateway.prototype.is_variable_product=function(){return e('[name="variation_id"]').length>0},wc_stripe.ProductGateway.prototype.needs_shipping=function(){return this.get_product_data().needs_shipping},wc_stripe.ProductGateway.prototype.get_product_data=function(){return e("#wc_stripe_product_data").data("product")},wc_stripe.ProductGateway.prototype.set_product_data=function(t){e("#wc_stripe_product_data").data("product",t)},wc_stripe.ProductGateway.prototype.add_to_cart=function(){return new Promise(function(t,i){this.block(),e.ajax({url:this.params.routes.add_to_cart,method:"POST",dataType:"json",data:{product_id:e("#product_id").val(),variation_id:this.is_variable_product()?e('[name="variation_id"]').val():0,qty:e('[name="quantity"]').val(),payment_method:this.gateway_id,page_id:this.get_page()},beforeSend:function(t){t.setRequestHeader("X-WP-Nonce",this.params.rest_nonce)}.bind(this)}).done(function(a,n,s){this.unblock(),e(document.body).triggerHandler("wc_stripe_updated_rest_nonce",s.getResponseHeader("X-WP-Nonce")),a.code?(this.submit_error(a.message),i(a)):(this.set_total_price(a.data.total),this.set_total_price_cents(a.data.totalCents),this.set_display_items(a.data.displayItems),t(a.data))}.bind(this)).fail(function(t,e,i){this.unblock(),this.submit_error(i)}.bind(this))}.bind(this))},wc_stripe.ProductGateway.prototype.cart_calculation=function(t){return new Promise(function(i,a){e.ajax({url:this.params.routes.cart_calculation,method:"POST",dataType:"json",data:{product_id:e("#product_id").val(),variation_id:this.is_variable_product()&&t?t:0,qty:e('[name="quantity"]').val(),payment_method:this.gateway_id},beforeSend:function(t){t.setRequestHeader("X-WP-Nonce",this.params.rest_nonce)}.bind(this)}).done(function(t,a,n){e(document.body).triggerHandler("wc_stripe_updated_rest_nonce",n.getResponseHeader("X-WP-Nonce")),t.code?this.cart_calculation_error=!0:(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.container="li.payment_method_"+this.gateway_id,this.message_container="div.woocommerce",e(document.body).on("updated_wc_div",this.updated_html.bind(this)),e(document.body).on("updated_cart_totals",this.updated_html.bind(this))},wc_stripe.CartGateway.prototype.needs_shipping=function(){return 1===e("#wc_stripe_needs_shipping").data("value")},wc_stripe.CartGateway.prototype.submit_error=function(t){this.submit_message(t)},wc_stripe.CartGateway.prototype.updated_html=function(t){},wc_stripe.CartGateway.prototype.add_cart_totals_class=function(){e(".cart_totals").addClass("stripe_cart_gateway_active")},wc_stripe.GooglePay=function(){};const a={apiVersion:2,apiVersionMinor:0},n={type:"CARD",parameters:{allowedAuthMethods:["PAN_ONLY"],allowedCardNetworks:["AMEX","DISCOVER","INTERAC","JCB","MASTERCARD","VISA"]}};wc_stripe.GooglePay.prototype.address_mappings=function(t){return{name:{set:function(t,i){var a=t.split(" ");e(i+"_first_name").val(a[0]),e(i+"_last_name").val(a[1])},get:function(t){return e(t+"_first_name").val()+e(t+"_last_name").val()}},postalCode:{set:function(t,i){e(i+"_postcode").val(t)},get:function(t){return e(t+"_postcode").val()}},countryCode:{set:function(t,i){e(i+"_country").val(t)},get:function(t){return e(t+"_country").val()}},phoneNumber:{set:function(t,i){e("#billing_phone").val(t)},get:function(){return"#billing_phone".val()}},address1:{set:function(t,i){e(i+"_address_1").val(t)},get:function(t){return e(t+"_address_1").val()}},address2:{set:function(t,i){e(i+"_address_2").val(t)},get:function(t){return e(t+"_address_2").val()}},locality:{set:function(t,i){e(i+"_city").val(t)},get:function(t){return e(t+"_city").val()}},administrativeArea:{set:function(t,i){e(i+"_state").val(t)},get:function(t){return e(t+"_state").val()}}}},wc_stripe.GooglePay.prototype.serialize_form=function(t){return e.extend({},wc_stripe.BaseGateway.prototype.serialize_form.apply(this,arguments),{order_review:!this.dynamic_price_enabled()})},wc_stripe.GooglePay.prototype.populate_address_fields=function(t){var i=t.paymentMethodData.info.billingAddress,a=this.address_mappings();for(var n in i)a[n]&&a[n].set.call(this,i[n],"#billing");if(t.shippingAddress)for(var n in t.shippingAddress)a[n]&&a[n].set.call(this,t.shippingAddress[n],"#shipping");t.email&&e("#billing_email").val(t.email),this.maybe_set_ship_to_different(),e('[name="billing_country"]').trigger("change")},wc_stripe.GooglePay.prototype.map_address=function(t){return{city:t.locality,postcode:t.postalCode,state:t.administrativeArea,country:t.countryCode}},wc_stripe.GooglePay.prototype.update_payment_data=function(t){return new Promise(function(i,a){e.when(e.ajax({url:this.params.routes.payment_data,dataType:"json",method:"POST",data:{shipping_address:this.map_address(t.shippingAddress),shipping_methods:this.map_shipping_methods(t.shippingOptionData.id),shipping_method_id:t.shippingOptionData.id,page_id:this.get_page()},beforeSend:function(t){t.setRequestHeader("X-WP-Nonce",this.params.rest_nonce)}.bind(this)})).done(function(t){t.code?a(t.data.data):i(t.data)}.bind(this)).fail(function(){a()}.bind(this))}.bind(this))},wc_stripe.GooglePay.prototype.on_payment_data_changed=function(t){return new Promise(function(e,i){this.update_payment_data(t).then(function(i){e(i.paymentRequestUpdate),this.set_selected_shipping_methods(i.shipping_methods),this.payment_data_updated(i,t)}.bind(this)).catch(function(t){e(t)}.bind(this))}.bind(this))},wc_stripe.GooglePay.prototype.payment_data_updated=function(t){},wc_stripe.GooglePay.prototype.get_googlepay_display_items=function(){return e("#googlepay_display_items").data("items")},wc_stripe.GooglePay.prototype.set_googlepay_display_items=function(t){e("#googlepay_display_items").data("items",t)},wc_stripe.GooglePay.prototype.get_shipping_options=function(){return e("#googlepay_shipping_options").data("items")},wc_stripe.GooglePay.prototype.get_merchant_info=function(){var t={merchantId:this.params.merchant_id,merchantName:this.params.merchant_name};return"TEST"===this.params.environment&&delete t.merchantId,t},wc_stripe.GooglePay.prototype.dynamic_price_enabled=function(){return"1"===this.params.dynamic_price},wc_stripe.GooglePay.prototype.get_payment_options=function(){var t={environment:this.params.environment,merchantInfo:this.get_merchant_info()};return this.dynamic_price_enabled()&&(this.needs_shipping()&&this.get_total_price_cents()>0?t.paymentDataCallbacks={onPaymentDataChanged:this.on_payment_data_changed.bind(this),onPaymentAuthorized:function(t){return new Promise(function(t,e){t({transactionState:"SUCCESS"})}.bind(this))}.bind(this)}:t.paymentDataCallbacks={onPaymentAuthorized:function(t){return new Promise(function(t,e){t({transactionState:"SUCCESS"})}.bind(this))}}),t},wc_stripe.GooglePay.prototype.build_payment_request=function(){var t=e.extend({},a,{emailRequired:!0,merchantInfo:this.get_merchant_info(),allowedPaymentMethods:[e.extend({type:"CARD",tokenizationSpecification:{type:"PAYMENT_GATEWAY",parameters:{gateway:"stripe","stripe:version":"2018-10-31","stripe:publishableKey":this.params.api_key}}},n)],shippingAddressRequired:this.needs_shipping()&&this.get_total_price_cents()>0,transactionInfo:{currencyCode:this.get_currency(),totalPriceStatus:"ESTIMATED",totalPrice:this.get_total_price().toString(),displayItems:this.get_googlepay_display_items(),totalPriceLabel:this.params.total_price_label}});return t.allowedPaymentMethods[0].parameters.billingAddressRequired=!0,t.allowedPaymentMethods[0].parameters.billingAddressParameters={format:"FULL",phoneNumberRequired:e("#billing_phone").length>0},this.dynamic_price_enabled()&&(this.needs_shipping()&&this.get_total_price_cents()>0?(t.shippingAddressParameters={},t.shippingOptionRequired=!0,t.shippingOptionParameters={shippingOptions:this.get_shipping_options()},t.callbackIntents=["SHIPPING_ADDRESS","SHIPPING_OPTION","PAYMENT_AUTHORIZATION"]):t.callbackIntents=["PAYMENT_AUTHORIZATION"]),t},wc_stripe.GooglePay.prototype.createPaymentsClient=function(){this.paymentsClient=new google.payments.api.PaymentsClient(this.get_payment_options())},wc_stripe.GooglePay.prototype.isReadyToPay=function(){return new Promise(function(t){var i=e.extend({},a);i.allowedPaymentMethods=[n],this.paymentsClient.isReadyToPay(i).then(function(){this.can_pay=!0,this.create_button(),t()}.bind(this)).catch(function(t){this.submit_error(t)}.bind(this))}.bind(this))},wc_stripe.GooglePay.prototype.create_button=function(){this.$button&&this.$button.remove(),this.$button=e(this.paymentsClient.createButton({onClick:this.start.bind(this),buttonColor:this.params.button_color,buttonType:this.params.button_style})),this.$button.addClass("gpay-button-container")},wc_stripe.GooglePay.prototype.start=function(){this.createPaymentsClient(),this.paymentsClient.loadPaymentData(this.build_payment_request()).then(function(t){var e=JSON.parse(t.paymentMethodData.tokenizationData.token);this.populate_address_fields(t),this.on_token_received(e)}.bind(this)).catch(function(t){"CANCELED"!==t.statusCode&&(t.statusMessage&&t.statusMessage.indexOf("paymentDataRequest.callbackIntent")>-1?this.submit_error_code("DEVELOPER_ERROR_WHITELIST"):this.submit_error(t.statusMessage))}.bind(this))},wc_stripe.ApplePay=function(){},wc_stripe.ApplePay.prototype.initialize=function(){e(document.body).on("click",".apple-pay-button",this.start.bind(this)),this.createPaymentRequest(),this.canMakePayment()},wc_stripe.ApplePay.prototype.create_button=function(){this.$button&&this.$button.remove(),this.$button=e(this.params.button),this.append_button()},wc_stripe.ApplePay.prototype.canMakePayment=function(){return new Promise(function(t,i){this.paymentRequest.canMakePayment().then(function(i){i&&i.applePay&&(this.can_pay=!0,this.create_button(),e(this.container).show(),t(i))}.bind(this))}.bind(this))},wc_stripe.ApplePay.prototype.start=function(t){t.preventDefault(),this.paymentRequest.update(this.get_payment_request_update({total:{pending:!1}})),this.paymentRequest.show()},wc_stripe.PaymentRequest=function(){},wc_stripe.PaymentRequest.prototype.initialize=function(){this.createPaymentRequest(),this.canMakePayment(),this.paymentRequestButton=this.createPaymentRequestButton(),this.paymentRequestButton.on("click",this.button_click.bind(this))},wc_stripe.PaymentRequest.prototype.button_click=function(t){},wc_stripe.PaymentRequest.prototype.createPaymentRequestButton=function(){return this.elements.create("paymentRequestButton",{paymentRequest:this.paymentRequest,style:{paymentRequestButton:{type:this.params.button.type,theme:this.params.button.theme,height:this.params.button.height}}})},wc_stripe.PaymentRequest.prototype.canMakePayment=function(){return new Promise(function(t,i){this.paymentRequest.canMakePayment().then(function(i){i&&!i.applePay&&(this.can_pay=!0,this.create_button(),e(this.container).show(),t(i))}.bind(this))}.bind(this))},wc_stripe.PaymentRequest.prototype.create_button=function(){this.paymentRequestButton.mount("#wc-stripe-payment-request-container")}}(window,jQuery);
i18n/languages/woo-stripe-payment.pot CHANGED
@@ -2,7 +2,7 @@
2
  msgid ""
3
  msgstr ""
4
  "Project-Id-Version: woo-stripe-payment\n"
5
- "POT-Creation-Date: 2020-01-15 13:16-0800\n"
6
  "PO-Revision-Date: 2019-08-16 14:27-0700\n"
7
  "Last-Translator: \n"
8
  "Language-Team: \n"
@@ -256,7 +256,7 @@ msgstr ""
256
 
257
  #: includes/admin/class-wc-stripe-admin-menus.php:34
258
  #: includes/admin/views/html-settings-nav.php:17
259
- #: includes/class-wc-stripe-install.php:21
260
  msgid "Documentation"
261
  msgstr ""
262
 
@@ -298,13 +298,13 @@ msgstr ""
298
 
299
  #: includes/admin/meta-boxes/views/html-charge-data-subview.php:25
300
  #: includes/admin/settings/class-wc-stripe-api-settings.php:33
301
- #: includes/controllers/class-wc-stripe-controller-gateway-settings.php:134
302
  msgid "Live"
303
  msgstr ""
304
 
305
  #: includes/admin/meta-boxes/views/html-charge-data-subview.php:25
306
  #: includes/admin/settings/class-wc-stripe-api-settings.php:32
307
- #: includes/controllers/class-wc-stripe-controller-gateway-settings.php:134
308
  msgid "Test"
309
  msgstr ""
310
 
@@ -347,7 +347,7 @@ msgstr ""
347
 
348
  #: includes/admin/meta-boxes/views/html-charge-data-subview.php:51
349
  #: includes/admin/views/html-ach-fee.php:10
350
- #: includes/gateways/settings/payment-request-settings.php:87
351
  msgid "Type"
352
  msgstr ""
353
 
@@ -465,18 +465,29 @@ msgstr ""
465
 
466
  #: includes/admin/settings/class-wc-stripe-api-settings.php:84
467
  #: includes/admin/settings/class-wc-stripe-api-settings.php:85
468
- msgid "Generate Webhook"
469
  msgstr ""
470
 
471
  #: includes/admin/settings/class-wc-stripe-api-settings.php:87
472
- msgid "Click this button to configure webhooks automatically."
 
 
473
  msgstr ""
474
 
475
  #: includes/admin/settings/class-wc-stripe-api-settings.php:91
476
- msgid "Webhook url"
 
477
  msgstr ""
478
 
479
  #: includes/admin/settings/class-wc-stripe-api-settings.php:94
 
 
 
 
 
 
 
 
480
  #, php-format
481
  msgid ""
482
  "<strong>Important:</strong> the webhook url is called by Stripe when events "
@@ -485,12 +496,12 @@ msgid ""
485
  "%sWebhook guide%s"
486
  msgstr ""
487
 
488
- #: includes/admin/settings/class-wc-stripe-api-settings.php:98
489
  msgid "Live Webhook Secret"
490
  msgstr ""
491
 
492
- #: includes/admin/settings/class-wc-stripe-api-settings.php:99
493
- #: includes/admin/settings/class-wc-stripe-api-settings.php:109
494
  #, php-format
495
  msgid ""
496
  "The webhook secret is used to authenticate webhooks sent from Stripe. It "
@@ -498,15 +509,15 @@ msgid ""
498
  "guide%s"
499
  msgstr ""
500
 
501
- #: includes/admin/settings/class-wc-stripe-api-settings.php:108
502
  msgid "Test Webhook Secret"
503
  msgstr ""
504
 
505
- #: includes/admin/settings/class-wc-stripe-api-settings.php:117
506
  msgid "Debug Log"
507
  msgstr ""
508
 
509
- #: includes/admin/settings/class-wc-stripe-api-settings.php:121
510
  msgid ""
511
  "When enabled, the plugin logs important errors and info that can help you "
512
  "troubleshoot potential issues."
@@ -604,7 +615,7 @@ msgid ""
604
  "the funds are received."
605
  msgstr ""
606
 
607
- #: includes/class-wc-stripe-gateway.php:193
608
  #, php-format
609
  msgid "Error capturing charge. Reason: %s"
610
  msgstr ""
@@ -643,34 +654,58 @@ msgstr ""
643
  msgid "Please review your order details then click Place Order."
644
  msgstr ""
645
 
646
- #: includes/controllers/class-wc-stripe-controller-gateway-settings.php:71
647
  msgid ""
648
  "You cannot register your domain until you have configured your Live API keys."
649
  msgstr ""
650
 
651
- #: includes/controllers/class-wc-stripe-controller-gateway-settings.php:87
652
  msgid ""
653
  "Domain registered successfully. You can confirm in your Stripe Dashboard at "
654
  "https://dashboard.stripe.com/account/apple_pay."
655
  msgstr ""
656
 
657
- #: includes/controllers/class-wc-stripe-controller-gateway-settings.php:104
658
  msgid "You must configure your secret key before creating webhooks."
659
  msgstr ""
660
 
661
- #: includes/controllers/class-wc-stripe-controller-gateway-settings.php:113
662
  msgid ""
663
  "There is already a webhook configured for this site. If you want to delete "
664
  "the webhook, login to your Stripe Dashboard."
665
  msgstr ""
666
 
667
- #: includes/controllers/class-wc-stripe-controller-gateway-settings.php:134
668
  #, php-format
669
  msgid ""
670
  "Webhook created in Stripe for %s environment. You can test your webhook by "
671
  "logging in to the Stripe dashboard"
672
  msgstr ""
673
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
674
  #: includes/controllers/class-wc-stripe-controller-googlepay.php:86
675
  msgid "Your shipping address is not serviceable."
676
  msgstr ""
@@ -734,23 +769,28 @@ msgstr ""
734
  msgid "ACH Fee"
735
  msgstr ""
736
 
737
- #: includes/gateways/class-wc-payment-gateway-stripe-applepay.php:14
738
  #: includes/gateways/settings/applepay-settings.php:17
739
  msgid "Apple Pay"
740
  msgstr ""
741
 
742
- #: includes/gateways/class-wc-payment-gateway-stripe-applepay.php:17
743
  msgid "Stripe Apple Pay"
744
  msgstr ""
745
 
746
- #: includes/gateways/class-wc-payment-gateway-stripe-applepay.php:18
747
  msgid "Apple Pay gateway that integrates with your Stripe account."
748
  msgstr ""
749
 
750
- #: includes/gateways/class-wc-payment-gateway-stripe-applepay.php:57
751
  msgid "Please update you product quantity before using Apple Pay."
752
  msgstr ""
753
 
 
 
 
 
 
754
  #: includes/gateways/class-wc-payment-gateway-stripe-bancontact.php:21
755
  #: includes/gateways/class-wc-payment-gateway-stripe-bancontact.php:24
756
  #: includes/gateways/class-wc-payment-gateway-stripe-bancontact.php:27
@@ -1047,10 +1087,6 @@ msgstr ""
1047
  msgid "Adding to cart..."
1048
  msgstr ""
1049
 
1050
- #: includes/gateways/class-wc-payment-gateway-stripe-payment-request.php:65
1051
- msgid "Please select a product option before updating quantity."
1052
- msgstr ""
1053
-
1054
  #: includes/gateways/class-wc-payment-gateway-stripe-sepa.php:19
1055
  #: includes/gateways/class-wc-payment-gateway-stripe-sepa.php:25
1056
  msgid "SEPA"
@@ -1281,21 +1317,21 @@ msgstr ""
1281
  #: includes/gateways/settings/applepay-settings.php:59
1282
  #: includes/gateways/settings/cc-settings.php:47
1283
  #: includes/gateways/settings/googlepay-settings.php:73
1284
- #: includes/gateways/settings/payment-request-settings.php:74
1285
  msgid "Order Status"
1286
  msgstr ""
1287
 
1288
  #: includes/gateways/settings/applepay-settings.php:63
1289
  #: includes/gateways/settings/cc-settings.php:51
1290
  #: includes/gateways/settings/googlepay-settings.php:77
1291
- #: includes/gateways/settings/payment-request-settings.php:78
1292
  msgid "Default"
1293
  msgstr ""
1294
 
1295
  #: includes/gateways/settings/applepay-settings.php:66
1296
  #: includes/gateways/settings/cc-settings.php:54
1297
  #: includes/gateways/settings/googlepay-settings.php:80
1298
- #: includes/gateways/settings/payment-request-settings.php:81
1299
  msgid ""
1300
  "This is the status of the order once payment is complete. If <b>Default</b> "
1301
  "is selected, then WooCommerce will set the order status automatically based "
@@ -1305,53 +1341,53 @@ msgid ""
1305
  "WooCommerce code to process the order status."
1306
  msgstr ""
1307
 
1308
- #: includes/gateways/settings/applepay-settings.php:83
1309
- #: includes/gateways/settings/payment-request-settings.php:84
1310
  msgid "Button Settings"
1311
  msgstr ""
1312
 
1313
- #: includes/gateways/settings/applepay-settings.php:86
1314
- #: includes/gateways/settings/googlepay-settings.php:146
1315
  msgid "Button Design"
1316
  msgstr ""
1317
 
1318
- #: includes/gateways/settings/applepay-settings.php:90
1319
  msgid "Black Button"
1320
  msgstr ""
1321
 
1322
- #: includes/gateways/settings/applepay-settings.php:91
1323
  msgid "White With Black Line"
1324
  msgstr ""
1325
 
1326
- #: includes/gateways/settings/applepay-settings.php:92
1327
  msgid "White Button"
1328
  msgstr ""
1329
 
1330
- #: includes/gateways/settings/applepay-settings.php:94
1331
  msgid "This is the style for all Apple Pay buttons presented on your store."
1332
  msgstr ""
1333
 
1334
- #: includes/gateways/settings/applepay-settings.php:97
1335
  msgid "Checkout button type"
1336
  msgstr ""
1337
 
1338
- #: includes/gateways/settings/applepay-settings.php:100
1339
- #: includes/gateways/settings/applepay-settings.php:110
1340
- #: includes/gateways/settings/applepay-settings.php:120
1341
  msgid "Standard Button"
1342
  msgstr ""
1343
 
1344
- #: includes/gateways/settings/applepay-settings.php:101
1345
- #: includes/gateways/settings/applepay-settings.php:111
1346
- #: includes/gateways/settings/applepay-settings.php:121
1347
  msgid "Buy with Apple Pay"
1348
  msgstr ""
1349
 
1350
- #: includes/gateways/settings/applepay-settings.php:107
1351
  msgid "Cart button type"
1352
  msgstr ""
1353
 
1354
- #: includes/gateways/settings/applepay-settings.php:117
1355
  msgid "Product button type"
1356
  msgstr ""
1357
 
@@ -1553,43 +1589,43 @@ msgid ""
1553
  "This is the icon style that appears next to the gateway on the checkout page."
1554
  msgstr ""
1555
 
1556
- #: includes/gateways/settings/googlepay-settings.php:123
1557
  msgid "Button Options"
1558
  msgstr ""
1559
 
1560
- #: includes/gateways/settings/googlepay-settings.php:126
1561
  msgid "Button Color"
1562
  msgstr ""
1563
 
1564
- #: includes/gateways/settings/googlepay-settings.php:130
1565
  msgid "Black"
1566
  msgstr ""
1567
 
1568
- #: includes/gateways/settings/googlepay-settings.php:131
1569
  msgid "White"
1570
  msgstr ""
1571
 
1572
- #: includes/gateways/settings/googlepay-settings.php:133
1573
  msgid "The button color of the GPay button."
1574
  msgstr ""
1575
 
1576
- #: includes/gateways/settings/googlepay-settings.php:136
1577
  msgid "Button Style"
1578
  msgstr ""
1579
 
1580
- #: includes/gateways/settings/googlepay-settings.php:140
1581
  msgid "Long"
1582
  msgstr ""
1583
 
1584
- #: includes/gateways/settings/googlepay-settings.php:141
1585
  msgid "Short"
1586
  msgstr ""
1587
 
1588
- #: includes/gateways/settings/googlepay-settings.php:143
1589
  msgid "The button style of the GPay button."
1590
  msgstr ""
1591
 
1592
- #: includes/gateways/settings/googlepay-settings.php:148
1593
  msgid ""
1594
  "If you can't see the Google Pay button, try switching to a Chrome browser."
1595
  msgstr ""
@@ -1607,43 +1643,43 @@ msgstr ""
1607
  msgid "Browser Payments"
1608
  msgstr ""
1609
 
1610
- #: includes/gateways/settings/payment-request-settings.php:89
1611
  msgid "default"
1612
  msgstr ""
1613
 
1614
- #: includes/gateways/settings/payment-request-settings.php:91
1615
  msgid "buy"
1616
  msgstr ""
1617
 
1618
- #: includes/gateways/settings/payment-request-settings.php:93
1619
  msgid "This defines the type of button that will display."
1620
  msgstr ""
1621
 
1622
- #: includes/gateways/settings/payment-request-settings.php:96
1623
  msgid "Theme"
1624
  msgstr ""
1625
 
1626
- #: includes/gateways/settings/payment-request-settings.php:98
1627
  msgid "dark"
1628
  msgstr ""
1629
 
1630
- #: includes/gateways/settings/payment-request-settings.php:99
1631
  msgid "light"
1632
  msgstr ""
1633
 
1634
- #: includes/gateways/settings/payment-request-settings.php:100
1635
  msgid "light-outline"
1636
  msgstr ""
1637
 
1638
- #: includes/gateways/settings/payment-request-settings.php:102
1639
  msgid "This defines the color scheme for the button."
1640
  msgstr ""
1641
 
1642
- #: includes/gateways/settings/payment-request-settings.php:105
1643
  msgid "Height"
1644
  msgstr ""
1645
 
1646
- #: includes/gateways/settings/payment-request-settings.php:107
1647
  msgid "The height of the button. Max height is 64"
1648
  msgstr ""
1649
 
2
  msgid ""
3
  msgstr ""
4
  "Project-Id-Version: woo-stripe-payment\n"
5
+ "POT-Creation-Date: 2020-02-03 09:29-0800\n"
6
  "PO-Revision-Date: 2019-08-16 14:27-0700\n"
7
  "Last-Translator: \n"
8
  "Language-Team: \n"
256
 
257
  #: includes/admin/class-wc-stripe-admin-menus.php:34
258
  #: includes/admin/views/html-settings-nav.php:17
259
+ #: includes/class-wc-stripe-install.php:28
260
  msgid "Documentation"
261
  msgstr ""
262
 
298
 
299
  #: includes/admin/meta-boxes/views/html-charge-data-subview.php:25
300
  #: includes/admin/settings/class-wc-stripe-api-settings.php:33
301
+ #: includes/controllers/class-wc-stripe-controller-gateway-settings.php:143
302
  msgid "Live"
303
  msgstr ""
304
 
305
  #: includes/admin/meta-boxes/views/html-charge-data-subview.php:25
306
  #: includes/admin/settings/class-wc-stripe-api-settings.php:32
307
+ #: includes/controllers/class-wc-stripe-controller-gateway-settings.php:143
308
  msgid "Test"
309
  msgstr ""
310
 
347
 
348
  #: includes/admin/meta-boxes/views/html-charge-data-subview.php:51
349
  #: includes/admin/views/html-ach-fee.php:10
350
+ #: includes/gateways/settings/payment-request-settings.php:73
351
  msgid "Type"
352
  msgstr ""
353
 
465
 
466
  #: includes/admin/settings/class-wc-stripe-api-settings.php:84
467
  #: includes/admin/settings/class-wc-stripe-api-settings.php:85
468
+ msgid "Connection Test"
469
  msgstr ""
470
 
471
  #: includes/admin/settings/class-wc-stripe-api-settings.php:87
472
+ msgid ""
473
+ "Click this button to perform a connection test. If successful, you have "
474
+ "entered your API keys correctly."
475
  msgstr ""
476
 
477
  #: includes/admin/settings/class-wc-stripe-api-settings.php:91
478
+ #: includes/admin/settings/class-wc-stripe-api-settings.php:92
479
+ msgid "Generate Webhook"
480
  msgstr ""
481
 
482
  #: includes/admin/settings/class-wc-stripe-api-settings.php:94
483
+ msgid "Click this button to configure webhooks automatically."
484
+ msgstr ""
485
+
486
+ #: includes/admin/settings/class-wc-stripe-api-settings.php:98
487
+ msgid "Webhook url"
488
+ msgstr ""
489
+
490
+ #: includes/admin/settings/class-wc-stripe-api-settings.php:101
491
  #, php-format
492
  msgid ""
493
  "<strong>Important:</strong> the webhook url is called by Stripe when events "
496
  "%sWebhook guide%s"
497
  msgstr ""
498
 
499
+ #: includes/admin/settings/class-wc-stripe-api-settings.php:105
500
  msgid "Live Webhook Secret"
501
  msgstr ""
502
 
503
+ #: includes/admin/settings/class-wc-stripe-api-settings.php:106
504
+ #: includes/admin/settings/class-wc-stripe-api-settings.php:116
505
  #, php-format
506
  msgid ""
507
  "The webhook secret is used to authenticate webhooks sent from Stripe. It "
509
  "guide%s"
510
  msgstr ""
511
 
512
+ #: includes/admin/settings/class-wc-stripe-api-settings.php:115
513
  msgid "Test Webhook Secret"
514
  msgstr ""
515
 
516
+ #: includes/admin/settings/class-wc-stripe-api-settings.php:124
517
  msgid "Debug Log"
518
  msgstr ""
519
 
520
+ #: includes/admin/settings/class-wc-stripe-api-settings.php:128
521
  msgid ""
522
  "When enabled, the plugin logs important errors and info that can help you "
523
  "troubleshoot potential issues."
615
  "the funds are received."
616
  msgstr ""
617
 
618
+ #: includes/class-wc-stripe-gateway.php:203
619
  #, php-format
620
  msgid "Error capturing charge. Reason: %s"
621
  msgstr ""
654
  msgid "Please review your order details then click Place Order."
655
  msgstr ""
656
 
657
+ #: includes/controllers/class-wc-stripe-controller-gateway-settings.php:80
658
  msgid ""
659
  "You cannot register your domain until you have configured your Live API keys."
660
  msgstr ""
661
 
662
+ #: includes/controllers/class-wc-stripe-controller-gateway-settings.php:96
663
  msgid ""
664
  "Domain registered successfully. You can confirm in your Stripe Dashboard at "
665
  "https://dashboard.stripe.com/account/apple_pay."
666
  msgstr ""
667
 
668
+ #: includes/controllers/class-wc-stripe-controller-gateway-settings.php:113
669
  msgid "You must configure your secret key before creating webhooks."
670
  msgstr ""
671
 
672
+ #: includes/controllers/class-wc-stripe-controller-gateway-settings.php:122
673
  msgid ""
674
  "There is already a webhook configured for this site. If you want to delete "
675
  "the webhook, login to your Stripe Dashboard."
676
  msgstr ""
677
 
678
+ #: includes/controllers/class-wc-stripe-controller-gateway-settings.php:143
679
  #, php-format
680
  msgid ""
681
  "Webhook created in Stripe for %s environment. You can test your webhook by "
682
  "logging in to the Stripe dashboard"
683
  msgstr ""
684
 
685
+ #: includes/controllers/class-wc-stripe-controller-gateway-settings.php:162
686
+ msgid "Secret key cannot be empty."
687
+ msgstr ""
688
+
689
+ #: includes/controllers/class-wc-stripe-controller-gateway-settings.php:165
690
+ msgid "Publishable key cannot be empty."
691
+ msgstr ""
692
+
693
+ #: includes/controllers/class-wc-stripe-controller-gateway-settings.php:171
694
+ #, php-format
695
+ msgid "Mode: %s. Invalid secret key. Please check your entry."
696
+ msgstr ""
697
+
698
+ #: includes/controllers/class-wc-stripe-controller-gateway-settings.php:186
699
+ #: includes/controllers/class-wc-stripe-controller-gateway-settings.php:189
700
+ #, php-format
701
+ msgid "Mode: %s. Invalid publishable key. Please check your entry."
702
+ msgstr ""
703
+
704
+ #: includes/controllers/class-wc-stripe-controller-gateway-settings.php:198
705
+ #, php-format
706
+ msgid "Connection test to Stripe was successful. Mode: %s."
707
+ msgstr ""
708
+
709
  #: includes/controllers/class-wc-stripe-controller-googlepay.php:86
710
  msgid "Your shipping address is not serviceable."
711
  msgstr ""
769
  msgid "ACH Fee"
770
  msgstr ""
771
 
772
+ #: includes/gateways/class-wc-payment-gateway-stripe-applepay.php:15
773
  #: includes/gateways/settings/applepay-settings.php:17
774
  msgid "Apple Pay"
775
  msgstr ""
776
 
777
+ #: includes/gateways/class-wc-payment-gateway-stripe-applepay.php:18
778
  msgid "Stripe Apple Pay"
779
  msgstr ""
780
 
781
+ #: includes/gateways/class-wc-payment-gateway-stripe-applepay.php:19
782
  msgid "Apple Pay gateway that integrates with your Stripe account."
783
  msgstr ""
784
 
785
+ #: includes/gateways/class-wc-payment-gateway-stripe-applepay.php:58
786
  msgid "Please update you product quantity before using Apple Pay."
787
  msgstr ""
788
 
789
+ #: includes/gateways/class-wc-payment-gateway-stripe-applepay.php:59
790
+ #: includes/gateways/class-wc-payment-gateway-stripe-payment-request.php:65
791
+ msgid "Please select a product option before updating quantity."
792
+ msgstr ""
793
+
794
  #: includes/gateways/class-wc-payment-gateway-stripe-bancontact.php:21
795
  #: includes/gateways/class-wc-payment-gateway-stripe-bancontact.php:24
796
  #: includes/gateways/class-wc-payment-gateway-stripe-bancontact.php:27
1087
  msgid "Adding to cart..."
1088
  msgstr ""
1089
 
 
 
 
 
1090
  #: includes/gateways/class-wc-payment-gateway-stripe-sepa.php:19
1091
  #: includes/gateways/class-wc-payment-gateway-stripe-sepa.php:25
1092
  msgid "SEPA"
1317
  #: includes/gateways/settings/applepay-settings.php:59
1318
  #: includes/gateways/settings/cc-settings.php:47
1319
  #: includes/gateways/settings/googlepay-settings.php:73
1320
+ #: includes/gateways/settings/payment-request-settings.php:60
1321
  msgid "Order Status"
1322
  msgstr ""
1323
 
1324
  #: includes/gateways/settings/applepay-settings.php:63
1325
  #: includes/gateways/settings/cc-settings.php:51
1326
  #: includes/gateways/settings/googlepay-settings.php:77
1327
+ #: includes/gateways/settings/payment-request-settings.php:64
1328
  msgid "Default"
1329
  msgstr ""
1330
 
1331
  #: includes/gateways/settings/applepay-settings.php:66
1332
  #: includes/gateways/settings/cc-settings.php:54
1333
  #: includes/gateways/settings/googlepay-settings.php:80
1334
+ #: includes/gateways/settings/payment-request-settings.php:67
1335
  msgid ""
1336
  "This is the status of the order once payment is complete. If <b>Default</b> "
1337
  "is selected, then WooCommerce will set the order status automatically based "
1341
  "WooCommerce code to process the order status."
1342
  msgstr ""
1343
 
1344
+ #: includes/gateways/settings/applepay-settings.php:69
1345
+ #: includes/gateways/settings/payment-request-settings.php:70
1346
  msgid "Button Settings"
1347
  msgstr ""
1348
 
1349
+ #: includes/gateways/settings/applepay-settings.php:72
1350
+ #: includes/gateways/settings/googlepay-settings.php:122
1351
  msgid "Button Design"
1352
  msgstr ""
1353
 
1354
+ #: includes/gateways/settings/applepay-settings.php:76
1355
  msgid "Black Button"
1356
  msgstr ""
1357
 
1358
+ #: includes/gateways/settings/applepay-settings.php:77
1359
  msgid "White With Black Line"
1360
  msgstr ""
1361
 
1362
+ #: includes/gateways/settings/applepay-settings.php:78
1363
  msgid "White Button"
1364
  msgstr ""
1365
 
1366
+ #: includes/gateways/settings/applepay-settings.php:80
1367
  msgid "This is the style for all Apple Pay buttons presented on your store."
1368
  msgstr ""
1369
 
1370
+ #: includes/gateways/settings/applepay-settings.php:83
1371
  msgid "Checkout button type"
1372
  msgstr ""
1373
 
1374
+ #: includes/gateways/settings/applepay-settings.php:86
1375
+ #: includes/gateways/settings/applepay-settings.php:96
1376
+ #: includes/gateways/settings/applepay-settings.php:106
1377
  msgid "Standard Button"
1378
  msgstr ""
1379
 
1380
+ #: includes/gateways/settings/applepay-settings.php:87
1381
+ #: includes/gateways/settings/applepay-settings.php:97
1382
+ #: includes/gateways/settings/applepay-settings.php:107
1383
  msgid "Buy with Apple Pay"
1384
  msgstr ""
1385
 
1386
+ #: includes/gateways/settings/applepay-settings.php:93
1387
  msgid "Cart button type"
1388
  msgstr ""
1389
 
1390
+ #: includes/gateways/settings/applepay-settings.php:103
1391
  msgid "Product button type"
1392
  msgstr ""
1393
 
1589
  "This is the icon style that appears next to the gateway on the checkout page."
1590
  msgstr ""
1591
 
1592
+ #: includes/gateways/settings/googlepay-settings.php:99
1593
  msgid "Button Options"
1594
  msgstr ""
1595
 
1596
+ #: includes/gateways/settings/googlepay-settings.php:102
1597
  msgid "Button Color"
1598
  msgstr ""
1599
 
1600
+ #: includes/gateways/settings/googlepay-settings.php:106
1601
  msgid "Black"
1602
  msgstr ""
1603
 
1604
+ #: includes/gateways/settings/googlepay-settings.php:107
1605
  msgid "White"
1606
  msgstr ""
1607
 
1608
+ #: includes/gateways/settings/googlepay-settings.php:109
1609
  msgid "The button color of the GPay button."
1610
  msgstr ""
1611
 
1612
+ #: includes/gateways/settings/googlepay-settings.php:112
1613
  msgid "Button Style"
1614
  msgstr ""
1615
 
1616
+ #: includes/gateways/settings/googlepay-settings.php:116
1617
  msgid "Long"
1618
  msgstr ""
1619
 
1620
+ #: includes/gateways/settings/googlepay-settings.php:117
1621
  msgid "Short"
1622
  msgstr ""
1623
 
1624
+ #: includes/gateways/settings/googlepay-settings.php:119
1625
  msgid "The button style of the GPay button."
1626
  msgstr ""
1627
 
1628
+ #: includes/gateways/settings/googlepay-settings.php:124
1629
  msgid ""
1630
  "If you can't see the Google Pay button, try switching to a Chrome browser."
1631
  msgstr ""
1643
  msgid "Browser Payments"
1644
  msgstr ""
1645
 
1646
+ #: includes/gateways/settings/payment-request-settings.php:75
1647
  msgid "default"
1648
  msgstr ""
1649
 
1650
+ #: includes/gateways/settings/payment-request-settings.php:77
1651
  msgid "buy"
1652
  msgstr ""
1653
 
1654
+ #: includes/gateways/settings/payment-request-settings.php:79
1655
  msgid "This defines the type of button that will display."
1656
  msgstr ""
1657
 
1658
+ #: includes/gateways/settings/payment-request-settings.php:82
1659
  msgid "Theme"
1660
  msgstr ""
1661
 
1662
+ #: includes/gateways/settings/payment-request-settings.php:84
1663
  msgid "dark"
1664
  msgstr ""
1665
 
1666
+ #: includes/gateways/settings/payment-request-settings.php:85
1667
  msgid "light"
1668
  msgstr ""
1669
 
1670
+ #: includes/gateways/settings/payment-request-settings.php:86
1671
  msgid "light-outline"
1672
  msgstr ""
1673
 
1674
+ #: includes/gateways/settings/payment-request-settings.php:88
1675
  msgid "This defines the color scheme for the button."
1676
  msgstr ""
1677
 
1678
+ #: includes/gateways/settings/payment-request-settings.php:91
1679
  msgid "Height"
1680
  msgstr ""
1681
 
1682
+ #: includes/gateways/settings/payment-request-settings.php:93
1683
  msgid "The height of the button. Max height is 64"
1684
  msgstr ""
1685
 
includes/abstract/abstract-wc-payment-gateway-stripe.php CHANGED
@@ -204,7 +204,7 @@ abstract class WC_Payment_Gateway_Stripe extends WC_Payment_Gateway {
204
  $this->enqueue_frontend_scripts ();
205
  wc_stripe_token_field ( $this );
206
  wc_stripe_payment_intent_field ( $this );
207
- wc_stripe_get_template ( 'checkout/payment-method.php', array(
208
  'gateway' => $this,
209
  'tokens' => is_add_payment_method_page () ? null : $this->get_tokens ()
210
  ) );
@@ -885,7 +885,7 @@ abstract class WC_Payment_Gateway_Stripe extends WC_Payment_Gateway {
885
  'post_meta' => array(
886
  '_payment_method_token' => array(
887
  'value' => $subscription->get_meta ( '_payment_method_token', true ),
888
- 'label' => __ ( 'Payment Method Token', 'braintree-payments' )
889
  )
890
  )
891
  );
204
  $this->enqueue_frontend_scripts ();
205
  wc_stripe_token_field ( $this );
206
  wc_stripe_payment_intent_field ( $this );
207
+ wc_stripe_get_template ( 'checkout/stripe-payment-method.php', array(
208
  'gateway' => $this,
209
  'tokens' => is_add_payment_method_page () ? null : $this->get_tokens ()
210
  ) );
885
  'post_meta' => array(
886
  '_payment_method_token' => array(
887
  'value' => $subscription->get_meta ( '_payment_method_token', true ),
888
+ 'label' => __ ( 'Payment Method Token', 'woo-stripe-payment' )
889
  )
890
  )
891
  );
includes/abstract/abstract-wc-payment-token-stripe.php CHANGED
@@ -116,7 +116,8 @@ abstract class WC_Payment_Token_Stripe extends WC_Payment_Token {
116
  'type' => $this->get_type (),
117
  'method_type' => $this->get_method_type (),
118
  'token' => $this->get_token (),
119
- 'title' => $this->get_payment_method_title ()
 
120
  ) );
121
  }
122
 
116
  'type' => $this->get_type (),
117
  'method_type' => $this->get_method_type (),
118
  'token' => $this->get_token (),
119
+ 'title' => $this->get_payment_method_title (),
120
+ 'gateway' => $this->get_gateway_id ()
121
  ) );
122
  }
123
 
includes/abstract/abstract-wc-stripe-settings.php CHANGED
@@ -32,6 +32,7 @@ abstract class WC_Stripe_Settings_API extends WC_Settings_API {
32
  if ($this->admin_output) {
33
  return;
34
  }
 
35
  $this->output_settings_nav ();
36
  printf ( '<input type="hidden" id="wc_stripe_prefix" name="wc_stripe_prefix" value="%1$s"/>', $this->get_prefix () );
37
  echo '<div class="wc-stripe-settings-container ' . $this->id . '">';
32
  if ($this->admin_output) {
33
  return;
34
  }
35
+ $this->display_errors ();
36
  $this->output_settings_nav ();
37
  printf ( '<input type="hidden" id="wc_stripe_prefix" name="wc_stripe_prefix" value="%1$s"/>', $this->get_prefix () );
38
  echo '<div class="wc-stripe-settings-container ' . $this->id . '">';
includes/admin/class-wc-stripe-admin-assets.php CHANGED
@@ -48,7 +48,8 @@ class WC_Stripe_Admin_Assets {
48
  wp_localize_script ( 'wc-stripe-admin-settings', 'wc_stripe_setting_params', [
49
  'routes' => [
50
  'apple_domain' => wc_stripe ()->rest_api->settings->rest_url ( 'apple-domain' ),
51
- 'create_webhook' => wc_stripe ()->rest_api->settings->rest_url ( 'create-webook' )
 
52
  ],
53
  'rest_nonce' => wp_create_nonce ( 'wp_rest' )
54
  ] );
48
  wp_localize_script ( 'wc-stripe-admin-settings', 'wc_stripe_setting_params', [
49
  'routes' => [
50
  'apple_domain' => wc_stripe ()->rest_api->settings->rest_url ( 'apple-domain' ),
51
+ 'create_webhook' => wc_stripe ()->rest_api->settings->rest_url ( 'create-webook' ),
52
+ 'connection_test' => wc_stripe ()->rest_api->settings->rest_url ( 'connection-test' )
53
  ],
54
  'rest_nonce' => wp_create_nonce ( 'wp_rest' )
55
  ] );
includes/admin/settings/class-wc-stripe-api-settings.php CHANGED
@@ -79,6 +79,13 @@ class WC_Stripe_API_Settings extends WC_Stripe_Settings_API {
79
  )
80
  )
81
  ),
 
 
 
 
 
 
 
82
  'webhook_button' => array(
83
  'type' => 'stripe_button',
84
  'title' => __ ( 'Generate Webhook', 'woo-stripe-payment' ),
@@ -122,4 +129,20 @@ class WC_Stripe_API_Settings extends WC_Stripe_Settings_API {
122
  )
123
  );
124
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
125
  }
79
  )
80
  )
81
  ),
82
+ 'connection_test' => array(
83
+ 'type' => 'stripe_button',
84
+ 'title' => __ ( 'Connection Test', 'woo-stripe-payment' ),
85
+ 'label' => __ ( 'Connection Test', 'woo-stripe-payment' ),
86
+ 'class' => 'wc-stripe-connection-test button-secondary',
87
+ 'description' => __ ( 'Click this button to perform a connection test. If successful, you have entered your API keys correctly.', 'woo-stripe-payment' )
88
+ ),
89
  'webhook_button' => array(
90
  'type' => 'stripe_button',
91
  'title' => __ ( 'Generate Webhook', 'woo-stripe-payment' ),
129
  )
130
  );
131
  }
132
+
133
+ /*
134
+ * public function validate_publishable_key_test_field($key, $value) {
135
+ * if (! strstr ( $value, 'test' )) {
136
+ * throw new Exception ( __ ( 'You have entered an invalid publishable key for Test mode', 'woo-stripe-payment' ) );
137
+ * }
138
+ * return $value;
139
+ * }
140
+ *
141
+ * public function validate_publishable_key_live_field($key, $value) {
142
+ * if (! strstr ( $value, 'live' )) {
143
+ * throw new Exception ( __ ( 'You have entered an invalid publishable key for Live mode', 'woo-stripe-payment' ) );
144
+ * }
145
+ * return $value;
146
+ * }
147
+ */
148
  }
includes/class-stripe.php CHANGED
@@ -21,7 +21,7 @@ class WC_Stripe_Manager {
21
  *
22
  * @var string
23
  */
24
- public $version = '3.0.7';
25
 
26
  /**
27
  *
21
  *
22
  * @var string
23
  */
24
+ public $version = '3.0.8';
25
 
26
  /**
27
  *
includes/class-wc-stripe-field-manager.php CHANGED
@@ -63,6 +63,11 @@ class WC_Stripe_Field_Manager {
63
 
64
  self::output_required_fields ();
65
 
 
 
 
 
 
66
  do_action ( 'wc_stripe_output_checkout_fields' );
67
  }
68
 
@@ -117,7 +122,7 @@ class WC_Stripe_Field_Manager {
117
  }
118
  }
119
  if (! empty ( $gateways )) {
120
- echo '<form>';
121
  self::output_required_fields ();
122
 
123
  self::output_fields ( 'billing' );
63
 
64
  self::output_required_fields ();
65
 
66
+ wp_localize_script ( 'wc-checkout', 'wc_stripe_checkout_fields', [
67
+ 'billing' => WC ()->checkout ()->get_checkout_fields ( 'billing' ),
68
+ 'shipping' => WC ()->checkout ()->get_checkout_fields ( 'billing' )
69
+ ] );
70
+
71
  do_action ( 'wc_stripe_output_checkout_fields' );
72
  }
73
 
122
  }
123
  }
124
  if (! empty ( $gateways )) {
125
+ echo '<form id="wc-stripe-cart-form">';
126
  self::output_required_fields ();
127
 
128
  self::output_fields ( 'billing' );
includes/class-wc-stripe-gateway.php CHANGED
@@ -20,10 +20,20 @@ class WC_Stripe_Gateway {
20
  */
21
  private $mode = null;
22
 
23
- public function __construct($mode = null) {
 
 
 
 
 
 
 
24
  if (null != $mode) {
25
  $this->mode = $mode;
26
  }
 
 
 
27
  }
28
 
29
  public static function init() {
@@ -372,6 +382,17 @@ class WC_Stripe_Gateway {
372
  }
373
  }
374
 
 
 
 
 
 
 
 
 
 
 
 
375
  public function fetch_payment_methods($customer_id, $mode = '') {
376
  try {
377
  return \Stripe\PaymentMethod::all ( [
@@ -398,7 +419,7 @@ class WC_Stripe_Gateway {
398
  public function webhooks($mode = '') {
399
  try {
400
  return \Stripe\WebhookEndpoint::all ( [
401
- 'limit' => 100
402
  ], $this->get_api_options ( $mode ) );
403
  } catch ( \Stripe\Error\Base $e ) {
404
  $err = $e->getJsonBody ()[ 'error' ];
@@ -423,7 +444,7 @@ class WC_Stripe_Gateway {
423
  $mode = $this->mode;
424
  }
425
  return apply_filters ( 'wc_stripe_api_options', [
426
- 'api_key' => wc_stripe_get_secret_key ( $mode )
427
  ] );
428
  }
429
  }
20
  */
21
  private $mode = null;
22
 
23
+ /**
24
+ *
25
+ * @since 3.0.8
26
+ * @var unknown
27
+ */
28
+ private $secret_key = null;
29
+
30
+ public function __construct($mode = null, $secret_key = null) {
31
  if (null != $mode) {
32
  $this->mode = $mode;
33
  }
34
+ if (null != $secret_key) {
35
+ $this->secret_key = $secret_key;
36
+ }
37
  }
38
 
39
  public static function init() {
382
  }
383
  }
384
 
385
+ public function fetch_customers($mode = '') {
386
+ try {
387
+ return \Stripe\Customer::all ( [
388
+ 'limit' => 1
389
+ ], $this->get_api_options ( $mode ) );
390
+ } catch ( \Stripe\Error\Base $e ) {
391
+ $err = $e->getJsonBody ()[ 'error' ];
392
+ return new WP_Error ( 'customer-error', $err[ 'message' ] );
393
+ }
394
+ }
395
+
396
  public function fetch_payment_methods($customer_id, $mode = '') {
397
  try {
398
  return \Stripe\PaymentMethod::all ( [
419
  public function webhooks($mode = '') {
420
  try {
421
  return \Stripe\WebhookEndpoint::all ( [
422
+ 'limit' => 100
423
  ], $this->get_api_options ( $mode ) );
424
  } catch ( \Stripe\Error\Base $e ) {
425
  $err = $e->getJsonBody ()[ 'error' ];
444
  $mode = $this->mode;
445
  }
446
  return apply_filters ( 'wc_stripe_api_options', [
447
+ 'api_key' => $this->secret_key ? $this->secret_key : wc_stripe_get_secret_key ( $mode )
448
  ] );
449
  }
450
  }
includes/controllers/class-wc-stripe-controller-gateway-settings.php CHANGED
@@ -26,6 +26,15 @@ class WC_Stripe_Controller_Gateway_Settings extends WC_Stripe_Rest_Controller {
26
  'admin_permission_check'
27
  )
28
  ] );
 
 
 
 
 
 
 
 
 
29
  }
30
 
31
  /**
@@ -136,4 +145,57 @@ class WC_Stripe_Controller_Gateway_Settings extends WC_Stripe_Rest_Controller {
136
  ] );
137
  }
138
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
139
  }
26
  'admin_permission_check'
27
  )
28
  ] );
29
+ register_rest_route ( $this->rest_uri (), 'connection-test', [
30
+ 'methods' => WP_REST_Server::CREATABLE,
31
+ 'callback' => [ $this,
32
+ 'connection_test'
33
+ ],
34
+ 'permission_callback' => array( $this,
35
+ 'admin_permission_check'
36
+ )
37
+ ] );
38
  }
39
 
40
  /**
145
  ] );
146
  }
147
  }
148
+
149
+ /**
150
+ * Perform a connection test
151
+ *
152
+ * @param WP_REST_Request $request
153
+ */
154
+ public function connection_test($request) {
155
+ $mode = $request->get_param ( 'mode' );
156
+ $secret_key = $request->get_param ( 'secret_key' );
157
+ $pub_key = $request->get_param ( 'publishable_key' );
158
+ $gateway = new WC_Stripe_Gateway ( $mode, $secret_key );
159
+
160
+ try {
161
+ if (empty ( $secret_key )) {
162
+ throw new Exception ( __ ( 'Secret key cannot be empty.', 'woo-stripe-payment' ) );
163
+ }
164
+ if (empty ( $pub_key )) {
165
+ throw new Exception ( __ ( 'Publishable key cannot be empty.', 'woo-stripe-payment' ) );
166
+ }
167
+ // test the secret key
168
+ $response = $gateway->fetch_customers ();
169
+
170
+ if (is_wp_error ( $response )) {
171
+ throw new Exception ( sprintf ( __ ( 'Mode: %s. Invalid secret key. Please check your entry.', 'woo-stripe-payment' ), $mode ) );
172
+ }
173
+
174
+ // secret key is good so save it.
175
+ wc_stripe ()->api_settings->update_option ( "secret_key_{$mode}", $secret_key );
176
+
177
+ // test the publishable key
178
+ $response = wp_remote_post ( 'https://api.stripe.com/v1/payment_methods', [
179
+ 'headers' => [
180
+ 'Content-Type' => 'application/x-www-form-urlencoded'
181
+ ],
182
+ 'body' => [ 'key' => $pub_key
183
+ ]
184
+ ] );
185
+ if (is_wp_error ( $response )) {
186
+ throw new Exception ( sprintf ( __ ( 'Mode: %s. Invalid publishable key. Please check your entry.', 'woo-stripe-payment' ), $mode ) );
187
+ }
188
+ if ($response[ 'response' ][ 'code' ] == 401) {
189
+ throw new Exception ( sprintf ( __ ( 'Mode: %s. Invalid publishable key. Please check your entry.', 'woo-stripe-payment' ), $mode ) );
190
+ }
191
+ wc_stripe ()->api_settings->update_option ( "publishable_key_{$mode}", $pub_key );
192
+ } catch ( Exception $e ) {
193
+ return new WP_Error ( 'connection-failure', $e->getMessage (), [
194
+ 'status' => 200
195
+ ] );
196
+ }
197
+ return rest_ensure_response ( [
198
+ 'message' => sprintf ( __ ( 'Connection test to Stripe was successful. Mode: %s.', 'woo-stripe-payment' ), $mode )
199
+ ] );
200
+ }
201
  }
includes/controllers/class-wc-stripe-controller-order-actions.php CHANGED
@@ -200,7 +200,7 @@ class WC_Stripe_Controller_Order_Actions extends WC_Stripe_Rest_Controller {
200
  $gateway->set_payment_method_token ( $token->get_token () );
201
  }
202
 
203
- // set intent atttribute off_session. Stripe requires confirm to be true to use off session.
204
  add_filter ( 'wc_stripe_payment_intent_args', function ($args) {
205
  $args[ 'confirm' ] = true;
206
  $args[ 'off_session' ] = true;
@@ -236,11 +236,10 @@ class WC_Stripe_Controller_Order_Actions extends WC_Stripe_Rest_Controller {
236
  $customer_id = $request->get_param ( 'customer_id' );
237
  $tokens = array();
238
  foreach ( WC ()->payment_gateways ()->payment_gateways () as $gateway ) {
239
- if ($gateway instanceof WC_Braintree_Payment_Gateway) {
240
  $tokens = array_merge ( $tokens, WC_Payment_Tokens::get_customer_tokens ( $customer_id, $gateway->id ) );
241
  }
242
  }
243
- $tokens = array_values ( WC_Payment_Tokens::get_customer_tokens ( $customer_id, 'braintree_cc' ) );
244
  return rest_ensure_response ( array(
245
  'payment_methods' => array_map ( function ($payment_method) {
246
  return $payment_method->to_json ();
200
  $gateway->set_payment_method_token ( $token->get_token () );
201
  }
202
 
203
+ // set intent attribute off_session. Stripe requires confirm to be true to use off session.
204
  add_filter ( 'wc_stripe_payment_intent_args', function ($args) {
205
  $args[ 'confirm' ] = true;
206
  $args[ 'off_session' ] = true;
236
  $customer_id = $request->get_param ( 'customer_id' );
237
  $tokens = array();
238
  foreach ( WC ()->payment_gateways ()->payment_gateways () as $gateway ) {
239
+ if ($gateway instanceof WC_Payment_Gateway_Stripe) {
240
  $tokens = array_merge ( $tokens, WC_Payment_Tokens::get_customer_tokens ( $customer_id, $gateway->id ) );
241
  }
242
  }
 
243
  return rest_ensure_response ( array(
244
  'payment_methods' => array_map ( function ($payment_method) {
245
  return $payment_method->to_json ();
includes/gateways/class-wc-payment-gateway-stripe-applepay.php CHANGED
@@ -3,9 +3,10 @@ if (! class_exists ( 'WC_Payment_Gateway_Stripe' )) {
3
  return;
4
  }
5
  /**
 
6
  * @package Stripe/Gateways
7
  * @author PaymentPlugins
8
- *
9
  */
10
  class WC_Payment_Gateway_Stripe_ApplePay extends WC_Payment_Gateway_Stripe_Payment_Intent {
11
 
@@ -54,7 +55,8 @@ class WC_Payment_Gateway_Stripe_ApplePay extends WC_Payment_Gateway_Stripe_Payme
54
  public function get_localized_params() {
55
  return array_merge_recursive ( parent::get_localized_params (), [
56
  'messages' => [
57
- 'invalid_amount' => __ ( 'Please update you product quantity before using Apple Pay.', 'woo-stripe-payment' )
 
58
  ],
59
  'button' => wc_stripe_get_template_html ( 'applepay-button.php', [
60
  'style' => $this->get_option ( 'button_style' ),
3
  return;
4
  }
5
  /**
6
+ *
7
  * @package Stripe/Gateways
8
  * @author PaymentPlugins
9
+ *
10
  */
11
  class WC_Payment_Gateway_Stripe_ApplePay extends WC_Payment_Gateway_Stripe_Payment_Intent {
12
 
55
  public function get_localized_params() {
56
  return array_merge_recursive ( parent::get_localized_params (), [
57
  'messages' => [
58
+ 'invalid_amount' => __ ( 'Please update you product quantity before using Apple Pay.', 'woo-stripe-payment' ),
59
+ 'choose_product' => __ ( 'Please select a product option before updating quantity.', 'woo-stripe-payment' )
60
  ],
61
  'button' => wc_stripe_get_template_html ( 'applepay-button.php', [
62
  'style' => $this->get_option ( 'button_style' ),
includes/gateways/settings/applepay-settings.php CHANGED
@@ -65,20 +65,6 @@ return array(
65
  'tool_tip' => true,
66
  'description' => __ ( 'This is the status of the order once payment is complete. If <b>Default</b> is selected, then WooCommerce will set the order status automatically based on internal logic which states if a product is virtual and downloadable then status is set to complete. Products that require shipping are set to Processing. Default is the recommended setting as it allows standard WooCommerce code to process the order status.', 'woo-stripe-payment' )
67
  ),
68
- /* 'order_prefix' => array( 'type' => 'text',
69
- 'title' => __ ( 'Order Prefix', 'woo-stripe-payment' ),
70
- 'value' => '', 'default' => '',
71
- 'class' => '', 'desc_tip' => true,
72
- 'description' => __ ( 'The order prefix is prepended to the WooCommerce order id and will appear within Braintree as the Order ID. This setting can be helpful if you want to distinguish
73
- orders that came from this particular site, plugin, or gateway.', 'woo-stripe-payment' )
74
- ),
75
- 'order_suffix' => array( 'type' => 'text',
76
- 'title' => __ ( 'Order Suffix', 'woo-stripe-payment' ),
77
- 'value' => '', 'default' => '',
78
- 'class' => '', 'desc_tip' => true,
79
- 'description' => __ ( 'The order suffix is appended to the WooCommerce order id and will appear within Braintree as the Order ID. This setting can be helpful if you want to distinguish
80
- orders that came from this particular site, plugin, or gateway.', 'woo-stripe-payment' )
81
- ), */
82
  'button_section' => [ 'type' => 'title',
83
  'title' => __ ( 'Button Settings', 'woo-stripe-payment' )
84
  ],
65
  'tool_tip' => true,
66
  'description' => __ ( 'This is the status of the order once payment is complete. If <b>Default</b> is selected, then WooCommerce will set the order status automatically based on internal logic which states if a product is virtual and downloadable then status is set to complete. Products that require shipping are set to Processing. Default is the recommended setting as it allows standard WooCommerce code to process the order status.', 'woo-stripe-payment' )
67
  ),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
68
  'button_section' => [ 'type' => 'title',
69
  'title' => __ ( 'Button Settings', 'woo-stripe-payment' )
70
  ],
includes/gateways/settings/googlepay-settings.php CHANGED
@@ -94,31 +94,7 @@ return array(
94
  ), 'default' => 'googlepay_standard',
95
  'desc_tip' => true,
96
  'description' => __ ( 'This is the icon style that appears next to the gateway on the checkout page.', 'woo-stripe-payment' )
97
- ),
98
- /* 'order_prefix' => array( 'type' => 'text',
99
- 'title' => __ ( 'Order Prefix', 'woo-stripe-payment' ),
100
- 'value' => '', 'default' => '',
101
- 'class' => '', 'desc_tip' => true,
102
- 'description' => __ ( 'The order prefix is prepended to the WooCommerce order id and will appear within Braintree as the Order ID. This setting can be helpful if you want to distinguish
103
- orders that came from this particular site, plugin, or gateway.', 'woo-stripe-payment' )
104
- ),
105
- 'order_suffix' => array( 'type' => 'text',
106
- 'title' => __ ( 'Order Suffix', 'woo-stripe-payment' ),
107
- 'value' => '', 'default' => '',
108
- 'class' => '', 'desc_tip' => true,
109
- 'description' => __ ( 'The order suffix is appended to the WooCommerce order id and will appear within Braintree as the Order ID. This setting can be helpful if you want to distinguish
110
- orders that came from this particular site, plugin, or gateway.', 'woo-stripe-payment' )
111
- ), */
112
- /* 'order_status' => array( 'type' => 'select',
113
- 'title' => __ ( 'Order Status', 'woo-stripe-payment' ),
114
- 'default' => 'default',
115
- 'class' => 'wc-enhanced-select',
116
- 'options' => array_merge ( array(
117
- 'default' => __ ( 'Default', 'woo-stripe-payment' )
118
- ), wc_get_order_statuses () ),
119
- 'tool_tip' => true,
120
- 'description' => __ ( 'This is the status of the order once payment is complete. If <b>Default</b> is selected, then WooCommerce will set the order status automatically based on internal logic which states if a product is virtual and downloadable then status is set to complete. Products that require shipping are set to Processing. Default is the recommended setting as it allows standard WooCommerce code to process the order status.', 'woo-stripe-payment' )
121
- ), */
122
  'button_section' => array( 'type' => 'title',
123
  'title' => __ ( 'Button Options', 'woo-stripe-payment' )
124
  ),
94
  ), 'default' => 'googlepay_standard',
95
  'desc_tip' => true,
96
  'description' => __ ( 'This is the icon style that appears next to the gateway on the checkout page.', 'woo-stripe-payment' )
97
+ ),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
98
  'button_section' => array( 'type' => 'title',
99
  'title' => __ ( 'Button Options', 'woo-stripe-payment' )
100
  ),
includes/gateways/settings/payment-request-settings.php CHANGED
@@ -56,20 +56,6 @@ return array(
56
  ],
57
  'description' => __ ( 'Increase your conversion rate by offering Apple Pay on your Product and Cart pages, or at the top of the checkout page.', 'woo-stripe-payment' )
58
  ),
59
- /* 'order_prefix' => array( 'type' => 'text',
60
- 'title' => __ ( 'Order Prefix', 'woo-stripe-payment' ),
61
- 'value' => '', 'default' => '',
62
- 'class' => '', 'desc_tip' => true,
63
- 'description' => __ ( 'The order prefix is prepended to the WooCommerce order id and will appear within Braintree as the Order ID. This setting can be helpful if you want to distinguish
64
- orders that came from this particular site, plugin, or gateway.', 'woo-stripe-payment' )
65
- ),
66
- 'order_suffix' => array( 'type' => 'text',
67
- 'title' => __ ( 'Order Suffix', 'woo-stripe-payment' ),
68
- 'value' => '', 'default' => '',
69
- 'class' => '', 'desc_tip' => true,
70
- 'description' => __ ( 'The order suffix is appended to the WooCommerce order id and will appear within Braintree as the Order ID. This setting can be helpful if you want to distinguish
71
- orders that came from this particular site, plugin, or gateway.', 'woo-stripe-payment' )
72
- ), */
73
  'order_status' => array( 'type' => 'select',
74
  'title' => __ ( 'Order Status', 'woo-stripe-payment' ),
75
  'default' => 'default',
56
  ],
57
  'description' => __ ( 'Increase your conversion rate by offering Apple Pay on your Product and Cart pages, or at the top of the checkout page.', 'woo-stripe-payment' )
58
  ),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
59
  'order_status' => array( 'type' => 'select',
60
  'title' => __ ( 'Order Status', 'woo-stripe-payment' ),
61
  'default' => 'default',
includes/wc-stripe-functions.php CHANGED
@@ -592,13 +592,13 @@ function wc_stripe_api_options($options) {
592
  * @param WC_Order $order
593
  */
594
  function wc_stripe_payment_complete_order_status($order_status, $order_id, $order) {
595
- if (is_checkout ()) {
596
  /**
597
  *
598
  * @var WC_Payment_Gateway_Stripe $gateway
599
  */
600
  $gateway = WC ()->payment_gateways ()->payment_gateways ()[ $order->get_payment_method () ];
601
- if ('default' !== $gateway->get_option ( 'order_status' )) {
602
  $order_status = $gateway->get_option ( 'order_status' );
603
  }
604
  }
592
  * @param WC_Order $order
593
  */
594
  function wc_stripe_payment_complete_order_status($order_status, $order_id, $order) {
595
+ if (is_checkout () && $order->get_payment_method ()) {
596
  /**
597
  *
598
  * @var WC_Payment_Gateway_Stripe $gateway
599
  */
600
  $gateway = WC ()->payment_gateways ()->payment_gateways ()[ $order->get_payment_method () ];
601
+ if ($gateway instanceof WC_Payment_Gateway_Stripe && 'default' !== $gateway->get_option ( 'order_status' )) {
602
  $order_status = $gateway->get_option ( 'order_status' );
603
  }
604
  }
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.3
6
  Requires PHP: 5.4
7
- Stable tag: 3.0.7
8
  Copyright: Payment Plugins
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
@@ -53,6 +53,12 @@ If you're site is not loading over https, then Stripe won't render the Payment R
53
  7. Payment options at top of checkout page for easy one click checkout
54
 
55
  == Changelog ==
 
 
 
 
 
 
56
  = 3.0.7 =
57
  * Added - WPML support for gateway titles and descriptions
58
  * Added - ACH fee option
4
  Requires at least: 3.0.1
5
  Tested up to: 5.3
6
  Requires PHP: 5.4
7
+ Stable tag: 3.0.8
8
  Copyright: Payment Plugins
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
53
  7. Payment options at top of checkout page for easy one click checkout
54
 
55
  == Changelog ==
56
+ = 3.0.8 =
57
+ * Updated - billing phone and email check added for card payment
58
+ * Updated - template checkout/payment-method.php name changed to checkout/stripe-payment-method.php
59
+ * Updated - cart checkout button styling
60
+ * Added - Connection test in admin API settings
61
+ * Misc - WC 3.9.1
62
  = 3.0.7 =
63
  * Added - WPML support for gateway titles and descriptions
64
  * Added - ACH fee option
stripe-payments.php CHANGED
@@ -4,13 +4,13 @@
4
  * Plugin Name: Stripe For WooCommerce
5
  * Plugin URI: https://docs.paymentplugins.com/wc-stripe/config/
6
  * Description: Accept credit cards, Google Pay, & Apple Pay, ACH, Klarna and more using Stripe.
7
- * Version: 3.0.7
8
  * Author: Payment Plugins, support@paymentplugins.com
9
  * Text Domain: woo-stripe-payment
10
  * Domain Path: /i18n/languages/
11
  * Tested up to: 5.3
12
  * WC requires at least: 3.0.0
13
- * WC tested up to: 3.9
14
  */
15
  function wc_stripe_php_version_notice() {
16
  $message = sprintf ( __ ( 'Your PHP version is %s but Stripe requires version 5.4+.', 'woo-stripe-payment' ), PHP_VERSION );
4
  * Plugin Name: Stripe For WooCommerce
5
  * Plugin URI: https://docs.paymentplugins.com/wc-stripe/config/
6
  * Description: Accept credit cards, Google Pay, & Apple Pay, ACH, Klarna and more using Stripe.
7
+ * Version: 3.0.8
8
  * Author: Payment Plugins, support@paymentplugins.com
9
  * Text Domain: woo-stripe-payment
10
  * Domain Path: /i18n/languages/
11
  * Tested up to: 5.3
12
  * WC requires at least: 3.0.0
13
+ * WC tested up to: 3.9.1
14
  */
15
  function wc_stripe_php_version_notice() {
16
  $message = sprintf ( __ ( 'Your PHP version is %s but Stripe requires version 5.4+.', 'woo-stripe-payment' ), PHP_VERSION );
templates/card-icons.php CHANGED
@@ -3,9 +3,9 @@
3
  * @version 3.0.0
4
  */
5
  ?>
6
- <div class="wc-stripe-card-icons-container">
7
  <?php foreach($cards as $id):?>
8
  <img class="wc-stripe-card-icon"
9
  src="<?php echo wc_stripe()->assets_url() . 'img/cards/' . $id . '.svg'?>" />
10
  <?php endforeach;?>
11
- </div>
3
  * @version 3.0.0
4
  */
5
  ?>
6
+ <span class="wc-stripe-card-icons-container">
7
  <?php foreach($cards as $id):?>
8
  <img class="wc-stripe-card-icon"
9
  src="<?php echo wc_stripe()->assets_url() . 'img/cards/' . $id . '.svg'?>" />
10
  <?php endforeach;?>
11
+ </span>
templates/cart/payment-methods.php CHANGED
@@ -10,7 +10,7 @@
10
  <?php if($after):?>
11
  <li class="wc-stripe-payment-method or">
12
  <p class="wc-stripe-cart-or">
13
- &mdash;&nbsp;<?php _e('or', 'woo-stripe-payment')?>&mdash;&nbsp;
14
  </p>
15
  </li>
16
  <?php endif;?>
@@ -25,7 +25,7 @@
25
  <?php if(!$after):?>
26
  <li class="wc-stripe-payment-method or">
27
  <p class="wc-stripe-cart-or">
28
- &mdash;&nbsp;<?php _e('or', 'woo-stripe-payment')?>&mdash;&nbsp;
29
  </p>
30
  </li>
31
  <?php endif;?>
10
  <?php if($after):?>
11
  <li class="wc-stripe-payment-method or">
12
  <p class="wc-stripe-cart-or">
13
+ &mdash;&nbsp;<?php _e('or', 'woo-stripe-payment')?>&nbsp;&mdash;
14
  </p>
15
  </li>
16
  <?php endif;?>
25
  <?php if(!$after):?>
26
  <li class="wc-stripe-payment-method or">
27
  <p class="wc-stripe-cart-or">
28
+ &mdash;&nbsp;<?php _e('or', 'woo-stripe-payment')?>&nbsp;&mdash;
29
  </p>
30
  </li>
31
  <?php endif;?>
templates/checkout/stripe-payment-method.php ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @version 3.0.0
4
+ *
5
+ * @var WC_Payment_Gateway_Stripe $gateway
6
+ */
7
+ ?>
8
+ <?php if(($desc = $gateway->get_description())):?>
9
+ <div class="wc-stripe-gateway-desc<?php if($tokens):?> has_tokens<?php endif;?>">
10
+ <?php echo wpautop( wptexturize( $desc ) )?>
11
+ </div>
12
+ <?php endif;?>
13
+ <?php if($tokens):?>
14
+ <input type="radio" class="wc-stripe-payment-type"
15
+ id="<?php echo $gateway->id?>_use_new"
16
+ name="<?php echo $gateway->payment_type_key?>" value="new" />
17
+ <label for="<?php echo $gateway->id?>_use_new"
18
+ class="wc-stripe-label-payment-type"><?php echo $gateway->get_new_method_label()?></label>
19
+ <?php endif;?>
20
+ <div class="wc-<?php echo $gateway->id?>-container">
21
+ <div class="wc-<?php echo $gateway->id?>-new-method-container"
22
+ <?php if($tokens):?> style="display: none" <?php endif;?>>
23
+ <?php wc_stripe_get_template('checkout/' . $gateway->template_name, array('gateway' => $gateway))?>
24
+ </div>
25
+ <?php
26
+ if ($tokens) :
27
+ $gateway->saved_payment_methods ( $tokens );
28
+
29
+ endif;
30
+ ?>
31
+ </div>