Beispiel #1
0
        public void testNoField48()
        {
            Iso8583TermApp msg = new Iso8583TermApp();

            Assert.IsFalse(msg.IsFieldSet(Iso8583Rev93.Bit._048_PRIVATE_ADDITIONAL_DATA));
            Assert.IsNull(msg.StructuredData);
        }
        public void UnpackEmv()
        {
            var data = Formatters.Binary.GetBytes("4231323130723404102FC5860031363437363137333930303130313031313930303030303030303030303030303039303030333037313130393337303030303031313430333037313130393337313531323531303130313532313134383130313134303330363334343736313733393030313031303131393D31353132323031313735383938393338393030303030303031323732333030323836303030303230313838373737373137383837373737312020202020202020303638303034303443303030303030303030303030303030304430303030303030303030303031343034433030303030303030303030303030303044303030303030303030303030323538F000FFC241383837373737313730303030303120202020203131544149534F537263312020204232344B656E796120202020303030303031303030303031426172636C617973544772705030313739323138506F7374696C696F6E3A4D657461446174613231363231304261736532344461746131313132313042617365323444617461333132323C3F786D6C2076657273696F6E3D22312E302220656E636F64696E673D225554462D38223F3E203C426173653234446174613E3C52657472696576616C5265664E723E3C446174613E3030303030303031323732333C2F446174613E3C2F52657472696576616C5265664E723E3C2F426173653234446174613e3430343032303030353334303444303030303030303030393030303135ff210c910af116e7b6a9135ba23030");
            var rsp  = new Iso8583TermApp(data);

            Assert.AreEqual(Iso8583TermApp.MsgType._1210_TRAN_REQ_RSP, rsp.MessageType);
            Assert.AreEqual("FF210C910AF116E7B6A9135BA23030", rsp[55]);
        }
        public void UnpackMac()
        {
            var data =
                Formatters.Binary.GetBytes(
                    "4231323130723404102FC5860131363437363137333930303130313030333630303030303030303030303030303039303030363330313035363139303030303031313430363330313135363139313531323531303130313531313134383130313134303330363334343736313733393030313031303033363D31353132323031313138343430343838393030303030303031373838343030333733383030303230313838373737373137383837373737312020202020202020303638303034303443303030303030303030303030303030304430303030303030303030303031343034433030303030303030303030303030303044303030303030303030303030323538F000FFC241383837373737313730303030303120202020203131544149534F537263312020204232344B656E796120202020303030303031303030303031426172636C617973544772705030313739323138506F7374696C696F6E3A4D657461446174613231363231304261736532344461746131313132313042617365323444617461333132323C3F786D6C2076657273696F6E3D22312E302220656E636F64696E673D225554462D38223F3E203C426173653234446174613E3C52657472696576616C5265664E723E3C446174613E3030303030303031373838343C2F446174613E3C2F52657472696576616C5265664E723E3C2F426173653234446174613E3430343032303030353334303444303030303030303030393030303135FF210C910A63F160DA6CCF601430304435453430373130");
            var rsp = new Iso8583TermApp(data);

            Assert.AreEqual("4435453430373130", rsp[Iso8583TermApp.Bit._064_MAC]);
        }
Beispiel #4
0
        public void testField48NoF16()
        {
            Iso8583TermApp msg     = new Iso8583TermApp();
            AdditionalData addData = new AdditionalData();

            addData.Add(AdditionalData.Field.PosData, "123456");
            msg.AdditionalData = addData;
            Assert.IsTrue(msg.IsFieldSet(Iso8583Rev93.Bit._048_PRIVATE_ADDITIONAL_DATA));
            Assert.IsNull(msg.StructuredData);
        }
Beispiel #5
0
        public void testPutStructuredDataEmtpy()
        {
            Iso8583TermApp   msg = new Iso8583TermApp();
            HashtableMessage sd  = new HashtableMessage();

            sd["PSI"]          = "V";
            msg.StructuredData = sd;
            AdditionalData addData = msg.AdditionalData;

            Assert.AreEqual("13PSI11V", addData[AdditionalData.Field.StructuredData]);
        }
Beispiel #6
0
        public void testGetStructuredData()
        {
            Iso8583TermApp msg     = new Iso8583TermApp();
            AdditionalData addData = new AdditionalData();

            addData.Add(AdditionalData.Field.StructuredData, "13PSI11V");
            msg.AdditionalData = addData;
            Assert.IsTrue(msg.IsFieldSet(Iso8583Rev93.Bit._048_PRIVATE_ADDITIONAL_DATA));
            Assert.IsNotNull(msg.StructuredData);
            Assert.AreEqual("V", msg.StructuredData["PSI"]);
        }
Beispiel #7
0
        public void TestMessagePack()
        {
            var expected = "423132303000000000020008003636363038FFFFDDDDEEEECCCC";
            var msg      = new Iso8583TermApp();

            msg.MessageType = Iso8583Rev93.MsgType._1200_TRAN_REQ;
            msg[Iso8583Rev93.Bit._039_ACTION_CODE]   = "666";
            msg[Iso8583Rev93.Bit._053_SECURITY_INFO] = "FFFFDDDDEEEECCCC";
            byte[] bytes  = msg.ToMsg();
            var    actual = Formatters.Binary.GetString(bytes);

            Assert.AreEqual(expected, actual);
        }
        public void testAdminMessageUnpack()
        {
            String msgStr = "4231363134723000100AC58000313632303038333831323334353637383930393130303030303030303030303030303030303132303039303330333030303031373134303132303131303330333133313032393030303030303030333530333030303838373737373132383837373737312020202020202020303638303034303443303030303030303030303030303030304430303030303030303030303031343034433030303030303030303030303030303044303030303030303030303030303738F0004BD20038383737373731323030303031372020202020313135303031546169537263202020202020416662536E6B20202020202030303030313730303332343341666247726F757020202020343034";

            byte[]         msgData = Formatters.Binary.GetBytes(msgStr);
            Iso8583TermApp msg     = new Iso8583TermApp(msgData);

            Assert.IsTrue(msg.IsFieldSet(Iso8583TermApp.Bit._048_PRIVATE_ADDITIONAL_DATA));
            AdditionalData addData = msg.AdditionalData;

            Assert.IsNotNull(addData);
            Assert.AreEqual("5001", addData[AdditionalData.Field.ExtendedTranType]);
        }
Beispiel #9
0
        public void PackIccData()
        {
            Iso8583TermApp msg = new Iso8583TermApp();

            msg.MessageType = Iso8583TermApp.MsgType._1200_TRAN_REQ;
            msg[Iso8583TermApp.Bit._011_SYS_TRACE_AUDIT_NUM] = "123456";

            msg[Iso8583TermApp.Bit._055_ICC_DATA] = "FF208201139F400C3030303030303030303930309F2610354134373043413041434439453733368204354330309F0704464630309F3604303030315F201A56495341204143515549524552205445535420434152442032359F34063145303330309F27023830840E41303030303030303033313031309F060E41303030303030303033313031309F0D0A463034303030383830309F0E0A303031303030303030309F0F0A463034303030393830309F100E30363031304130334130303030305F2804303834305F34009F120F4352454449544F204445205649534199009F33064530423043389F1A04303732349F090A303030303030383030305F2A04303937389A063134303330359C0230309F37083337334144313437";

            var actual   = Formatters.Binary.GetString(msg.ToMsg());
            var expected = "42313230300020000000000200313233343536323830FF208201139F400C3030303030303030303930309F2610354134373043413041434439453733368204354330309F0704464630309F3604303030315F201A56495341204143515549524552205445535420434152442032359F34063145303330309F27023830840E41303030303030303033313031309F060E41303030303030303033313031309F0D0A463034303030383830309F0E0A303031303030303030309F0F0A463034303030393830309F100E30363031304130334130303030305F2804303834305F34009F120F4352454449544F204445205649534199009F33064530423043389F1A04303732349F090A303030303030383030305F2A04303937389A063134303330359C0230309F37083337334144313437";

            Assert.AreEqual(expected, actual);
        }
Beispiel #10
0
        public void TestMessagePackWithPin()
        {
            var expected = "423132303000000000020018003636366327CE1BB15D7B9530380039997139E00006";
            var msg      = new Iso8583TermApp();

            msg.MessageType = Iso8583Rev93.MsgType._1200_TRAN_REQ;
            msg[Iso8583TermApp.Bit._039_ACTION_CODE]   = "666";
            msg[Iso8583TermApp.Bit._052_PIN_DATA]      = "6327CE1BB15D7B95";
            msg[Iso8583TermApp.Bit._053_SECURITY_INFO] = "0039997139E00006";
            byte[] bytes  = msg.ToMsg();
            var    actual = Formatters.Binary.GetString(bytes);

            Assert.AreEqual(expected, actual);
        }
        public void testAddDataInMsg()
        {
            AdditionalData addData = new AdditionalData();

            addData.Add(AdditionalData.Field.PosData, "2020202012345601234");
            Iso8583TermApp msg = new Iso8583TermApp();

            msg.AdditionalData = addData;
            var actual   = Formatters.Binary.GetString(msg.ToMsg());
            var expected = Formatters.Binary.GetString(new byte[] { 0x42, 0x30, 0x30, 0x30, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x30, 0x30,
                                                                    0x32, 0x34, (byte)0xf0, 0x00, 0x21, (byte)0x80, 0x00, 0x32, 0x30, 0x32, 0x30, 0x32, 0x30, 0x32, 0x30,
                                                                    0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x30, 0x31, 0x32, 0x33, 0x34 });

            Assert.AreEqual(expected, actual);
        }
Beispiel #12
0
        public void PackStructuredData()
        {
            Iso8583TermApp msg = new Iso8583TermApp();

            msg.MessageType = Iso8583TermApp.MsgType._1200_TRAN_REQ;
            msg[Iso8583TermApp.Bit._011_SYS_TRACE_AUDIT_NUM] = "123456";
            HashtableMessage sd = new HashtableMessage();

            sd.Add("key", "value");
            msg.StructuredData = sd;

            String actual   = Formatters.Binary.GetString(msg.ToMsg());
            String expected = "4231323030002000000001000031323334353630303231F0002100013030313231336B6579313576616C7565";

            Assert.AreEqual(expected, actual);
        }
Beispiel #13
0
        public void testPutStructuredDataExistingSd()
        {
            Iso8583TermApp msg     = new Iso8583TermApp();
            AdditionalData addData = new AdditionalData();

            addData[AdditionalData.Field.StructuredData] = "13PSI11V";
            msg.AdditionalData = addData;
            HashtableMessage sd = new HashtableMessage();

            sd.Add("ABC", "1234");
            msg.StructuredData = sd;

            HashtableMessage checkSd = msg.StructuredData;

            Assert.AreNotSame(sd, checkSd);
            Assert.IsTrue(checkSd.ContainsKey("ABC"));
            Assert.IsFalse(checkSd.ContainsKey("PSI"));
        }
 public void TestUnpackBinary()
 {
     var data = Formatters.Binary.GetBytes("4231323130723404112BC58400313634373631373339303031303130323637303030303030303030303030303030393030303330333130333534333030303030313134303330333130333534333135313230303030303030303030303030303031343032323830363439323931313334343736313733393030313031303236373D31353132323031313335303634363038393030303030303030323030373030303230313838373737373137383837373737312020202020202020303638303034303443303030303030303030303030303030304430303030303030303030303031343034433030303030303030303030303030303044303030303030303030303030303734F00047C200383837373737313730303030303120202020203131544149534F537263312020204232344B656E796120202020303030303031303030303031426172636C61797354477270343034303630343030323834304330303030303030313030303034303031383430443030303030303031303030303030353334303444303030303030303030393030");
     var rsp  = new Iso8583TermApp(data);
 }
 public void TestUnpackAscii()
 {
     var data = Formatters.Binary.GetBytes("413138313430323330303030303032433030303030303232373133303035353030303030323134303232373135303035353830303838373737373132383837373737312020202020202020");
     var rsp  = new Iso8583TermApp(data);
 }