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

import cn.sikey.framework.common.pojo.CommonResult;
import cn.sikey.hmd.enums.RateLimit;
import cn.sikey.hmd.service.alipay.AlipayPaymentService;
import cn.sikey.pay.api.alipay.dto.AliPayTradeDTO;
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/alipay")
@Slf4j
public class AlipayPaymentController {

    @Resource
    private AlipayPaymentService alipayPaymentService;

    /**
     * 创建订单
     * 手机网站支付
     * yaml，sw_merchant_config，h5
     *
     * @param aliPayTradeDTO alipay
     * @return
     */
    @RateLimit(key = "alipayTradeWapPay",type = RateLimit.LimitType.GLOBAL)
    @GetMapping("/alipayTradeWapPay")
    public CommonResult<String> alipayTradeWapPay(AliPayTradeDTO aliPayTradeDTO) {
        return alipayPaymentService.alipayTradeWapPay(aliPayTradeDTO);
    }

}
