Skip to content

Commit 98e7a01

Browse files
committed
#12493 - Add DomanRenew method
1 parent 32b03f6 commit 98e7a01

File tree

3 files changed

+50
-4
lines changed

3 files changed

+50
-4
lines changed

Examples/GetPriceList.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
$client = new Client(\Ease\Shared::instanced()->configuration);
1616

1717

18+
print_r($client->getPricelist('KONCOVA'));
1819

19-
print_r($client->pricelist());
20+
//print_r($client->pricelist());
2021

src/Subreg/Client.php

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,4 +253,34 @@ public function pricelist()
253253
{
254254
return $this->call('Pricelist');
255255
}
256+
257+
/**
258+
* Get specified pricelist from your account
259+
*
260+
* @link https://subreg.cz/manual/?cmd=Get_Pricelist Command: Get_Pricelist
261+
*
262+
* @param string requested pricelist name
263+
*
264+
* @return array
265+
*/
266+
public function getPricelist($pricelist)
267+
{
268+
return $this->call('Get_Pricelist', ['pricelist'=>$pricelist]);
269+
}
270+
271+
/**
272+
*
273+
* @link https://subreg.cz/manual/?cmd=Renew_Domain Command: Renew_Domain
274+
*
275+
* @param string $domain name
276+
* @param int $years
277+
*
278+
* @return type
279+
*/
280+
public function renewDomain(string $domain, int $years = 1)
281+
{
282+
return $this->call('Make_Order', ['order' => ['domain' => $domain, 'params' => ['period' => $years], 'type' => 'Renew_Domain']] );
283+
}
284+
285+
256286
}

tests/src/Subreg/ClientTest.php

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,15 @@ public function testPricelist()
119119
$this->assertTrue(array_key_exists('cz', $pricelist));
120120
}
121121

122+
/**
123+
* @covers Subreg\Client::getPricelist
124+
*/
125+
public function testGetPricelist()
126+
{
127+
$pricelist = $this->object->getPricelist('???');
128+
$this->assertTrue(array_key_exists('cz', $pricelist));
129+
}
130+
122131
/**
123132
* @covers Subreg\Client::registerDomain
124133
*/
@@ -131,8 +140,14 @@ public function testRegisterDomain()
131140
$result = $this->object->registerDomain($unexistentDomain, 'G-000001',
132141
'G-000001', 'G-000001', 'ukulele', $nsHosts);
133142

134-
$this->assertTrue( array_key_exists('orderid', $result));
143+
$this->assertTrue(array_key_exists('orderid', $result));
144+
}
145+
146+
/**
147+
* @covers Subreg\Client::renewDomain
148+
*/
149+
public function testRenewDomain()
150+
{
151+
$this->assertArrayHasKey('orderid',$this->object->renewDomain('vitexsoftware.cz',1));
135152
}
136-
137-
138153
}

0 commit comments

Comments
 (0)