Subversion Repositories SmartDukaan

Rev

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