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
Titouan Soulard
slapos.core
Commits
6a62851b
Commit
6a62851b
authored
Sep 13, 2023
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_subscription_request: drop unused SubscriptionRequest_verifyReservationPaymentTransaction
parent
c44f7fd5
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
0 additions
and
272 deletions
+0
-272
master/bt5/slapos_subscription_request/SkinTemplateItem/portal_skins/slapos_subscription_request/SubscriptionRequest_verifyReservationPaymentTransaction.py
...ubscriptionRequest_verifyReservationPaymentTransaction.py
+0
-48
master/bt5/slapos_subscription_request/SkinTemplateItem/portal_skins/slapos_subscription_request/SubscriptionRequest_verifyReservationPaymentTransaction.xml
...bscriptionRequest_verifyReservationPaymentTransaction.xml
+0
-62
master/bt5/slapos_subscription_request/TestTemplateItem/portal_components/test.erp5.testSlapOSSubscriptionSkins.py
...ortal_components/test.erp5.testSlapOSSubscriptionSkins.py
+0
-162
No files found.
master/bt5/slapos_subscription_request/SkinTemplateItem/portal_skins/slapos_subscription_request/SubscriptionRequest_verifyReservationPaymentTransaction.py
deleted
100644 → 0
View file @
c44f7fd5
from
DateTime
import
DateTime
if
context
.
getSimulationState
()
!=
"draft"
:
return
sale_invoice_transaction
=
context
.
getCausalityValue
(
portal_type
=
"Sale Invoice Transaction"
)
if
sale_invoice_transaction
is
None
:
if
context
.
getCreationDate
()
<
DateTime
()
-
1
:
context
.
cancel
(
comment
=
"No sale invoice transaction attached, so subscription is cancelled"
)
return
if
sale_invoice_transaction
.
getSimulationState
()
in
[
"draft"
,
"cancelled"
,
"deleted"
]:
context
.
cancel
(
comment
=
"Invoice is cancelled, so subscription is cancelled"
)
return
payment_transaction_list
=
sale_invoice_transaction
.
getCausalityRelatedValueList
(
portal_type
=
"Payment Transaction"
)
cancel_subscription_request
=
None
is_paid
=
False
for
payment_transaction
in
payment_transaction_list
:
if
cancel_subscription_request
!=
False
and
payment_transaction
.
getSimulationState
()
in
[
"draft"
,
"cancelled"
,
"deleted"
]:
cancel_subscription_request
=
True
if
payment_transaction
.
getSimulationState
()
==
"stopped"
:
cancel_subscription_request
=
False
is_paid
=
True
if
cancel_subscription_request
:
context
.
cancel
(
comment
=
"Payment is cancelled, so subscription is cancelled"
)
sale_invoice_transaction
.
cancel
(
comment
=
"Payment is cancelled, so invoice is cancelled"
)
for
payment_transaction
in
payment_transaction_list
:
if
payment_transaction
.
getSimulationState
()
==
"started"
:
payment_transaction
.
cancel
(
"Subscription is been cancelled"
)
# Check if payment_transaction is payed.
if
not
is_paid
:
# Nothing to do bug wait the payment
return
if
context
.
getSpecialise
(
portal_type
=
"Subscription Condition"
)
is
not
None
:
# Ensure Subscription is updated
context
.
SubscriptionRequest_applyCondition
()
context
.
plan
(
comment
=
"Payment is consider valid."
)
master/bt5/slapos_subscription_request/SkinTemplateItem/portal_skins/slapos_subscription_request/SubscriptionRequest_verifyReservationPaymentTransaction.xml
deleted
100644 → 0
View file @
c44f7fd5
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"PythonScript"
module=
"Products.PythonScripts.PythonScript"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_bind_names
</string>
</key>
<value>
<object>
<klass>
<global
name=
"_reconstructor"
module=
"copy_reg"
/>
</klass>
<tuple>
<global
name=
"NameAssignments"
module=
"Shared.DC.Scripts.Bindings"
/>
<global
name=
"object"
module=
"__builtin__"
/>
<none/>
</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>
_params
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
SubscriptionRequest_verifyReservationPaymentTransaction
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
master/bt5/slapos_subscription_request/TestTemplateItem/portal_components/test.erp5.testSlapOSSubscriptionSkins.py
View file @
6a62851b
...
...
@@ -710,168 +710,6 @@ class TestSubscriptionRequest_notifyInstanceIsReady(TestSubscriptionSkinsMixin):
event
.
getTextContent
(),
'%s %s %s'
%
(
person
.
getTitle
(),
subscription_request
.
getTitle
(),
self
.
instance_tree
.
getRelativeUrl
()))
class
TestSubscriptionRequest_verifyReservationPaymentTransaction
(
TestSubscriptionSkinsMixin
):
def
test_no_sale_invoice
(
self
):
person
=
self
.
makePerson
()
subscription_request
=
self
.
newSubscriptionRequest
(
quantity
=
1
,
destination_section_value
=
person
)
# Too early to cancel
self
.
assertEqual
(
subscription_request
.
SubscriptionRequest_verifyReservationPaymentTransaction
(),
None
)
self
.
assertEqual
(
subscription_request
.
getSimulationState
(),
"draft"
)
def
getCreationDate
(
self
):
return
DateTime
()
-
1.1
from
Products.ERP5Type.Base
import
Base
original_get_creation
=
Base
.
getCreationDate
Base
.
getCreationDate
=
getCreationDate
try
:
self
.
assertEqual
(
subscription_request
.
SubscriptionRequest_verifyReservationPaymentTransaction
(),
None
)
finally
:
Base
.
getCreationDate
=
original_get_creation
self
.
assertEqual
(
subscription_request
.
getSimulationState
(),
"cancelled"
)
def
_test_cancel_due_payment_state
(
self
,
state
=
"draft"
):
email
=
"abc%s@nexedi.com"
%
self
.
new_id
name
=
"Cous Cous %s"
%
self
.
new_id
person
,
_
=
self
.
portal
.
SubscriptionRequest_createUser
(
name
=
name
,
email
=
email
)
self
.
tic
()
subscription_request
=
self
.
newSubscriptionRequest
(
quantity
=
1
,
destination_section_value
=
person
,
default_email_text
=
"abc%s@nexedi.com"
%
self
.
new_id
)
invoice_template_path
=
"accounting_module/template_pre_payment_subscription_sale_invoice_transaction"
invoice_template
=
self
.
portal
.
restrictedTraverse
(
invoice_template_path
)
payment_template
=
self
.
portal
.
restrictedTraverse
(
"accounting_module/slapos_pre_payment_template"
)
# Too early to cancel
self
.
assertEqual
(
subscription_request
.
SubscriptionRequest_verifyReservationPaymentTransaction
(),
None
)
self
.
assertEqual
(
subscription_request
.
getSimulationState
(),
"draft"
)
current_invoice
=
invoice_template
.
Base_createCloneDocument
(
batch_mode
=
1
)
current_payment
=
payment_template
.
Base_createCloneDocument
(
batch_mode
=
1
)
current_invoice
.
start
()
subscription_request
.
edit
(
causality_value
=
current_invoice
)
current_payment
.
setCausalityValue
(
current_invoice
)
if
state
==
"cancelled"
:
current_payment
.
cancel
()
elif
state
==
"deleted"
:
current_payment
.
delete
()
self
.
tic
()
self
.
assertEqual
(
subscription_request
.
SubscriptionRequest_verifyReservationPaymentTransaction
(),
None
)
self
.
assertEqual
(
current_invoice
.
getSimulationState
(),
"cancelled"
)
self
.
assertEqual
(
subscription_request
.
getSimulationState
(),
"cancelled"
)
def
test_draft_payment_state
(
self
):
self
.
_test_cancel_due_payment_state
()
def
test_cancelled_payment_state
(
self
):
self
.
_test_cancel_due_payment_state
(
state
=
"cancelled"
)
def
test_deleted_payment_state
(
self
):
self
.
_test_cancel_due_payment_state
(
state
=
"deleted"
)
def
test_stopped_payment_state
(
self
,
state
=
"draft"
):
email
=
"abc%s@nexedi.com"
%
self
.
new_id
name
=
"Cous Cous %s"
%
self
.
new_id
person
,
_
=
self
.
portal
.
SubscriptionRequest_createUser
(
name
=
name
,
email
=
email
)
self
.
tic
()
subscription_request
=
self
.
newSubscriptionRequest
(
quantity
=
1
,
destination_section_value
=
person
,
default_email_text
=
"abc%s@nexedi.com"
%
self
.
new_id
)
invoice_template_path
=
"accounting_module/template_pre_payment_subscription_sale_invoice_transaction"
invoice_template
=
self
.
portal
.
restrictedTraverse
(
invoice_template_path
)
payment_template
=
self
.
portal
.
restrictedTraverse
(
"accounting_module/slapos_pre_payment_template"
)
# Too early to cancel
self
.
assertEqual
(
subscription_request
.
SubscriptionRequest_verifyReservationPaymentTransaction
(),
None
)
self
.
assertEqual
(
subscription_request
.
getSimulationState
(),
"draft"
)
current_invoice
=
invoice_template
.
Base_createCloneDocument
(
batch_mode
=
1
)
current_payment
=
payment_template
.
Base_createCloneDocument
(
batch_mode
=
1
)
current_invoice
.
confirm
()
current_invoice
.
start
()
current_invoice
.
stop
()
subscription_request
.
edit
(
causality_value
=
current_invoice
)
current_payment
.
setCausalityValue
(
current_invoice
)
current_payment
.
confirm
()
current_payment
.
start
()
self
.
tic
()
self
.
assertEqual
(
subscription_request
.
SubscriptionRequest_verifyReservationPaymentTransaction
(),
None
)
self
.
assertEqual
(
subscription_request
.
getSimulationState
(),
"draft"
)
current_payment
.
stop
()
self
.
assertEqual
(
subscription_request
.
SubscriptionRequest_verifyReservationPaymentTransaction
(),
None
)
self
.
assertEqual
(
subscription_request
.
getSimulationState
(),
"planned"
)
def
_test_cancel_due_sale_invoice_state
(
self
,
state
=
"draft"
):
email
=
"abc%s@nexedi.com"
%
self
.
new_id
name
=
"Cous Cous %s"
%
self
.
new_id
person
,
_
=
self
.
portal
.
SubscriptionRequest_createUser
(
name
=
name
,
email
=
email
)
self
.
tic
()
subscription_request
=
self
.
newSubscriptionRequest
(
quantity
=
1
,
destination_section_value
=
person
,
default_email_text
=
"abc%s@nexedi.com"
%
self
.
new_id
)
invoice_template_path
=
"accounting_module/template_pre_payment_subscription_sale_invoice_transaction"
invoice_template
=
self
.
portal
.
restrictedTraverse
(
invoice_template_path
)
# Too early to cancel
self
.
assertEqual
(
subscription_request
.
SubscriptionRequest_verifyReservationPaymentTransaction
(),
None
)
self
.
assertEqual
(
subscription_request
.
getSimulationState
(),
"draft"
)
current_invoice
=
invoice_template
.
Base_createCloneDocument
(
batch_mode
=
1
)
subscription_request
.
edit
(
causality_value
=
current_invoice
)
if
state
==
"cancelled"
:
current_invoice
.
cancel
()
elif
state
==
"deleted"
:
current_invoice
.
delete
()
self
.
assertEqual
(
subscription_request
.
SubscriptionRequest_verifyReservationPaymentTransaction
(),
None
)
self
.
assertEqual
(
subscription_request
.
getSimulationState
(),
"cancelled"
)
def
test_draft_sale_invoice_state
(
self
):
self
.
_test_cancel_due_sale_invoice_state
()
def
test_cancelled_sale_invoice_state
(
self
):
self
.
_test_cancel_due_sale_invoice_state
(
state
=
"cancelled"
)
def
test_deleted_sale_invoice_state
(
self
):
self
.
_test_cancel_due_sale_invoice_state
(
state
=
"deleted"
)
class
TestSubscriptionRequest_verifyInstanceIsAllocated
(
TestSubscriptionSkinsMixin
):
...
...
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