Skip to content

Commit 805e19a

Browse files
feat(api): add 'payment frequencies' and 'pay group ids' to payment model (#262)
1 parent 09dd676 commit 805e19a

7 files changed

Lines changed: 252 additions & 6 deletions

File tree

.stats.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
configured_endpoints: 36
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/finch-15385b754979d87bd7e583f618870246e79d1430a761e5bcd653db78cfab4789.yml
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/finch-60f88b9ae0cedc03dd888b63ca8dec25658c87e6cc3493170114144ca9e070c9.yml

finch-java-core/src/main/kotlin/com/tryfinch/api/models/AccountUpdateEvent.kt

Lines changed: 45 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5406,6 +5406,8 @@ private constructor(
54065406
private val employeeTaxes: JsonField<Boolean>,
54075407
private val individualIds: JsonField<Boolean>,
54085408
private val payPeriod: JsonField<PayPeriod>,
5409+
private val payGroupIds: JsonField<Boolean>,
5410+
private val payFrequencies: JsonField<Boolean>,
54095411
private val additionalProperties: Map<String, JsonValue>,
54105412
) {
54115413

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

5447+
fun payGroupIds(): Optional<Boolean> =
5448+
Optional.ofNullable(payGroupIds.getNullable("pay_group_ids"))
5449+
5450+
fun payFrequencies(): Optional<Boolean> =
5451+
Optional.ofNullable(payFrequencies.getNullable("pay_frequencies"))
5452+
54455453
@JsonProperty("id") @ExcludeMissing fun _id() = id
54465454

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

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

5481+
@JsonProperty("pay_group_ids") @ExcludeMissing fun _payGroupIds() = payGroupIds
5482+
5483+
@JsonProperty("pay_frequencies")
5484+
@ExcludeMissing
5485+
fun _payFrequencies() = payFrequencies
5486+
54735487
@JsonAnyGetter
54745488
@ExcludeMissing
54755489
fun _additionalProperties(): Map<String, JsonValue> = additionalProperties
@@ -5486,6 +5500,8 @@ private constructor(
54865500
employeeTaxes()
54875501
individualIds()
54885502
payPeriod().map { it.validate() }
5503+
payGroupIds()
5504+
payFrequencies()
54895505
validated = true
54905506
}
54915507
}
@@ -5508,6 +5524,8 @@ private constructor(
55085524
this.employeeTaxes == other.employeeTaxes &&
55095525
this.individualIds == other.individualIds &&
55105526
this.payPeriod == other.payPeriod &&
5527+
this.payGroupIds == other.payGroupIds &&
5528+
this.payFrequencies == other.payFrequencies &&
55115529
this.additionalProperties == other.additionalProperties
55125530
}
55135531

@@ -5525,14 +5543,16 @@ private constructor(
55255543
employeeTaxes,
55265544
individualIds,
55275545
payPeriod,
5546+
payGroupIds,
5547+
payFrequencies,
55285548
additionalProperties,
55295549
)
55305550
}
55315551
return hashCode
55325552
}
55335553

55345554
override fun toString() =
5535-
"SupportedPaymentFields{id=$id, payDate=$payDate, debitDate=$debitDate, companyDebit=$companyDebit, grossPay=$grossPay, netPay=$netPay, employerTaxes=$employerTaxes, employeeTaxes=$employeeTaxes, individualIds=$individualIds, payPeriod=$payPeriod, additionalProperties=$additionalProperties}"
5555+
"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}"
55365556

55375557
companion object {
55385558

@@ -5551,6 +5571,8 @@ private constructor(
55515571
private var employeeTaxes: JsonField<Boolean> = JsonMissing.of()
55525572
private var individualIds: JsonField<Boolean> = JsonMissing.of()
55535573
private var payPeriod: JsonField<PayPeriod> = JsonMissing.of()
5574+
private var payGroupIds: JsonField<Boolean> = JsonMissing.of()
5575+
private var payFrequencies: JsonField<Boolean> = JsonMissing.of()
55545576
private var additionalProperties: MutableMap<String, JsonValue> =
55555577
mutableMapOf()
55565578

@@ -5566,6 +5588,8 @@ private constructor(
55665588
this.employeeTaxes = supportedPaymentFields.employeeTaxes
55675589
this.individualIds = supportedPaymentFields.individualIds
55685590
this.payPeriod = supportedPaymentFields.payPeriod
5591+
this.payGroupIds = supportedPaymentFields.payGroupIds
5592+
this.payFrequencies = supportedPaymentFields.payFrequencies
55695593
additionalProperties(supportedPaymentFields.additionalProperties)
55705594
}
55715595

@@ -5647,6 +5671,24 @@ private constructor(
56475671
this.payPeriod = payPeriod
56485672
}
56495673

5674+
fun payGroupIds(payGroupIds: Boolean) =
5675+
payGroupIds(JsonField.of(payGroupIds))
5676+
5677+
@JsonProperty("pay_group_ids")
5678+
@ExcludeMissing
5679+
fun payGroupIds(payGroupIds: JsonField<Boolean>) = apply {
5680+
this.payGroupIds = payGroupIds
5681+
}
5682+
5683+
fun payFrequencies(payFrequencies: Boolean) =
5684+
payFrequencies(JsonField.of(payFrequencies))
5685+
5686+
@JsonProperty("pay_frequencies")
5687+
@ExcludeMissing
5688+
fun payFrequencies(payFrequencies: JsonField<Boolean>) = apply {
5689+
this.payFrequencies = payFrequencies
5690+
}
5691+
56505692
fun additionalProperties(additionalProperties: Map<String, JsonValue>) =
56515693
apply {
56525694
this.additionalProperties.clear()
@@ -5674,6 +5716,8 @@ private constructor(
56745716
employeeTaxes,
56755717
individualIds,
56765718
payPeriod,
5719+
payGroupIds,
5720+
payFrequencies,
56775721
additionalProperties.toUnmodifiable(),
56785722
)
56795723
}

finch-java-core/src/main/kotlin/com/tryfinch/api/models/Payment.kt

Lines changed: 152 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,17 @@ package com.tryfinch.api.models
44

55
import com.fasterxml.jackson.annotation.JsonAnyGetter
66
import com.fasterxml.jackson.annotation.JsonAnySetter
7+
import com.fasterxml.jackson.annotation.JsonCreator
78
import com.fasterxml.jackson.annotation.JsonProperty
89
import com.fasterxml.jackson.databind.annotation.JsonDeserialize
10+
import com.tryfinch.api.core.Enum
911
import com.tryfinch.api.core.ExcludeMissing
1012
import com.tryfinch.api.core.JsonField
1113
import com.tryfinch.api.core.JsonMissing
1214
import com.tryfinch.api.core.JsonValue
1315
import com.tryfinch.api.core.NoAutoDetect
1416
import com.tryfinch.api.core.toUnmodifiable
17+
import com.tryfinch.api.errors.FinchInvalidDataException
1518
import java.util.Objects
1619
import java.util.Optional
1720

@@ -29,6 +32,8 @@ private constructor(
2932
private val employerTaxes: JsonField<Money>,
3033
private val employeeTaxes: JsonField<Money>,
3134
private val individualIds: JsonField<List<String>>,
35+
private val payGroupIds: JsonField<List<String>>,
36+
private val payFrequencies: JsonField<List<PayFrequency>>,
3237
private val additionalProperties: Map<String, JsonValue>,
3338
) {
3439

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

71+
/** Array of the Finch id (uuidv4) of every pay group associated with this payment. */
72+
fun payGroupIds(): Optional<List<String>> =
73+
Optional.ofNullable(payGroupIds.getNullable("pay_group_ids"))
74+
75+
/** List of pay frequencies associated with this payment. */
76+
fun payFrequencies(): Optional<List<PayFrequency>> =
77+
Optional.ofNullable(payFrequencies.getNullable("pay_frequencies"))
78+
6679
/** The unique id for the payment. */
6780
@JsonProperty("id") @ExcludeMissing fun _id() = id
6881

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

102+
/** Array of the Finch id (uuidv4) of every pay group associated with this payment. */
103+
@JsonProperty("pay_group_ids") @ExcludeMissing fun _payGroupIds() = payGroupIds
104+
105+
/** List of pay frequencies associated with this payment. */
106+
@JsonProperty("pay_frequencies") @ExcludeMissing fun _payFrequencies() = payFrequencies
107+
89108
@JsonAnyGetter
90109
@ExcludeMissing
91110
fun _additionalProperties(): Map<String, JsonValue> = additionalProperties
@@ -102,6 +121,8 @@ private constructor(
102121
employerTaxes().map { it.validate() }
103122
employeeTaxes().map { it.validate() }
104123
individualIds()
124+
payGroupIds()
125+
payFrequencies()
105126
validated = true
106127
}
107128
}
@@ -124,6 +145,8 @@ private constructor(
124145
this.employerTaxes == other.employerTaxes &&
125146
this.employeeTaxes == other.employeeTaxes &&
126147
this.individualIds == other.individualIds &&
148+
this.payGroupIds == other.payGroupIds &&
149+
this.payFrequencies == other.payFrequencies &&
127150
this.additionalProperties == other.additionalProperties
128151
}
129152

@@ -141,14 +164,16 @@ private constructor(
141164
employerTaxes,
142165
employeeTaxes,
143166
individualIds,
167+
payGroupIds,
168+
payFrequencies,
144169
additionalProperties,
145170
)
146171
}
147172
return hashCode
148173
}
149174

150175
override fun toString() =
151-
"Payment{id=$id, payPeriod=$payPeriod, payDate=$payDate, debitDate=$debitDate, companyDebit=$companyDebit, grossPay=$grossPay, netPay=$netPay, employerTaxes=$employerTaxes, employeeTaxes=$employeeTaxes, individualIds=$individualIds, additionalProperties=$additionalProperties}"
176+
"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}"
152177

153178
companion object {
154179

@@ -167,6 +192,8 @@ private constructor(
167192
private var employerTaxes: JsonField<Money> = JsonMissing.of()
168193
private var employeeTaxes: JsonField<Money> = JsonMissing.of()
169194
private var individualIds: JsonField<List<String>> = JsonMissing.of()
195+
private var payGroupIds: JsonField<List<String>> = JsonMissing.of()
196+
private var payFrequencies: JsonField<List<PayFrequency>> = JsonMissing.of()
170197
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()
171198

172199
@JvmSynthetic
@@ -181,6 +208,8 @@ private constructor(
181208
this.employerTaxes = payment.employerTaxes
182209
this.employeeTaxes = payment.employeeTaxes
183210
this.individualIds = payment.individualIds
211+
this.payGroupIds = payment.payGroupIds
212+
this.payFrequencies = payment.payFrequencies
184213
additionalProperties(payment.additionalProperties)
185214
}
186215

@@ -256,6 +285,27 @@ private constructor(
256285
this.individualIds = individualIds
257286
}
258287

288+
/** Array of the Finch id (uuidv4) of every pay group associated with this payment. */
289+
fun payGroupIds(payGroupIds: List<String>) = payGroupIds(JsonField.of(payGroupIds))
290+
291+
/** Array of the Finch id (uuidv4) of every pay group associated with this payment. */
292+
@JsonProperty("pay_group_ids")
293+
@ExcludeMissing
294+
fun payGroupIds(payGroupIds: JsonField<List<String>>) = apply {
295+
this.payGroupIds = payGroupIds
296+
}
297+
298+
/** List of pay frequencies associated with this payment. */
299+
fun payFrequencies(payFrequencies: List<PayFrequency>) =
300+
payFrequencies(JsonField.of(payFrequencies))
301+
302+
/** List of pay frequencies associated with this payment. */
303+
@JsonProperty("pay_frequencies")
304+
@ExcludeMissing
305+
fun payFrequencies(payFrequencies: JsonField<List<PayFrequency>>) = apply {
306+
this.payFrequencies = payFrequencies
307+
}
308+
259309
fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
260310
this.additionalProperties.clear()
261311
this.additionalProperties.putAll(additionalProperties)
@@ -282,10 +332,111 @@ private constructor(
282332
employerTaxes,
283333
employeeTaxes,
284334
individualIds.map { it.toUnmodifiable() },
335+
payGroupIds.map { it.toUnmodifiable() },
336+
payFrequencies.map { it.toUnmodifiable() },
285337
additionalProperties.toUnmodifiable(),
286338
)
287339
}
288340

341+
class PayFrequency
342+
@JsonCreator
343+
private constructor(
344+
private val value: JsonField<String>,
345+
) : Enum {
346+
347+
@com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField<String> = value
348+
349+
override fun equals(other: Any?): Boolean {
350+
if (this === other) {
351+
return true
352+
}
353+
354+
return other is PayFrequency && this.value == other.value
355+
}
356+
357+
override fun hashCode() = value.hashCode()
358+
359+
override fun toString() = value.toString()
360+
361+
companion object {
362+
363+
@JvmField val ANNUALLY = PayFrequency(JsonField.of("annually"))
364+
365+
@JvmField val SEMI_ANNUALLY = PayFrequency(JsonField.of("semi_annually"))
366+
367+
@JvmField val QUARTERLY = PayFrequency(JsonField.of("quarterly"))
368+
369+
@JvmField val MONTHLY = PayFrequency(JsonField.of("monthly"))
370+
371+
@JvmField val SEMI_MONTHLY = PayFrequency(JsonField.of("semi_monthly"))
372+
373+
@JvmField val BI_WEEKLY = PayFrequency(JsonField.of("bi_weekly"))
374+
375+
@JvmField val WEEKLY = PayFrequency(JsonField.of("weekly"))
376+
377+
@JvmField val DAILY = PayFrequency(JsonField.of("daily"))
378+
379+
@JvmField val OTHER = PayFrequency(JsonField.of("other"))
380+
381+
@JvmStatic fun of(value: String) = PayFrequency(JsonField.of(value))
382+
}
383+
384+
enum class Known {
385+
ANNUALLY,
386+
SEMI_ANNUALLY,
387+
QUARTERLY,
388+
MONTHLY,
389+
SEMI_MONTHLY,
390+
BI_WEEKLY,
391+
WEEKLY,
392+
DAILY,
393+
OTHER,
394+
}
395+
396+
enum class Value {
397+
ANNUALLY,
398+
SEMI_ANNUALLY,
399+
QUARTERLY,
400+
MONTHLY,
401+
SEMI_MONTHLY,
402+
BI_WEEKLY,
403+
WEEKLY,
404+
DAILY,
405+
OTHER,
406+
_UNKNOWN,
407+
}
408+
409+
fun value(): Value =
410+
when (this) {
411+
ANNUALLY -> Value.ANNUALLY
412+
SEMI_ANNUALLY -> Value.SEMI_ANNUALLY
413+
QUARTERLY -> Value.QUARTERLY
414+
MONTHLY -> Value.MONTHLY
415+
SEMI_MONTHLY -> Value.SEMI_MONTHLY
416+
BI_WEEKLY -> Value.BI_WEEKLY
417+
WEEKLY -> Value.WEEKLY
418+
DAILY -> Value.DAILY
419+
OTHER -> Value.OTHER
420+
else -> Value._UNKNOWN
421+
}
422+
423+
fun known(): Known =
424+
when (this) {
425+
ANNUALLY -> Known.ANNUALLY
426+
SEMI_ANNUALLY -> Known.SEMI_ANNUALLY
427+
QUARTERLY -> Known.QUARTERLY
428+
MONTHLY -> Known.MONTHLY
429+
SEMI_MONTHLY -> Known.SEMI_MONTHLY
430+
BI_WEEKLY -> Known.BI_WEEKLY
431+
WEEKLY -> Known.WEEKLY
432+
DAILY -> Known.DAILY
433+
OTHER -> Known.OTHER
434+
else -> throw FinchInvalidDataException("Unknown PayFrequency: $value")
435+
}
436+
437+
fun asString(): String = _value().asStringOrThrow()
438+
}
439+
289440
/** The pay period object. */
290441
@JsonDeserialize(builder = PayPeriod.Builder::class)
291442
@NoAutoDetect

0 commit comments

Comments
 (0)