Skip to content

Commit

Permalink
Create LegacyCardAccountRangeRepository (#2741)
Browse files Browse the repository at this point in the history
A `CardAccountRangeRepository` that simulates existing card account
range lookup logic by only using a local, static source.
  • Loading branch information
mshafrir-stripe authored Aug 19, 2020
1 parent 8d13e36 commit 1a2939d
Showing 1 changed file with 17 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package com.stripe.android.cards

import com.stripe.android.model.CardMetadata

/**
* A [CardAccountRangeRepository] that simulates existing card account range lookup logic by only
* using a local, static source.
*/
internal class LegacyCardAccountRangeRepository(
private val localCardAccountRangeSource: CardAccountRangeSource
) : CardAccountRangeRepository {
override suspend fun getAccountRange(cardNumber: String): CardMetadata.AccountRange? {
return Bin.create(cardNumber)?.let {
localCardAccountRangeSource.getAccountRange(cardNumber)
}
}
}

0 comments on commit 1a2939d

Please sign in to comment.