WIP Coupon
RemoveXPercent and RemoveXAmount implementation
This commit is contained in:
@@ -23,6 +23,8 @@
|
||||
|
||||
namespace Thelia\Coupon;
|
||||
|
||||
use Symfony\Component\Intl\Exception\NotImplementedException;
|
||||
|
||||
/**
|
||||
* Created by JetBrains PhpStorm.
|
||||
* Date: 8/19/13
|
||||
@@ -36,9 +38,57 @@ namespace Thelia\Coupon;
|
||||
*/
|
||||
abstract class CouponAbstract implements CouponInterface
|
||||
{
|
||||
/** @var CouponAdapterInterface Provide necessary value from Thelia*/
|
||||
protected $adapter;
|
||||
|
||||
/** @var RuleOrganizerInterface */
|
||||
protected $organizer = null;
|
||||
|
||||
/** @var string Coupon code (ex: XMAS) */
|
||||
protected $code = null;
|
||||
|
||||
/** @var string Coupon title (ex: Coupon for XMAS) */
|
||||
protected $title = null;
|
||||
|
||||
/** @var string Coupon short description */
|
||||
protected $shortDescription = null;
|
||||
|
||||
/** @var string Coupon description */
|
||||
protected $description = null;
|
||||
|
||||
/** @var bool if Coupon is cumulative */
|
||||
protected $isCumulative = false;
|
||||
|
||||
/** @var bool if Coupon is removing postage */
|
||||
protected $isRemovingPostage = false;
|
||||
|
||||
/**
|
||||
* Set Adapter containing all relevant data
|
||||
*
|
||||
* @param CouponAdapterInterface $adapter Adapter
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setAdapter($adapter)
|
||||
{
|
||||
$this->adapter = $adapter;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Rule Organizer
|
||||
*
|
||||
* @param RuleOrganizerInterface $organizer Manage Rule groups (&& and ||)
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setOrganizer($organizer)
|
||||
{
|
||||
$this->organizer = $organizer;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return Coupon code (ex: XMAS)
|
||||
@@ -47,7 +97,7 @@ abstract class CouponAbstract implements CouponInterface
|
||||
*/
|
||||
public function getCode()
|
||||
{
|
||||
// TODO: Implement getCode() method.
|
||||
return $this->code;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -57,7 +107,7 @@ abstract class CouponAbstract implements CouponInterface
|
||||
*/
|
||||
public function getTitle()
|
||||
{
|
||||
// TODO: Implement getTitle() method.
|
||||
return $this->title;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -67,7 +117,7 @@ abstract class CouponAbstract implements CouponInterface
|
||||
*/
|
||||
public function getShortDescription()
|
||||
{
|
||||
// TODO: Implement getShortDescription() method.
|
||||
return $this->shortDescription;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -77,7 +127,7 @@ abstract class CouponAbstract implements CouponInterface
|
||||
*/
|
||||
public function getDescription()
|
||||
{
|
||||
// TODO: Implement getDescription() method.
|
||||
return $this->description;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -85,11 +135,11 @@ abstract class CouponAbstract implements CouponInterface
|
||||
* If is cumulative you can sum Coupon effects
|
||||
* If not cancel all other Coupon and take the last given
|
||||
*
|
||||
* @return string
|
||||
* @return bool
|
||||
*/
|
||||
public function isCumulative()
|
||||
{
|
||||
// TODO: Implement isCumulative() method.
|
||||
return $this->isCumulative;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -99,17 +149,20 @@ abstract class CouponAbstract implements CouponInterface
|
||||
*/
|
||||
public function isRemovingPostage()
|
||||
{
|
||||
// TODO: Implement isRemovingPostage() method.
|
||||
return $this->isRemovingPostage;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return effects generated by the coupon
|
||||
*
|
||||
* @throws \Symfony\Component\Intl\Exception\NotImplementedException
|
||||
* @return \Closure
|
||||
*/
|
||||
public function getEffect()
|
||||
{
|
||||
// TODO: Implement getEffect() method.
|
||||
throw new NotImplementedException(
|
||||
'Abstract method to implement (CouponAbstract->getEffect)'
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user