Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added TPP data elements 113.69, 113.70 and 113.71 to the CMF packager #635

Merged
merged 1 commit into from
Jan 18, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion jpos/src/main/resources/packager/cmf.xml
Original file line number Diff line number Diff line change
Expand Up @@ -885,7 +885,7 @@
<isofieldpackager
id="113"
length="9999"
name="jCard private use"
name="TPP private use"
class="org.jpos.iso.IFB_LLLLBINARY"
packager="org.jpos.iso.packager.GenericSubFieldPackager">
<isofield
Expand Down Expand Up @@ -1073,6 +1073,21 @@
length="9999"
name="Additional Data - reserved for private use"
class="org.jpos.iso.IFB_LLLLCHAR" />
<isofield
id="69"
length="40"
name="Card Token"
class="org.jpos.iso.IF_CHAR" />
<isofield
id="70"
length="19"
name="Transaction ID"
class="org.jpos.iso.IFB_NUMERIC" />
<isofield
id="71"
length="19"
name="Transaction GroupID"
class="org.jpos.iso.IFB_NUMERIC" />
</isofieldpackager>
<isofield
id="114"
Expand Down
49 changes: 49 additions & 0 deletions jpos/src/test/java/org/jpos/iso/TPPDataElementsTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/*
* jPOS Project [http://jpos.org]
* Copyright (C) 2000-2025 jPOS Software SRL
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

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");
}
}
Loading