createLockFXQuote method
Future<Map>
createLockFXQuote(
- String token,
- String? buyAmount,
- String buyCurrency,
- String? conversionDate,
- String? sellAmount,
- String sellCurrency,
- String validity,
override
Implementation
@override
Future<Map> createLockFXQuote(
String token,
String? buyAmount,
String buyCurrency,
String? conversionDate,
String? sellAmount,
String sellCurrency,
String validity) async {
final String baseUrl = await getBaseUrl;
var url = Uri.parse("$baseUrl/api/v1/lockfx/create");
var bodyData = {
"buy_currency": buyCurrency,
"sell_currency": sellCurrency,
"validity": validity
};
if (buyAmount != null) {
bodyData.addAll({"buy_amount": buyAmount});
}
if (conversionDate != null) {
bodyData.addAll({"conversion_date": conversionDate});
}
if (sellAmount != null) {
bodyData.addAll({"sell_amount": sellAmount});
}
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;
}