PointsExchangeInfo.py 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. import json
  4. from alipay.aop.api.constant.ParamConstants import *
  5. class PointsExchangeInfo(object):
  6. def __init__(self):
  7. self._ids = None
  8. self._type = None
  9. @property
  10. def ids(self):
  11. return self._ids
  12. @ids.setter
  13. def ids(self, value):
  14. if isinstance(value, list):
  15. self._ids = list()
  16. for i in value:
  17. self._ids.append(i)
  18. @property
  19. def type(self):
  20. return self._type
  21. @type.setter
  22. def type(self, value):
  23. self._type = value
  24. def to_alipay_dict(self):
  25. params = dict()
  26. if self.ids:
  27. if isinstance(self.ids, list):
  28. for i in range(0, len(self.ids)):
  29. element = self.ids[i]
  30. if hasattr(element, 'to_alipay_dict'):
  31. self.ids[i] = element.to_alipay_dict()
  32. if hasattr(self.ids, 'to_alipay_dict'):
  33. params['ids'] = self.ids.to_alipay_dict()
  34. else:
  35. params['ids'] = self.ids
  36. if self.type:
  37. if hasattr(self.type, 'to_alipay_dict'):
  38. params['type'] = self.type.to_alipay_dict()
  39. else:
  40. params['type'] = self.type
  41. return params
  42. @staticmethod
  43. def from_alipay_dict(d):
  44. if not d:
  45. return None
  46. o = PointsExchangeInfo()
  47. if 'ids' in d:
  48. o.ids = d['ids']
  49. if 'type' in d:
  50. o.type = d['type']
  51. return o