Skip to content

Commit

Permalink
Add uob_wlb_installment
Browse files Browse the repository at this point in the history
  • Loading branch information
AnasNaouchi committed Jan 9, 2025
1 parent 31f7a8d commit 9457173
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 0 deletions.
2 changes: 2 additions & 0 deletions app/src/main/java/co/omise/android/example/PaymentSetting.kt
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ object PaymentSetting {
R.string.payment_preference_installment_ttb_key,
R.string.payment_preference_installment_ttb_wlb_key,
R.string.payment_preference_installment_uob_key,
R.string.payment_preference_installment_uob_wlb_key,
R.string.payment_preference_alipay_key,
R.string.payment_preference_alipay_cn_key,
R.string.payment_preference_alipay_hk_key,
Expand Down Expand Up @@ -107,6 +108,7 @@ object PaymentSetting {
context.getString(R.string.payment_preference_installment_ttb_key) -> SourceType.Installment.Ttb
context.getString(R.string.payment_preference_installment_ttb_wlb_key) -> SourceType.Installment.TtbWlb
context.getString(R.string.payment_preference_installment_uob_key) -> SourceType.Installment.Uob
context.getString(R.string.payment_preference_installment_uob_wlb_key) -> SourceType.Installment.UobWlb
context.getString(R.string.payment_preference_econtext_key) -> SourceType.Econtext
context.getString(R.string.payment_preference_fpx_key) -> SourceType.Fpx()
context.getString(R.string.payment_preference_paynow_key) -> SourceType.PayNow
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
<string name="payment_preference_installment_ttb_key" translatable="false">installment_ttb</string>
<string name="payment_preference_installment_ttb_wlb_key" translatable="false">installment_wlb_ttb</string>
<string name="payment_preference_installment_uob_key" translatable="false">installment_uob</string>
<string name="payment_preference_installment_uob_wlb_key" translatable="false">installment_wlb_uob</string>
<string name="payment_preference_dana_key" translatable="false">dana</string>
<string name="payment_preference_econtext_key" translatable="false">econtext</string>
<string name="payment_preference_fpx_key" translatable="false">fpx</string>
Expand Down Expand Up @@ -103,6 +104,7 @@
<string name="payment_preference_installment_ttb_title" translatable="false">TMBThanachart - Installment</string>
<string name="payment_preference_installment_ttb_wlb_title" translatable="false">TMBThanachart - Whitelabel Installment</string>
<string name="payment_preference_installment_uob_title" translatable="false">UOB - Installment</string>
<string name="payment_preference_installment_uob_wlb_title" translatable="false">UOB - Whitelabel Installment</string>
<string name="payment_preference_dana_title" translatable="false">DANA</string>
<string name="payment_preference_econtext_title" translatable="false">econtext</string>
<string name="payment_preference_fpx_title" translatable="false">FPX</string>
Expand Down
5 changes: 5 additions & 0 deletions app/src/main/res/xml/preference_payment_setting.xml
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,11 @@
app:key="@string/payment_preference_installment_uob_key"
app:title="@string/payment_preference_installment_uob_title" />

<CheckBoxPreference
app:defaultValue="true"
app:key="@string/payment_preference_installment_uob_wlb_key"
app:title="@string/payment_preference_installment_uob_wlb_title" />

<CheckBoxPreference
app:defaultValue="true"
app:key="@string/payment_preference_econtext_key"
Expand Down
4 changes: 4 additions & 0 deletions sdk/src/main/java/co/omise/android/models/SourceType.kt
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,8 @@ sealed class SourceType(

object Uob : Installment("installment_uob")

object UobWlb : Installment("installment_wlb_uob")

data class Unknown(
@JsonValue override val name: String?,
) : Installment(name)
Expand Down Expand Up @@ -178,6 +180,7 @@ sealed class SourceType(
"installment_ttb" -> Installment.Ttb
"installment_wlb_ttb" -> Installment.TtbWlb
"installment_uob" -> Installment.Uob
"installment_wlb_uob" -> Installment.UobWlb
"paynow" -> PayNow
"promptpay" -> PromptPay
"alipay_cn" -> AlipayCn
Expand Down Expand Up @@ -243,6 +246,7 @@ val SourceType.Companion.allElements: List<SourceType>
SourceType.Installment.Ttb,
SourceType.Installment.TtbWlb,
SourceType.Installment.Uob,
SourceType.Installment.UobWlb,
SourceType.Atome,
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ internal class InstallmentTermChooserFragment : OmiseListFragment<InstallmentTer
SourceType.Installment.Ttb to Amount.fromLocalAmount(500.0, currency),
SourceType.Installment.TtbWlb to Amount.fromLocalAmount(500.0, currency),
SourceType.Installment.Uob to Amount.fromLocalAmount(500.0, currency),
SourceType.Installment.UobWlb to Amount.fromLocalAmount(500.0, currency),
)
val interestRatePerType =
mapOf(
Expand All @@ -75,6 +76,7 @@ internal class InstallmentTermChooserFragment : OmiseListFragment<InstallmentTer
SourceType.Installment.Ttb to 0.008,
SourceType.Installment.TtbWlb to 0.008,
SourceType.Installment.Uob to 0.0064,
SourceType.Installment.UobWlb to 0.0064,
)
val sourceType = (installment?.backendType as? BackendType.Source)?.sourceType!!
// White label installments require token and source
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -481,6 +481,12 @@ internal sealed class InstallmentResource(
indicatorIconRes = R.drawable.ic_next,
sourceType = SourceType.Installment.Uob,
)
object UobWlb : InstallmentResource(
iconRes = R.drawable.payment_uob,
titleRes = R.string.payment_method_installment_uob_title,
indicatorIconRes = R.drawable.ic_next,
sourceType = SourceType.Installment.UobWlb,
)
}

internal data class InstallmentTermResource(
Expand Down

0 comments on commit 9457173

Please sign in to comment.