def migration_task(): for config in EWSGhanaConfig.get_all_steady_sync_configs(): if config.enabled: endpoint = GhanaEndpoint.from_config(config) ews_bootstrap_domain(EWSApi(config.domain, endpoint)) stock_data_task.delay( EWSStockDataSynchronization(config.domain, endpoint))
def migration_task(): for config in EWSGhanaConfig.get_all_steady_sync_configs(): if config.enabled: endpoint = GhanaEndpoint.from_config(config) ews_bootstrap_domain(EWSApi(config.domain, endpoint)) apis = ( ('stock_transaction', sync_stock_transactions), ) stock_data_task.delay(config.domain, endpoint, apis, config, EWS_FACILITIES)
def ews_sync_stock_data(request, domain): apis = ( ('stock_transaction', sync_stock_transactions), ) config = EWSGhanaConfig.for_domain(domain) domain = config.domain endpoint = GhanaEndpoint.from_config(config) stock_data_task.delay(domain, endpoint, apis, config, EWS_FACILITIES) return HttpResponse('OK')
def ews_stock_data_task(domain): ewsghana_config = EWSGhanaConfig.for_domain(domain) domain = ewsghana_config.domain endpoint = GhanaEndpoint.from_config(ewsghana_config) commtrack_settings_sync(domain, LOCATION_TYPES) for product in endpoint.get_products(): sync_ilsgateway_product(domain, product) get_locations(domain, endpoint, EWS_FACILITIES) get_product_stock(domain, endpoint, EWS_FACILITIES) get_stock_transaction(domain, endpoint, EWS_FACILITIES)
def fix_users_with_more_than_one_phone_number(domain): config = EWSGhanaConfig.for_domain(domain) endpoint = GhanaEndpoint.from_config(config) ews_api = EWSApi(domain, endpoint) offset = 0 _, smsusers = endpoint.get_smsusers(filters={'with_more_than_one_number': True}) while smsusers: for sms_user in smsusers: ews_api.sms_user_sync(sms_user) offset += 100 _, smsusers = endpoint.get_smsusers(filters={'with_more_than_one_number': True}, offset=offset)
def migrate_email_settings(domain): config = EWSGhanaConfig.for_domain(domain) endpoint = GhanaEndpoint.from_config(config) migrate_email = EmailSettingsSync(domain) for report in endpoint.get_daily_reports()[1]: migrate_email.daily_report_sync(report) for report in endpoint.get_weekly_reports()[1]: migrate_email.weekly_report_sync(report) for report in endpoint.get_monthly_reports()[1]: migrate_email.monthly_report_sync(report)
def ews_bootstrap_domain_task(domain): ews_config = EWSGhanaConfig.for_domain(domain) commtrack_settings_sync(domain, LOCATION_TYPES) return bootstrap_domain(ews_config, GhanaEndpoint.from_config(ews_config), EXTENSIONS, fetch_groups=False)
def ews_bootstrap_domain_task(domain): ews_config = EWSGhanaConfig.for_domain(domain) return bootstrap_domain(EWSApi(domain, GhanaEndpoint.from_config(ews_config)))
def endpoint(self): return GhanaEndpoint.from_config(EWSGhanaConfig.for_domain(self.domain))
def balance_migration_task(domain): endpoint = GhanaEndpoint.from_config(EWSGhanaConfig.for_domain(domain)) BalanceMigration(domain, endpoint).balance_email_reports()
def ews_fix_sms_users(request, domain): config = EWSGhanaConfig.for_domain(domain) endpoint = GhanaEndpoint.from_config(config) sms_users_fix.delay(EWSApi(domain=domain, endpoint=endpoint)) return HttpResponse('OK')
def ews_add_products_to_locs(request, domain): config = EWSGhanaConfig.for_domain(domain) endpoint = GhanaEndpoint.from_config(config) add_products_to_loc.delay(EWSApi(domain=domain, endpoint=endpoint)) return HttpResponse('OK')
def ews_sync_stock_data(request, domain): config = EWSGhanaConfig.for_domain(domain) domain = config.domain endpoint = GhanaEndpoint.from_config(config) stock_data_task.delay(EWSStockDataSynchronization(domain, endpoint)) return HttpResponse('OK')
def migration_task(): for config in EWSGhanaConfig.get_all_steady_sync_configs(): if config.enabled: endpoint = GhanaEndpoint.from_config(config) ews_bootstrap_domain(EWSApi(config.domain, endpoint)) stock_data_task.delay(EWSStockDataSynchronization(config.domain, endpoint))
def migration_task(): configs = EWSGhanaConfig.get_all_configs() for config in configs: if config.enabled: ews_bootstrap_domain(EWSApi(config.domain, GhanaEndpoint.from_config(config)))
def migration_task(): configs = EWSGhanaConfig.get_all_configs() for config in configs: if config.enabled: commtrack_settings_sync(config.domain, LOCATION_TYPES) ils_bootstrap_domain(config, GhanaEndpoint.from_config(config), EXTENSIONS)
def ews_bootstrap_domain_task(domain): ews_config = EWSGhanaConfig.for_domain(domain) return bootstrap_domain( EWSApi(domain, GhanaEndpoint.from_config(ews_config)))
def ews_resync_web_users(request, domain): config = EWSGhanaConfig.for_domain(domain) endpoint = GhanaEndpoint.from_config(config) resync_web_users.delay(EWSApi(domain=domain, endpoint=endpoint)) return HttpResponse('OK')
def ews_resync_passwords(request, domain): config = EWSGhanaConfig.for_domain(domain) endpoint = GhanaEndpoint.from_config(config) resync_webusers_passwords_task.delay(config, endpoint) return HttpResponse('OK')
def endpoint(self): from custom.ewsghana.api import GhanaEndpoint return GhanaEndpoint.from_config(EWSGhanaConfig.for_domain( self.domain))
def endpoint(self): from custom.ewsghana.api import GhanaEndpoint return GhanaEndpoint.from_config(EWSGhanaConfig.for_domain(self.domain))