Skip to content

Commit e8ef9ce

Browse files
author
Stanislav Idolov
committed
MAGETWO-55342: [GITHUB] Free shiping coupon usage is not tracked #3506
1 parent 8ae9033 commit e8ef9ce

File tree

2 files changed

+5
-9
lines changed

2 files changed

+5
-9
lines changed

app/code/Magento/SalesRule/Observer/SalesOrderAfterPlaceObserver.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public function execute(EventObserver $observer)
5757
{
5858
$order = $observer->getEvent()->getOrder();
5959

60-
if (!$order || $order->getDiscountAmount() == 0) {
60+
if (!$order || !$order->getAppliedRuleIds()) {
6161
return $this;
6262
}
6363

app/code/Magento/SalesRule/Test/Unit/Observer/SalesOrderAfterPlaceObserverTest.php

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -121,10 +121,10 @@ public function testSalesOrderAfterPlaceWithoutRuleId()
121121
{
122122
$observer = $this->getMock(\Magento\Framework\Event\Observer::class, [], [], '', false);
123123
$order = $this->initOrderFromEvent($observer);
124-
$discountAmount = 10;
124+
$ruleIds = null;
125125
$order->expects($this->once())
126-
->method('getDiscountAmount')
127-
->will($this->returnValue($discountAmount));
126+
->method('getAppliedRuleIds')
127+
->will($this->returnValue($ruleIds));
128128

129129
$this->ruleFactory->expects($this->never())
130130
->method('create');
@@ -158,14 +158,10 @@ public function testSalesOrderAfterPlace($ruleCustomerId)
158158
$ruleId = 1;
159159
$couponId = 1;
160160
$customerId = 1;
161-
$discountAmount = 10;
162161

163-
$order->expects($this->once())
162+
$order->expects($this->exactly(2))
164163
->method('getAppliedRuleIds')
165164
->will($this->returnValue($ruleId));
166-
$order->expects($this->once())
167-
->method('getDiscountAmount')
168-
->will($this->returnValue($discountAmount));
169165
$order->expects($this->once())
170166
->method('getCustomerId')
171167
->will($this->returnValue($customerId));

0 commit comments

Comments
 (0)