Skip to content

Commit

Permalink
1. update NPM version
Browse files Browse the repository at this point in the history
2. Add support for MyinfoBiz Entitiy URL
  • Loading branch information
cheongkahou committed Sep 13, 2023
1 parent 17bbf84 commit 0b0581f
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/npmpublish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
- uses: actions/checkout@v1
- uses: actions/setup-node@v1
with:
node-version: 16
node-version: 18
registry-url: https://registry.npmjs.org/
- run: npm ci
- run: npm publish --access public
Expand Down
18 changes: 14 additions & 4 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -290,8 +290,15 @@ class MyInfoConnector {
callPersonAPI = async function (sub, accessToken, sessionEphemeralKeyPair) {
let urlLink;

urlLink = this.CONFIG.PERSON_URL + "/" + sub;

//Code to handle Myinfo Biz Entity Person URL
if (this.CONFIG.PERSON_URL.includes('biz')) {
let subTemp = sub.split('_');
var uen = subTemp[0];
var uuid = subTemp[1];
urlLink = this.CONFIG.PERSON_URL + '/' + uen + '/' + uuid;
} else {
urlLink = this.CONFIG.PERSON_URL + '/' + sub;
}
let cacheCtl = "no-cache";
let method = constant.HTTP_METHOD.GET;

Expand Down Expand Up @@ -333,9 +340,12 @@ class MyInfoConnector {
: this.CONFIG.PERSON_URL;
let parsedUrl = urlParser.parse(personURL);
let domain = parsedUrl.hostname;
let requestPath = parsedUrl.path + "/" + sub + "?" + strParams;
//invoking https to do GET call

//update url to include uen for Myinfo Biz
let requestPath = this.CONFIG.PERSON_URL.includes('biz') ? `${parsedUrl.path}/${uen}/${uuid}?${strParams}` :
`${parsedUrl.path}/${sub}?${strParams}`;

//invoking https to do GET call
let personData = await requestHandler.getHttpsResponse(
method,
"https://" + domain + requestPath,
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "myinfo-connector-v4-nodejs",
"version": "1.0.2",
"version": "2.0.0",
"description": "MyInfo Library for NodeJs",
"main": "index.js",
"publishConfig": {
Expand Down

0 comments on commit 0b0581f

Please sign in to comment.