WooCommerce Stripe Payment Gateway - Version 4.5.3

Version Description

Download this release

Release Info

Developer woothemes
Plugin Icon 128x128 WooCommerce Stripe Payment Gateway
Version 4.5.3
Comparing to
See all releases

Code changes from version 4.5.2 to 4.5.3

assets/css/stripe-styles.scss ADDED
@@ -0,0 +1,120 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .wc-stripe-elements-field, .wc-stripe-iban-element-field { border:1px solid #ddd; margin:5px 0; padding:5px; background-color:#fff; outline:0; }
2
+ #payment .methods li.woocommerce-SavedPaymentMethods-token label { display: inline; }
3
+ #payment .methods li.woocommerce-SavedPaymentMethods-new label { display: inline; }
4
+
5
+ .woocommerce-checkout #payment ul.payment_methods li img.stripe-icon,
6
+ #add_payment_method #payment ul.payment_methods li img.stripe-icon { max-width: 40px; padding-left: 3px; margin: 0; }
7
+
8
+ .woocommerce-checkout #payment ul.payment_methods li img.stripe-bancontact-icon,
9
+ #add_payment_method #payment ul.payment_methods li img.stripe-bancontact-icon { max-height: 65px; max-width: 45px; }
10
+
11
+ .woocommerce-checkout #payment ul.payment_methods li img.stripe-ideal-icon,
12
+ #add_payment_method #payment ul.payment_methods li img.stripe-ideal-icon { max-height: 35px; }
13
+
14
+ .woocommerce-checkout #payment ul.payment_methods li img.stripe-p24-icon,
15
+ #add_payment_method #payment ul.payment_methods li img.stripe-p24-icon { max-width: 65px; }
16
+
17
+ .woocommerce-checkout #payment ul.payment_methods li img.stripe-alipay-icon,
18
+ #add_payment_method #payment ul.payment_methods li img.stripe-alipay-icon { max-width: 50px; }
19
+
20
+ .woocommerce-checkout #payment ul.payment_methods li img.stripe-sofort-icon,
21
+ #add_payment_method #payment ul.payment_methods li img.stripe-sofort-icon { max-width: 55px; }
22
+
23
+ .woocommerce-checkout #payment ul.payment_methods li img.stripe-sepa-icon,
24
+ #add_payment_method #payment ul.payment_methods li img.stripe-sepa-icon { max-width: 50px; }
25
+
26
+ .woocommerce-checkout #payment ul.payment_methods li img.stripe-multibanco-icon,
27
+ #add_payment_method #payment ul.payment_methods li img.stripe-multibanco-icon { max-height: 30px; }
28
+
29
+ .woocommerce-checkout #payment ul.payment_methods li img.stripe-eps-icon,
30
+ #add_payment_method #payment ul.payment_methods li img.stripe-eps-icon { max-height: 30px; }
31
+
32
+ .woocommerce-checkout #payment ul.payment_methods li img.stripe-giropay-icon,
33
+ #add_payment_method #payment ul.payment_methods li img.stripe-giropay-icon { max-width: 50px; }
34
+
35
+ .woocommerce-checkout #payment ul.payment_methods li .stripe-credit-card-brand,
36
+ #add_payment_method #payment ul.payment_methods li .stripe-credit-card-brand { position: absolute; top: 50%; margin-top: -10px; right: 10px; background: no-repeat url( '../images/credit-card.svg' ); display: block; width: 30px; height: 24px; }
37
+
38
+ .woocommerce-checkout #payment ul.payment_methods li .stripe-visa-brand,
39
+ #add_payment_method #payment ul.payment_methods li .stripe-visa-brand { position: absolute; top: 50%; margin-top: -10px; right: 10px; background: no-repeat url( '../images/visa.svg' ); display: block; width: 30px; height: 24px; }
40
+
41
+ .woocommerce-checkout #payment ul.payment_methods li .stripe-amex-brand,
42
+ #add_payment_method #payment ul.payment_methods li .stripe-amex-brand { position: absolute; top: 50%; margin-top: -10px; right: 10px; background: no-repeat url( '../images/amex.svg' ); display: block; width: 30px; height: 24px; }
43
+
44
+ .woocommerce-checkout #payment ul.payment_methods li .stripe-diners-brand,
45
+ #add_payment_method #payment ul.payment_methods li .stripe-diners-brand { position: absolute; top: 50%; margin-top: -10px; right: 10px; background: no-repeat url( '../images/diners.svg' ); display: block; width: 30px; height: 24px; }
46
+
47
+ .woocommerce-checkout #payment ul.payment_methods li .stripe-discover-brand,
48
+ #add_payment_method #payment ul.payment_methods li .stripe-discover-brand { position: absolute; top: 50%; margin-top: -10px; right: 10px; background: no-repeat url( '../images/discover.svg' ); display: block; width: 30px; height: 24px; }
49
+
50
+ .woocommerce-checkout #payment ul.payment_methods li .stripe-jcb-brand,
51
+ #add_payment_method #payment ul.payment_methods li .stripe-jcb-brand { position: absolute; top: 50%; margin-top: -10px; right: 10px; background: no-repeat url( '../images/jcb.svg' ); display: block; width: 30px; height: 24px; }
52
+
53
+ .woocommerce-checkout #payment ul.payment_methods li .stripe-maestro-brand,
54
+ #add_payment_method #payment ul.payment_methods li .stripe-maestro-brand { position: absolute; top: 50%; margin-top: -10px; right: 10px; background: no-repeat url( '../images/maestro.svg' ); display: block; width: 30px; height: 24px; }
55
+
56
+ .woocommerce-checkout #payment ul.payment_methods li .stripe-mastercard-brand,
57
+ #add_payment_method #payment ul.payment_methods li .stripe-mastercard-brand { position: absolute; top: 50%; margin-top: -10px; right: 10px; background: no-repeat url( '../images/mastercard.svg' ); display: block; width: 30px; height: 24px; }
58
+
59
+ .woocommerce-checkout #payment ul.payment_methods .stripe-card-group,
60
+ #add_payment_method #payment ul.payment_methods .stripe-card-group { position: relative; }
61
+
62
+ .woocommerce-SavedPaymentMethods-token .stripe-source-errors .woocommerce-error { margin-top: 1em; margin-bottom: 2em; }
63
+
64
+ #wc-stripe-custom-button { display: block; width: 100%; }
65
+
66
+ .gpay-button {
67
+ background-origin: content-box;
68
+ background-position: center center;
69
+ background-repeat: no-repeat;
70
+ background-size: contain;
71
+ border: 0px;
72
+ border-radius: 4px;
73
+ box-shadow: rgba(60, 64, 67, 0.3) 0px 1px 1px 0px, rgba(60, 64, 67, 0.15) 0px 1px 3px 1px;
74
+ cursor: pointer;
75
+ height: 40px;
76
+ min-height: 40px;
77
+ padding: 11px 24px;
78
+ width: 100%;
79
+
80
+ &.light {
81
+ // account for button box-shadow when setting width
82
+ width: calc( 100% - 3px );
83
+ background-color: #fff;
84
+ &:active {
85
+ background-color: #fff;
86
+ }
87
+ &:hover {
88
+ background-color: #f8f8f8;
89
+ }
90
+ &:focus {
91
+ box-shadow: #e8e8e8 0 1px 1px 0, #e8e8e8 0 1px 3px;
92
+ outline: 0;
93
+ }
94
+ }
95
+
96
+ &.dark {
97
+ background-color: #000;
98
+ box-shadow: none;
99
+ padding: 12px 24px 10px;
100
+ &:active {
101
+ background-color: #5f6368;
102
+ }
103
+ &:hover{
104
+ background-color: #3c4043;
105
+ }
106
+ &:focus {
107
+ box-shadow: #5f6368 0 1px 1px 0, #5f6368 0 1px 3px;
108
+ outline: 0;
109
+ }
110
+ }
111
+
112
+ &.short {
113
+ &.light {
114
+ background-image: url(https://www.gstatic.com/instantbuy/svg/light_gpay.svg);
115
+ }
116
+ &.dark {
117
+ background-image: url(https://www.gstatic.com/instantbuy/svg/dark_gpay.svg);
118
+ }
119
+ }
120
+ }
assets/js/stripe-admin.js CHANGED
@@ -86,6 +86,28 @@ jQuery( function( $ ) {
86
  } );
87
  } );
88
  } );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
89
  }
90
  };
91
 
86
  } );
87
  } );
88
  } );
89
+
90
+ // Add secret visibility toggles.
91
+ $( '#woocommerce_stripe_test_secret_key, #woocommerce_stripe_secret_key, #woocommerce_stripe_test_webhook_secret, #woocommerce_stripe_webhook_secret' ).after(
92
+ '<button class="wc-stripe-toggle-secret" style="height: 30px; margin-left: 2px; cursor: pointer"><span class="dashicons dashicons-visibility"></span></button>'
93
+ );
94
+ $( '.wc-stripe-toggle-secret' ).on( 'click', function( event ) {
95
+ event.preventDefault();
96
+
97
+ var $dashicon = $( this ).closest( 'button' ).find( '.dashicons' );
98
+ var $input = $( this ).closest( 'tr' ).find( '.input-text' );
99
+ var inputType = $input.attr( 'type' );
100
+
101
+ if ( 'text' == inputType ) {
102
+ $input.attr( 'type', 'password' );
103
+ $dashicon.removeClass( 'dashicons-hidden' );
104
+ $dashicon.addClass( 'dashicons-visibility' );
105
+ } else {
106
+ $input.attr( 'type', 'text' );
107
+ $dashicon.removeClass( 'dashicons-visibility' );
108
+ $dashicon.addClass( 'dashicons-hidden' );
109
+ }
110
+ } );
111
  }
112
  };
113
 
assets/js/stripe-admin.min.js CHANGED
@@ -1 +1 @@
1
- jQuery(function(c){"use strict";var e={isTestMode:function(){return c("#woocommerce_stripe_testmode").is(":checked")},getSecretKey:function(){return e.isTestMode()?c("#woocommerce_stripe_test_secret_key").val():c("#woocommerce_stripe_secret_key").val()},init:function(){c(document.body).on("change","#woocommerce_stripe_testmode",function(){var e=c("#woocommerce_stripe_test_secret_key").parents("tr").eq(0),t=c("#woocommerce_stripe_test_publishable_key").parents("tr").eq(0),o=c("#woocommerce_stripe_test_webhook_secret").parents("tr").eq(0),s=c("#woocommerce_stripe_secret_key").parents("tr").eq(0),r=c("#woocommerce_stripe_publishable_key").parents("tr").eq(0),_=c("#woocommerce_stripe_webhook_secret").parents("tr").eq(0);c(this).is(":checked")?(e.show(),t.show(),o.show(),s.hide(),r.hide(),_.hide()):(e.hide(),t.hide(),o.hide(),s.show(),r.show(),_.show())}),c("#woocommerce_stripe_testmode").change(),c("#woocommerce_stripe_payment_request").change(function(){c(this).is(":checked")?c("#woocommerce_stripe_payment_request_button_theme, #woocommerce_stripe_payment_request_button_type, #woocommerce_stripe_payment_request_button_height").closest("tr").show():c("#woocommerce_stripe_payment_request_button_theme, #woocommerce_stripe_payment_request_button_type, #woocommerce_stripe_payment_request_button_height").closest("tr").hide()}).change(),c("#woocommerce_stripe_payment_request_button_type").change(function(){"custom"===c(this).val()?c("#woocommerce_stripe_payment_request_button_label").closest("tr").show():c("#woocommerce_stripe_payment_request_button_label").closest("tr").hide()}).change(),c("#woocommerce_stripe_payment_request_button_type").change(function(){"branded"===c(this).val()?c("#woocommerce_stripe_payment_request_button_branded_type").closest("tr").show():c("#woocommerce_stripe_payment_request_button_branded_type").closest("tr").hide()}).change(),c(".wc-stripe-3ds-missing").each(function(){var e=c(this);e.find(".notice-dismiss").on("click.wc-stripe-dismiss-notice",function(){c.ajax({type:"head",url:window.location.href+"&stripe_dismiss_3ds="+e.data("nonce")})})})}};e.init()});
1
+ jQuery(function(i){"use strict";var e={isTestMode:function(){return i("#woocommerce_stripe_testmode").is(":checked")},getSecretKey:function(){return e.isTestMode()?i("#woocommerce_stripe_test_secret_key").val():i("#woocommerce_stripe_secret_key").val()},init:function(){i(document.body).on("change","#woocommerce_stripe_testmode",function(){var e=i("#woocommerce_stripe_test_secret_key").parents("tr").eq(0),t=i("#woocommerce_stripe_test_publishable_key").parents("tr").eq(0),o=i("#woocommerce_stripe_test_webhook_secret").parents("tr").eq(0),s=i("#woocommerce_stripe_secret_key").parents("tr").eq(0),r=i("#woocommerce_stripe_publishable_key").parents("tr").eq(0),c=i("#woocommerce_stripe_webhook_secret").parents("tr").eq(0);i(this).is(":checked")?(e.show(),t.show(),o.show(),s.hide(),r.hide(),c.hide()):(e.hide(),t.hide(),o.hide(),s.show(),r.show(),c.show())}),i("#woocommerce_stripe_testmode").change(),i("#woocommerce_stripe_payment_request").change(function(){i(this).is(":checked")?i("#woocommerce_stripe_payment_request_button_theme, #woocommerce_stripe_payment_request_button_type, #woocommerce_stripe_payment_request_button_height").closest("tr").show():i("#woocommerce_stripe_payment_request_button_theme, #woocommerce_stripe_payment_request_button_type, #woocommerce_stripe_payment_request_button_height").closest("tr").hide()}).change(),i("#woocommerce_stripe_payment_request_button_type").change(function(){"custom"===i(this).val()?i("#woocommerce_stripe_payment_request_button_label").closest("tr").show():i("#woocommerce_stripe_payment_request_button_label").closest("tr").hide()}).change(),i("#woocommerce_stripe_payment_request_button_type").change(function(){"branded"===i(this).val()?i("#woocommerce_stripe_payment_request_button_branded_type").closest("tr").show():i("#woocommerce_stripe_payment_request_button_branded_type").closest("tr").hide()}).change(),i(".wc-stripe-3ds-missing").each(function(){var e=i(this);e.find(".notice-dismiss").on("click.wc-stripe-dismiss-notice",function(){i.ajax({type:"head",url:window.location.href+"&stripe_dismiss_3ds="+e.data("nonce")})})}),i("#woocommerce_stripe_test_secret_key, #woocommerce_stripe_secret_key, #woocommerce_stripe_test_webhook_secret, #woocommerce_stripe_webhook_secret").after('<button class="wc-stripe-toggle-secret" style="height: 30px; margin-left: 2px; cursor: pointer"><span class="dashicons dashicons-visibility"></span></button>'),i(".wc-stripe-toggle-secret").on("click",function(e){e.preventDefault();var t=i(this).closest("button").find(".dashicons"),o=i(this).closest("tr").find(".input-text");"text"==o.attr("type")?(o.attr("type","password"),t.removeClass("dashicons-hidden"),t.addClass("dashicons-visibility")):(o.attr("type","text"),t.removeClass("dashicons-visibility"),t.addClass("dashicons-hidden"))})}};e.init()});
assets/js/stripe-payment-request.js CHANGED
@@ -315,7 +315,7 @@ jQuery( function( $ ) {
315
  country: wc_stripe_payment_request_params.checkout.country_code,
316
  requestPayerName: true,
317
  requestPayerEmail: true,
318
- requestPayerPhone: true,
319
  requestShipping: wc_stripe_payment_request_params.product.requestShipping,
320
  displayItems: wc_stripe_payment_request_params.product.displayItems
321
  };
@@ -342,7 +342,7 @@ jQuery( function( $ ) {
342
  country: cart.order_data.country_code,
343
  requestPayerName: true,
344
  requestPayerEmail: true,
345
- requestPayerPhone: true,
346
  requestShipping: cart.shipping_required ? true : false,
347
  displayItems: cart.order_data.displayItems
348
  };
315
  country: wc_stripe_payment_request_params.checkout.country_code,
316
  requestPayerName: true,
317
  requestPayerEmail: true,
318
+ requestPayerPhone: wc_stripe_payment_request_params.checkout.needs_payer_phone,
319
  requestShipping: wc_stripe_payment_request_params.product.requestShipping,
320
  displayItems: wc_stripe_payment_request_params.product.displayItems
321
  };
342
  country: cart.order_data.country_code,
343
  requestPayerName: true,
344
  requestPayerEmail: true,
345
+ requestPayerPhone: wc_stripe_payment_request_params.checkout.needs_payer_phone,
346
  requestShipping: cart.shipping_required ? true : false,
347
  displayItems: cart.order_data.displayItems
348
  };
assets/js/stripe-payment-request.min.js CHANGED
@@ -1 +1 @@
1
- jQuery(function(i){"use strict";var o,u=Stripe(wc_stripe_payment_request_params.stripe.key),p={getAjaxURL:function(t){return wc_stripe_payment_request_params.ajax_url.toString().replace("%%endpoint%%","wc_stripe_"+t)},getCartDetails:function(){var t={security:wc_stripe_payment_request_params.nonce.payment};i.ajax({type:"POST",data:t,url:p.getAjaxURL("get_cart_details"),success:function(t){p.startPaymentRequest(t)}})},getAttributes:function(){var t=i(".variations_form").find(".variations select"),a={},n=0,s=0;return t.each(function(){var t=i(this).data("attribute_name")||i(this).attr("name"),e=i(this).val()||"";0<e.length&&s++,n++,a[t]=e}),{count:n,chosenCount:s,data:a}},processSource:function(t,e){var a=p.getOrderData(t,e);return i.ajax({type:"POST",data:a,dataType:"json",url:p.getAjaxURL("create_order")})},getOrderData:function(t,e){var a=t.source,n=a.owner.email,s=a.owner.phone,r=a.owner.address,i=a.owner.name,o=t.shippingAddress,u={_wpnonce:wc_stripe_payment_request_params.nonce.checkout,billing_first_name:null!==i?i.split(" ").slice(0,1).join(" "):"",billing_last_name:null!==i?i.split(" ").slice(1).join(" "):"",billing_company:"",billing_email:null!==n?n:t.payerEmail,billing_phone:null!==s?s:t.payerPhone.replace("/[() -]/g",""),billing_country:null!==r?r.country:"",billing_address_1:null!==r?r.line1:"",billing_address_2:null!==r?r.line2:"",billing_city:null!==r?r.city:"",billing_state:null!==r?r.state:"",billing_postcode:null!==r?r.postal_code:"",shipping_first_name:"",shipping_last_name:"",shipping_company:"",shipping_country:"",shipping_address_1:"",shipping_address_2:"",shipping_city:"",shipping_state:"",shipping_postcode:"",shipping_method:[null===t.shippingOption?null:t.shippingOption.id],order_comments:"",payment_method:"stripe",ship_to_different_address:1,terms:1,stripe_source:a.id,payment_request_type:e};return o&&(u.shipping_first_name=o.recipient.split(" ").slice(0,1).join(" "),u.shipping_last_name=o.recipient.split(" ").slice(1).join(" "),u.shipping_company=o.organization,u.shipping_country=o.country,u.shipping_address_1=void 0===o.addressLine[0]?"":o.addressLine[0],u.shipping_address_2=void 0===o.addressLine[1]?"":o.addressLine[1],u.shipping_city=o.city,u.shipping_state=o.region,u.shipping_postcode=o.postalCode),u},getErrorMessageHTML:function(t){return i('<div class="woocommerce-error" />').text(t)},abortPayment:function(t,e){if(t.complete("fail"),i(".woocommerce-error").remove(),wc_stripe_payment_request_params.is_product_page){var a=i(".product");a.before(e),i("html, body").animate({scrollTop:a.prev(".woocommerce-error").offset().top},600)}else{var n=i(".shop_table.cart").closest("form");n.before(e),i("html, body").animate({scrollTop:n.prev(".woocommerce-error").offset().top},600)}},completePayment:function(t,e){p.block(),t.complete("success"),window.location=e},block:function(){i.blockUI({message:null,overlayCSS:{background:"#fff",opacity:.6}})},updateShippingOptions:function(t,e){var a={security:wc_stripe_payment_request_params.nonce.shipping,country:e.country,state:e.region,postcode:e.postalCode,city:e.city,address:void 0===e.addressLine[0]?"":e.addressLine[0],address_2:void 0===e.addressLine[1]?"":e.addressLine[1],payment_request_type:o,is_product_page:wc_stripe_payment_request_params.is_product_page};return i.ajax({type:"POST",data:a,url:p.getAjaxURL("get_shipping_options")})},updateShippingDetails:function(t,e){var a={security:wc_stripe_payment_request_params.nonce.update_shipping,shipping_method:[e.id],payment_request_type:o,is_product_page:wc_stripe_payment_request_params.is_product_page};return i.ajax({type:"POST",data:a,url:p.getAjaxURL("update_shipping_method")})},addToCart:function(){var t=i(".single_add_to_cart_button").val();i(".single_variation_wrap").length&&(t=i(".single_variation_wrap").find('input[name="product_id"]').val());var n={security:wc_stripe_payment_request_params.nonce.add_to_cart,product_id:t,qty:i(".quantity .qty").val(),attributes:i(".variations_form").length?p.getAttributes().data:[]},e=i("form.cart").serializeArray();return i.each(e,function(t,e){if(/^addon-/.test(e.name))if(/\[\]$/.test(e.name)){var a=e.name.substring(0,e.name.length-2);n[a]?n[a].push(e.value):n[a]=[e.value]}else n[e.name]=e.value}),i.ajax({type:"POST",data:n,url:p.getAjaxURL("add_to_cart")})},clearCart:function(){var t={security:wc_stripe_payment_request_params.nonce.clear_cart};return i.ajax({type:"POST",data:t,url:p.getAjaxURL("clear_cart"),success:function(t){}})},getRequestOptionsFromLocal:function(){return{total:wc_stripe_payment_request_params.product.total,currency:wc_stripe_payment_request_params.checkout.currency_code,country:wc_stripe_payment_request_params.checkout.country_code,requestPayerName:!0,requestPayerEmail:!0,requestPayerPhone:!0,requestShipping:wc_stripe_payment_request_params.product.requestShipping,displayItems:wc_stripe_payment_request_params.product.displayItems}},startPaymentRequest:function(t){var a,e;a=wc_stripe_payment_request_params.is_product_page?e=p.getRequestOptionsFromLocal():(e={total:t.order_data.total,currency:t.order_data.currency,country:t.order_data.country_code,requestPayerName:!0,requestPayerEmail:!0,requestPayerPhone:!0,requestShipping:!!t.shipping_required,displayItems:t.order_data.displayItems},t.order_data);var n=u.paymentRequest(e),s=u.elements({locale:wc_stripe_payment_request_params.button.locale}),r=p.createPaymentRequestButton(s,n);n.canMakePayment().then(function(t){t&&(o=t.applePay?"apple_pay":"payment_request_api",p.attachPaymentRequestButtonEventListeners(r,n),p.showPaymentRequestButton(r))}),n.on("shippingaddresschange",function(e){i.when(p.updateShippingOptions(a,e.shippingAddress)).then(function(t){e.updateWith({status:t.result,shippingOptions:t.shipping_options,total:t.total,displayItems:t.displayItems})})}),n.on("shippingoptionchange",function(e){i.when(p.updateShippingDetails(a,e.shippingOption)).then(function(t){"success"===t.result&&e.updateWith({status:"success",total:t.total,displayItems:t.displayItems}),"fail"===t.result&&e.updateWith({status:"fail"})})}),n.on("source",function(e){"no"===wc_stripe_payment_request_params.stripe.allow_prepaid_card&&"prepaid"===e.source.card.funding?p.abortPayment(e,p.getErrorMessageHTML(wc_stripe_payment_request_params.i18n.no_prepaid_card)):i.when(p.processSource(e,o)).then(function(t){"success"===t.result?p.completePayment(e,t.redirect):p.abortPayment(e,t.messages)})})},getSelectedProductData:function(){var t=i(".single_add_to_cart_button").val();i(".single_variation_wrap").length&&(t=i(".single_variation_wrap").find('input[name="product_id"]').val());var e=(i("#product-addons-total").data("price_data")||[]).reduce(function(t,e){return t+e.cost},0),a={security:wc_stripe_payment_request_params.nonce.get_selected_product_data,product_id:t,qty:i(".quantity .qty").val(),attributes:i(".variations_form").length?p.getAttributes().data:[],addon_value:e};return i.ajax({type:"POST",data:a,url:p.getAjaxURL("get_selected_product_data")})},debounce:function(n,s,r){var i;return function(){var t=this,e=arguments,a=r&&!i;clearTimeout(i),i=setTimeout(function(){i=null,r||s.apply(t,e)},n),a&&s.apply(t,e)}},createPaymentRequestButton:function(t,e){var a;if(wc_stripe_payment_request_params.button.is_custom&&(a=i(wc_stripe_payment_request_params.button.css_selector)).length)return a.data("isCustom",!0),a;if(wc_stripe_payment_request_params.button.is_branded){if(p.shouldUseGooglePayBrand())return(a=p.createGooglePayButton()).data("isBranded",!0),a;wc_stripe_payment_request_params.button.type="long"===wc_stripe_payment_request_params.button.branded_type?"buy":"default"}return t.create("paymentRequestButton",{paymentRequest:e,style:{paymentRequestButton:{type:wc_stripe_payment_request_params.button.type,theme:wc_stripe_payment_request_params.button.theme,height:wc_stripe_payment_request_params.button.height+"px"}}})},isCustomPaymentRequestButton:function(t){return t&&"function"==typeof t.data&&t.data("isCustom")},isBrandedPaymentRequestButton:function(t){return t&&"function"==typeof t.data&&t.data("isBranded")},shouldUseGooglePayBrand:function(){var t=window.navigator.userAgent.toLowerCase(),e=/chrome/.test(t)&&!/edge|edg|opr|brave\//.test(t)&&"Google Inc."===window.navigator.vendor,a=e&&window.navigator.brave;return e&&!a},createGooglePayButton:function(){var t=wc_stripe_payment_request_params.button.theme,e=wc_stripe_payment_request_params.button.branded_type,a=wc_stripe_payment_request_params.button.locale,n=wc_stripe_payment_request_params.button.height;t=["dark","light"].includes(t)?t:"light",e=["short","long"].includes(e)?e:"long";var s=i('<button type="button" id="wc-stripe-branded-button" aria-label="Google Pay" class="gpay-button"></button>');s.css("height",n+"px"),s.addClass(t+" "+e),"long"===e&&function(t,e,a){t.css("background-image","url("+e+")");var n=document.createElement("img");n.onerror=function(){t.css("background-image","url("+a+")")},n.src=e}(s,"https://www.gstatic.com/instantbuy/svg/"+t+"/"+a+".svg","https://www.gstatic.com/instantbuy/svg/"+t+"/en.svg");return s},attachPaymentRequestButtonEventListeners:function(t,e){wc_stripe_payment_request_params.is_product_page?p.attachProductPageEventListeners(t,e):p.attachCartPageEventListeners(t,e)},attachProductPageEventListeners:function(e,a){var n=[],s=i(".single_add_to_cart_button");e.on("click",function(t){return s.is(".disabled")?(t.preventDefault(),void(s.is(".wc-variation-is-unavailable")?window.alert(wc_add_to_cart_variation_params.i18n_unavailable_text):s.is(".wc-variation-selection-needed")&&window.alert(wc_add_to_cart_variation_params.i18n_make_a_selection_text))):0<n.length?(t.preventDefault(),void window.alert(n)):(p.addToCart(),void((p.isCustomPaymentRequestButton(e)||p.isBrandedPaymentRequestButton(e))&&(t.preventDefault(),a.show())))}),i(document.body).on("woocommerce_variation_has_changed",function(){p.blockPaymentRequestButton(e),i.when(p.getSelectedProductData()).then(function(t){i.when(a.update({total:t.total,displayItems:t.displayItems})).then(function(){p.unblockPaymentRequestButton(e)})})}),i(".quantity").on("input",".qty",function(){p.blockPaymentRequestButton(e)}),i(".quantity").on("input",".qty",p.debounce(250,function(){p.blockPaymentRequestButton(e),n=[],i.when(p.getSelectedProductData()).then(function(t){t.error?(n=[t.error],p.unblockPaymentRequestButton(e)):i.when(a.update({total:t.total,displayItems:t.displayItems})).then(function(){p.unblockPaymentRequestButton(e)})})}))},attachCartPageEventListeners:function(t,e){(wc_stripe_payment_request_params.button.is_custom&&p.isCustomPaymentRequestButton(t)||wc_stripe_payment_request_params.button.is_branded&&p.isBrandedPaymentRequestButton(t))&&t.on("click",function(t){t.preventDefault(),e.show()})},showPaymentRequestButton:function(t){p.isCustomPaymentRequestButton(t)?(t.addClass("is-active"),i("#wc-stripe-payment-request-wrapper, #wc-stripe-payment-request-button-separator").show()):p.isBrandedPaymentRequestButton(t)?(i("#wc-stripe-payment-request-wrapper, #wc-stripe-payment-request-button-separator").show(),i("#wc-stripe-payment-request-button").html(t)):i("#wc-stripe-payment-request-button").length&&(i("#wc-stripe-payment-request-wrapper, #wc-stripe-payment-request-button-separator").show(),t.mount("#wc-stripe-payment-request-button"))},blockPaymentRequestButton:function(t){i("#wc-stripe-payment-request-button").data("blockUI.isBlocked")||(i("#wc-stripe-payment-request-button").block({message:null}),p.isCustomPaymentRequestButton(t)&&t.addClass("is-blocked"))},unblockPaymentRequestButton:function(t){i("#wc-stripe-payment-request-button").unblock(),p.isCustomPaymentRequestButton(t)&&t.removeClass("is-blocked")},init:function(){wc_stripe_payment_request_params.is_product_page?p.startPaymentRequest(""):p.getCartDetails()}};p.init(),i(document.body).on("updated_cart_totals",function(){p.init()}),i(document.body).on("updated_checkout",function(){p.init()})});
1
+ jQuery(function(i){"use strict";var o,u=Stripe(wc_stripe_payment_request_params.stripe.key),p={getAjaxURL:function(t){return wc_stripe_payment_request_params.ajax_url.toString().replace("%%endpoint%%","wc_stripe_"+t)},getCartDetails:function(){var t={security:wc_stripe_payment_request_params.nonce.payment};i.ajax({type:"POST",data:t,url:p.getAjaxURL("get_cart_details"),success:function(t){p.startPaymentRequest(t)}})},getAttributes:function(){var t=i(".variations_form").find(".variations select"),a={},n=0,s=0;return t.each(function(){var t=i(this).data("attribute_name")||i(this).attr("name"),e=i(this).val()||"";0<e.length&&s++,n++,a[t]=e}),{count:n,chosenCount:s,data:a}},processSource:function(t,e){var a=p.getOrderData(t,e);return i.ajax({type:"POST",data:a,dataType:"json",url:p.getAjaxURL("create_order")})},getOrderData:function(t,e){var a=t.source,n=a.owner.email,s=a.owner.phone,r=a.owner.address,i=a.owner.name,o=t.shippingAddress,u={_wpnonce:wc_stripe_payment_request_params.nonce.checkout,billing_first_name:null!==i?i.split(" ").slice(0,1).join(" "):"",billing_last_name:null!==i?i.split(" ").slice(1).join(" "):"",billing_company:"",billing_email:null!==n?n:t.payerEmail,billing_phone:null!==s?s:t.payerPhone.replace("/[() -]/g",""),billing_country:null!==r?r.country:"",billing_address_1:null!==r?r.line1:"",billing_address_2:null!==r?r.line2:"",billing_city:null!==r?r.city:"",billing_state:null!==r?r.state:"",billing_postcode:null!==r?r.postal_code:"",shipping_first_name:"",shipping_last_name:"",shipping_company:"",shipping_country:"",shipping_address_1:"",shipping_address_2:"",shipping_city:"",shipping_state:"",shipping_postcode:"",shipping_method:[null===t.shippingOption?null:t.shippingOption.id],order_comments:"",payment_method:"stripe",ship_to_different_address:1,terms:1,stripe_source:a.id,payment_request_type:e};return o&&(u.shipping_first_name=o.recipient.split(" ").slice(0,1).join(" "),u.shipping_last_name=o.recipient.split(" ").slice(1).join(" "),u.shipping_company=o.organization,u.shipping_country=o.country,u.shipping_address_1=void 0===o.addressLine[0]?"":o.addressLine[0],u.shipping_address_2=void 0===o.addressLine[1]?"":o.addressLine[1],u.shipping_city=o.city,u.shipping_state=o.region,u.shipping_postcode=o.postalCode),u},getErrorMessageHTML:function(t){return i('<div class="woocommerce-error" />').text(t)},abortPayment:function(t,e){if(t.complete("fail"),i(".woocommerce-error").remove(),wc_stripe_payment_request_params.is_product_page){var a=i(".product");a.before(e),i("html, body").animate({scrollTop:a.prev(".woocommerce-error").offset().top},600)}else{var n=i(".shop_table.cart").closest("form");n.before(e),i("html, body").animate({scrollTop:n.prev(".woocommerce-error").offset().top},600)}},completePayment:function(t,e){p.block(),t.complete("success"),window.location=e},block:function(){i.blockUI({message:null,overlayCSS:{background:"#fff",opacity:.6}})},updateShippingOptions:function(t,e){var a={security:wc_stripe_payment_request_params.nonce.shipping,country:e.country,state:e.region,postcode:e.postalCode,city:e.city,address:void 0===e.addressLine[0]?"":e.addressLine[0],address_2:void 0===e.addressLine[1]?"":e.addressLine[1],payment_request_type:o,is_product_page:wc_stripe_payment_request_params.is_product_page};return i.ajax({type:"POST",data:a,url:p.getAjaxURL("get_shipping_options")})},updateShippingDetails:function(t,e){var a={security:wc_stripe_payment_request_params.nonce.update_shipping,shipping_method:[e.id],payment_request_type:o,is_product_page:wc_stripe_payment_request_params.is_product_page};return i.ajax({type:"POST",data:a,url:p.getAjaxURL("update_shipping_method")})},addToCart:function(){var t=i(".single_add_to_cart_button").val();i(".single_variation_wrap").length&&(t=i(".single_variation_wrap").find('input[name="product_id"]').val());var n={security:wc_stripe_payment_request_params.nonce.add_to_cart,product_id:t,qty:i(".quantity .qty").val(),attributes:i(".variations_form").length?p.getAttributes().data:[]},e=i("form.cart").serializeArray();return i.each(e,function(t,e){if(/^addon-/.test(e.name))if(/\[\]$/.test(e.name)){var a=e.name.substring(0,e.name.length-2);n[a]?n[a].push(e.value):n[a]=[e.value]}else n[e.name]=e.value}),i.ajax({type:"POST",data:n,url:p.getAjaxURL("add_to_cart")})},clearCart:function(){var t={security:wc_stripe_payment_request_params.nonce.clear_cart};return i.ajax({type:"POST",data:t,url:p.getAjaxURL("clear_cart"),success:function(t){}})},getRequestOptionsFromLocal:function(){return{total:wc_stripe_payment_request_params.product.total,currency:wc_stripe_payment_request_params.checkout.currency_code,country:wc_stripe_payment_request_params.checkout.country_code,requestPayerName:!0,requestPayerEmail:!0,requestPayerPhone:wc_stripe_payment_request_params.checkout.needs_payer_phone,requestShipping:wc_stripe_payment_request_params.product.requestShipping,displayItems:wc_stripe_payment_request_params.product.displayItems}},startPaymentRequest:function(t){var a,e;a=wc_stripe_payment_request_params.is_product_page?e=p.getRequestOptionsFromLocal():(e={total:t.order_data.total,currency:t.order_data.currency,country:t.order_data.country_code,requestPayerName:!0,requestPayerEmail:!0,requestPayerPhone:wc_stripe_payment_request_params.checkout.needs_payer_phone,requestShipping:!!t.shipping_required,displayItems:t.order_data.displayItems},t.order_data);var n=u.paymentRequest(e),s=u.elements({locale:wc_stripe_payment_request_params.button.locale}),r=p.createPaymentRequestButton(s,n);n.canMakePayment().then(function(t){t&&(o=t.applePay?"apple_pay":"payment_request_api",p.attachPaymentRequestButtonEventListeners(r,n),p.showPaymentRequestButton(r))}),n.on("shippingaddresschange",function(e){i.when(p.updateShippingOptions(a,e.shippingAddress)).then(function(t){e.updateWith({status:t.result,shippingOptions:t.shipping_options,total:t.total,displayItems:t.displayItems})})}),n.on("shippingoptionchange",function(e){i.when(p.updateShippingDetails(a,e.shippingOption)).then(function(t){"success"===t.result&&e.updateWith({status:"success",total:t.total,displayItems:t.displayItems}),"fail"===t.result&&e.updateWith({status:"fail"})})}),n.on("source",function(e){"no"===wc_stripe_payment_request_params.stripe.allow_prepaid_card&&"prepaid"===e.source.card.funding?p.abortPayment(e,p.getErrorMessageHTML(wc_stripe_payment_request_params.i18n.no_prepaid_card)):i.when(p.processSource(e,o)).then(function(t){"success"===t.result?p.completePayment(e,t.redirect):p.abortPayment(e,t.messages)})})},getSelectedProductData:function(){var t=i(".single_add_to_cart_button").val();i(".single_variation_wrap").length&&(t=i(".single_variation_wrap").find('input[name="product_id"]').val());var e=(i("#product-addons-total").data("price_data")||[]).reduce(function(t,e){return t+e.cost},0),a={security:wc_stripe_payment_request_params.nonce.get_selected_product_data,product_id:t,qty:i(".quantity .qty").val(),attributes:i(".variations_form").length?p.getAttributes().data:[],addon_value:e};return i.ajax({type:"POST",data:a,url:p.getAjaxURL("get_selected_product_data")})},debounce:function(n,s,r){var i;return function(){var t=this,e=arguments,a=r&&!i;clearTimeout(i),i=setTimeout(function(){i=null,r||s.apply(t,e)},n),a&&s.apply(t,e)}},createPaymentRequestButton:function(t,e){var a;if(wc_stripe_payment_request_params.button.is_custom&&(a=i(wc_stripe_payment_request_params.button.css_selector)).length)return a.data("isCustom",!0),a;if(wc_stripe_payment_request_params.button.is_branded){if(p.shouldUseGooglePayBrand())return(a=p.createGooglePayButton()).data("isBranded",!0),a;wc_stripe_payment_request_params.button.type="long"===wc_stripe_payment_request_params.button.branded_type?"buy":"default"}return t.create("paymentRequestButton",{paymentRequest:e,style:{paymentRequestButton:{type:wc_stripe_payment_request_params.button.type,theme:wc_stripe_payment_request_params.button.theme,height:wc_stripe_payment_request_params.button.height+"px"}}})},isCustomPaymentRequestButton:function(t){return t&&"function"==typeof t.data&&t.data("isCustom")},isBrandedPaymentRequestButton:function(t){return t&&"function"==typeof t.data&&t.data("isBranded")},shouldUseGooglePayBrand:function(){var t=window.navigator.userAgent.toLowerCase(),e=/chrome/.test(t)&&!/edge|edg|opr|brave\//.test(t)&&"Google Inc."===window.navigator.vendor,a=e&&window.navigator.brave;return e&&!a},createGooglePayButton:function(){var t=wc_stripe_payment_request_params.button.theme,e=wc_stripe_payment_request_params.button.branded_type,a=wc_stripe_payment_request_params.button.locale,n=wc_stripe_payment_request_params.button.height;t=["dark","light"].includes(t)?t:"light",e=["short","long"].includes(e)?e:"long";var s=i('<button type="button" id="wc-stripe-branded-button" aria-label="Google Pay" class="gpay-button"></button>');s.css("height",n+"px"),s.addClass(t+" "+e),"long"===e&&function(t,e,a){t.css("background-image","url("+e+")");var n=document.createElement("img");n.onerror=function(){t.css("background-image","url("+a+")")},n.src=e}(s,"https://www.gstatic.com/instantbuy/svg/"+t+"/"+a+".svg","https://www.gstatic.com/instantbuy/svg/"+t+"/en.svg");return s},attachPaymentRequestButtonEventListeners:function(t,e){wc_stripe_payment_request_params.is_product_page?p.attachProductPageEventListeners(t,e):p.attachCartPageEventListeners(t,e)},attachProductPageEventListeners:function(e,a){var n=[],s=i(".single_add_to_cart_button");e.on("click",function(t){return s.is(".disabled")?(t.preventDefault(),void(s.is(".wc-variation-is-unavailable")?window.alert(wc_add_to_cart_variation_params.i18n_unavailable_text):s.is(".wc-variation-selection-needed")&&window.alert(wc_add_to_cart_variation_params.i18n_make_a_selection_text))):0<n.length?(t.preventDefault(),void window.alert(n)):(p.addToCart(),void((p.isCustomPaymentRequestButton(e)||p.isBrandedPaymentRequestButton(e))&&(t.preventDefault(),a.show())))}),i(document.body).on("woocommerce_variation_has_changed",function(){p.blockPaymentRequestButton(e),i.when(p.getSelectedProductData()).then(function(t){i.when(a.update({total:t.total,displayItems:t.displayItems})).then(function(){p.unblockPaymentRequestButton(e)})})}),i(".quantity").on("input",".qty",function(){p.blockPaymentRequestButton(e)}),i(".quantity").on("input",".qty",p.debounce(250,function(){p.blockPaymentRequestButton(e),n=[],i.when(p.getSelectedProductData()).then(function(t){t.error?(n=[t.error],p.unblockPaymentRequestButton(e)):i.when(a.update({total:t.total,displayItems:t.displayItems})).then(function(){p.unblockPaymentRequestButton(e)})})}))},attachCartPageEventListeners:function(t,e){(wc_stripe_payment_request_params.button.is_custom&&p.isCustomPaymentRequestButton(t)||wc_stripe_payment_request_params.button.is_branded&&p.isBrandedPaymentRequestButton(t))&&t.on("click",function(t){t.preventDefault(),e.show()})},showPaymentRequestButton:function(t){p.isCustomPaymentRequestButton(t)?(t.addClass("is-active"),i("#wc-stripe-payment-request-wrapper, #wc-stripe-payment-request-button-separator").show()):p.isBrandedPaymentRequestButton(t)?(i("#wc-stripe-payment-request-wrapper, #wc-stripe-payment-request-button-separator").show(),i("#wc-stripe-payment-request-button").html(t)):i("#wc-stripe-payment-request-button").length&&(i("#wc-stripe-payment-request-wrapper, #wc-stripe-payment-request-button-separator").show(),t.mount("#wc-stripe-payment-request-button"))},blockPaymentRequestButton:function(t){i("#wc-stripe-payment-request-button").data("blockUI.isBlocked")||(i("#wc-stripe-payment-request-button").block({message:null}),p.isCustomPaymentRequestButton(t)&&t.addClass("is-blocked"))},unblockPaymentRequestButton:function(t){i("#wc-stripe-payment-request-button").unblock(),p.isCustomPaymentRequestButton(t)&&t.removeClass("is-blocked")},init:function(){wc_stripe_payment_request_params.is_product_page?p.startPaymentRequest(""):p.getCartDetails()}};p.init(),i(document.body).on("updated_cart_totals",function(){p.init()}),i(document.body).on("updated_checkout",function(){p.init()})});
assets/js/stripe.js CHANGED
@@ -634,10 +634,9 @@ jQuery( function( $ ) {
634
  */
635
  if ( wc_stripe_form.isSepaChosen() ) {
636
  if ( 'invalid_owner_name' === result.error.code && wc_stripe_params.hasOwnProperty( result.error.code ) ) {
637
- var error = '<ul class="woocommerce-error"><li /></ul>';
638
  error.find( 'li' ).text( wc_stripe_params[ result.error.code ] ); // Prevent XSS
639
-
640
- return wc_stripe_form.submitError( error );
641
  }
642
  }
643
 
634
  */
635
  if ( wc_stripe_form.isSepaChosen() ) {
636
  if ( 'invalid_owner_name' === result.error.code && wc_stripe_params.hasOwnProperty( result.error.code ) ) {
637
+ var error = $( '<div><ul class="woocommerce-error"><li /></ul></div>' );
638
  error.find( 'li' ).text( wc_stripe_params[ result.error.code ] ); // Prevent XSS
639
+ return wc_stripe_form.submitError( error.html() );
 
640
  }
641
  }
642
 
assets/js/stripe.min.js CHANGED
@@ -1 +1 @@
1
- jQuery(function(c){"use strict";try{var o=Stripe(wc_stripe_params.key)}catch(e){return void console.log(e)}var t,n,i,e=Object.keys(wc_stripe_params.elements_options).length?wc_stripe_params.elements_options:{},r=Object.keys(wc_stripe_params.sepa_elements_options).length?wc_stripe_params.sepa_elements_options:{},a=o.elements(e),s=a.create("iban",r),m={getAjaxURL:function(e){return wc_stripe_params.ajaxurl.toString().replace("%%endpoint%%","wc_stripe_"+e)},unmountElements:function(){"yes"===wc_stripe_params.inline_cc_form?t.unmount("#stripe-card-element"):(t.unmount("#stripe-card-element"),n.unmount("#stripe-exp-element"),i.unmount("#stripe-cvc-element"))},mountElements:function(){if(c("#stripe-card-element").length){if("yes"===wc_stripe_params.inline_cc_form)return t.mount("#stripe-card-element");t.mount("#stripe-card-element"),n.mount("#stripe-exp-element"),i.mount("#stripe-cvc-element")}},createElements:function(){var e={base:{iconColor:"#666EE8",color:"#31325F",fontSize:"15px","::placeholder":{color:"#CFD7E0"}}},r={focus:"focused",empty:"empty",invalid:"invalid"};e=wc_stripe_params.elements_styling?wc_stripe_params.elements_styling:e,r=wc_stripe_params.elements_classes?wc_stripe_params.elements_classes:r,"yes"===wc_stripe_params.inline_cc_form?(t=a.create("card",{style:e,hidePostalCode:!0})).addEventListener("change",function(e){m.onCCFormChange(),e.error&&c(document.body).trigger("stripeError",e)}):(t=a.create("cardNumber",{style:e,classes:r}),n=a.create("cardExpiry",{style:e,classes:r}),i=a.create("cardCvc",{style:e,classes:r}),t.addEventListener("change",function(e){m.onCCFormChange(),m.updateCardBrand(e.brand),e.error&&c(document.body).trigger("stripeError",e)}),n.addEventListener("change",function(e){m.onCCFormChange(),e.error&&c(document.body).trigger("stripeError",e)}),i.addEventListener("change",function(e){m.onCCFormChange(),e.error&&c(document.body).trigger("stripeError",e)})),"yes"===wc_stripe_params.is_checkout?c(document.body).on("updated_checkout",function(){c("#stripe-card-element").children().length||(t&&m.unmountElements(),m.mountElements(),c("#stripe-iban-element").length&&s.mount("#stripe-iban-element"))}):(c("form#add_payment_method").length||c("form#order_review").length)&&(m.mountElements(),c("#stripe-iban-element").length&&s.mount("#stripe-iban-element"))},updateCardBrand:function(e){var r={visa:"stripe-visa-brand",mastercard:"stripe-mastercard-brand",amex:"stripe-amex-brand",discover:"stripe-discover-brand",diners:"stripe-diners-brand",jcb:"stripe-jcb-brand",unknown:"stripe-credit-card-brand"},t=c(".stripe-card-brand"),n="stripe-credit-card-brand";e in r&&(n=r[e]),c.each(r,function(e,r){t.removeClass(r)}),t.addClass(n)},init:function(){"yes"!==wc_stripe_params.is_change_payment_page&&"yes"!==wc_stripe_params.is_pay_for_order_page||c(document.body).trigger("wc-credit-card-form-init"),c("form.woocommerce-checkout").length&&(this.form=c("form.woocommerce-checkout")),c("form.woocommerce-checkout").on("checkout_place_order_stripe checkout_place_order_stripe_bancontact checkout_place_order_stripe_sofort checkout_place_order_stripe_giropay checkout_place_order_stripe_ideal checkout_place_order_stripe_alipay checkout_place_order_stripe_sepa",this.onSubmit),c("form#order_review").length&&(this.form=c("form#order_review")),c("form#order_review, form#add_payment_method").on("submit",this.onSubmit),c("form#add_payment_method").length&&(this.form=c("form#add_payment_method")),c("form.woocommerce-checkout").on("change",this.reset),c(document).on("stripeError",this.onError).on("checkout_error",this.reset),s.on("change",this.onSepaError),c("#early_renewal_modal_submit").on("click",this.onEarlyRenewalSubmit),m.createElements(),window.addEventListener("hashchange",m.onHashChange),m.maybeConfirmIntent()},isStripeChosen:function(){return c("#payment_method_stripe, #payment_method_stripe_bancontact, #payment_method_stripe_sofort, #payment_method_stripe_giropay, #payment_method_stripe_ideal, #payment_method_stripe_alipay, #payment_method_stripe_sepa, #payment_method_stripe_eps, #payment_method_stripe_multibanco").is(":checked")||c("#payment_method_stripe").is(":checked")&&"new"===c('input[name="wc-stripe-payment-token"]:checked').val()||c("#payment_method_stripe_sepa").is(":checked")&&"new"===c('input[name="wc-stripe-payment-token"]:checked').val()},isStripeSaveCardChosen:function(){return c("#payment_method_stripe").is(":checked")&&c('input[name="wc-stripe-payment-token"]').is(":checked")&&"new"!==c('input[name="wc-stripe-payment-token"]:checked').val()||c("#payment_method_stripe_sepa").is(":checked")&&c('input[name="wc-stripe_sepa-payment-token"]').is(":checked")&&"new"!==c('input[name="wc-stripe_sepa-payment-token"]:checked').val()},isStripeCardChosen:function(){return c("#payment_method_stripe").is(":checked")},isBancontactChosen:function(){return c("#payment_method_stripe_bancontact").is(":checked")},isGiropayChosen:function(){return c("#payment_method_stripe_giropay").is(":checked")},isIdealChosen:function(){return c("#payment_method_stripe_ideal").is(":checked")},isSofortChosen:function(){return c("#payment_method_stripe_sofort").is(":checked")},isAlipayChosen:function(){return c("#payment_method_stripe_alipay").is(":checked")},isSepaChosen:function(){return c("#payment_method_stripe_sepa").is(":checked")},isP24Chosen:function(){return c("#payment_method_stripe_p24").is(":checked")},isEpsChosen:function(){return c("#payment_method_stripe_eps").is(":checked")},isMultibancoChosen:function(){return c("#payment_method_stripe_multibanco").is(":checked")},hasSource:function(){return 0<c("input.stripe-source").length},isMobile:function(){return!!/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)},block:function(){m.isMobile()||m.form.block({message:null,overlayCSS:{background:"#fff",opacity:.6}})},unblock:function(){m.form&&m.form.unblock()},getSelectedPaymentElement:function(){return c('.payment_methods input[name="payment_method"]:checked')},getOwnerDetails:function(){var e=c("#billing_first_name").length?c("#billing_first_name").val():wc_stripe_params.billing_first_name,r=c("#billing_last_name").length?c("#billing_last_name").val():wc_stripe_params.billing_last_name,t={name:"",address:{},email:"",phone:""};return t.name=e,t.name=e&&r?e+" "+r:c("#stripe-payment-data").data("full-name"),t.email=c("#billing_email").val(),t.phone=c("#billing_phone").val(),(void 0===t.phone||t.phone.length<=0)&&delete t.phone,(void 0===t.email||t.email.length<=0)&&(c("#stripe-payment-data").data("email").length?t.email=c("#stripe-payment-data").data("email"):delete t.email),(void 0===t.name||t.name.length<=0)&&delete t.name,t.address.line1=c("#billing_address_1").val()||wc_stripe_params.billing_address_1,t.address.line2=c("#billing_address_2").val()||wc_stripe_params.billing_address_2,t.address.state=c("#billing_state").val()||wc_stripe_params.billing_state,t.address.city=c("#billing_city").val()||wc_stripe_params.billing_city,t.address.postal_code=c("#billing_postcode").val()||wc_stripe_params.billing_postcode,t.address.country=c("#billing_country").val()||wc_stripe_params.billing_country,{owner:t}},createSource:function(){var e=m.getOwnerDetails();return m.isSepaChosen()?(e.currency=c("#stripe-sepa_debit-payment-data").data("currency"),e.mandate={notification_method:wc_stripe_params.sepa_mandate_notification},e.type="sepa_debit",o.createSource(s,e).then(m.sourceResponse)):o.createSource(t,e).then(m.sourceResponse)},sourceResponse:function(e){if(e.error)return c(document.body).trigger("stripeError",e);m.reset(),m.form.append(c('<input type="hidden" />').addClass("stripe-source").attr("name","stripe_source").val(e.source.id)),c("form#add_payment_method").length&&c(m.form).off("submit",m.form.onSubmit),m.form.submit()},onSubmit:function(){return!m.isStripeChosen()||(!(!m.isStripeSaveCardChosen()&&!m.hasSource())||(!!(m.isBancontactChosen()||m.isGiropayChosen()||m.isIdealChosen()||m.isAlipayChosen()||m.isSofortChosen()||m.isP24Chosen()||m.isEpsChosen()||m.isMultibancoChosen())||(m.block(),m.createSource(),!1)))},onCCFormChange:function(){m.reset()},reset:function(){c(".wc-stripe-error, .stripe-source").remove()},onSepaError:function(e){var r=m.getSelectedPaymentElement().parents("li").eq(0).find(".stripe-source-errors");if(!e.error)return c(r).html("");console.log(e.error.message),c(r).html('<ul class="woocommerce_error woocommerce-error wc-stripe-error"><li /></ul>'),c(r).find("li").text(e.error.message)},onError:function(e,r){var t,n=r.error.message,o=m.getSelectedPaymentElement().closest("li"),i=o.find(".woocommerce-SavedPaymentMethods-tokenInput");if(i.length){var a=i.filter(":checked");t=a.closest(".woocommerce-SavedPaymentMethods-new").length?c("#wc-stripe-cc-form .stripe-source-errors"):a.closest("li").find(".stripe-source-errors")}else t=o.find(".stripe-source-errors");if(m.isSepaChosen()&&"invalid_owner_name"===r.error.code&&wc_stripe_params.hasOwnProperty(r.error.code)){var s='<ul class="woocommerce-error"><li /></ul>';return s.find("li").text(wc_stripe_params[r.error.code]),m.submitError(s)}"email_invalid"===r.error.code?n=wc_stripe_params.email_invalid:"invalid_request_error"!==r.error.type&&"api_connection_error"!==r.error.type&&"api_error"!==r.error.type&&"authentication_error"!==r.error.type&&"rate_limit_error"!==r.error.type||(n=wc_stripe_params.invalid_request_error),"card_error"===r.error.type&&wc_stripe_params.hasOwnProperty(r.error.code)&&(n=wc_stripe_params[r.error.code]),"validation_error"===r.error.type&&wc_stripe_params.hasOwnProperty(r.error.code)&&(n=wc_stripe_params[r.error.code]),m.reset(),c(".woocommerce-NoticeGroup-checkout").remove(),console.log(r.error.message),c(t).html('<ul class="woocommerce_error woocommerce-error wc-stripe-error"><li /></ul>'),c(t).find("li").text(n),c(".wc-stripe-error").length&&c("html, body").animate({scrollTop:c(".wc-stripe-error").offset().top-200},200),m.unblock(),c.unblockUI()},submitError:function(e){c(".woocommerce-NoticeGroup-checkout, .woocommerce-error, .woocommerce-message").remove(),m.form.prepend('<div class="woocommerce-NoticeGroup woocommerce-NoticeGroup-checkout">'+e+"</div>"),m.form.removeClass("processing").unblock(),m.form.find(".input-text, select, input:checkbox").blur();var r="";c("#add_payment_method").length&&(r=c("#add_payment_method")),c("#order_review").length&&(r=c("#order_review")),c("form.checkout").length&&(r=c("form.checkout")),r.length&&c("html, body").animate({scrollTop:r.offset().top-100},500),c(document.body).trigger("checkout_error"),m.unblock()},onHashChange:function(){var e=window.location.hash.match(/^#?confirm-(pi|si)-([^:]+):(.+)$/);if(e&&!(e.length<4)){var r=e[1],t=e[2],n=decodeURIComponent(e[3]);window.location.hash="",m.openIntentModal(t,n,!1,"si"===r)}},maybeConfirmIntent:function(){if(c("#stripe-intent-id").length&&c("#stripe-intent-return").length){var e=c("#stripe-intent-id").val(),r=c("#stripe-intent-return").val();m.openIntentModal(e,r,!0,!1)}},openIntentModal:function(e,t,r,n){o[n?"handleCardSetup":"handleCardPayment"](e).then(function(e){if(e.error)throw e.error;var r=e[n?"setupIntent":"paymentIntent"];"requires_capture"!==r.status&&"succeeded"!==r.status||(window.location=t)}).catch(function(e){if(r)return window.location=t;c(document.body).trigger("stripeError",{error:e}),m.form&&m.form.removeClass("processing"),c.get(t+"&is_ajax")})},onEarlyRenewalSubmit:function(e){return e.preventDefault(),c.ajax({url:c("#early_renewal_modal_submit").attr("href"),method:"get",success:function(e){var r=c.parseJSON(e);r.stripe_sca_required?m.openIntentModal(r.intent_secret,r.redirect_url,!0,!1):window.location=r.redirect_url}}),!1}};m.init()});
1
+ jQuery(function(c){"use strict";try{var o=Stripe(wc_stripe_params.key)}catch(e){return void console.log(e)}var t,n,i,e=Object.keys(wc_stripe_params.elements_options).length?wc_stripe_params.elements_options:{},r=Object.keys(wc_stripe_params.sepa_elements_options).length?wc_stripe_params.sepa_elements_options:{},a=o.elements(e),s=a.create("iban",r),m={getAjaxURL:function(e){return wc_stripe_params.ajaxurl.toString().replace("%%endpoint%%","wc_stripe_"+e)},unmountElements:function(){"yes"===wc_stripe_params.inline_cc_form?t.unmount("#stripe-card-element"):(t.unmount("#stripe-card-element"),n.unmount("#stripe-exp-element"),i.unmount("#stripe-cvc-element"))},mountElements:function(){if(c("#stripe-card-element").length){if("yes"===wc_stripe_params.inline_cc_form)return t.mount("#stripe-card-element");t.mount("#stripe-card-element"),n.mount("#stripe-exp-element"),i.mount("#stripe-cvc-element")}},createElements:function(){var e={base:{iconColor:"#666EE8",color:"#31325F",fontSize:"15px","::placeholder":{color:"#CFD7E0"}}},r={focus:"focused",empty:"empty",invalid:"invalid"};e=wc_stripe_params.elements_styling?wc_stripe_params.elements_styling:e,r=wc_stripe_params.elements_classes?wc_stripe_params.elements_classes:r,"yes"===wc_stripe_params.inline_cc_form?(t=a.create("card",{style:e,hidePostalCode:!0})).addEventListener("change",function(e){m.onCCFormChange(),e.error&&c(document.body).trigger("stripeError",e)}):(t=a.create("cardNumber",{style:e,classes:r}),n=a.create("cardExpiry",{style:e,classes:r}),i=a.create("cardCvc",{style:e,classes:r}),t.addEventListener("change",function(e){m.onCCFormChange(),m.updateCardBrand(e.brand),e.error&&c(document.body).trigger("stripeError",e)}),n.addEventListener("change",function(e){m.onCCFormChange(),e.error&&c(document.body).trigger("stripeError",e)}),i.addEventListener("change",function(e){m.onCCFormChange(),e.error&&c(document.body).trigger("stripeError",e)})),"yes"===wc_stripe_params.is_checkout?c(document.body).on("updated_checkout",function(){c("#stripe-card-element").children().length||(t&&m.unmountElements(),m.mountElements(),c("#stripe-iban-element").length&&s.mount("#stripe-iban-element"))}):(c("form#add_payment_method").length||c("form#order_review").length)&&(m.mountElements(),c("#stripe-iban-element").length&&s.mount("#stripe-iban-element"))},updateCardBrand:function(e){var r={visa:"stripe-visa-brand",mastercard:"stripe-mastercard-brand",amex:"stripe-amex-brand",discover:"stripe-discover-brand",diners:"stripe-diners-brand",jcb:"stripe-jcb-brand",unknown:"stripe-credit-card-brand"},t=c(".stripe-card-brand"),n="stripe-credit-card-brand";e in r&&(n=r[e]),c.each(r,function(e,r){t.removeClass(r)}),t.addClass(n)},init:function(){"yes"!==wc_stripe_params.is_change_payment_page&&"yes"!==wc_stripe_params.is_pay_for_order_page||c(document.body).trigger("wc-credit-card-form-init"),c("form.woocommerce-checkout").length&&(this.form=c("form.woocommerce-checkout")),c("form.woocommerce-checkout").on("checkout_place_order_stripe checkout_place_order_stripe_bancontact checkout_place_order_stripe_sofort checkout_place_order_stripe_giropay checkout_place_order_stripe_ideal checkout_place_order_stripe_alipay checkout_place_order_stripe_sepa",this.onSubmit),c("form#order_review").length&&(this.form=c("form#order_review")),c("form#order_review, form#add_payment_method").on("submit",this.onSubmit),c("form#add_payment_method").length&&(this.form=c("form#add_payment_method")),c("form.woocommerce-checkout").on("change",this.reset),c(document).on("stripeError",this.onError).on("checkout_error",this.reset),s.on("change",this.onSepaError),c("#early_renewal_modal_submit").on("click",this.onEarlyRenewalSubmit),m.createElements(),window.addEventListener("hashchange",m.onHashChange),m.maybeConfirmIntent()},isStripeChosen:function(){return c("#payment_method_stripe, #payment_method_stripe_bancontact, #payment_method_stripe_sofort, #payment_method_stripe_giropay, #payment_method_stripe_ideal, #payment_method_stripe_alipay, #payment_method_stripe_sepa, #payment_method_stripe_eps, #payment_method_stripe_multibanco").is(":checked")||c("#payment_method_stripe").is(":checked")&&"new"===c('input[name="wc-stripe-payment-token"]:checked').val()||c("#payment_method_stripe_sepa").is(":checked")&&"new"===c('input[name="wc-stripe-payment-token"]:checked').val()},isStripeSaveCardChosen:function(){return c("#payment_method_stripe").is(":checked")&&c('input[name="wc-stripe-payment-token"]').is(":checked")&&"new"!==c('input[name="wc-stripe-payment-token"]:checked').val()||c("#payment_method_stripe_sepa").is(":checked")&&c('input[name="wc-stripe_sepa-payment-token"]').is(":checked")&&"new"!==c('input[name="wc-stripe_sepa-payment-token"]:checked').val()},isStripeCardChosen:function(){return c("#payment_method_stripe").is(":checked")},isBancontactChosen:function(){return c("#payment_method_stripe_bancontact").is(":checked")},isGiropayChosen:function(){return c("#payment_method_stripe_giropay").is(":checked")},isIdealChosen:function(){return c("#payment_method_stripe_ideal").is(":checked")},isSofortChosen:function(){return c("#payment_method_stripe_sofort").is(":checked")},isAlipayChosen:function(){return c("#payment_method_stripe_alipay").is(":checked")},isSepaChosen:function(){return c("#payment_method_stripe_sepa").is(":checked")},isP24Chosen:function(){return c("#payment_method_stripe_p24").is(":checked")},isEpsChosen:function(){return c("#payment_method_stripe_eps").is(":checked")},isMultibancoChosen:function(){return c("#payment_method_stripe_multibanco").is(":checked")},hasSource:function(){return 0<c("input.stripe-source").length},isMobile:function(){return!!/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)},block:function(){m.isMobile()||m.form.block({message:null,overlayCSS:{background:"#fff",opacity:.6}})},unblock:function(){m.form&&m.form.unblock()},getSelectedPaymentElement:function(){return c('.payment_methods input[name="payment_method"]:checked')},getOwnerDetails:function(){var e=c("#billing_first_name").length?c("#billing_first_name").val():wc_stripe_params.billing_first_name,r=c("#billing_last_name").length?c("#billing_last_name").val():wc_stripe_params.billing_last_name,t={name:"",address:{},email:"",phone:""};return t.name=e,t.name=e&&r?e+" "+r:c("#stripe-payment-data").data("full-name"),t.email=c("#billing_email").val(),t.phone=c("#billing_phone").val(),(void 0===t.phone||t.phone.length<=0)&&delete t.phone,(void 0===t.email||t.email.length<=0)&&(c("#stripe-payment-data").data("email").length?t.email=c("#stripe-payment-data").data("email"):delete t.email),(void 0===t.name||t.name.length<=0)&&delete t.name,t.address.line1=c("#billing_address_1").val()||wc_stripe_params.billing_address_1,t.address.line2=c("#billing_address_2").val()||wc_stripe_params.billing_address_2,t.address.state=c("#billing_state").val()||wc_stripe_params.billing_state,t.address.city=c("#billing_city").val()||wc_stripe_params.billing_city,t.address.postal_code=c("#billing_postcode").val()||wc_stripe_params.billing_postcode,t.address.country=c("#billing_country").val()||wc_stripe_params.billing_country,{owner:t}},createSource:function(){var e=m.getOwnerDetails();return m.isSepaChosen()?(e.currency=c("#stripe-sepa_debit-payment-data").data("currency"),e.mandate={notification_method:wc_stripe_params.sepa_mandate_notification},e.type="sepa_debit",o.createSource(s,e).then(m.sourceResponse)):o.createSource(t,e).then(m.sourceResponse)},sourceResponse:function(e){if(e.error)return c(document.body).trigger("stripeError",e);m.reset(),m.form.append(c('<input type="hidden" />').addClass("stripe-source").attr("name","stripe_source").val(e.source.id)),c("form#add_payment_method").length&&c(m.form).off("submit",m.form.onSubmit),m.form.submit()},onSubmit:function(){return!m.isStripeChosen()||(!(!m.isStripeSaveCardChosen()&&!m.hasSource())||(!!(m.isBancontactChosen()||m.isGiropayChosen()||m.isIdealChosen()||m.isAlipayChosen()||m.isSofortChosen()||m.isP24Chosen()||m.isEpsChosen()||m.isMultibancoChosen())||(m.block(),m.createSource(),!1)))},onCCFormChange:function(){m.reset()},reset:function(){c(".wc-stripe-error, .stripe-source").remove()},onSepaError:function(e){var r=m.getSelectedPaymentElement().parents("li").eq(0).find(".stripe-source-errors");if(!e.error)return c(r).html("");console.log(e.error.message),c(r).html('<ul class="woocommerce_error woocommerce-error wc-stripe-error"><li /></ul>'),c(r).find("li").text(e.error.message)},onError:function(e,r){var t,n=r.error.message,o=m.getSelectedPaymentElement().closest("li"),i=o.find(".woocommerce-SavedPaymentMethods-tokenInput");if(i.length){var a=i.filter(":checked");t=a.closest(".woocommerce-SavedPaymentMethods-new").length?c("#wc-stripe-cc-form .stripe-source-errors"):a.closest("li").find(".stripe-source-errors")}else t=o.find(".stripe-source-errors");if(m.isSepaChosen()&&"invalid_owner_name"===r.error.code&&wc_stripe_params.hasOwnProperty(r.error.code)){var s=c('<div><ul class="woocommerce-error"><li /></ul></div>');return s.find("li").text(wc_stripe_params[r.error.code]),m.submitError(s.html())}"email_invalid"===r.error.code?n=wc_stripe_params.email_invalid:"invalid_request_error"!==r.error.type&&"api_connection_error"!==r.error.type&&"api_error"!==r.error.type&&"authentication_error"!==r.error.type&&"rate_limit_error"!==r.error.type||(n=wc_stripe_params.invalid_request_error),"card_error"===r.error.type&&wc_stripe_params.hasOwnProperty(r.error.code)&&(n=wc_stripe_params[r.error.code]),"validation_error"===r.error.type&&wc_stripe_params.hasOwnProperty(r.error.code)&&(n=wc_stripe_params[r.error.code]),m.reset(),c(".woocommerce-NoticeGroup-checkout").remove(),console.log(r.error.message),c(t).html('<ul class="woocommerce_error woocommerce-error wc-stripe-error"><li /></ul>'),c(t).find("li").text(n),c(".wc-stripe-error").length&&c("html, body").animate({scrollTop:c(".wc-stripe-error").offset().top-200},200),m.unblock(),c.unblockUI()},submitError:function(e){c(".woocommerce-NoticeGroup-checkout, .woocommerce-error, .woocommerce-message").remove(),m.form.prepend('<div class="woocommerce-NoticeGroup woocommerce-NoticeGroup-checkout">'+e+"</div>"),m.form.removeClass("processing").unblock(),m.form.find(".input-text, select, input:checkbox").blur();var r="";c("#add_payment_method").length&&(r=c("#add_payment_method")),c("#order_review").length&&(r=c("#order_review")),c("form.checkout").length&&(r=c("form.checkout")),r.length&&c("html, body").animate({scrollTop:r.offset().top-100},500),c(document.body).trigger("checkout_error"),m.unblock()},onHashChange:function(){var e=window.location.hash.match(/^#?confirm-(pi|si)-([^:]+):(.+)$/);if(e&&!(e.length<4)){var r=e[1],t=e[2],n=decodeURIComponent(e[3]);window.location.hash="",m.openIntentModal(t,n,!1,"si"===r)}},maybeConfirmIntent:function(){if(c("#stripe-intent-id").length&&c("#stripe-intent-return").length){var e=c("#stripe-intent-id").val(),r=c("#stripe-intent-return").val();m.openIntentModal(e,r,!0,!1)}},openIntentModal:function(e,t,r,n){o[n?"handleCardSetup":"handleCardPayment"](e).then(function(e){if(e.error)throw e.error;var r=e[n?"setupIntent":"paymentIntent"];"requires_capture"!==r.status&&"succeeded"!==r.status||(window.location=t)}).catch(function(e){if(r)return window.location=t;c(document.body).trigger("stripeError",{error:e}),m.form&&m.form.removeClass("processing"),c.get(t+"&is_ajax")})},onEarlyRenewalSubmit:function(e){return e.preventDefault(),c.ajax({url:c("#early_renewal_modal_submit").attr("href"),method:"get",success:function(e){var r=c.parseJSON(e);r.stripe_sca_required?m.openIntentModal(r.intent_secret,r.redirect_url,!0,!1):window.location=r.redirect_url}}),!1}};m.init()});
changelog.txt CHANGED
@@ -1,5 +1,14 @@
1
  *** Changelog ***
2
 
 
 
 
 
 
 
 
 
 
3
  = 4.5.2 - 2020-08-19 =
4
  * Fix - Allow extension to attempt to run in all countries, not just officially supported ones
5
 
1
  *** Changelog ***
2
 
3
+ = 4.5.3 - 2020-10-06 =
4
+ * Fix - Apple Pay now requires a buyer's phone number only if it's required in Appearance > Customize > WooCommerce > Checkout.
5
+ * Add - Allow toggling secrets temporarily to visible in settings.
6
+ * Fix - Properly display field required error when SEPA method is used.
7
+ * Tweak - Update payment request button description to include link to Stripe dashboard Apple Pay settings.
8
+ * Add - Add off session payment intent filter, props rfair404.
9
+ * Tweak - Update contributors list.
10
+ * Add - Link from Payment Request button setting to Apple Pay settings in Stripe dashboard.
11
+
12
  = 4.5.2 - 2020-08-19 =
13
  * Fix - Allow extension to attempt to run in all countries, not just officially supported ones
14
 
includes/abstracts/abstract-wc-stripe-payment-gateway.php CHANGED
@@ -1379,6 +1379,16 @@ abstract class WC_Stripe_Payment_Gateway extends WC_Payment_Gateway_CC {
1379
  if ( isset( $full_request['source'] ) ) {
1380
  $request['source'] = $full_request['source'];
1381
  }
 
 
 
 
 
 
 
 
 
 
1382
 
1383
  $level3_data = $this->get_level3_data_from_order( $order );
1384
  $intent = WC_Stripe_API::request_with_level3_data(
1379
  if ( isset( $full_request['source'] ) ) {
1380
  $request['source'] = $full_request['source'];
1381
  }
1382
+
1383
+ /**
1384
+ * Filter the value of the request.
1385
+ *
1386
+ * @since 4.5.0
1387
+ * @param array $request
1388
+ * @param WC_Order $order
1389
+ * @param object $source
1390
+ */
1391
+ $request = apply_filters('wc_stripe_generate_create_intent_request', $request, $order, $prepared_source );
1392
 
1393
  $level3_data = $this->get_level3_data_from_order( $order );
1394
  $intent = WC_Stripe_API::request_with_level3_data(
includes/admin/stripe-settings.php CHANGED
@@ -107,8 +107,15 @@ return apply_filters(
107
  ),
108
  'payment_request' => array(
109
  'title' => __( 'Payment Request Buttons', 'woocommerce-gateway-stripe' ),
110
- /* translators: 1) br tag 2) opening anchor tag 3) closing anchor tag */
111
- 'label' => sprintf( __( 'Enable Payment Request Buttons. (Apple Pay/Chrome Payment Request API) %1$sBy using Apple Pay, you agree to %2$s and %3$s\'s terms of service.', 'woocommerce-gateway-stripe' ), '<br />', '<a href="https://stripe.com/apple-pay/legal" target="_blank">Stripe</a>', '<a href="https://developer.apple.com/apple-pay/acceptable-use-guidelines-for-websites/" target="_blank">Apple</a>' ),
 
 
 
 
 
 
 
112
  'type' => 'checkbox',
113
  'description' => __( 'If enabled, users will be able to pay using Apple Pay or Chrome Payment Request if supported by the browser.', 'woocommerce-gateway-stripe' ),
114
  'default' => 'yes',
107
  ),
108
  'payment_request' => array(
109
  'title' => __( 'Payment Request Buttons', 'woocommerce-gateway-stripe' ),
110
+ 'label' => sprintf(
111
+ /* translators: 1) br tag 2) Stripe anchor tag 3) Apple anchor tag 4) Stripe dashboard opening anchor tag 5) Stripe dashboard closing anchor tag */
112
+ __( 'Enable Payment Request Buttons. (Apple Pay/Google Pay) %1$sBy using Apple Pay, you agree to %2$s and %3$s\'s terms of service. %4$sLog into your Stripe dashboard%5$s to complete or update your Apple Pay setup.', 'woocommerce-gateway-stripe' ),
113
+ '<br />',
114
+ '<a href="https://stripe.com/apple-pay/legal" target="_blank">Stripe</a>',
115
+ '<a href="https://developer.apple.com/apple-pay/acceptable-use-guidelines-for-websites/" target="_blank">Apple</a>',
116
+ '<a href="https://dashboard.stripe.com/settings/payments/apple_pay" target="_blank">',
117
+ '</a>'
118
+ ),
119
  'type' => 'checkbox',
120
  'description' => __( 'If enabled, users will be able to pay using Apple Pay or Chrome Payment Request if supported by the browser.', 'woocommerce-gateway-stripe' ),
121
  'default' => 'yes',
includes/class-wc-stripe-apple-pay-registration.php CHANGED
@@ -38,13 +38,6 @@ class WC_Stripe_Apple_Pay_Registration {
38
  */
39
  public $apple_pay_domain_set;
40
 
41
- /**
42
- * Testmode.
43
- *
44
- * @var bool
45
- */
46
- public $testmode;
47
-
48
  /**
49
  * Secret Key.
50
  *
@@ -60,15 +53,15 @@ class WC_Stripe_Apple_Pay_Registration {
60
  public $apple_pay_verify_notice;
61
 
62
  public function __construct() {
63
- add_action( 'woocommerce_stripe_updated', array( $this, 'update_verification_file' ) );
 
64
 
65
  $this->stripe_settings = get_option( 'woocommerce_stripe_settings', array() );
66
  $this->stripe_enabled = $this->get_option( 'enabled' );
67
  $this->payment_request = 'yes' === $this->get_option( 'payment_request', 'yes' );
68
  $this->apple_pay_domain_set = 'yes' === $this->get_option( 'apple_pay_domain_set', 'no' );
69
  $this->apple_pay_verify_notice = '';
70
- $this->testmode = 'yes' === $this->get_option( 'testmode', 'no' );
71
- $this->secret_key = $this->testmode ? $this->get_option( 'test_secret_key' ) : $this->get_option( 'secret_key' );
72
 
73
  if ( empty( $this->stripe_settings ) ) {
74
  return;
@@ -99,6 +92,17 @@ class WC_Stripe_Apple_Pay_Registration {
99
  return $default;
100
  }
101
 
 
 
 
 
 
 
 
 
 
 
 
102
  /**
103
  * Initializes Apple Pay process on settings page.
104
  *
@@ -113,7 +117,7 @@ class WC_Stripe_Apple_Pay_Registration {
113
  isset( $_GET['section'] ) && 'stripe' === $_GET['section'] &&
114
  $this->payment_request
115
  ) {
116
- $this->process_apple_pay_verification();
117
  }
118
  }
119
 
@@ -124,7 +128,7 @@ class WC_Stripe_Apple_Pay_Registration {
124
  * @version 3.1.0
125
  * @param string $secret_key
126
  */
127
- private function register_apple_pay_domain( $secret_key = '' ) {
128
  if ( empty( $secret_key ) ) {
129
  throw new Exception( __( 'Unable to verify domain - missing secret key.', 'woocommerce-gateway-stripe' ) );
130
  }
@@ -164,7 +168,7 @@ class WC_Stripe_Apple_Pay_Registration {
164
  }
165
 
166
  /**
167
- * Updates the Apple Pay domain verification file.
168
  *
169
  * @param bool $force True to create the file if it didn't exist, false for just updating the file if needed.
170
  *
@@ -172,7 +176,7 @@ class WC_Stripe_Apple_Pay_Registration {
172
  * @since 4.3.0
173
  * @return bool True on success, false on failure.
174
  */
175
- public function update_verification_file( $force = false ) {
176
  $path = untrailingslashit( $_SERVER['DOCUMENT_ROOT'] );
177
  $dir = '.well-known';
178
  $file = 'apple-developer-merchantid-domain-association';
@@ -206,8 +210,8 @@ class WC_Stripe_Apple_Pay_Registration {
206
  * @since 3.1.0
207
  * @version 3.1.0
208
  */
209
- public function process_apple_pay_verification() {
210
- if ( ! $this->update_verification_file( true ) ) {
211
  $this->stripe_settings['apple_pay_domain_set'] = 'no';
212
  update_option( 'woocommerce_stripe_settings', $this->stripe_settings );
213
  return;
@@ -216,7 +220,7 @@ class WC_Stripe_Apple_Pay_Registration {
216
  try {
217
  // At this point then the domain association folder and file should be available.
218
  // Proceed to verify/and or verify again.
219
- $this->register_apple_pay_domain( $this->secret_key );
220
 
221
  // No errors to this point, verification success!
222
  $this->stripe_settings['apple_pay_domain_set'] = 'yes';
@@ -235,6 +239,38 @@ class WC_Stripe_Apple_Pay_Registration {
235
  }
236
  }
237
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
238
  /**
239
  * Display any admin notices to the user.
240
  *
38
  */
39
  public $apple_pay_domain_set;
40
 
 
 
 
 
 
 
 
41
  /**
42
  * Secret Key.
43
  *
53
  public $apple_pay_verify_notice;
54
 
55
  public function __construct() {
56
+ add_action( 'woocommerce_stripe_updated', array( $this, 'verify_domain_if_needed' ) );
57
+ add_action( 'update_option_woocommerce_stripe_settings', array( $this, 'verify_domain_on_new_secret_key' ), 10, 2 );
58
 
59
  $this->stripe_settings = get_option( 'woocommerce_stripe_settings', array() );
60
  $this->stripe_enabled = $this->get_option( 'enabled' );
61
  $this->payment_request = 'yes' === $this->get_option( 'payment_request', 'yes' );
62
  $this->apple_pay_domain_set = 'yes' === $this->get_option( 'apple_pay_domain_set', 'no' );
63
  $this->apple_pay_verify_notice = '';
64
+ $this->secret_key = $this->get_secret_key();
 
65
 
66
  if ( empty( $this->stripe_settings ) ) {
67
  return;
92
  return $default;
93
  }
94
 
95
+ /**
96
+ * Gets the Stripe secret key for the current mode.
97
+ *
98
+ * @since 4.5.3
99
+ * @return string Secret key.
100
+ */
101
+ private function get_secret_key() {
102
+ $testmode = 'yes' === $this->get_option( 'testmode', 'no' );
103
+ return $testmode ? $this->get_option( 'test_secret_key' ) : $this->get_option( 'secret_key' );
104
+ }
105
+
106
  /**
107
  * Initializes Apple Pay process on settings page.
108
  *
117
  isset( $_GET['section'] ) && 'stripe' === $_GET['section'] &&
118
  $this->payment_request
119
  ) {
120
+ $this->verify_domain();
121
  }
122
  }
123
 
128
  * @version 3.1.0
129
  * @param string $secret_key
130
  */
131
+ private function register_domain_with_apple( $secret_key = '' ) {
132
  if ( empty( $secret_key ) ) {
133
  throw new Exception( __( 'Unable to verify domain - missing secret key.', 'woocommerce-gateway-stripe' ) );
134
  }
168
  }
169
 
170
  /**
171
+ * Updates the Apple Pay domain association file.
172
  *
173
  * @param bool $force True to create the file if it didn't exist, false for just updating the file if needed.
174
  *
176
  * @since 4.3.0
177
  * @return bool True on success, false on failure.
178
  */
179
+ public function update_domain_association_file( $force = false ) {
180
  $path = untrailingslashit( $_SERVER['DOCUMENT_ROOT'] );
181
  $dir = '.well-known';
182
  $file = 'apple-developer-merchantid-domain-association';
210
  * @since 3.1.0
211
  * @version 3.1.0
212
  */
213
+ public function verify_domain() {
214
+ if ( ! $this->update_domain_association_file( true ) ) {
215
  $this->stripe_settings['apple_pay_domain_set'] = 'no';
216
  update_option( 'woocommerce_stripe_settings', $this->stripe_settings );
217
  return;
220
  try {
221
  // At this point then the domain association folder and file should be available.
222
  // Proceed to verify/and or verify again.
223
+ $this->register_domain_with_apple( $this->secret_key );
224
 
225
  // No errors to this point, verification success!
226
  $this->stripe_settings['apple_pay_domain_set'] = 'yes';
239
  }
240
  }
241
 
242
+ /**
243
+ * Conditionally process the Apple Pay domain verification after a new secret key is set.
244
+ *
245
+ * @since 4.5.3
246
+ * @version 4.5.3
247
+ */
248
+ public function verify_domain_on_new_secret_key( $prev_settings, $settings ) {
249
+ $this->stripe_settings = $prev_settings;
250
+ $prev_secret_key = $this->get_secret_key();
251
+
252
+ $this->stripe_settings = $settings;
253
+ $this->secret_key = $this->get_secret_key();
254
+
255
+ if ( ! empty( $this->secret_key ) && $this->secret_key !== $prev_secret_key ) {
256
+ $this->verify_domain();
257
+ }
258
+ }
259
+
260
+ /**
261
+ * Process the Apple Pay domain verification if not already done - otherwise just update the file.
262
+ *
263
+ * @since 4.5.3
264
+ * @version 4.5.3
265
+ */
266
+ public function verify_domain_if_needed() {
267
+ if ( $this->apple_pay_domain_set ) {
268
+ $this->update_domain_association_file();
269
+ } else {
270
+ $this->verify_domain();
271
+ }
272
+ }
273
+
274
  /**
275
  * Display any admin notices to the user.
276
  *
includes/payment-methods/class-wc-stripe-payment-request.php CHANGED
@@ -61,16 +61,16 @@ class WC_Stripe_Payment_Request {
61
  /**
62
  * Initialize class actions.
63
  *
64
- * @since 3.0.0
65
  * @version 4.0.0
66
  */
67
  public function __construct() {
68
- self::$_this = $this;
69
- $this->stripe_settings = get_option( 'woocommerce_stripe_settings', array() );
70
- $this->testmode = ( ! empty( $this->stripe_settings['testmode'] ) && 'yes' === $this->stripe_settings['testmode'] ) ? true : false;
71
- $this->publishable_key = ! empty( $this->stripe_settings['publishable_key'] ) ? $this->stripe_settings['publishable_key'] : '';
72
- $this->secret_key = ! empty( $this->stripe_settings['secret_key'] ) ? $this->stripe_settings['secret_key'] : '';
73
- $this->total_label = ! empty( $this->stripe_settings['statement_descriptor'] ) ? WC_Stripe_Helper::clean_statement_descriptor( $this->stripe_settings['statement_descriptor'] ) : '';
74
 
75
  if ( $this->testmode ) {
76
  $this->publishable_key = ! empty( $this->stripe_settings['test_publishable_key'] ) ? $this->stripe_settings['test_publishable_key'] : '';
@@ -101,8 +101,8 @@ class WC_Stripe_Payment_Request {
101
  /**
102
  * Checks if keys are set and valid.
103
  *
104
- * @since 4.0.6
105
- * @return bool True if the keys are set *and* valid, false otherwise (for example, if keys are empty or the secret key was pasted as publishable key).
106
  */
107
  public function are_keys_set() {
108
  // NOTE: updates to this function should be added to are_keys_set()
@@ -119,7 +119,7 @@ class WC_Stripe_Payment_Request {
119
  /**
120
  * Get this instance.
121
  *
122
- * @since 4.0.6
123
  * @return class
124
  */
125
  public static function instance() {
@@ -130,7 +130,8 @@ class WC_Stripe_Payment_Request {
130
  * Sets the WC customer session if one is not set.
131
  * This is needed so nonces can be verified by AJAX Request.
132
  *
133
- * @since 4.0.0
 
134
  */
135
  public function set_session() {
136
  if ( ! is_product() || ( isset( WC()->session ) && WC()->session->has_session() ) ) {
@@ -143,8 +144,9 @@ class WC_Stripe_Payment_Request {
143
  /**
144
  * Initialize hooks.
145
  *
146
- * @since 4.0.0
147
  * @version 4.0.0
 
148
  */
149
  public function init() {
150
  add_action( 'wp_enqueue_scripts', array( $this, 'scripts' ) );
@@ -176,9 +178,9 @@ class WC_Stripe_Payment_Request {
176
  /**
177
  * Gets the button type.
178
  *
179
- * @since 4.0.0
180
  * @version 4.0.0
181
- * @return string
182
  */
183
  public function get_button_type() {
184
  return isset( $this->stripe_settings['payment_request_button_type'] ) ? $this->stripe_settings['payment_request_button_type'] : 'default';
@@ -187,9 +189,9 @@ class WC_Stripe_Payment_Request {
187
  /**
188
  * Gets the button theme.
189
  *
190
- * @since 4.0.0
191
  * @version 4.0.0
192
- * @return string
193
  */
194
  public function get_button_theme() {
195
  return isset( $this->stripe_settings['payment_request_button_theme'] ) ? $this->stripe_settings['payment_request_button_theme'] : 'dark';
@@ -198,9 +200,9 @@ class WC_Stripe_Payment_Request {
198
  /**
199
  * Gets the button height.
200
  *
201
- * @since 4.0.0
202
  * @version 4.0.0
203
- * @return string
204
  */
205
  public function get_button_height() {
206
  return isset( $this->stripe_settings['payment_request_button_height'] ) ? str_replace( 'px', '', $this->stripe_settings['payment_request_button_height'] ) : '64';
@@ -209,9 +211,9 @@ class WC_Stripe_Payment_Request {
209
  /**
210
  * Checks if the button is branded.
211
  *
212
- * @since 4.4.0
213
  * @version 4.4.0
214
- * @return bool
215
  */
216
  public function is_branded_button() {
217
  return 'branded' === $this->get_button_type();
@@ -220,9 +222,9 @@ class WC_Stripe_Payment_Request {
220
  /**
221
  * Gets the branded button type.
222
  *
223
- * @since 4.4.0
224
  * @version 4.4.0
225
- * @return string
226
  */
227
  public function get_button_branded_type() {
228
  return isset( $this->stripe_settings['payment_request_button_branded_type'] ) ? $this->stripe_settings['payment_request_button_branded_type'] : 'default';
@@ -231,9 +233,9 @@ class WC_Stripe_Payment_Request {
231
  /**
232
  * Checks if the button is custom.
233
  *
234
- * @since 4.4.0
235
  * @version 4.4.0
236
- * @return bool
237
  */
238
  public function is_custom_button() {
239
  return 'custom' === $this->get_button_type();
@@ -242,9 +244,9 @@ class WC_Stripe_Payment_Request {
242
  /**
243
  * Returns custom button css selector.
244
  *
245
- * @since 4.4.0
246
  * @version 4.4.0
247
- * @return string
248
  */
249
  public function custom_button_selector() {
250
  return $this->is_custom_button() ? '#wc-stripe-custom-button' : '';
@@ -253,9 +255,9 @@ class WC_Stripe_Payment_Request {
253
  /**
254
  * Gets the custom button label.
255
  *
256
- * @since 4.4.0
257
  * @version 4.4.0
258
- * @return string
259
  */
260
  public function get_button_label() {
261
  return isset( $this->stripe_settings['payment_request_button_label'] ) ? $this->stripe_settings['payment_request_button_label'] : 'Buy now';
@@ -264,8 +266,9 @@ class WC_Stripe_Payment_Request {
264
  /**
265
  * Gets the product data for the currently viewed page
266
  *
267
- * @since 4.0.0
268
  * @version 4.0.0
 
269
  */
270
  public function get_product_data() {
271
  if ( ! is_product() ) {
@@ -334,7 +337,6 @@ class WC_Stripe_Payment_Request {
334
 
335
  /**
336
  * Filters the gateway title to reflect Payment Request type
337
- *
338
  */
339
  public function filter_gateway_title( $title, $id ) {
340
  global $post;
@@ -360,7 +362,7 @@ class WC_Stripe_Payment_Request {
360
  /**
361
  * Removes postal code validation from WC.
362
  *
363
- * @since 3.1.4
364
  * @version 4.0.0
365
  */
366
  public function postal_code_validation( $valid, $postcode, $country ) {
@@ -392,10 +394,12 @@ class WC_Stripe_Payment_Request {
392
  /**
393
  * Add needed order meta
394
  *
395
- * @since 4.0.0
 
 
 
396
  * @version 4.0.0
397
- * @param int $order_id
398
- * @param array $posted_data The posted data from checkout form.
399
  */
400
  public function add_order_meta( $order_id, $posted_data ) {
401
  if ( empty( $_POST['payment_request_type'] ) ) {
@@ -420,9 +424,9 @@ class WC_Stripe_Payment_Request {
420
  /**
421
  * Checks to make sure product type is supported.
422
  *
423
- * @since 3.1.0
424
  * @version 4.0.0
425
- * @return array
426
  */
427
  public function supported_product_types() {
428
  return apply_filters(
@@ -445,9 +449,9 @@ class WC_Stripe_Payment_Request {
445
  /**
446
  * Checks the cart to see if all items are allowed to used.
447
  *
448
- * @since 3.1.4
449
  * @version 4.0.0
450
- * @return bool
451
  */
452
  public function allowed_items_in_cart() {
453
  foreach ( WC()->cart->get_cart() as $cart_item_key => $cart_item ) {
@@ -474,7 +478,7 @@ class WC_Stripe_Payment_Request {
474
  /**
475
  * Load public scripts and styles.
476
  *
477
- * @since 3.1.0
478
  * @version 4.0.0
479
  */
480
  public function scripts() {
@@ -522,10 +526,12 @@ class WC_Stripe_Payment_Request {
522
  'unknown_shipping' => __( 'Unknown shipping option "[option]".', 'woocommerce-gateway-stripe' ),
523
  ),
524
  'checkout' => array(
525
- 'url' => wc_get_checkout_url(),
526
- 'currency_code' => strtolower( get_woocommerce_currency() ),
527
- 'country_code' => substr( get_option( 'woocommerce_default_country' ), 0, 2 ),
528
- 'needs_shipping' => WC()->cart->needs_shipping() ? 'yes' : 'no',
 
 
529
  ),
530
  'button' => array(
531
  'type' => $this->get_button_type(),
@@ -557,7 +563,7 @@ class WC_Stripe_Payment_Request {
557
  /**
558
  * Display the payment request button.
559
  *
560
- * @since 4.0.0
561
  * @version 4.0.0
562
  */
563
  public function display_payment_request_button_html() {
@@ -602,7 +608,7 @@ class WC_Stripe_Payment_Request {
602
  /**
603
  * Display payment request button separator.
604
  *
605
- * @since 4.0.0
606
  * @version 4.0.0
607
  */
608
  public function display_payment_request_button_separator_html() {
@@ -635,9 +641,8 @@ class WC_Stripe_Payment_Request {
635
  /**
636
  * Whether payment button html should be rendered on the Cart
637
  *
638
- * @since 4.4.1
639
- *
640
- * @return bool
641
  */
642
  private function should_show_payment_button_on_cart() {
643
  if ( ! apply_filters( 'wc_stripe_show_payment_request_on_cart', true ) ) {
@@ -653,9 +658,8 @@ class WC_Stripe_Payment_Request {
653
  /**
654
  * Whether payment button html should be rendered
655
  *
656
- * @since 4.3.2
657
- *
658
- * @return bool
659
  */
660
  private function should_show_payment_button_on_product_page() {
661
  global $post;
@@ -697,7 +701,7 @@ class WC_Stripe_Payment_Request {
697
  /**
698
  * Log errors coming from Payment Request
699
  *
700
- * @since 3.1.4
701
  * @version 4.0.0
702
  */
703
  public function ajax_log_errors() {
@@ -713,7 +717,7 @@ class WC_Stripe_Payment_Request {
713
  /**
714
  * Clears cart.
715
  *
716
- * @since 3.1.4
717
  * @version 4.0.0
718
  */
719
  public function ajax_clear_cart() {
@@ -782,8 +786,8 @@ class WC_Stripe_Payment_Request {
782
  /**
783
  * Gets shipping options available for specified shipping address
784
  *
785
- * @param array $shipping_address Shipping address.
786
- * @param bool $itemized_display_items Indicates whether to show subtotals or itemized views.
787
  *
788
  * @return array Shipping options data.
789
  * phpcs:ignore Squiz.Commenting.FunctionCommentThrowTag
@@ -899,9 +903,9 @@ class WC_Stripe_Payment_Request {
899
  /**
900
  * Gets the selected product data.
901
  *
902
- * @since 4.0.0
903
  * @version 4.0.0
904
- * @return array $data
905
  */
906
  public function ajax_get_selected_product_data() {
907
  check_ajax_referer( 'wc-stripe-get-selected-product-data', 'security' );
@@ -993,9 +997,9 @@ class WC_Stripe_Payment_Request {
993
  /**
994
  * Adds the current product to the cart. Used on product detail page.
995
  *
996
- * @since 4.0.0
997
  * @version 4.0.0
998
- * @return array $data
999
  */
1000
  public function ajax_add_to_cart() {
1001
  check_ajax_referer( 'wc-stripe-add-to-cart', 'security' );
@@ -1042,7 +1046,7 @@ class WC_Stripe_Payment_Request {
1042
  * what WC is expecting and throws an error. An example
1043
  * for Ireland the county dropdown in Chrome shows "Co. Clare" format
1044
  *
1045
- * @since 4.0.0
1046
  * @version 4.0.0
1047
  */
1048
  public function normalize_state() {
@@ -1081,7 +1085,7 @@ class WC_Stripe_Payment_Request {
1081
  /**
1082
  * Create order. Security is handled by WC.
1083
  *
1084
- * @since 3.1.0
1085
  * @version 4.0.0
1086
  */
1087
  public function ajax_create_order() {
@@ -1103,9 +1107,10 @@ class WC_Stripe_Payment_Request {
1103
  /**
1104
  * Calculate and set shipping method.
1105
  *
1106
- * @since 3.1.0
 
 
1107
  * @version 4.0.0
1108
- * @param array $address
1109
  */
1110
  protected function calculate_shipping( $address = array() ) {
1111
  $country = $address['country'];
@@ -1170,7 +1175,7 @@ class WC_Stripe_Payment_Request {
1170
  /**
1171
  * Builds the shippings methods to pass to Payment Request
1172
  *
1173
- * @since 3.1.0
1174
  * @version 4.0.0
1175
  */
1176
  protected function build_shipping_methods( $shipping_methods ) {
@@ -1195,7 +1200,7 @@ class WC_Stripe_Payment_Request {
1195
  /**
1196
  * Builds the line items to pass to Payment Request
1197
  *
1198
- * @since 3.1.0
1199
  * @version 4.0.0
1200
  */
1201
  protected function build_display_items( $itemized_display_items = false ) {
61
  /**
62
  * Initialize class actions.
63
  *
64
+ * @since 3.0.0
65
  * @version 4.0.0
66
  */
67
  public function __construct() {
68
+ self::$_this = $this;
69
+ $this->stripe_settings = get_option( 'woocommerce_stripe_settings', array() );
70
+ $this->testmode = ( ! empty( $this->stripe_settings['testmode'] ) && 'yes' === $this->stripe_settings['testmode'] ) ? true : false;
71
+ $this->publishable_key = ! empty( $this->stripe_settings['publishable_key'] ) ? $this->stripe_settings['publishable_key'] : '';
72
+ $this->secret_key = ! empty( $this->stripe_settings['secret_key'] ) ? $this->stripe_settings['secret_key'] : '';
73
+ $this->total_label = ! empty( $this->stripe_settings['statement_descriptor'] ) ? WC_Stripe_Helper::clean_statement_descriptor( $this->stripe_settings['statement_descriptor'] ) : '';
74
 
75
  if ( $this->testmode ) {
76
  $this->publishable_key = ! empty( $this->stripe_settings['test_publishable_key'] ) ? $this->stripe_settings['test_publishable_key'] : '';
101
  /**
102
  * Checks if keys are set and valid.
103
  *
104
+ * @since 4.0.6
105
+ * @return boolean True if the keys are set *and* valid, false otherwise (for example, if keys are empty or the secret key was pasted as publishable key).
106
  */
107
  public function are_keys_set() {
108
  // NOTE: updates to this function should be added to are_keys_set()
119
  /**
120
  * Get this instance.
121
  *
122
+ * @since 4.0.6
123
  * @return class
124
  */
125
  public static function instance() {
130
  * Sets the WC customer session if one is not set.
131
  * This is needed so nonces can be verified by AJAX Request.
132
  *
133
+ * @since 4.0.0
134
+ * @return void
135
  */
136
  public function set_session() {
137
  if ( ! is_product() || ( isset( WC()->session ) && WC()->session->has_session() ) ) {
144
  /**
145
  * Initialize hooks.
146
  *
147
+ * @since 4.0.0
148
  * @version 4.0.0
149
+ * @return void
150
  */
151
  public function init() {
152
  add_action( 'wp_enqueue_scripts', array( $this, 'scripts' ) );
178
  /**
179
  * Gets the button type.
180
  *
181
+ * @since 4.0.0
182
  * @version 4.0.0
183
+ * @return string
184
  */
185
  public function get_button_type() {
186
  return isset( $this->stripe_settings['payment_request_button_type'] ) ? $this->stripe_settings['payment_request_button_type'] : 'default';
189
  /**
190
  * Gets the button theme.
191
  *
192
+ * @since 4.0.0
193
  * @version 4.0.0
194
+ * @return string
195
  */
196
  public function get_button_theme() {
197
  return isset( $this->stripe_settings['payment_request_button_theme'] ) ? $this->stripe_settings['payment_request_button_theme'] : 'dark';
200
  /**
201
  * Gets the button height.
202
  *
203
+ * @since 4.0.0
204
  * @version 4.0.0
205
+ * @return string
206
  */
207
  public function get_button_height() {
208
  return isset( $this->stripe_settings['payment_request_button_height'] ) ? str_replace( 'px', '', $this->stripe_settings['payment_request_button_height'] ) : '64';
211
  /**
212
  * Checks if the button is branded.
213
  *
214
+ * @since 4.4.0
215
  * @version 4.4.0
216
+ * @return boolean
217
  */
218
  public function is_branded_button() {
219
  return 'branded' === $this->get_button_type();
222
  /**
223
  * Gets the branded button type.
224
  *
225
+ * @since 4.4.0
226
  * @version 4.4.0
227
+ * @return string
228
  */
229
  public function get_button_branded_type() {
230
  return isset( $this->stripe_settings['payment_request_button_branded_type'] ) ? $this->stripe_settings['payment_request_button_branded_type'] : 'default';
233
  /**
234
  * Checks if the button is custom.
235
  *
236
+ * @since 4.4.0
237
  * @version 4.4.0
238
+ * @return boolean
239
  */
240
  public function is_custom_button() {
241
  return 'custom' === $this->get_button_type();
244
  /**
245
  * Returns custom button css selector.
246
  *
247
+ * @since 4.4.0
248
  * @version 4.4.0
249
+ * @return string
250
  */
251
  public function custom_button_selector() {
252
  return $this->is_custom_button() ? '#wc-stripe-custom-button' : '';
255
  /**
256
  * Gets the custom button label.
257
  *
258
+ * @since 4.4.0
259
  * @version 4.4.0
260
+ * @return string
261
  */
262
  public function get_button_label() {
263
  return isset( $this->stripe_settings['payment_request_button_label'] ) ? $this->stripe_settings['payment_request_button_label'] : 'Buy now';
266
  /**
267
  * Gets the product data for the currently viewed page
268
  *
269
+ * @since 4.0.0
270
  * @version 4.0.0
271
+ * @return mixed Returns false if not on a product page, the product information otherwise.
272
  */
273
  public function get_product_data() {
274
  if ( ! is_product() ) {
337
 
338
  /**
339
  * Filters the gateway title to reflect Payment Request type
 
340
  */
341
  public function filter_gateway_title( $title, $id ) {
342
  global $post;
362
  /**
363
  * Removes postal code validation from WC.
364
  *
365
+ * @since 3.1.4
366
  * @version 4.0.0
367
  */
368
  public function postal_code_validation( $valid, $postcode, $country ) {
394
  /**
395
  * Add needed order meta
396
  *
397
+ * @param integer $order_id The order ID.
398
+ * @param array $posted_data The posted data from checkout form.
399
+ *
400
+ * @since 4.0.0
401
  * @version 4.0.0
402
+ * @return void
 
403
  */
404
  public function add_order_meta( $order_id, $posted_data ) {
405
  if ( empty( $_POST['payment_request_type'] ) ) {
424
  /**
425
  * Checks to make sure product type is supported.
426
  *
427
+ * @since 3.1.0
428
  * @version 4.0.0
429
+ * @return array
430
  */
431
  public function supported_product_types() {
432
  return apply_filters(
449
  /**
450
  * Checks the cart to see if all items are allowed to used.
451
  *
452
+ * @since 3.1.4
453
  * @version 4.0.0
454
+ * @return boolean
455
  */
456
  public function allowed_items_in_cart() {
457
  foreach ( WC()->cart->get_cart() as $cart_item_key => $cart_item ) {
478
  /**
479
  * Load public scripts and styles.
480
  *
481
+ * @since 3.1.0
482
  * @version 4.0.0
483
  */
484
  public function scripts() {
526
  'unknown_shipping' => __( 'Unknown shipping option "[option]".', 'woocommerce-gateway-stripe' ),
527
  ),
528
  'checkout' => array(
529
+ 'url' => wc_get_checkout_url(),
530
+ 'currency_code' => strtolower( get_woocommerce_currency() ),
531
+ 'country_code' => substr( get_option( 'woocommerce_default_country' ), 0, 2 ),
532
+ 'needs_shipping' => WC()->cart->needs_shipping() ? 'yes' : 'no',
533
+ // Defaults to 'required' to match how core initializes this option.
534
+ 'needs_payer_phone' => 'required' === get_option( 'woocommerce_checkout_phone_field', 'required' ),
535
  ),
536
  'button' => array(
537
  'type' => $this->get_button_type(),
563
  /**
564
  * Display the payment request button.
565
  *
566
+ * @since 4.0.0
567
  * @version 4.0.0
568
  */
569
  public function display_payment_request_button_html() {
608
  /**
609
  * Display payment request button separator.
610
  *
611
+ * @since 4.0.0
612
  * @version 4.0.0
613
  */
614
  public function display_payment_request_button_separator_html() {
641
  /**
642
  * Whether payment button html should be rendered on the Cart
643
  *
644
+ * @since 4.4.1
645
+ * @return boolean
 
646
  */
647
  private function should_show_payment_button_on_cart() {
648
  if ( ! apply_filters( 'wc_stripe_show_payment_request_on_cart', true ) ) {
658
  /**
659
  * Whether payment button html should be rendered
660
  *
661
+ * @since 4.3.2
662
+ * @return boolean
 
663
  */
664
  private function should_show_payment_button_on_product_page() {
665
  global $post;
701
  /**
702
  * Log errors coming from Payment Request
703
  *
704
+ * @since 3.1.4
705
  * @version 4.0.0
706
  */
707
  public function ajax_log_errors() {
717
  /**
718
  * Clears cart.
719
  *
720
+ * @since 3.1.4
721
  * @version 4.0.0
722
  */
723
  public function ajax_clear_cart() {
786
  /**
787
  * Gets shipping options available for specified shipping address
788
  *
789
+ * @param array $shipping_address Shipping address.
790
+ * @param boolean $itemized_display_items Indicates whether to show subtotals or itemized views.
791
  *
792
  * @return array Shipping options data.
793
  * phpcs:ignore Squiz.Commenting.FunctionCommentThrowTag
903
  /**
904
  * Gets the selected product data.
905
  *
906
+ * @since 4.0.0
907
  * @version 4.0.0
908
+ * @return array $data
909
  */
910
  public function ajax_get_selected_product_data() {
911
  check_ajax_referer( 'wc-stripe-get-selected-product-data', 'security' );
997
  /**
998
  * Adds the current product to the cart. Used on product detail page.
999
  *
1000
+ * @since 4.0.0
1001
  * @version 4.0.0
1002
+ * @return array $data
1003
  */
1004
  public function ajax_add_to_cart() {
1005
  check_ajax_referer( 'wc-stripe-add-to-cart', 'security' );
1046
  * what WC is expecting and throws an error. An example
1047
  * for Ireland the county dropdown in Chrome shows "Co. Clare" format
1048
  *
1049
+ * @since 4.0.0
1050
  * @version 4.0.0
1051
  */
1052
  public function normalize_state() {
1085
  /**
1086
  * Create order. Security is handled by WC.
1087
  *
1088
+ * @since 3.1.0
1089
  * @version 4.0.0
1090
  */
1091
  public function ajax_create_order() {
1107
  /**
1108
  * Calculate and set shipping method.
1109
  *
1110
+ * @param array $address Shipping address.
1111
+ *
1112
+ * @since 3.1.0
1113
  * @version 4.0.0
 
1114
  */
1115
  protected function calculate_shipping( $address = array() ) {
1116
  $country = $address['country'];
1175
  /**
1176
  * Builds the shippings methods to pass to Payment Request
1177
  *
1178
+ * @since 3.1.0
1179
  * @version 4.0.0
1180
  */
1181
  protected function build_shipping_methods( $shipping_methods ) {
1200
  /**
1201
  * Builds the line items to pass to Payment Request
1202
  *
1203
+ * @since 3.1.0
1204
  * @version 4.0.0
1205
  */
1206
  protected function build_display_items( $itemized_display_items = false ) {
languages/woocommerce-gateway-stripe.pot CHANGED
@@ -2,10 +2,10 @@
2
  # This file is distributed under the same license as the WooCommerce Stripe Gateway package.
3
  msgid ""
4
  msgstr ""
5
- "Project-Id-Version: WooCommerce Stripe Gateway 4.5.2\n"
6
  "Report-Msgid-Bugs-To: "
7
  "https://wordpress.org/support/plugin/woocommerce-gateway-stripe\n"
8
- "POT-Creation-Date: 2020-08-19 19:45:47+00:00\n"
9
  "MIME-Version: 1.0\n"
10
  "Content-Type: text/plain; charset=utf-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
@@ -661,148 +661,150 @@ msgstr ""
661
  msgid "Payment Request Buttons"
662
  msgstr ""
663
 
664
- #: includes/admin/stripe-settings.php:111
665
- #. translators: 1) br tag 2) opening anchor tag 3) closing anchor tag
 
666
  msgid ""
667
- "Enable Payment Request Buttons. (Apple Pay/Chrome Payment Request API) "
668
- "%1$sBy using Apple Pay, you agree to %2$s and %3$s's terms of service."
 
669
  msgstr ""
670
 
671
- #: includes/admin/stripe-settings.php:113
672
  msgid ""
673
  "If enabled, users will be able to pay using Apple Pay or Chrome Payment "
674
  "Request if supported by the browser."
675
  msgstr ""
676
 
677
- #: includes/admin/stripe-settings.php:118
678
  msgid "Payment Request Button Type"
679
  msgstr ""
680
 
681
- #: includes/admin/stripe-settings.php:119
682
  msgid "Button Type"
683
  msgstr ""
684
 
685
- #: includes/admin/stripe-settings.php:121
686
  msgid "Select the button type you would like to show."
687
  msgstr ""
688
 
689
- #: includes/admin/stripe-settings.php:125
690
  msgid "Default"
691
  msgstr ""
692
 
693
- #: includes/admin/stripe-settings.php:126
694
  msgid "Buy"
695
  msgstr ""
696
 
697
- #: includes/admin/stripe-settings.php:127
698
  msgid "Donate"
699
  msgstr ""
700
 
701
- #: includes/admin/stripe-settings.php:128
702
  msgid "Branded"
703
  msgstr ""
704
 
705
- #: includes/admin/stripe-settings.php:129
706
  msgid "Custom"
707
  msgstr ""
708
 
709
- #: includes/admin/stripe-settings.php:133
710
  msgid "Payment Request Button Theme"
711
  msgstr ""
712
 
713
- #: includes/admin/stripe-settings.php:134
714
  msgid "Button Theme"
715
  msgstr ""
716
 
717
- #: includes/admin/stripe-settings.php:136
718
  msgid "Select the button theme you would like to show."
719
  msgstr ""
720
 
721
- #: includes/admin/stripe-settings.php:140
722
  msgid "Dark"
723
  msgstr ""
724
 
725
- #: includes/admin/stripe-settings.php:141
726
  msgid "Light"
727
  msgstr ""
728
 
729
- #: includes/admin/stripe-settings.php:142
730
  msgid "Light-Outline"
731
  msgstr ""
732
 
733
- #: includes/admin/stripe-settings.php:146
734
  msgid "Payment Request Button Height"
735
  msgstr ""
736
 
737
- #: includes/admin/stripe-settings.php:147
738
  msgid "Button Height"
739
  msgstr ""
740
 
741
- #: includes/admin/stripe-settings.php:149
742
  msgid ""
743
  "Enter the height you would like the button to be in pixels. Width will "
744
  "always be 100%."
745
  msgstr ""
746
 
747
- #: includes/admin/stripe-settings.php:154
748
  msgid "Payment Request Button Label"
749
  msgstr ""
750
 
751
- #: includes/admin/stripe-settings.php:155
752
  msgid "Button Label"
753
  msgstr ""
754
 
755
- #: includes/admin/stripe-settings.php:157
756
  msgid "Enter the custom text you would like the button to have."
757
  msgstr ""
758
 
759
- #: includes/admin/stripe-settings.php:158
760
  msgid "Buy now"
761
  msgstr ""
762
 
763
- #: includes/admin/stripe-settings.php:162
764
  msgid "Payment Request Branded Button Label Format"
765
  msgstr ""
766
 
767
- #: includes/admin/stripe-settings.php:163
768
  msgid "Branded Button Label Format"
769
  msgstr ""
770
 
771
- #: includes/admin/stripe-settings.php:165
772
  msgid "Select the branded button label format."
773
  msgstr ""
774
 
775
- #: includes/admin/stripe-settings.php:169
776
  msgid "Logo only"
777
  msgstr ""
778
 
779
- #: includes/admin/stripe-settings.php:170
780
  msgid "Text and logo"
781
  msgstr ""
782
 
783
- #: includes/admin/stripe-settings.php:174
784
  msgid "Saved Cards"
785
  msgstr ""
786
 
787
- #: includes/admin/stripe-settings.php:175
788
  msgid "Enable Payment via Saved Cards"
789
  msgstr ""
790
 
791
- #: includes/admin/stripe-settings.php:177
792
  msgid ""
793
  "If enabled, users will be able to pay with a saved card during checkout. "
794
  "Card details are saved on Stripe servers, not on your store."
795
  msgstr ""
796
 
797
- #: includes/admin/stripe-settings.php:182
798
  msgid "Logging"
799
  msgstr ""
800
 
801
- #: includes/admin/stripe-settings.php:183
802
  msgid "Log debug messages"
803
  msgstr ""
804
 
805
- #: includes/admin/stripe-settings.php:185
806
  msgid "Save debug messages to the WooCommerce System Status log."
807
  msgstr ""
808
 
@@ -977,25 +979,25 @@ msgstr ""
977
  msgid "There was a problem connecting to the Stripe API endpoint."
978
  msgstr ""
979
 
980
- #: includes/class-wc-stripe-apple-pay-registration.php:129
981
  msgid "Unable to verify domain - missing secret key."
982
  msgstr ""
983
 
984
- #: includes/class-wc-stripe-apple-pay-registration.php:153
985
- #: includes/class-wc-stripe-apple-pay-registration.php:162
986
  #. translators: error message
987
  msgid "Unable to verify domain - %s"
988
  msgstr ""
989
 
990
- #: includes/class-wc-stripe-apple-pay-registration.php:189
991
  msgid "Unable to create domain association folder to domain root."
992
  msgstr ""
993
 
994
- #: includes/class-wc-stripe-apple-pay-registration.php:195
995
  msgid "Unable to copy domain association file to domain root."
996
  msgstr ""
997
 
998
- #: includes/class-wc-stripe-apple-pay-registration.php:270
999
  #. translators: 1) HTML anchor open tag 2) HTML anchor closing tag
1000
  msgid ""
1001
  "Apple Pay domain verification failed. Please check the %1$slog%2$s to see "
@@ -1429,57 +1431,57 @@ msgstr ""
1429
  msgid "Stripe SOFORT"
1430
  msgstr ""
1431
 
1432
- #: includes/payment-methods/class-wc-stripe-payment-request.php:300
1433
- #: includes/payment-methods/class-wc-stripe-payment-request.php:955
1434
- #: includes/payment-methods/class-wc-stripe-payment-request.php:1246
1435
  msgid "Tax"
1436
  msgstr ""
1437
 
1438
- #: includes/payment-methods/class-wc-stripe-payment-request.php:308
1439
- #: includes/payment-methods/class-wc-stripe-payment-request.php:963
1440
- #: includes/payment-methods/class-wc-stripe-payment-request.php:1253
1441
  msgid "Shipping"
1442
  msgstr ""
1443
 
1444
- #: includes/payment-methods/class-wc-stripe-payment-request.php:315
1445
- #: includes/payment-methods/class-wc-stripe-payment-request.php:970
1446
  msgid "Pending"
1447
  msgstr ""
1448
 
1449
- #: includes/payment-methods/class-wc-stripe-payment-request.php:520
1450
  msgid "Sorry, we're not accepting prepaid cards at this time."
1451
  msgstr ""
1452
 
1453
- #: includes/payment-methods/class-wc-stripe-payment-request.php:522
1454
  #. translators: Do not translate the [option] placeholder
1455
  msgid "Unknown shipping option \"[option]\"."
1456
  msgstr ""
1457
 
1458
- #: includes/payment-methods/class-wc-stripe-payment-request.php:631
1459
  msgid "OR"
1460
  msgstr ""
1461
 
1462
- #: includes/payment-methods/class-wc-stripe-payment-request.php:805
1463
- #: includes/payment-methods/class-wc-stripe-payment-request.php:818
1464
  msgid "Unable to find shipping method for address."
1465
  msgstr ""
1466
 
1467
- #: includes/payment-methods/class-wc-stripe-payment-request.php:917
1468
  msgid "Product with the ID (%d) cannot be found."
1469
  msgstr ""
1470
 
1471
- #: includes/payment-methods/class-wc-stripe-payment-request.php:938
1472
  #. translators: 1: product name 2: quantity in stock
1473
  msgid ""
1474
  "You cannot add that amount of \"%1$s\"; to the cart because there is not "
1475
  "enough stock (%2$s remaining)."
1476
  msgstr ""
1477
 
1478
- #: includes/payment-methods/class-wc-stripe-payment-request.php:1089
1479
  msgid "Empty cart"
1480
  msgstr ""
1481
 
1482
- #: includes/payment-methods/class-wc-stripe-payment-request.php:1260
1483
  msgid "Discount"
1484
  msgstr ""
1485
 
2
  # This file is distributed under the same license as the WooCommerce Stripe Gateway package.
3
  msgid ""
4
  msgstr ""
5
+ "Project-Id-Version: WooCommerce Stripe Gateway 4.5.3\n"
6
  "Report-Msgid-Bugs-To: "
7
  "https://wordpress.org/support/plugin/woocommerce-gateway-stripe\n"
8
+ "POT-Creation-Date: 2020-10-06 20:07:26+00:00\n"
9
  "MIME-Version: 1.0\n"
10
  "Content-Type: text/plain; charset=utf-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
661
  msgid "Payment Request Buttons"
662
  msgstr ""
663
 
664
+ #: includes/admin/stripe-settings.php:112
665
+ #. translators: 1) br tag 2) Stripe anchor tag 3) Apple anchor tag 4) Stripe
666
+ #. dashboard opening anchor tag 5) Stripe dashboard closing anchor tag
667
  msgid ""
668
+ "Enable Payment Request Buttons. (Apple Pay/Google Pay) %1$sBy using Apple "
669
+ "Pay, you agree to %2$s and %3$s's terms of service. %4$sLog into your "
670
+ "Stripe dashboard%5$s to complete or update your Apple Pay setup."
671
  msgstr ""
672
 
673
+ #: includes/admin/stripe-settings.php:120
674
  msgid ""
675
  "If enabled, users will be able to pay using Apple Pay or Chrome Payment "
676
  "Request if supported by the browser."
677
  msgstr ""
678
 
679
+ #: includes/admin/stripe-settings.php:125
680
  msgid "Payment Request Button Type"
681
  msgstr ""
682
 
683
+ #: includes/admin/stripe-settings.php:126
684
  msgid "Button Type"
685
  msgstr ""
686
 
687
+ #: includes/admin/stripe-settings.php:128
688
  msgid "Select the button type you would like to show."
689
  msgstr ""
690
 
691
+ #: includes/admin/stripe-settings.php:132
692
  msgid "Default"
693
  msgstr ""
694
 
695
+ #: includes/admin/stripe-settings.php:133
696
  msgid "Buy"
697
  msgstr ""
698
 
699
+ #: includes/admin/stripe-settings.php:134
700
  msgid "Donate"
701
  msgstr ""
702
 
703
+ #: includes/admin/stripe-settings.php:135
704
  msgid "Branded"
705
  msgstr ""
706
 
707
+ #: includes/admin/stripe-settings.php:136
708
  msgid "Custom"
709
  msgstr ""
710
 
711
+ #: includes/admin/stripe-settings.php:140
712
  msgid "Payment Request Button Theme"
713
  msgstr ""
714
 
715
+ #: includes/admin/stripe-settings.php:141
716
  msgid "Button Theme"
717
  msgstr ""
718
 
719
+ #: includes/admin/stripe-settings.php:143
720
  msgid "Select the button theme you would like to show."
721
  msgstr ""
722
 
723
+ #: includes/admin/stripe-settings.php:147
724
  msgid "Dark"
725
  msgstr ""
726
 
727
+ #: includes/admin/stripe-settings.php:148
728
  msgid "Light"
729
  msgstr ""
730
 
731
+ #: includes/admin/stripe-settings.php:149
732
  msgid "Light-Outline"
733
  msgstr ""
734
 
735
+ #: includes/admin/stripe-settings.php:153
736
  msgid "Payment Request Button Height"
737
  msgstr ""
738
 
739
+ #: includes/admin/stripe-settings.php:154
740
  msgid "Button Height"
741
  msgstr ""
742
 
743
+ #: includes/admin/stripe-settings.php:156
744
  msgid ""
745
  "Enter the height you would like the button to be in pixels. Width will "
746
  "always be 100%."
747
  msgstr ""
748
 
749
+ #: includes/admin/stripe-settings.php:161
750
  msgid "Payment Request Button Label"
751
  msgstr ""
752
 
753
+ #: includes/admin/stripe-settings.php:162
754
  msgid "Button Label"
755
  msgstr ""
756
 
757
+ #: includes/admin/stripe-settings.php:164
758
  msgid "Enter the custom text you would like the button to have."
759
  msgstr ""
760
 
761
+ #: includes/admin/stripe-settings.php:165
762
  msgid "Buy now"
763
  msgstr ""
764
 
765
+ #: includes/admin/stripe-settings.php:169
766
  msgid "Payment Request Branded Button Label Format"
767
  msgstr ""
768
 
769
+ #: includes/admin/stripe-settings.php:170
770
  msgid "Branded Button Label Format"
771
  msgstr ""
772
 
773
+ #: includes/admin/stripe-settings.php:172
774
  msgid "Select the branded button label format."
775
  msgstr ""
776
 
777
+ #: includes/admin/stripe-settings.php:176
778
  msgid "Logo only"
779
  msgstr ""
780
 
781
+ #: includes/admin/stripe-settings.php:177
782
  msgid "Text and logo"
783
  msgstr ""
784
 
785
+ #: includes/admin/stripe-settings.php:181
786
  msgid "Saved Cards"
787
  msgstr ""
788
 
789
+ #: includes/admin/stripe-settings.php:182
790
  msgid "Enable Payment via Saved Cards"
791
  msgstr ""
792
 
793
+ #: includes/admin/stripe-settings.php:184
794
  msgid ""
795
  "If enabled, users will be able to pay with a saved card during checkout. "
796
  "Card details are saved on Stripe servers, not on your store."
797
  msgstr ""
798
 
799
+ #: includes/admin/stripe-settings.php:189
800
  msgid "Logging"
801
  msgstr ""
802
 
803
+ #: includes/admin/stripe-settings.php:190
804
  msgid "Log debug messages"
805
  msgstr ""
806
 
807
+ #: includes/admin/stripe-settings.php:192
808
  msgid "Save debug messages to the WooCommerce System Status log."
809
  msgstr ""
810
 
979
  msgid "There was a problem connecting to the Stripe API endpoint."
980
  msgstr ""
981
 
982
+ #: includes/class-wc-stripe-apple-pay-registration.php:133
983
  msgid "Unable to verify domain - missing secret key."
984
  msgstr ""
985
 
986
+ #: includes/class-wc-stripe-apple-pay-registration.php:157
987
+ #: includes/class-wc-stripe-apple-pay-registration.php:166
988
  #. translators: error message
989
  msgid "Unable to verify domain - %s"
990
  msgstr ""
991
 
992
+ #: includes/class-wc-stripe-apple-pay-registration.php:193
993
  msgid "Unable to create domain association folder to domain root."
994
  msgstr ""
995
 
996
+ #: includes/class-wc-stripe-apple-pay-registration.php:199
997
  msgid "Unable to copy domain association file to domain root."
998
  msgstr ""
999
 
1000
+ #: includes/class-wc-stripe-apple-pay-registration.php:306
1001
  #. translators: 1) HTML anchor open tag 2) HTML anchor closing tag
1002
  msgid ""
1003
  "Apple Pay domain verification failed. Please check the %1$slog%2$s to see "
1431
  msgid "Stripe SOFORT"
1432
  msgstr ""
1433
 
1434
+ #: includes/payment-methods/class-wc-stripe-payment-request.php:303
1435
+ #: includes/payment-methods/class-wc-stripe-payment-request.php:959
1436
+ #: includes/payment-methods/class-wc-stripe-payment-request.php:1251
1437
  msgid "Tax"
1438
  msgstr ""
1439
 
1440
+ #: includes/payment-methods/class-wc-stripe-payment-request.php:311
1441
+ #: includes/payment-methods/class-wc-stripe-payment-request.php:967
1442
+ #: includes/payment-methods/class-wc-stripe-payment-request.php:1258
1443
  msgid "Shipping"
1444
  msgstr ""
1445
 
1446
+ #: includes/payment-methods/class-wc-stripe-payment-request.php:318
1447
+ #: includes/payment-methods/class-wc-stripe-payment-request.php:974
1448
  msgid "Pending"
1449
  msgstr ""
1450
 
1451
+ #: includes/payment-methods/class-wc-stripe-payment-request.php:524
1452
  msgid "Sorry, we're not accepting prepaid cards at this time."
1453
  msgstr ""
1454
 
1455
+ #: includes/payment-methods/class-wc-stripe-payment-request.php:526
1456
  #. translators: Do not translate the [option] placeholder
1457
  msgid "Unknown shipping option \"[option]\"."
1458
  msgstr ""
1459
 
1460
+ #: includes/payment-methods/class-wc-stripe-payment-request.php:637
1461
  msgid "OR"
1462
  msgstr ""
1463
 
1464
+ #: includes/payment-methods/class-wc-stripe-payment-request.php:809
1465
+ #: includes/payment-methods/class-wc-stripe-payment-request.php:822
1466
  msgid "Unable to find shipping method for address."
1467
  msgstr ""
1468
 
1469
+ #: includes/payment-methods/class-wc-stripe-payment-request.php:921
1470
  msgid "Product with the ID (%d) cannot be found."
1471
  msgstr ""
1472
 
1473
+ #: includes/payment-methods/class-wc-stripe-payment-request.php:942
1474
  #. translators: 1: product name 2: quantity in stock
1475
  msgid ""
1476
  "You cannot add that amount of \"%1$s\"; to the cart because there is not "
1477
  "enough stock (%2$s remaining)."
1478
  msgstr ""
1479
 
1480
+ #: includes/payment-methods/class-wc-stripe-payment-request.php:1093
1481
  msgid "Empty cart"
1482
  msgstr ""
1483
 
1484
+ #: includes/payment-methods/class-wc-stripe-payment-request.php:1265
1485
  msgid "Discount"
1486
  msgstr ""
1487
 
readme.txt CHANGED
@@ -4,7 +4,7 @@ Tags: credit card, stripe, apple pay, payment request, google pay, sepa, sofort,
4
  Requires at least: 4.4
5
  Tested up to: 5.5
6
  Requires PHP: 5.6
7
- Stable tag: 4.5.2
8
  License: GPLv3
9
  License URI: https://www.gnu.org/licenses/gpl-3.0.html
10
  Attributions: thorsten-stripe
@@ -126,8 +126,14 @@ If you get stuck, you can ask for help in the Plugin Forum.
126
 
127
  == Changelog ==
128
 
129
- = 4.5.2 - 2020-08-19 =
130
- * Fix - Allow extension to attempt to run in all countries, not just officially supported ones
 
 
 
 
 
 
131
 
132
  [See changelog for all versions](https://raw.githubusercontent.com/woocommerce/woocommerce-gateway-stripe/master/changelog.txt).
133
 
4
  Requires at least: 4.4
5
  Tested up to: 5.5
6
  Requires PHP: 5.6
7
+ Stable tag: 4.5.3
8
  License: GPLv3
9
  License URI: https://www.gnu.org/licenses/gpl-3.0.html
10
  Attributions: thorsten-stripe
126
 
127
  == Changelog ==
128
 
129
+ = 4.5.4 - 2020-10-06 =
130
+ * Fix - Apple Pay now requires a buyer's phone number only if it's required in Appearance > Customize > WooCommerce > Checkout.
131
+ * Add - Allow toggling secrets temporarily to visible in settings.
132
+ * Fix - Properly display field required error when SEPA method is used.
133
+ * Tweak - Update payment request button description to include link to Stripe dashboard Apple Pay settings.
134
+ * Add - Add off session payment intent filter, props rfair404.
135
+ * Tweak - Update contributors list.
136
+ * Add - Link from Payment Request button setting to Apple Pay settings in Stripe dashboard.
137
 
138
  [See changelog for all versions](https://raw.githubusercontent.com/woocommerce/woocommerce-gateway-stripe/master/changelog.txt).
139
 
woocommerce-gateway-stripe.php CHANGED
@@ -5,7 +5,7 @@
5
  * Description: Take credit card payments on your store using Stripe.
6
  * Author: WooCommerce
7
  * Author URI: https://woocommerce.com/
8
- * Version: 4.5.2
9
  * Requires at least: 4.4
10
  * Tested up to: 5.5
11
  * WC requires at least: 3.0
@@ -22,7 +22,7 @@ if ( ! defined( 'ABSPATH' ) ) {
22
  /**
23
  * Required minimums and constants
24
  */
25
- define( 'WC_STRIPE_VERSION', '4.5.2' );
26
  define( 'WC_STRIPE_MIN_PHP_VER', '5.6.0' );
27
  define( 'WC_STRIPE_MIN_WC_VER', '3.0' );
28
  define( 'WC_STRIPE_FUTURE_MIN_WC_VER', '3.0' );
5
  * Description: Take credit card payments on your store using Stripe.
6
  * Author: WooCommerce
7
  * Author URI: https://woocommerce.com/
8
+ * Version: 4.5.3
9
  * Requires at least: 4.4
10
  * Tested up to: 5.5
11
  * WC requires at least: 3.0
22
  /**
23
  * Required minimums and constants
24
  */
25
+ define( 'WC_STRIPE_VERSION', '4.5.3' ); // WRCS: DEFINED_VERSION.
26
  define( 'WC_STRIPE_MIN_PHP_VER', '5.6.0' );
27
  define( 'WC_STRIPE_MIN_WC_VER', '3.0' );
28
  define( 'WC_STRIPE_FUTURE_MIN_WC_VER', '3.0' );