1jQuery(function($) { 2 3 var old_order_id = !1; 4 var new_nonce = !1; 5 $.fn.STSendAjaxPackage = function () { 6 this.each(function () { 7 var me = $(this); 8 var button = $('#st_submit_member_package', this); 9 var data = me.serializeArray(); 10 data.push({name: 'action', value: 'booking_form_package_direct_submit'}); 11 me.find('.form-control').removeClass('error'); 12 me.find('.form_alert').addClass('hidden'); 13 var dataobj = {}; 14 for (var i = 0; i < data.length; ++i) { 15 dataobj[data[i].name] = data[i].value 16 } 17 dataobj.order_id = old_order_id; 18 button.addClass('loading'); 19 20 $.ajax({ 21 type: 'post', 22 url: st_params.ajax_url, 23 data: dataobj, 24 dataType: 'json', 25 success: function (data) { 26 console.log(data); 27 var stripePublishKey = st_vina_stripe_params.vina_stripe.publishKey; 28 if(st_vina_stripe_params.vina_stripe.sanbox == 'sandbox'){ 29 stripePublishKey = st_vina_stripe_params.vina_stripe.testPublishKey 30 } 31 var stripe = Stripe(stripePublishKey); 32 if(data.error){ 33 $('#mpk-form').find('.mt20').addClass('alert alert-danger').html(data.error); 34 } 35 console.log(data); 36 if (typeof(data.payment_intent_client_secret) != 'undefined' && data.payment_intent_client_secret) { 37 stripe.handleCardAction( 38 data.payment_intent_client_secret 39 ).then(function(result) { 40 console.log(result); 41 if (result.error) { 42 alert(result.error.message); 43 } else { 44 45 $.ajax({
46 url: st_params.ajax_url, 47 dataType: 'json', 48 type: 'POST', 49 data: { 50 'action' : 'vina_stripe_package_confirm_server', 51 'st_order_id' : data.order_id, 52 'payment_intent_id' : result.paymentIntent.id, 53 'data_step2' : data, 54 }, 55 beforeSend: function () { 56 //handleServerResponse(); 57 }, 58 success: function (response_server) { 59 console.log(response_server); 60 console.log("stripe server confirm"); 61 }, 62 complete: function (jqXHR) { 63 if (typeof(data.order_id) != 'undefined' && data.order_id) { 64 old_order_id = data.order_id 65 } 66 if (data.message) { 67 me.find('.form_alert').addClass('alert-danger').removeClass('hidden'); 68 me.find('.form_alert').html(data.message) 69 } 70 if (data.redirect) { 71 window.location.href = data.redirect 72 } 73 if (data.redirect_form) { 74 $('body').append(data.redirect_form) 75 } 76 if (data.new_nonce) { 77 78 } 79 var widget_id = 'st_recaptchar_' + dataobj.item_id; 80 get_new_captcha(me); 81 button.removeClass('loading') 82 83 }, 84 }); 85 } 86 }); 87 } else { 88 if (typeof(data.order_id) != 'undefined' && data.order_id) { 89 old_order_id = data.order_id 90 } 91 if (data.message) { 92 me.find('.form_alert').addClass('alert-danger').removeClass('hidden'); 93 me.find('.form_alert').html(data.message) 94 } 95 if (data.redirect) { 96 window.location.href = data.redirect 97 } 98 if (data.redirect_form) { 99 $('body').append(data.redirect_form) 100 } 101 if (data.new_nonce) { 102 103 } 104 var widget_id = 'st_recaptchar_' + dataobj.item_id; 105 get_new_captcha(me); 106 button.removeClass('loading') 107 } 108 109 }, 110 error: function (e) { 111 button.removeClass('loading'); 112 alert('Lost connect to server'); 113 //get_new_captcha(me) 114 } 115 }); 116 }); 117 }; 118 jQuery(function($) { 119 jQuery('#st_submit_member_package').submit(function ($) { 120 var form = $(this).closest('form'); 121 form.trigger('st_before_checkout'); 122 123 var payment = $('input[name="st_payment_gateway"]:checked', form).val(); 124 var wait_validate = $('input[name="wait_validate_' + payment + '"]', form).val(); 125 if (wait_validate === 'wait') { 126 form.trigger('st_wait_checkout'); 127 return false; 128 } 129 form.STSendAjaxPackage(); 130 }); 131 }); 132 function get_new_captcha(me) { 133 var captcha_box = me.find('.captcha_box'); 134 url = captcha_box.find('.captcha_img').attr('src'); 135 captcha_box.find('.captcha_img').attr('src', url) 136 } 137});
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.