createGlobalAccountDeposit method
Future<Map>
createGlobalAccountDeposit(
- String token,
- String amount,
- String globalAccountId,
- String? payerBank,
- String? payerCountry,
- String? payerName,
- String? reference,
- String? status,
override
Implementation
@override
Future<Map> createGlobalAccountDeposit(
String token,
String amount,
String globalAccountId,
String? payerBank,
String? payerCountry,
String? payerName,
String? reference,
String? status) async {
final String baseUrl = await getBaseUrl;
var url = Uri.parse("$baseUrl/api/v1/simulation/deposit/create");
var bodyData = {
"amount": amount,
"global_account_id": globalAccountId,
};
if (payerBank != null) {
bodyData.addAll({"payer_bankname": payerBank});
}
if (payerCountry != null) {
bodyData.addAll({"payer_country": payerCountry});
}
if (payerName != null) {
bodyData.addAll({"payer_name": payerName});
}
if (reference != null) {
bodyData.addAll({"reference": reference});
}
if (status != null) {
bodyData.addAll({"status": status});
}
var jsonBody = jsonEncode(bodyData);
var response = await http.post(
url,
headers: {
"Content-Type": "application/json",
"Authorization": "Bearer $token"
},
body: jsonBody,
);
var data = jsonDecode(response.body);
return data;
}