ZhimaCreditPeUserAuthApplyModel.py 2.3 KB

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