com.adyen.service.Recurring 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
/*
* ######
* ######
* ############ ####( ###### #####. ###### ############ ############
* ############# #####( ###### #####. ###### ############# #############
* ###### #####( ###### #####. ###### ##### ###### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ######
* ############# ############# ############# ############# ##### ######
* ############ ############ ############# ############ ##### ######
* ######
* #############
* ############
*
* Adyen Java API Library
*
* Copyright (c) 2020 Adyen B.V.
* This file is open source and available under the MIT license.
* See the LICENSE file for more info.
*/
package com.adyen.service;
import com.adyen.Client;
import com.adyen.Service;
import com.adyen.model.recurring.DisableRequest;
import com.adyen.model.recurring.DisableResult;
import com.adyen.model.recurring.RecurringDetailsRequest;
import com.adyen.model.recurring.RecurringDetailsResult;
import com.adyen.model.recurring.StoreTokenRequest;
import com.adyen.model.recurring.StoreTokenResult;
import com.adyen.model.recurring.ScheduleAccountUpdaterRequest;
import com.adyen.model.recurring.ScheduleAccountUpdaterResult;
import com.adyen.service.exception.ApiException;
import com.adyen.service.resource.recurring.Disable;
import com.adyen.service.resource.recurring.ListRecurringDetails;
import com.adyen.service.resource.recurring.ScheduleAccountUpdater;
import com.adyen.service.resource.recurring.StoreToken;
import com.google.gson.reflect.TypeToken;
import java.io.IOException;
public class Recurring extends Service {
private ListRecurringDetails listRecurringDetails;
private Disable disable;
private StoreToken storeToken;
private ScheduleAccountUpdater scheduleAccountUpdater;
public Recurring(Client client) {
super(client);
listRecurringDetails = new ListRecurringDetails(this);
disable = new Disable(this);
storeToken = new StoreToken(this);
scheduleAccountUpdater = new ScheduleAccountUpdater(this);
}
/**
* Issues a listRecurringDetails API call
*
* @param request RecurringDetailsResult
* @return recurring details result
* @throws IOException IOException
* @throws ApiException ApiException
*/
public RecurringDetailsResult listRecurringDetails(RecurringDetailsRequest request) throws IOException, ApiException {
String jsonRequest = GSON.toJson(request);
String jsonResult = listRecurringDetails.request(jsonRequest);
return GSON.fromJson(jsonResult, new TypeToken() {
}.getType());
}
/**
* Issues a disable recurring contract API call
*
* @param request DisableRequest
* @return DisableResult
* @throws IOException IOException
* @throws ApiException ApiException
*/
public DisableResult disable(DisableRequest request) throws IOException, ApiException {
String jsonRequest = GSON.toJson(request);
String jsonResult = disable.request(jsonRequest);
return GSON.fromJson(jsonResult, new TypeToken() {
}.getType());
}
/**
* Issues a storeToken API call
*
* @param request StoreTokenRequest
* @return StoreTokenResult
* @throws IOException IOException
* @throws ApiException ApiException
*/
public StoreTokenResult storeToken(StoreTokenRequest request) throws IOException, ApiException {
String jsonRequest = GSON.toJson(request);
String jsonResult = storeToken.request(jsonRequest);
return GSON.fromJson(jsonResult, new TypeToken() {
}.getType());
}
/**
* Issues a scheduleAccountUpdate API call
*
* @param request ScheduleAccountUpdaterRequest
* @return ScheduleAccountUpdaterResult
* @throws IOException IOException
* @throws ApiException ApiException
*/
public ScheduleAccountUpdaterResult scheduleAccountUpdater(ScheduleAccountUpdaterRequest request) throws IOException, ApiException {
String jsonRequest = GSON.toJson(request);
String jsonResult = scheduleAccountUpdater.request(jsonRequest);
return GSON.fromJson(jsonResult, new TypeToken() {
}.getType());
}
}