package com.sqx.modules.pay.controller;

import com.sqx.common.utils.Result;
import com.sqx.modules.app.annotation.Login;
import com.sqx.modules.yskPay.resp.PublicResp;
import com.sqx.modules.yskPay.resp.WxScanPayResp;
import com.sqx.modules.yskPay.service.ThirdPayService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.math.BigDecimal;

/**
 * @author GYJ
 */
@RestController
@Api(value = "用户支付", tags = {"用户支付"})
@RequestMapping("/app/pay")
@Slf4j
public class ThirdPayController {
    final private ThirdPayService thirdPayService;

    public ThirdPayController(ThirdPayService thirdPayService) {
        this.thirdPayService = thirdPayService;
    }

//    @Login
    @ApiOperation("微信支付宝支付订单")
    @PostMapping("/wxPayJsApiOrder")
//    public Result wxPayJsApiOrder(@RequestAttribute("userId") Long userId, Long parentId, Integer type, Long addressId, Integer orderType) throws Exception {
    public Result wxPayJsApiOrder() {

        PublicResp<WxScanPayResp> scanpay = thirdPayService.scanpay("https://paymentapi.sxczgkj.cn", "66691a6afdf641f0bf1dc701",
                "外卖订单", "外卖订单", 1L,
                "WECHAT", "wxd88fffa983758a30", "or1l869Gqm3jUeqbmuL1TFKK4XrM", "1.80.169.5",
                "202407310944110001", "S2406120331",
                "https://paymentapi.sxczgkj.cn", null,
                "jikd52TefZcSPI5hRWrfPSpQcXZrbqshbnLmqH6UattqspIDEzjbGvZmfwTW58RMf1XuPhN4zE1GbIjKy3b1oabgOx5n79faT93Si6i7g2IPSQJAln2NNsCSNynHIJ8p");

        System.out.println(scanpay);

        return new Result();
    }
}
