Skip to content

Commit

Permalink
Merge pull request #7 from AbhiGaddi/main
Browse files Browse the repository at this point in the history
Feat : certificate changed
  • Loading branch information
AbhiGaddi authored Mar 19, 2024
2 parents 9d12392 + 4ce92d5 commit 883b849
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/main/java/org/swasth/hcx/service/HcxIntegratorService.java
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
package org.swasth.hcx.service;

import io.hcxprotocol.init.HCXIntegrator;
import org.apache.commons.io.IOUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
import org.springframework.stereotype.Service;

import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
import java.nio.charset.StandardCharsets;
import java.util.HashMap;
import java.util.Map;

Expand All @@ -29,16 +34,17 @@ public HCXIntegrator getHCXIntegrator(String participantCode) throws Exception {
return hcxIntegrator;
}

public Map<String, Object> getConfig(String code) {
public Map<String, Object> getConfig(String code) throws IOException {
Map<String, Object> configMap = new HashMap<>();
configMap.put("protocolBasePath", env.getProperty("hcx_application.url") + "/api/" + env.getProperty("hcx_application.api_version"));
configMap.put("participantCode", code);
configMap.put("authBasePath", env.getProperty("hcx_application.token_url"));
configMap.put("username", env.getProperty("provider.username"));
configMap.put("password", env.getProperty("provider.password"));
configMap.put("encryptionPrivateKey", env.getProperty("provider.private_key"));
String certificate = IOUtils.toString(new URL(env.getProperty("provider.private_key")), StandardCharsets.UTF_8.toString());
configMap.put("encryptionPrivateKey", certificate);
configMap.put("fhirValidationEnabled", true);
configMap.put("signingPrivateKey", env.getProperty("provider.private_key"));
configMap.put("signingPrivateKey", certificate);
return configMap;
}
}

0 comments on commit 883b849

Please sign in to comment.