File: D:/HostingSpaces/SBogers10/shop.komma.nl/app/Discounts/DiscountServiceInterface.php
<?php
namespace App\Discounts;
use App\Products\Product\Product;
use Illuminate\Support\Collection;
/**
* Class DiscountService
*
* Can add discount to discountables
*
* @see DiscountableInterface
* @package App\Discounts
*/
interface DiscountServiceInterface
{
/**
* Applies discounts if needed to the Discountable given
*
* @param DiscountableInterface $discountable
* @return DiscountServiceInterface
*/
public function updateDiscounts(DiscountableInterface $discountable): DiscountServiceInterface;
/**
* Exchanges a coupon code into a discount. Returns true if the coupon code can be applied. false if not
* @param string $couponCode
* @param DiscountableInterface $discountable
*/
public function applyCouponCode(string $couponCode, DiscountableInterface $discountable): void;
/**
* Checks if the coupon code can be applied
*
* @param string $couponCode
* @param DiscountableInterface $discountable
* @return bool
*/
public function checkIfCouponCodeCanBeApplied(string $couponCode, DiscountableInterface $discountable):bool;
/**
* Loop over a collection of DiscountModel items and insert the correct discount condition in it
*
* @param Collection $discounts
* @return Collection
*/
public function insertDiscountConditionAndActionsIfNotInsertedAlready(Collection $discounts): Collection;
/**
* Creates, updates, deletes the quantity discount for a specific discountable. Currently we only support product instances
*
* @param Product $discountable //TODO this may also be a ProductGroup and ProductComposite i think! Maybe we need to invent an interface to group all of them
* @param null $quantity
* @param null $quantityPrice
*/
public function manageQuantityDiscountForASpecificProductable(Product $discountable, $quantity = null, $quantityPrice = null);
/**
* Gets the quantity discount for a specific discountable. Currently we only support product instances
*
* @param Product $discountable //TODO this may also be a ProductGroup and ProductComposite i think! Maybe we need to invent an interface to group all of them
* @return Discount|null
*/
public function getQuantityDiscountForASpecificDiscountable(Product $discountable): ?Discount;
}