Advertisement
PandaDoddo72Rus

eco_test

May 8th, 2017
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.26 KB | None | 0 0
  1. -- test eco
  2. local unicode = require('unicode')
  3. local event = require("event")
  4. local computer = require('computer')
  5. local component = require('component')
  6. local serialization = require("serialization")
  7. local tunnel = require('component').tunnel
  8. local shell = require('shell')
  9.  
  10. local request = {
  11.   operation = 'transfer',
  12.   user = 'PandaDoddo',
  13.   key = 'shop',
  14.   target = 'PandaDoddo',
  15.   amount = 100,
  16.   description = 'test',
  17.   answearKey = 'KEY'
  18. }
  19.  
  20. tunnel.send(serialization.serialize(request))
  21. while true do
  22.   local e = {event.pull('modem_message')}
  23.   local answear = serialization.unserialize(e[6])
  24.   if answear.operation == 'transactionResult' and answear.status == true then
  25.     print('Payment succes!')
  26.   elseif answear.operation == 'transactionResult' and answear.status == false and answear.error == 'timeout' then
  27.     print('Payment timeout!')  
  28.   elseif answear.operation == 'transactionResult' and answear.status == false and answear.error == 'deny_command' then
  29.     print('Payment deny')
  30.   end
  31.   if answear.operation == 'transfer' and answear.status == true then
  32.     print('Payment register!')
  33.   elseif answear.operation == 'transfer' and answear.status == false and answear.status == 'Not enough money' then
  34.     print('Not money!')
  35.   end
  36. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement