com.tryfinch.api.models.BenefitFeaturesAndOperations.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of finch-java-core Show documentation
Show all versions of finch-java-core Show documentation
The Finch HRIS API provides a unified way to connect to a multitide of HRIS
systems. The API requires an access token issued by Finch.
By default, Organization and Payroll requests use Finch's
[Data Syncs](/developer-resources/Data-Syncs). If a request is made before the
initial sync has completed, Finch will request data live from the provider. The
latency on live requests may range from seconds to minutes depending on the
provider and batch size. For automated integrations, Deductions requests (both
read and write) are always made live to the provider. Latencies may range from
seconds to minutes depending on the provider and batch size.
Employer products are specified by the product parameter, a space-separated list
of products that your application requests from an employer authenticating
through Finch Connect. Valid product names are—
- `company`: Read basic company data
- `directory`: Read company directory and organization structure
- `individual`: Read individual data, excluding income and employment data
- `employment`: Read individual employment and income data
- `payment`: Read payroll and contractor related payments by the company
- `pay_statement`: Read detailed pay statements for each individual
- `benefits`: Create and manage deductions and contributions and enrollment for
an employer
[![Open in Postman](https://run.pstmn.io/button.svg)](https://god.gw.postman.com/run-collection/21027137-08db0929-883d-4094-a9ce-dbf5a9bee4a4?action=collection%2Ffork&collection-url=entityId%3D21027137-08db0929-883d-4094-a9ce-dbf5a9bee4a4%26entityType%3Dcollection%26workspaceId%3D1edf19bc-e0a8-41e9-ac55-481a4b50790b)
// File generated from our OpenAPI spec by Stainless.
package com.tryfinch.api.models
import com.fasterxml.jackson.annotation.JsonAnyGetter
import com.fasterxml.jackson.annotation.JsonAnySetter
import com.fasterxml.jackson.annotation.JsonCreator
import com.fasterxml.jackson.annotation.JsonProperty
import com.fasterxml.jackson.databind.annotation.JsonDeserialize
import com.tryfinch.api.core.Enum
import com.tryfinch.api.core.ExcludeMissing
import com.tryfinch.api.core.JsonField
import com.tryfinch.api.core.JsonMissing
import com.tryfinch.api.core.JsonValue
import com.tryfinch.api.core.NoAutoDetect
import com.tryfinch.api.core.toUnmodifiable
import com.tryfinch.api.errors.FinchInvalidDataException
import java.util.Objects
import java.util.Optional
@JsonDeserialize(builder = BenefitFeaturesAndOperations.Builder::class)
@NoAutoDetect
class BenefitFeaturesAndOperations
private constructor(
private val supportedFeatures: JsonField,
private val supportedOperations: JsonField,
private val additionalProperties: Map,
) {
private var validated: Boolean = false
private var hashCode: Int = 0
fun supportedFeatures(): Optional =
Optional.ofNullable(supportedFeatures.getNullable("supported_features"))
fun supportedOperations(): Optional =
Optional.ofNullable(supportedOperations.getNullable("supported_operations"))
@JsonProperty("supported_features") @ExcludeMissing fun _supportedFeatures() = supportedFeatures
@JsonProperty("supported_operations")
@ExcludeMissing
fun _supportedOperations() = supportedOperations
@JsonAnyGetter
@ExcludeMissing
fun _additionalProperties(): Map = additionalProperties
fun validate(): BenefitFeaturesAndOperations = apply {
if (!validated) {
supportedFeatures().map { it.validate() }
supportedOperations().map { it.validate() }
validated = true
}
}
fun toBuilder() = Builder().from(this)
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
}
return other is BenefitFeaturesAndOperations &&
this.supportedFeatures == other.supportedFeatures &&
this.supportedOperations == other.supportedOperations &&
this.additionalProperties == other.additionalProperties
}
override fun hashCode(): Int {
if (hashCode == 0) {
hashCode =
Objects.hash(
supportedFeatures,
supportedOperations,
additionalProperties,
)
}
return hashCode
}
override fun toString() =
"BenefitFeaturesAndOperations{supportedFeatures=$supportedFeatures, supportedOperations=$supportedOperations, additionalProperties=$additionalProperties}"
companion object {
@JvmStatic fun builder() = Builder()
}
class Builder {
private var supportedFeatures: JsonField = JsonMissing.of()
private var supportedOperations: JsonField = JsonMissing.of()
private var additionalProperties: MutableMap = mutableMapOf()
@JvmSynthetic
internal fun from(benefitFeaturesAndOperations: BenefitFeaturesAndOperations) = apply {
this.supportedFeatures = benefitFeaturesAndOperations.supportedFeatures
this.supportedOperations = benefitFeaturesAndOperations.supportedOperations
additionalProperties(benefitFeaturesAndOperations.additionalProperties)
}
fun supportedFeatures(supportedFeatures: BenefitFeature) =
supportedFeatures(JsonField.of(supportedFeatures))
@JsonProperty("supported_features")
@ExcludeMissing
fun supportedFeatures(supportedFeatures: JsonField) = apply {
this.supportedFeatures = supportedFeatures
}
fun supportedOperations(supportedOperations: SupportPerBenefitType) =
supportedOperations(JsonField.of(supportedOperations))
@JsonProperty("supported_operations")
@ExcludeMissing
fun supportedOperations(supportedOperations: JsonField) = apply {
this.supportedOperations = supportedOperations
}
fun additionalProperties(additionalProperties: Map) = apply {
this.additionalProperties.clear()
this.additionalProperties.putAll(additionalProperties)
}
@JsonAnySetter
fun putAdditionalProperty(key: String, value: JsonValue) = apply {
this.additionalProperties.put(key, value)
}
fun putAllAdditionalProperties(additionalProperties: Map) = apply {
this.additionalProperties.putAll(additionalProperties)
}
fun build(): BenefitFeaturesAndOperations =
BenefitFeaturesAndOperations(
supportedFeatures,
supportedOperations,
additionalProperties.toUnmodifiable(),
)
}
@JsonDeserialize(builder = BenefitFeature.Builder::class)
@NoAutoDetect
class BenefitFeature
private constructor(
private val description: JsonField,
private val frequencies: JsonField>,
private val employeeDeduction: JsonField>,
private val companyContribution: JsonField>,
private val annualMaximum: JsonField,
private val catchUp: JsonField,
private val hsaContributionLimit: JsonField>,
private val additionalProperties: Map,
) {
private var validated: Boolean = false
private var hashCode: Int = 0
fun description(): Optional =
Optional.ofNullable(description.getNullable("description"))
/** The list of frequencies supported by the provider for this benefit */
fun frequencies(): Optional> =
Optional.ofNullable(frequencies.getNullable("frequencies"))
/** Supported deduction types. An empty array indicates deductions are not supported. */
fun employeeDeduction(): Optional> =
Optional.ofNullable(employeeDeduction.getNullable("employee_deduction"))
/**
* Supported contribution types. An empty array indicates contributions are not supported.
*/
fun companyContribution(): Optional> =
Optional.ofNullable(companyContribution.getNullable("company_contribution"))
/** Whether the provider supports an annual maximum for this benefit. */
fun annualMaximum(): Optional =
Optional.ofNullable(annualMaximum.getNullable("annual_maximum"))
/**
* Whether the provider supports catch up for this benefit. This field will only be true for
* retirement benefits.
*/
fun catchUp(): Optional = Optional.ofNullable(catchUp.getNullable("catch_up"))
/**
* Whether the provider supports HSA contribution limits. Empty if this feature is not
* supported for the benefit. This array only has values for HSA benefits.
*/
fun hsaContributionLimit(): Optional> =
Optional.ofNullable(hsaContributionLimit.getNullable("hsa_contribution_limit"))
@JsonProperty("description") @ExcludeMissing fun _description() = description
/** The list of frequencies supported by the provider for this benefit */
@JsonProperty("frequencies") @ExcludeMissing fun _frequencies() = frequencies
/** Supported deduction types. An empty array indicates deductions are not supported. */
@JsonProperty("employee_deduction")
@ExcludeMissing
fun _employeeDeduction() = employeeDeduction
/**
* Supported contribution types. An empty array indicates contributions are not supported.
*/
@JsonProperty("company_contribution")
@ExcludeMissing
fun _companyContribution() = companyContribution
/** Whether the provider supports an annual maximum for this benefit. */
@JsonProperty("annual_maximum") @ExcludeMissing fun _annualMaximum() = annualMaximum
/**
* Whether the provider supports catch up for this benefit. This field will only be true for
* retirement benefits.
*/
@JsonProperty("catch_up") @ExcludeMissing fun _catchUp() = catchUp
/**
* Whether the provider supports HSA contribution limits. Empty if this feature is not
* supported for the benefit. This array only has values for HSA benefits.
*/
@JsonProperty("hsa_contribution_limit")
@ExcludeMissing
fun _hsaContributionLimit() = hsaContributionLimit
@JsonAnyGetter
@ExcludeMissing
fun _additionalProperties(): Map = additionalProperties
fun validate(): BenefitFeature = apply {
if (!validated) {
description()
frequencies()
employeeDeduction()
companyContribution()
annualMaximum()
catchUp()
hsaContributionLimit()
validated = true
}
}
fun toBuilder() = Builder().from(this)
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
}
return other is BenefitFeature &&
this.description == other.description &&
this.frequencies == other.frequencies &&
this.employeeDeduction == other.employeeDeduction &&
this.companyContribution == other.companyContribution &&
this.annualMaximum == other.annualMaximum &&
this.catchUp == other.catchUp &&
this.hsaContributionLimit == other.hsaContributionLimit &&
this.additionalProperties == other.additionalProperties
}
override fun hashCode(): Int {
if (hashCode == 0) {
hashCode =
Objects.hash(
description,
frequencies,
employeeDeduction,
companyContribution,
annualMaximum,
catchUp,
hsaContributionLimit,
additionalProperties,
)
}
return hashCode
}
override fun toString() =
"BenefitFeature{description=$description, frequencies=$frequencies, employeeDeduction=$employeeDeduction, companyContribution=$companyContribution, annualMaximum=$annualMaximum, catchUp=$catchUp, hsaContributionLimit=$hsaContributionLimit, additionalProperties=$additionalProperties}"
companion object {
@JvmStatic fun builder() = Builder()
}
class Builder {
private var description: JsonField = JsonMissing.of()
private var frequencies: JsonField> = JsonMissing.of()
private var employeeDeduction: JsonField> = JsonMissing.of()
private var companyContribution: JsonField> =
JsonMissing.of()
private var annualMaximum: JsonField = JsonMissing.of()
private var catchUp: JsonField = JsonMissing.of()
private var hsaContributionLimit: JsonField> =
JsonMissing.of()
private var additionalProperties: MutableMap = mutableMapOf()
@JvmSynthetic
internal fun from(benefitFeature: BenefitFeature) = apply {
this.description = benefitFeature.description
this.frequencies = benefitFeature.frequencies
this.employeeDeduction = benefitFeature.employeeDeduction
this.companyContribution = benefitFeature.companyContribution
this.annualMaximum = benefitFeature.annualMaximum
this.catchUp = benefitFeature.catchUp
this.hsaContributionLimit = benefitFeature.hsaContributionLimit
additionalProperties(benefitFeature.additionalProperties)
}
fun description(description: String) = description(JsonField.of(description))
@JsonProperty("description")
@ExcludeMissing
fun description(description: JsonField) = apply {
this.description = description
}
/** The list of frequencies supported by the provider for this benefit */
fun frequencies(frequencies: List) =
frequencies(JsonField.of(frequencies))
/** The list of frequencies supported by the provider for this benefit */
@JsonProperty("frequencies")
@ExcludeMissing
fun frequencies(frequencies: JsonField>) = apply {
this.frequencies = frequencies
}
/** Supported deduction types. An empty array indicates deductions are not supported. */
fun employeeDeduction(employeeDeduction: List) =
employeeDeduction(JsonField.of(employeeDeduction))
/** Supported deduction types. An empty array indicates deductions are not supported. */
@JsonProperty("employee_deduction")
@ExcludeMissing
fun employeeDeduction(employeeDeduction: JsonField>) = apply {
this.employeeDeduction = employeeDeduction
}
/**
* Supported contribution types. An empty array indicates contributions are not
* supported.
*/
fun companyContribution(companyContribution: List) =
companyContribution(JsonField.of(companyContribution))
/**
* Supported contribution types. An empty array indicates contributions are not
* supported.
*/
@JsonProperty("company_contribution")
@ExcludeMissing
fun companyContribution(companyContribution: JsonField>) =
apply {
this.companyContribution = companyContribution
}
/** Whether the provider supports an annual maximum for this benefit. */
fun annualMaximum(annualMaximum: Boolean) = annualMaximum(JsonField.of(annualMaximum))
/** Whether the provider supports an annual maximum for this benefit. */
@JsonProperty("annual_maximum")
@ExcludeMissing
fun annualMaximum(annualMaximum: JsonField) = apply {
this.annualMaximum = annualMaximum
}
/**
* Whether the provider supports catch up for this benefit. This field will only be true
* for retirement benefits.
*/
fun catchUp(catchUp: Boolean) = catchUp(JsonField.of(catchUp))
/**
* Whether the provider supports catch up for this benefit. This field will only be true
* for retirement benefits.
*/
@JsonProperty("catch_up")
@ExcludeMissing
fun catchUp(catchUp: JsonField) = apply { this.catchUp = catchUp }
/**
* Whether the provider supports HSA contribution limits. Empty if this feature is not
* supported for the benefit. This array only has values for HSA benefits.
*/
fun hsaContributionLimit(hsaContributionLimit: List) =
hsaContributionLimit(JsonField.of(hsaContributionLimit))
/**
* Whether the provider supports HSA contribution limits. Empty if this feature is not
* supported for the benefit. This array only has values for HSA benefits.
*/
@JsonProperty("hsa_contribution_limit")
@ExcludeMissing
fun hsaContributionLimit(hsaContributionLimit: JsonField>) =
apply {
this.hsaContributionLimit = hsaContributionLimit
}
fun additionalProperties(additionalProperties: Map) = apply {
this.additionalProperties.clear()
this.additionalProperties.putAll(additionalProperties)
}
@JsonAnySetter
fun putAdditionalProperty(key: String, value: JsonValue) = apply {
this.additionalProperties.put(key, value)
}
fun putAllAdditionalProperties(additionalProperties: Map) = apply {
this.additionalProperties.putAll(additionalProperties)
}
fun build(): BenefitFeature =
BenefitFeature(
description,
frequencies.map { it.toUnmodifiable() },
employeeDeduction.map { it.toUnmodifiable() },
companyContribution.map { it.toUnmodifiable() },
annualMaximum,
catchUp,
hsaContributionLimit.map { it.toUnmodifiable() },
additionalProperties.toUnmodifiable(),
)
}
class CompanyContribution
@JsonCreator
private constructor(
private val value: JsonField,
) : Enum {
@com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
}
return other is CompanyContribution && this.value == other.value
}
override fun hashCode() = value.hashCode()
override fun toString() = value.toString()
companion object {
@JvmField val FIXED = CompanyContribution(JsonField.of("fixed"))
@JvmField val PERCENT = CompanyContribution(JsonField.of("percent"))
@JvmStatic fun of(value: String) = CompanyContribution(JsonField.of(value))
}
enum class Known {
FIXED,
PERCENT,
}
enum class Value {
FIXED,
PERCENT,
_UNKNOWN,
}
fun value(): Value =
when (this) {
FIXED -> Value.FIXED
PERCENT -> Value.PERCENT
else -> Value._UNKNOWN
}
fun known(): Known =
when (this) {
FIXED -> Known.FIXED
PERCENT -> Known.PERCENT
else -> throw FinchInvalidDataException("Unknown CompanyContribution: $value")
}
fun asString(): String = _value().asStringOrThrow()
}
class EmployeeDeduction
@JsonCreator
private constructor(
private val value: JsonField,
) : Enum {
@com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
}
return other is EmployeeDeduction && this.value == other.value
}
override fun hashCode() = value.hashCode()
override fun toString() = value.toString()
companion object {
@JvmField val FIXED = EmployeeDeduction(JsonField.of("fixed"))
@JvmField val PERCENT = EmployeeDeduction(JsonField.of("percent"))
@JvmStatic fun of(value: String) = EmployeeDeduction(JsonField.of(value))
}
enum class Known {
FIXED,
PERCENT,
}
enum class Value {
FIXED,
PERCENT,
_UNKNOWN,
}
fun value(): Value =
when (this) {
FIXED -> Value.FIXED
PERCENT -> Value.PERCENT
else -> Value._UNKNOWN
}
fun known(): Known =
when (this) {
FIXED -> Known.FIXED
PERCENT -> Known.PERCENT
else -> throw FinchInvalidDataException("Unknown EmployeeDeduction: $value")
}
fun asString(): String = _value().asStringOrThrow()
}
class HsaContributionLimit
@JsonCreator
private constructor(
private val value: JsonField,
) : Enum {
@com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
}
return other is HsaContributionLimit && this.value == other.value
}
override fun hashCode() = value.hashCode()
override fun toString() = value.toString()
companion object {
@JvmField val INDIVIDUAL = HsaContributionLimit(JsonField.of("individual"))
@JvmField val FAMILY = HsaContributionLimit(JsonField.of("family"))
@JvmStatic fun of(value: String) = HsaContributionLimit(JsonField.of(value))
}
enum class Known {
INDIVIDUAL,
FAMILY,
}
enum class Value {
INDIVIDUAL,
FAMILY,
_UNKNOWN,
}
fun value(): Value =
when (this) {
INDIVIDUAL -> Value.INDIVIDUAL
FAMILY -> Value.FAMILY
else -> Value._UNKNOWN
}
fun known(): Known =
when (this) {
INDIVIDUAL -> Known.INDIVIDUAL
FAMILY -> Known.FAMILY
else -> throw FinchInvalidDataException("Unknown HsaContributionLimit: $value")
}
fun asString(): String = _value().asStringOrThrow()
}
}
}