create method
create
create a new trasaction
Implementation
Future<ABAServerResponse> create() async {
var res = ABAServerResponse(status: 11);
Map<String, dynamic> map = this.toEncodedMap();
map["type"] = "purchase";
var formData = FormData.fromMap(map);
try {
var helper = ABAClientService(merchant);
var dio = helper.client;
debugPrint(json.encode(map));
dio.interceptors.add(dioLoggerInterceptor);
Response<String> response = await dio.post("/purchase", data: formData);
// ABAPayment.logger.debug(response);
var cast = json.decode(response.data!) as Map<String, dynamic>;
res = ABAServerResponse.fromMap(cast);
return res;
} catch (error, stacktrace) {
print("Exception occured: $error stackTrace: $stacktrace");
res.description = ABAClientService.handleResponseError(error);
}
return ABAServerResponse();
}