Module: Unit::Account::Deposit

Defined in:
lib/unit/models/account/account.rb,
lib/unit/models/account/deposit/list_account_params.rb,
lib/unit/models/account/deposit/account_owners_request.rb,
lib/unit/models/account/deposit/freeze_account_request.rb,
lib/unit/models/account/deposit/balance_history_request.rb,
lib/unit/models/account/deposit/close_deposit_account_request.rb,
lib/unit/models/account/deposit/patch_deposit_account_request.rb,
lib/unit/models/account/deposit/create_deposit_account_request.rb

Defined Under Namespace

Classes: AccountOwnersRequest, BalanceHistoryRequest, CloseDepositAccountRequest, CreateDepositAccountRequest, FreezeAccountRequest, ListAccountParams, PatchDepositAccountRequest

Constant Summary collapse

ACCOUNT_LIST_LIMIT =
100
ACCOUNT_LIST_OFFSET =
0
BALANCE_HISTORY_LIMIT =
100
BALANCE_HISTORY_OFFSET =
0

Class Method Summary collapse

Class Method Details

.add_owners(account_id:, customers:) ⇒ UnitResponse, UnitError

Add account owners by calling Unit’s API

Parameters:

  • account_id (String)
  • customers (Array<String>)

Returns:

See Also:



140
141
142
143
# File 'lib/unit/models/account/account.rb', line 140

def add_owners(account_id:, customers:)
  request = AccountOwnersRequest.new(, customers)
  Unit::Resource::AccountResource.add_owners(request)
end

.close_deposit_account(account_id:, reason:, fraud_reason: nil) ⇒ UnitResponse, UnitError

Close deposit account

Parameters:

  • account_id (String)
  • reason (String)
  • fraud_reason (String) (defaults to: nil)
    • optional

Returns:

See Also:



37
38
39
40
# File 'lib/unit/models/account/account.rb', line 37

def (account_id:, reason:, fraud_reason: nil)
  request = CloseDepositAccountRequest.new(, reason, fraud_reason)
  Unit::Resource::AccountResource.(request)
end

.create_deposit_account(deposit_product:, tags: nil, relationships: nil, idempotency_key: nil) ⇒ UnitResponse, UnitError

Create a deposit account

Parameters:

  • deposit_product (String)
  • tags (Hash) (defaults to: nil)
    • optional

  • idempotency_key (String) (defaults to: nil)
    • optional

  • relationships (Relationships, RelationshipArray) (defaults to: nil)
    • optional

Returns:

See Also:



26
27
28
29
# File 'lib/unit/models/account/account.rb', line 26

def (deposit_product:, tags: nil, relationships: nil, idempotency_key: nil)
  request = CreateDepositAccountRequest.new(deposit_product, tags, relationships, idempotency_key)
  Unit::Resource::AccountResource.(request)
end

.freeze_account(account_id:, reason:, reason_text: nil) ⇒ UnitResponse, UnitError

Freeze deposit account

Parameters:

  • account_id (String)
  • reason (String)
  • reason_text (String) (defaults to: nil)
    • optional

Returns:

See Also:



63
64
65
66
# File 'lib/unit/models/account/account.rb', line 63

def (account_id:, reason:, reason_text: nil)
  request = FreezeAccountRequest.new(, reason, reason_text)
  Unit::Resource::AccountResource.(request)
end

.get_balance_history(limit = BALANCE_HISTORY_LIMIT, offset = BALANCE_HISTORY_OFFSET, account_id: nil, customer_id: nil, since: nil, _until: nil) ⇒ UnitResponse, UnitError

Get account balance history by calling Unit’s API

Parameters:

  • limit (Integer) (defaults to: BALANCE_HISTORY_LIMIT)
    • optional

  • offset (Integer) (defaults to: BALANCE_HISTORY_OFFSET)
    • optional

  • account_id (String) (defaults to: nil)
    • optional

  • customer_id (String) (defaults to: nil)
    • optional

  • since (String) (defaults to: nil)
    • optional

  • _until (String) (defaults to: nil)
    • optional

Returns:

See Also:



129
130
131
132
133
# File 'lib/unit/models/account/account.rb', line 129

def get_balance_history(limit = BALANCE_HISTORY_LIMIT, offset = BALANCE_HISTORY_OFFSET, account_id: nil, customer_id: nil,
                        since: nil, _until: nil)
  request = BalanceHistoryRequest.new(limit, offset, , customer_id, since, _until)
  Unit::Resource::AccountResource.(request)
end

.get_deposit_account(account_id:) ⇒ Object

Get a deposit account by id

Parameters:

  • account_id (String)

See Also:



53
54
55
# File 'lib/unit/models/account/account.rb', line 53

def (account_id:)
  Unit::Resource::AccountResource.()
end

.get_deposit_products(account_id:) ⇒ UnitResponse, UnitError

Get deposit products

Parameters:

  • account_id (String)

Returns:

See Also:



116
117
118
# File 'lib/unit/models/account/account.rb', line 116

def get_deposit_products(account_id:)
  Unit::Resource::AccountResource.get_deposit_products()
end

.limits(account_id:) ⇒ UnitResponse, UnitError

Limit a deposit account

Parameters:

  • account_id (String)

Returns:

See Also:



108
109
110
# File 'lib/unit/models/account/account.rb', line 108

def limits(account_id:)
  Unit::Resource::AccountResource.limits()
end

.list_deposit_accounts(limit: ACCOUNT_LIST_LIMIT, offset: ACCOUNT_LIST_OFFSET, customer_id: nil, tags: nil, status: nil, from_balance: nil, to_balance: nil, include: nil) ⇒ UnitResponse, UnitError

Listing deposit accounts

Parameters:

  • limit (Integer) (defaults to: ACCOUNT_LIST_LIMIT)
    • optional

  • offset (Integer) (defaults to: ACCOUNT_LIST_OFFSET)
    • optional

  • customer_id (String) (defaults to: nil)
    • optional

  • tags (Hash) (defaults to: nil)
    • optional

  • status (String) (defaults to: nil)
    • optional

  • from_balance (Integer) (defaults to: nil)
    • optional

  • to_balance (Integer) (defaults to: nil)
    • optional

  • include (String) (defaults to: nil)
    • optional

Returns:

See Also:



87
88
89
90
91
# File 'lib/unit/models/account/account.rb', line 87

def list_deposit_accounts(limit: ACCOUNT_LIST_LIMIT, offset: ACCOUNT_LIST_OFFSET, customer_id: nil, tags: nil,
                          status: nil, from_balance: nil, to_balance: nil, include: nil)
  request = ListAccountParams.new(limit, offset, customer_id, tags, status, from_balance, to_balance, include)
  Unit::Resource::AccountResource.list_accounts(request)
end

.remove_owners(account_id:, customers:) ⇒ UnitResponse, UnitError

Remove account owners by calling Unit’s API

Parameters:

  • account_id (String)
  • customers (Array<Customer>)

Returns:

See Also:



150
151
152
153
# File 'lib/unit/models/account/account.rb', line 150

def remove_owners(account_id:, customers:)
  request = AccountOwnersRequest.new(, customers)
  Unit::Resource::AccountResource.remove_owners(request)
end

.reopen_account(account_id:) ⇒ Object

Reopen deposit account

Parameters:

  • account_id (String)
  • reason (String)

See Also:



46
47
48
# File 'lib/unit/models/account/account.rb', line 46

def (account_id:)
  Unit::Resource::AccountResource.()
end

.unfreeze_account(account_id:) ⇒ UnitResponse, UnitError

Unfreeze deposit account

Parameters:

  • account_id (String)

Returns:

See Also:



72
73
74
# File 'lib/unit/models/account/account.rb', line 72

def (account_id:)
  Unit::Resource::AccountResource.()
end

.update_deposit_account(account_id:, tags: nil, deposit_product: nil) ⇒ UnitResponse, UnitError

Update a deposit account

Parameters:

  • account_id (String)
  • tags (Hash) (defaults to: nil)
    • optional

  • deposit_product (String) (defaults to: nil)
    • optional

Returns:

See Also:



99
100
101
102
# File 'lib/unit/models/account/account.rb', line 99

def (account_id:, tags: nil, deposit_product: nil)
  request = PatchDepositAccountRequest.new(, tags, deposit_product)
  Unit::Resource::AccountResource.(request)
end