Skip to content

Commit

Permalink
Merge pull request #234 from getlago/getlago/invoice_custom_sections
Browse files Browse the repository at this point in the history
Feat(invoice_custom_sections): add ics to ruby-client
  • Loading branch information
annvelents authored Jan 14, 2025
2 parents 8195d35 + 9878c83 commit d98a682
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/lago/api/resources/customer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,10 @@ def whitelist_params(params)
zipcode: params[:zipcode],
currency: params[:currency],
tax_codes: params[:tax_codes],
invoice_custom_section_codes: params[:invoice_custom_section_codes],
timezone: params[:timezone],
finalize_zero_amount_invoice: params[:finalize_zero_amount_invoice],
skip_invoice_custom_sections: params[:skip_invoice_custom_sections],
}

whitelist_billing_configuration(params[:billing_configuration]).tap do |config|
Expand Down
2 changes: 2 additions & 0 deletions spec/factories/customer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
net_payment_term { nil }
tax_identification_number { 'EU123456789' }
finalize_zero_amount_invoice { 'inherit' }
skip_invoice_custom_sections { false }
billing_configuration do
{
invoice_grace_period: 3,
Expand Down Expand Up @@ -62,6 +63,7 @@
end
currency { 'EUR' }
tax_codes { ['tax_code'] }
invoice_custom_section_codes { ['ics_code'] }
timezone { 'Europe/Paris' }
end
end
13 changes: 13 additions & 0 deletions spec/fixtures/api/customer.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"timezone": "Europe/Paris",
"applicable_timezone": "Europe/Paris",
"finalize_zero_amount_invoice": "inherit",
"skip_invoice_custom_sections": false,
"billing_configuration": {
"invoice_grace_period": 3,
"payment_provider": "stripe",
Expand Down Expand Up @@ -72,6 +73,18 @@
"applied_to_organization": false,
"created_at": "2022-04-29T08:59:51Z"
}
],
"invoice_custom_sections": [
{
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"code": "ics_code",
"name": "ics_name",
"description": "something about this section",
"details": "This part will be shown at the invoice",
"display_name": "Section name displayed on invoice",
"applied_to_organization": true,
"created_at": "2022-04-29T08:59:51Z"
}
]
}
}
10 changes: 10 additions & 0 deletions spec/fixtures/api/invoice.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,16 @@
"created_at": "2022-04-29T08:59:51Z"
}
],
"applied_invoice_custom_sections": [
{
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"lago_invoice_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"code": "ics_code",
"details": "This part will be shown at the invoice",
"display_name": "Section name displayed on invoice",
"created_at": "2022-04-29T08:59:51Z"
}
],
"customer": {
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"external_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
Expand Down

0 comments on commit d98a682

Please sign in to comment.