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,7 @@
|
||||
|
||||
namespace App\Http\Resources\Api\Admin;
|
||||
|
||||
use App\Support\BillingCycleCatalog;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
@@ -37,6 +38,8 @@ class ProductResource extends JsonResource
|
||||
'bandwidth' => $this->bandwidth,
|
||||
'domain_count' => $this->domain_count,
|
||||
'features' => $this->features,
|
||||
'short_description' => $this->short_description,
|
||||
'description' => $this->description,
|
||||
'setup_fee' => $this->setup_fee,
|
||||
'min_price' => $minPrice,
|
||||
'billing_type' => $this->whenLoaded('pricings', function () {
|
||||
@@ -52,6 +55,9 @@ class ProductResource extends JsonResource
|
||||
'price_annually' => $this->whenLoaded('pricings', fn () => optional($this->pricings->firstWhere('billing_cycle', 'annually'))->price),
|
||||
'price_biennially' => $this->whenLoaded('pricings', fn () => optional($this->pricings->firstWhere('billing_cycle', 'biennially'))->price),
|
||||
'price_triennially' => $this->whenLoaded('pricings', fn () => optional($this->pricings->firstWhere('billing_cycle', 'triennially'))->price),
|
||||
'custom_prices' => $this->whenLoaded('pricings', fn () => $this->pricings
|
||||
->filter(fn ($pricing) => str_starts_with((string) $pricing->billing_cycle, BillingCycleCatalog::CODE_PREFIX))
|
||||
->mapWithKeys(fn ($pricing) => [$pricing->billing_cycle => $pricing->price])),
|
||||
'price_onetime' => $this->whenLoaded('pricings', fn () => optional($this->pricings->first(fn ($pricing) => in_array($pricing->billing_cycle, ['onetime', 'one_time'], true)))->price),
|
||||
'is_active' => $this->is_active,
|
||||
'created_at' => $this->created_at,
|
||||
|
||||
Reference in New Issue
Block a user