| 420 |
ashish |
1 |
#!/usr/bin/env python
|
|
|
2 |
#
|
| 3431 |
rajveer |
3 |
# Autogenerated by Thrift Compiler (0.7.0)
|
| 420 |
ashish |
4 |
#
|
|
|
5 |
# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
|
|
|
6 |
#
|
|
|
7 |
|
|
|
8 |
import sys
|
|
|
9 |
import pprint
|
|
|
10 |
from urlparse import urlparse
|
|
|
11 |
from thrift.transport import TTransport
|
|
|
12 |
from thrift.transport import TSocket
|
|
|
13 |
from thrift.transport import THttpClient
|
|
|
14 |
from thrift.protocol import TBinaryProtocol
|
|
|
15 |
|
|
|
16 |
import PaymentService
|
|
|
17 |
from ttypes import *
|
|
|
18 |
|
|
|
19 |
if len(sys.argv) <= 1 or sys.argv[1] == '--help':
|
|
|
20 |
print ''
|
|
|
21 |
print 'Usage: ' + sys.argv[0] + ' [-h host:port] [-u url] [-f[ramed]] function [arg1 [arg2...]]'
|
|
|
22 |
print ''
|
|
|
23 |
print 'Functions:'
|
| 6050 |
anupam.sin |
24 |
print ' i64 createPayment(i64 userId, double amount, i64 gatewayId, i64 txnId, bool isDigital)'
|
| 696 |
rajveer |
25 |
print ' getPaymentsForUser(i64 userId, i64 fromTime, i64 toTime, PaymentStatus status, i64 gatewayId)'
|
|
|
26 |
print ' getPayments(i64 fromTime, i64 toTime, PaymentStatus status, i64 gatewayId)'
|
| 4141 |
chandransh |
27 |
print ' getPaymentsByCapturedDate(i64 fromTime, i64 toTime, i64 gatewayId)'
|
| 420 |
ashish |
28 |
print ' PaymentGateway getPaymentGateway(i64 id)'
|
| 4600 |
varun.gupt |
29 |
print ' getActivePaymentGateways()'
|
| 420 |
ashish |
30 |
print ' Payment getPayment(i64 id)'
|
| 696 |
rajveer |
31 |
print ' getPaymentForTxnId(i64 txnId)'
|
| 7049 |
anupam.sin |
32 |
print ' getPaymentForRechargeTxnId(i64 txnId)'
|
| 4600 |
varun.gupt |
33 |
print ' Payment getSuccessfulPaymentForTxnId(i64 txnId)'
|
| 1120 |
rajveer |
34 |
print ' bool updatePaymentDetails(i64 id, string gatewayPaymentId, string sessionId, string gatewayTxnStatus, string description, string gatewayTxnId, string authCode, string referenceCode, string errorCode, PaymentStatus status, string gatewayTxnDate, attributes)'
|
| 1731 |
ankur.sing |
35 |
print ' getSuccessfulPaymentsAmountRange()'
|
| 10478 |
amit.gupta |
36 |
print ' string initializeHdfcPayment(i64 merchantPaymentId, bool isMobile)'
|
|
|
37 |
print ' string doHdfcPaymentForDigitalOrder(i64 merchantPaymentId, i64 rechargeOrderId, string phone, bool isMobile)'
|
|
|
38 |
print ' string initializeHdfcEmiPayment(i64 merchantPaymentId, bool isMobile)'
|
| 2685 |
chandransh |
39 |
print ' i64 createRefund(i64 orderId, i64 merchantTxnId, double amount)'
|
| 8618 |
rajveer |
40 |
print ' bool capturePayment(i64 merchantTxnId, bool isDigital)'
|
| 6486 |
rajveer |
41 |
print ' bool refundPayment(i64 merchantTxnId, double amount, bool isDigital)'
|
| 3956 |
chandransh |
42 |
print ' bool partiallyCapturePayment(i64 merchantTxnId, double amount, string xferBy, string xferTxnId, i64 xferDate)'
|
| 4008 |
mandeep.dh |
43 |
print ' getPaymentsRequiringExtraProcessing(ExtraPaymentProcessingType category)'
|
|
|
44 |
print ' void markPaymentAsProcessed(i64 paymentId, ExtraPaymentProcessingType category)'
|
| 8914 |
rajveer |
45 |
print ' PaymentStatus getPaymentStatusAtGateway(i64 merchantTxnId, double amount, bool isDigital)'
|
| 18577 |
manish.sha |
46 |
print ' Creditor getCreditorInfo(i64 id, string name)'
|
|
|
47 |
print ' bool updateCreditorInfo(Creditor creditor)'
|
|
|
48 |
print ' getUserSanctionDetails(i64 userId)'
|
|
|
49 |
print ' UserSanction getUserSanctionDetailsForCreditor(i64 userId, i64 creditorId)'
|
|
|
50 |
print ' bool updateUserSanction(UserSanction userSanaction)'
|
|
|
51 |
print ' getCreditHistoryRecordsForTransaction(i64 paymentId, i64 creditorId, string creditTxnType)'
|
|
|
52 |
print ' getCreditHistoryRecordsForUserAndCreditor(i64 userId, string creditTxnType)'
|
|
|
53 |
print ' bool processCreditTransaction(i64 paymentId, creditTxns)'
|
|
|
54 |
print ' getLoanPayableForUserToCreditor(i64 userId, i64 creditorId, i64 dueDate)'
|
| 420 |
ashish |
55 |
print ''
|
|
|
56 |
sys.exit(0)
|
|
|
57 |
|
|
|
58 |
pp = pprint.PrettyPrinter(indent = 2)
|
|
|
59 |
host = 'localhost'
|
|
|
60 |
port = 9090
|
|
|
61 |
uri = ''
|
|
|
62 |
framed = False
|
|
|
63 |
http = False
|
|
|
64 |
argi = 1
|
|
|
65 |
|
|
|
66 |
if sys.argv[argi] == '-h':
|
| 3431 |
rajveer |
67 |
parts = sys.argv[argi+1].split(':')
|
| 420 |
ashish |
68 |
host = parts[0]
|
|
|
69 |
port = int(parts[1])
|
|
|
70 |
argi += 2
|
|
|
71 |
|
|
|
72 |
if sys.argv[argi] == '-u':
|
|
|
73 |
url = urlparse(sys.argv[argi+1])
|
| 3431 |
rajveer |
74 |
parts = url[1].split(':')
|
| 420 |
ashish |
75 |
host = parts[0]
|
|
|
76 |
if len(parts) > 1:
|
|
|
77 |
port = int(parts[1])
|
|
|
78 |
else:
|
|
|
79 |
port = 80
|
|
|
80 |
uri = url[2]
|
| 3431 |
rajveer |
81 |
if url[4]:
|
|
|
82 |
uri += '?%s' % url[4]
|
| 420 |
ashish |
83 |
http = True
|
|
|
84 |
argi += 2
|
|
|
85 |
|
|
|
86 |
if sys.argv[argi] == '-f' or sys.argv[argi] == '-framed':
|
|
|
87 |
framed = True
|
|
|
88 |
argi += 1
|
|
|
89 |
|
|
|
90 |
cmd = sys.argv[argi]
|
|
|
91 |
args = sys.argv[argi+1:]
|
|
|
92 |
|
|
|
93 |
if http:
|
|
|
94 |
transport = THttpClient.THttpClient(host, port, uri)
|
|
|
95 |
else:
|
|
|
96 |
socket = TSocket.TSocket(host, port)
|
|
|
97 |
if framed:
|
|
|
98 |
transport = TTransport.TFramedTransport(socket)
|
|
|
99 |
else:
|
|
|
100 |
transport = TTransport.TBufferedTransport(socket)
|
|
|
101 |
protocol = TBinaryProtocol.TBinaryProtocol(transport)
|
|
|
102 |
client = PaymentService.Client(protocol)
|
|
|
103 |
transport.open()
|
|
|
104 |
|
| 3376 |
rajveer |
105 |
if cmd == 'createPayment':
|
| 6050 |
anupam.sin |
106 |
if len(args) != 5:
|
|
|
107 |
print 'createPayment requires 5 args'
|
| 420 |
ashish |
108 |
sys.exit(1)
|
| 6050 |
anupam.sin |
109 |
pp.pprint(client.createPayment(eval(args[0]),eval(args[1]),eval(args[2]),eval(args[3]),eval(args[4]),))
|
| 420 |
ashish |
110 |
|
|
|
111 |
elif cmd == 'getPaymentsForUser':
|
|
|
112 |
if len(args) != 5:
|
|
|
113 |
print 'getPaymentsForUser requires 5 args'
|
|
|
114 |
sys.exit(1)
|
|
|
115 |
pp.pprint(client.getPaymentsForUser(eval(args[0]),eval(args[1]),eval(args[2]),eval(args[3]),eval(args[4]),))
|
|
|
116 |
|
|
|
117 |
elif cmd == 'getPayments':
|
|
|
118 |
if len(args) != 4:
|
|
|
119 |
print 'getPayments requires 4 args'
|
|
|
120 |
sys.exit(1)
|
|
|
121 |
pp.pprint(client.getPayments(eval(args[0]),eval(args[1]),eval(args[2]),eval(args[3]),))
|
|
|
122 |
|
| 4141 |
chandransh |
123 |
elif cmd == 'getPaymentsByCapturedDate':
|
|
|
124 |
if len(args) != 3:
|
|
|
125 |
print 'getPaymentsByCapturedDate requires 3 args'
|
|
|
126 |
sys.exit(1)
|
|
|
127 |
pp.pprint(client.getPaymentsByCapturedDate(eval(args[0]),eval(args[1]),eval(args[2]),))
|
|
|
128 |
|
| 420 |
ashish |
129 |
elif cmd == 'getPaymentGateway':
|
|
|
130 |
if len(args) != 1:
|
|
|
131 |
print 'getPaymentGateway requires 1 args'
|
|
|
132 |
sys.exit(1)
|
|
|
133 |
pp.pprint(client.getPaymentGateway(eval(args[0]),))
|
|
|
134 |
|
| 4600 |
varun.gupt |
135 |
elif cmd == 'getActivePaymentGateways':
|
|
|
136 |
if len(args) != 0:
|
|
|
137 |
print 'getActivePaymentGateways requires 0 args'
|
|
|
138 |
sys.exit(1)
|
|
|
139 |
pp.pprint(client.getActivePaymentGateways())
|
|
|
140 |
|
| 420 |
ashish |
141 |
elif cmd == 'getPayment':
|
|
|
142 |
if len(args) != 1:
|
|
|
143 |
print 'getPayment requires 1 args'
|
|
|
144 |
sys.exit(1)
|
|
|
145 |
pp.pprint(client.getPayment(eval(args[0]),))
|
|
|
146 |
|
| 696 |
rajveer |
147 |
elif cmd == 'getPaymentForTxnId':
|
|
|
148 |
if len(args) != 1:
|
|
|
149 |
print 'getPaymentForTxnId requires 1 args'
|
| 420 |
ashish |
150 |
sys.exit(1)
|
| 696 |
rajveer |
151 |
pp.pprint(client.getPaymentForTxnId(eval(args[0]),))
|
| 420 |
ashish |
152 |
|
| 7049 |
anupam.sin |
153 |
elif cmd == 'getPaymentForRechargeTxnId':
|
|
|
154 |
if len(args) != 1:
|
|
|
155 |
print 'getPaymentForRechargeTxnId requires 1 args'
|
|
|
156 |
sys.exit(1)
|
|
|
157 |
pp.pprint(client.getPaymentForRechargeTxnId(eval(args[0]),))
|
|
|
158 |
|
| 4600 |
varun.gupt |
159 |
elif cmd == 'getSuccessfulPaymentForTxnId':
|
|
|
160 |
if len(args) != 1:
|
|
|
161 |
print 'getSuccessfulPaymentForTxnId requires 1 args'
|
|
|
162 |
sys.exit(1)
|
|
|
163 |
pp.pprint(client.getSuccessfulPaymentForTxnId(eval(args[0]),))
|
|
|
164 |
|
| 696 |
rajveer |
165 |
elif cmd == 'updatePaymentDetails':
|
| 1120 |
rajveer |
166 |
if len(args) != 12:
|
|
|
167 |
print 'updatePaymentDetails requires 12 args'
|
| 696 |
rajveer |
168 |
sys.exit(1)
|
| 1120 |
rajveer |
169 |
pp.pprint(client.updatePaymentDetails(eval(args[0]),args[1],args[2],args[3],args[4],args[5],args[6],args[7],args[8],eval(args[9]),args[10],eval(args[11]),))
|
| 696 |
rajveer |
170 |
|
| 1731 |
ankur.sing |
171 |
elif cmd == 'getSuccessfulPaymentsAmountRange':
|
| 1627 |
ankur.sing |
172 |
if len(args) != 0:
|
| 1731 |
ankur.sing |
173 |
print 'getSuccessfulPaymentsAmountRange requires 0 args'
|
| 1627 |
ankur.sing |
174 |
sys.exit(1)
|
| 1731 |
ankur.sing |
175 |
pp.pprint(client.getSuccessfulPaymentsAmountRange())
|
| 1627 |
ankur.sing |
176 |
|
| 2559 |
chandransh |
177 |
elif cmd == 'initializeHdfcPayment':
|
| 10478 |
amit.gupta |
178 |
if len(args) != 2:
|
|
|
179 |
print 'initializeHdfcPayment requires 2 args'
|
| 2559 |
chandransh |
180 |
sys.exit(1)
|
| 10478 |
amit.gupta |
181 |
pp.pprint(client.initializeHdfcPayment(eval(args[0]),eval(args[1]),))
|
| 2559 |
chandransh |
182 |
|
| 6050 |
anupam.sin |
183 |
elif cmd == 'doHdfcPaymentForDigitalOrder':
|
| 10478 |
amit.gupta |
184 |
if len(args) != 4:
|
|
|
185 |
print 'doHdfcPaymentForDigitalOrder requires 4 args'
|
| 6050 |
anupam.sin |
186 |
sys.exit(1)
|
| 10478 |
amit.gupta |
187 |
pp.pprint(client.doHdfcPaymentForDigitalOrder(eval(args[0]),eval(args[1]),args[2],eval(args[3]),))
|
| 6050 |
anupam.sin |
188 |
|
| 3616 |
chandransh |
189 |
elif cmd == 'initializeHdfcEmiPayment':
|
| 10478 |
amit.gupta |
190 |
if len(args) != 2:
|
|
|
191 |
print 'initializeHdfcEmiPayment requires 2 args'
|
| 3616 |
chandransh |
192 |
sys.exit(1)
|
| 10478 |
amit.gupta |
193 |
pp.pprint(client.initializeHdfcEmiPayment(eval(args[0]),eval(args[1]),))
|
| 3616 |
chandransh |
194 |
|
| 2685 |
chandransh |
195 |
elif cmd == 'createRefund':
|
|
|
196 |
if len(args) != 3:
|
|
|
197 |
print 'createRefund requires 3 args'
|
|
|
198 |
sys.exit(1)
|
|
|
199 |
pp.pprint(client.createRefund(eval(args[0]),eval(args[1]),eval(args[2]),))
|
|
|
200 |
|
| 3010 |
chandransh |
201 |
elif cmd == 'capturePayment':
|
| 8618 |
rajveer |
202 |
if len(args) != 2:
|
|
|
203 |
print 'capturePayment requires 2 args'
|
| 3010 |
chandransh |
204 |
sys.exit(1)
|
| 8618 |
rajveer |
205 |
pp.pprint(client.capturePayment(eval(args[0]),eval(args[1]),))
|
| 3010 |
chandransh |
206 |
|
| 6486 |
rajveer |
207 |
elif cmd == 'refundPayment':
|
|
|
208 |
if len(args) != 3:
|
|
|
209 |
print 'refundPayment requires 3 args'
|
|
|
210 |
sys.exit(1)
|
|
|
211 |
pp.pprint(client.refundPayment(eval(args[0]),eval(args[1]),eval(args[2]),))
|
|
|
212 |
|
| 3956 |
chandransh |
213 |
elif cmd == 'partiallyCapturePayment':
|
|
|
214 |
if len(args) != 5:
|
|
|
215 |
print 'partiallyCapturePayment requires 5 args'
|
|
|
216 |
sys.exit(1)
|
|
|
217 |
pp.pprint(client.partiallyCapturePayment(eval(args[0]),eval(args[1]),args[2],args[3],eval(args[4]),))
|
|
|
218 |
|
| 4008 |
mandeep.dh |
219 |
elif cmd == 'getPaymentsRequiringExtraProcessing':
|
|
|
220 |
if len(args) != 1:
|
|
|
221 |
print 'getPaymentsRequiringExtraProcessing requires 1 args'
|
|
|
222 |
sys.exit(1)
|
|
|
223 |
pp.pprint(client.getPaymentsRequiringExtraProcessing(eval(args[0]),))
|
|
|
224 |
|
|
|
225 |
elif cmd == 'markPaymentAsProcessed':
|
|
|
226 |
if len(args) != 2:
|
|
|
227 |
print 'markPaymentAsProcessed requires 2 args'
|
|
|
228 |
sys.exit(1)
|
|
|
229 |
pp.pprint(client.markPaymentAsProcessed(eval(args[0]),eval(args[1]),))
|
|
|
230 |
|
| 8914 |
rajveer |
231 |
elif cmd == 'getPaymentStatusAtGateway':
|
| 8908 |
rajveer |
232 |
if len(args) != 3:
|
| 8914 |
rajveer |
233 |
print 'getPaymentStatusAtGateway requires 3 args'
|
| 8908 |
rajveer |
234 |
sys.exit(1)
|
| 8914 |
rajveer |
235 |
pp.pprint(client.getPaymentStatusAtGateway(eval(args[0]),eval(args[1]),eval(args[2]),))
|
| 8908 |
rajveer |
236 |
|
| 18577 |
manish.sha |
237 |
elif cmd == 'getCreditorInfo':
|
|
|
238 |
if len(args) != 2:
|
|
|
239 |
print 'getCreditorInfo requires 2 args'
|
|
|
240 |
sys.exit(1)
|
|
|
241 |
pp.pprint(client.getCreditorInfo(eval(args[0]),args[1],))
|
|
|
242 |
|
|
|
243 |
elif cmd == 'updateCreditorInfo':
|
|
|
244 |
if len(args) != 1:
|
|
|
245 |
print 'updateCreditorInfo requires 1 args'
|
|
|
246 |
sys.exit(1)
|
|
|
247 |
pp.pprint(client.updateCreditorInfo(eval(args[0]),))
|
|
|
248 |
|
|
|
249 |
elif cmd == 'getUserSanctionDetails':
|
|
|
250 |
if len(args) != 1:
|
|
|
251 |
print 'getUserSanctionDetails requires 1 args'
|
|
|
252 |
sys.exit(1)
|
|
|
253 |
pp.pprint(client.getUserSanctionDetails(eval(args[0]),))
|
|
|
254 |
|
|
|
255 |
elif cmd == 'getUserSanctionDetailsForCreditor':
|
|
|
256 |
if len(args) != 2:
|
|
|
257 |
print 'getUserSanctionDetailsForCreditor requires 2 args'
|
|
|
258 |
sys.exit(1)
|
|
|
259 |
pp.pprint(client.getUserSanctionDetailsForCreditor(eval(args[0]),eval(args[1]),))
|
|
|
260 |
|
|
|
261 |
elif cmd == 'updateUserSanction':
|
|
|
262 |
if len(args) != 1:
|
|
|
263 |
print 'updateUserSanction requires 1 args'
|
|
|
264 |
sys.exit(1)
|
|
|
265 |
pp.pprint(client.updateUserSanction(eval(args[0]),))
|
|
|
266 |
|
|
|
267 |
elif cmd == 'getCreditHistoryRecordsForTransaction':
|
|
|
268 |
if len(args) != 3:
|
|
|
269 |
print 'getCreditHistoryRecordsForTransaction requires 3 args'
|
|
|
270 |
sys.exit(1)
|
|
|
271 |
pp.pprint(client.getCreditHistoryRecordsForTransaction(eval(args[0]),eval(args[1]),args[2],))
|
|
|
272 |
|
|
|
273 |
elif cmd == 'getCreditHistoryRecordsForUserAndCreditor':
|
|
|
274 |
if len(args) != 2:
|
|
|
275 |
print 'getCreditHistoryRecordsForUserAndCreditor requires 2 args'
|
|
|
276 |
sys.exit(1)
|
|
|
277 |
pp.pprint(client.getCreditHistoryRecordsForUserAndCreditor(eval(args[0]),args[1],))
|
|
|
278 |
|
|
|
279 |
elif cmd == 'processCreditTransaction':
|
|
|
280 |
if len(args) != 2:
|
|
|
281 |
print 'processCreditTransaction requires 2 args'
|
|
|
282 |
sys.exit(1)
|
|
|
283 |
pp.pprint(client.processCreditTransaction(eval(args[0]),eval(args[1]),))
|
|
|
284 |
|
|
|
285 |
elif cmd == 'getLoanPayableForUserToCreditor':
|
|
|
286 |
if len(args) != 3:
|
|
|
287 |
print 'getLoanPayableForUserToCreditor requires 3 args'
|
|
|
288 |
sys.exit(1)
|
|
|
289 |
pp.pprint(client.getLoanPayableForUserToCreditor(eval(args[0]),eval(args[1]),eval(args[2]),))
|
|
|
290 |
|
| 3431 |
rajveer |
291 |
else:
|
|
|
292 |
print 'Unrecognized method %s' % cmd
|
|
|
293 |
sys.exit(1)
|
|
|
294 |
|
| 420 |
ashish |
295 |
transport.close()
|