Skip to content

Add purchase autorenew option#67

Merged
ChiragAgg5k merged 1 commit into
mainfrom
feat/purchase-autorenew
May 28, 2026
Merged

Add purchase autorenew option#67
ChiragAgg5k merged 1 commit into
mainfrom
feat/purchase-autorenew

Conversation

@ChiragAgg5k
Copy link
Copy Markdown
Member

Summary

  • Adds an optional autorenewEnabled purchase parameter with default false across registrar adapters.
  • Sends Name.com autorenewEnabled and OpenSRS auto_renew during domain registration.
  • Applies related PHP 8.5/style cleanups for global \is_array(), typed Name.com constants, string interpolation, and deprecated curl_close() removal.

Tests

  • vendor/bin/pint --test src/Domains/Adapter.php src/Domains/Registrar.php src/Domains/Registrar/Adapter.php src/Domains/Registrar/Adapter/Mock.php src/Domains/Registrar/Adapter/NameCom.php src/Domains/Registrar/Adapter/OpenSRS.php
  • vendor/bin/phpunit tests/Registrar/MockTest.php
  • php -l on touched PHP files

@greptile-apps
Copy link
Copy Markdown

greptile-apps Bot commented May 28, 2026

Greptile Summary

Adds an optional $autorenewEnabled parameter (default false) to the purchase() method across the abstract base, Registrar facade, and all three adapter implementations (NameCom, OpenSRS, Mock). Accompanying cleanup changes include typed constants, \is_array() FQN calls, string interpolation, and a ternary-to-null-coalescing fix.

  • NameCom sends autorenewEnabled in the registration payload; placement of the field warrants verification against the Name.com API schema (see inline comment).
  • OpenSRS correctly converts the bool to 1/0 for the XML-based SW_REGISTER action; transfer() is unaffected and correctly keeps autorenew off.
  • Mock accepts the new parameter in its signature but leaves the implementation intentionally unchanged, which is appropriate for a test double.

Confidence Score: 4/5

The change is straightforward and low-risk except for one structural question in the NameCom payload that could silently prevent autorenew from ever being set.

The autorenewEnabled field is nested inside the domain sub-object in the NameCom request body, while the Name.com v1 registration API schema defines it as a top-level field. If that placement is wrong, callers who explicitly request autorenew will have their preference silently dropped on every Name.com purchase. Everything else — OpenSRS, Mock, the abstract base, and the style-only changes — looks correct.

src/Domains/Registrar/Adapter/NameCom.php — specifically the structure of the POST body in purchase().

Important Files Changed

Filename Overview
src/Domains/Registrar/Adapter/NameCom.php Adds autorenewEnabled to purchase payload inside the domain sub-object; also typed constants, FQN is_array, and string interpolation cleanup.
src/Domains/Registrar/Adapter/OpenSRS.php Adds autorenewEnabled param to purchase() and register(); correctly converts bool to int (1/0) for OpenSRS XML API; transfer() correctly defaults to false.
src/Domains/Registrar/Adapter/Mock.php Adds autorenewEnabled parameter to purchase() signature; parameter is accepted but intentionally unused in mock implementation.
src/Domains/Registrar/Adapter.php Abstract purchase() signature updated with $autorenewEnabled = false; doc comment updated.
src/Domains/Registrar.php Forwarding wrapper purchase() updated to accept and pass through $autorenewEnabled.
src/Domains/Adapter.php Two is_array() calls changed to \is_array() FQN; no functional change.

Comments Outside Diff (1)

  1. src/Domains/Registrar/Adapter/NameCom.php, line 183-191 (link)

    P1 The autorenewEnabled field is placed inside the domain sub-object, but the Name.com API (v1 /domains POST endpoint) defines autorenewEnabled as a top-level field on the registration request, not nested inside the domain object. Placing it inside domain means the API will silently ignore it, so autorenew will never be enabled regardless of what the caller passes.

Reviews (1): Last reviewed commit: "Add purchase autorenew option" | Re-trigger Greptile

@ChiragAgg5k ChiragAgg5k merged commit 77fcf4b into main May 28, 2026
6 checks passed
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