MerchantModel.py 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. import json
  4. from alipay.aop.api.constant.ParamConstants import *
  5. class MerchantModel(object):
  6. def __init__(self):
  7. self._alias_name = None
  8. self._contact_name = None
  9. self._contact_number = None
  10. self._name = None
  11. self._pid = None
  12. @property
  13. def alias_name(self):
  14. return self._alias_name
  15. @alias_name.setter
  16. def alias_name(self, value):
  17. self._alias_name = value
  18. @property
  19. def contact_name(self):
  20. return self._contact_name
  21. @contact_name.setter
  22. def contact_name(self, value):
  23. self._contact_name = value
  24. @property
  25. def contact_number(self):
  26. return self._contact_number
  27. @contact_number.setter
  28. def contact_number(self, value):
  29. self._contact_number = value
  30. @property
  31. def name(self):
  32. return self._name
  33. @name.setter
  34. def name(self, value):
  35. self._name = value
  36. @property
  37. def pid(self):
  38. return self._pid
  39. @pid.setter
  40. def pid(self, value):
  41. self._pid = value
  42. def to_alipay_dict(self):
  43. params = dict()
  44. if self.alias_name:
  45. if hasattr(self.alias_name, 'to_alipay_dict'):
  46. params['alias_name'] = self.alias_name.to_alipay_dict()
  47. else:
  48. params['alias_name'] = self.alias_name
  49. if self.contact_name:
  50. if hasattr(self.contact_name, 'to_alipay_dict'):
  51. params['contact_name'] = self.contact_name.to_alipay_dict()
  52. else:
  53. params['contact_name'] = self.contact_name
  54. if self.contact_number:
  55. if hasattr(self.contact_number, 'to_alipay_dict'):
  56. params['contact_number'] = self.contact_number.to_alipay_dict()
  57. else:
  58. params['contact_number'] = self.contact_number
  59. if self.name:
  60. if hasattr(self.name, 'to_alipay_dict'):
  61. params['name'] = self.name.to_alipay_dict()
  62. else:
  63. params['name'] = self.name
  64. if self.pid:
  65. if hasattr(self.pid, 'to_alipay_dict'):
  66. params['pid'] = self.pid.to_alipay_dict()
  67. else:
  68. params['pid'] = self.pid
  69. return params
  70. @staticmethod
  71. def from_alipay_dict(d):
  72. if not d:
  73. return None
  74. o = MerchantModel()
  75. if 'alias_name' in d:
  76. o.alias_name = d['alias_name']
  77. if 'contact_name' in d:
  78. o.contact_name = d['contact_name']
  79. if 'contact_number' in d:
  80. o.contact_number = d['contact_number']
  81. if 'name' in d:
  82. o.name = d['name']
  83. if 'pid' in d:
  84. o.pid = d['pid']
  85. return o