getCardWalletDetails static method
Implementation
static Future<dynamic> getCardWalletDetails(Map<String, dynamic> payload, String env) async {
String url = getBaseUrl(env) +"issuance/v1/cardholders/cards/"+payload["cardId"]+"/wallets";
///print("Url--->$url");
try {
final response = await Card91HttpMethods.getMethods(url, payload["loginAuthToken"], "", "");
//log("getSmartWalletsData--->${response.body}");
if (response.statusCode >= 200 && response.statusCode <= 299) {
//Map<String, dynamic> jsonData = jsonDecode(response.body);
var walletDetailModel = walletDetailResponseModelFromJson(response.body);
var bodyClient = walletDetailResponseModelToJson(walletDetailModel);
//print("MY DATA --->"+bodyClient.toString());
final Map<String, dynamic> data = json.decode(bodyClient);
return card91ResponseBodyToJson(new Card91ResponseBody(success: true, headers: response.headers, data: data));
} else {
print("body----->"+response.body.toString());
Map<String, dynamic> jsonData = jsonDecode(response.body);
Map<String, dynamic> jsonDataHeader = jsonDecode("{}");
return card91ResponseBodyToJson(Card91ResponseBody(success: false, headers: jsonDataHeader, data: jsonData));
}
} on SocketException {
Map<String, dynamic> jsonData = jsonDecode('{"message": "Internet or Socket Exception"}');
Map<String, dynamic> jsonDataHeader = jsonDecode("{}");
return card91ResponseBodyToJson(new Card91ResponseBody(success: false, headers: jsonDataHeader, data: jsonData));
throw ('noInternetConnection'.tr);
} on HandshakeException {
Map<String, dynamic> jsonData = jsonDecode('{"message":"Handshake Exception"}');
Map<String, dynamic> jsonDataHeader = jsonDecode("{}");
return card91ResponseBodyToJson(new Card91ResponseBody(success: false, headers: jsonDataHeader, data: jsonData));
throw ("No internet");
}
}