Subversion Repositories SmartDukaan

Rev

Rev 4393 | Rev 4421 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
68 ashish 1
namespace java in.shop2020.model.v1.order
95 ashish 2
namespace py shop2020.thriftpy.model.v1.order
3374 rajveer 3
 
4
include "GenericService.thrift"
5
 
68 ashish 6
/***
7
	Order objects.
8
*/
483 rajveer 9
enum OrderStatus{
845 chandransh 10
	PAYMENT_PENDING,
11
	PAYMENT_FAILED,
483 rajveer 12
	INIT,
13
	SUBMITTED_FOR_PROCESSING,
14
	ACCEPTED,
15
	INVENTORY_LOW,
495 rajveer 16
	REJECTED,
483 rajveer 17
	BILLED,
4245 rajveer 18
	PAYMENT_FLAGGED, 
483 rajveer 19
	SHIPPED_FROM_WH,
20
	SHIPPED_TO_LOGST,
4245 rajveer 21
	PAYMENT_FLAGGED_DENIED,      
483 rajveer 22
	DELIVERY_SUCCESS,
4245 rajveer 23
	CANCEL_REQUEST_RECEIVED,
24
	CANCEL_REQUEST_CONFIRMED,
25
	CANCELLED_ON_CUSTOMER_REQUEST,
26
	CANCELLED_DUE_TO_LOW_INVENTORY,
27
	COMPLETED,                  //Not Used
483 rajveer 28
	CANCELED,
2537 chandransh 29
	FAILED,
30
	SALES_RETURN_IN_TRANSIT,
2611 chandransh 31
	SALES_RET_RECEIVED,
2537 chandransh 32
	DOA_PICKUP_REQUESTED,
33
	DOA_RETURN_AUTHORIZED,
34
	DOA_RETURN_IN_TRANSIT,
2600 chandransh 35
	DOA_RECEIVED,
2537 chandransh 36
	DOA_CERT_INVALID,
2614 chandransh 37
	DOA_CERT_VALID,
38
	SALES_RET_RESHIPPED,
39
	DOA_INVALID_RESHIPPED,
40
	DOA_RESHIPPED,
41
	SALES_RET_REFUNDED,
42
	DOA_VALID_REFUNDED,
43
	DOA_INVALID_REFUNDED,
4303 rajveer 44
	REFUNDED,
45
	LOW_INV_PO_RAISED,
46
	LOW_INV_REVERSAL_IN_PROCESS,
4369 rajveer 47
	LOW_INV_NOT_AVAILABLE_AT_HOTSPOT,
48
	LOW_INV_PO_RAISED_TIMEOUT,
4410 rajveer 49
	LOW_INV_REVERSAL_TIMEOUT,
50
	MANIFESTED
483 rajveer 51
}
52
 
4245 rajveer 53
 
483 rajveer 54
enum TransactionStatus{
55
	INIT,
56
	IN_PROCESS,
57
	COMPLETED,
2964 chandransh 58
	FAILED,
3060 chandransh 59
	AUTHORIZED,
4245 rajveer 60
	COD_IN_PROCESS,
61
	FLAGGED
483 rajveer 62
}
63
 
4008 mandeep.dh 64
enum ExtraTransactionProcessingType {
65
    COD_VERIFICATION,
4245 rajveer 66
    DELAYED_DELIVERY,
67
    PAYMENT_FLAGGED
4008 mandeep.dh 68
}
69
 
483 rajveer 70
struct LineItem{
71
	1:i64 id,
698 chandransh 72
	2:i64 item_id,
4008 mandeep.dh 73
	3:string productGroup,
956 chandransh 74
	4:string brand,
75
	5:string model_number,
76
	6:string color
77
	7:string model_name,
78
	8:string extra_info,
79
	9:double quantity,
80
	10:double unit_price,
81
	11:double unit_weight,
82
	12:double total_price,
1000 varun.gupt 83
	13:double transfer_price,
2780 chandransh 84
	14:double total_weight,
85
	15:optional i64 imei_number,
4172 rajveer 86
	16:optional string item_number,
4295 varun.gupt 87
	17:optional string dealText,
88
	18:i64 warrantry_expiry_timestamp
483 rajveer 89
}
90
 
3553 chandransh 91
enum DelayReason {
92
	INVENTORY_LOW_PHASED_OUT,
93
	INVENTORY_LOW_COLOR_NOT_AVAILABLE,
94
	INVENTORY_LOW_REVERSAL_NOT_ON_TIME,
95
	INVENTORY_LOW_PRODUCT_NOT_SEALED,
96
	COURIER_DELAY_NOT_DELIVERED_TO_COURIER_ON_TIME,
97
	COURIER_DELAY_DID_NOT_CONNECT,
98
	COURIER_DELAY_CUSTOMER_NOT_AVAILABLE,
99
	COURIER_DELAY_INCORRECT_ADDRESS
100
	COURIER_DELAY_OCTROI_DELAY,
101
	COURIER_DELAY_FORCES_OF_NATURE,
102
	COD_VERIFICATION_DELAY,
103
	PAYMENT_FLAGGED,
104
	OTHERS
105
}
483 rajveer 106
 
107
struct Order{
108
	1:i64 id,
109
	2:i64 warehouse_id,
110
	/**
111
		item info
112
	**/
113
	3:list<LineItem> lineitems,
114
	/**
115
	  logistics info
116
	**/
117
	4:i64 logistics_provider_id,
118
	5:string airwaybill_no,
119
	6:string tracking_id,
120
	7:i64 expected_delivery_time,
121
	/**
122
	  customer info
123
	**/
124
	8:i64 customer_id,
125
	9:string customer_name,
126
	10:string customer_mobilenumber,
127
	11:string customer_pincode,
735 chandransh 128
	12:string customer_address1,
129
	13:string customer_address2,
130
	14:string customer_email,
131
	15:string customer_city,
132
	16:string customer_state,
483 rajveer 133
 
134
	/**
135
		status and misc info
136
	**/
735 chandransh 137
	17:OrderStatus status,
138
	18:string statusDescription,
139
	19:double total_amount,
140
	20:double total_weight,
483 rajveer 141
	/**
142
		billing info
143
	**/
735 chandransh 144
	21:string invoice_number,
145
	22:string billed_by,
483 rajveer 146
	/**
147
		timestamps
148
	**/
735 chandransh 149
	23:i64 created_timestamp,
150
	24:i64 accepted_timestamp,
151
	25:i64 billing_timestamp,
152
	26:i64 shipping_timestamp,
1115 chandransh 153
	27:i64 pickup_timestamp,
154
	28:i64 delivery_timestamp,
1210 chandransh 155
	29:i64 outofstock_timestamp,
156
	30:i64 jacket_number,
1223 chandransh 157
	31:string receiver,
158
	32:i64 batchNo,
2537 chandransh 159
	33:i64 serialNo,
160
	34:bool doaFlag,
2675 vikas 161
	35:string pickupRequestNo,
2819 chandransh 162
	36:i64 transactionId,
3060 chandransh 163
	37:string purchaseOrderNo,
3553 chandransh 164
	38:bool cod,
4004 chandransh 165
	39:DelayReason delayReason,
166
	40:i64 promised_delivery_time,
167
	41:i64 expected_shipping_time,
4102 chandransh 168
	42:i64 verification_timestamp,
4192 anupam.sin 169
	43:i64 promised_shipping_time,
170
	44:optional i64 reship_timestamp,
171
	45:optional i64 refund_timestamp,
4245 rajveer 172
	46:optional i64 new_order_id,
4269 anupam.sin 173
	47:OrderStatus previousStatus,
174
	48:i64 vendorId
483 rajveer 175
}
176
 
4245 rajveer 177
struct OrderStatusAuditTrail{
178
	1:i64 id,
179
	2:i64 orderId,
180
	3:i64 status,
181
	4:i64 timestamp,
182
	5:i64 description
183
}
184
 
483 rajveer 185
struct Transaction{
186
	1:i64 id,
187
	2:list<Order> orders,
680 rajveer 188
	3:i64 createdOn,
189
	4:TransactionStatus transactionStatus,
190
	5:string statusDescription,
191
	6:i64 shoppingCartid,
2219 varun.gupt 192
	7:i64 customer_id,
2814 vikas 193
	8:string coupon_code,
194
	9:string sessionSource,
3858 vikas 195
	10:i64 sessionStartTime,
196
	11:string firstSource,
197
    12:i64 firstSourceTime
483 rajveer 198
}
199
 
4393 rajveer 200
enum AlertType{
201
	NEW_INVENTORY_ALERT,
202
	ORDER_READY_TO_ACCEPT
203
}
204
 
483 rajveer 205
struct Alert{
206
	1:i64 id,
4393 rajveer 207
	2:AlertType type,
208
	3:i64 status,
209
	4:i64 timestamp,
210
	5:string description
483 rajveer 211
}
212
 
2688 chandransh 213
struct ReturnOrder{
214
	1:i64 orderId,
2697 chandransh 215
	2:i64 warehouseId,
216
    3:i64 jacketNumber,
217
    4:string invoiceNumber,
218
    5:i64 itemId,
219
    6:string productGroup,
220
    7:string brand,
221
    8:string modelNumber,
222
    9:string modelName,
223
    10:string color,
224
    11:double totalPrice,
225
    12:double transferPrice,
226
    13:bool processedStatus,
227
    14:i64 createdAt,
228
    15:i64 processedAt
2688 chandransh 229
}
230
 
4303 rajveer 231
enum HotspotAction{
232
	PO_RAISED,
233
	REVERSAL_INITIATED,
234
	NOT_AVAILABLE
235
}
236
 
4369 rajveer 237
struct TimeoutSummary{
238
	1:i32 poRaised,
239
	2:i32 poEstimate
240
	3:i32 reversalInitiated,
241
	4:i32 reversalEstimate
242
}
243
 
483 rajveer 244
exception TransactionServiceException{
245
	1:i32 errorCode,
246
	2:string message
247
}
248
 
3374 rajveer 249
service TransactionService extends GenericService.GenericService{
483 rajveer 250
 
251
	i64 createTransaction(1:Transaction transaction) throws (1:TransactionServiceException ex),
252
 
253
	//	Get transaction methods.
254
	Transaction getTransaction(1:i64 id) throws (1:TransactionServiceException ex),
255
	list<Transaction> getTransactionsForCustomer(1:i64 customerId, 2:i64 from_date, 3:i64 to_date, 4:TransactionStatus status) throws (1:TransactionServiceException ex),
256
	list<Transaction> getTransactionsForShoppingCartId(1:i64 shoppingCartId) throws (1:TransactionServiceException ex),
257
	TransactionStatus getTransactionStatus(1:i64 transactionId) throws (1:TransactionServiceException ex),
258
	bool changeTransactionStatus(1:i64 transactionId, 2:TransactionStatus status, 3:string description) throws (1:TransactionServiceException ex),
1382 varun.gupt 259
 
1398 varun.gupt 260
	bool enqueueTransactionInfoEmail(1:i64 transactionId) throws (1:TransactionServiceException ex),
1382 varun.gupt 261
 
483 rajveer 262
	list<Order> getAllOrders(1:OrderStatus status, 2:i64 from_date, 3:i64 to_date, 4:i64 warehouse_id) throws (1:TransactionServiceException ex),
1111 varun.gupt 263
 
1115 chandransh 264
	/**
4133 chandransh 265
	Returns at most 'limit' orders with the given statuses for the given warehouse starting from the given offset.
266
	Pass the status as null and the limit as 0 to ignore them.
267
	*/
268
	list<Order> getOrdersInBatch(1:list<OrderStatus> statuses, 2:i64 offset, 3:i64 limit, 4:i64 warehouse_id) throws (1:TransactionServiceException ex),
269
 
270
	/**
271
	Returns the count of orders with the given statuses assigned to the given warehouse.
272
	*/
273
	i32 getOrderCount(1:list<OrderStatus> statuses, 2:i64 warehouseId) throws (1:TransactionServiceException ex),
274
 
275
	/**
1115 chandransh 276
	Returns orders within a range of their billing dates
277
	*/
1000 varun.gupt 278
	list<Order> getOrdersByBillingDate(1:OrderStatus status, 2:i64 start_billing_date, 3:i64 end_billing_date, 4:i64 warehouse_id) throws (1:TransactionServiceException ex),
1111 varun.gupt 279
 
1382 varun.gupt 280
	/**
3427 chandransh 281
	Returns orders for a particular provider and warehouse which were shipped between the given dates.
3451 chandransh 282
	Returned orders comprise of COD orders if cod parameter is true. It comprises of prepaid orders otherwise. 
283
	Pass providerId and warehouseId as -1 to ignore both these parameters.
3427 chandransh 284
	*/
3451 chandransh 285
	list<Order> getOrdersByShippingDate(1:i64 fromShippingDate, 2:i64 toShippingDate, 3:i64 providerId, 4:i64 warehouseId, 5:bool cod) throws (1:TransactionServiceException ex),
3427 chandransh 286
 
287
	/**
1382 varun.gupt 288
	Returns order ids for orders which can be returned
289
	*/
290
	list<i64> getReturnableOrdersForCustomer(1:i64 customer_id, 2:i64 limit) throws (1:TransactionServiceException ex),
291
 
292
	/**
293
	Returns order ids for orders which can be cancelled
294
	*/
295
	list<i64> getCancellableOrdersForCustomer(1:i64 customer_id, 2:i64 limit) throws (1:TransactionServiceException ex),
296
 
483 rajveer 297
	bool changeOrderStatus(1:i64 orderId, 2:OrderStatus status, 3:string description) throws (1:TransactionServiceException ex),
1147 chandransh 298
 
299
	/**
1529 ankur.sing 300
	Returns list of orders for given transaction Id. Also filters based on customer Id so that
301
	only user who owns the transaction can view its order details.
302
	*/
303
	list<Order> getOrdersForTransaction(1:i64 transactionId 2:i64 customerId)  throws (1:TransactionServiceException ex),
3014 chandransh 304
 
305
	/**
306
	Returns list of orders for the given customer created between the given dates and having the given statuses.
307
	Pass and empty list to ignore filtering on statuses.
308
	*/	
309
	list<Order> getOrdersForCustomer(1:i64 customerId, 2:i64 from_date, 3:i64 to_date, 4:list<OrderStatus> statuses) throws (1:TransactionServiceException ex),
1529 ankur.sing 310
 
483 rajveer 311
	i64 createOrder(1:Order order) throws (1:TransactionServiceException ex),
312
	Order getOrder(1:i64 id) throws (1:TransactionServiceException ex),
313
	list<LineItem> getLineItemsForOrder(1:i64 orderId) throws (1:TransactionServiceException ex),
314
 
1529 ankur.sing 315
 
757 chandransh 316
	/**
1529 ankur.sing 317
	Returns an order for the order Id. Also checks if the order belongs to the customer whose Id is passed.
318
	Throws exception if either order Id is invalid or order does not below to the customer whose Id is passed.
319
	*/
320
	Order getOrderForCustomer(1:i64 orderId, 2:i64 customerId) throws (1:TransactionServiceException ex),
321
 
3060 chandransh 322
	//Alerts apis 
4393 rajveer 323
	list<Alert> getAlerts(1:i64 type, 2:i64 status, 3:i64 timestamp),
324
	void addAlert(1:i64 type, 2:string description),
3060 chandransh 325
 
1529 ankur.sing 326
	/**
3060 chandransh 327
	Return the number of valid orders. (OrderStatus >= OrderStatus.SUBMITTED_FOR_PROCESSING)
328
	*/
329
	i64 getValidOrderCount(),
330
 
331
	/**
332
	Returns the number of distinct customers who have done successful transactions
333
	*/
334
	i64 getNoOfCustomersWithSuccessfulTransaction(),
335
 
336
	/**
337
	Returns the minimum and maximum amounts of a valid order. (OrderStatus >= OrderStatus.SUBMITTED_FOR_PROCESSING)
338
	List contains two values, first minimum amount and second maximum amount.	
339
	*/
340
	list<double> getValidOrdersAmountRange(),
341
 
342
	/**
343
	Returns list of Orders in descending order by Order creation date. List is restricted to limit Orders.
344
	If limit is passed as 0, then all valid Orders are returned. 
345
	*/
346
	list<Order> getValidOrders(1:i64 limit),
347
 
348
	/**
349
	Create a batch of all the pending orders for the given warehouse.
350
	The returned list is orderd by created_timestamp.
351
	If there are no pending orders, an empty list is returned.
352
	*/
1223 chandransh 353
	list<Order> batchOrders(1:i64 warehouseId) throws (1:TransactionServiceException ex),
354
 
355
	/**
356
	Mark the given order as out of stock. Throws an exception if the order with the given Id couldn't be found. 
1244 chandransh 357
	*/
1210 chandransh 358
	bool markOrderAsOutOfStock(1:i64 orderId) throws (1:TransactionServiceException ex),
359
 
360
	/**
3060 chandransh 361
	Marks the given order as SUBMITTED_FOR_PROCESSING and updates the verified
362
	timestamp. It is intended to be used for COD orders but can be harmlessly 
363
	used for all other orders as well.
364
	Throws an exception if no such order exists.
757 chandransh 365
	*/
3060 chandransh 366
	bool verifyOrder(1:i64 orderId) throws (1:TransactionServiceException ex),
1115 chandransh 367
 
368
	/**
3060 chandransh 369
	Marks the given order as ACCEPTED and updates the accepted timestamp. If the
370
	given order is not a COD order, it also captures the payment if the same has
371
	not been captured.
372
	Throws an exception if no such order exists.
373
	*/
374
	bool acceptOrder(1:i64 orderId) throws (1:TransactionServiceException ex),
375
 
376
	/**
377
	Add billing details such as the bill number and the biller to the Order.
378
	Adds jacket number, item number and IMEI no. to the order. Doesn't update
379
	the IMEI no. if a -1 is supplied.
380
	Also, it generates an invoice number for the order, marks the order as
381
	BILLED and sets the billing timestamp.
382
	Returns false if it doesn't find the order with the given ID.
383
	*/
4283 anupam.sin 384
	bool addBillingDetails(1:i64 orderId, 2:string invoice_number, 3:i64 imeiNumber, 4:string itemNumber, 5:string billed_by, 6:i64 jacketNumber, 7:i64 billingType, 8:i64 vendorId) throws (1:TransactionServiceException ex),
385
 
3060 chandransh 386
	/**
387
	Depending on the third parameter, marks either all prepaid or all cod orders BILLED by the
4410 rajveer 388
	given warehouse and were picked up by the given provider as MANIFESTED.
3060 chandransh 389
	*/
390
	bool markOrdersAsManifested(1:i64 warehouseId, 2:i64 providerId, 3:bool cod) throws (1:TransactionServiceException ex),
4410 rajveer 391
 
3060 chandransh 392
	/**
4410 rajveer 393
	Depending on the third parameter, marks either all prepaid or all cod orders BILLED and marked as MANIFESTED by the
394
	given warehouse and were picked up by the given provider as SHIPPED_FROM_WH.
395
	*/
396
	bool markOrdersAsShippedFromWarehouse(1:i64 warehouseId, 2:i64 providerId, 3:bool cod) throws (1:TransactionServiceException ex),
397
 
398
	/**
1115 chandransh 399
	Marks all SHIPPED_FROM_WH orders of the previous day for a provider as SHIPPED_TO_LOGISTICS.
400
	Returns a list of orders that were shipped from warehouse but did not appear in the pick-up report.
401
	Raises an exception if we encounter report for an AWB number that we did not ship.
402
	*/
1244 chandransh 403
	list<Order> markOrdersAsPickedUp(1:i64 providerId, 2:map<string, string> pickupDetails) throws (1:TransactionServiceException ex),
1134 chandransh 404
 
405
	/**
406
	Marks all orders with AWBs in the given map as delivered. Also sets the delivery timestamp and
407
	the name of the receiver.
408
	Raises an exception if we encounter report for an AWB number that we did not ship.
409
	*/
410
	void markOrdersAsDelivered(1:i64 providerId, 2:map<string, string> deliveredOrders) throws (1:TransactionServiceException ex),
411
 
412
	/**
413
	Mark all orders with AWBs in the given map as failed. Also sets the delivery timestamp.
414
	Raises an exception if we encounter report for an AWB number that we did not ship.
415
	*/
416
	void markOrdersAsFailed(1:i64 providerId, 2:map<string, string> returnedOrders) throws (1:TransactionServiceException ex),
417
 
1244 chandransh 418
	/**
419
	Update the status description of orders whose AWB numbers are keys of the Map.
420
	*/
421
	void updateNonDeliveryReason(1:i64 providerId, 2:map<string, string> undeliveredOrders) throws (1:TransactionServiceException ex),
422
 
1407 ankur.sing 423
	/**
424
	Returns the list of orders whose delivery time has passed but have not been
425
	delivered yet for the given provider and warehouse. To get a complete list of
426
	undelivered orders, pass them as -1. 
427
	Returns an empty list if no such orders exist.
428
	*/
429
	list<Order> getUndeliveredOrders(1:i64 providerId, 2:i64 warehouseId),
430
 
1599 ankur.sing 431
	/**
2537 chandransh 432
	Toggle the DOA flag of an order. This should be used to flag an order for follow-up and unflag it when the follow-up is complete.
433
	Returns the final flag status.
434
	Throws an exception if the order with the given id couldn't be found or if the order status is not DELVIERY_SUCCESS. 
435
	*/
436
	bool toggleDOAFlag(1:i64 orderId) throws (1:TransactionServiceException ex),
437
 
438
	/**
439
	Sends out an email to the account manager of the original courier provider used to ship the order.
440
	If the order status was DELIVERY_SUCCESS, it is changed to be DOA_PICKUP_REQUESTED.
441
	If the order status was DOA_PICKUP_REQUESTED, it is left unchanged.
442
	For any other status, it returns false.
443
	Throws an exception if the order with the given id couldn't be found.
444
	*/
445
	bool requestPickupNumber(1:i64 orderId) throws (1:TransactionServiceException ex),
446
 
447
	/**
448
	If the order status is DOA_PICKUP_REQUESTED, it does the following
449
		1. Sends out an email to the customer with the dispatch advice that he has to print as an attachment.
450
		2. Changes order status to be DOA_PICKUP_AUTHORIZED.
451
		3. Returns true
2589 chandransh 452
	If the order is in any other status, it returns false.
2537 chandransh 453
	Throws an exception if the order with the given id couldn't be found.
454
	*/
455
	bool authorizePickup(1:i64 orderId, 2:string pickupNumber) throws (1:TransactionServiceException ex),
2589 chandransh 456
 
457
	/**
2765 chandransh 458
	Marks all DOA_PICKUP_AUTHORIZED orders of the previous day for a provider as DOA_RETURN_IN_TRANSIT.
459
	Returns a list of orders that were authorized for pickup but did not appear in the pick-up report.
460
	*/
461
	list<Order> markDoasAsPickedUp(1:i64 providerId, 2:map<string, string> pickupDetails),
462
 
463
	/**
2600 chandransh 464
	If the order status is DOA_RETURN_AUTHORIZED or DOA_RETURN_IN_TRANSIT, marks the order status as DOA_RECEIVED and returns true.
2614 chandransh 465
	If the order status is SALES_RETURN_IN_TRANSIT, marks the order status as SALES_RET_RECEIVED and returns true.
2589 chandransh 466
	If the order is in any other state, it returns false.
467
	Throws an exception if the order with the given id couldn't be found.
468
	*/
2614 chandransh 469
	bool receiveReturn(1:i64 orderId) throws (1:TransactionServiceException ex),
2589 chandransh 470
 
471
	/**
2600 chandransh 472
	Used to validate the DOA certificate for an order in the DOA_RECEIVED state. If the certificate is valid,
2614 chandransh 473
	the order state is changed to DOA_CERT_VALID. If the certificate is invalid, the order state is changed to DOA_CERT_INVALID.
2589 chandransh 474
	If the order is in any other state, it returns false.
475
	Throws an exception if the order with the given id couldn't be found.
476
	*/
477
	bool validateDoa(1:i64 orderId, 2:bool isValid) throws (1:TransactionServiceException ex),
2614 chandransh 478
 
479
	/**
480
	If the order is in SALES_RET_RECEIVED or DOA_CERT_INVALID state, it does the following:
481
		1. Creates a new order for processing in the BILLED state. All billing information is saved.
482
		2. Marks the current order as one of the final states SALES_RET_RESHIPPED and DOA_INVALID_RESHIPPED depending on what state the order started in.
483
 
484
	If the order is in DOA_CERT_VALID state, it does the following:
485
		1. Creates a new order for processing in the SUBMITTED_FOR_PROCESSING state.
486
		2. Creates a return order for the warehouse executive to return the DOA material.
487
		3. Marks the current order as the final DOA_RESHIPPED state.
488
 
489
	Returns the id of the newly created order.
490
 
491
	Throws an exception if the order with the given id couldn't be found.
492
	*/
493
	i64 reshipOrder(1:i64 orderId) throws (1:TransactionServiceException ex),
494
 
495
	/**
496
	If the order is in SALES_RET_RECEIVED, DOA_CERT_VALID or DOA_CERT_INVALID state, it does the following:
497
		1. Creates a refund request for batch processing.
498
		2. Creates a return order for the warehouse executive to return the shipped material.
499
		3. Marks the current order as SALES_RET_REFUNDED, DOA_VALID_REFUNDED or DOA_INVALID_REFUNDED final states.
500
 
501
	If the order is in SUBMITTED_FOR_PROCESSING or INVENTORY_LOW state, it does the following:
502
		1. Creates a refund request for batch processing.
3226 chandransh 503
		2. Cancels the reservation of the item in the warehouse.
504
		3. Marks the current order as the REFUNDED final state.
2614 chandransh 505
 
3226 chandransh 506
	For all COD orders, if the order is in INIT, SUBMITTED_FOR_PROCESSING or INVENTORY_LOW state, it does the following:
507
		1. Cancels the reservation of the item in the warehouse.
508
		2. Marks the current order as CANCELED.	
509
 
510
	In all cases, it updates the reason for cancellation or refund and the person who performed the action.
511
 
2614 chandransh 512
	Returns True if it is successful, False otherwise.
513
 
514
	Throws an exception if the order with the given id couldn't be found.
515
	*/
3226 chandransh 516
	bool refundOrder(1:i64 orderId, 2:string refundedBy, 3:string reason) throws (1:TransactionServiceException ex),
2688 chandransh 517
 
518
	/**
519
	Get all return orders created between the from and to dates for the given warehouse.
520
	Ignores the warehouse if it is passed as -1.
521
	*/
522
	list<ReturnOrder> getReturnOrders(1:i64 warehouseId, 2:i64 fromDate, 3:i64 toDate),
523
 
524
	/**
2700 chandransh 525
	Returns the ReturnOrder corresponding to the given id.
526
	Throws an exception if the return order with the given id couldn't be found.
527
	*/
528
	ReturnOrder getReturnOrder(1:i64 id) throws (1:TransactionServiceException ex),
529
 
530
	/**
2688 chandransh 531
	Marks the return order with the given id as processed. Raises an exception if no such return order exists. 
532
	*/
2819 chandransh 533
	void processReturn(1:i64 returnOrderId) throws (1:TransactionServiceException ex),
534
 
535
	/**
536
	Creates a purchase order corresponding to all the pending orders of the given warehouse.
537
	Returns the PO no. of the newly created purchase order. Returns -1 no new purchase order had to be created.
538
	*/
3451 chandransh 539
	i64 createPurchaseOrder(1:i64 warehouseId) throws (1:TransactionServiceException ex),
540
 
541
	/**
542
	Set the weight of the given order to the provided value. Will attempt to update the weight of the item in the catalog as well.
543
	*/
3469 chandransh 544
	Order updateWeight(1:i64 orderId, 2:double weight) throws (1:TransactionServiceException ex),
545
 
546
	/**
547
	Change the item to be shipped for this order. Also adjusts the reservation in the inventory accordingly.
548
	Currently, it also ensures that only a different color of the given item is shipped.
549
	*/
550
	Order changeItem(1:i64 orderId, 2:i64 itemId) throws (1:TransactionServiceException ex),
551
 
552
	/**
553
	Moves the given order to the given warehouse. Also adjusts the inventory reservations accordingly.
554
	*/
3553 chandransh 555
	Order shiftToWarehouse(1:i64 orderId, 2:i64 warehouseId) throws (1:TransactionServiceException ex),
556
 
557
	/**
558
	Adds the given delay reason to the given order.
3986 chandransh 559
	Increases the expected delivery time of the given order by the given no. of days.
3553 chandransh 560
	Raises an exception if no order with the given id can be found.
561
	*/
3986 chandransh 562
	bool addDelayReason(1:i64 orderId, 2:DelayReason delayReason, 3:i64 furtherDelay) throws (1:TransactionServiceException ex),
3956 chandransh 563
 
564
	/**
565
	Marks the COD orders with given AWB nos. as having been processed.
566
	Updates the captured amount for the corresponding payment.
567
 
568
	Returns a map of AWBs which were not processed and the associated reason. An AWB is not processed if:
569
	1. There is no order corresponding to an AWB number.
570
	2. The captured amount for a payment exceeds the total payment.
571
	3. The order corresponding to an AWB no. is in a state prior to DELIVERY_SUCCESS.
572
	*/
4008 mandeep.dh 573
	map<string, string> reconcileCodCollection(1:map<string, double> collectedAmountMap, 2:string xferBy, 3:string xferTxnId, 4:i64 xferDate) throws (1:TransactionServiceException ex),
574
 
575
    /**
4065 mandeep.dh 576
     * Returns the list of transaction ids that require some extra processing and
4008 mandeep.dh 577
     * which belong to a particular category. This is currently used by CRM
4065 mandeep.dh 578
     * application. If no such transaction ids are present, it returns an empty list.
4008 mandeep.dh 579
     */
580
    list<i64> getTransactionsRequiringExtraProcessing(1:ExtraTransactionProcessingType category),
581
 
582
	/**
583
	 * Marks a particular transaction as processed for a particular cateogory.
4065 mandeep.dh 584
	 * It essentially deletes the transaction id record for a particular
585
	 * processing type category (if present) from DB.
586
	 * This is currently used by CRM application.
4008 mandeep.dh 587
	 */
4018 chandransh 588
	void markTransactionAsProcessed(1:i64 transactionId, 2:ExtraTransactionProcessingType category),
589
 
590
	/**
591
	Returns a map containing the number of risky orders keyed by item id. A risky order
592
	is defined as one whose shipping date is about to expire.
593
	*/
4245 rajveer 594
	map<i64, i64> getItemWiseRiskyOrdersCount(),
595
 
596
	/**
4295 varun.gupt 597
	Returns a list of all orders which have items with given id
598
	*/
599
	list<Order> getOrdersForItemIds(1:list<i64> itemIds),
600
 
601
	/**
4245 rajveer 602
	 * Mark order as cancellation request received. If customer sends request of cancellation of 
603
	 * a particular order, this method will be called. It will just change status of the order 
604
	 * depending on its current status. It also records the previous status, so that we can move 
605
	 * back to that status if cancellation request is denied.
606
	 */
607
	void markOrderCancellationRequestReceived(1:i64 orderId) throws (1:TransactionServiceException ex),
608
 
609
	/**
610
	 * If we decide to to cancel order, CRM will call this method to move the status of order to 
611
	 * cancellation request confirmed. After this OM will be able to cancel the order. 	
612
	 */
613
	void markOrderCancellationRequestConfirmed(1:i64 orderId) throws (1:TransactionServiceException ex),
614
 
615
	/**
616
	 * If we decide to not to cancel order, we will move the order ro previous status.	
617
	 */
618
	void markOrderCancellationRequestDenied(1:i64 orderId) throws (1:TransactionServiceException ex),
619
 
620
	/**
4258 rajveer 621
	 * If we and/or payment gateway has decided to accept the payment, this method needs to be called.
622
	 * Changed transaction and all orders status to payment accepted.  
4245 rajveer 623
	 */
4285 rajveer 624
	void markTransactionAsPaymentFlagRemoved(1:i64 transactionId) throws (1:TransactionServiceException ex),
4245 rajveer 625
 
4259 anupam.sin 626
	/**
627
	* This method is called when a flagged payment is deemed unserviceable and the corresponding orders
628
	* need to be cancelled
629
	*/
4285 rajveer 630
	void refundTransaction(1:i64 transactionId, 2:string refundedBy, 3:string reason) throws (1:TransactionServiceException ex),
4324 mandeep.dh 631
 
632
	/**
633
	 * Updates shipment address of an order. Delivery and shipping date estimates
634
	 * etc. are also updated here.
635
	 *
636
	 * Throws TransactionServiceException in case address change is not
637
	 * possible due to certain reasons such as new pincode in address is
638
	 * not serviceable etc.
639
	 */
640
	void updateShipmentAddress(1:i64 orderId, 2:i64 addressId) throws (1:TransactionServiceException ex)
4285 rajveer 641
 
642
	/**
643
	Marks the orders as ACCEPTED for the given itemId and inventory. It also updates the accepted timestamp. If the
644
	given order is not a COD order, it also captures the payment if the same has not been captured.
645
	*/
4303 rajveer 646
	bool acceptOrdersForItemId(1:i64 itemId, 2:i64 inventory) throws (1:TransactionServiceException ex),
4285 rajveer 647
 
4369 rajveer 648
	void markOrdersAsPORaised(1:i64 vendorId, 2:i64 itemId, 3:i64 quantity, 4:i64 estimate, 5:bool isReminder) throws (1:TransactionServiceException ex),
649
	void markOrdersAsReversalInitiated(1:i64 vendorId, 2:i64 itemId, 3:i64 quantity, 4:i64 estimate, 5:bool isReminder) throws (1:TransactionServiceException ex),
650
	void markOrdersAsNotAvailabke(1:i64 vendorId, 2:i64 itemId, 3:i64 quantity, 4:i64 estimate, 5:bool isReminder) throws (1:TransactionServiceException ex),
651
 
4386 anupam.sin 652
	map<i32, TimeoutSummary> markOrdersAsTimeout(1:i64 vendorId) throws (1:TransactionServiceException ex),
4369 rajveer 653
 
4386 anupam.sin 654
	/**
655
	Returns the order corresponding to an AWB number
656
	*/
657
	Order getOrderForAwb(1:string awb) throws (1:TransactionServiceException ex)
4369 rajveer 658
 
1115 chandransh 659
}