From 3ccb80ad75e92d8e5c2320d82e6fe28bc9a80f19 Mon Sep 17 00:00:00 2001 From: Bilal Catic Date: Tue, 30 Jul 2019 22:28:06 +0200 Subject: [PATCH 1/2] detect cancellation of newly created booking --- services/integration/bookingChangeLog.js | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/services/integration/bookingChangeLog.js b/services/integration/bookingChangeLog.js index 72dfeeb..c35f5d6 100644 --- a/services/integration/bookingChangeLog.js +++ b/services/integration/bookingChangeLog.js @@ -23,10 +23,17 @@ const bulkWriteChanges = ((changes) => { }; if (!oldReservation.start && !oldReservation.end && !oldReservation.resourceId){ - // new reservation - logEntry.oldResourceId = null; - logEntry.oldStart = null; - logEntry.oldEnd = null; + if (newReservation.canceled){ + //new reservation created and canceled immediately + logEntry.oldResourceId = resourceId; + logEntry.oldStart = start; + logEntry.newEnd = end; + }else{ + // new reservation + logEntry.oldResourceId = null; + logEntry.oldStart = null; + logEntry.oldEnd = null; + } } if (newReservation.canceled){ From b07c375d8341595b56321a98632ce02e890008b8 Mon Sep 17 00:00:00 2001 From: Bilal Catic Date: Tue, 30 Jul 2019 23:04:29 +0200 Subject: [PATCH 2/2] remove label and cost explanation from booking fees --- services/integration/invoiceIntegration.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/integration/invoiceIntegration.js b/services/integration/invoiceIntegration.js index b54e875..e5048f2 100644 --- a/services/integration/invoiceIntegration.js +++ b/services/integration/invoiceIntegration.js @@ -203,7 +203,7 @@ const createFeeFromBooking = (booking, resourceMappings) => { const formattedStartTime = startMoment.format('HH:mm a'); const formattedEndTime = endMoment.format('HH:mm a'); - const formattedName = `[BOOKING FEES] ${officeName}, ${resourceName}, $${totalCost}, ${reservationLength.toFixed(2)} x $${hourlyRate.toFixed(2)}, ${formattedDate} [${formattedStartTime} - ${formattedEndTime}]`; + const formattedName = `${officeName}, ${resourceName}, $${totalCost}, ${formattedDate} [${formattedStartTime} - ${formattedEndTime}]`; return { name: formattedName,