HelloBikePriceCondition.py 2.7 KB

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