Created
February 21, 2018 20:14
-
-
Save jeffreyjurgajtis/e6ff31af1c04bb2cf6ac0a2fd78f9cef to your computer and use it in GitHub Desktop.
This file contains hidden or 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
# Customer Signs up | |
# $100 Advanced (Product) | |
# $50 Minutes (Component) | |
# | |
# -$10 Coupon One (Single Use) | |
# -$20 Coupon Two (Multi Use) | |
Sale.new( | |
sale_amount_in_cents: 150_00, | |
discount_amount_in_cents: -30_00, | |
total_in_cents: 120_00, | |
... | |
lines: [], | |
... | |
discounts: [ | |
{ | |
id: coupon_one.id, | |
type: "single-use", | |
name: "$10 OFF NOW", | |
product_id: advanced.id, | |
component_id: 0, # a zero for component_id means this is a baseline, setup, one-time, etc charge | |
discount_amount_in_cents: -8_00, | |
}, | |
{ | |
id: coupon_one.id, | |
type: "single-use", | |
name: "$10 OFF NOW", | |
product_id: advanced.id, | |
component_id: minutes.id, | |
discount_amount_in_cents: -2_00 | |
}, | |
{ | |
id: coupon_two.id, | |
type: "multi-use", | |
name: "$20 OFF BLACK FRIDAY", | |
product_id: advanced.id, | |
component_id: 0, # a zero for component_id means this is a baseline, setup, one-time, etc charge | |
discount_amount_in_cents: -16_00 | |
}, | |
{ | |
id: coupon_two.id, | |
type: "multi-use", | |
name: "$20 OFF BLACK FRIDAY", | |
product_id: advanced.id, | |
component_id: minutes.id, | |
discount_amount_in_cents: -4_00 | |
} | |
] | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment