Skip to content

Commit

Permalink
rename Transfers service to TransfersApi and move capital endpoints i…
Browse files Browse the repository at this point in the history
…nto TransfersApi (#1072)
  • Loading branch information
wboereboom authored Jul 6, 2023
1 parent 34c3387 commit 1ba3bba
Show file tree
Hide file tree
Showing 56 changed files with 4,547 additions and 7,034 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
*.iml
/target/**
.DS_Store
.vscode
6 changes: 2 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ openapi-generator-cli:=java -jar $(openapi-generator-jar)

generator:=java
library:=jersey3
modelGen:=balancecontrol balanceplatform binlookup capital checkout dataprotection legalentitymanagement management payment payout posterminalmanagement recurring transfers storedvalue configurationwebhooks reportwebhooks transferwebhooks
modelGen:=balancecontrol balanceplatform binlookup checkout dataprotection legalentitymanagement management payment payout posterminalmanagement recurring transfers storedvalue configurationwebhooks reportwebhooks transferwebhooks
models:=src/main/java/com/adyen/model
output:=target/out

Expand All @@ -19,8 +19,6 @@ binlookup: smallServiceName=BinLookupApi
checkout: spec=CheckoutService-v70
dataprotection: spec=DataProtectionService-v1
dataprotection: smallServiceName=DataProtectionApi
capital: spec=GrantService-v3
capital: smallServiceName=CapitalApi
storedvalue: spec=StoredValueService-v46
storedvalue: smallServiceName=StoredValueApi
posterminalmanagement: spec=TfmAPIService-v1
Expand Down Expand Up @@ -68,7 +66,7 @@ $(modelGen): target/spec $(openapi-generator-jar)

# Full service + models automation
bigServices:=balanceplatform checkout payout management legalentitymanagement transfers
singleFileServices:=balancecontrol binlookup dataprotection storedvalue posterminalmanagement recurring payment capital
singleFileServices:=balancecontrol binlookup dataprotection storedvalue posterminalmanagement recurring payment

services: $(bigServices) $(singleFileServices)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Transfers API
*
* The version of the OpenAPI document: 3
* Contact: [email protected]
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
Expand All @@ -14,54 +14,38 @@

import java.util.Objects;
import java.util.Arrays;
import com.google.gson.TypeAdapter;
import com.google.gson.annotations.JsonAdapter;
import com.google.gson.annotations.SerializedName;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonWriter;
import java.util.Map;
import java.util.HashMap;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.IOException;

import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.JsonArray;
import com.google.gson.JsonDeserializationContext;
import com.google.gson.JsonDeserializer;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.JsonParseException;
import com.google.gson.TypeAdapterFactory;
import com.google.gson.reflect.TypeToken;

import java.lang.reflect.Type;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import java.util.logging.Level;
import java.util.logging.Logger;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import com.fasterxml.jackson.core.JsonProcessingException;

import com.adyen.model.transfers.JSON;

/**
* AULocalAccountIdentification
*/
@JsonPropertyOrder({
AULocalAccountIdentification.JSON_PROPERTY_ACCOUNT_NUMBER,
AULocalAccountIdentification.JSON_PROPERTY_BSB_CODE,
AULocalAccountIdentification.JSON_PROPERTY_TYPE
})

public class AULocalAccountIdentification {
public static final String SERIALIZED_NAME_ACCOUNT_NUMBER = "accountNumber";
@SerializedName(SERIALIZED_NAME_ACCOUNT_NUMBER)
public static final String JSON_PROPERTY_ACCOUNT_NUMBER = "accountNumber";
private String accountNumber;

public static final String SERIALIZED_NAME_BSB_CODE = "bsbCode";
@SerializedName(SERIALIZED_NAME_BSB_CODE)
public static final String JSON_PROPERTY_BSB_CODE = "bsbCode";
private String bsbCode;

/**
* **auLocal**
*/
@JsonAdapter(TypeEnum.Adapter.class)
public enum TypeEnum {
AULOCAL("auLocal");

Expand All @@ -71,6 +55,7 @@ public enum TypeEnum {
this.value = value;
}

@JsonValue
public String getValue() {
return value;
}
Expand All @@ -80,6 +65,7 @@ public String toString() {
return String.valueOf(value);
}

@JsonCreator
public static TypeEnum fromValue(String value) {
for (TypeEnum b : TypeEnum.values()) {
if (b.value.equals(value)) {
Expand All @@ -88,30 +74,15 @@ public static TypeEnum fromValue(String value) {
}
throw new IllegalArgumentException("Unexpected value '" + value + "'");
}

public static class Adapter extends TypeAdapter<TypeEnum> {
@Override
public void write(final JsonWriter jsonWriter, final TypeEnum enumeration) throws IOException {
jsonWriter.value(enumeration.getValue());
}

@Override
public TypeEnum read(final JsonReader jsonReader) throws IOException {
String value = jsonReader.nextString();
return TypeEnum.fromValue(value);
}
}
}

public static final String SERIALIZED_NAME_TYPE = "type";
@SerializedName(SERIALIZED_NAME_TYPE)
public static final String JSON_PROPERTY_TYPE = "type";
private TypeEnum type = TypeEnum.AULOCAL;

public AULocalAccountIdentification() {
}

public AULocalAccountIdentification accountNumber(String accountNumber) {

this.accountNumber = accountNumber;
return this;
}
Expand All @@ -121,19 +92,22 @@ public AULocalAccountIdentification accountNumber(String accountNumber) {
* @return accountNumber
**/
@ApiModelProperty(required = true, value = "The bank account number, without separators or whitespace.")
@JsonProperty(JSON_PROPERTY_ACCOUNT_NUMBER)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)

public String getAccountNumber() {
return accountNumber;
}


@JsonProperty(JSON_PROPERTY_ACCOUNT_NUMBER)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public void setAccountNumber(String accountNumber) {
this.accountNumber = accountNumber;
}


public AULocalAccountIdentification bsbCode(String bsbCode) {

this.bsbCode = bsbCode;
return this;
}
Expand All @@ -143,19 +117,22 @@ public AULocalAccountIdentification bsbCode(String bsbCode) {
* @return bsbCode
**/
@ApiModelProperty(required = true, value = "The 6-digit [Bank State Branch (BSB) code](https://en.wikipedia.org/wiki/Bank_state_branch), without separators or whitespace.")
@JsonProperty(JSON_PROPERTY_BSB_CODE)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)

public String getBsbCode() {
return bsbCode;
}


@JsonProperty(JSON_PROPERTY_BSB_CODE)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public void setBsbCode(String bsbCode) {
this.bsbCode = bsbCode;
}


public AULocalAccountIdentification type(TypeEnum type) {

this.type = type;
return this;
}
Expand All @@ -165,18 +142,24 @@ public AULocalAccountIdentification type(TypeEnum type) {
* @return type
**/
@ApiModelProperty(required = true, value = "**auLocal**")
@JsonProperty(JSON_PROPERTY_TYPE)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)

public TypeEnum getType() {
return type;
}


@JsonProperty(JSON_PROPERTY_TYPE)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public void setType(TypeEnum type) {
this.type = type;
}



/**
* Return true if this AULocalAccountIdentification object is equal to o.
*/
@Override
public boolean equals(Object o) {
if (this == o) {
Expand Down Expand Up @@ -218,121 +201,23 @@ private String toIndentedString(Object o) {
return o.toString().replace("\n", "\n ");
}


public static HashSet<String> openapiFields;
public static HashSet<String> openapiRequiredFields;

static {
// a set of all properties/fields (JSON key names)
openapiFields = new HashSet<String>();
openapiFields.add("accountNumber");
openapiFields.add("bsbCode");
openapiFields.add("type");

// a set of required properties/fields (JSON key names)
openapiRequiredFields = new HashSet<String>();
openapiRequiredFields.add("accountNumber");
openapiRequiredFields.add("bsbCode");
openapiRequiredFields.add("type");
}
/**
* logger for Deserialization Errors
*/
private static final Logger log = Logger.getLogger(AULocalAccountIdentification.class.getName());

/**
* Validates the JSON Object and throws an exception if issues found
*
* @param jsonObj JSON Object
* @throws IOException if the JSON Object is invalid with respect to AULocalAccountIdentification
*/
public static void validateJsonObject(JsonObject jsonObj) throws IOException {
if (jsonObj == null) {
if (AULocalAccountIdentification.openapiRequiredFields.isEmpty()) {
return;
} else { // has required fields
throw new IllegalArgumentException(String.format("The required field(s) %s in AULocalAccountIdentification is not found in the empty JSON string", AULocalAccountIdentification.openapiRequiredFields.toString()));
}
}

Set<Entry<String, JsonElement>> entries = jsonObj.entrySet();
// check to see if the JSON string contains additional fields
for (Entry<String, JsonElement> entry : entries) {
if (!AULocalAccountIdentification.openapiFields.contains(entry.getKey())) {
log.log(Level.WARNING, String.format("The field `%s` in the JSON string is not defined in the `AULocalAccountIdentification` properties.", entry.getKey()));
}
}

// check to make sure all required properties/fields are present in the JSON string
for (String requiredField : AULocalAccountIdentification.openapiRequiredFields) {
if (jsonObj.get(requiredField) == null) {
throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString()));
}
}
// validate the optional field accountNumber
if (jsonObj.get("accountNumber") != null && !jsonObj.get("accountNumber").isJsonPrimitive()) {
log.log(Level.WARNING, String.format("Expected the field `accountNumber` to be a primitive type in the JSON string but got `%s`", jsonObj.get("accountNumber").toString()));
}
// validate the optional field bsbCode
if (jsonObj.get("bsbCode") != null && !jsonObj.get("bsbCode").isJsonPrimitive()) {
log.log(Level.WARNING, String.format("Expected the field `bsbCode` to be a primitive type in the JSON string but got `%s`", jsonObj.get("bsbCode").toString()));
}
// ensure the field type can be parsed to an enum value
if (jsonObj.get("type") != null) {
if(!jsonObj.get("type").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString()));
}
TypeEnum.fromValue(jsonObj.get("type").getAsString());
}
}

public static class CustomTypeAdapterFactory implements TypeAdapterFactory {
@SuppressWarnings("unchecked")
@Override
public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type) {
if (!AULocalAccountIdentification.class.isAssignableFrom(type.getRawType())) {
return null; // this class only serializes 'AULocalAccountIdentification' and its subtypes
}
final TypeAdapter<JsonElement> elementAdapter = gson.getAdapter(JsonElement.class);
final TypeAdapter<AULocalAccountIdentification> thisAdapter
= gson.getDelegateAdapter(this, TypeToken.get(AULocalAccountIdentification.class));

return (TypeAdapter<T>) new TypeAdapter<AULocalAccountIdentification>() {
@Override
public void write(JsonWriter out, AULocalAccountIdentification value) throws IOException {
JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject();
elementAdapter.write(out, obj);
}

@Override
public AULocalAccountIdentification read(JsonReader in) throws IOException {
JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject();
validateJsonObject(jsonObj);
return thisAdapter.fromJsonTree(jsonObj);
}

}.nullSafe();
}
}

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

/**
/**
* Convert an instance of AULocalAccountIdentification to an JSON string
*
* @return JSON string
*/
public String toJson() {
return JSON.getGson().toJson(this);
public String toJson() throws JsonProcessingException {
return JSON.getMapper().writeValueAsString(this);
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Transfers API
*
* The version of the OpenAPI document: 3
* Contact: [email protected]
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
Expand All @@ -17,9 +17,12 @@
import java.util.Map;
import jakarta.ws.rs.core.GenericType;

import com.fasterxml.jackson.annotation.JsonValue;

/**
* Abstract class for oneOf,anyOf schemas defined in OpenAPI spec
*/

public abstract class AbstractOpenApiSchema {

// store the actual instance of the schema/object
Expand Down Expand Up @@ -48,7 +51,7 @@ public AbstractOpenApiSchema(String schemaType, Boolean isNullable) {
*
* @return an instance of the actual schema/object
*/
//@JsonValue
@JsonValue
public Object getActualInstance() {return instance;}

/**
Expand Down
Loading

0 comments on commit 1ba3bba

Please sign in to comment.