MBudgetInfo.py 1.9 KB

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