started payouts

This commit is contained in:
jackiettran
2025-08-29 00:32:06 -04:00
parent 0f04182768
commit b52104c3fa
13 changed files with 578 additions and 252 deletions

View File

@@ -0,0 +1,30 @@
class FeeCalculator {
static calculateRentalFees(baseAmount) {
const platformFeeRate = 0.2;
const stripeRate = 0.029;
const stripeFixedFee = 0.3;
const platformFee = baseAmount * platformFeeRate;
const processingFee = baseAmount * stripeRate + stripeFixedFee;
return {
baseRentalAmount: parseFloat(baseAmount.toFixed(2)),
platformFee: parseFloat(platformFee.toFixed(2)),
processingFee: parseFloat(processingFee.toFixed(2)),
totalChargedAmount: parseFloat((baseAmount + processingFee).toFixed(2)),
payoutAmount: parseFloat((baseAmount - platformFee).toFixed(2)),
};
}
static formatFeesForDisplay(fees) {
return {
baseRental: `$${fees.baseRentalAmount.toFixed(2)}`,
platformFee: `$${fees.platformFee.toFixed(2)} (20%)`,
processingFee: `$${fees.processingFee.toFixed(2)} (2.9% + $0.30)`,
totalCharge: `$${fees.totalChargedAmount.toFixed(2)}`,
ownerPayout: `$${fees.payoutAmount.toFixed(2)}`,
};
}
}
module.exports = FeeCalculator;