package com.neusoft.smart.pos.payment.controller;

import com.neusoft.smart.pos.payment.service.UnionPayNotifyService;
import com.neusoft.smart.pos.payment.utils.HttpClientUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import springfox.documentation.annotations.ApiIgnore;

import javax.servlet.http.HttpServletRequest;
import java.util.Map;

@RestController
@RequestMapping(path = "/unionPayNotify")
public class UnionPayNotifyController {

	@Autowired
	private UnionPayNotifyService unionPayNotifyService;

	/**
	 * 微信支付成功回调方法
	 * @return
	 */
	@ApiIgnore
	@RequestMapping(value = "payNotify")
	public String weixinPayNotify(HttpServletRequest request){
		Map<String,String> notifyMapData = HttpClientUtils.getUnionPayDataFromRequest(request);
		return unionPayNotifyService.unionPayNotifyDataHandle(notifyMapData);
	}

}
	