getTransactionForPaymentProcess method

Future<void> getTransactionForPaymentProcess({
  1. required String url,
  2. required String token,
})

Fetch payment information for processing

Implementation

Future<void> getTransactionForPaymentProcess({
  required String url,
  required String token,
}) async {
  try {
    setLoading(true);
    navigateToScreen(LokotroPayScreenNavigation.loadingScreen);

    // Set auth token
    _httpClient.setAuthToken(token);

    // Make API request
    final response = await _httpClient.get<LokotroPayRequestResponse>(
      url,
      parser: (data) => LokotroPayRequestResponse.fromJson(data),
    );

    if (response.isSuccess && response.data != null) {
      _paymentProcessInfoController.add(response.data!);
      navigateToScreen(LokotroPayScreenNavigation.paymentMethodSelectionScreen);
      setSuccessMessage('Payment information loaded successfully');
    } else {
      _handleApiError(response.message);
    }
  } catch (e) {
    _handleError(e);
  } finally {
    setLoading(false);
  }
}