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

cl.transbank.onepay.Onepay Maven / Gradle / Ivy

There is a newer version: 5.0.0
Show newest version
package cl.transbank.onepay;

import lombok.Getter;
import lombok.ToString;

public abstract class Onepay {
    public static final String APP_KEY = "04533c31-fe7e-43ed-bbc4-1c8ab1538afp";
    public static final Channel DEFAULT_CHANNEL = Channel.WEB;
    public static final String DEFAULT_CALLBACK = "http://no.callback.has/been.setted";
    private static volatile IntegrationType integrationType = IntegrationType.TEST;
    private static volatile String apiKey;
    private static volatile String sharedSecret;
    private static volatile String callbackUrl;
    private static volatile String appScheme;

    public static IntegrationType getIntegrationType() {
        return integrationType;
    }

    public static void setIntegrationType(IntegrationType integrationType) {
        if (null == integrationType) throw new NullPointerException("integrationType cannot be null");
        Onepay.integrationType = integrationType;
    }

    public static String getApiKey() {
        return apiKey;
    }

    public static void setApiKey(String apiKey) {
        if (null == apiKey) throw new NullPointerException("apiKey cannot be null");
        Onepay.apiKey = apiKey;
    }

    public static String getSharedSecret() {
        return sharedSecret;
    }

    public static void setSharedSecret(String sharedSecret) {
        if (null == sharedSecret) throw new NullPointerException("sharedSecret cannot be null");
        Onepay.sharedSecret = sharedSecret;
    }

    public static String getCallbackUrl() {
        return callbackUrl;
    }

    public static void setCallbackUrl(String callbackUrl) {
        if (null == callbackUrl) throw new NullPointerException("callbackUrl cannot be null");
        Onepay.callbackUrl = callbackUrl;
    }

    public static String getAppScheme() {
        return appScheme;
    }

    public static void setAppScheme(String appScheme) {
        Onepay.appScheme = appScheme;
    }

    @ToString public enum IntegrationType {
        LIVE(""),
        TEST("https://web2desa.test.transbank.cl"),
        MOCK("http://onepay.getsandbox.com");

        @Getter private String apiBase;

        IntegrationType(String apiBase) {
            this.apiBase = apiBase;
        }
    }

    public enum Channel {
        WEB,
        MOBILE,
        APP
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy