def email_trailcard_follow_up(): """ Function to test sending follow up emails the day after a trial class :return: """ if (not web2pytest.is_running_under_test(request, request.application) and not auth.has_membership(group_id='Admins')): redirect(URL('default', 'user', args=['not_authorized'])) ost = OsSchedulerTasks() return ost.email_trailcard_follow_up()
def email_teachers_sub_requests_daily_summary(): """ Function to expose class & method used by scheduler task to create send a daily summary available classes for subbing """ if (not web2pytest.is_running_under_test(request, request.application) and not auth.has_membership(group_id='Admins')): redirect(URL('default', 'user', args=['not_authorized'])) ost = OsSchedulerTasks() return ost.email_teachers_sub_requests_daily_summary()
def test_recreate_customer_thumbnails(): """ Function to expose class & method used by scheduler task to recreate customer thumbnails """ if ( not web2pytest.is_running_under_test(request, request.application) and not auth.has_membership(group_id='Admins') ): redirect(URL('default', 'user', args=['not_authorized'])) ost = OsSchedulerTasks() return ost.recreate_customer_thumbnails()
def email_reminders_teachers_sub_request_open(): """ Function to test sending reminders to teachers forclasses where they requestest a subteacher, which hasn't been found yet. :return: """ if (not web2pytest.is_running_under_test(request, request.application) and not auth.has_membership(group_id='Admins')): redirect(URL('default', 'user', args=['not_authorized'])) ost = OsSchedulerTasks() return ost.email_reminders_teachers_sub_request_open()
def test_extend_validity(): """ Function to expose class & method used by scheduler task to create monthly invoices """ if (not web2pytest.is_running_under_test(request, request.application) and not auth.has_membership(group_id='Admins')): redirect(URL('default', 'user', args=['not_authorized'])) ost = OsSchedulerTasks() valid_on = request.vars['valid_on'] days_to_add = request.vars['days_to_add'] return ost.customers_classcards_extend_validity(valid_on, days_to_add)
def test_add_subscription_credits_for_month(): """ Function to expose class & method used by scheduler task to add subscription credits for a given month """ if (not web2pytest.is_running_under_test(request, request.application) and not auth.has_membership(group_id='Admins')): redirect(URL('default', 'user', args=['not_authorized'])) ost = OsSchedulerTasks() year = request.vars['year'] month = request.vars['month'] return ost.customers_subscriptions_add_credits_for_month(year, month)
def test_memberships_renew_expired(): """ Function to expose class & method used by scheduler task to create monthly invoices """ if ( not web2pytest.is_running_under_test(request, request.application) and not auth.has_membership(group_id='Admins') ): redirect(URL('default', 'user', args=['not_authorized'])) ost = OsSchedulerTasks() year = request.vars['year'] month = request.vars['month'] ost.customers_memberships_renew_expired(year, month)
def test_create_invoices(): """ Function to expose class & method used by scheduler task to create monthly invoices """ if (not web2pytest.is_running_under_test(request, request.application) and not auth.has_membership(group_id='Admins')): redirect(URL('default', 'user', args=['not_authorized'])) ost = OsSchedulerTasks() year = request.vars['year'] month = request.vars['month'] description = request.vars['description'] invoice_date = request.vars['invoice_date'] or 'today' return ost.customers_subscriptions_create_invoices_for_month( year, month, description, invoice_date)
def sync_invoices(): """ :return: """ from openstudio.os_scheduler_tasks import OsSchedulerTasks osst = OsSchedulerTasks() result = osst.exact_online_sync_invoices() return result # def relation_get(): # code = '6929' # # import pprint # # from ConfigParser import NoOptionError # from openstudio.os_exact_online import OSExactOnline # from exactonline.http import HTTPError # # os_eo = OSExactOnline() # api = os_eo.get_api() # # # result = api.bankaccounts.all() # result = api.relations.filter(relation_code=code) # # pp = pprint.PrettyPrinter(depth=6) # pp.pprint(result) # # return 'success' # # # def bankaccount_get(): # accountID = "b8d78262-e8f3-4cca-a19b-daa8a3fdb6aa" # # import pprint # # from ConfigParser import NoOptionError # from openstudio.os_exact_online import OSExactOnline # from exactonline.http import HTTPError # # os_eo = OSExactOnline() # storage = os_eo.get_storage() # api = os_eo.get_api() # # # result = api.bankaccounts.all() # result = api.bankaccounts.filter(account=accountID) # # pp = pprint.PrettyPrinter(depth=6) # pp.pprint(result) # # return 'success' # # # def ddm_get(): # accountID = "b8d78262-e8f3-4cca-a19b-daa8a3fdb6aa" # reference = '487543587461' # # import pprint # # from ConfigParser import NoOptionError # from openstudio.os_exact_online import OSExactOnline # from exactonline.http import HTTPError # # os_eo = OSExactOnline() # storage = os_eo.get_storage() # api = os_eo.get_api() # # # result = api.bankaccounts.all() # # result = api.directdebitmandates.filter(account=accountID) # result = api.directdebitmandates.filter(reference=reference) # # pp = pprint.PrettyPrinter(depth=6) # pp.pprint(result) # # return 'success' # def bankaccount_create(): # eoID = "e984cfcb-80c9-46d7-b6b2-b2b6e60d09fb" # # from ConfigParser import NoOptionError # from openstudio.os_exact_online import OSExactOnline # from exactonline.http import HTTPError # # os_eo = OSExactOnline() # storage = os_eo.get_storage() # api = os_eo.get_api() # # bank_account_dict = { # 'Account': eoID, # 'BankAccount': 'NL21INGB0009355195' # } # # result = api.bankaccounts.create(bank_account_dict) # # pp = pprint.PrettyPrinter(depth=6) # pp.pprint(result) # return result # def bankaccount_update(): # eoID = "e984cfcb-80c9-46d7-b6b2-b2b6e60d09fb" # # from ConfigParser import NoOptionError # from openstudio.os_exact_online import OSExactOnline # from exactonline.http import HTTPError # # os_eo = OSExactOnline() # storage = os_eo.get_storage() # api = os_eo.get_api() # # bank_account_dict = { # 'Account': eoID, # 'BankAccount': 'NL21INGB0009355195' # } # # print api.bankaccounts.update(bank_account_dict) # api.restv1(POST('crm/BankAccounts', bank_account_dict))
send_mail_failed(cs.auth_customer_id) failed += 1 # For scheduled tasks, db has to be committed manually db.commit() return T("Payments collected") + ': ' + str(success) + '<br>' + \ T("Payments failed to collect") + ': ' + str(failed) def scheduler_task_test(): return 'success!' os_scheduler_tasks = OsSchedulerTasks() scheduler_tasks = { 'daily': task_openstudio_daily, 'customers_subscriptions_create_invoices_for_month': os_scheduler_tasks.customers_subscriptions_create_invoices_for_month, 'customers_subscriptions_add_credits_for_month': os_scheduler_tasks.customers_subscriptions_add_credits_for_month, 'customers_membership_renew_expired': os_scheduler_tasks.customers_memberships_renew_expired, 'customers_subscriptions_collect_mollie_recurring_current_month': task_mollie_subscription_invoices_and_payments, 'email_reminders_teachers_sub_request_open': os_scheduler_tasks.email_reminders_teachers_sub_request_open, 'email_teachers_sub_requests_daily_summary': os_scheduler_tasks.email_teachers_sub_requests_daily_summary,