Api reference
components.contracting.public.admin_segment_fr ¶
AdminSegment ¶
Bases: Segment
Segment used for emailing to select Admin users based on their responsibilities within an account and optionally specific companies. TODO @jsagl - AdminSegment should probably be owned and exposed by a component responsible for managing admin/rights
list_recipients ¶
List Admin recipients for account_id provided in settings. Admins are selected based on the responsibilities provided in settings. At least one of account responsibilities or company responsibilities must be provided. If no company_ids are provided but company responsibilities are provided, all companies are considered. If company_ids are provided, only admins with responsibilities for those companies are considered.
Source code in components/contracting/public/admin_segment_fr.py
AdminSegmentSettings
dataclass
¶
AdminSegmentSettings(
account_id,
company_ids=None,
at_least_one_account_responsibilities=None,
at_least_one_company_responsibilities=None,
)
components.contracting.public.customer_insights ¶
components.contracting.public.entities ¶
DocumentProviderType ¶
EmployeeNotificationType ¶
HealthPrices
dataclass
¶
Bases: BaseProductPrices
has_changed ¶
Source code in components/contracting/external/price/fr/health_insurance.py
has_price_decreased ¶
Returns True if the price has decreased compared to the given 'other' price.
So, returns True if no dimensions of the price are greater than its counterpart in the 'other' price and if at least one dimension is lower.
Source code in components/contracting/external/price/fr/health_insurance.py
has_price_increased ¶
Returns True if the price has increase compared to the given 'other' price.
So, returns True if at least one dimension of the price is greater than its counterpart in the 'other' price.
Source code in components/contracting/external/price/fr/health_insurance.py
is_same ¶
InsightsReportType ¶
Bases: AlanBaseEnum
MetricsPerHealthSubscriptionEntity
dataclass
¶
MetricsPerHealthSubscriptionEntity(
account_ref,
subscriptor_ref,
subscription_ref,
contract_size,
n_employees=0,
n_live_primaries=0,
n_live_partners=0,
n_live_children=0,
n_live_families=0,
n_primaries_with_children=0,
n_1st_or_2nd_children=0,
n_live_primaries_option=0,
n_live_partners_option=0,
n_live_families_option=0,
n_1st_or_2nd_children_option=0,
n_primaries_with_children_option=0,
n_live_primaries_option2=0,
n_1st_or_2nd_children_option2=0,
n_primaries_with_children_option2=0,
)
This entity is used to expose the metrics per subscription. These insights are refreshed monthly.
PrevoyancePrices
dataclass
¶
Bases: BaseProductPrices
has_changed ¶
Source code in components/contracting/external/price/fr/prevoyance_insurance.py
has_price_decreased ¶
Returns True if the price has decreased compared to the given 'other' price. So, returns True if no dimensions of the price are greater than its counterpart in the 'other' price and if at least one dimension is lower.
Source code in components/contracting/external/price/fr/prevoyance_insurance.py
has_price_increased ¶
Returns True if the price has increase compared to the given 'other' price. So, returns True if at least one dimension of the price is greater than its counterpart in the 'other' price.
Source code in components/contracting/external/price/fr/prevoyance_insurance.py
SafeCustomerInsightsDashboard
dataclass
¶
Bases: DataClassJsonMixin
SubscriptorLegalStatus ¶
WorkflowRunUpdate
dataclass
¶
WorkflowRunUpdate(
started_at=None,
completed_at=None,
status=None,
document_check_result_status=None,
document_check_result_sub_status=None,
)
components.contracting.public.errors ¶
ProposalErrorCodes ¶
Bases: AlanBaseEnum
all_codes
classmethod
¶
company_has_no_iban
class-attribute
instance-attribute
¶
compliance_with_1_5_rule
class-attribute
instance-attribute
¶
conflicting_proposal_item_exists
class-attribute
instance-attribute
¶
direct_billing_only_work_when_participation_for_children_and_partner_is_zero
class-attribute
instance-attribute
¶
direct_billing_only_work_when_participation_for_children_and_partner_is_zero = "direct_billing_only_work_when_participation_for_children_and_partner_is_zero"
expiration_date_in_past
class-attribute
instance-attribute
¶
health_contract_has_future_amendment
class-attribute
instance-attribute
¶
health_contract_has_no_ongoing_subscription
class-attribute
instance-attribute
¶
health_subscription_not_active_at_prevoyance_start
class-attribute
instance-attribute
¶
health_subscription_not_active_at_prevoyance_start = (
"health_subscription_not_active_at_prevoyance_start"
)
include_due_while_setup_act_is_not_due
class-attribute
instance-attribute
¶
internal_server_error
class-attribute
instance-attribute
¶
invalid_product_for_individual_tns_freelancer
class-attribute
instance-attribute
¶
legacy_contract_cancellation_date
class-attribute
instance-attribute
¶
legacy_health_contract_first_day_of_month
class-attribute
instance-attribute
¶
members_will_be_unsubscribed_from_options_by_default
class-attribute
instance-attribute
¶
members_will_be_unsubscribed_from_options_by_default = (
"members_will_be_unsubscribed_from_options_by_default"
)
new_proposal_item_starts_before_latest_offer_version
class-attribute
instance-attribute
¶
new_proposal_item_starts_before_latest_offer_version = (
"new_proposal_item_starts_before_latest_offer_version"
)
no_manual_renewal_proposal_on_automatic_renewal_account
class-attribute
instance-attribute
¶
no_manual_renewal_proposal_on_automatic_renewal_account = "no_manual_renewal_proposal_on_automatic_renewal_account"
no_subscription_matching_legacy_termination_target
class-attribute
instance-attribute
¶
no_subscription_matching_legacy_termination_target = (
"no_subscription_matching_legacy_termination_target"
)
no_switch_to_affiliation_based_billing
class-attribute
instance-attribute
¶
plan_is_not_compatible_with_one_of_the_target
class-attribute
instance-attribute
¶
proposal_does_not_start_on_first_day_of_month
class-attribute
instance-attribute
¶
proposal_item_has_no_start_date
class-attribute
instance-attribute
¶
proposal_item_product_is_same_as_current
class-attribute
instance-attribute
¶
proposal_start_date_first_day_of_month
class-attribute
instance-attribute
¶
proposal_start_date_in_the_past
class-attribute
instance-attribute
¶
renewal_month_should_be_january
class-attribute
instance-attribute
¶
requested_amendment_offer_is_the_same_as_ongoing_subscription_period
class-attribute
instance-attribute
¶
requested_amendment_offer_is_the_same_as_ongoing_subscription_period = "requested_amendment_offer_is_the_same_as_ongoing_subscription_period"
self_served_amendment_not_implemented
class-attribute
instance-attribute
¶
self_served_proposal_cannot_downgrade_under_commitment
class-attribute
instance-attribute
¶
self_served_proposal_cannot_downgrade_under_commitment = (
"self_served_proposal_cannot_downgrade_under_commitment"
)
self_served_proposal_item_should_have_one_target
class-attribute
instance-attribute
¶
self_served_proposal_item_should_have_one_target = (
"self_served_proposal_item_should_have_one_target"
)
self_served_proposal_policy_not_found_for_individual_user
class-attribute
instance-attribute
¶
self_served_proposal_policy_not_found_for_individual_user = "self_served_proposal_policy_not_found_for_individual_user"
self_served_proposal_user_is_not_individual
class-attribute
instance-attribute
¶
start_date_too_far_in_the_future
class-attribute
instance-attribute
¶
switch_to_dsn_billing
class-attribute
instance-attribute
¶
user_has_no_billing_iban
class-attribute
instance-attribute
¶
user_has_no_birth_date
class-attribute
instance-attribute
¶
user_has_no_ssn_or_ntt
class-attribute
instance-attribute
¶
user_with_active_contract
class-attribute
instance-attribute
¶
user_with_active_exemption
class-attribute
instance-attribute
¶
user_with_policy_not_in_ani
class-attribute
instance-attribute
¶
TerminationErrorCodes ¶
Bases: AlanBaseEnum
cannot_terminate_contract_for_key_account
class-attribute
instance-attribute
¶
cannot_terminate_contract_that_was_already_terminated
class-attribute
instance-attribute
¶
cannot_terminate_contract_that_was_already_terminated = (
"cannot_terminate_contract_that_was_already_terminated"
)
cannot_terminate_health_contract_without_terminating_prevoyance_contract
class-attribute
instance-attribute
¶
cannot_terminate_health_contract_without_terminating_prevoyance_contract = "cannot_terminate_health_contract_without_terminating_prevoyance_contract"
cannot_terminate_unbalanced_contract
class-attribute
instance-attribute
¶
self_termination_not_supported_for_individuals
class-attribute
instance-attribute
¶
self_termination_not_supported_for_individuals = (
"self_termination_not_supported_for_individuals"
)
termination_date_cannot_be_in_the_past
class-attribute
instance-attribute
¶
termination_date_cannot_be_more_than_3_months_from_now
class-attribute
instance-attribute
¶
termination_date_cannot_be_more_than_3_months_from_now = (
"termination_date_cannot_be_more_than_3_months_from_now"
)
user_does_not_have_access_to_all_health_contracts
class-attribute
instance-attribute
¶
user_does_not_have_access_to_all_health_contracts = (
"user_does_not_have_access_to_all_health_contracts"
)
user_does_not_have_access_to_all_prevoyance_contracts
class-attribute
instance-attribute
¶
user_does_not_have_access_to_all_prevoyance_contracts = (
"user_does_not_have_access_to_all_prevoyance_contracts"
)
ValidationContext
dataclass
¶
ValidationContext(
should_bypass_all_warnings=False,
warnings_to_bypass=list(),
warnings_to_consider=list(),
should_bypass_all_blockers=False,
blockers_to_bypass=list(),
noncompliance_acknowledgement_link=None,
should_persist_errors=True,
mark_blockers_as_seen=tuple(),
mark_warnings_as_seen=tuple(),
)
Bases: DataClassJsonMixin
This class is used to configure how the validation warnings & blockers should be handled.
You can define which warnings & blockers should be ignored using their code, or if all of them should be ignored.
Blockers can't be ignored in production mode, this is only provided to made testing easier.
__post_init__ ¶
Source code in components/contracting/utils/validation.py
blockers_to_bypass
class-attribute
instance-attribute
¶
noncompliance_acknowledgement_link
class-attribute
instance-attribute
¶
should_ignore_message ¶
Source code in components/contracting/utils/validation.py
should_mark_as_seen ¶
Source code in components/contracting/utils/validation.py
warnings_to_bypass
class-attribute
instance-attribute
¶
warnings_to_consider
class-attribute
instance-attribute
¶
components.contracting.public.exceptions ¶
components.contracting.public.helpers ¶
controllers ¶
get_contracting_controllers ¶
Source code in components/contracting/public/helpers/controllers.py
components.contracting.public.insights ¶
components.contracting.public.language ¶
get_supported_languages ¶
Gets the supported languages for the given app_name
Source code in components/contracting/public/language.py
components.contracting.public.legal_document ¶
EsAlanEssentialCPInputs ¶
Bases: Inputs
Used to represent inputs needed to render a Spanish Alan Essential CP document
EsAlanEssentialNoticeInputs ¶
EsAlanHealthCPInputCoverageDetails ¶
Used to represent coverage details needed to render a Spanish Alan Health CP document
EsAlanHealthCPInputDates ¶
EsAlanHealthCPInputFlags ¶
EsAlanHealthCPInputs ¶
EsAlanHealthNoticeInputCoverageDetails ¶
Used to represent coverage details needed to render a Spanish Alan Health Notice document
EsAlanHealthNoticeInputDates ¶
Bases: EsNoticeInputDates
Used to represent dates needed to render a Spanish Alan Health Notice document
EsAlanHealthNoticeInputFlags ¶
Used to represent flags needed to render a Spanish Alan Health Notice document
EsAlanHealthNoticeInputs ¶
EsAlanOutpatientCPInputFlags ¶
Bases: EsCPInputFlags
Used to represent flags needed to render a Spanish Alan Outpatient CP document
EsAlanOutpatientCPInputs ¶
Bases: Inputs
Used to represent inputs needed to render a Spanish Alan Outpatient CP document
EsAlanOutpatientNoticeInputFlags ¶
Used to represent flags needed to render a Spanish Alan Outpatient Notice document
EsAlanOutpatientNoticeInputs ¶
EsCGInputFlags ¶
Used to represent flags needed to render a Spanish general conditions document
EsCGInputs ¶
Bases: Inputs
A class used to represent the inputs needed to render CG document for ES Health.
EsCPInputDates ¶
Used to represent shared dates needed to render a Spanish CP document
EsCPInputFlags ¶
EsCPInputReferences ¶
Used to represent references needed to render a Spanish CP document
EsCPOptions ¶
Used to represent options needed to render a Spanish CP document
EsNoticeInputDates ¶
FrCGAANInputs ¶
Bases: Inputs
A class used to represent the inputs needed to render a French CG document.
It differs from FrCGInputs in the sense that it's intended at the association and thus include information about the price and coverage as well as legal content.
FrCGInputs ¶
FrCertificateHealthInputs ¶
FrCompaniesCPHealthInputs ¶
Bases: Inputs
A class used to represent the inputs needed to render Health CP and Notice for companies and collective_retirees segments in France.
FR Health Companies CP: https://docs.google.com/document/d/1a976b0FOF1K69r24xn5-4PphcJJ1MSMTID5ytf83gd0/edit ⧉
FR Health Companies Notice: https://docs.google.com/document/d/1P8fCRYn-uqxOX08qddW7A2NZyxCOqHZI/edit ⧉
FR Health Collective Retirees CP: https://docs.google.com/document/d/1OmugyJpuzjGpf_y234hZi5PqNs5jaKM0DnZD9jP5154/edit ⧉
FR Health Collective Retirees Notice: https://docs.google.com/document/d/1RzhOM67-V-4bJA-3LTL-8XfkRWAqKVua/edit ⧉
TODO: Haven't renamed to avoid too many conflicts for now, but should be renamed to something less specific
get_cache_key ¶
Returns a cache key for the given legal document identifier, None if not applicable.
Source code in components/contracting/subcomponents/legal_document/public/inputs.py
FrCpHealthInputFlags ¶
Used to represent flags needed to render a French health CP document
FrIndivAANHealthInputs ¶
Bases: Inputs
A class used to represent the inputs needed to render Health Notice for individual_tns and individual_evin segments in France.
FR Health Individual Notice:
FrIndivPrivateOrRetireeInputs ¶
Bases: Inputs
Used to represent the inputs needed to render Health Notice for individual_private and individual_retirees segments in France.
FrPrevoyanceInputs ¶
Bases: Inputs
A class used to represent the inputs needed to render Prevoyance for companies and companies_cnp segments in France. FR Prevoyance Companies Notice: https://docs.google.com/document/d/1ez66ziAuLshKMqo7pKLqC57Kj4k_HDhtDmwz3f0VBY0/edit ⧉
Inputs ¶
Base data type to represent the inputs we'll need to render a legal document. See render_legal_document for more details.
This class has the bare minimum that will be needed to resolve/lookup at the right template according to their release policy. Each context might require different inputs, in which case subclassing Inputs is the way.
Those inputs are sent to the relevant legal document context's init function.
document_id
class-attribute
instance-attribute
¶
This ID will be injected in the document template so it's possible to get it back from a PDF, or a merged PDF's specific page. See SIGNED_DOCUMENT_ID_MARKER.
generate_dummy
classmethod
¶
Generates dummy inputs for the given legal document identifier.
This is used to generate previews in the UI.
Source code in components/contracting/subcomponents/legal_document/public/inputs.py
LegalDocumentIdentifier
dataclass
¶
Bases: DataClassJsonMixin
With a legal document identifier, a context will be able to generate the proper template variables, and to fetch the proper document template to render as well.
LegalDocumentIdentifierMatcher ¶
Source code in components/contracting/subcomponents/legal_document/external/contexts/utils.py
__call__ ¶
legal_document_cache ¶
Source code in components/contracting/subcomponents/legal_document/internal/helpers/caching.py
legal_document_overrides ¶
Source code in components/contracting/subcomponents/legal_document/internal/helpers/overrides.py
render_legal_document ¶
render_legal_document(
legal_document_identifier,
inputs,
file_format,
fragment_overrides=NOT_SET,
_include_drafts_only_for_preview=False,
)
Source code in components/contracting/subcomponents/legal_document/internal/actions/rendering.py
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 | |
components.contracting.public.population ¶
components.contracting.public.proposal ¶
ApprovalNotificationType ¶
Bases: AlanBaseEnum
admin_invitation_email_with_signature_redirect
class-attribute
instance-attribute
¶
admin_invitation_email_with_signature_redirect = (
"admin_invitation_email_with_signature_redirect"
)
ApprovalRequest
dataclass
¶
ApprovalRequest(
id,
proposal_id,
approver_first_name,
approver_last_name,
approver_email,
created_at,
signed_bundle_id,
requester_ref,
requester_full_name,
approver_ref,
notification_type,
activity_logs,
is_withdrawn,
is_signed,
approved_at,
auto_approve_after,
document_provider_type,
cc_recipients,
can_be_forwarded,
reminder_scheduled_at,
reminder_sent_at,
onfido_workflow_run_id,
client_signed_at,
)
from_model
classmethod
¶
Source code in components/contracting/subcomponents/proposal/api/entities/approval_request.py
EmployeeNotificationType ¶
FrMemberNotification
dataclass
¶
FrMemberNotification(
notify_members_on_approved,
notification_type,
employee_communication_scheduled_at,
)
from_settings_dict
classmethod
¶
Source code in components/contracting/subcomponents/proposal/plugins/shared/fr/notification.py
to_settings_dict ¶
Source code in components/contracting/subcomponents/proposal/plugins/shared/fr/notification.py
LightProposal
dataclass
¶
LightProposal(
id,
created_at,
creator_ref,
creator_display_name,
subscriptor_names,
state,
proposal_items,
expire_after,
finalizor_ref,
finalizor_display_name,
origin,
tags,
language,
app_name,
name=None,
updated_at=None,
)
__hash__ ¶
from_model
classmethod
¶
Source code in components/contracting/subcomponents/proposal/api/entities/proposal.py
PluginId ¶
Bases: AlanBaseEnum
collective_retiree_individual_health_amendment_fr
class-attribute
instance-attribute
¶
collective_retiree_individual_health_amendment_fr = (
"collective_retiree_individual_health_amendment_fr"
)
collective_retiree_individual_health_subscription_fr
class-attribute
instance-attribute
¶
collective_retiree_individual_health_subscription_fr = (
"collective_retiree_individual_health_subscription_fr"
)
company_retiree_health_amendment_be
class-attribute
instance-attribute
¶
company_retiree_health_subscription_be
class-attribute
instance-attribute
¶
health_amendment_be
class-attribute
instance-attribute
¶
health_amendment_es
class-attribute
instance-attribute
¶
health_amendment_fr
class-attribute
instance-attribute
¶
health_subscription_be
class-attribute
instance-attribute
¶
health_subscription_es
class-attribute
instance-attribute
¶
health_subscription_fr
class-attribute
instance-attribute
¶
individual_health_amendment_be
class-attribute
instance-attribute
¶
individual_health_amendment_fr
class-attribute
instance-attribute
¶
individual_health_subscription_be
class-attribute
instance-attribute
¶
individual_health_subscription_fr
class-attribute
instance-attribute
¶
individual_retiree_health_amendment_be
class-attribute
instance-attribute
¶
individual_retiree_health_subscription_be
class-attribute
instance-attribute
¶
legacy_termination_fr
class-attribute
instance-attribute
¶
prevoyance_amendment_fr
class-attribute
instance-attribute
¶
prevoyance_subscription_fr
class-attribute
instance-attribute
¶
Population
dataclass
¶
Population(
professional_category,
ccn,
activity_type=ActivityType.employed,
is_apec_for_cadres=False,
custom_beneficiary_clause_for_cadres=None,
custom_beneficiary_clause_for_non_cadres=None,
)
Bases: DataClassJsonMixin
__hash__ ¶
__repr__ ¶
ccn
class-attribute
instance-attribute
¶
custom_beneficiary_clause_for_cadres
class-attribute
instance-attribute
¶
custom_beneficiary_clause_for_non_cadres
class-attribute
instance-attribute
¶
do_overlap ¶
Source code in components/contracting/utils/population.py
from_ccn_code
classmethod
¶
Source code in components/contracting/utils/population.py
from_contract_population
classmethod
¶
Source code in components/contracting/utils/population.py
from_model
classmethod
¶
Source code in components/contracting/utils/population.py
is_same_professional_category ¶
Source code in components/contracting/utils/population.py
Proposal
dataclass
¶
Proposal(
id,
created_at,
creator_ref,
creator_display_name,
state,
proposal_items,
approval_requests,
expire_after,
finalizor_ref,
finalizor_display_name,
lifecycle_notifications,
origin,
tags,
errors,
language,
app_name,
subscriptors_in_scope,
name=None,
updated_at=None,
renewal_campaign_name=None,
)
__post_init__ ¶
Source code in components/contracting/subcomponents/proposal/api/entities/proposal.py
can_be_tacitly_approved
property
¶
Tacit approve is something defined for renewal
from_model
classmethod
¶
Source code in components/contracting/subcomponents/proposal/api/entities/proposal.py
get_approval_request ¶
Source code in components/contracting/subcomponents/proposal/api/entities/proposal.py
get_approval_requests ¶
get_approval_requests(
notification_types=None,
is_live=None,
approver_emails=None,
reminder_scheduled_at=None,
document_provider_type=None,
)
Source code in components/contracting/subcomponents/proposal/api/entities/proposal.py
get_proposal_item ¶
Source code in components/contracting/subcomponents/proposal/api/entities/proposal.py
get_proposal_items ¶
Source code in components/contracting/subcomponents/proposal/api/entities/proposal.py
get_proposal_items_for_plugin ¶
Source code in components/contracting/subcomponents/proposal/api/entities/proposal.py
get_proposal_items_for_plugins ¶
get_proposal_items_for_product_ref ¶
Source code in components/contracting/subcomponents/proposal/api/entities/proposal.py
get_targeted_subscription_refs ¶
Source code in components/contracting/subcomponents/proposal/api/entities/proposal.py
get_targeted_subscriptor_refs ¶
has_only_companies ¶
Source code in components/contracting/subcomponents/proposal/api/entities/proposal.py
has_only_individuals ¶
Source code in components/contracting/subcomponents/proposal/api/entities/proposal.py
has_plugin ¶
is_approval_processing
property
¶
A proposal is in approval processing if - it has an approval request that is flagged as signed from client (through the params client_signed_at which is set as soon as the client signs the approval request within our electronic signature provider) - and the proposal is not yet approved (document processed & subscription created / updated)
targets_for_plugins ¶
Source code in components/contracting/subcomponents/proposal/api/entities/proposal.py
ProposalItem
dataclass
¶
ProposalItem(
id,
plugin_id,
name,
start_date,
targets,
product,
proposal_id,
settings,
noncompliance_acknowledgement_link,
created_at,
updated_at,
internal_metadata,
origin,
templates,
)
__post_init__ ¶
Source code in components/contracting/subcomponents/proposal/api/entities/proposal_item.py
differences ¶
Returns a dictionary of differences between this proposal item and another one for the following fields: (name, start_date, product_ref, settings)
- keys are the names of the fields that differ.
- values are tuples representing on previous value and the new one.
Source code in components/contracting/subcomponents/proposal/api/entities/proposal_item.py
does_target_individual_only
property
¶
Returns True if all targets are about individual only.
estimated_signed_pages_count
property
¶
Returns the estimated number of pages that will be generated for this proposal item to be signed.
from_model
classmethod
¶
Source code in components/contracting/subcomponents/proposal/api/entities/proposal_item.py
get_target ¶
Source code in components/contracting/subcomponents/proposal/api/entities/proposal_item.py
get_targets ¶
get_template_by_type ¶
get_templates ¶
get_templates(
documents_types=(
DocumentsType.unsigned_documents,
DocumentsType.signed_documents,
),
template_types=None,
languages=None,
)
Source code in components/contracting/subcomponents/proposal/api/entities/proposal_item.py
is_large
property
¶
Defines when the proposal item is considered as large. This implies that some action might require to be done async.
should_be_approved_before
property
¶
Returns the date before which the proposal item should be approved.
ProposalState ¶
Bases: AlanBaseEnum
active_states
staticmethod
¶
Active states are composed of all states not trashed or archived, ie: not in the bin
Source code in components/contracting/subcomponents/proposal/internals/models/proposal.py
after_waiting_for_approval_states
staticmethod
¶
approved_states
staticmethod
¶
archived_states
staticmethod
¶
blocking_states
staticmethod
¶
Blocking states are states that prevent other proposals with the same targets from being finalized.
Source code in components/contracting/subcomponents/proposal/internals/models/proposal.py
is_approved
staticmethod
¶
non_terminal_states
staticmethod
¶
terminal_states
staticmethod
¶
waiting_for_approval
class-attribute
instance-attribute
¶
SubscriptionType ¶
Bases: AlanBaseEnum
to_contract_type ¶
Source code in components/contracting/external/subscription/api/entities/subscription_type.py
SubscriptorKey
dataclass
¶
SubscriptorLegalStatus ¶
Target
dataclass
¶
Target(
subscriptor_ref,
subscriptor_legal_status,
account_ref,
subscription_ref,
subscription_type,
population,
app_name,
metadata=dict(),
)
Bases: DataClassJsonMixin
__repr__ ¶
Source code in components/contracting/utils/types.py
from_model
classmethod
¶
Source code in components/contracting/utils/types.py
from_subscription
classmethod
¶
Source code in components/contracting/utils/types.py
from_subscription_period
classmethod
¶
Source code in components/contracting/utils/types.py
metadata
class-attribute
instance-attribute
¶
TargetOriginProposal
dataclass
¶
from_model
classmethod
¶
Source code in components/contracting/subcomponents/proposal/api/entities/target_origin_proposal.py
TargetOriginProposalMetadata
dataclass
¶
TargetType ¶
ValidationContext
dataclass
¶
ValidationContext(
should_bypass_all_warnings=False,
warnings_to_bypass=list(),
warnings_to_consider=list(),
should_bypass_all_blockers=False,
blockers_to_bypass=list(),
noncompliance_acknowledgement_link=None,
should_persist_errors=True,
mark_blockers_as_seen=tuple(),
mark_warnings_as_seen=tuple(),
)
Bases: DataClassJsonMixin
This class is used to configure how the validation warnings & blockers should be handled.
You can define which warnings & blockers should be ignored using their code, or if all of them should be ignored.
Blockers can't be ignored in production mode, this is only provided to made testing easier.
__post_init__ ¶
Source code in components/contracting/utils/validation.py
blockers_to_bypass
class-attribute
instance-attribute
¶
noncompliance_acknowledgement_link
class-attribute
instance-attribute
¶
should_ignore_message ¶
Source code in components/contracting/utils/validation.py
should_mark_as_seen ¶
Source code in components/contracting/utils/validation.py
warnings_to_bypass
class-attribute
instance-attribute
¶
warnings_to_consider
class-attribute
instance-attribute
¶
add_proposal_item ¶
add_proposal_item(
proposal_id,
plugin_id,
name,
targets,
product_ref,
start_date,
settings,
templates=None,
internal_metadata=None,
validation_context=None,
commit=True,
)
Source code in components/contracting/subcomponents/proposal/api/main.py
append_activity ¶
append_activity(
approval_request_id,
message,
link=None,
created_at=None,
logged_username=None,
commit=True,
)
Source code in components/contracting/subcomponents/proposal/api/main.py
approve_proposal ¶
Source code in components/contracting/subcomponents/proposal/api/main.py
assign_documents_to_request ¶
assign_documents_to_request(
approval_request_id,
proposal_item_id,
documents,
target,
commit=True,
)
Source code in components/contracting/subcomponents/proposal/api/main.py
auto_approve_proposal ¶
Source code in components/contracting/subcomponents/proposal/api/main.py
build_subscriptions_from_proposal_items ¶
Source code in components/contracting/subcomponents/proposal/api/main.py
cancel_proposal ¶
Flag the proposal as cancelled. It's terminal state and no further action can be done on it.
:param proposal_id: proposal id to cancel :param withdraw_approval_requests: automatically withdraw all approval requests :param commit: commit the changes
Source code in components/contracting/subcomponents/proposal/api/main.py
create_proposal ¶
create_proposal(
creator_ref,
creator_display_name,
subscriptor_scope_refs,
subscriptor_scope_legal_status,
name,
lifecycle_notifications,
origin=None,
tags=None,
commit=True,
language=Lang.french,
app_name=AppName.ALAN_FR,
cancel_after=None,
renewal_campaign_name=None,
)
Source code in components/contracting/subcomponents/proposal/api/main.py
default_lifecycle_notifications ¶
Default lifecycle notifications for a proposal. Slack integration is enabled by default using the proposal creator user firstname.lastname (not robust)
Source code in components/contracting/subcomponents/proposal/views/create_proposal.py
delete_proposal_item ¶
Source code in components/contracting/subcomponents/proposal/api/main.py
duplicate_proposal ¶
Duplicate a proposal and all its items. Notice that target metadata are not duplicated.
Source code in components/contracting/subcomponents/proposal/api/main.py
1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 | |
edit_approval_request ¶
Source code in components/contracting/subcomponents/proposal/api/main.py
edit_proposal ¶
edit_proposal(
proposal_id,
subscriptor_scope_refs,
subscriptor_scope_legal_status,
name,
expire_after,
lifecycle_notifications,
language=Lang.french,
tags=None,
renewal_campaign_name=None,
)
Source code in components/contracting/subcomponents/proposal/api/main.py
edit_proposal_item ¶
edit_proposal_item(
proposal_item_id,
name,
targets,
product_ref,
start_date,
settings,
templates=None,
internal_metadata=None,
validation_context=None,
commit=True,
)
Source code in components/contracting/subcomponents/proposal/api/main.py
edit_proposal_tags ¶
Source code in components/contracting/subcomponents/proposal/api/main.py
finalize_proposal ¶
finalize_proposal(
proposal_id,
finalizor_ref,
finalizor_display_name,
validation_context=None,
commit=True,
)
Source code in components/contracting/subcomponents/proposal/api/main.py
forward_approval_request ¶
forward_approval_request(
approval_request_id,
approver_first_name,
approver_last_name,
approver_email,
requester_id,
)
Source code in components/contracting/subcomponents/proposal/api/main.py
get_all_documents ¶
Best effort to retrieve all documents for an approved proposal. As - we do not store final unsigned document else where than in final subscription (we should) - we do not have any link between proposal and subscription (e.g amendment / prevoyance contract) We can only retrieve document based on the start date of the proposal items.
Source code in components/contracting/subcomponents/proposal/api/main.py
1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 | |
get_proposal ¶
Source code in components/contracting/subcomponents/proposal/api/main.py
get_proposal_alert ¶
Return an alert when a proposal is waiting for approval by the admin.
Can be called with either: - company_id: returns alert for proposals of that company - account_id: returns alert for proposals of all companies in the account
At least one of company_id or account_id must be provided.
Source code in components/contracting/subcomponents/proposal/api/main.py
1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 | |
get_proposal_by_approval_request_id ¶
Source code in components/contracting/subcomponents/proposal/api/main.py
get_proposal_by_proposal_item_id ¶
Source code in components/contracting/subcomponents/proposal/api/main.py
get_proposal_from_target ¶
Return the proposal from a target
Source code in components/contracting/subcomponents/proposal/api/main.py
get_requester_id_by_approval_request_id ¶
Source code in components/contracting/subcomponents/proposal/api/main.py
get_signature_link ¶
Get the link to the signature page for the given approval request.
Source code in components/contracting/subcomponents/proposal/api/main.py
get_target_origin_proposal ¶
Source code in components/contracting/subcomponents/proposal/api/main.py
get_waiting_signature_links ¶
Return the signature links for the given admin, company or user.
:param company_refs: if provided return the signature links for the companies :param user_ref: if provided return the signature links for the user :param approver_emails: if provided return only the signature links where the approver email match :param plugin_ids: if provided return the signature links for the given plugins
Source code in components/contracting/subcomponents/proposal/api/main.py
insert_proposal_item_in_subscription ¶
insert_proposal_item_in_subscription(
subscription,
proposal_item,
source=None,
signature_status=None,
)
Returns a new (non persisted) subscription that includes this proposal item. It inserts the proposal item in the subscription periods list.
Source code in components/contracting/subcomponents/proposal/api/main.py
manual_approve_proposal ¶
manual_approve_proposal(
approval_request_id,
all_documents,
document_types=(DocumentsType.signed_documents,),
commit=True,
)
Source code in components/contracting/subcomponents/proposal/api/main.py
paginate_proposals ¶
paginate_proposals(
page=1,
per_page=100,
proposal_ids=None,
created_by=None,
user_refs=None,
account_refs=None,
company_refs=None,
contract_refs=None,
product_refs=None,
targets=None,
states=None,
origins=None,
proposal_name=None,
plugin_ids=None,
tags=None,
tags_to_exclude=None,
expire_before=None,
cancel_before=None,
max_per_page=100,
app_name=None,
renewal_campaign_name=None,
subscription_type=None,
)
Source code in components/contracting/subcomponents/proposal/api/main.py
274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 | |
process_hellosign_callback ¶
Source code in components/contracting/subcomponents/proposal/api/main.py
register_event ¶
Source code in components/contracting/subcomponents/proposal/api/main.py
request_approval ¶
request_approval(
proposal_id,
approver_first_name,
approver_last_name,
approver_email,
requester_id,
notification_type,
approver_ref=None,
auto_approve_after=None,
is_signable=True,
document_provider_type=DocumentProviderType.hellosign,
cc_recipients=None,
can_be_forwarded=None,
reminder_scheduled_at=None,
require_identity_verification=False,
validation_context=None,
commit=True,
)
Request approval for a proposal.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
proposal_id
|
UUID
|
proposal to request approval for |
required |
approver_*
|
approver's information |
required | |
approver_ref
|
Optional[str]
|
optional reference for the approver when he's an admin (and not an external user) |
None
|
requester_id
|
str
|
id of the user requesting the approval |
required |
notification_type
|
ApprovalNotificationType
|
defines how the approver will be notified (directly by email or just generate a unique link to share) |
required |
auto_approve_after
|
Optional[date]
|
defines when the proposal should be automatically approved if nothing happens |
None
|
is_signable
|
bool
|
defines if the proposal should be signable or not. Documents won't be pushed to HelloSign if False |
True
|
document_provider_type
|
DocumentProviderType
|
defines how the documents will be approved (automatically through hellosign or manually) |
hellosign
|
cc_recipients
|
Optional[list[str]]
|
defines the list of email addresses to be cced on the approval request |
None
|
can_be_forwarded
|
Optional[bool]
|
defines if the approval request can be forwarded to another approver. If None the default behaviour is to allow forwarding. |
None
|
reminder_scheduled_at
|
Optional[date]
|
defines when the reminder should be sent to the approver, no reminder will be sent if None |
None
|
require_identity_verification
|
bool
|
defines if approver should verify their identity |
False
|
Source code in components/contracting/subcomponents/proposal/api/main.py
137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 | |
set_target_metadata ¶
set_target_metadata(
proposal_item_id,
subscriptor_ref,
subscriptor_legal_status,
subscription_ref,
subscription_type,
metadata,
commit=True,
)
Source code in components/contracting/subcomponents/proposal/api/main.py
unregister_event ¶
Source code in components/contracting/subcomponents/proposal/api/main.py
update_proposal_creator ¶
This is only used is rare cases, when 2 users are merged together, and we need to update the creator_ref of the proposals created by the merged user.
Source code in components/contracting/subcomponents/proposal/api/main.py
update_proposal_expire_date ¶
It's only used by self-serve, that is making sure proposals expire 45 days (= PRODUCT_BUILDER_VALIDITY_FOR_SELF_SERVE_IN_DAYS) after its creation date
Source code in components/contracting/subcomponents/proposal/api/main.py
update_proposal_target ¶
This is only used is rare cases, when 2 users are merged together, and we need to replace the user_ref targeted by the proposals by the new_user_ref.
Source code in components/contracting/subcomponents/proposal/api/main.py
view_documents ¶
view_documents(
proposal_id,
proposal_item_ids=None,
targets=None,
documents_types=_ONLY_SIGNED_DOCUMENTS,
template_types=None,
is_preview=True,
approver_first_name=None,
approver_last_name=None,
approver_email=None,
languages=None,
)
Returns a list of documents. :param proposal_id: the proposal id to generate documents for :param proposal_item_ids: returns only documents for the given proposal items :param targets: returns only documents for the given targets :param documents_types: returns only documents of the given types :param template_types: returns only documents of the given template types :param is_preview: defines if the documents should include the signature fields or the preview block :param approver_first_name: the first name of the approver - required if is_preview is False :param approver_last_name: the last name of the approver - required if is_preview is False :param approver_email: the email of the approver - required if is_preview is False :param languages: the languages of the documents
Source code in components/contracting/subcomponents/proposal/api/main.py
1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 | |
withdraw_approval_request ¶
Source code in components/contracting/subcomponents/proposal/api/main.py
components.contracting.public.renewal ¶
get_contractee_renewal_operation ¶
get_contractee_renewal_operation(
account_id=None,
user_id=None,
contractee_renewal_operation_id=None,
campaign_name=None,
app_name=None,
active_campaign=True,
)
Fetches the contractee renewal operation for a given account and renewal year. If the campaign is not found, it raised a RenewalNotFoundException.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
account_id
|
UUID
|
The unique identifier of the account. |
None
|
user_id
|
str
|
The unique identifier of the user. |
None
|
contractee_renewal_operation_id
|
UUID
|
The unique identifier of the account renewal campaign. |
None
|
campaign_name
|
str
|
The name of the campaign. |
None
|
app_name
|
AppName
|
The name of the app. |
None
|
active_campaign
|
bool
|
If True, only active campaign is considered. |
True
|
Source code in components/contracting/subcomponents/renewal/public/contractee_renewal_operation.py
get_contractee_renewal_operation_or_none ¶
get_contractee_renewal_operation_or_none(
account_id=None,
user_id=None,
campaign_name=None,
app_name=None,
active_campaign=True,
)
Fetches the contractee renewal operation for a given account and renewal year. If the campaign is not found, it returns None.
Source code in components/contracting/subcomponents/renewal/public/contractee_renewal_operation.py
is_alternative_renewal ¶
Check if the proposal is an alternative renewal proposal
Source code in components/contracting/subcomponents/renewal/public/proposal.py
is_automatic_renewal ¶
Check if the proposal is an automatic renewal proposal
Source code in components/contracting/subcomponents/renewal/public/proposal.py
is_manual_renewal ¶
Check if the proposal is a manual renewal proposal
Source code in components/contracting/subcomponents/renewal/public/proposal.py
is_renewal_employee_communication ¶
is_renewal_employee_communication(
subscription_period_ref,
subscription_type,
company_id,
professional_category,
)
Check if the communication is a renewal communication :param subscription_period_ref: Either health_contract_version_id or prevoyance_contract_version_ref :param subscription_type: Either health_insurance or prevoyance
Source code in components/contracting/subcomponents/renewal/public/proposal.py
components.contracting.public.self_serve_subscription ¶
self_serve_active_company_proposal_from_user ¶
Self Serve Active Company Proposal From User
Source code in components/contracting/public/self_serve_subscription.py
self_serve_create_or_update_company_proposal_for_user ¶
Create or update a user's company proposal for self-serve.
Source code in components/contracting/public/self_serve_subscription.py
self_serve_individual_proposal_from_user ¶
Self Serve Active Individual Proposal From User
Source code in components/contracting/public/self_serve_subscription.py
components.contracting.public.subscription ¶
api ¶
initialize_subscription ¶
initialize_subscription(
subscription_scope,
owner_type,
owner_ref,
payload_ref=None,
*,
commit=True
)
Source code in components/contracting/public/subscription/api.py
fr ¶
health_insurance ¶
Subscription
dataclass
¶
Bases: Timeline[SubscriptionPeriod]
get_period_by_id ¶
get_status ¶
Source code in components/contracting/external/subscription/api/entities/subscription.py
get_health_subscriptions_for_companies ¶
get_health_subscriptions_for_companies(
*company_ids,
include_ended=False,
include_will_end=True,
include_collective_retiree=False
)
Source code in components/contracting/external/subscription/fr/health_insurance.py
get_ongoing_or_upcoming_health_subscription_for_company ¶
get_ongoing_or_upcoming_health_subscription_for_company(
company_id, include_ended=False, include_will_end=True
)
Source code in components/contracting/public/subscription/fr/health_insurance.py
prevoyance_insurance ¶
get_prevoyance_subscriptions_for_companies ¶
get_prevoyance_subscriptions_for_companies(
*company_ids, include_ended=True, include_will_end=True
)
Source code in components/contracting/external/subscription/fr/prevoyance_insurance.py
188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 | |
subscription ¶
BaseSubscription
dataclass
¶
BaseSubscriptionVersion ¶
Bases: WithValidityPeriod, Protocol
Subscription
dataclass
¶
Subscription(
id,
subscription_scope,
owner_type,
owner_ref,
payload_ref,
validity_period,
versions,
)
Bases: Generic[_T], BaseSubscription
SubscriptionScope ¶
Bases: AlanBaseEnum
Subscription's API can be configured to operate within a specific scope.
fr_legacy_termination
class-attribute
instance-attribute
¶
get_app_name ¶
Returns the app name associated with the subscription scope.
Source code in components/contracting/subcomponents/subscription/public/entities.py
occupational_health
class-attribute
instance-attribute
¶
SubscriptionUpdateModel ¶
Bases: BaseModel
Represents a change in a Subscription.
A subscription is identified by it's scope and reference and isn't materialized in the database through a table.
It records a period of time where subscription properties must apply.
It gives the ability to clear/delete the previously stored information by setting is_deletion to true.
If clients need additional context, we could either add it in the payload OR in a new context JSONB column.
__repr__ ¶
__table_args__
class-attribute
instance-attribute
¶
__table_args__ = (
Index(
"ix_subscription_update_unique_revision_by_reference_by_scope",
subscription_scope,
subscription_ref,
revision,
unique=True,
),
CheckConstraint(
"(is_deletion is true) = (payload_ref is null)",
name="subscription_is_deletion_or_have_payload",
),
{"schema": CONTRACTING_SCHEMA},
)
is_deletion
class-attribute
instance-attribute
¶
operation_ref
class-attribute
instance-attribute
¶
payload_ref
class-attribute
instance-attribute
¶
subscription_ref
class-attribute
instance-attribute
¶
subscription_scope
class-attribute
instance-attribute
¶
SubscriptionVersionModel ¶
Bases: BaseModel
Represents the evolution of the state of a Subscription.
A subscription is identified by it's scope and reference and isn't materialized in the database through a table.
It record the latest knowledge about which properties of the subscription should be active, and when.
__repr__ ¶
__table_args__
class-attribute
instance-attribute
¶
__table_args__ = (
Index(
"ix_subscription_version_scope_subscription_ref",
subscription_scope,
subscription_ref,
),
Index(
"ix_subscription_version_scope_and_payload_ref",
subscription_scope,
payload_ref,
),
ExcludeConstraint(
("subscription_scope", "="),
("subscription_ref", "="),
(
text("daterange(start_date, end_date, '[]')"),
"&&",
),
name="no_overlapping_subscription_version",
using="gist",
),
{"schema": CONTRACTING_SCHEMA},
)
operation_ref
class-attribute
instance-attribute
¶
payload_ref
class-attribute
instance-attribute
¶
subscription
class-attribute
instance-attribute
¶
subscription = relationship(
SubscriptionModel,
primaryjoin=lambda: and_(
subscription_scope == subscription_scope,
foreign(subscription_ref) == cast(id, String),
),
backref=backref(
"subscription_versions",
uselist=True,
order_by=lambda: asc(),
),
uselist=False,
viewonly=True,
)
subscription_ref
class-attribute
instance-attribute
¶
subscription_scope
class-attribute
instance-attribute
¶
admin_tools_contracting_subscriptions_blueprint
module-attribute
¶
admin_tools_contracting_subscriptions_blueprint = (
AdminToolsContractingSubscriptionsBlueprint(
name="admin_tools_contracting_subscriptions",
import_name=__name__,
template_folder="../internal/templates",
static_folder="../internal/static",
)
)
download_prevoyance_legal_document ¶
Source code in components/contracting/external/legal_documents.py
get_subscription ¶
get_subscription_by_id ¶
Source code in components/contracting/subcomponents/subscription/public/queries.py
get_subscription_version_timeline ¶
get_subscription_version_timeline(
subscription_scope,
subscription_ref,
subscription_version_serializer,
)
Source code in components/contracting/subcomponents/subscription/public/queries.py
get_subscription_version_timelines ¶
get_subscription_version_timelines(
subscription_scope,
subscription_refs,
subscription_version_serializer,
subscription_preload_options=tuple(),
payload_preload_options=tuple(),
)
Source code in components/contracting/subcomponents/subscription/public/queries.py
get_subscription_version_updates ¶
Source code in components/contracting/subcomponents/subscription/public/queries.py
get_subscriptions ¶
Source code in components/contracting/subcomponents/subscription/public/queries.py
get_subscriptions_for ¶
get_subscriptions_for(
owner_ref,
subscription_scope,
subscription_version_serializer,
period=None,
)
Return list of subscriptions for a given owner. :param owner_ref: Owner to return subscription to :param subscription_scope: filter subscription on this scope :param subscription_version_serializer: Your serialize for Subscription model :param period: if set, only subscription overlapping this period are returned
:return: GetSubscriptionsResult :raises EmptySubscriptionError: if only empty subscriptions are found
Source code in components/contracting/subcomponents/subscription/public/queries.py
104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 | |
get_subscriptions_for_companies ¶
Source code in components/contracting/external/subscription/fr/queries.py
initialize_subscription ¶
Create a subscription, and a first version matching inputs Subscription reference is returned You should create at least 1 version to the subscription by calling 'record_subscription_updates'
Source code in components/contracting/subcomponents/subscription/internal/actions/initialize_subscribtion.py
list_periods ¶
list_periods(
app_name,
account_id=None,
contract_ids=None,
subscription_type=None,
has_end_date=None,
latest_periods_only=None,
period_date=None,
product_id=None,
)
List subscription periods for a given account.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
account_id
|
UUID
|
The unique identifier of the account. |
None
|
app_name
|
AppName
|
The name of the application. |
required |
subscription_type
|
SubscriptionType
|
The type of subscription to filter by. Sending None will return all subscription types. |
None
|
has_end_date
|
bool
|
Filter periods by whether they have an end date. Defaults to None. |
None
|
latest_periods_only
|
bool
|
If True, only the latest subscription periods are returned. Defaults to None. |
None
|
period_date
|
date
|
The date to filter ongoing periods. This is exclusive with latest_periods_only. Defaults to None. |
None
|
product_id
|
str
|
The product ID to filter periods by. Defaults to None. |
None
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If both period_date and latest_periods_only are provided or both are None. |
Returns:
| Type | Description |
|---|---|
list[SubscriptionPeriod]
|
list[SubscriptionPeriod]: A list of subscription periods matching the criteria. |
Source code in components/contracting/external/subscription/api/queries.py
97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 | |
list_subscribed_products ¶
list_subscribed_products(
account_id,
app_name,
subscription_type=None,
has_end_date=None,
latest_periods_only=None,
period_date=None,
product_id=None,
)
Lists subscription periods grouped by product for a given account.
Returns:
| Type | Description |
|---|---|
list[SubscribedProduct]
|
list[SubscribedProduct]: A list of subscribed products with their associated periods. |
Source code in components/contracting/external/subscription/api/queries.py
record_subscription_updates ¶
Append the ordered updates to the existing subscription, fully rewriting its versions.
Source code in components/contracting/subcomponents/subscription/internal/actions/subscription_updates.py
types ¶
SubscriptionMixin ¶
get_simple_subscription_version_timeline ¶
Source code in components/contracting/subcomponents/subscription/public/mixins/subscription.py
get_subscription_version_timeline ¶
Source code in components/contracting/subcomponents/subscription/public/mixins/subscription.py
preload_subscription_timeline_option
classmethod
¶
Options to preload the graph of needed relationships to later serialize the timeline of subscription version efficiently.
Depending on the serialization function, some extra preload-options might be provided through subscription_options and payload_options.
Example to preload the timeline and get ready to use payload.prevoyance_plan:
PrevoyanceContract.query.options(
PrevoyanceContract.preload_subscription_timeline_options(
payload_options=[joinedload(PrevoyanceSubscriptionPayload.prevoyance_plan)],
)
)
See https://docs.sqlalchemy.org/en/latest/orm/queryguide/columns.html ⧉
Source code in components/contracting/subcomponents/subscription/public/mixins/subscription.py
record_subscription_updates ¶
Source code in components/contracting/subcomponents/subscription/public/mixins/subscription.py
SubscriptionPayloadMixin ¶
SubscriptionScope ¶
Bases: AlanBaseEnum
Subscription's API can be configured to operate within a specific scope.
fr_legacy_termination
class-attribute
instance-attribute
¶
get_app_name ¶
Returns the app name associated with the subscription scope.
Source code in components/contracting/subcomponents/subscription/public/entities.py
occupational_health
class-attribute
instance-attribute
¶
SubscriptionStatusEnum ¶
Bases: AlanBaseEnum
SubscriptionUpdateRequest ¶
SubscriptionVersionSerializer ¶
Bases: Generic[_T], ABC
Describe the kind of parameters our subscription version serializers can receive. The subscription and payload arguments are optional.
__call__
abstractmethod
¶
__call__(
*,
subscription_scope,
subscription_ref,
validity_period,
payload_ref,
operation_ref,
subscription,
payload,
timeline_proxy,
**kwargs
)