Skip to content

Commit a5f5b59

Browse files
feat(api): add property next_payment_end_date and next_payment_due_date to Statement model (#280)
1 parent 2608aba commit a5f5b59

3 files changed

Lines changed: 64 additions & 1 deletion

File tree

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

Lines changed: 56 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import com.lithic.api.errors.LithicInvalidDataException
1818
import java.time.LocalDate
1919
import java.time.OffsetDateTime
2020
import java.util.Objects
21+
import java.util.Optional
2122

2223
@JsonDeserialize(builder = Statement.Builder::class)
2324
@NoAutoDetect
@@ -27,7 +28,9 @@ private constructor(
2728
private val financialAccountToken: JsonField<String>,
2829
private val statementStartDate: JsonField<LocalDate>,
2930
private val statementEndDate: JsonField<LocalDate>,
31+
private val nextStatementEndDate: JsonField<LocalDate>,
3032
private val paymentDueDate: JsonField<LocalDate>,
33+
private val nextPaymentDueDate: JsonField<LocalDate>,
3134
private val daysInBillingCycle: JsonField<Long>,
3235
private val creditLimit: JsonField<Long>,
3336
private val availableCredit: JsonField<Long>,
@@ -61,9 +64,17 @@ private constructor(
6164
/** Date when the billing period ended */
6265
fun statementEndDate(): LocalDate = statementEndDate.getRequired("statement_end_date")
6366

67+
/** Date when the next billing period will end */
68+
fun nextStatementEndDate(): Optional<LocalDate> =
69+
Optional.ofNullable(nextStatementEndDate.getNullable("next_statement_end_date"))
70+
6471
/** Date when the payment is due */
6572
fun paymentDueDate(): LocalDate = paymentDueDate.getRequired("payment_due_date")
6673

74+
/** Date when the next payment is due */
75+
fun nextPaymentDueDate(): Optional<LocalDate> =
76+
Optional.ofNullable(nextPaymentDueDate.getNullable("next_payment_due_date"))
77+
6778
/** Number of days in the billing cycle */
6879
fun daysInBillingCycle(): Long = daysInBillingCycle.getRequired("days_in_billing_cycle")
6980

@@ -126,9 +137,19 @@ private constructor(
126137
/** Date when the billing period ended */
127138
@JsonProperty("statement_end_date") @ExcludeMissing fun _statementEndDate() = statementEndDate
128139

140+
/** Date when the next billing period will end */
141+
@JsonProperty("next_statement_end_date")
142+
@ExcludeMissing
143+
fun _nextStatementEndDate() = nextStatementEndDate
144+
129145
/** Date when the payment is due */
130146
@JsonProperty("payment_due_date") @ExcludeMissing fun _paymentDueDate() = paymentDueDate
131147

148+
/** Date when the next payment is due */
149+
@JsonProperty("next_payment_due_date")
150+
@ExcludeMissing
151+
fun _nextPaymentDueDate() = nextPaymentDueDate
152+
132153
/** Number of days in the billing cycle */
133154
@JsonProperty("days_in_billing_cycle")
134155
@ExcludeMissing
@@ -189,7 +210,9 @@ private constructor(
189210
financialAccountToken()
190211
statementStartDate()
191212
statementEndDate()
213+
nextStatementEndDate()
192214
paymentDueDate()
215+
nextPaymentDueDate()
193216
daysInBillingCycle()
194217
creditLimit()
195218
availableCredit()
@@ -219,7 +242,9 @@ private constructor(
219242
this.financialAccountToken == other.financialAccountToken &&
220243
this.statementStartDate == other.statementStartDate &&
221244
this.statementEndDate == other.statementEndDate &&
245+
this.nextStatementEndDate == other.nextStatementEndDate &&
222246
this.paymentDueDate == other.paymentDueDate &&
247+
this.nextPaymentDueDate == other.nextPaymentDueDate &&
223248
this.daysInBillingCycle == other.daysInBillingCycle &&
224249
this.creditLimit == other.creditLimit &&
225250
this.availableCredit == other.availableCredit &&
@@ -244,7 +269,9 @@ private constructor(
244269
financialAccountToken,
245270
statementStartDate,
246271
statementEndDate,
272+
nextStatementEndDate,
247273
paymentDueDate,
274+
nextPaymentDueDate,
248275
daysInBillingCycle,
249276
creditLimit,
250277
availableCredit,
@@ -265,7 +292,7 @@ private constructor(
265292
}
266293

267294
override fun toString() =
268-
"Statement{token=$token, financialAccountToken=$financialAccountToken, statementStartDate=$statementStartDate, statementEndDate=$statementEndDate, paymentDueDate=$paymentDueDate, daysInBillingCycle=$daysInBillingCycle, creditLimit=$creditLimit, availableCredit=$availableCredit, startingBalance=$startingBalance, endingBalance=$endingBalance, amountDue=$amountDue, amountPastDue=$amountPastDue, periodTotals=$periodTotals, ytdTotals=$ytdTotals, created=$created, updated=$updated, creditProductToken=$creditProductToken, accountStanding=$accountStanding, additionalProperties=$additionalProperties}"
295+
"Statement{token=$token, financialAccountToken=$financialAccountToken, statementStartDate=$statementStartDate, statementEndDate=$statementEndDate, nextStatementEndDate=$nextStatementEndDate, paymentDueDate=$paymentDueDate, nextPaymentDueDate=$nextPaymentDueDate, daysInBillingCycle=$daysInBillingCycle, creditLimit=$creditLimit, availableCredit=$availableCredit, startingBalance=$startingBalance, endingBalance=$endingBalance, amountDue=$amountDue, amountPastDue=$amountPastDue, periodTotals=$periodTotals, ytdTotals=$ytdTotals, created=$created, updated=$updated, creditProductToken=$creditProductToken, accountStanding=$accountStanding, additionalProperties=$additionalProperties}"
269296

270297
companion object {
271298

@@ -278,7 +305,9 @@ private constructor(
278305
private var financialAccountToken: JsonField<String> = JsonMissing.of()
279306
private var statementStartDate: JsonField<LocalDate> = JsonMissing.of()
280307
private var statementEndDate: JsonField<LocalDate> = JsonMissing.of()
308+
private var nextStatementEndDate: JsonField<LocalDate> = JsonMissing.of()
281309
private var paymentDueDate: JsonField<LocalDate> = JsonMissing.of()
310+
private var nextPaymentDueDate: JsonField<LocalDate> = JsonMissing.of()
282311
private var daysInBillingCycle: JsonField<Long> = JsonMissing.of()
283312
private var creditLimit: JsonField<Long> = JsonMissing.of()
284313
private var availableCredit: JsonField<Long> = JsonMissing.of()
@@ -300,7 +329,9 @@ private constructor(
300329
this.financialAccountToken = statement.financialAccountToken
301330
this.statementStartDate = statement.statementStartDate
302331
this.statementEndDate = statement.statementEndDate
332+
this.nextStatementEndDate = statement.nextStatementEndDate
303333
this.paymentDueDate = statement.paymentDueDate
334+
this.nextPaymentDueDate = statement.nextPaymentDueDate
304335
this.daysInBillingCycle = statement.daysInBillingCycle
305336
this.creditLimit = statement.creditLimit
306337
this.availableCredit = statement.availableCredit
@@ -358,6 +389,17 @@ private constructor(
358389
this.statementEndDate = statementEndDate
359390
}
360391

392+
/** Date when the next billing period will end */
393+
fun nextStatementEndDate(nextStatementEndDate: LocalDate) =
394+
nextStatementEndDate(JsonField.of(nextStatementEndDate))
395+
396+
/** Date when the next billing period will end */
397+
@JsonProperty("next_statement_end_date")
398+
@ExcludeMissing
399+
fun nextStatementEndDate(nextStatementEndDate: JsonField<LocalDate>) = apply {
400+
this.nextStatementEndDate = nextStatementEndDate
401+
}
402+
361403
/** Date when the payment is due */
362404
fun paymentDueDate(paymentDueDate: LocalDate) = paymentDueDate(JsonField.of(paymentDueDate))
363405

@@ -368,6 +410,17 @@ private constructor(
368410
this.paymentDueDate = paymentDueDate
369411
}
370412

413+
/** Date when the next payment is due */
414+
fun nextPaymentDueDate(nextPaymentDueDate: LocalDate) =
415+
nextPaymentDueDate(JsonField.of(nextPaymentDueDate))
416+
417+
/** Date when the next payment is due */
418+
@JsonProperty("next_payment_due_date")
419+
@ExcludeMissing
420+
fun nextPaymentDueDate(nextPaymentDueDate: JsonField<LocalDate>) = apply {
421+
this.nextPaymentDueDate = nextPaymentDueDate
422+
}
423+
371424
/** Number of days in the billing cycle */
372425
fun daysInBillingCycle(daysInBillingCycle: Long) =
373426
daysInBillingCycle(JsonField.of(daysInBillingCycle))
@@ -525,7 +578,9 @@ private constructor(
525578
financialAccountToken,
526579
statementStartDate,
527580
statementEndDate,
581+
nextStatementEndDate,
528582
paymentDueDate,
583+
nextPaymentDueDate,
529584
daysInBillingCycle,
530585
creditLimit,
531586
availableCredit,

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ class StatementTest {
5656
.purchases(123L)
5757
.build()
5858
)
59+
.nextPaymentDueDate(LocalDate.parse("2019-12-27"))
60+
.nextStatementEndDate(LocalDate.parse("2019-12-27"))
5961
.build()
6062
assertThat(statement).isNotNull
6163
assertThat(statement.token()).isEqualTo("token")
@@ -105,5 +107,7 @@ class StatementTest {
105107
.purchases(123L)
106108
.build()
107109
)
110+
assertThat(statement.nextPaymentDueDate()).contains(LocalDate.parse("2019-12-27"))
111+
assertThat(statement.nextStatementEndDate()).contains(LocalDate.parse("2019-12-27"))
108112
}
109113
}

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@ class StatementsTest {
5959
.purchases(123L)
6060
.build()
6161
)
62+
.nextPaymentDueDate(LocalDate.parse("2019-12-27"))
63+
.nextStatementEndDate(LocalDate.parse("2019-12-27"))
6264
.build()
6365
)
6466
)
@@ -111,6 +113,8 @@ class StatementsTest {
111113
.purchases(123L)
112114
.build()
113115
)
116+
.nextPaymentDueDate(LocalDate.parse("2019-12-27"))
117+
.nextStatementEndDate(LocalDate.parse("2019-12-27"))
114118
.build()
115119
)
116120
assertThat(statements.hasMore()).isEqualTo(true)

0 commit comments

Comments
 (0)