AlipayTradeCustomsQueryResponse.py 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. import json
  4. from alipay.aop.api.response.AlipayResponse import AlipayResponse
  5. from alipay.aop.api.domain.CustomsDeclareRecordInfo import CustomsDeclareRecordInfo
  6. class AlipayTradeCustomsQueryResponse(AlipayResponse):
  7. def __init__(self):
  8. super(AlipayTradeCustomsQueryResponse, self).__init__()
  9. self._not_found = None
  10. self._records = None
  11. @property
  12. def not_found(self):
  13. return self._not_found
  14. @not_found.setter
  15. def not_found(self, value):
  16. self._not_found = value
  17. @property
  18. def records(self):
  19. return self._records
  20. @records.setter
  21. def records(self, value):
  22. if isinstance(value, list):
  23. self._records = list()
  24. for i in value:
  25. if isinstance(i, CustomsDeclareRecordInfo):
  26. self._records.append(i)
  27. else:
  28. self._records.append(CustomsDeclareRecordInfo.from_alipay_dict(i))
  29. def parse_response_content(self, response_content):
  30. response = super(AlipayTradeCustomsQueryResponse, self).parse_response_content(response_content)
  31. if 'not_found' in response:
  32. self.not_found = response['not_found']
  33. if 'records' in response:
  34. self.records = response['records']