Subversion Repositories SmartDukaan

Rev

Rev 716 | Rev 765 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 716 Rev 732
Line 70... Line 70...
70
     - awb
70
     - awb
71
     - providerId
71
     - providerId
72
    """
72
    """
73
    pass
73
    pass
74
 
74
 
-
 
75
  def getDestinationCode(self, providerId, pinCode):
-
 
76
    """
-
 
77
    Returns the short three letter code of a pincode for the given provider.
-
 
78
       Raises an exception if the pin code is not serviced by the given provider.
-
 
79
    
-
 
80
    Parameters:
-
 
81
     - providerId
-
 
82
     - pinCode
-
 
83
    """
-
 
84
    pass
-
 
85
 
75
 
86
 
76
class Client(Iface):
87
class Client(Iface):
77
  def __init__(self, iprot, oprot=None):
88
  def __init__(self, iprot, oprot=None):
78
    self._iprot = self._oprot = iprot
89
    self._iprot = self._oprot = iprot
79
    if oprot != None:
90
    if oprot != None:
Line 286... Line 297...
286
      return result.success
297
      return result.success
287
    if result.se != None:
298
    if result.se != None:
288
      raise result.se
299
      raise result.se
289
    raise TApplicationException(TApplicationException.MISSING_RESULT, "getShipmentInfo failed: unknown result");
300
    raise TApplicationException(TApplicationException.MISSING_RESULT, "getShipmentInfo failed: unknown result");
290
 
301
 
-
 
302
  def getDestinationCode(self, providerId, pinCode):
-
 
303
    """
-
 
304
    Returns the short three letter code of a pincode for the given provider.
-
 
305
       Raises an exception if the pin code is not serviced by the given provider.
-
 
306
    
-
 
307
    Parameters:
-
 
308
     - providerId
-
 
309
     - pinCode
-
 
310
    """
-
 
311
    self.send_getDestinationCode(providerId, pinCode)
-
 
312
    return self.recv_getDestinationCode()
-
 
313
 
-
 
314
  def send_getDestinationCode(self, providerId, pinCode):
-
 
315
    self._oprot.writeMessageBegin('getDestinationCode', TMessageType.CALL, self._seqid)
-
 
316
    args = getDestinationCode_args()
-
 
317
    args.providerId = providerId
-
 
318
    args.pinCode = pinCode
-
 
319
    args.write(self._oprot)
-
 
320
    self._oprot.writeMessageEnd()
-
 
321
    self._oprot.trans.flush()
-
 
322
 
-
 
323
  def recv_getDestinationCode(self, ):
-
 
324
    (fname, mtype, rseqid) = self._iprot.readMessageBegin()
-
 
325
    if mtype == TMessageType.EXCEPTION:
-
 
326
      x = TApplicationException()
-
 
327
      x.read(self._iprot)
-
 
328
      self._iprot.readMessageEnd()
-
 
329
      raise x
-
 
330
    result = getDestinationCode_result()
-
 
331
    result.read(self._iprot)
-
 
332
    self._iprot.readMessageEnd()
-
 
333
    if result.success != None:
-
 
334
      return result.success
-
 
335
    if result.se != None:
-
 
336
      raise result.se
-
 
337
    raise TApplicationException(TApplicationException.MISSING_RESULT, "getDestinationCode failed: unknown result");
-
 
338
 
291
 
339
 
292
class Processor(Iface, TProcessor):
340
class Processor(Iface, TProcessor):
293
  def __init__(self, handler):
341
  def __init__(self, handler):
294
    self._handler = handler
342
    self._handler = handler
295
    self._processMap = {}
343
    self._processMap = {}
Line 297... Line 345...
297
    self._processMap["getAllProviders"] = Processor.process_getAllProviders
345
    self._processMap["getAllProviders"] = Processor.process_getAllProviders
298
    self._processMap["getLogisticsEstimation"] = Processor.process_getLogisticsEstimation
346
    self._processMap["getLogisticsEstimation"] = Processor.process_getLogisticsEstimation
299
    self._processMap["getLogisticsInfo"] = Processor.process_getLogisticsInfo
347
    self._processMap["getLogisticsInfo"] = Processor.process_getLogisticsInfo
300
    self._processMap["getEmptyAWB"] = Processor.process_getEmptyAWB
348
    self._processMap["getEmptyAWB"] = Processor.process_getEmptyAWB
301
    self._processMap["getShipmentInfo"] = Processor.process_getShipmentInfo
349
    self._processMap["getShipmentInfo"] = Processor.process_getShipmentInfo
-
 
350
    self._processMap["getDestinationCode"] = Processor.process_getDestinationCode
302
 
351
 
303
  def process(self, iprot, oprot):
352
  def process(self, iprot, oprot):
304
    (name, type, seqid) = iprot.readMessageBegin()
353
    (name, type, seqid) = iprot.readMessageBegin()
305
    if name not in self._processMap:
354
    if name not in self._processMap:
306
      iprot.skip(TType.STRUCT)
355
      iprot.skip(TType.STRUCT)
Line 397... Line 446...
397
    oprot.writeMessageBegin("getShipmentInfo", TMessageType.REPLY, seqid)
446
    oprot.writeMessageBegin("getShipmentInfo", TMessageType.REPLY, seqid)
398
    result.write(oprot)
447
    result.write(oprot)
399
    oprot.writeMessageEnd()
448
    oprot.writeMessageEnd()
400
    oprot.trans.flush()
449
    oprot.trans.flush()
401
 
450
 
-
 
451
  def process_getDestinationCode(self, seqid, iprot, oprot):
-
 
452
    args = getDestinationCode_args()
-
 
453
    args.read(iprot)
-
 
454
    iprot.readMessageEnd()
-
 
455
    result = getDestinationCode_result()
-
 
456
    try:
-
 
457
      result.success = self._handler.getDestinationCode(args.providerId, args.pinCode)
-
 
458
    except LogisticsServiceException, se:
-
 
459
      result.se = se
-
 
460
    oprot.writeMessageBegin("getDestinationCode", TMessageType.REPLY, seqid)
-
 
461
    result.write(oprot)
-
 
462
    oprot.writeMessageEnd()
-
 
463
    oprot.trans.flush()
-
 
464
 
402
 
465
 
403
# HELPER FUNCTIONS AND STRUCTURES
466
# HELPER FUNCTIONS AND STRUCTURES
404
 
467
 
405
class getProvider_args:
468
class getProvider_args:
406
  """
469
  """
Line 1169... Line 1232...
1169
      oprot.writeFieldEnd()
1232
      oprot.writeFieldEnd()
1170
    if self.se != None:
1233
    if self.se != None:
1171
      oprot.writeFieldBegin('se', TType.STRUCT, 1)
1234
      oprot.writeFieldBegin('se', TType.STRUCT, 1)
1172
      self.se.write(oprot)
1235
      self.se.write(oprot)
1173
      oprot.writeFieldEnd()
1236
      oprot.writeFieldEnd()
-
 
1237
    oprot.writeFieldStop()
-
 
1238
    oprot.writeStructEnd()
-
 
1239
 
-
 
1240
  def __repr__(self):
-
 
1241
    L = ['%s=%r' % (key, value)
-
 
1242
      for key, value in self.__dict__.iteritems()]
-
 
1243
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
-
 
1244
 
-
 
1245
  def __eq__(self, other):
-
 
1246
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
-
 
1247
 
-
 
1248
  def __ne__(self, other):
-
 
1249
    return not (self == other)
-
 
1250
 
-
 
1251
class getDestinationCode_args:
-
 
1252
  """
-
 
1253
  Attributes:
-
 
1254
   - providerId
-
 
1255
   - pinCode
-
 
1256
  """
-
 
1257
 
-
 
1258
  thrift_spec = (
-
 
1259
    None, # 0
-
 
1260
    (1, TType.I64, 'providerId', None, None, ), # 1
-
 
1261
    (2, TType.STRING, 'pinCode', None, None, ), # 2
-
 
1262
  )
-
 
1263
 
-
 
1264
  def __init__(self, providerId=None, pinCode=None,):
-
 
1265
    self.providerId = providerId
-
 
1266
    self.pinCode = pinCode
-
 
1267
 
-
 
1268
  def read(self, iprot):
-
 
1269
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
-
 
1270
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
-
 
1271
      return
-
 
1272
    iprot.readStructBegin()
-
 
1273
    while True:
-
 
1274
      (fname, ftype, fid) = iprot.readFieldBegin()
-
 
1275
      if ftype == TType.STOP:
-
 
1276
        break
-
 
1277
      if fid == 1:
-
 
1278
        if ftype == TType.I64:
-
 
1279
          self.providerId = iprot.readI64();
-
 
1280
        else:
-
 
1281
          iprot.skip(ftype)
-
 
1282
      elif fid == 2:
-
 
1283
        if ftype == TType.STRING:
-
 
1284
          self.pinCode = iprot.readString();
-
 
1285
        else:
-
 
1286
          iprot.skip(ftype)
-
 
1287
      else:
-
 
1288
        iprot.skip(ftype)
-
 
1289
      iprot.readFieldEnd()
-
 
1290
    iprot.readStructEnd()
-
 
1291
 
-
 
1292
  def write(self, oprot):
-
 
1293
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
-
 
1294
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
-
 
1295
      return
-
 
1296
    oprot.writeStructBegin('getDestinationCode_args')
-
 
1297
    if self.providerId != None:
-
 
1298
      oprot.writeFieldBegin('providerId', TType.I64, 1)
-
 
1299
      oprot.writeI64(self.providerId)
-
 
1300
      oprot.writeFieldEnd()
-
 
1301
    if self.pinCode != None:
-
 
1302
      oprot.writeFieldBegin('pinCode', TType.STRING, 2)
-
 
1303
      oprot.writeString(self.pinCode)
-
 
1304
      oprot.writeFieldEnd()
-
 
1305
    oprot.writeFieldStop()
-
 
1306
    oprot.writeStructEnd()
-
 
1307
 
-
 
1308
  def __repr__(self):
-
 
1309
    L = ['%s=%r' % (key, value)
-
 
1310
      for key, value in self.__dict__.iteritems()]
-
 
1311
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
-
 
1312
 
-
 
1313
  def __eq__(self, other):
-
 
1314
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
-
 
1315
 
-
 
1316
  def __ne__(self, other):
-
 
1317
    return not (self == other)
-
 
1318
 
-
 
1319
class getDestinationCode_result:
-
 
1320
  """
-
 
1321
  Attributes:
-
 
1322
   - success
-
 
1323
   - se
-
 
1324
  """
-
 
1325
 
-
 
1326
  thrift_spec = (
-
 
1327
    (0, TType.STRING, 'success', None, None, ), # 0
-
 
1328
    (1, TType.STRUCT, 'se', (LogisticsServiceException, LogisticsServiceException.thrift_spec), None, ), # 1
-
 
1329
  )
-
 
1330
 
-
 
1331
  def __init__(self, success=None, se=None,):
-
 
1332
    self.success = success
-
 
1333
    self.se = se
-
 
1334
 
-
 
1335
  def read(self, iprot):
-
 
1336
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
-
 
1337
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
-
 
1338
      return
-
 
1339
    iprot.readStructBegin()
-
 
1340
    while True:
-
 
1341
      (fname, ftype, fid) = iprot.readFieldBegin()
-
 
1342
      if ftype == TType.STOP:
-
 
1343
        break
-
 
1344
      if fid == 0:
-
 
1345
        if ftype == TType.STRING:
-
 
1346
          self.success = iprot.readString();
-
 
1347
        else:
-
 
1348
          iprot.skip(ftype)
-
 
1349
      elif fid == 1:
-
 
1350
        if ftype == TType.STRUCT:
-
 
1351
          self.se = LogisticsServiceException()
-
 
1352
          self.se.read(iprot)
-
 
1353
        else:
-
 
1354
          iprot.skip(ftype)
-
 
1355
      else:
-
 
1356
        iprot.skip(ftype)
-
 
1357
      iprot.readFieldEnd()
-
 
1358
    iprot.readStructEnd()
-
 
1359
 
-
 
1360
  def write(self, oprot):
-
 
1361
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
-
 
1362
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
-
 
1363
      return
-
 
1364
    oprot.writeStructBegin('getDestinationCode_result')
-
 
1365
    if self.success != None:
-
 
1366
      oprot.writeFieldBegin('success', TType.STRING, 0)
-
 
1367
      oprot.writeString(self.success)
-
 
1368
      oprot.writeFieldEnd()
-
 
1369
    if self.se != None:
-
 
1370
      oprot.writeFieldBegin('se', TType.STRUCT, 1)
-
 
1371
      self.se.write(oprot)
-
 
1372
      oprot.writeFieldEnd()
1174
    oprot.writeFieldStop()
1373
    oprot.writeFieldStop()
1175
    oprot.writeStructEnd()
1374
    oprot.writeStructEnd()
1176
 
1375
 
1177
  def __repr__(self):
1376
  def __repr__(self):
1178
    L = ['%s=%r' % (key, value)
1377
    L = ['%s=%r' % (key, value)