MemberBenefitInfo.py 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. import json
  4. from alipay.aop.api.constant.ParamConstants import *
  5. class MemberBenefitInfo(object):
  6. def __init__(self):
  7. self._action_url = None
  8. self._icon_url = None
  9. self._title = None
  10. self._value = None
  11. @property
  12. def action_url(self):
  13. return self._action_url
  14. @action_url.setter
  15. def action_url(self, value):
  16. self._action_url = value
  17. @property
  18. def icon_url(self):
  19. return self._icon_url
  20. @icon_url.setter
  21. def icon_url(self, value):
  22. self._icon_url = value
  23. @property
  24. def title(self):
  25. return self._title
  26. @title.setter
  27. def title(self, value):
  28. self._title = value
  29. @property
  30. def value(self):
  31. return self._value
  32. @value.setter
  33. def value(self, value):
  34. self._value = value
  35. def to_alipay_dict(self):
  36. params = dict()
  37. if self.action_url:
  38. if hasattr(self.action_url, 'to_alipay_dict'):
  39. params['action_url'] = self.action_url.to_alipay_dict()
  40. else:
  41. params['action_url'] = self.action_url
  42. if self.icon_url:
  43. if hasattr(self.icon_url, 'to_alipay_dict'):
  44. params['icon_url'] = self.icon_url.to_alipay_dict()
  45. else:
  46. params['icon_url'] = self.icon_url
  47. if self.title:
  48. if hasattr(self.title, 'to_alipay_dict'):
  49. params['title'] = self.title.to_alipay_dict()
  50. else:
  51. params['title'] = self.title
  52. if self.value:
  53. if hasattr(self.value, 'to_alipay_dict'):
  54. params['value'] = self.value.to_alipay_dict()
  55. else:
  56. params['value'] = self.value
  57. return params
  58. @staticmethod
  59. def from_alipay_dict(d):
  60. if not d:
  61. return None
  62. o = MemberBenefitInfo()
  63. if 'action_url' in d:
  64. o.action_url = d['action_url']
  65. if 'icon_url' in d:
  66. o.icon_url = d['icon_url']
  67. if 'title' in d:
  68. o.title = d['title']
  69. if 'value' in d:
  70. o.value = d['value']
  71. return o