McardNotifyMessage.py 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. import json
  4. from alipay.aop.api.constant.ParamConstants import *
  5. class McardNotifyMessage(object):
  6. def __init__(self):
  7. self._change_reason = None
  8. self._ext_info = None
  9. self._message_type = None
  10. @property
  11. def change_reason(self):
  12. return self._change_reason
  13. @change_reason.setter
  14. def change_reason(self, value):
  15. self._change_reason = value
  16. @property
  17. def ext_info(self):
  18. return self._ext_info
  19. @ext_info.setter
  20. def ext_info(self, value):
  21. self._ext_info = value
  22. @property
  23. def message_type(self):
  24. return self._message_type
  25. @message_type.setter
  26. def message_type(self, value):
  27. self._message_type = value
  28. def to_alipay_dict(self):
  29. params = dict()
  30. if self.change_reason:
  31. if hasattr(self.change_reason, 'to_alipay_dict'):
  32. params['change_reason'] = self.change_reason.to_alipay_dict()
  33. else:
  34. params['change_reason'] = self.change_reason
  35. if self.ext_info:
  36. if hasattr(self.ext_info, 'to_alipay_dict'):
  37. params['ext_info'] = self.ext_info.to_alipay_dict()
  38. else:
  39. params['ext_info'] = self.ext_info
  40. if self.message_type:
  41. if hasattr(self.message_type, 'to_alipay_dict'):
  42. params['message_type'] = self.message_type.to_alipay_dict()
  43. else:
  44. params['message_type'] = self.message_type
  45. return params
  46. @staticmethod
  47. def from_alipay_dict(d):
  48. if not d:
  49. return None
  50. o = McardNotifyMessage()
  51. if 'change_reason' in d:
  52. o.change_reason = d['change_reason']
  53. if 'ext_info' in d:
  54. o.ext_info = d['ext_info']
  55. if 'message_type' in d:
  56. o.message_type = d['message_type']
  57. return o