var resultCode
var bankCheck
var rrn
var mHash


oleObject = new ActiveXObject("SBRFSRV.Server")
ws = WScript.CreateObject('WScript.Shell')

oleObject.clear()
resultCode = oleObject.NFun(5009)
mHash = oleObject.GParamString("HASH")
RealPan = oleObject.GParamString("RealPan")
pan     = oleObject.GParamString("ClientCard")
if (RealPan)
  ws.popup("Считан токен.\nТокен:"+pan+"\n Карта:"+RealPan)
else
  ws.popup("Считана карта\n"+pan)

real_expiry_date = oleObject.GParamString("RealExpiryDate")
if(real_expiry_date == "")
    real_expiry_date = "Empity" 

resultCheck = "ERRCODE: " + resultCode + "\r\n" + "HASH: " + mHash + "\r\n" + "RealPan: " + RealPan + "\r\n" + "Pan: " + pan + "\r\n"
resultCheck += "RealExpiryDate:" + real_expiry_date
showTextInNotepad(resultCheck)

oleObject.clear()
oleObject.SParam ("Amount", 90000)
oleObject.SParam ("INHASH", mHash)
resultCode = oleObject.NFun(4000)

bankCheck = oleObject.GParamString("Cheque1251")
resultCheck = "ERRCODE: " + resultCode + "\r\n" + "HASH: " + mHash + "\r\n" + "RealPan: " + RealPan + "\r\n" + "Pan: " + pan + "\r\n\r\n" + bankCheck
showTextInNotepad(resultCheck)
oleObject.clear()

function showTextInNotepad(text){
filename = (new Date()).valueOf() + "upos_check.txt"
fso = WScript.CreateObject('Scripting.FileSystemObject')
file = fso.CreateTextFile(filename)
file.Write(text)
file.Close()
WScript.CreateObject('WScript.Shell').Run("notepad " + filename)
WScript.Sleep(2000)
fso.DeleteFile(filename)
}