Merge pull request #637 from BelleNottelling/documentation

Improved PHPDocs for payment, registrar, and server adapters
This commit is contained in:
Belle Aerni authored and GitHub committed 2022-12-28 11:04:24 -08:00
commit 7d0f87f74e
7 files changed
+669 -131

No files matched your search

+19 -8
View File
@@ -34,7 +34,7 @@ abstract class Payment_AdapterAbstract
protected $output = NULL;
/**
* Are we in test mode ?
* Are we in test mode?
*
* @var boolean
*/
@@ -48,8 +48,11 @@ abstract class Payment_AdapterAbstract
private $_log = false;
/**
*
* @param array $config
* Constructs a new Payment_Adapter object
*
* @param array $config The configuration for the payment adapter as configured within the admin panel
*
* @throws Payment_Exception
*/
public function __construct($config)
{
@@ -101,7 +104,8 @@ abstract class Payment_AdapterAbstract
}
/**
* Return payment gateway type
* Return payment gateway type (TYPE_HTML, TYPE_FORM, TYPE_API)
*
* @return string
*/
public function getType()
@@ -156,7 +160,10 @@ abstract class Payment_AdapterAbstract
/**
* Get config parameter
* @param string $param
*
* @param string $param the parameter name to retrieve from the config
*
* @return mixed|null The associated config parameter or null if it's not defined
*/
public function getParam($param)
{
@@ -166,9 +173,11 @@ abstract class Payment_AdapterAbstract
/**
* Convert money amount to Gateway money format
*
* @param float
* @param string
* @return string
* @param float The ammount
*
* @param string The currency (unused currently)
*
* @return string The formatted money string
*/
public function moneyFormat($amount, $currency = null)
{
@@ -179,6 +188,7 @@ abstract class Payment_AdapterAbstract
* Set test mode
*
* @param none
*
* @return Payment_AdapterAbstract
*/
public function setTestMode($bool)
@@ -197,6 +207,7 @@ abstract class Payment_AdapterAbstract
* Used only by payment gateways who care about notify_url response
*
* @param string
*
* @param string $response
*/
public function setOutput($response)
+103 -8
View File
@@ -22,78 +22,154 @@ class Payment_Invoice
private $buyer = NULL;
private $title = 'Payment for invoice';
/**
* Set the invoice ID.
*
* @param mixed $param The invoice ID.
*
* @return $this The current object, for method chaining.
*/
public function setId($param)
{
$this->id = $param;
return $this;
}
/**
* Get the invoice ID.
*
* @return mixed The invoice ID.
*/
public function getId()
{
return $this->id;
}
/**
* Set the invoice number.
*
* @param mixed $param The invoice number.
*
* @return $this The current object, for method chaining.
*/
public function setNumber($param)
{
$this->number = $param;
return $this;
}
/**
* Get the invoice number.
*
* @return mixed The invoice number.
*/
public function getNumber()
{
return $this->number;
}
/**
* Set the currency.
*
* @param string $param The currency.
*
* @return $this The current object, for method chaining.
*/
public function setCurrency($param)
{
$this->currency = $param;
return $this;
}
/**
* Get the currency.
*
* @return string The currency.
*/
public function getCurrency()
{
return $this->currency;
}
/**
* Set the buyer.
*
* @param Payment_Invoice_Buyer $param The buyer object.
*
* @return $this The current object, for method chaining.
*/
public function setBuyer(Payment_Invoice_Buyer $param)
{
$this->buyer = $param;
return $this;
}
/**
* Get the buyer.
*
* @return Payment_Invoice_Buyer The buyer object.
*/
public function getBuyer()
{
return $this->buyer;
}
/**
* Set the items.
*
* @param array $items An array of Payment_Invoice_Item objects.
*
* @return $this The current object, for method chaining.
*/
public function setItems(array $items)
{
foreach($items as $item) {
if($item instanceof Payment_Invoice_Item) {
foreach ($items as $item) {
if ($item instanceof Payment_Invoice_Item) {
$this->items[] = $item;
}
}
return $this;
}
/**
* Get the items.
*
* @return array An array of Payment_Invoice_Item objects.
*/
public function getItems()
{
return $this->items;
}
/**
* Set the subscription.
*
* @param Payment_Invoice_Subscription $param The subscription object.
*
* @return $this The current object, for method chaining.
*/
public function setSubscription(Payment_Invoice_Subscription $param)
{
$this->subscription = $param;
return $this;
}
/**
* Get the subscription.
*
* @return Payment_Invoice_Subscription The subscription object.
*/
public function getSubscription()
{
return $this->subscription;
}
/**
* @param null|string $title
* Set the title.
*
* @param null|string $title The title.
*
* @return $this The current object, for method chaining.
*/
public function setTitle($title)
{
@@ -101,32 +177,51 @@ class Payment_Invoice
return $this;
}
/**
* Get the title.
*
* @return null|string The title.
*/
public function getTitle()
{
return $this->title;
}
/**
* Get the total amount of the invoice (without tax).
*
* @return float The total amount.
*/
public function getTotal()
{
$total = 0;
foreach ($this->items as $item) {
foreach ($this->items as $item) {
$total += $item->getTotal();
}
return $total;
}
/**
* Get the total amount of the invoice (with tax).
*
* @return float The total amount with tax.
*/
public function getTotalWithTax()
{
return $this->getTotal() + $this->getTax();
}
/**
* Get the tax amount of the invoice.
*
* @return float The tax amount.
*/
public function getTax()
{
$tax = 0;
foreach ($this->items as $item) {
foreach ($this->items as $item) {
$tax += $item->getTax() * $item->getQuantity();
}
return $tax;
}
}
}
+138 -5
View File
@@ -26,118 +26,247 @@ class Payment_Invoice_Buyer
private $phone;
private $phone_cc;
/**
* Set the first name of the buyer.
*
* @param string $param The first name of the buyer.
*
* @return $this The current object, for method chaining.
*/
public function setFirstName($param)
{
$this->first_name = $param;
return $this;
}
/**
* Get the first name of the buyer.
*
* @return string The first name of the buyer.
*/
public function getFirstName()
{
return $this->first_name;
}
/**
* Set the last name of the buyer.
*
* @param string $param The last name of the buyer.
*
* @return $this The current object, for method chaining.
*/
public function setLastName($param)
{
$this->last_name = $param;
return $this;
}
/**
* Get the last name of the buyer.
*
* @return string The last name of the buyer.
*/
public function getLastName()
{
return $this->last_name;
}
/**
* Set the company name of the buyer.
*
* @param string $param The company name of the buyer.
*
* @return $this The current object, for method chaining.
*/
public function setCompany($param)
{
$this->company = $param;
return $this;
}
/**
* Get the company name of the buyer.
*
* @return string The company name of the buyer.
*/
public function getCompany()
{
return $this->company;
}
/**
* Set the email address of the buyer.
*
* @param string $param The email address of the buyer.
*
* @return $this The current object, for method chaining.
*/
public function setEmail($param)
{
$this->email = $param;
return $this;
}
/**
* Get the email address of the buyer.
*
* @return string The email address of the buyer.
*/
public function getEmail()
{
return $this->email;
}
/**
* Set the mailing address of the buyer.
*
* @param string $param The mailing address of the buyer.
*
* @return $this The current object, for method chaining.
*/
public function setAddress($param)
{
$this->address = $param;
return $this;
}
/**
* Get the mailing address of the buyer.
*
* @return string The mailing address of the buyer.
*/
public function getAddress()
{
return $this->address;
}
/**
* Set the city of the buyer's mailing address.
*
* @param string $param The city of the buyer's mailing address.
*
* @return $this The current object, for method chaining.
*/
public function setCity($param)
{
$this->city = $param;
return $this;
}
/**
* Get the city of the buyer's mailing address.
*
* @return string The city of the buyer's mailing address
*/
public function getCity()
{
return $this->city;
}
/**
* Set the state/province of the buyer's mailing address.
*
* @param string $param The state/province of the buyer's mailing address.
*
* @return $this The current object, for method chaining.
*/
public function setState($param)
{
$this->state = $param;
return $this;
}
/**
* Get the state/province of the buyer's mailing address.
*
* @return string The state/province of the buyer's mailing address.
*/
public function getState()
{
return $this->state;
}
/**
* Set the country of the buyer's mailing address.
*
* @param string $param The country of the buyer's mailing address.
*
* @return $this The current object, for method chaining.
*/
public function setCountry($param)
{
$this->country = $param;
return $this;
}
/**
* Get the country of the buyer's mailing address.
*
* @return string The country of the buyer's mailing address.
*/
public function getCountry()
{
return $this->country;
}
/**
* Set the ZIP/postal code of the buyer's mailing address.
*
* @param string $param The ZIP/postal code of the buyer's mailing address.
*
* @return $this The current object, for method chaining.
*/
public function setZip($param)
{
$this->zip = $param;
return $this;
}
/**
* Get the ZIP/postal code of the buyer's mailing address.
*
* @return string The ZIP/postal code of the buyer's mailing address.
*/
public function getZip()
{
return $this->zip;
}
/**
* Set the phone number of the buyer.
*
* @param string $param The phone number of the buyer.
*
* @return $this The current object, for method chaining.
*/
public function setPhone($param)
{
$this->phone = $param;
return $this;
}
/**
* Get the phone number of the buyer.
*
* @return string The phone number of the buyer.
*/
public function getPhone()
{
return $this->phone;
}
/**
* @param string $param
* Set the country code of the buyer's phone number.
*
* @param string $param The country code of the buyer's phone number.
*
* @return $this The current object, for method chaining.
*/
public function setPhoneCountryCode($param)
{
@@ -145,9 +274,13 @@ class Payment_Invoice_Buyer
return $this;
}
/**
* Get the country code of the buyer's phone number.
*
* @return string The country code of the buyer's phone number.
*/
public function getPhoneCountryCode()
{
return $this->phone_cc;
}
}
}
+64 -14
View File
@@ -22,8 +22,11 @@ class Payment_Invoice_Item
private $tax;
/**
* Set id
* @param int $id
* Set the id of the item.
*
* @param int $id The id of the item.
*
* @return $this The current object, for method chaining.
*/
public function setId($id)
{
@@ -32,9 +35,9 @@ class Payment_Invoice_Item
}
/**
* Get id
* Get the id of the item.
*
* @return integer
* @return int The id of the item.
*/
public function getId()
{
@@ -42,9 +45,11 @@ class Payment_Invoice_Item
}
/**
* Set title
* Set the title of the item.
*
* @param string $title
* @param string $title The title of the item.
*
* @return $this The current object, for method chaining.
*/
public function setTitle($title)
{
@@ -53,9 +58,9 @@ class Payment_Invoice_Item
}
/**
* Get title
* Get the title of the item.
*
* @return string
* @return string The title of the item.
*/
public function getTitle()
{
@@ -63,9 +68,11 @@ class Payment_Invoice_Item
}
/**
* Set description
* Set the description of the item.
*
* @param text $description
* @param string $description The description of the item.
*
* @return $this The current object, for method chaining.
*/
public function setDescription($description)
{
@@ -74,58 +81,101 @@ class Payment_Invoice_Item
}
/**
* Get description
* Get the description of the item.
*
* @return text
* @return string The description of the item.
*/
public function getDescription()
{
return $this->description;
}
/**
* Set the price of the item.
*
* @param float $price The price of the item.
*
* @return $this The current object, for method chaining.
*/
public function setPrice($price)
{
$this->price = $price;
return $this;
}
/**
* Get the price of the item.
*
* @return float The price of the item.
*/
public function getPrice()
{
return $this->price;
}
/**
* Set the tax amount for the item.
*
* @param float $tax The tax amount for the item.
*
* @return $this The current object, for method chaining.
*/
public function setTax($tax)
{
$this->tax = $tax;
return $this;
}
/**
* Get the tax amount for the item.
*
* @return float The tax amount for the item.
*/
public function getTax()
{
return $this->tax;
}
/**
* Set the quantity of the item.
*
* @param int $qty The quantity of the item.
*
* @return $this The current object, for method chaining.
*/
public function setQuantity($qty)
{
$this->qty = $qty;
return $this;
}
/**
* Get the quantity of the item.
*
* @return int The quantity of the item.
*/
public function getQuantity()
{
return $this->qty;
}
/**
* Return total price for this item
* Return the total price for this item.
*
* @return float The total price for this item.
*/
public function getTotal()
{
return $this->getQuantity() * $this->getPrice();
}
/**
* Return the total price for this item including tax.
*
* @return float The total price for this item including tax.
*/
public function getTotalWithTax()
{
return $this->getTotal() + $this->getTax();
}
}
}
+75 -3
View File
@@ -30,70 +30,142 @@ class Payment_Transaction
private $currency = NULL;
private $amount = NULL;
private $subscription_id = NULL;
/**
* Set the transaction ID.
*
* @param mixed $param The transaction ID.
*
* @return $this The current object, for method chaining.
*/
public function setId($param)
{
$this->id = $param;
return $this;
}
/**
* Get the transaction ID.
*
* @return mixed The transaction ID.
*/
public function getId()
{
return $this->id;
}
/**
* Set the transaction status.
*
* @param string $param The transaction status.
*
* @return $this The current object, for method chaining.
*/
public function setStatus($param)
{
$this->status = $param;
return $this;
}
/**
* Get the transaction status.
*
* @return string The transaction status.
*/
public function getStatus()
{
return $this->status;
}
/**
* Set the transaction type.
*
* @param string $param The transaction type.
*
* @return $this The current object, for method chaining.
*/
public function setType($param)
{
$this->type = $param;
return $this;
}
/**
* Get the transaction type.
*
* @return string The transaction type.
*/
public function getType()
{
return $this->type;
}
/**
* Set the transaction currency.
*
* @param string $param The transaction currency.
*
* @return $this The current object, for method chaining.
*/
public function setCurrency($param)
{
$this->currency = $param;
return $this;
}
/**
* Get the transaction currency.
*
* @return string The transaction currency.
*/
public function getCurrency()
{
return $this->currency;
}
/**
* Set the transaction amount.
*
* @param float $param The transaction amount.
*
* @return $this The current object, for method chaining.
*/
public function setAmount($param)
{
$this->amount = $param;
return $this;
}
/**
* Get the transaction amount.
*
* @return float The transaction amount.
*/
public function getAmount()
{
return $this->amount;
}
/**
* Set the ID of the subscription associated with the transaction.
*
* @param string $param The subscription ID.
*
* @return $this The current object, for method chaining.
*/
public function setSubscriptionId($param)
{
$this->subscription_id = $param;
return $this;
}
/**
* Get the ID of the subscription associated with the transaction.
*
* @return string The subscription ID.
*/
public function getSubscriptionId()
{
return $this->subscription_id;
}
}
}
+119 -38
View File
@@ -12,7 +12,9 @@ abstract class Registrar_AdapterAbstract
/**
* Return array with configuration
*
* Must be overriden in adapter class
*
* @return array
*/
public static function getConfig()
@@ -21,105 +23,174 @@ abstract class Registrar_AdapterAbstract
}
/**
* Return array of TLDs current Registar is capable to register
* If function returns empty array, this registrar can register any TLD
* @return array
* Returns an array of top-level domains (TLDs) that the registrar is capable of registering.
*
* If the function returns an empty array, the registrar can register any TLD.
*
* @return array Array of TLDs that the registrar is capable of registering.
*/
abstract public function getTlds();
/**
* @return bool
* @throws Registrar_Exception
* Checks if a domain is available for registration.
*
* @param Registrar_Domain $domain Domain object containing the details of the domain to check.
*
* @return bool True if the domain is available, otherwise the adapter should throw an exception
*
* @throws Registrar_Exception If there was an error while checking the domain availability.
*/
abstract public function isDomainAvailable(Registrar_Domain $domain);
/**
* @return bool
* @throws Registrar_Exception
* Checks if a domain can be transferred to the registrar.
*
* @param Registrar_Domain $domain Domain object containing the details of the domain to check.
*
* @return bool True if the domain can be transferred, otherwise the adapter should throw an exception
*
* @throws Registrar_Exception If there was an error while checking the domain transferability.
*/
abstract public function isDomaincanBeTransferred(Registrar_Domain $domain);
/**
* @return bool
* @throws Registrar_Exception
* Modifies the name servers for a domain.
*
* @param Registrar_Domain $domain Domain object containing the details of the domain to update, including the new name servers.
*
* @return bool True if the name servers were modified successfully, otherwise the adapter should throw an exception
*
* @throws Registrar_Exception If there was an error while modifying the name servers.
*/
abstract public function modifyNs(Registrar_Domain $domain);
/**
* @return bool
* @throws Registrar_Exception
* Modifies the contact information for a domain.
*
* @param Registrar_Domain $domain Domain object containing the details of the domain to update, including the new contact information.
*
* @return bool True if the contact information was modified successfully, otherwise the adapter should throw an exception
*
* @throws Registrar_Exception If there was an error while modifying the contact information.
*/
abstract public function modifyContact(Registrar_Domain $domain);
/**
* @return bool
* @throws Registrar_Exception
* Transfers a domain to the registrar.
*
* @param Registrar_Domain $domain Domain object containing the details of the domain to transfer, including the domain transfer code.
*
* @return bool True if the domain was transferred successfully, otherwise the adapter should throw an exceptions
*
* @throws Registrar_Exception If there was an error while transferring the domain.
*/
abstract public function transferDomain(Registrar_Domain $domain);
/**
* Should return details of registered domain
* If domain is not registered should throw Registrar_Exception
* @return Registrar_Domain
* @throws Registrar_Exception
* Returns the details of a registered domain.
*
* @param Registrar_Domain $domain Domain object containing the details of the domain to query.
*
* @return Registrar_Domain Domain object containing the updated details of the registered domain.
*
* @throws Registrar_Exception If the domain is not registered or there was an error while retrieving the domain details.
*/
abstract public function getDomainDetails(Registrar_Domain $domain);
/**
* Should return domain transfer code
* Returns the domain transfer code (also known as the EPP code or auth code) for a domain.
*
* @return string
* @throws Registrar_Exception
* @param Registrar_Domain $domain Domain object containing the details of the domain.
*
* @return string The domain transfer code.
*
* @throws Registrar_Exception If there was an error while retrieving the domain transfer code.
*/
abstract public function getEpp(Registrar_Domain $domain);
/**
* @return bool
* @throws Registrar_Exception
* Registers a domain with the registrar.
*
* @param Registrar_Domain $domain Domain object containing the details of the domain to register.
*
* @return bool True if the domain was registered successfully, otherwise the adapter should throw an exception
*
* @throws Registrar_Exception If there was an error while registering the domain.
*/
abstract public function registerDomain(Registrar_Domain $domain);
/**
* @return bool
* @throws Registrar_Exception
* Renews a domain registration with the registrar.
*
* @param Registrar_Domain $domain Domain object containing the details of the domain to renew.
*
* @return bool True if the domain was renewed successfully, otherwise the adapter should throw an exception
*
* @throws Registrar_Exception If there was an error while renewing the domain.
*/
abstract public function renewDomain(Registrar_Domain $domain);
/**
* @return bool
* @throws Registrar_Exception
* Deletes a domain from the registrar.
*
* @param Registrar_Domain $domain Domain object containing the details of the domain to delete.
*
* @return bool True if the domain was deleted successfully, otherwise the adapter should throw an exception
*
* @throws Registrar_Exception If there was an error while deleting the domain.
*/
abstract public function deleteDomain(Registrar_Domain $domain);
/**
* @return bool
* @throws Registrar_Exception
* Enables privacy protection for a domain.
*
* @param Registrar_Domain $domain Domain object containing the details of the domain for which to enable privacy protection.
*
* @return bool True if privacy protection was enabled successfully, otherwise the adapter should throw an exception
*
* @throws Registrar_Exception If there was an error while enabling privacy protection.
*/
abstract public function enablePrivacyProtection(Registrar_Domain $domain);
/**
* @return bool
* @throws Registrar_Exception
* Disables privacy protection for a domain.
*
* @param Registrar_Domain $domain Domain object containing the details of the domain for which to disable privacy protection.
*
* @return bool True if privacy protection was disabled successfully, otherwise the adapter should throw an exception
*
* @throws Registrar_Exception If there was an error while disabling privacy protection.
*/
abstract public function disablePrivacyProtection(Registrar_Domain $domain);
/**
* @return bool
* @throws Registrar_Exception
* Locks a domain to prevent transfer to another registrar.
*
* @param Registrar_Domain $domain Domain object containing the details of the domain to lock.
*
* @return bool True if the domain was locked successfully, otherwise the adapter should throw an exception
*
* @throws Registrar_Exception If there was an error while locking the domain.
*/
abstract public function lock(Registrar_Domain $domain);
/**
* @return bool
* @throws Registrar_Exception
* Unlocks a domain to allow transfer to another registrar.
*
* @param Registrar_Domain $domain Domain object containing the details of the domain to unlock.
*
* @return bool True if the domain was unlocked successfully, otherwise the adapter should throw an exception
*
* @throws Registrar_Exception If there was an error while unlocking the domain.
*/
abstract public function unlock(Registrar_Domain $domain);
/**
* Set Log
* Sets the logger object to use for logging messages.
*
* @param Box_Log $log
* @return Registrar_AdapterAbstract
* @param Box_Log $log The logger object to use.
*
* @return Registrar_AdapterAbstract The current adapter object, for method chaining.
*/
public function setLog(Box_Log $log)
{
@@ -127,16 +198,26 @@ abstract class Registrar_AdapterAbstract
return $this;
}
/**
* Gets the logger object currently in use for logging messages.
*
* @return Box_Log The logger object.
*/
public function getLog()
{
$log = $this->_log;
if(!$log instanceof Box_Log) {
if (!$log instanceof Box_Log) {
$log = new Box_Log();
$log->addWriter(new Box_LogDb('Model_ActivitySystem'));
}
return $log;
}
/**
* Enables test mode for the adapter.
*
* @return Registrar_AdapterAbstract The current adapter object, for method chaining.
*/
public function enableTestMode()
{
$this->_testMode = true;
+151 -55
View File
@@ -15,44 +15,57 @@
abstract class Server_Manager
{
private $_log = null;
protected $_config = array(
'ip' => NULL,
'host' => NULL,
'secure' => FALSE,
'username' => NULL,
'password' => NULL,
'accesshash'=> NULL,
'port' => NULL,
'ip' => NULL,
'host' => NULL,
'secure' => FALSE,
'username' => NULL,
'password' => NULL,
'accesshash' => NULL,
'port' => NULL,
);
/**
* Constructor for the class.
*
* @param array $options Associative array of options for the class.
* For example, some possible options include:
* - 'ip': IP address of the server.
* - 'host': Hostname of the server.
* - 'secure': Boolean value indicating whether to use a secure connection.
* - 'username': Username for authenticating the connection.
* - 'password': Password for authenticating the connection.
* - 'accesshash': Access hash for authenticating the connection. (API Key)
* - 'port': Custom port number for the connection.
*/
public function __construct($options)
{
if(isset($options['ip'])) {
if (isset($options['ip'])) {
$this->_config['ip'] = $options['ip'];
}
if(isset($options['host'])) {
if (isset($options['host'])) {
$this->_config['host'] = $options['host'];
}
if(isset($options['secure'])) {
if (isset($options['secure'])) {
$this->_config['secure'] = (bool)$options['secure'];
}
if(isset($options['username'])) {
if (isset($options['username'])) {
$this->_config['username'] = $options['username'];
}
if(isset($options['password'])) {
if (isset($options['password'])) {
$this->_config['password'] = $options['password'];
}
if(isset($options['accesshash'])) {
if (isset($options['accesshash'])) {
$this->_config['accesshash'] = $options['accesshash'];
}
if(isset($options['ssl'])) {
if (isset($options['ssl'])) {
$this->_config['ssl'] = $options['ssl'];
}
@@ -60,22 +73,33 @@ abstract class Server_Manager
* Custom connection port to API.
* If not provided, using default server manager port
*/
if(isset($options['port'])) {
if (isset($options['port'])) {
$this->_config['port'] = $options['port'];
}
$this->init();
}
/**
* Sets the logger object.
*
* @param Box_Log $value The logger object.
* @return $this
*/
public function setLog(Box_Log $value)
{
$this->_log = $value;
return $this;
}
/**
* Returns the logger object.
*
* @return Box_Log The logger object.
*/
public function getLog()
{
if(!$this->_log instanceof Box_Log) {
if (!$this->_log instanceof Box_Log) {
$log = new Box_Log();
$log->addWriter(new Box_LogDb('Model_ActivitySystem'));
return $log;
@@ -83,94 +107,166 @@ abstract class Server_Manager
return $this->_log;
}
protected function init(){}
/**
* Initializes the object after construction.
*
* This function can be used to perform any necessary setup tasks that are required after the object has been constructed.
*
* @return void
*/
protected function init()
{
}
/**
* Returns the login URL for the server. (ex: panel.example.com)
*
* @return string
*/
abstract public function getLoginUrl();
/**
* Returns the login URL for the server for reseller accounts.
*
* @return string
*/
abstract public function getResellerLoginUrl();
/**
* Used to test the connection to the server and verify the server configuration is correct.
*
* @return bool
*
* @throws Server_Exception
*/
abstract public function testConnection();
/**
* @param Server_Account
* @return bool
* @throws Server_Exception
* Creates a new account on the server.
*
* @param Server_Account $a Account object containing the details of the account to create.
*
* @return bool True if the account was created successfully, if not the server manager should throw an exception
*
* @throws Server_Exception If there was an error while creating the account.
*/
abstract public function createAccount(Server_Account $a);
/**
* @param Server_Account
* @return Server_Account
* @throws Server_Exception
* Synchronizes the account status from the server.
*
* @param Server_Account $a Account object containing the details of the account to synchronize.
*
* @return Server_Account A new account object with the updated status.
*
* @throws Server_Exception If there was an error while synchronizing the account.
*/
abstract public function synchronizeAccount(Server_Account $a);
/**
* @param Server_Account
* @return bool
* @throws Server_Exception
* Suspends an account on the server.
*
* @param Server_Account $a Account object containing the details of the account to suspend.
*
* @return bool True if the account was suspended successfully, if not the sever manager should throw an exception
*
* @throws Server_Exception If there was an error while suspending the account.
*/
abstract public function suspendAccount(Server_Account $a);
/**
* @param Server_Account
* @return bool
* @throws Server_Exception
* Unsuspends an account on the server.
*
* @param Server_Account $a Account object containing the details of the account to unsuspend.
*
* @return bool True if the account was unsuspended successfully, if not the sever manager should throw an exception
*
* @throws Server_Exception If there was an error while unsuspending the account.
*/
abstract public function unsuspendAccount(Server_Account $a);
/**
* @param Server_Account
* @return bool
* @throws Server_Exception
* Cancels an account on the server.
*
* @param Server_Account $a Account object containing the details of the account to cancel.
*
* @return bool True if the account was canceled successfully, if not the sever manager should throw an exception
*
* @throws Server_Exception If there was an error while canceling the account.
*/
abstract public function cancelAccount(Server_Account $a);
/**
* @param Server_Account
* @return bool
* @throws Server_Exception
* Changes the password for an account on the server.
*
* @param Server_Account $a Account object containing the details of the account to update.
*
* @param string $new_password The new password for the account.
*
* @return bool True if the password was changed successfully, if not the sever manager should throw an exception
*
* @throws Server_Exception If there was an error while changing the password.
*/
abstract public function changeAccountPassword(Server_Account $a, $new_password);
/**
* @param Server_Account
* @return bool
* @throws Server_Exception
* Changes the username for an account on the server.
*
* @param Server_Account $a Account object containing the details of the account to update.
*
* @param string $new_username The new username for the account.
*
* @return bool True if the username was changed successfully, if not the sever manager should throw an exception
*
* @throws Server_Exception If there was an error while changing the username.
*/
abstract public function changeAccountUsername(Server_Account $a, $new_username);
/**
* @param Server_Account
* @param string $new_domain
* @return bool
* @throws Server_Exception
* Changes the domain for an account on the server.
*
* @param Server_Account $a Account object containing the details of the account to update.
*
* @param string $new_domain The new domain for the account.
*
* @return bool True if the domain was changed successfully, if not the sever manager should throw an exception
*
* @throws Server_Exception If there was an error while changing the domain.
*/
abstract public function changeAccountDomain(Server_Account $a, $new_domain);
/**
* @param Server_Account
* @param string - new ip
* @return bool
* @throws Server_Exception
* Changes the IP address for an account on the server.
*
* @param Server_Account $a Account object containing the details of the account to update.
*
* @param string $new_ip The new IP address for the account.
*
* @return bool True if the IP address was changed successfully, if not the sever manager should throw an exception
*
* @throws Server_Exception If there was an error while changing the IP address.
*/
abstract public function changeAccountIp(Server_Account $a, $new_ip);
/**
* @param Server_Account
* @param Server_Package - new package
* @return bool
* @throws Server_Exception
* Changes the package for an account on the server.
*
* @param Server_Account $a Account object containing the details of the account to update.
*
* @param Server_Package $p New package for the account.
*
* @return bool True if the package was changed successfully, if not the sever manager should throw an exception
*
* @throws Server_Exception If there was an error while changing the package.
*/
abstract public function changeAccountPackage(Server_Account $a, Server_Package $p);
}
}