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

Add is_enabled field to Networks and Restrict Orders to Enabled Networks #422

Open
chibie opened this issue Feb 10, 2025 · 1 comment · May be fixed by #424
Open

Add is_enabled field to Networks and Restrict Orders to Enabled Networks #422

chibie opened this issue Feb 10, 2025 · 1 comment · May be fixed by #424
Assignees

Comments

@chibie
Copy link
Contributor

chibie commented Feb 10, 2025

User Story
As a developer, I want to ensure that payments can only be initiated for networks that are enabled, so that we can control which networks are actively supported and prevent payments on unsupported networks.

Acceptance Criteria

  1. GIVEN a network has is_enabled set to false
    WHEN a payment is initiated via POST: /sender/orders
    THEN the request should fail with an appropriate error message

  2. GIVEN the setRPCClients function is called
    WHEN it fetches networks
    THEN only networks with is_enabled set to true should be fetched and used for indexing

  3. GIVEN a new network is added
    WHEN the is_enabled field is not explicitly set
    THEN it should default to false

  4. GIVEN a database migration is generated
    WHEN the migration is applied
    THEN the network table should have a new is_enabled column, defaulting to false

Tech Details

  1. Generate a database migration to add the is_enabled field to the network table, defaulting to false.
  2. Add the is_enabled field to the Network entity in the database schema.
  3. Update the setRPCClients function to only fetch and connect to enabled networks.
  4. Add validation in POST: /sender/orders to ensure payments can only be initiated for enabled networks. See here
  5. Write unit tests to verify:
    • Payments are blocked for disabled networks.
    • Only enabled networks are fetched and used in setRPCClients.
    • The is_enabled field defaults to false for new networks.

Notes/Assumptions

  • Existing networks will need to be updated manually to set is_enabled to true if they are actively supported.
  • The POST: /sender/orders endpoint should return a clear error message (e.g., "Provided token is not supported for the specified network") when a payment is attempted on a disabled network.
@JuViquez
Copy link

I’d like to work on this.

@sundayonah sundayonah self-assigned this Feb 10, 2025
@sundayonah sundayonah linked a pull request Feb 11, 2025 that will close this issue
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants