Payment Plugins for Stripe WooCommerce - Version 3.2.1

Version Description

  • Updated - Plaid Link integration to use new Link Token
  • Updated - Convert state long name i.e. Texas
Download this release

Release Info

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

Code changes from version 3.2.0 to 3.2.1

Files changed (182) hide show
  1. assets/js/frontend/ach-payments.js +76 -59
  2. assets/js/frontend/applepay-checkout.js +2 -0
  3. assets/js/frontend/applepay-product.js +12 -7
  4. assets/js/frontend/googlepay-checkout.js +14 -7
  5. assets/js/frontend/googlepay-product.js +12 -7
  6. assets/js/frontend/mini-cart.js +4 -26
  7. assets/js/frontend/payment-request.js +27 -8
  8. assets/js/frontend/wc-stripe.js +1935 -1778
  9. assets/js/frontend/wc-stripe.min.js +5 -1
  10. composer.json +0 -5
  11. composer.lock +0 -76
  12. i18n/languages/woo-stripe-payment.pot +170 -203
  13. includes/abstract/abstract-wc-payment-gateway-stripe.php +234 -18
  14. includes/abstract/abstract-wc-stripe-payment.php +3 -0
  15. includes/admin/meta-boxes/views/html-product-data.php +56 -60
  16. includes/class-stripe.php +1 -1
  17. includes/class-wc-stripe-rest-api.php +3 -0
  18. includes/controllers/class-wc-stripe-controller-cart.php +10 -11
  19. includes/controllers/class-wc-stripe-controller-checkout.php +15 -0
  20. includes/controllers/class-wc-stripe-controller-googlepay.php +5 -2
  21. includes/controllers/class-wc-stripe-controller-plaid.php +35 -0
  22. includes/gateways/class-wc-payment-gateway-stripe-ach.php +28 -3
  23. includes/gateways/class-wc-payment-gateway-stripe-googlepay.php +72 -189
  24. includes/gateways/settings/ach-settings.php +1 -8
  25. includes/traits/wc-stripe-controller-traits.php +13 -0
  26. includes/wc-stripe-functions.php +25 -0
  27. readme.txt +7 -1
  28. stripe-payments.php +2 -2
  29. vendor/composer/installed.json +6 -6
  30. vendor/stripe/stripe-php/.gitignore +0 -31
  31. vendor/stripe/stripe-php/CHANGELOG.md +20 -0
  32. vendor/stripe/stripe-php/README.md +1 -1
  33. vendor/stripe/stripe-php/VERSION +1 -1
  34. vendor/stripe/stripe-php/composer.json +0 -48
  35. vendor/stripe/stripe-php/init.php +4 -0
  36. vendor/stripe/stripe-php/lib/Account.php +2 -0
  37. vendor/stripe/stripe-php/lib/AccountLink.php +2 -0
  38. vendor/stripe/stripe-php/lib/ApiRequestor.php +4 -2
  39. vendor/stripe/stripe-php/lib/ApplePayDomain.php +2 -0
  40. vendor/stripe/stripe-php/lib/ApplicationFee.php +2 -0
  41. vendor/stripe/stripe-php/lib/ApplicationFeeRefund.php +2 -0
  42. vendor/stripe/stripe-php/lib/Balance.php +2 -0
  43. vendor/stripe/stripe-php/lib/BalanceTransaction.php +2 -0
  44. vendor/stripe/stripe-php/lib/BankAccount.php +2 -0
  45. vendor/stripe/stripe-php/lib/BillingPortal/Session.php +2 -0
  46. vendor/stripe/stripe-php/lib/BitcoinReceiver.php +2 -0
  47. vendor/stripe/stripe-php/lib/BitcoinTransaction.php +2 -0
  48. vendor/stripe/stripe-php/lib/Capability.php +2 -0
  49. vendor/stripe/stripe-php/lib/Card.php +2 -0
  50. vendor/stripe/stripe-php/lib/Charge.php +2 -0
  51. vendor/stripe/stripe-php/lib/Checkout/Session.php +3 -1
  52. vendor/stripe/stripe-php/lib/CountrySpec.php +2 -0
  53. vendor/stripe/stripe-php/lib/Coupon.php +3 -0
  54. vendor/stripe/stripe-php/lib/CreditNote.php +2 -0
  55. vendor/stripe/stripe-php/lib/CreditNoteLineItem.php +2 -0
  56. vendor/stripe/stripe-php/lib/Customer.php +3 -1
  57. vendor/stripe/stripe-php/lib/CustomerBalanceTransaction.php +2 -0
  58. vendor/stripe/stripe-php/lib/Dispute.php +2 -0
  59. vendor/stripe/stripe-php/lib/EphemeralKey.php +2 -0
  60. vendor/stripe/stripe-php/lib/Event.php +2 -0
  61. vendor/stripe/stripe-php/lib/ExchangeRate.php +2 -0
  62. vendor/stripe/stripe-php/lib/File.php +3 -0
  63. vendor/stripe/stripe-php/lib/FileLink.php +2 -0
  64. vendor/stripe/stripe-php/lib/Invoice.php +2 -1
  65. vendor/stripe/stripe-php/lib/InvoiceItem.php +2 -1
  66. vendor/stripe/stripe-php/lib/InvoiceLineItem.php +2 -1
  67. vendor/stripe/stripe-php/lib/Issuing/Authorization.php +3 -0
  68. vendor/stripe/stripe-php/lib/Issuing/Card.php +2 -0
  69. vendor/stripe/stripe-php/lib/Issuing/Cardholder.php +2 -0
  70. vendor/stripe/stripe-php/lib/Issuing/Dispute.php +6 -5
  71. vendor/stripe/stripe-php/lib/Issuing/Transaction.php +3 -0
  72. vendor/stripe/stripe-php/lib/LineItem.php +2 -0
  73. vendor/stripe/stripe-php/lib/LoginLink.php +2 -0
  74. vendor/stripe/stripe-php/lib/Mandate.php +2 -0
  75. vendor/stripe/stripe-php/lib/Order.php +2 -0
  76. vendor/stripe/stripe-php/lib/OrderReturn.php +2 -0
  77. vendor/stripe/stripe-php/lib/PaymentIntent.php +2 -0
  78. vendor/stripe/stripe-php/lib/PaymentMethod.php +3 -0
  79. vendor/stripe/stripe-php/lib/Payout.php +2 -0
  80. vendor/stripe/stripe-php/lib/Person.php +2 -0
  81. vendor/stripe/stripe-php/lib/Plan.php +3 -1
  82. vendor/stripe/stripe-php/lib/Price.php +2 -0
  83. vendor/stripe/stripe-php/lib/Product.php +2 -0
  84. vendor/stripe/stripe-php/lib/PromotionCode.php +33 -0
  85. vendor/stripe/stripe-php/lib/Radar/EarlyFraudWarning.php +2 -0
  86. vendor/stripe/stripe-php/lib/Radar/ValueList.php +2 -0
  87. vendor/stripe/stripe-php/lib/Radar/ValueListItem.php +2 -0
  88. vendor/stripe/stripe-php/lib/Recipient.php +2 -0
  89. vendor/stripe/stripe-php/lib/Refund.php +2 -0
  90. vendor/stripe/stripe-php/lib/Reporting/ReportRun.php +2 -0
  91. vendor/stripe/stripe-php/lib/Reporting/ReportType.php +2 -0
  92. vendor/stripe/stripe-php/lib/Review.php +2 -0
  93. vendor/stripe/stripe-php/lib/SKU.php +2 -0
  94. vendor/stripe/stripe-php/lib/Service/AccountLinkService.php +2 -0
  95. vendor/stripe/stripe-php/lib/Service/AccountService.php +2 -0
  96. vendor/stripe/stripe-php/lib/Service/ApplePayDomainService.php +2 -0
  97. vendor/stripe/stripe-php/lib/Service/ApplicationFeeService.php +2 -0
  98. vendor/stripe/stripe-php/lib/Service/BalanceService.php +2 -0
  99. vendor/stripe/stripe-php/lib/Service/BalanceTransactionService.php +2 -0
  100. vendor/stripe/stripe-php/lib/Service/BillingPortal/BillingPortalServiceFactory.php +2 -0
  101. vendor/stripe/stripe-php/lib/Service/BillingPortal/SessionService.php +2 -0
  102. vendor/stripe/stripe-php/lib/Service/ChargeService.php +2 -0
  103. vendor/stripe/stripe-php/lib/Service/Checkout/CheckoutServiceFactory.php +2 -0
  104. vendor/stripe/stripe-php/lib/Service/Checkout/SessionService.php +2 -0
  105. vendor/stripe/stripe-php/lib/Service/CoreServiceFactory.php +4 -0
  106. vendor/stripe/stripe-php/lib/Service/CountrySpecService.php +2 -0
  107. vendor/stripe/stripe-php/lib/Service/CouponService.php +2 -0
  108. vendor/stripe/stripe-php/lib/Service/CreditNoteService.php +2 -0
  109. vendor/stripe/stripe-php/lib/Service/CustomerService.php +2 -0
  110. vendor/stripe/stripe-php/lib/Service/DisputeService.php +2 -0
  111. vendor/stripe/stripe-php/lib/Service/EphemeralKeyService.php +2 -0
  112. vendor/stripe/stripe-php/lib/Service/EventService.php +2 -0
  113. vendor/stripe/stripe-php/lib/Service/ExchangeRateService.php +2 -0
  114. vendor/stripe/stripe-php/lib/Service/FileLinkService.php +2 -0
  115. vendor/stripe/stripe-php/lib/Service/FileService.php +2 -0
  116. vendor/stripe/stripe-php/lib/Service/InvoiceItemService.php +5 -2
  117. vendor/stripe/stripe-php/lib/Service/InvoiceService.php +2 -0
  118. vendor/stripe/stripe-php/lib/Service/Issuing/AuthorizationService.php +2 -0
  119. vendor/stripe/stripe-php/lib/Service/Issuing/CardService.php +2 -0
  120. vendor/stripe/stripe-php/lib/Service/Issuing/CardholderService.php +2 -0
  121. vendor/stripe/stripe-php/lib/Service/Issuing/DisputeService.php +9 -1
  122. vendor/stripe/stripe-php/lib/Service/Issuing/IssuingServiceFactory.php +2 -0
  123. vendor/stripe/stripe-php/lib/Service/Issuing/TransactionService.php +2 -0
  124. vendor/stripe/stripe-php/lib/Service/MandateService.php +2 -0
  125. vendor/stripe/stripe-php/lib/Service/OAuthService.php +2 -2
  126. vendor/stripe/stripe-php/lib/Service/OrderReturnService.php +2 -0
  127. vendor/stripe/stripe-php/lib/Service/OrderService.php +2 -0
  128. vendor/stripe/stripe-php/lib/Service/PaymentIntentService.php +2 -0
  129. vendor/stripe/stripe-php/lib/Service/PaymentMethodService.php +2 -0
  130. vendor/stripe/stripe-php/lib/Service/PayoutService.php +2 -0
  131. vendor/stripe/stripe-php/lib/Service/PlanService.php +5 -2
  132. vendor/stripe/stripe-php/lib/Service/PriceService.php +2 -0
  133. vendor/stripe/stripe-php/lib/Service/ProductService.php +2 -0
  134. vendor/stripe/stripe-php/lib/Service/PromotionCodeService.php +72 -0
  135. vendor/stripe/stripe-php/lib/Service/Radar/EarlyFraudWarningService.php +2 -0
  136. vendor/stripe/stripe-php/lib/Service/Radar/RadarServiceFactory.php +2 -0
  137. vendor/stripe/stripe-php/lib/Service/Radar/ValueListItemService.php +2 -0
  138. vendor/stripe/stripe-php/lib/Service/Radar/ValueListService.php +2 -0
  139. vendor/stripe/stripe-php/lib/Service/RefundService.php +2 -0
  140. vendor/stripe/stripe-php/lib/Service/Reporting/ReportRunService.php +2 -0
  141. vendor/stripe/stripe-php/lib/Service/Reporting/ReportTypeService.php +2 -0
  142. vendor/stripe/stripe-php/lib/Service/Reporting/ReportingServiceFactory.php +2 -0
  143. vendor/stripe/stripe-php/lib/Service/ReviewService.php +2 -0
  144. vendor/stripe/stripe-php/lib/Service/SetupIntentService.php +2 -0
  145. vendor/stripe/stripe-php/lib/Service/Sigma/ScheduledQueryRunService.php +2 -0
  146. vendor/stripe/stripe-php/lib/Service/Sigma/SigmaServiceFactory.php +2 -0
  147. vendor/stripe/stripe-php/lib/Service/SkuService.php +2 -0
  148. vendor/stripe/stripe-php/lib/Service/SourceService.php +2 -0
  149. vendor/stripe/stripe-php/lib/Service/SubscriptionItemService.php +2 -0
  150. vendor/stripe/stripe-php/lib/Service/SubscriptionScheduleService.php +2 -0
  151. vendor/stripe/stripe-php/lib/Service/SubscriptionService.php +2 -0
  152. vendor/stripe/stripe-php/lib/Service/TaxRateService.php +2 -0
  153. vendor/stripe/stripe-php/lib/Service/Terminal/ConnectionTokenService.php +2 -0
  154. vendor/stripe/stripe-php/lib/Service/Terminal/LocationService.php +2 -0
  155. vendor/stripe/stripe-php/lib/Service/Terminal/ReaderService.php +2 -0
  156. vendor/stripe/stripe-php/lib/Service/Terminal/TerminalServiceFactory.php +2 -0
  157. vendor/stripe/stripe-php/lib/Service/TokenService.php +2 -0
  158. vendor/stripe/stripe-php/lib/Service/TopupService.php +2 -0
  159. vendor/stripe/stripe-php/lib/Service/TransferService.php +2 -0
  160. vendor/stripe/stripe-php/lib/Service/WebhookEndpointService.php +2 -0
  161. vendor/stripe/stripe-php/lib/SetupIntent.php +2 -0
  162. vendor/stripe/stripe-php/lib/Sigma/ScheduledQueryRun.php +2 -0
  163. vendor/stripe/stripe-php/lib/Source.php +2 -0
  164. vendor/stripe/stripe-php/lib/Stripe.php +1 -1
  165. vendor/stripe/stripe-php/lib/StripeClient.php +3 -0
  166. vendor/stripe/stripe-php/lib/Subscription.php +2 -3
  167. vendor/stripe/stripe-php/lib/SubscriptionItem.php +2 -0
  168. vendor/stripe/stripe-php/lib/SubscriptionSchedule.php +2 -0
  169. vendor/stripe/stripe-php/lib/TaxId.php +2 -0
  170. vendor/stripe/stripe-php/lib/TaxRate.php +2 -0
  171. vendor/stripe/stripe-php/lib/Terminal/ConnectionToken.php +2 -0
  172. vendor/stripe/stripe-php/lib/Terminal/Location.php +2 -0
  173. vendor/stripe/stripe-php/lib/Terminal/Reader.php +2 -0
  174. vendor/stripe/stripe-php/lib/ThreeDSecure.php +2 -0
  175. vendor/stripe/stripe-php/lib/Token.php +2 -0
  176. vendor/stripe/stripe-php/lib/Topup.php +2 -0
  177. vendor/stripe/stripe-php/lib/Transfer.php +2 -0
  178. vendor/stripe/stripe-php/lib/TransferReversal.php +2 -0
  179. vendor/stripe/stripe-php/lib/UsageRecord.php +2 -0
  180. vendor/stripe/stripe-php/lib/UsageRecordSummary.php +2 -0
  181. vendor/stripe/stripe-php/lib/Util/ObjectTypes.php +3 -0
  182. vendor/stripe/stripe-php/lib/WebhookEndpoint.php +2 -0
assets/js/frontend/ach-payments.js CHANGED
@@ -1,74 +1,91 @@
1
- (function($, wc_stripe) {
2
 
3
- function ACH() {
4
- wc_stripe.BaseGateway.call(this, wc_stripe_ach_params);
5
- wc_stripe.CheckoutGateway.call(this);
6
- this.metadata_key = this.params.metadata_key;
7
 
8
- $(document.body).on('payment_method_selected', this.payment_method_selected.bind(this));
9
- }
10
 
11
- ACH.prototype = $.extend({}, wc_stripe.BaseGateway.prototype, wc_stripe.CheckoutGateway.prototype);
12
 
13
- ACH.prototype.initialize = function() {
14
- $(document.body).on('click', '#place_order', this.place_order.bind(this));
15
- this.init_plaid();
16
- }
17
 
18
- ACH.prototype.init_plaid = function() {
19
- this.linkHandler = Plaid.create({
20
- env: this.params.env,
21
- clientName: this.params.client_name,
22
- key: this.params.public_key,
23
- product: ['auth'],
24
- selectAccount: true,
25
- countryCodes: ['US'],
26
- onSuccess: function(public_token, metadata) {
27
- // serialize metadata and submit form
28
- this.payment_token_received = true;
29
- this.set_nonce(public_token);
30
- this.set_metadata(metadata);
31
- $(this.container).closest('form').submit();
32
- }.bind(this),
33
- onExit: function(err, metadata) {
34
- if (err != null) {
35
- this.submit_error(err.error_message);
36
- }
37
- }.bind(this)
38
- });
39
- }
 
 
 
40
 
41
- ACH.prototype.place_order = function(e) {
42
- if (this.is_gateway_selected()) {
43
- if (!this.payment_token_received && !this.is_saved_method_selected()) {
44
- e.preventDefault();
45
- this.linkHandler.open();
46
- }
47
- }
48
- }
49
 
50
- ACH.prototype.hide_place_order = function() {
51
 
52
- }
53
 
54
- ACH.prototype.show_payment_button = function() {
55
- wc_stripe.CheckoutGateway.prototype.show_place_order.apply(this, arguments);
56
- }
57
 
58
- ACH.prototype.set_metadata = function(metadata) {
59
- $(this.metadata_key).val(JSON.stringify(metadata));
60
- }
61
 
62
- ACH.prototype.fees_enabled = function() {
63
- return this.params.fees_enabled == "1";
64
- }
65
 
66
- ACH.prototype.payment_method_selected = function() {
67
- if (this.fees_enabled()) {
68
- $(document.body).trigger('update_checkout');
69
- }
70
- }
71
 
72
- new ACH();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
73
 
74
  }(jQuery, window.wc_stripe))
1
+ (function ($, wc_stripe) {
2
 
3
+ function ACH() {
4
+ wc_stripe.BaseGateway.call(this, wc_stripe_ach_params);
5
+ wc_stripe.CheckoutGateway.call(this);
 
6
 
7
+ $(document.body).on('payment_method_selected', this.payment_method_selected.bind(this));
8
+ }
9
 
10
+ ACH.prototype = $.extend({}, wc_stripe.BaseGateway.prototype, wc_stripe.CheckoutGateway.prototype);
11
 
12
+ ACH.prototype.initialize = function () {
13
+ $(document.body).on('click', '#place_order', this.place_order.bind(this));
14
+ this.init_plaid();
15
+ }
16
 
17
+ ACH.prototype.init_plaid = function () {
18
+ this.fetch_link_token().then(function (link_token) {
19
+ this.linkHandler = Plaid.create({
20
+ clientName: this.params.client_name,
21
+ env: this.params.env,
22
+ product: ['auth'],
23
+ token: link_token,
24
+ selectAccount: true,
25
+ countryCodes: ['US'],
26
+ onSuccess: function (public_token, metadata) {
27
+ // serialize metadata and submit form
28
+ this.payment_token_received = true;
29
+ this.set_nonce(public_token);
30
+ this.set_metadata(metadata);
31
+ this.fields.toFormFields();
32
+ this.get_form().submit();
33
+ }.bind(this),
34
+ onExit: function (err, metadata) {
35
+ if (err != null) {
36
+ this.submit_error(err.error_message);
37
+ }
38
+ }.bind(this)
39
+ });
40
+ }.bind(this));
41
+ }
42
 
43
+ ACH.prototype.place_order = function (e) {
44
+ if (this.is_gateway_selected()) {
45
+ if (!this.payment_token_received && !this.is_saved_method_selected()) {
46
+ e.preventDefault();
47
+ this.linkHandler.open();
48
+ }
49
+ }
50
+ }
51
 
52
+ ACH.prototype.hide_place_order = function () {
53
 
54
+ }
55
 
56
+ ACH.prototype.show_payment_button = function () {
57
+ wc_stripe.CheckoutGateway.prototype.show_place_order.apply(this, arguments);
58
+ }
59
 
60
+ ACH.prototype.set_metadata = function (metadata) {
61
+ this.fields.set(this.gateway_id + '_metadata', JSON.stringify(metadata));
62
+ }
63
 
64
+ ACH.prototype.fees_enabled = function () {
65
+ return this.params.fees_enabled == "1";
66
+ }
67
 
68
+ ACH.prototype.payment_method_selected = function () {
69
+ if (this.fees_enabled()) {
70
+ $(document.body).trigger('update_checkout');
71
+ }
72
+ }
73
 
74
+ ACH.prototype.fetch_link_token = function () {
75
+ return new Promise(function (resolve) {
76
+ $.post({
77
+ url: this.params.routes.link_token,
78
+ dataType: 'json',
79
+ data: {_wpnonce: this.params.rest_nonce}
80
+ }).done(function (response) {
81
+ resolve(response.token);
82
+ }.bind(this)).fail(function (xhr, textStatus, errorThrown) {
83
+ $(this.container).hide();
84
+ console.log(errorThrown);
85
+ }.bind(this));
86
+ }.bind(this));
87
+ }
88
+
89
+ new ACH();
90
 
91
  }(jQuery, window.wc_stripe))
assets/js/frontend/applepay-checkout.js CHANGED
@@ -58,6 +58,8 @@
58
 
59
  ApplePay.prototype.on_token_received = function () {
60
  wc_stripe.CheckoutGateway.prototype.on_token_received.apply(this, arguments);
 
 
61
  if (this.checkout_fields_valid()) {
62
  this.get_form().submit();
63
  }
58
 
59
  ApplePay.prototype.on_token_received = function () {
60
  wc_stripe.CheckoutGateway.prototype.on_token_received.apply(this, arguments);
61
+ this.maybe_set_ship_to_different();
62
+ this.fields.toFormFields({update_shipping_method: false});
63
  if (this.checkout_fields_valid()) {
64
  this.get_form().submit();
65
  }
assets/js/frontend/applepay-product.js CHANGED
@@ -56,15 +56,20 @@
56
  $('#wc-stripe-applepay-container').append(this.$button);
57
  }
58
 
59
- ApplePay.prototype.add_to_cart = function (e) {
60
- if (this.$button.is('.disabled') && this.can_pay) {
61
- $('[name="quantity"]').val(this.old_qty);
62
- this.submit_error(this.params.messages.choose_product);
63
- return;
64
- }
65
  this.old_qty = this.get_quantity();
66
  var variation = this.get_product_data().variation;
67
- this.cart_calculation(variation.variation_id);
 
 
 
 
 
 
 
 
 
68
  }
69
 
70
  new ApplePay();
56
  $('#wc-stripe-applepay-container').append(this.$button);
57
  }
58
 
59
+ ApplePay.prototype.add_to_cart = function () {
60
+ this.disable_payment_button();
 
 
 
 
61
  this.old_qty = this.get_quantity();
62
  var variation = this.get_product_data().variation;
63
+ this.cart_calculation(variation.variation_id).then(function () {
64
+ if (this.is_variable_product()) {
65
+ this.createPaymentRequest();
66
+ wc_stripe.ApplePay.prototype.canMakePayment.apply(this, arguments).then(function () {
67
+ this.enable_payment_button();
68
+ }.bind(this));
69
+ } else {
70
+ this.enable_payment_button();
71
+ }
72
+ }.bind(this));
73
  }
74
 
75
  new ApplePay();
assets/js/frontend/googlepay-checkout.js CHANGED
@@ -1,4 +1,4 @@
1
- (function($, wc_stripe) {
2
 
3
  /**
4
  * @construct
@@ -18,10 +18,10 @@
18
  /**
19
  * @return {[type]}
20
  */
21
- GPay.prototype.initialize = function() {
22
  // create payments client
23
  this.createPaymentsClient();
24
- this.isReadyToPay().then(function() {
25
  $(this.container).show();
26
  if (this.banner_enabled()) {
27
  var $button = $(this.paymentsClient.createButton({
@@ -38,7 +38,7 @@
38
  /**
39
  * @return {[type]}
40
  */
41
- GPay.prototype.create_button = function() {
42
  wc_stripe.GooglePay.prototype.create_button.apply(this, arguments);
43
  $("#place_order").parent().append(this.$button);
44
  this.trigger_payment_method_selected();
@@ -47,7 +47,7 @@
47
  /**
48
  * @return {[type]}
49
  */
50
- GPay.prototype.updated_checkout = function() {
51
  if (this.can_pay) {
52
  $(this.container).show();
53
  this.create_button();
@@ -58,19 +58,26 @@
58
  * [banner_checkout description]
59
  * @return {[type]} [description]
60
  */
61
- GPay.prototype.banner_checkout = function() {
62
  this.set_payment_method(this.gateway_id);
63
  this.set_use_new_option(true);
64
  wc_stripe.GooglePay.prototype.start.apply(this, arguments);
65
  }
66
 
67
- GPay.prototype.on_token_received = function() {
68
  wc_stripe.CheckoutGateway.prototype.on_token_received.apply(this, arguments);
 
 
69
  if (this.checkout_fields_valid()) {
70
  this.get_form().submit();
71
  }
72
  }
73
 
 
 
 
 
 
74
  new GPay();
75
 
76
  }(jQuery, window.wc_stripe))
1
+ (function ($, wc_stripe) {
2
 
3
  /**
4
  * @construct
18
  /**
19
  * @return {[type]}
20
  */
21
+ GPay.prototype.initialize = function () {
22
  // create payments client
23
  this.createPaymentsClient();
24
+ this.isReadyToPay().then(function () {
25
  $(this.container).show();
26
  if (this.banner_enabled()) {
27
  var $button = $(this.paymentsClient.createButton({
38
  /**
39
  * @return {[type]}
40
  */
41
+ GPay.prototype.create_button = function () {
42
  wc_stripe.GooglePay.prototype.create_button.apply(this, arguments);
43
  $("#place_order").parent().append(this.$button);
44
  this.trigger_payment_method_selected();
47
  /**
48
  * @return {[type]}
49
  */
50
+ GPay.prototype.updated_checkout = function () {
51
  if (this.can_pay) {
52
  $(this.container).show();
53
  this.create_button();
58
  * [banner_checkout description]
59
  * @return {[type]} [description]
60
  */
61
+ GPay.prototype.banner_checkout = function () {
62
  this.set_payment_method(this.gateway_id);
63
  this.set_use_new_option(true);
64
  wc_stripe.GooglePay.prototype.start.apply(this, arguments);
65
  }
66
 
67
+ GPay.prototype.on_token_received = function () {
68
  wc_stripe.CheckoutGateway.prototype.on_token_received.apply(this, arguments);
69
+ this.maybe_set_ship_to_different();
70
+ this.fields.toFormFields({update_shipping_method: false});
71
  if (this.checkout_fields_valid()) {
72
  this.get_form().submit();
73
  }
74
  }
75
 
76
+ GPay.prototype.payment_data_updated = function (response) {
77
+ this.populate_billing_fields(response.address);
78
+ this.fields.toFormFields({update_shipping_method: false});
79
+ }
80
+
81
  new GPay();
82
 
83
  }(jQuery, window.wc_stripe))
assets/js/frontend/googlepay-product.js CHANGED
@@ -1,4 +1,4 @@
1
- (function($, wc_stripe) {
2
 
3
  /**
4
  * @constructor
@@ -17,9 +17,9 @@
17
  /**
18
  * @return {[type]}
19
  */
20
- GPay.prototype.initialize = function() {
21
  this.createPaymentsClient();
22
- this.isReadyToPay().then(function() {
23
  $(this.container).show();
24
  $(this.container).parent().parent().addClass('active');
25
  }.bind(this))
@@ -28,7 +28,7 @@
28
  /**
29
  * @return {[type]}
30
  */
31
- GPay.prototype.create_button = function() {
32
  wc_stripe.GooglePay.prototype.create_button.apply(this, arguments);
33
  $('#wc-stripe-googlepay-container').append(this.$button);
34
 
@@ -41,16 +41,16 @@
41
  /**
42
  * @return {[type]}
43
  */
44
- GPay.prototype.get_button = function() {
45
  return $(this.$button).find('.gpay-button');
46
  }
47
 
48
  /**
49
  * @return {[type]}
50
  */
51
- GPay.prototype.start = function() {
52
  if (this.get_quantity() > 0) {
53
- this.add_to_cart().then(function(data) {
54
  wc_stripe.GooglePay.prototype.start.apply(this, arguments);
55
  }.bind(this))
56
  } else {
@@ -58,6 +58,11 @@
58
  }
59
  }
60
 
 
 
 
 
 
61
  new GPay();
62
 
63
  }(jQuery, wc_stripe))
1
+ (function ($, wc_stripe) {
2
 
3
  /**
4
  * @constructor
17
  /**
18
  * @return {[type]}
19
  */
20
+ GPay.prototype.initialize = function () {
21
  this.createPaymentsClient();
22
+ this.isReadyToPay().then(function () {
23
  $(this.container).show();
24
  $(this.container).parent().parent().addClass('active');
25
  }.bind(this))
28
  /**
29
  * @return {[type]}
30
  */
31
+ GPay.prototype.create_button = function () {
32
  wc_stripe.GooglePay.prototype.create_button.apply(this, arguments);
33
  $('#wc-stripe-googlepay-container').append(this.$button);
34
 
41
  /**
42
  * @return {[type]}
43
  */
44
+ GPay.prototype.get_button = function () {
45
  return $(this.$button).find('.gpay-button');
46
  }
47
 
48
  /**
49
  * @return {[type]}
50
  */
51
+ GPay.prototype.start = function () {
52
  if (this.get_quantity() > 0) {
53
+ this.add_to_cart().then(function () {
54
  wc_stripe.GooglePay.prototype.start.apply(this, arguments);
55
  }.bind(this))
56
  } else {
58
  }
59
  }
60
 
61
+ GPay.prototype.found_variation = function () {
62
+ wc_stripe.ProductGateway.prototype.found_variation.apply(this, arguments);
63
+ this.enable_payment_button();
64
+ }
65
+
66
  new GPay();
67
 
68
  }(jQuery, wc_stripe))
assets/js/frontend/mini-cart.js CHANGED
@@ -7,39 +7,20 @@
7
  */
8
  function MiniCart(params) {
9
  this.message_container = '.widget_shopping_cart_content';
10
- wc_stripe.BaseGateway.call(this, params);
11
- }
12
-
13
- /**
14
- * This is the mini-cart so always return "cart" for the page.
15
- * @returns {string}
16
- */
17
- MiniCart.prototype.get_page = function () {
18
- return 'cart';
19
- }
20
-
21
- MiniCart.prototype.init_events = function () {
22
-
23
- }
24
-
25
- MiniCart.prototype.get_gateway_data = function () {
26
- return $(this.container).find('#' + this.gateway_id + '_' + this.get_page() + '_data').data('gateway');
27
- }
28
-
29
- MiniCart.prototype.set_gateway_data = function (data) {
30
- $(this.container).find('#' + this.gateway_id + '_' + this.get_page() + '_data').data('gateway', data);
31
  }
32
 
33
  MiniCart.prototype.on_token_received = function () {
34
  this.block();
 
35
  wc_stripe.BaseGateway.prototype.on_token_received.apply(this, arguments);
36
  }
37
 
38
- MiniCart.prototype.block = function () {
39
  $(this.container).closest('.widget_shopping_cart_content').find('.wc-stripe-overlay').addClass('active');
40
  }
41
 
42
- MiniCart.prototype.unblock = function () {
43
  $(this.container).closest('.widget_shopping_cart_content').find('.wc-stripe-overlay').addClass('active');
44
  }
45
 
@@ -51,7 +32,6 @@
51
  GPay.prototype = Object.assign({}, wc_stripe.BaseGateway.prototype, MiniCart.prototype, wc_stripe.GooglePay.prototype);
52
 
53
  GPay.prototype.initialize = function () {
54
- this.container = container;
55
  this.createPaymentsClient();
56
  this.isReadyToPay().then(function () {
57
  this.$button.find('.gpay-button').addClass('button');
@@ -82,7 +62,6 @@
82
 
83
 
84
  ApplePay.prototype.initialize = function () {
85
- this.container = container;
86
  wc_stripe.ApplePay.prototype.initialize.apply(this, arguments);
87
  }
88
 
@@ -99,7 +78,6 @@
99
  PaymentRequest.prototype = Object.assign({}, wc_stripe.BaseGateway.prototype, MiniCart.prototype, wc_stripe.PaymentRequest.prototype);
100
 
101
  PaymentRequest.prototype.initialize = function () {
102
- this.container = container;
103
  wc_stripe.PaymentRequest.prototype.initialize.apply(this, arguments);
104
  }
105
 
7
  */
8
  function MiniCart(params) {
9
  this.message_container = '.widget_shopping_cart_content';
10
+ wc_stripe.BaseGateway.call(this, params, container);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11
  }
12
 
13
  MiniCart.prototype.on_token_received = function () {
14
  this.block();
15
+ this.block_cart();
16
  wc_stripe.BaseGateway.prototype.on_token_received.apply(this, arguments);
17
  }
18
 
19
+ MiniCart.prototype.block_cart = function () {
20
  $(this.container).closest('.widget_shopping_cart_content').find('.wc-stripe-overlay').addClass('active');
21
  }
22
 
23
+ MiniCart.prototype.unblock_cart = function () {
24
  $(this.container).closest('.widget_shopping_cart_content').find('.wc-stripe-overlay').addClass('active');
25
  }
26
 
32
  GPay.prototype = Object.assign({}, wc_stripe.BaseGateway.prototype, MiniCart.prototype, wc_stripe.GooglePay.prototype);
33
 
34
  GPay.prototype.initialize = function () {
 
35
  this.createPaymentsClient();
36
  this.isReadyToPay().then(function () {
37
  this.$button.find('.gpay-button').addClass('button');
62
 
63
 
64
  ApplePay.prototype.initialize = function () {
 
65
  wc_stripe.ApplePay.prototype.initialize.apply(this, arguments);
66
  }
67
 
78
  PaymentRequest.prototype = Object.assign({}, wc_stripe.BaseGateway.prototype, MiniCart.prototype, wc_stripe.PaymentRequest.prototype);
79
 
80
  PaymentRequest.prototype.initialize = function () {
 
81
  wc_stripe.PaymentRequest.prototype.initialize.apply(this, arguments);
82
  }
83
 
assets/js/frontend/payment-request.js CHANGED
@@ -22,7 +22,7 @@
22
  * @return {[type]} [description]
23
  */
24
  PaymentRequest.prototype.canMakePayment = function () {
25
- wc_stripe.PaymentRequest.prototype.canMakePayment.apply(this, arguments).then(function (result) {
26
  $(document.body).on('change', '[name="quantity"]', this.add_to_cart.bind(this));
27
  $(this.container).parent().parent().addClass('active');
28
  if (!this.is_variable_product()) {
@@ -30,6 +30,7 @@
30
  } else {
31
  if (this.variable_product_selected()) {
32
  this.cart_calculation(this.get_product_data().variation.variation_id);
 
33
  } else {
34
  this.disable_payment_button();
35
  }
@@ -41,18 +42,28 @@
41
  * [add_to_cart description]
42
  */
43
  PaymentRequest.prototype.add_to_cart = function (e) {
44
- if (this.$button.is('.disabled') && this.can_pay) {
45
- $('[name="quantity"]').val(this.old_qty);
46
- this.submit_error(this.params.messages.choose_product);
47
- return;
48
- }
49
  this.old_qty = this.get_quantity();
50
  var variation = this.get_product_data().variation;
51
- this.cart_calculation(variation.variation_id);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
52
  }
53
 
54
  PaymentRequest.prototype.cart_calculation = function () {
55
- wc_stripe.ProductGateway.prototype.cart_calculation.apply(this, arguments).then(function () {
56
  this.paymentRequest.update(this.get_payment_request_update({
57
  total: {
58
  pending: false
@@ -64,6 +75,7 @@
64
  }
65
 
66
  PaymentRequest.prototype.create_button = function () {
 
67
  wc_stripe.PaymentRequest.prototype.create_button.apply(this, arguments);
68
  this.$button = $('#wc-stripe-payment-request-container');
69
  }
@@ -77,6 +89,11 @@
77
  }
78
  }
79
 
 
 
 
 
 
80
  /**
81
  * [block description]
82
  * @return {[type]} [description]
@@ -234,6 +251,8 @@
234
 
235
  PaymentRequest.prototype.on_token_received = function () {
236
  wc_stripe.CheckoutGateway.prototype.on_token_received.apply(this, arguments);
 
 
237
  if (this.checkout_fields_valid()) {
238
  this.get_form().submit();
239
  }
22
  * @return {[type]} [description]
23
  */
24
  PaymentRequest.prototype.canMakePayment = function () {
25
+ wc_stripe.PaymentRequest.prototype.canMakePayment.apply(this, arguments).then(function () {
26
  $(document.body).on('change', '[name="quantity"]', this.add_to_cart.bind(this));
27
  $(this.container).parent().parent().addClass('active');
28
  if (!this.is_variable_product()) {
30
  } else {
31
  if (this.variable_product_selected()) {
32
  this.cart_calculation(this.get_product_data().variation.variation_id);
33
+ $(this.container).removeClass('processingFoundVariation');
34
  } else {
35
  this.disable_payment_button();
36
  }
42
  * [add_to_cart description]
43
  */
44
  PaymentRequest.prototype.add_to_cart = function (e) {
45
+ this.disable_payment_button();
 
 
 
 
46
  this.old_qty = this.get_quantity();
47
  var variation = this.get_product_data().variation;
48
+ this.cart_calculation(variation.variation_id).then(function () {
49
+ if (this.is_variable_product() && $(this.container).is('.processingFoundVariation')) {
50
+ this.createPaymentRequest();
51
+ if (this.paymentRequestButton) {
52
+ this.paymentRequestButton.destroy();
53
+ }
54
+ this.createPaymentRequestButton();
55
+ wc_stripe.PaymentRequest.prototype.canMakePayment.apply(this, arguments).then(function () {
56
+ this.enable_payment_button();
57
+ $(this.container).removeClass('processingFoundVariation');
58
+ }.bind(this));
59
+ } else {
60
+ this.enable_payment_button();
61
+ }
62
+ }.bind(this));
63
  }
64
 
65
  PaymentRequest.prototype.cart_calculation = function () {
66
+ return wc_stripe.ProductGateway.prototype.cart_calculation.apply(this, arguments).then(function () {
67
  this.paymentRequest.update(this.get_payment_request_update({
68
  total: {
69
  pending: false
75
  }
76
 
77
  PaymentRequest.prototype.create_button = function () {
78
+ $('#wc-stripe-payment-request-container').empty();
79
  wc_stripe.PaymentRequest.prototype.create_button.apply(this, arguments);
80
  this.$button = $('#wc-stripe-payment-request-container');
81
  }
89
  }
90
  }
91
 
92
+ PaymentRequest.prototype.found_variation = function () {
93
+ $(this.container).addClass('processingFoundVariation');
94
+ wc_stripe.ProductGateway.prototype.found_variation.apply(this, arguments);
95
+ }
96
+
97
  /**
98
  * [block description]
99
  * @return {[type]} [description]
251
 
252
  PaymentRequest.prototype.on_token_received = function () {
253
  wc_stripe.CheckoutGateway.prototype.on_token_received.apply(this, arguments);
254
+ this.fields.toFormFields();
255
+ this.maybe_set_ship_to_different();
256
  if (this.checkout_fields_valid()) {
257
  this.get_form().submit();
258
  }
assets/js/frontend/wc-stripe.js CHANGED
@@ -1,1778 +1,1935 @@
1
- (function (window, $) {
2
- window.wc_stripe = {};
3
- var stripe = null;
4
-
5
- if (typeof wc_stripe_checkout_fields === 'undefined') {
6
- wc_stripe_checkout_fields = [];
7
- }
8
-
9
- /**
10
- * @consructorget_total_price
11
- */
12
- wc_stripe.BaseGateway = function (params) {
13
- this.params = params;
14
- this.gateway_id = this.params.gateway_id;
15
- this.container = 'li.payment_method_' + this.gateway_id;
16
- this.token_selector = this.params.token_selector;
17
- this.saved_method_selector = this.params.saved_method_selector;
18
- this.payment_token_received = false;
19
- this.stripe = stripe;
20
- this.elements = stripe.elements($.extend({}, {locale: 'auto'}, this.get_element_options()));
21
- this.fields = checkoutFields;
22
- this.initialize();
23
- }
24
-
25
- wc_stripe.BaseGateway.prototype.get_page = function () {
26
- return wc_stripe_params_v3.page;
27
- }
28
-
29
- wc_stripe.BaseGateway.prototype.set_nonce = function (value) {
30
- this.fields.set(this.gateway_id + '_token_key', value);
31
- $(this.token_selector).val(value);
32
- }
33
-
34
- /**
35
- * [get_element_options description]
36
- * @return {[type]} [description]
37
- */
38
- wc_stripe.BaseGateway.prototype.get_element_options = function () {
39
- return {};
40
- }
41
-
42
- wc_stripe.BaseGateway.prototype.initialize = function () {
43
- };
44
-
45
- /**
46
- * @return {[type]}
47
- */
48
- wc_stripe.BaseGateway.prototype.create_button = function () {
49
- }
50
-
51
- /**
52
- * @returns {Boolean}
53
- */
54
- wc_stripe.BaseGateway.prototype.is_gateway_selected = function () {
55
- return $('[name="payment_method"]:checked').val() === this.gateway_id;
56
- }
57
-
58
- /**
59
- * @returns {Boolean}
60
- */
61
- wc_stripe.BaseGateway.prototype.is_saved_method_selected = function () {
62
- return this.is_gateway_selected() && $('[name="' + this.gateway_id + '_payment_type_key"]:checked').val() === 'saved';
63
- }
64
-
65
- /**
66
- * @return {Boolean}
67
- */
68
- wc_stripe.BaseGateway.prototype.has_checkout_error = function () {
69
- return $('#wc_stripe_checkout_error').length > 0 && this.is_gateway_selected();
70
- }
71
-
72
- /**
73
- * @param {[type]}
74
- * @return {[type]}
75
- */
76
- wc_stripe.BaseGateway.prototype.submit_error = function (message) {
77
- message = this.get_error_message(message);
78
- if (message.indexOf('</ul>') == -1) {
79
- message = '<div class="woocommerce-error">' + message + '</div>';
80
- }
81
- this.submit_message(message);
82
- }
83
-
84
- wc_stripe.BaseGateway.prototype.submit_error_code = function (code) {
85
-
86
- }
87
-
88
- wc_stripe.BaseGateway.prototype.get_error_message = function (message) {
89
- if (typeof message == 'object' && message.code) {
90
- if (wc_stripe_messages[message.code]) {
91
- message = wc_stripe_messages[message.code];
92
- } else {
93
- message = message.message;
94
- }
95
- }
96
- return message;
97
- }
98
-
99
- /**
100
- * @param {[type]}
101
- * @return {[type]}
102
- */
103
- wc_stripe.BaseGateway.prototype.submit_message = function (message) {
104
- $('.woocommerce-error, .woocommerce-message, .woocommerce-info')
105
- .remove();
106
- var $container = $(this.message_container);
107
- if ($container.closest('form').length) {
108
- $container = $container.closest('form');
109
- }
110
- $container.prepend(message);
111
- $container.removeClass('processing').unblock();
112
- $container.find('.input-text, select, input:checkbox').blur();
113
- if ($.scroll_to_notices) {
114
- $.scroll_to_notices($container);
115
- } else {
116
- $('html, body').animate({
117
- scrollTop: ($container.offset().top - 100)
118
- }, 1000);
119
- }
120
- }
121
-
122
- wc_stripe.BaseGateway.prototype.get_first_name = function (prefix) {
123
- return $('#' + prefix + '_first_name').val();
124
- }
125
-
126
- wc_stripe.BaseGateway.prototype.get_last_name = function (prefix) {
127
- return $('#' + prefix + '_last_name').val();
128
- }
129
-
130
- /**
131
- * Return true if the source should be saved.
132
- *
133
- * @returns {Boolean}
134
- */
135
- wc_stripe.BaseGateway.prototype.should_save_method = function () {
136
- return $('#' + this.gateway_id + '_save_source_key').is(':checked');
137
- }
138
-
139
- wc_stripe.BaseGateway.prototype.is_add_payment_method_page = function () {
140
- return this.get_page() === 'add_payment_method' || $(document.body).hasClass('woocommerce-add-payment-method');
141
- }
142
-
143
- wc_stripe.BaseGateway.prototype.is_change_payment_method = function () {
144
- return this.get_page() === 'change_payment_method';
145
- }
146
-
147
- wc_stripe.BaseGateway.prototype.get_selected_payment_method = function () {
148
- return $(this.saved_method_selector).val();
149
- }
150
-
151
- wc_stripe.BaseGateway.prototype.needs_shipping = function () {
152
- return this.get_gateway_data().needs_shipping;
153
- }
154
-
155
- wc_stripe.BaseGateway.prototype.get_currency = function () {
156
- return this.get_gateway_data().currency;
157
- }
158
-
159
- wc_stripe.BaseGateway.prototype.get_gateway_data = function () {
160
- return $('#' + this.gateway_id + '_' + this.get_page() + '_data').data('gateway');
161
- }
162
-
163
- wc_stripe.BaseGateway.prototype.set_gateway_data = function (data) {
164
- $('#' + this.gateway_id + '_' + this.get_page() + '_data').data('gateway', data);
165
- }
166
-
167
- /**
168
- * [get_customer_name description]
169
- * @return String
170
- */
171
- wc_stripe.BaseGateway.prototype.get_customer_name = function (prefix) {
172
- return this.fields.get(prefix + '_first_name') + ' ' + this.fields.get(prefix + '_last_name');
173
- }
174
-
175
- /**
176
- * [get_customer_email description]
177
- * @return {String} [description]
178
- */
179
- wc_stripe.BaseGateway.prototype.get_customer_email = function () {
180
- return this.fields.get('billing_email');
181
- }
182
-
183
- /**
184
- * Returns a string representation of an address.
185
- * @param {[type]}
186
- * @return {[type]}
187
- */
188
- wc_stripe.BaseGateway.prototype.get_address_field_hash = function (prefix) {
189
- var params = ['_first_name', '_last_name', '_address_1', '_address_2', '_postcode', '_city', '_state', '_country',];
190
- var hash = "";
191
- for (var i = 0; i < params.length; i++) {
192
- hash += this.fields.get(prefix + params[i]) + '_';
193
- }
194
- return hash;
195
- }
196
-
197
- /**
198
- * @return {[type]}
199
- */
200
- wc_stripe.BaseGateway.prototype.block = function () {
201
- $.blockUI({
202
- message: null,
203
- overlayCSS: {
204
- background: '#fff',
205
- opacity: 0.6
206
- }
207
- });
208
- }
209
-
210
- /**
211
- * @return {[type]}
212
- */
213
- wc_stripe.BaseGateway.prototype.unblock = function () {
214
- $.unblockUI();
215
- }
216
-
217
- /**
218
- * @return {[type]}
219
- */
220
- wc_stripe.BaseGateway.prototype.get_form = function () {
221
- return $(this.token_selector).closest('form');
222
- }
223
-
224
- /**
225
- * @return {[type]}
226
- */
227
- wc_stripe.BaseGateway.prototype.get_total_price = function () {
228
- return this.get_gateway_data().total;
229
- }
230
-
231
- wc_stripe.BaseGateway.prototype.get_total_price_cents = function () {
232
- return this.get_gateway_data().total_cents;
233
- }
234
-
235
- /**
236
- * @return {[type]}
237
- */
238
- wc_stripe.BaseGateway.prototype.set_total_price = function (total) {
239
- var data = this.get_gateway_data();
240
- data.total = total;
241
- this.set_gateway_data(data);
242
- }
243
-
244
- /**
245
- * @return {[type]}
246
- */
247
- wc_stripe.BaseGateway.prototype.set_total_price_cents = function (total) {
248
- var data = this.get_gateway_data();
249
- data.total_cents = total;
250
- this.set_gateway_data(data);
251
- }
252
-
253
- /**
254
- * [set_payment_method description]
255
- * @param {[type]} payment_method [description]
256
- */
257
- wc_stripe.BaseGateway.prototype.set_payment_method = function (payment_method) {
258
- $('[name="payment_method"][value="' + payment_method + '"]').prop("checked", true).trigger('click');
259
- }
260
-
261
- /**
262
- * [set_shipping_methods description]
263
- */
264
- wc_stripe.BaseGateway.prototype.set_selected_shipping_methods = function (shipping_methods) {
265
- if (shipping_methods && $('[name^="shipping_method"]').length) {
266
- for (var i in shipping_methods) {
267
- var method = shipping_methods[i];
268
- $('[name="shipping_method[' + i + ']"][value="' + method + '"]').prop("checked", true).trigger('change');
269
- }
270
- }
271
- }
272
-
273
- /**
274
- * @param {[type]}
275
- * @return {[type]}
276
- */
277
- wc_stripe.BaseGateway.prototype.on_token_received = function (paymentMethod) {
278
- this.payment_token_received = true;
279
- this.set_nonce(paymentMethod.id);
280
- this.process_checkout();
281
- }
282
-
283
- wc_stripe.BaseGateway.prototype.createPaymentRequest = function () {
284
- try {
285
- this.paymentRequest = stripe.paymentRequest(this.get_payment_request_options());
286
- } catch (err) {
287
- this.submit_error(err.message);
288
- return;
289
- }
290
-
291
- // events
292
- if (this.needs_shipping()) {
293
- this.paymentRequest.on('shippingaddresschange', this.update_shipping_address.bind(this));
294
- this.paymentRequest.on('shippingoptionchange', this.update_shipping_method.bind(this));
295
- }
296
- this.paymentRequest.on('paymentmethod', this.on_payment_method_received.bind(this));
297
- }
298
-
299
- /**
300
- * @return {[Object]}
301
- */
302
- wc_stripe.BaseGateway.prototype.get_payment_request_options = function () {
303
- var options = {
304
- country: this.params.country_code,
305
- currency: this.get_currency().toLowerCase(),
306
- total: {
307
- amount: this.get_total_price_cents(),
308
- label: this.params.total_label,
309
- pending: true
310
- },
311
- requestPayerName: true,
312
- requestPayerEmail: this.fields.required('billing_email'),
313
- requestPayerPhone: this.fields.required('billing_phone'),
314
- requestShipping: this.needs_shipping()
315
- }
316
- var displayItems = this.get_display_items(),
317
- shippingOptions = this.get_shipping_options();
318
- if (displayItems) {
319
- options.displayItems = displayItems;
320
- }
321
- if (this.needs_shipping() && shippingOptions) {
322
- options.shippingOptions = shippingOptions;
323
- }
324
- return options;
325
- }
326
-
327
- /**
328
- * @return {[Object]}
329
- */
330
- wc_stripe.BaseGateway.prototype.get_payment_request_update = function (data) {
331
- var options = {
332
- currency: this.get_currency().toLowerCase(),
333
- total: {
334
- amount: parseInt(this.get_total_price_cents()),
335
- label: this.params.total_label,
336
- pending: true
337
- }
338
- }
339
- var displayItems = this.get_display_items(),
340
- shippingOptions = this.get_shipping_options();
341
- if (displayItems) {
342
- options.displayItems = displayItems;
343
- }
344
- if (this.needs_shipping() && shippingOptions) {
345
- options.shippingOptions = shippingOptions;
346
- }
347
- if (data) {
348
- options = $.extend(true, {}, options, data);
349
- }
350
- return options;
351
- }
352
-
353
- /**
354
- * @return {[type]}
355
- */
356
- wc_stripe.BaseGateway.prototype.get_display_items = function () {
357
- return this.get_gateway_data().items;
358
- }
359
-
360
- /**
361
- * @return {[type]}
362
- */
363
- wc_stripe.BaseGateway.prototype.set_display_items = function (items) {
364
- var data = this.get_gateway_data();
365
- data.items = items;
366
- this.set_gateway_data(data);
367
- }
368
-
369
- /**
370
- * Return an array of shipping options for display in the Google payment sheet
371
- * @return {[type]}
372
- */
373
- wc_stripe.BaseGateway.prototype.get_shipping_options = function () {
374
- return this.get_gateway_data().shipping_options;
375
- }
376
-
377
- /**
378
- * Update the shipping options.
379
- * @param {[type]}
380
- */
381
- wc_stripe.BaseGateway.prototype.set_shipping_options = function (items) {
382
- var data = this.get_gateway_data();
383
- data.shipping_options = items;
384
- this.set_gateway_data(data);
385
- }
386
-
387
- /**
388
- * Maps an address from the Browser address format to WC format.
389
- * @param {[type]}
390
- * @return {[type]}
391
- */
392
- wc_stripe.BaseGateway.prototype.map_address = function (address) {
393
- return {
394
- city: address.city,
395
- postcode: address.postalCode,
396
- state: address.region,
397
- country: address.country
398
- }
399
- }
400
-
401
- /**
402
- * @param {[type]}
403
- * @return {[type]}
404
- */
405
- wc_stripe.BaseGateway.prototype.on_payment_method_received = function (paymentResponse) {
406
- try {
407
- this.payment_response = paymentResponse;
408
- this.populate_checkout_fields(paymentResponse);
409
- paymentResponse.complete("success");
410
- this.on_token_received(paymentResponse.paymentMethod);
411
- } catch (err) {
412
- window.alert(err);
413
- }
414
- }
415
-
416
- /**
417
- * @return {[type]}
418
- */
419
- wc_stripe.BaseGateway.prototype.populate_checkout_fields = function (data) {
420
- this.set_nonce(data.paymentMethod.id);
421
- this.populate_address_fields(data);
422
- }
423
-
424
- /**
425
- * @param {[type]}
426
- * @return {[type]}
427
- */
428
- wc_stripe.BaseGateway.prototype.populate_address_fields = function (data) {
429
- if (data.payerName) {
430
- this.fields.set('name', data.payerName, 'billing');
431
- }
432
- if (data.payerEmail) {
433
- this.fields.set('email', data.payerEmail, 'billing');
434
- }
435
- if (data.payerPhone) {
436
- this.fields.set('phone', data.payerPhone, 'billing');
437
- }
438
- if (data.shippingAddress) {
439
- var address = data.shippingAddress;
440
- for (var k in address) {
441
- this.fields.set(k, address[k], 'shipping');
442
- }
443
- }
444
- if (data.paymentMethod.billing_details.address) {
445
- var address = data.paymentMethod.billing_details.address;
446
- for (var k in address) {
447
- this.fields.set(k, address[k], 'billing');
448
- }
449
- }
450
- if ('checkout' === this.get_page()) {
451
- this.maybe_set_ship_to_different();
452
- this.fields.toFormFields();
453
- $('[name="billing_country"]').trigger('change');
454
- }
455
- }
456
-
457
- /**
458
- * @return {[type]}
459
- */
460
- wc_stripe.BaseGateway.prototype.address_mappings = function () {
461
- return new wc_stripe.CheckoutFields();
462
- }
463
-
464
- wc_stripe.BaseGateway.prototype.ajax_before_send = function (xhr) {
465
- if (this.params.user_id > 0) {
466
- xhr.setRequestHeader('X-WP-Nonce', this.params.rest_nonce);
467
- }
468
- }
469
-
470
- /**
471
- * @return {[type]}
472
- */
473
- wc_stripe.BaseGateway.prototype.process_checkout = function () {
474
- return new Promise(function (resolve, reject) {
475
- this.block();
476
- $.ajax({
477
- url: this.params.routes.checkout,
478
- method: 'POST',
479
- dataType: 'json',
480
- data: $.extend({}, this.serialize_fields(), {
481
- payment_method: this.gateway_id,
482
- page_id: this.get_page()
483
- }),
484
- beforeSend: this.ajax_before_send.bind(this)
485
- }).done(function (result) {
486
- if (result.reload) {
487
- window.location.reload();
488
- return;
489
- }
490
- if (result.result === 'success') {
491
- window.location = result.redirect;
492
- } else {
493
- if (result.messages) {
494
- this.submit_error(result.messages);
495
- }
496
- this.unblock();
497
- }
498
- }.bind(this)).fail(function (xhr, textStatus, errorThrown) {
499
- this.unblock();
500
- this.submit_error(errorThrown);
501
- }.bind(this))
502
- }.bind(this))
503
- }
504
-
505
- /**
506
- * @return {[type]}
507
- */
508
- wc_stripe.BaseGateway.prototype.serialize_form = function ($form) {
509
- var formData = $form.find('input').filter(function (i, e) {
510
- if ($(e).is('[name^="add-to-cart"]')) {
511
- return false;
512
- }
513
- return true;
514
- }.bind(this)).serializeArray(),
515
- data = {};
516
-
517
- for (var i in formData) {
518
- var obj = formData[i];
519
- data[obj.name] = obj.value;
520
- }
521
- data.payment_method = this.gateway_id;
522
- return data;
523
- }
524
-
525
- wc_stripe.BaseGateway.prototype.serialize_fields = function () {
526
- return this.fields.toJson();
527
- }
528
-
529
- /**
530
- * @param {[type]}
531
- * @return {[type]}
532
- */
533
- wc_stripe.BaseGateway.prototype.map_shipping_methods = function (shippingData) {
534
- var methods = {};
535
- if (shippingData !== "default") {
536
- var matches = shippingData.match(/^([\w+]):(.+)$/);
537
- if (matches.length > 1) {
538
- methods[matches[1]] = matches[2];
539
- }
540
- }
541
- return methods;
542
- }
543
-
544
- /**
545
- * [maybe_set_ship_to_different description]
546
- * @return {[type]} [description]
547
- */
548
- wc_stripe.BaseGateway.prototype.maybe_set_ship_to_different = function () {
549
- // if shipping and billing address are different,
550
- // set the ship to different address option.
551
- if ($('[name="ship_to_different_address"]').length) {
552
- $('[name="ship_to_different_address"]').prop('checked', this.get_address_field_hash("billing") !== this.get_address_field_hash("shipping")).trigger('change');
553
- }
554
- }
555
-
556
- /**
557
- * @return {[@event]}
558
- */
559
- wc_stripe.BaseGateway.prototype.update_shipping_address = function (ev) {
560
- return new Promise(function (resolve, reject) {
561
- $.ajax({
562
- url: this.params.routes.shipping_address,
563
- method: 'POST',
564
- dataType: 'json',
565
- data: {
566
- address: this.map_address(ev.shippingAddress),
567
- payment_method: this.gateway_id,
568
- page_id: this.get_page()
569
- },
570
- beforeSend: this.ajax_before_send.bind(this)
571
- }).done(function (response) {
572
- if (response.code) {
573
- ev.updateWith(response.data.newData);
574
- reject(response.data);
575
- } else {
576
- ev.updateWith(response.data.newData);
577
- resolve(response.data);
578
- }
579
- }.bind(this)).fail(function (xhr, textStatus, errorThrown) {
580
-
581
- }.bind(this))
582
- }.bind(this))
583
- }
584
-
585
- /**
586
- * @return {[@event]}
587
- */
588
- wc_stripe.BaseGateway.prototype.update_shipping_method = function (ev) {
589
- return new Promise(function (resolve, reject) {
590
- $.ajax({
591
- url: this.params.routes.shipping_method,
592
- method: 'POST',
593
- dataType: 'json',
594
- data: {
595
- shipping_method: ev.shippingOption.id,
596
- payment_method: this.gateway_id,
597
- page_id: this.get_page()
598
- },
599
- beforeSend: this.ajax_before_send.bind(this)
600
- }).done(function (response) {
601
- if (response.code) {
602
- ev.updateWith(response.data.newData);
603
- reject(response.data);
604
- } else {
605
- this.set_selected_shipping_methods(response.data.shipping_methods);
606
- ev.updateWith(response.data.newData);
607
- resolve(response.data);
608
- }
609
- }.bind(this)).fail(function (xhr, textStatus, errorThrown) {
610
- this.submit_error(errorThrown);
611
- }.bind(this))
612
- }.bind(this))
613
- }
614
-
615
-
616
- /********** Checkout Gateway ********/
617
-
618
- /**
619
- * @constructor
620
- */
621
- wc_stripe.CheckoutGateway = function () {
622
- this.message_container = 'li.payment_method_' + this.gateway_id;
623
- this.banner_container = 'li.banner_payment_method_' + this.gateway_id;
624
- $(document.body).on('update_checkout', this.update_checkout.bind(this));
625
- $(document.body).on('updated_checkout', this.updated_checkout.bind(this));
626
- $(document.body).on('cfw_updated_checkout', this.updated_checkout.bind(this));
627
- $(document.body).on('checkout_error', this.checkout_error.bind(this));
628
- $(this.token_selector).closest('form').on('checkout_place_order_' + this.gateway_id, this.checkout_place_order.bind(this));
629
-
630
- // events for showing gateway payment buttons
631
- $(document.body).on('wc_stripe_new_method_' + this.gateway_id, this.on_show_new_methods.bind(this));
632
- $(document.body).on('wc_stripe_saved_method_' + this.gateway_id, this.on_show_saved_methods.bind(this));
633
- $(document.body).on('wc_stripe_payment_method_selected', this.on_payment_method_selected.bind(this));
634
-
635
- if (this.banner_enabled()) {
636
- if ($('.woocommerce-billing-fields').length) {
637
- $('.wc-stripe-banner-checkout').css('max-width', $('.woocommerce-billing-fields').outerWidth(true));
638
- }
639
- }
640
-
641
- this.order_review();
642
- }
643
-
644
- wc_stripe.CheckoutGateway.prototype.order_review = function () {
645
- var url = window.location.href;
646
- var matches = url.match(/order_review.+payment_method=([\w]+).+payment_nonce=(.+)/);
647
- if (matches && matches.length > 1) {
648
- var payment_method = matches[1],
649
- nonce = matches[2];
650
- if (this.gateway_id === payment_method) {
651
- this.payment_token_received = true;
652
- this.set_nonce(nonce);
653
- this.set_use_new_option(true);
654
- }
655
- }
656
- }
657
-
658
- /**
659
- * Called on the WC updated_checkout event
660
- */
661
- wc_stripe.CheckoutGateway.prototype.updated_checkout = function () {
662
- }
663
-
664
- /**
665
- * Called on the WC update_checkout event
666
- */
667
- wc_stripe.CheckoutGateway.prototype.update_checkout = function () {
668
- }
669
-
670
- /**
671
- * Called on the WC checkout_error event
672
- */
673
- wc_stripe.CheckoutGateway.prototype.checkout_error = function () {
674
- if (this.has_checkout_error()) {
675
- this.payment_token_received = false;
676
- this.payment_response = null;
677
- this.show_payment_button();
678
- this.hide_place_order();
679
- }
680
- }
681
-
682
- /**
683
- *
684
- */
685
- wc_stripe.CheckoutGateway.prototype.is_valid_checkout = function () {
686
- if ($('[name="terms"]').length) {
687
- if (!$('[name="terms"]').is(':checked')) {
688
- return false;
689
- }
690
- }
691
- return true;
692
- }
693
-
694
- /**
695
- * Returns the selected payment gateway's id.
696
- *
697
- * @returns {String}
698
- */
699
- wc_stripe.CheckoutGateway.prototype.get_payment_method = function () {
700
- return $('[name="payment_method"]:checked').val();
701
- }
702
-
703
- wc_stripe.CheckoutGateway.prototype.set_use_new_option = function (bool) {
704
- $('#' + this.gateway_id + '_use_new').prop("checked", bool).trigger('change');
705
- }
706
-
707
- /**
708
- * Called on the WC checkout_place_order_{$gateway_id} event
709
- */
710
- wc_stripe.CheckoutGateway.prototype.checkout_place_order = function () {
711
- if (!this.is_valid_checkout()) {
712
- this.submit_error(this.params.messages.terms);
713
- return false;
714
- } else if (this.is_saved_method_selected()) {
715
- return true;
716
- }
717
- return this.payment_token_received;
718
- }
719
-
720
- /**
721
- * @param {[type]}
722
- * @return {[type]}
723
- */
724
- wc_stripe.CheckoutGateway.prototype.on_token_received = function (paymentMethod) {
725
- this.payment_token_received = true;
726
- this.set_nonce(paymentMethod.id);
727
- this.hide_payment_button();
728
- this.show_place_order();
729
- }
730
-
731
- /**
732
- * @return {[type]}
733
- */
734
- wc_stripe.CheckoutGateway.prototype.block = function () {
735
- $('form.checkout').block({
736
- message: null,
737
- overlayCSS: {
738
- background: '#fff',
739
- opacity: 0.6
740
- }
741
- });
742
- }
743
-
744
- /**
745
- * @return {[type]}
746
- */
747
- wc_stripe.CheckoutGateway.prototype.unblock = function () {
748
- $('form.checkout').unblock();
749
- }
750
-
751
- wc_stripe.CheckoutGateway.prototype.hide_place_order = function () {
752
- $('#place_order').addClass('wc-stripe-hide');
753
- }
754
-
755
- /**
756
- * @return {[type]}
757
- */
758
- wc_stripe.CheckoutGateway.prototype.show_place_order = function () {
759
- $('#place_order').removeClass('wc-stripe-hide');
760
- }
761
-
762
- /**
763
- * Method that should perform actions when the show new methods contain is made visible.
764
- * @param {[@event]}
765
- * @param {[String]}
766
- * @return {[type]}
767
- */
768
- wc_stripe.CheckoutGateway.prototype.on_show_new_methods = function () {
769
- if (this.payment_token_received) {
770
- this.show_place_order();
771
- this.hide_payment_button();
772
- } else {
773
- this.hide_place_order();
774
- this.show_payment_button();
775
- }
776
- }
777
-
778
- /**
779
- * Method that performs actions when the saved methods contains is visible.
780
- * @param {[type]}
781
- * @param {[type]}
782
- * @return {[type]}
783
- */
784
- wc_stripe.CheckoutGateway.prototype.on_show_saved_methods = function () {
785
- this.hide_payment_button();
786
- this.show_place_order();
787
- }
788
-
789
- /**
790
- * @return {[type]}
791
- */
792
- wc_stripe.CheckoutGateway.prototype.show_payment_button = function () {
793
- if (this.$button) {
794
- this.$button.show();
795
- }
796
- }
797
-
798
- /**
799
- * @return {[type]}
800
- */
801
- wc_stripe.CheckoutGateway.prototype.hide_payment_button = function () {
802
- if (this.$button) {
803
- this.$button.hide();
804
- }
805
- }
806
-
807
- /**
808
- * Wrapper for on_payment_method_selected that is safe to call since it won't trigger
809
- * any DOM events.
810
- * @return {[type]}
811
- */
812
- wc_stripe.CheckoutGateway.prototype.trigger_payment_method_selected = function () {
813
- this.on_payment_method_selected(null, $('[name="payment_method"]:checked').val());
814
- }
815
-
816
- /**
817
- * @param {[type]}
818
- * @param {[type]}
819
- * @return {[type]}
820
- */
821
- wc_stripe.CheckoutGateway.prototype.on_payment_method_selected = function (e, payment_method) {
822
- if (payment_method === this.gateway_id) {
823
- if (this.payment_token_received || this.is_saved_method_selected()) {
824
- this.hide_payment_button();
825
- this.show_place_order();
826
- } else {
827
- this.show_payment_button();
828
- this.hide_place_order();
829
- }
830
- } else {
831
- this.hide_payment_button();
832
- if (payment_method.indexOf('stripe_') < 0) {
833
- this.show_place_order();
834
- }
835
- }
836
- }
837
-
838
- /**
839
- * [Return true if the banner option has been enabled for the gateway.]
840
- * @return {[type]} [description]
841
- */
842
- wc_stripe.CheckoutGateway.prototype.banner_enabled = function () {
843
- return this.params.banner_enabled === "1";
844
- }
845
-
846
- wc_stripe.CheckoutGateway.prototype.checkout_fields_valid = function () {
847
- if (typeof wc_stripe_checkout_fields == 'undefined' || this.get_page() !== 'checkout') {
848
- return true;
849
- }
850
- valid = true;
851
-
852
- function validateFields(prefix, fields) {
853
- for (var k in fields) {
854
- var field = fields[k];
855
- if (k.indexOf(prefix) > -1 && field.required) {
856
- if ($('#' + k).length) {
857
- var val = $('#' + k).val();
858
- if (typeof val === 'undefined' || val.length == 0) {
859
- valid = false;
860
- return
861
- }
862
- }
863
- }
864
- }
865
- }
866
-
867
- validateFields('billing', wc_stripe_checkout_fields);
868
-
869
- if (this.needs_shipping() && $('#ship-to-different-address-checkbox').is(':checked')) {
870
- validateFields('shipping', wc_stripe_checkout_fields);
871
- }
872
- if (valid) {
873
- valid = this.is_valid_checkout();
874
- }
875
- return valid;
876
- }
877
-
878
- /************** Product Gateway ***************/
879
-
880
- wc_stripe.ProductGateway = function () {
881
- this.message_container = 'div.product';
882
-
883
- // events
884
- $('form.cart').on('found_variation', this.found_variation.bind(this));
885
- $('form.cart').on('reset_data', this.reset_variation_data.bind(this));
886
-
887
- this.buttonWidth = $('div.quantity').outerWidth(true) + $('.single_add_to_cart_button').outerWidth();
888
- var marginLeft = $('.single_add_to_cart_button').css('marginLeft');
889
- if (marginLeft) {
890
- this.buttonWidth += parseInt(marginLeft.replace('px', ''));
891
- }
892
- $(this.container).css('max-width', this.buttonWidth + 'px');
893
- }
894
-
895
- /**
896
- * @return {[@int]}
897
- */
898
- wc_stripe.ProductGateway.prototype.get_quantity = function () {
899
- return parseInt($('[name="quantity"]').val());
900
- }
901
-
902
- /**
903
- * @param {[type]}
904
- * @param {[type]}
905
- */
906
- wc_stripe.ProductGateway.prototype.set_rest_nonce = function (e, nonce) {
907
- this.params.rest_nonce = nonce;
908
- }
909
-
910
- /**
911
- * @param {[type]}
912
- * @param {[type]}
913
- * @return {[type]}
914
- */
915
- wc_stripe.ProductGateway.prototype.found_variation = function (e, variation) {
916
- var data = this.get_gateway_data();
917
- data.product.price = variation.display_price;
918
- data.needs_shipping = !variation.is_virtual;
919
- data.product.variation = variation;
920
- this.set_gateway_data(data);
921
- this.enable_payment_button();
922
- }
923
-
924
- /**
925
- * @return {[type]}
926
- */
927
- wc_stripe.ProductGateway.prototype.reset_variation_data = function () {
928
- var data = this.get_product_data();
929
- data.variation = false;
930
- this.set_product_data(data);
931
- this.disable_payment_button();
932
- }
933
-
934
- /**
935
- * @return {[type]}
936
- */
937
- wc_stripe.ProductGateway.prototype.disable_payment_button = function () {
938
- if (this.$button) {
939
- this.get_button().prop('disabled', true).addClass('disabled');
940
- }
941
- }
942
-
943
- /**
944
- * @return {[type]}
945
- */
946
- wc_stripe.ProductGateway.prototype.enable_payment_button = function () {
947
- if (this.$button) {
948
- this.get_button().prop('disabled', false).removeClass('disabled');
949
- }
950
- }
951
-
952
- /**
953
- * @return {[type]}
954
- */
955
- wc_stripe.ProductGateway.prototype.get_button = function () {
956
- return this.$button;
957
- }
958
-
959
- /**
960
- * @return {Boolean}
961
- */
962
- wc_stripe.ProductGateway.prototype.is_variable_product = function () {
963
- return $('[name="variation_id"]').length > 0;
964
- }
965
-
966
- wc_stripe.ProductGateway.prototype.variable_product_selected = function () {
967
- return this.get_product_data().variation !== false;
968
- }
969
-
970
- /**
971
- * @return {[type]}
972
- */
973
- wc_stripe.ProductGateway.prototype.get_product_data = function () {
974
- return this.get_gateway_data().product;
975
- }
976
-
977
- /**
978
- * @return {[type]}
979
- */
980
- wc_stripe.ProductGateway.prototype.set_product_data = function (product) {
981
- var data = this.get_gateway_data();
982
- data.product = product;
983
- this.set_gateway_data(data);
984
- }
985
-
986
- /**
987
- * Add a product to the WC shopping cart
988
- */
989
- wc_stripe.ProductGateway.prototype.add_to_cart = function () {
990
- return new Promise(function (resolve, reject) {
991
- this.block();
992
- $.ajax({
993
- url: this.params.routes.add_to_cart,
994
- method: 'POST',
995
- dataType: 'json',
996
- data: {
997
- product_id: this.get_product_data().id,
998
- variation_id: this.is_variable_product() ? $('[name="variation_id"]').val() : 0,
999
- qty: $('[name="quantity"]').val(),
1000
- payment_method: this.gateway_id,
1001
- page_id: this.get_page()
1002
- },
1003
- beforeSend: this.ajax_before_send.bind(this)
1004
- }).done(function (response, status, xhr) {
1005
- this.unblock();
1006
- if (response.code) {
1007
- this.submit_error(response.message);
1008
- reject(response);
1009
- } else {
1010
- this.set_total_price(response.data.total);
1011
- this.set_total_price_cents(response.data.totalCents);
1012
- this.set_display_items(response.data.displayItems);
1013
- resolve(response.data);
1014
- }
1015
- }.bind(this)).fail(function (xhr, textStatus, errorThrown) {
1016
- this.unblock();
1017
- this.submit_error(errorThrown);
1018
- }.bind(this))
1019
- }.bind(this))
1020
- }
1021
-
1022
- wc_stripe.ProductGateway.prototype.cart_calculation = function (variation_id) {
1023
- return new Promise(function (resolve, reject) {
1024
- $.ajax({
1025
- url: this.params.routes.cart_calculation,
1026
- method: 'POST',
1027
- dataType: 'json',
1028
- data: {
1029
- product_id: this.get_product_data().id,
1030
- variation_id: this.is_variable_product() && variation_id ? variation_id : 0,
1031
- qty: $('[name="quantity"]').val(),
1032
- payment_method: this.gateway_id
1033
- },
1034
- beforeSend: this.ajax_before_send.bind(this)
1035
- }).done(function (response, status, xhr) {
1036
- if (response.code) {
1037
- this.cart_calculation_error = true;
1038
- reject(response);
1039
- } else {
1040
- this.set_total_price(response.data.total);
1041
- this.set_total_price_cents(response.data.totalCents);
1042
- this.set_display_items(response.data.displayItems);
1043
- resolve(response.data);
1044
- }
1045
- }.bind(this)).fail(function (xhr, textStatus, errorThrown) {
1046
-
1047
- }.bind(this))
1048
- }.bind(this))
1049
- }
1050
-
1051
- /************* Cart Gateway *************/
1052
-
1053
- /**
1054
- * @constructor
1055
- */
1056
- wc_stripe.CartGateway = function () {
1057
- this.message_container = 'div.woocommerce';
1058
-
1059
- // cart events
1060
- $(document.body).on('updated_wc_div', this.updated_html.bind(this));
1061
- $(document.body).on('updated_cart_totals', this.updated_html.bind(this));
1062
- $(document.body).on('wc_cart_emptied', this.cart_emptied.bind(this));
1063
- }
1064
-
1065
- /**
1066
- * @param {[type]}
1067
- * @return {[type]}
1068
- */
1069
- wc_stripe.CartGateway.prototype.submit_error = function (message) {
1070
- this.submit_message(this.get_error_message(message));
1071
- }
1072
-
1073
- /**
1074
- * @param {[@event]}
1075
- * @return {[null]}
1076
- */
1077
- wc_stripe.CartGateway.prototype.updated_html = function (e) {
1078
-
1079
- }
1080
-
1081
- wc_stripe.CartGateway.prototype.cart_emptied = function (e) {
1082
- }
1083
-
1084
- wc_stripe.CartGateway.prototype.add_cart_totals_class = function () {
1085
- $('.cart_totals').addClass('stripe_cart_gateway_active');
1086
- }
1087
-
1088
- /************* Google Pay Mixins **************/
1089
-
1090
- wc_stripe.GooglePay = function () {
1091
- }
1092
-
1093
- const googlePayBaseRequest = {
1094
- apiVersion: 2,
1095
- apiVersionMinor: 0
1096
- }
1097
-
1098
- const allowedCardNetworks = ["AMEX", "DISCOVER", "INTERAC", "JCB", "MASTERCARD", "VISA"];
1099
-
1100
- const allowedCardAuthMethods = ["PAN_ONLY"];
1101
-
1102
- const baseCardPaymentMethod = {
1103
- type: 'CARD',
1104
- parameters: {
1105
- allowedAuthMethods: allowedCardAuthMethods,
1106
- allowedCardNetworks: allowedCardNetworks
1107
- }
1108
- }
1109
-
1110
- /**
1111
- * Populate the WC checkout fields.
1112
- * @param {[type]}
1113
- * @return {[type]}
1114
- */
1115
- wc_stripe.GooglePay.prototype.populate_address_fields = function (paymentData) {
1116
- var billingAddress = paymentData.paymentMethodData.info.billingAddress;
1117
- for (var k in billingAddress) {
1118
- this.fields.set(k, billingAddress[k], 'billing');
1119
- }
1120
- if (paymentData.shippingAddress) {
1121
- for (var k in paymentData.shippingAddress) {
1122
- this.fields.set(k, paymentData.shippingAddress[k], "shipping");
1123
- }
1124
- }
1125
- if (paymentData.email) {
1126
- this.fields.set('email', paymentData.email, 'billing');
1127
- }
1128
- if ('checkout' === this.get_page()) {
1129
- this.maybe_set_ship_to_different();
1130
- this.fields.toFormFields();
1131
- $('[name="billing_country"]').trigger('change');
1132
- }
1133
- }
1134
-
1135
- /**
1136
- * @param {[type]}
1137
- * @return {[type]}
1138
- */
1139
- wc_stripe.GooglePay.prototype.map_address = function (address) {
1140
- return {
1141
- city: address.locality,
1142
- postcode: address.postalCode,
1143
- state: address.administrativeArea,
1144
- country: address.countryCode
1145
- }
1146
- }
1147
-
1148
- /**
1149
- * @param {[type]}
1150
- * @return {[type]}
1151
- */
1152
- wc_stripe.GooglePay.prototype.update_payment_data = function (data) {
1153
- return new Promise(function (resolve, reject) {
1154
- var shipping_method = data.shippingOptionData.id == 'default' ? null : data.shippingOptionData.id;
1155
- $.when($.ajax({
1156
- url: this.params.routes.payment_data,
1157
- dataType: 'json',
1158
- method: 'POST',
1159
- data: {
1160
- shipping_address: this.map_address(data.shippingAddress),
1161
- shipping_method: shipping_method,
1162
- page_id: this.get_page()
1163
- },
1164
- beforeSend: this.ajax_before_send.bind(this)
1165
- })).done(function (response) {
1166
- if (response.code) {
1167
- reject(response.data.data);
1168
- } else {
1169
- resolve(response.data);
1170
- }
1171
- }.bind(this)).fail(function () {
1172
- reject();
1173
- }.bind(this))
1174
- }.bind(this))
1175
- }
1176
-
1177
- /**
1178
- * @param {[type]}
1179
- * @return {[type]}
1180
- */
1181
- wc_stripe.GooglePay.prototype.on_payment_data_changed = function (address) {
1182
- return new Promise(function (resolve, reject) {
1183
- this.update_payment_data(address).then(function (response) {
1184
- resolve(response.paymentRequestUpdate);
1185
- this.set_selected_shipping_methods(response.shipping_methods);
1186
- this.payment_data_updated(response, address);
1187
- }.bind(this)).catch(function (data) {
1188
- resolve(data);
1189
- }.bind(this))
1190
- }.bind(this))
1191
- }
1192
-
1193
- /**
1194
- * Convenience method so that gateway can perform actions after the payment data
1195
- * has been updated.
1196
- * @param {[type]}
1197
- * @return {[type]}
1198
- */
1199
- wc_stripe.GooglePay.prototype.payment_data_updated = function (response) {
1200
-
1201
- }
1202
-
1203
- /**
1204
- * @return {[type]}
1205
- */
1206
- wc_stripe.GooglePay.prototype.get_merchant_info = function () {
1207
- var options = {
1208
- merchantId: this.params.merchant_id,
1209
- merchantName: this.params.merchant_name
1210
- }
1211
- if (this.params.environment === 'TEST') {
1212
- delete options.merchantId;
1213
- }
1214
- return options;
1215
- }
1216
-
1217
- /**
1218
- * @return {[type]}
1219
- */
1220
- wc_stripe.GooglePay.prototype.get_payment_options = function () {
1221
- var options = {
1222
- environment: this.params.environment,
1223
- merchantInfo: this.get_merchant_info()
1224
- }
1225
- if (this.needs_shipping()) {
1226
- options.paymentDataCallbacks = {
1227
- onPaymentDataChanged: this.on_payment_data_changed.bind(this),
1228
- onPaymentAuthorized: function (data) {
1229
- return new Promise(function (resolve, reject) {
1230
- resolve({transactionState: "SUCCESS"})
1231
- }.bind(this))
1232
- }.bind(this)
1233
- }
1234
- } else {
1235
- options.paymentDataCallbacks = {
1236
- onPaymentAuthorized: function (data) {
1237
- return new Promise(function (resolve, reject) {
1238
- resolve({transactionState: "SUCCESS"})
1239
- }.bind(this))
1240
- }
1241
- }
1242
- }
1243
- return options;
1244
- }
1245
-
1246
- /**
1247
- * @return {[type]}
1248
- */
1249
- wc_stripe.GooglePay.prototype.build_payment_request = function () {
1250
- var request = $.extend({}, googlePayBaseRequest, {
1251
- emailRequired: this.fields.required('billing_email'),
1252
- merchantInfo: this.get_merchant_info(),
1253
- allowedPaymentMethods: [$.extend({
1254
- type: "CARD",
1255
- tokenizationSpecification: {
1256
- type: "PAYMENT_GATEWAY",
1257
- parameters: {
1258
- gateway: 'stripe',
1259
- "stripe:version": "2018-10-31",
1260
- "stripe:publishableKey": this.params.api_key
1261
- }
1262
- }
1263
- }, baseCardPaymentMethod)],
1264
- shippingAddressRequired: this.needs_shipping(),
1265
- transactionInfo: {
1266
- currencyCode: this.get_currency(),
1267
- totalPriceStatus: "ESTIMATED",
1268
- totalPrice: this.get_total_price().toString(),
1269
- displayItems: this.get_display_items(),
1270
- totalPriceLabel: this.params.total_price_label
1271
- }
1272
- })
1273
- request.allowedPaymentMethods[0].parameters['billingAddressRequired'] = true;
1274
- request.allowedPaymentMethods[0].parameters['billingAddressParameters'] = {
1275
- format: "FULL",
1276
- phoneNumberRequired: this.fields.required('billing_phone')
1277
- }
1278
- if (this.needs_shipping()) {
1279
- request['shippingAddressParameters'] = {};
1280
- request['shippingOptionRequired'] = true;
1281
- request['shippingOptionParameters'] = {
1282
- shippingOptions: this.get_shipping_options(),
1283
- };
1284
- request['callbackIntents'] = ["SHIPPING_ADDRESS", "SHIPPING_OPTION", "PAYMENT_AUTHORIZATION"];
1285
- } else {
1286
- request['callbackIntents'] = ["PAYMENT_AUTHORIZATION"];
1287
- }
1288
- return request;
1289
- }
1290
-
1291
- /**
1292
- * @return {[type]}
1293
- */
1294
- wc_stripe.GooglePay.prototype.createPaymentsClient = function () {
1295
- this.paymentsClient = new google.payments.api.PaymentsClient(this.get_payment_options());
1296
- }
1297
-
1298
- /**
1299
- * @return {Promise}
1300
- */
1301
- wc_stripe.GooglePay.prototype.isReadyToPay = function () {
1302
- return new Promise(function (resolve) {
1303
- var isReadyToPayRequest = $.extend({}, googlePayBaseRequest);
1304
- isReadyToPayRequest.allowedPaymentMethods = [baseCardPaymentMethod];
1305
- this.paymentsClient.isReadyToPay(isReadyToPayRequest).then(function () {
1306
- this.can_pay = true;
1307
- this.create_button();
1308
- resolve();
1309
- }.bind(this)).catch(function (err) {
1310
- this.submit_error(err);
1311
- }.bind(this))
1312
- }.bind(this))
1313
- }
1314
-
1315
- wc_stripe.GooglePay.prototype.create_button = function () {
1316
- if (this.$button) {
1317
- this.$button.remove();
1318
- }
1319
- this.$button = $(this.paymentsClient.createButton({
1320
- onClick: this.start.bind(this),
1321
- buttonColor: this.params.button_color,
1322
- buttonType: this.params.button_style
1323
- }));
1324
- this.$button.addClass('gpay-button-container');
1325
- }
1326
-
1327
- /**
1328
- * @return {[type]}
1329
- */
1330
- wc_stripe.GooglePay.prototype.start = function () {
1331
- // always recreate the paymentClient to ensure latest data is used.
1332
- this.createPaymentsClient();
1333
- this.paymentsClient.loadPaymentData(this.build_payment_request()).then(function (paymentData) {
1334
- var data = JSON.parse(paymentData.paymentMethodData.tokenizationData.token);
1335
- this.populate_address_fields(paymentData);
1336
- this.on_token_received(data);
1337
- }.bind(this)).catch(function (err) {
1338
- if (err.statusCode === "CANCELED") {
1339
- return;
1340
- }
1341
- if (err.statusMessage && err.statusMessage.indexOf("paymentDataRequest.callbackIntent") > -1) {
1342
- this.submit_error_code("DEVELOPER_ERROR_WHITELIST");
1343
- } else {
1344
- this.submit_error(err.statusMessage);
1345
- }
1346
- }.bind(this))
1347
- }
1348
-
1349
- /************* Apple Pay ************/
1350
-
1351
- /**
1352
- * @constructor
1353
- */
1354
- wc_stripe.ApplePay = function () {
1355
-
1356
- }
1357
-
1358
- /**
1359
- * @return {[type]}
1360
- */
1361
- wc_stripe.ApplePay.prototype.initialize = function () {
1362
- var selector = '.apple-pay-button';
1363
- if (['checkout', 'order_pay'].indexOf(this.get_page()) < 0) {
1364
- selector = this.container + ' .apple-pay-button';
1365
- }
1366
- $(document.body).on('click', selector, this.start.bind(this));
1367
- this.createPaymentRequest();
1368
- this.canMakePayment();
1369
- }
1370
-
1371
- wc_stripe.ApplePay.prototype.create_button = function () {
1372
- if (this.$button) {
1373
- this.$button.remove();
1374
- }
1375
- this.$button = $(this.params.button);
1376
- this.append_button();
1377
- }
1378
-
1379
- /**
1380
- * @return {[type]}
1381
- */
1382
- wc_stripe.ApplePay.prototype.canMakePayment = function () {
1383
- return new Promise(function (resolve, reject) {
1384
- this.paymentRequest.canMakePayment().then(function (result) {
1385
- if (result && result.applePay) {
1386
- this.can_pay = true;
1387
- this.create_button();
1388
- $(this.container).show();
1389
- resolve(result);
1390
- }
1391
- }.bind(this))
1392
- }.bind(this))
1393
- }
1394
-
1395
- /**
1396
- * @return {[type]}
1397
- */
1398
- wc_stripe.ApplePay.prototype.start = function (e) {
1399
- e.preventDefault();
1400
- this.paymentRequest.update(this.get_payment_request_update({
1401
- total: {
1402
- pending: false
1403
- }
1404
- }));
1405
- this.paymentRequest.show();
1406
- }
1407
-
1408
- /*********** PaymentRequest *********/
1409
-
1410
- wc_stripe.PaymentRequest = function () {
1411
-
1412
- }
1413
-
1414
- /**
1415
- * [initialize description]
1416
- * @return {[type]} [description]
1417
- */
1418
- wc_stripe.PaymentRequest.prototype.initialize = function () {
1419
- this.createPaymentRequest();
1420
- this.canMakePayment();
1421
- this.paymentRequestButton = this.createPaymentRequestButton();
1422
- this.paymentRequestButton.on('click', this.button_click.bind(this));
1423
- }
1424
-
1425
- /**
1426
- * [button_click description]
1427
- * @param {[type]} event [description]
1428
- * @return {[type]} [description]
1429
- */
1430
- wc_stripe.PaymentRequest.prototype.button_click = function (event) {
1431
- }
1432
-
1433
- /**
1434
- * [createPaymentRequestButton description]
1435
- * @return {[type]} [description]
1436
- */
1437
- wc_stripe.PaymentRequest.prototype.createPaymentRequestButton = function () {
1438
- return this.elements.create("paymentRequestButton", {
1439
- paymentRequest: this.paymentRequest,
1440
- style: {
1441
- paymentRequestButton: {
1442
- type: this.params.button.type,
1443
- theme: this.params.button.theme,
1444
- height: this.params.button.height
1445
- }
1446
- }
1447
- })
1448
- }
1449
-
1450
- /**
1451
- * [canMakePayment description]
1452
- * @return {[type]} [description]
1453
- */
1454
- wc_stripe.PaymentRequest.prototype.canMakePayment = function () {
1455
- return new Promise(function (resolve, reject) {
1456
- this.paymentRequest.canMakePayment().then(function (result) {
1457
- if (result && !result.applePay) {
1458
- this.can_pay = true;
1459
- this.create_button();
1460
- $(this.container).show();
1461
- resolve(result);
1462
- }
1463
- }.bind(this))
1464
- }.bind(this))
1465
- }
1466
-
1467
- /**
1468
- * [create_button description]
1469
- * @return {[type]} [description]
1470
- */
1471
- wc_stripe.PaymentRequest.prototype.create_button = function () {
1472
- this.paymentRequestButton.mount('#wc-stripe-payment-request-container');
1473
- }
1474
-
1475
- wc_stripe.CheckoutFields = function (params, page) {
1476
- this.params = params;
1477
- this.fields = new Map(Object.keys(this.params).map(function (k) {
1478
- return [k, this.params[k].value];
1479
- }.bind(this)));
1480
- if ('checkout' === page) {
1481
- $('form.checkout').on('change', '.input-text, select', this.onChange.bind(this));
1482
- $('form.checkout').on('change', '[name="ship_to_different_address"]', this.on_ship_to_address_change.bind(this));
1483
- this.init_i18n();
1484
- }
1485
- }
1486
-
1487
- wc_stripe.CheckoutFields.prototype.init_i18n = function () {
1488
- if (typeof wc_address_i18n_params !== 'undefined') {
1489
- this.locales = $.parseJSON(wc_address_i18n_params.locale.replace(/&quot;/g, '"'));
1490
- } else {
1491
- this.locales = null;
1492
- }
1493
- }
1494
-
1495
- wc_stripe.CheckoutFields.prototype.onChange = function (e) {
1496
- try {
1497
- var name = e.currentTarget.name, value = e.currentTarget.value;
1498
- this.fields.set(name, value);
1499
-
1500
- if (name === 'billing_country' || name === 'shipping_country') {
1501
- this.update_required_fields(value, name);
1502
- }
1503
- } catch (err) {
1504
- console.log(err);
1505
- }
1506
- }
1507
-
1508
- wc_stripe.CheckoutFields.prototype.update_required_fields = function (country, name) {
1509
- if (this.locales) {
1510
- var prefix = name.indexOf('billing_') > -1 ? 'billing_' : 'shipping_';
1511
- var locale = typeof this.locales[country] !== 'undefined' ? this.locales[country] : this.locales['default'];
1512
- var fields = $.extend(true, {}, this.locales['default'], locale);
1513
- for (var k in fields) {
1514
- var k2 = prefix + k;
1515
- if (this.params[k2]) {
1516
- this.params[k2] = $.extend(true, {}, this.params[k2], fields[k]);
1517
- }
1518
- }
1519
- }
1520
- }
1521
-
1522
- wc_stripe.CheckoutFields.prototype.on_ship_to_address_change = function (e) {
1523
- if ($(e.currentTarget).is(':checked')) {
1524
- this.update_required_fields($('shipping_country'), 'shipping_country');
1525
- }
1526
- }
1527
-
1528
- wc_stripe.CheckoutFields.prototype.set = function (k, v, prefix) {
1529
- if (this[k] && typeof this[k] === 'function') {
1530
- this[k]().set.call(this, v, prefix);
1531
- } else {
1532
- this.fields.set(k, v);
1533
- }
1534
- }
1535
-
1536
- wc_stripe.CheckoutFields.prototype.get = function (k, prefix) {
1537
- if (this[k] && typeof this[k] === 'function') {
1538
- var value = this[k]().get.call(this, prefix);
1539
- } else {
1540
- var value = this.fields.get(k);
1541
- if (typeof value === 'undefined' || value === null || value === '') {
1542
- if (typeof prefix !== 'undefined') {
1543
- value = prefix;
1544
- }
1545
- }
1546
- }
1547
- return typeof value === 'undefined' ? '' : value;
1548
- }
1549
-
1550
- /**
1551
- * Return true if the field is required
1552
- * @param k
1553
- * @returns boolean
1554
- */
1555
- wc_stripe.CheckoutFields.prototype.required = function (k) {
1556
- if (this.params[k]) {
1557
- if (typeof this.params[k].required !== 'undefined') {
1558
- return this.params[k].required;
1559
- }
1560
- }
1561
- return false;
1562
- }
1563
-
1564
- wc_stripe.CheckoutFields.prototype.name = function () {
1565
- return {
1566
- set: function (v, prefix) {
1567
- var name = v.split(" ");
1568
- this.fields.set(prefix + '_first_name', name[0]);
1569
- this.fields.set(prefix + '_last_name', name[1]);
1570
- },
1571
- get: function (prefix) {
1572
- return this.fields.get(prefix + '_first_name') + ' ' + this.fields.get(prefix + '_last_name');
1573
- }
1574
- }
1575
- }
1576
-
1577
- wc_stripe.CheckoutFields.prototype.payerName = function () {
1578
- return wc_stripe.CheckoutFields.prototype.name.apply(this, arguments);
1579
- }
1580
-
1581
- wc_stripe.CheckoutFields.prototype.email = function () {
1582
- return {
1583
- set: function (v, prefix) {
1584
- this.fields.set(prefix + '_email', v);
1585
- },
1586
- get: function (prefix) {
1587
- return this.fields.get(prefix + '_email');
1588
- }
1589
- }
1590
- }
1591
-
1592
- wc_stripe.CheckoutFields.prototype.payerEmail = function () {
1593
- return wc_stripe.CheckoutFields.prototype.email.apply(this, arguments);
1594
- }
1595
-
1596
- wc_stripe.CheckoutFields.prototype.phone = function () {
1597
- return {
1598
- set: function (v, prefix) {
1599
- this.fields.set(prefix + '_phone', v);
1600
- },
1601
- get: function (prefix) {
1602
- return this.fields.get(prefix + '_phone');
1603
- }
1604
- }
1605
- }
1606
-
1607
- wc_stripe.CheckoutFields.prototype.payerPhone = function () {
1608
- return wc_stripe.CheckoutFields.prototype.phone.apply(this, arguments);
1609
- }
1610
-
1611
- wc_stripe.CheckoutFields.prototype.phoneNumber = function () {
1612
- return wc_stripe.CheckoutFields.prototype.phone.apply(this, arguments);
1613
- }
1614
-
1615
- wc_stripe.CheckoutFields.prototype.recipient = function () {
1616
- return {
1617
- set: function (v, prefix) {
1618
- var name = v.split(" ");
1619
- if (name.length > 0) {
1620
- this.fields.set(prefix + '_first_name', name[0]);
1621
- }
1622
- if (name.length > 1) {
1623
- this.fields.set(prefix + '_last_name', name[1]);
1624
- }
1625
- },
1626
- get: function (prefix) {
1627
- return this.fields.get(prefix + '_first_name') + ' ' + this.fields.get(prefix + '_last_name');
1628
- }
1629
- }
1630
- }
1631
-
1632
- wc_stripe.CheckoutFields.prototype.country = function () {
1633
- return {
1634
- set: function (v, prefix) {
1635
- this.fields.set(prefix + '_country', v);
1636
- },
1637
- get: function (prefix) {
1638
- return this.fields.get(prefix + '_country');
1639
- }
1640
- }
1641
- }
1642
-
1643
- wc_stripe.CheckoutFields.prototype.countryCode = function () {
1644
- return wc_stripe.CheckoutFields.prototype.country.apply(this, arguments);
1645
- }
1646
-
1647
- wc_stripe.CheckoutFields.prototype.address1 = function () {
1648
- return {
1649
- set: function (v, prefix) {
1650
- this.fields.set(prefix + '_address_1', v);
1651
- },
1652
- get: function (prefix) {
1653
- return this.fields.get(prefix + '_address_1');
1654
- }
1655
- }
1656
- }
1657
-
1658
- wc_stripe.CheckoutFields.prototype.address2 = function () {
1659
- return {
1660
- set: function (v, prefix) {
1661
- this.fields.set(prefix + '_address_2', v);
1662
- },
1663
- get: function (prefix) {
1664
- this.fields.get(prefix + '_address_2');
1665
- }
1666
- }
1667
- }
1668
-
1669
- wc_stripe.CheckoutFields.prototype.line1 = function () {
1670
- return wc_stripe.CheckoutFields.prototype.address1.apply(this, arguments);
1671
- }
1672
-
1673
- wc_stripe.CheckoutFields.prototype.line2 = function () {
1674
- return wc_stripe.CheckoutFields.prototype.address2.apply(this, arguments);
1675
- }
1676
-
1677
- wc_stripe.CheckoutFields.prototype.addressLine = function () {
1678
- return {
1679
- set: function (v, prefix) {
1680
- if (v.length > 0) {
1681
- this.fields.set(prefix + '_address_1', v[0]);
1682
- }
1683
- if (v.length > 1) {
1684
- this.fields.set(prefix + '_address_2', v[1]);
1685
- }
1686
- },
1687
- get: function (prefix) {
1688
- return [
1689
- this.fields.get(prefix + '_address_1'),
1690
- this.fields.get(prefix + '_address_2')
1691
- ]
1692
- }
1693
- }
1694
- }
1695
-
1696
- wc_stripe.CheckoutFields.prototype.state = function () {
1697
- return {
1698
- set: function (v, prefix) {
1699
- this.fields.set(prefix + '_state', v);
1700
- },
1701
- get: function (prefix) {
1702
- return this.fields.get(prefix + '_state');
1703
- }
1704
- }
1705
- }
1706
-
1707
- wc_stripe.CheckoutFields.prototype.region = function () {
1708
- return wc_stripe.CheckoutFields.prototype.state.apply(this, arguments);
1709
- }
1710
-
1711
- wc_stripe.CheckoutFields.prototype.administrativeArea = function () {
1712
- return wc_stripe.CheckoutFields.prototype.state.apply(this, arguments);
1713
- }
1714
-
1715
- wc_stripe.CheckoutFields.prototype.city = function () {
1716
- return {
1717
- set: function (v, prefix) {
1718
- this.fields.set(prefix + '_city', v);
1719
- },
1720
- get: function (prefix) {
1721
- this.fields.get(prefix + '_city');
1722
- }
1723
- }
1724
- }
1725
-
1726
- wc_stripe.CheckoutFields.prototype.locality = function () {
1727
- return wc_stripe.CheckoutFields.prototype.city.apply(this, arguments);
1728
- }
1729
-
1730
- wc_stripe.CheckoutFields.prototype.postal_code = function () {
1731
- return {
1732
- set: function (v, prefix) {
1733
- this.fields.set(prefix + '_postcode', v);
1734
- },
1735
- get: function (prefix) {
1736
- this.fields.get(prefix + '_postcode');
1737
- }
1738
- }
1739
- }
1740
-
1741
- wc_stripe.CheckoutFields.prototype.postalCode = function () {
1742
- return wc_stripe.CheckoutFields.prototype.postal_code.apply(this, arguments);
1743
- }
1744
-
1745
- /**
1746
- * Serialize the fields into an expected format
1747
- */
1748
- wc_stripe.CheckoutFields.prototype.toJson = function () {
1749
- var data = {};
1750
- this.fields.forEach(function (value, key) {
1751
- data[key] = value;
1752
- });
1753
- return data;
1754
- }
1755
-
1756
- /**
1757
- * Assign the field values to form field values
1758
- */
1759
- wc_stripe.CheckoutFields.prototype.toFormFields = function () {
1760
- this.fields.forEach(function (value, key) {
1761
- key = '[name="' + key + '"]';
1762
- if ($(key).length && value !== '') {
1763
- $(key).val(value);
1764
- }
1765
- });
1766
- }
1767
-
1768
- try {
1769
- stripe = Stripe(wc_stripe_params_v3.api_key, {stripeAccount: wc_stripe_params_v3.account});
1770
- } catch (error) {
1771
- window.alert(error);
1772
- console.log(error);
1773
- return;
1774
- }
1775
-
1776
- var checkoutFields = new wc_stripe.CheckoutFields(wc_stripe_checkout_fields, wc_stripe_params_v3.page);
1777
-
1778
- }(window, jQuery))
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ (function (window, $) {
2
+ window.wc_stripe = {};
3
+ var stripe = null;
4
+
5
+ if (typeof wc_stripe_checkout_fields === 'undefined') {
6
+ window.wc_stripe_checkout_fields = [];
7
+ }
8
+
9
+ wc_stripe.BaseGateway = function (params, container) {
10
+ this.params = params;
11
+ this.gateway_id = this.params.gateway_id;
12
+ this.container = typeof container === 'undefined' ? 'li.payment_method_'.concat(this.gateway_id) : container;
13
+
14
+ if (!$(this.container).length) {
15
+ this.container = '.payment_method_'.concat(this.gateway_id);
16
+ }
17
+
18
+ this.token_selector = this.params.token_selector;
19
+ this.saved_method_selector = this.params.saved_method_selector;
20
+ this.payment_token_received = false;
21
+ this.stripe = stripe;
22
+ this.elements = stripe.elements($.extend({}, {
23
+ locale: 'auto'
24
+ }, this.get_element_options()));
25
+ this.fields = checkoutFields;
26
+ this.initialize();
27
+ };
28
+
29
+ wc_stripe.BaseGateway.prototype.get_page = function () {
30
+ return wc_stripe_params_v3.page;
31
+ };
32
+
33
+ wc_stripe.BaseGateway.prototype.set_nonce = function (value) {
34
+ this.fields.set(this.gateway_id + '_token_key', value);
35
+ $(this.token_selector).val(value);
36
+ };
37
+ /**
38
+ * [get_element_options description]
39
+ * @return {[type]} [description]
40
+ */
41
+
42
+
43
+ wc_stripe.BaseGateway.prototype.get_element_options = function () {
44
+ return {};
45
+ };
46
+
47
+ wc_stripe.BaseGateway.prototype.initialize = function () {
48
+ };
49
+ /**
50
+ * @return {[type]}
51
+ */
52
+
53
+
54
+ wc_stripe.BaseGateway.prototype.create_button = function () {
55
+ };
56
+ /**
57
+ * @returns {Boolean}
58
+ */
59
+
60
+
61
+ wc_stripe.BaseGateway.prototype.is_gateway_selected = function () {
62
+ return $('[name="payment_method"]:checked').val() === this.gateway_id;
63
+ };
64
+ /**
65
+ * @returns {Boolean}
66
+ */
67
+
68
+
69
+ wc_stripe.BaseGateway.prototype.is_saved_method_selected = function () {
70
+ return this.is_gateway_selected() && $('[name="' + this.gateway_id + '_payment_type_key"]:checked').val() === 'saved';
71
+ };
72
+ /**
73
+ * @return {Boolean}
74
+ */
75
+
76
+
77
+ wc_stripe.BaseGateway.prototype.has_checkout_error = function () {
78
+ return $('#wc_stripe_checkout_error').length > 0 && this.is_gateway_selected();
79
+ };
80
+ /**
81
+ * @param {[type]}
82
+ * @return {[type]}
83
+ */
84
+
85
+
86
+ wc_stripe.BaseGateway.prototype.submit_error = function (message) {
87
+ message = this.get_error_message(message);
88
+
89
+ if (message.indexOf('</ul>') == -1) {
90
+ message = '<div class="woocommerce-error">' + message + '</div>';
91
+ }
92
+
93
+ this.submit_message(message);
94
+ };
95
+
96
+ wc_stripe.BaseGateway.prototype.submit_error_code = function (code) {
97
+ console.log(code);
98
+ };
99
+
100
+ wc_stripe.BaseGateway.prototype.get_error_message = function (message) {
101
+ if (typeof message == 'object' && message.code) {
102
+ if (wc_stripe_messages[message.code]) {
103
+ message = wc_stripe_messages[message.code];
104
+ } else {
105
+ message = message.message;
106
+ }
107
+ }
108
+
109
+ return message;
110
+ };
111
+ /**
112
+ * @param {[type]}
113
+ * @return {[type]}
114
+ */
115
+
116
+
117
+ wc_stripe.BaseGateway.prototype.submit_message = function (message) {
118
+ $('.woocommerce-error, .woocommerce-message, .woocommerce-info').remove();
119
+ var $container = $(this.message_container);
120
+
121
+ if ($container.closest('form').length) {
122
+ $container = $container.closest('form');
123
+ }
124
+
125
+ $container.prepend(message);
126
+ $container.removeClass('processing').unblock();
127
+ $container.find('.input-text, select, input:checkbox').blur();
128
+
129
+ if ($.scroll_to_notices) {
130
+ $.scroll_to_notices($container);
131
+ } else {
132
+ $('html, body').animate({
133
+ scrollTop: $container.offset().top - 100
134
+ }, 1000);
135
+ }
136
+ };
137
+
138
+ wc_stripe.BaseGateway.prototype.get_first_name = function (prefix) {
139
+ return $('#' + prefix + '_first_name').val();
140
+ };
141
+
142
+ wc_stripe.BaseGateway.prototype.get_last_name = function (prefix) {
143
+ return $('#' + prefix + '_last_name').val();
144
+ };
145
+ /**
146
+ * Return true if the source should be saved.
147
+ *
148
+ * @returns {Boolean}
149
+ */
150
+
151
+
152
+ wc_stripe.BaseGateway.prototype.should_save_method = function () {
153
+ return $('#' + this.gateway_id + '_save_source_key').is(':checked');
154
+ };
155
+
156
+ wc_stripe.BaseGateway.prototype.is_add_payment_method_page = function () {
157
+ return this.get_page() === 'add_payment_method' || $(document.body).hasClass('woocommerce-add-payment-method');
158
+ };
159
+
160
+ wc_stripe.BaseGateway.prototype.is_change_payment_method = function () {
161
+ return this.get_page() === 'change_payment_method';
162
+ };
163
+
164
+ wc_stripe.BaseGateway.prototype.get_selected_payment_method = function () {
165
+ return $(this.saved_method_selector).val();
166
+ };
167
+
168
+ wc_stripe.BaseGateway.prototype.needs_shipping = function () {
169
+ return this.get_gateway_data().needs_shipping;
170
+ };
171
+
172
+ wc_stripe.BaseGateway.prototype.get_currency = function () {
173
+ return this.get_gateway_data().currency;
174
+ };
175
+
176
+ wc_stripe.BaseGateway.prototype.get_gateway_data = function () {
177
+ return $(this.container).find(".woocommerce_".concat(this.gateway_id, "_gateway_data")).data('gateway');
178
+ };
179
+
180
+ wc_stripe.BaseGateway.prototype.set_gateway_data = function (data) {
181
+ $(this.container).find(".woocommerce_".concat(this.gateway_id, "_gateway_data")).data('gateway', data);
182
+ };
183
+ /**
184
+ * [get_customer_name description]
185
+ * @return String
186
+ */
187
+
188
+
189
+ wc_stripe.BaseGateway.prototype.get_customer_name = function (prefix) {
190
+ return this.fields.get(prefix + '_first_name') + ' ' + this.fields.get(prefix + '_last_name');
191
+ };
192
+ /**
193
+ * [get_customer_email description]
194
+ * @return {String} [description]
195
+ */
196
+
197
+
198
+ wc_stripe.BaseGateway.prototype.get_customer_email = function () {
199
+ return this.fields.get('billing_email');
200
+ };
201
+ /**
202
+ * Returns a string representation of an address.
203
+ * @param {[type]}
204
+ * @return {[type]}
205
+ */
206
+
207
+
208
+ wc_stripe.BaseGateway.prototype.get_address_field_hash = function (prefix) {
209
+ var params = ['_first_name', '_last_name', '_address_1', '_address_2', '_postcode', '_city', '_state', '_country'];
210
+ var hash = '';
211
+
212
+ for (var i = 0; i < params.length; i++) {
213
+ hash += this.fields.get(prefix + params[i]) + '_';
214
+ }
215
+
216
+ return hash;
217
+ };
218
+ /**
219
+ * @return {[type]}
220
+ */
221
+
222
+
223
+ wc_stripe.BaseGateway.prototype.block = function () {
224
+ $.blockUI({
225
+ message: null,
226
+ overlayCSS: {
227
+ background: '#fff',
228
+ opacity: 0.6
229
+ }
230
+ });
231
+ };
232
+ /**
233
+ * @return {[type]}
234
+ */
235
+
236
+
237
+ wc_stripe.BaseGateway.prototype.unblock = function () {
238
+ $.unblockUI();
239
+ };
240
+ /**
241
+ * @return {[type]}
242
+ */
243
+
244
+
245
+ wc_stripe.BaseGateway.prototype.get_form = function () {
246
+ return $(this.token_selector).closest('form');
247
+ };
248
+ /**
249
+ * @return {[type]}
250
+ */
251
+
252
+
253
+ wc_stripe.BaseGateway.prototype.get_total_price = function () {
254
+ return this.get_gateway_data().total;
255
+ };
256
+
257
+ wc_stripe.BaseGateway.prototype.get_total_price_cents = function () {
258
+ return this.get_gateway_data().total_cents;
259
+ };
260
+ /**
261
+ * @return {[type]}
262
+ */
263
+
264
+
265
+ wc_stripe.BaseGateway.prototype.set_total_price = function (total) {
266
+ var data = this.get_gateway_data();
267
+ data.total = total;
268
+ this.set_gateway_data(data);
269
+ };
270
+ /**
271
+ * @return {[type]}
272
+ */
273
+
274
+
275
+ wc_stripe.BaseGateway.prototype.set_total_price_cents = function (total) {
276
+ var data = this.get_gateway_data();
277
+ data.total_cents = total;
278
+ this.set_gateway_data(data);
279
+ };
280
+ /**
281
+ * [set_payment_method description]
282
+ * @param {[type]} payment_method [description]
283
+ */
284
+
285
+
286
+ wc_stripe.BaseGateway.prototype.set_payment_method = function (payment_method) {
287
+ $('[name="payment_method"][value="' + payment_method + '"]').prop("checked", true).trigger('click');
288
+ };
289
+ /**
290
+ * [set_shipping_methods description]
291
+ */
292
+
293
+
294
+ wc_stripe.BaseGateway.prototype.set_selected_shipping_methods = function (shipping_methods) {
295
+ this.fields.set('shipping_method', shipping_methods);
296
+
297
+ if (shipping_methods && $('[name^="shipping_method"]').length) {
298
+ for (var i in shipping_methods) {
299
+ var method = shipping_methods[i];
300
+ $('[name="shipping_method[' + i + ']"][value="' + method + '"]').prop("checked", true).trigger('change');
301
+ }
302
+ }
303
+ };
304
+ /**
305
+ * @param {[type]}
306
+ * @return {[type]}
307
+ */
308
+
309
+
310
+ wc_stripe.BaseGateway.prototype.on_token_received = function (paymentMethod) {
311
+ this.payment_token_received = true;
312
+ this.set_nonce(paymentMethod.id);
313
+ this.process_checkout();
314
+ };
315
+
316
+ wc_stripe.BaseGateway.prototype.createPaymentRequest = function () {
317
+ try {
318
+ this.paymentRequest = stripe.paymentRequest(this.get_payment_request_options());
319
+ } catch (err) {
320
+ this.submit_error(err.message);
321
+ return;
322
+ }
323
+
324
+ if (this.needs_shipping()) {
325
+ this.paymentRequest.on('shippingaddresschange', this.update_shipping_address.bind(this));
326
+ this.paymentRequest.on('shippingoptionchange', this.update_shipping_method.bind(this));
327
+ }
328
+
329
+ this.paymentRequest.on('paymentmethod', this.on_payment_method_received.bind(this));
330
+ };
331
+ /**
332
+ * @return {[Object]}
333
+ */
334
+
335
+
336
+ wc_stripe.BaseGateway.prototype.get_payment_request_options = function () {
337
+ var options = {
338
+ country: this.params.country_code,
339
+ currency: this.get_currency().toLowerCase(),
340
+ total: {
341
+ amount: this.get_total_price_cents(),
342
+ label: this.params.total_label,
343
+ pending: true
344
+ },
345
+ requestPayerName: true,
346
+ requestPayerEmail: this.fields.requestFieldInWallet('billing_email'),
347
+ requestPayerPhone: this.fields.requestFieldInWallet('billing_phone'),
348
+ requestShipping: this.needs_shipping()
349
+ };
350
+ var displayItems = this.get_display_items(),
351
+ shippingOptions = this.get_shipping_options();
352
+
353
+ if (displayItems) {
354
+ options.displayItems = displayItems;
355
+ }
356
+
357
+ if (this.needs_shipping() && shippingOptions) {
358
+ options.shippingOptions = shippingOptions;
359
+ }
360
+
361
+ return options;
362
+ };
363
+ /**
364
+ * @return {[Object]}
365
+ */
366
+
367
+
368
+ wc_stripe.BaseGateway.prototype.get_payment_request_update = function (data) {
369
+ var options = {
370
+ currency: this.get_currency().toLowerCase(),
371
+ total: {
372
+ amount: parseInt(this.get_total_price_cents()),
373
+ label: this.params.total_label,
374
+ pending: true
375
+ }
376
+ };
377
+ var displayItems = this.get_display_items(),
378
+ shippingOptions = this.get_shipping_options();
379
+
380
+ if (displayItems) {
381
+ options.displayItems = displayItems;
382
+ }
383
+
384
+ if (this.needs_shipping() && shippingOptions) {
385
+ options.shippingOptions = shippingOptions;
386
+ }
387
+
388
+ if (data) {
389
+ options = $.extend(true, {}, options, data);
390
+ }
391
+
392
+ return options;
393
+ };
394
+ /**
395
+ * @return {[type]}
396
+ */
397
+
398
+
399
+ wc_stripe.BaseGateway.prototype.get_display_items = function () {
400
+ return this.get_gateway_data().items;
401
+ };
402
+ /**
403
+ * @return {[type]}
404
+ */
405
+
406
+
407
+ wc_stripe.BaseGateway.prototype.set_display_items = function (items) {
408
+ var data = this.get_gateway_data();
409
+ data.items = items;
410
+ this.set_gateway_data(data);
411
+ };
412
+ /**
413
+ * Return an array of shipping options for display in the Google payment sheet
414
+ * @return {[type]}
415
+ */
416
+
417
+
418
+ wc_stripe.BaseGateway.prototype.get_shipping_options = function () {
419
+ return this.get_gateway_data().shipping_options;
420
+ };
421
+ /**
422
+ * Update the shipping options.
423
+ * @param {[type]}
424
+ */
425
+
426
+
427
+ wc_stripe.BaseGateway.prototype.set_shipping_options = function (items) {
428
+ var data = this.get_gateway_data();
429
+ data.shipping_options = items;
430
+ this.set_gateway_data(data);
431
+ };
432
+ /**
433
+ * Maps an address from the Browser address format to WC format.
434
+ * @param {[type]}
435
+ * @return {[type]}
436
+ */
437
+
438
+
439
+ wc_stripe.BaseGateway.prototype.map_address = function (address) {
440
+ return {
441
+ city: address.city,
442
+ postcode: address.postalCode,
443
+ state: address.region,
444
+ country: address.country
445
+ };
446
+ };
447
+ /**
448
+ * @param {[type]}
449
+ * @return {[type]}
450
+ */
451
+
452
+
453
+ wc_stripe.BaseGateway.prototype.on_payment_method_received = function (paymentResponse) {
454
+ try {
455
+ this.payment_response = paymentResponse;
456
+ this.populate_checkout_fields(paymentResponse);
457
+ paymentResponse.complete("success");
458
+ this.on_token_received(paymentResponse.paymentMethod);
459
+ } catch (err) {
460
+ window.alert(err);
461
+ }
462
+ };
463
+ /**
464
+ * @return {[type]}
465
+ */
466
+
467
+
468
+ wc_stripe.BaseGateway.prototype.populate_checkout_fields = function (data) {
469
+ this.set_nonce(data.paymentMethod.id);
470
+ this.update_addresses(data);
471
+ };
472
+ /**
473
+ * @param {[type]}
474
+ * @return {[type]}
475
+ */
476
+
477
+
478
+ wc_stripe.BaseGateway.prototype.update_addresses = function (data) {
479
+ if (data.payerName) {
480
+ this.fields.set('name', data.payerName, 'billing');
481
+ }
482
+
483
+ if (data.payerEmail) {
484
+ this.fields.set('email', data.payerEmail, 'billing');
485
+ }
486
+
487
+ if (data.payerPhone) {
488
+ this.fields.set('phone', data.payerPhone, 'billing');
489
+ }
490
+
491
+ if (data.shippingAddress) {
492
+ this.populate_shipping_fields(data.shippingAddress);
493
+ }
494
+
495
+ if (data.paymentMethod.billing_details.address) {
496
+ this.populate_billing_fields(data.paymentMethod.billing_details.address);
497
+ }
498
+ };
499
+
500
+ wc_stripe.BaseGateway.prototype.populate_address_fields = function (address, prefix) {
501
+ for (var k in address) {
502
+ this.fields.set(k, address[k], prefix);
503
+ }
504
+ }
505
+
506
+ wc_stripe.BaseGateway.prototype.populate_billing_fields = function (address) {
507
+ this.populate_address_fields(address, 'billing');
508
+ }
509
+
510
+ wc_stripe.BaseGateway.prototype.populate_shipping_fields = function (address) {
511
+ this.populate_address_fields(address, 'shipping');
512
+ }
513
+
514
+ wc_stripe.BaseGateway.prototype.address_mappings = function () {
515
+ return new wc_stripe.CheckoutFields();
516
+ };
517
+
518
+ wc_stripe.BaseGateway.prototype.ajax_before_send = function (xhr) {
519
+ if (this.params.user_id > 0) {
520
+ xhr.setRequestHeader('X-WP-Nonce', this.params.rest_nonce);
521
+ }
522
+ };
523
+ /**
524
+ * @return {[type]}
525
+ */
526
+
527
+
528
+ wc_stripe.BaseGateway.prototype.process_checkout = function () {
529
+ return new Promise(function () {
530
+ this.block();
531
+ $.ajax({
532
+ url: this.params.routes.checkout,
533
+ method: 'POST',
534
+ dataType: 'json',
535
+ data: $.extend({}, this.serialize_fields(), {
536
+ payment_method: this.gateway_id,
537
+ page_id: this.get_page()
538
+ }),
539
+ beforeSend: this.ajax_before_send.bind(this)
540
+ }).done(function (result) {
541
+ if (result.reload) {
542
+ window.location.reload();
543
+ return;
544
+ }
545
+
546
+ if (result.result === 'success') {
547
+ window.location = result.redirect;
548
+ } else {
549
+ if (result.messages) {
550
+ this.submit_error(result.messages);
551
+ }
552
+
553
+ this.unblock();
554
+ }
555
+ }.bind(this)).fail(function (xhr, textStatus, errorThrown) {
556
+ this.unblock();
557
+ this.submit_error(errorThrown);
558
+ }.bind(this));
559
+ }.bind(this));
560
+ };
561
+ /**
562
+ * @return {[type]}
563
+ */
564
+
565
+
566
+ wc_stripe.BaseGateway.prototype.serialize_form = function ($form) {
567
+ var formData = $form.find('input').filter(function (i, e) {
568
+ if ($(e).is('[name^="add-to-cart"]')) {
569
+ return false;
570
+ }
571
+
572
+ return true;
573
+ }.bind(this)).serializeArray(),
574
+ data = {};
575
+
576
+ for (var i in formData) {
577
+ var obj = formData[i];
578
+ data[obj.name] = obj.value;
579
+ }
580
+
581
+ data.payment_method = this.gateway_id;
582
+ return data;
583
+ };
584
+
585
+ wc_stripe.BaseGateway.prototype.serialize_fields = function () {
586
+ return this.fields.toJson();
587
+ };
588
+ /**
589
+ * @param {[type]}
590
+ * @return {[type]}
591
+ */
592
+
593
+
594
+ wc_stripe.BaseGateway.prototype.map_shipping_methods = function (shippingData) {
595
+ var methods = {};
596
+
597
+ if (shippingData !== "default") {
598
+ var matches = shippingData.match(/^([\w+]):(.+)$/);
599
+
600
+ if (matches.length > 1) {
601
+ methods[matches[1]] = matches[2];
602
+ }
603
+ }
604
+
605
+ return methods;
606
+ };
607
+ /**
608
+ * [maybe_set_ship_to_different description]
609
+ * @return {[type]} [description]
610
+ */
611
+
612
+
613
+ wc_stripe.BaseGateway.prototype.maybe_set_ship_to_different = function () {
614
+ // if shipping and billing address are different,
615
+ // set the ship to different address option.
616
+ if ($('[name="ship_to_different_address"]').length) {
617
+ $('[name="ship_to_different_address"]').prop('checked', this.get_address_field_hash("billing") !== this.get_address_field_hash("shipping")).trigger('change');
618
+ }
619
+ };
620
+
621
+ wc_stripe.BaseGateway.prototype.update_shipping_address = function (ev) {
622
+ return new Promise(function (resolve, reject) {
623
+ $.ajax({
624
+ url: this.params.routes.shipping_address,
625
+ method: 'POST',
626
+ dataType: 'json',
627
+ data: {
628
+ address: this.map_address(ev.shippingAddress),
629
+ payment_method: this.gateway_id,
630
+ page_id: this.get_page()
631
+ },
632
+ beforeSend: this.ajax_before_send.bind(this)
633
+ }).done(function (response) {
634
+ if (response.code) {
635
+ ev.updateWith(response.data.newData);
636
+ reject(response.data);
637
+ } else {
638
+ ev.updateWith(response.data.newData);
639
+ this.fields.set('shipping_method', data.shipping_method);
640
+ resolve(response.data);
641
+ }
642
+ }.bind(this)).fail(function () {
643
+ }.bind(this));
644
+ }.bind(this));
645
+ };
646
+ /**
647
+ * @return {[@event]}
648
+ */
649
+
650
+
651
+ wc_stripe.BaseGateway.prototype.update_shipping_method = function (ev) {
652
+ return new Promise(function (resolve, reject) {
653
+ $.ajax({
654
+ url: this.params.routes.shipping_method,
655
+ method: 'POST',
656
+ dataType: 'json',
657
+ data: {
658
+ shipping_method: ev.shippingOption.id,
659
+ payment_method: this.gateway_id,
660
+ page_id: this.get_page()
661
+ },
662
+ beforeSend: this.ajax_before_send.bind(this)
663
+ }).done(function (response) {
664
+ if (response.code) {
665
+ ev.updateWith(response.data.newData);
666
+ reject(response.data);
667
+ } else {
668
+ this.set_selected_shipping_methods(response.data.shipping_methods);
669
+ ev.updateWith(response.data.newData);
670
+ resolve(response.data);
671
+ }
672
+ }.bind(this)).fail(function (xhr, textStatus, errorThrown) {
673
+ this.submit_error(errorThrown);
674
+ }.bind(this));
675
+ }.bind(this));
676
+ };
677
+ /********** Checkout Gateway ********/
678
+
679
+ /**
680
+ * @constructor
681
+ */
682
+
683
+
684
+ wc_stripe.CheckoutGateway = function () {
685
+ this.message_container = 'li.payment_method_' + this.gateway_id;
686
+ this.banner_container = 'li.banner_payment_method_' + this.gateway_id;
687
+ $(document.body).on('update_checkout', this.update_checkout.bind(this));
688
+ $(document.body).on('updated_checkout', this.updated_checkout.bind(this));
689
+ $(document.body).on('cfw_updated_checkout', this.updated_checkout.bind(this));
690
+ $(document.body).on('checkout_error', this.checkout_error.bind(this));
691
+ $(this.token_selector).closest('form').on('checkout_place_order_' + this.gateway_id, this.checkout_place_order.bind(this)); // events for showing gateway payment buttons
692
+
693
+ $(document.body).on('wc_stripe_new_method_' + this.gateway_id, this.on_show_new_methods.bind(this));
694
+ $(document.body).on('wc_stripe_saved_method_' + this.gateway_id, this.on_show_saved_methods.bind(this));
695
+ $(document.body).on('wc_stripe_payment_method_selected', this.on_payment_method_selected.bind(this));
696
+
697
+ if (this.banner_enabled()) {
698
+ if ($('.woocommerce-billing-fields').length) {
699
+ $('.wc-stripe-banner-checkout').css('max-width', $('.woocommerce-billing-fields').outerWidth(true));
700
+ }
701
+ }
702
+
703
+ this.order_review();
704
+ };
705
+
706
+ wc_stripe.CheckoutGateway.prototype.order_review = function () {
707
+ var url = window.location.href;
708
+ var matches = url.match(/order_review.+payment_method=([\w]+).+payment_nonce=(.+)/);
709
+
710
+ if (matches && matches.length > 1) {
711
+ var payment_method = matches[1],
712
+ nonce = matches[2];
713
+
714
+ if (this.gateway_id === payment_method) {
715
+ this.payment_token_received = true;
716
+ this.set_nonce(nonce);
717
+ this.set_use_new_option(true);
718
+ }
719
+ }
720
+ };
721
+
722
+ wc_stripe.CheckoutGateway.prototype.update_shipping_address = function () {
723
+ return wc_stripe.BaseGateway.prototype.update_shipping_address.apply(this, arguments).then(function (data) {
724
+ // populate the checkout fields with the address
725
+ this.populate_address_fields(data.address, this.get_shipping_prefix());
726
+ this.fields.toFormFields({update_shipping_method: false});
727
+ }.bind(this));
728
+ }
729
+
730
+ wc_stripe.CheckoutGateway.prototype.get_shipping_prefix = function () {
731
+ if (this.needs_shipping() && $('[name="ship_to_different_address"]').length > 0 && $('[name="ship_to_different_address"]').is(':checked')) {
732
+ return 'shipping';
733
+ }
734
+ return 'billing';
735
+ }
736
+
737
+ /**
738
+ * Called on the WC updated_checkout event
739
+ */
740
+ wc_stripe.CheckoutGateway.prototype.updated_checkout = function () {
741
+ };
742
+
743
+ /**
744
+ * Called on the WC update_checkout event
745
+ */
746
+ wc_stripe.CheckoutGateway.prototype.update_checkout = function () {
747
+ };
748
+ /**
749
+ * Called on the WC checkout_error event
750
+ */
751
+
752
+
753
+ wc_stripe.CheckoutGateway.prototype.checkout_error = function () {
754
+ if (this.has_checkout_error()) {
755
+ this.payment_token_received = false;
756
+ this.payment_response = null;
757
+ this.show_payment_button();
758
+ this.hide_place_order();
759
+ }
760
+ };
761
+ /**
762
+ *
763
+ */
764
+
765
+
766
+ wc_stripe.CheckoutGateway.prototype.is_valid_checkout = function () {
767
+ if ($('[name="terms"]').length) {
768
+ if (!$('[name="terms"]').is(':checked')) {
769
+ return false;
770
+ }
771
+ }
772
+
773
+ return true;
774
+ };
775
+ /**
776
+ * Returns the selected payment gateway's id.
777
+ *
778
+ * @returns {String}
779
+ */
780
+
781
+
782
+ wc_stripe.CheckoutGateway.prototype.get_payment_method = function () {
783
+ return $('[name="payment_method"]:checked').val();
784
+ };
785
+
786
+ wc_stripe.CheckoutGateway.prototype.set_use_new_option = function (bool) {
787
+ $('#' + this.gateway_id + '_use_new').prop('checked', bool).trigger('change');
788
+ };
789
+ /**
790
+ * Called on the WC checkout_place_order_{$gateway_id} event
791
+ */
792
+
793
+
794
+ wc_stripe.CheckoutGateway.prototype.checkout_place_order = function () {
795
+ if (!this.is_valid_checkout()) {
796
+ this.submit_error(this.params.messages.terms);
797
+ return false;
798
+ } else if (this.is_saved_method_selected()) {
799
+ return true;
800
+ }
801
+
802
+ return this.payment_token_received;
803
+ };
804
+ /**
805
+ * @param {[type]}
806
+ * @return {[type]}
807
+ */
808
+
809
+
810
+ wc_stripe.CheckoutGateway.prototype.on_token_received = function (paymentMethod) {
811
+ this.payment_token_received = true;
812
+ this.set_nonce(paymentMethod.id);
813
+ this.hide_payment_button();
814
+ this.show_place_order();
815
+ };
816
+ /**
817
+ * @return {[type]}
818
+ */
819
+
820
+
821
+ wc_stripe.CheckoutGateway.prototype.block = function () {
822
+ $('form.checkout').block({
823
+ message: null,
824
+ overlayCSS: {
825
+ background: '#fff',
826
+ opacity: 0.6
827
+ }
828
+ });
829
+ };
830
+ /**
831
+ * @return {[type]}
832
+ */
833
+
834
+
835
+ wc_stripe.CheckoutGateway.prototype.unblock = function () {
836
+ $('form.checkout').unblock();
837
+ };
838
+
839
+ wc_stripe.CheckoutGateway.prototype.hide_place_order = function () {
840
+ $('#place_order').addClass('wc-stripe-hide');
841
+ };
842
+ /**
843
+ * @return {[type]}
844
+ */
845
+
846
+
847
+ wc_stripe.CheckoutGateway.prototype.show_place_order = function () {
848
+ $('#place_order').removeClass('wc-stripe-hide');
849
+ };
850
+ /**
851
+ * Method that should perform actions when the show new methods contain is made visible.
852
+ * @param {[@event]}
853
+ * @param {[String]}
854
+ * @return {[type]}
855
+ */
856
+
857
+
858
+ wc_stripe.CheckoutGateway.prototype.on_show_new_methods = function () {
859
+ if (this.payment_token_received) {
860
+ this.show_place_order();
861
+ this.hide_payment_button();
862
+ } else {
863
+ this.hide_place_order();
864
+ this.show_payment_button();
865
+ }
866
+ };
867
+ /**
868
+ * Method that performs actions when the saved methods contains is visible.
869
+ * @param {[type]}
870
+ * @param {[type]}
871
+ * @return {[type]}
872
+ */
873
+
874
+
875
+ wc_stripe.CheckoutGateway.prototype.on_show_saved_methods = function () {
876
+ this.hide_payment_button();
877
+ this.show_place_order();
878
+ };
879
+ /**
880
+ * @return {[type]}
881
+ */
882
+
883
+
884
+ wc_stripe.CheckoutGateway.prototype.show_payment_button = function () {
885
+ if (this.$button) {
886
+ this.$button.show();
887
+ }
888
+ };
889
+ /**
890
+ * @return {[type]}
891
+ */
892
+
893
+
894
+ wc_stripe.CheckoutGateway.prototype.hide_payment_button = function () {
895
+ if (this.$button) {
896
+ this.$button.hide();
897
+ }
898
+ };
899
+ /**
900
+ * Wrapper for on_payment_method_selected that is safe to call since it won't trigger
901
+ * any DOM events.
902
+ * @return {[type]}
903
+ */
904
+
905
+
906
+ wc_stripe.CheckoutGateway.prototype.trigger_payment_method_selected = function () {
907
+ this.on_payment_method_selected(null, $('[name="payment_method"]:checked').val());
908
+ };
909
+ /**
910
+ * @param {[type]}
911
+ * @param {[type]}
912
+ * @return {[type]}
913
+ */
914
+
915
+
916
+ wc_stripe.CheckoutGateway.prototype.on_payment_method_selected = function (e, payment_method) {
917
+ if (payment_method === this.gateway_id) {
918
+ if (this.payment_token_received || this.is_saved_method_selected()) {
919
+ this.hide_payment_button();
920
+ this.show_place_order();
921
+ } else {
922
+ this.show_payment_button();
923
+ this.hide_place_order();
924
+ }
925
+ } else {
926
+ this.hide_payment_button();
927
+
928
+ if (payment_method.indexOf('stripe_') < 0) {
929
+ this.show_place_order();
930
+ }
931
+ }
932
+ };
933
+ /**
934
+ * [Return true if the banner option has been enabled for the gateway.]
935
+ * @return {[type]} [description]
936
+ */
937
+
938
+
939
+ wc_stripe.CheckoutGateway.prototype.banner_enabled = function () {
940
+ return this.params.banner_enabled === '1';
941
+ };
942
+
943
+ wc_stripe.CheckoutGateway.prototype.checkout_fields_valid = function () {
944
+ if (typeof wc_stripe_checkout_fields === 'undefined' || this.get_page() !== 'checkout') {
945
+ return true;
946
+ }
947
+
948
+ var valid = true;
949
+
950
+ function validateFields(prefix, fields) {
951
+ for (var k in fields) {
952
+ var field = fields[k];
953
+
954
+ if (k.indexOf(prefix) > -1 && field.required) {
955
+ if ($('#' + k).length) {
956
+ var val = $('#' + k).val();
957
+
958
+ if (typeof val === 'undefined' || val === null || val.length == 0) {
959
+ valid = false;
960
+ return;
961
+ }
962
+ }
963
+ }
964
+ }
965
+ }
966
+
967
+ validateFields('billing', wc_stripe_checkout_fields);
968
+
969
+ if (this.needs_shipping() && $('#ship-to-different-address-checkbox').is(':checked')) {
970
+ validateFields('shipping', wc_stripe_checkout_fields);
971
+ }
972
+
973
+ if (valid) {
974
+ valid = this.is_valid_checkout();
975
+ }
976
+
977
+ return valid;
978
+ };
979
+ /************** Product Gateway ***************/
980
+
981
+
982
+ wc_stripe.ProductGateway = function () {
983
+ this.message_container = 'div.product'; // events
984
+
985
+ $('form.cart').on('found_variation', this.found_variation.bind(this));
986
+ $('form.cart').on('reset_data', this.reset_variation_data.bind(this));
987
+ this.buttonWidth = $('div.quantity').outerWidth(true) + $('.single_add_to_cart_button').outerWidth();
988
+ var marginLeft = $('.single_add_to_cart_button').css('marginLeft');
989
+
990
+ if (marginLeft) {
991
+ this.buttonWidth += parseInt(marginLeft.replace('px', ''));
992
+ }
993
+
994
+ $(this.container).css('max-width', this.buttonWidth + 'px');
995
+ };
996
+ /**
997
+ * @return {[@int]}
998
+ */
999
+
1000
+
1001
+ wc_stripe.ProductGateway.prototype.get_quantity = function () {
1002
+ return parseInt($('[name="quantity"]').val());
1003
+ };
1004
+ /**
1005
+ * @param {[type]}
1006
+ * @param {[type]}
1007
+ */
1008
+
1009
+
1010
+ wc_stripe.ProductGateway.prototype.set_rest_nonce = function (e, nonce) {
1011
+ this.params.rest_nonce = nonce;
1012
+ };
1013
+ /**
1014
+ * @param {[type]}
1015
+ * @param {[type]}
1016
+ * @return {[type]}
1017
+ */
1018
+
1019
+
1020
+ wc_stripe.ProductGateway.prototype.found_variation = function (e, variation) {
1021
+ var data = this.get_gateway_data();
1022
+ data.product.price = variation.display_price;
1023
+ data.needs_shipping = !variation.is_virtual;
1024
+ data.product.variation = variation;
1025
+ this.set_gateway_data(data);
1026
+ };
1027
+ /**
1028
+ * @return {[type]}
1029
+ */
1030
+
1031
+
1032
+ wc_stripe.ProductGateway.prototype.reset_variation_data = function () {
1033
+ var data = this.get_product_data();
1034
+ data.variation = false;
1035
+ this.set_product_data(data);
1036
+ this.disable_payment_button();
1037
+ };
1038
+ /**
1039
+ * @return {[type]}
1040
+ */
1041
+
1042
+
1043
+ wc_stripe.ProductGateway.prototype.disable_payment_button = function () {
1044
+ if (this.$button) {
1045
+ this.get_button().prop('disabled', true).addClass('disabled');
1046
+ }
1047
+ };
1048
+ /**
1049
+ * @return {[type]}
1050
+ */
1051
+
1052
+
1053
+ wc_stripe.ProductGateway.prototype.enable_payment_button = function () {
1054
+ if (this.$button) {
1055
+ this.get_button().prop('disabled', false).removeClass('disabled');
1056
+ }
1057
+ };
1058
+ /**
1059
+ * @return {[type]}
1060
+ */
1061
+
1062
+
1063
+ wc_stripe.ProductGateway.prototype.get_button = function () {
1064
+ return this.$button;
1065
+ };
1066
+ /**
1067
+ * @return {Boolean}
1068
+ */
1069
+
1070
+
1071
+ wc_stripe.ProductGateway.prototype.is_variable_product = function () {
1072
+ return $('[name="variation_id"]').length > 0;
1073
+ };
1074
+
1075
+ wc_stripe.ProductGateway.prototype.variable_product_selected = function () {
1076
+ return this.get_product_data().variation !== false;
1077
+ };
1078
+ /**
1079
+ * @return {[type]}
1080
+ */
1081
+
1082
+
1083
+ wc_stripe.ProductGateway.prototype.get_product_data = function () {
1084
+ return this.get_gateway_data().product;
1085
+ };
1086
+ /**
1087
+ * @return {[type]}
1088
+ */
1089
+
1090
+
1091
+ wc_stripe.ProductGateway.prototype.set_product_data = function (product) {
1092
+ var data = this.get_gateway_data();
1093
+ data.product = product;
1094
+ this.set_gateway_data(data);
1095
+ };
1096
+ /**
1097
+ * Add a product to the WC shopping cart
1098
+ */
1099
+
1100
+
1101
+ wc_stripe.ProductGateway.prototype.add_to_cart = function () {
1102
+ return new Promise(function (resolve, reject) {
1103
+ this.block();
1104
+ $.ajax({
1105
+ url: this.params.routes.add_to_cart,
1106
+ method: 'POST',
1107
+ dataType: 'json',
1108
+ data: {
1109
+ product_id: this.get_product_data().id,
1110
+ variation_id: this.is_variable_product() ? $('[name="variation_id"]').val() : 0,
1111
+ qty: $('[name="quantity"]').val(),
1112
+ payment_method: this.gateway_id,
1113
+ page_id: this.get_page()
1114
+ },
1115
+ beforeSend: this.ajax_before_send.bind(this)
1116
+ }).done(function (response) {
1117
+ this.unblock();
1118
+
1119
+ if (response.code) {
1120
+ this.submit_error(response.message);
1121
+ reject(response);
1122
+ } else {
1123
+ this.set_total_price(response.data.total);
1124
+ this.set_total_price_cents(response.data.totalCents);
1125
+ this.set_display_items(response.data.displayItems);
1126
+ resolve(response.data);
1127
+ }
1128
+ }.bind(this)).fail(function (xhr, textStatus, errorThrown) {
1129
+ this.unblock();
1130
+ this.submit_error(errorThrown);
1131
+ }.bind(this));
1132
+ }.bind(this));
1133
+ };
1134
+
1135
+ wc_stripe.ProductGateway.prototype.cart_calculation = function (variation_id) {
1136
+ return new Promise(function (resolve, reject) {
1137
+ $.ajax({
1138
+ url: this.params.routes.cart_calculation,
1139
+ method: 'POST',
1140
+ dataType: 'json',
1141
+ data: {
1142
+ product_id: this.get_product_data().id,
1143
+ variation_id: this.is_variable_product() && variation_id ? variation_id : 0,
1144
+ qty: $('[name="quantity"]').val(),
1145
+ payment_method: this.gateway_id
1146
+ },
1147
+ beforeSend: this.ajax_before_send.bind(this)
1148
+ }).done(function (response) {
1149
+ if (response.code) {
1150
+ this.cart_calculation_error = true;
1151
+ reject(response);
1152
+ } else {
1153
+ this.set_total_price(response.data.total);
1154
+ this.set_total_price_cents(response.data.totalCents);
1155
+ this.set_display_items(response.data.displayItems);
1156
+ resolve(response.data);
1157
+ }
1158
+ }.bind(this)).fail(function () {
1159
+ }.bind(this));
1160
+ }.bind(this));
1161
+ };
1162
+ /************* Cart Gateway *************/
1163
+
1164
+ /**
1165
+ * @constructor
1166
+ */
1167
+
1168
+
1169
+ wc_stripe.CartGateway = function () {
1170
+ this.message_container = 'div.woocommerce'; // cart events
1171
+
1172
+ $(document.body).on('updated_wc_div', this.updated_html.bind(this));
1173
+ $(document.body).on('updated_cart_totals', this.updated_html.bind(this));
1174
+ $(document.body).on('wc_cart_emptied', this.cart_emptied.bind(this));
1175
+ };
1176
+ /**
1177
+ * @param {[type]}
1178
+ * @return {[type]}
1179
+ */
1180
+
1181
+
1182
+ wc_stripe.CartGateway.prototype.submit_error = function (message) {
1183
+ this.submit_message(this.get_error_message(message));
1184
+ };
1185
+ /**
1186
+ * @param {[@event]}
1187
+ * @return {[null]}
1188
+ */
1189
+
1190
+
1191
+ wc_stripe.CartGateway.prototype.updated_html = function (e) {
1192
+ };
1193
+
1194
+ wc_stripe.CartGateway.prototype.cart_emptied = function (e) {
1195
+ };
1196
+
1197
+ wc_stripe.CartGateway.prototype.add_cart_totals_class = function () {
1198
+ $('.cart_totals').addClass('stripe_cart_gateway_active');
1199
+ };
1200
+
1201
+ /************* Google Pay Mixins **************/
1202
+
1203
+ wc_stripe.GooglePay = function () {
1204
+ };
1205
+
1206
+ var googlePayBaseRequest = {
1207
+ apiVersion: 2,
1208
+ apiVersionMinor: 0
1209
+ };
1210
+ var allowedCardNetworks = ["AMEX", "DISCOVER", "INTERAC", "JCB", "MASTERCARD", "VISA"];
1211
+ var allowedCardAuthMethods = ["PAN_ONLY"];
1212
+ var baseCardPaymentMethod = {
1213
+ type: 'CARD',
1214
+ parameters: {
1215
+ allowedAuthMethods: allowedCardAuthMethods,
1216
+ allowedCardNetworks: allowedCardNetworks
1217
+ }
1218
+ };
1219
+ /**
1220
+ * Populate the WC checkout fields.
1221
+ * @param {[type]}
1222
+ * @return {[type]}
1223
+ */
1224
+
1225
+ wc_stripe.GooglePay.prototype.update_addresses = function (paymentData) {
1226
+ this.populate_billing_fields(paymentData.paymentMethodData.info.billingAddress);
1227
+
1228
+ if (paymentData.shippingAddress) {
1229
+ this.populate_shipping_fields(paymentData.shippingAddress);
1230
+ }
1231
+
1232
+ if (paymentData.email) {
1233
+ this.fields.set('email', paymentData.email, 'billing');
1234
+ }
1235
+ };
1236
+ /**
1237
+ * @param {[type]}
1238
+ * @return {[type]}
1239
+ */
1240
+
1241
+
1242
+ wc_stripe.GooglePay.prototype.map_address = function (address) {
1243
+ return {
1244
+ city: address.locality,
1245
+ postcode: address.postalCode,
1246
+ state: address.administrativeArea,
1247
+ country: address.countryCode
1248
+ };
1249
+ };
1250
+ /**
1251
+ * @param {[type]}
1252
+ * @return {[type]}
1253
+ */
1254
+
1255
+
1256
+ wc_stripe.GooglePay.prototype.update_payment_data = function (data) {
1257
+ return new Promise(function (resolve, reject) {
1258
+ var shipping_method = data.shippingOptionData.id == 'default' ? null : data.shippingOptionData.id;
1259
+ $.when($.ajax({
1260
+ url: this.params.routes.payment_data,
1261
+ dataType: 'json',
1262
+ method: 'POST',
1263
+ data: {
1264
+ shipping_address: this.map_address(data.shippingAddress),
1265
+ shipping_method: shipping_method,
1266
+ page_id: this.get_page()
1267
+ },
1268
+ beforeSend: this.ajax_before_send.bind(this)
1269
+ })).done(function (response) {
1270
+ if (response.code) {
1271
+ reject(response.data.data);
1272
+ } else {
1273
+ resolve(response.data);
1274
+ }
1275
+ }.bind(this)).fail(function () {
1276
+ reject();
1277
+ }.bind(this));
1278
+ }.bind(this));
1279
+ };
1280
+ /**
1281
+ * @param {[type]}
1282
+ * @return {[type]}
1283
+ */
1284
+
1285
+
1286
+ wc_stripe.GooglePay.prototype.on_payment_data_changed = function (address) {
1287
+ return new Promise(function (resolve) {
1288
+ this.update_payment_data(address).then(function (response) {
1289
+ resolve(response.paymentRequestUpdate);
1290
+ this.set_selected_shipping_methods(response.shipping_methods);
1291
+ this.payment_data_updated(response, address);
1292
+ }.bind(this))['catch'](function (data) {
1293
+ resolve(data);
1294
+ }.bind(this));
1295
+ }.bind(this));
1296
+ };
1297
+ /**
1298
+ * Convenience method so that gateway can perform actions after the payment data
1299
+ * has been updated.
1300
+ * @param {[type]}
1301
+ * @return {[type]}
1302
+ */
1303
+
1304
+
1305
+ wc_stripe.GooglePay.prototype.payment_data_updated = function (response) {
1306
+ };
1307
+ /**
1308
+ * @return {[type]}
1309
+ */
1310
+
1311
+
1312
+ wc_stripe.GooglePay.prototype.get_merchant_info = function () {
1313
+ var options = {
1314
+ merchantId: this.params.merchant_id,
1315
+ merchantName: this.params.merchant_name
1316
+ };
1317
+
1318
+ if (this.params.environment === 'TEST') {
1319
+ delete options.merchantId;
1320
+ }
1321
+
1322
+ return options;
1323
+ };
1324
+ /**
1325
+ * @return {[type]}
1326
+ */
1327
+
1328
+
1329
+ wc_stripe.GooglePay.prototype.get_payment_options = function () {
1330
+ var options = {
1331
+ environment: this.params.environment,
1332
+ merchantInfo: this.get_merchant_info()
1333
+ };
1334
+
1335
+ if (this.needs_shipping()) {
1336
+ options.paymentDataCallbacks = {
1337
+ onPaymentDataChanged: this.on_payment_data_changed.bind(this),
1338
+ onPaymentAuthorized: function (data) {
1339
+ return new Promise(function (resolve, reject) {
1340
+ resolve({
1341
+ transactionState: "SUCCESS"
1342
+ });
1343
+ }.bind(this));
1344
+ }.bind(this)
1345
+ };
1346
+ } else {
1347
+ options.paymentDataCallbacks = {
1348
+ onPaymentAuthorized: function onPaymentAuthorized(data) {
1349
+ return new Promise(function (resolve, reject) {
1350
+ resolve({
1351
+ transactionState: "SUCCESS"
1352
+ });
1353
+ }.bind(this));
1354
+ }
1355
+ };
1356
+ }
1357
+
1358
+ return options;
1359
+ };
1360
+ /**
1361
+ * @return {[type]}
1362
+ */
1363
+
1364
+
1365
+ wc_stripe.GooglePay.prototype.build_payment_request = function () {
1366
+ var request = $.extend({}, googlePayBaseRequest, {
1367
+ emailRequired: function () {
1368
+ if ('checkout' === this.get_page()) {
1369
+ return this.fields.required('billing_email') && this.fields.isEmpty('billing_email');
1370
+ } else if ('order_pay' === this.get_page()) {
1371
+ return false;
1372
+ }
1373
+
1374
+ return this.fields.required('billing_email');
1375
+ }.bind(this)(),
1376
+ merchantInfo: this.get_merchant_info(),
1377
+ allowedPaymentMethods: [$.extend({
1378
+ type: "CARD",
1379
+ tokenizationSpecification: {
1380
+ type: "PAYMENT_GATEWAY",
1381
+ parameters: {
1382
+ gateway: 'stripe',
1383
+ "stripe:version": "2018-10-31",
1384
+ "stripe:publishableKey": this.params.api_key
1385
+ }
1386
+ }
1387
+ }, baseCardPaymentMethod)],
1388
+ shippingAddressRequired: this.needs_shipping(),
1389
+ transactionInfo: {
1390
+ currencyCode: this.get_currency(),
1391
+ totalPriceStatus: "ESTIMATED",
1392
+ totalPrice: this.get_total_price().toString(),
1393
+ displayItems: this.get_display_items(),
1394
+ totalPriceLabel: this.params.total_price_label
1395
+ }
1396
+ });
1397
+ request.allowedPaymentMethods[0].parameters['billingAddressRequired'] = true;
1398
+ request.allowedPaymentMethods[0].parameters['billingAddressParameters'] = {
1399
+ format: "FULL",
1400
+ phoneNumberRequired: function () {
1401
+ if ('checkout' === this.get_page()) {
1402
+ return this.fields.required('billing_phone') && this.fields.isEmpty('billing_phone');
1403
+ } else if ('order_pay' === this.get_page()) {
1404
+ return false;
1405
+ }
1406
+
1407
+ return this.fields.required('billing_phone');
1408
+ }.bind(this)()
1409
+ };
1410
+
1411
+ if (this.needs_shipping()) {
1412
+ request['shippingAddressParameters'] = {};
1413
+ request['shippingOptionRequired'] = true;
1414
+ request['shippingOptionParameters'] = {
1415
+ shippingOptions: this.get_shipping_options()
1416
+ };
1417
+ request['callbackIntents'] = ["SHIPPING_ADDRESS", "SHIPPING_OPTION", "PAYMENT_AUTHORIZATION"];
1418
+ } else {
1419
+ request['callbackIntents'] = ["PAYMENT_AUTHORIZATION"];
1420
+ }
1421
+
1422
+ return request;
1423
+ };
1424
+ /**
1425
+ * @return {[type]}
1426
+ */
1427
+
1428
+
1429
+ wc_stripe.GooglePay.prototype.createPaymentsClient = function () {
1430
+ this.paymentsClient = new google.payments.api.PaymentsClient(this.get_payment_options());
1431
+ };
1432
+ /**
1433
+ * @return {Promise}
1434
+ */
1435
+
1436
+
1437
+ wc_stripe.GooglePay.prototype.isReadyToPay = function () {
1438
+ return new Promise(function (resolve) {
1439
+ var isReadyToPayRequest = $.extend({}, googlePayBaseRequest);
1440
+ isReadyToPayRequest.allowedPaymentMethods = [baseCardPaymentMethod];
1441
+ this.paymentsClient.isReadyToPay(isReadyToPayRequest).then(function () {
1442
+ this.can_pay = true;
1443
+ this.create_button();
1444
+ resolve();
1445
+ }.bind(this))["catch"](function (err) {
1446
+ this.submit_error(err);
1447
+ }.bind(this));
1448
+ }.bind(this));
1449
+ };
1450
+
1451
+ wc_stripe.GooglePay.prototype.create_button = function () {
1452
+ if (this.$button) {
1453
+ this.$button.remove();
1454
+ }
1455
+
1456
+ this.$button = $(this.paymentsClient.createButton({
1457
+ onClick: this.start.bind(this),
1458
+ buttonColor: this.params.button_color,
1459
+ buttonType: this.params.button_style
1460
+ }));
1461
+ this.$button.addClass('gpay-button-container');
1462
+ };
1463
+ /**
1464
+ * @return {[type]}
1465
+ */
1466
+
1467
+
1468
+ wc_stripe.GooglePay.prototype.start = function () {
1469
+ // always recreate the paymentClient to ensure latest data is used.
1470
+ this.createPaymentsClient();
1471
+ this.paymentsClient.loadPaymentData(this.build_payment_request()).then(function (paymentData) {
1472
+ var data = JSON.parse(paymentData.paymentMethodData.tokenizationData.token);
1473
+ this.update_addresses(paymentData);
1474
+ this.on_token_received(data);
1475
+ }.bind(this))["catch"](function (err) {
1476
+ if (err.statusCode === "CANCELED") {
1477
+ return;
1478
+ }
1479
+
1480
+ if (err.statusMessage && err.statusMessage.indexOf("paymentDataRequest.callbackIntent") > -1) {
1481
+ this.submit_error_code("DEVELOPER_ERROR_WHITELIST");
1482
+ } else {
1483
+ this.submit_error(err.statusMessage);
1484
+ }
1485
+ }.bind(this));
1486
+ };
1487
+
1488
+ wc_stripe.ApplePay = function () {
1489
+ };
1490
+
1491
+ wc_stripe.ApplePay.prototype.initialize = function () {
1492
+ var selector = '.apple-pay-button';
1493
+
1494
+ if (['checkout', 'order_pay'].indexOf(this.get_page()) < 0) {
1495
+ selector = this.container + ' .apple-pay-button';
1496
+ }
1497
+
1498
+ $(document.body).on('click', selector, this.start.bind(this));
1499
+ this.createPaymentRequest();
1500
+ this.canMakePayment();
1501
+ };
1502
+
1503
+ wc_stripe.ApplePay.prototype.create_button = function () {
1504
+ if (this.$button) {
1505
+ this.$button.remove();
1506
+ }
1507
+
1508
+ this.$button = $(this.params.button);
1509
+ this.append_button();
1510
+ };
1511
+
1512
+ wc_stripe.ApplePay.prototype.canMakePayment = function () {
1513
+ return new Promise(function (resolve) {
1514
+ this.paymentRequest.canMakePayment().then(function (result) {
1515
+ if (result && result.applePay) {
1516
+ this.can_pay = true;
1517
+ this.create_button();
1518
+ $(this.container).show();
1519
+ resolve(result);
1520
+ }
1521
+ }.bind(this));
1522
+ }.bind(this));
1523
+ };
1524
+
1525
+ wc_stripe.ApplePay.prototype.start = function (e) {
1526
+ e.preventDefault();
1527
+ this.paymentRequest.update(this.get_payment_request_update({
1528
+ total: {
1529
+ pending: false
1530
+ }
1531
+ }));
1532
+ this.paymentRequest.show();
1533
+ };
1534
+
1535
+ /*********** PaymentRequest *********/
1536
+ wc_stripe.PaymentRequest = function () {
1537
+ };
1538
+
1539
+ wc_stripe.PaymentRequest.prototype.initialize = function () {
1540
+ this.createPaymentRequest();
1541
+ this.canMakePayment();
1542
+ this.createPaymentRequestButton();
1543
+ this.paymentRequestButton.on('click', this.button_click.bind(this));
1544
+ };
1545
+
1546
+ wc_stripe.PaymentRequest.prototype.button_click = function (event) {
1547
+ };
1548
+
1549
+ wc_stripe.PaymentRequest.prototype.createPaymentRequestButton = function () {
1550
+ this.paymentRequestButton = this.elements.create("paymentRequestButton", {
1551
+ paymentRequest: this.paymentRequest,
1552
+ style: {
1553
+ paymentRequestButton: {
1554
+ type: this.params.button.type,
1555
+ theme: this.params.button.theme,
1556
+ height: this.params.button.height
1557
+ }
1558
+ }
1559
+ });
1560
+ };
1561
+
1562
+ wc_stripe.PaymentRequest.prototype.canMakePayment = function () {
1563
+ return new Promise(function (resolve) {
1564
+ this.paymentRequest.canMakePayment().then(function (result) {
1565
+ if (result && !result.applePay) {
1566
+ this.can_pay = true;
1567
+ this.create_button();
1568
+ $(this.container).show();
1569
+ resolve(result);
1570
+ }
1571
+ }.bind(this));
1572
+ }.bind(this));
1573
+ };
1574
+
1575
+ wc_stripe.PaymentRequest.prototype.create_button = function () {
1576
+ this.paymentRequestButton.mount('#wc-stripe-payment-request-container');
1577
+ };
1578
+
1579
+ wc_stripe.CheckoutFields = function (params, page) {
1580
+ this.params = params;
1581
+ this.page = page;
1582
+ this.fields = new Map(Object.keys(this.params).map(function (k) {
1583
+ return [k, this.params[k].value];
1584
+ }.bind(this)));
1585
+
1586
+ if ('checkout' === page) {
1587
+ $('form.checkout').on('change', '.input-text, select', this.onChange.bind(this));
1588
+ $('form.checkout').on('change', '[name="ship_to_different_address"]', this.on_ship_to_address_change.bind(this));
1589
+ this.init_i18n();
1590
+ }
1591
+ };
1592
+
1593
+ wc_stripe.CheckoutFields.prototype.init_i18n = function () {
1594
+ if (typeof wc_address_i18n_params !== 'undefined') {
1595
+ this.locales = $.parseJSON(wc_address_i18n_params.locale.replace(/&quot;/g, '"'));
1596
+ } else {
1597
+ this.locales = null;
1598
+ }
1599
+ };
1600
+
1601
+ wc_stripe.CheckoutFields.prototype.onChange = function (e) {
1602
+ try {
1603
+ var name = e.currentTarget.name,
1604
+ value = e.currentTarget.value;
1605
+ this.fields.set(name, value);
1606
+
1607
+ if (name === 'billing_country' || name === 'shipping_country') {
1608
+ this.update_required_fields(value, name);
1609
+ }
1610
+ } catch (err) {
1611
+ console.log(err);
1612
+ }
1613
+ };
1614
+
1615
+ wc_stripe.CheckoutFields.prototype.update_required_fields = function (country, name) {
1616
+ if (this.locales) {
1617
+ var prefix = name.indexOf('billing_') > -1 ? 'billing_' : 'shipping_';
1618
+ var locale = typeof this.locales[country] !== 'undefined' ? this.locales[country] : this.locales['default'];
1619
+ var fields = $.extend(true, {}, this.locales['default'], locale);
1620
+
1621
+ for (var k in fields) {
1622
+ var k2 = prefix + k;
1623
+
1624
+ if (this.params[k2]) {
1625
+ this.params[k2] = $.extend(true, {}, this.params[k2], fields[k]);
1626
+ }
1627
+ }
1628
+ }
1629
+ };
1630
+
1631
+ wc_stripe.CheckoutFields.prototype.on_ship_to_address_change = function (e) {
1632
+ if ($(e.currentTarget).is(':checked')) {
1633
+ this.update_required_fields($('shipping_country'), 'shipping_country');
1634
+ }
1635
+ };
1636
+
1637
+ wc_stripe.CheckoutFields.prototype.requestFieldInWallet = function (key) {
1638
+ if ('checkout' === this.page) {
1639
+ return this.required(key) && this.isEmpty(key);
1640
+ } else if ('order_pay' === this.page) {
1641
+ return false;
1642
+ }
1643
+
1644
+ return this.required(key);
1645
+ };
1646
+
1647
+ wc_stripe.CheckoutFields.prototype.set = function (k, v, prefix) {
1648
+ if (this[k] && typeof this[k] === 'function') {
1649
+ this[k]().set.call(this, v, prefix);
1650
+ } else {
1651
+ this.fields.set(k, v);
1652
+ }
1653
+ };
1654
+
1655
+ wc_stripe.CheckoutFields.prototype.get = function (k, prefix) {
1656
+ if (this[k] && typeof this[k] === 'function') {
1657
+ var value = this[k]().get.call(this, prefix);
1658
+ } else {
1659
+ var value = this.fields.get(k);
1660
+
1661
+ if (typeof value === 'undefined' || value === null || value === '') {
1662
+ if (typeof prefix !== 'undefined') {
1663
+ value = prefix;
1664
+ }
1665
+ }
1666
+ }
1667
+
1668
+ return typeof value === 'undefined' ? '' : value;
1669
+ };
1670
+ /**
1671
+ * Return true if the field is required
1672
+ * @param k
1673
+ * @returns boolean
1674
+ */
1675
+
1676
+
1677
+ wc_stripe.CheckoutFields.prototype.required = function (k) {
1678
+ if (this.params[k]) {
1679
+ if (typeof this.params[k].required !== 'undefined') {
1680
+ return this.params[k].required;
1681
+ }
1682
+ }
1683
+
1684
+ return false;
1685
+ };
1686
+
1687
+ wc_stripe.CheckoutFields.prototype.isEmpty = function (k) {
1688
+ if (this.fields.has(k)) {
1689
+ var value = this.fields.get(k);
1690
+ return typeof value === 'undefined' || value === null || typeof value === 'string' && value.trim().length === 0;
1691
+ }
1692
+
1693
+ return true;
1694
+ };
1695
+
1696
+ wc_stripe.CheckoutFields.prototype.name = function () {
1697
+ return {
1698
+ set: function set(v, prefix) {
1699
+ var name = v.split(" ");
1700
+ this.fields.set(prefix + '_first_name', name[0]);
1701
+ this.fields.set(prefix + '_last_name', name[1]);
1702
+ },
1703
+ get: function get(prefix) {
1704
+ return this.fields.get(prefix + '_first_name') + ' ' + this.fields.get(prefix + '_last_name');
1705
+ }
1706
+ };
1707
+ };
1708
+
1709
+ wc_stripe.CheckoutFields.prototype.payerName = function () {
1710
+ return wc_stripe.CheckoutFields.prototype.name.apply(this, arguments);
1711
+ };
1712
+
1713
+ wc_stripe.CheckoutFields.prototype.email = function () {
1714
+ return {
1715
+ set: function set(v, prefix) {
1716
+ this.fields.set(prefix + '_email', v);
1717
+ },
1718
+ get: function get(prefix) {
1719
+ return this.fields.get(prefix + '_email');
1720
+ }
1721
+ };
1722
+ };
1723
+
1724
+ wc_stripe.CheckoutFields.prototype.payerEmail = function () {
1725
+ return wc_stripe.CheckoutFields.prototype.email.apply(this, arguments);
1726
+ };
1727
+
1728
+ wc_stripe.CheckoutFields.prototype.phone = function () {
1729
+ return {
1730
+ set: function set(v, prefix) {
1731
+ this.fields.set(prefix + '_phone', v);
1732
+ },
1733
+ get: function get(prefix) {
1734
+ return this.fields.get(prefix + '_phone');
1735
+ }
1736
+ };
1737
+ };
1738
+
1739
+ wc_stripe.CheckoutFields.prototype.payerPhone = function () {
1740
+ return wc_stripe.CheckoutFields.prototype.phone.apply(this, arguments);
1741
+ };
1742
+
1743
+ wc_stripe.CheckoutFields.prototype.phoneNumber = function () {
1744
+ return wc_stripe.CheckoutFields.prototype.phone.apply(this, arguments);
1745
+ };
1746
+
1747
+ wc_stripe.CheckoutFields.prototype.recipient = function () {
1748
+ return {
1749
+ set: function set(v, prefix) {
1750
+ var name = v.split(" ");
1751
+
1752
+ if (name.length > 0) {
1753
+ this.fields.set(prefix + '_first_name', name[0]);
1754
+ }
1755
+
1756
+ if (name.length > 1) {
1757
+ this.fields.set(prefix + '_last_name', name[1]);
1758
+ }
1759
+ },
1760
+ get: function get(prefix) {
1761
+ return this.fields.get(prefix + '_first_name') + ' ' + this.fields.get(prefix + '_last_name');
1762
+ }
1763
+ };
1764
+ };
1765
+
1766
+ wc_stripe.CheckoutFields.prototype.country = function () {
1767
+ return {
1768
+ set: function set(v, prefix) {
1769
+ this.fields.set(prefix + '_country', v);
1770
+ },
1771
+ get: function get(prefix) {
1772
+ return this.fields.get(prefix + '_country');
1773
+ }
1774
+ };
1775
+ };
1776
+
1777
+ wc_stripe.CheckoutFields.prototype.countryCode = function () {
1778
+ return wc_stripe.CheckoutFields.prototype.country.apply(this, arguments);
1779
+ };
1780
+
1781
+ wc_stripe.CheckoutFields.prototype.address1 = function () {
1782
+ return {
1783
+ set: function set(v, prefix) {
1784
+ this.fields.set(prefix + '_address_1', v);
1785
+ },
1786
+ get: function get(prefix) {
1787
+ return this.fields.get(prefix + '_address_1');
1788
+ }
1789
+ };
1790
+ };
1791
+
1792
+ wc_stripe.CheckoutFields.prototype.address2 = function () {
1793
+ return {
1794
+ set: function set(v, prefix) {
1795
+ this.fields.set(prefix + '_address_2', v);
1796
+ },
1797
+ get: function get(prefix) {
1798
+ this.fields.get(prefix + '_address_2');
1799
+ }
1800
+ };
1801
+ };
1802
+
1803
+ wc_stripe.CheckoutFields.prototype.line1 = function () {
1804
+ return wc_stripe.CheckoutFields.prototype.address1.apply(this, arguments);
1805
+ };
1806
+
1807
+ wc_stripe.CheckoutFields.prototype.line2 = function () {
1808
+ return wc_stripe.CheckoutFields.prototype.address2.apply(this, arguments);
1809
+ };
1810
+
1811
+ wc_stripe.CheckoutFields.prototype.addressLine = function () {
1812
+ return {
1813
+ set: function set(v, prefix) {
1814
+ if (v.length > 0) {
1815
+ this.fields.set(prefix + '_address_1', v[0]);
1816
+ }
1817
+
1818
+ if (v.length > 1) {
1819
+ this.fields.set(prefix + '_address_2', v[1]);
1820
+ }
1821
+ },
1822
+ get: function get(prefix) {
1823
+ return [this.fields.get(prefix + '_address_1'), this.fields.get(prefix + '_address_2')];
1824
+ }
1825
+ };
1826
+ };
1827
+
1828
+ wc_stripe.CheckoutFields.prototype.state = function () {
1829
+ return {
1830
+ set: function set(v, prefix) {
1831
+ v = v.toUpperCase();
1832
+ if (v.length > 2 && this.page === 'checkout') {
1833
+ $('#' + prefix + '_state option').each(function () {
1834
+ var $option = $(this);
1835
+ var state = $option.text().toUpperCase();
1836
+ if (v === state) {
1837
+ v = $option.val();
1838
+ }
1839
+ });
1840
+ }
1841
+ this.fields.set(prefix + '_state', v);
1842
+ },
1843
+ get: function get(prefix) {
1844
+ return this.fields.get(prefix + '_state');
1845
+ }
1846
+ };
1847
+ };
1848
+
1849
+ wc_stripe.CheckoutFields.prototype.region = function () {
1850
+ return wc_stripe.CheckoutFields.prototype.state.apply(this, arguments);
1851
+ };
1852
+
1853
+ wc_stripe.CheckoutFields.prototype.administrativeArea = function () {
1854
+ return wc_stripe.CheckoutFields.prototype.state.apply(this, arguments);
1855
+ };
1856
+
1857
+ wc_stripe.CheckoutFields.prototype.city = function () {
1858
+ return {
1859
+ set: function set(v, prefix) {
1860
+ this.fields.set(prefix + '_city', v);
1861
+ },
1862
+ get: function get(prefix) {
1863
+ this.fields.get(prefix + '_city');
1864
+ }
1865
+ };
1866
+ };
1867
+
1868
+ wc_stripe.CheckoutFields.prototype.locality = function () {
1869
+ return wc_stripe.CheckoutFields.prototype.city.apply(this, arguments);
1870
+ };
1871
+
1872
+ wc_stripe.CheckoutFields.prototype.postcode = function () {
1873
+ return {
1874
+ set: function set(v, prefix) {
1875
+ this.fields.set(prefix + '_postcode', v);
1876
+ },
1877
+ get: function get(prefix) {
1878
+ this.fields.get(prefix + '_postcode');
1879
+ }
1880
+ };
1881
+ };
1882
+
1883
+ wc_stripe.CheckoutFields.prototype.postal_code = function () {
1884
+ return wc_stripe.CheckoutFields.prototype.postcode.apply(this, arguments);
1885
+ }
1886
+
1887
+ wc_stripe.CheckoutFields.prototype.postalCode = function () {
1888
+ return wc_stripe.CheckoutFields.prototype.postcode.apply(this, arguments);
1889
+ };
1890
+ /**
1891
+ * Serialize the fields into an expected format
1892
+ */
1893
+
1894
+
1895
+ wc_stripe.CheckoutFields.prototype.toJson = function () {
1896
+ var data = {};
1897
+ this.fields.forEach(function (value, key) {
1898
+ data[key] = value;
1899
+ });
1900
+ return data;
1901
+ };
1902
+
1903
+ wc_stripe.CheckoutFields.prototype.toFormFields = function (args) {
1904
+ var changes = [];
1905
+ this.fields.forEach(function (value, key) {
1906
+ var name = '[name="' + key + '"]';
1907
+
1908
+ if ($(name).length && value !== '') {
1909
+ if ($(name).val() !== value && $(name).is('select')) {
1910
+ changes.push(name);
1911
+ }
1912
+
1913
+ $(name).val(value);
1914
+ }
1915
+ });
1916
+ if (changes.length > 0) {
1917
+ $(changes.join(',')).trigger('change');
1918
+ }
1919
+ if (typeof args !== 'undefined') {
1920
+ $(document.body).trigger('update_checkout', args);
1921
+ }
1922
+ };
1923
+
1924
+ try {
1925
+ stripe = Stripe(wc_stripe_params_v3.api_key, {
1926
+ stripeAccount: wc_stripe_params_v3.account
1927
+ });
1928
+ } catch (error) {
1929
+ window.alert(error);
1930
+ console.log(error);
1931
+ return;
1932
+ }
1933
+
1934
+ var checkoutFields = new wc_stripe.CheckoutFields(wc_stripe_checkout_fields, wc_stripe_params_v3.page);
1935
+ })(window, jQuery);
assets/js/frontend/wc-stripe.min.js CHANGED
@@ -1 +1,5 @@
1
- !function(t,e){t.wc_stripe={};var i=null;"undefined"==typeof wc_stripe_checkout_fields&&(wc_stripe_checkout_fields=[]),wc_stripe.BaseGateway=function(t){this.params=t,this.gateway_id=this.params.gateway_id,this.container="li.payment_method_"+this.gateway_id,this.token_selector=this.params.token_selector,this.saved_method_selector=this.params.saved_method_selector,this.payment_token_received=!1,this.stripe=i,this.elements=i.elements(e.extend({},{locale:"auto"},this.get_element_options())),this.fields=o,this.initialize()},wc_stripe.BaseGateway.prototype.get_page=function(){return wc_stripe_params_v3.page},wc_stripe.BaseGateway.prototype.set_nonce=function(t){this.fields.set(this.gateway_id+"_token_key",t),e(this.token_selector).val(t)},wc_stripe.BaseGateway.prototype.get_element_options=function(){return{}},wc_stripe.BaseGateway.prototype.initialize=function(){},wc_stripe.BaseGateway.prototype.create_button=function(){},wc_stripe.BaseGateway.prototype.is_gateway_selected=function(){return e('[name="payment_method"]:checked').val()===this.gateway_id},wc_stripe.BaseGateway.prototype.is_saved_method_selected=function(){return this.is_gateway_selected()&&"saved"===e('[name="'+this.gateway_id+'_payment_type_key"]:checked').val()},wc_stripe.BaseGateway.prototype.has_checkout_error=function(){return e("#wc_stripe_checkout_error").length>0&&this.is_gateway_selected()},wc_stripe.BaseGateway.prototype.submit_error=function(t){-1==(t=this.get_error_message(t)).indexOf("</ul>")&&(t='<div class="woocommerce-error">'+t+"</div>"),this.submit_message(t)},wc_stripe.BaseGateway.prototype.submit_error_code=function(t){},wc_stripe.BaseGateway.prototype.get_error_message=function(t){return"object"==typeof t&&t.code&&(t=wc_stripe_messages[t.code]?wc_stripe_messages[t.code]:t.message),t},wc_stripe.BaseGateway.prototype.submit_message=function(t){e(".woocommerce-error, .woocommerce-message, .woocommerce-info").remove();var i=e(this.message_container);i.closest("form").length&&(i=i.closest("form")),i.prepend(t),i.removeClass("processing").unblock(),i.find(".input-text, select, input:checkbox").blur(),e.scroll_to_notices?e.scroll_to_notices(i):e("html, body").animate({scrollTop:i.offset().top-100},1e3)},wc_stripe.BaseGateway.prototype.get_first_name=function(t){return e("#"+t+"_first_name").val()},wc_stripe.BaseGateway.prototype.get_last_name=function(t){return e("#"+t+"_last_name").val()},wc_stripe.BaseGateway.prototype.should_save_method=function(){return e("#"+this.gateway_id+"_save_source_key").is(":checked")},wc_stripe.BaseGateway.prototype.is_add_payment_method_page=function(){return"add_payment_method"===this.get_page()||e(document.body).hasClass("woocommerce-add-payment-method")},wc_stripe.BaseGateway.prototype.is_change_payment_method=function(){return"change_payment_method"===this.get_page()},wc_stripe.BaseGateway.prototype.get_selected_payment_method=function(){return e(this.saved_method_selector).val()},wc_stripe.BaseGateway.prototype.needs_shipping=function(){return this.get_gateway_data().needs_shipping},wc_stripe.BaseGateway.prototype.get_currency=function(){return this.get_gateway_data().currency},wc_stripe.BaseGateway.prototype.get_gateway_data=function(){return e("#"+this.gateway_id+"_"+this.get_page()+"_data").data("gateway")},wc_stripe.BaseGateway.prototype.set_gateway_data=function(t){e("#"+this.gateway_id+"_"+this.get_page()+"_data").data("gateway",t)},wc_stripe.BaseGateway.prototype.get_customer_name=function(t){return this.fields.get(t+"_first_name")+" "+this.fields.get(t+"_last_name")},wc_stripe.BaseGateway.prototype.get_customer_email=function(){return this.fields.get("billing_email")},wc_stripe.BaseGateway.prototype.get_address_field_hash=function(t){for(var e=["_first_name","_last_name","_address_1","_address_2","_postcode","_city","_state","_country"],i="",s=0;s<e.length;s++)i+=this.fields.get(t+e[s])+"_";return i},wc_stripe.BaseGateway.prototype.block=function(){e.blockUI({message:null,overlayCSS:{background:"#fff",opacity:.6}})},wc_stripe.BaseGateway.prototype.unblock=function(){e.unblockUI()},wc_stripe.BaseGateway.prototype.get_form=function(){return e(this.token_selector).closest("form")},wc_stripe.BaseGateway.prototype.get_total_price=function(){return this.get_gateway_data().total},wc_stripe.BaseGateway.prototype.get_total_price_cents=function(){return this.get_gateway_data().total_cents},wc_stripe.BaseGateway.prototype.set_total_price=function(t){var e=this.get_gateway_data();e.total=t,this.set_gateway_data(e)},wc_stripe.BaseGateway.prototype.set_total_price_cents=function(t){var e=this.get_gateway_data();e.total_cents=t,this.set_gateway_data(e)},wc_stripe.BaseGateway.prototype.set_payment_method=function(t){e('[name="payment_method"][value="'+t+'"]').prop("checked",!0).trigger("click")},wc_stripe.BaseGateway.prototype.set_selected_shipping_methods=function(t){if(t&&e('[name^="shipping_method"]').length)for(var i in t){var s=t[i];e('[name="shipping_method['+i+']"][value="'+s+'"]').prop("checked",!0).trigger("change")}},wc_stripe.BaseGateway.prototype.on_token_received=function(t){this.payment_token_received=!0,this.set_nonce(t.id),this.process_checkout()},wc_stripe.BaseGateway.prototype.createPaymentRequest=function(){try{this.paymentRequest=i.paymentRequest(this.get_payment_request_options())}catch(t){return void this.submit_error(t.message)}this.needs_shipping()&&(this.paymentRequest.on("shippingaddresschange",this.update_shipping_address.bind(this)),this.paymentRequest.on("shippingoptionchange",this.update_shipping_method.bind(this))),this.paymentRequest.on("paymentmethod",this.on_payment_method_received.bind(this))},wc_stripe.BaseGateway.prototype.get_payment_request_options=function(){var t={country:this.params.country_code,currency:this.get_currency().toLowerCase(),total:{amount:this.get_total_price_cents(),label:this.params.total_label,pending:!0},requestPayerName:!0,requestPayerEmail:this.fields.required("billing_email"),requestPayerPhone:this.fields.required("billing_phone"),requestShipping:this.needs_shipping()},e=this.get_display_items(),i=this.get_shipping_options();return e&&(t.displayItems=e),this.needs_shipping()&&i&&(t.shippingOptions=i),t},wc_stripe.BaseGateway.prototype.get_payment_request_update=function(t){var i={currency:this.get_currency().toLowerCase(),total:{amount:parseInt(this.get_total_price_cents()),label:this.params.total_label,pending:!0}},s=this.get_display_items(),a=this.get_shipping_options();return s&&(i.displayItems=s),this.needs_shipping()&&a&&(i.shippingOptions=a),t&&(i=e.extend(!0,{},i,t)),i},wc_stripe.BaseGateway.prototype.get_display_items=function(){return this.get_gateway_data().items},wc_stripe.BaseGateway.prototype.set_display_items=function(t){var e=this.get_gateway_data();e.items=t,this.set_gateway_data(e)},wc_stripe.BaseGateway.prototype.get_shipping_options=function(){return this.get_gateway_data().shipping_options},wc_stripe.BaseGateway.prototype.set_shipping_options=function(t){var e=this.get_gateway_data();e.shipping_options=t,this.set_gateway_data(e)},wc_stripe.BaseGateway.prototype.map_address=function(t){return{city:t.city,postcode:t.postalCode,state:t.region,country:t.country}},wc_stripe.BaseGateway.prototype.on_payment_method_received=function(e){try{this.payment_response=e,this.populate_checkout_fields(e),e.complete("success"),this.on_token_received(e.paymentMethod)}catch(e){t.alert(e)}},wc_stripe.BaseGateway.prototype.populate_checkout_fields=function(t){this.set_nonce(t.paymentMethod.id),this.populate_address_fields(t)},wc_stripe.BaseGateway.prototype.populate_address_fields=function(t){if(t.payerName&&this.fields.set("name",t.payerName,"billing"),t.payerEmail&&this.fields.set("email",t.payerEmail,"billing"),t.payerPhone&&this.fields.set("phone",t.payerPhone,"billing"),t.shippingAddress){var i=t.shippingAddress;for(var s in i)this.fields.set(s,i[s],"shipping")}if(t.paymentMethod.billing_details.address){i=t.paymentMethod.billing_details.address;for(var s in i)this.fields.set(s,i[s],"billing")}"checkout"===this.get_page()&&(this.maybe_set_ship_to_different(),this.fields.toFormFields(),e('[name="billing_country"]').trigger("change"))},wc_stripe.BaseGateway.prototype.address_mappings=function(){return new wc_stripe.CheckoutFields},wc_stripe.BaseGateway.prototype.ajax_before_send=function(t){this.params.user_id>0&&t.setRequestHeader("X-WP-Nonce",this.params.rest_nonce)},wc_stripe.BaseGateway.prototype.process_checkout=function(){return new Promise(function(i,s){this.block(),e.ajax({url:this.params.routes.checkout,method:"POST",dataType:"json",data:e.extend({},this.serialize_fields(),{payment_method:this.gateway_id,page_id:this.get_page()}),beforeSend:this.ajax_before_send.bind(this)}).done(function(e){e.reload?t.location.reload():"success"===e.result?t.location=e.redirect:(e.messages&&this.submit_error(e.messages),this.unblock())}.bind(this)).fail(function(t,e,i){this.unblock(),this.submit_error(i)}.bind(this))}.bind(this))},wc_stripe.BaseGateway.prototype.serialize_form=function(t){var i=t.find("input").filter(function(t,i){return!e(i).is('[name^="add-to-cart"]')}.bind(this)).serializeArray(),s={};for(var a in i){var o=i[a];s[o.name]=o.value}return s.payment_method=this.gateway_id,s},wc_stripe.BaseGateway.prototype.serialize_fields=function(){return this.fields.toJson()},wc_stripe.BaseGateway.prototype.map_shipping_methods=function(t){var e={};if("default"!==t){var i=t.match(/^([\w+]):(.+)$/);i.length>1&&(e[i[1]]=i[2])}return e},wc_stripe.BaseGateway.prototype.maybe_set_ship_to_different=function(){e('[name="ship_to_different_address"]').length&&e('[name="ship_to_different_address"]').prop("checked",this.get_address_field_hash("billing")!==this.get_address_field_hash("shipping")).trigger("change")},wc_stripe.BaseGateway.prototype.update_shipping_address=function(t){return new Promise(function(i,s){e.ajax({url:this.params.routes.shipping_address,method:"POST",dataType:"json",data:{address:this.map_address(t.shippingAddress),payment_method:this.gateway_id,page_id:this.get_page()},beforeSend:this.ajax_before_send.bind(this)}).done(function(e){e.code?(t.updateWith(e.data.newData),s(e.data)):(t.updateWith(e.data.newData),i(e.data))}.bind(this)).fail(function(t,e,i){}.bind(this))}.bind(this))},wc_stripe.BaseGateway.prototype.update_shipping_method=function(t){return new Promise(function(i,s){e.ajax({url:this.params.routes.shipping_method,method:"POST",dataType:"json",data:{shipping_method:t.shippingOption.id,payment_method:this.gateway_id,page_id:this.get_page()},beforeSend:this.ajax_before_send.bind(this)}).done(function(e){e.code?(t.updateWith(e.data.newData),s(e.data)):(this.set_selected_shipping_methods(e.data.shipping_methods),t.updateWith(e.data.newData),i(e.data))}.bind(this)).fail(function(t,e,i){this.submit_error(i)}.bind(this))}.bind(this))},wc_stripe.CheckoutGateway=function(){this.message_container="li.payment_method_"+this.gateway_id,this.banner_container="li.banner_payment_method_"+this.gateway_id,e(document.body).on("update_checkout",this.update_checkout.bind(this)),e(document.body).on("updated_checkout",this.updated_checkout.bind(this)),e(document.body).on("cfw_updated_checkout",this.updated_checkout.bind(this)),e(document.body).on("checkout_error",this.checkout_error.bind(this)),e(this.token_selector).closest("form").on("checkout_place_order_"+this.gateway_id,this.checkout_place_order.bind(this)),e(document.body).on("wc_stripe_new_method_"+this.gateway_id,this.on_show_new_methods.bind(this)),e(document.body).on("wc_stripe_saved_method_"+this.gateway_id,this.on_show_saved_methods.bind(this)),e(document.body).on("wc_stripe_payment_method_selected",this.on_payment_method_selected.bind(this)),this.banner_enabled()&&e(".woocommerce-billing-fields").length&&e(".wc-stripe-banner-checkout").css("max-width",e(".woocommerce-billing-fields").outerWidth(!0)),this.order_review()},wc_stripe.CheckoutGateway.prototype.order_review=function(){var e=t.location.href.match(/order_review.+payment_method=([\w]+).+payment_nonce=(.+)/);if(e&&e.length>1){var i=e[1],s=e[2];this.gateway_id===i&&(this.payment_token_received=!0,this.set_nonce(s),this.set_use_new_option(!0))}},wc_stripe.CheckoutGateway.prototype.updated_checkout=function(){},wc_stripe.CheckoutGateway.prototype.update_checkout=function(){},wc_stripe.CheckoutGateway.prototype.checkout_error=function(){this.has_checkout_error()&&(this.payment_token_received=!1,this.payment_response=null,this.show_payment_button(),this.hide_place_order())},wc_stripe.CheckoutGateway.prototype.is_valid_checkout=function(){return!(e('[name="terms"]').length&&!e('[name="terms"]').is(":checked"))},wc_stripe.CheckoutGateway.prototype.get_payment_method=function(){return e('[name="payment_method"]:checked').val()},wc_stripe.CheckoutGateway.prototype.set_use_new_option=function(t){e("#"+this.gateway_id+"_use_new").prop("checked",t).trigger("change")},wc_stripe.CheckoutGateway.prototype.checkout_place_order=function(){return this.is_valid_checkout()?!!this.is_saved_method_selected()||this.payment_token_received:(this.submit_error(this.params.messages.terms),!1)},wc_stripe.CheckoutGateway.prototype.on_token_received=function(t){this.payment_token_received=!0,this.set_nonce(t.id),this.hide_payment_button(),this.show_place_order()},wc_stripe.CheckoutGateway.prototype.block=function(){e("form.checkout").block({message:null,overlayCSS:{background:"#fff",opacity:.6}})},wc_stripe.CheckoutGateway.prototype.unblock=function(){e("form.checkout").unblock()},wc_stripe.CheckoutGateway.prototype.hide_place_order=function(){e("#place_order").addClass("wc-stripe-hide")},wc_stripe.CheckoutGateway.prototype.show_place_order=function(){e("#place_order").removeClass("wc-stripe-hide")},wc_stripe.CheckoutGateway.prototype.on_show_new_methods=function(){this.payment_token_received?(this.show_place_order(),this.hide_payment_button()):(this.hide_place_order(),this.show_payment_button())},wc_stripe.CheckoutGateway.prototype.on_show_saved_methods=function(){this.hide_payment_button(),this.show_place_order()},wc_stripe.CheckoutGateway.prototype.show_payment_button=function(){this.$button&&this.$button.show()},wc_stripe.CheckoutGateway.prototype.hide_payment_button=function(){this.$button&&this.$button.hide()},wc_stripe.CheckoutGateway.prototype.trigger_payment_method_selected=function(){this.on_payment_method_selected(null,e('[name="payment_method"]:checked').val())},wc_stripe.CheckoutGateway.prototype.on_payment_method_selected=function(t,e){e===this.gateway_id?this.payment_token_received||this.is_saved_method_selected()?(this.hide_payment_button(),this.show_place_order()):(this.show_payment_button(),this.hide_place_order()):(this.hide_payment_button(),e.indexOf("stripe_")<0&&this.show_place_order())},wc_stripe.CheckoutGateway.prototype.banner_enabled=function(){return"1"===this.params.banner_enabled},wc_stripe.CheckoutGateway.prototype.checkout_fields_valid=function(){if("undefined"==typeof wc_stripe_checkout_fields||"checkout"!==this.get_page())return!0;function t(t,i){for(var s in i){var a=i[s];if(s.indexOf(t)>-1&&a.required&&e("#"+s).length){var o=e("#"+s).val();if(void 0===o||0==o.length)return void(valid=!1)}}}return valid=!0,t("billing",wc_stripe_checkout_fields),this.needs_shipping()&&e("#ship-to-different-address-checkbox").is(":checked")&&t("shipping",wc_stripe_checkout_fields),valid&&(valid=this.is_valid_checkout()),valid},wc_stripe.ProductGateway=function(){this.message_container="div.product",e("form.cart").on("found_variation",this.found_variation.bind(this)),e("form.cart").on("reset_data",this.reset_variation_data.bind(this)),this.buttonWidth=e("div.quantity").outerWidth(!0)+e(".single_add_to_cart_button").outerWidth();var t=e(".single_add_to_cart_button").css("marginLeft");t&&(this.buttonWidth+=parseInt(t.replace("px",""))),e(this.container).css("max-width",this.buttonWidth+"px")},wc_stripe.ProductGateway.prototype.get_quantity=function(){return parseInt(e('[name="quantity"]').val())},wc_stripe.ProductGateway.prototype.set_rest_nonce=function(t,e){this.params.rest_nonce=e},wc_stripe.ProductGateway.prototype.found_variation=function(t,e){var i=this.get_gateway_data();i.product.price=e.display_price,i.needs_shipping=!e.is_virtual,i.product.variation=e,this.set_gateway_data(i),this.enable_payment_button()},wc_stripe.ProductGateway.prototype.reset_variation_data=function(){var t=this.get_product_data();t.variation=!1,this.set_product_data(t),this.disable_payment_button()},wc_stripe.ProductGateway.prototype.disable_payment_button=function(){this.$button&&this.get_button().prop("disabled",!0).addClass("disabled")},wc_stripe.ProductGateway.prototype.enable_payment_button=function(){this.$button&&this.get_button().prop("disabled",!1).removeClass("disabled")},wc_stripe.ProductGateway.prototype.get_button=function(){return this.$button},wc_stripe.ProductGateway.prototype.is_variable_product=function(){return e('[name="variation_id"]').length>0},wc_stripe.ProductGateway.prototype.variable_product_selected=function(){return!1!==this.get_product_data().variation},wc_stripe.ProductGateway.prototype.get_product_data=function(){return this.get_gateway_data().product},wc_stripe.ProductGateway.prototype.set_product_data=function(t){var e=this.get_gateway_data();e.product=t,this.set_gateway_data(e)},wc_stripe.ProductGateway.prototype.add_to_cart=function(){return new Promise(function(t,i){this.block(),e.ajax({url:this.params.routes.add_to_cart,method:"POST",dataType:"json",data:{product_id:this.get_product_data().id,variation_id:this.is_variable_product()?e('[name="variation_id"]').val():0,qty:e('[name="quantity"]').val(),payment_method:this.gateway_id,page_id:this.get_page()},beforeSend:this.ajax_before_send.bind(this)}).done(function(e,s,a){this.unblock(),e.code?(this.submit_error(e.message),i(e)):(this.set_total_price(e.data.total),this.set_total_price_cents(e.data.totalCents),this.set_display_items(e.data.displayItems),t(e.data))}.bind(this)).fail(function(t,e,i){this.unblock(),this.submit_error(i)}.bind(this))}.bind(this))},wc_stripe.ProductGateway.prototype.cart_calculation=function(t){return new Promise(function(i,s){e.ajax({url:this.params.routes.cart_calculation,method:"POST",dataType:"json",data:{product_id:this.get_product_data().id,variation_id:this.is_variable_product()&&t?t:0,qty:e('[name="quantity"]').val(),payment_method:this.gateway_id},beforeSend:this.ajax_before_send.bind(this)}).done(function(t,e,a){t.code?(this.cart_calculation_error=!0,s(t)):(this.set_total_price(t.data.total),this.set_total_price_cents(t.data.totalCents),this.set_display_items(t.data.displayItems),i(t.data))}.bind(this)).fail(function(t,e,i){}.bind(this))}.bind(this))},wc_stripe.CartGateway=function(){this.message_container="div.woocommerce",e(document.body).on("updated_wc_div",this.updated_html.bind(this)),e(document.body).on("updated_cart_totals",this.updated_html.bind(this)),e(document.body).on("wc_cart_emptied",this.cart_emptied.bind(this))},wc_stripe.CartGateway.prototype.submit_error=function(t){this.submit_message(this.get_error_message(t))},wc_stripe.CartGateway.prototype.updated_html=function(t){},wc_stripe.CartGateway.prototype.cart_emptied=function(t){},wc_stripe.CartGateway.prototype.add_cart_totals_class=function(){e(".cart_totals").addClass("stripe_cart_gateway_active")},wc_stripe.GooglePay=function(){};const s={apiVersion:2,apiVersionMinor:0},a={type:"CARD",parameters:{allowedAuthMethods:["PAN_ONLY"],allowedCardNetworks:["AMEX","DISCOVER","INTERAC","JCB","MASTERCARD","VISA"]}};wc_stripe.GooglePay.prototype.populate_address_fields=function(t){var i=t.paymentMethodData.info.billingAddress;for(var s in i)this.fields.set(s,i[s],"billing");if(t.shippingAddress)for(var s in t.shippingAddress)this.fields.set(s,t.shippingAddress[s],"shipping");t.email&&this.fields.set("email",t.email,"billing"),"checkout"===this.get_page()&&(this.maybe_set_ship_to_different(),this.fields.toFormFields(),e('[name="billing_country"]').trigger("change"))},wc_stripe.GooglePay.prototype.map_address=function(t){return{city:t.locality,postcode:t.postalCode,state:t.administrativeArea,country:t.countryCode}},wc_stripe.GooglePay.prototype.update_payment_data=function(t){return new Promise(function(i,s){var a="default"==t.shippingOptionData.id?null:t.shippingOptionData.id;e.when(e.ajax({url:this.params.routes.payment_data,dataType:"json",method:"POST",data:{shipping_address:this.map_address(t.shippingAddress),shipping_method:a,page_id:this.get_page()},beforeSend:this.ajax_before_send.bind(this)})).done(function(t){t.code?s(t.data.data):i(t.data)}.bind(this)).fail(function(){s()}.bind(this))}.bind(this))},wc_stripe.GooglePay.prototype.on_payment_data_changed=function(t){return new Promise(function(e,i){this.update_payment_data(t).then(function(i){e(i.paymentRequestUpdate),this.set_selected_shipping_methods(i.shipping_methods),this.payment_data_updated(i,t)}.bind(this)).catch(function(t){e(t)}.bind(this))}.bind(this))},wc_stripe.GooglePay.prototype.payment_data_updated=function(t){},wc_stripe.GooglePay.prototype.get_merchant_info=function(){var t={merchantId:this.params.merchant_id,merchantName:this.params.merchant_name};return"TEST"===this.params.environment&&delete t.merchantId,t},wc_stripe.GooglePay.prototype.get_payment_options=function(){var t={environment:this.params.environment,merchantInfo:this.get_merchant_info()};return this.needs_shipping()?t.paymentDataCallbacks={onPaymentDataChanged:this.on_payment_data_changed.bind(this),onPaymentAuthorized:function(t){return new Promise(function(t,e){t({transactionState:"SUCCESS"})}.bind(this))}.bind(this)}:t.paymentDataCallbacks={onPaymentAuthorized:function(t){return new Promise(function(t,e){t({transactionState:"SUCCESS"})}.bind(this))}},t},wc_stripe.GooglePay.prototype.build_payment_request=function(){var t=e.extend({},s,{emailRequired:this.fields.required("billing_email"),merchantInfo:this.get_merchant_info(),allowedPaymentMethods:[e.extend({type:"CARD",tokenizationSpecification:{type:"PAYMENT_GATEWAY",parameters:{gateway:"stripe","stripe:version":"2018-10-31","stripe:publishableKey":this.params.api_key}}},a)],shippingAddressRequired:this.needs_shipping(),transactionInfo:{currencyCode:this.get_currency(),totalPriceStatus:"ESTIMATED",totalPrice:this.get_total_price().toString(),displayItems:this.get_display_items(),totalPriceLabel:this.params.total_price_label}});return t.allowedPaymentMethods[0].parameters.billingAddressRequired=!0,t.allowedPaymentMethods[0].parameters.billingAddressParameters={format:"FULL",phoneNumberRequired:this.fields.required("billing_phone")},this.needs_shipping()?(t.shippingAddressParameters={},t.shippingOptionRequired=!0,t.shippingOptionParameters={shippingOptions:this.get_shipping_options()},t.callbackIntents=["SHIPPING_ADDRESS","SHIPPING_OPTION","PAYMENT_AUTHORIZATION"]):t.callbackIntents=["PAYMENT_AUTHORIZATION"],t},wc_stripe.GooglePay.prototype.createPaymentsClient=function(){this.paymentsClient=new google.payments.api.PaymentsClient(this.get_payment_options())},wc_stripe.GooglePay.prototype.isReadyToPay=function(){return new Promise(function(t){var i=e.extend({},s);i.allowedPaymentMethods=[a],this.paymentsClient.isReadyToPay(i).then(function(){this.can_pay=!0,this.create_button(),t()}.bind(this)).catch(function(t){this.submit_error(t)}.bind(this))}.bind(this))},wc_stripe.GooglePay.prototype.create_button=function(){this.$button&&this.$button.remove(),this.$button=e(this.paymentsClient.createButton({onClick:this.start.bind(this),buttonColor:this.params.button_color,buttonType:this.params.button_style})),this.$button.addClass("gpay-button-container")},wc_stripe.GooglePay.prototype.start=function(){this.createPaymentsClient(),this.paymentsClient.loadPaymentData(this.build_payment_request()).then(function(t){var e=JSON.parse(t.paymentMethodData.tokenizationData.token);this.populate_address_fields(t),this.on_token_received(e)}.bind(this)).catch(function(t){"CANCELED"!==t.statusCode&&(t.statusMessage&&t.statusMessage.indexOf("paymentDataRequest.callbackIntent")>-1?this.submit_error_code("DEVELOPER_ERROR_WHITELIST"):this.submit_error(t.statusMessage))}.bind(this))},wc_stripe.ApplePay=function(){},wc_stripe.ApplePay.prototype.initialize=function(){var t=".apple-pay-button";["checkout","order_pay"].indexOf(this.get_page())<0&&(t=this.container+" .apple-pay-button"),e(document.body).on("click",t,this.start.bind(this)),this.createPaymentRequest(),this.canMakePayment()},wc_stripe.ApplePay.prototype.create_button=function(){this.$button&&this.$button.remove(),this.$button=e(this.params.button),this.append_button()},wc_stripe.ApplePay.prototype.canMakePayment=function(){return new Promise(function(t,i){this.paymentRequest.canMakePayment().then(function(i){i&&i.applePay&&(this.can_pay=!0,this.create_button(),e(this.container).show(),t(i))}.bind(this))}.bind(this))},wc_stripe.ApplePay.prototype.start=function(t){t.preventDefault(),this.paymentRequest.update(this.get_payment_request_update({total:{pending:!1}})),this.paymentRequest.show()},wc_stripe.PaymentRequest=function(){},wc_stripe.PaymentRequest.prototype.initialize=function(){this.createPaymentRequest(),this.canMakePayment(),this.paymentRequestButton=this.createPaymentRequestButton(),this.paymentRequestButton.on("click",this.button_click.bind(this))},wc_stripe.PaymentRequest.prototype.button_click=function(t){},wc_stripe.PaymentRequest.prototype.createPaymentRequestButton=function(){return this.elements.create("paymentRequestButton",{paymentRequest:this.paymentRequest,style:{paymentRequestButton:{type:this.params.button.type,theme:this.params.button.theme,height:this.params.button.height}}})},wc_stripe.PaymentRequest.prototype.canMakePayment=function(){return new Promise(function(t,i){this.paymentRequest.canMakePayment().then(function(i){i&&!i.applePay&&(this.can_pay=!0,this.create_button(),e(this.container).show(),t(i))}.bind(this))}.bind(this))},wc_stripe.PaymentRequest.prototype.create_button=function(){this.paymentRequestButton.mount("#wc-stripe-payment-request-container")},wc_stripe.CheckoutFields=function(t,i){this.params=t,this.fields=new Map(Object.keys(this.params).map(function(t){return[t,this.params[t].value]}.bind(this))),"checkout"===i&&(e("form.checkout").on("change",".input-text, select",this.onChange.bind(this)),e("form.checkout").on("change",'[name="ship_to_different_address"]',this.on_ship_to_address_change.bind(this)),this.init_i18n())},wc_stripe.CheckoutFields.prototype.init_i18n=function(){"undefined"!=typeof wc_address_i18n_params?this.locales=e.parseJSON(wc_address_i18n_params.locale.replace(/&quot;/g,'"')):this.locales=null},wc_stripe.CheckoutFields.prototype.onChange=function(t){try{var e=t.currentTarget.name,i=t.currentTarget.value;this.fields.set(e,i),"billing_country"!==e&&"shipping_country"!==e||this.update_required_fields(i,e)}catch(t){console.log(t)}},wc_stripe.CheckoutFields.prototype.update_required_fields=function(t,i){if(this.locales){var s=i.indexOf("billing_")>-1?"billing_":"shipping_",a=void 0!==this.locales[t]?this.locales[t]:this.locales.default,o=e.extend(!0,{},this.locales.default,a);for(var n in o){var r=s+n;this.params[r]&&(this.params[r]=e.extend(!0,{},this.params[r],o[n]))}}},wc_stripe.CheckoutFields.prototype.on_ship_to_address_change=function(t){e(t.currentTarget).is(":checked")&&this.update_required_fields(e("shipping_country"),"shipping_country")},wc_stripe.CheckoutFields.prototype.set=function(t,e,i){this[t]&&"function"==typeof this[t]?this[t]().set.call(this,e,i):this.fields.set(t,e)},wc_stripe.CheckoutFields.prototype.get=function(t,e){if(this[t]&&"function"==typeof this[t])var i=this[t]().get.call(this,e);else null!=(i=this.fields.get(t))&&""!==i||void 0!==e&&(i=e);return void 0===i?"":i},wc_stripe.CheckoutFields.prototype.required=function(t){return!(!this.params[t]||void 0===this.params[t].required)&&this.params[t].required},wc_stripe.CheckoutFields.prototype.name=function(){return{set:function(t,e){var i=t.split(" ");this.fields.set(e+"_first_name",i[0]),this.fields.set(e+"_last_name",i[1])},get:function(t){return this.fields.get(t+"_first_name")+" "+this.fields.get(t+"_last_name")}}},wc_stripe.CheckoutFields.prototype.payerName=function(){return wc_stripe.CheckoutFields.prototype.name.apply(this,arguments)},wc_stripe.CheckoutFields.prototype.email=function(){return{set:function(t,e){this.fields.set(e+"_email",t)},get:function(t){return this.fields.get(t+"_email")}}},wc_stripe.CheckoutFields.prototype.payerEmail=function(){return wc_stripe.CheckoutFields.prototype.email.apply(this,arguments)},wc_stripe.CheckoutFields.prototype.phone=function(){return{set:function(t,e){this.fields.set(e+"_phone",t)},get:function(t){return this.fields.get(t+"_phone")}}},wc_stripe.CheckoutFields.prototype.payerPhone=function(){return wc_stripe.CheckoutFields.prototype.phone.apply(this,arguments)},wc_stripe.CheckoutFields.prototype.phoneNumber=function(){return wc_stripe.CheckoutFields.prototype.phone.apply(this,arguments)},wc_stripe.CheckoutFields.prototype.recipient=function(){return{set:function(t,e){var i=t.split(" ");i.length>0&&this.fields.set(e+"_first_name",i[0]),i.length>1&&this.fields.set(e+"_last_name",i[1])},get:function(t){return this.fields.get(t+"_first_name")+" "+this.fields.get(t+"_last_name")}}},wc_stripe.CheckoutFields.prototype.country=function(){return{set:function(t,e){this.fields.set(e+"_country",t)},get:function(t){return this.fields.get(t+"_country")}}},wc_stripe.CheckoutFields.prototype.countryCode=function(){return wc_stripe.CheckoutFields.prototype.country.apply(this,arguments)},wc_stripe.CheckoutFields.prototype.address1=function(){return{set:function(t,e){this.fields.set(e+"_address_1",t)},get:function(t){return this.fields.get(t+"_address_1")}}},wc_stripe.CheckoutFields.prototype.address2=function(){return{set:function(t,e){this.fields.set(e+"_address_2",t)},get:function(t){this.fields.get(t+"_address_2")}}},wc_stripe.CheckoutFields.prototype.line1=function(){return wc_stripe.CheckoutFields.prototype.address1.apply(this,arguments)},wc_stripe.CheckoutFields.prototype.line2=function(){return wc_stripe.CheckoutFields.prototype.address2.apply(this,arguments)},wc_stripe.CheckoutFields.prototype.addressLine=function(){return{set:function(t,e){t.length>0&&this.fields.set(e+"_address_1",t[0]),t.length>1&&this.fields.set(e+"_address_2",t[1])},get:function(t){return[this.fields.get(t+"_address_1"),this.fields.get(t+"_address_2")]}}},wc_stripe.CheckoutFields.prototype.state=function(){return{set:function(t,e){this.fields.set(e+"_state",t)},get:function(t){return this.fields.get(t+"_state")}}},wc_stripe.CheckoutFields.prototype.region=function(){return wc_stripe.CheckoutFields.prototype.state.apply(this,arguments)},wc_stripe.CheckoutFields.prototype.administrativeArea=function(){return wc_stripe.CheckoutFields.prototype.state.apply(this,arguments)},wc_stripe.CheckoutFields.prototype.city=function(){return{set:function(t,e){this.fields.set(e+"_city",t)},get:function(t){this.fields.get(t+"_city")}}},wc_stripe.CheckoutFields.prototype.locality=function(){return wc_stripe.CheckoutFields.prototype.city.apply(this,arguments)},wc_stripe.CheckoutFields.prototype.postal_code=function(){return{set:function(t,e){this.fields.set(e+"_postcode",t)},get:function(t){this.fields.get(t+"_postcode")}}},wc_stripe.CheckoutFields.prototype.postalCode=function(){return wc_stripe.CheckoutFields.prototype.postal_code.apply(this,arguments)},wc_stripe.CheckoutFields.prototype.toJson=function(){var t={};return this.fields.forEach(function(e,i){t[i]=e}),t},wc_stripe.CheckoutFields.prototype.toFormFields=function(){this.fields.forEach(function(t,i){e(i='[name="'+i+'"]').length&&""!==t&&e(i).val(t)})};try{i=Stripe(wc_stripe_params_v3.api_key,{stripeAccount:wc_stripe_params_v3.account})}catch(e){return t.alert(e),void console.log(e)}var o=new wc_stripe.CheckoutFields(wc_stripe_checkout_fields,wc_stripe_params_v3.page)}(window,jQuery);
 
 
 
 
1
+ (function(a,b){a.wc_stripe={};var c=null;"undefined"==typeof wc_stripe_checkout_fields&&(a.wc_stripe_checkout_fields=[]),wc_stripe.BaseGateway=function(a,d){this.params=a,this.gateway_id=this.params.gateway_id,this.container="undefined"==typeof d?"li.payment_method_".concat(this.gateway_id):d,b(this.container).length||(this.container=".payment_method_".concat(this.gateway_id)),this.token_selector=this.params.token_selector,this.saved_method_selector=this.params.saved_method_selector,this.payment_token_received=!1,this.stripe=c,this.elements=c.elements(b.extend({},{locale:"auto"},this.get_element_options())),this.fields=f,this.initialize()},wc_stripe.BaseGateway.prototype.get_page=function(){return wc_stripe_params_v3.page},wc_stripe.BaseGateway.prototype.set_nonce=function(a){this.fields.set(this.gateway_id+"_token_key",a),b(this.token_selector).val(a)},wc_stripe.BaseGateway.prototype.get_element_options=function(){return{}},wc_stripe.BaseGateway.prototype.initialize=function(){},wc_stripe.BaseGateway.prototype.create_button=function(){},wc_stripe.BaseGateway.prototype.is_gateway_selected=function(){return b("[name=\"payment_method\"]:checked").val()===this.gateway_id},wc_stripe.BaseGateway.prototype.is_saved_method_selected=function(){return this.is_gateway_selected()&&"saved"===b("[name=\""+this.gateway_id+"_payment_type_key\"]:checked").val()},wc_stripe.BaseGateway.prototype.has_checkout_error=function(){return 0<b("#wc_stripe_checkout_error").length&&this.is_gateway_selected()},wc_stripe.BaseGateway.prototype.submit_error=function(a){a=this.get_error_message(a),-1==a.indexOf("</ul>")&&(a="<div class=\"woocommerce-error\">"+a+"</div>"),this.submit_message(a)},wc_stripe.BaseGateway.prototype.submit_error_code=function(a){console.log(a)},wc_stripe.BaseGateway.prototype.get_error_message=function(a){return"object"==typeof a&&a.code&&(wc_stripe_messages[a.code]?a=wc_stripe_messages[a.code]:a=a.message),a},wc_stripe.BaseGateway.prototype.submit_message=function(a){b(".woocommerce-error, .woocommerce-message, .woocommerce-info").remove();var c=b(this.message_container);c.closest("form").length&&(c=c.closest("form")),c.prepend(a),c.removeClass("processing").unblock(),c.find(".input-text, select, input:checkbox").blur(),b.scroll_to_notices?b.scroll_to_notices(c):b("html, body").animate({scrollTop:c.offset().top-100},1e3)},wc_stripe.BaseGateway.prototype.get_first_name=function(a){return b("#"+a+"_first_name").val()},wc_stripe.BaseGateway.prototype.get_last_name=function(a){return b("#"+a+"_last_name").val()},wc_stripe.BaseGateway.prototype.should_save_method=function(){return b("#"+this.gateway_id+"_save_source_key").is(":checked")},wc_stripe.BaseGateway.prototype.is_add_payment_method_page=function(){return"add_payment_method"===this.get_page()||b(document.body).hasClass("woocommerce-add-payment-method")},wc_stripe.BaseGateway.prototype.is_change_payment_method=function(){return"change_payment_method"===this.get_page()},wc_stripe.BaseGateway.prototype.get_selected_payment_method=function(){return b(this.saved_method_selector).val()},wc_stripe.BaseGateway.prototype.needs_shipping=function(){return this.get_gateway_data().needs_shipping},wc_stripe.BaseGateway.prototype.get_currency=function(){return this.get_gateway_data().currency},wc_stripe.BaseGateway.prototype.get_gateway_data=function(){return b(this.container).find(".woocommerce_".concat(this.gateway_id,"_gateway_data")).data("gateway")},wc_stripe.BaseGateway.prototype.set_gateway_data=function(a){b(this.container).find(".woocommerce_".concat(this.gateway_id,"_gateway_data")).data("gateway",a)},wc_stripe.BaseGateway.prototype.get_customer_name=function(a){return this.fields.get(a+"_first_name")+" "+this.fields.get(a+"_last_name")},wc_stripe.BaseGateway.prototype.get_customer_email=function(){return this.fields.get("billing_email")},wc_stripe.BaseGateway.prototype.get_address_field_hash=function(a){for(var b=["_first_name","_last_name","_address_1","_address_2","_postcode","_city","_state","_country"],c="",d=0;d<b.length;d++)c+=this.fields.get(a+b[d])+"_";return c},wc_stripe.BaseGateway.prototype.block=function(){b.blockUI({message:null,overlayCSS:{background:"#fff",opacity:.6}})},wc_stripe.BaseGateway.prototype.unblock=function(){b.unblockUI()},wc_stripe.BaseGateway.prototype.get_form=function(){return b(this.token_selector).closest("form")},wc_stripe.BaseGateway.prototype.get_total_price=function(){return this.get_gateway_data().total},wc_stripe.BaseGateway.prototype.get_total_price_cents=function(){return this.get_gateway_data().total_cents},wc_stripe.BaseGateway.prototype.set_total_price=function(a){var b=this.get_gateway_data();b.total=a,this.set_gateway_data(b)},wc_stripe.BaseGateway.prototype.set_total_price_cents=function(a){var b=this.get_gateway_data();b.total_cents=a,this.set_gateway_data(b)},wc_stripe.BaseGateway.prototype.set_payment_method=function(a){b("[name=\"payment_method\"][value=\""+a+"\"]").prop("checked",!0).trigger("click")},wc_stripe.BaseGateway.prototype.set_selected_shipping_methods=function(a){if(this.fields.set("shipping_method",a),a&&b("[name^=\"shipping_method\"]").length)for(var c in a){var d=a[c];b("[name=\"shipping_method["+c+"]\"][value=\""+d+"\"]").prop("checked",!0).trigger("change")}},wc_stripe.BaseGateway.prototype.on_token_received=function(a){this.payment_token_received=!0,this.set_nonce(a.id),this.process_checkout()},wc_stripe.BaseGateway.prototype.createPaymentRequest=function(){try{this.paymentRequest=c.paymentRequest(this.get_payment_request_options())}catch(a){return void this.submit_error(a.message)}this.needs_shipping()&&(this.paymentRequest.on("shippingaddresschange",this.update_shipping_address.bind(this)),this.paymentRequest.on("shippingoptionchange",this.update_shipping_method.bind(this))),this.paymentRequest.on("paymentmethod",this.on_payment_method_received.bind(this))},wc_stripe.BaseGateway.prototype.get_payment_request_options=function(){var a={country:this.params.country_code,currency:this.get_currency().toLowerCase(),total:{amount:this.get_total_price_cents(),label:this.params.total_label,pending:!0},requestPayerName:!0,requestPayerEmail:this.fields.requestFieldInWallet("billing_email"),requestPayerPhone:this.fields.requestFieldInWallet("billing_phone"),requestShipping:this.needs_shipping()},b=this.get_display_items(),c=this.get_shipping_options();return b&&(a.displayItems=b),this.needs_shipping()&&c&&(a.shippingOptions=c),a},wc_stripe.BaseGateway.prototype.get_payment_request_update=function(a){var c={currency:this.get_currency().toLowerCase(),total:{amount:parseInt(this.get_total_price_cents()),label:this.params.total_label,pending:!0}},d=this.get_display_items(),e=this.get_shipping_options();return d&&(c.displayItems=d),this.needs_shipping()&&e&&(c.shippingOptions=e),a&&(c=b.extend(!0,{},c,a)),c},wc_stripe.BaseGateway.prototype.get_display_items=function(){return this.get_gateway_data().items},wc_stripe.BaseGateway.prototype.set_display_items=function(a){var b=this.get_gateway_data();b.items=a,this.set_gateway_data(b)},wc_stripe.BaseGateway.prototype.get_shipping_options=function(){return this.get_gateway_data().shipping_options},wc_stripe.BaseGateway.prototype.set_shipping_options=function(a){var b=this.get_gateway_data();b.shipping_options=a,this.set_gateway_data(b)},wc_stripe.BaseGateway.prototype.map_address=function(a){return{city:a.city,postcode:a.postalCode,state:a.region,country:a.country}},wc_stripe.BaseGateway.prototype.on_payment_method_received=function(b){try{this.payment_response=b,this.populate_checkout_fields(b),b.complete("success"),this.on_token_received(b.paymentMethod)}catch(b){a.alert(b)}},wc_stripe.BaseGateway.prototype.populate_checkout_fields=function(a){this.set_nonce(a.paymentMethod.id),this.update_addresses(a)},wc_stripe.BaseGateway.prototype.update_addresses=function(a){a.payerName&&this.fields.set("name",a.payerName,"billing"),a.payerEmail&&this.fields.set("email",a.payerEmail,"billing"),a.payerPhone&&this.fields.set("phone",a.payerPhone,"billing"),a.shippingAddress&&this.populate_shipping_fields(a.shippingAddress),a.paymentMethod.billing_details.address&&this.populate_billing_fields(a.paymentMethod.billing_details.address)},wc_stripe.BaseGateway.prototype.populate_address_fields=function(a,b){for(var c in a)this.fields.set(c,a[c],b)},wc_stripe.BaseGateway.prototype.populate_billing_fields=function(a){this.populate_address_fields(a,"billing")},wc_stripe.BaseGateway.prototype.populate_shipping_fields=function(a){this.populate_address_fields(a,"shipping")},wc_stripe.BaseGateway.prototype.address_mappings=function(){return new wc_stripe.CheckoutFields},wc_stripe.BaseGateway.prototype.ajax_before_send=function(a){0<this.params.user_id&&a.setRequestHeader("X-WP-Nonce",this.params.rest_nonce)},wc_stripe.BaseGateway.prototype.process_checkout=function(){return new Promise(function(){this.block(),b.ajax({url:this.params.routes.checkout,method:"POST",dataType:"json",data:b.extend({},this.serialize_fields(),{payment_method:this.gateway_id,page_id:this.get_page()}),beforeSend:this.ajax_before_send.bind(this)}).done(function(b){return b.reload?void a.location.reload():void("success"===b.result?a.location=b.redirect:(b.messages&&this.submit_error(b.messages),this.unblock()))}.bind(this)).fail(function(a,b,c){this.unblock(),this.submit_error(c)}.bind(this))}.bind(this))},wc_stripe.BaseGateway.prototype.serialize_form=function(a){var c=a.find("input").filter(function(a,c){return!b(c).is("[name^=\"add-to-cart\"]")}.bind(this)).serializeArray(),d={};for(var e in c){var f=c[e];d[f.name]=f.value}return d.payment_method=this.gateway_id,d},wc_stripe.BaseGateway.prototype.serialize_fields=function(){return this.fields.toJson()},wc_stripe.BaseGateway.prototype.map_shipping_methods=function(a){var b={};if("default"!==a){var c=a.match(/^([\w+]):(.+)$/);1<c.length&&(b[c[1]]=c[2])}return b},wc_stripe.BaseGateway.prototype.maybe_set_ship_to_different=function(){b("[name=\"ship_to_different_address\"]").length&&b("[name=\"ship_to_different_address\"]").prop("checked",this.get_address_field_hash("billing")!==this.get_address_field_hash("shipping")).trigger("change")},wc_stripe.BaseGateway.prototype.update_shipping_address=function(a){return new Promise(function(c,d){b.ajax({url:this.params.routes.shipping_address,method:"POST",dataType:"json",data:{address:this.map_address(a.shippingAddress),payment_method:this.gateway_id,page_id:this.get_page()},beforeSend:this.ajax_before_send.bind(this)}).done(function(b){b.code?(a.updateWith(b.data.newData),d(b.data)):(a.updateWith(b.data.newData),this.fields.set("shipping_method",data.shipping_method),c(b.data))}.bind(this)).fail(function(){}.bind(this))}.bind(this))},wc_stripe.BaseGateway.prototype.update_shipping_method=function(a){return new Promise(function(c,d){b.ajax({url:this.params.routes.shipping_method,method:"POST",dataType:"json",data:{shipping_method:a.shippingOption.id,payment_method:this.gateway_id,page_id:this.get_page()},beforeSend:this.ajax_before_send.bind(this)}).done(function(b){b.code?(a.updateWith(b.data.newData),d(b.data)):(this.set_selected_shipping_methods(b.data.shipping_methods),a.updateWith(b.data.newData),c(b.data))}.bind(this)).fail(function(a,b,c){this.submit_error(c)}.bind(this))}.bind(this))},wc_stripe.CheckoutGateway=function(){// events for showing gateway payment buttons
2
+ this.message_container="li.payment_method_"+this.gateway_id,this.banner_container="li.banner_payment_method_"+this.gateway_id,b(document.body).on("update_checkout",this.update_checkout.bind(this)),b(document.body).on("updated_checkout",this.updated_checkout.bind(this)),b(document.body).on("cfw_updated_checkout",this.updated_checkout.bind(this)),b(document.body).on("checkout_error",this.checkout_error.bind(this)),b(this.token_selector).closest("form").on("checkout_place_order_"+this.gateway_id,this.checkout_place_order.bind(this)),b(document.body).on("wc_stripe_new_method_"+this.gateway_id,this.on_show_new_methods.bind(this)),b(document.body).on("wc_stripe_saved_method_"+this.gateway_id,this.on_show_saved_methods.bind(this)),b(document.body).on("wc_stripe_payment_method_selected",this.on_payment_method_selected.bind(this)),this.banner_enabled()&&b(".woocommerce-billing-fields").length&&b(".wc-stripe-banner-checkout").css("max-width",b(".woocommerce-billing-fields").outerWidth(!0)),this.order_review()},wc_stripe.CheckoutGateway.prototype.order_review=function(){var b=a.location.href,c=b.match(/order_review.+payment_method=([\w]+).+payment_nonce=(.+)/);if(c&&1<c.length){var d=c[1],e=c[2];this.gateway_id===d&&(this.payment_token_received=!0,this.set_nonce(e),this.set_use_new_option(!0))}},wc_stripe.CheckoutGateway.prototype.update_shipping_address=function(){return wc_stripe.BaseGateway.prototype.update_shipping_address.apply(this,arguments).then(function(a){// populate the checkout fields with the address
3
+ this.populate_address_fields(a.address,this.get_shipping_prefix()),this.fields.toFormFields({update_shipping_method:!1})}.bind(this))},wc_stripe.CheckoutGateway.prototype.get_shipping_prefix=function(){return this.needs_shipping()&&0<b("[name=\"ship_to_different_address\"]").length&&b("[name=\"ship_to_different_address\"]").is(":checked")?"shipping":"billing"},wc_stripe.CheckoutGateway.prototype.updated_checkout=function(){},wc_stripe.CheckoutGateway.prototype.update_checkout=function(){},wc_stripe.CheckoutGateway.prototype.checkout_error=function(){this.has_checkout_error()&&(this.payment_token_received=!1,this.payment_response=null,this.show_payment_button(),this.hide_place_order())},wc_stripe.CheckoutGateway.prototype.is_valid_checkout=function(){return!b("[name=\"terms\"]").length||b("[name=\"terms\"]").is(":checked")},wc_stripe.CheckoutGateway.prototype.get_payment_method=function(){return b("[name=\"payment_method\"]:checked").val()},wc_stripe.CheckoutGateway.prototype.set_use_new_option=function(a){b("#"+this.gateway_id+"_use_new").prop("checked",a).trigger("change")},wc_stripe.CheckoutGateway.prototype.checkout_place_order=function(){return this.is_valid_checkout()?!!this.is_saved_method_selected()||this.payment_token_received:(this.submit_error(this.params.messages.terms),!1)},wc_stripe.CheckoutGateway.prototype.on_token_received=function(a){this.payment_token_received=!0,this.set_nonce(a.id),this.hide_payment_button(),this.show_place_order()},wc_stripe.CheckoutGateway.prototype.block=function(){b("form.checkout").block({message:null,overlayCSS:{background:"#fff",opacity:.6}})},wc_stripe.CheckoutGateway.prototype.unblock=function(){b("form.checkout").unblock()},wc_stripe.CheckoutGateway.prototype.hide_place_order=function(){b("#place_order").addClass("wc-stripe-hide")},wc_stripe.CheckoutGateway.prototype.show_place_order=function(){b("#place_order").removeClass("wc-stripe-hide")},wc_stripe.CheckoutGateway.prototype.on_show_new_methods=function(){this.payment_token_received?(this.show_place_order(),this.hide_payment_button()):(this.hide_place_order(),this.show_payment_button())},wc_stripe.CheckoutGateway.prototype.on_show_saved_methods=function(){this.hide_payment_button(),this.show_place_order()},wc_stripe.CheckoutGateway.prototype.show_payment_button=function(){this.$button&&this.$button.show()},wc_stripe.CheckoutGateway.prototype.hide_payment_button=function(){this.$button&&this.$button.hide()},wc_stripe.CheckoutGateway.prototype.trigger_payment_method_selected=function(){this.on_payment_method_selected(null,b("[name=\"payment_method\"]:checked").val())},wc_stripe.CheckoutGateway.prototype.on_payment_method_selected=function(a,b){b===this.gateway_id?this.payment_token_received||this.is_saved_method_selected()?(this.hide_payment_button(),this.show_place_order()):(this.show_payment_button(),this.hide_place_order()):(this.hide_payment_button(),0>b.indexOf("stripe_")&&this.show_place_order())},wc_stripe.CheckoutGateway.prototype.banner_enabled=function(){return"1"===this.params.banner_enabled},wc_stripe.CheckoutGateway.prototype.checkout_fields_valid=function(){function a(a,d){for(var e in d){var f=d[e];if(-1<e.indexOf(a)&&f.required&&b("#"+e).length){var g=b("#"+e).val();if("undefined"==typeof g||null===g||0==g.length)return void(c=!1)}}}if("undefined"==typeof wc_stripe_checkout_fields||"checkout"!==this.get_page())return!0;var c=!0;return a("billing",wc_stripe_checkout_fields),this.needs_shipping()&&b("#ship-to-different-address-checkbox").is(":checked")&&a("shipping",wc_stripe_checkout_fields),c&&(c=this.is_valid_checkout()),c},wc_stripe.ProductGateway=function(){this.message_container="div.product",b("form.cart").on("found_variation",this.found_variation.bind(this)),b("form.cart").on("reset_data",this.reset_variation_data.bind(this)),this.buttonWidth=b("div.quantity").outerWidth(!0)+b(".single_add_to_cart_button").outerWidth();var a=b(".single_add_to_cart_button").css("marginLeft");a&&(this.buttonWidth+=parseInt(a.replace("px",""))),b(this.container).css("max-width",this.buttonWidth+"px")},wc_stripe.ProductGateway.prototype.get_quantity=function(){return parseInt(b("[name=\"quantity\"]").val())},wc_stripe.ProductGateway.prototype.set_rest_nonce=function(a,b){this.params.rest_nonce=b},wc_stripe.ProductGateway.prototype.found_variation=function(a,b){var c=this.get_gateway_data();c.product.price=b.display_price,c.needs_shipping=!b.is_virtual,c.product.variation=b,this.set_gateway_data(c)},wc_stripe.ProductGateway.prototype.reset_variation_data=function(){var a=this.get_product_data();a.variation=!1,this.set_product_data(a),this.disable_payment_button()},wc_stripe.ProductGateway.prototype.disable_payment_button=function(){this.$button&&this.get_button().prop("disabled",!0).addClass("disabled")},wc_stripe.ProductGateway.prototype.enable_payment_button=function(){this.$button&&this.get_button().prop("disabled",!1).removeClass("disabled")},wc_stripe.ProductGateway.prototype.get_button=function(){return this.$button},wc_stripe.ProductGateway.prototype.is_variable_product=function(){return 0<b("[name=\"variation_id\"]").length},wc_stripe.ProductGateway.prototype.variable_product_selected=function(){return!1!==this.get_product_data().variation},wc_stripe.ProductGateway.prototype.get_product_data=function(){return this.get_gateway_data().product},wc_stripe.ProductGateway.prototype.set_product_data=function(a){var b=this.get_gateway_data();b.product=a,this.set_gateway_data(b)},wc_stripe.ProductGateway.prototype.add_to_cart=function(){return new Promise(function(a,c){this.block(),b.ajax({url:this.params.routes.add_to_cart,method:"POST",dataType:"json",data:{product_id:this.get_product_data().id,variation_id:this.is_variable_product()?b("[name=\"variation_id\"]").val():0,qty:b("[name=\"quantity\"]").val(),payment_method:this.gateway_id,page_id:this.get_page()},beforeSend:this.ajax_before_send.bind(this)}).done(function(b){this.unblock(),b.code?(this.submit_error(b.message),c(b)):(this.set_total_price(b.data.total),this.set_total_price_cents(b.data.totalCents),this.set_display_items(b.data.displayItems),a(b.data))}.bind(this)).fail(function(a,b,c){this.unblock(),this.submit_error(c)}.bind(this))}.bind(this))},wc_stripe.ProductGateway.prototype.cart_calculation=function(a){return new Promise(function(c,d){b.ajax({url:this.params.routes.cart_calculation,method:"POST",dataType:"json",data:{product_id:this.get_product_data().id,variation_id:this.is_variable_product()&&a?a:0,qty:b("[name=\"quantity\"]").val(),payment_method:this.gateway_id},beforeSend:this.ajax_before_send.bind(this)}).done(function(a){a.code?(this.cart_calculation_error=!0,d(a)):(this.set_total_price(a.data.total),this.set_total_price_cents(a.data.totalCents),this.set_display_items(a.data.displayItems),c(a.data))}.bind(this)).fail(function(){}.bind(this))}.bind(this))},wc_stripe.CartGateway=function(){// cart events
4
+ this.message_container="div.woocommerce",b(document.body).on("updated_wc_div",this.updated_html.bind(this)),b(document.body).on("updated_cart_totals",this.updated_html.bind(this)),b(document.body).on("wc_cart_emptied",this.cart_emptied.bind(this))},wc_stripe.CartGateway.prototype.submit_error=function(a){this.submit_message(this.get_error_message(a))},wc_stripe.CartGateway.prototype.updated_html=function(){},wc_stripe.CartGateway.prototype.cart_emptied=function(){},wc_stripe.CartGateway.prototype.add_cart_totals_class=function(){b(".cart_totals").addClass("stripe_cart_gateway_active")},wc_stripe.GooglePay=function(){};var d={apiVersion:2,apiVersionMinor:0},e={type:"CARD",parameters:{allowedAuthMethods:["PAN_ONLY"],allowedCardNetworks:["AMEX","DISCOVER","INTERAC","JCB","MASTERCARD","VISA"]}};wc_stripe.GooglePay.prototype.update_addresses=function(a){this.populate_billing_fields(a.paymentMethodData.info.billingAddress),a.shippingAddress&&this.populate_shipping_fields(a.shippingAddress),a.email&&this.fields.set("email",a.email,"billing")},wc_stripe.GooglePay.prototype.map_address=function(a){return{city:a.locality,postcode:a.postalCode,state:a.administrativeArea,country:a.countryCode}},wc_stripe.GooglePay.prototype.update_payment_data=function(a){return new Promise(function(c,d){var e="default"==a.shippingOptionData.id?null:a.shippingOptionData.id;b.when(b.ajax({url:this.params.routes.payment_data,dataType:"json",method:"POST",data:{shipping_address:this.map_address(a.shippingAddress),shipping_method:e,page_id:this.get_page()},beforeSend:this.ajax_before_send.bind(this)})).done(function(a){a.code?d(a.data.data):c(a.data)}.bind(this)).fail(function(){d()}.bind(this))}.bind(this))},wc_stripe.GooglePay.prototype.on_payment_data_changed=function(a){return new Promise(function(b){this.update_payment_data(a).then(function(c){b(c.paymentRequestUpdate),this.set_selected_shipping_methods(c.shipping_methods),this.payment_data_updated(c,a)}.bind(this))["catch"](function(a){b(a)}.bind(this))}.bind(this))},wc_stripe.GooglePay.prototype.payment_data_updated=function(){},wc_stripe.GooglePay.prototype.get_merchant_info=function(){var a={merchantId:this.params.merchant_id,merchantName:this.params.merchant_name};return"TEST"===this.params.environment&&delete a.merchantId,a},wc_stripe.GooglePay.prototype.get_payment_options=function(){var a={environment:this.params.environment,merchantInfo:this.get_merchant_info()};return a.paymentDataCallbacks=this.needs_shipping()?{onPaymentDataChanged:this.on_payment_data_changed.bind(this),onPaymentAuthorized:function(){return new Promise(function(a){a({transactionState:"SUCCESS"})}.bind(this))}.bind(this)}:{onPaymentAuthorized:function(){return new Promise(function(a){a({transactionState:"SUCCESS"})}.bind(this))}},a},wc_stripe.GooglePay.prototype.build_payment_request=function(){var a=b.extend({},d,{emailRequired:function(){return"checkout"===this.get_page()?this.fields.required("billing_email")&&this.fields.isEmpty("billing_email"):"order_pay"!==this.get_page()&&this.fields.required("billing_email")}.bind(this)(),merchantInfo:this.get_merchant_info(),allowedPaymentMethods:[b.extend({type:"CARD",tokenizationSpecification:{type:"PAYMENT_GATEWAY",parameters:{gateway:"stripe","stripe:version":"2018-10-31","stripe:publishableKey":this.params.api_key}}},e)],shippingAddressRequired:this.needs_shipping(),transactionInfo:{currencyCode:this.get_currency(),totalPriceStatus:"ESTIMATED",totalPrice:this.get_total_price().toString(),displayItems:this.get_display_items(),totalPriceLabel:this.params.total_price_label}});return a.allowedPaymentMethods[0].parameters.billingAddressRequired=!0,a.allowedPaymentMethods[0].parameters.billingAddressParameters={format:"FULL",phoneNumberRequired:function(){return"checkout"===this.get_page()?this.fields.required("billing_phone")&&this.fields.isEmpty("billing_phone"):"order_pay"!==this.get_page()&&this.fields.required("billing_phone")}.bind(this)()},this.needs_shipping()?(a.shippingAddressParameters={},a.shippingOptionRequired=!0,a.shippingOptionParameters={shippingOptions:this.get_shipping_options()},a.callbackIntents=["SHIPPING_ADDRESS","SHIPPING_OPTION","PAYMENT_AUTHORIZATION"]):a.callbackIntents=["PAYMENT_AUTHORIZATION"],a},wc_stripe.GooglePay.prototype.createPaymentsClient=function(){this.paymentsClient=new google.payments.api.PaymentsClient(this.get_payment_options())},wc_stripe.GooglePay.prototype.isReadyToPay=function(){return new Promise(function(a){var c=b.extend({},d);c.allowedPaymentMethods=[e],this.paymentsClient.isReadyToPay(c).then(function(){this.can_pay=!0,this.create_button(),a()}.bind(this))["catch"](function(a){this.submit_error(a)}.bind(this))}.bind(this))},wc_stripe.GooglePay.prototype.create_button=function(){this.$button&&this.$button.remove(),this.$button=b(this.paymentsClient.createButton({onClick:this.start.bind(this),buttonColor:this.params.button_color,buttonType:this.params.button_style})),this.$button.addClass("gpay-button-container")},wc_stripe.GooglePay.prototype.start=function(){// always recreate the paymentClient to ensure latest data is used.
5
+ this.createPaymentsClient(),this.paymentsClient.loadPaymentData(this.build_payment_request()).then(function(a){var b=JSON.parse(a.paymentMethodData.tokenizationData.token);this.update_addresses(a),this.on_token_received(b)}.bind(this))["catch"](function(a){"CANCELED"===a.statusCode||(a.statusMessage&&-1<a.statusMessage.indexOf("paymentDataRequest.callbackIntent")?this.submit_error_code("DEVELOPER_ERROR_WHITELIST"):this.submit_error(a.statusMessage))}.bind(this))},wc_stripe.ApplePay=function(){},wc_stripe.ApplePay.prototype.initialize=function(){var a=".apple-pay-button";0>["checkout","order_pay"].indexOf(this.get_page())&&(a=this.container+" .apple-pay-button"),b(document.body).on("click",a,this.start.bind(this)),this.createPaymentRequest(),this.canMakePayment()},wc_stripe.ApplePay.prototype.create_button=function(){this.$button&&this.$button.remove(),this.$button=b(this.params.button),this.append_button()},wc_stripe.ApplePay.prototype.canMakePayment=function(){return new Promise(function(a){this.paymentRequest.canMakePayment().then(function(c){c&&c.applePay&&(this.can_pay=!0,this.create_button(),b(this.container).show(),a(c))}.bind(this))}.bind(this))},wc_stripe.ApplePay.prototype.start=function(a){a.preventDefault(),this.paymentRequest.update(this.get_payment_request_update({total:{pending:!1}})),this.paymentRequest.show()},wc_stripe.PaymentRequest=function(){},wc_stripe.PaymentRequest.prototype.initialize=function(){this.createPaymentRequest(),this.canMakePayment(),this.createPaymentRequestButton(),this.paymentRequestButton.on("click",this.button_click.bind(this))},wc_stripe.PaymentRequest.prototype.button_click=function(){},wc_stripe.PaymentRequest.prototype.createPaymentRequestButton=function(){this.paymentRequestButton=this.elements.create("paymentRequestButton",{paymentRequest:this.paymentRequest,style:{paymentRequestButton:{type:this.params.button.type,theme:this.params.button.theme,height:this.params.button.height}}})},wc_stripe.PaymentRequest.prototype.canMakePayment=function(){return new Promise(function(a){this.paymentRequest.canMakePayment().then(function(c){c&&!c.applePay&&(this.can_pay=!0,this.create_button(),b(this.container).show(),a(c))}.bind(this))}.bind(this))},wc_stripe.PaymentRequest.prototype.create_button=function(){this.paymentRequestButton.mount("#wc-stripe-payment-request-container")},wc_stripe.CheckoutFields=function(a,c){this.params=a,this.page=c,this.fields=new Map(Object.keys(this.params).map(function(a){return[a,this.params[a].value]}.bind(this))),"checkout"===c&&(b("form.checkout").on("change",".input-text, select",this.onChange.bind(this)),b("form.checkout").on("change","[name=\"ship_to_different_address\"]",this.on_ship_to_address_change.bind(this)),this.init_i18n())},wc_stripe.CheckoutFields.prototype.init_i18n=function(){this.locales="undefined"==typeof wc_address_i18n_params?null:b.parseJSON(wc_address_i18n_params.locale.replace(/&quot;/g,"\""))},wc_stripe.CheckoutFields.prototype.onChange=function(a){try{var b=a.currentTarget.name,c=a.currentTarget.value;this.fields.set(b,c),("billing_country"===b||"shipping_country"===b)&&this.update_required_fields(c,b)}catch(a){console.log(a)}},wc_stripe.CheckoutFields.prototype.update_required_fields=function(a,c){if(this.locales){var d=-1<c.indexOf("billing_")?"billing_":"shipping_",e="undefined"==typeof this.locales[a]?this.locales["default"]:this.locales[a],f=b.extend(!0,{},this.locales["default"],e);for(var g in f){var h=d+g;this.params[h]&&(this.params[h]=b.extend(!0,{},this.params[h],f[g]))}}},wc_stripe.CheckoutFields.prototype.on_ship_to_address_change=function(a){b(a.currentTarget).is(":checked")&&this.update_required_fields(b("shipping_country"),"shipping_country")},wc_stripe.CheckoutFields.prototype.requestFieldInWallet=function(a){if("checkout"===this.page)return this.required(a)&&this.isEmpty(a);return"order_pay"!==this.page&&this.required(a)},wc_stripe.CheckoutFields.prototype.set=function(a,b,c){this[a]&&"function"==typeof this[a]?this[a]().set.call(this,b,c):this.fields.set(a,b)},wc_stripe.CheckoutFields.prototype.get=function(a,b){if(this[a]&&"function"==typeof this[a])var c=this[a]().get.call(this,b);else{var c=this.fields.get(a);("undefined"==typeof c||null===c||""===c)&&"undefined"!=typeof b&&(c=b)}return"undefined"==typeof c?"":c},wc_stripe.CheckoutFields.prototype.required=function(a){return!!(this.params[a]&&"undefined"!=typeof this.params[a].required)&&this.params[a].required},wc_stripe.CheckoutFields.prototype.isEmpty=function(a){if(this.fields.has(a)){var b=this.fields.get(a);return"undefined"==typeof b||null===b||"string"==typeof b&&0===b.trim().length}return!0},wc_stripe.CheckoutFields.prototype.name=function(){return{set:function(a,b){var c=a.split(" ");this.fields.set(b+"_first_name",c[0]),this.fields.set(b+"_last_name",c[1])},get:function(a){return this.fields.get(a+"_first_name")+" "+this.fields.get(a+"_last_name")}}},wc_stripe.CheckoutFields.prototype.payerName=function(){return wc_stripe.CheckoutFields.prototype.name.apply(this,arguments)},wc_stripe.CheckoutFields.prototype.email=function(){return{set:function(a,b){this.fields.set(b+"_email",a)},get:function(a){return this.fields.get(a+"_email")}}},wc_stripe.CheckoutFields.prototype.payerEmail=function(){return wc_stripe.CheckoutFields.prototype.email.apply(this,arguments)},wc_stripe.CheckoutFields.prototype.phone=function(){return{set:function(a,b){this.fields.set(b+"_phone",a)},get:function(a){return this.fields.get(a+"_phone")}}},wc_stripe.CheckoutFields.prototype.payerPhone=function(){return wc_stripe.CheckoutFields.prototype.phone.apply(this,arguments)},wc_stripe.CheckoutFields.prototype.phoneNumber=function(){return wc_stripe.CheckoutFields.prototype.phone.apply(this,arguments)},wc_stripe.CheckoutFields.prototype.recipient=function(){return{set:function(a,b){var c=a.split(" ");0<c.length&&this.fields.set(b+"_first_name",c[0]),1<c.length&&this.fields.set(b+"_last_name",c[1])},get:function(a){return this.fields.get(a+"_first_name")+" "+this.fields.get(a+"_last_name")}}},wc_stripe.CheckoutFields.prototype.country=function(){return{set:function(a,b){this.fields.set(b+"_country",a)},get:function(a){return this.fields.get(a+"_country")}}},wc_stripe.CheckoutFields.prototype.countryCode=function(){return wc_stripe.CheckoutFields.prototype.country.apply(this,arguments)},wc_stripe.CheckoutFields.prototype.address1=function(){return{set:function(a,b){this.fields.set(b+"_address_1",a)},get:function(a){return this.fields.get(a+"_address_1")}}},wc_stripe.CheckoutFields.prototype.address2=function(){return{set:function(a,b){this.fields.set(b+"_address_2",a)},get:function(a){this.fields.get(a+"_address_2")}}},wc_stripe.CheckoutFields.prototype.line1=function(){return wc_stripe.CheckoutFields.prototype.address1.apply(this,arguments)},wc_stripe.CheckoutFields.prototype.line2=function(){return wc_stripe.CheckoutFields.prototype.address2.apply(this,arguments)},wc_stripe.CheckoutFields.prototype.addressLine=function(){return{set:function(a,b){0<a.length&&this.fields.set(b+"_address_1",a[0]),1<a.length&&this.fields.set(b+"_address_2",a[1])},get:function(a){return[this.fields.get(a+"_address_1"),this.fields.get(a+"_address_2")]}}},wc_stripe.CheckoutFields.prototype.state=function(){return{set:function(a,c){a=a.toUpperCase(),2<a.length&&"checkout"===this.page&&b("#"+c+"_state option").each(function(){var c=b(this),d=c.text().toUpperCase();a===d&&(a=c.val())}),this.fields.set(c+"_state",a)},get:function(a){return this.fields.get(a+"_state")}}},wc_stripe.CheckoutFields.prototype.region=function(){return wc_stripe.CheckoutFields.prototype.state.apply(this,arguments)},wc_stripe.CheckoutFields.prototype.administrativeArea=function(){return wc_stripe.CheckoutFields.prototype.state.apply(this,arguments)},wc_stripe.CheckoutFields.prototype.city=function(){return{set:function(a,b){this.fields.set(b+"_city",a)},get:function(a){this.fields.get(a+"_city")}}},wc_stripe.CheckoutFields.prototype.locality=function(){return wc_stripe.CheckoutFields.prototype.city.apply(this,arguments)},wc_stripe.CheckoutFields.prototype.postcode=function(){return{set:function(a,b){this.fields.set(b+"_postcode",a)},get:function(a){this.fields.get(a+"_postcode")}}},wc_stripe.CheckoutFields.prototype.postal_code=function(){return wc_stripe.CheckoutFields.prototype.postcode.apply(this,arguments)},wc_stripe.CheckoutFields.prototype.postalCode=function(){return wc_stripe.CheckoutFields.prototype.postcode.apply(this,arguments)},wc_stripe.CheckoutFields.prototype.toJson=function(){var a={};return this.fields.forEach(function(b,c){a[c]=b}),a},wc_stripe.CheckoutFields.prototype.toFormFields=function(a){var c=[];this.fields.forEach(function(a,d){var e="[name=\""+d+"\"]";b(e).length&&""!==a&&(b(e).val()!==a&&b(e).is("select")&&c.push(e),b(e).val(a))}),0<c.length&&b(c.join(",")).trigger("change"),"undefined"!=typeof a&&b(document.body).trigger("update_checkout",a)};try{c=Stripe(wc_stripe_params_v3.api_key,{stripeAccount:wc_stripe_params_v3.account})}catch(b){return a.alert(b),void console.log(b)}var f=new wc_stripe.CheckoutFields(wc_stripe_checkout_fields,wc_stripe_params_v3.page)})(window,jQuery);
composer.json DELETED
@@ -1,5 +0,0 @@
1
- {
2
- "require": {
3
- "stripe/stripe-php": "^7.40"
4
- }
5
- }
 
 
 
 
 
composer.lock DELETED
@@ -1,76 +0,0 @@
1
- {
2
- "_readme": [
3
- "This file locks the dependencies of your project to a known state",
4
- "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
5
- "This file is @generated automatically"
6
- ],
7
- "content-hash": "7a93059c67c14d8e5b78b3c9325b47e5",
8
- "packages": [
9
- {
10
- "name": "stripe/stripe-php",
11
- "version": "v7.45.0",
12
- "source": {
13
- "type": "git",
14
- "url": "https://github.com/stripe/stripe-php.git",
15
- "reference": "21e5001f5e0d787e4755c8bfc00e578dce9ae058"
16
- },
17
- "dist": {
18
- "type": "zip",
19
- "url": "https://api.github.com/repos/stripe/stripe-php/zipball/21e5001f5e0d787e4755c8bfc00e578dce9ae058",
20
- "reference": "21e5001f5e0d787e4755c8bfc00e578dce9ae058",
21
- "shasum": ""
22
- },
23
- "require": {
24
- "ext-curl": "*",
25
- "ext-json": "*",
26
- "ext-mbstring": "*",
27
- "php": ">=5.6.0"
28
- },
29
- "require-dev": {
30
- "friendsofphp/php-cs-fixer": "2.16.1",
31
- "php-coveralls/php-coveralls": "^2.1",
32
- "phpunit/phpunit": "^5.7",
33
- "squizlabs/php_codesniffer": "^3.3",
34
- "symfony/process": "~3.4"
35
- },
36
- "type": "library",
37
- "extra": {
38
- "branch-alias": {
39
- "dev-master": "2.0-dev"
40
- }
41
- },
42
- "autoload": {
43
- "psr-4": {
44
- "Stripe\\": "lib/"
45
- }
46
- },
47
- "notification-url": "https://packagist.org/downloads/",
48
- "license": [
49
- "MIT"
50
- ],
51
- "authors": [
52
- {
53
- "name": "Stripe and contributors",
54
- "homepage": "https://github.com/stripe/stripe-php/contributors"
55
- }
56
- ],
57
- "description": "Stripe PHP Library",
58
- "homepage": "https://stripe.com/",
59
- "keywords": [
60
- "api",
61
- "payment processing",
62
- "stripe"
63
- ],
64
- "time": "2020-07-29T04:29:52+00:00"
65
- }
66
- ],
67
- "packages-dev": [],
68
- "aliases": [],
69
- "minimum-stability": "stable",
70
- "stability-flags": [],
71
- "prefer-stable": false,
72
- "prefer-lowest": false,
73
- "platform": [],
74
- "platform-dev": [],
75
- "plugin-api-version": "1.1.0"
76
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
i18n/languages/woo-stripe-payment.pot CHANGED
@@ -2,14 +2,14 @@
2
  # This file is distributed under the same license as the Stripe For WooCommerce plugin.
3
  msgid ""
4
  msgstr ""
5
- "Project-Id-Version: Stripe For WooCommerce 3.2.0\n"
6
  "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/woo-stripe-payment\n"
7
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
8
  "Language-Team: LANGUAGE <LL@li.org>\n"
9
  "MIME-Version: 1.0\n"
10
  "Content-Type: text/plain; charset=UTF-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
12
- "POT-Creation-Date: 2020-08-19T05:32:27+00:00\n"
13
  "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
14
  "X-Generator: WP-CLI 2.4.0\n"
15
  "X-Domain: woo-stripe-payment\n"
@@ -32,7 +32,6 @@ msgstr ""
32
 
33
  #: includes/abstract/abstract-wc-payment-gateway-stripe-local-payment.php:105
34
  #: includes/admin/meta-boxes/views/html-product-data.php:14
35
- #: includes/gateways/settings/ach-settings-v2.php:9
36
  #: includes/gateways/settings/ach-settings.php:9
37
  #: includes/gateways/settings/applepay-settings.php:11
38
  #: includes/gateways/settings/cc-settings.php:4
@@ -46,8 +45,7 @@ msgid "If enabled, your site can accept %s payments through Stripe."
46
  msgstr ""
47
 
48
  #: includes/abstract/abstract-wc-payment-gateway-stripe-local-payment.php:114
49
- #: includes/gateways/settings/ach-settings-v2.php:64
50
- #: includes/gateways/settings/ach-settings.php:73
51
  #: includes/gateways/settings/applepay-settings.php:20
52
  #: includes/gateways/settings/cc-settings.php:17
53
  #: includes/gateways/settings/googlepay-settings.php:31
@@ -57,8 +55,7 @@ msgstr ""
57
 
58
  #: includes/abstract/abstract-wc-payment-gateway-stripe-local-payment.php:118
59
  #: includes/admin/meta-boxes/views/html-charge-data-subview.php:47
60
- #: includes/gateways/settings/ach-settings-v2.php:68
61
- #: includes/gateways/settings/ach-settings.php:77
62
  #: includes/gateways/settings/applepay-settings.php:24
63
  #: includes/gateways/settings/cc-settings.php:21
64
  #: includes/gateways/settings/googlepay-settings.php:41
@@ -67,8 +64,7 @@ msgid "Title"
67
  msgstr ""
68
 
69
  #: includes/abstract/abstract-wc-payment-gateway-stripe-local-payment.php:124
70
- #: includes/gateways/settings/ach-settings-v2.php:74
71
- #: includes/gateways/settings/ach-settings.php:83
72
  #: includes/gateways/settings/applepay-settings.php:30
73
  #: includes/gateways/settings/cc-settings.php:27
74
  #: includes/gateways/settings/googlepay-settings.php:47
@@ -77,8 +73,7 @@ msgid "Description"
77
  msgstr ""
78
 
79
  #: includes/abstract/abstract-wc-payment-gateway-stripe-local-payment.php:127
80
- #: includes/gateways/settings/ach-settings-v2.php:77
81
- #: includes/gateways/settings/ach-settings.php:86
82
  #: includes/gateways/settings/applepay-settings.php:33
83
  #: includes/gateways/settings/cc-settings.php:30
84
  #: includes/gateways/settings/googlepay-settings.php:50
@@ -98,122 +93,149 @@ msgstr ""
98
  msgid " & billing country is <strong>%s</strong>"
99
  msgstr ""
100
 
101
- #: includes/abstract/abstract-wc-payment-gateway-stripe.php:421
102
  #: includes/controllers/class-wc-stripe-controller-cart.php:136
103
- #: includes/controllers/class-wc-stripe-controller-cart.php:199
104
- #: includes/controllers/class-wc-stripe-controller-googlepay.php:136
105
  #: includes/gateways/class-wc-payment-gateway-stripe-googlepay.php:103
106
  msgid "Total"
107
  msgstr ""
108
 
109
- #: includes/abstract/abstract-wc-payment-gateway-stripe.php:481
110
  msgid "User must be logged in."
111
  msgstr ""
112
 
113
- #: includes/abstract/abstract-wc-payment-gateway-stripe.php:493
114
  msgid "Error saving your payment method. Reason: %s"
115
  msgstr ""
116
 
117
- #: includes/abstract/abstract-wc-payment-gateway-stripe.php:508
118
  msgid "Error saving payment method. Reason: %s"
119
  msgstr ""
120
 
121
- #: includes/abstract/abstract-wc-payment-gateway-stripe.php:527
122
  msgid "Order refunded in Stripe. Amount: %s"
123
  msgstr ""
124
 
125
- #: includes/abstract/abstract-wc-payment-gateway-stripe.php:565
126
  msgid "Order amount captured in Stripe. Amount: %s"
127
  msgstr ""
128
 
129
- #: includes/abstract/abstract-wc-payment-gateway-stripe.php:575
130
  msgid "Error capturing charge in Stripe. Reason: %s"
131
  msgstr ""
132
 
133
- #: includes/abstract/abstract-wc-payment-gateway-stripe.php:596
134
  msgid "Error voiding charge. Reason: %s"
135
  msgstr ""
136
 
137
- #: includes/abstract/abstract-wc-payment-gateway-stripe.php:598
138
  msgid "Charge voided in Stripe."
139
  msgstr ""
140
 
141
- #: includes/abstract/abstract-wc-payment-gateway-stripe.php:768
142
  msgid "n/a"
143
  msgstr ""
144
 
145
- #: includes/abstract/abstract-wc-payment-gateway-stripe.php:796
146
  #: includes/admin/meta-boxes/views/html-order-pay.php:42
147
  msgid "New Card"
148
  msgstr ""
149
 
150
- #: includes/abstract/abstract-wc-payment-gateway-stripe.php:800
151
  #: includes/admin/meta-boxes/views/html-order-pay.php:30
152
  msgid "Saved Cards"
153
  msgstr ""
154
 
155
- #: includes/abstract/abstract-wc-payment-gateway-stripe.php:985
156
  msgid "Attemp to save payment method failed. Reason: %s"
157
  msgstr ""
158
 
159
- #: includes/abstract/abstract-wc-payment-gateway-stripe.php:1007
160
  msgid "We were not able to save your payment method. To prevent billing issues with your subscription, please add a payment method to the subscription."
161
  msgstr ""
162
 
163
- #: includes/abstract/abstract-wc-payment-gateway-stripe.php:1009
164
  msgid "We were not able to save your payment method. Reason: %s"
165
  msgstr ""
166
 
167
- #: includes/abstract/abstract-wc-payment-gateway-stripe.php:1043
168
  msgid "Payment Method Token"
169
  msgstr ""
170
 
171
- #: includes/abstract/abstract-wc-payment-gateway-stripe.php:1063
172
  msgid "Recurring payment for order failed. Reason: %s"
173
  msgstr ""
174
 
175
- #: includes/abstract/abstract-wc-payment-gateway-stripe.php:1076
176
  msgid "Recurring payment captured in Stripe. Payment method: %s"
177
  msgstr ""
178
 
179
- #: includes/abstract/abstract-wc-payment-gateway-stripe.php:1078
180
  msgid "Recurring payment authorized in Stripe. Payment method: %s"
181
  msgstr ""
182
 
183
- #: includes/abstract/abstract-wc-payment-gateway-stripe.php:1081
184
- #: includes/abstract/abstract-wc-payment-gateway-stripe.php:1340
185
  msgid "Customer must manually complete payment for payment method %s"
186
  msgstr ""
187
 
188
- #: includes/abstract/abstract-wc-payment-gateway-stripe.php:1097
189
  msgid "Error saving payment method for subscription. Reason: %s"
190
  msgstr ""
191
 
192
- #: includes/abstract/abstract-wc-payment-gateway-stripe.php:1158
193
  #: includes/abstract/abstract-wc-stripe-payment.php:219
194
  msgid "Order %1$s from %2$s"
195
  msgstr ""
196
 
197
- #: includes/abstract/abstract-wc-payment-gateway-stripe.php:1327
198
  msgid "Pre-order payment for order failed. Reason: %s"
199
  msgstr ""
200
 
201
- #: includes/abstract/abstract-wc-payment-gateway-stripe.php:1335
202
  msgid "Pre-order payment captured in Stripe. Payment method: %s"
203
  msgstr ""
204
 
205
- #: includes/abstract/abstract-wc-payment-gateway-stripe.php:1337
206
  msgid "Pre-order payment authorized in Stripe. Payment method: %s"
207
  msgstr ""
208
 
209
- #: includes/abstract/abstract-wc-payment-gateway-stripe.php:1409
210
  msgid "Cannot process payment"
211
  msgstr ""
212
 
213
- #: includes/abstract/abstract-wc-payment-gateway-stripe.php:1417
214
  msgid "Increase your conversion rate by offering %1$s on your Product and Cart pages, or at the top of the checkout page. <br/><strong>Note:</strong> you can control which products display %s by going to the product edit page."
215
  msgstr ""
216
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
217
  #: includes/abstract/abstract-wc-stripe-payment.php:104
218
  msgid "Charge %1$s is pending. Payment Method: %2$s. Payment will be completed once charge.succeeded webhook received from Stripe."
219
  msgstr ""
@@ -234,8 +256,8 @@ msgstr ""
234
  msgid "Transaction Id cannot be empty."
235
  msgstr ""
236
 
237
- #: includes/abstract/abstract-wc-stripe-payment.php:283
238
- #: includes/gateways/class-wc-payment-gateway-stripe-ach.php:115
239
  msgid "Error processing payment. Reason: %s"
240
  msgstr ""
241
 
@@ -302,7 +324,7 @@ msgstr ""
302
  #: includes/admin/meta-boxes/views/html-charge-data-subview.php:14
303
  #: includes/admin/meta-boxes/views/html-order-actions.php:48
304
  #: includes/admin/meta-boxes/views/html-order-pay.php:23
305
- #: includes/admin/meta-boxes/views/html-product-data.php:51
306
  #: includes/gateways/settings/applepay-settings.php:52
307
  #: includes/gateways/settings/cc-settings.php:49
308
  #: includes/gateways/settings/googlepay-settings.php:69
@@ -437,7 +459,7 @@ msgid "Charge Type"
437
  msgstr ""
438
 
439
  #: includes/admin/meta-boxes/views/html-order-pay.php:24
440
- #: includes/admin/meta-boxes/views/html-product-data.php:53
441
  #: includes/gateways/settings/applepay-settings.php:53
442
  #: includes/gateways/settings/cc-settings.php:50
443
  #: includes/gateways/settings/googlepay-settings.php:70
@@ -457,23 +479,23 @@ msgstr ""
457
  msgid "Method"
458
  msgstr ""
459
 
460
- #: includes/admin/meta-boxes/views/html-product-data.php:64
461
  msgid "Button Position"
462
  msgstr ""
463
 
464
- #: includes/admin/meta-boxes/views/html-product-data.php:66
465
  msgid "Below add to cart"
466
  msgstr ""
467
 
468
- #: includes/admin/meta-boxes/views/html-product-data.php:67
469
  msgid "Above add to cart"
470
  msgstr ""
471
 
472
- #: includes/admin/meta-boxes/views/html-product-data.php:70
473
  msgid "The location of the payment buttons in relation to the Add to Cart button."
474
  msgstr ""
475
 
476
- #: includes/admin/meta-boxes/views/html-product-data.php:79
477
  msgid "Save"
478
  msgstr ""
479
 
@@ -638,7 +660,7 @@ msgstr ""
638
  msgid "Your payment is being processed and your order status will be updated once the funds are received."
639
  msgstr ""
640
 
641
- #: includes/class-wc-stripe-frontend-scripts.php:74
642
  msgid "No matches found"
643
  msgstr ""
644
 
@@ -658,7 +680,7 @@ msgstr ""
658
  msgid "Payment authorization failed."
659
  msgstr ""
660
 
661
- #: includes/class-wc-stripe-rest-api.php:37
662
  msgid "%1$s is an invalid controller name."
663
  msgstr ""
664
 
@@ -670,11 +692,11 @@ msgstr ""
670
  msgid "Quantity must be greater than zero."
671
  msgstr ""
672
 
673
- #: includes/controllers/class-wc-stripe-controller-checkout.php:228
674
  msgid "Some required fields were missing. Please click %1$shere%2$s to complete your payment."
675
  msgstr ""
676
 
677
- #: includes/controllers/class-wc-stripe-controller-checkout.php:277
678
  msgid "Please review your order details then click Place Order."
679
  msgstr ""
680
 
@@ -765,15 +787,15 @@ msgstr ""
765
  msgid "Bank Payment"
766
  msgstr ""
767
 
768
- #: includes/gateways/class-wc-payment-gateway-stripe-ach.php:217
769
  msgid "Saved Banks"
770
  msgstr ""
771
 
772
- #: includes/gateways/class-wc-payment-gateway-stripe-ach.php:221
773
  msgid "New Bank"
774
  msgstr ""
775
 
776
- #: includes/gateways/class-wc-payment-gateway-stripe-ach.php:265
777
  msgid "You must set the API mode to live in order to enable the Plaid development environment."
778
  msgstr ""
779
 
@@ -904,42 +926,11 @@ msgstr ""
904
  msgid "Please update you product quantity before using Google Pay."
905
  msgstr ""
906
 
907
- #: includes/gateways/class-wc-payment-gateway-stripe-googlepay.php:125
908
- msgid "Subscription"
909
- msgstr ""
910
-
911
- #: includes/gateways/class-wc-payment-gateway-stripe-googlepay.php:154
912
- #: includes/gateways/class-wc-payment-gateway-stripe-googlepay.php:217
913
- #: includes/gateways/class-wc-payment-gateway-stripe-klarna.php:189
914
- #: includes/wc-stripe-functions.php:404
915
- #: includes/wc-stripe-functions.php:469
916
- msgid "Shipping"
917
- msgstr ""
918
-
919
- #: includes/gateways/class-wc-payment-gateway-stripe-googlepay.php:162
920
- #: includes/gateways/class-wc-payment-gateway-stripe-googlepay.php:239
921
- #: includes/gateways/class-wc-payment-gateway-stripe-klarna.php:199
922
- #: includes/wc-stripe-functions.php:421
923
- #: includes/wc-stripe-functions.php:477
924
- msgid "Discount"
925
- msgstr ""
926
-
927
- #: includes/gateways/class-wc-payment-gateway-stripe-googlepay.php:173
928
- #: includes/wc-stripe-functions.php:488
929
- msgid "Fees"
930
- msgstr ""
931
-
932
- #: includes/gateways/class-wc-payment-gateway-stripe-googlepay.php:253
933
- #: includes/gateways/class-wc-payment-gateway-stripe-klarna.php:221
934
- #: includes/wc-stripe-functions.php:429
935
- msgid "Tax"
936
- msgstr ""
937
-
938
- #: includes/gateways/class-wc-payment-gateway-stripe-googlepay.php:290
939
  msgid "Waiting..."
940
  msgstr ""
941
 
942
- #: includes/gateways/class-wc-payment-gateway-stripe-googlepay.php:291
943
  msgid "loading shipping methods..."
944
  msgstr ""
945
 
@@ -1108,124 +1099,100 @@ msgstr ""
1108
  msgid "Scan the QR code using your WeChat app. Once scanned click the Place Order button."
1109
  msgstr ""
1110
 
1111
- #: includes/gateways/settings/ach-settings-v2.php:5
1112
  #: includes/gateways/settings/ach-settings.php:5
1113
  msgid "For US customers only."
1114
  msgstr ""
1115
 
1116
- #: includes/gateways/settings/ach-settings-v2.php:6
1117
  #: includes/gateways/settings/ach-settings.php:6
1118
  msgid "Read through our %1$sdocumentation%2$s to configure ACH payments"
1119
  msgstr ""
1120
 
1121
- #: includes/gateways/settings/ach-settings-v2.php:14
1122
  #: includes/gateways/settings/ach-settings.php:14
1123
  msgid "If enabled, your site can accept ACH payments through Stripe."
1124
  msgstr ""
1125
 
1126
- #: includes/gateways/settings/ach-settings-v2.php:18
1127
  #: includes/gateways/settings/ach-settings.php:18
1128
  msgid "Plaid Environment"
1129
  msgstr ""
1130
 
1131
- #: includes/gateways/settings/ach-settings-v2.php:20
1132
  #: includes/gateways/settings/ach-settings.php:21
1133
  msgid "Sandbox"
1134
  msgstr ""
1135
 
1136
- #: includes/gateways/settings/ach-settings-v2.php:21
1137
  #: includes/gateways/settings/ach-settings.php:22
1138
  msgid "Development"
1139
  msgstr ""
1140
 
1141
- #: includes/gateways/settings/ach-settings-v2.php:22
1142
  #: includes/gateways/settings/ach-settings.php:23
1143
  msgid "Production"
1144
  msgstr ""
1145
 
1146
- #: includes/gateways/settings/ach-settings-v2.php:24
1147
- msgid "This setting determines the Plaid environment you are connecting with. When you are ready to accept live transactions, switch this option to Production.<br><strong>Production</strong> - accept live ACH payments <br><strong>Development</strong> - use real bank login details with test transactions <br><strong>Sandbox</strong> - test integration using test credentials"
1148
- msgstr ""
1149
-
1150
- #: includes/gateways/settings/ach-settings-v2.php:69
1151
- #: includes/gateways/settings/ach-settings.php:78
1152
- msgid "ACH Payment"
1153
- msgstr ""
1154
-
1155
- #: includes/gateways/settings/ach-settings-v2.php:82
1156
- #: includes/gateways/settings/ach-settings.php:91
1157
- msgid "Client Name"
1158
  msgstr ""
1159
 
1160
- #: includes/gateways/settings/ach-settings-v2.php:84
1161
- #: includes/gateways/settings/ach-settings.php:93
1162
- msgid "The name that appears on the ACH payment screen."
1163
  msgstr ""
1164
 
1165
- #: includes/gateways/settings/ach-settings-v2.php:88
1166
- #: includes/gateways/settings/ach-settings.php:97
1167
- msgid "ACH Display"
1168
  msgstr ""
1169
 
1170
- #: includes/gateways/settings/ach-settings-v2.php:98
1171
- #: includes/gateways/settings/ach-settings.php:107
1172
- msgid "ACH Fee"
1173
  msgstr ""
1174
 
1175
- #: includes/gateways/settings/ach-settings-v2.php:108
1176
- #: includes/gateways/settings/ach-settings.php:117
1177
- msgid "None"
1178
  msgstr ""
1179
 
1180
- #: includes/gateways/settings/ach-settings-v2.php:109
1181
- #: includes/gateways/settings/ach-settings.php:118
1182
- msgid "Amount"
1183
  msgstr ""
1184
 
1185
- #: includes/gateways/settings/ach-settings-v2.php:110
1186
- #: includes/gateways/settings/ach-settings.php:119
1187
- msgid "Percentage"
1188
  msgstr ""
1189
 
1190
- #: includes/gateways/settings/ach-settings-v2.php:113
1191
- #: includes/gateways/settings/ach-settings.php:122
1192
- msgid "You can assign a fee to the order for ACH payments. Amount is a static amount and percentage is a percentage of the cart amount."
1193
  msgstr ""
1194
 
1195
- #: includes/gateways/settings/ach-settings.php:26
1196
- msgid "The active Plaid environment. You must set API mode to live to use Plaid's development environment."
1197
  msgstr ""
1198
 
1199
- #: includes/gateways/settings/ach-settings.php:36
1200
- msgid "ID that identifies your Plaid account."
1201
  msgstr ""
1202
 
1203
- #: includes/gateways/settings/ach-settings.php:43
1204
- msgid "Used to identify ACH payments initiated from your site."
1205
  msgstr ""
1206
 
1207
- #: includes/gateways/settings/ach-settings.php:51
1208
- msgid "Sandbox Secret"
1209
  msgstr ""
1210
 
1211
- #: includes/gateways/settings/ach-settings.php:54
1212
- msgid "Key that acts as a password when connecting to Plaid's sandbox environment."
1213
  msgstr ""
1214
 
1215
- #: includes/gateways/settings/ach-settings.php:58
1216
- msgid "Development Secret"
1217
  msgstr ""
1218
 
1219
- #: includes/gateways/settings/ach-settings.php:61
1220
- msgid "Development allows you to test real bank credentials with test transactions."
1221
  msgstr ""
1222
 
1223
- #: includes/gateways/settings/ach-settings.php:65
1224
- msgid "Production Secret"
1225
  msgstr ""
1226
 
1227
- #: includes/gateways/settings/ach-settings.php:68
1228
- msgid "Key that acts as a password when connecting to Plaid's production environment."
1229
  msgstr ""
1230
 
1231
  #: includes/gateways/settings/applepay-settings.php:5
@@ -1640,218 +1607,218 @@ msgstr ""
1640
  msgid "Kind Regards,"
1641
  msgstr ""
1642
 
1643
- #: includes/wc-stripe-functions.php:811
1644
  msgid "Bootstrap form"
1645
  msgstr ""
1646
 
1647
- #: includes/wc-stripe-functions.php:837
1648
  msgid "Simple form"
1649
  msgstr ""
1650
 
1651
- #: includes/wc-stripe-functions.php:860
1652
  msgid "Minimalist form"
1653
  msgstr ""
1654
 
1655
- #: includes/wc-stripe-functions.php:886
1656
  msgid "Inline Form"
1657
  msgstr ""
1658
 
1659
- #: includes/wc-stripe-functions.php:908
1660
  msgid "Rounded Form"
1661
  msgstr ""
1662
 
1663
- #: includes/wc-stripe-functions.php:1126
1664
  msgid "There was an error processing your credit card."
1665
  msgstr ""
1666
 
1667
- #: includes/wc-stripe-functions.php:1127
1668
  msgid "Your card number is incomplete."
1669
  msgstr ""
1670
 
1671
- #: includes/wc-stripe-functions.php:1128
1672
  msgid "The card number is incorrect. Check the card's number or use a different card."
1673
  msgstr ""
1674
 
1675
- #: includes/wc-stripe-functions.php:1129
1676
  msgid "The card's security code is incorrect. Check the card's security code or use a different card."
1677
  msgstr ""
1678
 
1679
- #: includes/wc-stripe-functions.php:1130
1680
  msgid "The card's ZIP code is incorrect. Check the card's ZIP code or use a different card."
1681
  msgstr ""
1682
 
1683
- #: includes/wc-stripe-functions.php:1131
1684
- #: includes/wc-stripe-functions.php:1136
1685
  msgid "The card number is invalid. Check the card details or use a different card."
1686
  msgstr ""
1687
 
1688
- #: includes/wc-stripe-functions.php:1132
1689
  msgid "This value provided to the field contains characters that are unsupported by the field."
1690
  msgstr ""
1691
 
1692
- #: includes/wc-stripe-functions.php:1133
1693
  msgid "The card's security code is invalid. Check the card's security code or use a different card."
1694
  msgstr ""
1695
 
1696
- #: includes/wc-stripe-functions.php:1134
1697
  msgid "The card's expiration month is incorrect. Check the expiration date or use a different card."
1698
  msgstr ""
1699
 
1700
- #: includes/wc-stripe-functions.php:1135
1701
  msgid "The card's expiration year is incorrect. Check the expiration date or use a different card."
1702
  msgstr ""
1703
 
1704
- #: includes/wc-stripe-functions.php:1137
1705
  msgid "The card's address is incorrect. Check the card's address or use a different card."
1706
  msgstr ""
1707
 
1708
- #: includes/wc-stripe-functions.php:1138
1709
  msgid "The card has expired. Check the expiration date or use a different card."
1710
  msgstr ""
1711
 
1712
- #: includes/wc-stripe-functions.php:1139
1713
  msgid "The card has been declined."
1714
  msgstr ""
1715
 
1716
- #: includes/wc-stripe-functions.php:1140
1717
  msgid "Your card's expiration year is in the past."
1718
  msgstr ""
1719
 
1720
- #: includes/wc-stripe-functions.php:1141
1721
  msgid "The bank account number provided is invalid (e.g., missing digits). Bank account information varies from country to country. We recommend creating validations in your entry forms based on the bank account formats we provide."
1722
  msgstr ""
1723
 
1724
- #: includes/wc-stripe-functions.php:1142
1725
  msgid "The specified amount is greater than the maximum amount allowed. Use a lower amount and try again."
1726
  msgstr ""
1727
 
1728
- #: includes/wc-stripe-functions.php:1143
1729
  msgid "The specified amount is less than the minimum amount allowed. Use a higher amount and try again."
1730
  msgstr ""
1731
 
1732
- #: includes/wc-stripe-functions.php:1144
1733
  msgid "The payment requires authentication to proceed. If your customer is off session, notify your customer to return to your application and complete the payment. If you provided the error_on_requires_action parameter, then your customer should try another card that does not require authentication."
1734
  msgstr ""
1735
 
1736
- #: includes/wc-stripe-functions.php:1145
1737
  msgid "The transfer or payout could not be completed because the associated account does not have a sufficient balance available. Create a new transfer or payout using an amount less than or equal to the account's available balance."
1738
  msgstr ""
1739
 
1740
- #: includes/wc-stripe-functions.php:1146
1741
  msgid "The bank account provided can not be used to charge, either because it is not verified yet or it is not supported."
1742
  msgstr ""
1743
 
1744
- #: includes/wc-stripe-functions.php:1147
1745
  msgid "The bank account provided already exists on the specified Customer object. If the bank account should also be attached to a different customer, include the correct customer ID when making the request again."
1746
  msgstr ""
1747
 
1748
- #: includes/wc-stripe-functions.php:1148
1749
  msgid "The bank account provided cannot be used for payouts. A different bank account must be used."
1750
  msgstr ""
1751
 
1752
- #: includes/wc-stripe-functions.php:1149
1753
  msgid "Your Connect platform is attempting to share an unverified bank account with a connected account."
1754
  msgstr ""
1755
 
1756
- #: includes/wc-stripe-functions.php:1150
1757
  msgid "The bank account cannot be verified, either because the microdeposit amounts provided do not match the actual amounts, or because verification has failed too many times."
1758
  msgstr ""
1759
 
1760
- #: includes/wc-stripe-functions.php:1151
1761
  msgid "This card has been declined too many times. You can try to charge this card again after 24 hours. We suggest reaching out to your customer to make sure they have entered all of their information correctly and that there are no issues with their card."
1762
  msgstr ""
1763
 
1764
- #: includes/wc-stripe-functions.php:1152
1765
  msgid "The charge you're attempting to capture has already been captured. Update the request with an uncaptured charge ID."
1766
  msgstr ""
1767
 
1768
- #: includes/wc-stripe-functions.php:1153
1769
  msgid "The charge you're attempting to refund has already been refunded. Update the request to use the ID of a charge that has not been refunded."
1770
  msgstr ""
1771
 
1772
- #: includes/wc-stripe-functions.php:1154
1773
  msgid "The charge you're attempting to refund has been charged back. Check the disputes documentation to learn how to respond to the dispute."
1774
  msgstr ""
1775
 
1776
- #: includes/wc-stripe-functions.php:1155
1777
  msgid "This charge would cause you to exceed your rolling-window processing limit for this source type. Please retry the charge later, or contact us to request a higher processing limit."
1778
  msgstr ""
1779
 
1780
- #: includes/wc-stripe-functions.php:1156
1781
  msgid "The charge cannot be captured as the authorization has expired. Auth and capture charges must be captured within seven days."
1782
  msgstr ""
1783
 
1784
- #: includes/wc-stripe-functions.php:1157
1785
  msgid "One or more provided parameters was not allowed for the given operation on the Charge. Check our API reference or the returned error message to see which values were not correct for that Charge."
1786
  msgstr ""
1787
 
1788
- #: includes/wc-stripe-functions.php:1158
1789
  msgid "The email address is invalid (e.g., not properly formatted). Check that the email address is properly formatted and only includes allowed characters."
1790
  msgstr ""
1791
 
1792
- #: includes/wc-stripe-functions.php:1159
1793
  msgid "The idempotency key provided is currently being used in another request. This occurs if your integration is making duplicate requests simultaneously."
1794
  msgstr ""
1795
 
1796
- #: includes/wc-stripe-functions.php:1160
1797
  msgid "The specified amount is invalid. The charge amount must be a positive integer in the smallest currency unit, and not exceed the minimum or maximum amount."
1798
  msgstr ""
1799
 
1800
- #: includes/wc-stripe-functions.php:1161
1801
  msgid "The source cannot be used because it is not in the correct state (e.g., a charge request is trying to use a source with a pending, failed, or consumed source). Check the status of the source you are attempting to use."
1802
  msgstr ""
1803
 
1804
- #: includes/wc-stripe-functions.php:1162
1805
  msgid "Both a customer and source ID have been provided, but the source has not been saved to the customer. To create a charge for a customer with a specified source, you must first save the card details."
1806
  msgstr ""
1807
 
1808
- #: includes/wc-stripe-functions.php:1163
1809
  msgid "The ZIP code provided was incorrect."
1810
  msgstr ""
1811
 
1812
- #: includes/wc-stripe-functions.php:1164
1813
  msgid "An error occurred while processing the card. Try again later or with a different payment method."
1814
  msgstr ""
1815
 
1816
- #: includes/wc-stripe-functions.php:1165
1817
  msgid "The card does not support this type of purchase."
1818
  msgstr ""
1819
 
1820
- #: includes/wc-stripe-functions.php:1166
1821
- #: includes/wc-stripe-functions.php:1169
1822
  #: includes/wc-stripe-functions.php:1171
 
1823
  msgid "The card has been declined for an unknown reason."
1824
  msgstr ""
1825
 
1826
- #: includes/wc-stripe-functions.php:1167
1827
  msgid "The customer has exceeded the balance or credit limit available on their card."
1828
  msgstr ""
1829
 
1830
- #: includes/wc-stripe-functions.php:1168
1831
  msgid "The card does not support the specified currency."
1832
  msgstr ""
1833
 
1834
- #: includes/wc-stripe-functions.php:1170
1835
  msgid "The payment has been declined as Stripe suspects it is fraudulent."
1836
  msgstr ""
1837
 
1838
- #: includes/wc-stripe-functions.php:1172
1839
  msgid "The PIN entered is incorrect. "
1840
  msgstr ""
1841
 
1842
- #: includes/wc-stripe-functions.php:1173
1843
  msgid "The card has insufficient funds to complete the purchase."
1844
  msgstr ""
1845
 
1846
- #: includes/wc-stripe-functions.php:1174
1847
  msgid "Please select a payment method before proceeding."
1848
  msgstr ""
1849
 
1850
- #: includes/wc-stripe-functions.php:1175
1851
  msgid "Please enter your IBAN before proceeding."
1852
  msgstr ""
1853
 
1854
- #: includes/wc-stripe-functions.php:1176
1855
  msgid "Please select a bank before proceeding"
1856
  msgstr ""
1857
 
2
  # This file is distributed under the same license as the Stripe For WooCommerce plugin.
3
  msgid ""
4
  msgstr ""
5
+ "Project-Id-Version: Stripe For WooCommerce 3.2.1\n"
6
  "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/woo-stripe-payment\n"
7
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
8
  "Language-Team: LANGUAGE <LL@li.org>\n"
9
  "MIME-Version: 1.0\n"
10
  "Content-Type: text/plain; charset=UTF-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
12
+ "POT-Creation-Date: 2020-09-01T03:03:02+00:00\n"
13
  "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
14
  "X-Generator: WP-CLI 2.4.0\n"
15
  "X-Domain: woo-stripe-payment\n"
32
 
33
  #: includes/abstract/abstract-wc-payment-gateway-stripe-local-payment.php:105
34
  #: includes/admin/meta-boxes/views/html-product-data.php:14
 
35
  #: includes/gateways/settings/ach-settings.php:9
36
  #: includes/gateways/settings/applepay-settings.php:11
37
  #: includes/gateways/settings/cc-settings.php:4
45
  msgstr ""
46
 
47
  #: includes/abstract/abstract-wc-payment-gateway-stripe-local-payment.php:114
48
+ #: includes/gateways/settings/ach-settings.php:66
 
49
  #: includes/gateways/settings/applepay-settings.php:20
50
  #: includes/gateways/settings/cc-settings.php:17
51
  #: includes/gateways/settings/googlepay-settings.php:31
55
 
56
  #: includes/abstract/abstract-wc-payment-gateway-stripe-local-payment.php:118
57
  #: includes/admin/meta-boxes/views/html-charge-data-subview.php:47
58
+ #: includes/gateways/settings/ach-settings.php:70
 
59
  #: includes/gateways/settings/applepay-settings.php:24
60
  #: includes/gateways/settings/cc-settings.php:21
61
  #: includes/gateways/settings/googlepay-settings.php:41
64
  msgstr ""
65
 
66
  #: includes/abstract/abstract-wc-payment-gateway-stripe-local-payment.php:124
67
+ #: includes/gateways/settings/ach-settings.php:76
 
68
  #: includes/gateways/settings/applepay-settings.php:30
69
  #: includes/gateways/settings/cc-settings.php:27
70
  #: includes/gateways/settings/googlepay-settings.php:47
73
  msgstr ""
74
 
75
  #: includes/abstract/abstract-wc-payment-gateway-stripe-local-payment.php:127
76
+ #: includes/gateways/settings/ach-settings.php:79
 
77
  #: includes/gateways/settings/applepay-settings.php:33
78
  #: includes/gateways/settings/cc-settings.php:30
79
  #: includes/gateways/settings/googlepay-settings.php:50
93
  msgid " & billing country is <strong>%s</strong>"
94
  msgstr ""
95
 
96
+ #: includes/abstract/abstract-wc-payment-gateway-stripe.php:417
97
  #: includes/controllers/class-wc-stripe-controller-cart.php:136
98
+ #: includes/controllers/class-wc-stripe-controller-cart.php:196
99
+ #: includes/controllers/class-wc-stripe-controller-googlepay.php:137
100
  #: includes/gateways/class-wc-payment-gateway-stripe-googlepay.php:103
101
  msgid "Total"
102
  msgstr ""
103
 
104
+ #: includes/abstract/abstract-wc-payment-gateway-stripe.php:477
105
  msgid "User must be logged in."
106
  msgstr ""
107
 
108
+ #: includes/abstract/abstract-wc-payment-gateway-stripe.php:489
109
  msgid "Error saving your payment method. Reason: %s"
110
  msgstr ""
111
 
112
+ #: includes/abstract/abstract-wc-payment-gateway-stripe.php:504
113
  msgid "Error saving payment method. Reason: %s"
114
  msgstr ""
115
 
116
+ #: includes/abstract/abstract-wc-payment-gateway-stripe.php:523
117
  msgid "Order refunded in Stripe. Amount: %s"
118
  msgstr ""
119
 
120
+ #: includes/abstract/abstract-wc-payment-gateway-stripe.php:561
121
  msgid "Order amount captured in Stripe. Amount: %s"
122
  msgstr ""
123
 
124
+ #: includes/abstract/abstract-wc-payment-gateway-stripe.php:571
125
  msgid "Error capturing charge in Stripe. Reason: %s"
126
  msgstr ""
127
 
128
+ #: includes/abstract/abstract-wc-payment-gateway-stripe.php:592
129
  msgid "Error voiding charge. Reason: %s"
130
  msgstr ""
131
 
132
+ #: includes/abstract/abstract-wc-payment-gateway-stripe.php:594
133
  msgid "Charge voided in Stripe."
134
  msgstr ""
135
 
136
+ #: includes/abstract/abstract-wc-payment-gateway-stripe.php:764
137
  msgid "n/a"
138
  msgstr ""
139
 
140
+ #: includes/abstract/abstract-wc-payment-gateway-stripe.php:792
141
  #: includes/admin/meta-boxes/views/html-order-pay.php:42
142
  msgid "New Card"
143
  msgstr ""
144
 
145
+ #: includes/abstract/abstract-wc-payment-gateway-stripe.php:796
146
  #: includes/admin/meta-boxes/views/html-order-pay.php:30
147
  msgid "Saved Cards"
148
  msgstr ""
149
 
150
+ #: includes/abstract/abstract-wc-payment-gateway-stripe.php:999
151
  msgid "Attemp to save payment method failed. Reason: %s"
152
  msgstr ""
153
 
154
+ #: includes/abstract/abstract-wc-payment-gateway-stripe.php:1021
155
  msgid "We were not able to save your payment method. To prevent billing issues with your subscription, please add a payment method to the subscription."
156
  msgstr ""
157
 
158
+ #: includes/abstract/abstract-wc-payment-gateway-stripe.php:1023
159
  msgid "We were not able to save your payment method. Reason: %s"
160
  msgstr ""
161
 
162
+ #: includes/abstract/abstract-wc-payment-gateway-stripe.php:1057
163
  msgid "Payment Method Token"
164
  msgstr ""
165
 
166
+ #: includes/abstract/abstract-wc-payment-gateway-stripe.php:1077
167
  msgid "Recurring payment for order failed. Reason: %s"
168
  msgstr ""
169
 
170
+ #: includes/abstract/abstract-wc-payment-gateway-stripe.php:1090
171
  msgid "Recurring payment captured in Stripe. Payment method: %s"
172
  msgstr ""
173
 
174
+ #: includes/abstract/abstract-wc-payment-gateway-stripe.php:1092
175
  msgid "Recurring payment authorized in Stripe. Payment method: %s"
176
  msgstr ""
177
 
178
+ #: includes/abstract/abstract-wc-payment-gateway-stripe.php:1095
179
+ #: includes/abstract/abstract-wc-payment-gateway-stripe.php:1354
180
  msgid "Customer must manually complete payment for payment method %s"
181
  msgstr ""
182
 
183
+ #: includes/abstract/abstract-wc-payment-gateway-stripe.php:1111
184
  msgid "Error saving payment method for subscription. Reason: %s"
185
  msgstr ""
186
 
187
+ #: includes/abstract/abstract-wc-payment-gateway-stripe.php:1172
188
  #: includes/abstract/abstract-wc-stripe-payment.php:219
189
  msgid "Order %1$s from %2$s"
190
  msgstr ""
191
 
192
+ #: includes/abstract/abstract-wc-payment-gateway-stripe.php:1341
193
  msgid "Pre-order payment for order failed. Reason: %s"
194
  msgstr ""
195
 
196
+ #: includes/abstract/abstract-wc-payment-gateway-stripe.php:1349
197
  msgid "Pre-order payment captured in Stripe. Payment method: %s"
198
  msgstr ""
199
 
200
+ #: includes/abstract/abstract-wc-payment-gateway-stripe.php:1351
201
  msgid "Pre-order payment authorized in Stripe. Payment method: %s"
202
  msgstr ""
203
 
204
+ #: includes/abstract/abstract-wc-payment-gateway-stripe.php:1423
205
  msgid "Cannot process payment"
206
  msgstr ""
207
 
208
+ #: includes/abstract/abstract-wc-payment-gateway-stripe.php:1431
209
  msgid "Increase your conversion rate by offering %1$s on your Product and Cart pages, or at the top of the checkout page. <br/><strong>Note:</strong> you can control which products display %s by going to the product edit page."
210
  msgstr ""
211
 
212
+ #: includes/abstract/abstract-wc-payment-gateway-stripe.php:1542
213
+ #: includes/abstract/abstract-wc-payment-gateway-stripe.php:1573
214
+ #: includes/gateways/class-wc-payment-gateway-stripe-klarna.php:189
215
+ #: includes/wc-stripe-functions.php:405
216
+ #: includes/wc-stripe-functions.php:470
217
+ msgid "Shipping"
218
+ msgstr ""
219
+
220
+ #: includes/abstract/abstract-wc-payment-gateway-stripe.php:1550
221
+ #: includes/abstract/abstract-wc-payment-gateway-stripe.php:1576
222
+ #: includes/gateways/class-wc-payment-gateway-stripe-klarna.php:199
223
+ #: includes/wc-stripe-functions.php:422
224
+ #: includes/wc-stripe-functions.php:478
225
+ msgid "Discount"
226
+ msgstr ""
227
+
228
+ #: includes/abstract/abstract-wc-payment-gateway-stripe.php:1553
229
+ #: includes/gateways/class-wc-payment-gateway-stripe-klarna.php:221
230
+ #: includes/wc-stripe-functions.php:430
231
+ msgid "Tax"
232
+ msgstr ""
233
+
234
+ #: includes/abstract/abstract-wc-payment-gateway-stripe.php:1583
235
+ #: includes/wc-stripe-functions.php:489
236
+ msgid "Fees"
237
+ msgstr ""
238
+
239
  #: includes/abstract/abstract-wc-stripe-payment.php:104
240
  msgid "Charge %1$s is pending. Payment Method: %2$s. Payment will be completed once charge.succeeded webhook received from Stripe."
241
  msgstr ""
256
  msgid "Transaction Id cannot be empty."
257
  msgstr ""
258
 
259
+ #: includes/abstract/abstract-wc-stripe-payment.php:286
260
+ #: includes/gateways/class-wc-payment-gateway-stripe-ach.php:116
261
  msgid "Error processing payment. Reason: %s"
262
  msgstr ""
263
 
324
  #: includes/admin/meta-boxes/views/html-charge-data-subview.php:14
325
  #: includes/admin/meta-boxes/views/html-order-actions.php:48
326
  #: includes/admin/meta-boxes/views/html-order-pay.php:23
327
+ #: includes/admin/meta-boxes/views/html-product-data.php:47
328
  #: includes/gateways/settings/applepay-settings.php:52
329
  #: includes/gateways/settings/cc-settings.php:49
330
  #: includes/gateways/settings/googlepay-settings.php:69
459
  msgstr ""
460
 
461
  #: includes/admin/meta-boxes/views/html-order-pay.php:24
462
+ #: includes/admin/meta-boxes/views/html-product-data.php:49
463
  #: includes/gateways/settings/applepay-settings.php:53
464
  #: includes/gateways/settings/cc-settings.php:50
465
  #: includes/gateways/settings/googlepay-settings.php:70
479
  msgid "Method"
480
  msgstr ""
481
 
482
+ #: includes/admin/meta-boxes/views/html-product-data.php:60
483
  msgid "Button Position"
484
  msgstr ""
485
 
486
+ #: includes/admin/meta-boxes/views/html-product-data.php:62
487
  msgid "Below add to cart"
488
  msgstr ""
489
 
490
+ #: includes/admin/meta-boxes/views/html-product-data.php:63
491
  msgid "Above add to cart"
492
  msgstr ""
493
 
494
+ #: includes/admin/meta-boxes/views/html-product-data.php:66
495
  msgid "The location of the payment buttons in relation to the Add to Cart button."
496
  msgstr ""
497
 
498
+ #: includes/admin/meta-boxes/views/html-product-data.php:75
499
  msgid "Save"
500
  msgstr ""
501
 
660
  msgid "Your payment is being processed and your order status will be updated once the funds are received."
661
  msgstr ""
662
 
663
+ #: includes/class-wc-stripe-frontend-scripts.php:75
664
  msgid "No matches found"
665
  msgstr ""
666
 
680
  msgid "Payment authorization failed."
681
  msgstr ""
682
 
683
+ #: includes/class-wc-stripe-rest-api.php:38
684
  msgid "%1$s is an invalid controller name."
685
  msgstr ""
686
 
692
  msgid "Quantity must be greater than zero."
693
  msgstr ""
694
 
695
+ #: includes/controllers/class-wc-stripe-controller-checkout.php:229
696
  msgid "Some required fields were missing. Please click %1$shere%2$s to complete your payment."
697
  msgstr ""
698
 
699
+ #: includes/controllers/class-wc-stripe-controller-checkout.php:278
700
  msgid "Please review your order details then click Place Order."
701
  msgstr ""
702
 
787
  msgid "Bank Payment"
788
  msgstr ""
789
 
790
+ #: includes/gateways/class-wc-payment-gateway-stripe-ach.php:242
791
  msgid "Saved Banks"
792
  msgstr ""
793
 
794
+ #: includes/gateways/class-wc-payment-gateway-stripe-ach.php:246
795
  msgid "New Bank"
796
  msgstr ""
797
 
798
+ #: includes/gateways/class-wc-payment-gateway-stripe-ach.php:290
799
  msgid "You must set the API mode to live in order to enable the Plaid development environment."
800
  msgstr ""
801
 
926
  msgid "Please update you product quantity before using Google Pay."
927
  msgstr ""
928
 
929
+ #: includes/gateways/class-wc-payment-gateway-stripe-googlepay.php:160
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
930
  msgid "Waiting..."
931
  msgstr ""
932
 
933
+ #: includes/gateways/class-wc-payment-gateway-stripe-googlepay.php:161
934
  msgid "loading shipping methods..."
935
  msgstr ""
936
 
1099
  msgid "Scan the QR code using your WeChat app. Once scanned click the Place Order button."
1100
  msgstr ""
1101
 
 
1102
  #: includes/gateways/settings/ach-settings.php:5
1103
  msgid "For US customers only."
1104
  msgstr ""
1105
 
 
1106
  #: includes/gateways/settings/ach-settings.php:6
1107
  msgid "Read through our %1$sdocumentation%2$s to configure ACH payments"
1108
  msgstr ""
1109
 
 
1110
  #: includes/gateways/settings/ach-settings.php:14
1111
  msgid "If enabled, your site can accept ACH payments through Stripe."
1112
  msgstr ""
1113
 
 
1114
  #: includes/gateways/settings/ach-settings.php:18
1115
  msgid "Plaid Environment"
1116
  msgstr ""
1117
 
 
1118
  #: includes/gateways/settings/ach-settings.php:21
1119
  msgid "Sandbox"
1120
  msgstr ""
1121
 
 
1122
  #: includes/gateways/settings/ach-settings.php:22
1123
  msgid "Development"
1124
  msgstr ""
1125
 
 
1126
  #: includes/gateways/settings/ach-settings.php:23
1127
  msgid "Production"
1128
  msgstr ""
1129
 
1130
+ #: includes/gateways/settings/ach-settings.php:26
1131
+ msgid "The active Plaid environment. You must set API mode to live to use Plaid's development environment."
 
 
 
 
 
 
 
 
 
 
1132
  msgstr ""
1133
 
1134
+ #: includes/gateways/settings/ach-settings.php:36
1135
+ msgid "ID that identifies your Plaid account."
 
1136
  msgstr ""
1137
 
1138
+ #: includes/gateways/settings/ach-settings.php:44
1139
+ msgid "Sandbox Secret"
 
1140
  msgstr ""
1141
 
1142
+ #: includes/gateways/settings/ach-settings.php:47
1143
+ msgid "Key that acts as a password when connecting to Plaid's sandbox environment."
 
1144
  msgstr ""
1145
 
1146
+ #: includes/gateways/settings/ach-settings.php:51
1147
+ msgid "Development Secret"
 
1148
  msgstr ""
1149
 
1150
+ #: includes/gateways/settings/ach-settings.php:54
1151
+ msgid "Development allows you to test real bank credentials with test transactions."
 
1152
  msgstr ""
1153
 
1154
+ #: includes/gateways/settings/ach-settings.php:58
1155
+ msgid "Production Secret"
 
1156
  msgstr ""
1157
 
1158
+ #: includes/gateways/settings/ach-settings.php:61
1159
+ msgid "Key that acts as a password when connecting to Plaid's production environment."
 
1160
  msgstr ""
1161
 
1162
+ #: includes/gateways/settings/ach-settings.php:71
1163
+ msgid "ACH Payment"
1164
  msgstr ""
1165
 
1166
+ #: includes/gateways/settings/ach-settings.php:84
1167
+ msgid "Client Name"
1168
  msgstr ""
1169
 
1170
+ #: includes/gateways/settings/ach-settings.php:86
1171
+ msgid "The name that appears on the ACH payment screen."
1172
  msgstr ""
1173
 
1174
+ #: includes/gateways/settings/ach-settings.php:90
1175
+ msgid "ACH Display"
1176
  msgstr ""
1177
 
1178
+ #: includes/gateways/settings/ach-settings.php:100
1179
+ msgid "ACH Fee"
1180
  msgstr ""
1181
 
1182
+ #: includes/gateways/settings/ach-settings.php:110
1183
+ msgid "None"
1184
  msgstr ""
1185
 
1186
+ #: includes/gateways/settings/ach-settings.php:111
1187
+ msgid "Amount"
1188
  msgstr ""
1189
 
1190
+ #: includes/gateways/settings/ach-settings.php:112
1191
+ msgid "Percentage"
1192
  msgstr ""
1193
 
1194
+ #: includes/gateways/settings/ach-settings.php:115
1195
+ msgid "You can assign a fee to the order for ACH payments. Amount is a static amount and percentage is a percentage of the cart amount."
1196
  msgstr ""
1197
 
1198
  #: includes/gateways/settings/applepay-settings.php:5
1607
  msgid "Kind Regards,"
1608
  msgstr ""
1609
 
1610
+ #: includes/wc-stripe-functions.php:813
1611
  msgid "Bootstrap form"
1612
  msgstr ""
1613
 
1614
+ #: includes/wc-stripe-functions.php:839
1615
  msgid "Simple form"
1616
  msgstr ""
1617
 
1618
+ #: includes/wc-stripe-functions.php:862
1619
  msgid "Minimalist form"
1620
  msgstr ""
1621
 
1622
+ #: includes/wc-stripe-functions.php:888
1623
  msgid "Inline Form"
1624
  msgstr ""
1625
 
1626
+ #: includes/wc-stripe-functions.php:910
1627
  msgid "Rounded Form"
1628
  msgstr ""
1629
 
1630
+ #: includes/wc-stripe-functions.php:1128
1631
  msgid "There was an error processing your credit card."
1632
  msgstr ""
1633
 
1634
+ #: includes/wc-stripe-functions.php:1129
1635
  msgid "Your card number is incomplete."
1636
  msgstr ""
1637
 
1638
+ #: includes/wc-stripe-functions.php:1130
1639
  msgid "The card number is incorrect. Check the card's number or use a different card."
1640
  msgstr ""
1641
 
1642
+ #: includes/wc-stripe-functions.php:1131
1643
  msgid "The card's security code is incorrect. Check the card's security code or use a different card."
1644
  msgstr ""
1645
 
1646
+ #: includes/wc-stripe-functions.php:1132
1647
  msgid "The card's ZIP code is incorrect. Check the card's ZIP code or use a different card."
1648
  msgstr ""
1649
 
1650
+ #: includes/wc-stripe-functions.php:1133
1651
+ #: includes/wc-stripe-functions.php:1138
1652
  msgid "The card number is invalid. Check the card details or use a different card."
1653
  msgstr ""
1654
 
1655
+ #: includes/wc-stripe-functions.php:1134
1656
  msgid "This value provided to the field contains characters that are unsupported by the field."
1657
  msgstr ""
1658
 
1659
+ #: includes/wc-stripe-functions.php:1135
1660
  msgid "The card's security code is invalid. Check the card's security code or use a different card."
1661
  msgstr ""
1662
 
1663
+ #: includes/wc-stripe-functions.php:1136
1664
  msgid "The card's expiration month is incorrect. Check the expiration date or use a different card."
1665
  msgstr ""
1666
 
1667
+ #: includes/wc-stripe-functions.php:1137
1668
  msgid "The card's expiration year is incorrect. Check the expiration date or use a different card."
1669
  msgstr ""
1670
 
1671
+ #: includes/wc-stripe-functions.php:1139
1672
  msgid "The card's address is incorrect. Check the card's address or use a different card."
1673
  msgstr ""
1674
 
1675
+ #: includes/wc-stripe-functions.php:1140
1676
  msgid "The card has expired. Check the expiration date or use a different card."
1677
  msgstr ""
1678
 
1679
+ #: includes/wc-stripe-functions.php:1141
1680
  msgid "The card has been declined."
1681
  msgstr ""
1682
 
1683
+ #: includes/wc-stripe-functions.php:1142
1684
  msgid "Your card's expiration year is in the past."
1685
  msgstr ""
1686
 
1687
+ #: includes/wc-stripe-functions.php:1143
1688
  msgid "The bank account number provided is invalid (e.g., missing digits). Bank account information varies from country to country. We recommend creating validations in your entry forms based on the bank account formats we provide."
1689
  msgstr ""
1690
 
1691
+ #: includes/wc-stripe-functions.php:1144
1692
  msgid "The specified amount is greater than the maximum amount allowed. Use a lower amount and try again."
1693
  msgstr ""
1694
 
1695
+ #: includes/wc-stripe-functions.php:1145
1696
  msgid "The specified amount is less than the minimum amount allowed. Use a higher amount and try again."
1697
  msgstr ""
1698
 
1699
+ #: includes/wc-stripe-functions.php:1146
1700
  msgid "The payment requires authentication to proceed. If your customer is off session, notify your customer to return to your application and complete the payment. If you provided the error_on_requires_action parameter, then your customer should try another card that does not require authentication."
1701
  msgstr ""
1702
 
1703
+ #: includes/wc-stripe-functions.php:1147
1704
  msgid "The transfer or payout could not be completed because the associated account does not have a sufficient balance available. Create a new transfer or payout using an amount less than or equal to the account's available balance."
1705
  msgstr ""
1706
 
1707
+ #: includes/wc-stripe-functions.php:1148
1708
  msgid "The bank account provided can not be used to charge, either because it is not verified yet or it is not supported."
1709
  msgstr ""
1710
 
1711
+ #: includes/wc-stripe-functions.php:1149
1712
  msgid "The bank account provided already exists on the specified Customer object. If the bank account should also be attached to a different customer, include the correct customer ID when making the request again."
1713
  msgstr ""
1714
 
1715
+ #: includes/wc-stripe-functions.php:1150
1716
  msgid "The bank account provided cannot be used for payouts. A different bank account must be used."
1717
  msgstr ""
1718
 
1719
+ #: includes/wc-stripe-functions.php:1151
1720
  msgid "Your Connect platform is attempting to share an unverified bank account with a connected account."
1721
  msgstr ""
1722
 
1723
+ #: includes/wc-stripe-functions.php:1152
1724
  msgid "The bank account cannot be verified, either because the microdeposit amounts provided do not match the actual amounts, or because verification has failed too many times."
1725
  msgstr ""
1726
 
1727
+ #: includes/wc-stripe-functions.php:1153
1728
  msgid "This card has been declined too many times. You can try to charge this card again after 24 hours. We suggest reaching out to your customer to make sure they have entered all of their information correctly and that there are no issues with their card."
1729
  msgstr ""
1730
 
1731
+ #: includes/wc-stripe-functions.php:1154
1732
  msgid "The charge you're attempting to capture has already been captured. Update the request with an uncaptured charge ID."
1733
  msgstr ""
1734
 
1735
+ #: includes/wc-stripe-functions.php:1155
1736
  msgid "The charge you're attempting to refund has already been refunded. Update the request to use the ID of a charge that has not been refunded."
1737
  msgstr ""
1738
 
1739
+ #: includes/wc-stripe-functions.php:1156
1740
  msgid "The charge you're attempting to refund has been charged back. Check the disputes documentation to learn how to respond to the dispute."
1741
  msgstr ""
1742
 
1743
+ #: includes/wc-stripe-functions.php:1157
1744
  msgid "This charge would cause you to exceed your rolling-window processing limit for this source type. Please retry the charge later, or contact us to request a higher processing limit."
1745
  msgstr ""
1746
 
1747
+ #: includes/wc-stripe-functions.php:1158
1748
  msgid "The charge cannot be captured as the authorization has expired. Auth and capture charges must be captured within seven days."
1749
  msgstr ""
1750
 
1751
+ #: includes/wc-stripe-functions.php:1159
1752
  msgid "One or more provided parameters was not allowed for the given operation on the Charge. Check our API reference or the returned error message to see which values were not correct for that Charge."
1753
  msgstr ""
1754
 
1755
+ #: includes/wc-stripe-functions.php:1160
1756
  msgid "The email address is invalid (e.g., not properly formatted). Check that the email address is properly formatted and only includes allowed characters."
1757
  msgstr ""
1758
 
1759
+ #: includes/wc-stripe-functions.php:1161
1760
  msgid "The idempotency key provided is currently being used in another request. This occurs if your integration is making duplicate requests simultaneously."
1761
  msgstr ""
1762
 
1763
+ #: includes/wc-stripe-functions.php:1162
1764
  msgid "The specified amount is invalid. The charge amount must be a positive integer in the smallest currency unit, and not exceed the minimum or maximum amount."
1765
  msgstr ""
1766
 
1767
+ #: includes/wc-stripe-functions.php:1163
1768
  msgid "The source cannot be used because it is not in the correct state (e.g., a charge request is trying to use a source with a pending, failed, or consumed source). Check the status of the source you are attempting to use."
1769
  msgstr ""
1770
 
1771
+ #: includes/wc-stripe-functions.php:1164
1772
  msgid "Both a customer and source ID have been provided, but the source has not been saved to the customer. To create a charge for a customer with a specified source, you must first save the card details."
1773
  msgstr ""
1774
 
1775
+ #: includes/wc-stripe-functions.php:1165
1776
  msgid "The ZIP code provided was incorrect."
1777
  msgstr ""
1778
 
1779
+ #: includes/wc-stripe-functions.php:1166
1780
  msgid "An error occurred while processing the card. Try again later or with a different payment method."
1781
  msgstr ""
1782
 
1783
+ #: includes/wc-stripe-functions.php:1167
1784
  msgid "The card does not support this type of purchase."
1785
  msgstr ""
1786
 
1787
+ #: includes/wc-stripe-functions.php:1168
 
1788
  #: includes/wc-stripe-functions.php:1171
1789
+ #: includes/wc-stripe-functions.php:1173
1790
  msgid "The card has been declined for an unknown reason."
1791
  msgstr ""
1792
 
1793
+ #: includes/wc-stripe-functions.php:1169
1794
  msgid "The customer has exceeded the balance or credit limit available on their card."
1795
  msgstr ""
1796
 
1797
+ #: includes/wc-stripe-functions.php:1170
1798
  msgid "The card does not support the specified currency."
1799
  msgstr ""
1800
 
1801
+ #: includes/wc-stripe-functions.php:1172
1802
  msgid "The payment has been declined as Stripe suspects it is fraudulent."
1803
  msgstr ""
1804
 
1805
+ #: includes/wc-stripe-functions.php:1174
1806
  msgid "The PIN entered is incorrect. "
1807
  msgstr ""
1808
 
1809
+ #: includes/wc-stripe-functions.php:1175
1810
  msgid "The card has insufficient funds to complete the purchase."
1811
  msgstr ""
1812
 
1813
+ #: includes/wc-stripe-functions.php:1176
1814
  msgid "Please select a payment method before proceeding."
1815
  msgstr ""
1816
 
1817
+ #: includes/wc-stripe-functions.php:1177
1818
  msgid "Please enter your IBAN before proceeding."
1819
  msgstr ""
1820
 
1821
+ #: includes/wc-stripe-functions.php:1178
1822
  msgid "Please select a bank before proceeding"
1823
  msgstr ""
1824
 
includes/abstract/abstract-wc-payment-gateway-stripe.php CHANGED
@@ -882,7 +882,24 @@ abstract class WC_Payment_Gateway_Stripe extends WC_Payment_Gateway {
882
  * @return []
883
  */
884
  public function get_display_items( $page = 'checkout', $order = null ) {
885
- return wc_stripe_get_display_items( $page, $order );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
886
  }
887
 
888
  /**
@@ -891,10 +908,11 @@ abstract class WC_Payment_Gateway_Stripe extends WC_Payment_Gateway {
891
  *
892
  * @param bool $encode
893
  *
894
- * @return []
 
895
  */
896
  public function get_shipping_methods() {
897
- return wc_stripe_get_shipping_options();
898
  }
899
 
900
  /**
@@ -1423,19 +1441,28 @@ abstract class WC_Payment_Gateway_Stripe extends WC_Payment_Gateway {
1423
  $order = null;
1424
  $data = array(
1425
  'items' => $this->has_digital_wallet ? $this->get_display_items( $page ) : array(),
1426
- 'shipping_options' => $this->has_digital_wallet ? $this->get_shipping_methods() : array(),
1427
  'total' => WC()->cart->total,
1428
  'total_cents' => wc_stripe_add_number_precision( WC()->cart->total, get_woocommerce_currency() ),
1429
  'currency' => get_woocommerce_currency()
1430
  );
1431
- if ( ! empty( $wp->query_vars['order-pay'] ) ) {
1432
- $order = wc_get_order( absint( $wp->query_vars['order-pay'] ) );
1433
- $page = 'order_pay';
1434
- $data['needs_shipping'] = false;
1435
- $data['items'] = $this->has_digital_wallet ? $this->get_display_items( $page, $order ) : array();
1436
- $data['total'] = $order->get_total();
1437
- $data['total_cents'] = wc_stripe_add_number_precision( $order->get_total(), $order->get_currency() );
1438
- $data['currency'] = $order->get_currency();
 
 
 
 
 
 
 
 
 
1439
  } elseif ( 'product' === $page ) {
1440
  global $product;
1441
  $data['needs_shipping'] = $product->needs_shipping();
@@ -1444,11 +1471,6 @@ abstract class WC_Payment_Gateway_Stripe extends WC_Payment_Gateway {
1444
  'price' => $product->get_price(),
1445
  'variation' => false
1446
  );
1447
- } elseif ( in_array( $page, array( 'checkout', 'cart' ) ) ) {
1448
- $data['needs_shipping'] = WC()->cart->needs_shipping();
1449
- if ( is_add_payment_method_page() ) {
1450
- $page = 'add_payment_method';
1451
- }
1452
  }
1453
  /**
1454
  * @param array $data
@@ -1458,7 +1480,7 @@ abstract class WC_Payment_Gateway_Stripe extends WC_Payment_Gateway {
1458
  * @since 3.1.8
1459
  */
1460
  $data = apply_filters( 'wc_stripe_output_display_items', $data, $page, $this );
1461
- printf( '<input type="hidden" id="%1$s" data-gateway="%2$s"/>', "{$this->id}_{$page}_data", htmlspecialchars( wp_json_encode( $data ) ) );
1462
  }
1463
 
1464
  /**
@@ -1494,4 +1516,198 @@ abstract class WC_Payment_Gateway_Stripe extends WC_Payment_Gateway {
1494
 
1495
  return $packages;
1496
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1497
  }
882
  * @return []
883
  */
884
  public function get_display_items( $page = 'checkout', $order = null ) {
885
+ global $wp;
886
+ $items = array();
887
+ if ( in_array( $page, array( 'cart', 'checkout' ) ) ) {
888
+ $items = $this->get_display_items_for_cart( WC()->cart );
889
+ } elseif ( 'order_pay' === $page ) {
890
+ $order = ! is_null( $order ) ? $order : wc_get_order( absint( $wp->query_vars['order-pay'] ) );
891
+ $items = $this->get_display_items_for_order( $order );
892
+ } elseif ( 'product' === $page ) {
893
+ global $product;
894
+ $items = array( $this->get_display_item_for_product( $product ) );
895
+ }
896
+
897
+ /**
898
+ * @param array $items
899
+ * @param WC_Order|null $order
900
+ * @param string $page
901
+ */
902
+ return apply_filters( 'wc_stripe_get_display_items', $items, $order, $page );
903
  }
904
 
905
  /**
908
  *
909
  * @param bool $encode
910
  *
911
+ * @return array
912
+ * @deprecated
913
  */
914
  public function get_shipping_methods() {
915
+ return $this->get_formatted_shipping_methods();
916
  }
917
 
918
  /**
1441
  $order = null;
1442
  $data = array(
1443
  'items' => $this->has_digital_wallet ? $this->get_display_items( $page ) : array(),
1444
+ 'shipping_options' => $this->has_digital_wallet ? $this->get_formatted_shipping_methods() : array(),
1445
  'total' => WC()->cart->total,
1446
  'total_cents' => wc_stripe_add_number_precision( WC()->cart->total, get_woocommerce_currency() ),
1447
  'currency' => get_woocommerce_currency()
1448
  );
1449
+ if ( in_array( $page, array( 'checkout', 'cart' ) ) ) {
1450
+ if ( ! empty( $wp->query_vars['order-pay'] ) ) {
1451
+ $order = wc_get_order( absint( $wp->query_vars['order-pay'] ) );
1452
+ $page = 'order_pay';
1453
+ $data['needs_shipping'] = false;
1454
+ $data['items'] = $this->has_digital_wallet ? $this->get_display_items( $page, $order ) : array();
1455
+ $data['total'] = $order->get_total();
1456
+ $data['total_cents'] = wc_stripe_add_number_precision( $order->get_total(), $order->get_currency() );
1457
+ $data['currency'] = $order->get_currency();
1458
+ } else {
1459
+ $data['needs_shipping'] = WC()->cart->needs_shipping();
1460
+ if ( 'checkout' === $page && is_cart() ) {
1461
+ $page = 'cart';
1462
+ } elseif ( is_add_payment_method_page() ) {
1463
+ $page = 'add_payment_method';
1464
+ }
1465
+ }
1466
  } elseif ( 'product' === $page ) {
1467
  global $product;
1468
  $data['needs_shipping'] = $product->needs_shipping();
1471
  'price' => $product->get_price(),
1472
  'variation' => false
1473
  );
 
 
 
 
 
1474
  }
1475
  /**
1476
  * @param array $data
1480
  * @since 3.1.8
1481
  */
1482
  $data = apply_filters( 'wc_stripe_output_display_items', $data, $page, $this );
1483
+ printf( '<input type="hidden" class="%1$s" data-gateway="%2$s"/>', "woocommerce_{$this->id}_gateway_data {$page}-page", htmlspecialchars( wp_json_encode( $data ) ) );
1484
  }
1485
 
1486
  /**
1516
 
1517
  return $packages;
1518
  }
1519
+
1520
+ /**
1521
+ * @param WC_Cart $cart
1522
+ * @param array $items
1523
+ *
1524
+ * @return array
1525
+ * @since 3.2.1
1526
+ */
1527
+ protected function get_display_items_for_cart( $cart, $items = array() ) {
1528
+ $incl_tax = wc_stripe_display_prices_including_tax();
1529
+ foreach ( $cart->get_cart() as $cart_item ) {
1530
+ /**
1531
+ *
1532
+ * @var WC_Product $product
1533
+ */
1534
+ $product = $cart_item['data'];
1535
+ $qty = $cart_item['quantity'];
1536
+ $label = $qty > 1 ? sprintf( '%s X %s', $product->get_name(), $qty ) : $product->get_name();
1537
+ $price = $incl_tax ? wc_get_price_including_tax( $product, array( 'qty' => $qty ) ) : wc_get_price_excluding_tax( $product, array( 'qty' => $qty ) );
1538
+ $items[] = $this->get_display_item_for_cart( $price, $label, 'product', $cart_item, $cart );
1539
+ }
1540
+ if ( $cart->needs_shipping() ) {
1541
+ $price = $incl_tax ? $cart->shipping_total + $cart->shipping_tax_total : $cart->shipping_total;
1542
+ $items[] = $this->get_display_item_for_cart( $price, __( 'Shipping', 'woo-stripe-payment' ), 'shipping' );
1543
+ }
1544
+ foreach ( $cart->get_fees() as $fee ) {
1545
+ $price = $incl_tax ? $fee->total + $fee->tax : $fee->total;
1546
+ $items[] = $this->get_display_item_for_cart( $price, $fee->name, 'fee', $fee, $cart );
1547
+ }
1548
+ if ( 0 < $cart->discount_cart ) {
1549
+ $price = - 1 * abs( $incl_tax ? $cart->discount_cart + $cart->discount_cart_tax : $cart->discount_cart );
1550
+ $items[] = $this->get_display_item_for_cart( $price, __( 'Discount', 'woo-stripe-payment' ), 'discount', $cart );
1551
+ }
1552
+ if ( ! $incl_tax && wc_tax_enabled() ) {
1553
+ $items[] = $this->get_display_item_for_cart( $cart->get_taxes_total(), __( 'Tax', 'woo-stripe-payment' ), 'tax', $cart );
1554
+ }
1555
+
1556
+ return $items;
1557
+ }
1558
+
1559
+ /**
1560
+ * @param WC_Order $order
1561
+ * @param array $items
1562
+ *
1563
+ * @return array
1564
+ * @since 3.2.1
1565
+ */
1566
+ protected function get_display_items_for_order( $order, $items = array() ) {
1567
+ foreach ( $order->get_items() as $item ) {
1568
+ $qty = $item->get_quantity();
1569
+ $label = $qty > 1 ? sprintf( '%s X %s', $item->get_name(), $qty ) : $item->get_name();
1570
+ $items[] = $this->get_display_item_for_order( $item->get_subtotal(), $label, $order, 'item', $item );
1571
+ }
1572
+ if ( 0 < $order->get_shipping_total() ) {
1573
+ $items[] = $this->get_display_item_for_order( $order->get_shipping_total(), __( 'Shipping', 'woo-stripe-payment' ), $order, 'shipping' );
1574
+ }
1575
+ if ( 0 < $order->get_total_discount() ) {
1576
+ $items[] = $this->get_display_item_for_order( - 1 * $order->get_total_discount(), __( 'Discount', 'woo-stripe-payment' ), $order, 'discount' );
1577
+ }
1578
+ if ( 0 < $order->get_fees() ) {
1579
+ $fee_total = 0;
1580
+ foreach ( $order->get_fees() as $fee ) {
1581
+ $fee_total += $fee->get_total();
1582
+ }
1583
+ $items[] = $this->get_display_item_for_order( $fee_total, __( 'Fees', 'woo-stripe-payment' ), $order, 'fee' );
1584
+ }
1585
+ if ( 0 < $order->get_total_tax() ) {
1586
+ $items[] = $this->get_display_item_for_order( $order->get_total_tax(), __( 'Tax', 'woocommerce' ), $order, 'tax' );
1587
+ }
1588
+
1589
+ return $items;
1590
+ }
1591
+
1592
+ /**
1593
+ * @param float $price
1594
+ * @param string $label
1595
+ * @param string $type
1596
+ * @param mixed ...$args
1597
+ *
1598
+ * @return array
1599
+ * @since 3.2.1
1600
+ */
1601
+ protected function get_display_item_for_cart( $price, $label, $type, ...$args ) {
1602
+ return array(
1603
+ 'label' => $label,
1604
+ 'pending' => false,
1605
+ 'amount' => wc_stripe_add_number_precision( $price )
1606
+ );
1607
+ }
1608
+
1609
+ /**
1610
+ * @param float $price
1611
+ * @param string $label
1612
+ * @param WC_Order $order
1613
+ * @param string $type
1614
+ * @param mixed ...$args
1615
+ */
1616
+ protected function get_display_item_for_order( $price, $label, $order, $type, ...$args ) {
1617
+ return array(
1618
+ 'label' => $label,
1619
+ 'pending' => false,
1620
+ 'amount' => wc_stripe_add_number_precision( $price, $order->get_currency() )
1621
+ );
1622
+ }
1623
+
1624
+ /**
1625
+ * @param WC_Product $product
1626
+ *
1627
+ * @return array
1628
+ * @since 3.2.1
1629
+ *
1630
+ */
1631
+ protected function get_display_item_for_product( $product ) {
1632
+ return array(
1633
+ 'label' => esc_attr( $product->get_name() ),
1634
+ 'pending' => true,
1635
+ 'amount' => wc_stripe_add_number_precision( $product->get_price() )
1636
+ );
1637
+ }
1638
+
1639
+ /**
1640
+ * @param array $methods
1641
+ *
1642
+ * @return array
1643
+ * @since 3.2.1
1644
+ */
1645
+ public function get_formatted_shipping_methods( $methods = array() ) {
1646
+ if ( wcs_stripe_active() && WC_Subscriptions_Change_Payment_Gateway::$is_request_to_change_payment ) {
1647
+ return $methods;
1648
+ } else {
1649
+ $methods = array();
1650
+ $packages = $this->get_shipping_packages();
1651
+ $incl_tax = wc_stripe_display_prices_including_tax();
1652
+ foreach ( $packages as $i => $package ) {
1653
+ foreach ( $package['rates'] as $rate ) {
1654
+ $price = $incl_tax ? $rate->cost + $rate->get_shipping_tax() : $rate->cost;
1655
+ $methods[] = $this->get_formatted_shipping_method( $price, $rate, $i, $package, $incl_tax );
1656
+ }
1657
+ }
1658
+ }
1659
+
1660
+ return $methods;
1661
+ }
1662
+
1663
+ /**
1664
+ * @param float $price
1665
+ * @param WC_Shipping_Rate $rate
1666
+ * @param string $i
1667
+ * @param array $package
1668
+ * @param bool $incl_tax
1669
+ *
1670
+ * @return array
1671
+ * @since 3.2.1
1672
+ */
1673
+ public function get_formatted_shipping_method( $price, $rate, $i, $package, $incl_tax ) {
1674
+ $method = array(
1675
+ 'id' => $this->get_shipping_method_id( $rate->id, $i ),
1676
+ 'label' => $this->get_formatted_shipping_label( $price, $rate, $incl_tax ),
1677
+ 'detail' => '',
1678
+ 'amount' => wc_stripe_add_number_precision( $price )
1679
+ );
1680
+ if ( $incl_tax ) {
1681
+ if ( $rate->get_shipping_tax() > 0 && ! wc_prices_include_tax() ) {
1682
+ $method['detail'] = WC()->countries->inc_tax_or_vat();
1683
+ }
1684
+ } else {
1685
+ if ( $rate->get_shipping_tax() > 0 && wc_prices_include_tax() ) {
1686
+ $method['detail'] = WC()->countries->ex_tax_or_vat();
1687
+ }
1688
+ }
1689
+
1690
+ return $method;
1691
+ }
1692
+
1693
+ /**
1694
+ * @param string $id
1695
+ * @param string $index
1696
+ *
1697
+ * @return mixed
1698
+ */
1699
+ protected function get_shipping_method_id( $id, $index ) {
1700
+ return sprintf( '%s:%s', $index, $id );
1701
+ }
1702
+
1703
+ /**
1704
+ * @param float $price
1705
+ * @param WC_Shipping_Rate $rate
1706
+ * @param bool $incl_tax
1707
+ *
1708
+ * @since 3.2.1
1709
+ */
1710
+ protected function get_formatted_shipping_label( $price, $rate, $incl_tax ) {
1711
+ return sprintf( '%s', esc_attr( $rate->get_label() ) );
1712
+ }
1713
  }
includes/abstract/abstract-wc-stripe-payment.php CHANGED
@@ -264,6 +264,9 @@ abstract class WC_Stripe_Payment {
264
  /**
265
  *
266
  * @param WC_Order $order
 
 
 
267
  */
268
  public function get_name_from_order( $order, $type ) {
269
  if ( $type === 'billing' ) {
264
  /**
265
  *
266
  * @param WC_Order $order
267
+ * @param string $type
268
+ *
269
+ * @return string
270
  */
271
  public function get_name_from_order( $order, $type ) {
272
  if ( $type === 'billing' ) {
includes/admin/meta-boxes/views/html-product-data.php CHANGED
@@ -1,61 +1,57 @@
1
  <div id="stripe_product_data"
2
- class="panel woocommerce_stripe_panel woocommerce_options_panel hidden">
3
- <p>
4
- <?php _e( 'In this section you can control which gateways are displayed on the product page.', 'woo-stripe-payment' ); ?>
5
- </p>
6
- <div class="options_group">
7
- <input type="hidden" id="wc_stripe_update_product"
8
- name="wc_stripe_update_product" />
9
- <table class="wc-stripe-product-table wc_gateways">
10
- <thead>
11
- <tr>
12
- <th></th>
13
- <th><?php _e( 'Method', 'woo-stripe-payment' ); ?></th>
14
- <th><?php _e( 'Enabled', 'woo-stripe-payment' ); ?></th>
15
- <th><?php _e( 'Charge Type', 'woo-stripe-payment' ); ?>
16
-
17
-
18
- </thead>
19
- <tbody class="ui-sortable">
20
- <?php foreach ( self::get_payment_gateways() as $gateway ) : ?>
21
- <tr data-gateway_id="<?php echo $gateway->id; ?>">
22
- <td class="sort">
23
- <div class="wc-item-reorder-nav">
24
- <button type="button" class="wc-move-up" tabindex="0"
25
- aria-hidden="false"
26
- aria-label="<?php /* Translators: %s Payment gateway name. */ echo esc_attr( sprintf( __( 'Move the "%s" payment method up', 'woocommerce' ), $gateway->get_method_title() ) ); ?>"><?php esc_html_e( 'Move up', 'woocommerce' ); ?></button>
27
- <button type="button" class="wc-move-down" tabindex="0"
28
- aria-hidden="false"
29
- aria-label="<?php /* Translators: %s Payment gateway name. */ echo esc_attr( sprintf( __( 'Move the "%s" payment method down', 'woocommerce' ), $gateway->get_method_title() ) ); ?>"><?php esc_html_e( 'Move down', 'woocommerce' ); ?></button>
30
- <input type="hidden" name="stripe_gateway_order[]"
31
- value="<?php echo esc_attr( $gateway->id ); ?>" />
32
- </div>
33
- </td>
34
- <td>
35
- <?php echo $gateway->get_method_title(); ?>
36
- </td>
37
- <td><a class="wc-stripe-product-gateway-enabled" href="#"> <span
38
- class="woocommerce-input-toggle woocommerce-input-toggle--
39
- <?php
40
- if ( ! self::get_product_option( $gateway->id )->enabled() ) {
41
- ?>
42
- disabled
43
- <?php
44
- } else {
45
- ?>
46
- enabled<?php } ?>"></span>
47
- </a></td>
48
- <td><select name="stripe_capture_type[]" class="wc-enhanced-select"
49
- style="width: 100px">
50
- <option value="capture"
51
  <?php selected( 'capture', self::get_product_option( $gateway->id )->get_option( 'charge_type' ) ); ?>><?php _e( 'Capture', 'woo-stripe-payment' ); ?></option>
52
- <option value="authorize"
53
  <?php selected( 'authorize', self::get_product_option( $gateway->id )->get_option( 'charge_type' ) ); ?>><?php _e( 'Authorize', 'woo-stripe-payment' ); ?></option>
54
- </select></td>
55
- </tr>
56
- <?php endforeach; ?>
57
- </tbody>
58
- </table>
59
  <?php
60
  woocommerce_wp_select(
61
  array(
@@ -74,9 +70,9 @@
74
  )
75
  );
76
  ?>
77
- </div>
78
- <p>
79
- <button class="button button-secondary wc-stripe-save-product-data"><?php _e( 'Save', 'woo-stripe-payment' ); ?></button>
80
- <span class="spinner"></span>
81
- </p>
82
  </div>
1
  <div id="stripe_product_data"
2
+ class="panel woocommerce_stripe_panel woocommerce_options_panel hidden">
3
+ <p>
4
+ <?php _e( 'In this section you can control which gateways are displayed on the product page.', 'woo-stripe-payment' ); ?>
5
+ </p>
6
+ <div class="options_group">
7
+ <input type="hidden" id="wc_stripe_update_product"
8
+ name="wc_stripe_update_product"/>
9
+ <table class="wc-stripe-product-table wc_gateways">
10
+ <thead>
11
+ <tr>
12
+ <th></th>
13
+ <th><?php _e( 'Method', 'woo-stripe-payment' ); ?></th>
14
+ <th><?php _e( 'Enabled', 'woo-stripe-payment' ); ?></th>
15
+ <th><?php _e( 'Charge Type', 'woo-stripe-payment' ); ?>
16
+
17
+
18
+ </thead>
19
+ <tbody class="ui-sortable">
20
+ <?php foreach ( self::get_payment_gateways() as $gateway ) : ?>
21
+ <tr data-gateway_id="<?php echo $gateway->id; ?>">
22
+ <td class="sort">
23
+ <div class="wc-item-reorder-nav">
24
+ <button type="button" class="wc-move-up" tabindex="0"
25
+ aria-hidden="false"
26
+ aria-label="<?php /* Translators: %s Payment gateway name. */
27
+ echo esc_attr( sprintf( __( 'Move the "%s" payment method up', 'woocommerce' ), $gateway->get_method_title() ) ); ?>"><?php esc_html_e( 'Move up', 'woocommerce' ); ?></button>
28
+ <button type="button" class="wc-move-down" tabindex="0"
29
+ aria-hidden="false"
30
+ aria-label="<?php /* Translators: %s Payment gateway name. */
31
+ echo esc_attr( sprintf( __( 'Move the "%s" payment method down', 'woocommerce' ), $gateway->get_method_title() ) ); ?>"><?php esc_html_e( 'Move down', 'woocommerce' ); ?></button>
32
+ <input type="hidden" name="stripe_gateway_order[]"
33
+ value="<?php echo esc_attr( $gateway->id ); ?>"/>
34
+ </div>
35
+ </td>
36
+ <td>
37
+ <?php echo $gateway->get_method_title(); ?>
38
+ </td>
39
+ <td>
40
+ <a class="wc-stripe-product-gateway-enabled" href="#">
41
+ <span class="woocommerce-input-toggle woocommerce-input-toggle--<?php if ( ! self::get_product_option( $gateway->id )->enabled() ) { ?>disabled<?php } else { ?>enabled<?php } ?>"></span>
42
+ </a>
43
+ </td>
44
+ <td><select name="stripe_capture_type[]" class="wc-enhanced-select"
45
+ style="width: 100px">
46
+ <option value="capture"
 
 
 
 
47
  <?php selected( 'capture', self::get_product_option( $gateway->id )->get_option( 'charge_type' ) ); ?>><?php _e( 'Capture', 'woo-stripe-payment' ); ?></option>
48
+ <option value="authorize"
49
  <?php selected( 'authorize', self::get_product_option( $gateway->id )->get_option( 'charge_type' ) ); ?>><?php _e( 'Authorize', 'woo-stripe-payment' ); ?></option>
50
+ </select></td>
51
+ </tr>
52
+ <?php endforeach; ?>
53
+ </tbody>
54
+ </table>
55
  <?php
56
  woocommerce_wp_select(
57
  array(
70
  )
71
  );
72
  ?>
73
+ </div>
74
+ <p>
75
+ <button class="button button-secondary wc-stripe-save-product-data"><?php _e( 'Save', 'woo-stripe-payment' ); ?></button>
76
+ <span class="spinner"></span>
77
+ </p>
78
  </div>
includes/class-stripe.php CHANGED
@@ -25,7 +25,7 @@ class WC_Stripe_Manager {
25
  *
26
  * @var string
27
  */
28
- public $version = '3.2.0';
29
 
30
  /**
31
  *
25
  *
26
  * @var string
27
  */
28
+ public $version = '3.2.1';
29
 
30
  /**
31
  *
includes/class-wc-stripe-rest-api.php CHANGED
@@ -13,6 +13,7 @@ defined( 'ABSPATH' ) || exit();
13
  * @property WC_Stripe_Rest_Controller $settings
14
  * @property WC_Stripe_Rest_Controller $webhook
15
  * @property WC_Stripe_Rest_Controller $product_data
 
16
  */
17
  class WC_Stripe_Rest_API {
18
 
@@ -55,6 +56,7 @@ class WC_Stripe_Rest_API {
55
  include_once WC_STRIPE_PLUGIN_FILE_PATH . 'includes/controllers/class-wc-stripe-controller-gateway-settings.php';
56
  include_once WC_STRIPE_PLUGIN_FILE_PATH . 'includes/controllers/class-wc-stripe-controller-webhook.php';
57
  include_once WC_STRIPE_PLUGIN_FILE_PATH . 'includes/controllers/class-wc-stripe-controller-product-data.php';
 
58
 
59
  foreach ( $this->get_controllers() as $key => $class_name ) {
60
  if ( class_exists( $class_name ) ) {
@@ -84,6 +86,7 @@ class WC_Stripe_Rest_API {
84
  'settings' => 'WC_Stripe_Controller_Gateway_Settings',
85
  'webhook' => 'WC_Stripe_Controller_Webhook',
86
  'product_data' => 'WC_Stripe_Controller_Product_Data',
 
87
  );
88
 
89
  /**
13
  * @property WC_Stripe_Rest_Controller $settings
14
  * @property WC_Stripe_Rest_Controller $webhook
15
  * @property WC_Stripe_Rest_Controller $product_data
16
+ * @property WC_Stripe_Rest_Controller $plaid
17
  */
18
  class WC_Stripe_Rest_API {
19
 
56
  include_once WC_STRIPE_PLUGIN_FILE_PATH . 'includes/controllers/class-wc-stripe-controller-gateway-settings.php';
57
  include_once WC_STRIPE_PLUGIN_FILE_PATH . 'includes/controllers/class-wc-stripe-controller-webhook.php';
58
  include_once WC_STRIPE_PLUGIN_FILE_PATH . 'includes/controllers/class-wc-stripe-controller-product-data.php';
59
+ include_once WC_STRIPE_PLUGIN_FILE_PATH . 'includes/controllers/class-wc-stripe-controller-plaid.php';
60
 
61
  foreach ( $this->get_controllers() as $key => $class_name ) {
62
  if ( class_exists( $class_name ) ) {
86
  'settings' => 'WC_Stripe_Controller_Gateway_Settings',
87
  'webhook' => 'WC_Stripe_Controller_Webhook',
88
  'product_data' => 'WC_Stripe_Controller_Product_Data',
89
+ 'plaid' => 'WC_Stripe_Controller_Plaid'
90
  );
91
 
92
  /**
includes/controllers/class-wc-stripe-controller-cart.php CHANGED
@@ -37,8 +37,8 @@ class WC_Stripe_Controller_Cart extends WC_Stripe_Rest_Controller {
37
  'callback' => array( $this, 'update_shipping_address' ),
38
  'permission_callback' => '__return_true',
39
  'args' => array(
40
- 'address' => array( 'required' => true ),
41
  'payment_method' => array( 'required' => true ),
 
42
  ),
43
  )
44
  );
@@ -136,13 +136,10 @@ class WC_Stripe_Controller_Cart extends WC_Stripe_Rest_Controller {
136
  'label' => __( 'Total', 'woo-stripe-payment' ),
137
  'pending' => false,
138
  ),
139
- 'displayItems' => wc_stripe_get_display_items(),
140
- 'shippingOptions' => wc_stripe_get_shipping_options( null, $gateway->get_shipping_packages() ),
141
- ),
142
- 'shipping_methods' => WC()->session->get(
143
- 'chosen_shipping_methods',
144
- array()
145
  ),
 
146
  )
147
  ),
148
  )
@@ -192,16 +189,18 @@ class WC_Stripe_Controller_Cart extends WC_Stripe_Rest_Controller {
192
  array(
193
  'data' => $gateway->get_update_shipping_address_response(
194
  array(
195
- 'newData' => array(
196
  'status' => 'success',
197
  'total' => array(
198
  'amount' => wc_stripe_add_number_precision( WC()->cart->total ),
199
  'label' => __( 'Total', 'woo-stripe-payment' ),
200
  'pending' => false,
201
  ),
202
- 'displayItems' => wc_stripe_get_display_items(),
203
- 'shippingOptions' => wc_stripe_get_shipping_options( null, $gateway->get_shipping_packages() ),
204
  ),
 
 
205
  )
206
  ),
207
  )
@@ -263,7 +262,7 @@ class WC_Stripe_Controller_Cart extends WC_Stripe_Rest_Controller {
263
  'subtotal' => round( WC()->cart->subtotal, 2 ),
264
  'totalCents' => wc_stripe_add_number_precision( WC()->cart->total ),
265
  'displayItems' => $gateway->get_display_items( 'cart' ),
266
- 'shippingOptions' => $gateway->get_shipping_methods(),
267
  )
268
  ),
269
  ),
37
  'callback' => array( $this, 'update_shipping_address' ),
38
  'permission_callback' => '__return_true',
39
  'args' => array(
 
40
  'payment_method' => array( 'required' => true ),
41
+ 'address' => array( 'required' => true, 'validate_callback' => array( $this, 'validate_shipping_address' ) )
42
  ),
43
  )
44
  );
136
  'label' => __( 'Total', 'woo-stripe-payment' ),
137
  'pending' => false,
138
  ),
139
+ 'displayItems' => $gateway->get_display_items(),
140
+ 'shippingOptions' => $gateway->get_formatted_shipping_methods(),
 
 
 
 
141
  ),
142
+ 'shipping_methods' => WC()->session->get( 'chosen_shipping_methods', array() ),
143
  )
144
  ),
145
  )
189
  array(
190
  'data' => $gateway->get_update_shipping_address_response(
191
  array(
192
+ 'newData' => array(
193
  'status' => 'success',
194
  'total' => array(
195
  'amount' => wc_stripe_add_number_precision( WC()->cart->total ),
196
  'label' => __( 'Total', 'woo-stripe-payment' ),
197
  'pending' => false,
198
  ),
199
+ 'displayItems' => $gateway->get_display_items(),
200
+ 'shippingOptions' => $gateway->get_formatted_shipping_methods(),
201
  ),
202
+ 'address' => $address,
203
+ 'shipping_method' => WC()->session->get( 'chosen_shipping_methods', array() )
204
  )
205
  ),
206
  )
262
  'subtotal' => round( WC()->cart->subtotal, 2 ),
263
  'totalCents' => wc_stripe_add_number_precision( WC()->cart->total ),
264
  'displayItems' => $gateway->get_display_items( 'cart' ),
265
+ 'shippingOptions' => $gateway->get_formatted_shipping_methods(),
266
  )
267
  ),
268
  ),
includes/controllers/class-wc-stripe-controller-checkout.php CHANGED
@@ -203,6 +203,7 @@ class WC_Stripe_Controller_Checkout extends WC_Stripe_Rest_Controller {
203
  private function actions() {
204
  add_action( 'woocommerce_after_checkout_validation', array( $this, 'after_checkout_validation' ), 10, 2 );
205
  add_action( 'woocommerce_checkout_order_processed', array( $this, 'checkout_order_processed' ), 10, 3 );
 
206
  }
207
 
208
  /**
@@ -291,4 +292,18 @@ class WC_Stripe_Controller_Checkout extends WC_Stripe_Rest_Controller {
291
  unset( $data['product_cart'] );
292
  WC()->session->set( 'wc_stripe_cart', $data );
293
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
294
  }
203
  private function actions() {
204
  add_action( 'woocommerce_after_checkout_validation', array( $this, 'after_checkout_validation' ), 10, 2 );
205
  add_action( 'woocommerce_checkout_order_processed', array( $this, 'checkout_order_processed' ), 10, 3 );
206
+ add_action( 'woocommerce_checkout_posted_data', array( $this, 'filter_posted_data' ) );
207
  }
208
 
209
  /**
292
  unset( $data['product_cart'] );
293
  WC()->session->set( 'wc_stripe_cart', $data );
294
  }
295
+
296
+ /**
297
+ * @param $data
298
+ *
299
+ * @return mixed
300
+ * @since 3.2.1
301
+ */
302
+ public function filter_posted_data( $data ) {
303
+ if ( isset( $data['shipping_method'], $data['shipping_country'], $data['shipping_state'] ) ) {
304
+ $data['shipping_state'] = wc_stripe_filter_address_state( $data['shipping_state'], $data['shipping_country'] );
305
+ }
306
+
307
+ return $data;
308
+ }
309
  }
includes/controllers/class-wc-stripe-controller-googlepay.php CHANGED
@@ -44,7 +44,7 @@ class WC_Stripe_Controller_GooglePay extends WC_Stripe_Rest_Controller {
44
  'callback' => array( $this, 'update_shipping_data' ),
45
  'permission_callback' => '__return_true',
46
  'args' => array(
47
- 'shipping_address' => array( 'required' => true ),
48
  'shipping_method' => array( 'required' => false )
49
  ),
50
  )
@@ -94,6 +94,7 @@ class WC_Stripe_Controller_GooglePay extends WC_Stripe_Rest_Controller {
94
  'data' => array(
95
  'shipping_methods' => $this->get_shipping_methods(),
96
  'paymentRequestUpdate' => $this->get_payment_response_data(),
 
97
  ),
98
  )
99
  )
@@ -125,7 +126,7 @@ class WC_Stripe_Controller_GooglePay extends WC_Stripe_Rest_Controller {
125
  * Return a formatted array of response data required by the Google payment sheet.
126
  */
127
  public function get_payment_response_data() {
128
- $shipping_options = $this->gateway->get_shipping_methods();
129
 
130
  return array(
131
  'newTransactionInfo' => array(
@@ -149,6 +150,8 @@ class WC_Stripe_Controller_GooglePay extends WC_Stripe_Rest_Controller {
149
  /**
150
  * Returns a default shipping method based on the chosen shipping methods.
151
  *
 
 
152
  * @return string
153
  */
154
  private function get_default_shipping_method( $methods ) {
44
  'callback' => array( $this, 'update_shipping_data' ),
45
  'permission_callback' => '__return_true',
46
  'args' => array(
47
+ 'shipping_address' => array( 'required' => true, 'validate_callback' => array( $this, 'validate_shipping_address' ) ),
48
  'shipping_method' => array( 'required' => false )
49
  ),
50
  )
94
  'data' => array(
95
  'shipping_methods' => $this->get_shipping_methods(),
96
  'paymentRequestUpdate' => $this->get_payment_response_data(),
97
+ 'address' => $address
98
  ),
99
  )
100
  )
126
  * Return a formatted array of response data required by the Google payment sheet.
127
  */
128
  public function get_payment_response_data() {
129
+ $shipping_options = $this->gateway->get_formatted_shipping_methods();
130
 
131
  return array(
132
  'newTransactionInfo' => array(
150
  /**
151
  * Returns a default shipping method based on the chosen shipping methods.
152
  *
153
+ * @param array $methods
154
+ *
155
  * @return string
156
  */
157
  private function get_default_shipping_method( $methods ) {
includes/controllers/class-wc-stripe-controller-plaid.php ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ defined( 'ABSPATH' ) || exit();
3
+
4
+ class WC_Stripe_Controller_Plaid extends WC_Stripe_Rest_Controller {
5
+
6
+ use WC_Stripe_Controller_Frontend_Trait;
7
+
8
+ protected $namespace = 'plaid';
9
+
10
+ public function register_routes() {
11
+ register_rest_route( $this->rest_uri(), 'link-token', array(
12
+ 'methods' => WP_REST_Server::CREATABLE,
13
+ 'callback' => array( $this, 'get_link_token' )
14
+ ) );
15
+ }
16
+
17
+ /**
18
+ * @param WP_REST_Request $request
19
+ */
20
+ public function get_link_token( $request ) {
21
+ $this->frontend_includes();
22
+ /**
23
+ * @var WC_Payment_Gateway_Stripe_ACH $gateway
24
+ */
25
+ $gateway = WC()->payment_gateways()->payment_gateways()['stripe_ach'];
26
+
27
+ try {
28
+ $response = $gateway->fetch_link_token();
29
+
30
+ return rest_ensure_response( array( 'token' => $response->link_token ) );
31
+ } catch ( Exception $e ) {
32
+ return new WP_Error( 'plaid-error', $e->getMessage(), array( 'status' => 200 ) );
33
+ }
34
+ }
35
+ }
includes/gateways/class-wc-payment-gateway-stripe-ach.php CHANGED
@@ -87,9 +87,10 @@ class WC_Payment_Gateway_Stripe_ACH extends WC_Payment_Gateway_Stripe {
87
  array(
88
  'env' => $this->get_plaid_environment(),
89
  'client_name' => $this->get_option( 'client_name' ),
90
- 'public_key' => $this->get_option( 'public_key' ),
91
- 'metadata_key' => '[name="' . $this->metadata_key . '"]',
92
  'fees_enabled' => $this->fees_enabled(),
 
 
 
93
  )
94
  );
95
  }
@@ -156,7 +157,7 @@ class WC_Payment_Gateway_Stripe_ACH extends WC_Payment_Gateway_Stripe {
156
  array(
157
  'client_id' => $this->get_option( 'client_id' ),
158
  'secret' => $this->get_option( "{$env}_secret" ),
159
- 'public_token' => $public_token,
160
  )
161
  );
162
  }
@@ -175,6 +176,30 @@ class WC_Payment_Gateway_Stripe_ACH extends WC_Payment_Gateway_Stripe {
175
  );
176
  }
177
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
178
  /**
179
  * Return the base plaid api url.
180
  *
87
  array(
88
  'env' => $this->get_plaid_environment(),
89
  'client_name' => $this->get_option( 'client_name' ),
 
 
90
  'fees_enabled' => $this->fees_enabled(),
91
+ 'routes' => array(
92
+ 'link_token' => wc_stripe()->rest_api->plaid->rest_url( 'link-token' )
93
+ )
94
  )
95
  );
96
  }
157
  array(
158
  'client_id' => $this->get_option( 'client_id' ),
159
  'secret' => $this->get_option( "{$env}_secret" ),
160
+ 'public_token' => $public_token
161
  )
162
  );
163
  }
176
  );
177
  }
178
 
179
+ /**
180
+ * @return mixed|null
181
+ * @throws Exception
182
+ * @since 3.2.1
183
+ */
184
+ public function fetch_link_token() {
185
+ $env = $this->get_plaid_environment();
186
+
187
+ return $this->do_api_request(
188
+ 'link/token/create',
189
+ array(
190
+ 'client_id' => $this->get_option( 'client_id' ),
191
+ 'secret' => $this->get_option( "{$env}_secret" ),
192
+ 'client_name' => $this->get_option( 'client_name' ),
193
+ 'language' => 'en',
194
+ 'country_codes' => array( 'US' ),
195
+ 'user' => array(
196
+ 'client_user_id' => WC()->session->get_customer_id()
197
+ ),
198
+ 'products' => array( 'auth' )
199
+ )
200
+ );
201
+ }
202
+
203
  /**
204
  * Return the base plaid api url.
205
  *
includes/gateways/class-wc-payment-gateway-stripe-googlepay.php CHANGED
@@ -109,213 +109,79 @@ class WC_Payment_Gateway_Stripe_GooglePay extends WC_Payment_Gateway_Stripe {
109
  return $data;
110
  }
111
 
112
- /**
113
- * @param string $page
114
- * @param null $order
115
- *
116
- * @return array|mixed|void
117
- */
118
- public function get_display_items( $page = 'checkout', $order = null ) {
119
- $items = array();
120
- global $wp;
121
- $decimals = ( ( $decimals = wc_get_price_decimals() ) < 2 ? $decimals : 2 );
122
- if ( wcs_stripe_active() && WC_Subscriptions_Change_Payment_Gateway::$is_request_to_change_payment ) {
123
- $subscription = wcs_get_subscription( absint( $_GET['change_payment_method'] ) );
124
- $items[] = array(
125
- 'label' => __( 'Subscription', 'woo-stripe-payment' ),
126
- 'type' => 'SUBTOTAL',
127
- 'price' => strval( $subscription->get_total() ),
128
- );
129
- } elseif ( 'product' === $page ) {
130
- global $product;
131
- $items[] = array(
132
- 'label' => esc_attr( $product->get_name() ),
133
- 'type' => 'LINE_ITEM',
134
- 'price' => strval( $product->get_price() ),
135
- );
136
- } elseif ( 'order_pay' === $page ) {
137
- // add all order items
138
- foreach ( $order->get_items() as $item ) {
139
- /**
140
- *
141
- * @var WC_Order_Item_Product $item
142
- */
143
- $qty = $item->get_quantity();
144
-
145
- $items[] = array(
146
- 'label' => $qty > 1 ? sprintf( '%s X %s', $item->get_name(), $qty ) : $item->get_name(),
147
- 'type' => 'LINE_ITEM',
148
- 'price' => strval( round( $item->get_subtotal(), $decimals ) ),
149
- );
150
- }
151
- // shipping total
152
- if ( $order->get_shipping_total() ) {
153
- $items[] = array(
154
- 'label' => __( 'Shipping', 'woo-stripe-payment' ),
155
- 'type' => 'LINE_ITEM',
156
- 'price' => strval( round( $order->get_shipping_total(), $decimals ) ),
157
- );
158
- }
159
- // discount total
160
- if ( $order->get_total_discount() ) {
161
- $items[] = array(
162
- 'label' => __( 'Discount', 'woo-stripe-payment' ),
163
- 'type' => 'LINE_ITEM',
164
- 'price' => strval( - 1 * $order->get_total_discount() ),
165
- );
166
- }
167
- if ( $order->get_fees() ) {
168
- $fee_total = 0;
169
- foreach ( $order->get_fees() as $fee ) {
170
- $fee_total += $fee->get_total();
171
- }
172
- $items[] = array(
173
- 'label' => __( 'Fees', 'woo-stripe-payment' ),
174
- 'type' => 'LINE_ITEM',
175
- 'price' => strval( round( $fee_total, $decimals ) ),
176
- );
177
- }
178
- // tax total
179
- if ( $order->get_total_tax() ) {
180
- $items[] = array(
181
- 'label' => __( 'Tax', 'woocommerce' ),
182
- 'type' => 'TAX',
183
- 'price' => strval( round( $order->get_total_tax(), $decimals ) ),
184
- );
185
- }
186
- } elseif ( in_array( $page, array( 'cart', 'checkout' ) ) ) {
187
- $this->get_cart_display_items( $items );
188
  }
189
 
190
- return $items;
 
 
 
 
191
  }
192
 
193
- /**
194
- * @param array $items
195
- *
196
- * @since 3.1.7
197
- */
198
- private function get_cart_display_items( &$items = array() ) {
199
- $incl_tax = wc_stripe_display_prices_including_tax();
200
- $decimals = ( ( $decimals = wc_get_price_decimals() ) < 2 ? $decimals : 2 );
201
- foreach ( WC()->cart->get_cart() as $cart_item ) {
202
- /**
203
- *
204
- * @var WC_Product $product
205
- */
206
- $product = $cart_item['data'];
207
- $qty = $cart_item['quantity'];
208
- $args = array( 'qty' => $qty );
209
- $items[] = array(
210
- 'label' => $qty > 1 ? sprintf( '%s X %s', $product->get_name(), $qty ) : $product->get_name(),
211
- 'type' => 'LINE_ITEM',
212
- 'price' => strval( round( $incl_tax ? wc_get_price_including_tax( $product, $args ) : wc_get_price_excluding_tax( $product, $args ), $decimals ) ),
213
- );
214
- }
215
- if ( WC()->cart->needs_shipping() ) {
216
- $items[] = array(
217
- 'label' => __( 'Shipping', 'woo-stripe-payment' ),
218
- 'type' => 'LINE_ITEM',
219
- 'price' => strval( round( $incl_tax ? WC()->cart->shipping_total + WC()->cart->shipping_tax_total : WC()->cart->shipping_total, $decimals ) ),
220
- );
221
- }
222
-
223
- // fees
224
- foreach ( WC()->cart->get_fees() as $fee_item ) {
225
- /**
226
- *
227
- * @var WC_Order_I
228
- */
229
- $items[] = array(
230
- 'label' => $fee_item->name,
231
- 'type' => 'LINE_ITEM',
232
- 'price' => strval( round( $incl_tax ? $fee_item->total + $fee_item->tax : $fee_item->total, $decimals ) ),
233
- );
234
- }
235
 
236
- // coupons
237
- if ( 0 < WC()->cart->discount_cart ) {
238
- $items[] = array(
239
- 'label' => __( 'Discount', 'woo-stripe-payment' ),
240
- 'type' => 'LINE_ITEM',
241
- 'price' => strval(
242
- round(
243
- - 1 *
244
- abs( $incl_tax ? WC()->cart->discount_cart + WC()->cart->discount_cart_tax : WC()->cart->discount_cart ),
245
- $decimals
246
- )
247
- ),
248
- );
249
  }
250
 
251
- if ( ! $incl_tax && wc_tax_enabled() ) {
252
- $item = array(
253
- 'label' => __( 'Tax', 'woo-stripe-payment' ),
254
- 'type' => 'TAX',
255
- 'price' => strval( round( WC()->cart->get_taxes_total(), $decimals ) ),
256
- );
257
- if ( 'itemized' === get_option( 'woocommerce_tax_total_display' ) ) {
258
- if ( 0 < WC()->cart->get_taxes_total() ) {
259
- $items[] = $item;
260
- }
261
- } else {
262
- $items[] = $item;
263
- }
264
- }
265
  }
266
 
267
- public function get_shipping_methods() {
268
- if ( wcs_stripe_active() && WC_Subscriptions_Change_Payment_Gateway::$is_request_to_change_payment ) {
269
- $methods = array();
270
- } else {
271
- $methods = array();
272
- $packages = $this->get_shipping_packages();
273
- foreach ( $packages as $i => $package ) {
274
- foreach ( $package['rates'] as $rate ) {
275
- /**
276
- *
277
- * @var WC_Shipping_Rate $rate
278
- */
279
- $methods[] = array(
280
- 'id' => sprintf( '%s:%s', $i, $rate->id ),
281
- 'label' => $this->get_shipping_method_label( $rate ),
282
- 'description' => '',
283
- );
284
- }
285
- }
286
- if ( empty( $methods ) ) {
287
- // GPay does not like empty shipping methods. Make a temporary one;
288
- $methods[] = array(
289
- 'id' => 'default',
290
- 'label' => __( 'Waiting...', 'woo-stripe-payment' ),
291
- 'description' => __( 'loading shipping methods...', 'woo-stripe-payment' ),
292
- );
293
- }
294
  }
295
 
296
  return $methods;
297
  }
298
 
 
 
 
 
 
 
 
 
299
  /**
300
- * Return a formatted shipping method label.
301
- * <strong>Example</strong>&nbsp;5 Day shipping: 5 USD
302
- *
303
  * @param WC_Shipping_Rate $rate
 
304
  *
305
- * @return
306
  */
307
- public function get_shipping_method_label( $rate ) {
308
- $incl_tax = wc_stripe_display_prices_including_tax();
309
-
310
- if ( $incl_tax ) {
311
- $total = $rate->cost + $rate->get_shipping_tax();
312
- } else {
313
- $total = $rate->cost;
314
- }
315
- $decimals = ( ( $decimals = wc_get_price_decimals() ) < 2 ? $decimals : 2 );
316
- $total = number_format( $total, $decimals );
317
- $label = sprintf( '%s: %s %s', $rate->get_label(), $total, get_woocommerce_currency() );
318
-
319
  if ( $incl_tax ) {
320
  if ( $rate->get_shipping_tax() > 0 && ! wc_prices_include_tax() ) {
321
  $label .= ' ' . WC()->countries->inc_tax_or_vat();
@@ -329,6 +195,23 @@ class WC_Payment_Gateway_Stripe_GooglePay extends WC_Payment_Gateway_Stripe {
329
  return $label;
330
  }
331
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
332
  public function add_to_cart_response( $data ) {
333
  $data['googlepay']['displayItems'] = $this->get_display_items();
334
 
109
  return $data;
110
  }
111
 
112
+ protected function get_display_item_for_cart( $price, $label, $type, ...$args ) {
113
+ switch ( $type ) {
114
+ case 'tax':
115
+ $type = 'TAX';
116
+ break;
117
+ default:
118
+ $type = 'LINE_ITEM';
119
+ break;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
120
  }
121
 
122
+ return array(
123
+ 'label' => $label,
124
+ 'type' => $type,
125
+ 'price' => strval( round( $price, 2 ) )
126
+ );
127
  }
128
 
129
+ protected function get_display_item_for_product( $product ) {
130
+ return array(
131
+ 'label' => esc_attr( $product->get_name() ),
132
+ 'type' => 'SUBTOTAL',
133
+ 'price' => strval( round( $product->get_price(), 2 ) )
134
+ );
135
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
136
 
137
+ protected function get_display_item_for_order( $price, $label, $order, $type, ...$args ) {
138
+ switch ( $type ) {
139
+ case 'tax':
140
+ $type = 'TAX';
141
+ break;
142
+ default:
143
+ $type = 'LINE_ITEM';
144
+ break;
 
 
 
 
 
145
  }
146
 
147
+ return array(
148
+ 'label' => $label,
149
+ 'type' => $type,
150
+ 'price' => strval( round( $price, 2 ) )
151
+ );
 
 
 
 
 
 
 
 
 
152
  }
153
 
154
+ public function get_formatted_shipping_methods( $methods = array() ) {
155
+ $methods = parent::get_formatted_shipping_methods( $methods );
156
+ if ( empty( $methods ) ) {
157
+ // GPay does not like empty shipping methods. Make a temporary one;
158
+ $methods[] = array(
159
+ 'id' => 'default',
160
+ 'label' => __( 'Waiting...', 'woo-stripe-payment' ),
161
+ 'description' => __( 'loading shipping methods...', 'woo-stripe-payment' ),
162
+ );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
163
  }
164
 
165
  return $methods;
166
  }
167
 
168
+ public function get_formatted_shipping_method( $price, $rate, $i, $package, $incl_tax ) {
169
+ return array(
170
+ 'id' => $this->get_shipping_method_id( $rate->id, $i ),
171
+ 'label' => $this->get_formatted_shipping_label( $price, $rate, $incl_tax ),
172
+ 'description' => ''
173
+ );
174
+ }
175
+
176
  /**
177
+ * @param float $price
 
 
178
  * @param WC_Shipping_Rate $rate
179
+ * @param bool $incl_tax
180
  *
181
+ * @return string|void
182
  */
183
+ protected function get_formatted_shipping_label( $price, $rate, $incl_tax ) {
184
+ $label = sprintf( '%s: %s %s', esc_attr( $rate->get_label() ), number_format( $price, 2 ), get_woocommerce_currency() );
 
 
 
 
 
 
 
 
 
 
185
  if ( $incl_tax ) {
186
  if ( $rate->get_shipping_tax() > 0 && ! wc_prices_include_tax() ) {
187
  $label .= ' ' . WC()->countries->inc_tax_or_vat();
195
  return $label;
196
  }
197
 
198
+ /**
199
+ * Return a formatted shipping method label.
200
+ * <strong>Example</strong>&nbsp;5 Day shipping: 5 USD
201
+ *
202
+ * @param WC_Shipping_Rate $rate
203
+ *
204
+ * @return
205
+ * @deprecated
206
+ *
207
+ */
208
+ public function get_shipping_method_label( $rate ) {
209
+ $incl_tax = wc_stripe_display_prices_including_tax();
210
+ $price = $incl_tax ? $rate->cost + $rate->get_shipping_tax() : $rate->cost;
211
+
212
+ return $this->get_formatted_shipping_label( $price, $rate, $incl_tax );
213
+ }
214
+
215
  public function add_to_cart_response( $data ) {
216
  $data['googlepay']['displayItems'] = $this->get_display_items();
217
 
includes/gateways/settings/ach-settings.php CHANGED
@@ -3,7 +3,7 @@ return array(
3
  'desc' => array(
4
  'type' => 'description',
5
  'description' => sprintf( '<div>%s</div>', __( 'For US customers only.', 'woo-stripe-payment' ) ) .
6
- sprintf( '<p>%s</p>', sprintf( __( 'Read through our %1$sdocumentation%2$s to configure ACH payments', 'woo-stripe-payment' ), '<a target="_blank" href="https://docs.paymentplugins.com/wc-stripe/config/#/stripe_ach">', '</a>' ) ),
7
  ),
8
  'enabled' => array(
9
  'title' => __( 'Enabled', 'woo-stripe-payment' ),
@@ -36,13 +36,6 @@ return array(
36
  'description' => __( 'ID that identifies your Plaid account.', 'woo-stripe-payment' ),
37
  'desc_tip' => true,
38
  ),
39
- 'public_key' => array(
40
- 'type' => 'text',
41
- 'title' => __( 'Public Key' ),
42
- 'default' => '',
43
- 'description' => __( 'Used to identify ACH payments initiated from your site.', 'woo-stripe-payment' ),
44
- 'desc_tip' => true,
45
- ),
46
  'plaid_secrets' => array(
47
  'type' => 'title',
48
  'title' => __( 'Plaid Secrets', 'wo-stripe-paymento' ),
3
  'desc' => array(
4
  'type' => 'description',
5
  'description' => sprintf( '<div>%s</div>', __( 'For US customers only.', 'woo-stripe-payment' ) ) .
6
+ sprintf( '<p>%s</p>', sprintf( __( 'Read through our %1$sdocumentation%2$s to configure ACH payments', 'woo-stripe-payment' ), '<a target="_blank" href="https://docs.paymentplugins.com/wc-stripe/config/#/stripe_ach">', '</a>' ) ),
7
  ),
8
  'enabled' => array(
9
  'title' => __( 'Enabled', 'woo-stripe-payment' ),
36
  'description' => __( 'ID that identifies your Plaid account.', 'woo-stripe-payment' ),
37
  'desc_tip' => true,
38
  ),
 
 
 
 
 
 
 
39
  'plaid_secrets' => array(
40
  'type' => 'title',
41
  'title' => __( 'Plaid Secrets', 'wo-stripe-paymento' ),
includes/traits/wc-stripe-controller-traits.php CHANGED
@@ -44,6 +44,19 @@ trait WC_Stripe_Controller_Cart_Trait {
44
 
45
  return array();
46
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
47
  }
48
 
49
  /**
44
 
45
  return array();
46
  }
47
+
48
+ /**
49
+ * @param array $address
50
+ * @param WP_REST_Request $request
51
+ */
52
+ public function validate_shipping_address( $address, $request ) {
53
+ if ( isset( $address['state'], $address['country'] ) ) {
54
+ $address['state'] = wc_stripe_filter_address_state( $address['state'], $address['country'] );
55
+ $request['address'] = $address;
56
+ }
57
+
58
+ return true;
59
+ }
60
  }
61
 
62
  /**
includes/wc-stripe-functions.php CHANGED
@@ -370,6 +370,7 @@ function wc_stripe_shipping_address_serviceable( $packages = array() ) {
370
  *
371
  * @package Stripe/Functions
372
  * @since 3.0.0
 
373
  */
374
  function wc_stripe_get_display_items( $page = 'cart', $order = null ) {
375
  // first argument used to be $encode param so make sure it's a string now
@@ -515,6 +516,7 @@ function wc_stripe_get_display_items( $page = 'cart', $order = null ) {
515
  * @return mixed
516
  * @package Stripe/Functions
517
  * @since 3.0.0
 
518
  */
519
  function wc_stripe_get_shipping_options( $order = null, $packages = array() ) {
520
  $methods = array();
@@ -1287,3 +1289,26 @@ function wc_stripe_get_checkout_fields() {
1287
 
1288
  return $fields;
1289
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
370
  *
371
  * @package Stripe/Functions
372
  * @since 3.0.0
373
+ * @deprecated
374
  */
375
  function wc_stripe_get_display_items( $page = 'cart', $order = null ) {
376
  // first argument used to be $encode param so make sure it's a string now
516
  * @return mixed
517
  * @package Stripe/Functions
518
  * @since 3.0.0
519
+ * @deprecated
520
  */
521
  function wc_stripe_get_shipping_options( $order = null, $packages = array() ) {
522
  $methods = array();
1289
 
1290
  return $fields;
1291
  }
1292
+
1293
+ /**
1294
+ * Filters a state value, making sure the abbreviated state value recognized by WC is returned.
1295
+ * Example: Texas = TX
1296
+ *
1297
+ * @param string $state
1298
+ * @param string $country
1299
+ *
1300
+ * @return string
1301
+ *
1302
+ * @since 3.2.1
1303
+ */
1304
+ function wc_stripe_filter_address_state( $state, $country ) {
1305
+ $states = WC()->countries ? WC()->countries->get_states( $country ) : array();
1306
+ if ( ! empty( $states ) && is_array( $states ) && ! isset( $states[ $state ] ) ) {
1307
+ $state_keys = array_flip( array_map( 'strtoupper', $states ) );
1308
+ if ( isset( $state_keys[ strtoupper( $state ) ] ) ) {
1309
+ $state = $state_keys[ strtoupper( $state ) ];
1310
+ }
1311
+ }
1312
+
1313
+ return $state;
1314
+ }
readme.txt CHANGED
@@ -4,7 +4,7 @@ Tags: stripe, ach, klarna, credit card, apple pay, google pay, ideal, sepa, sofo
4
  Requires at least: 3.0.1
5
  Tested up to: 5.5
6
  Requires PHP: 5.6
7
- Stable tag: 3.2.0
8
  Copyright: Payment Plugins
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
@@ -58,6 +58,12 @@ If you're site is not loading over https, then Stripe won't render the Payment R
58
  8. Edit payment gateways on the product page
59
 
60
  == Changelog ==
 
 
 
 
 
 
61
  = 3.2.0 =
62
  * Fixed - Conflict with Checkout Field Editor for WooCommerce and JS checkout field variable
63
  * Fixed - Mini-cart html
4
  Requires at least: 3.0.1
5
  Tested up to: 5.5
6
  Requires PHP: 5.6
7
+ Stable tag: 3.2.1
8
  Copyright: Payment Plugins
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
58
  8. Edit payment gateways on the product page
59
 
60
  == Changelog ==
61
+ = 3.2.1 =
62
+ * Updated - Plaid Link integration to use new Link Token
63
+ * Updated - Convert state long name i.e. Texas = TX in case address is not abbreviated in wallet
64
+ * Updated - On checkout page, only request phone and email in Apple Pay and GPay if fields are empty
65
+ * Fixed - Issue where JS error triggered if cart/checkout page combined using Elementor
66
+ * Fixed - Apple Pay and Payment Request wallet requiring shipping address for variable virtual products
67
  = 3.2.0 =
68
  * Fixed - Conflict with Checkout Field Editor for WooCommerce and JS checkout field variable
69
  * Fixed - Mini-cart html
stripe-payments.php CHANGED
@@ -3,13 +3,13 @@
3
  * Plugin Name: Stripe For WooCommerce
4
  * Plugin URI: https://docs.paymentplugins.com/wc-stripe/config/
5
  * Description: Accept credit cards, Google Pay, Apple Pay, ACH, Klarna and more using Stripe.
6
- * Version: 3.2.0
7
  * Author: Payment Plugins, support@paymentplugins.com
8
  * Text Domain: woo-stripe-payment
9
  * Domain Path: /i18n/languages/
10
  * Tested up to: 5.5
11
  * WC requires at least: 3.0.0
12
- * WC tested up to: 4.4.1
13
  */
14
  defined( 'ABSPATH' ) || exit ();
15
 
3
  * Plugin Name: Stripe For WooCommerce
4
  * Plugin URI: https://docs.paymentplugins.com/wc-stripe/config/
5
  * Description: Accept credit cards, Google Pay, Apple Pay, ACH, Klarna and more using Stripe.
6
+ * Version: 3.2.1
7
  * Author: Payment Plugins, support@paymentplugins.com
8
  * Text Domain: woo-stripe-payment
9
  * Domain Path: /i18n/languages/
10
  * Tested up to: 5.5
11
  * WC requires at least: 3.0.0
12
+ * WC tested up to: 4.5.0
13
  */
14
  defined( 'ABSPATH' ) || exit ();
15
 
vendor/composer/installed.json CHANGED
@@ -1,17 +1,17 @@
1
  [
2
  {
3
  "name": "stripe/stripe-php",
4
- "version": "v7.45.0",
5
- "version_normalized": "7.45.0.0",
6
  "source": {
7
  "type": "git",
8
  "url": "https://github.com/stripe/stripe-php.git",
9
- "reference": "21e5001f5e0d787e4755c8bfc00e578dce9ae058"
10
  },
11
  "dist": {
12
  "type": "zip",
13
- "url": "https://api.github.com/repos/stripe/stripe-php/zipball/21e5001f5e0d787e4755c8bfc00e578dce9ae058",
14
- "reference": "21e5001f5e0d787e4755c8bfc00e578dce9ae058",
15
  "shasum": ""
16
  },
17
  "require": {
@@ -27,7 +27,7 @@
27
  "squizlabs/php_codesniffer": "^3.3",
28
  "symfony/process": "~3.4"
29
  },
30
- "time": "2020-07-29T04:29:52+00:00",
31
  "type": "library",
32
  "extra": {
33
  "branch-alias": {
1
  [
2
  {
3
  "name": "stripe/stripe-php",
4
+ "version": "v7.50.0",
5
+ "version_normalized": "7.50.0.0",
6
  "source": {
7
  "type": "git",
8
  "url": "https://github.com/stripe/stripe-php.git",
9
+ "reference": "0195e3dcc34123df9a441069dbf08db17c3b025d"
10
  },
11
  "dist": {
12
  "type": "zip",
13
+ "url": "https://api.github.com/repos/stripe/stripe-php/zipball/0195e3dcc34123df9a441069dbf08db17c3b025d",
14
+ "reference": "0195e3dcc34123df9a441069dbf08db17c3b025d",
15
  "shasum": ""
16
  },
17
  "require": {
27
  "squizlabs/php_codesniffer": "^3.3",
28
  "symfony/process": "~3.4"
29
  },
30
+ "time": "2020-08-28T20:17:35+00:00",
31
  "type": "library",
32
  "extra": {
33
  "branch-alias": {
vendor/stripe/stripe-php/.gitignore DELETED
@@ -1,31 +0,0 @@
1
- # Ignore build files
2
- build/*
3
-
4
- # Mac OS X dumps these all over the place.
5
- .DS_Store
6
-
7
- # Ignore the SimpleTest library if it is installed to /test/.
8
- /test/simpletest/
9
-
10
- # Ignore the /vendor/ directory for people using composer
11
- /vendor/
12
-
13
- # If the vendor directory isn't being commited the composer.lock file should also be ignored
14
- composer.lock
15
-
16
- # Ignore PHPUnit coverage file
17
- clover.xml
18
-
19
- # Ignore IDE's configuration files
20
- .idea
21
-
22
- # Ignore PHP CS Fixer local config and cache
23
- .php_cs
24
- .php_cs.cache
25
-
26
- # Ignore PHPStan local config
27
- .phpstan.neon
28
-
29
- # Ignore phpDocumentor's local config and artifacts
30
- .phpdoc/*
31
- phpdoc.xml
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/stripe/stripe-php/CHANGELOG.md CHANGED
@@ -1,5 +1,25 @@
1
  # Changelog
2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  ## 7.45.0 - 2020-07-28
4
  * [#981](https://github.com/stripe/stripe-php/pull/981) PHPdoc updates
5
 
1
  # Changelog
2
 
3
+ ## 7.50.0 - 2020-08-28
4
+ * [#1005](https://github.com/stripe/stripe-php/pull/1005) Updated PHPDocs
5
+
6
+ ## 7.49.0 - 2020-08-19
7
+ * [#998](https://github.com/stripe/stripe-php/pull/998) PHPDocs updated
8
+
9
+ ## 7.48.0 - 2020-08-17
10
+ * [#997](https://github.com/stripe/stripe-php/pull/997) PHPDocs updated
11
+ * [#996](https://github.com/stripe/stripe-php/pull/996) Fixing telemetry
12
+
13
+ ## 7.47.0 - 2020-08-13
14
+ * [#994](https://github.com/stripe/stripe-php/pull/994) Nullable balance_transactions on issuing disputes
15
+ * [#991](https://github.com/stripe/stripe-php/pull/991) Fix invalid return types in OAuthService
16
+
17
+ ## 7.46.1 - 2020-08-07
18
+ * [#990](https://github.com/stripe/stripe-php/pull/990) PHPdoc changes
19
+
20
+ ## 7.46.0 - 2020-08-05
21
+ * [#989](https://github.com/stripe/stripe-php/pull/989) Add support for the `PromotionCode` resource and APIs
22
+
23
  ## 7.45.0 - 2020-07-28
24
  * [#981](https://github.com/stripe/stripe-php/pull/981) PHPdoc updates
25
 
vendor/stripe/stripe-php/README.md CHANGED
@@ -74,7 +74,7 @@ See the [PHP API docs](https://stripe.com/docs/api/php#intro).
74
 
75
  ### PHP 5.4 & 5.5
76
 
77
- If you are using PHP 5.4 or 5.5, you can download v6.21.1 ([zip](https://github.com/stripe/stripe-php/archive/v6.21.1.zip), [tar.gz](https://github.com/stripe/stripe-php/archive/v5.9.2.tar.gz)) from our [releases page](https://github.com/stripe/stripe-php/releases). This version will continue to work with new versions of the Stripe API for all common uses.
78
 
79
  ### PHP 5.3
80
 
74
 
75
  ### PHP 5.4 & 5.5
76
 
77
+ If you are using PHP 5.4 or 5.5, you can download v6.21.1 ([zip](https://github.com/stripe/stripe-php/archive/v6.21.1.zip), [tar.gz](https://github.com/stripe/stripe-php/archive/v6.21.1.tar.gz)) from our [releases page](https://github.com/stripe/stripe-php/releases). This version will continue to work with new versions of the Stripe API for all common uses.
78
 
79
  ### PHP 5.3
80
 
vendor/stripe/stripe-php/VERSION CHANGED
@@ -1 +1 @@
1
- 7.45.0
1
+ 7.50.0
vendor/stripe/stripe-php/composer.json DELETED
@@ -1,48 +0,0 @@
1
- {
2
- "name": "stripe/stripe-php",
3
- "description": "Stripe PHP Library",
4
- "keywords": [
5
- "stripe",
6
- "payment processing",
7
- "api"
8
- ],
9
- "homepage": "https://stripe.com/",
10
- "license": "MIT",
11
- "authors": [
12
- {
13
- "name": "Stripe and contributors",
14
- "homepage": "https://github.com/stripe/stripe-php/contributors"
15
- }
16
- ],
17
- "require": {
18
- "php": ">=5.6.0",
19
- "ext-curl": "*",
20
- "ext-json": "*",
21
- "ext-mbstring": "*"
22
- },
23
- "require-dev": {
24
- "phpunit/phpunit": "^5.7",
25
- "php-coveralls/php-coveralls": "^2.1",
26
- "squizlabs/php_codesniffer": "^3.3",
27
- "symfony/process": "~3.4",
28
- "friendsofphp/php-cs-fixer": "2.16.1"
29
- },
30
- "autoload": {
31
- "psr-4": {
32
- "Stripe\\": "lib/"
33
- }
34
- },
35
- "autoload-dev": {
36
- "psr-4": {
37
- "Stripe\\": [
38
- "tests/",
39
- "tests/Stripe/"
40
- ]
41
- }
42
- },
43
- "extra": {
44
- "branch-alias": {
45
- "dev-master": "2.0-dev"
46
- }
47
- }
48
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/stripe/stripe-php/init.php CHANGED
@@ -1,5 +1,7 @@
1
  <?php
2
 
 
 
3
  // Stripe singleton
4
  require __DIR__ . '/lib/Stripe.php';
5
 
@@ -122,6 +124,7 @@ require __DIR__ . '/lib/Person.php';
122
  require __DIR__ . '/lib/Plan.php';
123
  require __DIR__ . '/lib/Price.php';
124
  require __DIR__ . '/lib/Product.php';
 
125
  require __DIR__ . '/lib/Radar/EarlyFraudWarning.php';
126
  require __DIR__ . '/lib/Radar/ValueList.php';
127
  require __DIR__ . '/lib/Radar/ValueListItem.php';
@@ -189,6 +192,7 @@ require __DIR__ . '/lib/Service/PayoutService.php';
189
  require __DIR__ . '/lib/Service/PlanService.php';
190
  require __DIR__ . '/lib/Service/PriceService.php';
191
  require __DIR__ . '/lib/Service/ProductService.php';
 
192
  require __DIR__ . '/lib/Service/Radar/EarlyFraudWarningService.php';
193
  require __DIR__ . '/lib/Service/Radar/ValueListService.php';
194
  require __DIR__ . '/lib/Service/Radar/ValueListItemService.php';
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  // Stripe singleton
6
  require __DIR__ . '/lib/Stripe.php';
7
 
124
  require __DIR__ . '/lib/Plan.php';
125
  require __DIR__ . '/lib/Price.php';
126
  require __DIR__ . '/lib/Product.php';
127
+ require __DIR__ . '/lib/PromotionCode.php';
128
  require __DIR__ . '/lib/Radar/EarlyFraudWarning.php';
129
  require __DIR__ . '/lib/Radar/ValueList.php';
130
  require __DIR__ . '/lib/Radar/ValueListItem.php';
192
  require __DIR__ . '/lib/Service/PlanService.php';
193
  require __DIR__ . '/lib/Service/PriceService.php';
194
  require __DIR__ . '/lib/Service/ProductService.php';
195
+ require __DIR__ . '/lib/Service/PromotionCodeService.php';
196
  require __DIR__ . '/lib/Service/Radar/EarlyFraudWarningService.php';
197
  require __DIR__ . '/lib/Service/Radar/ValueListService.php';
198
  require __DIR__ . '/lib/Service/Radar/ValueListItemService.php';
vendor/stripe/stripe-php/lib/Account.php CHANGED
@@ -1,5 +1,7 @@
1
  <?php
2
 
 
 
3
  namespace Stripe;
4
 
5
  /**
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe;
6
 
7
  /**
vendor/stripe/stripe-php/lib/AccountLink.php CHANGED
@@ -1,5 +1,7 @@
1
  <?php
2
 
 
 
3
  namespace Stripe;
4
 
5
  /**
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe;
6
 
7
  /**
vendor/stripe/stripe-php/lib/ApiRequestor.php CHANGED
@@ -377,9 +377,11 @@ class ApiRequestor
377
  $hasFile
378
  );
379
 
380
- if (isset($rheaders['request-id'], $rheaders['request-id'][0])) {
 
 
381
  self::$requestTelemetry = new RequestTelemetry(
382
- $rheaders['request-id'][0],
383
  Util\Util::currentTimeMillis() - $requestStartMs
384
  );
385
  }
377
  $hasFile
378
  );
379
 
380
+ if (isset($rheaders['request-id'])
381
+ && \is_string($rheaders['request-id'])
382
+ && \strlen($rheaders['request-id']) > 0) {
383
  self::$requestTelemetry = new RequestTelemetry(
384
+ $rheaders['request-id'],
385
  Util\Util::currentTimeMillis() - $requestStartMs
386
  );
387
  }
vendor/stripe/stripe-php/lib/ApplePayDomain.php CHANGED
@@ -1,5 +1,7 @@
1
  <?php
2
 
 
 
3
  namespace Stripe;
4
 
5
  /**
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe;
6
 
7
  /**
vendor/stripe/stripe-php/lib/ApplicationFee.php CHANGED
@@ -1,5 +1,7 @@
1
  <?php
2
 
 
 
3
  namespace Stripe;
4
 
5
  /**
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe;
6
 
7
  /**
vendor/stripe/stripe-php/lib/ApplicationFeeRefund.php CHANGED
@@ -1,5 +1,7 @@
1
  <?php
2
 
 
 
3
  namespace Stripe;
4
 
5
  /**
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe;
6
 
7
  /**
vendor/stripe/stripe-php/lib/Balance.php CHANGED
@@ -1,5 +1,7 @@
1
  <?php
2
 
 
 
3
  namespace Stripe;
4
 
5
  /**
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe;
6
 
7
  /**
vendor/stripe/stripe-php/lib/BalanceTransaction.php CHANGED
@@ -1,5 +1,7 @@
1
  <?php
2
 
 
 
3
  namespace Stripe;
4
 
5
  /**
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe;
6
 
7
  /**
vendor/stripe/stripe-php/lib/BankAccount.php CHANGED
@@ -1,5 +1,7 @@
1
  <?php
2
 
 
 
3
  namespace Stripe;
4
 
5
  /**
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe;
6
 
7
  /**
vendor/stripe/stripe-php/lib/BillingPortal/Session.php CHANGED
@@ -1,5 +1,7 @@
1
  <?php
2
 
 
 
3
  namespace Stripe\BillingPortal;
4
 
5
  /**
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe\BillingPortal;
6
 
7
  /**
vendor/stripe/stripe-php/lib/BitcoinReceiver.php CHANGED
@@ -1,5 +1,7 @@
1
  <?php
2
 
 
 
3
  namespace Stripe;
4
 
5
  /**
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe;
6
 
7
  /**
vendor/stripe/stripe-php/lib/BitcoinTransaction.php CHANGED
@@ -1,5 +1,7 @@
1
  <?php
2
 
 
 
3
  namespace Stripe;
4
 
5
  /**
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe;
6
 
7
  /**
vendor/stripe/stripe-php/lib/Capability.php CHANGED
@@ -1,5 +1,7 @@
1
  <?php
2
 
 
 
3
  namespace Stripe;
4
 
5
  /**
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe;
6
 
7
  /**
vendor/stripe/stripe-php/lib/Card.php CHANGED
@@ -1,5 +1,7 @@
1
  <?php
2
 
 
 
3
  namespace Stripe;
4
 
5
  /**
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe;
6
 
7
  /**
vendor/stripe/stripe-php/lib/Charge.php CHANGED
@@ -1,5 +1,7 @@
1
  <?php
2
 
 
 
3
  namespace Stripe;
4
 
5
  /**
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe;
6
 
7
  /**
vendor/stripe/stripe-php/lib/Checkout/Session.php CHANGED
@@ -1,5 +1,7 @@
1
  <?php
2
 
 
 
3
  namespace Stripe\Checkout;
4
 
5
  /**
@@ -22,6 +24,7 @@ namespace Stripe\Checkout;
22
  *
23
  * @property string $id Unique identifier for the object. Used to pass to <code>redirectToCheckout</code> in Stripe.js.
24
  * @property string $object String representing the object's type. Objects of the same type share the same value.
 
25
  * @property null|int $amount_subtotal Total of all items before discounts or taxes are applied.
26
  * @property null|int $amount_total Total of all items after discounts and taxes are applied.
27
  * @property null|string $billing_address_collection Describes whether Checkout should collect the customer's billing address.
@@ -30,7 +33,6 @@ namespace Stripe\Checkout;
30
  * @property null|string $currency Three-letter <a href="https://www.iso.org/iso-4217-currency-codes.html">ISO currency code</a>, in lowercase. Must be a <a href="https://stripe.com/docs/currencies">supported currency</a>.
31
  * @property null|string|\Stripe\Customer $customer The ID of the customer for this session. For Checkout Sessions in <code>payment</code> or <code>subscription</code> mode, Checkout will create a new customer object based on information provided during the session unless an existing customer was provided when the session was created.
32
  * @property null|string $customer_email If provided, this value will be used when the Customer object is created. If not provided, customers will be asked to enter their email address. Use this parameter to prefill customer data if you already have an email on file. To access information about the customer once a session is complete, use the <code>customer</code> attribute.
33
- * @property \Stripe\StripeObject[] $display_items The line items, plans, or SKUs purchased by the customer. Prefer using <code>line_items</code>.
34
  * @property \Stripe\Collection $line_items The line items purchased by the customer.
35
  * @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode.
36
  * @property null|string $locale The IETF language tag of the locale Checkout is displayed in. If blank or <code>auto</code>, the browser's locale is used.
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe\Checkout;
6
 
7
  /**
24
  *
25
  * @property string $id Unique identifier for the object. Used to pass to <code>redirectToCheckout</code> in Stripe.js.
26
  * @property string $object String representing the object's type. Objects of the same type share the same value.
27
+ * @property null|bool $allow_promotion_codes Enables user redeemable promotion codes.
28
  * @property null|int $amount_subtotal Total of all items before discounts or taxes are applied.
29
  * @property null|int $amount_total Total of all items after discounts and taxes are applied.
30
  * @property null|string $billing_address_collection Describes whether Checkout should collect the customer's billing address.
33
  * @property null|string $currency Three-letter <a href="https://www.iso.org/iso-4217-currency-codes.html">ISO currency code</a>, in lowercase. Must be a <a href="https://stripe.com/docs/currencies">supported currency</a>.
34
  * @property null|string|\Stripe\Customer $customer The ID of the customer for this session. For Checkout Sessions in <code>payment</code> or <code>subscription</code> mode, Checkout will create a new customer object based on information provided during the session unless an existing customer was provided when the session was created.
35
  * @property null|string $customer_email If provided, this value will be used when the Customer object is created. If not provided, customers will be asked to enter their email address. Use this parameter to prefill customer data if you already have an email on file. To access information about the customer once a session is complete, use the <code>customer</code> attribute.
 
36
  * @property \Stripe\Collection $line_items The line items purchased by the customer.
37
  * @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode.
38
  * @property null|string $locale The IETF language tag of the locale Checkout is displayed in. If blank or <code>auto</code>, the browser's locale is used.
vendor/stripe/stripe-php/lib/CountrySpec.php CHANGED
@@ -1,5 +1,7 @@
1
  <?php
2
 
 
 
3
  namespace Stripe;
4
 
5
  /**
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe;
6
 
7
  /**
vendor/stripe/stripe-php/lib/Coupon.php CHANGED
@@ -1,5 +1,7 @@
1
  <?php
2
 
 
 
3
  namespace Stripe;
4
 
5
  /**
@@ -13,6 +15,7 @@ namespace Stripe;
13
  * @property string $id Unique identifier for the object.
14
  * @property string $object String representing the object's type. Objects of the same type share the same value.
15
  * @property null|int $amount_off Amount (in the <code>currency</code> specified) that will be taken off the subtotal of any invoices for this customer.
 
16
  * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch.
17
  * @property null|string $currency If <code>amount_off</code> has been set, the three-letter <a href="https://stripe.com/docs/currencies">ISO code for the currency</a> of the amount to take off.
18
  * @property string $duration One of <code>forever</code>, <code>once</code>, and <code>repeating</code>. Describes how long a customer who applies this coupon will get the discount.
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe;
6
 
7
  /**
15
  * @property string $id Unique identifier for the object.
16
  * @property string $object String representing the object's type. Objects of the same type share the same value.
17
  * @property null|int $amount_off Amount (in the <code>currency</code> specified) that will be taken off the subtotal of any invoices for this customer.
18
+ * @property \Stripe\StripeObject $applies_to
19
  * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch.
20
  * @property null|string $currency If <code>amount_off</code> has been set, the three-letter <a href="https://stripe.com/docs/currencies">ISO code for the currency</a> of the amount to take off.
21
  * @property string $duration One of <code>forever</code>, <code>once</code>, and <code>repeating</code>. Describes how long a customer who applies this coupon will get the discount.
vendor/stripe/stripe-php/lib/CreditNote.php CHANGED
@@ -1,5 +1,7 @@
1
  <?php
2
 
 
 
3
  namespace Stripe;
4
 
5
  /**
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe;
6
 
7
  /**
vendor/stripe/stripe-php/lib/CreditNoteLineItem.php CHANGED
@@ -1,5 +1,7 @@
1
  <?php
2
 
 
 
3
  namespace Stripe;
4
 
5
  /**
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe;
6
 
7
  /**
vendor/stripe/stripe-php/lib/Customer.php CHANGED
@@ -1,5 +1,7 @@
1
  <?php
2
 
 
 
3
  namespace Stripe;
4
 
5
  /**
@@ -33,7 +35,7 @@ namespace Stripe;
33
  * @property null|string[] $preferred_locales The customer's preferred locales (languages), ordered by preference.
34
  * @property null|\Stripe\StripeObject $shipping Mailing and shipping address for the customer. Appears on invoices emailed to this customer.
35
  * @property \Stripe\Collection $sources The customer's payment sources, if any.
36
- * @property null|\Stripe\Collection $subscriptions The customer's current subscriptions, if any.
37
  * @property null|string $tax_exempt Describes the customer's tax exemption status. One of <code>none</code>, <code>exempt</code>, or <code>reverse</code>. When set to <code>reverse</code>, invoice and receipt PDFs include the text <strong>&quot;Reverse charge&quot;</strong>.
38
  * @property \Stripe\Collection $tax_ids The customer's tax IDs.
39
  */
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe;
6
 
7
  /**
35
  * @property null|string[] $preferred_locales The customer's preferred locales (languages), ordered by preference.
36
  * @property null|\Stripe\StripeObject $shipping Mailing and shipping address for the customer. Appears on invoices emailed to this customer.
37
  * @property \Stripe\Collection $sources The customer's payment sources, if any.
38
+ * @property \Stripe\Collection $subscriptions The customer's current subscriptions, if any.
39
  * @property null|string $tax_exempt Describes the customer's tax exemption status. One of <code>none</code>, <code>exempt</code>, or <code>reverse</code>. When set to <code>reverse</code>, invoice and receipt PDFs include the text <strong>&quot;Reverse charge&quot;</strong>.
40
  * @property \Stripe\Collection $tax_ids The customer's tax IDs.
41
  */
vendor/stripe/stripe-php/lib/CustomerBalanceTransaction.php CHANGED
@@ -1,5 +1,7 @@
1
  <?php
2
 
 
 
3
  namespace Stripe;
4
 
5
  /**
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe;
6
 
7
  /**
vendor/stripe/stripe-php/lib/Dispute.php CHANGED
@@ -1,5 +1,7 @@
1
  <?php
2
 
 
 
3
  namespace Stripe;
4
 
5
  /**
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe;
6
 
7
  /**
vendor/stripe/stripe-php/lib/EphemeralKey.php CHANGED
@@ -1,5 +1,7 @@
1
  <?php
2
 
 
 
3
  namespace Stripe;
4
 
5
  /**
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe;
6
 
7
  /**
vendor/stripe/stripe-php/lib/Event.php CHANGED
@@ -1,5 +1,7 @@
1
  <?php
2
 
 
 
3
  namespace Stripe;
4
 
5
  /**
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe;
6
 
7
  /**
vendor/stripe/stripe-php/lib/ExchangeRate.php CHANGED
@@ -1,5 +1,7 @@
1
  <?php
2
 
 
 
3
  namespace Stripe;
4
 
5
  /**
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe;
6
 
7
  /**
vendor/stripe/stripe-php/lib/File.php CHANGED
@@ -1,5 +1,7 @@
1
  <?php
2
 
 
 
3
  namespace Stripe;
4
 
5
  /**
@@ -16,6 +18,7 @@ namespace Stripe;
16
  * @property string $id Unique identifier for the object.
17
  * @property string $object String representing the object's type. Objects of the same type share the same value.
18
  * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch.
 
19
  * @property null|string $filename A filename for the file, suitable for saving to a filesystem.
20
  * @property null|\Stripe\Collection $links A list of <a href="https://stripe.com/docs/api#file_links">file links</a> that point at this file.
21
  * @property string $purpose The <a href="https://stripe.com/docs/file-upload#uploading-a-file">purpose</a> of the uploaded file.
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe;
6
 
7
  /**
18
  * @property string $id Unique identifier for the object.
19
  * @property string $object String representing the object's type. Objects of the same type share the same value.
20
  * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch.
21
+ * @property null|int $expires_at The time at which the file expires and is no longer available in epoch seconds.
22
  * @property null|string $filename A filename for the file, suitable for saving to a filesystem.
23
  * @property null|\Stripe\Collection $links A list of <a href="https://stripe.com/docs/api#file_links">file links</a> that point at this file.
24
  * @property string $purpose The <a href="https://stripe.com/docs/file-upload#uploading-a-file">purpose</a> of the uploaded file.
vendor/stripe/stripe-php/lib/FileLink.php CHANGED
@@ -1,5 +1,7 @@
1
  <?php
2
 
 
 
3
  namespace Stripe;
4
 
5
  /**
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe;
6
 
7
  /**
vendor/stripe/stripe-php/lib/Invoice.php CHANGED
@@ -1,5 +1,7 @@
1
  <?php
2
 
 
 
3
  namespace Stripe;
4
 
5
  /**
@@ -95,7 +97,6 @@ namespace Stripe;
95
  * @property int $subscription_proration_date Only set for upcoming invoices that preview prorations. The time used to calculate prorations.
96
  * @property int $subtotal Total of all subscriptions, invoice items, and prorations on the invoice before any invoice level discount or tax is applied. Item discounts are already incorporated
97
  * @property null|int $tax The amount of tax on this invoice. This is the sum of all the tax amounts on this invoice.
98
- * @property null|float $tax_percent This percentage of the subtotal has been added to the total amount of the invoice, including invoice line items and discounts. This field is inherited from the subscription's <code>tax_percent</code> field, but can be changed before the invoice is paid. This field defaults to null.
99
  * @property \Stripe\StripeObject $threshold_reason
100
  * @property int $total Total after discounts and taxes.
101
  * @property null|\Stripe\StripeObject[] $total_discount_amounts The aggregate amounts calculated per discount across all line items.
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe;
6
 
7
  /**
97
  * @property int $subscription_proration_date Only set for upcoming invoices that preview prorations. The time used to calculate prorations.
98
  * @property int $subtotal Total of all subscriptions, invoice items, and prorations on the invoice before any invoice level discount or tax is applied. Item discounts are already incorporated
99
  * @property null|int $tax The amount of tax on this invoice. This is the sum of all the tax amounts on this invoice.
 
100
  * @property \Stripe\StripeObject $threshold_reason
101
  * @property int $total Total after discounts and taxes.
102
  * @property null|\Stripe\StripeObject[] $total_discount_amounts The aggregate amounts calculated per discount across all line items.
vendor/stripe/stripe-php/lib/InvoiceItem.php CHANGED
@@ -1,5 +1,7 @@
1
  <?php
2
 
 
 
3
  namespace Stripe;
4
 
5
  /**
@@ -32,7 +34,6 @@ namespace Stripe;
32
  * @property null|string|\Stripe\Subscription $subscription The subscription that this invoice item has been created for, if any.
33
  * @property string $subscription_item The subscription item that this invoice item has been created for, if any.
34
  * @property null|\Stripe\TaxRate[] $tax_rates The tax rates which apply to the invoice item. When set, the <code>default_tax_rates</code> on the invoice do not apply to this invoice item.
35
- * @property bool $unified_proration For prorations this indicates whether Stripe automatically grouped multiple related debit and credit line items into a single combined line item.
36
  * @property null|int $unit_amount Unit Amount (in the <code>currency</code> specified) of the invoice item.
37
  * @property null|string $unit_amount_decimal Same as <code>unit_amount</code>, but contains a decimal value with at most 12 decimal places.
38
  */
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe;
6
 
7
  /**
34
  * @property null|string|\Stripe\Subscription $subscription The subscription that this invoice item has been created for, if any.
35
  * @property string $subscription_item The subscription item that this invoice item has been created for, if any.
36
  * @property null|\Stripe\TaxRate[] $tax_rates The tax rates which apply to the invoice item. When set, the <code>default_tax_rates</code> on the invoice do not apply to this invoice item.
 
37
  * @property null|int $unit_amount Unit Amount (in the <code>currency</code> specified) of the invoice item.
38
  * @property null|string $unit_amount_decimal Same as <code>unit_amount</code>, but contains a decimal value with at most 12 decimal places.
39
  */
vendor/stripe/stripe-php/lib/InvoiceLineItem.php CHANGED
@@ -1,5 +1,7 @@
1
  <?php
2
 
 
 
3
  namespace Stripe;
4
 
5
  /**
@@ -24,7 +26,6 @@ namespace Stripe;
24
  * @property null|\Stripe\StripeObject[] $tax_amounts The amount of tax calculated per tax rate for this line item
25
  * @property null|\Stripe\TaxRate[] $tax_rates The tax rates which apply to the line item.
26
  * @property string $type A string identifying the type of the source of this line item, either an <code>invoiceitem</code> or a <code>subscription</code>.
27
- * @property bool $unified_proration For prorations this indicates whether Stripe automatically grouped multiple related debit and credit line items into a single combined line item.
28
  */
29
  class InvoiceLineItem extends ApiResource
30
  {
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe;
6
 
7
  /**
26
  * @property null|\Stripe\StripeObject[] $tax_amounts The amount of tax calculated per tax rate for this line item
27
  * @property null|\Stripe\TaxRate[] $tax_rates The tax rates which apply to the line item.
28
  * @property string $type A string identifying the type of the source of this line item, either an <code>invoiceitem</code> or a <code>subscription</code>.
 
29
  */
30
  class InvoiceLineItem extends ApiResource
31
  {
vendor/stripe/stripe-php/lib/Issuing/Authorization.php CHANGED
@@ -1,5 +1,7 @@
1
  <?php
2
 
 
 
3
  namespace Stripe\Issuing;
4
 
5
  /**
@@ -15,6 +17,7 @@ namespace Stripe\Issuing;
15
  * @property string $id Unique identifier for the object.
16
  * @property string $object String representing the object's type. Objects of the same type share the same value.
17
  * @property int $amount The total amount that was authorized or rejected. This amount is in the card's currency and in the <a href="https://stripe.com/docs/currencies#zero-decimal">smallest currency unit</a>.
 
18
  * @property bool $approved Whether the authorization has been approved.
19
  * @property string $authorization_method How the card details were provided.
20
  * @property \Stripe\BalanceTransaction[] $balance_transactions List of balance transactions associated with this authorization.
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe\Issuing;
6
 
7
  /**
17
  * @property string $id Unique identifier for the object.
18
  * @property string $object String representing the object's type. Objects of the same type share the same value.
19
  * @property int $amount The total amount that was authorized or rejected. This amount is in the card's currency and in the <a href="https://stripe.com/docs/currencies#zero-decimal">smallest currency unit</a>.
20
+ * @property null|\Stripe\StripeObject $amount_details Detailed breakdown of amount components. These amounts are denominated in <code>currency</code> and in the <a href="https://stripe.com/docs/currencies#zero-decimal">smallest currency unit</a>.
21
  * @property bool $approved Whether the authorization has been approved.
22
  * @property string $authorization_method How the card details were provided.
23
  * @property \Stripe\BalanceTransaction[] $balance_transactions List of balance transactions associated with this authorization.
vendor/stripe/stripe-php/lib/Issuing/Card.php CHANGED
@@ -1,5 +1,7 @@
1
  <?php
2
 
 
 
3
  namespace Stripe\Issuing;
4
 
5
  /**
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe\Issuing;
6
 
7
  /**
vendor/stripe/stripe-php/lib/Issuing/Cardholder.php CHANGED
@@ -1,5 +1,7 @@
1
  <?php
2
 
 
 
3
  namespace Stripe\Issuing;
4
 
5
  /**
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe\Issuing;
6
 
7
  /**
vendor/stripe/stripe-php/lib/Issuing/Dispute.php CHANGED
@@ -1,12 +1,13 @@
1
  <?php
2
 
 
 
3
  namespace Stripe\Issuing;
4
 
5
  /**
6
- * As a <a href="https://stripe.com/docs/issuing">card issuer</a>, you can <a
7
- * href="https://stripe.com/docs/issuing/purchases/disputes">dispute</a>
8
- * transactions that you do not recognize, suspect to be fraudulent, or have some
9
- * other issue.
10
  *
11
  * Related guide: <a
12
  * href="https://stripe.com/docs/issuing/purchases/disputes">Disputing
@@ -14,7 +15,7 @@ namespace Stripe\Issuing;
14
  *
15
  * @property string $id Unique identifier for the object.
16
  * @property string $object String representing the object's type. Objects of the same type share the same value.
17
- * @property \Stripe\BalanceTransaction[] $balance_transactions List of balance transactions associated with this dispute.
18
  * @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode.
19
  * @property string|\Stripe\Issuing\Transaction $transaction The transaction being disputed.
20
  */
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe\Issuing;
6
 
7
  /**
8
+ * As a <a href="https://stripe.com/docs/issuing">card issuer</a>, you can dispute
9
+ * transactions that the cardholder does not recognize, suspects to be fraudulent,
10
+ * or has other issues with.
 
11
  *
12
  * Related guide: <a
13
  * href="https://stripe.com/docs/issuing/purchases/disputes">Disputing
15
  *
16
  * @property string $id Unique identifier for the object.
17
  * @property string $object String representing the object's type. Objects of the same type share the same value.
18
+ * @property null|\Stripe\BalanceTransaction[] $balance_transactions List of balance transactions associated with the dispute.
19
  * @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode.
20
  * @property string|\Stripe\Issuing\Transaction $transaction The transaction being disputed.
21
  */
vendor/stripe/stripe-php/lib/Issuing/Transaction.php CHANGED
@@ -1,5 +1,7 @@
1
  <?php
2
 
 
 
3
  namespace Stripe\Issuing;
4
 
5
  /**
@@ -15,6 +17,7 @@ namespace Stripe\Issuing;
15
  * @property string $id Unique identifier for the object.
16
  * @property string $object String representing the object's type. Objects of the same type share the same value.
17
  * @property int $amount The transaction amount, which will be reflected in your balance. This amount is in your currency and in the <a href="https://stripe.com/docs/currencies#zero-decimal">smallest currency unit</a>.
 
18
  * @property null|string|\Stripe\Issuing\Authorization $authorization The <code>Authorization</code> object that led to this transaction.
19
  * @property null|string|\Stripe\BalanceTransaction $balance_transaction ID of the <a href="https://stripe.com/docs/api/balance_transactions">balance transaction</a> associated with this transaction.
20
  * @property string|\Stripe\Issuing\Card $card The card used to make this transaction.
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe\Issuing;
6
 
7
  /**
17
  * @property string $id Unique identifier for the object.
18
  * @property string $object String representing the object's type. Objects of the same type share the same value.
19
  * @property int $amount The transaction amount, which will be reflected in your balance. This amount is in your currency and in the <a href="https://stripe.com/docs/currencies#zero-decimal">smallest currency unit</a>.
20
+ * @property null|\Stripe\StripeObject $amount_details Detailed breakdown of amount components. These amounts are denominated in <code>currency</code> and in the <a href="https://stripe.com/docs/currencies#zero-decimal">smallest currency unit</a>.
21
  * @property null|string|\Stripe\Issuing\Authorization $authorization The <code>Authorization</code> object that led to this transaction.
22
  * @property null|string|\Stripe\BalanceTransaction $balance_transaction ID of the <a href="https://stripe.com/docs/api/balance_transactions">balance transaction</a> associated with this transaction.
23
  * @property string|\Stripe\Issuing\Card $card The card used to make this transaction.
vendor/stripe/stripe-php/lib/LineItem.php CHANGED
@@ -1,5 +1,7 @@
1
  <?php
2
 
 
 
3
  namespace Stripe;
4
 
5
  /**
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe;
6
 
7
  /**
vendor/stripe/stripe-php/lib/LoginLink.php CHANGED
@@ -1,5 +1,7 @@
1
  <?php
2
 
 
 
3
  namespace Stripe;
4
 
5
  /**
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe;
6
 
7
  /**
vendor/stripe/stripe-php/lib/Mandate.php CHANGED
@@ -1,5 +1,7 @@
1
  <?php
2
 
 
 
3
  namespace Stripe;
4
 
5
  /**
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe;
6
 
7
  /**
vendor/stripe/stripe-php/lib/Order.php CHANGED
@@ -1,5 +1,7 @@
1
  <?php
2
 
 
 
3
  namespace Stripe;
4
 
5
  /**
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe;
6
 
7
  /**
vendor/stripe/stripe-php/lib/OrderReturn.php CHANGED
@@ -1,5 +1,7 @@
1
  <?php
2
 
 
 
3
  namespace Stripe;
4
 
5
  /**
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe;
6
 
7
  /**
vendor/stripe/stripe-php/lib/PaymentIntent.php CHANGED
@@ -1,5 +1,7 @@
1
  <?php
2
 
 
 
3
  namespace Stripe;
4
 
5
  /**
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe;
6
 
7
  /**
vendor/stripe/stripe-php/lib/PaymentMethod.php CHANGED
@@ -1,5 +1,7 @@
1
  <?php
2
 
 
 
3
  namespace Stripe;
4
 
5
  /**
@@ -16,6 +18,7 @@ namespace Stripe;
16
  *
17
  * @property string $id Unique identifier for the object.
18
  * @property string $object String representing the object's type. Objects of the same type share the same value.
 
19
  * @property \Stripe\StripeObject $au_becs_debit
20
  * @property \Stripe\StripeObject $bacs_debit
21
  * @property \Stripe\StripeObject $bancontact
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe;
6
 
7
  /**
18
  *
19
  * @property string $id Unique identifier for the object.
20
  * @property string $object String representing the object's type. Objects of the same type share the same value.
21
+ * @property \Stripe\StripeObject $alipay
22
  * @property \Stripe\StripeObject $au_becs_debit
23
  * @property \Stripe\StripeObject $bacs_debit
24
  * @property \Stripe\StripeObject $bancontact
vendor/stripe/stripe-php/lib/Payout.php CHANGED
@@ -1,5 +1,7 @@
1
  <?php
2
 
 
 
3
  namespace Stripe;
4
 
5
  /**
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe;
6
 
7
  /**
vendor/stripe/stripe-php/lib/Person.php CHANGED
@@ -1,5 +1,7 @@
1
  <?php
2
 
 
 
3
  namespace Stripe;
4
 
5
  /**
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe;
6
 
7
  /**
vendor/stripe/stripe-php/lib/Plan.php CHANGED
@@ -1,5 +1,7 @@
1
  <?php
2
 
 
 
3
  namespace Stripe;
4
 
5
  /**
@@ -37,7 +39,7 @@ namespace Stripe;
37
  * @property \Stripe\StripeObject $metadata Set of <a href="https://stripe.com/docs/api/metadata">key-value pairs</a> that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
38
  * @property null|string $nickname A brief description of the plan, hidden from customers.
39
  * @property null|string|\Stripe\Product $product The product whose pricing this plan determines.
40
- * @property null|\Stripe\StripeObject[] $tiers Each element represents a pricing tier. This parameter requires <code>billing_scheme</code> to be set to <code>tiered</code>. See also the documentation for <code>billing_scheme</code>.
41
  * @property null|string $tiers_mode Defines if the tiering price should be <code>graduated</code> or <code>volume</code> based. In <code>volume</code>-based tiering, the maximum quantity within a period determines the per unit price. In <code>graduated</code> tiering, pricing can change as the quantity grows.
42
  * @property null|\Stripe\StripeObject $transform_usage Apply a transformation to the reported usage or set quantity before computing the amount billed. Cannot be combined with <code>tiers</code>.
43
  * @property null|int $trial_period_days Default number of trial days when subscribing a customer to this plan using <a href="https://stripe.com/docs/api#create_subscription-trial_from_plan"><code>trial_from_plan=true</code></a>.
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe;
6
 
7
  /**
39
  * @property \Stripe\StripeObject $metadata Set of <a href="https://stripe.com/docs/api/metadata">key-value pairs</a> that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
40
  * @property null|string $nickname A brief description of the plan, hidden from customers.
41
  * @property null|string|\Stripe\Product $product The product whose pricing this plan determines.
42
+ * @property \Stripe\StripeObject[] $tiers Each element represents a pricing tier. This parameter requires <code>billing_scheme</code> to be set to <code>tiered</code>. See also the documentation for <code>billing_scheme</code>.
43
  * @property null|string $tiers_mode Defines if the tiering price should be <code>graduated</code> or <code>volume</code> based. In <code>volume</code>-based tiering, the maximum quantity within a period determines the per unit price. In <code>graduated</code> tiering, pricing can change as the quantity grows.
44
  * @property null|\Stripe\StripeObject $transform_usage Apply a transformation to the reported usage or set quantity before computing the amount billed. Cannot be combined with <code>tiers</code>.
45
  * @property null|int $trial_period_days Default number of trial days when subscribing a customer to this plan using <a href="https://stripe.com/docs/api#create_subscription-trial_from_plan"><code>trial_from_plan=true</code></a>.
vendor/stripe/stripe-php/lib/Price.php CHANGED
@@ -1,5 +1,7 @@
1
  <?php
2
 
 
 
3
  namespace Stripe;
4
 
5
  /**
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe;
6
 
7
  /**
vendor/stripe/stripe-php/lib/Product.php CHANGED
@@ -1,5 +1,7 @@
1
  <?php
2
 
 
 
3
  namespace Stripe;
4
 
5
  /**
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe;
6
 
7
  /**
vendor/stripe/stripe-php/lib/PromotionCode.php ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // File generated from our OpenAPI spec
4
+
5
+ namespace Stripe;
6
+
7
+ /**
8
+ * A Promotion Code represents a customer-redeemable code for a coupon. It can be
9
+ * used to create multiple codes for a single coupon.
10
+ *
11
+ * @property string $id Unique identifier for the object.
12
+ * @property string $object String representing the object's type. Objects of the same type share the same value.
13
+ * @property bool $active Whether the promotion code is currently active. A promotion code is only active if the coupon is also valid.
14
+ * @property string $code The customer-facing code. Regardless of case, this code must be unique across all active promotion codes for each customer.
15
+ * @property \Stripe\Coupon $coupon A coupon contains information about a percent-off or amount-off discount you might want to apply to a customer. Coupons may be applied to <a href="https://stripe.com/docs/api#invoices">invoices</a> or <a href="https://stripe.com/docs/api#create_order-coupon">orders</a>. Coupons do not work with conventional one-off <a href="https://stripe.com/docs/api#create_charge">charges</a>.
16
+ * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch.
17
+ * @property null|string|\Stripe\Customer $customer The customer that this promotion code can be used by.
18
+ * @property null|int $expires_at Date at which the promotion code can no longer be redeemed.
19
+ * @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode.
20
+ * @property null|int $max_redemptions Maximum number of times this promotion code can be redeemed.
21
+ * @property \Stripe\StripeObject $metadata Set of <a href="https://stripe.com/docs/api/metadata">key-value pairs</a> that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
22
+ * @property \Stripe\StripeObject $restrictions
23
+ * @property int $times_redeemed Number of times this promotion code has been used.
24
+ */
25
+ class PromotionCode extends ApiResource
26
+ {
27
+ const OBJECT_NAME = 'promotion_code';
28
+
29
+ use ApiOperations\All;
30
+ use ApiOperations\Create;
31
+ use ApiOperations\Retrieve;
32
+ use ApiOperations\Update;
33
+ }
vendor/stripe/stripe-php/lib/Radar/EarlyFraudWarning.php CHANGED
@@ -1,5 +1,7 @@
1
  <?php
2
 
 
 
3
  namespace Stripe\Radar;
4
 
5
  /**
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe\Radar;
6
 
7
  /**
vendor/stripe/stripe-php/lib/Radar/ValueList.php CHANGED
@@ -1,5 +1,7 @@
1
  <?php
2
 
 
 
3
  namespace Stripe\Radar;
4
 
5
  /**
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe\Radar;
6
 
7
  /**
vendor/stripe/stripe-php/lib/Radar/ValueListItem.php CHANGED
@@ -1,5 +1,7 @@
1
  <?php
2
 
 
 
3
  namespace Stripe\Radar;
4
 
5
  /**
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe\Radar;
6
 
7
  /**
vendor/stripe/stripe-php/lib/Recipient.php CHANGED
@@ -1,5 +1,7 @@
1
  <?php
2
 
 
 
3
  namespace Stripe;
4
 
5
  /**
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe;
6
 
7
  /**
vendor/stripe/stripe-php/lib/Refund.php CHANGED
@@ -1,5 +1,7 @@
1
  <?php
2
 
 
 
3
  namespace Stripe;
4
 
5
  /**
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe;
6
 
7
  /**
vendor/stripe/stripe-php/lib/Reporting/ReportRun.php CHANGED
@@ -1,5 +1,7 @@
1
  <?php
2
 
 
 
3
  namespace Stripe\Reporting;
4
 
5
  /**
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe\Reporting;
6
 
7
  /**
vendor/stripe/stripe-php/lib/Reporting/ReportType.php CHANGED
@@ -1,5 +1,7 @@
1
  <?php
2
 
 
 
3
  namespace Stripe\Reporting;
4
 
5
  /**
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe\Reporting;
6
 
7
  /**
vendor/stripe/stripe-php/lib/Review.php CHANGED
@@ -1,5 +1,7 @@
1
  <?php
2
 
 
 
3
  namespace Stripe;
4
 
5
  /**
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe;
6
 
7
  /**
vendor/stripe/stripe-php/lib/SKU.php CHANGED
@@ -1,5 +1,7 @@
1
  <?php
2
 
 
 
3
  namespace Stripe;
4
 
5
  /**
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe;
6
 
7
  /**
vendor/stripe/stripe-php/lib/Service/AccountLinkService.php CHANGED
@@ -1,5 +1,7 @@
1
  <?php
2
 
 
 
3
  namespace Stripe\Service;
4
 
5
  class AccountLinkService extends \Stripe\Service\AbstractService
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe\Service;
6
 
7
  class AccountLinkService extends \Stripe\Service\AbstractService
vendor/stripe/stripe-php/lib/Service/AccountService.php CHANGED
@@ -1,5 +1,7 @@
1
  <?php
2
 
 
 
3
  namespace Stripe\Service;
4
 
5
  class AccountService extends \Stripe\Service\AbstractService
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe\Service;
6
 
7
  class AccountService extends \Stripe\Service\AbstractService
vendor/stripe/stripe-php/lib/Service/ApplePayDomainService.php CHANGED
@@ -1,5 +1,7 @@
1
  <?php
2
 
 
 
3
  namespace Stripe\Service;
4
 
5
  class ApplePayDomainService extends \Stripe\Service\AbstractService
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe\Service;
6
 
7
  class ApplePayDomainService extends \Stripe\Service\AbstractService
vendor/stripe/stripe-php/lib/Service/ApplicationFeeService.php CHANGED
@@ -1,5 +1,7 @@
1
  <?php
2
 
 
 
3
  namespace Stripe\Service;
4
 
5
  class ApplicationFeeService extends \Stripe\Service\AbstractService
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe\Service;
6
 
7
  class ApplicationFeeService extends \Stripe\Service\AbstractService
vendor/stripe/stripe-php/lib/Service/BalanceService.php CHANGED
@@ -1,5 +1,7 @@
1
  <?php
2
 
 
 
3
  namespace Stripe\Service;
4
 
5
  class BalanceService extends \Stripe\Service\AbstractService
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe\Service;
6
 
7
  class BalanceService extends \Stripe\Service\AbstractService
vendor/stripe/stripe-php/lib/Service/BalanceTransactionService.php CHANGED
@@ -1,5 +1,7 @@
1
  <?php
2
 
 
 
3
  namespace Stripe\Service;
4
 
5
  class BalanceTransactionService extends \Stripe\Service\AbstractService
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe\Service;
6
 
7
  class BalanceTransactionService extends \Stripe\Service\AbstractService
vendor/stripe/stripe-php/lib/Service/BillingPortal/BillingPortalServiceFactory.php CHANGED
@@ -1,5 +1,7 @@
1
  <?php
2
 
 
 
3
  namespace Stripe\Service\BillingPortal;
4
 
5
  /**
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe\Service\BillingPortal;
6
 
7
  /**
vendor/stripe/stripe-php/lib/Service/BillingPortal/SessionService.php CHANGED
@@ -1,5 +1,7 @@
1
  <?php
2
 
 
 
3
  namespace Stripe\Service\BillingPortal;
4
 
5
  class SessionService extends \Stripe\Service\AbstractService
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe\Service\BillingPortal;
6
 
7
  class SessionService extends \Stripe\Service\AbstractService
vendor/stripe/stripe-php/lib/Service/ChargeService.php CHANGED
@@ -1,5 +1,7 @@
1
  <?php
2
 
 
 
3
  namespace Stripe\Service;
4
 
5
  class ChargeService extends \Stripe\Service\AbstractService
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe\Service;
6
 
7
  class ChargeService extends \Stripe\Service\AbstractService
vendor/stripe/stripe-php/lib/Service/Checkout/CheckoutServiceFactory.php CHANGED
@@ -1,5 +1,7 @@
1
  <?php
2
 
 
 
3
  namespace Stripe\Service\Checkout;
4
 
5
  /**
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe\Service\Checkout;
6
 
7
  /**
vendor/stripe/stripe-php/lib/Service/Checkout/SessionService.php CHANGED
@@ -1,5 +1,7 @@
1
  <?php
2
 
 
 
3
  namespace Stripe\Service\Checkout;
4
 
5
  class SessionService extends \Stripe\Service\AbstractService
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe\Service\Checkout;
6
 
7
  class SessionService extends \Stripe\Service\AbstractService
vendor/stripe/stripe-php/lib/Service/CoreServiceFactory.php CHANGED
@@ -1,5 +1,7 @@
1
  <?php
2
 
 
 
3
  namespace Stripe\Service;
4
 
5
  /**
@@ -37,6 +39,7 @@ namespace Stripe\Service;
37
  * @property PlanService $plans
38
  * @property PriceService $prices
39
  * @property ProductService $products
 
40
  * @property Radar\RadarServiceFactory $radar
41
  * @property RefundService $refunds
42
  * @property Reporting\ReportingServiceFactory $reporting
@@ -93,6 +96,7 @@ class CoreServiceFactory extends \Stripe\Service\AbstractServiceFactory
93
  'plans' => PlanService::class,
94
  'prices' => PriceService::class,
95
  'products' => ProductService::class,
 
96
  'radar' => Radar\RadarServiceFactory::class,
97
  'refunds' => RefundService::class,
98
  'reporting' => Reporting\ReportingServiceFactory::class,
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe\Service;
6
 
7
  /**
39
  * @property PlanService $plans
40
  * @property PriceService $prices
41
  * @property ProductService $products
42
+ * @property PromotionCodeService $promotionCodes
43
  * @property Radar\RadarServiceFactory $radar
44
  * @property RefundService $refunds
45
  * @property Reporting\ReportingServiceFactory $reporting
96
  'plans' => PlanService::class,
97
  'prices' => PriceService::class,
98
  'products' => ProductService::class,
99
+ 'promotionCodes' => PromotionCodeService::class,
100
  'radar' => Radar\RadarServiceFactory::class,
101
  'refunds' => RefundService::class,
102
  'reporting' => Reporting\ReportingServiceFactory::class,
vendor/stripe/stripe-php/lib/Service/CountrySpecService.php CHANGED
@@ -1,5 +1,7 @@
1
  <?php
2
 
 
 
3
  namespace Stripe\Service;
4
 
5
  class CountrySpecService extends \Stripe\Service\AbstractService
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe\Service;
6
 
7
  class CountrySpecService extends \Stripe\Service\AbstractService
vendor/stripe/stripe-php/lib/Service/CouponService.php CHANGED
@@ -1,5 +1,7 @@
1
  <?php
2
 
 
 
3
  namespace Stripe\Service;
4
 
5
  class CouponService extends \Stripe\Service\AbstractService
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe\Service;
6
 
7
  class CouponService extends \Stripe\Service\AbstractService
vendor/stripe/stripe-php/lib/Service/CreditNoteService.php CHANGED
@@ -1,5 +1,7 @@
1
  <?php
2
 
 
 
3
  namespace Stripe\Service;
4
 
5
  class CreditNoteService extends \Stripe\Service\AbstractService
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe\Service;
6
 
7
  class CreditNoteService extends \Stripe\Service\AbstractService
vendor/stripe/stripe-php/lib/Service/CustomerService.php CHANGED
@@ -1,5 +1,7 @@
1
  <?php
2
 
 
 
3
  namespace Stripe\Service;
4
 
5
  class CustomerService extends \Stripe\Service\AbstractService
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe\Service;
6
 
7
  class CustomerService extends \Stripe\Service\AbstractService
vendor/stripe/stripe-php/lib/Service/DisputeService.php CHANGED
@@ -1,5 +1,7 @@
1
  <?php
2
 
 
 
3
  namespace Stripe\Service;
4
 
5
  class DisputeService extends \Stripe\Service\AbstractService
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe\Service;
6
 
7
  class DisputeService extends \Stripe\Service\AbstractService
vendor/stripe/stripe-php/lib/Service/EphemeralKeyService.php CHANGED
@@ -1,5 +1,7 @@
1
  <?php
2
 
 
 
3
  namespace Stripe\Service;
4
 
5
  class EphemeralKeyService extends \Stripe\Service\AbstractService
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe\Service;
6
 
7
  class EphemeralKeyService extends \Stripe\Service\AbstractService
vendor/stripe/stripe-php/lib/Service/EventService.php CHANGED
@@ -1,5 +1,7 @@
1
  <?php
2
 
 
 
3
  namespace Stripe\Service;
4
 
5
  class EventService extends \Stripe\Service\AbstractService
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe\Service;
6
 
7
  class EventService extends \Stripe\Service\AbstractService
vendor/stripe/stripe-php/lib/Service/ExchangeRateService.php CHANGED
@@ -1,5 +1,7 @@
1
  <?php
2
 
 
 
3
  namespace Stripe\Service;
4
 
5
  class ExchangeRateService extends \Stripe\Service\AbstractService
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe\Service;
6
 
7
  class ExchangeRateService extends \Stripe\Service\AbstractService
vendor/stripe/stripe-php/lib/Service/FileLinkService.php CHANGED
@@ -1,5 +1,7 @@
1
  <?php
2
 
 
 
3
  namespace Stripe\Service;
4
 
5
  class FileLinkService extends \Stripe\Service\AbstractService
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe\Service;
6
 
7
  class FileLinkService extends \Stripe\Service\AbstractService
vendor/stripe/stripe-php/lib/Service/FileService.php CHANGED
@@ -1,5 +1,7 @@
1
  <?php
2
 
 
 
3
  namespace Stripe\Service;
4
 
5
  class FileService extends \Stripe\Service\AbstractService
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe\Service;
6
 
7
  class FileService extends \Stripe\Service\AbstractService
vendor/stripe/stripe-php/lib/Service/InvoiceItemService.php CHANGED
@@ -1,5 +1,7 @@
1
  <?php
2
 
 
 
3
  namespace Stripe\Service;
4
 
5
  class InvoiceItemService extends \Stripe\Service\AbstractService
@@ -21,8 +23,9 @@ class InvoiceItemService extends \Stripe\Service\AbstractService
21
  }
22
 
23
  /**
24
- * Creates an item to be added to a draft invoice. If no invoice is specified, the
25
- * item will be on the next invoice created for the customer specified.
 
26
  *
27
  * @param null|array $params
28
  * @param null|array|\Stripe\Util\RequestOptions $opts
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe\Service;
6
 
7
  class InvoiceItemService extends \Stripe\Service\AbstractService
23
  }
24
 
25
  /**
26
+ * Creates an item to be added to a draft invoice (up to 250 items per invoice). If
27
+ * no invoice is specified, the item will be on the next invoice created for the
28
+ * customer specified.
29
  *
30
  * @param null|array $params
31
  * @param null|array|\Stripe\Util\RequestOptions $opts
vendor/stripe/stripe-php/lib/Service/InvoiceService.php CHANGED
@@ -1,5 +1,7 @@
1
  <?php
2
 
 
 
3
  namespace Stripe\Service;
4
 
5
  class InvoiceService extends \Stripe\Service\AbstractService
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe\Service;
6
 
7
  class InvoiceService extends \Stripe\Service\AbstractService
vendor/stripe/stripe-php/lib/Service/Issuing/AuthorizationService.php CHANGED
@@ -1,5 +1,7 @@
1
  <?php
2
 
 
 
3
  namespace Stripe\Service\Issuing;
4
 
5
  class AuthorizationService extends \Stripe\Service\AbstractService
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe\Service\Issuing;
6
 
7
  class AuthorizationService extends \Stripe\Service\AbstractService
vendor/stripe/stripe-php/lib/Service/Issuing/CardService.php CHANGED
@@ -1,5 +1,7 @@
1
  <?php
2
 
 
 
3
  namespace Stripe\Service\Issuing;
4
 
5
  class CardService extends \Stripe\Service\AbstractService
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe\Service\Issuing;
6
 
7
  class CardService extends \Stripe\Service\AbstractService
vendor/stripe/stripe-php/lib/Service/Issuing/CardholderService.php CHANGED
@@ -1,5 +1,7 @@
1
  <?php
2
 
 
 
3
  namespace Stripe\Service\Issuing;
4
 
5
  class CardholderService extends \Stripe\Service\AbstractService
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe\Service\Issuing;
6
 
7
  class CardholderService extends \Stripe\Service\AbstractService
vendor/stripe/stripe-php/lib/Service/Issuing/DisputeService.php CHANGED
@@ -1,5 +1,7 @@
1
  <?php
2
 
 
 
3
  namespace Stripe\Service\Issuing;
4
 
5
  class DisputeService extends \Stripe\Service\AbstractService
@@ -22,7 +24,11 @@ class DisputeService extends \Stripe\Service\AbstractService
22
  }
23
 
24
  /**
25
- * Creates an Issuing <code>Dispute</code> object.
 
 
 
 
26
  *
27
  * @param null|array $params
28
  * @param null|array|\Stripe\Util\RequestOptions $opts
@@ -55,6 +61,8 @@ class DisputeService extends \Stripe\Service\AbstractService
55
  /**
56
  * Updates the specified Issuing <code>Dispute</code> object by setting the values
57
  * of the parameters passed. Any parameters not provided will be left unchanged.
 
 
58
  *
59
  * @param string $id
60
  * @param null|array $params
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe\Service\Issuing;
6
 
7
  class DisputeService extends \Stripe\Service\AbstractService
24
  }
25
 
26
  /**
27
+ * Creates an Issuing <code>Dispute</code> object. Individual pieces of evidence
28
+ * within the <code>evidence</code> object are optional at this point. Stripe only
29
+ * validates that required evidence is present during submission. Refer to <a
30
+ * href="/docs/issuing/purchases/disputes#dispute-reasons-and-evidence">Dispute
31
+ * reasons and evidence</a> for more details about evidence requirements.
32
  *
33
  * @param null|array $params
34
  * @param null|array|\Stripe\Util\RequestOptions $opts
61
  /**
62
  * Updates the specified Issuing <code>Dispute</code> object by setting the values
63
  * of the parameters passed. Any parameters not provided will be left unchanged.
64
+ * Properties on the <code>evidence</code> object can be unset by passing in an
65
+ * empty string.
66
  *
67
  * @param string $id
68
  * @param null|array $params
vendor/stripe/stripe-php/lib/Service/Issuing/IssuingServiceFactory.php CHANGED
@@ -1,5 +1,7 @@
1
  <?php
2
 
 
 
3
  namespace Stripe\Service\Issuing;
4
 
5
  /**
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe\Service\Issuing;
6
 
7
  /**
vendor/stripe/stripe-php/lib/Service/Issuing/TransactionService.php CHANGED
@@ -1,5 +1,7 @@
1
  <?php
2
 
 
 
3
  namespace Stripe\Service\Issuing;
4
 
5
  class TransactionService extends \Stripe\Service\AbstractService
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe\Service\Issuing;
6
 
7
  class TransactionService extends \Stripe\Service\AbstractService
vendor/stripe/stripe-php/lib/Service/MandateService.php CHANGED
@@ -1,5 +1,7 @@
1
  <?php
2
 
 
 
3
  namespace Stripe\Service;
4
 
5
  class MandateService extends \Stripe\Service\AbstractService
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe\Service;
6
 
7
  class MandateService extends \Stripe\Service\AbstractService
vendor/stripe/stripe-php/lib/Service/OAuthService.php CHANGED
@@ -55,7 +55,7 @@ class OAuthService extends \Stripe\Service\AbstractService
55
  *
56
  * @throws \Stripe\Exception\OAuth\OAuthErrorException if the request fails
57
  *
58
- * @return StripeObject object containing the response from the API
59
  */
60
  public function token($params = null, $opts = null)
61
  {
@@ -73,7 +73,7 @@ class OAuthService extends \Stripe\Service\AbstractService
73
  *
74
  * @throws \Stripe\Exception\OAuth\OAuthErrorException if the request fails
75
  *
76
- * @return StripeObject object containing the response from the API
77
  */
78
  public function deauthorize($params = null, $opts = null)
79
  {
55
  *
56
  * @throws \Stripe\Exception\OAuth\OAuthErrorException if the request fails
57
  *
58
+ * @return \Stripe\StripeObject object containing the response from the API
59
  */
60
  public function token($params = null, $opts = null)
61
  {
73
  *
74
  * @throws \Stripe\Exception\OAuth\OAuthErrorException if the request fails
75
  *
76
+ * @return \Stripe\StripeObject object containing the response from the API
77
  */
78
  public function deauthorize($params = null, $opts = null)
79
  {
vendor/stripe/stripe-php/lib/Service/OrderReturnService.php CHANGED
@@ -1,5 +1,7 @@
1
  <?php
2
 
 
 
3
  namespace Stripe\Service;
4
 
5
  class OrderReturnService extends \Stripe\Service\AbstractService
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe\Service;
6
 
7
  class OrderReturnService extends \Stripe\Service\AbstractService
vendor/stripe/stripe-php/lib/Service/OrderService.php CHANGED
@@ -1,5 +1,7 @@
1
  <?php
2
 
 
 
3
  namespace Stripe\Service;
4
 
5
  class OrderService extends \Stripe\Service\AbstractService
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe\Service;
6
 
7
  class OrderService extends \Stripe\Service\AbstractService
vendor/stripe/stripe-php/lib/Service/PaymentIntentService.php CHANGED
@@ -1,5 +1,7 @@
1
  <?php
2
 
 
 
3
  namespace Stripe\Service;
4
 
5
  class PaymentIntentService extends \Stripe\Service\AbstractService
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe\Service;
6
 
7
  class PaymentIntentService extends \Stripe\Service\AbstractService
vendor/stripe/stripe-php/lib/Service/PaymentMethodService.php CHANGED
@@ -1,5 +1,7 @@
1
  <?php
2
 
 
 
3
  namespace Stripe\Service;
4
 
5
  class PaymentMethodService extends \Stripe\Service\AbstractService
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe\Service;
6
 
7
  class PaymentMethodService extends \Stripe\Service\AbstractService
vendor/stripe/stripe-php/lib/Service/PayoutService.php CHANGED
@@ -1,5 +1,7 @@
1
  <?php
2
 
 
 
3
  namespace Stripe\Service;
4
 
5
  class PayoutService extends \Stripe\Service\AbstractService
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe\Service;
6
 
7
  class PayoutService extends \Stripe\Service\AbstractService
vendor/stripe/stripe-php/lib/Service/PlanService.php CHANGED
@@ -1,5 +1,7 @@
1
  <?php
2
 
 
 
3
  namespace Stripe\Service;
4
 
5
  class PlanService extends \Stripe\Service\AbstractService
@@ -20,8 +22,9 @@ class PlanService extends \Stripe\Service\AbstractService
20
  }
21
 
22
  /**
23
- * You can create plans using the API, or in the Stripe <a
24
- * href="https://dashboard.stripe.com/products">Dashboard</a>.
 
25
  *
26
  * @param null|array $params
27
  * @param null|array|\Stripe\Util\RequestOptions $opts
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe\Service;
6
 
7
  class PlanService extends \Stripe\Service\AbstractService
22
  }
23
 
24
  /**
25
+ * You can now model subscriptions more flexibly using the <a href="#prices">Prices
26
+ * API</a>. It replaces the Plans API and is backwards compatible to simplify your
27
+ * migration.
28
  *
29
  * @param null|array $params
30
  * @param null|array|\Stripe\Util\RequestOptions $opts
vendor/stripe/stripe-php/lib/Service/PriceService.php CHANGED
@@ -1,5 +1,7 @@
1
  <?php
2
 
 
 
3
  namespace Stripe\Service;
4
 
5
  class PriceService extends \Stripe\Service\AbstractService
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe\Service;
6
 
7
  class PriceService extends \Stripe\Service\AbstractService
vendor/stripe/stripe-php/lib/Service/ProductService.php CHANGED
@@ -1,5 +1,7 @@
1
  <?php
2
 
 
 
3
  namespace Stripe\Service;
4
 
5
  class ProductService extends \Stripe\Service\AbstractService
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe\Service;
6
 
7
  class ProductService extends \Stripe\Service\AbstractService
vendor/stripe/stripe-php/lib/Service/PromotionCodeService.php ADDED
@@ -0,0 +1,72 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // File generated from our OpenAPI spec
4
+
5
+ namespace Stripe\Service;
6
+
7
+ class PromotionCodeService extends \Stripe\Service\AbstractService
8
+ {
9
+ /**
10
+ * Returns a list of your promotion codes.
11
+ *
12
+ * @param null|array $params
13
+ * @param null|array|\Stripe\Util\RequestOptions $opts
14
+ *
15
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
16
+ *
17
+ * @return \Stripe\Collection
18
+ */
19
+ public function all($params = null, $opts = null)
20
+ {
21
+ return $this->requestCollection('get', '/v1/promotion_codes', $params, $opts);
22
+ }
23
+
24
+ /**
25
+ * A promotion code points to a coupon. You can optionally restrict the code to a
26
+ * specific customer, redemption limit, and expiration date.
27
+ *
28
+ * @param null|array $params
29
+ * @param null|array|\Stripe\Util\RequestOptions $opts
30
+ *
31
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
32
+ *
33
+ * @return \Stripe\PromotionCode
34
+ */
35
+ public function create($params = null, $opts = null)
36
+ {
37
+ return $this->request('post', '/v1/promotion_codes', $params, $opts);
38
+ }
39
+
40
+ /**
41
+ * Retrieves the promotion code with the given ID.
42
+ *
43
+ * @param string $id
44
+ * @param null|array $params
45
+ * @param null|array|\Stripe\Util\RequestOptions $opts
46
+ *
47
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
48
+ *
49
+ * @return \Stripe\PromotionCode
50
+ */
51
+ public function retrieve($id, $params = null, $opts = null)
52
+ {
53
+ return $this->request('get', $this->buildPath('/v1/promotion_codes/%s', $id), $params, $opts);
54
+ }
55
+
56
+ /**
57
+ * Updates the specified promotion code by setting the values of the parameters
58
+ * passed. Most fields are, by design, not editable.
59
+ *
60
+ * @param string $id
61
+ * @param null|array $params
62
+ * @param null|array|\Stripe\Util\RequestOptions $opts
63
+ *
64
+ * @throws \Stripe\Exception\ApiErrorException if the request fails
65
+ *
66
+ * @return \Stripe\PromotionCode
67
+ */
68
+ public function update($id, $params = null, $opts = null)
69
+ {
70
+ return $this->request('post', $this->buildPath('/v1/promotion_codes/%s', $id), $params, $opts);
71
+ }
72
+ }
vendor/stripe/stripe-php/lib/Service/Radar/EarlyFraudWarningService.php CHANGED
@@ -1,5 +1,7 @@
1
  <?php
2
 
 
 
3
  namespace Stripe\Service\Radar;
4
 
5
  class EarlyFraudWarningService extends \Stripe\Service\AbstractService
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe\Service\Radar;
6
 
7
  class EarlyFraudWarningService extends \Stripe\Service\AbstractService
vendor/stripe/stripe-php/lib/Service/Radar/RadarServiceFactory.php CHANGED
@@ -1,5 +1,7 @@
1
  <?php
2
 
 
 
3
  namespace Stripe\Service\Radar;
4
 
5
  /**
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe\Service\Radar;
6
 
7
  /**
vendor/stripe/stripe-php/lib/Service/Radar/ValueListItemService.php CHANGED
@@ -1,5 +1,7 @@
1
  <?php
2
 
 
 
3
  namespace Stripe\Service\Radar;
4
 
5
  class ValueListItemService extends \Stripe\Service\AbstractService
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe\Service\Radar;
6
 
7
  class ValueListItemService extends \Stripe\Service\AbstractService
vendor/stripe/stripe-php/lib/Service/Radar/ValueListService.php CHANGED
@@ -1,5 +1,7 @@
1
  <?php
2
 
 
 
3
  namespace Stripe\Service\Radar;
4
 
5
  class ValueListService extends \Stripe\Service\AbstractService
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe\Service\Radar;
6
 
7
  class ValueListService extends \Stripe\Service\AbstractService
vendor/stripe/stripe-php/lib/Service/RefundService.php CHANGED
@@ -1,5 +1,7 @@
1
  <?php
2
 
 
 
3
  namespace Stripe\Service;
4
 
5
  class RefundService extends \Stripe\Service\AbstractService
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe\Service;
6
 
7
  class RefundService extends \Stripe\Service\AbstractService
vendor/stripe/stripe-php/lib/Service/Reporting/ReportRunService.php CHANGED
@@ -1,5 +1,7 @@
1
  <?php
2
 
 
 
3
  namespace Stripe\Service\Reporting;
4
 
5
  class ReportRunService extends \Stripe\Service\AbstractService
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe\Service\Reporting;
6
 
7
  class ReportRunService extends \Stripe\Service\AbstractService
vendor/stripe/stripe-php/lib/Service/Reporting/ReportTypeService.php CHANGED
@@ -1,5 +1,7 @@
1
  <?php
2
 
 
 
3
  namespace Stripe\Service\Reporting;
4
 
5
  class ReportTypeService extends \Stripe\Service\AbstractService
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe\Service\Reporting;
6
 
7
  class ReportTypeService extends \Stripe\Service\AbstractService
vendor/stripe/stripe-php/lib/Service/Reporting/ReportingServiceFactory.php CHANGED
@@ -1,5 +1,7 @@
1
  <?php
2
 
 
 
3
  namespace Stripe\Service\Reporting;
4
 
5
  /**
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe\Service\Reporting;
6
 
7
  /**
vendor/stripe/stripe-php/lib/Service/ReviewService.php CHANGED
@@ -1,5 +1,7 @@
1
  <?php
2
 
 
 
3
  namespace Stripe\Service;
4
 
5
  class ReviewService extends \Stripe\Service\AbstractService
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe\Service;
6
 
7
  class ReviewService extends \Stripe\Service\AbstractService
vendor/stripe/stripe-php/lib/Service/SetupIntentService.php CHANGED
@@ -1,5 +1,7 @@
1
  <?php
2
 
 
 
3
  namespace Stripe\Service;
4
 
5
  class SetupIntentService extends \Stripe\Service\AbstractService
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe\Service;
6
 
7
  class SetupIntentService extends \Stripe\Service\AbstractService
vendor/stripe/stripe-php/lib/Service/Sigma/ScheduledQueryRunService.php CHANGED
@@ -1,5 +1,7 @@
1
  <?php
2
 
 
 
3
  namespace Stripe\Service\Sigma;
4
 
5
  class ScheduledQueryRunService extends \Stripe\Service\AbstractService
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe\Service\Sigma;
6
 
7
  class ScheduledQueryRunService extends \Stripe\Service\AbstractService
vendor/stripe/stripe-php/lib/Service/Sigma/SigmaServiceFactory.php CHANGED
@@ -1,5 +1,7 @@
1
  <?php
2
 
 
 
3
  namespace Stripe\Service\Sigma;
4
 
5
  /**
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe\Service\Sigma;
6
 
7
  /**
vendor/stripe/stripe-php/lib/Service/SkuService.php CHANGED
@@ -1,5 +1,7 @@
1
  <?php
2
 
 
 
3
  namespace Stripe\Service;
4
 
5
  class SkuService extends \Stripe\Service\AbstractService
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe\Service;
6
 
7
  class SkuService extends \Stripe\Service\AbstractService
vendor/stripe/stripe-php/lib/Service/SourceService.php CHANGED
@@ -1,5 +1,7 @@
1
  <?php
2
 
 
 
3
  namespace Stripe\Service;
4
 
5
  class SourceService extends \Stripe\Service\AbstractService
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe\Service;
6
 
7
  class SourceService extends \Stripe\Service\AbstractService
vendor/stripe/stripe-php/lib/Service/SubscriptionItemService.php CHANGED
@@ -1,5 +1,7 @@
1
  <?php
2
 
 
 
3
  namespace Stripe\Service;
4
 
5
  class SubscriptionItemService extends \Stripe\Service\AbstractService
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe\Service;
6
 
7
  class SubscriptionItemService extends \Stripe\Service\AbstractService
vendor/stripe/stripe-php/lib/Service/SubscriptionScheduleService.php CHANGED
@@ -1,5 +1,7 @@
1
  <?php
2
 
 
 
3
  namespace Stripe\Service;
4
 
5
  class SubscriptionScheduleService extends \Stripe\Service\AbstractService
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe\Service;
6
 
7
  class SubscriptionScheduleService extends \Stripe\Service\AbstractService
vendor/stripe/stripe-php/lib/Service/SubscriptionService.php CHANGED
@@ -1,5 +1,7 @@
1
  <?php
2
 
 
 
3
  namespace Stripe\Service;
4
 
5
  class SubscriptionService extends \Stripe\Service\AbstractService
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe\Service;
6
 
7
  class SubscriptionService extends \Stripe\Service\AbstractService
vendor/stripe/stripe-php/lib/Service/TaxRateService.php CHANGED
@@ -1,5 +1,7 @@
1
  <?php
2
 
 
 
3
  namespace Stripe\Service;
4
 
5
  class TaxRateService extends \Stripe\Service\AbstractService
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe\Service;
6
 
7
  class TaxRateService extends \Stripe\Service\AbstractService
vendor/stripe/stripe-php/lib/Service/Terminal/ConnectionTokenService.php CHANGED
@@ -1,5 +1,7 @@
1
  <?php
2
 
 
 
3
  namespace Stripe\Service\Terminal;
4
 
5
  class ConnectionTokenService extends \Stripe\Service\AbstractService
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe\Service\Terminal;
6
 
7
  class ConnectionTokenService extends \Stripe\Service\AbstractService
vendor/stripe/stripe-php/lib/Service/Terminal/LocationService.php CHANGED
@@ -1,5 +1,7 @@
1
  <?php
2
 
 
 
3
  namespace Stripe\Service\Terminal;
4
 
5
  class LocationService extends \Stripe\Service\AbstractService
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe\Service\Terminal;
6
 
7
  class LocationService extends \Stripe\Service\AbstractService
vendor/stripe/stripe-php/lib/Service/Terminal/ReaderService.php CHANGED
@@ -1,5 +1,7 @@
1
  <?php
2
 
 
 
3
  namespace Stripe\Service\Terminal;
4
 
5
  class ReaderService extends \Stripe\Service\AbstractService
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe\Service\Terminal;
6
 
7
  class ReaderService extends \Stripe\Service\AbstractService
vendor/stripe/stripe-php/lib/Service/Terminal/TerminalServiceFactory.php CHANGED
@@ -1,5 +1,7 @@
1
  <?php
2
 
 
 
3
  namespace Stripe\Service\Terminal;
4
 
5
  /**
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe\Service\Terminal;
6
 
7
  /**
vendor/stripe/stripe-php/lib/Service/TokenService.php CHANGED
@@ -1,5 +1,7 @@
1
  <?php
2
 
 
 
3
  namespace Stripe\Service;
4
 
5
  class TokenService extends \Stripe\Service\AbstractService
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe\Service;
6
 
7
  class TokenService extends \Stripe\Service\AbstractService
vendor/stripe/stripe-php/lib/Service/TopupService.php CHANGED
@@ -1,5 +1,7 @@
1
  <?php
2
 
 
 
3
  namespace Stripe\Service;
4
 
5
  class TopupService extends \Stripe\Service\AbstractService
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe\Service;
6
 
7
  class TopupService extends \Stripe\Service\AbstractService
vendor/stripe/stripe-php/lib/Service/TransferService.php CHANGED
@@ -1,5 +1,7 @@
1
  <?php
2
 
 
 
3
  namespace Stripe\Service;
4
 
5
  class TransferService extends \Stripe\Service\AbstractService
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe\Service;
6
 
7
  class TransferService extends \Stripe\Service\AbstractService
vendor/stripe/stripe-php/lib/Service/WebhookEndpointService.php CHANGED
@@ -1,5 +1,7 @@
1
  <?php
2
 
 
 
3
  namespace Stripe\Service;
4
 
5
  class WebhookEndpointService extends \Stripe\Service\AbstractService
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe\Service;
6
 
7
  class WebhookEndpointService extends \Stripe\Service\AbstractService
vendor/stripe/stripe-php/lib/SetupIntent.php CHANGED
@@ -1,5 +1,7 @@
1
  <?php
2
 
 
 
3
  namespace Stripe;
4
 
5
  /**
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe;
6
 
7
  /**
vendor/stripe/stripe-php/lib/Sigma/ScheduledQueryRun.php CHANGED
@@ -1,5 +1,7 @@
1
  <?php
2
 
 
 
3
  namespace Stripe\Sigma;
4
 
5
  /**
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe\Sigma;
6
 
7
  /**
vendor/stripe/stripe-php/lib/Source.php CHANGED
@@ -1,5 +1,7 @@
1
  <?php
2
 
 
 
3
  namespace Stripe;
4
 
5
  /**
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe;
6
 
7
  /**
vendor/stripe/stripe-php/lib/Stripe.php CHANGED
@@ -58,7 +58,7 @@ class Stripe
58
  /** @var float Initial delay between retries, in seconds */
59
  private static $initialNetworkRetryDelay = 0.5;
60
 
61
- const VERSION = '7.45.0';
62
 
63
  /**
64
  * @return string the API key used for requests
58
  /** @var float Initial delay between retries, in seconds */
59
  private static $initialNetworkRetryDelay = 0.5;
60
 
61
+ const VERSION = '7.50.0';
62
 
63
  /**
64
  * @return string the API key used for requests
vendor/stripe/stripe-php/lib/StripeClient.php CHANGED
@@ -1,5 +1,7 @@
1
  <?php
2
 
 
 
3
  namespace Stripe;
4
 
5
  /**
@@ -37,6 +39,7 @@ namespace Stripe;
37
  * @property \Stripe\Service\PlanService $plans
38
  * @property \Stripe\Service\PriceService $prices
39
  * @property \Stripe\Service\ProductService $products
 
40
  * @property \Stripe\Service\Radar\RadarServiceFactory $radar
41
  * @property \Stripe\Service\RefundService $refunds
42
  * @property \Stripe\Service\Reporting\ReportingServiceFactory $reporting
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe;
6
 
7
  /**
39
  * @property \Stripe\Service\PlanService $plans
40
  * @property \Stripe\Service\PriceService $prices
41
  * @property \Stripe\Service\ProductService $products
42
+ * @property \Stripe\Service\PromotionCodeService $promotionCodes
43
  * @property \Stripe\Service\Radar\RadarServiceFactory $radar
44
  * @property \Stripe\Service\RefundService $refunds
45
  * @property \Stripe\Service\Reporting\ReportingServiceFactory $reporting
vendor/stripe/stripe-php/lib/Subscription.php CHANGED
@@ -1,5 +1,7 @@
1
  <?php
2
 
 
 
3
  namespace Stripe;
4
 
5
  /**
@@ -37,12 +39,9 @@ namespace Stripe;
37
  * @property null|\Stripe\StripeObject $pending_invoice_item_interval Specifies an interval for how often to bill for any pending invoice items. It is analogous to calling <a href="https://stripe.com/docs/api#create_invoice">Create an invoice</a> for the given subscription at the specified interval.
38
  * @property null|string|\Stripe\SetupIntent $pending_setup_intent You can use this <a href="https://stripe.com/docs/api/setup_intents">SetupIntent</a> to collect user authentication when creating a subscription without immediate payment or updating a subscription's payment method, allowing you to optimize for off-session payments. Learn more in the <a href="https://stripe.com/docs/billing/migration/strong-customer-authentication#scenario-2">SCA Migration Guide</a>.
39
  * @property null|\Stripe\StripeObject $pending_update If specified, <a href="https://stripe.com/docs/billing/subscriptions/pending-updates">pending updates</a> that will be applied to the subscription once the <code>latest_invoice</code> has been paid.
40
- * @property null|\Stripe\Plan $plan Hash describing the plan the customer is subscribed to. Only set if the subscription contains a single plan.
41
- * @property null|int $quantity The quantity of the plan to which the customer is subscribed. For example, if your plan is $10/user/month, and your customer has 5 users, you could pass 5 as the quantity to have the customer charged $50 (5 x $10) monthly. Only set if the subscription contains a single plan.
42
  * @property null|string|\Stripe\SubscriptionSchedule $schedule The schedule attached to the subscription
43
  * @property int $start_date Date when the subscription was first created. The date might differ from the <code>created</code> date due to backdating.
44
  * @property string $status <p>Possible values are <code>incomplete</code>, <code>incomplete_expired</code>, <code>trialing</code>, <code>active</code>, <code>past_due</code>, <code>canceled</code>, or <code>unpaid</code>.</p><p>For <code>collection_method=charge_automatically</code> a subscription moves into <code>incomplete</code> if the initial payment attempt fails. A subscription in this state can only have metadata and default_source updated. Once the first invoice is paid, the subscription moves into an <code>active</code> state. If the first invoice is not paid within 23 hours, the subscription transitions to <code>incomplete_expired</code>. This is a terminal state, the open invoice will be voided and no further invoices will be generated.</p><p>A subscription that is currently in a trial period is <code>trialing</code> and moves to <code>active</code> when the trial period is over.</p><p>If subscription <code>collection_method=charge_automatically</code> it becomes <code>past_due</code> when payment to renew it fails and <code>canceled</code> or <code>unpaid</code> (depending on your subscriptions settings) when Stripe has exhausted all payment retry attempts.</p><p>If subscription <code>collection_method=send_invoice</code> it becomes <code>past_due</code> when its invoice is not paid by the due date, and <code>canceled</code> or <code>unpaid</code> if it is still not paid by an additional deadline after that. Note that when a subscription has a status of <code>unpaid</code>, no subsequent invoices will be attempted (invoices will be created, but then immediately automatically closed). After receiving updated payment information from a customer, you may choose to reopen and pay their closed invoices.</p>
45
- * @property null|float $tax_percent If provided, each invoice created by this subscription will apply the tax rate, increasing the amount billed to the customer.
46
  * @property null|int $trial_end If the subscription has a trial, the end of that trial.
47
  * @property null|int $trial_start If the subscription has a trial, the beginning of that trial.
48
  */
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe;
6
 
7
  /**
39
  * @property null|\Stripe\StripeObject $pending_invoice_item_interval Specifies an interval for how often to bill for any pending invoice items. It is analogous to calling <a href="https://stripe.com/docs/api#create_invoice">Create an invoice</a> for the given subscription at the specified interval.
40
  * @property null|string|\Stripe\SetupIntent $pending_setup_intent You can use this <a href="https://stripe.com/docs/api/setup_intents">SetupIntent</a> to collect user authentication when creating a subscription without immediate payment or updating a subscription's payment method, allowing you to optimize for off-session payments. Learn more in the <a href="https://stripe.com/docs/billing/migration/strong-customer-authentication#scenario-2">SCA Migration Guide</a>.
41
  * @property null|\Stripe\StripeObject $pending_update If specified, <a href="https://stripe.com/docs/billing/subscriptions/pending-updates">pending updates</a> that will be applied to the subscription once the <code>latest_invoice</code> has been paid.
 
 
42
  * @property null|string|\Stripe\SubscriptionSchedule $schedule The schedule attached to the subscription
43
  * @property int $start_date Date when the subscription was first created. The date might differ from the <code>created</code> date due to backdating.
44
  * @property string $status <p>Possible values are <code>incomplete</code>, <code>incomplete_expired</code>, <code>trialing</code>, <code>active</code>, <code>past_due</code>, <code>canceled</code>, or <code>unpaid</code>.</p><p>For <code>collection_method=charge_automatically</code> a subscription moves into <code>incomplete</code> if the initial payment attempt fails. A subscription in this state can only have metadata and default_source updated. Once the first invoice is paid, the subscription moves into an <code>active</code> state. If the first invoice is not paid within 23 hours, the subscription transitions to <code>incomplete_expired</code>. This is a terminal state, the open invoice will be voided and no further invoices will be generated.</p><p>A subscription that is currently in a trial period is <code>trialing</code> and moves to <code>active</code> when the trial period is over.</p><p>If subscription <code>collection_method=charge_automatically</code> it becomes <code>past_due</code> when payment to renew it fails and <code>canceled</code> or <code>unpaid</code> (depending on your subscriptions settings) when Stripe has exhausted all payment retry attempts.</p><p>If subscription <code>collection_method=send_invoice</code> it becomes <code>past_due</code> when its invoice is not paid by the due date, and <code>canceled</code> or <code>unpaid</code> if it is still not paid by an additional deadline after that. Note that when a subscription has a status of <code>unpaid</code>, no subsequent invoices will be attempted (invoices will be created, but then immediately automatically closed). After receiving updated payment information from a customer, you may choose to reopen and pay their closed invoices.</p>
 
45
  * @property null|int $trial_end If the subscription has a trial, the end of that trial.
46
  * @property null|int $trial_start If the subscription has a trial, the beginning of that trial.
47
  */
vendor/stripe/stripe-php/lib/SubscriptionItem.php CHANGED
@@ -1,5 +1,7 @@
1
  <?php
2
 
 
 
3
  namespace Stripe;
4
 
5
  /**
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe;
6
 
7
  /**
vendor/stripe/stripe-php/lib/SubscriptionSchedule.php CHANGED
@@ -1,5 +1,7 @@
1
  <?php
2
 
 
 
3
  namespace Stripe;
4
 
5
  /**
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe;
6
 
7
  /**
vendor/stripe/stripe-php/lib/TaxId.php CHANGED
@@ -1,5 +1,7 @@
1
  <?php
2
 
 
 
3
  namespace Stripe;
4
 
5
  /**
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe;
6
 
7
  /**
vendor/stripe/stripe-php/lib/TaxRate.php CHANGED
@@ -1,5 +1,7 @@
1
  <?php
2
 
 
 
3
  namespace Stripe;
4
 
5
  /**
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe;
6
 
7
  /**
vendor/stripe/stripe-php/lib/Terminal/ConnectionToken.php CHANGED
@@ -1,5 +1,7 @@
1
  <?php
2
 
 
 
3
  namespace Stripe\Terminal;
4
 
5
  /**
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe\Terminal;
6
 
7
  /**
vendor/stripe/stripe-php/lib/Terminal/Location.php CHANGED
@@ -1,5 +1,7 @@
1
  <?php
2
 
 
 
3
  namespace Stripe\Terminal;
4
 
5
  /**
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe\Terminal;
6
 
7
  /**
vendor/stripe/stripe-php/lib/Terminal/Reader.php CHANGED
@@ -1,5 +1,7 @@
1
  <?php
2
 
 
 
3
  namespace Stripe\Terminal;
4
 
5
  /**
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe\Terminal;
6
 
7
  /**
vendor/stripe/stripe-php/lib/ThreeDSecure.php CHANGED
@@ -1,5 +1,7 @@
1
  <?php
2
 
 
 
3
  namespace Stripe;
4
 
5
  /**
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe;
6
 
7
  /**
vendor/stripe/stripe-php/lib/Token.php CHANGED
@@ -1,5 +1,7 @@
1
  <?php
2
 
 
 
3
  namespace Stripe;
4
 
5
  /**
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe;
6
 
7
  /**
vendor/stripe/stripe-php/lib/Topup.php CHANGED
@@ -1,5 +1,7 @@
1
  <?php
2
 
 
 
3
  namespace Stripe;
4
 
5
  /**
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe;
6
 
7
  /**
vendor/stripe/stripe-php/lib/Transfer.php CHANGED
@@ -1,5 +1,7 @@
1
  <?php
2
 
 
 
3
  namespace Stripe;
4
 
5
  /**
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe;
6
 
7
  /**
vendor/stripe/stripe-php/lib/TransferReversal.php CHANGED
@@ -1,5 +1,7 @@
1
  <?php
2
 
 
 
3
  namespace Stripe;
4
 
5
  /**
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe;
6
 
7
  /**
vendor/stripe/stripe-php/lib/UsageRecord.php CHANGED
@@ -1,5 +1,7 @@
1
  <?php
2
 
 
 
3
  namespace Stripe;
4
 
5
  /**
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe;
6
 
7
  /**
vendor/stripe/stripe-php/lib/UsageRecordSummary.php CHANGED
@@ -1,5 +1,7 @@
1
  <?php
2
 
 
 
3
  namespace Stripe;
4
 
5
  /**
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe;
6
 
7
  /**
vendor/stripe/stripe-php/lib/Util/ObjectTypes.php CHANGED
@@ -1,5 +1,7 @@
1
  <?php
2
 
 
 
3
  namespace Stripe\Util;
4
 
5
  class ObjectTypes
@@ -61,6 +63,7 @@ class ObjectTypes
61
  \Stripe\Plan::OBJECT_NAME => \Stripe\Plan::class,
62
  \Stripe\Price::OBJECT_NAME => \Stripe\Price::class,
63
  \Stripe\Product::OBJECT_NAME => \Stripe\Product::class,
 
64
  \Stripe\Radar\EarlyFraudWarning::OBJECT_NAME => \Stripe\Radar\EarlyFraudWarning::class,
65
  \Stripe\Radar\ValueList::OBJECT_NAME => \Stripe\Radar\ValueList::class,
66
  \Stripe\Radar\ValueListItem::OBJECT_NAME => \Stripe\Radar\ValueListItem::class,
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe\Util;
6
 
7
  class ObjectTypes
63
  \Stripe\Plan::OBJECT_NAME => \Stripe\Plan::class,
64
  \Stripe\Price::OBJECT_NAME => \Stripe\Price::class,
65
  \Stripe\Product::OBJECT_NAME => \Stripe\Product::class,
66
+ \Stripe\PromotionCode::OBJECT_NAME => \Stripe\PromotionCode::class,
67
  \Stripe\Radar\EarlyFraudWarning::OBJECT_NAME => \Stripe\Radar\EarlyFraudWarning::class,
68
  \Stripe\Radar\ValueList::OBJECT_NAME => \Stripe\Radar\ValueList::class,
69
  \Stripe\Radar\ValueListItem::OBJECT_NAME => \Stripe\Radar\ValueListItem::class,
vendor/stripe/stripe-php/lib/WebhookEndpoint.php CHANGED
@@ -1,5 +1,7 @@
1
  <?php
2
 
 
 
3
  namespace Stripe;
4
 
5
  /**
1
  <?php
2
 
3
+ // File generated from our OpenAPI spec
4
+
5
  namespace Stripe;
6
 
7
  /**