feat(tenpaybusiness): 新增二维码支付、小程序支付、App 支付、企业微信支付等预下单接口

This commit is contained in:
Fu Diwei 2023-04-11 14:52:04 +08:00
parent b105be0a0d
commit c30f3473a4
19 changed files with 1071 additions and 238 deletions

View File

@ -8,6 +8,64 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayBusiness
{
public static class WechatTenpayBusinessClientExecutePaymentsExtensions
{
/// <summary>
/// <para>异步调用 [POST] /mse-pay/payments/app-pay 接口。</para>
/// <para>REF: https://businesspay.qq.com/p/doc/mse/api/server.html#%E6%94%AF%E4%BB%98%E9%A2%84%E4%B8%8B%E5%8D%95 </para>
/// <para>REF: https://businesspay.qq.com/p/doc/mse/api/server.html#%E6%94%AF%E4%BB%98%E9%A2%84%E4%B8%8B%E5%8D%95-2 </para>
/// </summary>
/// <param name="client"></param>
/// <param name="request"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
public static async Task<Models.CreatePaymentAppPayResponse> ExecuteCreatePaymentAppPayAsync(this WechatTenpayBusinessClient client, Models.CreatePaymentAppPayRequest request, CancellationToken cancellationToken = default)
{
if (client is null) throw new ArgumentNullException(nameof(client));
if (request is null) throw new ArgumentNullException(nameof(request));
IFlurlRequest flurlReq = client
.CreateRequest(request, HttpMethod.Post, "mse-pay", "payments", "app-pay");
return await client.SendRequestWithJsonAsync<Models.CreatePaymentAppPayResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
}
/// <summary>
/// <para>异步调用 [POST] /mse-pay/payments/app-registering-pay 接口。</para>
/// <para>REF: https://businesspay.qq.com/p/doc/mse/api/server.html#%E5%BC%80%E9%80%9A%E5%B9%B6%E6%94%AF%E4%BB%98%E9%A2%84%E4%B8%8B%E5%8D%95 </para>
/// </summary>
/// <param name="client"></param>
/// <param name="request"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
public static async Task<Models.CreatePaymentAppRegisteringPayResponse> ExecuteCreatePaymentAppRegisteringPayAsync(this WechatTenpayBusinessClient client, Models.CreatePaymentAppRegisteringPayRequest request, CancellationToken cancellationToken = default)
{
if (client is null) throw new ArgumentNullException(nameof(client));
if (request is null) throw new ArgumentNullException(nameof(request));
IFlurlRequest flurlReq = client
.CreateRequest(request, HttpMethod.Post, "mse-pay", "payments", "app-registering-pay");
return await client.SendRequestWithJsonAsync<Models.CreatePaymentAppRegisteringPayResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
}
/// <summary>
/// <para>异步调用 [POST] /mse-pay/payments/qrcode-pay 接口。</para>
/// <para>REF: https://businesspay.qq.com/p/doc/mse/api/server.html#%E4%BA%8C%E7%BB%B4%E7%A0%81%E6%94%AF%E4%BB%98%E9%A2%84%E4%B8%8B%E5%8D%95 </para>
/// </summary>
/// <param name="client"></param>
/// <param name="request"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
public static async Task<Models.CreatePaymentQrcodePayResponse> ExecuteCreatePaymentQrcodePayAsync(this WechatTenpayBusinessClient client, Models.CreatePaymentQrcodePayRequest request, CancellationToken cancellationToken = default)
{
if (client is null) throw new ArgumentNullException(nameof(client));
if (request is null) throw new ArgumentNullException(nameof(request));
IFlurlRequest flurlReq = client
.CreateRequest(request, HttpMethod.Post, "mse-pay", "payments", "qrcode-pay");
return await client.SendRequestWithJsonAsync<Models.CreatePaymentQrcodePayResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
}
/// <summary>
/// <para>异步调用 [POST] /mse-pay/payments/h5-pay 接口。</para>
/// <para>REF: https://businesspay.qq.com/p/doc/mse/api/server.html#h5%E6%94%AF%E4%BB%98 </para>
@ -27,6 +85,25 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayBusiness
return await client.SendRequestWithJsonAsync<Models.CreatePaymentH5PayResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
}
/// <summary>
/// <para>异步调用 [POST] /mse-pay/payments/mp-pay 接口。</para>
/// <para>REF: https://businesspay.qq.com/p/doc/mse/api/server.html#mp%E6%94%AF%E4%BB%98%E9%A2%84%E4%B8%8B%E5%8D%95 </para>
/// </summary>
/// <param name="client"></param>
/// <param name="request"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
public static async Task<Models.CreatePaymentMiniProgramPayResponse> ExecuteCreatePaymentMiniProgramPayAsync(this WechatTenpayBusinessClient client, Models.CreatePaymentMiniProgramPayRequest request, CancellationToken cancellationToken = default)
{
if (client is null) throw new ArgumentNullException(nameof(client));
if (request is null) throw new ArgumentNullException(nameof(request));
IFlurlRequest flurlReq = client
.CreateRequest(request, HttpMethod.Post, "mse-pay", "payments", "mp-pay");
return await client.SendRequestWithJsonAsync<Models.CreatePaymentMiniProgramPayResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
}
/// <summary>
/// <para>异步调用 [GET] /mse-pay/payments/out-payment-id/{out_payment_id} 接口。</para>
/// <para>REF: https://businesspay.qq.com/p/doc/mse/api/server.html#%E6%9F%A5%E8%AF%A2%E8%AE%A2%E5%8D%95%E6%98%8E%E7%BB%86-%E5%A4%96%E5%8D%95%E5%8F%B7 </para>

View File

@ -0,0 +1,325 @@
using System;
using System.Collections.Generic;
namespace SKIT.FlurlHttpClient.Wechat.TenpayBusiness.Models
{
/// <summary>
/// <para>表示 [POST] /mse-pay/payments/app-pay 接口的请求。</para>
/// </summary>
[WechatTenpayBusinessSensitive]
public class CreatePaymentAppPayRequest : WechatTenpayBusinessRequest
{
public static class Types
{
public class Payee
{
/// <summary>
/// 获取或设置企业 ID。
/// </summary>
[Newtonsoft.Json.JsonProperty("ent_id")]
[System.Text.Json.Serialization.JsonPropertyName("ent_id")]
public string EnterpriseId { get; set; } = string.Empty;
/// <summary>
/// 获取或设置企业名称(需使用微企付公钥加密)。
/// </summary>
[Newtonsoft.Json.JsonProperty("ent_name")]
[System.Text.Json.Serialization.JsonPropertyName("ent_name")]
[WechatTenpayBusinessSensitiveProperty]
public string EnterpriseName { get; set; } = string.Empty;
/// <summary>
/// 获取或设置企业账户 ID。
/// </summary>
[Newtonsoft.Json.JsonProperty("ent_acct_id")]
[System.Text.Json.Serialization.JsonPropertyName("ent_acct_id")]
public string? EnterpriseAccountId { get; set; }
/// <summary>
/// 获取或设置银行卡号后 4 位。
/// </summary>
[Newtonsoft.Json.JsonProperty("bank_account_number_last4")]
[System.Text.Json.Serialization.JsonPropertyName("bank_account_number_last4")]
public string? BankAccountNumberLast4String { get; set; }
}
public class Payer
{
/// <summary>
/// 获取或设置付款方 ID。
/// </summary>
[Newtonsoft.Json.JsonProperty("payer_id")]
[System.Text.Json.Serialization.JsonPropertyName("payer_id")]
public string? PayerId { get; set; }
/// <summary>
/// 获取或设置付款方名称。
/// </summary>
[Newtonsoft.Json.JsonProperty("payer_name")]
[System.Text.Json.Serialization.JsonPropertyName("payer_name")]
public string? PayerName { get; set; }
/// <summary>
/// 获取或设置平台付款方 ID。
/// </summary>
[Newtonsoft.Json.JsonProperty("out_payer_id")]
[System.Text.Json.Serialization.JsonPropertyName("out_payer_id")]
public string? OutPayerId { get; set; }
/// <summary>
/// 获取或设置银行卡号列表(需使用微企付公钥加密)。
/// </summary>
[Newtonsoft.Json.JsonProperty("bank_account_numbers")]
[System.Text.Json.Serialization.JsonPropertyName("bank_account_numbers")]
[WechatTenpayBusinessSensitiveProperty]
public IList<string>? BankAccountNumberList { get; set; }
}
public class Goods
{
/// <summary>
/// 获取或设置商品名称。
/// </summary>
[Newtonsoft.Json.JsonProperty("good_name")]
[System.Text.Json.Serialization.JsonPropertyName("good_name")]
public string GoodsName { get; set; } = string.Empty;
/// <summary>
/// 获取或设置商品数量。
/// </summary>
[Newtonsoft.Json.JsonProperty("good_number")]
[System.Text.Json.Serialization.JsonPropertyName("good_number")]
public int Quantity { get; set; }
/// <summary>
/// 获取或设置商品金额(单位:分)。
/// </summary>
[Newtonsoft.Json.JsonProperty("good_amount")]
[System.Text.Json.Serialization.JsonPropertyName("good_amount")]
public int Amount { get; set; }
}
public class NotifyConfig
{
public static class Types
{
public class FrontendCallback
{
/// <summary>
/// 获取或设置 Android 回跳地址。
/// </summary>
[Newtonsoft.Json.JsonProperty("android_url")]
[System.Text.Json.Serialization.JsonPropertyName("android_url")]
public string? AndroidUrl { get; set; }
/// <summary>
/// 获取或设置 iOS 回跳地址。
/// </summary>
[Newtonsoft.Json.JsonProperty("ios_url")]
[System.Text.Json.Serialization.JsonPropertyName("ios_url")]
public string? iOSUrl { get; set; }
}
}
/// <summary>
/// 获取或设置支付结果通知 URL。
/// </summary>
[Newtonsoft.Json.JsonProperty("server_notify_url")]
[System.Text.Json.Serialization.JsonPropertyName("server_notify_url")]
public string ServerNotifyUrl { get; set; } = string.Empty;
/// <summary>
/// 获取或设置前端回跳信息。
/// </summary>
[Newtonsoft.Json.JsonProperty("front_callback_url")]
[System.Text.Json.Serialization.JsonPropertyName("front_callback_url")]
public Types.FrontendCallback? FrontendCallback { get; set; }
}
public class RiskControl
{
/// <summary>
/// 获取或设置设备号。
/// </summary>
[Newtonsoft.Json.JsonProperty("device_id")]
[System.Text.Json.Serialization.JsonPropertyName("device_id")]
public string? DeviceId { get; set; }
/// <summary>
/// 获取或设置用户终端 IP。
/// </summary>
[Newtonsoft.Json.JsonProperty("payer_client_ip")]
[System.Text.Json.Serialization.JsonPropertyName("payer_client_ip")]
public string? ClientIp { get; set; }
/// <summary>
/// 获取或设置用户浏览器 User-Agent。
/// </summary>
[Newtonsoft.Json.JsonProperty("payer_ua")]
[System.Text.Json.Serialization.JsonPropertyName("payer_ua")]
public string? ClientUserAgent { get; set; }
/// <summary>
/// 获取或设置下单时间。
/// </summary>
[Newtonsoft.Json.JsonProperty("create_time")]
[Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.RFC3339NullableDateTimeOffsetConverter))]
[System.Text.Json.Serialization.JsonPropertyName("create_time")]
[System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Converters.RFC3339NullableDateTimeOffsetConverter))]
public DateTimeOffset? CreateTime { get; set; }
/// <summary>
/// 获取或设置提货方式。
/// </summary>
[Newtonsoft.Json.JsonProperty("pick_type")]
[System.Text.Json.Serialization.JsonPropertyName("pick_type")]
public string? PickType { get; set; }
/// <summary>
/// 获取或设置提货描述。
/// </summary>
[Newtonsoft.Json.JsonProperty("pick_description")]
[System.Text.Json.Serialization.JsonPropertyName("pick_description")]
public string? PickDescription { get; set; }
}
public class Scene
{
public static class Types
{
public class Store
{
/// <summary>
/// 获取或设置门店编号。
/// </summary>
[Newtonsoft.Json.JsonProperty("id")]
[System.Text.Json.Serialization.JsonPropertyName("id")]
public string? Id { get; set; }
/// <summary>
/// 获取或设置门店名称。
/// </summary>
[Newtonsoft.Json.JsonProperty("name")]
[System.Text.Json.Serialization.JsonPropertyName("name")]
public string? Name { get; set; }
/// <summary>
/// 获取或设置地区编号。
/// </summary>
[Newtonsoft.Json.JsonProperty("area_code")]
[System.Text.Json.Serialization.JsonPropertyName("area_code")]
public string? AreaCode { get; set; }
}
}
/// <summary>
/// 获取或设置门店信息。
/// </summary>
[Newtonsoft.Json.JsonProperty("store_info")]
[System.Text.Json.Serialization.JsonPropertyName("store_info")]
public Types.Store? Store { get; set; }
}
}
/// <summary>
/// 获取或设置付款类型。
/// </summary>
[Newtonsoft.Json.JsonProperty("purchaser_type")]
[System.Text.Json.Serialization.JsonPropertyName("purchaser_type")]
public string PurchaserType { get; set; } = string.Empty;
/// <summary>
/// 获取或设置平台支付单号。
/// </summary>
[Newtonsoft.Json.JsonProperty("out_payment_id")]
[System.Text.Json.Serialization.JsonPropertyName("out_payment_id")]
public string OutPaymentId { get; set; } = string.Empty;
/// <summary>
/// 获取或设置支付金额(单位:分)。
/// </summary>
[Newtonsoft.Json.JsonProperty("amount")]
[System.Text.Json.Serialization.JsonPropertyName("amount")]
public int Amount { get; set; }
/// <summary>
/// 获取或设置币种。
/// <para>默认值CNY</para>
/// </summary>
[Newtonsoft.Json.JsonProperty("currency")]
[System.Text.Json.Serialization.JsonPropertyName("currency")]
public string Currency { get; set; } = "CNY";
/// <summary>
/// 获取或设置过期时间。
/// </summary>
[Newtonsoft.Json.JsonProperty("expire_time")]
[Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.RFC3339DateTimeOffsetConverter))]
[System.Text.Json.Serialization.JsonPropertyName("expire_time")]
[System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Converters.RFC3339DateTimeOffsetConverter))]
public DateTimeOffset ExpireTime { get; set; }
/// <summary>
/// 获取或设置收款方信息。
/// </summary>
[Newtonsoft.Json.JsonProperty("payee")]
[System.Text.Json.Serialization.JsonPropertyName("payee")]
public Types.Payee Payee { get; set; } = new Types.Payee();
/// <summary>
/// 获取或设置付款方信息。
/// </summary>
[Newtonsoft.Json.JsonProperty("payer")]
[System.Text.Json.Serialization.JsonPropertyName("payer")]
public Types.Payer? Payer { get; set; }
/// <summary>
/// 获取或设置附言。
/// </summary>
[Newtonsoft.Json.JsonProperty("memo")]
[System.Text.Json.Serialization.JsonPropertyName("memo")]
public string? Memo { get; set; }
/// <summary>
/// 获取或设置商品信息列表。
/// </summary>
[Newtonsoft.Json.JsonProperty("goods")]
[System.Text.Json.Serialization.JsonPropertyName("goods")]
public IList<Types.Goods>? GoodsList { get; set; }
/// <summary>
/// 获取或设置附加信息。
/// </summary>
[Newtonsoft.Json.JsonProperty("attachment")]
[System.Text.Json.Serialization.JsonPropertyName("attachment")]
public string? Attachment { get; set; }
/// <summary>
/// 获取或设置风控信息。
/// </summary>
[Newtonsoft.Json.JsonProperty("risk_control")]
[System.Text.Json.Serialization.JsonPropertyName("risk_control")]
public Types.RiskControl? RiskControl { get; set; }
/// <summary>
/// 获取或设置回调配置信息。
/// </summary>
[Newtonsoft.Json.JsonProperty("notify_url")]
[System.Text.Json.Serialization.JsonPropertyName("notify_url")]
public Types.NotifyConfig NotifyConfig { get; set; } = new Types.NotifyConfig();
/// <summary>
/// 获取或设置场景信息。
/// </summary>
[Newtonsoft.Json.JsonProperty("scene_info")]
[System.Text.Json.Serialization.JsonPropertyName("scene_info")]
public Types.Scene? Scene { get; set; }
/// <summary>
/// 获取或设置分账标识。
/// </summary>
[Newtonsoft.Json.JsonProperty("profit_allocation_flag")]
[System.Text.Json.Serialization.JsonPropertyName("profit_allocation_flag")]
public string? ProfitAllocationFlag { get; set; }
}
}

View File

@ -0,0 +1,9 @@
namespace SKIT.FlurlHttpClient.Wechat.TenpayBusiness.Models
{
/// <summary>
/// <para>表示 [POST] /mse-pay/payments/app-pay 接口的响应。</para>
/// </summary>
public class CreatePaymentAppPayResponse : GetPaymentByPaymentIdResponse
{
}
}

View File

@ -0,0 +1,106 @@
using System.Collections.Generic;
namespace SKIT.FlurlHttpClient.Wechat.TenpayBusiness.Models
{
/// <summary>
/// <para>表示 [POST] /mse-pay/payments/app-registering-pay 接口的请求。</para>
/// </summary>
[WechatTenpayBusinessSensitive]
public class CreatePaymentAppRegisteringPayRequest : CreatePaymentAppPayRequest
{
public static new class Types
{
public class Payee : CreatePaymentAppPayRequest.Types.Payee
{
}
public class Payer : CreatePaymentAppPayRequest.Types.Payer
{
}
public class Goods : CreatePaymentAppPayRequest.Types.Goods
{
}
public class NotifyConfig : CreatePaymentAppPayRequest.Types.NotifyConfig
{
public static new class Types
{
public class FrontendCallback : CreatePaymentAppPayRequest.Types.NotifyConfig.Types.FrontendCallback
{
}
}
/// <summary>
/// 获取或设置前端回跳信息。
/// </summary>
[Newtonsoft.Json.JsonProperty("front_callback_url")]
[System.Text.Json.Serialization.JsonPropertyName("front_callback_url")]
public new Types.FrontendCallback? FrontendCallback { get; set; }
}
public class RiskControl : CreatePaymentAppPayRequest.Types.RiskControl
{
}
public class Scene : CreatePaymentAppPayRequest.Types.Scene
{
public static new class Types
{
public class Store : CreatePaymentAppPayRequest.Types.Scene.Types.Store
{
}
}
/// <summary>
/// 获取或设置门店信息。
/// </summary>
[Newtonsoft.Json.JsonProperty("store_info")]
[System.Text.Json.Serialization.JsonPropertyName("store_info")]
public new Types.Store? Store { get; set; }
}
}
/// <summary>
/// 获取或设置收款方信息。
/// </summary>
[Newtonsoft.Json.JsonProperty("payee")]
[System.Text.Json.Serialization.JsonPropertyName("payee")]
public new Types.Payee Payee { get; set; } = new Types.Payee();
/// <summary>
/// 获取或设置付款方信息。
/// </summary>
[Newtonsoft.Json.JsonProperty("payer")]
[System.Text.Json.Serialization.JsonPropertyName("payer")]
public new Types.Payer? Payer { get; set; }
/// <summary>
/// 获取或设置商品信息列表。
/// </summary>
[Newtonsoft.Json.JsonProperty("goods")]
[System.Text.Json.Serialization.JsonPropertyName("goods")]
public new IList<Types.Goods>? GoodsList { get; set; }
/// <summary>
/// 获取或设置风控信息。
/// </summary>
[Newtonsoft.Json.JsonProperty("risk_control")]
[System.Text.Json.Serialization.JsonPropertyName("risk_control")]
public new Types.RiskControl? RiskControl { get; set; }
/// <summary>
/// 获取或设置回调配置信息。
/// </summary>
[Newtonsoft.Json.JsonProperty("notify_url")]
[System.Text.Json.Serialization.JsonPropertyName("notify_url")]
public new Types.NotifyConfig NotifyConfig { get; set; } = new Types.NotifyConfig();
/// <summary>
/// 获取或设置场景信息。
/// </summary>
[Newtonsoft.Json.JsonProperty("scene_info")]
[System.Text.Json.Serialization.JsonPropertyName("scene_info")]
public new Types.Scene? Scene { get; set; }
}
}

View File

@ -0,0 +1,9 @@
namespace SKIT.FlurlHttpClient.Wechat.TenpayBusiness.Models
{
/// <summary>
/// <para>表示 [POST] /mse-pay/payments/app-registering-pay 接口的响应。</para>
/// </summary>
public class CreatePaymentAppRegisteringPayResponse : GetPaymentByPaymentIdResponse
{
}
}

View File

@ -1,4 +1,3 @@
using System;
using System.Collections.Generic;
namespace SKIT.FlurlHttpClient.Wechat.TenpayBusiness.Models
@ -7,79 +6,25 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayBusiness.Models
/// <para>表示 [POST] /mse-pay/payments/h5-pay 接口的请求。</para>
/// </summary>
[WechatTenpayBusinessSensitive]
public class CreatePaymentH5PayRequest : WechatTenpayBusinessRequest
public class CreatePaymentH5PayRequest : CreatePaymentAppPayRequest
{
public static class Types
public static new class Types
{
public class Payee
public class Payee : CreatePaymentAppPayRequest.Types.Payee
{
/// <summary>
/// 获取或设置企业 ID。
/// </summary>
[Newtonsoft.Json.JsonProperty("ent_id")]
[System.Text.Json.Serialization.JsonPropertyName("ent_id")]
public string EnterpriseId { get; set; } = string.Empty;
/// <summary>
/// 获取或设置企业名称(需使用微企付公钥加密)。
/// </summary>
[Newtonsoft.Json.JsonProperty("ent_name")]
[System.Text.Json.Serialization.JsonPropertyName("ent_name")]
[WechatTenpayBusinessSensitiveProperty]
public string EnterpriseName { get; set; } = string.Empty;
/// <summary>
/// 获取或设置企业账户 ID。
/// </summary>
[Newtonsoft.Json.JsonProperty("ent_acct_id")]
[System.Text.Json.Serialization.JsonPropertyName("ent_acct_id")]
public string? EnterpriseAccountId { get; set; }
/// <summary>
/// 获取或设置银行卡号后 4 位。
/// </summary>
[Newtonsoft.Json.JsonProperty("bank_account_number_last4")]
[System.Text.Json.Serialization.JsonPropertyName("bank_account_number_last4")]
public string? BankAccountNumberLast4String { get; set; }
}
public class Payer
public class Payer : CreatePaymentAppPayRequest.Types.Payer
{
/// <summary>
/// 获取或设置银行卡号列表。
/// </summary>
[Newtonsoft.Json.JsonProperty("bank_account_numbers")]
[System.Text.Json.Serialization.JsonPropertyName("bank_account_numbers")]
public IList<string>? BankAccountNumberList { get; set; }
}
public class Goods
public class Goods : CreatePaymentAppPayRequest.Types.Goods
{
/// <summary>
/// 获取或设置商品名称。
/// </summary>
[Newtonsoft.Json.JsonProperty("good_name")]
[System.Text.Json.Serialization.JsonPropertyName("good_name")]
public string GoodsName { get; set; } = string.Empty;
/// <summary>
/// 获取或设置商品数量。
/// </summary>
[Newtonsoft.Json.JsonProperty("good_number")]
[System.Text.Json.Serialization.JsonPropertyName("good_number")]
public int Quantity { get; set; }
/// <summary>
/// 获取或设置商品金额(单位:分)。
/// </summary>
[Newtonsoft.Json.JsonProperty("good_amount")]
[System.Text.Json.Serialization.JsonPropertyName("good_amount")]
public int Amount { get; set; }
}
public class NotifyConfig
public class NotifyConfig : CreatePaymentAppPayRequest.Types.NotifyConfig
{
public static class Types
public static new class Types
{
public class FrontendCallback
{
@ -92,94 +37,24 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayBusiness.Models
}
}
/// <summary>
/// 获取或设置支付结果通知 URL。
/// </summary>
[Newtonsoft.Json.JsonProperty("server_notify_url")]
[System.Text.Json.Serialization.JsonPropertyName("server_notify_url")]
public string ServerNotifyUrl { get; set; } = string.Empty;
/// <summary>
/// 获取或设置前端回跳信息。
/// </summary>
[Newtonsoft.Json.JsonProperty("front_callback_url")]
[System.Text.Json.Serialization.JsonPropertyName("front_callback_url")]
public Types.FrontendCallback? FrontendCallback { get; set; }
public new Types.FrontendCallback? FrontendCallback { get; set; }
}
public class RiskControl
public class RiskControl : CreatePaymentAppPayRequest.Types.RiskControl
{
/// <summary>
/// 获取或设置设备号。
/// </summary>
[Newtonsoft.Json.JsonProperty("device_id")]
[System.Text.Json.Serialization.JsonPropertyName("device_id")]
public string? DeviceId { get; set; }
/// <summary>
/// 获取或设置用户终端 IP。
/// </summary>
[Newtonsoft.Json.JsonProperty("payer_client_ip")]
[System.Text.Json.Serialization.JsonPropertyName("payer_client_ip")]
public string? ClientIp { get; set; }
/// <summary>
/// 获取或设置用户浏览器 User-Agent。
/// </summary>
[Newtonsoft.Json.JsonProperty("payer_ua")]
[System.Text.Json.Serialization.JsonPropertyName("payer_ua")]
public string? ClientUserAgent { get; set; }
/// <summary>
/// 获取或设置下单时间。
/// </summary>
[Newtonsoft.Json.JsonProperty("create_time")]
[Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.RFC3339NullableDateTimeOffsetConverter))]
[System.Text.Json.Serialization.JsonPropertyName("create_time")]
[System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Converters.RFC3339NullableDateTimeOffsetConverter))]
public DateTimeOffset? CreateTime { get; set; }
/// <summary>
/// 获取或设置提货方式。
/// </summary>
[Newtonsoft.Json.JsonProperty("pick_type")]
[System.Text.Json.Serialization.JsonPropertyName("pick_type")]
public string? PickType { get; set; }
/// <summary>
/// 获取或设置提货描述。
/// </summary>
[Newtonsoft.Json.JsonProperty("pick_description")]
[System.Text.Json.Serialization.JsonPropertyName("pick_description")]
public string? PickDescription { get; set; }
}
public class Scene
public class Scene : CreatePaymentAppPayRequest.Types.Scene
{
public static class Types
public static new class Types
{
public class Store
public class Store : CreatePaymentAppPayRequest.Types.Scene.Types.Store
{
/// <summary>
/// 获取或设置门店编号。
/// </summary>
[Newtonsoft.Json.JsonProperty("id")]
[System.Text.Json.Serialization.JsonPropertyName("id")]
public string? Id { get; set; }
/// <summary>
/// 获取或设置门店名称。
/// </summary>
[Newtonsoft.Json.JsonProperty("name")]
[System.Text.Json.Serialization.JsonPropertyName("name")]
public string? Name { get; set; }
/// <summary>
/// 获取或设置地区编号。
/// </summary>
[Newtonsoft.Json.JsonProperty("area_code")]
[System.Text.Json.Serialization.JsonPropertyName("area_code")]
public string? AreaCode { get; set; }
}
}
@ -188,120 +63,50 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayBusiness.Models
/// </summary>
[Newtonsoft.Json.JsonProperty("store_info")]
[System.Text.Json.Serialization.JsonPropertyName("store_info")]
public Types.Store? Store { get; set; }
}
public class Promotion
{
public new Types.Store? Store { get; set; }
}
}
/// <summary>
/// 获取或设置付款类型。
/// </summary>
[Newtonsoft.Json.JsonProperty("purchaser_type")]
[System.Text.Json.Serialization.JsonPropertyName("purchaser_type")]
public string PurchaserType { get; set; } = string.Empty;
/// <summary>
/// 获取或设置平台支付单号。
/// </summary>
[Newtonsoft.Json.JsonProperty("out_payment_id")]
[System.Text.Json.Serialization.JsonPropertyName("out_payment_id")]
public string OutPaymentId { get; set; } = string.Empty;
/// <summary>
/// 获取或设置支付金额(单位:分)。
/// </summary>
[Newtonsoft.Json.JsonProperty("amount")]
[System.Text.Json.Serialization.JsonPropertyName("amount")]
public int Amount { get; set; }
/// <summary>
/// 获取或设置币种。
/// <para>默认值CNY</para>
/// </summary>
[Newtonsoft.Json.JsonProperty("currency")]
[System.Text.Json.Serialization.JsonPropertyName("currency")]
public string Currency { get; set; } = "CNY";
/// <summary>
/// 获取或设置过期时间。
/// </summary>
[Newtonsoft.Json.JsonProperty("expire_time")]
[Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.RFC3339DateTimeOffsetConverter))]
[System.Text.Json.Serialization.JsonPropertyName("expire_time")]
[System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Converters.RFC3339DateTimeOffsetConverter))]
public DateTimeOffset ExpireTime { get; set; }
/// <summary>
/// 获取或设置收款方信息。
/// </summary>
[Newtonsoft.Json.JsonProperty("payee")]
[System.Text.Json.Serialization.JsonPropertyName("payee")]
public Types.Payee Payee { get; set; } = new Types.Payee();
public new Types.Payee Payee { get; set; } = new Types.Payee();
/// <summary>
/// 获取或设置付款方信息。
/// </summary>
[Newtonsoft.Json.JsonProperty("payer")]
[System.Text.Json.Serialization.JsonPropertyName("payer")]
public Types.Payer? Payer { get; set; }
/// <summary>
/// 获取或设置附言。
/// </summary>
[Newtonsoft.Json.JsonProperty("memo")]
[System.Text.Json.Serialization.JsonPropertyName("memo")]
public string? Memo { get; set; }
public new Types.Payer? Payer { get; set; }
/// <summary>
/// 获取或设置商品信息列表。
/// </summary>
[Newtonsoft.Json.JsonProperty("goods")]
[System.Text.Json.Serialization.JsonPropertyName("goods")]
public IList<Types.Goods>? GoodsList { get; set; }
/// <summary>
/// 获取或设置附加信息。
/// </summary>
[Newtonsoft.Json.JsonProperty("attachment")]
[System.Text.Json.Serialization.JsonPropertyName("attachment")]
public string? Attachment { get; set; }
public new IList<Types.Goods>? GoodsList { get; set; }
/// <summary>
/// 获取或设置风控信息。
/// </summary>
[Newtonsoft.Json.JsonProperty("risk_control")]
[System.Text.Json.Serialization.JsonPropertyName("risk_control")]
public Types.RiskControl? RiskControl { get; set; }
public new Types.RiskControl? RiskControl { get; set; }
/// <summary>
/// 获取或设置回调配置信息。
/// </summary>
[Newtonsoft.Json.JsonProperty("notify_url")]
[System.Text.Json.Serialization.JsonPropertyName("notify_url")]
public Types.NotifyConfig NotifyConfig { get; set; } = new Types.NotifyConfig();
public new Types.NotifyConfig NotifyConfig { get; set; } = new Types.NotifyConfig();
/// <summary>
/// 获取或设置场景信息。
/// </summary>
[Newtonsoft.Json.JsonProperty("scene_info")]
[System.Text.Json.Serialization.JsonPropertyName("scene_info")]
public Types.Scene? Scene { get; set; }
/// <summary>
/// 获取或设置优惠信息。
/// </summary>
[Newtonsoft.Json.JsonProperty("promotion_detail")]
[System.Text.Json.Serialization.JsonPropertyName("promotion_detail")]
public Types.Promotion? Promotion { get; set; }
/// <summary>
/// 获取或设置分账标识。
/// </summary>
[Newtonsoft.Json.JsonProperty("profit_allocation_flag")]
[System.Text.Json.Serialization.JsonPropertyName("profit_allocation_flag")]
public string? ProfitAllocationFlag { get; set; }
public new Types.Scene? Scene { get; set; }
}
}

View File

@ -0,0 +1,133 @@
using System.Collections.Generic;
namespace SKIT.FlurlHttpClient.Wechat.TenpayBusiness.Models
{
/// <summary>
/// <para>表示 [POST] /mse-pay/payments/mp-pay 接口的请求。</para>
/// </summary>
[WechatTenpayBusinessSensitive]
public class CreatePaymentMiniProgramPayRequest : CreatePaymentAppPayRequest
{
public static new class Types
{
public class Payee : CreatePaymentAppPayRequest.Types.Payee
{
}
public class Payer : CreatePaymentAppPayRequest.Types.Payer
{
}
public class Goods : CreatePaymentAppPayRequest.Types.Goods
{
}
public class NotifyConfig : CreatePaymentAppPayRequest.Types.NotifyConfig
{
public static new class Types
{
public class FrontendCallback
{
/// <summary>
/// 获取或设置小程序 AppId。
/// </summary>
[Newtonsoft.Json.JsonProperty("mp_appid")]
[System.Text.Json.Serialization.JsonPropertyName("mp_appid")]
public string AppId { get; set; } = default!;
/// <summary>
/// 获取或设置小程序页面路径。
/// </summary>
[Newtonsoft.Json.JsonProperty("mp_path")]
[System.Text.Json.Serialization.JsonPropertyName("mp_path")]
public string PagePath { get; set; } = default!;
/// <summary>
/// 获取或设置小程序原始 ID。
/// </summary>
[Newtonsoft.Json.JsonProperty("mp_username")]
[System.Text.Json.Serialization.JsonPropertyName("mp_username")]
public string Username { get; set; } = default!;
/// <summary>
/// 获取或设置小程序 URL Scheme。
/// </summary>
[Newtonsoft.Json.JsonProperty("mp_urlscheme")]
[System.Text.Json.Serialization.JsonPropertyName("mp_urlscheme")]
public string? UrlScheme { get; set; }
}
}
/// <summary>
/// 获取或设置前端回跳信息。
/// </summary>
[Newtonsoft.Json.JsonProperty("front_callback_url")]
[System.Text.Json.Serialization.JsonPropertyName("front_callback_url")]
public new Types.FrontendCallback? FrontendCallback { get; set; }
}
public class RiskControl : CreatePaymentAppPayRequest.Types.RiskControl
{
}
public class Scene : CreatePaymentAppPayRequest.Types.Scene
{
public static new class Types
{
public class Store : CreatePaymentAppPayRequest.Types.Scene.Types.Store
{
}
}
/// <summary>
/// 获取或设置门店信息。
/// </summary>
[Newtonsoft.Json.JsonProperty("store_info")]
[System.Text.Json.Serialization.JsonPropertyName("store_info")]
public new Types.Store? Store { get; set; }
}
}
/// <summary>
/// 获取或设置收款方信息。
/// </summary>
[Newtonsoft.Json.JsonProperty("payee")]
[System.Text.Json.Serialization.JsonPropertyName("payee")]
public new Types.Payee Payee { get; set; } = new Types.Payee();
/// <summary>
/// 获取或设置付款方信息。
/// </summary>
[Newtonsoft.Json.JsonProperty("payer")]
[System.Text.Json.Serialization.JsonPropertyName("payer")]
public new Types.Payer? Payer { get; set; }
/// <summary>
/// 获取或设置商品信息列表。
/// </summary>
[Newtonsoft.Json.JsonProperty("goods")]
[System.Text.Json.Serialization.JsonPropertyName("goods")]
public new IList<Types.Goods>? GoodsList { get; set; }
/// <summary>
/// 获取或设置风控信息。
/// </summary>
[Newtonsoft.Json.JsonProperty("risk_control")]
[System.Text.Json.Serialization.JsonPropertyName("risk_control")]
public new Types.RiskControl? RiskControl { get; set; }
/// <summary>
/// 获取或设置回调配置信息。
/// </summary>
[Newtonsoft.Json.JsonProperty("notify_url")]
[System.Text.Json.Serialization.JsonPropertyName("notify_url")]
public new Types.NotifyConfig NotifyConfig { get; set; } = new Types.NotifyConfig();
/// <summary>
/// 获取或设置场景信息。
/// </summary>
[Newtonsoft.Json.JsonProperty("scene_info")]
[System.Text.Json.Serialization.JsonPropertyName("scene_info")]
public new Types.Scene? Scene { get; set; }
}
}

View File

@ -0,0 +1,9 @@
namespace SKIT.FlurlHttpClient.Wechat.TenpayBusiness.Models
{
/// <summary>
/// <para>表示 [POST] /mse-pay/payments/mp-pay 接口的响应。</para>
/// </summary>
public class CreatePaymentMiniProgramPayResponse : GetPaymentByPaymentIdResponse
{
}
}

View File

@ -0,0 +1,106 @@
using System.Collections.Generic;
namespace SKIT.FlurlHttpClient.Wechat.TenpayBusiness.Models
{
/// <summary>
/// <para>表示 [POST] /mse-pay/payments/qrcode-pay 接口的请求。</para>
/// </summary>
[WechatTenpayBusinessSensitive]
public class CreatePaymentQrcodePayRequest : CreatePaymentAppPayRequest
{
public static new class Types
{
public class Payee : CreatePaymentAppPayRequest.Types.Payee
{
}
public class Payer : CreatePaymentAppPayRequest.Types.Payer
{
}
public class Goods : CreatePaymentAppPayRequest.Types.Goods
{
}
public class NotifyConfig : CreatePaymentAppPayRequest.Types.NotifyConfig
{
public static new class Types
{
public class FrontendCallback
{
}
}
/// <summary>
/// 获取或设置前端回跳信息。
/// </summary>
[Newtonsoft.Json.JsonProperty("front_callback_url")]
[System.Text.Json.Serialization.JsonPropertyName("front_callback_url")]
public new Types.FrontendCallback? FrontendCallback { get; set; }
}
public class RiskControl : CreatePaymentAppPayRequest.Types.RiskControl
{
}
public class Scene : CreatePaymentAppPayRequest.Types.Scene
{
public static new class Types
{
public class Store : CreatePaymentAppPayRequest.Types.Scene.Types.Store
{
}
}
/// <summary>
/// 获取或设置门店信息。
/// </summary>
[Newtonsoft.Json.JsonProperty("store_info")]
[System.Text.Json.Serialization.JsonPropertyName("store_info")]
public new Types.Store? Store { get; set; }
}
}
/// <summary>
/// 获取或设置收款方信息。
/// </summary>
[Newtonsoft.Json.JsonProperty("payee")]
[System.Text.Json.Serialization.JsonPropertyName("payee")]
public new Types.Payee Payee { get; set; } = new Types.Payee();
/// <summary>
/// 获取或设置付款方信息。
/// </summary>
[Newtonsoft.Json.JsonProperty("payer")]
[System.Text.Json.Serialization.JsonPropertyName("payer")]
public new Types.Payer? Payer { get; set; }
/// <summary>
/// 获取或设置商品信息列表。
/// </summary>
[Newtonsoft.Json.JsonProperty("goods")]
[System.Text.Json.Serialization.JsonPropertyName("goods")]
public new IList<Types.Goods>? GoodsList { get; set; }
/// <summary>
/// 获取或设置风控信息。
/// </summary>
[Newtonsoft.Json.JsonProperty("risk_control")]
[System.Text.Json.Serialization.JsonPropertyName("risk_control")]
public new Types.RiskControl? RiskControl { get; set; }
/// <summary>
/// 获取或设置回调配置信息。
/// </summary>
[Newtonsoft.Json.JsonProperty("notify_url")]
[System.Text.Json.Serialization.JsonPropertyName("notify_url")]
public new Types.NotifyConfig NotifyConfig { get; set; } = new Types.NotifyConfig();
/// <summary>
/// 获取或设置场景信息。
/// </summary>
[Newtonsoft.Json.JsonProperty("scene_info")]
[System.Text.Json.Serialization.JsonPropertyName("scene_info")]
public new Types.Scene? Scene { get; set; }
}
}

View File

@ -0,0 +1,9 @@
namespace SKIT.FlurlHttpClient.Wechat.TenpayBusiness.Models
{
/// <summary>
/// <para>表示 [POST] /mse-pay/payments/qrcode-pay 接口的响应。</para>
/// </summary>
public class CreatePaymentQrcodePayResponse : GetPaymentByPaymentIdResponse
{
}
}

View File

@ -9,30 +9,6 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayBusiness.Models
{
public static class Types
{
public class Payer
{
/// <summary>
/// 获取或设置微企付 OpenId。
/// </summary>
[Newtonsoft.Json.JsonProperty("payer_id")]
[System.Text.Json.Serialization.JsonPropertyName("payer_id")]
public string? PayerId { get; set; }
/// <summary>
/// 获取或设置平台付款方 ID。
/// </summary>
[Newtonsoft.Json.JsonProperty("out_payer_id")]
[System.Text.Json.Serialization.JsonPropertyName("out_payer_id")]
public string? OutPayerId { get; set; }
/// <summary>
/// 获取或设置银行卡号后 4 位。
/// </summary>
[Newtonsoft.Json.JsonProperty("payer_acct_last4")]
[System.Text.Json.Serialization.JsonPropertyName("payer_acct_last4")]
public string? BankAccountNumberLast4String { get; set; }
}
public class Payee
{
/// <summary>
@ -49,6 +25,37 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayBusiness.Models
[System.Text.Json.Serialization.JsonPropertyName("ent_name")]
public string EnterpriseName { get; set; } = default!;
}
public class Payer
{
/// <summary>
/// 获取或设置付款方 ID。
/// </summary>
[Newtonsoft.Json.JsonProperty("payer_id")]
[System.Text.Json.Serialization.JsonPropertyName("payer_id")]
public string? PayerId { get; set; }
/// <summary>
/// 获取或设置付款方名称。
/// </summary>
[Newtonsoft.Json.JsonProperty("payer_name")]
[System.Text.Json.Serialization.JsonPropertyName("payer_name")]
public string? PayerName { get; set; }
/// <summary>
/// 获取或设置平台付款方 ID。
/// </summary>
[Newtonsoft.Json.JsonProperty("out_payer_id")]
[System.Text.Json.Serialization.JsonPropertyName("out_payer_id")]
public string? OutPayerId { get; set; }
/// <summary>
/// 获取或设置银行卡号后 4 位。
/// </summary>
[Newtonsoft.Json.JsonProperty("payer_acct_last4")]
[System.Text.Json.Serialization.JsonPropertyName("payer_acct_last4")]
public string? BankAccountNumberLast4String { get; set; }
}
}
/// <summary>

View File

@ -0,0 +1,47 @@
{
"purchaser_type": "string",
"out_payment_id": "string",
"amount": 0,
"currency": "CNY",
"expire_time": "2022-11-15T13:25:18.000+00:00",
"payer": {
"payer_name": "string",
"out_payer_id": "string",
"bank_account_numbers": [ "string" ]
},
"payee": {
"ent_id": "stringstri",
"ent_name": "string"
},
"memo": "string",
"goods": [
{
"good_name": "string",
"good_number": 0,
"good_amount": 0
}
],
"attachment": "string",
"risk_control": {
"device_id": "string",
"payer_client_ip": "string",
"payer_ua": "string",
"create_time": "2022-11-15T13:25:18.000+00:00",
"pick_type": "SELF_PICK",
"pick_description": "string"
},
"notify_url": {
"server_notify_url": "string",
"front_callback_url": {
"android_url": "string",
"ios_url": "string"
}
},
"scene_info": {
"store_info": {
"id": "string",
"name": "string",
"area_code": "string"
}
}
}

View File

@ -0,0 +1,18 @@
{
"payment_id": "string",
"out_payment_id": "string",
"amount": 0,
"currency": "CNY",
"payer": {
"payer_name": "string",
"out_payer_id": "string",
"payer_acct_last4": "1010"
},
"payee": {
"ent_id": "string",
"ent_name": "string"
},
"pay_status": "PROCESSING",
"memo": "string",
"attachment": "string"
}

View File

@ -0,0 +1,44 @@
{
"purchaser_type": "string",
"out_payment_id": "string",
"amount": 0,
"currency": "CNY",
"expire_time": "2021-06-08T10:34:56+08:00",
"payer": {
"payer_id": "string",
"payer_name": "string",
"out_payer_id": "string",
"bank_account_numbers": [ "string" ]
},
"payee": {
"ent_id": "stringstri",
"ent_name": "string"
},
"memo": "string",
"goods": [
{
"good_name": "string",
"good_number": 0,
"good_amount": 0
}
],
"attachment": "string",
"risk_control": {
"device_id": "string",
"payer_client_ip": "string",
"payer_ua": "string",
"create_time": "2022-11-15T13:25:18.000+00:00",
"pick_type": "SELF_PICK",
"pick_description": "string"
},
"notify_url": {
"server_notify_url": "string"
},
"scene_info": {
"store_info": {
"id": "string",
"name": "string",
"area_code": "string"
}
}
}

View File

@ -0,0 +1,19 @@
{
"payment_id": "string",
"out_payment_id": "string",
"amount": 0,
"currency": "CNY",
"payer": {
"payer_id": "string",
"payer_name": "string",
"out_payer_id": "string",
"payer_acct_last4": "1010"
},
"payee": {
"ent_id": "stringstri",
"ent_name": "string"
},
"pay_status": "PROCESSING",
"memo": "string",
"attachment": "string"
}

View File

@ -0,0 +1,45 @@
{
"purchaser_type": "string",
"out_payment_id": "string",
"amount": 0,
"currency": "CNY",
"expire_time": "2022-11-15T13:25:18.000+00:00",
"payee": {
"ent_id": "stringstri",
"ent_name": "string"
},
"payer": { "bank_account_numbers": [ "string" ] },
"memo": "string",
"goods": [
{
"good_name": "string",
"good_number": 0,
"good_amount": 0
}
],
"attachment": "string",
"risk_control": {
"device_id": "string",
"payer_client_ip": "string",
"payer_ua": "string",
"create_time": "2022-11-15T13:25:18.000+00:00",
"pick_type": "SELF_PICK",
"pick_description": "string"
},
"notify_url": {
"server_notify_url": "string",
"front_callback_url": {
"mp_path": "string",
"mp_appid": "string",
"mp_username": "string",
"mp_urlscheme": "string"
}
},
"scene_info": {
"store_info": {
"id": "string",
"name": "string",
"area_code": "string"
}
}
}

View File

@ -0,0 +1,13 @@
{
"payment_id": "string",
"out_payment_id": "string",
"amount": 0,
"currency": "CNY",
"payee": {
"ent_id": "string",
"ent_name": "string"
},
"pay_status": "PROCESSING",
"memo": "string",
"attachment": "string"
}

View File

@ -0,0 +1,39 @@
{
"purchaser_type": "string",
"out_payment_id": "string",
"amount": 0,
"currency": "CNY",
"expire_time": "2022-11-15T13:25:18.000+00:00",
"payee": {
"ent_id": "stringstri",
"ent_name": "string"
},
"payer": { "bank_account_numbers": [ "string" ] },
"memo": "string",
"goods": [
{
"good_name": "string",
"good_number": 0,
"good_amount": 0
}
],
"attachment": "string",
"risk_control": {
"device_id": "string",
"payer_client_ip": "string",
"payer_ua": "string",
"create_time": "2022-11-15T13:25:18.000+00:00",
"pick_type": "SELF_PICK",
"pick_description": "string"
},
"notify_url": {
"server_notify_url": "string"
},
"scene_info": {
"store_info": {
"id": "string",
"name": "string",
"area_code": "string"
}
}
}

View File

@ -0,0 +1,13 @@
{
"payment_id": "string",
"out_payment_id": "string",
"amount": 0,
"currency": "CNY",
"payee": {
"ent_id": "stringstri",
"ent_name": "string"
},
"pay_status": "PROCESSING",
"memo": "string",
"attachment": "string"
}