Skip to content

Commit

Permalink
Merge pull request #32 from inwx/fix_empty_nameservers
Browse files Browse the repository at this point in the history
Fix empty nameservers
  • Loading branch information
ddmler authored May 24, 2024
2 parents 88c73ad + d0bb54e commit 824b0dc
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions modules/registrars/inwx/inwx.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
use WHMCS\Domain\TopLevel\ImportItem;
use WHMCS\Domains\DomainLookup\ResultsList;
use WHMCS\Domains\DomainLookup\SearchResult;
use WHMCS\Carbon;

include_once 'helpers.php';

Expand Down Expand Up @@ -492,7 +493,7 @@ function inwx_RegisterDomain(array $params): array
// Registrant creation
$pRegistrant['type'] = 'PERSON';
$pRegistrant['name'] = $params['firstname'] . ' ' . $params['lastname'];
if (isset($params['companyname']) && empty($params['companyname'])) {
if (isset($params['companyname']) && !empty($params['companyname'])) {
$pRegistrant['org'] = $params['companyname'];
}
$pRegistrant['street'] = $params['address1'];
Expand Down Expand Up @@ -524,7 +525,7 @@ function inwx_RegisterDomain(array $params): array
// Admin creation
$pAdmin['type'] = 'PERSON';
$pAdmin['name'] = $params['adminfirstname'] . ' ' . $params['adminlastname'];
if (isset($params['admincompanyname']) && empty($params['admincompanyname'])) {
if (isset($params['admincompanyname']) && !empty($params['admincompanyname'])) {
$pAdmin['org'] = $params['admincompanyname'];
}
$pAdmin['street'] = $params['adminaddress1'];
Expand Down Expand Up @@ -628,7 +629,7 @@ function inwx_TransferDomain(array $params): array
// Registrant creation
$pRegistrant['type'] = 'PERSON';
$pRegistrant['name'] = $params['firstname'] . ' ' . $params['lastname'];
if (isset($params['companyname']) && empty($params['companyname'])) {
if (isset($params['companyname']) && !empty($params['companyname'])) {
$pRegistrant['org'] = $params['companyname'];
}
$pRegistrant['street'] = $params['address1'];
Expand Down Expand Up @@ -660,7 +661,7 @@ function inwx_TransferDomain(array $params): array
// Admin creation
$pAdmin['type'] = 'PERSON';
$pAdmin['name'] = $params['adminfirstname'] . ' ' . $params['adminlastname'];
if (isset($params['admincompanyname']) && empty($params['admincompanyname'])) {
if (isset($params['admincompanyname']) && !empty($params['admincompanyname'])) {
$pAdmin['org'] = $params['admincompanyname'];
}
$pAdmin['street'] = $params['adminaddress1'];
Expand Down Expand Up @@ -1021,7 +1022,11 @@ function inwx_GetDomainInformation(array $params): Domain
}

if (isset($response['resData']['ns'])) {
$domain->setNameservers($response['resData']['ns']);
$nameservers = [];
for ($i = 0; $i < count($response['resData']['ns']); $i++) {
$nameservers['ns' . ($i + 1)] = $response['resData']['ns'][$i];
}
$domain->setNameservers($nameservers);
}

if (isset($response['resData']['status'])) {
Expand Down Expand Up @@ -1053,7 +1058,7 @@ function inwx_GetDomainInformation(array $params): Domain
}

if (isset($response['resData']['exDate'])) {
$domain->setExpiryDate(Carbon::createFromFormat('Y-m-d', $response['resData']['exDate']['scalar']));
$domain->setExpiryDate(Carbon::parse($response['resData']['exDate']['scalar']));
}

if (isset($response['resData']['registrantVerificationStatus']) && isset($response['resData']['verificationStatus'])) {
Expand Down

0 comments on commit 824b0dc

Please sign in to comment.