diff --git a/lib/lago/api/resources/customer.rb b/lib/lago/api/resources/customer.rb index 9196a54..2552d61 100644 --- a/lib/lago/api/resources/customer.rb +++ b/lib/lago/api/resources/customer.rb @@ -46,7 +46,7 @@ def checkout_url(external_customer_id) "#{client.base_api_url}#{api_resource}/#{external_customer_id}/checkout_url", ) - response = connection.post(uri)[root_name] + response = connection.post({}, uri)[root_name] JSON.parse(response.to_json, object_class: OpenStruct) end diff --git a/spec/lago/api/resources/customer_spec.rb b/spec/lago/api/resources/customer_spec.rb index 07c9e29..2b3bd4f 100644 --- a/spec/lago/api/resources/customer_spec.rb +++ b/spec/lago/api/resources/customer_spec.rb @@ -253,11 +253,7 @@ context 'when the customer exists' do before do - # NOTE: Api makes POST to /customers endpoint first - # stub_request(:post, "https://api.getlago.com/api/v1/customers/#{customer_external_id}/checkout_url") - # .to_return(body: response_body, status: 200) - - stub_request(:post, 'https://api.getlago.com/api/v1/customers') + stub_request(:post, "https://api.getlago.com/api/v1/customers/#{customer_external_id}/checkout_url") .to_return(body: response_body, status: 200) end @@ -275,11 +271,7 @@ let(:customer_external_id) { 'DOESNOTEXIST' } before do - # NOTE: Api makes POST to /customers endpoint first - # stub_request(:post, "https://api.getlago.com/api/v1/customers/#{customer_external_id}/checkout_url") - # .to_return(body: JSON.generate(status: 404, error: 'Not Found'), status: 404) - - stub_request(:post, 'https://api.getlago.com/api/v1/customers') + stub_request(:post, "https://api.getlago.com/api/v1/customers/#{customer_external_id}/checkout_url") .to_return(body: JSON.generate(status: 404, error: 'Not Found'), status: 404) end