complete.py 1.0 KB

1234567891011121314151617181920212223242526272829303132333435
  1. # -*- coding: utf-8 -*-
  2. # !/usr/bin/env python
  3. from django.conf import settings
  4. from library.jdopen.client.api.base import BaseJdOpenAPI
  5. class JdOpenComplete(BaseJdOpenAPI):
  6. def complete_customer(self, customerNum, licenseId=None, licenseStartTime=None, licenseEndTime=None, callbackUrl=None):
  7. url = "/v2/agent/declare/complete"
  8. defaultCallBackUrl = "{}/{}".format(settings.SERVER_END_BASE_URL, "merchant/auditNotify")
  9. data = {
  10. "customerNum": customerNum,
  11. "licenseId": licenseId,
  12. "licenseStartTime": licenseStartTime,
  13. "licenseEndTime": licenseEndTime,
  14. "callbackUrl": callbackUrl or defaultCallBackUrl
  15. }
  16. sendData = {_k: _v for _k, _v in data.items() if _v}
  17. return self._post(url, data=sendData)
  18. def confirm_customer(self, agentNum, customerNum):
  19. url = "/v1/agent/declare/sign/confirm"
  20. data = {
  21. "agentNum": agentNum,
  22. "customerNum": customerNum
  23. }
  24. return self._post(url, data=data)