-
Notifications
You must be signed in to change notification settings - Fork 990
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PAY-1764: Update UI with for payment method using PaymentSheet (#1666)
- Loading branch information
Showing
19 changed files
with
209 additions
and
119 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
2013150891 | ||
2013150892 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
3.3.0 | ||
3.4.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
app/src/main/java/com/kickstarter/models/extensions/StoredCardExt.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
@file:JvmName("StoredCard") | ||
package com.kickstarter.models.extensions | ||
|
||
import com.kickstarter.R | ||
import com.kickstarter.models.PaymentSource | ||
import com.kickstarter.models.StoredCard | ||
import type.CreditCardTypes | ||
|
||
fun StoredCard.getCardTypeDrawable(): Int { | ||
val cardType = this.type() ?: CreditCardTypes.`$UNKNOWN` | ||
val resourceId = this.expiration()?.let { | ||
getCardTypeDrawable(cardType) | ||
} ?: this.resourceId() ?: R.drawable.generic_bank_md | ||
|
||
return resourceId | ||
} | ||
|
||
fun StoredCard.isFromPaymentSheet(): Boolean { | ||
return this.type() == CreditCardTypes.`$UNKNOWN` && | ||
this.lastFourDigits()?.isNotEmpty() ?: false && | ||
this.clientSetupId()?.isNotEmpty() ?: false | ||
} | ||
|
||
fun PaymentSource.getCardTypeDrawable(): Int { | ||
val type = CreditCardTypes.safeValueOf(this.type()) | ||
return getCardTypeDrawable(type) | ||
} | ||
|
||
fun getCardTypeDrawable(cardType: CreditCardTypes): Int { | ||
return when (cardType) { | ||
CreditCardTypes.AMEX -> R.drawable.amex_md | ||
CreditCardTypes.DINERS -> R.drawable.diners_md | ||
CreditCardTypes.DISCOVER -> R.drawable.discover_md | ||
CreditCardTypes.JCB -> R.drawable.jcb_md | ||
CreditCardTypes.MASTERCARD -> R.drawable.mastercard_md | ||
CreditCardTypes.UNION_PAY -> R.drawable.union_pay_md | ||
CreditCardTypes.VISA -> R.drawable.visa_md | ||
else -> R.drawable.generic_bank_md | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.