package com.liquidnet.service.adam.service.admin.impl;

import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.liquidnet.service.adam.dto.AdamTransactionDto;
import com.liquidnet.service.adam.dto.admin.transaction.*;
import com.liquidnet.service.adam.service.admin.transaction.IAdminTransactionRecordService;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;

/**
 * @author AnJiabin <jiabin.an@lightnet.io>
 * @version V1.0
 * @Description: TODO
 * @class: AdminTransactionRecordServiceImpl
 * @Package com.liquidnet.service.adam.service.admin.impl
 * @Copyright: LightNet @ Copyright (c) 2020
 * @date 2020/11/3 13:30
 */
@SpringBootTest
@RunWith(SpringRunner.class)
public class AdminTransactionServiceImplTest {
    @Autowired
    private IAdminTransactionRecordService adminTransactionRecordService;

    @Test
    public void queryRechargePageList(){
        int pageNum = 1;
        int pageSize = 20;
        AdamRechargeRecordReq queryParam = new AdamRechargeRecordReq();
//        queryParam.setTransactionId("1323110169596596226");
//        queryParam.setWalletNo("115610");
//        queryParam.setCurrency("CNY");
//        queryParam.setTransactionAmountBegin("3000");
//        queryParam.setTransactionAmountEnd("4000");
//        queryParam.setCreateDateBegin("2020-10-01");
//        queryParam.setCreateDateEnd("2020-10-02");
//        queryParam.setCompletedDateBegin("2020-10-03");
//        queryParam.setCompletedDateEnd("2020-10-04");
//        queryParam.setTransactionStatus("processing");
        String comId = "";
        Page<AdamTransactionDto> pageResp = adminTransactionRecordService.queryRechargePageList(pageNum,pageSize,queryParam,comId);
        System.out.println(pageResp.getRecords());
        pageResp.getRecords().forEach(record -> System.out.println(" id===="+ record.getId()));
    }

    @Test
    public void queryPayoutPageList(){
        int pageNum = 1;
        int pageSize = 20;
        AdamPayoutRecordReq queryParam = new AdamPayoutRecordReq();
//        queryParam.setTransactionId("1323110169596596232");
//        queryParam.setWalletNo("115615");
//        queryParam.setCurrency("USD");
//        queryParam.setTransactionAmountBegin("5000");
        queryParam.setTransactionAmountEnd("5000");
//        queryParam.setTransactionDateBegin("2020-10-01");
//        queryParam.setTransactionDateEnd("2020-10-02");
//        queryParam.setExecutionDateBegin("2020-10-03");
//        queryParam.setExecutionDateEnd("2020-10-04");
//        queryParam.setTransactionStatus("processing");
        String comId = "";
        Page<AdamTransactionDto> pageResp = adminTransactionRecordService.queryPayoutPageList(pageNum,pageSize,queryParam,comId);
        System.out.println(pageResp.getRecords());
        pageResp.getRecords().forEach(record -> System.out.println(" id===="+ record.getId()));
    }

    @Test
    public void queryConversionPageList(){
        int pageNum = 1;
        int pageSize = 20;
        AdamConversionRecordReq queryParam = new AdamConversionRecordReq();
        String comId = "";
        Page<AdamTransactionDto> pageResp = adminTransactionRecordService.queryConversionPageList(pageNum,pageSize,queryParam,comId);
        System.out.println(pageResp.getRecords());
        pageResp.getRecords().forEach(record -> System.out.println(" id===="+ record.getId()));
    }
    @Test
    public void getPayoutDetailByOrderId(){
        String orderId = "";
        int pageNum = 1;
        int pageSize = 20;
        AdamConversionRecordReq queryParam = new AdamConversionRecordReq();
        String comId = "";
        AdamPayoutDetailDto pageResp = adminTransactionRecordService.getPayoutDetailByOrderId(orderId);
        System.out.println(JSON.toJSON(pageResp).toString());
    }
}
