Skip to content

Commit ca6746c

Browse files
committed
fix: mocktest
1 parent a48e3f2 commit ca6746c

File tree

2 files changed

+19
-9
lines changed

2 files changed

+19
-9
lines changed

src/Domains/Registrar/Mock.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -488,17 +488,17 @@ public function checkTransferStatus(string $domain, bool $checkStatus = true, bo
488488
'noservice' => 0,
489489
];
490490

491-
if (in_array($domain, $this->purchasedDomains)) {
491+
if (in_array($domain, $this->transferredDomains)) {
492492
$response['transferrable'] = 0;
493-
$response['reason'] = "Domain already exists in mock account";
494-
$response['reason_code'] = 'domain_already_belongs_to_current_reseller';
495-
$response['status'] = 'completed';
493+
$response['reason'] = 'Transfer in progress';
494+
$response['status'] = 'pending_registry';
496495
$response['timestamp'] = date('D M d H:i:s Y');
497496
$response['unixtime'] = time();
498-
} elseif (in_array($domain, $this->transferredDomains)) {
497+
} elseif (in_array($domain, $this->purchasedDomains)) {
499498
$response['transferrable'] = 0;
500-
$response['reason'] = 'Transfer in progress';
501-
$response['status'] = 'pending_registry';
499+
$response['reason'] = "Domain already exists in mock account";
500+
$response['reason_code'] = 'domain_already_belongs_to_current_reseller';
501+
$response['status'] = 'completed';
502502
$response['timestamp'] = date('D M d H:i:s Y');
503503
$response['unixtime'] = time();
504504
} else {

src/Domains/Registrar/OpenSRS.php

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -744,7 +744,7 @@ public function checkTransferStatus(string $domain, bool $checkStatus = true, bo
744744
}
745745
}
746746

747-
private function send(array $params = []): array|string
747+
private function send(array $params = []): string
748748
{
749749
$object = $params['object'];
750750
$action = $params['action'];
@@ -763,7 +763,17 @@ private function send(array $params = []): array|string
763763
curl_setopt($ch, CURLOPT_POST, 1);
764764
curl_setopt($ch, CURLOPT_POSTFIELDS, $xml);
765765

766-
return curl_exec($ch);
766+
$result = curl_exec($ch);
767+
768+
if ($result === false) {
769+
$error = curl_error($ch);
770+
curl_close($ch);
771+
throw new Exception('Failed to send request to OpenSRS: ' . $error);
772+
}
773+
774+
curl_close($ch);
775+
776+
return $result;
767777
}
768778

769779
private function sanitizeResponse(string $response)

0 commit comments

Comments
 (0)