AlipayInsSceneApplicationGroupApplyModel.py 6.8 KB

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