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
Léo-Paul Géneau
slapos.core
Commits
5b8ec7a0
Commit
5b8ec7a0
authored
Jun 22, 2020
by
Rafael Monnerat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_subscription_request: Set appropriated Currrency when generate the refund
parent
32dbee6a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
6 deletions
+30
-6
master/bt5/slapos_subscription_request/SkinTemplateItem/portal_skins/slapos_subscription_request/SubscriptionRequest_generateReservationRefoundSalePackingList.py
...ptionRequest_generateReservationRefoundSalePackingList.py
+2
-1
master/bt5/slapos_subscription_request/TestTemplateItem/portal_components/test.erp5.testSlapOSSubscriptionScenario.py
...al_components/test.erp5.testSlapOSSubscriptionScenario.py
+28
-5
No files found.
master/bt5/slapos_subscription_request/SkinTemplateItem/portal_skins/slapos_subscription_request/SubscriptionRequest_generateReservationRefoundSalePackingList.py
View file @
5b8ec7a0
...
...
@@ -50,7 +50,8 @@ delivery.edit(
destination
=
person
.
getRelativeUrl
(),
destination_decision
=
person
.
getRelativeUrl
(),
start_date
=
payment_transaction
.
getCreationDate
(),
causality_uid
=
context
.
getUid
()
causality_uid
=
context
.
getUid
(),
price_currency
=
sale_invoice_transaction
.
getPriceCurrency
()
)
line
=
delivery
.
newContent
(
...
...
master/bt5/slapos_subscription_request/TestTemplateItem/portal_components/test.erp5.testSlapOSSubscriptionScenario.py
View file @
5b8ec7a0
...
...
@@ -28,6 +28,8 @@ class TestSlapOSSubscriptionScenarioMixin(DefaultScenarioMixin):
def
afterSetUp
(
self
):
self
.
expected_individual_price_without_tax
=
162.50
self
.
expected_individual_price_with_tax
=
195.00
self
.
expected_reservation_fee
=
25.00
self
.
expected_price_currency
=
"currency_module/EUR"
self
.
login
()
self
.
portal
.
portal_alarms
.
slapos_subscription_request_process_draft
.
setEnabled
(
True
)
...
...
@@ -244,7 +246,7 @@ class TestSlapOSSubscriptionScenarioMixin(DefaultScenarioMixin):
# 195 is the month payment
# 195*1 is the 1 months to pay upfront to use.
# 25 is the reservation fee deduction.
authAmount
=
(
int
(
self
.
expected_individual_price_with_tax
*
100
)
*
1
-
2500
)
*
quantity
authAmount
=
(
int
(
self
.
expected_individual_price_with_tax
*
100
)
*
1
-
int
(
self
.
expected_reservation_fee
*
100
)
)
*
quantity
data_kw
=
{
'errorCode'
:
'0'
,
'transactionStatus'
:
'6'
,
...
...
@@ -268,7 +270,7 @@ class TestSlapOSSubscriptionScenarioMixin(DefaultScenarioMixin):
data_kw
=
{
'errorCode'
:
'0'
,
'transactionStatus'
:
'6'
,
'authAmount'
:
25
00
*
quantity
,
'authAmount'
:
self
.
expected_reservation_fee
*
1
00
*
quantity
,
'authDevise'
:
'978'
,
}
...
...
@@ -301,6 +303,7 @@ class TestSlapOSSubscriptionScenarioMixin(DefaultScenarioMixin):
self
.
assertEqual
(
invoice
.
getSimulationState
(),
"stopped"
)
self
.
assertEqual
(
invoice
.
getCausalityState
(),
"solved"
)
self
.
assertEqual
(
invoice
.
getPriceCurrency
(),
self
.
expected_price_currency
)
for
line
in
invoice
.
objectValues
():
if
line
.
getResource
()
==
"service_module/slapos_reservation_fee"
:
self
.
assertEqual
(
line
.
getQuantity
(),
quantity
)
...
...
@@ -309,7 +312,7 @@ class TestSlapOSSubscriptionScenarioMixin(DefaultScenarioMixin):
self
.
assertEqual
(
round
(
line
.
getQuantity
(),
2
),
round
(
20.833333333333333
*
quantity
,
2
))
self
.
assertEqual
(
round
(
line
.
getTotalPrice
(),
2
),
round
(
4.166666666666667
*
quantity
,
2
))
self
.
assertEqual
(
round
(
invoice
.
getTotalPrice
(),
2
),
25.0
*
quantity
)
self
.
assertEqual
(
round
(
invoice
.
getTotalPrice
(),
2
),
self
.
expected_reservation_fee
*
quantity
)
def
checkBootstrapUser
(
self
,
subscription_request
):
person
=
subscription_request
.
getDestinationSectionValue
(
portal_type
=
"Person"
)
...
...
@@ -421,11 +424,15 @@ class TestSlapOSSubscriptionScenarioMixin(DefaultScenarioMixin):
quantity
=
subscription_request
.
getQuantity
()
# The values are without tax
self
.
assertEqual
(
sale_packing_list_line
.
getQuantity
(),
1
)
self
.
assertEqual
(
round
(
sale_packing_list_line
.
getPrice
(),
2
),
-
25
*
quantity
)
self
.
assertEqual
(
round
(
sale_packing_list_line
.
getTotalPrice
(),
2
),
-
25
*
quantity
)
self
.
assertEqual
(
round
(
sale_packing_list_line
.
getPrice
(),
2
),
-
int
(
self
.
expected_reservation_fee
*
quantity
)
)
self
.
assertEqual
(
round
(
sale_packing_list_line
.
getTotalPrice
(),
2
),
-
int
(
self
.
expected_reservation_fee
*
quantity
)
)
self
.
assertEqual
(
sale_packing_list
.
getCausality
(),
subscription_request
.
getRelativeUrl
())
self
.
assertEqual
(
sale_packing_list
.
getPriceCurrency
(),
self
.
expected_price_currency
)
@
changeSkin
(
'Hal'
)
def
_requestSubscription
(
self
,
**
kw
):
return
self
.
web_site
.
hateoas
.
SubscriptionRequestModule_requestSubscription
(
**
kw
)
...
...
@@ -525,6 +532,22 @@ class TestSlapOSSubscriptionScenarioMixin(DefaultScenarioMixin):
self
.
stepCallSlaposSubscriptionRequestProcessOrderedAlarm
()
self
.
tic
()
sale_packing_list_list
=
self
.
portal
.
portal_catalog
(
causality_uid
=
subscription_request
.
getUid
(),
title
=
"Reservation Deduction"
,
portal_type
=
"Sale Packing List"
)
self
.
assertEqual
(
len
(
sale_packing_list_list
),
1
)
sale_packing_list
=
sale_packing_list_list
[
0
]
self
.
assertEqual
(
sale_packing_list
.
getPriceCurrency
(),
self
.
expected_price_currency
)
self
.
assertEqual
(
sale_packing_list
.
getSpecialise
(),
"sale_trade_condition_module/slapos_reservation_refund_trade_condition"
)
self
.
assertEqual
(
round
(
sale_packing_list
.
getTotalPrice
(),
2
),
-
round
(
self
.
expected_reservation_fee
,
2
))
return
subscription_request
def
_checkSubscriptionDeploymentAndSimulation
(
self
,
subscription_request_list
,
...
...
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