com.checkout.AbstractCheckoutSdkBuilder Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of checkout-sdk-java Show documentation
Show all versions of checkout-sdk-java Show documentation
Checkout SDK for Java https://checkout.com
package com.checkout;
import java.util.concurrent.Executor;
import java.util.concurrent.ForkJoinPool;
import org.apache.http.impl.client.HttpClientBuilder;
public abstract class AbstractCheckoutSdkBuilder {
protected HttpClientBuilder httpClientBuilder = HttpClientBuilder.create();
private IEnvironment environment;
private Executor executor = ForkJoinPool.commonPool();
public AbstractCheckoutSdkBuilder environment(final IEnvironment environment) {
this.environment = environment;
return this;
}
public AbstractCheckoutSdkBuilder httpClientBuilder(final HttpClientBuilder httpClientBuilder) {
this.httpClientBuilder = httpClientBuilder;
return this;
}
public AbstractCheckoutSdkBuilder executor(final Executor executor) {
this.executor = executor;
return this;
}
protected IEnvironment getEnvironment() {
return environment;
}
protected abstract SdkCredentials getSdkCredentials();
protected CheckoutConfiguration getCheckoutConfiguration() {
if (environment == null) {
throw new CheckoutArgumentException("environment must be specified");
}
final SdkCredentials sdkCredentials = getSdkCredentials();
return buildCheckoutConfiguration(sdkCredentials);
}
private CheckoutConfiguration buildCheckoutConfiguration(final SdkCredentials sdkCredentials) {
return new DefaultCheckoutConfiguration(sdkCredentials, getEnvironment(), httpClientBuilder, executor);
}
public abstract T build();
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy