Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
74 changes: 74 additions & 0 deletions Registries/itEppConnection/eppConnection.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
<?php
namespace Metaregistrar\EPP;

class itEppConnection extends eppHttpsConnection {

/*
* Available credit in euros
* @var float
*/
protected float $credit = 0;

public function __construct($logging = false, $settingsfile = null) {
parent::__construct($logging, $settingsfile);

parent::enableRgp();

parent::setServices(
array(
'urn:ietf:params:xml:ns:domain-1.0' => 'domain',
'urn:ietf:params:xml:ns:contact-1.0' => 'contact'
)
);

// Add registry-specific EPP extensions
parent::useExtension('it-extcon-1.0');
parent::useExtension('it-extdom-2.0');
parent::useExtension('it-extepp-2.0');
}

public function enableDnssec() {
parent::enableDnssec();
$this->useExtension('it-extsecdns-1.0');
}

public function disableDnssec() {
parent::disableDnssec();
$this->removeExtension('it-extsecdns-1.0');
}

/**
* Performs an EPP login request and checks the result
* @param bool $usecdata Enclose the password field with [[CDATA]]
* @return bool
*/
public function login($usecdata = false)
{
if (!$this->connected) {
if (!$this->connect()) {
return false;
}
}
$login = new eppLoginRequest(null, $usecdata);

if ($response = $this->request($login)) {
// Get available credit
/** @var itEppLoginResponse $response */
$this->credit = $response->getCredit();

$this->writeLog("Logged in", "LOGIN");
$this->loggedin = true;
return true;
}
return false;
}

/**
* Get the available credit in euros
* @return float
*/
public function getCredit(): float
{
return $this->credit;
}
}