Skip to content

Commit

Permalink
Merge pull request #88 from SynergyWholesale/release/2022-06-09
Browse files Browse the repository at this point in the history
Release 2022-06-09
  • Loading branch information
Sn0wCrack authored Jun 20, 2022
2 parents 0c9c2f6 + 74636c1 commit 4b7dc38
Show file tree
Hide file tree
Showing 4 changed files with 73 additions and 13 deletions.
10 changes: 9 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,15 @@ Synergy Wholesale WHMCS Domains Module
### Removed
-

## 2.3.1 [Updated 30/032022]
## 2.4.0 [Updated 09/05/2022]
### Fixed
- Organisation field not displaying on Domain Contact form
- Domains not syncing their correct status when in a transfer state
- Issue where DNS and URL Forwarding would display on side menu despite not being enabled on Domain Name
- Changing DNS configuration type would display "undefined" instead of the correct name
- Fix potential issue with logging API requests

## 2.3.1 [Updated 30/03/2022]
### Fixed
- Syncing .au domains that are currently pending application or pending identity verification

Expand Down
35 changes: 29 additions & 6 deletions modules/registrars/synergywholesaledomains/hooks.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,37 @@
$menu->removeChild('Manage Private Nameservers');
}

if ($context->hasDnsManagement && !is_null($menu->getChild('Manage DNS Host Records'))) {
$menu->removeChild('Manage DNS Host Records');
}
if ($context->status === 'Active') {
$settings = $context->getRegistrarInterface()->getSettings();

if ($context->hasEmailForwarding && !is_null($menu->getChild('Manage Email Forwarding'))) {
$menu->removeChild('Manage Email Forwarding');
}
$vars = [
'resellerID' => $settings['resellerID'],
'apiKey' => $settings['apiKey'],
'domainName' => $context->domain
];

try {
$info = synergywholesaledomains_apiRequest('domainInfo', [], $vars);

if ($context->hasDnsManagement && !in_array($info['dnsConfig'], [2, 4]) && !is_null($menu->getChild('Manage DNS Host Records'))) {
$menu->removeChild('Manage DNS Host Records');
}

if ($context->hasEmailForwarding && !in_array($info['dnsConfig'], [2]) && !is_null($menu->getChild('Manage Email Forwarding'))) {
$menu->removeChild('Manage Email Forwarding');
}
} catch (\Exception $e) {
if (!is_null($menu->getChild('Manage DNS Host Records'))) {
$menu->removeChild('Manage DNS Host Records');
}

if (!is_null($menu->getChild('Manage Email Forwarding'))) {
$menu->removeChild('Manage Email Forwarding');
}
}
}


if (preg_match('/\.au$/', $context->domain) && !is_null($menu->getChild('Registrar Lock Status'))) {
$menu->removeChild('Registrar Lock Status');
}
Expand Down
4 changes: 2 additions & 2 deletions modules/registrars/synergywholesaledomains/js/functions.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ function Toast(type, css, msg) {
}

function formSubmitDNS() {
let type = determineDNSType(document.getElementById('option').value);
let type = determineDNSType(parseInt(document.getElementById('option').value));
let text = `Are you sure you want to change the DNS Type to ${type} ?`;
if (confirm(text)) {
this.form.submit()
Expand Down Expand Up @@ -733,4 +733,4 @@ function DnsUrlPageReady(domain_id) {
break;
}
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,8 @@ function synergywholesaledomains_apiRequest($command, array $params = [], array

try {
$response = $client->{$command}($request);
logModuleCall(SW_MODULE_NAME, $command, $request, $response, $response, $auth);
$logResponse = is_string($response) ? $response : (array) $response;
logModuleCall(SW_MODULE_NAME, $command, $request, $logResponse, $logResponse, $auth);
} catch (SoapFault $e) {
logModuleCall(SW_MODULE_NAME, $command, $request, $e->getMessage(), $e->getMessage(), $auth);

Expand Down Expand Up @@ -1048,12 +1049,30 @@ function synergywholesaledomains_TransferSync(array $params)
try {
$response = synergywholesaledomains_apiRequest('domainInfo', $params);
} catch (\Exception $e) {
if ($e->getMessage() == 'Domain Info Failed - Unable to retrieve domain id') {
return [
'completed' => false,
'failed' => true,
'reason' => 'Domain has been marked as cancelled due to not being in your account'
];
}

return [
'error' => $e->getMessage(),
];
}

if (!isset($response['domain_status'])) {
if (isset($response['transfer_status'])
&& isset($response['status'])
&& in_array($response['status'], ['OK_TRANSFER_TIMEOUT', 'OK_TRANSFER_REJECTED', 'OK_TRANSFER_CANCELLED'])) {
// It has timed out, was cancelled, or was rejected
return [
'completed' => false,
'failed' => true,
'reason' => 'Transfer was either rejected, cancelled or timed out'
];
}
return [
'completed' => false,
];
Expand Down Expand Up @@ -1123,6 +1142,9 @@ function synergywholesaledomains_SaveContactDetails(array $params)
$request["{$contactType}_suburb"] = $params['contactdetails'][$whmcs_contact]['City'];
$request["{$contactType}_postcode"] = $params['contactdetails'][$whmcs_contact]['Postcode'];

if (!preg_match('/\.?uk$/', $params['tld'])) {
$request["{$contactType}_organisation"] = $params['contactdetails'][$whmcs_contact]['Organisation'];
}
// Validate the country being specified
if (!synergywholesaledomains_validateCountry($params['contactdetails'][$whmcs_contact]['Country'])) {
return [
Expand Down Expand Up @@ -1196,6 +1218,7 @@ function synergywholesaledomains_GetContactDetails(array $params)
'address1' => 'Address 1',
'address2' => 'Address 2',
'address3' => 'Address 3',
'organisation' => 'Organisation',
'suburb' => 'City',
'state' => 'State',
'country' => 'Country',
Expand All @@ -1204,6 +1227,12 @@ function synergywholesaledomains_GetContactDetails(array $params)
'email' => 'Email',
];


if (preg_match('/\.?uk$/', $params['tld'])) {
unset($map['organisation']);
}


$contactTypes = ['registrant'];
foreach (['admin', 'billing', 'tech'] as $otherTypes) {
if (isset($contacts[$otherTypes])) {
Expand Down Expand Up @@ -1277,12 +1306,12 @@ function synergywholesaledomains_domainOptions(array $params)
$errors[] = 'An error occured retrieving the domain information: ' . $e->getMessage();
}

if (isset($_REQUEST['sub']) && 'save' === $_REQUEST['sub'] && isset($_REQUEST['opt'])) {
if (isset($_REQUEST['sub']) && $_REQUEST['sub'] === 'save' && isset($_REQUEST['opt']) && empty($errors)) {
switch ($_REQUEST['opt']) {
case 'dnstype':
$request['nameServers'] = synergywholesaledomains_helper_getNameservers($info['nameServers']);
// Set nameservers to DNS hosting if selected.
if (1 == $_REQUEST['option']) {
if ($_REQUEST['option'] == 1) {
$request['nameServers'] = [
'ns1.nameserver.net.au',
'ns2.nameserver.net.au',
Expand Down Expand Up @@ -1312,7 +1341,7 @@ function synergywholesaledomains_domainOptions(array $params)
case 'resendwhoisverif':
try {
$response = synergywholesaledomains_apiRequest('resendVerificationEmail', $params, $request);
$vars['info'] = 'Resend WHOIS Verification Email successfull';
$vars['info'] = 'Resend WHOIS Verification Email successful';
} catch (\Exception $e) {
$errors[] = 'Resend WHOIS Verification Email failed: ' . $e->getMessage();
}
Expand Down

0 comments on commit 4b7dc38

Please sign in to comment.