Participant.py 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  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.BankcardExtInfo import BankcardExtInfo
  6. class Participant(object):
  7. def __init__(self):
  8. self._bankcard_ext_info = None
  9. self._ext_info = None
  10. self._identity = None
  11. self._identity_type = None
  12. self._merchant_user_info = None
  13. self._name = None
  14. @property
  15. def bankcard_ext_info(self):
  16. return self._bankcard_ext_info
  17. @bankcard_ext_info.setter
  18. def bankcard_ext_info(self, value):
  19. if isinstance(value, BankcardExtInfo):
  20. self._bankcard_ext_info = value
  21. else:
  22. self._bankcard_ext_info = BankcardExtInfo.from_alipay_dict(value)
  23. @property
  24. def ext_info(self):
  25. return self._ext_info
  26. @ext_info.setter
  27. def ext_info(self, value):
  28. self._ext_info = value
  29. @property
  30. def identity(self):
  31. return self._identity
  32. @identity.setter
  33. def identity(self, value):
  34. self._identity = value
  35. @property
  36. def identity_type(self):
  37. return self._identity_type
  38. @identity_type.setter
  39. def identity_type(self, value):
  40. self._identity_type = value
  41. @property
  42. def merchant_user_info(self):
  43. return self._merchant_user_info
  44. @merchant_user_info.setter
  45. def merchant_user_info(self, value):
  46. self._merchant_user_info = value
  47. @property
  48. def name(self):
  49. return self._name
  50. @name.setter
  51. def name(self, value):
  52. self._name = value
  53. def to_alipay_dict(self):
  54. params = dict()
  55. if self.bankcard_ext_info:
  56. if hasattr(self.bankcard_ext_info, 'to_alipay_dict'):
  57. params['bankcard_ext_info'] = self.bankcard_ext_info.to_alipay_dict()
  58. else:
  59. params['bankcard_ext_info'] = self.bankcard_ext_info
  60. if self.ext_info:
  61. if hasattr(self.ext_info, 'to_alipay_dict'):
  62. params['ext_info'] = self.ext_info.to_alipay_dict()
  63. else:
  64. params['ext_info'] = self.ext_info
  65. if self.identity:
  66. if hasattr(self.identity, 'to_alipay_dict'):
  67. params['identity'] = self.identity.to_alipay_dict()
  68. else:
  69. params['identity'] = self.identity
  70. if self.identity_type:
  71. if hasattr(self.identity_type, 'to_alipay_dict'):
  72. params['identity_type'] = self.identity_type.to_alipay_dict()
  73. else:
  74. params['identity_type'] = self.identity_type
  75. if self.merchant_user_info:
  76. if hasattr(self.merchant_user_info, 'to_alipay_dict'):
  77. params['merchant_user_info'] = self.merchant_user_info.to_alipay_dict()
  78. else:
  79. params['merchant_user_info'] = self.merchant_user_info
  80. if self.name:
  81. if hasattr(self.name, 'to_alipay_dict'):
  82. params['name'] = self.name.to_alipay_dict()
  83. else:
  84. params['name'] = self.name
  85. return params
  86. @staticmethod
  87. def from_alipay_dict(d):
  88. if not d:
  89. return None
  90. o = Participant()
  91. if 'bankcard_ext_info' in d:
  92. o.bankcard_ext_info = d['bankcard_ext_info']
  93. if 'ext_info' in d:
  94. o.ext_info = d['ext_info']
  95. if 'identity' in d:
  96. o.identity = d['identity']
  97. if 'identity_type' in d:
  98. o.identity_type = d['identity_type']
  99. if 'merchant_user_info' in d:
  100. o.merchant_user_info = d['merchant_user_info']
  101. if 'name' in d:
  102. o.name = d['name']
  103. return o