Skip to content

Commit b3bace5

Browse files
authored
Support more card providers (#25)
1 parent d01c189 commit b3bace5

3 files changed

Lines changed: 12 additions & 4 deletions

File tree

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
- ⚛️ Card In-App Provisioning seamless integration
55
- ♻️ Universal solution (Apple Wallet and Google Wallet)
66
- 💳 Easy and secure addition of payment cards from your app directly
7+
- 💰 Supports Visa, MasterCard, Amex and Discover payment cards
78

89
## Getting started
910

android/src/main/java/com/expensify/wallet/WalletModule.kt

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,6 @@ class WalletModule internal constructor(context: ReactApplicationContext) :
4141
const val REQUEST_CODE_PUSH_TOKENIZE: Int = 0xA001
4242
const val REQUEST_CREATE_WALLET: Int = 0xA002
4343

44-
const val TSP_VISA: String = "VISA"
45-
4644
const val E_SDK_API = "SDK API Error"
4745
const val E_OPERATION_FAILED = "E_OPERATION_FAILED"
4846
const val E_NO_TOKENS_AVAILABLE = "E_NO_TOKENS_AVAILABLE"
@@ -247,14 +245,20 @@ class WalletModule internal constructor(context: ReactApplicationContext) :
247245

248246
private fun getCardNetwork(network: String): Int {
249247
return when (network.uppercase(Locale.getDefault())) {
250-
TSP_VISA -> TapAndPay.CARD_NETWORK_VISA
248+
"VISA" -> TapAndPay.CARD_NETWORK_VISA
249+
"MASTERCARD" -> TapAndPay.CARD_NETWORK_MASTERCARD
250+
"AMEX" -> TapAndPay.CARD_NETWORK_AMEX
251+
"DISCOVER" -> TapAndPay.CARD_NETWORK_DISCOVER
251252
else -> throw InvalidNetworkError()
252253
}
253254
}
254255

255256
private fun getTokenServiceProvider(network: String): Int {
256257
return when (network.uppercase(Locale.getDefault())) {
257-
TSP_VISA -> TapAndPay.TOKEN_PROVIDER_VISA
258+
"VISA" -> TapAndPay.TOKEN_PROVIDER_VISA
259+
"MASTERCARD" -> TapAndPay.TOKEN_PROVIDER_MASTERCARD
260+
"AMEX" -> TapAndPay.TOKEN_PROVIDER_AMEX
261+
"DISCOVER" -> TapAndPay.TOKEN_PROVIDER_DISCOVER
258262
else -> throw InvalidNetworkError()
259263
}
260264
}

ios/stucts/CardInfo.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ struct CardInfo {
2424
private static func getNetwork(from identifier: String) -> PKPaymentNetwork? {
2525
switch identifier.lowercased() {
2626
case "visa": return .visa
27+
case "mastercard": return .masterCard
28+
case "amex": return .amex
29+
case "discover": return .discover
2730
default: return nil
2831
}
2932
}

0 commit comments

Comments
 (0)