VoucherVO.py 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. import json
  4. from alipay.aop.api.constant.ParamConstants import *
  5. class VoucherVO(object):
  6. def __init__(self):
  7. self._gmt_active = None
  8. self._gmt_expired = None
  9. self._name = None
  10. self._threshold_amount = None
  11. self._total_amount = None
  12. self._voucher_id = None
  13. self._voucher_template_id = None
  14. @property
  15. def gmt_active(self):
  16. return self._gmt_active
  17. @gmt_active.setter
  18. def gmt_active(self, value):
  19. self._gmt_active = value
  20. @property
  21. def gmt_expired(self):
  22. return self._gmt_expired
  23. @gmt_expired.setter
  24. def gmt_expired(self, value):
  25. self._gmt_expired = value
  26. @property
  27. def name(self):
  28. return self._name
  29. @name.setter
  30. def name(self, value):
  31. self._name = value
  32. @property
  33. def threshold_amount(self):
  34. return self._threshold_amount
  35. @threshold_amount.setter
  36. def threshold_amount(self, value):
  37. self._threshold_amount = value
  38. @property
  39. def total_amount(self):
  40. return self._total_amount
  41. @total_amount.setter
  42. def total_amount(self, value):
  43. self._total_amount = value
  44. @property
  45. def voucher_id(self):
  46. return self._voucher_id
  47. @voucher_id.setter
  48. def voucher_id(self, value):
  49. self._voucher_id = value
  50. @property
  51. def voucher_template_id(self):
  52. return self._voucher_template_id
  53. @voucher_template_id.setter
  54. def voucher_template_id(self, value):
  55. self._voucher_template_id = value
  56. def to_alipay_dict(self):
  57. params = dict()
  58. if self.gmt_active:
  59. if hasattr(self.gmt_active, 'to_alipay_dict'):
  60. params['gmt_active'] = self.gmt_active.to_alipay_dict()
  61. else:
  62. params['gmt_active'] = self.gmt_active
  63. if self.gmt_expired:
  64. if hasattr(self.gmt_expired, 'to_alipay_dict'):
  65. params['gmt_expired'] = self.gmt_expired.to_alipay_dict()
  66. else:
  67. params['gmt_expired'] = self.gmt_expired
  68. if self.name:
  69. if hasattr(self.name, 'to_alipay_dict'):
  70. params['name'] = self.name.to_alipay_dict()
  71. else:
  72. params['name'] = self.name
  73. if self.threshold_amount:
  74. if hasattr(self.threshold_amount, 'to_alipay_dict'):
  75. params['threshold_amount'] = self.threshold_amount.to_alipay_dict()
  76. else:
  77. params['threshold_amount'] = self.threshold_amount
  78. if self.total_amount:
  79. if hasattr(self.total_amount, 'to_alipay_dict'):
  80. params['total_amount'] = self.total_amount.to_alipay_dict()
  81. else:
  82. params['total_amount'] = self.total_amount
  83. if self.voucher_id:
  84. if hasattr(self.voucher_id, 'to_alipay_dict'):
  85. params['voucher_id'] = self.voucher_id.to_alipay_dict()
  86. else:
  87. params['voucher_id'] = self.voucher_id
  88. if self.voucher_template_id:
  89. if hasattr(self.voucher_template_id, 'to_alipay_dict'):
  90. params['voucher_template_id'] = self.voucher_template_id.to_alipay_dict()
  91. else:
  92. params['voucher_template_id'] = self.voucher_template_id
  93. return params
  94. @staticmethod
  95. def from_alipay_dict(d):
  96. if not d:
  97. return None
  98. o = VoucherVO()
  99. if 'gmt_active' in d:
  100. o.gmt_active = d['gmt_active']
  101. if 'gmt_expired' in d:
  102. o.gmt_expired = d['gmt_expired']
  103. if 'name' in d:
  104. o.name = d['name']
  105. if 'threshold_amount' in d:
  106. o.threshold_amount = d['threshold_amount']
  107. if 'total_amount' in d:
  108. o.total_amount = d['total_amount']
  109. if 'voucher_id' in d:
  110. o.voucher_id = d['voucher_id']
  111. if 'voucher_template_id' in d:
  112. o.voucher_template_id = d['voucher_template_id']
  113. return o