diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 9080fd4b76990cf6db329e0d00873aa7e978d053..e2a83cc9b100aa6bdba07667eb3b842f4f0b6a37 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.16.0 + IMAGE_VER: 0.17.0 services: - docker:20.10.9-dind diff --git a/lib/CF2022/Controller/Orders.pm b/lib/CF2022/Controller/Orders.pm index 328d05377348c1af1dd3c12493316ba16c0bc10d..f6a23fb5529c3b06ef4f3448cbf043658521bfd9 100644 --- a/lib/CF2022/Controller/Orders.pm +++ b/lib/CF2022/Controller/Orders.pm @@ -234,6 +234,31 @@ sub get ($c ) { ); } +sub payment ($c ) { + 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; + + my $pr = $c->_payment_request($order); + + $c->render( + status => 200, + json => $pr, + ); +} + sub qr ($c) { my $order; diff --git a/openapi.yaml b/openapi.yaml index 234e727778d323e8c31652fff1ddb4ec762a9310..0bf067ac176d624f90b76ab513d652411032fcbd 100644 --- a/openapi.yaml +++ b/openapi.yaml @@ -210,3 +210,25 @@ paths: application/json: schema: type: object + + /orders/{id}/payment/: + get: + x-mojo-to: orders#payment + tags: + - order + summary: "Info o platbe" + operationId: getOrderPayment + parameters: + - name: "id" + in: path + required: true + description: "ID nebo Pretix ID" + schema: + type: string + responses: + 200: + description: Informace o platbe + content: + application/json: + schema: + type: object