Skip to content

Api reference

components.member_lifecycle.public.commands

generate_frontend_types_file

generate_frontend_typescript_types_files

generate_frontend_typescript_types_files(dry_run)

Use flask generate_frontend_typescript_types_files --execute to generate the frontend typescript types.

  • File: "frontend/modules/member-lifecycle/add-dependents/src/queryTypes.ts"
  • Types: all enums and entities
Source code in components/member_lifecycle/public/commands/generate_frontend_types_file.py
@member_lifecycle_commands.command()
@command_with_dry_run
def generate_frontend_typescript_types_files(dry_run: bool) -> None:
    """
    Use `flask generate_frontend_typescript_types_files --execute` to generate the frontend typescript types.

    - File: "frontend/modules/member-lifecycle/add-dependents/src/queryTypes.ts"
    - Types: all enums and entities
    """
    from shared.codegen.typescript import (
        generate_typescript_enums_and_interfaces,
    )

    generate_typescript_enums_and_interfaces(
        target_filename_path_from_git_root="frontend/modules/member-lifecycle/add-dependents/src/queryTypes.ts",
        types_to_generate=[
            # Enums
        ],
        dry_run=dry_run,
    )

components.member_lifecycle.public.consts

MEMBER_LIFECYCLE_COMPONENT_NAME module-attribute

MEMBER_LIFECYCLE_COMPONENT_NAME = 'member_lifecycle'

components.member_lifecycle.public.dependencies

AddDependentsDependency

AddDependentsDependency(price_provider)

AddDependentsDependency defines the interface that apps using the add_dependents subcomponent need to implement

Source code in components/member_lifecycle/subcomponents/add_dependents/protected/dependencies.py
def __init__(self, price_provider: PriceProvider):
    self.price_provider = price_provider

can_add_dependents

can_add_dependents(user_id, start_date)

The method will return True if the user can add dependents

Source code in components/member_lifecycle/subcomponents/add_dependents/protected/dependencies.py
def can_add_dependents(self, user_id: str, start_date: date) -> bool:
    """The method will return True if the user can add dependents"""
    raise NotImplementedError()

contract_allows_partner

contract_allows_partner(user_id, at_date)

The method will return True if the primary's contract allows to add a partner

Source code in components/member_lifecycle/subcomponents/add_dependents/protected/dependencies.py
def contract_allows_partner(self, user_id: str, at_date: date) -> bool:
    """The method will return True if the primary's contract allows to add a partner"""
    raise NotImplementedError()

create_dependent

create_dependent(user_id, payload)

The method will create the dependent for the primary user. Returns: The insurance profile ID of the created dependent.

Source code in components/member_lifecycle/subcomponents/add_dependents/protected/dependencies.py
def create_dependent(
    self,
    user_id: str,
    payload: CreateDependentPayload,
) -> str | None:
    """
    The method will create the dependent for the primary user.
    Returns:
        The insurance profile ID of the created dependent.
    """
    raise NotImplementedError()

get_age_boundaries_by_dependent_type

get_age_boundaries_by_dependent_type(user_id, at_date=None)

The method will return the age boundaries of a dependent for the user Boundaries are included, meaning the dependent age should be withing those boundaries, including the boundaries.

Source code in components/member_lifecycle/subcomponents/add_dependents/protected/dependencies.py
def get_age_boundaries_by_dependent_type(
    self, user_id: str, at_date: date | None = None
) -> DependentsAgeBoundaries:
    """
    The method will return the age boundaries of a dependent for the user
    Boundaries are included, meaning the dependent age should be withing those boundaries,
    including the boundaries.
    """
    raise NotImplementedError()

get_beneficiaries_linked_to_user_on

get_beneficiaries_linked_to_user_on(
    user_id,
    on_date=None,
    enrollment_type=None,
    include_future=False,
)

The method will return the beneficiaries linked to the user coverage on a specific date. The beneficiaries contain the primary and their dependents.

Source code in components/member_lifecycle/subcomponents/add_dependents/protected/dependencies.py
def get_beneficiaries_linked_to_user_on(
    self,
    user_id: str,
    on_date: date | None = None,
    enrollment_type: EnrollmentType | None = None,
    include_future: bool = False,
) -> list[BeneficiaryInfo]:
    """
    The method will return the beneficiaries linked to the user coverage on a specific date.
    The beneficiaries contain the primary and their dependents.
    """
    raise NotImplementedError()

get_child_account_minimum_age

get_child_account_minimum_age()

Returns the minimum age required for a child dependent to have an Alan account. Returns None if child dependents are not allowed to have accounts.

Source code in components/member_lifecycle/subcomponents/add_dependents/protected/dependencies.py
def get_child_account_minimum_age(self) -> int | None:
    """
    Returns the minimum age required for a child dependent to have an Alan account.
    Returns None if child dependents are not allowed to have accounts.
    """
    raise NotImplementedError()

get_debt_balance

get_debt_balance(user_id, on_date)

The method will return the debt balance in cents for the user.

Source code in components/member_lifecycle/subcomponents/add_dependents/protected/dependencies.py
def get_debt_balance(self, user_id: str, on_date: date) -> int:
    """
    The method will return the debt balance in cents for the user.
    """
    raise NotImplementedError()

get_default_coverage_module

get_default_coverage_module(user_id, at_date)

Returns the default coverage module that will be applied to new dependents

Source code in components/member_lifecycle/subcomponents/add_dependents/protected/dependencies.py
def get_default_coverage_module(
    self, user_id: str, at_date: date
) -> DefaultCoverageModuleInfo | None:
    """
    Returns the default coverage module that will be applied to new dependents
    """
    raise NotImplementedError()

get_dependent_tax_benefit_type

get_dependent_tax_benefit_type(user_id, on_date)

The method will return the dependent tax benefit type if eligible else returns None.

Source code in components/member_lifecycle/subcomponents/add_dependents/protected/dependencies.py
def get_dependent_tax_benefit_type(
    self,
    user_id: str,
    on_date: date,
) -> DependentTaxBenefitType | None:
    """
    The method will return the dependent tax benefit type if eligible else returns None.
    """
    raise NotImplementedError()

get_health_contract_info

get_health_contract_info(
    user_id, on_date, new_dependent_birth_date=None
)

The method will return the user's health contract info, including affiliation delay if present

Source code in components/member_lifecycle/subcomponents/add_dependents/protected/dependencies.py
def get_health_contract_info(
    self,
    user_id: str,
    on_date: date,
    new_dependent_birth_date: date | None = None,
) -> HealthContractInfo:
    """The method will return the user's health contract info, including affiliation delay if present"""
    raise NotImplementedError()

get_household_declaration

get_household_declaration(user_id, at_date)

The method will return the household declaration data for the user.

Source code in components/member_lifecycle/subcomponents/add_dependents/protected/dependencies.py
def get_household_declaration(
    self,
    user_id: str,
    at_date: date,
) -> HouseholdDeclaration:
    """
    The method will return the household declaration data for the user.
    """
    raise NotImplementedError()

get_minimum_coverage_months

get_minimum_coverage_months()

The method will return the minimum number of months of coverage required for the dependent.

Source code in components/member_lifecycle/subcomponents/add_dependents/protected/dependencies.py
def get_minimum_coverage_months(self) -> int | None:
    """
    The method will return the minimum number of months of coverage required for the dependent.
    """
    raise NotImplementedError()

get_past_dependents

get_past_dependents(user_id, on_date, birthdate=None)

This method will return the past dependents of the user, relative to the start date of the current or next affiliation on on_date and, if provided, with a specific birthdate. It will exclude dependents that are active on or after on_date.

Source code in components/member_lifecycle/subcomponents/add_dependents/protected/dependencies.py
def get_past_dependents(
    self, user_id: str, on_date: date, birthdate: date | None = None
) -> list[PastDependent]:
    """
    This method will return the past dependents of the user, relative to the start
    date of the current or next affiliation on on_date and, if provided, with a specific birthdate.
    It will exclude dependents that are active on or after on_date.
    """
    raise NotImplementedError()

get_past_dependents_national_identification

get_past_dependents_national_identification(
    past_dependents,
)

The method will return the SSN of a past dependent.

Source code in components/member_lifecycle/subcomponents/add_dependents/protected/dependencies.py
def get_past_dependents_national_identification(
    self, past_dependents: list[PastDependent]
) -> list[NationalIdentification]:
    """
    The method will return the SSN of a past dependent.
    """
    raise NotImplementedError()

get_possible_start_dates

get_possible_start_dates(
    user_id,
    new_dependent_birth_date,
    coverage_start_date_scenario,
    at_date=None,
    existing_dependent_user_id=None,
)

The method will return the possible coverage start dates for the user.

Source code in components/member_lifecycle/subcomponents/add_dependents/protected/dependencies.py
def get_possible_start_dates(
    self,
    user_id: str,
    new_dependent_birth_date: date,
    coverage_start_date_scenario: CoverageStartDateScenario,
    at_date: date | None = None,
    existing_dependent_user_id: str | None = None,
) -> list[date]:
    """
    The method will return the possible coverage start dates for the user.
    """
    raise NotImplementedError()

get_prices_and_conditions_config

get_prices_and_conditions_config(user_id)

The method will return the features enablement for prices and conditions

Source code in components/member_lifecycle/subcomponents/add_dependents/protected/dependencies.py
def get_prices_and_conditions_config(
    self, user_id: str
) -> PricesAndConditionsConfig:
    """The method will return the features enablement for prices and conditions"""
    raise NotImplementedError()

is_primary_focus_enabled

is_primary_focus_enabled(user_id, on_date)

The method will return whether the primary focus feature is enabled or not.

Source code in components/member_lifecycle/subcomponents/add_dependents/protected/dependencies.py
def is_primary_focus_enabled(self, user_id: str, on_date: date) -> bool:
    """
    The method will return whether the primary focus feature is enabled or not.
    """
    raise NotImplementedError()

price_provider instance-attribute

price_provider = price_provider

require_gender

require_gender()

The method will return whether the add dependent flow requires a gender to be provided.

Source code in components/member_lifecycle/subcomponents/add_dependents/protected/dependencies.py
def require_gender(self) -> bool:
    """
    The method will return whether the add dependent flow requires a gender to be provided.
    """
    raise NotImplementedError()

should_request_payment_method_for_user_subscription

should_request_payment_method_for_user_subscription(
    user_id,
    on_date,
    new_dependent_birth_date=None,
    new_dependent_enrollment_type=None,
    declared_income_in_cents=None,
)

The method will return whether we should request payment method for the user's subscription.

Source code in components/member_lifecycle/subcomponents/add_dependents/protected/dependencies.py
def should_request_payment_method_for_user_subscription(
    self,
    user_id: str,
    on_date: date,
    new_dependent_birth_date: date | None = None,
    new_dependent_enrollment_type: BeneficiaryEnrollmentType | None = None,
    declared_income_in_cents: int | None = None,
) -> bool:
    """
    The method will return whether we should request payment method for the user's subscription.
    """
    raise NotImplementedError()

upload_identification_certificate_for_user

upload_identification_certificate_for_user(
    user_id, attestation_file, on_date=None
)

Upload an identification file for a given user.

Source code in components/member_lifecycle/subcomponents/add_dependents/protected/dependencies.py
def upload_identification_certificate_for_user(
    self,
    user_id: str,
    attestation_file: FileStorage,
    on_date: date | None = None,
) -> None:
    """
    Upload an identification file for a given user.
    """
    raise NotImplementedError()

upsert_household_declaration

upsert_household_declaration(
    user_id, has_partner, has_children, effective_date
)

The method will create the household declaration for the user.

Source code in components/member_lifecycle/subcomponents/add_dependents/protected/dependencies.py
def upsert_household_declaration(
    self,
    user_id: str,
    has_partner: bool,
    has_children: bool,
    effective_date: date,
) -> None:
    """
    The method will create the household declaration for the user.
    """
    raise NotImplementedError()

MemberLifecycleDependency

MemberLifecycleDependency(add_dependents)

MemberLifecycleDependency defines the interface that apps using the member_lifecycle component need to implement

Source code in components/member_lifecycle/internal/dependencies/member_lifecycle.py
def __init__(self, add_dependents: AddDependentsDependency):
    self.add_dependents = add_dependents

add_dependents instance-attribute

add_dependents = add_dependents

merge_users

merge_users(
    source_user_id, target_user_id, actor_id, commit=True
)

The method will merge the source user into the target user and return some logs about the changes

Source code in components/member_lifecycle/internal/dependencies/member_lifecycle.py
def merge_users(
    self,
    source_user_id: str,
    target_user_id: str,
    actor_id: str | None,
    commit: bool = True,
) -> list[str]:
    """The method will merge the source user into the target user and return some logs about the changes"""
    raise NotImplementedError()

NationalIdentification dataclass

NationalIdentification(user_id, type=None, number=None)

Bases: DataClassJsonMixin

Represents the national registration type and number Example for FR: - type = SSN - number = 189059912035995

number class-attribute instance-attribute

number = None

type class-attribute instance-attribute

type = None

user_id instance-attribute

user_id

PastDependent dataclass

PastDependent(user_id, profile_id)

Represents dependent user information returned by the get_past_dependents method

profile_id instance-attribute

profile_id

user_id instance-attribute

user_id

set_app_dependency

set_app_dependency(dependency)

Sets the member_lifecycle dependency to the app so it can be accessed within this component at runtime

Source code in components/member_lifecycle/internal/dependencies/member_lifecycle.py
def set_app_dependency(dependency: MemberLifecycleDependency) -> None:
    """Sets the member_lifecycle dependency to the app so it can be accessed within this component at runtime"""
    from flask import current_app

    cast("CustomFlask", current_app).add_component_dependency(
        MEMBER_LIFECYCLE_COMPONENT_NAME, dependency
    )

components.member_lifecycle.public.entities

AffiliationDelay dataclass

AffiliationDelay(
    threshold_months,
    duration_months,
    new_dependent_coverage_start_date=None,
)

Bases: DataClassJsonMixin

duration_months instance-attribute

duration_months

new_dependent_coverage_start_date class-attribute instance-attribute

new_dependent_coverage_start_date = None

threshold_months instance-attribute

threshold_months

AgeBoundaries dataclass

AgeBoundaries(min, max)

Bases: DataClassJsonMixin

Represents the min and max age of a dependent.

max instance-attribute

max

min instance-attribute

min

BeneficiaryInfo dataclass

BeneficiaryInfo(
    identification_type,
    identification_id,
    first_name,
    beneficiary_type,
    birth_date=None,
    user_id=None,
)

Bases: DataClassJsonMixin

beneficiary_type instance-attribute

beneficiary_type

birth_date class-attribute instance-attribute

birth_date = None

first_name instance-attribute

first_name

identification_id instance-attribute

identification_id

identification_type instance-attribute

identification_type

user_id class-attribute instance-attribute

user_id = None

CoverageModuleInfo dataclass

CoverageModuleInfo(
    coverage_module_name,
    coverages,
    is_upgrade,
    partner_price=None,
    child_price=None,
)

Bases: DataClassJsonMixin

child_price class-attribute instance-attribute

child_price = None

coverage_module_name instance-attribute

coverage_module_name

coverages instance-attribute

coverages

is_upgrade instance-attribute

is_upgrade

partner_price class-attribute instance-attribute

partner_price = None

CoverageStartDateScenario

Bases: AlanBaseEnum

Scenarios for determining coverage start date for new dependents - newborn_within_2_months = the dependent is a newborn born within 2 months of the current date - newborn_more_2_months = the dependent is a newborn born more than 2 months of the current date - onboarding_month = the add dependent occurs during the 1st month of the primary coverage (onboarding month) - default_scenario = refers to all other scenarios execpt the ones mentioned above - unique = refers to the others countries than France, where there is only one coverage start date option

The wording of the ENUMS matters
  • It is used in the frontend screen to pick the right description

default_scenario class-attribute instance-attribute

default_scenario = 'default'

newborn_more_2_months class-attribute instance-attribute

newborn_more_2_months = 'newborn_more_2_months'

newborn_within_2_months class-attribute instance-attribute

newborn_within_2_months = 'newborn_within_2_months'

onboarding_month class-attribute instance-attribute

onboarding_month = 'onboarding_month'

unique class-attribute instance-attribute

unique = 'unique'

CoverageType

Bases: AlanBaseEnum

CoverageType describes each class of guarantee.

Note: "ambulatory" means "daily care" + "dental".

ASSISTANCE_ABROAD class-attribute instance-attribute

ASSISTANCE_ABROAD = 'assistance_abroad'

DAILY_CARE class-attribute instance-attribute

DAILY_CARE = 'ambulatory'

DENTAL class-attribute instance-attribute

DENTAL = 'dental'

HOSPITALIZATION class-attribute instance-attribute

HOSPITALIZATION = 'hospitalization'

PRE_POST class-attribute instance-attribute

PRE_POST = 'pre_post'

SEVERE_ILLNESS class-attribute instance-attribute

SEVERE_ILLNESS = 'severe_illness'

CreateDependentPayload dataclass

CreateDependentPayload(
    dependent_user_id,
    first_name,
    last_name,
    birth_date,
    coverage_start_date,
    type,
    gender=None,
    coverage_module_name=None,
    settlement_iban=None,
    ssn=None,
    referent_ssns=None,
    selected_income_bracket_data=None,
    income_brackets_data=None,
    birth_ranks=None,
    supplementary_insurance=False,
)

birth_date instance-attribute

birth_date

birth_ranks class-attribute instance-attribute

birth_ranks = None

coverage_module_name class-attribute instance-attribute

coverage_module_name = None

coverage_start_date instance-attribute

coverage_start_date

dependent_user_id instance-attribute

dependent_user_id

first_name instance-attribute

first_name

gender class-attribute instance-attribute

gender = field(default=None, metadata={'by_value': True})

income_brackets_data class-attribute instance-attribute

income_brackets_data = None

last_name instance-attribute

last_name

referent_ssns class-attribute instance-attribute

referent_ssns = None

selected_income_bracket_data class-attribute instance-attribute

selected_income_bracket_data = None

settlement_iban class-attribute instance-attribute

settlement_iban = None

ssn class-attribute instance-attribute

ssn = None

supplementary_insurance class-attribute instance-attribute

supplementary_insurance = False

type instance-attribute

type

DefaultCoverageModuleInfo dataclass

DefaultCoverageModuleInfo(coverage_module_name, coverages)

Bases: DataClassJsonMixin

coverage_module_name instance-attribute

coverage_module_name

coverages instance-attribute

coverages

DependentSpecs dataclass

DependentSpecs(
    dependent_birthdate,
    dependent_type,
    dependent_coverage_module_name=None,
    start_date=None,
)

dependent_birthdate instance-attribute

dependent_birthdate

dependent_coverage_module_name class-attribute instance-attribute

dependent_coverage_module_name = None

dependent_type instance-attribute

dependent_type

start_date class-attribute instance-attribute

start_date = None

DependentsAgeBoundaries dataclass

DependentsAgeBoundaries(partner, child)

Bases: DataClassJsonMixin

Represents the age boundaries of dependents depending on their type.

child instance-attribute

child

partner instance-attribute

partner

HealthContractInfo dataclass

HealthContractInfo(
    dependents_participation,
    waiting_period,
    affiliation_delay,
    primary_coverage_start_date,
    is_direct_billing,
    is_partner_coverage_mandatory,
    is_children_coverage_mandatory,
    retroactive_affiliation_window,
)

Bases: DataClassJsonMixin

The fields will be None if the information cannot be matched to the expected dataclass.

affiliation_delay instance-attribute

affiliation_delay

dependents_participation instance-attribute

dependents_participation

is_children_coverage_mandatory instance-attribute

is_children_coverage_mandatory

is_direct_billing instance-attribute

is_direct_billing

is_partner_coverage_mandatory instance-attribute

is_partner_coverage_mandatory

primary_coverage_start_date instance-attribute

primary_coverage_start_date

retroactive_affiliation_window instance-attribute

retroactive_affiliation_window

waiting_period instance-attribute

waiting_period

HouseholdDeclaration dataclass

HouseholdDeclaration(
    has_partner, has_children, effective_date
)

Bases: DataClassJsonMixin

effective_date instance-attribute

effective_date

has_children instance-attribute

has_children

has_partner instance-attribute

has_partner

IdentificationFlowType

Bases: AlanBaseEnum

Type of identification flow.

ssn class-attribute instance-attribute

ssn = 'ssn'

NewDependentsPriceBreakdown dataclass

NewDependentsPriceBreakdown(
    total_policy_price, new_dependent_price
)

Bases: DataClassJsonMixin

Represents the price breakdown for a new dependent.

new_dependent_price instance-attribute

new_dependent_price

total_policy_price instance-attribute

total_policy_price

The total price of all the policy members + new dependent

Price dataclass

Price(
    currency,
    amount=None,
    min_amount=None,
    max_amount=None,
    min_discounted_amount=None,
    max_discounted_amount=None,
    tooltip_keys=None,
    tooltip_params=None,
)

Bases: DataClassJsonMixin

Source code in components/member_lifecycle/subcomponents/prices/internal/domain/entities/dependent_price.py
def __init__(
    self,
    currency: str,
    amount: Optional[AmountInCents] = None,
    min_amount: Optional[AmountInCents] = None,
    max_amount: Optional[AmountInCents] = None,
    min_discounted_amount: Optional[AmountInCents] = None,
    max_discounted_amount: Optional[AmountInCents] = None,
    tooltip_keys: Optional[list[str]] = None,
    tooltip_params: Optional[dict[str, Any]] = None,
):
    if amount is not None:
        self.min_amount = self.max_amount = amount
    elif min_amount is not None and max_amount is not None:
        self.min_amount = min_amount
        self.max_amount = max_amount
    else:
        raise ValueError(
            "Provide either `amount` or both (`min_amount` and `max_amount`)."
        )
    self.currency = currency
    self.min_discounted_amount = min_discounted_amount
    self.max_discounted_amount = max_discounted_amount
    self.tooltip_keys = tooltip_keys
    self.tooltip_params = tooltip_params
    self.__post_init__()

__post_init__

__post_init__()
Source code in components/member_lifecycle/subcomponents/prices/internal/domain/entities/dependent_price.py
def __post_init__(self) -> None:
    self.is_fixed_price = self.min_amount == self.max_amount
    self.is_free = self.min_amount == 0 and self.max_amount == 0

currency instance-attribute

currency = currency

is_fixed_price class-attribute instance-attribute

is_fixed_price = field(init=False)

is_free class-attribute instance-attribute

is_free = field(init=False)

max_amount instance-attribute

max_amount

max_discounted_amount class-attribute instance-attribute

max_discounted_amount = max_discounted_amount

min_amount instance-attribute

min_amount

min_discounted_amount class-attribute instance-attribute

min_discounted_amount = min_discounted_amount

tooltip_keys class-attribute instance-attribute

tooltip_keys = tooltip_keys

tooltip_params class-attribute instance-attribute

tooltip_params = tooltip_params

PricesAndConditionsConfig dataclass

PricesAndConditionsConfig(
    child_covered_until_max_age,
    membership,
    fr_social_security,
    be_social_security,
    be_fiscally_dependent_age,
    has_mandatory_dependents_coverage,
    show_prices_link,
)

Bases: DataClassJsonMixin

Configuration for the PricesAndConditions component.

be_fiscally_dependent_age instance-attribute

be_fiscally_dependent_age

be_social_security instance-attribute

be_social_security

child_covered_until_max_age instance-attribute

child_covered_until_max_age

fr_social_security instance-attribute

fr_social_security

has_mandatory_dependents_coverage instance-attribute

has_mandatory_dependents_coverage

membership instance-attribute

membership
show_prices_link

RetroactiveAffiliationWindow dataclass

RetroactiveAffiliationWindow(
    start_date,
    window_duration_in_days,
    end_date=isodate_field(),
)

Bases: DataClassJsonMixin

end_date class-attribute instance-attribute

end_date = isodate_field()

start_date instance-attribute

start_date

window_duration_in_days instance-attribute

window_duration_in_days

WaitingPeriod dataclass

WaitingPeriod(
    duration_in_months,
    start_date=isodate_field(),
    end_date=isodate_field(),
)

Bases: DataClassJsonMixin

Represents the waiting period for health contract.

duration_in_months instance-attribute

duration_in_months

end_date class-attribute instance-attribute

end_date = isodate_field()

start_date class-attribute instance-attribute

start_date = isodate_field()

components.member_lifecycle.public.enums

CoverageStartDateScenario

Bases: AlanBaseEnum

Scenarios for determining coverage start date for new dependents - newborn_within_2_months = the dependent is a newborn born within 2 months of the current date - newborn_more_2_months = the dependent is a newborn born more than 2 months of the current date - onboarding_month = the add dependent occurs during the 1st month of the primary coverage (onboarding month) - default_scenario = refers to all other scenarios execpt the ones mentioned above - unique = refers to the others countries than France, where there is only one coverage start date option

The wording of the ENUMS matters
  • It is used in the frontend screen to pick the right description

default_scenario class-attribute instance-attribute

default_scenario = 'default'

newborn_more_2_months class-attribute instance-attribute

newborn_more_2_months = 'newborn_more_2_months'

newborn_within_2_months class-attribute instance-attribute

newborn_within_2_months = 'newborn_within_2_months'

onboarding_month class-attribute instance-attribute

onboarding_month = 'onboarding_month'

unique class-attribute instance-attribute

unique = 'unique'

DependentTaxBenefitType

Bases: AlanBaseEnum

Global enum to determine which tax benefit the dependent is eligible to. The list is expected to evolved with future tax benefits.

The wording of the ENUMS matters
  • It is used in the frontend screen to pick the right information to display

madelin class-attribute instance-attribute

madelin = 'madelin'

NationalIdentificationTypes

Bases: AlanBaseEnum

Types of national identification numbers used across countries.

Each country has its own identification system for social security/healthcare: - ssn: Social Security Number (France - NumΓ©ro de SΓ©curitΓ© Sociale) - nrn: National Registration Number (Belgium - Rijksregisternummer) [future] - nie: Foreigner Identification Number (Spain - NΓΊmero de Identidad de Extranjero) [future] - sin: Social Insurance Number (Canada) [future]

This enum will expand as Alan operates in more countries.

ssn class-attribute instance-attribute

ssn = 'ssn'

components.member_lifecycle.public.ports

PriceProvider

get_dependents_price_breakdown

get_dependents_price_breakdown(
    user_id,
    dependent_specs,
    on_date,
    declared_income_in_cents=None,
)

Returns the price breakdown for a new dependent. This is used to display the prices when adding a new dependent.

Source code in components/member_lifecycle/subcomponents/prices/internal/domain/ports/price_provider.py
def get_dependents_price_breakdown(
    self,
    user_id: str,
    dependent_specs: DependentSpecs,
    on_date: date,
    declared_income_in_cents: Optional[int] = None,
) -> NewDependentsPriceBreakdown:
    """
    Returns the price breakdown for a new dependent.
    This is used to display the prices when adding a new dependent.
    """
    raise NotImplementedError()

components.member_lifecycle.public.queries

has_existing_partner

has_existing_partner(user_id, at_date=None)
Source code in components/member_lifecycle/subcomponents/add_dependents/internal/beneficiaries/queries.py
def has_existing_partner(
    user_id: str,
    at_date: date | None = None,
) -> bool:
    existing_partner = first_or_none(
        get_beneficiaries_linked_to_user_on(
            user_id=user_id,
            on_date=at_date,
            enrollment_type=EnrollmentType.partner,
            include_future=True,
        )
    )
    return bool(existing_partner)

has_reached_maximum_number_of_dependents

has_reached_maximum_number_of_dependents(
    user_id, at_date=None
)
Source code in components/member_lifecycle/subcomponents/add_dependents/internal/beneficiaries/queries.py
def has_reached_maximum_number_of_dependents(
    user_id: str,
    at_date: date | None = None,
) -> bool:
    beneficiaries = get_beneficiaries_linked_to_user_on(
        user_id=user_id,
        on_date=at_date,
        include_future=True,
    )
    return len(beneficiaries) >= MAX_NUMBER_OF_DEPENDENTS

should_trigger_household_not_declared_notification

should_trigger_household_not_declared_notification(user_id)
Source code in components/member_lifecycle/subcomponents/add_dependents/internal/household_declaration/queries.py
def should_trigger_household_not_declared_notification(user_id: str) -> bool:
    if get_current_app_name() == AppName.ALAN_FR:
        return should_trigger_household_not_declared_notification_FR(user_id)
    return False