Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix FPX bank order #2156

Merged
merged 1 commit into from
Feb 10, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 15 additions & 15 deletions stripe/src/main/java/com/stripe/android/view/FpxBank.kt
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,22 @@ enum class FpxBank(
val displayName: String,
val brandIconResId: Int = R.drawable.stripe_ic_bank_generic
) {
Maybank2U("MB2U0227", "maybank2u", "Maybank2U",
R.drawable.stripe_ic_bank_maybank),
Cimb("BCBB0235", "cimb", "CIMB Clicks",
R.drawable.stripe_ic_bank_cimb),
PublicBank("PBB0233", "public_bank", "Public Bank",
R.drawable.stripe_ic_bank_public),
Rhb("RHB0218", "rhb", "RHB Bank",
R.drawable.stripe_ic_bank_rhb),
HongLeongBank("HLB0224", "hong_leong_bank", "Hong Leong Bank",
R.drawable.stripe_ic_bank_hong_leong),
AmBank("AMBB0209", "ambank", "AmBank",
R.drawable.stripe_ic_bank_ambank),
AffinBank("ABB0233", "affin_bank", "Affin Bank",
R.drawable.stripe_ic_bank_affin),
AllianceBankBusiness("ABMB0212", "alliance_bank", "Alliance Bank (Personal)",
AllianceBankBusiness("ABMB0212", "alliance_bank", "Alliance Bank",
R.drawable.stripe_ic_bank_alliance),
AmBank("AMBB0209", "ambank", "AmBank",
R.drawable.stripe_ic_bank_ambank),
BankIslam("BIMB0340", "bank_islam", "Bank Islam",
R.drawable.stripe_ic_bank_islam),
BankMuamalat("BMMB0341", "bank_muamalat", "Bank Muamalat",
Expand All @@ -23,27 +33,17 @@ enum class FpxBank(
R.drawable.stripe_ic_bank_raykat),
Bsn("BSN0601", "bsn", "BSN",
R.drawable.stripe_ic_bank_bsn),
Cimb("BCBB0235", "cimb", "CIMB Clicks",
R.drawable.stripe_ic_bank_cimb),
HongLeongBank("HLB0224", "hong_leong_bank", "Hong Leong Bank",
R.drawable.stripe_ic_bank_hong_leong),
Hsbc("HSBC0223", "hsbc", "HSBC BANK",
Hsbc("HSBC0223", "hsbc", "HSBC Bank",
R.drawable.stripe_ic_bank_hsbc),
Kfh("KFH0346", "kfh", "KFH",
R.drawable.stripe_ic_bank_kfh),
Maybank2E("MBB0228", "maybank2e", "Maybank2E",
R.drawable.stripe_ic_bank_maybank),
Maybank2U("MB2U0227", "maybank2u", "Maybank2U",
R.drawable.stripe_ic_bank_maybank),
Ocbc("OCBC0229", "ocbc", "OCBC Bank",
R.drawable.stripe_ic_bank_ocbc),
PublicBank("PBB0233", "public_bank", "Public Bank",
R.drawable.stripe_ic_bank_public),
Rhb("RHB0218", "rhb", "RHB Bank",
R.drawable.stripe_ic_bank_rhb),
StandardChartered("SCB0216", "standard_chartered", "Standard Chartered",
R.drawable.stripe_ic_bank_standard_chartered),
UobBank("UOB0226", "uob", "UOB Bank",
UobBank("UOB0226", "uob", "UOB",
R.drawable.stripe_ic_bank_uob);

companion object {
Expand Down
28 changes: 28 additions & 0 deletions stripe/src/test/java/com/stripe/android/view/FpxBankTest.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.stripe.android.view

import com.google.common.truth.Truth.assertThat
import kotlin.test.Test
import kotlin.test.assertEquals
import kotlin.test.assertNull
Expand All @@ -14,4 +15,31 @@ class FpxBankTest {
fun testGet_withInvalidBank() {
assertNull(FpxBank.get("not_a_bank"))
}

@Test
fun testOrder() {
val expected = listOf(
"Maybank2U",
"CIMB Clicks",
"Public Bank",
"RHB Bank",
"Hong Leong Bank",
"AmBank",
"Affin Bank",
"Alliance Bank",
"Bank Islam",
"Bank Muamalat",
"Bank Rakyat",
"BSN",
"HSBC Bank",
"KFH",
"Maybank2E",
"OCBC Bank",
"Standard Chartered",
"UOB"
)
val actual = FpxBank.values().map { it.displayName }
assertThat(expected)
.isEqualTo(actual)
}
}