using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace POSV { /// /// 微信支付提交的XML Data数据[提交刷卡支付] /// public class WxPayV3MicroPayRequestData:AbstractRequestData { /// /// 公众账号ID /// public string AppId { get; set; } /// /// 商户号 /// public string MchId { get; set; } #region 服务商 /// /// 子商户号 sub_mch_id 是 String(32) 1900000109 微信支付分配的子商户号 /// public string SubMchId { get; set; } #endregion /// /// 随机字符串 /// public string NonceStr { get; set; } /// /// 终端设备号(商户自定义,如门店编号) /// public string DeviceInfo { get; set; } /// /// 商品简单描述,该字段须严格按照规范传递 /// public string Body { get; set; } /// /// 商品详细列表 /// public string Detail { get; set; } /// /// 附加数据,在查询API和支付通知中原样返回,该字段主要用于商户携带订单的自定义数据 /// public string Attach { get; set; } /// /// 商户系统内部的订单号,32个字符内、可包含字母 /// public string OutTradeNo { get; set; } /// /// 订单总金额,单位为分,只能为整数 /// public string TotalFee { get; set; } /// /// 符合ISO4217标准的三位字母代码,默认人民币:CNY /// public string FeeType { get; set; } /// /// 调用微信支付API的机器IP /// public string SpbillCreateIp { get; set; } /// /// 商品标记 /// public string GoodsTag { get; set; } /// /// 扫码支付授权码 /// public string AuthCode { get; set; } /// /// 签名类型 /// public string SignType { get; set; } /// /// /// public string Key { get; set; } public readonly string Sign; /// /// 提交刷卡支付 请求参数 /// /// /// /// /// /// /// /// /// /// /// /// /// /// /// /// public WxPayV3MicroPayRequestData(string appId , string mchId , string subMchId , string key , string nonceStr , string deviceInfo , string body , string detail , string attach , string outTradeNo , string totalFee , string feeType , string spbillCreateIp , string goodsTag , string authCode , string signType = "MD5") { AppId = appId; MchId = mchId; SubMchId = subMchId; NonceStr = nonceStr; DeviceInfo = deviceInfo; Body = body; Detail = detail; Attach = attach; OutTradeNo = outTradeNo; TotalFee = totalFee; FeeType = feeType; SpbillCreateIp = spbillCreateIp; GoodsTag = goodsTag; AuthCode = authCode; SignType = signType; Key = key; #region 设置Request请求参数 //设置package订单参数 NewParameters.Add("appid" , this.AppId); //公众账号ID NewParameters.Add("mch_id" , this.MchId); //商户号 if (!string.IsNullOrEmpty(this.SubMchId)) { NewParameters.Add("sub_mch_id" , this.SubMchId); //子商户号 } NewParameters.Add("device_info" , this.DeviceInfo); //终端设备号 NewParameters.Add("nonce_str" , this.NonceStr); //随机字符串 NewParameters.Add("sign_type" , this.SignType); //签名类型 NewParameters.Add("body" , this.Body); //商品简单描述 NewParameters.Add("detail" , this.Detail); //商品详细列表 NewParameters.Add("attach" , this.Attach); //附加数据 NewParameters.Add("out_trade_no" , this.OutTradeNo); //商户系统内部的订单号 NewParameters.Add("total_fee" , this.TotalFee); //订单总金额 NewParameters.Add("fee_type" , this.FeeType); //货币类型 NewParameters.Add("spbill_create_ip" , this.SpbillCreateIp); //终端IP NewParameters.Add("goods_tag" , this.GoodsTag); //商品标记 NewParameters.Add("auth_code" , this.AuthCode); //授权码 Sign = CreateMd5Sign("key" , this.Key); NewParameters.Add("sign" , Sign); //签名 #endregion } } }