aeat.adapters.persistence.profile.bienes_inversion module

Encrypted SQL persistence for the capital-goods IVA regularización register.

The domain.bienes_inversion.BienesInversionIvaRegister document is stored as a FINANCIAL adapters.persistence.storage.SensitivityClass secure object in the primary database through adapters.persistence.storage.SecureObjectRepository. The singleton namespace, default object key, schema version, and custody contracts come from adapters.persistence.storage.PROFILE_BIENES_INVERSION_IVA_REGISTER_NAMESPACE.

The register is authoritative primary state (the operator declares each tracked capital good), not a rebuildable cache; it therefore carries a strict save/load/equality roundtrip plus an anti-tautology proof.

See also

domain.bienes_inversion

Typed register payload models persisted here.

adapters.persistence.profile.assets

Sibling profile-local secure-object adapter whose shape this mirrors.

load_bienes_inversion_register()[source]

Load the register, returning an empty register when absent.

Return type:

BienesInversionIvaRegister

Returns:

Persisted BienesInversionIvaRegister, or an empty one when no envelope exists.

save_bienes_inversion_register(register)[source]

Persist register as a governed FINANCIAL-class encrypted envelope.

Parameters:

register (BienesInversionIvaRegister) – Register document to encrypt and write.

Return type:

Path

Returns:

Logical secure-object marker for the persisted register.

declare_bien_inversion(record)[source]

Atomically add record to the encrypted register.

Parameters:

record (BienInversionIvaRecord) – Capital-good record to insert.

Return type:

BienesInversionIvaRegister

Returns:

The updated BienesInversionIvaRegister including the new record.

class BienesInversionIvaRegisterRepository(*, bucket_id=None, objects=None)[source]

Bases: object

Governed repository for the encrypted register singleton.

The singleton row is owned by adapters.persistence.storage.PROFILE_BIENES_INVERSION_IVA_REGISTER_NAMESPACE and persisted through adapters.persistence.storage.SecureObjectRepository.

Parameters:
property envelope_path: Path

Logical path retained for callers that display the storage target.

load()[source]

Load the register, returning an empty document when absent.

Return type:

BienesInversionIvaRegister

Returns:

Decrypted BienesInversionIvaRegister.

Raises:

BienInversionRecordError – When the envelope exists but cannot be loaded or decrypted.

save(register)[source]

Persist register as FINANCIAL-class ciphertext.

Parameters:

register (BienesInversionIvaRegister) – Register document to encrypt and write.

Return type:

None

add(record)[source]

Atomically add record and refuse duplicate identifiers.

Parameters:

record (BienInversionIvaRecord) – Capital-good record to insert.

Return type:

BienesInversionIvaRegister

Returns:

The BienesInversionIvaRegister including the new record.

Raises:

BienInversionRecordError – When a record with the same identifier already exists.