Skip to content
Open
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
263 changes: 263 additions & 0 deletions src/main/java/com/adyen/model/transferwebhooks/InterchangeData.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,263 @@
/*
* Transfer webhooks
*
* The version of the OpenAPI document: 4
*
*
* 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.transferwebhooks;

import com.fasterxml.jackson.annotation.JsonCreator;
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;

/** InterchangeData */
@JsonPropertyOrder({
InterchangeData.JSON_PROPERTY_INTERCHANGE_AMOUNT,
InterchangeData.JSON_PROPERTY_INTERCHANGE_RATE_INDICATOR,
InterchangeData.JSON_PROPERTY_TYPE
})
public class InterchangeData {
public static final String JSON_PROPERTY_INTERCHANGE_AMOUNT = "interchangeAmount";
private Amount interchangeAmount;

public static final String JSON_PROPERTY_INTERCHANGE_RATE_INDICATOR = "interchangeRateIndicator";
private String interchangeRateIndicator;

/**
* The type of events data. Possible values: - **interchangeData**: information about the
* interchange fee applied to a transaction.
*/
public enum TypeEnum {
INTERCHANGEDATA(String.valueOf("interchangeData"));

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;
Comment on lines +63 to +75
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

Returning null for an unknown enum value can lead to NullPointerExceptions in consuming code if not handled carefully. It's generally safer to fail fast by throwing an exception for unknown values. Consider throwing an IllegalArgumentException instead.

    public static TypeEnum fromValue(String value) {
      for (TypeEnum b : TypeEnum.values()) {
        if (b.value.equals(value)) {
          return b;
        }
      }
      throw new IllegalArgumentException("Unexpected value '" + value + "' for TypeEnum");
    }

}
}

public static final String JSON_PROPERTY_TYPE = "type";
private TypeEnum type;

public InterchangeData() {}

/**
* interchangeAmount
*
* @param interchangeAmount
* @return the current {@code InterchangeData} instance, allowing for method chaining
*/
public InterchangeData interchangeAmount(Amount interchangeAmount) {
this.interchangeAmount = interchangeAmount;
return this;
}

/**
* Get interchangeAmount
*
* @return interchangeAmount
*/
@JsonProperty(JSON_PROPERTY_INTERCHANGE_AMOUNT)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public Amount getInterchangeAmount() {
return interchangeAmount;
}

/**
* interchangeAmount
*
* @param interchangeAmount
*/
@JsonProperty(JSON_PROPERTY_INTERCHANGE_AMOUNT)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public void setInterchangeAmount(Amount interchangeAmount) {
this.interchangeAmount = interchangeAmount;
}

/**
* A 3-character alphanumeric code assigned by Visa that identifies the specific interchange
* reimbursement program a transaction qualified for. The code is assigned based on the card type,
* entry mode, and security data provided.
*
* @param interchangeRateIndicator A 3-character alphanumeric code assigned by Visa that
* identifies the specific interchange reimbursement program a transaction qualified for. The
* code is assigned based on the card type, entry mode, and security data provided.
* @return the current {@code InterchangeData} instance, allowing for method chaining
*/
public InterchangeData interchangeRateIndicator(String interchangeRateIndicator) {
this.interchangeRateIndicator = interchangeRateIndicator;
return this;
}

/**
* A 3-character alphanumeric code assigned by Visa that identifies the specific interchange
* reimbursement program a transaction qualified for. The code is assigned based on the card type,
* entry mode, and security data provided.
*
* @return interchangeRateIndicator A 3-character alphanumeric code assigned by Visa that
* identifies the specific interchange reimbursement program a transaction qualified for. The
* code is assigned based on the card type, entry mode, and security data provided.
*/
@JsonProperty(JSON_PROPERTY_INTERCHANGE_RATE_INDICATOR)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public String getInterchangeRateIndicator() {
return interchangeRateIndicator;
}

/**
* A 3-character alphanumeric code assigned by Visa that identifies the specific interchange
* reimbursement program a transaction qualified for. The code is assigned based on the card type,
* entry mode, and security data provided.
*
* @param interchangeRateIndicator A 3-character alphanumeric code assigned by Visa that
* identifies the specific interchange reimbursement program a transaction qualified for. The
* code is assigned based on the card type, entry mode, and security data provided.
*/
@JsonProperty(JSON_PROPERTY_INTERCHANGE_RATE_INDICATOR)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public void setInterchangeRateIndicator(String interchangeRateIndicator) {
this.interchangeRateIndicator = interchangeRateIndicator;
}

/**
* The type of events data. Possible values: - **interchangeData**: information about the
* interchange fee applied to a transaction.
*
* @param type The type of events data. Possible values: - **interchangeData**: information about
* the interchange fee applied to a transaction.
* @return the current {@code InterchangeData} instance, allowing for method chaining
*/
public InterchangeData type(TypeEnum type) {
this.type = type;
return this;
}

/**
* The type of events data. Possible values: - **interchangeData**: information about the
* interchange fee applied to a transaction.
*
* @return type The type of events data. Possible values: - **interchangeData**: information about
* the interchange fee applied to a transaction.
*/
@JsonProperty(JSON_PROPERTY_TYPE)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public TypeEnum getType() {
return type;
}

/**
* The type of events data. Possible values: - **interchangeData**: information about the
* interchange fee applied to a transaction.
*
* @param type The type of events data. Possible values: - **interchangeData**: information about
* the interchange fee applied to a transaction.
*/
@JsonProperty(JSON_PROPERTY_TYPE)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public void setType(TypeEnum type) {
this.type = type;
}

/** Return true if this InterchangeData object is equal to o. */
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
InterchangeData interchangeData = (InterchangeData) o;
return Objects.equals(this.interchangeAmount, interchangeData.interchangeAmount)
&& Objects.equals(this.interchangeRateIndicator, interchangeData.interchangeRateIndicator)
&& Objects.equals(this.type, interchangeData.type);
}

@Override
public int hashCode() {
return Objects.hash(interchangeAmount, interchangeRateIndicator, type);
}

@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class InterchangeData {\n");
sb.append(" interchangeAmount: ").append(toIndentedString(interchangeAmount)).append("\n");
sb.append(" interchangeRateIndicator: ")
.append(toIndentedString(interchangeRateIndicator))
.append("\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 ");
}

/**
* Create an instance of InterchangeData given an JSON string
*
* @param jsonString JSON string
* @return An instance of InterchangeData
* @throws JsonProcessingException if the JSON string is invalid with respect to InterchangeData
*/
public static InterchangeData fromJson(String jsonString) throws JsonProcessingException {
return JSON.getMapper().readValue(jsonString, InterchangeData.class);
}

/**
* Convert an instance of InterchangeData to an JSON string
*
* @return JSON string
*/
public String toJson() throws JsonProcessingException {
return JSON.getMapper().writeValueAsString(this);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,8 @@ public enum StatusEnum {

FEEPENDING(String.valueOf("feePending")),

INTERCHANGEADJUSTED(String.valueOf("interchangeAdjusted")),

INTERNALTRANSFER(String.valueOf("internalTransfer")),

INTERNALTRANSFERPENDING(String.valueOf("internalTransferPending")),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -517,6 +517,8 @@ public enum StatusEnum {

FEEPENDING(String.valueOf("feePending")),

INTERCHANGEADJUSTED(String.valueOf("interchangeAdjusted")),

INTERNALTRANSFER(String.valueOf("internalTransfer")),

INTERNALTRANSFERPENDING(String.valueOf("internalTransferPending")),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,8 @@ public enum StatusEnum {

FEEPENDING(String.valueOf("feePending")),

INTERCHANGEADJUSTED(String.valueOf("interchangeAdjusted")),

INTERNALTRANSFER(String.valueOf("internalTransfer")),

INTERNALTRANSFERPENDING(String.valueOf("internalTransferPending")),
Expand Down Expand Up @@ -474,6 +476,8 @@ public static StatusEnum fromValue(String value) {
public enum TypeEnum {
ACCOUNTING(String.valueOf("accounting")),

TRACING(String.valueOf("tracing")),
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

With the addition of the TRACING enum member, the Javadoc for TypeEnum on line 475 is now outdated and could mislead developers. Please update it to include tracing as a possible value.

Suggested Javadoc:

/** The type of the transfer event. Possible values: **accounting**, **tracing**, **tracking**. */


TRACKING(String.valueOf("tracking"));

private static final Logger LOG = Logger.getLogger(TypeEnum.class.getName());
Expand Down
Loading