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:



194
195
196
197
198
199
200
# File 'lib/inttegro/resources/payouts.rb', line 194

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:



76
77
78
79
80
81
82
# File 'lib/inttegro/resources/payouts.rb', line 76

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:



134
135
136
# File 'lib/inttegro/resources/payouts.rb', line 134

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:



87
88
89
90
91
92
93
# File 'lib/inttegro/resources/payouts.rb', line 87

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:



117
118
119
# File 'lib/inttegro/resources/payouts.rb', line 117

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:



179
180
181
182
183
184
185
# File 'lib/inttegro/resources/payouts.rb', line 179

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:



155
156
157
# File 'lib/inttegro/resources/payouts.rb', line 155

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:



171
172
173
# File 'lib/inttegro/resources/payouts.rb', line 171

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:



163
164
165
# File 'lib/inttegro/resources/payouts.rb', line 163

def search(payload)
  @http.post_resource("/payouts/search", Inttegro::Search::Page, :search, 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

#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:



57
58
59
# File 'lib/inttegro/resources/payouts.rb', line 57

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