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

[WIP] Support Multiple Currencies per Provider and Provision Node #372

Open
chibie opened this issue Dec 11, 2024 · 1 comment · May be fixed by #373
Open

[WIP] Support Multiple Currencies per Provider and Provision Node #372

chibie opened this issue Dec 11, 2024 · 1 comment · May be fixed by #373
Assignees
Labels
enhancement New feature or request

Comments

@chibie
Copy link
Contributor

chibie commented Dec 11, 2024

User Story
As a provider, I want to support multiple currencies in my provision node to expand my service offering and handle payments in different fiat currencies.

Acceptance Criteria

  1. GIVEN a user signs up as a provider,
    WHEN they specify currencies,
    THEN they should be able to select one or more supported currencies

  2. GIVEN a provider profile exists,
    WHEN querying provider rates,
    THEN the rate should be specific to the requested currency

  3. GIVEN a provision node is configured,
    WHEN reading currency configuration,
    THEN it should support multiple currencies from environment variables

  4. GIVEN a provision node starts up,
    WHEN registering with PSPs,
    THEN it should register for all configured currencies

  5. GIVEN a provider supports multiple currencies,
    WHEN the priority queue selects providers,
    THEN it should match providers based on supported currencies

Tech Details

  • Schema Changes:

    • Update ProviderProfile schema to support many-to-many relationship with FiatCurrency
    • Add association table for provider-currency relationships
    • Update provider creation endpoint
  • API Changes:

    • Modify signup payload to accept array of currencies
    • Update provider rate queries to filter by currency
    • Add currency parameter to GetProviderRate function
    • Update rate calculation logic for multiple currencies
  • Provision Node Updates:

    • Change Currency env var to SupportedCurrencies (string array)
    • Update config parsing to handle multiple currencies
    • Modify PSP registration to handle all supported currencies
    • Update rate calculation for each currency

Example Changes:

// Provider profile creation
provider, err := tx.ProviderProfile.
   Create().
   AddCurrencies(currencies...).
   SetVisibilityMode(providerprofile.VisibilityModePrivate).
   SetUser(user).
   SetProvisionMode(providerprofile.ProvisionModeAuto).
   Save(ctx)

// GetProviderRate with currency
func (s *PriorityQueueService) GetProviderRate(
   ctx context.Context, 
   provider *ent.ProviderProfile, 
   token string,
   currency string,
) (decimal.Decimal, error) {
   // Add currency to query filters
}
@chibie chibie added the enhancement New feature or request label Dec 11, 2024
@OnahProsperity OnahProsperity changed the title Support Multiple Currencies per Provider and Provision Node [WIP] Support Multiple Currencies per Provider and Provision Node Dec 19, 2024
@Atanda1 Atanda1 mentioned this issue Jan 9, 2025
3 tasks
@Supa-mega
Copy link

May I handle this issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants