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

one.credify.sdk.utils.ServicexUtils Maven / Gradle / Ivy

There is a newer version: v0.4.9
Show newest version
package one.credify.sdk.utils;

import one.credify.crypto.Encryption;
import org.apache.commons.lang3.StringUtils;

public class ServicexUtils {
    public static String decryptString(Encryption encryption, String decryptedValue) throws Exception {
        if (StringUtils.isEmpty(decryptedValue)) {
            return null;
        }
        String result = encryption.decryptString(decryptedValue);
        if (result.startsWith("\"") && result.endsWith("\"")) {
            result = result.substring(1, result.length() - 1);
        }
        return result;

    }

    public static Integer decryptInt(Encryption encryption, String decryptedValue) throws Exception {
        if (StringUtils.isEmpty(decryptedValue)) {
            return null;
        }
        return Integer.valueOf(encryption.decryptString(decryptedValue));
    }

    public static Long decryptLong(Encryption encryption, String decryptedValue) throws Exception {
        if (StringUtils.isEmpty(decryptedValue)) {
            return null;
        }
        return Long.valueOf(encryption.decryptString(decryptedValue));

    }

    public static Boolean decryptBoolean(Encryption encryption, String decryptedValue) throws Exception {
        if (StringUtils.isEmpty(decryptedValue)) {
            return null;
        }
        return Boolean.valueOf(encryption.decryptString(decryptedValue));

    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy