verifyPayment method

Future<void> verifyPayment(
  1. String transactionId
)

Verify payment status

Implementation

Future<void> verifyPayment(String transactionId) async {
  try {
    setLoading(true);

    final response = await _httpClient.get<LokotroPayResponse>(
      LokotroPayEnv.buildVerifyPaymentUrl(transactionId),
      parser: (data) => LokotroPayResponse.fromJson(data),
    );

    if (response.isSuccess && response.data != null) {
      final paymentResponse = response.data!;

      if (paymentResponse.isSuccess) {
        setSuccessMessage(
          'Payment verified successfully',
          title: 'Verification Complete',
        );
      } else {
        setWarningMessage(
          'Payment verification failed',
          title: 'Verification Failed',
        );
      }
    } else {
      _handleApiError(response.message);
    }
  } catch (e) {
    _handleError(e);
  } finally {
    setLoading(false);
  }
}