PubChannelDTO.py 1.3 KB

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