Skip to content

Instantly share code, notes, and snippets.

@Philip-Nunoo
Created March 8, 2018 16:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Philip-Nunoo/8ea2ae9be7e3b44bb1ed8decf4a76e73 to your computer and use it in GitHub Desktop.
Save Philip-Nunoo/8ea2ae9be7e3b44bb1ed8decf4a76e73 to your computer and use it in GitHub Desktop.
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.phil.wrapper;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.jpos.iso.ISOException;
import org.jpos.iso.ISOMsg;
import org.jpos.iso.packager.GenericPackager;
/**
*
* @author Philip
*/
public class IsoMessageDecomposer {
private GenericPackager packager;
public ISOMsg decomposeIsoMessage(String clientMessage) throws Exception {
try {
packager = new GenericPackager("C:\\isoGateway\\basic.xml");
} catch (ISOException ex) {
Logger.getLogger(IsoMessageDecomposer.class.getName()).log(Level.SEVERE, null, ex);
throw new Exception("could not make the generic packer.. please make sure the file C:\\isoGateway\\basic.xml exit");
}
// Create ISO Message
ISOMsg isoMsg = new ISOMsg();
isoMsg.setPackager(packager);
try {
isoMsg.unpack(clientMessage.getBytes());
} catch (ISOException ex) {
Logger.getLogger(IsoMessageDecomposer.class.getName()).log(Level.SEVERE, null, ex);
throw new Exception("Could not unpack iso Message from ISO 8583 provider very well.. Please contact the ISO 8583 service provider");
}
return isoMsg;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment