Skip to content
Closed
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
8 changes: 4 additions & 4 deletions sdk-generation-log/configurationwebhooks.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"service": "configurationwebhooks",
"project": "java",
"generatedAt": "2026-06-02T15:30:09Z",
"openapiCommitSha": "f3894fd6b47d9076841b04852378251de3bba2de",
"automationCommitSha": "6f06b47d0661f0891defe6b85461d2c367fbd284",
"libraryCommitSha": "9539e092f2160ca341916c804f01f0f699a64415"
"generatedAt": "2026-07-23T13:25:47Z",
"openapiCommitSha": "06d031500a5565d326553c6b0d14c3c79d13a1eb",
"automationCommitSha": "0c108bd8050cf480d2710b78b770afdfbdd89397",
"libraryCommitSha": "7f01d8c3c98591abf7cf85a4db7b7ff76aa7e66b"
}
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,53 @@ public Optional<ScoreNotificationRequest> getScoreNotificationRequest() {
return Optional.empty();
}

/**
* Attempts to deserialize the webhook payload into a TopUpConfigurationEventRequest
*
* @return an Optional containing the deserialized object, or empty if deserialization fails
*/
public Optional<TopUpConfigurationEventRequest> getTopUpConfigurationEventRequest() {

var optionalTopUpConfigurationEventRequest =
getOptionalField(TopUpConfigurationEventRequest.class);

if (optionalTopUpConfigurationEventRequest.isPresent()) {
// verify event type
for (var value : TopUpConfigurationEventRequest.TypeEnum.values()) {
if (value.equals(optionalTopUpConfigurationEventRequest.get().getType())) {
// found matching event type
return optionalTopUpConfigurationEventRequest;
}
}
}
Comment on lines +323 to +331

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.

medium

The loop verifying the event type is redundant. Since getType() returns a TopUpConfigurationEventRequest.TypeEnum, any non-null value is guaranteed to be a valid enum constant. Additionally, calling TypeEnum.values() clones the underlying array on every invocation, which introduces unnecessary memory allocation and garbage collection overhead. We can simplify this to a direct null check.

    if (optionalTopUpConfigurationEventRequest.isPresent() && optionalTopUpConfigurationEventRequest.get().getType() != null) {
      return optionalTopUpConfigurationEventRequest;
    }


return Optional.empty();
}

/**
* Attempts to deserialize the webhook payload into a TopUpConfigurationUpdatedEventRequest
*
* @return an Optional containing the deserialized object, or empty if deserialization fails
*/
public Optional<TopUpConfigurationUpdatedEventRequest>
getTopUpConfigurationUpdatedEventRequest() {

var optionalTopUpConfigurationUpdatedEventRequest =
getOptionalField(TopUpConfigurationUpdatedEventRequest.class);

if (optionalTopUpConfigurationUpdatedEventRequest.isPresent()) {
// verify event type
for (var value : TopUpConfigurationUpdatedEventRequest.TypeEnum.values()) {
if (value.equals(optionalTopUpConfigurationUpdatedEventRequest.get().getType())) {
// found matching event type
return optionalTopUpConfigurationUpdatedEventRequest;
}
}
}
Comment on lines +347 to +355

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.

medium

The loop verifying the event type is redundant. Since getType() returns a TopUpConfigurationUpdatedEventRequest.TypeEnum, any non-null value is guaranteed to be a valid enum constant. Additionally, calling TypeEnum.values() clones the underlying array on every invocation, which introduces unnecessary memory allocation and garbage collection overhead. We can simplify this to a direct null check.

    if (optionalTopUpConfigurationUpdatedEventRequest.isPresent() && optionalTopUpConfigurationUpdatedEventRequest.get().getType() != null) {
      return optionalTopUpConfigurationUpdatedEventRequest;
    }


return Optional.empty();
}

/**
* Deserializes the payload into the specified class type.
*
Expand Down
41 changes: 21 additions & 20 deletions src/main/java/com/adyen/model/configurationwebhooks/Mandate.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import com.fasterxml.jackson.annotation.JsonValue;
import com.fasterxml.jackson.core.JsonProcessingException;
import java.time.OffsetDateTime;
import java.util.*;
import java.util.Arrays;
import java.util.logging.Logger;
Expand All @@ -40,7 +41,7 @@ public class Mandate {
private MandateBankAccount counterparty;

public static final String JSON_PROPERTY_CREATED_AT = "createdAt";
private Object createdAt;
private OffsetDateTime createdAt;

public static final String JSON_PROPERTY_ID = "id";
private String id;
Expand Down Expand Up @@ -137,7 +138,7 @@ public static TypeEnum fromValue(String value) {
private TypeEnum type;

public static final String JSON_PROPERTY_UPDATED_AT = "updatedAt";
private Object updatedAt;
private OffsetDateTime updatedAt;

public Mandate() {}

Expand Down Expand Up @@ -211,35 +212,35 @@ public void setCounterparty(MandateBankAccount counterparty) {
}

/**
* createdAt
* The date when the mandate was created.
*
* @param createdAt
* @param createdAt The date when the mandate was created.
* @return the current {@code Mandate} instance, allowing for method chaining
*/
public Mandate createdAt(Object createdAt) {
public Mandate createdAt(OffsetDateTime createdAt) {
this.createdAt = createdAt;
return this;
}

/**
* Get createdAt
* The date when the mandate was created.
*
* @return createdAt
* @return createdAt The date when the mandate was created.
*/
@JsonProperty(JSON_PROPERTY_CREATED_AT)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public Object getCreatedAt() {
public OffsetDateTime getCreatedAt() {
return createdAt;
}

/**
* createdAt
* The date when the mandate was created.
*
* @param createdAt
* @param createdAt The date when the mandate was created.
*/
@JsonProperty(JSON_PROPERTY_CREATED_AT)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public void setCreatedAt(Object createdAt) {
public void setCreatedAt(OffsetDateTime createdAt) {
this.createdAt = createdAt;
}

Expand Down Expand Up @@ -382,35 +383,35 @@ public void setType(TypeEnum type) {
}

/**
* updatedAt
* The date when the mandate was updated.
*
* @param updatedAt
* @param updatedAt The date when the mandate was updated.
* @return the current {@code Mandate} instance, allowing for method chaining
*/
public Mandate updatedAt(Object updatedAt) {
public Mandate updatedAt(OffsetDateTime updatedAt) {
this.updatedAt = updatedAt;
return this;
}

/**
* Get updatedAt
* The date when the mandate was updated.
*
* @return updatedAt
* @return updatedAt The date when the mandate was updated.
*/
@JsonProperty(JSON_PROPERTY_UPDATED_AT)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public Object getUpdatedAt() {
public OffsetDateTime getUpdatedAt() {
return updatedAt;
}

/**
* updatedAt
* The date when the mandate was updated.
*
* @param updatedAt
* @param updatedAt The date when the mandate was updated.
*/
@JsonProperty(JSON_PROPERTY_UPDATED_AT)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public void setUpdatedAt(Object updatedAt) {
public void setUpdatedAt(OffsetDateTime updatedAt) {
this.updatedAt = updatedAt;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,13 @@ public MandateBankAccountAccountIdentification(UKLocalMandateAccountIdentificati
new GenericType<UKLocalMandateAccountIdentification>() {});
JSON.registerDescendants(
MandateBankAccountAccountIdentification.class, Collections.unmodifiableMap(schemas));
// Initialize and register the discriminator mappings.
Map<String, Class<?>> mappings = new HashMap<>();
mappings.put("ukLocal", UKLocalMandateAccountIdentification.class);
mappings.put("UKLocalMandateAccountIdentification", UKLocalMandateAccountIdentification.class);
mappings.put(
"MandateBankAccount_accountIdentification", MandateBankAccountAccountIdentification.class);
JSON.registerDiscriminator(MandateBankAccountAccountIdentification.class, "type", mappings);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,15 @@ public PaymentInstrumentAdditionalBankAccountIdentificationsInner(IbanAccountIde
JSON.registerDescendants(
PaymentInstrumentAdditionalBankAccountIdentificationsInner.class,
Collections.unmodifiableMap(schemas));
// Initialize and register the discriminator mappings.
Map<String, Class<?>> mappings = new HashMap<>();
mappings.put("iban", IbanAccountIdentification.class);
mappings.put("IbanAccountIdentification", IbanAccountIdentification.class);
mappings.put(
"PaymentInstrument_additionalBankAccountIdentifications_inner",
PaymentInstrumentAdditionalBankAccountIdentificationsInner.class);
JSON.registerDiscriminator(
PaymentInstrumentAdditionalBankAccountIdentificationsInner.class, "type", mappings);
}

@Override
Expand Down
Loading