feat: refactor cart and bundle handling to support Buyable interface for improved flexibility
This commit is contained in:
20
app/Domains/Shared/Contracts/Buyable.php
Normal file
20
app/Domains/Shared/Contracts/Buyable.php
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\Domains\Shared\Contracts;
|
||||
|
||||
interface Buyable
|
||||
{
|
||||
public function getPrice(): float;
|
||||
|
||||
public function getName(): string;
|
||||
|
||||
public function availableQuantity(): ?int;
|
||||
|
||||
public function reserveStock(int $amount): void;
|
||||
|
||||
public function decrementReservedStock(int $amount): void;
|
||||
|
||||
public function buy(int $amount): void;
|
||||
|
||||
public function validateStock(): void;
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Domains\Shared\Contracts;
|
||||
|
||||
interface Stockable
|
||||
{
|
||||
public function incrementRealStock(int $amount): void;
|
||||
public function decrementRealStock(int $amount): void;
|
||||
|
||||
public function incrementReservedStock(int $amount): void;
|
||||
public function decrementReservedStock(int $amount): void;
|
||||
public function confirmReservedStock(int $amount): void;
|
||||
|
||||
public function validateStock(): void;
|
||||
}
|
||||
Reference in New Issue
Block a user