getStatusPayment method
Implementation
Future<void> getStatusPayment({required String token}) async {
_isLoader = true;
notifyListeners();
final result = await repository.checkStatusTransaction(
transactionId: responsePayment?.transactionId ?? "", token: token);
result.fold((error) {
if (error.codeStatus == 504) {
_statusPayment = EnumStatusPayment.failed;
responsePayment = error.data;
onFailed?.call(responsePayment!);
onCallBack?.call(error.data!);
} else {
_messageError = error.message;
_showError = true;
onError?.call(true);
}
}, (response) {
responsePayment = response.data;
if (response.codeStatus == 202) {
onPending?.call(true);
} else {
_isLoader = false;
_statusPayment = EnumStatusPayment.successful;
onSuccessful?.call(responsePayment!);
onCallBack?.call(response.data!);
}
});
notifyListeners();
}