Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Moroccan Dirham and Egyptian Pounds support #639

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions shared/src/main/scala/squants/market/Money.scala
Original file line number Diff line number Diff line change
Expand Up @@ -492,6 +492,8 @@ object NAD extends Currency("NAD", "Namibian Dollar", "N$", 2)
object TRY extends Currency("TRY", "Turkish lira", "₺", 2)
object UAH extends Currency("UAH", "Ukrainian Hryvnia", "₴", 2)
object THB extends Currency("THB", "Thai Baht", "฿", 2)
object MAD extends Currency("MAD", "Moroccan Dirham", ".د.م", 2)
object EGP extends Currency("EGP", "Egyptian Pounds", "E£", 2)

/**
* Support for Money DSL
Expand Down Expand Up @@ -537,6 +539,8 @@ object MoneyConversions {
def UAH = Money(n, squants.market.UAH)
def THB = Money(n, squants.market.THB)
def satang = Money(num.toDouble(n) / 100d, squants.market.THB)
def MAD = Money(n, squants.market.MAD)
def EGP = Money(n, squants.market.EGP)
}

class MoneyNumeric()(implicit mc: MoneyContext) extends Numeric[Money] {
Expand Down
2 changes: 1 addition & 1 deletion shared/src/main/scala/squants/market/package.scala
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ package object market {
KRW, MXN, MYR, NOK, NZD,
RUB, SEK, XAG, XAU, BTC,
ETH, LTC, ZAR, NAD, TRY,
UAH, THB
UAH, THB, MAD, EGP
)

lazy val defaultMoneyContext = MoneyContext(USD, defaultCurrencySet, Nil)
Expand Down
2 changes: 2 additions & 0 deletions shared/src/test/scala/squants/market/MoneySpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -499,6 +499,8 @@ class MoneySpec extends AnyFlatSpec with Matchers with TryValues {
d.UAH should be(UAH(d))
d.THB should be(THB(d))
d.satang should be(Money(d / 100d, squants.market.THB))
d.MAD should be(MAD(d))
d.EGP should be(EGP(d))
}

it should "provide Numeric support within a MoneyContext with no Exchange Rates" in {
Expand Down
Loading