package com.palmnest.application;

public class WxPayConstant {
	/**
	 * 公众号AppId
	 */
	public static final String APP_ID = "wxc794277437aa0034";

	/**
	 * 公众号AppSecret
	 */
	public static final String APP_SECRET = "2944feda26f8b19109b84360314820de";

	/**
	 * 微信支付商户号
	 */
	public static final String MCH_ID = "1486677412";

	/**
	 * 微信支付API秘钥
	 */
	public static final String KEY = "JJKASJKKJ90903490kKKLKkkdnfksklk";

	/**
	 * 微信交易类型:公众号支付
	 */
	public static final String TRADE_TYPE_JSAPI = "JSAPI";

	/**
	 * WEB
	 */
	public static final String WEB = "WEB";

	/**
	 * 返回成功字符串
	 */
	public static final String RETURN_SUCCESS = "SUCCESS";

	/**
	 * 支付地址(包涵回调地址)
	 */
	public static final String PAY_URL   = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxc794277437aa0034&redirect_uri=http%3a%2f%2fwx.palmnest.com%2fsuper_service%2fwechat%2funifiedOrder&response_type=code&scope=snsapi_base#wechat_redirect";
	public static final String PAY_URL_U = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxc794277437aa0034&redirect_uri=http%3a%2f%2fwx.palmnest.com%2fsuper_service%2fwechat%2funifiedOrder&response_type=code&scope=snsapi_userinfo#wechat_redirect";

	/**
	 * 微信统一下单url
	 */
	public static final String UNIFIED_ORDER_URL = "https://api.mch.weixin.qq.com/pay/unifiedorder";

	/**
	 * 微信申请退款url
	 */
	public static final String REFUND_URL = "https://api.mch.weixin.qq.com/secapi/pay/refund";

	/**
	 * 微信支付通知url
	 */
	public static final String NOTIFY_URL = "http://wx.palmnest.com/wechat/pay/wxpayNotify";

	/**
	 * 证书位置
	 */
	public static final String CERT_PATH = "H:/Ws/pes-wxpay/src/main/webapp/cert/apiclient_cert.p12";

	/**
	 * 获取授权URL失败返回码
	 */
	public static final String GET_AUTH_URL_ERROR  = "4001";
	/**
	 * 获取预支付会话标识失败返回码
	 */
	public static final String GET_PREPAYID_ERROR  = "4002";
	/**
	 * 获取统一支付信息失败
	 */
	public static final String UNIFIED_ORDER_ERROR = "4003";

	/**
	 * 通过code获取授权access_token的URL
	 */
	public static String Authtoken_URL(String code, String appId, String appSecret) {
		StringBuffer url = new StringBuffer();
		url.append("https://api.weixin.qq.com/sns/oauth2/access_token?appid=");
		url.append(appId);
		url.append("&secret=");
		url.append(appSecret);
		url.append("&code=");
		url.append(code);
		url.append("&grant_type=authorization_code");
		return url.toString();
	}

	/**
	 * 获取用户授权的URL
	 */
	public static String PAY_URL(String appId, String redirectUri) {
		StringBuffer url = new StringBuffer();
		url.append("https://open.weixin.qq.com/connect/oauth2/authorize?appid=");
		url.append(appId);
		url.append("&redirect_uri=");
		url.append(redirectUri);
		url.append("&response_type=code&scope=snsapi_userinfo#wechat_redirect");
		return url.toString();
	}
}
