Skip to content

Commit

Permalink
Merge pull request #92 from SynergyWholesale/bugfix/SW-2408-when-tran…
Browse files Browse the repository at this point in the history
…sfering-in-a-direct-au-domain-it-will-always-attempt-to-renew-it

fix: direct au domains always attempting to renew
  • Loading branch information
Sn0wCrack authored Aug 26, 2022
2 parents d5f0199 + 752243e commit 2dd84e6
Showing 1 changed file with 14 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -518,7 +518,7 @@ function synergywholesaledomains_SaveNameservers(array $params)
*/
function synergywholesaledomains_GetRegistrarLock(array $params)
{
if (!preg_match('/\.(au|uk)$/i', $params['tld'])) {
if (!preg_match('/\.?(au|uk)$/i', $params['tld'])) {
try {
$response = synergywholesaledomains_apiRequest('domainInfo', $params);
$locked = 'clientTransferProhibited' === $response['domain_status'];
Expand Down Expand Up @@ -695,18 +695,25 @@ function synergywholesaledomains_TransferDomain(array $params)
// This is a lazy way of getting the contact data in the format we need.
$contact = synergywholesaledomains_helper_getContacts($params, ['' => '']);

if (preg_match('/\.uk$/', $params['tld'])) {
if (preg_match('/\.?uk$/', $params['tld'])) {
return synergywholesaledomains_apiRequest('transferDomain', $params, $contact, false);
}

$request = [
'authInfo' => $params['transfersecret'],
'doRenewal' => 1,
];

if (preg_match('/\.au$/', $params['tld'])) {
$canRenew = synergywholesaledomains_apiRequest('domainRenewRequired', $params, $request, false);
$request['doRenewal'] = (int) ('on' === $params['doRenewal'] && 'OK_RENEWAL' === $canRenew['status']);
$canRenew = synergywholesaledomains_apiRequest('domainRenewRequired', $params, $request, false);

$forceAuRenewal = ('on' === $params['doRenewal']);

$canRenewDomain = $canRenew['status'] === 'OK_RENEWAL';

$request['doRenewal'] = $canRenewDomain;

// If this is an AU domain and we have disabled forcing .au renewals, disable doRenewal on the request
if (preg_match('/\.?au$/', $params['tld']) && !$forceAuRenewal) {
$request['doRenewal'] = false;
}

/**
Expand Down Expand Up @@ -907,7 +914,7 @@ function synergywholesaledomains_Sync(array $params)
}

$returnData = [];
if (preg_match('/\.au$/', $params['tld'])) {
if (preg_match('/\.?au$/', $params['tld'])) {
$appMap = [
'auRegistrantIDType' => 'Registrant ID Type',
'auRegistrantID' => 'Registrant ID',
Expand Down

0 comments on commit 2dd84e6

Please sign in to comment.