ShopDiscountInfo.py 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. import json
  4. from alipay.aop.api.constant.ParamConstants import *
  5. class ShopDiscountInfo(object):
  6. def __init__(self):
  7. self._cover = None
  8. self._description = None
  9. self._is_all = None
  10. self._item_id = None
  11. self._promo_sub_type = None
  12. self._promotion_type = None
  13. self._purchase_mode = None
  14. self._sales_quantity = None
  15. self._subject = None
  16. @property
  17. def cover(self):
  18. return self._cover
  19. @cover.setter
  20. def cover(self, value):
  21. self._cover = value
  22. @property
  23. def description(self):
  24. return self._description
  25. @description.setter
  26. def description(self, value):
  27. self._description = value
  28. @property
  29. def is_all(self):
  30. return self._is_all
  31. @is_all.setter
  32. def is_all(self, value):
  33. self._is_all = value
  34. @property
  35. def item_id(self):
  36. return self._item_id
  37. @item_id.setter
  38. def item_id(self, value):
  39. self._item_id = value
  40. @property
  41. def promo_sub_type(self):
  42. return self._promo_sub_type
  43. @promo_sub_type.setter
  44. def promo_sub_type(self, value):
  45. self._promo_sub_type = value
  46. @property
  47. def promotion_type(self):
  48. return self._promotion_type
  49. @promotion_type.setter
  50. def promotion_type(self, value):
  51. self._promotion_type = value
  52. @property
  53. def purchase_mode(self):
  54. return self._purchase_mode
  55. @purchase_mode.setter
  56. def purchase_mode(self, value):
  57. self._purchase_mode = value
  58. @property
  59. def sales_quantity(self):
  60. return self._sales_quantity
  61. @sales_quantity.setter
  62. def sales_quantity(self, value):
  63. self._sales_quantity = value
  64. @property
  65. def subject(self):
  66. return self._subject
  67. @subject.setter
  68. def subject(self, value):
  69. self._subject = value
  70. def to_alipay_dict(self):
  71. params = dict()
  72. if self.cover:
  73. if hasattr(self.cover, 'to_alipay_dict'):
  74. params['cover'] = self.cover.to_alipay_dict()
  75. else:
  76. params['cover'] = self.cover
  77. if self.description:
  78. if hasattr(self.description, 'to_alipay_dict'):
  79. params['description'] = self.description.to_alipay_dict()
  80. else:
  81. params['description'] = self.description
  82. if self.is_all:
  83. if hasattr(self.is_all, 'to_alipay_dict'):
  84. params['is_all'] = self.is_all.to_alipay_dict()
  85. else:
  86. params['is_all'] = self.is_all
  87. if self.item_id:
  88. if hasattr(self.item_id, 'to_alipay_dict'):
  89. params['item_id'] = self.item_id.to_alipay_dict()
  90. else:
  91. params['item_id'] = self.item_id
  92. if self.promo_sub_type:
  93. if hasattr(self.promo_sub_type, 'to_alipay_dict'):
  94. params['promo_sub_type'] = self.promo_sub_type.to_alipay_dict()
  95. else:
  96. params['promo_sub_type'] = self.promo_sub_type
  97. if self.promotion_type:
  98. if hasattr(self.promotion_type, 'to_alipay_dict'):
  99. params['promotion_type'] = self.promotion_type.to_alipay_dict()
  100. else:
  101. params['promotion_type'] = self.promotion_type
  102. if self.purchase_mode:
  103. if hasattr(self.purchase_mode, 'to_alipay_dict'):
  104. params['purchase_mode'] = self.purchase_mode.to_alipay_dict()
  105. else:
  106. params['purchase_mode'] = self.purchase_mode
  107. if self.sales_quantity:
  108. if hasattr(self.sales_quantity, 'to_alipay_dict'):
  109. params['sales_quantity'] = self.sales_quantity.to_alipay_dict()
  110. else:
  111. params['sales_quantity'] = self.sales_quantity
  112. if self.subject:
  113. if hasattr(self.subject, 'to_alipay_dict'):
  114. params['subject'] = self.subject.to_alipay_dict()
  115. else:
  116. params['subject'] = self.subject
  117. return params
  118. @staticmethod
  119. def from_alipay_dict(d):
  120. if not d:
  121. return None
  122. o = ShopDiscountInfo()
  123. if 'cover' in d:
  124. o.cover = d['cover']
  125. if 'description' in d:
  126. o.description = d['description']
  127. if 'is_all' in d:
  128. o.is_all = d['is_all']
  129. if 'item_id' in d:
  130. o.item_id = d['item_id']
  131. if 'promo_sub_type' in d:
  132. o.promo_sub_type = d['promo_sub_type']
  133. if 'promotion_type' in d:
  134. o.promotion_type = d['promotion_type']
  135. if 'purchase_mode' in d:
  136. o.purchase_mode = d['purchase_mode']
  137. if 'sales_quantity' in d:
  138. o.sales_quantity = d['sales_quantity']
  139. if 'subject' in d:
  140. o.subject = d['subject']
  141. return o