AlipayInsMarketingDiscountDecisionModel.py 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. import json
  4. from alipay.aop.api.constant.ParamConstants import *
  5. from alipay.aop.api.domain.InsMktFactorDTO import InsMktFactorDTO
  6. from alipay.aop.api.domain.InsMktObjectDTO import InsMktObjectDTO
  7. class AlipayInsMarketingDiscountDecisionModel(object):
  8. def __init__(self):
  9. self._account_id = None
  10. self._account_type = None
  11. self._business_type = None
  12. self._factors = None
  13. self._market_types = None
  14. self._mkt_objects = None
  15. self._request_id = None
  16. @property
  17. def account_id(self):
  18. return self._account_id
  19. @account_id.setter
  20. def account_id(self, value):
  21. self._account_id = value
  22. @property
  23. def account_type(self):
  24. return self._account_type
  25. @account_type.setter
  26. def account_type(self, value):
  27. self._account_type = value
  28. @property
  29. def business_type(self):
  30. return self._business_type
  31. @business_type.setter
  32. def business_type(self, value):
  33. self._business_type = value
  34. @property
  35. def factors(self):
  36. return self._factors
  37. @factors.setter
  38. def factors(self, value):
  39. if isinstance(value, list):
  40. self._factors = list()
  41. for i in value:
  42. if isinstance(i, InsMktFactorDTO):
  43. self._factors.append(i)
  44. else:
  45. self._factors.append(InsMktFactorDTO.from_alipay_dict(i))
  46. @property
  47. def market_types(self):
  48. return self._market_types
  49. @market_types.setter
  50. def market_types(self, value):
  51. if isinstance(value, list):
  52. self._market_types = list()
  53. for i in value:
  54. self._market_types.append(i)
  55. @property
  56. def mkt_objects(self):
  57. return self._mkt_objects
  58. @mkt_objects.setter
  59. def mkt_objects(self, value):
  60. if isinstance(value, list):
  61. self._mkt_objects = list()
  62. for i in value:
  63. if isinstance(i, InsMktObjectDTO):
  64. self._mkt_objects.append(i)
  65. else:
  66. self._mkt_objects.append(InsMktObjectDTO.from_alipay_dict(i))
  67. @property
  68. def request_id(self):
  69. return self._request_id
  70. @request_id.setter
  71. def request_id(self, value):
  72. self._request_id = value
  73. def to_alipay_dict(self):
  74. params = dict()
  75. if self.account_id:
  76. if hasattr(self.account_id, 'to_alipay_dict'):
  77. params['account_id'] = self.account_id.to_alipay_dict()
  78. else:
  79. params['account_id'] = self.account_id
  80. if self.account_type:
  81. if hasattr(self.account_type, 'to_alipay_dict'):
  82. params['account_type'] = self.account_type.to_alipay_dict()
  83. else:
  84. params['account_type'] = self.account_type
  85. if self.business_type:
  86. if hasattr(self.business_type, 'to_alipay_dict'):
  87. params['business_type'] = self.business_type.to_alipay_dict()
  88. else:
  89. params['business_type'] = self.business_type
  90. if self.factors:
  91. if isinstance(self.factors, list):
  92. for i in range(0, len(self.factors)):
  93. element = self.factors[i]
  94. if hasattr(element, 'to_alipay_dict'):
  95. self.factors[i] = element.to_alipay_dict()
  96. if hasattr(self.factors, 'to_alipay_dict'):
  97. params['factors'] = self.factors.to_alipay_dict()
  98. else:
  99. params['factors'] = self.factors
  100. if self.market_types:
  101. if isinstance(self.market_types, list):
  102. for i in range(0, len(self.market_types)):
  103. element = self.market_types[i]
  104. if hasattr(element, 'to_alipay_dict'):
  105. self.market_types[i] = element.to_alipay_dict()
  106. if hasattr(self.market_types, 'to_alipay_dict'):
  107. params['market_types'] = self.market_types.to_alipay_dict()
  108. else:
  109. params['market_types'] = self.market_types
  110. if self.mkt_objects:
  111. if isinstance(self.mkt_objects, list):
  112. for i in range(0, len(self.mkt_objects)):
  113. element = self.mkt_objects[i]
  114. if hasattr(element, 'to_alipay_dict'):
  115. self.mkt_objects[i] = element.to_alipay_dict()
  116. if hasattr(self.mkt_objects, 'to_alipay_dict'):
  117. params['mkt_objects'] = self.mkt_objects.to_alipay_dict()
  118. else:
  119. params['mkt_objects'] = self.mkt_objects
  120. if self.request_id:
  121. if hasattr(self.request_id, 'to_alipay_dict'):
  122. params['request_id'] = self.request_id.to_alipay_dict()
  123. else:
  124. params['request_id'] = self.request_id
  125. return params
  126. @staticmethod
  127. def from_alipay_dict(d):
  128. if not d:
  129. return None
  130. o = AlipayInsMarketingDiscountDecisionModel()
  131. if 'account_id' in d:
  132. o.account_id = d['account_id']
  133. if 'account_type' in d:
  134. o.account_type = d['account_type']
  135. if 'business_type' in d:
  136. o.business_type = d['business_type']
  137. if 'factors' in d:
  138. o.factors = d['factors']
  139. if 'market_types' in d:
  140. o.market_types = d['market_types']
  141. if 'mkt_objects' in d:
  142. o.mkt_objects = d['mkt_objects']
  143. if 'request_id' in d:
  144. o.request_id = d['request_id']
  145. return o