com.adyen.service.BinLookup Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of adyen-java-api-library Show documentation
Show all versions of adyen-java-api-library Show documentation
Adyen API Client Library for Java
package com.adyen.service;
import com.adyen.ApiKeyAuthenticatedService;
import com.adyen.Client;
import com.adyen.model.binlookup.CostEstimateRequest;
import com.adyen.model.binlookup.CostEstimateResponse;
import com.adyen.model.binlookup.ThreeDSAvailabilityRequest;
import com.adyen.model.binlookup.ThreeDSAvailabilityResponse;
import com.adyen.service.resource.binlookup.Get3dsAvailability;
import com.adyen.service.resource.binlookup.GetCostEstimate;
import com.google.gson.reflect.TypeToken;
public class BinLookup extends ApiKeyAuthenticatedService {
private Get3dsAvailability get3dsAvailability;
private GetCostEstimate getCostEstimate;
public BinLookup(Client client) {
super(client);
get3dsAvailability = new Get3dsAvailability(this);
getCostEstimate = new GetCostEstimate(this);
}
public ThreeDSAvailabilityResponse get3dsAvailability(ThreeDSAvailabilityRequest threeDSAvailabilityRequest) throws Exception {
String jsonRequest = GSON.toJson(threeDSAvailabilityRequest);
String jsonResult = get3dsAvailability.request(jsonRequest);
return GSON.fromJson(jsonResult, new TypeToken() {
}.getType());
}
public CostEstimateResponse getCostEstimate(CostEstimateRequest costEstimateRequest) throws Exception {
String jsonRequest = GSON.toJson(costEstimateRequest);
String jsonResult = getCostEstimate.request(jsonRequest);
return GSON.fromJson(jsonResult, new TypeToken() {
}.getType());
}
}