You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

utils.py 857B

123456789101112131415161718192021222324
  1. import warnings
  2. from . import models
  3. def Bankcard(card_number, expiry_date, name=None,
  4. cvv=None, start_date=None, issue_number=None):
  5. # This odd looking thing is to handle backwards compatibility with Oscar
  6. # 0.5 where the Bankcard class wasn't a model and lived in this utils
  7. # module. As of 0.6, the Bankcard class is a model.
  8. #
  9. # We pretend to be a class here (hence the capitalisation), remap the
  10. # constructor args and return an instance of the new class.
  11. warnings.warn("The Bankcard class has moved to oscar.apps.payment.models",
  12. DeprecationWarning)
  13. kwargs = {
  14. 'number': card_number,
  15. 'expiry_date': expiry_date,
  16. 'name': name,
  17. 'ccv': cvv,
  18. 'start_date': start_date,
  19. 'issue_number': issue_number
  20. }
  21. return models.Bankcard(**kwargs)