Module: Unit::Account::Credit
- Defined in:
- lib/unit/models/account/account.rb,
lib/unit/models/account/credit/list_account_params.rb,
lib/unit/models/account/credit/close_account_request.rb,
lib/unit/models/account/credit/patch_account_request.rb,
lib/unit/models/account/credit/create_account_request.rb,
lib/unit/models/account/credit/freeze_account_request.rb,
lib/unit/models/account/credit/balance_history_request.rb
Defined Under Namespace
Classes: BalanceHistoryRequest, CloseAccountRequest, CreateAccountRequest, FreezeAccountRequest, ListAccountParams, PatchAccountRequest
Constant Summary collapse
- ACCOUNT_LIST_LIMIT =
100
- ACCOUNT_LIST_OFFSET =
0
- BALANCE_HISTORY_LIMIT =
100
- BALANCE_HISTORY_OFFSET =
0
Class Method Summary collapse
-
.close_credit_account(account_id:, reason:, fraud_reason: nil) ⇒ Object
Close a credit account.
-
.create_credit_account(credit_terms:, credit_limit:, customer_id: nil, tags: nil, idempotency_key: nil) ⇒ Object
Create a credit account.
-
.freeze_credit_account(account_id:, reason:, reason_text: nil) ⇒ Object
Freeze credit account.
-
.get_balance_history(limit = BALANCE_HISTORY_LIMIT, offset = BALANCE_HISTORY_OFFSET, account_id: nil, customer_id: nil, since: nil, _until: nil) ⇒ Object
Get account balance history by calling Unit’s API.
-
.get_credit_account(account_id:) ⇒ Object
Get a credit account by id.
-
.limits(account_id:) ⇒ Object
Limit a credit account.
-
.list_credit_accounts(limit: ACCOUNT_LIST_LIMIT, offset: ACCOUNT_LIST_OFFSET, customer_id: nil, tags: nil, status: nil, from_balance: nil, to_balance: nil, include: nil, type: nil) ⇒ Object
List credit accounts by calling Unit’s API.
-
.unfreeze_credit_account(account_id:) ⇒ Object
Unfreeze credit account.
-
.update_credit_account(account_id:, tags: nil, credit_limit: nil) ⇒ Object
Update a credit account by calling Unit’s API.
Class Method Details
.close_credit_account(account_id:, reason:, fraud_reason: nil) ⇒ Object
Close a credit account
187 188 189 190 |
# File 'lib/unit/models/account/account.rb', line 187 def close_credit_account(account_id:, reason:, fraud_reason: nil) request = CloseAccountRequest.new(account_id, reason, fraud_reason) Unit::Resource::AccountResource.close_account(request) end |
.create_credit_account(credit_terms:, credit_limit:, customer_id: nil, tags: nil, idempotency_key: nil) ⇒ Object
Create a credit account
177 178 179 180 |
# File 'lib/unit/models/account/account.rb', line 177 def create_credit_account(credit_terms:, credit_limit:, customer_id: nil, tags: nil, idempotency_key: nil) request = CreateAccountRequest.new(credit_terms, credit_limit, customer_id, , idempotency_key) Unit::Resource::AccountResource.create_account(request) end |
.freeze_credit_account(account_id:, reason:, reason_text: nil) ⇒ Object
Freeze credit account
204 205 206 207 |
# File 'lib/unit/models/account/account.rb', line 204 def freeze_credit_account(account_id:, reason:, reason_text: nil) request = FreezeAccountRequest.new(account_id, reason, reason_text) Unit::Resource::AccountResource.freeze_account(request) end |
.get_balance_history(limit = BALANCE_HISTORY_LIMIT, offset = BALANCE_HISTORY_OFFSET, account_id: nil, customer_id: nil, since: nil, _until: nil) ⇒ Object
Get account balance history by calling Unit’s API
257 258 259 260 261 |
# File 'lib/unit/models/account/account.rb', line 257 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, account_id, customer_id, since, _until) Unit::Resource::AccountResource.get_account_balance_history(request) end |
.get_credit_account(account_id:) ⇒ Object
Get a credit account by id
195 196 197 |
# File 'lib/unit/models/account/account.rb', line 195 def get_credit_account(account_id:) Unit::Resource::AccountResource.get_account(account_id) end |
.limits(account_id:) ⇒ Object
Limit a credit account
245 246 247 |
# File 'lib/unit/models/account/account.rb', line 245 def limits(account_id:) Unit::Resource::AccountResource.limits(account_id) end |
.list_credit_accounts(limit: ACCOUNT_LIST_LIMIT, offset: ACCOUNT_LIST_OFFSET, customer_id: nil, tags: nil, status: nil, from_balance: nil, to_balance: nil, include: nil, type: nil) ⇒ Object
List credit accounts by calling Unit’s API
227 228 229 230 231 |
# File 'lib/unit/models/account/account.rb', line 227 def list_credit_accounts(limit: ACCOUNT_LIST_LIMIT, offset: ACCOUNT_LIST_OFFSET, customer_id: nil, tags: nil, status: nil, from_balance: nil, to_balance: nil, include: nil, type: nil) request = ListAccountParams.new(limit, offset, customer_id, , status, from_balance, to_balance, include, type) Unit::Resource::AccountResource.list_accounts(request) end |
.unfreeze_credit_account(account_id:) ⇒ Object
Unfreeze credit account
212 213 214 |
# File 'lib/unit/models/account/account.rb', line 212 def unfreeze_credit_account(account_id:) Unit::Resource::AccountResource.unfreeze_account(account_id) end |
.update_credit_account(account_id:, tags: nil, credit_limit: nil) ⇒ Object
Update a credit account by calling Unit’s API
237 238 239 240 |
# File 'lib/unit/models/account/account.rb', line 237 def update_credit_account(account_id:, tags: nil, credit_limit: nil) request = PatchAccountRequest.new(account_id, , credit_limit) Unit::Resource::AccountResource.update_account(request) end |