You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

167 lines
5.6 KiB
C#

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

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