Skip to content

Commit 9507834

Browse files
feat(api): add limitCashAmount/limitCashCount fields to VelocityLimitParams
1 parent 39e4623 commit 9507834

3 files changed

Lines changed: 153 additions & 5 deletions

File tree

‎.stats.yml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 214
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/lithic/lithic-59c09c7355b21b663e001d2ee1086ebd0a70d9b5433823282bca296eedff9eb0.yml
3-
openapi_spec_hash: d9c3b932c810809abc6e973d662ad376
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/lithic/lithic-1d6c7b672aa49dfe0fe5175965307f63a0ed42c13697b2f9f3b9275f32331937.yml
3+
openapi_spec_hash: 06e73960c7506484c589d718fa1ddad8
44
config_hash: 337a99d8cc30006358b7bc2531401669

‎lithic-java-core/src/main/kotlin/com/lithic/api/models/VelocityLimitParams.kt‎

Lines changed: 145 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ private constructor(
2525
private val scope: JsonField<VelocityScope>,
2626
private val filters: JsonField<VelocityLimitFilters>,
2727
private val limitAmount: JsonField<Long>,
28+
private val limitCashAmount: JsonField<Long>,
29+
private val limitCashCount: JsonField<Long>,
2830
private val limitCount: JsonField<Long>,
2931
private val additionalProperties: MutableMap<String, JsonValue>,
3032
) {
@@ -41,8 +43,23 @@ private constructor(
4143
@JsonProperty("limit_amount")
4244
@ExcludeMissing
4345
limitAmount: JsonField<Long> = JsonMissing.of(),
46+
@JsonProperty("limit_cash_amount")
47+
@ExcludeMissing
48+
limitCashAmount: JsonField<Long> = JsonMissing.of(),
49+
@JsonProperty("limit_cash_count")
50+
@ExcludeMissing
51+
limitCashCount: JsonField<Long> = JsonMissing.of(),
4452
@JsonProperty("limit_count") @ExcludeMissing limitCount: JsonField<Long> = JsonMissing.of(),
45-
) : this(period, scope, filters, limitAmount, limitCount, mutableMapOf())
53+
) : this(
54+
period,
55+
scope,
56+
filters,
57+
limitAmount,
58+
limitCashAmount,
59+
limitCashCount,
60+
limitCount,
61+
mutableMapOf(),
62+
)
4663

4764
/**
4865
* Velocity over the current day since 00:00 / 12 AM in Eastern Time
@@ -75,6 +92,29 @@ private constructor(
7592
*/
7693
fun limitAmount(): Optional<Long> = limitAmount.getOptional("limit_amount")
7794

95+
/**
96+
* The maximum amount of cash spend velocity allowed in the period in minor units (the smallest
97+
* unit of a currency, e.g. cents for USD). Cash spend covers ATM withdrawals, cash
98+
* disbursements, and purchases with cashback. Transactions exceeding this limit will be
99+
* declined.
100+
*
101+
* @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the
102+
* server responded with an unexpected value).
103+
*/
104+
fun limitCashAmount(): Optional<Long> = limitCashAmount.getOptional("limit_cash_amount")
105+
106+
/**
107+
* The number of cash spend velocity impacting transactions may not exceed this limit in the
108+
* period. Transactions exceeding this limit will be declined. A cash velocity impacting
109+
* transaction is an ATM withdrawal, cash disbursement, or purchase with cashback that has been
110+
* authorized, and optionally settled, or a force post (a transaction that settled without prior
111+
* authorization).
112+
*
113+
* @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the
114+
* server responded with an unexpected value).
115+
*/
116+
fun limitCashCount(): Optional<Long> = limitCashCount.getOptional("limit_cash_count")
117+
78118
/**
79119
* The number of spend velocity impacting transactions may not exceed this limit in the period.
80120
* Transactions exceeding this limit will be declined. A spend velocity impacting transaction is
@@ -116,6 +156,24 @@ private constructor(
116156
*/
117157
@JsonProperty("limit_amount") @ExcludeMissing fun _limitAmount(): JsonField<Long> = limitAmount
118158

159+
/**
160+
* Returns the raw JSON value of [limitCashAmount].
161+
*
162+
* Unlike [limitCashAmount], this method doesn't throw if the JSON field has an unexpected type.
163+
*/
164+
@JsonProperty("limit_cash_amount")
165+
@ExcludeMissing
166+
fun _limitCashAmount(): JsonField<Long> = limitCashAmount
167+
168+
/**
169+
* Returns the raw JSON value of [limitCashCount].
170+
*
171+
* Unlike [limitCashCount], this method doesn't throw if the JSON field has an unexpected type.
172+
*/
173+
@JsonProperty("limit_cash_count")
174+
@ExcludeMissing
175+
fun _limitCashCount(): JsonField<Long> = limitCashCount
176+
119177
/**
120178
* Returns the raw JSON value of [limitCount].
121179
*
@@ -156,6 +214,8 @@ private constructor(
156214
private var scope: JsonField<VelocityScope>? = null
157215
private var filters: JsonField<VelocityLimitFilters> = JsonMissing.of()
158216
private var limitAmount: JsonField<Long> = JsonMissing.of()
217+
private var limitCashAmount: JsonField<Long> = JsonMissing.of()
218+
private var limitCashCount: JsonField<Long> = JsonMissing.of()
159219
private var limitCount: JsonField<Long> = JsonMissing.of()
160220
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()
161221

@@ -165,6 +225,8 @@ private constructor(
165225
scope = velocityLimitParams.scope
166226
filters = velocityLimitParams.filters
167227
limitAmount = velocityLimitParams.limitAmount
228+
limitCashAmount = velocityLimitParams.limitCashAmount
229+
limitCashCount = velocityLimitParams.limitCashCount
168230
limitCount = velocityLimitParams.limitCount
169231
additionalProperties = velocityLimitParams.additionalProperties.toMutableMap()
170232
}
@@ -262,6 +324,69 @@ private constructor(
262324
*/
263325
fun limitAmount(limitAmount: JsonField<Long>) = apply { this.limitAmount = limitAmount }
264326

327+
/**
328+
* The maximum amount of cash spend velocity allowed in the period in minor units (the
329+
* smallest unit of a currency, e.g. cents for USD). Cash spend covers ATM withdrawals, cash
330+
* disbursements, and purchases with cashback. Transactions exceeding this limit will be
331+
* declined.
332+
*/
333+
fun limitCashAmount(limitCashAmount: Long?) =
334+
limitCashAmount(JsonField.ofNullable(limitCashAmount))
335+
336+
/**
337+
* Alias for [Builder.limitCashAmount].
338+
*
339+
* This unboxed primitive overload exists for backwards compatibility.
340+
*/
341+
fun limitCashAmount(limitCashAmount: Long) = limitCashAmount(limitCashAmount as Long?)
342+
343+
/** Alias for calling [Builder.limitCashAmount] with `limitCashAmount.orElse(null)`. */
344+
fun limitCashAmount(limitCashAmount: Optional<Long>) =
345+
limitCashAmount(limitCashAmount.getOrNull())
346+
347+
/**
348+
* Sets [Builder.limitCashAmount] to an arbitrary JSON value.
349+
*
350+
* You should usually call [Builder.limitCashAmount] with a well-typed [Long] value instead.
351+
* This method is primarily for setting the field to an undocumented or not yet supported
352+
* value.
353+
*/
354+
fun limitCashAmount(limitCashAmount: JsonField<Long>) = apply {
355+
this.limitCashAmount = limitCashAmount
356+
}
357+
358+
/**
359+
* The number of cash spend velocity impacting transactions may not exceed this limit in the
360+
* period. Transactions exceeding this limit will be declined. A cash velocity impacting
361+
* transaction is an ATM withdrawal, cash disbursement, or purchase with cashback that has
362+
* been authorized, and optionally settled, or a force post (a transaction that settled
363+
* without prior authorization).
364+
*/
365+
fun limitCashCount(limitCashCount: Long?) =
366+
limitCashCount(JsonField.ofNullable(limitCashCount))
367+
368+
/**
369+
* Alias for [Builder.limitCashCount].
370+
*
371+
* This unboxed primitive overload exists for backwards compatibility.
372+
*/
373+
fun limitCashCount(limitCashCount: Long) = limitCashCount(limitCashCount as Long?)
374+
375+
/** Alias for calling [Builder.limitCashCount] with `limitCashCount.orElse(null)`. */
376+
fun limitCashCount(limitCashCount: Optional<Long>) =
377+
limitCashCount(limitCashCount.getOrNull())
378+
379+
/**
380+
* Sets [Builder.limitCashCount] to an arbitrary JSON value.
381+
*
382+
* You should usually call [Builder.limitCashCount] with a well-typed [Long] value instead.
383+
* This method is primarily for setting the field to an undocumented or not yet supported
384+
* value.
385+
*/
386+
fun limitCashCount(limitCashCount: JsonField<Long>) = apply {
387+
this.limitCashCount = limitCashCount
388+
}
389+
265390
/**
266391
* The number of spend velocity impacting transactions may not exceed this limit in the
267392
* period. Transactions exceeding this limit will be declined. A spend velocity impacting
@@ -326,6 +451,8 @@ private constructor(
326451
checkRequired("scope", scope),
327452
filters,
328453
limitAmount,
454+
limitCashAmount,
455+
limitCashCount,
329456
limitCount,
330457
additionalProperties.toMutableMap(),
331458
)
@@ -350,6 +477,8 @@ private constructor(
350477
scope().validate()
351478
filters().ifPresent { it.validate() }
352479
limitAmount()
480+
limitCashAmount()
481+
limitCashCount()
353482
limitCount()
354483
validated = true
355484
}
@@ -373,6 +502,8 @@ private constructor(
373502
(scope.asKnown().getOrNull()?.validity() ?: 0) +
374503
(filters.asKnown().getOrNull()?.validity() ?: 0) +
375504
(if (limitAmount.asKnown().isPresent) 1 else 0) +
505+
(if (limitCashAmount.asKnown().isPresent) 1 else 0) +
506+
(if (limitCashCount.asKnown().isPresent) 1 else 0) +
376507
(if (limitCount.asKnown().isPresent) 1 else 0)
377508

378509
/** The scope the velocity is calculated for */
@@ -524,16 +655,27 @@ private constructor(
524655
scope == other.scope &&
525656
filters == other.filters &&
526657
limitAmount == other.limitAmount &&
658+
limitCashAmount == other.limitCashAmount &&
659+
limitCashCount == other.limitCashCount &&
527660
limitCount == other.limitCount &&
528661
additionalProperties == other.additionalProperties
529662
}
530663

531664
private val hashCode: Int by lazy {
532-
Objects.hash(period, scope, filters, limitAmount, limitCount, additionalProperties)
665+
Objects.hash(
666+
period,
667+
scope,
668+
filters,
669+
limitAmount,
670+
limitCashAmount,
671+
limitCashCount,
672+
limitCount,
673+
additionalProperties,
674+
)
533675
}
534676

535677
override fun hashCode(): Int = hashCode
536678

537679
override fun toString() =
538-
"VelocityLimitParams{period=$period, scope=$scope, filters=$filters, limitAmount=$limitAmount, limitCount=$limitCount, additionalProperties=$additionalProperties}"
680+
"VelocityLimitParams{period=$period, scope=$scope, filters=$filters, limitAmount=$limitAmount, limitCashAmount=$limitCashAmount, limitCashCount=$limitCashCount, limitCount=$limitCount, additionalProperties=$additionalProperties}"
539681
}

‎lithic-java-core/src/test/kotlin/com/lithic/api/models/VelocityLimitParamsTest.kt‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ internal class VelocityLimitParamsTest {
3030
.build()
3131
)
3232
.limitAmount(10000L)
33+
.limitCashAmount(5000L)
34+
.limitCashCount(0L)
3335
.limitCount(0L)
3436
.build()
3537

@@ -54,6 +56,8 @@ internal class VelocityLimitParamsTest {
5456
.build()
5557
)
5658
assertThat(velocityLimitParams.limitAmount()).contains(10000L)
59+
assertThat(velocityLimitParams.limitCashAmount()).contains(5000L)
60+
assertThat(velocityLimitParams.limitCashCount()).contains(0L)
5761
assertThat(velocityLimitParams.limitCount()).contains(0L)
5862
}
5963

@@ -79,6 +83,8 @@ internal class VelocityLimitParamsTest {
7983
.build()
8084
)
8185
.limitAmount(10000L)
86+
.limitCashAmount(5000L)
87+
.limitCashCount(0L)
8288
.limitCount(0L)
8389
.build()
8490

0 commit comments

Comments
 (0)