Subversion Repositories SmartDukaan

Rev

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