capturePayment method
Capture authorized payment
Implementation
Future<LokotroPayOnResponse> capturePayment({
required String orderId,
required String authorizationTransactionId,
required double amount,
String? currency,
}) async {
try {
final paymentResponse = await _paymentService.capturePayment(
orderId: orderId,
authorizationTransactionId: authorizationTransactionId,
amount: amount,
currency: currency ?? config.currency,
);
return _convertToLokotroResponse(paymentResponse);
} on MastercardException catch (e) {
return LokotroPayOnResponse(
title: 'Capture Failed',
message: e.errorMessage,
paymentStatus: LokotroPaymentStatus.failed,
apiResponseCode: LokotroPayApiResponseCode.lok001,
amount: amount,
currency: currency ?? config.currency,
systemRef: _uuid.v4(),
customRef: orderId,
timestamp: DateTime.now(),
transactionId: null,
);
}
}