InsApplication.py 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. import json
  4. from alipay.aop.api.constant.ParamConstants import *
  5. from alipay.aop.api.domain.InsObject import InsObject
  6. from alipay.aop.api.domain.InsPerson import InsPerson
  7. class InsApplication(object):
  8. def __init__(self):
  9. self._biz_data = None
  10. self._copies = None
  11. self._effect_end_time = None
  12. self._effect_start_time = None
  13. self._ins_object = None
  14. self._insured = None
  15. self._period = None
  16. self._premium = None
  17. self._sum_insured = None
  18. @property
  19. def biz_data(self):
  20. return self._biz_data
  21. @biz_data.setter
  22. def biz_data(self, value):
  23. self._biz_data = value
  24. @property
  25. def copies(self):
  26. return self._copies
  27. @copies.setter
  28. def copies(self, value):
  29. self._copies = value
  30. @property
  31. def effect_end_time(self):
  32. return self._effect_end_time
  33. @effect_end_time.setter
  34. def effect_end_time(self, value):
  35. self._effect_end_time = value
  36. @property
  37. def effect_start_time(self):
  38. return self._effect_start_time
  39. @effect_start_time.setter
  40. def effect_start_time(self, value):
  41. self._effect_start_time = value
  42. @property
  43. def ins_object(self):
  44. return self._ins_object
  45. @ins_object.setter
  46. def ins_object(self, value):
  47. if isinstance(value, InsObject):
  48. self._ins_object = value
  49. else:
  50. self._ins_object = InsObject.from_alipay_dict(value)
  51. @property
  52. def insured(self):
  53. return self._insured
  54. @insured.setter
  55. def insured(self, value):
  56. if isinstance(value, InsPerson):
  57. self._insured = value
  58. else:
  59. self._insured = InsPerson.from_alipay_dict(value)
  60. @property
  61. def period(self):
  62. return self._period
  63. @period.setter
  64. def period(self, value):
  65. self._period = value
  66. @property
  67. def premium(self):
  68. return self._premium
  69. @premium.setter
  70. def premium(self, value):
  71. self._premium = value
  72. @property
  73. def sum_insured(self):
  74. return self._sum_insured
  75. @sum_insured.setter
  76. def sum_insured(self, value):
  77. self._sum_insured = value
  78. def to_alipay_dict(self):
  79. params = dict()
  80. if self.biz_data:
  81. if hasattr(self.biz_data, 'to_alipay_dict'):
  82. params['biz_data'] = self.biz_data.to_alipay_dict()
  83. else:
  84. params['biz_data'] = self.biz_data
  85. if self.copies:
  86. if hasattr(self.copies, 'to_alipay_dict'):
  87. params['copies'] = self.copies.to_alipay_dict()
  88. else:
  89. params['copies'] = self.copies
  90. if self.effect_end_time:
  91. if hasattr(self.effect_end_time, 'to_alipay_dict'):
  92. params['effect_end_time'] = self.effect_end_time.to_alipay_dict()
  93. else:
  94. params['effect_end_time'] = self.effect_end_time
  95. if self.effect_start_time:
  96. if hasattr(self.effect_start_time, 'to_alipay_dict'):
  97. params['effect_start_time'] = self.effect_start_time.to_alipay_dict()
  98. else:
  99. params['effect_start_time'] = self.effect_start_time
  100. if self.ins_object:
  101. if hasattr(self.ins_object, 'to_alipay_dict'):
  102. params['ins_object'] = self.ins_object.to_alipay_dict()
  103. else:
  104. params['ins_object'] = self.ins_object
  105. if self.insured:
  106. if hasattr(self.insured, 'to_alipay_dict'):
  107. params['insured'] = self.insured.to_alipay_dict()
  108. else:
  109. params['insured'] = self.insured
  110. if self.period:
  111. if hasattr(self.period, 'to_alipay_dict'):
  112. params['period'] = self.period.to_alipay_dict()
  113. else:
  114. params['period'] = self.period
  115. if self.premium:
  116. if hasattr(self.premium, 'to_alipay_dict'):
  117. params['premium'] = self.premium.to_alipay_dict()
  118. else:
  119. params['premium'] = self.premium
  120. if self.sum_insured:
  121. if hasattr(self.sum_insured, 'to_alipay_dict'):
  122. params['sum_insured'] = self.sum_insured.to_alipay_dict()
  123. else:
  124. params['sum_insured'] = self.sum_insured
  125. return params
  126. @staticmethod
  127. def from_alipay_dict(d):
  128. if not d:
  129. return None
  130. o = InsApplication()
  131. if 'biz_data' in d:
  132. o.biz_data = d['biz_data']
  133. if 'copies' in d:
  134. o.copies = d['copies']
  135. if 'effect_end_time' in d:
  136. o.effect_end_time = d['effect_end_time']
  137. if 'effect_start_time' in d:
  138. o.effect_start_time = d['effect_start_time']
  139. if 'ins_object' in d:
  140. o.ins_object = d['ins_object']
  141. if 'insured' in d:
  142. o.insured = d['insured']
  143. if 'period' in d:
  144. o.period = d['period']
  145. if 'premium' in d:
  146. o.premium = d['premium']
  147. if 'sum_insured' in d:
  148. o.sum_insured = d['sum_insured']
  149. return o