com.checkout.customers.previous.CustomersClientImpl 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.customers.previous;
import com.checkout.AbstractClient;
import com.checkout.ApiClient;
import com.checkout.CheckoutConfiguration;
import com.checkout.EmptyResponse;
import com.checkout.SdkAuthorizationType;
import com.checkout.common.IdResponse;
import java.util.concurrent.CompletableFuture;
import static com.checkout.common.CheckoutUtils.validateParams;
public class CustomersClientImpl extends AbstractClient implements CustomersClient {
private static final String CUSTOMERS_PATH = "customers";
public CustomersClientImpl(final ApiClient apiClient, final CheckoutConfiguration configuration) {
super(apiClient, configuration, SdkAuthorizationType.SECRET_KEY);
}
@Override
public CompletableFuture get(final String customerId) {
validateParams("customerId", customerId);
return apiClient.getAsync(buildPath(CUSTOMERS_PATH, customerId), sdkAuthorization(), CustomerDetailsResponse.class);
}
@Override
public CompletableFuture create(final CustomerRequest customerRequest) {
validateParams("customerRequest", customerRequest);
return apiClient.postAsync(CUSTOMERS_PATH, sdkAuthorization(), IdResponse.class, customerRequest, null);
}
@Override
public CompletableFuture update(final String customerId, final CustomerRequest customerRequest) {
validateParams("customerId", customerId, "customerRequest", customerRequest);
return apiClient.patchAsync(buildPath(CUSTOMERS_PATH, customerId), sdkAuthorization(), EmptyResponse.class, customerRequest, null);
}
@Override
public CompletableFuture delete(final String customerId) {
validateParams("customerId", customerId);
return apiClient.deleteAsync(buildPath(CUSTOMERS_PATH, customerId), sdkAuthorization());
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy