Snippets

CashStar NI-4860 Send Account Activation Email to Imported Clients

You are viewing an old version of this snippet. View the current version.
Revised by Robbie Robinson b29e4ad
"""
This script looks up all clients for a merchant created within a datetime range and sends the activation e-mail
"""

from datetime import datetime

from bulk.models import BulkAccount

def client_import_ordering_pricing_update(merchant_code, cutoff_date_start, cutoff_date_end=None):
    # All of the merchant's clients which excludes THE merchant client
    clients_queryset = BulkAccount.objects.filter(
        effective_merchant__merchant_code=merchant_code,
        created__gte=cutoff_date_start,
        created__lte=cutoff_date_end or datetime.now(),
        bulk_merchant__isnull=True
    )

    for client in clients_queryset:
        client.notifications.enqueue_bulk_acct_activate_message()
        

# Example usage:
my_merchant_code = 'BLOOMIN'
my_cutoff_date_start = datetime(2018, 7, 26, 1, 0, 0)
my_cutoff_date_end = datetime(2018, 8, 29, 23, 59, 59)

client_import_ordering_pricing_update(my_merchant_code, my_cutoff_date_start, my_cutoff_date_end)
HTTPS SSH

You can clone a snippet to your computer for local editing. Learn more.