From 8c71dea04622e6662ecf476233eded6e0a1a8762 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luka=20Paunovi=C4=87?= Date: Sat, 12 Nov 2016 14:14:44 +0100 Subject: [PATCH] Payment ID option added to Namesilo.php https://github.com/lukapaunovic/namesilo-boxbilling-registrator-module/blob/master/Namesilo.php Are you tired of uploading your funds on your Namesilo account every time you need to register domain? Now no need to do so. I added Payment ID option to the registar, you can specify Payment ID from your verified cards list on your Namesilo account, and when you activate your order domain will be registered and charged directly from your credit card. Any further functions you want me to add, just say! --- bb-library/Registrar/Adapter/Namesilo.php | 30 +++++++++++++++++++---- 1 file changed, 25 insertions(+), 5 deletions(-) diff --git a/bb-library/Registrar/Adapter/Namesilo.php b/bb-library/Registrar/Adapter/Namesilo.php index 1ae9577..dc9567f 100644 --- a/bb-library/Registrar/Adapter/Namesilo.php +++ b/bb-library/Registrar/Adapter/Namesilo.php @@ -1,8 +1,15 @@ null + 'apikey' => null, + 'Payment_ID' => null ); public function __construct($options) { @@ -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() { @@ -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( @@ -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 @@ -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(), @@ -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);