Skip to content

Commit f1d019d

Browse files
feat(api): adds new merchant lock Auth Rule
- Add `SERVICE` as a new Financial Transaction event type - Add `scope` query parameter when retrieving AuthRules
1 parent 4063f5f commit f1d019d

20 files changed

+8908
-50
lines changed

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 157
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/lithic%2Flithic-569e7dcb415398515370989172038db711642cd3b0bd7559bfd2b94e325a6086.yml
3-
openapi_spec_hash: ce1dae8c6eb50d4490e75357c5e520a7
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/lithic%2Flithic-d44845cfc597e545a51450a62b2185d7a1ce76a3f9ac71145c3e74f99397d42a.yml
3+
openapi_spec_hash: 3339f9fd912f2eb8ba5efc3c73f5d030
44
config_hash: e9de93b19060a153a852f7c03f235162

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

Lines changed: 1503 additions & 9 deletions
Large diffs are not rendered by default.

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

Lines changed: 483 additions & 2 deletions
Large diffs are not rendered by default.

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

Lines changed: 153 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,13 @@
22

33
package com.lithic.api.models
44

5+
import com.fasterxml.jackson.annotation.JsonCreator
6+
import com.lithic.api.core.Enum
7+
import com.lithic.api.core.JsonField
58
import com.lithic.api.core.Params
69
import com.lithic.api.core.http.Headers
710
import com.lithic.api.core.http.QueryParams
11+
import com.lithic.api.errors.LithicInvalidDataException
812
import java.util.Objects
913
import java.util.Optional
1014
import kotlin.jvm.optionals.getOrNull
@@ -16,6 +20,7 @@ private constructor(
1620
private val cardToken: String?,
1721
private val endingBefore: String?,
1822
private val pageSize: Long?,
23+
private val scope: Scope?,
1924
private val startingAfter: String?,
2025
private val additionalHeaders: Headers,
2126
private val additionalQueryParams: QueryParams,
@@ -36,6 +41,9 @@ private constructor(
3641
/** Page size (for pagination). */
3742
fun pageSize(): Optional<Long> = Optional.ofNullable(pageSize)
3843

44+
/** Only return Authorization Rules that are bound to the provided scope; */
45+
fun scope(): Optional<Scope> = Optional.ofNullable(scope)
46+
3947
/**
4048
* A cursor representing an item's token after which a page of results should begin. Used to
4149
* retrieve the next page of results after this item.
@@ -63,6 +71,7 @@ private constructor(
6371
private var cardToken: String? = null
6472
private var endingBefore: String? = null
6573
private var pageSize: Long? = null
74+
private var scope: Scope? = null
6675
private var startingAfter: String? = null
6776
private var additionalHeaders: Headers.Builder = Headers.builder()
6877
private var additionalQueryParams: QueryParams.Builder = QueryParams.builder()
@@ -73,6 +82,7 @@ private constructor(
7382
cardToken = authRuleV2ListParams.cardToken
7483
endingBefore = authRuleV2ListParams.endingBefore
7584
pageSize = authRuleV2ListParams.pageSize
85+
scope = authRuleV2ListParams.scope
7686
startingAfter = authRuleV2ListParams.startingAfter
7787
additionalHeaders = authRuleV2ListParams.additionalHeaders.toBuilder()
7888
additionalQueryParams = authRuleV2ListParams.additionalQueryParams.toBuilder()
@@ -112,6 +122,12 @@ private constructor(
112122
/** Alias for calling [Builder.pageSize] with `pageSize.orElse(null)`. */
113123
fun pageSize(pageSize: Optional<Long>) = pageSize(pageSize.getOrNull())
114124

125+
/** Only return Authorization Rules that are bound to the provided scope; */
126+
fun scope(scope: Scope?) = apply { this.scope = scope }
127+
128+
/** Alias for calling [Builder.scope] with `scope.orElse(null)`. */
129+
fun scope(scope: Optional<Scope>) = scope(scope.getOrNull())
130+
115131
/**
116132
* A cursor representing an item's token after which a page of results should begin. Used to
117133
* retrieve the next page of results after this item.
@@ -231,6 +247,7 @@ private constructor(
231247
cardToken,
232248
endingBefore,
233249
pageSize,
250+
scope,
234251
startingAfter,
235252
additionalHeaders.build(),
236253
additionalQueryParams.build(),
@@ -246,21 +263,154 @@ private constructor(
246263
cardToken?.let { put("card_token", it) }
247264
endingBefore?.let { put("ending_before", it) }
248265
pageSize?.let { put("page_size", it.toString()) }
266+
scope?.let { put("scope", it.toString()) }
249267
startingAfter?.let { put("starting_after", it) }
250268
putAll(additionalQueryParams)
251269
}
252270
.build()
253271

272+
/** Only return Authorization Rules that are bound to the provided scope; */
273+
class Scope @JsonCreator private constructor(private val value: JsonField<String>) : Enum {
274+
275+
/**
276+
* Returns this class instance's raw value.
277+
*
278+
* This is usually only useful if this instance was deserialized from data that doesn't
279+
* match any known member, and you want to know that value. For example, if the SDK is on an
280+
* older version than the API, then the API may respond with new members that the SDK is
281+
* unaware of.
282+
*/
283+
@com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField<String> = value
284+
285+
companion object {
286+
287+
@JvmField val PROGRAM = of("PROGRAM")
288+
289+
@JvmField val ACCOUNT = of("ACCOUNT")
290+
291+
@JvmField val CARD = of("CARD")
292+
293+
@JvmStatic fun of(value: String) = Scope(JsonField.of(value))
294+
}
295+
296+
/** An enum containing [Scope]'s known values. */
297+
enum class Known {
298+
PROGRAM,
299+
ACCOUNT,
300+
CARD,
301+
}
302+
303+
/**
304+
* An enum containing [Scope]'s known values, as well as an [_UNKNOWN] member.
305+
*
306+
* An instance of [Scope] can contain an unknown value in a couple of cases:
307+
* - It was deserialized from data that doesn't match any known member. For example, if the
308+
* SDK is on an older version than the API, then the API may respond with new members that
309+
* the SDK is unaware of.
310+
* - It was constructed with an arbitrary value using the [of] method.
311+
*/
312+
enum class Value {
313+
PROGRAM,
314+
ACCOUNT,
315+
CARD,
316+
/** An enum member indicating that [Scope] was instantiated with an unknown value. */
317+
_UNKNOWN,
318+
}
319+
320+
/**
321+
* Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN]
322+
* if the class was instantiated with an unknown value.
323+
*
324+
* Use the [known] method instead if you're certain the value is always known or if you want
325+
* to throw for the unknown case.
326+
*/
327+
fun value(): Value =
328+
when (this) {
329+
PROGRAM -> Value.PROGRAM
330+
ACCOUNT -> Value.ACCOUNT
331+
CARD -> Value.CARD
332+
else -> Value._UNKNOWN
333+
}
334+
335+
/**
336+
* Returns an enum member corresponding to this class instance's value.
337+
*
338+
* Use the [value] method instead if you're uncertain the value is always known and don't
339+
* want to throw for the unknown case.
340+
*
341+
* @throws LithicInvalidDataException if this class instance's value is a not a known
342+
* member.
343+
*/
344+
fun known(): Known =
345+
when (this) {
346+
PROGRAM -> Known.PROGRAM
347+
ACCOUNT -> Known.ACCOUNT
348+
CARD -> Known.CARD
349+
else -> throw LithicInvalidDataException("Unknown Scope: $value")
350+
}
351+
352+
/**
353+
* Returns this class instance's primitive wire representation.
354+
*
355+
* This differs from the [toString] method because that method is primarily for debugging
356+
* and generally doesn't throw.
357+
*
358+
* @throws LithicInvalidDataException if this class instance's value does not have the
359+
* expected primitive type.
360+
*/
361+
fun asString(): String =
362+
_value().asString().orElseThrow { LithicInvalidDataException("Value is not a String") }
363+
364+
private var validated: Boolean = false
365+
366+
fun validate(): Scope = apply {
367+
if (validated) {
368+
return@apply
369+
}
370+
371+
known()
372+
validated = true
373+
}
374+
375+
fun isValid(): Boolean =
376+
try {
377+
validate()
378+
true
379+
} catch (e: LithicInvalidDataException) {
380+
false
381+
}
382+
383+
/**
384+
* Returns a score indicating how many valid values are contained in this object
385+
* recursively.
386+
*
387+
* Used for best match union deserialization.
388+
*/
389+
@JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1
390+
391+
override fun equals(other: Any?): Boolean {
392+
if (this === other) {
393+
return true
394+
}
395+
396+
return /* spotless:off */ other is Scope && value == other.value /* spotless:on */
397+
}
398+
399+
override fun hashCode() = value.hashCode()
400+
401+
override fun toString() = value.toString()
402+
}
403+
254404
override fun equals(other: Any?): Boolean {
255405
if (this === other) {
256406
return true
257407
}
258408

259-
return /* spotless:off */ other is AuthRuleV2ListParams && accountToken == other.accountToken && cardToken == other.cardToken && endingBefore == other.endingBefore && pageSize == other.pageSize && startingAfter == other.startingAfter && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams /* spotless:on */
409+
return /* spotless:off */ other is AuthRuleV2ListParams && accountToken == other.accountToken && cardToken == other.cardToken && endingBefore == other.endingBefore && pageSize == other.pageSize && scope == other.scope && startingAfter == other.startingAfter && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams /* spotless:on */
260410
}
261411

262-
override fun hashCode(): Int = /* spotless:off */ Objects.hash(accountToken, cardToken, endingBefore, pageSize, startingAfter, additionalHeaders, additionalQueryParams) /* spotless:on */
412+
override fun hashCode(): Int = /* spotless:off */ Objects.hash(accountToken, cardToken, endingBefore, pageSize, scope, startingAfter, additionalHeaders, additionalQueryParams) /* spotless:on */
263413

264414
override fun toString() =
265-
"AuthRuleV2ListParams{accountToken=$accountToken, cardToken=$cardToken, endingBefore=$endingBefore, pageSize=$pageSize, startingAfter=$startingAfter, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}"
415+
"AuthRuleV2ListParams{accountToken=$accountToken, cardToken=$cardToken, endingBefore=$endingBefore, pageSize=$pageSize, scope=$scope, startingAfter=$startingAfter, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}"
266416
}

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1155,6 +1155,8 @@ private constructor(
11551155

11561156
@JvmField val DISPUTE_WON = of("DISPUTE_WON")
11571157

1158+
@JvmField val SERVICE = of("SERVICE")
1159+
11581160
@JvmField val TRANSFER = of("TRANSFER")
11591161

11601162
@JvmStatic fun of(value: String) = Type(JsonField.of(value))
@@ -1193,6 +1195,7 @@ private constructor(
11931195
INACTIVITY_FEE_DOWN,
11941196
PROVISIONAL_CREDIT,
11951197
DISPUTE_WON,
1198+
SERVICE,
11961199
TRANSFER,
11971200
}
11981201

@@ -1237,6 +1240,7 @@ private constructor(
12371240
INACTIVITY_FEE_DOWN,
12381241
PROVISIONAL_CREDIT,
12391242
DISPUTE_WON,
1243+
SERVICE,
12401244
TRANSFER,
12411245
/** An enum member indicating that [Type] was instantiated with an unknown value. */
12421246
_UNKNOWN,
@@ -1282,6 +1286,7 @@ private constructor(
12821286
INACTIVITY_FEE_DOWN -> Value.INACTIVITY_FEE_DOWN
12831287
PROVISIONAL_CREDIT -> Value.PROVISIONAL_CREDIT
12841288
DISPUTE_WON -> Value.DISPUTE_WON
1289+
SERVICE -> Value.SERVICE
12851290
TRANSFER -> Value.TRANSFER
12861291
else -> Value._UNKNOWN
12871292
}
@@ -1328,6 +1333,7 @@ private constructor(
13281333
INACTIVITY_FEE_DOWN -> Known.INACTIVITY_FEE_DOWN
13291334
PROVISIONAL_CREDIT -> Known.PROVISIONAL_CREDIT
13301335
DISPUTE_WON -> Known.DISPUTE_WON
1336+
SERVICE -> Known.SERVICE
13311337
TRANSFER -> Known.TRANSFER
13321338
else -> throw LithicInvalidDataException("Unknown Type: $value")
13331339
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import kotlin.jvm.optionals.getOrNull
2424
/**
2525
* Initiate print and shipment of a duplicate physical card (e.g. card is physically damaged). The
2626
* PAN, expiry, and CVC2 will remain the same and the original card can continue to be used until
27-
* the new card is activated. Only applies to cards of type `PHYSICAL`. A card can be replaced or
27+
* the new card is activated. Only applies to cards of type `PHYSICAL`. A card can be reissued or
2828
* renewed a total of 8 times.
2929
*/
3030
class CardReissueParams

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ import kotlin.jvm.optionals.getOrNull
2626
* card token and PAN, but updated expiry and CVC2 code. The original card will keep working for
2727
* card-present transactions until the new card is activated. For card-not-present transactions, the
2828
* original card details (expiry, CVC2) will also keep working until the new card is activated. A
29-
* `PHYSICAL` card can be replaced or renewed a total of 8 times. For `VIRTUAL`, the card will
29+
* `PHYSICAL` card can be reissued or renewed a total of 8 times. For `VIRTUAL`, the card will
3030
* retain the same card token and PAN and receive an updated expiry and CVC2 code. `product_id`,
3131
* `shipping_method`, `shipping_address`, `carrier` are only relevant for renewing `PHYSICAL` cards.
3232
*/

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1292,6 +1292,8 @@ private constructor(
12921292

12931293
@JvmField val PROVISIONAL_CREDIT_REVERSAL = of("PROVISIONAL_CREDIT_REVERSAL")
12941294

1295+
@JvmField val SERVICE = of("SERVICE")
1296+
12951297
@JvmField val RETURN = of("RETURN")
12961298

12971299
@JvmField val RETURN_REVERSAL = of("RETURN_REVERSAL")
@@ -1370,6 +1372,7 @@ private constructor(
13701372
LOSS_WRITE_OFF,
13711373
PROVISIONAL_CREDIT,
13721374
PROVISIONAL_CREDIT_REVERSAL,
1375+
SERVICE,
13731376
RETURN,
13741377
RETURN_REVERSAL,
13751378
TRANSFER,
@@ -1450,6 +1453,7 @@ private constructor(
14501453
LOSS_WRITE_OFF,
14511454
PROVISIONAL_CREDIT,
14521455
PROVISIONAL_CREDIT_REVERSAL,
1456+
SERVICE,
14531457
RETURN,
14541458
RETURN_REVERSAL,
14551459
TRANSFER,
@@ -1532,6 +1536,7 @@ private constructor(
15321536
LOSS_WRITE_OFF -> Value.LOSS_WRITE_OFF
15331537
PROVISIONAL_CREDIT -> Value.PROVISIONAL_CREDIT
15341538
PROVISIONAL_CREDIT_REVERSAL -> Value.PROVISIONAL_CREDIT_REVERSAL
1539+
SERVICE -> Value.SERVICE
15351540
RETURN -> Value.RETURN
15361541
RETURN_REVERSAL -> Value.RETURN_REVERSAL
15371542
TRANSFER -> Value.TRANSFER
@@ -1612,6 +1617,7 @@ private constructor(
16121617
LOSS_WRITE_OFF -> Known.LOSS_WRITE_OFF
16131618
PROVISIONAL_CREDIT -> Known.PROVISIONAL_CREDIT
16141619
PROVISIONAL_CREDIT_REVERSAL -> Known.PROVISIONAL_CREDIT_REVERSAL
1620+
SERVICE -> Known.SERVICE
16151621
RETURN -> Known.RETURN
16161622
RETURN_REVERSAL -> Known.RETURN_REVERSAL
16171623
TRANSFER -> Known.TRANSFER

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1136,6 +1136,8 @@ private constructor(
11361136

11371137
@JvmField val PROVISIONAL_CREDIT_REVERSAL = of("PROVISIONAL_CREDIT_REVERSAL")
11381138

1139+
@JvmField val SERVICE = of("SERVICE")
1140+
11391141
@JvmField val RETURN = of("RETURN")
11401142

11411143
@JvmField val RETURN_REVERSAL = of("RETURN_REVERSAL")
@@ -1214,6 +1216,7 @@ private constructor(
12141216
LOSS_WRITE_OFF,
12151217
PROVISIONAL_CREDIT,
12161218
PROVISIONAL_CREDIT_REVERSAL,
1219+
SERVICE,
12171220
RETURN,
12181221
RETURN_REVERSAL,
12191222
TRANSFER,
@@ -1294,6 +1297,7 @@ private constructor(
12941297
LOSS_WRITE_OFF,
12951298
PROVISIONAL_CREDIT,
12961299
PROVISIONAL_CREDIT_REVERSAL,
1300+
SERVICE,
12971301
RETURN,
12981302
RETURN_REVERSAL,
12991303
TRANSFER,
@@ -1376,6 +1380,7 @@ private constructor(
13761380
LOSS_WRITE_OFF -> Value.LOSS_WRITE_OFF
13771381
PROVISIONAL_CREDIT -> Value.PROVISIONAL_CREDIT
13781382
PROVISIONAL_CREDIT_REVERSAL -> Value.PROVISIONAL_CREDIT_REVERSAL
1383+
SERVICE -> Value.SERVICE
13791384
RETURN -> Value.RETURN
13801385
RETURN_REVERSAL -> Value.RETURN_REVERSAL
13811386
TRANSFER -> Value.TRANSFER
@@ -1456,6 +1461,7 @@ private constructor(
14561461
LOSS_WRITE_OFF -> Known.LOSS_WRITE_OFF
14571462
PROVISIONAL_CREDIT -> Known.PROVISIONAL_CREDIT
14581463
PROVISIONAL_CREDIT_REVERSAL -> Known.PROVISIONAL_CREDIT_REVERSAL
1464+
SERVICE -> Known.SERVICE
14591465
RETURN -> Known.RETURN
14601466
RETURN_REVERSAL -> Known.RETURN_REVERSAL
14611467
TRANSFER -> Known.TRANSFER

0 commit comments

Comments
 (0)