package com.tmerclub.cloud.systemtest.api.platform;

import com.alibaba.fastjson2.JSON;
import com.tmerclub.cloud.common.database.vo.PageVO;
import com.tmerclub.cloud.common.util.Json;
import com.tmerclub.cloud.multishop.mongo.MongoShopWalletLogBO;
import com.tmerclub.cloud.order.vo.OrderDetailVO;
import com.moyuer.cloud.systemtest.constants.Constant;
import com.moyuer.cloud.systemtest.util.HttpUtil;
import com.moyuer.cloud.systemtest.util.UrlEnum;

import java.util.List;

/**
 * @author lpj
 */
public class PlatformWalletApi {
    /**
     * 根据订单号查询结算记录
     */
    public static List<MongoShopWalletLogBO> getMongoShopWalletLogBO(Long orderId) {
        String url = Constant.API_URL + "/tmerclub_admin/ma/shopWallet/page?platformIoType=&amountType=&orderId=" + orderId + "&refundId=&reason=&pageNum=1&pageSize=10";
        return JSON.parseArray(JSON.toJSONString(Json.parseObject(JSON.toJSONString(HttpUtil.get(url, PageVO.class, UrlEnum.PLATFORM)), PageVO.class).getList()), MongoShopWalletLogBO.class);
    }

    /**
     * 根据订单号查询结算明细
     */
    public static OrderDetailVO getOrderDetailVO(Long orderId) {
        String url = Constant.API_URL + "/tmerclub_order/mp/order_item/get_order_detail?orderId=" + orderId + "&refundId";
        return HttpUtil.get(url, OrderDetailVO.class, UrlEnum.PLATFORM);
    }

    /**
     * 根据订单号与退款单号查询结算明细
     */
    public static OrderDetailVO getOrderDetailVO(Long orderId, Long refundId) {
        String url = Constant.API_URL + "/tmerclub_order/mp/order_item/get_order_detail?orderId=" + orderId + "&refundId=" + refundId;
        return HttpUtil.get(url, OrderDetailVO.class, UrlEnum.PLATFORM);
    }
}
