def test_121_capital_flow(self):
		"""资金流水推送"""
		data = excel_table_byname(self.file, 'cash_push')
		param = json.loads(data[0]['param'])
		success_amount = GetSqlData.get_repayment_amount(
			project_id=self.r.get("jk_cwshd_18_periods_projectId"),
			environment=self.env,
			period=1
		)
		param.update(
			{
				"serviceSn": Common.get_random("serviceSn"),
				"projectId": self.r.get("jk_cwshd_18_periods_projectId"),
				"sourceProjectId": self.r.get("jk_cwshd_18_periods_sourceProjectId"),
				"repaymentPlanId": Common.get_random("sourceProjectId"),
				"successAmount": success_amount,
				"sourceRepaymentId": Common.get_random("sourceProjectId"),
				"tradeTime": Common.get_time(),
				"finishTime": Common.get_time()
			}
		)
		if len(data[0]['headers']) == 0:
			headers = None
		else:
			headers = json.loads(data[0]['headers'])
		rep = Common.response(
			faceaddr=data[0]['url'],
			headers=headers,
			data=json.dumps(param, ensure_ascii=False),
			environment=self.env,
			product="cloudloan"
		)
		self.assertEqual(rep['resultCode'], int(data[0]['resultCode']))
 def test_117_capital_flow(self, r, env, red):
     """资金流水推送"""
     data = excel_table_byname(self.file, 'cash_push')
     param = json.loads(data[0]['param'])
     success_amount = GetSqlData.get_repayment_amount(project_id=r.get(
         red["project_id"]),
                                                      environment=env,
                                                      period=1)
     param.update({
         "serviceSn": Common.get_random("serviceSn"),
         "projectId": r.get(red["project_id"]),
         "sourceProjectId": r.get(red["source_project_id"]),
         "repaymentPlanId": Common.get_random("sourceProjectId"),
         "successAmount": success_amount,
         "productCode": "FQ_JK_JFQYLV2",
         "sourceRepaymentId": Common.get_random("sourceProjectId"),
         "tradeTime": Common.get_time(),
         "finishTime": Common.get_time()
     })
     if len(data[0]['headers']) == 0:
         headers = None
     else:
         headers = json.loads(data[0]['headers'])
     rep = Common.response(faceaddr=data[0]['url'],
                           headers=headers,
                           data=json.dumps(param, ensure_ascii=False),
                           environment=env,
                           product="cloudloan")
     assert rep['resultCode'] == int(data[0]['resultCode'])
예제 #3
0
    def test_116_repayment(self):
        """还款流水推送:提前全部结清"""
        data = excel_table_byname(self.file, 'repayment')
        param = json.loads(data[0]['param'])
        for per in range(1, 7):
            success_amount = GetSqlData.get_repayment_amount(
                project_id=self.r.get("jfx_6_periods_projectId"),
                environment=self.env,
                period=per)
            param.update({
                "projectId":
                self.r.get('jfx_6_periods_projectId'),
                "transactionId":
                self.r.get('jfx_6_periods_transactionId'),
                "sourceProjectId":
                self.r.get('jfx_6_periods_sourceProjectId'),
                "sourcePlanId":
                Common.get_random('sourceProjectId'),
                "sourceRepaymentId":
                Common.get_random("transactionId"),
                "planPayDate":
                Common.get_repaydate(6)[per - 1],
                "payTime":
                Common.get_time('-'),
                "successAmount":
                float(success_amount),
                "period":
                per
            })
            for i in range(len(param['repaymentDetailList'])):
                pay_detail = GetSqlData.get_repayment_plan_date(
                    project_id=self.r.get('jfx_6_periods_projectId'),
                    environment=self.env,
                    repayment_plan_type=param['repaymentDetailList'][i]
                    ['planCategory'],
                    period=per)
                param['repaymentDetailList'][i].update({
                    "sourceRepaymentDetailId":
                    Common.get_random("serviceSn"),
                    "payAmount":
                    float(pay_detail.get("cur_amount"))
                })
            if len(data[0]['headers']) == 0:
                headers = None
            else:
                headers = json.loads(data[0]['headers'])
            rep = Common.response(faceaddr=data[0]['url'],
                                  headers=headers,
                                  data=json.dumps(param, ensure_ascii=False),
                                  environment=self.env,
                                  product="cloudloan")

            self.assertEqual(rep['resultCode'], int(data[0]['resultCode']))
            Assert.check_repayment(True, self.env,
                                   self.r.get('jfx_6_periods_projectId'),
                                   param)
 def test_3_repayment_one_period(self):
     """随意借还款一期"""
     time.sleep(5)
     data = excel_table_byname(self.file, 'repayment')
     print("接口名称:%s" % data[0]['casename'])
     param = json.loads(data[0]['param'])
     success_amount = GetSqlData.get_repayment_amount(
         environment=self.env,
         project_id=self.r.get("syj_repayment_advance_projectId"),
         period=param['repaymentDetailList'][0]['period'])
     param['repayment'].update({
         "projectId":
         self.r.get("syj_repayment_advance_projectId"),
         "sourceRepaymentId":
         Common.get_random("sourceProjectId"),
         "payTime":
         Common.get_time("-"),
         "sourceCreateTime":
         Common.get_time("-"),
         "successAmount":
         success_amount
     })
     plan_type = {"Principal": "1", "Interest": "2"}
     for i in param['repaymentDetailList']:
         plan_pay_type = plan_type.get(i['repaymentPlanType'])
         repayment_detail = GetSqlData.get_repayment_plan_date(
             project_id=self.r.get("syj_repayment_advance_projectId"),
             environment=self.env,
             repayment_plan_type=plan_pay_type,
             period=i['period'])
         i.update({
             "sourceRepaymentDetailId":
             Common.get_random("serviceSn"),
             "sourceCreateTime":
             Common.get_time("-"),
             "planPayDate":
             str(repayment_detail.get('plan_pay_date')),
             "thisPayAmount":
             float(repayment_detail.get('rest_amount')),
             "payTime":
             Common.get_time("-")
         })
     for y in param['repaymentPlanList']:
         plan_pay_type_plan = plan_type.get(y['repaymentPlanType'])
         repayment_detail_plan = GetSqlData.get_repayment_plan_date(
             project_id=self.r.get("syj_repayment_advance_projectId"),
             environment=self.env,
             repayment_plan_type=plan_pay_type_plan,
             period=y['period'])
         y.update({
             "sourcePlanId":
             repayment_detail_plan.get('source_plan_id'),
             "planPayDate":
             Common.get_time("-"),
             "curAmount":
             float(repayment_detail_plan.get("rest_amount")),
             "payAmount":
             float(repayment_detail_plan.get("rest_amount")),
             "payTime":
             Common.get_time("-")
         })
     if len(data[0]['headers']) == 0:
         headers = None
     else:
         headers = json.loads(data[0]['headers'])
     rep = Common.response(faceaddr=data[0]['url'],
                           headers=headers,
                           data=json.dumps(param, ensure_ascii=False),
                           environment=self.env,
                           product="pintic")
     print("响应信息:%s" % rep)
     print("返回json:%s" % rep.text)
     logger.info("返回信息:%s" % rep.text)
     self.assertEqual(
         json.loads(rep.text)['resultCode'], data[0]['msgCode'])
     self.assertEqual(json.loads(rep.text)['content']['message'], "交易成功")
예제 #5
0
 def test_3_repayment_one_period(self, env, r):
     """拿去花全部结清"""
     time.sleep(3)
     data = excel_table_byname(self.file, 'repayment')
     print("接口名称:%s" % data[0]['casename'])
     param = json.loads(data[0]['param'])
     for per in range(1, 7):
         plan_type = {"Principal": "1", "Interest": "2"}
         repayment = GetSqlData.get_repayment_plan_date(
             project_id=r.get("nqh_repayment_normal_settle_projectId"),
             environment=env,
             repayment_plan_type="1",
             period=per)
         success_amount = GetSqlData.get_repayment_amount(
             environment=env,
             project_id=r.get("nqh_repayment_normal_settle_projectId"),
             period=per)
         param['repayment'].update({
             "projectId":
             r.get("nqh_repayment_normal_settle_projectId"),
             "sourceRepaymentId":
             Common.get_random("sourceProjectId"),
             "payTime":
             Common.get_time("-"),
             "sourceCreateTime":
             str(repayment.get('plan_pay_date')),
             "successAmount":
             success_amount
         })
         for i in param['repaymentDetailList']:
             plan_pay_type = plan_type.get(i['repaymentPlanType'])
             repayment_detail = GetSqlData.get_repayment_plan_date(
                 project_id=r.get("nqh_repayment_normal_settle_projectId"),
                 environment=env,
                 repayment_plan_type=plan_pay_type,
                 period=per)
             i.update({
                 "sourceRepaymentDetailId":
                 Common.get_random("serviceSn"),
                 "sourceCreateTime":
                 str(repayment_detail.get('plan_pay_date')),
                 "period":
                 per,
                 "planPayDate":
                 str(repayment_detail.get('plan_pay_date')),
                 "thisPayAmount":
                 float(repayment_detail.get('rest_amount')),
                 "payTime":
                 Common.get_time("-")
             })
         for y in param['repaymentPlanList']:
             plan_pay_type_plan = plan_type.get(y['repaymentPlanType'])
             if y['assetPlanOwner'] == 'foundPartner':
                 repayment_detail_plan = GetSqlData.get_repayment_plan_date(
                     project_id=r.get(
                         "nqh_repayment_normal_settle_projectId"),
                     environment=env,
                     repayment_plan_type=plan_pay_type_plan,
                     period=per)
                 y.update({
                     "sourcePlanId":
                     repayment_detail_plan.get('source_plan_id'),
                     "planPayDate":
                     str(repayment_detail_plan.get('plan_pay_date')),
                     "curAmount":
                     float(repayment_detail_plan.get("rest_amount")),
                     "payAmount":
                     float(repayment_detail_plan.get("rest_amount")),
                     "payTime":
                     Common.get_time("-"),
                     "period":
                     per
                 })
             else:
                 repayment_detail_plan = GetSqlData.get_user_repayment_detail(
                     project_id=r.get(
                         "nqh_repayment_normal_settle_projectId"),
                     environment=env,
                     period=per,
                     repayment_plan_type=plan_pay_type_plan)
                 y.update({
                     "sourcePlanId":
                     repayment_detail_plan.get('source_plan_id'),
                     "planPayDate":
                     str(repayment_detail_plan.get('plan_pay_date')),
                     "curAmount":
                     float(repayment_detail_plan.get("rest_amount")),
                     "payAmount":
                     float(repayment_detail_plan.get("rest_amount")),
                     "payTime":
                     Common.get_time("-"),
                     "period":
                     per
                 })
         if len(data[0]['headers']) == 0:
             headers = None
         else:
             headers = json.loads(data[0]['headers'])
         rep = Common.response(faceaddr=data[0]['url'],
                               headers=headers,
                               data=json.dumps(param, ensure_ascii=False),
                               environment=env,
                               product="pintic")
         assert rep['resultCode'] == data[0]['msgCode']
         assert rep['content']['message'] == "交易成功"
         assert rep['resultCode'] == int(data[0]['msgCode'])
 def test_3_repayment_normal_settle(self):
     """借去花全部结清"""
     time.sleep(5)
     data = excel_table_byname(self.file, 'repayment')
     print("接口名称:%s" % data[0]['casename'])
     param = json.loads(data[0]['param'])
     for per in range(1, 7):
         amount = GetSqlData.get_repayment_amount(
             environment=self.env,
             project_id=self.r.get("jqh_repayment_normal_settle_projectId"),
             period=per)
         param['repayment'].update({
             "projectId":
             self.r.get("jqh_repayment_normal_settle_projectId"),
             "sourceRepaymentId":
             Common.get_random("sourceProjectId"),
             "payTime":
             Common.get_time("-"),
             "sourceCreateTime":
             Common.get_time("-"),
             "successAmount":
             amount
         })
         plan_type = {"Principal": "1", "Interest": "2"}
         for i in range(0, len(param['repaymentDetailList'])):
             plan_pay_type = plan_type[param['repaymentDetailList'][i]
                                       ['repaymentPlanType']]
             plan_catecory = param['repaymentDetailList'][i]['planCategory']
             asset_plan_owner = param['repaymentDetailList'][i][
                 'assetPlanOwner']
             if asset_plan_owner == "foundPartner":
                 if plan_catecory == 1 or plan_catecory == 2:
                     repayment_detail = GetSqlData.get_repayment_plan_date(
                         project_id=self.r.get(
                             "jqh_repayment_normal_settle_projectId"),
                         environment=self.env,
                         repayment_plan_type=plan_pay_type,
                         period=param['repaymentDetailList'][i]['period'])
                     param['repaymentDetailList'][i].update({
                         "sourceRepaymentDetailId":
                         Common.get_random("serviceSn"),
                         "sourceCreateTime":
                         Common.get_time("-"),
                         "planPayDate":
                         str(repayment_detail.get('plan_pay_date')),
                         "thisPayAmount":
                         float(repayment_detail.get('rest_amount')),
                         "payTime":
                         Common.get_time("-")
                     })
                 else:
                     param['repaymentDetailList'][i].update({
                         "sourceRepaymentDetailId":
                         Common.get_random("serviceSn"),
                         "sourceCreateTime":
                         Common.get_time("-"),
                         "planPayDate":
                         Common.get_repaydate("6")[0].split(" ")[0],
                         "payTime":
                         Common.get_time("-")
                     })
             elif asset_plan_owner == "financePartner":
                 user_repayment_detail = GetSqlData.get_user_repayment_detail(
                     project_id=self.r.get(
                         "jqh_repayment_normal_settle_projectId"),
                     environment=self.env,
                     period=param['repaymentDetailList'][i]['period'],
                     repayment_plan_type=plan_pay_type)
                 param['repaymentDetailList'][i].update({
                     "sourceRepaymentDetailId":
                     Common.get_random("serviceSn"),
                     "sourceCreateTime":
                     Common.get_time("-"),
                     "planPayDate":
                     str(user_repayment_detail.get('plan_pay_date')),
                     "thisPayAmount":
                     float(user_repayment_detail.get('rest_amount')),
                     "payTime":
                     Common.get_time("-")
                 })
             else:
                 pass
         for i in range(0, len(param['repaymentPlanList'])):
             plan_list_pay_type = plan_type[param['repaymentPlanList'][i]
                                            ['repaymentPlanType']]
             plan_list_asset_plan_owner = param['repaymentPlanList'][i][
                 'assetPlanOwner']
             if plan_list_asset_plan_owner == 'financePartner':
                 plan_list_detail = GetSqlData.get_user_repayment_detail(
                     project_id=self.r.get(
                         "jqh_repayment_normal_settle_projectId"),
                     environment=self.env,
                     period=param['repaymentPlanList'][i]['period'],
                     repayment_plan_type=plan_list_pay_type)
                 param['repaymentPlanList'][i].update({
                     "sourcePlanId":
                     plan_list_detail.get('source_plan_id'),
                     "planPayDate":
                     Common.get_time("-"),
                     "curAmount":
                     float(plan_list_detail.get("rest_amount")),
                     "payAmount":
                     float(plan_list_detail.get("rest_amount")),
                     "payTime":
                     Common.get_time("-")
                 })
             elif plan_list_asset_plan_owner == 'foundPartner':
                 plan_list_detail = GetSqlData.get_repayment_plan_date(
                     project_id=self.r.get(
                         "jqh_repayment_normal_settle_projectId"),
                     environment=self.env,
                     repayment_plan_type=plan_list_pay_type,
                     period=param['repaymentPlanList'][i]['period'])
                 param['repaymentPlanList'][i].update({
                     "sourcePlanId":
                     plan_list_detail.get('source_plan_id'),
                     "planPayDate":
                     Common.get_time("-"),
                     "curAmount":
                     float(plan_list_detail.get("rest_amount")),
                     "payAmount":
                     float(plan_list_detail.get("rest_amount")),
                     "payTime":
                     Common.get_time("-")
                 })
         if len(data[0]['headers']) == 0:
             headers = None
         else:
             headers = json.loads(data[0]['headers'])
         rep = Common.response(faceaddr=data[0]['url'],
                               headers=headers,
                               data=json.dumps(param, ensure_ascii=False),
                               environment=self.env,
                               product="pintic")
         self.assertEqual(rep['resultCode'], data[0]['msgCode'])
         self.assertEqual(rep['content']['message'], "交易成功")
         self.assertEqual(rep['resultCode'], int(data[0]['msgCode']))
예제 #7
0
    def test_4_repayment_after_return(self, env, r):
        """退货更新还款计划"""
        time.sleep(5)
        data = excel_table_byname(self.file, 'repayment')
        print("接口名称:%s" % data[0]['casename'])
        param = json.loads(data[0]['param'])
        plan_type = {"Principal": "1", "Interest": "2"}
        repayment = GetSqlData.get_repayment_plan_date(
            project_id=r.get("nqh_one_period_same_day_return_projectId"),
            environment=env,
            repayment_plan_type="1",
            period=1)

        success_amount = GetSqlData.get_repayment_amount(
            project_id=r.get("nqh_one_period_same_day_return_projectId"),
            environment=env,
            period=1)
        param['repayment'].update({
            "projectId":
            r.get("nqh_one_period_same_day_return_projectId"),
            "sourceRepaymentId":
            Common.get_random("sourceProjectId"),
            "payTime":
            str(repayment.get('plan_pay_date')),
            "sourceCreateTime":
            str(repayment.get('plan_pay_date')),
            "successAmount":
            success_amount
        })
        for i in param['repaymentDetailList']:
            plan_pay_type = plan_type.get(i['repaymentPlanType'])
            repayment_detail = GetSqlData.get_repayment_plan_date(
                project_id=r.get("nqh_one_period_same_day_return_projectId"),
                environment=env,
                repayment_plan_type=plan_pay_type,
                period=1)
            i.update({
                "sourceRepaymentDetailId": Common.get_random("serviceSn"),
                "sourceCreateTime": Common.get_time("-"),
                "planPayDate": str(repayment_detail.get('plan_pay_date')),
                "thisPayAmount": float(repayment_detail.get('cur_amount')),
                "payTime": Common.get_time("-")
            })

        for y in param['repaymentPlanList']:
            plan_pay_type_plan = plan_type.get(y['repaymentPlanType'])
            repayment_detail_plan = GetSqlData.get_repayment_plan_date(
                project_id=r.get("nqh_one_period_same_day_return_projectId"),
                environment=env,
                repayment_plan_type=plan_pay_type_plan,
                period=y['period'])
            y.update({
                "sourcePlanId":
                repayment_detail_plan.get('source_plan_id'),
                "curAmount":
                float(repayment_detail_plan.get('origin_amount')),
                "payAmount":
                float(repayment_detail_plan.get('origin_amount')),
                "payTime":
                Common.get_time('-')
            })
        if len(data[0]['headers']) == 0:
            headers = None
        else:
            headers = json.loads(data[0]['headers'])
        rep = Common.response(faceaddr=data[0]['url'],
                              headers=headers,
                              data=json.dumps(param, ensure_ascii=False),
                              environment=env,
                              product="pintic")
        assert rep['resultCode'] == data[0]['msgCode']
        assert rep['content']['message'] == "交易成功"
예제 #8
0
    def test_4_repayment_after_return(self):
        """退货更新还款计划"""
        time.sleep(5)
        data = excel_table_byname(self.file, 'repayment')
        print("接口名称:%s" % data[0]['casename'])
        param = json.loads(data[0]['param'])
        for per in range(1, 7):
            plan_type = {"Principal": "1", "Interest": "2"}
            repayment = GetSqlData.get_repayment_plan_date(
                project_id=self.r.get("nqh_periods_same_day_return_projectId"),
                environment=self.env,
                repayment_plan_type="1",
                period=per)
            success_amount = GetSqlData.get_repayment_amount(
                project_id=self.r.get("nqh_periods_same_day_return_projectId"),
                environment=self.env,
                period=per)
            param['repayment'].update({
                "projectId":
                self.r.get("nqh_periods_same_day_return_projectId"),
                "sourceRepaymentId":
                Common.get_random("sourceProjectId"),
                "payTime":
                str(repayment.get('plan_pay_date')),
                "sourceCreateTime":
                str(repayment.get('plan_pay_date')),
                "successAmount":
                success_amount
            })
            for i in range(len(param['repaymentDetailList'])):
                plan_pay_type = plan_type.get(
                    param['repaymentDetailList'][i]['repaymentPlanType'])
                repayment_detail = GetSqlData.get_repayment_plan_date(
                    project_id=self.r.get(
                        "nqh_periods_same_day_return_projectId"),
                    environment=self.env,
                    repayment_plan_type=plan_pay_type,
                    period=per)
                param['repaymentDetailList'][i].update({
                    "sourceRepaymentDetailId":
                    Common.get_random("serviceSn"),
                    "sourceCreateTime":
                    str(repayment_detail.get('plan_pay_date')),
                    "period":
                    per,
                    "planPayDate":
                    str(repayment_detail.get('plan_pay_date')),
                    "thisPayAmount":
                    float(repayment_detail.get('rest_amount')),
                    "payTime":
                    Common.get_time("-")
                })
            for y in range(len(param['repaymentPlanList'])):
                plan_pay_type_plan = plan_type.get(
                    param['repaymentPlanList'][y]['repaymentPlanType'])
                repayment_detail_plan = GetSqlData.get_repayment_plan_date(
                    project_id=self.r.get(
                        "nqh_periods_same_day_return_projectId"),
                    environment=self.env,
                    repayment_plan_type=plan_pay_type_plan,
                    period=param['repaymentPlanList'][y]['period'])
                if plan_pay_type_plan == "1":
                    param['repaymentPlanList'][y].update({
                        "sourcePlanId":
                        repayment_detail_plan.get('source_plan_id'),
                        "curAmount":
                        "100.00"
                    })
                elif plan_pay_type_plan == "2":
                    param['repaymentPlanList'][y].update({
                        "sourcePlanId":
                        repayment_detail_plan.get('source_plan_id'),
                        "curAmount":
                        "10.00"
                    })
            if len(data[0]['headers']) == 0:
                headers = None
            else:
                headers = json.loads(data[0]['headers'])
            rep = Common.response(faceaddr=data[0]['url'],
                                  headers=headers,
                                  data=json.dumps(param, ensure_ascii=False),
                                  environment=self.env,
                                  product="pintic")

            self.assertEqual(
                json.loads(rep.text)['resultCode'], data[0]['msgCode'])
            self.assertEqual(
                json.loads(rep.text)['content']['message'], "交易成功")