Skip to content

Commit 14d2b12

Browse files
feat(api): add SettlementReport property is_complete (#274)
1 parent 7b59cf8 commit 14d2b12

2 files changed

Lines changed: 25 additions & 1 deletion

File tree

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

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import com.lithic.api.core.NoAutoDetect
1414
import com.lithic.api.core.toUnmodifiable
1515
import java.time.OffsetDateTime
1616
import java.util.Objects
17+
import java.util.Optional
1718

1819
@JsonDeserialize(builder = SettlementReport.Builder::class)
1920
@NoAutoDetect
@@ -24,6 +25,7 @@ private constructor(
2425
private val details: JsonField<List<SettlementSummaryDetails>>,
2526
private val disputesGrossAmount: JsonField<Long>,
2627
private val interchangeGrossAmount: JsonField<Long>,
28+
private val isComplete: JsonField<Boolean>,
2729
private val otherFeesGrossAmount: JsonField<Long>,
2830
private val reportDate: JsonField<String>,
2931
private val settledNetAmount: JsonField<Long>,
@@ -51,6 +53,9 @@ private constructor(
5153
fun interchangeGrossAmount(): Long =
5254
interchangeGrossAmount.getRequired("interchange_gross_amount")
5355

56+
/** Indicates that all data expected on the given report date is available. */
57+
fun isComplete(): Optional<Boolean> = Optional.ofNullable(isComplete.getNullable("is_complete"))
58+
5459
/** Total amount of gross other fees outside of interchange. */
5560
fun otherFeesGrossAmount(): Long = otherFeesGrossAmount.getRequired("other_fees_gross_amount")
5661

@@ -90,6 +95,9 @@ private constructor(
9095
@ExcludeMissing
9196
fun _interchangeGrossAmount() = interchangeGrossAmount
9297

98+
/** Indicates that all data expected on the given report date is available. */
99+
@JsonProperty("is_complete") @ExcludeMissing fun _isComplete() = isComplete
100+
93101
/** Total amount of gross other fees outside of interchange. */
94102
@JsonProperty("other_fees_gross_amount")
95103
@ExcludeMissing
@@ -125,6 +133,7 @@ private constructor(
125133
details().forEach { it.validate() }
126134
disputesGrossAmount()
127135
interchangeGrossAmount()
136+
isComplete()
128137
otherFeesGrossAmount()
129138
reportDate()
130139
settledNetAmount()
@@ -147,6 +156,7 @@ private constructor(
147156
this.details == other.details &&
148157
this.disputesGrossAmount == other.disputesGrossAmount &&
149158
this.interchangeGrossAmount == other.interchangeGrossAmount &&
159+
this.isComplete == other.isComplete &&
150160
this.otherFeesGrossAmount == other.otherFeesGrossAmount &&
151161
this.reportDate == other.reportDate &&
152162
this.settledNetAmount == other.settledNetAmount &&
@@ -164,6 +174,7 @@ private constructor(
164174
details,
165175
disputesGrossAmount,
166176
interchangeGrossAmount,
177+
isComplete,
167178
otherFeesGrossAmount,
168179
reportDate,
169180
settledNetAmount,
@@ -176,7 +187,7 @@ private constructor(
176187
}
177188

178189
override fun toString() =
179-
"SettlementReport{created=$created, currency=$currency, details=$details, disputesGrossAmount=$disputesGrossAmount, interchangeGrossAmount=$interchangeGrossAmount, otherFeesGrossAmount=$otherFeesGrossAmount, reportDate=$reportDate, settledNetAmount=$settledNetAmount, transactionsGrossAmount=$transactionsGrossAmount, updated=$updated, additionalProperties=$additionalProperties}"
190+
"SettlementReport{created=$created, currency=$currency, details=$details, disputesGrossAmount=$disputesGrossAmount, interchangeGrossAmount=$interchangeGrossAmount, isComplete=$isComplete, otherFeesGrossAmount=$otherFeesGrossAmount, reportDate=$reportDate, settledNetAmount=$settledNetAmount, transactionsGrossAmount=$transactionsGrossAmount, updated=$updated, additionalProperties=$additionalProperties}"
180191

181192
companion object {
182193

@@ -190,6 +201,7 @@ private constructor(
190201
private var details: JsonField<List<SettlementSummaryDetails>> = JsonMissing.of()
191202
private var disputesGrossAmount: JsonField<Long> = JsonMissing.of()
192203
private var interchangeGrossAmount: JsonField<Long> = JsonMissing.of()
204+
private var isComplete: JsonField<Boolean> = JsonMissing.of()
193205
private var otherFeesGrossAmount: JsonField<Long> = JsonMissing.of()
194206
private var reportDate: JsonField<String> = JsonMissing.of()
195207
private var settledNetAmount: JsonField<Long> = JsonMissing.of()
@@ -204,6 +216,7 @@ private constructor(
204216
this.details = settlementReport.details
205217
this.disputesGrossAmount = settlementReport.disputesGrossAmount
206218
this.interchangeGrossAmount = settlementReport.interchangeGrossAmount
219+
this.isComplete = settlementReport.isComplete
207220
this.otherFeesGrossAmount = settlementReport.otherFeesGrossAmount
208221
this.reportDate = settlementReport.reportDate
209222
this.settledNetAmount = settlementReport.settledNetAmount
@@ -258,6 +271,14 @@ private constructor(
258271
this.interchangeGrossAmount = interchangeGrossAmount
259272
}
260273

274+
/** Indicates that all data expected on the given report date is available. */
275+
fun isComplete(isComplete: Boolean) = isComplete(JsonField.of(isComplete))
276+
277+
/** Indicates that all data expected on the given report date is available. */
278+
@JsonProperty("is_complete")
279+
@ExcludeMissing
280+
fun isComplete(isComplete: JsonField<Boolean>) = apply { this.isComplete = isComplete }
281+
261282
/** Total amount of gross other fees outside of interchange. */
262283
fun otherFeesGrossAmount(otherFeesGrossAmount: Long) =
263284
otherFeesGrossAmount(JsonField.of(otherFeesGrossAmount))
@@ -340,6 +361,7 @@ private constructor(
340361
details.map { it.toUnmodifiable() },
341362
disputesGrossAmount,
342363
interchangeGrossAmount,
364+
isComplete,
343365
otherFeesGrossAmount,
344366
reportDate,
345367
settledNetAmount,

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ class SettlementReportTest {
3434
.settledNetAmount(123L)
3535
.transactionsGrossAmount(123L)
3636
.updated(OffsetDateTime.parse("2023-06-01T00:00:00Z"))
37+
.isComplete(true)
3738
.build()
3839
assertThat(settlementReport).isNotNull
3940
assertThat(settlementReport.created())
@@ -59,5 +60,6 @@ class SettlementReportTest {
5960
assertThat(settlementReport.transactionsGrossAmount()).isEqualTo(123L)
6061
assertThat(settlementReport.updated())
6162
.isEqualTo(OffsetDateTime.parse("2023-06-01T00:00:00Z"))
63+
assertThat(settlementReport.isComplete()).contains(true)
6264
}
6365
}

0 commit comments

Comments
 (0)