cancelPayment method
Cancel payment
Implementation
Future<void> cancelPayment(String transactionId) async {
try {
setLoading(true);
final response = await _httpClient.post<LokotroPayResponse>(
LokotroPayEnv.buildCancelPaymentUrl(transactionId),
parser: (data) => LokotroPayResponse.fromJson(data),
);
if (response.isSuccess && response.data != null) {
setInfoMessage(
'Payment cancelled successfully',
title: 'Payment Cancelled',
);
navigateToScreen(LokotroPayScreenNavigation.infoScreen);
} else {
_handleApiError(response.message);
}
} catch (e) {
_handleError(e);
} finally {
setLoading(false);
}
}