Skip to content

[NEEDS DISCUSSION WITH PRODUCT] v6 - Card - Bin lookup callback#2746

Draft
araratthehero wants to merge 9 commits into
mainfrom
chore/v6-bin-lookup-alignment
Draft

[NEEDS DISCUSSION WITH PRODUCT] v6 - Card - Bin lookup callback#2746
araratthehero wants to merge 9 commits into
mainfrom
chore/v6-bin-lookup-alignment

Conversation

@araratthehero
Copy link
Copy Markdown
Contributor

@araratthehero araratthehero commented May 7, 2026

Description

Rework the bin lookup callback public API:

  • Rewrite BinLookupData to contain a list of BinLookupBrand and issuingCountryCode.
  • Introduce BinLookupBrand with brand, supported, and paymentMethodVariant fields.
  • Update OnBinLookupCallback.onBinLookup to receive BinLookupData instead of List<BinLookupData>.
  • Propagate issuingCountryCode through the bin lookup data flow.

Internally, introduce NetworkBinLookupState to decouple the component state from DetectedCardTypeList, and rename CardBrandDataMapper to DetectedCardTypeMappers.

Checklist

  • Code is unit tested
  • Changes are tested manually
  • Aligned public API changes with other platforms (if applicable)

Ticket number

COSDK-1204

@AdyenAutomationBot AdyenAutomationBot added the Chore [PRs only] Indicates any task that does not need to be mentioned in the public release notes label May 7, 2026
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request refactors the BIN lookup mechanism to provide more detailed information, including a list of card brands and the issuing country code. It introduces the BinLookupBrand data class and updates BinLookupData and OnBinLookupCallback to support multiple brands and the new country code field. Internal state management, caching, and network services have been updated to propagate this data. Feedback suggests optimizing the onCardBrandDataChanged flow in CardComponent by applying distinctUntilChanged() after mapping to the public BinLookupData class to ensure the callback is only triggered when the exposed data actually changes.

@araratthehero araratthehero marked this pull request as ready for review May 7, 2026 13:50
@araratthehero araratthehero requested a review from a team as a code owner May 7, 2026 13:50
@araratthehero araratthehero marked this pull request as draft May 7, 2026 13:50
@araratthehero araratthehero changed the title v6 - Card - Bin lookup callback [WAITING FOR ALIGNMENT] v6 - Card - Bin lookup callback May 7, 2026
@araratthehero araratthehero force-pushed the chore/v6-bin-lookup-alignment branch from 078d380 to 2505390 Compare May 13, 2026 11:30
@araratthehero araratthehero changed the title [WAITING FOR ALIGNMENT] v6 - Card - Bin lookup callback v6 - Card - Bin lookup callback May 13, 2026
@araratthehero araratthehero marked this pull request as ready for review May 13, 2026 13:04
@araratthehero araratthehero force-pushed the chore/v6-bin-lookup-alignment branch from d9b6255 to 3230a0d Compare May 13, 2026 13:18
@sonarqubecloud
Copy link
Copy Markdown

@github-actions
Copy link
Copy Markdown
Contributor

✅ No public API changes

@araratthehero araratthehero marked this pull request as draft May 15, 2026 10:05
@araratthehero araratthehero changed the title v6 - Card - Bin lookup callback [NEEDS DISCUSSION WITH PRODUCT] v6 - Card - Bin lookup callback May 15, 2026
data class Available(val detectedCardTypes: List<DetectedCardType>) : BinLookupCacheResult()
data class Available(
val detectedCardTypes: List<DetectedCardType>,
val issuingCountryCode: String? = null,
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This doesn't need a default value


// Component state
val cardBrandState: CardBrandState,
val networkBinLookupState: NetworkBinLookupState? = null,
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This shouldn't have a default value, to align with the rest of the fields


private fun createNetworkBinLookupState(
detectedCardTypes: List<DetectedCardType>,
issuingCountryCode: String? = null,
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This doesn't need a default value

}

fun setCachedResults(bin: String, detectedCardTypes: List<DetectedCardType>) {
fun setCachedResults(bin: String, detectedCardTypes: List<DetectedCardType>, issuingCountryCode: String? = null) {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This doesn't need a default value

* in the public API.
*/
val cardDetectionBin: String?,
val issuingCountryCode: String? = null,
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

IMO it's better not to use a default value here to be more explicit that this is null in the local detection flow

@jreij jreij self-assigned this May 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Chore [PRs only] Indicates any task that does not need to be mentioned in the public release notes size:medium

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants