OrderLogisticsInfo.py 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  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.OrderLogisticsExtInfo import OrderLogisticsExtInfo
  6. class OrderLogisticsInfo(object):
  7. def __init__(self):
  8. self._address = None
  9. self._contact_name = None
  10. self._ext_info = None
  11. self._latitude = None
  12. self._longitude = None
  13. self._merchant_bind_mobile = None
  14. self._mobile = None
  15. @property
  16. def address(self):
  17. return self._address
  18. @address.setter
  19. def address(self, value):
  20. self._address = value
  21. @property
  22. def contact_name(self):
  23. return self._contact_name
  24. @contact_name.setter
  25. def contact_name(self, value):
  26. self._contact_name = value
  27. @property
  28. def ext_info(self):
  29. return self._ext_info
  30. @ext_info.setter
  31. def ext_info(self, value):
  32. if isinstance(value, OrderLogisticsExtInfo):
  33. self._ext_info = value
  34. else:
  35. self._ext_info = OrderLogisticsExtInfo.from_alipay_dict(value)
  36. @property
  37. def latitude(self):
  38. return self._latitude
  39. @latitude.setter
  40. def latitude(self, value):
  41. self._latitude = value
  42. @property
  43. def longitude(self):
  44. return self._longitude
  45. @longitude.setter
  46. def longitude(self, value):
  47. self._longitude = value
  48. @property
  49. def merchant_bind_mobile(self):
  50. return self._merchant_bind_mobile
  51. @merchant_bind_mobile.setter
  52. def merchant_bind_mobile(self, value):
  53. self._merchant_bind_mobile = value
  54. @property
  55. def mobile(self):
  56. return self._mobile
  57. @mobile.setter
  58. def mobile(self, value):
  59. self._mobile = value
  60. def to_alipay_dict(self):
  61. params = dict()
  62. if self.address:
  63. if hasattr(self.address, 'to_alipay_dict'):
  64. params['address'] = self.address.to_alipay_dict()
  65. else:
  66. params['address'] = self.address
  67. if self.contact_name:
  68. if hasattr(self.contact_name, 'to_alipay_dict'):
  69. params['contact_name'] = self.contact_name.to_alipay_dict()
  70. else:
  71. params['contact_name'] = self.contact_name
  72. if self.ext_info:
  73. if hasattr(self.ext_info, 'to_alipay_dict'):
  74. params['ext_info'] = self.ext_info.to_alipay_dict()
  75. else:
  76. params['ext_info'] = self.ext_info
  77. if self.latitude:
  78. if hasattr(self.latitude, 'to_alipay_dict'):
  79. params['latitude'] = self.latitude.to_alipay_dict()
  80. else:
  81. params['latitude'] = self.latitude
  82. if self.longitude:
  83. if hasattr(self.longitude, 'to_alipay_dict'):
  84. params['longitude'] = self.longitude.to_alipay_dict()
  85. else:
  86. params['longitude'] = self.longitude
  87. if self.merchant_bind_mobile:
  88. if hasattr(self.merchant_bind_mobile, 'to_alipay_dict'):
  89. params['merchant_bind_mobile'] = self.merchant_bind_mobile.to_alipay_dict()
  90. else:
  91. params['merchant_bind_mobile'] = self.merchant_bind_mobile
  92. if self.mobile:
  93. if hasattr(self.mobile, 'to_alipay_dict'):
  94. params['mobile'] = self.mobile.to_alipay_dict()
  95. else:
  96. params['mobile'] = self.mobile
  97. return params
  98. @staticmethod
  99. def from_alipay_dict(d):
  100. if not d:
  101. return None
  102. o = OrderLogisticsInfo()
  103. if 'address' in d:
  104. o.address = d['address']
  105. if 'contact_name' in d:
  106. o.contact_name = d['contact_name']
  107. if 'ext_info' in d:
  108. o.ext_info = d['ext_info']
  109. if 'latitude' in d:
  110. o.latitude = d['latitude']
  111. if 'longitude' in d:
  112. o.longitude = d['longitude']
  113. if 'merchant_bind_mobile' in d:
  114. o.merchant_bind_mobile = d['merchant_bind_mobile']
  115. if 'mobile' in d:
  116. o.mobile = d['mobile']
  117. return o