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

added endpoint for business registry api #2676

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

Conversation

OlegPhenomenon
Copy link
Contributor

No description provided.

@OlegPhenomenon OlegPhenomenon force-pushed the business-registry-api branch 2 times, most recently from 2a41048 to c0915e7 Compare August 5, 2024 11:48
@vohmar
Copy link
Contributor

vohmar commented Oct 18, 2024

warning on deploy: Your Gemfile lists the gem net-ftp (>= 0) more than once.
You should probably keep only one of them.
Remove any duplicate entries and specify the gem only once.
While it's not a problem now, it could cause errors if you change the version of one of them later.

@vohmar
Copy link
Contributor

vohmar commented Oct 22, 2024

  • Get available domain name variants - fails to check for variant availability . Lists all the possible variants
  • Reserve a domain - fails to check for name availability and successfully creates a token for a registered domainname
  • Release reserved domain - returns "error": "Domain not found in reserved list" - status request at the same time returns unpaid (same name, same token (auth type bearer token))
  • get registration code for reserved domains - returns ""error": "Domain not found in reserved list"" - because of unpaid status?

@OlegPhenomenon
Copy link
Contributor Author

put here from our discussion:

but the problem is that the link is only available in the reservation response, I cannot get it afterwards ie with checking the reservation status. So if i did not save the response there is no way of recovering it

@vohmar
Copy link
Contributor

vohmar commented Oct 29, 2024

  • Reserve a domain endpoint returns error 500 for domains available for reservation. It responds correctly with "Domain is not available" for those that are already taken
  • Release reserved domains - could not test because reservation does not work (previous bullet point). Same goes for getting the registration code

  • Get available domain name variants is OK now. But perhaps we should not announce availability in all zones - ie med.ee is meant strictly for medical organisations

@vohmar
Copy link
Contributor

vohmar commented Oct 29, 2024

  • could not get multiple domains reserved in one request
  • status check and registration code request are doubling one another we could perhaps get away with just status check that will return the registration code when the reservation is set on a domain(s)
    • the domain name is missing from the registration_code response: "name": "name",

  • release reserved domain - OK
  • get registration code - OK

… ip constraint, added origin constraint, added test
Add success and failure callback URLs for business registry domain reservation process:

- Add success_business_registry_customer_url and failed_business_registry_customer_url
  fields to reserve_domain_invoices table
- Update ReserveDomainInvoice model to handle new callback URLs
- Add URL validation in LongReserveDomainsController
- Replace linkpay with oneoff_payment_link for consistency
- Update tests to cover new functionality
- Add wkhtmltopdf and xvfb setup in Dockerfile

This change allows the business registry to specify URLs where users should be
redirected after successful or failed domain reservation payments.
Add status tracking and update callback handling for domain reservations:

- Add status enum to ReserveDomainInvoice (pending, paid, cancelled, failed)
- Add status column to reserve_domain_invoices table with default 'pending'
- Update ONE_OFF_CUSTOMER_URL to include callback path
- Add callback route for EIS billing system
- Update database structure for new status column

This change enables tracking reservation payment status and proper callback
handling for the business registry domain reservation process.
- Remove deprecated success/failed URL parameters and related validations
- Add user_unique_id generation and tracking throughout the reservation process
- Improve handling of intersecting domain reservations:
  - Add checks for existing paid/pending invoices
  - Implement cancellation of conflicting pending invoices
  - Add validation of domain availability before processing
- Update invoice status checking to include user_unique_id
- Refactor tests to cover new functionality:
  - Add tests for intersecting domains handling
  - Add tests for user_unique_id generation
  - Add tests for domain availability validation
  - Remove URL-related tests
- Update EIS billing integration to handle user_unique_id in callbacks

This change simplifies the domain reservation process while adding better
handling of concurrent reservations and improved user tracking.
- Simplified DomainNameGeneratorService to generate only two variants (with and without hyphens)
- Removed complex legal form handling in domain name generation
- Removed unused controllers and tests related to domain release, refresh token, and status
- Updated tests to match new domain name generation logic
- Added return true to ReserveDomainInvoice after successful payment
- Made user_unique_id optional in GetReservedDomainsInvoiceStatus
- Fixed custom_field1 handling in EisBilling::AddDeposits

This change simplifies the domain name generation process while maintaining core functionality.
- Add setup/teardown to properly handle method mocking across test suite
- Add proper stubbing for Epp::Domain.check_availability in tests
- Fix test data consistency in ReserveDomainInvoice test
- Add teardown cleanup in related test files to prevent test pollution
- Update test assertions to use more explicit domain name variables

This change fixes flaky tests that were failing when run as part of the full test suite due to method mocking interference between tests.
- Rename oneoff_payment_link to linkpay_url for consistency
- Add debug logging in domain name controllers and invoice status
- Remove unused allowed_origins variable in domain names controller test
- Remove empty registration code controller

This change improves naming consistency for payment URLs and adds
logging to help with troubleshooting domain registration flow.
- Add `expired?` method to `ReservedDomain` model to check if domain has expired
- Add `destroy_if_expired` method to `ReservedDomain` model to remove expired domains
- Add corresponding tests in `ReservedDomainTest` to verify expiration handling
- Update database structure to include `expire_at` field in reserved_domains table

Domains with null `expire_at` are considered non-expiring and will not be destroyed.
- Add expiration check in DomainAvailabilityCheckerService to automatically remove expired domains
- Update InvoiceResponseStruct to include reserved_domain_names in response
- Add tests for expired domain handling in DomainAvailabilityCheckerService
- Add tests for expired domain handling in ReserveDomainInvoice
- Remove debug logging from EisBilling service

The changes ensure that expired reserved domains are automatically removed during
availability checks, making them available for new reservations. Domains with
null expire_at remain permanently reserved.
Add expiration time information to domain reservation responses across all endpoints:
- Add FREE_RESERVATION_EXPIRY (7 days) and PAID_RESERVATION_EXPIRY (1 year) constants
- Update ReservedDomain model to set expire_at on creation
- Modify ReserveDomainInvoice#build_reserved_domains_output to include expire_at
- Update API responses to include expire_at in reserved_domains data
- Add comprehensive tests for expiration time handling

This change ensures consistent expiration time handling across both free and paid
domain reservations, with proper validation in the test suite.
…roller

- Introduced AuthorizationError for handling token authentication failures.
- Added before_action :authenticate_token! to ensure requests have valid tokens.
- Implemented token validation logic using environment variable 'business_registry_api_tokens'.
- Added error handling for unauthorized requests with render_unauthorized method.
- Updated config/application.yml.sample to include sample API tokens.
Add Bearer token authentication to all business registry API tests:
- Add valid_token setup in test environment
- Update test headers to include Authorization token
- Ensure consistent API authentication across all business registry endpoints
- Maintain backward compatibility with existing IP and Origin restrictions
- Add user_unique_id to ReservedDomain.reserve_domains_without_payment response
- Create FreeDomainReservationHolder with unique ID for free domain reservations
- Add error handling for case when no domains are available
- Update tests to cover new functionality and error cases
- Increase unique ID length from 8 to 10 characters

This change adds tracking of free domain reservations through unique IDs and improves error handling when no domains are available for reservation.
- Add GET /api/v1/business_registry/reserve_domains/:user_unique_id endpoint
- Add output_reserved_domains method to FreeDomainReservationHolder model
- Add before_action to validate user_unique_id and find holder
- Add integration tests for new endpoint
- Add model tests for output_reserved_domains method
- Update routes to include new endpoint

The endpoint returns information about previously reserved domains including names,
passwords and expiration dates. Returns 404 if user_unique_id is invalid.
- Add expire_at field to Reserved Domains form and permit it in controller
- Add expire_at column to Reserved Domains index table with status indicators
- Add expire date search filter using custom ransacker to ignore time component
- Update translations and labels
- Change "edit_pw" to "edit" in views and translations
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.

2 participants