3

‘ã\÷  ã               @   sP   d dl mZ G dd„ deƒZG dd„ deƒZG dd„ deƒZG dd	„ d	eƒZd
S )é    )Úpricesc               @   s@   e Zd ZdZdZdZdZdZedd„ ƒZ	dZ
dZdZdd„ ZdS )ÚBasez<
    The interface that any pricing policy must support
    FNc             C   s   | j S )N)Úexcl_tax)Úself© r   ú4/var/www/html/oscar2019/oscar/apps/partner/prices.pyÚeffective_price   s    zBase.effective_pricec             C   s   d| j j| jf S )Nz%s(%r))Ú	__class__Ú__name__Ú__dict__)r   r   r   r   Ú__repr__$   s    zBase.__repr__)r
   Ú
__module__Ú__qualname__Ú__doc__ÚexistsÚis_tax_knownr   Úincl_taxÚpropertyr   ÚtaxZretailÚcurrencyr   r   r   r   r   r      s   r   c               @   s   e Zd ZdZdS )ÚUnavailablezl
    This should be used as a pricing policy when a product is unavailable and
    no prices are known.
    N)r
   r   r   r   r   r   r   r   r   (   s   r   c               @   s6   e Zd ZdZdZd
dd„Zedd„ ƒZedd	„ ƒZdS )Ú
FixedPriceas  
    This should be used for when the price of a product is known in advance.

    It can work for when tax isn't known (like in the US).

    Note that this price class uses the tax-exclusive price for offers, even if
    the tax is known.  This may not be what you want.  Use the
    TaxInclusiveFixedPrice class if you want offers to use tax-inclusive
    prices.
    TNc             C   s   || _ || _|| _d S )N)r   r   r   )r   r   r   r   r   r   r   Ú__init__<   s    zFixedPrice.__init__c             C   s    | j r| j| j S tjdƒ‚d S )Nz1Can't calculate price.incl_tax as tax isn't known)r   r   r   r   ÚTaxNotKnown)r   r   r   r   r   A   s    zFixedPrice.incl_taxc             C   s
   | j d k	S )N)r   )r   r   r   r   r   H   s    zFixedPrice.is_tax_known)N)	r
   r   r   r   r   r   r   r   r   r   r   r   r   r   /   s
   

r   c               @   s8   e Zd ZdZd ZZdd„ Zedd„ ƒZedd„ ƒZ	d	S )
ÚTaxInclusiveFixedPricez¯
    Specialised version of FixedPrice that must have tax passed.  It also
    specifies that offers should use the tax-inclusive price (which is the norm
    in the UK).
    Tc             C   s   || _ || _|| _d S )N)r   r   r   )r   r   r   r   r   r   r   r   U   s    zTaxInclusiveFixedPrice.__init__c             C   s   | j | j S )N)r   r   )r   r   r   r   r   Z   s    zTaxInclusiveFixedPrice.incl_taxc             C   s   | j S )N)r   )r   r   r   r   r   ^   s    z&TaxInclusiveFixedPrice.effective_priceN)
r
   r   r   r   r   r   r   r   r   r   r   r   r   r   r   M   s
   r   N)Ú
oscar.corer   Úobjectr   r   r   r   r   r   r   r   Ú<module>   s   $