package com.izouma.nineth;

import com.github.binarywang.wxpay.bean.request.WxPayRefundRequest;
import com.github.binarywang.wxpay.exception.WxPayException;
import com.github.binarywang.wxpay.service.WxPayService;
import com.izouma.nineth.utils.SnowflakeIdWorker;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;

public class WxTest extends ApplicationTests {
    @Autowired
    private WxPayService wxPayService;

    @Test
    public void refund() throws WxPayException {
        WxPayRefundRequest request = new WxPayRefundRequest();
        request.setTransactionId("4200001324202112096373883962");
        request.setTotalFee(100);
        request.setRefundFee(100);
        request.setOutRefundNo(String.valueOf(new SnowflakeIdWorker(0, 0).nextId()));
        wxPayService.refund(request);
    }
}
