Ejemplo n.º 1
0
 def test_BatchTransfer_notifyCheck_107010101011(self):
     """
             作者:刘佳琪
             需求版本号:不详(历史版本号:无)
             用例编号:
                 107010101011
             用例名称:
             	申请普通到账模式,不输省、市、开户支行信息
             用例描述:
                 无
     """
     self.BatchTransfer_notifyCheck_sample.input_parameter['payType'] = '2'
     self.BatchTransfer_notifyCheck_sample.input_parameter[
         'inAccountType'] = '0'
     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)
     """步骤一:生成加密批量文件"""
     self.BatchTransfer_notifyCheck_sample.batchpay_details_to_bank = [
         [
             '1', '个人银行账户', 'tester01', '0.04', '6217000010031195525',
             'ccb', '', '', '', '建行个人'
         ],
         [
             '2', '个人银行账户', 'tester01', '0.05', '6217000010031195525',
             'ccb', '', '', '', '建行个人'
         ]
     ]
     self.BatchTransfer_notifyCheck_sample.batchfile_context = batchfile_to_bank_template(
         datetime.datetime.strftime(datetime.datetime.now(), '%Y%m%d'),
         self.BatchTransfer_notifyCheck_sample.
         input_parameter['batchTransferNo'],
         self.BatchTransfer_notifyCheck_sample.batchpay_details_to_bank)[2]
     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())
     """断言1:同步响应断言"""
     self.assertEqual(
         '110180001',
         self.BatchTransfer_notifyCheck_sample.output_parameter['result'],
         msg=self.BatchTransfer_notifyCheck_sample.io_parameter)
Ejemplo n.º 2
0
    def test_BatchTransfer_notifyCheck_107010101001(self):
        """
        作者:刘佳琪
        需求版本号:不详(历史版本号:无)
        用例编号:
            107010101001
        用例名称:
        	付款至丰付企业账户(csv)-实时
        用例描述:
            无
        """
        commonUtils.encryptDesFromStrTofile(
            self.BatchTransfer_notifyCheck_sample.batchfile_des_key,
            self.BatchTransfer_notifyCheck_sample.batchfile_context,
            self.BatchTransfer_notifyCheck_sample.batchfile_name)
        with open(self.BatchTransfer_notifyCheck_sample.batchfile_name,
                  'rb') as fp:
            self.ftp_client.storbinary(
                'STOR ' + self.BatchTransfer_notifyCheck_sample.batchfile_name,
                fp)

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

        #响应签名断言
        self.assertEqual(respsonseSignatrue,
                         self.BatchTransfer_notifyCheck_sample.
                         output_parameter['signature'],
                         msg='响应签名验签失败')
        self.assertEqual(
            '00000',
            self.BatchTransfer_notifyCheck_sample.output_parameter['result'],
            msg=self.BatchTransfer_notifyCheck_sample.io_parameter)
Ejemplo n.º 3
0
 def test_BatchTransfer_queryBatchTransferState_107030101001(self):
     """
         作者:刘佳琪
         需求版本号:无(历史版本号:)
         用例编号:
             107030101001
         用例名称:
     	    批次状态查询
         用例描述:
             无
     """
     self.subTest(self.test_BatchTransfer_notifyCheck_107010101003())
     self.BatchTransfer_queryBatchTransferState_sample.input_parameter['batchTransferNo'] = \
         self.global_batchTransferNo
     self.BatchTransfer_queryBatchTransferState_sample.input_parameter[
         'signature'] = commonUtils.md5Signature(
             self.BatchTransfer_queryBatchTransferState_sample.
             input_parameter,
             self.BatchTransfer_queryBatchTransferState_sample.key,
             self.BatchTransfer_queryBatchTransferState_sample.
             request_signatrue_rule)
     respsonse_jsonstr = requests.post(
         url=self.BatchTransfer_queryBatchTransferState_sample.action_url,
         data=commonUtils.encodeDictionaryToGBK(
             self.BatchTransfer_queryBatchTransferState_sample.
             input_parameter),
         verify=False)
     self.BatchTransfer_queryBatchTransferState_sample.output_parameter.update(
         respsonse_jsonstr.json())
     respsonseSignatrue = commonUtils.md5Signature(
         self.BatchTransfer_queryBatchTransferState_sample.output_parameter,
         self.BatchTransfer_queryBatchTransferState_sample.key, self.
         BatchTransfer_queryBatchTransferState_sample.sync_signatrue_rule)
     self.assertEqual(respsonseSignatrue,
                      self.BatchTransfer_queryBatchTransferState_sample.
                      output_parameter['signature'],
                      msg='响应签名验签失败')
     self.assertEqual(
         '00000',
         self.BatchTransfer_queryBatchTransferState_sample.
         output_parameter['result'],
         msg=self.BatchTransfer_queryBatchTransferState_sample.io_parameter)
     self.assertEqual(
         '0',
         self.BatchTransfer_queryBatchTransferState_sample.
         output_parameter['status'],
         msg=self.BatchTransfer_queryBatchTransferState_sample.io_parameter)
Ejemplo n.º 4
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)
Ejemplo n.º 5
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)
Ejemplo n.º 6
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)