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
Boxiang Sun
slapos.core
Commits
5cd2c351
Commit
5cd2c351
authored
Nov 22, 2012
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add Currency_getIntegrationMapping script.
Prevent duplicated the complex mapping retrieval.
parent
89e8eb83
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
109 additions
and
5 deletions
+109
-5
master/bt5/slapos_payzen/SkinTemplateItem/portal_skins/slapos_payzen/Alarm_updatePayzenConfirmedPaymentTransaction.xml
..._payzen/Alarm_updatePayzenConfirmedPaymentTransaction.xml
+1
-1
master/bt5/slapos_payzen/SkinTemplateItem/portal_skins/slapos_payzen/Currency_getIntegrationMapping.xml
...al_skins/slapos_payzen/Currency_getIntegrationMapping.xml
+73
-0
master/bt5/slapos_payzen/SkinTemplateItem/portal_skins/slapos_payzen/PaymentTransaction_getPreviousPayzenId.xml
.../slapos_payzen/PaymentTransaction_getPreviousPayzenId.xml
+2
-0
master/bt5/slapos_payzen/TestTemplateItem/testSlapOSPayzenSkins.py
...5/slapos_payzen/TestTemplateItem/testSlapOSPayzenSkins.py
+24
-0
master/bt5/slapos_payzen/WorkflowTemplateItem/portal_workflow/payzen_interface_workflow/scripts/PayzenEvent_processUpdate.xml
..._interface_workflow/scripts/PayzenEvent_processUpdate.xml
+1
-1
master/bt5/slapos_payzen/WorkflowTemplateItem/portal_workflow/payzen_interface_workflow/scripts/PayzenEvent_registerPayzen.xml
...interface_workflow/scripts/PayzenEvent_registerPayzen.xml
+3
-1
master/bt5/slapos_payzen/WorkflowTemplateItem/portal_workflow/payzen_interface_workflow/scripts/PayzenEvent_updateStatus.xml
...n_interface_workflow/scripts/PayzenEvent_updateStatus.xml
+3
-1
master/bt5/slapos_payzen/bt/revision
master/bt5/slapos_payzen/bt/revision
+1
-1
master/bt5/slapos_payzen/bt/template_test_id_list
master/bt5/slapos_payzen/bt/template_test_id_list
+1
-0
No files found.
master/bt5/slapos_payzen/SkinTemplateItem/portal_skins/slapos_payzen/Alarm_updatePayzenConfirmedPaymentTransaction.xml
View file @
5cd2c351
...
...
@@ -55,7 +55,7 @@ portal.portal_catalog.searchAndActivate(\n
portal_type="Payment Transaction", \n
simulation_state=["confirmed"],\n
causality_state=["solved"],\n
method_id=\'PaymentTransaction_
updateStatus
\',\n
method_id=\'PaymentTransaction_
startExternalPayment
\',\n
packet_size=1, # just one to minimise errors\n
activate_kw={\'tag\': tag}\n
)\n
...
...
master/bt5/slapos_payzen/SkinTemplateItem/portal_skins/slapos_payzen/Currency_getIntegrationMapping.xml
0 → 100644
View file @
5cd2c351
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"PythonScript"
module=
"Products.PythonScripts.PythonScript"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
Script_magic
</string>
</key>
<value>
<int>
3
</int>
</value>
</item>
<item>
<key>
<string>
_bind_names
</string>
</key>
<value>
<object>
<klass>
<global
name=
"NameAssignments"
module=
"Shared.DC.Scripts.Bindings"
/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key>
<string>
_asgns
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
name_container
</string>
</key>
<value>
<string>
container
</string>
</value>
</item>
<item>
<key>
<string>
name_context
</string>
</key>
<value>
<string>
context
</string>
</value>
</item>
<item>
<key>
<string>
name_m_self
</string>
</key>
<value>
<string>
script
</string>
</value>
</item>
<item>
<key>
<string>
name_subpath
</string>
</key>
<value>
<string>
traverse_subpath
</string>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
portal = context.getPortalObject()\n
integration_site = portal.restrictedTraverse(portal.portal_preferences.getPreferredPayzenIntegrationSite())\n
\n
relative_url = context.getRelativeUrl()\n
# Only EUR is supported for now\n
assert relative_url == \'currency_module/EUR\'\n
return integration_site.getMappingFromCategory(\'resource/%s\' % relative_url).split(\'/\', 1)[-1]\n
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
Currency_getIntegrationMapping
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
master/bt5/slapos_payzen/SkinTemplateItem/portal_skins/slapos_payzen/PaymentTransaction_getPreviousPayzenId.xml
View file @
5cd2c351
...
...
@@ -52,6 +52,8 @@
<key>
<string>
_body
</string>
</key>
<value>
<string>
from DateTime import DateTime\n
transaction = context\n
return None\n
\n
portal = transaction.getPortalObject()\n
integration_site = portal.restrictedTraverse(portal.portal_preferences.getPreferredPayzenIntegrationSite())\n
state_list = portal.getPortalCurrentInventoryStateList()\n
...
...
master/bt5/slapos_payzen/TestTemplateItem/testSlapOSPayzenSkins.py
0 → 100644
View file @
5cd2c351
# Copyright (c) 2002-2012 Nexedi SA and Contributors. All Rights Reserved.
import
transaction
from
Products.SlapOS.tests.testSlapOSMixin
import
\
testSlapOSMixin
class
TestSlapOSCurrency_getIntegrationMapping
(
testSlapOSMixin
):
def
beforeTearDown
(
self
):
transaction
.
abort
()
def
test_integratedCurrency
(
self
):
currency
=
self
.
portal
.
currency_module
.
EUR
self
.
assertEquals
(
currency
.
Currency_getIntegrationMapping
(),
'978'
)
def
test_notIntegratedCurrency
(
self
):
new_id
=
self
.
generateNewId
()
currency
=
self
.
portal
.
currency_module
.
newContent
(
portal_type
=
'Currency'
,
title
=
"Currency %s"
%
new_id
,
reference
=
"TESTCUR-%s"
%
new_id
,
)
self
.
assertRaises
(
AssertionError
,
currency
.
Currency_getIntegrationMapping
)
master/bt5/slapos_payzen/WorkflowTemplateItem/portal_workflow/payzen_interface_workflow/scripts/PayzenEvent_processUpdate.xml
View file @
5cd2c351
...
...
@@ -110,7 +110,7 @@ elif transaction_status in continue_transaction_id_list:\n
if transaction_amount != auth_amount:\n
payzen_event.confirm(comment=\'Received amount (%r) does not match stored on transaction (%r)\'% (auth_amount, transaction_amount))\n
return\n
transaction_devise =
integration_tool.getMappingFromCategory(\'resource/currency_module/%s\' % transaction.getResourceReference()).split(\'/\')[-1]
\n
transaction_devise =
transaction.getResourceValue().Currency_getIntegrationMapping()
\n
if transaction_devise != auth_devise:\n
payzen_event.confirm(comment=\'Received devise (%r) does not match stored on transaction (%r)\'% (auth_devise, transaction_devise))\n
return\n
...
...
master/bt5/slapos_payzen/WorkflowTemplateItem/portal_workflow/payzen_interface_workflow/scripts/PayzenEvent_registerPayzen.xml
View file @
5cd2c351
...
...
@@ -55,6 +55,8 @@
In order to not transmit sensitive information the registration is done by looking the newest\n
payzen related transaction for destination_section and doing its duplicate"""\n
\n
raise NotImplementedError\n
\n
from DateTime import DateTime\n
payzen_event = state_change[\'object\']\n
transaction = payzen_event.getDestinationValue()\n
...
...
@@ -89,7 +91,7 @@ else:\n
# do causality mapping in integration_site between transaction.getRelativeUrl and today + transaction_id\n
payzen_dict = {}\n
payzen_dict.update(\n
devise=
integration_site.getMappingFromCategory(\'resource/currency_module/%s\' % transaction.getResourceReference()).split(\'/\')[-1]
,\n
devise=
transaction.getResourceValue().Currency_getIntegrationMapping()
,\n
amount=str(int(round((transaction.PaymentTransaction_getTotalPayablePrice() * -100), 0))),\n
presentationDate=transaction.getStartDate().toZone(\'UTC\').asdatetime(),\n
newTransactionId=transaction_id,\n
...
...
master/bt5/slapos_payzen/WorkflowTemplateItem/portal_workflow/payzen_interface_workflow/scripts/PayzenEvent_updateStatus.xml
View file @
5cd2c351
...
...
@@ -50,7 +50,9 @@
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
payzen_event = state_change[\'object\']\n
<value>
<string>
raise NotImplementedError\n
\n
payzen_event = state_change[\'object\']\n
payment_transaction = payzen_event.getDestinationValue()\n
portal = payment_transaction.getPortalObject()\n
service = portal.portal_secure_payments.find()\n
...
...
master/bt5/slapos_payzen/bt/revision
View file @
5cd2c351
85
\ No newline at end of file
87
\ No newline at end of file
master/bt5/slapos_payzen/bt/template_test_id_list
0 → 100644
View file @
5cd2c351
testSlapOSPayzenSkins
\ No newline at end of file
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