def send_followup_notif_monthly_fee_payment(user, event_name, previous_month, amount, app_name, link, event_id):
    """
    Send follow up notifications for monthly fee payment.
    :param user:
    :param event_name:
    :param previous_month:
    :param amount:
    :param app_name:
    :param link:
    :param event_id:
    :return:
    """
    message_settings = MessageSettings.query.filter_by(action=SESSION_ACCEPT_REJECT).first()
    if not message_settings or message_settings.notification_status == 1:
        actions = get_monthly_payment_follow_up_notification_actions(event_id, link)
        notification = NOTIFS[MONTHLY_PAYMENT_FOLLOWUP_NOTIF]
        title = notification['title'].format(date=previous_month,
                                             event_name=event_name)
        message = notification['message'].format(
            event_name=event_name,
            date=previous_month,
            amount=amount,
            app_name=app_name
        )

        send_notification(user, title, message, actions)
def send_followup_notif_monthly_fee_payment(user, event_name, previous_month,
                                            amount, app_name, link, event_id):
    """
    Send follow up notifications for monthly fee payment.
    :param user:
    :param event_name:
    :param previous_month:
    :param amount:
    :param app_name:
    :param link:
    :param event_id:
    :return:
    """
    message_settings = MessageSettings.query.filter_by(
        action=SESSION_ACCEPT_REJECT).first()
    if not message_settings or message_settings.notification_status == 1:
        actions = get_monthly_payment_follow_up_notification_actions(
            event_id, link)
        notification = NOTIFS[MONTHLY_PAYMENT_FOLLOWUP_NOTIF]
        title = notification['title'].format(date=previous_month,
                                             event_name=event_name)
        message = notification['message'].format(event_name=event_name,
                                                 date=previous_month,
                                                 amount=amount,
                                                 app_name=app_name)

        send_notification(user, title, message, actions)
示例#3
0
    def test_monthly_pay_followup_notification(self):
        """Method to test the actions associated with a follow up notification of monthly payments."""

        with self.app.test_request_context():
            request_url = 'https://localhost/e/345525/payment'
            request_event_id = 1
            response = get_monthly_payment_follow_up_notification_actions(
                request_event_id, request_url)
            expected_action = NotificationAction(subject='invoice',
                                                 link=request_url,
                                                 subject_id=request_event_id,
                                                 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)