Repository navigation
feat: issuer logo and brand colors on the card preview and token output - #18
Merged
Merged
Conversation
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Unit test coverage
Files
|
1 of 2 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The live card preview and the sample app's tokenization output now carry the issuer's visual identity:
OpenpayCardPreview): the background reacts to the detected brand — Visa gets a navy blue → yellow gradient, Mastercard an orange → yellow gradient, American Express a solid blue, and unknown brands keep the neutral gray. The issuer logo (new drawable assets) replaces the old text label at the top-right corner, in a fixed-height slot so the layout never jumps.OpenpayCardBrandLogobadge — the white logo over its brand color — shown next to the masked card in the sample app's token result. It announces the brand name to screen readers and renders nothing for unknown brands.CardBrand.fromBrandName: maps the brand string echoed by the Openpay API ("visa","mastercard","american_express", plus"amex"/"master_card"synonyms, case-insensitive) to aCardBrand, so API output can reuse the same visuals.All brand styling lives in one place (
CardBrandVisuals.kt) as a testable pure mapping (logo resource + background colors), consumed by both the preview and the badge.Also includes a one-line cleanup of stray characters that had slipped into
CheckoutViewModel.Documentation
docs/{en,es,fr,pt}/ui-components.mdgain a "Brand identity" section with the brand/background/logo table and a usage snippet for the badge.Test plan
fromBrandNameand the visual style mapping (colors, logo resources, solid vs gradient brush)../gradlew testDebugUnitTest jacocoTestReport :openpay-sdk:jacocoCoverageVerificationpasses locally (80% gate intact).🤖 Generated with Claude Code