refactor: replace switch statement with ugly a if statement (no go idiomatic btw)
All checks were successful
All checks were successful
This commit is contained in:
parent
1fe3148019
commit
94ca93e510
1 changed files with 3 additions and 7 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue