Skip to content

Commit

Permalink
Merge pull request #515 from magento-fearless-kiwis/develop
Browse files Browse the repository at this point in the history
[FearlessKiwis] Sprint 52: Cart Price Rule API, Coupon API, Bug fixes
  • Loading branch information
Tang, Yu(ytang1) committed Aug 8, 2015
2 parents 2245842 + 7390c1b commit f93986f
Show file tree
Hide file tree
Showing 62 changed files with 6,382 additions and 160 deletions.
3 changes: 0 additions & 3 deletions app/code/Magento/Bundle/etc/adminhtml/di.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@
*/
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../lib/internal/Magento/Framework/ObjectManager/etc/config.xsd">
<type name="Magento\Quote\Model\Quote\Item\ToOrderItem">
<plugin name="append_bundle_data_to_order" type="Magento\Bundle\Model\Plugin\QuoteItem"/>
</type>
<type name="Magento\Catalog\Controller\Adminhtml\Product\Initialization\Helper">
<plugin name="Bundle" type="Magento\Bundle\Controller\Adminhtml\Product\Initialization\Helper\Plugin\Bundle" sortOrder="60" />
</type>
Expand Down
3 changes: 3 additions & 0 deletions app/code/Magento/Bundle/etc/di.xml
Original file line number Diff line number Diff line change
Expand Up @@ -99,4 +99,7 @@
</argument>
</arguments>
</type>
<type name="Magento\Quote\Model\Quote\Item\ToOrderItem">
<plugin name="append_bundle_data_to_order" type="Magento\Bundle\Model\Plugin\QuoteItem"/>
</type>
</config>
3 changes: 0 additions & 3 deletions app/code/Magento/Bundle/etc/frontend/di.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@
*/
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../lib/internal/Magento/Framework/ObjectManager/etc/config.xsd">
<type name="Magento\Quote\Model\Quote\Item\ToOrderItem">
<plugin name="append_bundle_data_to_order" type="Magento\Bundle\Model\Plugin\QuoteItem"/>
</type>
<type name="Magento\Catalog\Helper\Product\ConfigurationPool">
<arguments>
<argument name="instancesByType" xsi:type="array">
Expand Down
45 changes: 45 additions & 0 deletions app/code/Magento/SalesRule/Api/CouponManagementInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<?php
/**
* Copyright © 2015 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\SalesRule\Api;

/**
* Coupon management interface
*
* @api
*/
interface CouponManagementInterface
{
/**
* Generate coupon for a rule
*
* @param \Magento\SalesRule\Api\Data\CouponGenerationSpecInterface $couponSpec
* @return string[]
* @throws \Magento\Framework\Exception\LocalizedException
*/
public function generate(\Magento\SalesRule\Api\Data\CouponGenerationSpecInterface $couponSpec);

/**
* Delete coupon by coupon ids.
*
* @param int[] $ids
* @param bool $ignoreInvalidCoupons
* @return \Magento\SalesRule\Api\Data\CouponMassDeleteResultInterface
* @throws \Magento\Framework\Exception\NoSuchEntityException
* @throws \Magento\Framework\Exception\LocalizedException
*/
public function deleteByIds(array $ids, $ignoreInvalidCoupons = true);

/**
* Delete coupon by coupon codes.
*
* @param string[] $codes
* @param bool $ignoreInvalidCoupons
* @return \Magento\SalesRule\Api\Data\CouponMassDeleteResultInterface
* @throws \Magento\Framework\Exception\NoSuchEntityException
* @throws \Magento\Framework\Exception\LocalizedException
*/
public function deleteByCodes(array $codes, $ignoreInvalidCoupons = true);
}
54 changes: 54 additions & 0 deletions app/code/Magento/SalesRule/Api/CouponRepositoryInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
<?php
/**
* Copyright © 2015 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\SalesRule\Api;

/**
* Coupon CRUD interface
*
* @api
*/
interface CouponRepositoryInterface
{
/**
* Save coupon.
*
* @param \Magento\SalesRule\Api\Data\CouponInterface $coupon
* @return \Magento\SalesRule\Api\Data\CouponInterface
* @throws \Magento\Framework\Exception\InputException If there is a problem with the input
* @throws \Magento\Framework\Exception\NoSuchEntityException If a coupon ID is sent but the coupon does not exist
* @throws \Magento\Framework\Exception\LocalizedException
*/
public function save(\Magento\SalesRule\Api\Data\CouponInterface $coupon);

/**
* Get coupon by coupon id.
*
* @param int $couponId
* @return \Magento\SalesRule\Api\Data\CouponInterface
* @throws \Magento\Framework\Exception\NoSuchEntityException If $couponId is not found
* @throws \Magento\Framework\Exception\LocalizedException
*/
public function getById($couponId);

/**
* Retrieve coupon.
*
* @param \Magento\Framework\Api\SearchCriteriaInterface $searchCriteria
* @return \Magento\SalesRule\Api\Data\CouponSearchResultInterface
* @throws \Magento\Framework\Exception\LocalizedException
*/
public function getList(\Magento\Framework\Api\SearchCriteriaInterface $searchCriteria);

/**
* Delete coupon by coupon id.
*
* @param int $couponId
* @return bool true on success
* @throws \Magento\Framework\Exception\NoSuchEntityException
* @throws \Magento\Framework\Exception\LocalizedException
*/
public function deleteById($couponId);
}
123 changes: 123 additions & 0 deletions app/code/Magento/SalesRule/Api/Data/ConditionInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
<?php
/**
* Copyright © 2015 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\SalesRule\Api\Data;

/**
* Interface ConditionInterface
*
* @api
*/
interface ConditionInterface extends \Magento\Framework\Api\ExtensibleDataInterface
{
const AGGREGATOR_TYPE_ALL = 'all';
const AGGREGATOR_TYPE_ANY = 'any';

/**
* Get condition type
*
* @return string
*/
public function getConditionType();

/**
* @param string $conditionType
* @return $this
*/
public function setConditionType($conditionType);


/**
* Return list of conditions
*
* @return \Magento\SalesRule\Api\Data\ConditionInterface[]|null
*/
public function getConditions();

/**
* Set conditions
*
* @param \Magento\SalesRule\Api\Data\ConditionInterface[]|null $conditions
* @return $this
*/
public function setConditions(array $conditions = null);

/**
* Return the aggregator type
*
* @return string|null
*/
public function getAggregatorType();

/**
* Set the aggregator type
*
* @param string $aggregatorType
* @return $this
*/
public function setAggregatorType($aggregatorType);

/**
* Return the operator of the condition
*
* @return string
*/
public function getOperator();

/**
* Set the operator of the condition
*
* @param string $operator
* @return $this
*/
public function setOperator($operator);

/**
* Return the attribute name of the condition
*
* @return string|null
*/
public function getAttributeName();

/**
* Set the attribute name of the condition
*
* @param string $attributeName
* @return $this
*/
public function setAttributeName($attributeName);

/**
* Return the value of the condition
*
* @return mixed
*/
public function getValue();

/**
* Return the value of the condition
*
* @param mixed $value
* @return $this
*/
public function setValue($value);

/**
* Retrieve existing extension attributes object or create a new one.
*
* @return \Magento\SalesRule\Api\Data\ConditionExtensionInterface|null
*/
public function getExtensionAttributes();

/**
* Set an extension attributes object.
*
* @param \Magento\SalesRule\Api\Data\ConditionExtensionInterface $extensionAttributes
* @return $this
*/
public function setExtensionAttributes(
\Magento\SalesRule\Api\Data\ConditionExtensionInterface $extensionAttributes
);
}
Loading

0 comments on commit f93986f

Please sign in to comment.