Subversion Repositories SmartDukaan

Rev

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