OpenItem.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 OpenItem(object):
  6. def __init__(self):
  7. self._item_id = None
  8. self._item_status = None
  9. self._store_id = None
  10. @property
  11. def item_id(self):
  12. return self._item_id
  13. @item_id.setter
  14. def item_id(self, value):
  15. self._item_id = value
  16. @property
  17. def item_status(self):
  18. return self._item_status
  19. @item_status.setter
  20. def item_status(self, value):
  21. self._item_status = value
  22. @property
  23. def store_id(self):
  24. return self._store_id
  25. @store_id.setter
  26. def store_id(self, value):
  27. self._store_id = value
  28. def to_alipay_dict(self):
  29. params = dict()
  30. if self.item_id:
  31. if hasattr(self.item_id, 'to_alipay_dict'):
  32. params['item_id'] = self.item_id.to_alipay_dict()
  33. else:
  34. params['item_id'] = self.item_id
  35. if self.item_status:
  36. if hasattr(self.item_status, 'to_alipay_dict'):
  37. params['item_status'] = self.item_status.to_alipay_dict()
  38. else:
  39. params['item_status'] = self.item_status
  40. if self.store_id:
  41. if hasattr(self.store_id, 'to_alipay_dict'):
  42. params['store_id'] = self.store_id.to_alipay_dict()
  43. else:
  44. params['store_id'] = self.store_id
  45. return params
  46. @staticmethod
  47. def from_alipay_dict(d):
  48. if not d:
  49. return None
  50. o = OpenItem()
  51. if 'item_id' in d:
  52. o.item_id = d['item_id']
  53. if 'item_status' in d:
  54. o.item_status = d['item_status']
  55. if 'store_id' in d:
  56. o.store_id = d['store_id']
  57. return o