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
9dddb882
Commit
9dddb882
authored
Aug 29, 2020
by
Rafael Monnerat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_subscription_request: Stop Payments for Free Reservations automatically
parent
0b8e17fc
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
2 deletions
+24
-2
master/bt5/slapos_subscription_request/SkinTemplateItem/portal_skins/slapos_subscription_request/SubscriptionRequest_requestPaymentTransaction.py
..._request/SubscriptionRequest_requestPaymentTransaction.py
+6
-1
master/bt5/slapos_subscription_request/TestTemplateItem/portal_components/test.erp5.testSlapOSSubscriptionScenario.py
...al_components/test.erp5.testSlapOSSubscriptionScenario.py
+18
-1
No files found.
master/bt5/slapos_subscription_request/SkinTemplateItem/portal_skins/slapos_subscription_request/SubscriptionRequest_requestPaymentTransaction.py
View file @
9dddb882
...
...
@@ -24,6 +24,7 @@ if current_invoice is None:
)
if
context
.
SubscriptionRequest_testSkippedReservationFree
(
contract
):
# Reservation is Free
amount
=
0
for
line
in
current_payment
.
contentValues
():
...
...
@@ -35,7 +36,11 @@ if current_invoice is None:
comment
=
"Validation payment for subscription request %s"
%
context
.
getRelativeUrl
()
current_payment
.
confirm
(
comment
=
comment
)
current_payment
.
start
(
comment
=
comment
)
current_payment
.
PaymentTransaction_updateStatus
()
if
not
amount
:
current_payment
.
stop
(
comment
=
"%s (Free)"
%
comment
)
elif
target_language
!=
"zh"
:
# Payzen don't require update like this.
current_payment
.
PaymentTransaction_updateStatus
()
current_payment
.
reindexObject
(
activate_kw
=
{
'tag'
:
tag
})
context
.
reindexObject
(
activate_kw
=
{
'tag'
:
tag
})
...
...
master/bt5/slapos_subscription_request/TestTemplateItem/portal_components/test.erp5.testSlapOSSubscriptionScenario.py
View file @
9dddb882
...
...
@@ -320,6 +320,18 @@ class TestSlapOSSubscriptionScenarioMixin(DefaultScenarioMixin):
}
payment
.
PaymentTransaction_createPayzenEvent
().
PayzenEvent_processUpdate
(
data_kw
,
True
)
def
_checkFreeReservationPayment
(
self
,
subscription_request
):
quantity
=
subscription_request
.
getQuantity
()
# Check Payment
payment
=
self
.
_getRelatedPaymentValue
(
subscription_request
)
self
.
assertEqual
(
self
.
expected_price_currency
,
payment
.
getPriceCurrency
())
self
.
assertEqual
(
-
self
.
expected_reservation_fee
*
quantity
,
payment
.
PaymentTransaction_getTotalPayablePrice
())
self
.
assertEqual
(
payment
.
getSimulationState
(),
"stopped"
)
return
payment
def
_payPayment
(
self
,
subscription_request
):
quantity
=
subscription_request
.
getQuantity
()
# Check Payment
...
...
@@ -353,8 +365,13 @@ class TestSlapOSSubscriptionScenarioMixin(DefaultScenarioMixin):
self
.
assertEqual
(
invoice
.
getSource
(),
self
.
expected_source
)
self
.
assertEqual
(
invoice
.
getSourceSection
(),
self
.
expected_source_section
)
# Pay Invoice if it is not Free
if
not
self
.
expected_free_reservation
:
payment
=
self
.
_payPayment
(
subscription_request
)
else
:
payment
=
self
.
_checkFreeReservationPayment
(
subscription_request
)
# Check Payment
payment
=
self
.
_payPayment
(
subscription_request
)
self
.
assertEqual
(
payment
.
getSourceSection
(),
self
.
expected_source_section
)
self
.
assertEqual
(
payment
.
getSourcePayment
(),
"%s/bank_account"
%
self
.
expected_source_section
)
...
...
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