com.checkout.tokens.TokensClientImpl 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.tokens;
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 TokensClientImpl extends AbstractClient implements TokensClient {
private static final String TOKENS_PATH = "tokens";
public TokensClientImpl(final ApiClient apiClient, final CheckoutConfiguration configuration) {
super(apiClient, configuration, SdkAuthorizationType.PUBLIC_KEY);
}
@Override
public CompletableFuture requestCardToken(final CardTokenRequest cardTokenRequest) {
validateParams("cardTokenRequest", cardTokenRequest);
return apiClient.postAsync(TOKENS_PATH, sdkAuthorization(), CardTokenResponse.class, cardTokenRequest, null);
}
@Override
public CompletableFuture requestWalletToken(final WalletTokenRequest walletTokenRequest) {
validateParams("walletTokenRequest", walletTokenRequest);
return apiClient.postAsync(TOKENS_PATH, sdkAuthorization(), TokenResponse.class, walletTokenRequest, null);
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy