diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 3b84be9ddc15548139aa13c3d6c39afed50a5c49..9080fd4b76990cf6db329e0d00873aa7e978d053 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -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 diff --git a/lib/CF2022/Controller/Orders.pm b/lib/CF2022/Controller/Orders.pm index c2fd8083761501f99b1ac61089443a5e7b7b42da..328d05377348c1af1dd3c12493316ba16c0bc10d 100644 --- a/lib/CF2022/Controller/Orders.pm +++ b/lib/CF2022/Controller/Orders.pm @@ -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');