switch to new thrift interface
authorOwen Smith <owen@omsmith.ca>
Tue, 20 Nov 2012 00:04:52 +0000 (19:04 -0500)
committerOwen Smith <owen@omsmith.ca>
Tue, 20 Nov 2012 00:04:52 +0000 (19:04 -0500)
pos-bookie.thrift [new file with mode: 0644]
pos.thrift [deleted file]
www/assets/js/Pos.js [deleted file]
www/assets/js/PosBookie.js [new file with mode: 0644]
www/assets/js/client.js
www/assets/js/pos-bookie_types.js [new file with mode: 0644]
www/assets/js/pos_types.js [deleted file]
www/assets/js/thrift.js
www/index.html

diff --git a/pos-bookie.thrift b/pos-bookie.thrift
new file mode 100644 (file)
index 0000000..a985c68
--- /dev/null
@@ -0,0 +1,44 @@
+namespace cpp posbookie
+
+enum E_PURCHASE_STATUS { EPS_FAIL, EPS_NOMONEY, EPS_SUCCESS }
+
+service PosBookie {
+       void ping(),
+
+       string getSalt(),
+
+  E_PURCHASE_STATUS
+    purchaseItems(1:string auth, 2:string dataToHash, 3:list<i64> upcs),
+
+
+       i32 getUPCPrice(1:i64 upc),
+  i32 getStock(1:i64 upc)
+}
+
+/* POS interface :
+       i32 getAccountFromHash(1:string dataToHash),
+       list<string> getHashesFromAccountId(1:i32 account),
+       list<string> getHashesFromAccountName(1:string account),
+
+       i32 getHashAccountBalance(1:string dataToHash),
+       i32 getIdAccountBalance(1:i32 account),
+       i32 getNameAccountBalance(1:string account),
+
+       i64 associateHashWithId(1:string auth, 2:string dataToHash, 3:i32 account),
+       i64 associateHashWithName(1:string auth, 2:string dataToHash, 3:string account),
+       i64 deassociateHash(1:string auth, 2:string dataToHash),
+
+       i32 getUPCPrice(1:i64 upc),
+       i64 setUPCPrice(1:string auth, 2:i64 upc, 3:i32 price),
+
+       i64 doTransactionOnHash(1:string auth, 2:string dataToHash, 3:i32 delta),
+       i64 doTransactionOnId(1:string auth, 2:i32 account, 3:i32 delta),
+       i64 doTransactionOnName(1:string auth, 2:string account, 3:i32 delta),
+       i64 revertTransaction(1:string auth, 2:i64 serial),
+
+       i32 getStock(1:i64 upc),
+       i64 doStockChange(1:string auth, 2:i64 upc, 3:i32 delta),
+
+       list<string> toString()
+*/
+
diff --git a/pos.thrift b/pos.thrift
deleted file mode 100644 (file)
index d550d66..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-namespace cpp pos
-
-service Pos {
-       void ping(),
-
-       string getSalt(),
-
-       i32 getAccountFromHash(1:string dataToHash),
-       list<string> getHashesFromAccountId(1:i32 account),
-       list<string> getHashesFromAccountName(1:string account),
-
-       i32 getHashAccountBalance(1:string dataToHash),
-       i32 getIdAccountBalance(1:i32 account),
-       i32 getNameAccountBalance(1:string account),
-
-       i64 associateHashWithId(1:string auth, 2:string dataToHash, 3:i32 account),
-       i64 associateHashWithName(1:string auth, 2:string dataToHash, 3:string account),
-       i64 deassociateHash(1:string auth, 2:string dataToHash),
-
-       i32 getUPCPrice(1:i64 upc),
-       i64 setUPCPrice(1:string auth, 2:i64 upc, 3:i32 price),
-
-       i64 doTransactionOnHash(1:string auth, 2:string dataToHash, 3:i32 delta),
-       i64 doTransactionOnId(1:string auth, 2:i32 account, 3:i32 delta),
-       i64 doTransactionOnName(1:string auth, 2:string account, 3:i32 delta),
-       i64 revertTransaction(1:string auth, 2:i64 serial),
-
-       i32 getStock(1:i64 upc),
-       i64 doStockChange(1:string auth, 2:i64 upc, 3:i32 delta),
-
-       list<string> toString()
-}
-
diff --git a/www/assets/js/Pos.js b/www/assets/js/Pos.js
deleted file mode 100644 (file)
index 8273699..0000000
+++ /dev/null
@@ -1,3140 +0,0 @@
-//
-// Autogenerated by Thrift Compiler (0.8.0)
-//
-// DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
-//
-
-
-//HELPER FUNCTIONS AND STRUCTURES
-
-Pos_ping_args = function(args) {
-};
-Pos_ping_args.prototype = {};
-Pos_ping_args.prototype.read = function(input) {
-  input.readStructBegin();
-  while (true)
-  {
-    var ret = input.readFieldBegin();
-    var fname = ret.fname;
-    var ftype = ret.ftype;
-    var fid = ret.fid;
-    if (ftype == Thrift.Type.STOP) {
-      break;
-    }
-    input.skip(ftype);
-    input.readFieldEnd();
-  }
-  input.readStructEnd();
-  return;
-};
-
-Pos_ping_args.prototype.write = function(output) {
-  output.writeStructBegin('Pos_ping_args');
-  output.writeFieldStop();
-  output.writeStructEnd();
-  return;
-};
-
-Pos_ping_result = function(args) {
-};
-Pos_ping_result.prototype = {};
-Pos_ping_result.prototype.read = function(input) {
-  input.readStructBegin();
-  while (true)
-  {
-    var ret = input.readFieldBegin();
-    var fname = ret.fname;
-    var ftype = ret.ftype;
-    var fid = ret.fid;
-    if (ftype == Thrift.Type.STOP) {
-      break;
-    }
-    input.skip(ftype);
-    input.readFieldEnd();
-  }
-  input.readStructEnd();
-  return;
-};
-
-Pos_ping_result.prototype.write = function(output) {
-  output.writeStructBegin('Pos_ping_result');
-  output.writeFieldStop();
-  output.writeStructEnd();
-  return;
-};
-
-Pos_getSalt_args = function(args) {
-};
-Pos_getSalt_args.prototype = {};
-Pos_getSalt_args.prototype.read = function(input) {
-  input.readStructBegin();
-  while (true)
-  {
-    var ret = input.readFieldBegin();
-    var fname = ret.fname;
-    var ftype = ret.ftype;
-    var fid = ret.fid;
-    if (ftype == Thrift.Type.STOP) {
-      break;
-    }
-    input.skip(ftype);
-    input.readFieldEnd();
-  }
-  input.readStructEnd();
-  return;
-};
-
-Pos_getSalt_args.prototype.write = function(output) {
-  output.writeStructBegin('Pos_getSalt_args');
-  output.writeFieldStop();
-  output.writeStructEnd();
-  return;
-};
-
-Pos_getSalt_result = function(args) {
-  this.success = null;
-  if (args) {
-    if (args.success !== undefined) {
-      this.success = args.success;
-    }
-  }
-};
-Pos_getSalt_result.prototype = {};
-Pos_getSalt_result.prototype.read = function(input) {
-  input.readStructBegin();
-  while (true)
-  {
-    var ret = input.readFieldBegin();
-    var fname = ret.fname;
-    var ftype = ret.ftype;
-    var fid = ret.fid;
-    if (ftype == Thrift.Type.STOP) {
-      break;
-    }
-    switch (fid)
-    {
-      case 0:
-      if (ftype == Thrift.Type.STRING) {
-        this.success = input.readString().value;
-      } else {
-        input.skip(ftype);
-      }
-      break;
-      case 0:
-        input.skip(ftype);
-        break;
-      default:
-        input.skip(ftype);
-    }
-    input.readFieldEnd();
-  }
-  input.readStructEnd();
-  return;
-};
-
-Pos_getSalt_result.prototype.write = function(output) {
-  output.writeStructBegin('Pos_getSalt_result');
-  if (this.success) {
-    output.writeFieldBegin('success', Thrift.Type.STRING, 0);
-    output.writeString(this.success);
-    output.writeFieldEnd();
-  }
-  output.writeFieldStop();
-  output.writeStructEnd();
-  return;
-};
-
-Pos_getAccountFromHash_args = function(args) {
-  this.dataToHash = null;
-  if (args) {
-    if (args.dataToHash !== undefined) {
-      this.dataToHash = args.dataToHash;
-    }
-  }
-};
-Pos_getAccountFromHash_args.prototype = {};
-Pos_getAccountFromHash_args.prototype.read = function(input) {
-  input.readStructBegin();
-  while (true)
-  {
-    var ret = input.readFieldBegin();
-    var fname = ret.fname;
-    var ftype = ret.ftype;
-    var fid = ret.fid;
-    if (ftype == Thrift.Type.STOP) {
-      break;
-    }
-    switch (fid)
-    {
-      case 1:
-      if (ftype == Thrift.Type.STRING) {
-        this.dataToHash = input.readString().value;
-      } else {
-        input.skip(ftype);
-      }
-      break;
-      case 0:
-        input.skip(ftype);
-        break;
-      default:
-        input.skip(ftype);
-    }
-    input.readFieldEnd();
-  }
-  input.readStructEnd();
-  return;
-};
-
-Pos_getAccountFromHash_args.prototype.write = function(output) {
-  output.writeStructBegin('Pos_getAccountFromHash_args');
-  if (this.dataToHash) {
-    output.writeFieldBegin('dataToHash', Thrift.Type.STRING, 1);
-    output.writeString(this.dataToHash);
-    output.writeFieldEnd();
-  }
-  output.writeFieldStop();
-  output.writeStructEnd();
-  return;
-};
-
-Pos_getAccountFromHash_result = function(args) {
-  this.success = null;
-  if (args) {
-    if (args.success !== undefined) {
-      this.success = args.success;
-    }
-  }
-};
-Pos_getAccountFromHash_result.prototype = {};
-Pos_getAccountFromHash_result.prototype.read = function(input) {
-  input.readStructBegin();
-  while (true)
-  {
-    var ret = input.readFieldBegin();
-    var fname = ret.fname;
-    var ftype = ret.ftype;
-    var fid = ret.fid;
-    if (ftype == Thrift.Type.STOP) {
-      break;
-    }
-    switch (fid)
-    {
-      case 0:
-      if (ftype == Thrift.Type.I32) {
-        this.success = input.readI32().value;
-      } else {
-        input.skip(ftype);
-      }
-      break;
-      case 0:
-        input.skip(ftype);
-        break;
-      default:
-        input.skip(ftype);
-    }
-    input.readFieldEnd();
-  }
-  input.readStructEnd();
-  return;
-};
-
-Pos_getAccountFromHash_result.prototype.write = function(output) {
-  output.writeStructBegin('Pos_getAccountFromHash_result');
-  if (this.success) {
-    output.writeFieldBegin('success', Thrift.Type.I32, 0);
-    output.writeI32(this.success);
-    output.writeFieldEnd();
-  }
-  output.writeFieldStop();
-  output.writeStructEnd();
-  return;
-};
-
-Pos_getHashesFromAccountId_args = function(args) {
-  this.account = null;
-  if (args) {
-    if (args.account !== undefined) {
-      this.account = args.account;
-    }
-  }
-};
-Pos_getHashesFromAccountId_args.prototype = {};
-Pos_getHashesFromAccountId_args.prototype.read = function(input) {
-  input.readStructBegin();
-  while (true)
-  {
-    var ret = input.readFieldBegin();
-    var fname = ret.fname;
-    var ftype = ret.ftype;
-    var fid = ret.fid;
-    if (ftype == Thrift.Type.STOP) {
-      break;
-    }
-    switch (fid)
-    {
-      case 1:
-      if (ftype == Thrift.Type.I32) {
-        this.account = input.readI32().value;
-      } else {
-        input.skip(ftype);
-      }
-      break;
-      case 0:
-        input.skip(ftype);
-        break;
-      default:
-        input.skip(ftype);
-    }
-    input.readFieldEnd();
-  }
-  input.readStructEnd();
-  return;
-};
-
-Pos_getHashesFromAccountId_args.prototype.write = function(output) {
-  output.writeStructBegin('Pos_getHashesFromAccountId_args');
-  if (this.account) {
-    output.writeFieldBegin('account', Thrift.Type.I32, 1);
-    output.writeI32(this.account);
-    output.writeFieldEnd();
-  }
-  output.writeFieldStop();
-  output.writeStructEnd();
-  return;
-};
-
-Pos_getHashesFromAccountId_result = function(args) {
-  this.success = null;
-  if (args) {
-    if (args.success !== undefined) {
-      this.success = args.success;
-    }
-  }
-};
-Pos_getHashesFromAccountId_result.prototype = {};
-Pos_getHashesFromAccountId_result.prototype.read = function(input) {
-  input.readStructBegin();
-  while (true)
-  {
-    var ret = input.readFieldBegin();
-    var fname = ret.fname;
-    var ftype = ret.ftype;
-    var fid = ret.fid;
-    if (ftype == Thrift.Type.STOP) {
-      break;
-    }
-    switch (fid)
-    {
-      case 0:
-      if (ftype == Thrift.Type.LIST) {
-        var _size0 = 0;
-        var _rtmp34;
-        this.success = [];
-        var _etype3 = 0;
-        _rtmp34 = input.readListBegin();
-        _etype3 = _rtmp34.etype;
-        _size0 = _rtmp34.size;
-        for (var _i5 = 0; _i5 < _size0; ++_i5)
-        {
-          var elem6 = null;
-          elem6 = input.readString().value;
-          this.success.push(elem6);
-        }
-        input.readListEnd();
-      } else {
-        input.skip(ftype);
-      }
-      break;
-      case 0:
-        input.skip(ftype);
-        break;
-      default:
-        input.skip(ftype);
-    }
-    input.readFieldEnd();
-  }
-  input.readStructEnd();
-  return;
-};
-
-Pos_getHashesFromAccountId_result.prototype.write = function(output) {
-  output.writeStructBegin('Pos_getHashesFromAccountId_result');
-  if (this.success) {
-    output.writeFieldBegin('success', Thrift.Type.LIST, 0);
-    output.writeListBegin(Thrift.Type.STRING, this.success.length);
-    for (var iter7 in this.success)
-    {
-      if (this.success.hasOwnProperty(iter7))
-      {
-        iter7 = this.success[iter7];
-        output.writeString(iter7);
-      }
-    }
-    output.writeListEnd();
-    output.writeFieldEnd();
-  }
-  output.writeFieldStop();
-  output.writeStructEnd();
-  return;
-};
-
-Pos_getHashesFromAccountName_args = function(args) {
-  this.account = null;
-  if (args) {
-    if (args.account !== undefined) {
-      this.account = args.account;
-    }
-  }
-};
-Pos_getHashesFromAccountName_args.prototype = {};
-Pos_getHashesFromAccountName_args.prototype.read = function(input) {
-  input.readStructBegin();
-  while (true)
-  {
-    var ret = input.readFieldBegin();
-    var fname = ret.fname;
-    var ftype = ret.ftype;
-    var fid = ret.fid;
-    if (ftype == Thrift.Type.STOP) {
-      break;
-    }
-    switch (fid)
-    {
-      case 1:
-      if (ftype == Thrift.Type.STRING) {
-        this.account = input.readString().value;
-      } else {
-        input.skip(ftype);
-      }
-      break;
-      case 0:
-        input.skip(ftype);
-        break;
-      default:
-        input.skip(ftype);
-    }
-    input.readFieldEnd();
-  }
-  input.readStructEnd();
-  return;
-};
-
-Pos_getHashesFromAccountName_args.prototype.write = function(output) {
-  output.writeStructBegin('Pos_getHashesFromAccountName_args');
-  if (this.account) {
-    output.writeFieldBegin('account', Thrift.Type.STRING, 1);
-    output.writeString(this.account);
-    output.writeFieldEnd();
-  }
-  output.writeFieldStop();
-  output.writeStructEnd();
-  return;
-};
-
-Pos_getHashesFromAccountName_result = function(args) {
-  this.success = null;
-  if (args) {
-    if (args.success !== undefined) {
-      this.success = args.success;
-    }
-  }
-};
-Pos_getHashesFromAccountName_result.prototype = {};
-Pos_getHashesFromAccountName_result.prototype.read = function(input) {
-  input.readStructBegin();
-  while (true)
-  {
-    var ret = input.readFieldBegin();
-    var fname = ret.fname;
-    var ftype = ret.ftype;
-    var fid = ret.fid;
-    if (ftype == Thrift.Type.STOP) {
-      break;
-    }
-    switch (fid)
-    {
-      case 0:
-      if (ftype == Thrift.Type.LIST) {
-        var _size8 = 0;
-        var _rtmp312;
-        this.success = [];
-        var _etype11 = 0;
-        _rtmp312 = input.readListBegin();
-        _etype11 = _rtmp312.etype;
-        _size8 = _rtmp312.size;
-        for (var _i13 = 0; _i13 < _size8; ++_i13)
-        {
-          var elem14 = null;
-          elem14 = input.readString().value;
-          this.success.push(elem14);
-        }
-        input.readListEnd();
-      } else {
-        input.skip(ftype);
-      }
-      break;
-      case 0:
-        input.skip(ftype);
-        break;
-      default:
-        input.skip(ftype);
-    }
-    input.readFieldEnd();
-  }
-  input.readStructEnd();
-  return;
-};
-
-Pos_getHashesFromAccountName_result.prototype.write = function(output) {
-  output.writeStructBegin('Pos_getHashesFromAccountName_result');
-  if (this.success) {
-    output.writeFieldBegin('success', Thrift.Type.LIST, 0);
-    output.writeListBegin(Thrift.Type.STRING, this.success.length);
-    for (var iter15 in this.success)
-    {
-      if (this.success.hasOwnProperty(iter15))
-      {
-        iter15 = this.success[iter15];
-        output.writeString(iter15);
-      }
-    }
-    output.writeListEnd();
-    output.writeFieldEnd();
-  }
-  output.writeFieldStop();
-  output.writeStructEnd();
-  return;
-};
-
-Pos_getHashAccountBalance_args = function(args) {
-  this.dataToHash = null;
-  if (args) {
-    if (args.dataToHash !== undefined) {
-      this.dataToHash = args.dataToHash;
-    }
-  }
-};
-Pos_getHashAccountBalance_args.prototype = {};
-Pos_getHashAccountBalance_args.prototype.read = function(input) {
-  input.readStructBegin();
-  while (true)
-  {
-    var ret = input.readFieldBegin();
-    var fname = ret.fname;
-    var ftype = ret.ftype;
-    var fid = ret.fid;
-    if (ftype == Thrift.Type.STOP) {
-      break;
-    }
-    switch (fid)
-    {
-      case 1:
-      if (ftype == Thrift.Type.STRING) {
-        this.dataToHash = input.readString().value;
-      } else {
-        input.skip(ftype);
-      }
-      break;
-      case 0:
-        input.skip(ftype);
-        break;
-      default:
-        input.skip(ftype);
-    }
-    input.readFieldEnd();
-  }
-  input.readStructEnd();
-  return;
-};
-
-Pos_getHashAccountBalance_args.prototype.write = function(output) {
-  output.writeStructBegin('Pos_getHashAccountBalance_args');
-  if (this.dataToHash) {
-    output.writeFieldBegin('dataToHash', Thrift.Type.STRING, 1);
-    output.writeString(this.dataToHash);
-    output.writeFieldEnd();
-  }
-  output.writeFieldStop();
-  output.writeStructEnd();
-  return;
-};
-
-Pos_getHashAccountBalance_result = function(args) {
-  this.success = null;
-  if (args) {
-    if (args.success !== undefined) {
-      this.success = args.success;
-    }
-  }
-};
-Pos_getHashAccountBalance_result.prototype = {};
-Pos_getHashAccountBalance_result.prototype.read = function(input) {
-  input.readStructBegin();
-  while (true)
-  {
-    var ret = input.readFieldBegin();
-    var fname = ret.fname;
-    var ftype = ret.ftype;
-    var fid = ret.fid;
-    if (ftype == Thrift.Type.STOP) {
-      break;
-    }
-    switch (fid)
-    {
-      case 0:
-      if (ftype == Thrift.Type.I32) {
-        this.success = input.readI32().value;
-      } else {
-        input.skip(ftype);
-      }
-      break;
-      case 0:
-        input.skip(ftype);
-        break;
-      default:
-        input.skip(ftype);
-    }
-    input.readFieldEnd();
-  }
-  input.readStructEnd();
-  return;
-};
-
-Pos_getHashAccountBalance_result.prototype.write = function(output) {
-  output.writeStructBegin('Pos_getHashAccountBalance_result');
-  if (this.success) {
-    output.writeFieldBegin('success', Thrift.Type.I32, 0);
-    output.writeI32(this.success);
-    output.writeFieldEnd();
-  }
-  output.writeFieldStop();
-  output.writeStructEnd();
-  return;
-};
-
-Pos_getIdAccountBalance_args = function(args) {
-  this.account = null;
-  if (args) {
-    if (args.account !== undefined) {
-      this.account = args.account;
-    }
-  }
-};
-Pos_getIdAccountBalance_args.prototype = {};
-Pos_getIdAccountBalance_args.prototype.read = function(input) {
-  input.readStructBegin();
-  while (true)
-  {
-    var ret = input.readFieldBegin();
-    var fname = ret.fname;
-    var ftype = ret.ftype;
-    var fid = ret.fid;
-    if (ftype == Thrift.Type.STOP) {
-      break;
-    }
-    switch (fid)
-    {
-      case 1:
-      if (ftype == Thrift.Type.I32) {
-        this.account = input.readI32().value;
-      } else {
-        input.skip(ftype);
-      }
-      break;
-      case 0:
-        input.skip(ftype);
-        break;
-      default:
-        input.skip(ftype);
-    }
-    input.readFieldEnd();
-  }
-  input.readStructEnd();
-  return;
-};
-
-Pos_getIdAccountBalance_args.prototype.write = function(output) {
-  output.writeStructBegin('Pos_getIdAccountBalance_args');
-  if (this.account) {
-    output.writeFieldBegin('account', Thrift.Type.I32, 1);
-    output.writeI32(this.account);
-    output.writeFieldEnd();
-  }
-  output.writeFieldStop();
-  output.writeStructEnd();
-  return;
-};
-
-Pos_getIdAccountBalance_result = function(args) {
-  this.success = null;
-  if (args) {
-    if (args.success !== undefined) {
-      this.success = args.success;
-    }
-  }
-};
-Pos_getIdAccountBalance_result.prototype = {};
-Pos_getIdAccountBalance_result.prototype.read = function(input) {
-  input.readStructBegin();
-  while (true)
-  {
-    var ret = input.readFieldBegin();
-    var fname = ret.fname;
-    var ftype = ret.ftype;
-    var fid = ret.fid;
-    if (ftype == Thrift.Type.STOP) {
-      break;
-    }
-    switch (fid)
-    {
-      case 0:
-      if (ftype == Thrift.Type.I32) {
-        this.success = input.readI32().value;
-      } else {
-        input.skip(ftype);
-      }
-      break;
-      case 0:
-        input.skip(ftype);
-        break;
-      default:
-        input.skip(ftype);
-    }
-    input.readFieldEnd();
-  }
-  input.readStructEnd();
-  return;
-};
-
-Pos_getIdAccountBalance_result.prototype.write = function(output) {
-  output.writeStructBegin('Pos_getIdAccountBalance_result');
-  if (this.success) {
-    output.writeFieldBegin('success', Thrift.Type.I32, 0);
-    output.writeI32(this.success);
-    output.writeFieldEnd();
-  }
-  output.writeFieldStop();
-  output.writeStructEnd();
-  return;
-};
-
-Pos_getNameAccountBalance_args = function(args) {
-  this.account = null;
-  if (args) {
-    if (args.account !== undefined) {
-      this.account = args.account;
-    }
-  }
-};
-Pos_getNameAccountBalance_args.prototype = {};
-Pos_getNameAccountBalance_args.prototype.read = function(input) {
-  input.readStructBegin();
-  while (true)
-  {
-    var ret = input.readFieldBegin();
-    var fname = ret.fname;
-    var ftype = ret.ftype;
-    var fid = ret.fid;
-    if (ftype == Thrift.Type.STOP) {
-      break;
-    }
-    switch (fid)
-    {
-      case 1:
-      if (ftype == Thrift.Type.STRING) {
-        this.account = input.readString().value;
-      } else {
-        input.skip(ftype);
-      }
-      break;
-      case 0:
-        input.skip(ftype);
-        break;
-      default:
-        input.skip(ftype);
-    }
-    input.readFieldEnd();
-  }
-  input.readStructEnd();
-  return;
-};
-
-Pos_getNameAccountBalance_args.prototype.write = function(output) {
-  output.writeStructBegin('Pos_getNameAccountBalance_args');
-  if (this.account) {
-    output.writeFieldBegin('account', Thrift.Type.STRING, 1);
-    output.writeString(this.account);
-    output.writeFieldEnd();
-  }
-  output.writeFieldStop();
-  output.writeStructEnd();
-  return;
-};
-
-Pos_getNameAccountBalance_result = function(args) {
-  this.success = null;
-  if (args) {
-    if (args.success !== undefined) {
-      this.success = args.success;
-    }
-  }
-};
-Pos_getNameAccountBalance_result.prototype = {};
-Pos_getNameAccountBalance_result.prototype.read = function(input) {
-  input.readStructBegin();
-  while (true)
-  {
-    var ret = input.readFieldBegin();
-    var fname = ret.fname;
-    var ftype = ret.ftype;
-    var fid = ret.fid;
-    if (ftype == Thrift.Type.STOP) {
-      break;
-    }
-    switch (fid)
-    {
-      case 0:
-      if (ftype == Thrift.Type.I32) {
-        this.success = input.readI32().value;
-      } else {
-        input.skip(ftype);
-      }
-      break;
-      case 0:
-        input.skip(ftype);
-        break;
-      default:
-        input.skip(ftype);
-    }
-    input.readFieldEnd();
-  }
-  input.readStructEnd();
-  return;
-};
-
-Pos_getNameAccountBalance_result.prototype.write = function(output) {
-  output.writeStructBegin('Pos_getNameAccountBalance_result');
-  if (this.success) {
-    output.writeFieldBegin('success', Thrift.Type.I32, 0);
-    output.writeI32(this.success);
-    output.writeFieldEnd();
-  }
-  output.writeFieldStop();
-  output.writeStructEnd();
-  return;
-};
-
-Pos_associateHashWithId_args = function(args) {
-  this.auth = null;
-  this.dataToHash = null;
-  this.account = null;
-  if (args) {
-    if (args.auth !== undefined) {
-      this.auth = args.auth;
-    }
-    if (args.dataToHash !== undefined) {
-      this.dataToHash = args.dataToHash;
-    }
-    if (args.account !== undefined) {
-      this.account = args.account;
-    }
-  }
-};
-Pos_associateHashWithId_args.prototype = {};
-Pos_associateHashWithId_args.prototype.read = function(input) {
-  input.readStructBegin();
-  while (true)
-  {
-    var ret = input.readFieldBegin();
-    var fname = ret.fname;
-    var ftype = ret.ftype;
-    var fid = ret.fid;
-    if (ftype == Thrift.Type.STOP) {
-      break;
-    }
-    switch (fid)
-    {
-      case 1:
-      if (ftype == Thrift.Type.STRING) {
-        this.auth = input.readString().value;
-      } else {
-        input.skip(ftype);
-      }
-      break;
-      case 2:
-      if (ftype == Thrift.Type.STRING) {
-        this.dataToHash = input.readString().value;
-      } else {
-        input.skip(ftype);
-      }
-      break;
-      case 3:
-      if (ftype == Thrift.Type.I32) {
-        this.account = input.readI32().value;
-      } else {
-        input.skip(ftype);
-      }
-      break;
-      default:
-        input.skip(ftype);
-    }
-    input.readFieldEnd();
-  }
-  input.readStructEnd();
-  return;
-};
-
-Pos_associateHashWithId_args.prototype.write = function(output) {
-  output.writeStructBegin('Pos_associateHashWithId_args');
-  if (this.auth) {
-    output.writeFieldBegin('auth', Thrift.Type.STRING, 1);
-    output.writeString(this.auth);
-    output.writeFieldEnd();
-  }
-  if (this.dataToHash) {
-    output.writeFieldBegin('dataToHash', Thrift.Type.STRING, 2);
-    output.writeString(this.dataToHash);
-    output.writeFieldEnd();
-  }
-  if (this.account) {
-    output.writeFieldBegin('account', Thrift.Type.I32, 3);
-    output.writeI32(this.account);
-    output.writeFieldEnd();
-  }
-  output.writeFieldStop();
-  output.writeStructEnd();
-  return;
-};
-
-Pos_associateHashWithId_result = function(args) {
-  this.success = null;
-  if (args) {
-    if (args.success !== undefined) {
-      this.success = args.success;
-    }
-  }
-};
-Pos_associateHashWithId_result.prototype = {};
-Pos_associateHashWithId_result.prototype.read = function(input) {
-  input.readStructBegin();
-  while (true)
-  {
-    var ret = input.readFieldBegin();
-    var fname = ret.fname;
-    var ftype = ret.ftype;
-    var fid = ret.fid;
-    if (ftype == Thrift.Type.STOP) {
-      break;
-    }
-    switch (fid)
-    {
-      case 0:
-      if (ftype == Thrift.Type.I64) {
-        this.success = input.readI64().value;
-      } else {
-        input.skip(ftype);
-      }
-      break;
-      case 0:
-        input.skip(ftype);
-        break;
-      default:
-        input.skip(ftype);
-    }
-    input.readFieldEnd();
-  }
-  input.readStructEnd();
-  return;
-};
-
-Pos_associateHashWithId_result.prototype.write = function(output) {
-  output.writeStructBegin('Pos_associateHashWithId_result');
-  if (this.success) {
-    output.writeFieldBegin('success', Thrift.Type.I64, 0);
-    output.writeI64(this.success);
-    output.writeFieldEnd();
-  }
-  output.writeFieldStop();
-  output.writeStructEnd();
-  return;
-};
-
-Pos_associateHashWithName_args = function(args) {
-  this.auth = null;
-  this.dataToHash = null;
-  this.account = null;
-  if (args) {
-    if (args.auth !== undefined) {
-      this.auth = args.auth;
-    }
-    if (args.dataToHash !== undefined) {
-      this.dataToHash = args.dataToHash;
-    }
-    if (args.account !== undefined) {
-      this.account = args.account;
-    }
-  }
-};
-Pos_associateHashWithName_args.prototype = {};
-Pos_associateHashWithName_args.prototype.read = function(input) {
-  input.readStructBegin();
-  while (true)
-  {
-    var ret = input.readFieldBegin();
-    var fname = ret.fname;
-    var ftype = ret.ftype;
-    var fid = ret.fid;
-    if (ftype == Thrift.Type.STOP) {
-      break;
-    }
-    switch (fid)
-    {
-      case 1:
-      if (ftype == Thrift.Type.STRING) {
-        this.auth = input.readString().value;
-      } else {
-        input.skip(ftype);
-      }
-      break;
-      case 2:
-      if (ftype == Thrift.Type.STRING) {
-        this.dataToHash = input.readString().value;
-      } else {
-        input.skip(ftype);
-      }
-      break;
-      case 3:
-      if (ftype == Thrift.Type.STRING) {
-        this.account = input.readString().value;
-      } else {
-        input.skip(ftype);
-      }
-      break;
-      default:
-        input.skip(ftype);
-    }
-    input.readFieldEnd();
-  }
-  input.readStructEnd();
-  return;
-};
-
-Pos_associateHashWithName_args.prototype.write = function(output) {
-  output.writeStructBegin('Pos_associateHashWithName_args');
-  if (this.auth) {
-    output.writeFieldBegin('auth', Thrift.Type.STRING, 1);
-    output.writeString(this.auth);
-    output.writeFieldEnd();
-  }
-  if (this.dataToHash) {
-    output.writeFieldBegin('dataToHash', Thrift.Type.STRING, 2);
-    output.writeString(this.dataToHash);
-    output.writeFieldEnd();
-  }
-  if (this.account) {
-    output.writeFieldBegin('account', Thrift.Type.STRING, 3);
-    output.writeString(this.account);
-    output.writeFieldEnd();
-  }
-  output.writeFieldStop();
-  output.writeStructEnd();
-  return;
-};
-
-Pos_associateHashWithName_result = function(args) {
-  this.success = null;
-  if (args) {
-    if (args.success !== undefined) {
-      this.success = args.success;
-    }
-  }
-};
-Pos_associateHashWithName_result.prototype = {};
-Pos_associateHashWithName_result.prototype.read = function(input) {
-  input.readStructBegin();
-  while (true)
-  {
-    var ret = input.readFieldBegin();
-    var fname = ret.fname;
-    var ftype = ret.ftype;
-    var fid = ret.fid;
-    if (ftype == Thrift.Type.STOP) {
-      break;
-    }
-    switch (fid)
-    {
-      case 0:
-      if (ftype == Thrift.Type.I64) {
-        this.success = input.readI64().value;
-      } else {
-        input.skip(ftype);
-      }
-      break;
-      case 0:
-        input.skip(ftype);
-        break;
-      default:
-        input.skip(ftype);
-    }
-    input.readFieldEnd();
-  }
-  input.readStructEnd();
-  return;
-};
-
-Pos_associateHashWithName_result.prototype.write = function(output) {
-  output.writeStructBegin('Pos_associateHashWithName_result');
-  if (this.success) {
-    output.writeFieldBegin('success', Thrift.Type.I64, 0);
-    output.writeI64(this.success);
-    output.writeFieldEnd();
-  }
-  output.writeFieldStop();
-  output.writeStructEnd();
-  return;
-};
-
-Pos_deassociateHash_args = function(args) {
-  this.auth = null;
-  this.dataToHash = null;
-  if (args) {
-    if (args.auth !== undefined) {
-      this.auth = args.auth;
-    }
-    if (args.dataToHash !== undefined) {
-      this.dataToHash = args.dataToHash;
-    }
-  }
-};
-Pos_deassociateHash_args.prototype = {};
-Pos_deassociateHash_args.prototype.read = function(input) {
-  input.readStructBegin();
-  while (true)
-  {
-    var ret = input.readFieldBegin();
-    var fname = ret.fname;
-    var ftype = ret.ftype;
-    var fid = ret.fid;
-    if (ftype == Thrift.Type.STOP) {
-      break;
-    }
-    switch (fid)
-    {
-      case 1:
-      if (ftype == Thrift.Type.STRING) {
-        this.auth = input.readString().value;
-      } else {
-        input.skip(ftype);
-      }
-      break;
-      case 2:
-      if (ftype == Thrift.Type.STRING) {
-        this.dataToHash = input.readString().value;
-      } else {
-        input.skip(ftype);
-      }
-      break;
-      default:
-        input.skip(ftype);
-    }
-    input.readFieldEnd();
-  }
-  input.readStructEnd();
-  return;
-};
-
-Pos_deassociateHash_args.prototype.write = function(output) {
-  output.writeStructBegin('Pos_deassociateHash_args');
-  if (this.auth) {
-    output.writeFieldBegin('auth', Thrift.Type.STRING, 1);
-    output.writeString(this.auth);
-    output.writeFieldEnd();
-  }
-  if (this.dataToHash) {
-    output.writeFieldBegin('dataToHash', Thrift.Type.STRING, 2);
-    output.writeString(this.dataToHash);
-    output.writeFieldEnd();
-  }
-  output.writeFieldStop();
-  output.writeStructEnd();
-  return;
-};
-
-Pos_deassociateHash_result = function(args) {
-  this.success = null;
-  if (args) {
-    if (args.success !== undefined) {
-      this.success = args.success;
-    }
-  }
-};
-Pos_deassociateHash_result.prototype = {};
-Pos_deassociateHash_result.prototype.read = function(input) {
-  input.readStructBegin();
-  while (true)
-  {
-    var ret = input.readFieldBegin();
-    var fname = ret.fname;
-    var ftype = ret.ftype;
-    var fid = ret.fid;
-    if (ftype == Thrift.Type.STOP) {
-      break;
-    }
-    switch (fid)
-    {
-      case 0:
-      if (ftype == Thrift.Type.I64) {
-        this.success = input.readI64().value;
-      } else {
-        input.skip(ftype);
-      }
-      break;
-      case 0:
-        input.skip(ftype);
-        break;
-      default:
-        input.skip(ftype);
-    }
-    input.readFieldEnd();
-  }
-  input.readStructEnd();
-  return;
-};
-
-Pos_deassociateHash_result.prototype.write = function(output) {
-  output.writeStructBegin('Pos_deassociateHash_result');
-  if (this.success) {
-    output.writeFieldBegin('success', Thrift.Type.I64, 0);
-    output.writeI64(this.success);
-    output.writeFieldEnd();
-  }
-  output.writeFieldStop();
-  output.writeStructEnd();
-  return;
-};
-
-Pos_getUPCPrice_args = function(args) {
-  this.upc = null;
-  if (args) {
-    if (args.upc !== undefined) {
-      this.upc = args.upc;
-    }
-  }
-};
-Pos_getUPCPrice_args.prototype = {};
-Pos_getUPCPrice_args.prototype.read = function(input) {
-  input.readStructBegin();
-  while (true)
-  {
-    var ret = input.readFieldBegin();
-    var fname = ret.fname;
-    var ftype = ret.ftype;
-    var fid = ret.fid;
-    if (ftype == Thrift.Type.STOP) {
-      break;
-    }
-    switch (fid)
-    {
-      case 1:
-      if (ftype == Thrift.Type.I64) {
-        this.upc = input.readI64().value;
-      } else {
-        input.skip(ftype);
-      }
-      break;
-      case 0:
-        input.skip(ftype);
-        break;
-      default:
-        input.skip(ftype);
-    }
-    input.readFieldEnd();
-  }
-  input.readStructEnd();
-  return;
-};
-
-Pos_getUPCPrice_args.prototype.write = function(output) {
-  output.writeStructBegin('Pos_getUPCPrice_args');
-  if (this.upc) {
-    output.writeFieldBegin('upc', Thrift.Type.I64, 1);
-    output.writeI64(this.upc);
-    output.writeFieldEnd();
-  }
-  output.writeFieldStop();
-  output.writeStructEnd();
-  return;
-};
-
-Pos_getUPCPrice_result = function(args) {
-  this.success = null;
-  if (args) {
-    if (args.success !== undefined) {
-      this.success = args.success;
-    }
-  }
-};
-Pos_getUPCPrice_result.prototype = {};
-Pos_getUPCPrice_result.prototype.read = function(input) {
-  input.readStructBegin();
-  while (true)
-  {
-    var ret = input.readFieldBegin();
-    var fname = ret.fname;
-    var ftype = ret.ftype;
-    var fid = ret.fid;
-    if (ftype == Thrift.Type.STOP) {
-      break;
-    }
-    switch (fid)
-    {
-      case 0:
-      if (ftype == Thrift.Type.I32) {
-        this.success = input.readI32().value;
-      } else {
-        input.skip(ftype);
-      }
-      break;
-      case 0:
-        input.skip(ftype);
-        break;
-      default:
-        input.skip(ftype);
-    }
-    input.readFieldEnd();
-  }
-  input.readStructEnd();
-  return;
-};
-
-Pos_getUPCPrice_result.prototype.write = function(output) {
-  output.writeStructBegin('Pos_getUPCPrice_result');
-  if (this.success) {
-    output.writeFieldBegin('success', Thrift.Type.I32, 0);
-    output.writeI32(this.success);
-    output.writeFieldEnd();
-  }
-  output.writeFieldStop();
-  output.writeStructEnd();
-  return;
-};
-
-Pos_setUPCPrice_args = function(args) {
-  this.auth = null;
-  this.upc = null;
-  this.price = null;
-  if (args) {
-    if (args.auth !== undefined) {
-      this.auth = args.auth;
-    }
-    if (args.upc !== undefined) {
-      this.upc = args.upc;
-    }
-    if (args.price !== undefined) {
-      this.price = args.price;
-    }
-  }
-};
-Pos_setUPCPrice_args.prototype = {};
-Pos_setUPCPrice_args.prototype.read = function(input) {
-  input.readStructBegin();
-  while (true)
-  {
-    var ret = input.readFieldBegin();
-    var fname = ret.fname;
-    var ftype = ret.ftype;
-    var fid = ret.fid;
-    if (ftype == Thrift.Type.STOP) {
-      break;
-    }
-    switch (fid)
-    {
-      case 1:
-      if (ftype == Thrift.Type.STRING) {
-        this.auth = input.readString().value;
-      } else {
-        input.skip(ftype);
-      }
-      break;
-      case 2:
-      if (ftype == Thrift.Type.I64) {
-        this.upc = input.readI64().value;
-      } else {
-        input.skip(ftype);
-      }
-      break;
-      case 3:
-      if (ftype == Thrift.Type.I32) {
-        this.price = input.readI32().value;
-      } else {
-        input.skip(ftype);
-      }
-      break;
-      default:
-        input.skip(ftype);
-    }
-    input.readFieldEnd();
-  }
-  input.readStructEnd();
-  return;
-};
-
-Pos_setUPCPrice_args.prototype.write = function(output) {
-  output.writeStructBegin('Pos_setUPCPrice_args');
-  if (this.auth) {
-    output.writeFieldBegin('auth', Thrift.Type.STRING, 1);
-    output.writeString(this.auth);
-    output.writeFieldEnd();
-  }
-  if (this.upc) {
-    output.writeFieldBegin('upc', Thrift.Type.I64, 2);
-    output.writeI64(this.upc);
-    output.writeFieldEnd();
-  }
-  if (this.price) {
-    output.writeFieldBegin('price', Thrift.Type.I32, 3);
-    output.writeI32(this.price);
-    output.writeFieldEnd();
-  }
-  output.writeFieldStop();
-  output.writeStructEnd();
-  return;
-};
-
-Pos_setUPCPrice_result = function(args) {
-  this.success = null;
-  if (args) {
-    if (args.success !== undefined) {
-      this.success = args.success;
-    }
-  }
-};
-Pos_setUPCPrice_result.prototype = {};
-Pos_setUPCPrice_result.prototype.read = function(input) {
-  input.readStructBegin();
-  while (true)
-  {
-    var ret = input.readFieldBegin();
-    var fname = ret.fname;
-    var ftype = ret.ftype;
-    var fid = ret.fid;
-    if (ftype == Thrift.Type.STOP) {
-      break;
-    }
-    switch (fid)
-    {
-      case 0:
-      if (ftype == Thrift.Type.I64) {
-        this.success = input.readI64().value;
-      } else {
-        input.skip(ftype);
-      }
-      break;
-      case 0:
-        input.skip(ftype);
-        break;
-      default:
-        input.skip(ftype);
-    }
-    input.readFieldEnd();
-  }
-  input.readStructEnd();
-  return;
-};
-
-Pos_setUPCPrice_result.prototype.write = function(output) {
-  output.writeStructBegin('Pos_setUPCPrice_result');
-  if (this.success) {
-    output.writeFieldBegin('success', Thrift.Type.I64, 0);
-    output.writeI64(this.success);
-    output.writeFieldEnd();
-  }
-  output.writeFieldStop();
-  output.writeStructEnd();
-  return;
-};
-
-Pos_doTransactionOnHash_args = function(args) {
-  this.auth = null;
-  this.dataToHash = null;
-  this.delta = null;
-  if (args) {
-    if (args.auth !== undefined) {
-      this.auth = args.auth;
-    }
-    if (args.dataToHash !== undefined) {
-      this.dataToHash = args.dataToHash;
-    }
-    if (args.delta !== undefined) {
-      this.delta = args.delta;
-    }
-  }
-};
-Pos_doTransactionOnHash_args.prototype = {};
-Pos_doTransactionOnHash_args.prototype.read = function(input) {
-  input.readStructBegin();
-  while (true)
-  {
-    var ret = input.readFieldBegin();
-    var fname = ret.fname;
-    var ftype = ret.ftype;
-    var fid = ret.fid;
-    if (ftype == Thrift.Type.STOP) {
-      break;
-    }
-    switch (fid)
-    {
-      case 1:
-      if (ftype == Thrift.Type.STRING) {
-        this.auth = input.readString().value;
-      } else {
-        input.skip(ftype);
-      }
-      break;
-      case 2:
-      if (ftype == Thrift.Type.STRING) {
-        this.dataToHash = input.readString().value;
-      } else {
-        input.skip(ftype);
-      }
-      break;
-      case 3:
-      if (ftype == Thrift.Type.I32) {
-        this.delta = input.readI32().value;
-      } else {
-        input.skip(ftype);
-      }
-      break;
-      default:
-        input.skip(ftype);
-    }
-    input.readFieldEnd();
-  }
-  input.readStructEnd();
-  return;
-};
-
-Pos_doTransactionOnHash_args.prototype.write = function(output) {
-  output.writeStructBegin('Pos_doTransactionOnHash_args');
-  if (this.auth) {
-    output.writeFieldBegin('auth', Thrift.Type.STRING, 1);
-    output.writeString(this.auth);
-    output.writeFieldEnd();
-  }
-  if (this.dataToHash) {
-    output.writeFieldBegin('dataToHash', Thrift.Type.STRING, 2);
-    output.writeString(this.dataToHash);
-    output.writeFieldEnd();
-  }
-  if (this.delta) {
-    output.writeFieldBegin('delta', Thrift.Type.I32, 3);
-    output.writeI32(this.delta);
-    output.writeFieldEnd();
-  }
-  output.writeFieldStop();
-  output.writeStructEnd();
-  return;
-};
-
-Pos_doTransactionOnHash_result = function(args) {
-  this.success = null;
-  if (args) {
-    if (args.success !== undefined) {
-      this.success = args.success;
-    }
-  }
-};
-Pos_doTransactionOnHash_result.prototype = {};
-Pos_doTransactionOnHash_result.prototype.read = function(input) {
-  input.readStructBegin();
-  while (true)
-  {
-    var ret = input.readFieldBegin();
-    var fname = ret.fname;
-    var ftype = ret.ftype;
-    var fid = ret.fid;
-    if (ftype == Thrift.Type.STOP) {
-      break;
-    }
-    switch (fid)
-    {
-      case 0:
-      if (ftype == Thrift.Type.I64) {
-        this.success = input.readI64().value;
-      } else {
-        input.skip(ftype);
-      }
-      break;
-      case 0:
-        input.skip(ftype);
-        break;
-      default:
-        input.skip(ftype);
-    }
-    input.readFieldEnd();
-  }
-  input.readStructEnd();
-  return;
-};
-
-Pos_doTransactionOnHash_result.prototype.write = function(output) {
-  output.writeStructBegin('Pos_doTransactionOnHash_result');
-  if (this.success) {
-    output.writeFieldBegin('success', Thrift.Type.I64, 0);
-    output.writeI64(this.success);
-    output.writeFieldEnd();
-  }
-  output.writeFieldStop();
-  output.writeStructEnd();
-  return;
-};
-
-Pos_doTransactionOnId_args = function(args) {
-  this.auth = null;
-  this.account = null;
-  this.delta = null;
-  if (args) {
-    if (args.auth !== undefined) {
-      this.auth = args.auth;
-    }
-    if (args.account !== undefined) {
-      this.account = args.account;
-    }
-    if (args.delta !== undefined) {
-      this.delta = args.delta;
-    }
-  }
-};
-Pos_doTransactionOnId_args.prototype = {};
-Pos_doTransactionOnId_args.prototype.read = function(input) {
-  input.readStructBegin();
-  while (true)
-  {
-    var ret = input.readFieldBegin();
-    var fname = ret.fname;
-    var ftype = ret.ftype;
-    var fid = ret.fid;
-    if (ftype == Thrift.Type.STOP) {
-      break;
-    }
-    switch (fid)
-    {
-      case 1:
-      if (ftype == Thrift.Type.STRING) {
-        this.auth = input.readString().value;
-      } else {
-        input.skip(ftype);
-      }
-      break;
-      case 2:
-      if (ftype == Thrift.Type.I32) {
-        this.account = input.readI32().value;
-      } else {
-        input.skip(ftype);
-      }
-      break;
-      case 3:
-      if (ftype == Thrift.Type.I32) {
-        this.delta = input.readI32().value;
-      } else {
-        input.skip(ftype);
-      }
-      break;
-      default:
-        input.skip(ftype);
-    }
-    input.readFieldEnd();
-  }
-  input.readStructEnd();
-  return;
-};
-
-Pos_doTransactionOnId_args.prototype.write = function(output) {
-  output.writeStructBegin('Pos_doTransactionOnId_args');
-  if (this.auth) {
-    output.writeFieldBegin('auth', Thrift.Type.STRING, 1);
-    output.writeString(this.auth);
-    output.writeFieldEnd();
-  }
-  if (this.account) {
-    output.writeFieldBegin('account', Thrift.Type.I32, 2);
-    output.writeI32(this.account);
-    output.writeFieldEnd();
-  }
-  if (this.delta) {
-    output.writeFieldBegin('delta', Thrift.Type.I32, 3);
-    output.writeI32(this.delta);
-    output.writeFieldEnd();
-  }
-  output.writeFieldStop();
-  output.writeStructEnd();
-  return;
-};
-
-Pos_doTransactionOnId_result = function(args) {
-  this.success = null;
-  if (args) {
-    if (args.success !== undefined) {
-      this.success = args.success;
-    }
-  }
-};
-Pos_doTransactionOnId_result.prototype = {};
-Pos_doTransactionOnId_result.prototype.read = function(input) {
-  input.readStructBegin();
-  while (true)
-  {
-    var ret = input.readFieldBegin();
-    var fname = ret.fname;
-    var ftype = ret.ftype;
-    var fid = ret.fid;
-    if (ftype == Thrift.Type.STOP) {
-      break;
-    }
-    switch (fid)
-    {
-      case 0:
-      if (ftype == Thrift.Type.I64) {
-        this.success = input.readI64().value;
-      } else {
-        input.skip(ftype);
-      }
-      break;
-      case 0:
-        input.skip(ftype);
-        break;
-      default:
-        input.skip(ftype);
-    }
-    input.readFieldEnd();
-  }
-  input.readStructEnd();
-  return;
-};
-
-Pos_doTransactionOnId_result.prototype.write = function(output) {
-  output.writeStructBegin('Pos_doTransactionOnId_result');
-  if (this.success) {
-    output.writeFieldBegin('success', Thrift.Type.I64, 0);
-    output.writeI64(this.success);
-    output.writeFieldEnd();
-  }
-  output.writeFieldStop();
-  output.writeStructEnd();
-  return;
-};
-
-Pos_doTransactionOnName_args = function(args) {
-  this.auth = null;
-  this.account = null;
-  this.delta = null;
-  if (args) {
-    if (args.auth !== undefined) {
-      this.auth = args.auth;
-    }
-    if (args.account !== undefined) {
-      this.account = args.account;
-    }
-    if (args.delta !== undefined) {
-      this.delta = args.delta;
-    }
-  }
-};
-Pos_doTransactionOnName_args.prototype = {};
-Pos_doTransactionOnName_args.prototype.read = function(input) {
-  input.readStructBegin();
-  while (true)
-  {
-    var ret = input.readFieldBegin();
-    var fname = ret.fname;
-    var ftype = ret.ftype;
-    var fid = ret.fid;
-    if (ftype == Thrift.Type.STOP) {
-      break;
-    }
-    switch (fid)
-    {
-      case 1:
-      if (ftype == Thrift.Type.STRING) {
-        this.auth = input.readString().value;
-      } else {
-        input.skip(ftype);
-      }
-      break;
-      case 2:
-      if (ftype == Thrift.Type.STRING) {
-        this.account = input.readString().value;
-      } else {
-        input.skip(ftype);
-      }
-      break;
-      case 3:
-      if (ftype == Thrift.Type.I32) {
-        this.delta = input.readI32().value;
-      } else {
-        input.skip(ftype);
-      }
-      break;
-      default:
-        input.skip(ftype);
-    }
-    input.readFieldEnd();
-  }
-  input.readStructEnd();
-  return;
-};
-
-Pos_doTransactionOnName_args.prototype.write = function(output) {
-  output.writeStructBegin('Pos_doTransactionOnName_args');
-  if (this.auth) {
-    output.writeFieldBegin('auth', Thrift.Type.STRING, 1);
-    output.writeString(this.auth);
-    output.writeFieldEnd();
-  }
-  if (this.account) {
-    output.writeFieldBegin('account', Thrift.Type.STRING, 2);
-    output.writeString(this.account);
-    output.writeFieldEnd();
-  }
-  if (this.delta) {
-    output.writeFieldBegin('delta', Thrift.Type.I32, 3);
-    output.writeI32(this.delta);
-    output.writeFieldEnd();
-  }
-  output.writeFieldStop();
-  output.writeStructEnd();
-  return;
-};
-
-Pos_doTransactionOnName_result = function(args) {
-  this.success = null;
-  if (args) {
-    if (args.success !== undefined) {
-      this.success = args.success;
-    }
-  }
-};
-Pos_doTransactionOnName_result.prototype = {};
-Pos_doTransactionOnName_result.prototype.read = function(input) {
-  input.readStructBegin();
-  while (true)
-  {
-    var ret = input.readFieldBegin();
-    var fname = ret.fname;
-    var ftype = ret.ftype;
-    var fid = ret.fid;
-    if (ftype == Thrift.Type.STOP) {
-      break;
-    }
-    switch (fid)
-    {
-      case 0:
-      if (ftype == Thrift.Type.I64) {
-        this.success = input.readI64().value;
-      } else {
-        input.skip(ftype);
-      }
-      break;
-      case 0:
-        input.skip(ftype);
-        break;
-      default:
-        input.skip(ftype);
-    }
-    input.readFieldEnd();
-  }
-  input.readStructEnd();
-  return;
-};
-
-Pos_doTransactionOnName_result.prototype.write = function(output) {
-  output.writeStructBegin('Pos_doTransactionOnName_result');
-  if (this.success) {
-    output.writeFieldBegin('success', Thrift.Type.I64, 0);
-    output.writeI64(this.success);
-    output.writeFieldEnd();
-  }
-  output.writeFieldStop();
-  output.writeStructEnd();
-  return;
-};
-
-Pos_revertTransaction_args = function(args) {
-  this.auth = null;
-  this.serial = null;
-  if (args) {
-    if (args.auth !== undefined) {
-      this.auth = args.auth;
-    }
-    if (args.serial !== undefined) {
-      this.serial = args.serial;
-    }
-  }
-};
-Pos_revertTransaction_args.prototype = {};
-Pos_revertTransaction_args.prototype.read = function(input) {
-  input.readStructBegin();
-  while (true)
-  {
-    var ret = input.readFieldBegin();
-    var fname = ret.fname;
-    var ftype = ret.ftype;
-    var fid = ret.fid;
-    if (ftype == Thrift.Type.STOP) {
-      break;
-    }
-    switch (fid)
-    {
-      case 1:
-      if (ftype == Thrift.Type.STRING) {
-        this.auth = input.readString().value;
-      } else {
-        input.skip(ftype);
-      }
-      break;
-      case 2:
-      if (ftype == Thrift.Type.I64) {
-        this.serial = input.readI64().value;
-      } else {
-        input.skip(ftype);
-      }
-      break;
-      default:
-        input.skip(ftype);
-    }
-    input.readFieldEnd();
-  }
-  input.readStructEnd();
-  return;
-};
-
-Pos_revertTransaction_args.prototype.write = function(output) {
-  output.writeStructBegin('Pos_revertTransaction_args');
-  if (this.auth) {
-    output.writeFieldBegin('auth', Thrift.Type.STRING, 1);
-    output.writeString(this.auth);
-    output.writeFieldEnd();
-  }
-  if (this.serial) {
-    output.writeFieldBegin('serial', Thrift.Type.I64, 2);
-    output.writeI64(this.serial);
-    output.writeFieldEnd();
-  }
-  output.writeFieldStop();
-  output.writeStructEnd();
-  return;
-};
-
-Pos_revertTransaction_result = function(args) {
-  this.success = null;
-  if (args) {
-    if (args.success !== undefined) {
-      this.success = args.success;
-    }
-  }
-};
-Pos_revertTransaction_result.prototype = {};
-Pos_revertTransaction_result.prototype.read = function(input) {
-  input.readStructBegin();
-  while (true)
-  {
-    var ret = input.readFieldBegin();
-    var fname = ret.fname;
-    var ftype = ret.ftype;
-    var fid = ret.fid;
-    if (ftype == Thrift.Type.STOP) {
-      break;
-    }
-    switch (fid)
-    {
-      case 0:
-      if (ftype == Thrift.Type.I64) {
-        this.success = input.readI64().value;
-      } else {
-        input.skip(ftype);
-      }
-      break;
-      case 0:
-        input.skip(ftype);
-        break;
-      default:
-        input.skip(ftype);
-    }
-    input.readFieldEnd();
-  }
-  input.readStructEnd();
-  return;
-};
-
-Pos_revertTransaction_result.prototype.write = function(output) {
-  output.writeStructBegin('Pos_revertTransaction_result');
-  if (this.success) {
-    output.writeFieldBegin('success', Thrift.Type.I64, 0);
-    output.writeI64(this.success);
-    output.writeFieldEnd();
-  }
-  output.writeFieldStop();
-  output.writeStructEnd();
-  return;
-};
-
-Pos_getStock_args = function(args) {
-  this.upc = null;
-  if (args) {
-    if (args.upc !== undefined) {
-      this.upc = args.upc;
-    }
-  }
-};
-Pos_getStock_args.prototype = {};
-Pos_getStock_args.prototype.read = function(input) {
-  input.readStructBegin();
-  while (true)
-  {
-    var ret = input.readFieldBegin();
-    var fname = ret.fname;
-    var ftype = ret.ftype;
-    var fid = ret.fid;
-    if (ftype == Thrift.Type.STOP) {
-      break;
-    }
-    switch (fid)
-    {
-      case 1:
-      if (ftype == Thrift.Type.I64) {
-        this.upc = input.readI64().value;
-      } else {
-        input.skip(ftype);
-      }
-      break;
-      case 0:
-        input.skip(ftype);
-        break;
-      default:
-        input.skip(ftype);
-    }
-    input.readFieldEnd();
-  }
-  input.readStructEnd();
-  return;
-};
-
-Pos_getStock_args.prototype.write = function(output) {
-  output.writeStructBegin('Pos_getStock_args');
-  if (this.upc) {
-    output.writeFieldBegin('upc', Thrift.Type.I64, 1);
-    output.writeI64(this.upc);
-    output.writeFieldEnd();
-  }
-  output.writeFieldStop();
-  output.writeStructEnd();
-  return;
-};
-
-Pos_getStock_result = function(args) {
-  this.success = null;
-  if (args) {
-    if (args.success !== undefined) {
-      this.success = args.success;
-    }
-  }
-};
-Pos_getStock_result.prototype = {};
-Pos_getStock_result.prototype.read = function(input) {
-  input.readStructBegin();
-  while (true)
-  {
-    var ret = input.readFieldBegin();
-    var fname = ret.fname;
-    var ftype = ret.ftype;
-    var fid = ret.fid;
-    if (ftype == Thrift.Type.STOP) {
-      break;
-    }
-    switch (fid)
-    {
-      case 0:
-      if (ftype == Thrift.Type.I32) {
-        this.success = input.readI32().value;
-      } else {
-        input.skip(ftype);
-      }
-      break;
-      case 0:
-        input.skip(ftype);
-        break;
-      default:
-        input.skip(ftype);
-    }
-    input.readFieldEnd();
-  }
-  input.readStructEnd();
-  return;
-};
-
-Pos_getStock_result.prototype.write = function(output) {
-  output.writeStructBegin('Pos_getStock_result');
-  if (this.success) {
-    output.writeFieldBegin('success', Thrift.Type.I32, 0);
-    output.writeI32(this.success);
-    output.writeFieldEnd();
-  }
-  output.writeFieldStop();
-  output.writeStructEnd();
-  return;
-};
-
-Pos_doStockChange_args = function(args) {
-  this.auth = null;
-  this.upc = null;
-  this.delta = null;
-  if (args) {
-    if (args.auth !== undefined) {
-      this.auth = args.auth;
-    }
-    if (args.upc !== undefined) {
-      this.upc = args.upc;
-    }
-    if (args.delta !== undefined) {
-      this.delta = args.delta;
-    }
-  }
-};
-Pos_doStockChange_args.prototype = {};
-Pos_doStockChange_args.prototype.read = function(input) {
-  input.readStructBegin();
-  while (true)
-  {
-    var ret = input.readFieldBegin();
-    var fname = ret.fname;
-    var ftype = ret.ftype;
-    var fid = ret.fid;
-    if (ftype == Thrift.Type.STOP) {
-      break;
-    }
-    switch (fid)
-    {
-      case 1:
-      if (ftype == Thrift.Type.STRING) {
-        this.auth = input.readString().value;
-      } else {
-        input.skip(ftype);
-      }
-      break;
-      case 2:
-      if (ftype == Thrift.Type.I64) {
-        this.upc = input.readI64().value;
-      } else {
-        input.skip(ftype);
-      }
-      break;
-      case 3:
-      if (ftype == Thrift.Type.I32) {
-        this.delta = input.readI32().value;
-      } else {
-        input.skip(ftype);
-      }
-      break;
-      default:
-        input.skip(ftype);
-    }
-    input.readFieldEnd();
-  }
-  input.readStructEnd();
-  return;
-};
-
-Pos_doStockChange_args.prototype.write = function(output) {
-  output.writeStructBegin('Pos_doStockChange_args');
-  if (this.auth) {
-    output.writeFieldBegin('auth', Thrift.Type.STRING, 1);
-    output.writeString(this.auth);
-    output.writeFieldEnd();
-  }
-  if (this.upc) {
-    output.writeFieldBegin('upc', Thrift.Type.I64, 2);
-    output.writeI64(this.upc);
-    output.writeFieldEnd();
-  }
-  if (this.delta) {
-    output.writeFieldBegin('delta', Thrift.Type.I32, 3);
-    output.writeI32(this.delta);
-    output.writeFieldEnd();
-  }
-  output.writeFieldStop();
-  output.writeStructEnd();
-  return;
-};
-
-Pos_doStockChange_result = function(args) {
-  this.success = null;
-  if (args) {
-    if (args.success !== undefined) {
-      this.success = args.success;
-    }
-  }
-};
-Pos_doStockChange_result.prototype = {};
-Pos_doStockChange_result.prototype.read = function(input) {
-  input.readStructBegin();
-  while (true)
-  {
-    var ret = input.readFieldBegin();
-    var fname = ret.fname;
-    var ftype = ret.ftype;
-    var fid = ret.fid;
-    if (ftype == Thrift.Type.STOP) {
-      break;
-    }
-    switch (fid)
-    {
-      case 0:
-      if (ftype == Thrift.Type.I64) {
-        this.success = input.readI64().value;
-      } else {
-        input.skip(ftype);
-      }
-      break;
-      case 0:
-        input.skip(ftype);
-        break;
-      default:
-        input.skip(ftype);
-    }
-    input.readFieldEnd();
-  }
-  input.readStructEnd();
-  return;
-};
-
-Pos_doStockChange_result.prototype.write = function(output) {
-  output.writeStructBegin('Pos_doStockChange_result');
-  if (this.success) {
-    output.writeFieldBegin('success', Thrift.Type.I64, 0);
-    output.writeI64(this.success);
-    output.writeFieldEnd();
-  }
-  output.writeFieldStop();
-  output.writeStructEnd();
-  return;
-};
-
-Pos_toString_args = function(args) {
-};
-Pos_toString_args.prototype = {};
-Pos_toString_args.prototype.read = function(input) {
-  input.readStructBegin();
-  while (true)
-  {
-    var ret = input.readFieldBegin();
-    var fname = ret.fname;
-    var ftype = ret.ftype;
-    var fid = ret.fid;
-    if (ftype == Thrift.Type.STOP) {
-      break;
-    }
-    input.skip(ftype);
-    input.readFieldEnd();
-  }
-  input.readStructEnd();
-  return;
-};
-
-Pos_toString_args.prototype.write = function(output) {
-  output.writeStructBegin('Pos_toString_args');
-  output.writeFieldStop();
-  output.writeStructEnd();
-  return;
-};
-
-Pos_toString_result = function(args) {
-  this.success = null;
-  if (args) {
-    if (args.success !== undefined) {
-      this.success = args.success;
-    }
-  }
-};
-Pos_toString_result.prototype = {};
-Pos_toString_result.prototype.read = function(input) {
-  input.readStructBegin();
-  while (true)
-  {
-    var ret = input.readFieldBegin();
-    var fname = ret.fname;
-    var ftype = ret.ftype;
-    var fid = ret.fid;
-    if (ftype == Thrift.Type.STOP) {
-      break;
-    }
-    switch (fid)
-    {
-      case 0:
-      if (ftype == Thrift.Type.LIST) {
-        var _size16 = 0;
-        var _rtmp320;
-        this.success = [];
-        var _etype19 = 0;
-        _rtmp320 = input.readListBegin();
-        _etype19 = _rtmp320.etype;
-        _size16 = _rtmp320.size;
-        for (var _i21 = 0; _i21 < _size16; ++_i21)
-        {
-          var elem22 = null;
-          elem22 = input.readString().value;
-          this.success.push(elem22);
-        }
-        input.readListEnd();
-      } else {
-        input.skip(ftype);
-      }
-      break;
-      case 0:
-        input.skip(ftype);
-        break;
-      default:
-        input.skip(ftype);
-    }
-    input.readFieldEnd();
-  }
-  input.readStructEnd();
-  return;
-};
-
-Pos_toString_result.prototype.write = function(output) {
-  output.writeStructBegin('Pos_toString_result');
-  if (this.success) {
-    output.writeFieldBegin('success', Thrift.Type.LIST, 0);
-    output.writeListBegin(Thrift.Type.STRING, this.success.length);
-    for (var iter23 in this.success)
-    {
-      if (this.success.hasOwnProperty(iter23))
-      {
-        iter23 = this.success[iter23];
-        output.writeString(iter23);
-      }
-    }
-    output.writeListEnd();
-    output.writeFieldEnd();
-  }
-  output.writeFieldStop();
-  output.writeStructEnd();
-  return;
-};
-
-PosClient = function(input, output) {
-    this.input = input;
-    this.output = (!output) ? input : output;
-    this.seqid = 0;
-};
-PosClient.prototype = {};
-PosClient.prototype.ping = function(callback) {
-  if (callback === undefined) {
-    this.send_ping();
-    this.recv_ping();
-  } else {
-    var postData = this.send_ping(true);
-    return this.output.getTransport()
-      .jqRequest(this, postData, arguments, this.recv_ping);
-  }
-};
-
-PosClient.prototype.send_ping = function(callback) {
-  this.output.writeMessageBegin('ping', Thrift.MessageType.CALL, this.seqid);
-  var args = new Pos_ping_args();
-  args.write(this.output);
-  this.output.writeMessageEnd();
-  return this.output.getTransport().flush(callback);
-};
-
-PosClient.prototype.recv_ping = function() {
-  var ret = this.input.readMessageBegin();
-  var fname = ret.fname;
-  var mtype = ret.mtype;
-  var rseqid = ret.rseqid;
-  if (mtype == Thrift.MessageType.EXCEPTION) {
-    var x = new Thrift.TApplicationException();
-    x.read(this.input);
-    this.input.readMessageEnd();
-    throw x;
-  }
-  var result = new Pos_ping_result();
-  result.read(this.input);
-  this.input.readMessageEnd();
-
-  return;
-};
-PosClient.prototype.getSalt = function(callback) {
-  if (callback === undefined) {
-    this.send_getSalt();
-    return this.recv_getSalt();
-  } else {
-    var postData = this.send_getSalt(true);
-    return this.output.getTransport()
-      .jqRequest(this, postData, arguments, this.recv_getSalt);
-  }
-};
-
-PosClient.prototype.send_getSalt = function(callback) {
-  this.output.writeMessageBegin('getSalt', Thrift.MessageType.CALL, this.seqid);
-  var args = new Pos_getSalt_args();
-  args.write(this.output);
-  this.output.writeMessageEnd();
-  return this.output.getTransport().flush(callback);
-};
-
-PosClient.prototype.recv_getSalt = function() {
-  var ret = this.input.readMessageBegin();
-  var fname = ret.fname;
-  var mtype = ret.mtype;
-  var rseqid = ret.rseqid;
-  if (mtype == Thrift.MessageType.EXCEPTION) {
-    var x = new Thrift.TApplicationException();
-    x.read(this.input);
-    this.input.readMessageEnd();
-    throw x;
-  }
-  var result = new Pos_getSalt_result();
-  result.read(this.input);
-  this.input.readMessageEnd();
-
-  if (null !== result.success) {
-    return result.success;
-  }
-  throw 'getSalt failed: unknown result';
-};
-PosClient.prototype.getAccountFromHash = function(dataToHash, callback) {
-  if (callback === undefined) {
-    this.send_getAccountFromHash(dataToHash);
-    return this.recv_getAccountFromHash();
-  } else {
-    var postData = this.send_getAccountFromHash(dataToHash, true);
-    return this.output.getTransport()
-      .jqRequest(this, postData, arguments, this.recv_getAccountFromHash);
-  }
-};
-
-PosClient.prototype.send_getAccountFromHash = function(dataToHash, callback) {
-  this.output.writeMessageBegin('getAccountFromHash', Thrift.MessageType.CALL, this.seqid);
-  var args = new Pos_getAccountFromHash_args();
-  args.dataToHash = dataToHash;
-  args.write(this.output);
-  this.output.writeMessageEnd();
-  return this.output.getTransport().flush(callback);
-};
-
-PosClient.prototype.recv_getAccountFromHash = function() {
-  var ret = this.input.readMessageBegin();
-  var fname = ret.fname;
-  var mtype = ret.mtype;
-  var rseqid = ret.rseqid;
-  if (mtype == Thrift.MessageType.EXCEPTION) {
-    var x = new Thrift.TApplicationException();
-    x.read(this.input);
-    this.input.readMessageEnd();
-    throw x;
-  }
-  var result = new Pos_getAccountFromHash_result();
-  result.read(this.input);
-  this.input.readMessageEnd();
-
-  if (null !== result.success) {
-    return result.success;
-  }
-  throw 'getAccountFromHash failed: unknown result';
-};
-PosClient.prototype.getHashesFromAccountId = function(account, callback) {
-  if (callback === undefined) {
-    this.send_getHashesFromAccountId(account);
-    return this.recv_getHashesFromAccountId();
-  } else {
-    var postData = this.send_getHashesFromAccountId(account, true);
-    return this.output.getTransport()
-      .jqRequest(this, postData, arguments, this.recv_getHashesFromAccountId);
-  }
-};
-
-PosClient.prototype.send_getHashesFromAccountId = function(account, callback) {
-  this.output.writeMessageBegin('getHashesFromAccountId', Thrift.MessageType.CALL, this.seqid);
-  var args = new Pos_getHashesFromAccountId_args();
-  args.account = account;
-  args.write(this.output);
-  this.output.writeMessageEnd();
-  return this.output.getTransport().flush(callback);
-};
-
-PosClient.prototype.recv_getHashesFromAccountId = function() {
-  var ret = this.input.readMessageBegin();
-  var fname = ret.fname;
-  var mtype = ret.mtype;
-  var rseqid = ret.rseqid;
-  if (mtype == Thrift.MessageType.EXCEPTION) {
-    var x = new Thrift.TApplicationException();
-    x.read(this.input);
-    this.input.readMessageEnd();
-    throw x;
-  }
-  var result = new Pos_getHashesFromAccountId_result();
-  result.read(this.input);
-  this.input.readMessageEnd();
-
-  if (null !== result.success) {
-    return result.success;
-  }
-  throw 'getHashesFromAccountId failed: unknown result';
-};
-PosClient.prototype.getHashesFromAccountName = function(account, callback) {
-  if (callback === undefined) {
-    this.send_getHashesFromAccountName(account);
-    return this.recv_getHashesFromAccountName();
-  } else {
-    var postData = this.send_getHashesFromAccountName(account, true);
-    return this.output.getTransport()
-      .jqRequest(this, postData, arguments, this.recv_getHashesFromAccountName);
-  }
-};
-
-PosClient.prototype.send_getHashesFromAccountName = function(account, callback) {
-  this.output.writeMessageBegin('getHashesFromAccountName', Thrift.MessageType.CALL, this.seqid);
-  var args = new Pos_getHashesFromAccountName_args();
-  args.account = account;
-  args.write(this.output);
-  this.output.writeMessageEnd();
-  return this.output.getTransport().flush(callback);
-};
-
-PosClient.prototype.recv_getHashesFromAccountName = function() {
-  var ret = this.input.readMessageBegin();
-  var fname = ret.fname;
-  var mtype = ret.mtype;
-  var rseqid = ret.rseqid;
-  if (mtype == Thrift.MessageType.EXCEPTION) {
-    var x = new Thrift.TApplicationException();
-    x.read(this.input);
-    this.input.readMessageEnd();
-    throw x;
-  }
-  var result = new Pos_getHashesFromAccountName_result();
-  result.read(this.input);
-  this.input.readMessageEnd();
-
-  if (null !== result.success) {
-    return result.success;
-  }
-  throw 'getHashesFromAccountName failed: unknown result';
-};
-PosClient.prototype.getHashAccountBalance = function(dataToHash, callback) {
-  if (callback === undefined) {
-    this.send_getHashAccountBalance(dataToHash);
-    return this.recv_getHashAccountBalance();
-  } else {
-    var postData = this.send_getHashAccountBalance(dataToHash, true);
-    return this.output.getTransport()
-      .jqRequest(this, postData, arguments, this.recv_getHashAccountBalance);
-  }
-};
-
-PosClient.prototype.send_getHashAccountBalance = function(dataToHash, callback) {
-  this.output.writeMessageBegin('getHashAccountBalance', Thrift.MessageType.CALL, this.seqid);
-  var args = new Pos_getHashAccountBalance_args();
-  args.dataToHash = dataToHash;
-  args.write(this.output);
-  this.output.writeMessageEnd();
-  return this.output.getTransport().flush(callback);
-};
-
-PosClient.prototype.recv_getHashAccountBalance = function() {
-  var ret = this.input.readMessageBegin();
-  var fname = ret.fname;
-  var mtype = ret.mtype;
-  var rseqid = ret.rseqid;
-  if (mtype == Thrift.MessageType.EXCEPTION) {
-    var x = new Thrift.TApplicationException();
-    x.read(this.input);
-    this.input.readMessageEnd();
-    throw x;
-  }
-  var result = new Pos_getHashAccountBalance_result();
-  result.read(this.input);
-  this.input.readMessageEnd();
-
-  if (null !== result.success) {
-    return result.success;
-  }
-  throw 'getHashAccountBalance failed: unknown result';
-};
-PosClient.prototype.getIdAccountBalance = function(account, callback) {
-  if (callback === undefined) {
-    this.send_getIdAccountBalance(account);
-    return this.recv_getIdAccountBalance();
-  } else {
-    var postData = this.send_getIdAccountBalance(account, true);
-    return this.output.getTransport()
-      .jqRequest(this, postData, arguments, this.recv_getIdAccountBalance);
-  }
-};
-
-PosClient.prototype.send_getIdAccountBalance = function(account, callback) {
-  this.output.writeMessageBegin('getIdAccountBalance', Thrift.MessageType.CALL, this.seqid);
-  var args = new Pos_getIdAccountBalance_args();
-  args.account = account;
-  args.write(this.output);
-  this.output.writeMessageEnd();
-  return this.output.getTransport().flush(callback);
-};
-
-PosClient.prototype.recv_getIdAccountBalance = function() {
-  var ret = this.input.readMessageBegin();
-  var fname = ret.fname;
-  var mtype = ret.mtype;
-  var rseqid = ret.rseqid;
-  if (mtype == Thrift.MessageType.EXCEPTION) {
-    var x = new Thrift.TApplicationException();
-    x.read(this.input);
-    this.input.readMessageEnd();
-    throw x;
-  }
-  var result = new Pos_getIdAccountBalance_result();
-  result.read(this.input);
-  this.input.readMessageEnd();
-
-  if (null !== result.success) {
-    return result.success;
-  }
-  throw 'getIdAccountBalance failed: unknown result';
-};
-PosClient.prototype.getNameAccountBalance = function(account, callback) {
-  if (callback === undefined) {
-    this.send_getNameAccountBalance(account);
-    return this.recv_getNameAccountBalance();
-  } else {
-    var postData = this.send_getNameAccountBalance(account, true);
-    return this.output.getTransport()
-      .jqRequest(this, postData, arguments, this.recv_getNameAccountBalance);
-  }
-};
-
-PosClient.prototype.send_getNameAccountBalance = function(account, callback) {
-  this.output.writeMessageBegin('getNameAccountBalance', Thrift.MessageType.CALL, this.seqid);
-  var args = new Pos_getNameAccountBalance_args();
-  args.account = account;
-  args.write(this.output);
-  this.output.writeMessageEnd();
-  return this.output.getTransport().flush(callback);
-};
-
-PosClient.prototype.recv_getNameAccountBalance = function() {
-  var ret = this.input.readMessageBegin();
-  var fname = ret.fname;
-  var mtype = ret.mtype;
-  var rseqid = ret.rseqid;
-  if (mtype == Thrift.MessageType.EXCEPTION) {
-    var x = new Thrift.TApplicationException();
-    x.read(this.input);
-    this.input.readMessageEnd();
-    throw x;
-  }
-  var result = new Pos_getNameAccountBalance_result();
-  result.read(this.input);
-  this.input.readMessageEnd();
-
-  if (null !== result.success) {
-    return result.success;
-  }
-  throw 'getNameAccountBalance failed: unknown result';
-};
-PosClient.prototype.associateHashWithId = function(auth, dataToHash, account, callback) {
-  if (callback === undefined) {
-    this.send_associateHashWithId(auth, dataToHash, account);
-    return this.recv_associateHashWithId();
-  } else {
-    var postData = this.send_associateHashWithId(auth, dataToHash, account, true);
-    return this.output.getTransport()
-      .jqRequest(this, postData, arguments, this.recv_associateHashWithId);
-  }
-};
-
-PosClient.prototype.send_associateHashWithId = function(auth, dataToHash, account, callback) {
-  this.output.writeMessageBegin('associateHashWithId', Thrift.MessageType.CALL, this.seqid);
-  var args = new Pos_associateHashWithId_args();
-  args.auth = auth;
-  args.dataToHash = dataToHash;
-  args.account = account;
-  args.write(this.output);
-  this.output.writeMessageEnd();
-  return this.output.getTransport().flush(callback);
-};
-
-PosClient.prototype.recv_associateHashWithId = function() {
-  var ret = this.input.readMessageBegin();
-  var fname = ret.fname;
-  var mtype = ret.mtype;
-  var rseqid = ret.rseqid;
-  if (mtype == Thrift.MessageType.EXCEPTION) {
-    var x = new Thrift.TApplicationException();
-    x.read(this.input);
-    this.input.readMessageEnd();
-    throw x;
-  }
-  var result = new Pos_associateHashWithId_result();
-  result.read(this.input);
-  this.input.readMessageEnd();
-
-  if (null !== result.success) {
-    return result.success;
-  }
-  throw 'associateHashWithId failed: unknown result';
-};
-PosClient.prototype.associateHashWithName = function(auth, dataToHash, account, callback) {
-  if (callback === undefined) {
-    this.send_associateHashWithName(auth, dataToHash, account);
-    return this.recv_associateHashWithName();
-  } else {
-    var postData = this.send_associateHashWithName(auth, dataToHash, account, true);
-    return this.output.getTransport()
-      .jqRequest(this, postData, arguments, this.recv_associateHashWithName);
-  }
-};
-
-PosClient.prototype.send_associateHashWithName = function(auth, dataToHash, account, callback) {
-  this.output.writeMessageBegin('associateHashWithName', Thrift.MessageType.CALL, this.seqid);
-  var args = new Pos_associateHashWithName_args();
-  args.auth = auth;
-  args.dataToHash = dataToHash;
-  args.account = account;
-  args.write(this.output);
-  this.output.writeMessageEnd();
-  return this.output.getTransport().flush(callback);
-};
-
-PosClient.prototype.recv_associateHashWithName = function() {
-  var ret = this.input.readMessageBegin();
-  var fname = ret.fname;
-  var mtype = ret.mtype;
-  var rseqid = ret.rseqid;
-  if (mtype == Thrift.MessageType.EXCEPTION) {
-    var x = new Thrift.TApplicationException();
-    x.read(this.input);
-    this.input.readMessageEnd();
-    throw x;
-  }
-  var result = new Pos_associateHashWithName_result();
-  result.read(this.input);
-  this.input.readMessageEnd();
-
-  if (null !== result.success) {
-    return result.success;
-  }
-  throw 'associateHashWithName failed: unknown result';
-};
-PosClient.prototype.deassociateHash = function(auth, dataToHash, callback) {
-  if (callback === undefined) {
-    this.send_deassociateHash(auth, dataToHash);
-    return this.recv_deassociateHash();
-  } else {
-    var postData = this.send_deassociateHash(auth, dataToHash, true);
-    return this.output.getTransport()
-      .jqRequest(this, postData, arguments, this.recv_deassociateHash);
-  }
-};
-
-PosClient.prototype.send_deassociateHash = function(auth, dataToHash, callback) {
-  this.output.writeMessageBegin('deassociateHash', Thrift.MessageType.CALL, this.seqid);
-  var args = new Pos_deassociateHash_args();
-  args.auth = auth;
-  args.dataToHash = dataToHash;
-  args.write(this.output);
-  this.output.writeMessageEnd();
-  return this.output.getTransport().flush(callback);
-};
-
-PosClient.prototype.recv_deassociateHash = function() {
-  var ret = this.input.readMessageBegin();
-  var fname = ret.fname;
-  var mtype = ret.mtype;
-  var rseqid = ret.rseqid;
-  if (mtype == Thrift.MessageType.EXCEPTION) {
-    var x = new Thrift.TApplicationException();
-    x.read(this.input);
-    this.input.readMessageEnd();
-    throw x;
-  }
-  var result = new Pos_deassociateHash_result();
-  result.read(this.input);
-  this.input.readMessageEnd();
-
-  if (null !== result.success) {
-    return result.success;
-  }
-  throw 'deassociateHash failed: unknown result';
-};
-PosClient.prototype.getUPCPrice = function(upc, callback) {
-  if (callback === undefined) {
-    this.send_getUPCPrice(upc);
-    return this.recv_getUPCPrice();
-  } else {
-    var postData = this.send_getUPCPrice(upc, true);
-    return this.output.getTransport()
-      .jqRequest(this, postData, arguments, this.recv_getUPCPrice);
-  }
-};
-
-PosClient.prototype.send_getUPCPrice = function(upc, callback) {
-  this.output.writeMessageBegin('getUPCPrice', Thrift.MessageType.CALL, this.seqid);
-  var args = new Pos_getUPCPrice_args();
-  args.upc = upc;
-  args.write(this.output);
-  this.output.writeMessageEnd();
-  return this.output.getTransport().flush(callback);
-};
-
-PosClient.prototype.recv_getUPCPrice = function() {
-  var ret = this.input.readMessageBegin();
-  var fname = ret.fname;
-  var mtype = ret.mtype;
-  var rseqid = ret.rseqid;
-  if (mtype == Thrift.MessageType.EXCEPTION) {
-    var x = new Thrift.TApplicationException();
-    x.read(this.input);
-    this.input.readMessageEnd();
-    throw x;
-  }
-  var result = new Pos_getUPCPrice_result();
-  result.read(this.input);
-  this.input.readMessageEnd();
-
-  if (null !== result.success) {
-    return result.success;
-  }
-  throw 'getUPCPrice failed: unknown result';
-};
-PosClient.prototype.setUPCPrice = function(auth, upc, price, callback) {
-  if (callback === undefined) {
-    this.send_setUPCPrice(auth, upc, price);
-    return this.recv_setUPCPrice();
-  } else {
-    var postData = this.send_setUPCPrice(auth, upc, price, true);
-    return this.output.getTransport()
-      .jqRequest(this, postData, arguments, this.recv_setUPCPrice);
-  }
-};
-
-PosClient.prototype.send_setUPCPrice = function(auth, upc, price, callback) {
-  this.output.writeMessageBegin('setUPCPrice', Thrift.MessageType.CALL, this.seqid);
-  var args = new Pos_setUPCPrice_args();
-  args.auth = auth;
-  args.upc = upc;
-  args.price = price;
-  args.write(this.output);
-  this.output.writeMessageEnd();
-  return this.output.getTransport().flush(callback);
-};
-
-PosClient.prototype.recv_setUPCPrice = function() {
-  var ret = this.input.readMessageBegin();
-  var fname = ret.fname;
-  var mtype = ret.mtype;
-  var rseqid = ret.rseqid;
-  if (mtype == Thrift.MessageType.EXCEPTION) {
-    var x = new Thrift.TApplicationException();
-    x.read(this.input);
-    this.input.readMessageEnd();
-    throw x;
-  }
-  var result = new Pos_setUPCPrice_result();
-  result.read(this.input);
-  this.input.readMessageEnd();
-
-  if (null !== result.success) {
-    return result.success;
-  }
-  throw 'setUPCPrice failed: unknown result';
-};
-PosClient.prototype.doTransactionOnHash = function(auth, dataToHash, delta, callback) {
-  if (callback === undefined) {
-    this.send_doTransactionOnHash(auth, dataToHash, delta);
-    return this.recv_doTransactionOnHash();
-  } else {
-    var postData = this.send_doTransactionOnHash(auth, dataToHash, delta, true);
-    return this.output.getTransport()
-      .jqRequest(this, postData, arguments, this.recv_doTransactionOnHash);
-  }
-};
-
-PosClient.prototype.send_doTransactionOnHash = function(auth, dataToHash, delta, callback) {
-  this.output.writeMessageBegin('doTransactionOnHash', Thrift.MessageType.CALL, this.seqid);
-  var args = new Pos_doTransactionOnHash_args();
-  args.auth = auth;
-  args.dataToHash = dataToHash;
-  args.delta = delta;
-  args.write(this.output);
-  this.output.writeMessageEnd();
-  return this.output.getTransport().flush(callback);
-};
-
-PosClient.prototype.recv_doTransactionOnHash = function() {
-  var ret = this.input.readMessageBegin();
-  var fname = ret.fname;
-  var mtype = ret.mtype;
-  var rseqid = ret.rseqid;
-  if (mtype == Thrift.MessageType.EXCEPTION) {
-    var x = new Thrift.TApplicationException();
-    x.read(this.input);
-    this.input.readMessageEnd();
-    throw x;
-  }
-  var result = new Pos_doTransactionOnHash_result();
-  result.read(this.input);
-  this.input.readMessageEnd();
-
-  if (null !== result.success) {
-    return result.success;
-  }
-  throw 'doTransactionOnHash failed: unknown result';
-};
-PosClient.prototype.doTransactionOnId = function(auth, account, delta, callback) {
-  if (callback === undefined) {
-    this.send_doTransactionOnId(auth, account, delta);
-    return this.recv_doTransactionOnId();
-  } else {
-    var postData = this.send_doTransactionOnId(auth, account, delta, true);
-    return this.output.getTransport()
-      .jqRequest(this, postData, arguments, this.recv_doTransactionOnId);
-  }
-};
-
-PosClient.prototype.send_doTransactionOnId = function(auth, account, delta, callback) {
-  this.output.writeMessageBegin('doTransactionOnId', Thrift.MessageType.CALL, this.seqid);
-  var args = new Pos_doTransactionOnId_args();
-  args.auth = auth;
-  args.account = account;
-  args.delta = delta;
-  args.write(this.output);
-  this.output.writeMessageEnd();
-  return this.output.getTransport().flush(callback);
-};
-
-PosClient.prototype.recv_doTransactionOnId = function() {
-  var ret = this.input.readMessageBegin();
-  var fname = ret.fname;
-  var mtype = ret.mtype;
-  var rseqid = ret.rseqid;
-  if (mtype == Thrift.MessageType.EXCEPTION) {
-    var x = new Thrift.TApplicationException();
-    x.read(this.input);
-    this.input.readMessageEnd();
-    throw x;
-  }
-  var result = new Pos_doTransactionOnId_result();
-  result.read(this.input);
-  this.input.readMessageEnd();
-
-  if (null !== result.success) {
-    return result.success;
-  }
-  throw 'doTransactionOnId failed: unknown result';
-};
-PosClient.prototype.doTransactionOnName = function(auth, account, delta, callback) {
-  if (callback === undefined) {
-    this.send_doTransactionOnName(auth, account, delta);
-    return this.recv_doTransactionOnName();
-  } else {
-    var postData = this.send_doTransactionOnName(auth, account, delta, true);
-    return this.output.getTransport()
-      .jqRequest(this, postData, arguments, this.recv_doTransactionOnName);
-  }
-};
-
-PosClient.prototype.send_doTransactionOnName = function(auth, account, delta, callback) {
-  this.output.writeMessageBegin('doTransactionOnName', Thrift.MessageType.CALL, this.seqid);
-  var args = new Pos_doTransactionOnName_args();
-  args.auth = auth;
-  args.account = account;
-  args.delta = delta;
-  args.write(this.output);
-  this.output.writeMessageEnd();
-  return this.output.getTransport().flush(callback);
-};
-
-PosClient.prototype.recv_doTransactionOnName = function() {
-  var ret = this.input.readMessageBegin();
-  var fname = ret.fname;
-  var mtype = ret.mtype;
-  var rseqid = ret.rseqid;
-  if (mtype == Thrift.MessageType.EXCEPTION) {
-    var x = new Thrift.TApplicationException();
-    x.read(this.input);
-    this.input.readMessageEnd();
-    throw x;
-  }
-  var result = new Pos_doTransactionOnName_result();
-  result.read(this.input);
-  this.input.readMessageEnd();
-
-  if (null !== result.success) {
-    return result.success;
-  }
-  throw 'doTransactionOnName failed: unknown result';
-};
-PosClient.prototype.revertTransaction = function(auth, serial, callback) {
-  if (callback === undefined) {
-    this.send_revertTransaction(auth, serial);
-    return this.recv_revertTransaction();
-  } else {
-    var postData = this.send_revertTransaction(auth, serial, true);
-    return this.output.getTransport()
-      .jqRequest(this, postData, arguments, this.recv_revertTransaction);
-  }
-};
-
-PosClient.prototype.send_revertTransaction = function(auth, serial, callback) {
-  this.output.writeMessageBegin('revertTransaction', Thrift.MessageType.CALL, this.seqid);
-  var args = new Pos_revertTransaction_args();
-  args.auth = auth;
-  args.serial = serial;
-  args.write(this.output);
-  this.output.writeMessageEnd();
-  return this.output.getTransport().flush(callback);
-};
-
-PosClient.prototype.recv_revertTransaction = function() {
-  var ret = this.input.readMessageBegin();
-  var fname = ret.fname;
-  var mtype = ret.mtype;
-  var rseqid = ret.rseqid;
-  if (mtype == Thrift.MessageType.EXCEPTION) {
-    var x = new Thrift.TApplicationException();
-    x.read(this.input);
-    this.input.readMessageEnd();
-    throw x;
-  }
-  var result = new Pos_revertTransaction_result();
-  result.read(this.input);
-  this.input.readMessageEnd();
-
-  if (null !== result.success) {
-    return result.success;
-  }
-  throw 'revertTransaction failed: unknown result';
-};
-PosClient.prototype.getStock = function(upc, callback) {
-  if (callback === undefined) {
-    this.send_getStock(upc);
-    return this.recv_getStock();
-  } else {
-    var postData = this.send_getStock(upc, true);
-    return this.output.getTransport()
-      .jqRequest(this, postData, arguments, this.recv_getStock);
-  }
-};
-
-PosClient.prototype.send_getStock = function(upc, callback) {
-  this.output.writeMessageBegin('getStock', Thrift.MessageType.CALL, this.seqid);
-  var args = new Pos_getStock_args();
-  args.upc = upc;
-  args.write(this.output);
-  this.output.writeMessageEnd();
-  return this.output.getTransport().flush(callback);
-};
-
-PosClient.prototype.recv_getStock = function() {
-  var ret = this.input.readMessageBegin();
-  var fname = ret.fname;
-  var mtype = ret.mtype;
-  var rseqid = ret.rseqid;
-  if (mtype == Thrift.MessageType.EXCEPTION) {
-    var x = new Thrift.TApplicationException();
-    x.read(this.input);
-    this.input.readMessageEnd();
-    throw x;
-  }
-  var result = new Pos_getStock_result();
-  result.read(this.input);
-  this.input.readMessageEnd();
-
-  if (null !== result.success) {
-    return result.success;
-  }
-  throw 'getStock failed: unknown result';
-};
-PosClient.prototype.doStockChange = function(auth, upc, delta, callback) {
-  if (callback === undefined) {
-    this.send_doStockChange(auth, upc, delta);
-    return this.recv_doStockChange();
-  } else {
-    var postData = this.send_doStockChange(auth, upc, delta, true);
-    return this.output.getTransport()
-      .jqRequest(this, postData, arguments, this.recv_doStockChange);
-  }
-};
-
-PosClient.prototype.send_doStockChange = function(auth, upc, delta, callback) {
-  this.output.writeMessageBegin('doStockChange', Thrift.MessageType.CALL, this.seqid);
-  var args = new Pos_doStockChange_args();
-  args.auth = auth;
-  args.upc = upc;
-  args.delta = delta;
-  args.write(this.output);
-  this.output.writeMessageEnd();
-  return this.output.getTransport().flush(callback);
-};
-
-PosClient.prototype.recv_doStockChange = function() {
-  var ret = this.input.readMessageBegin();
-  var fname = ret.fname;
-  var mtype = ret.mtype;
-  var rseqid = ret.rseqid;
-  if (mtype == Thrift.MessageType.EXCEPTION) {
-    var x = new Thrift.TApplicationException();
-    x.read(this.input);
-    this.input.readMessageEnd();
-    throw x;
-  }
-  var result = new Pos_doStockChange_result();
-  result.read(this.input);
-  this.input.readMessageEnd();
-
-  if (null !== result.success) {
-    return result.success;
-  }
-  throw 'doStockChange failed: unknown result';
-};
-PosClient.prototype.toString = function(callback) {
-  if (callback === undefined) {
-    this.send_toString();
-    return this.recv_toString();
-  } else {
-    var postData = this.send_toString(true);
-    return this.output.getTransport()
-      .jqRequest(this, postData, arguments, this.recv_toString);
-  }
-};
-
-PosClient.prototype.send_toString = function(callback) {
-  this.output.writeMessageBegin('toString', Thrift.MessageType.CALL, this.seqid);
-  var args = new Pos_toString_args();
-  args.write(this.output);
-  this.output.writeMessageEnd();
-  return this.output.getTransport().flush(callback);
-};
-
-PosClient.prototype.recv_toString = function() {
-  var ret = this.input.readMessageBegin();
-  var fname = ret.fname;
-  var mtype = ret.mtype;
-  var rseqid = ret.rseqid;
-  if (mtype == Thrift.MessageType.EXCEPTION) {
-    var x = new Thrift.TApplicationException();
-    x.read(this.input);
-    this.input.readMessageEnd();
-    throw x;
-  }
-  var result = new Pos_toString_result();
-  result.read(this.input);
-  this.input.readMessageEnd();
-
-  if (null !== result.success) {
-    return result.success;
-  }
-  throw 'toString failed: unknown result';
-};
diff --git a/www/assets/js/PosBookie.js b/www/assets/js/PosBookie.js
new file mode 100644 (file)
index 0000000..904dc65
--- /dev/null
@@ -0,0 +1,718 @@
+//
+// Autogenerated by Thrift Compiler (0.9.0)
+//
+// DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+//
+
+
+//HELPER FUNCTIONS AND STRUCTURES
+
+PosBookie_ping_args = function(args) {
+};
+PosBookie_ping_args.prototype = {};
+PosBookie_ping_args.prototype.read = function(input) {
+  input.readStructBegin();
+  while (true)
+  {
+    var ret = input.readFieldBegin();
+    var fname = ret.fname;
+    var ftype = ret.ftype;
+    var fid = ret.fid;
+    if (ftype == Thrift.Type.STOP) {
+      break;
+    }
+    input.skip(ftype);
+    input.readFieldEnd();
+  }
+  input.readStructEnd();
+  return;
+};
+
+PosBookie_ping_args.prototype.write = function(output) {
+  output.writeStructBegin('PosBookie_ping_args');
+  output.writeFieldStop();
+  output.writeStructEnd();
+  return;
+};
+
+PosBookie_ping_result = function(args) {
+};
+PosBookie_ping_result.prototype = {};
+PosBookie_ping_result.prototype.read = function(input) {
+  input.readStructBegin();
+  while (true)
+  {
+    var ret = input.readFieldBegin();
+    var fname = ret.fname;
+    var ftype = ret.ftype;
+    var fid = ret.fid;
+    if (ftype == Thrift.Type.STOP) {
+      break;
+    }
+    input.skip(ftype);
+    input.readFieldEnd();
+  }
+  input.readStructEnd();
+  return;
+};
+
+PosBookie_ping_result.prototype.write = function(output) {
+  output.writeStructBegin('PosBookie_ping_result');
+  output.writeFieldStop();
+  output.writeStructEnd();
+  return;
+};
+
+PosBookie_getSalt_args = function(args) {
+};
+PosBookie_getSalt_args.prototype = {};
+PosBookie_getSalt_args.prototype.read = function(input) {
+  input.readStructBegin();
+  while (true)
+  {
+    var ret = input.readFieldBegin();
+    var fname = ret.fname;
+    var ftype = ret.ftype;
+    var fid = ret.fid;
+    if (ftype == Thrift.Type.STOP) {
+      break;
+    }
+    input.skip(ftype);
+    input.readFieldEnd();
+  }
+  input.readStructEnd();
+  return;
+};
+
+PosBookie_getSalt_args.prototype.write = function(output) {
+  output.writeStructBegin('PosBookie_getSalt_args');
+  output.writeFieldStop();
+  output.writeStructEnd();
+  return;
+};
+
+PosBookie_getSalt_result = function(args) {
+  this.success = null;
+  if (args) {
+    if (args.success !== undefined) {
+      this.success = args.success;
+    }
+  }
+};
+PosBookie_getSalt_result.prototype = {};
+PosBookie_getSalt_result.prototype.read = function(input) {
+  input.readStructBegin();
+  while (true)
+  {
+    var ret = input.readFieldBegin();
+    var fname = ret.fname;
+    var ftype = ret.ftype;
+    var fid = ret.fid;
+    if (ftype == Thrift.Type.STOP) {
+      break;
+    }
+    switch (fid)
+    {
+      case 0:
+      if (ftype == Thrift.Type.STRING) {
+        this.success = input.readString().value;
+      } else {
+        input.skip(ftype);
+      }
+      break;
+      case 0:
+        input.skip(ftype);
+        break;
+      default:
+        input.skip(ftype);
+    }
+    input.readFieldEnd();
+  }
+  input.readStructEnd();
+  return;
+};
+
+PosBookie_getSalt_result.prototype.write = function(output) {
+  output.writeStructBegin('PosBookie_getSalt_result');
+  if (this.success !== null && this.success !== undefined) {
+    output.writeFieldBegin('success', Thrift.Type.STRING, 0);
+    output.writeString(this.success);
+    output.writeFieldEnd();
+  }
+  output.writeFieldStop();
+  output.writeStructEnd();
+  return;
+};
+
+PosBookie_purchaseItems_args = function(args) {
+  this.auth = null;
+  this.dataToHash = null;
+  this.upcs = null;
+  if (args) {
+    if (args.auth !== undefined) {
+      this.auth = args.auth;
+    }
+    if (args.dataToHash !== undefined) {
+      this.dataToHash = args.dataToHash;
+    }
+    if (args.upcs !== undefined) {
+      this.upcs = args.upcs;
+    }
+  }
+};
+PosBookie_purchaseItems_args.prototype = {};
+PosBookie_purchaseItems_args.prototype.read = function(input) {
+  input.readStructBegin();
+  while (true)
+  {
+    var ret = input.readFieldBegin();
+    var fname = ret.fname;
+    var ftype = ret.ftype;
+    var fid = ret.fid;
+    if (ftype == Thrift.Type.STOP) {
+      break;
+    }
+    switch (fid)
+    {
+      case 1:
+      if (ftype == Thrift.Type.STRING) {
+        this.auth = input.readString().value;
+      } else {
+        input.skip(ftype);
+      }
+      break;
+      case 2:
+      if (ftype == Thrift.Type.STRING) {
+        this.dataToHash = input.readString().value;
+      } else {
+        input.skip(ftype);
+      }
+      break;
+      case 3:
+      if (ftype == Thrift.Type.LIST) {
+        var _size0 = 0;
+        var _rtmp34;
+        this.upcs = [];
+        var _etype3 = 0;
+        _rtmp34 = input.readListBegin();
+        _etype3 = _rtmp34.etype;
+        _size0 = _rtmp34.size;
+        for (var _i5 = 0; _i5 < _size0; ++_i5)
+        {
+          var elem6 = null;
+          elem6 = input.readI64().value;
+          this.upcs.push(elem6);
+        }
+        input.readListEnd();
+      } else {
+        input.skip(ftype);
+      }
+      break;
+      default:
+        input.skip(ftype);
+    }
+    input.readFieldEnd();
+  }
+  input.readStructEnd();
+  return;
+};
+
+PosBookie_purchaseItems_args.prototype.write = function(output) {
+  output.writeStructBegin('PosBookie_purchaseItems_args');
+  if (this.auth !== null && this.auth !== undefined) {
+    output.writeFieldBegin('auth', Thrift.Type.STRING, 1);
+    output.writeString(this.auth);
+    output.writeFieldEnd();
+  }
+  if (this.dataToHash !== null && this.dataToHash !== undefined) {
+    output.writeFieldBegin('dataToHash', Thrift.Type.STRING, 2);
+    output.writeString(this.dataToHash);
+    output.writeFieldEnd();
+  }
+  if (this.upcs !== null && this.upcs !== undefined) {
+    output.writeFieldBegin('upcs', Thrift.Type.LIST, 3);
+    output.writeListBegin(Thrift.Type.I64, this.upcs.length);
+    for (var iter7 in this.upcs)
+    {
+      if (this.upcs.hasOwnProperty(iter7))
+      {
+        iter7 = this.upcs[iter7];
+        output.writeI64(iter7);
+      }
+    }
+    output.writeListEnd();
+    output.writeFieldEnd();
+  }
+  output.writeFieldStop();
+  output.writeStructEnd();
+  return;
+};
+
+PosBookie_purchaseItems_result = function(args) {
+  this.success = null;
+  if (args) {
+    if (args.success !== undefined) {
+      this.success = args.success;
+    }
+  }
+};
+PosBookie_purchaseItems_result.prototype = {};
+PosBookie_purchaseItems_result.prototype.read = function(input) {
+  input.readStructBegin();
+  while (true)
+  {
+    var ret = input.readFieldBegin();
+    var fname = ret.fname;
+    var ftype = ret.ftype;
+    var fid = ret.fid;
+    if (ftype == Thrift.Type.STOP) {
+      break;
+    }
+    switch (fid)
+    {
+      case 0:
+      if (ftype == Thrift.Type.I32) {
+        this.success = input.readI32().value;
+      } else {
+        input.skip(ftype);
+      }
+      break;
+      case 0:
+        input.skip(ftype);
+        break;
+      default:
+        input.skip(ftype);
+    }
+    input.readFieldEnd();
+  }
+  input.readStructEnd();
+  return;
+};
+
+PosBookie_purchaseItems_result.prototype.write = function(output) {
+  output.writeStructBegin('PosBookie_purchaseItems_result');
+  if (this.success !== null && this.success !== undefined) {
+    output.writeFieldBegin('success', Thrift.Type.I32, 0);
+    output.writeI32(this.success);
+    output.writeFieldEnd();
+  }
+  output.writeFieldStop();
+  output.writeStructEnd();
+  return;
+};
+
+PosBookie_getUPCPrice_args = function(args) {
+  this.upc = null;
+  if (args) {
+    if (args.upc !== undefined) {
+      this.upc = args.upc;
+    }
+  }
+};
+PosBookie_getUPCPrice_args.prototype = {};
+PosBookie_getUPCPrice_args.prototype.read = function(input) {
+  input.readStructBegin();
+  while (true)
+  {
+    var ret = input.readFieldBegin();
+    var fname = ret.fname;
+    var ftype = ret.ftype;
+    var fid = ret.fid;
+    if (ftype == Thrift.Type.STOP) {
+      break;
+    }
+    switch (fid)
+    {
+      case 1:
+      if (ftype == Thrift.Type.I64) {
+        this.upc = input.readI64().value;
+      } else {
+        input.skip(ftype);
+      }
+      break;
+      case 0:
+        input.skip(ftype);
+        break;
+      default:
+        input.skip(ftype);
+    }
+    input.readFieldEnd();
+  }
+  input.readStructEnd();
+  return;
+};
+
+PosBookie_getUPCPrice_args.prototype.write = function(output) {
+  output.writeStructBegin('PosBookie_getUPCPrice_args');
+  if (this.upc !== null && this.upc !== undefined) {
+    output.writeFieldBegin('upc', Thrift.Type.I64, 1);
+    output.writeI64(this.upc);
+    output.writeFieldEnd();
+  }
+  output.writeFieldStop();
+  output.writeStructEnd();
+  return;
+};
+
+PosBookie_getUPCPrice_result = function(args) {
+  this.success = null;
+  if (args) {
+    if (args.success !== undefined) {
+      this.success = args.success;
+    }
+  }
+};
+PosBookie_getUPCPrice_result.prototype = {};
+PosBookie_getUPCPrice_result.prototype.read = function(input) {
+  input.readStructBegin();
+  while (true)
+  {
+    var ret = input.readFieldBegin();
+    var fname = ret.fname;
+    var ftype = ret.ftype;
+    var fid = ret.fid;
+    if (ftype == Thrift.Type.STOP) {
+      break;
+    }
+    switch (fid)
+    {
+      case 0:
+      if (ftype == Thrift.Type.I32) {
+        this.success = input.readI32().value;
+      } else {
+        input.skip(ftype);
+      }
+      break;
+      case 0:
+        input.skip(ftype);
+        break;
+      default:
+        input.skip(ftype);
+    }
+    input.readFieldEnd();
+  }
+  input.readStructEnd();
+  return;
+};
+
+PosBookie_getUPCPrice_result.prototype.write = function(output) {
+  output.writeStructBegin('PosBookie_getUPCPrice_result');
+  if (this.success !== null && this.success !== undefined) {
+    output.writeFieldBegin('success', Thrift.Type.I32, 0);
+    output.writeI32(this.success);
+    output.writeFieldEnd();
+  }
+  output.writeFieldStop();
+  output.writeStructEnd();
+  return;
+};
+
+PosBookie_getStock_args = function(args) {
+  this.upc = null;
+  if (args) {
+    if (args.upc !== undefined) {
+      this.upc = args.upc;
+    }
+  }
+};
+PosBookie_getStock_args.prototype = {};
+PosBookie_getStock_args.prototype.read = function(input) {
+  input.readStructBegin();
+  while (true)
+  {
+    var ret = input.readFieldBegin();
+    var fname = ret.fname;
+    var ftype = ret.ftype;
+    var fid = ret.fid;
+    if (ftype == Thrift.Type.STOP) {
+      break;
+    }
+    switch (fid)
+    {
+      case 1:
+      if (ftype == Thrift.Type.I64) {
+        this.upc = input.readI64().value;
+      } else {
+        input.skip(ftype);
+      }
+      break;
+      case 0:
+        input.skip(ftype);
+        break;
+      default:
+        input.skip(ftype);
+    }
+    input.readFieldEnd();
+  }
+  input.readStructEnd();
+  return;
+};
+
+PosBookie_getStock_args.prototype.write = function(output) {
+  output.writeStructBegin('PosBookie_getStock_args');
+  if (this.upc !== null && this.upc !== undefined) {
+    output.writeFieldBegin('upc', Thrift.Type.I64, 1);
+    output.writeI64(this.upc);
+    output.writeFieldEnd();
+  }
+  output.writeFieldStop();
+  output.writeStructEnd();
+  return;
+};
+
+PosBookie_getStock_result = function(args) {
+  this.success = null;
+  if (args) {
+    if (args.success !== undefined) {
+      this.success = args.success;
+    }
+  }
+};
+PosBookie_getStock_result.prototype = {};
+PosBookie_getStock_result.prototype.read = function(input) {
+  input.readStructBegin();
+  while (true)
+  {
+    var ret = input.readFieldBegin();
+    var fname = ret.fname;
+    var ftype = ret.ftype;
+    var fid = ret.fid;
+    if (ftype == Thrift.Type.STOP) {
+      break;
+    }
+    switch (fid)
+    {
+      case 0:
+      if (ftype == Thrift.Type.I32) {
+        this.success = input.readI32().value;
+      } else {
+        input.skip(ftype);
+      }
+      break;
+      case 0:
+        input.skip(ftype);
+        break;
+      default:
+        input.skip(ftype);
+    }
+    input.readFieldEnd();
+  }
+  input.readStructEnd();
+  return;
+};
+
+PosBookie_getStock_result.prototype.write = function(output) {
+  output.writeStructBegin('PosBookie_getStock_result');
+  if (this.success !== null && this.success !== undefined) {
+    output.writeFieldBegin('success', Thrift.Type.I32, 0);
+    output.writeI32(this.success);
+    output.writeFieldEnd();
+  }
+  output.writeFieldStop();
+  output.writeStructEnd();
+  return;
+};
+
+PosBookieClient = function(input, output) {
+    this.input = input;
+    this.output = (!output) ? input : output;
+    this.seqid = 0;
+};
+PosBookieClient.prototype = {};
+PosBookieClient.prototype.ping = function(callback) {
+  if (callback === undefined) {
+    this.send_ping();
+    this.recv_ping();
+  } else {
+    var postData = this.send_ping(true);
+    return this.output.getTransport()
+      .jqRequest(this, postData, arguments, this.recv_ping);
+  }
+};
+
+PosBookieClient.prototype.send_ping = function(callback) {
+  this.output.writeMessageBegin('ping', Thrift.MessageType.CALL, this.seqid);
+  var args = new PosBookie_ping_args();
+  args.write(this.output);
+  this.output.writeMessageEnd();
+  return this.output.getTransport().flush(callback);
+};
+
+PosBookieClient.prototype.recv_ping = function() {
+  var ret = this.input.readMessageBegin();
+  var fname = ret.fname;
+  var mtype = ret.mtype;
+  var rseqid = ret.rseqid;
+  if (mtype == Thrift.MessageType.EXCEPTION) {
+    var x = new Thrift.TApplicationException();
+    x.read(this.input);
+    this.input.readMessageEnd();
+    throw x;
+  }
+  var result = new PosBookie_ping_result();
+  result.read(this.input);
+  this.input.readMessageEnd();
+
+  return;
+};
+PosBookieClient.prototype.getSalt = function(callback) {
+  if (callback === undefined) {
+    this.send_getSalt();
+    return this.recv_getSalt();
+  } else {
+    var postData = this.send_getSalt(true);
+    return this.output.getTransport()
+      .jqRequest(this, postData, arguments, this.recv_getSalt);
+  }
+};
+
+PosBookieClient.prototype.send_getSalt = function(callback) {
+  this.output.writeMessageBegin('getSalt', Thrift.MessageType.CALL, this.seqid);
+  var args = new PosBookie_getSalt_args();
+  args.write(this.output);
+  this.output.writeMessageEnd();
+  return this.output.getTransport().flush(callback);
+};
+
+PosBookieClient.prototype.recv_getSalt = function() {
+  var ret = this.input.readMessageBegin();
+  var fname = ret.fname;
+  var mtype = ret.mtype;
+  var rseqid = ret.rseqid;
+  if (mtype == Thrift.MessageType.EXCEPTION) {
+    var x = new Thrift.TApplicationException();
+    x.read(this.input);
+    this.input.readMessageEnd();
+    throw x;
+  }
+  var result = new PosBookie_getSalt_result();
+  result.read(this.input);
+  this.input.readMessageEnd();
+
+  if (null !== result.success) {
+    return result.success;
+  }
+  throw 'getSalt failed: unknown result';
+};
+PosBookieClient.prototype.purchaseItems = function(auth, dataToHash, upcs, callback) {
+  if (callback === undefined) {
+    this.send_purchaseItems(auth, dataToHash, upcs);
+    return this.recv_purchaseItems();
+  } else {
+    var postData = this.send_purchaseItems(auth, dataToHash, upcs, true);
+    return this.output.getTransport()
+      .jqRequest(this, postData, arguments, this.recv_purchaseItems);
+  }
+};
+
+PosBookieClient.prototype.send_purchaseItems = function(auth, dataToHash, upcs, callback) {
+  this.output.writeMessageBegin('purchaseItems', Thrift.MessageType.CALL, this.seqid);
+  var args = new PosBookie_purchaseItems_args();
+  args.auth = auth;
+  args.dataToHash = dataToHash;
+  args.upcs = upcs;
+  args.write(this.output);
+  this.output.writeMessageEnd();
+  return this.output.getTransport().flush(callback);
+};
+
+PosBookieClient.prototype.recv_purchaseItems = function() {
+  var ret = this.input.readMessageBegin();
+  var fname = ret.fname;
+  var mtype = ret.mtype;
+  var rseqid = ret.rseqid;
+  if (mtype == Thrift.MessageType.EXCEPTION) {
+    var x = new Thrift.TApplicationException();
+    x.read(this.input);
+    this.input.readMessageEnd();
+    throw x;
+  }
+  var result = new PosBookie_purchaseItems_result();
+  result.read(this.input);
+  this.input.readMessageEnd();
+
+  if (null !== result.success) {
+    return result.success;
+  }
+  throw 'purchaseItems failed: unknown result';
+};
+PosBookieClient.prototype.getUPCPrice = function(upc, callback) {
+  if (callback === undefined) {
+    this.send_getUPCPrice(upc);
+    return this.recv_getUPCPrice();
+  } else {
+    var postData = this.send_getUPCPrice(upc, true);
+    return this.output.getTransport()
+      .jqRequest(this, postData, arguments, this.recv_getUPCPrice);
+  }
+};
+
+PosBookieClient.prototype.send_getUPCPrice = function(upc, callback) {
+  this.output.writeMessageBegin('getUPCPrice', Thrift.MessageType.CALL, this.seqid);
+  var args = new PosBookie_getUPCPrice_args();
+  args.upc = upc;
+  args.write(this.output);
+  this.output.writeMessageEnd();
+  return this.output.getTransport().flush(callback);
+};
+
+PosBookieClient.prototype.recv_getUPCPrice = function() {
+  var ret = this.input.readMessageBegin();
+  var fname = ret.fname;
+  var mtype = ret.mtype;
+  var rseqid = ret.rseqid;
+  if (mtype == Thrift.MessageType.EXCEPTION) {
+    var x = new Thrift.TApplicationException();
+    x.read(this.input);
+    this.input.readMessageEnd();
+    throw x;
+  }
+  var result = new PosBookie_getUPCPrice_result();
+  result.read(this.input);
+  this.input.readMessageEnd();
+
+  if (null !== result.success) {
+    return result.success;
+  }
+  throw 'getUPCPrice failed: unknown result';
+};
+PosBookieClient.prototype.getStock = function(upc, callback) {
+  if (callback === undefined) {
+    this.send_getStock(upc);
+    return this.recv_getStock();
+  } else {
+    var postData = this.send_getStock(upc, true);
+    return this.output.getTransport()
+      .jqRequest(this, postData, arguments, this.recv_getStock);
+  }
+};
+
+PosBookieClient.prototype.send_getStock = function(upc, callback) {
+  this.output.writeMessageBegin('getStock', Thrift.MessageType.CALL, this.seqid);
+  var args = new PosBookie_getStock_args();
+  args.upc = upc;
+  args.write(this.output);
+  this.output.writeMessageEnd();
+  return this.output.getTransport().flush(callback);
+};
+
+PosBookieClient.prototype.recv_getStock = function() {
+  var ret = this.input.readMessageBegin();
+  var fname = ret.fname;
+  var mtype = ret.mtype;
+  var rseqid = ret.rseqid;
+  if (mtype == Thrift.MessageType.EXCEPTION) {
+    var x = new Thrift.TApplicationException();
+    x.read(this.input);
+    this.input.readMessageEnd();
+    throw x;
+  }
+  var result = new PosBookie_getStock_result();
+  result.read(this.input);
+  this.input.readMessageEnd();
+
+  if (null !== result.success) {
+    return result.success;
+  }
+  throw 'getStock failed: unknown result';
+};
index a664f2d..b029416 100644 (file)
@@ -1,31 +1,42 @@
 PosClientWrapper = function (authKey, serverLocation) {
-       this._authKey = authKey;
+       var _authKey = authKey;
 
-       this._transport = new Thrift.Transport(serverLocation);
-       this._protocol = new Thrift.Protocol(this._transport);
-       this._client = new PosClient(this._protocol);
+       var _transport = new Thrift.Transport(serverLocation);
+       var _protocol = new Thrift.Protocol(this._transport);
+       var _client = new PosBookieClient(this._protocol);
 
-       this._getAuthString = function () {
+       var _getAuthString = function () {
                var salt = this._client.getSalt();
 
-               return $.sha1(salt+this._authKey);
+               return $.sha1(salt+_authKey);
        }
 
-       try {
+
+       /*      try {
                this._client.ping();
        } catch (e) {
                location.reload(true);
-       }
+       }*/
 };
 
 PosClientWrapper.prototype = {};
+
 PosClientWrapper.prototype.getPrice = function (upc, callback) {
        if (callback === undefined) {
                return this._client.getUPCPrice(upc);
        }
 
-       this._client.getUPCPrice(upc, callback);
+       _client.getUPCPrice(upc, callback);
 }
 
 PosClientWrapper.prototype.process = function (cardData, selection) {
+       var upcs = [];
+
+       for (var i in selection) {
+               for (var q = 0; q < selection[i].quantity; q++) {
+                       upcs.push(i);
+               }
+       }
+
+       return _client.purchase(_getAuthString(), cardData, upcs);
 }
diff --git a/www/assets/js/pos-bookie_types.js b/www/assets/js/pos-bookie_types.js
new file mode 100644 (file)
index 0000000..68e40e7
--- /dev/null
@@ -0,0 +1,11 @@
+//
+// Autogenerated by Thrift Compiler (0.9.0)
+//
+// DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+//
+
+E_PURCHASE_STATUS = {
+'EPS_FAIL' : 0,
+'EPS_NOMONEY' : 1,
+'EPS_SUCCESS' : 2
+};
diff --git a/www/assets/js/pos_types.js b/www/assets/js/pos_types.js
deleted file mode 100644 (file)
index e8018b9..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-//
-// Autogenerated by Thrift Compiler (0.8.0)
-//
-// DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
-//
-
index 6d9dcec..e8436b9 100644 (file)
@@ -17,7 +17,7 @@
  * under the License.
  */
 var Thrift = {
-    Version: '0.8.0',
+    Version: '0.9.0',
 /*
     Description: 'JavaScript bindings for the Apache Thrift RPC system',
     License: 'http://www.apache.org/licenses/LICENSE-2.0',
@@ -223,46 +223,26 @@ Thrift.Transport.prototype = {
             throw 'Thrift.js requires jQuery 1.5+ to use asynchronous requests';
         }
 
-        // Deferreds
-        var deferred = jQuery.Deferred();
-        var completeDfd = jQuery._Deferred();
-        var dfd = deferred.promise();
-        dfd.success = dfd.done;
-        dfd.error = dfd.fail;
-        dfd.complete = completeDfd.done;
+        var thriftTransport = this;
 
         var jqXHR = jQuery.ajax({
             url: this.url,
             data: postData,
             type: 'POST',
             cache: false,
-            dataType: 'text',
-            context: this,
-            success: this.jqResponse,
-            error: function(xhr, status, e) {
-                deferred.rejectWith(client, jQuery.merge([e], xhr.tArgs));
+            dataType: 'text thrift',
+            converters: {
+                'text thrift' : function(responseData) {
+                    thriftTransport.setRecvBuffer(responseData);
+                    var value = recv_method.call(client);
+                    return value;
+                }
             },
-            complete: function(xhr, status) {
-                completeDfd.resolveWith(client, [xhr, status]);
-            }
+            context: client,
+            success: jQuery.makeArray(args).pop()
         });
 
-        deferred.done(jQuery.makeArray(args).pop()); //pop callback from args
-        jqXHR.tArgs = args;
-        jqXHR.tClient = client;
-        jqXHR.tRecvFn = recv_method;
-        jqXHR.tDfd = deferred;
-        return dfd;
-    },
-
-    jqResponse: function(responseData, textStatus, jqXHR) {
-      this.setRecvBuffer(responseData);
-      try {
-          var value = jqXHR.tRecvFn.call(jqXHR.tClient);
-          jqXHR.tDfd.resolveWith(jqXHR, jQuery.merge([value], jqXHR.tArgs));
-      } catch (ex) {
-          jqXHR.tDfd.rejectWith(jqXHR, jQuery.merge([ex], jqXHR.tArgs));
-      }
+        return jqXHR;
     },
 
     setRecvBuffer: function(buf) {
index 3714284..c9f6fb1 100644 (file)
@@ -79,8 +79,8 @@
                <script src="assets/js/jquery.formatCurrency-1.4.0.min.js"></script>
                <script src="assets/js/bootstrap.min.js"></script>
                <script src="assets/js/thrift.js"></script>
-               <script src="assets/js/pos_types.js"></script>
-               <script src="assets/js/Pos.js"></script>
+               <script src="assets/js/pos-bookie_types.js"></script>
+               <script src="assets/js/PosBookie.js"></script>
                <script src="assets/js/client.js"></script>
                <script src="assets/js/ui.js"></script>