Skip to content

feat: implement token update#96

Merged
ddiestra merged 2 commits intomasterfrom
eng-7500
Feb 24, 2026
Merged

feat: implement token update#96
ddiestra merged 2 commits intomasterfrom
eng-7500

Conversation

@ddiestra
Copy link
Contributor

Description

  • As part of the update on the Guides, we need to have the token update for when CVC needs to be updated in a card token.

Testing required outside of automated testing?

  • Not Applicable

Screenshots (if appropriate):

  • Not Applicable

Rollback / Rollforward Procedure

  • Roll Forward
  • Roll Back

Reviewer Checklist

  • Description of Change
  • Description of outside testing if applicable.
  • Description of Roll Forward / Backward Procedure
  • Documentation updated for Change

ducktape-agents[bot]
ducktape-agents bot previously approved these changes Feb 16, 2026
Copy link

@ducktape-agents ducktape-agents bot left a comment

Choose a reason for hiding this comment

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

LGTM. Clean implementation of token update via PATCH, consistent with existing create token patterns.

ducktape-agents[bot]
ducktape-agents bot previously approved these changes Feb 16, 2026
Copy link

@ducktape-agents ducktape-agents bot left a comment

Choose a reason for hiding this comment

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

LGTM. Clean implementation of token update via PATCH with proper content type, error handling, and telemetry consistent with existing patterns.

}

print("[DEBUG executeTypedRequest] Headers: \(headers)")
print("[DEBUG executeTypedRequest] URL: \(url)")

Choose a reason for hiding this comment

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

This debug print logs all HTTP headers including API keys to stdout — remove before merging.

let headers = getBasisTheoryHeaders(apiKey: getApiKey(apiKey), btTraceId: btTraceId)
let url = "\(basePath)/tokens/\(id)"

print("[DEBUG getTokenById] url: \(url)")

Choose a reason for hiding this comment

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

Debug print statement left in production code — remove before merging.

}
}

print("[DEBUG executeTypedRequest] FINAL URL: \(request.url!.absoluteString)")

Choose a reason for hiding this comment

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

This prints the full unmasked API key via request.allHTTPHeaderFields. The debugHeaders masking above is unused. Remove all debug prints before merging, or at minimum use debugHeaders instead.

let headers = getBasisTheoryHeaders(apiKey: getApiKey(apiKey), btTraceId: btTraceId)
let url = "\(basePath)/tokens/\(id)"

print("[DEBUG getTokenById] url: \(url)")

Choose a reason for hiding this comment

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

Debug print left in production code — remove before merging.


xcodebuild clean test \
-project ./IntegrationTester/IntegrationTester.xcodeproj \
-scheme IntegrationTester \

Choose a reason for hiding this comment

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

-only-testing UnitTests/CardExpirationDateUITextFieldTests limits CI to a single test class, so UpdateTokenTests and all other tests won't run in CI.

metadata: self.metadata,
searchIndexes: self.searchIndexes,
fingerprintExpression: self.fingerprintExpression,
mask: AnyCodable(self.mask),

Choose a reason for hiding this comment

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

AnyCodable(self.mask) when self.mask is nil creates a non-nil AnyCodable wrapping nil, which serializes as "mask": null in the merge-patch JSON — this will clear the mask on the server. Use self.mask.map { AnyCodable($0) } instead so the field is omitted when not set.

@ddiestra ddiestra merged commit 3c1c479 into master Feb 24, 2026
4 checks passed
@ddiestra ddiestra deleted the eng-7500 branch February 24, 2026 15:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants