AlipayMarketingCardQueryModel.py 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  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.CardUserInfo import CardUserInfo
  6. class AlipayMarketingCardQueryModel(object):
  7. def __init__(self):
  8. self._card_user_info = None
  9. self._ext_info = None
  10. self._target_card_no = None
  11. self._target_card_no_type = None
  12. @property
  13. def card_user_info(self):
  14. return self._card_user_info
  15. @card_user_info.setter
  16. def card_user_info(self, value):
  17. if isinstance(value, CardUserInfo):
  18. self._card_user_info = value
  19. else:
  20. self._card_user_info = CardUserInfo.from_alipay_dict(value)
  21. @property
  22. def ext_info(self):
  23. return self._ext_info
  24. @ext_info.setter
  25. def ext_info(self, value):
  26. self._ext_info = value
  27. @property
  28. def target_card_no(self):
  29. return self._target_card_no
  30. @target_card_no.setter
  31. def target_card_no(self, value):
  32. self._target_card_no = value
  33. @property
  34. def target_card_no_type(self):
  35. return self._target_card_no_type
  36. @target_card_no_type.setter
  37. def target_card_no_type(self, value):
  38. self._target_card_no_type = value
  39. def to_alipay_dict(self):
  40. params = dict()
  41. if self.card_user_info:
  42. if hasattr(self.card_user_info, 'to_alipay_dict'):
  43. params['card_user_info'] = self.card_user_info.to_alipay_dict()
  44. else:
  45. params['card_user_info'] = self.card_user_info
  46. if self.ext_info:
  47. if hasattr(self.ext_info, 'to_alipay_dict'):
  48. params['ext_info'] = self.ext_info.to_alipay_dict()
  49. else:
  50. params['ext_info'] = self.ext_info
  51. if self.target_card_no:
  52. if hasattr(self.target_card_no, 'to_alipay_dict'):
  53. params['target_card_no'] = self.target_card_no.to_alipay_dict()
  54. else:
  55. params['target_card_no'] = self.target_card_no
  56. if self.target_card_no_type:
  57. if hasattr(self.target_card_no_type, 'to_alipay_dict'):
  58. params['target_card_no_type'] = self.target_card_no_type.to_alipay_dict()
  59. else:
  60. params['target_card_no_type'] = self.target_card_no_type
  61. return params
  62. @staticmethod
  63. def from_alipay_dict(d):
  64. if not d:
  65. return None
  66. o = AlipayMarketingCardQueryModel()
  67. if 'card_user_info' in d:
  68. o.card_user_info = d['card_user_info']
  69. if 'ext_info' in d:
  70. o.ext_info = d['ext_info']
  71. if 'target_card_no' in d:
  72. o.target_card_no = d['target_card_no']
  73. if 'target_card_no_type' in d:
  74. o.target_card_no_type = d['target_card_no_type']
  75. return o