1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2025-01-05 20:46:14 +01:00
fab-manager/app/frontend/src/javascript/lib/wallet.ts
2020-11-25 17:13:45 +01:00

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;
}
}
}