TrustyPay.Crypto.Banks.ICBC
0.0.4
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.ICBC --version 0.0.4
NuGet\Install-Package TrustyPay.Crypto.Banks.ICBC -Version 0.0.4
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.ICBC" Version="0.0.4" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add TrustyPay.Crypto.Banks.ICBC --version 0.0.4
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: TrustyPay.Crypto.Banks.ICBC, 0.0.4"
#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.ICBC as a Cake Addin #addin nuget:?package=TrustyPay.Crypto.Banks.ICBC&version=0.0.4 // Install TrustyPay.Crypto.Banks.ICBC as a Cake Tool #tool nuget:?package=TrustyPay.Crypto.Banks.ICBC&version=0.0.4
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
工行接口客户端类
e企付客户端类
EPayHttpClient类的使用示例:
using TrustyPay.Crypto.Banks.ICBC; var client = new EPayHttpClient( "https://工行接口生产地址", new EPayConfig() { AppId = "<用户e企付AppId>", PublicKeyFromBank = "<工行公钥>".FromBase64(), PrivateKey = "<用户e企付私钥>".FromBase64() }); try { var result = await client.PostAsync<OrderResult>( "/api/mybank/pay/cpay/cporderquery/V1", new OrderQuery( "<用户协议编号>", "<order code>", "<partner seq>" ) ); } catch (InvalidSignatureException se) { Console.WriteLine("signature is incorrect!!!"); return; } catch (HttpResponseException re) { Console.WriteLine("some errors occured!!!"); return; }
OrderQuery类定义:
using Newtonsoft.Json; using TrustyPay.Crypto.Banks.ICBC; public class OrderQuery : IMessageIdentity { public OrderQuery(string argeeCode, string orderCode, string seq) { ArgeeCode = argeeCode; OrderCode = orderCode; PartnerSeq = seq; } [JsonProperty("agreeCode")] public string ArgeeCode { get; set; } [JsonProperty("orderCode")] public string OrderCode { get; set; } [JsonProperty("partnerSeq")] public string PartnerSeq { get; set; } public string MessageId { get; set; } = Guid.NewGuid().ToString("N"); }
OrderResult类定义:
using Newtonsoft.Json; using TrustyPay.Crypto.Banks.ICBC; public class OrderResult : ResultObjectBase { [JsonProperty("orderCurr")] public string Currency { get; set; } [JsonProperty("goodsList")] public JObject[] Goods { get; set; } }
e钱包客户端类
EWalletHttpClient类的使用示例:
using TrustyPay.Crypto.Banks.ICBC; var client = new EWalletHttpClient( "https://工行接口生产地址", new EWalletConfig() { AppId = "<用户e钱包AppId>", PublicKeyFromBank = "<工行公钥>".FromBase64(), PrivateKey = "<用户e钱包私钥>".FromBase64(), SM2PrivateKey = "<用户sm2私钥>".FromHex(), SM2PublicKeyFromBank = "<工行e钱包sm2公钥>".FromHex() }); try { var result = await client.PostAsync<WalletBalanceResult>( "/api/settlement/account/balance/V1/query", new WalletBalanceQuery { CorpNumber = "<用户e钱包AppId>", TxDate = DateTime.Now.ToString("yyyy-MM-dd"), TxTime = DateTime.Now.ToString("HH:mm:ss"), CorpDate = DateTime.Now.ToString("yyyy-MM-dd"), SerialNumber = Guid.NewGuid().ToString("N"), MediumId = "<e钱包卡号>", } ); } catch (InvalidSignatureException se) { Console.WriteLine("signature is incorrect!!!"); return; } catch (HttpResponseException re) { Console.WriteLine("some errors occured!!!"); return; }
WalletBalanceQuery类定义:
using Newtonsoft.Json; using TrustyPay.Crypto.Http; using TrustyPay.Crypto.Banks.ICBC; public class WalletBalanceQuery : ISecretKey { /// <summary> /// 合作方机构编号 /// </summary> [JsonProperty("corp_no")] public string CorpNumber { get; set; } /// <summary> /// 合作方交易日期 2017-03-02 /// </summary> [JsonProperty("trx_acc_date")] public string TxDate { get; set; } /// <summary> /// 合作方交易时间 10:38:01 /// </summary> [JsonProperty("trx_acc_time")] public string TxTime { get; set; } /// <summary> /// 合作方工作日期 /// </summary> [JsonProperty("corp_date")] public string CorpDate { get; set; } /// <summary> /// 合作方交易单号 /// </summary> [JsonProperty("corp_serno")] public string SerialNumber { get; set; } /// <summary> /// 外部服务代码 /// </summary> [JsonProperty("out_service_code")] public string ServiceCode { get; set; } = "querybalance"; /// <summary> /// 工行联名卡号(支持加密传输,Base64编码) /// </summary> [JsonProperty("medium_id")] [Encryption] public string MediumId { get; set; } /// <summary> /// 币种 /// </summary> [JsonProperty("ccy")] public int Currency { get; set; } = 1; /// <summary> /// sm4对称密钥 /// </summary> [JsonProperty("secret_key")] public string SecretKey { get; set; } /// <summary> /// 卡号哈希值 /// </summary> [JsonProperty("medium_id_hash")] public string MediumIdHash { get; set; } }
WalletBalanceResult类定义:
using Newtonsoft.Json; using TrustyPay.Crypto.Http; using TrustyPay.Crypto.Banks.ICBC; public class WalletBalanceResult : ResultObjectBase, ISecretKey { [JsonProperty("account_balance")] public string Balance { get; set; } [JsonProperty("medium_status")] public string Status { get; set; } [JsonProperty("cust_name")] [Encryption] public string CustomerName { get; set; } [JsonProperty("secret_key")] public string SecretKey { 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. 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. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net5.0
- Newtonsoft.Json (>= 13.0.1)
- TrustyPay.Crypto (>= 0.0.4)
-
net6.0
- Newtonsoft.Json (>= 13.0.1)
- TrustyPay.Crypto (>= 0.0.4)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.