com.global.api.entities.RecurringEntity Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of globalpayments-sdk Show documentation
Show all versions of globalpayments-sdk Show documentation
API for processing payments through Global Payments
package com.global.api.entities;
import com.global.api.ServicesContainer;
import com.global.api.entities.exceptions.ApiException;
import com.global.api.entities.exceptions.UnsupportedTransactionException;
import com.global.api.gateways.IRecurringGateway;
import com.global.api.services.RecurringService;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
public abstract class RecurringEntity implements IRecurringEntity {
protected String id;
protected String key;
protected String responseCode;
protected String responseMessage;
private RecurringService recurringService;
public String getKey() {
if(key != null)
return key;
else return id;
}
protected RecurringEntity() {
this.recurringService = new RecurringService();
}
public TResult create() throws ApiException {
return create("default");
}
public TResult create(String configName) throws ApiException {
return create(configName);
}
protected static void checkSupportsRetrieval(String configName) throws ApiException {
IRecurringGateway client = ServicesContainer.getInstance().getRecurring(configName);
if(!client.supportsRetrieval())
throw new UnsupportedTransactionException();
}
}