Compare commits
No commits in common. "faa0a1495bce73ac53ea868bebd33e4dfa065a6b" and "9981ebc9d1071102cd7a8d214eec6f476e6095f0" have entirely different histories.
faa0a1495b
...
9981ebc9d1
5 changed files with 463 additions and 115 deletions
|
@ -52,14 +52,10 @@ public class DepositController {
|
||||||
|
|
||||||
SessionCreateParams params = SessionCreateParams.builder()
|
SessionCreateParams params = SessionCreateParams.builder()
|
||||||
.addLineItem(SessionCreateParams.LineItem.builder()
|
.addLineItem(SessionCreateParams.LineItem.builder()
|
||||||
.setPriceData(SessionCreateParams.LineItem.PriceData.builder()
|
.setAmount((long) amountDto.getAmount() * 100)
|
||||||
.setCurrency("EUR")
|
.setCurrency("EUR")
|
||||||
.setUnitAmount((long) amountDto.getAmount() * 100)
|
|
||||||
.setProductData(SessionCreateParams.LineItem.PriceData.ProductData.builder()
|
|
||||||
.setName("Einzahlung")
|
|
||||||
.build())
|
|
||||||
.build())
|
|
||||||
.setQuantity(1L)
|
.setQuantity(1L)
|
||||||
|
.setName("Einzahlung")
|
||||||
.build())
|
.build())
|
||||||
.setSuccessUrl(frontendHost+"/home?success=true")
|
.setSuccessUrl(frontendHost+"/home?success=true")
|
||||||
.setCancelUrl(frontendHost+"/home?success=false")
|
.setCancelUrl(frontendHost+"/home?success=false")
|
||||||
|
|
|
@ -40,7 +40,7 @@ public class TransactionService {
|
||||||
.build();
|
.build();
|
||||||
Session checkoutSession = Session.retrieve(sessionID, params, null);
|
Session checkoutSession = Session.retrieve(sessionID, params, null);
|
||||||
|
|
||||||
if (!"paid".equals(checkoutSession.getPaymentStatus())) {
|
if (!Objects.equals(checkoutSession.getPaymentStatus(), "paid")) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -53,12 +53,10 @@ public class TransactionService {
|
||||||
transaction.setStatus(TransactionStatus.SUCCEEDED);
|
transaction.setStatus(TransactionStatus.SUCCEEDED);
|
||||||
|
|
||||||
UserEntity user = transaction.getUser();
|
UserEntity user = transaction.getUser();
|
||||||
Long amountTotal = checkoutSession.getAmountTotal();
|
user.addBalance(checkoutSession.getAmountTotal());
|
||||||
if (amountTotal != null) {
|
|
||||||
user.addBalance(amountTotal);
|
|
||||||
}
|
|
||||||
|
|
||||||
userRepository.save(user);
|
userRepository.save(user);
|
||||||
transactionRepository.save(transaction);
|
transactionRepository.save(transaction);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,18 +51,12 @@ public class WebhookController {
|
||||||
switch (event.getType()) {
|
switch (event.getType()) {
|
||||||
case "checkout.session.completed":
|
case "checkout.session.completed":
|
||||||
case "checkout.session.async_payment_succeeded":
|
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());
|
this.transactionService.fulfillCheckout(session.getId());
|
||||||
} else {
|
|
||||||
logger.error("Failed to deserialize webhook event data");
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
// No action needed for other event types
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return ResponseEntity.ok().body(null);
|
return ResponseEntity.ok().body(null);
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -28,7 +28,7 @@
|
||||||
"@fortawesome/free-solid-svg-icons": "^6.7.2",
|
"@fortawesome/free-solid-svg-icons": "^6.7.2",
|
||||||
"@stripe/stripe-js": "^7.0.0",
|
"@stripe/stripe-js": "^7.0.0",
|
||||||
"@tailwindcss/postcss": "^4.0.3",
|
"@tailwindcss/postcss": "^4.0.3",
|
||||||
"ajv": "8.17.1",
|
"ajv": "8.8.0",
|
||||||
"ajv-formats": "3.0.1",
|
"ajv-formats": "3.0.1",
|
||||||
"gsap": "^3.12.7",
|
"gsap": "^3.12.7",
|
||||||
"keycloak-angular": "^19.0.0",
|
"keycloak-angular": "^19.0.0",
|
||||||
|
|
Reference in a new issue