Skip to content

Commit ac4d410

Browse files
chore(api): release of Network Totals reporting and new filters for Velocity Limit Rules (#529)
- Network Totals reports are now available - adds `exclude_countries` and `exclude_mccs` filters to Auth Velocity Limit Rules
1 parent ea458b2 commit ac4d410

8 files changed

Lines changed: 129 additions & 35 deletions

File tree

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

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,7 @@ import java.util.stream.Stream
2020
import java.util.stream.StreamSupport
2121
import kotlin.jvm.optionals.getOrNull
2222

23-
/**
24-
* (Available March 4, 2025) List network total records with optional filters. Not available in
25-
* sandbox.
26-
*/
23+
/** List network total records with optional filters. Not available in sandbox. */
2724
class ReportSettlementNetworkTotalListPage
2825
private constructor(
2926
private val networkTotalsService: NetworkTotalService,

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

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,7 @@ import java.util.concurrent.CompletableFuture
2020
import java.util.concurrent.Executor
2121
import java.util.function.Predicate
2222

23-
/**
24-
* (Available March 4, 2025) List network total records with optional filters. Not available in
25-
* sandbox.
26-
*/
23+
/** List network total records with optional filters. Not available in sandbox. */
2724
class ReportSettlementNetworkTotalListPageAsync
2825
private constructor(
2926
private val networkTotalsService: NetworkTotalServiceAsync,

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

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,7 @@ import java.util.Objects
1717
import java.util.Optional
1818
import kotlin.jvm.optionals.getOrNull
1919

20-
/**
21-
* (Available March 4, 2025) List network total records with optional filters. Not available in
22-
* sandbox.
23-
*/
20+
/** List network total records with optional filters. Not available in sandbox. */
2421
class ReportSettlementNetworkTotalListParams
2522
private constructor(
2623
private val begin: OffsetDateTime?,

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

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,7 @@ import com.lithic.api.core.http.Headers
99
import com.lithic.api.core.http.QueryParams
1010
import java.util.Objects
1111

12-
/**
13-
* (Available March 4, 2025) Retrieve a specific network total record by token. Not available in
14-
* sandbox.
15-
*/
12+
/** Retrieve a specific network total record by token. Not available in sandbox. */
1613
class ReportSettlementNetworkTotalRetrieveParams
1714
private constructor(
1815
private val token: String,

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

Lines changed: 117 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,12 @@ private constructor(
285285
class Filters
286286
@JsonCreator
287287
private constructor(
288+
@JsonProperty("exclude_countries")
289+
@ExcludeMissing
290+
private val excludeCountries: JsonField<List<String>> = JsonMissing.of(),
291+
@JsonProperty("exclude_mccs")
292+
@ExcludeMissing
293+
private val excludeMccs: JsonField<List<String>> = JsonMissing.of(),
288294
@JsonProperty("include_countries")
289295
@ExcludeMissing
290296
private val includeCountries: JsonField<List<String>> = JsonMissing.of(),
@@ -295,6 +301,20 @@ private constructor(
295301
private val additionalProperties: Map<String, JsonValue> = immutableEmptyMap(),
296302
) {
297303

304+
/**
305+
* ISO-3166-1 alpha-3 Country Codes to exclude from the velocity calculation. Transactions
306+
* matching any of the provided will be excluded from the calculated velocity.
307+
*/
308+
fun excludeCountries(): Optional<List<String>> =
309+
Optional.ofNullable(excludeCountries.getNullable("exclude_countries"))
310+
311+
/**
312+
* Merchant Category Codes to exclude from the velocity calculation. Transactions matching
313+
* this MCC will be excluded from the calculated velocity.
314+
*/
315+
fun excludeMccs(): Optional<List<String>> =
316+
Optional.ofNullable(excludeMccs.getNullable("exclude_mccs"))
317+
298318
/**
299319
* ISO-3166-1 alpha-3 Country Codes to include in the velocity calculation. Transactions not
300320
* matching any of the provided will not be included in the calculated velocity.
@@ -309,6 +329,22 @@ private constructor(
309329
fun includeMccs(): Optional<List<String>> =
310330
Optional.ofNullable(includeMccs.getNullable("include_mccs"))
311331

332+
/**
333+
* ISO-3166-1 alpha-3 Country Codes to exclude from the velocity calculation. Transactions
334+
* matching any of the provided will be excluded from the calculated velocity.
335+
*/
336+
@JsonProperty("exclude_countries")
337+
@ExcludeMissing
338+
fun _excludeCountries(): JsonField<List<String>> = excludeCountries
339+
340+
/**
341+
* Merchant Category Codes to exclude from the velocity calculation. Transactions matching
342+
* this MCC will be excluded from the calculated velocity.
343+
*/
344+
@JsonProperty("exclude_mccs")
345+
@ExcludeMissing
346+
fun _excludeMccs(): JsonField<List<String>> = excludeMccs
347+
312348
/**
313349
* ISO-3166-1 alpha-3 Country Codes to include in the velocity calculation. Transactions not
314350
* matching any of the provided will not be included in the calculated velocity.
@@ -336,6 +372,8 @@ private constructor(
336372
return@apply
337373
}
338374

375+
excludeCountries()
376+
excludeMccs()
339377
includeCountries()
340378
includeMccs()
341379
validated = true
@@ -352,17 +390,91 @@ private constructor(
352390
/** A builder for [Filters]. */
353391
class Builder internal constructor() {
354392

393+
private var excludeCountries: JsonField<MutableList<String>>? = null
394+
private var excludeMccs: JsonField<MutableList<String>>? = null
355395
private var includeCountries: JsonField<MutableList<String>>? = null
356396
private var includeMccs: JsonField<MutableList<String>>? = null
357397
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()
358398

359399
@JvmSynthetic
360400
internal fun from(filters: Filters) = apply {
401+
excludeCountries = filters.excludeCountries.map { it.toMutableList() }
402+
excludeMccs = filters.excludeMccs.map { it.toMutableList() }
361403
includeCountries = filters.includeCountries.map { it.toMutableList() }
362404
includeMccs = filters.includeMccs.map { it.toMutableList() }
363405
additionalProperties = filters.additionalProperties.toMutableMap()
364406
}
365407

408+
/**
409+
* ISO-3166-1 alpha-3 Country Codes to exclude from the velocity calculation.
410+
* Transactions matching any of the provided will be excluded from the calculated
411+
* velocity.
412+
*/
413+
fun excludeCountries(excludeCountries: List<String>?) =
414+
excludeCountries(JsonField.ofNullable(excludeCountries))
415+
416+
/**
417+
* ISO-3166-1 alpha-3 Country Codes to exclude from the velocity calculation.
418+
* Transactions matching any of the provided will be excluded from the calculated
419+
* velocity.
420+
*/
421+
fun excludeCountries(excludeCountries: Optional<List<String>>) =
422+
excludeCountries(excludeCountries.getOrNull())
423+
424+
/**
425+
* ISO-3166-1 alpha-3 Country Codes to exclude from the velocity calculation.
426+
* Transactions matching any of the provided will be excluded from the calculated
427+
* velocity.
428+
*/
429+
fun excludeCountries(excludeCountries: JsonField<List<String>>) = apply {
430+
this.excludeCountries = excludeCountries.map { it.toMutableList() }
431+
}
432+
433+
/**
434+
* ISO-3166-1 alpha-3 Country Codes to exclude from the velocity calculation.
435+
* Transactions matching any of the provided will be excluded from the calculated
436+
* velocity.
437+
*/
438+
fun addExcludeCountry(excludeCountry: String) = apply {
439+
excludeCountries =
440+
(excludeCountries ?: JsonField.of(mutableListOf())).also {
441+
checkKnown("excludeCountries", it).add(excludeCountry)
442+
}
443+
}
444+
445+
/**
446+
* Merchant Category Codes to exclude from the velocity calculation. Transactions
447+
* matching this MCC will be excluded from the calculated velocity.
448+
*/
449+
fun excludeMccs(excludeMccs: List<String>?) =
450+
excludeMccs(JsonField.ofNullable(excludeMccs))
451+
452+
/**
453+
* Merchant Category Codes to exclude from the velocity calculation. Transactions
454+
* matching this MCC will be excluded from the calculated velocity.
455+
*/
456+
fun excludeMccs(excludeMccs: Optional<List<String>>) =
457+
excludeMccs(excludeMccs.getOrNull())
458+
459+
/**
460+
* Merchant Category Codes to exclude from the velocity calculation. Transactions
461+
* matching this MCC will be excluded from the calculated velocity.
462+
*/
463+
fun excludeMccs(excludeMccs: JsonField<List<String>>) = apply {
464+
this.excludeMccs = excludeMccs.map { it.toMutableList() }
465+
}
466+
467+
/**
468+
* Merchant Category Codes to exclude from the velocity calculation. Transactions
469+
* matching this MCC will be excluded from the calculated velocity.
470+
*/
471+
fun addExcludeMcc(excludeMcc: String) = apply {
472+
excludeMccs =
473+
(excludeMccs ?: JsonField.of(mutableListOf())).also {
474+
checkKnown("excludeMccs", it).add(excludeMcc)
475+
}
476+
}
477+
366478
/**
367479
* ISO-3166-1 alpha-3 Country Codes to include in the velocity calculation. Transactions
368480
* not matching any of the provided will not be included in the calculated velocity.
@@ -450,6 +562,8 @@ private constructor(
450562

451563
fun build(): Filters =
452564
Filters(
565+
(excludeCountries ?: JsonMissing.of()).map { it.toImmutable() },
566+
(excludeMccs ?: JsonMissing.of()).map { it.toImmutable() },
453567
(includeCountries ?: JsonMissing.of()).map { it.toImmutable() },
454568
(includeMccs ?: JsonMissing.of()).map { it.toImmutable() },
455569
additionalProperties.toImmutable(),
@@ -461,17 +575,17 @@ private constructor(
461575
return true
462576
}
463577

464-
return /* spotless:off */ other is Filters && includeCountries == other.includeCountries && includeMccs == other.includeMccs && additionalProperties == other.additionalProperties /* spotless:on */
578+
return /* spotless:off */ other is Filters && excludeCountries == other.excludeCountries && excludeMccs == other.excludeMccs && includeCountries == other.includeCountries && includeMccs == other.includeMccs && additionalProperties == other.additionalProperties /* spotless:on */
465579
}
466580

467581
/* spotless:off */
468-
private val hashCode: Int by lazy { Objects.hash(includeCountries, includeMccs, additionalProperties) }
582+
private val hashCode: Int by lazy { Objects.hash(excludeCountries, excludeMccs, includeCountries, includeMccs, additionalProperties) }
469583
/* spotless:on */
470584

471585
override fun hashCode(): Int = hashCode
472586

473587
override fun toString() =
474-
"Filters{includeCountries=$includeCountries, includeMccs=$includeMccs, additionalProperties=$additionalProperties}"
588+
"Filters{excludeCountries=$excludeCountries, excludeMccs=$excludeMccs, includeCountries=$includeCountries, includeMccs=$includeMccs, additionalProperties=$additionalProperties}"
475589
}
476590

477591
/**

lithic-java-core/src/main/kotlin/com/lithic/api/services/async/reports/settlement/NetworkTotalServiceAsync.kt

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,7 @@ interface NetworkTotalServiceAsync {
1818
*/
1919
fun withRawResponse(): WithRawResponse
2020

21-
/**
22-
* (Available March 4, 2025) Retrieve a specific network total record by token. Not available in
23-
* sandbox.
24-
*/
21+
/** Retrieve a specific network total record by token. Not available in sandbox. */
2522
fun retrieve(
2623
params: ReportSettlementNetworkTotalRetrieveParams
2724
): CompletableFuture<NetworkTotalRetrieveResponse> = retrieve(params, RequestOptions.none())
@@ -32,10 +29,7 @@ interface NetworkTotalServiceAsync {
3229
requestOptions: RequestOptions = RequestOptions.none(),
3330
): CompletableFuture<NetworkTotalRetrieveResponse>
3431

35-
/**
36-
* (Available March 4, 2025) List network total records with optional filters. Not available in
37-
* sandbox.
38-
*/
32+
/** List network total records with optional filters. Not available in sandbox. */
3933
fun list(): CompletableFuture<ReportSettlementNetworkTotalListPageAsync> =
4034
list(ReportSettlementNetworkTotalListParams.none())
4135

lithic-java-core/src/main/kotlin/com/lithic/api/services/blocking/reports/settlement/NetworkTotalService.kt

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,7 @@ interface NetworkTotalService {
1717
*/
1818
fun withRawResponse(): WithRawResponse
1919

20-
/**
21-
* (Available March 4, 2025) Retrieve a specific network total record by token. Not available in
22-
* sandbox.
23-
*/
20+
/** Retrieve a specific network total record by token. Not available in sandbox. */
2421
fun retrieve(params: ReportSettlementNetworkTotalRetrieveParams): NetworkTotalRetrieveResponse =
2522
retrieve(params, RequestOptions.none())
2623

@@ -30,10 +27,7 @@ interface NetworkTotalService {
3027
requestOptions: RequestOptions = RequestOptions.none(),
3128
): NetworkTotalRetrieveResponse
3229

33-
/**
34-
* (Available March 4, 2025) List network total records with optional filters. Not available in
35-
* sandbox.
36-
*/
30+
/** List network total records with optional filters. Not available in sandbox. */
3731
fun list(): ReportSettlementNetworkTotalListPage =
3832
list(ReportSettlementNetworkTotalListParams.none())
3933

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ class VelocityLimitParamsTest {
1313
VelocityLimitParams.builder()
1414
.filters(
1515
VelocityLimitParams.Filters.builder()
16+
.addExcludeCountry("USD")
17+
.addExcludeMcc("5542")
1618
.addIncludeCountry("USD")
1719
.addIncludeMcc("5542")
1820
.build()
@@ -26,6 +28,8 @@ class VelocityLimitParamsTest {
2628
assertThat(velocityLimitParams.filters())
2729
.isEqualTo(
2830
VelocityLimitParams.Filters.builder()
31+
.addExcludeCountry("USD")
32+
.addExcludeMcc("5542")
2933
.addIncludeCountry("USD")
3034
.addIncludeMcc("5542")
3135
.build()

0 commit comments

Comments
 (0)