1jQuery(document).ready(function($){ 2 $(document).on('click', '.wpecpp-stripe-button', function(e){ 3 e.preventDefault(); 4 5 const $button = $(this), 6 $form = $button.parents('form'), 7 $message = $form.find('.wpecpp-stripe-message'); 8 9 if ($button.hasClass('processing')) return false; 10 $button.addClass('processing'); 11 12 $message.html(''); 13 14 $.post(wpecpp.ajaxUrl, { 15 action: 'wpecpp_stripe_checkout_session', 16 nonce: wpecpp.nonce, 17 data: $form.serialize(), 18 location: window.location.href 19 }, function(response) { 20 if (response.success) { 21 if ( wpecpp.opens == '1' ) { 22 try { 23 const stripe = Stripe(response.data.stripeKey, { 24 stripeAccount: response.data.accountId 25 }); 26 stripe.redirectToCheckout({ 27 sessionId: response.data.sessionId 28 }); 29 } catch (error) { 30 $message.html('<span class="stripe-error">' + error + '</span>'); 31 $button.removeClass('processing'); 32 } 33 } else { 34 $button.removeClass('processing'); 35 36 const siteUrl = location.protocol + '//' + location.host + location.pathname; 37 38 let params = new URLSearchParams(location.search); 39 params.delete('wpecpp_stripe_success'); 40 params = params.toString(); 41 42 const url = siteUrl + '?' + new URLSearchParams({ 43 'wpecpp-stripe-checkout-redirect': 1, 44 'sk': response.data.stripeKey, 45 'ai': response.data.accountId, 46 'si': response.data.sessionId, 47 'rf': siteUrl + (params.length ? '?' + params : '') 48 }); 49 window.open(url, '_blank').focus(); 50 } 51 } else { 52 $message.html('<span class="stripe-error">' + response.data.message + '</span>'); 53 $button.removeClass('processing'); 54 } 55 }) 56 .fail(function() { 57 $message.html('<span class="stripe-error">An unexpected error occurred. Please try again.</span>'); 58 $button.removeClass('processing'); 59 }); 60 61 return false; 62 }); 63});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.