pago-sdk 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.
Files changed (49) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +21 -0
  3. data/README.md +131 -0
  4. data/lib/pago/base_client.rb +116 -0
  5. data/lib/pago/errors.rb +83 -0
  6. data/lib/pago/http.rb +78 -0
  7. data/lib/pago/model.rb +86 -0
  8. data/lib/pago/paginator.rb +67 -0
  9. data/lib/pago/serde.rb +186 -0
  10. data/lib/pago/service.rb +17 -0
  11. data/lib/pago/v2026_04/client.rb +124 -0
  12. data/lib/pago/v2026_04/enums.rb +4552 -0
  13. data/lib/pago/v2026_04/errors.rb +1121 -0
  14. data/lib/pago/v2026_04/models.rb +46344 -0
  15. data/lib/pago/v2026_04/services/benefit_grants.rb +48 -0
  16. data/lib/pago/v2026_04/services/benefits.rb +179 -0
  17. data/lib/pago/v2026_04/services/checkout_links.rb +131 -0
  18. data/lib/pago/v2026_04/services/checkouts.rb +185 -0
  19. data/lib/pago/v2026_04/services/custom_fields.rb +132 -0
  20. data/lib/pago/v2026_04/services/customer_meters.rb +69 -0
  21. data/lib/pago/v2026_04/services/customer_portal.rb +1181 -0
  22. data/lib/pago/v2026_04/services/customer_seats.rb +137 -0
  23. data/lib/pago/v2026_04/services/customer_sessions.rb +35 -0
  24. data/lib/pago/v2026_04/services/customers.rb +556 -0
  25. data/lib/pago/v2026_04/services/discounts.rb +131 -0
  26. data/lib/pago/v2026_04/services/disputes.rb +93 -0
  27. data/lib/pago/v2026_04/services/event_types.rb +74 -0
  28. data/lib/pago/v2026_04/services/events.rb +126 -0
  29. data/lib/pago/v2026_04/services/files.rb +135 -0
  30. data/lib/pago/v2026_04/services/license_keys.rb +183 -0
  31. data/lib/pago/v2026_04/services/members.rb +47 -0
  32. data/lib/pago/v2026_04/services/meters.rb +142 -0
  33. data/lib/pago/v2026_04/services/metrics.rb +188 -0
  34. data/lib/pago/v2026_04/services/oauth2.rb +175 -0
  35. data/lib/pago/v2026_04/services/orders.rb +238 -0
  36. data/lib/pago/v2026_04/services/organizations.rb +113 -0
  37. data/lib/pago/v2026_04/services/payments.rb +72 -0
  38. data/lib/pago/v2026_04/services/products.rb +142 -0
  39. data/lib/pago/v2026_04/services/refunds.rb +73 -0
  40. data/lib/pago/v2026_04/services/subscriptions.rb +171 -0
  41. data/lib/pago/v2026_04/services/webhooks.rb +212 -0
  42. data/lib/pago/v2026_04/unions.rb +739 -0
  43. data/lib/pago/v2026_04/webhooks.rb +86 -0
  44. data/lib/pago/version.rb +5 -0
  45. data/lib/pago/webhooks.rb +159 -0
  46. data/lib/pago.rb +39 -0
  47. data/sig/pago/v2026_04/generated.rbs +12401 -0
  48. data/sig/pago.rbs +204 -0
  49. metadata +91 -0
@@ -0,0 +1,1121 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Pago
4
+ module V2026_04
5
+ # Typed errors of the 2026-04 API.
6
+ #
7
+ # Each declared error response gets its own class, inheriting from the
8
+ # generic `Pago` error matching its status code. Rescue the exact error to
9
+ # branch on a specific failure, or its parent to catch a whole family:
10
+ #
11
+ # rescue Pago::NotFoundError => e # every 404 of the API
12
+ # rescue Pago::APIError => e # anything the API rejected
13
+ module Errors
14
+ # Invalid request or member already exists.
15
+ # Raised on HTTP 400.
16
+ class AddMember400Error < ::Pago::BadRequestError
17
+ STATUS_CODE = 400
18
+
19
+ # @return [nil] the deserialized error payload.
20
+ def self.from_response(status_code:, body:, response:)
21
+ new(
22
+ "Pago API returned an error: #{status_code} - AddMember400Error",
23
+ status_code: status_code,
24
+ data: body,
25
+ body: body,
26
+ response: response
27
+ )
28
+ end
29
+ end
30
+
31
+ # Authentication required
32
+ # Raised on HTTP 401.
33
+ class AddMember401Error < ::Pago::AuthenticationError
34
+ STATUS_CODE = 401
35
+
36
+ # @return [nil] the deserialized error payload.
37
+ def self.from_response(status_code:, body:, response:)
38
+ new(
39
+ "Pago API returned an error: #{status_code} - AddMember401Error",
40
+ status_code: status_code,
41
+ data: body,
42
+ body: body,
43
+ response: response
44
+ )
45
+ end
46
+ end
47
+
48
+ # Not permitted - requires owner or billing manager role
49
+ # Raised on HTTP 403.
50
+ class AddMember403Error < ::Pago::PermissionDeniedError
51
+ STATUS_CODE = 403
52
+
53
+ # @return [nil] the deserialized error payload.
54
+ def self.from_response(status_code:, body:, response:)
55
+ new(
56
+ "Pago API returned an error: #{status_code} - AddMember403Error",
57
+ status_code: status_code,
58
+ data: body,
59
+ body: body,
60
+ response: response
61
+ )
62
+ end
63
+ end
64
+
65
+ # This subscription is already revoked.
66
+ # Raised on HTTP 403.
67
+ class AlreadyCanceledSubscription < ::Pago::PermissionDeniedError
68
+ STATUS_CODE = 403
69
+
70
+ # @return [Models::AlreadyCanceledSubscription] the deserialized error payload.
71
+ def self.from_response(status_code:, body:, response:)
72
+ new(
73
+ "Pago API returned an error: #{status_code} - AlreadyCanceledSubscription",
74
+ status_code: status_code,
75
+ data: Models::AlreadyCanceledSubscription.from_json(body),
76
+ body: body,
77
+ response: response
78
+ )
79
+ end
80
+ end
81
+
82
+ # The external customer ID matches customers in several accessible organizations.
83
+ # Raised on HTTP 409.
84
+ class AmbiguousExternalCustomerID < ::Pago::ConflictError
85
+ STATUS_CODE = 409
86
+
87
+ # @return [Models::AmbiguousExternalCustomerID] the deserialized error payload.
88
+ def self.from_response(status_code:, body:, response:)
89
+ new(
90
+ "Pago API returned an error: #{status_code} - AmbiguousExternalCustomerID",
91
+ status_code: status_code,
92
+ data: Models::AmbiguousExternalCustomerID.from_json(body),
93
+ body: body,
94
+ response: response
95
+ )
96
+ end
97
+ end
98
+
99
+ # No available seats or customer already has a seat
100
+ # Raised on HTTP 400.
101
+ class AssignSeat400Error < ::Pago::BadRequestError
102
+ STATUS_CODE = 400
103
+
104
+ # @return [nil] the deserialized error payload.
105
+ def self.from_response(status_code:, body:, response:)
106
+ new(
107
+ "Pago API returned an error: #{status_code} - AssignSeat400Error",
108
+ status_code: status_code,
109
+ data: body,
110
+ body: body,
111
+ response: response
112
+ )
113
+ end
114
+ end
115
+
116
+ # Authentication required
117
+ # Raised on HTTP 401.
118
+ class AssignSeat401Error < ::Pago::AuthenticationError
119
+ STATUS_CODE = 401
120
+
121
+ # @return [nil] the deserialized error payload.
122
+ def self.from_response(status_code:, body:, response:)
123
+ new(
124
+ "Pago API returned an error: #{status_code} - AssignSeat401Error",
125
+ status_code: status_code,
126
+ data: body,
127
+ body: body,
128
+ response: response
129
+ )
130
+ end
131
+ end
132
+
133
+ # Not permitted or seat-based pricing not enabled
134
+ # Raised on HTTP 403.
135
+ class AssignSeat403Error < ::Pago::PermissionDeniedError
136
+ STATUS_CODE = 403
137
+
138
+ # @return [nil] the deserialized error payload.
139
+ def self.from_response(status_code:, body:, response:)
140
+ new(
141
+ "Pago API returned an error: #{status_code} - AssignSeat403Error",
142
+ status_code: status_code,
143
+ data: body,
144
+ body: body,
145
+ response: response
146
+ )
147
+ end
148
+ end
149
+
150
+ # Subscription, order, or customer not found
151
+ # Raised on HTTP 404.
152
+ class AssignSeat404Error < ::Pago::NotFoundError
153
+ STATUS_CODE = 404
154
+
155
+ # @return [nil] the deserialized error payload.
156
+ def self.from_response(status_code:, body:, response:)
157
+ new(
158
+ "Pago API returned an error: #{status_code} - AssignSeat404Error",
159
+ status_code: status_code,
160
+ data: body,
161
+ body: body,
162
+ response: response
163
+ )
164
+ end
165
+ end
166
+
167
+ # Forbidden
168
+ # Raised on HTTP 403.
169
+ class CannotCreateOrganizationError < ::Pago::PermissionDeniedError
170
+ STATUS_CODE = 403
171
+
172
+ # @return [Models::CannotCreateOrganizationError] the deserialized error payload.
173
+ def self.from_response(status_code:, body:, response:)
174
+ new(
175
+ "Pago API returned an error: #{status_code} - CannotCreateOrganizationError",
176
+ status_code: status_code,
177
+ data: Models::CannotCreateOrganizationError.from_json(body),
178
+ body: body,
179
+ response: response
180
+ )
181
+ end
182
+ end
183
+
184
+ # Invalid or expired verification token.
185
+ # Raised on HTTP 401.
186
+ class CheckEmailUpdate401Error < ::Pago::AuthenticationError
187
+ STATUS_CODE = 401
188
+
189
+ # @return [nil] the deserialized error payload.
190
+ def self.from_response(status_code:, body:, response:)
191
+ new(
192
+ "Pago API returned an error: #{status_code} - CheckEmailUpdate401Error",
193
+ status_code: status_code,
194
+ data: body,
195
+ body: body,
196
+ response: response
197
+ )
198
+ end
199
+ end
200
+
201
+ # Invalid, expired, or already claimed token
202
+ # Raised on HTTP 400.
203
+ class ClaimSeat400Error < ::Pago::BadRequestError
204
+ STATUS_CODE = 400
205
+
206
+ # @return [nil] the deserialized error payload.
207
+ def self.from_response(status_code:, body:, response:)
208
+ new(
209
+ "Pago API returned an error: #{status_code} - ClaimSeat400Error",
210
+ status_code: status_code,
211
+ data: body,
212
+ body: body,
213
+ response: response
214
+ )
215
+ end
216
+ end
217
+
218
+ # Seat-based pricing not enabled for organization
219
+ # Raised on HTTP 403.
220
+ class ClaimSeat403Error < ::Pago::PermissionDeniedError
221
+ STATUS_CODE = 403
222
+
223
+ # @return [nil] the deserialized error payload.
224
+ def self.from_response(status_code:, body:, response:)
225
+ new(
226
+ "Pago API returned an error: #{status_code} - ClaimSeat403Error",
227
+ status_code: status_code,
228
+ data: body,
229
+ body: body,
230
+ response: response
231
+ )
232
+ end
233
+ end
234
+
235
+ # The checkout is expired, the customer already has an active subscription, or the organization is not ready to accept payments.
236
+ # Raised on HTTP 403.
237
+ class ClientConfirm403Error < ::Pago::PermissionDeniedError
238
+ STATUS_CODE = 403
239
+
240
+ # @return [Object] the deserialized error payload.
241
+ def self.from_response(status_code:, body:, response:)
242
+ new(
243
+ "Pago API returned an error: #{status_code} - ClientConfirm403Error",
244
+ status_code: status_code,
245
+ data: Unions::CheckoutForbiddenError.from_json(body),
246
+ body: body,
247
+ response: response
248
+ )
249
+ end
250
+ end
251
+
252
+ # The checkout is expired, the customer already has an active subscription, or the organization is not ready to accept payments.
253
+ # Raised on HTTP 403.
254
+ class ClientUpdate403Error < ::Pago::PermissionDeniedError
255
+ STATUS_CODE = 403
256
+
257
+ # @return [Object] the deserialized error payload.
258
+ def self.from_response(status_code:, body:, response:)
259
+ new(
260
+ "Pago API returned an error: #{status_code} - ClientUpdate403Error",
261
+ status_code: status_code,
262
+ data: Unions::CheckoutForbiddenError.from_json(body),
263
+ body: body,
264
+ response: response
265
+ )
266
+ end
267
+ end
268
+
269
+ # Customer is not ready to confirm a payment method.
270
+ # Raised on HTTP 400.
271
+ class CustomerNotReady < ::Pago::BadRequestError
272
+ STATUS_CODE = 400
273
+
274
+ # @return [Models::CustomerNotReady] the deserialized error payload.
275
+ def self.from_response(status_code:, body:, response:)
276
+ new(
277
+ "Pago API returned an error: #{status_code} - CustomerNotReady",
278
+ status_code: status_code,
279
+ data: Models::CustomerNotReady.from_json(body),
280
+ body: body,
281
+ response: response
282
+ )
283
+ end
284
+ end
285
+
286
+ # Conflict
287
+ # Raised on HTTP 409.
288
+ class DisputeNotOpenError < ::Pago::ConflictError
289
+ STATUS_CODE = 409
290
+
291
+ # @return [Models::DisputeNotOpenError] the deserialized error payload.
292
+ def self.from_response(status_code:, body:, response:)
293
+ new(
294
+ "Pago API returned an error: #{status_code} - DisputeNotOpenError",
295
+ status_code: status_code,
296
+ data: Models::DisputeNotOpenError.from_json(body),
297
+ body: body,
298
+ response: response
299
+ )
300
+ end
301
+ end
302
+
303
+ # The checkout session is expired.
304
+ # Raised on HTTP 410.
305
+ class ExpiredCheckoutError < ::Pago::GoneError
306
+ STATUS_CODE = 410
307
+
308
+ # @return [Models::ExpiredCheckoutError] the deserialized error payload.
309
+ def self.from_response(status_code:, body:, response:)
310
+ new(
311
+ "Pago API returned an error: #{status_code} - ExpiredCheckoutError",
312
+ status_code: status_code,
313
+ data: Models::ExpiredCheckoutError.from_json(body),
314
+ body: body,
315
+ response: response
316
+ )
317
+ end
318
+ end
319
+
320
+ # The charge failed, or requires customer authentication (e.g. a 3DS challenge) that can't be completed off-session.
321
+ # Raised on HTTP 402.
322
+ class Finalize402Error < ::Pago::PaymentRequiredError
323
+ STATUS_CODE = 402
324
+
325
+ # @return [Models::PaymentFailed, Models::PaymentActionRequired] the deserialized error payload.
326
+ def self.from_response(status_code:, body:, response:)
327
+ new(
328
+ "Pago API returned an error: #{status_code} - Finalize402Error",
329
+ status_code: status_code,
330
+ data: ::Pago::Serde.union(body, variants: [Models::PaymentFailed, Models::PaymentActionRequired]),
331
+ body: body,
332
+ response: response
333
+ )
334
+ end
335
+ end
336
+
337
+ # Off-session charges are not enabled for this organization, or its account can't currently accept payments.
338
+ # Raised on HTTP 403.
339
+ class Finalize403Error < ::Pago::PermissionDeniedError
340
+ STATUS_CODE = 403
341
+
342
+ # @return [Models::OffSessionChargesNotEnabled, Models::OrganizationNotReadyForPayments] the deserialized error payload.
343
+ def self.from_response(status_code:, body:, response:)
344
+ new(
345
+ "Pago API returned an error: #{status_code} - Finalize403Error",
346
+ status_code: status_code,
347
+ data: ::Pago::Serde.union(body, variants: [Models::OffSessionChargesNotEnabled, Models::OrganizationNotReadyForPayments]),
348
+ body: body,
349
+ response: response
350
+ )
351
+ end
352
+ end
353
+
354
+ # Invalid or expired invitation token
355
+ # Raised on HTTP 400.
356
+ class GetClaimInfo400Error < ::Pago::BadRequestError
357
+ STATUS_CODE = 400
358
+
359
+ # @return [nil] the deserialized error payload.
360
+ def self.from_response(status_code:, body:, response:)
361
+ new(
362
+ "Pago API returned an error: #{status_code} - GetClaimInfo400Error",
363
+ status_code: status_code,
364
+ data: body,
365
+ body: body,
366
+ response: response
367
+ )
368
+ end
369
+ end
370
+
371
+ # Seat-based pricing not enabled for organization
372
+ # Raised on HTTP 403.
373
+ class GetClaimInfo403Error < ::Pago::PermissionDeniedError
374
+ STATUS_CODE = 403
375
+
376
+ # @return [nil] the deserialized error payload.
377
+ def self.from_response(status_code:, body:, response:)
378
+ new(
379
+ "Pago API returned an error: #{status_code} - GetClaimInfo403Error",
380
+ status_code: status_code,
381
+ data: body,
382
+ body: body,
383
+ response: response
384
+ )
385
+ end
386
+ end
387
+
388
+ # Seat not found
389
+ # Raised on HTTP 404.
390
+ class GetClaimInfo404Error < ::Pago::NotFoundError
391
+ STATUS_CODE = 404
392
+
393
+ # @return [nil] the deserialized error payload.
394
+ def self.from_response(status_code:, body:, response:)
395
+ new(
396
+ "Pago API returned an error: #{status_code} - GetClaimInfo404Error",
397
+ status_code: status_code,
398
+ data: body,
399
+ body: body,
400
+ response: response
401
+ )
402
+ end
403
+ end
404
+
405
+ # Validation Error
406
+ # Raised on HTTP 422.
407
+ class HTTPValidationError < ::Pago::UnprocessableEntityError
408
+ STATUS_CODE = 422
409
+
410
+ # @return [Models::HTTPValidationError] the deserialized error payload.
411
+ def self.from_response(status_code:, body:, response:)
412
+ new(
413
+ "Pago API returned an error: #{status_code} - HTTPValidationError",
414
+ status_code: status_code,
415
+ data: Models::HTTPValidationError.from_json(body),
416
+ body: body,
417
+ response: response
418
+ )
419
+ end
420
+ end
421
+
422
+ # Authentication required
423
+ # Raised on HTTP 401.
424
+ class ListClaimedSubscriptions401Error < ::Pago::AuthenticationError
425
+ STATUS_CODE = 401
426
+
427
+ # @return [nil] the deserialized error payload.
428
+ def self.from_response(status_code:, body:, response:)
429
+ new(
430
+ "Pago API returned an error: #{status_code} - ListClaimedSubscriptions401Error",
431
+ status_code: status_code,
432
+ data: body,
433
+ body: body,
434
+ response: response
435
+ )
436
+ end
437
+ end
438
+
439
+ # Authentication required
440
+ # Raised on HTTP 401.
441
+ class ListMembers401Error < ::Pago::AuthenticationError
442
+ STATUS_CODE = 401
443
+
444
+ # @return [nil] the deserialized error payload.
445
+ def self.from_response(status_code:, body:, response:)
446
+ new(
447
+ "Pago API returned an error: #{status_code} - ListMembers401Error",
448
+ status_code: status_code,
449
+ data: body,
450
+ body: body,
451
+ response: response
452
+ )
453
+ end
454
+ end
455
+
456
+ # Not permitted - requires owner or billing manager role
457
+ # Raised on HTTP 403.
458
+ class ListMembers403Error < ::Pago::PermissionDeniedError
459
+ STATUS_CODE = 403
460
+
461
+ # @return [nil] the deserialized error payload.
462
+ def self.from_response(status_code:, body:, response:)
463
+ new(
464
+ "Pago API returned an error: #{status_code} - ListMembers403Error",
465
+ status_code: status_code,
466
+ data: body,
467
+ body: body,
468
+ response: response
469
+ )
470
+ end
471
+ end
472
+
473
+ # Authentication required
474
+ # Raised on HTTP 401.
475
+ class ListSeats401Error < ::Pago::AuthenticationError
476
+ STATUS_CODE = 401
477
+
478
+ # @return [nil] the deserialized error payload.
479
+ def self.from_response(status_code:, body:, response:)
480
+ new(
481
+ "Pago API returned an error: #{status_code} - ListSeats401Error",
482
+ status_code: status_code,
483
+ data: body,
484
+ body: body,
485
+ response: response
486
+ )
487
+ end
488
+ end
489
+
490
+ # Not permitted or seat-based pricing not enabled
491
+ # Raised on HTTP 403.
492
+ class ListSeats403Error < ::Pago::PermissionDeniedError
493
+ STATUS_CODE = 403
494
+
495
+ # @return [nil] the deserialized error payload.
496
+ def self.from_response(status_code:, body:, response:)
497
+ new(
498
+ "Pago API returned an error: #{status_code} - ListSeats403Error",
499
+ status_code: status_code,
500
+ data: body,
501
+ body: body,
502
+ response: response
503
+ )
504
+ end
505
+ end
506
+
507
+ # Subscription or order not found
508
+ # Raised on HTTP 404.
509
+ class ListSeats404Error < ::Pago::NotFoundError
510
+ STATUS_CODE = 404
511
+
512
+ # @return [nil] the deserialized error payload.
513
+ def self.from_response(status_code:, body:, response:)
514
+ new(
515
+ "Pago API returned an error: #{status_code} - ListSeats404Error",
516
+ status_code: status_code,
517
+ data: body,
518
+ body: body,
519
+ response: response
520
+ )
521
+ end
522
+ end
523
+
524
+ # Manual retry limit exceeded.
525
+ # Raised on HTTP 429.
526
+ class ManualRetryLimitExceeded < ::Pago::RateLimitError
527
+ STATUS_CODE = 429
528
+
529
+ # @return [Models::ManualRetryLimitExceeded] the deserialized error payload.
530
+ def self.from_response(status_code:, body:, response:)
531
+ new(
532
+ "Pago API returned an error: #{status_code} - ManualRetryLimitExceeded",
533
+ status_code: status_code,
534
+ data: Models::ManualRetryLimitExceeded.from_json(body),
535
+ body: body,
536
+ response: response
537
+ )
538
+ end
539
+ end
540
+
541
+ # Order is missing billing name or address.
542
+ # Raised on HTTP 422.
543
+ class MissingInvoiceBillingDetails < ::Pago::UnprocessableEntityError
544
+ STATUS_CODE = 422
545
+
546
+ # @return [Models::MissingInvoiceBillingDetails] the deserialized error payload.
547
+ def self.from_response(status_code:, body:, response:)
548
+ new(
549
+ "Pago API returned an error: #{status_code} - MissingInvoiceBillingDetails",
550
+ status_code: status_code,
551
+ data: Models::MissingInvoiceBillingDetails.from_json(body),
552
+ body: body,
553
+ response: response
554
+ )
555
+ end
556
+ end
557
+
558
+ # You don't have the permission to update this organization.
559
+ # Raised on HTTP 403.
560
+ class NotPermitted < ::Pago::PermissionDeniedError
561
+ STATUS_CODE = 403
562
+
563
+ # @return [Models::NotPermitted] the deserialized error payload.
564
+ def self.from_response(status_code:, body:, response:)
565
+ new(
566
+ "Pago API returned an error: #{status_code} - NotPermitted",
567
+ status_code: status_code,
568
+ data: Models::NotPermitted.from_json(body),
569
+ body: body,
570
+ response: response
571
+ )
572
+ end
573
+ end
574
+
575
+ # The order is not in `draft` status.
576
+ # Raised on HTTP 412.
577
+ class OrderNotDraft < ::Pago::PreconditionFailedError
578
+ STATUS_CODE = 412
579
+
580
+ # @return [Models::OrderNotDraft] the deserialized error payload.
581
+ def self.from_response(status_code:, body:, response:)
582
+ new(
583
+ "Pago API returned an error: #{status_code} - OrderNotDraft",
584
+ status_code: status_code,
585
+ data: Models::OrderNotDraft.from_json(body),
586
+ body: body,
587
+ response: response
588
+ )
589
+ end
590
+ end
591
+
592
+ # Order is not eligible for invoice generation (invalid status).
593
+ # Raised on HTTP 409.
594
+ class OrderNotEligibleForInvoice < ::Pago::ConflictError
595
+ STATUS_CODE = 409
596
+
597
+ # @return [Models::OrderNotEligibleForInvoice] the deserialized error payload.
598
+ def self.from_response(status_code:, body:, response:)
599
+ new(
600
+ "Pago API returned an error: #{status_code} - OrderNotEligibleForInvoice",
601
+ status_code: status_code,
602
+ data: Models::OrderNotEligibleForInvoice.from_json(body),
603
+ body: body,
604
+ response: response
605
+ )
606
+ end
607
+ end
608
+
609
+ # Order not eligible for retry or payment confirmation failed.
610
+ # Raised on HTTP 422.
611
+ class OrderNotEligibleForRetry < ::Pago::UnprocessableEntityError
612
+ STATUS_CODE = 422
613
+
614
+ # @return [Models::OrderNotEligibleForRetry] the deserialized error payload.
615
+ def self.from_response(status_code:, body:, response:)
616
+ new(
617
+ "Pago API returned an error: #{status_code} - OrderNotEligibleForRetry",
618
+ status_code: status_code,
619
+ data: Models::OrderNotEligibleForRetry.from_json(body),
620
+ body: body,
621
+ response: response
622
+ )
623
+ end
624
+ end
625
+
626
+ # Payment already in progress.
627
+ # Raised on HTTP 409.
628
+ class PaymentAlreadyInProgress < ::Pago::ConflictError
629
+ STATUS_CODE = 409
630
+
631
+ # @return [Models::PaymentAlreadyInProgress] the deserialized error payload.
632
+ def self.from_response(status_code:, body:, response:)
633
+ new(
634
+ "Pago API returned an error: #{status_code} - PaymentAlreadyInProgress",
635
+ status_code: status_code,
636
+ data: Models::PaymentAlreadyInProgress.from_json(body),
637
+ body: body,
638
+ response: response
639
+ )
640
+ end
641
+ end
642
+
643
+ # The payment failed.
644
+ # Raised on HTTP 400.
645
+ class PaymentError < ::Pago::BadRequestError
646
+ STATUS_CODE = 400
647
+
648
+ # @return [Models::PaymentError] the deserialized error payload.
649
+ def self.from_response(status_code:, body:, response:)
650
+ new(
651
+ "Pago API returned an error: #{status_code} - PaymentError",
652
+ status_code: status_code,
653
+ data: Models::PaymentError.from_json(body),
654
+ body: body,
655
+ response: response
656
+ )
657
+ end
658
+ end
659
+
660
+ # Payment required to apply the subscription update.
661
+ # Raised on HTTP 402.
662
+ class PaymentFailed < ::Pago::PaymentRequiredError
663
+ STATUS_CODE = 402
664
+
665
+ # @return [Models::PaymentFailed] the deserialized error payload.
666
+ def self.from_response(status_code:, body:, response:)
667
+ new(
668
+ "Pago API returned an error: #{status_code} - PaymentFailed",
669
+ status_code: status_code,
670
+ data: Models::PaymentFailed.from_json(body),
671
+ body: body,
672
+ response: response
673
+ )
674
+ end
675
+ end
676
+
677
+ # Payment method is used by active subscription(s).
678
+ # Raised on HTTP 400.
679
+ class PaymentMethodInUseByActiveSubscription < ::Pago::BadRequestError
680
+ STATUS_CODE = 400
681
+
682
+ # @return [Models::PaymentMethodInUseByActiveSubscription] the deserialized error payload.
683
+ def self.from_response(status_code:, body:, response:)
684
+ new(
685
+ "Pago API returned an error: #{status_code} - PaymentMethodInUseByActiveSubscription",
686
+ status_code: status_code,
687
+ data: Models::PaymentMethodInUseByActiveSubscription.from_json(body),
688
+ body: body,
689
+ response: response
690
+ )
691
+ end
692
+ end
693
+
694
+ # The card was declined while setting up the payment method.
695
+ # Raised on HTTP 400.
696
+ class PaymentMethodSetupFailed < ::Pago::BadRequestError
697
+ STATUS_CODE = 400
698
+
699
+ # @return [Models::PaymentMethodSetupFailed] the deserialized error payload.
700
+ def self.from_response(status_code:, body:, response:)
701
+ new(
702
+ "Pago API returned an error: #{status_code} - PaymentMethodSetupFailed",
703
+ status_code: status_code,
704
+ data: Models::PaymentMethodSetupFailed.from_json(body),
705
+ body: body,
706
+ response: response
707
+ )
708
+ end
709
+ end
710
+
711
+ # Order is already fully refunded.
712
+ # Raised on HTTP 403.
713
+ class RefundedAlready < ::Pago::PermissionDeniedError
714
+ STATUS_CODE = 403
715
+
716
+ # @return [Models::RefundedAlready] the deserialized error payload.
717
+ def self.from_response(status_code:, body:, response:)
718
+ new(
719
+ "Pago API returned an error: #{status_code} - RefundedAlready",
720
+ status_code: status_code,
721
+ data: Models::RefundedAlready.from_json(body),
722
+ body: body,
723
+ response: response
724
+ )
725
+ end
726
+ end
727
+
728
+ # Cannot remove the only owner.
729
+ # Raised on HTTP 400.
730
+ class RemoveMember400Error < ::Pago::BadRequestError
731
+ STATUS_CODE = 400
732
+
733
+ # @return [nil] the deserialized error payload.
734
+ def self.from_response(status_code:, body:, response:)
735
+ new(
736
+ "Pago API returned an error: #{status_code} - RemoveMember400Error",
737
+ status_code: status_code,
738
+ data: body,
739
+ body: body,
740
+ response: response
741
+ )
742
+ end
743
+ end
744
+
745
+ # Authentication required
746
+ # Raised on HTTP 401.
747
+ class RemoveMember401Error < ::Pago::AuthenticationError
748
+ STATUS_CODE = 401
749
+
750
+ # @return [nil] the deserialized error payload.
751
+ def self.from_response(status_code:, body:, response:)
752
+ new(
753
+ "Pago API returned an error: #{status_code} - RemoveMember401Error",
754
+ status_code: status_code,
755
+ data: body,
756
+ body: body,
757
+ response: response
758
+ )
759
+ end
760
+ end
761
+
762
+ # Not permitted - requires owner or billing manager role
763
+ # Raised on HTTP 403.
764
+ class RemoveMember403Error < ::Pago::PermissionDeniedError
765
+ STATUS_CODE = 403
766
+
767
+ # @return [nil] the deserialized error payload.
768
+ def self.from_response(status_code:, body:, response:)
769
+ new(
770
+ "Pago API returned an error: #{status_code} - RemoveMember403Error",
771
+ status_code: status_code,
772
+ data: body,
773
+ body: body,
774
+ response: response
775
+ )
776
+ end
777
+ end
778
+
779
+ # Member not found.
780
+ # Raised on HTTP 404.
781
+ class RemoveMember404Error < ::Pago::NotFoundError
782
+ STATUS_CODE = 404
783
+
784
+ # @return [nil] the deserialized error payload.
785
+ def self.from_response(status_code:, body:, response:)
786
+ new(
787
+ "Pago API returned an error: #{status_code} - RemoveMember404Error",
788
+ status_code: status_code,
789
+ data: body,
790
+ body: body,
791
+ response: response
792
+ )
793
+ end
794
+ end
795
+
796
+ # Seat is not pending or already claimed
797
+ # Raised on HTTP 400.
798
+ class ResendInvitation400Error < ::Pago::BadRequestError
799
+ STATUS_CODE = 400
800
+
801
+ # @return [nil] the deserialized error payload.
802
+ def self.from_response(status_code:, body:, response:)
803
+ new(
804
+ "Pago API returned an error: #{status_code} - ResendInvitation400Error",
805
+ status_code: status_code,
806
+ data: body,
807
+ body: body,
808
+ response: response
809
+ )
810
+ end
811
+ end
812
+
813
+ # Authentication required
814
+ # Raised on HTTP 401.
815
+ class ResendInvitation401Error < ::Pago::AuthenticationError
816
+ STATUS_CODE = 401
817
+
818
+ # @return [nil] the deserialized error payload.
819
+ def self.from_response(status_code:, body:, response:)
820
+ new(
821
+ "Pago API returned an error: #{status_code} - ResendInvitation401Error",
822
+ status_code: status_code,
823
+ data: body,
824
+ body: body,
825
+ response: response
826
+ )
827
+ end
828
+ end
829
+
830
+ # Not permitted or seat-based pricing not enabled
831
+ # Raised on HTTP 403.
832
+ class ResendInvitation403Error < ::Pago::PermissionDeniedError
833
+ STATUS_CODE = 403
834
+
835
+ # @return [nil] the deserialized error payload.
836
+ def self.from_response(status_code:, body:, response:)
837
+ new(
838
+ "Pago API returned an error: #{status_code} - ResendInvitation403Error",
839
+ status_code: status_code,
840
+ data: body,
841
+ body: body,
842
+ response: response
843
+ )
844
+ end
845
+ end
846
+
847
+ # Seat not found
848
+ # Raised on HTTP 404.
849
+ class ResendInvitation404Error < ::Pago::NotFoundError
850
+ STATUS_CODE = 404
851
+
852
+ # @return [nil] the deserialized error payload.
853
+ def self.from_response(status_code:, body:, response:)
854
+ new(
855
+ "Pago API returned an error: #{status_code} - ResendInvitation404Error",
856
+ status_code: status_code,
857
+ data: body,
858
+ body: body,
859
+ response: response
860
+ )
861
+ end
862
+ end
863
+
864
+ # Organization not found.
865
+ # Raised on HTTP 404.
866
+ class ResourceNotFound < ::Pago::NotFoundError
867
+ STATUS_CODE = 404
868
+
869
+ # @return [Models::ResourceNotFound] the deserialized error payload.
870
+ def self.from_response(status_code:, body:, response:)
871
+ new(
872
+ "Pago API returned an error: #{status_code} - ResourceNotFound",
873
+ status_code: status_code,
874
+ data: Models::ResourceNotFound.from_json(body),
875
+ body: body,
876
+ response: response
877
+ )
878
+ end
879
+ end
880
+
881
+ # Authentication required
882
+ # Raised on HTTP 401.
883
+ class RevokeSeat401Error < ::Pago::AuthenticationError
884
+ STATUS_CODE = 401
885
+
886
+ # @return [nil] the deserialized error payload.
887
+ def self.from_response(status_code:, body:, response:)
888
+ new(
889
+ "Pago API returned an error: #{status_code} - RevokeSeat401Error",
890
+ status_code: status_code,
891
+ data: body,
892
+ body: body,
893
+ response: response
894
+ )
895
+ end
896
+ end
897
+
898
+ # Not permitted or seat-based pricing not enabled
899
+ # Raised on HTTP 403.
900
+ class RevokeSeat403Error < ::Pago::PermissionDeniedError
901
+ STATUS_CODE = 403
902
+
903
+ # @return [nil] the deserialized error payload.
904
+ def self.from_response(status_code:, body:, response:)
905
+ new(
906
+ "Pago API returned an error: #{status_code} - RevokeSeat403Error",
907
+ status_code: status_code,
908
+ data: body,
909
+ body: body,
910
+ response: response
911
+ )
912
+ end
913
+ end
914
+
915
+ # Seat not found
916
+ # Raised on HTTP 404.
917
+ class RevokeSeat404Error < ::Pago::NotFoundError
918
+ STATUS_CODE = 404
919
+
920
+ # @return [nil] the deserialized error payload.
921
+ def self.from_response(status_code:, body:, response:)
922
+ new(
923
+ "Pago API returned an error: #{status_code} - RevokeSeat404Error",
924
+ status_code: status_code,
925
+ data: body,
926
+ body: body,
927
+ response: response
928
+ )
929
+ end
930
+ end
931
+
932
+ # Cannot enforce SSO without an enabled connection.
933
+ # Raised on HTTP 409.
934
+ class SSOEnforcementRequiresConnection < ::Pago::ConflictError
935
+ STATUS_CODE = 409
936
+
937
+ # @return [Models::SSOEnforcementRequiresConnection] the deserialized error payload.
938
+ def self.from_response(status_code:, body:, response:)
939
+ new(
940
+ "Pago API returned an error: #{status_code} - SSOEnforcementRequiresConnection",
941
+ status_code: status_code,
942
+ data: Models::SSOEnforcementRequiresConnection.from_json(body),
943
+ body: body,
944
+ response: response
945
+ )
946
+ end
947
+ end
948
+
949
+ # Subscription is pending an update.
950
+ # Raised on HTTP 409.
951
+ class SubscriptionLocked < ::Pago::ConflictError
952
+ STATUS_CODE = 409
953
+
954
+ # @return [Models::SubscriptionLocked] the deserialized error payload.
955
+ def self.from_response(status_code:, body:, response:)
956
+ new(
957
+ "Pago API returned an error: #{status_code} - SubscriptionLocked",
958
+ status_code: status_code,
959
+ data: Models::SubscriptionLocked.from_json(body),
960
+ body: body,
961
+ response: response
962
+ )
963
+ end
964
+ end
965
+
966
+ # Not authorized to manage license key.
967
+ # Raised on HTTP 401.
968
+ class Unauthorized < ::Pago::AuthenticationError
969
+ STATUS_CODE = 401
970
+
971
+ # @return [Models::Unauthorized] the deserialized error payload.
972
+ def self.from_response(status_code:, body:, response:)
973
+ new(
974
+ "Pago API returned an error: #{status_code} - Unauthorized",
975
+ status_code: status_code,
976
+ data: Models::Unauthorized.from_json(body),
977
+ body: body,
978
+ response: response
979
+ )
980
+ end
981
+ end
982
+
983
+ # The checkout is expired, the customer already has an active subscription, or the organization is not ready to accept payments.
984
+ # Raised on HTTP 403.
985
+ class Update403Error < ::Pago::PermissionDeniedError
986
+ STATUS_CODE = 403
987
+
988
+ # @return [Object] the deserialized error payload.
989
+ def self.from_response(status_code:, body:, response:)
990
+ new(
991
+ "Pago API returned an error: #{status_code} - Update403Error",
992
+ status_code: status_code,
993
+ data: Unions::CheckoutForbiddenError.from_json(body),
994
+ body: body,
995
+ response: response
996
+ )
997
+ end
998
+ end
999
+
1000
+ # Not Found
1001
+ # Raised on HTTP 404.
1002
+ class Update404Error < ::Pago::NotFoundError
1003
+ STATUS_CODE = 404
1004
+
1005
+ # @return [nil] the deserialized error payload.
1006
+ def self.from_response(status_code:, body:, response:)
1007
+ new(
1008
+ "Pago API returned an error: #{status_code} - Update404Error",
1009
+ status_code: status_code,
1010
+ data: body,
1011
+ body: body,
1012
+ response: response
1013
+ )
1014
+ end
1015
+ end
1016
+
1017
+ # Invalid role change.
1018
+ # Raised on HTTP 400.
1019
+ class UpdateMember400Error < ::Pago::BadRequestError
1020
+ STATUS_CODE = 400
1021
+
1022
+ # @return [nil] the deserialized error payload.
1023
+ def self.from_response(status_code:, body:, response:)
1024
+ new(
1025
+ "Pago API returned an error: #{status_code} - UpdateMember400Error",
1026
+ status_code: status_code,
1027
+ data: body,
1028
+ body: body,
1029
+ response: response
1030
+ )
1031
+ end
1032
+ end
1033
+
1034
+ # Authentication required
1035
+ # Raised on HTTP 401.
1036
+ class UpdateMember401Error < ::Pago::AuthenticationError
1037
+ STATUS_CODE = 401
1038
+
1039
+ # @return [nil] the deserialized error payload.
1040
+ def self.from_response(status_code:, body:, response:)
1041
+ new(
1042
+ "Pago API returned an error: #{status_code} - UpdateMember401Error",
1043
+ status_code: status_code,
1044
+ data: body,
1045
+ body: body,
1046
+ response: response
1047
+ )
1048
+ end
1049
+ end
1050
+
1051
+ # Not permitted - requires owner or billing manager role
1052
+ # Raised on HTTP 403.
1053
+ class UpdateMember403Error < ::Pago::PermissionDeniedError
1054
+ STATUS_CODE = 403
1055
+
1056
+ # @return [nil] the deserialized error payload.
1057
+ def self.from_response(status_code:, body:, response:)
1058
+ new(
1059
+ "Pago API returned an error: #{status_code} - UpdateMember403Error",
1060
+ status_code: status_code,
1061
+ data: body,
1062
+ body: body,
1063
+ response: response
1064
+ )
1065
+ end
1066
+ end
1067
+
1068
+ # Member not found.
1069
+ # Raised on HTTP 404.
1070
+ class UpdateMember404Error < ::Pago::NotFoundError
1071
+ STATUS_CODE = 404
1072
+
1073
+ # @return [nil] the deserialized error payload.
1074
+ def self.from_response(status_code:, body:, response:)
1075
+ new(
1076
+ "Pago API returned an error: #{status_code} - UpdateMember404Error",
1077
+ status_code: status_code,
1078
+ data: body,
1079
+ body: body,
1080
+ response: response
1081
+ )
1082
+ end
1083
+ end
1084
+
1085
+ # Invalid or expired verification token.
1086
+ # Raised on HTTP 401.
1087
+ class VerifyEmailUpdate401Error < ::Pago::AuthenticationError
1088
+ STATUS_CODE = 401
1089
+
1090
+ # @return [nil] the deserialized error payload.
1091
+ def self.from_response(status_code:, body:, response:)
1092
+ new(
1093
+ "Pago API returned an error: #{status_code} - VerifyEmailUpdate401Error",
1094
+ status_code: status_code,
1095
+ data: body,
1096
+ body: body,
1097
+ response: response
1098
+ )
1099
+ end
1100
+ end
1101
+
1102
+ # Email address is already in use.
1103
+ # Raised on HTTP 422.
1104
+ class VerifyEmailUpdate422Error < ::Pago::UnprocessableEntityError
1105
+ STATUS_CODE = 422
1106
+
1107
+ # @return [nil] the deserialized error payload.
1108
+ def self.from_response(status_code:, body:, response:)
1109
+ new(
1110
+ "Pago API returned an error: #{status_code} - VerifyEmailUpdate422Error",
1111
+ status_code: status_code,
1112
+ data: body,
1113
+ body: body,
1114
+ response: response
1115
+ )
1116
+ end
1117
+ end
1118
+
1119
+ end
1120
+ end
1121
+ end