Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.core
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Paul Graydon
slapos.core
Commits
b7df55aa
Commit
b7df55aa
authored
May 23, 2024
by
Rafael Monnerat
👻
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_payzen: Use nice error when integration_site is not configured
parent
6cca1c8d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
11 deletions
+15
-11
master/bt5/slapos_payzen/SkinTemplateItem/portal_skins/slapos_payzen/PaymentTransaction_generatePayzenId.py
...kins/slapos_payzen/PaymentTransaction_generatePayzenId.py
+9
-10
master/bt5/slapos_payzen/SkinTemplateItem/portal_skins/slapos_payzen/PaymentTransaction_getPayzenId.py
...tal_skins/slapos_payzen/PaymentTransaction_getPayzenId.py
+6
-1
No files found.
master/bt5/slapos_payzen/SkinTemplateItem/portal_skins/slapos_payzen/PaymentTransaction_generatePayzenId.py
View file @
b7df55aa
...
...
@@ -3,7 +3,6 @@ if REQUEST is not None:
raise
Unauthorized
portal
=
context
.
getPortalObject
()
integration_site
=
portal
.
restrictedTraverse
(
portal
.
portal_preferences
.
getPreferredPayzenIntegrationSite
())
_
,
transaction_id
=
context
.
PaymentTransaction_getPayzenId
()
if
transaction_id
is
not
None
:
...
...
@@ -13,19 +12,17 @@ if transaction_id is not None:
now
=
DateTime
().
toZone
(
'UTC'
)
today
=
now
.
asdatetime
().
strftime
(
'%Y%m%d'
)
preferred_integration_site
=
portal
.
portal_preferences
.
getPreferredPayzenIntegrationSite
()
integration_site
=
portal
.
restrictedTraverse
(
preferred_integration_site
)
if
integration_site
is
None
or
not
preferred_integration_site
:
raise
ValueError
(
"Integration Site not found or not configured: %s"
%
preferred_integration_site
)
transaction_id
=
str
(
portal
.
portal_ids
.
generateNewId
(
id_group
=
'%s_%s'
%
(
integration_site
.
getRelativeUrl
(),
today
),
id_generator
=
'uid'
)).
zfill
(
6
)
mapping_id
=
'%s_%s'
%
(
today
,
transaction_id
)
# integration_site.Causality[mapping_id].setDestinationReference(context.getRelativeUrl())
# try:
# integration_site.getCategoryFromMapping('Causality/%s' % mapping_id, create_mapping_line=True, create_mapping=True)
# except ValueError:
# mapping = integration_site.Causality[mapping_id]
# mapping.setDestinationReference('%s' % context.getRelativeUrl())
# else:
# raise ValueError, "Payzen transaction_id already exists"
try
:
# Init for use later.
...
...
@@ -35,6 +32,8 @@ try:
create_mapping
=
True
)
except
ValueError
:
pass
mapping_id
=
'%s_%s'
%
(
today
,
transaction_id
)
integration_site
.
Causality
[
context
.
getId
().
replace
(
'-'
,
'_'
)].
setDestinationReference
(
mapping_id
)
return
context
.
PaymentTransaction_getPayzenId
()
master/bt5/slapos_payzen/SkinTemplateItem/portal_skins/slapos_payzen/PaymentTransaction_getPayzenId.py
View file @
b7df55aa
...
...
@@ -3,7 +3,12 @@ if REQUEST is not None:
raise
Unauthorized
portal
=
context
.
getPortalObject
()
integration_site
=
portal
.
restrictedTraverse
(
portal
.
portal_preferences
.
getPreferredPayzenIntegrationSite
())
preferred_integration_site
=
portal
.
portal_preferences
.
getPreferredPayzenIntegrationSite
()
integration_site
=
portal
.
restrictedTraverse
(
preferred_integration_site
)
if
integration_site
is
None
or
not
preferred_integration_site
:
raise
ValueError
(
"Integration Site not found or not configured: %s"
%
preferred_integration_site
)
payzen_id
=
integration_site
.
getCategoryFromMapping
(
'Causality/%s'
%
context
.
getId
().
replace
(
'-'
,
'_'
))
if
payzen_id
!=
'causality/%s'
%
context
.
getId
().
replace
(
'-'
,
'_'
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment