Add task for 22nd of month for notifying expring cc
parent
474c959fcf
commit
de96aa0755
|
@ -101,6 +101,18 @@ def update_account_status():
|
|||
|
||||
return errors
|
||||
|
||||
# task run roughly 8 days ahead of card expirations
|
||||
@task
|
||||
def notify_expiring_accounts():
|
||||
from regluit.payment.models import Account
|
||||
from django.contrib.sites.models import Site
|
||||
|
||||
expiring_accounts = Account.objects.filter('EXPIRING')
|
||||
for account in expiring_accounts:
|
||||
notification.send_now([account.user], "account_expiring", {
|
||||
'site':Site.objects.get_current()
|
||||
}, True)
|
||||
|
||||
@task
|
||||
def emit_notifications():
|
||||
logger.info('notifications emitting' )
|
||||
|
|
|
@ -441,7 +441,8 @@ def handle_Account_status_change(sender, instance, raw, **kwargs):
|
|||
|
||||
logger.info( "EXPIRING. send to instance.user: %s site: %s", instance.user,
|
||||
Site.objects.get_current())
|
||||
# fire off an account_expiring notice
|
||||
|
||||
# fire off an account_expiring notice -- might not want to do this immediately
|
||||
|
||||
notification.queue([instance.user], "account_expiring", {
|
||||
'site':Site.objects.get_current()
|
||||
|
|
|
@ -424,7 +424,7 @@ class AccountTest(TestCase):
|
|||
def suite():
|
||||
|
||||
#testcases = [PledgeTest, AuthorizeTest, TransactionTest]
|
||||
testcases = [TransactionTest, CreditTest]
|
||||
testcases = [TransactionTest, CreditTest, AccountTest]
|
||||
suites = unittest.TestSuite([unittest.TestLoader().loadTestsFromTestCase(testcase) for testcase in testcases])
|
||||
return suites
|
||||
|
||||
|
|
|
@ -291,6 +291,12 @@ UPDATE_ACCOUNT_STATUSES = {
|
|||
"args": ()
|
||||
}
|
||||
|
||||
NOTIFY_EXPIRING_ACCOUNTS = {
|
||||
"task": "regluit.core.tasks.notify_expiring_accounts",
|
||||
"schedule": crontab(day_of_month=22, hour=0, minute=30),
|
||||
"args": ()
|
||||
}
|
||||
|
||||
# by default, in common, we don't turn any of the celerybeat jobs on -- turn them on in the local settings file
|
||||
|
||||
# amazon or paypal for now.
|
||||
|
|
|
@ -141,6 +141,7 @@ CELERYBEAT_SCHEDULE['report_new_ebooks'] = EBOOK_NOTIFICATIONS_JOB
|
|||
CELERYBEAT_SCHEDULE['emit_notifications'] = EMIT_NOTIFICATIONS_JOB
|
||||
|
||||
CELERYBEAT_SCHEDULE['update_account_statuses'] = UPDATE_ACCOUNT_STATUSES
|
||||
CELERYBEAT_SCHEDULE['notify_expiring_accounts'] = NOTIFY_EXPIRING_ACCOUNTS
|
||||
|
||||
# set -- sandbox or production Amazon FPS?
|
||||
AMAZON_FPS_HOST = "fps.sandbox.amazonaws.com"
|
||||
|
|
|
@ -141,6 +141,7 @@ CELERYBEAT_SCHEDULE['update_active_campaign_statuses'] = UPDATE_ACTIVE_CAMPAIGN_
|
|||
CELERYBEAT_SCHEDULE['report_new_ebooks'] = EBOOK_NOTIFICATIONS_JOB
|
||||
CELERYBEAT_SCHEDULE['notify_ending_soon'] = NOTIFY_ENDING_SOON_JOB
|
||||
CELERYBEAT_SCHEDULE['update_account_statuses'] = UPDATE_ACCOUNT_STATUSES
|
||||
CELERYBEAT_SCHEDULE['notify_expiring_accounts'] = NOTIFY_EXPIRING_ACCOUNTS
|
||||
|
||||
# set -- sandbox or production Amazon FPS?
|
||||
#AMAZON_FPS_HOST = "fps.sandbox.amazonaws.com"
|
||||
|
|
Loading…
Reference in New Issue