Skip to content

Commit 7796bac

Browse files
feat(api): Add hold token field to book transfers
1 parent a0a4acc commit 7796bac

5 files changed

Lines changed: 74 additions & 3 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: 177
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/lithic%2Flithic-da8525181ab7cccb66db674dd7243de54b28969c0395223f6dbec3c791f1e7b0.yml
3-
openapi_spec_hash: f4f45e8ca906900f78f1c8aa0233fc20
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/lithic%2Flithic-f137c504db2dbc70382232b1db7ed592a852bc58068a4e72d5ba7ce724110b3d.yml
3+
openapi_spec_hash: 20abc9c95ee5814da6d7aeccec75e996
44
config_hash: 693dddc4721eef512d75ab6c60897794

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

Lines changed: 67 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,14 @@ private constructor(
9595
*/
9696
fun externalId(): Optional<String> = body.externalId()
9797

98+
/**
99+
* Token of an existing hold to settle when this transfer is initiated
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 holdToken(): Optional<String> = body.holdToken()
105+
98106
/**
99107
* Optional descriptor for the transfer.
100108
*
@@ -169,6 +177,13 @@ private constructor(
169177
*/
170178
fun _externalId(): JsonField<String> = body._externalId()
171179

180+
/**
181+
* Returns the raw JSON value of [holdToken].
182+
*
183+
* Unlike [holdToken], this method doesn't throw if the JSON field has an unexpected type.
184+
*/
185+
fun _holdToken(): JsonField<String> = body._holdToken()
186+
172187
/**
173188
* Returns the raw JSON value of [memo].
174189
*
@@ -351,6 +366,18 @@ private constructor(
351366
*/
352367
fun externalId(externalId: JsonField<String>) = apply { body.externalId(externalId) }
353368

369+
/** Token of an existing hold to settle when this transfer is initiated */
370+
fun holdToken(holdToken: String) = apply { body.holdToken(holdToken) }
371+
372+
/**
373+
* Sets [Builder.holdToken] to an arbitrary JSON value.
374+
*
375+
* You should usually call [Builder.holdToken] with a well-typed [String] value instead.
376+
* This method is primarily for setting the field to an undocumented or not yet supported
377+
* value.
378+
*/
379+
fun holdToken(holdToken: JsonField<String>) = apply { body.holdToken(holdToken) }
380+
354381
/** Optional descriptor for the transfer. */
355382
fun memo(memo: String) = apply { body.memo(memo) }
356383

@@ -537,6 +564,7 @@ private constructor(
537564
private val type: JsonField<BookTransferType>,
538565
private val token: JsonField<String>,
539566
private val externalId: JsonField<String>,
567+
private val holdToken: JsonField<String>,
540568
private val memo: JsonField<String>,
541569
private val onClosedAccount: JsonField<OnClosedAccount>,
542570
private val additionalProperties: MutableMap<String, JsonValue>,
@@ -562,6 +590,9 @@ private constructor(
562590
@JsonProperty("external_id")
563591
@ExcludeMissing
564592
externalId: JsonField<String> = JsonMissing.of(),
593+
@JsonProperty("hold_token")
594+
@ExcludeMissing
595+
holdToken: JsonField<String> = JsonMissing.of(),
565596
@JsonProperty("memo") @ExcludeMissing memo: JsonField<String> = JsonMissing.of(),
566597
@JsonProperty("on_closed_account")
567598
@ExcludeMissing
@@ -575,6 +606,7 @@ private constructor(
575606
type,
576607
token,
577608
externalId,
609+
holdToken,
578610
memo,
579611
onClosedAccount,
580612
mutableMapOf(),
@@ -648,6 +680,14 @@ private constructor(
648680
*/
649681
fun externalId(): Optional<String> = externalId.getOptional("external_id")
650682

683+
/**
684+
* Token of an existing hold to settle when this transfer is initiated
685+
*
686+
* @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the
687+
* server responded with an unexpected value).
688+
*/
689+
fun holdToken(): Optional<String> = holdToken.getOptional("hold_token")
690+
651691
/**
652692
* Optional descriptor for the transfer.
653693
*
@@ -731,6 +771,13 @@ private constructor(
731771
@ExcludeMissing
732772
fun _externalId(): JsonField<String> = externalId
733773

774+
/**
775+
* Returns the raw JSON value of [holdToken].
776+
*
777+
* Unlike [holdToken], this method doesn't throw if the JSON field has an unexpected type.
778+
*/
779+
@JsonProperty("hold_token") @ExcludeMissing fun _holdToken(): JsonField<String> = holdToken
780+
734781
/**
735782
* Returns the raw JSON value of [memo].
736783
*
@@ -790,6 +837,7 @@ private constructor(
790837
private var type: JsonField<BookTransferType>? = null
791838
private var token: JsonField<String> = JsonMissing.of()
792839
private var externalId: JsonField<String> = JsonMissing.of()
840+
private var holdToken: JsonField<String> = JsonMissing.of()
793841
private var memo: JsonField<String> = JsonMissing.of()
794842
private var onClosedAccount: JsonField<OnClosedAccount> = JsonMissing.of()
795843
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()
@@ -804,6 +852,7 @@ private constructor(
804852
type = createBookTransferRequest.type
805853
token = createBookTransferRequest.token
806854
externalId = createBookTransferRequest.externalId
855+
holdToken = createBookTransferRequest.holdToken
807856
memo = createBookTransferRequest.memo
808857
onClosedAccount = createBookTransferRequest.onClosedAccount
809858
additionalProperties = createBookTransferRequest.additionalProperties.toMutableMap()
@@ -924,6 +973,18 @@ private constructor(
924973
*/
925974
fun externalId(externalId: JsonField<String>) = apply { this.externalId = externalId }
926975

976+
/** Token of an existing hold to settle when this transfer is initiated */
977+
fun holdToken(holdToken: String) = holdToken(JsonField.of(holdToken))
978+
979+
/**
980+
* Sets [Builder.holdToken] to an arbitrary JSON value.
981+
*
982+
* You should usually call [Builder.holdToken] with a well-typed [String] value instead.
983+
* This method is primarily for setting the field to an undocumented or not yet
984+
* supported value.
985+
*/
986+
fun holdToken(holdToken: JsonField<String>) = apply { this.holdToken = holdToken }
987+
927988
/** Optional descriptor for the transfer. */
928989
fun memo(memo: String) = memo(JsonField.of(memo))
929990

@@ -997,6 +1058,7 @@ private constructor(
9971058
checkRequired("type", type),
9981059
token,
9991060
externalId,
1061+
holdToken,
10001062
memo,
10011063
onClosedAccount,
10021064
additionalProperties.toMutableMap(),
@@ -1018,6 +1080,7 @@ private constructor(
10181080
type().validate()
10191081
token()
10201082
externalId()
1083+
holdToken()
10211084
memo()
10221085
onClosedAccount().ifPresent { it.validate() }
10231086
validated = true
@@ -1047,6 +1110,7 @@ private constructor(
10471110
(type.asKnown().getOrNull()?.validity() ?: 0) +
10481111
(if (token.asKnown().isPresent) 1 else 0) +
10491112
(if (externalId.asKnown().isPresent) 1 else 0) +
1113+
(if (holdToken.asKnown().isPresent) 1 else 0) +
10501114
(if (memo.asKnown().isPresent) 1 else 0) +
10511115
(onClosedAccount.asKnown().getOrNull()?.validity() ?: 0)
10521116

@@ -1064,6 +1128,7 @@ private constructor(
10641128
type == other.type &&
10651129
token == other.token &&
10661130
externalId == other.externalId &&
1131+
holdToken == other.holdToken &&
10671132
memo == other.memo &&
10681133
onClosedAccount == other.onClosedAccount &&
10691134
additionalProperties == other.additionalProperties
@@ -1079,6 +1144,7 @@ private constructor(
10791144
type,
10801145
token,
10811146
externalId,
1147+
holdToken,
10821148
memo,
10831149
onClosedAccount,
10841150
additionalProperties,
@@ -1088,7 +1154,7 @@ private constructor(
10881154
override fun hashCode(): Int = hashCode
10891155

10901156
override fun toString() =
1091-
"CreateBookTransferRequest{amount=$amount, category=$category, fromFinancialAccountToken=$fromFinancialAccountToken, subtype=$subtype, toFinancialAccountToken=$toFinancialAccountToken, type=$type, token=$token, externalId=$externalId, memo=$memo, onClosedAccount=$onClosedAccount, additionalProperties=$additionalProperties}"
1157+
"CreateBookTransferRequest{amount=$amount, category=$category, fromFinancialAccountToken=$fromFinancialAccountToken, subtype=$subtype, toFinancialAccountToken=$toFinancialAccountToken, type=$type, token=$token, externalId=$externalId, holdToken=$holdToken, memo=$memo, onClosedAccount=$onClosedAccount, additionalProperties=$additionalProperties}"
10921158
}
10931159

10941160
class BookTransferCategory

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ internal class BookTransferCreateParamsTest {
1818
.type(BookTransferCreateParams.BookTransferType.ATM_BALANCE_INQUIRY)
1919
.token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
2020
.externalId("external_id")
21+
.holdToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
2122
.memo("memo")
2223
.onClosedAccount(BookTransferCreateParams.OnClosedAccount.FAIL)
2324
.build()
@@ -35,6 +36,7 @@ internal class BookTransferCreateParamsTest {
3536
.type(BookTransferCreateParams.BookTransferType.ATM_BALANCE_INQUIRY)
3637
.token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
3738
.externalId("external_id")
39+
.holdToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
3840
.memo("memo")
3941
.onClosedAccount(BookTransferCreateParams.OnClosedAccount.FAIL)
4042
.build()
@@ -52,6 +54,7 @@ internal class BookTransferCreateParamsTest {
5254
.isEqualTo(BookTransferCreateParams.BookTransferType.ATM_BALANCE_INQUIRY)
5355
assertThat(body.token()).contains("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
5456
assertThat(body.externalId()).contains("external_id")
57+
assertThat(body.holdToken()).contains("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
5558
assertThat(body.memo()).contains("memo")
5659
assertThat(body.onClosedAccount()).contains(BookTransferCreateParams.OnClosedAccount.FAIL)
5760
}

lithic-java-core/src/test/kotlin/com/lithic/api/services/async/BookTransferServiceAsyncTest.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ internal class BookTransferServiceAsyncTest {
3333
.type(BookTransferCreateParams.BookTransferType.ATM_BALANCE_INQUIRY)
3434
.token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
3535
.externalId("external_id")
36+
.holdToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
3637
.memo("memo")
3738
.onClosedAccount(BookTransferCreateParams.OnClosedAccount.FAIL)
3839
.build()

lithic-java-core/src/test/kotlin/com/lithic/api/services/blocking/BookTransferServiceTest.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ internal class BookTransferServiceTest {
3333
.type(BookTransferCreateParams.BookTransferType.ATM_BALANCE_INQUIRY)
3434
.token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
3535
.externalId("external_id")
36+
.holdToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
3637
.memo("memo")
3738
.onClosedAccount(BookTransferCreateParams.OnClosedAccount.FAIL)
3839
.build()

0 commit comments

Comments
 (0)