mirror of
https://github.com/LaCasemate/fab-manager.git
synced 2025-01-05 20:46:14 +01:00
21 lines
456 B
TypeScript
21 lines
456 B
TypeScript
import { Wallet } from '../models/wallet';
|
|
|
|
export default class WalletLib {
|
|
private wallet: Wallet;
|
|
|
|
constructor (wallet: Wallet) {
|
|
this.wallet = wallet;
|
|
}
|
|
|
|
/**
|
|
* Return the price remaining to pay, after we have used the maximum possible amount in the wallet
|
|
*/
|
|
computeRemainingPrice = (price: number): number => {
|
|
if (this.wallet.amount > price) {
|
|
return 0;
|
|
} else {
|
|
return price - this.wallet.amount;
|
|
}
|
|
}
|
|
}
|