check method

check

check the current status of this transaction vai its id

Implementation

Future<ABAServerResponse> check() async {
  var res = ABAServerResponse(status: 11);
  final _reqTime = reqTime;
  var hash =
      ABAClientService(merchant).getHash(reqTime: _reqTime, tranId: tranID);
  var form = FormData.fromMap({
    "req_time": _reqTime,
    "tran_id": tranID,
    "hash": hash,
    "merchant_id": this.merchant!.merchantID,
  });
  var helper = ABAClientService(merchant);

  try {
    Response<String> response =
        await helper.client.post("/check-transaction", data: form);
    var map = json.decode(response.data!) as Map<String, dynamic>;

    res = ABAServerResponse.fromMap(map);
    return res;
  } catch (error, stacktrace) {
    print("Exception occured: $error stackTrace: $stacktrace");
    res.description = ABAClientService.handleResponseError(error);
  }
  return ABAServerResponse();
}