@@ -640,8 +640,8 @@ class HomeViewModel @Inject constructor(
640640 }.onFailure { error ->
641641 error.printStackTrace()
642642 TopBarManager .showMessage(
643- " Payment Failed " ,
644- " This payment request could not be paid at this time. Please try again later. "
643+ resources.getString( R .string.error_title_payment_failed) ,
644+ resources.getString( R .string.error_description_payment_failed),
645645 )
646646 uiFlow.update { uiModel ->
647647 uiModel.copy(
@@ -659,47 +659,43 @@ class HomeViewModel @Inject constructor(
659659 }
660660 }
661661
662- fun cancelPayment (rejected : Boolean , ignoreRedirect : Boolean = false) {
662+ private fun cancelPayment (rejected : Boolean , ignoreRedirect : Boolean = false) {
663663 val bill = uiFlow.value.billState.bill ? : return
664664 val amount = bill.amount
665665 val request = bill.metadata.request
666666
667667 analytics.requestHidden(amount = amount)
668668
669- if (rejected) {
670- if (! ignoreRedirect) {
671- request?.cancelUrl?.let {
672- viewModelScope.launch {
673- _eventFlow .emit(HomeEvent .OpenUrl (it))
674- }
675- }
676- }
677- } else {
678- showToast(amount, isDeposit = false )
679-
680- if (! ignoreRedirect) {
681- request?.successUrl?.let {
682- viewModelScope.launch {
683- _eventFlow .emit(HomeEvent .OpenUrl (it))
684- }
685- }
686- }
687- }
688-
689669 uiFlow.update {
690670 it.copy(
691- presentationStyle = PresentationStyle .Hidden ,
671+ presentationStyle = PresentationStyle .Slide ,
692672 billState = it.billState.copy(
693673 bill = null ,
694- showToast = false ,
695674 paymentConfirmation = null ,
696- loginConfirmation = null ,
697- toast = null ,
698675 valuation = null ,
699676 hideBillButtons = false ,
700677 )
701678 )
702679 }
680+
681+ viewModelScope.launch {
682+ delay(300 )
683+ if (rejected) {
684+ if (! ignoreRedirect) {
685+ request?.cancelUrl?.let {
686+ _eventFlow .emit(HomeEvent .OpenUrl (it))
687+ }
688+ }
689+ } else {
690+ showToast(amount, isDeposit = false )
691+
692+ if (! ignoreRedirect) {
693+ request?.successUrl?.let {
694+ _eventFlow .emit(HomeEvent .OpenUrl (it))
695+ }
696+ }
697+ }
698+ }
703699 }
704700
705701 fun rejectPayment (ignoreRedirect : Boolean = false) {
0 commit comments