createSettlement method

Future<CreateSettlementResponse?> createSettlement()

Executes network call to initiate transactions

Implementation

Future<CreateSettlementResponse?> createSettlement() async {

  CreateSettlementResponse? createSettlementResponse = CreateSettlementResponse();

  final url = "${Utils.getBaseUrl(isTest!)}/${Utils.createSettlement}";

  final response = await http.post(Uri.parse(url),
      headers: {
        "Authorization" : "Bearer $publicKey",
        "Content-Type" : "application/json"
      },
      body: toJson()
  );

  final responseBody = jsonDecode(response.body);
  createSettlementResponse = CreateSettlementResponse.fromJson(responseBody);

  return createSettlementResponse;
}