Subversion Repositories SmartDukaan

Rev

Rev 763 | Rev 922 | 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
 
483 rajveer 158
 
159
	list<Order> getOrdersForTransaction(1:i64 transactionId)  throws (1:TransactionServiceException ex),
160
	list<Order> getOrdersForCustomer(1:i64 customerId, 2:i64 from_date, 3:i64 to_date, 4:OrderStatus status) throws (1:TransactionServiceException ex),
161
	i64 createOrder(1:Order order) throws (1:TransactionServiceException ex),
162
	Order getOrder(1:i64 id) throws (1:TransactionServiceException ex),
163
	list<LineItem> getLineItemsForOrder(1:i64 orderId) throws (1:TransactionServiceException ex),
164
 
757 chandransh 165
	/**
166
	Marks all BILLED orders for a warehouse and a provider as SHIPPED_FROM_WH
167
	*/
168
	bool markOrdersAsManifested(1:i64 warehouseId, 2:i64 providerId) throws (1:TransactionServiceException ex),
483 rajveer 169
	//Alerts apis 
170
	list<Alert> getAlerts(1:i64 orderId, 2:bool valid),
171
	void setAlert(1:i64 orderId, 2:bool unset, 3:i64 type, 4: string comment),
172
}
173
 
174
 
175
/*
176
 
177
enum PaymentStatus{
178
	FAILURE,
179
	SUCCESS
180
}
181
 
68 ashish 182
enum ShipmentStatus{
196 ashish 183
	YET_TO_SHIP,
68 ashish 184
	SHIPPED,
185
	IN_TRANSIT,
121 ashish 186
	DELIVERY_SUCCESS,
187
	DELIVERY_FAILED_FIRST_ATTEMPT,
188
	DELIVERY_FAILED_SECOND_ATTEMPT,
189
	DELIVERY_FAILED_THIRD_ATTEMPT,
190
	DELIVERY_FAILED_WORNG_ADDRESS
68 ashish 191
}
192
 
193
enum TransactionStatus{
351 ashish 194
	INCOMPLETE,
68 ashish 195
	INIT,
196
	SUBMITTED_FOR_PROCESSING,
197
	ORDER_FULFILLMENT,
121 ashish 198
	READY_FOR_SHIPPING,
199
	SHIPPED,
200
	COMPLETED,
201
	CANCELED,
196 ashish 202
	FAILED,	
203
	BILLED	
68 ashish 204
}
205
 
483 rajveer 206
 
68 ashish 207
struct Item{
85 ashish 208
	1:i64 id,
121 ashish 209
	2:double price,
210
	3:double weight
68 ashish 211
}
212
 
213
struct LineItem{
214
	1:Item item,
215
	2:i64 id,
216
	3:i64 addedOn,
217
	4:map<string,string> additionalInfo
218
}
219
 
220
struct OrderInfo{
221
	1:i64 id,
222
	2:list<LineItem> lineitems
223
}
224
 
225
struct Billing{
226
	1:i64 id,
227
	2:string billNumber,
121 ashish 228
	3:list<LineItem> lineItem,
68 ashish 229
	4:i64 generatedTimestamp,
230
	5:string generatedBy
231
}
232
 
233
struct BillingInfo{
234
	1:i64 id,
235
	2:list<Billing> billings
236
}
237
 
238
struct Shipment{
239
	1:i64 id,
240
	2:string address,
241
	3:string trackingId,
242
	4:list<LineItem> lineItems,
243
	5:ShipmentStatus status,
244
	6:i64 shipmentTimestamp,
245
	7:i64 deliveryTimestamp,
246
	8:double value,
247
	9:double insurance,
248
	10:double weight,
249
	11:string airwayBillNo,
250
	12:string provider
251
}
252
 
253
struct ShipmentInfo{
254
	1:list<Shipment> shipments,
255
	2:i64 id
256
}
257
 
258
struct Payment{
259
	1:i64 id,
260
	2:string merchant_tx_id,
261
	3:string bank_tx_id,
262
	4:string mode,
263
	5:double amount,
264
	6:PaymentStatus status,
265
	7:string description,
266
	9:i64 submissionTimestamp,
267
	10:i64 completionTimestamp
268
}
269
 
270
struct PaymentInfo{
271
	1:i64 id,
272
	2:map<i64,Payment> payments
273
}
274
 
275
struct Transaction{
276
	1:i64 id,
277
	2:OrderInfo orderInfo,
278
	3:ShipmentInfo shipmentInfo,
279
	4:BillingInfo billingInfo,
280
	5:PaymentInfo paymentInfo,
281
	6:i64 createdOn,
282
	7:i64 expectedDeliveryTime,
283
	8:TransactionStatus transactionStatus,
284
	9:string statusDescription,
121 ashish 285
	10:i64 customer_id,
355 ashish 286
	11:i64 shoppingCartid,
287
	12:i64 warehouse_id
68 ashish 288
}
289
 
302 ashish 290
struct Alert{
291
	1:i64 id,
292
	2:i64 transaction_id,
293
	3:i64 type,
294
	4:i64 time_set,
295
	5:string comment,
296
	6:i64 time_unset
297
}
298
 
299
struct ExtraOrderInfo{
300
	1:i64 id,
301
	2:i64 transaction_id,
302
	3:i64 sku_id,
303
	4:string model_name,
304
	5:string vendor_info,
305
	6:string colour
306
}
307
 
483 rajveer 308
 
309
 
68 ashish 310
exception TransactionServiceException{
311
	1:i32 errorCode,
312
	2:string message
313
}
314
 
315
service TransactionService{
316
 
132 ashish 317
	i64 createTransaction(1:Transaction transaction) throws (1:TransactionServiceException ex),
483 rajveer 318
 
319
	//	Get transaction methods.
320
 
68 ashish 321
	Transaction getTransaction(1:i64 id) throws (1:TransactionServiceException ex),
355 ashish 322
	list<Transaction> getAllTransactions(1:TransactionStatus status, 2:i64 from_date, 3:i64 to_date, 4:i64 warehouse_id) throws (1:TransactionServiceException ex),
95 ashish 323
	list<Transaction> getTransactionsForShipmentStatus(1:ShipmentStatus status, 2:i64 from_date, 3:i64 to_date) throws (1:TransactionServiceException ex),
324
	list<Transaction> getTransactionsForCustomer(1:i64 customerId, 2:i64 from_date, 3:i64 to_date, 4:TransactionStatus status) throws (1:TransactionServiceException ex),
325
	list<Transaction> getTransactionsForCustomerAndShipmentStatus(1:i64 customerId, 2:i64 from_date, 3:i64 to_date, 4:ShipmentStatus status) throws (1:TransactionServiceException ex),
121 ashish 326
	list<Transaction> getTransactionsForShoppingCartId(1:i64 shoppingCartId) throws (1:TransactionServiceException ex),
68 ashish 327
	TransactionStatus getTransactionStatus(1:i64 transactionId) throws (1:TransactionServiceException ex),
328
	bool changeTransactionStatus(1:i64 transactionId, 2:TransactionStatus status, 3:string description) throws (1:TransactionServiceException ex),
483 rajveer 329
 
330
	//	Get and set individual objects in it
331
 
68 ashish 332
	OrderInfo getOrderInfo(1:i64 transactionId) throws (1:TransactionServiceException ex),
333
	ShipmentInfo getShippingInfo(1:i64 transactionId) throws (1:TransactionServiceException ex),
334
	BillingInfo getBillingInfo(1:i64 transactionId) throws (1:TransactionServiceException ex),
335
	bool addBilling(1:i64 tranactionId,2: Billing billing) throws (1:TransactionServiceException ex),
336
	bool setShippingTracker(1:i64 transactionId, 2:i64 shippingId, 3:string trackingId, 4:string airwayBillNo, 5:string provider) throws (1:TransactionServiceException ex),
337
	bool setShippingDate(1:i64 transactionId, 2:i64 shippingId, 3:i64 timestamp) throws (1:TransactionServiceException ex),
338
	bool setDeliveryDate(1:i64 transactionId, 2:i64 shippingid, 3:i64 timestamp) throws (1:TransactionServiceException ex),
339
	bool changeShippingStatus(1:i64 transactionId, 2:i64 shippingId, 3:ShipmentStatus status, 4:string description) throws (1:TransactionServiceException ex),
302 ashish 340
	bool addTrail(1:i64 transactionId, 2:string description)throws (1:TransactionServiceException ex),
341
	//Alerts apis set on 5th June
342
	list<Alert> getAlerts(1:i64 transactionId, 2:bool valid),
343
	void setAlert(1:i64 transactionId, 2:bool unset, 3:i64 type, 4: string comment),
344
	//extra order info apis. added for demo
345
	ExtraOrderInfo getExtraInfo(1:i64 transaction_id),
346
	void setExtraInfo(1:i64 transaction_id, 2:i64 sku_id, 3:string model, 4:string colour, 5:string vendor)
483 rajveer 347
}
348
*/