Automatic updates of 3DS2 DS certificates - #352
Conversation
|
|
||
| internal fun DsCertEntry.isNotExpired(now: Long): Boolean { | ||
| val epochMillis = validUntilEpochMillis() | ||
| return validUntil == null || (epochMillis != null && epochMillis > now) |
There was a problem hiding this comment.
Just to confirm, as I understood after reading the PR, some cert entries are expected not to have expiry date, and then we treat them as "forever valid" - is that expected?
|
|
||
| /** | ||
| * Best-effort background refresh. Call at payment-screen creation, off the critical path. | ||
| * Never throws — all errors are swallowed and logged. |
There was a problem hiding this comment.
It actually throws Cancellation Exception, no? So comment may be misleading.
| sut.prefetch() | ||
|
|
||
| verify { | ||
| cache.write(match { it.fetchedAt == 9_999_999_999L && it.entries == stale.entries }) |
There was a problem hiding this comment.
I think we should use === for checking if it.entries and stale.entries has not been replaced (to compare references, not object content).
| runTest { | ||
| every { cache.read() } returns aStaleCache() | ||
| coEvery { api.fetchDsCerts(any(), any(), any()) } returns | ||
| successResponse(body = aResponse(schemaVersion = "2.0")) |
There was a problem hiding this comment.
Maybe better use 10.0 as schema version, so it's not gonna outdate that quick (once we increase real version to 2.0).
| runTest { | ||
| // Entry expired in 2020 — well within the 7-day pre-expiry window | ||
| val nearExpiry = visaEntry(validUntil = "2020-01-01T00:00:00Z") | ||
| // fetchedAt = now → cache TTL is fresh, but entry is past expiry |
There was a problem hiding this comment.
I think comment is misleading by saying "past expiry" instead "near expiry"
No description provided.