From f5fb89a01fb1915a74c4b12028c077bd8acb1b82 Mon Sep 17 00:00:00 2001 From: Miguel Pinto Date: Wed, 4 Sep 2024 12:34:49 +0100 Subject: [PATCH 1/4] feat: add finalize_zero_amount_invoice --- lib/lago/api/resources/customer.rb | 1 + lib/lago/api/resources/organization.rb | 1 + 2 files changed, 2 insertions(+) diff --git a/lib/lago/api/resources/customer.rb b/lib/lago/api/resources/customer.rb index 15ae124..723d462 100644 --- a/lib/lago/api/resources/customer.rb +++ b/lib/lago/api/resources/customer.rb @@ -72,6 +72,7 @@ def whitelist_params(params) currency: params[:currency], tax_codes: params[:tax_codes], timezone: params[:timezone], + finalize_zero_amount_invoice: params[:finalize_zero_amount_invoice], } whitelist_billing_configuration(params[:billing_configuration]).tap do |config| diff --git a/lib/lago/api/resources/organization.rb b/lib/lago/api/resources/organization.rb index 70cc24f..923840f 100644 --- a/lib/lago/api/resources/organization.rb +++ b/lib/lago/api/resources/organization.rb @@ -32,6 +32,7 @@ def whitelist_params(params) email_settings: params[:email_settings], document_numbering: params[:document_numbering], document_number_prefix: params[:document_number_prefix], + finalize_zero_amount_invoice: params[:finalize_zero_amount_invoice], }.compact whitelist_billing_configuration(params[:billing_configuration]).tap do |config| From ecae6a13bf4f16bad290dc9cb07ff41f2f7073e2 Mon Sep 17 00:00:00 2001 From: Miguel Pinto Date: Wed, 4 Sep 2024 12:46:07 +0100 Subject: [PATCH 2/4] feat: add finalize_zero_amount_invoice --- spec/factories/customer.rb | 1 + spec/lago/api/resources/customer_spec.rb | 3 +++ 2 files changed, 4 insertions(+) diff --git a/spec/factories/customer.rb b/spec/factories/customer.rb index a9ec8df..6b54d5a 100644 --- a/spec/factories/customer.rb +++ b/spec/factories/customer.rb @@ -18,6 +18,7 @@ legal_number { '49-008-2965' } net_payment_term { nil } tax_identification_number { 'EU123456789' } + finalize_zero_amount_invoice { 'inherit' } billing_configuration do { invoice_grace_period: 3, diff --git a/spec/lago/api/resources/customer_spec.rb b/spec/lago/api/resources/customer_spec.rb index 07c9e29..4cf174f 100644 --- a/spec/lago/api/resources/customer_spec.rb +++ b/spec/lago/api/resources/customer_spec.rb @@ -29,8 +29,11 @@ end it 'returns customer' do + pp params customer = resource.create(params) + pp customer + expect(customer.external_id).to eq('1a901a90-1a90-1a90-1a90-1a901a901a90') expect(customer.name).to eq('Gavin Belson') expect(customer.currency).to eq('EUR') From 77d8c2ae0714cb5baa769a941295f66bfbaba831 Mon Sep 17 00:00:00 2001 From: Miguel Pinto Date: Wed, 4 Sep 2024 12:55:07 +0100 Subject: [PATCH 3/4] feat: remove debug --- spec/lago/api/resources/customer_spec.rb | 3 --- 1 file changed, 3 deletions(-) diff --git a/spec/lago/api/resources/customer_spec.rb b/spec/lago/api/resources/customer_spec.rb index 4cf174f..07c9e29 100644 --- a/spec/lago/api/resources/customer_spec.rb +++ b/spec/lago/api/resources/customer_spec.rb @@ -29,11 +29,8 @@ end it 'returns customer' do - pp params customer = resource.create(params) - pp customer - expect(customer.external_id).to eq('1a901a90-1a90-1a90-1a90-1a901a901a90') expect(customer.name).to eq('Gavin Belson') expect(customer.currency).to eq('EUR') From bd3e9e6ad73bb6a5e30f17cc87f5d6f73e01e533 Mon Sep 17 00:00:00 2001 From: Miguel Pinto Date: Fri, 6 Sep 2024 10:59:52 +0100 Subject: [PATCH 4/4] feat: added the finalize_zero_amount_invoice to spec --- spec/fixtures/api/customer.json | 1 + spec/fixtures/api/organization.json | 1 + 2 files changed, 2 insertions(+) diff --git a/spec/fixtures/api/customer.json b/spec/fixtures/api/customer.json index c851ba4..e6d237a 100644 --- a/spec/fixtures/api/customer.json +++ b/spec/fixtures/api/customer.json @@ -21,6 +21,7 @@ "currency": "EUR", "timezone": "Europe/Paris", "applicable_timezone": "Europe/Paris", + "finalize_zero_amount_invoice": "inherit", "billing_configuration": { "invoice_grace_period": 3, "payment_provider": "stripe", diff --git a/spec/fixtures/api/organization.json b/spec/fixtures/api/organization.json index 277ff64..3eb7b88 100644 --- a/spec/fixtures/api/organization.json +++ b/spec/fixtures/api/organization.json @@ -21,6 +21,7 @@ "timezone": "America/New_York", "document_numbering": "per_customer", "document_number_prefix": "ORG-1234", + "finalize_zero_amount_invoice": true, "billing_configuration": { "invoice_footer": null, "invoice_grace_period": 3,