Commit 7806a43e authored by 马博's avatar 马博

update

parent 3512cea2
......@@ -249,6 +249,37 @@ public class CouponExchangeService {
}
/**
* 虚拟商品兑换接口
* @param cookies
* @param appItemId
* @param degreeId
* @return
* @throws Exception
*/
public Response virtualExchange(Map cookies,String appItemId,String degreeId) throws Exception {
Map<String,String> map = new HashMap<>();
map.put("appItemId",appItemId);
map.put("degreeId",degreeId);
map.put("token","yrJRr7Cddp2YeQd");
logger.info("请求/virtualExchange/exchange接口");
Response response = given().contentType("application/x-www-form-urlencoded;charset=UTF-8").cookies(cookies).params(map).post("http://"+goodsHost+"/virtualExchange/exchange");//couponExchange
try{
Assert.assertEquals(response.jsonPath().getString("success"),"true");
}catch(Exception e){
throw new Exception("/virtualExchange/exchange接口返回异常,返回信息:"+response.asString());
}catch(Error er){
throw new Exception("/virtualExchange/exchange接口返回异常,返回信息:"+response.asString());
}
return response;
}
public Response objectExchange(String appItemId,String itemId) throws Exception {
Map<String,String> map = new HashMap<>();
map.put("appItemId",appItemId);
......
......@@ -60,6 +60,50 @@ public class gawService {
// Response saveResponse = given().contentType("application/x-www-form-urlencoded;charset=UTF-8").cookies(authorization.dafuwengLogin(uid)).params(map).post("http://"+goodsHost+"/gaw/objectExchange/create");
// response.prettyPrint();
try{
Assert.assertEquals(response.jsonPath().getString("success"),"true");
}catch(Exception e){
throw new Exception("/gaw/objectExchange/create接口返回异常,返回信息:"+response.asString());
}catch(Error er){
throw new Exception("/gaw/objectExchange/create接口返回异常,返回信息:"+response.asString());
}
return response;
}
//优惠券兑换接口
public Response couponExchange(int uid, String appItemId) throws Exception {
Map<String,Object> map = new HashMap<>();
Map<String,Object> mapList = new HashMap<>();
List<Map> list = new ArrayList<>();
mapList.put("skuId",38);
mapList.put("appItemId",appItemId);
mapList.put("credits","100");
mapList.put("price",0);
list.add(mapList);
map.put("remark",""); //买家留言
map.put("degreeId","");
map.put("actualPrice","0"); //总金额
map.put("actualCredits","100"); //总积分
map.put("itemParam",list.toArray());
map.put("payType","3");
map.put("expressPrice","0");
map.put("validate","");
map.put("token","yrJRr7Cddp2YeQd");
JSONObject jsonParam = JSONObject.parseObject(JSON.toJSONString(map));
logger.info("请求实物兑换接口:"+ "/gaw/couponExchange/create");
Response response = given().contentType("application/json; charset=UTF-8").cookies(authorization.dafuwengLogin(uid)).body(jsonParam).post("http://"+goodsHost+"/gaw/couponExchange/create");
// Response saveResponse = given().contentType("application/x-www-form-urlencoded;charset=UTF-8").cookies(authorization.dafuwengLogin(uid)).params(map).post("http://"+goodsHost+"/gaw/objectExchange/create");
// response.prettyPrint();
try{
......
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