Skip to content

Commit 96a257b

Browse files
author
Prabhu Ram
committed
MC-20648: Implement the changes
- Renamed Discount Interface to Rule Discount Interface
1 parent 50f5b81 commit 96a257b

File tree

7 files changed

+23
-23
lines changed

7 files changed

+23
-23
lines changed

app/code/Magento/SalesRule/Api/Data/DiscountInterface.php renamed to app/code/Magento/SalesRule/Api/Data/RuleDiscountInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
/**
99
* @api
1010
*/
11-
interface DiscountInterface
11+
interface RuleDiscountInterface
1212
{
1313
/**
1414
* Get Discount Data

app/code/Magento/SalesRule/Model/Data/RuleDiscount.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@
77
namespace Magento\SalesRule\Model\Data;
88

99
use Magento\SalesRule\Model\Rule\Action\Discount\Data;
10-
use Magento\SalesRule\Api\Data\DiscountInterface;
10+
use Magento\SalesRule\Api\Data\RuleDiscountInterface;
1111

1212
/**
1313
* Data Model for Rule Discount
1414
*/
15-
class RuleDiscount extends \Magento\Framework\Api\AbstractExtensibleObject implements DiscountInterface
15+
class RuleDiscount extends \Magento\Framework\Api\AbstractExtensibleObject implements RuleDiscountInterface
1616
{
1717
const KEY_DISCOUNT_DATA = 'discount';
1818
const KEY_RULE_LABEL = 'rule';
@@ -84,7 +84,7 @@ public function setRuleID(string $ruleID)
8484
/**
8585
* Retrieve existing extension attributes object or create a new one.
8686
*
87-
* @return DiscountInterface|null
87+
* @return RuleDiscountInterface|null
8888
*/
8989
public function getExtensionAttributes()
9090
{
@@ -94,11 +94,11 @@ public function getExtensionAttributes()
9494
/**
9595
* Set an extension attributes object.
9696
*
97-
* @param DiscountInterface $extensionAttributes
97+
* @param RuleDiscountInterface $extensionAttributes
9898
* @return $this
9999
*/
100100
public function setExtensionAttributes(
101-
DiscountInterface $extensionAttributes
101+
RuleDiscountInterface $extensionAttributes
102102
) {
103103
return $this->_setExtensionAttributes($extensionAttributes);
104104
}

app/code/Magento/SalesRule/Model/Plugin/Discount.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
use Magento\SalesRule\Model\Rule\Action\Discount\DataFactory;
1010
use Magento\Quote\Model\Quote;
1111
use Magento\Framework\Data\Collection;
12-
use Magento\SalesRule\Api\Data\DiscountInterfaceFactory;
12+
use Magento\SalesRule\Api\Data\RuleDiscountInterfaceFactory;
1313

1414
/**
1515
* Plugin for persisting discounts along with Quote Address
@@ -27,19 +27,19 @@ class Discount
2727
private $discountFactory;
2828

2929
/**
30-
* @var DiscountInterfaceFactory
30+
* @var RuleDiscountInterfaceFactory
3131
*/
3232
private $discountInterfaceFactory;
3333

3434
/**
3535
* @param Json $json
3636
* @param DataFactory $discountDataFactory
37-
* @param DiscountInterfaceFactory $discountInterfaceFactory
37+
* @param RuleDiscountInterfaceFactory $discountInterfaceFactory
3838
*/
3939
public function __construct(
4040
Json $json,
4141
DataFactory $discountDataFactory,
42-
DiscountInterfaceFactory $discountInterfaceFactory
42+
RuleDiscountInterfaceFactory $discountInterfaceFactory
4343
) {
4444
$this->json = $json;
4545
$this->discountFactory = $discountDataFactory;

app/code/Magento/SalesRule/Model/Quote/Discount.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
use Magento\SalesRule\Model\Rule\Action\Discount\DataFactory;
99
use Magento\Framework\App\ObjectManager;
10-
use Magento\SalesRule\Api\Data\DiscountInterfaceFactory;
10+
use Magento\SalesRule\Api\Data\RuleDiscountInterfaceFactory;
1111

1212
/**
1313
* Discount totals calculation model.
@@ -46,7 +46,7 @@ class Discount extends \Magento\Quote\Model\Quote\Address\Total\AbstractTotal
4646
private $discountFactory;
4747

4848
/**
49-
* @var DiscountInterfaceFactory
49+
* @var RuleDiscountInterfaceFactory
5050
*/
5151
private $discountInterfaceFactory;
5252

@@ -56,15 +56,15 @@ class Discount extends \Magento\Quote\Model\Quote\Address\Total\AbstractTotal
5656
* @param \Magento\SalesRule\Model\Validator $validator
5757
* @param \Magento\Framework\Pricing\PriceCurrencyInterface $priceCurrency
5858
* @param DataFactory|null $discountDataFactory
59-
* @param DiscountInterfaceFactory|null $discountInterfaceFactory
59+
* @param RuleDiscountInterfaceFactory|null $discountInterfaceFactory
6060
*/
6161
public function __construct(
6262
\Magento\Framework\Event\ManagerInterface $eventManager,
6363
\Magento\Store\Model\StoreManagerInterface $storeManager,
6464
\Magento\SalesRule\Model\Validator $validator,
6565
\Magento\Framework\Pricing\PriceCurrencyInterface $priceCurrency,
6666
DataFactory $discountDataFactory = null,
67-
DiscountInterfaceFactory $discountInterfaceFactory = null
67+
RuleDiscountInterfaceFactory $discountInterfaceFactory = null
6868
) {
6969
$this->setCode(self::COLLECTOR_TYPE_CODE);
7070
$this->eventManager = $eventManager;
@@ -73,7 +73,7 @@ public function __construct(
7373
$this->priceCurrency = $priceCurrency;
7474
$this->discountFactory = $discountDataFactory ?: ObjectManager::getInstance()->get(DataFactory::class);
7575
$this->discountInterfaceFactory = $discountInterfaceFactory
76-
?: ObjectManager::getInstance()->get(DiscountInterfaceFactory::class);
76+
?: ObjectManager::getInstance()->get(RuleDiscountInterfaceFactory::class);
7777
}
7878

7979
/**

app/code/Magento/SalesRule/Model/RulesApplier.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
use Magento\SalesRule\Model\ResourceModel\Rule\Collection;
1313
use Magento\SalesRule\Model\Rule\Action\Discount\CalculatorFactory;
1414
use Magento\SalesRule\Model\Rule\Action\Discount\DataFactory;
15-
use Magento\SalesRule\Api\Data\DiscountInterfaceFactory;
15+
use Magento\SalesRule\Api\Data\RuleDiscountInterfaceFactory;
1616

1717
/**
1818
* Class RulesApplier
@@ -49,7 +49,7 @@ class RulesApplier
4949
protected $discountFactory;
5050

5151
/**
52-
* @var DiscountInterfaceFactory
52+
* @var RuleDiscountInterfaceFactory
5353
*/
5454
private $discountInterfaceFactory;
5555

@@ -64,15 +64,15 @@ class RulesApplier
6464
* @param Utility $utility
6565
* @param ChildrenValidationLocator|null $childrenValidationLocator
6666
* @param DataFactory|null $discountDataFactory
67-
* @param DiscountInterfaceFactory|null $discountInterfaceFactory
67+
* @param RuleDiscountInterfaceFactory|null $discountInterfaceFactory
6868
*/
6969
public function __construct(
7070
\Magento\SalesRule\Model\Rule\Action\Discount\CalculatorFactory $calculatorFactory,
7171
\Magento\Framework\Event\ManagerInterface $eventManager,
7272
\Magento\SalesRule\Model\Utility $utility,
7373
ChildrenValidationLocator $childrenValidationLocator = null,
7474
DataFactory $discountDataFactory = null,
75-
DiscountInterfaceFactory $discountInterfaceFactory = null
75+
RuleDiscountInterfaceFactory $discountInterfaceFactory = null
7676
) {
7777
$this->calculatorFactory = $calculatorFactory;
7878
$this->validatorUtility = $utility;
@@ -81,7 +81,7 @@ public function __construct(
8181
?: ObjectManager::getInstance()->get(ChildrenValidationLocator::class);
8282
$this->discountFactory = $discountDataFactory ?: ObjectManager::getInstance()->get(DataFactory::class);
8383
$this->discountInterfaceFactory = $discountInterfaceFactory
84-
?: ObjectManager::getInstance()->get(DiscountInterfaceFactory::class);
84+
?: ObjectManager::getInstance()->get(RuleDiscountInterfaceFactory::class);
8585
}
8686

8787
/**

app/code/Magento/SalesRule/etc/di.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
type="Magento\SalesRule\Model\Data\CouponMassDeleteResult" />
3131
<preference for="Magento\SalesRule\Api\CouponManagementInterface"
3232
type="Magento\SalesRule\Model\Service\CouponManagementService" />
33-
<preference for="Magento\SalesRule\Api\Data\DiscountInterface"
33+
<preference for="Magento\SalesRule\Api\Data\RuleDiscountInterface"
3434
type="Magento\SalesRule\Model\Data\RuleDiscount" />
3535
<type name="Magento\SalesRule\Helper\Coupon">
3636
<arguments>

app/code/Magento/SalesRule/etc/extension_attributes.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77
-->
88
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Api/etc/extension_attributes.xsd">
99
<extension_attributes for="Magento\Quote\Api\Data\CartItemInterface">
10-
<attribute code="discounts" type="Magento\SalesRule\Api\Data\DiscountInterface[]" />
10+
<attribute code="discounts" type="Magento\SalesRule\Api\Data\RuleDiscountInterface[]" />
1111
</extension_attributes>
1212
<extension_attributes for="Magento\Quote\Api\Data\AddressInterface">
13-
<attribute code="discounts" type="Magento\SalesRule\Api\Data\DiscountInterface[]" />
13+
<attribute code="discounts" type="Magento\SalesRule\Api\Data\RuleDiscountInterface[]" />
1414
</extension_attributes>
1515
</config>

0 commit comments

Comments
 (0)