BenefitInfoDetail.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 BenefitInfoDetail(object):
  6. def __init__(self):
  7. self._amount = None
  8. self._benefit_type = None
  9. self._count = None
  10. self._description = None
  11. @property
  12. def amount(self):
  13. return self._amount
  14. @amount.setter
  15. def amount(self, value):
  16. self._amount = value
  17. @property
  18. def benefit_type(self):
  19. return self._benefit_type
  20. @benefit_type.setter
  21. def benefit_type(self, value):
  22. self._benefit_type = value
  23. @property
  24. def count(self):
  25. return self._count
  26. @count.setter
  27. def count(self, value):
  28. self._count = value
  29. @property
  30. def description(self):
  31. return self._description
  32. @description.setter
  33. def description(self, value):
  34. self._description = value
  35. def to_alipay_dict(self):
  36. params = dict()
  37. if self.amount:
  38. if hasattr(self.amount, 'to_alipay_dict'):
  39. params['amount'] = self.amount.to_alipay_dict()
  40. else:
  41. params['amount'] = self.amount
  42. if self.benefit_type:
  43. if hasattr(self.benefit_type, 'to_alipay_dict'):
  44. params['benefit_type'] = self.benefit_type.to_alipay_dict()
  45. else:
  46. params['benefit_type'] = self.benefit_type
  47. if self.count:
  48. if hasattr(self.count, 'to_alipay_dict'):
  49. params['count'] = self.count.to_alipay_dict()
  50. else:
  51. params['count'] = self.count
  52. if self.description:
  53. if hasattr(self.description, 'to_alipay_dict'):
  54. params['description'] = self.description.to_alipay_dict()
  55. else:
  56. params['description'] = self.description
  57. return params
  58. @staticmethod
  59. def from_alipay_dict(d):
  60. if not d:
  61. return None
  62. o = BenefitInfoDetail()
  63. if 'amount' in d:
  64. o.amount = d['amount']
  65. if 'benefit_type' in d:
  66. o.benefit_type = d['benefit_type']
  67. if 'count' in d:
  68. o.count = d['count']
  69. if 'description' in d:
  70. o.description = d['description']
  71. return o