Skip to content

Commit fe5a15e

Browse files
feat(api): declare AccountHolderBusinessResponse and remove entity_token from BusinessEntity (#297)
1 parent ea6dc15 commit fe5a15e

8 files changed

Lines changed: 173 additions & 73 deletions

File tree

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

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@ import java.util.Optional
2424
class AccountHolder
2525
private constructor(
2626
private val accountToken: JsonField<String>,
27-
private val beneficialOwnerEntities: JsonField<List<BusinessEntity>>,
27+
private val beneficialOwnerEntities: JsonField<List<AccountHolderBusinessResponse>>,
2828
private val beneficialOwnerIndividuals: JsonField<List<AccountHolderIndividualResponse>>,
2929
private val businessAccountToken: JsonField<String>,
30-
private val businessEntity: JsonField<BusinessEntity>,
30+
private val businessEntity: JsonField<AccountHolderBusinessResponse>,
3131
private val controlPerson: JsonField<AccountHolderIndividualResponse>,
3232
private val created: JsonField<OffsetDateTime>,
3333
private val email: JsonField<String>,
@@ -58,7 +58,7 @@ private constructor(
5858
* Only present when user_type == "BUSINESS". List of all entities with >25% ownership in the
5959
* company.
6060
*/
61-
fun beneficialOwnerEntities(): Optional<List<BusinessEntity>> =
61+
fun beneficialOwnerEntities(): Optional<List<AccountHolderBusinessResponse>> =
6262
Optional.ofNullable(beneficialOwnerEntities.getNullable("beneficial_owner_entities"))
6363

6464
/**
@@ -80,7 +80,7 @@ private constructor(
8080
* Only present when user_type == "BUSINESS". Information about the business for which the
8181
* account is being opened and KYB is being run.
8282
*/
83-
fun businessEntity(): Optional<BusinessEntity> =
83+
fun businessEntity(): Optional<AccountHolderBusinessResponse> =
8484
Optional.ofNullable(businessEntity.getNullable("business_entity"))
8585

8686
/**
@@ -399,11 +399,12 @@ private constructor(
399399
class Builder {
400400

401401
private var accountToken: JsonField<String> = JsonMissing.of()
402-
private var beneficialOwnerEntities: JsonField<List<BusinessEntity>> = JsonMissing.of()
402+
private var beneficialOwnerEntities: JsonField<List<AccountHolderBusinessResponse>> =
403+
JsonMissing.of()
403404
private var beneficialOwnerIndividuals: JsonField<List<AccountHolderIndividualResponse>> =
404405
JsonMissing.of()
405406
private var businessAccountToken: JsonField<String> = JsonMissing.of()
406-
private var businessEntity: JsonField<BusinessEntity> = JsonMissing.of()
407+
private var businessEntity: JsonField<AccountHolderBusinessResponse> = JsonMissing.of()
407408
private var controlPerson: JsonField<AccountHolderIndividualResponse> = JsonMissing.of()
408409
private var created: JsonField<OffsetDateTime> = JsonMissing.of()
409410
private var email: JsonField<String> = JsonMissing.of()
@@ -461,7 +462,7 @@ private constructor(
461462
* Only present when user_type == "BUSINESS". List of all entities with >25% ownership in
462463
* the company.
463464
*/
464-
fun beneficialOwnerEntities(beneficialOwnerEntities: List<BusinessEntity>) =
465+
fun beneficialOwnerEntities(beneficialOwnerEntities: List<AccountHolderBusinessResponse>) =
465466
beneficialOwnerEntities(JsonField.of(beneficialOwnerEntities))
466467

467468
/**
@@ -470,10 +471,9 @@ private constructor(
470471
*/
471472
@JsonProperty("beneficial_owner_entities")
472473
@ExcludeMissing
473-
fun beneficialOwnerEntities(beneficialOwnerEntities: JsonField<List<BusinessEntity>>) =
474-
apply {
475-
this.beneficialOwnerEntities = beneficialOwnerEntities
476-
}
474+
fun beneficialOwnerEntities(
475+
beneficialOwnerEntities: JsonField<List<AccountHolderBusinessResponse>>
476+
) = apply { this.beneficialOwnerEntities = beneficialOwnerEntities }
477477

478478
/**
479479
* Only present when user_type == "BUSINESS". List of all individuals with >25% ownership in
@@ -516,7 +516,7 @@ private constructor(
516516
* Only present when user_type == "BUSINESS". Information about the business for which the
517517
* account is being opened and KYB is being run.
518518
*/
519-
fun businessEntity(businessEntity: BusinessEntity) =
519+
fun businessEntity(businessEntity: AccountHolderBusinessResponse) =
520520
businessEntity(JsonField.of(businessEntity))
521521

522522
/**
@@ -525,7 +525,7 @@ private constructor(
525525
*/
526526
@JsonProperty("business_entity")
527527
@ExcludeMissing
528-
fun businessEntity(businessEntity: JsonField<BusinessEntity>) = apply {
528+
fun businessEntity(businessEntity: JsonField<AccountHolderBusinessResponse>) = apply {
529529
this.businessEntity = businessEntity
530530
}
531531

@@ -795,9 +795,9 @@ private constructor(
795795
)
796796
}
797797

798-
@JsonDeserialize(builder = BusinessEntity.Builder::class)
798+
@JsonDeserialize(builder = AccountHolderBusinessResponse.Builder::class)
799799
@NoAutoDetect
800-
class BusinessEntity
800+
class AccountHolderBusinessResponse
801801
private constructor(
802802
private val address: JsonField<Address>,
803803
private val dbaBusinessName: JsonField<String>,
@@ -823,8 +823,7 @@ private constructor(
823823
* Any name that the business operates under that is not its legal business name (if
824824
* applicable).
825825
*/
826-
fun dbaBusinessName(): Optional<String> =
827-
Optional.ofNullable(dbaBusinessName.getNullable("dba_business_name"))
826+
fun dbaBusinessName(): String = dbaBusinessName.getRequired("dba_business_name")
828827

829828
/**
830829
* Government-issued identification number. US Federal Employer Identification Numbers (EIN)
@@ -881,7 +880,7 @@ private constructor(
881880
@ExcludeMissing
882881
fun _additionalProperties(): Map<String, JsonValue> = additionalProperties
883882

884-
fun validate(): BusinessEntity = apply {
883+
fun validate(): AccountHolderBusinessResponse = apply {
885884
if (!validated) {
886885
address().validate()
887886
dbaBusinessName()
@@ -901,7 +900,7 @@ private constructor(
901900
return true
902901
}
903902

904-
return other is BusinessEntity &&
903+
return other is AccountHolderBusinessResponse &&
905904
this.address == other.address &&
906905
this.dbaBusinessName == other.dbaBusinessName &&
907906
this.governmentId == other.governmentId &&
@@ -930,7 +929,7 @@ private constructor(
930929
}
931930

932931
override fun toString() =
933-
"BusinessEntity{address=$address, dbaBusinessName=$dbaBusinessName, governmentId=$governmentId, legalBusinessName=$legalBusinessName, parentCompany=$parentCompany, phoneNumbers=$phoneNumbers, entityToken=$entityToken, additionalProperties=$additionalProperties}"
932+
"AccountHolderBusinessResponse{address=$address, dbaBusinessName=$dbaBusinessName, governmentId=$governmentId, legalBusinessName=$legalBusinessName, parentCompany=$parentCompany, phoneNumbers=$phoneNumbers, entityToken=$entityToken, additionalProperties=$additionalProperties}"
934933

935934
companion object {
936935

@@ -949,16 +948,17 @@ private constructor(
949948
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()
950949

951950
@JvmSynthetic
952-
internal fun from(businessEntity: BusinessEntity) = apply {
953-
this.address = businessEntity.address
954-
this.dbaBusinessName = businessEntity.dbaBusinessName
955-
this.governmentId = businessEntity.governmentId
956-
this.legalBusinessName = businessEntity.legalBusinessName
957-
this.parentCompany = businessEntity.parentCompany
958-
this.phoneNumbers = businessEntity.phoneNumbers
959-
this.entityToken = businessEntity.entityToken
960-
additionalProperties(businessEntity.additionalProperties)
961-
}
951+
internal fun from(accountHolderBusinessResponse: AccountHolderBusinessResponse) =
952+
apply {
953+
this.address = accountHolderBusinessResponse.address
954+
this.dbaBusinessName = accountHolderBusinessResponse.dbaBusinessName
955+
this.governmentId = accountHolderBusinessResponse.governmentId
956+
this.legalBusinessName = accountHolderBusinessResponse.legalBusinessName
957+
this.parentCompany = accountHolderBusinessResponse.parentCompany
958+
this.phoneNumbers = accountHolderBusinessResponse.phoneNumbers
959+
this.entityToken = accountHolderBusinessResponse.entityToken
960+
additionalProperties(accountHolderBusinessResponse.additionalProperties)
961+
}
962962

963963
/**
964964
* Business's physical address - PO boxes, UPS drops, and FedEx drops are not
@@ -1062,8 +1062,8 @@ private constructor(
10621062
this.additionalProperties.putAll(additionalProperties)
10631063
}
10641064

1065-
fun build(): BusinessEntity =
1066-
BusinessEntity(
1065+
fun build(): AccountHolderBusinessResponse =
1066+
AccountHolderBusinessResponse(
10671067
address,
10681068
dbaBusinessName,
10691069
governmentId,

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

Lines changed: 110 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,33 +5,67 @@ package com.lithic.api.models
55
import com.lithic.api.core.NoAutoDetect
66
import com.lithic.api.core.toUnmodifiable
77
import com.lithic.api.models.*
8+
import java.time.OffsetDateTime
9+
import java.time.format.DateTimeFormatter
810
import java.util.Objects
911
import java.util.Optional
1012

1113
class AccountHolderListParams
1214
constructor(
15+
private val begin: OffsetDateTime?,
16+
private val email: String?,
17+
private val end: OffsetDateTime?,
1318
private val endingBefore: String?,
1419
private val externalId: String?,
20+
private val firstName: String?,
21+
private val lastName: String?,
22+
private val legalBusinessName: String?,
1523
private val limit: Long?,
24+
private val phoneNumber: String?,
1625
private val startingAfter: String?,
1726
private val additionalQueryParams: Map<String, List<String>>,
1827
private val additionalHeaders: Map<String, List<String>>,
1928
) {
2029

30+
fun begin(): Optional<OffsetDateTime> = Optional.ofNullable(begin)
31+
32+
fun email(): Optional<String> = Optional.ofNullable(email)
33+
34+
fun end(): Optional<OffsetDateTime> = Optional.ofNullable(end)
35+
2136
fun endingBefore(): Optional<String> = Optional.ofNullable(endingBefore)
2237

2338
fun externalId(): Optional<String> = Optional.ofNullable(externalId)
2439

40+
fun firstName(): Optional<String> = Optional.ofNullable(firstName)
41+
42+
fun lastName(): Optional<String> = Optional.ofNullable(lastName)
43+
44+
fun legalBusinessName(): Optional<String> = Optional.ofNullable(legalBusinessName)
45+
2546
fun limit(): Optional<Long> = Optional.ofNullable(limit)
2647

48+
fun phoneNumber(): Optional<String> = Optional.ofNullable(phoneNumber)
49+
2750
fun startingAfter(): Optional<String> = Optional.ofNullable(startingAfter)
2851

2952
@JvmSynthetic
3053
internal fun getQueryParams(): Map<String, List<String>> {
3154
val params = mutableMapOf<String, List<String>>()
55+
this.begin?.let {
56+
params.put("begin", listOf(DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(it)))
57+
}
58+
this.email?.let { params.put("email", listOf(it.toString())) }
59+
this.end?.let {
60+
params.put("end", listOf(DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(it)))
61+
}
3262
this.endingBefore?.let { params.put("ending_before", listOf(it.toString())) }
3363
this.externalId?.let { params.put("external_id", listOf(it.toString())) }
64+
this.firstName?.let { params.put("first_name", listOf(it.toString())) }
65+
this.lastName?.let { params.put("last_name", listOf(it.toString())) }
66+
this.legalBusinessName?.let { params.put("legal_business_name", listOf(it.toString())) }
3467
this.limit?.let { params.put("limit", listOf(it.toString())) }
68+
this.phoneNumber?.let { params.put("phone_number", listOf(it.toString())) }
3569
this.startingAfter?.let { params.put("starting_after", listOf(it.toString())) }
3670
params.putAll(additionalQueryParams)
3771
return params.toUnmodifiable()
@@ -49,27 +83,41 @@ constructor(
4983
}
5084

5185
return other is AccountHolderListParams &&
86+
this.begin == other.begin &&
87+
this.email == other.email &&
88+
this.end == other.end &&
5289
this.endingBefore == other.endingBefore &&
5390
this.externalId == other.externalId &&
91+
this.firstName == other.firstName &&
92+
this.lastName == other.lastName &&
93+
this.legalBusinessName == other.legalBusinessName &&
5494
this.limit == other.limit &&
95+
this.phoneNumber == other.phoneNumber &&
5596
this.startingAfter == other.startingAfter &&
5697
this.additionalQueryParams == other.additionalQueryParams &&
5798
this.additionalHeaders == other.additionalHeaders
5899
}
59100

60101
override fun hashCode(): Int {
61102
return Objects.hash(
103+
begin,
104+
email,
105+
end,
62106
endingBefore,
63107
externalId,
108+
firstName,
109+
lastName,
110+
legalBusinessName,
64111
limit,
112+
phoneNumber,
65113
startingAfter,
66114
additionalQueryParams,
67115
additionalHeaders,
68116
)
69117
}
70118

71119
override fun toString() =
72-
"AccountHolderListParams{endingBefore=$endingBefore, externalId=$externalId, limit=$limit, startingAfter=$startingAfter, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders}"
120+
"AccountHolderListParams{begin=$begin, email=$email, end=$end, endingBefore=$endingBefore, externalId=$externalId, firstName=$firstName, lastName=$lastName, legalBusinessName=$legalBusinessName, limit=$limit, phoneNumber=$phoneNumber, startingAfter=$startingAfter, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders}"
73121

74122
fun toBuilder() = Builder().from(this)
75123

@@ -81,23 +129,54 @@ constructor(
81129
@NoAutoDetect
82130
class Builder {
83131

132+
private var begin: OffsetDateTime? = null
133+
private var email: String? = null
134+
private var end: OffsetDateTime? = null
84135
private var endingBefore: String? = null
85136
private var externalId: String? = null
137+
private var firstName: String? = null
138+
private var lastName: String? = null
139+
private var legalBusinessName: String? = null
86140
private var limit: Long? = null
141+
private var phoneNumber: String? = null
87142
private var startingAfter: String? = null
88143
private var additionalQueryParams: MutableMap<String, MutableList<String>> = mutableMapOf()
89144
private var additionalHeaders: MutableMap<String, MutableList<String>> = mutableMapOf()
90145

91146
@JvmSynthetic
92147
internal fun from(accountHolderListParams: AccountHolderListParams) = apply {
148+
this.begin = accountHolderListParams.begin
149+
this.email = accountHolderListParams.email
150+
this.end = accountHolderListParams.end
93151
this.endingBefore = accountHolderListParams.endingBefore
94152
this.externalId = accountHolderListParams.externalId
153+
this.firstName = accountHolderListParams.firstName
154+
this.lastName = accountHolderListParams.lastName
155+
this.legalBusinessName = accountHolderListParams.legalBusinessName
95156
this.limit = accountHolderListParams.limit
157+
this.phoneNumber = accountHolderListParams.phoneNumber
96158
this.startingAfter = accountHolderListParams.startingAfter
97159
additionalQueryParams(accountHolderListParams.additionalQueryParams)
98160
additionalHeaders(accountHolderListParams.additionalHeaders)
99161
}
100162

163+
/**
164+
* Date string in RFC 3339 format. Only entries created after the specified time will be
165+
* included. UTC time zone.
166+
*/
167+
fun begin(begin: OffsetDateTime) = apply { this.begin = begin }
168+
169+
/**
170+
* Email address of the account holder. The query must be an exact match, case insensitive.
171+
*/
172+
fun email(email: String) = apply { this.email = email }
173+
174+
/**
175+
* Date string in RFC 3339 format. Only entries created before the specified time will be
176+
* included. UTC time zone.
177+
*/
178+
fun end(end: OffsetDateTime) = apply { this.end = end }
179+
101180
/**
102181
* A cursor representing an item's token before which a page of results should end. Used to
103182
* retrieve the previous page of results before this item.
@@ -107,9 +186,32 @@ constructor(
107186
/** If applicable, represents the external_id associated with the account_holder. */
108187
fun externalId(externalId: String) = apply { this.externalId = externalId }
109188

189+
/**
190+
* (Individual Account Holders only) The first name of the account holder. The query is case
191+
* insensitive and supports partial matches.
192+
*/
193+
fun firstName(firstName: String) = apply { this.firstName = firstName }
194+
195+
/**
196+
* (Individual Account Holders only) The last name of the account holder. The query is case
197+
* insensitive and supports partial matches.
198+
*/
199+
fun lastName(lastName: String) = apply { this.lastName = lastName }
200+
201+
/**
202+
* (Business Account Holders only) The legal business name of the account holder. The query
203+
* is case insensitive and supports partial matches.
204+
*/
205+
fun legalBusinessName(legalBusinessName: String) = apply {
206+
this.legalBusinessName = legalBusinessName
207+
}
208+
110209
/** The number of account_holders to limit the response to. */
111210
fun limit(limit: Long) = apply { this.limit = limit }
112211

212+
/** Phone number of the account holder. The query must be an exact match. */
213+
fun phoneNumber(phoneNumber: String) = apply { this.phoneNumber = phoneNumber }
214+
113215
/**
114216
* A cursor representing an item's token after which a page of results should begin. Used to
115217
* retrieve the next page of results after this item.
@@ -158,9 +260,16 @@ constructor(
158260

159261
fun build(): AccountHolderListParams =
160262
AccountHolderListParams(
263+
begin,
264+
email,
265+
end,
161266
endingBefore,
162267
externalId,
268+
firstName,
269+
lastName,
270+
legalBusinessName,
163271
limit,
272+
phoneNumber,
164273
startingAfter,
165274
additionalQueryParams.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(),
166275
additionalHeaders.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(),

0 commit comments

Comments
 (0)