Skip to content

Commit

Permalink
Refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
excid3 authored Oct 7, 2024
1 parent 5239f4b commit 113aab9
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions app/models/pay/paddle_billing/subscription.rb
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,11 @@ def change_quantity(quantity, **options)
quantity: quantity
}]

proration_billing_mode = options.delete(:proration_billing_mode) || "prorated_immediately"

::Paddle::Subscription.update(id: processor_id, items: items, proration_billing_mode: proration_billing_mode)
::Paddle::Subscription.update(
id: processor_id,
items: items,
proration_billing_mode: options.delete(:proration_billing_mode) || "prorated_immediately"
)
update(quantity: quantity)
rescue ::Paddle::Error => e
raise Pay::PaddleBilling::Error, e
Expand Down Expand Up @@ -157,9 +159,11 @@ def swap(plan, **options)
quantity: quantity || 1
}]

proration_billing_mode = options.delete(:proration_billing_mode) || "prorated_immediately"

::Paddle::Subscription.update(id: processor_id, items: items, proration_billing_mode: proration_billing_mode)
::Paddle::Subscription.update(
id: processor_id,
items: items,
proration_billing_mode: options.delete(:proration_billing_mode) || "prorated_immediately"
)
update(processor_plan: plan, ends_at: nil, status: :active)
end

Expand Down

0 comments on commit 113aab9

Please sign in to comment.