Commit 9dc8b717 by zhangyuxiao

修改体验卡报错

parent e41ba509
......@@ -31,6 +31,8 @@ public class TestActiveExperienceCard extends XMBaseTest {
float price; //价格
int validPeriod; //有效期
String latestSnapshotId;//最近的快照ID
BigDecimal entryQuantity;//入场权益
float entryPrice;//入场权益价格
@BeforeMethod
public void beforeTest(){
......@@ -47,10 +49,10 @@ public class TestActiveExperienceCard extends XMBaseTest {
@Test(description = "操作体验卡开卡")
public void testActivateMemberCard() {
//先检查下列表有没有数据,有数据才会执行下面的点代码,无数据则新建一个
cardTools.fetchPageOfMemberCard("EXPERIENCE_CARD");
cardTools.doMemberCardcommonSearch("课程次数入场次数","EXPERIENCE_CARD");
int listDatas = XMJSONPath.getJSONArrayByReadPath(dataApi.getApi_response(), "$.result.records").size();
if (listDatas > 0) {
memberCardId = XMJSONPath.readPath(dataApi.getApi_response(), "$.result.records[0].id");
memberCardId = XMJSONPath.readPath(dataApi.getApi_response(), "$.result[0].id");
} else {
for (int i = 0; i < 3; i++) {
title = "课程次数入场次数" + RandomStringUtil.randomString(3) + "-自动化创建";
......@@ -65,12 +67,14 @@ public class TestActiveExperienceCard extends XMBaseTest {
//获取体验卡详情
cardTools.fetchDetailById(memberCardId);
quantity= new BigDecimal(XMJSONPath.readPath(dataApi.getApi_response(),"$.result.benefitList[0].balance"));
price=Float.valueOf(XMJSONPath.readPath(dataApi.getApi_response(), "$.result.price"));
entryQuantity = new BigDecimal(XMJSONPath.readPath(dataApi.getApi_response(),"$.result.benefitList[1].balance"));
price=Float.valueOf(XMJSONPath.readPath(dataApi.getApi_response(), "$.result.benefitList[0].price"));
entryPrice = Float.valueOf(XMJSONPath.readPath(dataApi.getApi_response(), "$.result.benefitList[1].price"));
validPeriod=Integer.valueOf(XMJSONPath.readPath(dataApi.getApi_response(), "$.result.validPeriod"));
latestSnapshotId=XMJSONPath.readPath(dataApi.getApi_response(), "$.result.latestSnapshotId");
//给会员签单-购买体验卡
orderTools.signOrder(memberCardId,latestSnapshotId,quantity,price,validPeriod,latestSnapshotId,0,"FIRST_USED","EXPERIENCE_CARD", "1805435813468483586",price,price,"1");
orderTools.signOrder1(memberCardId,latestSnapshotId,quantity,entryQuantity,price,entryPrice,validPeriod,latestSnapshotId,0,"FIRST_USED","EXPERIENCE_CARD", "1805435813468483586",price+entryPrice,price+entryPrice,"1");
//获取该会员名下的体验卡列表
cardTools.getUserMemberCardList("1805435813468483586","EXPERIENCE");
......@@ -102,7 +106,7 @@ public class TestActiveExperienceCard extends XMBaseTest {
Assert.assertTrue(XMJSONPath.readPath(dataApi.getApi_response(), "$.result.records[0].consumeType").equals("PURCHASE"), "会员购卡后生成消耗记录不是购买");
//操作退卡
orderTools.refundOrder(2, memberAccountCardId, quantity, price, "EXPERIENCE_CARD", "1805435813468483586", price, price, "1");
orderTools.refundOrder1(2, 1,memberAccountCardId, quantity, entryQuantity,price, entryPrice,"EXPERIENCE_CARD", "1805435813468483586", "1");
String refundOrderId = XMJSONPath.readPath(dataApi.getApi_response(), "$.result");
......
......@@ -547,6 +547,73 @@ public class OrderTools extends XMBaseTest {
return response;
}
//双权益的订单
public JSONObject signOrder1(String cardId,String cardSnapshotId,BigDecimal quantity,BigDecimal entryQuantity,float price,float entryPrice,int validPeriod,String latestSnapshotId,float deductionAmount,String activatePattern,
String commodityCardType,String memberId,float receivableAmount,float amount,String paymentWay,DataUserInfo...dataUserInfos){
dataApi.setApiModule(ApiModule.Polar_Finance)
.setApiName("API_signOrder")
.setTerminal(Terminal.B);
super.beforeDataRequest(dataUserInfos);
JSONObject jsonObject=new JSONObject();
jsonObject.put("salesmanId",dataApi.getLoginInfo().getAdminId());
jsonObject.put("operationTime", TimeUtils.getCurrentTime());
JSONObject card=new JSONObject();
card.put("cardId",cardId);
card.put("cardSnapshotId",cardSnapshotId);
JSONObject cardChange=new JSONObject();
cardChange.put("quantity",quantity);
cardChange.put("entryQuantity",entryQuantity);
cardChange.put("price",price);
cardChange.put("entryPrice",entryPrice);
cardChange.put("validPeriod",validPeriod);
cardChange.put("totalPrice",price+entryPrice);
cardChange.put("latestSnapshotId",latestSnapshotId);
card.put("cardChange",cardChange);
card.put("deductionAmount",deductionAmount);//优惠金额(元)
card.put("activatePattern",activatePattern);
card.put("giftQuantity",2);//课程赠送2次
card.put("entryGiftQuantity",1);//入场赠送
if(activatePattern.equals("FIRST_USED")){ //如果选择生效方式为 首次使用生效
card.put("maxIdlePeriod",30); //最晚生效天数
}
if(activatePattern.equals("SPECIFIC_DATE")){//选择指定日期生效
card.put("activateDate", CommUtil.oneKeyGetAddDay(7));//当前时间+7天
}
card.put("commodityCardType",commodityCardType);
jsonObject.put("card",card);
jsonObject.put("objectId", RandomStringUtil.randomString(20));
jsonObject.put("studioId",dataApi.getLoginInfo().getStudioId());
jsonObject.put("memberId",memberId);
jsonObject.put("receivableAmount",receivableAmount);//应收金额
jsonObject.put("operatorId",dataApi.getLoginInfo().getAdminId());
JSONArray paymentWays=new JSONArray();
JSONObject object=new JSONObject();
object.put("amount",amount);//支付金额
object.put("paymentWay",paymentWay);
JSONArray voucherResourceIds=new JSONArray();//支付凭证
voucherResourceIds.add("");
object.put("voucherResourceIds",voucherResourceIds);
paymentWays.add(object);
jsonObject.put("paymentWays",paymentWays);
jsonObject.put("brandId",dataApi.getLoginInfo().getBrandId());
dataApi.doRequest(RequestType.JSON, dataparams, jsonObject.toJSONString(), dataheadrs).assetsSuccess(true);
JSONObject response=dataApi.getBodyInJSON();
return response;
}
/**
* @param
* @description:修改对外备注
......@@ -737,7 +804,56 @@ public class OrderTools extends XMBaseTest {
return response;
}
//双权益退卡
public JSONObject refundOrder1(int giftQuantity,int entryGiftQuantity, String memberCardId,BigDecimal quantity,BigDecimal entryQuantity,float refundAmount,float entryRefundAmount,String commodityCardType,String memberId,
String paymentWay,DataUserInfo...dataUserInfos){
dataApi.setApiModule(ApiModule.Polar_Finance)
.setApiName("API_refundOrder")
.setTerminal(Terminal.B);
super.beforeDataRequest(dataUserInfos);
JSONObject jsonObject=new JSONObject();
jsonObject.put("operationTime",TimeUtils.getCurrentTime());
JSONObject card=new JSONObject();
card.put("giftQuantity",giftQuantity);
card.put("memberCardId",memberCardId);
card.put("quantity",quantity);
card.put("entryQuantity",entryQuantity);
card.put("entryGiftQuantity",entryGiftQuantity);
card.put("refundAmount",refundAmount);
card.put("entryRefundAmount",entryRefundAmount);
card.put("commodityCardType",commodityCardType);
jsonObject.put("card",card);
jsonObject.put("objectId", RandomStringUtil.randomString(20));
jsonObject.put("studioId",dataApi.getLoginInfo().getStudioId());
jsonObject.put("memberId",memberId);
jsonObject.put("receivableAmount",refundAmount+entryRefundAmount);
jsonObject.put("operatorId",dataApi.getLoginInfo().getAdminId());
JSONArray paymentWays=new JSONArray();
JSONObject jsonObject1=new JSONObject();
jsonObject1.put("amount",refundAmount+entryRefundAmount);
jsonObject1.put("paymentWay",paymentWay);
JSONArray voucherResourceIds=new JSONArray();
voucherResourceIds.add("");
jsonObject1.put("voucherResourceIds",voucherResourceIds);
paymentWays.add(jsonObject1);
jsonObject.put("paymentWays",paymentWays);
jsonObject.put("brandId",dataApi.getLoginInfo().getBrandId());
dataApi.doRequest(RequestType.JSON, dataparams, jsonObject.toJSONString(), dataheadrs).assetsSuccess(true);
JSONObject response=dataApi.getBodyInJSON();
return response;
}
/**
* @param
......
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