function execute_stage(stage) if stage == 1 then return { execstage = 1, kioskid = 2, devicesn = "6825ddd01ce0", opcode = "CCTHENABLED", params = {3}, posans = "CCTHENABLED(3,1)", posstage = 5, negans = "CCTHENABLED(3,0)", negstage = 994, tmt = 5000, tmtstage = 994, loadpage = "messages.html", pagemsg = "please_wait", pageparams = {}, actions = {} } elseif stage == 2 then return { execstage = 2, kioskid = 2, devicesn = "6825ddd01ce0", opcode = "CCTHENABLED", params = {3}, posans = "CCTHENABLED(3,1)", posstage = 6, negans = "CCTHENABLED(3,0)", negstage = 994, tmt = 5000, tmtstage = 994, loadpage = "messages.html", pagemsg = "please_wait", pageparams = {}, actions = {} } elseif stage == 5 then return { execstage = 5, kioskid = 2, devicesn = "6825ddd01ce0", opcode = "CCTHSTOCK", params = {3}, posans = "CCTHSTOCK(3,1)", posstage = 10, negans = "CCTHSTOCK(3,0)", negstage = 994, tmt = 5000, tmtstage = 994, loadpage = "messages.html", pagemsg = "please_wait", pageparams = {}, actions = {} } elseif stage == 6 then return { execstage = 6, kioskid = 2, devicesn = "6825ddd01ce0", opcode = "CCTHSTOCK", params = {3}, posans = "CCTHSTOCK(3,1)", posstage = 12, negans = "CCTHSTOCK(3,0)", negstage = 994, tmt = 5000, tmtstage = 994, loadpage = "messages.html", pagemsg = "please_wait", pageparams = {}, actions = {} } elseif stage == 10 then return { execstage = 10, kioskid = 2, devicesn = "6825ddd01ce0", opcode = "GETCASH", params = {"$REQUIRED_PRICE$", 30}, posans = "GETCASHOK", posstage = 11, negans = "GETCASHFAIL", negstage = 990, tmt = 10000, tmtstage = 990, loadpage = "messages.html", pagemsg = "please_wait", pageparams = {}, actions = {} } elseif stage == 11 then return { execstage = 11, kioskid = 2, devicesn = "6825ddd01ce0", opcode = "", params = {}, posans = "GETCASHFULLYRECEIVED", posstage = 20, negans = "GETCASHTIMEOUT", negstage = 990, tmt = 30000, tmtstage = 990, loadpage = "messages.html", pagemsg = "insert_cash", pageparams = {"$PRODUCT_PRICE$", "$ACCUMULATED_CREDIT$"}, actions = {} } elseif stage == 12 then return { execstage = 12, kioskid = 2, devicesn = "6825ddd01ce0", opcode = "CSLS1VNDREQ", params = {"$PRODUCT_PRICE$", "$SELECTION_NUMBER$"}, posans = "CSLS1VNDREQOK", posstage = 13, negans = "CSLS1VNDREQFAIL", negstage = 993, tmt = 10000, tmtstage = 993, loadpage = "messages.html", pagemsg = "please_wait", pageparams = {}, actions = {} } elseif stage == 13 then return { execstage = 13, kioskid = 2, devicesn = "6825ddd01ce0", opcode = "", params = {}, posans = "CSLS1VNDAPP", posstage = 22, negans = "CSLS1VNDDEN", negstage = 993, tmt = 60000, tmtstage = 993, loadpage = "messages.html", pagemsg = "present_card", pageparams = {"$PRODUCT_PRICE$"}, actions = {} } elseif stage == 20 then return { execstage = 20, kioskid = 2, devicesn = "6825ddd01ce0", opcode = "CCTHDISPENSE", params = {3, 1, 2}, posans = "CCTHDISPENSESTART", posstage = 30, negans = "CCTHDISPENSEFAIL", negstage = 991, tmt = 5000, tmtstage = 991, loadpage = "messages.html", pagemsg = "payment_successful", pageparams = {}, actions = {} } elseif stage == 22 then return { execstage = 22, kioskid = 2, devicesn = "6825ddd01ce0", opcode = "CCTHDISPENSE", params = {3, 1, 2}, posans = "CCTHDISPENSESTART", posstage = 32, negans = "CCTHDISPENSEFAIL", negstage = 52, tmt = 5000, tmtstage = 52, loadpage = "messages.html", pagemsg = "payment_successful", pageparams = {}, actions = {} } elseif stage == 30 then return { execstage = 30, kioskid = 2, devicesn = "6825ddd01ce0", opcode = "", params = {}, posans = "CCTHFULLPAID", posstage = 40, negans = "CCTHPARTPAID", negstage = 992, tmt = 20000, tmtstage = 992, loadpage = "messages.html", pagemsg = "wait_product_dispensing", pageparams = {}, actions = {} } elseif stage == 32 then return { execstage = 32, kioskid = 2, devicesn = "6825ddd01ce0", opcode = "", params = {}, posans = "CCTHFULLPAID", posstage = 50, negans = "CCTHPARTPAID", negstage = 52, tmt = 20000, tmtstage = 52, loadpage = "messages.html", pagemsg = "wait_product_dispensing", pageparams = {}, actions = {} } elseif stage == 40 then return { execstage = 40, kioskid = 2, devicesn = "6825ddd01ce0", opcode = "CSLS1CASHSALE", params = {"$PRODUCT_PRICE$", "$SELECTION_NUMBER$"}, posans = "CSLS1CASHSALEOK", posstage = 999, negans = "CSLS1CASHSALEFAIL", negstage = 999, tmt = 3000, tmtstage = 999, aftersleep = 3000, gotostage = 999, loadpage = "messages.html", pagemsg = "sale_success", pageparams = {"$PRODUCT_NAME$", "$ACCUMULATED_CREDIT$"}, actions = { "$ACCUMULATED_CREDIT$ = $ACCUMULATED_CREDIT$ - $PRODUCT_PRICE$", "$SALE_PERFORMED$ = 1" } } elseif stage == 50 then return { execstage = 50, kioskid = 2, devicesn = "6825ddd01ce0", opcode = "CSLS1VNDSUCC", params = {"$SELECTION_NUMBER$"}, posans = "CSLS1VNDSUCCOK", posstage = 51, negans = "CSLS1VNDSUCCFAIL", negstage = 51, tmt = 5000, tmtstage = 51, loadpage = "messages.html", pagemsg = "payment_successful", pageparams = {}, actions = {} } elseif stage == 51 then return { execstage = 51, kioskid = 2, devicesn = "6825ddd01ce0", opcode = "", params = {}, posans = "", posstage = -1, negans = "", negstage = -1, tmt = -1, tmtstage = -1, aftersleep = 8000, gotostage = 999, loadpage = "messages.html", pagemsg = "sale_success", pageparams = {"$PRODUCT_NAME$"}, actions = {} } elseif stage == 52 then return { execstage = 52, kioskid = 2, devicesn = "6825ddd01ce0", opcode = "CSLS1VNDFAIL", params = {}, posans = "CSLS1VNDFAILOK", posstage = 991, negans = "CSLS1VNDFAILFAIL", negstage = 991, tmt = 5000, tmtstage = 991, loadpage = "messages.html", pagemsg = "dispensing_failed", pageparams = {}, actions = {} } elseif stage == 990 then return { execstage = 990, kioskid = 2, devicesn = "6825ddd01ce0", opcode = "", params = {}, posans = "", posstage = -1, negans = "", negstage = -1, tmt = -1, tmtstage = -1, aftersleep = 3000, gotostage = 999, loadpage = "messages.html", pagemsg = "cash_failed", pageparams = {}, actions = {} } elseif stage == 991 then return { execstage = 991, kioskid = 2, devicesn = "6825ddd01ce0", opcode = "", params = {}, posans = "", posstage = -1, negans = "", negstage = -1, tmt = -1, tmtstage = -1, aftersleep = 3000, gotostage = 999, loadpage = "messages.html", pagemsg = "dispensing_failed", pageparams = {}, actions = {} } elseif stage == 992 then return { execstage = 992, kioskid = 2, devicesn = "6825ddd01ce0", opcode = "", params = {}, posans = "", posstage = -1, negans = "", negstage = -1, tmt = -1, tmtstage = -1, aftersleep = 3000, gotostage = 999, loadpage = "messages.html", pagemsg = "sale_failed", pageparams = {}, actions = {} } elseif stage == 993 then return { execstage = 993, kioskid = 2, devicesn = "6825ddd01ce0", opcode = "", params = {}, posans = "", posstage = -1, negans = "", negstage = -1, tmt = -1, tmtstage = -1, aftersleep = 3000, gotostage = 999, loadpage = "messages.html", pagemsg = "card_payment_fail", pageparams = {}, actions = {} } elseif stage == 994 then return { execstage = 994, kioskid = 2, devicesn = "6825ddd01ce0", opcode = "", params = {}, posans = "", posstage = -1, negans = "", negstage = -1, tmt = -1, tmtstage = -1, aftersleep = 3000, gotostage = 999, loadpage = "messages.html", pagemsg = "product_not_available", pageparams = {}, actions = {} } elseif stage == 999 then return { execstage = 999, kioskid = 2, devicesn = "6825ddd01ce0", opcode = "", params = {}, posans = "", posstage = -1, negans = "", negstage = -1, tmt = -1, tmtstage = -1, loadpage = "main.html", pagemsg = "", pageparams = {}, actions = {} } end end