protected override void InitOrderParameter() { base.InitOrderParameter(); #region 商户数据 Merchant.NonceStr = Util.GenerateNonceStr(); GatewayData.Add(Constant.APPID, Merchant.AppId); GatewayData.Add(Constant.MCH_ID, Merchant.MchId); GatewayData.Add(Constant.NONCE_STR, Merchant.NonceStr); GatewayData.Add(Constant.SIGN_TYPE, Merchant.SignType); GatewayData.Add(Constant.NOTIFY_URL, Merchant.NotifyUrl); GatewayData.Add(Constant.DEVICE_INFO, Constant.WEB); #endregion #region 订单数据 GatewayData.Add(Constant.BODY, Order.Body); GatewayData.Add(Constant.OUT_TRADE_NO, Order.OutTradeNo); GatewayData.Add(Constant.FEE_TYPE, Order.FeeType); GatewayData.Add(Constant.TOTAL_FEE, Order.Amount * 100); GatewayData.Add(Constant.TIME_START, Order.TimeStart); GatewayData.Add(Constant.TRADE_TYPE, Order.TradeType); GatewayData.Add(Constant.SPBILL_CREATE_IP, Order.SpbillCreateIp); if (!string.IsNullOrEmpty(Order.Detail)) { GatewayData.Add(Constant.DETAIL, Order.Detail); } if (!string.IsNullOrEmpty(Order.Attach)) { GatewayData.Add(Constant.ATTACH, Order.Attach); } if (!string.IsNullOrEmpty(Order.TimeExpire)) { GatewayData.Add(Constant.TIME_EXPIRE, Order.TimeExpire); } if (!string.IsNullOrEmpty(Order.GoodsTag)) { GatewayData.Add(Constant.GOODS_TAG, Order.GoodsTag); } if (!string.IsNullOrEmpty(Order.ProductId)) { GatewayData.Add(Constant.PRODUCT_ID, Order.ProductId); } if (!string.IsNullOrEmpty(Order.LimitPay)) { GatewayData.Add(Constant.LIMIT_PAY, Order.LimitPay); } if (!string.IsNullOrEmpty(Order.OpenId)) { GatewayData.Add(Constant.OPENID, Order.OpenId); } if (!string.IsNullOrEmpty(Order.SceneInfo)) { GatewayData.Add(Constant.SCENE_INFO, Order.SceneInfo); } #endregion GatewayData.Add(Constant.SIGN, BuildSign()); }
/// <summary> /// 生成签名 /// </summary> private void BuildSign() { Merchant.Sign = EncryptUtil.RSA2(GatewayData.ToUrl(), Merchant.Privatekey); GatewayData.Add(Constant.SIGN, Merchant.Sign); }
protected override void WriteFailureFlag() { GatewayData.Clear(); GatewayData.Add("return_code", "FAIL"); HttpUtil.Write(GatewayData.ToXml()); }
public override void WriteSuccessFlag() { GatewayData.Add(Constant.RETURN_CODE, SUCCESS); HttpUtil.Write(GatewayData.ToXml()); }
public BaseRequest(string method) { RequestUrl = "/gateway.do?charset=UTF-8"; GatewayData.Add("method", method); }
public override void AddGatewayData(TModel model) { base.AddGatewayData(model); GatewayData.Add("biz_content", Util.SerializeObject(model)); }
protected override void WriteSuccessFlag() { GatewayData.Clear(); GatewayData.Add("return_code", "SUCCESS"); HttpUtil.Write(GatewayData.ToXml()); }
public override void AddGatewayData(TModel model) { base.AddGatewayData(model); GatewayData.Add(model, StringCase.Lower); }
internal override void Execute(Merchant merchant) { GatewayData.Remove("notify_url"); GatewayData.Add("sign_type", "HMAC-SHA256"); }