ZhimaCreditPeUserCreditFreezeModel.py 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  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.CreditFreezeSubOrder import CreditFreezeSubOrder
  6. class ZhimaCreditPeUserCreditFreezeModel(object):
  7. def __init__(self):
  8. self._buyer_id = None
  9. self._category_code = None
  10. self._credit_scene = None
  11. self._ext_info = None
  12. self._out_order_no = None
  13. self._out_request_no = None
  14. self._risk_info = None
  15. self._seller_id = None
  16. self._sub_order_info = None
  17. self._total_credit_amount = None
  18. @property
  19. def buyer_id(self):
  20. return self._buyer_id
  21. @buyer_id.setter
  22. def buyer_id(self, value):
  23. self._buyer_id = value
  24. @property
  25. def category_code(self):
  26. return self._category_code
  27. @category_code.setter
  28. def category_code(self, value):
  29. self._category_code = value
  30. @property
  31. def credit_scene(self):
  32. return self._credit_scene
  33. @credit_scene.setter
  34. def credit_scene(self, value):
  35. self._credit_scene = value
  36. @property
  37. def ext_info(self):
  38. return self._ext_info
  39. @ext_info.setter
  40. def ext_info(self, value):
  41. self._ext_info = value
  42. @property
  43. def out_order_no(self):
  44. return self._out_order_no
  45. @out_order_no.setter
  46. def out_order_no(self, value):
  47. self._out_order_no = value
  48. @property
  49. def out_request_no(self):
  50. return self._out_request_no
  51. @out_request_no.setter
  52. def out_request_no(self, value):
  53. self._out_request_no = value
  54. @property
  55. def risk_info(self):
  56. return self._risk_info
  57. @risk_info.setter
  58. def risk_info(self, value):
  59. self._risk_info = value
  60. @property
  61. def seller_id(self):
  62. return self._seller_id
  63. @seller_id.setter
  64. def seller_id(self, value):
  65. self._seller_id = value
  66. @property
  67. def sub_order_info(self):
  68. return self._sub_order_info
  69. @sub_order_info.setter
  70. def sub_order_info(self, value):
  71. if isinstance(value, list):
  72. self._sub_order_info = list()
  73. for i in value:
  74. if isinstance(i, CreditFreezeSubOrder):
  75. self._sub_order_info.append(i)
  76. else:
  77. self._sub_order_info.append(CreditFreezeSubOrder.from_alipay_dict(i))
  78. @property
  79. def total_credit_amount(self):
  80. return self._total_credit_amount
  81. @total_credit_amount.setter
  82. def total_credit_amount(self, value):
  83. self._total_credit_amount = value
  84. def to_alipay_dict(self):
  85. params = dict()
  86. if self.buyer_id:
  87. if hasattr(self.buyer_id, 'to_alipay_dict'):
  88. params['buyer_id'] = self.buyer_id.to_alipay_dict()
  89. else:
  90. params['buyer_id'] = self.buyer_id
  91. if self.category_code:
  92. if hasattr(self.category_code, 'to_alipay_dict'):
  93. params['category_code'] = self.category_code.to_alipay_dict()
  94. else:
  95. params['category_code'] = self.category_code
  96. if self.credit_scene:
  97. if hasattr(self.credit_scene, 'to_alipay_dict'):
  98. params['credit_scene'] = self.credit_scene.to_alipay_dict()
  99. else:
  100. params['credit_scene'] = self.credit_scene
  101. if self.ext_info:
  102. if hasattr(self.ext_info, 'to_alipay_dict'):
  103. params['ext_info'] = self.ext_info.to_alipay_dict()
  104. else:
  105. params['ext_info'] = self.ext_info
  106. if self.out_order_no:
  107. if hasattr(self.out_order_no, 'to_alipay_dict'):
  108. params['out_order_no'] = self.out_order_no.to_alipay_dict()
  109. else:
  110. params['out_order_no'] = self.out_order_no
  111. if self.out_request_no:
  112. if hasattr(self.out_request_no, 'to_alipay_dict'):
  113. params['out_request_no'] = self.out_request_no.to_alipay_dict()
  114. else:
  115. params['out_request_no'] = self.out_request_no
  116. if self.risk_info:
  117. if hasattr(self.risk_info, 'to_alipay_dict'):
  118. params['risk_info'] = self.risk_info.to_alipay_dict()
  119. else:
  120. params['risk_info'] = self.risk_info
  121. if self.seller_id:
  122. if hasattr(self.seller_id, 'to_alipay_dict'):
  123. params['seller_id'] = self.seller_id.to_alipay_dict()
  124. else:
  125. params['seller_id'] = self.seller_id
  126. if self.sub_order_info:
  127. if isinstance(self.sub_order_info, list):
  128. for i in range(0, len(self.sub_order_info)):
  129. element = self.sub_order_info[i]
  130. if hasattr(element, 'to_alipay_dict'):
  131. self.sub_order_info[i] = element.to_alipay_dict()
  132. if hasattr(self.sub_order_info, 'to_alipay_dict'):
  133. params['sub_order_info'] = self.sub_order_info.to_alipay_dict()
  134. else:
  135. params['sub_order_info'] = self.sub_order_info
  136. if self.total_credit_amount:
  137. if hasattr(self.total_credit_amount, 'to_alipay_dict'):
  138. params['total_credit_amount'] = self.total_credit_amount.to_alipay_dict()
  139. else:
  140. params['total_credit_amount'] = self.total_credit_amount
  141. return params
  142. @staticmethod
  143. def from_alipay_dict(d):
  144. if not d:
  145. return None
  146. o = ZhimaCreditPeUserCreditFreezeModel()
  147. if 'buyer_id' in d:
  148. o.buyer_id = d['buyer_id']
  149. if 'category_code' in d:
  150. o.category_code = d['category_code']
  151. if 'credit_scene' in d:
  152. o.credit_scene = d['credit_scene']
  153. if 'ext_info' in d:
  154. o.ext_info = d['ext_info']
  155. if 'out_order_no' in d:
  156. o.out_order_no = d['out_order_no']
  157. if 'out_request_no' in d:
  158. o.out_request_no = d['out_request_no']
  159. if 'risk_info' in d:
  160. o.risk_info = d['risk_info']
  161. if 'seller_id' in d:
  162. o.seller_id = d['seller_id']
  163. if 'sub_order_info' in d:
  164. o.sub_order_info = d['sub_order_info']
  165. if 'total_credit_amount' in d:
  166. o.total_credit_amount = d['total_credit_amount']
  167. return o