Class: Profitable::Processors::PaddleBillingProcessor
- Defined in:
- lib/profitable/processors/paddle_billing_processor.rb
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
Methods inherited from Base
Constructor Details
This class inherits a constructor from Profitable::Processors::Base
Instance Method Details
#calculate_mrr ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 |
# File 'lib/profitable/processors/paddle_billing_processor.rb', line 4 def calculate_mrr price_data = subscription.data['items']&.first&.dig('price') return 0 if price_data.nil? amount = price_data['unit_price']['amount'] quantity = subscription.quantity || 1 interval = price_data['billing_cycle']['interval'] interval_count = price_data['billing_cycle']['frequency'] normalize_to_monthly(amount * quantity, interval, interval_count) end |