feat(domains): implement registrar gateway layer with Gandi + ROTLD (#93)#169
Open
b3lz3but wants to merge 2 commits intocaptainpragmatic:masterfrom
Open
feat(domains): implement registrar gateway layer with Gandi + ROTLD (#93)#169b3lz3but wants to merge 2 commits intocaptainpragmatic:masterfrom
b3lz3but wants to merge 2 commits intocaptainpragmatic:masterfrom
Conversation
…tainpragmatic#121) Add retriable: bool = False field to the Err dataclass so callers (e.g. Django-Q tasks) can distinguish transient errors (DB timeout, lock contention) from permanent ones (validation failure). Default False preserves backward compatibility with all 577 existing Err() call sites. Closes captainpragmatic#121 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Signed-off-by: Ciprian Radulescu <craps2003@gmail.com>
…aptainpragmatic#93) Replace stubbed DomainRegistrarGateway with a production-ready gateway abstraction following the billing gateway ABC + cloud gateway Result[T, E] patterns. Implements the "Better" tier from issue captainpragmatic#93. New gateway layer (apps/domains/gateways/): - BaseRegistrarGateway ABC with circuit breaker, idempotency, retry, audit logging, SSRF-safe HTTP via OutboundPolicy, and shared error mapping - GandiGateway for international domains (.com, .net, .org, .eu) - ROTLDGateway for Romanian .ro domains with CUI/CNP registrant mapping - RegistrarErrorCode enum + typed exception hierarchy - RegistrarGatewayFactory following PaymentGatewayFactory pattern Service layer migration: - DomainLifecycleService methods now return Result[T, str] instead of tuple[bool, T | str], with all callers updated (views, order service, tests) - DomainRegistrarGateway in services.py is now a backward-compatible facade delegating to the gateway factory Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Signed-off-by: Ciprian Radulescu <craps2003@gmail.com>
0847724 to
d520bd8
Compare
5 tasks
Contributor
Author
|
@mostlyvirtual ready for review 🙏 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements the Better tier from #93 — replaces the stubbed
DomainRegistrarGatewaywith a production-ready gateway abstraction layer for domain registrar API integrations.What changed
New gateway package (
apps/domains/gateways/):errors.py—RegistrarErrorCodeenum + typed exception hierarchy (RegistrarAuthError,RegistrarConflictError,RegistrarNotFoundError,RegistrarRateLimitError,RegistrarTransientError)base.py—BaseRegistrarGatewayABC with:AuditService.log_simple_eventfor every API callOutboundPolicyper registrarRegistrarGatewayFactory(followsPaymentGatewayFactorypattern)gandi.py—GandiGatewayfor international domains (.com, .net, .org, .eu) via Gandi REST APIrotld.py—ROTLDGatewayfor Romanian .ro domains via ROTLD REST API v2.0, with CUI/CNP registrant mappingService layer migration (
services.py):DomainLifecycleServicemethods now returnResult[T, str]instead oftuple[bool, T | str]:create_domain_registration()→Result[Domain, str]process_domain_renewal()→Result[str, str]update_domain_expiration()→Result[bool, str]DomainRegistrarGatewayis now a backward-compatible facade delegating to the gateway factoryviews.py,DomainOrderService, testsArchitecture decisions
Result[T, E])safe_request()+OutboundPolicyper registrar (matching Virtualmin gateway)VirtualminAPIErrorErr.retriableflag used for transient errors (rate limits, 5xx, network)Better tier checklist (all complete)
RegistrarErrorCodeenumOutboundPolicyper registrarDomainLifecycleServicereturnsResult[T, str]Test plan
test_registrar_gateways.py— all passingDiff stats
Closes #93
🤖 Generated with Claude Code