1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2025-02-09 03:54:23 +01:00

21 lines
458 B
TypeScript
Raw Normal View History

2020-11-25 17:13:45 +01:00
import { Wallet } from '../models/wallet';
export default class WalletLib {
private wallet: Wallet;
constructor (wallet: Wallet) {
this.wallet = wallet;
}
/**
2022-01-18 16:07:23 +01:00
* Return the price remaining to pay, after we have used the maximum possible amount in the wallet.
2020-11-25 17:13:45 +01:00
*/
computeRemainingPrice = (price: number): number => {
if (this.wallet.amount > price) {
return 0;
} else {
return price - this.wallet.amount;
}
2022-04-01 17:48:32 +02:00
};
2020-11-25 17:13:45 +01:00
}