Skip to content
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
10 changes: 10 additions & 0 deletions lib/adyen/services/legalEntityManagement/legal_entities_api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,16 @@ def get_legal_entity(id, headers: {})
@client.call_adyen_api(@service, action, {}, headers, @version)
end

# Request periodic data review.
def request_periodic_review(id, headers: {})
endpoint = '/legalEntities/{id}/requestPeriodicReview'.gsub(/{.+?}/, '%s')
endpoint = endpoint.gsub(%r{^/}, '')
endpoint = format(endpoint, id)

action = { method: 'post', url: endpoint }
@client.call_adyen_api(@service, action, {}, headers, @version)
end

# Update a legal entity
def update_legal_entity(request, id, headers: {})
endpoint = '/legalEntities/{id}'.gsub(/{.+?}/, '%s')
Expand Down
21 changes: 21 additions & 0 deletions spec/lem_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -114,4 +114,25 @@
expect(error.msg).to eq('Legal entity not found ErrorCode: 100')
end
end

it 'makes a LegaleEntity /requestPeriodicReview call' do
url = @shared_values[:client].service_url(@shared_values[:service], "legalEntities/LE123/requestPeriodicReview",
@shared_values[:client].legal_entity_management.version)
WebMock.stub_request(:post, url)
.with(
headers: {
'x-api-key' => @shared_values[:client].api_key
}
)
.to_return(
body: '{}'
)

result = @shared_values[:client].legal_entity_management.legal_entities_api.request_periodic_review('LE123')
result.response

expect(result.status)
.to eq(200)
end

end