-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Sam Ban
committed
Sep 15, 2022
1 parent
b7b7783
commit 3427f9b
Showing
7 changed files
with
101 additions
and
164 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,33 @@ | ||
import fetch from 'node-fetch'; | ||
import { config } from './config.js'; | ||
|
||
const createWebhook = async (programID) => { | ||
const createWebhook = async (programId) => { | ||
const res = await fetch( | ||
`${config.SHEERID_API_URL}/rest/v2/program/${programID}/webhook`, { | ||
'method': 'post', | ||
'headers': { | ||
'Authorization': `Basic ${config.SHEERID_TOKEN}`, | ||
'Content-Type': 'application/json' | ||
}, | ||
data: { | ||
'scope': config.URL + '/success-webhook' | ||
} | ||
`${config.SHEERID_API_URL}/program/${programId}/webhook`, { | ||
'method': 'POST', | ||
'headers': { | ||
'Authorization': `Bearer ${config.SHEERID_TOKEN}`, | ||
'Content-Type': 'application/json' | ||
}, | ||
body: JSON.stringify({ | ||
'callbackUri': `${config.URL}/api/success-webhook`, | ||
}) | ||
}); | ||
return await res.json(); | ||
return res.json(); | ||
} | ||
|
||
export { createWebhook }; | ||
const getVerification = async (verificationId) => { | ||
const res = await fetch( | ||
`${config.SHEERID_API_URL}/verification/${verificationId}/details`, { | ||
'method': 'GET', | ||
'headers': { | ||
'Authorization': `Bearer ${config.SHEERID_TOKEN}`, | ||
'Content-Type': 'application/json' | ||
}, | ||
}); | ||
return res.json(); | ||
} | ||
|
||
export { createWebhook, getVerification }; | ||
|
||
|