From 6c7afc9bd83d9bd3272c862cdffa26cd2214b23a Mon Sep 17 00:00:00 2001 From: Pablo Sanches Date: Tue, 28 Nov 2023 10:21:59 -0300 Subject: [PATCH] =?UTF-8?q?feat:=20Add=20comando=20de=20update=20e=20delet?= =?UTF-8?q?e=20de=20dom=C3=ADnios?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 23 +++++++++++++++++++++++ templates/domain_delete.xml | 17 +++++++++++++++++ templates/domain_update.xml | 35 +++++++++++++++++++++++++++++++++++ tests/Resource/DomainTest.php | 27 +++++++++++++++++++++++++++ 4 files changed, 102 insertions(+) create mode 100644 templates/domain_delete.xml create mode 100644 templates/domain_update.xml diff --git a/README.md b/README.md index 6596062..9ccee01 100644 --- a/README.md +++ b/README.md @@ -105,6 +105,29 @@ $return = $domain->create([ var_dump($return->getResponse()); ``` +#### Atualizando um domínio +```php +$eppClient = EppClient::factory('user', 'password'); +$domain = ResourceFactory::factory($eppClient, 'domain'); +$return = $domain->update([ + 'name' => 'dominiodeexemplo.com.br', + 'period' => 1, + 'dns_1' => 'ns1.yoursite-idc.net', + 'dns_2' => 'ns2.yoursite-idc.net', + 'org_id' => '246.838.523-30', + 'auto_renew' => 0 +]); +var_dump($return->getResponse()); +``` + +#### Removendo um domínio +```php +$eppClient = EppClient::factory('user', 'password'); +$domain = ResourceFactory::factory($eppClient, 'domain'); +$return = $domain->delete(['name' => 'dominiodeexemplo.com.br']); +var_dump($return->getResponse()); +``` + #### Renovando um domínio ```php $eppClient = EppClient::factory('user', 'password'); diff --git a/templates/domain_delete.xml b/templates/domain_delete.xml new file mode 100644 index 0000000..fc94aff --- /dev/null +++ b/templates/domain_delete.xml @@ -0,0 +1,17 @@ + + + + + + {{ name }} + + + {{ clTRID }} + + \ No newline at end of file diff --git a/templates/domain_update.xml b/templates/domain_update.xml new file mode 100644 index 0000000..3982d14 --- /dev/null +++ b/templates/domain_update.xml @@ -0,0 +1,35 @@ + + + + + + {{ name }} + {{ period }} + + + {{ dns_1 }} + + + {{ dns_2 }} + + + + + + + {{ org_id }} + + + + {{ clTRID }} + + \ No newline at end of file diff --git a/tests/Resource/DomainTest.php b/tests/Resource/DomainTest.php index 93ab51b..e0b24d5 100644 --- a/tests/Resource/DomainTest.php +++ b/tests/Resource/DomainTest.php @@ -45,4 +45,31 @@ public function testInfo() $response = $response->getResponse(); self::assertEquals($domainName, $response['domain:infData']['domain:name']); } + + public function testUpdateDomain() + { + $eppClient = EppClient::factory('user', 'password'); + $domain = ResourceFactory::factory($eppClient, 'domain'); + + $response = $domain->update([ + 'name' => 'yoursite6.com.br', + 'period' => 1, + 'dns_1' => 'ns1.yoursite-idc.net', + 'dns_2' => 'ns2.yoursite-idc.net', + 'org_id' => '246.838.523-30', + 'auto_renew' => 0 + ]); + $response = $response->getResponse(); + self::assertNotEmpty($response); + } + + public function testDeleteDomain() + { + $eppClient = EppClient::factory('user', 'password'); + $domain = ResourceFactory::factory($eppClient, 'domain'); + + $response = $domain->delete(['name' => 'yoursite6.com.br']); + $response = $response->getResponse(); + self::assertNotEmpty($response); + } } \ No newline at end of file