package com.zhongzheng.controller.wx;

import com.github.xiaoymin.knife4j.annotations.ApiSupport;
import com.zhongzheng.common.constant.Constants;
import com.zhongzheng.common.core.domain.AjaxResult;
import com.zhongzheng.common.utils.ServletUtils;
import com.zhongzheng.framework.web.service.WxLoginService;
import com.zhongzheng.framework.web.service.WxTokenService;
import com.zhongzheng.modules.user.entity.ClientLoginUser;
import com.zhongzheng.modules.user.service.IUserService;
import com.zhongzheng.modules.user.vo.UserVo;
import com.zhongzheng.modules.wx.bo.WxLoginBody;
import com.zhongzheng.modules.wx.bo.WxPayBody;
import com.zhongzheng.modules.wx.service.IWxPayService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.HashMap;
import java.util.Map;

@Api(tags ="微信支付操作管理")
@ApiSupport(order = 2)
@RestController
@RequestMapping("/wx/pay")
public class WxPayController
{
    @Autowired
    private WxLoginService wxLoginService;

    @Autowired
    private WxTokenService wxTokenService;

    @Autowired
    private  IUserService iUserService;

    @Autowired
    private IWxPayService iWxPayService;

    /**
     * 支付方法
     *
     * @param wxPayBody 获取支付凭证
     * @return 结果
     */
    @ApiOperation("获取支付凭证")
    @PostMapping("/payment")
    public AjaxResult payment(@RequestBody WxPayBody wxPayBody)  {
        return AjaxResult.success();
    }

    @ApiOperation("获取支付回调凭证")
    @PostMapping("/callback")
    public String callback(@RequestBody String notifyData)
    {
        return iWxPayService.paymentCallBack(notifyData);
    }

}
