Bitzsoft.Integrations.Finance.Invoice 1.0.0-alpha.10

This is a prerelease version of Bitzsoft.Integrations.Finance.Invoice.
dotnet add package Bitzsoft.Integrations.Finance.Invoice --version 1.0.0-alpha.10
                    
NuGet\Install-Package Bitzsoft.Integrations.Finance.Invoice -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.Invoice" 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.Invoice" Version="1.0.0-alpha.10" />
                    
Directory.Packages.props
<PackageReference Include="Bitzsoft.Integrations.Finance.Invoice" />
                    
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.Invoice --version 1.0.0-alpha.10
                    
#r "nuget: Bitzsoft.Integrations.Finance.Invoice, 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.Invoice@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.Invoice&version=1.0.0-alpha.10&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=Bitzsoft.Integrations.Finance.Invoice&version=1.0.0-alpha.10&prerelease
                    
Install as a Cake Tool

Bitzsoft.Integrations.Finance.Invoice

发票管理服务抽象层 -- 定义开具、红冲、查验、查询、交付等统一接口与基础模型。

功能特性

  • 全票种覆盖:传统发票(发票代码 + 发票号码)与数电票(仅发票号码)两种模式统一建模
  • 核心开票能力IssueAsync 开具蓝字发票、RedFlushAsync 红字冲销、CancelAsync 作废
  • 查询与查验QueryAsync 日期范围分页查询、VerifyAsync 真伪查验、GetDetailAsync 完整详情
  • 发票交付DeliverAsync 邮箱 / 短信推送(InvoiceDeliveryMethod
  • 能力扩展:OCR 识别(IInvoiceOcrProvider)、税收分类编码智能匹配(ITaxCodeMatchProvider)独立接口,按 is 检查按需使用
  • 领域异常InvoiceException 派生自 FinanceException,统一携带供应商名称与错误码

安装

.NET CLI

dotnet add package Bitzsoft.Integrations.Finance.Invoice

PackageReference

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

配置

本包为抽象层,不定义 Options 类,不读取配置节。各供应商的配置项由实现包定义(如诺诺 NuonuoOptions、百旺 BaiwangOptions、金蝶 KingdeeOptions)。

注册服务

本包为抽象层,ServiceCollectionExtensions 仅作命名空间占位,不提供具体注册方法。具体供应商由实现包注册,或使用聚合包一次性注册:

// 发票管理聚合包(详见聚合包文档)
using Bitzsoft.Integrations.Finance.Invoice.All;

services.AddBitzsoftInvoiceAll(configuration);

使用示例

开具发票

using Bitzsoft.Integrations.Finance.Invoice.Interfaces;
using Bitzsoft.Integrations.Finance.Invoice.Models;
using Bitzsoft.Integrations.Finance.Invoice.Enums;

public class InvoiceService
{
    private readonly IInvoiceProvider _invoice;

    public InvoiceService(IInvoiceProvider invoice) => _invoice = invoice;

    public async Task<InvoiceIssueResult> IssueAsync()
    {
        var request = new InvoiceIssueRequest
        {
            OrderNo      = "ORD20260701001",   // 销方税号下唯一,用于幂等
            InvoiceType  = InvoiceType.DigitalNormal,
            Buyer        = new BuyerInfo { /* 购方信息 */ },
            Items        =
            [
                new InvoiceItem { /* 明细行 */ }
            ],
            PushMode     = InvoiceDeliveryMethod.Email
        };

        return await _invoice.IssueAsync(request);
    }
}

查验发票

var verify = await _invoice.VerifyAsync(new InvoiceVerifyRequest
{
    InvoiceCode    = null,            // 数电票传 null
    InvoiceNumber  = "2444...",
    InvoiceDate    = new DateTime(2026, 7, 1),
    InvoiceAmount  = 11300m,          // 含税金额
    CheckCode      = "123456"         // 校验码后六位(可选)
});

交付发票

await _invoice.DeliverAsync(new InvoiceDeliveryRequest
{
    InvoiceCode   = null,
    InvoiceNumber = "2444...",
    Method        = InvoiceDeliveryMethod.EmailAndSms,
    Email         = "buyer@example.com",
    Phone         = "138..."
});

按需使用扩展能力

// OCR 识别查验一体化(供应商实现 IInvoiceOcrProvider 时可用)
if (_invoice is IInvoiceOcrProvider ocr)
{
    var result = await ocr.RecognizeAndVerifyAsync(imageBytes);
}

// 税收分类编码智能匹配(供应商实现 ITaxCodeMatchProvider 时可用)
if (_invoice is ITaxCodeMatchProvider matcher)
{
    var code = await matcher.MatchTaxCodeAsync("软件开发服务");
}

核心类型一览

接口(位于 Interfaces/

接口 说明
IInvoiceProvider 发票管理服务统一抽象接口(开具 / 红冲 / 作废 / 查询 / 查验 / 详情 / 交付)
IInvoiceConfigProvider 配置提供者接口(异步获取配置,实现类注册为 Singleton)
IInvoiceOcrProvider 发票 OCR 识别能力扩展(RecognizeInvoiceAsync / RecognizeAndVerifyAsync
ITaxCodeMatchProvider 税收分类编码智能匹配能力扩展(MatchTaxCodeAsync

IInvoiceProvider 方法

方法 说明
IssueAsync 开具蓝字发票
RedFlushAsync 红字冲销发票
CancelAsync 作废发票
QueryAsync 查询已开发票(日期范围 + 分页)
VerifyAsync 发票查验
GetDetailAsync 获取发票详情
DeliverAsync 交付发票

请求模型

类型 说明
InvoiceIssueRequest 开票请求(OrderNo / InvoiceType / Buyer / Items / PushMode 等)
InvoiceRedFlushRequest 红冲请求
InvoiceReIssueRequest 重新开票请求
InvoiceDeliveryRequest 交付请求(Method / Email / Phone)
InvoiceVerifyRequest 查验请求(InvoiceCode / InvoiceNumber / InvoiceDate / InvoiceAmount / CheckCode)
DigitalInvoiceRequest 数电票请求
RedLetterApplyRequest / RedLetterQueryRequest 红字信息表申请 / 查询
InputSyncRequest 进项同步请求

响应模型

类型 说明
InvoiceIssueResult 开票结果
InvoiceQueryResult 查询结果
InvoiceVerifyResult 查验结果
InvoiceInfo 发票完整信息(InvoiceCode / InvoiceNumber / InvoiceType / Status / Buyer / Seller / Items / 金额合计 / PdfUrl)
InvoiceItem 发票明细行
OCRResult OCR 识别结果
RedLetterApplyResult 红字信息表申请结果
RedFlushResultDetail 红冲结果详情
InputQueryResult / InputStatisticsResult / InputSyncResult 进项查询 / 统计 / 同步结果
InvoiceStockInfo 发票库存信息
TaxClassificationCode 税收分类编码
AuthQRCodeResult / TaxBureauLoginResult 实人认证二维码 / 税局登录结果

实体与枚举

类型 说明
BuyerInfo / SellerInfo 购方 / 销方信息
SmartTitleInfo 智能抬头信息
TaxDeviceInfo 税控设备信息
InvoiceType 发票类型枚举(ElectronicNormal / PaperNormal / Special / DigitalNormal / DigitalSpecial 等 8 种)
InvoiceStatus 发票状态枚举(Pending / Issuing / Signing / Issued / Failed / Cancelled / RedFlushed 等 9 种)
InvoiceDeliveryMethod 交付方式枚举(Email / Sms / EmailAndSms)
RedFlushReason 红冲原因枚举
InvoiceException 发票管理领域异常(继承 FinanceException

依赖

说明
Bitzsoft.Integrations.Finance 财税管理公共基础(FinanceException 基类)
Bitzsoft.Integrations.Compatibility 基础工具库(实现包间接复用)

相关包

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 (4)

Showing the top 4 NuGet packages that depend on Bitzsoft.Integrations.Finance.Invoice:

Package Downloads
Bitzsoft.Integrations.Finance.Invoice.Baiwang

百旺发票服务实现

Bitzsoft.Integrations.Finance.Invoice.Nuonuo

诺诺发票服务实现

Bitzsoft.Integrations.Finance.Invoice.Kingdee

金蝶发票云发票管理实现

Bitzsoft.Integrations.Finance.Invoice.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 72 7/12/2026
1.0.0-alpha.8 83 7/1/2026
1.0.0-alpha.7 95 6/16/2026
1.0.0-alpha.6 86 6/16/2026
1.0.0-alpha.5 80 6/14/2026