Skip to content
This repository was archived by the owner on Feb 4, 2025. It is now read-only.

Use StatusCode constants for the checkStatus method #23

Merged
merged 2 commits into from
Feb 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). Please note this changelog affects
this package and not the Oxxa API.

## [2.5.1]

### Changed

- Use `StatusCode` constants for the `checkStatus` method.

## [2.5.0]

### Added
Expand Down
44 changes: 29 additions & 15 deletions src/Enum/StatusCode.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ class StatusCode
{
public const STATUS_DOMAIN_REGISTERED = 'XMLOK 1';

public const STATUS_DOMAIN_REGISTER_REQUESTED = 'XMLPEN 1';

public const STATUS_DOMAIN_AUTORENEW_CHANGED = 'XMLOK 2';

public const STATUS_DOMAIN_LOCK_CHANGED = 'XMLOK 3';
Expand Down Expand Up @@ -44,37 +42,53 @@ class StatusCode

public const STATUS_DOMAINS_RETRIEVED = 'XMLOK18';

public const STATUS_DOMAIN_TRANSFER_REQUESTED = 'XMLPEN 3';

public const STATUS_DOMAIN_TRANSFERRED = 'XMLOK 17';

public const STATUS_DOMAIN_TRANSFERRED_ALTERNATIVE = 'XMLOK 76';

public const STATUS_DOMAIN_TRANSFER_PENDING = 'XMLPEN 4';
public const STATUS_GLUES_UPDATED = 'XMLOK 142';

public const STATUS_DOMAIN_TRANSFER_INVALID_EPP = 'XMLERR 64';
public const STATUS_TLDS_RETRIEVED = 'XMLOK 46';

public const STATUS_DOMAIN_TRANSFER_UNABLE_LOCK = 'XMLERR 66';
public const STATUS_DNSSEC_RETRIEVED = 'XMLOK 80';

public const STATUS_DNSSEC_ADDED = 'XMLOK 82';

public const STATUS_DNSSEC_DELETED = 'XMLOK 81';

public const STATUS_SSL_RETRIEVED = 'XMLOK 115';

public const STATUS_SSL_PRODUCTS_RETRIEVED = 'XMLOK 118';

public const STATUS_DOMAIN_REGISTER_REQUESTED = 'XMLPEN 1';

public const STATUS_DOMAIN_TRANSFER_REQUESTED = 'XMLPEN 3';

public const STATUS_DOMAIN_TRANSFER_PENDING = 'XMLPEN 4';

public const STATUS_DOMAIN_DELETED = 'XMLPEN 11';

public const STATUS_DOMAIN_RESTORED = 'XMLPEN 12';

public const STATUS_GLUES_UPDATED = 'XMLOK 142';
public const STATUS_INVALID_CREDENTIALS = 'XMLERR 1';

public const STATUS_TLDS_RETRIEVED = 'XMLOK 46';
public const STATUS_INVALID_ADMIN_IDENTITY = 'XMLERR 11';

public const STATUS_DNSSEC_RETRIEVED = 'XMLOK 80';
public const STATUS_INVALID_TECH_IDENTITY = 'XMLERR 12';

public const STATUS_DNSSEC_ADDED = 'XMLOK 82';
public const STATUS_INVALID_BILLING_IDENTITY = 'XMLERR 13';

public const STATUS_DNSSEC_DELETED = 'XMLOK 81';
public const STATUS_INVALID_REGISTRANT_IDENTITY = 'XMLERR 14';

public const STATUS_INVALID_NAME_SERVER_GROUP = 'XMLERR 15';

public const STATUS_DOMAIN_NOT_MUTATABLE = 'XMLERR 19';

public const STATUS_DOMAIN_NOT_IN_ADMINISTRATION = 'XMLERR 24';

public const STATUS_INSUFFICIENT_FUNDS = 'XMLERR 87';
public const STATUS_DOMAIN_TRANSFER_INVALID_EPP = 'XMLERR 64';

public const STATUS_SSL_RETRIEVED = 'XMLOK 115';
public const STATUS_DOMAIN_TRANSFER_UNABLE_LOCK = 'XMLERR 66';

public const STATUS_SSL_PRODUCTS_RETRIEVED = 'XMLOK 118';
public const STATUS_INSUFFICIENT_FUNDS = 'XMLERR 87';
}
21 changes: 11 additions & 10 deletions src/Oxxa.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace Cyberfusion\Oxxa;

use Cyberfusion\Oxxa\Contracts\OxxaClient;
use Cyberfusion\Oxxa\Enum\StatusCode;
use Cyberfusion\Oxxa\Exceptions\OxxaException;
use Illuminate\Http\Client\Factory;
use Illuminate\Http\Client\PendingRequest;
Expand All @@ -14,7 +15,7 @@ class Oxxa implements OxxaClient
{
private const TIMEOUT = 180;

private const VERSION = '2.5.0';
private const VERSION = '2.5.1';

private const USER_AGENT = 'oxxa-api-client/'.self::VERSION;

Expand Down Expand Up @@ -109,23 +110,23 @@ private function checkStatus(Crawler $crawler): void

$statusCode = $status->text();
switch ($statusCode) {
case 'XMLERR 1':
case StatusCode::STATUS_INVALID_CREDENTIALS:
throw OxxaException::invalidCredentials($statusCode);
case 'XMLERR 24':
case StatusCode::STATUS_DOMAIN_NOT_IN_ADMINISTRATION:
throw OxxaException::restrictedDomain($statusCode);
case 'XMLERR 87':
case StatusCode::STATUS_INSUFFICIENT_FUNDS:
throw OxxaException::insufficientFunds($statusCode);
case 'XMLERR 11':
case StatusCode::STATUS_INVALID_ADMIN_IDENTITY:
throw OxxaException::invalidAdminIdentity($statusCode);
case 'XMLERR 12':
case StatusCode::STATUS_INVALID_TECH_IDENTITY:
throw OxxaException::invalidTechIdentity($statusCode);
case 'XMLERR 13':
case StatusCode::STATUS_INVALID_BILLING_IDENTITY:
throw OxxaException::invalidBillingIdentity($statusCode);
case 'XMLERR 14':
case StatusCode::STATUS_INVALID_REGISTRANT_IDENTITY:
throw OxxaException::invalidRegistrantIdentity($statusCode);
case 'XMLERR 15':
case StatusCode::STATUS_INVALID_NAME_SERVER_GROUP:
throw OxxaException::invalidNameServerGroup($statusCode);
case 'XMLERR 19':
case StatusCode::STATUS_DOMAIN_NOT_MUTATABLE:
throw OxxaException::domainTaken($statusCode);
}
}
Expand Down
Loading