Subversion Repositories SmartDukaan

Rev

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