【问题标题】:Docusign remote signing integration in laravelLaravel 中的 Docusign 远程签名集成
【发布时间】:2023-02-15 08:36:27
【问题描述】:

任何人都可以提供 laravel 中 docusign 远程签名的参考。我知道 github 上已经有纯 php 的代码,但它对我不起作用。我搜索了与 laravel 相关的代码,但我没有在互联网上的任何地方找到它。

我期待 laravel 中的参考而不是纯 php 中的参考。任何人都可以帮助我吗?

【问题讨论】:

    标签: php laravel-8 docusignapi docusignconnect docusign-sdk


    【解决方案1】:

    https://www.docusign.com/blog/developers/send-document-laravel-jwt-grant-authentication 有关于用 Laravel 做这件事的所有细节

    这是PHP代码:

    $apiClient = new ApiClient();
    $apiClient->getOAuth()->setOAuthBasePath(env('DS_AUTH_SERVER')); 
    try{
        $accessToken = $this->getToken($apiClient);
    } catch (Throwable $th) {
        return back()->withError($th->getMessage())->withInput();
    }
    $userInfo = $apiClient->getUserInfo($accessToken);
    $accountInfo = $userInfo[0]->getAccounts();
    $envelopeDefenition = $this->buildEnvelope($request);
    try {            
         $envelopeApi = new EnvelopesApi($apiClient);
         $result = $envelopeApi->createEnvelope($accountInfo[0]->getAccountId(), $envelopeDefenition);
         } catch (Throwable $th) {
            return back()->withError($th->getMessage())->withInput();
    }  
    
    private function getToken(ApiClient $apiClient) : string{
            try {
                $privateKey = file_get_contents(storage_path(env('DS_KEY_PATH')),true);
                $response = $apiClient->requestJWTUserToken(
                    $ikey = env('DS_CLIENT_ID'),
                    $userId = env('DS_IMPERSONATED_USER_ID'),
                    $key = $privateKey,
                    $scope = env('DS_JWT_SCOPE')
                );        
                $token = $response[0];
                $accessToken = $token->getAccessToken();
            } catch (Throwable $th) {
                throw $th;
            }    
            return $accessToken;        
    }
    

    【讨论】:

      猜你喜欢
      • 2023-02-10
      • 1970-01-01
      • 1970-01-01
      • 2015-08-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-01-24
      相关资源
      最近更新 更多