IndividualInfo.py 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. import json
  4. from alipay.aop.api.constant.ParamConstants import *
  5. class IndividualInfo(object):
  6. def __init__(self):
  7. self._date_of_birth = None
  8. self._id_number = None
  9. self._name = None
  10. self._nationality = None
  11. self._residential_address = None
  12. self._type = None
  13. @property
  14. def date_of_birth(self):
  15. return self._date_of_birth
  16. @date_of_birth.setter
  17. def date_of_birth(self, value):
  18. self._date_of_birth = value
  19. @property
  20. def id_number(self):
  21. return self._id_number
  22. @id_number.setter
  23. def id_number(self, value):
  24. self._id_number = value
  25. @property
  26. def name(self):
  27. return self._name
  28. @name.setter
  29. def name(self, value):
  30. self._name = value
  31. @property
  32. def nationality(self):
  33. return self._nationality
  34. @nationality.setter
  35. def nationality(self, value):
  36. self._nationality = value
  37. @property
  38. def residential_address(self):
  39. return self._residential_address
  40. @residential_address.setter
  41. def residential_address(self, value):
  42. self._residential_address = value
  43. @property
  44. def type(self):
  45. return self._type
  46. @type.setter
  47. def type(self, value):
  48. self._type = value
  49. def to_alipay_dict(self):
  50. params = dict()
  51. if self.date_of_birth:
  52. if hasattr(self.date_of_birth, 'to_alipay_dict'):
  53. params['date_of_birth'] = self.date_of_birth.to_alipay_dict()
  54. else:
  55. params['date_of_birth'] = self.date_of_birth
  56. if self.id_number:
  57. if hasattr(self.id_number, 'to_alipay_dict'):
  58. params['id_number'] = self.id_number.to_alipay_dict()
  59. else:
  60. params['id_number'] = self.id_number
  61. if self.name:
  62. if hasattr(self.name, 'to_alipay_dict'):
  63. params['name'] = self.name.to_alipay_dict()
  64. else:
  65. params['name'] = self.name
  66. if self.nationality:
  67. if hasattr(self.nationality, 'to_alipay_dict'):
  68. params['nationality'] = self.nationality.to_alipay_dict()
  69. else:
  70. params['nationality'] = self.nationality
  71. if self.residential_address:
  72. if hasattr(self.residential_address, 'to_alipay_dict'):
  73. params['residential_address'] = self.residential_address.to_alipay_dict()
  74. else:
  75. params['residential_address'] = self.residential_address
  76. if self.type:
  77. if hasattr(self.type, 'to_alipay_dict'):
  78. params['type'] = self.type.to_alipay_dict()
  79. else:
  80. params['type'] = self.type
  81. return params
  82. @staticmethod
  83. def from_alipay_dict(d):
  84. if not d:
  85. return None
  86. o = IndividualInfo()
  87. if 'date_of_birth' in d:
  88. o.date_of_birth = d['date_of_birth']
  89. if 'id_number' in d:
  90. o.id_number = d['id_number']
  91. if 'name' in d:
  92. o.name = d['name']
  93. if 'nationality' in d:
  94. o.nationality = d['nationality']
  95. if 'residential_address' in d:
  96. o.residential_address = d['residential_address']
  97. if 'type' in d:
  98. o.type = d['type']
  99. return o