#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 文件名:RefundRequestData.cs 文件功能描述:微信支付申请退款请求数据 创建标识:Senparc - 20210814 修改标识:Senparc - 20210819 修改描述:完善注释; 增加构造函数 ----------------------------------------------------------------*/ using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Xml.Schema; namespace Senparc.Weixin.TenPayV3.Apis.BasePay { public class RefundRequsetData { /// /// 含参构造函数 /// /// 原支付交易对应的微信订单号,transaction_id与out_trade_no二选一传入 /// 微信支付订单号,transaction_id与out_trade_no二选一传入 /// 商户系统内部的退款单号,商户系统内部唯一 /// 若商户传入,会在下发给用户的退款消息中体现退款原因,可为null /// 异步接收微信支付退款结果通知的回调地址,通知url必须为外网可访问的url,不能携带参数。 如果参数中传了notify_url,则商户平台上配置的回调地址将不会生效,优先回调当前传的这个地址,可为null /// 退款资金来源 若传递此参数则使用对应的资金账户退款,否则默认使用未结算资金退款(仅对老资金流商户适用),可为null /// 订单金额信息 /// 退款商品,可为null public RefundRequsetData(string transaction_id, string out_trade_no, string out_refund_no, string reason, string notify_url, string funds_account, Amount amount, Goods_Detail[] goods_detail) { this.transaction_id = transaction_id; this.out_trade_no = out_trade_no; this.out_refund_no = out_refund_no; this.reason = reason; this.notify_url = notify_url; this.funds_account = funds_account; this.amount = amount; this.goods_detail = goods_detail; } /// /// 无参构造函数 /// public RefundRequsetData() { } /// /// 微信支付订单号 /// 原支付交易对应的微信订单号 /// 示例值:1217752501201407033233368018 /// public string transaction_id { get; set; } /// /// 商户订单号 /// 原支付交易对应的商户订单号 /// 示例值:1217752501201407033233368018 /// public string out_trade_no { get; set; } /// /// 商户退款单号 /// 商户系统内部的退款单号,商户系统内部唯一,只能是数字、大小写字母_-|*@ ,同一退款单号多次请求只退一笔。 /// 示例值:1217752501201407033233368018 /// public string out_refund_no { get; set; } /// /// 退款原因 /// 若商户传入,会在下发给用户的退款消息中体现退款原因 /// 示例值:商品已售完 /// public string reason { get; set; } /// /// 退款结果回调url /// 异步接收微信支付退款结果通知的回调地址,通知url必须为外网可访问的url,不能携带参数。 如果参数中传了notify_url,则商户平台上配置的回调地址将不会生效,优先回调当前传的这个地址。 /// 示例值:https://weixin.qq.com /// public string notify_url { get; set; } /// /// 退款资金来源 /// 若传递此参数则使用对应的资金账户退款,否则默认使用未结算资金退款(仅对老资金流商户适用) /// 枚举值: /// AVAILABLE:可用余额账户 /// 示例值:AVAILABLE /// public string funds_account { get; set; } /// /// 订单金额信息 /// public Amount amount { get; set; } /// /// 退款商品 /// 指定商品退款需要传此参数,其他场景无需传递 /// public Goods_Detail[] goods_detail { get; set; } #region 请求数据类型 /// /// 订单金额信息 /// public class Amount { /// /// 含参构造函数 /// /// 退款金额 币种的最小单位,只能为整数,不能超过原订单支付金额 /// 退款出资账户及金额,可为null /// 订单总金额,单位为分 /// 货币类型 境内商户号仅支持人民币 public Amount(int refund, From[] from, int total, string currency) { this.refund = refund; this.from = from; this.total = total; this.currency = currency; } /// /// 无参构造函数 /// public Amount() { } /// /// 退款金额,币种的最小单位,只能为整数,不能超过原订单支付金额。 /// 示例值:888 /// public int refund { get; set; } /// /// 退款金额,币种的最小单位,只能为整数,不能超过原订单支付金额。 /// 示例值:888 /// public From[] from { get; set; } /// /// 总金额 /// 订单总金额,单位为分。 /// 示例值:100 (1元) /// public int total { get; set; } /// /// 货币类型 /// CNY:人民币,境内商户号仅支持人民币。 /// 示例值:CNY /// public string currency { get; set; } #region 请求数据类型 /// /// 退款出资账户及金额 /// public class From { /// /// 含参构造函数 /// /// 出资账户类型 /// 对应账户出资金额 public From(string account, string amount) { this.account = account; this.amount = amount; } /// /// 无参构造函数 /// public From() { } /// /// 出资账户类型 /// 下面枚举值多选一。 /// 枚举值: /// AVAILABLE : 可用余额 /// UNAVAILABLE : 不可用余额 /// 示例值:AVAILABLE /// public string account { get; set; } /// /// 出资金额 /// 对应账户出资金额 /// 示例值:444 /// public string amount { get; set; } } #endregion } /// /// 单品列表信息 /// public class Goods_Detail { /// /// 含参构造函数 /// /// 商户侧商品编码 /// 微信侧商品编码,可为null /// 商品的实际名称,可为null /// 商品单价,单位为分 /// 商品退款金额,单位为分 /// 单品的退款数量 public Goods_Detail(string merchant_goods_id, string wechatpay_goods_id, string goods_name, int unit_price, int refund_amount, int refund_quantity) { this.merchant_goods_id = merchant_goods_id; this.wechatpay_goods_id = wechatpay_goods_id; this.goods_name = goods_name; this.unit_price = unit_price; this.refund_amount = refund_amount; this.refund_quantity = refund_quantity; } /// /// 无参构造函数 /// public Goods_Detail() { } /// /// 商户侧商品编码 /// 由半角的大小写字母、数字、中划线、下划线中的一种或几种组成 /// 示例值:1217752501201407033233368018 /// public string merchant_goods_id { get; set; } /// /// 微信侧商品编码 /// 微信支付定义的统一商品编号(没有可不传) /// 示例值:1001 /// public string wechatpay_goods_id { get; set; } /// /// 商品的实际名称 /// 示例值:iPhone6s 16G /// public string goods_name { get; set; } /// /// 商品单价 /// 商品单价,单位为分 /// 示例值:828800 (8288元) /// public int unit_price { get; set; } /// /// 商品退款金额,单位为分 /// 示例值:528800 /// public int refund_amount { get; set; } /// /// 单品的退款数量 /// 示例值:1 /// public int refund_quantity { get; set; } } #endregion } }