3

‘ã\#  ã               @   s$   G d d„ de ƒZG dd„ deƒZdS )c               @   s   e Zd ZdZdS )ÚTaxNotKnownzw
    Exception for when a tax-inclusive price is requested but we don't know
    what the tax applicable is (yet).
    N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__© r   r   ú,/var/www/html/oscar2019/oscar/core/prices.pyr      s   r   c               @   sD   e Zd ZdZddd„Zdd„ Zdd„ ZeeeƒZd	d
„ Z	dd„ Z
dS )ÚPriceaI  
    Simple price class that encapsulates a price and its tax information

    Attributes:
        incl_tax (Decimal): Price including taxes
        excl_tax (Decimal): Price excluding taxes
        tax (Decimal): Tax amount
        is_tax_known (bool): Whether tax is known
        currency (str): 3 character currency code
    Nc             C   sL   || _ || _|d k	r"|| _d| _n&|d k	r<|| | _d| _nd | _d| _d S )NTF)ÚcurrencyÚexcl_taxÚincl_taxÚis_tax_known)Úselfr	   r
   r   Útaxr   r   r   Ú__init__   s    
zPrice.__init__c             C   s   | j | j S )N)r   r
   )r   r   r   r   Ú_get_tax!   s    zPrice._get_taxc             C   s   | j | | _d| _d S )NT)r
   r   r   )r   Úvaluer   r   r   Ú_set_tax$   s    zPrice._set_taxc             C   s:   | j r$d| jj| j| j| j| jf S d| jj| j| jf S )Nz1%s(currency=%r, excl_tax=%r, incl_tax=%r, tax=%r)z%s(currency=%r, excl_tax=%r))r   Ú	__class__r   r	   r
   r   r   )r   r   r   r   Ú__repr__*   s    zPrice.__repr__c             C   s$   | j |j ko"| j|jko"| j|jkS )zX
        Two price objects are equal if currency, price.excl_tax and tax match.
        )r	   r
   r   )r   Úotherr   r   r   Ú__eq__2   s    zPrice.__eq__)NN)r   r   r   r   r   r   r   Úpropertyr   r   r   r   r   r   r   r      s   


r   N)Ú	Exceptionr   Úobjectr   r   r   r   r   Ú<module>   s   