InsObject.py 2.0 KB

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