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
175eb04a
Commit
175eb04a
authored
Feb 26, 2021
by
Rafael Monnerat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_subscription_request: Dont set quantity 0 but price
Else simulation behaves oddly.
parent
dc3afa4f
Pipeline
#13874
failed with stage
in 0 seconds
Changes
5
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
11 additions
and
9 deletions
+11
-9
master/bt5/slapos_subscription_request/SkinTemplateItem/portal_skins/slapos_subscription_request/SubscriptionRequestModule_requestSubscriptionProxy.py
...est/SubscriptionRequestModule_requestSubscriptionProxy.py
+2
-3
master/bt5/slapos_subscription_request/SkinTemplateItem/portal_skins/slapos_subscription_request/SubscriptionRequest_createRelatedSaleInvoiceTransaction.py
...ubscriptionRequest_createRelatedSaleInvoiceTransaction.py
+4
-1
master/bt5/slapos_subscription_request/SkinTemplateItem/portal_skins/slapos_subscription_request/SubscriptionRequest_requestPaymentTransaction.py
..._request/SubscriptionRequest_requestPaymentTransaction.py
+1
-0
master/bt5/slapos_subscription_request/SkinTemplateItem/portal_skins/slapos_subscription_request/SubscriptionRequest_requestPaymentTransaction.xml
...request/SubscriptionRequest_requestPaymentTransaction.xml
+1
-1
master/bt5/slapos_subscription_request/TestTemplateItem/portal_components/test.erp5.testSlapOSSubscriptionScenario.py
...al_components/test.erp5.testSlapOSSubscriptionScenario.py
+3
-4
No files found.
master/bt5/slapos_subscription_request/SkinTemplateItem/portal_skins/slapos_subscription_request/SubscriptionRequestModule_requestSubscriptionProxy.py
View file @
175eb04a
...
...
@@ -60,12 +60,11 @@ subscription_request = context.subscription_request_module.newContent(
subscription_request
.
setDefaultEmailText
(
email
)
def
wrapWithShadow
(
subscription_request
,
amount
,
subscription_reference
,
def
wrapWithShadow
(
subscription_request
,
subscription_reference
,
subscription_request_id
,
contract
=
contract
):
subscription_request
.
activate
(
tag
=
"subscription_condition_%s"
%
subscription_request_id
).
SubscriptionRequest_applyCondition
(
subscription_reference
,
target_language
)
return
subscription_request
.
SubscriptionRequest_requestPaymentTransaction
(
amount
=
amount
,
tag
=
"subscription_%s"
%
subscription_request_id
,
target_language
=
target_language
,
contract
=
contract
...
...
@@ -74,7 +73,7 @@ def wrapWithShadow(subscription_request, amount, subscription_reference,
payment
=
person
.
Person_restrictMethodAsShadowUser
(
shadow_document
=
person
,
callable_object
=
wrapWithShadow
,
argument_list
=
[
subscription_request
,
user_input_dict
[
"amount"
],
argument_list
=
[
subscription_request
,
subscription_reference
,
subscription_request
.
getId
(),
contract
])
...
...
master/bt5/slapos_subscription_request/SkinTemplateItem/portal_skins/slapos_subscription_request/SubscriptionRequest_createRelatedSaleInvoiceTransaction.py
View file @
175eb04a
...
...
@@ -25,7 +25,10 @@ if current_invoice is None:
start_date
=
payment_transaction
.
getStartDate
(),
stop_date
=
payment_transaction
.
getStopDate
(),
)
current_invoice
[
"1"
].
setQuantity
(
amount
)
if
not
amount
:
# this is supposed to be free, so turn price free.
current_invoice
[
"1"
].
setPrice
(
0.0
)
current_invoice
[
"1"
].
setQuantity
(
context
.
getQuantity
())
comment
=
"Validation invoice for subscription request %s"
%
context
.
getRelativeUrl
()
current_invoice
.
plan
(
comment
=
comment
)
...
...
master/bt5/slapos_subscription_request/SkinTemplateItem/portal_skins/slapos_subscription_request/SubscriptionRequest_requestPaymentTransaction.py
View file @
175eb04a
...
...
@@ -23,6 +23,7 @@ if current_invoice is None:
stop_date
=
DateTime
()
)
amount
=
context
.
getQuantity
()
if
context
.
SubscriptionRequest_testSkippedReservationFree
(
contract
):
# Reservation is Free
amount
=
0
...
...
master/bt5/slapos_subscription_request/SkinTemplateItem/portal_skins/slapos_subscription_request/SubscriptionRequest_requestPaymentTransaction.xml
View file @
175eb04a
...
...
@@ -50,7 +50,7 @@
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
amount,
tag, target_language, contract=None, REQUEST=None
</string>
</value>
<value>
<string>
tag, target_language, contract=None, REQUEST=None
</string>
</value>
</item>
<item>
<key>
<string>
_proxy_roles
</string>
</key>
...
...
master/bt5/slapos_subscription_request/TestTemplateItem/portal_components/test.erp5.testSlapOSSubscriptionScenario.py
View file @
175eb04a
...
...
@@ -714,7 +714,6 @@ return dict(vads_url_already_registered="%s/already_registered" % (payment_trans
expected_reservation_quantity_tax
=
self
.
expected_reservation_quantity_tax
expected_reservation_tax
=
self
.
expected_reservation_tax
expected_reservation_fee
=
self
.
expected_reservation_fee
self
.
assertEqual
(
invoice
.
getSimulationState
(),
"stopped"
)
self
.
assertEqual
(
invoice
.
getCausalityState
(),
"solved"
)
...
...
@@ -722,11 +721,11 @@ return dict(vads_url_already_registered="%s/already_registered" % (payment_trans
subscription_request
.
getPriceCurrency
())
for
line
in
invoice
.
objectValues
():
if
line
.
getResource
()
==
"service_module/slapos_reservation_fee"
:
self
.
assertEqual
(
line
.
getQuantity
(),
quantity
)
if
self
.
expected_free_reservation
:
self
.
assertEqual
(
line
.
getQuantity
(),
0
)
self
.
assertEqual
(
round
(
line
.
getPrice
(),
2
),
0.
0
)
else
:
self
.
assertEqual
(
line
.
getQuantity
(),
quantity
)
self
.
assertEqual
(
round
(
line
.
getPrice
(),
2
),
expected_reservation_fee_without_tax
)
self
.
assertEqual
(
round
(
line
.
getPrice
(),
2
),
expected_reservation_fee_without_tax
)
if
line
.
getResource
()
==
"service_module/slapos_tax"
:
self
.
assertEqual
(
round
(
line
.
getQuantity
(),
2
),
round
(
expected_reservation_quantity_tax
*
quantity
,
2
))
...
...
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