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