checkTransaction method
Future<PaywayCheckTransactionResponse>
checkTransaction({
- required PaywayCheckTransaction transaction,
- bool enabledLogger = false,
checkTransaction
check the current status of this transaction vai its id
Implementation
Future<PaywayCheckTransactionResponse> checkTransaction(
{required PaywayCheckTransaction transaction,
bool enabledLogger = false}) async {
var res = PaywayCheckTransactionResponse(status: 11);
Map<String, dynamic> map = transaction.toFormDataMap();
var formData = FormData.fromMap(map);
try {
if (helper == null) return PaywayCheckTransactionResponse();
final client = helper!.client;
if (enabledLogger) {
debugPrint(json.encode(map));
client.interceptors.add(dioLoggerInterceptor);
}
Response<String> response =
await client.post("/check-transaction", data: formData);
var _map = json.decode(response.data!) as Map<String, dynamic>;
res = PaywayCheckTransactionResponse.fromMap(_map);
return res;
} catch (error, stacktrace) {
print("Exception occured: $error stackTrace: $stacktrace");
res = res.copyWith(
description: ABAClientService.handleResponseError(error));
}
return res;
}