Hacker Newsnew | past | comments | ask | show | jobs | submit | adenhoed's commentslogin

It's nice if your language has support for monetary amounts, but usually you end up using multiple languages that interact with the same database model, and you still end up using a built in numeric datatype in your RDBMS of choice.

Three additional 'mistakes' to prevent when dealing with money representations:

1. The definition of a currency might change. For example, some years ago Iceland decided to change the exponent of ISK from 2 to 0. Currencies have different versions.

2. As a FinTech you probably have integrations with many third parties, they don't change their exponents for a currency at the same time. Keep track of what third parties think the correct exponent is at any point in time, and convert between your representation and their representation. Otherwise, you'll have interesting incidents (e.g. transferring 100x the intended amount of ISK).

3. At first you think that counting minor units as an integer is enough, and then you need to start accounting for fractions of cents because sales people sold something for a fee of $0.0042 per transaction. If your code rounds all these fees to $0.00 you don't make any money.


1, 2 - Yeah, there's always a sanity checking and conversion layer around the 3rd party. Currencies do indeed sometimes have 2 versions in play there.

3 - Indeed, the currency type that I referenced "is appropriate for financial calculations that require large numbers of significant integral and fractional digits and no round-off errors"


flushHeaders() is there to have a simple bug to find. In real world cases, tools like tcpdump and strace are essential, and I think this is a nice way to teach about how these tools can be used.


While processing a payment a psp/acquirer is mostly receiving money, so no need to check if there is balance available. Only for cases like refunds and card payouts you need to know if a merchant has sufficient balance to process the request.


In The Netherlands you have the right to replace the locks with your own locks, as long as you can re-install the original lock once you move out.

How is that arranged in the US?


Do you need to provide your landlord with a copy of the key to your new lock?

In the US, it's standard for a rental agreement and/or state law to specify that the landlord can enter your property with 24 hours notice even if you're not there, or to enter immediately in case of an emergency.


> In the US, it's standard for a rental agreement and/or state law to specify that the landlord can enter your property with 24 hours notice even if you're not there, or to enter immediately in case of an emergency.

As a European, I find the idea extremely shocking.

Here entering the residence of someone without their explicit consent is considered home invasion and can net you a year in jail and a fine of up to 15000 euros. It doesn't matter if you own the property as long as someone else lives their. It remains true if they are not paying. You will need the police and a court order if you want to enter.


Worth noting: this kind of rule is both normal, & legal in both IE & UK. The idea that this wasn't the case somewhere sounds weird (although nice!) to my European ears.


No, if you replace it they don't have a key, and you don't have to give it to them.


In Germany the landlord isn't even allowed to keep a copy of the key for the original lock, so obviously you don't have to give them a key of your own lock.

All clauses in contracts that require you to give a key to the landlord are automatically void.


All of the places I’ve rented did not permit me to change the locks. I did change the cylinder on one place despite the contract and I changed it back before I left. I’m sure I could have been evicted for this but more likely I would just be liable for repairs.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: