Skip to content

Release v1.0.0 — Openpay Android SDK rebuilt on Kotlin and Compose - #22

Merged
RZEROSTERN merged 33 commits into
masterfrom
develop
Oct 1, 2026
Merged

RZEROSTERN merged 33 commits into
masterfrom
develop

Conversation

@RZEROSTERN

Copy link
Copy Markdown
Contributor

Release summary

First production release of the rebuilt Openpay Android SDK: a Kotlin 2.2 / Compose-first library published as mx.dev1.openpay:openpay-sdk:1.0.0, plus a sample app demonstrating the full flow. Everything below was merged into develop through reviewed PRs (#1–#21).

SDK (openpay-sdk)

  • Core — clean-architecture layering with domain models, typed errors, Ktor HTTP client and Koin dependency injection (100% Kotlin, no Java).
  • Tokenization — public Openpay facade: createToken(card) returns a Kotlin Result<Token>; merchant id/public key configuration with sandbox and production modes for MX / CO / PE.
  • Card validation — brand detection from the IIN prefix (Visa, Mastercard including the 2-series, American Express), Luhn, expiration and brand-aware security code rules; CardBrand.fromBrandName maps API brand strings.
  • Antifraud — device session collector (setupDeviceSession).
  • Compose-first UI kit — drop-in OpenpayCardForm, individually composable fields, and a live OpenpayCardPreview with issuer identity: Visa navy→yellow gradient (70% navy), Mastercard orange→yellow gradient, Amex solid blue, issuer logo on the card; public OpenpayCardBrandLogo badge for outputs. XML interop via OpenpayCardFormView for View-based apps.
  • Internationalization — English, Spanish, Portuguese and French, automatic from the device locale with a manual override (OpenpayLocale.override).
  • Accessibility — form fields announce translated labels and errors; the card preview exposes a single description and never reads card digits aloud; brand logos announce the brand name.
  • Security — card data is never persisted (no process-death restoration of the form state); credentials never touch the repository.

Sample app (app)

Checkout configuration screen plus an independent add-card screen consuming the SDK form, with navigation-compose and Koin wiring; the token result shows the masked card with the brand logo.

Quality and automation

  • Unit + instrumented tests across the SDK (Mockito, Robolectric, JUnit, Compose UI tests); JaCoCo enforces ≥80% line coverage on openpay-sdk — currently at ~83% overall.
  • CI (ci.yml): tests, coverage gate and an auto-updating coverage comment on every PR; instrumented tests on an API 34 emulator.
  • CD (cd.yml): pushing a v* tag runs tests, verifies the tag matches VERSION_NAME, signs and uploads to the Sonatype Central Portal, and creates the GitHub release; publication to Maven Central stays behind a manual Publish confirmation in the portal.

Documentation and licensing

  • Guides in English, Spanish, French and Portuguese under docs/ (getting started, architecture with diagrams, UI components with native-form and custom-inputs implementation instructions, i18n, contributing, CI/CD).
  • Apache License 2.0 (LICENSE.md), matching the license declared in the published POM.

After merging

  1. Tag the merge commit: git tag v1.0.0 master && git push origin v1.0.0 — this triggers the CD pipeline.
  2. Press Publish on the validated deployment at central.sonatype.com to release to Maven Central.

🤖 Generated with Claude Code

RZEROSTERN and others added 30 commits September 29, 2026 15:17
- Add :openpay-sdk Android library module (Compose-enabled, minSdk 26,
  AGP 9 built-in Kotlin, kotlinx.serialization plugin)
- Expand libs.versions.toml with Kotlin, Compose BOM, Koin, Ktor,
  kotlinx libraries, Mockito, Robolectric and JaCoCo versions
- Add shared JaCoCo convention in the root build: per-module
  jacocoTestReport and jacocoCoverageVerification (80% line minimum)
- Convert :app to Kotlin + Compose with a placeholder screen consuming
  the SDK, Material 3 theme and edge-to-edge activity
- Pin androidx.core to 1.17.0 (1.19.0 requires compileSdk 37 / AGP 9.1)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
- Domain models: Card (with API-formatted expiration), Address, Token,
  TokenizedCard as immutable data classes
- OpenpayConfig + OpenpayCountry (MX/CO/PE) + OpenpayEnvironment resolve
  the API base URL, matching the legacy SDK endpoints
- OpenpayException sealed hierarchy: ServiceError (API error body) and
  ConnectionError (transport failures)
- Ktor HttpClient factory (CIO engine): Basic auth with public key,
  SDK user agent, JSON content negotiation, 60s timeouts
- OpenpayResponseHandler maps non-2xx responses to ServiceError parsing
  the documented Openpay error body
- Serialization DTOs + mappers between DTOs and domain models
- Isolated Koin container (OpenpayKoinContext) so the SDK graph never
  clashes with a host app using Koin

Tests: 23 new unit tests, module line coverage 95.9%

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
- CardBrand detection from IIN prefixes: Visa, Mastercard (51-55 and
  2221-2720 series), American Express, with per-brand CVV length
- CardValidator: Luhn check with separator tolerance, holder name rules
  supporting accented names, brand-aware security code validation and
  clock-injectable expiration validation (current month .. +20 years)
- CardValidationResult reports every invalid field so UIs can point
  errors to the exact input

Tests: 27 new unit tests with a frozen clock, module coverage 95.7%

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
- TokenRepository domain interface + RemoteTokenRepository posting to
  v1/{merchantId}/tokens, wrapping transport failures as ConnectionError
- CreateTokenUseCase validates the card locally (ValidationError with
  the failing fields) before any network call
- OpenpayException.ValidationError added to the sealed hierarchy
- Public Openpay facade: OpenpayConfig constructor plus legacy-style
  (merchantId, publicApiKey, productionMode, country) constructor,
  suspend Result<Token> API and main-thread OpenpayCallback API,
  shutdown() releasing the coroutine scope and Koin graph
- Koin data module wiring repository, use case and clock

Tests: 9 new unit tests (MockEngine repository, Mockito use case,
test-dispatcher facade), module coverage 87.4%

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
- DeviceSessionIdGenerator: 32 character hexadecimal session ids
- WebViewDeviceSessionCollector: loads {baseUrl}/oa/logo.htm?m={merchant}
  &s={session} in a short-lived hidden WebView (JS enabled, destroyed on
  page finish), replicating the legacy fingerprint collection
- Injectable WebView factory so Robolectric tests can observe the loaded
  URL and settings
- Openpay.setupDeviceSession(activity) exposes the flow, resolved through
  the new antifraud Koin module

Tests: 7 new tests (Robolectric shadows + Mockito facade delegation),
module coverage 85.3%

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
- OpenpayTheme: Material 3 light/dark schemes with Openpay palette
- Field components: holder name, card number (live brand badge +
  grouped formatting), MM/YY expiration, masked security code
- Visual transformations with exact offset mappings (4-4-4-4 and
  Amex 4-6-5 grouping, MM/YY separator)
- OpenpayCardFormState: digits-only filtering, brand-aware CVV length,
  per-field error clearing, deliberate non-persistence of card data
- OpenpayCardForm assembling the fields with validation on submit
- Accessibility: labels + supporting error texts through semantics,
  content descriptions for brand badge and masked code, 48dp minimum
  touch target on submit
- OpenpayCardFormView (AbstractComposeView) for XML-based host apps

Tests: 24 new tests (offset-mapping round trips, state rules, Robolectric
Compose interaction tests), module coverage 88.7%

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
- SDK strings translated to es, pt and fr (values-es, values-pt,
  values-fr); English stays the default and the fallback for unbundled
  device languages
- OpenpayLanguage enum with BCP-47 tag resolution (es-MX -> SPANISH)
- OpenpayLocale.override: observable Compose state forcing a bundled
  language; null keeps automatic device-locale resolution
- OpenpayLocale.localize(context) for view-based apps
- OpenpayLocalized wrapper applied to every SDK composable so overrides
  recompose live; submit button text became nullable to localize its
  default inside the wrapped scope

Tests: 14 new tests (per-locale resources via Robolectric qualifiers,
override precedence, live recomposition on override change)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
- CheckoutScreen: merchant configuration (id, key, country chips,
  production switch), SDK language selector (auto/en/es/pt/fr),
  antifraud device session button and the OpenpayCardForm, with token
  and error result display
- CheckoutViewModel: state-flow driven, reuses the Openpay instance
  while the configuration is unchanged and rebuilds it (with shutdown)
  when it changes; readable error descriptions per failure type
- Koin at app level: SampleApplication starts Koin (guarded for test
  runners) and the view model is injected with koinViewModel()
- Removed the scaffold placeholder test

Tests: 10 new tests (view model with mocked SDK + Robolectric Compose
screen tests)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
- maven-publish with the release AAR variant plus sources and javadoc jars
- Coordinates mx.dev1.openpay:openpay-sdk:1.0.0 from gradle.properties
  (GROUP / VERSION_NAME kept aligned with OpenpaySdk.VERSION)
- Full POM metadata: name, description, Apache 2.0 license, developers
  and scm pointing at the repository
- Optional remote repository and in-memory PGP signing configured purely
  through environment variables, so credentials never live in the build;
  publishToMavenLocal works with no setup

Verified with ./gradlew :openpay-sdk:publishToMavenLocal

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
- Root README.md: features, installation, quick start, documentation
  matrix linking every guide in the four languages
- docs/{en,es,fr,pt}/ each with five guides written for readers without
  Android experience:
  - getting-started: requirements, install, configure, tokenize, device
    session, error handling, sandbox test cards
  - architecture: clean architecture layers, module/layer diagrams and
    tokenization + antifraud sequence diagrams (Mermaid)
  - ui-components: Compose form, standalone fields, XML interop and the
    accessibility guarantees
  - internationalization: automatic resolution, override API, flow
    diagram, how to add a language
  - contributing: machine setup, everyday Gradle commands, project rules,
    Git Flow diagram and PR checklist

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
feat: multi-module project structure with openpay-sdk library
The checkout column scrolls, but the keyboard overlapped it: the activity
window was not resizing on IME and the scrollable viewport ignored the
IME inset, so focused fields near the bottom stayed covered.

- MainActivity now uses windowSoftInputMode=adjustResize so the window
  reports IME insets under edge-to-edge
- The checkout column adds Modifier.imePadding() before verticalScroll,
  shrinking the scroll viewport above the keyboard so the focused field
  can always scroll into view

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…verlap

fix: checkout content hidden behind the keyboard
IDE state is machine-specific and was generating noise in diffs. The
whole /.idea/ folder is now ignored (replacing the previous per-file
entries) and its tracked files are removed from the index; local copies
stay untouched.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
chore: remove the .idea folder from version control
Adds OpenpayCardPreview, a Compose card visual that mirrors the form in
real time (masked number, holder name, expiration and detected brand).
OpenpayCardForm now renders it above the fields by default, with a
showCardPreview flag so host apps that draw their own card artwork can
opt out. The preview hides its inner texts from screen readers and never
announces card digits, exposing a single localized description instead.
Strings localized in English, Spanish, Portuguese and French.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Every SDK and sample composable now has @Preview functions, kept in
dedicated *Previews.kt files so the tightened JaCoCo exclusion
(*PreviewsKt*) no longer hides real components like OpenpayCardPreview
from coverage. The sample app splits the card form out of the merchant
configuration: CheckoutScreen keeps configuration, language and device
session plus an Add card button gated on complete credentials, and the
new AddCardScreen hosts the SDK form with navigation-compose wiring and
a shared activity-scoped view model. Screens are refactored into
stateless *Content composables so previews and tests render them with
fabricated states.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
feat: live card preview in the standardized card form
…screen

feat: previews for every composable and an independent add-card screen
feat: land composable previews and the independent add-card screen in develop
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
ci: GitHub Actions pipeline with tests and PR coverage comments
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
feat: issuer logo and brand colors on the card preview and token output
…tion docs

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
feat: land the brand visuals tweaks in develop
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
RZEROSTERN and others added 3 commits September 30, 2026 23:42
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
ci: CD pipeline that publishes releases to Maven Central
@github-actions

github-actions Bot commented Oct 1, 2026

Copy link
Copy Markdown

Unit test coverage

Overall Project 83.51% -16.49% 🍏
Files changed 83.51% 🍏

Module Coverage
app 86.25% -13.75% 🍏
openpay-sdk 82.45% -17.55% 🍏
Files
Module File Coverage
app SampleApplication.kt 100% 🍏
CheckoutViewModel.kt 92.38% -7.62% 🍏
CheckoutScreen.kt 92.32% -7.68% 🍏
AddCardScreen.kt 70.29% -29.71% ❌
SampleAppModule.kt 68.18% -31.82% ❌
MainActivity.kt 0% ❌
openpay-sdk OpenpayLocale.kt 100% 🍏
OpenpayLanguage.kt 100% 🍏
CardBrand.kt 100% 🍏
CardField.kt 100% 🍏
CardValidationResult.kt 100% 🍏
TokenMapper.kt 100% 🍏
OpenpayHttpClientFactory.kt 100% 🍏
OpenpayEnvironment.kt 100% 🍏
OpenpayConfig.kt 100% 🍏
OpenpayCountry.kt 100% 🍏
CardNumberVisualTransformation.kt 100% 🍏
ExpirationVisualTransformation.kt 100% 🍏
DeviceSessionIdGenerator.kt 100% 🍏
Card.kt 100% 🍏
OpenpaySdk.kt 100% 🍏
OpenpayKoinContext.kt 100% 🍏
OpenpayCoreModule.kt 100% 🍏
OpenpayCardFormState.kt 99.13% -0.87% 🍏
OpenpayCardPreview.kt 97.74% -2.26% 🍏
Address.kt 96.92% -3.08% 🍏
CardMapper.kt 96.77% -3.23% 🍏
RemoteTokenRepository.kt 95.71% -4.29% 🍏
CardBrandVisuals.kt 95.41% -4.59% 🍏
OpenpayCardFields.kt 94.65% -5.35% 🍏
OpenpayResponseHandler.kt 93.92% -6.08% 🍏
OpenpayLocalized.kt 93.24% -6.76% 🍏
OpenpayCardForm.kt 89.23% -10.77% 🍏
CardValidator.kt 88.6% -11.4% 🍏
OpenpayException.kt 87.18% -12.82% 🍏
OpenpayTheme.kt 84.72% -15.28% 🍏
Token.kt 82.14% -17.86% 🍏
WebViewDeviceSessionCollector.kt 77.94% -22.06% ❌
CardDto.kt 74.02% -25.98% ❌
CreateTokenUseCase.kt 69.05% -30.95% ❌
AddressMapper.kt 66.67% -33.33% ❌
Openpay.kt 63.03% -36.97% ❌
TokenDto.kt 54.76% -45.24% ❌
AddressDto.kt 25.52% -74.48% ❌
OpenpayApiErrorDto.kt 24.7% -75.3% ❌
OpenpayCardFormView.kt 0% ❌
OpenpayAntifraudModule.kt 0% ❌
OpenpayDataModule.kt 0% ❌

@RZEROSTERN
RZEROSTERN merged commit 0b14bfc into master Oct 1, 2026
4 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