Class: Inttegro::Resources::Payouts

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

Overview

Payouts resource for configuring and managing automatic balance payouts.

Payouts transfer available balance from Inttegro to your financial accounts. Use this resource to configure payout destinations, manage payout schedules, enable foreign exchange conversion, and retrieve payout history.

Instance Method Summary collapse

Constructor Details

#initialize(http) ⇒ Payouts

Returns a new instance of Payouts.

Parameters:



15
16
17
# File 'lib/inttegro/resources/payouts.rb', line 15

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

Instance Method Details

#cancel(payout_id:) ⇒ Inttegro::Payout

Cancel a scheduled payout before execution.

Only payouts in scheduled status with a future execution time can be canceled.

Parameters:

  • payout_id (String) —

    Scheduled payout ID

Returns:



217
218
219
220
221
222
223
# File 'lib/inttegro/resources/payouts.rb', line 217

def cancel(payout_id:)
  @http.post_resource(
    "/payouts/cancel",
    Inttegro::Payout, :payout,
    { payout_id: payout_id }
  )
end

#disable_automatic ⇒ Inttegro::Payout::SettingsMutation

Disable automatic payouts by switching to manual payout mode.

Disables automatic payouts for your application. When automatic payouts are disabled, the system will not automatically schedule payouts—you must manually trigger them. Balance transactions must still be at least 7 days old before they can be paid out, but the payout will only occur when you explicitly request it.

Examples:

Disable automatic payouts

result = client.payouts.disable_automatic

puts "Schedule type: #{result.schedule&.type}"

Returns:

See Also:



99
100
101
102
103
104
105
# File 'lib/inttegro/resources/payouts.rb', line 99

def disable_automatic
  @http.post_resource(
    "/payouts/disable",
    Inttegro::Payout::SettingsMutation, :settings,
    {}
  )
end

#disable_fx ⇒ Inttegro::Payout::SettingsMutation

Disable foreign exchange conversion for payouts.

Disables FX conversion, restricting payouts to accounts that match the transaction currency. After disabling FX, GHS balance can only be paid out to GHS accounts, USD balance only to USD accounts, etc.

Examples:

Disable foreign exchange for payouts

result = client.payouts.disable_fx

puts "FX enabled: #{result.fx_enabled}"

Returns:

See Also:



157
158
159
# File 'lib/inttegro/resources/payouts.rb', line 157

def disable_fx
  @http.post_resource("/payouts/disable_fx", Inttegro::Payout::SettingsMutation, :settings, {})
end

#enable_automatic ⇒ Inttegro::Payout::SettingsMutation Also known as: enable

Re-enable automatic payouts using the application's retained schedule settings.

Returns:



110
111
112
113
114
115
116
# File 'lib/inttegro/resources/payouts.rb', line 110

def enable_automatic
  @http.post_resource(
    "/payouts/enable",
    Inttegro::Payout::SettingsMutation, :settings,
    {}
  )
end

#enable_fx ⇒ Inttegro::Payout::SettingsMutation

Enable foreign exchange conversion for payouts.

Enables FX conversion for payouts. When FX is enabled, Inttegro can automatically convert payout funds from one currency to another when routing to destination accounts. This allows you to consolidate multiple currencies into a single operating account or hold funds in a preferred currency.

With FX disabled (default), payouts only transfer funds to accounts matching the transaction currency. With FX enabled, GHS balance can be converted and paid out to USD accounts, for example.

Important: FX conversion incurs additional fees beyond standard payout fees, and exchange rates are determined at payout execution time. FX-enabled payouts require approval and special configuration.

Examples:

Enable foreign exchange for payouts

result = client.payouts.enable_fx

puts "FX enabled: #{result.fx_enabled}"

Returns:

See Also:



140
141
142
# File 'lib/inttegro/resources/payouts.rb', line 140

def enable_fx
  @http.post_resource("/payouts/enable_fx", Inttegro::Payout::SettingsMutation, :settings, {})
end

#lookup(payout_id:) ⇒ Inttegro::Payout

Retrieve the current state of one payout.

Parameters:

  • payout_id (String) —

    unique payout identifier

Returns:



202
203
204
205
206
207
208
# File 'lib/inttegro/resources/payouts.rb', line 202

def lookup(payout_id:)
  @http.post_resource(
    "/payouts/lookup",
    Inttegro::Payout, :payout,
    { payout_id: payout_id }
  )
end

#page(payload) ⇒ Inttegro::Payout::Page

Retrieve a paginated list of payouts.

Returns payouts in reverse chronological order (most recent first).

Examples:

Get first page of payouts

result = client.payouts.page(
  Inttegro::Payout::PageRequest.new(page_number: 1, page_size: 25)
)

puts "Retrieved #{result.payouts&.length || 0} payouts"

Parameters:

Returns:

See Also:



178
179
180
# File 'lib/inttegro/resources/payouts.rb', line 178

def page(payload)
  @http.post_resource("/payouts/page", Inttegro::Payout::Page, :page, payload)
end

#schedule(payload) ⇒ Inttegro::Payout

Schedule a payout from the application's available balance.

Parameters:

Returns:



194
195
196
# File 'lib/inttegro/resources/payouts.rb', line 194

def schedule(payload)
  @http.post_resource("/payouts/schedule", Inttegro::Payout, :payout, payload)
end

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

Search payouts using indexed fields and full-text matching.

Parameters:

Returns:



186
187
188
# File 'lib/inttegro/resources/payouts.rb', line 186

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

#set_bt_aging_spec(payload) ⇒ Inttegro::Payout::SettingsMutation

Select when balance transactions become eligible for future payouts.

The selected canonical rule must be permitted by the application's operating policy. Changing it does not rewrite payouts that have already been created.

Parameters:

Returns:



63
64
65
# File 'lib/inttegro/resources/payouts.rb', line 63

def set_bt_aging_spec(payload)
  @http.post_resource("/payouts/set_bt_aging_spec", Inttegro::Payout::SettingsMutation, :settings, payload)
end

#set_destinations(destinations:) ⇒ Inttegro::Payout::SettingsMutation

Configure which financial account should be used for payouts in each currency.

Sets the supported GHS payout destination. The financial account must be owned by your application, have push operations enabled, and use Ghana cedi.

Examples:

Set the GHS payout destination

result = client.payouts.set_destinations(
  destinations: Inttegro::Payout::Destinations.new(ghs: "fa_1234567890abcdef")
)

puts "Destinations configured: #{result.destinations}"

Parameters:

Returns:

See Also:



36
37
38
39
40
41
42
# File 'lib/inttegro/resources/payouts.rb', line 36

def set_destinations(destinations:)
  @http.post_resource(
    "/payouts/set_destinations",
    Inttegro::Payout::SettingsMutation, :settings,
    { destinations: destinations }
  )
end

#set_limits(payload) ⇒ Inttegro::Payout::SettingsMutation

Update the inclusive payout amount range for GHS.

Amounts are integral minor units, so 25_000 represents GHS 250.00. The minimum must not exceed the maximum, and both values must be permitted by the application's operating policy.

Parameters:

Returns:



52
53
54
# File 'lib/inttegro/resources/payouts.rb', line 52

def set_limits(payload)
  @http.post_resource("/payouts/set_limits", Inttegro::Payout::SettingsMutation, :settings, payload)
end

#settings ⇒ Inttegro::Payout::SettingsLookup

Retrieve the current payout settings for your application.

Returns payout settings including configured payout destinations, schedule information, and whether foreign exchange is enabled.

Examples:

Get payout settings

result = client.payouts.settings

puts "Payout schedule: #{result.schedule&.name}"

Returns:

See Also:



80
81
82
# File 'lib/inttegro/resources/payouts.rb', line 80

def settings
  @http.post_resource("/payouts/settings", Inttegro::Payout::SettingsLookup, :settings, {})
end