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
1
Merge Requests
1
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
Romain Courteaud
slapos.core
Commits
2d508c90
Commit
2d508c90
authored
May 23, 2024
by
Rafael Monnerat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_accounting: Create integration site for payzen
parent
ad3ea0aa
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
73 additions
and
13 deletions
+73
-13
master/bt5/slapos_accounting/TestTemplateItem/portal_components/test.erp5.testSlapOSAccountingSkins.py
.../portal_components/test.erp5.testSlapOSAccountingSkins.py
+73
-13
No files found.
master/bt5/slapos_accounting/TestTemplateItem/portal_components/test.erp5.testSlapOSAccountingSkins.py
View file @
2d508c90
...
@@ -34,6 +34,34 @@ from zExceptions import Unauthorized
...
@@ -34,6 +34,34 @@ from zExceptions import Unauthorized
class
TestSlapOSAccounting
(
SlapOSTestCaseMixin
):
class
TestSlapOSAccounting
(
SlapOSTestCaseMixin
):
def
createIntegrationSite
(
self
):
# Include a simple Integration site, which is required for
# PaymentTransaction_generatePayzenId
integration_site
=
self
.
portal
.
portal_integrations
.
newContent
(
title
=
"Integration site for test_AccountingTransaction_getPaymentState_payzen_waiting_payment"
,
reference
=
"payzen"
,
portal_type
=
"Integration Site"
)
integration_site
.
newContent
(
id
=
"Causality"
,
portal_type
=
"Integration Base Category Mapping"
,
default_source_reference
=
"Causality"
,
default_destination_reference
=
"causality"
)
resource_map
=
integration_site
.
newContent
(
id
=
"Resource"
,
portal_type
=
"Integration Base Category Mapping"
,
default_source_reference
=
"Resource"
,
default_destination_reference
=
"resource"
)
resource_map
.
newContent
(
id
=
'978'
,
portal_type
=
"Integration Category Mapping"
,
default_destination_reference
=
'resource/currency_module/EUR'
,
default_source_reference
=
'978'
)
return
integration_site
def
createHostingSubscription
(
self
):
def
createHostingSubscription
(
self
):
new_id
=
self
.
generateNewId
()
new_id
=
self
.
generateNewId
()
return
self
.
portal
.
hosting_subscription_module
.
newContent
(
return
self
.
portal
.
hosting_subscription_module
.
newContent
(
...
@@ -153,16 +181,32 @@ class TestSlapOSAccounting(SlapOSTestCaseMixin):
...
@@ -153,16 +181,32 @@ class TestSlapOSAccounting(SlapOSTestCaseMixin):
causality_value
=
invoice
,
causality_value
=
invoice
,
destination
=
invoice
.
getDestination
(),
destination
=
invoice
.
getDestination
(),
destination_section
=
invoice
.
getDestinationSection
(),
destination_section
=
invoice
.
getDestinationSection
(),
created_by_builder
=
1
# to prevent init script to create lines
created_by_builder
=
1
# to prevent init script to create lines
)
)
self
.
portal
.
portal_workflow
.
_jumpToStateFor
(
payment
,
'started'
)
self
.
portal
.
portal_workflow
.
_jumpToStateFor
(
payment
,
'started'
)
self
.
tic
()
system_preference
=
self
.
portal
.
portal_preferences
.
slapos_default_system_preference
payment
.
PaymentTransaction_generatePayzenId
()
older_integration_site
=
system_preference
.
getPreferredPayzenIntegrationSite
()
self
.
assertRaises
(
ValueError
,
integration_site
=
self
.
createIntegrationSite
()
invoice
.
SaleInvoiceTransaction_createReversalSaleInvoiceTransaction
,
system_preference
.
setPreferredPayzenIntegrationSite
(
batch_mode
=
1
)
integration_site
.
getRelativeUrl
()
)
try
:
self
.
tic
()
payment
.
PaymentTransaction_generatePayzenId
()
self
.
assertRaises
(
ValueError
,
invoice
.
SaleInvoiceTransaction_createReversalSaleInvoiceTransaction
,
batch_mode
=
1
)
finally
:
self
.
portal
.
portal_integrations
.
manage_delObjects
(
ids
=
[
integration_site
.
getId
()])
system_preference
.
setPreferredPayzenIntegrationSite
(
older_integration_site
)
@
withAbort
@
withAbort
def
test_createReversalSaleInvoiceTransaction_ok
(
self
,
payment_mode
=
'payzen'
):
def
test_createReversalSaleInvoiceTransaction_ok
(
self
,
payment_mode
=
'payzen'
):
...
@@ -388,19 +432,35 @@ class TestSlapOSAccounting(SlapOSTestCaseMixin):
...
@@ -388,19 +432,35 @@ class TestSlapOSAccounting(SlapOSTestCaseMixin):
causality_value
=
invoice
,
causality_value
=
invoice
,
destination
=
invoice
.
getDestination
(),
destination
=
invoice
.
getDestination
(),
destination_section
=
invoice
.
getDestinationSection
(),
destination_section
=
invoice
.
getDestinationSection
(),
created_by_builder
=
1
# to prevent init script to create lines
created_by_builder
=
1
# to prevent init script to create lines
)
)
self
.
portal
.
portal_workflow
.
_jumpToStateFor
(
payment
,
'started'
)
self
.
portal
.
portal_workflow
.
_jumpToStateFor
(
payment
,
'started'
)
payment
.
PaymentTransaction_generatePayzenId
()
self
.
tic
()
system_preference
=
self
.
portal
.
portal_preferences
.
slapos_default_system_preference
self
.
login
(
person
.
getUserId
())
older_integration_site
=
system_preference
.
getPreferredPayzenIntegrationSite
()
self
.
assertEqual
(
"Waiting for payment confirmation"
,
integration_site
=
self
.
createIntegrationSite
()
system_preference
.
setPreferredPayzenIntegrationSite
(
integration_site
.
getRelativeUrl
()
)
try
:
payment
.
PaymentTransaction_generatePayzenId
()
self
.
tic
()
self
.
login
(
person
.
getUserId
())
self
.
assertEqual
(
"Waiting for payment confirmation"
,
invoice
.
AccountingTransaction_getPaymentState
())
invoice
.
AccountingTransaction_getPaymentState
())
finally
:
self
.
portal
.
portal_integrations
.
manage_delObjects
(
ids
=
[
integration_site
.
getId
()])
system_preference
.
setPreferredPayzenIntegrationSite
(
older_integration_site
)
def
test_AccountingTransaction_getPaymentState_wechat_waiting_payment
(
self
):
def
test_AccountingTransaction_getPaymentState_wechat_waiting_payment
(
self
):
project
=
self
.
addProject
()
project
=
self
.
addProject
()
person
=
self
.
makePerson
(
project
)
person
=
self
.
makePerson
(
project
)
invoice
=
self
.
createStoppedSaleInvoiceTransaction
(
invoice
=
self
.
createStoppedSaleInvoiceTransaction
(
destination_section_value
=
person
,
destination_section_value
=
person
,
payment_mode
=
'wechat'
)
payment_mode
=
'wechat'
)
...
...
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