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

refactor: delete no longer needed code #2732

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

pavelbrm
Copy link
Contributor

@pavelbrm pavelbrm commented Dec 19, 2024

Summary

The main purpose of this PR is to delete the logic for handling the DELETE /v1/orders/{orderID} endpoint. This was an authenticated endpoint for internal use, and it has long ago been migrated away from to DELETE /v1/orders-new/{orderID}. The SKUs service is no longer responsible for cancelling a Stripe subscription in Stripe.

Additionally, the PR adds a missing test for repository.Order.GetByExternalID method.

It also deletes other code that has not been used for a while.

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

@@ -730,10 +709,6 @@ func deleteOrderCreds(service *Service) handlers.AppHandler {
return handlers.ValidationError("orderID", map[string]interface{}{"orderID": err.Error()})
}

if err := service.validateOrderMerchantAndCaveats(ctx, orderID); err != nil {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This does not do anything useful for Premium orders. The endpoint is already authenticated. The merchant is always the same, it's brave.com, and we set it ourselves. And it seems like caveats for Premium are not populated at all, so the check is useless at least, and it also wastes two queries to the database to fetch the order.

@pavelbrm pavelbrm force-pushed the delete-cancel-order-legacy branch from a7c4680 to 203cb2a Compare December 19, 2024 10:51
@pavelbrm pavelbrm force-pushed the delete-cancel-order-legacy branch from 203cb2a to 28e9247 Compare December 19, 2024 11:02
@pavelbrm pavelbrm marked this pull request as ready for review December 19, 2024 11:10
@pavelbrm pavelbrm self-assigned this Dec 19, 2024
@pavelbrm pavelbrm requested a review from clD11 December 19, 2024 11:10
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.

1 participant