-
Notifications
You must be signed in to change notification settings - Fork 18
Expand file tree
/
Copy pathaddCard.cjs
More file actions
33 lines (29 loc) · 776 Bytes
/
addCard.cjs
File metadata and controls
33 lines (29 loc) · 776 Bytes
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
const axios = require('axios');
const { generateToken } = require("./generateToken.cjs");
const { getError } = require("./getError.cjs");
const { getUrl } = require("./getUrl.cjs");
const addCard = async (options) => {
try {
const response = await axios({
method: 'post',
url: getUrl('AddCard'),
headers: {
'Content-Type': 'application/json',
},
data: { ...options, Token: generateToken(options) },
});
const error = getError(response.data.ErrorCode);
return {
error,
request: options,
response: response.data,
};
} catch (error) {
return {
error,
request: options,
response: null,
};
}
};
exports.addCard = addCard;