refund and delayed charge

This commit is contained in:
jackiettran
2025-09-04 16:44:47 -04:00
parent b59fc07fc3
commit b22e4fa910
19 changed files with 1255 additions and 594 deletions

View File

@@ -1,26 +1,21 @@
class FeeCalculator {
static calculateRentalFees(baseAmount) {
static calculateRentalFees(totalAmount) {
const platformFeeRate = 0.2;
const stripeRate = 0.029;
const stripeFixedFee = 0.3;
const platformFee = baseAmount * platformFeeRate;
const processingFee = baseAmount * stripeRate + stripeFixedFee;
const platformFee = totalAmount * platformFeeRate;
return {
baseRentalAmount: parseFloat(baseAmount.toFixed(2)),
totalAmount: parseFloat(totalAmount.toFixed(2)),
platformFee: parseFloat(platformFee.toFixed(2)),
processingFee: parseFloat(processingFee.toFixed(2)),
totalChargedAmount: parseFloat((baseAmount + processingFee).toFixed(2)),
payoutAmount: parseFloat((baseAmount - platformFee).toFixed(2)),
totalChargedAmount: parseFloat(totalAmount.toFixed(2)),
payoutAmount: parseFloat((totalAmount - platformFee).toFixed(2)),
};
}
static formatFeesForDisplay(fees) {
return {
baseRental: `$${fees.baseRentalAmount.toFixed(2)}`,
totalAmount: `$${fees.totalAmount.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)}`,
};