Sha256: deac462006b06b2a3f753813d15ea32e8ace7d5f1c29d1c54eb41eb42c82e9bc
Contents?: true
Size: 1023 Bytes
Versions: 5
Compression:
Stored size: 1023 Bytes
Contents
class StripeSubscriptionSchedulePhasePlan < StripeModelCallbacks::ApplicationRecord MATCHING_STRIPE_ATTRIBUTES = %w[quantity].freeze private_constant :MATCHING_STRIPE_ATTRIBUTES belongs_to :stripe_plan, optional: true, primary_key: "stripe_id" belongs_to :stripe_subscription_schedule_phase has_one :stripe_subscription_schedule, through: :stripe_subscription_schedule_phase def self.stripe_class Stripe::SubscriptionSchedulePhasePlan end def assign_from_stripe(object) check_object_is_stripe_class(object) StripeModelCallbacks::AttributesAssignerService.execute!( model: self, stripe_model: object, attributes: MATCHING_STRIPE_ATTRIBUTES ) assign_attributes( stripe_plan_id: object.plan, stripe_price_id: object.price ) assign_billing_thresholds(object) end private def assign_billing_thresholds(object) billing_thresholds = object.billing_thresholds self.billing_thresholds_usage_gte = billing_thresholds&.usage_gte end end
Version data entries
5 entries across 5 versions & 1 rubygems