MerchantIDInfo.py 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. import json
  4. from alipay.aop.api.constant.ParamConstants import *
  5. class MerchantIDInfo(object):
  6. def __init__(self):
  7. self._pid = None
  8. self._seller_id = None
  9. self._sub_merchant_id = None
  10. @property
  11. def pid(self):
  12. return self._pid
  13. @pid.setter
  14. def pid(self, value):
  15. self._pid = value
  16. @property
  17. def seller_id(self):
  18. return self._seller_id
  19. @seller_id.setter
  20. def seller_id(self, value):
  21. self._seller_id = value
  22. @property
  23. def sub_merchant_id(self):
  24. return self._sub_merchant_id
  25. @sub_merchant_id.setter
  26. def sub_merchant_id(self, value):
  27. self._sub_merchant_id = value
  28. def to_alipay_dict(self):
  29. params = dict()
  30. if self.pid:
  31. if hasattr(self.pid, 'to_alipay_dict'):
  32. params['pid'] = self.pid.to_alipay_dict()
  33. else:
  34. params['pid'] = self.pid
  35. if self.seller_id:
  36. if hasattr(self.seller_id, 'to_alipay_dict'):
  37. params['seller_id'] = self.seller_id.to_alipay_dict()
  38. else:
  39. params['seller_id'] = self.seller_id
  40. if self.sub_merchant_id:
  41. if hasattr(self.sub_merchant_id, 'to_alipay_dict'):
  42. params['sub_merchant_id'] = self.sub_merchant_id.to_alipay_dict()
  43. else:
  44. params['sub_merchant_id'] = self.sub_merchant_id
  45. return params
  46. @staticmethod
  47. def from_alipay_dict(d):
  48. if not d:
  49. return None
  50. o = MerchantIDInfo()
  51. if 'pid' in d:
  52. o.pid = d['pid']
  53. if 'seller_id' in d:
  54. o.seller_id = d['seller_id']
  55. if 'sub_merchant_id' in d:
  56. o.sub_merchant_id = d['sub_merchant_id']
  57. return o