Commit ea01aad8 by yangfangfang

收银相关

parent 67ac9faf
package com.xiaomai.cases.polar.finance.cashier;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.xiaomai.client.DataUserInfo;
import com.xiaomai.enums.ApiModule;
import com.xiaomai.enums.RequestType;
import com.xiaomai.enums.Terminal;
import com.xiaomai.utils.XMBaseTest;
public class CashierTools extends XMBaseTest {
/**
* @param
* @description: 分页筛选收银流水-搜索
* @param buyerName:支付姓名 不用需要传null
* @param buyerPhone:支付手机号 不用需要传null
* @param businessNo:支付订单号 不用需要传null
* @author: yangfangfang
**/
public JSONObject page_select(String buyerName, String buyerPhone, String businessNo, DataUserInfo...dataUserInfos){
dataApi.setApiModule(ApiModule.Polar_Finance)
.setApiName("API_page")
.setTerminal(Terminal.B);
super.beforeDataRequest(dataUserInfos);
JSONObject jsonObject=new JSONObject();
jsonObject.put("current",0);
jsonObject.put("size",20);
jsonObject.put("buyerName",buyerName);
jsonObject.put("buyerPhone",buyerPhone);
jsonObject.put("businessNo",businessNo);
jsonObject.put("studioId",dataApi.getLoginInfo().getStudioId());
jsonObject.put("brandId",dataApi.getLoginInfo().getBrandId());
jsonObject.put("operatorId",dataApi.getLoginInfo().getAdminId());
dataApi.doRequest(RequestType.JSON, dataparams, jsonObject.toJSONString(), dataheadrs);
JSONObject response=dataApi.getBodyInJSON();
return response;
}
/**
* @param
* @description: 分页筛选收银流水-筛选
* @param subChannel:支付方式 [ "支付宝", "微信" ] [ ALI, WX ]
* @param orderType:来源[ "未知", "签单", "退单", "作废订单", "收款码", "B端短信充值", "电子合同" ][ UNKNOWN, SIGN_ORDER, REFUND_ORDER, DISCARD_ORDER, PAY_QR_CODE, B_SMS_RECHARGE, ELE_CONTRACT ]
* @author: yangfangfang
**/
public JSONObject page_sift(String subChannel, String orderType, DataUserInfo...dataUserInfos){
dataApi.setApiModule(ApiModule.Polar_Finance)
.setApiName("API_page")
.setTerminal(Terminal.B);
super.beforeDataRequest(dataUserInfos);
JSONObject jsonObject=new JSONObject();
jsonObject.put("current",0);
jsonObject.put("size",20);
jsonObject.put("subChannel",subChannel);//支付方式 [ "支付宝", "微信" ] [ ALI, WX ]
JSONArray transStateList=new JSONArray();//收款成功(入账中、入账成功),这两个状态都代表收款成功
transStateList.add("PAY_SUCCESS");
transStateList.add("PAY_IN");
jsonObject.put("transStateList",transStateList);
jsonObject.put("orderType",orderType);//来源[ "未知", "签单", "退单", "作废订单", "收款码", "B端短信充值", "电子合同" ][ UNKNOWN, SIGN_ORDER, REFUND_ORDER, DISCARD_ORDER, PAY_QR_CODE, B_SMS_RECHARGE, ELE_CONTRACT ]
jsonObject.put("studioId",xmAppApi.getLoginInfo().getStudioId());
jsonObject.put("brandId",xmAppApi.getLoginInfo().getBrandId());
jsonObject.put("operatorId",xmAppApi.getLoginInfo().getAdminId());
dataApi.doRequest(RequestType.JSON, dataparams, jsonObject.toJSONString(), dataheadrs);
JSONObject response=dataApi.getBodyInJSON();
return response;
}
}
package com.xiaomai.cases.polar.finance.cashier;
import com.alibaba.fastjson.JSONObject;
import com.xiaomai.enums.ApiModule;
import com.xiaomai.enums.LoginAccount;
import com.xiaomai.enums.RequestType;
import com.xiaomai.enums.Terminal;
import com.xiaomai.utils.XMBaseTest;
import org.testng.Assert;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
public class TestGetById extends XMBaseTest {
CashierTools cashierTools=new CashierTools();
@BeforeMethod
public void beforeTest(){
xmAppApi.setApiModule(ApiModule.Polar_Finance)
.setApiName("API_getById")
.setLoginUser(LoginAccount.YFF_PROD)
.setTerminal(Terminal.B);
dal.setCase_owner("yff")
.setCase_name(Thread.currentThread().getStackTrace()[1].getFileName().split("\\.")[0]);
super.beforeTest();
}
@Test(description = "查询收银流水详情")
public void testGetById(){
//10020060066--固定流水,换场馆需要按照这个手机支付0.01元 "flowIds": ["1808757176611880962"]
JSONObject page_select=cashierTools.page_select(null,"10020060066",null);
String id=page_select.getJSONObject("result").getJSONArray("records").getJSONObject(0).getString("id");//流水ID
JSONObject getById=new JSONObject();
getById.put("id",id);
getById.put("brandId",xmAppApi.getLoginInfo().getBrandId());
getById.put("studioId",xmAppApi.getLoginInfo().getStudioId());
getById.put("operatorId",xmAppApi.getLoginInfo().getAdminId());
xmAppApi.doRequest(RequestType.JSON,params,getById.toJSONString(),headers).assetsSuccess(true);
String success=xmAppApi.getBodyInJSON().getString("success");
Assert.assertEquals(success,"true","查询收银流水详情失败");
}
}
package com.xiaomai.cases.polar.finance.cashier;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.xiaomai.enums.ApiModule;
import com.xiaomai.enums.LoginAccount;
import com.xiaomai.enums.RequestType;
import com.xiaomai.enums.Terminal;
import com.xiaomai.utils.XMBaseTest;
import org.testng.Assert;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
public class TestPage extends XMBaseTest {
@BeforeMethod
public void beforeTest(){
xmAppApi.setApiModule(ApiModule.Polar_Finance)
.setApiName("API_page")
.setLoginUser(LoginAccount.YFF_PROD)
.setTerminal(Terminal.B);
dal.setCase_owner("yff")
.setCase_name(Thread.currentThread().getStackTrace()[1].getFileName().split("\\.")[0]);
super.beforeTest();
}
@DataProvider
public Object[][] dataProvider(){
return new Object[][]{
{"自动化流水",null},
{null,"10020060066"},
};
}
@Test(description = "分页筛选收银流水-搜索",dataProvider ="dataProvider")
public void testPage(String buyerName,String buyerPhone){
//10020060066--固定流水,换场馆需要按照这个手机支付0.01元 "flowIds": ["1808757176611880962"]
JSONObject jsonObject=new JSONObject();
jsonObject.put("current",0);
jsonObject.put("size",20);
jsonObject.put("buyerName",buyerName);
jsonObject.put("buyerPhone",buyerPhone);
jsonObject.put("businessNo",null);
jsonObject.put("studioId",xmAppApi.getLoginInfo().getStudioId());
jsonObject.put("brandId",xmAppApi.getLoginInfo().getBrandId());
jsonObject.put("operatorId",xmAppApi.getLoginInfo().getAdminId());
xmAppApi.doRequest(RequestType.JSON,params,jsonObject.toJSONString(),headers).assetsSuccess(true);
JSONObject response=xmAppApi.getBodyInJSON();
String success=response.getString("success");
int total=Integer.parseInt(response.getJSONObject("result").getString("total"));
Assert.assertEquals(success,"true","分页筛选收银流水失败");
Assert.assertEquals(total>=1,true,"未搜索到对应的流水");
}
@DataProvider
public Object[][] dataProvider1(){
return new Object[][]{
{true,"WX","PAY_QR_CODE","REFUND"},
{false,"ALI","SIGN_ORDER","PAY"},
{false,"ALI","REFUND_ORDER","REFUND"},
{false,"WX","DISCARD_ORDER","PAY"},
};
}
@Test(description = "分页筛选收银流水",dataProvider = "dataProvider1")
public void testPage_sift(boolean existSubOrderNo,String subChannel,String orderType,String transType){
JSONObject jsonObject=new JSONObject();
jsonObject.put("current",0);
jsonObject.put("size",20);
jsonObject.put("buyerName",null);
jsonObject.put("buyerPhone","10020060066");
jsonObject.put("businessNo",null);
jsonObject.put("existSubOrderNo",existSubOrderNo);//是否存在子订单号, true-存在;false-不存在
jsonObject.put("subChannel",subChannel);//支付方式 [ "支付宝", "微信" ] [ ALI, WX ]
JSONArray transStateList=new JSONArray();//收款成功(入账中、入账成功)
transStateList.add("PAY_SUCCESS");
transStateList.add("PAY_IN");
jsonObject.put("transStateList",transStateList);
jsonObject.put("orderType",orderType);//来源[ "未知", "签单", "退单", "作废订单", "收款码", "B端短信充值", "电子合同" ][ UNKNOWN, SIGN_ORDER, REFUND_ORDER, DISCARD_ORDER, PAY_QR_CODE, B_SMS_RECHARGE, ELE_CONTRACT ]
jsonObject.put("transType",transType);//交易类型:PAY-收款;REFUND-退款;
jsonObject.put("studioId",xmAppApi.getLoginInfo().getStudioId());
jsonObject.put("brandId",xmAppApi.getLoginInfo().getBrandId());
jsonObject.put("operatorId",xmAppApi.getLoginInfo().getAdminId());
xmAppApi.doRequest(RequestType.JSON,params,jsonObject.toJSONString(),headers).assetsSuccess(true);
String success=xmAppApi.getBodyInJSON().getString("success");
Assert.assertEquals(success,"true","分页筛选收银流水失败");
}
}
package com.xiaomai.cases.polar.finance.cashier;
import com.alibaba.fastjson.JSONObject;
import com.xiaomai.enums.ApiModule;
import com.xiaomai.enums.LoginAccount;
import com.xiaomai.enums.RequestType;
import com.xiaomai.enums.Terminal;
import com.xiaomai.utils.XMBaseTest;
import org.testng.Assert;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
public class TestPageSettle extends XMBaseTest {
@BeforeMethod
public void beforeTest(){
xmAppApi.setApiModule(ApiModule.Polar_Finance)
.setApiName("API_pageSettle")
.setLoginUser(LoginAccount.YFF_PROD)
.setTerminal(Terminal.B);
dal.setCase_owner("yff")
.setCase_name(Thread.currentThread().getStackTrace()[1].getFileName().split("\\.")[0]);
super.beforeTest();
}
@Test(description = "分页筛选结算记录")
public void testPageSettle(){
JSONObject jsonObject=new JSONObject();
jsonObject.put("current",0);
jsonObject.put("size",20);
jsonObject.put("transState","SUCCESS");//结算状态:成功
jsonObject.put("studioName","小麦乐动自动化场馆");//场馆名称
jsonObject.put("studioId",xmAppApi.getLoginInfo().getStudioId());
jsonObject.put("brandId",xmAppApi.getLoginInfo().getBrandId());
jsonObject.put("operatorId",xmAppApi.getLoginInfo().getAdminId());
xmAppApi.doRequest(RequestType.JSON,params,jsonObject.toJSONString(),headers).assetsSuccess(true);
String success=xmAppApi.getBodyInJSON().getString("success");
Assert.assertEquals(success,"true","获取分页筛选结算记录失败");
}
}
package com.xiaomai.cases.polar.finance.cashier;
import com.alibaba.fastjson.JSONObject;
import com.xiaomai.enums.ApiModule;
import com.xiaomai.enums.LoginAccount;
import com.xiaomai.enums.RequestType;
import com.xiaomai.enums.Terminal;
import com.xiaomai.utils.XMBaseTest;
import org.testng.Assert;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
public class TestStatistic extends XMBaseTest {
@BeforeMethod
public void beforeTest(){
xmAppApi.setApiModule(ApiModule.Polar_Finance)
.setApiName("API_statistic")
.setLoginUser(LoginAccount.YFF_PROD)
.setTerminal(Terminal.B);
dal.setCase_owner("yff")
.setCase_name(Thread.currentThread().getStackTrace()[1].getFileName().split("\\.")[0]);
super.beforeTest();
}
@DataProvider
public Object[][] dataProvider(){
return new Object[][]{
{"PAY"},//收款
{"REFUND"}//退款
};
}
@Test(description = "统计收银流水",dataProvider = "dataProvider")
public void testStatistic(String transType){
JSONObject jsonObject=new JSONObject();
jsonObject.put("transType",transType);
jsonObject.put("studioId",xmAppApi.getLoginInfo().getStudioId());
jsonObject.put("brandId",xmAppApi.getLoginInfo().getBrandId());
jsonObject.put("operatorId",xmAppApi.getLoginInfo().getAdminId());
xmAppApi.doRequest(RequestType.JSON,params,jsonObject.toJSONString(),headers).assetsSuccess(true);
String success=xmAppApi.getBodyInJSON().getString("success");
Assert.assertEquals(success,"true","获取统计收银流水失败");
}
}
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