#region Apache License Version 2.0 /*---------------------------------------------------------------- Copyright 2023 Jeffrey Su & Suzhou Senparc Network Technology Co.,Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. Detail: https://github.com/JeffreySu/WeiXinMPSDK/blob/master/license.md ----------------------------------------------------------------*/ #endregion Apache License Version 2.0 /*---------------------------------------------------------------- Copyright (C) 2023 Senparc 文件名:TransactionsRequestData.cs 文件功能描述:下单请求数据实体 创建标识:Senparc - 20210825 ----------------------------------------------------------------*/ using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Senparc.Weixin.TenPayV3.Entities; namespace Senparc.Weixin.TenPayV3.Apis.BasePay { public class TransactionsRequestData { /// /// 含参构造函数 /// /// 由微信生成的应用ID,全局唯一 /// 直连商户的商户号,由微信支付生成并下发 /// 商品描述 示例值:Image形象店-深圳腾大-QQ公仔 /// 商户系统内部订单号 /// 订单失效时间 遵循rfc3339标准格式,格式为YYYY-MM-DDTHH:mm:ss+TIMEZONE,可为null /// 附加数据,在查询API和支付通知中原样返回,可作为自定义参数使用,可为null /// 通知URL 必须为直接可访问的URL,不允许携带查询串,要求必须为https地址 /// 订单优惠标记 示例值:WXG,可为null /// 订单金额 /// 支付者,JSAPI下单必填,其它下单方式必须为null /// 优惠功能,可为null /// 结算信息,可为null /// 支付场景描述,H5下单必填,其它支付方式可为null public TransactionsRequestData(string appid, string mchid, string description, string out_trade_no, TenpayDateTime time_expire, string attach, string notify_url, string goods_tag, Amount amount, Payer payer = null, Detail detail = null, Settle_Info settle_info = null, Scene_Info scene_info = null) { this.appid = appid; this.mchid = mchid; this.description = description; this.out_trade_no = out_trade_no; this.time_expire = time_expire.ToString(); this.attach = attach; this.notify_url = notify_url; this.goods_tag = goods_tag; this.amount = amount; this.payer = payer; this.detail = detail; this.settle_info = settle_info; this.scene_info = scene_info; } /// /// 应用ID /// 由微信生成的应用ID,全局唯一。请求基础下单接口时请注意APPID的应用属性,例如公众号场景下,需使用应用属性为公众号的APPID /// 示例值:wxd678efh567hg6787 /// public string appid { get; set; } /// /// 直连商户号 /// 直连商户的商户号,由微信支付生成并下发。 /// 示例值:1230000109 /// public string mchid { get; set; } /// /// 商品描述 /// 示例值:Image形象店-深圳腾大-QQ公仔 /// public string description { get; set; } /// /// 商户订单号 /// 商户系统内部订单号,只能是数字、大小写字母_-*且在同一个商户号下唯一 /// 建议:最短失效时间间隔大于1分钟 /// 示例值:1217752501201407033233368018 /// public string out_trade_no { get; set; } /// /// 订单失效时间 /// 遵循rfc3339标准格式,格式为YYYY-MM-DDTHH:mm:ss+TIMEZONE /// 示例值:2018-06-08T10:34:56+08:00 /// public string time_expire { get; set; } /// /// 附加数据 /// 附加数据,在查询API和支付通知中原样返回,可作为自定义参数使用 /// 示例值:自定义数据 /// public string attach { get; set; } /// /// 通知地址 /// 通知URL必须为直接可访问的URL,不允许携带查询串,要求必须为https地址。 /// 示例值:https://www.weixin.qq.com/wxpay/pay.php /// public string notify_url { get; set; } /// /// 订单优惠标记 /// 示例值:WXG /// public string goods_tag { get; set; } /// /// 订单金额 /// public Amount amount { get; set; } /// /// 支付者信息 /// public Payer payer; /// /// 优惠功能 /// public Detail detail { get; set; } /// /// 结算信息 /// public Settle_Info settle_info; /// /// 场景信息 支付场景描述 /// public Scene_Info scene_info { get; set; } #region 请求数据类型 /// /// 订单金额 /// public class Amount { /// /// 含参构造函数 /// /// 订单总金额,单位为分 /// 货币类型 CNY:人民币,境内商户号仅支持人民币,可为null public Amount(int total, string currency) { this.total = total; this.currency = currency; } /// /// 无参构造函数 /// public Amount() { } /// /// 总金额 /// 订单总金额,单位为分。 /// 示例值:100 (1元) /// public int total { get; set; } /// /// 货币类型 /// CNY:人民币,境内商户号仅支持人民币。 /// 示例值:CNY /// public string currency { get; set; } } /// /// 支付者信息 /// public class Payer { /// /// 含参构造函数 /// /// 用户在直连商户appid下的唯一标识 public Payer(string openid) { this.openid = openid; } /// /// 无参构造函数 /// public Payer() { } /// /// 用户标识 /// 用户在直连商户appid下的唯一标识 /// 示例值:oUpF8uMuAJO_M2pxb1Q9zNjWeS6o /// public string openid { get; set; } } /// /// 优惠功能 /// public class Detail { /// /// 含参构造函数 /// /// 订单原价,可为null /// 商家小票ID,可为null /// 单品列表 条目个数限制:[1,6000],可为null public Detail(int cost_price, string invoice_id, Goods_Detail[] goods_detail) { this.invoice_id = invoice_id; this.goods_detail = goods_detail; this.cost_price = cost_price; } /// /// 无参构造函数 /// public Detail() { } /// /// 商家小票ID /// 示例值:微信123 /// public string invoice_id { get; set; } /// /// 单品列表 /// 条目个数限制:[1,6000] /// public Goods_Detail[] goods_detail { get; set; } /// /// 订单原价 /// 1、商户侧一张小票订单可能被分多次支付,订单原价用于记录整张小票的交易金额。 /// 2、当订单原价与支付金额不相等,则不享受优惠。 /// 3、该字段主要用于防止同一张小票分多次支付,以享受多次优惠的情况,正常支付订单不必上传此参数。 /// 示例值:608800 /// public int cost_price { get; set; } #region 请求数据类型 /// /// 单品信息 /// public class Goods_Detail { /// /// 含参构造函数 /// /// 商户侧商品编码 /// 微信侧商品编码,可为null /// 商品名称,可为null /// 用户购买的数量 /// 商品单价,单位为分 public Goods_Detail(string merchant_goods_id, string wechatpay_goods_id, string goods_name, int quantity, int unit_price) { this.goods_name = goods_name; this.wechatpay_goods_id = wechatpay_goods_id; this.quantity = quantity; this.merchant_goods_id = merchant_goods_id; this.unit_price = unit_price; } /// /// 无参构造函数 /// public Goods_Detail() { } /// /// 商品名称 /// 商品的实际名称 /// 示例值:iPhoneX 256G /// public string goods_name { get; set; } /// /// 微信侧商品编码 /// 微信支付定义的统一商品编号(没有可不传) /// 示例值:1001 /// public string wechatpay_goods_id { get; set; } /// /// 商品数量 /// 用户购买的数量 /// 示例值:1 /// public int quantity { get; set; } /// /// 商户侧商品编码 /// 由半角的大小写字母、数字、中划线、下划线中的一种或几种组成。 /// 示例值:1246464644 /// public string merchant_goods_id { get; set; } /// /// 商品单价 /// 商品单价,单位为分 /// 示例值:828800 (8288元) /// public int unit_price { get; set; } } #endregion } /// /// 结算信息 /// public class Settle_Info { /// /// 含参构造函数 /// /// 是否指定分账,可为null public Settle_Info(bool profit_sharing) { this.profit_sharing = profit_sharing; } /// /// 无参构造函数 /// public Settle_Info() { } /// /// 是否指定分账 /// public bool profit_sharing { get; set; } } /// /// 场景信息 /// public class Scene_Info { /// /// 含参构造函数 /// /// 用户终端IP /// 商户端设备号,可为null /// 商户门店信息,可为null /// H5场景信息,H5下单必填,其它支付方式必须为null public Scene_Info(string payer_client_ip, string device_id, Store_Info store_info, H5_Info h5_info = null) { this.store_info = store_info; this.device_id = device_id; this.payer_client_ip = payer_client_ip; this.h5_info = h5_info; } /// /// 无参构造函数 /// public Scene_Info() { } /// /// 商户门店信息 /// public Store_Info store_info { get; set; } /// /// 商户端设备号 /// 商户端设备号(门店号或收银设备ID)。 /// 示例值:013467007045764 /// public string device_id { get; set; } /// /// 用户终端IP /// 用户的客户端IP,支持IPv4和IPv6两种格式的IP地址。 /// 示例值:14.23.150.211 /// public string payer_client_ip { get; set; } /// /// H5场景信息 /// public H5_Info h5_info { get; set; } #region 请求数据类型 /// /// 商户门店信息 /// public class Store_Info { /// /// 含参构造函数 /// /// 商户侧门店编号 /// 商户侧门店名称,可为null /// 地区编码,详细请见省市区编号对照表,可为null /// 详细地址,可为null public Store_Info(string id, string name, string area_code, string address) { this.address = address; this.area_code = area_code; this.name = name; this.id = id; } /// /// 无参构造函数 /// public Store_Info() { } /// /// 详细地址 /// 详细的商户门店地址 /// 示例值:广东省深圳市南山区科技中一道10000号 /// public string address { get; set; } /// /// 地区编码 /// 地区编码,详细请见省市区编号对照表。 /// 示例值:440305 /// public string area_code { get; set; } /// /// 门店名称 /// 商户侧门店名称 /// 示例值:腾讯大厦分店 /// public string name { get; set; } /// /// 门店编号 /// 商户侧门店编号 /// 示例值:0001 /// public string id { get; set; } } /// /// H5场景信息 /// public class H5_Info { /// /// 含参构造函数 /// /// 场景类型 枚举值: iOS, Android, Wap /// 应用名称,可为null /// 应用URL,可为null /// iOS平台BundleID,可为null /// Android平台PackageName,可为null public H5_Info(string type, string app_name, string app_url, string bundle_id, string package_name) { this.type = type; this.app_name = app_name; this.app_url = app_url; this.bundle_id = bundle_id; this.package_name = package_name; } /// /// 无参构造函数 /// public H5_Info() { } /// /// 场景类型 /// 示例值:iOS, Android, Wap /// public string type { get; set; } /// /// 应用名称 /// 示例值:王者荣耀 /// public string app_name { get; set; } /// /// 网站URL /// 示例值:https://pay.qq.com /// public string app_url { get; set; } /// /// iOS平台BundleID /// 示例值:com.tencent.wzryiOS /// public string bundle_id { get; set; } /// /// Android平台PackageName /// 示例值:com.tencent.tmgp.sgame /// public string package_name { get; set; } } #endregion } #endregion } }