Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion src/main/java/com/adyen/model/tapi/AccountType.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import java.util.*;
import java.util.logging.Logger;

/**
* Type of cardholder account used for the transaction. Allows a cardholder to select the type of
Expand All @@ -37,6 +38,8 @@ public enum AccountType {

UNIVERSAL("Universal");

private static final Logger LOG = Logger.getLogger(AccountType.class.getName());

private String value;

AccountType(String value) {
Expand All @@ -60,6 +63,12 @@ public static AccountType fromValue(String value) {
return b;
}
}
throw new IllegalArgumentException("Unexpected value '" + value + "'");
// handling unexpected value
LOG.warning(
Comment thread
thomasc-adyen marked this conversation as resolved.
"AccountType: unexpected enum value '"
+ value
+ "' - Supported values are "
+ Arrays.toString(AccountType.values()));
return null;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is technically a breaking change, right? In the past this would have failed and now it will return null - will we update the release notes to document the difference?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure, the nexo AccountType uses gson that implements a similar approach, without throwing an exception when the enum is unknown

  public static AccountType fromValue(String v) {
    return Arrays.stream(values()).filter(s -> s.value.equals(v)).findFirst().orElse(null);
  }

Did you mean this change? or am I missing something?

}
}
11 changes: 10 additions & 1 deletion src/main/java/com/adyen/model/tapi/Alignment.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import java.util.*;
import java.util.logging.Logger;

/** Gets or Sets Alignment */
public enum Alignment {
Expand All @@ -25,6 +26,8 @@ public enum Alignment {

RIGHT("Right");

private static final Logger LOG = Logger.getLogger(Alignment.class.getName());

private String value;

Alignment(String value) {
Expand All @@ -48,6 +51,12 @@ public static Alignment fromValue(String value) {
return b;
}
}
throw new IllegalArgumentException("Unexpected value '" + value + "'");
// handling unexpected value
LOG.warning(
Comment thread
thomasc-adyen marked this conversation as resolved.
"Alignment: unexpected enum value '"
+ value
+ "' - Supported values are "
+ Arrays.toString(Alignment.values()));
return null;
}
}
11 changes: 10 additions & 1 deletion src/main/java/com/adyen/model/tapi/CharacterHeight.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import java.util.*;
import java.util.logging.Logger;

/** Gets or Sets CharacterHeight */
public enum CharacterHeight {
Expand All @@ -23,6 +24,8 @@ public enum CharacterHeight {

SINGLE_HEIGHT("SingleHeight");

private static final Logger LOG = Logger.getLogger(CharacterHeight.class.getName());

private String value;

CharacterHeight(String value) {
Expand All @@ -46,6 +49,12 @@ public static CharacterHeight fromValue(String value) {
return b;
}
}
throw new IllegalArgumentException("Unexpected value '" + value + "'");
// handling unexpected value
LOG.warning(
"CharacterHeight: unexpected enum value '"
+ value
+ "' - Supported values are "
+ Arrays.toString(CharacterHeight.values()));
return null;
}
}
11 changes: 10 additions & 1 deletion src/main/java/com/adyen/model/tapi/CharacterStyle.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import java.util.*;
import java.util.logging.Logger;

/** Gets or Sets CharacterStyle */
public enum CharacterStyle {
Expand All @@ -25,6 +26,8 @@ public enum CharacterStyle {

UNDERLINE("Underline");

private static final Logger LOG = Logger.getLogger(CharacterStyle.class.getName());

private String value;

CharacterStyle(String value) {
Expand All @@ -48,6 +51,12 @@ public static CharacterStyle fromValue(String value) {
return b;
}
}
throw new IllegalArgumentException("Unexpected value '" + value + "'");
// handling unexpected value
LOG.warning(
"CharacterStyle: unexpected enum value '"
+ value
+ "' - Supported values are "
+ Arrays.toString(CharacterStyle.values()));
return null;
}
}
11 changes: 10 additions & 1 deletion src/main/java/com/adyen/model/tapi/CharacterWidth.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,16 @@
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import java.util.*;
import java.util.logging.Logger;

/** Gets or Sets CharacterWidth */
public enum CharacterWidth {
DOUBLE_WIDTH("DoubleWidth"),

SINGLE_WIDTH("SingleWidth");

private static final Logger LOG = Logger.getLogger(CharacterWidth.class.getName());

private String value;

CharacterWidth(String value) {
Expand All @@ -44,6 +47,12 @@ public static CharacterWidth fromValue(String value) {
return b;
}
}
throw new IllegalArgumentException("Unexpected value '" + value + "'");
// handling unexpected value
LOG.warning(
"CharacterWidth: unexpected enum value '"
+ value
+ "' - Supported values are "
+ Arrays.toString(CharacterWidth.values()));
return null;
}
}
11 changes: 10 additions & 1 deletion src/main/java/com/adyen/model/tapi/Device.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import java.util.*;
import java.util.logging.Logger;

/** Gets or Sets Device */
public enum Device {
Expand All @@ -25,6 +26,8 @@ public enum Device {

CUSTOMER_INPUT("CustomerInput");

private static final Logger LOG = Logger.getLogger(Device.class.getName());

private String value;

Device(String value) {
Expand All @@ -48,6 +51,12 @@ public static Device fromValue(String value) {
return b;
}
}
throw new IllegalArgumentException("Unexpected value '" + value + "'");
// handling unexpected value
LOG.warning(
"Device: unexpected enum value '"
+ value
+ "' - Supported values are "
+ Arrays.toString(Device.values()));
return null;
}
}
11 changes: 10 additions & 1 deletion src/main/java/com/adyen/model/tapi/DocumentQualifier.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import java.util.*;
import java.util.logging.Logger;

/** Gets or Sets DocumentQualifier */
public enum DocumentQualifier {
Expand All @@ -29,6 +30,8 @@ public enum DocumentQualifier {

VOUCHER("Voucher");

private static final Logger LOG = Logger.getLogger(DocumentQualifier.class.getName());

private String value;

DocumentQualifier(String value) {
Expand All @@ -52,6 +55,12 @@ public static DocumentQualifier fromValue(String value) {
return b;
}
}
throw new IllegalArgumentException("Unexpected value '" + value + "'");
// handling unexpected value
LOG.warning(
"DocumentQualifier: unexpected enum value '"
+ value
+ "' - Supported values are "
+ Arrays.toString(DocumentQualifier.values()));
return null;
}
}
11 changes: 10 additions & 1 deletion src/main/java/com/adyen/model/tapi/ErrorCondition.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import java.util.*;
import java.util.logging.Logger;

/** Gets or Sets ErrorCondition */
public enum ErrorCondition {
Expand Down Expand Up @@ -51,6 +52,8 @@ public enum ErrorCondition {

WRONG_PIN("WrongPIN");

private static final Logger LOG = Logger.getLogger(ErrorCondition.class.getName());

private String value;

ErrorCondition(String value) {
Expand All @@ -74,6 +77,12 @@ public static ErrorCondition fromValue(String value) {
return b;
}
}
throw new IllegalArgumentException("Unexpected value '" + value + "'");
// handling unexpected value
LOG.warning(
"ErrorCondition: unexpected enum value '"
+ value
+ "' - Supported values are "
+ Arrays.toString(ErrorCondition.values()));
return null;
}
}
11 changes: 10 additions & 1 deletion src/main/java/com/adyen/model/tapi/EventToNotify.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import java.util.*;
import java.util.logging.Logger;

/**
* Event the POI notifies to the Sale System. Possible values: * **Abort** * **BeginMaintenance** *
Expand Down Expand Up @@ -59,6 +60,8 @@ public enum EventToNotify {

USE_ANOTHER_CARD_FOR_PREAUTH("UseAnotherCardForPreauth");

private static final Logger LOG = Logger.getLogger(EventToNotify.class.getName());

private String value;

EventToNotify(String value) {
Expand All @@ -82,6 +85,12 @@ public static EventToNotify fromValue(String value) {
return b;
}
}
throw new IllegalArgumentException("Unexpected value '" + value + "'");
// handling unexpected value
LOG.warning(
"EventToNotify: unexpected enum value '"
+ value
+ "' - Supported values are "
+ Arrays.toString(EventToNotify.values()));
return null;
}
}
11 changes: 10 additions & 1 deletion src/main/java/com/adyen/model/tapi/GlobalStatus.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import java.util.*;
import java.util.logging.Logger;

/** Gets or Sets GlobalStatus */
public enum GlobalStatus {
Expand All @@ -25,6 +26,8 @@ public enum GlobalStatus {

UNREACHABLE("Unreachable");

private static final Logger LOG = Logger.getLogger(GlobalStatus.class.getName());

private String value;

GlobalStatus(String value) {
Expand All @@ -48,6 +51,12 @@ public static GlobalStatus fromValue(String value) {
return b;
}
}
throw new IllegalArgumentException("Unexpected value '" + value + "'");
// handling unexpected value
LOG.warning(
"GlobalStatus: unexpected enum value '"
+ value
+ "' - Supported values are "
+ Arrays.toString(GlobalStatus.values()));
return null;
}
}
11 changes: 10 additions & 1 deletion src/main/java/com/adyen/model/tapi/IdentificationSupport.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import java.util.*;
import java.util.logging.Logger;

/**
* Support of the loyalty account identification. Allows knowing where and how you have found the
Expand All @@ -29,6 +30,8 @@ public enum IdentificationSupport {

NO_CARD("NoCard");

private static final Logger LOG = Logger.getLogger(IdentificationSupport.class.getName());

private String value;

IdentificationSupport(String value) {
Expand All @@ -52,6 +55,12 @@ public static IdentificationSupport fromValue(String value) {
return b;
}
}
throw new IllegalArgumentException("Unexpected value '" + value + "'");
// handling unexpected value
LOG.warning(
"IdentificationSupport: unexpected enum value '"
+ value
+ "' - Supported values are "
+ Arrays.toString(IdentificationSupport.values()));
return null;
}
}
11 changes: 10 additions & 1 deletion src/main/java/com/adyen/model/tapi/IdentificationType.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import java.util.*;
import java.util.logging.Logger;

/** Gets or Sets IdentificationType */
public enum IdentificationType {
Expand All @@ -27,6 +28,8 @@ public enum IdentificationType {

PHONE_NUMBER("PhoneNumber");

private static final Logger LOG = Logger.getLogger(IdentificationType.class.getName());

private String value;

IdentificationType(String value) {
Expand All @@ -50,6 +53,12 @@ public static IdentificationType fromValue(String value) {
return b;
}
}
throw new IllegalArgumentException("Unexpected value '" + value + "'");
// handling unexpected value
LOG.warning(
"IdentificationType: unexpected enum value '"
+ value
+ "' - Supported values are "
+ Arrays.toString(IdentificationType.values()));
return null;
}
}
Loading
Loading