From dc840f431b4c104adfab8d174341d13b9cb3731e Mon Sep 17 00:00:00 2001 From: Orlando Pagano Date: Sat, 18 Jan 2025 14:46:21 -0300 Subject: [PATCH] Added TPP data elements 113.69, 113.70 and 113.71 to the CMF packager --- jpos/src/main/resources/packager/cmf.xml | 17 ++++++- .../org/jpos/iso/TPPDataElementsTest.java | 49 +++++++++++++++++++ 2 files changed, 65 insertions(+), 1 deletion(-) create mode 100644 jpos/src/test/java/org/jpos/iso/TPPDataElementsTest.java diff --git a/jpos/src/main/resources/packager/cmf.xml b/jpos/src/main/resources/packager/cmf.xml index 79bf18c892..4030e4783b 100644 --- a/jpos/src/main/resources/packager/cmf.xml +++ b/jpos/src/main/resources/packager/cmf.xml @@ -885,7 +885,7 @@ + + + . + */ + +package org.jpos.iso; + +import org.jpos.iso.packager.GenericPackager; +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.*; + +public class TPPDataElementsTest { + private byte[] TPPDE = + ISOUtil.hex2byte( + ISOUtil.hexString(("tpp-card-token ").getBytes()) // Card Token + + "00000000000000022220" // Transaction ID + + "00000000000000011110" // Transaction GroupID + ); + + @Test + public void testTPPDataElements() throws ISOException { + ISOPackager p = new GenericPackager("jar:packager/cmf.xml"); + ISOMsg m = new ISOMsg("2100"); + m.set("113.69", "tpp-card-token"); + m.set("113.70", "2222"); + m.set("113.71", "1111"); + m.setPackager(p); + + assertEquals(ISOUtil.hexString(TPPDE), ISOUtil.hexString(m.pack()).substring(72)); + + assertEquals(m.getString("113.69"), "tpp-card-token"); + assertEquals(m.getString("113.70"), "2222"); + assertEquals(m.getString("113.71"), "1111"); + } +}