AlipayMarketingCardOpenResponse.py 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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.MerchantCard import MerchantCard
  6. class AlipayMarketingCardOpenResponse(AlipayResponse):
  7. def __init__(self):
  8. super(AlipayMarketingCardOpenResponse, self).__init__()
  9. self._card_info = None
  10. self._open_card_channel = None
  11. self._open_card_channel_id = None
  12. @property
  13. def card_info(self):
  14. return self._card_info
  15. @card_info.setter
  16. def card_info(self, value):
  17. if isinstance(value, MerchantCard):
  18. self._card_info = value
  19. else:
  20. self._card_info = MerchantCard.from_alipay_dict(value)
  21. @property
  22. def open_card_channel(self):
  23. return self._open_card_channel
  24. @open_card_channel.setter
  25. def open_card_channel(self, value):
  26. self._open_card_channel = value
  27. @property
  28. def open_card_channel_id(self):
  29. return self._open_card_channel_id
  30. @open_card_channel_id.setter
  31. def open_card_channel_id(self, value):
  32. self._open_card_channel_id = value
  33. def parse_response_content(self, response_content):
  34. response = super(AlipayMarketingCardOpenResponse, self).parse_response_content(response_content)
  35. if 'card_info' in response:
  36. self.card_info = response['card_info']
  37. if 'open_card_channel' in response:
  38. self.open_card_channel = response['open_card_channel']
  39. if 'open_card_channel_id' in response:
  40. self.open_card_channel_id = response['open_card_channel_id']