FeeValue.py 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. import json
  4. from alipay.aop.api.constant.ParamConstants import *
  5. class FeeValue(object):
  6. def __init__(self):
  7. self._bottom_cent = None
  8. self._currency_code = None
  9. self._fix_cent = None
  10. self._lower = None
  11. self._rate_unit = None
  12. self._rate_value = None
  13. self._top_cent = None
  14. self._upper = None
  15. @property
  16. def bottom_cent(self):
  17. return self._bottom_cent
  18. @bottom_cent.setter
  19. def bottom_cent(self, value):
  20. self._bottom_cent = value
  21. @property
  22. def currency_code(self):
  23. return self._currency_code
  24. @currency_code.setter
  25. def currency_code(self, value):
  26. self._currency_code = value
  27. @property
  28. def fix_cent(self):
  29. return self._fix_cent
  30. @fix_cent.setter
  31. def fix_cent(self, value):
  32. self._fix_cent = value
  33. @property
  34. def lower(self):
  35. return self._lower
  36. @lower.setter
  37. def lower(self, value):
  38. self._lower = value
  39. @property
  40. def rate_unit(self):
  41. return self._rate_unit
  42. @rate_unit.setter
  43. def rate_unit(self, value):
  44. self._rate_unit = value
  45. @property
  46. def rate_value(self):
  47. return self._rate_value
  48. @rate_value.setter
  49. def rate_value(self, value):
  50. self._rate_value = value
  51. @property
  52. def top_cent(self):
  53. return self._top_cent
  54. @top_cent.setter
  55. def top_cent(self, value):
  56. self._top_cent = value
  57. @property
  58. def upper(self):
  59. return self._upper
  60. @upper.setter
  61. def upper(self, value):
  62. self._upper = value
  63. def to_alipay_dict(self):
  64. params = dict()
  65. if self.bottom_cent:
  66. if hasattr(self.bottom_cent, 'to_alipay_dict'):
  67. params['bottom_cent'] = self.bottom_cent.to_alipay_dict()
  68. else:
  69. params['bottom_cent'] = self.bottom_cent
  70. if self.currency_code:
  71. if hasattr(self.currency_code, 'to_alipay_dict'):
  72. params['currency_code'] = self.currency_code.to_alipay_dict()
  73. else:
  74. params['currency_code'] = self.currency_code
  75. if self.fix_cent:
  76. if hasattr(self.fix_cent, 'to_alipay_dict'):
  77. params['fix_cent'] = self.fix_cent.to_alipay_dict()
  78. else:
  79. params['fix_cent'] = self.fix_cent
  80. if self.lower:
  81. if hasattr(self.lower, 'to_alipay_dict'):
  82. params['lower'] = self.lower.to_alipay_dict()
  83. else:
  84. params['lower'] = self.lower
  85. if self.rate_unit:
  86. if hasattr(self.rate_unit, 'to_alipay_dict'):
  87. params['rate_unit'] = self.rate_unit.to_alipay_dict()
  88. else:
  89. params['rate_unit'] = self.rate_unit
  90. if self.rate_value:
  91. if hasattr(self.rate_value, 'to_alipay_dict'):
  92. params['rate_value'] = self.rate_value.to_alipay_dict()
  93. else:
  94. params['rate_value'] = self.rate_value
  95. if self.top_cent:
  96. if hasattr(self.top_cent, 'to_alipay_dict'):
  97. params['top_cent'] = self.top_cent.to_alipay_dict()
  98. else:
  99. params['top_cent'] = self.top_cent
  100. if self.upper:
  101. if hasattr(self.upper, 'to_alipay_dict'):
  102. params['upper'] = self.upper.to_alipay_dict()
  103. else:
  104. params['upper'] = self.upper
  105. return params
  106. @staticmethod
  107. def from_alipay_dict(d):
  108. if not d:
  109. return None
  110. o = FeeValue()
  111. if 'bottom_cent' in d:
  112. o.bottom_cent = d['bottom_cent']
  113. if 'currency_code' in d:
  114. o.currency_code = d['currency_code']
  115. if 'fix_cent' in d:
  116. o.fix_cent = d['fix_cent']
  117. if 'lower' in d:
  118. o.lower = d['lower']
  119. if 'rate_unit' in d:
  120. o.rate_unit = d['rate_unit']
  121. if 'rate_value' in d:
  122. o.rate_value = d['rate_value']
  123. if 'top_cent' in d:
  124. o.top_cent = d['top_cent']
  125. if 'upper' in d:
  126. o.upper = d['upper']
  127. return o