WooCommerce Stripe Payment Gateway - Version 5.2.0

Version Description

  • 2021-05-19 =

  • Fix - Use get_parent method to avoid accessing order subscription property directly.

  • Fix - Orders won't transition to 'Refunded' state if refund can't be created.

  • Fix - Normalize United Kingdom and Canada postal codes for Apple Pay.

  • Fix - Subscription sign-up fees not included in total for Payment Request Button.

  • Fix - Reduce requests sent to server from stripe settings page.

  • Fix - Choose the appropriate version of the WooCommerce Admin Notes API based on which API is available.

  • Fix - Customer information is now correctly displayed in the Stripe Payments Dashboard when a new customer checks out through the WooCommerce Checkout Block.

  • Fix - Pass customer language/locale to Stripe upon creation or modification.

  • Fix - Initial price for Variable Products is now correctly shown when a Payment Request is started.

  • Add - Support for Credit Card payments (incl. 3DS payments) via WooCommerce Blocks; limited to WooCommerce Core product types.

  • Add - Support for payments (incl. 3DS payments) paid via Payment Request Buttons in WooCommerce Blocks; limited to WooCommerce Core product types.

  • Add - Support for custom and branded Payment Request Buttons when using the Cart and Checkout blocks.

  • Tweak - Should customer opt to save their card, the card is now saved after a payment has been confirmed.

See changelog for all versions.

Download this release

Release Info

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

Code changes from version 5.1.0 to 5.2.0

assets/css/stripe-styles.css CHANGED
@@ -1 +1 @@
1
- .wc-stripe-elements-field,.wc-stripe-iban-element-field{border:1px solid #ddd;margin:5px 0;padding:5px;background-color:#fff;outline:0}#payment .methods li.woocommerce-SavedPaymentMethods-token label{display:inline}#payment .methods li.woocommerce-SavedPaymentMethods-new label{display:inline}#add_payment_method #payment ul.payment_methods li img.stripe-icon,.woocommerce-checkout #payment ul.payment_methods li img.stripe-icon{max-width:40px;padding-left:3px;margin:0}#add_payment_method #payment ul.payment_methods li img.stripe-bancontact-icon,.woocommerce-checkout #payment ul.payment_methods li img.stripe-bancontact-icon{max-height:65px;max-width:45px}#add_payment_method #payment ul.payment_methods li img.stripe-ideal-icon,.woocommerce-checkout #payment ul.payment_methods li img.stripe-ideal-icon{max-height:35px}#add_payment_method #payment ul.payment_methods li img.stripe-p24-icon,.woocommerce-checkout #payment ul.payment_methods li img.stripe-p24-icon{max-width:65px}#add_payment_method #payment ul.payment_methods li img.stripe-alipay-icon,.woocommerce-checkout #payment ul.payment_methods li img.stripe-alipay-icon{max-width:50px}#add_payment_method #payment ul.payment_methods li img.stripe-sofort-icon,.woocommerce-checkout #payment ul.payment_methods li img.stripe-sofort-icon{max-width:55px}#add_payment_method #payment ul.payment_methods li img.stripe-sepa-icon,.woocommerce-checkout #payment ul.payment_methods li img.stripe-sepa-icon{max-width:50px}#add_payment_method #payment ul.payment_methods li img.stripe-multibanco-icon,.woocommerce-checkout #payment ul.payment_methods li img.stripe-multibanco-icon{max-height:30px}#add_payment_method #payment ul.payment_methods li img.stripe-eps-icon,.woocommerce-checkout #payment ul.payment_methods li img.stripe-eps-icon{max-height:30px}#add_payment_method #payment ul.payment_methods li img.stripe-giropay-icon,.woocommerce-checkout #payment ul.payment_methods li img.stripe-giropay-icon{max-width:50px}#add_payment_method #payment ul.payment_methods li .stripe-credit-card-brand,.woocommerce-checkout #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}#add_payment_method #payment ul.payment_methods li .stripe-visa-brand,.woocommerce-checkout #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}#add_payment_method #payment ul.payment_methods li .stripe-amex-brand,.woocommerce-checkout #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}#add_payment_method #payment ul.payment_methods li .stripe-diners-brand,.woocommerce-checkout #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}#add_payment_method #payment ul.payment_methods li .stripe-discover-brand,.woocommerce-checkout #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}#add_payment_method #payment ul.payment_methods li .stripe-jcb-brand,.woocommerce-checkout #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}#add_payment_method #payment ul.payment_methods li .stripe-maestro-brand,.woocommerce-checkout #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}#add_payment_method #payment ul.payment_methods li .stripe-mastercard-brand,.woocommerce-checkout #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}#add_payment_method #payment ul.payment_methods .stripe-card-group,.woocommerce-checkout #payment ul.payment_methods .stripe-card-group{position:relative}.woocommerce-SavedPaymentMethods-token .stripe-source-errors .woocommerce-error{margin-top:1em;margin-bottom:2em}#wc-stripe-custom-button{display:block;width:100%}.gpay-button{background-origin:content-box;background-position:center center;background-repeat:no-repeat;background-size:contain;border:0;border-radius:4px;box-shadow:rgba(60,64,67,.3) 0 1px 1px 0,rgba(60,64,67,.15) 0 1px 3px 1px;cursor:pointer;height:40px;min-height:40px;padding:11px 24px;width:100%}.gpay-button.light{width:calc(100% - 3px);background-color:#fff}.gpay-button.light:active{background-color:#fff}.gpay-button.light:hover{background-color:#f8f8f8}.gpay-button.light:focus{box-shadow:#e8e8e8 0 1px 1px 0,#e8e8e8 0 1px 3px;outline:0}.gpay-button.dark{background-color:#000;box-shadow:none;padding:12px 24px 10px}.gpay-button.dark:active{background-color:#5f6368}.gpay-button.dark:hover{background-color:#3c4043}.gpay-button.dark:focus{box-shadow:#5f6368 0 1px 1px 0,#5f6368 0 1px 3px;outline:0}.gpay-button.short.light{background-image:url(https://www.gstatic.com/instantbuy/svg/light_gpay.svg)}.gpay-button.short.dark{background-image:url(https://www.gstatic.com/instantbuy/svg/dark_gpay.svg)}
1
+ .wc-stripe-elements-field,.wc-stripe-iban-element-field{border:1px solid #ddd;margin:5px 0;padding:5px;background-color:#fff;outline:0}#payment .methods li.woocommerce-SavedPaymentMethods-token label{display:inline}#payment .methods li.woocommerce-SavedPaymentMethods-new label{display:inline}#add_payment_method #payment ul.payment_methods li img.stripe-icon,.woocommerce-checkout #payment ul.payment_methods li img.stripe-icon{max-width:40px;padding-left:3px;margin:0}#add_payment_method #payment ul.payment_methods li img.stripe-bancontact-icon,.woocommerce-checkout #payment ul.payment_methods li img.stripe-bancontact-icon{max-height:65px;max-width:45px}#add_payment_method #payment ul.payment_methods li img.stripe-ideal-icon,.woocommerce-checkout #payment ul.payment_methods li img.stripe-ideal-icon{max-height:35px}#add_payment_method #payment ul.payment_methods li img.stripe-p24-icon,.woocommerce-checkout #payment ul.payment_methods li img.stripe-p24-icon{max-width:65px}#add_payment_method #payment ul.payment_methods li img.stripe-alipay-icon,.woocommerce-checkout #payment ul.payment_methods li img.stripe-alipay-icon{max-width:50px}#add_payment_method #payment ul.payment_methods li img.stripe-sofort-icon,.woocommerce-checkout #payment ul.payment_methods li img.stripe-sofort-icon{max-width:55px}#add_payment_method #payment ul.payment_methods li img.stripe-sepa-icon,.woocommerce-checkout #payment ul.payment_methods li img.stripe-sepa-icon{max-width:50px}#add_payment_method #payment ul.payment_methods li img.stripe-multibanco-icon,.woocommerce-checkout #payment ul.payment_methods li img.stripe-multibanco-icon{max-height:30px}#add_payment_method #payment ul.payment_methods li img.stripe-eps-icon,.woocommerce-checkout #payment ul.payment_methods li img.stripe-eps-icon{max-height:30px}#add_payment_method #payment ul.payment_methods li img.stripe-giropay-icon,.woocommerce-checkout #payment ul.payment_methods li img.stripe-giropay-icon{max-width:50px}#add_payment_method #payment ul.payment_methods li .stripe-credit-card-brand,.woocommerce-checkout #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}#add_payment_method #payment ul.payment_methods li .stripe-visa-brand,.woocommerce-checkout #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}#add_payment_method #payment ul.payment_methods li .stripe-amex-brand,.woocommerce-checkout #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}#add_payment_method #payment ul.payment_methods li .stripe-diners-brand,.woocommerce-checkout #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}#add_payment_method #payment ul.payment_methods li .stripe-discover-brand,.woocommerce-checkout #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}#add_payment_method #payment ul.payment_methods li .stripe-jcb-brand,.woocommerce-checkout #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}#add_payment_method #payment ul.payment_methods li .stripe-maestro-brand,.woocommerce-checkout #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}#add_payment_method #payment ul.payment_methods li .stripe-mastercard-brand,.woocommerce-checkout #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}#add_payment_method #payment ul.payment_methods .stripe-card-group,.woocommerce-checkout #payment ul.payment_methods .stripe-card-group{position:relative}.woocommerce-SavedPaymentMethods-token .stripe-source-errors .woocommerce-error{margin-top:1em;margin-bottom:2em}#wc-stripe-custom-button{display:block;width:100%}.gpay-button{background-origin:content-box;background-position:center center;background-repeat:no-repeat;background-size:contain;border:0;border-radius:4px;cursor:pointer;height:40px;min-height:40px;padding:11px 24px;width:100%}.gpay-button.light{width:calc(100% - 3px);background-color:#fff;margin:2px 0 3px 0}.gpay-button.light:active{background-color:#fff}.gpay-button.light:hover{background-color:#f8f8f8}.gpay-button.light:focus{box-shadow:#e8e8e8 0 1px 1px 0,#e8e8e8 0 1px 3px;outline:0}.gpay-button.light-outline{width:calc(100% - 3px);background-color:#fff;box-shadow:rgba(60,64,67,.3) 0 1px 1px 0,rgba(60,64,67,.15) 0 1px 3px 1px;margin:2px 0 3px 0}.gpay-button.light-outline:active{background-color:#fff}.gpay-button.light-outline:hover{background-color:#f8f8f8}.gpay-button.light-outline:focus{box-shadow:#e8e8e8 0 1px 1px 0,#e8e8e8 0 1px 3px;outline:0}.gpay-button.dark{background-color:#000;padding:12px 24px 10px}.gpay-button.dark:active{background-color:#5f6368}.gpay-button.dark:hover{background-color:#3c4043}.gpay-button.dark:focus{box-shadow:#5f6368 0 1px 1px 0,#5f6368 0 1px 3px;outline:0}.gpay-button.short.light,.gpay-button.short.light-outline{background-image:url(https://www.gstatic.com/instantbuy/svg/light_gpay.svg)}.gpay-button.short.dark{background-image:url(https://www.gstatic.com/instantbuy/svg/dark_gpay.svg)}
assets/css/stripe-styles.scss CHANGED
@@ -1,76 +1,191 @@
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;
@@ -81,6 +196,34 @@
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
  }
@@ -95,12 +238,11 @@
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 {
@@ -110,11 +252,12 @@
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
  }
1
+ .wc-stripe-elements-field,
2
+ .wc-stripe-iban-element-field {
3
+ border: 1px solid #ddd;
4
+ margin: 5px 0;
5
+ padding: 5px;
6
+ background-color: #fff;
7
+ outline: 0;
8
+ }
9
+ #payment .methods li.woocommerce-SavedPaymentMethods-token label {
10
+ display: inline;
11
+ }
12
+ #payment .methods li.woocommerce-SavedPaymentMethods-new label {
13
+ display: inline;
14
+ }
15
 
16
  .woocommerce-checkout #payment ul.payment_methods li img.stripe-icon,
17
+ #add_payment_method #payment ul.payment_methods li img.stripe-icon {
18
+ max-width: 40px;
19
+ padding-left: 3px;
20
+ margin: 0;
21
+ }
22
 
23
  .woocommerce-checkout #payment ul.payment_methods li img.stripe-bancontact-icon,
24
+ #add_payment_method #payment ul.payment_methods li img.stripe-bancontact-icon {
25
+ max-height: 65px;
26
+ max-width: 45px;
27
+ }
28
 
29
  .woocommerce-checkout #payment ul.payment_methods li img.stripe-ideal-icon,
30
+ #add_payment_method #payment ul.payment_methods li img.stripe-ideal-icon {
31
+ max-height: 35px;
32
+ }
33
 
34
  .woocommerce-checkout #payment ul.payment_methods li img.stripe-p24-icon,
35
+ #add_payment_method #payment ul.payment_methods li img.stripe-p24-icon {
36
+ max-width: 65px;
37
+ }
38
 
39
  .woocommerce-checkout #payment ul.payment_methods li img.stripe-alipay-icon,
40
+ #add_payment_method #payment ul.payment_methods li img.stripe-alipay-icon {
41
+ max-width: 50px;
42
+ }
43
 
44
  .woocommerce-checkout #payment ul.payment_methods li img.stripe-sofort-icon,
45
+ #add_payment_method #payment ul.payment_methods li img.stripe-sofort-icon {
46
+ max-width: 55px;
47
+ }
48
 
49
  .woocommerce-checkout #payment ul.payment_methods li img.stripe-sepa-icon,
50
+ #add_payment_method #payment ul.payment_methods li img.stripe-sepa-icon {
51
+ max-width: 50px;
52
+ }
53
 
54
  .woocommerce-checkout #payment ul.payment_methods li img.stripe-multibanco-icon,
55
+ #add_payment_method #payment ul.payment_methods li img.stripe-multibanco-icon {
56
+ max-height: 30px;
57
+ }
58
 
59
  .woocommerce-checkout #payment ul.payment_methods li img.stripe-eps-icon,
60
+ #add_payment_method #payment ul.payment_methods li img.stripe-eps-icon {
61
+ max-height: 30px;
62
+ }
63
 
64
  .woocommerce-checkout #payment ul.payment_methods li img.stripe-giropay-icon,
65
+ #add_payment_method #payment ul.payment_methods li img.stripe-giropay-icon {
66
+ max-width: 50px;
67
+ }
68
 
69
  .woocommerce-checkout #payment ul.payment_methods li .stripe-credit-card-brand,
70
+ #add_payment_method #payment ul.payment_methods li .stripe-credit-card-brand {
71
+ position: absolute;
72
+ top: 50%;
73
+ margin-top: -10px;
74
+ right: 10px;
75
+ background: no-repeat url( '../images/credit-card.svg' );
76
+ display: block;
77
+ width: 30px;
78
+ height: 24px;
79
+ }
80
 
81
  .woocommerce-checkout #payment ul.payment_methods li .stripe-visa-brand,
82
+ #add_payment_method #payment ul.payment_methods li .stripe-visa-brand {
83
+ position: absolute;
84
+ top: 50%;
85
+ margin-top: -10px;
86
+ right: 10px;
87
+ background: no-repeat url( '../images/visa.svg' );
88
+ display: block;
89
+ width: 30px;
90
+ height: 24px;
91
+ }
92
 
93
  .woocommerce-checkout #payment ul.payment_methods li .stripe-amex-brand,
94
+ #add_payment_method #payment ul.payment_methods li .stripe-amex-brand {
95
+ position: absolute;
96
+ top: 50%;
97
+ margin-top: -10px;
98
+ right: 10px;
99
+ background: no-repeat url( '../images/amex.svg' );
100
+ display: block;
101
+ width: 30px;
102
+ height: 24px;
103
+ }
104
 
105
  .woocommerce-checkout #payment ul.payment_methods li .stripe-diners-brand,
106
+ #add_payment_method #payment ul.payment_methods li .stripe-diners-brand {
107
+ position: absolute;
108
+ top: 50%;
109
+ margin-top: -10px;
110
+ right: 10px;
111
+ background: no-repeat url( '../images/diners.svg' );
112
+ display: block;
113
+ width: 30px;
114
+ height: 24px;
115
+ }
116
 
117
  .woocommerce-checkout #payment ul.payment_methods li .stripe-discover-brand,
118
+ #add_payment_method #payment ul.payment_methods li .stripe-discover-brand {
119
+ position: absolute;
120
+ top: 50%;
121
+ margin-top: -10px;
122
+ right: 10px;
123
+ background: no-repeat url( '../images/discover.svg' );
124
+ display: block;
125
+ width: 30px;
126
+ height: 24px;
127
+ }
128
 
129
  .woocommerce-checkout #payment ul.payment_methods li .stripe-jcb-brand,
130
+ #add_payment_method #payment ul.payment_methods li .stripe-jcb-brand {
131
+ position: absolute;
132
+ top: 50%;
133
+ margin-top: -10px;
134
+ right: 10px;
135
+ background: no-repeat url( '../images/jcb.svg' );
136
+ display: block;
137
+ width: 30px;
138
+ height: 24px;
139
+ }
140
 
141
  .woocommerce-checkout #payment ul.payment_methods li .stripe-maestro-brand,
142
+ #add_payment_method #payment ul.payment_methods li .stripe-maestro-brand {
143
+ position: absolute;
144
+ top: 50%;
145
+ margin-top: -10px;
146
+ right: 10px;
147
+ background: no-repeat url( '../images/maestro.svg' );
148
+ display: block;
149
+ width: 30px;
150
+ height: 24px;
151
+ }
152
 
153
  .woocommerce-checkout #payment ul.payment_methods li .stripe-mastercard-brand,
154
+ #add_payment_method #payment ul.payment_methods li .stripe-mastercard-brand {
155
+ position: absolute;
156
+ top: 50%;
157
+ margin-top: -10px;
158
+ right: 10px;
159
+ background: no-repeat url( '../images/mastercard.svg' );
160
+ display: block;
161
+ width: 30px;
162
+ height: 24px;
163
+ }
164
 
165
  .woocommerce-checkout #payment ul.payment_methods .stripe-card-group,
166
+ #add_payment_method #payment ul.payment_methods .stripe-card-group {
167
+ position: relative;
168
+ }
169
 
170
+ .woocommerce-SavedPaymentMethods-token
171
+ .stripe-source-errors
172
+ .woocommerce-error {
173
+ margin-top: 1em;
174
+ margin-bottom: 2em;
175
+ }
176
 
177
+ #wc-stripe-custom-button {
178
+ display: block;
179
+ width: 100%;
180
+ }
181
 
182
  .gpay-button {
183
  background-origin: content-box;
184
  background-position: center center;
185
  background-repeat: no-repeat;
186
  background-size: contain;
187
+ border: 0;
188
  border-radius: 4px;
 
189
  cursor: pointer;
190
  height: 40px;
191
  min-height: 40px;
196
  // account for button box-shadow when setting width
197
  width: calc( 100% - 3px );
198
  background-color: #fff;
199
+
200
+ // Add vertical margin to make box-shadow visible in blocks.
201
+ margin: 2px 0 3px 0;
202
+
203
+ &:active {
204
+ background-color: #fff;
205
+ }
206
+ &:hover {
207
+ background-color: #f8f8f8;
208
+ }
209
+ &:focus {
210
+ box-shadow: #e8e8e8 0 1px 1px 0, #e8e8e8 0 1px 3px;
211
+ outline: 0;
212
+ }
213
+ }
214
+
215
+ &.light-outline {
216
+ // account for button box-shadow when setting width
217
+ width: calc( 100% - 3px );
218
+ background-color: #fff;
219
+
220
+ // The box-shadow forms the outline and as such is always on.
221
+ box-shadow: rgba( 60, 64, 67, 0.3 ) 0px 1px 1px 0,
222
+ rgba( 60, 64, 67, 0.15 ) 0 1px 3px 1px;
223
+
224
+ // Add vertical margin to make box-shadow visible in blocks.
225
+ margin: 2px 0 3px 0;
226
+
227
  &:active {
228
  background-color: #fff;
229
  }
238
 
239
  &.dark {
240
  background-color: #000;
 
241
  padding: 12px 24px 10px;
242
  &:active {
243
  background-color: #5f6368;
244
  }
245
+ &:hover {
246
  background-color: #3c4043;
247
  }
248
  &:focus {
252
  }
253
 
254
  &.short {
255
+ &.light,
256
+ &.light-outline {
257
+ background-image: url( https://www.gstatic.com/instantbuy/svg/light_gpay.svg );
258
  }
259
  &.dark {
260
+ background-image: url( https://www.gstatic.com/instantbuy/svg/dark_gpay.svg );
261
  }
262
  }
263
  }
assets/js/stripe-admin.js CHANGED
@@ -129,22 +129,10 @@ jQuery( function( $ ) {
129
  // server time is off from browser time by > 4 minutes.
130
  var timeDifference = Date.now() / 1000 - wc_stripe_settings_params.time;
131
  var isTimeOutOfSync = Math.abs( timeDifference ) > 4 * 60;
132
- $( '#woocommerce_stripe_test_webhook_secret, #woocommerce_stripe_webhook_secret' )
133
- .on( 'change input', function() {
134
- var $td = $( this ).closest( 'td' );
135
- var $warning = $td.find( '.webhook_secret_time_sync_warning' );
136
- var hasWebhookSecretValue = $( this ).val().length > 0;
137
-
138
- if ( hasWebhookSecretValue ){
139
- var isWarningShown = $warning.length > 0;
140
- if ( isTimeOutOfSync && ! isWarningShown ) {
141
- $td.append( '<p class="webhook_secret_time_sync_warning">' + wc_stripe_settings_params.i18n_out_of_sync + '</p>' );
142
- }
143
- } else {
144
- $warning.remove();
145
- }
146
- } )
147
- .change();
148
  }
149
  };
150
 
129
  // server time is off from browser time by > 4 minutes.
130
  var timeDifference = Date.now() / 1000 - wc_stripe_settings_params.time;
131
  var isTimeOutOfSync = Math.abs( timeDifference ) > 4 * 60;
132
+ if ( isTimeOutOfSync ) {
133
+ var $td = $( '#woocommerce_stripe_test_webhook_secret, #woocommerce_stripe_webhook_secret' ).closest( 'td' );
134
+ $td.append( '<p>' + wc_stripe_settings_params.i18n_out_of_sync + '</p>' );
135
+ }
 
 
 
 
 
 
 
 
 
 
 
 
136
  }
137
  };
138
 
assets/js/stripe-admin.min.js CHANGED
@@ -1 +1 @@
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").trigger("change"),i("#woocommerce_stripe_payment_request").on("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()}).trigger("change"),i("#woocommerce_stripe_payment_request_button_type").on("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()}).trigger("change"),i("#woocommerce_stripe_payment_request_button_type").on("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()}).trigger("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"))}),i("form").find("input, select").on("change input",function e(){i("#wc_stripe_connect_button").addClass("disabled"),i("#wc_stripe_connect_button").on("click",function(){return!1}),i("#woocommerce_stripe_api_credentials").next("p").append(" (Please save changes before selecting this button.)"),i("form").find("input, select").off("change input",e)});var e=Date.now()/1e3-wc_stripe_settings_params.time,s=240<Math.abs(e);i("#woocommerce_stripe_test_webhook_secret, #woocommerce_stripe_webhook_secret").on("change input",function(){var e=i(this).closest("td"),t=e.find(".webhook_secret_time_sync_warning");if(0<i(this).val().length){var o=0<t.length;s&&!o&&e.append('<p class="webhook_secret_time_sync_warning">'+wc_stripe_settings_params.i18n_out_of_sync+"</p>")}else t.remove()}).change()}};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"):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").trigger("change"),i("#woocommerce_stripe_payment_request").on("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()}).trigger("change"),i("#woocommerce_stripe_payment_request_button_type").on("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()}).trigger("change"),i("#woocommerce_stripe_payment_request_button_type").on("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()}).trigger("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"),e=i(this).closest("tr").find(".input-text");"text"==e.attr("type")?(e.attr("type","password"),t.removeClass("dashicons-hidden"),t.addClass("dashicons-visibility")):(e.attr("type","text"),t.removeClass("dashicons-visibility"),t.addClass("dashicons-hidden"))}),i("form").find("input, select").on("change input",function e(){i("#wc_stripe_connect_button").addClass("disabled"),i("#wc_stripe_connect_button").on("click",function(){return!1}),i("#woocommerce_stripe_api_credentials").next("p").append(" (Please save changes before selecting this button.)"),i("form").find("input, select").off("change input",e)});var e=Date.now()/1e3-wc_stripe_settings_params.time;240<Math.abs(e)&&i("#woocommerce_stripe_test_webhook_secret, #woocommerce_stripe_webhook_secret").closest("td").append("<p>"+wc_stripe_settings_params.i18n_out_of_sync+"</p>")}};e.init()});
assets/js/stripe-payment-request.js CHANGED
@@ -2,7 +2,9 @@
2
  jQuery( function( $ ) {
3
  'use strict';
4
 
5
- var stripe = Stripe( wc_stripe_payment_request_params.stripe.key ),
 
 
6
  paymentRequestType;
7
 
8
  /**
@@ -542,7 +544,7 @@ jQuery( function( $ ) {
542
  },
543
 
544
  createGooglePayButton: function () {
545
- var allowedThemes = [ 'dark', 'light' ];
546
  var allowedTypes = [ 'short', 'long' ];
547
 
548
  var theme = wc_stripe_payment_request_params.button.theme;
@@ -550,14 +552,15 @@ jQuery( function( $ ) {
550
  var locale = wc_stripe_payment_request_params.button.locale;
551
  var height = wc_stripe_payment_request_params.button.height;
552
  theme = allowedThemes.includes( theme ) ? theme : 'light';
 
553
  type = allowedTypes.includes( type ) ? type : 'long';
554
 
555
  var button = $( '<button type="button" id="wc-stripe-branded-button" aria-label="Google Pay" class="gpay-button"></button>' );
556
  button.css( 'height', height + 'px' );
557
  button.addClass( theme + ' ' + type );
558
  if ( 'long' === type ) {
559
- var url = 'https://www.gstatic.com/instantbuy/svg/' + theme + '/' + locale + '.svg';
560
- var fallbackUrl = 'https://www.gstatic.com/instantbuy/svg/' + theme + '/en.svg';
561
  // Check if locale GPay button exists, default to en if not
562
  setBackgroundImageWithFallback( button, url, fallbackUrl );
563
  }
@@ -610,8 +613,20 @@ jQuery( function( $ ) {
610
  }
611
  });
612
 
 
 
 
 
 
 
 
 
 
 
 
 
613
  $( document.body ).on( 'woocommerce_variation_has_changed', function () {
614
- wc_stripe_payment_request.blockPaymentRequestButton( prButton );
615
 
616
  $.when( wc_stripe_payment_request.getSelectedProductData() ).then( function ( response ) {
617
  $.when(
@@ -620,7 +635,7 @@ jQuery( function( $ ) {
620
  displayItems: response.displayItems,
621
  } )
622
  ).then( function () {
623
- wc_stripe_payment_request.unblockPaymentRequestButton( prButton );
624
  } );
625
  });
626
  } );
@@ -628,17 +643,17 @@ jQuery( function( $ ) {
628
  // Block the payment request button as soon as an "input" event is fired, to avoid sync issues
629
  // when the customer clicks on the button before the debounced event is processed.
630
  $( '.quantity' ).on( 'input', '.qty', function() {
631
- wc_stripe_payment_request.blockPaymentRequestButton( prButton );
632
  } );
633
 
634
  $( '.quantity' ).on( 'input', '.qty', wc_stripe_payment_request.debounce( 250, function() {
635
- wc_stripe_payment_request.blockPaymentRequestButton( prButton );
636
  paymentRequestError = [];
637
 
638
  $.when( wc_stripe_payment_request.getSelectedProductData() ).then( function ( response ) {
639
  if ( response.error ) {
640
  paymentRequestError = [ response.error ];
641
- wc_stripe_payment_request.unblockPaymentRequestButton( prButton );
642
  } else {
643
  $.when(
644
  paymentRequest.update( {
@@ -646,7 +661,7 @@ jQuery( function( $ ) {
646
  displayItems: response.displayItems,
647
  } )
648
  ).then( function () {
649
- wc_stripe_payment_request.unblockPaymentRequestButton( prButton );
650
  });
651
  }
652
  } );
@@ -678,24 +693,22 @@ jQuery( function( $ ) {
678
  }
679
  },
680
 
681
- blockPaymentRequestButton: function( prButton ) {
682
  // check if element isn't already blocked before calling block() to avoid blinking overlay issues
683
  // blockUI.isBlocked is either undefined or 0 when element is not blocked
684
  if ( $( '#wc-stripe-payment-request-button' ).data( 'blockUI.isBlocked' ) ) {
685
  return;
686
  }
687
 
688
- $( '#wc-stripe-payment-request-button' ).block( { message: null } );
689
- if ( wc_stripe_payment_request.isCustomPaymentRequestButton( prButton ) ) {
690
- prButton.addClass( 'is-blocked' );
691
- }
692
  },
693
 
694
- unblockPaymentRequestButton: function( prButton ) {
695
- $( '#wc-stripe-payment-request-button' ).unblock();
696
- if ( wc_stripe_payment_request.isCustomPaymentRequestButton( prButton ) ) {
697
- prButton.removeClass( 'is-blocked' );
698
- }
699
  },
700
 
701
  /**
2
  jQuery( function( $ ) {
3
  'use strict';
4
 
5
+ var stripe = Stripe( wc_stripe_payment_request_params.stripe.key, {
6
+ locale: typeof wc_stripe_params !== 'undefined' ? wc_stripe_params.stripe_locale : 'auto',
7
+ } ),
8
  paymentRequestType;
9
 
10
  /**
544
  },
545
 
546
  createGooglePayButton: function () {
547
+ var allowedThemes = [ 'dark', 'light', 'light-outline' ];
548
  var allowedTypes = [ 'short', 'long' ];
549
 
550
  var theme = wc_stripe_payment_request_params.button.theme;
552
  var locale = wc_stripe_payment_request_params.button.locale;
553
  var height = wc_stripe_payment_request_params.button.height;
554
  theme = allowedThemes.includes( theme ) ? theme : 'light';
555
+ var gpaySvgTheme = 'dark' === theme ? 'dark' : 'light';
556
  type = allowedTypes.includes( type ) ? type : 'long';
557
 
558
  var button = $( '<button type="button" id="wc-stripe-branded-button" aria-label="Google Pay" class="gpay-button"></button>' );
559
  button.css( 'height', height + 'px' );
560
  button.addClass( theme + ' ' + type );
561
  if ( 'long' === type ) {
562
+ var url = 'https://www.gstatic.com/instantbuy/svg/' + gpaySvgTheme + '/' + locale + '.svg';
563
+ var fallbackUrl = 'https://www.gstatic.com/instantbuy/svg/' + gpaySvgTheme + '/en.svg';
564
  // Check if locale GPay button exists, default to en if not
565
  setBackgroundImageWithFallback( button, url, fallbackUrl );
566
  }
613
  }
614
  });
615
 
616
+ $( document.body ).on( 'wc_stripe_unblock_payment_request_button wc_stripe_enable_payment_request_button', function () {
617
+ wc_stripe_payment_request.unblockPaymentRequestButton();
618
+ } );
619
+
620
+ $( document.body ).on( 'wc_stripe_block_payment_request_button', function () {
621
+ wc_stripe_payment_request.blockPaymentRequestButton( 'wc_request_button_is_blocked' );
622
+ } );
623
+
624
+ $( document.body ).on( 'wc_stripe_disable_payment_request_button', function () {
625
+ wc_stripe_payment_request.blockPaymentRequestButton( 'wc_request_button_is_disabled' );
626
+ } );
627
+
628
  $( document.body ).on( 'woocommerce_variation_has_changed', function () {
629
+ $( document.body ).trigger( 'wc_stripe_block_payment_request_button' );
630
 
631
  $.when( wc_stripe_payment_request.getSelectedProductData() ).then( function ( response ) {
632
  $.when(
635
  displayItems: response.displayItems,
636
  } )
637
  ).then( function () {
638
+ $( document.body ).trigger( 'wc_stripe_unblock_payment_request_button' );
639
  } );
640
  });
641
  } );
643
  // Block the payment request button as soon as an "input" event is fired, to avoid sync issues
644
  // when the customer clicks on the button before the debounced event is processed.
645
  $( '.quantity' ).on( 'input', '.qty', function() {
646
+ $( document.body ).trigger( 'wc_stripe_block_payment_request_button' );
647
  } );
648
 
649
  $( '.quantity' ).on( 'input', '.qty', wc_stripe_payment_request.debounce( 250, function() {
650
+ $( document.body ).trigger( 'wc_stripe_block_payment_request_button' );
651
  paymentRequestError = [];
652
 
653
  $.when( wc_stripe_payment_request.getSelectedProductData() ).then( function ( response ) {
654
  if ( response.error ) {
655
  paymentRequestError = [ response.error ];
656
+ $( document.body ).trigger( 'wc_stripe_unblock_payment_request_button' );
657
  } else {
658
  $.when(
659
  paymentRequest.update( {
661
  displayItems: response.displayItems,
662
  } )
663
  ).then( function () {
664
+ $( document.body ).trigger( 'wc_stripe_unblock_payment_request_button' );
665
  });
666
  }
667
  } );
693
  }
694
  },
695
 
696
+ blockPaymentRequestButton: function( cssClassname ) {
697
  // check if element isn't already blocked before calling block() to avoid blinking overlay issues
698
  // blockUI.isBlocked is either undefined or 0 when element is not blocked
699
  if ( $( '#wc-stripe-payment-request-button' ).data( 'blockUI.isBlocked' ) ) {
700
  return;
701
  }
702
 
703
+ $( '#wc-stripe-payment-request-button' )
704
+ .addClass( cssClassname )
705
+ .block( { message: null } );
 
706
  },
707
 
708
+ unblockPaymentRequestButton: function() {
709
+ $( '#wc-stripe-payment-request-button' )
710
+ .removeClass( ['wc_request_button_is_blocked', 'wc_request_button_is_disabled'] )
711
+ .unblock();
 
712
  },
713
 
714
  /**
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,r=0;return t.each(function(){var t=i(this).data("attribute_name")||i(this).attr("name"),e=i(this).val()||"";0<e.length&&r++,n++,a[t]=e}),{count:n,chosenCount:r,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,r=a.owner.phone,s=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!==r?r:t.payerPhone&&t.payerPhone.replace("/[() -]/g",""),billing_country:null!==s?s.country:"",billing_address_1:null!==s?s.line1:"",billing_address_2:null!==s?s.line2:"",billing_city:null!==s?s.city:"",billing_state:null!==s?s.state:"",billing_postcode:null!==s?s.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)},displayErrorMessage:function(t){if(i(".woocommerce-error").remove(),wc_stripe_payment_request_params.is_product_page){var e=i(".product").first();e.before(t),i("html, body").animate({scrollTop:e.prev(".woocommerce-error").offset().top},600)}else{var a=i(".shop_table.cart").closest("form");a.before(t),i("html, body").animate({scrollTop:a.prev(".woocommerce-error").offset().top},600)}},abortPayment:function(t,e){t.complete("fail"),p.displayErrorMessage(e)},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),"PR"===e.country&&(e.country="US");try{var n=u.paymentRequest(e),r=u.elements({locale:wc_stripe_payment_request_params.button.locale}),s=p.createPaymentRequestButton(r,n);n.canMakePayment().then(function(t){t&&(o=t.applePay?"apple_pay":"payment_request_api",p.attachPaymentRequestButtonEventListeners(s,n),p.showPaymentRequestButton(s))}),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)})})}catch(t){console.error(t)}},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,r,s){var i;return function(){var t=this,e=arguments,a=s&&!i;clearTimeout(i),i=setTimeout(function(){i=null,s||r.apply(t,e)},n),a&&r.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 r=i('<button type="button" id="wc-stripe-branded-button" aria-label="Google Pay" class="gpay-button"></button>');r.css("height",n+"px"),r.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}(r,"https://www.gstatic.com/instantbuy/svg/"+t+"/"+a+".svg","https://www.gstatic.com/instantbuy/svg/"+t+"/en.svg");return r},attachPaymentRequestButtonEventListeners:function(t,e){t.on("click",function(t){i("body").addClass("woocommerce-stripe-prb-clicked")}),wc_stripe_payment_request_params.is_product_page?p.attachProductPageEventListeners(t,e):p.attachCartPageEventListeners(t,e)},attachProductPageEventListeners:function(e,a){var n=[],r=i(".single_add_to_cart_button");e.on("click",function(t){return r.is(".disabled")?(t.preventDefault(),void(r.is(".wc-variation-is-unavailable")?window.alert(wc_add_to_cart_variation_params.i18n_unavailable_text):r.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,{locale:"undefined"!=typeof wc_stripe_params?wc_stripe_params.stripe_locale:"auto"}),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,r=0;return t.each(function(){var t=i(this).data("attribute_name")||i(this).attr("name"),e=i(this).val()||"";0<e.length&&r++,n++,a[t]=e}),{count:n,chosenCount:r,data:a}},processSource:function(t,e){e=p.getOrderData(t,e);return i.ajax({type:"POST",data:e,dataType:"json",url:p.getAjaxURL("create_order")})},getOrderData:function(t,e){var a=t.source,n=a.owner.email,r=a.owner.phone,s=a.owner.address,i=a.owner.name,o=t.shippingAddress,e={_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!==r?r:t.payerPhone&&t.payerPhone.replace("/[() -]/g",""),billing_country:null!==s?s.country:"",billing_address_1:null!==s?s.line1:"",billing_address_2:null!==s?s.line2:"",billing_city:null!==s?s.city:"",billing_state:null!==s?s.state:"",billing_postcode:null!==s?s.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&&(e.shipping_first_name=o.recipient.split(" ").slice(0,1).join(" "),e.shipping_last_name=o.recipient.split(" ").slice(1).join(" "),e.shipping_company=o.organization,e.shipping_country=o.country,e.shipping_address_1=void 0===o.addressLine[0]?"":o.addressLine[0],e.shipping_address_2=void 0===o.addressLine[1]?"":o.addressLine[1],e.shipping_city=o.city,e.shipping_state=o.region,e.shipping_postcode=o.postalCode),e},getErrorMessageHTML:function(t){return i('<div class="woocommerce-error" />').text(t)},displayErrorMessage:function(t){var e;i(".woocommerce-error").remove(),wc_stripe_payment_request_params.is_product_page?((e=i(".product").first()).before(t),i("html, body").animate({scrollTop:e.prev(".woocommerce-error").offset().top},600)):((e=i(".shop_table.cart").closest("form")).before(t),i("html, body").animate({scrollTop:e.prev(".woocommerce-error").offset().top},600))},abortPayment:function(t,e){t.complete("fail"),p.displayErrorMessage(e)},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){e={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:e,url:p.getAjaxURL("get_shipping_options")})},updateShippingDetails:function(t,e){e={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:e,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:[]},t=i("form.cart").serializeArray();return i.each(t,function(t,e){var a;/^addon-/.test(e.name)&&(/\[\]$/.test(e.name)?(a=e.name.substring(0,e.name.length-2),n[a]?n[a].push(e.value):n[a]=[e.value]):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 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);"PR"===e.country&&(e.country="US");try{var n=u.paymentRequest(e),r=u.elements({locale:wc_stripe_payment_request_params.button.locale}),s=p.createPaymentRequestButton(r,n);n.canMakePayment().then(function(t){t&&(o=t.applePay?"apple_pay":"payment_request_api",p.attachPaymentRequestButtonEventListeners(s,n),p.showPaymentRequestButton(s))}),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)})})}catch(t){console.error(t)}},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),e={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:e,url:p.getAjaxURL("get_selected_product_data")})},debounce:function(n,r,s){var i;return function(){var t=this,e=arguments,a=s&&!i;clearTimeout(i),i=setTimeout(function(){i=null,s||r.apply(t,e)},n),a&&r.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,t=e&&window.navigator.brave;return e&&!t},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,r="dark"===(t=["dark","light","light-outline"].includes(t)?t:"light")?"dark":"light",e=["short","long"].includes(e)?e:"long",s=i('<button type="button" id="wc-stripe-branded-button" aria-label="Google Pay" class="gpay-button"></button>');return 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/"+r+"/"+a+".svg","https://www.gstatic.com/instantbuy/svg/"+r+"/en.svg"),s},attachPaymentRequestButtonEventListeners:function(t,e){t.on("click",function(t){i("body").addClass("woocommerce-stripe-prb-clicked")}),wc_stripe_payment_request_params.is_product_page?p.attachProductPageEventListeners(t,e):p.attachCartPageEventListeners(t,e)},attachProductPageEventListeners:function(e,a){var n=[],r=i(".single_add_to_cart_button");e.on("click",function(t){return r.is(".disabled")?(t.preventDefault(),void(r.is(".wc-variation-is-unavailable")?window.alert(wc_add_to_cart_variation_params.i18n_unavailable_text):r.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("wc_stripe_unblock_payment_request_button wc_stripe_enable_payment_request_button",function(){p.unblockPaymentRequestButton()}),i(document.body).on("wc_stripe_block_payment_request_button",function(){p.blockPaymentRequestButton("wc_request_button_is_blocked")}),i(document.body).on("wc_stripe_disable_payment_request_button",function(){p.blockPaymentRequestButton("wc_request_button_is_disabled")}),i(document.body).on("woocommerce_variation_has_changed",function(){i(document.body).trigger("wc_stripe_block_payment_request_button"),i.when(p.getSelectedProductData()).then(function(t){i.when(a.update({total:t.total,displayItems:t.displayItems})).then(function(){i(document.body).trigger("wc_stripe_unblock_payment_request_button")})})}),i(".quantity").on("input",".qty",function(){i(document.body).trigger("wc_stripe_block_payment_request_button")}),i(".quantity").on("input",".qty",p.debounce(250,function(){i(document.body).trigger("wc_stripe_block_payment_request_button"),n=[],i.when(p.getSelectedProductData()).then(function(t){t.error?(n=[t.error],i(document.body).trigger("wc_stripe_unblock_payment_request_button")):i.when(a.update({total:t.total,displayItems:t.displayItems})).then(function(){i(document.body).trigger("wc_stripe_unblock_payment_request_button")})})}))},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").addClass(t).block({message:null})},unblockPaymentRequestButton:function(){i("#wc-stripe-payment-request-button").removeClass(["wc_request_button_is_blocked","wc_request_button_is_disabled"]).unblock()},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
@@ -4,7 +4,9 @@ jQuery( function( $ ) {
4
  'use strict';
5
 
6
  try {
7
- var stripe = Stripe( wc_stripe_params.key );
 
 
8
  } catch( error ) {
9
  console.log( error );
10
  return;
4
  'use strict';
5
 
6
  try {
7
+ var stripe = Stripe( wc_stripe_params.key, {
8
+ locale: wc_stripe_params.stripe_locale || 'auto',
9
+ } );
10
  } catch( error ) {
11
  console.log( error );
12
  return;
assets/js/stripe.min.js CHANGED
@@ -1 +1 @@
1
- jQuery(function(c){"use strict";try{var n=Stripe(wc_stripe_params.key)}catch(e){return void console.log(e)}var t,o,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:{},s=n.elements(e),a=s.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"),o.unmount("#stripe-exp-element"),i.unmount("#stripe-cvc-element"))},mountElements:function(){c("#stripe-card-element").length&&("yes"!==wc_stripe_params.inline_cc_form?(t.mount("#stripe-card-element"),o.mount("#stripe-exp-element"),i.mount("#stripe-cvc-element")):t.mount("#stripe-card-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=s.create("card",{style:e,hidePostalCode:!0})).addEventListener("change",function(e){m.onCCFormChange(),e.error&&c(document.body).trigger("stripeError",e)}):(t=s.create("cardNumber",{style:e,classes:r}),o=s.create("cardExpiry",{style:e,classes:r}),i=s.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)}),o.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&&a.mount("#stripe-iban-element"))}):(c("form#add_payment_method").length||c("form#order_review").length)&&(m.mountElements(),c("#stripe-iban-element").length&&a.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"),o="stripe-credit-card-brand";e in r&&(o=r[e]),c.each(r,function(e,r){t.removeClass(r)}),t.addClass(o)},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),a.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",n.createSource(a,e).then(m.sourceResponse)):n.createSource(t,e).then(m.sourceResponse)},sourceResponse:function(e){e.error?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("#wc-stripe-change-payment-method").length?m.sourceSetup(e):m.form.trigger("submit"))},sourceSetup:function(r){var e={error:{type:"api_connection_error"}};c.post({url:m.getAjaxURL("create_setup_intent"),dataType:"json",data:{stripe_source_id:r.source.id,nonce:wc_stripe_params.add_card_nonce},error:function(){c(document.body).trigger("stripeError",e)}}).done(function(e){if("success"===e.status)return c("form#add_payment_method").length&&c(m.form).off("submit",m.form.onSubmit),void m.form.trigger("submit");"requires_action"===e.status?n.confirmCardSetup(e.client_secret,{payment_method:r.source.id}).then(function(e){e.error?c(document.body).trigger("stripeError",e):(c("form#add_payment_method").length&&c(m.form).off("submit",m.form.onSubmit),m.form.trigger("submit"))}).catch(function(e){console.log(e),c(document.body).trigger("stripeError",{error:e})}):c(document.body).trigger("stripeError",e)})},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");e.error?(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)):c(r).html("")},onError:function(e,r){var t,o=r.error.message,n=m.getSelectedPaymentElement().closest("li"),i=n.find(".woocommerce-SavedPaymentMethods-tokenInput");if(c("body").hasClass("woocommerce-stripe-prb-clicked"))c("body").removeClass("woocommerce-stripe-prb-clicked"),t=c("div.woocommerce-notices-wrapper").first();else if(i.length){var s=i.filter(":checked");t=s.closest(".woocommerce-SavedPaymentMethods-new").length?c("#wc-stripe-cc-form .stripe-source-errors"):s.closest("li").find(".stripe-source-errors")}else t=n.find(".stripe-source-errors");if(m.isSepaChosen()&&"invalid_owner_name"===r.error.code&&wc_stripe_params.hasOwnProperty(r.error.code)){var a=c('<div><ul class="woocommerce-error"><li /></ul></div>');return a.find("li").text(wc_stripe_params[r.error.code]),void m.submitError(a.html())}"email_invalid"===r.error.code?o=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||(o=wc_stripe_params.invalid_request_error),"card_error"===r.error.type&&wc_stripe_params.hasOwnProperty(r.error.code)&&(o=wc_stripe_params[r.error.code]),"validation_error"===r.error.type&&wc_stripe_params.hasOwnProperty(r.error.code)&&(o=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(o),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").trigger("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],o=decodeURIComponent(e[3]);window.location.hash="",m.openIntentModal(t,o,!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,o){n[o?"handleCardSetup":"handleCardPayment"](e).then(function(e){if(e.error)throw e.error;var r=e[o?"setupIntent":"paymentIntent"];"requires_capture"!==r.status&&"succeeded"!==r.status||(window.location=t)}).catch(function(e){r?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=JSON.parse(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(a){"use strict";try{var n=Stripe(wc_stripe_params.key,{locale:wc_stripe_params.stripe_locale||"auto"})}catch(e){return void console.log(e)}var t,o,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:{},s=n.elements(e),c=s.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"),o.unmount("#stripe-exp-element"),i.unmount("#stripe-cvc-element"))},mountElements:function(){a("#stripe-card-element").length&&("yes"!==wc_stripe_params.inline_cc_form?(t.mount("#stripe-card-element"),o.mount("#stripe-exp-element"),i.mount("#stripe-cvc-element")):t.mount("#stripe-card-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||e,r=wc_stripe_params.elements_classes||r;"yes"===wc_stripe_params.inline_cc_form?(t=s.create("card",{style:e,hidePostalCode:!0})).addEventListener("change",function(e){m.onCCFormChange(),e.error&&a(document.body).trigger("stripeError",e)}):(t=s.create("cardNumber",{style:e,classes:r}),o=s.create("cardExpiry",{style:e,classes:r}),i=s.create("cardCvc",{style:e,classes:r}),t.addEventListener("change",function(e){m.onCCFormChange(),m.updateCardBrand(e.brand),e.error&&a(document.body).trigger("stripeError",e)}),o.addEventListener("change",function(e){m.onCCFormChange(),e.error&&a(document.body).trigger("stripeError",e)}),i.addEventListener("change",function(e){m.onCCFormChange(),e.error&&a(document.body).trigger("stripeError",e)})),"yes"===wc_stripe_params.is_checkout?a(document.body).on("updated_checkout",function(){a("#stripe-card-element").children().length||(t&&m.unmountElements(),m.mountElements(),a("#stripe-iban-element").length&&c.mount("#stripe-iban-element"))}):(a("form#add_payment_method").length||a("form#order_review").length)&&(m.mountElements(),a("#stripe-iban-element").length&&c.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=a(".stripe-card-brand"),e=e in r?r[e]:"stripe-credit-card-brand";a.each(r,function(e,r){t.removeClass(r)}),t.addClass(e)},init:function(){"yes"!==wc_stripe_params.is_change_payment_page&&"yes"!==wc_stripe_params.is_pay_for_order_page||a(document.body).trigger("wc-credit-card-form-init"),a("form.woocommerce-checkout").length&&(this.form=a("form.woocommerce-checkout")),a("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),a("form#order_review").length&&(this.form=a("form#order_review")),a("form#order_review, form#add_payment_method").on("submit",this.onSubmit),a("form#add_payment_method").length&&(this.form=a("form#add_payment_method")),a("form.woocommerce-checkout").on("change",this.reset),a(document).on("stripeError",this.onError).on("checkout_error",this.reset),c.on("change",this.onSepaError),a("#early_renewal_modal_submit").on("click",this.onEarlyRenewalSubmit),m.createElements(),window.addEventListener("hashchange",m.onHashChange),m.maybeConfirmIntent()},isStripeChosen:function(){return a("#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")||a("#payment_method_stripe").is(":checked")&&"new"===a('input[name="wc-stripe-payment-token"]:checked').val()||a("#payment_method_stripe_sepa").is(":checked")&&"new"===a('input[name="wc-stripe-payment-token"]:checked').val()},isStripeSaveCardChosen:function(){return a("#payment_method_stripe").is(":checked")&&a('input[name="wc-stripe-payment-token"]').is(":checked")&&"new"!==a('input[name="wc-stripe-payment-token"]:checked').val()||a("#payment_method_stripe_sepa").is(":checked")&&a('input[name="wc-stripe_sepa-payment-token"]').is(":checked")&&"new"!==a('input[name="wc-stripe_sepa-payment-token"]:checked').val()},isStripeCardChosen:function(){return a("#payment_method_stripe").is(":checked")},isBancontactChosen:function(){return a("#payment_method_stripe_bancontact").is(":checked")},isGiropayChosen:function(){return a("#payment_method_stripe_giropay").is(":checked")},isIdealChosen:function(){return a("#payment_method_stripe_ideal").is(":checked")},isSofortChosen:function(){return a("#payment_method_stripe_sofort").is(":checked")},isAlipayChosen:function(){return a("#payment_method_stripe_alipay").is(":checked")},isSepaChosen:function(){return a("#payment_method_stripe_sepa").is(":checked")},isP24Chosen:function(){return a("#payment_method_stripe_p24").is(":checked")},isEpsChosen:function(){return a("#payment_method_stripe_eps").is(":checked")},isMultibancoChosen:function(){return a("#payment_method_stripe_multibanco").is(":checked")},hasSource:function(){return 0<a("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 a('.payment_methods input[name="payment_method"]:checked')},getOwnerDetails:function(){var e=a("#billing_first_name").length?a("#billing_first_name").val():wc_stripe_params.billing_first_name,r=a("#billing_last_name").length?a("#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:a("#stripe-payment-data").data("full-name"),t.email=a("#billing_email").val(),t.phone=a("#billing_phone").val(),(void 0===t.phone||t.phone.length<=0)&&delete t.phone,(void 0===t.email||t.email.length<=0)&&(a("#stripe-payment-data").data("email").length?t.email=a("#stripe-payment-data").data("email"):delete t.email),(void 0===t.name||t.name.length<=0)&&delete t.name,t.address.line1=a("#billing_address_1").val()||wc_stripe_params.billing_address_1,t.address.line2=a("#billing_address_2").val()||wc_stripe_params.billing_address_2,t.address.state=a("#billing_state").val()||wc_stripe_params.billing_state,t.address.city=a("#billing_city").val()||wc_stripe_params.billing_city,t.address.postal_code=a("#billing_postcode").val()||wc_stripe_params.billing_postcode,t.address.country=a("#billing_country").val()||wc_stripe_params.billing_country,{owner:t}},createSource:function(){var e=m.getOwnerDetails();return m.isSepaChosen()?(e.currency=a("#stripe-sepa_debit-payment-data").data("currency"),e.mandate={notification_method:wc_stripe_params.sepa_mandate_notification},e.type="sepa_debit",n.createSource(c,e).then(m.sourceResponse)):n.createSource(t,e).then(m.sourceResponse)},sourceResponse:function(e){e.error?a(document.body).trigger("stripeError",e):(m.reset(),m.form.append(a('<input type="hidden" />').addClass("stripe-source").attr("name","stripe_source").val(e.source.id)),a("form#add_payment_method").length||a("#wc-stripe-change-payment-method").length?m.sourceSetup(e):m.form.trigger("submit"))},sourceSetup:function(r){var e={error:{type:"api_connection_error"}};a.post({url:m.getAjaxURL("create_setup_intent"),dataType:"json",data:{stripe_source_id:r.source.id,nonce:wc_stripe_params.add_card_nonce},error:function(){a(document.body).trigger("stripeError",e)}}).done(function(e){return"success"===e.status?(a("form#add_payment_method").length&&a(m.form).off("submit",m.form.onSubmit),void m.form.trigger("submit")):void("requires_action"===e.status?n.confirmCardSetup(e.client_secret,{payment_method:r.source.id}).then(function(e){e.error?a(document.body).trigger("stripeError",e):(a("form#add_payment_method").length&&a(m.form).off("submit",m.form.onSubmit),m.form.trigger("submit"))}).catch(function(e){console.log(e),a(document.body).trigger("stripeError",{error:e})}):a(document.body).trigger("stripeError",e))})},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(){a(".wc-stripe-error, .stripe-source").remove()},onSepaError:function(e){var r=m.getSelectedPaymentElement().parents("li").eq(0).find(".stripe-source-errors");e.error?(console.log(e.error.message),a(r).html('<ul class="woocommerce_error woocommerce-error wc-stripe-error"><li /></ul>'),a(r).find("li").text(e.error.message)):a(r).html("")},onError:function(e,r){var t,o=r.error.message,n=m.getSelectedPaymentElement().closest("li"),i=n.find(".woocommerce-SavedPaymentMethods-tokenInput"),s=a("body").hasClass("woocommerce-stripe-prb-clicked");if(t=s?(a("body").removeClass("woocommerce-stripe-prb-clicked"),a("div.woocommerce-notices-wrapper").first()):i.length?(t=i.filter(":checked")).closest(".woocommerce-SavedPaymentMethods-new").length?a("#wc-stripe-cc-form .stripe-source-errors"):t.closest("li").find(".stripe-source-errors"):n.find(".stripe-source-errors"),m.isSepaChosen()&&"invalid_owner_name"===r.error.code&&wc_stripe_params.hasOwnProperty(r.error.code)){n=a('<div><ul class="woocommerce-error"><li /></ul></div>');return n.find("li").text(wc_stripe_params[r.error.code]),void m.submitError(n.html())}"email_invalid"===r.error.code?o=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||(o=wc_stripe_params.invalid_request_error),"card_error"===r.error.type&&wc_stripe_params.hasOwnProperty(r.error.code)&&(o=wc_stripe_params[r.error.code]),"validation_error"===r.error.type&&wc_stripe_params.hasOwnProperty(r.error.code)&&(o=wc_stripe_params[r.error.code]),m.reset(),a(".woocommerce-NoticeGroup-checkout").remove(),console.log(r.error.message),a(t).html('<ul class="woocommerce_error woocommerce-error wc-stripe-error"><li /></ul>'),a(t).find("li").text(o),a(".wc-stripe-error").length&&a("html, body").animate({scrollTop:a(".wc-stripe-error").offset().top-200},200),m.unblock(),a.unblockUI()},submitError:function(e){a(".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").trigger("blur");e="";a("#add_payment_method").length&&(e=a("#add_payment_method")),a("#order_review").length&&(e=a("#order_review")),(e=a("form.checkout").length?a("form.checkout"):e).length&&a("html, body").animate({scrollTop:e.offset().top-100},500),a(document.body).trigger("checkout_error"),m.unblock()},onHashChange:function(){var e,r,t=window.location.hash.match(/^#?confirm-(pi|si)-([^:]+):(.+)$/);!t||t.length<4||(e=t[1],r=t[2],t=decodeURIComponent(t[3]),window.location.hash="",m.openIntentModal(r,t,!1,"si"===e))},maybeConfirmIntent:function(){var e,r;a("#stripe-intent-id").length&&a("#stripe-intent-return").length&&(e=a("#stripe-intent-id").val(),r=a("#stripe-intent-return").val(),m.openIntentModal(e,r,!0,!1))},openIntentModal:function(e,r,t,o){n[o?"handleCardSetup":"handleCardPayment"](e).then(function(e){if(e.error)throw e.error;e=e[o?"setupIntent":"paymentIntent"];"requires_capture"!==e.status&&"succeeded"!==e.status||(window.location=r)}).catch(function(e){t?window.location=r:(a(document.body).trigger("stripeError",{error:e}),m.form&&m.form.removeClass("processing"),a.get(r+"&is_ajax"))})},onEarlyRenewalSubmit:function(e){return e.preventDefault(),a.ajax({url:a("#early_renewal_modal_submit").attr("href"),method:"get",success:function(e){e=JSON.parse(e);e.stripe_sca_required?m.openIntentModal(e.intent_secret,e.redirect_url,!0,!1):window.location=e.redirect_url}}),!1}};m.init()});
build/index.asset.php ADDED
@@ -0,0 +1 @@
 
1
+ <?php return array('dependencies' => array('jquery', 'react', 'wc-blocks-registry', 'wc-settings', 'wp-element', 'wp-i18n', 'wp-polyfill'), 'version' => '70bf8f00a445ed6d4cd6dfa3cc471382');
build/index.js ADDED
@@ -0,0 +1 @@
 
1
+ !function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=20)}([function(e,t){e.exports=window.wp.element},function(e,t){e.exports=window.wp.i18n},function(e,t){e.exports=function(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t,n){var r=n(13),o=n(14),i=n(15),c=n(17);e.exports=function(e,t){return r(e)||o(e,t)||i(e,t)||c()},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t,n){!function(e,t){"use strict";function n(e){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function r(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function o(){}function i(){}t=t&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t,i.resetWarningCache=o;var c=function(e,t){return function(e){e.exports=function(){function e(e,t,n,r,o,i){if("SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"!==i){var c=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw c.name="Invariant Violation",c}}function t(){return e}e.isRequired=e;var n={array:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:i,resetWarningCache:o};return n.PropTypes=n,n}()}(t={exports:{}}),t.exports}(),a=function(e){return null!==e&&"object"===n(e)},s=function e(t,n){if(!a(t)||!a(n))return t===n;var r=Array.isArray(t);if(r!==Array.isArray(n))return!1;var o="[object Object]"===Object.prototype.toString.call(t);if(o!==("[object Object]"===Object.prototype.toString.call(n)))return!1;if(!o&&!r)return!1;var i=Object.keys(t),c=Object.keys(n);if(i.length!==c.length)return!1;for(var s={},u=0;u<i.length;u+=1)s[i[u]]=!0;for(var l=0;l<c.length;l+=1)s[c[l]]=!0;var p=Object.keys(s);if(p.length!==i.length)return!1;var d=t,f=n;return p.every((function(t){return e(d[t],f[t])}))},u=function(e){var n=t.useRef(e);return t.useEffect((function(){n.current=e}),[e]),n.current},l=function(e){if(null===e||a(t=e)&&"function"==typeof t.elements&&"function"==typeof t.createToken&&"function"==typeof t.createPaymentMethod&&"function"==typeof t.confirmCardPayment)return e;var t;throw new Error("Invalid prop `stripe` supplied to `Elements`. We recommend using the `loadStripe` utility from `@stripe/stripe-js`. See https://stripe.com/docs/stripe-js/react#elements-props-stripe for details.")},p=t.createContext(null);p.displayName="ElementsContext";var d=function(e){var n,o,i=e.stripe,c=e.options,d=e.children,f=t.useRef(!1),m=t.useRef(!0),y=t.useMemo((function(){return function(e){if(function(e){return a(e)&&"function"==typeof e.then}(e))return{tag:"async",stripePromise:Promise.resolve(e).then(l)};var t=l(e);return null===t?{tag:"empty"}:{tag:"sync",stripe:t}}(i)}),[i]),v=(n=t.useState((function(){return{stripe:null,elements:null}})),o=2,function(e){if(Array.isArray(e))return e}(n)||function(e,t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e)){var n=[],_n=!0,r=!1,o=void 0;try{for(var i,c=e[Symbol.iterator]();!(_n=(i=c.next()).done)&&(n.push(i.value),!t||n.length!==t);_n=!0);}catch(e){r=!0,o=e}finally{try{_n||null==c.return||c.return()}finally{if(r)throw o}}return n}}(n,o)||function(e,t){if(e){if("string"==typeof e)return r(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?r(e,t):void 0}}(n,o)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),b=v[0],_=v[1],g=u(i),h=u(c);return null!==g&&(g!==i&&console.warn("Unsupported prop change on Elements: You cannot change the `stripe` prop after setting it."),s(c,h)||console.warn("Unsupported prop change on Elements: You cannot change the `options` prop after setting the `stripe` prop.")),f.current||("sync"===y.tag&&(f.current=!0,_({stripe:y.stripe,elements:y.stripe.elements(c)})),"async"===y.tag&&(f.current=!0,y.stripePromise.then((function(e){e&&m.current&&_({stripe:e,elements:e.elements(c)})})))),t.useEffect((function(){return function(){m.current=!1}}),[]),t.useEffect((function(){var e=b.stripe;e&&e._registerWrapper&&e._registerWrapper({name:"react-stripe-js",version:"1.2.2"})}),[b.stripe]),t.createElement(p.Provider,{value:b},d)};d.propTypes={stripe:c.any,options:c.object};var f=function(e){return function(e,t){if(!e)throw new Error("Could not find Elements context; You need to wrap the part of your app that ".concat(t," in an <Elements> provider."));return e}(t.useContext(p),e)},m=function(e){return(0,e.children)(f("mounts <ElementsConsumer>"))};m.propTypes={children:c.func.isRequired};var y=function(e){var n=t.useRef(e);return t.useEffect((function(){n.current=e}),[e]),function(){n.current&&n.current.apply(n,arguments)}},v=function(e){return a(e)?(e.paymentRequest,function(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}(e,["paymentRequest"])):{}},b=function(){},_=function(e,n){var r,o="".concat((r=e).charAt(0).toUpperCase()+r.slice(1),"Element"),i=n?function(e){f("mounts <".concat(o,">"));var n=e.id,r=e.className;return t.createElement("div",{id:n,className:r})}:function(n){var r=n.id,i=n.className,c=n.options,a=void 0===c?{}:c,u=n.onBlur,l=void 0===u?b:u,p=n.onFocus,d=void 0===p?b:p,m=n.onReady,_=void 0===m?b:m,g=n.onChange,h=void 0===g?b:g,w=n.onEscape,O=void 0===w?b:w,E=n.onClick,j=void 0===E?b:E,C=f("mounts <".concat(o,">")).elements,x=t.useRef(null),S=t.useRef(null),R=y(_),P=y(l),T=y(d),k=y(j),A=y(h),I=y(O);t.useLayoutEffect((function(){if(null==x.current&&C&&null!=S.current){var t=C.create(e,a);x.current=t,t.mount(S.current),t.on("ready",(function(){return R(t)})),t.on("change",A),t.on("blur",P),t.on("focus",T),t.on("escape",I),t.on("click",k)}}));var M=t.useRef(a);return t.useEffect((function(){M.current&&M.current.paymentRequest!==a.paymentRequest&&console.warn("Unsupported prop change: options.paymentRequest is not a customizable property.");var e=v(a);0===Object.keys(e).length||s(e,v(M.current))||x.current&&(x.current.update(e),M.current=a)}),[a]),t.useLayoutEffect((function(){return function(){x.current&&x.current.destroy()}}),[]),t.createElement("div",{id:r,className:i,ref:S})};return i.propTypes={id:c.string,className:c.string,onChange:c.func,onBlur:c.func,onFocus:c.func,onReady:c.func,onClick:c.func,options:c.object},i.displayName=o,i.__elementType=e,i},g="undefined"==typeof window,h=_("auBankAccount",g),w=_("card",g),O=_("cardNumber",g),E=_("cardExpiry",g),j=_("cardCvc",g),C=_("fpxBank",g),x=_("iban",g),S=_("idealBank",g),R=_("paymentRequestButton",g);e.AuBankAccountElement=h,e.CardCvcElement=j,e.CardElement=w,e.CardExpiryElement=E,e.CardNumberElement=O,e.Elements=d,e.ElementsConsumer=m,e.FpxBankElement=C,e.IbanElement=x,e.IdealBankElement=S,e.PaymentRequestButtonElement=R,e.useElements=function(){return f("calls useElements()").elements},e.useStripe=function(){return f("calls useStripe()").stripe},Object.defineProperty(e,"__esModule",{value:!0})}(t,n(19))},function(e,t){e.exports=window.regeneratorRuntime},function(e,t){e.exports=window.jQuery},function(e,t){function n(e,t,n,r,o,i,c){try{var a=e[i](c),s=a.value}catch(e){return void n(e)}a.done?t(s):Promise.resolve(s).then(r,o)}e.exports=function(e){return function(){var t=this,r=arguments;return new Promise((function(o,i){var c=e.apply(t,r);function a(e){n(c,o,i,a,s,"next",e)}function s(e){n(c,o,i,a,s,"throw",e)}a(void 0)}))}},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t,n){var r=n(18);e.exports=function(e,t){if(null==e)return{};var n,o,i=r(e,t);if(Object.getOwnPropertySymbols){var c=Object.getOwnPropertySymbols(e);for(o=0;o<c.length;o++)n=c[o],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t){e.exports=window.wc.wcSettings},function(e,t){e.exports=window.wc.wcBlocksRegistry},function(e,t){function n(){return e.exports=n=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},e.exports.default=e.exports,e.exports.__esModule=!0,n.apply(this,arguments)}e.exports=n,e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t){function n(t){return"function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?(e.exports=n=function(e){return typeof e},e.exports.default=e.exports,e.exports.__esModule=!0):(e.exports=n=function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e.exports.default=e.exports,e.exports.__esModule=!0),n(t)}e.exports=n,e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t){e.exports=function(e){if(Array.isArray(e))return e},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t){e.exports=function(e,t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e)){var n=[],_n=!0,r=!1,o=void 0;try{for(var i,c=e[Symbol.iterator]();!(_n=(i=c.next()).done)&&(n.push(i.value),!t||n.length!==t);_n=!0);}catch(e){r=!0,o=e}finally{try{_n||null==c.return||c.return()}finally{if(r)throw o}}return n}},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t,n){var r=n(16);e.exports=function(e,t){if(e){if("string"==typeof e)return r(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?r(e,t):void 0}},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t){e.exports=function(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t){e.exports=function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t){e.exports=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(o[n]=e[n]);return o},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t){e.exports=window.React},function(e,t,n){"use strict";n.r(t);var r=n(10),o=n(11),i=n.n(o),c=n(3),a=n.n(c),s=n(8),u=n.n(s),l=n(0),p=n(1),d=n(2),f=n.n(d),m=n(9),y={INVALID_EMAIL:"email_invalid",INVALID_REQUEST:"invalid_request_error",API_CONNECTION:"api_connection_error",API_ERROR:"api_error",AUTHENTICATION_ERROR:"authentication_error",RATE_LIMIT_ERROR:"rate_limit_error",CARD_ERROR:"card_error",VALIDATION_ERROR:"validation_error"},v=function(){var e=Object(m.getSetting)("stripe_data",null);if(!e)throw new Error("Stripe initialization data is not available");return e},b=function(e){return[y.INVALID_REQUEST,y.API_CONNECTION,y.API_ERROR,y.AUTHENTICATION_ERROR,y.RATE_LIMIT_ERROR].includes(e)},_=function(e){var t;return(t={},f()(t,"invalid_number",Object(p.__)("The card number is not a valid credit card number.","woocommerce-gateway-stripe")),f()(t,"invalid_expiry_month",Object(p.__)("The card expiration month is invalid.","woocommerce-gateway-stripe")),f()(t,"invalid_expiry_year",Object(p.__)("The card expiration year is invalid.","woocommerce-gateway-stripe")),f()(t,"invalid_cvc",Object(p.__)("The card security code is invalid.","woocommerce-gateway-stripe")),f()(t,"incorrect_number",Object(p.__)("The card number is incorrect.","woocommerce-gateway-stripe")),f()(t,"incomplete_number",Object(p.__)("The card number is incomplete.","woocommerce-gateway-stripe")),f()(t,"incomplete_cvc",Object(p.__)("The card security code is incomplete.","woocommerce-gateway-stripe")),f()(t,"incomplete_expiry",Object(p.__)("The card expiration date is incomplete.","woocommerce-gateway-stripe")),f()(t,"expired_card",Object(p.__)("The card has expired.","woocommerce-gateway-stripe")),f()(t,"incorrect_cvc",Object(p.__)("The card security code is incorrect.","woocommerce-gateway-stripe")),f()(t,"incorrect_zip",Object(p.__)("The card zip code failed validation.","woocommerce-gateway-stripe")),f()(t,"invalid_expiry_year_past",Object(p.__)("The card expiration year is in the past","woocommerce-gateway-stripe")),f()(t,"card_declined",Object(p.__)("The card was declined.","woocommerce-gateway-stripe")),f()(t,"missing",Object(p.__)("There is no card on a customer that is being charged.","woocommerce-gateway-stripe")),f()(t,"processing_error",Object(p.__)("An error occurred while processing the card.","woocommerce-gateway-stripe")),t)[e]||null},g=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";switch(e){case y.INVALID_EMAIL:return Object(p.__)("Invalid email address, please correct and try again.","woocommerce-gateway-stripe");case b(e):return Object(p.__)("Unable to process this payment, please try again or use alternative method.","woocommerce-gateway-stripe");case y.CARD_ERROR:return _(t);case y.VALIDATION_ERROR:return""}return null},h="https://js.stripe.com/v3",w=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/,O="loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used",E=null,j=function(e,t,n){if(null===e)return null;var r=e.apply(void 0,t);return function(e,t){e&&e._registerWrapper&&e._registerWrapper({name:"stripe-js",version:"1.11.0",startTime:t})}(r,n),r},C=Promise.resolve().then((function(){return e=null,null!==E?E:E=new Promise((function(t,n){if("undefined"!=typeof window)if(window.Stripe&&e&&console.warn(O),window.Stripe)t(window.Stripe);else try{var r=function(){for(var e=document.querySelectorAll('script[src^="'.concat(h,'"]')),t=0;t<e.length;t++){var n=e[t];if(w.test(n.src))return n}return null}();r&&e?console.warn(O):r||(r=function(e){var t=e&&!e.advancedFraudSignals?"?advancedFraudSignals=false":"",n=document.createElement("script");n.src="".concat(h).concat(t);var r=document.head||document.body;if(!r)throw new Error("Expected document.body not to be null. Stripe.js requires a <body> element.");return r.appendChild(n),n}(e)),r.addEventListener("load",(function(){window.Stripe?t(window.Stripe):n(new Error("Stripe.js not available"))})),r.addEventListener("error",(function(){n(new Error("Failed to load Stripe.js"))}))}catch(e){return void n(e)}else t(null)}));var e})),x=!1;C.catch((function(e){x||console.warn(e)}));var S=function(){return new Promise((function(e){try{var t,n,r=null!==(t=null===(n=v())||void 0===n?void 0:n.stripeLocale)&&void 0!==t?t:"auto";e(function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];x=!0;var r=Date.now();return C.then((function(e){return j(e,t,r)}))}(function(){var e=v().publicKey;if(!e)throw new Error("There is no api key available for stripe. Make sure it is available on the wc.stripe_data.stripe.key property.");return e}(),{locale:r}))}catch(t){e({error:t})}}))},R=n(4),P=n(7),T=n.n(P),k=n(5),A=n.n(k),I=function(e){var t=e.stripe,n=e.paymentDetails,r=e.errorContext,o=e.errorType,i={type:e.successType};if(!n.setup_intent&&!n.payment_intent_secret)return!0;var c=!!n.setupIntent,a=n.verification_endpoint,s=c?n.setup_intent:n.payment_intent_secret;return t[c?"confirmCardSetup":"confirmCardPayment"](s).then((function(e){if(e.error)throw e.error;var t=e[c?"setupIntent":"paymentIntent"];return"requires_capture"!==t.status&&"succeeded"!==t.status||(i.redirectUrl=a),i})).catch((function(e){return i.type=o,i.message=e.message,i.retry=!0,i.messageContext=r,window.fetch(a+"&is_ajax"),i}))},M=function(e,t,n,r){Object(l.useEffect)((function(){var o=t(function(){var t=T()(A.a.mark((function t(o){var i,c,a;return A.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return i=o.processingResponse,c=i.paymentDetails||{},t.next=4,I({stripe:e,paymentDetails:c,errorContext:r.noticeContexts.PAYMENTS,errorType:r.responseTypes.ERROR,successType:r.responseTypes.SUCCESS});case 4:return(a=t.sent).type===r.responseTypes.ERROR&&a.retry&&n(""),t.abrupt("return",a);case 7:case"end":return t.stop()}}),t)})));return function(_x){return t.apply(this,arguments)}}());return function(){return o()}}),[t,r.noticeContexts.PAYMENTS,r.responseTypes.ERROR,r.responseTypes.SUCCESS,n,e])},N=function(){},q=function(e){var t=e.eventRegistration,n=e.emitResponse,r=Object(R.useStripe)(),o=t.onCheckoutAfterProcessingWithSuccess;return M(r,o,N,n),null},L=n(12),D=n.n(L);function B(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function U(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?B(Object(n),!0).forEach((function(t){f()(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):B(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var F={style:{base:{iconColor:"#666EE8",color:"#31325F",fontSize:function(e,t,n){var r={};if("object"===("undefined"==typeof document?"undefined":D()(document))&&"function"==typeof document.querySelector&&"function"==typeof window.getComputedStyle){var o=document.querySelector(".wc-block-checkout");o&&(r=window.getComputedStyle(o))}return r.fontSize||"16px"}(),lineHeight:1.375,"::placeholder":{color:"#fff"}}},classes:{focus:"focused",empty:"empty",invalid:"has-error"}},V=function(e){var t=Object(l.useState)(!1),n=a()(t,2),r=n[0],o=n[1],i=Object(l.useState)(U(U({},F),e)),c=a()(i,2),s=c[0],u=c[1],p=Object(l.useState)(""),d=a()(p,2),f=d[0],m=d[1];return Object(l.useEffect)((function(){var e=r?"#CFD7E0":"#fff";u((function(t){var n=void 0!==t.showIcon?{showIcon:r}:{};return U(U({},t),{},{style:U(U({},t.style),{},{base:U(U({},t.style.base),{},{"::placeholder":{color:e}})})},n)}))}),[r]),{options:s,onActive:Object(l.useCallback)((function(e){o(!e||function(e){return!e})}),[o]),error:f,setError:m}};function H(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function W(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?H(Object(n),!0).forEach((function(t){f()(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):H(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var Y,z,Z,$,Q=function(e){var t=e.inputErrorComponent,n=e.onChange,r=Object(l.useState)(!0),o=a()(r,2),i=o[0],c=o[1],s=V({hidePostalCode:!0}),u=s.options,d=s.onActive,f=s.error,m=s.setError;return Object(l.createElement)(l.Fragment,null,Object(l.createElement)("div",{className:"wc-block-gateway-container wc-inline-card-element"},Object(l.createElement)(R.CardElement,{id:"wc-stripe-inline-card-element",className:"wc-block-gateway-input",options:u,onBlur:function(){return d(i)},onFocus:function(){return d(i)},onChange:function(e){e.error?m(e.error.message):m(""),c(e.empty),n(e)}}),Object(l.createElement)("label",{htmlFor:"wc-stripe-inline-card-element"},Object(p.__)("Credit Card Information","woocommerce-gateway-stripe"))),Object(l.createElement)(t,{errorMessage:f}))},G=function(e){var t=e.onChange,n=e.inputErrorComponent,r=Object(l.useState)({cardNumber:!0,cardExpiry:!0,cardCvc:!0}),o=a()(r,2),i=o[0],c=o[1],s=V({showIcon:!1}),u=s.options,d=s.onActive,m=s.error,y=s.setError,v=V(),b=v.options,_=v.onActive,g=v.error,h=v.setError,w=V(),O=w.options,E=w.onActive,j=w.error,C=w.setError,x=function(e,n){return function(r){r.error?e(r.error.message):e(""),c(W(W({},i),{},f()({},n,r.empty))),t(r)}};return Object(l.createElement)("div",{className:"wc-block-card-elements"},Object(l.createElement)("div",{className:"wc-block-gateway-container wc-card-number-element"},Object(l.createElement)(R.CardNumberElement,{onChange:x(y,"cardNumber"),options:u,className:"wc-block-gateway-input",id:"wc-stripe-card-number-element",onFocus:function(){return d(i.cardNumber)},onBlur:function(){return d(i.cardNumber)}}),Object(l.createElement)("label",{htmlFor:"wc-stripe-card-number-element"},Object(p.__)("Card Number","woocommerce-gateway-stripe")),Object(l.createElement)(n,{errorMessage:m})),Object(l.createElement)("div",{className:"wc-block-gateway-container wc-card-expiry-element"},Object(l.createElement)(R.CardExpiryElement,{onChange:x(h,"cardExpiry"),options:b,className:"wc-block-gateway-input",onFocus:function(){return _(i.cardExpiry)},onBlur:function(){return _(i.cardExpiry)},id:"wc-stripe-card-expiry-element"}),Object(l.createElement)("label",{htmlFor:"wc-stripe-card-expiry-element"},Object(p.__)("Expiry Date","woocommerce-gateway-stripe")),Object(l.createElement)(n,{errorMessage:g})),Object(l.createElement)("div",{className:"wc-block-gateway-container wc-card-cvc-element"},Object(l.createElement)(R.CardCvcElement,{onChange:x(C,"cardCvc"),options:O,className:"wc-block-gateway-input",onFocus:function(){return E(i.cardCvc)},onBlur:function(){return E(i.cardCvc)},id:"wc-stripe-card-code-element"}),Object(l.createElement)("label",{htmlFor:"wc-stripe-card-code-element"},Object(p.__)("CVV/CVC","woocommerce-gateway-stripe")),Object(l.createElement)(n,{errorMessage:j})))},K=function(){return Object.entries(v().icons).map((function(e){var t=a()(e,2),n=t[0],r=t[1];return{id:n,src:r.src,alt:r.alt}}))},J=function(e){var t=e.billing,n=e.eventRegistration,r=e.emitResponse,o=e.components,i=o.ValidationInputError,c=o.PaymentMethodIcons,s=Object(l.useState)(""),u=a()(s,2),p=u[0],d=u[1],f=Object(R.useStripe)(),m=function(e,t,n,r,o,i){var c=Object(l.useState)(""),s=a()(c,2),u=s[0],p=s[1],d=Object(l.useCallback)((function(e){var t,n=e.error.type,r=e.error.code||"",o=null!==(t=g(n,r))&&void 0!==t?t:e.error.message;return p(o),o}),[]),f=e.onCheckoutAfterProcessingWithSuccess,m=e.onPaymentProcessing,b=e.onCheckoutAfterProcessingWithError;return M(i,f,r,o),function(e,t,n,r,o,i,c,a){var s=Object(R.useElements)();Object(l.useEffect)((function(){var u=function(){var e=T()(A.a.mark((function e(t){var r;return A.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=v().inline_cc_form?R.CardElement:R.CardNumberElement,e.next=3,n.createSource(null==s?void 0:s.getElement(r),{type:"card",owner:t});case 3:return e.abrupt("return",e.sent);case 4:case"end":return e.stop()}}),e)})));return function(_x){return e.apply(this,arguments)}}(),l=a(function(){var n=T()(A.a.mark((function n(){var a,s,l,p,d;return A.a.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(n.prev=0,l=r.billingData,!t){n.next=4;break}return n.abrupt("return",{type:o.responseTypes.ERROR,message:t});case 4:if(""===i){n.next=6;break}return n.abrupt("return",{type:o.responseTypes.SUCCESS,meta:{paymentMethodData:{paymentMethod:"stripe",paymentRequestType:"cc",stripe_source:i},billingData:l}});case 6:return p={address:{line1:l.address_1,line2:l.address_2,city:l.city,state:l.state,postal_code:l.postcode,country:l.country}},l.phone&&(p.phone=l.phone),l.email&&(p.email=l.email),(l.first_name||l.last_name)&&(p.name="".concat(l.first_name," ").concat(l.last_name)),n.next=12,u(p);case 12:if(!(d=n.sent).error){n.next=15;break}return n.abrupt("return",{type:o.responseTypes.ERROR,message:e(d)});case 15:if(d.source&&d.source.id){n.next=17;break}throw new Error(g(y.API_ERROR));case 17:return c(d.source.id),n.abrupt("return",{type:o.responseTypes.SUCCESS,meta:{paymentMethodData:{stripe_source:d.source.id,billing_email:p.email,billing_first_name:null!==(a=null==l?void 0:l.first_name)&&void 0!==a?a:"",billing_last_name:null!==(s=null==l?void 0:l.last_name)&&void 0!==s?s:"",paymentMethod:"stripe",paymentRequestType:"cc"},billingData:l}});case 21:return n.prev=21,n.t0=n.catch(0),n.abrupt("return",{type:o.responseTypes.ERROR,message:n.t0});case 24:case"end":return n.stop()}}),n,null,[[0,21]])})));return function(){return n.apply(this,arguments)}}());return function(){l()}}),[a,r.billingData,n,i,c,e,t,o.noticeContexts.PAYMENTS,o.responseTypes.ERROR,o.responseTypes.SUCCESS,s])}(d,u,i,t,o,n,r,m),Object(l.useEffect)((function(){var e=b((function(e){var t,n=e.processingResponse;return null==n||null===(t=n.paymentDetails)||void 0===t||!t.errorMessage||{type:o.responseTypes.ERROR,message:n.paymentDetails.errorMessage,messageContext:o.noticeContexts.PAYMENTS}}));return function(){e()}}),[b,o.noticeContexts.PAYMENTS,o.responseTypes.ERROR]),d}(n,t,p,d,r,f),b=function(e){e.error&&m(e),d("")},_=K(),h=v().inline_cc_form?Object(l.createElement)(Q,{onChange:b,inputErrorComponent:i}):Object(l.createElement)(G,{onChange:b,inputErrorComponent:i});return Object(l.createElement)(l.Fragment,null,h,c&&_.length&&Object(l.createElement)(c,{icons:_,align:"left"}))},X=function(e){var t=e.stripe;return Object(l.createElement)(R.Elements,{stripe:t},Object(l.createElement)(J,e))},ee=S(),te=function(e){var t=e.RenderedComponent,n=u()(e,["RenderedComponent"]),r=Object(l.useState)(""),o=a()(r,2),c=o[0],s=o[1];return Object(l.useEffect)((function(){Promise.resolve(ee).then((function(e){var t=e.error;t&&s(t.message)}))}),[s]),Object(l.useEffect)((function(){if(c)throw new Error(c)}),[c]),Object(l.createElement)(t,i()({stripe:ee},n))},ne=K(),re={name:"stripe",label:Object(l.createElement)((function(e){var t=e.components.PaymentMethodLabel,n=v().title?v().title:Object(p.__)("Credit / Debit Card","woocommerce-gateway-stripe");return Object(l.createElement)(t,{text:n})}),null),content:Object(l.createElement)(te,{RenderedComponent:X}),edit:Object(l.createElement)(te,{RenderedComponent:X}),savedTokenComponent:Object(l.createElement)(te,{RenderedComponent:function(e){var t=e.stripe,n=u()(e,["stripe"]);return Object(l.createElement)(R.Elements,{stripe:t},Object(l.createElement)(q,n))}}),icons:ne,canMakePayment:function(){return ee},ariaLabel:Object(p.__)("Stripe Credit Card payment method","woocommerce-gateway-stripe"),supports:{showSavedCards:null!==(Y=v().showSavedCards)&&void 0!==Y&&Y,showSaveOption:null!==(z=v().showSaveOption)&&void 0!==z&&z,features:null!==(Z=null===($=v())||void 0===$?void 0:$.supports)&&void 0!==Z?Z:[]}},oe=function(e){var t,n=e.onButtonClicked,r=null===(t=v())||void 0===t?void 0:t.button,o=r.theme,i=void 0===o?"dark":o,c=r.locale,s=void 0===c?"en":c,u=r.height,p=void 0===u?"44":u,d=wc_stripe_payment_request_params.button.branded_type,f=["short","long"].includes(d)?d:"long",m=function(e,t,n){var r="long"===e?"https://www.gstatic.com/instantbuy/svg/".concat(t,"/").concat(n,".svg"):"https://www.gstatic.com/instantbuy/svg/".concat(t,"_gpay.svg"),o=Object(l.useState)(r),i=a()(o,2),c=i[0],s=i[1];return Object(l.useEffect)((function(){var e=document.createElement("img");e.addEventListener("error",(function(){s("https://www.gstatic.com/instantbuy/svg/".concat(t,"/en.svg"))})),e.src=c}),[c,t]),c}(f,"dark"===i?"dark":"light",s);return Object(l.createElement)("button",{type:"button",id:"wc-stripe-branded-button","aria-label":"Google Pay",className:"gpay-button ".concat(i," ").concat(f),style:{backgroundImage:"url(".concat(m,")"),height:p+"px"},onClick:n})},ie=function(e){var t=e.onButtonClicked,n=v().button,r=n.theme,o=void 0===r?"dark":r,i=n.height,c=void 0===i?"44":i,a=n.customLabel,s=void 0===a?Object(p.__)("Buy now","woocommerce-gateway-stripe"):a;return Object(l.createElement)("button",{type:"button",id:"wc-stripe-custom-button",className:"button ".concat(o," is-active"),style:{height:c+"px"},onClick:t},s)},ce=n(6),ae=n.n(ce);function se(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}var ue,le,pe=function(e){return wc_stripe_payment_request_params.ajax_url.toString().replace("%%endpoint%%","wc_stripe_"+e)},de=function(e){var t,n;(t=e.shippingOption,n={security:wc_stripe_payment_request_params.nonce.update_shipping,shipping_method:[t.id],is_product_page:wc_stripe_payment_request_params.is_product_page},ae.a.ajax({type:"POST",data:n,url:pe("update_shipping_method")})).then((function(t){"success"===t.result&&e.updateWith({status:"success",total:t.total,displayItems:t.displayItems}),"fail"===t.result&&e.updateWith({status:"fail"})}))},fe=function(e,t){Object(l.useEffect)((function(){var n=null==e?void 0:e.on("shippingaddresschange",function(e){return function(t){(function(e,t){var n=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?se(Object(n),!0).forEach((function(t){f()(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):se(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({security:wc_stripe_payment_request_params.nonce.shipping,payment_request_type:t,is_product_page:wc_stripe_payment_request_params.is_product_page},function(e){return{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]}}(e));return ae.a.ajax({type:"POST",data:n,url:pe("get_shipping_options")})})(t.shippingAddress,e).then((function(e){t.updateWith({status:e.result,shippingOptions:e.shipping_options,total:e.total,displayItems:e.displayItems})}))}}(t));return function(){null==n||n.removeAllListeners()}}),[e,t])},me=function(e,t,n,r){Object(l.useEffect)((function(){var o=null==t?void 0:t.on("source",function(e,t,n){return function(r){var o,i,c,a,s,u;"yes"===(null===(o=wc_stripe_payment_request_params)||void 0===o||null===(i=o.stripe)||void 0===i?void 0:i.allow_prepaid_card)||"prepaid"!==(null==r||null===(c=r.source)||void 0===c||null===(a=c.card)||void 0===a?void 0:a.funding)?function(e,t){var n=function(e,t){var n,r,o,i,c,a,s,u,l,p,d,f,m,y,v,b,_,g,h,w,O,E,j,C,x,S,R,P,T=e.source,k=null==T||null===(n=T.owner)||void 0===n?void 0:n.email,A=null==T||null===(r=T.owner)||void 0===r?void 0:r.phone,I=null==T||null===(o=T.owner)||void 0===o?void 0:o.address,M=null==T||null===(i=T.owner)||void 0===i?void 0:i.name,N=null==e?void 0:e.shippingAddress,q={_wpnonce:wc_stripe_payment_request_params.nonce.checkout,billing_first_name:null!==(c=null==M||null===(a=M.split(" "))||void 0===a||null===(s=a.slice(0,1))||void 0===s?void 0:s.join(" "))&&void 0!==c?c:"",billing_last_name:null!==(u=null==M||null===(l=M.split(" "))||void 0===l||null===(p=l.slice(1))||void 0===p?void 0:p.join(" "))&&void 0!==u?u:"",billing_company:"",billing_email:null!=k?k:null==e?void 0:e.payerEmail,billing_phone:null!=A?A:null==e||null===(d=e.payerPhone)||void 0===d?void 0:d.replace("/[() -]/g",""),billing_country:null!==(f=null==I?void 0:I.country)&&void 0!==f?f:"",billing_address_1:null!==(m=null==I?void 0:I.line1)&&void 0!==m?m:"",billing_address_2:null!==(y=null==I?void 0:I.line2)&&void 0!==y?y:"",billing_city:null!==(v=null==I?void 0:I.city)&&void 0!==v?v:"",billing_state:null!==(b=null==I?void 0:I.state)&&void 0!==b?b:"",billing_postcode:null!==(_=null==I?void 0:I.postal_code)&&void 0!==_?_:"",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==e||null===(g=e.shippingOption)||void 0===g?void 0:g.id],order_comments:"",payment_method:"stripe",ship_to_different_address:1,terms:1,stripe_source:T.id,payment_request_type:t};return N&&(q.shipping_first_name=null==N||null===(h=N.recipient)||void 0===h||null===(w=h.split(" "))||void 0===w||null===(O=w.slice(0,1))||void 0===O?void 0:O.join(" "),q.shipping_last_name=null==N||null===(E=N.recipient)||void 0===E||null===(j=E.split(" "))||void 0===j||null===(C=j.slice(1))||void 0===C?void 0:C.join(" "),q.shipping_company=null==N?void 0:N.organization,q.shipping_country=null==N?void 0:N.country,q.shipping_address_1=null!==(x=null==N||null===(S=N.addressLine)||void 0===S?void 0:S[0])&&void 0!==x?x:"",q.shipping_address_2=null!==(R=null==N||null===(P=N.addressLine)||void 0===P?void 0:P[1])&&void 0!==R?R:"",q.shipping_city=null==N?void 0:N.city,q.shipping_state=null==N?void 0:N.region,q.shipping_postcode=null==N?void 0:N.postalCode),q}(e,t);return ae.a.ajax({type:"POST",data:n,dataType:"json",url:pe("create_order")})}(r,t).then(function(e,t,n){return function(r){if("success"===r.result){t.complete("success");var o=function(e){var t=e.match(/^#?confirm-(pi|si)-([^:]+):(.+)$/);if(t&&!(t.length<4))return{type:t[1],clientSecret:t[2],redirectUrl:decodeURIComponent(t[3])}}(r.redirect);if(!o||o.length<4)return void(window.location=r.redirect);var i=o.type,c=o.clientSecret,a=o.redirectUrl;(function(e,t,n){return"si"===t?e.handleCardSetup(n):e.handleCardPayment(n)})(e,i,c).then(function(e,t){return function(n){if(n.error)throw n.error;var r=function(e,t){return"si"===t?e.setupIntent:e.paymentIntent}(n,t);(function(e){return"requires_capture"===e.status}(r)||function(e){return"succeeded"===e.status}(r))&&(window.location=e)}}(a,i)).catch((function(e){n(e.message),ae.a.get(a+"&is_ajax")}))}else{var s,u;t.complete("fail");var l=document.createElement("div");l.innerHTML=r.messages;var p=null!==(s=null==l||null===(u=l.firstChild)||void 0===u?void 0:u.textContent)&&void 0!==s?s:"";n(p)}}}(e,r,n)):n(null===(s=wc_stripe_payment_request_params)||void 0===s||null===(u=s.i18n)||void 0===u?void 0:u.no_prepaid_card)}}(e,n,r));return function(){null==o||o.removeAllListeners()}}),[e,t,n,r])},ye=function(e){var t=e.billing,n=e.shippingData,r=e.onClick,o=e.onClose,i=e.setExpressPaymentError,c=Object(R.useStripe)(),s=function(e,t,n){var r=Object(l.useState)(null),o=a()(r,2),i=o[0],c=o[1],s=Object(l.useState)(null),u=a()(s,2),p=u[0],d=u[1];return Object(l.useEffect)((function(){var t;e&&!i&&(t={security:wc_stripe_payment_request_params.nonce.payment},ae.a.ajax({type:"POST",data:t,url:pe("get_cart_details")})).then((function(t){var n=function(e,t){var n={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};return"PR"===n.country&&(n.country="US"),e.paymentRequest(n)}(e,t);n.canMakePayment().then((function(e){e&&(c(n),e.applePay?d("apple_pay"):e.googlePay?d("google_pay"):d("payment_request_api"))}))}))}),[i,e]),Object(l.useEffect)((function(){c(null)}),[t,n.cartTotal,n.cartTotalItems,n.currency.code]),[i,p]}(c,n.needsShipping,t),u=a()(s,2),p=u[0],d=u[1];fe(p,d),function(e,t){Object(l.useEffect)((function(){var t=null==e?void 0:e.on("shippingoptionchange",de);return function(){null==t||t.removeAllListeners()}}),[e,t])}(p,d),me(c,p,d,i);var f=function(e,t){return Object(l.useCallback)((function(){e(""),t()}),[e,t])}(i,r);!function(e,t){Object(l.useEffect)((function(){null==e||e.on("cancel",(function(){t()}))}),[e,t])}(p,o);var m=v().button,y=m.type,b=void 0===y?"default":y,_=m.theme,g=void 0===_?"dark":_,h=m.height,w={paymentRequestButton:{type:b,theme:g,height:"".concat(void 0===h?"48":h,"px")}},O=wc_stripe_payment_request_params.button.is_branded,E=wc_stripe_payment_request_params.button.branded_type,j=wc_stripe_payment_request_params.button.is_custom;if(!p)return null;var C,x,S,P=function(){f(),p.show()};return j?Object(l.createElement)(ie,{onButtonClicked:P}):O&&(C=window.navigator.userAgent.toLowerCase(),S=(x=/chrome/.test(C)&&!/edge|edg|opr|brave\//.test(C)&&"Google Inc."===window.navigator.vendor)&&window.navigator.brave,x&&!S)?Object(l.createElement)(oe,{onButtonClicked:P}):(O&&(w.paymentRequestButton.type="long"===E?"buy":"default"),Object(l.createElement)(R.PaymentRequestButtonElement,{onClick:f,options:{style:w,paymentRequest:p}}))},ve=S(),be={name:"payment_request",content:Object(l.createElement)((function(e){var t=e.stripe;return Object(l.createElement)(R.Elements,{stripe:t},Object(l.createElement)(ye,e))}),{stripe:ve}),edit:Object(l.createElement)((function(){return Object(l.createElement)("img",{src:"data:image/svg+xml,%3Csvg width='264' height='48' viewBox='0 0 264 48' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Crect width='264' height='48' rx='3' fill='black'/%3E%3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M125.114 16.6407C125.682 15.93 126.067 14.9756 125.966 14C125.135 14.0415 124.121 14.549 123.533 15.2602C123.006 15.8693 122.539 16.8641 122.661 17.7983C123.594 17.8797 124.526 17.3317 125.114 16.6407Z' fill='white'/%3E%3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M125.955 17.982C124.601 17.9011 123.448 18.7518 122.801 18.7518C122.154 18.7518 121.163 18.0224 120.092 18.0421C118.696 18.0629 117.402 18.8524 116.694 20.1079C115.238 22.6196 116.31 26.3453 117.726 28.3909C118.414 29.4028 119.242 30.5174 120.334 30.4769C121.366 30.4365 121.77 29.8087 123.024 29.8087C124.277 29.8087 124.641 30.4769 125.733 30.4567C126.865 30.4365 127.573 29.4443 128.261 28.4313C129.049 27.2779 129.373 26.1639 129.393 26.1027C129.373 26.0825 127.209 25.2515 127.189 22.7606C127.169 20.6751 128.888 19.6834 128.969 19.6217C127.998 18.1847 126.481 18.0224 125.955 17.982Z' fill='white'/%3E%3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M136.131 23.1804H138.834C140.886 23.1804 142.053 22.0752 142.053 20.1592C142.053 18.2432 140.886 17.1478 138.845 17.1478H136.131V23.1804ZM139.466 15.1582C142.411 15.1582 144.461 17.1903 144.461 20.1483C144.461 23.1172 142.369 25.1596 139.392 25.1596H136.131V30.3498H133.775V15.1582H139.466Z' fill='white'/%3E%3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M152.198 26.224V25.3712L149.579 25.5397C148.106 25.6341 147.339 26.182 147.339 27.14C147.339 28.0664 148.138 28.6667 149.39 28.6667C150.988 28.6667 152.198 27.6449 152.198 26.224ZM145.046 27.2032C145.046 25.2551 146.529 24.1395 149.263 23.971L152.198 23.7922V22.9498C152.198 21.7181 151.388 21.0442 149.947 21.0442C148.758 21.0442 147.896 21.6548 147.717 22.5916H145.592C145.656 20.6232 147.507 19.1914 150.01 19.1914C152.703 19.1914 154.459 20.602 154.459 22.7917V30.351H152.282V28.5298H152.229C151.609 29.719 150.241 30.4666 148.758 30.4666C146.571 30.4666 145.046 29.1612 145.046 27.2032Z' fill='white'/%3E%3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M156.461 34.4145V32.5934C156.608 32.6141 156.965 32.6354 157.155 32.6354C158.196 32.6354 158.785 32.1932 159.142 31.0564L159.353 30.3824L155.366 19.3281H157.827L160.604 28.298H160.657L163.434 19.3281H165.832L161.698 30.9402C160.752 33.6038 159.668 34.4778 157.376 34.4778C157.197 34.4778 156.618 34.4565 156.461 34.4145Z' fill='white'/%3E%3C/svg%3E%0A",alt:""})}),null),canMakePayment:function(e){var t,n;return!(null===(t=null===(n=v())||void 0===n?void 0:n.isAdmin)||void 0===t||!t)||"undefined"!=typeof wc_stripe_payment_request_params&&S().then((function(t){var n,r,o,i,c;return t.paymentRequest({total:{label:"Total",amount:parseInt(null!==(n=null==e||null===(r=e.cartTotals)||void 0===r?void 0:r.total_price)&&void 0!==n?n:0,10),pending:!0},country:null===(o=Object(m.getSetting)("baseLocation",{}))||void 0===o?void 0:o.country,currency:null==e||null===(i=e.cartTotals)||void 0===i||null===(c=i.currency_code)||void 0===c?void 0:c.toLowerCase()}).canMakePayment()}))},paymentMethodId:"stripe",supports:{features:null!==(ue=null===(le=v())||void 0===le?void 0:le.supports)&&void 0!==ue?ue:[]}};Object(r.registerPaymentMethod)(re),Object(r.registerExpressPaymentMethod)(be)}]);
changelog.txt CHANGED
@@ -1,4 +1,20 @@
1
  *** Changelog ***
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
  = 5.1.0 - 2021-04-07 =
3
  * Fix - Don't attempt to submit level 3 data for non-US merchants.
4
  * Fix - Hide Payment Request Buttons when guest checkout is disabled.
1
  *** Changelog ***
2
+
3
+ = 5.2.0 - 2021-05-19 =
4
+ * Fix - Use `get_parent` method to avoid accessing `order` subscription property directly.
5
+ * Fix - Orders won't transition to 'Refunded' state if refund can't be created.
6
+ * Fix - Normalize United Kingdom and Canada postal codes for Apple Pay.
7
+ * Fix - Subscription sign-up fees not included in total for Payment Request Button.
8
+ * Fix - Reduce requests sent to server from stripe settings page.
9
+ * Fix - Choose the appropriate version of the WooCommerce Admin Notes API based on which API is available.
10
+ * Fix - Customer information is now correctly displayed in the Stripe Payments Dashboard when a new customer checks out through the WooCommerce Checkout Block.
11
+ * Fix - Pass customer language/locale to Stripe upon creation or modification.
12
+ * Fix - Initial price for Variable Products is now correctly shown when a Payment Request is started.
13
+ * Add - Support for Credit Card payments (incl. 3DS payments) via WooCommerce Blocks; limited to WooCommerce Core product types.
14
+ * Add - Support for payments (incl. 3DS payments) paid via Payment Request Buttons in WooCommerce Blocks; limited to WooCommerce Core product types.
15
+ * Add - Support for custom and branded Payment Request Buttons when using the Cart and Checkout blocks.
16
+ * Tweak - Should customer opt to save their card, the card is now saved after a payment has been confirmed.
17
+
18
  = 5.1.0 - 2021-04-07 =
19
  * Fix - Don't attempt to submit level 3 data for non-US merchants.
20
  * Fix - Hide Payment Request Buttons when guest checkout is disabled.
includes/abstracts/abstract-wc-stripe-payment-gateway.php CHANGED
@@ -118,7 +118,7 @@ abstract class WC_Stripe_Payment_Gateway extends WC_Payment_Gateway_CC {
118
  return (
119
  $error &&
120
  'invalid_request_error' === $error->type &&
121
- preg_match( '/No such source/i', $error->message )
122
  );
123
  }
124
 
@@ -188,6 +188,12 @@ abstract class WC_Stripe_Payment_Gateway extends WC_Payment_Gateway_CC {
188
  return parent::is_available();
189
  }
190
 
 
 
 
 
 
 
191
  /**
192
  * Checks if we need to process pre orders when
193
  * pre orders is in the cart.
@@ -635,7 +641,7 @@ abstract class WC_Stripe_Payment_Gateway extends WC_Payment_Gateway_CC {
635
  * actually reusable. Either that or force_save_source is true.
636
  */
637
  if ( ( $user_id && $this->saved_cards && $maybe_saved_card && 'reusable' === $source_object->usage ) || $force_save_source ) {
638
- $response = $customer->add_source( $source_object->id );
639
 
640
  if ( ! empty( $response->error ) ) {
641
  throw new WC_Stripe_Exception( print_r( $response, true ), $this->get_localized_error_message_from_response( $response ) );
@@ -665,7 +671,7 @@ abstract class WC_Stripe_Payment_Gateway extends WC_Payment_Gateway_CC {
665
 
666
  // This is true if the user wants to store the card to their account.
667
  if ( ( $user_id && $this->saved_cards && $maybe_saved_card ) || $force_save_source ) {
668
- $response = $customer->add_source( $stripe_token );
669
 
670
  if ( ! empty( $response->error ) ) {
671
  throw new WC_Stripe_Exception( print_r( $response, true ), $response->error->message );
@@ -673,7 +679,7 @@ abstract class WC_Stripe_Payment_Gateway extends WC_Payment_Gateway_CC {
673
  if ( is_wp_error( $response ) ) {
674
  throw new WC_Stripe_Exception( $response->get_error_message(), $response->get_error_message() );
675
  }
676
- $source_id = $response;
677
  } else {
678
  $source_id = $stripe_token;
679
  $is_token = true;
@@ -912,7 +918,14 @@ abstract class WC_Stripe_Payment_Gateway extends WC_Payment_Gateway_CC {
912
  if ( ! empty( $response->error ) ) {
913
  WC_Stripe_Logger::log( 'Error: ' . $response->error->message );
914
 
915
- return $response;
 
 
 
 
 
 
 
916
 
917
  } elseif ( ! empty( $response->id ) ) {
918
  $formatted_amount = wc_price( $response->amount / 100 );
@@ -1080,6 +1093,13 @@ abstract class WC_Stripe_Payment_Gateway extends WC_Payment_Gateway_CC {
1080
  ],
1081
  ];
1082
 
 
 
 
 
 
 
 
1083
  if ( $prepared_source->customer ) {
1084
  $request['customer'] = $prepared_source->customer;
1085
  }
118
  return (
119
  $error &&
120
  'invalid_request_error' === $error->type &&
121
+ preg_match( '/No such (source|PaymentMethod)/i', $error->message )
122
  );
123
  }
124
 
188
  return parent::is_available();
189
  }
190
 
191
+ public function save_payment_method_requested() {
192
+ $payment_method = isset( $_POST['payment_method'] ) ? wc_clean( wp_unslash( $_POST['payment_method'] ) ) : 'stripe';
193
+
194
+ return isset( $_POST[ 'wc-' . $payment_method . '-new-payment-method' ] ) && ! empty( $_POST[ 'wc-' . $payment_method . '-new-payment-method' ] );
195
+ }
196
+
197
  /**
198
  * Checks if we need to process pre orders when
199
  * pre orders is in the cart.
641
  * actually reusable. Either that or force_save_source is true.
642
  */
643
  if ( ( $user_id && $this->saved_cards && $maybe_saved_card && 'reusable' === $source_object->usage ) || $force_save_source ) {
644
+ $response = $customer->attach_source( $source_object->id );
645
 
646
  if ( ! empty( $response->error ) ) {
647
  throw new WC_Stripe_Exception( print_r( $response, true ), $this->get_localized_error_message_from_response( $response ) );
671
 
672
  // This is true if the user wants to store the card to their account.
673
  if ( ( $user_id && $this->saved_cards && $maybe_saved_card ) || $force_save_source ) {
674
+ $response = $customer->attach_source( $stripe_token );
675
 
676
  if ( ! empty( $response->error ) ) {
677
  throw new WC_Stripe_Exception( print_r( $response, true ), $response->error->message );
679
  if ( is_wp_error( $response ) ) {
680
  throw new WC_Stripe_Exception( $response->get_error_message(), $response->get_error_message() );
681
  }
682
+ $source_id = $response->id;
683
  } else {
684
  $source_id = $stripe_token;
685
  $is_token = true;
918
  if ( ! empty( $response->error ) ) {
919
  WC_Stripe_Logger::log( 'Error: ' . $response->error->message );
920
 
921
+ return new WP_Error(
922
+ 'stripe_error',
923
+ sprintf(
924
+ /* translators: %1$s is a stripe error message */
925
+ __( 'There was a problem initiating a refund: %1$s', 'woocommerce-gateway-stripe' ),
926
+ $response->error->message
927
+ )
928
+ );
929
 
930
  } elseif ( ! empty( $response->id ) ) {
931
  $formatted_amount = wc_price( $response->amount / 100 );
1093
  ],
1094
  ];
1095
 
1096
+ $force_save_source = apply_filters( 'wc_stripe_force_save_source', false, $prepared_source->source );
1097
+
1098
+ if ( $this->save_payment_method_requested() || $force_save_source ) {
1099
+ $request['setup_future_usage'] = 'off_session';
1100
+ $request['metadata']['save_payment_method'] = 'true';
1101
+ }
1102
+
1103
  if ( $prepared_source->customer ) {
1104
  $request['customer'] = $prepared_source->customer;
1105
  }
includes/admin/class-wc-stripe-inbox-notes.php CHANGED
@@ -1,11 +1,9 @@
1
  <?php
 
2
  if ( ! defined( 'ABSPATH' ) ) {
3
  exit;
4
  }
5
 
6
- use Automattic\WooCommerce\Admin\Notes\WC_Admin_Note;
7
- use Automattic\WooCommerce\Admin\Notes\WC_Admin_Notes;
8
-
9
  /**
10
  * Class that adds Inbox notifications.
11
  *
@@ -49,11 +47,8 @@ class WC_Stripe_Inbox_Notes {
49
  * Manage notes to show after Apple Pay domain verification.
50
  */
51
  public static function notify_on_apple_pay_domain_verification( $verification_complete ) {
52
- if ( ! class_exists( 'Automattic\WooCommerce\Admin\Notes\WC_Admin_Notes' ) ) {
53
- return;
54
- }
55
-
56
- if ( ! class_exists( 'WC_Data_Store' ) ) {
57
  return;
58
  }
59
 
@@ -63,7 +58,7 @@ class WC_Stripe_Inbox_Notes {
63
  // Delete all previously created, soft deleted and unactioned failure notes (Legacy).
64
  while ( ! empty( $failure_note_ids ) ) {
65
  $note_id = array_pop( $failure_note_ids );
66
- $note = WC_Admin_Notes::get_note( $note_id );
67
  $note->delete();
68
  }
69
  } catch ( Exception $e ) {} // @codingStandardsIgnoreLine
@@ -121,10 +116,11 @@ class WC_Stripe_Inbox_Notes {
121
  }
122
 
123
  try {
124
- $note = new WC_Admin_Note();
 
125
  $note->set_title( self::get_success_title() );
126
  $note->set_content( __( 'Now that you accept Apple Pay® with Stripe, you can increase conversion rates by letting your customers know that Apple Pay is available. Here’s a marketing guide to help you get started.', 'woocommerce-gateway-stripe' ) );
127
- $note->set_type( WC_Admin_Note::E_WC_ADMIN_NOTE_MARKETING );
128
  $note->set_name( self::SUCCESS_NOTE_NAME );
129
  $note->set_source( 'woocommerce-gateway-stripe' );
130
  $note->add_action(
@@ -141,10 +137,11 @@ class WC_Stripe_Inbox_Notes {
141
  */
142
  public static function create_failure_note() {
143
  try {
144
- $note = new WC_Admin_Note();
 
145
  $note->set_title( __( 'Apple Pay domain verification needed', 'woocommerce-gateway-stripe' ) );
146
  $note->set_content( __( 'The WooCommerce Stripe Gateway extension attempted to perform domain verification on behalf of your store, but was unable to do so. This must be resolved before Apple Pay can be offered to your customers.', 'woocommerce-gateway-stripe' ) );
147
- $note->set_type( WC_Admin_Note::E_WC_ADMIN_NOTE_INFORMATIONAL );
148
  $note->set_name( self::FAILURE_NOTE_NAME );
149
  $note->set_source( 'woocommerce-gateway-stripe' );
150
  $note->add_action(
@@ -162,11 +159,8 @@ class WC_Stripe_Inbox_Notes {
162
  * on/about 2020 Dec 22.
163
  */
164
  public static function cleanup_campaign_2020() {
165
- if ( ! class_exists( 'Automattic\WooCommerce\Admin\Notes\WC_Admin_Notes' ) ) {
166
- return;
167
- }
168
-
169
- if ( ! class_exists( 'WC_Data_Store' ) ) {
170
  return;
171
  }
172
 
@@ -184,10 +178,11 @@ class WC_Stripe_Inbox_Notes {
184
 
185
  $deleted_an_unactioned_note = false;
186
 
 
187
  foreach ( (array) $note_ids as $note_id ) {
188
  try {
189
- $note = new WC_Admin_Note( $note_id );
190
- if ( WC_Admin_Note::E_WC_ADMIN_NOTE_UNACTIONED == $note->get_status() ) {
191
  $note->delete();
192
  $deleted_an_unactioned_note = true;
193
  }
1
  <?php
2
+
3
  if ( ! defined( 'ABSPATH' ) ) {
4
  exit;
5
  }
6
 
 
 
 
7
  /**
8
  * Class that adds Inbox notifications.
9
  *
47
  * Manage notes to show after Apple Pay domain verification.
48
  */
49
  public static function notify_on_apple_pay_domain_verification( $verification_complete ) {
50
+ $admin_notes_class = WC_Stripe_Woo_Compat_Utils::get_notes_class();
51
+ if ( ! class_exists( $admin_notes_class ) || ! class_exists( 'WC_Data_Store' ) ) {
 
 
 
52
  return;
53
  }
54
 
58
  // Delete all previously created, soft deleted and unactioned failure notes (Legacy).
59
  while ( ! empty( $failure_note_ids ) ) {
60
  $note_id = array_pop( $failure_note_ids );
61
+ $note = $admin_notes_class::get_note( $note_id );
62
  $note->delete();
63
  }
64
  } catch ( Exception $e ) {} // @codingStandardsIgnoreLine
116
  }
117
 
118
  try {
119
+ $admin_note_class = WC_Stripe_Woo_Compat_Utils::get_note_class();
120
+ $note = new $admin_note_class();
121
  $note->set_title( self::get_success_title() );
122
  $note->set_content( __( 'Now that you accept Apple Pay® with Stripe, you can increase conversion rates by letting your customers know that Apple Pay is available. Here’s a marketing guide to help you get started.', 'woocommerce-gateway-stripe' ) );
123
+ $note->set_type( $admin_note_class::E_WC_ADMIN_NOTE_MARKETING );
124
  $note->set_name( self::SUCCESS_NOTE_NAME );
125
  $note->set_source( 'woocommerce-gateway-stripe' );
126
  $note->add_action(
137
  */
138
  public static function create_failure_note() {
139
  try {
140
+ $admin_note_class = WC_Stripe_Woo_Compat_Utils::get_note_class();
141
+ $note = new $admin_note_class();
142
  $note->set_title( __( 'Apple Pay domain verification needed', 'woocommerce-gateway-stripe' ) );
143
  $note->set_content( __( 'The WooCommerce Stripe Gateway extension attempted to perform domain verification on behalf of your store, but was unable to do so. This must be resolved before Apple Pay can be offered to your customers.', 'woocommerce-gateway-stripe' ) );
144
+ $note->set_type( $admin_note_class::E_WC_ADMIN_NOTE_INFORMATIONAL );
145
  $note->set_name( self::FAILURE_NOTE_NAME );
146
  $note->set_source( 'woocommerce-gateway-stripe' );
147
  $note->add_action(
159
  * on/about 2020 Dec 22.
160
  */
161
  public static function cleanup_campaign_2020() {
162
+ $admin_notes_class = WC_Stripe_Woo_Compat_Utils::get_notes_class();
163
+ if ( ! class_exists( $admin_notes_class ) || ! class_exists( 'WC_Data_Store' ) ) {
 
 
 
164
  return;
165
  }
166
 
178
 
179
  $deleted_an_unactioned_note = false;
180
 
181
+ $admin_note_class = WC_Stripe_Woo_Compat_Utils::get_note_class();
182
  foreach ( (array) $note_ids as $note_id ) {
183
  try {
184
+ $note = new $admin_note_class( $note_id );
185
+ if ( $admin_note_class::E_WC_ADMIN_NOTE_UNACTIONED == $note->get_status() ) {
186
  $note->delete();
187
  $deleted_an_unactioned_note = true;
188
  }
includes/admin/stripe-settings.php CHANGED
@@ -3,39 +3,6 @@ if ( ! defined( 'ABSPATH' ) ) {
3
  exit;
4
  }
5
 
6
- if ( woocommerce_gateway_stripe()->connect->is_connected() ) {
7
- $reset_link = add_query_arg(
8
- [
9
- '_wpnonce' => wp_create_nonce( 'reset_stripe_api_credentials' ),
10
- 'reset_stripe_api_credentials' => true,
11
- ],
12
- admin_url( 'admin.php?page=wc-settings&tab=checkout&section=stripe' )
13
- );
14
-
15
- $api_credentials_text = sprintf(
16
- /* translators: %1, %2, %3, and %4 are all HTML markup tags */
17
- __( '%1$sClear all Stripe account keys.%2$s %3$sThis will disable any connection to Stripe.%4$s', 'woocommerce-gateway-stripe' ),
18
- '<a id="wc_stripe_connect_button" href="' . $reset_link . '" class="button button-secondary">',
19
- '</a>',
20
- '<span style="color:red;">',
21
- '</span>'
22
- );
23
- } else {
24
- $oauth_url = woocommerce_gateway_stripe()->connect->get_oauth_url();
25
-
26
- if ( ! is_wp_error( $oauth_url ) ) {
27
- $api_credentials_text = sprintf(
28
- /* translators: %1, %2 and %3 are all HTML markup tags */
29
- __( '%1$sSetup or link an existing Stripe account.%2$s By clicking this button you agree to the %3$sTerms of Service%2$s. Or, manually enter Stripe account keys below.', 'woocommerce-gateway-stripe' ),
30
- '<a id="wc_stripe_connect_button" href="' . $oauth_url . '" class="button button-primary">',
31
- '</a>',
32
- '<a href="https://wordpress.com/tos">'
33
- );
34
- } else {
35
- $api_credentials_text = __( 'Manually enter Stripe keys below.', 'woocommerce-gateway-stripe' );
36
- }
37
- }
38
-
39
  return apply_filters(
40
  'wc_stripe_settings',
41
  [
@@ -62,8 +29,7 @@ return apply_filters(
62
  ],
63
  'api_credentials' => [
64
  'title' => __( 'Stripe Account Keys', 'woocommerce-gateway-stripe' ),
65
- 'type' => 'title',
66
- 'description' => $api_credentials_text,
67
  ],
68
  'testmode' => [
69
  'title' => __( 'Test mode', 'woocommerce-gateway-stripe' ),
3
  exit;
4
  }
5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6
  return apply_filters(
7
  'wc_stripe_settings',
8
  [
29
  ],
30
  'api_credentials' => [
31
  'title' => __( 'Stripe Account Keys', 'woocommerce-gateway-stripe' ),
32
+ 'type' => 'stripe_account_keys',
 
33
  ],
34
  'testmode' => [
35
  'title' => __( 'Test mode', 'woocommerce-gateway-stripe' ),
includes/class-wc-gateway-stripe.php CHANGED
@@ -442,6 +442,7 @@ class WC_Gateway_Stripe extends WC_Stripe_Payment_Gateway {
442
  ]
443
  );
444
 
 
445
  $stripe_params['no_prepaid_card_msg'] = __( 'Sorry, we\'re not accepting prepaid cards at this time. Your credit card has not been charged. Please try with alternative payment method.', 'woocommerce-gateway-stripe' );
446
  $stripe_params['no_sepa_owner_msg'] = __( 'Please enter your IBAN account name.', 'woocommerce-gateway-stripe' );
447
  $stripe_params['no_sepa_iban_msg'] = __( 'Please enter your IBAN account number.', 'woocommerce-gateway-stripe' );
@@ -627,6 +628,12 @@ class WC_Gateway_Stripe extends WC_Stripe_Payment_Gateway {
627
  $intent = $this->confirm_intent( $intent, $order, $prepared_source );
628
  }
629
 
 
 
 
 
 
 
630
  if ( ! empty( $intent->error ) ) {
631
  $this->maybe_remove_non_existent_customer( $intent->error, $order );
632
 
@@ -703,6 +710,28 @@ class WC_Gateway_Stripe extends WC_Stripe_Payment_Gateway {
703
  }
704
  }
705
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
706
  /**
707
  * Displays the Stripe fee
708
  *
@@ -1013,14 +1042,19 @@ class WC_Gateway_Stripe extends WC_Stripe_Payment_Gateway {
1013
  }
1014
 
1015
  // Put the final thank you page redirect into the verification URL.
1016
- $verification_url = add_query_arg(
1017
- [
1018
- 'order' => $order_id,
1019
- 'nonce' => wp_create_nonce( 'wc_stripe_confirm_pi' ),
1020
- 'redirect_to' => rawurlencode( $result['redirect'] ),
1021
- ],
1022
- WC_AJAX::get_endpoint( 'wc_stripe_verify_intent' )
1023
- );
 
 
 
 
 
1024
 
1025
  if ( isset( $result['payment_intent_secret'] ) ) {
1026
  $redirect = sprintf( '#confirm-pi-%s:%s', $result['payment_intent_secret'], rawurlencode( $verification_url ) );
@@ -1232,4 +1266,48 @@ class WC_Gateway_Stripe extends WC_Stripe_Payment_Gateway {
1232
  }
1233
  return $settings;
1234
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1235
  }
442
  ]
443
  );
444
 
445
+ $stripe_params['stripe_locale'] = WC_Stripe_Helper::convert_wc_locale_to_stripe_locale( get_locale() );
446
  $stripe_params['no_prepaid_card_msg'] = __( 'Sorry, we\'re not accepting prepaid cards at this time. Your credit card has not been charged. Please try with alternative payment method.', 'woocommerce-gateway-stripe' );
447
  $stripe_params['no_sepa_owner_msg'] = __( 'Please enter your IBAN account name.', 'woocommerce-gateway-stripe' );
448
  $stripe_params['no_sepa_iban_msg'] = __( 'Please enter your IBAN account number.', 'woocommerce-gateway-stripe' );
628
  $intent = $this->confirm_intent( $intent, $order, $prepared_source );
629
  }
630
 
631
+ $force_save_source_value = apply_filters( 'wc_stripe_force_save_source', $force_save_source, $prepared_source->source );
632
+
633
+ if ( 'succeeded' === $intent->status && ! $this->is_using_saved_payment_method() && ( $this->save_payment_method_requested() || $force_save_source_value ) ) {
634
+ $this->save_payment_method( $prepared_source->source_object );
635
+ }
636
+
637
  if ( ! empty( $intent->error ) ) {
638
  $this->maybe_remove_non_existent_customer( $intent->error, $order );
639
 
710
  }
711
  }
712
 
713
+ /**
714
+ * Saves payment method
715
+ *
716
+ * @param object $source_object
717
+ * @throws WC_Stripe_Exception
718
+ */
719
+ public function save_payment_method( $source_object ) {
720
+ $user_id = get_current_user_id();
721
+ $customer = new WC_Stripe_Customer( $user_id );
722
+
723
+ if ( ( $user_id && 'reusable' === $source_object->usage ) ) {
724
+ $response = $customer->add_source( $source_object->id );
725
+
726
+ if ( ! empty( $response->error ) ) {
727
+ throw new WC_Stripe_Exception( print_r( $response, true ), $this->get_localized_error_message_from_response( $response ) );
728
+ }
729
+ if ( is_wp_error( $response ) ) {
730
+ throw new WC_Stripe_Exception( $response->get_error_message(), $response->get_error_message() );
731
+ }
732
+ }
733
+ }
734
+
735
  /**
736
  * Displays the Stripe fee
737
  *
1042
  }
1043
 
1044
  // Put the final thank you page redirect into the verification URL.
1045
+ $query_params = [
1046
+ 'order' => $order_id,
1047
+ 'nonce' => wp_create_nonce( 'wc_stripe_confirm_pi' ),
1048
+ 'redirect_to' => rawurlencode( $result['redirect'] ),
1049
+ ];
1050
+
1051
+ $force_save_source_value = apply_filters( 'wc_stripe_force_save_source', false );
1052
+
1053
+ if ( $this->save_payment_method_requested() || $force_save_source_value ) {
1054
+ $query_params['save_payment_method'] = true;
1055
+ }
1056
+
1057
+ $verification_url = add_query_arg( $query_params, WC_AJAX::get_endpoint( 'wc_stripe_verify_intent' ) );
1058
 
1059
  if ( isset( $result['payment_intent_secret'] ) ) {
1060
  $redirect = sprintf( '#confirm-pi-%s:%s', $result['payment_intent_secret'], rawurlencode( $verification_url ) );
1266
  }
1267
  return $settings;
1268
  }
1269
+
1270
+ /**
1271
+ * This is overloading the title type so the oauth url is only fetched if we are on the settings page.
1272
+ *
1273
+ * @param string $key Field key.
1274
+ * @param array $data Field data.
1275
+ * @return string
1276
+ */
1277
+ public function generate_stripe_account_keys_html( $key, $data ) {
1278
+ if ( woocommerce_gateway_stripe()->connect->is_connected() ) {
1279
+ $reset_link = add_query_arg(
1280
+ [
1281
+ '_wpnonce' => wp_create_nonce( 'reset_stripe_api_credentials' ),
1282
+ 'reset_stripe_api_credentials' => true,
1283
+ ],
1284
+ admin_url( 'admin.php?page=wc-settings&tab=checkout&section=stripe' )
1285
+ );
1286
+
1287
+ $api_credentials_text = sprintf(
1288
+ /* translators: %1, %2, %3, and %4 are all HTML markup tags */
1289
+ __( '%1$sClear all Stripe account keys.%2$s %3$sThis will disable any connection to Stripe.%4$s', 'woocommerce-gateway-stripe' ),
1290
+ '<a id="wc_stripe_connect_button" href="' . $reset_link . '" class="button button-secondary">',
1291
+ '</a>',
1292
+ '<span style="color:red;">',
1293
+ '</span>'
1294
+ );
1295
+ } else {
1296
+ $oauth_url = woocommerce_gateway_stripe()->connect->get_oauth_url();
1297
+
1298
+ if ( ! is_wp_error( $oauth_url ) ) {
1299
+ $api_credentials_text = sprintf(
1300
+ /* translators: %1, %2 and %3 are all HTML markup tags */
1301
+ __( '%1$sSetup or link an existing Stripe account.%2$s By clicking this button you agree to the %3$sTerms of Service%2$s. Or, manually enter Stripe account keys below.', 'woocommerce-gateway-stripe' ),
1302
+ '<a id="wc_stripe_connect_button" href="' . $oauth_url . '" class="button button-primary">',
1303
+ '</a>',
1304
+ '<a href="https://wordpress.com/tos">'
1305
+ );
1306
+ } else {
1307
+ $api_credentials_text = __( 'Manually enter Stripe keys below.', 'woocommerce-gateway-stripe' );
1308
+ }
1309
+ }
1310
+ $data['description'] = $api_credentials_text;
1311
+ return $this->generate_title_html( $key, $data );
1312
+ }
1313
  }
includes/class-wc-stripe-api.php CHANGED
@@ -57,9 +57,10 @@ class WC_Stripe_API {
57
  */
58
  public static function get_user_agent() {
59
  $app_info = [
60
- 'name' => 'WooCommerce Stripe Gateway',
61
- 'version' => WC_STRIPE_VERSION,
62
- 'url' => 'https://woocommerce.com/products/stripe/',
 
63
  ];
64
 
65
  return [
@@ -81,15 +82,19 @@ class WC_Stripe_API {
81
  $user_agent = self::get_user_agent();
82
  $app_info = $user_agent['application'];
83
 
84
- return apply_filters(
85
  'woocommerce_stripe_request_headers',
86
  [
87
- 'Authorization' => 'Basic ' . base64_encode( self::get_secret_key() . ':' ),
88
- 'Stripe-Version' => self::STRIPE_API_VERSION,
89
- 'User-Agent' => $app_info['name'] . '/' . $app_info['version'] . ' (' . $app_info['url'] . ')',
90
- 'X-Stripe-Client-User-Agent' => wp_json_encode( $user_agent ),
91
  ]
92
  );
 
 
 
 
 
 
93
  }
94
 
95
  /**
57
  */
58
  public static function get_user_agent() {
59
  $app_info = [
60
+ 'name' => 'WooCommerce Stripe Gateway',
61
+ 'version' => WC_STRIPE_VERSION,
62
+ 'url' => 'https://woocommerce.com/products/stripe/',
63
+ 'partner_id' => 'pp_partner_EYuSt9peR0WTMg',
64
  ];
65
 
66
  return [
82
  $user_agent = self::get_user_agent();
83
  $app_info = $user_agent['application'];
84
 
85
+ $headers = apply_filters(
86
  'woocommerce_stripe_request_headers',
87
  [
88
+ 'Authorization' => 'Basic ' . base64_encode( self::get_secret_key() . ':' ),
89
+ 'Stripe-Version' => self::STRIPE_API_VERSION,
 
 
90
  ]
91
  );
92
+
93
+ // These headers should not be overridden for this gateway.
94
+ $headers['User-Agent'] = $app_info['name'] . '/' . $app_info['version'] . ' (' . $app_info['url'] . ')';
95
+ $headers['X-Stripe-Client-User-Agent'] = wp_json_encode( $user_agent );
96
+
97
+ return $headers;
98
  }
99
 
100
  /**
includes/class-wc-stripe-blocks-support.php ADDED
@@ -0,0 +1,337 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ use Automattic\WooCommerce\Blocks\Payments\Integrations\AbstractPaymentMethodType;
3
+ use Automattic\WooCommerce\Blocks\Payments\PaymentResult;
4
+ use Automattic\WooCommerce\Blocks\Payments\PaymentContext;
5
+
6
+ defined( 'ABSPATH' ) || exit;
7
+
8
+ /**
9
+ * WC_Stripe_Blocks_Support class.
10
+ *
11
+ * @extends AbstractPaymentMethodType
12
+ */
13
+ final class WC_Stripe_Blocks_Support extends AbstractPaymentMethodType {
14
+ /**
15
+ * Payment method name defined by payment methods extending this class.
16
+ *
17
+ * @var string
18
+ */
19
+ protected $name = 'stripe';
20
+
21
+ /**
22
+ * Constructor
23
+ */
24
+ public function __construct() {
25
+ add_action( 'woocommerce_rest_checkout_process_payment_with_context', [ $this, 'add_payment_request_order_meta' ], 8, 2 );
26
+ add_action( 'woocommerce_rest_checkout_process_payment_with_context', [ $this, 'add_stripe_intents' ], 9999, 2 );
27
+ }
28
+
29
+ /**
30
+ * Initializes the payment method type.
31
+ */
32
+ public function initialize() {
33
+ $this->settings = get_option( 'woocommerce_stripe_settings', [] );
34
+ }
35
+
36
+ /**
37
+ * Returns if this payment method should be active. If false, the scripts will not be enqueued.
38
+ *
39
+ * @return boolean
40
+ */
41
+ public function is_active() {
42
+ return ! empty( $this->settings['enabled'] ) && 'yes' === $this->settings['enabled'];
43
+ }
44
+
45
+ /**
46
+ * Returns an array of scripts/handles to be registered for this payment method.
47
+ *
48
+ * @return array
49
+ */
50
+ public function get_payment_method_script_handles() {
51
+ $asset_path = WC_STRIPE_PLUGIN_PATH . '/build/index.asset.php';
52
+ $version = WC_STRIPE_VERSION;
53
+ $dependencies = [];
54
+ if ( file_exists( $asset_path ) ) {
55
+ $asset = require $asset_path;
56
+ $version = is_array( $asset ) && isset( $asset['version'] )
57
+ ? $asset['version']
58
+ : $version;
59
+ $dependencies = is_array( $asset ) && isset( $asset['dependencies'] )
60
+ ? $asset['dependencies']
61
+ : $dependencies;
62
+ }
63
+ wp_register_script(
64
+ 'wc-stripe-blocks-integration',
65
+ WC_STRIPE_PLUGIN_URL . '/build/index.js',
66
+ $dependencies,
67
+ $version,
68
+ true
69
+ );
70
+ wp_set_script_translations(
71
+ 'wc-stripe-blocks-integration',
72
+ 'woocommerce-gateway-stripe'
73
+ );
74
+
75
+ return [ 'wc-stripe-blocks-integration' ];
76
+ }
77
+
78
+ /**
79
+ * Returns an array of key=>value pairs of data made available to the payment methods script.
80
+ *
81
+ * @return array
82
+ */
83
+ public function get_payment_method_data() {
84
+ return [
85
+ 'stripeTotalLabel' => $this->get_total_label(),
86
+ 'publicKey' => $this->get_publishable_key(),
87
+ 'allowPrepaidCard' => $this->get_allow_prepaid_card(),
88
+ 'title' => $this->get_title(),
89
+ 'button' => [
90
+ 'type' => $this->get_button_type(),
91
+ 'theme' => $this->get_button_theme(),
92
+ 'height' => $this->get_button_height(),
93
+ 'locale' => $this->get_button_locale(),
94
+ 'customLabel' => isset( $this->settings['payment_request_button_label'] ) ? $this->settings['payment_request_button_label'] : 'Buy now',
95
+ ],
96
+ 'inline_cc_form' => $this->get_inline_cc_form(),
97
+ 'icons' => $this->get_icons(),
98
+ 'showSavedCards' => $this->get_show_saved_cards(),
99
+ 'showSaveOption' => $this->get_show_save_option(),
100
+ 'supports' => $this->get_supported_features(),
101
+ 'stripeLocale' => WC_Stripe_Helper::convert_wc_locale_to_stripe_locale( get_locale() ),
102
+ 'isAdmin' => is_admin(),
103
+ ];
104
+ }
105
+
106
+ /**
107
+ * Determine if store allows cards to be saved during checkout.
108
+ *
109
+ * @return bool True if merchant allows shopper to save card (payment method) during checkout.
110
+ */
111
+ private function get_show_saved_cards() {
112
+ return isset( $this->settings['saved_cards'] ) ? 'yes' === $this->settings['saved_cards'] : false;
113
+ }
114
+
115
+ /**
116
+ * Determine if the checkbox to enable the user to save their payment method should be shown.
117
+ *
118
+ * @return bool True if the save payment checkbox should be displayed to the user.
119
+ */
120
+ private function get_show_save_option() {
121
+ $saved_cards = $this->get_show_saved_cards();
122
+ // This assumes that Stripe supports `tokenization` - currently this is true, based on
123
+ // https://github.com/woocommerce/woocommerce-gateway-stripe/blob/master/includes/class-wc-gateway-stripe.php#L95 .
124
+ // See https://github.com/woocommerce/woocommerce-gateway-stripe/blob/ad19168b63df86176cbe35c3e95203a245687640/includes/class-wc-gateway-stripe.php#L271 and
125
+ // https://github.com/woocommerce/woocommerce/wiki/Payment-Token-API .
126
+ return apply_filters( 'wc_stripe_display_save_payment_method_checkbox', filter_var( $saved_cards, FILTER_VALIDATE_BOOLEAN ) );
127
+ }
128
+
129
+ /**
130
+ * Returns the label to use accompanying the total in the stripe statement.
131
+ *
132
+ * @return string Statement descriptor.
133
+ */
134
+ private function get_total_label() {
135
+ return ! empty( $this->settings['statement_descriptor'] ) ? WC_Stripe_Helper::clean_statement_descriptor( $this->settings['statement_descriptor'] ) : '';
136
+ }
137
+
138
+ /**
139
+ * Returns the publishable api key for the Stripe service.
140
+ *
141
+ * @return string Public api key.
142
+ */
143
+ private function get_publishable_key() {
144
+ $test_mode = ( ! empty( $this->settings['testmode'] ) && 'yes' === $this->settings['testmode'] );
145
+ $setting_key = $test_mode ? 'test_publishable_key' : 'publishable_key';
146
+ return ! empty( $this->settings[ $setting_key ] ) ? $this->settings[ $setting_key ] : '';
147
+ }
148
+
149
+ /**
150
+ * Returns whether to allow prepaid cards for payments.
151
+ *
152
+ * @return bool True means to allow prepaid card (default).
153
+ */
154
+ private function get_allow_prepaid_card() {
155
+ return apply_filters( 'wc_stripe_allow_prepaid_card', true );
156
+ }
157
+
158
+ /**
159
+ * Returns the title string to use in the UI (customisable via admin settings screen).
160
+ *
161
+ * @return string Title / label string
162
+ */
163
+ private function get_title() {
164
+ return isset( $this->settings['title'] ) ? $this->settings['title'] : __( 'Credit / Debit Card', 'woocommerce-gateway-stripe' );
165
+ }
166
+
167
+ /**
168
+ * Return the button type for the payment button.
169
+ *
170
+ * @return string Defaults to 'default'.
171
+ */
172
+ private function get_button_type() {
173
+ return isset( $this->settings['payment_request_button_type'] ) ? $this->settings['payment_request_button_type'] : 'default';
174
+ }
175
+
176
+ /**
177
+ * Return the theme to use for the payment button.
178
+ *
179
+ * @return string Defaults to 'dark'.
180
+ */
181
+ private function get_button_theme() {
182
+ return isset( $this->settings['payment_request_button_theme'] ) ? $this->settings['payment_request_button_theme'] : 'dark';
183
+ }
184
+
185
+ /**
186
+ * Return the height for the payment button.
187
+ *
188
+ * @return string A pixel value for the height (defaults to '64').
189
+ */
190
+ private function get_button_height() {
191
+ return isset( $this->settings['payment_request_button_height'] ) ? str_replace( 'px', '', $this->settings['payment_request_button_height'] ) : '64';
192
+ }
193
+
194
+ /**
195
+ * Return the inline cc option.
196
+ *
197
+ * @return boolean True if the inline CC form option is enabled.
198
+ */
199
+ private function get_inline_cc_form() {
200
+ return isset( $this->settings['inline_cc_form'] ) && 'yes' === $this->settings['inline_cc_form'];
201
+ }
202
+
203
+ /**
204
+ * Return the locale for the payment button.
205
+ *
206
+ * @return string Defaults to en_US.
207
+ */
208
+ private function get_button_locale() {
209
+ return apply_filters( 'wc_stripe_payment_request_button_locale', substr( get_locale(), 0, 2 ) );
210
+ }
211
+
212
+ /**
213
+ * Return the icons urls.
214
+ *
215
+ * @return array Arrays of icons metadata.
216
+ */
217
+ private function get_icons() {
218
+ $icons_src = [
219
+ 'visa' => [
220
+ 'src' => WC_STRIPE_PLUGIN_URL . '/assets/images/visa.svg',
221
+ 'alt' => __( 'Visa', 'woocommerce-gateway-stripe' ),
222
+ ],
223
+ 'amex' => [
224
+ 'src' => WC_STRIPE_PLUGIN_URL . '/assets/images/amex.svg',
225
+ 'alt' => __( 'American Express', 'woocommerce-gateway-stripe' ),
226
+ ],
227
+ 'mastercard' => [
228
+ 'src' => WC_STRIPE_PLUGIN_URL . '/assets/images/mastercard.svg',
229
+ 'alt' => __( 'Mastercard', 'woocommerce-gateway-stripe' ),
230
+ ],
231
+ ];
232
+
233
+ if ( 'USD' === get_woocommerce_currency() ) {
234
+ $icons_src['discover'] = [
235
+ 'src' => WC_STRIPE_PLUGIN_URL . '/assets/images/discover.svg',
236
+ 'alt' => __( 'Discover', 'woocommerce-gateway-stripe' ),
237
+ ];
238
+ $icons_src['jcb'] = [
239
+ 'src' => WC_STRIPE_PLUGIN_URL . '/assets/images/jcb.svg',
240
+ 'alt' => __( 'JCB', 'woocommerce-gateway-stripe' ),
241
+ ];
242
+ $icons_src['diners'] = [
243
+ 'src' => WC_STRIPE_PLUGIN_URL . '/assets/images/diners.svg',
244
+ 'alt' => __( 'Diners', 'woocommerce-gateway-stripe' ),
245
+ ];
246
+ }
247
+ return $icons_src;
248
+ }
249
+
250
+ /**
251
+ * Add payment request data to the order meta as hooked on the
252
+ * woocommerce_rest_checkout_process_payment_with_context action.
253
+ *
254
+ * @param PaymentContext $context Holds context for the payment.
255
+ * @param PaymentResult $result Result object for the payment.
256
+ */
257
+ public function add_payment_request_order_meta( PaymentContext $context, PaymentResult &$result ) {
258
+ $data = $context->payment_data;
259
+ if ( ! empty( $data['payment_request_type'] ) && 'stripe' === $context->payment_method ) {
260
+ $this->add_order_meta( $context->order, $data['payment_request_type'] );
261
+ }
262
+
263
+ // hook into stripe error processing so that we can capture the error to
264
+ // payment details (which is added to notices and thus not helpful for
265
+ // this context).
266
+ if ( 'stripe' === $context->payment_method ) {
267
+ add_action(
268
+ 'wc_gateway_stripe_process_payment_error',
269
+ function( $error ) use ( &$result ) {
270
+ $payment_details = $result->payment_details;
271
+ $payment_details['errorMessage'] = wp_strip_all_tags( $error->getLocalizedMessage() );
272
+ $result->set_payment_details( $payment_details );
273
+ }
274
+ );
275
+ }
276
+ }
277
+
278
+ /**
279
+ * Handles any potential stripe intents on the order that need handled.
280
+ *
281
+ * This is configured to execute after legacy payment processing has
282
+ * happened on the woocommerce_rest_checkout_process_payment_with_context
283
+ * action hook.
284
+ *
285
+ * @param PaymentContext $context Holds context for the payment.
286
+ * @param PaymentResult $result Result object for the payment.
287
+ */
288
+ public function add_stripe_intents( PaymentContext $context, PaymentResult &$result ) {
289
+ if ( 'stripe' === $context->payment_method
290
+ && (
291
+ ! empty( $result->payment_details['payment_intent_secret'] )
292
+ || ! empty( $result->payment_details['setup_intent_secret'] )
293
+ )
294
+ ) {
295
+ $payment_details = $result->payment_details;
296
+ $payment_details['verification_endpoint'] = add_query_arg(
297
+ [
298
+ 'order' => $context->order->get_id(),
299
+ 'nonce' => wp_create_nonce( 'wc_stripe_confirm_pi' ),
300
+ 'redirect_to' => rawurlencode( $result->redirect_url ),
301
+ ],
302
+ home_url() . \WC_Ajax::get_endpoint( 'wc_stripe_verify_intent' )
303
+ );
304
+ $result->set_payment_details( $payment_details );
305
+ $result->set_status( 'success' );
306
+ }
307
+ }
308
+
309
+ /**
310
+ * Handles adding information about the payment request type used to the order meta.
311
+ *
312
+ * @param \WC_Order $order The order being processed.
313
+ * @param string $payment_request_type The payment request type used for payment.
314
+ */
315
+ private function add_order_meta( \WC_Order $order, $payment_request_type ) {
316
+ if ( 'apple_pay' === $payment_request_type ) {
317
+ $order->set_payment_method_title( 'Apple Pay (Stripe)' );
318
+ $order->save();
319
+ } elseif ( 'google_pay' === $payment_request_type ) {
320
+ $order->set_payment_method_title( 'Google Pay (Stripe)' );
321
+ $order->save();
322
+ } elseif ( 'payment_request_api' === $payment_request_type ) {
323
+ $order->set_payment_method_title( 'Payment Request (Stripe)' );
324
+ $order->save();
325
+ }
326
+ }
327
+
328
+ /**
329
+ * Returns an array of supported features.
330
+ *
331
+ * @return string[]
332
+ */
333
+ public function get_supported_features() {
334
+ $gateway = new WC_Gateway_Stripe();
335
+ return array_filter( $gateway->supports, [ $gateway, 'supports' ] );
336
+ }
337
+ }
includes/class-wc-stripe-customer.php CHANGED
@@ -156,8 +156,9 @@ class WC_Stripe_Customer {
156
  }
157
  }
158
 
159
- $metadata = [];
160
- $defaults['metadata'] = apply_filters( 'wc_stripe_customer_metadata', $metadata, $user );
 
161
 
162
  return wp_parse_args( $args, $defaults );
163
  }
@@ -265,7 +266,7 @@ class WC_Stripe_Customer {
265
  * @return WP_Error|int
266
  */
267
  public function add_source( $source_id ) {
268
- $response = $this->attach_source( $source_id );
269
 
270
  if ( ! empty( $response->error ) || is_wp_error( $response ) ) {
271
  return $response;
@@ -484,4 +485,58 @@ class WC_Stripe_Customer {
484
  $this->delete_id_from_meta();
485
  return $this->create_customer();
486
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
487
  }
156
  }
157
  }
158
 
159
+ $metadata = [];
160
+ $defaults['metadata'] = apply_filters( 'wc_stripe_customer_metadata', $metadata, $user );
161
+ $defaults['preferred_locales'] = $this->get_customer_preferred_locale( $user );
162
 
163
  return wp_parse_args( $args, $defaults );
164
  }
266
  * @return WP_Error|int
267
  */
268
  public function add_source( $source_id ) {
269
+ $response = WC_Stripe_API::retrieve( 'sources/' . $source_id );
270
 
271
  if ( ! empty( $response->error ) || is_wp_error( $response ) ) {
272
  return $response;
485
  $this->delete_id_from_meta();
486
  return $this->create_customer();
487
  }
488
+
489
+ /**
490
+ * Get the customer's preferred locale based on the user or site setting.
491
+ *
492
+ * @param object $user The user being created/modified.
493
+ * @return array The matched locale string wrapped in an array, or empty default.
494
+ */
495
+ public function get_customer_preferred_locale( $user ) {
496
+ $locale = $this->get_customer_locale( $user );
497
+
498
+ // Options based on Stripe locales.
499
+ // https://support.stripe.com/questions/language-options-for-customer-emails
500
+ $stripe_locales = [
501
+ 'ar' => 'ar-AR',
502
+ 'da_DK' => 'da-DK',
503
+ 'de_DE' => 'de-DE',
504
+ 'en' => 'en-US',
505
+ 'es_ES' => 'es-ES',
506
+ 'es_CL' => 'es-419',
507
+ 'es_AR' => 'es-419',
508
+ 'es_CO' => 'es-419',
509
+ 'es_PE' => 'es-419',
510
+ 'es_UY' => 'es-419',
511
+ 'es_PR' => 'es-419',
512
+ 'es_GT' => 'es-419',
513
+ 'es_EC' => 'es-419',
514
+ 'es_MX' => 'es-419',
515
+ 'es_VE' => 'es-419',
516
+ 'es_CR' => 'es-419',
517
+ 'fi' => 'fi-FI',
518
+ 'fr_FR' => 'fr-FR',
519
+ 'he_IL' => 'he-IL',
520
+ 'it_IT' => 'it-IT',
521
+ 'ja' => 'ja-JP',
522
+ 'nl_NL' => 'nl-NL',
523
+ 'nn_NO' => 'no-NO',
524
+ 'pt_BR' => 'pt-BR',
525
+ 'sv_SE' => 'sv-SE',
526
+ ];
527
+
528
+ $preferred = isset( $stripe_locales[ $locale ] ) ? $stripe_locales[ $locale ] : 'en-US';
529
+ return [ $preferred ];
530
+ }
531
+
532
+ /**
533
+ * Gets the customer's locale/language based on their setting or the site settings.
534
+ *
535
+ * @param object $user The user we're wanting to get the locale for.
536
+ * @return string The locale/language set in the user profile or the site itself.
537
+ */
538
+ public function get_customer_locale( $user ) {
539
+ // If we have a user, get their locale with a site fallback.
540
+ return ( $user ) ? get_user_locale( $user->ID ) : get_locale();
541
+ }
542
  }
includes/class-wc-stripe-helper.php CHANGED
@@ -510,4 +510,91 @@ class WC_Stripe_Helper {
510
 
511
  return $statement_descriptor;
512
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
513
  }
510
 
511
  return $statement_descriptor;
512
  }
513
+
514
+ /**
515
+ * Converts a WooCommerce locale to the closest supported by Stripe.js.
516
+ *
517
+ * Stripe.js supports only a subset of IETF language tags, if a country specific locale is not supported we use
518
+ * the default for that language (https://stripe.com/docs/js/appendix/supported_locales).
519
+ * If no match is found we return 'auto' so Stripe.js uses the browser locale.
520
+ *
521
+ * @param string $wc_locale The locale to convert.
522
+ *
523
+ * @return string Closest locale supported by Stripe ('auto' if NONE).
524
+ */
525
+ public static function convert_wc_locale_to_stripe_locale( $wc_locale ) {
526
+ // List copied from: https://stripe.com/docs/js/appendix/supported_locales.
527
+ $supported = [
528
+ 'ar', // Arabic.
529
+ 'bg', // Bulgarian (Bulgaria).
530
+ 'cs', // Czech (Czech Republic).
531
+ 'da', // Danish.
532
+ 'de', // German (Germany).
533
+ 'el', // Greek (Greece).
534
+ 'en', // English.
535
+ 'en-GB', // English (United Kingdom).
536
+ 'es', // Spanish (Spain).
537
+ 'es-419', // Spanish (Latin America).
538
+ 'et', // Estonian (Estonia).
539
+ 'fi', // Finnish (Finland).
540
+ 'fr', // French (France).
541
+ 'fr-CA', // French (Canada).
542
+ 'he', // Hebrew (Israel).
543
+ 'hu', // Hungarian (Hungary).
544
+ 'id', // Indonesian (Indonesia).
545
+ 'it', // Italian (Italy).
546
+ 'ja', // Japanese.
547
+ 'lt', // Lithuanian (Lithuania).
548
+ 'lv', // Latvian (Latvia).
549
+ 'ms', // Malay (Malaysia).
550
+ 'mt', // Maltese (Malta).
551
+ 'nb', // Norwegian Bokmål.
552
+ 'nl', // Dutch (Netherlands).
553
+ 'pl', // Polish (Poland).
554
+ 'pt-BR', // Portuguese (Brazil).
555
+ 'pt', // Portuguese (Brazil).
556
+ 'ro', // Romanian (Romania).
557
+ 'ru', // Russian (Russia).
558
+ 'sk', // Slovak (Slovakia).
559
+ 'sl', // Slovenian (Slovenia).
560
+ 'sv', // Swedish (Sweden).
561
+ 'th', // Thai.
562
+ 'tr', // Turkish (Turkey).
563
+ 'zh', // Chinese Simplified (China).
564
+ 'zh-HK', // Chinese Traditional (Hong Kong).
565
+ 'zh-TW', // Chinese Traditional (Taiwan).
566
+ ];
567
+
568
+ // Stripe uses '-' instead of '_' (used in WordPress).
569
+ $locale = str_replace( '_', '-', $wc_locale );
570
+
571
+ if ( in_array( $locale, $supported, true ) ) {
572
+ return $locale;
573
+ }
574
+
575
+ // The plugin has been fully translated for Spanish (Ecuador), Spanish (Mexico), and
576
+ // Spanish(Venezuela), and partially (88% at 2021-05-14) for Spanish (Colombia).
577
+ // We need to map these locales to Stripe's Spanish (Latin America) 'es-419' locale.
578
+ // This list should be updated if more localized versions of Latin American Spanish are
579
+ // made available.
580
+ $lowercase_locale = strtolower( $wc_locale );
581
+ $translated_latin_american_locales = [
582
+ 'es_co', // Spanish (Colombia).
583
+ 'es_ec', // Spanish (Ecuador).
584
+ 'es_mx', // Spanish (Mexico).
585
+ 'es_ve', // Spanish (Venezuela).
586
+ ];
587
+ if ( in_array( $lowercase_locale, $translated_latin_american_locales, true ) ) {
588
+ return 'es-419';
589
+ }
590
+
591
+ // Finally, we check if the "base locale" is available.
592
+ $base_locale = substr( $wc_locale, 0, 2 );
593
+ if ( in_array( $base_locale, $supported, true ) ) {
594
+ return $base_locale;
595
+ }
596
+
597
+ // Default to 'auto' so Stripe.js uses the browser locale.
598
+ return 'auto';
599
+ }
600
  }
includes/class-wc-stripe-intent-controller.php CHANGED
@@ -102,6 +102,23 @@ class WC_Stripe_Intent_Controller {
102
  try {
103
  $gateway->verify_intent_after_checkout( $order );
104
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
105
  if ( ! isset( $_GET['is_ajax'] ) ) {
106
  $redirect_url = isset( $_GET['redirect_to'] ) // wpcs: csrf ok.
107
  ? esc_url_raw( wp_unslash( $_GET['redirect_to'] ) ) // wpcs: csrf ok.
102
  try {
103
  $gateway->verify_intent_after_checkout( $order );
104
 
105
+ if ( isset( $_GET['save_payment_method'] ) && ! empty( $_GET['save_payment_method'] ) ) {
106
+ $intent = $gateway->get_intent_from_order( $order );
107
+ if ( isset( $intent->last_payment_error ) ) {
108
+ // Currently, Stripe saves the payment method even if the authentication fails for 3DS cards.
109
+ // Although, the card is not stored in DB we need to remove the source from the customer on Stripe
110
+ // in order to keep the sources in sync with the data in DB.
111
+ $customer = new WC_Stripe_Customer( wp_get_current_user()->ID );
112
+ $customer->delete_source( $intent->last_payment_error->source->id );
113
+ } else {
114
+ $metadata = $intent->metadata;
115
+ if ( isset( $metadata->save_payment_method ) && 'true' === $metadata->save_payment_method ) {
116
+ $source_object = WC_Stripe_API::retrieve( 'sources/' . $intent->source );
117
+ $gateway->save_payment_method( $source_object );
118
+ }
119
+ }
120
+ }
121
+
122
  if ( ! isset( $_GET['is_ajax'] ) ) {
123
  $redirect_url = isset( $_GET['redirect_to'] ) // wpcs: csrf ok.
124
  ? esc_url_raw( wp_unslash( $_GET['redirect_to'] ) ) // wpcs: csrf ok.
includes/compat/class-wc-stripe-sepa-subs-compat.php CHANGED
@@ -467,7 +467,7 @@ class WC_Stripe_Sepa_Subs_Compat extends WC_Gateway_Stripe_Sepa {
467
  }
468
 
469
  // If we couldn't find a Stripe customer linked to the account, fallback to the order meta data.
470
- if ( ( ! $stripe_customer_id || ! is_string( $stripe_customer_id ) ) && false !== $subscription->order ) {
471
  $stripe_customer_id = get_post_meta( $subscription->get_parent_id(), '_stripe_customer_id', true );
472
  $stripe_source_id = get_post_meta( $subscription->get_parent_id(), '_stripe_source_id', true );
473
 
467
  }
468
 
469
  // If we couldn't find a Stripe customer linked to the account, fallback to the order meta data.
470
+ if ( ( ! $stripe_customer_id || ! is_string( $stripe_customer_id ) ) && false !== $subscription->get_parent() ) {
471
  $stripe_customer_id = get_post_meta( $subscription->get_parent_id(), '_stripe_customer_id', true );
472
  $stripe_source_id = get_post_meta( $subscription->get_parent_id(), '_stripe_source_id', true );
473
 
includes/compat/class-wc-stripe-subs-compat.php CHANGED
@@ -579,7 +579,7 @@ class WC_Stripe_Subs_Compat extends WC_Gateway_Stripe {
579
  }
580
 
581
  // If we couldn't find a Stripe customer linked to the account, fallback to the order meta data.
582
- if ( ( ! $stripe_customer_id || ! is_string( $stripe_customer_id ) ) && false !== $subscription->order ) {
583
  $stripe_customer_id = get_post_meta( $subscription->get_parent_id(), '_stripe_customer_id', true );
584
  $stripe_source_id = get_post_meta( $subscription->get_parent_id(), '_stripe_source_id', true );
585
 
579
  }
580
 
581
  // If we couldn't find a Stripe customer linked to the account, fallback to the order meta data.
582
+ if ( ( ! $stripe_customer_id || ! is_string( $stripe_customer_id ) ) && false !== $subscription->get_parent() ) {
583
  $stripe_customer_id = get_post_meta( $subscription->get_parent_id(), '_stripe_customer_id', true );
584
  $stripe_source_id = get_post_meta( $subscription->get_parent_id(), '_stripe_source_id', true );
585
 
includes/compat/class-wc-stripe-woo-compat-utils.php ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if ( ! defined( 'ABSPATH' ) ) {
4
+ exit; // Exit if accessed directly.
5
+ }
6
+
7
+ use Automattic\WooCommerce\Admin\Notes\Note;
8
+ use Automattic\WooCommerce\Admin\Notes\Notes;
9
+ use Automattic\WooCommerce\Admin\Notes\WC_Admin_Note;
10
+ use Automattic\WooCommerce\Admin\Notes\WC_Admin_Notes;
11
+
12
+ /**
13
+ * Util class for handling compatibilities with different versions of WooCommerce core.
14
+ */
15
+ class WC_Stripe_Woo_Compat_Utils {
16
+ /**
17
+ * Return non-deprecated class for instantiating WC-Admin notes.
18
+ *
19
+ * @return string
20
+ */
21
+ public static function get_note_class() {
22
+ if ( class_exists( 'Automattic\WooCommerce\Admin\Notes\Note' ) ) {
23
+ return Note::class;
24
+ }
25
+
26
+ return WC_Admin_Note::class;
27
+ }
28
+
29
+ /**
30
+ * Return non-deprecated class for instantiating WC-Admin notes.
31
+ *
32
+ * @return string
33
+ */
34
+ public static function get_notes_class() {
35
+ if ( class_exists( 'Automattic\WooCommerce\Admin\Notes\Notes' ) ) {
36
+ return Notes::class;
37
+ }
38
+
39
+ return WC_Admin_Notes::class;
40
+ }
41
+ }
includes/payment-methods/class-wc-stripe-payment-request.php CHANGED
@@ -165,10 +165,11 @@ class WC_Stripe_Payment_Request {
165
  * This is needed so nonces can be verified by AJAX Request.
166
  *
167
  * @since 4.0.0
 
168
  * @return void
169
  */
170
  public function set_session() {
171
- if ( ! is_product() || ( isset( WC()->session ) && WC()->session->has_session() ) ) {
172
  return;
173
  }
174
 
@@ -204,8 +205,6 @@ class WC_Stripe_Payment_Request {
204
  add_action( 'wc_ajax_wc_stripe_log_errors', [ $this, 'ajax_log_errors' ] );
205
 
206
  add_filter( 'woocommerce_gateway_title', [ $this, 'filter_gateway_title' ], 10, 2 );
207
- add_filter( 'woocommerce_validate_postcode', [ $this, 'postal_code_validation' ], 10, 3 );
208
-
209
  add_action( 'woocommerce_checkout_order_processed', [ $this, 'add_order_meta' ], 10, 2 );
210
  }
211
 
@@ -297,24 +296,50 @@ class WC_Stripe_Payment_Request {
297
  return isset( $this->stripe_settings['payment_request_button_label'] ) ? $this->stripe_settings['payment_request_button_label'] : 'Buy now';
298
  }
299
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
300
  /**
301
  * Gets the product data for the currently viewed page
302
  *
303
  * @since 4.0.0
304
- * @version 4.0.0
305
  * @return mixed Returns false if not on a product page, the product information otherwise.
306
  */
307
  public function get_product_data() {
308
- if ( ! is_product() ) {
309
  return false;
310
  }
311
 
312
- global $post;
313
-
314
- $product = wc_get_product( $post->ID );
315
 
316
  if ( 'variable' === $product->get_type() ) {
317
- $attributes = wc_clean( wp_unslash( $_GET ) );
 
 
 
 
 
 
 
 
 
 
318
 
319
  $data_store = WC_Data_Store::load( 'product' );
320
  $variation_id = $data_store->find_matching_product_variation( $product, $attributes );
@@ -329,7 +354,7 @@ class WC_Stripe_Payment_Request {
329
 
330
  $items[] = [
331
  'label' => $product->get_name(),
332
- 'amount' => WC_Stripe_Helper::get_stripe_amount( $product->get_price() ),
333
  ];
334
 
335
  if ( wc_tax_enabled() ) {
@@ -358,7 +383,7 @@ class WC_Stripe_Payment_Request {
358
  $data['displayItems'] = $items;
359
  $data['total'] = [
360
  'label' => apply_filters( 'wc_stripe_payment_request_total_label', $this->total_label ),
361
- 'amount' => WC_Stripe_Helper::get_stripe_amount( $product->get_price() ),
362
  'pending' => true,
363
  ];
364
 
@@ -382,47 +407,50 @@ class WC_Stripe_Payment_Request {
382
  $order = wc_get_order( $post->ID );
383
  $method_title = is_object( $order ) ? $order->get_payment_method_title() : '';
384
 
385
- if ( 'stripe' === $id && ! empty( $method_title ) && 'Apple Pay (Stripe)' === $method_title ) {
386
- return $method_title;
387
- }
 
 
 
 
388
 
389
- if ( 'stripe' === $id && ! empty( $method_title ) && 'Chrome Payment Request (Stripe)' === $method_title ) {
390
- return $method_title;
 
 
 
 
 
391
  }
392
 
393
  return $title;
394
  }
395
 
396
  /**
397
- * Removes postal code validation from WC.
398
  *
399
- * @since 3.1.4
400
- * @version 4.0.0
 
 
401
  */
402
- public function postal_code_validation( $valid, $postcode, $country ) {
403
- $gateways = WC()->payment_gateways->get_available_payment_gateways();
404
-
405
- if ( ! isset( $gateways['stripe'] ) ) {
406
- return $valid;
407
- }
408
-
409
- $payment_request_type = isset( $_POST['payment_request_type'] ) ? wc_clean( wp_unslash( $_POST['payment_request_type'] ) ) : '';
410
-
411
- if ( 'apple_pay' !== $payment_request_type ) {
412
- return $valid;
413
- }
414
-
415
  /**
416
- * Currently Apple Pay truncates postal codes from UK and Canada to first 3 characters
417
  * when passing it back from the shippingcontactselected object. This causes WC to invalidate
418
- * the order and not let it go through. The remedy for now is just to remove this validation.
419
- * Note that this only works with shipping providers that don't validate full postal codes.
420
  */
421
- if ( 'GB' === $country || 'CA' === $country ) {
422
- return true;
 
 
 
 
 
423
  }
424
 
425
- return $valid;
426
  }
427
 
428
  /**
@@ -447,10 +475,11 @@ class WC_Stripe_Payment_Request {
447
  if ( 'apple_pay' === $payment_request_type ) {
448
  $order->set_payment_method_title( 'Apple Pay (Stripe)' );
449
  $order->save();
450
- }
451
-
452
- if ( 'payment_request_api' === $payment_request_type ) {
453
- $order->set_payment_method_title( 'Chrome Payment Request (Stripe)' );
 
454
  $order->save();
455
  }
456
  }
@@ -513,11 +542,56 @@ class WC_Stripe_Payment_Request {
513
  return true;
514
  }
515
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
516
  /**
517
  * Load public scripts and styles.
518
  *
519
  * @since 3.1.0
520
- * @version 4.0.0
521
  */
522
  public function scripts() {
523
  // If keys are not set bail.
@@ -532,11 +606,14 @@ class WC_Stripe_Payment_Request {
532
  return;
533
  }
534
 
535
- if ( ! is_product() && ! is_cart() && ! is_checkout() && ! isset( $_GET['pay_for_order'] ) ) {
 
536
  return;
537
  }
538
 
539
- if ( is_product() && ! $this->should_show_payment_button_on_product_page() ) {
 
 
540
  return;
541
  }
542
 
@@ -581,7 +658,7 @@ class WC_Stripe_Payment_Request {
581
  'css_selector' => $this->custom_button_selector(),
582
  'branded_type' => $this->get_button_branded_type(),
583
  ],
584
- 'is_product_page' => is_product(),
585
  'product' => $this->get_product_data(),
586
  ];
587
 
@@ -602,7 +679,7 @@ class WC_Stripe_Payment_Request {
602
  * Display the payment request button.
603
  *
604
  * @since 4.0.0
605
- * @version 4.0.0
606
  */
607
  public function display_payment_request_button_html() {
608
  global $post;
@@ -613,19 +690,13 @@ class WC_Stripe_Payment_Request {
613
  return;
614
  }
615
 
616
- if ( ! is_cart() && ! is_checkout() && ! is_product() && ! isset( $_GET['pay_for_order'] ) ) {
617
  return;
618
  }
619
 
620
  if ( is_checkout() && ! apply_filters( 'wc_stripe_show_payment_request_on_checkout', false, $post ) ) {
621
  return;
622
  }
623
-
624
- if ( is_product() && ! $this->should_show_payment_button_on_product_page() ) {
625
- return;
626
- } elseif ( ! $this->should_show_payment_button_on_cart() ) {
627
- return;
628
- }
629
  ?>
630
  <div id="wc-stripe-payment-request-wrapper" style="clear:both;padding-top:1.5em;display:none;">
631
  <div id="wc-stripe-payment-request-button">
@@ -647,7 +718,7 @@ class WC_Stripe_Payment_Request {
647
  * Display payment request button separator.
648
  *
649
  * @since 4.0.0
650
- * @version 4.0.0
651
  */
652
  public function display_payment_request_button_separator_html() {
653
  global $post;
@@ -658,19 +729,13 @@ class WC_Stripe_Payment_Request {
658
  return;
659
  }
660
 
661
- if ( ! is_cart() && ! is_checkout() && ! is_product() && ! isset( $_GET['pay_for_order'] ) ) {
662
  return;
663
  }
664
 
665
  if ( is_checkout() && ! apply_filters( 'wc_stripe_show_payment_request_on_checkout', false, $post ) ) {
666
  return;
667
  }
668
-
669
- if ( is_product() && ! $this->should_show_payment_button_on_product_page() ) {
670
- return;
671
- } elseif ( ! $this->should_show_payment_button_on_cart() ) {
672
- return;
673
- }
674
  ?>
675
  <p id="wc-stripe-payment-request-button-separator" style="margin-top:1.5em;text-align:center;display:none;">&mdash; <?php esc_html_e( 'OR', 'woocommerce-gateway-stripe' ); ?> &mdash;</p>
676
  <?php
@@ -703,17 +768,18 @@ class WC_Stripe_Payment_Request {
703
  * Whether payment button html should be rendered
704
  *
705
  * @since 4.3.2
 
706
  * @return boolean
707
  */
708
  private function should_show_payment_button_on_product_page() {
709
  global $post;
710
 
711
- $product = wc_get_product( $post->ID );
712
-
713
  if ( apply_filters( 'wc_stripe_hide_payment_request_on_product_page', false, $post ) ) {
714
  return false;
715
  }
716
 
 
 
717
  if ( ! is_object( $product ) || ! in_array( $product->get_type(), $this->supported_product_types() ) ) {
718
  return false;
719
  }
@@ -1001,7 +1067,7 @@ class WC_Stripe_Payment_Request {
1001
  throw new Exception( sprintf( __( 'You cannot add that amount of "%1$s"; to the cart because there is not enough stock (%2$s remaining).', 'woocommerce-gateway-stripe' ), $product->get_name(), wc_format_stock_quantity_for_display( $product->get_stock_quantity(), $product ) ) );
1002
  }
1003
 
1004
- $total = $qty * $product->get_price() + $addon_value;
1005
 
1006
  $quantity_label = 1 < $qty ? ' (x' . $qty . ')' : '';
1007
 
@@ -1323,6 +1389,9 @@ class WC_Stripe_Payment_Request {
1323
  // Normalizes state to calculate shipping zones.
1324
  $state = $this->get_normalized_state( $state, $country );
1325
 
 
 
 
1326
  WC()->shipping->reset_shipping();
1327
 
1328
  if ( $postcode && WC_Validation::is_postcode( $postcode, $country ) ) {
165
  * This is needed so nonces can be verified by AJAX Request.
166
  *
167
  * @since 4.0.0
168
+ * @version 5.2.0
169
  * @return void
170
  */
171
  public function set_session() {
172
+ if ( ! $this->is_product() || ( isset( WC()->session ) && WC()->session->has_session() ) ) {
173
  return;
174
  }
175
 
205
  add_action( 'wc_ajax_wc_stripe_log_errors', [ $this, 'ajax_log_errors' ] );
206
 
207
  add_filter( 'woocommerce_gateway_title', [ $this, 'filter_gateway_title' ], 10, 2 );
 
 
208
  add_action( 'woocommerce_checkout_order_processed', [ $this, 'add_order_meta' ], 10, 2 );
209
  }
210
 
296
  return isset( $this->stripe_settings['payment_request_button_label'] ) ? $this->stripe_settings['payment_request_button_label'] : 'Buy now';
297
  }
298
 
299
+ /**
300
+ * Gets the product total price.
301
+ *
302
+ * @since 5.2.0
303
+ *
304
+ * @param object $product WC_Product_* object.
305
+ * @return integer Total price.
306
+ */
307
+ public function get_product_price( $product ) {
308
+ $product_price = $product->get_price();
309
+ // Add subscription sign-up fees to product price.
310
+ if ( 'subscription' === $product->get_type() && class_exists( 'WC_Subscriptions_Product' ) ) {
311
+ $product_price = $product->get_price() + WC_Subscriptions_Product::get_sign_up_fee( $product );
312
+ }
313
+
314
+ return $product_price;
315
+ }
316
+
317
  /**
318
  * Gets the product data for the currently viewed page
319
  *
320
  * @since 4.0.0
321
+ * @version 5.2.0
322
  * @return mixed Returns false if not on a product page, the product information otherwise.
323
  */
324
  public function get_product_data() {
325
+ if ( ! $this->is_product() ) {
326
  return false;
327
  }
328
 
329
+ $product = $this->get_product();
 
 
330
 
331
  if ( 'variable' === $product->get_type() ) {
332
+ $variation_attributes = $product->get_variation_attributes();
333
+ $attributes = [];
334
+
335
+ foreach ( $variation_attributes as $attribute_name => $attribute_values ) {
336
+ $attribute_key = 'attribute_' . sanitize_title( $attribute_name );
337
+
338
+ // Passed value via GET takes precedence. Otherwise get the default value for given attribute
339
+ $attributes[ $attribute_key ] = isset( $_GET[ $attribute_key ] )
340
+ ? wc_clean( wp_unslash( $_GET[ $attribute_key ] ) )
341
+ : $product->get_variation_default_attribute( $attribute_name );
342
+ }
343
 
344
  $data_store = WC_Data_Store::load( 'product' );
345
  $variation_id = $data_store->find_matching_product_variation( $product, $attributes );
354
 
355
  $items[] = [
356
  'label' => $product->get_name(),
357
+ 'amount' => WC_Stripe_Helper::get_stripe_amount( $this->get_product_price( $product ) ),
358
  ];
359
 
360
  if ( wc_tax_enabled() ) {
383
  $data['displayItems'] = $items;
384
  $data['total'] = [
385
  'label' => apply_filters( 'wc_stripe_payment_request_total_label', $this->total_label ),
386
+ 'amount' => WC_Stripe_Helper::get_stripe_amount( $this->get_product_price( $product ) ),
387
  'pending' => true,
388
  ];
389
 
407
  $order = wc_get_order( $post->ID );
408
  $method_title = is_object( $order ) ? $order->get_payment_method_title() : '';
409
 
410
+ if ( 'stripe' === $id && ! empty( $method_title ) ) {
411
+ if ( 'Apple Pay (Stripe)' === $method_title
412
+ || 'Google Pay (Stripe)' === $method_title
413
+ || 'Payment Request (Stripe)' === $method_title
414
+ ) {
415
+ return $method_title;
416
+ }
417
 
418
+ // We renamed 'Chrome Payment Request' to just 'Payment Request' since Payment Requests
419
+ // are supported by other browsers besides Chrome. As such, we need to check for the
420
+ // old title to make sure older orders still reflect that they were paid via Payment
421
+ // Request Buttons.
422
+ if ( 'Chrome Payment Request (Stripe)' === $method_title ) {
423
+ return 'Payment Request (Stripe)';
424
+ }
425
  }
426
 
427
  return $title;
428
  }
429
 
430
  /**
431
+ * Normalizes postal code in case of redacted data from Apple Pay.
432
  *
433
+ * @since 5.2.0
434
+ *
435
+ * @param string $postcode Postal code.
436
+ * @param string $country Country.
437
  */
438
+ public function get_normalized_postal_code( $postcode, $country ) {
 
 
 
 
 
 
 
 
 
 
 
 
439
  /**
440
+ * Currently, Apple Pay truncates the UK and Canadian postal codes to the first 4 and 3 characters respectively
441
  * when passing it back from the shippingcontactselected object. This causes WC to invalidate
442
+ * the postal code and not calculate shipping zones correctly.
 
443
  */
444
+ if ( 'GB' === $country ) {
445
+ // Replaces a redacted string with something like LN10***.
446
+ return str_pad( preg_replace( '/\s+/', '', $postcode ), 7, '*' );
447
+ }
448
+ if ( 'CA' === $country ) {
449
+ // Replaces a redacted string with something like L4Y***.
450
+ return str_pad( preg_replace( '/\s+/', '', $postcode ), 6, '*' );
451
  }
452
 
453
+ return $postcode;
454
  }
455
 
456
  /**
475
  if ( 'apple_pay' === $payment_request_type ) {
476
  $order->set_payment_method_title( 'Apple Pay (Stripe)' );
477
  $order->save();
478
+ } elseif ( 'google_pay' === $payment_request_type ) {
479
+ $order->set_payment_method_title( 'Google Pay (Stripe)' );
480
+ $order->save();
481
+ } elseif ( 'payment_request_api' === $payment_request_type ) {
482
+ $order->set_payment_method_title( 'Payment Request (Stripe)' );
483
  $order->save();
484
  }
485
  }
542
  return true;
543
  }
544
 
545
+ /**
546
+ * Checks if this page contains a cart or checkout block.
547
+ *
548
+ * @since 5.2.0
549
+ * @return boolean
550
+ */
551
+ public function is_block() {
552
+ return has_block( 'woocommerce/cart' ) || has_block( 'woocommerce/checkout' );
553
+ }
554
+
555
+ /**
556
+ * Checks if this is a product page or content contains a product_page shortcode.
557
+ *
558
+ * @since 5.2.0
559
+ * @return boolean
560
+ */
561
+ public function is_product() {
562
+ return is_product() || wc_post_content_has_shortcode( 'product_page' );
563
+ }
564
+
565
+ /**
566
+ * Get product from product page or product_page shortcode.
567
+ *
568
+ * @since 5.2.0
569
+ * @return WC_Product Product object.
570
+ */
571
+ public function get_product() {
572
+ global $post;
573
+
574
+ if ( is_product() ) {
575
+ return wc_get_product( $post->ID );
576
+ } elseif ( wc_post_content_has_shortcode( 'product_page' ) ) {
577
+ // Get id from product_page shortcode.
578
+ preg_match( '/\[product_page id="(?<id>\d+)"\]/', $post->post_content, $shortcode_match );
579
+
580
+ if ( ! isset( $shortcode_match['id'] ) ) {
581
+ return false;
582
+ }
583
+
584
+ return wc_get_product( $shortcode_match['id'] );
585
+ }
586
+
587
+ return false;
588
+ }
589
+
590
  /**
591
  * Load public scripts and styles.
592
  *
593
  * @since 3.1.0
594
+ * @version 5.2.0
595
  */
596
  public function scripts() {
597
  // If keys are not set bail.
606
  return;
607
  }
608
 
609
+ // If page is not supported, bail.
610
+ if ( ! $this->is_block() && ! $this->is_product() && ! is_cart() && ! is_checkout() && ! isset( $_GET['pay_for_order'] ) ) {
611
  return;
612
  }
613
 
614
+ if ( $this->is_product() && ! $this->should_show_payment_button_on_product_page() ) {
615
+ return;
616
+ } elseif ( ! $this->should_show_payment_button_on_cart() ) {
617
  return;
618
  }
619
 
658
  'css_selector' => $this->custom_button_selector(),
659
  'branded_type' => $this->get_button_branded_type(),
660
  ],
661
+ 'is_product_page' => $this->is_product(),
662
  'product' => $this->get_product_data(),
663
  ];
664
 
679
  * Display the payment request button.
680
  *
681
  * @since 4.0.0
682
+ * @version 5.2.0
683
  */
684
  public function display_payment_request_button_html() {
685
  global $post;
690
  return;
691
  }
692
 
693
+ if ( ! is_cart() && ! is_checkout() && ! $this->is_product() && ! isset( $_GET['pay_for_order'] ) ) {
694
  return;
695
  }
696
 
697
  if ( is_checkout() && ! apply_filters( 'wc_stripe_show_payment_request_on_checkout', false, $post ) ) {
698
  return;
699
  }
 
 
 
 
 
 
700
  ?>
701
  <div id="wc-stripe-payment-request-wrapper" style="clear:both;padding-top:1.5em;display:none;">
702
  <div id="wc-stripe-payment-request-button">
718
  * Display payment request button separator.
719
  *
720
  * @since 4.0.0
721
+ * @version 5.2.0
722
  */
723
  public function display_payment_request_button_separator_html() {
724
  global $post;
729
  return;
730
  }
731
 
732
+ if ( ! is_cart() && ! is_checkout() && ! $this->is_product() && ! isset( $_GET['pay_for_order'] ) ) {
733
  return;
734
  }
735
 
736
  if ( is_checkout() && ! apply_filters( 'wc_stripe_show_payment_request_on_checkout', false, $post ) ) {
737
  return;
738
  }
 
 
 
 
 
 
739
  ?>
740
  <p id="wc-stripe-payment-request-button-separator" style="margin-top:1.5em;text-align:center;display:none;">&mdash; <?php esc_html_e( 'OR', 'woocommerce-gateway-stripe' ); ?> &mdash;</p>
741
  <?php
768
  * Whether payment button html should be rendered
769
  *
770
  * @since 4.3.2
771
+ * @version 5.2.0
772
  * @return boolean
773
  */
774
  private function should_show_payment_button_on_product_page() {
775
  global $post;
776
 
 
 
777
  if ( apply_filters( 'wc_stripe_hide_payment_request_on_product_page', false, $post ) ) {
778
  return false;
779
  }
780
 
781
+ $product = $this->get_product();
782
+
783
  if ( ! is_object( $product ) || ! in_array( $product->get_type(), $this->supported_product_types() ) ) {
784
  return false;
785
  }
1067
  throw new Exception( sprintf( __( 'You cannot add that amount of "%1$s"; to the cart because there is not enough stock (%2$s remaining).', 'woocommerce-gateway-stripe' ), $product->get_name(), wc_format_stock_quantity_for_display( $product->get_stock_quantity(), $product ) ) );
1068
  }
1069
 
1070
+ $total = $qty * $this->get_product_price( $product ) + $addon_value;
1071
 
1072
  $quantity_label = 1 < $qty ? ' (x' . $qty . ')' : '';
1073
 
1389
  // Normalizes state to calculate shipping zones.
1390
  $state = $this->get_normalized_state( $state, $country );
1391
 
1392
+ // Normalizes postal code in case of redacted data from Apple Pay.
1393
+ $postcode = $this->get_normalized_postal_code( $postcode, $country );
1394
+
1395
  WC()->shipping->reset_shipping();
1396
 
1397
  if ( $postcode && WC_Validation::is_postcode( $postcode, $country ) ) {
languages/woocommerce-gateway-stripe.pot CHANGED
@@ -2,17 +2,17 @@
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 5.1.0\n"
6
  "Report-Msgid-Bugs-To: "
7
  "https://wordpress.org/support/plugin/woocommerce-gateway-stripe\n"
8
- "POT-Creation-Date: 2021-04-07 19:43:23+00:00\n"
9
  "MIME-Version: 1.0\n"
10
  "Content-Type: text/plain; charset=utf-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
12
  "PO-Revision-Date: 2021-MO-DA HO:MI+ZONE\n"
13
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
14
  "Language-Team: LANGUAGE <LL@li.org>\n"
15
- "X-Generator: node-wp-i18n 1.2.3\n"
16
 
17
  #: includes/abstracts/abstract-wc-stripe-payment-gateway.php:25
18
  #. translators: 1) webhook url
@@ -29,7 +29,7 @@ msgstr ""
29
  msgid "Save payment information to my account for future purchases."
30
  msgstr ""
31
 
32
- #: includes/abstracts/abstract-wc-stripe-payment-gateway.php:251
33
  #: includes/compat/class-wc-stripe-sepa-subs-compat.php:230
34
  #: includes/compat/class-wc-stripe-subs-compat.php:243
35
  #. translators: 1) amount (including currency symbol)
@@ -37,25 +37,25 @@ msgstr ""
37
  msgid "Sorry, the minimum allowed order total is %1$s to use this payment method."
38
  msgstr ""
39
 
40
- #: includes/abstracts/abstract-wc-stripe-payment-gateway.php:344
41
  #. translators: 1) blog name 2) order number
42
  msgid "%1$s - Order %2$s"
43
  msgstr ""
44
 
45
- #: includes/abstracts/abstract-wc-stripe-payment-gateway.php:385
46
  msgid "customer_name"
47
  msgstr ""
48
 
49
- #: includes/abstracts/abstract-wc-stripe-payment-gateway.php:386
50
  msgid "customer_email"
51
  msgstr ""
52
 
53
- #: includes/abstracts/abstract-wc-stripe-payment-gateway.php:449
54
  #. translators: transaction id
55
  msgid "Stripe charge awaiting payment: %s."
56
  msgstr ""
57
 
58
- #: includes/abstracts/abstract-wc-stripe-payment-gateway.php:456
59
  #: includes/class-wc-stripe-order-handler.php:299
60
  #: includes/class-wc-stripe-webhook-handler.php:415
61
  #: includes/class-wc-stripe-webhook-handler.php:465
@@ -63,13 +63,13 @@ msgstr ""
63
  msgid "Stripe charge complete (Charge ID: %s)"
64
  msgstr ""
65
 
66
- #: includes/abstracts/abstract-wc-stripe-payment-gateway.php:461
67
- #: includes/class-wc-gateway-stripe.php:503
68
  #: includes/compat/class-wc-stripe-sepa-subs-compat.php:187
69
  msgid "Payment processing failed. Please retry."
70
  msgstr ""
71
 
72
- #: includes/abstracts/abstract-wc-stripe-payment-gateway.php:473
73
  #. translators: transaction id
74
  msgid ""
75
  "Stripe charge authorized (Charge ID: %s). Process order to take payment, or "
@@ -77,28 +77,33 @@ msgid ""
77
  "part or in full will release the authorization and cancel the payment."
78
  msgstr ""
79
 
80
- #: includes/abstracts/abstract-wc-stripe-payment-gateway.php:654
81
  msgid "Invalid payment method. Please input a new card number."
82
  msgstr ""
83
 
84
- #: includes/abstracts/abstract-wc-stripe-payment-gateway.php:926
 
 
 
 
 
85
  #. translators: amount (including currency symbol)
86
  msgid "Pre-Authorization for %s voided."
87
  msgstr ""
88
 
89
- #: includes/abstracts/abstract-wc-stripe-payment-gateway.php:931
90
  msgid ""
91
  "The authorization was voided and the order cancelled. Click okay to "
92
  "continue, then refresh the page."
93
  msgstr ""
94
 
95
- #: includes/abstracts/abstract-wc-stripe-payment-gateway.php:945
96
  #. translators: 1) amount (including currency symbol) 2) transaction id 3)
97
  #. refund message
98
  msgid "Refunded %1$s - Refund ID: %2$s - Reason: %3$s"
99
  msgstr ""
100
 
101
- #: includes/abstracts/abstract-wc-stripe-payment-gateway.php:963
102
  msgid "There was a problem adding the payment method."
103
  msgstr ""
104
 
@@ -199,37 +204,37 @@ msgstr ""
199
  msgid "Cheatin&#8217; huh?"
200
  msgstr ""
201
 
202
- #: includes/admin/class-wc-stripe-inbox-notes.php:42
203
  msgid "Boost sales this holiday season with Apple Pay!"
204
  msgstr ""
205
 
206
- #: includes/admin/class-wc-stripe-inbox-notes.php:45
207
  msgid "Boost sales with Apple Pay!"
208
  msgstr ""
209
 
210
- #: includes/admin/class-wc-stripe-inbox-notes.php:126
211
  msgid ""
212
  "Now that you accept Apple Pay® with Stripe, you can increase conversion "
213
  "rates by letting your customers know that Apple Pay is available. Here’s a "
214
  "marketing guide to help you get started."
215
  msgstr ""
216
 
217
- #: includes/admin/class-wc-stripe-inbox-notes.php:132
218
  msgid "See marketing guide"
219
  msgstr ""
220
 
221
- #: includes/admin/class-wc-stripe-inbox-notes.php:145
222
  msgid "Apple Pay domain verification needed"
223
  msgstr ""
224
 
225
- #: includes/admin/class-wc-stripe-inbox-notes.php:146
226
  msgid ""
227
  "The WooCommerce Stripe Gateway extension attempted to perform domain "
228
  "verification on behalf of your store, but was unable to do so. This must be "
229
  "resolved before Apple Pay can be offered to your customers."
230
  msgstr ""
231
 
232
- #: includes/admin/class-wc-stripe-inbox-notes.php:152
233
  msgid "Learn more"
234
  msgstr ""
235
 
@@ -363,7 +368,7 @@ msgstr ""
363
  #: includes/admin/stripe-multibanco-settings.php:18
364
  #: includes/admin/stripe-p24-settings.php:18
365
  #: includes/admin/stripe-sepa-settings.php:22
366
- #: includes/admin/stripe-settings.php:43
367
  #: includes/admin/stripe-sofort-settings.php:22
368
  msgid "Enable/Disable"
369
  msgstr ""
@@ -380,7 +385,7 @@ msgstr ""
380
  #: includes/admin/stripe-multibanco-settings.php:25
381
  #: includes/admin/stripe-p24-settings.php:25
382
  #: includes/admin/stripe-sepa-settings.php:29
383
- #: includes/admin/stripe-settings.php:50
384
  #: includes/admin/stripe-sofort-settings.php:29
385
  msgid "Title"
386
  msgstr ""
@@ -393,7 +398,7 @@ msgstr ""
393
  #: includes/admin/stripe-multibanco-settings.php:27
394
  #: includes/admin/stripe-p24-settings.php:27
395
  #: includes/admin/stripe-sepa-settings.php:31
396
- #: includes/admin/stripe-settings.php:52
397
  #: includes/admin/stripe-sofort-settings.php:31
398
  msgid "This controls the title which the user sees during checkout."
399
  msgstr ""
@@ -410,7 +415,7 @@ msgstr ""
410
  #: includes/admin/stripe-multibanco-settings.php:32
411
  #: includes/admin/stripe-p24-settings.php:32
412
  #: includes/admin/stripe-sepa-settings.php:36
413
- #: includes/admin/stripe-settings.php:57
414
  #: includes/admin/stripe-sofort-settings.php:36
415
  msgid "Description"
416
  msgstr ""
@@ -423,7 +428,7 @@ msgstr ""
423
  #: includes/admin/stripe-multibanco-settings.php:34
424
  #: includes/admin/stripe-p24-settings.php:34
425
  #: includes/admin/stripe-sepa-settings.php:38
426
- #: includes/admin/stripe-settings.php:59
427
  #: includes/admin/stripe-sofort-settings.php:38
428
  msgid "This controls the description which the user sees during checkout."
429
  msgstr ""
@@ -440,7 +445,7 @@ msgstr ""
440
  #: includes/admin/stripe-multibanco-settings.php:39
441
  #: includes/admin/stripe-p24-settings.php:39
442
  #: includes/admin/stripe-sepa-settings.php:43
443
- #: includes/admin/stripe-settings.php:105
444
  #: includes/admin/stripe-sofort-settings.php:43
445
  msgid "Webhook Endpoints"
446
  msgstr ""
@@ -584,126 +589,106 @@ msgstr ""
584
  msgid "Mandate Information."
585
  msgstr ""
586
 
587
- #: includes/admin/stripe-settings.php:17
588
- #. translators: %1, %2, %3, and %4 are all HTML markup tags
589
- msgid ""
590
- "%1$sClear all Stripe account keys.%2$s %3$sThis will disable any connection "
591
- "to Stripe.%4$s"
592
- msgstr ""
593
-
594
- #: includes/admin/stripe-settings.php:29
595
- #. translators: %1, %2 and %3 are all HTML markup tags
596
- msgid ""
597
- "%1$sSetup or link an existing Stripe account.%2$s By clicking this button "
598
- "you agree to the %3$sTerms of Service%2$s. Or, manually enter Stripe "
599
- "account keys below."
600
- msgstr ""
601
-
602
- #: includes/admin/stripe-settings.php:35
603
- msgid "Manually enter Stripe keys below."
604
- msgstr ""
605
-
606
- #: includes/admin/stripe-settings.php:44
607
  msgid "Enable Stripe"
608
  msgstr ""
609
 
610
- #: includes/admin/stripe-settings.php:53
611
  msgid "Credit Card (Stripe)"
612
  msgstr ""
613
 
614
- #: includes/admin/stripe-settings.php:60
615
  msgid "Pay with your credit card via Stripe."
616
  msgstr ""
617
 
618
- #: includes/admin/stripe-settings.php:64
619
  msgid "Stripe Account Keys"
620
  msgstr ""
621
 
622
- #: includes/admin/stripe-settings.php:69
623
  msgid "Test mode"
624
  msgstr ""
625
 
626
- #: includes/admin/stripe-settings.php:70
627
  msgid "Enable Test Mode"
628
  msgstr ""
629
 
630
- #: includes/admin/stripe-settings.php:72
631
  msgid "Place the payment gateway in test mode using test API keys."
632
  msgstr ""
633
 
634
- #: includes/admin/stripe-settings.php:77
635
  msgid "Test Publishable Key"
636
  msgstr ""
637
 
638
- #: includes/admin/stripe-settings.php:79
639
  msgid ""
640
  "Get your API keys from your stripe account. Invalid values will be "
641
  "rejected. Only values starting with \"pk_test_\" will be saved."
642
  msgstr ""
643
 
644
- #: includes/admin/stripe-settings.php:84
645
  msgid "Test Secret Key"
646
  msgstr ""
647
 
648
- #: includes/admin/stripe-settings.php:86
649
  msgid ""
650
  "Get your API keys from your stripe account. Invalid values will be "
651
  "rejected. Only values starting with \"sk_test_\" or \"rk_test_\" will be "
652
  "saved."
653
  msgstr ""
654
 
655
- #: includes/admin/stripe-settings.php:91
656
  msgid "Live Publishable Key"
657
  msgstr ""
658
 
659
- #: includes/admin/stripe-settings.php:93
660
  msgid ""
661
  "Get your API keys from your stripe account. Invalid values will be "
662
  "rejected. Only values starting with \"pk_live_\" will be saved."
663
  msgstr ""
664
 
665
- #: includes/admin/stripe-settings.php:98
666
  msgid "Live Secret Key"
667
  msgstr ""
668
 
669
- #: includes/admin/stripe-settings.php:100
670
  msgid ""
671
  "Get your API keys from your stripe account. Invalid values will be "
672
  "rejected. Only values starting with \"sk_live_\" or \"rk_live_\" will be "
673
  "saved."
674
  msgstr ""
675
 
676
- #: includes/admin/stripe-settings.php:110
677
  msgid "Test Webhook Secret"
678
  msgstr ""
679
 
680
- #: includes/admin/stripe-settings.php:112
681
- #: includes/admin/stripe-settings.php:119
682
  msgid ""
683
  "Get your webhook signing secret from the webhooks section in your stripe "
684
  "account."
685
  msgstr ""
686
 
687
- #: includes/admin/stripe-settings.php:117
688
  msgid "Webhook Secret"
689
  msgstr ""
690
 
691
- #: includes/admin/stripe-settings.php:124
692
  msgid "Inline Credit Card Form"
693
  msgstr ""
694
 
695
- #: includes/admin/stripe-settings.php:126
696
  msgid ""
697
  "Choose the style you want to show for your credit card form. When "
698
  "unchecked, the credit card form will display separate credit card number "
699
  "field, expiry date field and cvc field."
700
  msgstr ""
701
 
702
- #: includes/admin/stripe-settings.php:131
703
  msgid "Statement Descriptor"
704
  msgstr ""
705
 
706
- #: includes/admin/stripe-settings.php:133
707
  msgid ""
708
  "Statement descriptors are limited to 22 characters, cannot use the special "
709
  "characters >, <, \", \\, ', *, /, (, ), {, }, and must not consist solely "
@@ -711,26 +696,26 @@ msgid ""
711
  "letters."
712
  msgstr ""
713
 
714
- #: includes/admin/stripe-settings.php:138
715
  msgid "Capture"
716
  msgstr ""
717
 
718
- #: includes/admin/stripe-settings.php:139
719
  msgid "Capture charge immediately"
720
  msgstr ""
721
 
722
- #: includes/admin/stripe-settings.php:141
723
  msgid ""
724
  "Whether or not to immediately capture the charge. When unchecked, the "
725
  "charge issues an authorization and will need to be captured later. "
726
  "Uncaptured charges expire in 7 days."
727
  msgstr ""
728
 
729
- #: includes/admin/stripe-settings.php:146
730
  msgid "Payment Request Buttons"
731
  msgstr ""
732
 
733
- #: includes/admin/stripe-settings.php:149
734
  #. translators: 1) br tag 2) Stripe anchor tag 3) Apple anchor tag 4) Stripe
735
  #. dashboard opening anchor tag 5) Stripe dashboard closing anchor tag
736
  msgid ""
@@ -740,141 +725,141 @@ msgid ""
740
  "found on the %4$sStripe dashboard%5$s.)"
741
  msgstr ""
742
 
743
- #: includes/admin/stripe-settings.php:157
744
  msgid ""
745
  "If enabled, users will be able to pay using Apple Pay or Chrome Payment "
746
  "Request if supported by the browser."
747
  msgstr ""
748
 
749
- #: includes/admin/stripe-settings.php:162
750
  msgid "Payment Request Button Type"
751
  msgstr ""
752
 
753
- #: includes/admin/stripe-settings.php:163
754
  msgid "Button Type"
755
  msgstr ""
756
 
757
- #: includes/admin/stripe-settings.php:165
758
  msgid "Select the button type you would like to show."
759
  msgstr ""
760
 
761
- #: includes/admin/stripe-settings.php:169
762
  msgid "Default"
763
  msgstr ""
764
 
765
- #: includes/admin/stripe-settings.php:170
766
  msgid "Buy"
767
  msgstr ""
768
 
769
- #: includes/admin/stripe-settings.php:171
770
  msgid "Donate"
771
  msgstr ""
772
 
773
- #: includes/admin/stripe-settings.php:172
774
  msgid "Branded"
775
  msgstr ""
776
 
777
- #: includes/admin/stripe-settings.php:173
778
  msgid "Custom"
779
  msgstr ""
780
 
781
- #: includes/admin/stripe-settings.php:177
782
  msgid "Payment Request Button Theme"
783
  msgstr ""
784
 
785
- #: includes/admin/stripe-settings.php:178
786
  msgid "Button Theme"
787
  msgstr ""
788
 
789
- #: includes/admin/stripe-settings.php:180
790
  msgid "Select the button theme you would like to show."
791
  msgstr ""
792
 
793
- #: includes/admin/stripe-settings.php:184
794
  msgid "Dark"
795
  msgstr ""
796
 
797
- #: includes/admin/stripe-settings.php:185
798
  msgid "Light"
799
  msgstr ""
800
 
801
- #: includes/admin/stripe-settings.php:186
802
  msgid "Light-Outline"
803
  msgstr ""
804
 
805
- #: includes/admin/stripe-settings.php:190
806
  msgid "Payment Request Button Height"
807
  msgstr ""
808
 
809
- #: includes/admin/stripe-settings.php:191
810
  msgid "Button Height"
811
  msgstr ""
812
 
813
- #: includes/admin/stripe-settings.php:193
814
  msgid ""
815
  "Enter the height you would like the button to be in pixels. Width will "
816
  "always be 100%."
817
  msgstr ""
818
 
819
- #: includes/admin/stripe-settings.php:198
820
  msgid "Payment Request Button Label"
821
  msgstr ""
822
 
823
- #: includes/admin/stripe-settings.php:199
824
  msgid "Button Label"
825
  msgstr ""
826
 
827
- #: includes/admin/stripe-settings.php:201
828
  msgid "Enter the custom text you would like the button to have."
829
  msgstr ""
830
 
831
- #: includes/admin/stripe-settings.php:202
832
  msgid "Buy now"
833
  msgstr ""
834
 
835
- #: includes/admin/stripe-settings.php:206
836
  msgid "Payment Request Branded Button Label Format"
837
  msgstr ""
838
 
839
- #: includes/admin/stripe-settings.php:207
840
  msgid "Branded Button Label Format"
841
  msgstr ""
842
 
843
- #: includes/admin/stripe-settings.php:209
844
  msgid "Select the branded button label format."
845
  msgstr ""
846
 
847
- #: includes/admin/stripe-settings.php:213
848
  msgid "Logo only"
849
  msgstr ""
850
 
851
- #: includes/admin/stripe-settings.php:214
852
  msgid "Text and logo"
853
  msgstr ""
854
 
855
- #: includes/admin/stripe-settings.php:218
856
  msgid "Saved Cards"
857
  msgstr ""
858
 
859
- #: includes/admin/stripe-settings.php:219
860
  msgid "Enable Payment via Saved Cards"
861
  msgstr ""
862
 
863
- #: includes/admin/stripe-settings.php:221
864
  msgid ""
865
  "If enabled, users will be able to pay with a saved card during checkout. "
866
  "Card details are saved on Stripe servers, not on your store."
867
  msgstr ""
868
 
869
- #: includes/admin/stripe-settings.php:226
870
  msgid "Logging"
871
  msgstr ""
872
 
873
- #: includes/admin/stripe-settings.php:227
874
  msgid "Log debug messages"
875
  msgstr ""
876
 
877
- #: includes/admin/stripe-settings.php:229
878
  msgid "Save debug messages to the WooCommerce System Status log."
879
  msgstr ""
880
 
@@ -957,49 +942,49 @@ msgstr ""
957
  msgid "Please fill in required checkout fields first"
958
  msgstr ""
959
 
960
- #: includes/class-wc-gateway-stripe.php:445
961
- #: includes/class-wc-gateway-stripe.php:490
962
  msgid ""
963
  "Sorry, we're not accepting prepaid cards at this time. Your credit card has "
964
  "not been charged. Please try with alternative payment method."
965
  msgstr ""
966
 
967
- #: includes/class-wc-gateway-stripe.php:446
968
  msgid "Please enter your IBAN account name."
969
  msgstr ""
970
 
971
- #: includes/class-wc-gateway-stripe.php:447
972
  msgid "Please enter your IBAN account number."
973
  msgstr ""
974
 
975
- #: includes/class-wc-gateway-stripe.php:448
976
  msgid "We couldn't initiate the payment. Please try again."
977
  msgstr ""
978
 
979
- #: includes/class-wc-gateway-stripe.php:459
980
  msgid "Billing First Name and Last Name are required."
981
  msgstr ""
982
 
983
- #: includes/class-wc-gateway-stripe.php:731
984
  #. translators: error message
985
  msgid "This represents the fee Stripe collects for the transaction."
986
  msgstr ""
987
 
988
- #: includes/class-wc-gateway-stripe.php:732
989
  msgid "Stripe Fee:"
990
  msgstr ""
991
 
992
- #: includes/class-wc-gateway-stripe.php:768
993
  msgid ""
994
  "This represents the net total that will be credited to your Stripe bank "
995
  "account. This may be in the currency that is set in your Stripe account."
996
  msgstr ""
997
 
998
- #: includes/class-wc-gateway-stripe.php:769
999
  msgid "Stripe Payout:"
1000
  msgstr ""
1001
 
1002
- #: includes/class-wc-gateway-stripe.php:832
1003
  #: includes/class-wc-stripe-order-handler.php:159
1004
  #: includes/class-wc-stripe-webhook-handler.php:264
1005
  #: includes/compat/class-wc-stripe-sepa-subs-compat.php:287
@@ -1010,7 +995,7 @@ msgid ""
1010
  "later."
1011
  msgstr ""
1012
 
1013
- #: includes/class-wc-gateway-stripe.php:885
1014
  msgid ""
1015
  "Almost there!\n"
1016
  "\n"
@@ -1018,47 +1003,66 @@ msgid ""
1018
  "done is for you to authorize the payment with your bank."
1019
  msgstr ""
1020
 
1021
- #: includes/class-wc-gateway-stripe.php:907
1022
  #. translators: %s is the order Id
1023
  msgid "Payment Intent not found for order #%s"
1024
  msgstr ""
1025
 
1026
- #: includes/class-wc-gateway-stripe.php:1133
1027
  #: includes/class-wc-stripe-webhook-handler.php:768
1028
  #: includes/class-wc-stripe-webhook-handler.php:813
1029
  #. translators: 1) The error message that was received from Stripe.
1030
  msgid "Stripe SCA authentication failed. Reason: %s"
1031
  msgstr ""
1032
 
1033
- #: includes/class-wc-gateway-stripe.php:1134
1034
  msgid "Stripe SCA authentication failed."
1035
  msgstr ""
1036
 
1037
- #: includes/class-wc-gateway-stripe.php:1191
1038
  msgid ""
1039
  "The \"Live Publishable Key\" should start with \"pk_live\", enter the "
1040
  "correct key."
1041
  msgstr ""
1042
 
1043
- #: includes/class-wc-gateway-stripe.php:1199
1044
  msgid ""
1045
  "The \"Live Secret Key\" should start with \"sk_live\" or \"rk_live\", enter "
1046
  "the correct key."
1047
  msgstr ""
1048
 
1049
- #: includes/class-wc-gateway-stripe.php:1207
1050
  msgid ""
1051
  "The \"Test Publishable Key\" should start with \"pk_test\", enter the "
1052
  "correct key."
1053
  msgstr ""
1054
 
1055
- #: includes/class-wc-gateway-stripe.php:1215
1056
  msgid ""
1057
  "The \"Test Secret Key\" should start with \"sk_test\" or \"rk_test\", enter "
1058
  "the correct key."
1059
  msgstr ""
1060
 
1061
- #: includes/class-wc-stripe-api.php:143 includes/class-wc-stripe-api.php:177
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1062
  msgid "There was a problem connecting to the Stripe API endpoint."
1063
  msgstr ""
1064
 
@@ -1104,6 +1108,34 @@ msgid ""
1104
  "be enabled to see recorded logs."
1105
  msgstr ""
1106
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1107
  #: includes/class-wc-stripe-customer.php:130
1108
  #. translators: %1$s First name, %2$s Second name, %3$s Username.
1109
  msgid "Name: %1$s %2$s, Username: %3$s"
@@ -1114,11 +1146,11 @@ msgstr ""
1114
  msgid "Name: %1$s %2$s, Guest"
1115
  msgstr ""
1116
 
1117
- #: includes/class-wc-stripe-customer.php:204
1118
  msgid "Attempting to update a Stripe customer without a customer ID."
1119
  msgstr ""
1120
 
1121
- #: includes/class-wc-stripe-customer.php:353
1122
  msgid "Unable to add payment source."
1123
  msgstr ""
1124
 
@@ -1214,15 +1246,15 @@ msgstr ""
1214
  msgid "Payment verification error: %s"
1215
  msgstr ""
1216
 
1217
- #: includes/class-wc-stripe-intent-controller.php:160
1218
  msgid "Unable to verify your request. Please reload the page and try again."
1219
  msgstr ""
1220
 
1221
- #: includes/class-wc-stripe-intent-controller.php:200
1222
  msgid "Your card could not be set up for future usage."
1223
  msgstr ""
1224
 
1225
- #: includes/class-wc-stripe-intent-controller.php:217
1226
  msgid "Failed to save payment method."
1227
  msgstr ""
1228
 
@@ -1594,7 +1626,7 @@ msgid "You are not authorized to clear Stripe account keys."
1594
  msgstr ""
1595
 
1596
  #: includes/payment-methods/class-wc-gateway-stripe-alipay.php:61
1597
- #: woocommerce-gateway-stripe.php:305
1598
  msgid "Stripe Alipay"
1599
  msgstr ""
1600
 
@@ -1623,27 +1655,27 @@ msgid "Add Payment"
1623
  msgstr ""
1624
 
1625
  #: includes/payment-methods/class-wc-gateway-stripe-bancontact.php:61
1626
- #: woocommerce-gateway-stripe.php:299
1627
  msgid "Stripe Bancontact"
1628
  msgstr ""
1629
 
1630
  #: includes/payment-methods/class-wc-gateway-stripe-eps.php:61
1631
- #: woocommerce-gateway-stripe.php:302
1632
  msgid "Stripe EPS"
1633
  msgstr ""
1634
 
1635
  #: includes/payment-methods/class-wc-gateway-stripe-giropay.php:61
1636
- #: woocommerce-gateway-stripe.php:301
1637
  msgid "Stripe Giropay"
1638
  msgstr ""
1639
 
1640
  #: includes/payment-methods/class-wc-gateway-stripe-ideal.php:61
1641
- #: woocommerce-gateway-stripe.php:303
1642
  msgid "Stripe iDeal"
1643
  msgstr ""
1644
 
1645
  #: includes/payment-methods/class-wc-gateway-stripe-multibanco.php:61
1646
- #: woocommerce-gateway-stripe.php:307
1647
  msgid "Stripe Multibanco"
1648
  msgstr ""
1649
 
@@ -1672,12 +1704,12 @@ msgid "Awaiting Multibanco payment"
1672
  msgstr ""
1673
 
1674
  #: includes/payment-methods/class-wc-gateway-stripe-p24.php:61
1675
- #: woocommerce-gateway-stripe.php:304
1676
  msgid "Stripe P24"
1677
  msgstr ""
1678
 
1679
  #: includes/payment-methods/class-wc-gateway-stripe-sepa.php:76
1680
- #: woocommerce-gateway-stripe.php:306
1681
  msgid "Stripe SEPA Direct Debit"
1682
  msgstr ""
1683
 
@@ -1704,58 +1736,58 @@ msgid ""
1704
  msgstr ""
1705
 
1706
  #: includes/payment-methods/class-wc-gateway-stripe-sofort.php:61
1707
- #: woocommerce-gateway-stripe.php:300
1708
  msgid "Stripe SOFORT"
1709
  msgstr ""
1710
 
1711
- #: includes/payment-methods/class-wc-stripe-payment-request.php:337
1712
- #: includes/payment-methods/class-wc-stripe-payment-request.php:1018
1713
- #: includes/payment-methods/class-wc-stripe-payment-request.php:1445
1714
  msgid "Tax"
1715
  msgstr ""
1716
 
1717
- #: includes/payment-methods/class-wc-stripe-payment-request.php:345
1718
- #: includes/payment-methods/class-wc-stripe-payment-request.php:1026
1719
- #: includes/payment-methods/class-wc-stripe-payment-request.php:1452
1720
  msgid "Shipping"
1721
  msgstr ""
1722
 
1723
- #: includes/payment-methods/class-wc-stripe-payment-request.php:352
1724
- #: includes/payment-methods/class-wc-stripe-payment-request.php:1033
1725
  msgid "Pending"
1726
  msgstr ""
1727
 
1728
- #: includes/payment-methods/class-wc-stripe-payment-request.php:562
1729
  msgid "Sorry, we're not accepting prepaid cards at this time."
1730
  msgstr ""
1731
 
1732
- #: includes/payment-methods/class-wc-stripe-payment-request.php:564
1733
  #. translators: Do not translate the [option] placeholder
1734
  msgid "Unknown shipping option \"[option]\"."
1735
  msgstr ""
1736
 
1737
- #: includes/payment-methods/class-wc-stripe-payment-request.php:675
1738
  msgid "OR"
1739
  msgstr ""
1740
 
1741
- #: includes/payment-methods/class-wc-stripe-payment-request.php:867
1742
- #: includes/payment-methods/class-wc-stripe-payment-request.php:880
1743
  msgid "Unable to find shipping method for address."
1744
  msgstr ""
1745
 
1746
- #: includes/payment-methods/class-wc-stripe-payment-request.php:980
1747
  #. translators: %d is the product Id
1748
  msgid "Product with the ID (%d) cannot be found."
1749
  msgstr ""
1750
 
1751
- #: includes/payment-methods/class-wc-stripe-payment-request.php:1001
1752
  #. translators: 1: product name 2: quantity in stock
1753
  msgid ""
1754
  "You cannot add that amount of \"%1$s\"; to the cart because there is not "
1755
  "enough stock (%2$s remaining)."
1756
  msgstr ""
1757
 
1758
- #: includes/payment-methods/class-wc-stripe-payment-request.php:1273
1759
  #. translators: %s: country.
1760
  msgid ""
1761
  "The Payment Request button is not supported in %s because some required "
@@ -1763,11 +1795,11 @@ msgid ""
1763
  "again."
1764
  msgstr ""
1765
 
1766
- #: includes/payment-methods/class-wc-stripe-payment-request.php:1289
1767
  msgid "Empty cart"
1768
  msgstr ""
1769
 
1770
- #: includes/payment-methods/class-wc-stripe-payment-request.php:1459
1771
  msgid "Discount"
1772
  msgstr ""
1773
 
@@ -1810,23 +1842,23 @@ msgid ""
1810
  "WooCommerce %2$s is no longer supported."
1811
  msgstr ""
1812
 
1813
- #: woocommerce-gateway-stripe.php:229
1814
  msgid "Settings"
1815
  msgstr ""
1816
 
1817
- #: woocommerce-gateway-stripe.php:245
1818
  msgid "View Documentation"
1819
  msgstr ""
1820
 
1821
- #: woocommerce-gateway-stripe.php:245
1822
  msgid "Docs"
1823
  msgstr ""
1824
 
1825
- #: woocommerce-gateway-stripe.php:246
1826
  msgid "Open a support request at WooCommerce.com"
1827
  msgstr ""
1828
 
1829
- #: woocommerce-gateway-stripe.php:246
1830
  msgid "Support"
1831
  msgstr ""
1832
 
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 5.2.0\n"
6
  "Report-Msgid-Bugs-To: "
7
  "https://wordpress.org/support/plugin/woocommerce-gateway-stripe\n"
8
+ "POT-Creation-Date: 2021-05-19 17:02:17+00:00\n"
9
  "MIME-Version: 1.0\n"
10
  "Content-Type: text/plain; charset=utf-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
12
  "PO-Revision-Date: 2021-MO-DA HO:MI+ZONE\n"
13
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
14
  "Language-Team: LANGUAGE <LL@li.org>\n"
15
+ "X-Generator: node-wp-i18n 1.2.5\n"
16
 
17
  #: includes/abstracts/abstract-wc-stripe-payment-gateway.php:25
18
  #. translators: 1) webhook url
29
  msgid "Save payment information to my account for future purchases."
30
  msgstr ""
31
 
32
+ #: includes/abstracts/abstract-wc-stripe-payment-gateway.php:257
33
  #: includes/compat/class-wc-stripe-sepa-subs-compat.php:230
34
  #: includes/compat/class-wc-stripe-subs-compat.php:243
35
  #. translators: 1) amount (including currency symbol)
37
  msgid "Sorry, the minimum allowed order total is %1$s to use this payment method."
38
  msgstr ""
39
 
40
+ #: includes/abstracts/abstract-wc-stripe-payment-gateway.php:350
41
  #. translators: 1) blog name 2) order number
42
  msgid "%1$s - Order %2$s"
43
  msgstr ""
44
 
45
+ #: includes/abstracts/abstract-wc-stripe-payment-gateway.php:391
46
  msgid "customer_name"
47
  msgstr ""
48
 
49
+ #: includes/abstracts/abstract-wc-stripe-payment-gateway.php:392
50
  msgid "customer_email"
51
  msgstr ""
52
 
53
+ #: includes/abstracts/abstract-wc-stripe-payment-gateway.php:455
54
  #. translators: transaction id
55
  msgid "Stripe charge awaiting payment: %s."
56
  msgstr ""
57
 
58
+ #: includes/abstracts/abstract-wc-stripe-payment-gateway.php:462
59
  #: includes/class-wc-stripe-order-handler.php:299
60
  #: includes/class-wc-stripe-webhook-handler.php:415
61
  #: includes/class-wc-stripe-webhook-handler.php:465
63
  msgid "Stripe charge complete (Charge ID: %s)"
64
  msgstr ""
65
 
66
+ #: includes/abstracts/abstract-wc-stripe-payment-gateway.php:467
67
+ #: includes/class-wc-gateway-stripe.php:504
68
  #: includes/compat/class-wc-stripe-sepa-subs-compat.php:187
69
  msgid "Payment processing failed. Please retry."
70
  msgstr ""
71
 
72
+ #: includes/abstracts/abstract-wc-stripe-payment-gateway.php:479
73
  #. translators: transaction id
74
  msgid ""
75
  "Stripe charge authorized (Charge ID: %s). Process order to take payment, or "
77
  "part or in full will release the authorization and cancel the payment."
78
  msgstr ""
79
 
80
+ #: includes/abstracts/abstract-wc-stripe-payment-gateway.php:660
81
  msgid "Invalid payment method. Please input a new card number."
82
  msgstr ""
83
 
84
+ #: includes/abstracts/abstract-wc-stripe-payment-gateway.php:925
85
+ #. translators: %1$s is a stripe error message
86
+ msgid "There was a problem initiating a refund: %1$s"
87
+ msgstr ""
88
+
89
+ #: includes/abstracts/abstract-wc-stripe-payment-gateway.php:939
90
  #. translators: amount (including currency symbol)
91
  msgid "Pre-Authorization for %s voided."
92
  msgstr ""
93
 
94
+ #: includes/abstracts/abstract-wc-stripe-payment-gateway.php:944
95
  msgid ""
96
  "The authorization was voided and the order cancelled. Click okay to "
97
  "continue, then refresh the page."
98
  msgstr ""
99
 
100
+ #: includes/abstracts/abstract-wc-stripe-payment-gateway.php:958
101
  #. translators: 1) amount (including currency symbol) 2) transaction id 3)
102
  #. refund message
103
  msgid "Refunded %1$s - Refund ID: %2$s - Reason: %3$s"
104
  msgstr ""
105
 
106
+ #: includes/abstracts/abstract-wc-stripe-payment-gateway.php:976
107
  msgid "There was a problem adding the payment method."
108
  msgstr ""
109
 
204
  msgid "Cheatin&#8217; huh?"
205
  msgstr ""
206
 
207
+ #: includes/admin/class-wc-stripe-inbox-notes.php:40
208
  msgid "Boost sales this holiday season with Apple Pay!"
209
  msgstr ""
210
 
211
+ #: includes/admin/class-wc-stripe-inbox-notes.php:43
212
  msgid "Boost sales with Apple Pay!"
213
  msgstr ""
214
 
215
+ #: includes/admin/class-wc-stripe-inbox-notes.php:122
216
  msgid ""
217
  "Now that you accept Apple Pay® with Stripe, you can increase conversion "
218
  "rates by letting your customers know that Apple Pay is available. Here’s a "
219
  "marketing guide to help you get started."
220
  msgstr ""
221
 
222
+ #: includes/admin/class-wc-stripe-inbox-notes.php:128
223
  msgid "See marketing guide"
224
  msgstr ""
225
 
226
+ #: includes/admin/class-wc-stripe-inbox-notes.php:142
227
  msgid "Apple Pay domain verification needed"
228
  msgstr ""
229
 
230
+ #: includes/admin/class-wc-stripe-inbox-notes.php:143
231
  msgid ""
232
  "The WooCommerce Stripe Gateway extension attempted to perform domain "
233
  "verification on behalf of your store, but was unable to do so. This must be "
234
  "resolved before Apple Pay can be offered to your customers."
235
  msgstr ""
236
 
237
+ #: includes/admin/class-wc-stripe-inbox-notes.php:149
238
  msgid "Learn more"
239
  msgstr ""
240
 
368
  #: includes/admin/stripe-multibanco-settings.php:18
369
  #: includes/admin/stripe-p24-settings.php:18
370
  #: includes/admin/stripe-sepa-settings.php:22
371
+ #: includes/admin/stripe-settings.php:10
372
  #: includes/admin/stripe-sofort-settings.php:22
373
  msgid "Enable/Disable"
374
  msgstr ""
385
  #: includes/admin/stripe-multibanco-settings.php:25
386
  #: includes/admin/stripe-p24-settings.php:25
387
  #: includes/admin/stripe-sepa-settings.php:29
388
+ #: includes/admin/stripe-settings.php:17
389
  #: includes/admin/stripe-sofort-settings.php:29
390
  msgid "Title"
391
  msgstr ""
398
  #: includes/admin/stripe-multibanco-settings.php:27
399
  #: includes/admin/stripe-p24-settings.php:27
400
  #: includes/admin/stripe-sepa-settings.php:31
401
+ #: includes/admin/stripe-settings.php:19
402
  #: includes/admin/stripe-sofort-settings.php:31
403
  msgid "This controls the title which the user sees during checkout."
404
  msgstr ""
415
  #: includes/admin/stripe-multibanco-settings.php:32
416
  #: includes/admin/stripe-p24-settings.php:32
417
  #: includes/admin/stripe-sepa-settings.php:36
418
+ #: includes/admin/stripe-settings.php:24
419
  #: includes/admin/stripe-sofort-settings.php:36
420
  msgid "Description"
421
  msgstr ""
428
  #: includes/admin/stripe-multibanco-settings.php:34
429
  #: includes/admin/stripe-p24-settings.php:34
430
  #: includes/admin/stripe-sepa-settings.php:38
431
+ #: includes/admin/stripe-settings.php:26
432
  #: includes/admin/stripe-sofort-settings.php:38
433
  msgid "This controls the description which the user sees during checkout."
434
  msgstr ""
445
  #: includes/admin/stripe-multibanco-settings.php:39
446
  #: includes/admin/stripe-p24-settings.php:39
447
  #: includes/admin/stripe-sepa-settings.php:43
448
+ #: includes/admin/stripe-settings.php:71
449
  #: includes/admin/stripe-sofort-settings.php:43
450
  msgid "Webhook Endpoints"
451
  msgstr ""
589
  msgid "Mandate Information."
590
  msgstr ""
591
 
592
+ #: includes/admin/stripe-settings.php:11
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
593
  msgid "Enable Stripe"
594
  msgstr ""
595
 
596
+ #: includes/admin/stripe-settings.php:20
597
  msgid "Credit Card (Stripe)"
598
  msgstr ""
599
 
600
+ #: includes/admin/stripe-settings.php:27
601
  msgid "Pay with your credit card via Stripe."
602
  msgstr ""
603
 
604
+ #: includes/admin/stripe-settings.php:31
605
  msgid "Stripe Account Keys"
606
  msgstr ""
607
 
608
+ #: includes/admin/stripe-settings.php:35
609
  msgid "Test mode"
610
  msgstr ""
611
 
612
+ #: includes/admin/stripe-settings.php:36
613
  msgid "Enable Test Mode"
614
  msgstr ""
615
 
616
+ #: includes/admin/stripe-settings.php:38
617
  msgid "Place the payment gateway in test mode using test API keys."
618
  msgstr ""
619
 
620
+ #: includes/admin/stripe-settings.php:43
621
  msgid "Test Publishable Key"
622
  msgstr ""
623
 
624
+ #: includes/admin/stripe-settings.php:45
625
  msgid ""
626
  "Get your API keys from your stripe account. Invalid values will be "
627
  "rejected. Only values starting with \"pk_test_\" will be saved."
628
  msgstr ""
629
 
630
+ #: includes/admin/stripe-settings.php:50
631
  msgid "Test Secret Key"
632
  msgstr ""
633
 
634
+ #: includes/admin/stripe-settings.php:52
635
  msgid ""
636
  "Get your API keys from your stripe account. Invalid values will be "
637
  "rejected. Only values starting with \"sk_test_\" or \"rk_test_\" will be "
638
  "saved."
639
  msgstr ""
640
 
641
+ #: includes/admin/stripe-settings.php:57
642
  msgid "Live Publishable Key"
643
  msgstr ""
644
 
645
+ #: includes/admin/stripe-settings.php:59
646
  msgid ""
647
  "Get your API keys from your stripe account. Invalid values will be "
648
  "rejected. Only values starting with \"pk_live_\" will be saved."
649
  msgstr ""
650
 
651
+ #: includes/admin/stripe-settings.php:64
652
  msgid "Live Secret Key"
653
  msgstr ""
654
 
655
+ #: includes/admin/stripe-settings.php:66
656
  msgid ""
657
  "Get your API keys from your stripe account. Invalid values will be "
658
  "rejected. Only values starting with \"sk_live_\" or \"rk_live_\" will be "
659
  "saved."
660
  msgstr ""
661
 
662
+ #: includes/admin/stripe-settings.php:76
663
  msgid "Test Webhook Secret"
664
  msgstr ""
665
 
666
+ #: includes/admin/stripe-settings.php:78 includes/admin/stripe-settings.php:85
 
667
  msgid ""
668
  "Get your webhook signing secret from the webhooks section in your stripe "
669
  "account."
670
  msgstr ""
671
 
672
+ #: includes/admin/stripe-settings.php:83
673
  msgid "Webhook Secret"
674
  msgstr ""
675
 
676
+ #: includes/admin/stripe-settings.php:90
677
  msgid "Inline Credit Card Form"
678
  msgstr ""
679
 
680
+ #: includes/admin/stripe-settings.php:92
681
  msgid ""
682
  "Choose the style you want to show for your credit card form. When "
683
  "unchecked, the credit card form will display separate credit card number "
684
  "field, expiry date field and cvc field."
685
  msgstr ""
686
 
687
+ #: includes/admin/stripe-settings.php:97
688
  msgid "Statement Descriptor"
689
  msgstr ""
690
 
691
+ #: includes/admin/stripe-settings.php:99
692
  msgid ""
693
  "Statement descriptors are limited to 22 characters, cannot use the special "
694
  "characters >, <, \", \\, ', *, /, (, ), {, }, and must not consist solely "
696
  "letters."
697
  msgstr ""
698
 
699
+ #: includes/admin/stripe-settings.php:104
700
  msgid "Capture"
701
  msgstr ""
702
 
703
+ #: includes/admin/stripe-settings.php:105
704
  msgid "Capture charge immediately"
705
  msgstr ""
706
 
707
+ #: includes/admin/stripe-settings.php:107
708
  msgid ""
709
  "Whether or not to immediately capture the charge. When unchecked, the "
710
  "charge issues an authorization and will need to be captured later. "
711
  "Uncaptured charges expire in 7 days."
712
  msgstr ""
713
 
714
+ #: includes/admin/stripe-settings.php:112
715
  msgid "Payment Request Buttons"
716
  msgstr ""
717
 
718
+ #: includes/admin/stripe-settings.php:115
719
  #. translators: 1) br tag 2) Stripe anchor tag 3) Apple anchor tag 4) Stripe
720
  #. dashboard opening anchor tag 5) Stripe dashboard closing anchor tag
721
  msgid ""
725
  "found on the %4$sStripe dashboard%5$s.)"
726
  msgstr ""
727
 
728
+ #: includes/admin/stripe-settings.php:123
729
  msgid ""
730
  "If enabled, users will be able to pay using Apple Pay or Chrome Payment "
731
  "Request if supported by the browser."
732
  msgstr ""
733
 
734
+ #: includes/admin/stripe-settings.php:128
735
  msgid "Payment Request Button Type"
736
  msgstr ""
737
 
738
+ #: includes/admin/stripe-settings.php:129
739
  msgid "Button Type"
740
  msgstr ""
741
 
742
+ #: includes/admin/stripe-settings.php:131
743
  msgid "Select the button type you would like to show."
744
  msgstr ""
745
 
746
+ #: includes/admin/stripe-settings.php:135
747
  msgid "Default"
748
  msgstr ""
749
 
750
+ #: includes/admin/stripe-settings.php:136
751
  msgid "Buy"
752
  msgstr ""
753
 
754
+ #: includes/admin/stripe-settings.php:137
755
  msgid "Donate"
756
  msgstr ""
757
 
758
+ #: includes/admin/stripe-settings.php:138
759
  msgid "Branded"
760
  msgstr ""
761
 
762
+ #: includes/admin/stripe-settings.php:139
763
  msgid "Custom"
764
  msgstr ""
765
 
766
+ #: includes/admin/stripe-settings.php:143
767
  msgid "Payment Request Button Theme"
768
  msgstr ""
769
 
770
+ #: includes/admin/stripe-settings.php:144
771
  msgid "Button Theme"
772
  msgstr ""
773
 
774
+ #: includes/admin/stripe-settings.php:146
775
  msgid "Select the button theme you would like to show."
776
  msgstr ""
777
 
778
+ #: includes/admin/stripe-settings.php:150
779
  msgid "Dark"
780
  msgstr ""
781
 
782
+ #: includes/admin/stripe-settings.php:151
783
  msgid "Light"
784
  msgstr ""
785
 
786
+ #: includes/admin/stripe-settings.php:152
787
  msgid "Light-Outline"
788
  msgstr ""
789
 
790
+ #: includes/admin/stripe-settings.php:156
791
  msgid "Payment Request Button Height"
792
  msgstr ""
793
 
794
+ #: includes/admin/stripe-settings.php:157
795
  msgid "Button Height"
796
  msgstr ""
797
 
798
+ #: includes/admin/stripe-settings.php:159
799
  msgid ""
800
  "Enter the height you would like the button to be in pixels. Width will "
801
  "always be 100%."
802
  msgstr ""
803
 
804
+ #: includes/admin/stripe-settings.php:164
805
  msgid "Payment Request Button Label"
806
  msgstr ""
807
 
808
+ #: includes/admin/stripe-settings.php:165
809
  msgid "Button Label"
810
  msgstr ""
811
 
812
+ #: includes/admin/stripe-settings.php:167
813
  msgid "Enter the custom text you would like the button to have."
814
  msgstr ""
815
 
816
+ #: includes/admin/stripe-settings.php:168
817
  msgid "Buy now"
818
  msgstr ""
819
 
820
+ #: includes/admin/stripe-settings.php:172
821
  msgid "Payment Request Branded Button Label Format"
822
  msgstr ""
823
 
824
+ #: includes/admin/stripe-settings.php:173
825
  msgid "Branded Button Label Format"
826
  msgstr ""
827
 
828
+ #: includes/admin/stripe-settings.php:175
829
  msgid "Select the branded button label format."
830
  msgstr ""
831
 
832
+ #: includes/admin/stripe-settings.php:179
833
  msgid "Logo only"
834
  msgstr ""
835
 
836
+ #: includes/admin/stripe-settings.php:180
837
  msgid "Text and logo"
838
  msgstr ""
839
 
840
+ #: includes/admin/stripe-settings.php:184
841
  msgid "Saved Cards"
842
  msgstr ""
843
 
844
+ #: includes/admin/stripe-settings.php:185
845
  msgid "Enable Payment via Saved Cards"
846
  msgstr ""
847
 
848
+ #: includes/admin/stripe-settings.php:187
849
  msgid ""
850
  "If enabled, users will be able to pay with a saved card during checkout. "
851
  "Card details are saved on Stripe servers, not on your store."
852
  msgstr ""
853
 
854
+ #: includes/admin/stripe-settings.php:192
855
  msgid "Logging"
856
  msgstr ""
857
 
858
+ #: includes/admin/stripe-settings.php:193
859
  msgid "Log debug messages"
860
  msgstr ""
861
 
862
+ #: includes/admin/stripe-settings.php:195
863
  msgid "Save debug messages to the WooCommerce System Status log."
864
  msgstr ""
865
 
942
  msgid "Please fill in required checkout fields first"
943
  msgstr ""
944
 
945
+ #: includes/class-wc-gateway-stripe.php:446
946
+ #: includes/class-wc-gateway-stripe.php:491
947
  msgid ""
948
  "Sorry, we're not accepting prepaid cards at this time. Your credit card has "
949
  "not been charged. Please try with alternative payment method."
950
  msgstr ""
951
 
952
+ #: includes/class-wc-gateway-stripe.php:447
953
  msgid "Please enter your IBAN account name."
954
  msgstr ""
955
 
956
+ #: includes/class-wc-gateway-stripe.php:448
957
  msgid "Please enter your IBAN account number."
958
  msgstr ""
959
 
960
+ #: includes/class-wc-gateway-stripe.php:449
961
  msgid "We couldn't initiate the payment. Please try again."
962
  msgstr ""
963
 
964
+ #: includes/class-wc-gateway-stripe.php:460
965
  msgid "Billing First Name and Last Name are required."
966
  msgstr ""
967
 
968
+ #: includes/class-wc-gateway-stripe.php:760
969
  #. translators: error message
970
  msgid "This represents the fee Stripe collects for the transaction."
971
  msgstr ""
972
 
973
+ #: includes/class-wc-gateway-stripe.php:761
974
  msgid "Stripe Fee:"
975
  msgstr ""
976
 
977
+ #: includes/class-wc-gateway-stripe.php:797
978
  msgid ""
979
  "This represents the net total that will be credited to your Stripe bank "
980
  "account. This may be in the currency that is set in your Stripe account."
981
  msgstr ""
982
 
983
+ #: includes/class-wc-gateway-stripe.php:798
984
  msgid "Stripe Payout:"
985
  msgstr ""
986
 
987
+ #: includes/class-wc-gateway-stripe.php:861
988
  #: includes/class-wc-stripe-order-handler.php:159
989
  #: includes/class-wc-stripe-webhook-handler.php:264
990
  #: includes/compat/class-wc-stripe-sepa-subs-compat.php:287
995
  "later."
996
  msgstr ""
997
 
998
+ #: includes/class-wc-gateway-stripe.php:914
999
  msgid ""
1000
  "Almost there!\n"
1001
  "\n"
1003
  "done is for you to authorize the payment with your bank."
1004
  msgstr ""
1005
 
1006
+ #: includes/class-wc-gateway-stripe.php:936
1007
  #. translators: %s is the order Id
1008
  msgid "Payment Intent not found for order #%s"
1009
  msgstr ""
1010
 
1011
+ #: includes/class-wc-gateway-stripe.php:1167
1012
  #: includes/class-wc-stripe-webhook-handler.php:768
1013
  #: includes/class-wc-stripe-webhook-handler.php:813
1014
  #. translators: 1) The error message that was received from Stripe.
1015
  msgid "Stripe SCA authentication failed. Reason: %s"
1016
  msgstr ""
1017
 
1018
+ #: includes/class-wc-gateway-stripe.php:1168
1019
  msgid "Stripe SCA authentication failed."
1020
  msgstr ""
1021
 
1022
+ #: includes/class-wc-gateway-stripe.php:1225
1023
  msgid ""
1024
  "The \"Live Publishable Key\" should start with \"pk_live\", enter the "
1025
  "correct key."
1026
  msgstr ""
1027
 
1028
+ #: includes/class-wc-gateway-stripe.php:1233
1029
  msgid ""
1030
  "The \"Live Secret Key\" should start with \"sk_live\" or \"rk_live\", enter "
1031
  "the correct key."
1032
  msgstr ""
1033
 
1034
+ #: includes/class-wc-gateway-stripe.php:1241
1035
  msgid ""
1036
  "The \"Test Publishable Key\" should start with \"pk_test\", enter the "
1037
  "correct key."
1038
  msgstr ""
1039
 
1040
+ #: includes/class-wc-gateway-stripe.php:1249
1041
  msgid ""
1042
  "The \"Test Secret Key\" should start with \"sk_test\" or \"rk_test\", enter "
1043
  "the correct key."
1044
  msgstr ""
1045
 
1046
+ #: includes/class-wc-gateway-stripe.php:1289
1047
+ #. translators: %1, %2, %3, and %4 are all HTML markup tags
1048
+ msgid ""
1049
+ "%1$sClear all Stripe account keys.%2$s %3$sThis will disable any connection "
1050
+ "to Stripe.%4$s"
1051
+ msgstr ""
1052
+
1053
+ #: includes/class-wc-gateway-stripe.php:1301
1054
+ #. translators: %1, %2 and %3 are all HTML markup tags
1055
+ msgid ""
1056
+ "%1$sSetup or link an existing Stripe account.%2$s By clicking this button "
1057
+ "you agree to the %3$sTerms of Service%2$s. Or, manually enter Stripe "
1058
+ "account keys below."
1059
+ msgstr ""
1060
+
1061
+ #: includes/class-wc-gateway-stripe.php:1307
1062
+ msgid "Manually enter Stripe keys below."
1063
+ msgstr ""
1064
+
1065
+ #: includes/class-wc-stripe-api.php:148 includes/class-wc-stripe-api.php:182
1066
  msgid "There was a problem connecting to the Stripe API endpoint."
1067
  msgstr ""
1068
 
1108
  "be enabled to see recorded logs."
1109
  msgstr ""
1110
 
1111
+ #: includes/class-wc-stripe-blocks-support.php:164
1112
+ msgid "Credit / Debit Card"
1113
+ msgstr ""
1114
+
1115
+ #: includes/class-wc-stripe-blocks-support.php:221
1116
+ msgid "Visa"
1117
+ msgstr ""
1118
+
1119
+ #: includes/class-wc-stripe-blocks-support.php:225
1120
+ msgid "American Express"
1121
+ msgstr ""
1122
+
1123
+ #: includes/class-wc-stripe-blocks-support.php:229
1124
+ msgid "Mastercard"
1125
+ msgstr ""
1126
+
1127
+ #: includes/class-wc-stripe-blocks-support.php:236
1128
+ msgid "Discover"
1129
+ msgstr ""
1130
+
1131
+ #: includes/class-wc-stripe-blocks-support.php:240
1132
+ msgid "JCB"
1133
+ msgstr ""
1134
+
1135
+ #: includes/class-wc-stripe-blocks-support.php:244
1136
+ msgid "Diners"
1137
+ msgstr ""
1138
+
1139
  #: includes/class-wc-stripe-customer.php:130
1140
  #. translators: %1$s First name, %2$s Second name, %3$s Username.
1141
  msgid "Name: %1$s %2$s, Username: %3$s"
1146
  msgid "Name: %1$s %2$s, Guest"
1147
  msgstr ""
1148
 
1149
+ #: includes/class-wc-stripe-customer.php:205
1150
  msgid "Attempting to update a Stripe customer without a customer ID."
1151
  msgstr ""
1152
 
1153
+ #: includes/class-wc-stripe-customer.php:354
1154
  msgid "Unable to add payment source."
1155
  msgstr ""
1156
 
1246
  msgid "Payment verification error: %s"
1247
  msgstr ""
1248
 
1249
+ #: includes/class-wc-stripe-intent-controller.php:177
1250
  msgid "Unable to verify your request. Please reload the page and try again."
1251
  msgstr ""
1252
 
1253
+ #: includes/class-wc-stripe-intent-controller.php:217
1254
  msgid "Your card could not be set up for future usage."
1255
  msgstr ""
1256
 
1257
+ #: includes/class-wc-stripe-intent-controller.php:234
1258
  msgid "Failed to save payment method."
1259
  msgstr ""
1260
 
1626
  msgstr ""
1627
 
1628
  #: includes/payment-methods/class-wc-gateway-stripe-alipay.php:61
1629
+ #: woocommerce-gateway-stripe.php:307
1630
  msgid "Stripe Alipay"
1631
  msgstr ""
1632
 
1655
  msgstr ""
1656
 
1657
  #: includes/payment-methods/class-wc-gateway-stripe-bancontact.php:61
1658
+ #: woocommerce-gateway-stripe.php:301
1659
  msgid "Stripe Bancontact"
1660
  msgstr ""
1661
 
1662
  #: includes/payment-methods/class-wc-gateway-stripe-eps.php:61
1663
+ #: woocommerce-gateway-stripe.php:304
1664
  msgid "Stripe EPS"
1665
  msgstr ""
1666
 
1667
  #: includes/payment-methods/class-wc-gateway-stripe-giropay.php:61
1668
+ #: woocommerce-gateway-stripe.php:303
1669
  msgid "Stripe Giropay"
1670
  msgstr ""
1671
 
1672
  #: includes/payment-methods/class-wc-gateway-stripe-ideal.php:61
1673
+ #: woocommerce-gateway-stripe.php:305
1674
  msgid "Stripe iDeal"
1675
  msgstr ""
1676
 
1677
  #: includes/payment-methods/class-wc-gateway-stripe-multibanco.php:61
1678
+ #: woocommerce-gateway-stripe.php:309
1679
  msgid "Stripe Multibanco"
1680
  msgstr ""
1681
 
1704
  msgstr ""
1705
 
1706
  #: includes/payment-methods/class-wc-gateway-stripe-p24.php:61
1707
+ #: woocommerce-gateway-stripe.php:306
1708
  msgid "Stripe P24"
1709
  msgstr ""
1710
 
1711
  #: includes/payment-methods/class-wc-gateway-stripe-sepa.php:76
1712
+ #: woocommerce-gateway-stripe.php:308
1713
  msgid "Stripe SEPA Direct Debit"
1714
  msgstr ""
1715
 
1736
  msgstr ""
1737
 
1738
  #: includes/payment-methods/class-wc-gateway-stripe-sofort.php:61
1739
+ #: woocommerce-gateway-stripe.php:302
1740
  msgid "Stripe SOFORT"
1741
  msgstr ""
1742
 
1743
+ #: includes/payment-methods/class-wc-stripe-payment-request.php:362
1744
+ #: includes/payment-methods/class-wc-stripe-payment-request.php:1084
1745
+ #: includes/payment-methods/class-wc-stripe-payment-request.php:1514
1746
  msgid "Tax"
1747
  msgstr ""
1748
 
1749
+ #: includes/payment-methods/class-wc-stripe-payment-request.php:370
1750
+ #: includes/payment-methods/class-wc-stripe-payment-request.php:1092
1751
+ #: includes/payment-methods/class-wc-stripe-payment-request.php:1521
1752
  msgid "Shipping"
1753
  msgstr ""
1754
 
1755
+ #: includes/payment-methods/class-wc-stripe-payment-request.php:377
1756
+ #: includes/payment-methods/class-wc-stripe-payment-request.php:1099
1757
  msgid "Pending"
1758
  msgstr ""
1759
 
1760
+ #: includes/payment-methods/class-wc-stripe-payment-request.php:639
1761
  msgid "Sorry, we're not accepting prepaid cards at this time."
1762
  msgstr ""
1763
 
1764
+ #: includes/payment-methods/class-wc-stripe-payment-request.php:641
1765
  #. translators: Do not translate the [option] placeholder
1766
  msgid "Unknown shipping option \"[option]\"."
1767
  msgstr ""
1768
 
1769
+ #: includes/payment-methods/class-wc-stripe-payment-request.php:740
1770
  msgid "OR"
1771
  msgstr ""
1772
 
1773
+ #: includes/payment-methods/class-wc-stripe-payment-request.php:933
1774
+ #: includes/payment-methods/class-wc-stripe-payment-request.php:946
1775
  msgid "Unable to find shipping method for address."
1776
  msgstr ""
1777
 
1778
+ #: includes/payment-methods/class-wc-stripe-payment-request.php:1046
1779
  #. translators: %d is the product Id
1780
  msgid "Product with the ID (%d) cannot be found."
1781
  msgstr ""
1782
 
1783
+ #: includes/payment-methods/class-wc-stripe-payment-request.php:1067
1784
  #. translators: 1: product name 2: quantity in stock
1785
  msgid ""
1786
  "You cannot add that amount of \"%1$s\"; to the cart because there is not "
1787
  "enough stock (%2$s remaining)."
1788
  msgstr ""
1789
 
1790
+ #: includes/payment-methods/class-wc-stripe-payment-request.php:1339
1791
  #. translators: %s: country.
1792
  msgid ""
1793
  "The Payment Request button is not supported in %s because some required "
1795
  "again."
1796
  msgstr ""
1797
 
1798
+ #: includes/payment-methods/class-wc-stripe-payment-request.php:1355
1799
  msgid "Empty cart"
1800
  msgstr ""
1801
 
1802
+ #: includes/payment-methods/class-wc-stripe-payment-request.php:1528
1803
  msgid "Discount"
1804
  msgstr ""
1805
 
1842
  "WooCommerce %2$s is no longer supported."
1843
  msgstr ""
1844
 
1845
+ #: woocommerce-gateway-stripe.php:231
1846
  msgid "Settings"
1847
  msgstr ""
1848
 
1849
+ #: woocommerce-gateway-stripe.php:247
1850
  msgid "View Documentation"
1851
  msgstr ""
1852
 
1853
+ #: woocommerce-gateway-stripe.php:247
1854
  msgid "Docs"
1855
  msgstr ""
1856
 
1857
+ #: woocommerce-gateway-stripe.php:248
1858
  msgid "Open a support request at WooCommerce.com"
1859
  msgstr ""
1860
 
1861
+ #: woocommerce-gateway-stripe.php:248
1862
  msgid "Support"
1863
  msgstr ""
1864
 
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.6
6
  Requires PHP: 5.6
7
- Stable tag: 5.1.0
8
  License: GPLv3
9
  License URI: https://www.gnu.org/licenses/gpl-3.0.html
10
  Attributions: thorsten-stripe
@@ -126,10 +126,20 @@ If you get stuck, you can ask for help in the Plugin Forum.
126
 
127
  == Changelog ==
128
 
129
- = 5.1.0 - 2021-04-07 =
130
-
131
- * Fix - Don't attempt to submit level 3 data for non-US merchants.
132
- * Fix - Hide Payment Request Buttons when guest checkout is disabled.
133
- * Fix - Match Payment Request states with WooCommerce states.
 
 
 
 
 
 
 
 
 
 
134
 
135
  [See changelog for all versions](https://raw.githubusercontent.com/woocommerce/woocommerce-gateway-stripe/trunk/changelog.txt).
4
  Requires at least: 4.4
5
  Tested up to: 5.6
6
  Requires PHP: 5.6
7
+ Stable tag: 5.2.0
8
  License: GPLv3
9
  License URI: https://www.gnu.org/licenses/gpl-3.0.html
10
  Attributions: thorsten-stripe
126
 
127
  == Changelog ==
128
 
129
+ = 5.2.0 - 2021-05-19 =
130
+
131
+ * Fix - Use `get_parent` method to avoid accessing `order` subscription property directly.
132
+ * Fix - Orders won't transition to 'Refunded' state if refund can't be created.
133
+ * Fix - Normalize United Kingdom and Canada postal codes for Apple Pay.
134
+ * Fix - Subscription sign-up fees not included in total for Payment Request Button.
135
+ * Fix - Reduce requests sent to server from stripe settings page.
136
+ * Fix - Choose the appropriate version of the WooCommerce Admin Notes API based on which API is available.
137
+ * Fix - Customer information is now correctly displayed in the Stripe Payments Dashboard when a new customer checks out through the WooCommerce Checkout Block.
138
+ * Fix - Pass customer language/locale to Stripe upon creation or modification.
139
+ * Fix - Initial price for Variable Products is now correctly shown when a Payment Request is started.
140
+ * Add - Support for Credit Card payments (incl. 3DS payments) via WooCommerce Blocks; limited to WooCommerce Core product types.
141
+ * Add - Support for payments (incl. 3DS payments) paid via Payment Request Buttons in WooCommerce Blocks; limited to WooCommerce Core product types.
142
+ * Add - Support for custom and branded Payment Request Buttons when using the Cart and Checkout blocks.
143
+ * Tweak - Should customer opt to save their card, the card is now saved after a payment has been confirmed.
144
 
145
  [See changelog for all versions](https://raw.githubusercontent.com/woocommerce/woocommerce-gateway-stripe/trunk/changelog.txt).
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: 5.1.0
9
  * Requires at least: 4.4
10
  * Tested up to: 5.6
11
  * WC requires at least: 3.0
@@ -21,7 +21,7 @@ if ( ! defined( 'ABSPATH' ) ) {
21
  /**
22
  * Required minimums and constants
23
  */
24
- define( 'WC_STRIPE_VERSION', '5.1.0' ); // WRCS: DEFINED_VERSION.
25
  define( 'WC_STRIPE_MIN_PHP_VER', '5.6.0' );
26
  define( 'WC_STRIPE_MIN_WC_VER', '3.0' );
27
  define( 'WC_STRIPE_FUTURE_MIN_WC_VER', '3.3' );
@@ -156,6 +156,7 @@ function woocommerce_gateway_stripe() {
156
  require_once dirname( __FILE__ ) . '/includes/payment-methods/class-wc-gateway-stripe-multibanco.php';
157
  require_once dirname( __FILE__ ) . '/includes/payment-methods/class-wc-stripe-payment-request.php';
158
  require_once dirname( __FILE__ ) . '/includes/compat/class-wc-stripe-subs-compat.php';
 
159
  require_once dirname( __FILE__ ) . '/includes/compat/class-wc-stripe-sepa-subs-compat.php';
160
  require_once dirname( __FILE__ ) . '/includes/connect/class-wc-stripe-connect.php';
161
  require_once dirname( __FILE__ ) . '/includes/connect/class-wc-stripe-connect-api.php';
@@ -214,6 +215,7 @@ function woocommerce_gateway_stripe() {
214
  define( 'WC_STRIPE_INSTALLING', true );
215
  }
216
 
 
217
  $this->update_plugin_version();
218
  }
219
  }
@@ -390,3 +392,49 @@ function woocommerce_gateway_stripe_init() {
390
 
391
  woocommerce_gateway_stripe();
392
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5
  * Description: Take credit card payments on your store using Stripe.
6
  * Author: WooCommerce
7
  * Author URI: https://woocommerce.com/
8
+ * Version: 5.2.0
9
  * Requires at least: 4.4
10
  * Tested up to: 5.6
11
  * WC requires at least: 3.0
21
  /**
22
  * Required minimums and constants
23
  */
24
+ define( 'WC_STRIPE_VERSION', '5.2.0' ); // WRCS: DEFINED_VERSION.
25
  define( 'WC_STRIPE_MIN_PHP_VER', '5.6.0' );
26
  define( 'WC_STRIPE_MIN_WC_VER', '3.0' );
27
  define( 'WC_STRIPE_FUTURE_MIN_WC_VER', '3.3' );
156
  require_once dirname( __FILE__ ) . '/includes/payment-methods/class-wc-gateway-stripe-multibanco.php';
157
  require_once dirname( __FILE__ ) . '/includes/payment-methods/class-wc-stripe-payment-request.php';
158
  require_once dirname( __FILE__ ) . '/includes/compat/class-wc-stripe-subs-compat.php';
159
+ require_once dirname( __FILE__ ) . '/includes/compat/class-wc-stripe-woo-compat-utils.php';
160
  require_once dirname( __FILE__ ) . '/includes/compat/class-wc-stripe-sepa-subs-compat.php';
161
  require_once dirname( __FILE__ ) . '/includes/connect/class-wc-stripe-connect.php';
162
  require_once dirname( __FILE__ ) . '/includes/connect/class-wc-stripe-connect-api.php';
215
  define( 'WC_STRIPE_INSTALLING', true );
216
  }
217
 
218
+ add_woocommerce_inbox_variant();
219
  $this->update_plugin_version();
220
  }
221
  }
392
 
393
  woocommerce_gateway_stripe();
394
  }
395
+
396
+ /**
397
+ * Add woocommerce_inbox_variant for the Remote Inbox Notification.
398
+ *
399
+ * P2 post can be found at https://wp.me/paJDYF-1uJ.
400
+ */
401
+ if ( ! function_exists( 'add_woocommerce_inbox_variant' ) ) {
402
+ function add_woocommerce_inbox_variant() {
403
+ $config_name = 'woocommerce_inbox_variant_assignment';
404
+ if ( false === get_option( $config_name, false ) ) {
405
+ update_option( $config_name, wp_rand( 1, 12 ) );
406
+ }
407
+ }
408
+ }
409
+ register_activation_hook( __FILE__, 'add_woocommerce_inbox_variant' );
410
+
411
+ // Hook in Blocks integration. This action is called in a callback on plugins loaded, so current Stripe plugin class
412
+ // implementation is too late.
413
+ add_action( 'woocommerce_blocks_loaded', 'woocommerce_gateway_stripe_woocommerce_block_support' );
414
+
415
+ function woocommerce_gateway_stripe_woocommerce_block_support() {
416
+ if ( class_exists( 'Automattic\WooCommerce\Blocks\Payments\Integrations\AbstractPaymentMethodType' ) ) {
417
+ require_once dirname( __FILE__ ) . '/includes/class-wc-stripe-blocks-support.php';
418
+ // priority is important here because this ensures this integration is
419
+ // registered before the WooCommerce Blocks built-in Stripe registration.
420
+ // Blocks code has a check in place to only register if 'stripe' is not
421
+ // already registered.
422
+ add_action(
423
+ 'woocommerce_blocks_payment_method_type_registration',
424
+ function( Automattic\WooCommerce\Blocks\Payments\PaymentMethodRegistry $payment_method_registry ) {
425
+ $container = Automattic\WooCommerce\Blocks\Package::container();
426
+ // registers as shared instance.
427
+ $container->register(
428
+ WC_Stripe_Blocks_Support::class,
429
+ function() {
430
+ return new WC_Stripe_Blocks_Support();
431
+ }
432
+ );
433
+ $payment_method_registry->register(
434
+ $container->get( WC_Stripe_Blocks_Support::class )
435
+ );
436
+ },
437
+ 5
438
+ );
439
+ }
440
+ }