WorldBaseRPCResponseInfo.py 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  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.WorldErrorIndicator import WorldErrorIndicator
  6. class WorldBaseRPCResponseInfo(object):
  7. def __init__(self):
  8. self._error_indicator = None
  9. self._ext_info = None
  10. self._success = None
  11. self._time = None
  12. @property
  13. def error_indicator(self):
  14. return self._error_indicator
  15. @error_indicator.setter
  16. def error_indicator(self, value):
  17. if isinstance(value, WorldErrorIndicator):
  18. self._error_indicator = value
  19. else:
  20. self._error_indicator = WorldErrorIndicator.from_alipay_dict(value)
  21. @property
  22. def ext_info(self):
  23. return self._ext_info
  24. @ext_info.setter
  25. def ext_info(self, value):
  26. self._ext_info = value
  27. @property
  28. def success(self):
  29. return self._success
  30. @success.setter
  31. def success(self, value):
  32. self._success = value
  33. @property
  34. def time(self):
  35. return self._time
  36. @time.setter
  37. def time(self, value):
  38. self._time = value
  39. def to_alipay_dict(self):
  40. params = dict()
  41. if self.error_indicator:
  42. if hasattr(self.error_indicator, 'to_alipay_dict'):
  43. params['error_indicator'] = self.error_indicator.to_alipay_dict()
  44. else:
  45. params['error_indicator'] = self.error_indicator
  46. if self.ext_info:
  47. if hasattr(self.ext_info, 'to_alipay_dict'):
  48. params['ext_info'] = self.ext_info.to_alipay_dict()
  49. else:
  50. params['ext_info'] = self.ext_info
  51. if self.success:
  52. if hasattr(self.success, 'to_alipay_dict'):
  53. params['success'] = self.success.to_alipay_dict()
  54. else:
  55. params['success'] = self.success
  56. if self.time:
  57. if hasattr(self.time, 'to_alipay_dict'):
  58. params['time'] = self.time.to_alipay_dict()
  59. else:
  60. params['time'] = self.time
  61. return params
  62. @staticmethod
  63. def from_alipay_dict(d):
  64. if not d:
  65. return None
  66. o = WorldBaseRPCResponseInfo()
  67. if 'error_indicator' in d:
  68. o.error_indicator = d['error_indicator']
  69. if 'ext_info' in d:
  70. o.ext_info = d['ext_info']
  71. if 'success' in d:
  72. o.success = d['success']
  73. if 'time' in d:
  74. o.time = d['time']
  75. return o