Skip to content

Commit 08fd371

Browse files
committed
fix: fix auth rule conditional value parsing
1 parent 1bac5f3 commit 08fd371

File tree

2 files changed

+15
-16
lines changed

2 files changed

+15
-16
lines changed

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

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -219,30 +219,28 @@ private constructor(
219219

220220
val bestMatches =
221221
sequenceOf(
222-
if (node.isTextual) {
223-
tryDeserialize(node, jacksonTypeRef<String>())?.let {
224-
ConditionalValue(regex = it, _json = json)
225-
}
226-
} else {
227-
null
228-
},
229222
if (node.isNumber) {
230223
tryDeserialize(node, jacksonTypeRef<Long>())?.let {
231224
ConditionalValue(number = it, _json = json)
232225
}
233-
} else {
234-
null
235-
},
226+
} else null,
236227
if (node.isArray) {
237228
tryDeserialize(node, jacksonTypeRef<List<String>>())?.let {
238229
ConditionalValue(listOfStrings = it, _json = json)
239230
}
240-
} else {
241-
null
242-
},
243-
tryDeserialize(node, jacksonTypeRef<OffsetDateTime>())?.let {
244-
ConditionalValue(timestamp = it, _json = json)
245-
},
231+
} else null,
232+
// Try timestamp before generic string, since timestamps serialize as
233+
// strings
234+
if (node.isTextual) {
235+
tryDeserialize(node, jacksonTypeRef<OffsetDateTime>())?.let {
236+
ConditionalValue(timestamp = it, _json = json)
237+
}
238+
} else null,
239+
if (node.isTextual) {
240+
tryDeserialize(node, jacksonTypeRef<String>())?.let {
241+
ConditionalValue(regex = it, _json = json)
242+
}
243+
} else null,
246244
)
247245
.filterNotNull()
248246
.allMaxBy { it.validity() }

lithic-java-proguard-test/src/test/kotlin/com/lithic/api/proguard/ProGuardCompatibilityTest.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ internal class ProGuardCompatibilityTest {
8181
assertThat(client.fraud()).isNotNull()
8282
assertThat(client.networkPrograms()).isNotNull()
8383
assertThat(client.accountActivity()).isNotNull()
84+
assertThat(client.webhooks()).isNotNull()
8485
}
8586

8687
@Test

0 commit comments

Comments
 (0)