handleApiResponse method
Implementation
void handleApiResponse(PaymentStatusResponseModel? model) {
if (model == null) {
print('No response from API');
return;
}
BuildContext context = Get.context!;
try {
if (model.status == "POS200") {
// paymentResponse = model;
paymentTransactionId.value = model.data!.transactionId.toString();
actionType.value = model.data!.merchantId.toString();
customerID.value = model.data!.customerId.toString();
var status = model.data?.status ?? "";
if (status == "SUCCESS") {
paymentStatus.value = status;
stopApiPolling();
// stopScreenTime();
if (paymentmodestatus == 2) {
Helper.close();
}
} else if (disableCancelButton(status)) {
stopApiPolling();
//stopScreenTime();
// errorMessage.value = model.data?.errorMessage ?? "";
paymentStatus.value = status;
if (paymentmodestatus == 2) {
Helper.close();
}
} else {
if (_isTimerExpired) {
stopApiPolling();
// stopScreenTime();
Helper.close();
}
paymentStatus.value = status;
}
} else {
if (_isTimerExpired) {
stopApiPolling();
// stopScreenTime();
Helper.close();
}
}
} catch (e) {
if (_isTimerExpired) {
stopApiPolling();
// stopScreenTime();
Helper.close();
}
// paymentStatus.value = "Failure";
print('Error handling response: $e');
}
}