Skip to content

Commit

Permalink
Merge pull request #23 from lukapaunovic/patch-1
Browse files Browse the repository at this point in the history
Payment ID option added to Namesilo.php
  • Loading branch information
fordnox authored Nov 12, 2016
2 parents d05343a + 8c71dea commit 2621a67
Showing 1 changed file with 25 additions and 5 deletions.
30 changes: 25 additions & 5 deletions bb-library/Registrar/Adapter/Namesilo.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
<?php
/*
Namesilo Registrar Module
Payment ID option added by Luka Paunovic from Leo-Host.com
*/
class Registrar_Adapter_Namesilo extends Registrar_AdapterAbstract
{
public $config = array(
'apikey' => null
'apikey' => null,
'Payment_ID' => null
);
public function __construct($options)
{
Expand All @@ -15,6 +22,13 @@ public function __construct($options)
} else {
throw new Registrar_Exception('Domain registrar "Namesilo" is not configured properly. Please update configuration parameter "Namesilo Apikey" at "Configuration -> Domain registration".');
}

if(isset($options['Payment_ID']) && !empty($options['Payment_ID'])) {
$this->config['Payment_ID'] = $options['Payment_ID'];
unset($options['Payment_ID']);
} else {
throw new Registrar_Exception('Domain registrar "Namesilo" is not configured preoprly. Please update configuration paramer Payment ID".');
}
}
public static function getConfig()
{
Expand All @@ -27,9 +41,15 @@ public static function getConfig()
'renderPassword' => true,
),
),
),
);
'Payment_ID' => array('Payment_ID', array(
'label' => 'Payment ID',
'description'=>'Payment ID',
),
),
),
);
}

public function getTlds()
{
return array(
Expand Down Expand Up @@ -226,7 +246,6 @@ public function deleteDomain(Registrar_Domain $domain)
{
throw new Registrar_Exception('Registrar does not support domain removal.');
}

/**
* @param Registrar_Domain $domain
* @return bool
Expand All @@ -239,7 +258,7 @@ public function registerDomain(Registrar_Domain $domain)

$params = array(
'domain' => $domain->getName(),
'years' => $domain->getRegistrationPeriod(),
'years' => $domain->getRegistrationPeriod(),

'fn' => $c->getFirstName(),
'ln' => $c->getLastName(),
Expand Down Expand Up @@ -419,6 +438,7 @@ private function _request($cmd, $params)
$params['version'] = 1;
$params['type'] = 'xml';
$params['key'] = $this->config['apikey'];
$params['payment_id'] = $this->config['Payment_ID'];

$query = http_build_query($params);

Expand Down

0 comments on commit 2621a67

Please sign in to comment.