1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2025-02-06 01:08:21 +01:00
fab-manager/app/models/cart_item/subscription.rb

22 lines
373 B
Ruby
Raw Normal View History

# frozen_string_literal: true
# A subscription added to the shopping cart
class CartItem::Subscription < CartItem::BaseItem
def initialize(plan)
2021-04-26 11:40:26 +02:00
raise TypeError unless plan.is_a? Plan
@plan = plan
end
def price
amount = @plan.amount
elements = { plan: amount }
{ elements: elements, amount: amount }
end
def name
@plan.name
end
end