Skip to content
Snippets Groups Projects
Verified Commit 6a5767e4 authored by Andrej Ramašeuski's avatar Andrej Ramašeuski
Browse files

QR dle pretix kodu

parent 8403b39f
No related branches found
No related tags found
No related merge requests found
Pipeline #12062 passed
......@@ -2,7 +2,7 @@ image: docker:20.10.9
variables:
DOCKER_TLS_CERTDIR: "/certs"
IMAGE_VER: 0.15.2
IMAGE_VER: 0.16.0
services:
- docker:20.10.9-dind
......
......@@ -5,7 +5,7 @@ use Mojo::Asset::File;
use Image::PNG::QRCode 'qrpng';
use constant TPL_VS => '%d%07d';
use constant TPL_PAYMENT => 'SPD*1.0*ACC:%s*AM:%f*MSG:%s, %s*X-ID:%s*X-VS:%d*X-SS:%d*X-KS:%d';
use constant TPL_PAYMENT => 'SPD*1.0*ACC:%s*AM:%.2f*MSG:%s, %s*X-ID:%s*X-VS:%d*X-SS:%d*X-KS:%d';
use feature 'signatures';
no warnings qw{ experimental::signatures };
......@@ -235,10 +235,20 @@ sub get ($c ) {
}
sub qr ($c) {
my $order = $c->schema->resultset('Order')->find({
id => $c->stash->{id},
deleted => undef,
});
my $order;
if ( $c->stash->{id} =~ /\D/) {
$order = $c->schema->resultset('Order')->search({
order_id => {ilike => $c->stash->{id}},
deleted => undef,
})->first;
}
else {
$order = $c->schema->resultset('Order')->find({
id => $c->stash->{id},
deleted => undef,
});
}
return $c->error(404, 'NOT FOUND') if ! $order;
......@@ -255,6 +265,8 @@ sub qr ($c) {
$pr->{ks},
);
$c->trace($payment);
my $png = qrpng (text => $payment, level => 4);
$c->res->headers->content_type('image/png');
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment