refundPayment method
Refund payment securely
Implementation
Future<LokotroPayOnResponse> refundPayment({
required String orderId,
required String originalTransactionId,
required double amount,
required String currency,
String? reason,
}) async {
if (!isInitialized) {
return _createErrorResponse(
'Service not initialized',
'Please initialize the service first',
amount,
currency,
orderId,
);
}
try {
return await _backendProxy!.refundPayment(
orderId: orderId,
originalTransactionId: originalTransactionId,
amount: amount,
currency: currency,
userId: _currentUserId!,
reason: reason,
sessionToken: _currentSessionToken,
);
} catch (e) {
return _createErrorResponse(
'Refund Error',
'Failed to process refund: $e',
amount,
currency,
orderId,
);
}
}