Subversion Repositories SmartDukaan

Rev

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