Subversion Repositories SmartDukaan

Rev

Rev 196 | Rev 351 | 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
 
12
enum ShipmentStatus{
196 ashish 13
	YET_TO_SHIP,
68 ashish 14
	SHIPPED,
15
	IN_TRANSIT,
121 ashish 16
	DELIVERY_SUCCESS,
17
	DELIVERY_FAILED_FIRST_ATTEMPT,
18
	DELIVERY_FAILED_SECOND_ATTEMPT,
19
	DELIVERY_FAILED_THIRD_ATTEMPT,
20
	DELIVERY_FAILED_WORNG_ADDRESS
68 ashish 21
}
22
 
23
enum TransactionStatus{
24
	INIT,
25
	SUBMITTED_FOR_PROCESSING,
26
	ORDER_FULFILLMENT,
121 ashish 27
	READY_FOR_SHIPPING,
28
	SHIPPED,
29
	COMPLETED,
30
	CANCELED,
196 ashish 31
	FAILED,	
32
	BILLED	
68 ashish 33
}
34
 
35
struct Item{
85 ashish 36
	1:i64 id,
121 ashish 37
	2:double price,
38
	3:double weight
68 ashish 39
}
40
 
41
struct LineItem{
42
	1:Item item,
43
	2:i64 id,
44
	3:i64 addedOn,
45
	4:map<string,string> additionalInfo
46
}
47
 
48
struct OrderInfo{
49
	1:i64 id,
50
	2:list<LineItem> lineitems
51
}
52
 
53
struct Billing{
54
	1:i64 id,
55
	2:string billNumber,
121 ashish 56
	3:list<LineItem> lineItem,
68 ashish 57
	4:i64 generatedTimestamp,
58
	5:string generatedBy
59
}
60
 
61
struct BillingInfo{
62
	1:i64 id,
63
	2:list<Billing> billings
64
}
65
 
66
struct Shipment{
67
	1:i64 id,
68
	2:string address,
69
	3:string trackingId,
70
	4:list<LineItem> lineItems,
71
	5:ShipmentStatus status,
72
	6:i64 shipmentTimestamp,
73
	7:i64 deliveryTimestamp,
74
	8:double value,
75
	9:double insurance,
76
	10:double weight,
77
	11:string airwayBillNo,
78
	12:string provider
79
}
80
 
81
struct ShipmentInfo{
82
	1:list<Shipment> shipments,
83
	2:i64 id
84
}
85
 
86
struct Payment{
87
	1:i64 id,
88
	2:string merchant_tx_id,
89
	3:string bank_tx_id,
90
	4:string mode,
91
	5:double amount,
92
	6:PaymentStatus status,
93
	7:string description,
94
	9:i64 submissionTimestamp,
95
	10:i64 completionTimestamp
96
}
97
 
98
struct PaymentInfo{
99
	1:i64 id,
100
	2:map<i64,Payment> payments
101
}
102
 
103
struct Transaction{
104
	1:i64 id,
105
	2:OrderInfo orderInfo,
106
	3:ShipmentInfo shipmentInfo,
107
	4:BillingInfo billingInfo,
108
	5:PaymentInfo paymentInfo,
109
	6:i64 createdOn,
110
	7:i64 expectedDeliveryTime,
111
	8:TransactionStatus transactionStatus,
112
	9:string statusDescription,
121 ashish 113
	10:i64 customer_id,
114
	11:i64 shoppingCartid
68 ashish 115
}
116
 
302 ashish 117
struct Alert{
118
	1:i64 id,
119
	2:i64 transaction_id,
120
	3:i64 type,
121
	4:i64 time_set,
122
	5:string comment,
123
	6:i64 time_unset
124
}
125
 
126
struct ExtraOrderInfo{
127
	1:i64 id,
128
	2:i64 transaction_id,
129
	3:i64 sku_id,
130
	4:string model_name,
131
	5:string vendor_info,
132
	6:string colour
133
}
134
 
68 ashish 135
exception TransactionServiceException{
136
	1:i32 errorCode,
137
	2:string message
138
}
139
 
140
service TransactionService{
141
 
132 ashish 142
	i64 createTransaction(1:Transaction transaction) throws (1:TransactionServiceException ex),
68 ashish 143
	/**
144
		Get transaction methods.
145
	**/
146
	Transaction getTransaction(1:i64 id) throws (1:TransactionServiceException ex),
95 ashish 147
	list<Transaction> getAllTransactions(1:TransactionStatus status, 2:i64 from_date, 3:i64 to_date) throws (1:TransactionServiceException ex),
148
	list<Transaction> getTransactionsForShipmentStatus(1:ShipmentStatus status, 2:i64 from_date, 3:i64 to_date) throws (1:TransactionServiceException ex),
149
	list<Transaction> getTransactionsForCustomer(1:i64 customerId, 2:i64 from_date, 3:i64 to_date, 4:TransactionStatus status) throws (1:TransactionServiceException ex),
150
	list<Transaction> getTransactionsForCustomerAndShipmentStatus(1:i64 customerId, 2:i64 from_date, 3:i64 to_date, 4:ShipmentStatus status) throws (1:TransactionServiceException ex),
121 ashish 151
	list<Transaction> getTransactionsForShoppingCartId(1:i64 shoppingCartId) throws (1:TransactionServiceException ex),
68 ashish 152
	TransactionStatus getTransactionStatus(1:i64 transactionId) throws (1:TransactionServiceException ex),
153
	bool changeTransactionStatus(1:i64 transactionId, 2:TransactionStatus status, 3:string description) throws (1:TransactionServiceException ex),
154
	/**
155
		Get and set individual objects in it
156
	**/
157
	OrderInfo getOrderInfo(1:i64 transactionId) throws (1:TransactionServiceException ex),
158
	ShipmentInfo getShippingInfo(1:i64 transactionId) throws (1:TransactionServiceException ex),
159
	BillingInfo getBillingInfo(1:i64 transactionId) throws (1:TransactionServiceException ex),
160
	bool addBilling(1:i64 tranactionId,2: Billing billing) throws (1:TransactionServiceException ex),
161
	bool setShippingTracker(1:i64 transactionId, 2:i64 shippingId, 3:string trackingId, 4:string airwayBillNo, 5:string provider) throws (1:TransactionServiceException ex),
162
	bool setShippingDate(1:i64 transactionId, 2:i64 shippingId, 3:i64 timestamp) throws (1:TransactionServiceException ex),
163
	bool setDeliveryDate(1:i64 transactionId, 2:i64 shippingid, 3:i64 timestamp) throws (1:TransactionServiceException ex),
164
	bool changeShippingStatus(1:i64 transactionId, 2:i64 shippingId, 3:ShipmentStatus status, 4:string description) throws (1:TransactionServiceException ex),
302 ashish 165
	bool addTrail(1:i64 transactionId, 2:string description)throws (1:TransactionServiceException ex),
166
	//Alerts apis set on 5th June
167
	list<Alert> getAlerts(1:i64 transactionId, 2:bool valid),
168
	void setAlert(1:i64 transactionId, 2:bool unset, 3:i64 type, 4: string comment),
169
	//extra order info apis. added for demo
170
	ExtraOrderInfo getExtraInfo(1:i64 transaction_id),
171
	void setExtraInfo(1:i64 transaction_id, 2:i64 sku_id, 3:string model, 4:string colour, 5:string vendor)
68 ashish 172
}