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

import cn.sikey.framework.common.pojo.CommonResult;
import cn.sikey.hmd.enums.RateLimit;
import cn.sikey.hmd.service.wechat.WechatPaymentService;
import cn.sikey.pay.api.wechat.dto.WechatPayTradeDTO;
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: qin
 * @Date: 2025/3/31
 * @Description: 网关
 */
@RestController
@RequestMapping("/hmd/wechat")
@Slf4j
public class WechatPaymentController {

    @Resource
    private WechatPaymentService wechatPaymentService;

    /**
     * 创建订单
     * 手机网站支付
     * yaml，sw_merchant_config，h5
     *
     * @param wechatPayTradeDTO wechat
     * @return
     */
    @RateLimit(key = "payTransactionsH5",type = RateLimit.LimitType.GLOBAL)
    @GetMapping("/payTransactionsH5")
    public CommonResult<String> payTransactionsH5(WechatPayTradeDTO wechatPayTradeDTO) {
        return wechatPaymentService.payTransactionsH5(wechatPayTradeDTO);
    }

}
