Skip to content

Commit 2a2a00a

Browse files
fix(types): add EMPTY exemption type, make fields optional in Account/Card/NonPciCard
1 parent fa52ecb commit 2a2a00a

9 files changed

Lines changed: 85 additions & 38 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: 191
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/lithic%2Flithic-d29b68bb85936070878d8badaa8a7c5991313285e70a990bc812c838eba85373.yml
3-
openapi_spec_hash: 54b44da68df22eb0ea99f2bc564667a2
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/lithic%2Flithic-dc8aacc11d74a1e25c95ba549dd0f4a4e735cbf7562fc6b17b0c81d62fd5475c.yml
3+
openapi_spec_hash: 1906583f260a3e9ace5ae38fd2254763
44
config_hash: ac8326134e692f3f3bdec82396bbec80

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -504,7 +504,10 @@ private constructor(
504504
* * `OTHER` - The reason for the account's current status does not fall into any of the
505505
* above categories. A comment should be provided to specify the particular reason.
506506
*/
507-
fun substatus(substatus: Substatus) = substatus(JsonField.of(substatus))
507+
fun substatus(substatus: Substatus?) = substatus(JsonField.ofNullable(substatus))
508+
509+
/** Alias for calling [Builder.substatus] with `substatus.orElse(null)`. */
510+
fun substatus(substatus: Optional<Substatus>) = substatus(substatus.getOrNull())
508511

509512
/**
510513
* Sets [Builder.substatus] to an arbitrary JSON value.

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

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ private constructor(
209209
fun email(): Optional<String> = email.getOptional("email")
210210

211211
/**
212-
* The type of KYC exemption for a KYC-Exempt Account Holder. "None" if the account holder is
212+
* The type of KYC exemption for a KYC-Exempt Account Holder. `null` if the account holder is
213213
* not KYC-Exempt.
214214
*
215215
* @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the
@@ -733,10 +733,15 @@ private constructor(
733733
fun email(email: JsonField<String>) = apply { this.email = email }
734734

735735
/**
736-
* The type of KYC exemption for a KYC-Exempt Account Holder. "None" if the account holder
736+
* The type of KYC exemption for a KYC-Exempt Account Holder. `null` if the account holder
737737
* is not KYC-Exempt.
738738
*/
739-
fun exemptionType(exemptionType: ExemptionType) = exemptionType(JsonField.of(exemptionType))
739+
fun exemptionType(exemptionType: ExemptionType?) =
740+
exemptionType(JsonField.ofNullable(exemptionType))
741+
742+
/** Alias for calling [Builder.exemptionType] with `exemptionType.orElse(null)`. */
743+
fun exemptionType(exemptionType: Optional<ExemptionType>) =
744+
exemptionType(exemptionType.getOrNull())
740745

741746
/**
742747
* Sets [Builder.exemptionType] to an arbitrary JSON value.
@@ -1871,7 +1876,7 @@ private constructor(
18711876
}
18721877

18731878
/**
1874-
* The type of KYC exemption for a KYC-Exempt Account Holder. "None" if the account holder is
1879+
* The type of KYC exemption for a KYC-Exempt Account Holder. `null` if the account holder is
18751880
* not KYC-Exempt.
18761881
*/
18771882
class ExemptionType @JsonCreator private constructor(private val value: JsonField<String>) :

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,7 @@ private constructor(
402402
fun email(): Optional<String> = email.getOptional("email")
403403

404404
/**
405-
* The type of KYC exemption for a KYC-Exempt Account Holder. "None" if the account holder
405+
* The type of KYC exemption for a KYC-Exempt Account Holder. `null` if the account holder
406406
* is not KYC-Exempt.
407407
*
408408
* @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the
@@ -927,7 +927,7 @@ private constructor(
927927
fun email(email: JsonField<String>) = apply { this.email = email }
928928

929929
/**
930-
* The type of KYC exemption for a KYC-Exempt Account Holder. "None" if the account
930+
* The type of KYC exemption for a KYC-Exempt Account Holder. `null` if the account
931931
* holder is not KYC-Exempt.
932932
*/
933933
fun exemptionType(exemptionType: ExemptionType) =
@@ -2098,7 +2098,7 @@ private constructor(
20982098
}
20992099

21002100
/**
2101-
* The type of KYC exemption for a KYC-Exempt Account Holder. "None" if the account holder
2101+
* The type of KYC exemption for a KYC-Exempt Account Holder. `null` if the account holder
21022102
* is not KYC-Exempt.
21032103
*/
21042104
class ExemptionType @JsonCreator private constructor(private val value: JsonField<String>) :

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

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,10 @@ private constructor(
337337
* * `OTHER` - The reason for the account's current status does not fall into any of the
338338
* above categories. A comment should be provided to specify the particular reason.
339339
*/
340-
fun substatus(substatus: Substatus) = apply { body.substatus(substatus) }
340+
fun substatus(substatus: Substatus?) = apply { body.substatus(substatus) }
341+
342+
/** Alias for calling [Builder.substatus] with `substatus.orElse(null)`. */
343+
fun substatus(substatus: Optional<Substatus>) = substatus(substatus.getOrNull())
341344

342345
/**
343346
* Sets [Builder.substatus] to an arbitrary JSON value.
@@ -864,7 +867,10 @@ private constructor(
864867
* * `OTHER` - The reason for the account's current status does not fall into any of the
865868
* above categories. A comment should be provided to specify the particular reason.
866869
*/
867-
fun substatus(substatus: Substatus) = substatus(JsonField.of(substatus))
870+
fun substatus(substatus: Substatus?) = substatus(JsonField.ofNullable(substatus))
871+
872+
/** Alias for calling [Builder.substatus] with `substatus.orElse(null)`. */
873+
fun substatus(substatus: Optional<Substatus>) = substatus(substatus.getOrNull())
868874

869875
/**
870876
* Sets [Builder.substatus] to an arbitrary JSON value.

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

Lines changed: 26 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -206,12 +206,12 @@ private constructor(
206206
fun created(): OffsetDateTime = created.getRequired("created")
207207

208208
/**
209-
* Deprecated: Funding account for the card.
209+
* Funding account for a card
210210
*
211-
* @throws LithicInvalidDataException if the JSON field has an unexpected type or is
212-
* unexpectedly missing or null (e.g. if the server responded with an unexpected value).
211+
* @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the
212+
* server responded with an unexpected value).
213213
*/
214-
fun funding(): NonPciCard.FundingAccount = funding.getRequired("funding")
214+
fun funding(): Optional<NonPciCard.FundingAccount> = funding.getOptional("funding")
215215

216216
/**
217217
* Last four digits of the card number.
@@ -822,8 +822,11 @@ private constructor(
822822
*/
823823
fun created(created: JsonField<OffsetDateTime>) = apply { this.created = created }
824824

825-
/** Deprecated: Funding account for the card. */
826-
fun funding(funding: NonPciCard.FundingAccount) = funding(JsonField.of(funding))
825+
/** Funding account for a card */
826+
fun funding(funding: NonPciCard.FundingAccount?) = funding(JsonField.ofNullable(funding))
827+
828+
/** Alias for calling [Builder.funding] with `funding.orElse(null)`. */
829+
fun funding(funding: Optional<NonPciCard.FundingAccount>) = funding(funding.getOrNull())
827830

828831
/**
829832
* Sets [Builder.funding] to an arbitrary JSON value.
@@ -1040,8 +1043,14 @@ private constructor(
10401043
* tokenization. This artwork must be approved by Mastercard and configured by Lithic to
10411044
* use.
10421045
*/
1043-
fun digitalCardArtToken(digitalCardArtToken: String) =
1044-
digitalCardArtToken(JsonField.of(digitalCardArtToken))
1046+
fun digitalCardArtToken(digitalCardArtToken: String?) =
1047+
digitalCardArtToken(JsonField.ofNullable(digitalCardArtToken))
1048+
1049+
/**
1050+
* Alias for calling [Builder.digitalCardArtToken] with `digitalCardArtToken.orElse(null)`.
1051+
*/
1052+
fun digitalCardArtToken(digitalCardArtToken: Optional<String>) =
1053+
digitalCardArtToken(digitalCardArtToken.getOrNull())
10451054

10461055
/**
10471056
* Sets [Builder.digitalCardArtToken] to an arbitrary JSON value.
@@ -1159,7 +1168,10 @@ private constructor(
11591168
* use. Specifies the configuration (i.e., physical card art) that the card should be
11601169
* manufactured with.
11611170
*/
1162-
fun productId(productId: String) = productId(JsonField.of(productId))
1171+
fun productId(productId: String?) = productId(JsonField.ofNullable(productId))
1172+
1173+
/** Alias for calling [Builder.productId] with `productId.orElse(null)`. */
1174+
fun productId(productId: Optional<String>) = productId(productId.getOrNull())
11631175

11641176
/**
11651177
* Sets [Builder.productId] to an arbitrary JSON value.
@@ -1212,7 +1224,10 @@ private constructor(
12121224
* has been returned. * `OTHER` - The reason for the status does not fall into any of the
12131225
* above categories. A comment can be provided to specify the reason.
12141226
*/
1215-
fun substatus(substatus: NonPciCard.Substatus) = substatus(JsonField.of(substatus))
1227+
fun substatus(substatus: NonPciCard.Substatus?) = substatus(JsonField.ofNullable(substatus))
1228+
1229+
/** Alias for calling [Builder.substatus] with `substatus.orElse(null)`. */
1230+
fun substatus(substatus: Optional<NonPciCard.Substatus>) = substatus(substatus.getOrNull())
12161231

12171232
/**
12181233
* Sets [Builder.substatus] to an arbitrary JSON value.
@@ -1336,7 +1351,7 @@ private constructor(
13361351
accountToken()
13371352
cardProgramToken()
13381353
created()
1339-
funding().validate()
1354+
funding().ifPresent { it.validate() }
13401355
lastFour()
13411356
pinStatus().validate()
13421357
spendLimit()

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

Lines changed: 31 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -170,12 +170,12 @@ private constructor(
170170
fun created(): OffsetDateTime = created.getRequired("created")
171171

172172
/**
173-
* Deprecated: Funding account for the card.
173+
* Funding account for a card
174174
*
175-
* @throws LithicInvalidDataException if the JSON field has an unexpected type or is
176-
* unexpectedly missing or null (e.g. if the server responded with an unexpected value).
175+
* @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the
176+
* server responded with an unexpected value).
177177
*/
178-
fun funding(): FundingAccount = funding.getRequired("funding")
178+
fun funding(): Optional<FundingAccount> = funding.getOptional("funding")
179179

180180
/**
181181
* Last four digits of the card number.
@@ -745,8 +745,11 @@ private constructor(
745745
*/
746746
fun created(created: JsonField<OffsetDateTime>) = apply { this.created = created }
747747

748-
/** Deprecated: Funding account for the card. */
749-
fun funding(funding: FundingAccount) = funding(JsonField.of(funding))
748+
/** Funding account for a card */
749+
fun funding(funding: FundingAccount?) = funding(JsonField.ofNullable(funding))
750+
751+
/** Alias for calling [Builder.funding] with `funding.orElse(null)`. */
752+
fun funding(funding: Optional<FundingAccount>) = funding(funding.getOrNull())
750753

751754
/**
752755
* Sets [Builder.funding] to an arbitrary JSON value.
@@ -957,8 +960,14 @@ private constructor(
957960
* tokenization. This artwork must be approved by Mastercard and configured by Lithic to
958961
* use.
959962
*/
960-
fun digitalCardArtToken(digitalCardArtToken: String) =
961-
digitalCardArtToken(JsonField.of(digitalCardArtToken))
963+
fun digitalCardArtToken(digitalCardArtToken: String?) =
964+
digitalCardArtToken(JsonField.ofNullable(digitalCardArtToken))
965+
966+
/**
967+
* Alias for calling [Builder.digitalCardArtToken] with `digitalCardArtToken.orElse(null)`.
968+
*/
969+
fun digitalCardArtToken(digitalCardArtToken: Optional<String>) =
970+
digitalCardArtToken(digitalCardArtToken.getOrNull())
962971

963972
/**
964973
* Sets [Builder.digitalCardArtToken] to an arbitrary JSON value.
@@ -1076,7 +1085,10 @@ private constructor(
10761085
* use. Specifies the configuration (i.e., physical card art) that the card should be
10771086
* manufactured with.
10781087
*/
1079-
fun productId(productId: String) = productId(JsonField.of(productId))
1088+
fun productId(productId: String?) = productId(JsonField.ofNullable(productId))
1089+
1090+
/** Alias for calling [Builder.productId] with `productId.orElse(null)`. */
1091+
fun productId(productId: Optional<String>) = productId(productId.getOrNull())
10801092

10811093
/**
10821094
* Sets [Builder.productId] to an arbitrary JSON value.
@@ -1129,7 +1141,10 @@ private constructor(
11291141
* has been returned. * `OTHER` - The reason for the status does not fall into any of the
11301142
* above categories. A comment can be provided to specify the reason.
11311143
*/
1132-
fun substatus(substatus: Substatus) = substatus(JsonField.of(substatus))
1144+
fun substatus(substatus: Substatus?) = substatus(JsonField.ofNullable(substatus))
1145+
1146+
/** Alias for calling [Builder.substatus] with `substatus.orElse(null)`. */
1147+
fun substatus(substatus: Optional<Substatus>) = substatus(substatus.getOrNull())
11331148

11341149
/**
11351150
* Sets [Builder.substatus] to an arbitrary JSON value.
@@ -1223,7 +1238,7 @@ private constructor(
12231238
accountToken()
12241239
cardProgramToken()
12251240
created()
1226-
funding().validate()
1241+
funding().ifPresent { it.validate() }
12271242
lastFour()
12281243
pinStatus().validate()
12291244
spendLimit()
@@ -1288,7 +1303,7 @@ private constructor(
12881303
(if (replacementFor.asKnown().isPresent) 1 else 0) +
12891304
(substatus.asKnown().getOrNull()?.validity() ?: 0)
12901305

1291-
/** Deprecated: Funding account for the card. */
1306+
/** Funding account for a card */
12921307
class FundingAccount
12931308
@JsonCreator(mode = JsonCreator.Mode.DISABLED)
12941309
private constructor(
@@ -1574,7 +1589,10 @@ private constructor(
15741589
}
15751590

15761591
/** The nickname given to the `FundingAccount` or `null` if it has no nickname. */
1577-
fun nickname(nickname: String) = nickname(JsonField.of(nickname))
1592+
fun nickname(nickname: String?) = nickname(JsonField.ofNullable(nickname))
1593+
1594+
/** Alias for calling [Builder.nickname] with `nickname.orElse(null)`. */
1595+
fun nickname(nickname: Optional<String>) = nickname(nickname.getOrNull())
15781596

15791597
/**
15801598
* Sets [Builder.nickname] to an arbitrary JSON value.

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ internal class CardTest {
5959
assertThat(card.cardProgramToken()).isEqualTo("5e9483eb-8103-4e16-9794-2106111b2eca")
6060
assertThat(card.created()).isEqualTo(OffsetDateTime.parse("2021-06-28T22:53:15Z"))
6161
assertThat(card.funding())
62-
.isEqualTo(
62+
.contains(
6363
NonPciCard.FundingAccount.builder()
6464
.token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
6565
.created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ internal class NonPciCardTest {
5757
assertThat(nonPciCard.cardProgramToken()).isEqualTo("5e9483eb-8103-4e16-9794-2106111b2eca")
5858
assertThat(nonPciCard.created()).isEqualTo(OffsetDateTime.parse("2021-06-28T22:53:15Z"))
5959
assertThat(nonPciCard.funding())
60-
.isEqualTo(
60+
.contains(
6161
NonPciCard.FundingAccount.builder()
6262
.token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
6363
.created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))

0 commit comments

Comments
 (0)