File: D:/HostingSpaces/SBogers10/blije-gasten.komma.pro/app/Komma/Shop/Vat/VatServiceInterface.php
<?php declare(strict_types=1);
namespace App\Komma\Shop\Vat;
use App\Komma\Shop\Orders\Models\Order;
use App\Komma\Shop\Products\ProductableInterface;
use App\Komma\Shop\Vat\Models\Rate;
use App\Komma\Sites\Models\Site;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Collection as DatabaseCollection;
use Illuminate\Database\Eloquent\Model;
/**
* Class KmsUserService
*
* @package App\Komma\Users\Kms
*/
interface VatServiceInterface
{
/**
* This method will save an model
*
* @param $model Model or null
* @param DatabaseCollection $sectionTabItems These must be filled with data. This is something you need to do yourself.
*
* @return mixed
*/
public function saveModel(Model $model = null, DatabaseCollection $sectionTabItems): Model;
/**
* Calculates the orders vat amount for the current site and the total order price including vat.
* It fills the vat_amount and total_price (including vat) of an order.
*
* @param $order
*/
public function calculateOrderVatTotal(Order $order);
/**
* Returns the vat rate for the current site
*
* @return Rate
*/
public function getVatRate(): Rate;
/**
* Gets the vat rates for a certain site or the current one if your don't specify it.
*
* @param Site|null $site
* @return Builder
*/
public function vatRatesForSite(Site $site = null): Builder;
/**
* @param ProductableInterface $productable
* @return ProductableInterface
*/
public function calculateVatForProductable(ProductableInterface $productable);
/**
* Receives a price in cents and returns the price in cents including vat.
*
* @param float $exPriceInCents
* @param Rate|null $rate If you dont specify it, a default vat rate will be used.
* @return int The price including vat. The decimals represent fractions of cents.
*/
public function calculateIncVatRatePrice(float $exPriceInCents, Rate $rate = null): int;
/**
* Receives a price in cents, that includes a given vat amount,
* and returns the price in cents without vat.
*
* @param float $incPriceInCents
* @param Rate|null $rate If you dont specify it, a default vat rate will be used.
* @return int The price excluding vat.
*/
public function calculateExVatRatePrice(float $incPriceInCents, Rate $rate = null): int;
/**
* Calculates the total amount of vat in cents for a certain given amount in cents.
* Warning! Rounds fractions of cents according to a rule in a config file.
*
* @param float $amount
* @param Rate|null $rate If you dont specify it, a default vat rate will be used.
* @return int
*/
public function calculateVatRateAmountFromExAmount(float $amount, Rate $rate = null): int;
/**
* Receives a price in cents, that includes a given vat amount, and returns the amount of vat in cents.
* @param float $incPriceInCents
* @param Rate|null $rate If you dont specify it, a default vat rate will be used.
* @return int
*/
public function calculateVatRateAmountFromIncAmount(float $incPriceInCents, Rate $rate = null): int;
}