diff --git a/cla-backend-go/cmd/server.go b/cla-backend-go/cmd/server.go index 1853717bb..99613cf7b 100644 --- a/cla-backend-go/cmd/server.go +++ b/cla-backend-go/cmd/server.go @@ -318,7 +318,7 @@ func server(localMode bool) http.Handler { v2GithubActivityService := v2GithubActivity.NewService(gitV1Repository, githubOrganizationsRepo, eventsService, autoEnableService, emailService) v2ClaGroupService := cla_groups.NewService(v1ProjectService, templateService, v1ProjectClaGroupRepo, v1ClaManagerService, v1SignaturesService, metricsRepo, gerritService, v1RepositoriesService, eventsService) - v2SignService := sign.NewService(configFile.ClaV1ApiURL, v1CompanyRepo, v1CLAGroupRepo, v1ProjectClaGroupRepo, v1CompanyService, v2ClaGroupService, configFile.DocuSignPrivateKey, usersService, v1SignaturesService, storeRepository, v1RepositoriesService, githubOrganizationsService, gitlabOrganizationsService) + v2SignService := sign.NewService(configFile.ClaAPIV4Base, v1CompanyRepo, v1CLAGroupRepo, v1ProjectClaGroupRepo, v1CompanyService, v2ClaGroupService, configFile.DocuSignPrivateKey, usersService, v1SignaturesService, storeRepository, v1RepositoriesService, githubOrganizationsService, gitlabOrganizationsService) sessionStore, err := dynastore.New(dynastore.Path("/"), dynastore.HTTPOnly(), dynastore.TableName(configFile.SessionStoreTableName), dynastore.DynamoDB(dynamodb.New(awsSession))) if err != nil { diff --git a/cla-backend-go/swagger/cla.v2.yaml b/cla-backend-go/swagger/cla.v2.yaml index cff2c86e8..a15bbe795 100644 --- a/cla-backend-go/swagger/cla.v2.yaml +++ b/cla-backend-go/swagger/cla.v2.yaml @@ -4179,7 +4179,8 @@ paths: in: body required: true schema: - type: string + type: object + additionalProperties: true responses: '200': description: Successfully received and processed the callback data. @@ -4204,7 +4205,8 @@ paths: in: body required: true schema: - type: string + type: object + additionalProperties: true responses: '200': description: Successfully received and processed the Gerrit callback data. @@ -4233,7 +4235,8 @@ paths: in: body required: true schema: - type: string + type: object + additionalProperties: true responses: '200': description: Successfully received and processed the callback data for corporate signatures. @@ -4270,7 +4273,8 @@ paths: in: body required: true schema: - type: string + type: object + additionalProperties: true responses: '200': description: Callback data for GitLab successfully received and processed. diff --git a/cla-backend-go/v2/sign/handlers.go b/cla-backend-go/v2/sign/handlers.go index 22f2e6af2..eca336e2b 100644 --- a/cla-backend-go/v2/sign/handlers.go +++ b/cla-backend-go/v2/sign/handlers.go @@ -138,6 +138,8 @@ func Configure(api *operations.EasyclaAPI, service Service, userService users.Se return sign.NewIclaCallbackGithubBadRequest() } + log.WithFields(f).Debugf("body: %+v", payload) + err := service.SignedIndividualCallbackGithub(ctx, payload, params.InstallationID, params.ChangeRequestID, params.GithubRepositoryID) if err != nil { return sign.NewIclaCallbackGithubBadRequest() diff --git a/cla-backend-go/v2/sign/service.go b/cla-backend-go/v2/sign/service.go index 479e3d61d..3a1fe12fb 100644 --- a/cla-backend-go/v2/sign/service.go +++ b/cla-backend-go/v2/sign/service.go @@ -82,7 +82,7 @@ type Service interface { // service type service struct { - ClaV1ApiURL string + ClaV4ApiURL string companyRepo company.IRepository projectRepo ProjectRepo projectClaGroupsRepo projects_cla_groups.Repository @@ -101,7 +101,7 @@ type service struct { func NewService(apiURL string, compRepo company.IRepository, projectRepo ProjectRepo, pcgRepo projects_cla_groups.Repository, compService company.IService, claGroupService cla_groups.Service, docsignPrivateKey string, userService users.Service, signatureService signatures.SignatureService, storeRepository store.Repository, repositoryService repositories.Service, githubOrgService github_organizations.Service, gitlabOrgService gitlab_organizations.ServiceInterface) Service { return &service{ - ClaV1ApiURL: apiURL, + ClaV4ApiURL: apiURL, companyRepo: compRepo, projectRepo: projectRepo, projectClaGroupsRepo: pcgRepo, @@ -303,7 +303,7 @@ func (s *service) RequestCorporateSignature(ctx context.Context, lfUsername stri } } - signature, err := s.requestCorporateSignature(ctx, s.ClaV1ApiURL, &requestCorporateSignatureInput{ + signature, err := s.requestCorporateSignature(ctx, s.ClaV4ApiURL, &requestCorporateSignatureInput{ ProjectID: proj.ProjectID, CompanyID: comp.CompanyID, SigningEntityName: input.SigningEntityName, @@ -338,7 +338,7 @@ func (s *service) RequestCorporateSignature(ctx context.Context, lfUsername stri } func (s *service) getCorporateSignatureCallbackUrl(companyId, projectId string) string { - return fmt.Sprintf("%s/v2/signed/corporate/%s/%s", s.ClaV1ApiURL, companyId, projectId) + return fmt.Sprintf("%s/v2/signed/corporate/%s/%s", s.ClaV4ApiURL, companyId, projectId) } func (s *service) SignedIndividualCallbackGithub(ctx context.Context, payload []byte, installationID, changeRequestID, repositoryID string) error { @@ -736,7 +736,7 @@ func (s *service) getIndividualSignatureCallbackURLGitlab(ctx context.Context, u return "", err } - return fmt.Sprintf("%s/v2/signed/gitlab/individual/%s/%s/%s/%s", s.ClaV1ApiURL, userID, gitlabOrg.OrganizationID, repositoryID, mergeRequestID), nil + return fmt.Sprintf("%s/v4/signed/gitlab/individual/%s/%s/%s/%s", s.ClaV4ApiURL, userID, gitlabOrg.OrganizationID, repositoryID, mergeRequestID), nil } @@ -796,7 +796,7 @@ func (s *service) getIndividualSignatureCallbackURL(ctx context.Context, userID return "", err } - return fmt.Sprintf("%s/v2/signed/individual/%d/%s/%s", s.ClaV1ApiURL, installationId, repositoryID, pullRequestID), nil + return fmt.Sprintf("%s/v2/signed/individual/%d/%s/%s", s.ClaV4ApiURL, installationId, repositoryID, pullRequestID), nil } //nolint:gocyclo @@ -1101,7 +1101,7 @@ func (s *service) populateSignURL(ctx context.Context, return "", errors.New("no envelope recipients found") } recipient := recipients[0] - returnURL := fmt.Sprintf("%s/v2/return-url/%s", s.ClaV1ApiURL, recipient.ClientUserId) + returnURL := fmt.Sprintf("%s/v2/return-url/%s", s.ClaV4ApiURL, recipient.ClientUserId) log.WithFields(f).Debugf("generating signature sign_url, using return-url as: %s", returnURL) signURL, signErr := s.GetSignURL(signer.Email, signer.RecipientId, signer.Name, signer.ClientUserId, envelopeResponse.EnvelopeId, returnURL)