diff --git a/android/navi-payment/src/main/java/com/navi/payment/nativepayment/viewmodel/NPSViewModel.kt b/android/navi-payment/src/main/java/com/navi/payment/nativepayment/viewmodel/NPSViewModel.kt index 1d69a3b021..1beea034b7 100644 --- a/android/navi-payment/src/main/java/com/navi/payment/nativepayment/viewmodel/NPSViewModel.kt +++ b/android/navi-payment/src/main/java/com/navi/payment/nativepayment/viewmodel/NPSViewModel.kt @@ -8,6 +8,7 @@ package com.navi.payment.nativepayment.viewmodel import android.app.Activity +import android.app.Activity.RESULT_CANCELED import android.content.Intent import androidx.activity.compose.ManagedActivityResultLauncher import androidx.activity.result.ActivityResult @@ -109,6 +110,7 @@ import com.navi.payment.turbocheckout.model.UpiIntentPayNowRequest import com.navi.payment.turbocheckout.model.UpiPayNowRequest import com.navi.payment.utils.Constants import com.navi.payment.utils.Constants.COIN_DISCOUNT_APPLY_DELAY +import com.navi.payment.utils.PaymentSource import com.navi.payment.utils.getInstalledUpiApps import com.navi.payment.utils.getPMSMetricInfo import com.navi.payment.utils.roundTo @@ -490,6 +492,9 @@ constructor( } override fun handleNaviUpiConnectedAccountsUpdate() { + if (paymentSdkInitParams?.paymentSource == PaymentSource.AMC.name) { + return + } viewModelScope.launch { (npsScreenState.naviUpiPaymentState.bankAccountState as? BankAccountsState.AccountList) ?.let { oldList -> @@ -898,7 +903,12 @@ constructor( } } } else if ( - selectedBankAccount.isNotNull() || npsScreenState.naviUpiPaymentState.showOnboardingCard + selectedBankAccount.isNotNull() || + npsScreenState.naviUpiPaymentState.showOnboardingCard || + (npsScreenState.naviUpiPaymentState.bankAccountState + as BankAccountsState.AccountList) + .accounts + .isNotNullAndNotEmpty() ) { if (naviPayManager.isUserOnboarded().not()) { viewModelScope.launch { @@ -916,13 +926,13 @@ constructor( ) } } else { - if (selectedBankAccount?.isMPinSet.orFalse().not()) { + if (selectedBankAccount?.isMPinSet.orTrue().not()) { val entryPoint = UpiIntent.SET_PIN.name val pinSetPayload = getMpinSetAction(selectedBankAccount?.accountId.orEmpty()) _effect.emit( NPSScreenContract.NPSScreenEffect.StartNaviUpiMPinSetAction(pinSetPayload) ) - } else { + } else if (selectedBankAccount.isNotNull()) { showLoader(true) val discountState = npsScreenState.naviCoinState payNowRequest = @@ -1118,12 +1128,16 @@ constructor( ) ) handlePayNowClicked() - } else if (npsScreenState.naviUpiPaymentState.selectedBankAccount.isNull()) { + } else if ( + paymentSdkInitParams?.paymentSource == PaymentSource.AMC.name || + npsScreenState.naviUpiPaymentState.selectedBankAccount.isNull() + ) { handleNpsRefresh() } } else { if ( - npsScreenState.naviUpiPaymentState.selectedBankAccount.isNull() && + result.resultCode != RESULT_CANCELED && + npsScreenState.naviUpiPaymentState.selectedBankAccount.isNull() && naviUpiConnectedAccounts.isNotNullAndNotEmpty() ) { handleNpsRefresh()