import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.gic.api.base.commons.Page;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.haoban.manage.api.dto.licence.LicenceOrderDTO;
import com.gic.haoban.manage.api.dto.licence.LicenceOrderPageDTO;
import com.gic.haoban.manage.api.dto.qdto.licence.LicenceOrderPageQDTO;
import com.gic.haoban.manage.api.dto.qdto.licence.LicenceOrderQDTO;
import com.gic.haoban.manage.api.service.licence.LicenceOrderApiService;
import com.gic.haoban.manage.service.entity.licence.TabHaobanLicenceOrder;
import com.gic.haoban.manage.service.service.licence.LicenceOrderService;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

/**
 * @description:
 * @Author: wenhua
 * @Date: 2023/3/22 11:37
 */
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = { "classpath:applicationContext-conf.xml" })
public class LicenceOrderServiceTest {

    @Autowired
    private LicenceOrderService licenceOrderService;
    @Autowired
    private LicenceOrderApiService licenceOrderApiService;

    @Test
    public void test1(){
        Boolean qweqwe = licenceOrderService.uploadLicenceOrderVoucher(1L, "qweqwe","111","111","jx");
    }
    @Test
    public void test2(){
        LicenceOrderPageQDTO qdto = new LicenceOrderPageQDTO();
        Page<LicenceOrderPageDTO> licenceOrderPage = licenceOrderService.getLicenceOrderPage(qdto);

    }
    @Test
    public void test3(){
        ServiceResponse<LicenceOrderDTO> licenceOrderDetail = licenceOrderApiService.getLicenceOrderDetail(1L, null);

    }
    @Test
    public void test4(){
        ServiceResponse<String> result = licenceOrderApiService.payLicenceOrder(512360219787935783L);
    }
    @Test
    public void test5(){
        ServiceResponse<Boolean> booleanServiceResponse = licenceOrderApiService.wxRefund(513736803677659139L);

    }
    @Test
    public void test6(){
        JSONObject json = new JSONObject();
        json.put("infoType","license_refund");
        json.put("openCorpId","wp59NLDQAAWfAU-uhldYZyNZnPXz_1xg");
        json.put("orderId","OI00000D4BD3E76423DDEB15475B1T");
        json.put("timeStamp","1680072171");
        json.put("orderStatus",1);
        json.put("buyerUserId","WangJianFeng");
        licenceOrderApiService.qywxCallBack(JSON.toJSONString(json));

    }
    @Test
    public void test7(){
         licenceOrderApiService.hasPopup("ca66a01b79474c40b3e7c7f93daf1a3b");
    }

    @Test
    public void test8(){
        LicenceOrderQDTO licenceOrderQDTO = new LicenceOrderQDTO();
        licenceOrderQDTO.setEnterpriseId("ff8080815dacd3a2015dacd3ef5c0000");
        licenceOrderQDTO.setWxEnterpriseId("ca66a01b79474c40b3e7c7f93daf1a3b");
        licenceOrderQDTO.setOrderType(1);
        licenceOrderQDTO.setExternalContactCount(10);
        licenceOrderQDTO.setTimeType(1);
        licenceOrderQDTO.setTimeValue(2);
        licenceOrderQDTO.setPayType(1);
        ServiceResponse<String> stringServiceResponse = licenceOrderApiService.saveOrUpdateLicenceOrder(licenceOrderQDTO);

    }
}
