BusinessParams.py 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. import json
  4. from alipay.aop.api.constant.ParamConstants import *
  5. class BusinessParams(object):
  6. def __init__(self):
  7. self._actual_order_time = None
  8. self._campus_card = None
  9. self._card_type = None
  10. @property
  11. def actual_order_time(self):
  12. return self._actual_order_time
  13. @actual_order_time.setter
  14. def actual_order_time(self, value):
  15. self._actual_order_time = value
  16. @property
  17. def campus_card(self):
  18. return self._campus_card
  19. @campus_card.setter
  20. def campus_card(self, value):
  21. self._campus_card = value
  22. @property
  23. def card_type(self):
  24. return self._card_type
  25. @card_type.setter
  26. def card_type(self, value):
  27. self._card_type = value
  28. def to_alipay_dict(self):
  29. params = dict()
  30. if self.actual_order_time:
  31. if hasattr(self.actual_order_time, 'to_alipay_dict'):
  32. params['actual_order_time'] = self.actual_order_time.to_alipay_dict()
  33. else:
  34. params['actual_order_time'] = self.actual_order_time
  35. if self.campus_card:
  36. if hasattr(self.campus_card, 'to_alipay_dict'):
  37. params['campus_card'] = self.campus_card.to_alipay_dict()
  38. else:
  39. params['campus_card'] = self.campus_card
  40. if self.card_type:
  41. if hasattr(self.card_type, 'to_alipay_dict'):
  42. params['card_type'] = self.card_type.to_alipay_dict()
  43. else:
  44. params['card_type'] = self.card_type
  45. return params
  46. @staticmethod
  47. def from_alipay_dict(d):
  48. if not d:
  49. return None
  50. o = BusinessParams()
  51. if 'actual_order_time' in d:
  52. o.actual_order_time = d['actual_order_time']
  53. if 'campus_card' in d:
  54. o.campus_card = d['campus_card']
  55. if 'card_type' in d:
  56. o.card_type = d['card_type']
  57. return o