Skip to content

Commit

Permalink
Reworked clearpay pricing to work with final price (#24)
Browse files Browse the repository at this point in the history
  • Loading branch information
andrii-onufriichuk authored Mar 27, 2023
1 parent 41fb1e5 commit 1575bb9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions Test/Unit/ViewModel/ClearpayMessagingTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ protected function setUp(): void
{
$this->configMock = $this->getMockBuilder(Config::class)->disableOriginalConstructor()->getMock();
$productRepositoryMock = $this->getMockBuilder(ProductRepositoryInterface::class)->getMock();
$this->productMock = $this->getMockBuilder(ProductInterface::class)->addMethods(['getRvvupRestricted'])
->getMockForAbstractClass();
$this->productMock = $this->getMockBuilder(ProductInterface::class)
->addMethods(['getRvvupRestricted','getFinalPrice'])->getMockForAbstractClass();
$thresholdProviderMock = $this->getMockBuilder(ThresholdProvider::class)->disableOriginalConstructor()
->onlyMethods(['get'])->getMock();
$thresholdProviderMock->method('get')->with('CLEARPAY')
Expand Down Expand Up @@ -175,7 +175,7 @@ private function configureProduct(bool $restricted, float $price)
$this->productMock->method('getRvvupRestricted')
->willReturn($restricted);

$this->productMock->method('getPrice')
$this->productMock->method('getFinalPrice')
->willReturn($price);

$this->taxHelperMock->method('getTaxPrice')->willReturn($price);
Expand Down
4 changes: 2 additions & 2 deletions ViewModel/Clearpay.php
Original file line number Diff line number Diff line change
Expand Up @@ -316,9 +316,9 @@ private function getThresholdsByProviderAndCurrency()
public function getPrice(ProductInterface $product): float
{
if ($this->taxConfig->getPriceDisplayType() == TaxConfig::DISPLAY_TYPE_BOTH) {
return $this->taxHelper->getTaxPrice($product, (float)$product->getPrice(), true);
return $this->taxHelper->getTaxPrice($product, (float)$product->getFinalPrice(), true);
}

return $this->taxHelper->getTaxPrice($product, (float)$product->getPrice());
return $this->taxHelper->getTaxPrice($product, (float)$product->getFinalPrice());
}
}

0 comments on commit 1575bb9

Please sign in to comment.