package com.ym.mec.collectfee.controller;

import com.ym.mec.collectfee.utils.yqpay.YqPayUtil;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import springfox.documentation.annotations.ApiIgnore;

import java.util.LinkedHashMap;
import java.util.Map;

@ApiIgnore
@Controller
@RequestMapping("yqreg")
public class YqRegController {

    /**
     * 用户（商户）注册
     *
     * @param map
     * @return
     * @throws Exception
     */
    @GetMapping("/register")
    public String register(ModelMap map) throws Exception {

        String notifyUrl = "http://47.99.212.176:9000/yqpay/notify"; //主动通知地址

        Map<String, Object> resultMap = new LinkedHashMap<String, Object>();
        resultMap.put("type", "H5");
        resultMap.put("returnUrl", "https://www.baidu.com");
        resultMap.put("seraialNumber", "785679");
        resultMap.put("merType", "per");

        Map<String, Object> requestMap = new YqPayUtil(notifyUrl, resultMap).getRequestMap();
        map.addAttribute("info", requestMap);
        return "/reg/register";
    }

}
