openmobilityfoundation / mobility-data-specification

A data standard to enable right-of-way regulation and two-way communication between mobility companies and local governments.
https://www.openmobilityfoundation.org/about-mds/
Other
684 stars 231 forks source link

Add a currency designation for standard_cost and actual_cost #91

Closed aickin closed 4 years ago

aickin commented 5 years ago

The definitions of standard_cost and actual_cost both reference "cents", and I think the assumption is that the cost will always be denominated in US dollars. However, if this spec becomes successful, it would be great to see it used in other countries. And this is not just a theoretical possibility: in August, Bird launched scooters in Paris, and Lime did so in Madrid.

I would suggest adding two extra fields to the /trips provider endpoint: standard_cost_currency and actual_cost_currency. Each of these fields would be an ISO4217 currency code like "USD" or "GBP".

Alternately, you could have standard_cost and actual_cost be sub-objects with two properties: amount and currency.

There is a catch, though, in that you will then need to store the currency amount either as a decimal amount, which can cause problems if it is parsed into a float, or as a fixed point number based on the currency's default number of fraction digits, which can be a little unwieldy. See https://github.com/zalando/jackson-datatype-money/blob/master/MONEY.md for a more thorough discussion of how to represent money in JSON.

hunterowens commented 5 years ago

moving to 0.4.0