Charges/invoices update

This commit is contained in:
Senad Uka
2019-07-19 09:46:15 +02:00
parent e2dcb246f0
commit 4389aaa8da
16 changed files with 253 additions and 62 deletions

View File

@@ -4,18 +4,26 @@ require('dotenv').config();
const { fetchAllBookings, bulkWriteReservationsWithChangesTracking } = require('../services/officeRnD/bookings');
const { chargeBookingChanges } = require('../services/integration/bookingChangeCharges');
const { bulkWriteChanges } = require('../services/integration/bookingChangeLog');
const checkBookingChanges = () => {
fetchAllBookings()
.then((reservations) => {
bulkWriteReservationsWithChangesTracking(reservations)
.then((changes) => {
chargeBookingChanges(changes)
bulkWriteChanges(changes)
.then(() => {
process.exit();
chargeBookingChanges(changes)
.then(() => {
process.exit();
})
.catch((error) => {
console.log('Error creating charges ', error);
process.exit();
});
})
.catch((error) => {
console.log('Error creating charges ', error);
console.log('Error bulk write booking reservation change log :', error);
process.exit();
});
})