| Line 2... |
Line 2... |
| 2 |
import base64, re
|
2 |
import base64, re
|
| 3 |
from xml.dom.minidom import parseString
|
3 |
from xml.dom.minidom import parseString
|
| 4 |
import logging
|
4 |
import logging
|
| 5 |
from datetime import datetime
|
5 |
from datetime import datetime
|
| 6 |
import time
|
6 |
import time
|
| - |
|
7 |
from shop2020.config.client.ConfigClient import ConfigClient
|
| 7 |
logging.basicConfig(level=logging.INFO)
|
8 |
logging.basicConfig(level=logging.INFO)
|
| 8 |
#logging.getLogger('suds.client').setLevel(logging.DEBUG)
|
9 |
#logging.getLogger('suds.client').setLevel(logging.DEBUG)
|
| 9 |
#logging.getLogger('suds.transport').setLevel(logging.DEBUG)
|
10 |
#logging.getLogger('suds.transport').setLevel(logging.DEBUG)
|
| 10 |
|
11 |
|
| 11 |
|
12 |
|
| Line 13... |
Line 14... |
| 13 |
password = base64.b64encode('ap2020sh')
|
14 |
password = base64.b64encode('ap2020sh')
|
| 14 |
account_url = 'http://125.19.68.55/McommWebServices/AccountApiMcomm?wsdl'
|
15 |
account_url = 'http://125.19.68.55/McommWebServices/AccountApiMcomm?wsdl'
|
| 15 |
recharge_url = 'http://125.19.68.55/McommWebServices/RechargeApiMcomm?wsdl'
|
16 |
recharge_url = 'http://125.19.68.55/McommWebServices/RechargeApiMcomm?wsdl'
|
| 16 |
aclient = None
|
17 |
aclient = None
|
| 17 |
raclient = None
|
18 |
raclient = None
|
| - |
|
19 |
allow_recharge = False
|
| 18 |
|
20 |
|
| - |
|
21 |
allow_recharge_string = ConfigClient().get_property('allow_recharge')
|
| - |
|
22 |
|
| - |
|
23 |
if allow_recharge_string in ['True', 'true']:
|
| - |
|
24 |
allow_recharge = True
|
| 19 |
|
25 |
|
| 20 |
def getAccountClient():
|
26 |
def getAccountClient():
|
| 21 |
global aclient
|
27 |
global aclient
|
| 22 |
if aclient is None:
|
28 |
if aclient is None:
|
| 23 |
aclient = Client(account_url, timeout=70)
|
29 |
aclient = Client(account_url, timeout=70)
|
| Line 28... |
Line 34... |
| 28 |
if raclient is None:
|
34 |
if raclient is None:
|
| 29 |
raclient = Client(recharge_url, timeout=70)
|
35 |
raclient = Client(recharge_url, timeout=70)
|
| 30 |
return raclient
|
36 |
return raclient
|
| 31 |
|
37 |
|
| 32 |
def rechargeDevice(transactionId, rechargeType, strProviderCode, deviceNumber, amount, plan):
|
38 |
def rechargeDevice(transactionId, rechargeType, strProviderCode, deviceNumber, amount, plan):
|
| - |
|
39 |
if not allow_recharge:
|
| - |
|
40 |
return 'S', '00', 'Testing', 'SUCCESS'
|
| 33 |
spString = getRechargeClient().service.getRecharge(username, password, '919650889334', 'SOAP', '115.249.47.66', transactionId, rechargeType, strProviderCode, deviceNumber, amount, 'DEBIT', '', plan, '')
|
41 |
spString = getRechargeClient().service.getRecharge(username, password, '919650889334', 'SOAP', '115.249.47.66', transactionId, rechargeType, strProviderCode, deviceNumber, amount, 'DEBIT', '', plan, '')
|
| 34 |
print spString
|
42 |
print spString
|
| 35 |
spString = re.sub('<\?.*\?>','',spString)
|
43 |
spString = re.sub('<\?.*\?>','',spString)
|
| 36 |
spString = "<dom>" + spString + "</dom>"
|
44 |
spString = "<dom>" + spString + "</dom>"
|
| 37 |
dom = parseString(spString)
|
45 |
dom = parseString(spString)
|