JPos - ISO8583 消息 TLV 字段
JPos - ISO8583 Messages TLV Fields
我正在使用 jpos 库构建一个简单的电子购买金融消息,我正在使用一个通用打包程序来打包我的消息字段,问题出现在字段 48,它是一个 TLV 字段。
这是字段 48 的打包参数。
<isofieldpackager id="48"
name="Additional Private Data"
length="999"
class="org.jpos.iso.IFB_LLLBINARY"
emitBitmap="false"
tagMapper="org.jpos.iso.packager.TTTDecimalTagMapper"
packager="org.jpos.iso.packager.GenericTaggedFieldsPackager">
<!-- -->
<isofield id="1" length="8" name="PSP Identifier" class="ma.XXY.net.merkit.utils.IFA_TTLLBINARY2"/>
<!-- -->
<isofield id="2" length="8" name="Ecommerce Acquirer Identifier" class="ma.XXY.net.merkit.utils.IFA_TTLLBINARY2"/>
<!-- -->
<isofield id="3" length="3" name="Buyer Country Code" class="ma.XXY.net.merkit.utils.IFA_TTLLBINARY2" />
<!-- -->
<isofield id="4" length="20" name="Buyer Card Brand" class="ma.XXY.net.merkit.utils.IFA_TTLLBINARY2" />
<!-- -->
<isofield id="5" length="24" name="Buyer IP Address" class="ma.XXY.net.merkit.utils.IFA_TTLLBINARY2" />
<!-- -->
<isofield id="6" length="30" name="Buyer email Address" class="ma.XXY.net.merkit.utils.IFA_TTLLBINARY2" />
<!-- -->
<isofield id="7" length="14" name="Buyer Phone Number" class="ma.XXY.net.merkit.utils.IFA_TTLLBINARY2" />
<isofield id="8" length="6" name="Merchant Operation Reference" class="org.jpos.iso.IF_CHAR" />
<isofield id="9" length="3" name="One Click Indicator" class="org.jpos.iso.IF_CHAR"/>
<isofield id="10" length="12" name="ISC INTERNET PIN" class="org.jpos.iso.IF_CHAR"/>
<isofield id="11" length="3" name="One Click Indicator" class="org.jpos.iso.IF_CHAR"/>
<isofield id="12" length="12" name="ISC INTERNET PIN" class="org.jpos.iso.IF_CHAR"/>
<!-- -->
<isofield id="13" length="12" name="One Click Indicator" class="ma.XXY.net.merkit.utils.IFA_TTLLBINARY2"/>
<!-- -->
<isofield id="14" length="1" name="ISC INTERNET PIN" class="ma.XXY.net.merkit.utils.IFA_TTLLBINARY2"/>
</isofieldpackager>
IFA_TTLLBINARY2.java
public class IFA_TTLLBINARY2 extends ISOTagBinaryFieldPackager {
public IFA_TTLLBINARY2() {
super(0,null, BcdPrefixer.LLL, NullPadder.INSTANCE,
LiteralBinaryInterpreter.INSTANCE, BcdPrefixer.LL);
}
public IFA_TTLLBINARY2 (int len, String description) {
super(len, description, BcdPrefixer.LLL, NullPadder.INSTANCE,
LiteralBinaryInterpreter.INSTANCE, BcdPrefixer.LL);
}
}
main.java
ISOMsg authISOMsg = new ISOMsg();
ISOMsg authISOMsgResp;
QMUX qMux;
IServicesUtils service = new ServiceUtilsImpl();
logger.info("Initiating Authorization Request for Simple ePurchase Transaction : 11001122222");
// To be used in header
String stan = service.generateSTAN();
// HEADER
String acquirerTimeOut = service
.getValuesFromPropertiesFile(new String[] { IConstants.ACQUIRER_MSG_TIMEOUT }, "parameters.properties")
.get(IConstants.ACQUIRER_MSG_TIMEOUT).toString();
String issuerTimeOut = service
.getValuesFromPropertiesFile(new String[] { IConstants.ISSUER_MSG_TIMEOUT }, "parameters.properties")
.get(IConstants.ISSUER_MSG_TIMEOUT).toString();
authISOMsg.setHeader(("001" + issuerTimeOut + DateUtils.getHeaderFieldIso(new Date(), stan)).getBytes());
try {
// MTI
authISOMsg.setMTI(IsoConstants.ISO_AUTH_REQUEST_MSG_MTI);
authISOMsg.set(14, "0819");
// Merchant Type - not existing in mpi response
authISOMsg.set(18, "3306");
// POS Entry Mode
authISOMsg.set(22, IsoConstants.ISO_AUTH_REQUEST_POS_ENTRY_MODE);
// POS Condition code
authISOMsg.set(25,IsoConstants.ISO_AUTH_REQUEST_POS_CONDITION_CODE);
// Card Acceptor Terminal Identification
authISOMsg.set(41,"BX023350");
// Merchant ID
authISOMsg.set(42, service.reduceMerchantIDLength("*****"));
//
authISOMsg.set("48.1","PSP_001");
authISOMsg.set("48.2","ACQ_002");
authISOMsg.set("48.3","MAR");
authISOMsg.set("48.4","VISA INTERNATIONAL");
authISOMsg.set("48.5","10.0.0.136");
authISOMsg.set("48.6","*****");
authISOMsg.set("48.7","******");
// Currency
authISOMsg.set(49,"840");
Q2 scanner = new Q2();
scanner.start();
qMux = (QMUX) QMUX.getMUX("clientmux");
authISOMsgResp = qMux.request(authISOMsg,
Integer.parseInt(acquirerTimeOut));
if (authISOMsgResp != null) {
System.out.println(authISOMsgResp.getString(2));
}
上面的主要代码表示包含一些字段的财务信息,我遇到的问题出现在字段48。
下面的错误抛出以下异常。
Nested:org.jpos.iso.ISOException: Error reading deploy\packager\basic-packager.xml (org.xml.sax.SAXParseException; systemId: file:basic-packager.xml;
lineNumber: 114; columnNumber: 64; Attribute "tagMapper" must be declared for element type "isofieldpackager").
您似乎需要使用 generic-subtag-packager.dtd 来验证您的 xml 打包程序定义。
您可以将该文件复制到与您的 xml 相同的目录中,并用文档类型定义替换此文件:
<!DOCTYPE isopackager SYSTEM "generic-subtag-packager.dtd">
希望这能解决您的问题。
我正在使用 jpos 库构建一个简单的电子购买金融消息,我正在使用一个通用打包程序来打包我的消息字段,问题出现在字段 48,它是一个 TLV 字段。
这是字段 48 的打包参数。
<isofieldpackager id="48"
name="Additional Private Data"
length="999"
class="org.jpos.iso.IFB_LLLBINARY"
emitBitmap="false"
tagMapper="org.jpos.iso.packager.TTTDecimalTagMapper"
packager="org.jpos.iso.packager.GenericTaggedFieldsPackager">
<!-- -->
<isofield id="1" length="8" name="PSP Identifier" class="ma.XXY.net.merkit.utils.IFA_TTLLBINARY2"/>
<!-- -->
<isofield id="2" length="8" name="Ecommerce Acquirer Identifier" class="ma.XXY.net.merkit.utils.IFA_TTLLBINARY2"/>
<!-- -->
<isofield id="3" length="3" name="Buyer Country Code" class="ma.XXY.net.merkit.utils.IFA_TTLLBINARY2" />
<!-- -->
<isofield id="4" length="20" name="Buyer Card Brand" class="ma.XXY.net.merkit.utils.IFA_TTLLBINARY2" />
<!-- -->
<isofield id="5" length="24" name="Buyer IP Address" class="ma.XXY.net.merkit.utils.IFA_TTLLBINARY2" />
<!-- -->
<isofield id="6" length="30" name="Buyer email Address" class="ma.XXY.net.merkit.utils.IFA_TTLLBINARY2" />
<!-- -->
<isofield id="7" length="14" name="Buyer Phone Number" class="ma.XXY.net.merkit.utils.IFA_TTLLBINARY2" />
<isofield id="8" length="6" name="Merchant Operation Reference" class="org.jpos.iso.IF_CHAR" />
<isofield id="9" length="3" name="One Click Indicator" class="org.jpos.iso.IF_CHAR"/>
<isofield id="10" length="12" name="ISC INTERNET PIN" class="org.jpos.iso.IF_CHAR"/>
<isofield id="11" length="3" name="One Click Indicator" class="org.jpos.iso.IF_CHAR"/>
<isofield id="12" length="12" name="ISC INTERNET PIN" class="org.jpos.iso.IF_CHAR"/>
<!-- -->
<isofield id="13" length="12" name="One Click Indicator" class="ma.XXY.net.merkit.utils.IFA_TTLLBINARY2"/>
<!-- -->
<isofield id="14" length="1" name="ISC INTERNET PIN" class="ma.XXY.net.merkit.utils.IFA_TTLLBINARY2"/>
</isofieldpackager>
IFA_TTLLBINARY2.java
public class IFA_TTLLBINARY2 extends ISOTagBinaryFieldPackager {
public IFA_TTLLBINARY2() {
super(0,null, BcdPrefixer.LLL, NullPadder.INSTANCE,
LiteralBinaryInterpreter.INSTANCE, BcdPrefixer.LL);
}
public IFA_TTLLBINARY2 (int len, String description) {
super(len, description, BcdPrefixer.LLL, NullPadder.INSTANCE,
LiteralBinaryInterpreter.INSTANCE, BcdPrefixer.LL);
}
}
main.java
ISOMsg authISOMsg = new ISOMsg();
ISOMsg authISOMsgResp;
QMUX qMux;
IServicesUtils service = new ServiceUtilsImpl();
logger.info("Initiating Authorization Request for Simple ePurchase Transaction : 11001122222");
// To be used in header
String stan = service.generateSTAN();
// HEADER
String acquirerTimeOut = service
.getValuesFromPropertiesFile(new String[] { IConstants.ACQUIRER_MSG_TIMEOUT }, "parameters.properties")
.get(IConstants.ACQUIRER_MSG_TIMEOUT).toString();
String issuerTimeOut = service
.getValuesFromPropertiesFile(new String[] { IConstants.ISSUER_MSG_TIMEOUT }, "parameters.properties")
.get(IConstants.ISSUER_MSG_TIMEOUT).toString();
authISOMsg.setHeader(("001" + issuerTimeOut + DateUtils.getHeaderFieldIso(new Date(), stan)).getBytes());
try {
// MTI
authISOMsg.setMTI(IsoConstants.ISO_AUTH_REQUEST_MSG_MTI);
authISOMsg.set(14, "0819");
// Merchant Type - not existing in mpi response
authISOMsg.set(18, "3306");
// POS Entry Mode
authISOMsg.set(22, IsoConstants.ISO_AUTH_REQUEST_POS_ENTRY_MODE);
// POS Condition code
authISOMsg.set(25,IsoConstants.ISO_AUTH_REQUEST_POS_CONDITION_CODE);
// Card Acceptor Terminal Identification
authISOMsg.set(41,"BX023350");
// Merchant ID
authISOMsg.set(42, service.reduceMerchantIDLength("*****"));
//
authISOMsg.set("48.1","PSP_001");
authISOMsg.set("48.2","ACQ_002");
authISOMsg.set("48.3","MAR");
authISOMsg.set("48.4","VISA INTERNATIONAL");
authISOMsg.set("48.5","10.0.0.136");
authISOMsg.set("48.6","*****");
authISOMsg.set("48.7","******");
// Currency
authISOMsg.set(49,"840");
Q2 scanner = new Q2();
scanner.start();
qMux = (QMUX) QMUX.getMUX("clientmux");
authISOMsgResp = qMux.request(authISOMsg,
Integer.parseInt(acquirerTimeOut));
if (authISOMsgResp != null) {
System.out.println(authISOMsgResp.getString(2));
}
上面的主要代码表示包含一些字段的财务信息,我遇到的问题出现在字段48。
下面的错误抛出以下异常。
Nested:org.jpos.iso.ISOException: Error reading deploy\packager\basic-packager.xml (org.xml.sax.SAXParseException; systemId: file:basic-packager.xml;
lineNumber: 114; columnNumber: 64; Attribute "tagMapper" must be declared for element type "isofieldpackager").
您似乎需要使用 generic-subtag-packager.dtd 来验证您的 xml 打包程序定义。
您可以将该文件复制到与您的 xml 相同的目录中,并用文档类型定义替换此文件:
<!DOCTYPE isopackager SYSTEM "generic-subtag-packager.dtd">
希望这能解决您的问题。