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

Implement dynamic rules #9

Open
uphlewis opened this issue Apr 5, 2023 · 0 comments
Open

Implement dynamic rules #9

uphlewis opened this issue Apr 5, 2023 · 0 comments
Labels
enhancement New feature or request

Comments

@uphlewis
Copy link
Member

uphlewis commented Apr 5, 2023

For example when registering a domain name, some TLDs require additional fields such as registrant type (individual/organisation).

This could be defined in the RegisterParams dataset rules() like so:

    return new Rules([
        // ...
        'additional_fields' => ['upmind_dynamic_rules:getRegisterAdditionalFieldRules'],
        // ...
    ]);

The argument passed to the upmind_dynamic_rules would specify where to get the validation rules from for the additional_fields object, so in this case we need to call the provider's getRegisterAdditionalFieldRules() method, which in-turn may specify which params it requires in order to return the rules we need, such as the tld.

This allows the provision system client to build a dynamic html form for domain registrations, once it knows which tld the customer wants to register a domain for, and once it has determined which provision provider to use.

Caching the dynamic rules (per provider + tld and perhaps per provision configuration) should negate any performance impact of the blocking call to getRegisterAdditionalFieldRules().

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

No branches or pull requests

1 participant