lib/mangopay/ubo_declaration.rb in mangopay-3.0.31 vs lib/mangopay/ubo_declaration.rb in mangopay-3.0.32
- old
+ new
@@ -1,19 +1,30 @@
module MangoPay
-
# Provides API methods for the UBO declaration entity.
class UboDeclaration < Resource
- include HTTPCalls::Fetch
-
class << self
-
- def update(id = nil, params = {})
- declared_ubo_ids = []
- params['DeclaredUBOs'].each do |ubo|
- declared_ubo_ids << (ubo.key?('UserId') ? ubo['UserId'] : ubo)
+ def url(user_id, id = nil)
+ if id
+ "#{MangoPay.api_path}/users/#{user_id}/kyc/ubodeclarations/#{id}"
+ else
+ "#{MangoPay.api_path}/users/#{user_id}/kyc/ubodeclarations"
end
- params['DeclaredUBOs'] = declared_ubo_ids
- MangoPay.request(:put, url(id), params)
end
+
+ def create(user_id)
+ MangoPay.request(:post, url(user_id))
+ end
+
+ def fetch(user_id, id)
+ MangoPay.request(:get, url(user_id, id))
+ end
+
+ def update(user_id, id, params = {})
+ request_params = {
+ Status: params['Status'],
+ Ubos: params['Ubos']
+ }
+ MangoPay.request(:put, url(user_id, id), request_params)
+ end
end
end
-end
\ No newline at end of file
+end