Version Description
- 2021-01-28 =
- Fix - Filter more disallowed characters from statement descriptors.
See changelog for all versions.
Download this release
Release Info
Developer | automattic |
Plugin | WooCommerce Stripe Payment Gateway |
Version | 4.8.0 |
Comparing to | |
See all releases |
Code changes from version 4.7.0 to 4.8.0
- assets/js/stripe-admin.js +23 -0
- assets/js/stripe-admin.min.js +1 -1
- assets/js/stripe-payment-request.js +69 -51
- assets/js/stripe-payment-request.min.js +1 -1
- changelog.txt +7 -0
- includes/abstracts/abstract-wc-stripe-payment-gateway.php +8 -1
- includes/admin/stripe-settings.php +1 -1
- includes/class-wc-gateway-stripe.php +29 -1
- includes/class-wc-stripe-helper.php +11 -4
- includes/class-wc-stripe-webhook-handler.php +1 -1
- languages/woocommerce-gateway-stripe.pot +47 -36
- readme.txt +4 -9
- woocommerce-gateway-stripe.php +5 -5
assets/js/stripe-admin.js
CHANGED
@@ -1,3 +1,5 @@
|
|
|
|
|
|
1 |
jQuery( function( $ ) {
|
2 |
'use strict';
|
3 |
|
@@ -122,6 +124,27 @@ jQuery( function( $ ) {
|
|
122 |
|
123 |
$( 'form' ).find( 'input, select' ).off( 'change input', disableConnect );
|
124 |
} );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
125 |
}
|
126 |
};
|
127 |
|
1 |
+
+/* global wc_stripe_settings_params */
|
2 |
+
|
3 |
jQuery( function( $ ) {
|
4 |
'use strict';
|
5 |
|
124 |
|
125 |
$( 'form' ).find( 'input, select' ).off( 'change input', disableConnect );
|
126 |
} );
|
127 |
+
|
128 |
+
// Webhook verification checks for timestamp within 5 minutes so warn if
|
129 |
+
// server time is off from browser time by > 4 minutes.
|
130 |
+
var timeDifference = Date.now() / 1000 - wc_stripe_settings_params.time;
|
131 |
+
var isTimeOutOfSync = Math.abs( timeDifference ) > 4 * 60;
|
132 |
+
$( '#woocommerce_stripe_test_webhook_secret, #woocommerce_stripe_webhook_secret' )
|
133 |
+
.on( 'change input', function() {
|
134 |
+
var $td = $( this ).closest( 'td' );
|
135 |
+
var $warning = $td.find( '.webhook_secret_time_sync_warning' );
|
136 |
+
var hasWebhookSecretValue = $( this ).val().length > 0;
|
137 |
+
|
138 |
+
if ( hasWebhookSecretValue ){
|
139 |
+
var isWarningShown = $warning.length > 0;
|
140 |
+
if ( isTimeOutOfSync && ! isWarningShown ) {
|
141 |
+
$td.append( '<p class="webhook_secret_time_sync_warning">' + wc_stripe_settings_params.i18n_out_of_sync + '</p>' );
|
142 |
+
}
|
143 |
+
} else {
|
144 |
+
$warning.remove();
|
145 |
+
}
|
146 |
+
} )
|
147 |
+
.change();
|
148 |
}
|
149 |
};
|
150 |
|
assets/js/stripe-admin.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
jQuery(function(i){"use strict";var e={isTestMode:function(){return i("#woocommerce_stripe_testmode").is(":checked")},getSecretKey:function(){return e.isTestMode()?i("#woocommerce_stripe_test_secret_key").val():i("#woocommerce_stripe_secret_key").val()},init:function(){i(document.body).on("change","#woocommerce_stripe_testmode",function(){var e=i("#woocommerce_stripe_test_secret_key").parents("tr").eq(0),t=i("#woocommerce_stripe_test_publishable_key").parents("tr").eq(0),o=i("#woocommerce_stripe_test_webhook_secret").parents("tr").eq(0),s=i("#woocommerce_stripe_secret_key").parents("tr").eq(0),r=i("#woocommerce_stripe_publishable_key").parents("tr").eq(0),c=i("#woocommerce_stripe_webhook_secret").parents("tr").eq(0);i(this).is(":checked")?(e.show(),t.show(),o.show(),s.hide(),r.hide(),c.hide()):(e.hide(),t.hide(),o.hide(),s.show(),r.show(),c.show())}),i("#woocommerce_stripe_testmode").trigger("change"),i("#woocommerce_stripe_payment_request").on("change",function(){i(this).is(":checked")?i("#woocommerce_stripe_payment_request_button_theme, #woocommerce_stripe_payment_request_button_type, #woocommerce_stripe_payment_request_button_height").closest("tr").show():i("#woocommerce_stripe_payment_request_button_theme, #woocommerce_stripe_payment_request_button_type, #woocommerce_stripe_payment_request_button_height").closest("tr").hide()}).trigger("change"),i("#woocommerce_stripe_payment_request_button_type").on("change",function(){"custom"===i(this).val()?i("#woocommerce_stripe_payment_request_button_label").closest("tr").show():i("#woocommerce_stripe_payment_request_button_label").closest("tr").hide()}).trigger("change"),i("#woocommerce_stripe_payment_request_button_type").on("change",function(){"branded"===i(this).val()?i("#woocommerce_stripe_payment_request_button_branded_type").closest("tr").show():i("#woocommerce_stripe_payment_request_button_branded_type").closest("tr").hide()}).trigger("change"),i(".wc-stripe-3ds-missing").each(function(){var e=i(this);e.find(".notice-dismiss").on("click.wc-stripe-dismiss-notice",function(){i.ajax({type:"head",url:window.location.href+"&stripe_dismiss_3ds="+e.data("nonce")})})}),i("#woocommerce_stripe_test_secret_key, #woocommerce_stripe_secret_key, #woocommerce_stripe_test_webhook_secret, #woocommerce_stripe_webhook_secret").after('<button class="wc-stripe-toggle-secret" style="height: 30px; margin-left: 2px; cursor: pointer"><span class="dashicons dashicons-visibility"></span></button>'),i(".wc-stripe-toggle-secret").on("click",function(e){e.preventDefault();var t=i(this).closest("button").find(".dashicons"),o=i(this).closest("tr").find(".input-text");"text"==o.attr("type")?(o.attr("type","password"),t.removeClass("dashicons-hidden"),t.addClass("dashicons-visibility")):(o.attr("type","text"),t.removeClass("dashicons-visibility"),t.addClass("dashicons-hidden"))}),i("form").find("input, select").on("change input",function e(){i("#wc_stripe_connect_button").addClass("disabled"),i("#wc_stripe_connect_button").on("click",function(){return!1}),i("#woocommerce_stripe_api_credentials").next("p").append(" (Please save changes before selecting this button.)"),i("form").find("input, select").off("change input",e)})}};e.init()});
|
1 |
+
jQuery(function(i){"use strict";var e={isTestMode:function(){return i("#woocommerce_stripe_testmode").is(":checked")},getSecretKey:function(){return e.isTestMode()?i("#woocommerce_stripe_test_secret_key").val():i("#woocommerce_stripe_secret_key").val()},init:function(){i(document.body).on("change","#woocommerce_stripe_testmode",function(){var e=i("#woocommerce_stripe_test_secret_key").parents("tr").eq(0),t=i("#woocommerce_stripe_test_publishable_key").parents("tr").eq(0),o=i("#woocommerce_stripe_test_webhook_secret").parents("tr").eq(0),s=i("#woocommerce_stripe_secret_key").parents("tr").eq(0),r=i("#woocommerce_stripe_publishable_key").parents("tr").eq(0),c=i("#woocommerce_stripe_webhook_secret").parents("tr").eq(0);i(this).is(":checked")?(e.show(),t.show(),o.show(),s.hide(),r.hide(),c.hide()):(e.hide(),t.hide(),o.hide(),s.show(),r.show(),c.show())}),i("#woocommerce_stripe_testmode").trigger("change"),i("#woocommerce_stripe_payment_request").on("change",function(){i(this).is(":checked")?i("#woocommerce_stripe_payment_request_button_theme, #woocommerce_stripe_payment_request_button_type, #woocommerce_stripe_payment_request_button_height").closest("tr").show():i("#woocommerce_stripe_payment_request_button_theme, #woocommerce_stripe_payment_request_button_type, #woocommerce_stripe_payment_request_button_height").closest("tr").hide()}).trigger("change"),i("#woocommerce_stripe_payment_request_button_type").on("change",function(){"custom"===i(this).val()?i("#woocommerce_stripe_payment_request_button_label").closest("tr").show():i("#woocommerce_stripe_payment_request_button_label").closest("tr").hide()}).trigger("change"),i("#woocommerce_stripe_payment_request_button_type").on("change",function(){"branded"===i(this).val()?i("#woocommerce_stripe_payment_request_button_branded_type").closest("tr").show():i("#woocommerce_stripe_payment_request_button_branded_type").closest("tr").hide()}).trigger("change"),i(".wc-stripe-3ds-missing").each(function(){var e=i(this);e.find(".notice-dismiss").on("click.wc-stripe-dismiss-notice",function(){i.ajax({type:"head",url:window.location.href+"&stripe_dismiss_3ds="+e.data("nonce")})})}),i("#woocommerce_stripe_test_secret_key, #woocommerce_stripe_secret_key, #woocommerce_stripe_test_webhook_secret, #woocommerce_stripe_webhook_secret").after('<button class="wc-stripe-toggle-secret" style="height: 30px; margin-left: 2px; cursor: pointer"><span class="dashicons dashicons-visibility"></span></button>'),i(".wc-stripe-toggle-secret").on("click",function(e){e.preventDefault();var t=i(this).closest("button").find(".dashicons"),o=i(this).closest("tr").find(".input-text");"text"==o.attr("type")?(o.attr("type","password"),t.removeClass("dashicons-hidden"),t.addClass("dashicons-visibility")):(o.attr("type","text"),t.removeClass("dashicons-visibility"),t.addClass("dashicons-hidden"))}),i("form").find("input, select").on("change input",function e(){i("#wc_stripe_connect_button").addClass("disabled"),i("#wc_stripe_connect_button").on("click",function(){return!1}),i("#woocommerce_stripe_api_credentials").next("p").append(" (Please save changes before selecting this button.)"),i("form").find("input, select").off("change input",e)});var e=Date.now()/1e3-wc_stripe_settings_params.time,s=240<Math.abs(e);i("#woocommerce_stripe_test_webhook_secret, #woocommerce_stripe_webhook_secret").on("change input",function(){var e=i(this).closest("td"),t=e.find(".webhook_secret_time_sync_warning");if(0<i(this).val().length){var o=0<t.length;s&&!o&&e.append('<p class="webhook_secret_time_sync_warning">'+wc_stripe_settings_params.i18n_out_of_sync+"</p>")}else t.remove()}).change()}};e.init()});
|
assets/js/stripe-payment-request.js
CHANGED
@@ -147,21 +147,16 @@ jQuery( function( $ ) {
|
|
147 |
},
|
148 |
|
149 |
/**
|
150 |
-
*
|
151 |
*
|
152 |
-
* @since
|
153 |
-
* @
|
154 |
-
* @param {PaymentResponse} payment Payment response instance.
|
155 |
-
* @param {String} message Error message to display.
|
156 |
*/
|
157 |
-
|
158 |
-
payment.complete( 'fail' );
|
159 |
-
|
160 |
$( '.woocommerce-error' ).remove();
|
161 |
|
162 |
if ( wc_stripe_payment_request_params.is_product_page ) {
|
163 |
-
var element = $( '.product' );
|
164 |
-
|
165 |
element.before( message );
|
166 |
|
167 |
$( 'html, body' ).animate({
|
@@ -169,15 +164,26 @@ jQuery( function( $ ) {
|
|
169 |
}, 600 );
|
170 |
} else {
|
171 |
var $form = $( '.shop_table.cart' ).closest( 'form' );
|
172 |
-
|
173 |
$form.before( message );
|
174 |
-
|
175 |
$( 'html, body' ).animate({
|
176 |
scrollTop: $form.prev( '.woocommerce-error' ).offset().top
|
177 |
}, 600 );
|
178 |
}
|
179 |
},
|
180 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
181 |
/**
|
182 |
* Complete payment.
|
183 |
*
|
@@ -325,7 +331,7 @@ jQuery( function( $ ) {
|
|
325 |
* Starts the payment request
|
326 |
*
|
327 |
* @since 4.0.0
|
328 |
-
* @version 4.
|
329 |
*/
|
330 |
startPaymentRequest: function( cart ) {
|
331 |
var paymentDetails,
|
@@ -350,54 +356,66 @@ jQuery( function( $ ) {
|
|
350 |
paymentDetails = cart.order_data;
|
351 |
}
|
352 |
|
353 |
-
|
354 |
-
|
355 |
-
|
356 |
-
|
|
|
357 |
|
358 |
-
//
|
359 |
-
|
360 |
-
|
361 |
-
return;
|
362 |
-
}
|
363 |
-
paymentRequestType = result.applePay ? 'apple_pay' : 'payment_request_api';
|
364 |
-
wc_stripe_payment_request.attachPaymentRequestButtonEventListeners( prButton, paymentRequest );
|
365 |
-
wc_stripe_payment_request.showPaymentRequestButton( prButton );
|
366 |
-
} );
|
367 |
|
368 |
-
|
369 |
-
|
370 |
-
$.when( wc_stripe_payment_request.updateShippingOptions( paymentDetails, evt.shippingAddress ) ).then( function( response ) {
|
371 |
-
evt.updateWith( { status: response.result, shippingOptions: response.shipping_options, total: response.total, displayItems: response.displayItems } );
|
372 |
-
} );
|
373 |
-
} );
|
374 |
|
375 |
-
|
376 |
-
|
377 |
-
if (
|
378 |
-
|
379 |
}
|
|
|
|
|
|
|
|
|
380 |
|
381 |
-
|
382 |
-
|
383 |
-
|
|
|
|
|
384 |
} );
|
385 |
-
} );
|
386 |
|
387 |
-
|
388 |
-
|
389 |
-
if ( 'no' === wc_stripe_payment_request_params.stripe.allow_prepaid_card && 'prepaid' === evt.source.card.funding ) {
|
390 |
-
wc_stripe_payment_request.abortPayment( evt, wc_stripe_payment_request.getErrorMessageHTML( wc_stripe_payment_request_params.i18n.no_prepaid_card ) );
|
391 |
-
} else {
|
392 |
-
$.when( wc_stripe_payment_request.processSource( evt, paymentRequestType ) ).then( function( response ) {
|
393 |
if ( 'success' === response.result ) {
|
394 |
-
|
395 |
-
}
|
396 |
-
|
|
|
|
|
397 |
}
|
398 |
} );
|
399 |
-
}
|
400 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
401 |
},
|
402 |
|
403 |
getSelectedProductData: function() {
|
147 |
},
|
148 |
|
149 |
/**
|
150 |
+
* Display error messages.
|
151 |
*
|
152 |
+
* @since 4.8.0
|
153 |
+
* @param {Object} message DOM object with error message to display.
|
|
|
|
|
154 |
*/
|
155 |
+
displayErrorMessage: function( message ) {
|
|
|
|
|
156 |
$( '.woocommerce-error' ).remove();
|
157 |
|
158 |
if ( wc_stripe_payment_request_params.is_product_page ) {
|
159 |
+
var element = $( '.product' ).first();
|
|
|
160 |
element.before( message );
|
161 |
|
162 |
$( 'html, body' ).animate({
|
164 |
}, 600 );
|
165 |
} else {
|
166 |
var $form = $( '.shop_table.cart' ).closest( 'form' );
|
|
|
167 |
$form.before( message );
|
|
|
168 |
$( 'html, body' ).animate({
|
169 |
scrollTop: $form.prev( '.woocommerce-error' ).offset().top
|
170 |
}, 600 );
|
171 |
}
|
172 |
},
|
173 |
|
174 |
+
/**
|
175 |
+
* Abort payment and display error messages.
|
176 |
+
*
|
177 |
+
* @since 3.1.0
|
178 |
+
* @version 4.8.0
|
179 |
+
* @param {PaymentResponse} payment Payment response instance.
|
180 |
+
* @param {Object} message DOM object with error message to display.
|
181 |
+
*/
|
182 |
+
abortPayment: function( payment, message ) {
|
183 |
+
payment.complete( 'fail' );
|
184 |
+
wc_stripe_payment_request.displayErrorMessage( message );
|
185 |
+
},
|
186 |
+
|
187 |
/**
|
188 |
* Complete payment.
|
189 |
*
|
331 |
* Starts the payment request
|
332 |
*
|
333 |
* @since 4.0.0
|
334 |
+
* @version 4.8.0
|
335 |
*/
|
336 |
startPaymentRequest: function( cart ) {
|
337 |
var paymentDetails,
|
356 |
paymentDetails = cart.order_data;
|
357 |
}
|
358 |
|
359 |
+
// Puerto Rico (PR) is the only US territory/possession that's supported by Stripe.
|
360 |
+
// Since it's considered a US state by Stripe, we need to do some special mapping.
|
361 |
+
if ( 'PR' === options.country ) {
|
362 |
+
options.country = 'US';
|
363 |
+
}
|
364 |
|
365 |
+
// Handle errors thrown by Stripe, so we don't break the product page
|
366 |
+
try {
|
367 |
+
var paymentRequest = stripe.paymentRequest( options );
|
|
|
|
|
|
|
|
|
|
|
|
|
368 |
|
369 |
+
var elements = stripe.elements( { locale: wc_stripe_payment_request_params.button.locale } );
|
370 |
+
var prButton = wc_stripe_payment_request.createPaymentRequestButton( elements, paymentRequest );
|
|
|
|
|
|
|
|
|
371 |
|
372 |
+
// Check the availability of the Payment Request API first.
|
373 |
+
paymentRequest.canMakePayment().then( function( result ) {
|
374 |
+
if ( ! result ) {
|
375 |
+
return;
|
376 |
}
|
377 |
+
paymentRequestType = result.applePay ? 'apple_pay' : 'payment_request_api';
|
378 |
+
wc_stripe_payment_request.attachPaymentRequestButtonEventListeners( prButton, paymentRequest );
|
379 |
+
wc_stripe_payment_request.showPaymentRequestButton( prButton );
|
380 |
+
} );
|
381 |
|
382 |
+
// Possible statuses success, fail, invalid_payer_name, invalid_payer_email, invalid_payer_phone, invalid_shipping_address.
|
383 |
+
paymentRequest.on( 'shippingaddresschange', function( evt ) {
|
384 |
+
$.when( wc_stripe_payment_request.updateShippingOptions( paymentDetails, evt.shippingAddress ) ).then( function( response ) {
|
385 |
+
evt.updateWith( { status: response.result, shippingOptions: response.shipping_options, total: response.total, displayItems: response.displayItems } );
|
386 |
+
} );
|
387 |
} );
|
|
|
388 |
|
389 |
+
paymentRequest.on( 'shippingoptionchange', function( evt ) {
|
390 |
+
$.when( wc_stripe_payment_request.updateShippingDetails( paymentDetails, evt.shippingOption ) ).then( function( response ) {
|
|
|
|
|
|
|
|
|
391 |
if ( 'success' === response.result ) {
|
392 |
+
evt.updateWith( { status: 'success', total: response.total, displayItems: response.displayItems } );
|
393 |
+
}
|
394 |
+
|
395 |
+
if ( 'fail' === response.result ) {
|
396 |
+
evt.updateWith( { status: 'fail' } );
|
397 |
}
|
398 |
} );
|
399 |
+
} );
|
400 |
+
|
401 |
+
paymentRequest.on( 'source', function( evt ) {
|
402 |
+
// Check if we allow prepaid cards.
|
403 |
+
if ( 'no' === wc_stripe_payment_request_params.stripe.allow_prepaid_card && 'prepaid' === evt.source.card.funding ) {
|
404 |
+
wc_stripe_payment_request.abortPayment( evt, wc_stripe_payment_request.getErrorMessageHTML( wc_stripe_payment_request_params.i18n.no_prepaid_card ) );
|
405 |
+
} else {
|
406 |
+
$.when( wc_stripe_payment_request.processSource( evt, paymentRequestType ) ).then( function( response ) {
|
407 |
+
if ( 'success' === response.result ) {
|
408 |
+
wc_stripe_payment_request.completePayment( evt, response.redirect );
|
409 |
+
} else {
|
410 |
+
wc_stripe_payment_request.abortPayment( evt, response.messages );
|
411 |
+
}
|
412 |
+
} );
|
413 |
+
}
|
414 |
+
} );
|
415 |
+
} catch( e ) {
|
416 |
+
// Leave for troubleshooting
|
417 |
+
console.error( e );
|
418 |
+
}
|
419 |
},
|
420 |
|
421 |
getSelectedProductData: function() {
|
assets/js/stripe-payment-request.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
jQuery(function(i){"use strict";var o,p=Stripe(wc_stripe_payment_request_params.stripe.key),u={getAjaxURL:function(t){return wc_stripe_payment_request_params.ajax_url.toString().replace("%%endpoint%%","wc_stripe_"+t)},getCartDetails:function(){var t={security:wc_stripe_payment_request_params.nonce.payment};i.ajax({type:"POST",data:t,url:u.getAjaxURL("get_cart_details"),success:function(t){u.startPaymentRequest(t)}})},getAttributes:function(){var t=i(".variations_form").find(".variations select"),a={},n=0,s=0;return t.each(function(){var t=i(this).data("attribute_name")||i(this).attr("name"),e=i(this).val()||"";0<e.length&&s++,n++,a[t]=e}),{count:n,chosenCount:s,data:a}},processSource:function(t,e){var a=u.getOrderData(t,e);return i.ajax({type:"POST",data:a,dataType:"json",url:u.getAjaxURL("create_order")})},getOrderData:function(t,e){var a=t.source,n=a.owner.email,s=a.owner.phone,r=a.owner.address,i=a.owner.name,o=t.shippingAddress,p={_wpnonce:wc_stripe_payment_request_params.nonce.checkout,billing_first_name:null!==i?i.split(" ").slice(0,1).join(" "):"",billing_last_name:null!==i?i.split(" ").slice(1).join(" "):"",billing_company:"",billing_email:null!==n?n:t.payerEmail,billing_phone:null!==s?s:t.payerPhone&&t.payerPhone.replace("/[() -]/g",""),billing_country:null!==r?r.country:"",billing_address_1:null!==r?r.line1:"",billing_address_2:null!==r?r.line2:"",billing_city:null!==r?r.city:"",billing_state:null!==r?r.state:"",billing_postcode:null!==r?r.postal_code:"",shipping_first_name:"",shipping_last_name:"",shipping_company:"",shipping_country:"",shipping_address_1:"",shipping_address_2:"",shipping_city:"",shipping_state:"",shipping_postcode:"",shipping_method:[null===t.shippingOption?null:t.shippingOption.id],order_comments:"",payment_method:"stripe",ship_to_different_address:1,terms:1,stripe_source:a.id,payment_request_type:e};return o&&(p.shipping_first_name=o.recipient.split(" ").slice(0,1).join(" "),p.shipping_last_name=o.recipient.split(" ").slice(1).join(" "),p.shipping_company=o.organization,p.shipping_country=o.country,p.shipping_address_1=void 0===o.addressLine[0]?"":o.addressLine[0],p.shipping_address_2=void 0===o.addressLine[1]?"":o.addressLine[1],p.shipping_city=o.city,p.shipping_state=o.region,p.shipping_postcode=o.postalCode),p},getErrorMessageHTML:function(t){return i('<div class="woocommerce-error" />').text(t)},abortPayment:function(t,e){if(t.complete("fail"),i(".woocommerce-error").remove(),wc_stripe_payment_request_params.is_product_page){var a=i(".product");a.before(e),i("html, body").animate({scrollTop:a.prev(".woocommerce-error").offset().top},600)}else{var n=i(".shop_table.cart").closest("form");n.before(e),i("html, body").animate({scrollTop:n.prev(".woocommerce-error").offset().top},600)}},completePayment:function(t,e){u.block(),t.complete("success"),window.location=e},block:function(){i.blockUI({message:null,overlayCSS:{background:"#fff",opacity:.6}})},updateShippingOptions:function(t,e){var a={security:wc_stripe_payment_request_params.nonce.shipping,country:e.country,state:e.region,postcode:e.postalCode,city:e.city,address:void 0===e.addressLine[0]?"":e.addressLine[0],address_2:void 0===e.addressLine[1]?"":e.addressLine[1],payment_request_type:o,is_product_page:wc_stripe_payment_request_params.is_product_page};return i.ajax({type:"POST",data:a,url:u.getAjaxURL("get_shipping_options")})},updateShippingDetails:function(t,e){var a={security:wc_stripe_payment_request_params.nonce.update_shipping,shipping_method:[e.id],payment_request_type:o,is_product_page:wc_stripe_payment_request_params.is_product_page};return i.ajax({type:"POST",data:a,url:u.getAjaxURL("update_shipping_method")})},addToCart:function(){var t=i(".single_add_to_cart_button").val();i(".single_variation_wrap").length&&(t=i(".single_variation_wrap").find('input[name="product_id"]').val());var n={security:wc_stripe_payment_request_params.nonce.add_to_cart,product_id:t,qty:i(".quantity .qty").val(),attributes:i(".variations_form").length?u.getAttributes().data:[]},e=i("form.cart").serializeArray();return i.each(e,function(t,e){if(/^addon-/.test(e.name))if(/\[\]$/.test(e.name)){var a=e.name.substring(0,e.name.length-2);n[a]?n[a].push(e.value):n[a]=[e.value]}else n[e.name]=e.value}),i.ajax({type:"POST",data:n,url:u.getAjaxURL("add_to_cart")})},clearCart:function(){var t={security:wc_stripe_payment_request_params.nonce.clear_cart};return i.ajax({type:"POST",data:t,url:u.getAjaxURL("clear_cart"),success:function(t){}})},getRequestOptionsFromLocal:function(){return{total:wc_stripe_payment_request_params.product.total,currency:wc_stripe_payment_request_params.checkout.currency_code,country:wc_stripe_payment_request_params.checkout.country_code,requestPayerName:!0,requestPayerEmail:!0,requestPayerPhone:wc_stripe_payment_request_params.checkout.needs_payer_phone,requestShipping:wc_stripe_payment_request_params.product.requestShipping,displayItems:wc_stripe_payment_request_params.product.displayItems}},startPaymentRequest:function(t){var a,e;a=wc_stripe_payment_request_params.is_product_page?e=u.getRequestOptionsFromLocal():(e={total:t.order_data.total,currency:t.order_data.currency,country:t.order_data.country_code,requestPayerName:!0,requestPayerEmail:!0,requestPayerPhone:wc_stripe_payment_request_params.checkout.needs_payer_phone,requestShipping:!!t.shipping_required,displayItems:t.order_data.displayItems},t.order_data);var n=p.paymentRequest(e),s=p.elements({locale:wc_stripe_payment_request_params.button.locale}),r=u.createPaymentRequestButton(s,n);n.canMakePayment().then(function(t){t&&(o=t.applePay?"apple_pay":"payment_request_api",u.attachPaymentRequestButtonEventListeners(r,n),u.showPaymentRequestButton(r))}),n.on("shippingaddresschange",function(e){i.when(u.updateShippingOptions(a,e.shippingAddress)).then(function(t){e.updateWith({status:t.result,shippingOptions:t.shipping_options,total:t.total,displayItems:t.displayItems})})}),n.on("shippingoptionchange",function(e){i.when(u.updateShippingDetails(a,e.shippingOption)).then(function(t){"success"===t.result&&e.updateWith({status:"success",total:t.total,displayItems:t.displayItems}),"fail"===t.result&&e.updateWith({status:"fail"})})}),n.on("source",function(e){"no"===wc_stripe_payment_request_params.stripe.allow_prepaid_card&&"prepaid"===e.source.card.funding?u.abortPayment(e,u.getErrorMessageHTML(wc_stripe_payment_request_params.i18n.no_prepaid_card)):i.when(u.processSource(e,o)).then(function(t){"success"===t.result?u.completePayment(e,t.redirect):u.abortPayment(e,t.messages)})})},getSelectedProductData:function(){var t=i(".single_add_to_cart_button").val();i(".single_variation_wrap").length&&(t=i(".single_variation_wrap").find('input[name="product_id"]').val());var e=(i("#product-addons-total").data("price_data")||[]).reduce(function(t,e){return t+e.cost},0),a={security:wc_stripe_payment_request_params.nonce.get_selected_product_data,product_id:t,qty:i(".quantity .qty").val(),attributes:i(".variations_form").length?u.getAttributes().data:[],addon_value:e};return i.ajax({type:"POST",data:a,url:u.getAjaxURL("get_selected_product_data")})},debounce:function(n,s,r){var i;return function(){var t=this,e=arguments,a=r&&!i;clearTimeout(i),i=setTimeout(function(){i=null,r||s.apply(t,e)},n),a&&s.apply(t,e)}},createPaymentRequestButton:function(t,e){var a;if(wc_stripe_payment_request_params.button.is_custom&&(a=i(wc_stripe_payment_request_params.button.css_selector)).length)return a.data("isCustom",!0),a;if(wc_stripe_payment_request_params.button.is_branded){if(u.shouldUseGooglePayBrand())return(a=u.createGooglePayButton()).data("isBranded",!0),a;wc_stripe_payment_request_params.button.type="long"===wc_stripe_payment_request_params.button.branded_type?"buy":"default"}return t.create("paymentRequestButton",{paymentRequest:e,style:{paymentRequestButton:{type:wc_stripe_payment_request_params.button.type,theme:wc_stripe_payment_request_params.button.theme,height:wc_stripe_payment_request_params.button.height+"px"}}})},isCustomPaymentRequestButton:function(t){return t&&"function"==typeof t.data&&t.data("isCustom")},isBrandedPaymentRequestButton:function(t){return t&&"function"==typeof t.data&&t.data("isBranded")},shouldUseGooglePayBrand:function(){var t=window.navigator.userAgent.toLowerCase(),e=/chrome/.test(t)&&!/edge|edg|opr|brave\//.test(t)&&"Google Inc."===window.navigator.vendor,a=e&&window.navigator.brave;return e&&!a},createGooglePayButton:function(){var t=wc_stripe_payment_request_params.button.theme,e=wc_stripe_payment_request_params.button.branded_type,a=wc_stripe_payment_request_params.button.locale,n=wc_stripe_payment_request_params.button.height;t=["dark","light"].includes(t)?t:"light",e=["short","long"].includes(e)?e:"long";var s=i('<button type="button" id="wc-stripe-branded-button" aria-label="Google Pay" class="gpay-button"></button>');s.css("height",n+"px"),s.addClass(t+" "+e),"long"===e&&function(t,e,a){t.css("background-image","url("+e+")");var n=document.createElement("img");n.onerror=function(){t.css("background-image","url("+a+")")},n.src=e}(s,"https://www.gstatic.com/instantbuy/svg/"+t+"/"+a+".svg","https://www.gstatic.com/instantbuy/svg/"+t+"/en.svg");return s},attachPaymentRequestButtonEventListeners:function(t,e){t.on("click",function(t){i("body").addClass("woocommerce-stripe-prb-clicked")}),wc_stripe_payment_request_params.is_product_page?u.attachProductPageEventListeners(t,e):u.attachCartPageEventListeners(t,e)},attachProductPageEventListeners:function(e,a){var n=[],s=i(".single_add_to_cart_button");e.on("click",function(t){return s.is(".disabled")?(t.preventDefault(),void(s.is(".wc-variation-is-unavailable")?window.alert(wc_add_to_cart_variation_params.i18n_unavailable_text):s.is(".wc-variation-selection-needed")&&window.alert(wc_add_to_cart_variation_params.i18n_make_a_selection_text))):0<n.length?(t.preventDefault(),void window.alert(n)):(u.addToCart(),void((u.isCustomPaymentRequestButton(e)||u.isBrandedPaymentRequestButton(e))&&(t.preventDefault(),a.show())))}),i(document.body).on("woocommerce_variation_has_changed",function(){u.blockPaymentRequestButton(e),i.when(u.getSelectedProductData()).then(function(t){i.when(a.update({total:t.total,displayItems:t.displayItems})).then(function(){u.unblockPaymentRequestButton(e)})})}),i(".quantity").on("input",".qty",function(){u.blockPaymentRequestButton(e)}),i(".quantity").on("input",".qty",u.debounce(250,function(){u.blockPaymentRequestButton(e),n=[],i.when(u.getSelectedProductData()).then(function(t){t.error?(n=[t.error],u.unblockPaymentRequestButton(e)):i.when(a.update({total:t.total,displayItems:t.displayItems})).then(function(){u.unblockPaymentRequestButton(e)})})}))},attachCartPageEventListeners:function(t,e){(wc_stripe_payment_request_params.button.is_custom&&u.isCustomPaymentRequestButton(t)||wc_stripe_payment_request_params.button.is_branded&&u.isBrandedPaymentRequestButton(t))&&t.on("click",function(t){t.preventDefault(),e.show()})},showPaymentRequestButton:function(t){u.isCustomPaymentRequestButton(t)?(t.addClass("is-active"),i("#wc-stripe-payment-request-wrapper, #wc-stripe-payment-request-button-separator").show()):u.isBrandedPaymentRequestButton(t)?(i("#wc-stripe-payment-request-wrapper, #wc-stripe-payment-request-button-separator").show(),i("#wc-stripe-payment-request-button").html(t)):i("#wc-stripe-payment-request-button").length&&(i("#wc-stripe-payment-request-wrapper, #wc-stripe-payment-request-button-separator").show(),t.mount("#wc-stripe-payment-request-button"))},blockPaymentRequestButton:function(t){i("#wc-stripe-payment-request-button").data("blockUI.isBlocked")||(i("#wc-stripe-payment-request-button").block({message:null}),u.isCustomPaymentRequestButton(t)&&t.addClass("is-blocked"))},unblockPaymentRequestButton:function(t){i("#wc-stripe-payment-request-button").unblock(),u.isCustomPaymentRequestButton(t)&&t.removeClass("is-blocked")},init:function(){wc_stripe_payment_request_params.is_product_page?u.startPaymentRequest(""):u.getCartDetails()}};u.init(),i(document.body).on("updated_cart_totals",function(){u.init()}),i(document.body).on("updated_checkout",function(){u.init()})});
|
1 |
+
jQuery(function(i){"use strict";var o,u=Stripe(wc_stripe_payment_request_params.stripe.key),p={getAjaxURL:function(t){return wc_stripe_payment_request_params.ajax_url.toString().replace("%%endpoint%%","wc_stripe_"+t)},getCartDetails:function(){var t={security:wc_stripe_payment_request_params.nonce.payment};i.ajax({type:"POST",data:t,url:p.getAjaxURL("get_cart_details"),success:function(t){p.startPaymentRequest(t)}})},getAttributes:function(){var t=i(".variations_form").find(".variations select"),a={},n=0,r=0;return t.each(function(){var t=i(this).data("attribute_name")||i(this).attr("name"),e=i(this).val()||"";0<e.length&&r++,n++,a[t]=e}),{count:n,chosenCount:r,data:a}},processSource:function(t,e){var a=p.getOrderData(t,e);return i.ajax({type:"POST",data:a,dataType:"json",url:p.getAjaxURL("create_order")})},getOrderData:function(t,e){var a=t.source,n=a.owner.email,r=a.owner.phone,s=a.owner.address,i=a.owner.name,o=t.shippingAddress,u={_wpnonce:wc_stripe_payment_request_params.nonce.checkout,billing_first_name:null!==i?i.split(" ").slice(0,1).join(" "):"",billing_last_name:null!==i?i.split(" ").slice(1).join(" "):"",billing_company:"",billing_email:null!==n?n:t.payerEmail,billing_phone:null!==r?r:t.payerPhone&&t.payerPhone.replace("/[() -]/g",""),billing_country:null!==s?s.country:"",billing_address_1:null!==s?s.line1:"",billing_address_2:null!==s?s.line2:"",billing_city:null!==s?s.city:"",billing_state:null!==s?s.state:"",billing_postcode:null!==s?s.postal_code:"",shipping_first_name:"",shipping_last_name:"",shipping_company:"",shipping_country:"",shipping_address_1:"",shipping_address_2:"",shipping_city:"",shipping_state:"",shipping_postcode:"",shipping_method:[null===t.shippingOption?null:t.shippingOption.id],order_comments:"",payment_method:"stripe",ship_to_different_address:1,terms:1,stripe_source:a.id,payment_request_type:e};return o&&(u.shipping_first_name=o.recipient.split(" ").slice(0,1).join(" "),u.shipping_last_name=o.recipient.split(" ").slice(1).join(" "),u.shipping_company=o.organization,u.shipping_country=o.country,u.shipping_address_1=void 0===o.addressLine[0]?"":o.addressLine[0],u.shipping_address_2=void 0===o.addressLine[1]?"":o.addressLine[1],u.shipping_city=o.city,u.shipping_state=o.region,u.shipping_postcode=o.postalCode),u},getErrorMessageHTML:function(t){return i('<div class="woocommerce-error" />').text(t)},displayErrorMessage:function(t){if(i(".woocommerce-error").remove(),wc_stripe_payment_request_params.is_product_page){var e=i(".product").first();e.before(t),i("html, body").animate({scrollTop:e.prev(".woocommerce-error").offset().top},600)}else{var a=i(".shop_table.cart").closest("form");a.before(t),i("html, body").animate({scrollTop:a.prev(".woocommerce-error").offset().top},600)}},abortPayment:function(t,e){t.complete("fail"),p.displayErrorMessage(e)},completePayment:function(t,e){p.block(),t.complete("success"),window.location=e},block:function(){i.blockUI({message:null,overlayCSS:{background:"#fff",opacity:.6}})},updateShippingOptions:function(t,e){var a={security:wc_stripe_payment_request_params.nonce.shipping,country:e.country,state:e.region,postcode:e.postalCode,city:e.city,address:void 0===e.addressLine[0]?"":e.addressLine[0],address_2:void 0===e.addressLine[1]?"":e.addressLine[1],payment_request_type:o,is_product_page:wc_stripe_payment_request_params.is_product_page};return i.ajax({type:"POST",data:a,url:p.getAjaxURL("get_shipping_options")})},updateShippingDetails:function(t,e){var a={security:wc_stripe_payment_request_params.nonce.update_shipping,shipping_method:[e.id],payment_request_type:o,is_product_page:wc_stripe_payment_request_params.is_product_page};return i.ajax({type:"POST",data:a,url:p.getAjaxURL("update_shipping_method")})},addToCart:function(){var t=i(".single_add_to_cart_button").val();i(".single_variation_wrap").length&&(t=i(".single_variation_wrap").find('input[name="product_id"]').val());var n={security:wc_stripe_payment_request_params.nonce.add_to_cart,product_id:t,qty:i(".quantity .qty").val(),attributes:i(".variations_form").length?p.getAttributes().data:[]},e=i("form.cart").serializeArray();return i.each(e,function(t,e){if(/^addon-/.test(e.name))if(/\[\]$/.test(e.name)){var a=e.name.substring(0,e.name.length-2);n[a]?n[a].push(e.value):n[a]=[e.value]}else n[e.name]=e.value}),i.ajax({type:"POST",data:n,url:p.getAjaxURL("add_to_cart")})},clearCart:function(){var t={security:wc_stripe_payment_request_params.nonce.clear_cart};return i.ajax({type:"POST",data:t,url:p.getAjaxURL("clear_cart"),success:function(t){}})},getRequestOptionsFromLocal:function(){return{total:wc_stripe_payment_request_params.product.total,currency:wc_stripe_payment_request_params.checkout.currency_code,country:wc_stripe_payment_request_params.checkout.country_code,requestPayerName:!0,requestPayerEmail:!0,requestPayerPhone:wc_stripe_payment_request_params.checkout.needs_payer_phone,requestShipping:wc_stripe_payment_request_params.product.requestShipping,displayItems:wc_stripe_payment_request_params.product.displayItems}},startPaymentRequest:function(t){var a,e;a=wc_stripe_payment_request_params.is_product_page?e=p.getRequestOptionsFromLocal():(e={total:t.order_data.total,currency:t.order_data.currency,country:t.order_data.country_code,requestPayerName:!0,requestPayerEmail:!0,requestPayerPhone:wc_stripe_payment_request_params.checkout.needs_payer_phone,requestShipping:!!t.shipping_required,displayItems:t.order_data.displayItems},t.order_data),"PR"===e.country&&(e.country="US");try{var n=u.paymentRequest(e),r=u.elements({locale:wc_stripe_payment_request_params.button.locale}),s=p.createPaymentRequestButton(r,n);n.canMakePayment().then(function(t){t&&(o=t.applePay?"apple_pay":"payment_request_api",p.attachPaymentRequestButtonEventListeners(s,n),p.showPaymentRequestButton(s))}),n.on("shippingaddresschange",function(e){i.when(p.updateShippingOptions(a,e.shippingAddress)).then(function(t){e.updateWith({status:t.result,shippingOptions:t.shipping_options,total:t.total,displayItems:t.displayItems})})}),n.on("shippingoptionchange",function(e){i.when(p.updateShippingDetails(a,e.shippingOption)).then(function(t){"success"===t.result&&e.updateWith({status:"success",total:t.total,displayItems:t.displayItems}),"fail"===t.result&&e.updateWith({status:"fail"})})}),n.on("source",function(e){"no"===wc_stripe_payment_request_params.stripe.allow_prepaid_card&&"prepaid"===e.source.card.funding?p.abortPayment(e,p.getErrorMessageHTML(wc_stripe_payment_request_params.i18n.no_prepaid_card)):i.when(p.processSource(e,o)).then(function(t){"success"===t.result?p.completePayment(e,t.redirect):p.abortPayment(e,t.messages)})})}catch(t){console.error(t)}},getSelectedProductData:function(){var t=i(".single_add_to_cart_button").val();i(".single_variation_wrap").length&&(t=i(".single_variation_wrap").find('input[name="product_id"]').val());var e=(i("#product-addons-total").data("price_data")||[]).reduce(function(t,e){return t+e.cost},0),a={security:wc_stripe_payment_request_params.nonce.get_selected_product_data,product_id:t,qty:i(".quantity .qty").val(),attributes:i(".variations_form").length?p.getAttributes().data:[],addon_value:e};return i.ajax({type:"POST",data:a,url:p.getAjaxURL("get_selected_product_data")})},debounce:function(n,r,s){var i;return function(){var t=this,e=arguments,a=s&&!i;clearTimeout(i),i=setTimeout(function(){i=null,s||r.apply(t,e)},n),a&&r.apply(t,e)}},createPaymentRequestButton:function(t,e){var a;if(wc_stripe_payment_request_params.button.is_custom&&(a=i(wc_stripe_payment_request_params.button.css_selector)).length)return a.data("isCustom",!0),a;if(wc_stripe_payment_request_params.button.is_branded){if(p.shouldUseGooglePayBrand())return(a=p.createGooglePayButton()).data("isBranded",!0),a;wc_stripe_payment_request_params.button.type="long"===wc_stripe_payment_request_params.button.branded_type?"buy":"default"}return t.create("paymentRequestButton",{paymentRequest:e,style:{paymentRequestButton:{type:wc_stripe_payment_request_params.button.type,theme:wc_stripe_payment_request_params.button.theme,height:wc_stripe_payment_request_params.button.height+"px"}}})},isCustomPaymentRequestButton:function(t){return t&&"function"==typeof t.data&&t.data("isCustom")},isBrandedPaymentRequestButton:function(t){return t&&"function"==typeof t.data&&t.data("isBranded")},shouldUseGooglePayBrand:function(){var t=window.navigator.userAgent.toLowerCase(),e=/chrome/.test(t)&&!/edge|edg|opr|brave\//.test(t)&&"Google Inc."===window.navigator.vendor,a=e&&window.navigator.brave;return e&&!a},createGooglePayButton:function(){var t=wc_stripe_payment_request_params.button.theme,e=wc_stripe_payment_request_params.button.branded_type,a=wc_stripe_payment_request_params.button.locale,n=wc_stripe_payment_request_params.button.height;t=["dark","light"].includes(t)?t:"light",e=["short","long"].includes(e)?e:"long";var r=i('<button type="button" id="wc-stripe-branded-button" aria-label="Google Pay" class="gpay-button"></button>');r.css("height",n+"px"),r.addClass(t+" "+e),"long"===e&&function(t,e,a){t.css("background-image","url("+e+")");var n=document.createElement("img");n.onerror=function(){t.css("background-image","url("+a+")")},n.src=e}(r,"https://www.gstatic.com/instantbuy/svg/"+t+"/"+a+".svg","https://www.gstatic.com/instantbuy/svg/"+t+"/en.svg");return r},attachPaymentRequestButtonEventListeners:function(t,e){t.on("click",function(t){i("body").addClass("woocommerce-stripe-prb-clicked")}),wc_stripe_payment_request_params.is_product_page?p.attachProductPageEventListeners(t,e):p.attachCartPageEventListeners(t,e)},attachProductPageEventListeners:function(e,a){var n=[],r=i(".single_add_to_cart_button");e.on("click",function(t){return r.is(".disabled")?(t.preventDefault(),void(r.is(".wc-variation-is-unavailable")?window.alert(wc_add_to_cart_variation_params.i18n_unavailable_text):r.is(".wc-variation-selection-needed")&&window.alert(wc_add_to_cart_variation_params.i18n_make_a_selection_text))):0<n.length?(t.preventDefault(),void window.alert(n)):(p.addToCart(),void((p.isCustomPaymentRequestButton(e)||p.isBrandedPaymentRequestButton(e))&&(t.preventDefault(),a.show())))}),i(document.body).on("woocommerce_variation_has_changed",function(){p.blockPaymentRequestButton(e),i.when(p.getSelectedProductData()).then(function(t){i.when(a.update({total:t.total,displayItems:t.displayItems})).then(function(){p.unblockPaymentRequestButton(e)})})}),i(".quantity").on("input",".qty",function(){p.blockPaymentRequestButton(e)}),i(".quantity").on("input",".qty",p.debounce(250,function(){p.blockPaymentRequestButton(e),n=[],i.when(p.getSelectedProductData()).then(function(t){t.error?(n=[t.error],p.unblockPaymentRequestButton(e)):i.when(a.update({total:t.total,displayItems:t.displayItems})).then(function(){p.unblockPaymentRequestButton(e)})})}))},attachCartPageEventListeners:function(t,e){(wc_stripe_payment_request_params.button.is_custom&&p.isCustomPaymentRequestButton(t)||wc_stripe_payment_request_params.button.is_branded&&p.isBrandedPaymentRequestButton(t))&&t.on("click",function(t){t.preventDefault(),e.show()})},showPaymentRequestButton:function(t){p.isCustomPaymentRequestButton(t)?(t.addClass("is-active"),i("#wc-stripe-payment-request-wrapper, #wc-stripe-payment-request-button-separator").show()):p.isBrandedPaymentRequestButton(t)?(i("#wc-stripe-payment-request-wrapper, #wc-stripe-payment-request-button-separator").show(),i("#wc-stripe-payment-request-button").html(t)):i("#wc-stripe-payment-request-button").length&&(i("#wc-stripe-payment-request-wrapper, #wc-stripe-payment-request-button-separator").show(),t.mount("#wc-stripe-payment-request-button"))},blockPaymentRequestButton:function(t){i("#wc-stripe-payment-request-button").data("blockUI.isBlocked")||(i("#wc-stripe-payment-request-button").block({message:null}),p.isCustomPaymentRequestButton(t)&&t.addClass("is-blocked"))},unblockPaymentRequestButton:function(t){i("#wc-stripe-payment-request-button").unblock(),p.isCustomPaymentRequestButton(t)&&t.removeClass("is-blocked")},init:function(){wc_stripe_payment_request_params.is_product_page?p.startPaymentRequest(""):p.getCartDetails()}};p.init(),i(document.body).on("updated_cart_totals",function(){p.init()}),i(document.body).on("updated_checkout",function(){p.init()})});
|
changelog.txt
CHANGED
@@ -1,5 +1,12 @@
|
|
1 |
*** Changelog ***
|
2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
= 4.7.0 - 2020-12-22 =
|
4 |
* Fix - Updating subscription payment methods from the "My Account" page now adds a note to the subscription.
|
5 |
* Fix - Link is now correctly formatted in readme.txt.
|
1 |
*** Changelog ***
|
2 |
|
3 |
+
= 4.8.0 - 2021-01-28 =
|
4 |
+
* Fix - Filter more disallowed characters from statement descriptors.
|
5 |
+
* Fix - Payment request button for Puerto Rico.
|
6 |
+
* Fix - Handle error if country is not supported for payment request button.
|
7 |
+
* Fix - Trim the refund reason to a max of 500 characters.
|
8 |
+
* Tweak - Display warning on webhook secret when server time is off from device time.
|
9 |
+
|
10 |
= 4.7.0 - 2020-12-22 =
|
11 |
* Fix - Updating subscription payment methods from the "My Account" page now adds a note to the subscription.
|
12 |
* Fix - Link is now correctly formatted in readme.txt.
|
includes/abstracts/abstract-wc-stripe-payment-gateway.php
CHANGED
@@ -819,7 +819,7 @@ abstract class WC_Stripe_Payment_Gateway extends WC_Payment_Gateway_CC {
|
|
819 |
* Refund a charge.
|
820 |
*
|
821 |
* @since 3.1.0
|
822 |
-
* @version 4.
|
823 |
* @param int $order_id
|
824 |
* @param float $amount
|
825 |
* @return bool
|
@@ -851,6 +851,13 @@ abstract class WC_Stripe_Payment_Gateway extends WC_Payment_Gateway_CC {
|
|
851 |
}
|
852 |
|
853 |
if ( $reason ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
854 |
$request['metadata'] = array(
|
855 |
'reason' => $reason,
|
856 |
);
|
819 |
* Refund a charge.
|
820 |
*
|
821 |
* @since 3.1.0
|
822 |
+
* @version 4.8.0
|
823 |
* @param int $order_id
|
824 |
* @param float $amount
|
825 |
* @return bool
|
851 |
}
|
852 |
|
853 |
if ( $reason ) {
|
854 |
+
// Trim the refund reason to a max of 500 characters due to Stripe limits: https://stripe.com/docs/api/metadata.
|
855 |
+
if ( strlen( $reason ) > 500 ) {
|
856 |
+
$reason = function_exists( 'mb_substr' ) ? mb_substr( $reason, 0, 450 ) : substr( $reason, 0, 450 );
|
857 |
+
// Add some explainer text indicating where to find the full refund reason.
|
858 |
+
$reason = $reason . '... [See WooCommerce order page for full text.]';
|
859 |
+
}
|
860 |
+
|
861 |
$request['metadata'] = array(
|
862 |
'reason' => $reason,
|
863 |
);
|
includes/admin/stripe-settings.php
CHANGED
@@ -130,7 +130,7 @@ return apply_filters(
|
|
130 |
'statement_descriptor' => array(
|
131 |
'title' => __( 'Statement Descriptor', 'woocommerce-gateway-stripe' ),
|
132 |
'type' => 'text',
|
133 |
-
'description' => __( 'Statement descriptors are limited to 22 characters, cannot use the special characters >, <, ", \, \', *, and must not consist solely of numbers. This will appear on your customer\'s statement in capital letters.', 'woocommerce-gateway-stripe' ),
|
134 |
'default' => '',
|
135 |
'desc_tip' => true,
|
136 |
),
|
130 |
'statement_descriptor' => array(
|
131 |
'title' => __( 'Statement Descriptor', 'woocommerce-gateway-stripe' ),
|
132 |
'type' => 'text',
|
133 |
+
'description' => __( 'Statement descriptors are limited to 22 characters, cannot use the special characters >, <, ", \, \', *, /, (, ), {, }, and must not consist solely of numbers. This will appear on your customer\'s statement in capital letters.', 'woocommerce-gateway-stripe' ),
|
134 |
'default' => '',
|
135 |
'desc_tip' => true,
|
136 |
),
|
includes/class-wc-gateway-stripe.php
CHANGED
@@ -140,6 +140,7 @@ class WC_Gateway_Stripe extends WC_Stripe_Payment_Gateway {
|
|
140 |
add_filter( 'woocommerce_payment_successful_result', array( $this, 'modify_successful_payment_result' ), 99999, 2 );
|
141 |
add_action( 'set_logged_in_cookie', array( $this, 'set_cookie_on_current_request' ) );
|
142 |
add_filter( 'woocommerce_get_checkout_payment_url', array( $this, 'get_checkout_payment_url' ), 10, 2 );
|
|
|
143 |
|
144 |
// Note: display error is in the parent class.
|
145 |
add_action( 'admin_notices', array( $this, 'display_errors' ), 9999 );
|
@@ -350,7 +351,18 @@ class WC_Gateway_Stripe extends WC_Stripe_Payment_Gateway {
|
|
350 |
|
351 |
$suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
|
352 |
|
353 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
354 |
}
|
355 |
|
356 |
/**
|
@@ -1202,4 +1214,20 @@ class WC_Gateway_Stripe extends WC_Stripe_Payment_Gateway {
|
|
1202 |
}
|
1203 |
return $value;
|
1204 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1205 |
}
|
140 |
add_filter( 'woocommerce_payment_successful_result', array( $this, 'modify_successful_payment_result' ), 99999, 2 );
|
141 |
add_action( 'set_logged_in_cookie', array( $this, 'set_cookie_on_current_request' ) );
|
142 |
add_filter( 'woocommerce_get_checkout_payment_url', array( $this, 'get_checkout_payment_url' ), 10, 2 );
|
143 |
+
add_filter( 'woocommerce_settings_api_sanitized_fields_' . $this->id, array( $this, 'settings_api_sanitized_fields' ) );
|
144 |
|
145 |
// Note: display error is in the parent class.
|
146 |
add_action( 'admin_notices', array( $this, 'display_errors' ), 9999 );
|
351 |
|
352 |
$suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
|
353 |
|
354 |
+
wp_register_script( 'woocommerce_stripe_admin', plugins_url( 'assets/js/stripe-admin' . $suffix . '.js', WC_STRIPE_MAIN_FILE ), array(), WC_STRIPE_VERSION, true );
|
355 |
+
|
356 |
+
$params = array(
|
357 |
+
'time' => time(),
|
358 |
+
'i18n_out_of_sync' => wp_kses(
|
359 |
+
__( '<strong>Warning:</strong> your site\'s time does not match the time on your browser and may be incorrect. Some payment methods depend on webhook verification and verifying webhooks with a signing secret depends on your site\'s time being correct, so please check your site\'s time before setting a webhook secret. You may need to contact your site\'s hosting provider to correct the site\'s time.', 'woocommerce-gateway-stripe' ),
|
360 |
+
array( 'strong' => array() )
|
361 |
+
),
|
362 |
+
);
|
363 |
+
wp_localize_script( 'woocommerce_stripe_admin', 'wc_stripe_settings_params', $params );
|
364 |
+
|
365 |
+
wp_enqueue_script( 'woocommerce_stripe_admin' );
|
366 |
}
|
367 |
|
368 |
/**
|
1214 |
}
|
1215 |
return $value;
|
1216 |
}
|
1217 |
+
|
1218 |
+
/**
|
1219 |
+
* Ensures the statement descriptor about to be saved to options does not contain any invalid characters.
|
1220 |
+
*
|
1221 |
+
* @since 4.8.0
|
1222 |
+
* @param $settings WC_Settings_API settings to be filtered
|
1223 |
+
* @return Filtered settings
|
1224 |
+
*/
|
1225 |
+
public function settings_api_sanitized_fields( $settings ) {
|
1226 |
+
if ( is_array( $settings ) ) {
|
1227 |
+
if ( array_key_exists( 'statement_descriptor', $settings ) ) {
|
1228 |
+
$settings['statement_descriptor'] = WC_Stripe_Helper::clean_statement_descriptor( $settings['statement_descriptor']);
|
1229 |
+
}
|
1230 |
+
}
|
1231 |
+
return $settings;
|
1232 |
+
}
|
1233 |
}
|
includes/class-wc-stripe-helper.php
CHANGED
@@ -451,19 +451,26 @@ class WC_Stripe_Helper {
|
|
451 |
/**
|
452 |
* Sanitize statement descriptor text.
|
453 |
*
|
454 |
-
* Stripe requires max of 22 characters and no
|
455 |
-
* special characters with ><"'.
|
456 |
*
|
457 |
* @since 4.0.0
|
458 |
* @param string $statement_descriptor
|
459 |
* @return string $statement_descriptor Sanitized statement descriptor
|
460 |
*/
|
461 |
public static function clean_statement_descriptor( $statement_descriptor = '' ) {
|
462 |
-
$disallowed_characters = array( '<', '>', '"', "'" );
|
463 |
|
464 |
-
//
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
465 |
$statement_descriptor = str_replace( $disallowed_characters, '', $statement_descriptor );
|
466 |
|
|
|
467 |
$statement_descriptor = substr( trim( $statement_descriptor ), 0, 22 );
|
468 |
|
469 |
return $statement_descriptor;
|
451 |
/**
|
452 |
* Sanitize statement descriptor text.
|
453 |
*
|
454 |
+
* Stripe requires max of 22 characters and no special characters.
|
|
|
455 |
*
|
456 |
* @since 4.0.0
|
457 |
* @param string $statement_descriptor
|
458 |
* @return string $statement_descriptor Sanitized statement descriptor
|
459 |
*/
|
460 |
public static function clean_statement_descriptor( $statement_descriptor = '' ) {
|
461 |
+
$disallowed_characters = array( '<', '>', '\\', '*', '"', "'", '/', '(', ')', '{', '}' );
|
462 |
|
463 |
+
// Strip any tags.
|
464 |
+
$statement_descriptor = strip_tags( $statement_descriptor );
|
465 |
+
|
466 |
+
// Strip any HTML entities.
|
467 |
+
// Props https://stackoverflow.com/questions/657643/how-to-remove-html-special-chars .
|
468 |
+
$statement_descriptor = preg_replace( "/&#?[a-z0-9]{2,8};/i", "", $statement_descriptor );
|
469 |
+
|
470 |
+
// Next, remove any remaining disallowed characters.
|
471 |
$statement_descriptor = str_replace( $disallowed_characters, '', $statement_descriptor );
|
472 |
|
473 |
+
// Trim any whitespace at the ends and limit to 22 characters.
|
474 |
$statement_descriptor = substr( trim( $statement_descriptor ), 0, 22 );
|
475 |
|
476 |
return $statement_descriptor;
|
includes/class-wc-stripe-webhook-handler.php
CHANGED
@@ -104,7 +104,7 @@ class WC_Stripe_Webhook_Handler extends WC_Stripe_Payment_Gateway {
|
|
104 |
// Verify the timestamp.
|
105 |
$timestamp = intval( $matches['timestamp'] );
|
106 |
if ( abs( $timestamp - time() ) > 5 * MINUTE_IN_SECONDS ) {
|
107 |
-
return;
|
108 |
}
|
109 |
|
110 |
// Generate the expected signature.
|
104 |
// Verify the timestamp.
|
105 |
$timestamp = intval( $matches['timestamp'] );
|
106 |
if ( abs( $timestamp - time() ) > 5 * MINUTE_IN_SECONDS ) {
|
107 |
+
return false;
|
108 |
}
|
109 |
|
110 |
// Generate the expected signature.
|
languages/woocommerce-gateway-stripe.pot
CHANGED
@@ -1,15 +1,15 @@
|
|
1 |
-
# Copyright (C)
|
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.
|
6 |
"Report-Msgid-Bugs-To: "
|
7 |
"https://wordpress.org/support/plugin/woocommerce-gateway-stripe\n"
|
8 |
-
"POT-Creation-Date:
|
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:
|
13 |
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
14 |
"Language-Team: LANGUAGE <LL@li.org>\n"
|
15 |
"X-Generator: node-wp-i18n 1.2.3\n"
|
@@ -63,7 +63,7 @@ msgid "Stripe charge complete (Charge ID: %s)"
|
|
63 |
msgstr ""
|
64 |
|
65 |
#: includes/abstracts/abstract-wc-stripe-payment-gateway.php:455
|
66 |
-
#: includes/class-wc-gateway-stripe.php:
|
67 |
#: includes/compat/class-wc-stripe-sepa-subs-compat.php:185
|
68 |
msgid "Payment processing failed. Please retry."
|
69 |
msgstr ""
|
@@ -79,16 +79,16 @@ msgstr ""
|
|
79 |
msgid "Invalid payment method. Please input a new card number."
|
80 |
msgstr ""
|
81 |
|
82 |
-
#: includes/abstracts/abstract-wc-stripe-payment-gateway.php:
|
83 |
#. translators: 1) dollar amount 2) transaction id 3) refund message
|
84 |
msgid "Refunded %1$s - Refund ID: %2$s - Reason: %3$s"
|
85 |
msgstr ""
|
86 |
|
87 |
-
#: includes/abstracts/abstract-wc-stripe-payment-gateway.php:
|
88 |
msgid "Pre-Authorization Released"
|
89 |
msgstr ""
|
90 |
|
91 |
-
#: includes/abstracts/abstract-wc-stripe-payment-gateway.php:
|
92 |
msgid "There was a problem adding the payment method."
|
93 |
msgstr ""
|
94 |
|
@@ -693,8 +693,9 @@ msgstr ""
|
|
693 |
#: includes/admin/stripe-settings.php:133
|
694 |
msgid ""
|
695 |
"Statement descriptors are limited to 22 characters, cannot use the special "
|
696 |
-
"characters >, <, \", \\, ', *, and must not consist solely
|
697 |
-
"will appear on your customer's statement in capital
|
|
|
698 |
msgstr ""
|
699 |
|
700 |
#: includes/admin/stripe-settings.php:138
|
@@ -893,14 +894,14 @@ msgid ""
|
|
893 |
"details to Stripe for verification."
|
894 |
msgstr ""
|
895 |
|
896 |
-
#: includes/class-wc-gateway-stripe.php:
|
897 |
#. translators: 1) Opening anchor tag 2) closing anchor tag
|
898 |
msgid ""
|
899 |
"If your billing address has been changed for saved payment methods, be sure "
|
900 |
"to remove any %1$ssaved payment methods%2$s on file and re-add them."
|
901 |
msgstr ""
|
902 |
|
903 |
-
#: includes/class-wc-gateway-stripe.php:
|
904 |
#. translators: link to Stripe testing page
|
905 |
msgid ""
|
906 |
"TEST MODE ENABLED. In test mode, you can use the card number "
|
@@ -909,73 +910,83 @@ msgid ""
|
|
909 |
"card numbers."
|
910 |
msgstr ""
|
911 |
|
912 |
-
#: includes/class-wc-gateway-stripe.php:
|
913 |
msgid "Credit or debit card"
|
914 |
msgstr ""
|
915 |
|
916 |
-
#: includes/class-wc-gateway-stripe.php:
|
917 |
msgid "Card Number"
|
918 |
msgstr ""
|
919 |
|
920 |
-
#: includes/class-wc-gateway-stripe.php:
|
921 |
msgid "Expiry Date"
|
922 |
msgstr ""
|
923 |
|
924 |
-
#: includes/class-wc-gateway-stripe.php:
|
925 |
msgid "Card Code (CVC)"
|
926 |
msgstr ""
|
927 |
|
928 |
-
#: includes/class-wc-gateway-stripe.php:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
929 |
msgid "Please accept the terms and conditions first"
|
930 |
msgstr ""
|
931 |
|
932 |
-
#: includes/class-wc-gateway-stripe.php:
|
933 |
msgid "Please fill in required checkout fields first"
|
934 |
msgstr ""
|
935 |
|
936 |
-
#: includes/class-wc-gateway-stripe.php:
|
937 |
-
#: includes/class-wc-gateway-stripe.php:
|
938 |
msgid ""
|
939 |
"Sorry, we're not accepting prepaid cards at this time. Your credit card has "
|
940 |
"not been charged. Please try with alternative payment method."
|
941 |
msgstr ""
|
942 |
|
943 |
-
#: includes/class-wc-gateway-stripe.php:
|
944 |
msgid "Please enter your IBAN account name."
|
945 |
msgstr ""
|
946 |
|
947 |
-
#: includes/class-wc-gateway-stripe.php:
|
948 |
msgid "Please enter your IBAN account number."
|
949 |
msgstr ""
|
950 |
|
951 |
-
#: includes/class-wc-gateway-stripe.php:
|
952 |
msgid "We couldn't initiate the payment. Please try again."
|
953 |
msgstr ""
|
954 |
|
955 |
-
#: includes/class-wc-gateway-stripe.php:
|
956 |
msgid "Billing First Name and Last Name are required."
|
957 |
msgstr ""
|
958 |
|
959 |
-
#: includes/class-wc-gateway-stripe.php:
|
960 |
#. translators: error message
|
961 |
msgid "This represents the fee Stripe collects for the transaction."
|
962 |
msgstr ""
|
963 |
|
964 |
-
#: includes/class-wc-gateway-stripe.php:
|
965 |
msgid "Stripe Fee:"
|
966 |
msgstr ""
|
967 |
|
968 |
-
#: includes/class-wc-gateway-stripe.php:
|
969 |
msgid ""
|
970 |
"This represents the net total that will be credited to your Stripe bank "
|
971 |
"account. This may be in the currency that is set in your Stripe account."
|
972 |
msgstr ""
|
973 |
|
974 |
-
#: includes/class-wc-gateway-stripe.php:
|
975 |
msgid "Stripe Payout:"
|
976 |
msgstr ""
|
977 |
|
978 |
-
#: includes/class-wc-gateway-stripe.php:
|
979 |
#: includes/class-wc-stripe-order-handler.php:158
|
980 |
#: includes/class-wc-stripe-webhook-handler.php:233
|
981 |
#: includes/compat/class-wc-stripe-sepa-subs-compat.php:284
|
@@ -986,7 +997,7 @@ msgid ""
|
|
986 |
"later."
|
987 |
msgstr ""
|
988 |
|
989 |
-
#: includes/class-wc-gateway-stripe.php:
|
990 |
msgid ""
|
991 |
"Almost there!\n"
|
992 |
"\n"
|
@@ -994,36 +1005,36 @@ msgid ""
|
|
994 |
"done is for you to authorize the payment with your bank."
|
995 |
msgstr ""
|
996 |
|
997 |
-
#: includes/class-wc-gateway-stripe.php:
|
998 |
#: includes/class-wc-stripe-webhook-handler.php:674
|
999 |
#: includes/class-wc-stripe-webhook-handler.php:713
|
1000 |
#. translators: 1) The error message that was received from Stripe.
|
1001 |
msgid "Stripe SCA authentication failed. Reason: %s"
|
1002 |
msgstr ""
|
1003 |
|
1004 |
-
#: includes/class-wc-gateway-stripe.php:
|
1005 |
msgid "Stripe SCA authentication failed."
|
1006 |
msgstr ""
|
1007 |
|
1008 |
-
#: includes/class-wc-gateway-stripe.php:
|
1009 |
msgid ""
|
1010 |
"The \"Live Publishable Key\" should start with \"pk_live\", enter the "
|
1011 |
"correct key."
|
1012 |
msgstr ""
|
1013 |
|
1014 |
-
#: includes/class-wc-gateway-stripe.php:
|
1015 |
msgid ""
|
1016 |
"The \"Live Secret Key\" should start with \"sk_live\" or \"rk_live\", enter "
|
1017 |
"the correct key."
|
1018 |
msgstr ""
|
1019 |
|
1020 |
-
#: includes/class-wc-gateway-stripe.php:
|
1021 |
msgid ""
|
1022 |
"The \"Test Publishable Key\" should start with \"pk_test\", enter the "
|
1023 |
"correct key."
|
1024 |
msgstr ""
|
1025 |
|
1026 |
-
#: includes/class-wc-gateway-stripe.php:
|
1027 |
msgid ""
|
1028 |
"The \"Test Secret Key\" should start with \"sk_test\" or \"rk_test\", enter "
|
1029 |
"the correct key."
|
1 |
+
# Copyright (C) 2021 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.8.0\n"
|
6 |
"Report-Msgid-Bugs-To: "
|
7 |
"https://wordpress.org/support/plugin/woocommerce-gateway-stripe\n"
|
8 |
+
"POT-Creation-Date: 2021-01-28 19:54:35+00:00\n"
|
9 |
"MIME-Version: 1.0\n"
|
10 |
"Content-Type: text/plain; charset=utf-8\n"
|
11 |
"Content-Transfer-Encoding: 8bit\n"
|
12 |
+
"PO-Revision-Date: 2021-MO-DA HO:MI+ZONE\n"
|
13 |
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
14 |
"Language-Team: LANGUAGE <LL@li.org>\n"
|
15 |
"X-Generator: node-wp-i18n 1.2.3\n"
|
63 |
msgstr ""
|
64 |
|
65 |
#: includes/abstracts/abstract-wc-stripe-payment-gateway.php:455
|
66 |
+
#: includes/class-wc-gateway-stripe.php:508
|
67 |
#: includes/compat/class-wc-stripe-sepa-subs-compat.php:185
|
68 |
msgid "Payment processing failed. Please retry."
|
69 |
msgstr ""
|
79 |
msgid "Invalid payment method. Please input a new card number."
|
80 |
msgstr ""
|
81 |
|
82 |
+
#: includes/abstracts/abstract-wc-stripe-payment-gateway.php:917
|
83 |
#. translators: 1) dollar amount 2) transaction id 3) refund message
|
84 |
msgid "Refunded %1$s - Refund ID: %2$s - Reason: %3$s"
|
85 |
msgstr ""
|
86 |
|
87 |
+
#: includes/abstracts/abstract-wc-stripe-payment-gateway.php:917
|
88 |
msgid "Pre-Authorization Released"
|
89 |
msgstr ""
|
90 |
|
91 |
+
#: includes/abstracts/abstract-wc-stripe-payment-gateway.php:935
|
92 |
msgid "There was a problem adding the payment method."
|
93 |
msgstr ""
|
94 |
|
693 |
#: includes/admin/stripe-settings.php:133
|
694 |
msgid ""
|
695 |
"Statement descriptors are limited to 22 characters, cannot use the special "
|
696 |
+
"characters >, <, \", \\, ', *, /, (, ), {, }, and must not consist solely "
|
697 |
+
"of numbers. This will appear on your customer's statement in capital "
|
698 |
+
"letters."
|
699 |
msgstr ""
|
700 |
|
701 |
#: includes/admin/stripe-settings.php:138
|
894 |
"details to Stripe for verification."
|
895 |
msgstr ""
|
896 |
|
897 |
+
#: includes/class-wc-gateway-stripe.php:181
|
898 |
#. translators: 1) Opening anchor tag 2) closing anchor tag
|
899 |
msgid ""
|
900 |
"If your billing address has been changed for saved payment methods, be sure "
|
901 |
"to remove any %1$ssaved payment methods%2$s on file and re-add them."
|
902 |
msgstr ""
|
903 |
|
904 |
+
#: includes/class-wc-gateway-stripe.php:258
|
905 |
#. translators: link to Stripe testing page
|
906 |
msgid ""
|
907 |
"TEST MODE ENABLED. In test mode, you can use the card number "
|
910 |
"card numbers."
|
911 |
msgstr ""
|
912 |
|
913 |
+
#: includes/class-wc-gateway-stripe.php:297
|
914 |
msgid "Credit or debit card"
|
915 |
msgstr ""
|
916 |
|
917 |
+
#: includes/class-wc-gateway-stripe.php:305
|
918 |
msgid "Card Number"
|
919 |
msgstr ""
|
920 |
|
921 |
+
#: includes/class-wc-gateway-stripe.php:316
|
922 |
msgid "Expiry Date"
|
923 |
msgstr ""
|
924 |
|
925 |
+
#: includes/class-wc-gateway-stripe.php:324
|
926 |
msgid "Card Code (CVC)"
|
927 |
msgstr ""
|
928 |
|
929 |
+
#: includes/class-wc-gateway-stripe.php:359
|
930 |
+
msgid ""
|
931 |
+
"<strong>Warning:</strong> your site's time does not match the time on your "
|
932 |
+
"browser and may be incorrect. Some payment methods depend on webhook "
|
933 |
+
"verification and verifying webhooks with a signing secret depends on your "
|
934 |
+
"site's time being correct, so please check your site's time before setting "
|
935 |
+
"a webhook secret. You may need to contact your site's hosting provider to "
|
936 |
+
"correct the site's time."
|
937 |
+
msgstr ""
|
938 |
+
|
939 |
+
#: includes/class-wc-gateway-stripe.php:420
|
940 |
msgid "Please accept the terms and conditions first"
|
941 |
msgstr ""
|
942 |
|
943 |
+
#: includes/class-wc-gateway-stripe.php:421
|
944 |
msgid "Please fill in required checkout fields first"
|
945 |
msgstr ""
|
946 |
|
947 |
+
#: includes/class-wc-gateway-stripe.php:450
|
948 |
+
#: includes/class-wc-gateway-stripe.php:495
|
949 |
msgid ""
|
950 |
"Sorry, we're not accepting prepaid cards at this time. Your credit card has "
|
951 |
"not been charged. Please try with alternative payment method."
|
952 |
msgstr ""
|
953 |
|
954 |
+
#: includes/class-wc-gateway-stripe.php:451
|
955 |
msgid "Please enter your IBAN account name."
|
956 |
msgstr ""
|
957 |
|
958 |
+
#: includes/class-wc-gateway-stripe.php:452
|
959 |
msgid "Please enter your IBAN account number."
|
960 |
msgstr ""
|
961 |
|
962 |
+
#: includes/class-wc-gateway-stripe.php:453
|
963 |
msgid "We couldn't initiate the payment. Please try again."
|
964 |
msgstr ""
|
965 |
|
966 |
+
#: includes/class-wc-gateway-stripe.php:464
|
967 |
msgid "Billing First Name and Last Name are required."
|
968 |
msgstr ""
|
969 |
|
970 |
+
#: includes/class-wc-gateway-stripe.php:736
|
971 |
#. translators: error message
|
972 |
msgid "This represents the fee Stripe collects for the transaction."
|
973 |
msgstr ""
|
974 |
|
975 |
+
#: includes/class-wc-gateway-stripe.php:737
|
976 |
msgid "Stripe Fee:"
|
977 |
msgstr ""
|
978 |
|
979 |
+
#: includes/class-wc-gateway-stripe.php:773
|
980 |
msgid ""
|
981 |
"This represents the net total that will be credited to your Stripe bank "
|
982 |
"account. This may be in the currency that is set in your Stripe account."
|
983 |
msgstr ""
|
984 |
|
985 |
+
#: includes/class-wc-gateway-stripe.php:774
|
986 |
msgid "Stripe Payout:"
|
987 |
msgstr ""
|
988 |
|
989 |
+
#: includes/class-wc-gateway-stripe.php:837
|
990 |
#: includes/class-wc-stripe-order-handler.php:158
|
991 |
#: includes/class-wc-stripe-webhook-handler.php:233
|
992 |
#: includes/compat/class-wc-stripe-sepa-subs-compat.php:284
|
997 |
"later."
|
998 |
msgstr ""
|
999 |
|
1000 |
+
#: includes/class-wc-gateway-stripe.php:890
|
1001 |
msgid ""
|
1002 |
"Almost there!\n"
|
1003 |
"\n"
|
1005 |
"done is for you to authorize the payment with your bank."
|
1006 |
msgstr ""
|
1007 |
|
1008 |
+
#: includes/class-wc-gateway-stripe.php:1131
|
1009 |
#: includes/class-wc-stripe-webhook-handler.php:674
|
1010 |
#: includes/class-wc-stripe-webhook-handler.php:713
|
1011 |
#. translators: 1) The error message that was received from Stripe.
|
1012 |
msgid "Stripe SCA authentication failed. Reason: %s"
|
1013 |
msgstr ""
|
1014 |
|
1015 |
+
#: includes/class-wc-gateway-stripe.php:1132
|
1016 |
msgid "Stripe SCA authentication failed."
|
1017 |
msgstr ""
|
1018 |
|
1019 |
+
#: includes/class-wc-gateway-stripe.php:1189
|
1020 |
msgid ""
|
1021 |
"The \"Live Publishable Key\" should start with \"pk_live\", enter the "
|
1022 |
"correct key."
|
1023 |
msgstr ""
|
1024 |
|
1025 |
+
#: includes/class-wc-gateway-stripe.php:1197
|
1026 |
msgid ""
|
1027 |
"The \"Live Secret Key\" should start with \"sk_live\" or \"rk_live\", enter "
|
1028 |
"the correct key."
|
1029 |
msgstr ""
|
1030 |
|
1031 |
+
#: includes/class-wc-gateway-stripe.php:1205
|
1032 |
msgid ""
|
1033 |
"The \"Test Publishable Key\" should start with \"pk_test\", enter the "
|
1034 |
"correct key."
|
1035 |
msgstr ""
|
1036 |
|
1037 |
+
#: includes/class-wc-gateway-stripe.php:1213
|
1038 |
msgid ""
|
1039 |
"The \"Test Secret Key\" should start with \"sk_test\" or \"rk_test\", enter "
|
1040 |
"the correct key."
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Tags: credit card, stripe, apple pay, payment request, google pay, sepa, sofort,
|
|
4 |
Requires at least: 4.4
|
5 |
Tested up to: 5.5
|
6 |
Requires PHP: 5.6
|
7 |
-
Stable tag: 4.
|
8 |
License: GPLv3
|
9 |
License URI: https://www.gnu.org/licenses/gpl-3.0.html
|
10 |
Attributions: thorsten-stripe
|
@@ -126,13 +126,8 @@ If you get stuck, you can ask for help in the Plugin Forum.
|
|
126 |
|
127 |
== Changelog ==
|
128 |
|
129 |
-
= 4.
|
130 |
-
* Fix -
|
131 |
-
* Fix - Link is now correctly formatted in readme.txt.
|
132 |
-
* Fix - Using SCA cards for subscriptions renewal payments now works as intended.
|
133 |
-
* Fix - Cards added under "My Account -> Payment Methods -> Add Payment Method" will now handle SCA properly.
|
134 |
-
* Fix - Changing a payment method for a subscription in "My Account -> Subscriptions" will now handle SCA properly.
|
135 |
-
* Fix - Missing space causing fatal errors for certain WooCommerce Inbox Note features.
|
136 |
|
137 |
-
[See changelog for all versions](https://raw.githubusercontent.com/woocommerce/woocommerce-gateway-stripe/
|
138 |
|
4 |
Requires at least: 4.4
|
5 |
Tested up to: 5.5
|
6 |
Requires PHP: 5.6
|
7 |
+
Stable tag: 4.8.0
|
8 |
License: GPLv3
|
9 |
License URI: https://www.gnu.org/licenses/gpl-3.0.html
|
10 |
Attributions: thorsten-stripe
|
126 |
|
127 |
== Changelog ==
|
128 |
|
129 |
+
= 4.8.0 - 2021-01-28 =
|
130 |
+
* Fix - Filter more disallowed characters from statement descriptors.
|
|
|
|
|
|
|
|
|
|
|
131 |
|
132 |
+
[See changelog for all versions](https://raw.githubusercontent.com/woocommerce/woocommerce-gateway-stripe/trunk/changelog.txt).
|
133 |
|
woocommerce-gateway-stripe.php
CHANGED
@@ -5,11 +5,11 @@
|
|
5 |
* Description: Take credit card payments on your store using Stripe.
|
6 |
* Author: WooCommerce
|
7 |
* Author URI: https://woocommerce.com/
|
8 |
-
* Version: 4.
|
9 |
* Requires at least: 4.4
|
10 |
-
* Tested up to: 5.
|
11 |
* WC requires at least: 3.0
|
12 |
-
* WC tested up to: 4.
|
13 |
* Text Domain: woocommerce-gateway-stripe
|
14 |
* Domain Path: /languages
|
15 |
*
|
@@ -22,10 +22,10 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
22 |
/**
|
23 |
* Required minimums and constants
|
24 |
*/
|
25 |
-
define( 'WC_STRIPE_VERSION', '4.
|
26 |
define( 'WC_STRIPE_MIN_PHP_VER', '5.6.0' );
|
27 |
define( 'WC_STRIPE_MIN_WC_VER', '3.0' );
|
28 |
-
define( 'WC_STRIPE_FUTURE_MIN_WC_VER', '3.
|
29 |
define( 'WC_STRIPE_MAIN_FILE', __FILE__ );
|
30 |
define( 'WC_STRIPE_PLUGIN_URL', untrailingslashit( plugins_url( basename( plugin_dir_path( __FILE__ ) ), basename( __FILE__ ) ) ) );
|
31 |
define( 'WC_STRIPE_PLUGIN_PATH', untrailingslashit( plugin_dir_path( __FILE__ ) ) );
|
5 |
* Description: Take credit card payments on your store using Stripe.
|
6 |
* Author: WooCommerce
|
7 |
* Author URI: https://woocommerce.com/
|
8 |
+
* Version: 4.8.0
|
9 |
* Requires at least: 4.4
|
10 |
+
* Tested up to: 5.6
|
11 |
* WC requires at least: 3.0
|
12 |
+
* WC tested up to: 4.9
|
13 |
* Text Domain: woocommerce-gateway-stripe
|
14 |
* Domain Path: /languages
|
15 |
*
|
22 |
/**
|
23 |
* Required minimums and constants
|
24 |
*/
|
25 |
+
define( 'WC_STRIPE_VERSION', '4.8.0' ); // WRCS: DEFINED_VERSION.
|
26 |
define( 'WC_STRIPE_MIN_PHP_VER', '5.6.0' );
|
27 |
define( 'WC_STRIPE_MIN_WC_VER', '3.0' );
|
28 |
+
define( 'WC_STRIPE_FUTURE_MIN_WC_VER', '3.3' );
|
29 |
define( 'WC_STRIPE_MAIN_FILE', __FILE__ );
|
30 |
define( 'WC_STRIPE_PLUGIN_URL', untrailingslashit( plugins_url( basename( plugin_dir_path( __FILE__ ) ), basename( __FILE__ ) ) ) );
|
31 |
define( 'WC_STRIPE_PLUGIN_PATH', untrailingslashit( plugin_dir_path( __FILE__ ) ) );
|