Bitzsoft.Integrations.Finance.Tax.QiXiangYun 1.0.0-alpha.10

This is a prerelease version of Bitzsoft.Integrations.Finance.Tax.QiXiangYun.
dotnet add package Bitzsoft.Integrations.Finance.Tax.QiXiangYun --version 1.0.0-alpha.10
                    
NuGet\Install-Package Bitzsoft.Integrations.Finance.Tax.QiXiangYun -Version 1.0.0-alpha.10
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Bitzsoft.Integrations.Finance.Tax.QiXiangYun" Version="1.0.0-alpha.10" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Bitzsoft.Integrations.Finance.Tax.QiXiangYun" Version="1.0.0-alpha.10" />
                    
Directory.Packages.props
<PackageReference Include="Bitzsoft.Integrations.Finance.Tax.QiXiangYun" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Bitzsoft.Integrations.Finance.Tax.QiXiangYun --version 1.0.0-alpha.10
                    
#r "nuget: Bitzsoft.Integrations.Finance.Tax.QiXiangYun, 1.0.0-alpha.10"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Bitzsoft.Integrations.Finance.Tax.QiXiangYun@1.0.0-alpha.10
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Bitzsoft.Integrations.Finance.Tax.QiXiangYun&version=1.0.0-alpha.10&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=Bitzsoft.Integrations.Finance.Tax.QiXiangYun&version=1.0.0-alpha.10&prerelease
                    
Install as a Cake Tool

Bitzsoft.Integrations.Finance.Tax.QiXiangYun

企享云税务服务实现 -- 对接企享云开放平台 API,提供订购管理、企业授权与异步任务能力。

功能特性

  • 订购管理:产品订购(SubscribeProductAsync)、取消订购(CancelSubscribeAsync),按税号 + 产品代码维护服务订购关系
  • 企业授权:获取已授权企业列表(GetEnterpriseListAsync),返回税号、企业名称与授权状态
  • 通知回调保护:供应商签名规范未配置时拒绝确认服务异常通知和税局维护消息,避免将未经验证的回调误报为成功
  • 异步任务管理QiXiangYunAsyncTaskManager 封装发起任务 → 轮询 → 超时处理的标准模式,可配置轮询间隔与超时上限
  • 自动鉴权QiXiangYunAuthHandler 自动注入 access_tokenappId 请求头
  • 配置校验:启动期校验 AppId / AppSecret 必填、BaseUrl 合法 URI、轮询与超时参数合理

安装

.NET CLI

dotnet add package Bitzsoft.Integrations.Finance.Tax.QiXiangYun

PackageReference

<PackageReference Include="Bitzsoft.Integrations.Finance.Tax.QiXiangYun" Version="1.0.0" />

配置

appsettings.json

{
  "Finance": {
    "Tax": {
      "QiXiangYun": {
        "AppId": "企享云提供的 AppId",
        "AppSecret": "双方约定的 AppSecret",
        "BaseUrl": "https://api.qixiangyun.com",
        "CallbackBaseUrl": "https://yourapp.com/qxy/callback",
        "AsyncPollIntervalMs": 3000,
        "AsyncTimeoutMs": 60000,
        "HttpTimeoutSeconds": 30
      }
    }
  }
}
配置项 必填 默认值 说明
AppId 企享云开放平台应用标识
AppSecret 双方约定的应用密钥
BaseUrl https://api.qixiangyun.com API 基地址
CallbackBaseUrl 回调通知基础地址(用于接收企享云推送)
AsyncPollIntervalMs 3000 异步任务轮询间隔(毫秒,最小 1000)
AsyncTimeoutMs 60000 异步任务超时(毫秒,须大于 AsyncPollIntervalMs
HttpTimeoutSeconds 30 HTTP 请求超时(秒,最小 1)

注册服务

从 IConfiguration 绑定

using Bitzsoft.Integrations.Finance.Tax.QiXiangYun;

builder.Services.AddBitzsoftQiXiangYunTax(
    builder.Configuration.GetSection("Finance:Tax:QiXiangYun"));

注意:当前 AddBitzsoftQiXiangYunTax 仅提供 Action<QiXiangYunOptions> 委托重载。从配置节绑定时,可使用 services.Configure<QiXiangYunOptions>(configuration.GetSection(...)) 后再调用委托重载,或通过 Bitzsoft.Integrations.Finance.All 聚合包统一注册。

委托配置

builder.Services.AddBitzsoftQiXiangYunTax(options =>
{
    options.AppId = "企享云提供的 AppId";
    options.AppSecret = "双方约定的 AppSecret";
    options.BaseUrl = "https://api.qixiangyun.com";
    options.AsyncPollIntervalMs = 3000;
    options.AsyncTimeoutMs = 60000;
});

第三方请求日志

内置 Bitzsoft.Integrations.RequestLogging 出站请求记录管道,默认使用 NullRequestLogStore 不持久化。

// 持久化:宿主注册 IRequestLogStore 实现后,所有出站请求自动落库
services.AddRequestLogging<MyRequestLogStore>(opts =>
{
    opts.MaxInMemoryBodyBytes = 64 * 1024; // 仅控制内存/加密临时文件切换,不截断正文
    opts.SensitiveFields.Add("AppSecret");
});
services.AddBitzsoftQiXiangYunTax(options => { /* ... */ });

使用示例

using Bitzsoft.Integrations.Finance.Tax.QiXiangYun.Common;

public class QxyService
{
    private readonly QiXiangYunCommonProvider _common;

    public QxyService(QiXiangYunCommonProvider common) => _common = common;

    // 获取已授权企业列表
    public async Task<IReadOnlyList<QiXiangYunEnterprise>> GetEnterprisesAsync(CancellationToken ct)
    {
        var result = await _common.GetEnterpriseListAsync(ct);
        return result.Success ? result.Data!.enterprises : Array.Empty<QiXiangYunEnterprise>();
    }

    // 订购产品
    public async Task<string> SubscribeAsync(string taxNumber, string productCode, CancellationToken ct)
    {
        var resp = await _common.SubscribeProductAsync(new QiXiangYunSubscribeRequest
        {
            taxNumber   = taxNumber,
            productCode = productCode,
            startDate   = "2026-07-23",
            endDate     = "2027-07-23"
        }, ct);
        return resp.Data?.orderNo ?? "";
    }
}

核心类型一览

类型 说明
QiXiangYunOptions 配置选项(AppId / AppSecret / BaseUrl / CallbackBaseUrl / AsyncPollIntervalMs / AsyncTimeoutMs / HttpTimeoutSeconds)
ServiceCollectionExtensions.AddBitzsoftQiXiangYunTax DI 注册扩展(Action<QiXiangYunOptions>
QiXiangYunCommonProvider 公共能力 Provider(企业列表 / 订购 / 通知处理,分部类)
QiXiangYunAsyncTaskManager 异步任务管理器(ExecuteAsync<T> 发起 → 轮询 → 超时)
QiXiangYunHttpClient HTTP 客户端(PostAsync / GetAsync
QiXiangYunAuthHandler 鉴权 DelegatingHandler(自动注入 access_token / appId)
QiXiangYunOptionsValidator 配置校验器(IValidateOptions<QiXiangYunOptions>
TaxApiResult<T> 统一响应(来自抽象层)
QiXiangYunSubscribeRequest / QiXiangYunSubscribeResponse 订购请求 / 响应
QiXiangYunEnterpriseListResponse / QiXiangYunEnterprise 企业列表响应 / 企业信息
QiXiangYunNotificationPayload 通知载荷

以上业务 Provider 与模型当前为 internal,主要通过聚合包或抽象接口使用。

依赖

说明
Bitzsoft.Integrations.Finance.Tax 税务管理抽象层(TaxApiResult<T> / TaxException
Bitzsoft.Integrations.RequestLogging 出站请求记录管道
Microsoft.Extensions.Http IHttpClientFactory(Typed Client 连接池)
Microsoft.Extensions.Options.ConfigurationExtensions Options 配置节点绑定

相关包

Product Compatible and additional computed target framework versions.
.NET net5.0 is compatible.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Bitzsoft.Integrations.Finance.Tax.QiXiangYun:

Package Downloads
Bitzsoft.Integrations.Finance.All

财税管理集成聚合包 — 包含所有子模块与供应商实现

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.0-alpha.10 33 7/26/2026
1.0.0-alpha.9 54 7/12/2026
1.0.0-alpha.8 58 7/1/2026
1.0.0-alpha.7 72 6/16/2026
1.0.0-alpha.6 64 6/16/2026
1.0.0-alpha.5 65 6/14/2026