-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathhelper.js
39 lines (27 loc) · 859 Bytes
/
helper.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
const axios = require('axios');
const CLIENT_ID = <client-id>;
const CLIENT_SECRET = <client-secret>;
const API_AUTH_URL = "https://enrollment-api-auth.paymentshub.com"; // The Sandbox Authentication URL
const API_SANDBOX_URL = "https://enrollment-api-sandbox.paymentshub.com"; // The Sandbox Enrollment API URL
class authHelper{
constructor(){
}
/*
* Get Auth Token
*/
static async getAuthToken(){
try{
return await axios.post(API_AUTH_URL + '/oauth/token', {
grant_type: "client_credentials",
scope: "all",
client_id: CLIENT_ID,
client_secret: CLIENT_SECRET
});
}
catch (error) {
console.error("Error");
throw error;
}
}
}
exports.authHelper = authHelper;