Skip to content

Commit

Permalink
support for notification on pay
Browse files Browse the repository at this point in the history
  • Loading branch information
joamag committed Mar 28, 2016
1 parent 440afc1 commit ddb1d95
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/budy/controllers/api/order.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def pay(self, key):
data = appier.request_json()
empty_bag = self.field("empty_bag", True, cast = bool)
order = budy.Order.get(key = key, rules = False)
order.pay_s(data)
order.pay_s(data, notify = True)
bag = budy.Bag.from_session()
if empty_bag and bag: bag.empty_bag_s()
order = order.reload(map = True)
Expand Down
3 changes: 2 additions & 1 deletion src/budy/models/order.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,10 +163,11 @@ def verify(self):
appier.verify(self.paid == False)
appier.verify(self.date == None)

def pay_s(self, payment_data):
def pay_s(self, payment_data, notify = False):
self.verify()
self._pay_stripe(payment_data)
self.mark_paid_s()
if notify: self.notify_s()

@appier.operation(name = "Notify")
def notify_s(self):
Expand Down

0 comments on commit ddb1d95

Please sign in to comment.