LrJposChannel.setOverrideHeader

Sets whether to override the message header with the defined channel header.

public static void setOverrideHeader(boolean overrideHeader)

Parameters

  • overrideHeader: Boolean that is set as the overrideHeader property.

    If it is set to true, the channel header overrides the message header. If it is set to false or not set, the channel header is not used.

Return values

This function does not return any values.

Example

Copy code
public void simpleISOtest() throws Throwable{
        
        GenericPackager packager = new GenericPackager(PACKAGERCONFIGFILE);
        LrJposChannel.initChannel(LrJposChannel.ChannelType.ASCIIChannel, "localhost", 8000, packager);
        LrJposChannel.setHeader("newHeader");
        if (LrJposChannel.isOverrideHeader()) {
            LrJposChannel.setOverrideHeader(true);
        }
        
        LrJposChannel.connect();
        
        LrISOMsg m = new LrISOMsg();
        m.setMTI("0100");
        m.set(ISO87Fields.PAN_PRIMARY_ACCOUNT_NUMBER, "1234567890000000000")
        m.set(3, "523456")
        m.set(4, "123456789121")
        m.set(12, "20241605108110");  
        m.set(47, "32432")

        LrJposChannel.send(m);
        
        LrISOMsg r = LrJposChannel.receive();
        if (r!=null) {
            lr.output_message(r.getMTI());
        }
        
        byte[] currentHeader = LrJposChannel.getHeader();

        LrJposChannel.disconnect();
        LrJposChannel.closeChannel();
}