inttegro 1.0.0 → 3.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 +4 -4
- data/CHANGELOG.md +12 -0
- data/Dockerfile +1 -1
- data/README.md +9 -7
- data/SECURITY.md +11 -0
- data/lib/inttegro/enums.rb +2 -2
- data/lib/inttegro/file_download.rb +1 -1
- data/lib/inttegro/generated/enums.rb +221 -329
- data/lib/inttegro/generated/models.rb +3707 -3830
- data/lib/inttegro/generated/operations.rb +230 -230
- data/lib/inttegro/http_client.rb +62 -5
- data/lib/inttegro/models.rb +54 -105
- data/lib/inttegro/resources/apps.rb +3 -3
- data/lib/inttegro/resources/balance_transactions.rb +2 -6
- data/lib/inttegro/resources/balances.rb +1 -1
- data/lib/inttegro/resources/broadcasts.rb +2 -6
- data/lib/inttegro/resources/chimes.rb +5 -5
- data/lib/inttegro/resources/customers.rb +4 -4
- data/lib/inttegro/resources/file_links.rb +4 -6
- data/lib/inttegro/resources/file_references.rb +1 -1
- data/lib/inttegro/resources/files.rb +4 -6
- data/lib/inttegro/resources/financial_accounts.rb +22 -22
- data/lib/inttegro/resources/keys.rb +8 -10
- data/lib/inttegro/resources/message_templates.rb +13 -15
- data/lib/inttegro/resources/orders.rb +72 -69
- data/lib/inttegro/resources/otp.rb +4 -4
- data/lib/inttegro/resources/payment_methods.rb +34 -36
- data/lib/inttegro/resources/payouts.rb +28 -28
- data/lib/inttegro/resources/prices.rb +7 -7
- data/lib/inttegro/resources/products.rb +9 -9
- data/lib/inttegro/resources/purchase_intents.rb +8 -8
- data/lib/inttegro/resources/refunds.rb +6 -6
- data/lib/inttegro/resources/schedules.rb +4 -4
- data/lib/inttegro/resources/spec.rb +1 -1
- data/lib/inttegro/resources/upload_requests.rb +10 -10
- data/lib/inttegro/response_object.rb +1 -1
- data/lib/inttegro/version.rb +1 -1
- data/lib/inttegro.rb +15 -0
- data/rbi/inttegro/generated.rbi +124 -124
- metadata +3 -2
|
@@ -38,10 +38,10 @@ module Inttegro
|
|
|
38
38
|
# @option payload [String] :statement_descriptor_prefix Static prefix, 2-10 characters, used to build prefix*order_id; mutually exclusive with statement_descriptor
|
|
39
39
|
# @option payload [Boolean] :finalize Whether to explicitly finalize order (default: false)
|
|
40
40
|
#
|
|
41
|
-
# @return [Inttegro::
|
|
41
|
+
# @return [Inttegro::Order] Created order
|
|
42
42
|
#
|
|
43
43
|
# @example Create order with new customer and execute payment
|
|
44
|
-
#
|
|
44
|
+
# order = client.orders.create(
|
|
45
45
|
# request_meta: {
|
|
46
46
|
# idempotency_key: 'order_2025_001'
|
|
47
47
|
# },
|
|
@@ -77,7 +77,7 @@ module Inttegro
|
|
|
77
77
|
# }
|
|
78
78
|
# )
|
|
79
79
|
#
|
|
80
|
-
# puts "Created order: #{
|
|
80
|
+
# puts "Created order: #{order.id}"
|
|
81
81
|
#
|
|
82
82
|
# @example Create order with existing customer
|
|
83
83
|
# result = client.orders.create(
|
|
@@ -100,11 +100,11 @@ module Inttegro
|
|
|
100
100
|
# @see https://studio.inttegro.com/accept-a-payment for payment flow guide
|
|
101
101
|
# @see https://studio.inttegro.com/order-lifecycle for order states
|
|
102
102
|
def create(payload)
|
|
103
|
-
@http.
|
|
103
|
+
@http.post_resource("/orders/create", Inttegro::Order, :order, payload)
|
|
104
104
|
end
|
|
105
105
|
|
|
106
106
|
def new(payload)
|
|
107
|
-
@http.
|
|
107
|
+
@http.post_resource("/orders/new", Inttegro::Order, :order, payload)
|
|
108
108
|
end
|
|
109
109
|
|
|
110
110
|
# Retrieve an existing order by its ID.
|
|
@@ -115,23 +115,23 @@ module Inttegro
|
|
|
115
115
|
# @param order_id [String] Unique identifier of the order to retrieve (required)
|
|
116
116
|
# @param options [Hash] Additional options (currently unused)
|
|
117
117
|
#
|
|
118
|
-
# @return [Inttegro::
|
|
118
|
+
# @return [Inttegro::Order] Complete order object
|
|
119
119
|
#
|
|
120
120
|
# @example Lookup an order
|
|
121
|
-
#
|
|
121
|
+
# order = client.orders.lookup(
|
|
122
122
|
# order_id: 'GKj7A8lM5wEGRUvbqpI4bkDFsQvpqVyh5fqePNnb'
|
|
123
123
|
# )
|
|
124
124
|
#
|
|
125
|
-
# puts "Order status: #{
|
|
125
|
+
# puts "Order status: #{order.status.serialize}"
|
|
126
126
|
#
|
|
127
127
|
# @see https://studio.inttegro.com/orders for API reference
|
|
128
128
|
def lookup(order_id:, **options)
|
|
129
129
|
body = { order_id: order_id }.merge(options)
|
|
130
|
-
@http.
|
|
130
|
+
@http.post_resource("/orders/lookup", Inttegro::Order, :order, body)
|
|
131
131
|
end
|
|
132
132
|
|
|
133
133
|
def update(payload)
|
|
134
|
-
@http.
|
|
134
|
+
@http.post_resource("/orders/update", Inttegro::Order, :order, payload)
|
|
135
135
|
end
|
|
136
136
|
|
|
137
137
|
# Initiate payment for an existing order.
|
|
@@ -141,7 +141,7 @@ module Inttegro
|
|
|
141
141
|
# 2. New payment method: Include payment_method_data with inline payment details
|
|
142
142
|
# 3. Offline payment: Set paid_out_of_band to true for cash, bank transfer, or check payments
|
|
143
143
|
#
|
|
144
|
-
# When payment requires customer confirmation (e.g., OTP), the
|
|
144
|
+
# When payment requires customer confirmation (e.g., OTP), the returned order includes a next_action field.
|
|
145
145
|
#
|
|
146
146
|
# @param payload [Hash] Payment parameters
|
|
147
147
|
# @option payload [String] :order_id Unique identifier of the order to pay (required)
|
|
@@ -149,10 +149,10 @@ module Inttegro
|
|
|
149
149
|
# @option payload [String] :payment_method_id ID of a saved payment method to use
|
|
150
150
|
# @option payload [Boolean] :paid_out_of_band Set to true if payment received outside Inttegro (default: false)
|
|
151
151
|
#
|
|
152
|
-
# @return [Inttegro::
|
|
152
|
+
# @return [Inttegro::Order] Updated order and payment state
|
|
153
153
|
#
|
|
154
154
|
# @example Pay with inline mobile money
|
|
155
|
-
#
|
|
155
|
+
# order = client.orders.pay(
|
|
156
156
|
# order_id: 'GKj7A8lM5wEGRUvbqpI4bkDFsQvpqVyh5fqePNnb',
|
|
157
157
|
# payment_method_data: {
|
|
158
158
|
# type: 'mobile_money',
|
|
@@ -163,8 +163,7 @@ module Inttegro
|
|
|
163
163
|
# }
|
|
164
164
|
# )
|
|
165
165
|
#
|
|
166
|
-
# order
|
|
167
|
-
# if order.payment&.next_action&.type == Inttegro::Enums::PaymentNextActionType::CONFIRM_PAYMENT
|
|
166
|
+
# if order.payment&.next_action&.type == Inttegro::PaymentNextActionType::CONFIRM_PAYMENT
|
|
168
167
|
# # Customer needs to provide OTP sent to their phone
|
|
169
168
|
# puts 'Please enter the OTP sent to your phone'
|
|
170
169
|
# end
|
|
@@ -184,7 +183,7 @@ module Inttegro
|
|
|
184
183
|
# @see https://studio.inttegro.com/accept-a-payment for payment flow guide
|
|
185
184
|
# @see https://studio.inttegro.com/charge-repeat-customers for saved payment methods
|
|
186
185
|
def pay(payload)
|
|
187
|
-
@http.
|
|
186
|
+
@http.post_resource("/orders/pay", Inttegro::Order, :order, payload)
|
|
188
187
|
end
|
|
189
188
|
|
|
190
189
|
# Confirm a pending payment using a verification token (e.g., OTP sent to customer's phone).
|
|
@@ -196,22 +195,21 @@ module Inttegro
|
|
|
196
195
|
# @option payload [String] :order_id Unique identifier of the order being paid (required)
|
|
197
196
|
# @option payload [String] :token Verification token provided by customer (required, typically 6 digits)
|
|
198
197
|
#
|
|
199
|
-
# @return [Inttegro::
|
|
198
|
+
# @return [Inttegro::Order] Updated order with payment status
|
|
200
199
|
#
|
|
201
200
|
# @example Confirm payment with OTP
|
|
202
|
-
#
|
|
201
|
+
# order = client.orders.confirm_payment(
|
|
203
202
|
# order_id: 'GKj7A8lM5wEGRUvbqpI4bkDFsQvpqVyh5fqePNnb',
|
|
204
203
|
# token: '123456'
|
|
205
204
|
# )
|
|
206
205
|
#
|
|
207
|
-
# order
|
|
208
|
-
# if order.payment&.status == Inttegro::Enums::OrderPaymentStatus::PAID
|
|
206
|
+
# if order.payment&.status == Inttegro::OrderPaymentStatus::PAID
|
|
209
207
|
# puts 'Payment confirmed successfully!'
|
|
210
208
|
# end
|
|
211
209
|
#
|
|
212
210
|
# @see https://studio.inttegro.com/accept-a-payment for complete payment flow
|
|
213
211
|
def confirm_payment(payload)
|
|
214
|
-
@http.
|
|
212
|
+
@http.post_resource("/orders/confirm_payment", Inttegro::Order, :order, payload)
|
|
215
213
|
end
|
|
216
214
|
|
|
217
215
|
# Request a new confirmation token to be sent to the customer (e.g., resend OTP).
|
|
@@ -222,7 +220,7 @@ module Inttegro
|
|
|
222
220
|
# @param order_id [String] Unique identifier of the order requiring confirmation (required)
|
|
223
221
|
# @param request_meta [Hash, nil] Request controls such as idempotency_key (optional)
|
|
224
222
|
#
|
|
225
|
-
# @return [Inttegro::
|
|
223
|
+
# @return [Inttegro::Order] Updated order
|
|
226
224
|
#
|
|
227
225
|
# @example Resend OTP to customer
|
|
228
226
|
# result = client.orders.request_confirmation(
|
|
@@ -233,9 +231,10 @@ module Inttegro
|
|
|
233
231
|
#
|
|
234
232
|
# @see https://studio.inttegro.com/accept-a-payment for payment confirmation flow
|
|
235
233
|
def request_confirmation(order_id:, request_meta: nil)
|
|
236
|
-
@http.
|
|
234
|
+
@http.post_resource(
|
|
237
235
|
"/orders/request_confirmation",
|
|
238
|
-
Inttegro::
|
|
236
|
+
Inttegro::Order,
|
|
237
|
+
:order,
|
|
239
238
|
{
|
|
240
239
|
order_id: order_id,
|
|
241
240
|
request_meta: request_meta || stable_order_request_meta("request_confirmation", order_id)
|
|
@@ -251,20 +250,21 @@ module Inttegro
|
|
|
251
250
|
# @param order_id [String] Unique identifier of the order to finalize (required)
|
|
252
251
|
# @param request_meta [Hash, nil] Request controls such as idempotency_key (optional)
|
|
253
252
|
#
|
|
254
|
-
# @return [Inttegro::
|
|
253
|
+
# @return [Inttegro::Order] Finalized order object
|
|
255
254
|
#
|
|
256
255
|
# @example Finalize an order
|
|
257
|
-
#
|
|
256
|
+
# order = client.orders.finalize(
|
|
258
257
|
# order_id: 'GKj7A8lM5wEGRUvbqpI4bkDFsQvpqVyh5fqePNnb'
|
|
259
258
|
# )
|
|
260
259
|
#
|
|
261
|
-
# puts "Order finalized at: #{
|
|
260
|
+
# puts "Order finalized at: #{order.sealed_at}"
|
|
262
261
|
#
|
|
263
262
|
# @see https://studio.inttegro.com/order-lifecycle for order states
|
|
264
263
|
def finalize(order_id:, request_meta: nil)
|
|
265
|
-
@http.
|
|
264
|
+
@http.post_resource(
|
|
266
265
|
"/orders/finalize",
|
|
267
|
-
Inttegro::
|
|
266
|
+
Inttegro::Order,
|
|
267
|
+
:order,
|
|
268
268
|
{
|
|
269
269
|
order_id: order_id,
|
|
270
270
|
request_meta: request_meta || stable_order_request_meta("finalize", order_id)
|
|
@@ -276,11 +276,11 @@ module Inttegro
|
|
|
276
276
|
#
|
|
277
277
|
# @param order_id [String] Unique identifier of the order whose invoice should be sent (required)
|
|
278
278
|
#
|
|
279
|
-
# @return [Inttegro::
|
|
279
|
+
# @return [Inttegro::OrderDocumentDeliveryResult] Order and delivery details
|
|
280
280
|
def send_invoice(order_id:)
|
|
281
281
|
@http.post_model(
|
|
282
282
|
"/orders/send_invoice",
|
|
283
|
-
Inttegro::
|
|
283
|
+
Inttegro::OrderDocumentDeliveryResult,
|
|
284
284
|
{ order_id: order_id }
|
|
285
285
|
)
|
|
286
286
|
end
|
|
@@ -289,11 +289,11 @@ module Inttegro
|
|
|
289
289
|
#
|
|
290
290
|
# @param order_id [String] Unique identifier of the paid order whose receipt should be sent (required)
|
|
291
291
|
#
|
|
292
|
-
# @return [Inttegro::
|
|
292
|
+
# @return [Inttegro::OrderDocumentDeliveryResult] Order and delivery details
|
|
293
293
|
def send_receipt(order_id:)
|
|
294
294
|
@http.post_model(
|
|
295
295
|
"/orders/send_receipt",
|
|
296
|
-
Inttegro::
|
|
296
|
+
Inttegro::OrderDocumentDeliveryResult,
|
|
297
297
|
{ order_id: order_id }
|
|
298
298
|
)
|
|
299
299
|
end
|
|
@@ -308,14 +308,14 @@ module Inttegro
|
|
|
308
308
|
# @option payload [String] :order_id Unique identifier of the order to complete (required)
|
|
309
309
|
# @option payload [Boolean] :paid_out_of_band Set to true if payment received outside Inttegro (default: false)
|
|
310
310
|
#
|
|
311
|
-
# @return [Inttegro::
|
|
311
|
+
# @return [Inttegro::Order] Completed order object
|
|
312
312
|
#
|
|
313
313
|
# @example Complete order after fulfillment
|
|
314
|
-
#
|
|
314
|
+
# order = client.orders.complete(
|
|
315
315
|
# order_id: 'GKj7A8lM5wEGRUvbqpI4bkDFsQvpqVyh5fqePNnb'
|
|
316
316
|
# )
|
|
317
317
|
#
|
|
318
|
-
# puts "Order completed at: #{
|
|
318
|
+
# puts "Order completed at: #{order.completed_at}"
|
|
319
319
|
#
|
|
320
320
|
# @example Complete order with offline payment
|
|
321
321
|
# result = client.orders.complete(
|
|
@@ -325,7 +325,7 @@ module Inttegro
|
|
|
325
325
|
#
|
|
326
326
|
# @see https://studio.inttegro.com/order-lifecycle for order states
|
|
327
327
|
def complete(payload)
|
|
328
|
-
@http.
|
|
328
|
+
@http.post_resource("/orders/complete", Inttegro::Order, :order, payload)
|
|
329
329
|
end
|
|
330
330
|
|
|
331
331
|
# Cancel an order, stopping payment execution and preventing further processing.
|
|
@@ -336,20 +336,21 @@ module Inttegro
|
|
|
336
336
|
# @param order_id [String] Unique identifier of the order to cancel (required)
|
|
337
337
|
# @param request_meta [Hash, nil] Request controls such as idempotency_key (optional)
|
|
338
338
|
#
|
|
339
|
-
# @return [Inttegro::
|
|
339
|
+
# @return [Inttegro::Order] Cancelled order object
|
|
340
340
|
#
|
|
341
341
|
# @example Cancel an order
|
|
342
|
-
#
|
|
342
|
+
# order = client.orders.cancel(
|
|
343
343
|
# order_id: 'GKj7A8lM5wEGRUvbqpI4bkDFsQvpqVyh5fqePNnb'
|
|
344
344
|
# )
|
|
345
345
|
#
|
|
346
|
-
# puts "Order #{
|
|
346
|
+
# puts "Order #{order.id} has been cancelled"
|
|
347
347
|
#
|
|
348
348
|
# @see https://studio.inttegro.com/order-lifecycle for order states
|
|
349
349
|
def cancel(order_id:, request_meta: nil)
|
|
350
|
-
@http.
|
|
350
|
+
@http.post_resource(
|
|
351
351
|
"/orders/cancel",
|
|
352
|
-
Inttegro::
|
|
352
|
+
Inttegro::Order,
|
|
353
|
+
:order,
|
|
353
354
|
{
|
|
354
355
|
order_id: order_id,
|
|
355
356
|
request_meta: request_meta || stable_order_request_meta("cancel", order_id)
|
|
@@ -357,59 +358,61 @@ module Inttegro
|
|
|
357
358
|
)
|
|
358
359
|
end
|
|
359
360
|
|
|
360
|
-
#
|
|
361
|
+
# Create a refund through the /orders/refund compatibility alias.
|
|
361
362
|
#
|
|
362
|
-
#
|
|
363
|
-
#
|
|
363
|
+
# This accepts the same line-item payload as client.refunds.create and returns
|
|
364
|
+
# the created Refund directly. New integrations should use that canonical method.
|
|
364
365
|
#
|
|
365
|
-
# @param
|
|
366
|
+
# @param payload [Hash] Create-refund payload containing order_id, reason, and line_items
|
|
366
367
|
#
|
|
367
|
-
# @return [Inttegro::
|
|
368
|
+
# @return [Inttegro::Refund] Created refund
|
|
368
369
|
#
|
|
369
370
|
# @example Refund an order
|
|
370
|
-
#
|
|
371
|
-
# order_id: '
|
|
371
|
+
# refund = client.orders.refund(
|
|
372
|
+
# order_id: 'or_0123456789abcdefghijklmnopqrstuvwxyzABCD',
|
|
373
|
+
# reason: 'requested_by_customer',
|
|
374
|
+
# line_items: [{
|
|
375
|
+
# order_line_item_id: 'oli_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMN',
|
|
376
|
+
# refund_amount: { currency: 'ghs', value: 2500 }
|
|
377
|
+
# }]
|
|
372
378
|
# )
|
|
373
379
|
#
|
|
374
|
-
# puts "Refund created: #{
|
|
380
|
+
# puts "Refund created: #{refund.id}"
|
|
375
381
|
#
|
|
376
|
-
# @see https://studio.inttegro.com/
|
|
382
|
+
# @see https://studio.inttegro.com/refunds
|
|
377
383
|
def refund(payload)
|
|
378
|
-
@http.
|
|
384
|
+
@http.post_resource("/orders/refund", Inttegro::Refund, :refund, payload)
|
|
379
385
|
end
|
|
380
386
|
|
|
381
387
|
# Retrieve a paginated list of orders.
|
|
382
388
|
#
|
|
383
|
-
# Returns orders in reverse chronological order (most recent first).
|
|
384
|
-
# and page parameter to navigate through results. Supports filtering by status and time range.
|
|
389
|
+
# Returns orders in reverse chronological order (most recent first).
|
|
385
390
|
#
|
|
386
391
|
# @param payload [Hash] Pagination and filter parameters (optional)
|
|
387
|
-
# @option payload [Integer] :page
|
|
388
|
-
# @option payload [Integer] :
|
|
389
|
-
# @option payload [String] :
|
|
390
|
-
# @option payload [String] :created_after Filter orders created after this timestamp (ISO 8601)
|
|
391
|
-
# @option payload [String] :created_before Filter orders created before this timestamp (ISO 8601)
|
|
392
|
+
# @option payload [Integer] :page_number Zero-based page index to retrieve (0-10)
|
|
393
|
+
# @option payload [Integer] :page_size Number of orders per page (1-256)
|
|
394
|
+
# @option payload [String] :customer_id Optional customer whose orders should be returned
|
|
392
395
|
#
|
|
393
|
-
# @return [Inttegro::
|
|
396
|
+
# @return [Inttegro::OrderPage] Paginated list of orders
|
|
394
397
|
#
|
|
395
398
|
# @example Get first page of orders
|
|
396
|
-
#
|
|
397
|
-
#
|
|
398
|
-
#
|
|
399
|
+
# page = client.orders.page(
|
|
400
|
+
# page_size: 25,
|
|
401
|
+
# page_number: 0
|
|
399
402
|
# )
|
|
400
403
|
#
|
|
401
|
-
# puts "Retrieved #{
|
|
404
|
+
# puts "Retrieved #{page.orders&.length || 0} orders"
|
|
402
405
|
#
|
|
403
|
-
# @example
|
|
404
|
-
#
|
|
405
|
-
#
|
|
406
|
-
#
|
|
406
|
+
# @example Restrict the page to one customer
|
|
407
|
+
# customer_orders = client.orders.page(
|
|
408
|
+
# customer_id: 'cu_123',
|
|
409
|
+
# page_size: 50
|
|
407
410
|
# )
|
|
408
411
|
#
|
|
409
412
|
# @see https://studio.inttegro.com/pagination for pagination guide
|
|
410
413
|
# @see https://studio.inttegro.com/orders for API reference
|
|
411
414
|
def page(payload = {})
|
|
412
|
-
@http.
|
|
415
|
+
@http.post_resource("/orders/page", Inttegro::OrderPage, :page, payload || {})
|
|
413
416
|
end
|
|
414
417
|
|
|
415
418
|
private
|
|
@@ -9,21 +9,21 @@ module Inttegro
|
|
|
9
9
|
end
|
|
10
10
|
|
|
11
11
|
def initiate(payload)
|
|
12
|
-
@http.
|
|
12
|
+
@http.post_resource("/otp/initiate", Inttegro::OTPTransaction, :transaction, payload)
|
|
13
13
|
end
|
|
14
14
|
|
|
15
15
|
alias_method :initialize_session, :initiate
|
|
16
16
|
|
|
17
17
|
def verify(payload)
|
|
18
|
-
@http.post_model("/otp/verify", Inttegro::
|
|
18
|
+
@http.post_model("/otp/verify", Inttegro::OTPVerification, payload)
|
|
19
19
|
end
|
|
20
20
|
|
|
21
21
|
def lookup(payload)
|
|
22
|
-
@http.
|
|
22
|
+
@http.post_resource("/otp/lookup", Inttegro::OTPTransaction, :transaction, payload)
|
|
23
23
|
end
|
|
24
24
|
|
|
25
25
|
def cancel(payload)
|
|
26
|
-
@http.
|
|
26
|
+
@http.post_resource("/otp/cancel", Inttegro::OTPTransaction, :transaction, payload)
|
|
27
27
|
end
|
|
28
28
|
end
|
|
29
29
|
end
|
|
@@ -29,7 +29,7 @@ module Inttegro
|
|
|
29
29
|
# @option payload [Hash] :payment_method_data Payment method details (required)
|
|
30
30
|
# @option payload [Boolean] :verify_immediately Send verification OTP immediately (default: false)
|
|
31
31
|
#
|
|
32
|
-
# @return [Inttegro::
|
|
32
|
+
# @return [Inttegro::PaymentMethod] Tokenized payment method
|
|
33
33
|
#
|
|
34
34
|
# @example Tokenize a mobile money payment method
|
|
35
35
|
# result = client.payment_methods.tokenize(
|
|
@@ -44,13 +44,13 @@ module Inttegro
|
|
|
44
44
|
# verify_immediately: true
|
|
45
45
|
# )
|
|
46
46
|
#
|
|
47
|
-
# puts "Tokenized payment method: #{result.
|
|
47
|
+
# puts "Tokenized payment method: #{result.id}"
|
|
48
48
|
#
|
|
49
49
|
# @see https://studio.inttegro.com/charge-repeat-customers for usage guide
|
|
50
50
|
def tokenize(payload)
|
|
51
|
-
@http.
|
|
51
|
+
@http.post_resource(
|
|
52
52
|
"/payment_methods/tokenize",
|
|
53
|
-
Inttegro::
|
|
53
|
+
Inttegro::PaymentMethod, :payment_method,
|
|
54
54
|
payload
|
|
55
55
|
)
|
|
56
56
|
end
|
|
@@ -64,20 +64,20 @@ module Inttegro
|
|
|
64
64
|
# @param payment_method_id [String] ID of the payment method to verify (required)
|
|
65
65
|
# @param request_meta [Hash, nil] Request controls such as idempotency_key (optional)
|
|
66
66
|
#
|
|
67
|
-
# @return [Inttegro::
|
|
67
|
+
# @return [Inttegro::PaymentMethodVerification] Verification details
|
|
68
68
|
#
|
|
69
69
|
# @example Verify a payment method
|
|
70
70
|
# result = client.payment_methods.verify(
|
|
71
71
|
# payment_method_id: 'pm_xyz789'
|
|
72
72
|
# )
|
|
73
73
|
#
|
|
74
|
-
# puts "Verification request: #{result.
|
|
74
|
+
# puts "Verification request: #{result.request_id}"
|
|
75
75
|
#
|
|
76
76
|
# @see https://studio.inttegro.com/charge-repeat-customers for verification flow
|
|
77
77
|
def verify(payment_method_id:, request_meta: nil)
|
|
78
|
-
@http.
|
|
78
|
+
@http.post_resource(
|
|
79
79
|
"/payment_methods/verify",
|
|
80
|
-
Inttegro::
|
|
80
|
+
Inttegro::PaymentMethodVerification, :verification,
|
|
81
81
|
{
|
|
82
82
|
payment_method_id: payment_method_id,
|
|
83
83
|
request_meta: request_meta || stable_payment_method_request_meta("verify", payment_method_id)
|
|
@@ -94,7 +94,7 @@ module Inttegro
|
|
|
94
94
|
# @option payload [String] :payment_method_id ID of the payment method being verified (required)
|
|
95
95
|
# @option payload [String] :token OTP code provided by customer (required, typically 6 digits)
|
|
96
96
|
#
|
|
97
|
-
# @return [Inttegro::
|
|
97
|
+
# @return [Inttegro::PaymentMethod] Verified payment method
|
|
98
98
|
#
|
|
99
99
|
# @example Confirm verification with OTP
|
|
100
100
|
# result = client.payment_methods.confirm_verification(
|
|
@@ -102,15 +102,15 @@ module Inttegro
|
|
|
102
102
|
# token: '123456'
|
|
103
103
|
# )
|
|
104
104
|
#
|
|
105
|
-
# if result.
|
|
105
|
+
# if result.verified_at
|
|
106
106
|
# puts 'Payment method verified successfully!'
|
|
107
107
|
# end
|
|
108
108
|
#
|
|
109
109
|
# @see https://studio.inttegro.com/charge-repeat-customers for verification flow
|
|
110
110
|
def confirm_verification(payload)
|
|
111
|
-
@http.
|
|
111
|
+
@http.post_resource(
|
|
112
112
|
"/payment_methods/confirm_verification",
|
|
113
|
-
Inttegro::
|
|
113
|
+
Inttegro::PaymentMethod, :payment_method,
|
|
114
114
|
payload
|
|
115
115
|
)
|
|
116
116
|
end
|
|
@@ -122,52 +122,52 @@ module Inttegro
|
|
|
122
122
|
#
|
|
123
123
|
# @param payment_method_id [String] ID of the payment method to retrieve (required)
|
|
124
124
|
#
|
|
125
|
-
# @return [Inttegro::
|
|
125
|
+
# @return [Inttegro::PaymentMethod] Payment method details
|
|
126
126
|
#
|
|
127
127
|
# @example Lookup a payment method
|
|
128
128
|
# result = client.payment_methods.lookup(
|
|
129
129
|
# payment_method_id: 'pm_xyz789'
|
|
130
130
|
# )
|
|
131
131
|
#
|
|
132
|
-
# puts "Payment method type: #{result.
|
|
132
|
+
# puts "Payment method type: #{result.type&.serialize}"
|
|
133
133
|
#
|
|
134
134
|
# @see https://studio.inttegro.com/payment-methods for API reference
|
|
135
135
|
def lookup(payment_method_id:)
|
|
136
|
-
@http.
|
|
136
|
+
@http.post_resource(
|
|
137
137
|
"/payment_methods/lookup",
|
|
138
|
-
Inttegro::
|
|
138
|
+
Inttegro::PaymentMethod, :payment_method,
|
|
139
139
|
{ payment_method_id: payment_method_id }
|
|
140
140
|
)
|
|
141
141
|
end
|
|
142
142
|
|
|
143
143
|
def page(payload = {})
|
|
144
|
-
@http.
|
|
144
|
+
@http.post_resource(
|
|
145
145
|
"/payment_methods/page",
|
|
146
|
-
Inttegro::
|
|
146
|
+
Inttegro::PaymentMethodPage, :page,
|
|
147
147
|
payload || {}
|
|
148
148
|
)
|
|
149
149
|
end
|
|
150
150
|
|
|
151
151
|
def update(payload)
|
|
152
|
-
@http.
|
|
152
|
+
@http.post_resource(
|
|
153
153
|
"/payment_methods/update",
|
|
154
|
-
Inttegro::
|
|
154
|
+
Inttegro::PaymentMethod, :payment_method,
|
|
155
155
|
payload
|
|
156
156
|
)
|
|
157
157
|
end
|
|
158
158
|
|
|
159
159
|
def activate(payment_method_id:)
|
|
160
|
-
@http.
|
|
160
|
+
@http.post_resource(
|
|
161
161
|
"/payment_methods/activate",
|
|
162
|
-
Inttegro::
|
|
162
|
+
Inttegro::PaymentMethod, :payment_method,
|
|
163
163
|
{ payment_method_id: payment_method_id }
|
|
164
164
|
)
|
|
165
165
|
end
|
|
166
166
|
|
|
167
167
|
def disactivate(payment_method_id:)
|
|
168
|
-
@http.
|
|
168
|
+
@http.post_resource(
|
|
169
169
|
"/payment_methods/disactivate",
|
|
170
|
-
Inttegro::
|
|
170
|
+
Inttegro::PaymentMethod, :payment_method,
|
|
171
171
|
{ payment_method_id: payment_method_id }
|
|
172
172
|
)
|
|
173
173
|
end
|
|
@@ -175,17 +175,17 @@ module Inttegro
|
|
|
175
175
|
alias deactivate disactivate
|
|
176
176
|
|
|
177
177
|
def archive(payment_method_id:)
|
|
178
|
-
@http.
|
|
178
|
+
@http.post_resource(
|
|
179
179
|
"/payment_methods/archive",
|
|
180
|
-
Inttegro::
|
|
180
|
+
Inttegro::PaymentMethod, :payment_method,
|
|
181
181
|
{ payment_method_id: payment_method_id }
|
|
182
182
|
)
|
|
183
183
|
end
|
|
184
184
|
|
|
185
185
|
def unarchive(payment_method_id:)
|
|
186
|
-
@http.
|
|
186
|
+
@http.post_resource(
|
|
187
187
|
"/payment_methods/unarchive",
|
|
188
|
-
Inttegro::
|
|
188
|
+
Inttegro::PaymentMethod, :payment_method,
|
|
189
189
|
{ payment_method_id: payment_method_id }
|
|
190
190
|
)
|
|
191
191
|
end
|
|
@@ -198,7 +198,7 @@ module Inttegro
|
|
|
198
198
|
# @param payment_method_id [String] ID of the payment method to delete (required)
|
|
199
199
|
# @param request_meta [Hash, nil] Request controls such as idempotency_key (optional)
|
|
200
200
|
#
|
|
201
|
-
# @return [Inttegro::
|
|
201
|
+
# @return [Inttegro::PaymentMethodDeletion] Deletion confirmation
|
|
202
202
|
#
|
|
203
203
|
# @example Delete a payment method
|
|
204
204
|
# result = client.payment_methods.delete(
|
|
@@ -209,9 +209,7 @@ module Inttegro
|
|
|
209
209
|
#
|
|
210
210
|
# @see https://studio.inttegro.com/payment-methods for API reference
|
|
211
211
|
def delete(payment_method_id:, request_meta: nil)
|
|
212
|
-
@http.post_model(
|
|
213
|
-
"/payment_methods/delete",
|
|
214
|
-
Inttegro::Models::PaymentMethodDeleteResponse,
|
|
212
|
+
@http.post_model("/payment_methods/delete", Inttegro::PaymentMethodDeletion,
|
|
215
213
|
{
|
|
216
214
|
payment_method_id: payment_method_id,
|
|
217
215
|
request_meta: request_meta || stable_payment_method_request_meta("delete", payment_method_id)
|
|
@@ -224,18 +222,18 @@ module Inttegro
|
|
|
224
222
|
# Returns settings that control payment method behavior, including whether verification
|
|
225
223
|
# is required before charging and supported payment method types.
|
|
226
224
|
#
|
|
227
|
-
# @return [Inttegro::
|
|
225
|
+
# @return [Inttegro::PaymentMethodSettings] Payment method settings
|
|
228
226
|
#
|
|
229
227
|
# @example Get payment method settings
|
|
230
228
|
# result = client.payment_methods.settings
|
|
231
229
|
#
|
|
232
|
-
# puts "Mobile money enabled: #{result.
|
|
230
|
+
# puts "Mobile money enabled: #{result.mobile_money&.enabled}"
|
|
233
231
|
#
|
|
234
232
|
# @see https://studio.inttegro.com/payment-methods for API reference
|
|
235
233
|
def settings
|
|
236
|
-
@http.
|
|
234
|
+
@http.post_resource(
|
|
237
235
|
"/payment_methods/settings",
|
|
238
|
-
Inttegro::
|
|
236
|
+
Inttegro::PaymentMethodSettings, :settings,
|
|
239
237
|
{}
|
|
240
238
|
)
|
|
241
239
|
end
|