Edit Order Notification Util Classes¶
Application Dependencies¶
-
class
util.application_dependencies.ApplicationDependencies(application_credentials_name='storepick_edit_order', config_credentials_name='storepick_config_service')[source]¶ -
not_found_message= 'was not found in configuration retrieved from configuration service'¶
-
__init__(application_credentials_name='storepick_edit_order', config_credentials_name='storepick_config_service')[source]¶ Application Dependencies class
- Parameters
application_credentials_name (str) – Default=storepick_edit_order name of parameter store on ssm for the app
config_credentials_name (str) – Default=storepick_config_service name of parameter store on ssm for config service
-
execute(environment='dev', name_of_configuration='storepick-edit-order-notification.json')[source]¶ Method to load all the initialise the dependencies can raise many errors always use in try catch
- Parameters
environment (str) – Default=dev The environment the application is running in
name_of_configuration (str) – Default=storepick-edit-order-notification.json The name of the configuration to be loaded from config service
- Returns
True on successful execution
- Return type
bool
-
get_configuration_from_config_service(name_of_configuration)[source]¶ Gets the configuration from the config service using the credentials created when executed
- Returns
Configuration from config service
- Return type
json
- Raises
NotExecutedError – If the dependencies have not been initialised
-
get_google_big_query_client()[source]¶ Enables the big query client to be initialised and configured for use with the table from config
- Returns
Initialised bigquery client with credentials
- Return type
google.cloud.bigquery.client.Client
- Raises
NotExecutedError – If the dependencies have not been initialised
-
get_default_logger()[source]¶ Enables the default/console logger to use within the app for logging processes
- Returns
default/console logger
- Return type
logging.Logger
-
get_monitoring_logger()[source]¶ Enables the monitoring logger to use within the app for logging monitoring processes
- Returns
monitor logger
- Return type
logging.Logger
-
get_cut_off_tomorrow_data_set()[source]¶ Finds the bigquery data set name from the application configuration
- Returns
Name of the bigquery data set found in the config
- Return type
str
- Raises
NotExecutedError – If dependencies have not been initialised
ConfigurationException – If data set is not found within the config
-
get_cut_off_tomorrow_table()[source]¶ Finds the bigquery table name from the application configuration
- Returns
Name of the bigquery table found in the config
- Return type
str
- Raises
NotExecutedError – If dependencies have not been initialised
ConfigurationException – If table is not found within the config
-
get_application_credentials()[source]¶ Finds the ssm application credentials for osp
- Returns
The ssm key value pairs stored in aws for the application
- Return type
json
- Raises
NotExecutedError – If dependencies have not been initialised
-
get_report_table()[source]¶ Finds the bigquery report table name from the application configuration
- Returns
Name of the bigquery report table found in the config
- Return type
str
- Raises
NotExecutedError – If dependencies have not been initialised
ConfigurationException – If report table is not found within the config
-
get_email_template_id()[source]¶ Finds the marketing email template id from the application configuration
- Returns
Template id of the marketing email
- Return type
str
- Raises
NotExecutedError – If dependencies have not been initialised
ConfigurationException – If template id is not found within the config
-
get_sms_message()[source]¶ Finds the sms message to send from the application configuration
- Returns
message content to send by sms to the customer
- Return type
str
- Raises
NotExecutedError – If dependencies have not been initialised
ConfigurationException – If sms message is not found within the config
-
Customer API Data Formatter¶
-
class
util.customer_api_data_formatter.CustomerDataFormatter(application_dependencies)[source]¶ -
__init__(application_dependencies)[source]¶ - Parameters
application_dependencies (util.application_dependencies.ApplicationDependencies) – Application dependency object used for DI
-
remove_any_non_digit_characters_from_phone_number(number)[source]¶ - Parameters
number (str) – Number to remove any non integer characters from
- Returns
The formatted number with only integers
- Return type
str
- Raises
NumberFormatWrongLengthError – When the extracted numbers is not the length of 10 or 11
NumberFormatError – When a number can not be formatted e.i. not type string
-
Customer Data Validator¶
-
class
util.customer_data_validator.CustomerDataValidator(application_dependencies)[source]¶ -
__init__(application_dependencies)[source]¶ Class to handle the validation
- Parameters
application_dependencies (util.application_dependencies.ApplicationDependencies) – Application dependency object used for DI
-