Refresh.imohsenb.iso8583
2.3.1
dotnet add package Refresh.imohsenb.iso8583 --version 2.3.1
NuGet\Install-Package Refresh.imohsenb.iso8583 -Version 2.3.1
<PackageReference Include="Refresh.imohsenb.iso8583" Version="2.3.1" />
paket add Refresh.imohsenb.iso8583 --version 2.3.1
#r "nuget: Refresh.imohsenb.iso8583, 2.3.1"
// Install Refresh.imohsenb.iso8583 as a Cake Addin #addin nuget:?package=Refresh.imohsenb.iso8583&version=2.3.1 // Install Refresh.imohsenb.iso8583 as a Cake Tool #tool nuget:?package=Refresh.imohsenb.iso8583&version=2.3.1
ISO-8583 .Net Lib
ISO8583 Message Packer and Unpakcer with ISOClient for communication with iso server
A lightweight ISO8583 (is an international standard for financial transaction card originated interchange messaging - wikipedia ) library for DotNet based on builder pattern and provide very simple use as you will see later.
Usage
Library is available in Nuget
ISOMessage
Create and pack an ISO message
To create an ISO message you must use ISOMessageBuilder which produce iso message for you:
ISOMessage isoMessage = ISOMessageBuilder.Packer(VERSION.V1987)
.NetworkManagement()
.MTI(MESSAGE_FUNCTION.Request, MESSAGE_ORIGIN.Acquirer)
.ProcessCode("930000")
.SetField(FIELDS.F11_STAN, "385629")
.SetField(FIELDS.F22_EntryMode, "1234")
.SetField(FIELDS.F24_NII_FunctionCode, "4321")
.SetField(FIELDS.F25_POS_ConditionCode, "12")
.SetField(FIELDS.F41_CA_TerminalID, "12345678")
.SetField(FIELDS.F42_CA_ID, "123456789876543")
.GenerateMac(data => {
byte[] mac = MacCalculator(data);
return mac;
})
.SetHeader("1234567890")
.Build();
with ISOMessageBuilder.Packer(VERSION.V1987)
you can build iso message as you can see above. the 'Packer' method return 8 method for 8 iso message class (authorization, financial, networkManagment, ...) based on ISO8583 after that you can set message function and message origin by MTI
method.
MTI
method accept string and enums as parameter, and I think enums are much clear and readable.
As you know an iso message need a 'Processing Code' and you can set it's value by ProcessCode
method, and then we can start setting required fields by SetField
method and accept String and enums as field number parameter.
After all, you must call build method to generate iso message object.
Unpack a buffer and parse it to ISO message
For unpacking a buffer received from server you need to use ISOMessageBuilder.Unpacker()
:
ISOMessage isoMessage = ISOMessageBuilder.Unpacker()
.SetMessage(SAMPLE_HEADER + SAMPLE_MSG)
.Build();
Working with ISOMessage object
ISOMessage object has multiple method provide fields, message body, header and ...
for security reason they will return byte array exept .ToString
and .GetStringField
method, because Strings stay alive in memory until a garbage collector will come to collect that. but you can clear byte or char arrays after use and calling garbage collector is not important anymore.
If you use Strings, taking memory dumps will be dangerous.
byte[] body = isoMessage.GetBody();
byte[] trace = isoMessage.GetField(11);
string trace = isoMessage.GetStringField(FIELDS.F11_STAN);
ISOClient
Sending message to iso server
Sending message to iso server and received response from server can be done with ISOClient in many ways:
IISOClient client = ISOClientBuilder.CreateSocket(HOST, PORT)
.Build();
ISOMessage respIso = client.SendMessageSync(reqIso);
client.Disconnect();
License
Copyright 2018 Mohsen Beiranvand
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Product | Versions 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 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 | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 is compatible. |
.NET Framework | net46 is compatible. net461 was computed. net462 was computed. net463 was computed. net47 is compatible. net471 was computed. net472 was computed. net48 is compatible. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETFramework 4.6
- ISO8583 (>= 6.0.0)
- Microsoft.NETCore.Platforms (>= 5.0.2)
- RefreshOpenIso8583Net (>= 1.2.6)
-
.NETFramework 4.7
- ISO8583 (>= 6.0.0)
- Microsoft.NETCore.Platforms (>= 5.0.2)
- RefreshOpenIso8583Net (>= 1.2.6)
-
.NETFramework 4.8
- ISO8583 (>= 6.0.0)
- Microsoft.NETCore.Platforms (>= 5.0.2)
- RefreshOpenIso8583Net (>= 1.2.6)
-
.NETStandard 2.0
- ISO8583 (>= 6.0.0)
- Microsoft.NETCore.Platforms (>= 5.0.2)
- RefreshOpenIso8583Net (>= 1.2.6)
-
.NETStandard 2.1
- ISO8583 (>= 6.0.0)
- Microsoft.NETCore.Platforms (>= 5.0.2)
- RefreshOpenIso8583Net (>= 1.2.6)
-
net5.0
- ISO8583 (>= 6.0.0)
- Microsoft.NETCore.Platforms (>= 5.0.2)
- RefreshOpenIso8583Net (>= 1.2.6)
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 |
---|---|---|
2.3.1 | 457 | 8/6/2021 |
Added Net5 Target Framework Support;
Remove Net Framework4.5;
Added Send Byte To Networks;