From 2aed755724dcf3368fc23254a97682af31255d38 Mon Sep 17 00:00:00 2001 From: Hillel Coren Date: Tue, 20 Apr 2021 18:07:19 +0300 Subject: [PATCH] Stripe connect --- lib/ui/company_gateway/edit/company_gateway_edit.dart | 8 +++++--- lib/ui/company_gateway/edit/company_gateway_edit_vm.dart | 4 ++++ 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/lib/ui/company_gateway/edit/company_gateway_edit.dart b/lib/ui/company_gateway/edit/company_gateway_edit.dart index 14f2ce402..c27452f9f 100644 --- a/lib/ui/company_gateway/edit/company_gateway_edit.dart +++ b/lib/ui/company_gateway/edit/company_gateway_edit.dart @@ -134,9 +134,11 @@ class _CompanyGatewayEditState extends State companyGateway.gatewayId == kGatewayStripeConnect) AppButton( label: localization.stripeConnect.toUpperCase(), - onPressed: () { - viewModel.onStripeConnectPressed(); - }, + onPressed: viewModel.state.isSaving + ? null + : () { + viewModel.onStripeConnectPressed(); + }, ) else GatewayConfigSettings( diff --git a/lib/ui/company_gateway/edit/company_gateway_edit_vm.dart b/lib/ui/company_gateway/edit/company_gateway_edit_vm.dart index 1c65fb95f..451597747 100644 --- a/lib/ui/company_gateway/edit/company_gateway_edit_vm.dart +++ b/lib/ui/company_gateway/edit/company_gateway_edit_vm.dart @@ -118,11 +118,15 @@ class CompanyGatewayEditVM { final credentials = state.credentials; final url = '${credentials.url}/one_time_token'; + store.dispatch(StartSaving()); + webClient.post(url, credentials.token).then((dynamic response) { + store.dispatch(StopSaving()); print('## RESPONSE: $response'); // TODO parse 'hash' //launch('${credentials.url}/stripe-connect/'); }).catchError((dynamic error) { + store.dispatch(StopSaving()); showErrorDialog( context: navigatorKey.currentContext, message: '$error'); });