@@ -156,6 +156,10 @@ public function check(string|array $request): array
156156 * updateDate: \DateTimeImmutable|null,
157157 * expirationDate: \DateTimeImmutable|null,
158158 * whoisPrivacy: bool,
159+ * isDomainVerified: bool,
160+ * domainVerifiedOn: \DateTimeImmutable|null,
161+ * domainVerificationRequestExpiresOn: \DateTimeImmutable|null,
162+ * isWhoisPrivacyPaid: bool,
159163 * operationMode: string|null,
160164 * notifyAdmin: bool,
161165 * dnsSec: bool,
@@ -328,13 +332,35 @@ public function update(array $request): array
328332 }
329333
330334 /**
331- * @param array{
332- * operation?: mixed,
333- * name?: mixed,
334- * period?: mixed,
335- * periodUnit?: mixed,
336- * authInfo?: mixed
337- * } $request
335+ * Approves a domain transfer using the provided transfer code.
336+ *
337+ * @return array{
338+ * name: string|null,
339+ * transferStatus: string|null,
340+ * requestClientId: string|null,
341+ * requestDate: \DateTimeImmutable|null,
342+ * actionClientId: string|null,
343+ * actionDate: \DateTimeImmutable|null,
344+ * expirationDate: \DateTimeImmutable|null
345+ * }
346+ */
347+ public function transfer (string $ domain , string $ transferCode ): array
348+ {
349+ $ name = $ this ->inputNormalizer ->requireDomainName ($ domain );
350+
351+ if ('' === \trim ($ transferCode )) {
352+ throw new \InvalidArgumentException ('Domain transfer code must be a non-empty string. ' );
353+ }
354+
355+ return $ this ->executeTransferOperation (
356+ DomainTransferRequest::OPERATION_APPROVE ,
357+ $ name ,
358+ $ transferCode ,
359+ );
360+ }
361+
362+ /**
363+ * Starts the transfer flow and requests transfer code-related state from the registry.
338364 *
339365 * @return array{
340366 * name: string|null,
@@ -346,15 +372,55 @@ public function update(array $request): array
346372 * expirationDate: \DateTimeImmutable|null
347373 * }
348374 */
349- public function transfer (array $ request ): array
375+ public function getCode (string $ domain ): array
376+ {
377+ return $ this ->executeTransferOperation (
378+ DomainTransferRequest::OPERATION_REQUEST ,
379+ $ this ->inputNormalizer ->requireDomainName ($ domain ),
380+ );
381+ }
382+
383+ /**
384+ * Queries current transfer state for a domain.
385+ *
386+ * @return array{
387+ * name: string|null,
388+ * transferStatus: string|null,
389+ * requestClientId: string|null,
390+ * requestDate: \DateTimeImmutable|null,
391+ * actionClientId: string|null,
392+ * actionDate: \DateTimeImmutable|null,
393+ * expirationDate: \DateTimeImmutable|null
394+ * }
395+ */
396+ public function getState (string $ domain ): array
397+ {
398+ return $ this ->executeTransferOperation (
399+ DomainTransferRequest::OPERATION_QUERY ,
400+ $ this ->inputNormalizer ->requireDomainName ($ domain ),
401+ );
402+ }
403+
404+ /**
405+ * @return array{
406+ * name: string|null,
407+ * transferStatus: string|null,
408+ * requestClientId: string|null,
409+ * requestDate: \DateTimeImmutable|null,
410+ * actionClientId: string|null,
411+ * actionDate: \DateTimeImmutable|null,
412+ * expirationDate: \DateTimeImmutable|null
413+ * }
414+ */
415+ private function executeTransferOperation (string $ operation , string $ name , ?string $ authInfo = null ): array
350416 {
351417 $ xml = $ this ->transferRequestBuilder ->build (
352418 new DomainTransferRequest (
353- $ this -> inputNormalizer -> requireTransferOperation ( $ request ) ,
354- $ this -> inputNormalizer -> requireName ( $ request ) ,
355- $ this -> inputNormalizer -> optionalPositiveInt ( $ request , ' period ' ) ,
356- $ this -> inputNormalizer -> optionalPeriodUnit ( $ request ) ,
357- $ this -> inputNormalizer -> optionalNullableString ( $ request , ' authInfo ' ) ,
419+ $ operation ,
420+ $ name ,
421+ null ,
422+ ' y ' ,
423+ $ authInfo ,
358424 ),
359425 $ this ->tridGenerator ->nextId (),
360426 );
0 commit comments