Subversion Repositories SmartDukaan

Rev

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