Last active
March 15, 2019 11:31
-
-
Save jedie/455e3e7eba64a521d9fd8fe55fec1377 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import logging | |
from django.core.exceptions import SuspiciousOperation | |
from oscar_docdata.facade import Facade | |
from oscar_docdata.models import DocdataOrder | |
log = logging.getLogger(__name__) | |
class CustomDocdataFacade(Facade): | |
# ... | |
def update_order(self, order): | |
""" | |
Update order status by request new data from DocData. | |
Restrict to certain Order status codes | |
See also: | |
https://github.com/django-oscar/django-oscar-docdata/issues/51 | |
""" | |
order_status = order.status | |
log.info("Update order: %s (status: %r)", order, order_status) | |
if order_status not in (DocdataOrder.STATUS_NEW, DocdataOrder.STATUS_IN_PROGRESS, DocdataOrder.STATUS_PENDING): | |
raise SuspiciousOperation("Wrong DocData Order status!") | |
super().update_order(order) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment