PromoVoucherInfo.py 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. import json
  4. from alipay.aop.api.constant.ParamConstants import *
  5. class PromoVoucherInfo(object):
  6. def __init__(self):
  7. self._discount = None
  8. self._is_auto_obtain = None
  9. self._is_mall_voucher = None
  10. self._item_brand_name = None
  11. self._item_gmt_end = None
  12. self._item_gmt_start = None
  13. self._item_id = None
  14. self._item_logo = None
  15. self._item_name = None
  16. self._send_item_name = None
  17. self._shop_id = None
  18. self._shop_name = None
  19. self._use_condition_amount = None
  20. self._value_amount = None
  21. self._voucher_detail_url = None
  22. self._voucher_type = None
  23. @property
  24. def discount(self):
  25. return self._discount
  26. @discount.setter
  27. def discount(self, value):
  28. self._discount = value
  29. @property
  30. def is_auto_obtain(self):
  31. return self._is_auto_obtain
  32. @is_auto_obtain.setter
  33. def is_auto_obtain(self, value):
  34. self._is_auto_obtain = value
  35. @property
  36. def is_mall_voucher(self):
  37. return self._is_mall_voucher
  38. @is_mall_voucher.setter
  39. def is_mall_voucher(self, value):
  40. self._is_mall_voucher = value
  41. @property
  42. def item_brand_name(self):
  43. return self._item_brand_name
  44. @item_brand_name.setter
  45. def item_brand_name(self, value):
  46. self._item_brand_name = value
  47. @property
  48. def item_gmt_end(self):
  49. return self._item_gmt_end
  50. @item_gmt_end.setter
  51. def item_gmt_end(self, value):
  52. self._item_gmt_end = value
  53. @property
  54. def item_gmt_start(self):
  55. return self._item_gmt_start
  56. @item_gmt_start.setter
  57. def item_gmt_start(self, value):
  58. self._item_gmt_start = value
  59. @property
  60. def item_id(self):
  61. return self._item_id
  62. @item_id.setter
  63. def item_id(self, value):
  64. self._item_id = value
  65. @property
  66. def item_logo(self):
  67. return self._item_logo
  68. @item_logo.setter
  69. def item_logo(self, value):
  70. self._item_logo = value
  71. @property
  72. def item_name(self):
  73. return self._item_name
  74. @item_name.setter
  75. def item_name(self, value):
  76. self._item_name = value
  77. @property
  78. def send_item_name(self):
  79. return self._send_item_name
  80. @send_item_name.setter
  81. def send_item_name(self, value):
  82. self._send_item_name = value
  83. @property
  84. def shop_id(self):
  85. return self._shop_id
  86. @shop_id.setter
  87. def shop_id(self, value):
  88. self._shop_id = value
  89. @property
  90. def shop_name(self):
  91. return self._shop_name
  92. @shop_name.setter
  93. def shop_name(self, value):
  94. self._shop_name = value
  95. @property
  96. def use_condition_amount(self):
  97. return self._use_condition_amount
  98. @use_condition_amount.setter
  99. def use_condition_amount(self, value):
  100. self._use_condition_amount = value
  101. @property
  102. def value_amount(self):
  103. return self._value_amount
  104. @value_amount.setter
  105. def value_amount(self, value):
  106. self._value_amount = value
  107. @property
  108. def voucher_detail_url(self):
  109. return self._voucher_detail_url
  110. @voucher_detail_url.setter
  111. def voucher_detail_url(self, value):
  112. self._voucher_detail_url = value
  113. @property
  114. def voucher_type(self):
  115. return self._voucher_type
  116. @voucher_type.setter
  117. def voucher_type(self, value):
  118. self._voucher_type = value
  119. def to_alipay_dict(self):
  120. params = dict()
  121. if self.discount:
  122. if hasattr(self.discount, 'to_alipay_dict'):
  123. params['discount'] = self.discount.to_alipay_dict()
  124. else:
  125. params['discount'] = self.discount
  126. if self.is_auto_obtain:
  127. if hasattr(self.is_auto_obtain, 'to_alipay_dict'):
  128. params['is_auto_obtain'] = self.is_auto_obtain.to_alipay_dict()
  129. else:
  130. params['is_auto_obtain'] = self.is_auto_obtain
  131. if self.is_mall_voucher:
  132. if hasattr(self.is_mall_voucher, 'to_alipay_dict'):
  133. params['is_mall_voucher'] = self.is_mall_voucher.to_alipay_dict()
  134. else:
  135. params['is_mall_voucher'] = self.is_mall_voucher
  136. if self.item_brand_name:
  137. if hasattr(self.item_brand_name, 'to_alipay_dict'):
  138. params['item_brand_name'] = self.item_brand_name.to_alipay_dict()
  139. else:
  140. params['item_brand_name'] = self.item_brand_name
  141. if self.item_gmt_end:
  142. if hasattr(self.item_gmt_end, 'to_alipay_dict'):
  143. params['item_gmt_end'] = self.item_gmt_end.to_alipay_dict()
  144. else:
  145. params['item_gmt_end'] = self.item_gmt_end
  146. if self.item_gmt_start:
  147. if hasattr(self.item_gmt_start, 'to_alipay_dict'):
  148. params['item_gmt_start'] = self.item_gmt_start.to_alipay_dict()
  149. else:
  150. params['item_gmt_start'] = self.item_gmt_start
  151. if self.item_id:
  152. if hasattr(self.item_id, 'to_alipay_dict'):
  153. params['item_id'] = self.item_id.to_alipay_dict()
  154. else:
  155. params['item_id'] = self.item_id
  156. if self.item_logo:
  157. if hasattr(self.item_logo, 'to_alipay_dict'):
  158. params['item_logo'] = self.item_logo.to_alipay_dict()
  159. else:
  160. params['item_logo'] = self.item_logo
  161. if self.item_name:
  162. if hasattr(self.item_name, 'to_alipay_dict'):
  163. params['item_name'] = self.item_name.to_alipay_dict()
  164. else:
  165. params['item_name'] = self.item_name
  166. if self.send_item_name:
  167. if hasattr(self.send_item_name, 'to_alipay_dict'):
  168. params['send_item_name'] = self.send_item_name.to_alipay_dict()
  169. else:
  170. params['send_item_name'] = self.send_item_name
  171. if self.shop_id:
  172. if hasattr(self.shop_id, 'to_alipay_dict'):
  173. params['shop_id'] = self.shop_id.to_alipay_dict()
  174. else:
  175. params['shop_id'] = self.shop_id
  176. if self.shop_name:
  177. if hasattr(self.shop_name, 'to_alipay_dict'):
  178. params['shop_name'] = self.shop_name.to_alipay_dict()
  179. else:
  180. params['shop_name'] = self.shop_name
  181. if self.use_condition_amount:
  182. if hasattr(self.use_condition_amount, 'to_alipay_dict'):
  183. params['use_condition_amount'] = self.use_condition_amount.to_alipay_dict()
  184. else:
  185. params['use_condition_amount'] = self.use_condition_amount
  186. if self.value_amount:
  187. if hasattr(self.value_amount, 'to_alipay_dict'):
  188. params['value_amount'] = self.value_amount.to_alipay_dict()
  189. else:
  190. params['value_amount'] = self.value_amount
  191. if self.voucher_detail_url:
  192. if hasattr(self.voucher_detail_url, 'to_alipay_dict'):
  193. params['voucher_detail_url'] = self.voucher_detail_url.to_alipay_dict()
  194. else:
  195. params['voucher_detail_url'] = self.voucher_detail_url
  196. if self.voucher_type:
  197. if hasattr(self.voucher_type, 'to_alipay_dict'):
  198. params['voucher_type'] = self.voucher_type.to_alipay_dict()
  199. else:
  200. params['voucher_type'] = self.voucher_type
  201. return params
  202. @staticmethod
  203. def from_alipay_dict(d):
  204. if not d:
  205. return None
  206. o = PromoVoucherInfo()
  207. if 'discount' in d:
  208. o.discount = d['discount']
  209. if 'is_auto_obtain' in d:
  210. o.is_auto_obtain = d['is_auto_obtain']
  211. if 'is_mall_voucher' in d:
  212. o.is_mall_voucher = d['is_mall_voucher']
  213. if 'item_brand_name' in d:
  214. o.item_brand_name = d['item_brand_name']
  215. if 'item_gmt_end' in d:
  216. o.item_gmt_end = d['item_gmt_end']
  217. if 'item_gmt_start' in d:
  218. o.item_gmt_start = d['item_gmt_start']
  219. if 'item_id' in d:
  220. o.item_id = d['item_id']
  221. if 'item_logo' in d:
  222. o.item_logo = d['item_logo']
  223. if 'item_name' in d:
  224. o.item_name = d['item_name']
  225. if 'send_item_name' in d:
  226. o.send_item_name = d['send_item_name']
  227. if 'shop_id' in d:
  228. o.shop_id = d['shop_id']
  229. if 'shop_name' in d:
  230. o.shop_name = d['shop_name']
  231. if 'use_condition_amount' in d:
  232. o.use_condition_amount = d['use_condition_amount']
  233. if 'value_amount' in d:
  234. o.value_amount = d['value_amount']
  235. if 'voucher_detail_url' in d:
  236. o.voucher_detail_url = d['voucher_detail_url']
  237. if 'voucher_type' in d:
  238. o.voucher_type = d['voucher_type']
  239. return o