Commit 00167799 authored by Thomas Bilk's avatar Thomas Bilk

put condition targets into constants

parent e87ffd6e
......@@ -317,8 +317,8 @@ class Cart implements Jsonable, \JsonSerializable, Arrayable{
throw new InvalidConditionException('Argument 1 must be an instance of \'Bnet\Cart\CartCondition\'');
// set target to cart if not set
$condition->setTarget($condition->getTarget() ?: 'cart');
if ($condition->getTarget() !== 'cart')
$condition->setTarget($condition->getTarget() ?: Condition::TARGET_CART);
if ($condition->getTarget() !== Condition::TARGET_CART)
throw new InvalidConditionException('target have to be cart for cart conditions');
$conditions = $this->getConditions();
......@@ -502,7 +502,7 @@ class Cart implements Jsonable, \JsonSerializable, Arrayable{
$condTotal = $this->getConditions($only_with_condition_type)->sum(function ($cond) use ($subTotal) {
/** @var Condition $cond */
return $cond->getTarget() === 'cart'
return $cond->getTarget() === Condition::TARGET_CART
? $cond->applyCondition($subTotal)
: 0;
});
......@@ -544,7 +544,7 @@ class Cart implements Jsonable, \JsonSerializable, Arrayable{
$condTotal = $cond->sum(function ($cond) use ($subTotal) {
/** @var Condition $cond */
return $cond->getTarget() === 'cart'
return $cond->getTarget() === Condition::TARGET_CART
? $cond->applyCondition($subTotal)
: 0;
});
......
......@@ -12,6 +12,10 @@ use Illuminate\Support\Collection;
*/
class Condition extends Collection {
const TARGET_CART = 'cart';
const TARGET_ITEM = 'item';
const TARGET_price = 'price';
/**
* List of validation rules for the condition
* @var array
......
......@@ -64,7 +64,7 @@ class CurrencyCart extends Cart {
$condTotal = $this->getConditions($only_with_condition_type)->sum(function ($cond) use ($subTotal) {
/** @var Condition $cond */
$price =$cond->getTarget() === 'cart'
$price =$cond->getTarget() === Condition::TARGET_CART
? $cond->applyCondition($subTotal)
: 0;
return $price instanceof Money
......@@ -106,9 +106,9 @@ class CurrencyCart extends Cart {
return $itemConditionTotal;
/** @var Money $condTotal */
$condTotal = $cond->reduce(function (Money $money = null, $cond) use ($subTotal) {
$condTotal = $cond->reduce(function ($carry, $cond) use ($subTotal) {
/** @var Condition $cond */
$price = $cond->getTarget() === 'cart'
$price = $cond->getTarget() === Condition::TARGET_CART
? $cond->applyCondition($subTotal->amount())
: 0;
......@@ -116,11 +116,12 @@ class CurrencyCart extends Cart {
if (!$price instanceof Money)
$price = new Money((int)$price, $this->currency);
if (!$money) // set the $money at the first run
return $money = $price;
/** @var Money $carry */
if (!$carry) // set the $money at the first run
return $carry = $price;
else
return $money->add($price);
});
return $carry->add($price);
}, null);
return $condTotal->add($itemConditionTotal);
}
......
......@@ -65,7 +65,7 @@ class CurrencyItem extends Item {
$condition_price = $this->conditions->sum(function ($condition) use ($originalPrice, $type) {
/** @var Condition $condition */
$price = ($condition && $condition->getTarget() === 'item'
$price = ($condition && $condition->getTarget() === Condition::TARGET_ITEM
&& (is_null($type) || $type == $condition->getType()))
? $condition->applyCondition($originalPrice)
: 0;
......@@ -88,7 +88,7 @@ class CurrencyItem extends Item {
$condition_price = $this->conditions->sum(function ($condition) use ($originalPrice, $type) {
/** @var Condition $condition */
$price = ($condition && $condition->getTarget() === 'item'
$price = ($condition && $condition->getTarget() === Condition::TARGET_ITEM
&& (is_null($type) || $type == $condition->getType()))
? $condition->applyConditionWithQuantity($originalPrice, $this->quantity)
: 0;
......
......@@ -84,7 +84,7 @@ class Item extends Collection {
$condition_price = $this->conditions->sum(function ($condition) use ($originalPrice, $type) {
/** @var Condition $condition */
return ($condition && $condition->getTarget() === 'item'
return ($condition && $condition->getTarget() === Condition::TARGET_ITEM
&& (is_null($type) || $type == $condition->getType()))
? $condition->applyCondition($originalPrice)
: 0;
......@@ -121,7 +121,7 @@ class Item extends Collection {
$condition_price = $this->conditions->sum(function ($condition) use ($originalPrice, $type) {
/** @var Condition $condition */
return ($condition && $condition->getTarget() === 'item'
return ($condition && $condition->getTarget() === Condition::TARGET_ITEM
&& (is_null($type) || $type == $condition->getType()))
? $condition->applyConditionWithQuantity($originalPrice, $this->quantity)
: 0;
......@@ -175,9 +175,9 @@ class Item extends Collection {
$condition = new Condition($condition);
// ignore target==cart conditions
if ($condition->getTarget() == 'cart')
if ($condition->getTarget() == Condition::TARGET_CART)
return false;
$condition->setTarget('item'); // set item as default it not set
$condition->setTarget(Condition::TARGET_ITEM); // set item as default it not set
return $condition;
})
......
......@@ -84,7 +84,7 @@ class CartConditionTest extends PHPUnit_Framework_TestCase {
$condition = new Condition(array(
'name' => 'VAT 12.5%',
'type' => 'tax',
'target' => 'cart',
'target' => Condition::TARGET_CART,
'value' => '12.5%',
));
......@@ -106,13 +106,13 @@ class CartConditionTest extends PHPUnit_Framework_TestCase {
$condition1 = new Condition(array(
'name' => 'VAT 12.5%',
'type' => 'tax',
'target' => 'cart',
'target' => Condition::TARGET_CART,
'value' => '12.5%',
));
$condition2 = new Condition(array(
'name' => 'Express Shipping $15',
'type' => 'shipping',
'target' => 'cart',
'target' => Condition::TARGET_CART,
'value' => '+1500',
));
......@@ -135,13 +135,13 @@ class CartConditionTest extends PHPUnit_Framework_TestCase {
$condition1 = new Condition(array(
'name' => 'VAT 12.5%',
'type' => 'tax',
'target' => 'cart',
'target' => Condition::TARGET_CART,
'value' => '12.5%',
));
$condition2 = new Condition(array(
'name' => 'Express Shipping $15',
'type' => 'shipping',
'target' => 'cart',
'target' => Condition::TARGET_CART,
'value' => '-1500',
));
......@@ -164,13 +164,13 @@ class CartConditionTest extends PHPUnit_Framework_TestCase {
$condition1 = new Condition(array(
'name' => 'VAT 12.5%',
'type' => 'tax',
'target' => 'cart',
'target' => Condition::TARGET_CART,
'value' => '-12.5%',
));
$condition2 = new Condition(array(
'name' => 'Express Shipping $15',
'type' => 'shipping',
'target' => 'cart',
'target' => Condition::TARGET_CART,
'value' => '-1500',
));
......@@ -193,13 +193,13 @@ class CartConditionTest extends PHPUnit_Framework_TestCase {
$condition1 = new Condition(array(
'name' => 'VAT 12.5%',
'type' => 'tax',
'target' => 'cart',
'target' => Condition::TARGET_CART,
'value' => '-12.5%',
));
$condition2 = new Condition(array(
'name' => 'Express Shipping $15',
'type' => 'shipping',
'target' => 'cart',
'target' => Condition::TARGET_CART,
'value' => '-1500',
));
......@@ -221,13 +221,13 @@ class CartConditionTest extends PHPUnit_Framework_TestCase {
$condition1 = new Condition(array(
'name' => 'COUPON LESS 12.5%',
'type' => 'tax',
'target' => 'cart',
'target' => Condition::TARGET_CART,
'value' => '-12.5%',
));
$condition2 = new Condition(array(
'name' => 'Express Shipping $15',
'type' => 'shipping',
'target' => 'cart',
'target' => Condition::TARGET_CART,
'value' => '+1500',
));
......@@ -270,19 +270,19 @@ class CartConditionTest extends PHPUnit_Framework_TestCase {
$itemCondition1 = new Condition(array(
'name' => 'SALE 5%',
'type' => 'sale',
'target' => 'item',
'target' => Condition::TARGET_ITEM,
'value' => '-5%',
));
$itemCondition2 = new Condition(array(
'name' => 'Item Gift Pack 2500',
'type' => 'promo',
'target' => 'item',
'target' => Condition::TARGET_ITEM,
'value' => '-2500',
));
$itemCondition3 = new Condition(array(
'name' => 'MISC',
'type' => 'misc',
'target' => 'item',
'target' => Condition::TARGET_ITEM,
'value' => '+1000',
));
......@@ -327,25 +327,25 @@ class CartConditionTest extends PHPUnit_Framework_TestCase {
$itemCondition1 = new Condition(array(
'name' => 'SALE 5%',
'type' => 'sale',
'target' => 'cart',
'target' => Condition::TARGET_CART,
'value' => '-5%',
)); // --> this should not be included in calculation
$itemCondition2 = new Condition(array(
'name' => 'Item Gift Pack 2500',
'type' => 'promo',
'target' => 'item',
'target' => Condition::TARGET_ITEM,
'value' => '-2500',
));
$itemCondition3 = new Condition(array(
'name' => 'MISC',
'type' => 'misc',
'target' => 'item',
'target' => Condition::TARGET_ITEM,
'value' => '+1000',
));
$itemCondition4 = new Condition(array(
'name' => 'MISC 2',
'type' => 'misc2',
'target' => 'cart',
'target' => Condition::TARGET_CART,
'value' => '+10%',
));// --> this should not be included in calculation
......@@ -374,13 +374,13 @@ class CartConditionTest extends PHPUnit_Framework_TestCase {
$itemCondition2 = new Condition(array(
'name' => 'Item Gift Pack 2500',
'type' => 'promo',
'target' => 'item',
'target' => Condition::TARGET_ITEM,
'value' => '-2500',
));
$coupon101 = new Condition(array(
'name' => 'COUPON 101',
'type' => 'coupon',
'target' => 'item',
'target' => Condition::TARGET_ITEM,
'value' => '-5%',
));
......@@ -408,7 +408,7 @@ class CartConditionTest extends PHPUnit_Framework_TestCase {
$condition = new Condition([
'name' => 'Substract amount but prevent negative value',
'type' => 'promo',
'target' => 'item',
'target' => Condition::TARGET_ITEM,
'value' => '-2500',
]);
......@@ -434,13 +434,13 @@ class CartConditionTest extends PHPUnit_Framework_TestCase {
$itemCondition1 = new Condition(array(
'name' => 'SALE 5%',
'type' => 'sale',
'target' => 'cart',
'target' => Condition::TARGET_CART,
'value' => '-5%',
));
$itemCondition2 = new Condition(array(
'name' => 'Item Gift Pack 2500',
'type' => 'promo',
'target' => 'cart',
'target' => Condition::TARGET_CART,
'value' => '-2500',
));
......@@ -460,7 +460,7 @@ class CartConditionTest extends PHPUnit_Framework_TestCase {
$condition = $this->cart->getCondition($itemCondition1->getName());
$this->assertEquals($condition->getName(), 'SALE 5%');
$this->assertEquals($condition->getTarget(), 'cart');
$this->assertEquals($condition->getTarget(), Condition::TARGET_CART);
$this->assertEquals($condition->getType(), 'sale');
$this->assertEquals($condition->getValue(), '-5%');
}
......@@ -469,13 +469,13 @@ class CartConditionTest extends PHPUnit_Framework_TestCase {
$itemCondition1 = new Condition(array(
'name' => 'SALE 5%',
'type' => 'sale',
'target' => 'cart',
'target' => Condition::TARGET_CART,
'value' => '-5%',
));
$itemCondition2 = new Condition(array(
'name' => 'Item Gift Pack 2500',
'type' => 'promo',
'target' => 'cart',
'target' => Condition::TARGET_CART,
'value' => '-2500',
));
......@@ -506,13 +506,13 @@ class CartConditionTest extends PHPUnit_Framework_TestCase {
$itemCondition1 = new Condition(array(
'name' => 'SALE 5%',
'type' => 'sale',
'target' => 'item',
'target' => Condition::TARGET_ITEM,
'value' => '-5%',
));
$itemCondition2 = new Condition(array(
'name' => 'Item Gift Pack 2500',
'type' => 'promo',
'target' => 'item',
'target' => Condition::TARGET_ITEM,
'value' => '-2500',
));
......@@ -543,7 +543,7 @@ class CartConditionTest extends PHPUnit_Framework_TestCase {
$itemCondition = new Condition(array(
'name' => 'SALE 5%',
'type' => 'sale',
'target' => 'item',
'target' => Condition::TARGET_ITEM,
'value' => '-5%',
));
......@@ -572,13 +572,13 @@ class CartConditionTest extends PHPUnit_Framework_TestCase {
$itemCondition1 = new Condition(array(
'name' => 'SALE 5%',
'type' => 'sale',
'target' => 'item',
'target' => Condition::TARGET_ITEM,
'value' => '-5%',
));
$itemCondition2 = new Condition(array(
'name' => 'Item Gift Pack 2500',
'type' => 'promo',
'target' => 'item',
'target' => Condition::TARGET_ITEM,
'value' => '-2500',
));
......@@ -611,13 +611,13 @@ class CartConditionTest extends PHPUnit_Framework_TestCase {
$itemCondition1 = new Condition(array(
'name' => 'SALE 5%',
'type' => 'sale',
'target' => 'cart',
'target' => Condition::TARGET_CART,
'value' => '-5%',
));
$itemCondition2 = new Condition(array(
'name' => 'Item Gift Pack 2500',
'type' => 'promo',
'target' => 'cart',
'target' => Condition::TARGET_CART,
'value' => '-2500',
));
......@@ -647,13 +647,13 @@ class CartConditionTest extends PHPUnit_Framework_TestCase {
$cartCondition1 = new Condition(array(
'name' => 'SALE 5%',
'type' => 'sale',
'target' => 'cart',
'target' => Condition::TARGET_CART,
'value' => '-5%',
));
$cartCondition2 = new Condition(array(
'name' => 'Item Gift Pack 2500',
'type' => 'promo',
'target' => 'cart',
'target' => Condition::TARGET_CART,
'value' => '-25',
));
......@@ -689,19 +689,19 @@ class CartConditionTest extends PHPUnit_Framework_TestCase {
$cartCondition1 = new Condition(array(
'name' => 'SALE 5%',
'type' => 'sale',
'target' => 'cart',
'target' => Condition::TARGET_CART,
'value' => '-5%',
));
$cartCondition2 = new Condition(array(
'name' => 'Item Gift Pack 2500',
'type' => 'promo',
'target' => 'cart',
'target' => Condition::TARGET_CART,
'value' => '-2500',
));
$cartCondition3 = new Condition(array(
'name' => 'Item Less 8%',
'type' => 'promo',
'target' => 'cart',
'target' => Condition::TARGET_CART,
'value' => '-8%',
));
......@@ -735,19 +735,19 @@ class CartConditionTest extends PHPUnit_Framework_TestCase {
$cartCondition1 = new Condition(array(
'name' => 'SALE 5%',
'type' => 'sale',
'target' => 'cart',
'target' => Condition::TARGET_CART,
'value' => '-5%',
));
$cartCondition2 = new Condition(array(
'name' => 'Item Gift Pack 20',
'type' => 'promo',
'target' => 'cart',
'target' => Condition::TARGET_CART,
'value' => '-2500',
));
$cartCondition3 = new Condition(array(
'name' => 'Item Less 8%',
'type' => 'promo',
'target' => 'cart',
'target' => Condition::TARGET_CART,
'value' => '-8%',
));
......@@ -773,7 +773,7 @@ class CartConditionTest extends PHPUnit_Framework_TestCase {
$cartCondition1 = new Condition(array(
'name' => 'SALE 5%',
'type' => 'sale',
'target' => 'cart',
'target' => Condition::TARGET_CART,
'value' => '-5%'
));
......@@ -803,7 +803,7 @@ class CartConditionTest extends PHPUnit_Framework_TestCase {
$cartCondition1 = new Condition(array(
'name' => 'SALE 5%',
'type' => 'sale',
'target' => 'cart',
'target' => Condition::TARGET_CART,
'value' => '-5%',
'attributes' => array(
'description' => 'october fest promo sale',
......@@ -845,28 +845,28 @@ class CartConditionTest extends PHPUnit_Framework_TestCase {
$itemCondition = new Condition(array(
'name' => 'Test Fix 500',
'type' => 'sale',
'target' => 'item',
'target' => Condition::TARGET_ITEM,
'quantity_independent' => true,
'value' => '500'
));
$itemCondition1 = new Condition(array(
'name' => 'Test 10%',
'type' => 'sale',
'target' => 'item',
'target' => Condition::TARGET_ITEM,
'quantity_independent' => true,
'value' => '+10%'
));
$itemCondition2 = new Condition(array(
'name' => 'Test 10% per Item',
'type' => 'sale',
'target' => 'item',
'target' => Condition::TARGET_ITEM,
'quantity_independent' => false,
'value' => '+10%'
));
$itemCondition3 = new Condition(array(
'name' => 'Test Fix 250',
'type' => 'sale',
'target' => 'item',
'target' => Condition::TARGET_ITEM,
'quantity_independent' => false,
'value' => '250'
));
......@@ -916,14 +916,14 @@ class CartConditionTest extends PHPUnit_Framework_TestCase {
$itemCondition = new Condition(array(
'name' => 'Test1',
'type' => 'sale',
'target' => 'item',
'target' => Condition::TARGET_ITEM,
'quantity_independent' => true,
'value' => '500'
));
$itemCondition1 = new Condition(array(
'name' => 'Test1',
'type' => 'sale',
'target' => 'item',
'target' => Condition::TARGET_ITEM,
'quantity_independent' => true,
'value' => '500'
));
......
......@@ -536,7 +536,7 @@ class CartTest extends PHPUnit_Framework_TestCase {
$itemCondition = new Condition(array(
'name' => 'SALE 5%',
'type' => 'tax',
'target' => 'item',
'target' => Condition::TARGET_ITEM,
'value' => '-5%',
));
$items = [
......@@ -564,7 +564,7 @@ class CartTest extends PHPUnit_Framework_TestCase {
$condition = new Condition(array(
'name' => 'VAT 12.5%',
'type' => 'tax',
'target' => 'cart',
'target' => Condition::TARGET_CART,
'value' => '12.5%',
));
......@@ -574,7 +574,7 @@ class CartTest extends PHPUnit_Framework_TestCase {
'SALE 5%' => [
'name' => 'SALE 5%',
'type' => 'tax',
'target' => 'item',
'target' => Condition::TARGET_ITEM,
'value' => '-5%',
]
];
......@@ -603,7 +603,7 @@ class CartTest extends PHPUnit_Framework_TestCase {
'VAT 12.5%' => [
'name' => 'VAT 12.5%',
'type' => 'tax',
'target' => 'cart',
'target' => Condition::TARGET_CART,
'value' => '12.5%',
]
]
......
......@@ -86,7 +86,7 @@ class CurrencyCartConditionTest extends PHPUnit_Framework_TestCase {
$condition = new Condition(array(
'name' => 'VAT 12.5%',
'type' => 'tax',
'target' => 'cart',
'target' => Condition::TARGET_CART,
'value' => '12.5%',
));
......@@ -101,6 +101,49 @@ class CurrencyCartConditionTest extends PHPUnit_Framework_TestCase {
$this->assertEquals(2344, $this->cart->totalOnlyConditions()->amount());
}
/**
* @throws \Bnet\Cart\Exceptions\InvalidConditionException
*/
public function test_total_with_more_conditions() {
$this->fillCart();
$this->assertEquals(18749, $this->cart->subTotal()->amount(), 'Cart should have sub total of 18749');
// add condition
$condition = new Condition(array(
'name' => 'VAT 12.5%',
'type' => 'tax',
'target' => Condition::TARGET_CART,
'value' => '12.5%',
));
$this->cart->condition($condition);
// no changes in subtotal as the condition's target added was for total
$this->assertEquals(18749, $this->cart->subTotal()->amount(), 'Cart should have sub total of 18749');
// total should be changed
$this->assertEquals(21093, $this->cart->total()->amount(), 'Cart should have a total of 21093');
$this->assertEquals(2344, $this->cart->totalOnlyConditions()->amount());
$discount = new Condition([
'name' => 'Discount',
'type' => 'discount',
'target' => Condition::TARGET_CART,
'value' => '-500',
]);
$this->cart->condition($discount);
// no changes in subtotal as the condition's target added was for total
$this->assertEquals(18749, $this->cart->subTotal()->amount(), 'Cart should have sub total of 18749');
// total should be changed
$this->assertEquals(20593, $this->cart->total()->amount(), 'Cart should have a total of 21093');
$this->assertEquals(1844, $this->cart->totalOnlyConditions()->amount());
}
public function test_total_with_multiple_conditions_added_scenario_one() {
$this->fillCart();
......@@ -110,13 +153,13 @@ class CurrencyCartConditionTest extends PHPUnit_Framework_TestCase {
$condition1 = new Condition(array(
'name' => 'VAT 12.5%',
'type' => 'tax',
'target' => 'cart',
'target' => Condition::TARGET_CART,
'value' => '12.5%',
));
$condition2 = new Condition(array(
'name' => 'Express Shipping $15',
'type' => 'shipping',
'target' => 'cart',
'target' => Condition::TARGET_CART,
'value' => '+1500',
));
......@@ -139,13 +182,13 @@ class CurrencyCartConditionTest extends PHPUnit_Framework_TestCase {
$condition1 = new Condition(array(
'name' => 'VAT 12.5%',
'type' => 'tax',
'target' => 'cart',
'target' => Condition::TARGET_CART,
'value' => '12.5%',
));
$condition2 = new Condition(array(
'name' => 'Express Shipping $15',
'type' => 'shipping',
'target' => 'cart',
'target' => Condition::TARGET_CART,
'value' => '-1500',
));
......@@ -168,13 +211,13 @@ class CurrencyCartConditionTest extends PHPUnit_Framework_TestCase {
$condition1 = new Condition(array(
'name' => 'VAT 12.5%',
'type' => 'tax',
'target' => 'cart',
'target' => Condition::TARGET_CART,
'value' => '-12.5%',
));
$condition2 = new Condition(array(
'name' => 'Express Shipping $15',
'type' => 'shipping',
'target' => 'cart',
'target' => Condition::TARGET_CART,
'value' => '-1500',
));
......@@ -197,13 +240,13 @@ class CurrencyCartConditionTest extends PHPUnit_Framework_TestCase {
$condition1 = new Condition(array(
'name' => 'VAT 12.5%',
'type' => 'tax',
'target' => 'cart',
'target' => Condition::TARGET_CART,
'value' => '-12.5%',
));
$condition2 = new Condition(array(
'name' => 'Express Shipping $15',
'type' => 'shipping',
'target' => 'cart',
'target' => Condition::TARGET_CART,
'value' => '-1500',
));
......@@ -225,13 +268,13 @@ class CurrencyCartConditionTest extends PHPUnit_Framework_TestCase {
$condition1 = new Condition(array(
'name' => 'COUPON LESS 12.5%',
'type' => 'tax',
'target' => 'cart',
'target' => Condition::TARGET_CART,
'value' => '-12.5%',
));
$condition2 = new Condition(array(
'name' => 'Express Shipping $15',
'type' => 'shipping',
'target' => 'cart',
'target' => Condition::TARGET_CART,
'value' => '+1500',
));
......@@ -249,7 +292,7 @@ class CurrencyCartConditionTest extends PHPUnit_Framework_TestCase {
$condition1 = new Condition(array(
'name' => 'SALE 5%',
'type' => 'tax',
'target' => 'item',
'target' => Condition::TARGET_ITEM,
'value' => '-5%',
));
......@@ -272,19 +315,19 @@ class CurrencyCartConditionTest extends PHPUnit_Framework_TestCase {
$itemCondition1 = new Condition(array(
'name' => 'SALE 5%',
'type' => 'sale',
'target' => 'item',
'target' => Condition::TARGET_ITEM,
'value' => '-5%',
));
$itemCondition2 = new Condition(array(
'name' => 'Item Gift Pack 2500',
'type' => 'promo',
'target' => 'item',
'target' => Condition::TARGET_ITEM,
'value' => '-2500',
));
$itemCondition3 = new Condition(array(
'name' => 'MISC',
'type' => 'misc',
'target' => 'item',
'target' => Condition::TARGET_ITEM,
'value' => '+1000',
));
......@@ -313,25 +356,25 @@ class CurrencyCartConditionTest extends PHPUnit_Framework_TestCase {
$itemCondition1 = new Condition(array(
'name' => 'SALE 5%',
'type' => 'sale',
'target' => 'cart',
'target' => Condition::TARGET_CART,
'value' => '-5%',
)); // --> this should not be included in calculation
$itemCondition2 = new Condition(array(
'name' => 'Item Gift Pack 2500',
'type' => 'promo',
'target' => 'item',
'target' => Condition::TARGET_ITEM,
'value' => '-2500',
));
$itemCondition3 = new Condition(array(
'name' => 'MISC',
'type' => 'misc',
'target' => 'item',
'target' => Condition::TARGET_ITEM,
'value' => '+1000',