createCardTransaction method
Future<Map>
createCardTransaction(
- String token,
- String transactionAmount,
- String transactionCurrencyCode,
- String? merchantInfo,
- String? merchantCategoryCode,
- String? cardNumber,
- String? cardId,
- String? authCode,
override
Implementation
@override
Future<Map> createCardTransaction(
String token,
String transactionAmount,
String transactionCurrencyCode,
String? merchantInfo,
String? merchantCategoryCode,
String? cardNumber,
String? cardId,
String? authCode) async {
final String baseUrl = await getBaseUrl;
var url = Uri.parse("$baseUrl/api/v1/simulation/issuing/create");
var bodyData = {
"transaction_amount": transactionAmount,
"transaction_currency": transactionCurrencyCode
};
if (authCode != null) {
bodyData.addAll({"auth_code": authCode});
}
if (cardId != null) {
bodyData.addAll({"card_id": cardId});
}
if (cardNumber != null) {
bodyData.addAll({"card_number": cardNumber});
}
if (merchantCategoryCode != null) {
bodyData.addAll({"merchant_category_code": merchantCategoryCode});
}
if (merchantInfo != null) {
bodyData.addAll({"merchant_info": merchantInfo});
}
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;
}