ProductPriceConversionService
in package
implements
ProductPriceConversionService
Class ProductPriceConversionService
Interfaces, Classes and Traits
- ProductPriceConversionService
- Interface ProductPriceConversionService
Table of Contents
- $isAdminGrossEnabled : bool
- $reader : ProductPriceConversionReader
- $taxes : array<string|int, mixed>
- __construct() : mixed
- getGrossPrice() : float
- Converts a given net price of a product to a gross price if the gross-admin configuration is activated for the Gambio Admin, otherwise it will return the net price unchanged.
- getNetPrice() : float
- Converts a given gross price of a product to a net price if the gross-admin configuration is deactivated for the Gambio Admin, otherwise it will return the gross price unchanged.
- calculateGross() : float
- calculateNet() : float
- formatPrice() : float
- getPrice() : float
- getProductTaxes() : array<string|int, mixed>
- isGrossAdminEnabled() : bool
Properties
$isAdminGrossEnabled
private
bool
$isAdminGrossEnabled
$reader
private
ProductPriceConversionReader
$reader
$taxes
private
array<string|int, mixed>
$taxes
= []
Methods
__construct()
public
__construct(ProductPriceConversionReader $reader) : mixed
Parameters
- $reader : ProductPriceConversionReader
Return values
mixed —getGrossPrice()
Converts a given net price of a product to a gross price if the gross-admin configuration is activated for the Gambio Admin, otherwise it will return the net price unchanged.
public
getGrossPrice(float $price, int $productId[, int $precision = 4 ]) : float
Parameters
- $price : float
-
net price needed to be converted to gross
- $productId : int
-
product ID to get related tax rates
- $precision : int = 4
-
for which decimal should the results be rounded up
Tags
Return values
float —getNetPrice()
Converts a given gross price of a product to a net price if the gross-admin configuration is deactivated for the Gambio Admin, otherwise it will return the gross price unchanged.
public
getNetPrice(float $price, int $productId[, int $precision = 4 ]) : float
Parameters
- $price : float
-
gross price needed to be converted to net
- $productId : int
-
product ID to get related tax rates
- $precision : int = 4
-
for which decimal should the results be rounded up
Tags
Return values
float —calculateGross()
private
calculateGross(float $net, float $percent) : float
Parameters
- $net : float
-
The price, excluding any surcharge
- $percent : float
-
surcharge percent
Return values
float —total price, including surcharge percent
calculateNet()
private
calculateNet(float $gross, float $percent) : float
Parameters
- $gross : float
-
The price, including all surcharges
- $percent : float
-
surcharge percent
Return values
float —net price, excluding any surcharge
formatPrice()
private
formatPrice(float $price, int $precision) : float
Parameters
- $price : float
- $precision : int
Return values
float —getPrice()
private
getPrice(float $price, int $productId, bool $calculateGross, int $precision) : float
Parameters
- $price : float
- $productId : int
- $calculateGross : bool
- $precision : int
Return values
float —getProductTaxes()
private
getProductTaxes(int $productId) : array<string|int, mixed>
Parameters
- $productId : int
Return values
array<string|int, mixed> —isGrossAdminEnabled()
private
isGrossAdminEnabled() : bool