Show iDEAL 0,01 temporary charge warning dialog for monthly subscription.

This commit is contained in:
Cody Henthorne 2024-02-02 09:36:38 -05:00 committed by Nicholas Tinsley
parent e798feb1d7
commit 673fe2625c
2 changed files with 30 additions and 6 deletions

View file

@ -49,6 +49,7 @@ import androidx.lifecycle.LifecycleOwner
import androidx.navigation.fragment.findNavController
import androidx.navigation.fragment.navArgs
import androidx.navigation.navGraphViewModels
import com.google.android.material.dialog.MaterialAlertDialogBuilder
import org.signal.core.ui.Buttons
import org.signal.core.ui.Scaffolds
import org.signal.core.ui.Texts
@ -156,13 +157,30 @@ class IdealTransferDetailsFragment : ComposeFragment(), DonationCheckoutDelegate
}
private fun onDonateClick() {
stripePaymentViewModel.provideIDEALData(viewModel.state.value.asIDEALData())
findNavController().safeNavigate(
IdealTransferDetailsFragmentDirections.actionBankTransferDetailsFragmentToStripePaymentInProgressFragment(
DonationProcessorAction.PROCESS_NEW_DONATION,
args.request
val state = viewModel.state.value
val continueTransfer = {
stripePaymentViewModel.provideIDEALData(state.asIDEALData())
findNavController().safeNavigate(
IdealTransferDetailsFragmentDirections.actionBankTransferDetailsFragmentToStripePaymentInProgressFragment(
DonationProcessorAction.PROCESS_NEW_DONATION,
args.request
)
)
)
}
if (args.request.donateToSignalType == DonateToSignalType.MONTHLY) {
MaterialAlertDialogBuilder(requireContext())
.setTitle(getString(R.string.IdealTransferDetailsFragment__confirm_your_donation_with_s, getString(state.idealBank!!.getUIValues().name)))
.setMessage(R.string.IdealTransferDetailsFragment__monthly_ideal_warning)
.setPositiveButton(R.string.IdealTransferDetailsFragment__continue) { _, _ ->
continueTransfer()
}
.setNegativeButton(android.R.string.cancel, null)
.show()
} else {
continueTransfer()
}
}
override fun onUserLaunchedAnExternalApplication() {

View file

@ -5978,6 +5978,12 @@
<string name="IdealTransferDetailsFragment__email">Email</string>
<!-- Default label for bank selection -->
<string name="IdealTransferDetailsFragment__choose_your_bank">Choose your bank</string>
<!-- Dialog title shown when using iDEAL payment for setting up a monthly donation -->
<string name="IdealTransferDetailsFragment__confirm_your_donation_with_s">Confirm your donation with %1$s</string>
<!-- Dialog warning shown when using iDEAL payment for setting up a monthly donation -->
<string name="IdealTransferDetailsFragment__monthly_ideal_warning">To setup your recurring donation tap continue to confirm a €0,01 charge with your bank. This will be automatically refunded and allows your €5/month donation to debited from your account.</string>
<!-- Dialog button shown when using iDEAL payment for setting up a monthly donation to continue with the donation -->
<string name="IdealTransferDetailsFragment__continue">Continue</string>
<!-- IdealTransferDetailsBankSelectionDialogFragment -->
<!-- Title of the screen, displayed in the toolbar -->