Commit 4d04f7a1 authored by 龚小红's avatar 龚小红

重构支付接口用例,并注释邀请关系、优惠码相关的用例

parent 39894be6
......@@ -270,7 +270,7 @@ public class PersonCard implements Authorization {
params.put("product","金牌产品A");
Response response = network.postResponse(params, SELLERCARD_EDITDELLERCASE);
boolean success = response.jsonPath().getBoolean("success");
Assert.assertTrue(success,network.message(params, SELLERCARD_personalProfile,"接口返回失败状态",response.body().asString()));
Assert.assertTrue(success,network.message(params, SELLERCARD_EDITDELLERCASE,"接口返回失败状态",response.body().asString()));
//查看是否添加成功
params.clear();
......
......@@ -55,7 +55,7 @@ public class NoviceGuidance implements Authorization {
//关注公众号
userId = (long) subscribe();
//切换会员
updateTypeOrDate(userId);
updateTypeOrDate(userId,true);
}
@Test(description = "创建资料包", priority = 3)
......
......@@ -13,6 +13,7 @@ import java.util.Map;
import static com.kjj.config.BasicConfig.*;
import static com.kjj.config.BasicConfig.PAY_CALLOUT;
import static com.kjj.utils.BaseUtils.updateTypeOrDate;
public class Cashback implements Authorization {
......@@ -22,58 +23,73 @@ public class Cashback implements Authorization {
}
public String comboId;
@Test(description = "用户绑定分享关系",priority = 1)
public void 用户绑定分享关系() {
Map<String, Object> Params = new HashMap<String, Object>();
Params.put("fromStr",1);
Params.put("inviterSid",2991);
Params.put("accessSource",22);
Response response = network.getResponse(Params,PAY_distribute);
System.out.println(response.body().asString());
boolean data=response.jsonPath().getBoolean("data");
Assert.assertTrue(data,network.message(PAY_distribute,"用户绑定失败",response.body().asString()));
}
@Test (description = "用户支付后是否有180天打卡权限",priority = 2)
public void 用户支付后是否有180天打卡权限() {
Response response = network.getResponse(PAY_clockPayInfo);
System.out.println(response.body().asString());
boolean isClockPay=response.jsonPath().getBoolean("data.isClockPay");
Assert.assertFalse(isClockPay,network.message(PAY_clockPayInfo,"有180天打卡权限",response.body().asString()));
}
@Test (description = "返现用户付费_微信支付后回调",priority = 3)
public void 返现用户付费_微信支付后回调() {
//获取付费价格
Response actualPayMoneyResponse = network.getResponse(PAY_combo);
System.out.println(actualPayMoneyResponse.body().asString());
comboId=actualPayMoneyResponse.jsonPath().getString("data[0].id");
Assert.assertNotNull(comboId,network.message(PAY_combo,"套餐ID为null",actualPayMoneyResponse.body().asString()));
String actualPayMoney = actualPayMoneyResponse.jsonPath().getString("data[0].actualPayMoney");
Assert.assertEquals(actualPayMoney,"0.01",network.message(PAY_combo,"获取付费价格:价格不是365",actualPayMoneyResponse.body().asString()));
//创建支付
Map<String, Object> payParams = new HashMap<String, Object>();
payParams.put("userVersion", 2); // 1 通用版 2 保险版
payParams.put("comboId", comboId);
payParams.put("oaId", "1");
payParams.put("paySource", "2");
Response response = network.postResponse(payParams, PAY_create);
String tradeNo = response.jsonPath().getString("data.tradeNo");
// mock微信回调失败
Map<String, Object> callbackParams = new HashMap<String, Object>();
callbackParams.put("tradeNo", tradeNo);
callbackParams.put("payResult", true);
callbackParams.put("payTradeNo", "test");
response = network.getResponse(callbackParams, PAY_CALLOUT);
boolean result = response.jsonPath().getBoolean("data");
Assert.assertTrue(result, network.message(callbackParams, PAY_CALLOUT, "mock微信支付回调成功,但我们订单处理失败", response.body().asString()));
}
// @Test(description = "用户绑定分享关系",priority = 1)
// public void 用户绑定分享关系() {
// Map<String, Object> Params = new HashMap<String, Object>();
// Params.put("fromStr",1);
// Params.put("inviterSid",2991);
// Params.put("accessSource",22);
// Response response = network.getResponse(Params,PAY_distribute);
// System.out.println(response.body().asString());
// boolean data=response.jsonPath().getBoolean("data");
// Assert.assertTrue(data,network.message(PAY_distribute,"用户绑定失败",response.body().asString()));
//
// }
// @Test (description = "用户支付后是否有180天打卡权限",priority = 2)
// public void 用户支付后是否有180天打卡权限() {
// Response response = network.getResponse(PAY_clockPayInfo);
// System.out.println(response.body().asString());
// boolean isClockPay=response.jsonPath().getBoolean("data.isClockPay");
// Assert.assertFalse(isClockPay,network.message(PAY_clockPayInfo,"有180天打卡权限",response.body().asString()));
// }
//
// @Test (description = "默认付费_邀请付费页",priority = 3) //priority 方法执行优先级
// public void 默认付费_邀请付费页() {
// updateTypeOrDate(5495,false);
// //代理人续费状态
// Map<String, Object> payParams = new HashMap<String, Object>();
// payParams.put("entryDiscountType",3); //入口折扣类型,1-普通,3-邀请,4-优惠码
// Response response = network.getResponse(PAY_info);
// int discountType = response.jsonPath().getInt("data.discountType");
// int validity = response.jsonPath().getInt("data.validity");
// int preferentialPrice = response.jsonPath().getInt("data.preferentialPrice");
// Assert.assertEquals(discountType,3,network.message(PAY_info,"非邀请付费逻辑",response.body().asString()));
// Assert.assertEquals(validity,12,network.message(PAY_info,"增加会员时长非12个月",response.body().asString()));
// Assert.assertEquals(preferentialPrice,3,network.message(PAY_info,"邀请价格非0.03",response.body().asString()));
// }
// @Test (description = "返现用户付费_微信支付后回调",priority = 3)
// public void 返现用户付费_微信支付后回调() {
// //获取付费价格
// Response actualPayMoneyResponse = network.getResponse(PAY_combo);
// System.out.println(actualPayMoneyResponse.body().asString());
// comboId=actualPayMoneyResponse.jsonPath().getString("data[0].id");
// Assert.assertNotNull(comboId,network.message(PAY_combo,"套餐ID为null",actualPayMoneyResponse.body().asString()));
// String actualPayMoney = actualPayMoneyResponse.jsonPath().getString("data[0].actualPayMoney");
// Assert.assertEquals(actualPayMoney,"0.01",network.message(PAY_combo,"获取付费价格:价格不是365",actualPayMoneyResponse.body().asString()));
//
// //创建支付
// Map<String, Object> payParams = new HashMap<String, Object>();
// payParams.put("userVersion", 2); // 1 通用版 2 保险版
// payParams.put("comboId", comboId);
// payParams.put("oaId", "1");
// payParams.put("paySource", "2");
// Response response = network.postResponse(payParams, PAY_create);
// String tradeNo = response.jsonPath().getString("data.tradeNo");
//
// // mock微信回调失败
// Map<String, Object> callbackParams = new HashMap<String, Object>();
// callbackParams.put("tradeNo", tradeNo);
// callbackParams.put("payResult", true);
// callbackParams.put("payTradeNo", "test");
// response = network.getResponse(callbackParams, PAY_CALLOUT);
// boolean result = response.jsonPath().getBoolean("data");
// Assert.assertTrue(result, network.message(callbackParams, PAY_CALLOUT, "mock微信支付回调成功,但我们订单处理失败", response.body().asString()));
//
//
// }
@Test(description = "获取用户版本信息",priority = 4)
public void 获取用户版本信息() {
......
package com.kjj.cases.assistant.pay;
import static com.kjj.config.BasicConfig.*;
import static com.kjj.utils.BaseUtils.updateTypeOrDate;
import static com.kjj.utils.ThreadSleepUtils.sleep;
import com.kjj.cases.admin.Authorization;
import com.kjj.utils.BaseUtils;
......@@ -27,14 +29,23 @@ public class Pay implements Authorization {
public String comboId;
public long id;
public String promotionCode;
public String tradeNo;
@Test (description = "默认付费_付费页",priority = 1) //priority 方法执行优先级
public void 默认付费_付费页() {
//付款中间页判断
Response response = network.getResponse(PAY_getMiddleDetail);
int skipType = response.jsonPath().getInt("data.skipType");
Assert.assertEquals(skipType,2,network.message(PAY_getMiddleDetail,"付款中间页:不是2020新版",response.body().asString()));
@Test (description = "默认付费_续费页",priority = 1) //priority 方法执行优先级
public void 默认付费_续费页() {
//切换会员为非会员状态
updateTypeOrDate(5495,true);
//代理人续费状态
Map<String, Object> payParams = new HashMap<String, Object>();
payParams.put("entryDiscountType",3); //入口折扣类型,1-普通,3-邀请,4-优惠码
Response response = network.getResponse(PAY_info);
int discountType = response.jsonPath().getInt("data.discountType");
int validity = response.jsonPath().getInt("data.validity");
int preferentialPrice = response.jsonPath().getInt("data.preferentialPrice");
Assert.assertEquals(discountType,2,network.message(PAY_info,"非续费逻辑",response.body().asString()));
Assert.assertEquals(validity,12,network.message(PAY_info,"增加会员时长非12个月",response.body().asString()));
Assert.assertEquals(preferentialPrice,2,network.message(PAY_info,"续费价格非0.02",response.body().asString()));
//会员类型版本判断
Map<String, Object> params = new HashMap<String, Object>();
......@@ -42,66 +53,85 @@ public class Pay implements Authorization {
response = network.getResponse(params, version_info);
int userVersion = response.jsonPath().getInt("data.find {it.openType == 1}.userVersion"); // 找出开启状态的版本类型 1为通用版 2为保险版
Assert.assertEquals(userVersion,2,network.message(params, version_info,"会员类型版本判断:判断错误,此版本为通用版",response.body().asString()));
}
//获取当前用户可用优惠码
response= network.getResponse(params,PAY_getPromoCode);
String promoCode = response.jsonPath().getString("data");
Assert.assertNull(promoCode, network.message(params,PAY_getPromoCode,"是否优惠判断:判断错误,当前有优惠",response.body().asString()));
@Test (description = "获取开通会员跑马灯",priority = 2) //priority 方法执行优先级
public void 获取开通会员跑马灯() {
Response response = network.getResponse(PAY_list);
String nickname = response.jsonPath().getString("data.get(0).nickname");
String avatar = response.jsonPath().getString("data.get(0).nickname");
Assert.assertNotNull(nickname,network.message(PAY_list,"会员昵称为空",response.body().asString()));
Assert.assertNotNull(avatar,network.message(PAY_list,"会员头像为空",response.body().asString()));
}
//获取付费价格
Response actualPayMoneyResponse = network.getResponse(PAY_combo);
System.out.println(actualPayMoneyResponse.body().asString());
comboId=actualPayMoneyResponse.jsonPath().getString("data[0].id");
Assert.assertNotNull(comboId,network.message(PAY_combo,"套餐ID为null",actualPayMoneyResponse.body().asString()));
String actualPayMoney = actualPayMoneyResponse.jsonPath().getString("data[0].actualPayMoney");
Assert.assertEquals(actualPayMoney,"0.01",network.message(PAY_combo,"获取付费价格:价格不是365",actualPayMoneyResponse.body().asString()));
@Test (description = "默认付费_正常付费页",priority = 3) //priority 方法执行优先级
public void 默认付费_正常付费页() {
//切换会员为非会员状态
updateTypeOrDate(5495,false);
Map<String, Object> payParams = new HashMap<String, Object>();
payParams.put("entryDiscountType",1); //入口折扣类型,1-普通,3-邀请,4-优惠码
Response response = network.getResponse(PAY_info);
int discountType = response.jsonPath().getInt("data.discountType");
int validity = response.jsonPath().getInt("data.validity");
int preferentialPrice = response.jsonPath().getInt("data.preferentialPrice");
Assert.assertEquals(discountType,1,network.message(PAY_info,"非正常付费逻辑",response.body().asString()));
Assert.assertEquals(validity,12,network.message(PAY_info,"增加会员时长非12个月",response.body().asString()));
Assert.assertEquals(preferentialPrice,4,network.message(PAY_info,"正常价格非0.04",response.body().asString()));
}
@Test (description = "默认付费_待支付",priority = 2)
@Test (description = "默认付费_待支付",priority = 5)
public void 默认付费_待支付() {
//创建支付
Map<String, Object> payParams = new HashMap<String, Object>();
payParams.put("userVersion",1);
payParams.put("comboId",comboId);
payParams.put("oaId","1");
payParams.put("entryDiscountType",1);
payParams.put("discountType",1); //实际折扣类型,1-普通,2-续费,3-邀请,4-优惠码
payParams.put("paySource","2");
Response response = network.postResponse(payParams,PAY_create);
System.out.println(response.body().asString());
String appId = response.jsonPath().getString("data.appId");
Assert.assertEquals(appId,"wxcb8c36279dd7dff2",network.message(payParams, PAY_create,"拉起支付:拉起微信支付失败",response.body().asString())); //判断返回的微信调起参数中appId是否正确
tradeNo = response.jsonPath().getString("data.tradeNo");
Assert.assertNotNull(tradeNo,network.message(payParams, PAY_create,"拉起支付:拉起微信支付失败",response.body().asString())); //判断订单号是否为空
}
@Test (description = "默认付费_取消支付",priority = 3)
public void 默认付费_取消支付() {
//创建支付
Map<String, Object> payParams = new HashMap<String, Object>();
payParams.put("userVersion",1);
payParams.put("comboId",comboId);
payParams.put("oaId","1");
payParams.put("paySource","2");
Response response = network.postResponse(payParams,PAY_create);
String tradeNo = response.jsonPath().getString("data.tradeNo");
@Test (description = "默认付费_查询订单状态",priority = 6)
public void 默认付费_查询订单状态() {
Map<String, Object> cancelParams = new HashMap<String, Object>();
cancelParams.put("tradeNo",tradeNo);
Response response = network.getResponse(cancelParams,PAY_result);
int data = response.jsonPath().getInt("data");//1-待付款,2-付款中,3-付款成功,4-付款失败,5-取消支付,6-支付异常
Assert.assertEquals(data,2,network.message(cancelParams, PAY_result,"订单状态不为待付款",response.body().asString()));
}
//会员类型版本判断
@Test (description = "好友代付_弹窗信息",priority = 7)
public void 好友代付_弹窗信息() {
Map<String, Object> params = new HashMap<String, Object>();
params.put("entryDiscountType",1);
params.put("discountType",1);
params.put("paySource","2");
Response response = network.postResponse(params,PAY_popup);
String data = response.jsonPath().getString("data.qrCode");
Assert.assertNotNull(data,network.message(params, PAY_popup,"好友代付-付款码为空",response.body().asString()));
}
@Test (description = "默认付费_取消支付",priority = 8)
public void 默认付费_取消支付() {
Map<String, Object> cancelParams = new HashMap<String, Object>();
cancelParams.put("tradeNo",tradeNo);
response = network.getResponse(cancelParams,PAY_cancel);
Response response = network.postResponse(cancelParams,PAY_cancel);
String result = response.jsonPath().getString("desc");
Assert.assertEquals(result,"OK",network.message(cancelParams, PAY_cancel,"取消支付:取消支付失败",response.body().asString())); //判断返回的微信调起参数中appId是否正确
}
//取消付款后的订单查询
Map<String, Object> statusParams = new HashMap<String, Object>();
statusParams.put("tradeNo",tradeNo);
response = network.getResponse(statusParams,PAY_status);
System.out.println(response.body().asString());
@Test (description = "默认付费_取消后查询订单状态",priority = 9)
public void 默认付费_取消后查询订单状态() {
Map<String, Object> cancelParams = new HashMap<String, Object>();
cancelParams.put("tradeNo",tradeNo);
Response response = network.getResponse(cancelParams,PAY_result);
int data = response.jsonPath().getInt("data");
Assert.assertTrue(data==5,network.message(statusParams, PAY_status,"取消支付:订单状态不对",response.body().asString()));
Assert.assertEquals(data,5,network.message(cancelParams, PAY_result,"取消支付:取消支付失败",response.body().asString())); //判断返回的微信调起参数中appId是否正确
}
@Test (description = "默认付费_切换会员类型为保险版",priority = 4)
@Test (description = "默认付费_切换会员类型为保险版",priority = 10)
public void 默认付费_切换为保险版会员类型(){
//会员类型版本判断
Map<String, Object> params = new HashMap<String, Object>();
......@@ -130,126 +160,135 @@ public class Pay implements Authorization {
Assert.assertEquals(result,"OK",network.message(versionParams,PAY_exchange,"会员类型切换:切换失败",response.body().asString())); //判断返回的微信调起参数中appId是否正确
}
}
@Test (description = "用户是否满足续费条件",priority = 5)
public void 用户是否满足续费条件 () {
Response response = network.getResponse(PAY_isRenewCondition);
System.out.println(response.body().asString());
boolean data = response.jsonPath().getBoolean("data");
Assert.assertTrue(data,network.message(PAY_isRenewCondition,"用户不满足续费条件",response.body().asString()));
}
@Test (description = "创建优惠码",priority = 6)
public void 创建优惠码 () {
//优惠码类型列表
Response response=network.getResponse(MANAGER_typeList);
System.out.println(response.body().asString());
Object data=response.jsonPath().getJsonObject("data");
Assert.assertNotNull(data,network.message(MANAGER_typeList,"优惠码类型列表为null",response.body().asString()));
//创建优惠码
Map<String, Object> Params = new HashMap<String, Object>();
Params.put("comboId",1);
Params.put("codeTotal",10);
Params.put("startTime",System.currentTimeMillis());
Params.put("deadline",System.currentTimeMillis() + 1000*60*60*24*30L);
Params.put("price",365);
Params.put("promotionType",5);
Params.put("remark","优惠码"+ RandomUtils.nextInt(1, 100));
Params.put("userVersion",2);
Params.put("validityDuration",12);
response = network.postResponse(Params,MANAGER_batchCreateV2);
System.out.println( response.body().asString());
id=response.jsonPath().getLong("data.id");
Assert.assertNotNull(id,network.message(MANAGER_batchCreateV2,"优惠码批次ID未获取到",response.body().asString()));
//优惠码列表
Map<String, Object> codeListParam = new HashMap<String, Object>();
codeListParam.put("batchId",id);
codeListParam.put("promotionCodeStatus",0); //0 未使用
codeListParam.put("pageIndex",1);
codeListParam.put("pageSize",20);
response =network.getResponse(codeListParam,MANAGER_codeList);
promotionCode=response.jsonPath().getString("data.list[0].promotionCode");
}
@Test (description = "优惠券付费",priority = 7)
public void 优惠券付费 () {
Map<String, Object> payParams = new HashMap<String, Object>();
payParams.put("comboId",comboId);
payParams.put("promotionCode",promotionCode);
Response response = network.postResponse(payParams,PAY_create);
String tradeNo = response.jsonPath().getString("data.tradeNo");
// mock微信回调成功
Map<String, Object> callbackParams = new HashMap<String, Object>();
callbackParams.put("tradeNo",tradeNo);
callbackParams.put("payResult",true);
callbackParams.put("payTradeNo","test");
response= network.getResponse(callbackParams,PAY_CALLOUT);
boolean result = response.jsonPath().getBoolean("data");
response.body().prettyPrint();
Assert.assertTrue(result,network.message(callbackParams,PAY_CALLOUT,"mock微信支付回调成功,但我们订单处理失败",response.body().asString()));
}
@Test (description = "默认付费_微信支付后回调",priority = 8)
public void 默认付费_微信支付后回调() {
//创建支付
Map<String, Object> payParams = new HashMap<String, Object>();
payParams.put("userVersion",2); // 1 通用版 2 保险版
payParams.put("comboId",comboId);
payParams.put("oaId","1");
payParams.put("paySource","2");
Response response = network.postResponse(payParams,PAY_create);
String tradeNo = response.jsonPath().getString("data.tradeNo");
// mock微信回调失败
Map<String, Object> callbackParams = new HashMap<String, Object>();
callbackParams.put("tradeNo",tradeNo);
callbackParams.put("payTradeNo","test");
callbackParams.put("payResult",false);
response = network.getResponse(callbackParams,PAY_CALLOUT);
boolean result = response.jsonPath().getBoolean("data");
Assert.assertTrue(result,network.message(callbackParams,PAY_CALLOUT,"mock微信支付回调失败,但我们订单处理也失败",response.body().asString()));
// mock微信回调成功
response = network.postResponse(payParams,PAY_create);
tradeNo = response.jsonPath().getString("data.tradeNo");
callbackParams.put("tradeNo",tradeNo);
callbackParams.put("payResult",true);
response = network.getResponse(callbackParams,PAY_CALLOUT);
result = response.jsonPath().getBoolean("data");
Assert.assertTrue(result,network.message(callbackParams,PAY_CALLOUT,"mock微信支付回调成功,但我们订单处理失败",response.body().asString()));
//查询订单状态
Map<String, Object> statusParams = new HashMap<String, Object>();
statusParams.put("tradeNo",tradeNo);
response = network.getResponse(statusParams,PAY_status);
System.out.println(response.body().asString());
int data = response.jsonPath().getInt("data");
Assert.assertTrue(data==3,network.message(statusParams, PAY_status,"支付成功的订单状态不对",response.body().asString()));
// 检查会员开通结果
response = network.getResponse(USER_INFO);
boolean isVip = response.jsonPath().getBoolean("data.vipValid");
Assert.assertTrue(isVip,network.message(USER_INFO,"微信支付成功,但是接口返回还是非会员状态",response.body().asString()));
// 检查会员版本类型
response = network.getResponse(version_info);
int userVersion = response.jsonPath().getInt("data.find {it.openType == 1}.userVersion"); // 找出开启状态的版本类型 1为通用版 2为保险版
Assert.assertEquals(userVersion,2,network.message(version_info,"会员类型版本判断:判断错误,此版本为通用版",response.body().asString()));
// 重复提交
response = network.postResponse(payParams,PAY_create);
tradeNo = response.jsonPath().getString("data.tradeNo");
System.out.println(tradeNo);
}
//
// @Test (description = "创建优惠码",priority = 11)
// public void 创建优惠码 () {
//
// //优惠码类型列表
// Response response=network.getResponse(MANAGER_typeList);
// System.out.println(response.body().asString());
// Object data=response.jsonPath().getJsonObject("data");
// Assert.assertNotNull(data,network.message(MANAGER_typeList,"优惠码类型列表为null",response.body().asString()));
//
// //创建优惠码
// Map<String, Object> Params = new HashMap<String, Object>();
// Params.put("comboId",1);
// Params.put("codeTotal",10);
// Params.put("startTime",System.currentTimeMillis());
// Params.put("deadline",System.currentTimeMillis() + 1000*60*60*24*30L);
// Params.put("price",365);
// Params.put("promotionType",5);
// Params.put("remark","优惠码"+ RandomUtils.nextInt(1, 100));
// Params.put("userVersion",2);
// Params.put("validityDuration",12);
// response = network.postResponse(Params,MANAGER_batchCreateV2);
// System.out.println( response.body().asString());
// id=response.jsonPath().getLong("data.id");
// Assert.assertNotNull(id,network.message(MANAGER_batchCreateV2,"优惠码批次ID未获取到",response.body().asString()));
//
// //优惠码列表
// Map<String, Object> codeListParam = new HashMap<String, Object>();
// codeListParam.put("batchId",id);
// codeListParam.put("promotionCodeStatus",0); //0 未使用
// codeListParam.put("pageIndex",1);
// codeListParam.put("pageSize",20);
// response =network.getResponse(codeListParam,MANAGER_codeList);
// promotionCode=response.jsonPath().getString("data.list[0].promotionCode");
// }
//
//
// @Test (description = "优惠券_付费页",priority = 12)
// public void 优惠券_付费页 () {
// //创建支付订单
// Map<String, Object> payParams = new HashMap<String, Object>();
// payParams.clear();
// payParams.put("entryDiscountType",4);
// payParams.put("promotionCode",promotionCode);
// payParams.put("discountType",4);
// payParams.put("paySource","2");
// Response response = network.postResponse(payParams,PAY_create);
// System.out.println(response.body().asString());
// tradeNo = response.jsonPath().getString("data.tradeNo");
// Assert.assertNotNull(tradeNo,network.message(payParams, PAY_create,"拉起支付:拉起微信支付失败",response.body().asString())); //判断订单号是否为空
//
// //付费页
// payParams.clear();
// payParams.put("entryDiscountType",4);
// response = network.getResponse(PAY_info);
// int discountType = response.jsonPath().getInt("data.discountType");
// int validity = response.jsonPath().getInt("data.validity");
// int preferentialPrice = response.jsonPath().getInt("data.preferentialPrice");
// Assert.assertEquals(discountType,2,network.message(PAY_info,"非续费逻辑",response.body().asString()));
// Assert.assertEquals(validity,14,network.message(PAY_info,"增加会员时长非14个月",response.body().asString()));
// Assert.assertEquals(preferentialPrice,36500,network.message(PAY_info,"优惠码价格非365",response.body().asString()));
// }
//
// @Test (description = "默认付费_微信支付后回调",priority = 13)
// public void 默认付费_微信支付后回调() {
// // mock微信回调失败
// Map<String, Object> callbackParams = new HashMap<String, Object>();
// callbackParams.put("tradeNo",tradeNo);
// callbackParams.put("payTradeNo","test");
// callbackParams.put("payResult",false);
// Response response = network.getResponse(callbackParams,PAY_CALLOUT);
// boolean result = response.jsonPath().getBoolean("data");
// Assert.assertTrue(result,network.message(callbackParams,PAY_CALLOUT,"mock微信支付回调失败,但我们订单处理也失败",response.body().asString()));
//
// // mock微信回调成功
// response = network.postResponse(callbackParams,PAY_create);
// tradeNo = response.jsonPath().getString("data.tradeNo");
// callbackParams.put("tradeNo",tradeNo);
// callbackParams.put("payResult",true);
// response = network.getResponse(callbackParams,PAY_CALLOUT);
// result = response.jsonPath().getBoolean("data");
// Assert.assertTrue(result,network.message(callbackParams,PAY_CALLOUT,"mock微信支付回调成功,但我们订单处理失败",response.body().asString()));
//
// //查询订单状态
// Map<String, Object> statusParams = new HashMap<String, Object>();
// statusParams.put("tradeNo",tradeNo);
// response = network.getResponse(statusParams,PAY_result);
// System.out.println(response.body().asString());
// int data = response.jsonPath().getInt("data");
// Assert.assertTrue(data==3,network.message(statusParams, PAY_result,"支付成功的订单状态不对",response.body().asString()));
//
//
// // 检查会员开通结果
// response = network.getResponse(USER_INFO);
// boolean isVip = response.jsonPath().getBoolean("data.vipValid");
// Assert.assertTrue(isVip,network.message(USER_INFO,"微信支付成功,但是接口返回还是非会员状态",response.body().asString()));
//
// // 检查会员版本类型
// response = network.getResponse(version_info);
// int userVersion = response.jsonPath().getInt("data.find {it.openType == 1}.userVersion"); // 找出开启状态的版本类型 1为通用版 2为保险版
// Assert.assertEquals(userVersion,2,network.message(version_info,"会员类型版本判断:判断错误,此版本为通用版",response.body().asString()));
//
// // 重复提交
// //创建支付订单
// Map<String, Object> payParams = new HashMap<String, Object>();
// payParams.clear();
// payParams.put("entryDiscountType",4);
// payParams.put("promotionCode",promotionCode);
// payParams.put("discountType",4);
// payParams.put("paySource","2");
// response = network.postResponse(payParams,PAY_create);
// System.out.println(response.body().asString());
// tradeNo = response.jsonPath().getString("data.tradeNo");
// Assert.assertNotNull(tradeNo,network.message(payParams, PAY_create,"拉起支付:拉起微信支付失败",response.body().asString())); //判断订单号是否为空
// }
//
// @Test (description = "优惠券_重复提交订单",priority = 12)
// public void 优惠券_重复提交订单 () {
// //创建支付订单
// Map<String, Object> payParams = new HashMap<String, Object>();
// payParams.clear();
// payParams.put("entryDiscountType",4);
// payParams.put("promotionCode",promotionCode);
// payParams.put("discountType",4);
// payParams.put("paySource","2");
// Response response = network.postResponse(payParams,PAY_create);
// System.out.println(response.body().asString());
// tradeNo = response.jsonPath().getString("data.tradeNo");
// Assert.assertNotNull(tradeNo,network.message(payParams, PAY_create,"拉起支付:拉起微信支付失败",response.body().asString())); //判断订单号是否为空
// }
}
......@@ -768,12 +768,10 @@ public class BasicConfig {
public static final String ROOKIEGUIDE_homeGuide= HOST + "/kjy/mp/rookieGuide/homeGuide";
// *************** 支付 ***************
public static final String PAY_getMiddleDetail = HOST + "/kjy/mp/payMiddle/getMiddleDetail";
public static final String PAY_getPromoCode = HOST + "/kjy/order/getPromoCode";
public static final String PAY_combo = HOST + "/kjy/mp/combo/list/v2";
public static final String PAY_create = HOST + "/kjy/order/create";
public static final String PAY_cancel = HOST + "/kjy/order/cancel";
public static final String PAY_CALLOUT = HOST + "/kjy/order/payCallout";
public static final String PAY_create = HOST + "/kjj/vip/order/create";
public static final String PAY_cancel = HOST + "/kjj/vip/order/cancel";
public static final String PAY_CALLOUT = HOST + "/kjj/order/payCallout";
public static final String PAY_exchange= HOST + "/kjy/mp/version/exchange";
public static final String PAY_status= HOST + "/kjy/order/status";
public static final String PAY_isRenewCondition= HOST + "/kjy/mp/combo/isRenewCondition";
......@@ -785,6 +783,10 @@ public class BasicConfig {
public static final String PAY_distributionList = HOST + "/kjy/sp/seller/distributionList";
public static final String PAY_accDetail = HOST + "/kjy/sp/seller/acc/detail";
public static final String PAY_withdraw = HOST + "/kjy/sp/seller/acc/withdraw";
public static final String PAY_info = HOST + "/kjj/vip/order/info";
public static final String PAY_list = HOST + "/kjj/vip/order/success/list";
public static final String PAY_result = HOST + "/kjj/vip/order/pay/result";
public static final String PAY_popup = HOST + "/kjj/vip/order/other/popup";
// *************** 名片 ***************
public static final String SELLERCARD_topOfDetail = HOST + "/kjy/mp/sellerCardV5/topOfDetail";
......
......@@ -108,9 +108,10 @@ public class BaseUtils {
}
/**
* 切换为会员
* 切换会员
* choice-1切换为非会员,choice为其他切换为会员
*/
public static void updateTypeOrDate(long userId){
public static void updateTypeOrDate(long userId,boolean choice){
//找到用户的sellerid
Map<String, Object> params = new HashMap<String, Object>();
Response response = network.getResponse(USER_INFO);
......@@ -129,23 +130,31 @@ public class BaseUtils {
Assert.assertTrue(success,network.message(params,MANAGER_changeCompany,"接口返回失败",response.body().asString()));
Assert.assertTrue(result,network.message(params,MANAGER_changeCompany,"返回数据为空",response.body().asString()));
//切换会员
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'");//设置日期格式
Date date = new Date();// new Date()为获取当前系统时间
Calendar cal = Calendar.getInstance();
cal.setTime(date);
cal.add(Calendar.YEAR,1);
params.put("reason","测试账号");
params.put("sellerId",sellerId);
params.put("userVersion",2);
params.put("vipEndDate",df.format(date));
params.put("vipStartDate",df.format(cal.getTime()));
params.put("vipType",2);
response = network.postResponse(params,MANAGER_updateTypeOrDate);
cal.add(Calendar.YEAR, 1);
params.put("reason", "测试账号");
params.put("sellerId", sellerId);
params.put("userVersion", 2);
params.put("vipStartDate", df.format(date));
params.put("vipEndDate", df.format(cal.getTime()));
if(choice) {
//切换会员
params.put("vipType", 2);
response = network.postResponse(params, MANAGER_updateTypeOrDate);
success = response.jsonPath().getBoolean("success");
result = response.jsonPath().getBoolean("data");
Assert.assertTrue(success, network.message(params, MANAGER_updateTypeOrDate, "接口返回失败", response.body().asString()));
}else{
//切换非会员
params.put("vipType", 1);
response = network.postResponse(params, MANAGER_updateTypeOrDate);
success = response.jsonPath().getBoolean("success");
result = response.jsonPath().getBoolean("data");
Assert.assertTrue(success,network.message(params,MANAGER_updateTypeOrDate,"接口返回失败",response.body().asString()));
Assert.assertTrue(result,network.message(params,MANAGER_updateTypeOrDate,"返回数据为空",response.body().asString()));
Assert.assertTrue(success, network.message(params, MANAGER_updateTypeOrDate, "接口返回失败", response.body().asString()));
}
}
/*
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment