Skip to content

Commit d14245d

Browse files
committed
Remove formatBasePriceTxt from Order object
1 parent 286009f commit d14245d

File tree

3 files changed

+14
-15
lines changed

3 files changed

+14
-15
lines changed

app/code/Magento/Sales/Model/Order.php

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1503,7 +1503,7 @@ public function getItemById($itemId)
15031503
* Get item by quote item id
15041504
*
15051505
* @param mixed $quoteItemId
1506-
* @return \Magento\Framework\DataObject|null
1506+
* @return \Magento\Framework\DataObject|null
15071507
*/
15081508
public function getItemByQuoteItemId($quoteItemId)
15091509
{
@@ -1784,17 +1784,6 @@ public function formatBasePricePrecision($price, $precision)
17841784
return $this->getBaseCurrency()->formatPrecision($price, $precision);
17851785
}
17861786

1787-
/**
1788-
* Retrieve text formatted base price value
1789-
*
1790-
* @param float $price
1791-
* @return string
1792-
*/
1793-
public function formatBasePriceTxt($price)
1794-
{
1795-
return $this->getBaseCurrency()->formatTxt($price);
1796-
}
1797-
17981787
/**
17991788
* Is currency different
18001789
*

app/code/Magento/Sales/Model/Service/CreditmemoService.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ protected function validateForRefund(\Magento\Sales\Api\Data\CreditmemoInterface
202202
throw new \Magento\Framework\Exception\LocalizedException(
203203
__(
204204
'The most money available to refund is %1.',
205-
$creditmemo->getOrder()->formatBasePriceTxt($baseAvailableRefund)
205+
$creditmemo->getOrder()->getBaseCurrency()->formatTxt($baseAvailableRefund)
206206
)
207207
);
208208
}

app/code/Magento/Sales/Test/Unit/Model/Service/CreditmemoServiceTest.php

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -351,9 +351,14 @@ public function testRefundExpectsMoneyAvailableToReturn()
351351
$order->method('getBaseTotalPaid')
352352
->willReturn($baseTotalPaid);
353353
$baseAvailableRefund = $baseTotalPaid - $baseTotalRefunded;
354-
$order->method('formatBasePriceTxt')
354+
$baseCurrency = $this->createMock(\Magento\Directory\Model\Currency::class);
355+
$baseCurrency->expects($this->once())
356+
->method('formatTxt')
355357
->with($baseAvailableRefund)
356358
->willReturn($baseAvailableRefund);
359+
$order->expects($this->once())
360+
->method('getBaseCurrency')
361+
->willReturn($baseCurrency);
357362
$this->creditmemoService->refund($creditMemo, true);
358363
}
359364

@@ -411,9 +416,14 @@ public function testMultiCurrencyRefundExpectsMoneyAvailableToReturn()
411416
$order->method('getTotalPaid')
412417
->willReturn($totalPaid);
413418
$baseAvailableRefund = $baseTotalPaid - $baseTotalRefunded;
414-
$order->method('formatBasePriceTxt')
419+
$baseCurrency = $this->createMock(\Magento\Directory\Model\Currency::class);
420+
$baseCurrency->expects($this->once())
421+
->method('formatTxt')
415422
->with($baseAvailableRefund)
416423
->willReturn(sprintf('$%.2f', $baseAvailableRefund));
424+
$order->expects($this->once())
425+
->method('getBaseCurrency')
426+
->willReturn($baseCurrency);
417427
$this->creditmemoService->refund($creditMemo, true);
418428
}
419429
}

0 commit comments

Comments
 (0)