admin
2021-06-23 b47f8a03db79bb1f6356479cd8a5cf190d7d9694
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
package com.ks;
 
import com.ks.vip.VIPApplication;
import com.ks.vip.exception.OrderPayException;
import com.ks.vip.exception.VipOrderException;
import com.ks.vip.pojo.DTO.VipOrderDTO;
import com.ks.vip.pojo.Enums.PayWayEnum;
import com.ks.vip.service.VipOrederPayService;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
 
import javax.annotation.Resource;
import java.math.BigDecimal;
 
@SpringBootTest(classes = VIPApplication.class)
public class OrderTest {
 
    @Resource
    private VipOrederPayService vipOrederPayService;
 
    @Test
    public void addAlipayOrder() {
        String notifuUrl = "http://api.tejia.yeshitv.com/fanli/client/v1/callback/alipay";
        String resturnUrl = "http://192.168.3.122:8848/tejia-web/vip/index.html";
        VipOrderDTO dto = new VipOrderDTO();
        dto.setUid("tejia-6845887");
        dto.setComboId(1l);
        dto.setPayAccount(null);
        dto.setPayMoney(new BigDecimal("19.9"));
        dto.setPayWay(PayWayEnum.weChat);
        dto.setThreeOrderId("tejia-vip-" + System.currentTimeMillis());
        try {
            vipOrederPayService.addOrderWithPay(dto, notifuUrl, resturnUrl, "192.168.3.122");
        } catch (VipOrderException e) {
            e.printStackTrace();
        }
    }
 
 
    @Test
    public void checkOrder() {
        try {
            vipOrederPayService.checkOrderPayState(1000068L);
        } catch (Exception e) {
            e.printStackTrace();
        }
 
        try {
            vipOrederPayService.checkOrderPayState(1000059L);
        } catch (Exception e) {
            e.printStackTrace();
        }
 
        try {
            vipOrederPayService.checkOrderPayState(1000067L);
        } catch (Exception e) {
            e.printStackTrace();
        }
 
        try {
            vipOrederPayService.checkOrderPayState(1000070L);
        } catch (Exception e) {
            e.printStackTrace();
        }
 
    }
 
 
}