Skip to content

Commit

Permalink
injecting PixHelper via di
Browse files Browse the repository at this point in the history
  • Loading branch information
Mateus Picoloto committed Jul 25, 2023
1 parent b0417a7 commit 0d95b54
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions Block/Payment/Pix.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,20 @@ class Pix extends Template
*/
private $pixInfo;

/**
* @var PixHelper
*/
private $pixHelper;

/**
* Link constructor.
* @param Context $context
* @param CheckoutSession $checkoutSession
*/
public function __construct(Context $context, CheckoutSession $checkoutSession)
public function __construct(Context $context, CheckoutSession $checkoutSession, PixHelper $pixHelper)
{
$this->checkoutSession = $checkoutSession;
$this->pixHelper = $pixHelper;
parent::__construct($context, []);
}

Expand Down Expand Up @@ -116,8 +122,7 @@ public function getSuccessMessage()
private function getPixInfo()
{
if (empty($this->pixInfo)) {
$pixHelper = new PixHelper();
$this->pixInfo = $pixHelper->getQrCode($this->getPayment());
$this->pixInfo = $this->pixHelper->getQrCode($this->getPayment());
}

return $this->pixInfo;
Expand Down

0 comments on commit 0d95b54

Please sign in to comment.