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)
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
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)