#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
文件名:CombineTransactionsRequestData.cs
文件功能描述:合单支付请求数据
创建标识:Senparc - 20210825
----------------------------------------------------------------*/
using Senparc.Weixin.TenPayV3.Entities;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Senparc.Weixin.TenPayV3.Apis.BasePay
{
public class CombineTransactionsRequestData
{
///
/// 构造函数
///
/// 合单商户appid
/// 合单商户号
/// 合单商户订单号
/// 支付场景描述,可为null
/// 子单信息 最多支持子单条数:10
/// 支付者信息
/// 订单生成时间 遵循rfc3339标准格式,格式为YYYY-MM-DDTHH:mm:ss+TIMEZONE,可为null
/// 订单失效时间 遵循rfc3339标准格式,格式为YYYY-MM-DDTHH:mm:ss+TIMEZONE,可为null
/// 通知URL 必须为直接可访问的URL,不允许携带查询串,要求必须为https地址。
public CombineTransactionsRequestData(string combine_appid, string combine_mchid, string combine_out_trade_no, Scene_Info scene_info, IEnumerable sub_orders, Combine_Payer_Info combine_payer_info, TenpayDateTime time_start, TenpayDateTime time_expire, string notify_url)
{
this.combine_appid = combine_appid;
this.combine_mchid = combine_mchid;
this.combine_out_trade_no = combine_out_trade_no;
this.scene_info = scene_info;
this.sub_orders = sub_orders;
this.combine_payer_info = combine_payer_info;
this.time_start = time_start?.ToString();
this.time_expire = time_expire?.ToString();
this.notify_url = notify_url;
}
///
/// 合单商户appid
/// 合单发起方的appid。
/// 示例值:wxd678efh567hg6787
///
public string combine_appid { get; set; }
///
/// 合单商户号
/// 合单发起方商户号。
/// 示例值:1900000109
///
public string combine_mchid { get; set; }
///
/// 合单商户订单号
/// 合单支付总订单号,要求32个字符内,只能是数字、大小写字母_-|*@ ,且在同一个商户号下唯一。
/// 示例值:P20150806125346
///
public string combine_out_trade_no { get; set; }
///
/// 场景信息 支付场景描述
///
public Scene_Info scene_info { get; set; }
///
/// 子单信息数组
/// 最多支持子单条数:10
///
public IEnumerable sub_orders { get; set; }
///
/// 支付者信息
///
public Combine_Payer_Info combine_payer_info { get; set; }
///
/// 订单生成时间
/// 遵循rfc3339标准格式,格式为YYYY-MM-DDTHH:mm:ss+TIMEZONE
/// 示例值:2018-06-08T10:34:56+08:00
///
public string time_start { get; set; }
///
/// 订单失效时间
/// 遵循rfc3339标准格式,格式为YYYY-MM-DDTHH:mm:ss+TIMEZONE
/// 示例值:2018-06-08T10:34:56+08:00
///
public string time_expire { get; set; }
///
/// 通知地址
/// 通知URL必须为直接可访问的URL,不允许携带查询串,要求必须为https地址。
/// 示例值:https://www.weixin.qq.com/wxpay/pay.php
///
public string notify_url { get; set; }
#region 请求数据类型
///
/// 场景信息
///
public class Scene_Info
{
///
/// 含参构造函数
///
/// 用户终端IP
/// 商户端设备号,可为null
/// H5场景信息,H5下单必填,其它支付方式必须为null
public Scene_Info(string payer_client_ip, string device_id, H5_Info h5_info = null)
{
this.device_id = device_id;
this.payer_client_ip = payer_client_ip;
this.h5_info = h5_info;
}
///
/// 无参构造函数
///
public Scene_Info()
{
}
///
/// 商户端设备号
/// 商户端设备号(门店号或收银设备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 请求数据类型
///
/// H5场景信息
///
public class H5_Info
{
///
/// 含参构造函数
///
/// 场景类型
/// 应用名称,可为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
}
///
/// 子单信息
///
public class Sub_Order
{
///
/// 含参构造函数
///
/// 子单商户号,即合单参与方商户号,必须与发起方appid有绑定关系
/// 附加数据,在查询API和支付通知中原样返回,可作为自定义参数使用
/// 订单金额
/// 商户系统内部订单号
/// 订单优惠标记,可为null
/// 商品描述
/// 结算信息,可为null
public Sub_Order(string mchid, string attach, Amount amount, string out_trade_no, string goods_tag, string description, Settle_Info settle_info)
{
this.mchid = mchid;
this.attach = attach;
this.amount = amount;
this.out_trade_no = out_trade_no;
this.goods_tag = goods_tag;
this.description = description;
this.settle_info = settle_info;
}
///
/// 无参构造函数
///
public Sub_Order()
{
}
///
/// 子单商户号
/// 子单发起方商户号即合单参与方商户号,必须与发起方appid有绑定关系。
/// 示例值:1900000109
///
public string mchid { get; set; }
///
/// 附加数据
/// 附加数据,在查询API和支付通知中原样返回,可作为自定义参数使用
/// 示例值:自定义数据
///
public string attach { get; set; }
///
/// 订单金额
///
public Amount amount { get; set; }
///
/// 子单商户订单号
/// 商户系统内部订单号,要求32个字符内,只能是数字、大小写字母_-|*@ ,且在同一个商户号下唯一。
/// 示例值:20150806125346
///
public string out_trade_no { get; set; }
///
/// 订单优惠标记
/// 示例值:WXG
///
public string goods_tag { get; set; }
///
/// 商品描述
/// 示例值:Image形象店-深圳腾大-QQ公仔
///
public string description { get; set; }
///
/// 结算信息
///
public Settle_Info settle_info { get; set; }
#region 请求数据类型
///
/// 订单金额
///
public class Amount
{
///
/// 含参构造函数
///
/// 订单总金额,单位为分
/// 货币类型 CNY:人民币,境内商户号仅支持人民币
public Amount(int total_amount, string currency)
{
this.total_amount = total_amount;
this.currency = currency;
}
///
/// 无参构造函数
///
public Amount()
{
}
///
/// 总金额
/// 订单总金额,单位为分。
/// 示例值:100 (1元)
///
public int total_amount { get; set; }
///
/// 货币类型
/// CNY:人民币,境内商户号仅支持人民币。
/// 示例值:CNY
///
public string currency { get; set; }
}
///
/// 结算信息
///
public class Settle_Info
{
///
/// 含参构造函数
///
/// 是否指定分账,可为null
/// 补差金额 ,SettleInfo.profit_sharing为true时,该金额才生效,可为null
public Settle_Info(bool profit_sharing, long subsidy_amount)
{
this.profit_sharing = profit_sharing;
this.subsidy_amount = subsidy_amount;
}
///
/// 无参构造函数
///
public Settle_Info()
{
}
///
/// 是否指定分账
///
public bool profit_sharing { get; set; }
///
/// 补差金额
/// SettleInfo.profit_sharing为true时,该金额才生效。
/// 注意:单笔订单最高补差金额为5000元
/// 示例值:10
///
public long subsidy_amount { get; set; }
}
#endregion
}
///
/// 支付者信息
///
public class Combine_Payer_Info
{
///
/// 含参构造函数
///
/// 用户在直连商户appid下的唯一标识
public Combine_Payer_Info(string openid)
{
this.openid = openid;
}
///
/// 无参构造函数
///
public Combine_Payer_Info()
{
}
///
/// 用户标识
/// 用户在直连商户appid下的唯一标识
/// 示例值:oUpF8uMuAJO_M2pxb1Q9zNjWeS6o
///
public string openid { get; set; }
}
#endregion
}
}