VoucherLiteInfo.py 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. import json
  4. from alipay.aop.api.constant.ParamConstants import *
  5. class VoucherLiteInfo(object):
  6. def __init__(self):
  7. self._send_time = None
  8. self._status = None
  9. self._template_id = None
  10. self._voucher_id = None
  11. @property
  12. def send_time(self):
  13. return self._send_time
  14. @send_time.setter
  15. def send_time(self, value):
  16. self._send_time = value
  17. @property
  18. def status(self):
  19. return self._status
  20. @status.setter
  21. def status(self, value):
  22. self._status = value
  23. @property
  24. def template_id(self):
  25. return self._template_id
  26. @template_id.setter
  27. def template_id(self, value):
  28. self._template_id = value
  29. @property
  30. def voucher_id(self):
  31. return self._voucher_id
  32. @voucher_id.setter
  33. def voucher_id(self, value):
  34. self._voucher_id = value
  35. def to_alipay_dict(self):
  36. params = dict()
  37. if self.send_time:
  38. if hasattr(self.send_time, 'to_alipay_dict'):
  39. params['send_time'] = self.send_time.to_alipay_dict()
  40. else:
  41. params['send_time'] = self.send_time
  42. if self.status:
  43. if hasattr(self.status, 'to_alipay_dict'):
  44. params['status'] = self.status.to_alipay_dict()
  45. else:
  46. params['status'] = self.status
  47. if self.template_id:
  48. if hasattr(self.template_id, 'to_alipay_dict'):
  49. params['template_id'] = self.template_id.to_alipay_dict()
  50. else:
  51. params['template_id'] = self.template_id
  52. if self.voucher_id:
  53. if hasattr(self.voucher_id, 'to_alipay_dict'):
  54. params['voucher_id'] = self.voucher_id.to_alipay_dict()
  55. else:
  56. params['voucher_id'] = self.voucher_id
  57. return params
  58. @staticmethod
  59. def from_alipay_dict(d):
  60. if not d:
  61. return None
  62. o = VoucherLiteInfo()
  63. if 'send_time' in d:
  64. o.send_time = d['send_time']
  65. if 'status' in d:
  66. o.status = d['status']
  67. if 'template_id' in d:
  68. o.template_id = d['template_id']
  69. if 'voucher_id' in d:
  70. o.voucher_id = d['voucher_id']
  71. return o