-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #14 from levanto-financial/acct-management
Account and refresh management
- Loading branch information
Showing
4 changed files
with
146 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
defmodule Yodlee.Account do | ||
|
||
def delete(creds, account_id, cobrand_name \\ Yodlee.default_cobrand_name) do | ||
Yodlee.make_authenticated_request(creds, "delete", "#{cobrand_name}/v1/accounts/#{account_id}") | ||
end | ||
|
||
def delete!(creds, account_id, cobrand_name \\ Yodlee.default_cobrand_name) do | ||
Yodlee.throw_on_fail fn -> | ||
delete(creds, account_id, cobrand_name) | ||
end | ||
end | ||
|
||
def get(creds, account_id, container_name, cobrand_name \\ Yodlee.default_cobrand_name) do | ||
Yodlee.make_authenticated_request(creds, "get", "#{cobrand_name}/v1/accounts/#{account_id}", %{ | ||
"container" => container_name | ||
}) | ||
end | ||
|
||
def get!(creds, account_id, container_name, cobrand_name \\ Yodlee.default_cobrand_name) do | ||
Yodlee.throw_on_fail fn -> | ||
get(creds, account_id, container_name, cobrand_name) | ||
end | ||
end | ||
|
||
def search(creds, params, cobrand_name \\ Yodlee.default_cobrand_name) do | ||
Yodlee.make_authenticated_request(creds, "get", "#{cobrand_name}/v1/accounts", params) | ||
end | ||
|
||
def search!(creds, params, cobrand_name \\ Yodlee.default_cobrand_name) do | ||
Yodlee.throw_on_fail fn -> | ||
search(creds, params, cobrand_name) | ||
end | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
defmodule Yodlee.Refresh do | ||
|
||
def begin(creds, account_ids, cobrand_name \\ Yodlee.default_cobrand_name) do | ||
ids_param = cond do | ||
is_list(account_ids) -> Enum.join(account_ids, ",") | ||
true -> Enum.join([account_ids], ",") | ||
end | ||
Yodlee.make_authenticated_request(creds, "post", "#{cobrand_name}/v1/refresh", %{ | ||
"accountIds" => ids_param | ||
}) | ||
end | ||
|
||
def begin!(creds, account_ids, cobrand_name \\ Yodlee.default_cobrand_name) do | ||
Yodlee.throw_on_fail fn -> | ||
begin(creds, account_ids, cobrand_name) | ||
end | ||
end | ||
|
||
def get_pending_account_status(creds, provider_account_id, cobrand_name \\ Yodlee.default_cobrand_name) do | ||
Yodlee.make_authenticated_request(creds, "get", "#{cobrand_name}/v1/refresh/#{provider_account_id}") | ||
end | ||
|
||
def get_pending_account_status!(creds, provider_account_id, cobrand_name \\ Yodlee.default_cobrand_name) do | ||
Yodlee.throw_on_fail fn -> | ||
get_pending_account_status(creds, provider_account_id, cobrand_name) | ||
end | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters