Created
March 8, 2018 16:05
-
-
Save Philip-Nunoo/8ea2ae9be7e3b44bb1ed8decf4a76e73 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* 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