def send_notif_ticket_purchase_organizer(user, invoice_id, order_url, event_name, subject_id): """Send notification with order invoice link after purchase""" actions = get_ticket_purchased_organizer_notification_actions( subject_id, order_url) send_notification(user=user, title=NOTIFS[TICKET_PURCHASED_ORGANIZER]['title'].format( invoice_id=invoice_id, event_name=event_name), message=NOTIFS[TICKET_PURCHASED_ORGANIZER]['message'], actions=actions)
def send_notif_ticket_purchase_organizer(user, order): """Send notification with order invoice link after purchase""" actions = get_ticket_purchased_organizer_notification_actions( order.identifier, order.site_view_link) send_notification( user=user, title=NOTIFS[TICKET_PURCHASED_ORGANIZER]['title'].format( invoice_id=order.invoice_number, event_name=order.event.name), message=NOTIFS[TICKET_PURCHASED_ORGANIZER]['message'], actions=actions, )
def send_notif_ticket_purchase_organizer(user, invoice_id, order_url, event_name, subject_id): """Send notification with order invoice link after purchase""" actions = get_ticket_purchased_organizer_notification_actions(subject_id, order_url) send_notification( user=user, title=NOTIFS[TICKET_PURCHASED_ORGANIZER]['title'].format( invoice_id=invoice_id, event_name=event_name ), message=NOTIFS[TICKET_PURCHASED_ORGANIZER]['message'], actions=actions )
def test_ticket_purchase_organizer(self): """Method to test the actions associated with a notification of tickets purchased for the event organizer.""" with self.app.test_request_context(): request_url = 'https://localhost/e/345525/order' request_order_id = 1 response = get_ticket_purchased_organizer_notification_actions( request_order_id, request_url) expected_action = NotificationAction(subject='order', subject_id=request_order_id, link=request_url, action_type='view') expected_action = [expected_action] expected_length = len(expected_action) response_length = len(response) self.assertIsInstance(response, list) self.assertEqual(expected_action[0].subject, response[0].subject) self.assertEqual(expected_length, response_length)