CreditPayDiscountVO.py 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. import json
  4. from alipay.aop.api.constant.ParamConstants import *
  5. class CreditPayDiscountVO(object):
  6. def __init__(self):
  7. self._discount_desc = None
  8. self._discount_name = None
  9. self._full_discount_rate = None
  10. self._has_discount = None
  11. self._is_uneven_discount = None
  12. @property
  13. def discount_desc(self):
  14. return self._discount_desc
  15. @discount_desc.setter
  16. def discount_desc(self, value):
  17. self._discount_desc = value
  18. @property
  19. def discount_name(self):
  20. return self._discount_name
  21. @discount_name.setter
  22. def discount_name(self, value):
  23. self._discount_name = value
  24. @property
  25. def full_discount_rate(self):
  26. return self._full_discount_rate
  27. @full_discount_rate.setter
  28. def full_discount_rate(self, value):
  29. self._full_discount_rate = value
  30. @property
  31. def has_discount(self):
  32. return self._has_discount
  33. @has_discount.setter
  34. def has_discount(self, value):
  35. self._has_discount = value
  36. @property
  37. def is_uneven_discount(self):
  38. return self._is_uneven_discount
  39. @is_uneven_discount.setter
  40. def is_uneven_discount(self, value):
  41. self._is_uneven_discount = value
  42. def to_alipay_dict(self):
  43. params = dict()
  44. if self.discount_desc:
  45. if hasattr(self.discount_desc, 'to_alipay_dict'):
  46. params['discount_desc'] = self.discount_desc.to_alipay_dict()
  47. else:
  48. params['discount_desc'] = self.discount_desc
  49. if self.discount_name:
  50. if hasattr(self.discount_name, 'to_alipay_dict'):
  51. params['discount_name'] = self.discount_name.to_alipay_dict()
  52. else:
  53. params['discount_name'] = self.discount_name
  54. if self.full_discount_rate:
  55. if hasattr(self.full_discount_rate, 'to_alipay_dict'):
  56. params['full_discount_rate'] = self.full_discount_rate.to_alipay_dict()
  57. else:
  58. params['full_discount_rate'] = self.full_discount_rate
  59. if self.has_discount:
  60. if hasattr(self.has_discount, 'to_alipay_dict'):
  61. params['has_discount'] = self.has_discount.to_alipay_dict()
  62. else:
  63. params['has_discount'] = self.has_discount
  64. if self.is_uneven_discount:
  65. if hasattr(self.is_uneven_discount, 'to_alipay_dict'):
  66. params['is_uneven_discount'] = self.is_uneven_discount.to_alipay_dict()
  67. else:
  68. params['is_uneven_discount'] = self.is_uneven_discount
  69. return params
  70. @staticmethod
  71. def from_alipay_dict(d):
  72. if not d:
  73. return None
  74. o = CreditPayDiscountVO()
  75. if 'discount_desc' in d:
  76. o.discount_desc = d['discount_desc']
  77. if 'discount_name' in d:
  78. o.discount_name = d['discount_name']
  79. if 'full_discount_rate' in d:
  80. o.full_discount_rate = d['full_discount_rate']
  81. if 'has_discount' in d:
  82. o.has_discount = d['has_discount']
  83. if 'is_uneven_discount' in d:
  84. o.is_uneven_discount = d['is_uneven_discount']
  85. return o