OutDiscountInfo.py 2.0 KB

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