com.tryfinch.api.models.SupportedBenefit.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 = SupportedBenefit.Builder::class)
@NoAutoDetect
class SupportedBenefit
private constructor(
private val type: JsonField,
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
/** Type of benefit. */
fun type(): Optional = Optional.ofNullable(type.getNullable("type"))
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"))
/** Type of benefit. */
@JsonProperty("type") @ExcludeMissing fun _type() = type
@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(): SupportedBenefit = apply {
if (!validated) {
type()
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 SupportedBenefit &&
this.type == other.type &&
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(
type,
description,
frequencies,
employeeDeduction,
companyContribution,
annualMaximum,
catchUp,
hsaContributionLimit,
additionalProperties,
)
}
return hashCode
}
override fun toString() =
"SupportedBenefit{type=$type, 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 type: JsonField = JsonMissing.of()
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(supportedBenefit: SupportedBenefit) = apply {
this.type = supportedBenefit.type
this.description = supportedBenefit.description
this.frequencies = supportedBenefit.frequencies
this.employeeDeduction = supportedBenefit.employeeDeduction
this.companyContribution = supportedBenefit.companyContribution
this.annualMaximum = supportedBenefit.annualMaximum
this.catchUp = supportedBenefit.catchUp
this.hsaContributionLimit = supportedBenefit.hsaContributionLimit
additionalProperties(supportedBenefit.additionalProperties)
}
/** Type of benefit. */
fun type(type: BenefitType) = type(JsonField.of(type))
/** Type of benefit. */
@JsonProperty("type")
@ExcludeMissing
fun type(type: JsonField) = apply { this.type = type }
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(): SupportedBenefit =
SupportedBenefit(
type,
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()
}
}