Class: Inttegro::Resources::FinancialAccounts

Inherits:
Object
  • Object
show all
Defined in:
lib/inttegro/resources/financial_accounts.rb

Overview

Client for financial accounts used for supported collections and payouts.

Access this resource through Client#financial_accounts.

Instance Method Summary collapse

Constructor Details

#initialize(http) ⇒ FinancialAccounts

Returns a new instance of FinancialAccounts.

Parameters:



11
12
13
# File 'lib/inttegro/resources/financial_accounts.rb', line 11

def initialize(http)
  @http = T.let(http, Inttegro::HTTPClient)
end

Instance Method Details

#connect(payload) ⇒ Inttegro::FinancialAccount

Connect an existing financial account for supported collections or payouts.

Parameters:

Returns:



43
44
45
46
47
48
49
# File 'lib/inttegro/resources/financial_accounts.rb', line 43

def connect(payload)
  @http.post_resource(
    "/financial_accounts/connect",
    Inttegro::FinancialAccount, :account,
    payload
  )
end

#create(payload) ⇒ Inttegro::FinancialAccount

Create a wallet, Ghana bank account, or Dosh account managed through Inttegro.

Parameters:

Returns:



19
20
21
22
23
24
25
# File 'lib/inttegro/resources/financial_accounts.rb', line 19

def create(payload)
  @http.post_resource(
    "/financial_accounts/create",
    Inttegro::FinancialAccount, :account,
    payload
  )
end

#disable_pull(account_id:) ⇒ Inttegro::FinancialAccount

Stop supported charges from pulling funds from the account.

Parameters:

  • account_id (String) —

    unique financial account identifier

Returns:



130
131
132
133
134
135
136
# File 'lib/inttegro/resources/financial_accounts.rb', line 130

def disable_pull(account_id:)
  @http.post_resource(
    "/financial_accounts/disable_pull",
    Inttegro::FinancialAccount, :account,
    { account_id:  }
  )
end

#disable_push(account_id:, unset_as_payout_destination: nil) ⇒ Inttegro::FinancialAccount

Stop the account from receiving supported payouts and transfers.

Parameters:

  • account_id (String) —

    unique financial account identifier

  • unset_as_payout_destination (Boolean, nil) (defaults to: nil) —

    whether to remove this account from payout destinations

Returns:



104
105
106
107
108
109
110
111
112
# File 'lib/inttegro/resources/financial_accounts.rb', line 104

def disable_push(account_id:, unset_as_payout_destination: nil)
  payload = { account_id:  }
  payload[:unset_as_payout_destination] = unset_as_payout_destination unless unset_as_payout_destination.nil?
  @http.post_resource(
    "/financial_accounts/disable_push",
    Inttegro::FinancialAccount, :account,
    payload
  )
end

#disconnect(account_id:, unset_as_payout_destination: nil) ⇒ Inttegro::FinancialAccount

Disconnect an account from new Inttegro activity.

Parameters:

  • account_id (String) —

    unique financial account identifier

  • unset_as_payout_destination (Boolean, nil) (defaults to: nil) —

    whether to remove this account from payout destinations

Returns:



143
144
145
146
147
148
149
150
151
# File 'lib/inttegro/resources/financial_accounts.rb', line 143

def disconnect(account_id:, unset_as_payout_destination: nil)
  payload = { account_id:  }
  payload[:unset_as_payout_destination] = unset_as_payout_destination unless unset_as_payout_destination.nil?
  @http.post_resource(
    "/financial_accounts/disconnect",
    Inttegro::FinancialAccount, :account,
    payload
  )
end

#enable_pull(account_id:) ⇒ Inttegro::FinancialAccount

Allow supported charges to pull funds from the account.

Parameters:

  • account_id (String) —

    unique financial account identifier

Returns:



118
119
120
121
122
123
124
# File 'lib/inttegro/resources/financial_accounts.rb', line 118

def enable_pull(account_id:)
  @http.post_resource(
    "/financial_accounts/enable_pull",
    Inttegro::FinancialAccount, :account,
    { account_id:  }
  )
end

#enable_push(account_id:) ⇒ Inttegro::FinancialAccount

Allow the account to receive supported payouts and transfers.

Parameters:

  • account_id (String) —

    unique financial account identifier

Returns:



91
92
93
94
95
96
97
# File 'lib/inttegro/resources/financial_accounts.rb', line 91

def enable_push(account_id:)
  @http.post_resource(
    "/financial_accounts/enable_push",
    Inttegro::FinancialAccount, :account,
    { account_id:  }
  )
end

#lookup(account_id:) ⇒ Inttegro::FinancialAccount

Retrieve a financial account by identifier.

Parameters:

  • account_id (String) —

    unique financial account identifier

Returns:



31
32
33
34
35
36
37
# File 'lib/inttegro/resources/financial_accounts.rb', line 31

def lookup(account_id:)
  @http.post_resource(
    "/financial_accounts/lookup",
    Inttegro::FinancialAccount, :account,
    { account_id:  }
  )
end

#page(payload = {}) ⇒ Inttegro::FinancialAccount::Page

Retrieve a page of financial accounts.

Parameters:

Returns:



55
56
57
58
59
60
61
# File 'lib/inttegro/resources/financial_accounts.rb', line 55

def page(payload = {})
  @http.post_resource(
    "/financial_accounts/page",
    Inttegro::FinancialAccount::Page, :page,
    payload || {}
  )
end

#reconnect(account_id:) ⇒ Inttegro::FinancialAccount

Reconnect a previously disconnected financial account.

Parameters:

  • account_id (String) —

    unique financial account identifier

Returns:



157
158
159
160
161
162
163
# File 'lib/inttegro/resources/financial_accounts.rb', line 157

def reconnect(account_id:)
  @http.post_resource(
    "/financial_accounts/reconnect",
    Inttegro::FinancialAccount, :account,
    { account_id:  }
  )
end

#search(payload) ⇒ Inttegro::Search::Page

Search financial accounts using indexed fields and full-text matching.

Parameters:

Returns:



67
68
69
70
71
72
73
# File 'lib/inttegro/resources/financial_accounts.rb', line 67

def search(payload)
  @http.post_resource(
    "/financial_accounts/search",
    Inttegro::Search::Page, :search,
    payload
  )
end

#update(payload) ⇒ Inttegro::FinancialAccount

Update mutable account profile fields.

Parameters:

Returns:



79
80
81
82
83
84
85
# File 'lib/inttegro/resources/financial_accounts.rb', line 79

def update(payload)
  @http.post_resource(
    "/financial_accounts/update",
    Inttegro::FinancialAccount, :account,
    payload
  )
end