def doPayCard(self): bcc = bccclt.new(CustInfoGen.MAINFUNC) if not self.doLogin(bcc): return False rpt = chkpfmnc.CheckPerf() rpt.startchk() for custid in self.custidlist: current = datetime.datetime.now().strftime('%Y%m%d%H%M%S') v = { 'lvol0':custid, 'damt0':40.0, 'snote':self.samno, 'sdate0':current[:8], 'stime0':current[8:], 'semp':self.opercode, 'sstat_type':'F' } print "正在缴费客户号[%d]..." % custid ret = 0 ret = bcc.callsvr(2001,v,3000) if ret != 0: print "卡缴费失败custid[%d],ret[%d][%s]" % (custid,ret,bcc.errmsg) return False rpt.setchkpoint() print rpt.report() return True
def testVoucherMake(self): """ 测试凭证录入功能 """ obj = bccclt.new(common.MAINFUNC) v = { "sstatus0":"A", "lsafe_level":11, "lwithdraw_flag":common.TERMID, "semp":"1000", "sorder0":"20100815", "lvol0":2, "snote":"退款", "lbank_acc_type":5, "lvol9":2, "sname2":"14525678", "scust_auth":"220201", "damt1":500, "damt2":0, "damt3":0, "damt4":500, "snote2":"退款", "scust_auth2":"1001", } ret = obj.callsvr(850050,v) self.failUnless(ret==0,obj.errmsg) self.failUnless(obj.recordcnt==1,'no record') x = obj.getrecord(["lserial1","lserial0","lsafe_level"])
def estWaterTrans(self): """ 测试广州大学城水控充值 """ obj = bccclt.new(6000) befbala=100.0 tranbala=5.0 # 正常交易 v = {"lcert_code":240201,"lvol0":common.CARDNO,"lvol1":common.CARDCNT,"lvol2":0, "damt0":befbala,"damt1":tranbala,"scust_no":'1000','lvol3':1,'lvol4':common.TERMID, 'sname':'','sphone':'13564319628'} ret = obj.callsvr(847316,v) self.failUnless(ret==0,obj.errmsg) x = obj.getrecord(["lvol0","damt0","damt1","damt2","lvol5",'damt10','damt11','damt12']) self.assertEqual(x["damt0"],befbala-tranbala,'incorrect aftbala') self.assertEqual(x["lvol5"],(befbala-tranbala)*100,'incorrect aftbala') self.failUnless(x['damt10']>0.0,'water price1') self.failUnless(x['damt11']>0.0,'water price2') self.failUnless(x['damt12']>0.0,'water price3') v = {"lcert_code":240201,"lvol0":3797,"lvol1":24,"lvol2":0, "damt0":100.0,"damt1":1,"scust_no":'1000','lvol3':1,'lvol4':125, 'sname':'','sphone':'13564319628','lvol6':x['lvol0']} ret = obj.callsvr(847317,v) self.failUnless(ret==0,obj.errmsg)
def estInconstantTrans(self): """ 测试非正常流水支付 """ obj = bccclt.new(common.MAINFUNC) # 测试异常交易 v = {"lcert_code":210001,"lvol0":common.CARDNO,"lvol1":common.CARDCNT,"lvol2":0, "damt0":100.0,"damt1":1,'lvol3':1,'lvol4':common.TERMID, 'sname':'','sphone':'13564319628'} ret = obj.callsvr(847316,v) self.failUnless(ret==0,obj.errmsg) x = obj.getrecord(["lvol0","damt0","damt1","damt2","lvol5"]) self.assertEqual(x["damt0"],99.0,'incorrect aftbala') self.assertEqual(x["lvol5"],9900,'incorrect aftbala') v = {"lcert_code":210002,"lvol0":common.CARDNO,"lvol1":common.CARDCNT,"lvol2":0, "damt0":100.0,"damt1":1,'lvol3':1,'lvol4':common.TERMID, 'sname':'','sphone':'13564319628','lvol6':x['lvol0']} ret = obj.callsvr(847317,v) self.failUnless(ret<>0,obj.errmsg) # 测试异常交易金额 v = {"lcert_code":210001,"lvol0":common.CARDNO,"lvol1":common.CARDCNT,"lvol2":0, "damt0":1.2,"damt1":1.2,'lvol3':1,'lvol4':common.TERMID, 'sname':'','sphone':'13564319628'} ret = obj.callsvr(847316,v) self.failUnless(ret==0,obj.errmsg) v = {"lcert_code":210001,"lvol0":common.CARDNO,"lvol1":common.CARDCNT,"lvol2":0, "damt0":1.2,"damt1":1.21,'lvol3':1,'lvol4':common.TERMID, 'sname':'','sphone':'13564319628'} ret = obj.callsvr(847316,v) self.failUnless(ret<>0,obj.errmsg)
def testQuery(self): """ 测试查询第三方账户 """ obj = bccclt.new(9900) v = { 'scust_limit':'001', 'sbank_code':'1000', 'sbank_acc':'12345', 'spager':'200901010', 'sall_name':'张三', 'lwithdraw_flag':common.TERMID, 'vsvarstr0':'aaaaaaaa', 'sholder_ac_no2':'10.49.188.13', 'lvol4':3000, 'lsafe_level':3 } ret = obj.callsvr(851001,v,10000) self.failUnless(ret==0,obj.errmsg) x = obj.getrecord(['scust_limit', 'sbank_code', 'sbank_acc', 'scusttypes', 'lvol1', 'sstation0', 'lsafe_level', 'vsmess',]) self.failUnless(x['lsafe_level']==0,'查询账户 : ' + x['vsmess']) print x
def testPOSReverse(self): """ 测试充值冲正 """ obj = bccclt.new(common.MAINFUNC) current = datetime.today().strftime('%Y%m%d%H%M%S') v = { 'sphone3':'0181100706', 'lwithdraw_flag':0, 'lserial0':124, 'sstation0':'0000000015', 'lvol10':12, 'lvol1':dpsPOSTest.batchno, 'lvol2':dpsPOSTest.authcode, 'semp_no':dpsPOSTest.opercode, 'lvol4':12, 'lvol7':30870, 'lvol8':100, 'lvol5':4, 'sdate0':current[:8], 'stime0':current[8:] } ret = obj.callsvr(950073,v,1000) self.failUnless(ret==0,obj.errmsg) self.failUnless(obj.recordcnt==1,'no record') x = obj.getrecord(['lcert_code','lbank_acc_type','sdate3','stime3','sstock_code2','sphone3','lserial0', 'scust_auth','lvol4','lvol7','lvol8','lvol10']) print x msg = '后台返回[%d]' % x['lcert_code'] self.failUnless(x['lcert_code']==0,msg)
def testLogin(self): """ 测试前置机登录 """ obj = bccclt.new(6000) v = { 'scust_limit':'172.16.0.52', 'scust_limit2':'00-1C-23-4F-0E-C3', 'scert_no':'sungard kingstar gateway common v3 version' } ret = obj.callsvr(950001,v) self.failUnless(ret==0,obj.errmsg) x = obj.getrecord(['lvol0','scust_limit']) v = { 'lvol0':x['lvol0'], 'scust_limit':x['scust_limit'] } ret = obj.callsvr(950002,v) self.failUnless(ret==0,obj.errmsg) y = obj.getrecord(['lvol0','lvol1','lvol2','lvol3','lvol4', 'lvol5','lvol6','lvol7','lvol8','lvol9','sname','sname2']) print y self.failUnless(y['lvol3']>0,'parameter error') self.failUnless(y['lvol9']>0,'parameter error')
def testCfgFeeAdd(self): """ 添加收费参数 """ obj = bccclt.new(common.MAINFUNC) v = {'lvol0': 3000, 'lvol1': 602, 'lvol2': 1, 'lvol3': 0, 'lvol5': 12, 'lsafe_level': 1, 'sbranch_code0': '0', 'damt0': 8.0, 'sstatus0': 'D', 'sstation0': '001C234F0EC3', 'semp': '1000', 'lvol7':10} ret = obj.callsvr(846502,v,5000) #self.failUnless(ret==0,obj.errmsg) v = {'lvol0': 3000, 'lvol1': 602, 'lvol2': 1, 'lvol3': 0, 'lvol5': 12, 'lsafe_level': 1, 'sbranch_code0': '0', 'damt0': 8.0, 'sstatus0': 'A', 'sstation0': '001C234F0EC3', 'semp': '1000', 'lvol7':10} ret = obj.callsvr(846502,v,5000) self.failUnless(ret==0,obj.errmsg) v = {'lvol0': 3000, 'lvol1': 602, 'lvol2': 1, 'lvol3': 0, 'lvol5': 12, 'lsafe_level': 1, 'sbranch_code0': '0', 'damt0': 8.0, 'sstatus0': 'D', 'sstation0': '001C234F0EC3', 'semp': '1000', 'lvol7':30} ret = obj.callsvr(846502,v,5000) #self.failUnless(ret==0,obj.errmsg) v = {'lvol0': 3000, 'lvol1': 602, 'lvol2': 1, 'lvol3': 0, 'lvol5': 12, 'lsafe_level': 1, 'sbranch_code0': '0', 'damt0': 8.0, 'sstatus0': 'A', 'sstation0': '001C234F0EC3', 'semp': '1000', 'lvol7':30} ret = obj.callsvr(846502,v,5000) self.failUnless(ret==0,obj.errmsg)
def testInitForLoad(self): """ Ȧ´æ³õʼ»¯ """ d = datetime.datetime.now() current = d.strftime("%Y%m%d%H%M%S") obj = bccclt.new(common.MAINFUNC) v = { "scust_limit":testBUBank.dynkey, "lcert_code":testBUBank.batchno, "lwithdraw_flag":testBUBank.svrid, "sholder_ac_no":testBUBank.samno, "lserial0":testBUBank.samseqno, "scust_auth":testBUBank.cardasno, "lvol2":testBUBank.befbal, "lvol1":testBUBank.dpscnt, "lvol0":testBUBank.amount, "sdate1":"20110505", "sdate0":current[:8], "stime0":current[8:], "sname":"", "sbank_acc":"6225881204373798" } ret = obj.callsvr(50002,v) self.failUnless(ret==0,obj.errmsg) x = obj.getrecord(['sphone']) testBUBank.refno=x['sphone'] print x
def testTermTrans(self): """ ²âÊÔÖÕ¶ËÏû·Ñ """ obj = bccclt.new(common.MAINFUNC) # ½â¹Ò v={"sstatus1":"0","lwithdraw_flag":common.TERMID,"lvol0":common.CARDNO} ret = obj.callsvr(846307,v) self.failUnless(ret==0,obj.errmsg) # Öն˵Ǽ v = { "lcert_code":3, "lvol0":5 } ret = obj.callsvr(849001,v) self.failUnless(ret==0,obj.errmsg) x = obj.getrecord(["lvol0","lvol1","scust_limit",'lvol2','lvol3','lvol4','scust_no','lvol5']) self.failUnless(x['lvol1']>0,'serial error!') devid=x['lvol0'] serialno=x['lvol1'] # ÖÕ¶ËÏû·Ñ v = {"lcert_code":240202,"lvol0":common.CARDNO,"lvol1":common.CARDCNT,"lvol2":0, "damt0":100.0,"damt1":1,'lvol3':1,'lvol4':devid, 'sname':'','sphone':'13564319628','lvol5':serialno} ret = obj.callsvr(847316,v) self.failUnless(ret==0,"%s ,value %d " % (obj.errmsg,ret)) x = obj.getrecord(["lvol0","damt0","damt1","damt2","lvol5","sdate1"]) self.assertEqual(x["damt0"],99.0,'incorrect aftbala') self.assertEqual(x["lvol5"],9900,'incorrect aftbala') v = {"lcert_code":240202,"lvol0":common.CARDNO,"lvol1":common.CARDCNT,"lvol2":0, "damt0":100.0,"damt1":1,'lvol3':1,'lvol4':devid, 'sname':'','sphone':'13564319628','lvol6':x['lvol0']} ret = obj.callsvr(847317,v) self.failUnless(ret==0,obj.errmsg) # ²âÊÔÖÕ¶ËÁ÷Ë®ºÅÖظ´µÄÎÊÌâ v = {"lcert_code":240202,"lvol0":common.CARDNO,"lvol1":common.CARDCNT,"lvol2":0, "damt0":100.0,"damt1":1,'lvol3':1,'lvol4':devid, 'sname':'','sphone':'13564319628','lvol5':serialno} ret = obj.callsvr(847316,v) self.failUnless(ret<>0,"%s ,value %d " % (obj.errmsg,ret)) # ÔÙ²âÊÔÒ»±ÊÕý³£Ïû·Ñ serialno+=1 v = {"lcert_code":240202,"lvol0":common.CARDNO,"lvol1":common.CARDCNT,"lvol2":0, "damt0":100.0,"damt1":1,'lvol3':1,'lvol4':devid, 'sname':'','sphone':'13564319628','lvol5':serialno} ret = obj.callsvr(847316,v) self.failUnless(ret==0,"%s ,value %d ,serial %d " % (obj.errmsg,ret,serialno)) x = obj.getrecord(["lvol0","damt0","damt1","damt2","lvol5","sdate1"]) self.assertEqual(x["damt0"],99.0,'incorrect aftbala') self.assertEqual(x["lvol5"],9900,'incorrect aftbala') v = {"lcert_code":240202,"lvol0":common.CARDNO,"lvol1":common.CARDCNT,"lvol2":0, "damt0":100.0,"damt1":1,'lvol3':1,'lvol4':devid, 'sname':'','sphone':'13564319628','lvol6':x['lvol0']} ret = obj.callsvr(847317,v) self.failUnless(ret==0,obj.errmsg)
def GetSubsidy(self): """ ÁìÈ¡²¹Öú """ obj = bccclt.new(6000) v = { "lvol0":292214, "lvol3":0, "lvol5":380547 } ret = obj.callsvr(849006,v) self.failUnless(ret==0,obj.errmsg)
def SiteAdd1(self): """ Õ¾µãÌí¼Ó1 """ obj = bccclt.new(600) v = { "semp":"system", "sstatus0":"A", "scust_limit":"liweifang²âÊÔÕ¾µã", "sphone":"172.16.0.39" } ret = obj.callsvr(820341,v) self.failUnless(ret==0,obj.errmsg)
def testSiteAdd2(self): """ Õ¾µãÌí¼Ó2 """ obj = bccclt.new(600) v = { "semp":"system", "sstatus0":"A", "scust_limit":"wenjian²âÊÔÕ¾µã", "sphone":"192.168.234.1" } ret = obj.callsvr(820341,v) self.failUnless(ret==0,obj.errmsg)
def testVoucherEntry(self): """ 测试凭证入账功能 """ obj = bccclt.new(common.MAINFUNC) v = { "sstatus0":"B", "lsafe_level":11, "semp":"1000", "lserial0":3, } ret = obj.callsvr(850050,v) self.failUnless(ret==0,obj.errmsg)
def testDownloadSubsidy(self): """ ÏÂÔز¹Öú """ obj = bccclt.new(6000) v = { "semp":"system", "sstatus0":"A", "scust_limit":"wenjian²âÊÔÕ¾µã", "sphone":"192.168.113.1" } ret = obj.callsvr(849007,v) self.failUnless(ret==0,obj.errmsg)
def testGetDownloadList(self): """ 下载门禁名单队列 """ obj = bccclt.new(common.MAINFUNC) v = { "lcert_code":common.SYSID, "lvol0":20, "lvol1":10, "lvol2":0 } ret = obj.callsvr(950103,v) self.failUnless(ret==0,obj.errmsg)
def testPayWithSerial(self): """ 测试有流水补扣 """ obj = bccclt.new(common.MAINFUNC) v = {'lvol0':7,'semp':'1000','lvol1':97501,'lvol2':45,'sphone':'0022100807','sdate0':'20100826','stime0':'193152', 'sstation0':'D19EE170','lvol3':45} ret = obj.callsvr(850011,v,5000) self.failUnless(ret==0,obj.errmsg) x = obj.getrecord(['lvol0','lvol4','lvol5','damt0','sdate0','stime0']) print x self.failUnless(x['lvol4']==20,'交易金额不正确') self.failUnless(x['lvol5']==5000-20,'出卡金额不正确') self.failUnless(x['damt0']==(5000-30)/100.0,'出卡金额不正确')
def _testPayUnlock(self): """ 测试不需补扣 """ obj = bccclt.new(common.MAINFUNC) v = {'lvol0':7,'semp':'1000','lvol1':5000,'lvol2':40,'sphone':'0022100807','sdate0':'20100825','stime0':'150301', 'sstation0':'D19EE170','lvol3':39} ret = obj.callsvr(850011,v,5000) self.failUnless(ret==0,obj.errmsg) x = obj.getrecord(['lvol0','lvol4','lvol5','damt0','sdate0','stime0']) #print x self.failUnless(x['lvol4']==0,'交易金额不正确') self.failUnless(x['lvol5']==5000,'出卡金额不正确') self.failUnless(x['damt0']==5000/100.0,'出卡金额不正确')
def testDeviceLogin(self): """ ²âÊÔÖն˵Ǽ """ obj = bccclt.new(common.MAINFUNC) # É豸ÉÌ»§°ó¶¨ v = { "semp":common.OPERCODE, "sstatus0":"A", "lvol0":0, "lvol3":19, "lvol5":128, "stime2":"235959", "sdate1":"20090101", "sdate2":"20501010", } #ret = obj.callsvr(843371,v) #self.failUnless(ret==0,obj.errmsg) v = { "lcert_code":3, "lvol0":5 } ret = obj.callsvr(849001,v) self.failUnless(ret==0,obj.errmsg) x = obj.getrecord(["lvol0","lvol1","scust_limit",'lvol2','lvol3','lvol4','scust_no','lvol5']) #print x self.assertEquals(x['lvol5'],1,'ÖÕ¶ËÏû·Ñ¿ª¹Ø´íÎó') self.assertNotEquals(x['lvol0'],0,'Öն˺ŴíÎó') print "Ïû·Ñ½ð¶î1 : %d " % (x['lvol3']) print "Ïû·Ñ½ð¶î2 : %d " % (x['lvol4']) v = { "lcert_code":3, "lvol0":1 } ret = obj.callsvr(849001,v) self.failUnless(ret<>0,obj.errmsg) v = { "lcert_code":3, "lvol0":0 } ret = obj.callsvr(849001,v) self.failUnless(ret<>0,obj.errmsg) v = { "lcert_code":2, "lvol0":1 } ret = obj.callsvr(849001,v) self.failUnless(ret<>0,obj.errmsg)
def testGetSubsidy(self): """ 测试查询卡信息 """ obj = bccclt.new(6000) v = { "lwithdraw_flag":1220, 'lvol0':81, 'lvol5':5, # 充值次数 'lvol6':295, # 消费次数 'lvol7':11981, # 入卡值 } ret = obj.callsvr(846318,v,8000) self.failUnless(ret==0,obj.errmsg) x = obj.getrecord(['lvol0','lvol8','sdate3','lwithdraw_flag','lserial1','damt0','vsmess']) print x
def testQueryTrans(self): ''' ²âÊÔȦ´æÁ÷Ë®²éѯ ''' obj = bccclt.new(common.MAINFUNC) v = { "scust_limit":testBUBank.dynkey, "lcert_code":testBUBank.batchno, "lwithdraw_flag":testBUBank.svrid, "sdate0":'20110101', 'sdate1':'20110218', "scust_auth":testBUBank.cardasno } ret = obj.callsvr(50101,v,5000) self.failUnless(ret==0,obj.errmsg) x = obj.getrecord(['sphone','scust_auth2']) print x
def testLogin(self): """ Ȧ´æÇ°ÖûúÇ©µ½ """ obj = bccclt.new(common.MAINFUNC) v = { "scust_limit":"192.168.56.3", "scust_auth":"00-22-15-50-94-BF", "scust_auth2":"86435D353079A787" } ret = obj.callsvr(50001,v) self.failUnless(ret==0,obj.errmsg) x = obj.getrecord(['scust_limit','lserial0','lwithdraw_flag']) testBUBank.svrid=x['lwithdraw_flag'] testBUBank.dynkey=x['scust_limit'] testBUBank.batchno=x['lserial0'] print x
def testNormalTrans(self): """ 测试标准支付功能 """ obj = bccclt.new(common.MAINFUNC) #v={"sstatus1":"0","lwithdraw_flag":125,"lvol0":3797} #ret = obj.callsvr(846307,v) #self.failUnless(ret==0,obj.errmsg) # 测试正常交易 v = {"lcert_code":210001,"lvol0":common.CARDNO,"lvol1":common.CARDCNT,"lvol2":0, "damt0":100.0,"damt1":1,'lvol3':1,'lvol4':common.TERMID, 'sname':'','sphone':'13564319628'} ret = obj.callsvr(847316,v) self.failUnless(ret==0,obj.errmsg) self.failUnless(obj.recordcnt==1,'no record') x = obj.getrecord(["lvol0","damt0","damt1","damt2","lvol5","sdate1"]) self.assertEqual(x["damt0"],99.0,'incorrect aftbala') self.assertEqual(x["lvol5"],9900,'incorrect aftbala') v = {"lcert_code":210001,"lvol0":common.CARDNO,"lvol1":common.CARDCNT,"lvol2":0, "damt0":100.0,"damt1":1,'lvol3':1,'lvol4':common.TERMID, 'sname':'','sphone':'13564319628','lvol6':x['lvol0']} ret = obj.callsvr(847317,v) self.failUnless(ret==0,obj.errmsg) # 对同一交易重复测试 v = {"lcert_code":210001,"lvol0":common.CARDNO,"lvol1":common.CARDCNT,"lvol2":0, "damt0":100.0,"damt1":1,'lvol3':1,'lvol4':common.TERMID, 'sname':'','sphone':'13564319628','lvol6':x['lvol0']} ret = obj.callsvr(847317,v) self.failUnless(ret==0,obj.errmsg) # 准备查询账务流水 v = {"sdate1":x['sdate1'], "sdate2":x['sdate1'], 'lwithdraw_flag':common.TERMID, 'lserial1':x['lvol0']} ret = obj.callsvr(846606,v) self.failUnless(ret==0,obj.errmsg) self.failUnless(obj.recordcnt==2,'trans record error'); r = obj.getrecord(["sdate0"]) self.failUnless(r<>None,'no trans record') self.assertEquals(r['sdate0'],x['sdate1'],'account trans date error') r = obj.getrecord(["sdate0"]) self.failUnless(r<>None,'no trans record') self.assertEquals(r['sdate0'],x['sdate1'],'account trans date error') r = obj.getrecord(["sdate0"]) self.failUnless(r==None,'no trans record')
def estReaderTrans(self): """ 测试大学城读卡器收费 """ obj = bccclt.new(common.MAINFUNC) # 设备商户绑定 v = { "semp":common.OPERCODE, "sstatus0":"A", "lvol0":0, "lvol3":19, "lvol5":common.TERMID, "stime2":"235959", "sdate1":"20090101", "sdate2":"20501010", } #ret = obj.callsvr(843371,v) #self.failUnless(ret==0,obj.errmsg) # 测试正常交易 v = {"lcert_code":240202,"lvol0":common.CARDNO,"lvol1":common.CARDCNT,"lvol2":0, "damt0":100.0,"damt1":1,'lvol3':1,'lvol4':common.TERMID, 'sname':'','sphone':'13564319628'} ret = obj.callsvr(847316,v) self.failUnless(ret==0,"%s ,value %d " % (obj.errmsg,ret)) x = obj.getrecord(["lvol0","damt0","damt1","damt2","lvol5","sdate1"]) self.assertEqual(x["damt0"],99.0,'incorrect aftbala') self.assertEqual(x["lvol5"],9900,'incorrect aftbala') v = {"lcert_code":240202,"lvol0":common.CARDNO,"lvol1":common.CARDCNT,"lvol2":0, "damt0":100.0,"damt1":1,'lvol3':1,'lvol4':common.TERMID, 'sname':'','sphone':'13564319628','lvol6':x['lvol0']} ret = obj.callsvr(847317,v) self.failUnless(ret==0,obj.errmsg) v = {"sdate1":x['sdate1'], "sdate2":x['sdate1'], 'lwithdraw_flag':common.TERMID, 'lserial1':x['lvol0']} ret = obj.callsvr(846606,v) self.failUnless(ret==0,obj.errmsg) self.failUnless(obj.recordcnt==2,'trans record error'); r = obj.getrecord(["sdate0"]) self.failUnless(r<>None,'no trans record') self.assertEquals(r['sdate0'],x['sdate1'],'account trans date error') r = obj.getrecord(["sdate0"]) self.failUnless(r<>None,'no trans record') self.assertEquals(r['sdate0'],x['sdate1'],'account trans date error') r = obj.getrecord(["sdate0"]) self.failUnless(r==None,'no trans record')
def testShopPosAdd(self): """设备商户分配""" obj = bccclt.new(common.MAINFUNC) v = { "lwithdraw_flag":127, "semp":common.OPERCODE, "sstatus0":"A", "lvol0":0, "lvol3":19, "lvol5":common.TERMID, "stime2":"235959", "sdate1":"20090101", "sdate2":"20501010", } ret = obj.callsvr(843371,v) self.failUnless(ret==0,obj.errmsg)
def testSign(self): """Ȧ´æÇ©µ½""" obj = bccclt.new(5000) v = { "snote":'Ȧ´æÇ©µ½', "sdate0":'20090606', "stime0":'182144', "lvol0":'92083', "sclose_emp":'240101', "semp_pwd":'111111', "sstatus0":'0', "sserial0":'4800', "sorder2":'124' } ret = obj.callsvr(900077,v) self.failUnless(ret==0,obj.errmsg)
def testExcLoss(self): """ ²âÊÔµÚÈý·½¹Òʧ¿¨ """ obj = bccclt.new(common.MAINFUNC) # ÏÈÐÞ¸ÄÃÜÂë v = { "lvol0":common.CARDNO, "scust_no":common.CARDPWD, "lwithdraw_flag":common.TERMID, "semp":common.OPERCODE } ret = obj.callsvr(847111,v) self.failUnless(ret==0,obj.errmsg) # ¹Òʧ¿¨ v = { "lvol0":common.CUSTID, "lvol1":0, "lvol2":0, "sstatus0":'1', "semp_pwd":common.CARDPWD, "scust_limit":common.OPERCODE, "lvol6":common.TERMID, "lvol7":common.TERMID } ret = obj.callsvr(847318,v) self.failUnless(ret==0,obj.errmsg) # ²éѯ¿¨ÐÅÏ¢ v = { "lvol1":common.CUSTID } query_ret = obj.callsvr(849002,v) if query_ret == 0: x = obj.getrecord(['lvol1','semail','smarket_code','sphone','scust_auth2', 'scert_no','sstatus1','lvol6','sdate0','damt0','sdate2','scust_no2','sroom_no','lvol2']) # ¿¨½â¹Ò v={"sstatus1":"0","lwithdraw_flag":common.TERMID,"lvol0":common.CARDNO} ret = obj.callsvr(846307,v) self.failUnless(ret==0,obj.errmsg) self.failUnless(query_ret==0,obj.errmsg) self.assertEquals(x['sdate2'][1],'1','card is not loss')
def estFronzenCardTrans(self): """ 测试冻结卡支付 """ obj = bccclt.new(common.MAINFUNC) # 卡冻结后测试 v={"sstatus1":"1","lwithdraw_flag":common.TERMID,"lvol0":common.CARDNO} ret = obj.callsvr(846308,v) self.failUnless(ret==0,obj.errmsg) v = {"lcert_code":210001,"lvol0":common.CARDNO,"lvol1":common.CARDCNT,"lvol2":0, "damt0":100.0,"damt1":1,'lvol3':1,'lvol4':common.TERMID, 'sname':'','sphone':'13564319628'} ret = obj.callsvr(847316,v) self.failUnless(ret<>0,obj.errmsg) # 卡解冻 v={"sstatus1":"0","lwithdraw_flag":common.TERMID,"lvol0":common.CARDNO} ret = obj.callsvr(846308,v) self.failUnless(ret==0,obj.errmsg)
def testCardUnLost(self): """¿¨½â¹Ò""" obj = bccclt.new(5000) v = { "snote":'¿¨½â¹Ò', "sdate0":'20090606', "stime0":'182144', "lvol0":'92083', "sclose_emp":'930002', "semp_pwd":'111111', "sstatus0":'0', "sserial0":'4942', "sorder2":'127', } ret = obj.callsvr(900077,v) self.failUnless(ret==0,obj.errmsg) x = obj.getrecord(["lvol8","damt0","damt1","damt2","lvol5"])
def testReadCardFromDB(self): """ ²âÊÔ²éѯ¿¨ÐÅÏ¢ """ obj = bccclt.new(5000) v = { "lvol1":common.CUSTID } ret = obj.callsvr(849002,v) self.failUnless(ret==0,obj.errmsg) x = obj.getrecord(['lvol1','semail','smarket_code','sphone','scust_auth2', 'scert_no','sstatus1','lvol6','sdate0','damt0','sdate2','scust_no2','sroom_no','lvol2']) #print x v = { "lvol0":common.CARDNO } ret = obj.callsvr(847173,v) self.failUnless(ret==0,obj.errmsg)
def testReadCardFromDB(self): """ ²âÊÔ²éѯ¿¨ÐÅÏ¢ """ obj = bccclt.new(common.MAINFUNC) v = { "lvol1":common.CUSTID } ret = obj.callsvr(849002,v) self.failUnless(ret==0,obj.errmsg) x = obj.getrecord(['lvol1','semail','smarket_code','sphone','scust_auth2', 'scert_no','sstatus1','lvol6','sdate0','damt0','sdate2','scust_no2','sroom_no','lvol2']) #print x v = { "lvol0":common.CARDNO } ret = obj.callsvr(847173,v) self.failUnless(ret==0,obj.errmsg)
def testPayTrans(self): """ 测试支付模拟入账功能 """ obj = bccclt.new(common.MAINFUNC) #v={"sstatus1":"0","lwithdraw_flag":125,"lvol0":3797} #ret = obj.callsvr(846307,v) #self.failUnless(ret==0,obj.errmsg) """测试模拟入账交易""" v = { 'lbank_acc_type':1, 'lwithdraw_flag':common.TERMID, "lcert_code":4200, "lvol0":common.CARDNO, "lvol6":common.CARDCNT, "lvol7":10000, "lvol1":500, 'lsafe_level':100, } ret = obj.callsvr(850005,v) self.failUnless(ret==0,obj.errmsg) self.failUnless(obj.recordcnt==1,'no record') x = obj.getrecord(["lvol0","lvol8","lvol10","lvol11","lvol12","sdate3","stime3","lsafe_level2","sphone3","saddr"]) #self.assertEqual(x["lvol8"],9900,'incorrect aftbala') #self.assertEqual(x["lsafe_level2"],200,'incorrect water aftbala') #self.assertEqual(x["lvol10"],4,'incorrect ') #return """ 测试正式入账交易 """ # 测试正常交易 v = { 'lbank_acc_type':2, 'lwithdraw_flag':common.TERMID, "lvol0":common.CARDNO, "lvol6":common.CARDCNT, "lvol7":10000, "lvol1":100, 'lsafe_level':100, 'sphone3':x["sphone3"], 'saddr':x["saddr"], } ret = obj.callsvr(850005,v) self.failUnless(ret==0,obj.errmsg) self.failUnless(obj.recordcnt==1,'no record') x = obj.getrecord(["lvol0","lvol8","lvol10","lvol11","lvol12","sdate3","stime3","lsafe_level2"])
def testOnlineMac(self): """ ¼ÆËãMAC """ obj = bccclt.new(common.MAINFUNC) v = { "sdate0":'20101028', "stime0":'112345', "lvol1":19680, "lvol6":9, "lvol7":100520, "sstock_code":'E1DA5FE2', "semp":'1001', "sserial0":'000000000001', "sstation1":'217F12A280000000' } ret = obj.callsvr(846313,v) self.failUnless(ret==0,obj.errmsg) x = obj.getrecord(['sstock_code2']) self.failUnless('C6097175'==x['sstock_code2'],'Mac¼ÆËã´íÎó')
def BankCardBind(self): """"ÒøÐп¨°ó¶¨""" obj = bccclt.new(6000) v = { "snote":'ÒøÐп¨°ó¶¨', "sstatus0":'A', "lvol1":4800, "lwithdraw_flag":127, "semp":'1000', "spager":'spager', "sbank_code":'02', "scard0":"9558803602115542797", "sbranch_code0":'2' } ret = obj.callsvr(841602,v) print ret self.failUnless(ret==0,"%s , ret=%d " % (obj.errmsg,ret)) #self.assertEqual(ret,0,obj.errmsg) x = obj.getrecord(["lvol8","damt0","damt1","damt2","lvol5"])
def testPOSLogin(self): """ 测试充值签到功能 """ obj = bccclt.new(common.MAINFUNC) v = { 'sphone3':'0181100706', 'sstation0':'000000000015', 'lvol0':12, 'stx_pwd':'666666', } ret = obj.callsvr(950070,v,1000) self.failUnless(ret==0,obj.errmsg) self.failUnless(obj.recordcnt==1,'no record') x = obj.getrecord(['lcert_code','sphone3','lvol0','lwithdraw_flag','semp_no','sname','lvol1', 'lvol2','lvol3','lvol4','sdate3','stime3','sholder_ac_no','lvol5']) print x msg = '后台返回[%d]' % x['lcert_code'] self.failUnless(x['lcert_code']==0,msg) dpsPOSTest.opercode=x['semp_no'] dpsPOSTest.batchno=x['lvol1'] dpsPOSTest.authcode=x['lvol2']
def PasswdUpdate(self): """ÐÞ¸ÄÃÜÂë""" obj = bccclt.new(5000) v = { "lcert_code":210001, "lvol0":3797, "lvol1":24, "lvol2":0, "damt0":100.0, "damt1":1, "sclose_emp":'930001', "scust_no":'1000', 'lvol3':1, 'lvol4':125, 'sname':'', 'sphone':'13564319628' } ret = obj.callsvr(900077,v) self.failUnless(ret==0,obj.errmsg) x = obj.getrecord(["lvol8","damt0","damt1","damt2","lvol5"])
def testDeposit(self): """¹ñÃæ³äÖµ""" obj = bccclt.new(common.MAINFUNC) v = { "lwithdraw_flag":127, "semp":common.OPERCODE, "lvol5":common.TERMID, "semp":"3000", "stime2":"235959", "sdate1":"20090101", "sdate2":"20501010", "lvol0":59, "sstation0":"261E6466", "lvol6":4, "lvol7":12400, "lvol9":1, "damt0":amount, } ret = obj.callsvr(846312,v) self.failUnless(ret==0,obj.errmsg)
def testDebitForLoad(self): """ ²âÊÔȦ´æÈ·ÈÏ """ obj = bccclt.new(common.MAINFUNC) v = { "scust_limit":testBUBank.dynkey, "lcert_code":testBUBank.batchno, "lwithdraw_flag":testBUBank.svrid, "scust_auth2":testBUBank.randomnum, "lvol1":testBUBank.dpscnt, "lvol0":testBUBank.befbal, "scust_limit2":"20110505000001", "sname":"", "sphone":testBUBank.refno, "sbank_acc":"6225881204373798", "sholder_ac_no2":testBUBank.mac1 } ret = obj.callsvr(50003,v,5000) self.failUnless(ret==0,obj.errmsg) x = obj.getrecord(['sphone','scust_auth2']) print x