AntMerchantExpandIsvDeviceCreateModel.py 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206
  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.DeliveryInfo import DeliveryInfo
  6. from alipay.aop.api.domain.DeviceApplyTemplate import DeviceApplyTemplate
  7. class AntMerchantExpandIsvDeviceCreateModel(object):
  8. def __init__(self):
  9. self._biz_type = None
  10. self._channel_isv_pid = None
  11. self._delivery_info = None
  12. self._device_list = None
  13. self._operator_contact = None
  14. self._operator_name = None
  15. self._pid = None
  16. self._reason = None
  17. self._shop_id = None
  18. self._usage_detail = None
  19. self._usage_type = None
  20. @property
  21. def biz_type(self):
  22. return self._biz_type
  23. @biz_type.setter
  24. def biz_type(self, value):
  25. self._biz_type = value
  26. @property
  27. def channel_isv_pid(self):
  28. return self._channel_isv_pid
  29. @channel_isv_pid.setter
  30. def channel_isv_pid(self, value):
  31. self._channel_isv_pid = value
  32. @property
  33. def delivery_info(self):
  34. return self._delivery_info
  35. @delivery_info.setter
  36. def delivery_info(self, value):
  37. if isinstance(value, DeliveryInfo):
  38. self._delivery_info = value
  39. else:
  40. self._delivery_info = DeliveryInfo.from_alipay_dict(value)
  41. @property
  42. def device_list(self):
  43. return self._device_list
  44. @device_list.setter
  45. def device_list(self, value):
  46. if isinstance(value, list):
  47. self._device_list = list()
  48. for i in value:
  49. if isinstance(i, DeviceApplyTemplate):
  50. self._device_list.append(i)
  51. else:
  52. self._device_list.append(DeviceApplyTemplate.from_alipay_dict(i))
  53. @property
  54. def operator_contact(self):
  55. return self._operator_contact
  56. @operator_contact.setter
  57. def operator_contact(self, value):
  58. self._operator_contact = value
  59. @property
  60. def operator_name(self):
  61. return self._operator_name
  62. @operator_name.setter
  63. def operator_name(self, value):
  64. self._operator_name = value
  65. @property
  66. def pid(self):
  67. return self._pid
  68. @pid.setter
  69. def pid(self, value):
  70. self._pid = value
  71. @property
  72. def reason(self):
  73. return self._reason
  74. @reason.setter
  75. def reason(self, value):
  76. self._reason = value
  77. @property
  78. def shop_id(self):
  79. return self._shop_id
  80. @shop_id.setter
  81. def shop_id(self, value):
  82. self._shop_id = value
  83. @property
  84. def usage_detail(self):
  85. return self._usage_detail
  86. @usage_detail.setter
  87. def usage_detail(self, value):
  88. self._usage_detail = value
  89. @property
  90. def usage_type(self):
  91. return self._usage_type
  92. @usage_type.setter
  93. def usage_type(self, value):
  94. self._usage_type = value
  95. def to_alipay_dict(self):
  96. params = dict()
  97. if self.biz_type:
  98. if hasattr(self.biz_type, 'to_alipay_dict'):
  99. params['biz_type'] = self.biz_type.to_alipay_dict()
  100. else:
  101. params['biz_type'] = self.biz_type
  102. if self.channel_isv_pid:
  103. if hasattr(self.channel_isv_pid, 'to_alipay_dict'):
  104. params['channel_isv_pid'] = self.channel_isv_pid.to_alipay_dict()
  105. else:
  106. params['channel_isv_pid'] = self.channel_isv_pid
  107. if self.delivery_info:
  108. if hasattr(self.delivery_info, 'to_alipay_dict'):
  109. params['delivery_info'] = self.delivery_info.to_alipay_dict()
  110. else:
  111. params['delivery_info'] = self.delivery_info
  112. if self.device_list:
  113. if isinstance(self.device_list, list):
  114. for i in range(0, len(self.device_list)):
  115. element = self.device_list[i]
  116. if hasattr(element, 'to_alipay_dict'):
  117. self.device_list[i] = element.to_alipay_dict()
  118. if hasattr(self.device_list, 'to_alipay_dict'):
  119. params['device_list'] = self.device_list.to_alipay_dict()
  120. else:
  121. params['device_list'] = self.device_list
  122. if self.operator_contact:
  123. if hasattr(self.operator_contact, 'to_alipay_dict'):
  124. params['operator_contact'] = self.operator_contact.to_alipay_dict()
  125. else:
  126. params['operator_contact'] = self.operator_contact
  127. if self.operator_name:
  128. if hasattr(self.operator_name, 'to_alipay_dict'):
  129. params['operator_name'] = self.operator_name.to_alipay_dict()
  130. else:
  131. params['operator_name'] = self.operator_name
  132. if self.pid:
  133. if hasattr(self.pid, 'to_alipay_dict'):
  134. params['pid'] = self.pid.to_alipay_dict()
  135. else:
  136. params['pid'] = self.pid
  137. if self.reason:
  138. if hasattr(self.reason, 'to_alipay_dict'):
  139. params['reason'] = self.reason.to_alipay_dict()
  140. else:
  141. params['reason'] = self.reason
  142. if self.shop_id:
  143. if hasattr(self.shop_id, 'to_alipay_dict'):
  144. params['shop_id'] = self.shop_id.to_alipay_dict()
  145. else:
  146. params['shop_id'] = self.shop_id
  147. if self.usage_detail:
  148. if hasattr(self.usage_detail, 'to_alipay_dict'):
  149. params['usage_detail'] = self.usage_detail.to_alipay_dict()
  150. else:
  151. params['usage_detail'] = self.usage_detail
  152. if self.usage_type:
  153. if hasattr(self.usage_type, 'to_alipay_dict'):
  154. params['usage_type'] = self.usage_type.to_alipay_dict()
  155. else:
  156. params['usage_type'] = self.usage_type
  157. return params
  158. @staticmethod
  159. def from_alipay_dict(d):
  160. if not d:
  161. return None
  162. o = AntMerchantExpandIsvDeviceCreateModel()
  163. if 'biz_type' in d:
  164. o.biz_type = d['biz_type']
  165. if 'channel_isv_pid' in d:
  166. o.channel_isv_pid = d['channel_isv_pid']
  167. if 'delivery_info' in d:
  168. o.delivery_info = d['delivery_info']
  169. if 'device_list' in d:
  170. o.device_list = d['device_list']
  171. if 'operator_contact' in d:
  172. o.operator_contact = d['operator_contact']
  173. if 'operator_name' in d:
  174. o.operator_name = d['operator_name']
  175. if 'pid' in d:
  176. o.pid = d['pid']
  177. if 'reason' in d:
  178. o.reason = d['reason']
  179. if 'shop_id' in d:
  180. o.shop_id = d['shop_id']
  181. if 'usage_detail' in d:
  182. o.usage_detail = d['usage_detail']
  183. if 'usage_type' in d:
  184. o.usage_type = d['usage_type']
  185. return o