Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .stats.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
configured_endpoints: 36
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/finch-15385b754979d87bd7e583f618870246e79d1430a761e5bcd653db78cfab4789.yml
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/finch-60f88b9ae0cedc03dd888b63ca8dec25658c87e6cc3493170114144ca9e070c9.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5406,6 +5406,8 @@ private constructor(
private val employeeTaxes: JsonField<Boolean>,
private val individualIds: JsonField<Boolean>,
private val payPeriod: JsonField<PayPeriod>,
private val payGroupIds: JsonField<Boolean>,
private val payFrequencies: JsonField<Boolean>,
private val additionalProperties: Map<String, JsonValue>,
) {

Expand Down Expand Up @@ -5442,6 +5444,12 @@ private constructor(
fun payPeriod(): Optional<PayPeriod> =
Optional.ofNullable(payPeriod.getNullable("pay_period"))

fun payGroupIds(): Optional<Boolean> =
Optional.ofNullable(payGroupIds.getNullable("pay_group_ids"))

fun payFrequencies(): Optional<Boolean> =
Optional.ofNullable(payFrequencies.getNullable("pay_frequencies"))

@JsonProperty("id") @ExcludeMissing fun _id() = id

@JsonProperty("pay_date") @ExcludeMissing fun _payDate() = payDate
Expand Down Expand Up @@ -5470,6 +5478,12 @@ private constructor(

@JsonProperty("pay_period") @ExcludeMissing fun _payPeriod() = payPeriod

@JsonProperty("pay_group_ids") @ExcludeMissing fun _payGroupIds() = payGroupIds

@JsonProperty("pay_frequencies")
@ExcludeMissing
fun _payFrequencies() = payFrequencies

@JsonAnyGetter
@ExcludeMissing
fun _additionalProperties(): Map<String, JsonValue> = additionalProperties
Expand All @@ -5486,6 +5500,8 @@ private constructor(
employeeTaxes()
individualIds()
payPeriod().map { it.validate() }
payGroupIds()
payFrequencies()
validated = true
}
}
Expand All @@ -5508,6 +5524,8 @@ private constructor(
this.employeeTaxes == other.employeeTaxes &&
this.individualIds == other.individualIds &&
this.payPeriod == other.payPeriod &&
this.payGroupIds == other.payGroupIds &&
this.payFrequencies == other.payFrequencies &&
this.additionalProperties == other.additionalProperties
}

Expand All @@ -5525,14 +5543,16 @@ private constructor(
employeeTaxes,
individualIds,
payPeriod,
payGroupIds,
payFrequencies,
additionalProperties,
)
}
return hashCode
}

override fun toString() =
"SupportedPaymentFields{id=$id, payDate=$payDate, debitDate=$debitDate, companyDebit=$companyDebit, grossPay=$grossPay, netPay=$netPay, employerTaxes=$employerTaxes, employeeTaxes=$employeeTaxes, individualIds=$individualIds, payPeriod=$payPeriod, additionalProperties=$additionalProperties}"
"SupportedPaymentFields{id=$id, payDate=$payDate, debitDate=$debitDate, companyDebit=$companyDebit, grossPay=$grossPay, netPay=$netPay, employerTaxes=$employerTaxes, employeeTaxes=$employeeTaxes, individualIds=$individualIds, payPeriod=$payPeriod, payGroupIds=$payGroupIds, payFrequencies=$payFrequencies, additionalProperties=$additionalProperties}"

companion object {

Expand All @@ -5551,6 +5571,8 @@ private constructor(
private var employeeTaxes: JsonField<Boolean> = JsonMissing.of()
private var individualIds: JsonField<Boolean> = JsonMissing.of()
private var payPeriod: JsonField<PayPeriod> = JsonMissing.of()
private var payGroupIds: JsonField<Boolean> = JsonMissing.of()
private var payFrequencies: JsonField<Boolean> = JsonMissing.of()
private var additionalProperties: MutableMap<String, JsonValue> =
mutableMapOf()

Expand All @@ -5566,6 +5588,8 @@ private constructor(
this.employeeTaxes = supportedPaymentFields.employeeTaxes
this.individualIds = supportedPaymentFields.individualIds
this.payPeriod = supportedPaymentFields.payPeriod
this.payGroupIds = supportedPaymentFields.payGroupIds
this.payFrequencies = supportedPaymentFields.payFrequencies
additionalProperties(supportedPaymentFields.additionalProperties)
}

Expand Down Expand Up @@ -5647,6 +5671,24 @@ private constructor(
this.payPeriod = payPeriod
}

fun payGroupIds(payGroupIds: Boolean) =
payGroupIds(JsonField.of(payGroupIds))

@JsonProperty("pay_group_ids")
@ExcludeMissing
fun payGroupIds(payGroupIds: JsonField<Boolean>) = apply {
this.payGroupIds = payGroupIds
}

fun payFrequencies(payFrequencies: Boolean) =
payFrequencies(JsonField.of(payFrequencies))

@JsonProperty("pay_frequencies")
@ExcludeMissing
fun payFrequencies(payFrequencies: JsonField<Boolean>) = apply {
this.payFrequencies = payFrequencies
}

fun additionalProperties(additionalProperties: Map<String, JsonValue>) =
apply {
this.additionalProperties.clear()
Expand Down Expand Up @@ -5674,6 +5716,8 @@ private constructor(
employeeTaxes,
individualIds,
payPeriod,
payGroupIds,
payFrequencies,
additionalProperties.toUnmodifiable(),
)
}
Expand Down
153 changes: 152 additions & 1 deletion finch-java-core/src/main/kotlin/com/tryfinch/api/models/Payment.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,17 @@ 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

Expand All @@ -29,6 +32,8 @@ private constructor(
private val employerTaxes: JsonField<Money>,
private val employeeTaxes: JsonField<Money>,
private val individualIds: JsonField<List<String>>,
private val payGroupIds: JsonField<List<String>>,
private val payFrequencies: JsonField<List<PayFrequency>>,
private val additionalProperties: Map<String, JsonValue>,
) {

Expand Down Expand Up @@ -63,6 +68,14 @@ private constructor(
fun individualIds(): Optional<List<String>> =
Optional.ofNullable(individualIds.getNullable("individual_ids"))

/** Array of the Finch id (uuidv4) of every pay group associated with this payment. */
fun payGroupIds(): Optional<List<String>> =
Optional.ofNullable(payGroupIds.getNullable("pay_group_ids"))

/** List of pay frequencies associated with this payment. */
fun payFrequencies(): Optional<List<PayFrequency>> =
Optional.ofNullable(payFrequencies.getNullable("pay_frequencies"))

/** The unique id for the payment. */
@JsonProperty("id") @ExcludeMissing fun _id() = id

Expand All @@ -86,6 +99,12 @@ private constructor(
/** Array of every individual on this payment. */
@JsonProperty("individual_ids") @ExcludeMissing fun _individualIds() = individualIds

/** Array of the Finch id (uuidv4) of every pay group associated with this payment. */
@JsonProperty("pay_group_ids") @ExcludeMissing fun _payGroupIds() = payGroupIds

/** List of pay frequencies associated with this payment. */
@JsonProperty("pay_frequencies") @ExcludeMissing fun _payFrequencies() = payFrequencies

@JsonAnyGetter
@ExcludeMissing
fun _additionalProperties(): Map<String, JsonValue> = additionalProperties
Expand All @@ -102,6 +121,8 @@ private constructor(
employerTaxes().map { it.validate() }
employeeTaxes().map { it.validate() }
individualIds()
payGroupIds()
payFrequencies()
validated = true
}
}
Expand All @@ -124,6 +145,8 @@ private constructor(
this.employerTaxes == other.employerTaxes &&
this.employeeTaxes == other.employeeTaxes &&
this.individualIds == other.individualIds &&
this.payGroupIds == other.payGroupIds &&
this.payFrequencies == other.payFrequencies &&
this.additionalProperties == other.additionalProperties
}

Expand All @@ -141,14 +164,16 @@ private constructor(
employerTaxes,
employeeTaxes,
individualIds,
payGroupIds,
payFrequencies,
additionalProperties,
)
}
return hashCode
}

override fun toString() =
"Payment{id=$id, payPeriod=$payPeriod, payDate=$payDate, debitDate=$debitDate, companyDebit=$companyDebit, grossPay=$grossPay, netPay=$netPay, employerTaxes=$employerTaxes, employeeTaxes=$employeeTaxes, individualIds=$individualIds, additionalProperties=$additionalProperties}"
"Payment{id=$id, payPeriod=$payPeriod, payDate=$payDate, debitDate=$debitDate, companyDebit=$companyDebit, grossPay=$grossPay, netPay=$netPay, employerTaxes=$employerTaxes, employeeTaxes=$employeeTaxes, individualIds=$individualIds, payGroupIds=$payGroupIds, payFrequencies=$payFrequencies, additionalProperties=$additionalProperties}"

companion object {

Expand All @@ -167,6 +192,8 @@ private constructor(
private var employerTaxes: JsonField<Money> = JsonMissing.of()
private var employeeTaxes: JsonField<Money> = JsonMissing.of()
private var individualIds: JsonField<List<String>> = JsonMissing.of()
private var payGroupIds: JsonField<List<String>> = JsonMissing.of()
private var payFrequencies: JsonField<List<PayFrequency>> = JsonMissing.of()
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()

@JvmSynthetic
Expand All @@ -181,6 +208,8 @@ private constructor(
this.employerTaxes = payment.employerTaxes
this.employeeTaxes = payment.employeeTaxes
this.individualIds = payment.individualIds
this.payGroupIds = payment.payGroupIds
this.payFrequencies = payment.payFrequencies
additionalProperties(payment.additionalProperties)
}

Expand Down Expand Up @@ -256,6 +285,27 @@ private constructor(
this.individualIds = individualIds
}

/** Array of the Finch id (uuidv4) of every pay group associated with this payment. */
fun payGroupIds(payGroupIds: List<String>) = payGroupIds(JsonField.of(payGroupIds))

/** Array of the Finch id (uuidv4) of every pay group associated with this payment. */
@JsonProperty("pay_group_ids")
@ExcludeMissing
fun payGroupIds(payGroupIds: JsonField<List<String>>) = apply {
this.payGroupIds = payGroupIds
}

/** List of pay frequencies associated with this payment. */
fun payFrequencies(payFrequencies: List<PayFrequency>) =
payFrequencies(JsonField.of(payFrequencies))

/** List of pay frequencies associated with this payment. */
@JsonProperty("pay_frequencies")
@ExcludeMissing
fun payFrequencies(payFrequencies: JsonField<List<PayFrequency>>) = apply {
this.payFrequencies = payFrequencies
}

fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
this.additionalProperties.clear()
this.additionalProperties.putAll(additionalProperties)
Expand All @@ -282,10 +332,111 @@ private constructor(
employerTaxes,
employeeTaxes,
individualIds.map { it.toUnmodifiable() },
payGroupIds.map { it.toUnmodifiable() },
payFrequencies.map { it.toUnmodifiable() },
additionalProperties.toUnmodifiable(),
)
}

class PayFrequency
@JsonCreator
private constructor(
private val value: JsonField<String>,
) : Enum {

@com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField<String> = value

override fun equals(other: Any?): Boolean {
if (this === other) {
return true
}

return other is PayFrequency && this.value == other.value
}

override fun hashCode() = value.hashCode()

override fun toString() = value.toString()

companion object {

@JvmField val ANNUALLY = PayFrequency(JsonField.of("annually"))

@JvmField val SEMI_ANNUALLY = PayFrequency(JsonField.of("semi_annually"))

@JvmField val QUARTERLY = PayFrequency(JsonField.of("quarterly"))

@JvmField val MONTHLY = PayFrequency(JsonField.of("monthly"))

@JvmField val SEMI_MONTHLY = PayFrequency(JsonField.of("semi_monthly"))

@JvmField val BI_WEEKLY = PayFrequency(JsonField.of("bi_weekly"))

@JvmField val WEEKLY = PayFrequency(JsonField.of("weekly"))

@JvmField val DAILY = PayFrequency(JsonField.of("daily"))

@JvmField val OTHER = PayFrequency(JsonField.of("other"))

@JvmStatic fun of(value: String) = PayFrequency(JsonField.of(value))
}

enum class Known {
ANNUALLY,
SEMI_ANNUALLY,
QUARTERLY,
MONTHLY,
SEMI_MONTHLY,
BI_WEEKLY,
WEEKLY,
DAILY,
OTHER,
}

enum class Value {
ANNUALLY,
SEMI_ANNUALLY,
QUARTERLY,
MONTHLY,
SEMI_MONTHLY,
BI_WEEKLY,
WEEKLY,
DAILY,
OTHER,
_UNKNOWN,
}

fun value(): Value =
when (this) {
ANNUALLY -> Value.ANNUALLY
SEMI_ANNUALLY -> Value.SEMI_ANNUALLY
QUARTERLY -> Value.QUARTERLY
MONTHLY -> Value.MONTHLY
SEMI_MONTHLY -> Value.SEMI_MONTHLY
BI_WEEKLY -> Value.BI_WEEKLY
WEEKLY -> Value.WEEKLY
DAILY -> Value.DAILY
OTHER -> Value.OTHER
else -> Value._UNKNOWN
}

fun known(): Known =
when (this) {
ANNUALLY -> Known.ANNUALLY
SEMI_ANNUALLY -> Known.SEMI_ANNUALLY
QUARTERLY -> Known.QUARTERLY
MONTHLY -> Known.MONTHLY
SEMI_MONTHLY -> Known.SEMI_MONTHLY
BI_WEEKLY -> Known.BI_WEEKLY
WEEKLY -> Known.WEEKLY
DAILY -> Known.DAILY
OTHER -> Known.OTHER
else -> throw FinchInvalidDataException("Unknown PayFrequency: $value")
}

fun asString(): String = _value().asStringOrThrow()
}

/** The pay period object. */
@JsonDeserialize(builder = PayPeriod.Builder::class)
@NoAutoDetect
Expand Down
Loading