Bugfix for fees / Oauth 2 implementation

This commit is contained in:
Senad Uka
2019-08-31 06:11:15 +02:00
parent cbf502bc14
commit b3e2de9f57
15 changed files with 245 additions and 23 deletions

View File

@@ -247,6 +247,10 @@ const createNegativeFeeForDiscount = (memberData, dateRange) => {
}
});
if (membershipFeeForDiscount === 0){
return null; //This member's plan is not eligible for a discount
}
const totalChargeFee = membershipFeeForDiscount + totalBookingChargedFee;
let discount = 0;
@@ -261,7 +265,7 @@ const createNegativeFeeForDiscount = (memberData, dateRange) => {
const discountRate = discountPercentage / 100;
discount = totalChargeFee * discountRate;
}else{
return null;
return null; //Not enough hours to earn a discount
}
const formattedName = `[Discount] Total booked : ${totalBookedHours.toFixed(2)} hrs, Total charged : ${totalChargedHours.toFixed(2)} hrs, Discount : ${discountPercentage} %`;
@@ -317,7 +321,7 @@ const getMembersFeesForDateRange = (dateRange, memberIds) => {
membersMap[member.memberId] = {
member,
bookingData: Object.assign({}, oneMemberObject),
membershipFees: membershipsMap[member.memberId],
membershipFees: membershipsMap[member.memberId] || [],
};
});