761f857f13
closes #1807 - e2e tests now also cover the tax calculator. - Dart app updated to match TS (it had no sales tax calculator). - TS sample source cleanup (e.g. removed many unnecessary `docregions`). - Prose updated to include @kwalrath's revisions from a while ago, Ward's comments, and some of my edits as well. Contributes to #1598 and #1508.
15 lines
381 B
TypeScript
15 lines
381 B
TypeScript
import { Injectable } from '@angular/core';
|
|
|
|
import { TaxRateService } from './tax-rate.service';
|
|
|
|
@Injectable()
|
|
export class SalesTaxService {
|
|
constructor(private rateService: TaxRateService) { }
|
|
|
|
getVAT(value: string | number) {
|
|
let amount = (typeof value === 'string') ?
|
|
parseFloat(value) : value;
|
|
return (amount || 0) * this.rateService.getRate('VAT');
|
|
}
|
|
}
|