AssetDeliveryAddress.py 4.7 KB

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