Server/project/src/helpers/PaymentHelper.ts

38 lines
821 B
TypeScript
Raw Normal View History

2023-03-03 16:23:46 +01:00
import { injectable } from "tsyringe";
import { Money } from "../models/enums/Money";
@injectable()
export class PaymentHelper
{
/**
* Check whether tpl is Money
* @param {string} tpl
* @returns void
*/
public isMoneyTpl(tpl: string): boolean
{
return [Money.DOLLARS, Money.EUROS, Money.ROUBLES].some(element => element === tpl);
}
/**
* Gets currency TPL from TAG
* @param {string} currency
* @returns string
*/
public getCurrency(currency: string): string
{
switch (currency)
{
case "EUR":
return Money.EUROS;
case "USD":
return Money.DOLLARS;
case "RUB":
return Money.ROUBLES;
default:
return "";
}
}
}