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
Labels
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
Rafael Monnerat
slapos.core
Commits
1bf10285
Commit
1bf10285
authored
Aug 05, 2020
by
Rafael Monnerat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_payzen: Make Pylint Happy
parent
8c7f556e
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
109 additions
and
88 deletions
+109
-88
master/bt5/slapos_payzen/SkinTemplateItem/portal_skins/slapos_payzen/OrderBuilder_generateUnrelatedInvoiceList.py
...lapos_payzen/OrderBuilder_generateUnrelatedInvoiceList.py
+5
-5
master/bt5/slapos_payzen/SkinTemplateItem/portal_skins/slapos_payzen/PaymentTransaction_generatePayzenId.py
...kins/slapos_payzen/PaymentTransaction_generatePayzenId.py
+6
-5
master/bt5/slapos_payzen/SkinTemplateItem/portal_skins/slapos_payzen/PaymentTransaction_updateStatus.py
...al_skins/slapos_payzen/PaymentTransaction_updateStatus.py
+1
-2
master/bt5/slapos_payzen/SkinTemplateItem/portal_skins/slapos_payzen/PayzenEvent_processUpdate.py
...m/portal_skins/slapos_payzen/PayzenEvent_processUpdate.py
+1
-4
master/bt5/slapos_payzen/TestTemplateItem/portal_components/test.erp5.testSlapOSPayzenAlarm.xml
...tem/portal_components/test.erp5.testSlapOSPayzenAlarm.xml
+20
-16
master/bt5/slapos_payzen/TestTemplateItem/portal_components/test.erp5.testSlapOSPayzenBuilder.xml
...m/portal_components/test.erp5.testSlapOSPayzenBuilder.xml
+20
-16
master/bt5/slapos_payzen/TestTemplateItem/portal_components/test.erp5.testSlapOSPayzenSkins.xml
...tem/portal_components/test.erp5.testSlapOSPayzenSkins.xml
+20
-17
master/bt5/slapos_payzen/TestTemplateItem/portal_components/test.erp5.testSlapOSPayzenWorkflow.xml
.../portal_components/test.erp5.testSlapOSPayzenWorkflow.xml
+20
-16
master/bt5/slapos_payzen/WorkflowTemplateItem/portal_workflow/payzen_interface_workflow/scripts/PayzenEvent_generateNavigationPage.py
...ce_workflow/scripts/PayzenEvent_generateNavigationPage.py
+1
-2
master/bt5/slapos_payzen/WorkflowTemplateItem/portal_workflow/payzen_interface_workflow/scripts/PayzenEvent_registerPayzen.py
..._interface_workflow/scripts/PayzenEvent_registerPayzen.py
+11
-3
master/bt5/slapos_payzen/WorkflowTemplateItem/portal_workflow/payzen_interface_workflow/scripts/PayzenEvent_updateStatus.py
...en_interface_workflow/scripts/PayzenEvent_updateStatus.py
+4
-2
No files found.
master/bt5/slapos_payzen/SkinTemplateItem/portal_skins/slapos_payzen/OrderBuilder_generateUnrelatedInvoiceList.py
View file @
1bf10285
...
...
@@ -23,7 +23,7 @@ select_kw.update(
default_source_uid
=
portal
.
restrictedTraverse
(
'account_module/receivable'
).
getUid
()
movement_list
=
[]
id
=
1
_
id
=
1
for
invoice
in
portal
.
portal_catalog
(
**
select_kw
):
invoice
.
getObject
().
serialize
()
# in order to avoid selection on concurrent transactions
...
...
@@ -51,21 +51,21 @@ for invoice in portal.portal_catalog(**select_kw):
source_payment
=
'%s/bank_account'
%
invoice
.
getSourceSection
(),
# the other place defnied: business process
)
temp_movement_rec
=
newTempSimulationMovement
(
temp_object
=
True
,
id
=
str
(
id
),
temp_object
=
True
,
id
=
str
(
_
id
),
quantity
=-
1
*
quantity
,
source
=
'account_module/receivable'
,
destination
=
'account_module/payable'
,
**
temp_movement_kw
)
id
+=
1
_
id
+=
1
temp_movement_bank
=
newTempSimulationMovement
(
temp_object
=
True
,
id
=
str
(
id
),
temp_object
=
True
,
id
=
str
(
_
id
),
quantity
=
1
*
quantity
,
source
=
'account_module/bank'
,
destination
=
'account_module/bank'
,
**
temp_movement_kw
)
id
+=
1
_
id
+=
1
movement_list
.
extend
([
temp_movement_rec
,
temp_movement_bank
])
return
movement_list
master/bt5/slapos_payzen/SkinTemplateItem/portal_skins/slapos_payzen/PaymentTransaction_generatePayzenId.py
View file @
1bf10285
...
...
@@ -5,7 +5,7 @@ if REQUEST is not None:
portal
=
context
.
getPortalObject
()
integration_site
=
portal
.
restrictedTraverse
(
portal
.
portal_preferences
.
getPreferredPayzenIntegrationSite
())
transaction_date
,
transaction_id
=
context
.
PaymentTransaction_getPayzenId
()
_
,
transaction_id
=
context
.
PaymentTransaction_getPayzenId
()
if
transaction_id
is
not
None
:
# XXX raise?
return
None
,
None
...
...
@@ -28,10 +28,11 @@ mapping_id = '%s_%s' % (today, transaction_id)
# raise ValueError, "Payzen transaction_id already exists"
try
:
mapping
=
integration_site
.
getCategoryFromMapping
(
'Causality/%s'
%
context
.
getId
().
replace
(
'-'
,
'_'
),
create_mapping_line
=
True
,
create_mapping
=
True
)
# Init for use later.
integration_site
.
getCategoryFromMapping
(
'Causality/%s'
%
context
.
getId
().
replace
(
'-'
,
'_'
),
create_mapping_line
=
True
,
create_mapping
=
True
)
except
ValueError
:
pass
integration_site
.
Causality
[
context
.
getId
().
replace
(
'-'
,
'_'
)].
setDestinationReference
(
mapping_id
)
...
...
master/bt5/slapos_payzen/SkinTemplateItem/portal_skins/slapos_payzen/PaymentTransaction_updateStatus.py
View file @
1bf10285
from
DateTime
import
DateTime
portal
=
context
.
getPortalObject
()
state
=
context
.
getSimulationState
()
if
(
state
!=
'started'
)
or
(
context
.
getPaymentMode
()
!=
'payzen'
):
return
else
:
transaction_date
,
transaction_id
=
context
.
PaymentTransaction_getPayzenId
()
_
,
transaction_id
=
context
.
PaymentTransaction_getPayzenId
()
if
transaction_id
is
not
None
:
# so the payment is registered in payzen
...
...
master/bt5/slapos_payzen/SkinTemplateItem/portal_skins/slapos_payzen/PayzenEvent_processUpdate.py
View file @
1bf10285
...
...
@@ -9,7 +9,6 @@ def storeWorkflowComment(ctx, comment):
payzen_event
=
context
transaction
=
payzen_event
.
getDestinationValue
()
portal
=
transaction
.
getPortalObject
()
assert
signature
in
(
True
,
False
)
if
signature
is
False
:
...
...
@@ -21,7 +20,7 @@ isTransitionPossible = context.getPortalObject().portal_workflow.isTransitionPos
error_code
=
data_kw
[
'errorCode'
]
if
error_code
==
'2'
:
transaction_date
,
payzen_id
=
transaction
.
PaymentTransaction_getPayzenId
()
transaction_date
,
_
=
transaction
.
PaymentTransaction_getPayzenId
()
# Mark on payment transaction history log that transaction was not processed yet
payzen_event
.
confirm
()
payzen_event
.
acknowledge
(
comment
=
'Transaction not found on payzen side.'
)
...
...
@@ -61,8 +60,6 @@ elif error_code == '0':
payzen_event
.
confirm
(
comment
=
'Unknown transactionStatus %r'
%
transaction_status
)
return
doActionFor
=
context
.
getPortalObject
().
portal_workflow
.
doActionFor
if
transaction_status
in
mark_transaction_id_list
:
# Mark on payment transaction history log that transaction was not processed yet
storeWorkflowComment
(
transaction
,
'Transaction status %s (%s) did not changed the document state'
%
(
transaction_status
,
transaction_status_description
))
...
...
master/bt5/slapos_payzen/TestTemplateItem/portal_components/test.erp5.testSlapOSPayzenAlarm.xml
View file @
1bf10285
...
...
@@ -100,24 +100,28 @@
</record>
<record
id=
"4"
aka=
"AAAAAAAAAAQ="
>
<pickle>
<global
name=
"WorkflowHistoryList"
module=
"Products.ERP5Type.
patches.WorkflowTool
"
/>
<global
name=
"WorkflowHistoryList"
module=
"Products.ERP5Type.
Workflow
"
/>
</pickle>
<pickle>
<tuple>
<none/>
<list>
<dictionary>
<item>
<key>
<string>
action
</string>
</key>
<value>
<string>
validate
</string>
</value>
</item>
<item>
<key>
<string>
validation_state
</string>
</key>
<value>
<string>
validated
</string>
</value>
</item>
</dictionary>
</list>
</tuple>
<dictionary>
<item>
<key>
<string>
_log
</string>
</key>
<value>
<list>
<dictionary>
<item>
<key>
<string>
action
</string>
</key>
<value>
<string>
validate
</string>
</value>
</item>
<item>
<key>
<string>
validation_state
</string>
</key>
<value>
<string>
validated
</string>
</value>
</item>
</dictionary>
</list>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
master/bt5/slapos_payzen/TestTemplateItem/portal_components/test.erp5.testSlapOSPayzenBuilder.xml
View file @
1bf10285
...
...
@@ -100,24 +100,28 @@
</record>
<record
id=
"4"
aka=
"AAAAAAAAAAQ="
>
<pickle>
<global
name=
"WorkflowHistoryList"
module=
"Products.ERP5Type.
patches.WorkflowTool
"
/>
<global
name=
"WorkflowHistoryList"
module=
"Products.ERP5Type.
Workflow
"
/>
</pickle>
<pickle>
<tuple>
<none/>
<list>
<dictionary>
<item>
<key>
<string>
action
</string>
</key>
<value>
<string>
validate
</string>
</value>
</item>
<item>
<key>
<string>
validation_state
</string>
</key>
<value>
<string>
validated
</string>
</value>
</item>
</dictionary>
</list>
</tuple>
<dictionary>
<item>
<key>
<string>
_log
</string>
</key>
<value>
<list>
<dictionary>
<item>
<key>
<string>
action
</string>
</key>
<value>
<string>
validate
</string>
</value>
</item>
<item>
<key>
<string>
validation_state
</string>
</key>
<value>
<string>
validated
</string>
</value>
</item>
</dictionary>
</list>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
master/bt5/slapos_payzen/TestTemplateItem/portal_components/test.erp5.testSlapOSPayzenSkins.xml
View file @
1bf10285
...
...
@@ -100,25 +100,28 @@
</record>
<record
id=
"4"
aka=
"AAAAAAAAAAQ="
>
<pickle>
<global
name=
"WorkflowHistoryList"
module=
"Products.ERP5Type.
patches.WorkflowTool
"
/>
<global
name=
"WorkflowHistoryList"
module=
"Products.ERP5Type.
Workflow
"
/>
</pickle>
<pickle>
<tuple>
<none/>
<list>
<dictionary>
<item>
<key>
<string>
action
</string>
</key>
<value>
<string>
validate
</string>
</value>
</item>
<item>
<key>
<string>
validation_state
</string>
</key>
<value>
<string>
validated
</string>
</value>
</item>
</dictionary>
</list>
<none/>
</tuple>
<dictionary>
<item>
<key>
<string>
_log
</string>
</key>
<value>
<list>
<dictionary>
<item>
<key>
<string>
action
</string>
</key>
<value>
<string>
validate
</string>
</value>
</item>
<item>
<key>
<string>
validation_state
</string>
</key>
<value>
<string>
validated
</string>
</value>
</item>
</dictionary>
</list>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
master/bt5/slapos_payzen/TestTemplateItem/portal_components/test.erp5.testSlapOSPayzenWorkflow.xml
View file @
1bf10285
...
...
@@ -100,24 +100,28 @@
</record>
<record
id=
"4"
aka=
"AAAAAAAAAAQ="
>
<pickle>
<global
name=
"WorkflowHistoryList"
module=
"Products.ERP5Type.
patches.WorkflowTool
"
/>
<global
name=
"WorkflowHistoryList"
module=
"Products.ERP5Type.
Workflow
"
/>
</pickle>
<pickle>
<tuple>
<none/>
<list>
<dictionary>
<item>
<key>
<string>
action
</string>
</key>
<value>
<string>
validate
</string>
</value>
</item>
<item>
<key>
<string>
validation_state
</string>
</key>
<value>
<string>
validated
</string>
</value>
</item>
</dictionary>
</list>
</tuple>
<dictionary>
<item>
<key>
<string>
_log
</string>
</key>
<value>
<list>
<dictionary>
<item>
<key>
<string>
action
</string>
</key>
<value>
<string>
validate
</string>
</value>
</item>
<item>
<key>
<string>
validation_state
</string>
</key>
<value>
<string>
validated
</string>
</value>
</item>
</dictionary>
</list>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
master/bt5/slapos_payzen/WorkflowTemplateItem/portal_workflow/payzen_interface_workflow/scripts/PayzenEvent_generateNavigationPage.py
View file @
1bf10285
...
...
@@ -20,11 +20,10 @@ payment_transaction = payzen_event.getDestinationValue(portal_type="Payment Tran
now
=
DateTime
()
payment_transaction
.
AccountingTransaction_updateStartDate
(
now
)
transaction_date
,
transaction_id
=
payment_transaction
.
PaymentTransaction_generatePayzenId
()
_
,
transaction_id
=
payment_transaction
.
PaymentTransaction_generatePayzenId
()
if
transaction_id
is
None
:
raise
ValueError
,
"Transaction already registered"
today
=
now
.
toZone
(
'UTC'
).
asdatetime
().
strftime
(
'%Y%m%d'
)
payzen_dict
=
{
'vads_currency'
:
payment_transaction
.
getResourceValue
().
Currency_getIntegrationMapping
(),
'vads_amount'
:
str
(
int
(
round
((
payment_transaction
.
PaymentTransaction_getTotalPayablePrice
()
*
-
100
),
0
))),
...
...
master/bt5/slapos_payzen/WorkflowTemplateItem/portal_workflow/payzen_interface_workflow/scripts/PayzenEvent_registerPayzen.py
View file @
1bf10285
...
...
@@ -6,7 +6,6 @@ payzen related transaction for destination_section and doing its duplicate"""
from
DateTime
import
DateTime
payzen_event
=
state_change
[
'object'
]
transaction
=
payzen_event
.
getDestinationValue
()
portal
=
transaction
.
getPortalObject
()
payment_service
=
payzen_event
.
getSourceValue
(
portal_type
=
"Payzen Service"
)
previous_id
=
transaction
.
PaymentTransaction_getPreviousPayzenId
()
...
...
@@ -31,6 +30,15 @@ payzen_dict.update(
data_kw
,
signature
,
sent_text
,
received_text
=
payment_service
.
soap_duplicate
(
**
payzen_dict
)
sent
=
payzen_event
.
newContent
(
title
=
'Sent SOAP'
,
portal_type
=
'Payzen Event Message'
,
text_content
=
sent_text
)
received
=
payzen_event
.
newContent
(
title
=
'Received SOAP'
,
text_content
=
received_text
,
predecessor_value
=
sent
,
portal_type
=
'Payzen Event Message'
)
# SENT
sent
=
payzen_event
.
newContent
(
title
=
'Sent SOAP'
,
portal_type
=
'Payzen Event Message'
,
text_content
=
sent_text
)
# RECEIVED
payzen_event
.
newContent
(
title
=
'Received SOAP'
,
text_content
=
received_text
,
predecessor_value
=
sent
,
portal_type
=
'Payzen Event Message'
)
context
.
PayzenEvent_processUpdate
(
state_change
,
data_kw
,
signature
)
master/bt5/slapos_payzen/WorkflowTemplateItem/portal_workflow/payzen_interface_workflow/scripts/PayzenEvent_updateStatus.py
View file @
1bf10285
payzen_event
=
state_change
[
'object'
]
payment_transaction
=
payzen_event
.
getDestinationValue
(
portal_type
=
"Payment Transaction"
)
portal
=
payment_transaction
.
getPortalObject
()
transaction_date
,
transaction_id
=
payment_transaction
.
PaymentTransaction_getPayzenId
()
if
transaction_id
is
None
:
...
...
@@ -11,11 +10,14 @@ data_kw, signature, sent_text, received_text = payment_service.soap_getInfo(
transaction_date
.
toZone
(
'UTC'
).
asdatetime
(),
transaction_id
)
# SENT
sent
=
payzen_event
.
newContent
(
title
=
'Sent SOAP'
,
portal_type
=
'Payzen Event Message'
,
text_content
=
sent_text
)
received
=
payzen_event
.
newContent
(
# RECEIVED
payzen_event
.
newContent
(
title
=
'Received SOAP'
,
portal_type
=
'Payzen Event Message'
,
text_content
=
received_text
,
...
...
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