use of alfio.model.transaction.webhook.MollieWebhookPayload in project alf.io by alfio-event.
the class MollieWebhookPaymentManager method parseTransactionPayload.
@Override
public Optional<TransactionWebhookPayload> parseTransactionPayload(String body, String signature, Map<String, String> additionalInfo, PaymentContext paymentContext) {
try (var reader = new StringReader(body)) {
Properties properties = new Properties();
properties.load(reader);
return Optional.ofNullable(StringUtils.trimToNull(properties.getProperty("id"))).map(paymentId -> new MollieWebhookPayload(paymentId, PurchaseContext.PurchaseContextType.from(additionalInfo.get(ADDITIONAL_INFO_PURCHASE_CONTEXT_TYPE)), additionalInfo.get(ADDITIONAL_INFO_PURCHASE_IDENTIFIER), additionalInfo.get(ADDITIONAL_INFO_RESERVATION_ID)));
} catch (Exception e) {
log.warn("got exception while trying to decode Mollie Webhook Payload", e);
}
return Optional.empty();
}
Aggregations