Skip to content

feat: Reimplement credit card support#58

Merged
OffRange merged 36 commits into
v2from
feat/reimplement-creditcard
May 30, 2026
Merged

feat: Reimplement credit card support#58
OffRange merged 36 commits into
v2from
feat/reimplement-creditcard

Conversation

@OffRange
Copy link
Copy Markdown
Owner

No description provided.

OffRange and others added 30 commits May 24, 2026 02:09
- Implement credit card network detection, Luhn validation, and formatting logic in Rust.
- Add `CardNumberVisualTransformation` and `CardNumberInputTransformation` to handle real-time field formatting and input sanitization.
- Update `KeyGoFormField` to support `OutputTransformation`.
- Integrate `CardFormatter` into the credit card creation flow via dependency injection.
Migrates `InputTransformation` and `OutputTransformation` logic from the `CreditCardViewModel` and `CreditCardUiState` directly into the UI layer. This change localizes formatting logic and simplifies the ViewModel.

Specific changes include:
- Removed transformation properties from `CreditCardUiState`.
- Added `rememberCardNumberInputTransformation`, `rememberCardNumberOutputTransformation`, and `rememberCvvInputTransformation` helper functions.
- Updated `CreditCardContent` to use these locally remembered transformations.
- Removed `CardFormatter` dependency and associated setup from `CreditCardViewModel`.
- Refactored `ExpirationDateInputTransformation` and `CardNumberVisualTransformation` to use standard Composable memory patterns instead of singleton injections.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Update `ObfuscatedString` to support custom formatting and visible suffixes, allowing card numbers to maintain their grouping (e.g., spaces) while masking digits.

Key changes include:
- Enhanced `ObfuscatedString` to preserve non-digit characters and reveal a specified number of suffix digits.
- Injected `CardFormatter` into `ViewCreditCardViewModel` to handle network-specific card formatting.
- Updated the UI to display the formatted string instead of raw digits when the card number is revealed.
- Added comprehensive unit tests for `ObfuscatedString` logic and `ViewCreditCardViewModel` state production.
… networks

Unknown IINs now fall back to the full plausible PAN length range so a
card can be validated on length + Luhn alone without requiring a
recognised network.  Renames the public binding and fake accordingly.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
lastNumbers was a redundant cache of the last four digits of the card
number.  The full (encrypted) card number is already stored; deriving a
preview string from ciphertext is the ViewModel's job.  Removes the
column from the Room schema, entity, mapper, domain model, and all test
fixtures that referenced it.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Adds InvalidCvv to CreditCardUpsertError and enforces it in
CreateNewOrUpdateCreditCardUseCase: when both the card number and CVV
are being set, the CVV must match the length reported by the formatter
for that network.  Updating a CVV without supplying a new card number is
left unchecked because the network is unknown in that context.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…reens

Propagates InvalidCvv from the use case to the CVV input field in both
CreditCardContent (create flow) and ViewCreditCardViewModel (view/edit
flow).  Adds cvvError to CreditCardBaseState and removes the now-unused
lastNumbers field from ViewCreditCardState.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
OffRange and others added 5 commits May 29, 2026 15:24
Moves the onHold(false) call into a finally block so the held state is
always cleared even when the pointer-input coroutine is cancelled
(e.g. by navigation or recomposition).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings May 30, 2026 13:12
@OffRange OffRange linked an issue May 30, 2026 that may be closed by this pull request
5 tasks
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

The devnied emvnfccard library logs through slf4j-api but ships no
slf4j binding, so org.slf4j.impl.StaticLoggerBinder is absent at build
time. R8 full-mode treats the missing class as a hard error, breaking
the minified app build (and CodeQL autobuild's assemble). Add
-dontwarn org.slf4j.** to the module's consumer rules so it propagates
into the app's R8 run. slf4j degrades to a no-op logger at runtime, so
there is no behavioral impact.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@OffRange OffRange merged commit 9bd32af into v2 May 30, 2026
8 checks passed
@OffRange OffRange deleted the feat/reimplement-creditcard branch May 30, 2026 14:41
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.

Reimplement Credit Cards

2 participants