From def28ba5c8ad093dca229e1bdc12ca538f819929 Mon Sep 17 00:00:00 2001 From: M Date: Thu, 30 Jun 2022 13:23:11 +0100 Subject: [PATCH] Change ionia base url. Add exception throwing for error messaging for some of ionia calls. --- lib/ionia/ionia_api.dart | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/ionia/ionia_api.dart b/lib/ionia/ionia_api.dart index a3667cca8..b00c52217 100644 --- a/lib/ionia/ionia_api.dart +++ b/lib/ionia/ionia_api.dart @@ -8,7 +8,7 @@ import 'package:cake_wallet/ionia/ionia_virtual_card.dart'; import 'package:cake_wallet/ionia/ionia_category.dart'; class IoniaApi { - static const baseUri = 'apidev.dashdirect.org'; + static const baseUri = 'apidev.ionia.io'; static const pathPrefix = 'cake'; static final createUserUri = Uri.https(baseUri, '/$pathPrefix/CreateUser'); static final verifyEmailUri = Uri.https(baseUri, '/$pathPrefix/VerifyEmail'); @@ -229,14 +229,14 @@ class IoniaApi { final response = await post(getPurchaseMerchantsUrl, headers: headers, body: json.encode(body)); if (response.statusCode != 200) { - return null; + throw Exception('Unexpected response'); } final decodedBody = json.decode(response.body) as Map; final isSuccessful = decodedBody['Successful'] as bool ?? false; - + if (!isSuccessful) { - return null; + throw Exception(decodedBody['ErrorMessage'] as String); } final data = decodedBody['Data'] as Map;