Skip to content

Commit

Permalink
feat: Add comando de update e delete de domínios
Browse files Browse the repository at this point in the history
  • Loading branch information
pablosanches committed Nov 28, 2023
1 parent 6fe3fdd commit 6c7afc9
Show file tree
Hide file tree
Showing 4 changed files with 102 additions and 0 deletions.
23 changes: 23 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
17 changes: 17 additions & 0 deletions templates/domain_delete.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:ietf:params:xml:ns:epp-1.0
epp-1.0.xsd">
<command>
<delete>
<domain:delete
xmlns:domain="urn:ietf:params:xml:ns:domain-1.0"
xsi:schemaLocation="urn:ietf:params:xml:ns:domain-1.0
domain-1.0.xsd">
<domain:name>{{ name }}</domain:name>
</domain:delete>
</delete>
<clTRID>{{ clTRID }}</clTRID>
</command>
</epp>
35 changes: 35 additions & 0 deletions templates/domain_update.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:ietf:params:xml:ns:epp-1.0
epp-1.0.xsd">
<command>
<update>
<domain:update
xmlns:domain="urn:ietf:params:xml:ns:domain-1.0"
xsi:schemaLocation="urn:ietf:params:xml:ns:domain-1.0
domain-1.0.xsd">
<domain:name>{{ name }}</domain:name>
<domain:period unit="y">{{ period }}</domain:period>
<domain:ns>
<domain:hostAttr>
<domain:hostName>{{ dns_1 }}</domain:hostName>
</domain:hostAttr>
<domain:hostAttr>
<domain:hostName>{{ dns_2 }}</domain:hostName>
</domain:hostAttr>
</domain:ns>
</domain:update>
</update>
<extension>
<brdomain:update
xmlns:brdomain="urn:ietf:params:xml:ns:brdomain-1.0"
xsi:schemaLocation="urn:ietf:params:xml:ns:brdomain-1.0
brdomain-1.0.xsd">
<brdomain:organization>{{ org_id }}</brdomain:organization>
<brdomain:autoRenew active="{{ auto_renew }}"/>
</brdomain:update>
</extension>
<clTRID>{{ clTRID }}</clTRID>
</command>
</epp>
27 changes: 27 additions & 0 deletions tests/Resource/DomainTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

0 comments on commit 6c7afc9

Please sign in to comment.