Package com.midtrans
Class Config
- java.lang.Object
-
- com.midtrans.Config
-
public class Config extends Object
Midtrans configuration
-
-
Constructor Summary
Constructors Constructor Description Config(String serverKey, String clientKey, boolean isProduction)Deprecated.This constructor will delete soon on the next major release.Config(String serverKey, String clientKey, boolean isProduction, boolean enabledLog, int connectionTimeout, int readTimeout, int writeTimeout, int maxConnectionPool, int keepAliveDuration, TimeUnit httpClientTimeUnit, String irisIdempotencyKey, String paymentIdempotencyKey, String xAppendNotification, String xOverrideNotification, ProxyConfig proxyConfig, Map<String,String> customHeaders)Config(String serverKey, String clientKey, boolean isProduction, int connectionTimeout, int readTimeout, int writeTimeout, int maxConnectionPool, int keepAliveDuration)Deprecated.This constructor will delete soon on the next major release.Config(String serverKey, String clientKey, boolean isProduction, int connectionTimeout, int readTimeout, int writeTimeout, int maxConnectionPool, int keepAliveDuration, ProxyConfig proxyConfig)Deprecated.This constructor will delete soon on the next major release.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static ConfigBuilderbuilder()StringgetCLIENT_KEY()Deprecated.This method will delete soon on the next major release.StringgetClientKey()Get merchant client keyintgetConnectionTimeout()Get http client connection timeoutStringgetCoreApiURL()set BASE_URL to CoreAPI_BASE_URL in accordance with the environment typeMap<String,String>getCustomHeaders()static ConfiggetGlobalConfig()TimeUnitgetHttpClientTimeUnit()StringgetIRIS_MERCHANT_KEY()Get Iris merchant keyStringgetIrisApiURL()set BASE_URL to IRIS_API_BASE_URL in accordance with the environment typeStringgetIrisIdempotencyKey()Get Iris Idempotent KeyStringgetIrisMerchantKey()Get Iris merchant keyintgetKeepAliveDuration()Get http client keep alive durationsintgetMaxConnectionPool()Get http client max connection poolStringgetPaymentAppendNotification()Get Payment append notification URLStringgetPaymentIdempotencyKey()Get Payment Idempotent KeyStringgetPaymentOverrideNotification()Get Payment override notification URLProxyConfiggetProxyConfig()Get http client proxy configurationintgetReadTimeout()Get http client read timeoutStringgetSERVER_KEY()Deprecated.This method will delete soon on the next major release.StringgetServerKey()Get merchant server keyStringgetSnapApiURL()set BASE_URL to SnapAPI_BASE_URL in accordance with the environment typeintgetWriteTimeout()Get http client write timeoutbooleanisEnabledLog()Get enableLog is enabledbooleanisProduction()Get environment typevoidpaymentAppendNotification(String xAppendNotification)Set Payment append URL notificationvoidpaymentOverrideNotification(String xOverrideNotification)Set Override URL notificationvoidsetCLIENT_KEY(String CLIENT_KEY)Deprecated.This method will delete soon on the next major release.voidsetClientKey(String clientKey)set client-key used for authorization on frontend API request/configuration.voidsetConnectionTimeout(int connectionTimeout)set connect timeout HttpClientvoidsetConnectionTimeout(int connectionTimeout, TimeUnit timeUnit)set connect timeout with time unit HttpClientvoidsetCustomHeaders(Map<String,String> customHeaders)Set Custom headers for API RequestvoidsetEnabledLog(boolean enabledLog)set enable log for debuggingvoidsetIRIS_MERCHANT_KEY(String IRIS_MERCHANT_KEY)Deprecated.This method will delete soon on the next major release.voidsetIrisIdempotencyKey(String irisIdempotencyKey)Set Iris idempotent keyvoidsetIrisMerchantKey(String irisMerchantKey)Set Iris Merchant keyvoidsetKeepAliveDuration(int keepAliveDuration)Set keep alive durationsvoidsetKeepAliveDuration(int keepAliveDuration, TimeUnit timeUnit)set keep alive duration with time unit HttpClientvoidsetMaxConnectionPool(int maxConnectionPool)Set max connection poolvoidsetPaymentIdempotencyKey(String paymentIdempotencyKey)Set Payment idempotent keyvoidsetProduction(boolean production)set environment sandbox/productionvoidsetProxyConfig(ProxyConfig proxyConfig)Set proxy configurationvoidsetReadTimeout(int readTimeout)Set read timeout HttpClientvoidsetReadTimeout(int readTimeout, TimeUnit timeUnit)set read timeout with time unit HttpClientvoidsetSERVER_KEY(String SERVER_KEY)Deprecated.This method will delete soon on the next major release.voidsetServerKey(String serverKey)set server-key for Basic Authentication while calling Midtrans API from backend.voidsetWriteTimeout(int writeTimeout)Set write timeout HttpClientvoidsetWriteTimeout(int writeTimeout, TimeUnit timeUnit)set write timeout with time unit HttpClient
-
-
-
Constructor Detail
-
Config
public Config(String serverKey, String clientKey, boolean isProduction)
Deprecated.This constructor will delete soon on the next major release.Please use
builder()instead.Midtrans configuration constructor- Parameters:
serverKey- Merchant server-keyclientKey- Merchant client-keyisProduction- Merchant Environment Sandbox or Production
-
Config
public Config(String serverKey, String clientKey, boolean isProduction, int connectionTimeout, int readTimeout, int writeTimeout, int maxConnectionPool, int keepAliveDuration)
Deprecated.This constructor will delete soon on the next major release.Please use
builder()instead.Midtrans configuration constructor- Parameters:
serverKey- Merchant server-keyclientKey- Merchant client-keyisProduction- Merchant Environment Sandbox or ProductionconnectionTimeout- Config for connection timeoutreadTimeout- Config for read timeoutwriteTimeout- Config for write timeoutmaxConnectionPool- value max for connection poolkeepAliveDuration- Durations for Keep alive connection
-
Config
public Config(String serverKey, String clientKey, boolean isProduction, int connectionTimeout, int readTimeout, int writeTimeout, int maxConnectionPool, int keepAliveDuration, ProxyConfig proxyConfig)
Deprecated.This constructor will delete soon on the next major release.Please use
builder()instead.Midtrans configuration constructor- Parameters:
serverKey- Merchant server-keyclientKey- Merchant client-keyisProduction- Merchant Environment Sandbox or ProductionconnectionTimeout- Config for connection timeoutreadTimeout- Config for read timeoutwriteTimeout- Config for write timeoutmaxConnectionPool- value max for connection poolkeepAliveDuration- Durations for Keep alive connectionproxyConfig- Config for use http proxy
-
Config
public Config(String serverKey, String clientKey, boolean isProduction, boolean enabledLog, int connectionTimeout, int readTimeout, int writeTimeout, int maxConnectionPool, int keepAliveDuration, TimeUnit httpClientTimeUnit, String irisIdempotencyKey, String paymentIdempotencyKey, String xAppendNotification, String xOverrideNotification, ProxyConfig proxyConfig, Map<String,String> customHeaders)
-
-
Method Detail
-
getGlobalConfig
public static Config getGlobalConfig()
-
isProduction
public boolean isProduction()
Get environment type- Returns:
- boolean
-
getSERVER_KEY
public String getSERVER_KEY()
Deprecated.This method will delete soon on the next major release.Please use
getServerKey()instead.Get merchant server key- Returns:
getServerKey()
-
getServerKey
public String getServerKey()
Get merchant server key- Returns:
- Merchant server key
-
getCLIENT_KEY
public String getCLIENT_KEY()
Deprecated.This method will delete soon on the next major release.Please use
getClientKey()instead.Get merchant client key- Returns:
- Merchant client key
-
getClientKey
public String getClientKey()
Get merchant client key- Returns:
- Merchant client key
-
getConnectionTimeout
public int getConnectionTimeout()
Get http client connection timeout- Returns:
- connection timeout
-
getReadTimeout
public int getReadTimeout()
Get http client read timeout- Returns:
- read timeout
-
getWriteTimeout
public int getWriteTimeout()
Get http client write timeout- Returns:
- write timeout
-
getMaxConnectionPool
public int getMaxConnectionPool()
Get http client max connection pool- Returns:
- max connection pool
-
getKeepAliveDuration
public int getKeepAliveDuration()
Get http client keep alive durations- Returns:
- keep alive durations
-
getHttpClientTimeUnit
public TimeUnit getHttpClientTimeUnit()
-
getProxyConfig
public ProxyConfig getProxyConfig()
Get http client proxy configuration- Returns:
- Http client
proxy configuration
-
isEnabledLog
public boolean isEnabledLog()
Get enableLog is enabled- Returns:
- Http client enabledLog
-
getCoreApiURL
public String getCoreApiURL()
set BASE_URL to CoreAPI_BASE_URL in accordance with the environment type
-
getSnapApiURL
public String getSnapApiURL()
set BASE_URL to SnapAPI_BASE_URL in accordance with the environment type
-
getIrisApiURL
public String getIrisApiURL()
set BASE_URL to IRIS_API_BASE_URL in accordance with the environment type
-
getIrisIdempotencyKey
public String getIrisIdempotencyKey()
Get Iris Idempotent Key- Returns:
- iris idempotent key
-
getPaymentIdempotencyKey
public String getPaymentIdempotencyKey()
Get Payment Idempotent Key- Returns:
- payment idempotent key
-
getPaymentAppendNotification
public String getPaymentAppendNotification()
Get Payment append notification URL- Returns:
- URL append notification
-
getPaymentOverrideNotification
public String getPaymentOverrideNotification()
Get Payment override notification URL- Returns:
- URL override notification
-
getIRIS_MERCHANT_KEY
public String getIRIS_MERCHANT_KEY()
Get Iris merchant key- Returns:
- String iris merchant key
-
getIrisMerchantKey
public String getIrisMerchantKey()
Get Iris merchant key- Returns:
- String iris merchant key
-
setSERVER_KEY
public void setSERVER_KEY(String SERVER_KEY)
Deprecated.This method will delete soon on the next major release.Please use
setServerKey(String)instead.set server-key for Basic Authentication while calling Midtrans API from backend.- Parameters:
SERVER_KEY- merchant server key
-
setServerKey
public void setServerKey(String serverKey)
set server-key for Basic Authentication while calling Midtrans API from backend.- Parameters:
serverKey- merchant server key
-
setCLIENT_KEY
public void setCLIENT_KEY(String CLIENT_KEY)
Deprecated.This method will delete soon on the next major release.Please use
setClientKey(String)instead.set client-key used for authorization on frontend API request/configuration.- Parameters:
CLIENT_KEY- merchant client key
-
setClientKey
public void setClientKey(String clientKey)
set client-key used for authorization on frontend API request/configuration.- Parameters:
clientKey- merchant client key
-
setProduction
public void setProduction(boolean production)
set environment sandbox/production- Parameters:
production- merchant environment type
-
setEnabledLog
public void setEnabledLog(boolean enabledLog)
set enable log for debugging- Parameters:
enabledLog- boolean to turn off/on LOG
-
setConnectionTimeout
public void setConnectionTimeout(int connectionTimeout, TimeUnit timeUnit)set connect timeout with time unit HttpClient- Parameters:
connectionTimeout-timeUnit-
-
setConnectionTimeout
public void setConnectionTimeout(int connectionTimeout)
set connect timeout HttpClient- Parameters:
connectionTimeout- int connection time out unit durations is seconds
-
setReadTimeout
public void setReadTimeout(int readTimeout, TimeUnit timeUnit)set read timeout with time unit HttpClient- Parameters:
readTimeout-timeUnit-
-
setReadTimeout
public void setReadTimeout(int readTimeout)
Set read timeout HttpClient- Parameters:
readTimeout- int read time out unit durations is seconds
-
setWriteTimeout
public void setWriteTimeout(int writeTimeout, TimeUnit timeUnit)set write timeout with time unit HttpClient- Parameters:
writeTimeout-timeUnit-
-
setWriteTimeout
public void setWriteTimeout(int writeTimeout)
Set write timeout HttpClient- Parameters:
writeTimeout- int write time out unit durations is seconds
-
setProxyConfig
public void setProxyConfig(ProxyConfig proxyConfig)
Set proxy configuration- Parameters:
proxyConfig- Object from ProxyConfig
-
setMaxConnectionPool
public void setMaxConnectionPool(int maxConnectionPool)
Set max connection pool- Parameters:
maxConnectionPool- int max connection pool
-
setKeepAliveDuration
public void setKeepAliveDuration(int keepAliveDuration, TimeUnit timeUnit)set keep alive duration with time unit HttpClient- Parameters:
keepAliveDuration-timeUnit-
-
setKeepAliveDuration
public void setKeepAliveDuration(int keepAliveDuration)
Set keep alive durations- Parameters:
keepAliveDuration- int keep alive duration, unit is seconds
-
setIrisIdempotencyKey
public void setIrisIdempotencyKey(String irisIdempotencyKey)
Set Iris idempotent key- Parameters:
irisIdempotencyKey- String for idempotent key
-
setPaymentIdempotencyKey
public void setPaymentIdempotencyKey(String paymentIdempotencyKey)
Set Payment idempotent key- Parameters:
paymentIdempotencyKey- String for idempotent key
-
paymentAppendNotification
public void paymentAppendNotification(String xAppendNotification)
Set Payment append URL notification- Parameters:
xAppendNotification- String URL for append notification, multiple URL can separate with commas
-
paymentOverrideNotification
public void paymentOverrideNotification(String xOverrideNotification)
Set Override URL notification- Parameters:
xOverrideNotification- String URL for override notification, multiple URL can separate with commas
-
setIRIS_MERCHANT_KEY
@Deprecated public void setIRIS_MERCHANT_KEY(String IRIS_MERCHANT_KEY)
Deprecated.This method will delete soon on the next major release.Please use
setIrisMerchantKey(String)instead.Set Iris Merchant key- Parameters:
IRIS_MERCHANT_KEY- String iris merchant key
-
setIrisMerchantKey
public void setIrisMerchantKey(String irisMerchantKey)
Set Iris Merchant key- Parameters:
irisMerchantKey-
-
setCustomHeaders
public void setCustomHeaders(Map<String,String> customHeaders)
Set Custom headers for API Request- Parameters:
customHeaders- Map string for custom headers
-
builder
public static ConfigBuilder builder()
-
-