
com.commercetools.payment.payone.config.PayoneConfiguration Maven / Gradle / Ivy
package com.commercetools.payment.payone.config;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.sphere.sdk.payments.PaymentMethodInfo;
import io.sphere.sdk.payments.TransactionType;
import java.util.List;
import java.util.Map;
/**
* Provides the configuration values of the PayOne payment interface and its methods.
*
* Is currently read only.
*
* Created by mgatz on 7/26/16.
*/
public class PayoneConfiguration {
private String interfaceId;
private PayoneCreditCardConfiguration creditCardConfiguration;
private String handlePaymentBaseUrl;
private List enabledMethods;
private Map availableMethods;
private Map transactionTypes;
@JsonCreator
private PayoneConfiguration(@JsonProperty("interfaceId") final String interfaceId,
@JsonProperty("enabledMethods") final List enabledMethods,
@JsonProperty("availableMethods") final Map availableMethods,
@JsonProperty("transactionTypes") final Map transactionTypes,
@JsonProperty("creditCardConfig") final PayoneCreditCardConfiguration creditCardConfiguration) {
this.interfaceId = interfaceId;
this.creditCardConfiguration = creditCardConfiguration;
this.handlePaymentBaseUrl = handlePaymentBaseUrl;
this.enabledMethods = enabledMethods;
this.availableMethods = availableMethods;
this.transactionTypes = transactionTypes;
}
public String getInterfaceId() {
return interfaceId;
}
/**
* @return the configured base URL of the Payone Connectors handle interface
*/
public String getHandlePaymentBaseUrl() {
return handlePaymentBaseUrl;
}
/**
* @return the list of enabled payment methods
*/
public List getEnabledMethods() {
return enabledMethods;
}
/**
* @return the available payment method configurations mapped by their method ID
*/
public Map getAvailableMethods() {
return availableMethods;
}
/**
* @param methodId the method id to check
* @return true if the method is enabled
*/
public boolean isMethodEnabled(String methodId) {
return this.enabledMethods.contains(methodId);
}
/**
* Try finding the {@link PaymentMethodInfo} for the passed method ID.
* @param methodId the method ID
* @return the {@link PaymentMethodInfo} or null if none is found
*/
public PaymentMethodInfo getMethodInfo(String methodId) {
return this.availableMethods.get(methodId);
}
/**
* @return all configured {@link TransactionType}
*/
public Map getTransactionTypes() {
return transactionTypes;
}
/**
* Get the configured {@link TransactionType} for the passed method Id
* @param methodId the method Id
* @return the configuration {@link TransactionType}
*/
public TransactionType getTransactionType(String methodId) {
return transactionTypes.get(methodId);
}
/**
* Get the credit card related configuration values.
* @return the payone credit card configuration values
*/
public PayoneCreditCardConfiguration getCreditCardConfiguration() {
return creditCardConfiguration;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy