mirror of
https://gitee.com/fudiwei/DotNetCore.SKIT.FlurlHttpClient.Wechat.git
synced 2025-07-16 16:50:43 +08:00
feat(tenpayv3): 新增服务商扫码支付下单接口
This commit is contained in:
parent
1d1a5f1088
commit
354dd6063b
@ -115,6 +115,31 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
return await client.SendFlurlRequestAsJsonAsync<Models.CreatePayPartnerTransactionNativeResponse>(flurlReq, data: request, cancellationToken: cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <para>异步调用 [POST] /pay/partner/transactions/scannedpos 接口。</para>
|
||||
/// <para>
|
||||
/// REF: <br/>
|
||||
/// <![CDATA[ https://pay.weixin.qq.com/docs/partner/apis/partner-scannedpos-payment/partner-ap-iv3/parner-scanned-pos-prepay.html ]]>
|
||||
/// </para>
|
||||
/// </summary>
|
||||
/// <param name="client"></param>
|
||||
/// <param name="request"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
public static async Task<Models.CreatePayPartnerTransactionScannedPosResponse> ExecuteCreatePayPartnerTransactionScannedPosAsync(this WechatTenpayClient client, Models.CreatePayPartnerTransactionScannedPosRequest request, CancellationToken cancellationToken = default)
|
||||
{
|
||||
if (client is null) throw new ArgumentNullException(nameof(client));
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
if (request.MerchantId is null)
|
||||
request.MerchantId = client.Credentials.MerchantId;
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateFlurlRequest(request, HttpMethod.Post, "pay", "partner", "transactions", "scannedpos");
|
||||
|
||||
return await client.SendFlurlRequestAsJsonAsync<Models.CreatePayPartnerTransactionScannedPosResponse>(flurlReq, data: request, cancellationToken: cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <para>异步调用 [GET] /pay/partner/transactions/out-trade-no/{out_trade_no} 接口。</para>
|
||||
/// <para>
|
||||
|
@ -104,7 +104,14 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("id")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("id")]
|
||||
public string Id { get; set; } = string.Empty;
|
||||
public string? Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置商家自定义编码。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("out_id")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("out_id")]
|
||||
public string? OutId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置门店名称。
|
||||
@ -227,6 +234,13 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
|
||||
[System.Text.Json.Serialization.JsonPropertyName("goods_tag")]
|
||||
public string? GoodsTag { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置是否支持开票。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("support_fapiao")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("support_fapiao")]
|
||||
public bool? IsSupportFapiao { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置金额信息。
|
||||
/// </summary>
|
||||
|
@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
|
||||
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
|
||||
{
|
||||
@ -132,6 +132,13 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
|
||||
[System.Text.Json.Serialization.JsonPropertyName("goods_tag")]
|
||||
public string? GoodsTag { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置是否支持开票。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("support_fapiao")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("support_fapiao")]
|
||||
public bool? IsSupportFapiao { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置金额信息。
|
||||
/// </summary>
|
||||
|
@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
|
||||
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
|
||||
{
|
||||
@ -84,6 +84,13 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
|
||||
[System.Text.Json.Serialization.JsonPropertyName("goods_tag")]
|
||||
public string? GoodsTag { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置是否支持开票。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("support_fapiao")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("support_fapiao")]
|
||||
public bool? IsSupportFapiao { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置金额信息。
|
||||
/// </summary>
|
||||
|
@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
|
||||
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
|
||||
{
|
||||
@ -98,6 +98,13 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
|
||||
[System.Text.Json.Serialization.JsonPropertyName("goods_tag")]
|
||||
public string? GoodsTag { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置是否支持开票。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("support_fapiao")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("support_fapiao")]
|
||||
public bool? IsSupportFapiao { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置金额信息。
|
||||
/// </summary>
|
||||
|
@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
|
||||
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
|
||||
{
|
||||
@ -98,6 +98,13 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
|
||||
[System.Text.Json.Serialization.JsonPropertyName("goods_tag")]
|
||||
public string? GoodsTag { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置是否支持开票。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("support_fapiao")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("support_fapiao")]
|
||||
public bool? IsSupportFapiao { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置金额信息。
|
||||
/// </summary>
|
||||
|
@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
|
||||
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
|
||||
{
|
||||
@ -98,6 +98,13 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
|
||||
[System.Text.Json.Serialization.JsonPropertyName("goods_tag")]
|
||||
public string? GoodsTag { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置是否支持开票。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("support_fapiao")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("support_fapiao")]
|
||||
public bool? IsSupportFapiao { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置金额信息。
|
||||
/// </summary>
|
||||
|
@ -0,0 +1,147 @@
|
||||
using System;
|
||||
|
||||
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 [POST] /pay/partner/transactions/scannedpos 接口的请求。</para>
|
||||
/// </summary>
|
||||
public class CreatePayPartnerTransactionScannedPosRequest : WechatTenpayRequest
|
||||
{
|
||||
public static class Types
|
||||
{
|
||||
public class Amount : CreatePayPartnerTransactionJsapiRequest.Types.Amount
|
||||
{
|
||||
}
|
||||
|
||||
public class Payer : CreatePayPartnerTransactionJsapiRequest.Types.Payer
|
||||
{
|
||||
}
|
||||
|
||||
public class Detail : CreatePayPartnerTransactionJsapiRequest.Types.Detail
|
||||
{
|
||||
}
|
||||
|
||||
public class Scene : CreatePayPartnerTransactionJsapiRequest.Types.Scene
|
||||
{
|
||||
}
|
||||
|
||||
public class Settlement : CreatePayPartnerTransactionJsapiRequest.Types.Settlement
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置服务商商户号。如果不指定将使用构造 <see cref="WechatTenpayClient"/> 时的 <see cref="WechatTenpayClientOptions.MerchantId"/> 参数。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("sp_mchid")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("sp_mchid")]
|
||||
public string? MerchantId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置子商户号。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("sub_mchid")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("sub_mchid")]
|
||||
public string SubMerchantId { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置服务商 AppId。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("sp_appid")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("sp_appid")]
|
||||
public string AppId { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置子商户 AppId。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("sub_appid")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("sub_appid")]
|
||||
public string? SubAppId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置商品描述。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("description")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("description")]
|
||||
public string Description { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置商户订单号。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("out_trade_no")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("out_trade_no")]
|
||||
public string OutTradeNumber { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置交易结束时间。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("time_expire")]
|
||||
[Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.Common.Rfc3339DateTimeOffsetConverter))]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("time_expire")]
|
||||
[System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.Common.Rfc3339DateTimeOffsetConverter))]
|
||||
public DateTimeOffset? ExpireTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置附加数据。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("attach")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("attach")]
|
||||
public string? Attachment { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置回调通知地址。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("notify_url")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("notify_url")]
|
||||
public string? NotifyUrl { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置订单优惠标记。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("goods_tag")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("goods_tag")]
|
||||
public string? GoodsTag { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置是否支持开票。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("support_fapiao")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("support_fapiao")]
|
||||
public bool? IsSupportFapiao { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置金额信息。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("amount")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("amount")]
|
||||
public Types.Amount Amount { get; set; } = new Types.Amount();
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置支付者信息。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("payer")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("payer")]
|
||||
public Types.Payer Payer { get; set; } = new Types.Payer();
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置商品信息。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("detail")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("detail")]
|
||||
public Types.Detail? Detail { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置场景信息。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("scene_info")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("scene_info")]
|
||||
public Types.Scene Scene { get; set; } = new Types.Scene();
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置结算信息。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("settle_info")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("settle_info")]
|
||||
public Types.Settlement? Settlement { get; set; }
|
||||
}
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 [POST] /pay/partner/transactions/scannedpos 接口的响应。</para>
|
||||
/// </summary>
|
||||
public class CreatePayPartnerTransactionScannedPosResponse : WechatTenpayResponse
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取或设置预支付交易会话标识。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("prepay_id")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("prepay_id")]
|
||||
public string PrepayId { get; set; } = default!;
|
||||
}
|
||||
}
|
@ -0,0 +1,45 @@
|
||||
{
|
||||
"sp_appid": "wx8888888888888888",
|
||||
"sp_mchid": "1230000109",
|
||||
"sub_appid": "wxd678efh567hg6999",
|
||||
"sub_mchid": "1900000109",
|
||||
"description": "Image形象店-深圳腾大-QQ公仔",
|
||||
"out_trade_no": "1217752501201407033233368018",
|
||||
"time_expire": "2018-06-08T10:34:56+08:00",
|
||||
"attach": "自定义数据",
|
||||
"notify_url": " https://www.weixin.qq.com/wxpay/pay.php",
|
||||
"goods_tag": "WXG",
|
||||
"support_fapiao": true,
|
||||
"amount": {
|
||||
"total": 888,
|
||||
"currency": "CNY"
|
||||
},
|
||||
"payer": {
|
||||
"sp_openid": "oUpF8uMuAJO_M2pxb1Q9zNjWeS6o\t",
|
||||
"sub_openid": "oUpF8uMuAJO_M2pxb1Q9zNjWeS6o\t"
|
||||
},
|
||||
"detail": {
|
||||
"cost_price": 1,
|
||||
"invoice_id": "wx123",
|
||||
"goods_detail": [
|
||||
{
|
||||
"merchant_goods_id": "由半角的大小写字母、数字、中划线、下划线中的一 种或几种组成 ",
|
||||
"wechatpay_goods_id": "微信支付定义的统一商品编号(没有可不传)",
|
||||
"goods_name": "iPhone6s 16G",
|
||||
"quantity": 1,
|
||||
"unit_price": 528800
|
||||
}
|
||||
]
|
||||
},
|
||||
"scene_info": {
|
||||
"payer_client_ip": "14.23.150.211",
|
||||
"device_id": "013467007045764",
|
||||
"store_info": {
|
||||
"id": "0001",
|
||||
"out_id": "example_out_id"
|
||||
}
|
||||
},
|
||||
"settle_info": {
|
||||
"profit_sharing": false
|
||||
}
|
||||
}
|
@ -0,0 +1,3 @@
|
||||
{
|
||||
"prepay_id": "wx201410272009395522657a690389285100"
|
||||
}
|
Loading…
Reference in New Issue
Block a user