diff --git a/src/main/java/com/adyen/model/management/ForceRebootDetails.java b/src/main/java/com/adyen/model/management/ForceRebootDetails.java new file mode 100644 index 000000000..f9191c270 --- /dev/null +++ b/src/main/java/com/adyen/model/management/ForceRebootDetails.java @@ -0,0 +1,219 @@ +/* + * Management API + * + * The version of the OpenAPI document: 3 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.adyen.model.management; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.core.JsonProcessingException; +import java.util.*; +import java.util.Arrays; +import java.util.logging.Logger; + +/** ForceRebootDetails */ +@JsonPropertyOrder({ForceRebootDetails.JSON_PROPERTY_TYPE}) +public class ForceRebootDetails { + /** Type of terminal action: Force Reboot. */ + public enum TypeEnum { + FORCEREBOOT(String.valueOf("ForceReboot")); + + private static final Logger LOG = Logger.getLogger(TypeEnum.class.getName()); + + private String value; + + TypeEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static TypeEnum fromValue(String value) { + for (TypeEnum b : TypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + // handling unexpected value + LOG.warning( + "TypeEnum: unexpected enum value '" + + value + + "' - Supported values are " + + Arrays.toString(TypeEnum.values())); + return null; + } + } + + public static final String JSON_PROPERTY_TYPE = "type"; + private TypeEnum type; + + /** Mark when the attribute has been explicitly set. */ + private boolean isSetType = false; + + /** + * Sets whether attributes with null values should be explicitly included in the JSON payload. + * Default is false. + */ + @JsonIgnore private boolean includeNullValues = false; + + public ForceRebootDetails() {} + + /** + * Type of terminal action: Force Reboot. + * + * @param type Type of terminal action: Force Reboot. + * @return the current {@code ForceRebootDetails} instance, allowing for method chaining + */ + public ForceRebootDetails type(TypeEnum type) { + this.type = type; + isSetType = true; // mark as set + return this; + } + + /** + * Type of terminal action: Force Reboot. + * + * @return type Type of terminal action: Force Reboot. + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public TypeEnum getType() { + return type; + } + + /** + * Type of terminal action: Force Reboot. + * + * @param type Type of terminal action: Force Reboot. + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setType(TypeEnum type) { + this.type = type; + isSetType = true; // mark as set + } + + /** + * Configures whether null values are explicitly serialized in the JSON payload. Default is false. + */ + public ForceRebootDetails includeNullValues(boolean includeNullValues) { + this.includeNullValues = includeNullValues; + return this; + } + + /** Returns whether null values are explicitly serialized in the JSON payload. */ + public boolean isIncludeNullValues() { + return includeNullValues; + } + + /** + * Sets whether null values should be explicitly serialized in the JSON payload. Default is false. + */ + public void setIncludeNullValues(boolean includeNullValues) { + this.includeNullValues = includeNullValues; + } + + /** Return true if this ForceRebootDetails object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ForceRebootDetails forceRebootDetails = (ForceRebootDetails) o; + return Objects.equals(this.type, forceRebootDetails.type) + && Objects.equals(this.isSetType, forceRebootDetails.isSetType); + } + + @Override + public int hashCode() { + return Objects.hash(type, isSetType); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ForceRebootDetails {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + /** Returns a map of properties to be merged into the JSON payload as explicit null values. */ + @JsonInclude(JsonInclude.Include.ALWAYS) + @JsonAnyGetter + public Map getExplicitNulls() { + if (!this.includeNullValues) { + return Collections.emptyMap(); + } + + Map nulls = new HashMap<>(); + + if (isSetType) { + addIfNull(nulls, JSON_PROPERTY_TYPE, this.type); + } + + return nulls; + } + + // add to map when value is null + private void addIfNull(Map map, String key, Object value) { + if (value == null) { + map.put(key, null); + } + } + + /** + * Create an instance of ForceRebootDetails given an JSON string + * + * @param jsonString JSON string + * @return An instance of ForceRebootDetails + * @throws JsonProcessingException if the JSON string is invalid with respect to + * ForceRebootDetails + */ + public static ForceRebootDetails fromJson(String jsonString) throws JsonProcessingException { + return JSON.getMapper().readValue(jsonString, ForceRebootDetails.class); + } + + /** + * Convert an instance of ForceRebootDetails to an JSON string + * + * @return JSON string + */ + public String toJson() throws JsonProcessingException { + return JSON.getMapper().writeValueAsString(this); + } +} diff --git a/src/main/java/com/adyen/model/management/Moto.java b/src/main/java/com/adyen/model/management/Moto.java index 27b27e585..208d44d96 100644 --- a/src/main/java/com/adyen/model/management/Moto.java +++ b/src/main/java/com/adyen/model/management/Moto.java @@ -20,11 +20,7 @@ import java.util.*; /** Moto */ -@JsonPropertyOrder({ - Moto.JSON_PROPERTY_ENABLE_MOTO, - Moto.JSON_PROPERTY_ENABLE_REFUNDS, - Moto.JSON_PROPERTY_MAX_AMOUNT -}) +@JsonPropertyOrder({Moto.JSON_PROPERTY_ENABLE_MOTO, Moto.JSON_PROPERTY_MAX_AMOUNT}) public class Moto { public static final String JSON_PROPERTY_ENABLE_MOTO = "enableMoto"; private Boolean enableMoto; @@ -32,12 +28,6 @@ public class Moto { /** Mark when the attribute has been explicitly set. */ private boolean isSetEnableMoto = false; - public static final String JSON_PROPERTY_ENABLE_REFUNDS = "enableRefunds"; - private Boolean enableRefunds; - - /** Mark when the attribute has been explicitly set. */ - private boolean isSetEnableRefunds = false; - public static final String JSON_PROPERTY_MAX_AMOUNT = "maxAmount"; private Integer maxAmount; @@ -87,41 +77,6 @@ public void setEnableMoto(Boolean enableMoto) { isSetEnableMoto = true; // mark as set } - /** - * Enable MOTO refunds. - * - * @param enableRefunds Enable MOTO refunds. - * @return the current {@code Moto} instance, allowing for method chaining - */ - public Moto enableRefunds(Boolean enableRefunds) { - this.enableRefunds = enableRefunds; - isSetEnableRefunds = true; // mark as set - return this; - } - - /** - * Enable MOTO refunds. - * - * @return enableRefunds Enable MOTO refunds. - */ - @JsonProperty(JSON_PROPERTY_ENABLE_REFUNDS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public Boolean getEnableRefunds() { - return enableRefunds; - } - - /** - * Enable MOTO refunds. - * - * @param enableRefunds Enable MOTO refunds. - */ - @JsonProperty(JSON_PROPERTY_ENABLE_REFUNDS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setEnableRefunds(Boolean enableRefunds) { - this.enableRefunds = enableRefunds; - isSetEnableRefunds = true; // mark as set - } - /** * The maximum amount for MOTO transactions. You need to set the currency for this amount using * the @@ -207,16 +162,13 @@ public boolean equals(Object o) { Moto moto = (Moto) o; return Objects.equals(this.enableMoto, moto.enableMoto) && Objects.equals(this.isSetEnableMoto, moto.isSetEnableMoto) - && Objects.equals(this.enableRefunds, moto.enableRefunds) - && Objects.equals(this.isSetEnableRefunds, moto.isSetEnableRefunds) && Objects.equals(this.maxAmount, moto.maxAmount) && Objects.equals(this.isSetMaxAmount, moto.isSetMaxAmount); } @Override public int hashCode() { - return Objects.hash( - enableMoto, isSetEnableMoto, enableRefunds, isSetEnableRefunds, maxAmount, isSetMaxAmount); + return Objects.hash(enableMoto, isSetEnableMoto, maxAmount, isSetMaxAmount); } @Override @@ -224,7 +176,6 @@ public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class Moto {\n"); sb.append(" enableMoto: ").append(toIndentedString(enableMoto)).append("\n"); - sb.append(" enableRefunds: ").append(toIndentedString(enableRefunds)).append("\n"); sb.append(" maxAmount: ").append(toIndentedString(maxAmount)).append("\n"); sb.append("}"); return sb.toString(); @@ -253,9 +204,6 @@ public Map getExplicitNulls() { if (isSetEnableMoto) { addIfNull(nulls, JSON_PROPERTY_ENABLE_MOTO, this.enableMoto); } - if (isSetEnableRefunds) { - addIfNull(nulls, JSON_PROPERTY_ENABLE_REFUNDS, this.enableRefunds); - } if (isSetMaxAmount) { addIfNull(nulls, JSON_PROPERTY_MAX_AMOUNT, this.maxAmount); } diff --git a/src/main/java/com/adyen/model/management/Payment.java b/src/main/java/com/adyen/model/management/Payment.java index 02ac77659..67c707189 100644 --- a/src/main/java/com/adyen/model/management/Payment.java +++ b/src/main/java/com/adyen/model/management/Payment.java @@ -49,12 +49,16 @@ public class Payment { public Payment() {} /** - * The default currency for contactless payments on the payment terminal, as the three-letter [ISO - * 4217](https://en.wikipedia.org/wiki/ISO_4217) currency code. + * The default currency for contactless payments on the payment terminal, in three-letter [ISO + * 4217](https://en.wikipedia.org/wiki/ISO_4217) currency code format. Contact Adyen before you + * update this setting for the first time. To enable you to change the contactless currency, we + * first need to check if you meet the compliance requirements. * * @param contactlessCurrency The default currency for contactless payments on the payment - * terminal, as the three-letter [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) currency - * code. + * terminal, in three-letter [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) currency code + * format. Contact Adyen before you update this setting for the first time. To enable you to + * change the contactless currency, we first need to check if you meet the compliance + * requirements. * @return the current {@code Payment} instance, allowing for method chaining */ public Payment contactlessCurrency(String contactlessCurrency) { @@ -64,12 +68,16 @@ public Payment contactlessCurrency(String contactlessCurrency) { } /** - * The default currency for contactless payments on the payment terminal, as the three-letter [ISO - * 4217](https://en.wikipedia.org/wiki/ISO_4217) currency code. + * The default currency for contactless payments on the payment terminal, in three-letter [ISO + * 4217](https://en.wikipedia.org/wiki/ISO_4217) currency code format. Contact Adyen before you + * update this setting for the first time. To enable you to change the contactless currency, we + * first need to check if you meet the compliance requirements. * * @return contactlessCurrency The default currency for contactless payments on the payment - * terminal, as the three-letter [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) currency - * code. + * terminal, in three-letter [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) currency code + * format. Contact Adyen before you update this setting for the first time. To enable you to + * change the contactless currency, we first need to check if you meet the compliance + * requirements. */ @JsonProperty(JSON_PROPERTY_CONTACTLESS_CURRENCY) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -78,12 +86,16 @@ public String getContactlessCurrency() { } /** - * The default currency for contactless payments on the payment terminal, as the three-letter [ISO - * 4217](https://en.wikipedia.org/wiki/ISO_4217) currency code. + * The default currency for contactless payments on the payment terminal, in three-letter [ISO + * 4217](https://en.wikipedia.org/wiki/ISO_4217) currency code format. Contact Adyen before you + * update this setting for the first time. To enable you to change the contactless currency, we + * first need to check if you meet the compliance requirements. * * @param contactlessCurrency The default currency for contactless payments on the payment - * terminal, as the three-letter [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) currency - * code. + * terminal, in three-letter [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) currency code + * format. Contact Adyen before you update this setting for the first time. To enable you to + * change the contactless currency, we first need to check if you meet the compliance + * requirements. */ @JsonProperty(JSON_PROPERTY_CONTACTLESS_CURRENCY) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) diff --git a/src/main/java/com/adyen/model/management/PaymentMethodResponse.java b/src/main/java/com/adyen/model/management/PaymentMethodResponse.java index 39057ab7c..ac0d52891 100644 --- a/src/main/java/com/adyen/model/management/PaymentMethodResponse.java +++ b/src/main/java/com/adyen/model/management/PaymentMethodResponse.java @@ -108,6 +108,8 @@ public enum TypesWithErrorsEnum { BLIK(String.valueOf("blik")), + BLIK_POS(String.valueOf("blik_pos")), + BR_SCHEMES(String.valueOf("br_schemes")), CARTEBANCAIRE(String.valueOf("cartebancaire")), diff --git a/src/main/java/com/adyen/model/management/PaymentMethodSetupInfo.java b/src/main/java/com/adyen/model/management/PaymentMethodSetupInfo.java index 151a3b89f..96f81da91 100644 --- a/src/main/java/com/adyen/model/management/PaymentMethodSetupInfo.java +++ b/src/main/java/com/adyen/model/management/PaymentMethodSetupInfo.java @@ -459,6 +459,8 @@ public enum TypeEnum { BLIK(String.valueOf("blik")), + BLIK_POS(String.valueOf("blik_pos")), + BR_SCHEMES(String.valueOf("br_schemes")), CARTEBANCAIRE(String.valueOf("cartebancaire")), diff --git a/src/main/java/com/adyen/model/management/ScheduleTerminalActionsRequestActionDetails.java b/src/main/java/com/adyen/model/management/ScheduleTerminalActionsRequestActionDetails.java index 94436e76c..3381a85ad 100644 --- a/src/main/java/com/adyen/model/management/ScheduleTerminalActionsRequestActionDetails.java +++ b/src/main/java/com/adyen/model/management/ScheduleTerminalActionsRequestActionDetails.java @@ -84,6 +84,32 @@ public ScheduleTerminalActionsRequestActionDetails deserialize( boolean typeCoercion = ctxt.isEnabled(MapperFeature.ALLOW_COERCION_OF_SCALARS); int match = 0; JsonToken token = tree.traverse(jp.getCodec()).nextToken(); + // deserialize ForceRebootDetails + try { + boolean attemptParsing = true; + if (attemptParsing) { + // Checks if the unique type of the oneOf json matches any of the object TypeEnum values + boolean typeMatch = false; + if (tree.findValue("type") != null) { + typeMatch = + Arrays.stream(ForceRebootDetails.TypeEnum.values()) + .anyMatch((t) -> t.getValue().equals(tree.findValue("type").asText())); + } + + if (typeMatch) { + deserialized = tree.traverse(jp.getCodec()).readValueAs(ForceRebootDetails.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + match++; + log.log(Level.FINER, "Input data matches schema 'ForceRebootDetails'"); + } + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'ForceRebootDetails'", e); + } + // deserialize InstallAndroidAppDetails try { boolean attemptParsing = true; @@ -249,6 +275,11 @@ public ScheduleTerminalActionsRequestActionDetails() { super("oneOf", Boolean.FALSE); } + public ScheduleTerminalActionsRequestActionDetails(ForceRebootDetails o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + public ScheduleTerminalActionsRequestActionDetails(InstallAndroidAppDetails o) { super("oneOf", Boolean.FALSE); setActualInstance(o); @@ -275,6 +306,7 @@ public ScheduleTerminalActionsRequestActionDetails(UninstallAndroidCertificateDe } static { + schemas.put("ForceRebootDetails", new GenericType() {}); schemas.put("InstallAndroidAppDetails", new GenericType() {}); schemas.put( "InstallAndroidCertificateDetails", new GenericType() {}); @@ -294,14 +326,20 @@ public Map> getSchemas() { /** * Set the instance that matches the oneOf child schema, check the instance parameter is valid - * against the oneOf child schemas: InstallAndroidAppDetails, InstallAndroidCertificateDetails, - * ReleaseUpdateDetails, UninstallAndroidAppDetails, UninstallAndroidCertificateDetails + * against the oneOf child schemas: ForceRebootDetails, InstallAndroidAppDetails, + * InstallAndroidCertificateDetails, ReleaseUpdateDetails, UninstallAndroidAppDetails, + * UninstallAndroidCertificateDetails * *

It could be an instance of the 'oneOf' schemas. The oneOf child schemas may themselves be a * composed schema (allOf, anyOf, oneOf). */ @Override public void setActualInstance(Object instance) { + if (JSON.isInstanceOf(ForceRebootDetails.class, instance, new HashSet<>())) { + super.setActualInstance(instance); + return; + } + if (JSON.isInstanceOf(InstallAndroidAppDetails.class, instance, new HashSet<>())) { super.setActualInstance(instance); return; @@ -328,22 +366,34 @@ public void setActualInstance(Object instance) { } throw new RuntimeException( - "Invalid instance type. Must be InstallAndroidAppDetails, InstallAndroidCertificateDetails, ReleaseUpdateDetails, UninstallAndroidAppDetails, UninstallAndroidCertificateDetails"); + "Invalid instance type. Must be ForceRebootDetails, InstallAndroidAppDetails, InstallAndroidCertificateDetails, ReleaseUpdateDetails, UninstallAndroidAppDetails, UninstallAndroidCertificateDetails"); } /** - * Get the actual instance, which can be the following: InstallAndroidAppDetails, - * InstallAndroidCertificateDetails, ReleaseUpdateDetails, UninstallAndroidAppDetails, - * UninstallAndroidCertificateDetails + * Get the actual instance, which can be the following: ForceRebootDetails, + * InstallAndroidAppDetails, InstallAndroidCertificateDetails, ReleaseUpdateDetails, + * UninstallAndroidAppDetails, UninstallAndroidCertificateDetails * - * @return The actual instance (InstallAndroidAppDetails, InstallAndroidCertificateDetails, - * ReleaseUpdateDetails, UninstallAndroidAppDetails, UninstallAndroidCertificateDetails) + * @return The actual instance (ForceRebootDetails, InstallAndroidAppDetails, + * InstallAndroidCertificateDetails, ReleaseUpdateDetails, UninstallAndroidAppDetails, + * UninstallAndroidCertificateDetails) */ @Override public Object getActualInstance() { return super.getActualInstance(); } + /** + * Get the actual instance of `ForceRebootDetails`. If the actual instance is not + * `ForceRebootDetails`, the ClassCastException will be thrown. + * + * @return The actual instance of `ForceRebootDetails` + * @throws ClassCastException if the instance is not `ForceRebootDetails` + */ + public ForceRebootDetails getForceRebootDetails() throws ClassCastException { + return (ForceRebootDetails) super.getActualInstance(); + } + /** * Get the actual instance of `InstallAndroidAppDetails`. If the actual instance is not * `InstallAndroidAppDetails`, the ClassCastException will be thrown.