Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
cf-web-api
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
KS Pardubický kraj
cf-web-api
Commits
a25f0192
Verified
Commit
a25f0192
authored
2 years ago
by
Andrej Ramašeuski
Browse files
Options
Downloads
Patches
Plain Diff
Variabilita KS
parent
26fad4ef
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Pipeline
#11984
passed
2 years ago
Stage: build
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
.gitlab-ci.yml
+1
-1
1 addition, 1 deletion
.gitlab-ci.yml
lib/CF2022/Controller/Orders.pm
+32
-17
32 additions, 17 deletions
lib/CF2022/Controller/Orders.pm
lib/CF2022/Helpers/Core.pm
+6
-0
6 additions, 0 deletions
lib/CF2022/Helpers/Core.pm
with
39 additions
and
18 deletions
.gitlab-ci.yml
+
1
−
1
View file @
a25f0192
...
...
@@ -2,7 +2,7 @@ image: docker:20.10.9
variables
:
DOCKER_TLS_CERTDIR
:
"
/certs"
IMAGE_VER
:
0.1
4
.0
IMAGE_VER
:
0.1
5
.0
services
:
-
docker:20.10.9-dind
...
...
This diff is collapsed.
Click to expand it.
lib/CF2022/Controller/Orders.pm
+
32
−
17
View file @
a25f0192
...
...
@@ -166,7 +166,6 @@ sub create ($c ) {
return
$c
->
error
(
400
,
$rc
->
body
)
if
!
$rc
->
is_success
;
# ukladani do lokalni databazi
$order
=
$c
->
schema
->
resultset
('
Order
')
->
create
({
ip
=>
$c
->
tx
->
remote_address
,
sso_uuid
=>
$claims
->
{
sub
},
...
...
@@ -177,19 +176,11 @@ sub create ($c ) {
order_id
=>
$rc
->
json
->
{
code
},
});
$c
->
render
(
status
=>
201
,
json
=>
{
%
{
$rc
->
json
},
payment_request
=>
{
account
=>
$c
->
cfg
->
{
payment_account
},
amount
=>
$order
->
response
->
{
payments
}[
0
]{
amount
},
vs
=>
sprintf
(
TPL_VS
,
$c
->
cfg
->
{
payment_vs_prefix
},
$order
->
id
),
ss
=>
$c
->
cfg
->
{
payment_ss
},
ks
=>
$c
->
cfg
->
{
payment_ks
},
qr
=>
'
/api/orders/
'
.
$order
->
id
.
'
/payment.png
',
},
payment_request
=>
$c
->
_payment_request
(
$order
),
}
);
}
...
...
@@ -251,15 +242,17 @@ sub qr ($c) {
return
$c
->
error
(
404
,
'
NOT FOUND
')
if
!
$order
;
my
$pr
=
$c
->
_payment_request
(
$order
);
my
$payment
=
sprintf
(
TPL_PAYMENT
,
$
c
->
cfg
->
{
payment_
iban
},
$
order
->
response
->
{
payments
}[
0
]
{
amount
},
$
c
->
cfg
->
{
payment_msg
},
$
order
->
request
->
{
positions
}[
0
]{
attendee_name
},
$
pr
->
{
iban
},
$
pr
->
{
amount
},
$
pr
->
{
message
},
$
pr
->
{
payer
},
$order
->
order_id
,
s
pr
intf
(
TPL_VS
,
$c
->
cfg
->
{
payment_vs_prefix
},
$order
->
id
)
,
$
c
->
cfg
->
{
payment_
ss
},
$
c
->
cfg
->
{
payment_
ks
},
$
pr
->
{
vs
}
,
$
pr
->
{
ss
},
$
pr
->
{
ks
},
);
my
$png
=
qrpng
(
text
=>
$payment
,
level
=>
4
);
...
...
@@ -296,4 +289,26 @@ sub _upload_photo ($c, $username ) {
}
sub
_payment_request
($c, $order) {
my
$ks
=
$c
->
cfg
->
{
payment_ks
};
PRODUCT:
foreach
my
$pos
(
@
{
$order
->
response
->
{
positions
}}
)
{
$ks
|=
$c
->
payment_ks_bit
(
$pos
->
{
item
})
}
return
{
account
=>
$c
->
cfg
->
{
payment_account
},
iban
=>
$c
->
cfg
->
{
payment_iban
},
amount
=>
$order
->
response
->
{
payments
}[
0
]{
amount
},
message
=>
$c
->
cfg
->
{
payment_msg
},
payer
=>
$order
->
request
->
{
positions
}[
0
]{
attendee_name
},
vs
=>
sprintf
(
TPL_VS
,
$c
->
cfg
->
{
payment_vs_prefix
},
$order
->
id
),
ss
=>
$c
->
cfg
->
{
payment_ss
},
ks
=>
$ks
,
qr
=>
'
/api/orders/
'
.
$order
->
id
.
'
/payment.png
',
};
}
1
;
This diff is collapsed.
Click to expand it.
lib/CF2022/Helpers/Core.pm
+
6
−
0
View file @
a25f0192
...
...
@@ -79,6 +79,12 @@ sub register ($class, $self, $conf) {
my
%map
=
(
split
/\D+/
,
$c
->
cfg
->
{
pretix_variations_map
});
return
(
exists
$map
{
$id
})
?
$map
{
$id
}
:
$id
;
});
$self
->
helper
(
payment_ks_bit
=>
sub
($c, $id) {
my
%map
=
(
split
/\D+/
,
$c
->
cfg
->
{
payment_ks_product_map
});
return
(
exists
$map
{
$id
})
?
$map
{
$id
}
:
0
;
});
}
1
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment