package com.ruoyi.xq.controller.app;

import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.helper.LoginHelper;
import com.ruoyi.xq.domain.VipOrder;
import com.ruoyi.xq.enums.pay.PlatformTypeEnum;
import com.ruoyi.xq.manager.PayManager;
import com.ruoyi.xq.service.VipOrderService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/api/test")
@Tag(name = "测试接口")
public class PayTestController {

    @Autowired
    private VipOrderService vipOrderService;
    @Autowired
    private PayManager payManager;

    @GetMapping("/vip")
    @Operation(summary = "vip支付流程")
    public R<Void> testVip(Long vipPriceSettingId){
        VipOrder vipOrder = vipOrderService.createVipOrder(LoginHelper.getUserId(), vipPriceSettingId);
        payManager.callBack(vipOrder.getOrderNo(),null,null, PlatformTypeEnum.WX);
        return R.ok();
    }
}
