Created
February 28, 2018 14:05
-
-
Save jeffreyjurgajtis/89819654d47d93c5f2d22d836c60ab48 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
###### New Business | |
transactions: [ | |
Charge.new( | |
product_id: 1, | |
component_id: nil, | |
kind: "baseline", | |
amount_in_cents: 100_00, | |
memo: "Essential", | |
), | |
Charge.new( | |
product_id: 1, | |
component_id: nil, | |
kind: "quantity_based_component", | |
amount_in_cents: 20_00, | |
memo: "390 Paying Customers", | |
) | |
] | |
# resulting subscription.items => | |
items: [ | |
{ | |
product_id: 1, | |
component_id: 0, | |
name: "Advanced", | |
mrr: 120_00, | |
quantity: 1, | |
mrr_movements: [{ amount: 120_00, category: "new_business" }], | |
}, | |
] | |
###### Customer downgrades to 240 Paying Customers (Qty Based Component) | |
transactions: [ | |
Charge.new( | |
product_id: 1, | |
component_id: nil, | |
kind: "baseline", | |
amount_in_cents: 100_00, | |
memo: "Essential", | |
), | |
Charge.new( | |
product_id: 1, | |
component_id: nil, | |
kind: "quantity_based_component", | |
amount_in_cents: 15_00, | |
memo: "240 Paying Customers", | |
) | |
] | |
# resulting subscription.items => | |
items: [ | |
{ | |
product_id: 1, | |
component_id: 0, | |
name: "Advanced", | |
mrr: 115_00, | |
quantity: 1, | |
mrr_movements: [{ amount: -5_00 category: "contraction" }], | |
}, | |
] | |
###### Customer upgrades to 500 Paying Customers (Qty Based Component WITH ID), | |
transactions: [ | |
Charge.new( | |
product_id: 1, | |
component_id: nil, | |
kind: "baseline", | |
amount_in_cents: 100_00, | |
memo: "Essential", | |
), | |
Charge.new( | |
product_id: 1, | |
component_id: 3, | |
kind: "quantity_based_component", | |
amount_in_cents: 25_00, | |
memo: "500 Paying Customers", | |
) | |
] | |
# resulting subscription.items => | |
items: [ | |
{ | |
product_id: 1, | |
component_id: 0, | |
name: "Advanced", | |
mrr: 100_00, | |
quantity: 1, | |
mrr_movements: [{ amount: -15_00 category: "contraction" }], | |
}, | |
{ | |
product_id: 1, | |
component_id: 3, | |
name: "500 Paying Customers", | |
mrr: 25_00, | |
quantity: 1, | |
mrr_movements: [{ amount: 25_00 category: "new_business" }], | |
}, | |
] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment