pyconsk/django-konfera

Order status change notification

ricco386 opened this issue · 2 comments

Let's build a feature that will allow notify about orders.

When new order is created, or the status has changed we can do a post with some data.

Let's define setting:

ORDER_NOTIFICATION = {
   'server': 'http://127.0.0.1',
}

Default:

ORDER_NOTIFICATION = None

In model we create status_change_notification function, that will check if setting is set and if so will do a post to server. We should figurout the way that admin can customize the content. Initial post data could be:

{
    'uuid': self.uuid, 
    'status': self.status,
    ... 
} 

Several services support, incoming hooks, when post is done is correct. We need to figure out easy way to modify what is going to be send. For example Slack would support message:

{
    "text": "This is a line of text.\nAnd this is another one."
}

One thing that comes to my mind is to have ORDER_NOTIFICATION as a strore it as a string that we can convert to json and post. In string we can uaselly add support for order model attributes.

This is just a first draft of the functionality, comments and suggestions are welcome.

Where would we use this feature?

This might be a neat feature, for example it might be able to post data to slack (similar to webhooks on github).

However but at this point we dont need it and I am closing this issue.