Skip to content

Instantly share code, notes, and snippets.

@jeffreyjurgajtis
Created January 26, 2018 17:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jeffreyjurgajtis/b1d6f150a43928edb3be1c71d3e7a84d to your computer and use it in GitHub Desktop.
Save jeffreyjurgajtis/b1d6f150a43928edb3be1c71d3e7a84d to your computer and use it in GitHub Desktop.
# User signs up for 'free' and adds 'ip_addresses' (3 units)
# Datapoint1
# subcription.items:
[
{
product_id: free.id,
component_id: ip_addresses.id,
name: "IP Addresses",
mrr: 30_00,
mrr_movements: [{ amount: 30_00, category: "new_business" }],
quantity: 3,
},
]
# User upgrades to 'Advanced'
# Datapoint2
# subcription.items:
[
{
product_id: advanced.id,
component_id: 0,
name: "Advanced",
mrr: 100_00,
mrr_movements: [{ amount: 100_00, category: "expansion" }],
quantity: 1,
},
{
product_id: free.id,
component_id: ip_addresses.id,
name: "IP Addresses",
mrr: 0,
mrr_movements: [{ amount: -30_00, category: "switch" }],
quantity: 0,
},
{
product_id: advanced.id,
component_id: ip_addresses.id,
name: "IP Addresses",
mrr: 30_00,
mrr_movements: [{ amount: 30_00, category: "switch" }],
quantity: 3,
}
]
# Nowhere on Datapoint2 does the name of product `free` exist, because we don't
# persist sub-items for $0, so the best that we can do to describe the
# $30 `ip_addresses` switch movement is:
#
# "$30.00/mo moved to Advanced as IP Addresses"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment