Beispiel #1
0
 def parseCustomerInfo(customerInfostr, certPath=SDKConfig().signCertPath, certPwd=SDKConfig().signCertPwd):
     '''
     解析customerInfo。
     为方便处理,encryptedInfo下面的信息也均转换为customerInfo子域一样方式处理,
     '''
     customerInfostr = base64.b64decode(customerInfostr)
     customerInfostr = customerInfostr[1:len(customerInfostr) - 1]
     customerInfo = SDKUtil.parseQString(customerInfostr)
     if 'encryptedInfo' in customerInfo:
         encryptedInfoStr = customerInfo.pop("encryptedInfo")
         encryptedInfoStr = AcpService.decryptData(encryptedInfoStr, certPath, certPwd)
         encryptedInfo = SDKUtil.parseQString(encryptedInfoStr)
         for k, v in encryptedInfo.items():
             customerInfo[k] = v
     return customerInfo
Beispiel #2
0
 def test_parseQString(self):
     respString = ('accessType=0&bizType=000000&certId=68759585097&'
                   'encoding=utf-8&merId=777290058110097&orderId=20'
                   '160417104527&respCode=34&respMsg=查无此交易[26000'
                   '00]&signMethod=01&txnSubType=00&txnTime=20160417'
                   '104527&txnType=00&version=5.0.0')
     parse_dict = SDKUtil.parseQString(respString)
     check_dict = {
         'accessType': '0',
         'bizType': '000000',
         'certId': '68759585097',
         'encoding': 'utf-8',
         'merId': '777290058110097',
         'orderId': '20160417104527',
         'respCode': '34',
         'respMsg': '查无此交易[2600000]',
         'signMethod': '01',
         'txnSubType': '00',
         'txnTime': '20160417104527',
         'txnType': '00',
         'version': '5.0.0',
     }
     self.assertDictEqual(parse_dict, check_dict)
Beispiel #3
0
 def post(params, url):
     content = SDKUtil.createLinkString(params, False, True)
     respString = SDKUtil.post(url, content)
     resp = SDKUtil.parseQString(respString)
     return resp