Commit 347695d5 authored by 赵然's avatar 赵然

zr

parent 3d0f5d38
package http.service.Activity;
import base.DuibaLog;
import http.service.Authorization;
import io.restassured.response.Response;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.testng.Assert;
import java.util.HashMap;
import java.util.Map;
import static io.restassured.RestAssured.given;
/**
* Created by zhaoran on 2019/03/29
*/
@Service
public class GlobalRewardService {
@Autowired
Authorization authorization;
@Value("${activity.host}")
String activityHost;
private DuibaLog logger = DuibaLog.getLogger();
/**
* 获取红包账户
* @param cookies
* @return
* @throws Exception
*/
public Response getWalletAccount(Map cookies) throws Exception {
logger.info("请求getWalletAccount");
Response response = given().cookies(cookies).get(activityHost+"/walletAccount/getWalletAccount");
try{
Assert.assertEquals(response.jsonPath().getString("success"),"true","/walletAccount/getWalletAccount接口失败");
}catch(Exception e){
throw new Exception("/walletAccount/getWalletAccount接口失败,返回信息:"+response.asString());
}catch(Error er){
throw new Exception("/walletAccount/getWalletAccount接口失败,返回信息:"+response.asString());
}
return response;
}
/**
* 红包账户提现
* @param cookies
* @param amount
* @param account
* @param username
* @return
* @throws Exception
*/
public Response withdraw(Map cookies,String amount,String account,String username) throws Exception {
logger.info("请求withdraw");
Map<String,String> map = new HashMap<>();
map.put("amount",amount);
map.put("account",account);
map.put("username",username);
Response response = given().contentType("application/x-www-form-urlencoded;charset=UTF-8").cookies(cookies).params(map).post(activityHost+"/globalReward/withdraw");
try{
Assert.assertEquals(response.jsonPath().getString("success"),"true","/walletAccount/doTakePrize接口失败");
}catch(Exception e){
throw new Exception("/globalReward/withdraw接口失败,返回信息:"+response.asString());
}catch(Error er){
throw new Exception("/globalReward/withdraw接口失败,返回信息:"+response.asString());
}
return response;
}
/**
* 红包账户提现
* @param cookies
* @param orderId
* @return
* @throws Exception
*/
public Response getOrderStatus(Map cookies,String orderId) throws Exception {
logger.info("请求getOrderStatus");
Map<String,String> map = new HashMap<>();
map.put("orderId",orderId);
Response response = given().cookies(cookies).params(map).post(activityHost+"/walletAccount/getOrderStatus");
try{
Assert.assertEquals(response.jsonPath().getString("success"),"true","/walletAccount/getOrderStatus接口失败");
}catch(Exception e){
throw new Exception("/walletAccount/getOrderStatus接口失败,返回信息:"+response.asString());
}catch(Error er){
throw new Exception("/walletAccount/getOrderStatus接口失败,返回信息:"+response.asString());
}
return response;
}
public Response getOrderStatus2(Map cookies,String orderId) throws Exception {
logger.info("请求getOrderStatus");
Map<String,String> map = new HashMap<>();
map.put("orderId",orderId);
Response response = given().cookies(cookies).params(map).post(activityHost+"/walletAccount/getOrderStatus");
return response;
}
/**
* 红包账户提现记录
* @param cookies
* @return
* @throws Exception
*/
public Response walletDetail(Map cookies) throws Exception {
logger.info("请求walletDetail");
Map<String,String> map = new HashMap<>();
map.put("pageNo","1");
map.put("pageSize","12");
Response response = given().cookies(cookies).params(map).get(activityHost+"/walletAccount/walletDetail");
try{
Assert.assertEquals(response.jsonPath().getString("success"),"true","/walletAccount/walletDetail接口失败");
}catch(Exception e){
throw new Exception("/walletAccount/walletDetail接口失败,返回信息:"+response.asString());
}catch(Error er){
throw new Exception("/walletAccount/walletDetail接口失败,返回信息:"+response.asString());
}
return response;
}
/**
* 红包账户修改钱包账户余额后门
* @param consumerId
* @param accountType
* @param balanceAmount
* @return
* @throws Exception
*/
public void updateConsumerAccount(String consumerId,String accountType,String balanceAmount) throws Exception {
logger.info("请求修改钱包账户余额后门:updateConsumerAccount");
Map<String,String> map = new HashMap<>();
map.put("consumerId",consumerId);
map.put("accountType",accountType);
map.put("balanceAmount",balanceAmount);
Response response = given().params(map).get(activityHost+"/aaw/automated/updateConsumerAccount");
// try{
// Assert.assertEquals(response.jsonPath().getString("success"),"true","/walletAccount/walletDetail接口失败");
//
// }catch(Exception e){
// throw new Exception("/aaw/automated/updateConsumerAccount接口失败,返回信息:"+response.asString());
// }catch(Error er){
// throw new Exception("/aaw/automated/updateConsumerAccount接口失败,返回信息:"+response.asString());
//
// }
//return response;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment