Subversion Repositories SmartDukaan

Rev

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

Rev 3064 Rev 3226
Line 477... Line 477...
477
    Parameters:
477
    Parameters:
478
     - orderId
478
     - orderId
479
    """
479
    """
480
    pass
480
    pass
481
 
481
 
482
  def refundOrder(self, orderId):
482
  def refundOrder(self, orderId, refundedBy, reason):
483
    """
483
    """
484
    If the order is in SALES_RET_RECEIVED, DOA_CERT_VALID or DOA_CERT_INVALID state, it does the following:
484
    If the order is in SALES_RET_RECEIVED, DOA_CERT_VALID or DOA_CERT_INVALID state, it does the following:
485
    	1. Creates a refund request for batch processing.
485
    	1. Creates a refund request for batch processing.
486
    	2. Creates a return order for the warehouse executive to return the shipped material.
486
    	2. Creates a return order for the warehouse executive to return the shipped material.
487
    	3. Marks the current order as SALES_RET_REFUNDED, DOA_VALID_REFUNDED or DOA_INVALID_REFUNDED final states.
487
    	3. Marks the current order as SALES_RET_REFUNDED, DOA_VALID_REFUNDED or DOA_INVALID_REFUNDED final states.
488
    
488
    
489
    If the order is in SUBMITTED_FOR_PROCESSING or INVENTORY_LOW state, it does the following:
489
    If the order is in SUBMITTED_FOR_PROCESSING or INVENTORY_LOW state, it does the following:
490
    	1. Creates a refund request for batch processing.
490
    	1. Creates a refund request for batch processing.
-
 
491
    	2. Cancels the reservation of the item in the warehouse.
491
    	2. Marks the current order as the REFUNDED final state.
492
    	3. Marks the current order as the REFUNDED final state.
492
    
493
    
-
 
494
    For all COD orders, if the order is in INIT, SUBMITTED_FOR_PROCESSING or INVENTORY_LOW state, it does the following:
-
 
495
    	1. Cancels the reservation of the item in the warehouse.
-
 
496
    	2. Marks the current order as CANCELED.
-
 
497
    	
-
 
498
    In all cases, it updates the reason for cancellation or refund and the person who performed the action.
-
 
499
     
493
    Returns True if it is successful, False otherwise.
500
    Returns True if it is successful, False otherwise.
494
    
501
    
495
    Throws an exception if the order with the given id couldn't be found.
502
    Throws an exception if the order with the given id couldn't be found.
496
    
503
    
497
    Parameters:
504
    Parameters:
498
     - orderId
505
     - orderId
-
 
506
     - refundedBy
-
 
507
     - reason
499
    """
508
    """
500
    pass
509
    pass
501
 
510
 
502
  def getReturnOrders(self, warehouseId, fromDate, toDate):
511
  def getReturnOrders(self, warehouseId, fromDate, toDate):
503
    """
512
    """
Line 2143... Line 2152...
2143
      return result.success
2152
      return result.success
2144
    if result.ex != None:
2153
    if result.ex != None:
2145
      raise result.ex
2154
      raise result.ex
2146
    raise TApplicationException(TApplicationException.MISSING_RESULT, "reshipOrder failed: unknown result");
2155
    raise TApplicationException(TApplicationException.MISSING_RESULT, "reshipOrder failed: unknown result");
2147
 
2156
 
2148
  def refundOrder(self, orderId):
2157
  def refundOrder(self, orderId, refundedBy, reason):
2149
    """
2158
    """
2150
    If the order is in SALES_RET_RECEIVED, DOA_CERT_VALID or DOA_CERT_INVALID state, it does the following:
2159
    If the order is in SALES_RET_RECEIVED, DOA_CERT_VALID or DOA_CERT_INVALID state, it does the following:
2151
    	1. Creates a refund request for batch processing.
2160
    	1. Creates a refund request for batch processing.
2152
    	2. Creates a return order for the warehouse executive to return the shipped material.
2161
    	2. Creates a return order for the warehouse executive to return the shipped material.
2153
    	3. Marks the current order as SALES_RET_REFUNDED, DOA_VALID_REFUNDED or DOA_INVALID_REFUNDED final states.
2162
    	3. Marks the current order as SALES_RET_REFUNDED, DOA_VALID_REFUNDED or DOA_INVALID_REFUNDED final states.
2154
    
2163
    
2155
    If the order is in SUBMITTED_FOR_PROCESSING or INVENTORY_LOW state, it does the following:
2164
    If the order is in SUBMITTED_FOR_PROCESSING or INVENTORY_LOW state, it does the following:
2156
    	1. Creates a refund request for batch processing.
2165
    	1. Creates a refund request for batch processing.
-
 
2166
    	2. Cancels the reservation of the item in the warehouse.
2157
    	2. Marks the current order as the REFUNDED final state.
2167
    	3. Marks the current order as the REFUNDED final state.
2158
    
2168
    
-
 
2169
    For all COD orders, if the order is in INIT, SUBMITTED_FOR_PROCESSING or INVENTORY_LOW state, it does the following:
-
 
2170
    	1. Cancels the reservation of the item in the warehouse.
-
 
2171
    	2. Marks the current order as CANCELED.
-
 
2172
    	
-
 
2173
    In all cases, it updates the reason for cancellation or refund and the person who performed the action.
-
 
2174
     
2159
    Returns True if it is successful, False otherwise.
2175
    Returns True if it is successful, False otherwise.
2160
    
2176
    
2161
    Throws an exception if the order with the given id couldn't be found.
2177
    Throws an exception if the order with the given id couldn't be found.
2162
    
2178
    
2163
    Parameters:
2179
    Parameters:
2164
     - orderId
2180
     - orderId
-
 
2181
     - refundedBy
-
 
2182
     - reason
2165
    """
2183
    """
2166
    self.send_refundOrder(orderId)
2184
    self.send_refundOrder(orderId, refundedBy, reason)
2167
    return self.recv_refundOrder()
2185
    return self.recv_refundOrder()
2168
 
2186
 
2169
  def send_refundOrder(self, orderId):
2187
  def send_refundOrder(self, orderId, refundedBy, reason):
2170
    self._oprot.writeMessageBegin('refundOrder', TMessageType.CALL, self._seqid)
2188
    self._oprot.writeMessageBegin('refundOrder', TMessageType.CALL, self._seqid)
2171
    args = refundOrder_args()
2189
    args = refundOrder_args()
2172
    args.orderId = orderId
2190
    args.orderId = orderId
-
 
2191
    args.refundedBy = refundedBy
-
 
2192
    args.reason = reason
2173
    args.write(self._oprot)
2193
    args.write(self._oprot)
2174
    self._oprot.writeMessageEnd()
2194
    self._oprot.writeMessageEnd()
2175
    self._oprot.trans.flush()
2195
    self._oprot.trans.flush()
2176
 
2196
 
2177
  def recv_refundOrder(self, ):
2197
  def recv_refundOrder(self, ):
Line 3007... Line 3027...
3007
    args = refundOrder_args()
3027
    args = refundOrder_args()
3008
    args.read(iprot)
3028
    args.read(iprot)
3009
    iprot.readMessageEnd()
3029
    iprot.readMessageEnd()
3010
    result = refundOrder_result()
3030
    result = refundOrder_result()
3011
    try:
3031
    try:
3012
      result.success = self._handler.refundOrder(args.orderId)
3032
      result.success = self._handler.refundOrder(args.orderId, args.refundedBy, args.reason)
3013
    except TransactionServiceException, ex:
3033
    except TransactionServiceException, ex:
3014
      result.ex = ex
3034
      result.ex = ex
3015
    oprot.writeMessageBegin("refundOrder", TMessageType.REPLY, seqid)
3035
    oprot.writeMessageBegin("refundOrder", TMessageType.REPLY, seqid)
3016
    result.write(oprot)
3036
    result.write(oprot)
3017
    oprot.writeMessageEnd()
3037
    oprot.writeMessageEnd()
Line 9095... Line 9115...
9095
 
9115
 
9096
class refundOrder_args:
9116
class refundOrder_args:
9097
  """
9117
  """
9098
  Attributes:
9118
  Attributes:
9099
   - orderId
9119
   - orderId
-
 
9120
   - refundedBy
-
 
9121
   - reason
9100
  """
9122
  """
9101
 
9123
 
9102
  thrift_spec = (
9124
  thrift_spec = (
9103
    None, # 0
9125
    None, # 0
9104
    (1, TType.I64, 'orderId', None, None, ), # 1
9126
    (1, TType.I64, 'orderId', None, None, ), # 1
-
 
9127
    (2, TType.STRING, 'refundedBy', None, None, ), # 2
-
 
9128
    (3, TType.STRING, 'reason', None, None, ), # 3
9105
  )
9129
  )
9106
 
9130
 
9107
  def __init__(self, orderId=None,):
9131
  def __init__(self, orderId=None, refundedBy=None, reason=None,):
9108
    self.orderId = orderId
9132
    self.orderId = orderId
-
 
9133
    self.refundedBy = refundedBy
-
 
9134
    self.reason = reason
9109
 
9135
 
9110
  def read(self, iprot):
9136
  def read(self, iprot):
9111
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
9137
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
9112
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
9138
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
9113
      return
9139
      return
Line 9119... Line 9145...
9119
      if fid == 1:
9145
      if fid == 1:
9120
        if ftype == TType.I64:
9146
        if ftype == TType.I64:
9121
          self.orderId = iprot.readI64();
9147
          self.orderId = iprot.readI64();
9122
        else:
9148
        else:
9123
          iprot.skip(ftype)
9149
          iprot.skip(ftype)
-
 
9150
      elif fid == 2:
-
 
9151
        if ftype == TType.STRING:
-
 
9152
          self.refundedBy = iprot.readString();
-
 
9153
        else:
-
 
9154
          iprot.skip(ftype)
-
 
9155
      elif fid == 3:
-
 
9156
        if ftype == TType.STRING:
-
 
9157
          self.reason = iprot.readString();
-
 
9158
        else:
-
 
9159
          iprot.skip(ftype)
9124
      else:
9160
      else:
9125
        iprot.skip(ftype)
9161
        iprot.skip(ftype)
9126
      iprot.readFieldEnd()
9162
      iprot.readFieldEnd()
9127
    iprot.readStructEnd()
9163
    iprot.readStructEnd()
9128
 
9164
 
Line 9133... Line 9169...
9133
    oprot.writeStructBegin('refundOrder_args')
9169
    oprot.writeStructBegin('refundOrder_args')
9134
    if self.orderId != None:
9170
    if self.orderId != None:
9135
      oprot.writeFieldBegin('orderId', TType.I64, 1)
9171
      oprot.writeFieldBegin('orderId', TType.I64, 1)
9136
      oprot.writeI64(self.orderId)
9172
      oprot.writeI64(self.orderId)
9137
      oprot.writeFieldEnd()
9173
      oprot.writeFieldEnd()
-
 
9174
    if self.refundedBy != None:
-
 
9175
      oprot.writeFieldBegin('refundedBy', TType.STRING, 2)
-
 
9176
      oprot.writeString(self.refundedBy)
-
 
9177
      oprot.writeFieldEnd()
-
 
9178
    if self.reason != None:
-
 
9179
      oprot.writeFieldBegin('reason', TType.STRING, 3)
-
 
9180
      oprot.writeString(self.reason)
-
 
9181
      oprot.writeFieldEnd()
9138
    oprot.writeFieldStop()
9182
    oprot.writeFieldStop()
9139
    oprot.writeStructEnd()
9183
    oprot.writeStructEnd()
9140
 
9184
 
9141
  def __repr__(self):
9185
  def __repr__(self):
9142
    L = ['%s=%r' % (key, value)
9186
    L = ['%s=%r' % (key, value)