Allow to add a comment when cancelling an order (#2580)

This commit is contained in:
Raphael Michel
2022-04-12 09:53:02 +02:00
committed by GitHub
parent f7c0921f18
commit 3cdf578c14
43 changed files with 130 additions and 10 deletions

View File

@@ -345,6 +345,7 @@ class OrderViewSet(viewsets.ModelViewSet):
@action(detail=True, methods=['POST'])
def mark_canceled(self, request, **kwargs):
send_mail = request.data.get('send_email', True)
comment = request.data.get('comment', None)
cancellation_fee = request.data.get('cancellation_fee', None)
if cancellation_fee:
try:
@@ -367,6 +368,7 @@ class OrderViewSet(viewsets.ModelViewSet):
device=request.auth if isinstance(request.auth, Device) else None,
oauth_application=request.auth.application if isinstance(request.auth, OAuthAccessToken) else None,
send_mail=send_mail,
email_comment=comment,
cancellation_fee=cancellation_fee
)
except OrderError as e: