diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 3b4c2d4b..bd7f3844 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "4.1.0" + ".": "4.2.0" } \ No newline at end of file diff --git a/.stats.yml b/.stats.yml index 23dfdad6..bed01067 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ configured_endpoints: 40 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/finch%2Ffinch-5d2b3a9cdbcfb6f10b6e621ef7ababbd2701316e5ea1117ced072ab76bdbec34.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/finch%2Ffinch-7a816d4a5f0039230590a6662f3513d5756344ca662761ecbc49016593f65836.yml diff --git a/CHANGELOG.md b/CHANGELOG.md index 9fe07907..a4a094f3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,32 @@ # Changelog +## 4.2.0 (2025-02-27) + +Full Changelog: [v4.1.0...v4.2.0](https://github.com/Finch-API/finch-api-java/compare/v4.1.0...v4.2.0) + +### Features + +* **api:** api update ([#463](https://github.com/Finch-API/finch-api-java/issues/463)) ([2eb1796](https://github.com/Finch-API/finch-api-java/commit/2eb1796d9d21e25e60b5242041cc7ef9e7e1df0e)) +* **client:** allow omitting params object when none required ([#455](https://github.com/Finch-API/finch-api-java/issues/455)) ([cac8229](https://github.com/Finch-API/finch-api-java/commit/cac82298a09597acfa12046c8d6396aa08bb3807)) + + +### Bug Fixes + +* **client:** add missing `@JvmStatic` ([#457](https://github.com/Finch-API/finch-api-java/issues/457)) ([258a817](https://github.com/Finch-API/finch-api-java/commit/258a817f842e9344c107586f1ac7c879f6c1e3ae)) + + +### Chores + +* **client:** use deep identity methods for primitive array types ([#459](https://github.com/Finch-API/finch-api-java/issues/459)) ([4424710](https://github.com/Finch-API/finch-api-java/commit/4424710651151e1a0a075ee7a4c05ed96dc1ce64)) +* **internal:** add async service tests ([#458](https://github.com/Finch-API/finch-api-java/issues/458)) ([4698263](https://github.com/Finch-API/finch-api-java/commit/4698263f9490cc4df1b8412c084c1ade14c38b68)) +* **internal:** improve sync service tests ([4698263](https://github.com/Finch-API/finch-api-java/commit/4698263f9490cc4df1b8412c084c1ade14c38b68)) +* **internal:** refactor `ServiceParamsTest` ([#460](https://github.com/Finch-API/finch-api-java/issues/460)) ([c375fa6](https://github.com/Finch-API/finch-api-java/commit/c375fa659417a964964c150b7b0f8dc27ceab91f)) + + +### Documentation + +* readme parameter tweaks ([4698263](https://github.com/Finch-API/finch-api-java/commit/4698263f9490cc4df1b8412c084c1ade14c38b68)) + ## 4.1.0 (2025-02-25) Full Changelog: [v4.0.2...v4.1.0](https://github.com/Finch-API/finch-api-java/compare/v4.0.2...v4.1.0) diff --git a/README.md b/README.md index d469a892..a4e73200 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ -[![Maven Central](https://img.shields.io/maven-central/v/com.tryfinch.api/finch-java)](https://central.sonatype.com/artifact/com.tryfinch.api/finch-java/4.1.0) +[![Maven Central](https://img.shields.io/maven-central/v/com.tryfinch.api/finch-java)](https://central.sonatype.com/artifact/com.tryfinch.api/finch-java/4.2.0) @@ -23,7 +23,7 @@ The REST API documentation can be foundĀ [in the Finch Documentation Center](htt ### Gradle ```kotlin -implementation("com.tryfinch.api:finch-java:4.1.0") +implementation("com.tryfinch.api:finch-java:4.2.0") ``` ### Maven @@ -32,7 +32,7 @@ implementation("com.tryfinch.api:finch-java:4.1.0") com.tryfinch.api finch-java - 4.1.0 + 4.2.0 ``` @@ -56,10 +56,7 @@ FinchClient client = FinchOkHttpClient.builder() .accessToken("My Access Token") .build(); -HrisDirectoryListParams params = HrisDirectoryListParams.builder() - .candidateId("") - .build(); -HrisDirectoryListPage page = client.hris().directory().list(params); +HrisDirectoryListPage page = client.hris().directory().list(); ``` ## Client configuration @@ -98,7 +95,6 @@ FinchClient client = FinchOkHttpClient.builder() // Configures using the `FINCH_CLIENT_ID`, `FINCH_CLIENT_SECRET` and `FINCH_WEBHOOK_SECRET` environment variables .fromEnv() .accessToken("My Access Token") - .accessToken("My Access Token") .build(); ``` @@ -145,8 +141,7 @@ FinchClient client = FinchOkHttpClient.builder() .accessToken("My Access Token") .build(); -HrisDirectoryListParams params = HrisDirectoryListParams.builder().build(); -CompletableFuture page = client.async().hris().directory().list(params); +CompletableFuture page = client.async().hris().directory().list(); ``` Or create an asynchronous client from the beginning: @@ -164,8 +159,7 @@ FinchClientAsync client = FinchOkHttpClientAsync.builder() .accessToken("My Access Token") .build(); -HrisDirectoryListParams params = HrisDirectoryListParams.builder().build(); -CompletableFuture page = client.hris().directory().list(params); +CompletableFuture page = client.hris().directory().list(); ``` The asynchronous client supports the same options as the synchronous one, except most methods return `CompletableFuture`s. @@ -295,8 +289,8 @@ import com.tryfinch.api.client.okhttp.FinchOkHttpClient; FinchClient client = FinchOkHttpClient.builder() .fromEnv() - .accessToken("My Access Token") .maxRetries(4) + .accessToken("My Access Token") .build(); ``` @@ -310,9 +304,7 @@ To set a custom timeout, configure the method call using the `timeout` method: import com.tryfinch.api.models.HrisDirectoryListPage; import com.tryfinch.api.models.HrisDirectoryListParams; -HrisDirectoryListPage page = client.hris().directory().list( - params, RequestOptions.builder().timeout(Duration.ofSeconds(30)).build() -); +HrisDirectoryListPage page = client.hris().directory().list(RequestOptions.builder().timeout(Duration.ofSeconds(30)).build()); ``` Or configure the default for all method calls at the client level: @@ -324,8 +316,8 @@ import java.time.Duration; FinchClient client = FinchOkHttpClient.builder() .fromEnv() - .accessToken("My Access Token") .timeout(Duration.ofSeconds(30)) + .accessToken("My Access Token") .build(); ``` @@ -341,12 +333,12 @@ import java.net.Proxy; FinchClient client = FinchOkHttpClient.builder() .fromEnv() - .accessToken("My Access Token") .proxy(new Proxy( Proxy.Type.HTTP, new InetSocketAddress( "https://example.com", 8080 ) )) + .accessToken("My Access Token") .build(); ``` @@ -453,9 +445,7 @@ Or configure the method call to validate the response using the `responseValidat import com.tryfinch.api.models.HrisDirectoryListPage; import com.tryfinch.api.models.HrisDirectoryListParams; -HrisDirectoryListPage page = client.hris().directory().list( - params, RequestOptions.builder().responseValidation(true).build() -); +HrisDirectoryListPage page = client.hris().directory().list(RequestOptions.builder().responseValidation(true).build()); ``` Or configure the default for all method calls at the client level: @@ -466,8 +456,8 @@ import com.tryfinch.api.client.okhttp.FinchOkHttpClient; FinchClient client = FinchOkHttpClient.builder() .fromEnv() - .accessToken("My Access Token") .responseValidation(true) + .accessToken("My Access Token") .build(); ``` diff --git a/build.gradle.kts b/build.gradle.kts index 4b46d1a3..5b66da78 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,4 +1,4 @@ allprojects { group = "com.tryfinch.api" - version = "4.1.0" // x-release-please-version + version = "4.2.0" // x-release-please-version } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/core/Utils.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/core/Utils.kt index c2f32509..979a3580 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/core/Utils.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/core/Utils.kt @@ -26,6 +26,42 @@ internal fun , V> SortedMap.toImmutable(): SortedMap value.contentHashCode() - is String -> value - is Boolean -> value - is Long -> value - is Double -> value - else -> value?.hashCode() - }, - ) - } - return hashCode - } - - override fun equals(other: Any?): Boolean { - if (this === other) return true - if (other == null || this.javaClass != other.javaClass) return false + private val hashCode: Int by lazy { contentHash(name, value, contentType, filename) } - other as MultipartFormValue<*> + override fun hashCode(): Int = hashCode - if (name != other.name || contentType != other.contentType || filename != other.filename) - return false - - return when { - value is ByteArray && other.value is ByteArray -> value contentEquals other.value - else -> value?.equals(other.value) ?: (other.value == null) + override fun equals(other: Any?): Boolean { + if (this === other) { + return true } + + return other is MultipartFormValue<*> && + name == other.name && + value contentEquals other.value && + contentType == other.contentType && + filename == other.filename } override fun toString(): String = diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AccountDisconnectParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AccountDisconnectParams.kt index 8edd0cba..1e95395e 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AccountDisconnectParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AccountDisconnectParams.kt @@ -37,6 +37,8 @@ private constructor( companion object { + @JvmStatic fun none(): AccountDisconnectParams = builder().build() + @JvmStatic fun builder() = Builder() } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AccountIntrospectParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AccountIntrospectParams.kt index 0f3ddc95..c9718b4c 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AccountIntrospectParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AccountIntrospectParams.kt @@ -27,6 +27,8 @@ private constructor( companion object { + @JvmStatic fun none(): AccountIntrospectParams = builder().build() + @JvmStatic fun builder() = Builder() } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitCreateParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitCreateParams.kt index 5f17f2f8..868e087a 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitCreateParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitCreateParams.kt @@ -227,6 +227,8 @@ private constructor( companion object { + @JvmStatic fun none(): HrisBenefitCreateParams = builder().build() + @JvmStatic fun builder() = Builder() } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitListParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitListParams.kt index 74a5d5b8..63ae4bf0 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitListParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitListParams.kt @@ -27,6 +27,8 @@ private constructor( companion object { + @JvmStatic fun none(): HrisBenefitListParams = builder().build() + @JvmStatic fun builder() = Builder() } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitListSupportedBenefitsParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitListSupportedBenefitsParams.kt index 0719a212..c783f66b 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitListSupportedBenefitsParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitListSupportedBenefitsParams.kt @@ -27,6 +27,8 @@ private constructor( companion object { + @JvmStatic fun none(): HrisBenefitListSupportedBenefitsParams = builder().build() + @JvmStatic fun builder() = Builder() } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisCompanyRetrieveParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisCompanyRetrieveParams.kt index f1eca56d..cd51a0ed 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisCompanyRetrieveParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisCompanyRetrieveParams.kt @@ -27,6 +27,8 @@ private constructor( companion object { + @JvmStatic fun none(): HrisCompanyRetrieveParams = builder().build() + @JvmStatic fun builder() = Builder() } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListIndividualsParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListIndividualsParams.kt index 5eafd559..aa21caf7 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListIndividualsParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListIndividualsParams.kt @@ -43,6 +43,8 @@ private constructor( companion object { + @JvmStatic fun none(): HrisDirectoryListIndividualsParams = builder().build() + @JvmStatic fun builder() = Builder() } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListParams.kt index 000f255d..ed4d67ad 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListParams.kt @@ -42,6 +42,8 @@ private constructor( companion object { + @JvmStatic fun none(): HrisDirectoryListParams = builder().build() + @JvmStatic fun builder() = Builder() } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDocumentListParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDocumentListParams.kt index 28c06a6a..8e51b518 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDocumentListParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDocumentListParams.kt @@ -60,6 +60,8 @@ private constructor( companion object { + @JvmStatic fun none(): HrisDocumentListParams = builder().build() + @JvmStatic fun builder() = Builder() } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisIndividualRetrieveManyParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisIndividualRetrieveManyParams.kt index e65280f8..3809d289 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisIndividualRetrieveManyParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisIndividualRetrieveManyParams.kt @@ -183,6 +183,8 @@ private constructor( companion object { + @JvmStatic fun none(): HrisIndividualRetrieveManyParams = builder().build() + @JvmStatic fun builder() = Builder() } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobAutomatedCreateParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobAutomatedCreateParams.kt index 187f04d1..34e0c010 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobAutomatedCreateParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobAutomatedCreateParams.kt @@ -741,6 +741,8 @@ private constructor( companion object { + @JvmStatic fun none(): JobAutomatedCreateParams = builder().build() + @JvmStatic fun builder() = Builder() } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobAutomatedListParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobAutomatedListParams.kt index 9a6b4b60..d49551f0 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobAutomatedListParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobAutomatedListParams.kt @@ -46,6 +46,8 @@ private constructor( companion object { + @JvmStatic fun none(): JobAutomatedListParams = builder().build() + @JvmStatic fun builder() = Builder() } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayStatement.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayStatement.kt index 359f7437..0553227d 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayStatement.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayStatement.kt @@ -381,7 +381,7 @@ private constructor( private val amount: JsonField = JsonMissing.of(), @JsonProperty("attributes") @ExcludeMissing - private val attributes: JsonField = JsonMissing.of(), + private val attributes: JsonField = JsonMissing.of(), @JsonProperty("currency") @ExcludeMissing private val currency: JsonField = JsonMissing.of(), @@ -399,7 +399,7 @@ private constructor( /** The earnings amount in cents. */ fun amount(): Optional = Optional.ofNullable(amount.getNullable("amount")) - fun attributes(): Optional = + fun attributes(): Optional = Optional.ofNullable(attributes.getNullable("attributes")) /** The earnings currency code. */ @@ -422,7 +422,7 @@ private constructor( @JsonProperty("attributes") @ExcludeMissing - fun _attributes(): JsonField = attributes + fun _attributes(): JsonField = attributes /** The earnings currency code. */ @JsonProperty("currency") @ExcludeMissing fun _currency(): JsonField = currency @@ -470,7 +470,7 @@ private constructor( class Builder internal constructor() { private var amount: JsonField = JsonMissing.of() - private var attributes: JsonField = JsonMissing.of() + private var attributes: JsonField = JsonMissing.of() private var currency: JsonField = JsonMissing.of() private var hours: JsonField = JsonMissing.of() private var name: JsonField = JsonMissing.of() @@ -501,11 +501,13 @@ private constructor( /** The earnings amount in cents. */ fun amount(amount: JsonField) = apply { this.amount = amount } - fun attributes(attributes: Metadata?) = attributes(JsonField.ofNullable(attributes)) + fun attributes(attributes: Attributes?) = attributes(JsonField.ofNullable(attributes)) - fun attributes(attributes: Optional) = attributes(attributes.orElse(null)) + fun attributes(attributes: Optional) = attributes(attributes.orElse(null)) - fun attributes(attributes: JsonField) = apply { this.attributes = attributes } + fun attributes(attributes: JsonField) = apply { + this.attributes = attributes + } /** The earnings currency code. */ fun currency(currency: String?) = currency(JsonField.ofNullable(currency)) @@ -591,30 +593,22 @@ private constructor( } @NoAutoDetect - class Metadata + class Attributes @JsonCreator private constructor( @JsonProperty("metadata") @ExcludeMissing - private val metadata: JsonField = JsonMissing.of(), + private val metadata: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** - * The metadata to be attached to the entity by existing rules. It is a key-value pairs - * where the values can be of any type (string, number, boolean, object, array, etc.). - */ - fun metadata(): Optional = + fun metadata(): Optional = Optional.ofNullable(metadata.getNullable("metadata")) - /** - * The metadata to be attached to the entity by existing rules. It is a key-value pairs - * where the values can be of any type (string, number, boolean, object, array, etc.). - */ @JsonProperty("metadata") @ExcludeMissing - fun _metadata(): JsonField = metadata + fun _metadata(): JsonField = metadata @JsonAnyGetter @ExcludeMissing @@ -622,7 +616,7 @@ private constructor( private var validated: Boolean = false - fun validate(): Metadata = apply { + fun validate(): Attributes = apply { if (validated) { return@apply } @@ -638,33 +632,21 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [Metadata]. */ + /** A builder for [Attributes]. */ class Builder internal constructor() { - private var metadata: JsonField = JsonMissing.of() + private var metadata: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(metadata: Metadata) = apply { - this.metadata = metadata.metadata - additionalProperties = metadata.additionalProperties.toMutableMap() + internal fun from(attributes: Attributes) = apply { + metadata = attributes.metadata + additionalProperties = attributes.additionalProperties.toMutableMap() } - /** - * The metadata to be attached to the entity by existing rules. It is a key-value - * pairs where the values can be of any type (string, number, boolean, object, - * array, etc.). - */ - fun metadata(metadata: InnerMetadata) = metadata(JsonField.of(metadata)) + fun metadata(metadata: Metadata) = metadata(JsonField.of(metadata)) - /** - * The metadata to be attached to the entity by existing rules. It is a key-value - * pairs where the values can be of any type (string, number, boolean, object, - * array, etc.). - */ - fun metadata(metadata: JsonField) = apply { - this.metadata = metadata - } + fun metadata(metadata: JsonField) = apply { this.metadata = metadata } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -688,32 +670,49 @@ private constructor( keys.forEach(::removeAdditionalProperty) } - fun build(): Metadata = Metadata(metadata, additionalProperties.toImmutable()) + fun build(): Attributes = Attributes(metadata, additionalProperties.toImmutable()) } - /** - * The metadata to be attached to the entity by existing rules. It is a key-value pairs - * where the values can be of any type (string, number, boolean, object, array, etc.). - */ @NoAutoDetect - class InnerMetadata + class Metadata @JsonCreator private constructor( + @JsonProperty("metadata") + @ExcludeMissing + private val metadata: JsonField = JsonMissing.of(), @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap() + private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * The metadata to be attached to the entity by existing rules. It is a key-value + * pairs where the values can be of any type (string, number, boolean, object, + * array, etc.). + */ + fun metadata(): Optional = + Optional.ofNullable(metadata.getNullable("metadata")) + + /** + * The metadata to be attached to the entity by existing rules. It is a key-value + * pairs where the values can be of any type (string, number, boolean, object, + * array, etc.). + */ + @JsonProperty("metadata") + @ExcludeMissing + fun _metadata(): JsonField = metadata + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties private var validated: Boolean = false - fun validate(): InnerMetadata = apply { + fun validate(): Metadata = apply { if (validated) { return@apply } + metadata().ifPresent { it.validate() } validated = true } @@ -724,14 +723,32 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [InnerMetadata]. */ + /** A builder for [Metadata]. */ class Builder internal constructor() { + private var metadata: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(innerMetadata: InnerMetadata) = apply { - additionalProperties = innerMetadata.additionalProperties.toMutableMap() + internal fun from(metadata: Metadata) = apply { + this.metadata = metadata.metadata + additionalProperties = metadata.additionalProperties.toMutableMap() + } + + /** + * The metadata to be attached to the entity by existing rules. It is a + * key-value pairs where the values can be of any type (string, number, boolean, + * object, array, etc.). + */ + fun metadata(metadata: InnerMetadata) = metadata(JsonField.of(metadata)) + + /** + * The metadata to be attached to the entity by existing rules. It is a + * key-value pairs where the values can be of any type (string, number, boolean, + * object, array, etc.). + */ + fun metadata(metadata: JsonField) = apply { + this.metadata = metadata } fun additionalProperties(additionalProperties: Map) = apply { @@ -756,7 +773,96 @@ private constructor( keys.forEach(::removeAdditionalProperty) } - fun build(): InnerMetadata = InnerMetadata(additionalProperties.toImmutable()) + fun build(): Metadata = Metadata(metadata, additionalProperties.toImmutable()) + } + + /** + * The metadata to be attached to the entity by existing rules. It is a key-value + * pairs where the values can be of any type (string, number, boolean, object, + * array, etc.). + */ + @NoAutoDetect + class InnerMetadata + @JsonCreator + private constructor( + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap() + ) { + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + private var validated: Boolean = false + + fun validate(): InnerMetadata = apply { + if (validated) { + return@apply + } + + validated = true + } + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun builder() = Builder() + } + + /** A builder for [InnerMetadata]. */ + class Builder internal constructor() { + + private var additionalProperties: MutableMap = + mutableMapOf() + + @JvmSynthetic + internal fun from(innerMetadata: InnerMetadata) = apply { + additionalProperties = innerMetadata.additionalProperties.toMutableMap() + } + + fun additionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties( + additionalProperties: Map + ) = apply { this.additionalProperties.putAll(additionalProperties) } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + fun build(): InnerMetadata = + InnerMetadata(additionalProperties.toImmutable()) + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is InnerMetadata && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "InnerMetadata{additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { @@ -764,17 +870,17 @@ private constructor( return true } - return /* spotless:off */ other is InnerMetadata && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Metadata && metadata == other.metadata && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(metadata, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "InnerMetadata{additionalProperties=$additionalProperties}" + "Metadata{metadata=$metadata, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { @@ -782,7 +888,7 @@ private constructor( return true } - return /* spotless:off */ other is Metadata && metadata == other.metadata && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Attributes && metadata == other.metadata && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ @@ -792,7 +898,7 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "Metadata{metadata=$metadata, additionalProperties=$additionalProperties}" + "Attributes{metadata=$metadata, additionalProperties=$additionalProperties}" } /** The type of earning. */ @@ -989,7 +1095,7 @@ private constructor( private val amount: JsonField = JsonMissing.of(), @JsonProperty("attributes") @ExcludeMissing - private val attributes: JsonField = JsonMissing.of(), + private val attributes: JsonField = JsonMissing.of(), @JsonProperty("currency") @ExcludeMissing private val currency: JsonField = JsonMissing.of(), @@ -1009,7 +1115,7 @@ private constructor( /** The deduction amount in cents. */ fun amount(): Optional = Optional.ofNullable(amount.getNullable("amount")) - fun attributes(): Optional = + fun attributes(): Optional = Optional.ofNullable(attributes.getNullable("attributes")) /** The deduction currency. */ @@ -1029,7 +1135,7 @@ private constructor( @JsonProperty("attributes") @ExcludeMissing - fun _attributes(): JsonField = attributes + fun _attributes(): JsonField = attributes /** The deduction currency. */ @JsonProperty("currency") @ExcludeMissing fun _currency(): JsonField = currency @@ -1074,7 +1180,7 @@ private constructor( class Builder internal constructor() { private var amount: JsonField = JsonMissing.of() - private var attributes: JsonField = JsonMissing.of() + private var attributes: JsonField = JsonMissing.of() private var currency: JsonField = JsonMissing.of() private var name: JsonField = JsonMissing.of() private var preTax: JsonField = JsonMissing.of() @@ -1105,11 +1211,13 @@ private constructor( /** The deduction amount in cents. */ fun amount(amount: JsonField) = apply { this.amount = amount } - fun attributes(attributes: Metadata?) = attributes(JsonField.ofNullable(attributes)) + fun attributes(attributes: Attributes?) = attributes(JsonField.ofNullable(attributes)) - fun attributes(attributes: Optional) = attributes(attributes.orElse(null)) + fun attributes(attributes: Optional) = attributes(attributes.orElse(null)) - fun attributes(attributes: JsonField) = apply { this.attributes = attributes } + fun attributes(attributes: JsonField) = apply { + this.attributes = attributes + } /** The deduction currency. */ fun currency(currency: String?) = currency(JsonField.ofNullable(currency)) @@ -1183,30 +1291,22 @@ private constructor( } @NoAutoDetect - class Metadata + class Attributes @JsonCreator private constructor( @JsonProperty("metadata") @ExcludeMissing - private val metadata: JsonField = JsonMissing.of(), + private val metadata: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** - * The metadata to be attached to the entity by existing rules. It is a key-value pairs - * where the values can be of any type (string, number, boolean, object, array, etc.). - */ - fun metadata(): Optional = + fun metadata(): Optional = Optional.ofNullable(metadata.getNullable("metadata")) - /** - * The metadata to be attached to the entity by existing rules. It is a key-value pairs - * where the values can be of any type (string, number, boolean, object, array, etc.). - */ @JsonProperty("metadata") @ExcludeMissing - fun _metadata(): JsonField = metadata + fun _metadata(): JsonField = metadata @JsonAnyGetter @ExcludeMissing @@ -1214,7 +1314,7 @@ private constructor( private var validated: Boolean = false - fun validate(): Metadata = apply { + fun validate(): Attributes = apply { if (validated) { return@apply } @@ -1230,33 +1330,21 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [Metadata]. */ + /** A builder for [Attributes]. */ class Builder internal constructor() { - private var metadata: JsonField = JsonMissing.of() + private var metadata: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(metadata: Metadata) = apply { - this.metadata = metadata.metadata - additionalProperties = metadata.additionalProperties.toMutableMap() + internal fun from(attributes: Attributes) = apply { + metadata = attributes.metadata + additionalProperties = attributes.additionalProperties.toMutableMap() } - /** - * The metadata to be attached to the entity by existing rules. It is a key-value - * pairs where the values can be of any type (string, number, boolean, object, - * array, etc.). - */ - fun metadata(metadata: InnerMetadata) = metadata(JsonField.of(metadata)) + fun metadata(metadata: Metadata) = metadata(JsonField.of(metadata)) - /** - * The metadata to be attached to the entity by existing rules. It is a key-value - * pairs where the values can be of any type (string, number, boolean, object, - * array, etc.). - */ - fun metadata(metadata: JsonField) = apply { - this.metadata = metadata - } + fun metadata(metadata: JsonField) = apply { this.metadata = metadata } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -1280,32 +1368,49 @@ private constructor( keys.forEach(::removeAdditionalProperty) } - fun build(): Metadata = Metadata(metadata, additionalProperties.toImmutable()) + fun build(): Attributes = Attributes(metadata, additionalProperties.toImmutable()) } - /** - * The metadata to be attached to the entity by existing rules. It is a key-value pairs - * where the values can be of any type (string, number, boolean, object, array, etc.). - */ @NoAutoDetect - class InnerMetadata + class Metadata @JsonCreator private constructor( + @JsonProperty("metadata") + @ExcludeMissing + private val metadata: JsonField = JsonMissing.of(), @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap() + private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * The metadata to be attached to the entity by existing rules. It is a key-value + * pairs where the values can be of any type (string, number, boolean, object, + * array, etc.). + */ + fun metadata(): Optional = + Optional.ofNullable(metadata.getNullable("metadata")) + + /** + * The metadata to be attached to the entity by existing rules. It is a key-value + * pairs where the values can be of any type (string, number, boolean, object, + * array, etc.). + */ + @JsonProperty("metadata") + @ExcludeMissing + fun _metadata(): JsonField = metadata + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties private var validated: Boolean = false - fun validate(): InnerMetadata = apply { + fun validate(): Metadata = apply { if (validated) { return@apply } + metadata().ifPresent { it.validate() } validated = true } @@ -1316,14 +1421,32 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [InnerMetadata]. */ + /** A builder for [Metadata]. */ class Builder internal constructor() { + private var metadata: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(innerMetadata: InnerMetadata) = apply { - additionalProperties = innerMetadata.additionalProperties.toMutableMap() + internal fun from(metadata: Metadata) = apply { + this.metadata = metadata.metadata + additionalProperties = metadata.additionalProperties.toMutableMap() + } + + /** + * The metadata to be attached to the entity by existing rules. It is a + * key-value pairs where the values can be of any type (string, number, boolean, + * object, array, etc.). + */ + fun metadata(metadata: InnerMetadata) = metadata(JsonField.of(metadata)) + + /** + * The metadata to be attached to the entity by existing rules. It is a + * key-value pairs where the values can be of any type (string, number, boolean, + * object, array, etc.). + */ + fun metadata(metadata: JsonField) = apply { + this.metadata = metadata } fun additionalProperties(additionalProperties: Map) = apply { @@ -1348,7 +1471,96 @@ private constructor( keys.forEach(::removeAdditionalProperty) } - fun build(): InnerMetadata = InnerMetadata(additionalProperties.toImmutable()) + fun build(): Metadata = Metadata(metadata, additionalProperties.toImmutable()) + } + + /** + * The metadata to be attached to the entity by existing rules. It is a key-value + * pairs where the values can be of any type (string, number, boolean, object, + * array, etc.). + */ + @NoAutoDetect + class InnerMetadata + @JsonCreator + private constructor( + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap() + ) { + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + private var validated: Boolean = false + + fun validate(): InnerMetadata = apply { + if (validated) { + return@apply + } + + validated = true + } + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun builder() = Builder() + } + + /** A builder for [InnerMetadata]. */ + class Builder internal constructor() { + + private var additionalProperties: MutableMap = + mutableMapOf() + + @JvmSynthetic + internal fun from(innerMetadata: InnerMetadata) = apply { + additionalProperties = innerMetadata.additionalProperties.toMutableMap() + } + + fun additionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties( + additionalProperties: Map + ) = apply { this.additionalProperties.putAll(additionalProperties) } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + fun build(): InnerMetadata = + InnerMetadata(additionalProperties.toImmutable()) + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is InnerMetadata && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "InnerMetadata{additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { @@ -1356,17 +1568,17 @@ private constructor( return true } - return /* spotless:off */ other is InnerMetadata && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Metadata && metadata == other.metadata && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(metadata, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "InnerMetadata{additionalProperties=$additionalProperties}" + "Metadata{metadata=$metadata, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { @@ -1374,7 +1586,7 @@ private constructor( return true } - return /* spotless:off */ other is Metadata && metadata == other.metadata && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Attributes && metadata == other.metadata && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ @@ -1384,7 +1596,7 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "Metadata{metadata=$metadata, additionalProperties=$additionalProperties}" + "Attributes{metadata=$metadata, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { @@ -1414,7 +1626,7 @@ private constructor( private val amount: JsonField = JsonMissing.of(), @JsonProperty("attributes") @ExcludeMissing - private val attributes: JsonField = JsonMissing.of(), + private val attributes: JsonField = JsonMissing.of(), @JsonProperty("currency") @ExcludeMissing private val currency: JsonField = JsonMissing.of(), @@ -1431,7 +1643,7 @@ private constructor( /** The contribution amount in cents. */ fun amount(): Optional = Optional.ofNullable(amount.getNullable("amount")) - fun attributes(): Optional = + fun attributes(): Optional = Optional.ofNullable(attributes.getNullable("attributes")) /** The contribution currency. */ @@ -1448,7 +1660,7 @@ private constructor( @JsonProperty("attributes") @ExcludeMissing - fun _attributes(): JsonField = attributes + fun _attributes(): JsonField = attributes /** The contribution currency. */ @JsonProperty("currency") @ExcludeMissing fun _currency(): JsonField = currency @@ -1489,7 +1701,7 @@ private constructor( class Builder internal constructor() { private var amount: JsonField = JsonMissing.of() - private var attributes: JsonField = JsonMissing.of() + private var attributes: JsonField = JsonMissing.of() private var currency: JsonField = JsonMissing.of() private var name: JsonField = JsonMissing.of() private var type: JsonField = JsonMissing.of() @@ -1518,11 +1730,13 @@ private constructor( /** The contribution amount in cents. */ fun amount(amount: JsonField) = apply { this.amount = amount } - fun attributes(attributes: Metadata?) = attributes(JsonField.ofNullable(attributes)) + fun attributes(attributes: Attributes?) = attributes(JsonField.ofNullable(attributes)) - fun attributes(attributes: Optional) = attributes(attributes.orElse(null)) + fun attributes(attributes: Optional) = attributes(attributes.orElse(null)) - fun attributes(attributes: JsonField) = apply { this.attributes = attributes } + fun attributes(attributes: JsonField) = apply { + this.attributes = attributes + } /** The contribution currency. */ fun currency(currency: String?) = currency(JsonField.ofNullable(currency)) @@ -1582,30 +1796,22 @@ private constructor( } @NoAutoDetect - class Metadata + class Attributes @JsonCreator private constructor( @JsonProperty("metadata") @ExcludeMissing - private val metadata: JsonField = JsonMissing.of(), + private val metadata: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** - * The metadata to be attached to the entity by existing rules. It is a key-value pairs - * where the values can be of any type (string, number, boolean, object, array, etc.). - */ - fun metadata(): Optional = + fun metadata(): Optional = Optional.ofNullable(metadata.getNullable("metadata")) - /** - * The metadata to be attached to the entity by existing rules. It is a key-value pairs - * where the values can be of any type (string, number, boolean, object, array, etc.). - */ @JsonProperty("metadata") @ExcludeMissing - fun _metadata(): JsonField = metadata + fun _metadata(): JsonField = metadata @JsonAnyGetter @ExcludeMissing @@ -1613,7 +1819,7 @@ private constructor( private var validated: Boolean = false - fun validate(): Metadata = apply { + fun validate(): Attributes = apply { if (validated) { return@apply } @@ -1629,33 +1835,21 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [Metadata]. */ + /** A builder for [Attributes]. */ class Builder internal constructor() { - private var metadata: JsonField = JsonMissing.of() + private var metadata: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(metadata: Metadata) = apply { - this.metadata = metadata.metadata - additionalProperties = metadata.additionalProperties.toMutableMap() + internal fun from(attributes: Attributes) = apply { + metadata = attributes.metadata + additionalProperties = attributes.additionalProperties.toMutableMap() } - /** - * The metadata to be attached to the entity by existing rules. It is a key-value - * pairs where the values can be of any type (string, number, boolean, object, - * array, etc.). - */ - fun metadata(metadata: InnerMetadata) = metadata(JsonField.of(metadata)) + fun metadata(metadata: Metadata) = metadata(JsonField.of(metadata)) - /** - * The metadata to be attached to the entity by existing rules. It is a key-value - * pairs where the values can be of any type (string, number, boolean, object, - * array, etc.). - */ - fun metadata(metadata: JsonField) = apply { - this.metadata = metadata - } + fun metadata(metadata: JsonField) = apply { this.metadata = metadata } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -1679,32 +1873,49 @@ private constructor( keys.forEach(::removeAdditionalProperty) } - fun build(): Metadata = Metadata(metadata, additionalProperties.toImmutable()) + fun build(): Attributes = Attributes(metadata, additionalProperties.toImmutable()) } - /** - * The metadata to be attached to the entity by existing rules. It is a key-value pairs - * where the values can be of any type (string, number, boolean, object, array, etc.). - */ @NoAutoDetect - class InnerMetadata + class Metadata @JsonCreator private constructor( + @JsonProperty("metadata") + @ExcludeMissing + private val metadata: JsonField = JsonMissing.of(), @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap() + private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * The metadata to be attached to the entity by existing rules. It is a key-value + * pairs where the values can be of any type (string, number, boolean, object, + * array, etc.). + */ + fun metadata(): Optional = + Optional.ofNullable(metadata.getNullable("metadata")) + + /** + * The metadata to be attached to the entity by existing rules. It is a key-value + * pairs where the values can be of any type (string, number, boolean, object, + * array, etc.). + */ + @JsonProperty("metadata") + @ExcludeMissing + fun _metadata(): JsonField = metadata + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties private var validated: Boolean = false - fun validate(): InnerMetadata = apply { + fun validate(): Metadata = apply { if (validated) { return@apply } + metadata().ifPresent { it.validate() } validated = true } @@ -1715,14 +1926,32 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [InnerMetadata]. */ + /** A builder for [Metadata]. */ class Builder internal constructor() { + private var metadata: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(innerMetadata: InnerMetadata) = apply { - additionalProperties = innerMetadata.additionalProperties.toMutableMap() + internal fun from(metadata: Metadata) = apply { + this.metadata = metadata.metadata + additionalProperties = metadata.additionalProperties.toMutableMap() + } + + /** + * The metadata to be attached to the entity by existing rules. It is a + * key-value pairs where the values can be of any type (string, number, boolean, + * object, array, etc.). + */ + fun metadata(metadata: InnerMetadata) = metadata(JsonField.of(metadata)) + + /** + * The metadata to be attached to the entity by existing rules. It is a + * key-value pairs where the values can be of any type (string, number, boolean, + * object, array, etc.). + */ + fun metadata(metadata: JsonField) = apply { + this.metadata = metadata } fun additionalProperties(additionalProperties: Map) = apply { @@ -1747,7 +1976,96 @@ private constructor( keys.forEach(::removeAdditionalProperty) } - fun build(): InnerMetadata = InnerMetadata(additionalProperties.toImmutable()) + fun build(): Metadata = Metadata(metadata, additionalProperties.toImmutable()) + } + + /** + * The metadata to be attached to the entity by existing rules. It is a key-value + * pairs where the values can be of any type (string, number, boolean, object, + * array, etc.). + */ + @NoAutoDetect + class InnerMetadata + @JsonCreator + private constructor( + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap() + ) { + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + private var validated: Boolean = false + + fun validate(): InnerMetadata = apply { + if (validated) { + return@apply + } + + validated = true + } + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun builder() = Builder() + } + + /** A builder for [InnerMetadata]. */ + class Builder internal constructor() { + + private var additionalProperties: MutableMap = + mutableMapOf() + + @JvmSynthetic + internal fun from(innerMetadata: InnerMetadata) = apply { + additionalProperties = innerMetadata.additionalProperties.toMutableMap() + } + + fun additionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties( + additionalProperties: Map + ) = apply { this.additionalProperties.putAll(additionalProperties) } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + fun build(): InnerMetadata = + InnerMetadata(additionalProperties.toImmutable()) + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is InnerMetadata && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "InnerMetadata{additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { @@ -1755,17 +2073,17 @@ private constructor( return true } - return /* spotless:off */ other is InnerMetadata && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Metadata && metadata == other.metadata && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(metadata, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "InnerMetadata{additionalProperties=$additionalProperties}" + "Metadata{metadata=$metadata, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { @@ -1773,7 +2091,7 @@ private constructor( return true } - return /* spotless:off */ other is Metadata && metadata == other.metadata && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Attributes && metadata == other.metadata && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ @@ -1783,7 +2101,7 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "Metadata{metadata=$metadata, additionalProperties=$additionalProperties}" + "Attributes{metadata=$metadata, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { @@ -1915,7 +2233,7 @@ private constructor( private val amount: JsonField = JsonMissing.of(), @JsonProperty("attributes") @ExcludeMissing - private val attributes: JsonField = JsonMissing.of(), + private val attributes: JsonField = JsonMissing.of(), @JsonProperty("currency") @ExcludeMissing private val currency: JsonField = JsonMissing.of(), @@ -1933,7 +2251,7 @@ private constructor( /** The tax amount in cents. */ fun amount(): Optional = Optional.ofNullable(amount.getNullable("amount")) - fun attributes(): Optional = + fun attributes(): Optional = Optional.ofNullable(attributes.getNullable("attributes")) /** The currency code. */ @@ -1953,7 +2271,7 @@ private constructor( @JsonProperty("attributes") @ExcludeMissing - fun _attributes(): JsonField = attributes + fun _attributes(): JsonField = attributes /** The currency code. */ @JsonProperty("currency") @ExcludeMissing fun _currency(): JsonField = currency @@ -1998,7 +2316,7 @@ private constructor( class Builder internal constructor() { private var amount: JsonField = JsonMissing.of() - private var attributes: JsonField = JsonMissing.of() + private var attributes: JsonField = JsonMissing.of() private var currency: JsonField = JsonMissing.of() private var employer: JsonField = JsonMissing.of() private var name: JsonField = JsonMissing.of() @@ -2029,11 +2347,13 @@ private constructor( /** The tax amount in cents. */ fun amount(amount: JsonField) = apply { this.amount = amount } - fun attributes(attributes: Metadata?) = attributes(JsonField.ofNullable(attributes)) + fun attributes(attributes: Attributes?) = attributes(JsonField.ofNullable(attributes)) - fun attributes(attributes: Optional) = attributes(attributes.orElse(null)) + fun attributes(attributes: Optional) = attributes(attributes.orElse(null)) - fun attributes(attributes: JsonField) = apply { this.attributes = attributes } + fun attributes(attributes: JsonField) = apply { + this.attributes = attributes + } /** The currency code. */ fun currency(currency: String?) = currency(JsonField.ofNullable(currency)) @@ -2107,30 +2427,22 @@ private constructor( } @NoAutoDetect - class Metadata + class Attributes @JsonCreator private constructor( @JsonProperty("metadata") @ExcludeMissing - private val metadata: JsonField = JsonMissing.of(), + private val metadata: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** - * The metadata to be attached to the entity by existing rules. It is a key-value pairs - * where the values can be of any type (string, number, boolean, object, array, etc.). - */ - fun metadata(): Optional = + fun metadata(): Optional = Optional.ofNullable(metadata.getNullable("metadata")) - /** - * The metadata to be attached to the entity by existing rules. It is a key-value pairs - * where the values can be of any type (string, number, boolean, object, array, etc.). - */ @JsonProperty("metadata") @ExcludeMissing - fun _metadata(): JsonField = metadata + fun _metadata(): JsonField = metadata @JsonAnyGetter @ExcludeMissing @@ -2138,7 +2450,7 @@ private constructor( private var validated: Boolean = false - fun validate(): Metadata = apply { + fun validate(): Attributes = apply { if (validated) { return@apply } @@ -2154,33 +2466,21 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [Metadata]. */ + /** A builder for [Attributes]. */ class Builder internal constructor() { - private var metadata: JsonField = JsonMissing.of() + private var metadata: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(metadata: Metadata) = apply { - this.metadata = metadata.metadata - additionalProperties = metadata.additionalProperties.toMutableMap() + internal fun from(attributes: Attributes) = apply { + metadata = attributes.metadata + additionalProperties = attributes.additionalProperties.toMutableMap() } - /** - * The metadata to be attached to the entity by existing rules. It is a key-value - * pairs where the values can be of any type (string, number, boolean, object, - * array, etc.). - */ - fun metadata(metadata: InnerMetadata) = metadata(JsonField.of(metadata)) + fun metadata(metadata: Metadata) = metadata(JsonField.of(metadata)) - /** - * The metadata to be attached to the entity by existing rules. It is a key-value - * pairs where the values can be of any type (string, number, boolean, object, - * array, etc.). - */ - fun metadata(metadata: JsonField) = apply { - this.metadata = metadata - } + fun metadata(metadata: JsonField) = apply { this.metadata = metadata } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -2204,32 +2504,49 @@ private constructor( keys.forEach(::removeAdditionalProperty) } - fun build(): Metadata = Metadata(metadata, additionalProperties.toImmutable()) + fun build(): Attributes = Attributes(metadata, additionalProperties.toImmutable()) } - /** - * The metadata to be attached to the entity by existing rules. It is a key-value pairs - * where the values can be of any type (string, number, boolean, object, array, etc.). - */ @NoAutoDetect - class InnerMetadata + class Metadata @JsonCreator private constructor( + @JsonProperty("metadata") + @ExcludeMissing + private val metadata: JsonField = JsonMissing.of(), @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap() + private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * The metadata to be attached to the entity by existing rules. It is a key-value + * pairs where the values can be of any type (string, number, boolean, object, + * array, etc.). + */ + fun metadata(): Optional = + Optional.ofNullable(metadata.getNullable("metadata")) + + /** + * The metadata to be attached to the entity by existing rules. It is a key-value + * pairs where the values can be of any type (string, number, boolean, object, + * array, etc.). + */ + @JsonProperty("metadata") + @ExcludeMissing + fun _metadata(): JsonField = metadata + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties private var validated: Boolean = false - fun validate(): InnerMetadata = apply { + fun validate(): Metadata = apply { if (validated) { return@apply } + metadata().ifPresent { it.validate() } validated = true } @@ -2240,14 +2557,32 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [InnerMetadata]. */ + /** A builder for [Metadata]. */ class Builder internal constructor() { + private var metadata: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(innerMetadata: InnerMetadata) = apply { - additionalProperties = innerMetadata.additionalProperties.toMutableMap() + internal fun from(metadata: Metadata) = apply { + this.metadata = metadata.metadata + additionalProperties = metadata.additionalProperties.toMutableMap() + } + + /** + * The metadata to be attached to the entity by existing rules. It is a + * key-value pairs where the values can be of any type (string, number, boolean, + * object, array, etc.). + */ + fun metadata(metadata: InnerMetadata) = metadata(JsonField.of(metadata)) + + /** + * The metadata to be attached to the entity by existing rules. It is a + * key-value pairs where the values can be of any type (string, number, boolean, + * object, array, etc.). + */ + fun metadata(metadata: JsonField) = apply { + this.metadata = metadata } fun additionalProperties(additionalProperties: Map) = apply { @@ -2272,7 +2607,96 @@ private constructor( keys.forEach(::removeAdditionalProperty) } - fun build(): InnerMetadata = InnerMetadata(additionalProperties.toImmutable()) + fun build(): Metadata = Metadata(metadata, additionalProperties.toImmutable()) + } + + /** + * The metadata to be attached to the entity by existing rules. It is a key-value + * pairs where the values can be of any type (string, number, boolean, object, + * array, etc.). + */ + @NoAutoDetect + class InnerMetadata + @JsonCreator + private constructor( + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap() + ) { + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + private var validated: Boolean = false + + fun validate(): InnerMetadata = apply { + if (validated) { + return@apply + } + + validated = true + } + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun builder() = Builder() + } + + /** A builder for [InnerMetadata]. */ + class Builder internal constructor() { + + private var additionalProperties: MutableMap = + mutableMapOf() + + @JvmSynthetic + internal fun from(innerMetadata: InnerMetadata) = apply { + additionalProperties = innerMetadata.additionalProperties.toMutableMap() + } + + fun additionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties( + additionalProperties: Map + ) = apply { this.additionalProperties.putAll(additionalProperties) } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + fun build(): InnerMetadata = + InnerMetadata(additionalProperties.toImmutable()) + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is InnerMetadata && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "InnerMetadata{additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { @@ -2280,17 +2704,17 @@ private constructor( return true } - return /* spotless:off */ other is InnerMetadata && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Metadata && metadata == other.metadata && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(metadata, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "InnerMetadata{additionalProperties=$additionalProperties}" + "Metadata{metadata=$metadata, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { @@ -2298,7 +2722,7 @@ private constructor( return true } - return /* spotless:off */ other is Metadata && metadata == other.metadata && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Attributes && metadata == other.metadata && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ @@ -2308,7 +2732,7 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "Metadata{metadata=$metadata, additionalProperties=$additionalProperties}" + "Attributes{metadata=$metadata, additionalProperties=$additionalProperties}" } /** The type of taxes. */ diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayrollPayGroupListParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayrollPayGroupListParams.kt index fe12118b..0b6a7c84 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayrollPayGroupListParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayrollPayGroupListParams.kt @@ -41,6 +41,8 @@ private constructor( companion object { + @JvmStatic fun none(): PayrollPayGroupListParams = builder().build() + @JvmStatic fun builder() = Builder() } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ProviderListParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ProviderListParams.kt index d73f15c9..2940b01d 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ProviderListParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ProviderListParams.kt @@ -27,6 +27,8 @@ private constructor( companion object { + @JvmStatic fun none(): ProviderListParams = builder().build() + @JvmStatic fun builder() = Builder() } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxConnectionAccountUpdateParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxConnectionAccountUpdateParams.kt index c487b917..521e6d18 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxConnectionAccountUpdateParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxConnectionAccountUpdateParams.kt @@ -149,6 +149,8 @@ private constructor( companion object { + @JvmStatic fun none(): SandboxConnectionAccountUpdateParams = builder().build() + @JvmStatic fun builder() = Builder() } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxDirectoryCreateParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxDirectoryCreateParams.kt index 69d1eaeb..3bca9b07 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxDirectoryCreateParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxDirectoryCreateParams.kt @@ -2361,6 +2361,8 @@ private constructor( companion object { + @JvmStatic fun none(): SandboxDirectoryCreateParams = builder().build() + @JvmStatic fun builder() = Builder() } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxJobConfigurationRetrieveParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxJobConfigurationRetrieveParams.kt index 8bde74ca..b13948c7 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxJobConfigurationRetrieveParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxJobConfigurationRetrieveParams.kt @@ -27,6 +27,8 @@ private constructor( companion object { + @JvmStatic fun none(): SandboxJobConfigurationRetrieveParams = builder().build() + @JvmStatic fun builder() = Builder() } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxPaymentCreateParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxPaymentCreateParams.kt index f28985d0..27e89a23 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxPaymentCreateParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxPaymentCreateParams.kt @@ -207,6 +207,8 @@ private constructor( companion object { + @JvmStatic fun none(): SandboxPaymentCreateParams = builder().build() + @JvmStatic fun builder() = Builder() } @@ -745,7 +747,7 @@ private constructor( private val amount: JsonField = JsonMissing.of(), @JsonProperty("attributes") @ExcludeMissing - private val attributes: JsonField = JsonMissing.of(), + private val attributes: JsonField = JsonMissing.of(), @JsonProperty("currency") @ExcludeMissing private val currency: JsonField = JsonMissing.of(), @@ -765,7 +767,7 @@ private constructor( /** The earnings amount in cents. */ fun amount(): Optional = Optional.ofNullable(amount.getNullable("amount")) - fun attributes(): Optional = + fun attributes(): Optional = Optional.ofNullable(attributes.getNullable("attributes")) /** The earnings currency code. */ @@ -788,7 +790,7 @@ private constructor( @JsonProperty("attributes") @ExcludeMissing - fun _attributes(): JsonField = attributes + fun _attributes(): JsonField = attributes /** The earnings currency code. */ @JsonProperty("currency") @ExcludeMissing fun _currency(): JsonField = currency @@ -836,7 +838,7 @@ private constructor( class Builder internal constructor() { private var amount: JsonField = JsonMissing.of() - private var attributes: JsonField = JsonMissing.of() + private var attributes: JsonField = JsonMissing.of() private var currency: JsonField = JsonMissing.of() private var hours: JsonField = JsonMissing.of() private var name: JsonField = JsonMissing.of() @@ -867,11 +869,13 @@ private constructor( /** The earnings amount in cents. */ fun amount(amount: JsonField) = apply { this.amount = amount } - fun attributes(attributes: Metadata?) = attributes(JsonField.ofNullable(attributes)) + fun attributes(attributes: Attributes?) = + attributes(JsonField.ofNullable(attributes)) - fun attributes(attributes: Optional) = attributes(attributes.orElse(null)) + fun attributes(attributes: Optional) = + attributes(attributes.orElse(null)) - fun attributes(attributes: JsonField) = apply { + fun attributes(attributes: JsonField) = apply { this.attributes = attributes } @@ -962,32 +966,22 @@ private constructor( } @NoAutoDetect - class Metadata + class Attributes @JsonCreator private constructor( @JsonProperty("metadata") @ExcludeMissing - private val metadata: JsonField = JsonMissing.of(), + private val metadata: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** - * The metadata to be attached to the entity by existing rules. It is a key-value - * pairs where the values can be of any type (string, number, boolean, object, - * array, etc.). - */ - fun metadata(): Optional = + fun metadata(): Optional = Optional.ofNullable(metadata.getNullable("metadata")) - /** - * The metadata to be attached to the entity by existing rules. It is a key-value - * pairs where the values can be of any type (string, number, boolean, object, - * array, etc.). - */ @JsonProperty("metadata") @ExcludeMissing - fun _metadata(): JsonField = metadata + fun _metadata(): JsonField = metadata @JsonAnyGetter @ExcludeMissing @@ -995,7 +989,7 @@ private constructor( private var validated: Boolean = false - fun validate(): Metadata = apply { + fun validate(): Attributes = apply { if (validated) { return@apply } @@ -1011,33 +1005,21 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [Metadata]. */ + /** A builder for [Attributes]. */ class Builder internal constructor() { - private var metadata: JsonField = JsonMissing.of() + private var metadata: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(metadata: Metadata) = apply { - this.metadata = metadata.metadata - additionalProperties = metadata.additionalProperties.toMutableMap() + internal fun from(attributes: Attributes) = apply { + metadata = attributes.metadata + additionalProperties = attributes.additionalProperties.toMutableMap() } - /** - * The metadata to be attached to the entity by existing rules. It is a - * key-value pairs where the values can be of any type (string, number, boolean, - * object, array, etc.). - */ - fun metadata(metadata: InnerMetadata) = metadata(JsonField.of(metadata)) + fun metadata(metadata: Metadata) = metadata(JsonField.of(metadata)) - /** - * The metadata to be attached to the entity by existing rules. It is a - * key-value pairs where the values can be of any type (string, number, boolean, - * object, array, etc.). - */ - fun metadata(metadata: JsonField) = apply { - this.metadata = metadata - } + fun metadata(metadata: JsonField) = apply { this.metadata = metadata } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -1061,33 +1043,50 @@ private constructor( keys.forEach(::removeAdditionalProperty) } - fun build(): Metadata = Metadata(metadata, additionalProperties.toImmutable()) + fun build(): Attributes = + Attributes(metadata, additionalProperties.toImmutable()) } - /** - * The metadata to be attached to the entity by existing rules. It is a key-value - * pairs where the values can be of any type (string, number, boolean, object, - * array, etc.). - */ @NoAutoDetect - class InnerMetadata + class Metadata @JsonCreator private constructor( + @JsonProperty("metadata") + @ExcludeMissing + private val metadata: JsonField = JsonMissing.of(), @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap() + private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * The metadata to be attached to the entity by existing rules. It is a + * key-value pairs where the values can be of any type (string, number, boolean, + * object, array, etc.). + */ + fun metadata(): Optional = + Optional.ofNullable(metadata.getNullable("metadata")) + + /** + * The metadata to be attached to the entity by existing rules. It is a + * key-value pairs where the values can be of any type (string, number, boolean, + * object, array, etc.). + */ + @JsonProperty("metadata") + @ExcludeMissing + fun _metadata(): JsonField = metadata + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties private var validated: Boolean = false - fun validate(): InnerMetadata = apply { + fun validate(): Metadata = apply { if (validated) { return@apply } + metadata().ifPresent { it.validate() } validated = true } @@ -1098,15 +1097,33 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [InnerMetadata]. */ + /** A builder for [Metadata]. */ class Builder internal constructor() { + private var metadata: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(innerMetadata: InnerMetadata) = apply { - additionalProperties = innerMetadata.additionalProperties.toMutableMap() + internal fun from(metadata: Metadata) = apply { + this.metadata = metadata.metadata + additionalProperties = metadata.additionalProperties.toMutableMap() + } + + /** + * The metadata to be attached to the entity by existing rules. It is a + * key-value pairs where the values can be of any type (string, number, + * boolean, object, array, etc.). + */ + fun metadata(metadata: InnerMetadata) = metadata(JsonField.of(metadata)) + + /** + * The metadata to be attached to the entity by existing rules. It is a + * key-value pairs where the values can be of any type (string, number, + * boolean, object, array, etc.). + */ + fun metadata(metadata: JsonField) = apply { + this.metadata = metadata } fun additionalProperties(additionalProperties: Map) = @@ -1131,8 +1148,99 @@ private constructor( keys.forEach(::removeAdditionalProperty) } - fun build(): InnerMetadata = - InnerMetadata(additionalProperties.toImmutable()) + fun build(): Metadata = + Metadata(metadata, additionalProperties.toImmutable()) + } + + /** + * The metadata to be attached to the entity by existing rules. It is a + * key-value pairs where the values can be of any type (string, number, boolean, + * object, array, etc.). + */ + @NoAutoDetect + class InnerMetadata + @JsonCreator + private constructor( + @JsonAnySetter + private val additionalProperties: Map = + immutableEmptyMap() + ) { + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + private var validated: Boolean = false + + fun validate(): InnerMetadata = apply { + if (validated) { + return@apply + } + + validated = true + } + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun builder() = Builder() + } + + /** A builder for [InnerMetadata]. */ + class Builder internal constructor() { + + private var additionalProperties: MutableMap = + mutableMapOf() + + @JvmSynthetic + internal fun from(innerMetadata: InnerMetadata) = apply { + additionalProperties = + innerMetadata.additionalProperties.toMutableMap() + } + + fun additionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties( + additionalProperties: Map + ) = apply { this.additionalProperties.putAll(additionalProperties) } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + fun build(): InnerMetadata = + InnerMetadata(additionalProperties.toImmutable()) + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is InnerMetadata && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "InnerMetadata{additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { @@ -1140,17 +1248,17 @@ private constructor( return true } - return /* spotless:off */ other is InnerMetadata && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Metadata && metadata == other.metadata && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(metadata, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "InnerMetadata{additionalProperties=$additionalProperties}" + "Metadata{metadata=$metadata, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { @@ -1158,7 +1266,7 @@ private constructor( return true } - return /* spotless:off */ other is Metadata && metadata == other.metadata && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Attributes && metadata == other.metadata && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ @@ -1168,7 +1276,7 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "Metadata{metadata=$metadata, additionalProperties=$additionalProperties}" + "Attributes{metadata=$metadata, additionalProperties=$additionalProperties}" } /** The type of earning. */ @@ -1368,7 +1476,7 @@ private constructor( private val amount: JsonField = JsonMissing.of(), @JsonProperty("attributes") @ExcludeMissing - private val attributes: JsonField = JsonMissing.of(), + private val attributes: JsonField = JsonMissing.of(), @JsonProperty("currency") @ExcludeMissing private val currency: JsonField = JsonMissing.of(), @@ -1388,7 +1496,7 @@ private constructor( /** The deduction amount in cents. */ fun amount(): Optional = Optional.ofNullable(amount.getNullable("amount")) - fun attributes(): Optional = + fun attributes(): Optional = Optional.ofNullable(attributes.getNullable("attributes")) /** The deduction currency. */ @@ -1408,7 +1516,7 @@ private constructor( @JsonProperty("attributes") @ExcludeMissing - fun _attributes(): JsonField = attributes + fun _attributes(): JsonField = attributes /** The deduction currency. */ @JsonProperty("currency") @ExcludeMissing fun _currency(): JsonField = currency @@ -1453,7 +1561,7 @@ private constructor( class Builder internal constructor() { private var amount: JsonField = JsonMissing.of() - private var attributes: JsonField = JsonMissing.of() + private var attributes: JsonField = JsonMissing.of() private var currency: JsonField = JsonMissing.of() private var name: JsonField = JsonMissing.of() private var preTax: JsonField = JsonMissing.of() @@ -1484,11 +1592,13 @@ private constructor( /** The deduction amount in cents. */ fun amount(amount: JsonField) = apply { this.amount = amount } - fun attributes(attributes: Metadata?) = attributes(JsonField.ofNullable(attributes)) + fun attributes(attributes: Attributes?) = + attributes(JsonField.ofNullable(attributes)) - fun attributes(attributes: Optional) = attributes(attributes.orElse(null)) + fun attributes(attributes: Optional) = + attributes(attributes.orElse(null)) - fun attributes(attributes: JsonField) = apply { + fun attributes(attributes: JsonField) = apply { this.attributes = attributes } @@ -1567,32 +1677,22 @@ private constructor( } @NoAutoDetect - class Metadata + class Attributes @JsonCreator private constructor( @JsonProperty("metadata") @ExcludeMissing - private val metadata: JsonField = JsonMissing.of(), + private val metadata: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** - * The metadata to be attached to the entity by existing rules. It is a key-value - * pairs where the values can be of any type (string, number, boolean, object, - * array, etc.). - */ - fun metadata(): Optional = + fun metadata(): Optional = Optional.ofNullable(metadata.getNullable("metadata")) - /** - * The metadata to be attached to the entity by existing rules. It is a key-value - * pairs where the values can be of any type (string, number, boolean, object, - * array, etc.). - */ @JsonProperty("metadata") @ExcludeMissing - fun _metadata(): JsonField = metadata + fun _metadata(): JsonField = metadata @JsonAnyGetter @ExcludeMissing @@ -1600,7 +1700,7 @@ private constructor( private var validated: Boolean = false - fun validate(): Metadata = apply { + fun validate(): Attributes = apply { if (validated) { return@apply } @@ -1616,33 +1716,21 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [Metadata]. */ + /** A builder for [Attributes]. */ class Builder internal constructor() { - private var metadata: JsonField = JsonMissing.of() + private var metadata: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(metadata: Metadata) = apply { - this.metadata = metadata.metadata - additionalProperties = metadata.additionalProperties.toMutableMap() + internal fun from(attributes: Attributes) = apply { + metadata = attributes.metadata + additionalProperties = attributes.additionalProperties.toMutableMap() } - /** - * The metadata to be attached to the entity by existing rules. It is a - * key-value pairs where the values can be of any type (string, number, boolean, - * object, array, etc.). - */ - fun metadata(metadata: InnerMetadata) = metadata(JsonField.of(metadata)) + fun metadata(metadata: Metadata) = metadata(JsonField.of(metadata)) - /** - * The metadata to be attached to the entity by existing rules. It is a - * key-value pairs where the values can be of any type (string, number, boolean, - * object, array, etc.). - */ - fun metadata(metadata: JsonField) = apply { - this.metadata = metadata - } + fun metadata(metadata: JsonField) = apply { this.metadata = metadata } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -1666,33 +1754,50 @@ private constructor( keys.forEach(::removeAdditionalProperty) } - fun build(): Metadata = Metadata(metadata, additionalProperties.toImmutable()) + fun build(): Attributes = + Attributes(metadata, additionalProperties.toImmutable()) } - /** - * The metadata to be attached to the entity by existing rules. It is a key-value - * pairs where the values can be of any type (string, number, boolean, object, - * array, etc.). - */ @NoAutoDetect - class InnerMetadata + class Metadata @JsonCreator private constructor( + @JsonProperty("metadata") + @ExcludeMissing + private val metadata: JsonField = JsonMissing.of(), @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap() + private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * The metadata to be attached to the entity by existing rules. It is a + * key-value pairs where the values can be of any type (string, number, boolean, + * object, array, etc.). + */ + fun metadata(): Optional = + Optional.ofNullable(metadata.getNullable("metadata")) + + /** + * The metadata to be attached to the entity by existing rules. It is a + * key-value pairs where the values can be of any type (string, number, boolean, + * object, array, etc.). + */ + @JsonProperty("metadata") + @ExcludeMissing + fun _metadata(): JsonField = metadata + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties private var validated: Boolean = false - fun validate(): InnerMetadata = apply { + fun validate(): Metadata = apply { if (validated) { return@apply } + metadata().ifPresent { it.validate() } validated = true } @@ -1703,15 +1808,33 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [InnerMetadata]. */ + /** A builder for [Metadata]. */ class Builder internal constructor() { + private var metadata: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(innerMetadata: InnerMetadata) = apply { - additionalProperties = innerMetadata.additionalProperties.toMutableMap() + internal fun from(metadata: Metadata) = apply { + this.metadata = metadata.metadata + additionalProperties = metadata.additionalProperties.toMutableMap() + } + + /** + * The metadata to be attached to the entity by existing rules. It is a + * key-value pairs where the values can be of any type (string, number, + * boolean, object, array, etc.). + */ + fun metadata(metadata: InnerMetadata) = metadata(JsonField.of(metadata)) + + /** + * The metadata to be attached to the entity by existing rules. It is a + * key-value pairs where the values can be of any type (string, number, + * boolean, object, array, etc.). + */ + fun metadata(metadata: JsonField) = apply { + this.metadata = metadata } fun additionalProperties(additionalProperties: Map) = @@ -1736,8 +1859,99 @@ private constructor( keys.forEach(::removeAdditionalProperty) } - fun build(): InnerMetadata = - InnerMetadata(additionalProperties.toImmutable()) + fun build(): Metadata = + Metadata(metadata, additionalProperties.toImmutable()) + } + + /** + * The metadata to be attached to the entity by existing rules. It is a + * key-value pairs where the values can be of any type (string, number, boolean, + * object, array, etc.). + */ + @NoAutoDetect + class InnerMetadata + @JsonCreator + private constructor( + @JsonAnySetter + private val additionalProperties: Map = + immutableEmptyMap() + ) { + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + private var validated: Boolean = false + + fun validate(): InnerMetadata = apply { + if (validated) { + return@apply + } + + validated = true + } + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun builder() = Builder() + } + + /** A builder for [InnerMetadata]. */ + class Builder internal constructor() { + + private var additionalProperties: MutableMap = + mutableMapOf() + + @JvmSynthetic + internal fun from(innerMetadata: InnerMetadata) = apply { + additionalProperties = + innerMetadata.additionalProperties.toMutableMap() + } + + fun additionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties( + additionalProperties: Map + ) = apply { this.additionalProperties.putAll(additionalProperties) } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + fun build(): InnerMetadata = + InnerMetadata(additionalProperties.toImmutable()) + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is InnerMetadata && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "InnerMetadata{additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { @@ -1745,17 +1959,17 @@ private constructor( return true } - return /* spotless:off */ other is InnerMetadata && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Metadata && metadata == other.metadata && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(metadata, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "InnerMetadata{additionalProperties=$additionalProperties}" + "Metadata{metadata=$metadata, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { @@ -1763,7 +1977,7 @@ private constructor( return true } - return /* spotless:off */ other is Metadata && metadata == other.metadata && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Attributes && metadata == other.metadata && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ @@ -1773,7 +1987,7 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "Metadata{metadata=$metadata, additionalProperties=$additionalProperties}" + "Attributes{metadata=$metadata, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { @@ -1803,7 +2017,7 @@ private constructor( private val amount: JsonField = JsonMissing.of(), @JsonProperty("attributes") @ExcludeMissing - private val attributes: JsonField = JsonMissing.of(), + private val attributes: JsonField = JsonMissing.of(), @JsonProperty("currency") @ExcludeMissing private val currency: JsonField = JsonMissing.of(), @@ -1820,7 +2034,7 @@ private constructor( /** The contribution amount in cents. */ fun amount(): Optional = Optional.ofNullable(amount.getNullable("amount")) - fun attributes(): Optional = + fun attributes(): Optional = Optional.ofNullable(attributes.getNullable("attributes")) /** The contribution currency. */ @@ -1837,7 +2051,7 @@ private constructor( @JsonProperty("attributes") @ExcludeMissing - fun _attributes(): JsonField = attributes + fun _attributes(): JsonField = attributes /** The contribution currency. */ @JsonProperty("currency") @ExcludeMissing fun _currency(): JsonField = currency @@ -1878,7 +2092,7 @@ private constructor( class Builder internal constructor() { private var amount: JsonField = JsonMissing.of() - private var attributes: JsonField = JsonMissing.of() + private var attributes: JsonField = JsonMissing.of() private var currency: JsonField = JsonMissing.of() private var name: JsonField = JsonMissing.of() private var type: JsonField = JsonMissing.of() @@ -1907,11 +2121,13 @@ private constructor( /** The contribution amount in cents. */ fun amount(amount: JsonField) = apply { this.amount = amount } - fun attributes(attributes: Metadata?) = attributes(JsonField.ofNullable(attributes)) + fun attributes(attributes: Attributes?) = + attributes(JsonField.ofNullable(attributes)) - fun attributes(attributes: Optional) = attributes(attributes.orElse(null)) + fun attributes(attributes: Optional) = + attributes(attributes.orElse(null)) - fun attributes(attributes: JsonField) = apply { + fun attributes(attributes: JsonField) = apply { this.attributes = attributes } @@ -1976,32 +2192,22 @@ private constructor( } @NoAutoDetect - class Metadata + class Attributes @JsonCreator private constructor( @JsonProperty("metadata") @ExcludeMissing - private val metadata: JsonField = JsonMissing.of(), + private val metadata: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** - * The metadata to be attached to the entity by existing rules. It is a key-value - * pairs where the values can be of any type (string, number, boolean, object, - * array, etc.). - */ - fun metadata(): Optional = + fun metadata(): Optional = Optional.ofNullable(metadata.getNullable("metadata")) - /** - * The metadata to be attached to the entity by existing rules. It is a key-value - * pairs where the values can be of any type (string, number, boolean, object, - * array, etc.). - */ @JsonProperty("metadata") @ExcludeMissing - fun _metadata(): JsonField = metadata + fun _metadata(): JsonField = metadata @JsonAnyGetter @ExcludeMissing @@ -2009,7 +2215,7 @@ private constructor( private var validated: Boolean = false - fun validate(): Metadata = apply { + fun validate(): Attributes = apply { if (validated) { return@apply } @@ -2025,33 +2231,21 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [Metadata]. */ + /** A builder for [Attributes]. */ class Builder internal constructor() { - private var metadata: JsonField = JsonMissing.of() + private var metadata: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(metadata: Metadata) = apply { - this.metadata = metadata.metadata - additionalProperties = metadata.additionalProperties.toMutableMap() + internal fun from(attributes: Attributes) = apply { + metadata = attributes.metadata + additionalProperties = attributes.additionalProperties.toMutableMap() } - /** - * The metadata to be attached to the entity by existing rules. It is a - * key-value pairs where the values can be of any type (string, number, boolean, - * object, array, etc.). - */ - fun metadata(metadata: InnerMetadata) = metadata(JsonField.of(metadata)) + fun metadata(metadata: Metadata) = metadata(JsonField.of(metadata)) - /** - * The metadata to be attached to the entity by existing rules. It is a - * key-value pairs where the values can be of any type (string, number, boolean, - * object, array, etc.). - */ - fun metadata(metadata: JsonField) = apply { - this.metadata = metadata - } + fun metadata(metadata: JsonField) = apply { this.metadata = metadata } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -2075,33 +2269,50 @@ private constructor( keys.forEach(::removeAdditionalProperty) } - fun build(): Metadata = Metadata(metadata, additionalProperties.toImmutable()) + fun build(): Attributes = + Attributes(metadata, additionalProperties.toImmutable()) } - /** - * The metadata to be attached to the entity by existing rules. It is a key-value - * pairs where the values can be of any type (string, number, boolean, object, - * array, etc.). - */ @NoAutoDetect - class InnerMetadata + class Metadata @JsonCreator private constructor( + @JsonProperty("metadata") + @ExcludeMissing + private val metadata: JsonField = JsonMissing.of(), @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap() + private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * The metadata to be attached to the entity by existing rules. It is a + * key-value pairs where the values can be of any type (string, number, boolean, + * object, array, etc.). + */ + fun metadata(): Optional = + Optional.ofNullable(metadata.getNullable("metadata")) + + /** + * The metadata to be attached to the entity by existing rules. It is a + * key-value pairs where the values can be of any type (string, number, boolean, + * object, array, etc.). + */ + @JsonProperty("metadata") + @ExcludeMissing + fun _metadata(): JsonField = metadata + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties private var validated: Boolean = false - fun validate(): InnerMetadata = apply { + fun validate(): Metadata = apply { if (validated) { return@apply } + metadata().ifPresent { it.validate() } validated = true } @@ -2112,15 +2323,33 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [InnerMetadata]. */ + /** A builder for [Metadata]. */ class Builder internal constructor() { + private var metadata: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(innerMetadata: InnerMetadata) = apply { - additionalProperties = innerMetadata.additionalProperties.toMutableMap() + internal fun from(metadata: Metadata) = apply { + this.metadata = metadata.metadata + additionalProperties = metadata.additionalProperties.toMutableMap() + } + + /** + * The metadata to be attached to the entity by existing rules. It is a + * key-value pairs where the values can be of any type (string, number, + * boolean, object, array, etc.). + */ + fun metadata(metadata: InnerMetadata) = metadata(JsonField.of(metadata)) + + /** + * The metadata to be attached to the entity by existing rules. It is a + * key-value pairs where the values can be of any type (string, number, + * boolean, object, array, etc.). + */ + fun metadata(metadata: JsonField) = apply { + this.metadata = metadata } fun additionalProperties(additionalProperties: Map) = @@ -2145,8 +2374,99 @@ private constructor( keys.forEach(::removeAdditionalProperty) } - fun build(): InnerMetadata = - InnerMetadata(additionalProperties.toImmutable()) + fun build(): Metadata = + Metadata(metadata, additionalProperties.toImmutable()) + } + + /** + * The metadata to be attached to the entity by existing rules. It is a + * key-value pairs where the values can be of any type (string, number, boolean, + * object, array, etc.). + */ + @NoAutoDetect + class InnerMetadata + @JsonCreator + private constructor( + @JsonAnySetter + private val additionalProperties: Map = + immutableEmptyMap() + ) { + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + private var validated: Boolean = false + + fun validate(): InnerMetadata = apply { + if (validated) { + return@apply + } + + validated = true + } + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun builder() = Builder() + } + + /** A builder for [InnerMetadata]. */ + class Builder internal constructor() { + + private var additionalProperties: MutableMap = + mutableMapOf() + + @JvmSynthetic + internal fun from(innerMetadata: InnerMetadata) = apply { + additionalProperties = + innerMetadata.additionalProperties.toMutableMap() + } + + fun additionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties( + additionalProperties: Map + ) = apply { this.additionalProperties.putAll(additionalProperties) } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + fun build(): InnerMetadata = + InnerMetadata(additionalProperties.toImmutable()) + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is InnerMetadata && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "InnerMetadata{additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { @@ -2154,17 +2474,17 @@ private constructor( return true } - return /* spotless:off */ other is InnerMetadata && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Metadata && metadata == other.metadata && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(metadata, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "InnerMetadata{additionalProperties=$additionalProperties}" + "Metadata{metadata=$metadata, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { @@ -2172,7 +2492,7 @@ private constructor( return true } - return /* spotless:off */ other is Metadata && metadata == other.metadata && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Attributes && metadata == other.metadata && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ @@ -2182,7 +2502,7 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "Metadata{metadata=$metadata, additionalProperties=$additionalProperties}" + "Attributes{metadata=$metadata, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { @@ -2317,7 +2637,7 @@ private constructor( private val amount: JsonField = JsonMissing.of(), @JsonProperty("attributes") @ExcludeMissing - private val attributes: JsonField = JsonMissing.of(), + private val attributes: JsonField = JsonMissing.of(), @JsonProperty("currency") @ExcludeMissing private val currency: JsonField = JsonMissing.of(), @@ -2337,7 +2657,7 @@ private constructor( /** The tax amount in cents. */ fun amount(): Optional = Optional.ofNullable(amount.getNullable("amount")) - fun attributes(): Optional = + fun attributes(): Optional = Optional.ofNullable(attributes.getNullable("attributes")) /** The currency code. */ @@ -2358,7 +2678,7 @@ private constructor( @JsonProperty("attributes") @ExcludeMissing - fun _attributes(): JsonField = attributes + fun _attributes(): JsonField = attributes /** The currency code. */ @JsonProperty("currency") @ExcludeMissing fun _currency(): JsonField = currency @@ -2403,7 +2723,7 @@ private constructor( class Builder internal constructor() { private var amount: JsonField = JsonMissing.of() - private var attributes: JsonField = JsonMissing.of() + private var attributes: JsonField = JsonMissing.of() private var currency: JsonField = JsonMissing.of() private var employer: JsonField = JsonMissing.of() private var name: JsonField = JsonMissing.of() @@ -2434,11 +2754,13 @@ private constructor( /** The tax amount in cents. */ fun amount(amount: JsonField) = apply { this.amount = amount } - fun attributes(attributes: Metadata?) = attributes(JsonField.ofNullable(attributes)) + fun attributes(attributes: Attributes?) = + attributes(JsonField.ofNullable(attributes)) - fun attributes(attributes: Optional) = attributes(attributes.orElse(null)) + fun attributes(attributes: Optional) = + attributes(attributes.orElse(null)) - fun attributes(attributes: JsonField) = apply { + fun attributes(attributes: JsonField) = apply { this.attributes = attributes } @@ -2518,32 +2840,22 @@ private constructor( } @NoAutoDetect - class Metadata + class Attributes @JsonCreator private constructor( @JsonProperty("metadata") @ExcludeMissing - private val metadata: JsonField = JsonMissing.of(), + private val metadata: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** - * The metadata to be attached to the entity by existing rules. It is a key-value - * pairs where the values can be of any type (string, number, boolean, object, - * array, etc.). - */ - fun metadata(): Optional = + fun metadata(): Optional = Optional.ofNullable(metadata.getNullable("metadata")) - /** - * The metadata to be attached to the entity by existing rules. It is a key-value - * pairs where the values can be of any type (string, number, boolean, object, - * array, etc.). - */ @JsonProperty("metadata") @ExcludeMissing - fun _metadata(): JsonField = metadata + fun _metadata(): JsonField = metadata @JsonAnyGetter @ExcludeMissing @@ -2551,7 +2863,7 @@ private constructor( private var validated: Boolean = false - fun validate(): Metadata = apply { + fun validate(): Attributes = apply { if (validated) { return@apply } @@ -2567,33 +2879,21 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [Metadata]. */ + /** A builder for [Attributes]. */ class Builder internal constructor() { - private var metadata: JsonField = JsonMissing.of() + private var metadata: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(metadata: Metadata) = apply { - this.metadata = metadata.metadata - additionalProperties = metadata.additionalProperties.toMutableMap() + internal fun from(attributes: Attributes) = apply { + metadata = attributes.metadata + additionalProperties = attributes.additionalProperties.toMutableMap() } - /** - * The metadata to be attached to the entity by existing rules. It is a - * key-value pairs where the values can be of any type (string, number, boolean, - * object, array, etc.). - */ - fun metadata(metadata: InnerMetadata) = metadata(JsonField.of(metadata)) + fun metadata(metadata: Metadata) = metadata(JsonField.of(metadata)) - /** - * The metadata to be attached to the entity by existing rules. It is a - * key-value pairs where the values can be of any type (string, number, boolean, - * object, array, etc.). - */ - fun metadata(metadata: JsonField) = apply { - this.metadata = metadata - } + fun metadata(metadata: JsonField) = apply { this.metadata = metadata } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -2617,33 +2917,50 @@ private constructor( keys.forEach(::removeAdditionalProperty) } - fun build(): Metadata = Metadata(metadata, additionalProperties.toImmutable()) + fun build(): Attributes = + Attributes(metadata, additionalProperties.toImmutable()) } - /** - * The metadata to be attached to the entity by existing rules. It is a key-value - * pairs where the values can be of any type (string, number, boolean, object, - * array, etc.). - */ @NoAutoDetect - class InnerMetadata + class Metadata @JsonCreator private constructor( + @JsonProperty("metadata") + @ExcludeMissing + private val metadata: JsonField = JsonMissing.of(), @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap() + private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * The metadata to be attached to the entity by existing rules. It is a + * key-value pairs where the values can be of any type (string, number, boolean, + * object, array, etc.). + */ + fun metadata(): Optional = + Optional.ofNullable(metadata.getNullable("metadata")) + + /** + * The metadata to be attached to the entity by existing rules. It is a + * key-value pairs where the values can be of any type (string, number, boolean, + * object, array, etc.). + */ + @JsonProperty("metadata") + @ExcludeMissing + fun _metadata(): JsonField = metadata + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties private var validated: Boolean = false - fun validate(): InnerMetadata = apply { + fun validate(): Metadata = apply { if (validated) { return@apply } + metadata().ifPresent { it.validate() } validated = true } @@ -2654,15 +2971,33 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [InnerMetadata]. */ + /** A builder for [Metadata]. */ class Builder internal constructor() { + private var metadata: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(innerMetadata: InnerMetadata) = apply { - additionalProperties = innerMetadata.additionalProperties.toMutableMap() + internal fun from(metadata: Metadata) = apply { + this.metadata = metadata.metadata + additionalProperties = metadata.additionalProperties.toMutableMap() + } + + /** + * The metadata to be attached to the entity by existing rules. It is a + * key-value pairs where the values can be of any type (string, number, + * boolean, object, array, etc.). + */ + fun metadata(metadata: InnerMetadata) = metadata(JsonField.of(metadata)) + + /** + * The metadata to be attached to the entity by existing rules. It is a + * key-value pairs where the values can be of any type (string, number, + * boolean, object, array, etc.). + */ + fun metadata(metadata: JsonField) = apply { + this.metadata = metadata } fun additionalProperties(additionalProperties: Map) = @@ -2687,8 +3022,99 @@ private constructor( keys.forEach(::removeAdditionalProperty) } - fun build(): InnerMetadata = - InnerMetadata(additionalProperties.toImmutable()) + fun build(): Metadata = + Metadata(metadata, additionalProperties.toImmutable()) + } + + /** + * The metadata to be attached to the entity by existing rules. It is a + * key-value pairs where the values can be of any type (string, number, boolean, + * object, array, etc.). + */ + @NoAutoDetect + class InnerMetadata + @JsonCreator + private constructor( + @JsonAnySetter + private val additionalProperties: Map = + immutableEmptyMap() + ) { + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + private var validated: Boolean = false + + fun validate(): InnerMetadata = apply { + if (validated) { + return@apply + } + + validated = true + } + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun builder() = Builder() + } + + /** A builder for [InnerMetadata]. */ + class Builder internal constructor() { + + private var additionalProperties: MutableMap = + mutableMapOf() + + @JvmSynthetic + internal fun from(innerMetadata: InnerMetadata) = apply { + additionalProperties = + innerMetadata.additionalProperties.toMutableMap() + } + + fun additionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties( + additionalProperties: Map + ) = apply { this.additionalProperties.putAll(additionalProperties) } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + fun build(): InnerMetadata = + InnerMetadata(additionalProperties.toImmutable()) + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is InnerMetadata && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "InnerMetadata{additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { @@ -2696,17 +3122,17 @@ private constructor( return true } - return /* spotless:off */ other is InnerMetadata && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Metadata && metadata == other.metadata && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(metadata, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "InnerMetadata{additionalProperties=$additionalProperties}" + "Metadata{metadata=$metadata, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { @@ -2714,7 +3140,7 @@ private constructor( return true } - return /* spotless:off */ other is Metadata && metadata == other.metadata && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Attributes && metadata == other.metadata && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ @@ -2724,7 +3150,7 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "Metadata{metadata=$metadata, additionalProperties=$additionalProperties}" + "Attributes{metadata=$metadata, additionalProperties=$additionalProperties}" } /** The type of taxes. */ diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/AccountServiceAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/AccountServiceAsync.kt index b602490d..f40cf58d 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/AccountServiceAsync.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/AccountServiceAsync.kt @@ -16,14 +16,22 @@ interface AccountServiceAsync { /** Disconnect one or more `access_token`s from your application. */ @JvmOverloads fun disconnect( - params: AccountDisconnectParams, + params: AccountDisconnectParams = AccountDisconnectParams.none(), requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture + /** Disconnect one or more `access_token`s from your application. */ + fun disconnect(requestOptions: RequestOptions): CompletableFuture = + disconnect(AccountDisconnectParams.none(), requestOptions) + /** Read account information associated with an `access_token` */ @JvmOverloads fun introspect( - params: AccountIntrospectParams, + params: AccountIntrospectParams = AccountIntrospectParams.none(), requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture + + /** Read account information associated with an `access_token` */ + fun introspect(requestOptions: RequestOptions): CompletableFuture = + introspect(AccountIntrospectParams.none(), requestOptions) } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/ProviderServiceAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/ProviderServiceAsync.kt index 7fe3883c..954bba83 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/ProviderServiceAsync.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/ProviderServiceAsync.kt @@ -14,7 +14,11 @@ interface ProviderServiceAsync { /** Return details on all available payroll and HR systems. */ @JvmOverloads fun list( - params: ProviderListParams, + params: ProviderListParams = ProviderListParams.none(), requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture + + /** Return details on all available payroll and HR systems. */ + fun list(requestOptions: RequestOptions): CompletableFuture = + list(ProviderListParams.none(), requestOptions) } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/BenefitServiceAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/BenefitServiceAsync.kt index 6f547577..c764d97d 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/BenefitServiceAsync.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/BenefitServiceAsync.kt @@ -28,10 +28,17 @@ interface BenefitServiceAsync { */ @JvmOverloads fun create( - params: HrisBenefitCreateParams, + params: HrisBenefitCreateParams = HrisBenefitCreateParams.none(), requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture + /** + * Creates a new company-wide deduction or contribution. Please use the `/providers` endpoint to + * view available types for each provider. + */ + fun create(requestOptions: RequestOptions): CompletableFuture = + create(HrisBenefitCreateParams.none(), requestOptions) + /** Lists deductions and contributions information for a given item */ @JvmOverloads fun retrieve( @@ -49,14 +56,25 @@ interface BenefitServiceAsync { /** List all company-wide deductions and contributions. */ @JvmOverloads fun list( - params: HrisBenefitListParams, + params: HrisBenefitListParams = HrisBenefitListParams.none(), requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture + /** List all company-wide deductions and contributions. */ + fun list(requestOptions: RequestOptions): CompletableFuture = + list(HrisBenefitListParams.none(), requestOptions) + /** Get deductions metadata */ @JvmOverloads fun listSupportedBenefits( - params: HrisBenefitListSupportedBenefitsParams, + params: HrisBenefitListSupportedBenefitsParams = + HrisBenefitListSupportedBenefitsParams.none(), requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture + + /** Get deductions metadata */ + fun listSupportedBenefits( + requestOptions: RequestOptions + ): CompletableFuture = + listSupportedBenefits(HrisBenefitListSupportedBenefitsParams.none(), requestOptions) } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/CompanyServiceAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/CompanyServiceAsync.kt index 250bddee..aaee4fc4 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/CompanyServiceAsync.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/CompanyServiceAsync.kt @@ -14,7 +14,11 @@ interface CompanyServiceAsync { /** Read basic company data */ @JvmOverloads fun retrieve( - params: HrisCompanyRetrieveParams, + params: HrisCompanyRetrieveParams = HrisCompanyRetrieveParams.none(), requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture + + /** Read basic company data */ + fun retrieve(requestOptions: RequestOptions): CompletableFuture = + retrieve(HrisCompanyRetrieveParams.none(), requestOptions) } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/DirectoryServiceAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/DirectoryServiceAsync.kt index e0afdd7f..01ae6ff8 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/DirectoryServiceAsync.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/DirectoryServiceAsync.kt @@ -16,15 +16,26 @@ interface DirectoryServiceAsync { /** Read company directory and organization structure */ @JvmOverloads fun list( - params: HrisDirectoryListParams, + params: HrisDirectoryListParams = HrisDirectoryListParams.none(), requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture + /** Read company directory and organization structure */ + fun list(requestOptions: RequestOptions): CompletableFuture = + list(HrisDirectoryListParams.none(), requestOptions) + /** Read company directory and organization structure */ @Deprecated("use `list` instead") @JvmOverloads fun listIndividuals( - params: HrisDirectoryListIndividualsParams, + params: HrisDirectoryListIndividualsParams = HrisDirectoryListIndividualsParams.none(), requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture + + /** Read company directory and organization structure */ + @Deprecated("use `list` instead") + fun listIndividuals( + requestOptions: RequestOptions + ): CompletableFuture = + listIndividuals(HrisDirectoryListIndividualsParams.none(), requestOptions) } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/DocumentServiceAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/DocumentServiceAsync.kt index 80833114..59291b23 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/DocumentServiceAsync.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/DocumentServiceAsync.kt @@ -18,10 +18,16 @@ interface DocumentServiceAsync { */ @JvmOverloads fun list( - params: HrisDocumentListParams, + params: HrisDocumentListParams = HrisDocumentListParams.none(), requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture + /** + * **Beta:** This endpoint is in beta and may change. Retrieve a list of company-wide documents. + */ + fun list(requestOptions: RequestOptions): CompletableFuture = + list(HrisDocumentListParams.none(), requestOptions) + /** * **Beta:** This endpoint is in beta and may change. Retrieve details of a specific document by * its ID. diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/IndividualServiceAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/IndividualServiceAsync.kt index c888eba6..c1e2218e 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/IndividualServiceAsync.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/IndividualServiceAsync.kt @@ -14,7 +14,13 @@ interface IndividualServiceAsync { /** Read individual data, excluding income and employment data */ @JvmOverloads fun retrieveMany( - params: HrisIndividualRetrieveManyParams, + params: HrisIndividualRetrieveManyParams = HrisIndividualRetrieveManyParams.none(), requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture + + /** Read individual data, excluding income and employment data */ + fun retrieveMany( + requestOptions: RequestOptions + ): CompletableFuture = + retrieveMany(HrisIndividualRetrieveManyParams.none(), requestOptions) } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/jobs/AutomatedServiceAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/jobs/AutomatedServiceAsync.kt index aecaf07b..3d03563b 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/jobs/AutomatedServiceAsync.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/jobs/AutomatedServiceAsync.kt @@ -32,10 +32,28 @@ interface AutomatedServiceAsync { */ @JvmOverloads fun create( - params: JobAutomatedCreateParams, + params: JobAutomatedCreateParams = JobAutomatedCreateParams.none(), requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture + /** + * Enqueue an automated job. + * + * `data_sync_all`: Enqueue a job to re-sync all data for a connection. `data_sync_all` has a + * concurrency limit of 1 job at a time per connection. This means that if this endpoint is + * called while a job is already in progress for this connection, Finch will return the `job_id` + * of the job that is currently in progress. Finch allows a fixed window rate limit of 1 forced + * refresh per hour per connection. + * + * `w4_form_employee_sync`: Enqueues a job for sync W-4 data for a particular individual, + * identified by `individual_id`. This feature is currently in beta. + * + * This endpoint is available for _Scale_ tier customers as an add-on. To request access to this + * endpoint, please contact your Finch account manager. + */ + fun create(requestOptions: RequestOptions): CompletableFuture = + create(JobAutomatedCreateParams.none(), requestOptions) + /** Get an automated job by `job_id`. */ @JvmOverloads fun retrieve( @@ -50,7 +68,15 @@ interface AutomatedServiceAsync { */ @JvmOverloads fun list( - params: JobAutomatedListParams, + params: JobAutomatedListParams = JobAutomatedListParams.none(), requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture + + /** + * Get all automated jobs. Automated jobs are completed by a machine. By default, jobs are + * sorted in descending order by submission time. For scheduled jobs such as data syncs, only + * the next scheduled job is shown. + */ + fun list(requestOptions: RequestOptions): CompletableFuture = + list(JobAutomatedListParams.none(), requestOptions) } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/payroll/PayGroupServiceAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/payroll/PayGroupServiceAsync.kt index 92ee6590..bc144858 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/payroll/PayGroupServiceAsync.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/payroll/PayGroupServiceAsync.kt @@ -23,7 +23,11 @@ interface PayGroupServiceAsync { /** Read company pay groups and frequencies */ @JvmOverloads fun list( - params: PayrollPayGroupListParams, + params: PayrollPayGroupListParams = PayrollPayGroupListParams.none(), requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture + + /** Read company pay groups and frequencies */ + fun list(requestOptions: RequestOptions): CompletableFuture = + list(PayrollPayGroupListParams.none(), requestOptions) } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/DirectoryServiceAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/DirectoryServiceAsync.kt index 7802b965..8155d37a 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/DirectoryServiceAsync.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/DirectoryServiceAsync.kt @@ -14,7 +14,11 @@ interface DirectoryServiceAsync { /** Add new individuals to a sandbox company */ @JvmOverloads fun create( - params: SandboxDirectoryCreateParams, + params: SandboxDirectoryCreateParams = SandboxDirectoryCreateParams.none(), requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture> + + /** Add new individuals to a sandbox company */ + fun create(requestOptions: RequestOptions): CompletableFuture> = + create(SandboxDirectoryCreateParams.none(), requestOptions) } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/PaymentServiceAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/PaymentServiceAsync.kt index 00f99f4c..efd8f707 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/PaymentServiceAsync.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/PaymentServiceAsync.kt @@ -14,7 +14,11 @@ interface PaymentServiceAsync { /** Add a new sandbox payment */ @JvmOverloads fun create( - params: SandboxPaymentCreateParams, + params: SandboxPaymentCreateParams = SandboxPaymentCreateParams.none(), requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture + + /** Add a new sandbox payment */ + fun create(requestOptions: RequestOptions): CompletableFuture = + create(SandboxPaymentCreateParams.none(), requestOptions) } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/connections/AccountServiceAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/connections/AccountServiceAsync.kt index 9b1de597..ff94d659 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/connections/AccountServiceAsync.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/connections/AccountServiceAsync.kt @@ -26,7 +26,14 @@ interface AccountServiceAsync { */ @JvmOverloads fun update( - params: SandboxConnectionAccountUpdateParams, + params: SandboxConnectionAccountUpdateParams = SandboxConnectionAccountUpdateParams.none(), requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture + + /** + * Update an existing sandbox account. Change the connection status to understand how the Finch + * API responds. + */ + fun update(requestOptions: RequestOptions): CompletableFuture = + update(SandboxConnectionAccountUpdateParams.none(), requestOptions) } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/jobs/ConfigurationServiceAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/jobs/ConfigurationServiceAsync.kt index e9fa09f4..89dd69a8 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/jobs/ConfigurationServiceAsync.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/jobs/ConfigurationServiceAsync.kt @@ -15,10 +15,15 @@ interface ConfigurationServiceAsync { /** Get configurations for sandbox jobs */ @JvmOverloads fun retrieve( - params: SandboxJobConfigurationRetrieveParams, + params: SandboxJobConfigurationRetrieveParams = + SandboxJobConfigurationRetrieveParams.none(), requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture> + /** Get configurations for sandbox jobs */ + fun retrieve(requestOptions: RequestOptions): CompletableFuture> = + retrieve(SandboxJobConfigurationRetrieveParams.none(), requestOptions) + /** Update configurations for sandbox jobs */ @JvmOverloads fun update( diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/AccountService.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/AccountService.kt index 5cc0334d..fb69f10a 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/AccountService.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/AccountService.kt @@ -15,14 +15,22 @@ interface AccountService { /** Disconnect one or more `access_token`s from your application. */ @JvmOverloads fun disconnect( - params: AccountDisconnectParams, + params: AccountDisconnectParams = AccountDisconnectParams.none(), requestOptions: RequestOptions = RequestOptions.none(), ): DisconnectResponse + /** Disconnect one or more `access_token`s from your application. */ + fun disconnect(requestOptions: RequestOptions): DisconnectResponse = + disconnect(AccountDisconnectParams.none(), requestOptions) + /** Read account information associated with an `access_token` */ @JvmOverloads fun introspect( - params: AccountIntrospectParams, + params: AccountIntrospectParams = AccountIntrospectParams.none(), requestOptions: RequestOptions = RequestOptions.none(), ): Introspection + + /** Read account information associated with an `access_token` */ + fun introspect(requestOptions: RequestOptions): Introspection = + introspect(AccountIntrospectParams.none(), requestOptions) } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/ProviderService.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/ProviderService.kt index 9c534a0d..b37847a4 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/ProviderService.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/ProviderService.kt @@ -13,7 +13,11 @@ interface ProviderService { /** Return details on all available payroll and HR systems. */ @JvmOverloads fun list( - params: ProviderListParams, + params: ProviderListParams = ProviderListParams.none(), requestOptions: RequestOptions = RequestOptions.none(), ): ProviderListPage + + /** Return details on all available payroll and HR systems. */ + fun list(requestOptions: RequestOptions): ProviderListPage = + list(ProviderListParams.none(), requestOptions) } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/BenefitService.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/BenefitService.kt index 1c6a96e2..6b03b8da 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/BenefitService.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/BenefitService.kt @@ -27,10 +27,17 @@ interface BenefitService { */ @JvmOverloads fun create( - params: HrisBenefitCreateParams, + params: HrisBenefitCreateParams = HrisBenefitCreateParams.none(), requestOptions: RequestOptions = RequestOptions.none(), ): CreateCompanyBenefitsResponse + /** + * Creates a new company-wide deduction or contribution. Please use the `/providers` endpoint to + * view available types for each provider. + */ + fun create(requestOptions: RequestOptions): CreateCompanyBenefitsResponse = + create(HrisBenefitCreateParams.none(), requestOptions) + /** Lists deductions and contributions information for a given item */ @JvmOverloads fun retrieve( @@ -48,14 +55,25 @@ interface BenefitService { /** List all company-wide deductions and contributions. */ @JvmOverloads fun list( - params: HrisBenefitListParams, + params: HrisBenefitListParams = HrisBenefitListParams.none(), requestOptions: RequestOptions = RequestOptions.none(), ): HrisBenefitListPage + /** List all company-wide deductions and contributions. */ + fun list(requestOptions: RequestOptions): HrisBenefitListPage = + list(HrisBenefitListParams.none(), requestOptions) + /** Get deductions metadata */ @JvmOverloads fun listSupportedBenefits( - params: HrisBenefitListSupportedBenefitsParams, + params: HrisBenefitListSupportedBenefitsParams = + HrisBenefitListSupportedBenefitsParams.none(), requestOptions: RequestOptions = RequestOptions.none(), ): HrisBenefitListSupportedBenefitsPage + + /** Get deductions metadata */ + fun listSupportedBenefits( + requestOptions: RequestOptions + ): HrisBenefitListSupportedBenefitsPage = + listSupportedBenefits(HrisBenefitListSupportedBenefitsParams.none(), requestOptions) } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/CompanyService.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/CompanyService.kt index e14f27cd..def4fcd0 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/CompanyService.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/CompanyService.kt @@ -13,7 +13,11 @@ interface CompanyService { /** Read basic company data */ @JvmOverloads fun retrieve( - params: HrisCompanyRetrieveParams, + params: HrisCompanyRetrieveParams = HrisCompanyRetrieveParams.none(), requestOptions: RequestOptions = RequestOptions.none(), ): Company + + /** Read basic company data */ + fun retrieve(requestOptions: RequestOptions): Company = + retrieve(HrisCompanyRetrieveParams.none(), requestOptions) } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/DirectoryService.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/DirectoryService.kt index 5223328e..6304c989 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/DirectoryService.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/DirectoryService.kt @@ -15,15 +15,24 @@ interface DirectoryService { /** Read company directory and organization structure */ @JvmOverloads fun list( - params: HrisDirectoryListParams, + params: HrisDirectoryListParams = HrisDirectoryListParams.none(), requestOptions: RequestOptions = RequestOptions.none(), ): HrisDirectoryListPage + /** Read company directory and organization structure */ + fun list(requestOptions: RequestOptions): HrisDirectoryListPage = + list(HrisDirectoryListParams.none(), requestOptions) + /** Read company directory and organization structure */ @Deprecated("use `list` instead") @JvmOverloads fun listIndividuals( - params: HrisDirectoryListIndividualsParams, + params: HrisDirectoryListIndividualsParams = HrisDirectoryListIndividualsParams.none(), requestOptions: RequestOptions = RequestOptions.none(), ): HrisDirectoryListIndividualsPage + + /** Read company directory and organization structure */ + @Deprecated("use `list` instead") + fun listIndividuals(requestOptions: RequestOptions): HrisDirectoryListIndividualsPage = + listIndividuals(HrisDirectoryListIndividualsParams.none(), requestOptions) } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/DocumentService.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/DocumentService.kt index 3e06ad08..ca9377fc 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/DocumentService.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/DocumentService.kt @@ -17,10 +17,16 @@ interface DocumentService { */ @JvmOverloads fun list( - params: HrisDocumentListParams, + params: HrisDocumentListParams = HrisDocumentListParams.none(), requestOptions: RequestOptions = RequestOptions.none(), ): DocumentListResponse + /** + * **Beta:** This endpoint is in beta and may change. Retrieve a list of company-wide documents. + */ + fun list(requestOptions: RequestOptions): DocumentListResponse = + list(HrisDocumentListParams.none(), requestOptions) + /** * **Beta:** This endpoint is in beta and may change. Retrieve details of a specific document by * its ID. diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/IndividualService.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/IndividualService.kt index 669e8aa9..1c0a766b 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/IndividualService.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/IndividualService.kt @@ -13,7 +13,11 @@ interface IndividualService { /** Read individual data, excluding income and employment data */ @JvmOverloads fun retrieveMany( - params: HrisIndividualRetrieveManyParams, + params: HrisIndividualRetrieveManyParams = HrisIndividualRetrieveManyParams.none(), requestOptions: RequestOptions = RequestOptions.none(), ): HrisIndividualRetrieveManyPage + + /** Read individual data, excluding income and employment data */ + fun retrieveMany(requestOptions: RequestOptions): HrisIndividualRetrieveManyPage = + retrieveMany(HrisIndividualRetrieveManyParams.none(), requestOptions) } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/jobs/AutomatedService.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/jobs/AutomatedService.kt index dc4e6545..1755269a 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/jobs/AutomatedService.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/jobs/AutomatedService.kt @@ -31,10 +31,28 @@ interface AutomatedService { */ @JvmOverloads fun create( - params: JobAutomatedCreateParams, + params: JobAutomatedCreateParams = JobAutomatedCreateParams.none(), requestOptions: RequestOptions = RequestOptions.none(), ): AutomatedCreateResponse + /** + * Enqueue an automated job. + * + * `data_sync_all`: Enqueue a job to re-sync all data for a connection. `data_sync_all` has a + * concurrency limit of 1 job at a time per connection. This means that if this endpoint is + * called while a job is already in progress for this connection, Finch will return the `job_id` + * of the job that is currently in progress. Finch allows a fixed window rate limit of 1 forced + * refresh per hour per connection. + * + * `w4_form_employee_sync`: Enqueues a job for sync W-4 data for a particular individual, + * identified by `individual_id`. This feature is currently in beta. + * + * This endpoint is available for _Scale_ tier customers as an add-on. To request access to this + * endpoint, please contact your Finch account manager. + */ + fun create(requestOptions: RequestOptions): AutomatedCreateResponse = + create(JobAutomatedCreateParams.none(), requestOptions) + /** Get an automated job by `job_id`. */ @JvmOverloads fun retrieve( @@ -49,7 +67,15 @@ interface AutomatedService { */ @JvmOverloads fun list( - params: JobAutomatedListParams, + params: JobAutomatedListParams = JobAutomatedListParams.none(), requestOptions: RequestOptions = RequestOptions.none(), ): JobAutomatedListPage + + /** + * Get all automated jobs. Automated jobs are completed by a machine. By default, jobs are + * sorted in descending order by submission time. For scheduled jobs such as data syncs, only + * the next scheduled job is shown. + */ + fun list(requestOptions: RequestOptions): JobAutomatedListPage = + list(JobAutomatedListParams.none(), requestOptions) } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/payroll/PayGroupService.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/payroll/PayGroupService.kt index 660dcb3a..b5c0e37b 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/payroll/PayGroupService.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/payroll/PayGroupService.kt @@ -22,7 +22,11 @@ interface PayGroupService { /** Read company pay groups and frequencies */ @JvmOverloads fun list( - params: PayrollPayGroupListParams, + params: PayrollPayGroupListParams = PayrollPayGroupListParams.none(), requestOptions: RequestOptions = RequestOptions.none(), ): PayrollPayGroupListPage + + /** Read company pay groups and frequencies */ + fun list(requestOptions: RequestOptions): PayrollPayGroupListPage = + list(PayrollPayGroupListParams.none(), requestOptions) } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/DirectoryService.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/DirectoryService.kt index fd14c7da..210e1395 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/DirectoryService.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/DirectoryService.kt @@ -13,7 +13,11 @@ interface DirectoryService { /** Add new individuals to a sandbox company */ @JvmOverloads fun create( - params: SandboxDirectoryCreateParams, + params: SandboxDirectoryCreateParams = SandboxDirectoryCreateParams.none(), requestOptions: RequestOptions = RequestOptions.none(), ): List + + /** Add new individuals to a sandbox company */ + fun create(requestOptions: RequestOptions): List = + create(SandboxDirectoryCreateParams.none(), requestOptions) } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/PaymentService.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/PaymentService.kt index 968cafd4..6e20efa2 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/PaymentService.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/PaymentService.kt @@ -13,7 +13,11 @@ interface PaymentService { /** Add a new sandbox payment */ @JvmOverloads fun create( - params: SandboxPaymentCreateParams, + params: SandboxPaymentCreateParams = SandboxPaymentCreateParams.none(), requestOptions: RequestOptions = RequestOptions.none(), ): PaymentCreateResponse + + /** Add a new sandbox payment */ + fun create(requestOptions: RequestOptions): PaymentCreateResponse = + create(SandboxPaymentCreateParams.none(), requestOptions) } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/connections/AccountService.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/connections/AccountService.kt index 7fbb6b15..a2c8266f 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/connections/AccountService.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/connections/AccountService.kt @@ -25,7 +25,14 @@ interface AccountService { */ @JvmOverloads fun update( - params: SandboxConnectionAccountUpdateParams, + params: SandboxConnectionAccountUpdateParams = SandboxConnectionAccountUpdateParams.none(), requestOptions: RequestOptions = RequestOptions.none(), ): AccountUpdateResponse + + /** + * Update an existing sandbox account. Change the connection status to understand how the Finch + * API responds. + */ + fun update(requestOptions: RequestOptions): AccountUpdateResponse = + update(SandboxConnectionAccountUpdateParams.none(), requestOptions) } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/jobs/ConfigurationService.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/jobs/ConfigurationService.kt index 393f230c..4dfb7f1b 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/jobs/ConfigurationService.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/jobs/ConfigurationService.kt @@ -14,10 +14,15 @@ interface ConfigurationService { /** Get configurations for sandbox jobs */ @JvmOverloads fun retrieve( - params: SandboxJobConfigurationRetrieveParams, + params: SandboxJobConfigurationRetrieveParams = + SandboxJobConfigurationRetrieveParams.none(), requestOptions: RequestOptions = RequestOptions.none(), ): List + /** Get configurations for sandbox jobs */ + fun retrieve(requestOptions: RequestOptions): List = + retrieve(SandboxJobConfigurationRetrieveParams.none(), requestOptions) + /** Update configurations for sandbox jobs */ @JvmOverloads fun update( diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/core/UtilsTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/core/UtilsTest.kt new file mode 100644 index 00000000..3bb58b5d --- /dev/null +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/core/UtilsTest.kt @@ -0,0 +1,33 @@ +package com.tryfinch.api.core + +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +internal class UtilsTest { + @Test + fun contentDeepEquals() { + assertThat(42 contentEquals 42).isTrue() + assertThat(42 contentEquals "Hello World!").isFalse() + assertThat(byteArrayOf(1, 2, 3) contentEquals byteArrayOf(1, 2, 3)).isTrue() + assertThat(byteArrayOf(1, 2, 3) contentEquals byteArrayOf(1, 2, 4)).isFalse() + assertThat( + arrayOf(byteArrayOf(1, 2), byteArrayOf(3)) contentEquals + arrayOf(byteArrayOf(1, 2), byteArrayOf(3)) + ) + .isTrue() + assertThat( + arrayOf(byteArrayOf(1, 2), byteArrayOf(3)) contentEquals + arrayOf(byteArrayOf(1), byteArrayOf(2, 3)) + ) + .isFalse() + } + + @Test + fun contentToString() { + assertThat((42).contentToString()).isEqualTo("42") + assertThat("Hello World!".contentToString()).isEqualTo("Hello World!") + assertThat(byteArrayOf(1, 2, 3).contentToString()).isEqualTo("[1, 2, 3]") + assertThat(arrayOf(byteArrayOf(1, 2), byteArrayOf(3)).contentToString()) + .isEqualTo("[[1, 2], [3]]") + } +} diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/PayStatementResponseBodyTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/PayStatementResponseBodyTest.kt index 554f844e..8c004da4 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/PayStatementResponseBodyTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/PayStatementResponseBodyTest.kt @@ -19,10 +19,19 @@ class PayStatementResponseBodyTest { PayStatement.Earning.builder() .amount(0L) .attributes( - PayStatement.Earning.Metadata.builder() + PayStatement.Earning.Attributes.builder() .metadata( - PayStatement.Earning.Metadata.InnerMetadata.builder() - .putAdditionalProperty("foo", JsonValue.from("bar")) + PayStatement.Earning.Attributes.Metadata.builder() + .metadata( + PayStatement.Earning.Attributes.Metadata + .InnerMetadata + .builder() + .putAdditionalProperty( + "foo", + JsonValue.from("bar"), + ) + .build() + ) .build() ) .build() @@ -37,11 +46,21 @@ class PayStatementResponseBodyTest { PayStatement.EmployeeDeduction.builder() .amount(0L) .attributes( - PayStatement.EmployeeDeduction.Metadata.builder() + PayStatement.EmployeeDeduction.Attributes.builder() .metadata( - PayStatement.EmployeeDeduction.Metadata.InnerMetadata + PayStatement.EmployeeDeduction.Attributes.Metadata .builder() - .putAdditionalProperty("foo", JsonValue.from("bar")) + .metadata( + PayStatement.EmployeeDeduction.Attributes + .Metadata + .InnerMetadata + .builder() + .putAdditionalProperty( + "foo", + JsonValue.from("bar"), + ) + .build() + ) .build() ) .build() @@ -56,11 +75,21 @@ class PayStatementResponseBodyTest { PayStatement.EmployerContribution.builder() .amount(0L) .attributes( - PayStatement.EmployerContribution.Metadata.builder() + PayStatement.EmployerContribution.Attributes.builder() .metadata( - PayStatement.EmployerContribution.Metadata.InnerMetadata + PayStatement.EmployerContribution.Attributes.Metadata .builder() - .putAdditionalProperty("foo", JsonValue.from("bar")) + .metadata( + PayStatement.EmployerContribution.Attributes + .Metadata + .InnerMetadata + .builder() + .putAdditionalProperty( + "foo", + JsonValue.from("bar"), + ) + .build() + ) .build() ) .build() @@ -78,10 +107,19 @@ class PayStatementResponseBodyTest { PayStatement.Tax.builder() .amount(0L) .attributes( - PayStatement.Tax.Metadata.builder() + PayStatement.Tax.Attributes.builder() .metadata( - PayStatement.Tax.Metadata.InnerMetadata.builder() - .putAdditionalProperty("foo", JsonValue.from("bar")) + PayStatement.Tax.Attributes.Metadata.builder() + .metadata( + PayStatement.Tax.Attributes.Metadata + .InnerMetadata + .builder() + .putAdditionalProperty( + "foo", + JsonValue.from("bar"), + ) + .build() + ) .build() ) .build() @@ -107,10 +145,19 @@ class PayStatementResponseBodyTest { PayStatement.Earning.builder() .amount(0L) .attributes( - PayStatement.Earning.Metadata.builder() + PayStatement.Earning.Attributes.builder() .metadata( - PayStatement.Earning.Metadata.InnerMetadata.builder() - .putAdditionalProperty("foo", JsonValue.from("bar")) + PayStatement.Earning.Attributes.Metadata.builder() + .metadata( + PayStatement.Earning.Attributes.Metadata + .InnerMetadata + .builder() + .putAdditionalProperty( + "foo", + JsonValue.from("bar"), + ) + .build() + ) .build() ) .build() @@ -125,11 +172,19 @@ class PayStatementResponseBodyTest { PayStatement.EmployeeDeduction.builder() .amount(0L) .attributes( - PayStatement.EmployeeDeduction.Metadata.builder() + PayStatement.EmployeeDeduction.Attributes.builder() .metadata( - PayStatement.EmployeeDeduction.Metadata.InnerMetadata - .builder() - .putAdditionalProperty("foo", JsonValue.from("bar")) + PayStatement.EmployeeDeduction.Attributes.Metadata.builder() + .metadata( + PayStatement.EmployeeDeduction.Attributes.Metadata + .InnerMetadata + .builder() + .putAdditionalProperty( + "foo", + JsonValue.from("bar"), + ) + .build() + ) .build() ) .build() @@ -144,11 +199,21 @@ class PayStatementResponseBodyTest { PayStatement.EmployerContribution.builder() .amount(0L) .attributes( - PayStatement.EmployerContribution.Metadata.builder() + PayStatement.EmployerContribution.Attributes.builder() .metadata( - PayStatement.EmployerContribution.Metadata.InnerMetadata + PayStatement.EmployerContribution.Attributes.Metadata .builder() - .putAdditionalProperty("foo", JsonValue.from("bar")) + .metadata( + PayStatement.EmployerContribution.Attributes + .Metadata + .InnerMetadata + .builder() + .putAdditionalProperty( + "foo", + JsonValue.from("bar"), + ) + .build() + ) .build() ) .build() @@ -166,10 +231,18 @@ class PayStatementResponseBodyTest { PayStatement.Tax.builder() .amount(0L) .attributes( - PayStatement.Tax.Metadata.builder() + PayStatement.Tax.Attributes.builder() .metadata( - PayStatement.Tax.Metadata.InnerMetadata.builder() - .putAdditionalProperty("foo", JsonValue.from("bar")) + PayStatement.Tax.Attributes.Metadata.builder() + .metadata( + PayStatement.Tax.Attributes.Metadata.InnerMetadata + .builder() + .putAdditionalProperty( + "foo", + JsonValue.from("bar"), + ) + .build() + ) .build() ) .build() diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/PayStatementResponseTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/PayStatementResponseTest.kt index f01728a1..2400e2ca 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/PayStatementResponseTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/PayStatementResponseTest.kt @@ -21,13 +21,19 @@ class PayStatementResponseTest { PayStatement.Earning.builder() .amount(0L) .attributes( - PayStatement.Earning.Metadata.builder() + PayStatement.Earning.Attributes.builder() .metadata( - PayStatement.Earning.Metadata.InnerMetadata + PayStatement.Earning.Attributes.Metadata .builder() - .putAdditionalProperty( - "foo", - JsonValue.from("bar"), + .metadata( + PayStatement.Earning.Attributes.Metadata + .InnerMetadata + .builder() + .putAdditionalProperty( + "foo", + JsonValue.from("bar"), + ) + .build() ) .build() ) @@ -43,14 +49,22 @@ class PayStatementResponseTest { PayStatement.EmployeeDeduction.builder() .amount(0L) .attributes( - PayStatement.EmployeeDeduction.Metadata.builder() + PayStatement.EmployeeDeduction.Attributes.builder() .metadata( - PayStatement.EmployeeDeduction.Metadata - .InnerMetadata + PayStatement.EmployeeDeduction.Attributes + .Metadata .builder() - .putAdditionalProperty( - "foo", - JsonValue.from("bar"), + .metadata( + PayStatement.EmployeeDeduction + .Attributes + .Metadata + .InnerMetadata + .builder() + .putAdditionalProperty( + "foo", + JsonValue.from("bar"), + ) + .build() ) .build() ) @@ -66,14 +80,22 @@ class PayStatementResponseTest { PayStatement.EmployerContribution.builder() .amount(0L) .attributes( - PayStatement.EmployerContribution.Metadata.builder() + PayStatement.EmployerContribution.Attributes.builder() .metadata( - PayStatement.EmployerContribution.Metadata - .InnerMetadata + PayStatement.EmployerContribution.Attributes + .Metadata .builder() - .putAdditionalProperty( - "foo", - JsonValue.from("bar"), + .metadata( + PayStatement.EmployerContribution + .Attributes + .Metadata + .InnerMetadata + .builder() + .putAdditionalProperty( + "foo", + JsonValue.from("bar"), + ) + .build() ) .build() ) @@ -92,13 +114,18 @@ class PayStatementResponseTest { PayStatement.Tax.builder() .amount(0L) .attributes( - PayStatement.Tax.Metadata.builder() + PayStatement.Tax.Attributes.builder() .metadata( - PayStatement.Tax.Metadata.InnerMetadata - .builder() - .putAdditionalProperty( - "foo", - JsonValue.from("bar"), + PayStatement.Tax.Attributes.Metadata.builder() + .metadata( + PayStatement.Tax.Attributes.Metadata + .InnerMetadata + .builder() + .putAdditionalProperty( + "foo", + JsonValue.from("bar"), + ) + .build() ) .build() ) @@ -130,13 +157,18 @@ class PayStatementResponseTest { PayStatement.Earning.builder() .amount(0L) .attributes( - PayStatement.Earning.Metadata.builder() + PayStatement.Earning.Attributes.builder() .metadata( - PayStatement.Earning.Metadata.InnerMetadata - .builder() - .putAdditionalProperty( - "foo", - JsonValue.from("bar"), + PayStatement.Earning.Attributes.Metadata.builder() + .metadata( + PayStatement.Earning.Attributes.Metadata + .InnerMetadata + .builder() + .putAdditionalProperty( + "foo", + JsonValue.from("bar"), + ) + .build() ) .build() ) @@ -152,14 +184,20 @@ class PayStatementResponseTest { PayStatement.EmployeeDeduction.builder() .amount(0L) .attributes( - PayStatement.EmployeeDeduction.Metadata.builder() + PayStatement.EmployeeDeduction.Attributes.builder() .metadata( - PayStatement.EmployeeDeduction.Metadata - .InnerMetadata + PayStatement.EmployeeDeduction.Attributes.Metadata .builder() - .putAdditionalProperty( - "foo", - JsonValue.from("bar"), + .metadata( + PayStatement.EmployeeDeduction.Attributes + .Metadata + .InnerMetadata + .builder() + .putAdditionalProperty( + "foo", + JsonValue.from("bar"), + ) + .build() ) .build() ) @@ -175,14 +213,21 @@ class PayStatementResponseTest { PayStatement.EmployerContribution.builder() .amount(0L) .attributes( - PayStatement.EmployerContribution.Metadata.builder() + PayStatement.EmployerContribution.Attributes.builder() .metadata( - PayStatement.EmployerContribution.Metadata - .InnerMetadata + PayStatement.EmployerContribution.Attributes + .Metadata .builder() - .putAdditionalProperty( - "foo", - JsonValue.from("bar"), + .metadata( + PayStatement.EmployerContribution.Attributes + .Metadata + .InnerMetadata + .builder() + .putAdditionalProperty( + "foo", + JsonValue.from("bar"), + ) + .build() ) .build() ) @@ -201,12 +246,18 @@ class PayStatementResponseTest { PayStatement.Tax.builder() .amount(0L) .attributes( - PayStatement.Tax.Metadata.builder() + PayStatement.Tax.Attributes.builder() .metadata( - PayStatement.Tax.Metadata.InnerMetadata.builder() - .putAdditionalProperty( - "foo", - JsonValue.from("bar"), + PayStatement.Tax.Attributes.Metadata.builder() + .metadata( + PayStatement.Tax.Attributes.Metadata + .InnerMetadata + .builder() + .putAdditionalProperty( + "foo", + JsonValue.from("bar"), + ) + .build() ) .build() ) diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/PayStatementTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/PayStatementTest.kt index 4c62f3b0..62d33044 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/PayStatementTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/PayStatementTest.kt @@ -16,10 +16,15 @@ class PayStatementTest { PayStatement.Earning.builder() .amount(0L) .attributes( - PayStatement.Earning.Metadata.builder() + PayStatement.Earning.Attributes.builder() .metadata( - PayStatement.Earning.Metadata.InnerMetadata.builder() - .putAdditionalProperty("foo", JsonValue.from("bar")) + PayStatement.Earning.Attributes.Metadata.builder() + .metadata( + PayStatement.Earning.Attributes.Metadata.InnerMetadata + .builder() + .putAdditionalProperty("foo", JsonValue.from("bar")) + .build() + ) .build() ) .build() @@ -34,10 +39,16 @@ class PayStatementTest { PayStatement.EmployeeDeduction.builder() .amount(0L) .attributes( - PayStatement.EmployeeDeduction.Metadata.builder() + PayStatement.EmployeeDeduction.Attributes.builder() .metadata( - PayStatement.EmployeeDeduction.Metadata.InnerMetadata.builder() - .putAdditionalProperty("foo", JsonValue.from("bar")) + PayStatement.EmployeeDeduction.Attributes.Metadata.builder() + .metadata( + PayStatement.EmployeeDeduction.Attributes.Metadata + .InnerMetadata + .builder() + .putAdditionalProperty("foo", JsonValue.from("bar")) + .build() + ) .build() ) .build() @@ -52,11 +63,16 @@ class PayStatementTest { PayStatement.EmployerContribution.builder() .amount(0L) .attributes( - PayStatement.EmployerContribution.Metadata.builder() + PayStatement.EmployerContribution.Attributes.builder() .metadata( - PayStatement.EmployerContribution.Metadata.InnerMetadata - .builder() - .putAdditionalProperty("foo", JsonValue.from("bar")) + PayStatement.EmployerContribution.Attributes.Metadata.builder() + .metadata( + PayStatement.EmployerContribution.Attributes.Metadata + .InnerMetadata + .builder() + .putAdditionalProperty("foo", JsonValue.from("bar")) + .build() + ) .build() ) .build() @@ -74,10 +90,15 @@ class PayStatementTest { PayStatement.Tax.builder() .amount(0L) .attributes( - PayStatement.Tax.Metadata.builder() + PayStatement.Tax.Attributes.builder() .metadata( - PayStatement.Tax.Metadata.InnerMetadata.builder() - .putAdditionalProperty("foo", JsonValue.from("bar")) + PayStatement.Tax.Attributes.Metadata.builder() + .metadata( + PayStatement.Tax.Attributes.Metadata.InnerMetadata + .builder() + .putAdditionalProperty("foo", JsonValue.from("bar")) + .build() + ) .build() ) .build() @@ -97,10 +118,15 @@ class PayStatementTest { PayStatement.Earning.builder() .amount(0L) .attributes( - PayStatement.Earning.Metadata.builder() + PayStatement.Earning.Attributes.builder() .metadata( - PayStatement.Earning.Metadata.InnerMetadata.builder() - .putAdditionalProperty("foo", JsonValue.from("bar")) + PayStatement.Earning.Attributes.Metadata.builder() + .metadata( + PayStatement.Earning.Attributes.Metadata.InnerMetadata + .builder() + .putAdditionalProperty("foo", JsonValue.from("bar")) + .build() + ) .build() ) .build() @@ -116,10 +142,16 @@ class PayStatementTest { PayStatement.EmployeeDeduction.builder() .amount(0L) .attributes( - PayStatement.EmployeeDeduction.Metadata.builder() + PayStatement.EmployeeDeduction.Attributes.builder() .metadata( - PayStatement.EmployeeDeduction.Metadata.InnerMetadata.builder() - .putAdditionalProperty("foo", JsonValue.from("bar")) + PayStatement.EmployeeDeduction.Attributes.Metadata.builder() + .metadata( + PayStatement.EmployeeDeduction.Attributes.Metadata + .InnerMetadata + .builder() + .putAdditionalProperty("foo", JsonValue.from("bar")) + .build() + ) .build() ) .build() @@ -135,10 +167,16 @@ class PayStatementTest { PayStatement.EmployerContribution.builder() .amount(0L) .attributes( - PayStatement.EmployerContribution.Metadata.builder() + PayStatement.EmployerContribution.Attributes.builder() .metadata( - PayStatement.EmployerContribution.Metadata.InnerMetadata.builder() - .putAdditionalProperty("foo", JsonValue.from("bar")) + PayStatement.EmployerContribution.Attributes.Metadata.builder() + .metadata( + PayStatement.EmployerContribution.Attributes.Metadata + .InnerMetadata + .builder() + .putAdditionalProperty("foo", JsonValue.from("bar")) + .build() + ) .build() ) .build() @@ -159,10 +197,14 @@ class PayStatementTest { PayStatement.Tax.builder() .amount(0L) .attributes( - PayStatement.Tax.Metadata.builder() + PayStatement.Tax.Attributes.builder() .metadata( - PayStatement.Tax.Metadata.InnerMetadata.builder() - .putAdditionalProperty("foo", JsonValue.from("bar")) + PayStatement.Tax.Attributes.Metadata.builder() + .metadata( + PayStatement.Tax.Attributes.Metadata.InnerMetadata.builder() + .putAdditionalProperty("foo", JsonValue.from("bar")) + .build() + ) .build() ) .build() diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxPaymentCreateParamsTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxPaymentCreateParamsTest.kt index 3e1a17b4..708ed715 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxPaymentCreateParamsTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxPaymentCreateParamsTest.kt @@ -19,12 +19,23 @@ class SandboxPaymentCreateParamsTest { SandboxPaymentCreateParams.PayStatement.Earning.builder() .amount(0L) .attributes( - SandboxPaymentCreateParams.PayStatement.Earning.Metadata.builder() + SandboxPaymentCreateParams.PayStatement.Earning.Attributes.builder() .metadata( - SandboxPaymentCreateParams.PayStatement.Earning.Metadata - .InnerMetadata + SandboxPaymentCreateParams.PayStatement.Earning.Attributes + .Metadata .builder() - .putAdditionalProperty("foo", JsonValue.from("bar")) + .metadata( + SandboxPaymentCreateParams.PayStatement.Earning + .Attributes + .Metadata + .InnerMetadata + .builder() + .putAdditionalProperty( + "foo", + JsonValue.from("bar"), + ) + .build() + ) .build() ) .build() @@ -37,22 +48,34 @@ class SandboxPaymentCreateParamsTest { ) .addEmployeeDeduction( SandboxPaymentCreateParams.PayStatement.EmployeeDeduction.builder() - .amount(0L) + .amount(2000L) .attributes( - SandboxPaymentCreateParams.PayStatement.EmployeeDeduction.Metadata + SandboxPaymentCreateParams.PayStatement.EmployeeDeduction.Attributes .builder() .metadata( SandboxPaymentCreateParams.PayStatement.EmployeeDeduction + .Attributes .Metadata - .InnerMetadata .builder() - .putAdditionalProperty("foo", JsonValue.from("bar")) + .metadata( + SandboxPaymentCreateParams.PayStatement + .EmployeeDeduction + .Attributes + .Metadata + .InnerMetadata + .builder() + .putAdditionalProperty( + "foo", + JsonValue.from("bar"), + ) + .build() + ) .build() ) .build() ) - .currency("currency") - .name("name") + .currency("usd") + .name("401k test") .preTax(true) .type(BenefitType._401K) .build() @@ -62,14 +85,26 @@ class SandboxPaymentCreateParamsTest { .amount(0L) .attributes( SandboxPaymentCreateParams.PayStatement.EmployerContribution - .Metadata + .Attributes .builder() .metadata( SandboxPaymentCreateParams.PayStatement.EmployerContribution + .Attributes .Metadata - .InnerMetadata .builder() - .putAdditionalProperty("foo", JsonValue.from("bar")) + .metadata( + SandboxPaymentCreateParams.PayStatement + .EmployerContribution + .Attributes + .Metadata + .InnerMetadata + .builder() + .putAdditionalProperty( + "foo", + JsonValue.from("bar"), + ) + .build() + ) .build() ) .build() @@ -80,19 +115,30 @@ class SandboxPaymentCreateParamsTest { .build() ) .grossPay(Money.builder().amount(0L).currency("currency").build()) - .individualId("individual_id") + .individualId("b2338cfb-472f-4f72-9faa-e028c083144a") .netPay(Money.builder().amount(0L).currency("currency").build()) .paymentMethod(SandboxPaymentCreateParams.PayStatement.PaymentMethod.CHECK) .addTax( SandboxPaymentCreateParams.PayStatement.Tax.builder() .amount(0L) .attributes( - SandboxPaymentCreateParams.PayStatement.Tax.Metadata.builder() + SandboxPaymentCreateParams.PayStatement.Tax.Attributes.builder() .metadata( - SandboxPaymentCreateParams.PayStatement.Tax.Metadata - .InnerMetadata + SandboxPaymentCreateParams.PayStatement.Tax.Attributes + .Metadata .builder() - .putAdditionalProperty("foo", JsonValue.from("bar")) + .metadata( + SandboxPaymentCreateParams.PayStatement.Tax + .Attributes + .Metadata + .InnerMetadata + .builder() + .putAdditionalProperty( + "foo", + JsonValue.from("bar"), + ) + .build() + ) .build() ) .build() @@ -122,13 +168,25 @@ class SandboxPaymentCreateParamsTest { SandboxPaymentCreateParams.PayStatement.Earning.builder() .amount(0L) .attributes( - SandboxPaymentCreateParams.PayStatement.Earning.Metadata + SandboxPaymentCreateParams.PayStatement.Earning.Attributes .builder() .metadata( - SandboxPaymentCreateParams.PayStatement.Earning.Metadata - .InnerMetadata + SandboxPaymentCreateParams.PayStatement.Earning + .Attributes + .Metadata .builder() - .putAdditionalProperty("foo", JsonValue.from("bar")) + .metadata( + SandboxPaymentCreateParams.PayStatement.Earning + .Attributes + .Metadata + .InnerMetadata + .builder() + .putAdditionalProperty( + "foo", + JsonValue.from("bar"), + ) + .build() + ) .build() ) .build() @@ -141,24 +199,36 @@ class SandboxPaymentCreateParamsTest { ) .addEmployeeDeduction( SandboxPaymentCreateParams.PayStatement.EmployeeDeduction.builder() - .amount(0L) + .amount(2000L) .attributes( SandboxPaymentCreateParams.PayStatement.EmployeeDeduction - .Metadata + .Attributes .builder() .metadata( SandboxPaymentCreateParams.PayStatement .EmployeeDeduction + .Attributes .Metadata - .InnerMetadata .builder() - .putAdditionalProperty("foo", JsonValue.from("bar")) + .metadata( + SandboxPaymentCreateParams.PayStatement + .EmployeeDeduction + .Attributes + .Metadata + .InnerMetadata + .builder() + .putAdditionalProperty( + "foo", + JsonValue.from("bar"), + ) + .build() + ) .build() ) .build() ) - .currency("currency") - .name("name") + .currency("usd") + .name("401k test") .preTax(true) .type(BenefitType._401K) .build() @@ -168,15 +238,27 @@ class SandboxPaymentCreateParamsTest { .amount(0L) .attributes( SandboxPaymentCreateParams.PayStatement.EmployerContribution - .Metadata + .Attributes .builder() .metadata( SandboxPaymentCreateParams.PayStatement .EmployerContribution + .Attributes .Metadata - .InnerMetadata .builder() - .putAdditionalProperty("foo", JsonValue.from("bar")) + .metadata( + SandboxPaymentCreateParams.PayStatement + .EmployerContribution + .Attributes + .Metadata + .InnerMetadata + .builder() + .putAdditionalProperty( + "foo", + JsonValue.from("bar"), + ) + .build() + ) .build() ) .build() @@ -187,19 +269,30 @@ class SandboxPaymentCreateParamsTest { .build() ) .grossPay(Money.builder().amount(0L).currency("currency").build()) - .individualId("individual_id") + .individualId("b2338cfb-472f-4f72-9faa-e028c083144a") .netPay(Money.builder().amount(0L).currency("currency").build()) .paymentMethod(SandboxPaymentCreateParams.PayStatement.PaymentMethod.CHECK) .addTax( SandboxPaymentCreateParams.PayStatement.Tax.builder() .amount(0L) .attributes( - SandboxPaymentCreateParams.PayStatement.Tax.Metadata.builder() + SandboxPaymentCreateParams.PayStatement.Tax.Attributes.builder() .metadata( - SandboxPaymentCreateParams.PayStatement.Tax.Metadata - .InnerMetadata + SandboxPaymentCreateParams.PayStatement.Tax.Attributes + .Metadata .builder() - .putAdditionalProperty("foo", JsonValue.from("bar")) + .metadata( + SandboxPaymentCreateParams.PayStatement.Tax + .Attributes + .Metadata + .InnerMetadata + .builder() + .putAdditionalProperty( + "foo", + JsonValue.from("bar"), + ) + .build() + ) .build() ) .build() @@ -229,13 +322,25 @@ class SandboxPaymentCreateParamsTest { SandboxPaymentCreateParams.PayStatement.Earning.builder() .amount(0L) .attributes( - SandboxPaymentCreateParams.PayStatement.Earning.Metadata + SandboxPaymentCreateParams.PayStatement.Earning.Attributes .builder() .metadata( - SandboxPaymentCreateParams.PayStatement.Earning.Metadata - .InnerMetadata + SandboxPaymentCreateParams.PayStatement.Earning + .Attributes + .Metadata .builder() - .putAdditionalProperty("foo", JsonValue.from("bar")) + .metadata( + SandboxPaymentCreateParams.PayStatement.Earning + .Attributes + .Metadata + .InnerMetadata + .builder() + .putAdditionalProperty( + "foo", + JsonValue.from("bar"), + ) + .build() + ) .build() ) .build() @@ -248,24 +353,36 @@ class SandboxPaymentCreateParamsTest { ) .addEmployeeDeduction( SandboxPaymentCreateParams.PayStatement.EmployeeDeduction.builder() - .amount(0L) + .amount(2000L) .attributes( SandboxPaymentCreateParams.PayStatement.EmployeeDeduction - .Metadata + .Attributes .builder() .metadata( SandboxPaymentCreateParams.PayStatement .EmployeeDeduction + .Attributes .Metadata - .InnerMetadata .builder() - .putAdditionalProperty("foo", JsonValue.from("bar")) + .metadata( + SandboxPaymentCreateParams.PayStatement + .EmployeeDeduction + .Attributes + .Metadata + .InnerMetadata + .builder() + .putAdditionalProperty( + "foo", + JsonValue.from("bar"), + ) + .build() + ) .build() ) .build() ) - .currency("currency") - .name("name") + .currency("usd") + .name("401k test") .preTax(true) .type(BenefitType._401K) .build() @@ -275,15 +392,27 @@ class SandboxPaymentCreateParamsTest { .amount(0L) .attributes( SandboxPaymentCreateParams.PayStatement.EmployerContribution - .Metadata + .Attributes .builder() .metadata( SandboxPaymentCreateParams.PayStatement .EmployerContribution + .Attributes .Metadata - .InnerMetadata .builder() - .putAdditionalProperty("foo", JsonValue.from("bar")) + .metadata( + SandboxPaymentCreateParams.PayStatement + .EmployerContribution + .Attributes + .Metadata + .InnerMetadata + .builder() + .putAdditionalProperty( + "foo", + JsonValue.from("bar"), + ) + .build() + ) .build() ) .build() @@ -294,19 +423,30 @@ class SandboxPaymentCreateParamsTest { .build() ) .grossPay(Money.builder().amount(0L).currency("currency").build()) - .individualId("individual_id") + .individualId("b2338cfb-472f-4f72-9faa-e028c083144a") .netPay(Money.builder().amount(0L).currency("currency").build()) .paymentMethod(SandboxPaymentCreateParams.PayStatement.PaymentMethod.CHECK) .addTax( SandboxPaymentCreateParams.PayStatement.Tax.builder() .amount(0L) .attributes( - SandboxPaymentCreateParams.PayStatement.Tax.Metadata.builder() + SandboxPaymentCreateParams.PayStatement.Tax.Attributes.builder() .metadata( - SandboxPaymentCreateParams.PayStatement.Tax.Metadata - .InnerMetadata + SandboxPaymentCreateParams.PayStatement.Tax.Attributes + .Metadata .builder() - .putAdditionalProperty("foo", JsonValue.from("bar")) + .metadata( + SandboxPaymentCreateParams.PayStatement.Tax + .Attributes + .Metadata + .InnerMetadata + .builder() + .putAdditionalProperty( + "foo", + JsonValue.from("bar"), + ) + .build() + ) .build() ) .build() diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/ServiceParamsTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/ServiceParamsTest.kt index 555e8b13..fcded4b6 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/ServiceParamsTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/ServiceParamsTest.kt @@ -2,7 +2,6 @@ package com.tryfinch.api.services -import com.fasterxml.jackson.databind.json.JsonMapper import com.github.tomakehurst.wiremock.client.WireMock.anyUrl import com.github.tomakehurst.wiremock.client.WireMock.equalTo import com.github.tomakehurst.wiremock.client.WireMock.get @@ -14,18 +13,12 @@ import com.github.tomakehurst.wiremock.junit5.WireMockRuntimeInfo import com.github.tomakehurst.wiremock.junit5.WireMockTest import com.tryfinch.api.client.FinchClient import com.tryfinch.api.client.okhttp.FinchOkHttpClient -import com.tryfinch.api.core.jsonMapper -import com.tryfinch.api.models.HrisDirectoryListPage import com.tryfinch.api.models.HrisDirectoryListParams -import com.tryfinch.api.models.IndividualInDirectory -import com.tryfinch.api.models.Paging import org.junit.jupiter.api.BeforeEach import org.junit.jupiter.api.Test @WireMockTest -class ServiceParamsTest { - - private val JSON_MAPPER: JsonMapper = jsonMapper() +internal class ServiceParamsTest { private lateinit var client: FinchClient @@ -33,61 +26,27 @@ class ServiceParamsTest { fun beforeEach(wmRuntimeInfo: WireMockRuntimeInfo) { client = FinchOkHttpClient.builder() + .baseUrl(wmRuntimeInfo.httpBaseUrl) .accessToken("My Access Token") - .clientId("4ab15e51-11ad-49f4-acae-f343b7794375") - .clientSecret("My Client Secret") - .webhookSecret("My Webhook Secret") - .baseUrl(wmRuntimeInfo.getHttpBaseUrl()) .build() } @Test - fun directoriesListWithAdditionalParams() { - val additionalHeaders = mutableMapOf>() - - additionalHeaders.put("x-test-header", listOf("abc1234")) - - val additionalQueryParams = mutableMapOf>() + fun list() { + val directoryService = client.hris().directory() + stubFor(get(anyUrl()).willReturn(ok("{}"))) - additionalQueryParams.put("test_query_param", listOf("def567")) - - val params = + directoryService.list( HrisDirectoryListParams.builder() - .limit(0L) - .offset(0L) - .additionalHeaders(additionalHeaders) - .additionalQueryParams(additionalQueryParams) + .putAdditionalHeader("Secret-Header", "42") + .putAdditionalQueryParam("secret_query_param", "42") .build() - - val apiResponse = - HrisDirectoryListPage.Response.builder() - .individuals( - listOf( - IndividualInDirectory.builder() - .id("id") - .department( - IndividualInDirectory.Department.builder().name("name").build() - ) - .firstName("first_name") - .isActive(true) - .lastName("last_name") - .manager(IndividualInDirectory.Manager.builder().id("id").build()) - .middleName("middle_name") - .build() - ) - ) - .paging(Paging.builder().count(0L).offset(0L).build()) - .build() - - stubFor( - get(anyUrl()) - .withHeader("x-test-header", equalTo("abc1234")) - .withQueryParam("test_query_param", equalTo("def567")) - .willReturn(ok(JSON_MAPPER.writeValueAsString(apiResponse))) ) - client.hris().directory().list(params) - - verify(getRequestedFor(anyUrl())) + verify( + getRequestedFor(anyUrl()) + .withHeader("Secret-Header", equalTo("42")) + .withQueryParam("secret_query_param", equalTo("42")) + ) } } diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/AccessTokenServiceAsyncTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/AccessTokenServiceAsyncTest.kt new file mode 100644 index 00000000..32d058d1 --- /dev/null +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/AccessTokenServiceAsyncTest.kt @@ -0,0 +1,36 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.tryfinch.api.services.async + +import com.tryfinch.api.TestServerExtension +import com.tryfinch.api.client.okhttp.FinchOkHttpClientAsync +import com.tryfinch.api.models.AccessTokenCreateParams +import org.junit.jupiter.api.Test +import org.junit.jupiter.api.extension.ExtendWith + +@ExtendWith(TestServerExtension::class) +class AccessTokenServiceAsyncTest { + + @Test + fun create() { + val client = + FinchOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .accessToken("My Access Token") + .build() + val accessTokenServiceAsync = client.accessTokens() + + val createAccessTokenResponseFuture = + accessTokenServiceAsync.create( + AccessTokenCreateParams.builder() + .code("") + .clientId("6d28c315-5eaa-4071-8ea5-f030eb45edbc") + .clientSecret("") + .redirectUri("https://example.com") + .build() + ) + + val createAccessTokenResponse = createAccessTokenResponseFuture.get() + createAccessTokenResponse.validate() + } +} diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/AccountServiceAsyncTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/AccountServiceAsyncTest.kt new file mode 100644 index 00000000..62020a50 --- /dev/null +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/AccountServiceAsyncTest.kt @@ -0,0 +1,42 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.tryfinch.api.services.async + +import com.tryfinch.api.TestServerExtension +import com.tryfinch.api.client.okhttp.FinchOkHttpClientAsync +import org.junit.jupiter.api.Test +import org.junit.jupiter.api.extension.ExtendWith + +@ExtendWith(TestServerExtension::class) +class AccountServiceAsyncTest { + + @Test + fun disconnect() { + val client = + FinchOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .accessToken("My Access Token") + .build() + val accountServiceAsync = client.account() + + val disconnectResponseFuture = accountServiceAsync.disconnect() + + val disconnectResponse = disconnectResponseFuture.get() + disconnectResponse.validate() + } + + @Test + fun introspect() { + val client = + FinchOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .accessToken("My Access Token") + .build() + val accountServiceAsync = client.account() + + val introspectionFuture = accountServiceAsync.introspect() + + val introspection = introspectionFuture.get() + introspection.validate() + } +} diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/ProviderServiceAsyncTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/ProviderServiceAsyncTest.kt new file mode 100644 index 00000000..970a3878 --- /dev/null +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/ProviderServiceAsyncTest.kt @@ -0,0 +1,27 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.tryfinch.api.services.async + +import com.tryfinch.api.TestServerExtension +import com.tryfinch.api.client.okhttp.FinchOkHttpClientAsync +import org.junit.jupiter.api.Test +import org.junit.jupiter.api.extension.ExtendWith + +@ExtendWith(TestServerExtension::class) +class ProviderServiceAsyncTest { + + @Test + fun list() { + val client = + FinchOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .accessToken("My Access Token") + .build() + val providerServiceAsync = client.providers() + + val pageFuture = providerServiceAsync.list() + + val page = pageFuture.get() + page.response().validate() + } +} diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/RequestForwardingServiceAsyncTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/RequestForwardingServiceAsyncTest.kt new file mode 100644 index 00000000..a30f22d6 --- /dev/null +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/RequestForwardingServiceAsyncTest.kt @@ -0,0 +1,38 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.tryfinch.api.services.async + +import com.tryfinch.api.TestServerExtension +import com.tryfinch.api.client.okhttp.FinchOkHttpClientAsync +import com.tryfinch.api.core.JsonValue +import com.tryfinch.api.models.RequestForwardingForwardParams +import org.junit.jupiter.api.Test +import org.junit.jupiter.api.extension.ExtendWith + +@ExtendWith(TestServerExtension::class) +class RequestForwardingServiceAsyncTest { + + @Test + fun forward() { + val client = + FinchOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .accessToken("My Access Token") + .build() + val requestForwardingServiceAsync = client.requestForwarding() + + val responseFuture = + requestForwardingServiceAsync.forward( + RequestForwardingForwardParams.builder() + .method("POST") + .route("/people/search") + .data(null) + .headers(JsonValue.from(mapOf("content-type" to "application/json"))) + .params(JsonValue.from(mapOf("showInactive" to true, "humanReadable" to true))) + .build() + ) + + val response = responseFuture.get() + response.validate() + } +} diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/connect/SessionServiceAsyncTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/connect/SessionServiceAsyncTest.kt new file mode 100644 index 00000000..87f1d9a0 --- /dev/null +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/connect/SessionServiceAsyncTest.kt @@ -0,0 +1,70 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.tryfinch.api.services.async.connect + +import com.tryfinch.api.TestServerExtension +import com.tryfinch.api.client.okhttp.FinchOkHttpClientAsync +import com.tryfinch.api.models.ConnectSessionNewParams +import com.tryfinch.api.models.ConnectSessionReauthenticateParams +import org.junit.jupiter.api.Test +import org.junit.jupiter.api.extension.ExtendWith + +@ExtendWith(TestServerExtension::class) +class SessionServiceAsyncTest { + + @Test + fun new_() { + val client = + FinchOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .accessToken("My Access Token") + .build() + val sessionServiceAsync = client.connect().sessions() + + val responseFuture = + sessionServiceAsync.new_( + ConnectSessionNewParams.builder() + .customerId("x") + .customerName("x") + .addProduct(ConnectSessionNewParams.ConnectProducts.COMPANY) + .customerEmail("dev@stainlessapi.com") + .integration( + ConnectSessionNewParams.Integration.builder() + .authMethod(ConnectSessionNewParams.Integration.AuthMethod.ASSISTED) + .provider("provider") + .build() + ) + .manual(true) + .minutesToExpire(1.0) + .redirectUri("redirect_uri") + .sandbox(ConnectSessionNewParams.Sandbox.FINCH) + .build() + ) + + val response = responseFuture.get() + response.validate() + } + + @Test + fun reauthenticate() { + val client = + FinchOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .accessToken("My Access Token") + .build() + val sessionServiceAsync = client.connect().sessions() + + val responseFuture = + sessionServiceAsync.reauthenticate( + ConnectSessionReauthenticateParams.builder() + .connectionId("connection_id") + .minutesToExpire(0L) + .addProduct(ConnectSessionReauthenticateParams.ConnectProducts.COMPANY) + .redirectUri("https://example.com") + .build() + ) + + val response = responseFuture.get() + response.validate() + } +} diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/hris/BenefitServiceAsyncTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/hris/BenefitServiceAsyncTest.kt new file mode 100644 index 00000000..8c2a73eb --- /dev/null +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/hris/BenefitServiceAsyncTest.kt @@ -0,0 +1,108 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.tryfinch.api.services.async.hris + +import com.tryfinch.api.TestServerExtension +import com.tryfinch.api.client.okhttp.FinchOkHttpClientAsync +import com.tryfinch.api.models.BenefitFrequency +import com.tryfinch.api.models.BenefitType +import com.tryfinch.api.models.HrisBenefitCreateParams +import com.tryfinch.api.models.HrisBenefitRetrieveParams +import com.tryfinch.api.models.HrisBenefitUpdateParams +import org.junit.jupiter.api.Test +import org.junit.jupiter.api.extension.ExtendWith + +@ExtendWith(TestServerExtension::class) +class BenefitServiceAsyncTest { + + @Test + fun create() { + val client = + FinchOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .accessToken("My Access Token") + .build() + val benefitServiceAsync = client.hris().benefits() + + val createCompanyBenefitsResponseFuture = + benefitServiceAsync.create( + HrisBenefitCreateParams.builder() + .description("description") + .frequency(BenefitFrequency.ONE_TIME) + .type(BenefitType._401K) + .build() + ) + + val createCompanyBenefitsResponse = createCompanyBenefitsResponseFuture.get() + createCompanyBenefitsResponse.validate() + } + + @Test + fun retrieve() { + val client = + FinchOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .accessToken("My Access Token") + .build() + val benefitServiceAsync = client.hris().benefits() + + val companyBenefitFuture = + benefitServiceAsync.retrieve( + HrisBenefitRetrieveParams.builder().benefitId("benefit_id").build() + ) + + val companyBenefit = companyBenefitFuture.get() + companyBenefit.validate() + } + + @Test + fun update() { + val client = + FinchOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .accessToken("My Access Token") + .build() + val benefitServiceAsync = client.hris().benefits() + + val updateCompanyBenefitResponseFuture = + benefitServiceAsync.update( + HrisBenefitUpdateParams.builder() + .benefitId("benefit_id") + .description("description") + .build() + ) + + val updateCompanyBenefitResponse = updateCompanyBenefitResponseFuture.get() + updateCompanyBenefitResponse.validate() + } + + @Test + fun list() { + val client = + FinchOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .accessToken("My Access Token") + .build() + val benefitServiceAsync = client.hris().benefits() + + val pageFuture = benefitServiceAsync.list() + + val page = pageFuture.get() + page.response().validate() + } + + @Test + fun listSupportedBenefits() { + val client = + FinchOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .accessToken("My Access Token") + .build() + val benefitServiceAsync = client.hris().benefits() + + val pageFuture = benefitServiceAsync.listSupportedBenefits() + + val page = pageFuture.get() + page.response().validate() + } +} diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/hris/CompanyServiceAsyncTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/hris/CompanyServiceAsyncTest.kt new file mode 100644 index 00000000..f281cf88 --- /dev/null +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/hris/CompanyServiceAsyncTest.kt @@ -0,0 +1,27 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.tryfinch.api.services.async.hris + +import com.tryfinch.api.TestServerExtension +import com.tryfinch.api.client.okhttp.FinchOkHttpClientAsync +import org.junit.jupiter.api.Test +import org.junit.jupiter.api.extension.ExtendWith + +@ExtendWith(TestServerExtension::class) +class CompanyServiceAsyncTest { + + @Test + fun retrieve() { + val client = + FinchOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .accessToken("My Access Token") + .build() + val companyServiceAsync = client.hris().company() + + val companyFuture = companyServiceAsync.retrieve() + + val company = companyFuture.get() + company.validate() + } +} diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/hris/DirectoryServiceAsyncTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/hris/DirectoryServiceAsyncTest.kt new file mode 100644 index 00000000..82958815 --- /dev/null +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/hris/DirectoryServiceAsyncTest.kt @@ -0,0 +1,42 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.tryfinch.api.services.async.hris + +import com.tryfinch.api.TestServerExtension +import com.tryfinch.api.client.okhttp.FinchOkHttpClientAsync +import org.junit.jupiter.api.Test +import org.junit.jupiter.api.extension.ExtendWith + +@ExtendWith(TestServerExtension::class) +class DirectoryServiceAsyncTest { + + @Test + fun list() { + val client = + FinchOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .accessToken("My Access Token") + .build() + val directoryServiceAsync = client.hris().directory() + + val pageFuture = directoryServiceAsync.list() + + val page = pageFuture.get() + page.response().validate() + } + + @Test + fun listIndividuals() { + val client = + FinchOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .accessToken("My Access Token") + .build() + val directoryServiceAsync = client.hris().directory() + + val pageFuture = directoryServiceAsync.listIndividuals() + + val page = pageFuture.get() + page.response().validate() + } +} diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/hris/DocumentServiceAsyncTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/hris/DocumentServiceAsyncTest.kt new file mode 100644 index 00000000..efb50717 --- /dev/null +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/hris/DocumentServiceAsyncTest.kt @@ -0,0 +1,55 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.tryfinch.api.services.async.hris + +import com.tryfinch.api.TestServerExtension +import com.tryfinch.api.client.okhttp.FinchOkHttpClientAsync +import com.tryfinch.api.models.HrisDocumentListParams +import com.tryfinch.api.models.HrisDocumentRetreiveParams +import org.junit.jupiter.api.Test +import org.junit.jupiter.api.extension.ExtendWith + +@ExtendWith(TestServerExtension::class) +class DocumentServiceAsyncTest { + + @Test + fun list() { + val client = + FinchOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .accessToken("My Access Token") + .build() + val documentServiceAsync = client.hris().documents() + + val documentFuture = + documentServiceAsync.list( + HrisDocumentListParams.builder() + .addIndividualId("string") + .limit(0L) + .offset(0L) + .addType(HrisDocumentListParams.Type.W4_2020) + .build() + ) + + val document = documentFuture.get() + document.validate() + } + + @Test + fun retreive() { + val client = + FinchOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .accessToken("My Access Token") + .build() + val documentServiceAsync = client.hris().documents() + + val responseFuture = + documentServiceAsync.retreive( + HrisDocumentRetreiveParams.builder().documentId("document_id").build() + ) + + val response = responseFuture.get() + response.validate() + } +} diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/hris/EmploymentServiceAsyncTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/hris/EmploymentServiceAsyncTest.kt new file mode 100644 index 00000000..1a201342 --- /dev/null +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/hris/EmploymentServiceAsyncTest.kt @@ -0,0 +1,37 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.tryfinch.api.services.async.hris + +import com.tryfinch.api.TestServerExtension +import com.tryfinch.api.client.okhttp.FinchOkHttpClientAsync +import com.tryfinch.api.models.HrisEmploymentRetrieveManyParams +import org.junit.jupiter.api.Test +import org.junit.jupiter.api.extension.ExtendWith + +@ExtendWith(TestServerExtension::class) +class EmploymentServiceAsyncTest { + + @Test + fun retrieveMany() { + val client = + FinchOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .accessToken("My Access Token") + .build() + val employmentServiceAsync = client.hris().employments() + + val pageFuture = + employmentServiceAsync.retrieveMany( + HrisEmploymentRetrieveManyParams.builder() + .addRequest( + HrisEmploymentRetrieveManyParams.Request.builder() + .individualId("individual_id") + .build() + ) + .build() + ) + + val page = pageFuture.get() + page.response().validate() + } +} diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/hris/IndividualServiceAsyncTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/hris/IndividualServiceAsyncTest.kt new file mode 100644 index 00000000..5c9271e4 --- /dev/null +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/hris/IndividualServiceAsyncTest.kt @@ -0,0 +1,27 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.tryfinch.api.services.async.hris + +import com.tryfinch.api.TestServerExtension +import com.tryfinch.api.client.okhttp.FinchOkHttpClientAsync +import org.junit.jupiter.api.Test +import org.junit.jupiter.api.extension.ExtendWith + +@ExtendWith(TestServerExtension::class) +class IndividualServiceAsyncTest { + + @Test + fun retrieveMany() { + val client = + FinchOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .accessToken("My Access Token") + .build() + val individualServiceAsync = client.hris().individuals() + + val pageFuture = individualServiceAsync.retrieveMany() + + val page = pageFuture.get() + page.response().validate() + } +} diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/hris/PayStatementServiceAsyncTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/hris/PayStatementServiceAsyncTest.kt new file mode 100644 index 00000000..20ec632a --- /dev/null +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/hris/PayStatementServiceAsyncTest.kt @@ -0,0 +1,37 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.tryfinch.api.services.async.hris + +import com.tryfinch.api.TestServerExtension +import com.tryfinch.api.client.okhttp.FinchOkHttpClientAsync +import com.tryfinch.api.models.HrisPayStatementRetrieveManyParams +import org.junit.jupiter.api.Test +import org.junit.jupiter.api.extension.ExtendWith + +@ExtendWith(TestServerExtension::class) +class PayStatementServiceAsyncTest { + + @Test + fun retrieveMany() { + val client = + FinchOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .accessToken("My Access Token") + .build() + val payStatementServiceAsync = client.hris().payStatements() + + val pageFuture = + payStatementServiceAsync.retrieveMany( + HrisPayStatementRetrieveManyParams.builder() + .addRequest( + HrisPayStatementRetrieveManyParams.Request.builder() + .paymentId("string") + .build() + ) + .build() + ) + + val page = pageFuture.get() + page.response().validate() + } +} diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/hris/PaymentServiceAsyncTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/hris/PaymentServiceAsyncTest.kt new file mode 100644 index 00000000..3525074f --- /dev/null +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/hris/PaymentServiceAsyncTest.kt @@ -0,0 +1,35 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.tryfinch.api.services.async.hris + +import com.tryfinch.api.TestServerExtension +import com.tryfinch.api.client.okhttp.FinchOkHttpClientAsync +import com.tryfinch.api.models.HrisPaymentListParams +import java.time.LocalDate +import org.junit.jupiter.api.Test +import org.junit.jupiter.api.extension.ExtendWith + +@ExtendWith(TestServerExtension::class) +class PaymentServiceAsyncTest { + + @Test + fun list() { + val client = + FinchOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .accessToken("My Access Token") + .build() + val paymentServiceAsync = client.hris().payments() + + val pageFuture = + paymentServiceAsync.list( + HrisPaymentListParams.builder() + .endDate(LocalDate.parse("2021-01-01")) + .startDate(LocalDate.parse("2021-01-01")) + .build() + ) + + val page = pageFuture.get() + page.response().validate() + } +} diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/hris/benefits/IndividualServiceAsyncTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/hris/benefits/IndividualServiceAsyncTest.kt new file mode 100644 index 00000000..e2e0ba6a --- /dev/null +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/hris/benefits/IndividualServiceAsyncTest.kt @@ -0,0 +1,71 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.tryfinch.api.services.async.hris.benefits + +import com.tryfinch.api.TestServerExtension +import com.tryfinch.api.client.okhttp.FinchOkHttpClientAsync +import com.tryfinch.api.models.HrisBenefitIndividualEnrolledIdsParams +import com.tryfinch.api.models.HrisBenefitIndividualRetrieveManyBenefitsParams +import com.tryfinch.api.models.HrisBenefitIndividualUnenrollManyParams +import org.junit.jupiter.api.Test +import org.junit.jupiter.api.extension.ExtendWith + +@ExtendWith(TestServerExtension::class) +class IndividualServiceAsyncTest { + + @Test + fun enrolledIds() { + val client = + FinchOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .accessToken("My Access Token") + .build() + val individualServiceAsync = client.hris().benefits().individuals() + + val responseFuture = + individualServiceAsync.enrolledIds( + HrisBenefitIndividualEnrolledIdsParams.builder().benefitId("benefit_id").build() + ) + + val response = responseFuture.get() + response.validate() + } + + @Test + fun retrieveManyBenefits() { + val client = + FinchOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .accessToken("My Access Token") + .build() + val individualServiceAsync = client.hris().benefits().individuals() + + val pageFuture = + individualServiceAsync.retrieveManyBenefits( + HrisBenefitIndividualRetrieveManyBenefitsParams.builder() + .benefitId("benefit_id") + .build() + ) + + val page = pageFuture.get() + page.response().validate() + } + + @Test + fun unenrollMany() { + val client = + FinchOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .accessToken("My Access Token") + .build() + val individualServiceAsync = client.hris().benefits().individuals() + + val pageFuture = + individualServiceAsync.unenrollMany( + HrisBenefitIndividualUnenrollManyParams.builder().benefitId("benefit_id").build() + ) + + val page = pageFuture.get() + page.response().validate() + } +} diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/jobs/AutomatedServiceAsyncTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/jobs/AutomatedServiceAsyncTest.kt new file mode 100644 index 00000000..305e344f --- /dev/null +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/jobs/AutomatedServiceAsyncTest.kt @@ -0,0 +1,71 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.tryfinch.api.services.async.jobs + +import com.tryfinch.api.TestServerExtension +import com.tryfinch.api.client.okhttp.FinchOkHttpClientAsync +import com.tryfinch.api.models.JobAutomatedCreateParams +import com.tryfinch.api.models.JobAutomatedRetrieveParams +import org.junit.jupiter.api.Test +import org.junit.jupiter.api.extension.ExtendWith + +@ExtendWith(TestServerExtension::class) +class AutomatedServiceAsyncTest { + + @Test + fun create() { + val client = + FinchOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .accessToken("My Access Token") + .build() + val automatedServiceAsync = client.jobs().automated() + + val automatedFuture = + automatedServiceAsync.create( + JobAutomatedCreateParams.builder() + .body( + JobAutomatedCreateParams.Body.DataSyncAll.builder() + .type(JobAutomatedCreateParams.Body.DataSyncAll.Type.DATA_SYNC_ALL) + .build() + ) + .build() + ) + + val automated = automatedFuture.get() + automated.validate() + } + + @Test + fun retrieve() { + val client = + FinchOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .accessToken("My Access Token") + .build() + val automatedServiceAsync = client.jobs().automated() + + val automatedAsyncJobFuture = + automatedServiceAsync.retrieve( + JobAutomatedRetrieveParams.builder().jobId("job_id").build() + ) + + val automatedAsyncJob = automatedAsyncJobFuture.get() + automatedAsyncJob.validate() + } + + @Test + fun list() { + val client = + FinchOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .accessToken("My Access Token") + .build() + val automatedServiceAsync = client.jobs().automated() + + val pageFuture = automatedServiceAsync.list() + + val page = pageFuture.get() + page.response().validate() + } +} diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/jobs/ManualServiceAsyncTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/jobs/ManualServiceAsyncTest.kt new file mode 100644 index 00000000..b0e5e66f --- /dev/null +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/jobs/ManualServiceAsyncTest.kt @@ -0,0 +1,29 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.tryfinch.api.services.async.jobs + +import com.tryfinch.api.TestServerExtension +import com.tryfinch.api.client.okhttp.FinchOkHttpClientAsync +import com.tryfinch.api.models.JobManualRetrieveParams +import org.junit.jupiter.api.Test +import org.junit.jupiter.api.extension.ExtendWith + +@ExtendWith(TestServerExtension::class) +class ManualServiceAsyncTest { + + @Test + fun retrieve() { + val client = + FinchOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .accessToken("My Access Token") + .build() + val manualServiceAsync = client.jobs().manual() + + val manualAsyncJobFuture = + manualServiceAsync.retrieve(JobManualRetrieveParams.builder().jobId("job_id").build()) + + val manualAsyncJob = manualAsyncJobFuture.get() + manualAsyncJob.validate() + } +} diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/payroll/PayGroupServiceAsyncTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/payroll/PayGroupServiceAsyncTest.kt new file mode 100644 index 00000000..603c5607 --- /dev/null +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/payroll/PayGroupServiceAsyncTest.kt @@ -0,0 +1,46 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.tryfinch.api.services.async.payroll + +import com.tryfinch.api.TestServerExtension +import com.tryfinch.api.client.okhttp.FinchOkHttpClientAsync +import com.tryfinch.api.models.PayrollPayGroupRetrieveParams +import org.junit.jupiter.api.Test +import org.junit.jupiter.api.extension.ExtendWith + +@ExtendWith(TestServerExtension::class) +class PayGroupServiceAsyncTest { + + @Test + fun retrieve() { + val client = + FinchOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .accessToken("My Access Token") + .build() + val payGroupServiceAsync = client.payroll().payGroups() + + val payGroupFuture = + payGroupServiceAsync.retrieve( + PayrollPayGroupRetrieveParams.builder().payGroupId("pay_group_id").build() + ) + + val payGroup = payGroupFuture.get() + payGroup.validate() + } + + @Test + fun list() { + val client = + FinchOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .accessToken("My Access Token") + .build() + val payGroupServiceAsync = client.payroll().payGroups() + + val pageFuture = payGroupServiceAsync.list() + + val page = pageFuture.get() + page.response().validate() + } +} diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/sandbox/CompanyServiceAsyncTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/sandbox/CompanyServiceAsyncTest.kt new file mode 100644 index 00000000..e4a8d339 --- /dev/null +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/sandbox/CompanyServiceAsyncTest.kt @@ -0,0 +1,74 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.tryfinch.api.services.async.sandbox + +import com.tryfinch.api.TestServerExtension +import com.tryfinch.api.client.okhttp.FinchOkHttpClientAsync +import com.tryfinch.api.models.Location +import com.tryfinch.api.models.SandboxCompanyUpdateParams +import org.junit.jupiter.api.Test +import org.junit.jupiter.api.extension.ExtendWith + +@ExtendWith(TestServerExtension::class) +class CompanyServiceAsyncTest { + + @Test + fun update() { + val client = + FinchOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .accessToken("My Access Token") + .build() + val companyServiceAsync = client.sandbox().company() + + val companyFuture = + companyServiceAsync.update( + SandboxCompanyUpdateParams.builder() + .addAccount( + SandboxCompanyUpdateParams.Account.builder() + .accountName("account_name") + .accountNumber("account_number") + .accountType(SandboxCompanyUpdateParams.Account.AccountType.CHECKING) + .institutionName("institution_name") + .routingNumber("routing_number") + .build() + ) + .addDepartment( + SandboxCompanyUpdateParams.Department.builder() + .name("name") + .parent( + SandboxCompanyUpdateParams.Department.Parent.builder() + .name("name") + .build() + ) + .build() + ) + .ein("ein") + .entity( + SandboxCompanyUpdateParams.Entity.builder() + .subtype(SandboxCompanyUpdateParams.Entity.Subtype.S_CORPORATION) + .type(SandboxCompanyUpdateParams.Entity.Type.LLC) + .build() + ) + .legalName("legal_name") + .addLocation( + Location.builder() + .city("city") + .country("country") + .line1("line1") + .line2("line2") + .name("name") + .postalCode("postal_code") + .sourceId("source_id") + .state("state") + .build() + ) + .primaryEmail("primary_email") + .primaryPhoneNumber("primary_phone_number") + .build() + ) + + val company = companyFuture.get() + company.validate() + } +} diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/sandbox/ConnectionServiceAsyncTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/sandbox/ConnectionServiceAsyncTest.kt new file mode 100644 index 00000000..d642684f --- /dev/null +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/sandbox/ConnectionServiceAsyncTest.kt @@ -0,0 +1,36 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.tryfinch.api.services.async.sandbox + +import com.tryfinch.api.TestServerExtension +import com.tryfinch.api.client.okhttp.FinchOkHttpClientAsync +import com.tryfinch.api.models.SandboxConnectionCreateParams +import org.junit.jupiter.api.Test +import org.junit.jupiter.api.extension.ExtendWith + +@ExtendWith(TestServerExtension::class) +class ConnectionServiceAsyncTest { + + @Test + fun create() { + val client = + FinchOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .accessToken("My Access Token") + .build() + val connectionServiceAsync = client.sandbox().connections() + + val connectionFuture = + connectionServiceAsync.create( + SandboxConnectionCreateParams.builder() + .providerId("provider_id") + .authenticationType(SandboxConnectionCreateParams.AuthenticationType.CREDENTIAL) + .employeeSize(0L) + .addProduct("string") + .build() + ) + + val connection = connectionFuture.get() + connection.validate() + } +} diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/sandbox/DirectoryServiceAsyncTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/sandbox/DirectoryServiceAsyncTest.kt new file mode 100644 index 00000000..c6c5da92 --- /dev/null +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/sandbox/DirectoryServiceAsyncTest.kt @@ -0,0 +1,160 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.tryfinch.api.services.async.sandbox + +import com.tryfinch.api.TestServerExtension +import com.tryfinch.api.client.okhttp.FinchOkHttpClientAsync +import com.tryfinch.api.core.JsonValue +import com.tryfinch.api.models.Income +import com.tryfinch.api.models.Location +import com.tryfinch.api.models.SandboxDirectoryCreateParams +import org.junit.jupiter.api.Test +import org.junit.jupiter.api.extension.ExtendWith + +@ExtendWith(TestServerExtension::class) +class DirectoryServiceAsyncTest { + + @Test + fun create() { + val client = + FinchOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .accessToken("My Access Token") + .build() + val directoryServiceAsync = client.sandbox().directory() + + val directoriesFuture = + directoryServiceAsync.create( + SandboxDirectoryCreateParams.builder() + .addBody( + SandboxDirectoryCreateParams.IndividualOrEmployment.builder() + .classCode("class_code") + .addCustomField( + SandboxDirectoryCreateParams.IndividualOrEmployment.CustomField + .builder() + .name("name") + .value(JsonValue.from(mapOf())) + .build() + ) + .department( + SandboxDirectoryCreateParams.IndividualOrEmployment.Department + .builder() + .name("name") + .build() + ) + .dob("dob") + .addEmail( + SandboxDirectoryCreateParams.IndividualOrEmployment.Email.builder() + .data("data") + .type( + SandboxDirectoryCreateParams.IndividualOrEmployment.Email + .Type + .WORK + ) + .build() + ) + .employment( + SandboxDirectoryCreateParams.IndividualOrEmployment.Employment + .builder() + .subtype( + SandboxDirectoryCreateParams.IndividualOrEmployment + .Employment + .Subtype + .FULL_TIME + ) + .type( + SandboxDirectoryCreateParams.IndividualOrEmployment + .Employment + .Type + .EMPLOYEE + ) + .build() + ) + .employmentStatus( + SandboxDirectoryCreateParams.IndividualOrEmployment.EmploymentStatus + .ACTIVE + ) + .encryptedSsn("encrypted_ssn") + .endDate("end_date") + .ethnicity( + SandboxDirectoryCreateParams.IndividualOrEmployment.Ethnicity.ASIAN + ) + .firstName("first_name") + .gender( + SandboxDirectoryCreateParams.IndividualOrEmployment.Gender.FEMALE + ) + .income( + Income.builder() + .amount(0L) + .currency("currency") + .effectiveDate("effective_date") + .unit(Income.Unit.YEARLY) + .build() + ) + .addIncomeHistory( + Income.builder() + .amount(0L) + .currency("currency") + .effectiveDate("effective_date") + .unit(Income.Unit.YEARLY) + .build() + ) + .isActive(true) + .lastName("last_name") + .latestRehireDate("latest_rehire_date") + .location( + Location.builder() + .city("city") + .country("country") + .line1("line1") + .line2("line2") + .name("name") + .postalCode("postal_code") + .sourceId("source_id") + .state("state") + .build() + ) + .manager( + SandboxDirectoryCreateParams.IndividualOrEmployment.Manager + .builder() + .id("id") + .build() + ) + .middleName("middle_name") + .addPhoneNumber( + SandboxDirectoryCreateParams.IndividualOrEmployment.PhoneNumber + .builder() + .data("data") + .type( + SandboxDirectoryCreateParams.IndividualOrEmployment + .PhoneNumber + .Type + .WORK + ) + .build() + ) + .preferredName("preferred_name") + .residence( + Location.builder() + .city("city") + .country("country") + .line1("line1") + .line2("line2") + .name("name") + .postalCode("postal_code") + .sourceId("source_id") + .state("state") + .build() + ) + .sourceId("source_id") + .ssn("ssn") + .startDate("start_date") + .title("title") + .build() + ) + .build() + ) + + val directories = directoriesFuture.get() + } +} diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/sandbox/EmploymentServiceAsyncTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/sandbox/EmploymentServiceAsyncTest.kt new file mode 100644 index 00000000..406c6e9b --- /dev/null +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/sandbox/EmploymentServiceAsyncTest.kt @@ -0,0 +1,91 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.tryfinch.api.services.async.sandbox + +import com.tryfinch.api.TestServerExtension +import com.tryfinch.api.client.okhttp.FinchOkHttpClientAsync +import com.tryfinch.api.core.JsonValue +import com.tryfinch.api.models.Income +import com.tryfinch.api.models.Location +import com.tryfinch.api.models.SandboxEmploymentUpdateParams +import org.junit.jupiter.api.Test +import org.junit.jupiter.api.extension.ExtendWith + +@ExtendWith(TestServerExtension::class) +class EmploymentServiceAsyncTest { + + @Test + fun update() { + val client = + FinchOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .accessToken("My Access Token") + .build() + val employmentServiceAsync = client.sandbox().employment() + + val employmentFuture = + employmentServiceAsync.update( + SandboxEmploymentUpdateParams.builder() + .individualId("individual_id") + .classCode("class_code") + .addCustomField( + SandboxEmploymentUpdateParams.CustomField.builder() + .name("name") + .value(JsonValue.from(mapOf())) + .build() + ) + .department( + SandboxEmploymentUpdateParams.Department.builder().name("name").build() + ) + .employment( + SandboxEmploymentUpdateParams.Employment.builder() + .subtype(SandboxEmploymentUpdateParams.Employment.Subtype.FULL_TIME) + .type(SandboxEmploymentUpdateParams.Employment.Type.EMPLOYEE) + .build() + ) + .employmentStatus(SandboxEmploymentUpdateParams.EmploymentStatus.ACTIVE) + .endDate("end_date") + .firstName("first_name") + .income( + Income.builder() + .amount(0L) + .currency("currency") + .effectiveDate("effective_date") + .unit(Income.Unit.YEARLY) + .build() + ) + .addIncomeHistory( + Income.builder() + .amount(0L) + .currency("currency") + .effectiveDate("effective_date") + .unit(Income.Unit.YEARLY) + .build() + ) + .isActive(true) + .lastName("last_name") + .latestRehireDate("latest_rehire_date") + .location( + Location.builder() + .city("city") + .country("country") + .line1("line1") + .line2("line2") + .name("name") + .postalCode("postal_code") + .sourceId("source_id") + .state("state") + .build() + ) + .manager(SandboxEmploymentUpdateParams.Manager.builder().id("id").build()) + .middleName("middle_name") + .sourceId("source_id") + .startDate("start_date") + .title("title") + .build() + ) + + val employment = employmentFuture.get() + employment.validate() + } +} diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/sandbox/IndividualServiceAsyncTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/sandbox/IndividualServiceAsyncTest.kt new file mode 100644 index 00000000..e7b71dc4 --- /dev/null +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/sandbox/IndividualServiceAsyncTest.kt @@ -0,0 +1,67 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.tryfinch.api.services.async.sandbox + +import com.tryfinch.api.TestServerExtension +import com.tryfinch.api.client.okhttp.FinchOkHttpClientAsync +import com.tryfinch.api.models.Location +import com.tryfinch.api.models.SandboxIndividualUpdateParams +import org.junit.jupiter.api.Test +import org.junit.jupiter.api.extension.ExtendWith + +@ExtendWith(TestServerExtension::class) +class IndividualServiceAsyncTest { + + @Test + fun update() { + val client = + FinchOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .accessToken("My Access Token") + .build() + val individualServiceAsync = client.sandbox().individual() + + val individualFuture = + individualServiceAsync.update( + SandboxIndividualUpdateParams.builder() + .individualId("individual_id") + .dob("dob") + .addEmail( + SandboxIndividualUpdateParams.Email.builder() + .data("data") + .type(SandboxIndividualUpdateParams.Email.Type.WORK) + .build() + ) + .encryptedSsn("encrypted_ssn") + .ethnicity(SandboxIndividualUpdateParams.Ethnicity.ASIAN) + .firstName("first_name") + .gender(SandboxIndividualUpdateParams.Gender.FEMALE) + .lastName("last_name") + .middleName("middle_name") + .addPhoneNumber( + SandboxIndividualUpdateParams.PhoneNumber.builder() + .data("data") + .type(SandboxIndividualUpdateParams.PhoneNumber.Type.WORK) + .build() + ) + .preferredName("preferred_name") + .residence( + Location.builder() + .city("city") + .country("country") + .line1("line1") + .line2("line2") + .name("name") + .postalCode("postal_code") + .sourceId("source_id") + .state("state") + .build() + ) + .ssn("ssn") + .build() + ) + + val individual = individualFuture.get() + individual.validate() + } +} diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/sandbox/JobServiceAsyncTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/sandbox/JobServiceAsyncTest.kt new file mode 100644 index 00000000..157e7459 --- /dev/null +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/sandbox/JobServiceAsyncTest.kt @@ -0,0 +1,33 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.tryfinch.api.services.async.sandbox + +import com.tryfinch.api.TestServerExtension +import com.tryfinch.api.client.okhttp.FinchOkHttpClientAsync +import com.tryfinch.api.models.SandboxJobCreateParams +import org.junit.jupiter.api.Test +import org.junit.jupiter.api.extension.ExtendWith + +@ExtendWith(TestServerExtension::class) +class JobServiceAsyncTest { + + @Test + fun create() { + val client = + FinchOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .accessToken("My Access Token") + .build() + val jobServiceAsync = client.sandbox().jobs() + + val jobFuture = + jobServiceAsync.create( + SandboxJobCreateParams.builder() + .type(SandboxJobCreateParams.Type.DATA_SYNC_ALL) + .build() + ) + + val job = jobFuture.get() + job.validate() + } +} diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/sandbox/PaymentServiceAsyncTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/sandbox/PaymentServiceAsyncTest.kt new file mode 100644 index 00000000..88fdddfe --- /dev/null +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/sandbox/PaymentServiceAsyncTest.kt @@ -0,0 +1,190 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.tryfinch.api.services.async.sandbox + +import com.tryfinch.api.TestServerExtension +import com.tryfinch.api.client.okhttp.FinchOkHttpClientAsync +import com.tryfinch.api.core.JsonValue +import com.tryfinch.api.models.BenefitType +import com.tryfinch.api.models.Money +import com.tryfinch.api.models.SandboxPaymentCreateParams +import org.junit.jupiter.api.Test +import org.junit.jupiter.api.extension.ExtendWith + +@ExtendWith(TestServerExtension::class) +class PaymentServiceAsyncTest { + + @Test + fun create() { + val client = + FinchOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .accessToken("My Access Token") + .build() + val paymentServiceAsync = client.sandbox().payment() + + val paymentFuture = + paymentServiceAsync.create( + SandboxPaymentCreateParams.builder() + .endDate("end_date") + .addPayStatement( + SandboxPaymentCreateParams.PayStatement.builder() + .addEarning( + SandboxPaymentCreateParams.PayStatement.Earning.builder() + .amount(0L) + .attributes( + SandboxPaymentCreateParams.PayStatement.Earning.Attributes + .builder() + .metadata( + SandboxPaymentCreateParams.PayStatement.Earning + .Attributes + .Metadata + .builder() + .metadata( + SandboxPaymentCreateParams.PayStatement + .Earning + .Attributes + .Metadata + .InnerMetadata + .builder() + .putAdditionalProperty( + "foo", + JsonValue.from("bar"), + ) + .build() + ) + .build() + ) + .build() + ) + .currency("currency") + .hours(0.0) + .name("name") + .type( + SandboxPaymentCreateParams.PayStatement.Earning.Type.SALARY + ) + .build() + ) + .addEmployeeDeduction( + SandboxPaymentCreateParams.PayStatement.EmployeeDeduction.builder() + .amount(2000L) + .attributes( + SandboxPaymentCreateParams.PayStatement.EmployeeDeduction + .Attributes + .builder() + .metadata( + SandboxPaymentCreateParams.PayStatement + .EmployeeDeduction + .Attributes + .Metadata + .builder() + .metadata( + SandboxPaymentCreateParams.PayStatement + .EmployeeDeduction + .Attributes + .Metadata + .InnerMetadata + .builder() + .putAdditionalProperty( + "foo", + JsonValue.from("bar"), + ) + .build() + ) + .build() + ) + .build() + ) + .currency("usd") + .name("401k test") + .preTax(true) + .type(BenefitType._401K) + .build() + ) + .addEmployerContribution( + SandboxPaymentCreateParams.PayStatement.EmployerContribution + .builder() + .amount(0L) + .attributes( + SandboxPaymentCreateParams.PayStatement.EmployerContribution + .Attributes + .builder() + .metadata( + SandboxPaymentCreateParams.PayStatement + .EmployerContribution + .Attributes + .Metadata + .builder() + .metadata( + SandboxPaymentCreateParams.PayStatement + .EmployerContribution + .Attributes + .Metadata + .InnerMetadata + .builder() + .putAdditionalProperty( + "foo", + JsonValue.from("bar"), + ) + .build() + ) + .build() + ) + .build() + ) + .currency("currency") + .name("name") + .type(BenefitType._401K) + .build() + ) + .grossPay(Money.builder().amount(0L).currency("currency").build()) + .individualId("b2338cfb-472f-4f72-9faa-e028c083144a") + .netPay(Money.builder().amount(0L).currency("currency").build()) + .paymentMethod( + SandboxPaymentCreateParams.PayStatement.PaymentMethod.CHECK + ) + .addTax( + SandboxPaymentCreateParams.PayStatement.Tax.builder() + .amount(0L) + .attributes( + SandboxPaymentCreateParams.PayStatement.Tax.Attributes + .builder() + .metadata( + SandboxPaymentCreateParams.PayStatement.Tax + .Attributes + .Metadata + .builder() + .metadata( + SandboxPaymentCreateParams.PayStatement.Tax + .Attributes + .Metadata + .InnerMetadata + .builder() + .putAdditionalProperty( + "foo", + JsonValue.from("bar"), + ) + .build() + ) + .build() + ) + .build() + ) + .currency("currency") + .employer(true) + .name("name") + .type(SandboxPaymentCreateParams.PayStatement.Tax.Type.STATE) + .build() + ) + .totalHours(0.0) + .type(SandboxPaymentCreateParams.PayStatement.Type.REGULAR_PAYROLL) + .build() + ) + .startDate("start_date") + .build() + ) + + val payment = paymentFuture.get() + payment.validate() + } +} diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/sandbox/connections/AccountServiceAsyncTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/sandbox/connections/AccountServiceAsyncTest.kt new file mode 100644 index 00000000..6e7732ce --- /dev/null +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/sandbox/connections/AccountServiceAsyncTest.kt @@ -0,0 +1,60 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.tryfinch.api.services.async.sandbox.connections + +import com.tryfinch.api.TestServerExtension +import com.tryfinch.api.client.okhttp.FinchOkHttpClientAsync +import com.tryfinch.api.models.ConnectionStatusType +import com.tryfinch.api.models.SandboxConnectionAccountCreateParams +import com.tryfinch.api.models.SandboxConnectionAccountUpdateParams +import org.junit.jupiter.api.Test +import org.junit.jupiter.api.extension.ExtendWith + +@ExtendWith(TestServerExtension::class) +class AccountServiceAsyncTest { + + @Test + fun create() { + val client = + FinchOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .accessToken("My Access Token") + .build() + val accountServiceAsync = client.sandbox().connections().accounts() + + val accountFuture = + accountServiceAsync.create( + SandboxConnectionAccountCreateParams.builder() + .companyId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .providerId("provider_id") + .authenticationType( + SandboxConnectionAccountCreateParams.AuthenticationType.CREDENTIAL + ) + .addProduct("string") + .build() + ) + + val account = accountFuture.get() + account.validate() + } + + @Test + fun update() { + val client = + FinchOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .accessToken("My Access Token") + .build() + val accountServiceAsync = client.sandbox().connections().accounts() + + val accountFuture = + accountServiceAsync.update( + SandboxConnectionAccountUpdateParams.builder() + .connectionStatus(ConnectionStatusType.PENDING) + .build() + ) + + val account = accountFuture.get() + account.validate() + } +} diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/sandbox/jobs/ConfigurationServiceAsyncTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/sandbox/jobs/ConfigurationServiceAsyncTest.kt new file mode 100644 index 00000000..c219443c --- /dev/null +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/async/sandbox/jobs/ConfigurationServiceAsyncTest.kt @@ -0,0 +1,54 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.tryfinch.api.services.async.sandbox.jobs + +import com.tryfinch.api.TestServerExtension +import com.tryfinch.api.client.okhttp.FinchOkHttpClientAsync +import com.tryfinch.api.models.SandboxJobConfiguration +import com.tryfinch.api.models.SandboxJobConfigurationUpdateParams +import org.junit.jupiter.api.Test +import org.junit.jupiter.api.extension.ExtendWith + +@ExtendWith(TestServerExtension::class) +class ConfigurationServiceAsyncTest { + + @Test + fun retrieve() { + val client = + FinchOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .accessToken("My Access Token") + .build() + val configurationServiceAsync = client.sandbox().jobs().configuration() + + val sandboxJobConfigurationsFuture = configurationServiceAsync.retrieve() + + val sandboxJobConfigurations = sandboxJobConfigurationsFuture.get() + sandboxJobConfigurations.forEach { it.validate() } + } + + @Test + fun update() { + val client = + FinchOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .accessToken("My Access Token") + .build() + val configurationServiceAsync = client.sandbox().jobs().configuration() + + val sandboxJobConfigurationFuture = + configurationServiceAsync.update( + SandboxJobConfigurationUpdateParams.builder() + .sandboxJobConfiguration( + SandboxJobConfiguration.builder() + .completionStatus(SandboxJobConfiguration.CompletionStatus.COMPLETE) + .type(SandboxJobConfiguration.Type.DATA_SYNC_ALL) + .build() + ) + .build() + ) + + val sandboxJobConfiguration = sandboxJobConfigurationFuture.get() + sandboxJobConfiguration.validate() + } +} diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/AccessTokenServiceTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/AccessTokenServiceTest.kt index 258b40b3..c015937d 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/AccessTokenServiceTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/AccessTokenServiceTest.kt @@ -12,13 +12,14 @@ import org.junit.jupiter.api.extension.ExtendWith class AccessTokenServiceTest { @Test - fun callCreate() { + fun create() { val client = FinchOkHttpClient.builder() .baseUrl(TestServerExtension.BASE_URL) .accessToken("My Access Token") .build() val accessTokenService = client.accessTokens() + val createAccessTokenResponse = accessTokenService.create( AccessTokenCreateParams.builder() @@ -28,7 +29,7 @@ class AccessTokenServiceTest { .redirectUri("https://example.com") .build() ) - println(createAccessTokenResponse) + createAccessTokenResponse.validate() } } diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/AccountServiceTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/AccountServiceTest.kt index 722ea7d8..d3b6eab2 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/AccountServiceTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/AccountServiceTest.kt @@ -4,8 +4,6 @@ package com.tryfinch.api.services.blocking import com.tryfinch.api.TestServerExtension import com.tryfinch.api.client.okhttp.FinchOkHttpClient -import com.tryfinch.api.models.AccountDisconnectParams -import com.tryfinch.api.models.AccountIntrospectParams import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith @@ -13,29 +11,30 @@ import org.junit.jupiter.api.extension.ExtendWith class AccountServiceTest { @Test - fun callDisconnect() { + fun disconnect() { val client = FinchOkHttpClient.builder() .baseUrl(TestServerExtension.BASE_URL) .accessToken("My Access Token") .build() val accountService = client.account() - val disconnectResponse = - accountService.disconnect(AccountDisconnectParams.builder().build()) - println(disconnectResponse) + + val disconnectResponse = accountService.disconnect() + disconnectResponse.validate() } @Test - fun callIntrospect() { + fun introspect() { val client = FinchOkHttpClient.builder() .baseUrl(TestServerExtension.BASE_URL) .accessToken("My Access Token") .build() val accountService = client.account() - val introspection = accountService.introspect(AccountIntrospectParams.builder().build()) - println(introspection) + + val introspection = accountService.introspect() + introspection.validate() } } diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/ProviderServiceTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/ProviderServiceTest.kt index 55efec7e..061ba5ac 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/ProviderServiceTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/ProviderServiceTest.kt @@ -4,7 +4,6 @@ package com.tryfinch.api.services.blocking import com.tryfinch.api.TestServerExtension import com.tryfinch.api.client.okhttp.FinchOkHttpClient -import com.tryfinch.api.models.ProviderListParams import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith @@ -12,15 +11,16 @@ import org.junit.jupiter.api.extension.ExtendWith class ProviderServiceTest { @Test - fun callList() { + fun list() { val client = FinchOkHttpClient.builder() .baseUrl(TestServerExtension.BASE_URL) .accessToken("My Access Token") .build() val providerService = client.providers() - val getProvidersResponse = providerService.list(ProviderListParams.builder().build()) - println(getProvidersResponse) - getProvidersResponse.items().forEach { it.validate() } + + val page = providerService.list() + + page.response().validate() } } diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/RequestForwardingServiceTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/RequestForwardingServiceTest.kt index 86c16c24..ea604816 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/RequestForwardingServiceTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/RequestForwardingServiceTest.kt @@ -13,14 +13,15 @@ import org.junit.jupiter.api.extension.ExtendWith class RequestForwardingServiceTest { @Test - fun callForward() { + fun forward() { val client = FinchOkHttpClient.builder() .baseUrl(TestServerExtension.BASE_URL) .accessToken("My Access Token") .build() val requestForwardingService = client.requestForwarding() - val requestForwardingForwardResponse = + + val response = requestForwardingService.forward( RequestForwardingForwardParams.builder() .method("POST") @@ -30,7 +31,7 @@ class RequestForwardingServiceTest { .params(JsonValue.from(mapOf("showInactive" to true, "humanReadable" to true))) .build() ) - println(requestForwardingForwardResponse) - requestForwardingForwardResponse.validate() + + response.validate() } } diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/connect/SessionServiceTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/connect/SessionServiceTest.kt index d6a8f6d5..a7d71d39 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/connect/SessionServiceTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/connect/SessionServiceTest.kt @@ -13,14 +13,15 @@ import org.junit.jupiter.api.extension.ExtendWith class SessionServiceTest { @Test - fun callNew() { + fun new_() { val client = FinchOkHttpClient.builder() .baseUrl(TestServerExtension.BASE_URL) .accessToken("My Access Token") .build() val sessionService = client.connect().sessions() - val sessionNewResponse = + + val response = sessionService.new_( ConnectSessionNewParams.builder() .customerId("x") @@ -39,19 +40,20 @@ class SessionServiceTest { .sandbox(ConnectSessionNewParams.Sandbox.FINCH) .build() ) - println(sessionNewResponse) - sessionNewResponse.validate() + + response.validate() } @Test - fun callReauthenticate() { + fun reauthenticate() { val client = FinchOkHttpClient.builder() .baseUrl(TestServerExtension.BASE_URL) .accessToken("My Access Token") .build() val sessionService = client.connect().sessions() - val sessionReauthenticateResponse = + + val response = sessionService.reauthenticate( ConnectSessionReauthenticateParams.builder() .connectionId("connection_id") @@ -60,7 +62,7 @@ class SessionServiceTest { .redirectUri("https://example.com") .build() ) - println(sessionReauthenticateResponse) - sessionReauthenticateResponse.validate() + + response.validate() } } diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/hris/BenefitServiceTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/hris/BenefitServiceTest.kt index aa9964e9..488bfb34 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/hris/BenefitServiceTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/hris/BenefitServiceTest.kt @@ -7,8 +7,6 @@ import com.tryfinch.api.client.okhttp.FinchOkHttpClient import com.tryfinch.api.models.BenefitFrequency import com.tryfinch.api.models.BenefitType import com.tryfinch.api.models.HrisBenefitCreateParams -import com.tryfinch.api.models.HrisBenefitListParams -import com.tryfinch.api.models.HrisBenefitListSupportedBenefitsParams import com.tryfinch.api.models.HrisBenefitRetrieveParams import com.tryfinch.api.models.HrisBenefitUpdateParams import org.junit.jupiter.api.Test @@ -18,13 +16,14 @@ import org.junit.jupiter.api.extension.ExtendWith class BenefitServiceTest { @Test - fun callCreate() { + fun create() { val client = FinchOkHttpClient.builder() .baseUrl(TestServerExtension.BASE_URL) .accessToken("My Access Token") .build() val benefitService = client.hris().benefits() + val createCompanyBenefitsResponse = benefitService.create( HrisBenefitCreateParams.builder() @@ -33,34 +32,36 @@ class BenefitServiceTest { .type(BenefitType._401K) .build() ) - println(createCompanyBenefitsResponse) + createCompanyBenefitsResponse.validate() } @Test - fun callRetrieve() { + fun retrieve() { val client = FinchOkHttpClient.builder() .baseUrl(TestServerExtension.BASE_URL) .accessToken("My Access Token") .build() val benefitService = client.hris().benefits() + val companyBenefit = benefitService.retrieve( HrisBenefitRetrieveParams.builder().benefitId("benefit_id").build() ) - println(companyBenefit) + companyBenefit.validate() } @Test - fun callUpdate() { + fun update() { val client = FinchOkHttpClient.builder() .baseUrl(TestServerExtension.BASE_URL) .accessToken("My Access Token") .build() val benefitService = client.hris().benefits() + val updateCompanyBenefitResponse = benefitService.update( HrisBenefitUpdateParams.builder() @@ -68,37 +69,35 @@ class BenefitServiceTest { .description("description") .build() ) - println(updateCompanyBenefitResponse) + updateCompanyBenefitResponse.validate() } @Test - fun callList() { + fun list() { val client = FinchOkHttpClient.builder() .baseUrl(TestServerExtension.BASE_URL) .accessToken("My Access Token") .build() val benefitService = client.hris().benefits() - val getCompanyBenefitsResponse = - benefitService.list(HrisBenefitListParams.builder().build()) - println(getCompanyBenefitsResponse) - getCompanyBenefitsResponse.items().forEach { it.validate() } + + val page = benefitService.list() + + page.response().validate() } @Test - fun callListSupportedBenefits() { + fun listSupportedBenefits() { val client = FinchOkHttpClient.builder() .baseUrl(TestServerExtension.BASE_URL) .accessToken("My Access Token") .build() val benefitService = client.hris().benefits() - val getCompanyBenefitsMetadataResponse = - benefitService.listSupportedBenefits( - HrisBenefitListSupportedBenefitsParams.builder().build() - ) - println(getCompanyBenefitsMetadataResponse) - getCompanyBenefitsMetadataResponse.items().forEach { it.validate() } + + val page = benefitService.listSupportedBenefits() + + page.response().validate() } } diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/hris/CompanyServiceTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/hris/CompanyServiceTest.kt index 8d94efc7..79040ece 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/hris/CompanyServiceTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/hris/CompanyServiceTest.kt @@ -4,7 +4,6 @@ package com.tryfinch.api.services.blocking.hris import com.tryfinch.api.TestServerExtension import com.tryfinch.api.client.okhttp.FinchOkHttpClient -import com.tryfinch.api.models.HrisCompanyRetrieveParams import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith @@ -12,15 +11,16 @@ import org.junit.jupiter.api.extension.ExtendWith class CompanyServiceTest { @Test - fun callRetrieve() { + fun retrieve() { val client = FinchOkHttpClient.builder() .baseUrl(TestServerExtension.BASE_URL) .accessToken("My Access Token") .build() val companyService = client.hris().company() - val company = companyService.retrieve(HrisCompanyRetrieveParams.builder().build()) - println(company) + + val company = companyService.retrieve() + company.validate() } } diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/hris/DirectoryServiceTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/hris/DirectoryServiceTest.kt index 0fb92f37..61039c9e 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/hris/DirectoryServiceTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/hris/DirectoryServiceTest.kt @@ -4,8 +4,6 @@ package com.tryfinch.api.services.blocking.hris import com.tryfinch.api.TestServerExtension import com.tryfinch.api.client.okhttp.FinchOkHttpClient -import com.tryfinch.api.models.HrisDirectoryListIndividualsParams -import com.tryfinch.api.models.HrisDirectoryListParams import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith @@ -13,29 +11,30 @@ import org.junit.jupiter.api.extension.ExtendWith class DirectoryServiceTest { @Test - fun callList() { + fun list() { val client = FinchOkHttpClient.builder() .baseUrl(TestServerExtension.BASE_URL) .accessToken("My Access Token") .build() val directoryService = client.hris().directory() - val getDirectoryResponse = directoryService.list(HrisDirectoryListParams.builder().build()) - println(getDirectoryResponse) - getDirectoryResponse.individuals().forEach { it.validate() } + + val page = directoryService.list() + + page.response().validate() } @Test - fun callListIndividuals() { + fun listIndividuals() { val client = FinchOkHttpClient.builder() .baseUrl(TestServerExtension.BASE_URL) .accessToken("My Access Token") .build() val directoryService = client.hris().directory() - val getDirectoryResponse = - directoryService.listIndividuals(HrisDirectoryListIndividualsParams.builder().build()) - println(getDirectoryResponse) - getDirectoryResponse.individuals().forEach { it.validate() } + + val page = directoryService.listIndividuals() + + page.response().validate() } } diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/hris/DocumentServiceTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/hris/DocumentServiceTest.kt index 09f54c0e..aee56e24 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/hris/DocumentServiceTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/hris/DocumentServiceTest.kt @@ -13,14 +13,15 @@ import org.junit.jupiter.api.extension.ExtendWith class DocumentServiceTest { @Test - fun callList() { + fun list() { val client = FinchOkHttpClient.builder() .baseUrl(TestServerExtension.BASE_URL) .accessToken("My Access Token") .build() val documentService = client.hris().documents() - val documentListResponse = + + val document = documentService.list( HrisDocumentListParams.builder() .addIndividualId("string") @@ -29,22 +30,24 @@ class DocumentServiceTest { .addType(HrisDocumentListParams.Type.W4_2020) .build() ) - println(documentListResponse) - documentListResponse.validate() + + document.validate() } @Test - fun callRetreive() { + fun retreive() { val client = FinchOkHttpClient.builder() .baseUrl(TestServerExtension.BASE_URL) .accessToken("My Access Token") .build() val documentService = client.hris().documents() - val documentRetreiveResponse = + + val response = documentService.retreive( HrisDocumentRetreiveParams.builder().documentId("document_id").build() ) - println(documentRetreiveResponse) + + response.validate() } } diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/hris/EmploymentServiceTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/hris/EmploymentServiceTest.kt index 9eba85be..1de19a6e 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/hris/EmploymentServiceTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/hris/EmploymentServiceTest.kt @@ -12,14 +12,15 @@ import org.junit.jupiter.api.extension.ExtendWith class EmploymentServiceTest { @Test - fun callRetrieveMany() { + fun retrieveMany() { val client = FinchOkHttpClient.builder() .baseUrl(TestServerExtension.BASE_URL) .accessToken("My Access Token") .build() val employmentService = client.hris().employments() - val getEmploymentResponse = + + val page = employmentService.retrieveMany( HrisEmploymentRetrieveManyParams.builder() .addRequest( @@ -29,7 +30,7 @@ class EmploymentServiceTest { ) .build() ) - println(getEmploymentResponse) - getEmploymentResponse.responses().forEach { it.validate() } + + page.response().validate() } } diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/hris/IndividualServiceTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/hris/IndividualServiceTest.kt index 3aef212f..229dbb1a 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/hris/IndividualServiceTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/hris/IndividualServiceTest.kt @@ -4,7 +4,6 @@ package com.tryfinch.api.services.blocking.hris import com.tryfinch.api.TestServerExtension import com.tryfinch.api.client.okhttp.FinchOkHttpClient -import com.tryfinch.api.models.HrisIndividualRetrieveManyParams import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith @@ -12,16 +11,16 @@ import org.junit.jupiter.api.extension.ExtendWith class IndividualServiceTest { @Test - fun callRetrieveMany() { + fun retrieveMany() { val client = FinchOkHttpClient.builder() .baseUrl(TestServerExtension.BASE_URL) .accessToken("My Access Token") .build() val individualService = client.hris().individuals() - val getIndividualsResponse = - individualService.retrieveMany(HrisIndividualRetrieveManyParams.builder().build()) - println(getIndividualsResponse) - getIndividualsResponse.responses().forEach { it.validate() } + + val page = individualService.retrieveMany() + + page.response().validate() } } diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/hris/PayStatementServiceTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/hris/PayStatementServiceTest.kt index 6d52ab44..625767fa 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/hris/PayStatementServiceTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/hris/PayStatementServiceTest.kt @@ -12,14 +12,15 @@ import org.junit.jupiter.api.extension.ExtendWith class PayStatementServiceTest { @Test - fun callRetrieveMany() { + fun retrieveMany() { val client = FinchOkHttpClient.builder() .baseUrl(TestServerExtension.BASE_URL) .accessToken("My Access Token") .build() val payStatementService = client.hris().payStatements() - val getPayStatementsResponse = + + val page = payStatementService.retrieveMany( HrisPayStatementRetrieveManyParams.builder() .addRequest( @@ -29,7 +30,7 @@ class PayStatementServiceTest { ) .build() ) - println(getPayStatementsResponse) - getPayStatementsResponse.responses().forEach { it.validate() } + + page.response().validate() } } diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/hris/PaymentServiceTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/hris/PaymentServiceTest.kt index 35cc4d01..dcdb6295 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/hris/PaymentServiceTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/hris/PaymentServiceTest.kt @@ -13,21 +13,22 @@ import org.junit.jupiter.api.extension.ExtendWith class PaymentServiceTest { @Test - fun callList() { + fun list() { val client = FinchOkHttpClient.builder() .baseUrl(TestServerExtension.BASE_URL) .accessToken("My Access Token") .build() val paymentService = client.hris().payments() - val getPaymentsResponse = + + val page = paymentService.list( HrisPaymentListParams.builder() .endDate(LocalDate.parse("2021-01-01")) .startDate(LocalDate.parse("2021-01-01")) .build() ) - println(getPaymentsResponse) - getPaymentsResponse.items().forEach { it.validate() } + + page.response().validate() } } diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/hris/benefits/IndividualServiceTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/hris/benefits/IndividualServiceTest.kt index 61091aa9..7f39fa58 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/hris/benefits/IndividualServiceTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/hris/benefits/IndividualServiceTest.kt @@ -14,52 +14,55 @@ import org.junit.jupiter.api.extension.ExtendWith class IndividualServiceTest { @Test - fun callEnrolledIds() { + fun enrolledIds() { val client = FinchOkHttpClient.builder() .baseUrl(TestServerExtension.BASE_URL) .accessToken("My Access Token") .build() val individualService = client.hris().benefits().individuals() - val individualEnrolledIdsResponse = + + val response = individualService.enrolledIds( HrisBenefitIndividualEnrolledIdsParams.builder().benefitId("benefit_id").build() ) - println(individualEnrolledIdsResponse) - individualEnrolledIdsResponse.validate() + + response.validate() } @Test - fun callRetrieveManyBenefits() { + fun retrieveManyBenefits() { val client = FinchOkHttpClient.builder() .baseUrl(TestServerExtension.BASE_URL) .accessToken("My Access Token") .build() val individualService = client.hris().benefits().individuals() - val individualBenefits = + + val page = individualService.retrieveManyBenefits( HrisBenefitIndividualRetrieveManyBenefitsParams.builder() .benefitId("benefit_id") .build() ) - println(individualBenefits) - individualBenefits.items().forEach { it.validate() } + + page.response().validate() } @Test - fun callUnenrollMany() { + fun unenrollMany() { val client = FinchOkHttpClient.builder() .baseUrl(TestServerExtension.BASE_URL) .accessToken("My Access Token") .build() val individualService = client.hris().benefits().individuals() - val unenrollIndividualBenefitResponse = + + val page = individualService.unenrollMany( HrisBenefitIndividualUnenrollManyParams.builder().benefitId("benefit_id").build() ) - println(unenrollIndividualBenefitResponse) - unenrollIndividualBenefitResponse.items().forEach { it.validate() } + + page.response().validate() } } diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/jobs/AutomatedServiceTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/jobs/AutomatedServiceTest.kt index dd612542..087d29b4 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/jobs/AutomatedServiceTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/jobs/AutomatedServiceTest.kt @@ -5,7 +5,6 @@ package com.tryfinch.api.services.blocking.jobs import com.tryfinch.api.TestServerExtension import com.tryfinch.api.client.okhttp.FinchOkHttpClient import com.tryfinch.api.models.JobAutomatedCreateParams -import com.tryfinch.api.models.JobAutomatedListParams import com.tryfinch.api.models.JobAutomatedRetrieveParams import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith @@ -14,14 +13,15 @@ import org.junit.jupiter.api.extension.ExtendWith class AutomatedServiceTest { @Test - fun callCreate() { + fun create() { val client = FinchOkHttpClient.builder() .baseUrl(TestServerExtension.BASE_URL) .accessToken("My Access Token") .build() val automatedService = client.jobs().automated() - val automatedCreateResponse = + + val automated = automatedService.create( JobAutomatedCreateParams.builder() .body( @@ -31,34 +31,36 @@ class AutomatedServiceTest { ) .build() ) - println(automatedCreateResponse) - automatedCreateResponse.validate() + + automated.validate() } @Test - fun callRetrieve() { + fun retrieve() { val client = FinchOkHttpClient.builder() .baseUrl(TestServerExtension.BASE_URL) .accessToken("My Access Token") .build() val automatedService = client.jobs().automated() + val automatedAsyncJob = automatedService.retrieve(JobAutomatedRetrieveParams.builder().jobId("job_id").build()) - println(automatedAsyncJob) + automatedAsyncJob.validate() } @Test - fun callList() { + fun list() { val client = FinchOkHttpClient.builder() .baseUrl(TestServerExtension.BASE_URL) .accessToken("My Access Token") .build() val automatedService = client.jobs().automated() - val response = automatedService.list(JobAutomatedListParams.builder().build()) - println(response) - response.data().forEach { it.validate() } + + val page = automatedService.list() + + page.response().validate() } } diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/jobs/ManualServiceTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/jobs/ManualServiceTest.kt index ef763502..fcf6a74d 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/jobs/ManualServiceTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/jobs/ManualServiceTest.kt @@ -12,16 +12,17 @@ import org.junit.jupiter.api.extension.ExtendWith class ManualServiceTest { @Test - fun callRetrieve() { + fun retrieve() { val client = FinchOkHttpClient.builder() .baseUrl(TestServerExtension.BASE_URL) .accessToken("My Access Token") .build() val manualService = client.jobs().manual() + val manualAsyncJob = manualService.retrieve(JobManualRetrieveParams.builder().jobId("job_id").build()) - println(manualAsyncJob) + manualAsyncJob.validate() } } diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/payroll/PayGroupServiceTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/payroll/PayGroupServiceTest.kt index c9fe1035..569dfb08 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/payroll/PayGroupServiceTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/payroll/PayGroupServiceTest.kt @@ -4,7 +4,6 @@ package com.tryfinch.api.services.blocking.payroll import com.tryfinch.api.TestServerExtension import com.tryfinch.api.client.okhttp.FinchOkHttpClient -import com.tryfinch.api.models.PayrollPayGroupListParams import com.tryfinch.api.models.PayrollPayGroupRetrieveParams import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith @@ -13,32 +12,33 @@ import org.junit.jupiter.api.extension.ExtendWith class PayGroupServiceTest { @Test - fun callRetrieve() { + fun retrieve() { val client = FinchOkHttpClient.builder() .baseUrl(TestServerExtension.BASE_URL) .accessToken("My Access Token") .build() val payGroupService = client.payroll().payGroups() - val payGroupRetrieveResponse = + + val payGroup = payGroupService.retrieve( PayrollPayGroupRetrieveParams.builder().payGroupId("pay_group_id").build() ) - println(payGroupRetrieveResponse) - payGroupRetrieveResponse.validate() + + payGroup.validate() } @Test - fun callList() { + fun list() { val client = FinchOkHttpClient.builder() .baseUrl(TestServerExtension.BASE_URL) .accessToken("My Access Token") .build() val payGroupService = client.payroll().payGroups() - val getAllPayGroupsResponse = - payGroupService.list(PayrollPayGroupListParams.builder().build()) - println(getAllPayGroupsResponse) - getAllPayGroupsResponse.items().forEach { it.validate() } + + val page = payGroupService.list() + + page.response().validate() } } diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/sandbox/CompanyServiceTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/sandbox/CompanyServiceTest.kt index e6a6da70..e16c0ee9 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/sandbox/CompanyServiceTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/sandbox/CompanyServiceTest.kt @@ -13,14 +13,15 @@ import org.junit.jupiter.api.extension.ExtendWith class CompanyServiceTest { @Test - fun callUpdate() { + fun update() { val client = FinchOkHttpClient.builder() .baseUrl(TestServerExtension.BASE_URL) .accessToken("My Access Token") .build() val companyService = client.sandbox().company() - val companyUpdateResponse = + + val company = companyService.update( SandboxCompanyUpdateParams.builder() .addAccount( @@ -66,7 +67,7 @@ class CompanyServiceTest { .primaryPhoneNumber("primary_phone_number") .build() ) - println(companyUpdateResponse) - companyUpdateResponse.validate() + + company.validate() } } diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/sandbox/ConnectionServiceTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/sandbox/ConnectionServiceTest.kt index 7c74ddb7..c310e2cc 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/sandbox/ConnectionServiceTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/sandbox/ConnectionServiceTest.kt @@ -12,14 +12,15 @@ import org.junit.jupiter.api.extension.ExtendWith class ConnectionServiceTest { @Test - fun callCreate() { + fun create() { val client = FinchOkHttpClient.builder() .baseUrl(TestServerExtension.BASE_URL) .accessToken("My Access Token") .build() val connectionService = client.sandbox().connections() - val connectionCreateResponse = + + val connection = connectionService.create( SandboxConnectionCreateParams.builder() .providerId("provider_id") @@ -28,7 +29,7 @@ class ConnectionServiceTest { .addProduct("string") .build() ) - println(connectionCreateResponse) - connectionCreateResponse.validate() + + connection.validate() } } diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/sandbox/DirectoryServiceTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/sandbox/DirectoryServiceTest.kt index b236df8b..bd96b1f1 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/sandbox/DirectoryServiceTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/sandbox/DirectoryServiceTest.kt @@ -15,144 +15,134 @@ import org.junit.jupiter.api.extension.ExtendWith class DirectoryServiceTest { @Test - fun callCreate() { + fun create() { val client = FinchOkHttpClient.builder() .baseUrl(TestServerExtension.BASE_URL) .accessToken("My Access Token") .build() val directoryService = client.sandbox().directory() - val directoryCreateResponse = - directoryService.create( - SandboxDirectoryCreateParams.builder() - .addBody( - SandboxDirectoryCreateParams.IndividualOrEmployment.builder() - .classCode("class_code") - .addCustomField( - SandboxDirectoryCreateParams.IndividualOrEmployment.CustomField - .builder() - .name("name") - .value(JsonValue.from(mapOf())) - .build() - ) - .department( - SandboxDirectoryCreateParams.IndividualOrEmployment.Department - .builder() - .name("name") - .build() - ) - .dob("dob") - .addEmail( - SandboxDirectoryCreateParams.IndividualOrEmployment.Email.builder() - .data("data") - .type( - SandboxDirectoryCreateParams.IndividualOrEmployment.Email - .Type - .WORK - ) - .build() - ) - .employment( - SandboxDirectoryCreateParams.IndividualOrEmployment.Employment - .builder() - .subtype( - SandboxDirectoryCreateParams.IndividualOrEmployment - .Employment - .Subtype - .FULL_TIME - ) - .type( - SandboxDirectoryCreateParams.IndividualOrEmployment - .Employment - .Type - .EMPLOYEE - ) - .build() - ) - .employmentStatus( - SandboxDirectoryCreateParams.IndividualOrEmployment.EmploymentStatus - .ACTIVE - ) - .encryptedSsn("encrypted_ssn") - .endDate("end_date") - .ethnicity( - SandboxDirectoryCreateParams.IndividualOrEmployment.Ethnicity.ASIAN - ) - .firstName("first_name") - .gender( - SandboxDirectoryCreateParams.IndividualOrEmployment.Gender.FEMALE - ) - .income( - Income.builder() - .amount(0L) - .currency("currency") - .effectiveDate("effective_date") - .unit(Income.Unit.YEARLY) - .build() - ) - .addIncomeHistory( - Income.builder() - .amount(0L) - .currency("currency") - .effectiveDate("effective_date") - .unit(Income.Unit.YEARLY) - .build() - ) - .isActive(true) - .lastName("last_name") - .latestRehireDate("latest_rehire_date") - .location( - Location.builder() - .city("city") - .country("country") - .line1("line1") - .line2("line2") - .name("name") - .postalCode("postal_code") - .sourceId("source_id") - .state("state") - .build() - ) - .manager( - SandboxDirectoryCreateParams.IndividualOrEmployment.Manager - .builder() - .id("id") - .build() - ) - .middleName("middle_name") - .addPhoneNumber( - SandboxDirectoryCreateParams.IndividualOrEmployment.PhoneNumber - .builder() - .data("data") - .type( - SandboxDirectoryCreateParams.IndividualOrEmployment - .PhoneNumber - .Type - .WORK - ) - .build() - ) - .preferredName("preferred_name") - .residence( - Location.builder() - .city("city") - .country("country") - .line1("line1") - .line2("line2") - .name("name") - .postalCode("postal_code") - .sourceId("source_id") - .state("state") - .build() - ) - .sourceId("source_id") - .ssn("ssn") - .startDate("start_date") - .title("title") - .build() - ) - .build() - ) - println(directoryCreateResponse) + + directoryService.create( + SandboxDirectoryCreateParams.builder() + .addBody( + SandboxDirectoryCreateParams.IndividualOrEmployment.builder() + .classCode("class_code") + .addCustomField( + SandboxDirectoryCreateParams.IndividualOrEmployment.CustomField + .builder() + .name("name") + .value(JsonValue.from(mapOf())) + .build() + ) + .department( + SandboxDirectoryCreateParams.IndividualOrEmployment.Department.builder() + .name("name") + .build() + ) + .dob("dob") + .addEmail( + SandboxDirectoryCreateParams.IndividualOrEmployment.Email.builder() + .data("data") + .type( + SandboxDirectoryCreateParams.IndividualOrEmployment.Email.Type + .WORK + ) + .build() + ) + .employment( + SandboxDirectoryCreateParams.IndividualOrEmployment.Employment.builder() + .subtype( + SandboxDirectoryCreateParams.IndividualOrEmployment.Employment + .Subtype + .FULL_TIME + ) + .type( + SandboxDirectoryCreateParams.IndividualOrEmployment.Employment + .Type + .EMPLOYEE + ) + .build() + ) + .employmentStatus( + SandboxDirectoryCreateParams.IndividualOrEmployment.EmploymentStatus + .ACTIVE + ) + .encryptedSsn("encrypted_ssn") + .endDate("end_date") + .ethnicity( + SandboxDirectoryCreateParams.IndividualOrEmployment.Ethnicity.ASIAN + ) + .firstName("first_name") + .gender(SandboxDirectoryCreateParams.IndividualOrEmployment.Gender.FEMALE) + .income( + Income.builder() + .amount(0L) + .currency("currency") + .effectiveDate("effective_date") + .unit(Income.Unit.YEARLY) + .build() + ) + .addIncomeHistory( + Income.builder() + .amount(0L) + .currency("currency") + .effectiveDate("effective_date") + .unit(Income.Unit.YEARLY) + .build() + ) + .isActive(true) + .lastName("last_name") + .latestRehireDate("latest_rehire_date") + .location( + Location.builder() + .city("city") + .country("country") + .line1("line1") + .line2("line2") + .name("name") + .postalCode("postal_code") + .sourceId("source_id") + .state("state") + .build() + ) + .manager( + SandboxDirectoryCreateParams.IndividualOrEmployment.Manager.builder() + .id("id") + .build() + ) + .middleName("middle_name") + .addPhoneNumber( + SandboxDirectoryCreateParams.IndividualOrEmployment.PhoneNumber + .builder() + .data("data") + .type( + SandboxDirectoryCreateParams.IndividualOrEmployment.PhoneNumber + .Type + .WORK + ) + .build() + ) + .preferredName("preferred_name") + .residence( + Location.builder() + .city("city") + .country("country") + .line1("line1") + .line2("line2") + .name("name") + .postalCode("postal_code") + .sourceId("source_id") + .state("state") + .build() + ) + .sourceId("source_id") + .ssn("ssn") + .startDate("start_date") + .title("title") + .build() + ) + .build() + ) } } diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/sandbox/EmploymentServiceTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/sandbox/EmploymentServiceTest.kt index 0fbd8fd4..578cfb42 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/sandbox/EmploymentServiceTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/sandbox/EmploymentServiceTest.kt @@ -15,14 +15,15 @@ import org.junit.jupiter.api.extension.ExtendWith class EmploymentServiceTest { @Test - fun callUpdate() { + fun update() { val client = FinchOkHttpClient.builder() .baseUrl(TestServerExtension.BASE_URL) .accessToken("My Access Token") .build() val employmentService = client.sandbox().employment() - val employmentUpdateResponse = + + val employment = employmentService.update( SandboxEmploymentUpdateParams.builder() .individualId("individual_id") @@ -83,7 +84,7 @@ class EmploymentServiceTest { .title("title") .build() ) - println(employmentUpdateResponse) - employmentUpdateResponse.validate() + + employment.validate() } } diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/sandbox/IndividualServiceTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/sandbox/IndividualServiceTest.kt index f2aca632..6171b984 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/sandbox/IndividualServiceTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/sandbox/IndividualServiceTest.kt @@ -13,14 +13,15 @@ import org.junit.jupiter.api.extension.ExtendWith class IndividualServiceTest { @Test - fun callUpdate() { + fun update() { val client = FinchOkHttpClient.builder() .baseUrl(TestServerExtension.BASE_URL) .accessToken("My Access Token") .build() val individualService = client.sandbox().individual() - val individualUpdateResponse = + + val individual = individualService.update( SandboxIndividualUpdateParams.builder() .individualId("individual_id") @@ -59,7 +60,7 @@ class IndividualServiceTest { .ssn("ssn") .build() ) - println(individualUpdateResponse) - individualUpdateResponse.validate() + + individual.validate() } } diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/sandbox/JobServiceTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/sandbox/JobServiceTest.kt index c462ab1e..b196352b 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/sandbox/JobServiceTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/sandbox/JobServiceTest.kt @@ -12,20 +12,21 @@ import org.junit.jupiter.api.extension.ExtendWith class JobServiceTest { @Test - fun callCreate() { + fun create() { val client = FinchOkHttpClient.builder() .baseUrl(TestServerExtension.BASE_URL) .accessToken("My Access Token") .build() val jobService = client.sandbox().jobs() - val jobCreateResponse = + + val job = jobService.create( SandboxJobCreateParams.builder() .type(SandboxJobCreateParams.Type.DATA_SYNC_ALL) .build() ) - println(jobCreateResponse) - jobCreateResponse.validate() + + job.validate() } } diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/sandbox/PaymentServiceTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/sandbox/PaymentServiceTest.kt index a9a6c9e3..3d7751cd 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/sandbox/PaymentServiceTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/sandbox/PaymentServiceTest.kt @@ -15,14 +15,15 @@ import org.junit.jupiter.api.extension.ExtendWith class PaymentServiceTest { @Test - fun callCreate() { + fun create() { val client = FinchOkHttpClient.builder() .baseUrl(TestServerExtension.BASE_URL) .accessToken("My Access Token") .build() val paymentService = client.sandbox().payment() - val paymentCreateResponse = + + val payment = paymentService.create( SandboxPaymentCreateParams.builder() .endDate("end_date") @@ -32,16 +33,25 @@ class PaymentServiceTest { SandboxPaymentCreateParams.PayStatement.Earning.builder() .amount(0L) .attributes( - SandboxPaymentCreateParams.PayStatement.Earning.Metadata + SandboxPaymentCreateParams.PayStatement.Earning.Attributes .builder() .metadata( SandboxPaymentCreateParams.PayStatement.Earning + .Attributes .Metadata - .InnerMetadata .builder() - .putAdditionalProperty( - "foo", - JsonValue.from("bar"), + .metadata( + SandboxPaymentCreateParams.PayStatement + .Earning + .Attributes + .Metadata + .InnerMetadata + .builder() + .putAdditionalProperty( + "foo", + JsonValue.from("bar"), + ) + .build() ) .build() ) @@ -57,27 +67,36 @@ class PaymentServiceTest { ) .addEmployeeDeduction( SandboxPaymentCreateParams.PayStatement.EmployeeDeduction.builder() - .amount(0L) + .amount(2000L) .attributes( SandboxPaymentCreateParams.PayStatement.EmployeeDeduction - .Metadata + .Attributes .builder() .metadata( SandboxPaymentCreateParams.PayStatement .EmployeeDeduction + .Attributes .Metadata - .InnerMetadata .builder() - .putAdditionalProperty( - "foo", - JsonValue.from("bar"), + .metadata( + SandboxPaymentCreateParams.PayStatement + .EmployeeDeduction + .Attributes + .Metadata + .InnerMetadata + .builder() + .putAdditionalProperty( + "foo", + JsonValue.from("bar"), + ) + .build() ) .build() ) .build() ) - .currency("currency") - .name("name") + .currency("usd") + .name("401k test") .preTax(true) .type(BenefitType._401K) .build() @@ -88,17 +107,26 @@ class PaymentServiceTest { .amount(0L) .attributes( SandboxPaymentCreateParams.PayStatement.EmployerContribution - .Metadata + .Attributes .builder() .metadata( SandboxPaymentCreateParams.PayStatement .EmployerContribution + .Attributes .Metadata - .InnerMetadata .builder() - .putAdditionalProperty( - "foo", - JsonValue.from("bar"), + .metadata( + SandboxPaymentCreateParams.PayStatement + .EmployerContribution + .Attributes + .Metadata + .InnerMetadata + .builder() + .putAdditionalProperty( + "foo", + JsonValue.from("bar"), + ) + .build() ) .build() ) @@ -110,7 +138,7 @@ class PaymentServiceTest { .build() ) .grossPay(Money.builder().amount(0L).currency("currency").build()) - .individualId("individual_id") + .individualId("b2338cfb-472f-4f72-9faa-e028c083144a") .netPay(Money.builder().amount(0L).currency("currency").build()) .paymentMethod( SandboxPaymentCreateParams.PayStatement.PaymentMethod.CHECK @@ -119,15 +147,24 @@ class PaymentServiceTest { SandboxPaymentCreateParams.PayStatement.Tax.builder() .amount(0L) .attributes( - SandboxPaymentCreateParams.PayStatement.Tax.Metadata + SandboxPaymentCreateParams.PayStatement.Tax.Attributes .builder() .metadata( - SandboxPaymentCreateParams.PayStatement.Tax.Metadata - .InnerMetadata + SandboxPaymentCreateParams.PayStatement.Tax + .Attributes + .Metadata .builder() - .putAdditionalProperty( - "foo", - JsonValue.from("bar"), + .metadata( + SandboxPaymentCreateParams.PayStatement.Tax + .Attributes + .Metadata + .InnerMetadata + .builder() + .putAdditionalProperty( + "foo", + JsonValue.from("bar"), + ) + .build() ) .build() ) @@ -146,7 +183,7 @@ class PaymentServiceTest { .startDate("start_date") .build() ) - println(paymentCreateResponse) - paymentCreateResponse.validate() + + payment.validate() } } diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/sandbox/connections/AccountServiceTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/sandbox/connections/AccountServiceTest.kt index 9b1b064d..2b427d6c 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/sandbox/connections/AccountServiceTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/sandbox/connections/AccountServiceTest.kt @@ -14,14 +14,15 @@ import org.junit.jupiter.api.extension.ExtendWith class AccountServiceTest { @Test - fun callCreate() { + fun create() { val client = FinchOkHttpClient.builder() .baseUrl(TestServerExtension.BASE_URL) .accessToken("My Access Token") .build() val accountService = client.sandbox().connections().accounts() - val accountCreateResponse = + + val account = accountService.create( SandboxConnectionAccountCreateParams.builder() .companyId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") @@ -32,25 +33,26 @@ class AccountServiceTest { .addProduct("string") .build() ) - println(accountCreateResponse) - accountCreateResponse.validate() + + account.validate() } @Test - fun callUpdate() { + fun update() { val client = FinchOkHttpClient.builder() .baseUrl(TestServerExtension.BASE_URL) .accessToken("My Access Token") .build() val accountService = client.sandbox().connections().accounts() - val accountUpdateResponse = + + val account = accountService.update( SandboxConnectionAccountUpdateParams.builder() .connectionStatus(ConnectionStatusType.PENDING) .build() ) - println(accountUpdateResponse) - accountUpdateResponse.validate() + + account.validate() } } diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/sandbox/jobs/ConfigurationServiceTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/sandbox/jobs/ConfigurationServiceTest.kt index d7c74124..12e59369 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/sandbox/jobs/ConfigurationServiceTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/sandbox/jobs/ConfigurationServiceTest.kt @@ -5,7 +5,6 @@ package com.tryfinch.api.services.blocking.sandbox.jobs import com.tryfinch.api.TestServerExtension import com.tryfinch.api.client.okhttp.FinchOkHttpClient import com.tryfinch.api.models.SandboxJobConfiguration -import com.tryfinch.api.models.SandboxJobConfigurationRetrieveParams import com.tryfinch.api.models.SandboxJobConfigurationUpdateParams import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith @@ -14,29 +13,28 @@ import org.junit.jupiter.api.extension.ExtendWith class ConfigurationServiceTest { @Test - fun callRetrieve() { + fun retrieve() { val client = FinchOkHttpClient.builder() .baseUrl(TestServerExtension.BASE_URL) .accessToken("My Access Token") .build() val configurationService = client.sandbox().jobs().configuration() - val configurationRetrieveResponse = - configurationService.retrieve(SandboxJobConfigurationRetrieveParams.builder().build()) - println(configurationRetrieveResponse) - for (sandboxJobConfiguration: SandboxJobConfiguration in configurationRetrieveResponse) { - sandboxJobConfiguration.validate() - } + + val sandboxJobConfigurations = configurationService.retrieve() + + sandboxJobConfigurations.forEach { it.validate() } } @Test - fun callUpdate() { + fun update() { val client = FinchOkHttpClient.builder() .baseUrl(TestServerExtension.BASE_URL) .accessToken("My Access Token") .build() val configurationService = client.sandbox().jobs().configuration() + val sandboxJobConfiguration = configurationService.update( SandboxJobConfigurationUpdateParams.builder() @@ -48,7 +46,7 @@ class ConfigurationServiceTest { ) .build() ) - println(sandboxJobConfiguration) + sandboxJobConfiguration.validate() } }