CPCommunitySet.py 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. import json
  4. from alipay.aop.api.constant.ParamConstants import *
  5. class CPCommunitySet(object):
  6. def __init__(self):
  7. self._community_id = None
  8. self._merchant_pid = None
  9. self._out_community_id = None
  10. self._status = None
  11. @property
  12. def community_id(self):
  13. return self._community_id
  14. @community_id.setter
  15. def community_id(self, value):
  16. self._community_id = value
  17. @property
  18. def merchant_pid(self):
  19. return self._merchant_pid
  20. @merchant_pid.setter
  21. def merchant_pid(self, value):
  22. self._merchant_pid = value
  23. @property
  24. def out_community_id(self):
  25. return self._out_community_id
  26. @out_community_id.setter
  27. def out_community_id(self, value):
  28. self._out_community_id = value
  29. @property
  30. def status(self):
  31. return self._status
  32. @status.setter
  33. def status(self, value):
  34. self._status = value
  35. def to_alipay_dict(self):
  36. params = dict()
  37. if self.community_id:
  38. if hasattr(self.community_id, 'to_alipay_dict'):
  39. params['community_id'] = self.community_id.to_alipay_dict()
  40. else:
  41. params['community_id'] = self.community_id
  42. if self.merchant_pid:
  43. if hasattr(self.merchant_pid, 'to_alipay_dict'):
  44. params['merchant_pid'] = self.merchant_pid.to_alipay_dict()
  45. else:
  46. params['merchant_pid'] = self.merchant_pid
  47. if self.out_community_id:
  48. if hasattr(self.out_community_id, 'to_alipay_dict'):
  49. params['out_community_id'] = self.out_community_id.to_alipay_dict()
  50. else:
  51. params['out_community_id'] = self.out_community_id
  52. if self.status:
  53. if hasattr(self.status, 'to_alipay_dict'):
  54. params['status'] = self.status.to_alipay_dict()
  55. else:
  56. params['status'] = self.status
  57. return params
  58. @staticmethod
  59. def from_alipay_dict(d):
  60. if not d:
  61. return None
  62. o = CPCommunitySet()
  63. if 'community_id' in d:
  64. o.community_id = d['community_id']
  65. if 'merchant_pid' in d:
  66. o.merchant_pid = d['merchant_pid']
  67. if 'out_community_id' in d:
  68. o.out_community_id = d['out_community_id']
  69. if 'status' in d:
  70. o.status = d['status']
  71. return o