B
    ฒ๔`  ใ               @   s0   G d d de ZG dd dZG dd dZdS )c               @   s   e Zd Zedd ZdS )ฺSurchargeListc             C   s   t dd | D S )Nc             S   s   g | ]
}|j qS ฉ )ฺprice)ฺ.0ฺ	surcharger   r   ๚M/home/dcms/DCMS/lib/python3.7/site-packages/oscar/apps/checkout/applicator.py๚
<listcomp>   s    z'SurchargeList.total.<locals>.<listcomp>)ฺsum)ฺselfr   r   r   ฺtotal   s    zSurchargeList.totalN)ฺ__name__ฺ
__module__ฺ__qualname__ฺpropertyr
   r   r   r   r   r      s   r   c               @   s   e Zd ZdZdZdd ZdS )ฺSurchargePriceNc             C   s   || _ || _d S )N)r   r   )r	   r   r   r   r   r   ฺ__init__   s    zSurchargePrice.__init__)r   r   r   r   r   r   r   r   r   r   r      s   r   c               @   s.   e Zd Zd
ddZdd Zdd Zdd	 ZdS )ฺSurchargeApplicatorNc             C   s   || _ || _d S )N)ฺcontextฺrequest)r	   r   r   r   r   r   r      s    zSurchargeApplicator.__init__c             K   s   dS )a~  
        For example::
            return (
                PercentageCharge(percentage=D("2.00")),
                FlatCharge(excl_tax=D("20.0"), incl_tax=D("20.0")),
            )

        Surcharges must implement the minimal API in ``oscar.apps.checkout.surcharges.BaseSurcharge``.
        Note that you can also make it a model if you want, just like shipping methods.
        r   r   )r	   ฺbasketฺkwargsr   r   r   ฺget_surcharges   s    z"SurchargeApplicator.get_surchargesc                s:    fddj f d iD }|r2t|S d S d S )Nc                s<   g | ]4}j f | d rt||jf d iqS ))r   r   r   )ฺis_applicabler   Z	calculate)r   r   )r   r   r	   r   r   r   &   s   zASurchargeApplicator.get_applicable_surcharges.<locals>.<listcomp>r   )r   r   )r	   r   r   ฺmethodsr   )r   r   r	   r   ฺget_applicable_surcharges$   s
    z-SurchargeApplicator.get_applicable_surchargesc             K   s   dS )zI
        Checks if surcharge is applicable to certain conditions
        Tr   )r	   r   r   r   r   r   r   r   3   s    z!SurchargeApplicator.is_applicable)NN)r   r   r   r   r   r   r   r   r   r   r   r      s   
r   N)ฺlistr   r   r   r   r   r   r   ฺ<module>   s   	