-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Changed paypal pdp messaging to work with taxes and final price
- Loading branch information
1 parent
1575bb9
commit b447860
Showing
5 changed files
with
66 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Rvvup\Payments\ViewModel; | ||
|
||
use Magento\Catalog\Api\Data\ProductInterface; | ||
use Magento\Catalog\Helper\Data; | ||
use Magento\Framework\View\Element\Block\ArgumentInterface; | ||
use Magento\Tax\Model\Config as TaxConfig; | ||
|
||
class Price implements ArgumentInterface | ||
{ | ||
|
||
/** | ||
* @var Data | ||
*/ | ||
private Data $taxHelper; | ||
|
||
/** | ||
* @var TaxConfig | ||
*/ | ||
private TaxConfig $taxConfig; | ||
|
||
public function __construct( | ||
Data $taxHelper, | ||
TaxConfig $taxConfig | ||
) { | ||
$this->taxHelper = $taxHelper; | ||
$this->taxConfig = $taxConfig; | ||
} | ||
|
||
public function getPrice(ProductInterface $product): float | ||
{ | ||
if ($this->taxConfig->getPriceDisplayType() == TaxConfig::DISPLAY_TYPE_BOTH) { | ||
return $this->taxHelper->getTaxPrice($product, (float)$product->getFinalPrice(), true); | ||
} | ||
|
||
return $this->taxHelper->getTaxPrice($product, (float)$product->getFinalPrice()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters