Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Updating plan with new charge #1706

Merged
merged 1 commit into from
Feb 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions app/controllers/api/v1/subscriptions_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ def plan_overrides
:billable_metric_id,
:min_amount_cents,
:invoice_display_name,
:charge_model,
{ properties: {} },
{
group_properties: [
Expand Down
2 changes: 1 addition & 1 deletion db/schema.rb

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 23 additions & 0 deletions spec/services/plans/update_service_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,29 @@
end
end

context 'with new charge' do
let(:plan_name) { 'foo' }

let(:charges_args) do
[
{
billable_metric_id: sum_billable_metric.id,
charge_model: 'standard',
pay_in_advance: false,
invoiceable: true,
properties: {
amount: '100',
},
},
]
end

it 'updates the plan' do
result = plans_service.call
expect(result.plan.charges.count).to eq(1)
end
end

context 'with premium charge model' do
let(:plan_name) { 'foo' }

Expand Down
Loading