Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
ecommerce
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
ecommerce
Commits
47abd96d
Commit
47abd96d
authored
Feb 07, 2017
by
Clinton Blackburn
Committed by
Clinton Blackburn
Feb 07, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Disabled refund notifications for free orders
ECOM-6975
parent
7ea2a493
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
4 deletions
+9
-4
ecommerce/extensions/refund/models.py
+4
-3
ecommerce/extensions/refund/tests/test_models.py
+5
-1
No files found.
ecommerce/extensions/refund/models.py
View file @
47abd96d
...
@@ -137,7 +137,7 @@ class Refund(StatusMixin, TimeStampedModel):
...
@@ -137,7 +137,7 @@ class Refund(StatusMixin, TimeStampedModel):
)
)
if
total_credit_excl_tax
==
0
:
if
total_credit_excl_tax
==
0
:
refund
.
approve
()
refund
.
approve
(
notify_purchaser
=
False
)
return
refund
return
refund
...
@@ -232,7 +232,7 @@ class Refund(StatusMixin, TimeStampedModel):
...
@@ -232,7 +232,7 @@ class Refund(StatusMixin, TimeStampedModel):
logger
.
error
(
'Unable to revoke fulfillment of all lines of Refund [
%
d].'
,
self
.
id
)
logger
.
error
(
'Unable to revoke fulfillment of all lines of Refund [
%
d].'
,
self
.
id
)
self
.
set_status
(
REFUND
.
REVOCATION_ERROR
)
self
.
set_status
(
REFUND
.
REVOCATION_ERROR
)
def
approve
(
self
,
revoke_fulfillment
=
True
):
def
approve
(
self
,
revoke_fulfillment
=
True
,
notify_purchaser
=
True
):
if
not
self
.
can_approve
:
if
not
self
.
can_approve
:
logger
.
debug
(
'Refund [
%
d] cannot be approved.'
,
self
.
id
)
logger
.
debug
(
'Refund [
%
d] cannot be approved.'
,
self
.
id
)
return
False
return
False
...
@@ -240,7 +240,8 @@ class Refund(StatusMixin, TimeStampedModel):
...
@@ -240,7 +240,8 @@ class Refund(StatusMixin, TimeStampedModel):
try
:
try
:
self
.
_issue_credit
()
self
.
_issue_credit
()
self
.
set_status
(
REFUND
.
PAYMENT_REFUNDED
)
self
.
set_status
(
REFUND
.
PAYMENT_REFUNDED
)
self
.
_notify_purchaser
()
if
notify_purchaser
:
self
.
_notify_purchaser
()
except
PaymentError
:
except
PaymentError
:
logger
.
exception
(
'Failed to issue credit for refund [
%
d].'
,
self
.
id
)
logger
.
exception
(
'Failed to issue credit for refund [
%
d].'
,
self
.
id
)
self
.
set_status
(
REFUND
.
PAYMENT_REFUND_ERROR
)
self
.
set_status
(
REFUND
.
PAYMENT_REFUND_ERROR
)
...
...
ecommerce/extensions/refund/tests/test_models.py
View file @
47abd96d
...
@@ -171,7 +171,8 @@ class RefundTests(RefundTestMixin, StatusTestsMixin, TestCase):
...
@@ -171,7 +171,8 @@ class RefundTests(RefundTestMixin, StatusTestsMixin, TestCase):
# Verify that the order totals $0.
# Verify that the order totals $0.
self
.
assertEqual
(
order
.
total_excl_tax
,
0
)
self
.
assertEqual
(
order
.
total_excl_tax
,
0
)
refund
=
Refund
.
create_with_lines
(
order
,
list
(
order
.
lines
.
all
()))
with
mock
.
patch
.
object
(
Refund
,
'_notify_purchaser'
)
as
mock_notify
:
refund
=
Refund
.
create_with_lines
(
order
,
list
(
order
.
lines
.
all
()))
# Verify that refund lines are not revoked.
# Verify that refund lines are not revoked.
self
.
assertFalse
(
mock_revoke_line
.
called
)
self
.
assertFalse
(
mock_revoke_line
.
called
)
...
@@ -180,6 +181,9 @@ class RefundTests(RefundTestMixin, StatusTestsMixin, TestCase):
...
@@ -180,6 +181,9 @@ class RefundTests(RefundTestMixin, StatusTestsMixin, TestCase):
self
.
assertEqual
(
refund
.
status
,
REFUND
.
COMPLETE
)
self
.
assertEqual
(
refund
.
status
,
REFUND
.
COMPLETE
)
self
.
assertEqual
(
set
([
line
.
status
for
line
in
refund
.
lines
.
all
()]),
{
REFUND_LINE
.
COMPLETE
})
self
.
assertEqual
(
set
([
line
.
status
for
line
in
refund
.
lines
.
all
()]),
{
REFUND_LINE
.
COMPLETE
})
# Verify no notification is sent to the purchaser
self
.
assertFalse
(
mock_notify
.
called
)
@ddt.unpack
@ddt.unpack
@ddt.data
(
@ddt.data
(
(
REFUND
.
OPEN
,
True
),
(
REFUND
.
OPEN
,
True
),
...
...
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