BenifitGoodsInfo.py 2.3 KB

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