HelloBikePriceConstraint.py 4.1 KB

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