inttegro 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.dockerignore +9 -0
- data/CHANGELOG.md +17 -0
- data/Dockerfile +23 -0
- data/LICENSE +21 -0
- data/README.md +104 -0
- data/Rakefile +50 -0
- data/lib/inttegro/client.rb +159 -0
- data/lib/inttegro/enums.rb +6 -0
- data/lib/inttegro/errors.rb +128 -0
- data/lib/inttegro/file_download.rb +29 -0
- data/lib/inttegro/generated/enums.rb +693 -0
- data/lib/inttegro/generated/models.rb +3840 -0
- data/lib/inttegro/generated/operations.rb +369 -0
- data/lib/inttegro/http_client.rb +639 -0
- data/lib/inttegro/models.rb +132 -0
- data/lib/inttegro/resources/apps.rb +24 -0
- data/lib/inttegro/resources/balance_transactions.rb +28 -0
- data/lib/inttegro/resources/balances.rb +16 -0
- data/lib/inttegro/resources/broadcasts.rb +28 -0
- data/lib/inttegro/resources/chimes.rb +32 -0
- data/lib/inttegro/resources/customers.rb +28 -0
- data/lib/inttegro/resources/file_links.rb +50 -0
- data/lib/inttegro/resources/file_references.rb +20 -0
- data/lib/inttegro/resources/files.rb +39 -0
- data/lib/inttegro/resources/financial_accounts.rb +104 -0
- data/lib/inttegro/resources/keys.rb +60 -0
- data/lib/inttegro/resources/message_templates.rb +78 -0
- data/lib/inttegro/resources/orders.rb +422 -0
- data/lib/inttegro/resources/otp.rb +30 -0
- data/lib/inttegro/resources/payment_methods.rb +250 -0
- data/lib/inttegro/resources/payouts.rb +200 -0
- data/lib/inttegro/resources/prices.rb +40 -0
- data/lib/inttegro/resources/products.rb +48 -0
- data/lib/inttegro/resources/purchase_intents.rb +44 -0
- data/lib/inttegro/resources/refunds.rb +36 -0
- data/lib/inttegro/resources/schedules.rb +28 -0
- data/lib/inttegro/resources/spec.rb +16 -0
- data/lib/inttegro/resources/upload_requests.rb +66 -0
- data/lib/inttegro/response_object.rb +86 -0
- data/lib/inttegro/transport_response.rb +65 -0
- data/lib/inttegro/types.rb +32 -0
- data/lib/inttegro/version.rb +6 -0
- data/lib/inttegro.rb +14 -0
- data/rbi/inttegro/generated.rbi +529 -0
- metadata +107 -0
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
# typed: strict
|
|
3
|
+
|
|
4
|
+
module Inttegro
|
|
5
|
+
module Resources
|
|
6
|
+
# Payment Methods resource for tokenizing and managing customer payment instruments.
|
|
7
|
+
#
|
|
8
|
+
# Payment methods are saved payment instruments (mobile money wallets, cards, bank accounts)
|
|
9
|
+
# that customers can reuse across purchases. Use this resource to tokenize new payment methods,
|
|
10
|
+
# verify ownership, and manage the payment method lifecycle.
|
|
11
|
+
#
|
|
12
|
+
# @see https://studio.inttegro.com/payment-methods for detailed guides
|
|
13
|
+
class PaymentMethods
|
|
14
|
+
def initialize(http)
|
|
15
|
+
@http = T.let(http, Inttegro::HTTPClient)
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
# Save a new payment method for a customer without charging it.
|
|
19
|
+
#
|
|
20
|
+
# Tokenizes and stores payment details for future use. Currently supports mobile money wallets.
|
|
21
|
+
# Use this to collect payment details during customer onboarding, let customers save multiple
|
|
22
|
+
# payment instruments, or set up payment methods before subscription billing.
|
|
23
|
+
#
|
|
24
|
+
# After tokenization, you can optionally verify the payment method to confirm customer ownership
|
|
25
|
+
# and enable frictionless charging.
|
|
26
|
+
#
|
|
27
|
+
# @param payload [Hash] Tokenization parameters
|
|
28
|
+
# @option payload [String] :customer_id Customer who will own this payment method (required)
|
|
29
|
+
# @option payload [Hash] :payment_method_data Payment method details (required)
|
|
30
|
+
# @option payload [Boolean] :verify_immediately Send verification OTP immediately (default: false)
|
|
31
|
+
#
|
|
32
|
+
# @return [Inttegro::Models::TokenizePaymentMethodResponse] Tokenized payment method
|
|
33
|
+
#
|
|
34
|
+
# @example Tokenize a mobile money payment method
|
|
35
|
+
# result = client.payment_methods.tokenize(
|
|
36
|
+
# customer_id: 'cu_abc123',
|
|
37
|
+
# payment_method_data: {
|
|
38
|
+
# type: 'mobile_money',
|
|
39
|
+
# mobile_money: {
|
|
40
|
+
# network: 'mtn',
|
|
41
|
+
# account_number: '0544998605'
|
|
42
|
+
# }
|
|
43
|
+
# },
|
|
44
|
+
# verify_immediately: true
|
|
45
|
+
# )
|
|
46
|
+
#
|
|
47
|
+
# puts "Tokenized payment method: #{result.payment_method&.id}"
|
|
48
|
+
#
|
|
49
|
+
# @see https://studio.inttegro.com/charge-repeat-customers for usage guide
|
|
50
|
+
def tokenize(payload)
|
|
51
|
+
@http.post_model(
|
|
52
|
+
"/payment_methods/tokenize",
|
|
53
|
+
Inttegro::Models::TokenizePaymentMethodResponse,
|
|
54
|
+
payload
|
|
55
|
+
)
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
# Send an OTP to confirm customer ownership of a payment method.
|
|
59
|
+
#
|
|
60
|
+
# For mobile money, a 6-digit code is sent via SMS to the registered wallet number. The customer
|
|
61
|
+
# submits the token to complete verification. Verified payment methods can be charged without
|
|
62
|
+
# additional OTP confirmation, meet network provider requirements, and have better authorization rates.
|
|
63
|
+
#
|
|
64
|
+
# @param payment_method_id [String] ID of the payment method to verify (required)
|
|
65
|
+
# @param request_meta [Hash, nil] Request controls such as idempotency_key (optional)
|
|
66
|
+
#
|
|
67
|
+
# @return [Inttegro::Models::PaymentMethodVerificationResponse] Verification details
|
|
68
|
+
#
|
|
69
|
+
# @example Verify a payment method
|
|
70
|
+
# result = client.payment_methods.verify(
|
|
71
|
+
# payment_method_id: 'pm_xyz789'
|
|
72
|
+
# )
|
|
73
|
+
#
|
|
74
|
+
# puts "Verification request: #{result.verification&.request_id}"
|
|
75
|
+
#
|
|
76
|
+
# @see https://studio.inttegro.com/charge-repeat-customers for verification flow
|
|
77
|
+
def verify(payment_method_id:, request_meta: nil)
|
|
78
|
+
@http.post_model(
|
|
79
|
+
"/payment_methods/verify",
|
|
80
|
+
Inttegro::Models::PaymentMethodVerificationResponse,
|
|
81
|
+
{
|
|
82
|
+
payment_method_id: payment_method_id,
|
|
83
|
+
request_meta: request_meta || stable_payment_method_request_meta("verify", payment_method_id)
|
|
84
|
+
}
|
|
85
|
+
)
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
# Submit the OTP received by the customer to complete payment method verification.
|
|
89
|
+
#
|
|
90
|
+
# On success, the payment method's verified flag is set to true. Tokens expire after 8 minutes,
|
|
91
|
+
# and after 5 failed attempts, verification is locked—call verify() again to restart.
|
|
92
|
+
#
|
|
93
|
+
# @param payload [Hash] Confirmation parameters
|
|
94
|
+
# @option payload [String] :payment_method_id ID of the payment method being verified (required)
|
|
95
|
+
# @option payload [String] :token OTP code provided by customer (required, typically 6 digits)
|
|
96
|
+
#
|
|
97
|
+
# @return [Inttegro::Models::PaymentMethodResponse] Verified payment method
|
|
98
|
+
#
|
|
99
|
+
# @example Confirm verification with OTP
|
|
100
|
+
# result = client.payment_methods.confirm_verification(
|
|
101
|
+
# payment_method_id: 'pm_xyz789',
|
|
102
|
+
# token: '123456'
|
|
103
|
+
# )
|
|
104
|
+
#
|
|
105
|
+
# if result.payment_method&.verified_at
|
|
106
|
+
# puts 'Payment method verified successfully!'
|
|
107
|
+
# end
|
|
108
|
+
#
|
|
109
|
+
# @see https://studio.inttegro.com/charge-repeat-customers for verification flow
|
|
110
|
+
def confirm_verification(payload)
|
|
111
|
+
@http.post_model(
|
|
112
|
+
"/payment_methods/confirm_verification",
|
|
113
|
+
Inttegro::Models::LookupPaymentMethodResponse,
|
|
114
|
+
payload
|
|
115
|
+
)
|
|
116
|
+
end
|
|
117
|
+
|
|
118
|
+
# Retrieve details of a saved payment method by its ID.
|
|
119
|
+
#
|
|
120
|
+
# Returns full payment method information including type, verification status, and associated customer.
|
|
121
|
+
# Use this to display saved payment methods to customers or verify payment method status.
|
|
122
|
+
#
|
|
123
|
+
# @param payment_method_id [String] ID of the payment method to retrieve (required)
|
|
124
|
+
#
|
|
125
|
+
# @return [Inttegro::Models::LookupPaymentMethodResponse] Payment method details
|
|
126
|
+
#
|
|
127
|
+
# @example Lookup a payment method
|
|
128
|
+
# result = client.payment_methods.lookup(
|
|
129
|
+
# payment_method_id: 'pm_xyz789'
|
|
130
|
+
# )
|
|
131
|
+
#
|
|
132
|
+
# puts "Payment method type: #{result.payment_method&.type&.serialize}"
|
|
133
|
+
#
|
|
134
|
+
# @see https://studio.inttegro.com/payment-methods for API reference
|
|
135
|
+
def lookup(payment_method_id:)
|
|
136
|
+
@http.post_model(
|
|
137
|
+
"/payment_methods/lookup",
|
|
138
|
+
Inttegro::Models::LookupPaymentMethodResponse,
|
|
139
|
+
{ payment_method_id: payment_method_id }
|
|
140
|
+
)
|
|
141
|
+
end
|
|
142
|
+
|
|
143
|
+
def page(payload = {})
|
|
144
|
+
@http.post_model(
|
|
145
|
+
"/payment_methods/page",
|
|
146
|
+
Inttegro::Models::PaymentMethodPageResponse,
|
|
147
|
+
payload || {}
|
|
148
|
+
)
|
|
149
|
+
end
|
|
150
|
+
|
|
151
|
+
def update(payload)
|
|
152
|
+
@http.post_model(
|
|
153
|
+
"/payment_methods/update",
|
|
154
|
+
Inttegro::Models::UpdatePaymentMethodResponse,
|
|
155
|
+
payload
|
|
156
|
+
)
|
|
157
|
+
end
|
|
158
|
+
|
|
159
|
+
def activate(payment_method_id:)
|
|
160
|
+
@http.post_model(
|
|
161
|
+
"/payment_methods/activate",
|
|
162
|
+
Inttegro::Models::ActivatePaymentMethodResponse,
|
|
163
|
+
{ payment_method_id: payment_method_id }
|
|
164
|
+
)
|
|
165
|
+
end
|
|
166
|
+
|
|
167
|
+
def disactivate(payment_method_id:)
|
|
168
|
+
@http.post_model(
|
|
169
|
+
"/payment_methods/disactivate",
|
|
170
|
+
Inttegro::Models::DisactivatePaymentMethodResponse,
|
|
171
|
+
{ payment_method_id: payment_method_id }
|
|
172
|
+
)
|
|
173
|
+
end
|
|
174
|
+
|
|
175
|
+
alias deactivate disactivate
|
|
176
|
+
|
|
177
|
+
def archive(payment_method_id:)
|
|
178
|
+
@http.post_model(
|
|
179
|
+
"/payment_methods/archive",
|
|
180
|
+
Inttegro::Models::ArchivePaymentMethodResponse,
|
|
181
|
+
{ payment_method_id: payment_method_id }
|
|
182
|
+
)
|
|
183
|
+
end
|
|
184
|
+
|
|
185
|
+
def unarchive(payment_method_id:)
|
|
186
|
+
@http.post_model(
|
|
187
|
+
"/payment_methods/unarchive",
|
|
188
|
+
Inttegro::Models::UnarchivePaymentMethodResponse,
|
|
189
|
+
{ payment_method_id: payment_method_id }
|
|
190
|
+
)
|
|
191
|
+
end
|
|
192
|
+
|
|
193
|
+
# Delete a saved payment method, removing it from the customer's account.
|
|
194
|
+
#
|
|
195
|
+
# Permanently deletes the payment method. This action cannot be undone. Use when a customer
|
|
196
|
+
# requests removal of their payment details or when a payment method is no longer valid.
|
|
197
|
+
#
|
|
198
|
+
# @param payment_method_id [String] ID of the payment method to delete (required)
|
|
199
|
+
# @param request_meta [Hash, nil] Request controls such as idempotency_key (optional)
|
|
200
|
+
#
|
|
201
|
+
# @return [Inttegro::Models::PaymentMethodDeleteResponse] Deletion confirmation
|
|
202
|
+
#
|
|
203
|
+
# @example Delete a payment method
|
|
204
|
+
# result = client.payment_methods.delete(
|
|
205
|
+
# payment_method_id: 'pm_xyz789'
|
|
206
|
+
# )
|
|
207
|
+
#
|
|
208
|
+
# puts "Payment method deleted"
|
|
209
|
+
#
|
|
210
|
+
# @see https://studio.inttegro.com/payment-methods for API reference
|
|
211
|
+
def delete(payment_method_id:, request_meta: nil)
|
|
212
|
+
@http.post_model(
|
|
213
|
+
"/payment_methods/delete",
|
|
214
|
+
Inttegro::Models::PaymentMethodDeleteResponse,
|
|
215
|
+
{
|
|
216
|
+
payment_method_id: payment_method_id,
|
|
217
|
+
request_meta: request_meta || stable_payment_method_request_meta("delete", payment_method_id)
|
|
218
|
+
}
|
|
219
|
+
)
|
|
220
|
+
end
|
|
221
|
+
|
|
222
|
+
# Get configuration settings for payment methods in your application.
|
|
223
|
+
#
|
|
224
|
+
# Returns settings that control payment method behavior, including whether verification
|
|
225
|
+
# is required before charging and supported payment method types.
|
|
226
|
+
#
|
|
227
|
+
# @return [Inttegro::Models::GetPaymentMethodSettingsResponse] Payment method settings
|
|
228
|
+
#
|
|
229
|
+
# @example Get payment method settings
|
|
230
|
+
# result = client.payment_methods.settings
|
|
231
|
+
#
|
|
232
|
+
# puts "Mobile money enabled: #{result.settings&.mobile_money&.enabled}"
|
|
233
|
+
#
|
|
234
|
+
# @see https://studio.inttegro.com/payment-methods for API reference
|
|
235
|
+
def settings
|
|
236
|
+
@http.post_model(
|
|
237
|
+
"/payment_methods/settings",
|
|
238
|
+
Inttegro::Models::GetPaymentMethodSettingsResponse,
|
|
239
|
+
{}
|
|
240
|
+
)
|
|
241
|
+
end
|
|
242
|
+
|
|
243
|
+
private
|
|
244
|
+
|
|
245
|
+
def stable_payment_method_request_meta(action, payment_method_id)
|
|
246
|
+
{ idempotency_key: "payment_methods_#{action}_#{payment_method_id}" }
|
|
247
|
+
end
|
|
248
|
+
end
|
|
249
|
+
end
|
|
250
|
+
end
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
# typed: strict
|
|
3
|
+
|
|
4
|
+
module Inttegro
|
|
5
|
+
module Resources
|
|
6
|
+
# Payouts resource for configuring and managing automatic balance payouts.
|
|
7
|
+
#
|
|
8
|
+
# Payouts transfer available balance from Inttegro to your financial accounts. Use this resource
|
|
9
|
+
# to configure payout destinations, manage payout schedules, enable foreign exchange conversion,
|
|
10
|
+
# and retrieve payout history.
|
|
11
|
+
#
|
|
12
|
+
# @see https://studio.inttegro.com/payouts for detailed guides
|
|
13
|
+
class Payouts
|
|
14
|
+
def initialize(http)
|
|
15
|
+
@http = T.let(http, Inttegro::HTTPClient)
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
# Configure which financial account should be used for payouts in each currency.
|
|
19
|
+
#
|
|
20
|
+
# Sets payout destinations by mapping currency codes to financial account IDs. Each financial
|
|
21
|
+
# account must be owned by your application, have push operations enabled, and its currency
|
|
22
|
+
# must match the currency key in the destinations map.
|
|
23
|
+
#
|
|
24
|
+
# @param destinations [Hash] Map of currency codes to financial account IDs (required)
|
|
25
|
+
#
|
|
26
|
+
# @return [Inttegro::Models::SetPayoutDestinationsResponse] Updated payout settings
|
|
27
|
+
#
|
|
28
|
+
# @example Set payout destinations for multiple currencies
|
|
29
|
+
# result = client.payouts.set_destinations(
|
|
30
|
+
# destinations: {
|
|
31
|
+
# 'ghs' => 'fa_1234567890abcdef',
|
|
32
|
+
# 'usd' => 'fa_0987654321fedcba'
|
|
33
|
+
# }
|
|
34
|
+
# )
|
|
35
|
+
#
|
|
36
|
+
# puts "Destinations configured: #{result.settings&.destinations}"
|
|
37
|
+
#
|
|
38
|
+
# @see https://studio.inttegro.com/enable-automatic-payouts for configuration guide
|
|
39
|
+
def set_destinations(destinations:)
|
|
40
|
+
@http.post_model(
|
|
41
|
+
"/payouts/set_destinations",
|
|
42
|
+
Inttegro::Models::SetPayoutDestinationsResponse,
|
|
43
|
+
{ destinations: destinations }
|
|
44
|
+
)
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
# Retrieve the current payout settings for your application.
|
|
48
|
+
#
|
|
49
|
+
# Returns payout settings including configured payout destinations, schedule information,
|
|
50
|
+
# and whether foreign exchange is enabled.
|
|
51
|
+
#
|
|
52
|
+
# @return [Inttegro::Models::GetPayoutSettingsResponse] Current payout settings
|
|
53
|
+
#
|
|
54
|
+
# @example Get payout settings
|
|
55
|
+
# result = client.payouts.settings
|
|
56
|
+
#
|
|
57
|
+
# puts "Payout schedule: #{result.settings&.schedule&.name}"
|
|
58
|
+
#
|
|
59
|
+
# @see https://studio.inttegro.com/product-payouts for payouts overview
|
|
60
|
+
def settings
|
|
61
|
+
@http.post_model("/payouts/settings", Inttegro::Models::GetPayoutSettingsResponse, {})
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
# Disable automatic payouts by switching to manual payout mode.
|
|
65
|
+
#
|
|
66
|
+
# Disables automatic payouts for your application. When automatic payouts are disabled, the system
|
|
67
|
+
# will not automatically schedule payouts—you must manually trigger them. Balance transactions must
|
|
68
|
+
# still be at least 7 days old before they can be paid out, but the payout will only occur when you
|
|
69
|
+
# explicitly request it.
|
|
70
|
+
#
|
|
71
|
+
# @return [Inttegro::Models::DisableAutomaticPayoutsResponse] Updated payout settings
|
|
72
|
+
#
|
|
73
|
+
# @example Disable automatic payouts
|
|
74
|
+
# result = client.payouts.disable_automatic
|
|
75
|
+
#
|
|
76
|
+
# puts "Schedule type: #{result.settings&.schedule&.type}"
|
|
77
|
+
#
|
|
78
|
+
# @see https://studio.inttegro.com/disable-automatic-payouts for manual payout guide
|
|
79
|
+
def disable_automatic
|
|
80
|
+
@http.post_model(
|
|
81
|
+
"/payouts/disable",
|
|
82
|
+
Inttegro::Models::DisableAutomaticPayoutsResponse,
|
|
83
|
+
{}
|
|
84
|
+
)
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
def enable_automatic
|
|
88
|
+
@http.post_model(
|
|
89
|
+
"/payouts/enable",
|
|
90
|
+
Inttegro::Models::EnableAutomaticPayoutsResponse,
|
|
91
|
+
{}
|
|
92
|
+
)
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
alias enable enable_automatic
|
|
96
|
+
|
|
97
|
+
# Enable foreign exchange conversion for payouts.
|
|
98
|
+
#
|
|
99
|
+
# Enables FX conversion for payouts. When FX is enabled, Inttegro can automatically convert payout
|
|
100
|
+
# funds from one currency to another when routing to destination accounts. This allows you to
|
|
101
|
+
# consolidate multiple currencies into a single operating account or hold funds in a preferred currency.
|
|
102
|
+
#
|
|
103
|
+
# With FX disabled (default), payouts only transfer funds to accounts matching the transaction currency.
|
|
104
|
+
# With FX enabled, GHS balance can be converted and paid out to USD accounts, for example.
|
|
105
|
+
#
|
|
106
|
+
# Important: FX conversion incurs additional fees beyond standard payout fees, and exchange rates are
|
|
107
|
+
# determined at payout execution time. FX-enabled payouts require approval and special configuration.
|
|
108
|
+
#
|
|
109
|
+
# @return [Inttegro::Models::PayoutSettingsResponse] Updated payout settings
|
|
110
|
+
#
|
|
111
|
+
# @example Enable foreign exchange for payouts
|
|
112
|
+
# result = client.payouts.enable_fx
|
|
113
|
+
#
|
|
114
|
+
# puts "FX enabled: #{result.settings&.fx_enabled}"
|
|
115
|
+
#
|
|
116
|
+
# @see https://studio.inttegro.com/enable-fx-payouts for FX payout guide
|
|
117
|
+
def enable_fx
|
|
118
|
+
@http.post_model("/payouts/enable_fx", Inttegro::Models::PayoutSettingsResponse, {})
|
|
119
|
+
end
|
|
120
|
+
|
|
121
|
+
# Disable foreign exchange conversion for payouts.
|
|
122
|
+
#
|
|
123
|
+
# Disables FX conversion, restricting payouts to accounts that match the transaction currency.
|
|
124
|
+
# After disabling FX, GHS balance can only be paid out to GHS accounts, USD balance only to USD accounts, etc.
|
|
125
|
+
#
|
|
126
|
+
# @return [Inttegro::Models::PayoutSettingsResponse] Updated payout settings
|
|
127
|
+
#
|
|
128
|
+
# @example Disable foreign exchange for payouts
|
|
129
|
+
# result = client.payouts.disable_fx
|
|
130
|
+
#
|
|
131
|
+
# puts "FX enabled: #{result.settings&.fx_enabled}"
|
|
132
|
+
#
|
|
133
|
+
# @see https://studio.inttegro.com/disable-fx-payouts for FX payout guide
|
|
134
|
+
def disable_fx
|
|
135
|
+
@http.post_model("/payouts/disable_fx", Inttegro::Models::PayoutSettingsResponse, {})
|
|
136
|
+
end
|
|
137
|
+
|
|
138
|
+
# Retrieve a paginated list of payouts.
|
|
139
|
+
#
|
|
140
|
+
# Returns payouts in reverse chronological order (most recent first). Use the has_more field
|
|
141
|
+
# and page parameter to navigate through results. Supports filtering by status and time range.
|
|
142
|
+
#
|
|
143
|
+
# @param payload [Hash] Pagination and filter parameters (optional)
|
|
144
|
+
# @option payload [Integer] :page Page number to retrieve (minimum 1, default: 1)
|
|
145
|
+
# @option payload [Integer] :per_page Number of results per page (minimum 1, maximum 100, default: 10)
|
|
146
|
+
# @option payload [String] :status Filter by payout status (e.g., 'pending', 'paid', 'failed')
|
|
147
|
+
# @option payload [String] :created_after Filter payouts created after this timestamp (ISO 8601)
|
|
148
|
+
# @option payload [String] :created_before Filter payouts created before this timestamp (ISO 8601)
|
|
149
|
+
#
|
|
150
|
+
# @return [Inttegro::Models::PagePayoutsResponse] Paginated list of payouts
|
|
151
|
+
#
|
|
152
|
+
# @example Get first page of payouts
|
|
153
|
+
# result = client.payouts.page(
|
|
154
|
+
# per_page: 25,
|
|
155
|
+
# page: 1
|
|
156
|
+
# )
|
|
157
|
+
#
|
|
158
|
+
# puts "Retrieved #{result.page&.payouts&.length || 0} payouts"
|
|
159
|
+
#
|
|
160
|
+
# @example Filter by status
|
|
161
|
+
# paid_payouts = client.payouts.page(
|
|
162
|
+
# status: 'paid',
|
|
163
|
+
# per_page: 50
|
|
164
|
+
# )
|
|
165
|
+
#
|
|
166
|
+
# @see https://studio.inttegro.com/pagination for pagination guide
|
|
167
|
+
# @see https://studio.inttegro.com/product-payouts for payouts overview
|
|
168
|
+
def page(payload = {})
|
|
169
|
+
@http.post_model("/payouts/page", Inttegro::Models::PagePayoutsResponse, payload || {})
|
|
170
|
+
end
|
|
171
|
+
|
|
172
|
+
def schedule(payload)
|
|
173
|
+
@http.post_model("/payouts/schedule", Inttegro::Models::SchedulePayoutResponse, payload)
|
|
174
|
+
end
|
|
175
|
+
|
|
176
|
+
def lookup(payout_id:)
|
|
177
|
+
@http.post_model(
|
|
178
|
+
"/payouts/lookup",
|
|
179
|
+
Inttegro::Models::LookupPayoutResponse,
|
|
180
|
+
{ payout_id: payout_id }
|
|
181
|
+
)
|
|
182
|
+
end
|
|
183
|
+
|
|
184
|
+
# Cancel a scheduled payout before execution.
|
|
185
|
+
#
|
|
186
|
+
# Only payouts in scheduled status with a future execution time can be canceled.
|
|
187
|
+
#
|
|
188
|
+
# @param payout_id [String] Scheduled payout ID
|
|
189
|
+
#
|
|
190
|
+
# @return [Inttegro::Models::CancelPayoutResponse] Canceled payout
|
|
191
|
+
def cancel(payout_id:)
|
|
192
|
+
@http.post_model(
|
|
193
|
+
"/payouts/cancel",
|
|
194
|
+
Inttegro::Models::CancelPayoutResponse,
|
|
195
|
+
{ payout_id: payout_id }
|
|
196
|
+
)
|
|
197
|
+
end
|
|
198
|
+
end
|
|
199
|
+
end
|
|
200
|
+
end
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
# typed: strict
|
|
3
|
+
|
|
4
|
+
module Inttegro
|
|
5
|
+
module Resources
|
|
6
|
+
class Prices
|
|
7
|
+
def initialize(http)
|
|
8
|
+
@http = T.let(http, Inttegro::HTTPClient)
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def create(payload)
|
|
12
|
+
@http.post_model("/prices/create", Inttegro::Models::PriceResponse, payload)
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def lookup(price_id:)
|
|
16
|
+
@http.post_model("/prices/lookup", Inttegro::Models::PriceResponse, { price_id: price_id })
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def page(payload = {})
|
|
20
|
+
@http.post_model("/prices/page", Inttegro::Models::PricePageResponse, payload || {})
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def update(payload)
|
|
24
|
+
@http.post_model("/prices/update", Inttegro::Models::PriceResponse, payload)
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def activate(price_id:)
|
|
28
|
+
@http.post_model("/prices/activate", Inttegro::Models::PriceResponse, { price_id: price_id })
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def deactivate(price_id:)
|
|
32
|
+
@http.post_model("/prices/deactivate", Inttegro::Models::PriceResponse, { price_id: price_id })
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def archive(price_id:)
|
|
36
|
+
@http.post_model("/prices/archive", Inttegro::Models::PriceResponse, { price_id: price_id })
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
end
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
# typed: strict
|
|
3
|
+
|
|
4
|
+
module Inttegro
|
|
5
|
+
module Resources
|
|
6
|
+
class Products
|
|
7
|
+
def initialize(http)
|
|
8
|
+
@http = T.let(http, Inttegro::HTTPClient)
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def create(payload)
|
|
12
|
+
@http.post_model("/products/create", Inttegro::Models::ProductResponse, payload)
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def add_price(payload)
|
|
16
|
+
@http.post_model("/products/add_price", Inttegro::Models::AddProductPriceResponse, payload)
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def set_default_unit_price(payload)
|
|
20
|
+
@http.post_model("/products/set_default_unit_price", Inttegro::Models::ProductResponse, payload)
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def lookup(product_id:)
|
|
24
|
+
@http.post_model("/products/lookup", Inttegro::Models::ProductResponse, { product_id: product_id })
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def update(payload)
|
|
28
|
+
@http.post_model("/products/update", Inttegro::Models::UpdateProductResponse, payload)
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def publish(product_id:)
|
|
32
|
+
@http.post_model("/products/publish", Inttegro::Models::ProductResponse, { product_id: product_id })
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def unpublish(product_id:)
|
|
36
|
+
@http.post_model("/products/unpublish", Inttegro::Models::ProductResponse, { product_id: product_id })
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
def archive(product_id:)
|
|
40
|
+
@http.post_model("/products/archive", Inttegro::Models::ProductResponse, { product_id: product_id })
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
def page(payload = {})
|
|
44
|
+
@http.post_model("/products/page", Inttegro::Models::PageProductsResponse, payload || {})
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
end
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
# typed: strict
|
|
3
|
+
|
|
4
|
+
module Inttegro
|
|
5
|
+
module Resources
|
|
6
|
+
class PurchaseIntents
|
|
7
|
+
def initialize(http)
|
|
8
|
+
@http = T.let(http, Inttegro::HTTPClient)
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def create(payload)
|
|
12
|
+
@http.post_model("/purchase_intents/create", Inttegro::Models::PurchaseIntentResponse, payload)
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def update(payload)
|
|
16
|
+
@http.post_model("/purchase_intents/update", Inttegro::Models::PurchaseIntentResponse, payload)
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def cancel(id:)
|
|
20
|
+
@http.post_model(
|
|
21
|
+
"/purchase_intents/cancel",
|
|
22
|
+
Inttegro::Models::PurchaseIntentResponse,
|
|
23
|
+
{ id: id }
|
|
24
|
+
)
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def lookup(id:)
|
|
28
|
+
@http.post_model(
|
|
29
|
+
"/purchase_intents/lookup",
|
|
30
|
+
Inttegro::Models::PurchaseIntentResponse,
|
|
31
|
+
{ id: id }
|
|
32
|
+
)
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def page(payload = {})
|
|
36
|
+
@http.post_model(
|
|
37
|
+
"/purchase_intents/page",
|
|
38
|
+
Inttegro::Models::PagePurchaseIntentsResponse,
|
|
39
|
+
payload || {}
|
|
40
|
+
)
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
end
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
# typed: strict
|
|
3
|
+
|
|
4
|
+
module Inttegro
|
|
5
|
+
module Resources
|
|
6
|
+
class Refunds
|
|
7
|
+
def initialize(http)
|
|
8
|
+
@http = T.let(http, Inttegro::HTTPClient)
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def create(payload)
|
|
12
|
+
@http.post_model("/refunds/create", Inttegro::Models::RefundResponse, payload)
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def cancel(refund_id:)
|
|
16
|
+
@http.post_model(
|
|
17
|
+
"/refunds/cancel",
|
|
18
|
+
Inttegro::Models::RefundResponse,
|
|
19
|
+
{ refund_id: refund_id }
|
|
20
|
+
)
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def lookup(refund_id:)
|
|
24
|
+
@http.post_model(
|
|
25
|
+
"/refunds/lookup",
|
|
26
|
+
Inttegro::Models::RefundResponse,
|
|
27
|
+
{ refund_id: refund_id }
|
|
28
|
+
)
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def page(payload)
|
|
32
|
+
@http.post_model("/refunds/page", Inttegro::Models::RefundPageResponse, payload)
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
end
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
# typed: strict
|
|
3
|
+
|
|
4
|
+
module Inttegro
|
|
5
|
+
module Resources
|
|
6
|
+
class Schedules
|
|
7
|
+
def initialize(http)
|
|
8
|
+
@http = T.let(http, Inttegro::HTTPClient)
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def lookup(schedule_id:)
|
|
12
|
+
@http.post_model(
|
|
13
|
+
"/schedules/lookup",
|
|
14
|
+
Inttegro::Models::ScheduleLookupResponse,
|
|
15
|
+
{ schedule_id: schedule_id }
|
|
16
|
+
)
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def cancel(schedule_id:)
|
|
20
|
+
@http.post_model(
|
|
21
|
+
"/schedules/cancel",
|
|
22
|
+
Inttegro::Models::ScheduleCancelResponse,
|
|
23
|
+
{ schedule_id: schedule_id }
|
|
24
|
+
)
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
# typed: strict
|
|
3
|
+
|
|
4
|
+
module Inttegro
|
|
5
|
+
module Resources
|
|
6
|
+
class Spec
|
|
7
|
+
def initialize(http)
|
|
8
|
+
@http = T.let(http, Inttegro::HTTPClient)
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def countries
|
|
12
|
+
@http.post_model("/spec/countries", Inttegro::Models::ListCountrySpecsResponse, {})
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|