getTransactionDetails method
Get transaction details
Implementation
Future<LokotroEWalletTransactionResponse> getTransactionDetails({
required String transactionId,
}) async {
try {
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 responseData = response.data!['data'] as Map<String, dynamic>;
return LokotroEWalletTransactionResponse(
transactionId: responseData['transaction_id'] as String,
status: responseData['status'] as String,
channel: responseData['channel'] as String?,
fillingInfo: responseData['filling_info'] as String?,
paymentMethodId: responseData['payment_method_id'] as String?,
transactionalAmount: (responseData['transactional_amount'] as num?)?.toDouble(),
currency: responseData['currency'] as String?,
createdAt: responseData['created_at'] as String?,
message: response.data!['message'] as String,
);
} else {
throw LokotroPayException(
message: response.message,
code: 'TRANSACTION_FETCH_FAILED',
);
}
} catch (e) {
LokotroPayLog.m('ewallet.tx.err', 'get transaction failed (type=${e.runtimeType})');
rethrow;
}
}