Subversion Repositories SmartDukaan

Rev

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