ExRefRateInfoVO.py 3.8 KB

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