GithubHelp home page GithubHelp logo

qrpaymentsk's Introduction

qrpaymentsk's People

Contributors

ciki avatar hubipe avatar kacercz avatar rikudousage avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

qrpaymentsk's Issues

QR code in the GIF format

Hello,
I need to have a QR code generated in GIF format.
Is it possible to specify the image type with some parameter?
Or should I convert the PNG to GIF myself?
Thanks a lot for the answer
Best Regards
Michal

Windows support

Prosím o windows support.
Malo by stačiť vytvoriť podmienku po neúspešnom exec('which xz', $output, $return); na windows variantu. exec('where xz', $output, $return);

Getting the result - not working

<?php

use rikudou\SkQrPayment\QrPayment;
use Rikudou\Iban\Iban\IBAN;

$payment = new QrPayment(new IBAN('SK6807200002891987426353'));

$payment
    ->setAmount(500)
    ->setVariableSymbol('123456')
    ->setDueDate(new DateTime('+1 week'))
;

$qrString = $payment->getQrString();

// $qrString now holds the string to embed inside the QR code, in this example:
// 0004U0001M8GLP3E8KPT058IQ99QISMB02IH36MOD4BCKQQGVDE4641AOA2NURPCOPSALFG0LPG1C6N0E2JMC7RG2F4L2E57OCSHOUROGHOC8VTTPHHRFHU6VFTM8N80

$qrCode = $payment->getQrImage();

// send to browser
header('Content-Type: ' . $qrCode->getContentType());
echo $qrCode->writeString();

Testing on local testserver with PHP 8.1 in PC (Win10 x64): as soon as the code reaches $qrString = $payment->getQrString(); it quits with webpage page saying:

This page isn’t working
localhost is currently unable to handle this request.
HTTP ERROR 500

Installed with php composer.phar update --no-cache --with-all-dependencies

UPDATE
Tested a bit more: in the public function getQrString() the problem starts with the line $xzBinary = $this->getXzBinary();. As soon as it reaches this line, code breaks and all stops.

Now I do understood I need something called "xz binary" and set its path in the options for $payment using ->setXzBinary('/path/to/xz'). On Wikipedia I find those are "XZ Utils (previously LZMA Utils) is a set of free software command-line lossless data compressors, including the programs lzma and xz, for Unix-like operating systems and, from version 5.0 onwards, Microsoft Windows."

QUESTION IS: where to get those XZ binaries??? I found one here: https://tukaani.org/xz/xz-5.2.9-windows.7z
I did extract those to root "xz" folder, I set ->setXzBinary('/xz') but it still does not work.

Ah, I see: correct path shout start without the /, so that it is ->setXzBinary('xz') - now it passed!

YOU CAN SET THIS ISSUE AS SOLVED NOW...

Master zip neobsahuje priecinok TESTS ani dalsie subory z korenoveho adresara

Jakoze sorry, ale jak sa da toto MANUALNE NAINSTALOVAT?!

Reku, urobim rychly test podla prikladu co tu uvadzas, a jeeeb:

use rikudou\SkQrPayment\QrPayment;
use Rikudou\Iban\Iban\IBAN;

$payment = new QrPayment(new IBAN('SK6807200002891987426353'));

$payment
    ->setAmount(500)
    ->setVariableSymbol('123456')
    ->setDueDate(new DateTime('+1 week'))
;

$qrString = $payment->getQrString();

// $qrString now holds the string to embed inside the QR code, in this example:
// 0004U0001M8GLP3E8KPT058IQ99QISMB02IH36MOD4BCKQQGVDE4641AOA2NURPCOPSALFG0LPG1C6N0E2JMC7RG2F4L2E57OCSHOUROGHOC8VTTPHHRFHU6VFTM8N80

$qrCode = $payment->getQrImage();

// send to browser
header('Content-Type: ' . $qrCode->getContentType());
echo $qrCode->writeString();

Fatal error: Class 'rikudou\SkQrPayment\QrPayment' not found in Z:_SERVER_\root\www...\index.php on line 108

Boha, preco nemozes spravit BEZNY NORMALNY SPOSOB IMPLEMENTACIE JAK VACSINA NORMNALNYCH KODEROV, al epouzijes PREIJEBANE use??? Nejake include/require - nic, ee, vobec?! Neee, ty radsej vymyslis NEPOCHOPITELNY SPOSOB...cele zle, a take nadejne to s tebou bolo, skoda!

Toto jednoducho priemerne zdatny clovek nema sancu pochopit, lebo implementacia MANUALNA nie je nikde uvedena!!!! composer require rikudou/skqrpayment si strc vies kam...nepouzitelne, nepouzivam ziadny prijebany redakcny system, kurwa!

XzBinaryLocator is only for linux host, what abou windows?

In XzBinaryLocator.php there is on line 22:
exec('which xz', $output, $return);
This should be wrapped to check if php host is linux or windows:
if (stristr(PHP_OS, 'LINUX')) { exec( 'which xz', $output, $return ); } elseif (stristr(PHP_OS, 'WIN')) { exec( 'where xz', $output, $return ); } else { throw new QrPaymentException("not supported OS"); }

No QR code provider found exception after installing

I'm using the code from the readme at https://github.com/RikudouSage/QrPaymentSK#getting-the-result and after running composer require rikudou/skqrpayment and calling $payment->getQrImage(); this is what I'm getting:

rikudou\SkQrPayment\Exception\QrPaymentException: Error: library endroid/qr-code is not loaded. in rikudou\SkQrPayment\QrPayment->getQrImage() (line 247 of /app/vendor/rikudou/skqrpayment/src/QrPayment.php).

I tried adding them manually by running composer require endroid/qr-code and composer require rikudou/qr-payment-qr-code-provider but the same thing is happening.

I also tried modifying $payment->getQrImage(); to $payment->getQrCode(); but another error is happening:

Rikudou\QrPaymentQrCodeProvider\Exception\NoProviderFoundException: No QR code provider found. in Rikudou\QrPaymentQrCodeProvider\QrCodeProviderLocator->getProvider() (line 41 of /app/vendor/rikudou/qr-payment-qr-code-provider/src/QrCodeProviderLocator.php).

I'm trying to add this to a Drupal 9 site using PHP 7.4. What am I doing wrong?

Windows don't like ' in proc_open

When using LZMA for Windows, the Windows doesn't like this ${xzBinary} '--format=raw' '--lzma1=lc=3,lp=0,pb=2,dict=128KiB' '-c' '-'. It treads ' as separate command:

php .\test.php
xz: '--format=raw': No such file or directory
xz: '--lzma1=lc=3,lp=0,pb=2,dict=128KiB': No such file or directory
xz: '-c': No such file or directory
xz: '-': No such file or directory

After removing ' , everything works just fine. Are they required for some other OS ?

$payment->getQrString(); broken?

<?php

require_once('vendor/autoload.php');

use rikudou\SkQrPayment\QrPayment;
use Rikudou\Iban\Iban\IBAN;

$payment = new QrPayment();
$payment
    ->setXzBinary('xz')
    ->setCurrency('EUR')
    ->setAmount(10)
    ->setComment('financny dar, ')
    ->setIbans([
        new IBAN('SK6807200002891987426353')
    ]);

$qrString = $payment->getQrString();

echo $qrString;
?>

Output string is 0005C00 ???

Likewise, if I use your example from this webpage:

<?php

require_once('vendor/autoload.php');

use rikudou\SkQrPayment\QrPayment;
use Rikudou\Iban\Iban\IBAN;

$payment = new QrPayment(new IBAN('SK6807200002891987426353'));
$payment
    ->setXzBinary('xz')
    ->setAmount(500)
    ->setVariableSymbol('123456')
    ->setDueDate(new DateTime('+1 week'))
;

$qrString = $payment->getQrString();


// $qrString now holds the string to embed inside the QR code, in this example:
// 0004U0001M8GLP3E8KPT058IQ99QISMB02IH36MOD4BCKQQGVDE4641AOA2NURPCOPSALFG0LPG1C6N0E2JMC7RG2F4L2E57OCSHOUROGHOC8VTTPHHRFHU6VFTM8N80


echo $qrString;
?>

Output string is 0004U00 instead of supposed 0004U0001M8GLP3E8KPT058IQ99QISMB02IH36MOD4BCKQQGVDE4641AOA2NURPCOPSALFG0LPG1C6N0E2JMC7RG2F4L2E57OCSHOUROGHOC8VTTPHHRFHU6VFTM8N80

Did I miss to enable something somewhere, like some PHP extension or what?

Using QrPaymentSK v4.2.1

UPDATE
I was investigating some more in your getQrString() function in QrPayment.php file, and I found out that until the line 196 proc_close($xzProcess); variable $hashedData still holds all the correct values that were defined in $payment options (Ô ŔŹ 1 1 10 EUR 20240611 financny dar, 1 SK7783605207004206972399 BREXSKBX 0 0).
BUT as soon as the line $hashedData = bin2hex("\x00\x00" . pack('v', strlen($hashedData)) . $pipeOutput); happens, the new variable $hashedData suddenly becomes 00005600.

Investigating even more: important variable $pipeOutput is (seems to be) EMPTY, which means that stream_get_contents($xzProcessPipes[1]) returns nothing?!

Now as I search for the src of the $pipeOutput I see it is probably made by $xzProcess (cos that is the 1st time in the code it appears, thus my impression) which trying to call proc_open and I see it is the only call to proc_open in the file (so what I write further would have its logic, I guess), but interestingly enough, when I was trying to make Composer work I had to run it on a different PC, where I had to manually install PHP 8.1 from scratch, cos here on my PC where I run my testserver with PHP 8.1 it was Unable to launch a new process, which I was told by one guy (I guess author of the Composer, I'm not sure now) might be caused because my server - for some reason - does not allow proc_open. Which by itself is strange cos it is not disabled in the php.ini at all!

These are just my thoughts - still waiting for your actual answer tho!

UPDATE 2
Well, I tried it on that another PC where I was able successfully running Composer (= no problem with launching new process there), but the result is the same, thus I now think it is not the case of my server possibly not allowing proc_open - IT HAS TO BE SOMETHING ELSE!!! Indeed, I tested on my actual local testserver if proc_open works with this code, and it does work (output is echoed into the webpage in a loop):

<?php
set_time_limit(1800);
ob_implicit_flush(true);

$exe_command = 'C:\\Windows\\System32\\ping.exe -t google.com';

$descriptorspec = array(
    0 => array("pipe", "r"),  // stdin
    1 => array("pipe", "w"),  // stdout -> we use this
    2 => array("pipe", "w")   // stderr 
);

$process = proc_open($exe_command, $descriptorspec, $pipes);

if (is_resource($process))
{
    while( ! feof($pipes[1]))
    {
        $return_message = fgets($pipes[1], 1024);
        if (strlen($return_message) == 0) break;

        echo $return_message.'<br />';
        ob_flush();
        flush();
    }
}
?>

If I save to a text file values with file_put_contents("test.txt", $pipeOutput.'<br>'.$hashedData.'<br>'.$xzProcessPipes[0].'<br>'.$xzProcessPipes[1]); right after the line 200 $hashedData = bin2hex("\x00\x00" . pack('v', strlen($hashedData)) . $pipeOutput);, then the result is: <br>00005600<br>Resource id #25<br>Resource id #26 (in case this info would help you somehow in your investigation at all).

Hmm, maybe the xz binary ($xzProcess) is not producing expected result = no result at all, actually (maybe if you know some 100% functional xz binaries download link that you are using yourself, I could try those instead of those I have now)?

I just deleted everything in the xy folder and...no error was produced, and code works still - how come??? There are literally no files in the xz folder now, yet all seems to working OK (except the broken output string, of course) - WHAT IS GOING ON HERE???

I WOULD SAY THIS REVELATION ALONE BASICALLY SAYING WHERE THE RPOBLEM IS: does your script actually check not only for the xz binaries folder, but also for the actual binary files in there it requires for the actual code/output? Seems not...

Everything here is just my uncompetent thoughts...7+ hrs passed and I still wait for any reaction from you. :-(((

Allow set values back to null

Properties variableSymbol, specificSymbol, constantSymbol, dueDate and xzPath have default value null.
Their getters allow to return null (for symbol properties) or use fallback value.
Their setters don't allow set these properties back to null.
Please allow set mentioned properties back to null by allowing nullable type in parameters of setters.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.