Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature (template/server): Provide a server side application template for webhooks #10

Merged
merged 6 commits into from
Jul 18, 2024

Conversation

JPPortier
Copy link
Contributor

PR based onto Numbers related one because of using Numbers versioned V1; but have to be merged after Numbers to main

@JPPortier JPPortier requested a review from alex-sberna July 9, 2024 06:41
@alex-sberna
Copy link
Contributor

Overall, this is really good stuff. What are your thoughts on how the snippets will be slotted in? Will the snippet file just be able to replace the business logic file, like the way the client app works?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion of class naming: ParsedEventHandler

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to our last discussion, ServerBusinessLogic will be used

Base automatically changed from DEVEXP-468-use-versioned-numbers-v1 to main July 16, 2024 15:16
…e classes processing webhooks business logic
@JPPortier JPPortier marked this pull request as ready for review July 16, 2024 15:30
NumberEvent event = webhooks.parseEvent(body);

// let business layer process the request
webhooksBusinessLogic.numbersEvent(event);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Although thanks to the Spring Boot configuration (typically the @ResponseBody annotation included with @RestController) and the method returning void, this will return an empty body with a status 200 (which is expected), it might be clearer to explicitly a ResponseEntity to make the intended behavior clear

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very good [educational] idea 👍
Applied to all controllers

WebHooksService webhooks = sinchClient.numbers().v1().webhooks();

// decode the request payload
NumberEvent event = webhooks.parseEvent(body);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideally, the incoming request should be verified before being processed

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right.
Created a ticket to add this missing feature to webhooks service
Thank you to highlight this

com: INFO

server:
port: 8080
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not the same value as in the README file (8090)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

@JPPortier JPPortier merged commit 22f77f5 into main Jul 18, 2024
1 check passed
@JPPortier JPPortier deleted the DEVEXP-466-server-template branch July 18, 2024 15:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants