Homec4science

Make Currency a more formal type

Authored by epriestley <git@epriestley.com> on Oct 6 2014, 19:26.

Description

Make Currency a more formal type

Summary:
Ref T2787. Phortune currently stores a bunch of stuff as ...inUSDCents. This ends up being pretty cumbersome and I worry it will create a huge headache down the road (and possibly not that far off if we do Coinbase/Bitcoin soon). Even now, it's more of a pain than I figured it would be.

Instead:

  • Provide an application-level serialization mechanism.
  • Provide currency serialization.
  • Store currency in an abstract way (currently, as "1.23 USD") that can handle currencies in the future.
  • Change all ...inUSDCents to ..asCurrency.
  • This generally simplifies all the application code.
  • Also remove some columns which don't make sense or don't make sense anymore. Notably, Product is going to get more abstract and mostly be provided by applications.

Test Plan:

  • Created a new product.
  • Purchased a product.
  • Backed an initiative.
  • Ran unit tests.

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T2787

Differential Revision: https://secure.phabricator.com/D10633

Details

Committed
epriestley <git@epriestley.com>Oct 6 2014, 19:26
Pushed
aubortJan 31 2017, 17:16
Parents
rPH3463ce8a514f: Create new databases with appropriate collation
Branches
Unknown
Tags
Unknown

Event Timeline

epriestley <git@epriestley.com> committed rPHf86f9dc51283: Make Currency a more formal type (authored by epriestley <git@epriestley.com>).Oct 6 2014, 19:26