com.checkout.payments.hosted.HostedPaymentsClientImpl 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.payments.hosted;
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 HostedPaymentsClientImpl extends AbstractClient implements HostedPaymentsClient {
private static final String HOSTED_PAYMENTS_PATH = "hosted-payments";
public HostedPaymentsClientImpl(final ApiClient apiClient, final CheckoutConfiguration configuration) {
super(apiClient, configuration, SdkAuthorizationType.SECRET_KEY);
}
@Override
public CompletableFuture createHostedPaymentsPageSession(final HostedPaymentRequest hostedPaymentRequest) {
validateParams("hostedPaymentRequest", hostedPaymentRequest);
return apiClient.postAsync(HOSTED_PAYMENTS_PATH, sdkAuthorization(), HostedPaymentResponse.class, hostedPaymentRequest, null);
}
@Override
public CompletableFuture getHostedPaymentsPageDetails(final String hostedPaymentId) {
validateParams("hostedPayment", hostedPaymentId);
return apiClient.getAsync(buildPath(HOSTED_PAYMENTS_PATH, hostedPaymentId), sdkAuthorization(), HostedPaymentDetailsResponse.class);
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy