Marlingaming

CC Tweaked banking_public3 - Card Payment Transaction System

Feb 24th, 2022 (edited)
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.21 KB | None | 0 0
  1. os.pullEvent = os.pullEventRaw
  2. local tArg = {...}
  3. local Reader = peripherals.find("reader")
  4. rednet.open(peripherals.find("modem"))
  5. local VertifyState = "unvertified"
  6. local ServerId
  7. local Key = "0000"
  8. local Amount = tArg[1]
  9. local Item = tArg[2]
  10.  
  11. local function Clear()
  12. term.setBackgroundColor(colors.lightBlue)
  13. term.clear()
  14. term.setCursorPos(1,1)
  15. print("|",VertifyState,"| Banking System | banking_public3 | ")
  16. end
  17.  
  18. function Getkey()
  19. centerText(h/2, "Please Enter Pin")
  20. term.setCursorPos(5,(h/2) + 1)
  21. local input
  22. repeat
  23. input = read("*")
  24. until string.len(input) == 4
  25. Key = input
  26. end
  27.  
  28. function GetCard()
  29. centerText(h/2, "Please Swipe Card Now")
  30. local side, id, data = os.pullEvent("mag_swipe")
  31. centerText(h/2, "Vertifying Card")
  32. local Mes = {id,data,Key,Amount,Item}
  33. rednet.send(ServerId,textutils.serialize(Mes),"4523")
  34. local a, b, c = rednet.receive("4523")
  35. if a == ServerId and b == "accepted" then
  36. os.queueEvent("Transaction_Accepted")
  37. elseif a == ServerId and b == "declined" then
  38. os.queueEvent("Transaction_Declined","Rejected by Server")
  39. end
  40. end
  41.  
  42. function getServer()
  43. ServerId = rednet.lookup("4523","Ser_B_1")
  44. end
  45.  
  46. getServer()
  47. if Amount > 40 then
  48. Getkey()
  49. end
  50. GetCard()
Add Comment
Please, Sign In to add comment