ServiceProviderTest.php 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. <?php /*
  2. * Copyright (C) 2017 All rights reserved.
  3. *
  4. * @File ServiceProviderTest.php
  5. * @Brief
  6. * @Author abelzhu, abelzhu@tencent.com
  7. * @Version 1.0
  8. * @Date 2017-12-26
  9. *
  10. */
  11. include_once("../src/CorpAPI.class.php");
  12. include_once("../src/ServiceCorpAPI.class.php");
  13. include_once("../src/ServiceProviderAPI.class.php");
  14. try {
  15. $ServiceProviderAPI = new ServiceProviderAPI(
  16. "CORPID",
  17. "PROVIDER_SECRET"
  18. );
  19. //
  20. //
  21. $GetRegisterCodeReq = new GetRegisterCodeReq();
  22. {
  23. $GetRegisterCodeReq->template_id = "template_id";
  24. $GetRegisterCodeReq->corp_name = "corp_name";
  25. }
  26. $register_code = $ServiceProviderAPI->GetRegisterCode($GetRegisterCodeReq);
  27. var_dump($register_code);
  28. //
  29. $GetLoginInfoRsp = $ServiceProviderAPI->GetLoginInfo("xxxxxxxxxxxxxx");
  30. } catch (Exception $e) {
  31. echo $e->getMessage() . "\n";
  32. }
  33. try {
  34. $ServiceProviderAPI = new ServiceProviderAPI();
  35. $access_token = "xxxxxxxxxxxxxx";
  36. //
  37. $SetAgentScopeReq = new SetAgentScopeReq();
  38. {
  39. $SetAgentScopeReq->agentid = 11111111;
  40. }
  41. $SetAgentScopeRsp = $ServiceProviderAPI->SetAgentScope($access_token, $SetAgentScopeReq);
  42. var_dump($SetAgentScopeRsp);
  43. //
  44. $ServiceProviderAPI->SetContactSyncSuccess($access_token);
  45. } catch (Exception $e) {
  46. echo $e->getMessage() . "\n";
  47. }
  48. try {
  49. } catch (Exception $e) {
  50. echo $e->getMessage() . "\n";
  51. }