Fix missing fee problem when ORD returns missing membership information

This commit is contained in:
Senad Uka
2019-10-04 17:31:35 +02:00
parent 5c5931f3ed
commit 4de9e1d9a0
8 changed files with 214 additions and 182 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);
});
};