forked from Modulr-finance/modulr-hmac
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
25 lines (22 loc) · 895 Bytes
/
index.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
'use strict';
const request = require('request');
const signature = require(`./signature`);
const API_KEY = "57502612d1bb2c00010000256c9568f1f7d540e085052b425d46d233";
const API_SECRET = "Y2Q0MzhmZDE2OWIzNDVkNGE5ZTczOTU3ZTAxZWY5NTc=";
const signatureHelper = new signature(API_KEY,API_SECRET);
const signatureResult = signatureHelper.calculate();
request.get(
{
url: 'https://api-sandbox.modulrfinance.com/api-sandbox/customers',
json: true,
headers: signatureResult.getHTTPHeaders()
},
(err, res, data) => {
if (err) {
console.error('Error calling API', err);
} else if (res.statusCode !== 200) {
console.error('Unsuccessful API call, code: ', res.statusCode, ', messsage: ', res.statusMessage, ', body: ', data);
} else {
console.log('OK response from API, body: ', data);
}
});