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

2611 bsa gateway integration #2621

Open
wants to merge 11 commits into
base: master
Choose a base branch
from

Conversation

OlegPhenomenon
Copy link
Contributor

@OlegPhenomenon OlegPhenomenon commented Oct 10, 2023

close #2611

What is this?
This is the implementation for interacting with BSA reserved domains, which can be obtained from GoDaddy.

What do you need to know beforehand?

  • First of all, make sure that the server from which this functionality will be launched has its IP address added to the GoDaddy reserved domains management dashboard.
  • In the application.yml file, you need to add the following keys: bsa_base_url and bsa_api_key.
  • Rake Task: rake bsa_domains:call. This rake task initially runs the FetchGodaddyBsaBlockOrderListJob, which retrieves all data about domains that have the QueuedForActivation status. Then, when the job has completed, another job, UpdateGodaddyDomainsStatusJob, is run. It takes these domains and changes their status from QueuedForActivation to ActivationInProgress both on the GoDaddy side and on our side. Then the same job is run again, but this time it changes the status from ActivationInProgress to Active. Skipping and changing the status from QueuedForActivation to Active is not allowed; the status ActivationInProgress must be set beforehand. This is a particular feature of the finite state machine on GoDaddy's side.

Implementation Description

GoDaddy Service Token Management:

The GoDaddy service operates in such a way that the token refreshes every 20 minutes and also has a limit on the number of requests within a specific time frame. Therefore, the generated token is stored in a Redis cache, and it is used for each request. There is also a check for the token's expiration time; if the 20-minute period has expired, a request is made to GoDaddy to obtain a new token.

Two jobs were implemented:

  • FetchGodaddyBsaBlockOrderListJob - This job makes a request to GoDaddy and adds domains to our reserved list. This reserved list is stored in the BsaProtectedDomains table. By default, this job uses the QueuedForActivation status, but it can also accept other statuses as parameters if needed.
  • UpdateGodaddyDomainsStatusJob - This job is required for status updates. GoDaddy has a lifecycle for domains, and therefore you can't jump from one status to another without going through the entire lifecycle. To achieve a certain result, you need to run the job multiple times with different parameters. What parameters does this job accept? Here's an example:
UpdateGodaddyDomainsStatusJob.perform_now(
  BsaProtectedDomain.states['QueuedForActivation'],
  BsaProtectedDomain.states['ActivationInProgress']
)
  • In this case, the first parameter specifies which domains with which status will be selected from the database, and the second parameter indicates the status to be updated to. After that, a request goes to GoDaddy, and if the update is successful on GoDaddy's side, the domain statuses are also updated on our end.
  • I also implemented a rake task that triggers the entire lifecycle process. However, to start one job, you need to wait for the other to complete. I decided to make the jobs execute synchronously, not asynchronously, and not be deferred for later. This needs to be taken into account.
  • I created a view in the admin panel where users can independently change various domain states, as well as add or remove them from the list.
  • Through REPP and EPP protocols, you can't create a domain with a name from the BsaProtectedDomain table unless a registration code is entered.

.. will be continued :)

@viezly
Copy link

viezly bot commented Oct 10, 2023

This pull request is split into 14 parts for easier review.
👀 Review pull request on Viezly

Changed files are located in these folders:

  • /
  • app/controllers/admin
  • app/interactions/whois
  • app/jobs
  • app/models
  • app/services
  • app/views/admin
  • config
  • db
  • lib/core_monkey_patches
  • lib/gem_monkey_patches
  • lib/xsd
  • test

@OlegPhenomenon OlegPhenomenon force-pushed the 2611-bsa-gateway-integration branch from 6b9f7ad to ca9b37c Compare October 19, 2023 09:20
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.

BSA gateway integration
2 participants