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 =
      ABAClientHelper(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 = ABAClientHelper(merchant);
  ABAPayment.logger.error("tid $tranID");
  try {
    Response<String> response =
        await helper.getDio().post("/check-transaction", data: form);
    var map = json.decode(response.data!) as Map<String, dynamic>;
    ABAPayment.logger.error("checkMap $map $response");
    res = ABAServerResponse.fromMap(map);
    return res;
  } catch (error, stacktrace) {
    print("Exception occured: $error stackTrace: $stacktrace");
    res.description = ABAClientHelper.handleResponseError(error);
  }
  return ABAServerResponse();
}