diff --git a/android/navi-pay/src/main/kotlin/com/navi/pay/analytics/NaviPayAnalytics.kt b/android/navi-pay/src/main/kotlin/com/navi/pay/analytics/NaviPayAnalytics.kt index 8eeda3650e..7365138673 100644 --- a/android/navi-pay/src/main/kotlin/com/navi/pay/analytics/NaviPayAnalytics.kt +++ b/android/navi-pay/src/main/kotlin/com/navi/pay/analytics/NaviPayAnalytics.kt @@ -3632,6 +3632,7 @@ class NaviPayAnalytics private constructor() { } fun onResetUpiPinClicked( + errorCode: String, source: SendMoneyScreenSource, transactionType: UpiTransactionType, naviPaySessionAttributes: Map, @@ -3647,11 +3648,15 @@ class NaviPayAnalytics private constructor() { naviPaySessionAttributes["naviPaySessionId"].orEmpty(), "naviPayCustomerStatusMap" to naviPaySessionAttributes["naviPayCustomerStatusMap"].orEmpty(), + "errorCode" to errorCode, ), ) } - fun onPaymentFailedRetryAddAccountClicked(naviPaySessionAttributes: Map) { + fun onPaymentFailedRetryAddAccountClicked( + naviPaySessionAttributes: Map, + errorCode: String, + ) { NaviTrackEvent.trackEventOnClickStream( eventName = "NaviPay_SendMoney_Payment_Failed_BottomSheet_AddAccount_Clicked", eventValues = @@ -3660,12 +3665,14 @@ class NaviPayAnalytics private constructor() { naviPaySessionAttributes["naviPaySessionId"].orEmpty(), "naviPayCustomerStatusMap" to naviPaySessionAttributes["naviPayCustomerStatusMap"].orEmpty(), + "errorCode" to errorCode, ), ) } fun onPaymentFailedRetryPayViaAnotherAccountClicked( - naviPaySessionAttributes: Map + naviPaySessionAttributes: Map, + errorCode: String, ) { NaviTrackEvent.trackEventOnClickStream( eventName = @@ -3676,11 +3683,15 @@ class NaviPayAnalytics private constructor() { naviPaySessionAttributes["naviPaySessionId"].orEmpty(), "naviPayCustomerStatusMap" to naviPaySessionAttributes["naviPayCustomerStatusMap"].orEmpty(), + "errorCode" to errorCode, ), ) } - fun onPaymentFailedRetryOkayGotItClicked(naviPaySessionAttributes: Map) { + fun onPaymentFailedRetryOkayGotItClicked( + naviPaySessionAttributes: Map, + errorCode: String, + ) { NaviTrackEvent.trackEventOnClickStream( eventName = "NaviPay_SendMoney_Payment_Failed_BottomSheet_OkayGotIt_Clicked", eventValues = @@ -3689,11 +3700,15 @@ class NaviPayAnalytics private constructor() { naviPaySessionAttributes["naviPaySessionId"].orEmpty(), "naviPayCustomerStatusMap" to naviPaySessionAttributes["naviPayCustomerStatusMap"].orEmpty(), + "errorCode" to errorCode, ), ) } - fun onPaymentFailedRetryCrossIconClicked(naviPaySessionAttributes: Map) { + fun onPaymentFailedRetryCrossIconClicked( + naviPaySessionAttributes: Map, + errorCode: String, + ) { NaviTrackEvent.trackEventOnClickStream( eventName = "NaviPay_SendMoney_Payment_Failed_BottomSheet_CrossIcon_Clicked", eventValues = @@ -3702,11 +3717,15 @@ class NaviPayAnalytics private constructor() { naviPaySessionAttributes["naviPaySessionId"].orEmpty(), "naviPayCustomerStatusMap" to naviPaySessionAttributes["naviPayCustomerStatusMap"].orEmpty(), + "errorCode" to errorCode, ), ) } - fun onPaymentFailedRetryRetryClicked(naviPaySessionAttributes: Map) { + fun onPaymentFailedRetryRetryClicked( + naviPaySessionAttributes: Map, + errorCode: String, + ) { NaviTrackEvent.trackEventOnClickStream( eventName = "NaviPay_SendMoney_Payment_Failed_BottomSheet_Retry_Clicked", eventValues = @@ -3715,11 +3734,15 @@ class NaviPayAnalytics private constructor() { naviPaySessionAttributes["naviPaySessionId"].orEmpty(), "naviPayCustomerStatusMap" to naviPaySessionAttributes["naviPayCustomerStatusMap"].orEmpty(), + "errorCode" to errorCode, ), ) } - fun onPaymentFailedRetryCheckBalanceClicked(naviPaySessionAttributes: Map) { + fun onPaymentFailedRetryCheckBalanceClicked( + naviPaySessionAttributes: Map, + errorCode: String, + ) { NaviTrackEvent.trackEventOnClickStream( eventName = "NaviPay_SendMoney_Payment_Failed_BottomSheet_CheckBalance_Clicked", eventValues = @@ -3728,6 +3751,7 @@ class NaviPayAnalytics private constructor() { naviPaySessionAttributes["naviPaySessionId"].orEmpty(), "naviPayCustomerStatusMap" to naviPaySessionAttributes["naviPayCustomerStatusMap"].orEmpty(), + "errorCode" to errorCode, ), ) } diff --git a/android/navi-pay/src/main/kotlin/com/navi/pay/management/common/sendmoney/ui/SendMoneyBottomSheetContent.kt b/android/navi-pay/src/main/kotlin/com/navi/pay/management/common/sendmoney/ui/SendMoneyBottomSheetContent.kt index 01b28a3533..f858204664 100644 --- a/android/navi-pay/src/main/kotlin/com/navi/pay/management/common/sendmoney/ui/SendMoneyBottomSheetContent.kt +++ b/android/navi-pay/src/main/kotlin/com/navi/pay/management/common/sendmoney/ui/SendMoneyBottomSheetContent.kt @@ -242,17 +242,20 @@ fun SendMoneyBottomSheetContent( when (ctaType) { PaymentFailedErrorBottomSheetDismissCtaType.RETRY -> { naviPayAnalytics.onPaymentFailedRetryRetryClicked( - naviPaySessionAttributes = naviPaySessionAttributes + naviPaySessionAttributes = naviPaySessionAttributes, + errorCode = bottomSheetType.errorCode, ) } PaymentFailedErrorBottomSheetDismissCtaType.OKAY_GOT_IT -> { naviPayAnalytics.onPaymentFailedRetryOkayGotItClicked( - naviPaySessionAttributes = naviPaySessionAttributes + naviPaySessionAttributes = naviPaySessionAttributes, + errorCode = bottomSheetType.errorCode, ) } PaymentFailedErrorBottomSheetDismissCtaType.CROSS_BUTTON -> { naviPayAnalytics.onPaymentFailedRetryCrossIconClicked( - naviPaySessionAttributes = naviPaySessionAttributes + naviPaySessionAttributes = naviPaySessionAttributes, + errorCode = bottomSheetType.errorCode, ) } } @@ -263,13 +266,15 @@ fun SendMoneyBottomSheetContent( sendMoneyScreenSource = sendMoneyScreenSource, onAddAccountClicked = { naviPayAnalytics.onPaymentFailedRetryAddAccountClicked( - naviPaySessionAttributes = naviPaySessionAttributes + naviPaySessionAttributes = naviPaySessionAttributes, + errorCode = bottomSheetType.errorCode, ) onAddAccountClicked() }, onPayViaAnotherAccountClicked = { naviPayAnalytics.onPaymentFailedRetryPayViaAnotherAccountClicked( - naviPaySessionAttributes = naviPaySessionAttributes + naviPaySessionAttributes = naviPaySessionAttributes, + errorCode = bottomSheetType.errorCode, ) onMoreAccountsClick(SEND_MONEY_PAYMENT_FAILED_MORE_ACCOUNTS) }, @@ -277,7 +282,8 @@ fun SendMoneyBottomSheetContent( selectedBankAccount = selectedBankAccount, onCheckBalanceClicked = { accountId -> naviPayAnalytics.onPaymentFailedRetryCheckBalanceClicked( - naviPaySessionAttributes = naviPaySessionAttributes + naviPaySessionAttributes = naviPaySessionAttributes, + errorCode = bottomSheetType.errorCode, ) sendMoneyViewModel.onCheckBalanceClicked(accountId) }, diff --git a/android/navi-pay/src/main/kotlin/com/navi/pay/management/common/sendmoney/util/SendMoneyUtils.kt b/android/navi-pay/src/main/kotlin/com/navi/pay/management/common/sendmoney/util/SendMoneyUtils.kt index f55d43b9da..0868261eec 100644 --- a/android/navi-pay/src/main/kotlin/com/navi/pay/management/common/sendmoney/util/SendMoneyUtils.kt +++ b/android/navi-pay/src/main/kotlin/com/navi/pay/management/common/sendmoney/util/SendMoneyUtils.kt @@ -174,6 +174,7 @@ sealed class SendMoneyBottomSheetType { data object MerchantFeeInfoBottomSheet : SendMoneyBottomSheetType() data class PaymentFailedRetryBottomSheet( + val errorCode: String, val errorBucket: PaymentRetryErrorBucket, val isPaymentThroughLite: Boolean, ) : SendMoneyBottomSheetType() diff --git a/android/navi-pay/src/main/kotlin/com/navi/pay/management/common/sendmoney/viewmodel/SendMoneyViewModel.kt b/android/navi-pay/src/main/kotlin/com/navi/pay/management/common/sendmoney/viewmodel/SendMoneyViewModel.kt index 9fc5ed5584..a0522f7193 100644 --- a/android/navi-pay/src/main/kotlin/com/navi/pay/management/common/sendmoney/viewmodel/SendMoneyViewModel.kt +++ b/android/navi-pay/src/main/kotlin/com/navi/pay/management/common/sendmoney/viewmodel/SendMoneyViewModel.kt @@ -459,6 +459,8 @@ constructor( private var naviPayDefaultConfig = NaviPayDefaultConfig() + private var paymentFailedErrorCode: String = EMPTY + private val isQrFromUploadImage = if (source is SendMoneyScreenSource.ScanAndPay) { source.qrData.isQrFromUploadImage @@ -1151,6 +1153,7 @@ constructor( source = source, naviPaySessionAttributes = getNaviPaySessionAttributes(), transactionType = transactionType, + errorCode = paymentFailedErrorCode, ) naviPayPspManager.evaluateAndOnboardPspForFlow( @@ -2937,12 +2940,15 @@ constructor( return } + paymentFailedErrorCode = response.errors?.getOrNull(0)?.code.orEmpty() + /** is a valid error bucket, show payment failed retry bottom sheet */ updateBottomSheetUIState( showBottomSheet = true, bottomSheetStateChange = true, bottomSheetUIState = SendMoneyBottomSheetType.PaymentFailedRetryBottomSheet( + errorCode = paymentFailedErrorCode, errorBucket = errorBucket, isPaymentThroughLite = isPaymentThroughLite, ),