cadrumo.application.ledger.m210_classification module

Assembling one explicit Modelo 210 income classification from operator intent.

M210IncomeClassification is a domain record that only accepts a complete, valid set. Deciding whether the operator supplied one – and whether the transaction they named can carry it at all – is the work in front of that record, and it lived in the CLI option object.

Two rules travel with it. Modelo 210 declares non-resident INCOME, so an outgoing row cannot carry the classification whatever else is supplied. And the four facts that constitute a declaration are answered together or not at all: a code with no rate, or a rate with no gross amount, describes no filing position. Half of one would persist a classification the IRNR projection cannot compute from, which is worse than the operator being told to finish answering.

resolve_m210_income_classification(*, bucket_id, transaction_id, tipo_renta_code=None, gross_income_amount=None, applicable_rate=None, payer_mode=None, payer_id=None, asset_or_right_id=None, transaction_repository=None)[source]

Build the explicit M210 classification the operator asked for, if any.

Parameters:
  • bucket_id (str) – The owning profile bucket.

  • transaction_id (str) – The transaction being classified.

  • tipo_renta_code (str | None) – The two-character official income-type code.

  • gross_income_amount (Decimal | None) – The gross income declared for the row.

  • applicable_rate (Decimal | None) – The rate applied, as a unit proportion.

  • payer_mode (str | M210PayerMode | None) – Single or multiple payer.

  • payer_id (str | None) – The payer, when identified.

  • asset_or_right_id (str | None) – The asset or right the income arises from.

  • transaction_repository (TransactionCatalogueRepositoryProtocol | None) – Injected catalogue; resolved when omitted.

Return type:

M210IncomeClassification | None

Returns:

The classification, or None when no M210 answer was supplied at all.

Raises:

TransactionValidationError – When the four required answers are partially supplied, or the named transaction is absent or not incoming.