Compare commits

..

No commits in common. "faa0a1495bce73ac53ea868bebd33e4dfa065a6b" and "9981ebc9d1071102cd7a8d214eec6f476e6095f0" have entirely different histories.

5 changed files with 463 additions and 115 deletions

View file

@ -52,14 +52,10 @@ public class DepositController {
SessionCreateParams params = SessionCreateParams.builder()
.addLineItem(SessionCreateParams.LineItem.builder()
.setPriceData(SessionCreateParams.LineItem.PriceData.builder()
.setCurrency("EUR")
.setUnitAmount((long) amountDto.getAmount() * 100)
.setProductData(SessionCreateParams.LineItem.PriceData.ProductData.builder()
.setName("Einzahlung")
.build())
.build())
.setAmount((long) amountDto.getAmount() * 100)
.setCurrency("EUR")
.setQuantity(1L)
.setName("Einzahlung")
.build())
.setSuccessUrl(frontendHost+"/home?success=true")
.setCancelUrl(frontendHost+"/home?success=false")

View file

@ -40,7 +40,7 @@ public class TransactionService {
.build();
Session checkoutSession = Session.retrieve(sessionID, params, null);
if (!"paid".equals(checkoutSession.getPaymentStatus())) {
if (!Objects.equals(checkoutSession.getPaymentStatus(), "paid")) {
return;
}
@ -53,12 +53,10 @@ public class TransactionService {
transaction.setStatus(TransactionStatus.SUCCEEDED);
UserEntity user = transaction.getUser();
Long amountTotal = checkoutSession.getAmountTotal();
if (amountTotal != null) {
user.addBalance(amountTotal);
}
user.addBalance(checkoutSession.getAmountTotal());
userRepository.save(user);
transactionRepository.save(transaction);
}
}

View file

@ -51,18 +51,12 @@ public class WebhookController {
switch (event.getType()) {
case "checkout.session.completed":
case "checkout.session.async_payment_succeeded":
EventDataObjectDeserializer dataObjectDeserializer = event.getDataObjectDeserializer();
Session session = (Session) event.getData().getObject();
if (dataObjectDeserializer.getObject().isPresent()) {
Session session = (Session) dataObjectDeserializer.getObject().get();
this.transactionService.fulfillCheckout(session.getId());
} else {
logger.error("Failed to deserialize webhook event data");
}
this.transactionService.fulfillCheckout(session.getId());
break;
default:
// No action needed for other event types
break;
}
return ResponseEntity.ok().body(null);

File diff suppressed because it is too large Load diff

View file

@ -28,7 +28,7 @@
"@fortawesome/free-solid-svg-icons": "^6.7.2",
"@stripe/stripe-js": "^7.0.0",
"@tailwindcss/postcss": "^4.0.3",
"ajv": "8.17.1",
"ajv": "8.8.0",
"ajv-formats": "3.0.1",
"gsap": "^3.12.7",
"keycloak-angular": "^19.0.0",