private string GetErrorResponse(string[] DE, string msg) { //whatever Iso Operation passed, We change the 3 char in MTI //to 1 to indicate response string MTI = DE[129]; char[] array = MTI.ToCharArray(); array[2] = '1'; MTI = new string(array); string response = ""; //2.Create an object BIM-ISO8583.ISO8583 BIM_ISO8583.NET.ISO8583 Buildiso8583 = new BIM_ISO8583.NET.ISO8583(); //3. Create Arrays string[] ResponseDE = new string[130]; //4. Assign corresponding data to each array // Ex: ISO8583 Data Element No.2 (PAN) shall assign to newly created array, DE[2]; ResponseDE[39] = "06"; //Error flag for ISO 8583 ResponseDE[47] = msg; //Error msg ResponseDE[48] = ""; ResponseDE[49] = DE[11]; //Request Id //5.Use "Build" method of object iso8583 to create a new message. response = Buildiso8583.Build(ResponseDE, MTI); return(response); }
public void TestISO8583Message() { string MTI = "0200"; BIM_ISO8583.NET.ISO8583 iso8583 = new BIM_ISO8583.NET.ISO8583(); string[] DE = new string[130]; DE[22] = "021"; //DE[32] = "437586002"; string NewISOmsg = iso8583.Build(DE, MTI); string test = "0200323a448128e21881013000000000"; test += "00200001090438520005961538520109"; test += "01095811002141080043758637518868"; test += "0100002858d15122015301010540000f"; test += "35303039313533383035393653393231"; test += "38313633343337353836303030202020"; test += "202020383030204c414e47444f4e2053"; test += "542c202020202020202020204d414449"; test += "534f4e20202020202041553032385443"; test += "4330315c45464330303030303030305c"; test += "434349305c46424b565cab702f27a85e"; test += "87130000000000000001000000000000"; test += "cf74bdce00000000"; string[] decode = iso8583.Parse(test); }
private string ReturnOperationNotSupportedError(string[] DE) { //whatever ISO Operation passed, We change the 3rd character in MTI //to 1 to indicate response string MTI = DE[129]; char[] array = MTI.ToCharArray(); array[2] = '1'; MTI = array.ToString(); string response = ""; //2.Create an object BIM-ISO8583.ISO8583 BIM_ISO8583.NET.ISO8583 Buildiso8583 = new BIM_ISO8583.NET.ISO8583(); //3. Create Arrays string[] ResponseDE = new string[130]; //4. Assign corresponding data to each array // Ex: ISO8583 Data Element No.2 (PAN) shall assign to newly created array, DE[2]; ResponseDE[39] = "06"; //Error flag for ISO 8583 ResponseDE[47] = "THIS_ISO_OPERATION_IS_NOT_YET_SUPPORTED_AT_PEGPAY"; //Error msg ResponseDE[48] = ""; ResponseDE[49] = DE[11]; //Request Id //5.Use "Build" method of object iso8583 to create a new message. response = Buildiso8583.Build(ResponseDE, MTI); return(response); }
private static void TestGetMiniStatement() { Socket clientSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); clientSocket.Connect("127.0.0.1", 4128); BIM_ISO8583.NET.ISO8583 Parseiso8583 = new BIM_ISO8583.NET.ISO8583(); string HexISOMessage = GetISO8583MiniStatementMessageToSend(); Console.WriteLine("ISO 8583 Request:" + HexISOMessage); byte[] outStream = Encoding.UTF8.GetBytes(HexISOMessage); clientSocket.Send(outStream); byte[] inStream = new byte[100025]; int result = clientSocket.Receive(inStream); string returndata = Encoding.UTF8.GetString(inStream, 0, result); Console.WriteLine("Response:" + returndata); string[] DE = new string[130]; DE = Parseiso8583.Parse(returndata); string[] lines = DE[125].Split('|'); string statusCode = DE[39]; string StatusDesc = DE[47]; string PegPayId = DE[48]; Console.Read(); }
public static string GetISO8583ReversalMessageToSend() { string MTI = "0400"; string ToAccount = ""; //DE[103] string FromAccount = ""; //DE[102] string TranAmount = ""; //DE[4] string BankTranId = "9095"; //DE[11] string PaymentDate = ""; //DE[7] (format: MMDDhhmmss) string Teller = "Pegasus"; //DE[42] string ApprovedBy = "Mr.Ronald"; //DE[61] string BankCode = "12345"; //DE[2]----NO string Narration = ""; //DE[104]----ans100 string Password = "******"; //DE[47] string DigitalSignature = "kjhgfdyuioplkjbvgvhok2kj3h454j32k3j45v6b543mnb4345h65434554n"; //DE[46] string TranCategory = "="; //DE[48] string BranchCode = "="; //DE[43] string CurrencyCode = ""; //DE[49] string CustomerName = ""; string PaymentType = ""; string ChequeNumber = ""; //2.Create an object BIM-ISO8583.ISO8583 BIM_ISO8583.NET.ISO8583 Buildiso8583 = new BIM_ISO8583.NET.ISO8583(); //3. Create Arrays string[] DE = new string[130]; //4. Assign corresponding data to each array // Ex: ISO8583 Data Element No.2 (PAN) shall assign to newly created array, DE[2]; DE[103] = ToAccount; DE[102] = FromAccount; DE[4] = TranAmount; DE[11] = BankTranId; DE[7] = "0429104720"; DE[73] = PaymentDate; DE[42] = Teller; DE[62] = ApprovedBy; DE[2] = BankCode; DE[104] = Narration; DE[47] = Password; DE[46] = DigitalSignature; DE[48] = TranCategory; DE[43] = BranchCode; DE[49] = CurrencyCode; DE[41] = PaymentType; DE[56] = CustomerName; DE[61] = ChequeNumber; //5.Use "Build" method of object iso8583 to create a new message. //60197105032103634 string NewISOmsg = Buildiso8583.Build(DE, MTI); return(NewISOmsg); }
private static string GetISO8583EchoMessageToSend() { BIM_ISO8583.NET.ISO8583 Parseiso8583 = new BIM_ISO8583.NET.ISO8583(); string echoRequest = ""; string MTI = "0800"; string echo = "309"; string[] DE = new string[130]; DE[70] = echo; echoRequest = Parseiso8583.Build(DE, MTI); return(echoRequest); }
public string ProcessRequest(string content) { string response = ""; try { //4. <<< Use "Parse" method of object iso8583. >>> BIM_ISO8583.NET.ISO8583 Parseiso8583 = new BIM_ISO8583.NET.ISO8583(); string[] DE = Parseiso8583.Parse(content); PrintIsoMessage(DE); string MTI = DE[129]; switch (MTI) { case "0200": response = DoTransactOperation(DE); break; case "0400": response = DoReversalOperation(DE); break; case "0800": response = DoEchoOperation(DE); break; case "0100": response = DoAccountInquiryOperation(DE); break; case "0500": response = DoGetMiniStatementOperation(DE); break; default: response = ReturnOperationNotSupportedError(DE); break; } } catch (Exception ex) { response = InvalidISOformatErrorMessage(); } return(response); }
private string InvalidISOformatErrorMessage() { string MTI = "0610"; string response = ""; //2.Create an object BIM-ISO8583.ISO8583 BIM_ISO8583.NET.ISO8583 Buildiso8583 = new BIM_ISO8583.NET.ISO8583(); //3. Create Arrays string[] ResponseDE = new string[130]; //4. Assign corresponding data to each array // Ex: ISO8583 Data Element No.2 (PAN) shall assign to newly created array, DE[2]; ResponseDE[39] = "96"; //Error flag for ISO 8583 ResponseDE[47] = "INVALID ISO MESSAGE FORMAT"; //Error msg ResponseDE[48] = ""; ResponseDE[49] = ""; //Request Id //5.Use "Build" method of object iso8583 to create a new message. response = Buildiso8583.Build(ResponseDE, MTI); return(response); }
private string GetFinicialOpFailureResponse(TransactionRequest tran, Result result) { string response = ""; string MTI = "0210"; //2.Create an object BIM-ISO8583.ISO8583 BIM_ISO8583.NET.ISO8583 Buildiso8583 = new BIM_ISO8583.NET.ISO8583(); //3. Create Arrays string[] ResponseDE = new string[130]; //4. Assign corresponding data to each array // Ex: ISO8583 Data Element No.2 (PAN) shall assign to newly created array, DE[2]; ResponseDE[39] = GetIso8583ResponseCode(tran.StatusDesc);//Error flag for ISO 8583 ResponseDE[47] = result.StatusDesc; ResponseDE[48] = result.PegPayId; ResponseDE[49] = result.RequestId; //5.Use "Build" method of object iso8583 to create a new message. response = Buildiso8583.Build(ResponseDE, MTI); return(response); }
private string GetAccountBalSuccessResponse(BankAccount account, string AccountNumber) { string response = ""; string MTI = "0110"; //2.Create an object BIM-ISO8583.ISO8583 BIM_ISO8583.NET.ISO8583 Buildiso8583 = new BIM_ISO8583.NET.ISO8583(); //3. Create Arrays string[] ResponseDE = new string[130]; //4. Assign corresponding data to each array // Ex: ISO8583 Data Element No.2 (PAN) shall assign to newly created array, DE[2]; ResponseDE[39] = "00"; ResponseDE[47] = account.StatusDesc; ResponseDE[48] = account.AccountBalance; ResponseDE[49] = AccountNumber; //5.Use "Build" method of object iso8583 to create a new message. response = Buildiso8583.Build(ResponseDE, MTI); return(response); }
private string ReturnMiniStatementSuccessResponse(BankAccountStatement state, string AccountNumber) { string response = ""; string MTI = "0510"; //2.Create an object BIM-ISO8583.ISO8583 BIM_ISO8583.NET.ISO8583 Buildiso8583 = new BIM_ISO8583.NET.ISO8583(); //3. Create Arrays string[] ResponseDE = new string[130]; //4. Assign corresponding data to each array // Ex: ISO8583 Data Element No.2 (PAN) shall assign to newly created array, DE[2]; ResponseDE[39] = "00";//success response code ResponseDE[47] = state.StatusDesc; ResponseDE[48] = ""; ResponseDE[125] = GetStatementString(state); //5.Use "Build" method of object iso8583 to create a new message. response = Buildiso8583.Build(ResponseDE, MTI); return(response); }
private string DoEchoOperation(string[] DE) { string response = ""; string MTI = "0810"; try { string echo = DE[70]; if (!string.IsNullOrEmpty(echo)) { BIM_ISO8583.NET.ISO8583 echoResponse = new BIM_ISO8583.NET.ISO8583(); response = echoResponse.Build(DE, MTI); } else { response = ReturnOperationNotSupportedError(DE); } } catch (Exception ex) { response = GetErrorResponse(DE, ex.Message); } return(response); }
public static string getISOData() { string MTI = "0800"; //2.Create an object BIM-ISO8583.ISO8583 BIM_ISO8583.NET.ISO8583 iso8583 = new BIM_ISO8583.NET.ISO8583(); //3. Create Arrays string[] DE = new string[130]; //4. Assign corresponding data to each array // Ex: ISO8583 Data Element No.2 (PAN) shall assign to newly created array, DE[2]; DE[7] = "0411123431"; DE[11] = "000032"; DE[37] = "810112000029"; DE[70] = "071"; //5.Use "Build" method of object iso8583 to create a new message. string NewISOmsg = iso8583.Build(DE, MTI); string lengths = NewISOmsg.Length.ToString(); return(NewISOmsg); }