AlipayOpenMiniMorphoAppgrayOnlineModel.py 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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.MorphoIdentity import MorphoIdentity
  6. class AlipayOpenMiniMorphoAppgrayOnlineModel(object):
  7. def __init__(self):
  8. self._gray_strategy = None
  9. self._id = None
  10. self._identity = None
  11. @property
  12. def gray_strategy(self):
  13. return self._gray_strategy
  14. @gray_strategy.setter
  15. def gray_strategy(self, value):
  16. self._gray_strategy = value
  17. @property
  18. def id(self):
  19. return self._id
  20. @id.setter
  21. def id(self, value):
  22. self._id = value
  23. @property
  24. def identity(self):
  25. return self._identity
  26. @identity.setter
  27. def identity(self, value):
  28. if isinstance(value, MorphoIdentity):
  29. self._identity = value
  30. else:
  31. self._identity = MorphoIdentity.from_alipay_dict(value)
  32. def to_alipay_dict(self):
  33. params = dict()
  34. if self.gray_strategy:
  35. if hasattr(self.gray_strategy, 'to_alipay_dict'):
  36. params['gray_strategy'] = self.gray_strategy.to_alipay_dict()
  37. else:
  38. params['gray_strategy'] = self.gray_strategy
  39. if self.id:
  40. if hasattr(self.id, 'to_alipay_dict'):
  41. params['id'] = self.id.to_alipay_dict()
  42. else:
  43. params['id'] = self.id
  44. if self.identity:
  45. if hasattr(self.identity, 'to_alipay_dict'):
  46. params['identity'] = self.identity.to_alipay_dict()
  47. else:
  48. params['identity'] = self.identity
  49. return params
  50. @staticmethod
  51. def from_alipay_dict(d):
  52. if not d:
  53. return None
  54. o = AlipayOpenMiniMorphoAppgrayOnlineModel()
  55. if 'gray_strategy' in d:
  56. o.gray_strategy = d['gray_strategy']
  57. if 'id' in d:
  58. o.id = d['id']
  59. if 'identity' in d:
  60. o.identity = d['identity']
  61. return o