com.checkout.transfers.TransfersClientImpl 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.transfers;
import com.checkout.AbstractClient;
import com.checkout.ApiClient;
import com.checkout.CheckoutConfiguration;
import com.checkout.SdkAuthorizationType;
import java.util.concurrent.CompletableFuture;
import static com.checkout.common.CheckoutUtils.validateParams;
public class TransfersClientImpl extends AbstractClient implements TransfersClient {
private static final String TRANSFERS_PATH = "transfers";
public TransfersClientImpl(final ApiClient apiClient, final CheckoutConfiguration configuration) {
super(apiClient, configuration, SdkAuthorizationType.SECRET_KEY_OR_OAUTH);
}
@Override
public CompletableFuture initiateTransferOfFunds(final CreateTransferRequest createTransferRequest) {
return requestInitiateTransferOfFunds(createTransferRequest, null);
}
@Override
public CompletableFuture initiateTransferOfFunds(final CreateTransferRequest createTransferRequest, final String idempotencyKey) {
return requestInitiateTransferOfFunds(createTransferRequest, idempotencyKey);
}
@Override
public CompletableFuture retrieveATransfer(final String transferId) {
validateParams("transferId", transferId);
return apiClient.getAsync(buildPath(TRANSFERS_PATH, transferId), sdkAuthorization(), TransferDetailsResponse.class);
}
private CompletableFuture requestInitiateTransferOfFunds(final CreateTransferRequest createTransferRequest, final String idempotencyKey) {
validateParams("createTransferRequest", createTransferRequest);
return apiClient.postAsync(TRANSFERS_PATH, sdkAuthorization(), CreateTransferResponse.class, createTransferRequest, idempotencyKey);
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy