PosDiscountDetail.py 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. import json
  4. from alipay.aop.api.constant.ParamConstants import *
  5. class PosDiscountDetail(object):
  6. def __init__(self):
  7. self._activity_id = None
  8. self._activity_type = None
  9. self._discount_name = None
  10. self._discount_type = None
  11. self._dish_id = None
  12. self._ext_info = None
  13. self._mrt_discount = None
  14. self._rt_discount = None
  15. self._target_user_type = None
  16. self._used_item_id = None
  17. @property
  18. def activity_id(self):
  19. return self._activity_id
  20. @activity_id.setter
  21. def activity_id(self, value):
  22. self._activity_id = value
  23. @property
  24. def activity_type(self):
  25. return self._activity_type
  26. @activity_type.setter
  27. def activity_type(self, value):
  28. self._activity_type = value
  29. @property
  30. def discount_name(self):
  31. return self._discount_name
  32. @discount_name.setter
  33. def discount_name(self, value):
  34. self._discount_name = value
  35. @property
  36. def discount_type(self):
  37. return self._discount_type
  38. @discount_type.setter
  39. def discount_type(self, value):
  40. self._discount_type = value
  41. @property
  42. def dish_id(self):
  43. return self._dish_id
  44. @dish_id.setter
  45. def dish_id(self, value):
  46. self._dish_id = value
  47. @property
  48. def ext_info(self):
  49. return self._ext_info
  50. @ext_info.setter
  51. def ext_info(self, value):
  52. self._ext_info = value
  53. @property
  54. def mrt_discount(self):
  55. return self._mrt_discount
  56. @mrt_discount.setter
  57. def mrt_discount(self, value):
  58. self._mrt_discount = value
  59. @property
  60. def rt_discount(self):
  61. return self._rt_discount
  62. @rt_discount.setter
  63. def rt_discount(self, value):
  64. self._rt_discount = value
  65. @property
  66. def target_user_type(self):
  67. return self._target_user_type
  68. @target_user_type.setter
  69. def target_user_type(self, value):
  70. self._target_user_type = value
  71. @property
  72. def used_item_id(self):
  73. return self._used_item_id
  74. @used_item_id.setter
  75. def used_item_id(self, value):
  76. self._used_item_id = value
  77. def to_alipay_dict(self):
  78. params = dict()
  79. if self.activity_id:
  80. if hasattr(self.activity_id, 'to_alipay_dict'):
  81. params['activity_id'] = self.activity_id.to_alipay_dict()
  82. else:
  83. params['activity_id'] = self.activity_id
  84. if self.activity_type:
  85. if hasattr(self.activity_type, 'to_alipay_dict'):
  86. params['activity_type'] = self.activity_type.to_alipay_dict()
  87. else:
  88. params['activity_type'] = self.activity_type
  89. if self.discount_name:
  90. if hasattr(self.discount_name, 'to_alipay_dict'):
  91. params['discount_name'] = self.discount_name.to_alipay_dict()
  92. else:
  93. params['discount_name'] = self.discount_name
  94. if self.discount_type:
  95. if hasattr(self.discount_type, 'to_alipay_dict'):
  96. params['discount_type'] = self.discount_type.to_alipay_dict()
  97. else:
  98. params['discount_type'] = self.discount_type
  99. if self.dish_id:
  100. if hasattr(self.dish_id, 'to_alipay_dict'):
  101. params['dish_id'] = self.dish_id.to_alipay_dict()
  102. else:
  103. params['dish_id'] = self.dish_id
  104. if self.ext_info:
  105. if hasattr(self.ext_info, 'to_alipay_dict'):
  106. params['ext_info'] = self.ext_info.to_alipay_dict()
  107. else:
  108. params['ext_info'] = self.ext_info
  109. if self.mrt_discount:
  110. if hasattr(self.mrt_discount, 'to_alipay_dict'):
  111. params['mrt_discount'] = self.mrt_discount.to_alipay_dict()
  112. else:
  113. params['mrt_discount'] = self.mrt_discount
  114. if self.rt_discount:
  115. if hasattr(self.rt_discount, 'to_alipay_dict'):
  116. params['rt_discount'] = self.rt_discount.to_alipay_dict()
  117. else:
  118. params['rt_discount'] = self.rt_discount
  119. if self.target_user_type:
  120. if hasattr(self.target_user_type, 'to_alipay_dict'):
  121. params['target_user_type'] = self.target_user_type.to_alipay_dict()
  122. else:
  123. params['target_user_type'] = self.target_user_type
  124. if self.used_item_id:
  125. if hasattr(self.used_item_id, 'to_alipay_dict'):
  126. params['used_item_id'] = self.used_item_id.to_alipay_dict()
  127. else:
  128. params['used_item_id'] = self.used_item_id
  129. return params
  130. @staticmethod
  131. def from_alipay_dict(d):
  132. if not d:
  133. return None
  134. o = PosDiscountDetail()
  135. if 'activity_id' in d:
  136. o.activity_id = d['activity_id']
  137. if 'activity_type' in d:
  138. o.activity_type = d['activity_type']
  139. if 'discount_name' in d:
  140. o.discount_name = d['discount_name']
  141. if 'discount_type' in d:
  142. o.discount_type = d['discount_type']
  143. if 'dish_id' in d:
  144. o.dish_id = d['dish_id']
  145. if 'ext_info' in d:
  146. o.ext_info = d['ext_info']
  147. if 'mrt_discount' in d:
  148. o.mrt_discount = d['mrt_discount']
  149. if 'rt_discount' in d:
  150. o.rt_discount = d['rt_discount']
  151. if 'target_user_type' in d:
  152. o.target_user_type = d['target_user_type']
  153. if 'used_item_id' in d:
  154. o.used_item_id = d['used_item_id']
  155. return o