Skip to content

Automatic updates of 3DS2 DS certificates - #352

Draft
stefan-tudor wants to merge 1 commit into
masterfrom
feature/NONE/dynamic-3ds-certs
Draft

Automatic updates of 3DS2 DS certificates#352
stefan-tudor wants to merge 1 commit into
masterfrom
feature/NONE/dynamic-3ds-certs

Conversation

@stefan-tudor

Copy link
Copy Markdown
Contributor

No description provided.


internal fun DsCertEntry.isNotExpired(now: Long): Boolean {
val epochMillis = validUntilEpochMillis()
return validUntil == null || (epochMillis != null && epochMillis > now)

@RafalOzogJudopay RafalOzogJudopay Jun 30, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@RafalOzogJudopay RafalOzogJudopay Jul 1, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 })

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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"))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think comment is misleading by saying "past expiry" instead "near expiry"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

4 participants