Account.py 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. import json
  4. from alipay.aop.api.constant.ParamConstants import *
  5. class Account(object):
  6. def __init__(self):
  7. self._account_ext = None
  8. self._account_name = None
  9. self._account_no = None
  10. self._account_type = None
  11. @property
  12. def account_ext(self):
  13. return self._account_ext
  14. @account_ext.setter
  15. def account_ext(self, value):
  16. self._account_ext = value
  17. @property
  18. def account_name(self):
  19. return self._account_name
  20. @account_name.setter
  21. def account_name(self, value):
  22. self._account_name = value
  23. @property
  24. def account_no(self):
  25. return self._account_no
  26. @account_no.setter
  27. def account_no(self, value):
  28. self._account_no = value
  29. @property
  30. def account_type(self):
  31. return self._account_type
  32. @account_type.setter
  33. def account_type(self, value):
  34. self._account_type = value
  35. def to_alipay_dict(self):
  36. params = dict()
  37. if self.account_ext:
  38. if hasattr(self.account_ext, 'to_alipay_dict'):
  39. params['account_ext'] = self.account_ext.to_alipay_dict()
  40. else:
  41. params['account_ext'] = self.account_ext
  42. if self.account_name:
  43. if hasattr(self.account_name, 'to_alipay_dict'):
  44. params['account_name'] = self.account_name.to_alipay_dict()
  45. else:
  46. params['account_name'] = self.account_name
  47. if self.account_no:
  48. if hasattr(self.account_no, 'to_alipay_dict'):
  49. params['account_no'] = self.account_no.to_alipay_dict()
  50. else:
  51. params['account_no'] = self.account_no
  52. if self.account_type:
  53. if hasattr(self.account_type, 'to_alipay_dict'):
  54. params['account_type'] = self.account_type.to_alipay_dict()
  55. else:
  56. params['account_type'] = self.account_type
  57. return params
  58. @staticmethod
  59. def from_alipay_dict(d):
  60. if not d:
  61. return None
  62. o = Account()
  63. if 'account_ext' in d:
  64. o.account_ext = d['account_ext']
  65. if 'account_name' in d:
  66. o.account_name = d['account_name']
  67. if 'account_no' in d:
  68. o.account_no = d['account_no']
  69. if 'account_type' in d:
  70. o.account_type = d['account_type']
  71. return o