Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. from decimal import Decimal as D
  2. class ShippingMethod(object):
  3. """
  4. Superclass for all shipping method objects.
  5. It is an actual superclass to the classes in methods.py, and a de-facto
  6. superclass to the classes in models.py. This allows using all
  7. shipping methods interchangeably (aka polymorphism).
  8. """
  9. # This is the interface that all shipping methods must implement
  10. #: Used to store this method in the session. Each shipping method should
  11. # have a unique code.
  12. code = '__default__'
  13. #: The name of the shipping method, shown to the customer during checkout
  14. name = 'Default shipping'
  15. #: A more detailed description of the shipping method shown to the customer
  16. # during checkout
  17. description = ''
  18. # These are not intended to be overridden
  19. is_discounted = False
  20. discount = D('0.00')
  21. def __init__(self, *args, **kwargs):
  22. self.exempt_from_tax = False
  23. super(ShippingMethod, self).__init__(*args, **kwargs)
  24. def set_basket(self, basket):
  25. self.basket = basket
  26. def basket_charge_incl_tax(self):
  27. """
  28. Return the shipping charge including any taxes
  29. """
  30. raise NotImplemented()
  31. def basket_charge_excl_tax(self):
  32. """
  33. Return the shipping charge excluding taxes
  34. """
  35. raise NotImplemented()