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