MakePriceResult.py 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. import json
  4. from alipay.aop.api.constant.ParamConstants import *
  5. class MakePriceResult(object):
  6. def __init__(self):
  7. self._base_price_cent = None
  8. self._product_type = None
  9. self._promo_price = None
  10. @property
  11. def base_price_cent(self):
  12. return self._base_price_cent
  13. @base_price_cent.setter
  14. def base_price_cent(self, value):
  15. self._base_price_cent = value
  16. @property
  17. def product_type(self):
  18. return self._product_type
  19. @product_type.setter
  20. def product_type(self, value):
  21. self._product_type = value
  22. @property
  23. def promo_price(self):
  24. return self._promo_price
  25. @promo_price.setter
  26. def promo_price(self, value):
  27. self._promo_price = value
  28. def to_alipay_dict(self):
  29. params = dict()
  30. if self.base_price_cent:
  31. if hasattr(self.base_price_cent, 'to_alipay_dict'):
  32. params['base_price_cent'] = self.base_price_cent.to_alipay_dict()
  33. else:
  34. params['base_price_cent'] = self.base_price_cent
  35. if self.product_type:
  36. if hasattr(self.product_type, 'to_alipay_dict'):
  37. params['product_type'] = self.product_type.to_alipay_dict()
  38. else:
  39. params['product_type'] = self.product_type
  40. if self.promo_price:
  41. if hasattr(self.promo_price, 'to_alipay_dict'):
  42. params['promo_price'] = self.promo_price.to_alipay_dict()
  43. else:
  44. params['promo_price'] = self.promo_price
  45. return params
  46. @staticmethod
  47. def from_alipay_dict(d):
  48. if not d:
  49. return None
  50. o = MakePriceResult()
  51. if 'base_price_cent' in d:
  52. o.base_price_cent = d['base_price_cent']
  53. if 'product_type' in d:
  54. o.product_type = d['product_type']
  55. if 'promo_price' in d:
  56. o.promo_price = d['promo_price']
  57. return o