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
Xiaowu Zhang
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
Changes
5
Show 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(
...
@@ -60,12 +60,11 @@ subscription_request = context.subscription_request_module.newContent(
subscription_request
.
setDefaultEmailText
(
email
)
subscription_request
.
setDefaultEmailText
(
email
)
def
wrapWithShadow
(
subscription_request
,
amount
,
subscription_reference
,
def
wrapWithShadow
(
subscription_request
,
subscription_reference
,
subscription_request_id
,
contract
=
contract
):
subscription_request_id
,
contract
=
contract
):
subscription_request
.
activate
(
tag
=
"subscription_condition_%s"
%
subscription_request_id
subscription_request
.
activate
(
tag
=
"subscription_condition_%s"
%
subscription_request_id
).
SubscriptionRequest_applyCondition
(
subscription_reference
,
target_language
)
).
SubscriptionRequest_applyCondition
(
subscription_reference
,
target_language
)
return
subscription_request
.
SubscriptionRequest_requestPaymentTransaction
(
return
subscription_request
.
SubscriptionRequest_requestPaymentTransaction
(
amount
=
amount
,
tag
=
"subscription_%s"
%
subscription_request_id
,
tag
=
"subscription_%s"
%
subscription_request_id
,
target_language
=
target_language
,
target_language
=
target_language
,
contract
=
contract
contract
=
contract
...
@@ -74,7 +73,7 @@ def wrapWithShadow(subscription_request, amount, subscription_reference,
...
@@ -74,7 +73,7 @@ def wrapWithShadow(subscription_request, amount, subscription_reference,
payment
=
person
.
Person_restrictMethodAsShadowUser
(
payment
=
person
.
Person_restrictMethodAsShadowUser
(
shadow_document
=
person
,
shadow_document
=
person
,
callable_object
=
wrapWithShadow
,
callable_object
=
wrapWithShadow
,
argument_list
=
[
subscription_request
,
user_input_dict
[
"amount"
],
argument_list
=
[
subscription_request
,
subscription_reference
,
subscription_request
.
getId
(),
subscription_reference
,
subscription_request
.
getId
(),
contract
])
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:
...
@@ -25,7 +25,10 @@ if current_invoice is None:
start_date
=
payment_transaction
.
getStartDate
(),
start_date
=
payment_transaction
.
getStartDate
(),
stop_date
=
payment_transaction
.
getStopDate
(),
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
()
comment
=
"Validation invoice for subscription request %s"
%
context
.
getRelativeUrl
()
current_invoice
.
plan
(
comment
=
comment
)
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:
...
@@ -23,6 +23,7 @@ if current_invoice is None:
stop_date
=
DateTime
()
stop_date
=
DateTime
()
)
)
amount
=
context
.
getQuantity
()
if
context
.
SubscriptionRequest_testSkippedReservationFree
(
contract
):
if
context
.
SubscriptionRequest_testSkippedReservationFree
(
contract
):
# Reservation is Free
# Reservation is Free
amount
=
0
amount
=
0
...
...
master/bt5/slapos_subscription_request/SkinTemplateItem/portal_skins/slapos_subscription_request/SubscriptionRequest_requestPaymentTransaction.xml
View file @
175eb04a
...
@@ -50,7 +50,7 @@
...
@@ -50,7 +50,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
_params
</string>
</key>
<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>
<item>
<item>
<key>
<string>
_proxy_roles
</string>
</key>
<key>
<string>
_proxy_roles
</string>
</key>
...
...
master/bt5/slapos_subscription_request/TestTemplateItem/portal_components/test.erp5.testSlapOSSubscriptionScenario.py
View file @
175eb04a
...
@@ -715,17 +715,16 @@ return dict(vads_url_already_registered="%s/already_registered" % (payment_trans
...
@@ -715,17 +715,16 @@ return dict(vads_url_already_registered="%s/already_registered" % (payment_trans
expected_reservation_tax
=
self
.
expected_reservation_tax
expected_reservation_tax
=
self
.
expected_reservation_tax
expected_reservation_fee
=
self
.
expected_reservation_fee
expected_reservation_fee
=
self
.
expected_reservation_fee
self
.
assertEqual
(
invoice
.
getSimulationState
(),
"stopped"
)
self
.
assertEqual
(
invoice
.
getSimulationState
(),
"stopped"
)
self
.
assertEqual
(
invoice
.
getCausalityState
(),
"solved"
)
self
.
assertEqual
(
invoice
.
getCausalityState
(),
"solved"
)
self
.
assertEqual
(
invoice
.
getPriceCurrency
(),
self
.
assertEqual
(
invoice
.
getPriceCurrency
(),
subscription_request
.
getPriceCurrency
())
subscription_request
.
getPriceCurrency
())
for
line
in
invoice
.
objectValues
():
for
line
in
invoice
.
objectValues
():
if
line
.
getResource
()
==
"service_module/slapos_reservation_fee"
:
if
line
.
getResource
()
==
"service_module/slapos_reservation_fee"
:
self
.
assertEqual
(
line
.
getQuantity
(),
quantity
)
if
self
.
expected_free_reservation
:
if
self
.
expected_free_reservation
:
self
.
assertEqual
(
line
.
getQuantity
(),
0
)
self
.
assertEqual
(
round
(
line
.
getPrice
(),
2
),
0.
0
)
else
:
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"
:
if
line
.
getResource
()
==
"service_module/slapos_tax"
:
self
.
assertEqual
(
round
(
line
.
getQuantity
(),
2
),
self
.
assertEqual
(
round
(
line
.
getQuantity
(),
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