AntMerchantExpandIndirectAttachmentUploadModel.py 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  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.AttachmentInfo import AttachmentInfo
  6. class AntMerchantExpandIndirectAttachmentUploadModel(object):
  7. def __init__(self):
  8. self._attachment_info = None
  9. self._memo = None
  10. self._sub_merchant_id = None
  11. @property
  12. def attachment_info(self):
  13. return self._attachment_info
  14. @attachment_info.setter
  15. def attachment_info(self, value):
  16. if isinstance(value, list):
  17. self._attachment_info = list()
  18. for i in value:
  19. if isinstance(i, AttachmentInfo):
  20. self._attachment_info.append(i)
  21. else:
  22. self._attachment_info.append(AttachmentInfo.from_alipay_dict(i))
  23. @property
  24. def memo(self):
  25. return self._memo
  26. @memo.setter
  27. def memo(self, value):
  28. self._memo = value
  29. @property
  30. def sub_merchant_id(self):
  31. return self._sub_merchant_id
  32. @sub_merchant_id.setter
  33. def sub_merchant_id(self, value):
  34. self._sub_merchant_id = value
  35. def to_alipay_dict(self):
  36. params = dict()
  37. if self.attachment_info:
  38. if isinstance(self.attachment_info, list):
  39. for i in range(0, len(self.attachment_info)):
  40. element = self.attachment_info[i]
  41. if hasattr(element, 'to_alipay_dict'):
  42. self.attachment_info[i] = element.to_alipay_dict()
  43. if hasattr(self.attachment_info, 'to_alipay_dict'):
  44. params['attachment_info'] = self.attachment_info.to_alipay_dict()
  45. else:
  46. params['attachment_info'] = self.attachment_info
  47. if self.memo:
  48. if hasattr(self.memo, 'to_alipay_dict'):
  49. params['memo'] = self.memo.to_alipay_dict()
  50. else:
  51. params['memo'] = self.memo
  52. if self.sub_merchant_id:
  53. if hasattr(self.sub_merchant_id, 'to_alipay_dict'):
  54. params['sub_merchant_id'] = self.sub_merchant_id.to_alipay_dict()
  55. else:
  56. params['sub_merchant_id'] = self.sub_merchant_id
  57. return params
  58. @staticmethod
  59. def from_alipay_dict(d):
  60. if not d:
  61. return None
  62. o = AntMerchantExpandIndirectAttachmentUploadModel()
  63. if 'attachment_info' in d:
  64. o.attachment_info = d['attachment_info']
  65. if 'memo' in d:
  66. o.memo = d['memo']
  67. if 'sub_merchant_id' in d:
  68. o.sub_merchant_id = d['sub_merchant_id']
  69. return o