Skip to content

feat: issuer logo and brand colors on the card preview and token output - #18

Merged
RZEROSTERN merged 2 commits into
developfrom
feature/card-brand-visuals
Sep 30, 2026
Merged

RZEROSTERN merged 2 commits into
developfrom
feature/card-brand-visuals

Conversation

@RZEROSTERN

@RZEROSTERN RZEROSTERN commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

Summary

The live card preview and the sample app's tokenization output now carry the issuer's visual identity:

  • Card preview (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.
  • Token output: new public OpenpayCardBrandLogo badge — 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 a CardBrand, 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.md gain a "Brand identity" section with the brand/background/logo table and a usage snippet for the badge.

Test plan

  • Unit tests for fromBrandName and the visual style mapping (colors, logo resources, solid vs gradient brush).
  • Robolectric Compose tests: logo shown on the preview for recognized brands and absent for unknown; badge content descriptions per brand; sample token output shows the Visa badge and hides it for unrecognized brands.
  • ./gradlew testDebugUnitTest jacocoTestReport :openpay-sdk:jacocoCoverageVerification passes locally (80% gate intact).
  • CI should post the coverage comment below and run the instrumented suite on the emulator.

🤖 Generated with Claude Code

RZEROSTERN and others added 2 commits September 30, 2026 12:45
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

Unit test coverage

Overall Project 83.56% -0.22% 🍏
Files changed 96.15% 🍏

Module Coverage
app 86.25% -0.15% 🍏
openpay-sdk 82.56% -0.24% 🍏
Files
Module File Coverage
app AddCardScreen.kt 70.29% -0.61% 🍏
openpay-sdk CardBrand.kt 100% 🍏
OpenpayCardPreview.kt 97.74% 🍏
CardBrandVisuals.kt 94.69% -5.31% 🍏
OpenpayCardFields.kt 92.83% 🍏

@RZEROSTERN
RZEROSTERN merged commit 9e53038 into develop Sep 30, 2026
2 checks passed
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.

1 participant