mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2025-01-09 12:29:31 +00:00
Change ionia base url. Add exception throwing for error messaging for some of ionia calls.
This commit is contained in:
parent
0a7f8bf286
commit
def28ba5c8
1 changed files with 4 additions and 4 deletions
|
@ -8,7 +8,7 @@ import 'package:cake_wallet/ionia/ionia_virtual_card.dart';
|
||||||
import 'package:cake_wallet/ionia/ionia_category.dart';
|
import 'package:cake_wallet/ionia/ionia_category.dart';
|
||||||
|
|
||||||
class IoniaApi {
|
class IoniaApi {
|
||||||
static const baseUri = 'apidev.dashdirect.org';
|
static const baseUri = 'apidev.ionia.io';
|
||||||
static const pathPrefix = 'cake';
|
static const pathPrefix = 'cake';
|
||||||
static final createUserUri = Uri.https(baseUri, '/$pathPrefix/CreateUser');
|
static final createUserUri = Uri.https(baseUri, '/$pathPrefix/CreateUser');
|
||||||
static final verifyEmailUri = Uri.https(baseUri, '/$pathPrefix/VerifyEmail');
|
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));
|
final response = await post(getPurchaseMerchantsUrl, headers: headers, body: json.encode(body));
|
||||||
|
|
||||||
if (response.statusCode != 200) {
|
if (response.statusCode != 200) {
|
||||||
return null;
|
throw Exception('Unexpected response');
|
||||||
}
|
}
|
||||||
|
|
||||||
final decodedBody = json.decode(response.body) as Map<String, dynamic>;
|
final decodedBody = json.decode(response.body) as Map<String, dynamic>;
|
||||||
final isSuccessful = decodedBody['Successful'] as bool ?? false;
|
final isSuccessful = decodedBody['Successful'] as bool ?? false;
|
||||||
|
|
||||||
if (!isSuccessful) {
|
if (!isSuccessful) {
|
||||||
return null;
|
throw Exception(decodedBody['ErrorMessage'] as String);
|
||||||
}
|
}
|
||||||
|
|
||||||
final data = decodedBody['Data'] as Map<String, dynamic>;
|
final data = decodedBody['Data'] as Map<String, dynamic>;
|
||||||
|
|
Loading…
Reference in a new issue