Subversion Repositories SmartDukaan

Rev

Rev 121 | Rev 680 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 121 Rev 420
Line 1... Line 1...
1
namespace java in.shop2020.payments
1
namespace java in.shop2020.payments
2
namespace py shop2020.payments
2
namespace py shop2020.thriftpy.payments
3
 
3
 
4
/**
4
/**
5
Various structures
5
Various structures
6
**/
6
**/
7
enum PaymentGatewayStatus{
7
enum PaymentGatewayStatus{
Line 22... Line 22...
22
	GATEWAY_UNREACHABLE
22
	GATEWAY_UNREACHABLE
23
	RESPONSE_FROM_GATEWAY,
23
	RESPONSE_FROM_GATEWAY,
24
	RESPONSE_SENT
24
	RESPONSE_SENT
25
}
25
}
26
 
26
 
27
struct Paymentgateway{
27
struct PaymentGateway{
28
	1:i64 id,
28
	1:i64 id,
29
	2:string gatewayName,
29
	2:string gatewayName,
30
	3:string gatewayProductionUrl,
30
	3:string gatewayProductionUrl,
31
	4:string gatewayStagingUrl,
31
	4:string gatewayStagingUrl,
32
	5:map<string,string> gatewayInfo,
32
	5:map<string,string> gatewayInfo,
33
	6:i64 addedOn
33
	6:i64 addedOn
34
}
34
}
35
 
35
 
36
struct Payment{
36
struct Payment{
37
	1:i64 merchant_tx_id,			//merchant transaction id. This will be propagated further to order processing
37
	1:string merchant_tx_id,			//merchant transaction id. This will be propagated further to order processing
38
	2:i64 bank_tx_id,				//bank trnasaction id
38
	2:string bank_tx_id,				//bank trnasaction id
39
	3:double amount,				
39
	3:double amount,				
40
	4:i64 init_timestamp,			//statring the payment processing timestamp
40
	4:i64 init_timestamp,			//statring the payment processing timestamp
41
	5:i64 bank_ack_timestamp,		//finishing processing timestamp
41
	5:i64 bank_ack_timestamp,		//finishing processing timestamp
42
	6:string bank_status,			//status provided by bank
42
	6:string bank_status,			//status provided by bank
43
	7:PaymentStatus status,			//shop2020 status
43
	7:PaymentStatus status,			//shop2020 status
44
	8:string message,				//Will have the failure reason
44
	8:string message,				//Will have the failure reason
45
	9:i64 user_id,					//The user for which payment has to be processed.This is here to speed up querying.
45
	9:i64 user_id,					//The user for which payment has to be processed.This is here to speed up querying.
46
	10:i64 cart_id,
46
	10:i64 cart_id,
47
	11:map<string,string> other_info, //other misllaneous info about the payment
47
	11:map<string,string> other_info, //other misllaneous info about the payment
48
	12:PaymentGateway gateway 		//payment gateway used
48
	12:i64 gateway_id, 		//payment gateway used
-
 
49
	13:string payment_id,
-
 
50
	14:string error_code,
-
 
51
	15:string session_id,
-
 
52
	16:string ref_code,
-
 
53
	17:string auth_code,
-
 
54
	18:string post_date	
49
}	
55
}	
50
 
56
 
51
struct ApplicationRegistry{
57
struct ApplicationRegistry{
52
	1:i64 application_id,
58
	1:i64 application_id,
53
	2:string callback_url
59
	2:string callback_url
Line 73... Line 79...
73
	2:string message
79
	2:string message
74
}
80
}
75
 
81
 
76
service PaymentService{
82
service PaymentService{
77
	//create a new payment
83
	//create a new payment
78
	Payment createPayment(1:i64 user_id, 2:i64 cart_id, 3:double amount, 4:i64 gateway_id) throws (1:PaymentException pe),
84
	i64 createPayment(1:i64 user_id, 2:i64 cart_id, 3:double amount, 4:i64 gateway_id) throws (1:PaymentException pe),
79
	//create a new payment request
85
	//create a new payment request
80
	PaymentRequest createPaymentRequest(1:i64 cart_id, 2:i64 application_id, 3:i64 merchant_tx_id, 5:list<Param> params) throws (1:PaymentException pe),
86
	void createPaymentRequest(1:i64 cart_id, 2:i64 application_id, 3:i64 merchant_tx_id, 5:list<Param> params) throws (1:PaymentException pe),
81
	//Add/update  a new callback url for an application
87
	//Add/update  a new callback url for an application
82
	void addCallbackUrl(1:i64 application_id, 2:string callback_url, 3:bool updateIfExisting) throws (1:PaymentException pe),
88
	void addCallbackUrl(1:i64 application_id, 2:string callback_url, 3:bool updateIfExisting) throws (1:PaymentException pe),
83
	//Retrieve callback url
89
	//Retrieve callback url
84
	void getCallbackUrl(1:i64 application_id) throws (1:PaymentException pe),
90
	void getCallbackUrl(1:i64 application_id) throws (1:PaymentException pe),
85
	//get payment for user. If status and gateway are null, it is ignore. Same for times as well. 
91
	//get payment for user. If status and gateway are null, it is ignore. Same for times as well. 
86
	list<Payment> getPaymentsForUser(1:i64 userId, 2:i64 from_time, 3:i64 to_time, 4:PaymentStatus status, 5:PaymentGateway gateway) throws (1:PaymentException pe),
92
	list<Payment> getPaymentsForUser(1:i64 userId, 2:i64 from_time, 3:i64 to_time, 4:PaymentStatus status, 5:i64 gateway_id) throws (1:PaymentException pe),
87
	//get payments for a cart. If status and gateway are null, it is ignore. Same for times as well.
93
	//get payments for a cart. If status and gateway are null, it is ignore. Same for times as well.
88
	list<Payment> getPaymentsForCart(1:i64 cartId,  2:i64 from_time, 3:i64 to_time, 4:PaymentStatus status, 5:PaymentGateway gateway) throws (1:PaymentException pe),
94
	list<Payment> getPaymentsForCart(1:i64 cartId,  2:i64 from_time, 3:i64 to_time, 4:PaymentStatus status, 5:i64 gateway_id) throws (1:PaymentException pe),
89
	//get all payments. 
95
	//get all payments. 
90
	list<Payment> getPayments(1:i64 from_time, 2:i64 to_time, 3:PaymentStatus status, 4:PaymentGateway gateway) throws (1:PaymentException pe),
96
	list<Payment> getPayments(1:i64 from_time, 2:i64 to_time, 3:PaymentStatus status, 4:i64 gateway_id) throws (1:PaymentException pe),
91
	//Get a particular payment
97
	//Get a particular payment
92
	Payment getPaymentForMerchantId(1:i64 merchant_tx_id) throws (1:PaymentException pe),
98
	list<Payment> getPaymentForMerchantId(1:i64 merchant_tx_id) throws (1:PaymentException pe),
93
	//change payment status
99
	//change payment status
94
	void changePaymentStatus(1:i64 merchant_tx_id, 2:PaymentStatus newStatus) throws (1:PaymentException pe),
100
	void changePaymentStatus(1:i64 id, 2:PaymentStatus newStatus) throws (1:PaymentException pe),
95
	//change paymet request status
101
	//change paymet request status
96
	void changePaymentRequestStatus(1:i64 request_id, 2:RequestStatus requestStatus) throws (1:PaymentException pe),
102
	void changePaymentRequestStatus(1:i64 request_id, 2:RequestStatus requestStatus) throws (1:PaymentException pe),
97
	
103
	
98
	//Get all payment gateways
104
	//Get all payment gateways
99
	list<PaymentGateway> getPaymentGateways(1:PaymentGatewayStatus status) throws (1:PaymentException pe),
105
	list<PaymentGateway> getPaymentGateways(1:PaymentGatewayStatus status) throws (1:PaymentException pe),
100
	
106
	
101
	//Get a particular gateway
107
	//Get a particular gateway
102
	PaymentGateway getPaymentGateway(1:i64 id) throws (1:PaymentException pe),
108
	PaymentGateway getPaymentGateway(1:i64 id) throws (1:PaymentException pe),
103
	
109
	
104
	//change status of a gateway
110
	//change status of a gateway
105
	void changeGatewayStatus(1:i64 id, 2:PaymentGatewayStatus) throws (1:PaymentException pe),
111
	void changeGatewayStatus(1:i64 id, 2:PaymentGatewayStatus status 	) throws (1:PaymentException pe),
-
 
112
	
-
 
113
	Payment getPayment(1:i64 id) throws (1:PaymentException pe),
-
 
114
	
-
 
115
	void addBankDetails(1:i64 id, 2:string bid, 3: string btxid, 4:string error_code, 5:string session_id, 6:string postdate, 7:string auth_code, 8:string ref_code) throws (1:PaymentException pe),
106
	
116
	
107
	
117
	
108
}
118
}
109
119