feat: add payment method support for domain registration

Extended the EPP registrar module to include payment method fields `card_id` and `card_cvc`, allowing for direct payment processing during domain registration and renewal processes. This update enables more streamlined transactions by incorporating payment details directly within the domain provisioning workflow, addressing previous limitations that required separate payment handling.

This change introduces new configuration options for storing payment method details securely and modifies the domain registration and renewal XML requests to include these details as per the updated EPP standard. Ensure proper handling and storage of these sensitive details in compliance with applicable security standards.
This commit is contained in:
Kumi 2024-05-19 18:40:15 +02:00
parent 66c0c8e0e6
commit 0047b66f53
Signed by: kumi
GPG key ID: ECBCC9082395383F

112
ISNIC.php
View file

@ -1,4 +1,5 @@
<?php <?php
/** /**
* Indera EPP registrar module for FOSSBilling (https://fossbilling.org/) * Indera EPP registrar module for FOSSBilling (https://fossbilling.org/)
* *
@ -45,6 +46,12 @@ class Registrar_Adapter_ISNIC extends Registrar_AdapterAbstract
} else { } else {
$this->config['use_tls_12'] = false; $this->config['use_tls_12'] = false;
} }
if (isset($options['card_id'])) {
$this->config['card_id'] = $options['card_id'];
}
if (isset($options['card_cvc'])) {
$this->config['card_cvc'] = $options['card_cvc'];
}
} }
public function getTlds() public function getTlds()
@ -57,52 +64,73 @@ class Registrar_Adapter_ISNIC extends Registrar_AdapterAbstract
return array( return array(
'label' => 'An EPP registry module allows registrars to manage and register domain names using the Extensible Provisioning Protocol (EPP). All details below are typically provided by the domain registry and are used to authenticate your account when connecting to the EPP server.', 'label' => 'An EPP registry module allows registrars to manage and register domain names using the Extensible Provisioning Protocol (EPP). All details below are typically provided by the domain registry and are used to authenticate your account when connecting to the EPP server.',
'form' => array( 'form' => array(
'username' => array('text', array( 'username' => array(
'text', array(
'label' => 'EPP Server Username', 'label' => 'EPP Server Username',
'required' => true, 'required' => true,
), ),
), ),
'password' => array('password', array( 'password' => array(
'password', array(
'label' => 'EPP Server Password', 'label' => 'EPP Server Password',
'required' => true, 'required' => true,
'renderPassword' => true, 'renderPassword' => true,
), ),
), ),
'host' => array('text', array( 'host' => array(
'text', array(
'label' => 'EPP Server Host', 'label' => 'EPP Server Host',
'required' => true, 'required' => true,
), ),
), ),
'port' => array('text', array( 'port' => array(
'text', array(
'label' => 'EPP Server Port', 'label' => 'EPP Server Port',
'required' => true, 'required' => true,
), ),
), ),
'registrarprefix' => array('text', array( 'registrarprefix' => array(
'text', array(
'label' => 'Registrar Prefix', 'label' => 'Registrar Prefix',
'required' => true, 'required' => true,
), ),
), ),
'ssl_cert' => array('text', array( 'ssl_cert' => array(
'text', array(
'label' => 'SSL Certificate Path', 'label' => 'SSL Certificate Path',
'required' => true, 'required' => true,
), ),
), ),
'ssl_key' => array('text', array( 'ssl_key' => array(
'text', array(
'label' => 'SSL Key Path', 'label' => 'SSL Key Path',
'required' => true, 'required' => true,
), ),
), ),
'ssl_ca' => array('text', array( 'ssl_ca' => array(
'text', array(
'label' => 'SSL CA Path', 'label' => 'SSL CA Path',
'required' => false, 'required' => false,
), ),
), ),
'use_tls_12' => array('radio', array( 'use_tls_12' => array(
'radio', array(
'multiOptions' => array('1' => 'Yes', '0' => 'No'), 'multiOptions' => array('1' => 'Yes', '0' => 'No'),
'label' => 'Use TLS 1.2 instead of 1.3', 'label' => 'Use TLS 1.2 instead of 1.3',
), ),
), ),
'card_id' => array(
'text', array(
'label' => 'Card ID of the payment method',
'required' => true,
),
),
'card_cvc' => array(
'text', array(
'label' => 'Card CVC',
'required' => true,
),
),
), ),
); );
} }
@ -144,14 +172,12 @@ class Registrar_Adapter_ISNIC extends Registrar_AdapterAbstract
$r = $r->response->resData->children('urn:ietf:params:xml:ns:domain-1.0')->chkData; $r = $r->response->resData->children('urn:ietf:params:xml:ns:domain-1.0')->chkData;
$reason = (string)$r->cd[0]->reason; $reason = (string)$r->cd[0]->reason;
if ($reason) if ($reason) {
{
return false; return false;
} else { } else {
return true; return true;
} }
if (!empty($s)) if (!empty($s)) {
{
$this->logout(); $this->logout();
} }
@ -258,9 +284,7 @@ class Registrar_Adapter_ISNIC extends Registrar_AdapterAbstract
</epp>'); </epp>');
$r = $this->write($xml, __FUNCTION__); $r = $this->write($xml, __FUNCTION__);
} }
} } catch (exception $e) {
catch(exception $e) {
$return = array( $return = array(
'error' => $e->getMessage() 'error' => $e->getMessage()
); );
@ -309,9 +333,7 @@ class Registrar_Adapter_ISNIC extends Registrar_AdapterAbstract
</epp>'); </epp>');
$r = $this->write($xml, __FUNCTION__); $r = $this->write($xml, __FUNCTION__);
$r = $r->response->resData->children('urn:ietf:params:xml:ns:domain-1.0')->trnData; $r = $r->response->resData->children('urn:ietf:params:xml:ns:domain-1.0')->trnData;
} } catch (exception $e) {
catch(exception $e) {
$return = array( $return = array(
'error' => $e->getMessage() 'error' => $e->getMessage()
); );
@ -381,9 +403,7 @@ class Registrar_Adapter_ISNIC extends Registrar_AdapterAbstract
$domain->setNs2(isset($ns[1]) ? $ns[1] : ''); $domain->setNs2(isset($ns[1]) ? $ns[1] : '');
$domain->setNs3(isset($ns[2]) ? $ns[2] : ''); $domain->setNs3(isset($ns[2]) ? $ns[2] : '');
$domain->setNs4(isset($ns[3]) ? $ns[3] : ''); $domain->setNs4(isset($ns[3]) ? $ns[3] : '');
} } catch (exception $e) {
catch(exception $e) {
$domain = array( $domain = array(
'error' => $e->getMessage() 'error' => $e->getMessage()
); );
@ -424,9 +444,7 @@ class Registrar_Adapter_ISNIC extends Registrar_AdapterAbstract
</command> </command>
</epp>'); </epp>');
$r = $this->write($xml, __FUNCTION__); $r = $this->write($xml, __FUNCTION__);
} } catch (exception $e) {
catch(exception $e) {
$return = array( $return = array(
'error' => $e->getMessage() 'error' => $e->getMessage()
); );
@ -673,13 +691,17 @@ class Registrar_Adapter_ISNIC extends Registrar_AdapterAbstract
</domain:authInfo> </domain:authInfo>
</domain:create> </domain:create>
</create> </create>
<extension>
<is-ext-domain:create>
<is-ext-domain:cardID>{{ card_id }}</is-ext-domain:cardID>
<is-ext-domain:cardCVC>{{ card_cvc }}</is-ext-domain:cardCVC>
</is-ext-domain:create>
</extension>
<clTRID>{{ clTRID }}</clTRID> <clTRID>{{ clTRID }}</clTRID>
</command> </command>
</epp>'); </epp>');
$r = $this->write($xml, __FUNCTION__); $r = $this->write($xml, __FUNCTION__);
} } catch (exception $e) {
catch(exception $e) {
$return = array( $return = array(
'error' => $e->getMessage() 'error' => $e->getMessage()
); );
@ -745,13 +767,17 @@ class Registrar_Adapter_ISNIC extends Registrar_AdapterAbstract
<domain:period unit="y">1</domain:period> <domain:period unit="y">1</domain:period>
</domain:renew> </domain:renew>
</renew> </renew>
<extension>
<is-ext-domain:renew>
<is-ext-domain:cardID>{{ card_id }}</is-ext-domain:cardID>
<is-ext-domain:cardCVC>{{ card_cvc }}</is-ext-domain:cardCVC>
</is-ext-domain:renew>
</extension>
<clTRID>{{ clTRID }}</clTRID> <clTRID>{{ clTRID }}</clTRID>
</command> </command>
</epp>'); </epp>');
$r = $this->write($xml, __FUNCTION__); $r = $this->write($xml, __FUNCTION__);
} } catch (exception $e) {
catch(exception $e) {
$return = array( $return = array(
'error' => $e->getMessage() 'error' => $e->getMessage()
); );
@ -853,9 +879,7 @@ class Registrar_Adapter_ISNIC extends Registrar_AdapterAbstract
</command> </command>
</epp>'); </epp>');
$r = $this->write($xml, __FUNCTION__); $r = $this->write($xml, __FUNCTION__);
} } catch (exception $e) {
catch(exception $e) {
$return = array( $return = array(
'error' => $e->getMessage() 'error' => $e->getMessage()
); );
@ -943,9 +967,7 @@ class Registrar_Adapter_ISNIC extends Registrar_AdapterAbstract
</epp>'); </epp>');
$r = $this->write($xml, __FUNCTION__); $r = $this->write($xml, __FUNCTION__);
} }
} } catch (exception $e) {
catch(exception $e) {
$return = array( $return = array(
'error' => $e->getMessage() 'error' => $e->getMessage()
); );
@ -1033,9 +1055,7 @@ class Registrar_Adapter_ISNIC extends Registrar_AdapterAbstract
</epp>'); </epp>');
$r = $this->write($xml, __FUNCTION__); $r = $this->write($xml, __FUNCTION__);
} }
} } catch (exception $e) {
catch(exception $e) {
$return = array( $return = array(
'error' => $e->getMessage() 'error' => $e->getMessage()
); );
@ -1084,9 +1104,7 @@ class Registrar_Adapter_ISNIC extends Registrar_AdapterAbstract
$this->logout(); $this->logout();
} }
return $eppcode; return $eppcode;
} } catch (exception $e) {
catch(exception $e) {
$return = array( $return = array(
'error' => $e->getMessage() 'error' => $e->getMessage()
); );
@ -1180,9 +1198,7 @@ class Registrar_Adapter_ISNIC extends Registrar_AdapterAbstract
</epp>'); </epp>');
$r = $this->write($xml, __FUNCTION__); $r = $this->write($xml, __FUNCTION__);
} }
} } catch (exception $e) {
catch(exception $e) {
$return = array( $return = array(
'error' => $e->getMessage() 'error' => $e->getMessage()
); );
@ -1276,9 +1292,7 @@ class Registrar_Adapter_ISNIC extends Registrar_AdapterAbstract
</epp>'); </epp>');
$r = $this->write($xml, __FUNCTION__); $r = $this->write($xml, __FUNCTION__);
} }
} } catch (exception $e) {
catch(exception $e) {
$return = array( $return = array(
'error' => $e->getMessage() 'error' => $e->getMessage()
); );