getTransactionDetails method
Step 2: Get transaction details GET /payments/transaction/{transaction_id}
Implementation
Future<LokotroTransactionDetails> getTransactionDetails(String transactionId) async {
try {
if (kDebugMode) {
debugPrint('[Lokotro Payment] Getting transaction details: $transactionId');
}
final response = await _httpClient.get<Map<String, dynamic>>(
'/payments/transaction/$transactionId',
parser: (data) => data as Map<String, dynamic>,
);
if (response.isSuccess && response.data != null) {
final transactionDetails = LokotroTransactionDetails.fromJson(response.data!);
if (kDebugMode) {
debugPrint('[Lokotro Payment] Transaction details: ${transactionDetails.toString()}');
}
return transactionDetails;
} else {
throw LokotroPaymentException(
message: response.message,
code: 'TRANSACTION_FETCH_FAILED',
);
}
} catch (e) {
if (kDebugMode) {
debugPrint('[Lokotro Payment] Get transaction details error: $e');
}
rethrow;
}
}