AgentOrganization.py 1.8 KB

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