def test004(self): """ 财务通过 """ self.subTest(self.test002()) self.subTest(self.test003()) sqlStatus = 'select status from merchant_transfer_request where request_id = \'%s\' order by id desc' % self.globalRequestId cookies = login('xjd1', 'xjd12345') transferConfirm(self.globalRequestId, cookies) requestStatus = str(OracleQuery.sqlAll(sqlStatus)[0][0]) self.assertEqual('9', requestStatus)
def test003(self): """ 风控通过 """ self.subTest(self.test002()) sqlStatus = 'select status from merchant_transfer_request where request_id = \'%s\' order by id desc' % self.globalRequestId cookies = login('xjd1', 'xjd12345') commonUtils.waiting(15) #风控通过 transferRiskAudit(self.globalRequestId, cookies) requestStatus = str(OracleQuery.sqlAll(sqlStatus)[0][0]) self.assertEqual('6', requestStatus)
def test001(): modifyDisburseFeeParameter = { 'step': '2', 'oldMethod': '2', 'merchantId': '46170', 'type': '5', 'chargeType': '0', 'meth': '2', 'fixFee': '0.02', # 'feeRate': '33', 'minFee': '0.01', 'maxFee': '6', 'limitFixRateFund': '500', #额度 (仅在“固定值+费率”的类型下有效!) 'fixFee1': '', 'limit1': '', 'fixFee2': '', 'limit2': '', 'fixFee3': '', 'limit3': '', 'fixFee4': '', 'limit4': '', 'fixFee5': '', 'limit5': '', 'limitFund': '45', #单笔限额 'fld12': '0', #是否手工复核 'isNeedChildReview': '0', 'merSingleDayLimit': '', 'merSingleDayCountLimit': '', 'merSingleMonthLimit': '', 'merSingleYearLimit': '' } cookie = authentication.login('xjd', 'xjd12345') merchantFeeRequestId = str( DisburseManager.mgmodifyDisburseFee(modifyDisburseFeeParameter, cookie)[0][0]) print(merchantFeeRequestId) cookie1 = authentication.login('xjd1', 'xjd12345') status = feeAudit.merchantFeeAuditAction_auditConfirm( merchantFeeRequestId, cookie1) print(status)
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)
def test002(): cookie = authentication.login('xjd1', 'xjd12345') print(DisburseManager.transferRiskAudit('auto20190312105720051473', cookie)) print(DisburseManager.transferConfirm('auto20190312105720051473', cookie))
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)
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)