TrustyPay.Crypto.Banks.CMB 0.0.3

There is a newer version of this package available.
See the version list below for details.
dotnet add package TrustyPay.Crypto.Banks.CMB --version 0.0.3
NuGet\Install-Package TrustyPay.Crypto.Banks.CMB -Version 0.0.3
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="TrustyPay.Crypto.Banks.CMB" Version="0.0.3" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add TrustyPay.Crypto.Banks.CMB --version 0.0.3
#r "nuget: TrustyPay.Crypto.Banks.CMB, 0.0.3"
#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.
// Install TrustyPay.Crypto.Banks.CMB as a Cake Addin
#addin nuget:?package=TrustyPay.Crypto.Banks.CMB&version=0.0.3

// Install TrustyPay.Crypto.Banks.CMB as a Cake Tool
#tool nuget:?package=TrustyPay.Crypto.Banks.CMB&version=0.0.3

招行免前置机接口客户端类

  1. 下载招行国密算法密钥生成工具
  2. 运行SMKeyTool.exe程序并点击"生成密钥"按钮
  3. 保存好银行公钥/用户公钥/用户私钥/用户对称密钥
  4. CmbHttpClient类的使用示例:
    using System.Net.Http;
    using TrustyPay.Crypto;

    var config = new Config(
        "<用户私钥>",
        "<银行公钥>",
        "<用户对称密钥>",
        "用户编号" // 用户编号来自招行企业网银后台设置的用户编号,需要有相应的权限,用于调用云直联接口。
    );

    var client = new CmbHttpClient(
        "https://招行生产/测试接口地址",
        config);

    try
    {
        return await client.PostAsync<SubaccountBalanceQuery, SubaccountBalanceResult>(
            string.Empty,
            new SubaccountBalanceQuery("用户招行账号", "记账子单元编号", "续传字段"),
            System.Threading.CancellationToken.None);
    }
    catch (InvalidSignatureException se)
    {
        throw;
    }
    catch (HttpRequestException se)
    {
        throw;
    }

  1. SubaccountBalanceQuery类定义:
    using Newtonsoft.Json;
    using TrustyPay.Crypto.Banks.CMB;

    public class SubaccountBalanceQuery : IFunctionCode
    {
        [JsonProperty("ntdmabalx")]
        public AccountInfo[] Account { get; set; }

        public string FuncCode => "NTDMABAL";

        public SubaccountBalanceQuery(
            string account,
            string subaccount,
            string nextLink)
        {
            Account = new[]{
                new AccountInfo
                {
                    Account = account,
                    Subaccount = subaccount,
                    NextLink = nextLink
                }
            };
        }

        public class AccountInfo
        {
            [JsonProperty("accnbr")]
            public string Account { get; set; }

            [JsonProperty("dmanbr")]
            public string Subaccount { get; set; }

            [JsonProperty("ctnkey")]
            public string NextLink { get; set; }
        }
    }
  1. SubaccountBalanceResult类定义:
    using Newtonsoft.Json;

    public class SubaccountBalanceResult
    {
        [JsonProperty("ntdmabalx")]
        public AccountInfo[] Account { get; set; }

        [JsonProperty("ntdmabalz")]
        public BalanceItem[] Balances { get; set; }

        public class AccountInfo
        {
            [JsonProperty("accnbr")]
            public string Account { get; set; }
            [JsonProperty("dmanbr")]
            public string Subaccount { get; set; }
            [JsonProperty("rsv50z")]
            public string NextLink { get; set; }
        }

        public class BalanceItem
        {
            [JsonProperty("accnbr")]
            public string Account { get; set; }

            [JsonProperty("dmanbr")]
            public string Subaccount { get; set; }

            [JsonProperty("dmanam")]
            public string SubaccountName { get; set; }

            [JsonProperty("dmaccy")]
            public string Currency { get; set; }

            [JsonProperty("eftdat")]
            public string EffectDate { get; set; }

            [JsonProperty("actbal")]
            public decimal Balance { get; set; }

            [JsonProperty("stscod")]
            public string Status { get; set; }

            [JsonProperty("mthaub")]
            public string Points { get; set; }
        }
    }
Product Compatible and additional computed target framework versions.
.NET net5.0 is compatible.  net5.0-windows was computed.  net6.0 is compatible.  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 was computed.  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. 
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
0.0.8 501 7/21/2022
0.0.7 389 7/20/2022
0.0.6 379 7/15/2022
0.0.4 414 6/25/2022
0.0.3 386 6/10/2022
0.0.2 378 6/6/2022
0.0.1 384 6/1/2022