WooCommerce Stripe Payment Gateway - Version 4.0.5

Version Description

  • 2018-02-02 =
  • Fix - Illegal offset error on settings when non is defined or saved.
  • Fix - Wrong ID used for dispute webhook handler.
  • Fix - A WC 2.6 backwards compat issue while trying to get order id in subscriptions.
  • Fix - Processing SEPA can't find email when not logged in.
  • Add - Allow restricted secret keys to be used.
  • Add - Statement Descriptor to SEPA Direct Debit.
  • Add - Idempotency failure retry with easing to prevent multirequest issue.
  • Add - POT file.
  • Tweak - Make billing name optional on pay for order page.

See changelog for all versions.

=

Download this release

Release Info

Developer royho
Plugin Icon 128x128 WooCommerce Stripe Payment Gateway
Version 4.0.5
Comparing to
See all releases

Code changes from version 4.0.4 to 4.0.5

assets/js/stripe-admin.min.js CHANGED
@@ -1 +1 @@
1
- jQuery(function(a){"use strict";var b={isTestMode:function(){return a("#woocommerce_stripe_testmode").is(":checked")},getSecretKey:function(){return b.isTestMode()?a("#woocommerce_stripe_test_secret_key").val():a("#woocommerce_stripe_secret_key").val()},init:function(){a(document.body).on("change","#woocommerce_stripe_testmode",function(){var b=a("#woocommerce_stripe_test_secret_key").parents("tr").eq(0),c=a("#woocommerce_stripe_test_publishable_key").parents("tr").eq(0),d=a("#woocommerce_stripe_secret_key").parents("tr").eq(0),e=a("#woocommerce_stripe_publishable_key").parents("tr").eq(0);a(this).is(":checked")?(b.show(),c.show(),d.hide(),e.hide()):(b.hide(),c.hide(),d.show(),e.show())}),a("#woocommerce_stripe_testmode").change(),a("#woocommerce_stripe_stripe_checkout").change(function(){a(this).is(":checked")?a("#woocommerce_stripe_stripe_bitcoin, #woocommerce_stripe_stripe_checkout_image").closest("tr").show():a("#woocommerce_stripe_stripe_bitcoin, #woocommerce_stripe_stripe_checkout_image").closest("tr").hide()}).change(),a("#woocommerce_stripe_payment_request").change(function(){a(this).is(":checked")?a("#woocommerce_stripe_payment_request_button_theme, #woocommerce_stripe_payment_request_button_type, #woocommerce_stripe_payment_request_button_height").closest("tr").show():a("#woocommerce_stripe_payment_request_button_theme, #woocommerce_stripe_payment_request_button_type, #woocommerce_stripe_payment_request_button_height").closest("tr").hide()}).change()}};b.init()});
1
+ jQuery(function(e){"use strict";var t={isTestMode:function(){return e("#woocommerce_stripe_testmode").is(":checked")},getSecretKey:function(){return t.isTestMode()?e("#woocommerce_stripe_test_secret_key").val():e("#woocommerce_stripe_secret_key").val()},init:function(){e(document.body).on("change","#woocommerce_stripe_testmode",function(){var t=e("#woocommerce_stripe_test_secret_key").parents("tr").eq(0),o=e("#woocommerce_stripe_test_publishable_key").parents("tr").eq(0),c=e("#woocommerce_stripe_secret_key").parents("tr").eq(0),r=e("#woocommerce_stripe_publishable_key").parents("tr").eq(0);e(this).is(":checked")?(t.show(),o.show(),c.hide(),r.hide()):(t.hide(),o.hide(),c.show(),r.show())}),e("#woocommerce_stripe_testmode").change(),e("#woocommerce_stripe_stripe_checkout").change(function(){e(this).is(":checked")?e("#woocommerce_stripe_stripe_bitcoin, #woocommerce_stripe_stripe_checkout_image").closest("tr").show():e("#woocommerce_stripe_stripe_bitcoin, #woocommerce_stripe_stripe_checkout_image").closest("tr").hide()}).change(),e("#woocommerce_stripe_payment_request").change(function(){e(this).is(":checked")?e("#woocommerce_stripe_payment_request_button_theme, #woocommerce_stripe_payment_request_button_type, #woocommerce_stripe_payment_request_button_height").closest("tr").show():e("#woocommerce_stripe_payment_request_button_theme, #woocommerce_stripe_payment_request_button_type, #woocommerce_stripe_payment_request_button_height").closest("tr").hide()}).change()}};t.init()});
assets/js/stripe-payment-request.min.js CHANGED
@@ -1 +1 @@
1
- jQuery(function(a){"use strict";var b,c=Stripe(wc_stripe_payment_request_params.stripe.key),d={getAjaxURL:function(a){return wc_stripe_payment_request_params.ajax_url.toString().replace("%%endpoint%%","wc_stripe_"+a)},getCartDetails:function(b){var c={security:wc_stripe_payment_request_params.nonce.payment};a.ajax({type:"POST",data:c,url:d.getAjaxURL("get_cart_details"),success:function(a){b.update({total:a.order_data.total})}})},getAttributes:function(){var b=a(".variations_form").find(".variations select"),c={},d=0,e=0;return b.each(function(){var b=a(this).data("attribute_name")||a(this).attr("name"),f=a(this).val()||"";f.length>0&&e++,d++,c[b]=f}),{count:d,chosenCount:e,data:c}},processSource:function(b,c){var e=d.getOrderData(b,c);return a.ajax({type:"POST",data:e,dataType:"json",url:d.getAjaxURL("create_order")})},getOrderData:function(a,b){var c=a.source,d=c.owner.email,e=c.owner.phone,f=c.owner.address,g=c.owner.name,h=a.shippingAddress,i={_wpnonce:wc_stripe_payment_request_params.nonce.checkout,billing_first_name:null!==g?g.split(" ").slice(0,1).join(" "):"",billing_last_name:null!==g?g.split(" ").slice(1).join(" "):"",billing_company:"",billing_email:null!==d?d:a.payerEmail,billing_phone:null!==e?e:a.payerPhone.replace("/[() -]/g",""),billing_country:null!==f?f.country:"",billing_address_1:null!==f?f.line1:"",billing_address_2:null!==f?f.line2:"",billing_city:null!==f?f.city:"",billing_state:null!==f?f.state:"",billing_postcode:null!==f?f.postal_code:"",shipping_first_name:"",shipping_last_name:"",shipping_company:"",shipping_country:"",shipping_address_1:"",shipping_address_2:"",shipping_city:"",shipping_state:"",shipping_postcode:"",shipping_method:[null===a.shippingOption?null:a.shippingOption.id],order_comments:"",payment_method:"stripe",ship_to_different_address:1,terms:1,stripe_source:c.id,payment_request_type:b};return h&&(i.shipping_first_name=h.recipient.split(" ").slice(0,1).join(" "),i.shipping_last_name=h.recipient.split(" ").slice(1).join(" "),i.shipping_company=h.organization,i.shipping_country=h.country,i.shipping_address_1=void 0===h.addressLine[0]?"":h.addressLine[0],i.shipping_address_2=void 0===h.addressLine[1]?"":h.addressLine[1],i.shipping_city=h.city,i.shipping_state=h.region,i.shipping_postcode=h.postalCode),i},getErrorMessageHTML:function(b){return a('<div class="woocommerce-error" />').text(b)},abortPayment:function(b,c){if(b.complete("fail"),a(".woocommerce-error").remove(),wc_stripe_payment_request_params.is_product_page){var d=a(".product");d.before(c),a("html, body").animate({scrollTop:d.prev(".woocommerce-error").offset().top},600)}else{var e=a(".shop_table.cart").closest("form");e.before(c),a("html, body").animate({scrollTop:e.prev(".woocommerce-error").offset().top},600)}},completePayment:function(a,b){d.block(),a.complete("success"),window.location=b},block:function(){a.blockUI({message:null,overlayCSS:{background:"#fff",opacity:.6}})},updateShippingOptions:function(c,e){var f={security:wc_stripe_payment_request_params.nonce.shipping,country:e.country,state:e.region,postcode:e.postalCode,city:e.city,address:void 0===e.addressLine[0]?"":e.addressLine[0],address_2:void 0===e.addressLine[1]?"":e.addressLine[1],payment_request_type:b};return a.ajax({type:"POST",data:f,url:d.getAjaxURL("get_shipping_options")})},updateShippingDetails:function(c,e){var f={security:wc_stripe_payment_request_params.nonce.update_shipping,shipping_method:[e.id],payment_request_type:b};return a.ajax({type:"POST",data:f,url:d.getAjaxURL("update_shipping_method")})},addToCart:function(){var b=a(".single_add_to_cart_button").val();a(".single_variation_wrap").length&&(b=a(".single_variation_wrap").find('input[name="product_id"]').val());var c={security:wc_stripe_payment_request_params.nonce.add_to_cart,product_id:b,qty:a(".quantity .qty").val(),attributes:a(".variations_form").length?d.getAttributes().data:[]};return a.ajax({type:"POST",data:c,url:d.getAjaxURL("add_to_cart")})},clearCart:function(){var b={security:wc_stripe_payment_request_params.nonce.clear_cart};return a.ajax({type:"POST",data:b,url:d.getAjaxURL("clear_cart"),success:function(a){}})},getRequestOptionsFromLocal:function(){return{total:wc_stripe_payment_request_params.product.total,currency:wc_stripe_payment_request_params.checkout.currency_code,country:wc_stripe_payment_request_params.checkout.country_code,requestPayerName:!0,requestPayerEmail:!0,requestPayerPhone:!0,requestShipping:wc_stripe_payment_request_params.product.requestShipping,displayItems:wc_stripe_payment_request_params.product.displayItems}},startPaymentRequest:function(e){var f,g;wc_stripe_payment_request_params.is_product_page?(g=d.getRequestOptionsFromLocal(),f=g):(g={total:e.order_data.total,currency:e.order_data.currency,country:e.order_data.country_code,requestPayerName:!0,requestPayerEmail:!0,requestPayerPhone:!0,requestShipping:!!e.shipping_required,displayItems:e.order_data.displayItems},f=e.order_data);var h=c.paymentRequest(g),i=c.elements({locale:wc_stripe_payment_request_params.button.locale}),j=i.create("paymentRequestButton",{paymentRequest:h,style:{paymentRequestButton:{type:wc_stripe_payment_request_params.button.type,theme:wc_stripe_payment_request_params.button.theme,height:wc_stripe_payment_request_params.button.height+"px"}}});h.canMakePayment().then(function(c){if(c){if(b=c.applePay?"apple_pay":"payment_request_api",wc_stripe_payment_request_params.is_product_page){var e=a(".single_add_to_cart_button");j.on("click",function(a){e.is(".disabled")?(a.preventDefault(),e.is(".wc-variation-is-unavailable")?window.alert(wc_add_to_cart_variation_params.i18n_unavailable_text):e.is(".wc-variation-selection-needed")&&window.alert(wc_add_to_cart_variation_params.i18n_make_a_selection_text)):d.addToCart()}),a(document.body).on("woocommerce_variation_has_changed",function(){a("#wc-stripe-payment-request-button").block({message:null}),a.when(d.getSelectedProductData()).then(function(b){a.when(h.update({total:b.total,displayItems:b.displayItems})).then(function(){a("#wc-stripe-payment-request-button").unblock()})})}),a(".quantity").on("change",".qty",function(){a("#wc-stripe-payment-request-button").block({message:null}),a.when(d.getSelectedProductData()).then(function(b){a.when(h.update({total:b.total,displayItems:b.displayItems})).then(function(){a("#wc-stripe-payment-request-button").unblock()})})})}a("#wc-stripe-payment-request-button").length&&(j.mount("#wc-stripe-payment-request-button"),a("#wc-stripe-payment-request-button-separator").show())}else a("#wc-stripe-payment-request-button").hide(),a("#wc-stripe-payment-request-button-separator").hide()}),h.on("shippingaddresschange",function(b){a.when(d.updateShippingOptions(f,b.shippingAddress)).then(function(a){b.updateWith({status:a.result,shippingOptions:a.shipping_options,total:a.total,displayItems:a.displayItems})})}),h.on("shippingoptionchange",function(b){a.when(d.updateShippingDetails(f,b.shippingOption)).then(function(a){"success"===a.result&&b.updateWith({status:"success",total:a.total,displayItems:a.displayItems}),"fail"===a.result&&b.updateWith({status:"fail"})})}),h.on("source",function(c){"no"===wc_stripe_payment_request_params.stripe.allow_prepaid_card&&"prepaid"===c.source.card.funding?d.abortPayment(c,d.getErrorMessageHTML(wc_stripe_payment_request_params.i18n.no_prepaid_card)):a.when(d.processSource(c,b)).then(function(a){"success"===a.result?d.completePayment(c,a.redirect):d.abortPayment(c,a.messages)})})},getSelectedProductData:function(){var b=a(".single_add_to_cart_button").val();a(".single_variation_wrap").length&&(b=a(".single_variation_wrap").find('input[name="product_id"]').val());var c={security:wc_stripe_payment_request_params.nonce.get_selected_product_data,product_id:b,qty:a(".quantity .qty").val(),attributes:a(".variations_form").length?d.getAttributes().data:[]};return a.ajax({type:"POST",data:c,url:d.getAjaxURL("get_selected_product_data")})},init:function(){var b={security:wc_stripe_payment_request_params.nonce.payment};a.ajax({type:"POST",data:b,url:d.getAjaxURL("get_cart_details"),success:function(a){d.startPaymentRequest(a)}})}};d.init(),a(document.body).on("updated_cart_totals",function(){d.init()}),a(document.body).on("updated_checkout",function(){d.init()})});
1
+ jQuery(function(t){"use strict";var e,a=Stripe(wc_stripe_payment_request_params.stripe.key),n={getAjaxURL:function(t){return wc_stripe_payment_request_params.ajax_url.toString().replace("%%endpoint%%","wc_stripe_"+t)},getCartDetails:function(e){var a={security:wc_stripe_payment_request_params.nonce.payment};t.ajax({type:"POST",data:a,url:n.getAjaxURL("get_cart_details"),success:function(t){e.update({total:t.order_data.total})}})},getAttributes:function(){var e={},a=0,n=0;return t(".variations_form").find(".variations select").each(function(){var r=t(this).data("attribute_name")||t(this).attr("name"),i=t(this).val()||"";i.length>0&&n++,a++,e[r]=i}),{count:a,chosenCount:n,data:e}},processSource:function(e,a){var r=n.getOrderData(e,a);return t.ajax({type:"POST",data:r,dataType:"json",url:n.getAjaxURL("create_order")})},getOrderData:function(t,e){var a=t.source,n=a.owner.email,r=a.owner.phone,i=a.owner.address,s=a.owner.name,p=t.shippingAddress,o={_wpnonce:wc_stripe_payment_request_params.nonce.checkout,billing_first_name:null!==s?s.split(" ").slice(0,1).join(" "):"",billing_last_name:null!==s?s.split(" ").slice(1).join(" "):"",billing_company:"",billing_email:null!==n?n:t.payerEmail,billing_phone:null!==r?r:t.payerPhone.replace("/[() -]/g",""),billing_country:null!==i?i.country:"",billing_address_1:null!==i?i.line1:"",billing_address_2:null!==i?i.line2:"",billing_city:null!==i?i.city:"",billing_state:null!==i?i.state:"",billing_postcode:null!==i?i.postal_code:"",shipping_first_name:"",shipping_last_name:"",shipping_company:"",shipping_country:"",shipping_address_1:"",shipping_address_2:"",shipping_city:"",shipping_state:"",shipping_postcode:"",shipping_method:[null===t.shippingOption?null:t.shippingOption.id],order_comments:"",payment_method:"stripe",ship_to_different_address:1,terms:1,stripe_source:a.id,payment_request_type:e};return p&&(o.shipping_first_name=p.recipient.split(" ").slice(0,1).join(" "),o.shipping_last_name=p.recipient.split(" ").slice(1).join(" "),o.shipping_company=p.organization,o.shipping_country=p.country,o.shipping_address_1=void 0===p.addressLine[0]?"":p.addressLine[0],o.shipping_address_2=void 0===p.addressLine[1]?"":p.addressLine[1],o.shipping_city=p.city,o.shipping_state=p.region,o.shipping_postcode=p.postalCode),o},getErrorMessageHTML:function(e){return t('<div class="woocommerce-error" />').text(e)},abortPayment:function(e,a){if(e.complete("fail"),t(".woocommerce-error").remove(),wc_stripe_payment_request_params.is_product_page){var n=t(".product");n.before(a),t("html, body").animate({scrollTop:n.prev(".woocommerce-error").offset().top},600)}else{var r=t(".shop_table.cart").closest("form");r.before(a),t("html, body").animate({scrollTop:r.prev(".woocommerce-error").offset().top},600)}},completePayment:function(t,e){n.block(),t.complete("success"),window.location=e},block:function(){t.blockUI({message:null,overlayCSS:{background:"#fff",opacity:.6}})},updateShippingOptions:function(a,r){var i={security:wc_stripe_payment_request_params.nonce.shipping,country:r.country,state:r.region,postcode:r.postalCode,city:r.city,address:void 0===r.addressLine[0]?"":r.addressLine[0],address_2:void 0===r.addressLine[1]?"":r.addressLine[1],payment_request_type:e};return t.ajax({type:"POST",data:i,url:n.getAjaxURL("get_shipping_options")})},updateShippingDetails:function(a,r){var i={security:wc_stripe_payment_request_params.nonce.update_shipping,shipping_method:[r.id],payment_request_type:e};return t.ajax({type:"POST",data:i,url:n.getAjaxURL("update_shipping_method")})},addToCart:function(){var e=t(".single_add_to_cart_button").val();t(".single_variation_wrap").length&&(e=t(".single_variation_wrap").find('input[name="product_id"]').val());var a={security:wc_stripe_payment_request_params.nonce.add_to_cart,product_id:e,qty:t(".quantity .qty").val(),attributes:t(".variations_form").length?n.getAttributes().data:[]};return t.ajax({type:"POST",data:a,url:n.getAjaxURL("add_to_cart")})},clearCart:function(){var e={security:wc_stripe_payment_request_params.nonce.clear_cart};return t.ajax({type:"POST",data:e,url:n.getAjaxURL("clear_cart"),success:function(t){}})},getRequestOptionsFromLocal:function(){return{total:wc_stripe_payment_request_params.product.total,currency:wc_stripe_payment_request_params.checkout.currency_code,country:wc_stripe_payment_request_params.checkout.country_code,requestPayerName:!0,requestPayerEmail:!0,requestPayerPhone:!0,requestShipping:wc_stripe_payment_request_params.product.requestShipping,displayItems:wc_stripe_payment_request_params.product.displayItems}},startPaymentRequest:function(r){var i,s;wc_stripe_payment_request_params.is_product_page?(s=n.getRequestOptionsFromLocal(),i=s):(s={total:r.order_data.total,currency:r.order_data.currency,country:r.order_data.country_code,requestPayerName:!0,requestPayerEmail:!0,requestPayerPhone:!0,requestShipping:!!r.shipping_required,displayItems:r.order_data.displayItems},i=r.order_data);var p=a.paymentRequest(s),o=a.elements({locale:wc_stripe_payment_request_params.button.locale}).create("paymentRequestButton",{paymentRequest:p,style:{paymentRequestButton:{type:wc_stripe_payment_request_params.button.type,theme:wc_stripe_payment_request_params.button.theme,height:wc_stripe_payment_request_params.button.height+"px"}}});p.canMakePayment().then(function(a){if(a){if(e=a.applePay?"apple_pay":"payment_request_api",wc_stripe_payment_request_params.is_product_page){var r=t(".single_add_to_cart_button");o.on("click",function(t){r.is(".disabled")?(t.preventDefault(),r.is(".wc-variation-is-unavailable")?window.alert(wc_add_to_cart_variation_params.i18n_unavailable_text):r.is(".wc-variation-selection-needed")&&window.alert(wc_add_to_cart_variation_params.i18n_make_a_selection_text)):n.addToCart()}),t(document.body).on("woocommerce_variation_has_changed",function(){t("#wc-stripe-payment-request-button").block({message:null}),t.when(n.getSelectedProductData()).then(function(e){t.when(p.update({total:e.total,displayItems:e.displayItems})).then(function(){t("#wc-stripe-payment-request-button").unblock()})})}),t(".quantity").on("change",".qty",function(){t("#wc-stripe-payment-request-button").block({message:null}),t.when(n.getSelectedProductData()).then(function(e){t.when(p.update({total:e.total,displayItems:e.displayItems})).then(function(){t("#wc-stripe-payment-request-button").unblock()})})})}t("#wc-stripe-payment-request-button").length&&(o.mount("#wc-stripe-payment-request-button"),t("#wc-stripe-payment-request-button-separator").show())}else t("#wc-stripe-payment-request-button").hide(),t("#wc-stripe-payment-request-button-separator").hide()}),p.on("shippingaddresschange",function(e){t.when(n.updateShippingOptions(i,e.shippingAddress)).then(function(t){e.updateWith({status:t.result,shippingOptions:t.shipping_options,total:t.total,displayItems:t.displayItems})})}),p.on("shippingoptionchange",function(e){t.when(n.updateShippingDetails(i,e.shippingOption)).then(function(t){"success"===t.result&&e.updateWith({status:"success",total:t.total,displayItems:t.displayItems}),"fail"===t.result&&e.updateWith({status:"fail"})})}),p.on("source",function(a){"no"===wc_stripe_payment_request_params.stripe.allow_prepaid_card&&"prepaid"===a.source.card.funding?n.abortPayment(a,n.getErrorMessageHTML(wc_stripe_payment_request_params.i18n.no_prepaid_card)):t.when(n.processSource(a,e)).then(function(t){"success"===t.result?n.completePayment(a,t.redirect):n.abortPayment(a,t.messages)})})},getSelectedProductData:function(){var e=t(".single_add_to_cart_button").val();t(".single_variation_wrap").length&&(e=t(".single_variation_wrap").find('input[name="product_id"]').val());var a={security:wc_stripe_payment_request_params.nonce.get_selected_product_data,product_id:e,qty:t(".quantity .qty").val(),attributes:t(".variations_form").length?n.getAttributes().data:[]};return t.ajax({type:"POST",data:a,url:n.getAjaxURL("get_selected_product_data")})},init:function(){var e={security:wc_stripe_payment_request_params.nonce.payment};t.ajax({type:"POST",data:e,url:n.getAjaxURL("get_cart_details"),success:function(t){n.startPaymentRequest(t)}})}};n.init(),t(document.body).on("updated_cart_totals",function(){n.init()}),t(document.body).on("updated_checkout",function(){n.init()})});
assets/js/stripe.js CHANGED
@@ -422,6 +422,10 @@ jQuery( function( $ ) {
422
  delete extra_details.owner.email;
423
  }
424
 
 
 
 
 
425
  if ( $( '#billing_address_1' ).length > 0 ) {
426
  extra_details.owner.address.line1 = $( '#billing_address_1' ).val();
427
  extra_details.owner.address.line2 = $( '#billing_address_2' ).val();
@@ -497,10 +501,12 @@ jQuery( function( $ ) {
497
  // Handle special inputs that are unique to a payment method.
498
  switch ( source_type ) {
499
  case 'sepa_debit':
500
- var owner = $( '#stripe-payment-data' );
 
 
501
  extra_details.currency = $( '#stripe-' + source_type + '-payment-data' ).data( 'currency' );
502
  extra_details.owner.name = $( '#stripe-sepa-owner' ).val();
503
- extra_details.owner.email = owner.data( 'email' );
504
  extra_details.sepa_debit = { iban: $( '#stripe-sepa-iban' ).val() };
505
  extra_details.mandate = { notification_method: wc_stripe_params.sepa_mandate_notification };
506
  break;
422
  delete extra_details.owner.email;
423
  }
424
 
425
+ if ( typeof extra_details.owner.name !== 'undefined' && 0 >= extra_details.owner.name.length ) {
426
+ delete extra_details.owner.name;
427
+ }
428
+
429
  if ( $( '#billing_address_1' ).length > 0 ) {
430
  extra_details.owner.address.line1 = $( '#billing_address_1' ).val();
431
  extra_details.owner.address.line2 = $( '#billing_address_2' ).val();
501
  // Handle special inputs that are unique to a payment method.
502
  switch ( source_type ) {
503
  case 'sepa_debit':
504
+ var owner = $( '#stripe-payment-data' ),
505
+ email = $( '#billing_email' ).length ? $( '#billing_email' ).val() : owner.data( 'email' );
506
+
507
  extra_details.currency = $( '#stripe-' + source_type + '-payment-data' ).data( 'currency' );
508
  extra_details.owner.name = $( '#stripe-sepa-owner' ).val();
509
+ extra_details.owner.email = email;
510
  extra_details.sepa_debit = { iban: $( '#stripe-sepa-iban' ).val() };
511
  extra_details.mandate = { notification_method: wc_stripe_params.sepa_mandate_notification };
512
  break;
assets/js/stripe.min.js CHANGED
@@ -1 +1 @@
1
- jQuery(function(a){"use strict";var b=Stripe(wc_stripe_params.key);if("yes"===wc_stripe_params.use_elements)var c,d,e,f=wc_stripe_params.elements_options.length?wc_stripe_params.elements_options:{},g=b.elements(f);var h={getAjaxURL:function(a){return wc_stripe_params.ajaxurl.toString().replace("%%endpoint%%","wc_stripe_"+a)},init:function(){"yes"===wc_stripe_params.is_change_payment_page&&a(document.body).trigger("wc-credit-card-form-init"),this.stripe_checkout_submit=!1,a("form.woocommerce-checkout").length&&(this.form=a("form.woocommerce-checkout")),a("form.woocommerce-checkout").on("checkout_place_order_stripe checkout_place_order_stripe_bancontact checkout_place_order_stripe_sofort checkout_place_order_stripe_giropay checkout_place_order_stripe_ideal checkout_place_order_stripe_alipay checkout_place_order_stripe_sepa checkout_place_order_stripe_bitcoin",this.onSubmit),a("form#order_review").length&&(this.form=a("form#order_review")),a("form#order_review").on("submit",this.onSubmit),a("form#add_payment_method").length&&(this.form=a("form#add_payment_method")),a("form#add_payment_method").on("submit",this.onSubmit),a("form.woocommerce-checkout").on("change","#stripe-bank-country",this.reset),a(document).on("stripeError",this.onError).on("checkout_error",this.reset);var b={base:{iconColor:"#666EE8",color:"#31325F",fontSize:"15px","::placeholder":{color:"#CFD7E0"}}},f={focus:"focused",empty:"empty",invalid:"invalid"};"yes"===wc_stripe_params.use_elements&&a("#stripe-card-element").length&&(b=wc_stripe_params.elements_styling?wc_stripe_params.elements_styling:b,f=wc_stripe_params.elements_classes?wc_stripe_params.elements_classes:f,"yes"===wc_stripe_params.inline_cc_form?(c=g.create("card",{style:b,hidePostalCode:!0}),c.addEventListener("change",function(b){h.onCCFormChange(),b.error&&a(document.body).trigger("stripeError",b)})):(c=g.create("cardNumber",{style:b,classes:f}),d=g.create("cardExpiry",{style:b,classes:f}),e=g.create("cardCvc",{style:b,classes:f}),c.addEventListener("change",function(b){h.onCCFormChange(),b.error&&a(document.body).trigger("stripeError",b)}),d.addEventListener("change",function(b){h.onCCFormChange(),b.error&&a(document.body).trigger("stripeError",b)}),e.addEventListener("change",function(b){h.onCCFormChange(),b.error&&a(document.body).trigger("stripeError",b)})),wc_stripe_params.is_checkout?a(document.body).on("updated_checkout",function(){c&&("yes"===wc_stripe_params.inline_cc_form?c.unmount("#stripe-card-element"):(c.unmount("#stripe-card-element"),d.unmount("#stripe-exp-element"),e.unmount("#stripe-cvc-element"))),"yes"===wc_stripe_params.inline_cc_form?c.mount("#stripe-card-element"):(c.mount("#stripe-card-element"),d.mount("#stripe-exp-element"),e.mount("#stripe-cvc-element"))}):(a("form#add_payment_method").length||a("form#order_review").length)&&("yes"===wc_stripe_params.inline_cc_form?c.mount("#stripe-card-element"):(c.mount("#stripe-card-element"),d.mount("#stripe-exp-element"),e.mount("#stripe-cvc-element"))))},isStripeChosen:function(){return a("#payment_method_stripe, #payment_method_stripe_bancontact, #payment_method_stripe_sofort, #payment_method_stripe_giropay, #payment_method_stripe_ideal, #payment_method_stripe_alipay, #payment_method_stripe_sepa, #payment_method_stripe_bitcoin").is(":checked")||a("#payment_method_stripe").is(":checked")&&"new"===a('input[name="wc-stripe-payment-token"]:checked').val()||a("#payment_method_stripe_sepa").is(":checked")&&"new"===a('input[name="wc-stripe-payment-token"]:checked').val()},isStripeSaveCardChosen:function(){return a("#payment_method_stripe").is(":checked")&&a('input[name="wc-stripe-payment-token"]').is(":checked")&&"new"!==a('input[name="wc-stripe-payment-token"]:checked').val()||a("#payment_method_stripe_sepa").is(":checked")&&a('input[name="wc-stripe_sepa-payment-token"]').is(":checked")&&"new"!==a('input[name="wc-stripe_sepa-payment-token"]:checked').val()},isStripeCardChosen:function(){return a("#payment_method_stripe").is(":checked")},isBancontactChosen:function(){return a("#payment_method_stripe_bancontact").is(":checked")},isGiropayChosen:function(){return a("#payment_method_stripe_giropay").is(":checked")},isIdealChosen:function(){return a("#payment_method_stripe_ideal").is(":checked")},isSofortChosen:function(){return a("#payment_method_stripe_sofort").is(":checked")},isAlipayChosen:function(){return a("#payment_method_stripe_alipay").is(":checked")},isSepaChosen:function(){return a("#payment_method_stripe_sepa").is(":checked")},isBitcoinChosen:function(){return a("#payment_method_stripe_bitcoin").is(":checked")},isP24Chosen:function(){return a("#payment_method_stripe_p24").is(":checked")},hasSource:function(){return 0<a("input.stripe-source").length},hasToken:function(){return 0<a("input.stripe_token").length},isMobile:function(){return!!/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)},isStripeModalNeeded:function(a){var b=h.form.find("input.stripe_token");return(!h.stripe_submit||!b)&&!!h.isStripeChosen()},block:function(){h.isMobile()?a.blockUI({message:null,overlayCSS:{background:"#fff",opacity:.6}}):h.form.block({message:null,overlayCSS:{background:"#fff",opacity:.6}})},unblock:function(){h.isMobile()?a.unblockUI():h.form.unblock()},getSelectedPaymentElement:function(){return a('.payment_methods input[name="payment_method"]:checked')},openModal:function(){var c=h.form,d=a("#stripe-payment-data");h.reset();var e=function(a){if(c.find("input.stripe_source").remove(),"token"===a.object)b.createSource({type:"card",token:a.id}).then(h.sourceResponse);else if("source"===a.object){var d={source:a};h.sourceResponse(d)}};StripeCheckout.open({key:wc_stripe_params.key,billingAddress:"yes"===wc_stripe_params.stripe_checkout_require_billing_address,amount:d.data("amount"),name:d.data("name"),description:d.data("description"),currency:d.data("currency"),image:d.data("image"),bitcoin:d.data("bitcoin"),locale:d.data("locale"),email:a("#billing_email").val()||d.data("email"),panelLabel:d.data("panel-label"),allowRememberMe:d.data("allow-remember-me"),token:e,closed:h.onClose()})},resetModal:function(){h.reset(),h.stripe_checkout_submit=!1},onClose:function(){h.unblock()},onError:function(b,c){var d=c.error.message,e=h.getSelectedPaymentElement().parents("li").eq(0).find(".stripe-source-errors");"invalid_request_error"!==c.error.type&&"api_connection_error"!==c.error.type&&"api_error"!==c.error.type&&"authentication_error"!==c.error.type&&"rate_limit_error"!==c.error.type||(d=wc_stripe_params.invalid_request_error),"card_error"===c.error.type&&wc_stripe_params.hasOwnProperty(c.error.code)&&(d=wc_stripe_params[c.error.code]),"validation_error"===c.error.type&&wc_stripe_params.hasOwnProperty(c.error.code)&&(d=wc_stripe_params[c.error.code]),h.reset(),a(".woocommerce-NoticeGroup-checkout").remove(),console.log(c.error.message),a(e).html('<ul class="woocommerce_error woocommerce-error wc-stripe-error"><li>'+d+"</li></ul>"),a(".wc-stripe-error").length&&a("html, body").animate({scrollTop:a(".wc-stripe-error").offset().top-200},200),h.unblock()},getOwnerDetails:function(){var b=a("#billing_first_name").length?a("#billing_first_name").val():wc_stripe_params.billing_first_name,c=a("#billing_last_name").length?a("#billing_last_name").val():wc_stripe_params.billing_last_name,d={owner:{name:"",address:{},email:"",phone:""}};return d.owner.name=b,b&&c&&(d.owner.name=b+" "+c),d.owner.email=a("#billing_email").val(),d.owner.phone=a("#billing_phone").val(),void 0!==d.owner.phone&&0>=d.owner.phone.length&&delete d.owner.phone,void 0!==d.owner.email&&0>=d.owner.email.length&&delete d.owner.email,a("#billing_address_1").length>0?(d.owner.address.line1=a("#billing_address_1").val(),d.owner.address.line2=a("#billing_address_2").val(),d.owner.address.state=a("#billing_state").val(),d.owner.address.city=a("#billing_city").val(),d.owner.address.postal_code=a("#billing_postcode").val(),d.owner.address.country=a("#billing_country").val()):wc_stripe_params.billing_address_1&&(d.owner.address.line1=wc_stripe_params.billing_address_1,d.owner.address.line2=wc_stripe_params.billing_address_2,d.owner.address.state=wc_stripe_params.billing_state,d.owner.address.city=wc_stripe_params.billing_city,d.owner.address.postal_code=wc_stripe_params.billing_postcode,d.owner.address.country=wc_stripe_params.billing_country),d},createSource:function(){var d=h.getOwnerDetails(),e="card";if(h.isBancontactChosen()&&(e="bancontact"),h.isSepaChosen()&&(e="sepa_debit"),h.isIdealChosen()&&(e="ideal"),h.isSofortChosen()&&(e="sofort"),h.isBitcoinChosen()&&(e="bitcoin"),h.isGiropayChosen()&&(e="giropay"),h.isAlipayChosen()&&(e="alipay"),"card"===e)b.createSource(c,d).then(h.sourceResponse);else{switch(e){case"bancontact":case"giropay":case"ideal":case"sofort":case"alipay":d.amount=a("#stripe-"+e+"-payment-data").data("amount"),d.currency=a("#stripe-"+e+"-payment-data").data("currency"),d.redirect={return_url:wc_stripe_params.return_url},wc_stripe_params.statement_descriptor&&(d.statement_descriptor=wc_stripe_params.statement_descriptor)}switch(e){case"sepa_debit":var f=a("#stripe-payment-data");d.currency=a("#stripe-"+e+"-payment-data").data("currency"),d.owner.name=a("#stripe-sepa-owner").val(),d.owner.email=f.data("email"),d.sepa_debit={iban:a("#stripe-sepa-iban").val()},d.mandate={notification_method:wc_stripe_params.sepa_mandate_notification};break;case"ideal":d.ideal={bank:a("#stripe-ideal-bank").val()};break;case"bitcoin":case"alipay":d.currency=a("#stripe-"+e+"-payment-data").data("currency"),d.amount=a("#stripe-"+e+"-payment-data").data("amount");break;case"sofort":d.sofort={country:a("#billing_country").val()}}d.type=e,b.createSource(d).then(h.sourceResponse)}},sourceResponse:function(b){b.error?a(document.body).trigger("stripeError",b):"no"===wc_stripe_params.allow_prepaid_card&&"card"===b.source.type&&"prepaid"===b.source.card.funding?(b.error={message:wc_stripe_params.no_prepaid_card_msg},wc_stripe_params.is_stripe_checkout?h.submitError('<ul class="woocommerce-error"><li>'+wc_stripe_params.no_prepaid_card_msg+"</li></ul>"):a(document.body).trigger("stripeError",b)):h.processStripeResponse(b.source)},processStripeResponse:function(b){h.reset(),h.form.append("<input type='hidden' class='stripe-source' name='stripe_source' value='"+b.id+"'/>"),a("form#add_payment_method").length&&a(h.form).off("submit",h.form.onSubmit),h.form.submit()},createToken:function(){var b=a("#stripe-card-number").val(),c=a("#stripe-card-cvc").val(),d=a("#stripe-card-expiry").payment("cardExpiryVal"),e=a("#billing_first_name").length?a("#billing_first_name").val():wc_stripe_params.billing_first_name,f=a("#billing_last_name").length?a("#billing_last_name").val():wc_stripe_params.billing_last_name,g={number:b,cvc:c,exp_month:parseInt(d.month,10)||0,exp_year:parseInt(d.year,10)||0};e&&f&&(g.name=e+" "+f),a("#billing_address_1").length>0?(g.address_line1=a("#billing_address_1").val(),g.address_line2=a("#billing_address_2").val(),g.address_state=a("#billing_state").val(),g.address_city=a("#billing_city").val(),g.address_zip=a("#billing_postcode").val(),g.address_country=a("#billing_country").val()):wc_stripe_params.billing_address_1&&(g.address_line1=wc_stripe_params.billing_address_1,g.address_line2=wc_stripe_params.billing_address_2,g.address_state=wc_stripe_params.billing_state,g.address_city=wc_stripe_params.billing_city,g.address_zip=wc_stripe_params.billing_postcode,g.address_country=wc_stripe_params.billing_country),Stripe.setPublishableKey(wc_stripe_params.key),Stripe.createToken(g,h.onStripeTokenResponse)},onStripeTokenResponse:function(b,c){if(c.error)a(document).trigger("stripeError",c);else{if("no"===wc_stripe_params.allow_prepaid_card&&"prepaid"===c.card.funding)return c.error={message:wc_stripe_params.no_prepaid_card_msg},a(document).trigger("stripeError",{response:c}),!1;var d=c.id;h.form.append("<input type='hidden' class='stripe_token' name='stripe_token' value='"+d+"'/>"),a("form#add_payment_method").length&&a(h.form).off("submit",h.form.onSubmit),h.form.submit()}},onSubmit:function(b){if(h.isStripeChosen()&&!h.isStripeSaveCardChosen()&&!h.hasSource()&&!h.hasToken()){if(b.preventDefault(),"yes"===wc_stripe_params.is_stripe_checkout&&h.isStripeModalNeeded()&&h.isStripeCardChosen())return h.isMobile()?h.openModal():h.validateCheckout("modal"),!1;if(h.block(),h.isStripeCardChosen()&&"no"===wc_stripe_params.use_elements)return h.createToken(),!1;if(h.isSepaChosen()){if(""===a("#stripe-sepa-owner").val())return a(document.body).trigger("stripeError",{error:{message:wc_stripe_params.no_sepa_owner_msg}}),!1;if(""===a("#stripe-sepa-iban").val())return a(document.body).trigger("stripeError",{error:{message:wc_stripe_params.no_sepa_iban_msg}}),!1}if(h.isBancontactChosen()||h.isGiropayChosen()||h.isIdealChosen()||h.isAlipayChosen()||h.isSofortChosen()||h.isP24Chosen()){if(a("form#order_review").length&&(a("form#order_review").off("submit",this.onSubmit),h.isMobile()&&h.unblock(),h.form.submit()),a("form.woocommerce-checkout").length)return a("form.woocommerce-checkout").off("submit",this.onSubmit),h.isMobile()&&h.unblock(),!0;a("form#add_payment_method").length&&(a("form#add_payment_method").off("submit",this.onSubmit),h.isMobile()&&h.unblock(),h.form.submit())}return wc_stripe_params.is_checkout?h.validateCheckout():h.createSource(),!1}if(a("form#add_payment_method").length)return b.preventDefault(),"yes"===wc_stripe_params.is_stripe_checkout&&h.isStripeModalNeeded()&&h.isStripeCardChosen()?(h.openModal(),!1):(h.block(),h.isStripeCardChosen()&&"no"===wc_stripe_params.use_elements?(h.createToken(),!1):(h.createSource(),!1))},onCCFormChange:function(){h.reset()},reset:function(){a(".wc-stripe-error, .stripe-source, .stripe_token, .stripe-checkout-object").remove(),"yes"===wc_stripe_params.is_stripe_checkout&&(h.stripe_submit=!1)},getRequiredFields:function(){return h.form.find(".form-row.validate-required > input, .form-row.validate-required > select, .form-row.validate-required > textarea")},validateCheckout:function(b){void 0===b&&(b="");var c={nonce:wc_stripe_params.stripe_nonce,required_fields:h.getRequiredFields().serialize(),all_fields:h.form.serialize(),source_type:h.getSelectedPaymentElement().val(),is_add_payment_page:wc_stripe_params.is_add_payment_method_page};a.ajax({type:"POST",url:h.getAjaxURL("validate_checkout"),data:c,dataType:"json",success:function(c){if("success"===c)if("modal"===b)h.openModal();else{if(h.isSepaChosen()){if(""===a("#stripe-sepa-owner").val())return a(document.body).trigger("stripeError",{error:{message:wc_stripe_params.no_sepa_owner_msg}}),!1;if(""===a("#stripe-sepa-iban").val())return a(document.body).trigger("stripeError",{error:{message:wc_stripe_params.no_sepa_iban_msg}}),!1}h.createSource()}else c.messages&&(h.resetModal(),h.reset(),h.submitError(c.messages))}})},submitError:function(b){a(".woocommerce-NoticeGroup-checkout, .woocommerce-error, .woocommerce-message").remove(),h.form.prepend('<div class="woocommerce-NoticeGroup woocommerce-NoticeGroup-checkout">'+b+"</div>"),h.form.removeClass("processing").unblock(),h.form.find(".input-text, select, input:checkbox").blur();var c="";a("#add_payment_method").length&&(c=a("#add_payment_method")),a("#order_review").length&&(c=a("#order_review")),a("form.checkout").length&&(c=a("form.checkout")),c.length&&a("html, body").animate({scrollTop:c.offset().top-100},500),a(document.body).trigger("checkout_error"),h.unblock()}};h.init()});
1
+ jQuery(function(e){"use strict";var r=Stripe(wc_stripe_params.key);if("yes"===wc_stripe_params.use_elements)var t,i,o,s=wc_stripe_params.elements_options.length?wc_stripe_params.elements_options:{},a=r.elements(s);var n={getAjaxURL:function(e){return wc_stripe_params.ajaxurl.toString().replace("%%endpoint%%","wc_stripe_"+e)},init:function(){"yes"===wc_stripe_params.is_change_payment_page&&e(document.body).trigger("wc-credit-card-form-init"),this.stripe_checkout_submit=!1,e("form.woocommerce-checkout").length&&(this.form=e("form.woocommerce-checkout")),e("form.woocommerce-checkout").on("checkout_place_order_stripe checkout_place_order_stripe_bancontact checkout_place_order_stripe_sofort checkout_place_order_stripe_giropay checkout_place_order_stripe_ideal checkout_place_order_stripe_alipay checkout_place_order_stripe_sepa checkout_place_order_stripe_bitcoin",this.onSubmit),e("form#order_review").length&&(this.form=e("form#order_review")),e("form#order_review").on("submit",this.onSubmit),e("form#add_payment_method").length&&(this.form=e("form#add_payment_method")),e("form#add_payment_method").on("submit",this.onSubmit),e("form.woocommerce-checkout").on("change","#stripe-bank-country",this.reset),e(document).on("stripeError",this.onError).on("checkout_error",this.reset);var r={base:{iconColor:"#666EE8",color:"#31325F",fontSize:"15px","::placeholder":{color:"#CFD7E0"}}},s={focus:"focused",empty:"empty",invalid:"invalid"};"yes"===wc_stripe_params.use_elements&&e("#stripe-card-element").length&&(r=wc_stripe_params.elements_styling?wc_stripe_params.elements_styling:r,s=wc_stripe_params.elements_classes?wc_stripe_params.elements_classes:s,"yes"===wc_stripe_params.inline_cc_form?(t=a.create("card",{style:r,hidePostalCode:!0})).addEventListener("change",function(r){n.onCCFormChange(),r.error&&e(document.body).trigger("stripeError",r)}):(t=a.create("cardNumber",{style:r,classes:s}),i=a.create("cardExpiry",{style:r,classes:s}),o=a.create("cardCvc",{style:r,classes:s}),t.addEventListener("change",function(r){n.onCCFormChange(),r.error&&e(document.body).trigger("stripeError",r)}),i.addEventListener("change",function(r){n.onCCFormChange(),r.error&&e(document.body).trigger("stripeError",r)}),o.addEventListener("change",function(r){n.onCCFormChange(),r.error&&e(document.body).trigger("stripeError",r)})),wc_stripe_params.is_checkout?e(document.body).on("updated_checkout",function(){t&&("yes"===wc_stripe_params.inline_cc_form?t.unmount("#stripe-card-element"):(t.unmount("#stripe-card-element"),i.unmount("#stripe-exp-element"),o.unmount("#stripe-cvc-element"))),"yes"===wc_stripe_params.inline_cc_form?t.mount("#stripe-card-element"):(t.mount("#stripe-card-element"),i.mount("#stripe-exp-element"),o.mount("#stripe-cvc-element"))}):(e("form#add_payment_method").length||e("form#order_review").length)&&("yes"===wc_stripe_params.inline_cc_form?t.mount("#stripe-card-element"):(t.mount("#stripe-card-element"),i.mount("#stripe-exp-element"),o.mount("#stripe-cvc-element"))))},isStripeChosen:function(){return e("#payment_method_stripe, #payment_method_stripe_bancontact, #payment_method_stripe_sofort, #payment_method_stripe_giropay, #payment_method_stripe_ideal, #payment_method_stripe_alipay, #payment_method_stripe_sepa, #payment_method_stripe_bitcoin").is(":checked")||e("#payment_method_stripe").is(":checked")&&"new"===e('input[name="wc-stripe-payment-token"]:checked').val()||e("#payment_method_stripe_sepa").is(":checked")&&"new"===e('input[name="wc-stripe-payment-token"]:checked').val()},isStripeSaveCardChosen:function(){return e("#payment_method_stripe").is(":checked")&&e('input[name="wc-stripe-payment-token"]').is(":checked")&&"new"!==e('input[name="wc-stripe-payment-token"]:checked').val()||e("#payment_method_stripe_sepa").is(":checked")&&e('input[name="wc-stripe_sepa-payment-token"]').is(":checked")&&"new"!==e('input[name="wc-stripe_sepa-payment-token"]:checked').val()},isStripeCardChosen:function(){return e("#payment_method_stripe").is(":checked")},isBancontactChosen:function(){return e("#payment_method_stripe_bancontact").is(":checked")},isGiropayChosen:function(){return e("#payment_method_stripe_giropay").is(":checked")},isIdealChosen:function(){return e("#payment_method_stripe_ideal").is(":checked")},isSofortChosen:function(){return e("#payment_method_stripe_sofort").is(":checked")},isAlipayChosen:function(){return e("#payment_method_stripe_alipay").is(":checked")},isSepaChosen:function(){return e("#payment_method_stripe_sepa").is(":checked")},isBitcoinChosen:function(){return e("#payment_method_stripe_bitcoin").is(":checked")},isP24Chosen:function(){return e("#payment_method_stripe_p24").is(":checked")},hasSource:function(){return 0<e("input.stripe-source").length},hasToken:function(){return 0<e("input.stripe_token").length},isMobile:function(){return!!/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)},isStripeModalNeeded:function(e){var r=n.form.find("input.stripe_token");return(!n.stripe_submit||!r)&&!!n.isStripeChosen()},block:function(){n.isMobile()?e.blockUI({message:null,overlayCSS:{background:"#fff",opacity:.6}}):n.form.block({message:null,overlayCSS:{background:"#fff",opacity:.6}})},unblock:function(){n.isMobile()?e.unblockUI():n.form.unblock()},getSelectedPaymentElement:function(){return e('.payment_methods input[name="payment_method"]:checked')},openModal:function(){var t=n.form,i=e("#stripe-payment-data");n.reset();StripeCheckout.open({key:wc_stripe_params.key,billingAddress:"yes"===wc_stripe_params.stripe_checkout_require_billing_address,amount:i.data("amount"),name:i.data("name"),description:i.data("description"),currency:i.data("currency"),image:i.data("image"),bitcoin:i.data("bitcoin"),locale:i.data("locale"),email:e("#billing_email").val()||i.data("email"),panelLabel:i.data("panel-label"),allowRememberMe:i.data("allow-remember-me"),token:function(e){if(t.find("input.stripe_source").remove(),"token"===e.object)r.createSource({type:"card",token:e.id}).then(n.sourceResponse);else if("source"===e.object){var i={source:e};n.sourceResponse(i)}},closed:n.onClose()})},resetModal:function(){n.reset(),n.stripe_checkout_submit=!1},onClose:function(){n.unblock()},onError:function(r,t){var i=t.error.message,o=n.getSelectedPaymentElement().parents("li").eq(0).find(".stripe-source-errors");"invalid_request_error"!==t.error.type&&"api_connection_error"!==t.error.type&&"api_error"!==t.error.type&&"authentication_error"!==t.error.type&&"rate_limit_error"!==t.error.type||(i=wc_stripe_params.invalid_request_error),"card_error"===t.error.type&&wc_stripe_params.hasOwnProperty(t.error.code)&&(i=wc_stripe_params[t.error.code]),"validation_error"===t.error.type&&wc_stripe_params.hasOwnProperty(t.error.code)&&(i=wc_stripe_params[t.error.code]),n.reset(),e(".woocommerce-NoticeGroup-checkout").remove(),console.log(t.error.message),e(o).html('<ul class="woocommerce_error woocommerce-error wc-stripe-error"><li>'+i+"</li></ul>"),e(".wc-stripe-error").length&&e("html, body").animate({scrollTop:e(".wc-stripe-error").offset().top-200},200),n.unblock()},getOwnerDetails:function(){var r=e("#billing_first_name").length?e("#billing_first_name").val():wc_stripe_params.billing_first_name,t=e("#billing_last_name").length?e("#billing_last_name").val():wc_stripe_params.billing_last_name,i={owner:{name:"",address:{},email:"",phone:""}};return i.owner.name=r,r&&t&&(i.owner.name=r+" "+t),i.owner.email=e("#billing_email").val(),i.owner.phone=e("#billing_phone").val(),void 0!==i.owner.phone&&0>=i.owner.phone.length&&delete i.owner.phone,void 0!==i.owner.email&&0>=i.owner.email.length&&delete i.owner.email,void 0!==i.owner.name&&0>=i.owner.name.length&&delete i.owner.name,e("#billing_address_1").length>0?(i.owner.address.line1=e("#billing_address_1").val(),i.owner.address.line2=e("#billing_address_2").val(),i.owner.address.state=e("#billing_state").val(),i.owner.address.city=e("#billing_city").val(),i.owner.address.postal_code=e("#billing_postcode").val(),i.owner.address.country=e("#billing_country").val()):wc_stripe_params.billing_address_1&&(i.owner.address.line1=wc_stripe_params.billing_address_1,i.owner.address.line2=wc_stripe_params.billing_address_2,i.owner.address.state=wc_stripe_params.billing_state,i.owner.address.city=wc_stripe_params.billing_city,i.owner.address.postal_code=wc_stripe_params.billing_postcode,i.owner.address.country=wc_stripe_params.billing_country),i},createSource:function(){var i=n.getOwnerDetails(),o="card";if(n.isBancontactChosen()&&(o="bancontact"),n.isSepaChosen()&&(o="sepa_debit"),n.isIdealChosen()&&(o="ideal"),n.isSofortChosen()&&(o="sofort"),n.isBitcoinChosen()&&(o="bitcoin"),n.isGiropayChosen()&&(o="giropay"),n.isAlipayChosen()&&(o="alipay"),"card"===o)r.createSource(t,i).then(n.sourceResponse);else{switch(o){case"bancontact":case"giropay":case"ideal":case"sofort":case"alipay":i.amount=e("#stripe-"+o+"-payment-data").data("amount"),i.currency=e("#stripe-"+o+"-payment-data").data("currency"),i.redirect={return_url:wc_stripe_params.return_url},wc_stripe_params.statement_descriptor&&(i.statement_descriptor=wc_stripe_params.statement_descriptor)}switch(o){case"sepa_debit":var s=e("#stripe-payment-data"),a=e("#billing_email").length?e("#billing_email").val():s.data("email");i.currency=e("#stripe-"+o+"-payment-data").data("currency"),i.owner.name=e("#stripe-sepa-owner").val(),i.owner.email=a,i.sepa_debit={iban:e("#stripe-sepa-iban").val()},i.mandate={notification_method:wc_stripe_params.sepa_mandate_notification};break;case"ideal":i.ideal={bank:e("#stripe-ideal-bank").val()};break;case"bitcoin":case"alipay":i.currency=e("#stripe-"+o+"-payment-data").data("currency"),i.amount=e("#stripe-"+o+"-payment-data").data("amount");break;case"sofort":i.sofort={country:e("#billing_country").val()}}i.type=o,r.createSource(i).then(n.sourceResponse)}},sourceResponse:function(r){r.error?e(document.body).trigger("stripeError",r):"no"===wc_stripe_params.allow_prepaid_card&&"card"===r.source.type&&"prepaid"===r.source.card.funding?(r.error={message:wc_stripe_params.no_prepaid_card_msg},wc_stripe_params.is_stripe_checkout?n.submitError('<ul class="woocommerce-error"><li>'+wc_stripe_params.no_prepaid_card_msg+"</li></ul>"):e(document.body).trigger("stripeError",r)):n.processStripeResponse(r.source)},processStripeResponse:function(r){n.reset(),n.form.append("<input type='hidden' class='stripe-source' name='stripe_source' value='"+r.id+"'/>"),e("form#add_payment_method").length&&e(n.form).off("submit",n.form.onSubmit),n.form.submit()},createToken:function(){var r=e("#stripe-card-number").val(),t=e("#stripe-card-cvc").val(),i=e("#stripe-card-expiry").payment("cardExpiryVal"),o=e("#billing_first_name").length?e("#billing_first_name").val():wc_stripe_params.billing_first_name,s=e("#billing_last_name").length?e("#billing_last_name").val():wc_stripe_params.billing_last_name,a={number:r,cvc:t,exp_month:parseInt(i.month,10)||0,exp_year:parseInt(i.year,10)||0};o&&s&&(a.name=o+" "+s),e("#billing_address_1").length>0?(a.address_line1=e("#billing_address_1").val(),a.address_line2=e("#billing_address_2").val(),a.address_state=e("#billing_state").val(),a.address_city=e("#billing_city").val(),a.address_zip=e("#billing_postcode").val(),a.address_country=e("#billing_country").val()):wc_stripe_params.billing_address_1&&(a.address_line1=wc_stripe_params.billing_address_1,a.address_line2=wc_stripe_params.billing_address_2,a.address_state=wc_stripe_params.billing_state,a.address_city=wc_stripe_params.billing_city,a.address_zip=wc_stripe_params.billing_postcode,a.address_country=wc_stripe_params.billing_country),Stripe.setPublishableKey(wc_stripe_params.key),Stripe.createToken(a,n.onStripeTokenResponse)},onStripeTokenResponse:function(r,t){if(t.error)e(document).trigger("stripeError",t);else{if("no"===wc_stripe_params.allow_prepaid_card&&"prepaid"===t.card.funding)return t.error={message:wc_stripe_params.no_prepaid_card_msg},e(document).trigger("stripeError",{response:t}),!1;var i=t.id;n.form.append("<input type='hidden' class='stripe_token' name='stripe_token' value='"+i+"'/>"),e("form#add_payment_method").length&&e(n.form).off("submit",n.form.onSubmit),n.form.submit()}},onSubmit:function(r){if(n.isStripeChosen()&&!n.isStripeSaveCardChosen()&&!n.hasSource()&&!n.hasToken()){if(r.preventDefault(),"yes"===wc_stripe_params.is_stripe_checkout&&n.isStripeModalNeeded()&&n.isStripeCardChosen())return n.isMobile()?n.openModal():n.validateCheckout("modal"),!1;if(n.block(),n.isStripeCardChosen()&&"no"===wc_stripe_params.use_elements)return n.createToken(),!1;if(n.isSepaChosen()){if(""===e("#stripe-sepa-owner").val())return e(document.body).trigger("stripeError",{error:{message:wc_stripe_params.no_sepa_owner_msg}}),!1;if(""===e("#stripe-sepa-iban").val())return e(document.body).trigger("stripeError",{error:{message:wc_stripe_params.no_sepa_iban_msg}}),!1}if(n.isBancontactChosen()||n.isGiropayChosen()||n.isIdealChosen()||n.isAlipayChosen()||n.isSofortChosen()||n.isP24Chosen()){if(e("form#order_review").length&&(e("form#order_review").off("submit",this.onSubmit),n.isMobile()&&n.unblock(),n.form.submit()),e("form.woocommerce-checkout").length)return e("form.woocommerce-checkout").off("submit",this.onSubmit),n.isMobile()&&n.unblock(),!0;e("form#add_payment_method").length&&(e("form#add_payment_method").off("submit",this.onSubmit),n.isMobile()&&n.unblock(),n.form.submit())}return wc_stripe_params.is_checkout?n.validateCheckout():n.createSource(),!1}if(e("form#add_payment_method").length)return r.preventDefault(),"yes"===wc_stripe_params.is_stripe_checkout&&n.isStripeModalNeeded()&&n.isStripeCardChosen()?(n.openModal(),!1):(n.block(),n.isStripeCardChosen()&&"no"===wc_stripe_params.use_elements?(n.createToken(),!1):(n.createSource(),!1))},onCCFormChange:function(){n.reset()},reset:function(){e(".wc-stripe-error, .stripe-source, .stripe_token, .stripe-checkout-object").remove(),"yes"===wc_stripe_params.is_stripe_checkout&&(n.stripe_submit=!1)},getRequiredFields:function(){return n.form.find(".form-row.validate-required > input, .form-row.validate-required > select, .form-row.validate-required > textarea")},validateCheckout:function(r){void 0===r&&(r="");var t={nonce:wc_stripe_params.stripe_nonce,required_fields:n.getRequiredFields().serialize(),all_fields:n.form.serialize(),source_type:n.getSelectedPaymentElement().val(),is_add_payment_page:wc_stripe_params.is_add_payment_method_page};e.ajax({type:"POST",url:n.getAjaxURL("validate_checkout"),data:t,dataType:"json",success:function(t){if("success"===t)if("modal"===r)n.openModal();else{if(n.isSepaChosen()){if(""===e("#stripe-sepa-owner").val())return e(document.body).trigger("stripeError",{error:{message:wc_stripe_params.no_sepa_owner_msg}}),!1;if(""===e("#stripe-sepa-iban").val())return e(document.body).trigger("stripeError",{error:{message:wc_stripe_params.no_sepa_iban_msg}}),!1}n.createSource()}else t.messages&&(n.resetModal(),n.reset(),n.submitError(t.messages))}})},submitError:function(r){e(".woocommerce-NoticeGroup-checkout, .woocommerce-error, .woocommerce-message").remove(),n.form.prepend('<div class="woocommerce-NoticeGroup woocommerce-NoticeGroup-checkout">'+r+"</div>"),n.form.removeClass("processing").unblock(),n.form.find(".input-text, select, input:checkbox").blur();var t="";e("#add_payment_method").length&&(t=e("#add_payment_method")),e("#order_review").length&&(t=e("#order_review")),e("form.checkout").length&&(t=e("form.checkout")),t.length&&e("html, body").animate({scrollTop:t.offset().top-100},500),e(document.body).trigger("checkout_error"),n.unblock()}};n.init()});
changelog.txt CHANGED
@@ -1,5 +1,16 @@
1
  *** Changelog ***
2
 
 
 
 
 
 
 
 
 
 
 
 
3
  = 4.0.4 - 2018-01-30 =
4
  * Add - SEPA mandate notification email.
5
  * Add - Preferred language to SOFORT and Bancontact so it can be localized.
1
  *** Changelog ***
2
 
3
+ = 4.0.5 - 2018-02-02 =
4
+ * Fix - Illegal offset error on settings when non is defined or saved.
5
+ * Fix - Wrong ID used for dispute webhook handler.
6
+ * Fix - A WC 2.6 backwards compat issue while trying to get order id in subscriptions.
7
+ * Fix - Processing SEPA can't find email when not logged in.
8
+ * Add - Allow restricted secret keys to be used.
9
+ * Add - Statement Descriptor to SEPA Direct Debit.
10
+ * Add - Idempotency failure retry with easing to prevent multirequest issue.
11
+ * Add - POT file.
12
+ * Tweak - Make billing name optional on pay for order page.
13
+
14
  = 4.0.4 - 2018-01-30 =
15
  * Add - SEPA mandate notification email.
16
  * Add - Preferred language to SOFORT and Bancontact so it can be localized.
includes/abstracts/abstract-wc-stripe-payment-gateway.php CHANGED
@@ -14,6 +14,21 @@ abstract class WC_Stripe_Payment_Gateway extends WC_Payment_Gateway_CC {
14
  const META_NAME_FEE = 'Stripe Fee';
15
  const META_NAME_NET = 'Net Revenue From Stripe';
16
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
17
  /**
18
  * Check if this gateway is enabled
19
  */
@@ -199,6 +214,11 @@ abstract class WC_Stripe_Payment_Gateway extends WC_Payment_Gateway_CC {
199
 
200
  $post_data['capture'] = $capture ? 'true' : 'false';
201
  break;
 
 
 
 
 
202
  }
203
 
204
  $post_data['expand[]'] = 'balance_transaction';
@@ -264,7 +284,7 @@ abstract class WC_Stripe_Payment_Gateway extends WC_Payment_Gateway_CC {
264
  WC_Stripe_Helper::is_pre_30() ? $order->reduce_order_stock() : wc_reduce_stock_levels( $order_id );
265
  }
266
 
267
- WC_Stripe_Helper::is_pre_30() ? update_post_meta( $order_id, '_transaction_id', $response->id, true ) : $order->set_transaction_id( $response->id );
268
  /* translators: transaction id */
269
  $order->update_status( 'on-hold', sprintf( __( 'Stripe charge awaiting payment: %s.', 'woocommerce-gateway-stripe' ), $response->id ) );
270
  }
@@ -283,7 +303,7 @@ abstract class WC_Stripe_Payment_Gateway extends WC_Payment_Gateway_CC {
283
  throw new WC_Stripe_Exception( print_r( $response, true ), $localized_message );
284
  }
285
  } else {
286
- WC_Stripe_Helper::is_pre_30() ? update_post_meta( $order_id, '_transaction_id', $response->id, true ) : $order->set_transaction_id( $response->id );
287
 
288
  if ( $order->has_status( array( 'pending', 'failed' ) ) ) {
289
  WC_Stripe_Helper::is_pre_30() ? $order->reduce_order_stock() : wc_reduce_stock_levels( $order_id );
@@ -357,7 +377,7 @@ abstract class WC_Stripe_Payment_Gateway extends WC_Payment_Gateway_CC {
357
  */
358
  public function get_source_object() {
359
  $source = ! empty( $_POST['stripe_source'] ) ? wc_clean( $_POST['stripe_source'] ) : '';
360
-
361
  if ( empty( $source ) ) {
362
  return '';
363
  }
@@ -648,27 +668,36 @@ abstract class WC_Stripe_Payment_Gateway extends WC_Payment_Gateway_CC {
648
  return false;
649
  }
650
 
651
- $body = array();
652
 
653
  if ( WC_Stripe_Helper::is_pre_30() ) {
654
  $order_currency = get_post_meta( $order_id, '_order_currency', true );
 
655
  } else {
656
  $order_currency = $order->get_currency();
 
657
  }
658
 
659
  if ( ! is_null( $amount ) ) {
660
- $body['amount'] = WC_Stripe_Helper::get_stripe_amount( $amount, $order_currency );
 
 
 
 
 
661
  }
662
 
663
  if ( $reason ) {
664
- $body['metadata'] = array(
665
  'reason' => $reason,
666
  );
667
  }
668
 
 
 
669
  WC_Stripe_Logger::log( "Info: Beginning refund for order {$order->get_transaction_id()} for the amount of {$amount}" );
670
 
671
- $response = WC_Stripe_API::request( $body, 'charges/' . $order->get_transaction_id() . '/refunds' );
672
 
673
  if ( ! empty( $response->error ) ) {
674
  WC_Stripe_Logger::log( 'Error: ' . $response->error->message );
@@ -689,7 +718,8 @@ abstract class WC_Stripe_Payment_Gateway extends WC_Payment_Gateway_CC {
689
  }
690
 
691
  /* translators: 1) dollar amount 2) transaction id 3) refund message */
692
- $refund_message = sprintf( __( 'Refunded %1$s - Refund ID: %2$s - Reason: %3$s', 'woocommerce-gateway-stripe' ), $amount, $response->id, $reason );
 
693
  $order->add_order_note( $refund_message );
694
  WC_Stripe_Logger::log( 'Success: ' . html_entity_decode( strip_tags( $refund_message ) ) );
695
 
14
  const META_NAME_FEE = 'Stripe Fee';
15
  const META_NAME_NET = 'Net Revenue From Stripe';
16
 
17
+ /**
18
+ * Checks to see if request is invalid and that
19
+ * they are worth retrying.
20
+ *
21
+ * @since 4.0.5
22
+ * @param array $error
23
+ */
24
+ public function is_retryable_error( $error ) {
25
+ return (
26
+ 'invalid_request_error' === $error->type ||
27
+ 'idempotency_error' === $error->type ||
28
+ 'rate_limit_error' === $error->type
29
+ );
30
+ }
31
+
32
  /**
33
  * Check if this gateway is enabled
34
  */
214
 
215
  $post_data['capture'] = $capture ? 'true' : 'false';
216
  break;
217
+ case 'stripe_sepa':
218
+ if ( ! empty( $statement_descriptor ) ) {
219
+ $post_data['statement_descriptor'] = WC_Stripe_Helper::clean_statement_descriptor( $statement_descriptor );
220
+ }
221
+ break;
222
  }
223
 
224
  $post_data['expand[]'] = 'balance_transaction';
284
  WC_Stripe_Helper::is_pre_30() ? $order->reduce_order_stock() : wc_reduce_stock_levels( $order_id );
285
  }
286
 
287
+ WC_Stripe_Helper::is_pre_30() ? update_post_meta( $order_id, '_transaction_id', $response->id ) : $order->set_transaction_id( $response->id );
288
  /* translators: transaction id */
289
  $order->update_status( 'on-hold', sprintf( __( 'Stripe charge awaiting payment: %s.', 'woocommerce-gateway-stripe' ), $response->id ) );
290
  }
303
  throw new WC_Stripe_Exception( print_r( $response, true ), $localized_message );
304
  }
305
  } else {
306
+ WC_Stripe_Helper::is_pre_30() ? update_post_meta( $order_id, '_transaction_id', $response->id ) : $order->set_transaction_id( $response->id );
307
 
308
  if ( $order->has_status( array( 'pending', 'failed' ) ) ) {
309
  WC_Stripe_Helper::is_pre_30() ? $order->reduce_order_stock() : wc_reduce_stock_levels( $order_id );
377
  */
378
  public function get_source_object() {
379
  $source = ! empty( $_POST['stripe_source'] ) ? wc_clean( $_POST['stripe_source'] ) : '';
380
+
381
  if ( empty( $source ) ) {
382
  return '';
383
  }
668
  return false;
669
  }
670
 
671
+ $request = array();
672
 
673
  if ( WC_Stripe_Helper::is_pre_30() ) {
674
  $order_currency = get_post_meta( $order_id, '_order_currency', true );
675
+ $captured = get_post_meta( $order_id, '_stripe_charge_captured', true );
676
  } else {
677
  $order_currency = $order->get_currency();
678
+ $captured = $order->get_meta( '_stripe_charge_captured', true );
679
  }
680
 
681
  if ( ! is_null( $amount ) ) {
682
+ $request['amount'] = WC_Stripe_Helper::get_stripe_amount( $amount, $order_currency );
683
+ }
684
+
685
+ // If order is only authorized, don't pass amount.
686
+ if ( 'yes' !== $captured ) {
687
+ unset( $request['amount'] );
688
  }
689
 
690
  if ( $reason ) {
691
+ $request['metadata'] = array(
692
  'reason' => $reason,
693
  );
694
  }
695
 
696
+ $request['charge'] = $order->get_transaction_id();
697
+
698
  WC_Stripe_Logger::log( "Info: Beginning refund for order {$order->get_transaction_id()} for the amount of {$amount}" );
699
 
700
+ $response = WC_Stripe_API::request( $request, 'refunds' );
701
 
702
  if ( ! empty( $response->error ) ) {
703
  WC_Stripe_Logger::log( 'Error: ' . $response->error->message );
718
  }
719
 
720
  /* translators: 1) dollar amount 2) transaction id 3) refund message */
721
+ $refund_message = ( isset( $captured ) && 'yes' === $captured ) ? sprintf( __( 'Refunded %1$s - Refund ID: %2$s - Reason: %3$s', 'woocommerce-gateway-stripe' ), $amount, $response->id, $reason ) : __( 'Pre-Authorization Released', 'woocommerce-gateway-stripe' );
722
+
723
  $order->add_order_note( $refund_message );
724
  WC_Stripe_Logger::log( 'Success: ' . html_entity_decode( strip_tags( $refund_message ) ) );
725
 
includes/admin/stripe-settings.php CHANGED
@@ -80,7 +80,7 @@ return apply_filters( 'wc_stripe_settings',
80
  'statement_descriptor' => array(
81
  'title' => __( 'Statement Descriptor', 'woocommerce-gateway-stripe' ),
82
  'type' => 'text',
83
- 'description' => __( 'This may be up to 22 characters. The statement description must contain at least one letter, may not include ><"\' characters, and will appear on your customer\'s statement in capital letters.' ),
84
  'default' => '',
85
  'desc_tip' => true,
86
  ),
80
  'statement_descriptor' => array(
81
  'title' => __( 'Statement Descriptor', 'woocommerce-gateway-stripe' ),
82
  'type' => 'text',
83
+ 'description' => __( 'This may be up to 22 characters. The statement description must contain at least one letter, may not include ><"\' characters, and will appear on your customer\'s statement in capital letters.', 'woocommerce-gateway-stripe' ),
84
  'default' => '',
85
  'desc_tip' => true,
86
  ),
includes/class-wc-gateway-stripe.php CHANGED
@@ -9,6 +9,8 @@ if ( ! defined( 'ABSPATH' ) ) {
9
  * @extends WC_Payment_Gateway
10
  */
11
  class WC_Gateway_Stripe extends WC_Stripe_Payment_Gateway {
 
 
12
  /**
13
  * Should we capture Credit cards
14
  *
@@ -111,6 +113,7 @@ class WC_Gateway_Stripe extends WC_Stripe_Payment_Gateway {
111
  * Constructor
112
  */
113
  public function __construct() {
 
114
  $this->id = 'stripe';
115
  $this->method_title = __( 'Stripe', 'woocommerce-gateway-stripe' );
116
  /* translators: 1) link to Stripe register page 2) link to Stripe api keys page */
@@ -687,6 +690,26 @@ class WC_Gateway_Stripe extends WC_Stripe_Payment_Gateway {
687
  }
688
  }
689
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
690
  // Customer param wrong? The user may have been deleted on stripe's end. Remove customer_id. Can be retried without.
691
  if ( preg_match( '/No such customer/i', $response->error->message ) && $retry ) {
692
  if ( WC_Stripe_Helper::is_pre_30() ) {
9
  * @extends WC_Payment_Gateway
10
  */
11
  class WC_Gateway_Stripe extends WC_Stripe_Payment_Gateway {
12
+ public $retry_interval;
13
+
14
  /**
15
  * Should we capture Credit cards
16
  *
113
  * Constructor
114
  */
115
  public function __construct() {
116
+ $this->retry_interval = 2;
117
  $this->id = 'stripe';
118
  $this->method_title = __( 'Stripe', 'woocommerce-gateway-stripe' );
119
  /* translators: 1) link to Stripe register page 2) link to Stripe api keys page */
690
  }
691
  }
692
 
693
+ // We want to retry.
694
+ if ( $this->is_retryable_error( $response->error ) ) {
695
+ if ( $retry ) {
696
+ // Don't do anymore retries after this.
697
+ if ( 5 <= $this->retry_interval ) {
698
+
699
+ return $this->process_payment( $order_id, false, $force_save_source );
700
+ }
701
+
702
+ sleep( $this->retry_interval );
703
+
704
+ $this->retry_interval++;
705
+ return $this->process_payment( $order_id, true, $force_save_source );
706
+ } else {
707
+ $localized_message = __( 'On going requests error and retries exhausted.', 'woocommerce-gateway-stripe' );
708
+ $order->add_order_note( $localized_message );
709
+ throw new WC_Stripe_Exception( print_r( $response, true ), $localized_message );
710
+ }
711
+ }
712
+
713
  // Customer param wrong? The user may have been deleted on stripe's end. Remove customer_id. Can be retried without.
714
  if ( preg_match( '/No such customer/i', $response->error->message ) && $retry ) {
715
  if ( WC_Stripe_Helper::is_pre_30() ) {
includes/class-wc-stripe-api.php CHANGED
@@ -101,7 +101,10 @@ class WC_Stripe_API {
101
  $headers = self::get_headers();
102
 
103
  if ( 'charges' === $api && 'POST' === $method ) {
104
- $headers['Idempotency-Key'] = uniqid( 'stripe_' );
 
 
 
105
  }
106
 
107
  $response = wp_safe_remote_post(
101
  $headers = self::get_headers();
102
 
103
  if ( 'charges' === $api && 'POST' === $method ) {
104
+ $customer = ! empty( $request['customer'] ) ? $request['customer'] : '';
105
+ $source = ! empty( $request['source'] ) ? $request['source'] : $customer;
106
+
107
+ $headers['Idempotency-Key'] = $request['metadata']['order_id'] . '-' . $source;
108
  }
109
 
110
  $response = wp_safe_remote_post(
includes/class-wc-stripe-customer.php CHANGED
@@ -86,39 +86,6 @@ class WC_Stripe_Customer {
86
  $this->customer_data = $data;
87
  }
88
 
89
- /**
90
- * Get data from the Stripe API about this customer
91
- */
92
- public function get_customer_data() {
93
- $this->customer_data = get_transient( 'stripe_customer_' . $this->get_id() );
94
-
95
- if ( empty( $this->customer_data ) && $this->get_id() && false === $this->customer_data ) {
96
- $response = WC_Stripe_API::request( array(), 'customers/' . $this->get_id() );
97
-
98
- if ( empty( $response->error ) ) {
99
- $this->set_customer_data( $response );
100
- set_transient( 'stripe_customer_' . $this->get_id(), $response, HOUR_IN_SECONDS * 48 );
101
- }
102
- }
103
-
104
- return $this->customer_data;
105
- }
106
-
107
- /**
108
- * Get default card/source
109
- * @return string
110
- */
111
- public function get_default_source() {
112
- $data = $this->get_customer_data();
113
- $source = '';
114
-
115
- if ( $data ) {
116
- $source = $data->default_source;
117
- }
118
-
119
- return $source;
120
- }
121
-
122
  /**
123
  * Create a customer via API.
124
  * @param array $args
@@ -244,7 +211,7 @@ class WC_Stripe_Customer {
244
  }
245
 
246
  /**
247
- * Get a customers saved sources using their Stripe ID. Cached.
248
  *
249
  * @param string $customer_id
250
  * @return array
86
  $this->customer_data = $data;
87
  }
88
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
89
  /**
90
  * Create a customer via API.
91
  * @param array $args
211
  }
212
 
213
  /**
214
+ * Get a customers saved sources using their Stripe ID.
215
  *
216
  * @param string $customer_id
217
  * @return array
includes/class-wc-stripe-order-handler.php CHANGED
@@ -10,6 +10,7 @@ if ( ! defined( 'ABSPATH' ) ) {
10
  */
11
  class WC_Stripe_Order_Handler extends WC_Stripe_Payment_Gateway {
12
  private static $_this;
 
13
 
14
  /**
15
  * Constructor.
@@ -20,6 +21,8 @@ class WC_Stripe_Order_Handler extends WC_Stripe_Payment_Gateway {
20
  public function __construct() {
21
  self::$_this = $this;
22
 
 
 
23
  add_action( 'wp', array( $this, 'maybe_process_redirect_order' ) );
24
  add_action( 'woocommerce_order_status_on-hold_to_processing', array( $this, 'capture_payment' ) );
25
  add_action( 'woocommerce_order_status_on-hold_to_completed', array( $this, 'capture_payment' ) );
@@ -116,9 +119,28 @@ class WC_Stripe_Order_Handler extends WC_Stripe_Payment_Gateway {
116
  sleep( 5 );
117
  return $this->process_redirect_payment( $order_id, false );
118
  } else {
119
- $message = 'API connection error and retries exhausted.';
120
- $order->add_order_note( $message );
121
- throw new WC_Stripe_Exception( print_r( $response, true ), $message );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
122
  }
123
  }
124
 
@@ -262,29 +284,10 @@ class WC_Stripe_Order_Handler extends WC_Stripe_Payment_Gateway {
262
  $order = wc_get_order( $order_id );
263
 
264
  if ( 'stripe' === ( WC_Stripe_Helper::is_pre_30() ? $order->payment_method : $order->get_payment_method() ) ) {
265
- $charge_id = WC_Stripe_Helper::is_pre_30() ? get_post_meta( $order_id, '_transaction_id', true ) : $order->get_transaction_id();
266
-
267
- if ( $charge_id ) {
268
- $result = WC_Stripe_API::request( array(
269
- 'amount' => WC_Stripe_Helper::get_stripe_amount( $order->get_total() ),
270
- ), 'charges/' . $charge_id . '/refund' );
271
 
272
- if ( ! empty( $result->error ) ) {
273
- $order->add_order_note( __( 'Unable to refund charge!', 'woocommerce-gateway-stripe' ) . ' ' . $result->error->message );
274
- } else {
275
- /* translators: transaction id */
276
- $order->add_order_note( sprintf( __( 'Stripe charge refunded (Charge ID: %s)', 'woocommerce-gateway-stripe' ), $result->id ) );
277
- WC_Stripe_Helper::is_pre_30() ? delete_post_meta( $order_id, '_stripe_charge_captured' ) : $order->delete_meta_data( '_stripe_charge_captured' );
278
- WC_Stripe_Helper::is_pre_30() ? delete_post_meta( $order_id, '_transaction_id' ) : $order->delete_meta_data( '_stripe_transaction_id' );
279
-
280
- if ( is_callable( array( $order, 'save' ) ) ) {
281
- $order->save();
282
- }
283
- }
284
-
285
- // This hook fires when admin manually changes order status to cancel.
286
- do_action( 'woocommerce_stripe_process_manual_cancel', $order, $result );
287
- }
288
  }
289
  }
290
 
10
  */
11
  class WC_Stripe_Order_Handler extends WC_Stripe_Payment_Gateway {
12
  private static $_this;
13
+ public $retry_interval;
14
 
15
  /**
16
  * Constructor.
21
  public function __construct() {
22
  self::$_this = $this;
23
 
24
+ $this->retry_interval = 2;
25
+
26
  add_action( 'wp', array( $this, 'maybe_process_redirect_order' ) );
27
  add_action( 'woocommerce_order_status_on-hold_to_processing', array( $this, 'capture_payment' ) );
28
  add_action( 'woocommerce_order_status_on-hold_to_completed', array( $this, 'capture_payment' ) );
119
  sleep( 5 );
120
  return $this->process_redirect_payment( $order_id, false );
121
  } else {
122
+ $localized_message = __( 'API connection error and retries exhausted.', 'woocommerce-gateway-stripe' );
123
+ $order->add_order_note( $localized_message );
124
+ throw new WC_Stripe_Exception( print_r( $response, true ), $localized_message );
125
+ }
126
+ }
127
+
128
+ // We want to retry.
129
+ if ( $this->is_retryable_error( $response->error ) ) {
130
+ if ( $retry ) {
131
+ // Don't do anymore retries after this.
132
+ if ( 5 <= $this->retry_interval ) {
133
+ return $this->process_redirect_payment( $order_id, false );
134
+ }
135
+
136
+ sleep( $this->retry_interval );
137
+
138
+ $this->retry_interval++;
139
+ return $this->process_redirect_payment( $order_id, true );
140
+ } else {
141
+ $localized_message = __( 'On going requests error and retries exhausted.', 'woocommerce-gateway-stripe' );
142
+ $order->add_order_note( $localized_message );
143
+ throw new WC_Stripe_Exception( print_r( $response, true ), $localized_message );
144
  }
145
  }
146
 
284
  $order = wc_get_order( $order_id );
285
 
286
  if ( 'stripe' === ( WC_Stripe_Helper::is_pre_30() ? $order->payment_method : $order->get_payment_method() ) ) {
287
+ $this->process_refund( $order_id );
 
 
 
 
 
288
 
289
+ // This hook fires when admin manually changes order status to cancel.
290
+ do_action( 'woocommerce_stripe_process_manual_cancel', $order );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
291
  }
292
  }
293
 
includes/class-wc-stripe-webhook-handler.php CHANGED
@@ -10,6 +10,8 @@ if ( ! defined( 'ABSPATH' ) ) {
10
  * @since 4.0.0
11
  */
12
  class WC_Stripe_Webhook_Handler extends WC_Stripe_Payment_Gateway {
 
 
13
  /**
14
  * Constructor.
15
  *
@@ -17,6 +19,7 @@ class WC_Stripe_Webhook_Handler extends WC_Stripe_Payment_Gateway {
17
  * @version 4.0.0
18
  */
19
  public function __construct() {
 
20
  add_action( 'woocommerce_api_wc_stripe', array( $this, 'check_for_webhook' ) );
21
  }
22
 
@@ -152,7 +155,7 @@ class WC_Stripe_Webhook_Handler extends WC_Stripe_Payment_Gateway {
152
  if ( 'api_connection_error' === $response->error->type || 'api_error' === $response->error->type ) {
153
  if ( $retry ) {
154
  sleep( 5 );
155
- return $this->process_payment( $order_id, false );
156
  } else {
157
  $localized_message = 'API connection error and retries exhausted.';
158
  $order->add_order_note( $localized_message );
@@ -160,6 +163,26 @@ class WC_Stripe_Webhook_Handler extends WC_Stripe_Payment_Gateway {
160
  }
161
  }
162
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
163
  // Customer param wrong? The user may have been deleted on stripe's end. Remove customer_id. Can be retried without.
164
  if ( preg_match( '/No such customer/i', $response->error->message ) && $retry ) {
165
  if ( WC_Stripe_Helper::is_pre_30() ) {
@@ -171,7 +194,7 @@ class WC_Stripe_Webhook_Handler extends WC_Stripe_Payment_Gateway {
171
  $order->save();
172
  }
173
 
174
- return $this->process_payment( $order_id, false );
175
 
176
  } elseif ( preg_match( '/No such token/i', $response->error->message ) && $source_object->token_id ) {
177
  // Source param wrong? The CARD may have been deleted on stripe's end. Remove token and show message.
@@ -218,20 +241,21 @@ class WC_Stripe_Webhook_Handler extends WC_Stripe_Payment_Gateway {
218
  * We want to put the order into on-hold and add an order note.
219
  *
220
  * @since 4.0.0
221
- * @version 4.0.0
222
  * @param object $notification
223
  */
224
  public function process_webhook_dispute( $notification ) {
225
- $order = WC_Stripe_Helper::get_order_by_charge_id( $notification->data->object->id );
226
 
227
  if ( ! $order ) {
228
- WC_Stripe_Logger::log( 'Could not find order via charge ID: ' . $notification->data->object->id );
229
  return;
230
  }
231
 
232
  $order->update_status( 'on-hold', __( 'A dispute was created for this order. Response is needed. Please go to your Stripe Dashboard to review this dispute.', 'woocommerce-gateway-stripe' ) );
233
 
234
  do_action( 'wc_gateway_stripe_process_webhook_payment_error', $order, $notification );
 
 
235
  $this->send_failed_order_email( $order_id );
236
  }
237
 
@@ -409,17 +433,21 @@ class WC_Stripe_Webhook_Handler extends WC_Stripe_Payment_Gateway {
409
  }
410
 
411
  // Only refund captured charge.
412
- if ( $charge && 'yes' === $captured ) {
 
 
413
  // Create the refund.
414
  $refund = wc_create_refund( array(
415
  'order_id' => $order_id,
416
  'amount' => $this->get_refund_amount( $notification ),
417
- 'reason' => __( 'Refunded via Stripe Dashboard', 'woocommerce-gateway-stripe' ),
418
  ) );
419
 
420
  if ( is_wp_error( $refund ) ) {
421
  WC_Stripe_Logger::log( $refund->get_error_message() );
422
  }
 
 
423
  }
424
  }
425
  }
@@ -487,13 +515,6 @@ class WC_Stripe_Webhook_Handler extends WC_Stripe_Payment_Gateway {
487
  public function process_webhook( $request_body ) {
488
  $notification = json_decode( $request_body );
489
 
490
- /*
491
- * Hacky way to possibly prevent duplicate requests due to
492
- * frontend request and webhook payment firing at the same
493
- * time.
494
- */
495
- sleep( 10 );
496
-
497
  switch ( $notification->type ) {
498
  case 'source.chargeable':
499
  $this->process_webhook_payment( $notification );
10
  * @since 4.0.0
11
  */
12
  class WC_Stripe_Webhook_Handler extends WC_Stripe_Payment_Gateway {
13
+ public $retry_interval;
14
+
15
  /**
16
  * Constructor.
17
  *
19
  * @version 4.0.0
20
  */
21
  public function __construct() {
22
+ $this->retry_interval = 2;
23
  add_action( 'woocommerce_api_wc_stripe', array( $this, 'check_for_webhook' ) );
24
  }
25
 
155
  if ( 'api_connection_error' === $response->error->type || 'api_error' === $response->error->type ) {
156
  if ( $retry ) {
157
  sleep( 5 );
158
+ return $this->process_webhook_payment( $notification, false );
159
  } else {
160
  $localized_message = 'API connection error and retries exhausted.';
161
  $order->add_order_note( $localized_message );
163
  }
164
  }
165
 
166
+ // We want to retry.
167
+ if ( $this->is_retryable_error( $response->error ) ) {
168
+ if ( $retry ) {
169
+ // Don't do anymore retries after this.
170
+ if ( 5 <= $this->retry_interval ) {
171
+
172
+ return $this->process_webhook_payment( $notification, false );
173
+ }
174
+
175
+ sleep( $this->retry_interval );
176
+
177
+ $this->retry_interval++;
178
+ return $this->process_webhook_payment( $notification, true );
179
+ } else {
180
+ $localized_message = __( 'On going requests error and retries exhausted.', 'woocommerce-gateway-stripe' );
181
+ $order->add_order_note( $localized_message );
182
+ throw new WC_Stripe_Exception( print_r( $response, true ), $localized_message );
183
+ }
184
+ }
185
+
186
  // Customer param wrong? The user may have been deleted on stripe's end. Remove customer_id. Can be retried without.
187
  if ( preg_match( '/No such customer/i', $response->error->message ) && $retry ) {
188
  if ( WC_Stripe_Helper::is_pre_30() ) {
194
  $order->save();
195
  }
196
 
197
+ return $this->process_webhook_payment( $notification, false );
198
 
199
  } elseif ( preg_match( '/No such token/i', $response->error->message ) && $source_object->token_id ) {
200
  // Source param wrong? The CARD may have been deleted on stripe's end. Remove token and show message.
241
  * We want to put the order into on-hold and add an order note.
242
  *
243
  * @since 4.0.0
 
244
  * @param object $notification
245
  */
246
  public function process_webhook_dispute( $notification ) {
247
+ $order = WC_Stripe_Helper::get_order_by_charge_id( $notification->data->object->charge );
248
 
249
  if ( ! $order ) {
250
+ WC_Stripe_Logger::log( 'Could not find order via charge ID: ' . $notification->data->object->charge );
251
  return;
252
  }
253
 
254
  $order->update_status( 'on-hold', __( 'A dispute was created for this order. Response is needed. Please go to your Stripe Dashboard to review this dispute.', 'woocommerce-gateway-stripe' ) );
255
 
256
  do_action( 'wc_gateway_stripe_process_webhook_payment_error', $order, $notification );
257
+
258
+ $order_id = WC_Stripe_Helper::is_pre_30() ? $order->id : $order->get_id();
259
  $this->send_failed_order_email( $order_id );
260
  }
261
 
433
  }
434
 
435
  // Only refund captured charge.
436
+ if ( $charge ) {
437
+ $reason = ( isset( $captured ) && 'yes' === $captured ) ? __( 'Refunded via Stripe Dashboard', 'woocommerce-gateway-stripe' ) : __( 'Pre-Authorization Released via Stripe Dashboard', 'woocommerce-gateway-stripe' );
438
+
439
  // Create the refund.
440
  $refund = wc_create_refund( array(
441
  'order_id' => $order_id,
442
  'amount' => $this->get_refund_amount( $notification ),
443
+ 'reason' => $reason,
444
  ) );
445
 
446
  if ( is_wp_error( $refund ) ) {
447
  WC_Stripe_Logger::log( $refund->get_error_message() );
448
  }
449
+
450
+ $order->add_order_note( $reason );
451
  }
452
  }
453
  }
515
  public function process_webhook( $request_body ) {
516
  $notification = json_decode( $request_body );
517
 
 
 
 
 
 
 
 
518
  switch ( $notification->type ) {
519
  case 'source.chargeable':
520
  $this->process_webhook_payment( $notification );
includes/compat/class-wc-stripe-compat.php CHANGED
@@ -179,7 +179,7 @@ class WC_Stripe_Compat extends WC_Gateway_Stripe {
179
  * @param object $order
180
  */
181
  public function add_subscription_meta_data( $metadata, $order ) {
182
- if ( ! $this->has_subscription( $order->get_id() ) ) {
183
  return $metadata;
184
  }
185
 
179
  * @param object $order
180
  */
181
  public function add_subscription_meta_data( $metadata, $order ) {
182
+ if ( ! $this->has_subscription( WC_Stripe_Helper::is_pre_30() ? $order->id : $order->get_id() ) ) {
183
  return $metadata;
184
  }
185
 
includes/compat/class-wc-stripe-sepa-compat.php CHANGED
@@ -93,7 +93,7 @@ class WC_Stripe_Sepa_Compat extends WC_Gateway_Stripe_Sepa {
93
  * @param object $order
94
  */
95
  public function add_subscription_meta_data( $metadata, $order ) {
96
- if ( ! $this->has_subscription( $order->get_id() ) ) {
97
  return $metadata;
98
  }
99
 
@@ -317,13 +317,18 @@ class WC_Stripe_Sepa_Compat extends WC_Gateway_Stripe_Sepa {
317
  if ( $this->id === $payment_method_id ) {
318
 
319
  if ( ! isset( $payment_meta['post_meta']['_stripe_customer_id']['value'] ) || empty( $payment_meta['post_meta']['_stripe_customer_id']['value'] ) ) {
320
- throw new Exception( 'A "_stripe_customer_id" value is required.' );
321
  } elseif ( 0 !== strpos( $payment_meta['post_meta']['_stripe_customer_id']['value'], 'cus_' ) ) {
322
- throw new Exception( 'Invalid customer ID. A valid "_stripe_customer_id" must begin with "cus_".' );
323
  }
324
 
325
- if ( ! isset( $payment_meta['post_meta']['_stripe_source_id']['value'] ) || empty( $payment_meta['post_meta']['_stripe_source_id']['value'] ) ) {
326
- throw new Exception( 'A "_stripe_source_id" value is required.' );
 
 
 
 
 
327
  }
328
  }
329
  }
93
  * @param object $order
94
  */
95
  public function add_subscription_meta_data( $metadata, $order ) {
96
+ if ( ! $this->has_subscription( WC_Stripe_Helper::is_pre_30() ? $order->id : $order->get_id() ) ) {
97
  return $metadata;
98
  }
99
 
317
  if ( $this->id === $payment_method_id ) {
318
 
319
  if ( ! isset( $payment_meta['post_meta']['_stripe_customer_id']['value'] ) || empty( $payment_meta['post_meta']['_stripe_customer_id']['value'] ) ) {
320
+ throw new Exception( __( 'A "Stripe Customer ID" value is required.', 'woocommerce-gateway-stripe' ) );
321
  } elseif ( 0 !== strpos( $payment_meta['post_meta']['_stripe_customer_id']['value'], 'cus_' ) ) {
322
+ throw new Exception( __( 'Invalid customer ID. A valid "Stripe Customer ID" must begin with "cus_".', 'woocommerce-gateway-stripe' ) );
323
  }
324
 
325
+ if (
326
+ ( ! empty( $payment_meta['post_meta']['_stripe_source_id']['value'] )
327
+ && 0 !== strpos( $payment_meta['post_meta']['_stripe_source_id']['value'], 'card_' ) )
328
+ && ( ! empty( $payment_meta['post_meta']['_stripe_source_id']['value'] )
329
+ && 0 !== strpos( $payment_meta['post_meta']['_stripe_source_id']['value'], 'src_' ) ) ) {
330
+
331
+ throw new Exception( __( 'Invalid source ID. A valid source "Stripe Source ID" must begin with "src_" or "card_".', 'woocommerce-gateway-stripe' ) );
332
  }
333
  }
334
  }
languages/woocommerce-gateway-stripe.pot ADDED
@@ -0,0 +1,1243 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright (C) 2018 WooCommerce
2
+ # This file is distributed under the same license as the WooCommerce Stripe Gateway package.
3
+ msgid ""
4
+ msgstr ""
5
+ "Project-Id-Version: WooCommerce Stripe Gateway 4.0.4\n"
6
+ "Report-Msgid-Bugs-To: "
7
+ "https://github.com/woocommerce/woocommerce-gateway-stripe/issues\n"
8
+ "POT-Creation-Date: 2018-02-03 00:03:14+00:00\n"
9
+ "MIME-Version: 1.0\n"
10
+ "Content-Type: text/plain; charset=utf-8\n"
11
+ "Content-Transfer-Encoding: 8bit\n"
12
+ "PO-Revision-Date: 2018-MO-DA HO:MI+ZONE\n"
13
+ "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
14
+ "Language-Team: LANGUAGE <EMAIL@ADDRESS>\n"
15
+ "X-Generator: grunt-wp-i18n1.0.1\n"
16
+
17
+ #: includes/abstracts/abstract-wc-stripe-payment-gateway.php:113
18
+ #: includes/compat/class-wc-stripe-compat.php:231
19
+ #: includes/compat/class-wc-stripe-compat.php:536
20
+ #: includes/compat/class-wc-stripe-sepa-compat.php:145
21
+ #: includes/compat/class-wc-stripe-sepa-compat.php:446
22
+ #. translators: 1) dollar amount
23
+ #. translators: minimum amount
24
+ msgid "Sorry, the minimum allowed order total is %1$s to use this payment method."
25
+ msgstr ""
26
+
27
+ #: includes/abstracts/abstract-wc-stripe-payment-gateway.php:200
28
+ #. translators: 1) blog name 2) order number
29
+ msgid "%1$s - Order %2$s"
30
+ msgstr ""
31
+
32
+ #: includes/abstracts/abstract-wc-stripe-payment-gateway.php:227
33
+ msgid "customer_name"
34
+ msgstr ""
35
+
36
+ #: includes/abstracts/abstract-wc-stripe-payment-gateway.php:228
37
+ msgid "customer_email"
38
+ msgstr ""
39
+
40
+ #: includes/abstracts/abstract-wc-stripe-payment-gateway.php:289
41
+ #. translators: transaction id
42
+ msgid "Stripe charge awaiting payment: %s."
43
+ msgstr ""
44
+
45
+ #: includes/abstracts/abstract-wc-stripe-payment-gateway.php:296
46
+ #: includes/class-wc-stripe-order-handler.php:250
47
+ #: includes/class-wc-stripe-webhook-handler.php:299
48
+ #: includes/class-wc-stripe-webhook-handler.php:350
49
+ #. translators: transaction id
50
+ msgid "Stripe charge complete (Charge ID: %s)"
51
+ msgstr ""
52
+
53
+ #: includes/abstracts/abstract-wc-stripe-payment-gateway.php:301
54
+ #: includes/class-wc-gateway-stripe.php:628
55
+ #: includes/compat/class-wc-stripe-compat.php:103
56
+ #: includes/payment-methods/class-wc-gateway-stripe-bitcoin.php:374
57
+ msgid "Payment processing failed. Please retry."
58
+ msgstr ""
59
+
60
+ #: includes/abstracts/abstract-wc-stripe-payment-gateway.php:313
61
+ #. translators: transaction id
62
+ msgid ""
63
+ "Stripe charge authorized (Charge ID: %s). Process order to take payment, or "
64
+ "cancel to remove the pre-authorization."
65
+ msgstr ""
66
+
67
+ #: includes/abstracts/abstract-wc-stripe-payment-gateway.php:496
68
+ msgid "Invalid payment method. Please input a new card number."
69
+ msgstr ""
70
+
71
+ #: includes/abstracts/abstract-wc-stripe-payment-gateway.php:721
72
+ #. translators: 1) dollar amount 2) transaction id 3) refund message
73
+ msgid "Refunded %1$s - Refund ID: %2$s - Reason: %3$s"
74
+ msgstr ""
75
+
76
+ #: includes/abstracts/abstract-wc-stripe-payment-gateway.php:721
77
+ msgid "Pre-Authorization Released"
78
+ msgstr ""
79
+
80
+ #: includes/abstracts/abstract-wc-stripe-payment-gateway.php:739
81
+ msgid "There was a problem adding the card."
82
+ msgstr ""
83
+
84
+ #: includes/admin/stripe-alipay-settings.php:11
85
+ msgid "Relevant Payer Geography: China"
86
+ msgstr ""
87
+
88
+ #: includes/admin/stripe-alipay-settings.php:15
89
+ msgid ""
90
+ "<a href=\"https://stripe.com/payments/payment-methods-guide#alipay\" "
91
+ "target=\"_blank\">Payment Method Guide</a>"
92
+ msgstr ""
93
+
94
+ #: includes/admin/stripe-alipay-settings.php:19
95
+ #: includes/admin/stripe-bancontact-settings.php:19
96
+ #: includes/admin/stripe-bitcoin-settings.php:19
97
+ #: includes/admin/stripe-giropay-settings.php:19
98
+ #: includes/admin/stripe-ideal-settings.php:19
99
+ #: includes/admin/stripe-p24-settings.php:15
100
+ #: includes/admin/stripe-sepa-settings.php:19
101
+ #: includes/admin/stripe-sofort-settings.php:19
102
+ msgid ""
103
+ "Must be activated from your Stripe Dashboard Settings <a "
104
+ "href=\"https://dashboard.stripe.com/account/payments/settings\" "
105
+ "target=\"_blank\">here</a>"
106
+ msgstr ""
107
+
108
+ #: includes/admin/stripe-alipay-settings.php:23
109
+ #: includes/admin/stripe-bancontact-settings.php:23
110
+ #: includes/admin/stripe-bitcoin-settings.php:23
111
+ #: includes/admin/stripe-giropay-settings.php:23
112
+ #: includes/admin/stripe-ideal-settings.php:23
113
+ #: includes/admin/stripe-p24-settings.php:19
114
+ #: includes/admin/stripe-sepa-settings.php:23
115
+ #: includes/admin/stripe-settings.php:11
116
+ #: includes/admin/stripe-sofort-settings.php:23
117
+ msgid "Enable/Disable"
118
+ msgstr ""
119
+
120
+ #: includes/admin/stripe-alipay-settings.php:24
121
+ msgid "Enable Stripe Alipay"
122
+ msgstr ""
123
+
124
+ #: includes/admin/stripe-alipay-settings.php:30
125
+ #: includes/admin/stripe-bancontact-settings.php:30
126
+ #: includes/admin/stripe-bitcoin-settings.php:30
127
+ #: includes/admin/stripe-giropay-settings.php:30
128
+ #: includes/admin/stripe-ideal-settings.php:30
129
+ #: includes/admin/stripe-p24-settings.php:26
130
+ #: includes/admin/stripe-sepa-settings.php:30
131
+ #: includes/admin/stripe-settings.php:18
132
+ #: includes/admin/stripe-sofort-settings.php:30
133
+ msgid "Title"
134
+ msgstr ""
135
+
136
+ #: includes/admin/stripe-alipay-settings.php:32
137
+ #: includes/admin/stripe-bancontact-settings.php:32
138
+ #: includes/admin/stripe-bitcoin-settings.php:32
139
+ #: includes/admin/stripe-giropay-settings.php:32
140
+ #: includes/admin/stripe-ideal-settings.php:32
141
+ #: includes/admin/stripe-p24-settings.php:28
142
+ #: includes/admin/stripe-sepa-settings.php:32
143
+ #: includes/admin/stripe-settings.php:20
144
+ #: includes/admin/stripe-sofort-settings.php:32
145
+ msgid "This controls the title which the user sees during checkout."
146
+ msgstr ""
147
+
148
+ #: includes/admin/stripe-alipay-settings.php:33
149
+ msgid "Alipay"
150
+ msgstr ""
151
+
152
+ #: includes/admin/stripe-alipay-settings.php:37
153
+ #: includes/admin/stripe-bancontact-settings.php:37
154
+ #: includes/admin/stripe-bitcoin-settings.php:37
155
+ #: includes/admin/stripe-giropay-settings.php:37
156
+ #: includes/admin/stripe-ideal-settings.php:37
157
+ #: includes/admin/stripe-p24-settings.php:33
158
+ #: includes/admin/stripe-sepa-settings.php:37
159
+ #: includes/admin/stripe-settings.php:25
160
+ #: includes/admin/stripe-sofort-settings.php:37
161
+ msgid "Description"
162
+ msgstr ""
163
+
164
+ #: includes/admin/stripe-alipay-settings.php:39
165
+ #: includes/admin/stripe-bancontact-settings.php:39
166
+ #: includes/admin/stripe-bitcoin-settings.php:39
167
+ #: includes/admin/stripe-giropay-settings.php:39
168
+ #: includes/admin/stripe-ideal-settings.php:39
169
+ #: includes/admin/stripe-p24-settings.php:35
170
+ #: includes/admin/stripe-sepa-settings.php:39
171
+ #: includes/admin/stripe-settings.php:27
172
+ #: includes/admin/stripe-sofort-settings.php:39
173
+ msgid "This controls the description which the user sees during checkout."
174
+ msgstr ""
175
+
176
+ #: includes/admin/stripe-alipay-settings.php:40
177
+ msgid "You will be redirected to Alipay."
178
+ msgstr ""
179
+
180
+ #: includes/admin/stripe-alipay-settings.php:44
181
+ #: includes/admin/stripe-bancontact-settings.php:44
182
+ #: includes/admin/stripe-bitcoin-settings.php:44
183
+ #: includes/admin/stripe-giropay-settings.php:44
184
+ #: includes/admin/stripe-ideal-settings.php:44
185
+ #: includes/admin/stripe-p24-settings.php:40
186
+ #: includes/admin/stripe-sepa-settings.php:44
187
+ #: includes/admin/stripe-settings.php:32
188
+ #: includes/admin/stripe-sofort-settings.php:44
189
+ msgid "Webhook Endpoints"
190
+ msgstr ""
191
+
192
+ #: includes/admin/stripe-alipay-settings.php:47
193
+ #: includes/admin/stripe-bancontact-settings.php:47
194
+ #: includes/admin/stripe-bitcoin-settings.php:47
195
+ #: includes/admin/stripe-giropay-settings.php:47
196
+ #: includes/admin/stripe-ideal-settings.php:47
197
+ #: includes/admin/stripe-p24-settings.php:43
198
+ #: includes/admin/stripe-sepa-settings.php:47
199
+ #: includes/admin/stripe-settings.php:35
200
+ #: includes/admin/stripe-sofort-settings.php:47
201
+ #. translators: webhook URL
202
+ msgid ""
203
+ "You must add the webhook endpoint <strong "
204
+ "style=\"background-color:#ddd;\">&nbsp;&nbsp;%s&nbsp;&nbsp;</strong> to "
205
+ "your Stripe Account Settings <a "
206
+ "href=\"https://dashboard.stripe.com/account/webhooks\" "
207
+ "target=\"_blank\">Here</a> so you can receive notifications on the charge "
208
+ "statuses."
209
+ msgstr ""
210
+
211
+ #: includes/admin/stripe-bancontact-settings.php:11
212
+ msgid "Relevant Payer Geography: Belgium"
213
+ msgstr ""
214
+
215
+ #: includes/admin/stripe-bancontact-settings.php:15
216
+ msgid ""
217
+ "<a href=\"https://stripe.com/payments/payment-methods-guide#bancontact\" "
218
+ "target=\"_blank\">Payment Method Guide</a>"
219
+ msgstr ""
220
+
221
+ #: includes/admin/stripe-bancontact-settings.php:24
222
+ msgid "Enable Stripe Bancontact"
223
+ msgstr ""
224
+
225
+ #: includes/admin/stripe-bancontact-settings.php:33
226
+ msgid "Bancontact"
227
+ msgstr ""
228
+
229
+ #: includes/admin/stripe-bancontact-settings.php:40
230
+ msgid "You will be redirected to Bancontact."
231
+ msgstr ""
232
+
233
+ #: includes/admin/stripe-bitcoin-settings.php:11
234
+ msgid "Relevant Payer Geography: Global"
235
+ msgstr ""
236
+
237
+ #: includes/admin/stripe-bitcoin-settings.php:15
238
+ msgid ""
239
+ "<a href=\"https://stripe.com/payments/payment-methods-guide#bitcoin\" "
240
+ "target=\"_blank\">Payment Method Guide</a>"
241
+ msgstr ""
242
+
243
+ #: includes/admin/stripe-bitcoin-settings.php:24
244
+ msgid "Enable Stripe Bitcoin"
245
+ msgstr ""
246
+
247
+ #: includes/admin/stripe-bitcoin-settings.php:33
248
+ msgid "Bitcoin"
249
+ msgstr ""
250
+
251
+ #: includes/admin/stripe-bitcoin-settings.php:40
252
+ msgid "Bitcoin payment information will be provided when you place the order."
253
+ msgstr ""
254
+
255
+ #: includes/admin/stripe-giropay-settings.php:11
256
+ msgid "Relevant Payer Geography: Germany"
257
+ msgstr ""
258
+
259
+ #: includes/admin/stripe-giropay-settings.php:15
260
+ msgid ""
261
+ "<a href=\"https://stripe.com/payments/payment-methods-guide#giropay\" "
262