Skip to content

Commit 029fe55

Browse files
chore(api): adds replacement_account_token to Card create parameters (#379)
1 parent dc48060 commit 029fe55

5 files changed

Lines changed: 66 additions & 6 deletions

File tree

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

Lines changed: 50 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ constructor(
3232
private val memo: String?,
3333
private val pin: String?,
3434
private val productId: String?,
35+
private val replacementAccountToken: String?,
3536
private val replacementFor: String?,
3637
private val shippingAddress: ShippingAddress?,
3738
private val shippingMethod: ShippingMethod?,
@@ -63,6 +64,8 @@ constructor(
6364

6465
fun productId(): Optional<String> = Optional.ofNullable(productId)
6566

67+
fun replacementAccountToken(): Optional<String> = Optional.ofNullable(replacementAccountToken)
68+
6669
fun replacementFor(): Optional<String> = Optional.ofNullable(replacementFor)
6770

6871
fun shippingAddress(): Optional<ShippingAddress> = Optional.ofNullable(shippingAddress)
@@ -88,6 +91,7 @@ constructor(
8891
memo,
8992
pin,
9093
productId,
94+
replacementAccountToken,
9195
replacementFor,
9296
shippingAddress,
9397
shippingMethod,
@@ -116,6 +120,7 @@ constructor(
116120
private val memo: String?,
117121
private val pin: String?,
118122
private val productId: String?,
123+
private val replacementAccountToken: String?,
119124
private val replacementFor: String?,
120125
private val shippingAddress: ShippingAddress?,
121126
private val shippingMethod: ShippingMethod?,
@@ -194,6 +199,16 @@ constructor(
194199
*/
195200
@JsonProperty("product_id") fun productId(): String? = productId
196201

202+
/**
203+
* Restricted field limited to select use cases. Lithic will reach out directly if this
204+
* field should be used. Globally unique identifier for the replacement card's account. If
205+
* this field is specified, `replacement_for` must also be specified. If `replacement_for`
206+
* is specified and this field is omitted, the replacement card's account will be inferred
207+
* from the card being replaced.
208+
*/
209+
@JsonProperty("replacement_account_token")
210+
fun replacementAccountToken(): String? = replacementAccountToken
211+
197212
/**
198213
* Only applicable to cards of type `PHYSICAL`. Globally unique identifier for the card that
199214
* this physical card will replace.
@@ -268,6 +283,7 @@ constructor(
268283
private var memo: String? = null
269284
private var pin: String? = null
270285
private var productId: String? = null
286+
private var replacementAccountToken: String? = null
271287
private var replacementFor: String? = null
272288
private var shippingAddress: ShippingAddress? = null
273289
private var shippingMethod: ShippingMethod? = null
@@ -288,6 +304,7 @@ constructor(
288304
this.memo = cardCreateBody.memo
289305
this.pin = cardCreateBody.pin
290306
this.productId = cardCreateBody.productId
307+
this.replacementAccountToken = cardCreateBody.replacementAccountToken
291308
this.replacementFor = cardCreateBody.replacementFor
292309
this.shippingAddress = cardCreateBody.shippingAddress
293310
this.shippingMethod = cardCreateBody.shippingMethod
@@ -378,6 +395,18 @@ constructor(
378395
@JsonProperty("product_id")
379396
fun productId(productId: String) = apply { this.productId = productId }
380397

398+
/**
399+
* Restricted field limited to select use cases. Lithic will reach out directly if this
400+
* field should be used. Globally unique identifier for the replacement card's account.
401+
* If this field is specified, `replacement_for` must also be specified. If
402+
* `replacement_for` is specified and this field is omitted, the replacement card's
403+
* account will be inferred from the card being replaced.
404+
*/
405+
@JsonProperty("replacement_account_token")
406+
fun replacementAccountToken(replacementAccountToken: String) = apply {
407+
this.replacementAccountToken = replacementAccountToken
408+
}
409+
381410
/**
382411
* Only applicable to cards of type `PHYSICAL`. Globally unique identifier for the card
383412
* that this physical card will replace.
@@ -470,6 +499,7 @@ constructor(
470499
memo,
471500
pin,
472501
productId,
502+
replacementAccountToken,
473503
replacementFor,
474504
shippingAddress,
475505
shippingMethod,
@@ -485,20 +515,20 @@ constructor(
485515
return true
486516
}
487517

488-
return /* spotless:off */ other is CardCreateBody && this.type == other.type && this.accountToken == other.accountToken && this.cardProgramToken == other.cardProgramToken && this.carrier == other.carrier && this.digitalCardArtToken == other.digitalCardArtToken && this.expMonth == other.expMonth && this.expYear == other.expYear && this.memo == other.memo && this.pin == other.pin && this.productId == other.productId && this.replacementFor == other.replacementFor && this.shippingAddress == other.shippingAddress && this.shippingMethod == other.shippingMethod && this.spendLimit == other.spendLimit && this.spendLimitDuration == other.spendLimitDuration && this.state == other.state && this.additionalProperties == other.additionalProperties /* spotless:on */
518+
return /* spotless:off */ other is CardCreateBody && this.type == other.type && this.accountToken == other.accountToken && this.cardProgramToken == other.cardProgramToken && this.carrier == other.carrier && this.digitalCardArtToken == other.digitalCardArtToken && this.expMonth == other.expMonth && this.expYear == other.expYear && this.memo == other.memo && this.pin == other.pin && this.productId == other.productId && this.replacementAccountToken == other.replacementAccountToken && this.replacementFor == other.replacementFor && this.shippingAddress == other.shippingAddress && this.shippingMethod == other.shippingMethod && this.spendLimit == other.spendLimit && this.spendLimitDuration == other.spendLimitDuration && this.state == other.state && this.additionalProperties == other.additionalProperties /* spotless:on */
489519
}
490520

491521
private var hashCode: Int = 0
492522

493523
override fun hashCode(): Int {
494524
if (hashCode == 0) {
495-
hashCode = /* spotless:off */ Objects.hash(type, accountToken, cardProgramToken, carrier, digitalCardArtToken, expMonth, expYear, memo, pin, productId, replacementFor, shippingAddress, shippingMethod, spendLimit, spendLimitDuration, state, additionalProperties) /* spotless:on */
525+
hashCode = /* spotless:off */ Objects.hash(type, accountToken, cardProgramToken, carrier, digitalCardArtToken, expMonth, expYear, memo, pin, productId, replacementAccountToken, replacementFor, shippingAddress, shippingMethod, spendLimit, spendLimitDuration, state, additionalProperties) /* spotless:on */
496526
}
497527
return hashCode
498528
}
499529

500530
override fun toString() =
501-
"CardCreateBody{type=$type, accountToken=$accountToken, cardProgramToken=$cardProgramToken, carrier=$carrier, digitalCardArtToken=$digitalCardArtToken, expMonth=$expMonth, expYear=$expYear, memo=$memo, pin=$pin, productId=$productId, replacementFor=$replacementFor, shippingAddress=$shippingAddress, shippingMethod=$shippingMethod, spendLimit=$spendLimit, spendLimitDuration=$spendLimitDuration, state=$state, additionalProperties=$additionalProperties}"
531+
"CardCreateBody{type=$type, accountToken=$accountToken, cardProgramToken=$cardProgramToken, carrier=$carrier, digitalCardArtToken=$digitalCardArtToken, expMonth=$expMonth, expYear=$expYear, memo=$memo, pin=$pin, productId=$productId, replacementAccountToken=$replacementAccountToken, replacementFor=$replacementFor, shippingAddress=$shippingAddress, shippingMethod=$shippingMethod, spendLimit=$spendLimit, spendLimitDuration=$spendLimitDuration, state=$state, additionalProperties=$additionalProperties}"
502532
}
503533

504534
fun _additionalHeaders(): Map<String, List<String>> = additionalHeaders
@@ -512,15 +542,15 @@ constructor(
512542
return true
513543
}
514544

515-
return /* spotless:off */ other is CardCreateParams && this.type == other.type && this.accountToken == other.accountToken && this.cardProgramToken == other.cardProgramToken && this.carrier == other.carrier && this.digitalCardArtToken == other.digitalCardArtToken && this.expMonth == other.expMonth && this.expYear == other.expYear && this.memo == other.memo && this.pin == other.pin && this.productId == other.productId && this.replacementFor == other.replacementFor && this.shippingAddress == other.shippingAddress && this.shippingMethod == other.shippingMethod && this.spendLimit == other.spendLimit && this.spendLimitDuration == other.spendLimitDuration && this.state == other.state && this.additionalHeaders == other.additionalHeaders && this.additionalQueryParams == other.additionalQueryParams && this.additionalBodyProperties == other.additionalBodyProperties /* spotless:on */
545+
return /* spotless:off */ other is CardCreateParams && this.type == other.type && this.accountToken == other.accountToken && this.cardProgramToken == other.cardProgramToken && this.carrier == other.carrier && this.digitalCardArtToken == other.digitalCardArtToken && this.expMonth == other.expMonth && this.expYear == other.expYear && this.memo == other.memo && this.pin == other.pin && this.productId == other.productId && this.replacementAccountToken == other.replacementAccountToken && this.replacementFor == other.replacementFor && this.shippingAddress == other.shippingAddress && this.shippingMethod == other.shippingMethod && this.spendLimit == other.spendLimit && this.spendLimitDuration == other.spendLimitDuration && this.state == other.state && this.additionalHeaders == other.additionalHeaders && this.additionalQueryParams == other.additionalQueryParams && this.additionalBodyProperties == other.additionalBodyProperties /* spotless:on */
516546
}
517547

518548
override fun hashCode(): Int {
519-
return /* spotless:off */ Objects.hash(type, accountToken, cardProgramToken, carrier, digitalCardArtToken, expMonth, expYear, memo, pin, productId, replacementFor, shippingAddress, shippingMethod, spendLimit, spendLimitDuration, state, additionalHeaders, additionalQueryParams, additionalBodyProperties) /* spotless:on */
549+
return /* spotless:off */ Objects.hash(type, accountToken, cardProgramToken, carrier, digitalCardArtToken, expMonth, expYear, memo, pin, productId, replacementAccountToken, replacementFor, shippingAddress, shippingMethod, spendLimit, spendLimitDuration, state, additionalHeaders, additionalQueryParams, additionalBodyProperties) /* spotless:on */
520550
}
521551

522552
override fun toString() =
523-
"CardCreateParams{type=$type, accountToken=$accountToken, cardProgramToken=$cardProgramToken, carrier=$carrier, digitalCardArtToken=$digitalCardArtToken, expMonth=$expMonth, expYear=$expYear, memo=$memo, pin=$pin, productId=$productId, replacementFor=$replacementFor, shippingAddress=$shippingAddress, shippingMethod=$shippingMethod, spendLimit=$spendLimit, spendLimitDuration=$spendLimitDuration, state=$state, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams, additionalBodyProperties=$additionalBodyProperties}"
553+
"CardCreateParams{type=$type, accountToken=$accountToken, cardProgramToken=$cardProgramToken, carrier=$carrier, digitalCardArtToken=$digitalCardArtToken, expMonth=$expMonth, expYear=$expYear, memo=$memo, pin=$pin, productId=$productId, replacementAccountToken=$replacementAccountToken, replacementFor=$replacementFor, shippingAddress=$shippingAddress, shippingMethod=$shippingMethod, spendLimit=$spendLimit, spendLimitDuration=$spendLimitDuration, state=$state, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams, additionalBodyProperties=$additionalBodyProperties}"
524554

525555
fun toBuilder() = Builder().from(this)
526556

@@ -542,6 +572,7 @@ constructor(
542572
private var memo: String? = null
543573
private var pin: String? = null
544574
private var productId: String? = null
575+
private var replacementAccountToken: String? = null
545576
private var replacementFor: String? = null
546577
private var shippingAddress: ShippingAddress? = null
547578
private var shippingMethod: ShippingMethod? = null
@@ -564,6 +595,7 @@ constructor(
564595
this.memo = cardCreateParams.memo
565596
this.pin = cardCreateParams.pin
566597
this.productId = cardCreateParams.productId
598+
this.replacementAccountToken = cardCreateParams.replacementAccountToken
567599
this.replacementFor = cardCreateParams.replacementFor
568600
this.shippingAddress = cardCreateParams.shippingAddress
569601
this.shippingMethod = cardCreateParams.shippingMethod
@@ -647,6 +679,17 @@ constructor(
647679
*/
648680
fun productId(productId: String) = apply { this.productId = productId }
649681

682+
/**
683+
* Restricted field limited to select use cases. Lithic will reach out directly if this
684+
* field should be used. Globally unique identifier for the replacement card's account. If
685+
* this field is specified, `replacement_for` must also be specified. If `replacement_for`
686+
* is specified and this field is omitted, the replacement card's account will be inferred
687+
* from the card being replaced.
688+
*/
689+
fun replacementAccountToken(replacementAccountToken: String) = apply {
690+
this.replacementAccountToken = replacementAccountToken
691+
}
692+
650693
/**
651694
* Only applicable to cards of type `PHYSICAL`. Globally unique identifier for the card that
652695
* this physical card will replace.
@@ -803,6 +846,7 @@ constructor(
803846
memo,
804847
pin,
805848
productId,
849+
replacementAccountToken,
806850
replacementFor,
807851
shippingAddress,
808852
shippingMethod,

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ class CardCreateParamsTest {
2121
.memo("New Card")
2222
.pin("pin")
2323
.productId("1")
24+
.replacementAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
2425
.replacementFor("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
2526
.shippingAddress(
2627
ShippingAddress.builder()
@@ -58,6 +59,7 @@ class CardCreateParamsTest {
5859
.memo("New Card")
5960
.pin("pin")
6061
.productId("1")
62+
.replacementAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
6163
.replacementFor("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
6264
.shippingAddress(
6365
ShippingAddress.builder()
@@ -91,6 +93,7 @@ class CardCreateParamsTest {
9193
assertThat(body.memo()).isEqualTo("New Card")
9294
assertThat(body.pin()).isEqualTo("pin")
9395
assertThat(body.productId()).isEqualTo("1")
96+
assertThat(body.replacementAccountToken()).isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
9497
assertThat(body.replacementFor()).isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
9598
assertThat(body.shippingAddress())
9699
.isEqualTo(

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

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ class ErrorHandlingTest {
7070
.memo("New Card")
7171
.pin("pin")
7272
.productId("1")
73+
.replacementAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
7374
.replacementFor("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
7475
.shippingAddress(
7576
ShippingAddress.builder()
@@ -147,6 +148,7 @@ class ErrorHandlingTest {
147148
.memo("New Card")
148149
.pin("pin")
149150
.productId("1")
151+
.replacementAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
150152
.replacementFor("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
151153
.shippingAddress(
152154
ShippingAddress.builder()
@@ -194,6 +196,7 @@ class ErrorHandlingTest {
194196
.memo("New Card")
195197
.pin("pin")
196198
.productId("1")
199+
.replacementAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
197200
.replacementFor("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
198201
.shippingAddress(
199202
ShippingAddress.builder()
@@ -241,6 +244,7 @@ class ErrorHandlingTest {
241244
.memo("New Card")
242245
.pin("pin")
243246
.productId("1")
247+
.replacementAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
244248
.replacementFor("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
245249
.shippingAddress(
246250
ShippingAddress.builder()
@@ -288,6 +292,7 @@ class ErrorHandlingTest {
288292
.memo("New Card")
289293
.pin("pin")
290294
.productId("1")
295+
.replacementAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
291296
.replacementFor("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
292297
.shippingAddress(
293298
ShippingAddress.builder()
@@ -335,6 +340,7 @@ class ErrorHandlingTest {
335340
.memo("New Card")
336341
.pin("pin")
337342
.productId("1")
343+
.replacementAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
338344
.replacementFor("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
339345
.shippingAddress(
340346
ShippingAddress.builder()
@@ -382,6 +388,7 @@ class ErrorHandlingTest {
382388
.memo("New Card")
383389
.pin("pin")
384390
.productId("1")
391+
.replacementAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
385392
.replacementFor("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
386393
.shippingAddress(
387394
ShippingAddress.builder()
@@ -429,6 +436,7 @@ class ErrorHandlingTest {
429436
.memo("New Card")
430437
.pin("pin")
431438
.productId("1")
439+
.replacementAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
432440
.replacementFor("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
433441
.shippingAddress(
434442
ShippingAddress.builder()
@@ -476,6 +484,7 @@ class ErrorHandlingTest {
476484
.memo("New Card")
477485
.pin("pin")
478486
.productId("1")
487+
.replacementAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
479488
.replacementFor("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
480489
.shippingAddress(
481490
ShippingAddress.builder()
@@ -528,6 +537,7 @@ class ErrorHandlingTest {
528537
.memo("New Card")
529538
.pin("pin")
530539
.productId("1")
540+
.replacementAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
531541
.replacementFor("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
532542
.shippingAddress(
533543
ShippingAddress.builder()
@@ -574,6 +584,7 @@ class ErrorHandlingTest {
574584
.memo("New Card")
575585
.pin("pin")
576586
.productId("1")
587+
.replacementAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
577588
.replacementFor("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
578589
.shippingAddress(
579590
ShippingAddress.builder()

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ class ServiceParamsTest {
6868
.memo("New Card")
6969
.pin("pin")
7070
.productId("1")
71+
.replacementAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
7172
.replacementFor("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
7273
.shippingAddress(
7374
ShippingAddress.builder()

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ class CardServiceTest {
3434
.memo("New Card")
3535
.pin("pin")
3636
.productId("1")
37+
.replacementAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
3738
.replacementFor("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
3839
.shippingAddress(
3940
ShippingAddress.builder()

0 commit comments

Comments
 (0)