AlipayInsSceneClaimAttachmentUploadRequest.py 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. import json
  4. from alipay.aop.api.FileItem import FileItem
  5. from alipay.aop.api.constant.ParamConstants import *
  6. class AlipayInsSceneClaimAttachmentUploadRequest(object):
  7. def __init__(self, biz_model=None):
  8. self._biz_model = biz_model
  9. self._attachment_name = None
  10. self._attachment_type = None
  11. self._claim_report_no = None
  12. self._description = None
  13. self._file_type = None
  14. self._file_content = None
  15. self._version = "1.0"
  16. self._terminal_type = None
  17. self._terminal_info = None
  18. self._prod_code = None
  19. self._notify_url = None
  20. self._return_url = None
  21. self._udf_params = None
  22. self._need_encrypt = False
  23. @property
  24. def biz_model(self):
  25. return self._biz_model
  26. @biz_model.setter
  27. def biz_model(self, value):
  28. self._biz_model = value
  29. @property
  30. def attachment_name(self):
  31. return self._attachment_name
  32. @attachment_name.setter
  33. def attachment_name(self, value):
  34. self._attachment_name = value
  35. @property
  36. def attachment_type(self):
  37. return self._attachment_type
  38. @attachment_type.setter
  39. def attachment_type(self, value):
  40. self._attachment_type = value
  41. @property
  42. def claim_report_no(self):
  43. return self._claim_report_no
  44. @claim_report_no.setter
  45. def claim_report_no(self, value):
  46. self._claim_report_no = value
  47. @property
  48. def description(self):
  49. return self._description
  50. @description.setter
  51. def description(self, value):
  52. self._description = value
  53. @property
  54. def file_type(self):
  55. return self._file_type
  56. @file_type.setter
  57. def file_type(self, value):
  58. self._file_type = value
  59. @property
  60. def file_content(self):
  61. return self._file_content
  62. @file_content.setter
  63. def file_content(self, value):
  64. if not isinstance(value, FileItem):
  65. return
  66. self._file_content = value
  67. @property
  68. def version(self):
  69. return self._version
  70. @version.setter
  71. def version(self, value):
  72. self._version = value
  73. @property
  74. def terminal_type(self):
  75. return self._terminal_type
  76. @terminal_type.setter
  77. def terminal_type(self, value):
  78. self._terminal_type = value
  79. @property
  80. def terminal_info(self):
  81. return self._terminal_info
  82. @terminal_info.setter
  83. def terminal_info(self, value):
  84. self._terminal_info = value
  85. @property
  86. def prod_code(self):
  87. return self._prod_code
  88. @prod_code.setter
  89. def prod_code(self, value):
  90. self._prod_code = value
  91. @property
  92. def notify_url(self):
  93. return self._notify_url
  94. @notify_url.setter
  95. def notify_url(self, value):
  96. self._notify_url = value
  97. @property
  98. def return_url(self):
  99. return self._return_url
  100. @return_url.setter
  101. def return_url(self, value):
  102. self._return_url = value
  103. @property
  104. def udf_params(self):
  105. return self._udf_params
  106. @udf_params.setter
  107. def udf_params(self, value):
  108. if not isinstance(value, dict):
  109. return
  110. self._udf_params = value
  111. @property
  112. def need_encrypt(self):
  113. return self._need_encrypt
  114. @need_encrypt.setter
  115. def need_encrypt(self, value):
  116. self._need_encrypt = value
  117. def add_other_text_param(self, key, value):
  118. if not self.udf_params:
  119. self.udf_params = dict()
  120. self.udf_params[key] = value
  121. def get_params(self):
  122. params = dict()
  123. params[P_METHOD] = 'alipay.ins.scene.claim.attachment.upload'
  124. params[P_VERSION] = self.version
  125. if self.biz_model:
  126. params[P_BIZ_CONTENT] = json.dumps(obj=self.biz_model.to_alipay_dict(), ensure_ascii=False, sort_keys=True, separators=(',', ':'))
  127. if self.attachment_name:
  128. if hasattr(self.attachment_name, 'to_alipay_dict'):
  129. params['attachment_name'] = json.dumps(obj=self.attachment_name.to_alipay_dict(), ensure_ascii=False, sort_keys=True, separators=(',', ':'))
  130. else:
  131. params['attachment_name'] = self.attachment_name
  132. if self.attachment_type:
  133. if hasattr(self.attachment_type, 'to_alipay_dict'):
  134. params['attachment_type'] = json.dumps(obj=self.attachment_type.to_alipay_dict(), ensure_ascii=False, sort_keys=True, separators=(',', ':'))
  135. else:
  136. params['attachment_type'] = self.attachment_type
  137. if self.claim_report_no:
  138. if hasattr(self.claim_report_no, 'to_alipay_dict'):
  139. params['claim_report_no'] = json.dumps(obj=self.claim_report_no.to_alipay_dict(), ensure_ascii=False, sort_keys=True, separators=(',', ':'))
  140. else:
  141. params['claim_report_no'] = self.claim_report_no
  142. if self.description:
  143. if hasattr(self.description, 'to_alipay_dict'):
  144. params['description'] = json.dumps(obj=self.description.to_alipay_dict(), ensure_ascii=False, sort_keys=True, separators=(',', ':'))
  145. else:
  146. params['description'] = self.description
  147. if self.file_type:
  148. if hasattr(self.file_type, 'to_alipay_dict'):
  149. params['file_type'] = json.dumps(obj=self.file_type.to_alipay_dict(), ensure_ascii=False, sort_keys=True, separators=(',', ':'))
  150. else:
  151. params['file_type'] = self.file_type
  152. if self.terminal_type:
  153. params['terminal_type'] = self.terminal_type
  154. if self.terminal_info:
  155. params['terminal_info'] = self.terminal_info
  156. if self.prod_code:
  157. params['prod_code'] = self.prod_code
  158. if self.notify_url:
  159. params['notify_url'] = self.notify_url
  160. if self.return_url:
  161. params['return_url'] = self.return_url
  162. if self.udf_params:
  163. params.update(self.udf_params)
  164. return params
  165. def get_multipart_params(self):
  166. multipart_params = dict()
  167. if self.file_content:
  168. multipart_params['file_content'] = self.file_content
  169. return multipart_params