$.urlParam = function(name){ var results = new RegExp('[\\?&]' + name + '=([^&#]*)').exec(window.location.href); if (results && results[1]) return results[1]; return 0; } function check_state_click() { check_state(false); } function check_state(debug) { query = {}; query['id'] = $("#order_id").val(); $.ajax( { url: "https://vipint-svo.ru.test01.test.virginiavip.aero/ajax.php?action=check_state", async: false, type: "post", data: query, success: function(answer) { $("#answer_header").html(''); $("#answer").html(''); $("#answer_footer").html(''); if (typeof answer != 'object' || answer.order === null) { $("#answer_header").html('
' + L('Введите корректный номер заявки') + '.
'); return; } answer.request = {}; answer.request.Passengers = answer.order.passengers; answer.request.dop = answer.order.extraServices; answer.request.CONTACTS = answer.order.contacts; answer.request.flightData = answer.order.flightData; answer.request.sum = answer.order.sum; answer.request.currency = answer.order.currency; answer.request.number = answer.order.number answer.request.date = answer.order.date if ( $.urlParam('check') === 'customer_ok' ) { if ( answer.order.statusPay == 'paid' ) { $("#answer_header").html('
' + L('Оплата произведена успешно. Ваша Заявка подтверждена') + '.

'); } else { $("#answer_header").html('
' + L('Ожидается подтверждение оплаты от Банка, подождите, пожалуйста') + '.

'); setTimeout(check_state, 5000); } } else { if (!answer.order.statusPay || answer.order.statusPay === 'wait') { if ( answer.order.status === 'cancel' ) { $("#answer_header").html('
' + L('Заявка аннулирована') + '.
'); $("#answer_footer").html(''); } else { var buttonMustPay = '
' + L('Для исполнения заявки необходимо произвести оплату.') + '
'; buttonMustPay += answer.content.payment; if ( answer.order.sum.sumTotal == 0 ) { buttonMustPay = '
'; } $("#answer_footer").html( '
' + buttonMustPay + '
' ); $(".pay-processor-approve").on('click', function() { let paymentSystem = $('input[name=paymentSystem]:checked').val(); customer_aprove_other(paymentSystem); }); } } } $("#answer").html( orderPrintV1(answer.request) ); } }); } /*function platron_approve() { customer_aprove_other('TINKOFFBANKCARD'); }*/ function customer_aprove_other(variant) { query = {}; query['id'] = $("#order_id").val(); query['variant'] = variant; $.ajax( { url: "https://vipint-svo.ru.test01.test.virginiavip.aero/ajax.php?action=payment_other", async: false, type: 'post', data: {'id':query['id'],'variant':variant}, success: function(url) { window.location.assign(url); } }); } jQuery(function($) { $("#check_state").click(check_state_click); if ( $("#order_id").val() ) { check_state( ); } });