$.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/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_header").html('
' + L('Введите корректный номер заявки') + '.
'); return; } answer.request.Passengers = $.parseJSON(answer.request.passengers); answer.request.dop = $.parseJSON(answer.request.dop); if ( $.urlParam('check') == 'customer_ok' ) { if ( answer.request.status_pay == 'paid' ) { $("#answer_header").html('
' + L('Оплата произведена успешно. Ваша Заявка подтверждена') + '.

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

'); setTimeout(check_state, 5000); } } else { if (!answer.request.status_pay || answer.request.status_pay == 'wait') { if ( answer.request.status == 'cancel' ) { $("#answer_header").html('
' + L('Заявка аннулирована') + '.
'); $("#answer_footer").html(''); } else { var buttonMustPay = '
' + L('Для исполнения заявки необходимо произвести оплату.') + '
'; /* + '

';*/ // if ( debug ) { // buttonMustPay += '

'; // } buttonMustPay += answer.content.payment; //buttonMustPay += '
'; //buttonMustPay += '
'; //buttonMustPay += '' + L('Платрон') + ''; //buttonMustPay += ''; //buttonMustPay += '
'; //buttonMustPay += '
'; //buttonMustPay += '
'; //buttonMustPay += '' + L('Сбербанк') + ''; //buttonMustPay += ''; //buttonMustPay += '
'; //buttonMustPay += '
'; if ( answer.request.summ == 0 ) { buttonMustPay = '
'; } $("#answer_footer").html( '
' + buttonMustPay + '
' ); //$("#customer_aprove").click(customer_aprove); $(".pay-processor-approve").on('click', function() { let el = $(this); //let paymentsystem = el.data('platform'); let paymentSystem = $('input[name=paymentSystem]:checked').val(); customer_aprove_other(paymentSystem); }); } } } $("#answer").html( order_print(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/ajax.php?action=payment_other", async: false, type: 'post', data: {'id':query['id'],'variant':variant}, success: function(url) { console.log("RECEIVED URL:", url) window.location.assign(url); } }); } jQuery(function($) { $("#check_state").click(check_state_click); if ( $("#order_id").val() ) { check_state( ); } });