Skip to content

Instantly share code, notes, and snippets.

@trikitrok
Created March 22, 2025 11:24
Show Gist options
  • Save trikitrok/bdb816b2bb4c0b962840eb43cd3da51b to your computer and use it in GitHub Desktop.
Save trikitrok/bdb816b2bb4c0b962840eb43cd3da51b to your computer and use it in GitHub Desktop.
// After changing the code, Invoice should look like:
export class Invoice {
private readonly shippingPricer: ShippingPricer;
// ...
constructor(
billingDate: OurDate,
openingDate: OurDate,
originator: Originator,
// ...
) {
// ...
this.shippingPricer = new ShippingPricer(billingDate, openingDate, originator);
}
// ...
public getValue(): Money {
const total = this.itemsSum();
total.add(this.shippingPricer.getPrice());
total.add(this.getTax());
return total;
}
private itemsSum(): Money {
throw new Error("Not implemented");
}
// ...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment