Subversion Repositories SmartDukaan

Rev

Rev 132 | Rev 302 | 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
 
117
exception TransactionServiceException{
118
	1:i32 errorCode,
119
	2:string message
120
}
121
 
122
service TransactionService{
123
 
132 ashish 124
	i64 createTransaction(1:Transaction transaction) throws (1:TransactionServiceException ex),
68 ashish 125
	/**
126
		Get transaction methods.
127
	**/
128
	Transaction getTransaction(1:i64 id) throws (1:TransactionServiceException ex),
95 ashish 129
	list<Transaction> getAllTransactions(1:TransactionStatus status, 2:i64 from_date, 3:i64 to_date) throws (1:TransactionServiceException ex),
130
	list<Transaction> getTransactionsForShipmentStatus(1:ShipmentStatus status, 2:i64 from_date, 3:i64 to_date) throws (1:TransactionServiceException ex),
131
	list<Transaction> getTransactionsForCustomer(1:i64 customerId, 2:i64 from_date, 3:i64 to_date, 4:TransactionStatus status) throws (1:TransactionServiceException ex),
132
	list<Transaction> getTransactionsForCustomerAndShipmentStatus(1:i64 customerId, 2:i64 from_date, 3:i64 to_date, 4:ShipmentStatus status) throws (1:TransactionServiceException ex),
121 ashish 133
	list<Transaction> getTransactionsForShoppingCartId(1:i64 shoppingCartId) throws (1:TransactionServiceException ex),
68 ashish 134
	TransactionStatus getTransactionStatus(1:i64 transactionId) throws (1:TransactionServiceException ex),
135
	bool changeTransactionStatus(1:i64 transactionId, 2:TransactionStatus status, 3:string description) throws (1:TransactionServiceException ex),
136
	/**
137
		Get and set individual objects in it
138
	**/
139
	OrderInfo getOrderInfo(1:i64 transactionId) throws (1:TransactionServiceException ex),
140
	ShipmentInfo getShippingInfo(1:i64 transactionId) throws (1:TransactionServiceException ex),
141
	BillingInfo getBillingInfo(1:i64 transactionId) throws (1:TransactionServiceException ex),
142
	bool addBilling(1:i64 tranactionId,2: Billing billing) throws (1:TransactionServiceException ex),
143
	bool setShippingTracker(1:i64 transactionId, 2:i64 shippingId, 3:string trackingId, 4:string airwayBillNo, 5:string provider) throws (1:TransactionServiceException ex),
144
	bool setShippingDate(1:i64 transactionId, 2:i64 shippingId, 3:i64 timestamp) throws (1:TransactionServiceException ex),
145
	bool setDeliveryDate(1:i64 transactionId, 2:i64 shippingid, 3:i64 timestamp) throws (1:TransactionServiceException ex),
146
	bool changeShippingStatus(1:i64 transactionId, 2:i64 shippingId, 3:ShipmentStatus status, 4:string description) throws (1:TransactionServiceException ex),
147
	bool addTrail(1:i64 transactionId, 2:string description)throws (1:TransactionServiceException ex)
148
}