TrustyPay.Crypto.Banks.CMB
0.0.7
.NET 5.0
This package targets .NET 5.0. The package is compatible with this framework or higher.
.NET Core 3.1
This package targets .NET Core 3.1. The package is compatible with this framework or higher.
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package TrustyPay.Crypto.Banks.CMB --version 0.0.7
NuGet\Install-Package TrustyPay.Crypto.Banks.CMB -Version 0.0.7
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.7" />
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.7
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: TrustyPay.Crypto.Banks.CMB, 0.0.7"
#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.7 // Install TrustyPay.Crypto.Banks.CMB as a Cake Tool #tool nuget:?package=TrustyPay.Crypto.Banks.CMB&version=0.0.7
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
招行免前置机接口客户端类
- 从招商银行企业开放平台下载国密算法密钥生成工具;
- 双击运行国密算法密钥生成工具SMKeyTool.exe并点击"生成密钥"按钮;
- 妥善保管好生成的银行公钥/用户公钥/用户私钥/用户对称密钥;
- 将上述的用户公钥和加密版对称密钥保存到招商银行银企直联->设置与授权->密钥设置;
- CmbHttpClient类的使用示例:
using TrustyPay.Crypto;
using TrustyPay.Crypto.Http;
using TrustyPay.Crypto.Banks.CMB;
var config = new Config(
"<用户私钥>",
"<银行公钥>",
"<用户对称密钥>",
"用户编号" // 用户编号来自招行企业网银后台设置的用户[U盾编号],此用户需要有相应的接口调用权限。
);
var client = new CmbHttpClient(
"https://招商银行接口生产地址/测试接口地址",
config);
SubaccountBalanceResult result;
try
{
result = await client.PostAsync<SubaccountBalanceResult>(
string.Empty,
new SubaccountBalanceQuery("用户招行账号", "记账子单元编号", "续传字段"),
System.Threading.CancellationToken.None);
}
catch (InvalidSignatureException se)
{
Console.WriteLine("signature is incorrect!!!");
return;
}
catch (HttpResponseException re)
{
Console.WriteLine(re.Message);
return;
}
- 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; }
}
}
- 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 | Versions 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. |
.NET Core | netcoreapp3.1 is compatible. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
.NETCoreApp 3.1
- Newtonsoft.Json (>= 13.0.1)
- TrustyPay.Crypto (>= 0.0.7)
-
net5.0
- Newtonsoft.Json (>= 13.0.1)
- TrustyPay.Crypto (>= 0.0.7)
-
net6.0
- Newtonsoft.Json (>= 13.0.1)
- TrustyPay.Crypto (>= 0.0.7)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.