Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
X
xm-sportstest
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
xiamai-test
xm-sportstest
Commits
1ac0654d
Commit
1ac0654d
authored
Jul 03, 2024
by
DuJunLi
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
ssh://xmgit.ixm5.cn:10022/xiamai-test/xm-sportstest
parents
ea39de37
9064b6c7
Show whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
1489 additions
and
154 deletions
+1489
-154
imgFile/test1.jpg
+0
-0
src/main/java/com/xiaomai/cases/polar/finance/order/OrderTools.java
+224
-89
src/main/java/com/xiaomai/cases/polar/finance/order/TestCancel.java
+5
-5
src/main/java/com/xiaomai/cases/polar/finance/order/TestDiscard.java
+9
-10
src/main/java/com/xiaomai/cases/polar/finance/order/TestModifyMemo.java
+5
-7
src/main/java/com/xiaomai/cases/polar/finance/order/TestPay.java
+167
-0
src/main/java/com/xiaomai/cases/polar/finance/order/TestRefundOrder.java
+220
-0
src/main/java/com/xiaomai/cases/polar/finance/order/TestSignOrder.java
+16
-16
src/main/java/com/xiaomai/cases/polar/finance/revenueAndExpenditure/ResourceUtil.java
+131
-0
src/main/java/com/xiaomai/cases/polar/finance/revenueAndExpenditure/RevenueAndExpenditureTools.java
+69
-26
src/main/java/com/xiaomai/cases/polar/finance/revenueAndExpenditure/SignatureVO.java
+104
-0
src/main/java/com/xiaomai/cases/polar/finance/revenueAndExpenditure/TestUploadResources.java
+178
-0
src/main/java/com/xiaomai/cases/polar/setting/pay/PayTools.java
+158
-0
src/main/java/com/xiaomai/cases/polar/setting/pay/TestSave.java
+95
-0
src/main/java/com/xiaomai/cases/polar/setting/pay/TestUpdate.java
+105
-0
src/main/java/com/xiaomai/enums/ApiModule.java
+3
-1
No files found.
imgFile/test1.jpg
0 → 100644
View file @
1ac0654d
237 KB
src/main/java/com/xiaomai/cases/polar/finance/order/OrderTools.java
View file @
1ac0654d
...
...
@@ -18,12 +18,9 @@ public class OrderTools extends XMBaseTest {
* @description:获取会员详情-订单管理列表
* @param supplierId:卖家ID 场馆ID
* @param receiverId:会员ID
* @param brandId:品牌ID
* @param studioId:场馆ID
* @param operatorId:操作人ID
* @author: yangfangfang
**/
public
JSONObject
pageMemberVoucher
(
String
supplierId
,
String
receiverId
,
String
brandId
,
String
studioId
,
String
operatorId
,
DataUserInfo
...
dataUserInfos
){
public
JSONObject
pageMemberVoucher
(
String
supplierId
,
String
receiverId
,
DataUserInfo
...
dataUserInfos
){
dataApi
.
setApiModule
(
ApiModule
.
Polar_Finance
)
.
setApiName
(
"API_pageMemberVoucher"
)
...
...
@@ -35,9 +32,9 @@ public class OrderTools extends XMBaseTest {
jsonObject
.
put
(
"size"
,
20
);
jsonObject
.
put
(
"supplierId"
,
supplierId
);
jsonObject
.
put
(
"receiverId"
,
receiverId
);
jsonObject
.
put
(
"brandId"
,
brandId
);
jsonObject
.
put
(
"studioId"
,
studioId
);
jsonObject
.
put
(
"operatorId"
,
operatorId
);
jsonObject
.
put
(
"brandId"
,
dataApi
.
getLoginInfo
().
getBrandId
()
);
jsonObject
.
put
(
"studioId"
,
dataApi
.
getLoginInfo
().
getStudioId
()
);
jsonObject
.
put
(
"operatorId"
,
dataApi
.
getLoginInfo
().
getAdminId
()
);
dataApi
.
doRequest
(
RequestType
.
JSON
,
dataparams
,
jsonObject
.
toJSONString
(),
dataheadrs
).
assetsSuccess
(
true
);
JSONObject
response
=
dataApi
.
getBodyInJSON
();
...
...
@@ -49,12 +46,9 @@ public class OrderTools extends XMBaseTest {
* @description:获取会员详情-订单管理金额统计
* @param supplierId:卖家ID 场馆ID
* @param receiverId:会员ID
* @param brandId:品牌ID
* @param studioId:场馆ID
* @param operatorId:操作人ID
* @author: yangfangfang
**/
public
JSONObject
sumMemberVoucherAmount
(
String
supplierId
,
String
receiverId
,
String
brandId
,
String
studioId
,
String
operatorId
,
DataUserInfo
...
dataUserInfos
){
public
JSONObject
sumMemberVoucherAmount
(
String
supplierId
,
String
receiverId
,
DataUserInfo
...
dataUserInfos
){
dataApi
.
setApiModule
(
ApiModule
.
Polar_Finance
)
.
setApiName
(
"API_sumMemberVoucherAmount"
)
...
...
@@ -66,9 +60,9 @@ public class OrderTools extends XMBaseTest {
jsonObject
.
put
(
"size"
,
20
);
jsonObject
.
put
(
"supplierId"
,
supplierId
);
jsonObject
.
put
(
"receiverId"
,
receiverId
);
jsonObject
.
put
(
"brandId"
,
brandId
);
jsonObject
.
put
(
"studioId"
,
studioId
);
jsonObject
.
put
(
"operatorId"
,
operatorId
);
jsonObject
.
put
(
"brandId"
,
dataApi
.
getLoginInfo
().
getBrandId
()
);
jsonObject
.
put
(
"studioId"
,
dataApi
.
getLoginInfo
().
getStudioId
()
);
jsonObject
.
put
(
"operatorId"
,
dataApi
.
getLoginInfo
().
getAdminId
()
);
dataApi
.
doRequest
(
RequestType
.
JSON
,
dataparams
,
jsonObject
.
toJSONString
(),
dataheadrs
).
assetsSuccess
(
true
);
JSONObject
response
=
dataApi
.
getBodyInJSON
();
...
...
@@ -85,7 +79,7 @@ public class OrderTools extends XMBaseTest {
* @param operatorId:操作人ID
* @author: yangfangfang
**/
public
JSONObject
pageMemberVoucherItem
(
String
supplierId
,
String
receiverId
,
String
brandId
,
String
studioId
,
String
operatorId
,
DataUserInfo
...
dataUserInfos
){
public
JSONObject
pageMemberVoucherItem
(
String
supplierId
,
String
receiverId
,
DataUserInfo
...
dataUserInfos
){
dataApi
.
setApiModule
(
ApiModule
.
Polar_Finance
)
.
setApiName
(
"API_pageMemberVoucherItem"
)
...
...
@@ -97,9 +91,9 @@ public class OrderTools extends XMBaseTest {
jsonObject
.
put
(
"size"
,
20
);
jsonObject
.
put
(
"supplierId"
,
supplierId
);
jsonObject
.
put
(
"receiverId"
,
receiverId
);
jsonObject
.
put
(
"brandId"
,
brandId
);
jsonObject
.
put
(
"studioId"
,
studioId
);
jsonObject
.
put
(
"operatorId"
,
operatorId
);
jsonObject
.
put
(
"brandId"
,
dataApi
.
getLoginInfo
().
getBrandId
()
);
jsonObject
.
put
(
"studioId"
,
dataApi
.
getLoginInfo
().
getStudioId
()
);
jsonObject
.
put
(
"operatorId"
,
dataApi
.
getLoginInfo
().
getAdminId
()
);
dataApi
.
doRequest
(
RequestType
.
JSON
,
dataparams
,
jsonObject
.
toJSONString
(),
dataheadrs
).
assetsSuccess
(
true
);
JSONObject
response
=
dataApi
.
getBodyInJSON
();
...
...
@@ -114,10 +108,9 @@ public class OrderTools extends XMBaseTest {
* @param brandId:品牌ID
* @param studioId:场馆ID
* @param operatorId:操作人ID
* @param businessNo:订单编号
* @author: yangfangfang
**/
public
JSONObject
pageVoucher
(
String
supplierId
,
String
brandId
,
String
studioId
,
String
operatorId
,
DataUserInfo
...
dataUserInfos
){
public
JSONObject
pageVoucher
(
String
supplierId
,
DataUserInfo
...
dataUserInfos
){
dataApi
.
setApiModule
(
ApiModule
.
Polar_Finance
)
.
setApiName
(
"API_pageVoucher"
)
...
...
@@ -128,9 +121,9 @@ public class OrderTools extends XMBaseTest {
jsonObject
.
put
(
"current"
,
0
);
jsonObject
.
put
(
"size"
,
20
);
jsonObject
.
put
(
"supplierId"
,
supplierId
);
jsonObject
.
put
(
"brandId"
,
brandId
);
jsonObject
.
put
(
"studioId"
,
studioId
);
jsonObject
.
put
(
"operatorId"
,
operatorId
);
jsonObject
.
put
(
"brandId"
,
dataApi
.
getLoginInfo
().
getBrandId
()
);
jsonObject
.
put
(
"studioId"
,
dataApi
.
getLoginInfo
().
getStudioId
()
);
jsonObject
.
put
(
"operatorId"
,
dataApi
.
getLoginInfo
().
getAdminId
()
);
dataApi
.
doRequest
(
RequestType
.
JSON
,
dataparams
,
jsonObject
.
toJSONString
(),
dataheadrs
).
assetsSuccess
(
true
);
...
...
@@ -142,13 +135,10 @@ public class OrderTools extends XMBaseTest {
* @param
* @description:搜索订单管理-订单管理列表
* @param supplierId:卖家ID 场馆ID
* @param brandId:品牌ID
* @param studioId:场馆ID
* @param operatorId:操作人ID
* @param businessNo:订单编号
* @author: yangfangfang
**/
public
JSONObject
pageVoucher1
(
String
supplierId
,
String
b
randId
,
String
studioId
,
String
operatorId
,
String
b
usinessNo
,
DataUserInfo
...
dataUserInfos
){
public
JSONObject
pageVoucher1
(
String
supplierId
,
String
businessNo
,
DataUserInfo
...
dataUserInfos
){
dataApi
.
setApiModule
(
ApiModule
.
Polar_Finance
)
.
setApiName
(
"API_pageVoucher"
)
...
...
@@ -157,9 +147,9 @@ public class OrderTools extends XMBaseTest {
JSONObject
jsonObject
=
new
JSONObject
();
jsonObject
.
put
(
"supplierId"
,
supplierId
);
jsonObject
.
put
(
"brandId"
,
brandId
);
jsonObject
.
put
(
"studioId"
,
studioId
);
jsonObject
.
put
(
"operatorId"
,
operatorId
);
jsonObject
.
put
(
"brandId"
,
dataApi
.
getLoginInfo
().
getBrandId
()
);
jsonObject
.
put
(
"studioId"
,
dataApi
.
getLoginInfo
().
getStudioId
()
);
jsonObject
.
put
(
"operatorId"
,
dataApi
.
getLoginInfo
().
getAdminId
()
);
jsonObject
.
put
(
"businessNo"
,
businessNo
);
...
...
@@ -179,7 +169,7 @@ public class OrderTools extends XMBaseTest {
* @param operatorId:操作人ID
* @author: yangfangfang
**/
public
JSONObject
sumVoucherAmount
(
String
supplierId
,
String
brandId
,
String
studioId
,
String
operatorId
,
DataUserInfo
...
dataUserInfos
){
public
JSONObject
sumVoucherAmount
(
String
supplierId
,
DataUserInfo
...
dataUserInfos
){
dataApi
.
setApiModule
(
ApiModule
.
Polar_Finance
)
.
setApiName
(
"API_sumVoucherAmount"
)
...
...
@@ -190,9 +180,9 @@ public class OrderTools extends XMBaseTest {
jsonObject
.
put
(
"current"
,
0
);
jsonObject
.
put
(
"size"
,
20
);
jsonObject
.
put
(
"supplierId"
,
supplierId
);
jsonObject
.
put
(
"brandId"
,
brandId
);
jsonObject
.
put
(
"studioId"
,
studioId
);
jsonObject
.
put
(
"operatorId"
,
operatorId
);
jsonObject
.
put
(
"brandId"
,
dataApi
.
getLoginInfo
().
getBrandId
()
);
jsonObject
.
put
(
"studioId"
,
dataApi
.
getLoginInfo
().
getStudioId
()
);
jsonObject
.
put
(
"operatorId"
,
dataApi
.
getLoginInfo
().
getAdminId
()
);
dataApi
.
doRequest
(
RequestType
.
JSON
,
dataparams
,
jsonObject
.
toJSONString
(),
dataheadrs
).
assetsSuccess
(
true
);
JSONObject
response
=
dataApi
.
getBodyInJSON
();
...
...
@@ -208,7 +198,7 @@ public class OrderTools extends XMBaseTest {
* @param operatorId:操作人ID
* @author: yangfangfang
**/
public
JSONObject
pageVoucherItem
(
String
supplierId
,
String
brandId
,
String
studioId
,
String
operatorId
,
DataUserInfo
...
dataUserInfos
){
public
JSONObject
pageVoucherItem
(
String
supplierId
,
DataUserInfo
...
dataUserInfos
){
dataApi
.
setApiModule
(
ApiModule
.
Polar_Finance
)
.
setApiName
(
"API_pageVoucherItem"
)
...
...
@@ -219,9 +209,9 @@ public class OrderTools extends XMBaseTest {
jsonObject
.
put
(
"current"
,
0
);
jsonObject
.
put
(
"size"
,
20
);
jsonObject
.
put
(
"supplierId"
,
supplierId
);
jsonObject
.
put
(
"brandId"
,
brandId
);
jsonObject
.
put
(
"studioId"
,
studioId
);
jsonObject
.
put
(
"operatorId"
,
operatorId
);
jsonObject
.
put
(
"brandId"
,
dataApi
.
getLoginInfo
().
getBrandId
()
);
jsonObject
.
put
(
"studioId"
,
dataApi
.
getLoginInfo
().
getStudioId
()
);
jsonObject
.
put
(
"operatorId"
,
dataApi
.
getLoginInfo
().
getAdminId
()
);
dataApi
.
doRequest
(
RequestType
.
JSON
,
dataparams
,
jsonObject
.
toJSONString
(),
dataheadrs
).
assetsSuccess
(
true
);
JSONObject
response
=
dataApi
.
getBodyInJSON
();
...
...
@@ -237,7 +227,7 @@ public class OrderTools extends XMBaseTest {
* @param operatorId:操作人ID
* @author: yangfangfang
**/
public
JSONObject
sumVoucherItemAmount
(
String
supplierId
,
String
brandId
,
String
studioId
,
String
operatorId
,
DataUserInfo
...
dataUserInfos
){
public
JSONObject
sumVoucherItemAmount
(
String
supplierId
,
DataUserInfo
...
dataUserInfos
){
dataApi
.
setApiModule
(
ApiModule
.
Polar_Finance
)
.
setApiName
(
"API_sumVoucherItemAmount"
)
...
...
@@ -248,9 +238,9 @@ public class OrderTools extends XMBaseTest {
jsonObject
.
put
(
"current"
,
0
);
jsonObject
.
put
(
"size"
,
20
);
jsonObject
.
put
(
"supplierId"
,
supplierId
);
jsonObject
.
put
(
"brandId"
,
brandId
);
jsonObject
.
put
(
"studioId"
,
studioId
);
jsonObject
.
put
(
"operatorId"
,
operatorId
);
jsonObject
.
put
(
"brandId"
,
dataApi
.
getLoginInfo
().
getBrandId
()
);
jsonObject
.
put
(
"studioId"
,
dataApi
.
getLoginInfo
().
getStudioId
()
);
jsonObject
.
put
(
"operatorId"
,
dataApi
.
getLoginInfo
().
getAdminId
()
);
dataApi
.
doRequest
(
RequestType
.
JSON
,
dataparams
,
jsonObject
.
toJSONString
(),
dataheadrs
).
assetsSuccess
(
true
);
JSONObject
response
=
dataApi
.
getBodyInJSON
();
...
...
@@ -261,12 +251,9 @@ public class OrderTools extends XMBaseTest {
/**
* @param
* @description: 获取会员卡列表
* @param brandId:品牌ID
* @param studioId:场馆ID
* @param operatorId:操作人ID
* @author: yangfangfang
**/
public
JSONObject
fetchPageOfMemberCard
(
String
brandId
,
String
studioId
,
String
operatorId
,
DataUserInfo
...
dataUserInfos
){
public
JSONObject
fetchPageOfMemberCard
(
DataUserInfo
...
dataUserInfos
){
dataApi
.
setApiModule
(
ApiModule
.
Polar_Card
)
.
setApiName
(
"API_fetchPageOfMemberCard"
)
...
...
@@ -278,9 +265,9 @@ public class OrderTools extends XMBaseTest {
jsonObject
.
put
(
"shelfState"
,
"YES"
);
jsonObject
.
put
(
"current"
,
0
);
jsonObject
.
put
(
"size"
,
20
);
jsonObject
.
put
(
"brandId"
,
brandId
);
jsonObject
.
put
(
"studioId"
,
studioId
);
jsonObject
.
put
(
"operatorId"
,
operatorId
);
jsonObject
.
put
(
"brandId"
,
dataApi
.
getLoginInfo
().
getBrandId
()
);
jsonObject
.
put
(
"studioId"
,
dataApi
.
getLoginInfo
().
getStudioId
()
);
jsonObject
.
put
(
"operatorId"
,
dataApi
.
getLoginInfo
().
getAdminId
()
);
dataApi
.
doRequest
(
RequestType
.
JSON
,
dataparams
,
jsonObject
.
toJSONString
(),
dataheadrs
).
assetsSuccess
(
true
);
JSONObject
response
=
dataApi
.
getBodyInJSON
();
...
...
@@ -428,12 +415,9 @@ public class OrderTools extends XMBaseTest {
* @param
* @description: 获取订单详情
* @param id:主键ID(创建订单获取的result)
* @param brandId:品牌ID
* @param studioId:场馆ID
* @param operatorId:操作人ID
* @author: yangfangfang
**/
public
JSONObject
getDetail
(
String
id
,
String
brandId
,
String
studioId
,
String
operatorId
,
DataUserInfo
...
dataUserInfos
){
public
JSONObject
getDetail
(
String
id
,
DataUserInfo
...
dataUserInfos
){
dataApi
.
setApiModule
(
ApiModule
.
Polar_Finance
)
.
setApiName
(
"API_getDetail"
)
...
...
@@ -442,9 +426,9 @@ public class OrderTools extends XMBaseTest {
JSONObject
jsonObject
=
new
JSONObject
();
jsonObject
.
put
(
"id"
,
id
);
jsonObject
.
put
(
"brandId"
,
brandId
);
jsonObject
.
put
(
"studioId"
,
studioId
);
jsonObject
.
put
(
"operatorId"
,
operatorId
);
jsonObject
.
put
(
"brandId"
,
dataApi
.
getLoginInfo
().
getBrandId
()
);
jsonObject
.
put
(
"studioId"
,
dataApi
.
getLoginInfo
().
getStudioId
()
);
jsonObject
.
put
(
"operatorId"
,
dataApi
.
getLoginInfo
().
getAdminId
()
);
dataApi
.
doRequest
(
RequestType
.
JSON
,
dataparams
,
jsonObject
.
toJSONString
(),
dataheadrs
).
assetsSuccess
(
true
);
JSONObject
response
=
dataApi
.
getBodyInJSON
();
...
...
@@ -456,12 +440,9 @@ public class OrderTools extends XMBaseTest {
* @param
* @description:获取订单支付/退款记录
* @param id:主键ID 创建订单接口的result
* @param brandId:品牌ID
* @param studioId:场馆ID
* @param operatorId:操作人ID
* @author: yangfangfang
**/
public
JSONObject
listByVoucherId
(
String
id
,
String
brandId
,
String
studioId
,
String
operatorId
,
DataUserInfo
...
dataUserInfos
){
public
JSONObject
listByVoucherId
(
String
id
,
DataUserInfo
...
dataUserInfos
){
dataApi
.
setApiModule
(
ApiModule
.
Polar_Finance
)
.
setApiName
(
"API_listByVoucherId"
)
...
...
@@ -470,9 +451,9 @@ public class OrderTools extends XMBaseTest {
JSONObject
jsonObject
=
new
JSONObject
();
jsonObject
.
put
(
"id"
,
id
);
jsonObject
.
put
(
"brandId"
,
brandId
);
jsonObject
.
put
(
"studioId"
,
studioId
);
jsonObject
.
put
(
"operatorId"
,
operatorId
);
jsonObject
.
put
(
"brandId"
,
dataApi
.
getLoginInfo
().
getBrandId
()
);
jsonObject
.
put
(
"studioId"
,
dataApi
.
getLoginInfo
().
getStudioId
()
);
jsonObject
.
put
(
"operatorId"
,
dataApi
.
getLoginInfo
().
getAdminId
()
);
dataApi
.
doRequest
(
RequestType
.
JSON
,
dataparams
,
jsonObject
.
toJSONString
(),
dataheadrs
).
assetsSuccess
(
true
);
JSONObject
response
=
dataApi
.
getBodyInJSON
();
...
...
@@ -490,7 +471,7 @@ public class OrderTools extends XMBaseTest {
* @param operatorId:操作人ID
* @author: yangfangfang
**/
public
JSONObject
modifySupplierInnerMemo
(
String
voucherId
,
String
supplierInnerMemo
,
String
brandId
,
String
studioId
,
String
operatorId
,
DataUserInfo
...
dataUserInfos
){
public
JSONObject
modifySupplierInnerMemo
(
String
voucherId
,
String
supplierInnerMemo
,
DataUserInfo
...
dataUserInfos
){
dataApi
.
setApiModule
(
ApiModule
.
Polar_Finance
)
.
setApiName
(
"API_modifySupplierInnerMemo"
)
...
...
@@ -500,9 +481,9 @@ public class OrderTools extends XMBaseTest {
JSONObject
jsonObject
=
new
JSONObject
();
jsonObject
.
put
(
"voucherId"
,
voucherId
);
jsonObject
.
put
(
"supplierInnerMemo"
,
supplierInnerMemo
);
jsonObject
.
put
(
"brandId"
,
brandId
);
jsonObject
.
put
(
"studioId"
,
studioId
);
jsonObject
.
put
(
"operatorId"
,
operatorId
);
jsonObject
.
put
(
"brandId"
,
dataApi
.
getLoginInfo
().
getBrandId
()
);
jsonObject
.
put
(
"studioId"
,
dataApi
.
getLoginInfo
().
getStudioId
()
);
jsonObject
.
put
(
"operatorId"
,
dataApi
.
getLoginInfo
().
getAdminId
()
);
dataApi
.
doRequest
(
RequestType
.
JSON
,
dataparams
,
jsonObject
.
toJSONString
(),
dataheadrs
).
assetsSuccess
(
true
);
JSONObject
response
=
dataApi
.
getBodyInJSON
();
...
...
@@ -519,7 +500,7 @@ public class OrderTools extends XMBaseTest {
* @param operatorId:操作人ID
* @author: yangfangfang
**/
public
JSONObject
modifySupplierMemo
(
String
voucherId
,
String
supplierMemo
,
String
brandId
,
String
studioId
,
String
operatorId
,
DataUserInfo
...
dataUserInfos
){
public
JSONObject
modifySupplierMemo
(
String
voucherId
,
String
supplierMemo
,
DataUserInfo
...
dataUserInfos
){
dataApi
.
setApiModule
(
ApiModule
.
Polar_Finance
)
.
setApiName
(
"API_modifySupplierMemo"
)
...
...
@@ -529,9 +510,9 @@ public class OrderTools extends XMBaseTest {
JSONObject
jsonObject
=
new
JSONObject
();
jsonObject
.
put
(
"voucherId"
,
voucherId
);
jsonObject
.
put
(
"supplierMemo"
,
supplierMemo
);
jsonObject
.
put
(
"brandId"
,
brandId
);
jsonObject
.
put
(
"studioId"
,
studioId
);
jsonObject
.
put
(
"operatorId"
,
operatorId
);
jsonObject
.
put
(
"brandId"
,
dataApi
.
getLoginInfo
().
getBrandId
()
);
jsonObject
.
put
(
"studioId"
,
dataApi
.
getLoginInfo
().
getStudioId
()
);
jsonObject
.
put
(
"operatorId"
,
dataApi
.
getLoginInfo
().
getAdminId
()
);
dataApi
.
doRequest
(
RequestType
.
JSON
,
dataparams
,
jsonObject
.
toJSONString
(),
dataheadrs
).
assetsSuccess
(
true
);
JSONObject
response
=
dataApi
.
getBodyInJSON
();
...
...
@@ -547,7 +528,7 @@ public class OrderTools extends XMBaseTest {
* @param operatorId:操作人ID
* @author: yangfangfang
**/
public
JSONObject
checkDiscardVoucher
(
String
id
,
String
brandId
,
String
studioId
,
String
operatorId
,
DataUserInfo
...
dataUserInfos
){
public
JSONObject
checkDiscardVoucher
(
String
id
,
DataUserInfo
...
dataUserInfos
){
dataApi
.
setApiModule
(
ApiModule
.
Polar_Finance
)
.
setApiName
(
"API_checkDiscardVoucher"
)
...
...
@@ -556,9 +537,9 @@ public class OrderTools extends XMBaseTest {
JSONObject
jsonObject
=
new
JSONObject
();
jsonObject
.
put
(
"id"
,
id
);
jsonObject
.
put
(
"brandId"
,
brandId
);
jsonObject
.
put
(
"studioId"
,
studioId
);
jsonObject
.
put
(
"operatorId"
,
operatorId
);
jsonObject
.
put
(
"brandId"
,
dataApi
.
getLoginInfo
().
getBrandId
()
);
jsonObject
.
put
(
"studioId"
,
dataApi
.
getLoginInfo
().
getStudioId
()
);
jsonObject
.
put
(
"operatorId"
,
dataApi
.
getLoginInfo
().
getAdminId
()
);
dataApi
.
doRequest
(
RequestType
.
JSON
,
dataparams
,
jsonObject
.
toJSONString
(),
dataheadrs
).
assetsSuccess
(
true
);
JSONObject
response
=
dataApi
.
getBodyInJSON
();
...
...
@@ -569,12 +550,9 @@ public class OrderTools extends XMBaseTest {
* @param
* @description:作废订单
* @param id:主键ID 创建订单接口的result 订单id
* @param brandId:品牌ID
* @param studioId:场馆ID
* @param operatorId:操作人ID
* @author: yangfangfang
**/
public
JSONObject
discard
(
String
id
,
String
discardCause
,
String
discardMemo
,
String
brandId
,
String
studioId
,
String
operatorId
,
DataUserInfo
...
dataUserInfos
){
public
JSONObject
discard
(
String
id
,
String
discardCause
,
String
discardMemo
,
DataUserInfo
...
dataUserInfos
){
dataApi
.
setApiModule
(
ApiModule
.
Polar_Finance
)
.
setApiName
(
"API_discard"
)
...
...
@@ -585,9 +563,9 @@ public class OrderTools extends XMBaseTest {
jsonObject
.
put
(
"id"
,
id
);
jsonObject
.
put
(
"discardCause"
,
discardCause
);
jsonObject
.
put
(
"discardMemo"
,
discardMemo
);
jsonObject
.
put
(
"brandId"
,
brandId
);
jsonObject
.
put
(
"studioId"
,
studioId
);
jsonObject
.
put
(
"operatorId"
,
operatorId
);
jsonObject
.
put
(
"brandId"
,
dataApi
.
getLoginInfo
().
getBrandId
()
);
jsonObject
.
put
(
"studioId"
,
dataApi
.
getLoginInfo
().
getStudioId
()
);
jsonObject
.
put
(
"operatorId"
,
dataApi
.
getLoginInfo
().
getAdminId
()
);
dataApi
.
doRequest
(
RequestType
.
JSON
,
dataparams
,
jsonObject
.
toJSONString
(),
dataheadrs
).
assetsSuccess
(
true
);
JSONObject
response
=
dataApi
.
getBodyInJSON
();
...
...
@@ -600,12 +578,9 @@ public class OrderTools extends XMBaseTest {
* @param
* @description:取消订单
* @param id:主键ID 创建订单接口的result 订单id
* @param brandId:品牌ID
* @param studioId:场馆ID
* @param operatorId:操作人ID
* @author: yangfangfang
**/
public
JSONObject
cancel
(
String
id
,
String
brandId
,
String
studioId
,
String
operatorId
,
DataUserInfo
...
dataUserInfos
){
public
JSONObject
cancel
(
String
id
,
DataUserInfo
...
dataUserInfos
){
dataApi
.
setApiModule
(
ApiModule
.
Polar_Finance
)
.
setApiName
(
"API_cancel"
)
...
...
@@ -614,9 +589,169 @@ public class OrderTools extends XMBaseTest {
JSONObject
jsonObject
=
new
JSONObject
();
jsonObject
.
put
(
"id"
,
id
);
jsonObject
.
put
(
"brandId"
,
brandId
);
jsonObject
.
put
(
"studioId"
,
studioId
);
jsonObject
.
put
(
"operatorId"
,
operatorId
);
jsonObject
.
put
(
"brandId"
,
dataApi
.
getLoginInfo
().
getBrandId
());
jsonObject
.
put
(
"studioId"
,
dataApi
.
getLoginInfo
().
getStudioId
());
jsonObject
.
put
(
"operatorId"
,
dataApi
.
getLoginInfo
().
getAdminId
());
dataApi
.
doRequest
(
RequestType
.
JSON
,
dataparams
,
jsonObject
.
toJSONString
(),
dataheadrs
).
assetsSuccess
(
true
);
JSONObject
response
=
dataApi
.
getBodyInJSON
();
return
response
;
}
/**
* @param
* @description:查询订单或者收支可退流水金额(包含乐动收银状态信息
* @param voucherId:订单id
* @param shouldRefundAmount:应退金额
* @author: yangfangfang
**/
public
JSONObject
checkRefundableAmount
(
String
voucherId
,
float
shouldRefundAmount
,
DataUserInfo
...
dataUserInfos
){
dataApi
.
setApiModule
(
ApiModule
.
Polar_Finance
)
.
setApiName
(
"API_checkRefundableAmount"
)
.
setTerminal
(
Terminal
.
B
);
super
.
beforeDataRequest
(
dataUserInfos
);
JSONObject
jsonObject
=
new
JSONObject
();
jsonObject
.
put
(
"voucherId"
,
voucherId
);
jsonObject
.
put
(
"shouldRefundAmount"
,
shouldRefundAmount
);
jsonObject
.
put
(
"brandId"
,
dataApi
.
getLoginInfo
().
getBrandId
());
jsonObject
.
put
(
"studioId"
,
dataApi
.
getLoginInfo
().
getStudioId
());
jsonObject
.
put
(
"operatorId"
,
dataApi
.
getLoginInfo
().
getAdminId
());
dataApi
.
doRequest
(
RequestType
.
JSON
,
dataparams
,
jsonObject
.
toJSONString
(),
dataheadrs
).
assetsSuccess
(
true
);
JSONObject
response
=
dataApi
.
getBodyInJSON
();
return
response
;
}
/**
* @param
* @description:退单
* @param giftQuantity:退出赠送数量
* @param memberCardId:会员的卡id 从listUserRefundableCard中的id获取 不是买的时候的卡id
* @param quantity:退出购买数量
* @param refundAmount:退出金额
* @param commodityCardType:卡商品类型[ MEMBER_CARD, EXPERIENCE_CARD, DEPOSIT_CARD ]
* @param memberId:会员ID
* @param receivableAmount:应退金额
* @param amount:支付金额
* @param paymentWay:支付方式
* @author: yangfangfang
**/
public
JSONObject
refundOrder
(
int
giftQuantity
,
String
memberCardId
,
int
quantity
,
float
refundAmount
,
String
commodityCardType
,
String
memberId
,
float
receivableAmount
,
float
amount
,
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
(
"refundAmount"
,
refundAmount
);
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
jsonObject1
=
new
JSONObject
();
jsonObject1
.
put
(
"amount"
,
amount
);
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
* @description:查询用户可退的会员卡列表
* @param accountType:账户类型 [ MEMBER, TRAINING, EXPERIENCE, SINGLE_RESERVE, DEPOSIT ]
* @param content:搜索内容
* @param memberId:搜索内容
* @author: yangfangfang
**/
public
JSONObject
listUserRefundableCard
(
String
accountType
,
String
content
,
String
memberId
,
DataUserInfo
...
dataUserInfos
){
dataApi
.
setApiModule
(
ApiModule
.
Polar_Card
)
.
setApiName
(
"API_listUserRefundableCard"
)
.
setTerminal
(
Terminal
.
B
);
super
.
beforeDataRequest
(
dataUserInfos
);
JSONObject
jsonObject
=
new
JSONObject
();
jsonObject
.
put
(
"accountType"
,
accountType
);
jsonObject
.
put
(
"content"
,
content
);
jsonObject
.
put
(
"memberId"
,
memberId
);
jsonObject
.
put
(
"brandId"
,
dataApi
.
getLoginInfo
().
getBrandId
());
jsonObject
.
put
(
"studioId"
,
dataApi
.
getLoginInfo
().
getStudioId
());
jsonObject
.
put
(
"operatorId"
,
dataApi
.
getLoginInfo
().
getAdminId
());
dataApi
.
doRequest
(
RequestType
.
JSON
,
dataparams
,
jsonObject
.
toJSONString
(),
dataheadrs
).
assetsSuccess
(
true
);
JSONObject
response
=
dataApi
.
getBodyInJSON
();
return
response
;
}
/**
* @param
* @description:继续收款
* @param unpaidAmount:欠费金额
* @param getDetailId:订单ID
* @param paymentWay:支付方式 1-线下微信 2 3
* @author: yangfangfang
**/
public
JSONObject
pay
(
float
unpaidAmount
,
String
paymentWay
,
String
getDetailId
,
DataUserInfo
...
dataUserInfos
){
dataApi
.
setApiModule
(
ApiModule
.
Polar_Finance
)
.
setApiName
(
"API_pay"
)
.
setTerminal
(
Terminal
.
B
);
super
.
beforeDataRequest
(
dataUserInfos
);
JSONObject
jsonObject
=
new
JSONObject
();
jsonObject
.
put
(
"operationTime"
,
TimeUtils
.
getCurrentTime
());
jsonObject
.
put
(
"operatorId"
,
dataApi
.
getLoginInfo
().
getAdminId
());
JSONArray
paymentWays
=
new
JSONArray
();
JSONObject
jsonObject1
=
new
JSONObject
();
jsonObject1
.
put
(
"amount"
,
unpaidAmount
);
jsonObject1
.
put
(
"paymentWay"
,
paymentWay
);
JSONArray
voucherResourceIds
=
new
JSONArray
();
voucherResourceIds
.
add
(
""
);
jsonObject1
.
put
(
"voucherResourceIds"
,
voucherResourceIds
);
paymentWays
.
add
(
jsonObject1
);
jsonObject
.
put
(
"paymentWays"
,
paymentWays
);
jsonObject
.
put
(
"voucherId"
,
getDetailId
);
jsonObject
.
put
(
"brandId"
,
dataApi
.
getLoginInfo
().
getBrandId
());
jsonObject
.
put
(
"studioId"
,
dataApi
.
getLoginInfo
().
getStudioId
());
dataApi
.
doRequest
(
RequestType
.
JSON
,
dataparams
,
jsonObject
.
toJSONString
(),
dataheadrs
).
assetsSuccess
(
true
);
JSONObject
response
=
dataApi
.
getBodyInJSON
();
...
...
src/main/java/com/xiaomai/cases/polar/finance/order/TestCancel.java
View file @
1ac0654d
...
...
@@ -56,11 +56,11 @@ public class TestCancel extends XMBaseTest {
}
//获取会员卡信息
//获取会员卡列表
int
cardTotal
=
Integer
.
parseInt
(
orderTools
.
fetchPageOfMemberCard
(
xmAppApi
.
getLoginInfo
().
getBrandId
(),
xmAppApi
.
getLoginInfo
().
getStudioId
(),
xmAppApi
.
getLoginInfo
().
getAdminId
()
).
getJSONObject
(
"result"
).
getString
(
"total"
));
int
cardTotal
=
Integer
.
parseInt
(
orderTools
.
fetchPageOfMemberCard
().
getJSONObject
(
"result"
).
getString
(
"total"
));
if
(
cardTotal
==
0
)
{
cardId
=
cardTools
.
memberCardCreate
(
"创建订单会员卡"
+
TimeUtils
.
getCurrentTime
()).
getString
(
"result"
);
}
JSONObject
memberCard
=
orderTools
.
fetchPageOfMemberCard
(
xmAppApi
.
getLoginInfo
().
getBrandId
(),
xmAppApi
.
getLoginInfo
().
getStudioId
(),
xmAppApi
.
getLoginInfo
().
getAdminId
()
);
JSONObject
memberCard
=
orderTools
.
fetchPageOfMemberCard
();
cardId
=
memberCard
.
getJSONObject
(
"result"
).
getJSONArray
(
"records"
).
getJSONObject
(
0
).
getString
(
"id"
);
int
quantity
=
Integer
.
parseInt
(
memberCard
.
getJSONObject
(
"result"
).
getJSONArray
(
"records"
).
getJSONObject
(
0
).
getString
(
"balance"
));
float
price
=
Float
.
parseFloat
(
memberCard
.
getJSONObject
(
"result"
).
getJSONArray
(
"records"
).
getJSONObject
(
0
).
getString
(
"price"
));
...
...
@@ -102,7 +102,7 @@ public class TestCancel extends XMBaseTest {
//获取订单详情
JSONObject
getDetailResult
=
orderTools
.
getDetail
(
getDetailId
,
xmAppApi
.
getLoginInfo
().
getBrandId
(),
xmAppApi
.
getLoginInfo
().
getStudioId
(),
xmAppApi
.
getLoginInfo
().
getAdminId
()
);
JSONObject
getDetailResult
=
orderTools
.
getDetail
(
getDetailId
);
String
id
=
getDetailResult
.
getJSONObject
(
"result"
).
getString
(
"id"
);
//订单id
String
state
=
getDetailResult
.
getJSONObject
(
"result"
).
getString
(
"state"
);
...
...
@@ -111,12 +111,12 @@ public class TestCancel extends XMBaseTest {
//取消订单
JSONObject
cancel
=
orderTools
.
cancel
(
getDetailId
,
xmAppApi
.
getLoginInfo
().
getBrandId
(),
xmAppApi
.
getLoginInfo
().
getStudioId
(),
xmAppApi
.
getLoginInfo
().
getAdminId
()
);
JSONObject
cancel
=
orderTools
.
cancel
(
getDetailId
);
String
cancelSuccess
=
cancel
.
getString
(
"success"
);
Assert
.
assertEquals
(
cancelSuccess
,
"true"
,
"取消待支付订单失败"
);
//获取订单详情
JSONObject
getDetailResult1
=
orderTools
.
getDetail
(
getDetailId
,
xmAppApi
.
getLoginInfo
().
getBrandId
(),
xmAppApi
.
getLoginInfo
().
getStudioId
(),
xmAppApi
.
getLoginInfo
().
getAdminId
()
);
JSONObject
getDetailResult1
=
orderTools
.
getDetail
(
getDetailId
);
String
id1
=
getDetailResult1
.
getJSONObject
(
"result"
).
getString
(
"id"
);
//订单id
String
state1
=
getDetailResult1
.
getJSONObject
(
"result"
).
getString
(
"state"
);
...
...
src/main/java/com/xiaomai/cases/polar/finance/order/TestDiscard.java
View file @
1ac0654d
...
...
@@ -58,11 +58,11 @@ public class TestDiscard extends XMBaseTest {
}
//获取会员卡信息
//获取会员卡列表
int
cardTotal
=
Integer
.
parseInt
(
orderTools
.
fetchPageOfMemberCard
(
xmAppApi
.
getLoginInfo
().
getBrandId
(),
xmAppApi
.
getLoginInfo
().
getStudioId
(),
xmAppApi
.
getLoginInfo
().
getAdminId
()
).
getJSONObject
(
"result"
).
getString
(
"total"
));
int
cardTotal
=
Integer
.
parseInt
(
orderTools
.
fetchPageOfMemberCard
().
getJSONObject
(
"result"
).
getString
(
"total"
));
if
(
cardTotal
==
0
)
{
cardId
=
cardTools
.
memberCardCreate
(
"创建订单会员卡"
+
TimeUtils
.
getCurrentTime
()).
getString
(
"result"
);
}
JSONObject
memberCard
=
orderTools
.
fetchPageOfMemberCard
(
xmAppApi
.
getLoginInfo
().
getBrandId
(),
xmAppApi
.
getLoginInfo
().
getStudioId
(),
xmAppApi
.
getLoginInfo
().
getAdminId
()
);
JSONObject
memberCard
=
orderTools
.
fetchPageOfMemberCard
();
cardId
=
memberCard
.
getJSONObject
(
"result"
).
getJSONArray
(
"records"
).
getJSONObject
(
0
).
getString
(
"id"
);
int
quantity
=
Integer
.
parseInt
(
memberCard
.
getJSONObject
(
"result"
).
getJSONArray
(
"records"
).
getJSONObject
(
0
).
getString
(
"balance"
));
float
price
=
Float
.
parseFloat
(
memberCard
.
getJSONObject
(
"result"
).
getJSONArray
(
"records"
).
getJSONObject
(
0
).
getString
(
"price"
));
...
...
@@ -109,7 +109,7 @@ public class TestDiscard extends XMBaseTest {
}
//获取订单详情
JSONObject
getDetailResult
=
orderTools
.
getDetail
(
getDetailId
,
xmAppApi
.
getLoginInfo
().
getBrandId
(),
xmAppApi
.
getLoginInfo
().
getStudioId
(),
xmAppApi
.
getLoginInfo
().
getAdminId
()
);
JSONObject
getDetailResult
=
orderTools
.
getDetail
(
getDetailId
);
String
id
=
getDetailResult
.
getJSONObject
(
"result"
).
getString
(
"id"
);
String
businessNo
=
getDetailResult
.
getJSONObject
(
"result"
).
getString
(
"businessNo"
);
Assert
.
assertEquals
(
id
.
equals
(
getDetailId
),
true
,
"获取创建的订单详情失败"
);
...
...
@@ -117,7 +117,7 @@ public class TestDiscard extends XMBaseTest {
//校验是否可以作废订单
boolean
checkDiscardVoucherResult
=
orderTools
.
checkDiscardVoucher
(
getDetailId
,
xmAppApi
.
getLoginInfo
().
getBrandId
(),
xmAppApi
.
getLoginInfo
().
getStudioId
(),
xmAppApi
.
getLoginInfo
().
getAdminId
()
).
getBoolean
(
"success"
);
boolean
checkDiscardVoucherResult
=
orderTools
.
checkDiscardVoucher
(
getDetailId
).
getBoolean
(
"success"
);
try
{
Thread
.
sleep
(
1000
);
...
...
@@ -127,15 +127,14 @@ public class TestDiscard extends XMBaseTest {
if
(
checkDiscardVoucherResult
==
true
){
JSONObject
discardResult
=
orderTools
.
discard
(
getDetailId
,
"重复录入"
,
"已作废签单订单"
+
RandomStringUtil
.
randomString
(
10
),
xmAppApi
.
getLoginInfo
().
getBrandId
(),
xmAppApi
.
getLoginInfo
().
getStudioId
(),
xmAppApi
.
getLoginInfo
().
getAdminId
());
JSONObject
discardResult
=
orderTools
.
discard
(
getDetailId
,
"重复录入"
,
"已作废签单订单"
+
RandomStringUtil
.
randomString
(
10
));
String
discardSuccess
=
discardResult
.
getString
(
"success"
);
Assert
.
assertEquals
(
discardSuccess
,
"true"
,
"签单订单作废失败"
);
//验证订单状态
//获取订单详情--订单状态:已作废
JSONObject
getDetailResult1
=
orderTools
.
getDetail
(
getDetailId
,
xmAppApi
.
getLoginInfo
().
getBrandId
(),
xmAppApi
.
getLoginInfo
().
getStudioId
(),
xmAppApi
.
getLoginInfo
().
getAdminId
()
);
JSONObject
getDetailResult1
=
orderTools
.
getDetail
(
getDetailId
);
String
state
=
getDetailResult1
.
getJSONObject
(
"result"
).
getString
(
"state"
);
Assert
.
assertEquals
(
state
,
"DISCARD"
,
"签单订单作废失败"
);
...
...
@@ -147,7 +146,7 @@ public class TestDiscard extends XMBaseTest {
}
//获取订单支付记录--支付记录被作废
JSONObject
listByVoucherIdResult
=
orderTools
.
listByVoucherId
(
getDetailId
,
xmAppApi
.
getLoginInfo
().
getBrandId
(),
xmAppApi
.
getLoginInfo
().
getStudioId
(),
xmAppApi
.
getLoginInfo
().
getAdminId
()
);
JSONObject
listByVoucherIdResult
=
orderTools
.
listByVoucherId
(
getDetailId
);
String
listByVoucherId
=
listByVoucherIdResult
.
getJSONArray
(
"result"
).
getJSONObject
(
0
).
getString
(
"id"
);
//收支的id
String
listByVoucherState
=
listByVoucherIdResult
.
getJSONArray
(
"result"
).
getJSONObject
(
0
).
getString
(
"state"
);
String
paymentWayId
=
listByVoucherIdResult
.
getJSONArray
(
"result"
).
getJSONObject
(
0
).
getJSONObject
(
"paymentWay"
).
getString
(
"id"
);
...
...
@@ -156,7 +155,7 @@ public class TestDiscard extends XMBaseTest {
//获取已作废收支明细
JSONObject
pageDiscardIncomeExpenseResult
=
revenueAndExpenditureTools
.
pageDiscardIncomeExpense
(
paymentWayId
,
"INCOME"
,
"SIGN"
,
xmAppApi
.
getLoginInfo
().
getStudioId
()
,
xmAppApi
.
getLoginInfo
().
getBrandId
(),
xmAppApi
.
getLoginInfo
().
getStudioId
(),
xmAppApi
.
getLoginInfo
().
getAdminId
()
);
xmAppApi
.
getLoginInfo
().
getStudioId
());
int
pageDiscardIncomeExpensePages
=
Integer
.
parseInt
(
pageDiscardIncomeExpenseResult
.
getJSONObject
(
"result"
).
getString
(
"pages"
));
int
pageDiscardIncomeExpenseTotal
=
Integer
.
parseInt
(
pageDiscardIncomeExpenseResult
.
getJSONObject
(
"result"
).
getString
(
"total"
));
...
...
@@ -177,7 +176,7 @@ public class TestDiscard extends XMBaseTest {
}
//获取已作废收支详情
JSONObject
getResult
=
revenueAndExpenditureTools
.
get
(
listByVoucherId
,
xmAppApi
.
getLoginInfo
().
getBrandId
(),
xmAppApi
.
getLoginInfo
().
getStudioId
(),
xmAppApi
.
getLoginInfo
().
getAdminId
()
);
JSONObject
getResult
=
revenueAndExpenditureTools
.
get
(
listByVoucherId
);
String
getBusinessNo
=
getResult
.
getJSONObject
(
"result"
).
getString
(
"businessNo"
);
String
getState
=
getResult
.
getJSONObject
(
"result"
).
getString
(
"state"
);
...
...
src/main/java/com/xiaomai/cases/polar/finance/order/TestModifyMemo.java
View file @
1ac0654d
...
...
@@ -59,11 +59,11 @@ public class TestModifyMemo extends XMBaseTest {
}
//获取会员卡信息
//获取会员卡列表
int
cardTotal
=
Integer
.
parseInt
(
orderTools
.
fetchPageOfMemberCard
(
xmAppApi
.
getLoginInfo
().
getBrandId
(),
xmAppApi
.
getLoginInfo
().
getStudioId
(),
xmAppApi
.
getLoginInfo
().
getAdminId
()
).
getJSONObject
(
"result"
).
getString
(
"total"
));
int
cardTotal
=
Integer
.
parseInt
(
orderTools
.
fetchPageOfMemberCard
().
getJSONObject
(
"result"
).
getString
(
"total"
));
if
(
cardTotal
==
0
)
{
cardId
=
cardTools
.
memberCardCreate
(
"创建订单会员卡"
+
TimeUtils
.
getCurrentTime
()).
getString
(
"result"
);
}
JSONObject
memberCard
=
orderTools
.
fetchPageOfMemberCard
(
xmAppApi
.
getLoginInfo
().
getBrandId
(),
xmAppApi
.
getLoginInfo
().
getStudioId
(),
xmAppApi
.
getLoginInfo
().
getAdminId
()
);
JSONObject
memberCard
=
orderTools
.
fetchPageOfMemberCard
();
cardId
=
memberCard
.
getJSONObject
(
"result"
).
getJSONArray
(
"records"
).
getJSONObject
(
0
).
getString
(
"id"
);
int
quantity
=
Integer
.
parseInt
(
memberCard
.
getJSONObject
(
"result"
).
getJSONArray
(
"records"
).
getJSONObject
(
0
).
getString
(
"balance"
));
float
price
=
Float
.
parseFloat
(
memberCard
.
getJSONObject
(
"result"
).
getJSONArray
(
"records"
).
getJSONObject
(
0
).
getString
(
"price"
));
...
...
@@ -109,7 +109,7 @@ public class TestModifyMemo extends XMBaseTest {
}
//获取订单详情
JSONObject
getDetailResult
=
orderTools
.
getDetail
(
getDetailId
,
xmAppApi
.
getLoginInfo
().
getBrandId
(),
xmAppApi
.
getLoginInfo
().
getStudioId
(),
xmAppApi
.
getLoginInfo
().
getAdminId
()
);
JSONObject
getDetailResult
=
orderTools
.
getDetail
(
getDetailId
);
String
id
=
getDetailResult
.
getJSONObject
(
"result"
).
getString
(
"id"
);
String
businessNo
=
getDetailResult
.
getJSONObject
(
"result"
).
getString
(
"businessNo"
);
Assert
.
assertEquals
(
id
.
equals
(
getDetailId
),
true
,
"获取创建的订单详情失败"
);
...
...
@@ -123,8 +123,7 @@ public class TestModifyMemo extends XMBaseTest {
//修改对内备注
JSONObject
modifySupplierInnerMemoResult
=
orderTools
.
modifySupplierInnerMemo
(
getDetailId
,
"已修改对内备注"
+
RandomStringUtil
.
randomString
(
10
),
xmAppApi
.
getLoginInfo
().
getBrandId
(),
xmAppApi
.
getLoginInfo
().
getStudioId
(),
xmAppApi
.
getLoginInfo
().
getAdminId
());
JSONObject
modifySupplierInnerMemoResult
=
orderTools
.
modifySupplierInnerMemo
(
getDetailId
,
"已修改对内备注"
+
RandomStringUtil
.
randomString
(
10
));
String
modifySupplierInnerMemoSuccess
=
modifySupplierInnerMemoResult
.
getString
(
"success"
);
Assert
.
assertEquals
(
modifySupplierInnerMemoSuccess
,
"true"
,
"修改对内备注失败"
);
...
...
@@ -132,8 +131,7 @@ public class TestModifyMemo extends XMBaseTest {
//修改对外备注
JSONObject
modifySupplierMemoResult
=
orderTools
.
modifySupplierMemo
(
getDetailId
,
"已修改对外备注"
+
RandomStringUtil
.
randomString
(
10
),
xmAppApi
.
getLoginInfo
().
getBrandId
(),
xmAppApi
.
getLoginInfo
().
getStudioId
(),
xmAppApi
.
getLoginInfo
().
getAdminId
());
JSONObject
modifySupplierMemoResult
=
orderTools
.
modifySupplierMemo
(
getDetailId
,
"已修改对外备注"
+
RandomStringUtil
.
randomString
(
10
));
String
modifySupplierMemoResultSuccess
=
modifySupplierMemoResult
.
getString
(
"success"
);
Assert
.
assertEquals
(
modifySupplierMemoResultSuccess
,
"true"
,
"修改对外备注失败"
);
...
...
src/main/java/com/xiaomai/cases/polar/finance/order/TestPay.java
0 → 100644
View file @
1ac0654d
package
com
.
xiaomai
.
cases
.
polar
.
finance
.
order
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
com.xiaomai.cases.polar.member.Tools
;
import
com.xiaomai.cases.polar.memberCard.CardTools
;
import
com.xiaomai.enums.ApiModule
;
import
com.xiaomai.enums.LoginAccount
;
import
com.xiaomai.enums.RequestType
;
import
com.xiaomai.enums.Terminal
;
import
com.xiaomai.utils.RandomStringUtil
;
import
com.xiaomai.utils.TimeUtils
;
import
com.xiaomai.utils.XMBaseTest
;
import
org.testng.Assert
;
import
org.testng.annotations.BeforeMethod
;
import
org.testng.annotations.Test
;
public
class
TestPay
extends
XMBaseTest
{
String
memberId
;
String
cardId
;
Tools
tools
=
new
Tools
();
OrderTools
orderTools
=
new
OrderTools
();
CardTools
cardTools
=
new
CardTools
();
@BeforeMethod
public
void
beforeTest
(){
xmAppApi
.
setApiModule
(
ApiModule
.
Polar_Finance
)
.
setApiName
(
"API_pay"
)
.
setLoginUser
(
LoginAccount
.
GYM_PROD
)
.
setTerminal
(
Terminal
.
B
);
dal
.
setCase_owner
(
"yff"
)
.
setCase_name
(
Thread
.
currentThread
().
getStackTrace
()[
1
].
getFileName
().
split
(
"\\."
)[
0
]);
super
.
beforeTest
();
}
@Test
(
description
=
"收款(继续收款)"
)
public
void
testPay
(){
String
name
=
"创建订单潜在会员"
+
RandomStringUtil
.
randomString
(
3
);
String
phone
=
RandomStringUtil
.
randomMobile
(
"666"
);
//获取会员ID
int
memberTotal
=
Integer
.
parseInt
(
tools
.
search
(
"NORMAL"
,
"NORMAL"
).
getJSONObject
(
"result"
).
getString
(
"total"
));
if
(
memberTotal
==
0
)
{
memberId
=
tools
.
create
(
name
,
phone
).
getString
(
"result"
);
}
memberId
=
tools
.
search
(
"NORMAL"
,
"NORMAL"
).
getJSONObject
(
"result"
).
getJSONArray
(
"records"
).
getJSONObject
(
0
).
getString
(
"id"
);
try
{
Thread
.
sleep
(
1000
);
}
catch
(
InterruptedException
e
)
{
throw
new
RuntimeException
(
e
);
}
//获取会员卡信息
//获取会员卡列表
int
cardTotal
=
Integer
.
parseInt
(
orderTools
.
fetchPageOfMemberCard
().
getJSONObject
(
"result"
).
getString
(
"total"
));
if
(
cardTotal
==
0
)
{
cardId
=
cardTools
.
memberCardCreate
(
"创建订单会员卡"
+
TimeUtils
.
getCurrentTime
()).
getString
(
"result"
);
}
JSONObject
memberCard
=
orderTools
.
fetchPageOfMemberCard
();
cardId
=
memberCard
.
getJSONObject
(
"result"
).
getJSONArray
(
"records"
).
getJSONObject
(
0
).
getString
(
"id"
);
int
quantity
=
Integer
.
parseInt
(
memberCard
.
getJSONObject
(
"result"
).
getJSONArray
(
"records"
).
getJSONObject
(
0
).
getString
(
"balance"
));
float
price
=
Float
.
parseFloat
(
memberCard
.
getJSONObject
(
"result"
).
getJSONArray
(
"records"
).
getJSONObject
(
0
).
getString
(
"price"
));
int
validPeriod
=
Integer
.
parseInt
(
memberCard
.
getJSONObject
(
"result"
).
getJSONArray
(
"records"
).
getJSONObject
(
0
).
getString
(
"validPeriod"
));
try
{
Thread
.
sleep
(
1000
);
}
catch
(
InterruptedException
e
)
{
throw
new
RuntimeException
(
e
);
}
//获取签单要用的卡快照id
String
latestSnapshotId
=
orderTools
.
fetchDetailById
(
cardId
,
xmAppApi
.
getLoginInfo
().
getBrandId
(),
xmAppApi
.
getLoginInfo
().
getStudioId
(),
xmAppApi
.
getLoginInfo
().
getAdminId
()).
getJSONObject
(
"result"
).
getString
(
"latestSnapshotId"
);
try
{
Thread
.
sleep
(
1000
);
}
catch
(
InterruptedException
e
)
{
throw
new
RuntimeException
(
e
);
}
//检查会员对该卡是否超出购买上限
boolean
limitResult
=
orderTools
.
checkAllowPurchase
(
"MEMBER_CARD"
,
cardId
,
memberId
,
"1"
,
xmAppApi
.
getLoginInfo
().
getBrandId
(),
xmAppApi
.
getLoginInfo
().
getStudioId
(),
xmAppApi
.
getLoginInfo
().
getAdminId
()).
getBoolean
(
"success"
);
try
{
Thread
.
sleep
(
1000
);
}
catch
(
InterruptedException
e
)
{
throw
new
RuntimeException
(
e
);
}
if
(
limitResult
==
true
)
{
//创建部分支付订单
JSONObject
orderResult
=
orderTools
.
signOrder
(
cardId
,
latestSnapshotId
,
quantity
,
price
,
validPeriod
,
latestSnapshotId
,
0
,
"PURCHASE"
,
"MEMBER_CARD"
,
memberId
,
price
,
price
/
2
,
"1"
);
String
getDetailId
=
orderResult
.
getString
(
"result"
);
try
{
Thread
.
sleep
(
1000
);
}
catch
(
InterruptedException
e
)
{
throw
new
RuntimeException
(
e
);
}
//获取订单详情
JSONObject
getDetailResult
=
orderTools
.
getDetail
(
getDetailId
);
String
id
=
getDetailResult
.
getJSONObject
(
"result"
).
getString
(
"id"
);
//订单id
String
state
=
getDetailResult
.
getJSONObject
(
"result"
).
getString
(
"state"
);
String
unpaidAmount
=
getDetailResult
.
getJSONObject
(
"result"
).
getString
(
"unpaidAmount"
);
Assert
.
assertEquals
(
id
.
equals
(
getDetailId
),
true
,
"获取创建的订单详情失败"
);
Assert
.
assertEquals
(
state
,
"ARREARS"
,
"获取创建的订单状态未是部分支付"
);
//继续收款
JSONObject
jsonObject
=
new
JSONObject
();
jsonObject
.
put
(
"operationTime"
,
TimeUtils
.
getCurrentTime
());
jsonObject
.
put
(
"operatorId"
,
xmAppApi
.
getLoginInfo
().
getAdminId
());
JSONArray
paymentWays
=
new
JSONArray
();
JSONObject
jsonObject1
=
new
JSONObject
();
jsonObject1
.
put
(
"amount"
,
unpaidAmount
);
jsonObject1
.
put
(
"paymentWay"
,
"1"
);
//线下微信
JSONArray
voucherResourceIds
=
new
JSONArray
();
voucherResourceIds
.
add
(
""
);
jsonObject1
.
put
(
"voucherResourceIds"
,
voucherResourceIds
);
paymentWays
.
add
(
jsonObject1
);
jsonObject
.
put
(
"paymentWays"
,
paymentWays
);
jsonObject
.
put
(
"voucherId"
,
getDetailId
);
jsonObject
.
put
(
"brandId"
,
xmAppApi
.
getLoginInfo
().
getBrandId
());
jsonObject
.
put
(
"studioId"
,
xmAppApi
.
getLoginInfo
().
getStudioId
());
xmAppApi
.
doRequest
(
RequestType
.
JSON
,
params
,
jsonObject
.
toJSONString
(),
headers
).
assetsSuccess
(
true
);
JSONObject
response
=
xmAppApi
.
getBodyInJSON
();
String
result
=
response
.
getString
(
"result"
);
Assert
.
assertEquals
(
result
,
"true"
,
"继续收款失败"
);
try
{
Thread
.
sleep
(
1000
);
}
catch
(
InterruptedException
e
)
{
throw
new
RuntimeException
(
e
);
}
//校验订单状态已完成;继续收款后欠费金额为0;继续收款订单和原部分支付订单为同一个
//获取订单详情
JSONObject
getDetailResult1
=
orderTools
.
getDetail
(
getDetailId
);
String
state1
=
getDetailResult1
.
getJSONObject
(
"result"
).
getString
(
"state"
);
String
unpaidAmount1
=
getDetailResult1
.
getJSONObject
(
"result"
).
getString
(
"unpaidAmount"
);
String
id1
=
getDetailResult1
.
getJSONObject
(
"result"
).
getString
(
"id"
);
Assert
.
assertEquals
(
state1
,
"PAID"
,
"继续收款全部金额后状态未是已完成"
);
Assert
.
assertEquals
(
unpaidAmount1
,
"0.0000"
,
"继续收款全部金额后欠费金额不是0"
);
Assert
.
assertEquals
(
id1
.
equals
(
getDetailId
),
true
,
"继续收款订单不是原部分支付订单"
);
}
}
}
src/main/java/com/xiaomai/cases/polar/finance/order/TestRefundOrder.java
0 → 100644
View file @
1ac0654d
package
com
.
xiaomai
.
cases
.
polar
.
finance
.
order
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
com.xiaomai.cases.polar.finance.revenueAndExpenditure.RevenueAndExpenditureTools
;
import
com.xiaomai.cases.polar.member.Tools
;
import
com.xiaomai.cases.polar.memberCard.CardTools
;
import
com.xiaomai.enums.ApiModule
;
import
com.xiaomai.enums.LoginAccount
;
import
com.xiaomai.enums.Terminal
;
import
com.xiaomai.utils.RandomStringUtil
;
import
com.xiaomai.utils.TimeUtils
;
import
com.xiaomai.utils.XMBaseTest
;
import
org.testng.Assert
;
import
org.testng.annotations.BeforeMethod
;
import
org.testng.annotations.Test
;
public
class
TestRefundOrder
extends
XMBaseTest
{
String
memberId
;
String
cardId
;
Tools
tools
=
new
Tools
();
OrderTools
orderTools
=
new
OrderTools
();
RevenueAndExpenditureTools
revenueAndExpenditureTools
=
new
RevenueAndExpenditureTools
();
CardTools
cardTools
=
new
CardTools
();
@BeforeMethod
public
void
beforeTest
(){
xmAppApi
.
setApiModule
(
ApiModule
.
Polar_Finance
)
.
setApiName
(
"API_refundOrder"
)
.
setLoginUser
(
LoginAccount
.
GYM_PROD
)
.
setTerminal
(
Terminal
.
B
);
dal
.
setCase_owner
(
"yff"
)
.
setCase_name
(
Thread
.
currentThread
().
getStackTrace
()[
1
].
getFileName
().
split
(
"\\."
)[
0
]);
super
.
beforeTest
();
}
@Test
(
description
=
"创建退单订单"
)
public
void
testRefundOrder
(){
//创建订单
String
name
=
"创建订单潜在会员"
+
RandomStringUtil
.
randomString
(
3
);
String
phone
=
RandomStringUtil
.
randomMobile
(
"666"
);
//获取会员ID
int
memberTotal
=
Integer
.
parseInt
(
tools
.
search
(
"NORMAL"
,
"NORMAL"
).
getJSONObject
(
"result"
).
getString
(
"total"
));
if
(
memberTotal
==
0
)
{
memberId
=
tools
.
create
(
name
,
phone
).
getString
(
"result"
);
}
memberId
=
tools
.
search
(
"NORMAL"
,
"NORMAL"
).
getJSONObject
(
"result"
).
getJSONArray
(
"records"
).
getJSONObject
(
0
).
getString
(
"id"
);
try
{
Thread
.
sleep
(
1000
);
}
catch
(
InterruptedException
e
)
{
throw
new
RuntimeException
(
e
);
}
//获取会员卡信息
//获取会员卡列表
int
cardTotal
=
Integer
.
parseInt
(
orderTools
.
fetchPageOfMemberCard
().
getJSONObject
(
"result"
).
getString
(
"total"
));
if
(
cardTotal
==
0
)
{
cardId
=
cardTools
.
memberCardCreate
(
"创建订单会员卡"
+
TimeUtils
.
getCurrentTime
()).
getString
(
"result"
);
}
JSONObject
memberCard
=
orderTools
.
fetchPageOfMemberCard
();
cardId
=
memberCard
.
getJSONObject
(
"result"
).
getJSONArray
(
"records"
).
getJSONObject
(
0
).
getString
(
"id"
);
int
quantity
=
Integer
.
parseInt
(
memberCard
.
getJSONObject
(
"result"
).
getJSONArray
(
"records"
).
getJSONObject
(
0
).
getString
(
"balance"
));
float
price
=
Float
.
parseFloat
(
memberCard
.
getJSONObject
(
"result"
).
getJSONArray
(
"records"
).
getJSONObject
(
0
).
getString
(
"price"
));
int
validPeriod
=
Integer
.
parseInt
(
memberCard
.
getJSONObject
(
"result"
).
getJSONArray
(
"records"
).
getJSONObject
(
0
).
getString
(
"validPeriod"
));
try
{
Thread
.
sleep
(
1000
);
}
catch
(
InterruptedException
e
)
{
throw
new
RuntimeException
(
e
);
}
//获取签单要用的卡快照id
String
latestSnapshotId
=
orderTools
.
fetchDetailById
(
cardId
,
xmAppApi
.
getLoginInfo
().
getBrandId
(),
xmAppApi
.
getLoginInfo
().
getStudioId
(),
xmAppApi
.
getLoginInfo
().
getAdminId
()).
getJSONObject
(
"result"
).
getString
(
"latestSnapshotId"
);
try
{
Thread
.
sleep
(
1000
);
}
catch
(
InterruptedException
e
)
{
throw
new
RuntimeException
(
e
);
}
//检查会员对该卡是否超出购买上限
boolean
limitResult
=
orderTools
.
checkAllowPurchase
(
"MEMBER_CARD"
,
cardId
,
memberId
,
"1"
,
xmAppApi
.
getLoginInfo
().
getBrandId
(),
xmAppApi
.
getLoginInfo
().
getStudioId
(),
xmAppApi
.
getLoginInfo
().
getAdminId
()).
getBoolean
(
"success"
);
try
{
Thread
.
sleep
(
1000
);
}
catch
(
InterruptedException
e
)
{
throw
new
RuntimeException
(
e
);
}
if
(
limitResult
==
true
)
{
//创建订单
JSONObject
orderResult
=
orderTools
.
signOrder
(
cardId
,
latestSnapshotId
,
quantity
,
price
,
validPeriod
,
latestSnapshotId
,
price
/
2
,
"PURCHASE"
,
"MEMBER_CARD"
,
memberId
,
price
-
price
/
2
,
price
-
price
/
2
,
"1"
);
String
success
=
orderResult
.
getString
(
"success"
);
String
getDetailId
=
orderResult
.
getString
(
"result"
);
Assert
.
assertEquals
(
success
,
"true"
,
"创建订单失败"
);
try
{
Thread
.
sleep
(
3000
);
}
catch
(
InterruptedException
e
)
{
throw
new
RuntimeException
(
e
);
}
//查询要退的卡id 从listUserRefundableCard-查询用户可退的会员卡列表中获取
JSONObject
listUserRefundableCardResult
=
orderTools
.
listUserRefundableCard
(
"MEMBER"
,
""
,
memberId
);
String
listUserRefundableId
=
listUserRefundableCardResult
.
getJSONArray
(
"result"
).
getJSONObject
(
0
).
getString
(
"id"
);
//查询订单或者收支可退流水金额(包含乐动收银状态信息)
boolean
checkRefundableAmountResult
=
orderTools
.
checkRefundableAmount
(
getDetailId
,
price
-
price
/
2
).
getBoolean
(
"success"
);
try
{
Thread
.
sleep
(
1000
);
}
catch
(
InterruptedException
e
)
{
throw
new
RuntimeException
(
e
);
}
if
(
checkRefundableAmountResult
==
true
){
//退单-会员卡
JSONObject
refundOrderResult
=
orderTools
.
refundOrder
(
0
,
listUserRefundableId
,
quantity
,
price
-
price
/
2
,
"MEMBER_CARD"
,
memberId
,
price
-
price
/
2
,
price
-
price
/
2
,
"1"
);
String
refundOrderSuccess
=
refundOrderResult
.
getString
(
"success"
);
String
refundOrderGetDetailId
=
orderResult
.
getString
(
"result"
);
Assert
.
assertEquals
(
refundOrderSuccess
,
"true"
,
"创建退单订单失败"
);
try
{
Thread
.
sleep
(
3000
);
}
catch
(
InterruptedException
e
)
{
throw
new
RuntimeException
(
e
);
}
//获取订单详情
JSONObject
getDetailResult
=
orderTools
.
getDetail
(
getDetailId
);
String
id
=
getDetailResult
.
getJSONObject
(
"result"
).
getString
(
"id"
);
String
businessNo
=
getDetailResult
.
getJSONObject
(
"result"
).
getString
(
"businessNo"
);
//退单订单的businessNo
String
state
=
getDetailResult
.
getJSONObject
(
"result"
).
getString
(
"state"
);
Assert
.
assertEquals
(
id
.
equals
(
getDetailId
),
true
,
"获取创建的退单订单详情失败"
);
Assert
.
assertEquals
(
state
,
"PAID"
,
"获取创建的退单订单未完成"
);
//获取订单支付记录
JSONObject
listByVoucherIdResult
=
orderTools
.
listByVoucherId
(
getDetailId
);
String
listByVoucherId
=
listByVoucherIdResult
.
getJSONArray
(
"result"
).
getJSONObject
(
0
).
getString
(
"voucherId"
);
//退单订单的id
String
paymentWayId
=
listByVoucherIdResult
.
getJSONArray
(
"result"
).
getJSONObject
(
0
).
getJSONObject
(
"paymentWay"
).
getString
(
"id"
);
String
listByVoucherState
=
listByVoucherIdResult
.
getJSONArray
(
"result"
).
getJSONObject
(
0
).
getString
(
"state"
);
String
id1
=
listByVoucherIdResult
.
getJSONArray
(
"result"
).
getJSONObject
(
0
).
getString
(
"id"
);
//收支的id
Assert
.
assertEquals
(
listByVoucherId
.
equals
(
getDetailId
),
true
,
"获取创建的退单订单的支付记录失败"
);
Assert
.
assertEquals
(
listByVoucherState
,
"NORMAL"
,
"获取创建的退单订单的支付记录状态未是已完成"
);
//获取订单管理列表
JSONObject
pageVoucherResult
=
orderTools
.
pageVoucher1
(
xmAppApi
.
getLoginInfo
().
getStudioId
(),
businessNo
);
int
total
=
Integer
.
parseInt
(
pageVoucherResult
.
getJSONObject
(
"result"
).
getString
(
"total"
));
Assert
.
assertEquals
(
total
>=
1
,
true
,
"订单管理列表获取创建的退单订单失败"
);
try
{
Thread
.
sleep
(
1000
);
}
catch
(
InterruptedException
e
)
{
throw
new
RuntimeException
(
e
);
}
//获取收支明细
JSONObject
pageNormalIncomeExpenseResult
=
revenueAndExpenditureTools
.
pageNormalIncomeExpense
(
paymentWayId
,
"EXPENSE"
,
"REFUND"
,
xmAppApi
.
getLoginInfo
().
getStudioId
());
int
pageNormalIncomeExpensePages
=
Integer
.
parseInt
(
pageNormalIncomeExpenseResult
.
getJSONObject
(
"result"
).
getString
(
"pages"
));
int
pageNormalIncomeExpenseTotal
=
Integer
.
parseInt
(
pageNormalIncomeExpenseResult
.
getJSONObject
(
"result"
).
getString
(
"total"
));
for
(
int
k
=
0
;
k
==
pageNormalIncomeExpensePages
+
1
;
k
++){
int
n
=
k
==
pageNormalIncomeExpensePages
?
(
pageNormalIncomeExpenseTotal
%
10
==
0
?
10
:
pageNormalIncomeExpenseTotal
%
10
)
:
10
;
JSONArray
records
=
pageNormalIncomeExpenseResult
.
getJSONObject
(
"result"
).
getJSONArray
(
"records"
);
boolean
flag
=
true
;
for
(
int
i
=
0
;
i
<
n
;
i
++){
String
pageNormalIncomeExpenseId
=
records
.
getJSONObject
(
i
).
getString
(
"id"
);
if
(
pageNormalIncomeExpenseId
.
equals
(
id1
)){
flag
=
true
;
break
;
}
}
Assert
.
assertEquals
(
true
,
flag
,
"创建退单订单未生成对应的收支明细"
);
}
//获取收支详情
JSONObject
getResult
=
revenueAndExpenditureTools
.
get
(
id1
);
String
getBusinessNo
=
getResult
.
getJSONObject
(
"result"
).
getString
(
"businessNo"
);
String
getState
=
getResult
.
getJSONObject
(
"result"
).
getString
(
"state"
);
Assert
.
assertEquals
(
getBusinessNo
.
equals
(
businessNo
),
true
,
"获取创建的退单订单的收支详情失败"
);
Assert
.
assertEquals
(
getState
,
"NORMAL"
,
"创建的退单订单的收支明细状态未是已完成"
);
}
else
{
Assert
.
assertEquals
(
checkRefundableAmountResult
,
false
,
"无可退金额"
);
}
}
}
}
src/main/java/com/xiaomai/cases/polar/finance/order/TestSignOrder.java
View file @
1ac0654d
...
...
@@ -60,11 +60,11 @@ public class TestSignOrder extends XMBaseTest {
}
//获取会员卡信息
//获取会员卡列表
int
cardTotal
=
Integer
.
parseInt
(
orderTools
.
fetchPageOfMemberCard
(
xmAppApi
.
getLoginInfo
().
getBrandId
(),
xmAppApi
.
getLoginInfo
().
getStudioId
(),
xmAppApi
.
getLoginInfo
().
getAdminId
()
).
getJSONObject
(
"result"
).
getString
(
"total"
));
int
cardTotal
=
Integer
.
parseInt
(
orderTools
.
fetchPageOfMemberCard
().
getJSONObject
(
"result"
).
getString
(
"total"
));
if
(
cardTotal
==
0
)
{
cardId
=
cardTools
.
memberCardCreate
(
"创建订单会员卡"
+
TimeUtils
.
getCurrentTime
()).
getString
(
"result"
);
}
JSONObject
memberCard
=
orderTools
.
fetchPageOfMemberCard
(
xmAppApi
.
getLoginInfo
().
getBrandId
(),
xmAppApi
.
getLoginInfo
().
getStudioId
(),
xmAppApi
.
getLoginInfo
().
getAdminId
()
);
JSONObject
memberCard
=
orderTools
.
fetchPageOfMemberCard
();
cardId
=
memberCard
.
getJSONObject
(
"result"
).
getJSONArray
(
"records"
).
getJSONObject
(
0
).
getString
(
"id"
);
int
quantity
=
Integer
.
parseInt
(
memberCard
.
getJSONObject
(
"result"
).
getJSONArray
(
"records"
).
getJSONObject
(
0
).
getString
(
"balance"
));
float
price
=
Float
.
parseFloat
(
memberCard
.
getJSONObject
(
"result"
).
getJSONArray
(
"records"
).
getJSONObject
(
0
).
getString
(
"price"
));
...
...
@@ -101,7 +101,7 @@ public class TestSignOrder extends XMBaseTest {
"MEMBER_CARD"
,
memberId
,
price
-
price
/
2
,
price
-
price
/
2
,
"1"
);
String
success
=
orderResult
.
getString
(
"success"
);
String
getDetailId
=
orderResult
.
getString
(
"result"
);
Assert
.
assertEquals
(
success
,
"true"
,
"创建订单失败"
);
Assert
.
assertEquals
(
success
,
"true"
,
"创建
签单
订单失败"
);
try
{
Thread
.
sleep
(
3000
);
...
...
@@ -110,30 +110,30 @@ public class TestSignOrder extends XMBaseTest {
}
//获取订单详情
JSONObject
getDetailResult
=
orderTools
.
getDetail
(
getDetailId
,
xmAppApi
.
getLoginInfo
().
getBrandId
(),
xmAppApi
.
getLoginInfo
().
getStudioId
(),
xmAppApi
.
getLoginInfo
().
getAdminId
()
);
JSONObject
getDetailResult
=
orderTools
.
getDetail
(
getDetailId
);
String
id
=
getDetailResult
.
getJSONObject
(
"result"
).
getString
(
"id"
);
String
businessNo
=
getDetailResult
.
getJSONObject
(
"result"
).
getString
(
"businessNo"
);
String
state
=
getDetailResult
.
getJSONObject
(
"result"
).
getString
(
"state"
);
Assert
.
assertEquals
(
id
.
equals
(
getDetailId
),
true
,
"获取创建的订单详情失败"
);
Assert
.
assertEquals
(
state
,
"PAID"
,
"获取创建的订单未完成"
);
Assert
.
assertEquals
(
id
.
equals
(
getDetailId
),
true
,
"获取创建的
签单
订单详情失败"
);
Assert
.
assertEquals
(
state
,
"PAID"
,
"获取创建的
签单
订单未完成"
);
//获取订单支付记录
JSONObject
listByVoucherIdResult
=
orderTools
.
listByVoucherId
(
getDetailId
,
xmAppApi
.
getLoginInfo
().
getBrandId
(),
xmAppApi
.
getLoginInfo
().
getStudioId
(),
xmAppApi
.
getLoginInfo
().
getAdminId
()
);
JSONObject
listByVoucherIdResult
=
orderTools
.
listByVoucherId
(
getDetailId
);
String
listByVoucherId
=
listByVoucherIdResult
.
getJSONArray
(
"result"
).
getJSONObject
(
0
).
getString
(
"voucherId"
);
//订单的id
String
paymentWayId
=
listByVoucherIdResult
.
getJSONArray
(
"result"
).
getJSONObject
(
0
).
getJSONObject
(
"paymentWay"
).
getString
(
"id"
);
String
listByVoucherState
=
listByVoucherIdResult
.
getJSONArray
(
"result"
).
getJSONObject
(
0
).
getString
(
"state"
);
String
id1
=
listByVoucherIdResult
.
getJSONArray
(
"result"
).
getJSONObject
(
0
).
getString
(
"id"
);
//收支的id
Assert
.
assertEquals
(
listByVoucherId
.
equals
(
getDetailId
),
true
,
"获取创建的订单的支付记录失败"
);
Assert
.
assertEquals
(
listByVoucherState
,
"NORMAL"
,
"获取创建的订单的支付记录状态未是已完成"
);
Assert
.
assertEquals
(
listByVoucherId
.
equals
(
getDetailId
),
true
,
"获取创建的
签单
订单的支付记录失败"
);
Assert
.
assertEquals
(
listByVoucherState
,
"NORMAL"
,
"获取创建的
签单
订单的支付记录状态未是已完成"
);
//获取订单管理列表
JSONObject
pageVoucherResult
=
orderTools
.
pageVoucher1
(
xmAppApi
.
getLoginInfo
().
getStudioId
(),
xmAppApi
.
getLoginInfo
().
getBrandId
(),
xmAppApi
.
getLoginInfo
().
getStudioId
(),
xmAppApi
.
getLoginInfo
().
getAdminId
(),
businessNo
);
JSONObject
pageVoucherResult
=
orderTools
.
pageVoucher1
(
xmAppApi
.
getLoginInfo
().
getStudioId
(),
businessNo
);
int
total
=
Integer
.
parseInt
(
pageVoucherResult
.
getJSONObject
(
"result"
).
getString
(
"total"
));
Assert
.
assertEquals
(
total
>=
1
,
true
,
"订单管理列表获取创建的订单失败"
);
Assert
.
assertEquals
(
total
>=
1
,
true
,
"订单管理列表获取创建的
签单
订单失败"
);
try
{
Thread
.
sleep
(
1000
);
...
...
@@ -143,7 +143,7 @@ public class TestSignOrder extends XMBaseTest {
//获取收支明细
JSONObject
pageNormalIncomeExpenseResult
=
revenueAndExpenditureTools
.
pageNormalIncomeExpense
(
paymentWayId
,
"INCOME"
,
"SIGN"
,
xmAppApi
.
getLoginInfo
().
getStudioId
()
,
xmAppApi
.
getLoginInfo
().
getBrandId
(),
xmAppApi
.
getLoginInfo
().
getStudioId
(),
xmAppApi
.
getLoginInfo
().
getAdminId
()
);
xmAppApi
.
getLoginInfo
().
getStudioId
());
int
pageNormalIncomeExpensePages
=
Integer
.
parseInt
(
pageNormalIncomeExpenseResult
.
getJSONObject
(
"result"
).
getString
(
"pages"
));
int
pageNormalIncomeExpenseTotal
=
Integer
.
parseInt
(
pageNormalIncomeExpenseResult
.
getJSONObject
(
"result"
).
getString
(
"total"
));
...
...
@@ -159,15 +159,15 @@ public class TestSignOrder extends XMBaseTest {
break
;
}
}
Assert
.
assertEquals
(
true
,
flag
,
"创建订单未生成对应的收支明细"
);
Assert
.
assertEquals
(
true
,
flag
,
"创建
签单
订单未生成对应的收支明细"
);
}
//获取收支详情
JSONObject
getResult
=
revenueAndExpenditureTools
.
get
(
id1
,
xmAppApi
.
getLoginInfo
().
getBrandId
(),
xmAppApi
.
getLoginInfo
().
getStudioId
(),
xmAppApi
.
getLoginInfo
().
getAdminId
()
);
JSONObject
getResult
=
revenueAndExpenditureTools
.
get
(
id1
);
String
getBusinessNo
=
getResult
.
getJSONObject
(
"result"
).
getString
(
"businessNo"
);
String
getState
=
getResult
.
getJSONObject
(
"result"
).
getString
(
"state"
);
Assert
.
assertEquals
(
getBusinessNo
.
equals
(
businessNo
),
true
,
"获取创建的订单的收支详情失败"
);
Assert
.
assertEquals
(
getState
,
"NORMAL"
,
"创建的订单的收支明细状态未是已完成"
);
Assert
.
assertEquals
(
getBusinessNo
.
equals
(
businessNo
),
true
,
"获取创建的
签单
订单的收支详情失败"
);
Assert
.
assertEquals
(
getState
,
"NORMAL"
,
"创建的
签单
订单的收支明细状态未是已完成"
);
}
...
...
src/main/java/com/xiaomai/cases/polar/finance/revenueAndExpenditure/ResourceUtil.java
0 → 100644
View file @
1ac0654d
package
com
.
xiaomai
.
cases
.
polar
.
finance
.
revenueAndExpenditure
;
import
org.apache.http.Consts
;
import
org.apache.http.HttpEntity
;
import
org.apache.http.HttpResponse
;
import
org.apache.http.client.config.RequestConfig
;
import
org.apache.http.client.methods.HttpPost
;
import
org.apache.http.entity.ContentType
;
import
org.apache.http.entity.mime.HttpMultipartMode
;
import
org.apache.http.entity.mime.MultipartEntityBuilder
;
import
org.apache.http.entity.mime.content.StringBody
;
import
org.apache.http.impl.client.CloseableHttpClient
;
import
org.apache.http.impl.client.HttpClients
;
import
org.apache.log4j.Logger
;
import
java.io.BufferedReader
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.io.InputStreamReader
;
/**
* @Author adu
* @Description 传文件留到阿里云oss
* @Date 13:13 2021-04-22
*/
public
class
ResourceUtil
{
public
static
final
Logger
logger
=
Logger
.
getLogger
(
ResourceUtil
.
class
);
public
static
final
String
OSS_ACCESS_KEY_ID
=
"OSSAccessKeyId"
;
public
static
final
String
POLICY
=
"policy"
;
public
static
final
String
SIGNATURE
=
"Signature"
;
public
static
final
String
KEY
=
"key"
;
public
static
final
String
SUCCESS_ACTION_STATUS
=
"success_action_status"
;
public
static
final
String
FILE
=
"file"
;
public
static
final
String
CALL_BACK
=
"callback"
;
public
static
final
String
RESPONSE_STATUS
=
"200"
;
public
static
final
String
CONTENT_TYPE
=
"multipart/form-data"
;
/**
* 上传文件留到阿里云oss
*
* @param inputStream 文件流
* @param fileName 文件名称
* @param signatureVO 临时访问阿里云授权签名
* @return true 上传成功,false 失败
* @throws IOException 关闭文件流或httpClient连接时可能会异常
*/
public
static
boolean
uploadFile
(
InputStream
inputStream
,
String
fileName
,
SignatureVO
signatureVO
,
int
timeout
)
throws
IOException
{
CloseableHttpClient
client
=
HttpClients
.
createDefault
();
RequestConfig
requestConfig
=
RequestConfig
.
custom
()
//connectTimeout:指客户端和服务器建立连接的timeout,
.
setConnectTimeout
(
2000
)
//connectionRequestTimout:指从连接池获取连接的timeout
.
setConnectionRequestTimeout
(
2000
)
//socketTimeout:指客户端从服务器读取数据的timeout,超出后会抛出SocketTimeOutException,根据需要自定义
.
setSocketTimeout
(
timeout
)
.
build
();
HttpPost
post
=
new
HttpPost
(
signatureVO
.
getHost
());
post
.
setConfig
(
requestConfig
);
BufferedReader
br
=
null
;
try
{
// 参数顺序问题,该死的回调,千万要注意参数的顺序,死坑死坑
MultipartEntityBuilder
builder
=
MultipartEntityBuilder
.
create
();
builder
.
setMode
(
HttpMultipartMode
.
BROWSER_COMPATIBLE
);
StringBody
accessKeyId
=
new
StringBody
(
signatureVO
.
getAccessId
(),
ContentType
.
MULTIPART_FORM_DATA
);
builder
.
addPart
(
OSS_ACCESS_KEY_ID
,
accessKeyId
);
StringBody
policy
=
new
StringBody
(
signatureVO
.
getPolicy
(),
ContentType
.
MULTIPART_FORM_DATA
);
builder
.
addPart
(
POLICY
,
policy
);
StringBody
callBackStr
=
new
StringBody
(
signatureVO
.
getCallback
(),
ContentType
.
MULTIPART_FORM_DATA
);
builder
.
addPart
(
CALL_BACK
,
callBackStr
);
StringBody
signature
=
new
StringBody
(
signatureVO
.
getSignature
(),
ContentType
.
MULTIPART_FORM_DATA
);
builder
.
addPart
(
SIGNATURE
,
signature
);
// 兼容key中的中文名称
StringBody
key
=
new
StringBody
(
signatureVO
.
getKey
(),
ContentType
.
APPLICATION_JSON
);
builder
.
addPart
(
KEY
,
key
);
builder
.
addBinaryBody
(
FILE
,
inputStream
,
ContentType
.
create
(
CONTENT_TYPE
),
fileName
);
StringBody
successActionStatus
=
new
StringBody
(
RESPONSE_STATUS
,
ContentType
.
MULTIPART_FORM_DATA
);
builder
.
addPart
(
SUCCESS_ACTION_STATUS
,
successActionStatus
);
HttpEntity
entity
=
builder
.
build
();
post
.
setEntity
(
entity
);
//发送请求
HttpResponse
response
=
client
.
execute
(
post
);
int
status
=
response
.
getStatusLine
().
getStatusCode
();
if
(
Integer
.
valueOf
(
RESPONSE_STATUS
).
equals
(
status
))
{
return
true
;
}
else
{
entity
=
response
.
getEntity
();
if
(
entity
!=
null
)
{
inputStream
=
entity
.
getContent
();
br
=
new
BufferedReader
(
new
InputStreamReader
(
inputStream
,
Consts
.
UTF_8
));
StringBuilder
message
=
new
StringBuilder
();
String
body
;
while
((
body
=
br
.
readLine
())
!=
null
)
{
message
.
append
(
body
);
}
logger
.
error
(
"文件上传失败!message:{}"
+
message
);
}
return
true
;
}
}
catch
(
Exception
e
)
{
logger
.
error
(
"文件上传异常!"
,
e
);
}
finally
{
if
(
br
!=
null
){
br
.
close
();
}
inputStream
.
close
();
client
.
close
();
}
return
false
;
}
}
src/main/java/com/xiaomai/cases/polar/finance/revenueAndExpenditure/RevenueAndExpenditureTools.java
View file @
1ac0654d
...
...
@@ -7,8 +7,11 @@ import com.xiaomai.enums.ApiModule;
import
com.xiaomai.enums.RequestType
;
import
com.xiaomai.enums.Terminal
;
import
com.xiaomai.utils.XMBaseTest
;
import
com.xiaomai.utils.XMJSONPath
;
import
java.util.Date
;
import
java.io.FileInputStream
;
import
java.io.IOException
;
import
java.io.InputStream
;
public
class
RevenueAndExpenditureTools
extends
XMBaseTest
{
...
...
@@ -19,12 +22,9 @@ public class RevenueAndExpenditureTools extends XMBaseTest {
* @param type: 业务收支类型:INCOME:收入 EXPENSE:支出
* @param item: 业务收支类型:SIGN:签单 REFUND:退单
* @param supplierId:卖家ID 场馆ID
* @param brandId:品牌ID
* @param studioId:场馆ID
* @param operatorId:操作人ID
* @author: yangfangfang
**/
public
JSONObject
pageNormalIncomeExpense
(
String
paymentWays
,
String
type
,
String
item
,
String
supplierId
,
String
brandId
,
String
studioId
,
String
operatorId
,
DataUserInfo
...
dataUserInfos
){
public
JSONObject
pageNormalIncomeExpense
(
String
paymentWays
,
String
type
,
String
item
,
String
supplierId
,
DataUserInfo
...
dataUserInfos
){
dataApi
.
setApiModule
(
ApiModule
.
Polar_Finance
)
.
setApiName
(
"API_pageNormalIncomeExpense"
)
...
...
@@ -43,9 +43,9 @@ public class RevenueAndExpenditureTools extends XMBaseTest {
jsonObject
.
put
(
"type"
,
type
);
jsonObject
.
put
(
"item"
,
item
);
jsonObject
.
put
(
"supplierId"
,
supplierId
);
jsonObject
.
put
(
"brandId"
,
brandId
);
jsonObject
.
put
(
"studioId"
,
studioId
);
jsonObject
.
put
(
"operatorId"
,
operatorId
);
jsonObject
.
put
(
"brandId"
,
dataApi
.
getLoginInfo
().
getBrandId
()
);
jsonObject
.
put
(
"studioId"
,
dataApi
.
getLoginInfo
().
getStudioId
()
);
jsonObject
.
put
(
"operatorId"
,
dataApi
.
getLoginInfo
().
getAdminId
()
);
dataApi
.
doRequest
(
RequestType
.
JSON
,
dataparams
,
jsonObject
.
toJSONString
(),
dataheadrs
).
assetsSuccess
(
true
);
JSONObject
response
=
dataApi
.
getBodyInJSON
();
...
...
@@ -56,12 +56,9 @@ public class RevenueAndExpenditureTools extends XMBaseTest {
* @param
* @description:统计收支
* @param supplierId:卖家ID 场馆ID
* @param brandId:品牌ID
* @param studioId:场馆ID
* @param operatorId:操作人ID
* @author: yangfangfang
**/
public
JSONObject
sumNormalIncomeExpense
(
String
paymentWays
,
String
type
,
String
item
,
String
supplierId
,
String
brandId
,
String
studioId
,
String
operatorId
,
DataUserInfo
...
dataUserInfos
){
public
JSONObject
sumNormalIncomeExpense
(
String
paymentWays
,
String
type
,
String
item
,
String
supplierId
,
DataUserInfo
...
dataUserInfos
){
dataApi
.
setApiModule
(
ApiModule
.
Polar_Finance
)
.
setApiName
(
"API_sumNormalIncomeExpense"
)
...
...
@@ -80,9 +77,9 @@ public class RevenueAndExpenditureTools extends XMBaseTest {
jsonObject
.
put
(
"type"
,
type
);
jsonObject
.
put
(
"item"
,
item
);
jsonObject
.
put
(
"supplierId"
,
supplierId
);
jsonObject
.
put
(
"brandId"
,
brandId
);
jsonObject
.
put
(
"studioId"
,
studioId
);
jsonObject
.
put
(
"operatorId"
,
operatorId
);
jsonObject
.
put
(
"brandId"
,
dataApi
.
getLoginInfo
().
getBrandId
()
);
jsonObject
.
put
(
"studioId"
,
dataApi
.
getLoginInfo
().
getStudioId
()
);
jsonObject
.
put
(
"operatorId"
,
dataApi
.
getLoginInfo
().
getAdminId
()
);
dataApi
.
doRequest
(
RequestType
.
JSON
,
dataparams
,
jsonObject
.
toJSONString
(),
dataheadrs
).
assetsSuccess
(
true
);
JSONObject
response
=
dataApi
.
getBodyInJSON
();
...
...
@@ -98,7 +95,7 @@ public class RevenueAndExpenditureTools extends XMBaseTest {
* @param operatorId:操作人ID
* @author: yangfangfang
**/
public
JSONObject
pageDiscardIncomeExpense
(
String
paymentWays
,
String
type
,
String
item
,
String
supplierId
,
String
brandId
,
String
studioId
,
String
operatorId
,
DataUserInfo
...
dataUserInfos
){
public
JSONObject
pageDiscardIncomeExpense
(
String
paymentWays
,
String
type
,
String
item
,
String
supplierId
,
DataUserInfo
...
dataUserInfos
){
dataApi
.
setApiModule
(
ApiModule
.
Polar_Finance
)
.
setApiName
(
"API_pageDiscardIncomeExpense"
)
...
...
@@ -117,9 +114,9 @@ public class RevenueAndExpenditureTools extends XMBaseTest {
jsonObject
.
put
(
"type"
,
type
);
jsonObject
.
put
(
"item"
,
item
);
jsonObject
.
put
(
"supplierId"
,
supplierId
);
jsonObject
.
put
(
"brandId"
,
brandId
);
jsonObject
.
put
(
"studioId"
,
studioId
);
jsonObject
.
put
(
"operatorId"
,
operatorId
);
jsonObject
.
put
(
"brandId"
,
dataApi
.
getLoginInfo
().
getBrandId
()
);
jsonObject
.
put
(
"studioId"
,
dataApi
.
getLoginInfo
().
getStudioId
()
);
jsonObject
.
put
(
"operatorId"
,
dataApi
.
getLoginInfo
().
getAdminId
()
);
dataApi
.
doRequest
(
RequestType
.
JSON
,
dataparams
,
jsonObject
.
toJSONString
(),
dataheadrs
).
assetsSuccess
(
true
);
JSONObject
response
=
dataApi
.
getBodyInJSON
();
...
...
@@ -131,12 +128,9 @@ public class RevenueAndExpenditureTools extends XMBaseTest {
* @param
* @description:获取收支的支付/退款记录
* @param id:主键ID
* @param brandId:品牌ID
* @param studioId:场馆ID
* @param operatorId:操作人ID
* @author: yangfangfang
**/
public
JSONObject
get
(
String
id
,
String
brandId
,
String
studioId
,
String
operatorId
,
DataUserInfo
...
dataUserInfos
){
public
JSONObject
get
(
String
id
,
DataUserInfo
...
dataUserInfos
){
dataApi
.
setApiModule
(
ApiModule
.
Polar_Finance
)
.
setApiName
(
"API_get"
)
...
...
@@ -145,13 +139,62 @@ public class RevenueAndExpenditureTools extends XMBaseTest {
JSONObject
jsonObject
=
new
JSONObject
();
jsonObject
.
put
(
"id"
,
id
);
jsonObject
.
put
(
"brandId"
,
brandId
);
jsonObject
.
put
(
"studioId"
,
studioId
);
jsonObject
.
put
(
"operatorId"
,
operatorId
);
jsonObject
.
put
(
"brandId"
,
dataApi
.
getLoginInfo
().
getBrandId
()
);
jsonObject
.
put
(
"studioId"
,
dataApi
.
getLoginInfo
().
getStudioId
()
);
jsonObject
.
put
(
"operatorId"
,
dataApi
.
getLoginInfo
().
getAdminId
()
);
dataApi
.
doRequest
(
RequestType
.
JSON
,
dataparams
,
jsonObject
.
toJSONString
(),
dataheadrs
).
assetsSuccess
(
true
);
JSONObject
response
=
dataApi
.
getBodyInJSON
();
return
response
;
}
/**
* @param
* @description:上传图片资源
* @param bizCode:VOUCHER_INFO
* @param tenantType:BRAND
* @param filePath:图片地址
* @author: yangfangfang
**/
public
JSONObject
mobileResource
(
String
bizCode
,
String
tenantType
,
String
filePath
,
DataUserInfo
...
dataUserInfos
)
throws
IOException
{
dataApi
.
setApiModule
(
ApiModule
.
Polar_Finance
)
.
setApiName
(
"API_mobileResource"
)
.
setTerminal
(
Terminal
.
B
);
super
.
beforeDataRequest
(
dataUserInfos
);
JSONObject
jsonObject
=
new
JSONObject
();
jsonObject
.
put
(
"tenantId"
,
dataApi
.
getLoginInfo
().
getBrandId
());
jsonObject
.
put
(
"resourceName"
,
"imgFile/test1.jpg"
);
jsonObject
.
put
(
"bizCode"
,
bizCode
);
jsonObject
.
put
(
"tenantType"
,
tenantType
);
dataApi
.
doRequest
(
RequestType
.
JSON
,
dataparams
,
jsonObject
.
toJSONString
(),
dataheadrs
).
assetsSuccess
(
true
);
JSONObject
response
=
dataApi
.
getBodyInJSON
();
String
resourceId
=
XMJSONPath
.
readPath
(
response
,
"$.result.resourceId"
);
String
accessId
=
XMJSONPath
.
readPath
(
response
,
"$.result.accessId"
);
String
policy
=
XMJSONPath
.
readPath
(
response
,
"$.result.policy"
);
String
signature
=
XMJSONPath
.
readPath
(
response
,
"$.result.signature"
);
String
key
=
XMJSONPath
.
readPath
(
response
,
"$.result.key"
);
String
callback
=
XMJSONPath
.
readPath
(
response
,
"$.result.callback"
);
String
host
=
XMJSONPath
.
readPath
(
response
,
"$.result.host"
);
InputStream
inputStream
=
new
FileInputStream
(
filePath
);
SignatureVO
signatureVO
=
new
SignatureVO
();
signatureVO
.
setAccessId
(
accessId
);
signatureVO
.
setPolicy
(
policy
);
signatureVO
.
setCallback
(
callback
);
signatureVO
.
setKey
(
key
);
signatureVO
.
setSignature
(
signature
);
signatureVO
.
setHost
(
host
);
signatureVO
.
setResourceId
(
Long
.
valueOf
(
resourceId
));
ResourceUtil
.
uploadFile
(
inputStream
,
filePath
,
signatureVO
,
5000
);
return
response
;
}
}
src/main/java/com/xiaomai/cases/polar/finance/revenueAndExpenditure/SignatureVO.java
0 → 100644
View file @
1ac0654d
/*
* Copyright © 2020 Hangzhou Jiejing Technology Co., Ltd. All rights reserved.
*
* The copyright of the company's program code belongs to Hangzhou Jiejing Technology Co., Ltd.
* No one can illegally copy it without the explicit permission of this website.
* Official website: www.xiaomai5.com
*
* Copyright © 2020 杭州杰竞科技有限公司 版权所有.
*
* 本公司程序代码的版权归杭州杰竞科技有限公司所有,未经本网站的明确许可,任何人不得非法复制。
* 官网: www.xiaomai5.com
*/
package
com
.
xiaomai
.
cases
.
polar
.
finance
.
revenueAndExpenditure
;
/**
* @author adu
* @date 2021-04-22
*/
public
class
SignatureVO
{
//资源ID
private
Long
resourceId
;
//接入ID
private
String
accessId
;
//访问策略
private
String
policy
;
//签名
private
String
signature
;
//对象路径
private
String
key
;
//接入点
private
String
host
;
//过期时间
private
String
expire
;
//回调地址
private
String
callback
;
public
Long
getResourceId
()
{
return
resourceId
;
}
public
void
setResourceId
(
Long
resourceId
)
{
this
.
resourceId
=
resourceId
;
}
public
String
getAccessId
()
{
return
accessId
;
}
public
void
setAccessId
(
String
accessId
)
{
this
.
accessId
=
accessId
;
}
public
String
getPolicy
()
{
return
policy
;
}
public
void
setPolicy
(
String
policy
)
{
this
.
policy
=
policy
;
}
public
String
getSignature
()
{
return
signature
;
}
public
void
setSignature
(
String
signature
)
{
this
.
signature
=
signature
;
}
public
String
getKey
()
{
return
key
;
}
public
void
setKey
(
String
key
)
{
this
.
key
=
key
;
}
public
String
getHost
()
{
return
host
;
}
public
void
setHost
(
String
host
)
{
this
.
host
=
host
;
}
public
String
getExpire
()
{
return
expire
;
}
public
void
setExpire
(
String
expire
)
{
this
.
expire
=
expire
;
}
public
String
getCallback
()
{
return
callback
;
}
public
void
setCallback
(
String
callback
)
{
this
.
callback
=
callback
;
}
}
src/main/java/com/xiaomai/cases/polar/finance/revenueAndExpenditure/TestUploadResources.java
0 → 100644
View file @
1ac0654d
package
com
.
xiaomai
.
cases
.
polar
.
finance
.
revenueAndExpenditure
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
com.xiaomai.cases.polar.finance.order.OrderTools
;
import
com.xiaomai.cases.polar.member.Tools
;
import
com.xiaomai.cases.polar.memberCard.CardTools
;
import
com.xiaomai.enums.ApiModule
;
import
com.xiaomai.enums.LoginAccount
;
import
com.xiaomai.enums.RequestType
;
import
com.xiaomai.enums.Terminal
;
import
com.xiaomai.utils.RandomStringUtil
;
import
com.xiaomai.utils.TimeUtils
;
import
com.xiaomai.utils.XMBaseTest
;
import
com.xiaomai.utils.XMJSONPath
;
import
org.testng.Assert
;
import
org.testng.annotations.BeforeMethod
;
import
org.testng.annotations.Test
;
import
java.io.IOException
;
public
class
TestUploadResources
extends
XMBaseTest
{
String
memberId
;
String
cardId
;
String
id1
;
Tools
tools
=
new
Tools
();
OrderTools
orderTools
=
new
OrderTools
();
RevenueAndExpenditureTools
revenueAndExpenditureTools
=
new
RevenueAndExpenditureTools
();
CardTools
cardTools
=
new
CardTools
();
@BeforeMethod
public
void
beforeTest
(){
xmAppApi
.
setApiModule
(
ApiModule
.
Polar_Finance
)
.
setApiName
(
"API_uploadResources"
)
.
setLoginUser
(
LoginAccount
.
GYM_PROD
)
.
setTerminal
(
Terminal
.
B
);
dal
.
setCase_owner
(
"yff"
)
.
setCase_name
(
Thread
.
currentThread
().
getStackTrace
()[
1
].
getFileName
().
split
(
"\\."
)[
0
]);
super
.
beforeTest
();
}
@Test
(
description
=
"收支(收支明细&订单详情-支付记录)上传支付凭证-3张"
)
public
void
testUploadResources
()
throws
IOException
{
String
name
=
"创建订单潜在会员"
+
RandomStringUtil
.
randomString
(
3
);
String
phone
=
RandomStringUtil
.
randomMobile
(
"666"
);
//获取会员ID
int
memberTotal
=
Integer
.
parseInt
(
tools
.
search
(
"NORMAL"
,
"NORMAL"
).
getJSONObject
(
"result"
).
getString
(
"total"
));
if
(
memberTotal
==
0
)
{
memberId
=
tools
.
create
(
name
,
phone
).
getString
(
"result"
);
}
memberId
=
tools
.
search
(
"NORMAL"
,
"NORMAL"
).
getJSONObject
(
"result"
).
getJSONArray
(
"records"
).
getJSONObject
(
0
).
getString
(
"id"
);
try
{
Thread
.
sleep
(
1000
);
}
catch
(
InterruptedException
e
)
{
throw
new
RuntimeException
(
e
);
}
//获取会员卡信息
//获取会员卡列表
int
cardTotal
=
Integer
.
parseInt
(
orderTools
.
fetchPageOfMemberCard
().
getJSONObject
(
"result"
).
getString
(
"total"
));
if
(
cardTotal
==
0
)
{
cardId
=
cardTools
.
memberCardCreate
(
"创建订单会员卡"
+
TimeUtils
.
getCurrentTime
()).
getString
(
"result"
);
}
JSONObject
memberCard
=
orderTools
.
fetchPageOfMemberCard
();
cardId
=
memberCard
.
getJSONObject
(
"result"
).
getJSONArray
(
"records"
).
getJSONObject
(
0
).
getString
(
"id"
);
int
quantity
=
Integer
.
parseInt
(
memberCard
.
getJSONObject
(
"result"
).
getJSONArray
(
"records"
).
getJSONObject
(
0
).
getString
(
"balance"
));
float
price
=
Float
.
parseFloat
(
memberCard
.
getJSONObject
(
"result"
).
getJSONArray
(
"records"
).
getJSONObject
(
0
).
getString
(
"price"
));
int
validPeriod
=
Integer
.
parseInt
(
memberCard
.
getJSONObject
(
"result"
).
getJSONArray
(
"records"
).
getJSONObject
(
0
).
getString
(
"validPeriod"
));
try
{
Thread
.
sleep
(
1000
);
}
catch
(
InterruptedException
e
)
{
throw
new
RuntimeException
(
e
);
}
//获取签单要用的卡快照id
String
latestSnapshotId
=
orderTools
.
fetchDetailById
(
cardId
,
xmAppApi
.
getLoginInfo
().
getBrandId
(),
xmAppApi
.
getLoginInfo
().
getStudioId
(),
xmAppApi
.
getLoginInfo
().
getAdminId
()).
getJSONObject
(
"result"
).
getString
(
"latestSnapshotId"
);
try
{
Thread
.
sleep
(
1000
);
}
catch
(
InterruptedException
e
)
{
throw
new
RuntimeException
(
e
);
}
//检查会员对该卡是否超出购买上限
boolean
limitResult
=
orderTools
.
checkAllowPurchase
(
"MEMBER_CARD"
,
cardId
,
memberId
,
"1"
,
xmAppApi
.
getLoginInfo
().
getBrandId
(),
xmAppApi
.
getLoginInfo
().
getStudioId
(),
xmAppApi
.
getLoginInfo
().
getAdminId
()).
getBoolean
(
"success"
);
try
{
Thread
.
sleep
(
1000
);
}
catch
(
InterruptedException
e
)
{
throw
new
RuntimeException
(
e
);
}
if
(
limitResult
==
true
)
{
//创建订单
JSONObject
orderResult
=
orderTools
.
signOrder
(
cardId
,
latestSnapshotId
,
quantity
,
price
,
validPeriod
,
latestSnapshotId
,
price
/
2
,
"PURCHASE"
,
"MEMBER_CARD"
,
memberId
,
price
-
price
/
2
,
price
-
price
/
2
,
"1"
);
String
success
=
orderResult
.
getString
(
"success"
);
String
getDetailId
=
orderResult
.
getString
(
"result"
);
Assert
.
assertEquals
(
success
,
"true"
,
"创建签单订单失败"
);
try
{
Thread
.
sleep
(
3000
);
}
catch
(
InterruptedException
e
)
{
throw
new
RuntimeException
(
e
);
}
//获取订单支付记录
JSONObject
listByVoucherIdResult
=
orderTools
.
listByVoucherId
(
getDetailId
);
id1
=
listByVoucherIdResult
.
getJSONArray
(
"result"
).
getJSONObject
(
0
).
getString
(
"id"
);
//收支的id
//上传资源
JSONObject
resourceResult
=
revenueAndExpenditureTools
.
mobileResource
(
"VOUCHER_INFO"
,
"BRAND"
,
"imgFile/test1.jpg"
);
String
resourceId
=
XMJSONPath
.
readPath
(
resourceResult
,
"$.result.resourceId"
);
//上传图片
JSONObject
jsonObject
=
new
JSONObject
();
jsonObject
.
put
(
"id"
,
id1
);
JSONArray
resourceIds
=
new
JSONArray
();
resourceIds
.
add
(
"1808067425522491394"
);
resourceIds
.
add
(
"1808067425522491394"
);
resourceIds
.
add
(
"1808067425522491394"
);
jsonObject
.
put
(
"resourceIds"
,
resourceIds
);
jsonObject
.
put
(
"brandId"
,
xmAppApi
.
getLoginInfo
().
getBrandId
());
jsonObject
.
put
(
"studioId"
,
xmAppApi
.
getLoginInfo
().
getStudioId
());
jsonObject
.
put
(
"operatorId"
,
xmAppApi
.
getLoginInfo
().
getAdminId
());
xmAppApi
.
doRequest
(
RequestType
.
JSON
,
params
,
jsonObject
.
toJSONString
(),
headers
).
assetsSuccess
(
true
);
JSONObject
response
=
xmAppApi
.
getBodyInJSON
();
String
uploadResourcesSuccess
=
response
.
getString
(
"success"
);
Assert
.
assertEquals
(
uploadResourcesSuccess
,
"true"
,
"上传图片失败"
);
}
}
@Test
(
description
=
"收支(收支明细&订单详情-支付记录)上传支付凭证-资源不能超过3个"
)
public
void
testUploadResources_add
()
{
//上传图片
JSONObject
jsonObject
=
new
JSONObject
();
jsonObject
.
put
(
"id"
,
id1
);
JSONArray
resourceIds
=
new
JSONArray
();
resourceIds
.
add
(
"1808067425522491394"
);
resourceIds
.
add
(
"1808067425522491394"
);
resourceIds
.
add
(
"1808067425522491394"
);
resourceIds
.
add
(
"1808067425522491394"
);
jsonObject
.
put
(
"resourceIds"
,
resourceIds
);
jsonObject
.
put
(
"brandId"
,
xmAppApi
.
getLoginInfo
().
getBrandId
());
jsonObject
.
put
(
"studioId"
,
xmAppApi
.
getLoginInfo
().
getStudioId
());
jsonObject
.
put
(
"operatorId"
,
xmAppApi
.
getLoginInfo
().
getAdminId
());
xmAppApi
.
doRequest
(
RequestType
.
JSON
,
params
,
jsonObject
.
toJSONString
(),
headers
);
String
uploadResourcesSuccess
=
xmAppApi
.
getBodyInJSON
().
getString
(
"success"
);
Assert
.
assertEquals
(
uploadResourcesSuccess
,
"false"
,
"支付凭证资源不能超过3个"
);
}
}
src/main/java/com/xiaomai/cases/polar/setting/pay/PayTools.java
0 → 100644
View file @
1ac0654d
package
com
.
xiaomai
.
cases
.
polar
.
setting
.
pay
;
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
PayTools
extends
XMBaseTest
{
/**
* @param
* @description:获取通用配置-支付配置列表
* @author: yangfangfang
**/
public
JSONObject
getList
(
DataUserInfo
...
dataUserInfos
){
dataApi
.
setApiModule
(
ApiModule
.
Polar_Setting
)
.
setApiName
(
"API_getList"
)
.
setTerminal
(
Terminal
.
B
);
super
.
beforeDataRequest
(
dataUserInfos
);
JSONObject
jsonObject
=
new
JSONObject
();
jsonObject
.
put
(
"tenantId"
,
dataApi
.
getLoginInfo
().
getBrandId
());
jsonObject
.
put
(
"tenantType"
,
"BRAND"
);
// "BRAND", "STUDIO", "INVALID" ]租户类型:BRAND-品牌;STUDIO-场馆[TenantTypeEnum]
JSONArray
categories
=
new
JSONArray
();
categories
.
add
(
"PAYMENT"
);
jsonObject
.
put
(
"categories"
,
categories
);
//"会员来源", "支付方式" ]属性类别[ RESOURCE, PAYMENT ]
jsonObject
.
put
(
"brandId"
,
dataApi
.
getLoginInfo
().
getBrandId
());
jsonObject
.
put
(
"studioId"
,
dataApi
.
getLoginInfo
().
getStudioId
());
jsonObject
.
put
(
"operatorId"
,
dataApi
.
getLoginInfo
().
getAdminId
());
dataApi
.
doRequest
(
RequestType
.
JSON
,
dataparams
,
jsonObject
.
toJSONString
(),
dataheadrs
).
assetsSuccess
(
true
);
JSONObject
response
=
dataApi
.
getBodyInJSON
();
return
response
;
}
/**
* @param
* @description:新建通用配置-支付方式
* @param name:支付方式名
* @author: yangfangfang
**/
public
JSONObject
save
(
String
name
,
DataUserInfo
...
dataUserInfos
){
dataApi
.
setApiModule
(
ApiModule
.
Polar_Setting
)
.
setApiName
(
"API_save"
)
.
setTerminal
(
Terminal
.
B
);
super
.
beforeDataRequest
(
dataUserInfos
);
JSONObject
jsonObject
=
new
JSONObject
();
jsonObject
.
put
(
"category"
,
"PAYMENT"
);
jsonObject
.
put
(
"name"
,
name
);
jsonObject
.
put
(
"tenantId"
,
dataApi
.
getLoginInfo
().
getBrandId
());
jsonObject
.
put
(
"tenantType"
,
"BRAND"
);
// "BRAND", "STUDIO", "INVALID" ]租户类型:BRAND-品牌;STUDIO-场馆[TenantTypeEnum]
jsonObject
.
put
(
"brandId"
,
dataApi
.
getLoginInfo
().
getBrandId
());
jsonObject
.
put
(
"studioId"
,
dataApi
.
getLoginInfo
().
getStudioId
());
jsonObject
.
put
(
"operatorId"
,
dataApi
.
getLoginInfo
().
getAdminId
());
dataApi
.
doRequest
(
RequestType
.
JSON
,
dataparams
,
jsonObject
.
toJSONString
(),
dataheadrs
).
assetsSuccess
(
true
);
JSONObject
response
=
dataApi
.
getBodyInJSON
();
return
response
;
}
/**
* @param
* @description:修改通用配置-支付方式(开启/关闭)
* @param id:属性ID 支付方式id
* @param name:属性名称 支付方式名称
* @param status:[ "启用", "禁用", "删除" ]状态[ ON, OFF, DEL ]
* @author: yangfangfang
**/
public
JSONObject
update
(
String
id
,
String
name
,
String
status
,
DataUserInfo
...
dataUserInfos
){
dataApi
.
setApiModule
(
ApiModule
.
Polar_Setting
)
.
setApiName
(
"API_update"
)
.
setTerminal
(
Terminal
.
B
);
super
.
beforeDataRequest
(
dataUserInfos
);
JSONObject
jsonObject
=
new
JSONObject
();
jsonObject
.
put
(
"id"
,
id
);
jsonObject
.
put
(
"name"
,
name
);
jsonObject
.
put
(
"tenantId"
,
dataApi
.
getLoginInfo
().
getBrandId
());
jsonObject
.
put
(
"tenantType"
,
"BRAND"
);
// "BRAND", "STUDIO", "INVALID" ]租户类型:BRAND-品牌;STUDIO-场馆[TenantTypeEnum]
jsonObject
.
put
(
"status"
,
status
);
jsonObject
.
put
(
"category"
,
"PAYMENT"
);
jsonObject
.
put
(
"brandId"
,
dataApi
.
getLoginInfo
().
getBrandId
());
jsonObject
.
put
(
"studioId"
,
dataApi
.
getLoginInfo
().
getStudioId
());
jsonObject
.
put
(
"operatorId"
,
dataApi
.
getLoginInfo
().
getAdminId
());
dataApi
.
doRequest
(
RequestType
.
JSON
,
dataparams
,
jsonObject
.
toJSONString
(),
dataheadrs
).
assetsSuccess
(
true
);
JSONObject
response
=
dataApi
.
getBodyInJSON
();
return
response
;
}
/**
* @param
* @description:删除通用配置-支付方式
* @param ids:属性ID 支付方式id
* @author: yangfangfang
**/
public
JSONObject
remove
(
String
ids
,
DataUserInfo
...
dataUserInfos
){
dataApi
.
setApiModule
(
ApiModule
.
Polar_Setting
)
.
setApiName
(
"API_remove"
)
.
setTerminal
(
Terminal
.
B
);
super
.
beforeDataRequest
(
dataUserInfos
);
JSONObject
jsonObject
=
new
JSONObject
();
JSONArray
jsonArray
=
new
JSONArray
();
jsonArray
.
add
(
ids
);
jsonObject
.
put
(
"ids"
,
jsonArray
);
jsonObject
.
put
(
"tenantId"
,
dataApi
.
getLoginInfo
().
getBrandId
());
jsonObject
.
put
(
"tenantType"
,
"BRAND"
);
// "BRAND", "STUDIO", "INVALID" ]租户类型:BRAND-品牌;STUDIO-场馆[TenantTypeEnum]
jsonObject
.
put
(
"category"
,
"PAYMENT"
);
jsonObject
.
put
(
"brandId"
,
dataApi
.
getLoginInfo
().
getBrandId
());
jsonObject
.
put
(
"studioId"
,
dataApi
.
getLoginInfo
().
getStudioId
());
jsonObject
.
put
(
"operatorId"
,
dataApi
.
getLoginInfo
().
getAdminId
());
dataApi
.
doRequest
(
RequestType
.
JSON
,
dataparams
,
jsonObject
.
toJSONString
(),
dataheadrs
).
assetsSuccess
(
true
);
JSONObject
response
=
dataApi
.
getBodyInJSON
();
return
response
;
}
/**
* @param
* @description:校验该支付方式是否使用过
* @param id:支付方式id
* @param paymentWay:支付方式code
* @author: yangfangfang
**/
public
JSONObject
checkPaymentWayUsed
(
String
id
,
String
paymentWay
,
DataUserInfo
...
dataUserInfos
){
dataApi
.
setApiModule
(
ApiModule
.
Polar_Finance
)
.
setApiName
(
"API_checkPaymentWayUsed"
)
.
setTerminal
(
Terminal
.
B
);
super
.
beforeDataRequest
(
dataUserInfos
);
JSONObject
jsonObject
=
new
JSONObject
();
jsonObject
.
put
(
"id"
,
id
);
jsonObject
.
put
(
"paymentWay"
,
paymentWay
);
jsonObject
.
put
(
"brandId"
,
dataApi
.
getLoginInfo
().
getBrandId
());
jsonObject
.
put
(
"studioId"
,
dataApi
.
getLoginInfo
().
getStudioId
());
jsonObject
.
put
(
"operatorId"
,
dataApi
.
getLoginInfo
().
getAdminId
());
dataApi
.
doRequest
(
RequestType
.
JSON
,
dataparams
,
jsonObject
.
toJSONString
(),
dataheadrs
).
assetsSuccess
(
true
);
JSONObject
response
=
dataApi
.
getBodyInJSON
();
return
response
;
}
}
src/main/java/com/xiaomai/cases/polar/setting/pay/TestSave.java
0 → 100644
View file @
1ac0654d
package
com
.
xiaomai
.
cases
.
polar
.
setting
.
pay
;
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.RandomStringUtil
;
import
com.xiaomai.utils.XMBaseTest
;
import
org.testng.Assert
;
import
org.testng.annotations.BeforeMethod
;
import
org.testng.annotations.Test
;
public
class
TestSave
extends
XMBaseTest
{
PayTools
payTools
=
new
PayTools
();
@BeforeMethod
public
void
beforeTest
(){
xmAppApi
.
setApiModule
(
ApiModule
.
Polar_Setting
)
.
setApiName
(
"API_save"
)
.
setLoginUser
(
LoginAccount
.
GYM_PROD
)
.
setTerminal
(
Terminal
.
B
);
dal
.
setCase_owner
(
"yff"
)
.
setCase_name
(
Thread
.
currentThread
().
getStackTrace
()[
1
].
getFileName
().
split
(
"\\."
)[
0
]);
super
.
beforeTest
();
}
@Test
(
description
=
"新建自定义支付方式"
)
public
void
testSave
(){
JSONObject
jsonObject
=
new
JSONObject
();
jsonObject
.
put
(
"category"
,
"PAYMENT"
);
jsonObject
.
put
(
"name"
,
RandomStringUtil
.
random_name
());
jsonObject
.
put
(
"tenantId"
,
xmAppApi
.
getLoginInfo
().
getBrandId
());
jsonObject
.
put
(
"tenantType"
,
"BRAND"
);
// "BRAND", "STUDIO", "INVALID" ]租户类型:BRAND-品牌;STUDIO-场馆[TenantTypeEnum]
jsonObject
.
put
(
"brandId"
,
xmAppApi
.
getLoginInfo
().
getBrandId
());
jsonObject
.
put
(
"studioId"
,
xmAppApi
.
getLoginInfo
().
getStudioId
());
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"
);
String
id
=
response
.
getString
(
"result"
);
Assert
.
assertEquals
(
success
,
"true"
,
"新建自定义支付方式失败"
);
try
{
Thread
.
sleep
(
1000
);
}
catch
(
InterruptedException
e
)
{
throw
new
RuntimeException
(
e
);
}
//获取支付方式列表
JSONArray
getList
=
payTools
.
getList
().
getJSONArray
(
"result"
);
int
length
=
getList
.
size
();
JSONObject
lastJsonObject
=
getList
.
getJSONObject
(
length
-
1
);
String
lastCode
=
lastJsonObject
.
getString
(
"code"
);
String
lastId
=
lastJsonObject
.
getString
(
"id"
);
Assert
.
assertEquals
(
lastId
.
equals
(
id
),
true
,
"新建自定义支付方式失败"
);
//校验该支付方式是否使用过
boolean
checkPaymentWayUsedResult
=
payTools
.
checkPaymentWayUsed
(
id
,
lastCode
).
getBoolean
(
"result"
);
if
(
checkPaymentWayUsedResult
==
false
){
//删除新建的自定义支付方式
JSONObject
removeResult
=
payTools
.
remove
(
id
);
Assert
.
assertEquals
(
removeResult
.
getString
(
"success"
),
"true"
,
"删除新建自定义支付方式失败"
);
}
}
@Test
(
description
=
"新建自定义支付方式-不可添加重复名称"
)
public
void
testSave_duplicateName
(){
JSONObject
jsonObject
=
new
JSONObject
();
jsonObject
.
put
(
"category"
,
"PAYMENT"
);
jsonObject
.
put
(
"name"
,
"线下支付宝"
);
jsonObject
.
put
(
"tenantId"
,
xmAppApi
.
getLoginInfo
().
getBrandId
());
jsonObject
.
put
(
"tenantType"
,
"BRAND"
);
jsonObject
.
put
(
"brandId"
,
xmAppApi
.
getLoginInfo
().
getBrandId
());
jsonObject
.
put
(
"studioId"
,
xmAppApi
.
getLoginInfo
().
getStudioId
());
jsonObject
.
put
(
"operatorId"
,
xmAppApi
.
getLoginInfo
().
getAdminId
());
xmAppApi
.
doRequest
(
RequestType
.
JSON
,
params
,
jsonObject
.
toJSONString
(),
headers
).
assetsSuccess
(
false
);
}
}
src/main/java/com/xiaomai/cases/polar/setting/pay/TestUpdate.java
0 → 100644
View file @
1ac0654d
package
com
.
xiaomai
.
cases
.
polar
.
setting
.
pay
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
com.xiaomai.enums.ApiModule
;
import
com.xiaomai.enums.LoginAccount
;
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
TestUpdate
extends
XMBaseTest
{
PayTools
payTools
=
new
PayTools
();
@BeforeMethod
public
void
beforeTest
(){
xmAppApi
.
setApiModule
(
ApiModule
.
Polar_Setting
)
.
setApiName
(
"API_update"
)
.
setLoginUser
(
LoginAccount
.
GYM_PROD
)
.
setTerminal
(
Terminal
.
B
);
dal
.
setCase_owner
(
"yff"
)
.
setCase_name
(
Thread
.
currentThread
().
getStackTrace
()[
1
].
getFileName
().
split
(
"\\."
)[
0
]);
super
.
beforeTest
();
}
@Test
(
description
=
"修改通用配置支付方式-关闭/开启"
)
public
void
testUpdate
(){
//修改默认支付方式
String
getListStatus
=
payTools
.
getList
().
getJSONArray
(
"result"
).
getJSONObject
(
1
).
getString
(
"status"
);
if
(
getListStatus
==
"ON"
){
JSONObject
update
=
payTools
.
update
(
"1798566848871395329"
,
"线下微信"
,
"OFF"
);
Assert
.
assertEquals
(
update
.
getString
(
"success"
),
"true"
,
"修改默认支付方式失败"
);
}
else
if
(
getListStatus
==
"OFF"
){
JSONObject
update
=
payTools
.
update
(
"1798566848871395329"
,
"线下微信"
,
"ON"
);
Assert
.
assertEquals
(
update
.
getString
(
"success"
),
"true"
,
"修改默认支付方式失败"
);
}
//修改自定义方式
JSONObject
saveResult
=
payTools
.
save
(
"被修改自动化支付方式"
);
String
saveId
=
saveResult
.
getString
(
"result"
);
JSONObject
OFF
=
new
JSONObject
();
OFF
.
put
(
"id"
,
saveId
);
OFF
.
put
(
"name"
,
"被修改自动化支付方式"
);
OFF
.
put
(
"tenantId"
,
xmAppApi
.
getLoginInfo
().
getBrandId
());
OFF
.
put
(
"tenantType"
,
"BRAND"
);
// "BRAND", "STUDIO", "INVALID" ]租户类型:BRAND-品牌;STUDIO-场馆[TenantTypeEnum]
OFF
.
put
(
"status"
,
"OFF"
);
OFF
.
put
(
"category"
,
"PAYMENT"
);
OFF
.
put
(
"brandId"
,
xmAppApi
.
getLoginInfo
().
getBrandId
());
OFF
.
put
(
"studioId"
,
xmAppApi
.
getLoginInfo
().
getStudioId
());
OFF
.
put
(
"operatorId"
,
xmAppApi
.
getLoginInfo
().
getAdminId
());
try
{
Thread
.
sleep
(
2000
);
}
catch
(
InterruptedException
e
)
{
throw
new
RuntimeException
(
e
);
}
JSONObject
ON
=
new
JSONObject
();
ON
.
put
(
"id"
,
saveId
);
ON
.
put
(
"name"
,
"被修改自动化支付方式"
);
ON
.
put
(
"tenantId"
,
xmAppApi
.
getLoginInfo
().
getBrandId
());
ON
.
put
(
"tenantType"
,
"BRAND"
);
// "BRAND", "STUDIO", "INVALID" ]租户类型:BRAND-品牌;STUDIO-场馆[TenantTypeEnum]
ON
.
put
(
"status"
,
"ON"
);
ON
.
put
(
"category"
,
"PAYMENT"
);
ON
.
put
(
"brandId"
,
xmAppApi
.
getLoginInfo
().
getBrandId
());
ON
.
put
(
"studioId"
,
xmAppApi
.
getLoginInfo
().
getStudioId
());
ON
.
put
(
"operatorId"
,
xmAppApi
.
getLoginInfo
().
getAdminId
());
try
{
Thread
.
sleep
(
1000
);
}
catch
(
InterruptedException
e
)
{
throw
new
RuntimeException
(
e
);
}
//获取支付方式列表
JSONArray
getList
=
payTools
.
getList
().
getJSONArray
(
"result"
);
int
length
=
getList
.
size
();
String
lastCode
=
getList
.
getJSONObject
(
length
-
1
).
getString
(
"code"
);
//校验该支付方式是否使用过
boolean
checkPaymentWayUsedResult
=
payTools
.
checkPaymentWayUsed
(
saveId
,
lastCode
).
getBoolean
(
"result"
);
if
(
checkPaymentWayUsedResult
==
false
){
//删除新建的自定义支付方式
JSONObject
removeResult
=
payTools
.
remove
(
saveId
);
Assert
.
assertEquals
(
removeResult
.
getString
(
"success"
),
"true"
,
"删除新建自定义支付方式失败"
);
}
}
}
src/main/java/com/xiaomai/enums/ApiModule.java
View file @
1ac0654d
...
...
@@ -16,9 +16,11 @@ public class ApiModule {
public
static
String
Polar_Studio
=
"polar_studio"
;
//场馆
public
static
String
Polar_Finance
=
"polar_finance"
;
//财务中心
public
static
String
Polar_Card
=
"polar_card"
;
//会员卡
public
static
String
Polar_Schedule
=
"polar_schedule"
;
//课程排期
public
static
String
Polar_Card
=
"polar_card"
;
//会员卡
public
static
String
Polar_Reserve
=
"polar_reserve"
;
//预约
public
static
String
Lunar_Reserve
=
"lunar_reserve"
;
//预约
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment