1// Ð´Ð»Ñ ÑÐ¼ÐµÐ½Ñ ÑелекÑов Ñ Ð¿Ð°Ð½ÑионаÑами и без 2$(document).on('change', '#payment_form [name=TYPE]', function (e) { 3 if ($(this).val() == 118) { 4 $('[name=NUM_DOGOVOR]').closest('.form-group').addClass('hide'); 5 } else { 6 $('[name=NUM_DOGOVOR]').closest('.form-group.hide').removeClass('hide'); 7 } 8}); 9 10// ÑÑили Ð´Ð»Ñ Ñппла 11if ($(window).width() > 767) { 12 var isiPad = navigator.userAgent.match(/iPad/i) != null; 13 14 var ua = navigator.userAgent; 15 var isiPad = /iPad/i.test(ua) || /iPhone OS 3_1_2/i.test(ua) || /iPhone OS 3_2_2/i.test(ua); 16 if (!isiPad) { 17 $('.styler').styler(); 18 } 19} 20 21// вÑÑиÑлÑем конеÑнÑÑ ÑÑÐ¼Ð¼Ñ Ð´Ð»Ñ Ð¾Ð¿Ð»Ð°ÑÑ 22function calc() { 23 var $sum_total = $('#payment_form [name=SUM_TOTAL]'); 24 25 val = $sum_total.val(); 26 val = val.replace(',', '.'); 27 28 val = parseFloat(val); 29 $sum_total.val(val); 30 31 $sum_total.val(isNaN(val) ? '' : val); 32 $('#summ').text(isNaN(val) ? 0 : val); 33 summ_comission = Math.round((val * 1.022) * 100, 2) / 100; 34 $('#summ_comission').text(isNaN(summ_comission) ? '' : summ_comission); 35} 36 37// вÑÑÑавлÑем конеÑнÑÑ ÑÑÐ¼Ð¼Ñ Ð´Ð»Ñ Ð¾Ð¿Ð»Ð°ÑÑ 38var tID = 0; 39$(document).on('keyup', '#payment_form [name=SUM_TOTAL]', function () { 40 clearTimeout(tID); 41 tID = setTimeout(calc, 1000); 42}) 43 44// Ð¡Ð¾Ñ Ñанение даннÑÑ Ð¿Ñи изменении Ð¿Ð¾Ð»Ñ Ð²Ð²Ð¾Ð´Ð° и воÑÑÑановление пÑи загÑÑзке ÑÑÑаниÑÑ 45$("input").on("input", function () { 46if ($(this).attr("type") === "submit") return; 47 48var inputName = $(this).attr("name"); 49var inputValue = $(this).val(); 50localStorage.setItem(inputName, inputValue); 51}); 52 53// ФÑнкÑÐ¸Ñ Ð´Ð»Ñ Ð¾ÑиÑÑки вÑÐµÑ Ð¿Ð¾Ð»ÐµÐ¹ ÑоÑÐ¼Ñ Ð¸ ÑооÑвеÑÑÑвÑÑÑÐ¸Ñ Ð´Ð°Ð½Ð½ÑÑ Ð² localStorage 54function clearFormAndLocalStorage(form) { 55$(form) 56 .find("input") 57 .each(function () { 58 if ($(this).attr("type") !== "submit") { 59 var inputName = $(this).attr("name"); 60 localStorage.removeItem(inputName); 61 $(this).val(""); 62 } 63 }); 64} 65 66$(document).ready(function () { 67$("input").each(function () { 68 if ($(this).attr("type") === "submit") return; 69 70 var inputName = $(this).attr("name"); 71 var savedValue = localStorage.getItem(inputName); 72 73 if (savedValue) { 74 if ($(this).val() == '') $(this).val(savedValue); 75 } 76}); 77calc() 78}); 79$("#payment_clear").click(function(e) { 80e.preventDefault(); 81clearFormAndLocalStorage("#payment_form"); 82}); 83 84 85// ÑÑнкÑÐ¸Ñ Ð´Ð»Ñ ÑабоÑÑ Ð²Ð¸Ð´Ð¶ÐµÑом ÐлаÑдпейменÑÑ 86function payCloudPayments(data) { 87 var widget = new cp.CloudPayments(); 88 89 //console.log('data = ') 90 //console.log(data) 91 92 var receipt = { 93 "Items": [ 94 { 95 "label": data.label, 96 "price": Number(data.amount), 97 "quantity": 1.00, 98 "amount": Number(data.amount), 99 "vat": 0, // ÑÑавка ÐÐС 100 "method": 1, // 1 - ÐÑедоплаÑа 100% 101 "object": 4, // 4 - ÑÑлÑга 102 } 103 ], 104 "calculationPlace": data.domen, // меÑÑо оÑÑÑеÑÑÐ²Ð»ÐµÐ½Ð¸Ñ ÑаÑÑÑÑа, по ÑмолÑÐ°Ð½Ð¸Ñ Ð±ÐµÑеÑÑÑ Ð·Ð½Ð°Ñение из каÑÑÑ 105 "taxationSystem": 0, // ÑиÑÑема налогообложениÑ; необÑзаÑелÑнÑй, еÑли Ñ Ð²Ð°Ñ Ð¾Ð´Ð½Ð° ÑиÑÑема Ð½Ð°Ð»Ð¾Ð³Ð¾Ð¾Ð±Ð»Ð¾Ð¶ÐµÐ½Ð¸Ñ 106 "email": data.email, 107 "phone": data.phone, 108 "customerInfo": data.firstName, 109 "isBso": false, // Ñек ÑвлÑеÑÑÑ Ð±Ð»Ð°Ð½ÐºÐ¾Ð¼ ÑÑÑогой оÑÑÑÑноÑÑи 110 "AgentSign": null, // пÑизнак агенÑа, Ñег ÐФР1057 111 "amounts": 112 { 113 "electronic": Number(data.amount), 114 "advancePayment": 0.00, 115 "credit": 0.00, 116 "provision": 0.00 117 } 118 }; 119 120 widget.pay('charge', 121 { 122 publicId: data.publicId, 123 description: 'ÐплаÑа ÑÑлÑг в sgc-opeca.ru ' + ' - Ð½Ð¾Ð¼ÐµÑ Ð·Ð°ÐºÐ°Ð·Ð° ' + data['orderId'], 124 amount: Number(data.amount), 125 currency: 'RUB', 126 invoiceId: data.orderId, 127 email: data.email, 128 skin: "mini", 129 autoClose: 3, 130 payer: { 131 firstName: data.firstName, 132 lastName: data.lastName, 133 phone: data.phone, 134 }, 135 data: { 136 cloudPayments: { 137 "CustomerReceipt": receipt, // онлайн-Ñек 138 } 139 }, 140 }, 141 { 142 onSuccess: function (options) { // success 143 //дейÑÑвие пÑи ÑÑпеÑной оплаÑе 144 //console.log('options = '); 145 //console.log(options); 146 dataLayer.push({ 147 event: "GAevent", 148 eventCategory: "pay", 149 eventAction: "success", 150 }); 151 152 }, 153 onFail: function (reason, options) { // fail 154 //дейÑÑвие пÑи неÑÑпеÑной оплаÑе 155 //console.log('reason = '); 156 //console.log(reason); 157 // window.location.replace(data.url); 158 }, 159 onComplete: function (paymentResult, options) { 160 //console.log('ÐÑзÑваеÑÑÑ ÐºÐ°Ðº ÑолÑко Ð²Ð¸Ð´Ð¶ÐµÑ Ð¿Ð¾Ð»ÑÑÐ°ÐµÑ Ð¾Ñ api.cloudpayments оÑÐ²ÐµÑ Ñ ÑезÑлÑÑаÑом ÑÑанзакÑии.'); 161 //console.log('paymentResult = '); 162 console.log(paymentResult); 163 // window.location.replace(data.url); 164 165 // ÑÑÑ Ð¼Ñ Ð¿Ð¾Ð»ÑÑаем ÑезÑлÑÑаÑÑ Ð¾Ð¿Ð»Ð°ÑÑ, и нÑжно впиÑаÑÑ Ð² аналиÑÐ¸ÐºÑ Ð¸Ð½ÑÑ Ð¾Ð± ÑÑом 166 } 167 } 168 ) 169} 170 171
172// валидаÑÐ¸Ñ Ð¸ обÑабоÑка ÑоÑÐ¼Ñ 173$(document).on('submit', '#payment_form', function (e) { 174 e.preventDefault(); 175 176 var $form = $(this); 177 $form.find('.alert').remove(); 178 $sum = $form.find('[name=SUM_TOTAL]'); 179 $sum.val($sum.val().replace(/[^0-9\.]+/g, "")); 180 181 $.ajax({ 182 url: $form.attr('action'), 183 type: 'post', 184 data: $form.serialize(), 185 success: function (response) { 186 console.log(response); 187 eval(('response=' + response)); 188 console.log(response); 189 if (response.status == 'ERROR') { 190 $form.prepend('<div class="alert alert-error">' + response.text + '</div>'); 191 eval('response=' + response); 192 } else { 193 if (typeof response.redirect !== 'undifined' || response.redirect !== '') { 194 // console.log('вÑзÑваем Ð²Ð¸Ð´Ð¶ÐµÑ Ð´Ð»Ñ ÐлаÑдпейменÑÑ'); 195 payCloudPayments(response.data); 196 // $form.prepend('<div class="alert alert-success">' + response.text + '</div>'); 197 // setTimeout(() => { 198 // window.location = response.redirect; 199 // }, 1000); 200 201 } 202 } 203 } 204 }); 205 206 return false; 207}); 208
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.