Bitzsoft.Integrations.Express.SfLegal 1.0.1

dotnet add package Bitzsoft.Integrations.Express.SfLegal --version 1.0.1
                    
NuGet\Install-Package Bitzsoft.Integrations.Express.SfLegal -Version 1.0.1
                    
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.Express.SfLegal" Version="1.0.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Bitzsoft.Integrations.Express.SfLegal" Version="1.0.1" />
                    
Directory.Packages.props
<PackageReference Include="Bitzsoft.Integrations.Express.SfLegal" />
                    
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.Express.SfLegal --version 1.0.1
                    
#r "nuget: Bitzsoft.Integrations.Express.SfLegal, 1.0.1"
                    
#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.Express.SfLegal@1.0.1
                    
#: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.Express.SfLegal&version=1.0.1
                    
Install as a Cake Addin
#tool nuget:?package=Bitzsoft.Integrations.Express.SfLegal&version=1.0.1
                    
Install as a Cake Tool

Bitzsoft.Integrations.Express.SfLegal

顺丰函证通法律函件寄递服务实现 -- 面向律师事务所、会计师事务所等企业的法律函件全生命周期管理。

功能特性

  • 实现 ISfLegalDocumentProvider 独立接口(非 IExpressProvider),与通用物流服务互不冲突
  • 支持法律函件创建、寄递追踪、签收确认、全流程记录查询
  • 认证方式:月结卡号 + CustomerCode + CheckWord,签名 = Base64(MD5(data + timestamp + checkWord))
  • 法律函件状态自动推断(签收 / 拒收 / 退回 / 异常)
  • 统一异常处理,供应商错误码自动映射为 ExpressException

安装

.NET CLI

dotnet add package Bitzsoft.Integrations.Express.SfLegal

PackageReference

<PackageReference Include="Bitzsoft.Integrations.Express.SfLegal" Version="1.0.0" />

配置

appsettings.json

{
  "Express": {
    "SfLegal": {
      "MonthlyCardNo": "你的月结卡号",
      "CustomerCode": "你的顾客编码",
      "CheckWord": "你的校验码",
      "BaseUrl": "https://sfapi.sf-express.com",
      "HttpClientName": "SfLegal"
    }
  }
}
配置项 必填 默认值 说明
MonthlyCardNo 顺丰月结卡号
CustomerCode 顾客编码
CheckWord 校验码,参与签名计算
BaseUrl https://sfapi.sf-express.com 顺丰开放平台 API 基地址
HttpClientName SfLegal 命名 HttpClient 名称

注册服务

从 IConfiguration 绑定(推荐)

using Bitzsoft.Integrations.Express.SfLegal;

builder.Services.AddBitzsoftSfLegal(
    builder.Configuration.GetSection("Express:SfLegal"));

委托配置

builder.Services.AddBitzsoftSfLegal(options =>
{
    options.MonthlyCardNo = "your_card_no";
    options.CustomerCode = "your_code";
    options.CheckWord = "your_check_word";
});

请求审计

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

// ① 默认:启用记录管道但不持久化(日志丢弃)
services.AddBitzsoftSfLegal(options => { /* ... */ });

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

使用示例

创建法律函件寄递任务

using Bitzsoft.Integrations.Express.Interfaces;
using Bitzsoft.Integrations.Express.Models;

public class LegalService
{
    private readonly ISfLegalDocumentProvider _provider;

    public LegalService(ISfLegalDocumentProvider provider) => _provider = provider;

    public async Task ShipAsync(ExpressContact sender, ExpressContact receiver)
    {
        var request = new LegalDocumentShipmentRequest
        {
            Sender = sender,
            Receiver = receiver,
            DocumentType = "律师函",
            Title = "催收律师函",
            CaseNumber = "CASE-2026-001"
        };

        LegalDocumentShipmentResult result =
            await _provider.CreateDocumentShipmentAsync(request);
        Console.WriteLine($"函件ID: {result.DocumentId}, 运单号: {result.TrackingNumber}");
    }
}

查询函件寄递状态

LegalDocumentTrackingResult result =
    await _provider.TrackDocumentAsync(documentId);
Console.WriteLine($"状态: {result.Status}, 运单号: {result.TrackingNumber}");

// 确认签收
await _provider.ConfirmReceiptAsync(documentId);

// 获取全流程记录
LegalDocumentFullRecord record = await _provider.GetFullRecordAsync(documentId);
Console.WriteLine($"创建 {record.CreatedTime}, 寄出 {record.SentTime}, 签收 {record.SignedTime}");

核心类型一览

类型 说明
SfLegalDocumentProvider 顺丰函证通实现(ISfLegalDocumentProvider
SfLegalOptions 顺丰函证通配置选项(MonthlyCardNo / CustomerCode / CheckWord / BaseUrl / HttpClientName)
ISfLegalDocumentProvider 法律函件寄递契约(抽象层)
LegalDocumentShipmentRequest 法律函件寄递请求(DocumentType / Title / CaseNumber)
LegalDocumentTrackingResult 寄递状态追踪结果(Status / Traces / SignedTime / SignedBy)
LegalDocumentFullRecord 函件寄递全流程记录(DocumentType / Status / CreatedTime / SentTime)
LegalDocumentStatus 法律函件状态枚举(Created / Pending / Sent / InTransit / Signed / Rejected / Returned / Exception)

支持的操作

方法 API 接口(Service Code) 说明
CreateDocumentShipmentAsync EXP_RECE_CREATE_ORDER 创建法律函件寄递任务
TrackDocumentAsync EXP_RECE_SEARCH_ROUTES 查询函件寄递状态
ConfirmReceiptAsync EXP_RECE_UPDATE_ORDER 确认函件签收
GetFullRecordAsync 基于路由查询组合 获取函件寄递全流程记录

依赖

说明
Bitzsoft.Integrations.Express 抽象层(ISfLegalDocumentProvider 接口与模型)
Bitzsoft.Integrations.Compatibility 基础工具库
Bitzsoft.Integrations.RequestLogging 出站请求记录管道
Microsoft.Extensions.Configuration.Abstractions 配置抽象
Microsoft.Extensions.Http IHttpClientFactory(Typed Client 连接池)
Microsoft.Extensions.Options.ConfigurationExtensions Options 配置节点绑定

注意事项

  • 顺丰函证通具体 API 文档需在 顺丰开放平台 注册并申请服务权限后获取
  • 需绑定月结卡号的 IUOP 账号
  • ISfLegalDocumentProvider 独立注册,可与 IExpressProvider 并存(如顺丰查询 + 函证通寄递)

相关包

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.Express.SfLegal:

Package Downloads
Bitzsoft.Integrations.Express.All

快递物流服务聚合包 — 包含所有供应商实现

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.1 122 8/3/2026
1.0.0 128 8/2/2026
1.0.0-alpha.10 52 7/26/2026
1.0.0-alpha.9 58 7/12/2026
1.0.0-alpha.8 191 7/1/2026
1.0.0-alpha.7 76 6/16/2026
1.0.0-alpha.6 64 6/16/2026
1.0.0-alpha.5 65 6/14/2026
1.0.0-alpha.3 66 6/7/2026