diff --git a/Block/Payment/Pix.php b/Block/Payment/Pix.php index c2a74038..845e34de 100644 --- a/Block/Payment/Pix.php +++ b/Block/Payment/Pix.php @@ -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, []); } @@ -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;