protected override void WriteSuccessFlag() { GatewayData.Clear(); GatewayData.Add("return_code", "SUCCESS"); GatewayData.Add("return_msg", "OK"); HttpUtil.Write(GatewayData.ToXml()); }
/// <summary> /// 当接收到支付网关通知并验证无误时按照支付网关要求格式输出表示成功接收到网关通知的字符串 /// </summary> protected override string GetSuccessFlag() { GatewayData.Clear(); GatewayData.Add("return_code", "SUCCESS"); GatewayData.Add("return_msg", "OK"); return(GatewayData.ToXml()); }
/// <summary> /// 备份并清除网关的参数 /// </summary> private GatewayData BackupAndClearGatewayData() { GatewayData gatewayData = GatewayData; GatewayData.Clear(); return(gatewayData); }
/// <summary> /// 初始化订单参数 /// </summary> private void InitOrderParameter() { GatewayData.Clear(); Order.Amount *= 100; Merchant.NonceStr = Util.GenerateNonceStr(); Merchant.DeviceInfo = Constant.WEB; GatewayData.Add(Merchant); GatewayData.Add(Order); Merchant.Sign = BuildSign(); GatewayData.Add(Constant.SIGN, Merchant.Sign); }
/// <summary> /// 初始化公众号调起支付的参数 /// </summary> private void InitPublicParameter() { GatewayData.Clear(); Merchant.NonceStr = Util.GenerateNonceStr(); GatewayData.Add(Constant.APPID, Merchant.AppId); GatewayData.Add(Constant.TIMESTAMP, DateTime.Now.ToTimeStamp()); GatewayData.Add(Constant.NONCE_STR, Merchant.NonceStr); GatewayData.Add(Constant.PACKAGE, $"{Constant.PREPAY_ID}={Notify.PrepayId}"); GatewayData.Add(Constant.SIGN_TYPE, "MD5"); GatewayData.Add(Constant.PAYSIGN, BuildSign()); }
/// <summary> /// 初始化APP端调起支付的参数 /// </summary> private void InitAppParameter() { GatewayData.Clear(); Merchant.NonceStr = Util.GenerateNonceStr(); GatewayData.Add(Constant.APPID, Merchant.AppId); GatewayData.Add(Constant.PARTNERID, Merchant.MchId); GatewayData.Add(Constant.PREPAYID, Notify.PrepayId); GatewayData.Add(Constant.PACKAGE, "Sign=WXPay"); GatewayData.Add(Constant.NONCE_STR, Merchant.NonceStr); GatewayData.Add(Constant.TIMESTAMP, DateTime.Now.ToTimeStamp()); GatewayData.Add(Constant.SIGN, BuildSign()); }
/// <summary> /// 通过授权码获取OpenId /// </summary> /// <param name="authCode">授权码</param> public string GetOpenIdByAuthCode(string authCode) { GatewayData.Clear(); Merchant.NonceStr = Util.GenerateNonceStr(); GatewayData.Add(Constant.APPID, Merchant.AppId); GatewayData.Add(Constant.MCH_ID, Merchant.AppId); GatewayData.Add(Constant.AUTH_CODE, Merchant.AppId); GatewayData.Add(Constant.NONCE_STR, Merchant.NonceStr); Merchant.Sign = BuildSign(); GatewayData.Add(Constant.SIGN, Merchant.Sign); GatewayUrl = AUTHCODETOOPENIDURL; Commit(); return(Notify.OpenId); }
protected override void WriteFailureFlag() { GatewayData.Clear(); GatewayData.Add("return_code", "FAIL"); HttpUtil.Write(GatewayData.ToXml()); }
/// <summary> /// 当接收到支付网关通知并验证有误时按照支付网关要求格式输出表示失败接收到网关通知的字符串 /// </summary> protected override string GetFailureFlag() { GatewayData.Clear(); GatewayData.Add("return_code", "FAIL"); return(GatewayData.ToXml()); }