Add logging in addFees steps

This commit is contained in:
Bilal Catic
2019-10-04 16:54:12 +02:00
parent ca55bf83af
commit fc662b73a6
7 changed files with 211 additions and 181 deletions

View File

@@ -68,13 +68,13 @@ const deleteFeesFromORD = (dateRange, memberIds) => {
resolve(feesToSkip);
})
.catch((error) => {
console.log('error : ', error);
reject(error);
console.log('[Delete Fees From ORD] Error deleting fees from ORD : ', error);
reject(officeRnDAPIErrors.FAILED_TO_DELETE_FEES);
});
})
.catch((error) => {
console.log(error);
reject(`${officeRnDAPIErrors.FAILED_TO_FETCH_FEES} or ${officeRnDAPIErrors.FAILED_TO_FETCH_PLANS}`);
console.log("[Delete Fees From ORD] Error fetching fees and plans from ORD : ", error);
reject(`${officeRnDAPIErrors.FAILED_TO_FETCH_FEES} and ${officeRnDAPIErrors.FAILED_TO_FETCH_PLANS}`);
});
});
};
@@ -96,11 +96,13 @@ const addFeesToORD = (allFees, invoicedFees) => {
const nonInvoicedFees = allFees.filter(isFeeNonInvoiced);
API.post('/fees', nonInvoicedFees)
.then(() => {
resolve(nonInvoicedFees.length);
})
.catch((error) => {
console.log('==== ERROR ====');
console.log(error);
console.log('[Add Fees To ORD] Failed to send fees to ORD', error);
reject(officeRnDAPIErrors.FAILED_TO_ADD_FEES);
});
resolve(nonInvoicedFees.length);
});
};