import { Money } from "bigint-money/dist" ; import { NumberFormatter } from "../NumberFormatter" ; import { Fee } from "./Fee" ; export class PercentageFee implements Fee { constructor ( public percentage ) { } public calculateFor ( amount ) { return amount . multiply ( this . percentage . toString ( ) ) . divide ( 100 ) ; } public describe ( ) { const numberFormatter = new NumberFormatter ( ) ; return numberFormatter . formatPercentage ( this . percentage / 100 , 3 ) ; } public getExtendedDescription ( ) { return [ this . describe ( ) ] ; } }