Skip to content

Commit

Permalink
Fix transfer() contact handling where null is given
Browse files Browse the repository at this point in the history
  • Loading branch information
uphlewis committed May 12, 2023
1 parent d374502 commit ca142b1
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 11 deletions.
17 changes: 11 additions & 6 deletions src/ConnectReseller/Provider.php
Original file line number Diff line number Diff line change
Expand Up @@ -159,13 +159,18 @@ public function transfer(TransferParams $params): DomainResult
// we need to initiate a transfer order
}

$contact = $params->registrant->register
?? $params->admin->register
?? $params->tech->register
?? $params->billing->register
?? null;

if (!$contact) {
throw $this->errorResult('Contact details are required to initiate transfer');
}

$eppCode = $params->epp_code ?? '0000';
$customerId = $this->_getCustomerId(
$params->registrant->register
?? $params->admin->register
?? $params->tech->register
?? $params->billing->register
);
$customerId = $this->_getCustomerId($contact);

$transferResponse = $this->_initiateTransfer($customerId, $domainName, $eppCode);

Expand Down
8 changes: 4 additions & 4 deletions src/Demo/Provider.php
Original file line number Diff line number Diff line change
Expand Up @@ -131,10 +131,10 @@ public function transfer(TransferParams $params): DomainResult
return $result->setMessage('Demo domain transfer complete')
->setStatuses(['Active'])
->setLocked(false)
->setRegistrant($params->registrant->register)
->setAdmin($params->admin->register)
->setTech($params->tech->register)
->setBilling($params->billing->register)
->setRegistrant($params->registrant->register ?? null)
->setAdmin($params->admin->register ?? null)
->setTech($params->tech->register ?? null)
->setBilling($params->billing->register ?? null)
->setUpdatedAt(Carbon::now())
->setExpiresAt($expires->addYears($params->renew_years));
}
Expand Down
2 changes: 1 addition & 1 deletion src/NameSilo/Provider.php
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ public function transfer(TransferParams $params): DomainResult
$this->_callApi([
'domain' => $domain,
'auth' => Arr::get($params, 'epp_code'),
'contact_id' => $this->_handleContact($params->registrant),
'contact_id' => $this->_handleContact($params->registrant ?? $params->admin),
'auto_renew' => 0,
], 'transferDomain');

Expand Down

0 comments on commit ca142b1

Please sign in to comment.