package cn.sikey.hmd.controller.app.razorpay;

import cn.sikey.framework.common.pojo.CommonResult;
import cn.sikey.hmd.controller.app.alipay.vo.CheckPayReqVO;
import cn.sikey.hmd.enums.RateLimit;
import cn.sikey.hmd.service.razorpay.RazorpayPaymentService;
import cn.sikey.pay.api.razorpay.dto.RazorpayTradeDTO;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


/**
 * @Author: nelson
 * @Date: 2025/3/31
 * @Description: 网关
 */
@RestController
@RequestMapping("/hmd/razorpay")
@Slf4j
public class RazorpayPaymentController {

    @Resource
    private RazorpayPaymentService razorpayPaymentService;

    /**
     * 创建订单
     * 手机网站支付
     * yaml，sw_merchant_config，h5
     *
     * @param razorPayTradeDTO razorpay
     * @return
     */
    @RateLimit(key = "razorpayTradeWapPay", type = RateLimit.LimitType.GLOBAL)
    @GetMapping("/razorpayTradeWapPay")
    public CommonResult<CheckPayReqVO> razorpayTradeWapPay(RazorpayTradeDTO razorPayTradeDTO) {
        return razorpayPaymentService.razorpayTradeWapPay(razorPayTradeDTO);
    }

}
