All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.hps.integrator.terminals.DeviceMessage Maven / Gradle / Ivy

Go to download

The SecureSubmit Java SDK simplifies processing of credit card transactions using Heartland Payment Systems' Portico Payment Gateway

There is a newer version: v2.5.2
Show newest version
package com.hps.integrator.terminals;

import com.hps.integrator.abstractions.IDeviceMessage;
import com.hps.integrator.infrastructure.emums.ControlCodes;
import com.hps.integrator.infrastructure.utils.HpsEnumUtils;

public class DeviceMessage implements IDeviceMessage {
    byte[] buffer;

    public DeviceMessage(byte[] buffer){
        this.buffer = buffer;
    }

    public byte[] getSendBuffer() { return this.buffer; }

    @Override
    public String toString(){
        StringBuilder sb = new StringBuilder();
        for(byte b : buffer){
            if(HpsEnumUtils.isDefined(ControlCodes.class, b)){
                ControlCodes code = HpsEnumUtils.parse(ControlCodes.class, b);
                sb.append(code.toString());
            }
            else sb.append((char)b);
        }

        return sb.toString();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy