Skip to content

Commit

Permalink
Merge pull request #157 from veritrans/kredivo
Browse files Browse the repository at this point in the history
[CHEC-648] add Kredivo
  • Loading branch information
uziwuzzy authored Mar 31, 2024
2 parents 337dc0c + e26212d commit db15c9a
Show file tree
Hide file tree
Showing 19 changed files with 73 additions and 45 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ class DemoConfigurationActivity : AppCompatActivity() {
PaymentMethod.GO_PAY, PaymentMethod.SHOPEEPAY, PaymentMethod.KLIKBCA, PaymentMethod.BCA_KLIKPAY,
PaymentMethod.CIMB_CLICKS, PaymentMethod.EPAY_BRI, PaymentMethod.DANAMON_ONLINE,
PaymentMethod.UOB_EZPAY, PaymentMethod.UOB_EZPAY_APP, PaymentMethod.UOB_EZPAY_WEB,
PaymentMethod.INDOMARET, PaymentMethod.ALFAMART, PaymentMethod.AKULAKU
PaymentMethod.INDOMARET, PaymentMethod.ALFAMART, PaymentMethod.AKULAKU, PaymentMethod.KREDIVO
).map {
it.toString()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ fun AlertDialogDropdownMenu(
ListItem("Alfamart", PaymentType.ALFAMART, isSelected = false),

ListItem("Akulaku", PaymentType.AKULAKU, isSelected = false),
ListItem("Kredivo", PaymentType.KREDIVO, isSelected = false),
ListItem("UOB", PaymentType.UOB_EZPAY, isSelected = false),
)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class OrderReviewRevampActivity : ComponentActivity() {
)
Toast.makeText(
this@OrderReviewRevampActivity,
"Coba trxid ${transactionResult?.transactionId.orEmpty()}",
"Coba trxid ${transactionResult?.transactionId.orEmpty()} trx status ${transactionResult?.status.orEmpty()}",
Toast.LENGTH_LONG
).show()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,6 @@ public enum PaymentMethod {
UOB_EZPAY_APP,
INDOMARET,
AKULAKU,
ALFAMART
ALFAMART,
KREDIVO
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ class PaymentType {
QRIS,
DANAMON_ONLINE,
AKULAKU,
KREDIVO,
CSTORE,
ALFAMART,
UOB_EZPAY_WEB,
Expand Down Expand Up @@ -67,6 +68,7 @@ class PaymentType {

//PAY LATER
const val AKULAKU = "akulaku"
const val KREDIVO = "kredivo"

//CONVENIENCE STORE
const val CSTORE = "cstore"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ class PayLaterPaymentRequestBuilder : PaymentRequestBuilder() {

override fun build(): PaymentRequest {
return when (paymentType) {
PaymentType.AKULAKU -> PaymentRequest(paymentType = paymentType)
PaymentType.AKULAKU,
PaymentType.KREDIVO -> PaymentRequest(paymentType = paymentType)
else -> throw InvalidPaymentTypeException()
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ class PageName {
INDOMARET_PAGE,
ALFAMART_PAGE,
AKULAKU_PAGE,
KREDIVO_PAGE,
KLIK_BCA_PAGE,
BCA_KLIK_PAY_PAGE,
OCTO_CLICKS_PAGE,
Expand Down Expand Up @@ -44,13 +45,14 @@ class PageName {
const val SHOPEEPAY_DEEPLINK_PAGE = "Shopeepay Deeplink Instruction"
const val INDOMARET_PAGE = "Indomaret Page"
const val ALFAMART_PAGE = "Alfamart Page"
const val AKULAKU_PAGE = "Akulaku Instruction"
const val KLIK_BCA_PAGE = "KlikBCA Instruction"
const val BCA_KLIK_PAY_PAGE = "BCAKlikPay Instruction"
const val AKULAKU_PAGE = "Akulaku Instruction"
const val KREDIVO_PAGE = "Kredivo Instruction"
const val KLIK_BCA_PAGE = "KlikBCA Instruction"
const val BCA_KLIK_PAY_PAGE = "BCAKlikPay Instruction"
const val OCTO_CLICKS_PAGE = "OCTOClicks Instruction"
const val DANAMON_ONLINE_PAGE = "Danamon Online Banking Instruction"
const val BRIMO_PAGE = "BRImo Instruction"
const val UOB_PAGE = "UOB EZpay Instruction"
const val UOB_PAGE = "UOB EZpay Instruction"
const val UOB_SELECTION_PAGE = "UOB EZpay Selection"
const val REDIRECTION_PAGE = "Redirection Page"
const val SUCCESS_PAGE = "Success Page"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ class PaymentType {
SHOPEEPAY,
DANAMON_ONLINE,
AKULAKU,
KREDIVO,
CSTORE,
ALFAMART,
UOB_EZPAY_WEB,
Expand Down Expand Up @@ -61,6 +62,7 @@ class PaymentType {

//PAY LATER
const val AKULAKU = "akulaku"
const val KREDIVO = "kredivo"

//CONVENIENCE STORE
const val CSTORE = "cstore"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ class UiKitApi private constructor(val builder: Builder) {
PaymentMethod.DANAMON_ONLINE -> PaymentTypeItem(PaymentType.DANAMON_ONLINE, null)
PaymentMethod.INDOMARET -> PaymentTypeItem(PaymentType.INDOMARET, null)
PaymentMethod.AKULAKU -> PaymentTypeItem(PaymentType.AKULAKU, null)
PaymentMethod.KREDIVO -> PaymentTypeItem(PaymentType.KREDIVO, null)
PaymentMethod.ALFAMART -> PaymentTypeItem(PaymentType.ALFAMART, null)
PaymentMethod.UOB_EZPAY -> PaymentTypeItem(PaymentType.UOB_EZPAY, null)
PaymentMethod.UOB_EZPAY_APP -> PaymentTypeItem(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ internal class BankTransferDetailActivity : BaseActivity() {
SnapInstructionButton(
isExpanded = isExpanded,
iconResId = R.drawable.ic_help,
title = stringResource(id = R.string.kredivo_how_to_pay_title),
title = stringResource(id = R.string.payment_instruction_how_to_pay_title),
onExpandClick = {
viewModel?.trackHowToPayClicked(paymentType)
isExpanded = !isExpanded
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ internal class ConvenienceStoreActivity : BaseActivity() {
modifier = Modifier.padding(top = 16.dp, bottom = 16.dp),
isExpanded = isExpanded,
iconResId = R.drawable.ic_help,
title = stringResource(id = R.string.kredivo_how_to_pay_title),
title = stringResource(id = R.string.payment_instruction_how_to_pay_title),
onExpandClick = {
viewModel?.trackHowToPayClicked(paymentType)
isExpanded = !isExpanded
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ internal class WalletActivity : BaseActivity() {
modifier = Modifier.padding(top = 16.dp, bottom = 16.dp),
isExpanded = isExpanded,
iconResId = R.drawable.ic_help,
title = stringResource(id = R.string.kredivo_how_to_pay_title),
title = stringResource(id = R.string.payment_instruction_how_to_pay_title),
onExpandClick = {
viewModel.trackHowToPayClicked(paymentType)
isExpanded = !isExpanded
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -288,12 +288,14 @@ class PayLaterActivity : BaseActivity() {
private fun getTitleId(paymentType: String): Int {
return when (paymentType) {
PaymentType.AKULAKU -> R.string.akulaku_title
PaymentType.KREDIVO -> R.string.kredivo_title
else -> 0
}
}

private fun getCta(paymentType: String): Int {
return when (paymentType) {
PaymentType.KREDIVO -> R.string.kredivo_cta
PaymentType.AKULAKU -> R.string.akulaku_cta
else -> 0
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -661,7 +661,8 @@ class PaymentOptionActivity : BaseActivity() {
Pair(PaymentType.GOPAY_QRIS, eWalletPaymentLauncher),
Pair(PaymentType.ALFAMART, cStorePaymentLauncher),
Pair(PaymentType.INDOMARET, cStorePaymentLauncher),
Pair(PaymentType.AKULAKU, payLaterPaymentLauncher)
Pair(PaymentType.AKULAKU, payLaterPaymentLauncher),
Pair(PaymentType.KREDIVO, payLaterPaymentLauncher)
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import com.midtrans.sdk.corekit.api.model.PaymentType.Companion.GOPAY
import com.midtrans.sdk.corekit.api.model.PaymentType.Companion.GOPAY_QRIS
import com.midtrans.sdk.corekit.api.model.PaymentType.Companion.INDOMARET
import com.midtrans.sdk.corekit.api.model.PaymentType.Companion.KLIK_BCA
import com.midtrans.sdk.corekit.api.model.PaymentType.Companion.KREDIVO
import com.midtrans.sdk.corekit.api.model.PaymentType.Companion.OTHER_VA
import com.midtrans.sdk.corekit.api.model.PaymentType.Companion.PERMATA_VA
import com.midtrans.sdk.corekit.api.model.PaymentType.Companion.SHOPEEPAY
Expand Down Expand Up @@ -67,20 +68,21 @@ internal class PaymentOptionViewModel @Inject constructor(

private fun isValidMethod(type: String, isTabletDevice: Boolean): Boolean {
return type == INDOMARET
|| type == ALFAMART
|| type == BANK_TRANSFER
|| type == KLIK_BCA
|| type == BCA_KLIKPAY
|| type == CIMB_CLICKS
|| type == BRI_EPAY
|| type == DANAMON_ONLINE
|| type == UOB_EZPAY
|| type == CREDIT_CARD
|| type == AKULAKU
|| (type == GOPAY && !isTabletDevice)
|| (type == GOPAY_QRIS && isTabletDevice)
|| (type == SHOPEEPAY && !isTabletDevice)
|| (type == SHOPEEPAY_QRIS && isTabletDevice)
|| type == ALFAMART
|| type == BANK_TRANSFER
|| type == KLIK_BCA
|| type == BCA_KLIKPAY
|| type == CIMB_CLICKS
|| type == BRI_EPAY
|| type == DANAMON_ONLINE
|| type == UOB_EZPAY
|| type == CREDIT_CARD
|| type == AKULAKU
|| type == KREDIVO
|| (type == GOPAY && !isTabletDevice)
|| (type == GOPAY_QRIS && isTabletDevice)
|| (type == SHOPEEPAY && !isTabletDevice)
|| (type == SHOPEEPAY_QRIS && isTabletDevice)
}

private fun getIcons(type: String, channels: List<String>, isTabletDevice: Boolean): List<Int> {
Expand All @@ -99,6 +101,7 @@ internal class PaymentOptionViewModel @Inject constructor(
R.drawable.ic_outline_amex_40
)
AKULAKU -> listOf(R.drawable.ic_outline_akulaku_40)
KREDIVO -> listOf(R.drawable.ic_outline_kredivo_40)
GOPAY -> listOf(R.drawable.ic_outline_gopaylogo_40)
GOPAY_QRIS -> {
listOf(
Expand Down Expand Up @@ -136,6 +139,7 @@ internal class PaymentOptionViewModel @Inject constructor(
UOB_EZPAY -> R.string.payment_summary_uobezpay
CREDIT_CARD -> R.string.payment_summary_cc_dc
AKULAKU -> R.string.payment_summary_akulaku
KREDIVO -> R.string.payment_summary_kredivo
INDOMARET -> R.string.payment_summary_indomaret
ALFAMART -> R.string.payment_summary_alfamart
SHOPEEPAY -> R.string.payment_title_shopeepay
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,13 +121,15 @@ fun SnapInstructionButton(
private fun getHowToPayId(paymentType: String): Int? {
return when (paymentType) {
PaymentType.AKULAKU -> R.array.akulaku_how_to_pay
PaymentType.KREDIVO -> R.array.kredivo_how_to_pay
else -> null
}
}

private fun getInstructionId(paymentType: String): Int? {
return when (paymentType) {
PaymentType.AKULAKU -> R.string.akulaku_instruction
PaymentType.KREDIVO -> R.string.kredivo_instruction
else -> null
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,11 @@ private inline fun finishWebView(
onFinishWebView.invoke()
}
}
PaymentType.KREDIVO -> {
if (url.contains(SnapWebViewClient.CALLBACK_KREDIVO, true)) {
onFinishWebView.invoke()
}
}
PaymentType.GOPAY,
PaymentType.SHOPEEPAY,
PaymentType.UOB_EZPAY_APP-> {
Expand All @@ -256,5 +261,6 @@ private class SnapWebViewClient(
const val CALLBACK_AKULAKU = "?refNo="
const val CALLBACK_OLD_THREE_DS = "callback"
const val CALLBACK_NEW_THREE_DS = "result-completion"
const val CALLBACK_KREDIVO = "order_id"
}
}
21 changes: 11 additions & 10 deletions ui/src/main/res/values-in/string.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
<string name="payment_summary_danamonob">Danamon Online Banking</string>
<string name="payment_summary_uobezpay">UOB EZ Pay</string>
<string name="payment_summary_akulaku">Akulaku PayLater</string>
<string name="payment_summary_kredivo">Kredivo</string>
<string name="payment_summary_shopeepay">ShopeePay/e-Wallet Lainnya</string>
<string name="payment_summary_alfamart">Alfa Group</string>
<string name="payment_summary_indomaret">Indomaret</string>
Expand Down Expand Up @@ -356,18 +357,18 @@
</string-array>
<string name="brimo_cta">Bayar sekarang</string>


<string name="kredivo_instruction">Mohon untuk menyelesaikan pembayaran melalui aplikasi/website Krevido.</string>

<string name="kredivo_how_to_pay_title">Cara bayar</string>
<string name="kredivo_step_by_step">1. Klik Bayar sekarang dan Anda akan diarahkan ke halaman Kredivo. 2. Login ke akun Kredivo Anda. 3. Pilih jangka waktu cicilan yang diinginkan. 4. Masukkan kode OTP yang telah dikirimkan ke nomor HP-mu. 4. Klik Bayar. 5. Anda akan mendapatkan konfirmasi pada layar jika transaksi berhasil.</string>

<string name="kredivo_title">Kredivo</string>
<string name="kredivo_instruction">Mohon untuk menyelesaikan pembayaran melalui aplikasi/website kredivo.</string>
<string-array name="kredivo_how_to_pay">
<item><data><![CDATA[Klik <b>Bayar sekarang</b> dan Anda akan diarahkan ke halaman Kredivo.]]></data></item>
<item><data><![CDATA[Login ke akun Kredivo Anda.]]></data></item>
<item><data><![CDATA[Pilih jangka waktu cicilan yang diinginkan.]]></data></item>
<item><data><![CDATA[Masukkan kode OTP yang telah dikirimkan ke nomor HP-mu.]]></data></item>
<item><data><![CDATA[Klik <b>Bayar</b>.]]></data></item>
<item><data><![CDATA[Anda akan mendapatkan konfirmasi pada layar jika transaksi berhasil.]]></data></item>
</string-array>
<string name="kredivo_cta">Bayar sekarang</string>


<string name="kredivo_redirection_main_message">Mengalihkan ke Kredivo…</string>
<string name="kredivo_redirection_cta">Buka sekarang</string>

<string name="uob_ez_pay_title">UOB EZ Pay</string>
<string name="uob_web_method_name">UOB EZ Pay via web</string>
<string name="uob_web_instruction">Pastikan Anda sudah memiliki ID terdaftar dan silakan selesaikan pembayaran melalui UOB EZ Pay.</string>
Expand Down
20 changes: 11 additions & 9 deletions ui/src/main/res/values/string.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
<string name="payment_summary_danamonob">Danamon Online Banking</string>
<string name="payment_summary_uobezpay">UOB EZ Pay</string>
<string name="payment_summary_akulaku">Akulaku PayLater</string>
<string name="payment_summary_kredivo">Kredivo</string>
<string name="payment_summary_shopeepay">ShopeePay/other e-Wallets</string>
<string name="payment_summary_alfamart">Alfa Group</string>
<string name="payment_summary_indomaret">Indomaret</string>
Expand Down Expand Up @@ -361,17 +362,18 @@
<string name="brimo_cta">Pay now</string>


<string name="kredivo_title">Kredivo</string>
<string name="kredivo_instruction">Please complete the payment through Kredivo app/website.</string>

<string name="kredivo_how_to_pay_title">How to pay</string>
<string name="kredivo_step_by_step">1. Tap Pay now and you will be redirected to Kredivo page. 2. Login to your Kredivo account. 3. Choose the installment term. 4. Enter the OTP code that has been sent to your mobile number. 5. Tap Pay. 6. You\'ll get confirmation message on the screen once transaction is successful.</string>

<string-array name="kredivo_how_to_pay">
<item><data><![CDATA[Click <b>Pay Now</b>, then you will be directed to Kredivo page.]]></data></item>
<item><data><![CDATA[Login to your Kredivo account.]]></data></item>
<item><data><![CDATA[Choose the installment term.]]></data></item>
<item><data><![CDATA[Enter the OTP code that has been sent to your mobile number.]]></data></item>
<item><data><![CDATA[Tap <b>Pay</b>.]]></data></item>
<item><data><![CDATA[You\'ll get confirmation message on the screen once transaction is successful.]]></data></item>
</string-array>
<string name="kredivo_cta">Pay now</string>


<string name="kredivo_redirection_main_message">Redirecting to Kredivo…</string>
<string name="kredivo_redirection_cta">Open now</string>


<string name="uob_ez_pay_title">UOB EZ Pay</string>
<string name="uob_web_method_name">UOB EZ Pay via web</string>
<string name="uob_web_instruction">Please make sure that you have registered ID and complete your payment via UOB EZ Pay.</string>
Expand Down

0 comments on commit db15c9a

Please sign in to comment.