Skip to content

Commit

Permalink
Merge pull request #93 from pagarme/bugfix/cent-missing-recurrence-pr…
Browse files Browse the repository at this point in the history
…ice/PAOPN-12

Bugfix/cent missing recurrence price/paopn 12
  • Loading branch information
mauriciohaygert authored Jun 14, 2022
2 parents 71bf5fe + 05c3754 commit 4427366
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion Helper/ProductHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,13 @@ public function getProductList(array $productIdList)
*/
public static function applyDiscount($title, $product)
{
$value = ProductHelper::extractValueFromTitle($title);
if (!$value) {
return $title;
}
$price = ProductHelper::applyMoneyFormat(
ProductHelper::calculateDiscount(
ProductHelper::extractValueFromTitle($title),
$value,
ProductHelper::getDiscountAmount($product)
)
);
Expand Down
2 changes: 1 addition & 1 deletion Observer/DiscountCyclesObserver.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public function execute(Observer $observer)
private function applyDiscountCycles($cycles, $product)
{
foreach ($cycles as $cycle) {
ProductHelper::applyDiscount($cycle->getTitle(), $product);
$cycle->setTitle(ProductHelper::applyDiscount($cycle->getTitle(), $product));
}
}
}

0 comments on commit 4427366

Please sign in to comment.