Compare commits

...

3 commits

Author SHA1 Message Date
f6dd50dc44
Merge branch 'main' into fix-pipeline2
Some checks failed
CI / Get Changed Files (pull_request) Successful in 8s
CI / prettier (pull_request) Successful in 28s
CI / Checkstyle Main (pull_request) Successful in 48s
CI / test-build (pull_request) Successful in 36s
CI / eslint (pull_request) Failing after 37s
2025-04-23 07:16:50 +00:00
eda1fc8417
Merge pull request 'refactor: replace switch statement with if statement' (!132) from refactor-webhook into main
Some checks are pending
Release / Release (push) Waiting to run
Reviewed-on: #132
Reviewed-by: Constantin Simonis <constantin@simonis.lol>
2025-04-23 07:16:24 +00:00
Phan Huy Tran
94ca93e510 refactor: replace switch statement with ugly a if statement (no go idiomatic btw)
All checks were successful
CI / Get Changed Files (pull_request) Successful in 6s
CI / eslint (pull_request) Has been skipped
CI / prettier (pull_request) Has been skipped
CI / test-build (pull_request) Has been skipped
CI / Checkstyle Main (pull_request) Successful in 37s
2025-04-23 09:14:19 +02:00

View file

@ -46,14 +46,10 @@ public class WebhookController {
public ResponseEntity<String> webhook(@RequestBody String payload, @RequestHeader("Stripe-Signature") String sigHeader) throws StripeException {
Event event = Webhook.constructEvent(payload, sigHeader, webhookSecret);
switch (event.getType()) {
case "checkout.session.completed":
case "checkout.session.async_payment_succeeded":
Session session = (Session) event.getData().getObject();
if (Objects.equals(event.getType(), "checkout.session.completed") || Objects.equals(event.getType(), "checkout.session.async_payment_succeeded")) {
Session session = (Session) event.getData().getObject();
this.transactionService.fulfillCheckout(session.getId());
break;
default:
this.transactionService.fulfillCheckout(session.getId());
}
return ResponseEntity.ok().body(null);