package com.izouma.dingdong.service;

import com.izouma.dingdong.dto.UserOrderDTO;
import com.izouma.dingdong.enums.PayMethod;
import com.izouma.dingdong.enums.RefundReason;
import com.izouma.dingdong.enums.RiderStatus;
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;


@RunWith(SpringRunner.class)
@SpringBootTest
public class OrderInfoServiceTest {
    @Autowired
    private OrderInfoService orderInfoService;

    @Test
    public void testCancel() {
        System.out.println(orderInfoService.cancel(296L, RefundReason.ORDER_TIMEOUT, null, null));
    }

    @Test
    public void test1() {
        orderInfoService.merReceiveOrder(2177L, true);
    }

    @Test
    public void test2() {
        UserOrderDTO build = UserOrderDTO.builder()
                .shoppingCartId(2055L)
                .payMethod(PayMethod.ALI_PAY)
                .addressId(2042L)
                .build();
        orderInfoService.userOrder(build);
    }


    @Test
    public void testBuy() {
        UserOrderDTO dto = UserOrderDTO.builder()
                .addressId(1889L)
                .payMethod(PayMethod.ALI_PAY)
                .shoppingCartId(1985L)
                //.remark("多加点！")
                //.userCouponId(217L)
                .build();

        System.out.println(orderInfoService.userOrder(dto).getId());
    }

    @Test
    public void testPay() {
        orderInfoService.toCompleted(2177L);
    }

    @Test
    public void testMandatory(){
        orderInfoService.mandatory(2027L, RiderStatus.CARRY_OUT);
    }


}
