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
e7ec62c1
Commit
e7ec62c1
authored
Jul 02, 2024
by
yangfangfang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
订单、收支、支付方式
parent
b721cfb1
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
878 additions
and
65 deletions
+878
-65
imgFile/test1.jpg
+0
-0
src/main/java/com/xiaomai/cases/polar/finance/order/OrderTools.java
+0
-0
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/TestRefundOrder.java
+0
-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 @
e7ec62c1
237 KB
src/main/java/com/xiaomai/cases/polar/finance/order/OrderTools.java
View file @
e7ec62c1
This diff is collapsed.
Click to expand it.
src/main/java/com/xiaomai/cases/polar/finance/order/TestCancel.java
View file @
e7ec62c1
...
...
@@ -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 @
e7ec62c1
...
...
@@ -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 @
e7ec62c1
...
...
@@ -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/TestRefundOrder.java
0 → 100644
View file @
e7ec62c1
This diff is collapsed.
Click to expand it.
src/main/java/com/xiaomai/cases/polar/finance/order/TestSignOrder.java
View file @
e7ec62c1
...
...
@@ -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 @
e7ec62c1
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 @
e7ec62c1
...
...
@@ -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 @
e7ec62c1
/*
* 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 @
e7ec62c1
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 @
e7ec62c1
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 @
e7ec62c1
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
.
YFF_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 @
e7ec62c1
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
.
YFF_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 @
e7ec62c1
...
...
@@ -14,9 +14,11 @@ public class ApiModule {
public
static
String
Polar_Course
=
"polar_course"
;
//会员管理
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