Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- os.loadAPI("generator")
- os.loadAPI("krist")
- print("Welcome to PaySafeKrist\nHere, you can purchase PaySafeKrist codes.\n")
- print("To purchase a card, please select one of the values below.\n")
- -- Array lists
- s1 = {" 5 \017\n","10\n","25\n","50\n","100\n","250\n","500\n","1000\n"}
- s2 = {" 5\n","10 \017\n","25\n","50\n","100\n","250\n","500\n","1000\n"}
- s3 = {" 5\n","10\n","25 \017\n","50\n","100\n","250\n","500\n","1000\n"}
- s4 = {" 5\n","10\n","25\n","50 \017\n","100\n","250\n","500\n","1000\n"}
- s5 = {" 5\n","10\n","25\n","50\n","100 \017\n","250\n","500\n","1000\n"}
- s6 = {" 5\n","10\n","25\n","50\n","100\n","250 \017\n","500\n","1000\n"}
- s7 = {" 5\n","10\n","25\n","50\n","100\n","250\n","500 \017\n","1000\n"}
- s8 = {" 5\n","10\n","25\n","50\n","100\n","250\n","500\n","1000 \017\n"}
- sel = 1
- selected = false
- value = "not selected"
- while not selected do
- term.clear()
- term.setCursorPos(1,1)
- print("Welcome to PaySafeKrist\nHere, you can purchase PaySafeKrist codes.\n")
- print("To purchase a card, please select one of the values below.\n")
- if sel == 1 then print(table.unpack(s1))
- elseif sel == 2 then print(table.unpack(s2))
- elseif sel == 3 then print(table.unpack(s3))
- elseif sel == 4 then print(table.unpack(s4))
- elseif sel == 5 then print(table.unpack(s5))
- elseif sel == 6 then print(table.unpack(s6))
- elseif sel == 7 then print(table.unpack(s7))
- elseif sel == 8 then print(table.unpack(s8))
- end
- x = 9
- y = 6
- act, key = os.pullEvent("key")
- if key == 200 and sel > 1 then sel = sel - 1 end
- if key == 208 and sel < 8 then sel = sel + 1 end
- if key == 28 then
- if sel == 1 then value = 5 term.setCursorPos(x,y+1) print("Selected!") break
- elseif sel == 2 then value = 10 term.setCursorPos(x,y+2) print("Selected!") break
- elseif sel == 3 then value = 25 term.setCursorPos(x,y+3) print("Selected!") break
- elseif sel == 4 then value = 50 term.setCursorPos(x,y+4) print("Selected!") break
- elseif sel == 5 then value = 100 term.setCursorPos(x,y+5) print("Selected!") break
- elseif sel == 6 then value = 250 term.setCursorPos(x,y+6) print("Selected!") break
- elseif sel == 7 then value = 500 term.setCursorPos(x,y+7) print("Selected!") break
- elseif sel == 8 then value = 1000 term.setCursorPos(x,y+8) print("Selected!") break
- end
- end
- end
- -- End of selection Menu.
- term.setCursorPos(1,y+10)
- write("Communicating with server... ")
- sleep(0.25)
- print("Done.")
- sleep(0.5)
- write("Negotiating connection... ")
- sleep(0.1)
- print("Accepted!")
- sleep(0.5)
- write("Checking Krist availability... ")
- sleep(0.7)
- print("Available!")
- sleep(1)
- term.clear()
- term.setCursorPos(1,1)
- print("-------Order Receipt-------\n")
- print('PSK '..value..' x1 : '..value..' KST')
- print('Service fees (2%): '..math.ceil(value/100*2)..' KST\n')
- print("---------------------------")
- print("Subtotal: "..value+math.ceil(value/100*2).." KST")
- print("---------------------------")
- val1 = math.random(10)
- val2 = math.random(10)
- calc = val1 + val2
- print("if you want to cancel the order, type 'c' in the CCCapatcha below.")
- write('\nCCCapatcha: '..tostring(val1).." + "..tostring(val2)..'\nSolution: ')
- cont = read()
- if tonumber(cont) == calc then print("\nSolution correct.") elseif cont == "c" then print("\nCanceling payment...") sleep(0.75) os.reboot() else error("Solution invalid") end
- sleep(0.5)
- term.clear()
- term.setCursorPos(1,1)
- print("Before continuing, we need your e-mail address \n(your code will be sent to it.).\n\nThis is to prevent abuse of our systems.\nSo we can keep track of all our customers.\n")
- write("Your e-mail address: ")
- email = read()
- print("\nThank you.\nE-mail addresses are required as an additional security matter.\n\nWe thank you for your trust.\n - The PaySafeKrist Team")
- sleep(6)
- write("Generating "..value.." KST PSK card... ")
- rawkey = generator.generate()
- key = krist.sha256("KRISTWALLET"..rawkey).."-000"
- fine = krist.auth(key)
- if fine == true then print("Authentication succeeded. continueing...") else printError("Could not authenticate address, destroying session...") end
- address = krist.generate(key)
- print("Done!\nLoading payment portal...")
- sleep(1)
- term.clear()
- term.setCursorPos(1,1)
- anonkey = math.random(10000) * math.random(10000)
- anonadd = krist.generate(krist.sha256("KRISTWALLET"..anonkey).."-000")
- alright = krist.auth(krist.sha256("KRISTWALLET"..anonkey).."-000")
- if alright == true then print("Payment address OK proceeding to checkout...") sleep(0.5) else printError("Payment address failed to authenticate, destorying sesssion...") end
- completed = false
- time = 120
- if krist.balance(anonadd) == nil then oldbal = 0 else oldbal = krist.balance(anonadd) end
- while completed == false do
- term.clear()
- term.setCursorPos(1,1)
- print(anonkey)
- print("Please send "..tostring(math.ceil(value+value/100*2)).." KST to "..tostring(anonadd).." to buy:\n'1x PSK "..tostring(value).."'.\n(Session expires after "..time.."s)")
- sleep(1)
- time = time - 1
- if time == 0 then completed = true end
- if krist.balance(anonadd) == nil then bal = 0 else bal = krist.balance(anonadd) end
- if bal > oldbal and bal == value+value/100*2 or bal > value+value/100*2 then
- write("Payment Succeeded, refilling card with "..value.." KST.")
- sleep(0.5)
- krist.transfer('official',anonkey,value,address,"Card refilled by PaySafeKrist!")
- write(".")
- sleep(0.5)
- krist.transfer('official',anonkey,bal-value,"PaySafeKrist.kst","Service fees for "..value.." PSK")
- write(".\n")
- -- Using my own api to send the e-mail.
- html = textutils.urlEncode(('<h1 style="text-align: center;">Thank you for your purchase!</h1><hr/><h2 style="text-align: left;">Your purchase has been completed successfully!</h2><p>Below, you can find your card code, together with contacting information.</p><br/><p>Your card code is: <strong>'..rawkey..'</strong> <i>(PSK '..value..' KST)</i></p><br/><p>We would like to thank you once again for your purchase!</p><p>If there is anything we can improve, please tell us!<br />You can contact us at <a href="mailto:support@lolmaker2002.bid">support@lolmaker2002.bid</a><br /> <span style="font-size: xx-small;">(We might respond with a different email, but we will clarify we are talking to you)</span></p><p><br /> </p><p><i></o>Happy shopping!</i><br/> <b> -The PaySafeKrist Team!</b></p>'))
- mail = http.post("http://tracking.lolmaker2002.bid/v2/email/send","apikey=5e7886a8-8fa4-40d5-92ac-548ca7e96436&to="..email.."&subject=PaySafeKrist Card Purchase.&from=paysafekrist@lolmaker2002.bid&fromName=The PaySafeKrist Team&bodyHtml="..html.."&isTransactional=true").readAll()
- print("Sending e-mail to "..email)
- checkmail = krist.decode(mail)
- if checkmail == nil then checkmail = { ["success"] = false} else end
- if checkmail.success == true then print("\nCheck your inbox!") else print("\nWe are unable to send the e-mail, Your code is: "..rawkey) end
- break
- end
- end
- -- End of PaySafeKrist Purchase Terminal.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement