AlipayInsSceneApplicationOutsideApplyModel.py 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206
  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.InsPerson import InsPerson
  6. from alipay.aop.api.domain.InsPerson import InsPerson
  7. class AlipayInsSceneApplicationOutsideApplyModel(object):
  8. def __init__(self):
  9. self._applicant = None
  10. self._biz_factor = None
  11. self._effect_end_time = None
  12. self._effect_start_time = None
  13. self._insureds = None
  14. self._out_biz_no = None
  15. self._period = None
  16. self._premium = None
  17. self._prod_code = None
  18. self._source = None
  19. self._sum_insured = None
  20. @property
  21. def applicant(self):
  22. return self._applicant
  23. @applicant.setter
  24. def applicant(self, value):
  25. if isinstance(value, InsPerson):
  26. self._applicant = value
  27. else:
  28. self._applicant = InsPerson.from_alipay_dict(value)
  29. @property
  30. def biz_factor(self):
  31. return self._biz_factor
  32. @biz_factor.setter
  33. def biz_factor(self, value):
  34. self._biz_factor = value
  35. @property
  36. def effect_end_time(self):
  37. return self._effect_end_time
  38. @effect_end_time.setter
  39. def effect_end_time(self, value):
  40. self._effect_end_time = value
  41. @property
  42. def effect_start_time(self):
  43. return self._effect_start_time
  44. @effect_start_time.setter
  45. def effect_start_time(self, value):
  46. self._effect_start_time = value
  47. @property
  48. def insureds(self):
  49. return self._insureds
  50. @insureds.setter
  51. def insureds(self, value):
  52. if isinstance(value, list):
  53. self._insureds = list()
  54. for i in value:
  55. if isinstance(i, InsPerson):
  56. self._insureds.append(i)
  57. else:
  58. self._insureds.append(InsPerson.from_alipay_dict(i))
  59. @property
  60. def out_biz_no(self):
  61. return self._out_biz_no
  62. @out_biz_no.setter
  63. def out_biz_no(self, value):
  64. self._out_biz_no = value
  65. @property
  66. def period(self):
  67. return self._period
  68. @period.setter
  69. def period(self, value):
  70. self._period = value
  71. @property
  72. def premium(self):
  73. return self._premium
  74. @premium.setter
  75. def premium(self, value):
  76. self._premium = value
  77. @property
  78. def prod_code(self):
  79. return self._prod_code
  80. @prod_code.setter
  81. def prod_code(self, value):
  82. self._prod_code = value
  83. @property
  84. def source(self):
  85. return self._source
  86. @source.setter
  87. def source(self, value):
  88. self._source = value
  89. @property
  90. def sum_insured(self):
  91. return self._sum_insured
  92. @sum_insured.setter
  93. def sum_insured(self, value):
  94. self._sum_insured = value
  95. def to_alipay_dict(self):
  96. params = dict()
  97. if self.applicant:
  98. if hasattr(self.applicant, 'to_alipay_dict'):
  99. params['applicant'] = self.applicant.to_alipay_dict()
  100. else:
  101. params['applicant'] = self.applicant
  102. if self.biz_factor:
  103. if hasattr(self.biz_factor, 'to_alipay_dict'):
  104. params['biz_factor'] = self.biz_factor.to_alipay_dict()
  105. else:
  106. params['biz_factor'] = self.biz_factor
  107. if self.effect_end_time:
  108. if hasattr(self.effect_end_time, 'to_alipay_dict'):
  109. params['effect_end_time'] = self.effect_end_time.to_alipay_dict()
  110. else:
  111. params['effect_end_time'] = self.effect_end_time
  112. if self.effect_start_time:
  113. if hasattr(self.effect_start_time, 'to_alipay_dict'):
  114. params['effect_start_time'] = self.effect_start_time.to_alipay_dict()
  115. else:
  116. params['effect_start_time'] = self.effect_start_time
  117. if self.insureds:
  118. if isinstance(self.insureds, list):
  119. for i in range(0, len(self.insureds)):
  120. element = self.insureds[i]
  121. if hasattr(element, 'to_alipay_dict'):
  122. self.insureds[i] = element.to_alipay_dict()
  123. if hasattr(self.insureds, 'to_alipay_dict'):
  124. params['insureds'] = self.insureds.to_alipay_dict()
  125. else:
  126. params['insureds'] = self.insureds
  127. if self.out_biz_no:
  128. if hasattr(self.out_biz_no, 'to_alipay_dict'):
  129. params['out_biz_no'] = self.out_biz_no.to_alipay_dict()
  130. else:
  131. params['out_biz_no'] = self.out_biz_no
  132. if self.period:
  133. if hasattr(self.period, 'to_alipay_dict'):
  134. params['period'] = self.period.to_alipay_dict()
  135. else:
  136. params['period'] = self.period
  137. if self.premium:
  138. if hasattr(self.premium, 'to_alipay_dict'):
  139. params['premium'] = self.premium.to_alipay_dict()
  140. else:
  141. params['premium'] = self.premium
  142. if self.prod_code:
  143. if hasattr(self.prod_code, 'to_alipay_dict'):
  144. params['prod_code'] = self.prod_code.to_alipay_dict()
  145. else:
  146. params['prod_code'] = self.prod_code
  147. if self.source:
  148. if hasattr(self.source, 'to_alipay_dict'):
  149. params['source'] = self.source.to_alipay_dict()
  150. else:
  151. params['source'] = self.source
  152. if self.sum_insured:
  153. if hasattr(self.sum_insured, 'to_alipay_dict'):
  154. params['sum_insured'] = self.sum_insured.to_alipay_dict()
  155. else:
  156. params['sum_insured'] = self.sum_insured
  157. return params
  158. @staticmethod
  159. def from_alipay_dict(d):
  160. if not d:
  161. return None
  162. o = AlipayInsSceneApplicationOutsideApplyModel()
  163. if 'applicant' in d:
  164. o.applicant = d['applicant']
  165. if 'biz_factor' in d:
  166. o.biz_factor = d['biz_factor']
  167. if 'effect_end_time' in d:
  168. o.effect_end_time = d['effect_end_time']
  169. if 'effect_start_time' in d:
  170. o.effect_start_time = d['effect_start_time']
  171. if 'insureds' in d:
  172. o.insureds = d['insureds']
  173. if 'out_biz_no' in d:
  174. o.out_biz_no = d['out_biz_no']
  175. if 'period' in d:
  176. o.period = d['period']
  177. if 'premium' in d:
  178. o.premium = d['premium']
  179. if 'prod_code' in d:
  180. o.prod_code = d['prod_code']
  181. if 'source' in d:
  182. o.source = d['source']
  183. if 'sum_insured' in d:
  184. o.sum_insured = d['sum_insured']
  185. return o