small fixes for single payout and big chunck for multiple payouts
This commit is contained in:
@@ -11,10 +11,12 @@ import 'package:pshared/provider/recipient/pmethods.dart';
|
||||
import 'package:pshared/provider/recipient/provider.dart';
|
||||
|
||||
import 'package:pweb/pages/payment_methods/payment_page/body.dart';
|
||||
import 'package:pweb/app/router/payout_routes.dart';
|
||||
import 'package:pweb/utils/recipient/filtering.dart';
|
||||
import 'package:pweb/widgets/sidebar/destinations.dart';
|
||||
import 'package:pweb/services/posthog.dart';
|
||||
import 'package:pweb/widgets/dialogs/payment_status_dialog.dart';
|
||||
import 'package:pweb/controllers/payment_page.dart';
|
||||
|
||||
|
||||
class PaymentPage extends StatefulWidget {
|
||||
@@ -92,19 +94,23 @@ class _PaymentPageState extends State<PaymentPage> {
|
||||
});
|
||||
}
|
||||
|
||||
void _handleSendPayment() {
|
||||
Future<void> _handleSendPayment() async {
|
||||
final flowProvider = context.read<PaymentFlowProvider>();
|
||||
final paymentProvider = context.read<PaymentProvider>();
|
||||
final controller = context.read<PaymentPageController>();
|
||||
if (paymentProvider.isLoading) return;
|
||||
|
||||
paymentProvider.pay().then((payment) {
|
||||
if (!mounted) return;
|
||||
final isSuccess = payment != null && paymentProvider.error == null;
|
||||
showPaymentStatusDialog(context, isSuccess: isSuccess);
|
||||
if (isSuccess) {
|
||||
PosthogService.paymentInitiated(method: flowProvider.selectedType);
|
||||
}
|
||||
});
|
||||
final isSuccess = await controller.sendPayment();
|
||||
if (!mounted) return;
|
||||
|
||||
await showPaymentStatusDialog(context, isSuccess: isSuccess);
|
||||
if (!mounted) return;
|
||||
|
||||
if (isSuccess) {
|
||||
PosthogService.paymentInitiated(method: flowProvider.selectedType);
|
||||
controller.resetAfterSuccess();
|
||||
context.goToPayout(widget.fallbackDestination);
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
|
||||
Reference in New Issue
Block a user