Subversion Repositories SmartDukaan

Rev

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

Rev 21089 Rev 21993
Line 5... Line 5...
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
from shop2020.config.client.ConfigClient import ConfigClient
8
from decimal import Decimal
8
from decimal import Decimal
9
from shop2020.thriftpy.model.v1.order.ttypes import RechargeMode
9
from shop2020.thriftpy.model.v1.order.ttypes import RechargeMode
-
 
10
from suds.cache import NoCache
10
logging.basicConfig(level=logging.INFO)
11
logging.basicConfig(level=logging.INFO)
11
 
12
 
12
username = base64.b64encode('saholic20')
13
username = base64.b64encode('saholic20')
13
password = base64.b64encode('ap2020sh')
14
password = base64.b64encode('ap2020sh')
14
account_url = 'https://api.spicesafar.com/McommWebServices/AccountApiMcomm?wsdl'
15
account_url = "file:./AccountApiMcomm.xml"
15
recharge_url = 'https://api.spicesafar.com/McommWebServices/RechargeApiMcomm?wsdl'
16
recharge_url = "file:./RechargeApiMcomm.xml"
16
aclient = None
17
aclient = None
17
raclient = None
18
raclient = None
18
allow_recharge = False
19
allow_recharge = False
19
 
20
 
20
store_map = {
21
store_map = {
Line 209... Line 210...
209
    allow_recharge = True    
210
    allow_recharge = True    
210
 
211
 
211
def getAccountClient():
212
def getAccountClient():
212
    global aclient
213
    global aclient
213
    if aclient is None:
214
    if aclient is None:
214
        aclient = Client(account_url, timeout=70)
215
        aclient = Client(account_url, timeout=70,cache=NoCache())
215
    return aclient
216
    return aclient
216
 
217
 
217
def getRechargeClient():
218
def getRechargeClient():
218
    global raclient
219
    global raclient
219
    if raclient is None:
220
    if raclient is None:
220
        raclient = Client(recharge_url, timeout=70)    
221
        raclient = Client(recharge_url, timeout=70,cache=NoCache())    
221
    return raclient
222
    return raclient
222
 
223
 
223
def rechargeDevice(transactionId, rechargeType, strProviderCode, deviceNumber, amount, plan, storeCode = '', rechargeMode=None):
224
def rechargeDevice(transactionId, rechargeType, strProviderCode, deviceNumber, amount, plan, storeCode = '', rechargeMode=None):
224
    if not allow_recharge:
225
    if not allow_recharge:
225
        return 'S', '00', 'spiceTID', 'SUCCESS', 'aggTID', 'providerTID'
226
        return 'S', '00', 'spiceTID', 'SUCCESS', 'aggTID', 'providerTID'
Line 416... Line 417...
416
        responseDescription = ""
417
        responseDescription = ""
417
    return responseCode, responseDescription
418
    return responseCode, responseDescription
418
 
419
 
419
def main():
420
def main():
420
    #print rechargeDevice(20141031157,'MTP','BSP','9459060666',1,'')
421
    #print rechargeDevice(20141031157,'MTP','BSP','9459060666',1,'')
421
    print checkTransactionStatus("", 1004866117)
422
    #print checkTransactionStatus("", 1004866117)
-
 
423
    getBalance()
422
 
424
 
423
if __name__=='__main__':
425
if __name__=='__main__':
424
    main()
-
 
425
426
    main()
-
 
427