1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2025-02-02 22:52:21 +01:00
2022-03-29 17:21:29 +02:00

21 lines
458 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;
}
};
}