feat(billing): renewals, coupons, VAT numbering, billing cycles and invoice payment tracking
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 5.5
parent
ea9a53f742
commit
25f23d541e
@@ -2,6 +2,8 @@
|
||||
|
||||
namespace App\Enums\Product;
|
||||
|
||||
use App\Support\BillingCycleCatalog;
|
||||
|
||||
enum ProductBillingCycle: string
|
||||
{
|
||||
case ONE_TIME = 'onetime';
|
||||
@@ -40,14 +42,16 @@ enum ProductBillingCycle: string
|
||||
|
||||
public static function vietnameseLabelFor(?string $code): string
|
||||
{
|
||||
return self::tryFrom((string) $code)?->vietnameseLabel() ?? ($code ?: 'N/A');
|
||||
return self::tryFrom((string) $code)?->vietnameseLabel()
|
||||
?? BillingCycleCatalog::labelForCode($code)
|
||||
?? ($code ?: 'N/A');
|
||||
}
|
||||
|
||||
public static function vietnameseLabelForMonths(int $months): string
|
||||
{
|
||||
$cycle = collect(self::cases())->first(fn (self $case) => $case->months() === $months && $months > 0);
|
||||
|
||||
return $cycle?->vietnameseLabel() ?? $months . ' tháng';
|
||||
return $cycle?->vietnameseLabel() ?? BillingCycleCatalog::labelForMonths($months);
|
||||
}
|
||||
|
||||
public function months(): int
|
||||
|
||||
Reference in New Issue
Block a user