예제 #1
0
def sqlAll(sql):
    # sql='select id from merchant where merchant_code = \'CSSH\''
    # connector = cx_Oracle.connect('tvpay2/[email protected]/sumapay')
    connector = cx_Oracle.connect(
        const._global_configuration().OracleConnectUri)
    curs = connector.cursor()
    curs.execute(sql)
    rows = curs.fetchall()
    # print(row[0])
    curs.close()
    connector.close()
    return rows
예제 #2
0
def getEncodePassword(strTransferKey, strDate):
    jvmPath = jpype.getDefaultJVMPath()
    jarPath = os.path.join(
        os.path.abspath('.'),
        const._global_configuration().invokeJarPath)  #第二个参数是jar包的路径
    jarDependency = os.path.join(
        os.path.abspath('.'),
        const._global_configuration().invokeJarDependencyPath)
    # jpype.startJVM(jvmPath, "-ea", "-Djava.class.path=%s;%s"%(jarPath, jarDependency))#启动jvm
    jvmStatus = jpype.isJVMStarted()
    if not jvmStatus:
        jpype.startJVM(jvmPath, "-ea", "-Djava.class.path=%s" % jarPath,
                       "-Djava.ext.dirs=%s" % jarDependency)
    # jpype.java.lang.System.out.println("Hello World")
    javaClass = jpype.JClass('tools.Utils')
    # javaInstance = javaClass()#创建类的实例,可以调用类里边的方法
    # encodeStr = javaInstance.getCipher(strTransferKey, strDate)
    encodeStr = javaClass.getCipher(strTransferKey, strDate)
    # jpype.shutdownJVM()#最后关闭jvm
    return encodeStr


# print(getEncodePassword('41227312490261166168189947899258', 'xjd12345'))
예제 #3
0
def transferConfirm(merchantTransferRequestId, cookie):
    sqlId = 'select id from merchant_transfer_request where request_id = \'%s\'' % merchantTransferRequestId#.decode()
    indexId = OracleQuery.sqlOne(sqlId)[0]
    transferRiskAuditActionList = ['/Admin/withdrawManage/merchantWithdrawManageAction_query',
                                   '/Admin/withdrawManage/merchantWithdrawManageAction_mgfinanceConfirm?requestIds=%s|0' % (
                                       indexId)]
    getTokenParam = {'requestDateStart': '2999/03/12'}
    getTokenResponseHtmlStr = requests.post(
        const._global_configuration().OptionManagerHttpUrl + transferRiskAuditActionList[0],
        cookies=cookie, data=getTokenParam)
    selector = etree.HTML(getTokenResponseHtmlStr.text)
    try:
        strToken = (selector.xpath('//input[@name=\"token\"]/@value'))[0].strip()
    except IndexError:
        strToken = 'none'
    hideFormParam = {'struts.token.name': 'token',
                     'token': strToken}
    allFormParam = hideFormParam.copy()
    # allFormParam.update(inputFormParam)
    responseByPostForm = requests.post(
        const._global_configuration().OptionManagerHttpUrl + transferRiskAuditActionList[1],
        cookies=cookie,
        data=allFormParam)
    responseHtmlStr = responseByPostForm.text
예제 #4
0
def login(strUserName, strPassword):
    loginActionList = ['/Admin/queryUserNameAction_srandNum?time=1540957646874',
                       '/Admin/j_spring_security_check']
    getSrandNumResponse = requests.get(const._global_configuration().OptionManagerHttpUrl + loginActionList[0])
    responseCookies = getSrandNumResponse.cookies
    strSandNum = re.findall(r"%7B%27mcryptKey%27%3A%27(.+?)%27%7D",getSrandNumResponse.text)
    strEncodePassword = invokeJar.getEncodePassword(strSandNum[0], strPassword)

    securityCheckFormPara = {'phone':'',
                             'randomValidateId':'',
                             'sendFlag':'',
                             'userNameOld': strUserName,
                             'password': strEncodePassword,
                             'passwordtype': '1',
                             'j_username': strUserName,
                             'validate':'',
                             'message':''}
    responseByPostForm = requests.post(const._global_configuration().OptionManagerHttpUrl + loginActionList[1],
                                       cookies = responseCookies,
                                       data = securityCheckFormPara)

    responseCookies.update(responseByPostForm.cookies)
    responseCookies.set('tvpay_login_name', strUserName)
    return responseCookies
예제 #5
0
def sendMerchantSMS(usrDictionary):
    sendMerchantSMSParam = {'operatorName': usrDictionary.get('userName'),
                        'merchantNo': usrDictionary.get('merchantCode'),
                        'mobilePhoneFlag': '1'}
    responseByPostForm = requests.post(const._global_configuration().merchantHttpUrl + 'Login_sendPhoneMessage',
                                       data = sendMerchantSMSParam,
                                       verify = False)
    dict = json.loads(responseByPostForm.text)
    if dict.get('dataMap').get('result') == 0:
        randomValidateId = dict.get('dataMap').get('randomValidateId')
        sql = "select t.random_code from sms_request t where t.random_id = '%s'"%randomValidateId
        randomCode = OracleQuery.sqlOne(sql)
        return (True, randomValidateId, commonUtils.decryptDes(randomCode[0]))
    else:
        return (False, responseByPostForm.text)
예제 #6
0
def login(usrDictionary, smsTuple):
    loginParam = {'randomValidateId': smsTuple[1],
                  'sendFlag': '1',
                  'mobilePhoneFlag': '1',
                  'supportedPwdCtrl': '0',
                  'operatorName': usrDictionary.get('userName'),
                  'merchantNo': usrDictionary.get('merchantCode'),
                  'password': usrDictionary.get('password'),
                  'phoneRandomCode': smsTuple[2]}
    responseByPostForm = requests.post(const._global_configuration().merchantHttpUrl + 'Login_init',
                                       data=loginParam, verify=False)
    if responseByPostForm.text.find('商户自助 - -账户信息'):
        print(usrDictionary.get('userName') + '登录成功')
        return (True, responseByPostForm.cookies)
    else:
        print(usrDictionary.get('userName') + '登录失败')
        return (False, responseByPostForm.text)
예제 #7
0
    def test001(self):
        """
        手工审核付款成功-正例-冒烟
        """
        #发送请求
        self.inputParameter['requestId'] = commonUtils.requestId()
        self.inputParameter['transferPayType'] = '0'
        self.inputParameter['signature'] = commonUtils.md5Signature(
            self.inputParameter, self.key, self.requestSignatrueRule)
        s = requests.post(url=self.actionUrl,
                          data=commonUtils.encodeDictionaryToGBK(
                              self.inputParameter),
                          verify=False)
        self.outputParameter.update(s.json())
        respsonseSignatrue = commonUtils.md5Signature(self.outputParameter,
                                                      self.key,
                                                      self.syncSignatrueRule)
        #响应签名断言
        self.assertEqual(respsonseSignatrue,
                         self.outputParameter['signature'],
                         msg='响应签名验签失败')
        #同步响应断言
        self.assertEqual('00000',
                         self.outputParameter['result'],
                         msg=self.IOParameter)
        #数据库断言
        sqlStatus = 'select status from merchant_transfer_request where request_id = \'%s\' order by id desc' % self.inputParameter.get(
            'requestId').decode()
        requestStatus = str(OracleQuery.sqlAll(sqlStatus)[0][0])
        self.assertEqual('0', requestStatus)
        self.ass

        returnTuple = login(
            const._global_configuration().optionManagerOperator)
        commonUtils.waiting(15)
        #风控通过
        transferRiskAudit(self.inputParameter.get('requestId'), returnTuple[1])
        requestStatus = str(OracleQuery.sqlAll(sqlStatus)[0][0])
        self.assertEqual('6', requestStatus)

        #财务通过
        transferConfirm(self.inputParameter.get('requestId'), returnTuple[1])
        requestStatus = str(OracleQuery.sqlAll(sqlStatus)[0][0])
        self.assertEqual('9', requestStatus)
예제 #8
0
def merchant_info_mgmodify(inputFormParam, cookie, merchant_code):
    merchant_info_list = select_table(
        'merchant',
        list_view = [
            'ID',
            'MERCHANT_NAME',
            'MERCHANT_CODE',
            'LEGAL_PERSON',
            'CONTACT_PERSON',
            'CONTACT_TELEPHONE',
            'ZIP_CODE',
            'BUSINESS_LICENSE',
            'SIGN_TYPE',
            'SIGN_KEY',
            'FLD7',
            'FLD8',
            'FLD9',
            'FLD10',
            'FLD13',
            'FLD16'
        ],
        where_condition = "merchant_code = '%s'" %merchant_code
    )
    merchant_info_default = {
        'id': str(merchant_info_list[0][0]),
        'oldfld9': '0',
        'oldisd': '',
        'selectBizs': '',
        'flag': '1',
        'name': str(merchant_info_list[0][1]),
        'code': str(merchant_info_list[0][2]),
        'address': '',
        'owner': commonUtils.decryptDes(str(merchant_info_list[0][3])),
        'manager': commonUtils.decryptDes(str(merchant_info_list[0][4])),
        'telphone': commonUtils.decryptDes(str(merchant_info_list[0][5])),
        'addressCode': str(merchant_info_list[0][6]),
        'permitId': str(merchant_info_list[0][7]),
        'signType': str(merchant_info_list[0][8]),
        'merKey': str(merchant_info_list[0][9]),
        'fld7': str(merchant_info_list[0][10]),
        'fld8': str(merchant_info_list[0][11]),
        'serviceTelphone': '',
        'fld9': str(merchant_info_list[0][12]),
        'isSameCard': '0',
        'fld10': str(merchant_info_list[0][13]),
        'fld13': str(merchant_info_list[0][14]),
        'fld16': str(merchant_info_list[0][15])  # 0手工审核 1实时自动
    }
    merchant_info_default.update(inputFormParam)
    mgmodifyActionList = ['/Admin/merchantManage/merchantManageAction_mgtoUpdate',
                          '/Admin/merchantManage/merchantManageAction_mgmodify']
    getTokenParam = '?id=' + merchant_info_default.get('id')
    getTokenResponseHtmlStr = requests.get(
        const._global_configuration().OptionManagerHttpUrl + mgmodifyActionList[0] + getTokenParam,
        cookies=cookie)
    selector = etree.HTML(getTokenResponseHtmlStr.text)
    try:
        strToken = (selector.xpath('//input[@name=\"token\"]/@value'))[0].strip()
    except IndexError:
        strToken = 'none'
    hideFormParam = {'struts.token.name': 'token',
                 'token': strToken}
    allFormParam = hideFormParam.copy()
    allFormParam.update(merchant_info_default)
    responseByPostForm = requests.post(const._global_configuration().OptionManagerHttpUrl + mgmodifyActionList[1],
                                       cookies=cookie,
                                       data = allFormParam)
    return responseByPostForm.text
예제 #9
0
 def test_BatchTransfer_notifyCheck_107010101048_4(self):
     """
             作者:刘佳琪
             需求版本号:不详(历史版本号:无)
             用例编号:
                 107010101048
             用例名称:
             	批量付款至银行账户,付款类型可以选择0或1'
             用例描述:
                 商户为实时付款商户,批量付款至银行账户,付款类型输入0-手工审核
     """
     """修改商户为手工审核商户"""
     merchant_id = select_table('merchant',
                                list_view=['ID'],
                                where_condition="merchant_code = '%s'" %
                                self.BatchTransfer_notifyCheck_sample.
                                input_parameter['merchantCode'])[0][0]
     """操作员登录"""
     self.cookies_operator = authentication.login(
         const._global_configuration().optionManagerOperator)[1]
     merchant_info_default['id'] = str(merchant_id)
     merchant_info_default['fld16'] = '1'
     merchantManage.merchant_info_mgmodify(self.input_dic,
                                           self.cookies_operator)
     fld16 = select_table('merchant',
                          list_view=['fld16'],
                          where_condition="merchant_code = '%s'" %
                          self.BatchTransfer_notifyCheck_sample.
                          input_parameter['merchantCode'])[0][0]
     if str(fld16) != '1':
         raise RuntimeError('修改审核类型失败')
     self.BatchTransfer_notifyCheck_sample.input_parameter['payType'] = '2'
     self.BatchTransfer_notifyCheck_sample.input_parameter[
         'transferPayType'] = '1'
     self.BatchTransfer_notifyCheck_sample.input_parameter[
         'signature'] = commonUtils.md5Signature(
             self.BatchTransfer_notifyCheck_sample.input_parameter,
             self.BatchTransfer_notifyCheck_sample.key,
             self.BatchTransfer_notifyCheck_sample.request_signatrue_rule)
     """步骤一:生成加密批量文件"""
     commonUtils.encryptDesFromStrTofile(
         self.BatchTransfer_notifyCheck_sample.batchfile_des_key,
         self.BatchTransfer_notifyCheck_sample.batchfile_context,
         self.BatchTransfer_notifyCheck_sample.batchfile_name)
     """步骤二:上传加密批量文件到ftp"""
     with open(self.BatchTransfer_notifyCheck_sample.batchfile_name,
               'rb') as fp:
         self.ftp_client.storbinary(
             'STOR ' + self.BatchTransfer_notifyCheck_sample.batchfile_name,
             fp)
     """步骤三:批量付款请求"""
     respsonse_jsonstr = requests.post(
         url=self.BatchTransfer_notifyCheck_sample.action_url,
         data=commonUtils.encodeDictionaryToGBK(
             self.BatchTransfer_notifyCheck_sample.input_parameter),
         verify=False)
     self.BatchTransfer_notifyCheck_sample.output_parameter.update(
         respsonse_jsonstr.json())
     self.assertEqual(
         '110180000',
         self.BatchTransfer_notifyCheck_sample.output_parameter['result'],
         msg=self.BatchTransfer_notifyCheck_sample.io_parameter)
예제 #10
0
 def test_BatchTransfer_notifyCheck_107010101004(self):
     """
     作者:刘佳琪
     需求版本号:不详(历史版本号:无)
     用例编号:
         107010101003
     用例名称:
     	付款至银行账户csv(快速)-预付
     用例描述:
         无
     """
     """前提条件:设置快速付款费率为预付"""
     merchant_id = select_table('merchant',
                                list_view=['ID'],
                                where_condition="merchant_code = '%s'" %
                                self.BatchTransfer_notifyCheck_sample.
                                input_parameter['merchantCode'])[0][0]
     merchant_fee = select_table(
         'merchant_fee',
         list_view=['FEE_RATE', 'MIN_FEE', 'CHARGE_TYPE'],
         where_condition="merchant_id = '%s' and type = '12'" %
         str(merchant_id))
     if str(merchant_fee[0][0]) != '1' or str(
             merchant_fee[0][1]) != '0.01' or str(
                 merchant_fee[0][2]) != '1':
         """操作员登录"""
         self.cookies_operator = authentication.login(
             const._global_configuration().optionManagerOperator)[1]
         set_disburse_fee = {
             'type':
             '12',  # 4付款至企业账户、5普通付款至个人银行、6普通付款至企业银行、12快速付款至个人银行、13快速付款至企业银行
             'chargeType': '1',  # 丰付手续费收取类型,0为实时,1为预付,2为垫付,3为后付
             'feeRate': '1',
             'minFee': '0.01',
         }
         """修改费率"""
         mgmodifyDisburseFee(
             set_disburse_fee, self.cookies_operator,
             self.BatchTransfer_notifyCheck_sample.
             input_parameter['merchantCode'])
         modify_disburse_fee_count = select_table(
             'MERCHANT_FEE_REQUEST',
             list_view=['count(*)'],
             where_condition=
             "merchant_id = '%s' and type = '12' and status = '0' and charge_type = '1'"
             % str(merchant_id))[0][0]
         if str(modify_disburse_fee_count) != '1':
             raise RuntimeError('付款待审核记录数不为1')
         self.cookies_auditor = authentication.login(
             const._global_configuration().optionManagerAuditor)[1]
         modify_disburse_fee_id = select_table(
             'MERCHANT_FEE_REQUEST',
             list_view=['ID'],
             where_condition=
             "merchant_id = '%s' and type = '12' and status = '0' and charge_type = '1'"
             % str(merchant_id))[0][0]
         merchantFeeAuditAction_auditConfirm(str(modify_disburse_fee_id),
                                             self.cookies_auditor)
         charge_type = select_table(
             'merchant_fee',
             list_view=['CHARGE_TYPE'],
             where_condition="merchant_id = '%s' and type = '12'" %
             str(merchant_id))[0][0]
         if str(charge_type) != '1':
             raise RuntimeError('修改费率为实时类型失败')
     """步骤一:设置入参,快速-预付手续费付款到银行账户"""
     self.BatchTransfer_notifyCheck_sample.input_parameter['payType'] = '2'
     self.BatchTransfer_notifyCheck_sample.input_parameter[
         'inAccountType'] = '1'
     self.BatchTransfer_notifyCheck_sample.input_parameter[
         'transferPayType'] = '1'
     self.BatchTransfer_notifyCheck_sample.input_parameter[
         'signature'] = commonUtils.md5Signature(
             self.BatchTransfer_notifyCheck_sample.input_parameter,
             self.BatchTransfer_notifyCheck_sample.key,
             self.BatchTransfer_notifyCheck_sample.request_signatrue_rule)
     """步骤二:生成加密批量文件"""
     commonUtils.encryptDesFromStrTofile(
         self.BatchTransfer_notifyCheck_sample.batchfile_des_key,
         self.BatchTransfer_notifyCheck_sample.batchfile_context,
         self.BatchTransfer_notifyCheck_sample.batchfile_name)
     """步骤三:上传加密批量文件到ftp"""
     with open(self.BatchTransfer_notifyCheck_sample.batchfile_name,
               'rb') as fp:
         self.ftp_client.storbinary(
             'STOR ' + self.BatchTransfer_notifyCheck_sample.batchfile_name,
             fp)
     """步骤四:批量付款请求"""
     respsonse_jsonstr = requests.post(
         url=self.BatchTransfer_notifyCheck_sample.action_url,
         data=commonUtils.encodeDictionaryToGBK(
             self.BatchTransfer_notifyCheck_sample.input_parameter),
         verify=False)
     self.BatchTransfer_notifyCheck_sample.output_parameter.update(
         respsonse_jsonstr.json())
     """生成响应签名数据"""
     respsonseSignatrue = commonUtils.md5Signature(
         self.BatchTransfer_notifyCheck_sample.output_parameter,
         self.BatchTransfer_notifyCheck_sample.key,
         self.BatchTransfer_notifyCheck_sample.sync_signatrue_rule)
     """断言1:同步响应断言"""
     self.assertEqual(respsonseSignatrue,
                      self.BatchTransfer_notifyCheck_sample.
                      output_parameter['signature'],
                      msg='响应签名验签失败')
     self.assertEqual(
         '110180000',
         self.BatchTransfer_notifyCheck_sample.output_parameter['result'],
         msg=self.BatchTransfer_notifyCheck_sample.io_parameter)
     self.assertEqual(
         self.BatchTransfer_notifyCheck_sample.
         input_parameter['merchantCode'].decode(),
         self.BatchTransfer_notifyCheck_sample.
         output_parameter['merchantCode'],
         msg=self.BatchTransfer_notifyCheck_sample.io_parameter)
     self.assertEqual(
         self.BatchTransfer_notifyCheck_sample.
         input_parameter['batchTransferNo'].decode(),
         self.BatchTransfer_notifyCheck_sample.
         output_parameter['batchTransferNo'],
         msg=self.BatchTransfer_notifyCheck_sample.io_parameter)
     """断言2:数据库断言"""
     """查询数据库batchpay_record表数据"""
     batchpay_record_list = select_table(
         'batchpay_record',
         list_view=[
             'STATUS',  # 0初始、1待复核、2待付款、3已接收、4审核拒绝、5付款失败、 6待财务确认、7财务拒绝、8付款处理中、9处理完成、10、11事务分离中间态、12待父商户复核、13父商户复核拒绝
             'TOTAL_COUNT',  # 付款明细总笔数
             'TOTAL_SUM',  # 总金额(不含手续费)
             'VALID_COUNT',  # 有效付款明细笔数
             'VALID_SUM',  # 有效付款总额(不含手续费)
             'VALID_FEE',  # 有效手续费
             'SECCEED_COUNT',  # 付款成功的交易笔数
             'SECCEED_SUM',  # 付款成功金额(不含手续费)
             'SECCEED_FEE',  # 付款成功手续费
             'FLD1',  # 结算周期
             'FLD3',  # 快捷同卡批次标识,0为非快捷同卡,1为快捷同卡
             'ACCOUNTING_TYPE',  # 到账类型0普通1快速
             'TRANSFER_TYPE',  # 付款类型0混合付款,1付款至丰付账户,2付款至银行账户
             'OPERATOR_AUDITING_SIGN',  # 运营审核标识(0手工审核,1自动实时)
         ],
         where_condition="batchpay_no = '%s'" %
         self.BatchTransfer_notifyCheck_sample.
         input_parameter['batchTransferNo'].decode())
     self.assertEqual(
         '0',
         str(batchpay_record_list[0][0]).strip(),
         msg=self.BatchTransfer_notifyCheck_sample.io_parameter)
     self.assertEqual(
         '2',
         str(batchpay_record_list[0][1]).strip(),
         msg=self.BatchTransfer_notifyCheck_sample.io_parameter)
     self.assertEqual(
         '.09',
         str(batchpay_record_list[0][2]).strip(),
         msg=self.BatchTransfer_notifyCheck_sample.io_parameter)
     self.assertEqual(
         '2',
         str(batchpay_record_list[0][3]).strip(),
         msg=self.BatchTransfer_notifyCheck_sample.io_parameter)
     self.assertEqual(
         '0.09',
         str(batchpay_record_list[0][4]).strip(),
         msg=self.BatchTransfer_notifyCheck_sample.io_parameter)
     self.assertEqual(
         '.02',
         str(batchpay_record_list[0][5]).strip(),
         msg=self.BatchTransfer_notifyCheck_sample.io_parameter)
     self.assertEqual(
         '0',
         str(batchpay_record_list[0][6]).strip(),
         msg=self.BatchTransfer_notifyCheck_sample.io_parameter)
     self.assertEqual(
         '0.0',
         str(batchpay_record_list[0][7]).strip(),
         msg=self.BatchTransfer_notifyCheck_sample.io_parameter)
     self.assertEqual(
         '0.0',
         str(batchpay_record_list[0][8]).strip(),
         msg=self.BatchTransfer_notifyCheck_sample.io_parameter)
     self.assertEqual(
         '0.0',
         str(batchpay_record_list[0][8]).strip(),
         msg=self.BatchTransfer_notifyCheck_sample.io_parameter)
     self.assertEqual(
         '0',
         str(batchpay_record_list[0][9]).strip(),
         msg=self.BatchTransfer_notifyCheck_sample.io_parameter)
     self.assertEqual(
         '0',
         str(batchpay_record_list[0][10]).strip(),
         msg=self.BatchTransfer_notifyCheck_sample.io_parameter)
     self.assertEqual(
         '1',
         str(batchpay_record_list[0][11]).strip(),
         msg=self.BatchTransfer_notifyCheck_sample.io_parameter)
     self.assertEqual(
         '2',
         str(batchpay_record_list[0][12]).strip(),
         msg=self.BatchTransfer_notifyCheck_sample.io_parameter)
     self.assertEqual(
         '1',
         str(batchpay_record_list[0][13]).strip(),
         msg=self.BatchTransfer_notifyCheck_sample.io_parameter)
     """查询数据库batchpay_record表数据"""
     batchpay_detail_list = select_table(
         'batchpay_detail',
         list_view=[
             'FUND',  # 金额
             'ACCOUNT_TYPE',  # 账户类型(2对公银行账户,1对私银行账户,0对公丰付账户)
             'BANK_CODE',  # 银行代码
             'BANK_NAME',  # 收款方开户银行
             'BANK_ACCOUNT',  # 银行账号
             'BANK_ACCOUNT_NAME',  # 开户姓名
             'STATUS',  # -1校验失败、0退票、1失败、2成功、3初始、4审核拒绝、5财务拒绝、6已请求、7事务分离中间态
             'ACCOUNTING_TYPE',  # 到账类型,0为普通,1为快速
             'PAY_FUND',  # 已付金额,供校验用
         ],
         where_condition="batchpay_no = '%s' and detail_no = '1'" %
         self.BatchTransfer_notifyCheck_sample.
         input_parameter['batchTransferNo'].decode())
     self.assertEqual(
         '0.04',
         str(batchpay_detail_list[0][0]).strip(),
         msg=self.BatchTransfer_notifyCheck_sample.io_parameter)
     self.assertEqual(
         '1',
         str(batchpay_detail_list[0][1]).strip(),
         msg=self.BatchTransfer_notifyCheck_sample.io_parameter)
     self.assertEqual(
         'ccb',
         str(batchpay_detail_list[0][2]).strip(),
         msg=self.BatchTransfer_notifyCheck_sample.io_parameter)
     self.assertEqual(
         '中国建设银行',
         str(batchpay_detail_list[0][3].strip()),
         msg=self.BatchTransfer_notifyCheck_sample.io_parameter)
     self.assertEqual(
         '6217000010031195525',
         commonUtils.decryptDes(batchpay_detail_list[0][4].strip()),
         msg=self.BatchTransfer_notifyCheck_sample.io_parameter)
     self.assertEqual(
         'tester01',
         commonUtils.decryptDes(batchpay_detail_list[0][5].strip()),
         msg=self.BatchTransfer_notifyCheck_sample.io_parameter)
     self.assertEqual(
         '3',
         str(batchpay_detail_list[0][6]).strip(),
         msg=self.BatchTransfer_notifyCheck_sample.io_parameter)
     self.assertEqual(
         '1',
         str(batchpay_detail_list[0][7]).strip(),
         msg=self.BatchTransfer_notifyCheck_sample.io_parameter)
     self.assertEqual(
         '0.04',
         str(batchpay_detail_list[0][8]).strip(),
         msg=self.BatchTransfer_notifyCheck_sample.io_parameter)
예제 #11
0
def mgmodifyDisburseFee(inputFormParam, cookie, merchant_code):
    disburse_fee_list = select_table(
        'merchant_fee',
        list_view=[
            'METHOD', 'MERCHANT_ID', 'TYPE', 'FIX_FEE', 'FEE_RATE', 'MIN_FEE',
            'MAX_FEE', 'LIMIT_FIX_RATE_FUND', 'LOWER_LIMIT', 'UPPER_LIMIT',
            'LIMIT_LAYER', 'LIMIT_FUND', 'CHARGE_TYPE'
        ],
        where_condition=
        "merchant_code = '%s' and type = '%s' order by limit_layer" %
        (merchant_code, inputFormParam['type']))
    merchant_transfer_config_default = select_table(
        'merchant_transfer_config',
        list_view=[
            'IS_NEED_REVIEW', 'IS_NEED_SUB_REVIEW', 'MER_SINGLE_DAY_LIMIT',
            'MER_SINGLE_DAY_COUNT_LIMIT', 'MER_SINGLE_MONTH_LIMIT',
            'MER_SINGLE_YEAR_LIMIT'
        ],
        where_condition="merchant_code = '%s'" % merchant_code)
    merchant_transfer_fee_default = {
        'step':
        '1',
        'oldMethod':
        str(disburse_fee_list[0][0]),
        'merchantId':
        str(disburse_fee_list[0][1]),
        'type':
        str(disburse_fee_list[0]
            [2]),  # 4付款至企业账户、5普通付款至个人银行、6普通付款至企业银行、12快速付款至个人银行、13快速付款至企业银行
        'chargeType':
        str(disburse_fee_list[0][12]),  # 丰付手续费收取类型,0为实时,1为预付,2为垫付,3为后付
        'meth':
        str(disburse_fee_list[0][0]),
        'fixFee':
        '',
        'feeRate':
        str('{:g}'.format(disburse_fee_list[0][4]))
        if disburse_fee_list[0][4] != None else '',
        'minFee':
        str('{:g}'.format(disburse_fee_list[0][5]))
        if disburse_fee_list[0][5] != None else '',
        'maxFee':
        str('{:g}'.format(disburse_fee_list[0][6]))
        if disburse_fee_list[0][6] != None else '',
        'limitFixRateFund':
        str('{:g}'.format(disburse_fee_list[0][7]))
        if disburse_fee_list[0][7] != None else '',
        'fixFee1':
        '',
        'limit1':
        '',
        'fixFee2':
        '',
        'limit2':
        '',
        'fixFee3':
        '',
        'limit3':
        '',
        'fixFee4':
        '',
        'limit4':
        '',
        'fixFee5':
        '',
        'limit5':
        '',
        'limitFund':
        str('{:g}'.format(disburse_fee_list[0][11]))
        if disburse_fee_list[0][11] != None else '',
        'fld12':
        str(merchant_transfer_config_default[0][0])
        if merchant_transfer_config_default[0][0] != None else '',
        'isNeedChildReview':
        str(merchant_transfer_config_default[0][1])
        if merchant_transfer_config_default[0][1] != None else '',
        'merSingleDayLimit':
        str('{:g}'.format(merchant_transfer_config_default[0][2]))
        if merchant_transfer_config_default[0][2] != None else '',
        'merSingleDayCountLimit':
        str('{:g}'.format(merchant_transfer_config_default[0][3]))
        if merchant_transfer_config_default[0][3] != None else '',
        'merSingleMonthLimit':
        str('{:g}'.format(merchant_transfer_config_default[0][4]))
        if merchant_transfer_config_default[0][4] != None else '',
        'merSingleYearLimit':
        str('{:g}'.format(merchant_transfer_config_default[0][5]))
        if merchant_transfer_config_default[0][5] != None else ''
    }

    if str(disburse_fee_list[0][0]) == '2':
        merchant_fix_rate_fee = {
            'step':
            '2',
            'fixFee':
            str('{:g}'.format(disburse_fee_list[0][3]))
            if disburse_fee_list[0][3] != None else '',
            'feeRate': (str('{:g}'.format(disburse_fee_list[1][4]))
                        if disburse_fee_list[1][4] != None else '')
            if len(disburse_fee_list) == 2 else '',
        }
        merchant_transfer_fee_default.update(merchant_fix_rate_fee)
    elif str(disburse_fee_list[0][0]) == '3':
        merchant_step_fee = {
            'step':
            str(len(disburse_fee_list)),
            'fixFee1':
            str('{:g}'.format(disburse_fee_list[0][3]))
            if disburse_fee_list[0][3] != None else '',
            'limit1':
            str('{:g}'.format(disburse_fee_list[0][9]))
            if disburse_fee_list[0][9] != None else '',
            'fixFee2': (str('{:g}'.format(disburse_fee_list[1][3]))
                        if disburse_fee_list[1][3] != None else '')
            if len(disburse_fee_list) > 1 else '',
            'limit2': (str('{:g}'.format(disburse_fee_list[1][9]))
                       if disburse_fee_list[1][9] != None else '')
            if len(disburse_fee_list) > 1 else '',
            'fixFee3': (str('{:g}'.format(disburse_fee_list[2][3]))
                        if disburse_fee_list[2][3] != None else '')
            if len(disburse_fee_list) > 2 else '',
            'limit3': (str('{:g}'.format(disburse_fee_list[2][9]))
                       if disburse_fee_list[2][9] != None else '')
            if len(disburse_fee_list) > 2 else '',
            'fixFee4': (str('{:g}'.format(disburse_fee_list[3][3]))
                        if disburse_fee_list[3][3] != None else '')
            if len(disburse_fee_list) > 3 else '',
            'limit4': (str('{:g}'.format(disburse_fee_list[3][9]))
                       if disburse_fee_list[3][9] != None else '')
            if len(disburse_fee_list) > 3 else '',
            'fixFee5': (str('{:g}'.format(disburse_fee_list[4][3]))
                        if disburse_fee_list[4][3] != None else '')
            if len(disburse_fee_list) > 4 else '',
            'limit5':
            ''
        }
        merchant_transfer_fee_default.update(merchant_step_fee)

    merchant_transfer_fee_default.update(inputFormParam)
    # print(merchant_transfer_fee_default)
    mgmodifyActionList = [
        '/Admin/withdrawManage/merchantTransferConfigManageAction_mgtoUpdateBatchpay',
        '/Admin/withdrawManage/merchantTransferConfigManageAction_mgmodifyBatchpay'
    ]
    getTokenParam = '?merchantId=' + merchant_transfer_fee_default.get(
        'merchantId') + '&type=' + merchant_transfer_fee_default.get(
            'type') + '&meth=' + merchant_transfer_fee_default.get('oldMethod')
    getTokenResponseHtmlStr = requests.get(
        const._global_configuration().OptionManagerHttpUrl +
        mgmodifyActionList[0] + getTokenParam,
        cookies=cookie)
    selector = etree.HTML(getTokenResponseHtmlStr.text)
    try:
        strToken = (
            selector.xpath('//input[@name=\"token\"]/@value'))[0].strip()
    except IndexError:
        strToken = 'none'
    hideFormParam = {'struts.token.name': 'token', 'token': strToken}
    allFormParam = hideFormParam.copy()
    allFormParam.update(merchant_transfer_fee_default)
    responseByPostForm = requests.post(
        const._global_configuration().OptionManagerHttpUrl +
        mgmodifyActionList[1],
        cookies=cookie,
        data=allFormParam)
    responseHtmlStr = responseByPostForm.text