Skip to content

Prevent users from deleting the last payment method attached to the org #4212

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

Merged
merged 1 commit into from
Jul 30, 2025

Conversation

carlosmonastyrski
Copy link
Contributor

Description 📣

Disable ability to remove a payment method if a customer only has one payment method on file

Type ✨

  • Bug fix
  • New feature
  • Improvement
  • Breaking change
  • Documentation

Tests 🛠️

# Here's some code block to paste some code snippets

@maidul98
Copy link
Collaborator

🎉 Snyk checks have passed. No issues have been found so far.

security/snyk check is complete. No issues have been found. (View Details)

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

Greptile Summary

This PR implements a safety mechanism to prevent organizations from deleting their last payment method. The changes span both frontend and backend:

  • Frontend: Adds a validation check in PmtMethodsTable that prevents deletion if only one payment method exists, showing an error notification to users
  • Backend: Enhances error handling in license-service.ts to properly capture and relay error messages from the license server API when payment method deletion fails

These changes ensure organizations maintain at least one valid payment method for billing continuity.

Confidence score: 5/5

  1. This PR is very safe to merge as it adds protective validation without modifying existing behavior
  2. The changes are straightforward, well-implemented, and follow defensive programming practices
  3. Key areas to review:
    • Error handling in license-service.ts
    • Frontend validation logic in PmtMethodsTable.tsx

2 files reviewed, no comments

Edit Code Review Bot Settings | Greptile

@carlosmonastyrski carlosmonastyrski merged commit 9c6ec80 into main Jul 30, 2025
9 checks passed
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