base.py 894 B

12345678910111213141516171819202122232425262728293031323334
  1. # -*- coding: utf-8 -*-
  2. from __future__ import absolute_import, unicode_literals
  3. class BaseWeChatPayAPI(object):
  4. """ WeChat Pay API base class """
  5. def __init__(self, client=None):
  6. self._client = client
  7. def _get(self, url, **kwargs):
  8. if getattr(self, 'API_BASE_URL', None):
  9. kwargs['api_base_url'] = self.API_BASE_URL
  10. return self._client.get(url, **kwargs)
  11. def _post(self, url, **kwargs):
  12. if getattr(self, 'API_BASE_URL', None):
  13. kwargs['api_base_url'] = self.API_BASE_URL
  14. return self._client.post(url, **kwargs)
  15. @property
  16. def appid(self):
  17. return self._client.appid
  18. @property
  19. def sub_appid(self):
  20. return self._client.sub_appid
  21. @property
  22. def mch_id(self):
  23. return self._client.mch_id
  24. @property
  25. def sub_mch_id(self):
  26. return self._client.sub_mch_id