Skip to content

Commit

Permalink
Merge pull request #170 from skyflowapi/SK-1597-fix-card-brand-choice
Browse files Browse the repository at this point in the history
SK-1597 Fix card brand choice
  • Loading branch information
skyflow-vivek authored Sep 6, 2024
2 parents 0ffcbf4 + 5bbfa39 commit d504361
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ class StateforText internal constructor(val tf: TextField) : State(tf.columnName
}

private fun getCardSchemeString(): String {
return if (tf.cardType === CardType.EMPTY) ""
else tf.cardType.toString()
return if (tf.cardType === CardType.EMPTY || !tf.isCustomCardBrandSelected) ""
else tf.cardType.defaultName.uppercase()
}

override fun show(): String {
Expand Down Expand Up @@ -69,13 +69,15 @@ class StateforText internal constructor(val tf: TextField) : State(tf.columnName
state.put("isRequired", isRequired)
state.put("isFocused", isFocused)
state.put("isValid", isValid)
state.put("selectedCardScheme", selectedCardScheme)
var value = ""
if (env == Env.DEV) {
value = tf.getValue()
} else if (env == Env.PROD && tf.fieldType == SkyflowElementType.CARD_NUMBER) {
value = CardType.getBin(tf.getValue())
}
if (tf.fieldType == SkyflowElementType.CARD_NUMBER) {
state.put("selectedCardScheme", selectedCardScheme)
}
state.put("value", value)
return state
}
Expand Down

0 comments on commit d504361

Please sign in to comment.