feat(tenpayv3): 新增区块链电子发票相关接口

This commit is contained in:
Fu Diwei 2023-04-03 15:19:48 +08:00
parent 6e1aeb0798
commit 2f6216e609
52 changed files with 2636 additions and 6 deletions

View File

@ -42,6 +42,7 @@
| √ | 经营能力:微信先享卡 | 直连商户 | |
| √ | 经营能力:支付即服务 | 直连商户 & 服务商 | |
| √ | 经营能力:点金计划 | 服务商 | |
| √ | 经营能力:区块链电子发票 | 直连商户 | |
| √ | 经营能力:出租车电子发票 | 服务商 | |
| √ | 行业方案:电商收付通 | 服务商 | |
| √ | 行业方案:智慧商圈 | 直连商户 & 服务商 | |

View File

@ -0,0 +1,71 @@
using System;
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Events
{
/// <summary>
/// <para>表示 FAPIAO.USER_APPLIED 通知的数据。</para>
/// <para>标识 FAPIAO.CARD_INSERTED 通知的数据。</para>
/// <para>标识 FAPIAO.CARD_DISCARDED 通知的数据。</para>
/// <para>标识 FAPIAO.ISSUED 通知的数据。</para>
/// <para>标识 FAPIAO.REVERSED 通知的数据。</para>
/// </summary>
public class FapiaoResource : WechatTenpayEvent.Types.IDecryptedResource
{
public static class Types
{
public class Fapiao
{
/// <summary>
/// 获取或设置商户发票单号。
/// </summary>
[Newtonsoft.Json.JsonProperty("fapiao_id")]
[System.Text.Json.Serialization.JsonPropertyName("fapiao_id")]
public string FapiaoId { get; set; } = default!;
/// <summary>
/// 获取或设置发票状态。
/// </summary>
[Newtonsoft.Json.JsonProperty("fapiao_status")]
[System.Text.Json.Serialization.JsonPropertyName("fapiao_status")]
public string FapiaoStatus { get; set; } = default!;
/// <summary>
/// 获取或设置卡包状态。
/// </summary>
[Newtonsoft.Json.JsonProperty("card_status")]
[System.Text.Json.Serialization.JsonPropertyName("card_status")]
public string CardStatus { get; set; } = default!;
}
}
/// <summary>
/// 获取或设置微信商户号。
/// </summary>
[Newtonsoft.Json.JsonProperty("mchid")]
[System.Text.Json.Serialization.JsonPropertyName("mchid")]
public string MerchantId { get; set; } = default!;
/// <summary>
/// 获取或设置发票申请单号。
/// </summary>
[Newtonsoft.Json.JsonProperty("fapiao_apply_id")]
[System.Text.Json.Serialization.JsonPropertyName("fapiao_apply_id")]
public string FapiaoApplyId { get; set; } = default!;
/// <summary>
/// 获取或设置用户填写时间。
/// </summary>
[Newtonsoft.Json.JsonProperty("apply_time")]
[Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.RFC3339NullableDateTimeOffsetConverter))]
[System.Text.Json.Serialization.JsonPropertyName("apply_time")]
[System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Converters.RFC3339NullableDateTimeOffsetConverter))]
public DateTimeOffset? ApplyTime { get; set; }
/// <summary>
/// 获取或设置发票列表。
/// </summary>
[Newtonsoft.Json.JsonProperty("fapiao_information")]
[System.Text.Json.Serialization.JsonPropertyName("fapiao_information")]
public Types.Fapiao[]? FapiaoList { get; set; }
}
}

View File

@ -0,0 +1,328 @@
using System;
using System.Net.Http;
using System.Threading;
using System.Threading.Tasks;
using Flurl.Http;
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
{
/// <summary>
/// 为 <see cref="WechatTenpayClient"/> 提供电子发票相关的 API 扩展方法。
/// </summary>
public static class WechatTenpayClientExecuteNewTaxControlFapiaoExtensions
{
#region CardTemplate
/// <summary>
/// <para>异步调用 [POST] /new-tax-control-fapiao/card-template 接口。</para>
/// <para>REF: https://pay.weixin.qq.com/wiki/doc/apiv3/Offline/apis/chapter4_8_5.shtml </para>
/// </summary>
/// <param name="client"></param>
/// <param name="request"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
public static async Task<Models.CreateNewTaxControlFapiaoCardTemplateResponse> ExecuteCreateNewTaxControlFapiaoCardTemplateAsync(this WechatTenpayClient client, Models.CreateNewTaxControlFapiaoCardTemplateRequest 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, "new-tax-control-fapiao", "card-template");
return await client.SendRequestWithJsonAsync<Models.CreateNewTaxControlFapiaoCardTemplateResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
}
#endregion
#region Merchant
/// <summary>
/// <para>异步调用 [PATCH] /new-tax-control-fapiao/merchant/development-config 接口。</para>
/// <para>REF: https://pay.weixin.qq.com/wiki/doc/apiv3/Offline/apis/chapter4_8_18.shtml </para>
/// </summary>
/// <param name="client"></param>
/// <param name="request"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
public static async Task<Models.ModifyNewTaxControlFapiaoMerchantDevelopmentConfigResponse> ExecuteModifyNewTaxControlFapiaoMerchantDevelopmentConfigAsync(this WechatTenpayClient client, Models.ModifyNewTaxControlFapiaoMerchantDevelopmentConfigRequest 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, new HttpMethod("PATCH"), "new-tax-control-fapiao", "merchant", "development-config");
return await client.SendRequestWithJsonAsync<Models.ModifyNewTaxControlFapiaoMerchantDevelopmentConfigResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
}
/// <summary>
/// <para>异步调用 [GET] /new-tax-control-fapiao/merchant/development-config 接口。</para>
/// <para>REF: https://pay.weixin.qq.com/wiki/doc/apiv3/Offline/apis/chapter4_8_18.shtml </para>
/// </summary>
/// <param name="client"></param>
/// <param name="request"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
public static async Task<Models.GetNewTaxControlFapiaoMerchantDevelopmentConfigResponse> ExecuteGetNewTaxControlFapiaoMerchantDevelopmentConfigAsync(this WechatTenpayClient client, Models.GetNewTaxControlFapiaoMerchantDevelopmentConfigRequest 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.Get, "new-tax-control-fapiao", "merchant", "development-config");
return await client.SendRequestWithJsonAsync<Models.GetNewTaxControlFapiaoMerchantDevelopmentConfigResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
}
/// <summary>
/// <para>异步调用 [GET] /new-tax-control-fapiao/merchant/base-information 接口。</para>
/// <para>REF: https://pay.weixin.qq.com/wiki/doc/apiv3/Offline/apis/chapter4_8_3.shtml </para>
/// </summary>
/// <param name="client"></param>
/// <param name="request"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
public static async Task<Models.GetNewTaxControlFapiaoMerchantBaseInformationResponse> ExecuteGetNewTaxControlFapiaoMerchantBaseInformationAsync(this WechatTenpayClient client, Models.GetNewTaxControlFapiaoMerchantBaseInformationRequest 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.Get, "new-tax-control-fapiao", "merchant", "base-information");
return await client.SendRequestWithJsonAsync<Models.GetNewTaxControlFapiaoMerchantBaseInformationResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
}
/// <summary>
/// <para>异步调用 [GET] /new-tax-control-fapiao/merchant/tax-codes 接口。</para>
/// <para>REF: https://pay.weixin.qq.com/wiki/doc/apiv3/Offline/apis/chapter4_8_2.shtml </para>
/// </summary>
/// <param name="client"></param>
/// <param name="request"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
public static async Task<Models.QueryNewTaxControlFapiaoMerchantTaxCodesResponse> ExecuteQueryNewTaxControlFapiaoMerchantTaxCodesAsync(this WechatTenpayClient client, Models.QueryNewTaxControlFapiaoMerchantTaxCodesRequest 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.Get, "new-tax-control-fapiao", "merchant", "tax-codes")
.SetQueryParam("offset", request.Offset)
.SetQueryParam("limit", request.Limit);
return await client.SendRequestWithJsonAsync<Models.QueryNewTaxControlFapiaoMerchantTaxCodesResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
}
#endregion
#region UserTitle
/// <summary>
/// <para>异步调用 [GET] /new-tax-control-fapiao/user-title/title-url 接口。</para>
/// <para>REF: https://pay.weixin.qq.com/wiki/doc/apiv3/Offline/apis/chapter4_8_6.shtml </para>
/// </summary>
/// <param name="client"></param>
/// <param name="request"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
public static async Task<Models.GetNewTaxControlFapiaoUserTitleUrlResponse> ExecuteGetNewTaxControlFapiaoUserTitleUrlAsync(this WechatTenpayClient client, Models.GetNewTaxControlFapiaoUserTitleUrlRequest 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.Get, "new-tax-control-fapiao", "user-title", "title-url")
.SetQueryParam("fapiao_apply_id", request.FapiaoApplyId)
.SetQueryParam("source", request.Source)
.SetQueryParam("total_amount", request.TotalAmount)
.SetQueryParam("appid", request.AppId)
.SetQueryParam("openid", request.OpenId);
if (request.SellerName != null)
flurlReq.SetQueryParam("seller_name", request.SellerName);
if (request.RequireShowMobileCell != null)
flurlReq.SetQueryParam("show_phone_cell", request.RequireShowMobileCell.Value ? "true" : "false");
if (request.RequireMustInputMobile != null)
flurlReq.SetQueryParam("must_input_phone", request.RequireMustInputMobile.Value ? "true" : "false");
if (request.RequireShowEmailCell != null)
flurlReq.SetQueryParam("show_email_cell", request.RequireShowEmailCell.Value ? "true" : "false");
if (request.RequireMustInputEmail != null)
flurlReq.SetQueryParam("must_input_email", request.RequireMustInputEmail.Value ? "true" : "false");
return await client.SendRequestWithJsonAsync<Models.GetNewTaxControlFapiaoUserTitleUrlResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
}
/// <summary>
/// <para>异步调用 [GET] /new-tax-control-fapiao/user-title 接口。</para>
/// <para>REF: https://pay.weixin.qq.com/wiki/doc/apiv3/Offline/apis/chapter4_8_7.shtml </para>
/// </summary>
/// <param name="client"></param>
/// <param name="request"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
public static async Task<Models.GetNewTaxControlFapiaoUserTitleResponse> ExecuteGetNewTaxControlFapiaoUserTitleAsync(this WechatTenpayClient client, Models.GetNewTaxControlFapiaoUserTitleRequest 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.Get, "new-tax-control-fapiao", "user-title")
.SetQueryParam("fapiao_apply_id", request.FapiaoApplyId)
.SetQueryParam("scene", request.Scene);
return await client.SendRequestWithJsonAsync<Models.GetNewTaxControlFapiaoUserTitleResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
}
#endregion
#region FapiaoApplication
/// <summary>
/// <para>异步调用 [POST] /new-tax-control-fapiao/fapiao-applications 接口。</para>
/// <para>REF: https://pay.weixin.qq.com/wiki/doc/apiv3/Offline/apis/chapter4_8_8.shtml </para>
/// </summary>
/// <param name="client"></param>
/// <param name="request"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
public static async Task<Models.CreateNewTaxControlFapiaoApplicationResponse> ExecuteCreateNewTaxControlFapiaoApplicationAsync(this WechatTenpayClient client, Models.CreateNewTaxControlFapiaoApplicationRequest 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, "new-tax-control-fapiao", "fapiao-applications");
return await client.SendRequestWithJsonAsync<Models.CreateNewTaxControlFapiaoApplicationResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
}
/// <summary>
/// <para>异步调用 [POST] /new-tax-control-fapiao/fapiao-applications/{fapiao_apply_id}/reverse 接口。</para>
/// <para>REF: https://pay.weixin.qq.com/wiki/doc/apiv3/Offline/apis/chapter4_8_10.shtml </para>
/// </summary>
/// <param name="client"></param>
/// <param name="request"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
public static async Task<Models.ReverseNewTaxControlFapiaoApplicationResponse> ExecuteReverseNewTaxControlFapiaoApplicationAsync(this WechatTenpayClient client, Models.ReverseNewTaxControlFapiaoApplicationRequest 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, "new-tax-control-fapiao", "fapiao-applications", request.FapiaoApplyId, "reverse");
return await client.SendRequestWithJsonAsync<Models.ReverseNewTaxControlFapiaoApplicationResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
}
/// <summary>
/// <para>异步调用 [GET] /new-tax-control-fapiao/fapiao-applications/{fapiao_apply_id} 接口。</para>
/// <para>REF: https://pay.weixin.qq.com/wiki/doc/apiv3/Offline/apis/chapter4_8_9.shtml </para>
/// </summary>
/// <param name="client"></param>
/// <param name="request"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
public static async Task<Models.GetNewTaxControlFapiaoApplicationByFapiaoApplyIdResponse> ExecuteGetNewTaxControlFapiaoApplicationByFapiaoApplyIdAsync(this WechatTenpayClient client, Models.GetNewTaxControlFapiaoApplicationByFapiaoApplyIdRequest 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.Get, "new-tax-control-fapiao", "fapiao-applications", request.FapiaoApplyId);
if (request.FapiaoId != null)
flurlReq.SetQueryParam("fapiao_id", request.FapiaoId);
return await client.SendRequestWithJsonAsync<Models.GetNewTaxControlFapiaoApplicationByFapiaoApplyIdResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
}
/// <summary>
/// <para>异步调用 [GET] /new-tax-control-fapiao/fapiao-applications/{fapiao_apply_id}/fapiao-files 接口。</para>
/// <para>REF: https://pay.weixin.qq.com/wiki/doc/apiv3/Offline/apis/chapter4_8_9.shtml </para>
/// </summary>
/// <param name="client"></param>
/// <param name="request"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
public static async Task<Models.GetNewTaxControlFapiaoApplicationFilesResponse> ExecuteGetNewTaxControlFapiaoApplicationFilesAsync(this WechatTenpayClient client, Models.GetNewTaxControlFapiaoApplicationFilesRequest 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.Get, "new-tax-control-fapiao", "fapiao-applications", request.FapiaoApplyId, "fapiao-files");
if (request.FapiaoId != null)
flurlReq.SetQueryParam("fapiao_id", request.FapiaoId);
return await client.SendRequestWithJsonAsync<Models.GetNewTaxControlFapiaoApplicationFilesResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
}
/// <summary>
/// <para>异步调用 [GET] /{download_url} 接口。</para>
/// <para>REF: https://pay.weixin.qq.com/wiki/doc/apiv3/Offline/apis/chapter4_8_21.shtml </para>
/// <para><i>(请注意此接口不受构造 <see cref="WechatTenpayClient" /> 时指定的 <see cref="WechatTenpayClientOptions.Endpoint"/> 参数控制。)</i></para>
/// </summary>
/// <param name="client"></param>
/// <param name="request"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
public static async Task<Models.DownloadNewTaxControlFapiaoApplicationFileResponse> ExecuteDownloadNewTaxControlFapiaoApplicationFileAsync(this WechatTenpayClient client, Models.DownloadNewTaxControlFapiaoApplicationFileRequest 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 == null)
request.MerchantId = client.Credentials.MerchantId;
IFlurlRequest flurlReq = client
.CreateRequest(request, HttpMethod.Get, request.DownloadUrl)
.WithUrl(request.DownloadUrl)
.SetQueryParam("mchid", request.MerchantId)
.SetQueryParam("openid", request.OpenId)
.SetQueryParam("fapiao_id", request.FapiaoId)
.SetQueryParam("invoice_code", request.FapiaoCode)
.SetQueryParam("invoice_no", request.FapiaoNumber);
return await client.SendRequestWithJsonAsync<Models.DownloadNewTaxControlFapiaoApplicationFileResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
}
/// <summary>
/// <para>异步调用 [POST] /new-tax-control-fapiao/fapiao-applications/upload-fapiao-file 接口。</para>
/// <para>REF: https://pay.weixin.qq.com/wiki/doc/apiv3/Offline/apis/chapter4_8_14.shtml </para>
/// </summary>
/// <param name="client"></param>
/// <param name="request"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
public static async Task<Models.UploadNewTaxControlFapiaoApplicationFapiaoFileResponse> ExecuteUploadNewTaxControlFapiaoApplicationFapiaoFileAsync(this WechatTenpayClient client, Models.UploadNewTaxControlFapiaoApplicationFapiaoFileRequest 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, "new-tax-control-fapiao", "fapiao-applications", "upload-fapiao-file");
using var httpContent = Utilities.FileHttpContentBuilder.Build(fileName: "file.pdf", fileBytes: request.FileBytes, fileContentType: "application/pdf", fileMetaJson: client.JsonSerializer.Serialize(request));
return await client.SendRequestAsync<Models.UploadNewTaxControlFapiaoApplicationFapiaoFileResponse>(flurlReq, httpContent: httpContent, cancellationToken: cancellationToken);
}
/// <summary>
/// <para>异步调用 [POST] /new-tax-control-fapiao/fapiao-applications/{fapiao_apply_id}/insert-cards 接口。</para>
/// <para>REF: https://pay.weixin.qq.com/wiki/doc/apiv3/Offline/apis/chapter4_8_15.shtml </para>
/// </summary>
/// <param name="client"></param>
/// <param name="request"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
public static async Task<Models.CreateNewTaxControlFapiaoApplicationCardResponse> ExecuteCreateNewTaxControlFapiaoApplicationCardAsync(this WechatTenpayClient client, Models.CreateNewTaxControlFapiaoApplicationCardRequest 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, "new-tax-control-fapiao", "fapiao-applications", request.FapiaoApplyId, "insert-cards");
return await client.SendRequestWithJsonAsync<Models.CreateNewTaxControlFapiaoApplicationCardResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
}
#endregion
}
}

View File

@ -0,0 +1,90 @@
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
{
/// <summary>
/// <para>表示 [POST] /new-tax-control-fapiao/card-template 接口的请求。</para>
/// </summary>
public class CreateNewTaxControlFapiaoCardTemplateRequest : WechatTenpayRequest
{
public static class Types
{
public class CartTemplate
{
public static class Types
{
public class CustomCell
{
/// <summary>
/// 获取或设置文字。
/// </summary>
[Newtonsoft.Json.JsonProperty("words")]
[System.Text.Json.Serialization.JsonPropertyName("words")]
public string Words { get; set; } = string.Empty;
/// <summary>
/// 获取或设置描述。
/// </summary>
[Newtonsoft.Json.JsonProperty("description")]
[System.Text.Json.Serialization.JsonPropertyName("description")]
public string Description { get; set; } = string.Empty;
/// <summary>
/// 获取或设置跳转链接。
/// </summary>
[Newtonsoft.Json.JsonProperty("jump_url")]
[System.Text.Json.Serialization.JsonPropertyName("jump_url")]
public string? JumpUrl { get; set; }
/// <summary>
/// 获取或设置跳转小程序的用户名。
/// </summary>
[Newtonsoft.Json.JsonProperty("miniprogram_user_name")]
[System.Text.Json.Serialization.JsonPropertyName("miniprogram_user_name")]
public string? MiniProgramUsername { get; set; }
/// <summary>
/// 获取或设置跳转小程序的页面路径。
/// </summary>
[Newtonsoft.Json.JsonProperty("miniprogram_path")]
[System.Text.Json.Serialization.JsonPropertyName("miniprogram_path")]
public string? MiniProgramPagePath { get; set; }
}
}
/// <summary>
/// 获取或设置收款方名称。
/// </summary>
[Newtonsoft.Json.JsonProperty("payee_name")]
[System.Text.Json.Serialization.JsonPropertyName("payee_name")]
public string? PayeeName { get; set; }
/// <summary>
/// 获取或设置卡券 Logo 地址。
/// </summary>
[Newtonsoft.Json.JsonProperty("logo_url")]
[System.Text.Json.Serialization.JsonPropertyName("logo_url")]
public string? LogoUrl { get; set; }
/// <summary>
/// 获取或设置卡券自定义信息。
/// </summary>
[Newtonsoft.Json.JsonProperty("custom_cell")]
[System.Text.Json.Serialization.JsonPropertyName("custom_cell")]
public Types.CustomCell? CustomCell { get; set; }
}
}
/// <summary>
/// 获取或设置微信 AppId。
/// </summary>
[Newtonsoft.Json.JsonProperty("card_appid")]
[System.Text.Json.Serialization.JsonPropertyName("card_appid")]
public string CardAppId { get; set; } = string.Empty;
/// <summary>
/// 获取或设置卡券模板信息。
/// </summary>
[Newtonsoft.Json.JsonProperty("card_template_information")]
[System.Text.Json.Serialization.JsonPropertyName("card_template_information")]
public Types.CartTemplate CartTemplate { get; set; } = new Types.CartTemplate();
}
}

View File

@ -0,0 +1,22 @@
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
{
/// <summary>
/// <para>表示 [POST] /new-tax-control-fapiao/card-template 接口的响应。</para>
/// </summary>
public class CreateNewTaxControlFapiaoCardTemplateResponse : WechatTenpayResponse
{
/// <summary>
/// 获取或设置微信 AppId。
/// </summary>
[Newtonsoft.Json.JsonProperty("card_appid")]
[System.Text.Json.Serialization.JsonPropertyName("card_appid")]
public string CardAppId { get; set; } = default!;
/// <summary>
/// 获取或设置卡券模板 ID。
/// </summary>
[Newtonsoft.Json.JsonProperty("card_id")]
[System.Text.Json.Serialization.JsonPropertyName("card_id")]
public string CardTemplateId { get; set; } = default!;
}
}

View File

@ -0,0 +1,303 @@
using System;
using System.Collections.Generic;
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
{
/// <summary>
/// <para>表示 [POST] /new-tax-control-fapiao/fapiao-applications/{fapiao_apply_id}/insert-cards 接口的请求。</para>
/// </summary>
[WechatTenpaySensitive]
public class CreateNewTaxControlFapiaoApplicationCardRequest : WechatTenpayRequest
{
public static class Types
{
public class Buyer : CreateNewTaxControlFapiaoApplicationRequest.Types.Buyer
{
}
public class FapiaoCard
{
public static class Types
{
public class Seller
{
/// <summary>
/// 获取或设置销售方名称。
/// </summary>
[Newtonsoft.Json.JsonProperty("name")]
[System.Text.Json.Serialization.JsonPropertyName("name")]
public string Name { get; set; } = string.Empty;
/// <summary>
/// 获取或设置纳税人识别号。
/// </summary>
[Newtonsoft.Json.JsonProperty("taxpayer_id")]
[System.Text.Json.Serialization.JsonPropertyName("taxpayer_id")]
public string TaxpayerId { get; set; } = string.Empty;
/// <summary>
/// 获取或设置地址。
/// </summary>
[Newtonsoft.Json.JsonProperty("address")]
[System.Text.Json.Serialization.JsonPropertyName("address")]
public string? Address { get; set; }
/// <summary>
/// 获取或设置电话。
/// </summary>
[Newtonsoft.Json.JsonProperty("telephone")]
[System.Text.Json.Serialization.JsonPropertyName("telephone")]
public string? PhoneNumber { get; set; }
/// <summary>
/// 获取或设置开户银行。
/// </summary>
[Newtonsoft.Json.JsonProperty("bank_name")]
[System.Text.Json.Serialization.JsonPropertyName("bank_name")]
public string? BankName { get; set; }
/// <summary>
/// 获取或设置银行账号。
/// </summary>
[Newtonsoft.Json.JsonProperty("bank_account")]
[System.Text.Json.Serialization.JsonPropertyName("bank_account")]
public string? BankAccountNumber { get; set; }
}
public class Extra
{
/// <summary>
/// 获取或设置收款人。
/// </summary>
[Newtonsoft.Json.JsonProperty("payee")]
[System.Text.Json.Serialization.JsonPropertyName("payee")]
public string? Payee { get; set; }
/// <summary>
/// 获取或设置复核人。
/// </summary>
[Newtonsoft.Json.JsonProperty("reviewer")]
[System.Text.Json.Serialization.JsonPropertyName("reviewer")]
public string? Reviewer { get; set; }
/// <summary>
/// 获取或设置开票人。
/// </summary>
[Newtonsoft.Json.JsonProperty("drawer")]
[System.Text.Json.Serialization.JsonPropertyName("drawer")]
public string Drawer { get; set; } = string.Empty;
}
public class Item
{
/// <summary>
/// 获取或设置货物或应税劳务或服务编码。
/// </summary>
[Newtonsoft.Json.JsonProperty("tax_code")]
[System.Text.Json.Serialization.JsonPropertyName("tax_code")]
public string TaxCode { get; set; } = string.Empty;
/// <summary>
/// 获取或设置货物或应税劳务或服务名称。
/// </summary>
[Newtonsoft.Json.JsonProperty("goods_name")]
[System.Text.Json.Serialization.JsonPropertyName("goods_name")]
public string GoodsName { get; set; } = string.Empty;
/// <summary>
/// 获取或设置规格型号。
/// </summary>
[Newtonsoft.Json.JsonProperty("specification")]
[System.Text.Json.Serialization.JsonPropertyName("specification")]
public string? Specification { get; set; }
/// <summary>
/// 获取或设置单位。
/// </summary>
[Newtonsoft.Json.JsonProperty("unit")]
[System.Text.Json.Serialization.JsonPropertyName("unit")]
public string? Unit { get; set; }
/// <summary>
/// 获取或设置数量。
/// </summary>
[Newtonsoft.Json.JsonProperty("quantity")]
[System.Text.Json.Serialization.JsonPropertyName("quantity")]
public int Quantity { get; set; }
/// <summary>
/// 获取或设置单价单位10^-6分
/// </summary>
[Newtonsoft.Json.JsonProperty("unit_price")]
[System.Text.Json.Serialization.JsonPropertyName("unit_price")]
public long UnitPrice { get; set; }
/// <summary>
/// 获取或设置单行金额(单位:分)。
/// </summary>
[Newtonsoft.Json.JsonProperty("amount")]
[System.Text.Json.Serialization.JsonPropertyName("amount")]
public int Amount { get; set; }
/// <summary>
/// 获取或设置单行税额(单位:分)。
/// </summary>
[Newtonsoft.Json.JsonProperty("tax_amount")]
[System.Text.Json.Serialization.JsonPropertyName("tax_amount")]
public int TaxAmount { get; set; }
/// <summary>
/// 获取或设置单行合计(单位:分)。
/// </summary>
[Newtonsoft.Json.JsonProperty("total_amount")]
[System.Text.Json.Serialization.JsonPropertyName("total_amount")]
public int TotalAmount { get; set; }
/// <summary>
/// 获取或设置税率(单位:万分数)。
/// </summary>
[Newtonsoft.Json.JsonProperty("tax_rate")]
[System.Text.Json.Serialization.JsonPropertyName("tax_rate")]
public int TaxRate { get; set; }
/// <summary>
/// 获取或设置税收优惠政策标识。
/// <para>默认值NO_FAVORABLE</para>
/// </summary>
[Newtonsoft.Json.JsonProperty("tax_prefer_mark")]
[System.Text.Json.Serialization.JsonPropertyName("tax_prefer_mark")]
public string TaxPreferMark { get; set; } = "NO_FAVORABLE";
/// <summary>
/// 获取或设置是否是折扣行。
/// </summary>
[Newtonsoft.Json.JsonProperty("discount")]
[System.Text.Json.Serialization.JsonPropertyName("discount")]
public bool IsDiscount { get; set; }
}
}
/// <summary>
/// 获取或设置发票文件 MediaId。
/// </summary>
[Newtonsoft.Json.JsonProperty("fapiao_media_id")]
[System.Text.Json.Serialization.JsonPropertyName("fapiao_media_id")]
public string FapiaoMediaId { get; set; } = string.Empty;
/// <summary>
/// 获取或设置发票号码。
/// </summary>
[Newtonsoft.Json.JsonProperty("fapiao_number")]
[System.Text.Json.Serialization.JsonPropertyName("fapiao_number")]
public string FapiaoNumber { get; set; } = string.Empty;
/// <summary>
/// 获取或设置发票代码。
/// </summary>
[Newtonsoft.Json.JsonProperty("fapiao_code")]
[System.Text.Json.Serialization.JsonPropertyName("fapiao_code")]
public string FapiaoCode { get; set; } = string.Empty;
/// <summary>
/// 获取或设置开票时间。
/// </summary>
[Newtonsoft.Json.JsonProperty("fapiao_time")]
[Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.RFC3339DateTimeOffsetConverter))]
[System.Text.Json.Serialization.JsonPropertyName("fapiao_time")]
[System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Converters.RFC3339DateTimeOffsetConverter))]
public DateTimeOffset FapiaoTime { get; set; }
/// <summary>
/// 获取或设置校验码。
/// </summary>
[Newtonsoft.Json.JsonProperty("check_code")]
[System.Text.Json.Serialization.JsonPropertyName("check_code")]
public string CheckCode { get; set; } = string.Empty;
/// <summary>
/// 获取或设置密码。
/// </summary>
[Newtonsoft.Json.JsonProperty("password")]
[System.Text.Json.Serialization.JsonPropertyName("password")]
public string Password { get; set; } = string.Empty;
/// <summary>
/// 获取或设置总价税合计(单位:分)。
/// </summary>
[Newtonsoft.Json.JsonProperty("total_amount")]
[System.Text.Json.Serialization.JsonPropertyName("total_amount")]
public int TotalAmount { get; set; }
/// <summary>
/// 获取或设置总税额(单位:分)。
/// </summary>
[Newtonsoft.Json.JsonProperty("tax_amount")]
[System.Text.Json.Serialization.JsonPropertyName("tax_amount")]
public int TaxAmount { get; set; }
/// <summary>
/// 获取或设置总金额(单位:分)。
/// </summary>
[Newtonsoft.Json.JsonProperty("amount")]
[System.Text.Json.Serialization.JsonPropertyName("amount")]
public int Amount { get; set; }
/// <summary>
/// 获取或设置销售方信息。
/// </summary>
[Newtonsoft.Json.JsonProperty("seller_information")]
[System.Text.Json.Serialization.JsonPropertyName("seller_information")]
public Types.Seller Seller { get; set; } = new Types.Seller();
/// <summary>
/// 获取或设置额外信息。
/// </summary>
[Newtonsoft.Json.JsonProperty("extra_information")]
[System.Text.Json.Serialization.JsonPropertyName("extra_information")]
public Types.Extra Extra { get; set; } = new Types.Extra();
/// <summary>
/// 获取或设置发票行列表。
/// </summary>
[Newtonsoft.Json.JsonProperty("items")]
[System.Text.Json.Serialization.JsonPropertyName("items")]
public IList<Types.Item>? ItemList { get; set; }
/// <summary>
/// 获取或设置备注信息。
/// </summary>
[Newtonsoft.Json.JsonProperty("remark")]
[System.Text.Json.Serialization.JsonPropertyName("remark")]
public string? Remark { get; set; }
}
}
/// <summary>
/// 获取或设置发票申请单号。
/// </summary>
[Newtonsoft.Json.JsonIgnore]
[System.Text.Json.Serialization.JsonIgnore]
public string FapiaoApplyId { get; set; } = string.Empty;
/// <summary>
/// 获取或设置开票场景。
/// </summary>
[Newtonsoft.Json.JsonProperty("scene")]
[System.Text.Json.Serialization.JsonPropertyName("scene")]
public string Scene { get; set; } = string.Empty;
/// <summary>
/// 获取或设置购买方信息。
/// </summary>
[Newtonsoft.Json.JsonProperty("buyer_information")]
[System.Text.Json.Serialization.JsonPropertyName("buyer_information")]
public Types.Buyer Buyer { get; set; } = new Types.Buyer();
/// <summary>
/// 获取或设置电子发票卡券信息列表。
/// </summary>
[Newtonsoft.Json.JsonProperty("fapiao_card_information")]
[System.Text.Json.Serialization.JsonPropertyName("fapiao_card_information")]
public IList<Types.FapiaoCard> FapiaoCardList { get; set; } = new List<Types.FapiaoCard>();
}
}

View File

@ -0,0 +1,9 @@
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
{
/// <summary>
/// <para>表示 [POST] /new-tax-control-fapiao/fapiao-applications/{fapiao_apply_id}/insert-cards 接口的响应。</para>
/// </summary>
public class CreateNewTaxControlFapiaoApplicationCardResponse : WechatTenpayResponse
{
}
}

View File

@ -0,0 +1,227 @@
using System;
using System.Collections.Generic;
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
{
/// <summary>
/// <para>表示 [POST] /new-tax-control-fapiao/fapiao-applications 接口的请求。</para>
/// </summary>
[WechatTenpaySensitive]
public class CreateNewTaxControlFapiaoApplicationRequest : WechatTenpayRequest
{
public static class Types
{
public class Buyer
{
/// <summary>
/// 获取或设置购买方类型。
/// </summary>
[Newtonsoft.Json.JsonProperty("type")]
[System.Text.Json.Serialization.JsonPropertyName("type")]
public string Type { get; set; } = string.Empty;
/// <summary>
/// 获取或设置购买方名称。
/// </summary>
[Newtonsoft.Json.JsonProperty("name")]
[System.Text.Json.Serialization.JsonPropertyName("name")]
public string Name { get; set; } = string.Empty;
/// <summary>
/// 获取或设置纳税人识别号。
/// </summary>
[Newtonsoft.Json.JsonProperty("taxpayer_id")]
[System.Text.Json.Serialization.JsonPropertyName("taxpayer_id")]
public string? TaxpayerId { get; set; }
/// <summary>
/// 获取或设置地址。
/// </summary>
[Newtonsoft.Json.JsonProperty("address")]
[System.Text.Json.Serialization.JsonPropertyName("address")]
public string? Address { get; set; }
/// <summary>
/// 获取或设置电话。
/// </summary>
[Newtonsoft.Json.JsonProperty("telephone")]
[System.Text.Json.Serialization.JsonPropertyName("telephone")]
public string? PhoneNumber { get; set; }
/// <summary>
/// 获取或设置开户银行。
/// </summary>
[Newtonsoft.Json.JsonProperty("bank_name")]
[System.Text.Json.Serialization.JsonPropertyName("bank_name")]
public string? BankName { get; set; }
/// <summary>
/// 获取或设置银行账号。
/// </summary>
[Newtonsoft.Json.JsonProperty("bank_account")]
[System.Text.Json.Serialization.JsonPropertyName("bank_account")]
public string? BankAccountNumber { get; set; }
/// <summary>
/// 获取或设置用户手机号码。
/// </summary>
[Newtonsoft.Json.JsonProperty("phone")]
[System.Text.Json.Serialization.JsonPropertyName("phone")]
[WechatTenpaySensitiveProperty(scheme: Constants.SignSchemes.WECHATPAY2_RSA_2048_WITH_SHA256, algorithm: Constants.EncryptionAlgorithms.RSA_2048_ECB_PKCS8_OAEP_WITH_SHA1_AND_MGF1)]
[WechatTenpaySensitiveProperty(scheme: Constants.SignSchemes.WECHATPAY2_SM2_WITH_SM3, algorithm: Constants.EncryptionAlgorithms.SM2_C1C3C2_ASN1)]
public string? UserMobileNumber { get; set; }
/// <summary>
/// 获取或设置用户邮箱地址。
/// </summary>
[Newtonsoft.Json.JsonProperty("email")]
[System.Text.Json.Serialization.JsonPropertyName("email")]
[WechatTenpaySensitiveProperty(scheme: Constants.SignSchemes.WECHATPAY2_RSA_2048_WITH_SHA256, algorithm: Constants.EncryptionAlgorithms.RSA_2048_ECB_PKCS8_OAEP_WITH_SHA1_AND_MGF1)]
[WechatTenpaySensitiveProperty(scheme: Constants.SignSchemes.WECHATPAY2_SM2_WITH_SM3, algorithm: Constants.EncryptionAlgorithms.SM2_C1C3C2_ASN1)]
public string? UserEmail { get; set; }
}
public class Fapiao
{
public static class Types
{
public class Item
{
/// <summary>
/// 获取或设置货物或应税劳务或服务编码。
/// </summary>
[Newtonsoft.Json.JsonProperty("tax_code")]
[System.Text.Json.Serialization.JsonPropertyName("tax_code")]
public string TaxCode { get; set; } = string.Empty;
/// <summary>
/// 获取或设置货物或应税劳务或服务分类。
/// </summary>
[Newtonsoft.Json.JsonProperty("goods_category")]
[System.Text.Json.Serialization.JsonPropertyName("goods_category")]
public string? GoodsCategory { get; set; }
/// <summary>
/// 获取或设置货物或应税劳务或服务名称。
/// </summary>
[Newtonsoft.Json.JsonProperty("goods_name")]
[System.Text.Json.Serialization.JsonPropertyName("goods_name")]
public string? GoodsName { get; set; }
/// <summary>
/// 获取或设置规格型号。
/// </summary>
[Newtonsoft.Json.JsonProperty("specification")]
[System.Text.Json.Serialization.JsonPropertyName("specification")]
public string? Specification { get; set; }
/// <summary>
/// 获取或设置单位。
/// </summary>
[Newtonsoft.Json.JsonProperty("unit")]
[System.Text.Json.Serialization.JsonPropertyName("unit")]
public string? Unit { get; set; }
/// <summary>
/// 获取或设置数量。
/// </summary>
[Newtonsoft.Json.JsonProperty("quantity")]
[System.Text.Json.Serialization.JsonPropertyName("quantity")]
public int Quantity { get; set; }
/// <summary>
/// 获取或设置单行合计(单位:分)。
/// </summary>
[Newtonsoft.Json.JsonProperty("total_amount")]
[System.Text.Json.Serialization.JsonPropertyName("total_amount")]
public int TotalAmount { get; set; }
/// <summary>
/// 获取或设置税率(单位:万分数)。
/// </summary>
[Newtonsoft.Json.JsonProperty("tax_rate")]
[System.Text.Json.Serialization.JsonPropertyName("tax_rate")]
public int? TaxRate { get; set; }
/// <summary>
/// 获取或设置税收优惠政策标识。
/// </summary>
[Newtonsoft.Json.JsonProperty("tax_prefer_mark")]
[System.Text.Json.Serialization.JsonPropertyName("tax_prefer_mark")]
public string? TaxPreferMark { get; set; }
/// <summary>
/// 获取或设置是否是折扣行。
/// </summary>
[Newtonsoft.Json.JsonProperty("discount")]
[System.Text.Json.Serialization.JsonPropertyName("discount")]
public bool IsDiscount { get; set; }
}
}
/// <summary>
/// 获取或设置商户发票单号。
/// </summary>
[Newtonsoft.Json.JsonProperty("fapiao_id")]
[System.Text.Json.Serialization.JsonPropertyName("fapiao_id")]
public string FapiaoId { get; set; } = string.Empty;
/// <summary>
/// 获取或设置总价税合计(单位:分)。
/// </summary>
[Newtonsoft.Json.JsonProperty("total_amount")]
[System.Text.Json.Serialization.JsonPropertyName("total_amount")]
public int TotalAmount { get; set; }
/// <summary>
/// 获取或设置是否以清单形式开具发票。
/// </summary>
[Newtonsoft.Json.JsonProperty("need_list")]
[System.Text.Json.Serialization.JsonPropertyName("need_list")]
public bool RequireItemList { get; set; }
/// <summary>
/// 获取或设置发票行列表。
/// </summary>
[Newtonsoft.Json.JsonProperty("items")]
[System.Text.Json.Serialization.JsonPropertyName("items")]
public IList<Types.Item>? ItemList { get; set; }
/// <summary>
/// 获取或设置备注信息。
/// </summary>
[Newtonsoft.Json.JsonProperty("remark")]
[System.Text.Json.Serialization.JsonPropertyName("remark")]
public string? Remark { get; set; }
}
}
/// <summary>
/// 获取或设置发票申请单号。
/// </summary>
[Newtonsoft.Json.JsonProperty("fapiao_apply_id")]
[System.Text.Json.Serialization.JsonPropertyName("fapiao_apply_id")]
public string FapiaoApplyId { get; set; } = string.Empty;
/// <summary>
/// 获取或设置开票场景。
/// </summary>
[Newtonsoft.Json.JsonProperty("scene")]
[System.Text.Json.Serialization.JsonPropertyName("scene")]
public string Scene { get; set; } = string.Empty;
/// <summary>
/// 获取或设置购买方信息。
/// </summary>
[Newtonsoft.Json.JsonProperty("buyer_information")]
[System.Text.Json.Serialization.JsonPropertyName("buyer_information")]
public Types.Buyer Buyer { get; set; } = new Types.Buyer();
/// <summary>
/// 获取或设置电子发票信息列表。
/// </summary>
[Newtonsoft.Json.JsonProperty("fapiao_information")]
[System.Text.Json.Serialization.JsonPropertyName("fapiao_information")]
public IList<Types.Fapiao> FapiaoList { get; set; } = new List<Types.Fapiao>();
}
}

View File

@ -0,0 +1,9 @@
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
{
/// <summary>
/// <para>表示 [POST] /new-tax-control-fapiao/fapiao-applications 接口的响应。</para>
/// </summary>
public class CreateNewTaxControlFapiaoApplicationResponse : WechatTenpayResponse
{
}
}

View File

@ -0,0 +1,50 @@
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
{
/// <summary>
/// <para>表示 [GET] /{download_url} 接口的请求。</para>
/// </summary>
public class DownloadNewTaxControlFapiaoApplicationFileRequest : WechatTenpayRequest
{
/// <summary>
/// 获取或设置发票文件下载地址。
/// </summary>
[Newtonsoft.Json.JsonIgnore]
[System.Text.Json.Serialization.JsonIgnore]
public string DownloadUrl { get; set; } = string.Empty;
/// <summary>
/// 获取或设置微信商户号。如果不指定将使用构造 <see cref="WechatTenpayClient"/> 时的 <see cref="WechatTenpayClientOptions.MerchantId"/> 参数。
/// </summary>
[Newtonsoft.Json.JsonIgnore]
[System.Text.Json.Serialization.JsonIgnore]
public string? MerchantId { get; set; }
/// <summary>
/// 获取或设置商户发票单号。
/// </summary>
[Newtonsoft.Json.JsonIgnore]
[System.Text.Json.Serialization.JsonIgnore]
public string FapiaoId { get; set; } = string.Empty;
/// <summary>
/// 获取或设置发票代码。
/// </summary>
[Newtonsoft.Json.JsonIgnore]
[System.Text.Json.Serialization.JsonIgnore]
public string FapiaoCode { get; set; } = string.Empty;
/// <summary>
/// 获取或设置发票号码。
/// </summary>
[Newtonsoft.Json.JsonIgnore]
[System.Text.Json.Serialization.JsonIgnore]
public string FapiaoNumber { get; set; } = string.Empty;
/// <summary>
/// 获取或设置用户唯一标识。
/// </summary>
[Newtonsoft.Json.JsonIgnore]
[System.Text.Json.Serialization.JsonIgnore]
public string OpenId { get; set; } = string.Empty;
}
}

View File

@ -0,0 +1,13 @@
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
{
/// <summary>
/// <para>表示 [GET] /{download_url} 接口的响应。</para>
/// </summary>
public class DownloadNewTaxControlFapiaoApplicationFileResponse : WechatTenpayResponse
{
public override bool IsSuccessful()
{
return base.IsSuccessful() && RawBytes?.Length > 0;
}
}
}

View File

@ -0,0 +1,22 @@
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
{
/// <summary>
/// <para>表示 [GET] /new-tax-control-fapiao/fapiao-applications/{fapiao_apply_id} 接口的请求。</para>
/// </summary>
public class GetNewTaxControlFapiaoApplicationByFapiaoApplyIdRequest : WechatTenpayRequest
{
/// <summary>
/// 获取或设置发票申请单号。
/// </summary>
[Newtonsoft.Json.JsonIgnore]
[System.Text.Json.Serialization.JsonIgnore]
public string FapiaoApplyId { get; set; } = string.Empty;
/// <summary>
/// 获取或设置商户发票单号。
/// </summary>
[Newtonsoft.Json.JsonIgnore]
[System.Text.Json.Serialization.JsonIgnore]
public string? FapiaoId { get; set; }
}
}

View File

@ -0,0 +1,388 @@
using System;
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
{
/// <summary>
/// <para>表示 [GET] /new-tax-control-fapiao/fapiao-applications/{fapiao_apply_id} 接口的响应。</para>
/// </summary>
[WechatTenpaySensitive]
public class GetNewTaxControlFapiaoApplicationByFapiaoApplyIdResponse : WechatTenpayResponse
{
public static class Types
{
public class Fapiao
{
public static class Types
{
public class FapiaoDetail
{
/// <summary>
/// 获取或设置发票代码。
/// </summary>
[Newtonsoft.Json.JsonProperty("fapiao_code")]
[System.Text.Json.Serialization.JsonPropertyName("fapiao_code")]
public string FapiaoCode { get; set; } = default!;
/// <summary>
/// 获取或设置发票号码。
/// </summary>
[Newtonsoft.Json.JsonProperty("fapiao_number")]
[System.Text.Json.Serialization.JsonPropertyName("fapiao_number")]
public string FapiaoNumber { get; set; } = default!;
/// <summary>
/// 获取或设置校验码。
/// </summary>
[Newtonsoft.Json.JsonProperty("check_code")]
[System.Text.Json.Serialization.JsonPropertyName("check_code")]
public string CheckCode { get; set; } = default!;
/// <summary>
/// 获取或设置密码。
/// </summary>
[Newtonsoft.Json.JsonProperty("password")]
[System.Text.Json.Serialization.JsonPropertyName("password")]
public string Password { get; set; } = default!;
/// <summary>
/// 获取或设置开票时间。
/// </summary>
[Newtonsoft.Json.JsonProperty("fapiao_time")]
[Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.RFC3339DateTimeOffsetConverter))]
[System.Text.Json.Serialization.JsonPropertyName("fapiao_time")]
[System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Converters.RFC3339DateTimeOffsetConverter))]
public DateTimeOffset FapiaoTime { get; set; }
}
public class FapiaoCard
{
/// <summary>
/// 获取或设置微信 AppId。
/// </summary>
[Newtonsoft.Json.JsonProperty("card_appid")]
[System.Text.Json.Serialization.JsonPropertyName("card_appid")]
public string AppId { get; set; } = default!;
/// <summary>
/// 获取或设置用户唯一标识。
/// </summary>
[Newtonsoft.Json.JsonProperty("card_openid")]
[System.Text.Json.Serialization.JsonPropertyName("card_openid")]
public string OpenId { get; set; } = default!;
/// <summary>
/// 获取或设置电子发票卡券模板 ID。
/// </summary>
[Newtonsoft.Json.JsonProperty("card_id")]
[System.Text.Json.Serialization.JsonPropertyName("card_id")]
public string? CardTemplateId { get; set; }
/// <summary>
/// 获取或设置电子发票在卡包中的编码。
/// </summary>
[Newtonsoft.Json.JsonProperty("card_code")]
[System.Text.Json.Serialization.JsonPropertyName("card_code")]
public string? CardCode { get; set; }
/// <summary>
/// 获取或设置发票卡券状态。
/// </summary>
[Newtonsoft.Json.JsonProperty("card_status")]
[System.Text.Json.Serialization.JsonPropertyName("card_status")]
public string? CardStatus { get; set; }
}
public class Buyer
{
/// <summary>
/// 获取或设置购买方类型。
/// </summary>
[Newtonsoft.Json.JsonProperty("type")]
[System.Text.Json.Serialization.JsonPropertyName("type")]
public string Type { get; set; } = default!;
/// <summary>
/// 获取或设置购买方名称。
/// </summary>
[Newtonsoft.Json.JsonProperty("name")]
[System.Text.Json.Serialization.JsonPropertyName("name")]
public string Name { get; set; } = default!;
/// <summary>
/// 获取或设置纳税人识别号。
/// </summary>
[Newtonsoft.Json.JsonProperty("taxpayer_id")]
[System.Text.Json.Serialization.JsonPropertyName("taxpayer_id")]
public string? TaxpayerId { get; set; }
/// <summary>
/// 获取或设置地址。
/// </summary>
[Newtonsoft.Json.JsonProperty("address")]
[System.Text.Json.Serialization.JsonPropertyName("address")]
public string? Address { get; set; }
/// <summary>
/// 获取或设置电话。
/// </summary>
[Newtonsoft.Json.JsonProperty("telephone")]
[System.Text.Json.Serialization.JsonPropertyName("telephone")]
public string? PhoneNumber { get; set; }
/// <summary>
/// 获取或设置开户银行。
/// </summary>
[Newtonsoft.Json.JsonProperty("bank_name")]
[System.Text.Json.Serialization.JsonPropertyName("bank_name")]
public string? BankName { get; set; }
/// <summary>
/// 获取或设置银行账号。
/// </summary>
[Newtonsoft.Json.JsonProperty("bank_account")]
[System.Text.Json.Serialization.JsonPropertyName("bank_account")]
public string? BankAccountNumber { get; set; }
/// <summary>
/// 获取或设置用户手机号码。
/// </summary>
[Newtonsoft.Json.JsonProperty("phone")]
[System.Text.Json.Serialization.JsonPropertyName("phone")]
[WechatTenpaySensitiveProperty(scheme: Constants.SignSchemes.WECHATPAY2_RSA_2048_WITH_SHA256, algorithm: Constants.EncryptionAlgorithms.RSA_2048_ECB_PKCS8_OAEP_WITH_SHA1_AND_MGF1)]
[WechatTenpaySensitiveProperty(scheme: Constants.SignSchemes.WECHATPAY2_SM2_WITH_SM3, algorithm: Constants.EncryptionAlgorithms.SM2_C1C3C2_ASN1)]
public string? UserMobileNumber { get; set; }
/// <summary>
/// 获取或设置用户邮箱地址。
/// </summary>
[Newtonsoft.Json.JsonProperty("email")]
[System.Text.Json.Serialization.JsonPropertyName("email")]
[WechatTenpaySensitiveProperty(scheme: Constants.SignSchemes.WECHATPAY2_RSA_2048_WITH_SHA256, algorithm: Constants.EncryptionAlgorithms.RSA_2048_ECB_PKCS8_OAEP_WITH_SHA1_AND_MGF1)]
[WechatTenpaySensitiveProperty(scheme: Constants.SignSchemes.WECHATPAY2_SM2_WITH_SM3, algorithm: Constants.EncryptionAlgorithms.SM2_C1C3C2_ASN1)]
public string? UserEmail { get; set; }
}
public class Seller : GetNewTaxControlFapiaoMerchantBaseInformationResponse.Types.Seller
{
}
public class Extra
{
/// <summary>
/// 获取或设置收款人。
/// </summary>
[Newtonsoft.Json.JsonProperty("payee")]
[System.Text.Json.Serialization.JsonPropertyName("payee")]
public string? Payee { get; set; }
/// <summary>
/// 获取或设置复核人。
/// </summary>
[Newtonsoft.Json.JsonProperty("reviewer")]
[System.Text.Json.Serialization.JsonPropertyName("reviewer")]
public string? Reviewer { get; set; }
/// <summary>
/// 获取或设置开票人。
/// </summary>
[Newtonsoft.Json.JsonProperty("drawer")]
[System.Text.Json.Serialization.JsonPropertyName("drawer")]
public string Drawer { get; set; } = default!;
}
public class Item
{
/// <summary>
/// 获取或设置货物或应税劳务或服务编码。
/// </summary>
[Newtonsoft.Json.JsonProperty("tax_code")]
[System.Text.Json.Serialization.JsonPropertyName("tax_code")]
public string TaxCode { get; set; } = string.Empty;
/// <summary>
/// 获取或设置货物或应税劳务或服务名称。
/// </summary>
[Newtonsoft.Json.JsonProperty("goods_name")]
[System.Text.Json.Serialization.JsonPropertyName("goods_name")]
public string GoodsName { get; set; } = string.Empty;
/// <summary>
/// 获取或设置规格型号。
/// </summary>
[Newtonsoft.Json.JsonProperty("specification")]
[System.Text.Json.Serialization.JsonPropertyName("specification")]
public string? Specification { get; set; }
/// <summary>
/// 获取或设置单位。
/// </summary>
[Newtonsoft.Json.JsonProperty("unit")]
[System.Text.Json.Serialization.JsonPropertyName("unit")]
public string? Unit { get; set; }
/// <summary>
/// 获取或设置数量。
/// </summary>
[Newtonsoft.Json.JsonProperty("quantity")]
[System.Text.Json.Serialization.JsonPropertyName("quantity")]
public int Quantity { get; set; }
/// <summary>
/// 获取或设置单价单位10^-6分
/// </summary>
[Newtonsoft.Json.JsonProperty("unit_price")]
[System.Text.Json.Serialization.JsonPropertyName("unit_price")]
public long UnitPrice { get; set; }
/// <summary>
/// 获取或设置单行金额(单位:分)。
/// </summary>
[Newtonsoft.Json.JsonProperty("amount")]
[System.Text.Json.Serialization.JsonPropertyName("amount")]
public int Amount { get; set; }
/// <summary>
/// 获取或设置单行税额(单位:分)。
/// </summary>
[Newtonsoft.Json.JsonProperty("tax_amount")]
[System.Text.Json.Serialization.JsonPropertyName("tax_amount")]
public int TaxAmount { get; set; }
/// <summary>
/// 获取或设置单行合计(单位:分)。
/// </summary>
[Newtonsoft.Json.JsonProperty("total_amount")]
[System.Text.Json.Serialization.JsonPropertyName("total_amount")]
public int TotalAmount { get; set; }
/// <summary>
/// 获取或设置税率(单位:万分数)。
/// </summary>
[Newtonsoft.Json.JsonProperty("tax_rate")]
[System.Text.Json.Serialization.JsonPropertyName("tax_rate")]
public int TaxRate { get; set; }
/// <summary>
/// 获取或设置税收优惠政策标识。
/// </summary>
[Newtonsoft.Json.JsonProperty("tax_prefer_mark")]
[System.Text.Json.Serialization.JsonPropertyName("tax_prefer_mark")]
public string? TaxPreferMark { get; set; }
/// <summary>
/// 获取或设置是否是折扣行。
/// </summary>
[Newtonsoft.Json.JsonProperty("discount")]
[System.Text.Json.Serialization.JsonPropertyName("discount")]
public bool IsDiscount { get; set; }
}
}
/// <summary>
/// 获取或设置商户发票单号。
/// </summary>
[Newtonsoft.Json.JsonProperty("fapiao_id")]
[System.Text.Json.Serialization.JsonPropertyName("fapiao_id")]
public string FapiaoId { get; set; } = default!;
/// <summary>
/// 获取或设置发票状态。
/// </summary>
[Newtonsoft.Json.JsonProperty("status")]
[System.Text.Json.Serialization.JsonPropertyName("status")]
public string FapiaoStatus { get; set; } = default!;
/// <summary>
/// 获取或设置总价税合计(单位:分)。
/// </summary>
[Newtonsoft.Json.JsonProperty("total_amount")]
[System.Text.Json.Serialization.JsonPropertyName("total_amount")]
public int TotalAmount { get; set; }
/// <summary>
/// 获取或设置总税额(单位:分)。
/// </summary>
[Newtonsoft.Json.JsonProperty("tax_amount")]
[System.Text.Json.Serialization.JsonPropertyName("tax_amount")]
public int TaxAmount { get; set; }
/// <summary>
/// 获取或设置总金额(单位:分)。
/// </summary>
[Newtonsoft.Json.JsonProperty("amount")]
[System.Text.Json.Serialization.JsonPropertyName("amount")]
public int Amount { get; set; }
/// <summary>
/// 获取或设置蓝字发票信息。
/// </summary>
[Newtonsoft.Json.JsonProperty("blue_fapiao")]
[System.Text.Json.Serialization.JsonPropertyName("blue_fapiao")]
public Types.FapiaoDetail? BlueFapiao { get; set; }
/// <summary>
/// 获取或设置红字发票信息。
/// </summary>
[Newtonsoft.Json.JsonProperty("red_fapiao")]
[System.Text.Json.Serialization.JsonPropertyName("red_fapiao")]
public Types.FapiaoDetail? RedFapiao { get; set; }
/// <summary>
/// 获取或设置电子发票卡券信息。
/// </summary>
[Newtonsoft.Json.JsonProperty("card_information")]
[System.Text.Json.Serialization.JsonPropertyName("card_information")]
public Types.FapiaoCard? FapiaoCard { get; set; }
/// <summary>
/// 获取或设置购买方信息。
/// </summary>
[Newtonsoft.Json.JsonProperty("buyer_information")]
[System.Text.Json.Serialization.JsonPropertyName("buyer_information")]
public Types.Buyer Buyer { get; set; } = default!;
/// <summary>
/// 获取或设置销售方信息。
/// </summary>
[Newtonsoft.Json.JsonProperty("seller_information")]
[System.Text.Json.Serialization.JsonPropertyName("seller_information")]
public Types.Seller Seller { get; set; } = default!;
/// <summary>
/// 获取或设置额外信息。
/// </summary>
[Newtonsoft.Json.JsonProperty("extra_information")]
[System.Text.Json.Serialization.JsonPropertyName("extra_information")]
public Types.Extra Extra { get; set; } = new Types.Extra();
/// <summary>
/// 获取或设置发票行列表。
/// </summary>
[Newtonsoft.Json.JsonProperty("items")]
[System.Text.Json.Serialization.JsonPropertyName("items")]
public Types.Item[]? ItemList { get; set; }
/// <summary>
/// 获取或设置备注信息。
/// </summary>
[Newtonsoft.Json.JsonProperty("remark")]
[System.Text.Json.Serialization.JsonPropertyName("remark")]
public string? Remark { get; set; }
}
}
/// <summary>
/// 获取或设置发票信息列表。
/// </summary>
[Newtonsoft.Json.JsonProperty("fapiao_information")]
[System.Text.Json.Serialization.JsonPropertyName("fapiao_information")]
public Types.Fapiao[] FapiaoList { get; set; } = default!;
/// <summary>
/// 获取或设置发票数量。
/// </summary>
[Newtonsoft.Json.JsonProperty("total_count")]
[System.Text.Json.Serialization.JsonPropertyName("total_count")]
public int TotalCount { get; set; }
}
}

View File

@ -0,0 +1,22 @@
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
{
/// <summary>
/// <para>表示 [GET] /new-tax-control-fapiao/fapiao-applications/{fapiao_apply_id}/fapiao-files 接口的请求。</para>
/// </summary>
public class GetNewTaxControlFapiaoApplicationFilesRequest : WechatTenpayRequest
{
/// <summary>
/// 获取或设置发票申请单号。
/// </summary>
[Newtonsoft.Json.JsonIgnore]
[System.Text.Json.Serialization.JsonIgnore]
public string FapiaoApplyId { get; set; } = string.Empty;
/// <summary>
/// 获取或设置商户发票单号。
/// </summary>
[Newtonsoft.Json.JsonIgnore]
[System.Text.Json.Serialization.JsonIgnore]
public string? FapiaoId { get; set; }
}
}

View File

@ -0,0 +1,42 @@
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
{
/// <summary>
/// <para>表示 [GET] /new-tax-control-fapiao/fapiao-applications/{fapiao_apply_id}/fapiao-files 接口的响应。</para>
/// </summary>
public class GetNewTaxControlFapiaoApplicationFilesResponse : WechatTenpayResponse
{
public static class Types
{
public class FapiaoFile
{
/// <summary>
/// 获取或设置商户发票单号。
/// </summary>
[Newtonsoft.Json.JsonProperty("fapiao_id")]
[System.Text.Json.Serialization.JsonPropertyName("fapiao_id")]
public string FapiaoId { get; set; } = default!;
/// <summary>
/// 获取或设置发票状态。
/// </summary>
[Newtonsoft.Json.JsonProperty("status")]
[System.Text.Json.Serialization.JsonPropertyName("status")]
public string FapiaoStatus { get; set; } = default!;
/// <summary>
/// 获取或设置发票文件下载地址。
/// </summary>
[Newtonsoft.Json.JsonProperty("download_url")]
[System.Text.Json.Serialization.JsonPropertyName("download_url")]
public string? DownloadUrl { get; set; }
}
}
/// <summary>
/// 获取或设置发票文件列表。
/// </summary>
[Newtonsoft.Json.JsonProperty("fapiao_download_info_list")]
[System.Text.Json.Serialization.JsonPropertyName("fapiao_download_info_list")]
public Types.FapiaoFile[] FapiaoFile { get; set; } = default!;
}
}

View File

@ -0,0 +1,58 @@
using System.Collections.Generic;
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
{
/// <summary>
/// <para>表示 [POST] /new-tax-control-fapiao/fapiao-applications/{fapiao_apply_id}/reverse 接口的请求。</para>
/// </summary>
public class ReverseNewTaxControlFapiaoApplicationRequest : WechatTenpayRequest
{
public static class Types
{
public class Fapiao
{
/// <summary>
/// 获取或设置商户发票单号。
/// </summary>
[Newtonsoft.Json.JsonProperty("fapiao_id")]
[System.Text.Json.Serialization.JsonPropertyName("fapiao_id")]
public string FapiaoId { get; set; } = string.Empty;
/// <summary>
/// 获取或设置发票号码。
/// </summary>
[Newtonsoft.Json.JsonProperty("fapiao_number")]
[System.Text.Json.Serialization.JsonPropertyName("fapiao_number")]
public string FapiaoNumber { get; set; } = string.Empty;
/// <summary>
/// 获取或设置发票代码。
/// </summary>
[Newtonsoft.Json.JsonProperty("fapiao_code")]
[System.Text.Json.Serialization.JsonPropertyName("fapiao_code")]
public string FapiaoCode { get; set; } = string.Empty;
}
}
/// <summary>
/// 获取或设置发票申请单号。
/// </summary>
[Newtonsoft.Json.JsonIgnore]
[System.Text.Json.Serialization.JsonIgnore]
public string FapiaoApplyId { get; set; } = string.Empty;
/// <summary>
/// 获取或设置冲红原因。
/// </summary>
[Newtonsoft.Json.JsonProperty("reverse_reason")]
[System.Text.Json.Serialization.JsonPropertyName("reverse_reason")]
public string ReverseReason { get; set; } = string.Empty;
/// <summary>
/// 获取或设置电子发票信息列表。
/// </summary>
[Newtonsoft.Json.JsonProperty("fapiao_information")]
[System.Text.Json.Serialization.JsonPropertyName("fapiao_information")]
public IList<Types.Fapiao> FapiaoList { get; set; } = new List<Types.Fapiao>();
}
}

View File

@ -0,0 +1,9 @@
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
{
/// <summary>
/// <para>表示 [POST] /new-tax-control-fapiao/fapiao-applications/{fapiao_apply_id}/reverse 接口的响应。</para>
/// </summary>
public class ReverseNewTaxControlFapiaoApplicationResponse : WechatTenpayResponse
{
}
}

View File

@ -0,0 +1,39 @@
using System;
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
{
/// <summary>
/// <para>表示 [POST] /new-tax-control-fapiao/fapiao-applications/upload-fapiao-file 接口的请求。</para>
/// </summary>
public class UploadNewTaxControlFapiaoApplicationFapiaoFileRequest : WechatTenpayRequest
{
/// <summary>
/// 获取或设置文件字节数组。
/// </summary>
[Newtonsoft.Json.JsonIgnore]
[System.Text.Json.Serialization.JsonIgnore]
public byte[] FileBytes { get; set; } = Array.Empty<byte>();
/// <summary>
/// 获取或设置文件类型。
/// <para>默认值PDF</para>
/// </summary>
[Newtonsoft.Json.JsonProperty("file_type")]
[System.Text.Json.Serialization.JsonPropertyName("file_type")]
public string FileType { get; set; } = "PDF";
/// <summary>
/// 获取或设置文件内容哈希算法。
/// </summary>
[Newtonsoft.Json.JsonProperty("digest_alogrithm")]
[System.Text.Json.Serialization.JsonPropertyName("digest_alogrithm")]
public string FileHashAlgorithm { get; set; } = string.Empty;
/// <summary>
/// 获取或设置文件内容哈希值。
/// </summary>
[Newtonsoft.Json.JsonProperty("digest")]
[System.Text.Json.Serialization.JsonPropertyName("digest")]
public string FileHashValue { get; set; } = string.Empty;
}
}

View File

@ -0,0 +1,15 @@
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
{
/// <summary>
/// <para>表示 [POST] /new-tax-control-fapiao/fapiao-applications/upload-fapiao-file 接口的响应。</para>
/// </summary>
public class UploadNewTaxControlFapiaoApplicationFapiaoFileResponse : WechatTenpayResponse
{
/// <summary>
/// 获取或设置发票文件 MediaId。
/// </summary>
[Newtonsoft.Json.JsonProperty("fapiao_media_id")]
[System.Text.Json.Serialization.JsonPropertyName("fapiao_media_id")]
public string FapiaoMediaId { get; set; } = default!;
}
}

View File

@ -0,0 +1,9 @@
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
{
/// <summary>
/// <para>表示 [GET] /new-tax-control-fapiao/merchant/base-information 接口的请求。</para>
/// </summary>
public class GetNewTaxControlFapiaoMerchantBaseInformationRequest : WechatTenpayRequest
{
}
}

View File

@ -0,0 +1,94 @@
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
{
/// <summary>
/// <para>表示 [GET] /new-tax-control-fapiao/merchant/base-information 接口的响应。</para>
/// </summary>
public class GetNewTaxControlFapiaoMerchantBaseInformationResponse : WechatTenpayResponse
{
public static class Types
{
public class Seller
{
/// <summary>
/// 获取或设置销售方名称。
/// </summary>
[Newtonsoft.Json.JsonProperty("name")]
[System.Text.Json.Serialization.JsonPropertyName("name")]
public string Name { get; set; } = default!;
/// <summary>
/// 获取或设置纳税人识别号。
/// </summary>
[Newtonsoft.Json.JsonProperty("taxpayer_id")]
[System.Text.Json.Serialization.JsonPropertyName("taxpayer_id")]
public string TaxpayerId { get; set; } = default!;
/// <summary>
/// 获取或设置地址。
/// </summary>
[Newtonsoft.Json.JsonProperty("address")]
[System.Text.Json.Serialization.JsonPropertyName("address")]
public string? Address { get; set; }
/// <summary>
/// 获取或设置电话。
/// </summary>
[Newtonsoft.Json.JsonProperty("telephone")]
[System.Text.Json.Serialization.JsonPropertyName("telephone")]
public string? PhoneNumber { get; set; }
/// <summary>
/// 获取或设置开户银行。
/// </summary>
[Newtonsoft.Json.JsonProperty("bank_name")]
[System.Text.Json.Serialization.JsonPropertyName("bank_name")]
public string? BankName { get; set; }
/// <summary>
/// 获取或设置银行账号。
/// </summary>
[Newtonsoft.Json.JsonProperty("bank_account")]
[System.Text.Json.Serialization.JsonPropertyName("bank_account")]
public string? BankAccountNumber { get; set; }
}
public class Extra
{
/// <summary>
/// 获取或设置收款人。
/// </summary>
[Newtonsoft.Json.JsonProperty("payee")]
[System.Text.Json.Serialization.JsonPropertyName("payee")]
public string? Payee { get; set; }
/// <summary>
/// 获取或设置复核人。
/// </summary>
[Newtonsoft.Json.JsonProperty("reviewer")]
[System.Text.Json.Serialization.JsonPropertyName("reviewer")]
public string? Reviewer { get; set; }
/// <summary>
/// 获取或设置开票人。
/// </summary>
[Newtonsoft.Json.JsonProperty("drawer")]
[System.Text.Json.Serialization.JsonPropertyName("drawer")]
public string Drawer { get; set; } = default!;
}
}
/// <summary>
/// 获取或设置销售方信息。
/// </summary>
[Newtonsoft.Json.JsonProperty("seller_information")]
[System.Text.Json.Serialization.JsonPropertyName("seller_information")]
public Types.Seller Seller { get; set; } = default!;
/// <summary>
/// 获取或设置额外信息。
/// </summary>
[Newtonsoft.Json.JsonProperty("extra_information")]
[System.Text.Json.Serialization.JsonPropertyName("extra_information")]
public Types.Extra Extra { get; set; } = default!;
}
}

View File

@ -0,0 +1,9 @@
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
{
/// <summary>
/// <para>表示 [GET] /new-tax-control-fapiao/merchant/development-config 接口的请求。</para>
/// </summary>
public class GetNewTaxControlFapiaoMerchantDevelopmentConfigRequest : WechatTenpayRequest
{
}
}

View File

@ -0,0 +1,15 @@
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
{
/// <summary>
/// <para>表示 [GET] /new-tax-control-fapiao/merchant/development-config 接口的响应。</para>
/// </summary>
public class GetNewTaxControlFapiaoMerchantDevelopmentConfigResponse : WechatTenpayResponse
{
/// <summary>
/// 获取或设置回调地址。
/// </summary>
[Newtonsoft.Json.JsonProperty("callback_url")]
[System.Text.Json.Serialization.JsonPropertyName("callback_url")]
public string CallbackUrl { get; set; } = default!;
}
}

View File

@ -0,0 +1,15 @@
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
{
/// <summary>
/// <para>表示 [PATCH] /new-tax-control-fapiao/merchant/development-config 接口的请求。</para>
/// </summary>
public class ModifyNewTaxControlFapiaoMerchantDevelopmentConfigRequest : WechatTenpayRequest
{
/// <summary>
/// 获取或设置回调地址。
/// </summary>
[Newtonsoft.Json.JsonProperty("callback_url")]
[System.Text.Json.Serialization.JsonPropertyName("callback_url")]
public string CallbackUrl { get; set; } = string.Empty;
}
}

View File

@ -0,0 +1,15 @@
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
{
/// <summary>
/// <para>表示 [PATCH] /new-tax-control-fapiao/merchant/development-config 接口的响应。</para>
/// </summary>
public class ModifyNewTaxControlFapiaoMerchantDevelopmentConfigResponse : WechatTenpayResponse
{
/// <summary>
/// 获取或设置回调地址。
/// </summary>
[Newtonsoft.Json.JsonProperty("callback_url")]
[System.Text.Json.Serialization.JsonPropertyName("callback_url")]
public string CallbackUrl { get; set; } = default!;
}
}

View File

@ -0,0 +1,23 @@
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
{
/// <summary>
/// <para>表示 [GET] /new-tax-control-fapiao/merchant/tax-codes 接口的请求。</para>
/// </summary>
public class QueryNewTaxControlFapiaoMerchantTaxCodesRequest : WechatTenpayRequest
{
/// <summary>
/// 获取或设置分页起始位置。
/// </summary>
[Newtonsoft.Json.JsonIgnore]
[System.Text.Json.Serialization.JsonIgnore]
public int Offset { get; set; }
/// <summary>
/// 获取或设置分页每页数量。
/// <para>默认值10</para>
/// </summary>
[Newtonsoft.Json.JsonIgnore]
[System.Text.Json.Serialization.JsonIgnore]
public int Limit { get; set; } = 10;
}
}

View File

@ -0,0 +1,70 @@
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
{
/// <summary>
/// <para>表示 [GET] /new-tax-control-fapiao/merchant/tax-codes 接口的响应。</para>
/// </summary>
public class QueryNewTaxControlFapiaoMerchantTaxCodesResponse : WechatTenpayResponse
{
public static class Types
{
public class Tax
{
/// <summary>
/// 获取或设置货物或应税劳务或服务编码。
/// </summary>
[Newtonsoft.Json.JsonProperty("tax_code")]
[System.Text.Json.Serialization.JsonPropertyName("tax_code")]
public string TaxCode { get; set; } = default!;
/// <summary>
/// 获取或设置货物或应税劳务或服务名称。
/// </summary>
[Newtonsoft.Json.JsonProperty("goods_name")]
[System.Text.Json.Serialization.JsonPropertyName("goods_name")]
public string GoodsName { get; set; } = default!;
/// <summary>
/// 获取或设置税率(单位:万分数)。
/// </summary>
[Newtonsoft.Json.JsonProperty("tax_rate")]
[System.Text.Json.Serialization.JsonPropertyName("tax_rate")]
public int TaxRate { get; set; }
/// <summary>
/// 获取或设置税收优惠政策标识。
/// </summary>
[Newtonsoft.Json.JsonProperty("tax_prefer_mark")]
[System.Text.Json.Serialization.JsonPropertyName("tax_prefer_mark")]
public string TaxPreferMark { get; set; } = default!;
}
}
/// <summary>
/// 获取或设置商品和服务税收分类对照信息列表。
/// </summary>
[Newtonsoft.Json.JsonProperty("data")]
[System.Text.Json.Serialization.JsonPropertyName("data")]
public Types.Tax[] TaxList { get; set; } = default!;
/// <summary>
/// 获取或设置分页起始位置。
/// </summary>
[Newtonsoft.Json.JsonProperty("offset")]
[System.Text.Json.Serialization.JsonPropertyName("offset")]
public int Offset { get; set; }
/// <summary>
/// 获取或设置分页每页数量。
/// </summary>
[Newtonsoft.Json.JsonProperty("limit")]
[System.Text.Json.Serialization.JsonPropertyName("limit")]
public int Limit { get; set; }
/// <summary>
/// 获取或设置总数量。
/// </summary>
[Newtonsoft.Json.JsonProperty("total_count")]
[System.Text.Json.Serialization.JsonPropertyName("total_count")]
public int TotalCount { get; set; }
}
}

View File

@ -0,0 +1,22 @@
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
{
/// <summary>
/// <para>表示 [GET] /new-tax-control-fapiao/user-title 接口的请求。</para>
/// </summary>
public class GetNewTaxControlFapiaoUserTitleRequest : WechatTenpayRequest
{
/// <summary>
/// 获取或设置发票申请单号。
/// </summary>
[Newtonsoft.Json.JsonIgnore]
[System.Text.Json.Serialization.JsonIgnore]
public string FapiaoApplyId { get; set; } = string.Empty;
/// <summary>
/// 获取或设置开票场景。
/// </summary>
[Newtonsoft.Json.JsonIgnore]
[System.Text.Json.Serialization.JsonIgnore]
public string Scene { get; set; } = string.Empty;
}
}

View File

@ -0,0 +1,76 @@
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
{
/// <summary>
/// <para>表示 [GET] /new-tax-control-fapiao/user-title 接口的响应。</para>
/// </summary>
[WechatTenpaySensitive]
public class GetNewTaxControlFapiaoUserTitleResponse : WechatTenpayResponse
{
/// <summary>
/// 获取或设置购买方类型。
/// </summary>
[Newtonsoft.Json.JsonProperty("type")]
[System.Text.Json.Serialization.JsonPropertyName("type")]
public string Type { get; set; } = default!;
/// <summary>
/// 获取或设置购买方名称。
/// </summary>
[Newtonsoft.Json.JsonProperty("name")]
[System.Text.Json.Serialization.JsonPropertyName("name")]
public string Name { get; set; } = default!;
/// <summary>
/// 获取或设置纳税人识别号。
/// </summary>
[Newtonsoft.Json.JsonProperty("taxpayer_id")]
[System.Text.Json.Serialization.JsonPropertyName("taxpayer_id")]
public string? TaxpayerId { get; set; }
/// <summary>
/// 获取或设置地址。
/// </summary>
[Newtonsoft.Json.JsonProperty("address")]
[System.Text.Json.Serialization.JsonPropertyName("address")]
public string? Address { get; set; }
/// <summary>
/// 获取或设置电话。
/// </summary>
[Newtonsoft.Json.JsonProperty("telephone")]
[System.Text.Json.Serialization.JsonPropertyName("telephone")]
public string? PhoneNumber { get; set; }
/// <summary>
/// 获取或设置开户银行。
/// </summary>
[Newtonsoft.Json.JsonProperty("bank_name")]
[System.Text.Json.Serialization.JsonPropertyName("bank_name")]
public string? BankName { get; set; }
/// <summary>
/// 获取或设置银行账号。
/// </summary>
[Newtonsoft.Json.JsonProperty("bank_account")]
[System.Text.Json.Serialization.JsonPropertyName("bank_account")]
public string? BankAccountNumber { get; set; }
/// <summary>
/// 获取或设置用户手机号码。
/// </summary>
[Newtonsoft.Json.JsonProperty("phone")]
[System.Text.Json.Serialization.JsonPropertyName("phone")]
[WechatTenpaySensitiveProperty(scheme: Constants.SignSchemes.WECHATPAY2_RSA_2048_WITH_SHA256, algorithm: Constants.EncryptionAlgorithms.RSA_2048_ECB_PKCS8_OAEP_WITH_SHA1_AND_MGF1)]
[WechatTenpaySensitiveProperty(scheme: Constants.SignSchemes.WECHATPAY2_SM2_WITH_SM3, algorithm: Constants.EncryptionAlgorithms.SM2_C1C3C2_ASN1)]
public string? UserMobileNumber { get; set; }
/// <summary>
/// 获取或设置用户邮箱地址。
/// </summary>
[Newtonsoft.Json.JsonProperty("email")]
[System.Text.Json.Serialization.JsonPropertyName("email")]
[WechatTenpaySensitiveProperty(scheme: Constants.SignSchemes.WECHATPAY2_RSA_2048_WITH_SHA256, algorithm: Constants.EncryptionAlgorithms.RSA_2048_ECB_PKCS8_OAEP_WITH_SHA1_AND_MGF1)]
[WechatTenpaySensitiveProperty(scheme: Constants.SignSchemes.WECHATPAY2_SM2_WITH_SM3, algorithm: Constants.EncryptionAlgorithms.SM2_C1C3C2_ASN1)]
public string? UserEmail { get; set; }
}
}

View File

@ -0,0 +1,78 @@
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
{
/// <summary>
/// <para>表示 [GET] /new-tax-control-fapiao/user-title/title-url 接口的请求。</para>
/// </summary>
public class GetNewTaxControlFapiaoUserTitleUrlRequest : WechatTenpayRequest
{
/// <summary>
/// 获取或设置发票申请单号。
/// </summary>
[Newtonsoft.Json.JsonIgnore]
[System.Text.Json.Serialization.JsonIgnore]
public string FapiaoApplyId { get; set; } = string.Empty;
/// <summary>
/// 获取或设置开票来源。
/// </summary>
[Newtonsoft.Json.JsonIgnore]
[System.Text.Json.Serialization.JsonIgnore]
public string Source { get; set; } = string.Empty;
/// <summary>
/// 获取或设置总金额(单位:分)。
/// </summary>
[Newtonsoft.Json.JsonIgnore]
[System.Text.Json.Serialization.JsonIgnore]
public int TotalAmount { get; set; }
/// <summary>
/// 获取或设置开票来源微信 AppId。
/// </summary>
[Newtonsoft.Json.JsonIgnore]
[System.Text.Json.Serialization.JsonIgnore]
public string AppId { get; set; } = string.Empty;
/// <summary>
/// 获取或设置用户唯一标识。
/// </summary>
[Newtonsoft.Json.JsonIgnore]
[System.Text.Json.Serialization.JsonIgnore]
public string OpenId { get; set; } = string.Empty;
/// <summary>
/// 获取或设置销售方名称。
/// </summary>
[Newtonsoft.Json.JsonIgnore]
[System.Text.Json.Serialization.JsonIgnore]
public string? SellerName { get; set; }
/// <summary>
/// 获取或设置是否需要展示手机号填写栏。
/// </summary>
[Newtonsoft.Json.JsonIgnore]
[System.Text.Json.Serialization.JsonIgnore]
public bool? RequireShowMobileCell { get; set; }
/// <summary>
/// 获取或设置是否必须填写手机号。
/// </summary>
[Newtonsoft.Json.JsonIgnore]
[System.Text.Json.Serialization.JsonIgnore]
public bool? RequireMustInputMobile { get; set; }
/// <summary>
/// 获取或设置是否需要展示邮箱地址填写栏。
/// </summary>
[Newtonsoft.Json.JsonIgnore]
[System.Text.Json.Serialization.JsonIgnore]
public bool? RequireShowEmailCell { get; set; }
/// <summary>
/// 获取或设置是否必须填写邮箱地址。
/// </summary>
[Newtonsoft.Json.JsonIgnore]
[System.Text.Json.Serialization.JsonIgnore]
public bool? RequireMustInputEmail { get; set; }
}
}

View File

@ -0,0 +1,29 @@
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
{
/// <summary>
/// <para>表示 [GET] /new-tax-control-fapiao/user-title/title-url 接口的响应。</para>
/// </summary>
public class GetNewTaxControlFapiaoUserTitleUrlResponse : WechatTenpayResponse
{
/// <summary>
/// 获取或设置小程序 AppId。
/// </summary>
[Newtonsoft.Json.JsonProperty("miniprogram_appid")]
[System.Text.Json.Serialization.JsonPropertyName("miniprogram_appid")]
public string MiniProgramAppId { get; set; } = default!;
/// <summary>
/// 获取或设置小程序页面路径。
/// </summary>
[Newtonsoft.Json.JsonProperty("miniprogram_path")]
[System.Text.Json.Serialization.JsonPropertyName("miniprogram_path")]
public string MiniProgramPagePath { get; set; } = default!;
/// <summary>
/// 获取或设置小程序用户名。
/// </summary>
[Newtonsoft.Json.JsonProperty("miniprogram_user_name")]
[System.Text.Json.Serialization.JsonPropertyName("miniprogram_user_name")]
public string? MiniProgramUsername { get; set; } = default!;
}
}

View File

@ -35,7 +35,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
/// </summary>
[Newtonsoft.Json.JsonProperty("taxpayer_id")]
[System.Text.Json.Serialization.JsonPropertyName("taxpayer_id")]
public string? TaxPayerId { get; set; }
public string? TaxpayerId { get; set; }
/// <summary>
/// 获取或设置地址。
@ -80,7 +80,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
/// </summary>
[Newtonsoft.Json.JsonProperty("taxpayer_id")]
[System.Text.Json.Serialization.JsonPropertyName("taxpayer_id")]
public string TaxPayerId { get; set; } = string.Empty;
public string TaxpayerId { get; set; } = string.Empty;
/// <summary>
/// 获取或设置地址。
@ -135,7 +135,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
public string Drawer { get; set; } = string.Empty;
}
public class LineItem
public class Item
{
/// <summary>
/// 获取或设置货物或应税劳务或服务编码。
@ -315,7 +315,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models
/// </summary>
[Newtonsoft.Json.JsonProperty("items")]
[System.Text.Json.Serialization.JsonPropertyName("items")]
public IList<Types.LineItem>? LineItemList { get; set; }
public IList<Types.Item>? ItemList { get; set; }
/// <summary>
/// 获取或设置备注信息。

View File

@ -120,12 +120,12 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
public virtual Dictionary<string, object>? ErrorDetail { get; set; }
/// <summary>
/// 获取一个值,该值指示调用微信 API 是否成功(即 HTTP 状态码为 200204、且 code 值为空)。
/// 获取一个值,该值指示调用微信 API 是否成功(即 HTTP 状态码为 200/202/204、且 code 值为空)。
/// </summary>
/// <returns></returns>
public virtual bool IsSuccessful()
{
return (RawStatus == 200 || RawStatus == 204) && string.IsNullOrEmpty(ErrorCode);
return (RawStatus >= 200 && RawStatus <= 204) && string.IsNullOrEmpty(ErrorCode);
}
}
}

View File

@ -0,0 +1,12 @@
{
"mchid": "1900000109",
"fapiao_apply_id": "4200000444201910177461284488",
"apply_time": "2020-07-01T12:00:00+08:00",
"fapiao_information": [
{
"fapiao_id": "20200701123456",
"fapiao_status": "ISSUED",
"card_status": "INSERTED"
}
]
}

View File

@ -0,0 +1,14 @@
{
"card_appid": "wxb1170446a4c0a5a2",
"card_template_information": {
"payee_name": "某公司",
"logo_url": "http://mmbiz.qpic.cn/mmbiz/iaL1LJM1mF9aRKPZJkmG8xXhiaHqkKSVMMWeN3hLut7X7hicFNjakmxibMLGWpXrEXB33367o7zHN0CwngnQY7zb7g/0",
"custom_cell": {
"words": "电子发票",
"description": "查看发票",
"jump_url": "http://www.qq.com",
"miniprogram_user_name": "gh_86a091e50ad4@app",
"miniprogram_path": "pages/xxxPage"
}
}
}

View File

@ -0,0 +1,4 @@
{
"card_appid": "wxb1170446a4c0a5a2",
"card_id": "p4gLgvn_cxVCQez17kaBJnZHPcXs"
}

View File

@ -0,0 +1,57 @@
{
"scene": "WITH_WECHATPAY",
"buyer_information": {
"type": "ORGANIZATION",
"name": "深圳市南山区测试企业",
"taxpayer_id": "202003261233701778",
"address": "深圳市南山区深南大道10000号",
"telephone": "075512345678",
"bank_name": "测试银行",
"bank_account": "62001234567890",
"phone": "18507550000",
"email": "123110@qq.com"
},
"fapiao_card_information": [
{
"fapiao_media_id": "ASNFZ4mrze/+3LqYdlQyEA==",
"fapiao_number": "12897794",
"fapiao_code": "044001911211",
"fapiao_time": "2020-07-01T12:00:00+08:00",
"check_code": "69001808340631374774",
"password": "006>299-375/326>2+7/*0-+<351059<80<4*/5>+<11631+*3030/5*37+/-243159658+013>3409*044>4-/1+/9->*>69501*6++1997--21",
"total_amount": 382895,
"tax_amount": 44050,
"amount": 338845,
"seller_information": {
"name": "深圳市南山区测试公司",
"taxpayer_id": "202003261233701778",
"address": "深圳市南山区深南大道10000号",
"telephone": "075512345678",
"bank_name": "测试银行",
"bank_account": "62001234567890"
},
"extra_information": {
"payee": "张三",
"reviewer": "李四",
"drawer": "王五"
},
"items": [
{
"tax_code": "3010101020203000000",
"goods_name": "出租汽车客运服务",
"specification": "A4",
"unit": "次",
"quantity": 100000000,
"unit_price": 380442000000,
"amount": 380442,
"tax_amount": 49458,
"total_amount": 429900,
"tax_rate": 1300,
"tax_prefer_mark": "NO_FAVORABLE",
"discount": false
}
],
"remark": "备注"
}
]
}

View File

@ -0,0 +1,37 @@
{
"scene": "WITH_WECHATPAY",
"fapiao_apply_id": "4200000444201910177461284488",
"buyer_information": {
"type": "ORGANIZATION",
"name": "深圳市南山区测试企业",
"taxpayer_id": "202003261233701778",
"address": "深圳市南山区深南大道10000号",
"telephone": "075512345678",
"bank_name": "测试银行",
"bank_account": "62001234567890",
"phone": "18507550000",
"email": "123110@qq.com"
},
"fapiao_information": [
{
"fapiao_id": "20200701123456",
"total_amount": 382895,
"need_list": false,
"remark": "备注",
"items": [
{
"tax_code": "3010101020203000000",
"goods_category": "运输服务",
"goods_name": "出租汽车客运服务",
"specification": "A4",
"unit": "次",
"quantity": 100000000,
"total_amount": 429900,
"tax_rate": 1300,
"tax_prefer_mark": "NO_FAVORABLE",
"discount": false
}
]
}
]
}

View File

@ -0,0 +1,74 @@
{
"total_count": 5,
"fapiao_information": [
{
"fapiao_id": "20200701123456",
"status": "ISSUED",
"blue_fapiao": {
"fapiao_code": "044001911211",
"fapiao_number": "12897794",
"check_code": "69001808340631374774",
"password": "006>299-375/326>2+7/*0-+<351059<80<4*/5>+<11631+*3030/5*37+/-243159658+013>3409*044>4-/1+/9->*>69501*6+21997--21",
"fapiao_time": "2020-07-01T12:00:00+08:00"
},
"red_fapiao": {
"fapiao_code": "044001911211",
"fapiao_number": "12897794",
"check_code": "69001808340631374774",
"password": "006>299-375/326>2+7/*0-+<351059<80<4*/5>+<11631+*3030/5*37+/-243159658+013>3409*044>4-/1+/9->*>69501*6+21997--21",
"fapiao_time": "2020-07-01T12:00:00+08:00"
},
"card_information": {
"card_appid": "wxab8acb865bb1637e",
"card_openid": "plN5twRbHym_j-QcqCzstl0HmwEs",
"card_id": "p4gLgvlAYSEOpeXGFVJRFxgop6iY",
"card_code": "379550244162",
"card_status": "INSERT_ACCEPTED"
},
"total_amount": 382895,
"tax_amount": 44050,
"amount": 338845,
"seller_information": {
"name": "深圳市南山区测试公司",
"taxpayer_id": "202003261233701778",
"address": "深圳市南山区深南大道10000号",
"telephone": "075512345678",
"bank_name": "测试银行",
"bank_account": "62001234567890"
},
"buyer_information": {
"type": "ORGANIZATION",
"name": "深圳市南山区测试企业",
"taxpayer_id": "202003261233701778",
"address": "深圳市南山区深南大道10000号",
"telephone": "075512345678",
"bank_name": "测试银行",
"bank_account": "62001234567890",
"phone": "pVd1HJ6zyvPedzGaV+X3qtmrq9bb9tPttdY+aQ6zB",
"email": "pVd1HJ6zyvPedzGaV+X3qtmrq9bb9tPttdY+aQ6za"
},
"extra_information": {
"payee": "张三",
"reviewer": "李四",
"drawer": "王五"
},
"items": [
{
"tax_code": "3010101020203000000",
"goods_name": "出租汽车客运服务",
"specification": "A4",
"unit": "次",
"quantity": 100000000,
"unit_price": 380442000000,
"amount": 380442,
"tax_amount": 49458,
"total_amount": 429900,
"tax_rate": 1300,
"tax_prefer_mark": "NO_FAVORABLE",
"discount": false
}
],
"remark": "备注"
}
]
}

View File

@ -0,0 +1,9 @@
{
"fapiao_download_info_list": [
{
"download_url": "https://pay.wechatpay.cn/invoicing/fapiao/fapiao-file",
"fapiao_id": "20200701123456",
"status": "ISSUED"
}
]
}

View File

@ -0,0 +1,15 @@
{
"seller_information": {
"name": "深圳市南山区测试公司",
"taxpayer_id": "202003261233701778",
"address": "深圳市南山区深南大道10000号",
"telephone": "075512345678",
"bank_name": "测试银行",
"bank_account": "62001234567890"
},
"extra_information": {
"payee": "张三",
"reviewer": "李四",
"drawer": "王五"
}
}

View File

@ -0,0 +1,10 @@
{
"reverse_reason": "退款",
"fapiao_information": [
{
"fapiao_id": "20200701123456",
"fapiao_code": "044001911211",
"fapiao_number": "12897794"
}
]
}

View File

@ -0,0 +1,5 @@
{
"digest": "addca90a6a290b9642dbaccffdf01e8c22aa348940b2e96754169ba08c19e5db",
"digest_alogrithm": "SM3",
"file_type": "PDF"
}

View File

@ -0,0 +1,13 @@
{
"offset": "0",
"limit": 5,
"data": [
{
"tax_code": "3010101020203000000",
"goods_name": "出租汽车客运服务",
"tax_rate": 1300,
"tax_prefer_mark": "NO_FAVORABLE"
}
],
"total_count": 20
}

View File

@ -0,0 +1,11 @@
{
"type": "ORGANIZATION",
"name": "深圳市南山区测试企业",
"taxpayer_id": "202003261233701778",
"address": "深圳市南山区深南大道10000号",
"telephone": "075512345678",
"bank_name": "测试银行",
"bank_account": "62001234567890",
"phone": "18507550000",
"email": "123110@qq.com"
}

View File

@ -0,0 +1,5 @@
{
"miniprogram_appid": "wxb1170446a4c0a5a2",
"miniprogram_path": "pages/xxxPage",
"miniprogram_user_name": "gh_86a091e50ad4@app"
}

View File

@ -647,6 +647,88 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.UnitTests
AssertMockRequestModel(reqB2, (cipher) => Utilities.SM2Utility.Decrypt(SM2_PEM_PRIVATE_KEY, cipher));
}
[Fact(DisplayName = "测试用例:加密请求中的敏感数据([POST] /new-tax-control-fapiao/fapiao-applications")]
public async Task TestEncryptRequestSensitiveProperty_CreateNewTaxControlFapiaoApplicationRequest()
{
static Models.CreateNewTaxControlFapiaoApplicationRequest GenerateMockRequestModel()
{
return new Models.CreateNewTaxControlFapiaoApplicationRequest()
{
Buyer = new Models.CreateNewTaxControlFapiaoApplicationRequest.Types.Buyer()
{
UserMobileNumber = MOCK_PLAIN_STR,
UserEmail = MOCK_PLAIN_STR
}
};
}
static void AssertMockRequestModel(Models.CreateNewTaxControlFapiaoApplicationRequest request, Func<string, string> decryptor)
{
Assert.NotEqual(MOCK_PLAIN_STR, request.Buyer!.UserMobileNumber!);
Assert.NotEqual(MOCK_PLAIN_STR, request.Buyer!.UserEmail!);
Assert.Equal(MOCK_PLAIN_STR, decryptor.Invoke(request.Buyer!.UserMobileNumber!));
Assert.Equal(MOCK_PLAIN_STR, decryptor.Invoke(request.Buyer!.UserEmail!));
Assert.Equal(MOCK_CERT_SN, request.WechatpayCertificateSerialNumber!, ignoreCase: true);
}
var reqA1 = GenerateMockRequestModel();
CreateMockClientUseRSA(autoEncrypt: false).EncryptRequestSensitiveProperty(reqA1);
AssertMockRequestModel(reqA1, (cipher) => Utilities.RSAUtility.DecryptWithECB(RSA_PEM_PRIVATE_KEY, cipher));
var reqA2 = GenerateMockRequestModel();
CreateMockClientUseSM2(autoEncrypt: false).EncryptRequestSensitiveProperty(reqA2);
AssertMockRequestModel(reqA2, (cipher) => Utilities.SM2Utility.Decrypt(SM2_PEM_PRIVATE_KEY, cipher));
var reqB1 = GenerateMockRequestModel();
await CreateMockClientUseRSA(autoEncrypt: true).ExecuteCreateNewTaxControlFapiaoApplicationAsync(reqB1);
AssertMockRequestModel(reqB1, (cipher) => Utilities.RSAUtility.DecryptWithECB(RSA_PEM_PRIVATE_KEY, cipher));
var reqB2 = GenerateMockRequestModel();
await CreateMockClientUseSM2(autoEncrypt: true).ExecuteCreateNewTaxControlFapiaoApplicationAsync(reqB2);
AssertMockRequestModel(reqB2, (cipher) => Utilities.SM2Utility.Decrypt(SM2_PEM_PRIVATE_KEY, cipher));
}
[Fact(DisplayName = "测试用例:加密请求中的敏感数据([POST] /new-tax-control-fapiao/fapiao-applications/{fapiao_apply_id}/insert-cards")]
public async Task TestEncryptRequestSensitiveProperty_CreateNewTaxControlFapiaoApplicationCardRequest()
{
static Models.CreateNewTaxControlFapiaoApplicationCardRequest GenerateMockRequestModel()
{
return new Models.CreateNewTaxControlFapiaoApplicationCardRequest()
{
Buyer = new Models.CreateNewTaxControlFapiaoApplicationCardRequest.Types.Buyer()
{
UserMobileNumber = MOCK_PLAIN_STR,
UserEmail = MOCK_PLAIN_STR
}
};
}
static void AssertMockRequestModel(Models.CreateNewTaxControlFapiaoApplicationCardRequest request, Func<string, string> decryptor)
{
Assert.NotEqual(MOCK_PLAIN_STR, request.Buyer!.UserMobileNumber!);
Assert.NotEqual(MOCK_PLAIN_STR, request.Buyer!.UserEmail!);
Assert.Equal(MOCK_PLAIN_STR, decryptor.Invoke(request.Buyer!.UserMobileNumber!));
Assert.Equal(MOCK_PLAIN_STR, decryptor.Invoke(request.Buyer!.UserEmail!));
Assert.Equal(MOCK_CERT_SN, request.WechatpayCertificateSerialNumber!, ignoreCase: true);
}
var reqA1 = GenerateMockRequestModel();
CreateMockClientUseRSA(autoEncrypt: false).EncryptRequestSensitiveProperty(reqA1);
AssertMockRequestModel(reqA1, (cipher) => Utilities.RSAUtility.DecryptWithECB(RSA_PEM_PRIVATE_KEY, cipher));
var reqA2 = GenerateMockRequestModel();
CreateMockClientUseSM2(autoEncrypt: false).EncryptRequestSensitiveProperty(reqA2);
AssertMockRequestModel(reqA2, (cipher) => Utilities.SM2Utility.Decrypt(SM2_PEM_PRIVATE_KEY, cipher));
var reqB1 = GenerateMockRequestModel();
await CreateMockClientUseRSA(autoEncrypt: true).ExecuteCreateNewTaxControlFapiaoApplicationCardAsync(reqB1);
AssertMockRequestModel(reqB1, (cipher) => Utilities.RSAUtility.DecryptWithECB(RSA_PEM_PRIVATE_KEY, cipher));
var reqB2 = GenerateMockRequestModel();
await CreateMockClientUseSM2(autoEncrypt: true).ExecuteCreateNewTaxControlFapiaoApplicationCardAsync(reqB2);
AssertMockRequestModel(reqB2, (cipher) => Utilities.SM2Utility.Decrypt(SM2_PEM_PRIVATE_KEY, cipher));
}
[Fact(DisplayName = "测试用例:加密请求中的敏感数据([POST] /payroll-card/authentications/pre-order-with-auth")]
public async Task TestEncryptRequestSensitiveProperty_PreOrderWithAuthPayrollCardAuthenticationRequest()
{

View File

@ -380,6 +380,103 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.UnitTests
AssertMockResponseModel(resB2);
}
[Fact(DisplayName = "测试用例:解密响应中的敏感数据([GET] /new-tax-control-fapiao/fapiao-applications/{fapiao_apply_id}")]
public async Task TestDecryptResponseSensitiveProperty_GetNewTaxControlFapiaoApplicationByFapiaoApplyId()
{
static Models.GetNewTaxControlFapiaoApplicationByFapiaoApplyIdResponse GenerateMockResponseModel(Func<string, string> encryptor)
{
return new Models.GetNewTaxControlFapiaoApplicationByFapiaoApplyIdResponse()
{
RawStatus = (int)HttpStatusCode.OK,
FapiaoList = new Models.GetNewTaxControlFapiaoApplicationByFapiaoApplyIdResponse.Types.Fapiao[]
{
new Models.GetNewTaxControlFapiaoApplicationByFapiaoApplyIdResponse.Types.Fapiao()
{
Buyer = new Models.GetNewTaxControlFapiaoApplicationByFapiaoApplyIdResponse.Types.Fapiao.Types.Buyer()
{
UserMobileNumber = encryptor.Invoke(MOCK_PLAIN_STR),
UserEmail = encryptor.Invoke(MOCK_PLAIN_STR)
}
}
}
};
}
static void AssertMockResponseModel(Models.GetNewTaxControlFapiaoApplicationByFapiaoApplyIdResponse response)
{
Assert.Equal(MOCK_PLAIN_STR, response.FapiaoList[0]!.Buyer!.UserMobileNumber!);
Assert.Equal(MOCK_PLAIN_STR, response.FapiaoList[0]!.Buyer!.UserEmail!);
}
var resA1 = GenerateMockResponseModel((plain) => Utilities.RSAUtility.EncryptWithECBByCertificate(RSA_PEM_CERTIFICATE, plain));
CreateMockClientUseRSA(autoDecrypt: false).DecryptResponseSensitiveProperty(resA1);
AssertMockResponseModel(resA1);
var resA2 = GenerateMockResponseModel((plain) => Utilities.SM2Utility.EncryptByCertificate(SM2_PEM_CERTIFICATE, plain));
CreateMockClientUseSM2(autoDecrypt: false).DecryptResponseSensitiveProperty(resA2);
AssertMockResponseModel(resA2);
var resB1 = await CreateMockClientUseRSA(
autoDecrypt: true,
mockResponseContent: new FlurlSystemTextJsonSerializer().Serialize(
GenerateMockResponseModel((plain) => Utilities.RSAUtility.EncryptWithECBByCertificate(RSA_PEM_CERTIFICATE, plain))
)
).ExecuteGetNewTaxControlFapiaoApplicationByFapiaoApplyIdAsync(new Models.GetNewTaxControlFapiaoApplicationByFapiaoApplyIdRequest());
AssertMockResponseModel(resB1);
var resB2 = await CreateMockClientUseSM2(
autoDecrypt: true,
mockResponseContent: new FlurlSystemTextJsonSerializer().Serialize(
GenerateMockResponseModel((plain) => Utilities.SM2Utility.EncryptByCertificate(SM2_PEM_CERTIFICATE, plain))
)
).ExecuteGetNewTaxControlFapiaoApplicationByFapiaoApplyIdAsync(new Models.GetNewTaxControlFapiaoApplicationByFapiaoApplyIdRequest());
AssertMockResponseModel(resB2);
}
[Fact(DisplayName = "测试用例:解密响应中的敏感数据([GET] /new-tax-control-fapiao/user-title")]
public async Task TestDecryptResponseSensitiveProperty_GetNewTaxControlFapiaoUserTitle()
{
static Models.GetNewTaxControlFapiaoUserTitleResponse GenerateMockResponseModel(Func<string, string> encryptor)
{
return new Models.GetNewTaxControlFapiaoUserTitleResponse()
{
RawStatus = (int)HttpStatusCode.OK,
UserMobileNumber = encryptor.Invoke(MOCK_PLAIN_STR),
UserEmail = encryptor.Invoke(MOCK_PLAIN_STR)
};
}
static void AssertMockResponseModel(Models.GetNewTaxControlFapiaoUserTitleResponse response)
{
Assert.Equal(MOCK_PLAIN_STR, response.UserMobileNumber!);
Assert.Equal(MOCK_PLAIN_STR, response.UserEmail!);
}
var resA1 = GenerateMockResponseModel((plain) => Utilities.RSAUtility.EncryptWithECBByCertificate(RSA_PEM_CERTIFICATE, plain));
CreateMockClientUseRSA(autoDecrypt: false).DecryptResponseSensitiveProperty(resA1);
AssertMockResponseModel(resA1);
var resA2 = GenerateMockResponseModel((plain) => Utilities.SM2Utility.EncryptByCertificate(SM2_PEM_CERTIFICATE, plain));
CreateMockClientUseSM2(autoDecrypt: false).DecryptResponseSensitiveProperty(resA2);
AssertMockResponseModel(resA2);
var resB1 = await CreateMockClientUseRSA(
autoDecrypt: true,
mockResponseContent: new FlurlSystemTextJsonSerializer().Serialize(
GenerateMockResponseModel((plain) => Utilities.RSAUtility.EncryptWithECBByCertificate(RSA_PEM_CERTIFICATE, plain))
)
).ExecuteGetNewTaxControlFapiaoUserTitleAsync(new Models.GetNewTaxControlFapiaoUserTitleRequest());
AssertMockResponseModel(resB1);
var resB2 = await CreateMockClientUseSM2(
autoDecrypt: true,
mockResponseContent: new FlurlSystemTextJsonSerializer().Serialize(
GenerateMockResponseModel((plain) => Utilities.SM2Utility.EncryptByCertificate(SM2_PEM_CERTIFICATE, plain))
)
).ExecuteGetNewTaxControlFapiaoUserTitleAsync(new Models.GetNewTaxControlFapiaoUserTitleRequest());
AssertMockResponseModel(resB2);
}
[Fact(DisplayName = "测试用例:解密响应中的敏感数据([GET] /partner-transfer/batches/batch-id/{batch_id}/details/detail-id/{detail_id}")]
public async Task TestDecryptResponseSensitiveProperty_GetPartnerTransferBatchDetailByDetailIdResponse()
{