-
Notifications
You must be signed in to change notification settings - Fork 5
Open
Milestone
Description
Represent all pricing values as Money from Blesta\Money.
Example usage:
$fiveDollars = new Money(500, new Currency('USD'));
$fiveDollars = Money::fromString('5.00', 'USD'); // or this
$fiveDollars = Money::fromString('5.00', new Currency('USD')); // or this
$price = new UnitPrice($fiveDollars, 2);
$price-->setDescription('2 x 5.00');
$unit_price = $price->price(); // Money
$qty = $price->qty(); // 2
$tenDollars = $price->total(); // Money
$tenDollars->getConvertedAmount(); // 10.00
echo $tenDollars; // 10.00Any value that supports float should support Money, and convert to Money internally if provided with float. Should use the XXX currency code (which denotes no currency), where the precision is out to 4 decimal places. For example:
$price = new UnitPrice(5.00, 2);
$price->price(); // Money 5.0000 XXX
$price->total(); // Money 10.0000 XXXReactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels