Skip to content

Commit

Permalink
Merge pull request #216 from getlago/feat-customer-type
Browse files Browse the repository at this point in the history
feat(customer-type): Add customer type, firstname and lastname to customer
  • Loading branch information
brunomiguelpinto authored Sep 16, 2024
2 parents b50125a + b44090b commit 628a33a
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 6 deletions.
10 changes: 9 additions & 1 deletion lib/lago/api/resources/customer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ def whitelist_params(params)
tax_identification_number: params[:tax_identification_number],
logo_url: params[:logo_url],
name: params[:name],
firstname: params[:firstname],
lastname: params[:lastname],
customer_type: params[:customer_type],
phone: params[:phone],
state: params[:state],
url: params[:url],
Expand Down Expand Up @@ -121,7 +124,12 @@ def whitelist_integration_customers(integration_customers)

(integration_customers || []).each do |m|
result = (m || {})
.slice(:id, :external_customer_id, :integration_type, :integration_code, :subsidiary_id, :sync_with_provider)
.slice(:id,
:external_customer_id,
:integration_type,
:integration_code,
:subsidiary_id,
:sync_with_provider)

processed_integration_customers << result unless result.empty?
end
Expand Down
13 changes: 8 additions & 5 deletions spec/factories/customer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
factory :create_customer, class: OpenStruct do
external_id { '1a901a90-1a90-1a90-1a90-1a901a901a90' }
name { 'Gavin Belson' }
firstname { 'Gavin' }
lastname { 'Belson' }
customer_type { 'individual' }
country { 'US' }
address_line1 { '5230 Penfield Ave' }
address_line2 { 'fzufuzfuz' }
Expand Down Expand Up @@ -41,11 +44,11 @@
integration_customers do
[
{
integration_type: "netsuite",
integration_code: "test-123",
subsidiary_id: "2",
sync_with_provider: true
}
integration_type: 'netsuite',
integration_code: 'test-123',
subsidiary_id: '2',
sync_with_provider: true,
},
]
end
metadata do
Expand Down
3 changes: 3 additions & 0 deletions spec/fixtures/api/customer.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
"tax_identification_number": "EU123456789",
"logo_url": "http://hooli.com/logo.png",
"name": "Gavin Belson",
"firstname": "Gavin",
"lastname": "Belson",
"customer_type": "individual",
"phone": "1-171-883-3711 x245",
"state": "CA",
"url": "http://hooli.com",
Expand Down

0 comments on commit 628a33a

Please sign in to comment.