Skip to content

Commit 21ad44e

Browse files
committed
Fix the path where token authorization is saved
1 parent a3e50f0 commit 21ad44e

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/Afip.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -246,12 +246,15 @@ Afip.prototype.CreateServiceTA = async function(service) {
246246
// Parse loginCmsReturn to JSON
247247
const res = await xmlParser.parseStringPromise(loginCmsResult.loginCmsReturn);
248248

249-
// Token authorization file name
250-
const taFileName = `TA-${this.options['CUIT']}-${service}${this.options['production'] ? '-production' : ''}.json`;
251-
249+
// Declare token authorization file path
250+
const taFilePath = path.resolve(
251+
this.TA_FOLDER,
252+
`TA-${this.options['CUIT']}-${service}${this.options['production'] ? '-production' : ''}.json`
253+
);
254+
252255
// Save Token authorization data to json file
253256
await (new Promise((resolve, reject) => {
254-
fs.writeFile(taFileName, JSON.stringify(res.loginticketresponse), (err) => {
257+
fs.writeFile(taFilePath, JSON.stringify(res.loginticketresponse), (err) => {
255258
if (err) {reject(err);return;}
256259
resolve();
257260
});

0 commit comments

Comments
 (0)