Subversion Repositories SmartDukaan

Rev

Rev 845 | Rev 956 | 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
68 ashish 3
/***
4
	Order objects.
5
*/
483 rajveer 6
enum OrderStatus{
845 chandransh 7
	PAYMENT_PENDING,
8
	PAYMENT_FAILED,
483 rajveer 9
	INIT,
10
	SUBMITTED_FOR_PROCESSING,
11
	ACCEPTED,
12
	INVENTORY_LOW,
495 rajveer 13
	REJECTED,
483 rajveer 14
	BILLED,
15
	READY_FOR_SHIPPING,
16
	SHIPPED_FROM_WH,
17
	SHIPPED_TO_LOGST,
18
	IN_TRANSIT,
19
	DELIVERY_SUCCESS,
20
	DELIVERY_FAILED_FIRST_ATTEMPT,
21
	DELIVERY_FAILED_SECOND_ATTEMPT,
22
	DELIVERY_FAILED_THIRD_ATTEMPT,
23
	DELIVERY_FAILED_WORNG_ADDRESS
24
	COMPLETED,
25
	CANCELED,
845 chandransh 26
	FAILED
483 rajveer 27
}
28
 
29
enum TransactionStatus{
30
	INIT,
31
	IN_PROCESS,
32
	COMPLETED,
33
	FAILED
34
}
35
 
36
 
37
struct LineItem{
38
	1:i64 id,
698 chandransh 39
	2:i64 item_id,
483 rajveer 40
	3:string brand,
41
	4:string model_number,
42
	5:string model_name,
43
	6:string extra_info,
44
	7:double quantity,
45
	8:double unit_price,
46
	9:double unit_weight,
47
	10:double total_price,
667 chandransh 48
	11:double total_weight,
49
	12:string color
483 rajveer 50
}
51
 
52
 
53
struct Order{
54
	1:i64 id,
55
	2:i64 warehouse_id,
56
	/**
57
		item info
58
	**/
59
	3:list<LineItem> lineitems,
60
	/**
61
	  logistics info
62
	**/
63
	4:i64 logistics_provider_id,
64
	5:string airwaybill_no,
65
	6:string tracking_id,
66
	7:i64 expected_delivery_time,
67
	/**
68
	  customer info
69
	**/
70
	8:i64 customer_id,
71
	9:string customer_name,
72
	10:string customer_mobilenumber,
73
	11:string customer_pincode,
735 chandransh 74
	12:string customer_address1,
75
	13:string customer_address2,
76
	14:string customer_email,
77
	15:string customer_city,
78
	16:string customer_state,
483 rajveer 79
 
80
	/**
81
		status and misc info
82
	**/
735 chandransh 83
	17:OrderStatus status,
84
	18:string statusDescription,
85
	19:double total_amount,
86
	20:double total_weight,
483 rajveer 87
	/**
88
		billing info
89
	**/
735 chandransh 90
	21:string invoice_number,
91
	22:string billed_by,
483 rajveer 92
	/**
93
		timestamps
94
	**/
735 chandransh 95
	23:i64 created_timestamp,
96
	24:i64 accepted_timestamp,
97
	25:i64 billing_timestamp,
98
	26:i64 shipping_timestamp,
99
	27:i64 delivery_timestamp,
100
	28:i64 jacket_number,
483 rajveer 101
}
102
 
103
struct Transaction{
104
	1:i64 id,
105
	2:list<Order> orders,
680 rajveer 106
	3:i64 createdOn,
107
	4:TransactionStatus transactionStatus,
108
	5:string statusDescription,
109
	6:i64 shoppingCartid,
110
	7:i64 customer_id
483 rajveer 111
}
112
 
113
struct Alert{
114
	1:i64 id,
115
	2:i64 order_id,
116
	3:i64 type,
117
	4:i64 time_set,
118
	5:string comment,
119
	6:i64 time_unset
120
}
121
 
122
exception TransactionServiceException{
123
	1:i32 errorCode,
124
	2:string message
125
}
126
 
127
service TransactionService{
128
 
763 rajveer 129
	/**
130
	* For closing the open session in sqlalchemy
131
	*/
132
	void closeSession(),
133
 
483 rajveer 134
	i64 createTransaction(1:Transaction transaction) throws (1:TransactionServiceException ex),
135
 
136
	//	Get transaction methods.
137
	Transaction getTransaction(1:i64 id) throws (1:TransactionServiceException ex),
138
	list<Transaction> getTransactionsForCustomer(1:i64 customerId, 2:i64 from_date, 3:i64 to_date, 4:TransactionStatus status) throws (1:TransactionServiceException ex),
139
	list<Transaction> getTransactionsForShoppingCartId(1:i64 shoppingCartId) throws (1:TransactionServiceException ex),
140
	TransactionStatus getTransactionStatus(1:i64 transactionId) throws (1:TransactionServiceException ex),
141
	bool changeTransactionStatus(1:i64 transactionId, 2:TransactionStatus status, 3:string description) throws (1:TransactionServiceException ex),
142
 
143
	//	Order getter and setters
144
 
145
	/*
146
	list<Transaction> getTransactionsForShipmentStatus(1:ShipmentStatus status, 2:i64 from_date, 3:i64 to_date) throws (1:TransactionServiceException ex),
147
	list<Transaction> getTransactionsForCustomer(1:i64 customerId, 2:i64 from_date, 3:i64 to_date, 4:TransactionStatus status) throws (1:TransactionServiceException ex),
148
	list<Transaction> getTransactionsForCustomerAndShipmentStatus(1:i64 customerId, 2:i64 from_date, 3:i64 to_date, 4:ShipmentStatus status) throws (1:TransactionServiceException ex),
149
	list<Transaction> getTransactionsForShoppingCartId(1:i64 shoppingCartId) throws (1:TransactionServiceException ex),
150
	TransactionStatus getTransactionStatus(1:i64 transactionId) throws (1:TransactionServiceException ex),
151
	bool changeTransactionStatus(1:i64 transactionId, 2:TransactionStatus status, 3:string description) throws (1:TransactionServiceException ex),
152
	*/
153
 
154
	list<Order> getAllOrders(1:OrderStatus status, 2:i64 from_date, 3:i64 to_date, 4:i64 warehouse_id) throws (1:TransactionServiceException ex),
155
	bool changeOrderStatus(1:i64 orderId, 2:OrderStatus status, 3:string description) throws (1:TransactionServiceException ex),
641 chandransh 156
	bool addBillingDetails(1:i64 orderId, 2:string invoice_number, 3:i64 jacket_number, 4:string billed_by) throws (1:TransactionServiceException ex),
495 rajveer 157
 
922 rajveer 158
	bool acceptOrder(1:i64 orderId) throws (1:TransactionServiceException ex),
159
	bool billOrder(1:i64 orderId) throws (1:TransactionServiceException ex),
160
 
483 rajveer 161
	list<Order> getOrdersForTransaction(1:i64 transactionId)  throws (1:TransactionServiceException ex),
162
	list<Order> getOrdersForCustomer(1:i64 customerId, 2:i64 from_date, 3:i64 to_date, 4:OrderStatus status) throws (1:TransactionServiceException ex),
163
	i64 createOrder(1:Order order) throws (1:TransactionServiceException ex),
164
	Order getOrder(1:i64 id) throws (1:TransactionServiceException ex),
165
	list<LineItem> getLineItemsForOrder(1:i64 orderId) throws (1:TransactionServiceException ex),
166
 
757 chandransh 167
	/**
168
	Marks all BILLED orders for a warehouse and a provider as SHIPPED_FROM_WH
169
	*/
170
	bool markOrdersAsManifested(1:i64 warehouseId, 2:i64 providerId) throws (1:TransactionServiceException ex),
483 rajveer 171
	//Alerts apis 
172
	list<Alert> getAlerts(1:i64 orderId, 2:bool valid),
173
	void setAlert(1:i64 orderId, 2:bool unset, 3:i64 type, 4: string comment),
174
}
175
 
176
 
177
/*
178
 
179
enum PaymentStatus{
180
	FAILURE,
181
	SUCCESS
182
}
183
 
68 ashish 184
enum ShipmentStatus{
196 ashish 185
	YET_TO_SHIP,
68 ashish 186
	SHIPPED,
187
	IN_TRANSIT,
121 ashish 188
	DELIVERY_SUCCESS,
189
	DELIVERY_FAILED_FIRST_ATTEMPT,
190
	DELIVERY_FAILED_SECOND_ATTEMPT,
191
	DELIVERY_FAILED_THIRD_ATTEMPT,
192
	DELIVERY_FAILED_WORNG_ADDRESS
68 ashish 193
}
194
 
195
enum TransactionStatus{
351 ashish 196
	INCOMPLETE,
68 ashish 197
	INIT,
198
	SUBMITTED_FOR_PROCESSING,
199
	ORDER_FULFILLMENT,
121 ashish 200
	READY_FOR_SHIPPING,
201
	SHIPPED,
202
	COMPLETED,
203
	CANCELED,
196 ashish 204
	FAILED,	
205
	BILLED	
68 ashish 206
}
207
 
483 rajveer 208
 
68 ashish 209
struct Item{
85 ashish 210
	1:i64 id,
121 ashish 211
	2:double price,
212
	3:double weight
68 ashish 213
}
214
 
215
struct LineItem{
216
	1:Item item,
217
	2:i64 id,
218
	3:i64 addedOn,
219
	4:map<string,string> additionalInfo
220
}
221
 
222
struct OrderInfo{
223
	1:i64 id,
224
	2:list<LineItem> lineitems
225
}
226
 
227
struct Billing{
228
	1:i64 id,
229
	2:string billNumber,
121 ashish 230
	3:list<LineItem> lineItem,
68 ashish 231
	4:i64 generatedTimestamp,
232
	5:string generatedBy
233
}
234
 
235
struct BillingInfo{
236
	1:i64 id,
237
	2:list<Billing> billings
238
}
239
 
240
struct Shipment{
241
	1:i64 id,
242
	2:string address,
243
	3:string trackingId,
244
	4:list<LineItem> lineItems,
245
	5:ShipmentStatus status,
246
	6:i64 shipmentTimestamp,
247
	7:i64 deliveryTimestamp,
248
	8:double value,
249
	9:double insurance,
250
	10:double weight,
251
	11:string airwayBillNo,
252
	12:string provider
253
}
254
 
255
struct ShipmentInfo{
256
	1:list<Shipment> shipments,
257
	2:i64 id
258
}
259
 
260
struct Payment{
261
	1:i64 id,
262
	2:string merchant_tx_id,
263
	3:string bank_tx_id,
264
	4:string mode,
265
	5:double amount,
266
	6:PaymentStatus status,
267
	7:string description,
268
	9:i64 submissionTimestamp,
269
	10:i64 completionTimestamp
270
}
271
 
272
struct PaymentInfo{
273
	1:i64 id,
274
	2:map<i64,Payment> payments
275
}
276
 
277
struct Transaction{
278
	1:i64 id,
279
	2:OrderInfo orderInfo,
280
	3:ShipmentInfo shipmentInfo,
281
	4:BillingInfo billingInfo,
282
	5:PaymentInfo paymentInfo,
283
	6:i64 createdOn,
284
	7:i64 expectedDeliveryTime,
285
	8:TransactionStatus transactionStatus,
286
	9:string statusDescription,
121 ashish 287
	10:i64 customer_id,
355 ashish 288
	11:i64 shoppingCartid,
289
	12:i64 warehouse_id
68 ashish 290
}
291
 
302 ashish 292
struct Alert{
293
	1:i64 id,
294
	2:i64 transaction_id,
295
	3:i64 type,
296
	4:i64 time_set,
297
	5:string comment,
298
	6:i64 time_unset
299
}
300
 
301
struct ExtraOrderInfo{
302
	1:i64 id,
303
	2:i64 transaction_id,
304
	3:i64 sku_id,
305
	4:string model_name,
306
	5:string vendor_info,
307
	6:string colour
308
}
309
 
483 rajveer 310
 
311
 
68 ashish 312
exception TransactionServiceException{
313
	1:i32 errorCode,
314
	2:string message
315
}
316
 
317
service TransactionService{
318
 
132 ashish 319
	i64 createTransaction(1:Transaction transaction) throws (1:TransactionServiceException ex),
483 rajveer 320
 
321
	//	Get transaction methods.
322
 
68 ashish 323
	Transaction getTransaction(1:i64 id) throws (1:TransactionServiceException ex),
355 ashish 324
	list<Transaction> getAllTransactions(1:TransactionStatus status, 2:i64 from_date, 3:i64 to_date, 4:i64 warehouse_id) throws (1:TransactionServiceException ex),
95 ashish 325
	list<Transaction> getTransactionsForShipmentStatus(1:ShipmentStatus status, 2:i64 from_date, 3:i64 to_date) throws (1:TransactionServiceException ex),
326
	list<Transaction> getTransactionsForCustomer(1:i64 customerId, 2:i64 from_date, 3:i64 to_date, 4:TransactionStatus status) throws (1:TransactionServiceException ex),
327
	list<Transaction> getTransactionsForCustomerAndShipmentStatus(1:i64 customerId, 2:i64 from_date, 3:i64 to_date, 4:ShipmentStatus status) throws (1:TransactionServiceException ex),
121 ashish 328
	list<Transaction> getTransactionsForShoppingCartId(1:i64 shoppingCartId) throws (1:TransactionServiceException ex),
68 ashish 329
	TransactionStatus getTransactionStatus(1:i64 transactionId) throws (1:TransactionServiceException ex),
330
	bool changeTransactionStatus(1:i64 transactionId, 2:TransactionStatus status, 3:string description) throws (1:TransactionServiceException ex),
483 rajveer 331
 
332
	//	Get and set individual objects in it
333
 
68 ashish 334
	OrderInfo getOrderInfo(1:i64 transactionId) throws (1:TransactionServiceException ex),
335
	ShipmentInfo getShippingInfo(1:i64 transactionId) throws (1:TransactionServiceException ex),
336
	BillingInfo getBillingInfo(1:i64 transactionId) throws (1:TransactionServiceException ex),
337
	bool addBilling(1:i64 tranactionId,2: Billing billing) throws (1:TransactionServiceException ex),
338
	bool setShippingTracker(1:i64 transactionId, 2:i64 shippingId, 3:string trackingId, 4:string airwayBillNo, 5:string provider) throws (1:TransactionServiceException ex),
339
	bool setShippingDate(1:i64 transactionId, 2:i64 shippingId, 3:i64 timestamp) throws (1:TransactionServiceException ex),
340
	bool setDeliveryDate(1:i64 transactionId, 2:i64 shippingid, 3:i64 timestamp) throws (1:TransactionServiceException ex),
341
	bool changeShippingStatus(1:i64 transactionId, 2:i64 shippingId, 3:ShipmentStatus status, 4:string description) throws (1:TransactionServiceException ex),
302 ashish 342
	bool addTrail(1:i64 transactionId, 2:string description)throws (1:TransactionServiceException ex),
343
	//Alerts apis set on 5th June
344
	list<Alert> getAlerts(1:i64 transactionId, 2:bool valid),
345
	void setAlert(1:i64 transactionId, 2:bool unset, 3:i64 type, 4: string comment),
346
	//extra order info apis. added for demo
347
	ExtraOrderInfo getExtraInfo(1:i64 transaction_id),
348
	void setExtraInfo(1:i64 transaction_id, 2:i64 sku_id, 3:string model, 4:string colour, 5:string vendor)
483 rajveer 349
}
350
*/