<?php
namespace system\library\payment;

use Mpdf\QrCode\QrCode;
use Mpdf\QrCode\Output;

class PixQRCodeGenerator{
    public static function generateQrCodeImage($qrCode){
        try {
            $qrCodeGenerator = new QrCode($qrCode);
            
            $qrcodeImage = (new Output\Png())->output($qrCodeGenerator, 400);
            
            $qrCode = "data:image/png;base64," . base64_encode($qrcodeImage);

        } catch(\Exception $e) {
            $qrCode = null;
        }

        return $qrCode;
    }
}