use of com.stripe.model.Fee in project alf.io by alfio-event.
the class StripeManager method getInfo.
Optional<PaymentInformation> getInfo(Transaction transaction, Event event) {
try {
Optional<RequestOptions> requestOptionsOptional = options(event);
if (requestOptionsOptional.isPresent()) {
RequestOptions options = requestOptionsOptional.get();
Charge charge = Charge.retrieve(transaction.getTransactionId(), options);
String paidAmount = MonetaryUtil.formatCents(charge.getAmount());
String refundedAmount = MonetaryUtil.formatCents(charge.getAmountRefunded());
List<Fee> fees = retrieveBalanceTransaction(charge.getBalanceTransaction(), options).getFeeDetails();
return Optional.of(new PaymentInformation(paidAmount, refundedAmount, getFeeAmount(fees, "stripe_fee"), getFeeAmount(fees, "application_fee")));
}
return Optional.empty();
} catch (StripeException e) {
return Optional.empty();
}
}
Aggregations