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

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

parent 39894be6
...@@ -270,7 +270,7 @@ public class PersonCard implements Authorization { ...@@ -270,7 +270,7 @@ public class PersonCard implements Authorization {
params.put("product","金牌产品A"); params.put("product","金牌产品A");
Response response = network.postResponse(params, SELLERCARD_EDITDELLERCASE); Response response = network.postResponse(params, SELLERCARD_EDITDELLERCASE);
boolean success = response.jsonPath().getBoolean("success"); 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(); params.clear();
......
...@@ -55,7 +55,7 @@ public class NoviceGuidance implements Authorization { ...@@ -55,7 +55,7 @@ public class NoviceGuidance implements Authorization {
//关注公众号 //关注公众号
userId = (long) subscribe(); userId = (long) subscribe();
//切换会员 //切换会员
updateTypeOrDate(userId); updateTypeOrDate(userId,true);
} }
@Test(description = "创建资料包", priority = 3) @Test(description = "创建资料包", priority = 3)
......
...@@ -13,6 +13,7 @@ import java.util.Map; ...@@ -13,6 +13,7 @@ import java.util.Map;
import static com.kjj.config.BasicConfig.*; import static com.kjj.config.BasicConfig.*;
import static com.kjj.config.BasicConfig.PAY_CALLOUT; import static com.kjj.config.BasicConfig.PAY_CALLOUT;
import static com.kjj.utils.BaseUtils.updateTypeOrDate;
public class Cashback implements Authorization { public class Cashback implements Authorization {
...@@ -22,58 +23,73 @@ public class Cashback implements Authorization { ...@@ -22,58 +23,73 @@ public class Cashback implements Authorization {
} }
public String comboId; public String comboId;
@Test(description = "用户绑定分享关系",priority = 1) // @Test(description = "用户绑定分享关系",priority = 1)
public void 用户绑定分享关系() { // public void 用户绑定分享关系() {
Map<String, Object> Params = new HashMap<String, Object>(); // Map<String, Object> Params = new HashMap<String, Object>();
Params.put("fromStr",1); // Params.put("fromStr",1);
Params.put("inviterSid",2991); // Params.put("inviterSid",2991);
Params.put("accessSource",22); // Params.put("accessSource",22);
Response response = network.getResponse(Params,PAY_distribute); // Response response = network.getResponse(Params,PAY_distribute);
System.out.println(response.body().asString()); // System.out.println(response.body().asString());
boolean data=response.jsonPath().getBoolean("data"); // boolean data=response.jsonPath().getBoolean("data");
Assert.assertTrue(data,network.message(PAY_distribute,"用户绑定失败",response.body().asString())); // Assert.assertTrue(data,network.message(PAY_distribute,"用户绑定失败",response.body().asString()));
//
} // }
@Test (description = "用户支付后是否有180天打卡权限",priority = 2) // @Test (description = "用户支付后是否有180天打卡权限",priority = 2)
public void 用户支付后是否有180天打卡权限() { // public void 用户支付后是否有180天打卡权限() {
Response response = network.getResponse(PAY_clockPayInfo); // Response response = network.getResponse(PAY_clockPayInfo);
System.out.println(response.body().asString()); // System.out.println(response.body().asString());
boolean isClockPay=response.jsonPath().getBoolean("data.isClockPay"); // boolean isClockPay=response.jsonPath().getBoolean("data.isClockPay");
Assert.assertFalse(isClockPay,network.message(PAY_clockPayInfo,"有180天打卡权限",response.body().asString())); // Assert.assertFalse(isClockPay,network.message(PAY_clockPayInfo,"有180天打卡权限",response.body().asString()));
// }
} //
// @Test (description = "默认付费_邀请付费页",priority = 3) //priority 方法执行优先级
@Test (description = "返现用户付费_微信支付后回调",priority = 3) // public void 默认付费_邀请付费页() {
public void 返现用户付费_微信支付后回调() { // updateTypeOrDate(5495,false);
//获取付费价格 // //代理人续费状态
Response actualPayMoneyResponse = network.getResponse(PAY_combo); // Map<String, Object> payParams = new HashMap<String, Object>();
System.out.println(actualPayMoneyResponse.body().asString()); // payParams.put("entryDiscountType",3); //入口折扣类型,1-普通,3-邀请,4-优惠码
comboId=actualPayMoneyResponse.jsonPath().getString("data[0].id"); // Response response = network.getResponse(PAY_info);
Assert.assertNotNull(comboId,network.message(PAY_combo,"套餐ID为null",actualPayMoneyResponse.body().asString())); // int discountType = response.jsonPath().getInt("data.discountType");
String actualPayMoney = actualPayMoneyResponse.jsonPath().getString("data[0].actualPayMoney"); // int validity = response.jsonPath().getInt("data.validity");
Assert.assertEquals(actualPayMoney,"0.01",network.message(PAY_combo,"获取付费价格:价格不是365",actualPayMoneyResponse.body().asString())); // 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()));
Map<String, Object> payParams = new HashMap<String, Object>(); // Assert.assertEquals(preferentialPrice,3,network.message(PAY_info,"邀请价格非0.03",response.body().asString()));
payParams.put("userVersion", 2); // 1 通用版 2 保险版 // }
payParams.put("comboId", comboId);
payParams.put("oaId", "1");
payParams.put("paySource", "2"); // @Test (description = "返现用户付费_微信支付后回调",priority = 3)
Response response = network.postResponse(payParams, PAY_create); // public void 返现用户付费_微信支付后回调() {
String tradeNo = response.jsonPath().getString("data.tradeNo"); // //获取付费价格
// Response actualPayMoneyResponse = network.getResponse(PAY_combo);
// mock微信回调失败 // System.out.println(actualPayMoneyResponse.body().asString());
Map<String, Object> callbackParams = new HashMap<String, Object>(); // comboId=actualPayMoneyResponse.jsonPath().getString("data[0].id");
callbackParams.put("tradeNo", tradeNo); // Assert.assertNotNull(comboId,network.message(PAY_combo,"套餐ID为null",actualPayMoneyResponse.body().asString()));
callbackParams.put("payResult", true); // String actualPayMoney = actualPayMoneyResponse.jsonPath().getString("data[0].actualPayMoney");
callbackParams.put("payTradeNo", "test"); // Assert.assertEquals(actualPayMoney,"0.01",network.message(PAY_combo,"获取付费价格:价格不是365",actualPayMoneyResponse.body().asString()));
response = network.getResponse(callbackParams, PAY_CALLOUT); //
boolean result = response.jsonPath().getBoolean("data"); // //创建支付
Assert.assertTrue(result, network.message(callbackParams, PAY_CALLOUT, "mock微信支付回调成功,但我们订单处理失败", response.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) @Test(description = "获取用户版本信息",priority = 4)
public void 获取用户版本信息() { public void 获取用户版本信息() {
......
...@@ -768,12 +768,10 @@ public class BasicConfig { ...@@ -768,12 +768,10 @@ public class BasicConfig {
public static final String ROOKIEGUIDE_homeGuide= HOST + "/kjy/mp/rookieGuide/homeGuide"; 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_combo = HOST + "/kjy/mp/combo/list/v2";
public static final String PAY_create = HOST + "/kjy/order/create"; public static final String PAY_create = HOST + "/kjj/vip/order/create";
public static final String PAY_cancel = HOST + "/kjy/order/cancel"; public static final String PAY_cancel = HOST + "/kjj/vip/order/cancel";
public static final String PAY_CALLOUT = HOST + "/kjy/order/payCallout"; 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_exchange= HOST + "/kjy/mp/version/exchange";
public static final String PAY_status= HOST + "/kjy/order/status"; public static final String PAY_status= HOST + "/kjy/order/status";
public static final String PAY_isRenewCondition= HOST + "/kjy/mp/combo/isRenewCondition"; public static final String PAY_isRenewCondition= HOST + "/kjy/mp/combo/isRenewCondition";
...@@ -785,6 +783,10 @@ public class BasicConfig { ...@@ -785,6 +783,10 @@ public class BasicConfig {
public static final String PAY_distributionList = HOST + "/kjy/sp/seller/distributionList"; 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_accDetail = HOST + "/kjy/sp/seller/acc/detail";
public static final String PAY_withdraw = HOST + "/kjy/sp/seller/acc/withdraw"; 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"; public static final String SELLERCARD_topOfDetail = HOST + "/kjy/mp/sellerCardV5/topOfDetail";
......
...@@ -108,9 +108,10 @@ public class BaseUtils { ...@@ -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 //找到用户的sellerid
Map<String, Object> params = new HashMap<String, Object>(); Map<String, Object> params = new HashMap<String, Object>();
Response response = network.getResponse(USER_INFO); Response response = network.getResponse(USER_INFO);
...@@ -129,23 +130,31 @@ public class BaseUtils { ...@@ -129,23 +130,31 @@ public class BaseUtils {
Assert.assertTrue(success,network.message(params,MANAGER_changeCompany,"接口返回失败",response.body().asString())); Assert.assertTrue(success,network.message(params,MANAGER_changeCompany,"接口返回失败",response.body().asString()));
Assert.assertTrue(result,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'");//设置日期格式 SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'");//设置日期格式
Date date = new Date();// new Date()为获取当前系统时间 Date date = new Date();// new Date()为获取当前系统时间
Calendar cal = Calendar.getInstance(); Calendar cal = Calendar.getInstance();
cal.setTime(date); cal.setTime(date);
cal.add(Calendar.YEAR,1); cal.add(Calendar.YEAR, 1);
params.put("reason","测试账号"); params.put("reason", "测试账号");
params.put("sellerId",sellerId); params.put("sellerId", sellerId);
params.put("userVersion",2); params.put("userVersion", 2);
params.put("vipEndDate",df.format(date)); params.put("vipStartDate", df.format(date));
params.put("vipStartDate",df.format(cal.getTime())); params.put("vipEndDate", df.format(cal.getTime()));
params.put("vipType",2); if(choice) {
response = network.postResponse(params,MANAGER_updateTypeOrDate); //切换会员
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"); success = response.jsonPath().getBoolean("success");
result = response.jsonPath().getBoolean("data"); result = response.jsonPath().getBoolean("data");
Assert.assertTrue(success,network.message(params,MANAGER_updateTypeOrDate,"接口返回失败",response.body().asString())); Assert.assertTrue(success, network.message(params, MANAGER_updateTypeOrDate, "接口返回失败", response.body().asString()));
Assert.assertTrue(result,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