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

feat: add endpoint for cancelling orders #2656

Merged
merged 9 commits into from
Sep 20, 2024
Merged

feat: add endpoint for cancelling orders #2656

merged 9 commits into from
Sep 20, 2024

Conversation

pavelbrm
Copy link
Contributor

@pavelbrm pavelbrm commented Sep 16, 2024

Summary

This PR adds a new endpoint which works similar to the existing one for cancelling orders expect for it does not handle subscription cancellations in Stripe. Instead, it just updates the order status to canceled.

I've considered going with PUT and/or using 204 response, but rejected those options because they did not fit this use case. So had to stick with DELETE and 200 in response, with an empty body.

Also, for some tests .ErrorIs and .Nil for errors were not applicable, details for which I could provide if needed. Had to use the simple .Equal because it simply works, and does the comparison the way I need it.

Hopefully the points above provide the necessary context during review.

Type of Change

  • Product feature
  • Bug fix
  • Performance improvement
  • Refactor
  • Other

Tested Environments

  • Development
  • Staging
  • Production

Before Requesting Review

  • Does your code build cleanly without any errors or warnings?
  • Have you used auto closing keywords?
  • Have you added tests for new functionality?
  • Have validated query efficiency for new database queries?
  • Have documented new functionality in README or in comments?
  • Have you squashed all intermediate commits?
  • Is there a clear title that explains what the PR does?
  • Have you used intuitive function, variable and other naming?
  • Have you requested security and/or privacy review if needed
  • Have you performed a self review of this PR?

Manual Test Plan

@pavelbrm pavelbrm self-assigned this Sep 16, 2024
@pavelbrm pavelbrm requested a review from clD11 September 18, 2024 12:29
Copy link
Contributor

@clD11 clD11 left a comment

Choose a reason for hiding this comment

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

Approved with comments and questions.

services/skus/handler/handler.go Show resolved Hide resolved
services/skus/handler/handler_test.go Outdated Show resolved Hide resolved
services/skus/service.go Show resolved Hide resolved
services/skus/handler/handler_test.go Outdated Show resolved Hide resolved
services/grant/cmd/grant.go Outdated Show resolved Hide resolved
@pavelbrm pavelbrm merged commit 3c0b1d4 into master Sep 20, 2024
12 checks passed
@pavelbrm pavelbrm deleted the cancel-order-01 branch September 20, 2024 12:33
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.

2 participants