Add feature tests for domain order management
- Implement AdminDomainOrderTest to cover admin functionalities for domain orders including listing, confirming registration, KYC updates, activation, rejection, and refunds. - Implement ClientDomainOrderTest to cover client functionalities for placing domain orders, including validation for balance, duplicate orders, and domain normalization. - Ensure proper handling of domain pricing and service statuses throughout the tests.
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
namespace App\Enums\Domain;
|
||||
|
||||
enum DomainProvisioningStatus: string
|
||||
{
|
||||
case PENDING = 'pending';
|
||||
case REGISTRAR_CREATED = 'registrar_created';
|
||||
case PENDING_KYC = 'pending_kyc';
|
||||
case ACTIVE = 'active';
|
||||
case CANCELLED = 'cancelled';
|
||||
case REFUNDED = 'refunded';
|
||||
|
||||
public function label(): string
|
||||
{
|
||||
return match ($this) {
|
||||
self::PENDING => 'Chờ xử lý',
|
||||
self::REGISTRAR_CREATED => 'Đã tạo tại nhà đăng ký',
|
||||
self::PENDING_KYC => 'Chờ xác minh KYC',
|
||||
self::ACTIVE => 'Đang hoạt động',
|
||||
self::CANCELLED => 'Đã hủy',
|
||||
self::REFUNDED => 'Đã hoàn tiền',
|
||||
};
|
||||
}
|
||||
|
||||
/** Valid forward transitions. */
|
||||
public function canTransitionTo(self $next): bool
|
||||
{
|
||||
return match ($this) {
|
||||
self::PENDING => in_array($next, [self::REGISTRAR_CREATED, self::PENDING_KYC, self::REFUNDED]),
|
||||
self::REGISTRAR_CREATED => in_array($next, [self::PENDING_KYC, self::ACTIVE, self::CANCELLED]),
|
||||
self::PENDING_KYC => in_array($next, [self::ACTIVE, self::CANCELLED]),
|
||||
self::ACTIVE => in_array($next, [self::CANCELLED]),
|
||||
self::CANCELLED,
|
||||
self::REFUNDED => false,
|
||||
};
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user