[NEEDS DISCUSSION WITH PRODUCT] v6 - Card - Bin lookup callback#2746
[NEEDS DISCUSSION WITH PRODUCT] v6 - Card - Bin lookup callback#2746araratthehero wants to merge 9 commits into
Conversation
There was a problem hiding this comment.
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.
…back signature. COSDK-1204
COSDK-1204
078d380 to
2505390
Compare
d9b6255 to
3230a0d
Compare
|
✅ No public API changes |
| data class Available(val detectedCardTypes: List<DetectedCardType>) : BinLookupCacheResult() | ||
| data class Available( | ||
| val detectedCardTypes: List<DetectedCardType>, | ||
| val issuingCountryCode: String? = null, |
There was a problem hiding this comment.
This doesn't need a default value
|
|
||
| // Component state | ||
| val cardBrandState: CardBrandState, | ||
| val networkBinLookupState: NetworkBinLookupState? = null, |
There was a problem hiding this comment.
This shouldn't have a default value, to align with the rest of the fields
|
|
||
| private fun createNetworkBinLookupState( | ||
| detectedCardTypes: List<DetectedCardType>, | ||
| issuingCountryCode: String? = null, |
There was a problem hiding this comment.
This doesn't need a default value
| } | ||
|
|
||
| fun setCachedResults(bin: String, detectedCardTypes: List<DetectedCardType>) { | ||
| fun setCachedResults(bin: String, detectedCardTypes: List<DetectedCardType>, issuingCountryCode: String? = null) { |
There was a problem hiding this comment.
This doesn't need a default value
| * in the public API. | ||
| */ | ||
| val cardDetectionBin: String?, | ||
| val issuingCountryCode: String? = null, |
There was a problem hiding this comment.
IMO it's better not to use a default value here to be more explicit that this is null in the local detection flow



Description
Rework the bin lookup callback public API:
BinLookupDatato contain a list ofBinLookupBrandandissuingCountryCode.BinLookupBrandwithbrand,supported, andpaymentMethodVariantfields.OnBinLookupCallback.onBinLookupto receiveBinLookupDatainstead ofList<BinLookupData>.issuingCountryCodethrough the bin lookup data flow.Internally, introduce
NetworkBinLookupStateto decouple the component state fromDetectedCardTypeList, and renameCardBrandDataMappertoDetectedCardTypeMappers.Checklist
Ticket number
COSDK-1204