PromoteItemModel.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 PromoteItemModel(object):
  6. def __init__(self):
  7. self._brand_name = None
  8. self._merchant_name = None
  9. self._voucher_name = None
  10. @property
  11. def brand_name(self):
  12. return self._brand_name
  13. @brand_name.setter
  14. def brand_name(self, value):
  15. self._brand_name = value
  16. @property
  17. def merchant_name(self):
  18. return self._merchant_name
  19. @merchant_name.setter
  20. def merchant_name(self, value):
  21. self._merchant_name = value
  22. @property
  23. def voucher_name(self):
  24. return self._voucher_name
  25. @voucher_name.setter
  26. def voucher_name(self, value):
  27. self._voucher_name = value
  28. def to_alipay_dict(self):
  29. params = dict()
  30. if self.brand_name:
  31. if hasattr(self.brand_name, 'to_alipay_dict'):
  32. params['brand_name'] = self.brand_name.to_alipay_dict()
  33. else:
  34. params['brand_name'] = self.brand_name
  35. if self.merchant_name:
  36. if hasattr(self.merchant_name, 'to_alipay_dict'):
  37. params['merchant_name'] = self.merchant_name.to_alipay_dict()
  38. else:
  39. params['merchant_name'] = self.merchant_name
  40. if self.voucher_name:
  41. if hasattr(self.voucher_name, 'to_alipay_dict'):
  42. params['voucher_name'] = self.voucher_name.to_alipay_dict()
  43. else:
  44. params['voucher_name'] = self.voucher_name
  45. return params
  46. @staticmethod
  47. def from_alipay_dict(d):
  48. if not d:
  49. return None
  50. o = PromoteItemModel()
  51. if 'brand_name' in d:
  52. o.brand_name = d['brand_name']
  53. if 'merchant_name' in d:
  54. o.merchant_name = d['merchant_name']
  55. if 'voucher_name' in d:
  56. o.voucher_name = d['voucher_name']
  57. return o