Entity¶
- class en16931.Entity(name=None, tax_scheme=None, tax_scheme_id=None, country=None, party_legal_entity_id=None, registration_name=None, mail=None, endpoint=None, endpoint_scheme=None, postalzone=None, city=None, address=None, address2=None, province=None)¶
Entity class.
It represents a party involved in the trade described by the invoice, such as seller or buyer party.
You can initialize an Entity with most of its attributes:
>>> e = Entity(name="Acme Inc.", tax_scheme="VAT", ... tax_scheme_id="ES34626691F", country="ES", ... party_legal_entity_id="ES34626691F", ... registration_name="Acme INc.", mail="acme@acme.io", ... endpoint="ES76281415Y", endpoint_scheme="ES:VAT", ... address="easy street", postalzone="08080", ... province="Barcelona, city="Barcelona")
Or you can build it step by step:
>>> e.name = "Acme Inc." >>> e.tax_scheme = "VAT" >>> e.tax_scheme_id = "ES34626691F" >>> e.country = "ES" >>> e.party_legal_entity_id = "ES34626691F" >>> e.registration_name = "Acme INc." >>> e.endpoint = "ES76281415Y" >>> e.endpoint_scheme = "ES:VAT" >>> p = PostalAddress(address="easy street", city_name="Barcelona", ... postal_zone="08080", province="Barcelona", country="ES") >>> e.postal_address = p
You can assign a
PostalAddress
to itspostal_address()
property. You can also associate aBankInfo
instance to an Entity in order to store relevant banking information for debit and transfer payments:>>> bank_info = BankInfo(iban="ES661234563156", bic="AAAABBCCDDD") >>> e.bank_info = bank_info >>> e.bank_info.iban "ES661234563156"
An entity is valid if it has a name, a country, valid ids, valid taxscheme and endpoint, and has an address.
>>> e.is_Valid() True
- __init__(name=None, tax_scheme=None, tax_scheme_id=None, country=None, party_legal_entity_id=None, registration_name=None, mail=None, endpoint=None, endpoint_scheme=None, postalzone=None, city=None, address=None, address2=None, province=None)¶
Initialize an Entity.
TODO formal definition of Entity.
- Parameters:
name (string.) – The name of the Entity.
tax_scheme (string.) – The tax scheme of the Entity.
tax_scheme_id (string.) – The tax ID of the Entity.
country (string.) – Two letter code for the country of the Entity.
party_legal_entity_id (string.) – The party legal entity of the Entity.
registration_name (string.) – The Registration name of the Entity.
mail (string.) – The contact Email of the Entity.
endpoint (string.) – A valid PEPPOL endpoint.
endpoint_scheme (string.) – The scheme defining the endpoint.
postalzone (string.) – The postalzone of the address of the Entity.
city (string.) – The city of the address of the Entity.
address (string.) – The address of the Entity.
address2 (string.) – Additional addres field.
province (string.) – The province of the Entity.
Notes
An entity is valid if it has a name, a country, valid ids, valid taxscheme and endpoint, and has an address.
- __weakref__¶
list of weak references to the object (if defined)
- property bank_info¶
a
BankInfo
instance- Parameters:
bank_info (BankInfo instance) – a valid BankInfo instance.
- Raises:
TypeError – If the parameter is not a BankInfo instance
ValueError – If the BankInfo instance is not valid
- Type:
Property
- property country¶
The country of the entity.
- Parameters:
country (string.) – Two letter code for the country of the Entity.
- Type:
Property
- property endpoint¶
The endpoint ID of the Entity.
- Parameters:
endpoint (string.) – A valid PEPPOL endpoint.
- Type:
Property
- property endpoint_scheme¶
The endpoint scheme of the Entity.
- Parameters:
endpoint_scheme (string.) – The scheme defining the endpoint.
- Type:
Property
- is_valid()¶
Returns True if the Entity is valid.
An entity is valid if it has a name, a country, valid ids, valid taxscheme and endpoint, and has an address.
- property mail¶
The contact mail of the Entity.
- property name¶
The name of the Entity.
- Parameters:
name (string.) – The name for the Entity.
- Type:
Property
- property party_legal_entity_id¶
The party legal entity ID
- property postal_address¶
The PostalAddress of the Entity.
See the
PostalAddress
class.- Parameters:
address (PostalAddress object.) – A PostalAddress instance.
- Raises:
TypeError – if the input is not a PostalAddreess: or a subclass.
- Type:
Property
- property province¶
The province of the entity.
- Parameters:
province (string.) – Code for the province of the Entity.
- Type:
Property
- property registration_name¶
The registration name of the Entity.
- property tax_scheme¶
The tax scheme of the Entity.
- Parameters:
scheme (string.) – The tax scheme used by the Entity.
- Raises:
ValueError – if the tax scheme is not valid.:
- Type:
Property
- property tax_scheme_id¶
The tax ID of the Entity.
- Parameters:
tax_scheme_id (string.) – The tax ID of the Entity.
- Type:
Property