Subversion Repositories SmartDukaan

Rev

Rev 683 | Rev 735 | 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{
7
	INIT,
8
	SUBMITTED_FOR_PROCESSING,
9
	ACCEPTED,
10
	INVENTORY_LOW,
495 rajveer 11
	REJECTED,
483 rajveer 12
	BILLED,
13
	READY_FOR_SHIPPING,
14
	SHIPPED_FROM_WH,
15
	SHIPPED_TO_LOGST,
16
	IN_TRANSIT,
17
	DELIVERY_SUCCESS,
18
	DELIVERY_FAILED_FIRST_ATTEMPT,
19
	DELIVERY_FAILED_SECOND_ATTEMPT,
20
	DELIVERY_FAILED_THIRD_ATTEMPT,
21
	DELIVERY_FAILED_WORNG_ADDRESS
22
	COMPLETED,
23
	CANCELED,
683 chandransh 24
	FAILED,
25
	PAYMENT_PENDING,
26
	PAYMENT_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,
74
	12:string customer_address,
75
	13:string customer_email,
76
 
77
 
78
	/**
79
		status and misc info
80
	**/
81
	14:OrderStatus status,
82
	15:string statusDescription
83
	16:double total_amount,
84
	17:double total_weight,
85
	/**
86
		billing info
87
	**/
88
	18:string invoice_number,
89
	19:string billed_by,
90
	/**
91
		timestamps
92
	**/
93
	20:i64 created_timestamp,
94
	21:i64 accepted_timestamp,
95
	22:i64 billing_timestamp,
96
	23:i64 shipping_timestamp,
97
	24:i64 delivery_timestamp,
667 chandransh 98
	25:i64 jacket_number,
99
	26:string customer_city,
100
	27:string customer_state
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
 
129
	i64 createTransaction(1:Transaction transaction) throws (1:TransactionServiceException ex),
130
 
131
	//	Get transaction methods.
132
	Transaction getTransaction(1:i64 id) throws (1:TransactionServiceException ex),
133
	list<Transaction> getTransactionsForCustomer(1:i64 customerId, 2:i64 from_date, 3:i64 to_date, 4:TransactionStatus status) throws (1:TransactionServiceException ex),
134
	list<Transaction> getTransactionsForShoppingCartId(1:i64 shoppingCartId) throws (1:TransactionServiceException ex),
135
	TransactionStatus getTransactionStatus(1:i64 transactionId) throws (1:TransactionServiceException ex),
136
	bool changeTransactionStatus(1:i64 transactionId, 2:TransactionStatus status, 3:string description) throws (1:TransactionServiceException ex),
137
 
138
	//	Order getter and setters
139
 
140
	/*
141
	list<Transaction> getTransactionsForShipmentStatus(1:ShipmentStatus status, 2:i64 from_date, 3:i64 to_date) throws (1:TransactionServiceException ex),
142
	list<Transaction> getTransactionsForCustomer(1:i64 customerId, 2:i64 from_date, 3:i64 to_date, 4:TransactionStatus status) throws (1:TransactionServiceException ex),
143
	list<Transaction> getTransactionsForCustomerAndShipmentStatus(1:i64 customerId, 2:i64 from_date, 3:i64 to_date, 4:ShipmentStatus status) throws (1:TransactionServiceException ex),
144
	list<Transaction> getTransactionsForShoppingCartId(1:i64 shoppingCartId) throws (1:TransactionServiceException ex),
145
	TransactionStatus getTransactionStatus(1:i64 transactionId) throws (1:TransactionServiceException ex),
146
	bool changeTransactionStatus(1:i64 transactionId, 2:TransactionStatus status, 3:string description) throws (1:TransactionServiceException ex),
147
	*/
148
 
149
	list<Order> getAllOrders(1:OrderStatus status, 2:i64 from_date, 3:i64 to_date, 4:i64 warehouse_id) throws (1:TransactionServiceException ex),
150
	bool changeOrderStatus(1:i64 orderId, 2:OrderStatus status, 3:string description) throws (1:TransactionServiceException ex),
641 chandransh 151
	bool addBillingDetails(1:i64 orderId, 2:string invoice_number, 3:i64 jacket_number, 4:string billed_by) throws (1:TransactionServiceException ex),
495 rajveer 152
 
483 rajveer 153
 
154
	list<Order> getOrdersForTransaction(1:i64 transactionId)  throws (1:TransactionServiceException ex),
155
	list<Order> getOrdersForCustomer(1:i64 customerId, 2:i64 from_date, 3:i64 to_date, 4:OrderStatus status) throws (1:TransactionServiceException ex),
156
	i64 createOrder(1:Order order) throws (1:TransactionServiceException ex),
157
	Order getOrder(1:i64 id) throws (1:TransactionServiceException ex),
158
	list<LineItem> getLineItemsForOrder(1:i64 orderId) throws (1:TransactionServiceException ex),
159
 
160
	//Alerts apis 
161
	list<Alert> getAlerts(1:i64 orderId, 2:bool valid),
162
	void setAlert(1:i64 orderId, 2:bool unset, 3:i64 type, 4: string comment),
163
}
164
 
165
 
166
/*
167
 
168
enum PaymentStatus{
169
	FAILURE,
170
	SUCCESS
171
}
172
 
68 ashish 173
enum ShipmentStatus{
196 ashish 174
	YET_TO_SHIP,
68 ashish 175
	SHIPPED,
176
	IN_TRANSIT,
121 ashish 177
	DELIVERY_SUCCESS,
178
	DELIVERY_FAILED_FIRST_ATTEMPT,
179
	DELIVERY_FAILED_SECOND_ATTEMPT,
180
	DELIVERY_FAILED_THIRD_ATTEMPT,
181
	DELIVERY_FAILED_WORNG_ADDRESS
68 ashish 182
}
183
 
184
enum TransactionStatus{
351 ashish 185
	INCOMPLETE,
68 ashish 186
	INIT,
187
	SUBMITTED_FOR_PROCESSING,
188
	ORDER_FULFILLMENT,
121 ashish 189
	READY_FOR_SHIPPING,
190
	SHIPPED,
191
	COMPLETED,
192
	CANCELED,
196 ashish 193
	FAILED,	
194
	BILLED	
68 ashish 195
}
196
 
483 rajveer 197
 
68 ashish 198
struct Item{
85 ashish 199
	1:i64 id,
121 ashish 200
	2:double price,
201
	3:double weight
68 ashish 202
}
203
 
204
struct LineItem{
205
	1:Item item,
206
	2:i64 id,
207
	3:i64 addedOn,
208
	4:map<string,string> additionalInfo
209
}
210
 
211
struct OrderInfo{
212
	1:i64 id,
213
	2:list<LineItem> lineitems
214
}
215
 
216
struct Billing{
217
	1:i64 id,
218
	2:string billNumber,
121 ashish 219
	3:list<LineItem> lineItem,
68 ashish 220
	4:i64 generatedTimestamp,
221
	5:string generatedBy
222
}
223
 
224
struct BillingInfo{
225
	1:i64 id,
226
	2:list<Billing> billings
227
}
228
 
229
struct Shipment{
230
	1:i64 id,
231
	2:string address,
232
	3:string trackingId,
233
	4:list<LineItem> lineItems,
234
	5:ShipmentStatus status,
235
	6:i64 shipmentTimestamp,
236
	7:i64 deliveryTimestamp,
237
	8:double value,
238
	9:double insurance,
239
	10:double weight,
240
	11:string airwayBillNo,
241
	12:string provider
242
}
243
 
244
struct ShipmentInfo{
245
	1:list<Shipment> shipments,
246
	2:i64 id
247
}
248
 
249
struct Payment{
250
	1:i64 id,
251
	2:string merchant_tx_id,
252
	3:string bank_tx_id,
253
	4:string mode,
254
	5:double amount,
255
	6:PaymentStatus status,
256
	7:string description,
257
	9:i64 submissionTimestamp,
258
	10:i64 completionTimestamp
259
}
260
 
261
struct PaymentInfo{
262
	1:i64 id,
263
	2:map<i64,Payment> payments
264
}
265
 
266
struct Transaction{
267
	1:i64 id,
268
	2:OrderInfo orderInfo,
269
	3:ShipmentInfo shipmentInfo,
270
	4:BillingInfo billingInfo,
271
	5:PaymentInfo paymentInfo,
272
	6:i64 createdOn,
273
	7:i64 expectedDeliveryTime,
274
	8:TransactionStatus transactionStatus,
275
	9:string statusDescription,
121 ashish 276
	10:i64 customer_id,
355 ashish 277
	11:i64 shoppingCartid,
278
	12:i64 warehouse_id
68 ashish 279
}
280
 
302 ashish 281
struct Alert{
282
	1:i64 id,
283
	2:i64 transaction_id,
284
	3:i64 type,
285
	4:i64 time_set,
286
	5:string comment,
287
	6:i64 time_unset
288
}
289
 
290
struct ExtraOrderInfo{
291
	1:i64 id,
292
	2:i64 transaction_id,
293
	3:i64 sku_id,
294
	4:string model_name,
295
	5:string vendor_info,
296
	6:string colour
297
}
298
 
483 rajveer 299
 
300
 
68 ashish 301
exception TransactionServiceException{
302
	1:i32 errorCode,
303
	2:string message
304
}
305
 
306
service TransactionService{
307
 
132 ashish 308
	i64 createTransaction(1:Transaction transaction) throws (1:TransactionServiceException ex),
483 rajveer 309
 
310
	//	Get transaction methods.
311
 
68 ashish 312
	Transaction getTransaction(1:i64 id) throws (1:TransactionServiceException ex),
355 ashish 313
	list<Transaction> getAllTransactions(1:TransactionStatus status, 2:i64 from_date, 3:i64 to_date, 4:i64 warehouse_id) throws (1:TransactionServiceException ex),
95 ashish 314
	list<Transaction> getTransactionsForShipmentStatus(1:ShipmentStatus status, 2:i64 from_date, 3:i64 to_date) throws (1:TransactionServiceException ex),
315
	list<Transaction> getTransactionsForCustomer(1:i64 customerId, 2:i64 from_date, 3:i64 to_date, 4:TransactionStatus status) throws (1:TransactionServiceException ex),
316
	list<Transaction> getTransactionsForCustomerAndShipmentStatus(1:i64 customerId, 2:i64 from_date, 3:i64 to_date, 4:ShipmentStatus status) throws (1:TransactionServiceException ex),
121 ashish 317
	list<Transaction> getTransactionsForShoppingCartId(1:i64 shoppingCartId) throws (1:TransactionServiceException ex),
68 ashish 318
	TransactionStatus getTransactionStatus(1:i64 transactionId) throws (1:TransactionServiceException ex),
319
	bool changeTransactionStatus(1:i64 transactionId, 2:TransactionStatus status, 3:string description) throws (1:TransactionServiceException ex),
483 rajveer 320
 
321
	//	Get and set individual objects in it
322
 
68 ashish 323
	OrderInfo getOrderInfo(1:i64 transactionId) throws (1:TransactionServiceException ex),
324
	ShipmentInfo getShippingInfo(1:i64 transactionId) throws (1:TransactionServiceException ex),
325
	BillingInfo getBillingInfo(1:i64 transactionId) throws (1:TransactionServiceException ex),
326
	bool addBilling(1:i64 tranactionId,2: Billing billing) throws (1:TransactionServiceException ex),
327
	bool setShippingTracker(1:i64 transactionId, 2:i64 shippingId, 3:string trackingId, 4:string airwayBillNo, 5:string provider) throws (1:TransactionServiceException ex),
328
	bool setShippingDate(1:i64 transactionId, 2:i64 shippingId, 3:i64 timestamp) throws (1:TransactionServiceException ex),
329
	bool setDeliveryDate(1:i64 transactionId, 2:i64 shippingid, 3:i64 timestamp) throws (1:TransactionServiceException ex),
330
	bool changeShippingStatus(1:i64 transactionId, 2:i64 shippingId, 3:ShipmentStatus status, 4:string description) throws (1:TransactionServiceException ex),
302 ashish 331
	bool addTrail(1:i64 transactionId, 2:string description)throws (1:TransactionServiceException ex),
332
	//Alerts apis set on 5th June
333
	list<Alert> getAlerts(1:i64 transactionId, 2:bool valid),
334
	void setAlert(1:i64 transactionId, 2:bool unset, 3:i64 type, 4: string comment),
335
	//extra order info apis. added for demo
336
	ExtraOrderInfo getExtraInfo(1:i64 transaction_id),
337
	void setExtraInfo(1:i64 transaction_id, 2:i64 sku_id, 3:string model, 4:string colour, 5:string vendor)
483 rajveer 338
}
339
*/