com.global.api.utils.EnumUtils 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.utils;
import com.global.api.entities.enums.*;
public class EnumUtils {
public static & IByteConstant> boolean isDefined(Class valueType, byte value){
return parse(valueType, value) != null;
}
public static & IByteConstant> V parse(Class valueType, byte value) {
ReverseByteEnumMap map = new ReverseByteEnumMap(valueType);
return map.get(value);
}
public static & IStringConstant> V parse(Class valueType, String value) {
ReverseStringEnumMap map = new ReverseStringEnumMap(valueType);
return map.get(value);
}
public static & INumericConstant> V parse(Class valueType, int value) {
ReverseIntEnumMap map = new ReverseIntEnumMap(valueType);
return map.get(value);
}
public static String getMapping(Target target, IMappedConstant value) {
return (value != null) ? value.getValue(target) : null;
}
public static String mapDigitalWalletType(Target target, MobilePaymentMethodType type) {
if (target == Target.GP_API) {
switch (type) {
case APPLEPAY:
return EncyptedMobileType.APPLE_PAY.getValue();
case GOOGLEPAY:
return EncyptedMobileType.GOOGLE_PAY.getValue();
case CLICK_TO_PAY:
return EncyptedMobileType.CLICK_TO_PAY.getValue();
}
}
return null;
}
}