Skip to content

Commit

Permalink
fix-dependens-on-validation-issue-service-offer-vc-url-replace-with-id
Browse files Browse the repository at this point in the history
  • Loading branch information
mittalVaghela committed Jun 13, 2024
1 parent e4d0612 commit bbbba1b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public void hostPolicy(String hostPolicyJson, String hostedPath) {
FileUtils.writeStringToFile(file, hostPolicyJson, Charset.defaultCharset());
this.s3Utils.uploadFile(hostedPath, file);
} catch (Exception e) {
log.error("Error while hosting policy json on path " + hostedPath, e);
log.error("Error while hosting policy json on path {}", hostedPath, e);
} finally {
CommonUtils.deleteFile(file);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,8 @@ public ServiceOfferResponse createServiceOffering(CreateServiceOfferingRequest r
}

String serviceName = "service_" + this.getRandomString();
String serviceHostUrl = this.wizardHost + participant.getId() + "/" + serviceName + ".json";

String serviceHostUrl = signerService.formServiceOfferingJsonUrl(participant.getDomain(), participant.getId(), serviceName);

Map<String, String> labelLevelVc = this.createServiceOfferLabelLevel(participant, request, serviceHostUrl);
Map<String, Object> credentialSubject = request.getCredentialSubject();
Expand All @@ -122,9 +123,8 @@ public ServiceOfferResponse createServiceOffering(CreateServiceOfferingRequest r
request.setCredentialSubject(credentialSubject);

Map<String, String> complianceCredential = this.signerService.signService(participant, request, serviceName);
String vcUrl=StringUtils.hasText(request.getCredentialSubject().get("id").toString())?request.getCredentialSubject().get("id").toString():serviceHostUrl;

Credential serviceOffVc = this.credentialService.createCredential(complianceCredential.get(SERVICE_VC), vcUrl, CredentialTypeEnum.SERVICE_OFFER.getCredentialType(), "", participant);
Credential serviceOffVc = this.credentialService.createCredential(complianceCredential.get(SERVICE_VC), serviceHostUrl, CredentialTypeEnum.SERVICE_OFFER.getCredentialType(), "", participant);
List<StandardTypeMaster> supportedStandardList = this.getSupportedStandardList(complianceCredential.get(SERVICE_VC));

ServiceOffer serviceOffer = ServiceOffer.builder()
Expand All @@ -140,7 +140,7 @@ public ServiceOfferResponse createServiceOffering(CreateServiceOfferingRequest r
serviceOffer = this.serviceOfferRepository.save(serviceOffer);

if (!participant.isOwnDidSolution()) {
this.signerService.addServiceEndpoint(participant.getId(), vcUrl, this.serviceEndpointConfig.linkDomainType(), vcUrl);
this.signerService.addServiceEndpoint(participant.getId(), serviceHostUrl, this.serviceEndpointConfig.linkDomainType(), serviceHostUrl);
}

this.publishService.publishServiceComplianceToMessagingQueue(serviceOffer.getId(), complianceCredential.get(SERVICE_VC));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ private String formParticipantJsonUrl(String domain, UUID participantId) {
return this.wizardHost + participantId.toString() + "/" + PARTICIPANT_JSON;
}

private String formServiceOfferingJsonUrl(String domain, UUID participantId, String name) {
public String formServiceOfferingJsonUrl(String domain, UUID participantId, String name) {
if (StringUtils.hasText(domain)) {
return "https://" + domain + "/" + participantId.toString() + "/" + name + JSON_EXTENSION;
}
Expand Down

0 comments on commit bbbba1b

Please sign in to comment.