Galosys.Foundation.Wechat 26.8.13.2

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

Galosys.Foundation.Wechat

成熟度: 🟡 可用 — 微信支付通道适配器,手搓 V3 API + RSA-SHA256 签名

微信支付通道模块,实现 IPaymentChannelIBillNormalizer,基于微信支付 APIv3 手搓实现(无第三方 SDK 依赖)。

功能特性

  • 支付能力 — JSAPI、Native、H5、APP 四种支付方式
  • 订单操作 — 创建/查询/退款/关闭/回调验签(AES-256-GCM 解密)
  • 账单拉取PullBillFileAsync 拉取微信交易账单(gzip/AES 加密 CSV)
  • 账单标准化WechatBillNormalizer 将原始 CSV 转换为统一 NormalizedBillDto(分转元、退款拆子行)
  • 签名/验签WechatPayV3Signer(WECHATPAY2-SHA256-RSA2048)、WechatPayNotifyVerifier

安装

<PackageReference Include="Galosys.Foundation.Wechat" Version="x.x.x" />

快速开始

1. 注册服务

// 模块自动发现(推荐)—— WechatModule 自动注册
// WechatPayChannel + WechatBillNormalizer 均已注册

配置 appsettings.json

{
  "Wechat": {
    "Pay": {
      "AppId": "your_app_id",
      "MchId": "your_mch_id",
      "ApiKey": "your_api_v3_key",
      "SerialNo": "your_cert_serial_no",
      "PrivateKeyPath": "path/to/apiclient_key.pem",
      "PlatformCertPath": "path/to/platform_cert.pem",
      "NotifyUrl": "https://example.com/notify"
    }
  }
}

2. 创建支付(JSAPI)

using Galosys.Foundation.Integration.Payment.Abstractions;

// 通过 IPaymentDispatcher 路由到 Wechat
var result = await dispatcher.PayAsync(new PaymentCreateRequest
{
    Channel = "wechat",
    OutTradeNo = "ORD001",
    Amount = 99.9m,
    Subject = "测试订单",
    PaymentType = PaymentType.JsApi,
    OpenId = "user_openid"
});

3. 拉取账单

var channel = new WechatPayChannel(...); // 实际通过 DI 获取 IPaymentChannel
var raw = await channel.PullBillFileAsync(new BillPullRequest(
    BillDate: "2024-01-20",
    Type: BillType.Trade));

// 通过 IBillNormalizer 标准化(自动处理分转元、退款拆子行)
var normalizer = new WechatBillNormalizer();
var bills = await normalizer.NormalizeAsync(raw);
// bills[0].TotalAmount = 1.00  ← 微信原始 100 分自动转为 1 元

依赖

  • Galosys.Foundation.Integration.Payment.Abstractions — IPaymentChannel、IBillNormalizer
  • Galosys.Foundation.Core — PluginRegistry、IModule
  • Galosys.Foundation.Notification — WechatNotificationProvider
Product Compatible and additional computed target framework versions.
.NET 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

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
26.8.13.2 39 8/13/2026
26.8.13.1 40 8/13/2026
26.8.12.2 40 8/12/2026
26.8.12.1 43 8/12/2026
26.8.10.1 84 8/10/2026
26.8.5.1 90 8/5/2026
26.8.4.1 105 8/4/2026
26.8.3.1 101 8/3/2026
26.7.31.1 101 7/31/2026
26.7.30.1 96 7/30/2026
26.7.29.1 100 7/29/2026
26.7.28.1 97 7/28/2026
26.7.26.2 98 7/26/2026
26.7.26.1 100 7/25/2026
26.7.25.1 97 7/25/2026
26.7.24.2 97 7/24/2026
26.7.24.1 100 7/24/2026
26.7.22.1 107 7/23/2026
26.7.21.1 105 7/22/2026
26.7.20.2 98 7/20/2026
Loading failed