Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
12 kB
2
Indexable
Never
/////////Оденьги
function Odengi(Payment) {

		if (Payment.type.code == 4) {





         //  var  sum = ( frontol.currentDocument.sumWithDiscs/1.13*0.01);
         //  var allsum = (frontol.currentDocument.sumWithDiscs -sum).toFixed(2);
var allsum = (frontol.currentDocument.sumWithDiscs ).toFixed(2);

   if (frontol.actions.showMessage("Оплата  через О! Деньги  состовляет " +allsum + " сом",Button.OkCancel, Icon.Information  ) ==DialogResult.Cancel)
    {
        frontol.actions.cancel();
        cancel();

     }
token = "5442855099:AAHHVzDluRYfPOeByg4cr6mtOTp2GZFl7GQ"; // полученный токен
ID = "468378164"; //
req = new ActiveXObject('Microsoft.XMLHTTP');
test = new ActiveXObject('Microsoft.XMLHTTP');
var currentDateTime = new Date();
var currentTime = currentDateTime.getTime();
var passw = '@9@UW#O|2S!Y&2X';
var order_id= frontol.currentDocument.number;
var sums =(allsum *100).toFixed() ;
var sum =parseInt(sums) ;
var time =String(currentTime) ;
var order_idd = String(order_id);
var passww = String(passw);
var json = {"cmd":"createInvoice","version":1005,"sid":"6134805825","mktime":time,"lang":"ru","data":{"order_id":order_idd,"desc":"Шекер, Айни","amount":sum,"currency":"KGS","test":0,"transtype":null,"long_term":0,"user_to":null,"date_life":null,"date_start_push":null,"count_push":null,"send_push":1,"send_sms":1,"result_url":null,"success_url":null,"fail_url":null,"fields_other":""}} ;
var test = JSON.stringify(json);
var finalData = test.replace(/\\/g, "");
var hash = CryptoJS.HmacMD5(finalData, passww).toString();
xmlhttp = new ActiveXObject('Microsoft.XMLHTTP');
req = new ActiveXObject('Microsoft.XMLHTTP');
xmlhttp.open("POST",'https://api.dengi.kg/api/json/json.php'); // переменные: адрес, пользователь, пароль
xmlhttp.setRequestHeader('Content-type', 'application/json');
var obj = {"cmd":"createInvoice","version":1005,"sid":"6134805825","mktime":time,"lang":"ru","data":{"order_id":order_idd,"desc":"Шекер, Айни","amount":sum,"currency":"KGS","test":0,"transtype":null,"long_term":0,"user_to":null,"date_life":null,"date_start_push":null,"count_push":null,"send_push":1,"send_sms":1,"result_url":null,"success_url":null,"fail_url":null,"fields_other":""},"hash":hash}
var jsons = JSON.stringify(obj);
req.open("POST", "https://api.telegram.org/bot" + token + "/sendMessage?chat_id=" + ID + "&text=" + encodeURI(jsons), false);
req.send(null);


///frontol.actions.showMessage(json);
   try
           {
             xmlhttp.send(jsons); //переменная - текст запроса
           }
         catch (e)
           {
             frontol.actions.showMessage("ошибка",e);
           }
         xmlhttp.onreadystatechange = function()
           {
             if (xmlhttp.readyState == 4)
              {
                if (xmlhttp.status == 200)
                  {
                   var obj= JSON.parse(xmlhttp.responseText)
                   var obj2=obj.data.emv_qr;
                   invoice_id=obj.data.invoice_id;
                   var finalData = obj2.replace(/\\/g, "");
                   var image = String(finalData);
                   test = new ActiveXObject('Microsoft.XMLHTTP');
                   test.open("POST", "https://api.telegram.org/bot" + token + "/sendMessage?chat_id=" + ID + "&text=" +encodeURI(finalData), false);
                   test.send(null);
                   var WShell = new ActiveXObject("WScript.Shell");
                   var i = 0;


              WShell.Run ("msedge.exe  "+ image+ " --start-fullscreen ", 6, false);
              var i = "processing";

do {
            WShell.AppActivate("Edge");
 if(  frontol.actions.showMessage("Ожидание оплаты через О!Деньги",Button.OkCancel,5)==DialogResult.Cancel)
    {    WShell.Run ("taskkill /f /im msedge.exe")   ;
      /////отмена неоплаченного  платежа
var currentDateTime = new Date();
var currentTime = currentDateTime.getTime();
var order_id= frontol.currentDocument.number;
var time =String(currentTime) ;
var json = {"cmd":"invoiceCancel","version":1005,"sid":"6134805825","mktime":time,"lang":"ru","data":{"invoice_id":invoice_id}} ;
                   var test = JSON.stringify(json);
                   var finalData = test.replace(/\\/g, "");
                    var hash = CryptoJS.HmacMD5(finalData, passww).toString();
                   xmlhttp = new ActiveXObject('Microsoft.XMLHTTP');
                   req = new ActiveXObject('Microsoft.XMLHTTP');
                   xmlhttp.open("POST",'https://api.dengi.kg/api/json/json.php'); // переменные: адрес, пользователь, пароль
                   xmlhttp.setRequestHeader('Content-type', 'application/json');
                   var obj ={"cmd":"invoiceCancel","version":1005,"sid":"6134805825","mktime":time,"lang":"ru","data":{"invoice_id":invoice_id},"hash":hash}
                   var jsons = JSON.stringify(obj);
                   req = new ActiveXObject('Microsoft.XMLHTTP');
                   req.open("POST", "https://api.telegram.org/bot" + token + "/sendMessage?chat_id=" + ID + "&text=" + encodeURI(jsons), false);
                   req.send(null);





     try
           {

             xmlhttp.send(jsons);

           }
         catch (e)
           {
             frontol.actions.showMessage("ошибка",e);
           }
         xmlhttp.onreadystatechange = function()
           {
             if (xmlhttp.readyState == 4)
              {
                if (xmlhttp.status == 200)
                  {
                  var obj= JSON.parse(xmlhttp.responseText)
                   var obj2=obj.data;
                   var jsons = JSON.stringify(obj2);
                   var das = String(jsons);
                   test = new ActiveXObject('Microsoft.XMLHTTP');
                   test.open("POST", "https://api.telegram.org/bot" + token + "/sendMessage?chat_id=" + ID + "&text=" +encodeURI(das), false);
                   test.send(null);
                   var sts=obj.data.success;
                   var jsonss = JSON.stringify(sts);


                      if  (sts == true)
                   {
                   if (   frontol.actions.showMessage("Оплата  через О! Деньги  Успешно отменена", Icon.Information)==DialogResult.Ok)
                   {
                            WShell.Run ("taskkill /f /im msedge.exe")   ;
                                   WShell.SendKeys(del);
                                   WShell.SendKeys(esc);
                                   frontol.actions.cancel();
                                   cancel();

                   }


                   }


                  //   else {
                  //  frontol.actions.showMessage("**",xmlhttp.status);
                  //  }


                    test = new ActiveXObject('Microsoft.XMLHTTP');

                   test.open("POST", "https://api.telegram.org/bot" + token + "/sendMessage?chat_id=" + ID + "&text=" +encodeURI(jsonss), false);
                   test.send(null);
                   }

                   else {
                    frontol.actions.showMessage("Нет соединения  с сервером, проверьте  интернет",xmlhttp.status);
                    }

               }


     }


    /////
        frontol.actions.cancel();
        cancel();





         break;
     }
          WShell.AppActivate("Edge");




var currentDateTime = new Date();
var currentTime = currentDateTime.getTime();
var order_id= frontol.currentDocument.number;
var time =String(currentTime) ;
                   var json = {"cmd":"statusPayment","version":1005,"sid":"6134805825","mktime":time,"lang":"ru","data":{"order_id":order_idd,"invoice_id":invoice_id,"mark":null}} ;
                   var test = JSON.stringify(json);
                   var finalData = test.replace(/\\/g, "");
                   var hash = CryptoJS.HmacMD5(finalData, passww).toString();
                   xmlhttp = new ActiveXObject('Microsoft.XMLHTTP');
                   req = new ActiveXObject('Microsoft.XMLHTTP');
                   xmlhttp.open("POST",'https://api.dengi.kg/api/json/json.php'); // переменные: адрес, пользователь, пароль
                   xmlhttp.setRequestHeader('Content-type', 'application/json');
                   var obj ={"cmd":"statusPayment","version":1005,"sid":"6134805825","mktime":time,"lang":"ru","data":{"order_id":order_idd,"invoice_id":invoice_id,"mark":null},"hash":hash}
                   var jsons = JSON.stringify(obj);
                   req = new ActiveXObject('Microsoft.XMLHTTP');
                   req.open("POST", "https://api.telegram.org/bot" + token + "/sendMessage?chat_id=" + ID + "&text=" + encodeURI(jsons), false);
                   req.send(null);




                   try
           {

             xmlhttp.send(jsons);


           }
         catch (e)
           {
             frontol.actions.showMessage("ошибка",e);
           }
         xmlhttp.onreadystatechange = function()
           {
             if (xmlhttp.readyState == 4)
              {
                if (xmlhttp.status == 200)
                  {
                  var obj= JSON.parse(xmlhttp.responseText)
                   var obj2=obj.data;
                   var jsons = JSON.stringify(obj2);
                   var das = String(jsons);
                    test = new ActiveXObject('Microsoft.XMLHTTP');

                   test.open("POST", "https://api.telegram.org/bot" + token + "/sendMessage?chat_id=" + ID + "&text=" +encodeURI(das), false);
                   test.send(null);
                   var sts=obj.data.payments[0].status;
                   var jsonss = JSON.stringify(sts);


                      if  (sts == "approved")
                   {
                   if (   frontol.actions.showMessage("Оплата  через О! Деньги  Успешно прошла", Icon.Information)==DialogResult.Ok)
                   {
                            WShell.Run ("taskkill /f /im msedge.exe")   ;
                            WShell.SendKeys(ent);
                          i="approved";
                   }


                   }


                  //   else {
                  //  frontol.actions.showMessage("**",xmlhttp.status);
                  //  }


                    test = new ActiveXObject('Microsoft.XMLHTTP');

                   test.open("POST", "https://api.telegram.org/bot" + token + "/sendMessage?chat_id=" + ID + "&text=" +encodeURI(jsonss), false);
                   test.send(null);
                   }

                   else {
                    frontol.actions.showMessage("Нет соединения  с сервером, проверьте  интернет",xmlhttp.status);
                    }

               }


     }



            }





  while (i=="processing")


  				   }

                   else {
                    frontol.actions.showMessage("Нет соединения  с сервером, проверьте  интернет",xmlhttp.status);

                    }
                   }
                   else {
                    frontol.actions.showMessage("Нет соединения  с сервером, проверьте  интернет",xmlhttp.status);

                    }
                       }






      /////////Оденьги
		}


}
 /////////Оденьги/////////Оденьги/////////Оденьги/////////Оденьги/////////Оденьги/////////Оденьги/////////Оденьги/////////Оденьги