Subversion Repositories SmartDukaan

Rev

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

Rev 6561 Rev 6679
Line 121... Line 121...
121
    """
121
    """
122
    Returns a list of active coupons
122
    Returns a list of active coupons
123
    """
123
    """
124
    pass
124
    pass
125
 
125
 
126
  def createCoupon(self, promotionId, endOn, email, amount, isCod, usage, prefix):
126
  def createCoupon(self, promotionId, arguments, isCod, prefix):
127
    """
127
    """
128
    Creates a coupon with prefix (optional, pass null)and returns couponcode if successfully created.
128
    Creates a coupon with prefix (optional, pass null)and returns couponcode if successfully created.
129
 
129
 
130
    Parameters:
130
    Parameters:
131
     - promotionId
131
     - promotionId
132
     - endOn
-
 
133
     - email
-
 
134
     - amount
132
     - arguments
135
     - isCod
133
     - isCod
136
     - usage
-
 
137
     - prefix
134
     - prefix
138
    """
135
    """
139
    pass
136
    pass
140
 
137
 
141
  def getSuccessfulPaymentCountForCoupon(self, couponCode):
138
  def getSuccessfulPaymentCountForCoupon(self, couponCode):
Line 654... Line 651...
654
      return result.success
651
      return result.success
655
    if result.pex is not None:
652
    if result.pex is not None:
656
      raise result.pex
653
      raise result.pex
657
    raise TApplicationException(TApplicationException.MISSING_RESULT, "getActiveCoupons failed: unknown result");
654
    raise TApplicationException(TApplicationException.MISSING_RESULT, "getActiveCoupons failed: unknown result");
658
 
655
 
659
  def createCoupon(self, promotionId, endOn, email, amount, isCod, usage, prefix):
656
  def createCoupon(self, promotionId, arguments, isCod, prefix):
660
    """
657
    """
661
    Creates a coupon with prefix (optional, pass null)and returns couponcode if successfully created.
658
    Creates a coupon with prefix (optional, pass null)and returns couponcode if successfully created.
662
 
659
 
663
    Parameters:
660
    Parameters:
664
     - promotionId
661
     - promotionId
665
     - endOn
-
 
666
     - email
-
 
667
     - amount
662
     - arguments
668
     - isCod
663
     - isCod
669
     - usage
-
 
670
     - prefix
664
     - prefix
671
    """
665
    """
672
    self.send_createCoupon(promotionId, endOn, email, amount, isCod, usage, prefix)
666
    self.send_createCoupon(promotionId, arguments, isCod, prefix)
673
    return self.recv_createCoupon()
667
    return self.recv_createCoupon()
674
 
668
 
675
  def send_createCoupon(self, promotionId, endOn, email, amount, isCod, usage, prefix):
669
  def send_createCoupon(self, promotionId, arguments, isCod, prefix):
676
    self._oprot.writeMessageBegin('createCoupon', TMessageType.CALL, self._seqid)
670
    self._oprot.writeMessageBegin('createCoupon', TMessageType.CALL, self._seqid)
677
    args = createCoupon_args()
671
    args = createCoupon_args()
678
    args.promotionId = promotionId
672
    args.promotionId = promotionId
679
    args.endOn = endOn
-
 
680
    args.email = email
-
 
681
    args.amount = amount
673
    args.arguments = arguments
682
    args.isCod = isCod
674
    args.isCod = isCod
683
    args.usage = usage
-
 
684
    args.prefix = prefix
675
    args.prefix = prefix
685
    args.write(self._oprot)
676
    args.write(self._oprot)
686
    self._oprot.writeMessageEnd()
677
    self._oprot.writeMessageEnd()
687
    self._oprot.trans.flush()
678
    self._oprot.trans.flush()
688
 
679
 
Line 1168... Line 1159...
1168
    args = createCoupon_args()
1159
    args = createCoupon_args()
1169
    args.read(iprot)
1160
    args.read(iprot)
1170
    iprot.readMessageEnd()
1161
    iprot.readMessageEnd()
1171
    result = createCoupon_result()
1162
    result = createCoupon_result()
1172
    try:
1163
    try:
1173
      result.success = self._handler.createCoupon(args.promotionId, args.endOn, args.email, args.amount, args.isCod, args.usage, args.prefix)
1164
      result.success = self._handler.createCoupon(args.promotionId, args.arguments, args.isCod, args.prefix)
1174
    except PromotionException, pex:
1165
    except PromotionException, pex:
1175
      result.pex = pex
1166
      result.pex = pex
1176
    oprot.writeMessageBegin("createCoupon", TMessageType.REPLY, seqid)
1167
    oprot.writeMessageBegin("createCoupon", TMessageType.REPLY, seqid)
1177
    result.write(oprot)
1168
    result.write(oprot)
1178
    oprot.writeMessageEnd()
1169
    oprot.writeMessageEnd()
Line 3194... Line 3185...
3194
 
3185
 
3195
class createCoupon_args:
3186
class createCoupon_args:
3196
  """
3187
  """
3197
  Attributes:
3188
  Attributes:
3198
   - promotionId
3189
   - promotionId
3199
   - endOn
-
 
3200
   - email
-
 
3201
   - amount
3190
   - arguments
3202
   - isCod
3191
   - isCod
3203
   - usage
-
 
3204
   - prefix
3192
   - prefix
3205
  """
3193
  """
3206
 
3194
 
3207
  thrift_spec = (
3195
  thrift_spec = (
3208
    None, # 0
3196
    None, # 0
3209
    (1, TType.I64, 'promotionId', None, None, ), # 1
3197
    (1, TType.I64, 'promotionId', None, None, ), # 1
3210
    (2, TType.I64, 'endOn', None, None, ), # 2
-
 
3211
    (3, TType.STRING, 'email', None, None, ), # 3
3198
    (2, TType.STRING, 'arguments', None, None, ), # 2
3212
    (4, TType.I64, 'amount', None, None, ), # 4
-
 
3213
    (5, TType.BOOL, 'isCod', None, None, ), # 5
3199
    (3, TType.BOOL, 'isCod', None, None, ), # 3
3214
    (6, TType.I64, 'usage', None, None, ), # 6
-
 
3215
    (7, TType.STRING, 'prefix', None, None, ), # 7
3200
    (4, TType.STRING, 'prefix', None, None, ), # 4
3216
  )
3201
  )
3217
 
3202
 
3218
  def __init__(self, promotionId=None, endOn=None, email=None, amount=None, isCod=None, usage=None, prefix=None,):
3203
  def __init__(self, promotionId=None, arguments=None, isCod=None, prefix=None,):
3219
    self.promotionId = promotionId
3204
    self.promotionId = promotionId
3220
    self.endOn = endOn
-
 
3221
    self.email = email
-
 
3222
    self.amount = amount
3205
    self.arguments = arguments
3223
    self.isCod = isCod
3206
    self.isCod = isCod
3224
    self.usage = usage
-
 
3225
    self.prefix = prefix
3207
    self.prefix = prefix
3226
 
3208
 
3227
  def read(self, iprot):
3209
  def read(self, iprot):
3228
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
3210
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
3229
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
3211
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
Line 3237... Line 3219...
3237
        if ftype == TType.I64:
3219
        if ftype == TType.I64:
3238
          self.promotionId = iprot.readI64();
3220
          self.promotionId = iprot.readI64();
3239
        else:
3221
        else:
3240
          iprot.skip(ftype)
3222
          iprot.skip(ftype)
3241
      elif fid == 2:
3223
      elif fid == 2:
3242
        if ftype == TType.I64:
-
 
3243
          self.endOn = iprot.readI64();
-
 
3244
        else:
-
 
3245
          iprot.skip(ftype)
-
 
3246
      elif fid == 3:
-
 
3247
        if ftype == TType.STRING:
3224
        if ftype == TType.STRING:
3248
          self.email = iprot.readString();
3225
          self.arguments = iprot.readString();
3249
        else:
3226
        else:
3250
          iprot.skip(ftype)
3227
          iprot.skip(ftype)
3251
      elif fid == 4:
3228
      elif fid == 3:
3252
        if ftype == TType.I64:
-
 
3253
          self.amount = iprot.readI64();
-
 
3254
        else:
-
 
3255
          iprot.skip(ftype)
-
 
3256
      elif fid == 5:
-
 
3257
        if ftype == TType.BOOL:
3229
        if ftype == TType.BOOL:
3258
          self.isCod = iprot.readBool();
3230
          self.isCod = iprot.readBool();
3259
        else:
3231
        else:
3260
          iprot.skip(ftype)
3232
          iprot.skip(ftype)
3261
      elif fid == 6:
3233
      elif fid == 4:
3262
        if ftype == TType.I64:
-
 
3263
          self.usage = iprot.readI64();
-
 
3264
        else:
-
 
3265
          iprot.skip(ftype)
-
 
3266
      elif fid == 7:
-
 
3267
        if ftype == TType.STRING:
3234
        if ftype == TType.STRING:
3268
          self.prefix = iprot.readString();
3235
          self.prefix = iprot.readString();
3269
        else:
3236
        else:
3270
          iprot.skip(ftype)
3237
          iprot.skip(ftype)
3271
      else:
3238
      else:
Line 3280... Line 3247...
3280
    oprot.writeStructBegin('createCoupon_args')
3247
    oprot.writeStructBegin('createCoupon_args')
3281
    if self.promotionId is not None:
3248
    if self.promotionId is not None:
3282
      oprot.writeFieldBegin('promotionId', TType.I64, 1)
3249
      oprot.writeFieldBegin('promotionId', TType.I64, 1)
3283
      oprot.writeI64(self.promotionId)
3250
      oprot.writeI64(self.promotionId)
3284
      oprot.writeFieldEnd()
3251
      oprot.writeFieldEnd()
3285
    if self.endOn is not None:
3252
    if self.arguments is not None:
3286
      oprot.writeFieldBegin('endOn', TType.I64, 2)
-
 
3287
      oprot.writeI64(self.endOn)
-
 
3288
      oprot.writeFieldEnd()
-
 
3289
    if self.email is not None:
-
 
3290
      oprot.writeFieldBegin('email', TType.STRING, 3)
3253
      oprot.writeFieldBegin('arguments', TType.STRING, 2)
3291
      oprot.writeString(self.email)
3254
      oprot.writeString(self.arguments)
3292
      oprot.writeFieldEnd()
-
 
3293
    if self.amount is not None:
-
 
3294
      oprot.writeFieldBegin('amount', TType.I64, 4)
-
 
3295
      oprot.writeI64(self.amount)
-
 
3296
      oprot.writeFieldEnd()
3255
      oprot.writeFieldEnd()
3297
    if self.isCod is not None:
3256
    if self.isCod is not None:
3298
      oprot.writeFieldBegin('isCod', TType.BOOL, 5)
3257
      oprot.writeFieldBegin('isCod', TType.BOOL, 3)
3299
      oprot.writeBool(self.isCod)
3258
      oprot.writeBool(self.isCod)
3300
      oprot.writeFieldEnd()
3259
      oprot.writeFieldEnd()
3301
    if self.usage is not None:
-
 
3302
      oprot.writeFieldBegin('usage', TType.I64, 6)
-
 
3303
      oprot.writeI64(self.usage)
-
 
3304
      oprot.writeFieldEnd()
-
 
3305
    if self.prefix is not None:
3260
    if self.prefix is not None:
3306
      oprot.writeFieldBegin('prefix', TType.STRING, 7)
3261
      oprot.writeFieldBegin('prefix', TType.STRING, 4)
3307
      oprot.writeString(self.prefix)
3262
      oprot.writeString(self.prefix)
3308
      oprot.writeFieldEnd()
3263
      oprot.writeFieldEnd()
3309
    oprot.writeFieldStop()
3264
    oprot.writeFieldStop()
3310
    oprot.writeStructEnd()
3265
    oprot.writeStructEnd()
3311
 
3266