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.
- checksums.yaml +7 -0
- data/LICENSE +21 -0
- data/README.md +131 -0
- data/lib/pago/base_client.rb +116 -0
- data/lib/pago/errors.rb +83 -0
- data/lib/pago/http.rb +78 -0
- data/lib/pago/model.rb +86 -0
- data/lib/pago/paginator.rb +67 -0
- data/lib/pago/serde.rb +186 -0
- data/lib/pago/service.rb +17 -0
- data/lib/pago/v2026_04/client.rb +124 -0
- data/lib/pago/v2026_04/enums.rb +4552 -0
- data/lib/pago/v2026_04/errors.rb +1121 -0
- data/lib/pago/v2026_04/models.rb +46344 -0
- data/lib/pago/v2026_04/services/benefit_grants.rb +48 -0
- data/lib/pago/v2026_04/services/benefits.rb +179 -0
- data/lib/pago/v2026_04/services/checkout_links.rb +131 -0
- data/lib/pago/v2026_04/services/checkouts.rb +185 -0
- data/lib/pago/v2026_04/services/custom_fields.rb +132 -0
- data/lib/pago/v2026_04/services/customer_meters.rb +69 -0
- data/lib/pago/v2026_04/services/customer_portal.rb +1181 -0
- data/lib/pago/v2026_04/services/customer_seats.rb +137 -0
- data/lib/pago/v2026_04/services/customer_sessions.rb +35 -0
- data/lib/pago/v2026_04/services/customers.rb +556 -0
- data/lib/pago/v2026_04/services/discounts.rb +131 -0
- data/lib/pago/v2026_04/services/disputes.rb +93 -0
- data/lib/pago/v2026_04/services/event_types.rb +74 -0
- data/lib/pago/v2026_04/services/events.rb +126 -0
- data/lib/pago/v2026_04/services/files.rb +135 -0
- data/lib/pago/v2026_04/services/license_keys.rb +183 -0
- data/lib/pago/v2026_04/services/members.rb +47 -0
- data/lib/pago/v2026_04/services/meters.rb +142 -0
- data/lib/pago/v2026_04/services/metrics.rb +188 -0
- data/lib/pago/v2026_04/services/oauth2.rb +175 -0
- data/lib/pago/v2026_04/services/orders.rb +238 -0
- data/lib/pago/v2026_04/services/organizations.rb +113 -0
- data/lib/pago/v2026_04/services/payments.rb +72 -0
- data/lib/pago/v2026_04/services/products.rb +142 -0
- data/lib/pago/v2026_04/services/refunds.rb +73 -0
- data/lib/pago/v2026_04/services/subscriptions.rb +171 -0
- data/lib/pago/v2026_04/services/webhooks.rb +212 -0
- data/lib/pago/v2026_04/unions.rb +739 -0
- data/lib/pago/v2026_04/webhooks.rb +86 -0
- data/lib/pago/version.rb +5 -0
- data/lib/pago/webhooks.rb +159 -0
- data/lib/pago.rb +39 -0
- data/sig/pago/v2026_04/generated.rbs +12401 -0
- data/sig/pago.rbs +204 -0
- metadata +91 -0
|
@@ -0,0 +1,1181 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Pago
|
|
4
|
+
module V2026_04
|
|
5
|
+
module Services
|
|
6
|
+
class CustomerPortal < ::Pago::Service
|
|
7
|
+
# @return [BenefitGrants]
|
|
8
|
+
def benefit_grants = @benefit_grants ||= BenefitGrants.new(client)
|
|
9
|
+
|
|
10
|
+
# @return [Customers]
|
|
11
|
+
def customers = @customers ||= Customers.new(client)
|
|
12
|
+
|
|
13
|
+
# @return [CustomerMeters]
|
|
14
|
+
def customer_meters = @customer_meters ||= CustomerMeters.new(client)
|
|
15
|
+
|
|
16
|
+
# @return [Seats]
|
|
17
|
+
def seats = @seats ||= Seats.new(client)
|
|
18
|
+
|
|
19
|
+
# @return [CustomerSession]
|
|
20
|
+
def customer_session = @customer_session ||= CustomerSession.new(client)
|
|
21
|
+
|
|
22
|
+
# @return [Downloadables]
|
|
23
|
+
def downloadables = @downloadables ||= Downloadables.new(client)
|
|
24
|
+
|
|
25
|
+
# @return [LicenseKeys]
|
|
26
|
+
def license_keys = @license_keys ||= LicenseKeys.new(client)
|
|
27
|
+
|
|
28
|
+
# @return [Members]
|
|
29
|
+
def members = @members ||= Members.new(client)
|
|
30
|
+
|
|
31
|
+
# @return [Orders]
|
|
32
|
+
def orders = @orders ||= Orders.new(client)
|
|
33
|
+
|
|
34
|
+
# @return [Organizations]
|
|
35
|
+
def organizations = @organizations ||= Organizations.new(client)
|
|
36
|
+
|
|
37
|
+
# @return [Subscriptions]
|
|
38
|
+
def subscriptions = @subscriptions ||= Subscriptions.new(client)
|
|
39
|
+
|
|
40
|
+
# @return [Wallets]
|
|
41
|
+
def wallets = @wallets ||= Wallets.new(client)
|
|
42
|
+
|
|
43
|
+
class BenefitGrants < ::Pago::Service
|
|
44
|
+
# List benefits grants of the authenticated customer.
|
|
45
|
+
#
|
|
46
|
+
# **Scopes**: `customer_portal:read` `customer_portal:write`
|
|
47
|
+
#
|
|
48
|
+
# @param query [String, nil] Filter by benefit description.
|
|
49
|
+
# @param type [String, Array<String>, nil] Filter by benefit type.
|
|
50
|
+
# @param benefit_id [String, Array<String>, nil] Filter by benefit ID.
|
|
51
|
+
# @param checkout_id [String, Array<String>, nil] Filter by checkout ID.
|
|
52
|
+
# @param order_id [String, Array<String>, nil] Filter by order ID.
|
|
53
|
+
# @param subscription_id [String, Array<String>, nil] Filter by subscription ID.
|
|
54
|
+
# @param member_id [String, Array<String>, nil] Filter by member ID.
|
|
55
|
+
# @param page [Integer] Page number, defaults to 1.
|
|
56
|
+
# @param limit [Integer] Size of a page, defaults to 10. Maximum is 100.
|
|
57
|
+
# @param sorting [Array<String>, nil] Sorting criterion. Several criteria can be used simultaneously and will be applied in order. Add a minus sign `-` before the criteria name to sort by descending order.
|
|
58
|
+
# @raise [Errors::HTTPValidationError] on HTTP 422.
|
|
59
|
+
# @raise [Pago::NetworkError] when the request never reached the API.
|
|
60
|
+
# @return [Models::ListResourceCustomerBenefitGrant]
|
|
61
|
+
def list(query: nil, type: nil, benefit_id: nil, checkout_id: nil, order_id: nil, subscription_id: nil, member_id: nil, page: 1, limit: 10, sorting: ["product_benefit", "-granted_at"])
|
|
62
|
+
data = client.request(
|
|
63
|
+
http_method: "GET",
|
|
64
|
+
path: "/v1/customer-portal/benefit-grants/",
|
|
65
|
+
path_params: {},
|
|
66
|
+
query: { "query" => query, "type" => type, "benefit_id" => benefit_id, "checkout_id" => checkout_id, "order_id" => order_id, "subscription_id" => subscription_id, "member_id" => member_id, "page" => page, "limit" => limit, "sorting" => sorting },
|
|
67
|
+
response_type: :json,
|
|
68
|
+
errors: { 422 => Errors::HTTPValidationError }
|
|
69
|
+
)
|
|
70
|
+
Models::ListResourceCustomerBenefitGrant.from_json(data)
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
# Enumerate every item of `list`, fetching pages on demand.
|
|
74
|
+
#
|
|
75
|
+
# @yieldparam item [Object]
|
|
76
|
+
# @return [Pago::Paginator] when called without a block.
|
|
77
|
+
def list_each(query: nil, type: nil, benefit_id: nil, checkout_id: nil, order_id: nil, subscription_id: nil, member_id: nil, limit: 10, sorting: ["product_benefit", "-granted_at"], &block)
|
|
78
|
+
paginator = ::Pago::Paginator.new do |page_number|
|
|
79
|
+
list(query: query, type: type, benefit_id: benefit_id, checkout_id: checkout_id, order_id: order_id, subscription_id: subscription_id, member_id: member_id, page: page_number, limit: limit, sorting: sorting)
|
|
80
|
+
end
|
|
81
|
+
block ? paginator.each(&block) : paginator
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
# Get a benefit grant by ID for the authenticated customer.
|
|
85
|
+
#
|
|
86
|
+
# **Scopes**: `customer_portal:read` `customer_portal:write`
|
|
87
|
+
#
|
|
88
|
+
# @param id [String] The benefit grant ID.
|
|
89
|
+
# @raise [Errors::ResourceNotFound] on HTTP 404.
|
|
90
|
+
# @raise [Errors::HTTPValidationError] on HTTP 422.
|
|
91
|
+
# @raise [Pago::NetworkError] when the request never reached the API.
|
|
92
|
+
# @return [Object]
|
|
93
|
+
def get(id)
|
|
94
|
+
data = client.request(
|
|
95
|
+
http_method: "GET",
|
|
96
|
+
path: "/v1/customer-portal/benefit-grants/{id}",
|
|
97
|
+
path_params: { "id" => id },
|
|
98
|
+
query: {},
|
|
99
|
+
response_type: :json,
|
|
100
|
+
errors: { 404 => Errors::ResourceNotFound, 422 => Errors::HTTPValidationError }
|
|
101
|
+
)
|
|
102
|
+
Unions::CustomerBenefitGrant.from_json(data)
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
# Update a benefit grant for the authenticated customer.
|
|
106
|
+
#
|
|
107
|
+
# **Scopes**: `customer_portal:write`
|
|
108
|
+
#
|
|
109
|
+
# @param id [String] The benefit grant ID.
|
|
110
|
+
# @param body [Hash, Object] the request body.
|
|
111
|
+
# @raise [Errors::NotPermitted] on HTTP 403.
|
|
112
|
+
# @raise [Errors::ResourceNotFound] on HTTP 404.
|
|
113
|
+
# @raise [Errors::HTTPValidationError] on HTTP 422.
|
|
114
|
+
# @raise [Pago::NetworkError] when the request never reached the API.
|
|
115
|
+
# @return [Object]
|
|
116
|
+
def update(id, body: {})
|
|
117
|
+
data = client.request(
|
|
118
|
+
http_method: "PATCH",
|
|
119
|
+
path: "/v1/customer-portal/benefit-grants/{id}",
|
|
120
|
+
path_params: { "id" => id },
|
|
121
|
+
query: {},
|
|
122
|
+
body: body,
|
|
123
|
+
response_type: :json,
|
|
124
|
+
errors: { 403 => Errors::NotPermitted, 404 => Errors::ResourceNotFound, 422 => Errors::HTTPValidationError }
|
|
125
|
+
)
|
|
126
|
+
Unions::CustomerBenefitGrant.from_json(data)
|
|
127
|
+
end
|
|
128
|
+
|
|
129
|
+
end
|
|
130
|
+
|
|
131
|
+
class Customers < ::Pago::Service
|
|
132
|
+
# Get authenticated customer.
|
|
133
|
+
#
|
|
134
|
+
# **Scopes**: `customer_portal:read` `customer_portal:write`
|
|
135
|
+
#
|
|
136
|
+
# @raise [Pago::NetworkError] when the request never reached the API.
|
|
137
|
+
# @return [Models::CustomerPortalCustomer]
|
|
138
|
+
def get()
|
|
139
|
+
data = client.request(
|
|
140
|
+
http_method: "GET",
|
|
141
|
+
path: "/v1/customer-portal/customers/me",
|
|
142
|
+
path_params: {},
|
|
143
|
+
query: {},
|
|
144
|
+
response_type: :json,
|
|
145
|
+
errors: { }
|
|
146
|
+
)
|
|
147
|
+
Models::CustomerPortalCustomer.from_json(data)
|
|
148
|
+
end
|
|
149
|
+
|
|
150
|
+
# Update authenticated customer.
|
|
151
|
+
#
|
|
152
|
+
# @param body [Hash, Models::CustomerPortalCustomerUpdate] the request body.
|
|
153
|
+
# @raise [Errors::HTTPValidationError] on HTTP 422.
|
|
154
|
+
# @raise [Pago::NetworkError] when the request never reached the API.
|
|
155
|
+
# @return [Models::CustomerPortalCustomer]
|
|
156
|
+
def update(body: {})
|
|
157
|
+
data = client.request(
|
|
158
|
+
http_method: "PATCH",
|
|
159
|
+
path: "/v1/customer-portal/customers/me",
|
|
160
|
+
path_params: {},
|
|
161
|
+
query: {},
|
|
162
|
+
body: body,
|
|
163
|
+
response_type: :json,
|
|
164
|
+
errors: { 422 => Errors::HTTPValidationError }
|
|
165
|
+
)
|
|
166
|
+
Models::CustomerPortalCustomer.from_json(data)
|
|
167
|
+
end
|
|
168
|
+
|
|
169
|
+
# Get saved payment methods of the authenticated customer.
|
|
170
|
+
#
|
|
171
|
+
# @param page [Integer] Page number, defaults to 1.
|
|
172
|
+
# @param limit [Integer] Size of a page, defaults to 10. Maximum is 100.
|
|
173
|
+
# @raise [Errors::HTTPValidationError] on HTTP 422.
|
|
174
|
+
# @raise [Pago::NetworkError] when the request never reached the API.
|
|
175
|
+
# @return [Models::ListResourceCustomerPaymentMethod]
|
|
176
|
+
def list_payment_methods(page: 1, limit: 10)
|
|
177
|
+
data = client.request(
|
|
178
|
+
http_method: "GET",
|
|
179
|
+
path: "/v1/customer-portal/customers/me/payment-methods",
|
|
180
|
+
path_params: {},
|
|
181
|
+
query: { "page" => page, "limit" => limit },
|
|
182
|
+
response_type: :json,
|
|
183
|
+
errors: { 422 => Errors::HTTPValidationError }
|
|
184
|
+
)
|
|
185
|
+
Models::ListResourceCustomerPaymentMethod.from_json(data)
|
|
186
|
+
end
|
|
187
|
+
|
|
188
|
+
# Enumerate every item of `list_payment_methods`, fetching pages on demand.
|
|
189
|
+
#
|
|
190
|
+
# @yieldparam item [Object]
|
|
191
|
+
# @return [Pago::Paginator] when called without a block.
|
|
192
|
+
def list_payment_methods_each(limit: 10, &block)
|
|
193
|
+
paginator = ::Pago::Paginator.new do |page_number|
|
|
194
|
+
list_payment_methods(page: page_number, limit: limit)
|
|
195
|
+
end
|
|
196
|
+
block ? paginator.each(&block) : paginator
|
|
197
|
+
end
|
|
198
|
+
|
|
199
|
+
# Add a payment method to the authenticated customer.
|
|
200
|
+
#
|
|
201
|
+
# @param body [Hash, Models::CustomerPaymentMethodCreate] the request body.
|
|
202
|
+
# @raise [Errors::PaymentMethodSetupFailed] on HTTP 400.
|
|
203
|
+
# @raise [Errors::HTTPValidationError] on HTTP 422.
|
|
204
|
+
# @raise [Pago::NetworkError] when the request never reached the API.
|
|
205
|
+
# @return [Object]
|
|
206
|
+
def add_payment_method(body: {})
|
|
207
|
+
data = client.request(
|
|
208
|
+
http_method: "POST",
|
|
209
|
+
path: "/v1/customer-portal/customers/me/payment-methods",
|
|
210
|
+
path_params: {},
|
|
211
|
+
query: {},
|
|
212
|
+
body: body,
|
|
213
|
+
response_type: :json,
|
|
214
|
+
errors: { 400 => Errors::PaymentMethodSetupFailed, 422 => Errors::HTTPValidationError }
|
|
215
|
+
)
|
|
216
|
+
Unions::CustomerPaymentMethodCreateResponse.from_json(data)
|
|
217
|
+
end
|
|
218
|
+
|
|
219
|
+
# Confirm a payment method for the authenticated customer.
|
|
220
|
+
#
|
|
221
|
+
# @param body [Hash, Models::CustomerPaymentMethodConfirm] the request body.
|
|
222
|
+
# @raise [Errors::CustomerNotReady] on HTTP 400.
|
|
223
|
+
# @raise [Errors::HTTPValidationError] on HTTP 422.
|
|
224
|
+
# @raise [Pago::NetworkError] when the request never reached the API.
|
|
225
|
+
# @return [Object]
|
|
226
|
+
def confirm_payment_method(body: {})
|
|
227
|
+
data = client.request(
|
|
228
|
+
http_method: "POST",
|
|
229
|
+
path: "/v1/customer-portal/customers/me/payment-methods/confirm",
|
|
230
|
+
path_params: {},
|
|
231
|
+
query: {},
|
|
232
|
+
body: body,
|
|
233
|
+
response_type: :json,
|
|
234
|
+
errors: { 400 => Errors::CustomerNotReady, 422 => Errors::HTTPValidationError }
|
|
235
|
+
)
|
|
236
|
+
Unions::CustomerPaymentMethodCreateResponse.from_json(data)
|
|
237
|
+
end
|
|
238
|
+
|
|
239
|
+
# Delete a payment method from the authenticated customer.
|
|
240
|
+
#
|
|
241
|
+
# @param id [String]
|
|
242
|
+
# @raise [Errors::PaymentMethodInUseByActiveSubscription] on HTTP 400.
|
|
243
|
+
# @raise [Errors::ResourceNotFound] on HTTP 404.
|
|
244
|
+
# @raise [Errors::HTTPValidationError] on HTTP 422.
|
|
245
|
+
# @raise [Pago::NetworkError] when the request never reached the API.
|
|
246
|
+
# @return [nil]
|
|
247
|
+
def delete_payment_method(id)
|
|
248
|
+
client.request(
|
|
249
|
+
http_method: "DELETE",
|
|
250
|
+
path: "/v1/customer-portal/customers/me/payment-methods/{id}",
|
|
251
|
+
path_params: { "id" => id },
|
|
252
|
+
query: {},
|
|
253
|
+
response_type: :none,
|
|
254
|
+
errors: { 400 => Errors::PaymentMethodInUseByActiveSubscription, 404 => Errors::ResourceNotFound, 422 => Errors::HTTPValidationError }
|
|
255
|
+
)
|
|
256
|
+
end
|
|
257
|
+
|
|
258
|
+
# Request an email change for the authenticated customer.
|
|
259
|
+
#
|
|
260
|
+
# @param body [Hash, Models::CustomerEmailUpdateRequest] the request body.
|
|
261
|
+
# @raise [Errors::HTTPValidationError] on HTTP 422.
|
|
262
|
+
# @raise [Pago::NetworkError] when the request never reached the API.
|
|
263
|
+
# @return [Object]
|
|
264
|
+
def request_email_update(body: {})
|
|
265
|
+
data = client.request(
|
|
266
|
+
http_method: "POST",
|
|
267
|
+
path: "/v1/customer-portal/customers/me/email-update/request",
|
|
268
|
+
path_params: {},
|
|
269
|
+
query: {},
|
|
270
|
+
body: body,
|
|
271
|
+
response_type: :json,
|
|
272
|
+
errors: { 422 => Errors::HTTPValidationError }
|
|
273
|
+
)
|
|
274
|
+
data
|
|
275
|
+
end
|
|
276
|
+
|
|
277
|
+
# Check if an email change verification token is still valid.
|
|
278
|
+
#
|
|
279
|
+
# @param token [String]
|
|
280
|
+
# @raise [Errors::CheckEmailUpdate401Error] on HTTP 401.
|
|
281
|
+
# @raise [Errors::HTTPValidationError] on HTTP 422.
|
|
282
|
+
# @raise [Pago::NetworkError] when the request never reached the API.
|
|
283
|
+
# @return [nil]
|
|
284
|
+
def check_email_update(token:)
|
|
285
|
+
client.request(
|
|
286
|
+
http_method: "GET",
|
|
287
|
+
path: "/v1/customer-portal/customers/me/email-update/check",
|
|
288
|
+
path_params: {},
|
|
289
|
+
query: { "token" => token },
|
|
290
|
+
response_type: :none,
|
|
291
|
+
errors: { 401 => Errors::CheckEmailUpdate401Error, 422 => Errors::HTTPValidationError }
|
|
292
|
+
)
|
|
293
|
+
end
|
|
294
|
+
|
|
295
|
+
# Verify an email change using the token from the verification email.
|
|
296
|
+
#
|
|
297
|
+
# @param body [Hash, Models::CustomerEmailUpdateVerifyRequest] the request body.
|
|
298
|
+
# @raise [Errors::VerifyEmailUpdate401Error] on HTTP 401.
|
|
299
|
+
# @raise [Errors::VerifyEmailUpdate422Error] on HTTP 422.
|
|
300
|
+
# @raise [Pago::NetworkError] when the request never reached the API.
|
|
301
|
+
# @return [Models::CustomerEmailUpdateVerifyResponse]
|
|
302
|
+
def verify_email_update(body: {})
|
|
303
|
+
data = client.request(
|
|
304
|
+
http_method: "POST",
|
|
305
|
+
path: "/v1/customer-portal/customers/me/email-update/verify",
|
|
306
|
+
path_params: {},
|
|
307
|
+
query: {},
|
|
308
|
+
body: body,
|
|
309
|
+
response_type: :json,
|
|
310
|
+
errors: { 401 => Errors::VerifyEmailUpdate401Error, 422 => Errors::VerifyEmailUpdate422Error }
|
|
311
|
+
)
|
|
312
|
+
Models::CustomerEmailUpdateVerifyResponse.from_json(data)
|
|
313
|
+
end
|
|
314
|
+
|
|
315
|
+
end
|
|
316
|
+
|
|
317
|
+
class CustomerMeters < ::Pago::Service
|
|
318
|
+
# List meters of the authenticated customer.
|
|
319
|
+
#
|
|
320
|
+
# **Scopes**: `customer_portal:read` `customer_portal:write`
|
|
321
|
+
#
|
|
322
|
+
# @param meter_id [String, Array<String>, nil] Filter by meter ID.
|
|
323
|
+
# @param query [String, nil] Filter by meter name.
|
|
324
|
+
# @param page [Integer] Page number, defaults to 1.
|
|
325
|
+
# @param limit [Integer] Size of a page, defaults to 10. Maximum is 100.
|
|
326
|
+
# @param sorting [Array<String>, nil] Sorting criterion. Several criteria can be used simultaneously and will be applied in order. Add a minus sign `-` before the criteria name to sort by descending order.
|
|
327
|
+
# @raise [Errors::HTTPValidationError] on HTTP 422.
|
|
328
|
+
# @raise [Pago::NetworkError] when the request never reached the API.
|
|
329
|
+
# @return [Models::ListResourceCustomerCustomerMeter]
|
|
330
|
+
def list(meter_id: nil, query: nil, page: 1, limit: 10, sorting: ["-modified_at"])
|
|
331
|
+
data = client.request(
|
|
332
|
+
http_method: "GET",
|
|
333
|
+
path: "/v1/customer-portal/meters/",
|
|
334
|
+
path_params: {},
|
|
335
|
+
query: { "meter_id" => meter_id, "query" => query, "page" => page, "limit" => limit, "sorting" => sorting },
|
|
336
|
+
response_type: :json,
|
|
337
|
+
errors: { 422 => Errors::HTTPValidationError }
|
|
338
|
+
)
|
|
339
|
+
Models::ListResourceCustomerCustomerMeter.from_json(data)
|
|
340
|
+
end
|
|
341
|
+
|
|
342
|
+
# Enumerate every item of `list`, fetching pages on demand.
|
|
343
|
+
#
|
|
344
|
+
# @yieldparam item [Models::CustomerCustomerMeter]
|
|
345
|
+
# @return [Pago::Paginator] when called without a block.
|
|
346
|
+
def list_each(meter_id: nil, query: nil, limit: 10, sorting: ["-modified_at"], &block)
|
|
347
|
+
paginator = ::Pago::Paginator.new do |page_number|
|
|
348
|
+
list(meter_id: meter_id, query: query, page: page_number, limit: limit, sorting: sorting)
|
|
349
|
+
end
|
|
350
|
+
block ? paginator.each(&block) : paginator
|
|
351
|
+
end
|
|
352
|
+
|
|
353
|
+
# Get a meter by ID for the authenticated customer.
|
|
354
|
+
#
|
|
355
|
+
# **Scopes**: `customer_portal:read` `customer_portal:write`
|
|
356
|
+
#
|
|
357
|
+
# @param id [String] The customer meter ID.
|
|
358
|
+
# @raise [Errors::ResourceNotFound] on HTTP 404.
|
|
359
|
+
# @raise [Errors::HTTPValidationError] on HTTP 422.
|
|
360
|
+
# @raise [Pago::NetworkError] when the request never reached the API.
|
|
361
|
+
# @return [Models::CustomerCustomerMeter]
|
|
362
|
+
def get(id)
|
|
363
|
+
data = client.request(
|
|
364
|
+
http_method: "GET",
|
|
365
|
+
path: "/v1/customer-portal/meters/{id}",
|
|
366
|
+
path_params: { "id" => id },
|
|
367
|
+
query: {},
|
|
368
|
+
response_type: :json,
|
|
369
|
+
errors: { 404 => Errors::ResourceNotFound, 422 => Errors::HTTPValidationError }
|
|
370
|
+
)
|
|
371
|
+
Models::CustomerCustomerMeter.from_json(data)
|
|
372
|
+
end
|
|
373
|
+
|
|
374
|
+
end
|
|
375
|
+
|
|
376
|
+
class Seats < ::Pago::Service
|
|
377
|
+
# **Scopes**: `customer_portal:read` `customer_portal:write`
|
|
378
|
+
#
|
|
379
|
+
# @param subscription_id [String, nil] Subscription ID
|
|
380
|
+
# @param order_id [String, nil] Order ID
|
|
381
|
+
# @raise [Errors::ListSeats401Error] on HTTP 401.
|
|
382
|
+
# @raise [Errors::ListSeats403Error] on HTTP 403.
|
|
383
|
+
# @raise [Errors::ListSeats404Error] on HTTP 404.
|
|
384
|
+
# @raise [Errors::HTTPValidationError] on HTTP 422.
|
|
385
|
+
# @raise [Pago::NetworkError] when the request never reached the API.
|
|
386
|
+
# @return [Models::SeatsList]
|
|
387
|
+
def list_seats(subscription_id: nil, order_id: nil)
|
|
388
|
+
data = client.request(
|
|
389
|
+
http_method: "GET",
|
|
390
|
+
path: "/v1/customer-portal/seats",
|
|
391
|
+
path_params: {},
|
|
392
|
+
query: { "subscription_id" => subscription_id, "order_id" => order_id },
|
|
393
|
+
response_type: :json,
|
|
394
|
+
errors: { 401 => Errors::ListSeats401Error, 403 => Errors::ListSeats403Error, 404 => Errors::ListSeats404Error, 422 => Errors::HTTPValidationError }
|
|
395
|
+
)
|
|
396
|
+
Models::SeatsList.from_json(data)
|
|
397
|
+
end
|
|
398
|
+
|
|
399
|
+
# @param body [Hash, Models::CustomerSeatAssign] the request body.
|
|
400
|
+
# @raise [Errors::AssignSeat400Error] on HTTP 400.
|
|
401
|
+
# @raise [Errors::AssignSeat401Error] on HTTP 401.
|
|
402
|
+
# @raise [Errors::AssignSeat403Error] on HTTP 403.
|
|
403
|
+
# @raise [Errors::AssignSeat404Error] on HTTP 404.
|
|
404
|
+
# @raise [Errors::HTTPValidationError] on HTTP 422.
|
|
405
|
+
# @raise [Pago::NetworkError] when the request never reached the API.
|
|
406
|
+
# @return [Models::CustomerSeat]
|
|
407
|
+
def assign_seat(body: {})
|
|
408
|
+
data = client.request(
|
|
409
|
+
http_method: "POST",
|
|
410
|
+
path: "/v1/customer-portal/seats",
|
|
411
|
+
path_params: {},
|
|
412
|
+
query: {},
|
|
413
|
+
body: body,
|
|
414
|
+
response_type: :json,
|
|
415
|
+
errors: { 400 => Errors::AssignSeat400Error, 401 => Errors::AssignSeat401Error, 403 => Errors::AssignSeat403Error, 404 => Errors::AssignSeat404Error, 422 => Errors::HTTPValidationError }
|
|
416
|
+
)
|
|
417
|
+
Models::CustomerSeat.from_json(data)
|
|
418
|
+
end
|
|
419
|
+
|
|
420
|
+
# @param seat_id [String]
|
|
421
|
+
# @raise [Errors::RevokeSeat401Error] on HTTP 401.
|
|
422
|
+
# @raise [Errors::RevokeSeat403Error] on HTTP 403.
|
|
423
|
+
# @raise [Errors::RevokeSeat404Error] on HTTP 404.
|
|
424
|
+
# @raise [Errors::HTTPValidationError] on HTTP 422.
|
|
425
|
+
# @raise [Pago::NetworkError] when the request never reached the API.
|
|
426
|
+
# @return [Models::CustomerSeat]
|
|
427
|
+
def revoke_seat(seat_id)
|
|
428
|
+
data = client.request(
|
|
429
|
+
http_method: "DELETE",
|
|
430
|
+
path: "/v1/customer-portal/seats/{seat_id}",
|
|
431
|
+
path_params: { "seat_id" => seat_id },
|
|
432
|
+
query: {},
|
|
433
|
+
response_type: :json,
|
|
434
|
+
errors: { 401 => Errors::RevokeSeat401Error, 403 => Errors::RevokeSeat403Error, 404 => Errors::RevokeSeat404Error, 422 => Errors::HTTPValidationError }
|
|
435
|
+
)
|
|
436
|
+
Models::CustomerSeat.from_json(data)
|
|
437
|
+
end
|
|
438
|
+
|
|
439
|
+
# @param seat_id [String]
|
|
440
|
+
# @raise [Errors::ResendInvitation400Error] on HTTP 400.
|
|
441
|
+
# @raise [Errors::ResendInvitation401Error] on HTTP 401.
|
|
442
|
+
# @raise [Errors::ResendInvitation403Error] on HTTP 403.
|
|
443
|
+
# @raise [Errors::ResendInvitation404Error] on HTTP 404.
|
|
444
|
+
# @raise [Errors::HTTPValidationError] on HTTP 422.
|
|
445
|
+
# @raise [Pago::NetworkError] when the request never reached the API.
|
|
446
|
+
# @return [Models::CustomerSeat]
|
|
447
|
+
def resend_invitation(seat_id)
|
|
448
|
+
data = client.request(
|
|
449
|
+
http_method: "POST",
|
|
450
|
+
path: "/v1/customer-portal/seats/{seat_id}/resend",
|
|
451
|
+
path_params: { "seat_id" => seat_id },
|
|
452
|
+
query: {},
|
|
453
|
+
response_type: :json,
|
|
454
|
+
errors: { 400 => Errors::ResendInvitation400Error, 401 => Errors::ResendInvitation401Error, 403 => Errors::ResendInvitation403Error, 404 => Errors::ResendInvitation404Error, 422 => Errors::HTTPValidationError }
|
|
455
|
+
)
|
|
456
|
+
Models::CustomerSeat.from_json(data)
|
|
457
|
+
end
|
|
458
|
+
|
|
459
|
+
# List all subscriptions where the authenticated customer has claimed a seat.
|
|
460
|
+
#
|
|
461
|
+
# **Scopes**: `customer_portal:read` `customer_portal:write`
|
|
462
|
+
#
|
|
463
|
+
# @param page [Integer] Page number, defaults to 1.
|
|
464
|
+
# @param limit [Integer] Size of a page, defaults to 10. Maximum is 100.
|
|
465
|
+
# @raise [Errors::ListClaimedSubscriptions401Error] on HTTP 401.
|
|
466
|
+
# @raise [Errors::HTTPValidationError] on HTTP 422.
|
|
467
|
+
# @raise [Pago::NetworkError] when the request never reached the API.
|
|
468
|
+
# @return [Models::ListResourceCustomerSubscription]
|
|
469
|
+
def list_claimed_subscriptions(page: 1, limit: 10)
|
|
470
|
+
data = client.request(
|
|
471
|
+
http_method: "GET",
|
|
472
|
+
path: "/v1/customer-portal/seats/subscriptions",
|
|
473
|
+
path_params: {},
|
|
474
|
+
query: { "page" => page, "limit" => limit },
|
|
475
|
+
response_type: :json,
|
|
476
|
+
errors: { 401 => Errors::ListClaimedSubscriptions401Error, 422 => Errors::HTTPValidationError }
|
|
477
|
+
)
|
|
478
|
+
Models::ListResourceCustomerSubscription.from_json(data)
|
|
479
|
+
end
|
|
480
|
+
|
|
481
|
+
# Enumerate every item of `list_claimed_subscriptions`, fetching pages on demand.
|
|
482
|
+
#
|
|
483
|
+
# @yieldparam item [Models::CustomerSubscription]
|
|
484
|
+
# @return [Pago::Paginator] when called without a block.
|
|
485
|
+
def list_claimed_subscriptions_each(limit: 10, &block)
|
|
486
|
+
paginator = ::Pago::Paginator.new do |page_number|
|
|
487
|
+
list_claimed_subscriptions(page: page_number, limit: limit)
|
|
488
|
+
end
|
|
489
|
+
block ? paginator.each(&block) : paginator
|
|
490
|
+
end
|
|
491
|
+
|
|
492
|
+
end
|
|
493
|
+
|
|
494
|
+
class CustomerSession < ::Pago::Service
|
|
495
|
+
# Introspect the current session and return its information.
|
|
496
|
+
#
|
|
497
|
+
# **Scopes**: `customer_portal:read` `customer_portal:write`
|
|
498
|
+
#
|
|
499
|
+
# @raise [Pago::NetworkError] when the request never reached the API.
|
|
500
|
+
# @return [Models::CustomerCustomerSession]
|
|
501
|
+
def introspect()
|
|
502
|
+
data = client.request(
|
|
503
|
+
http_method: "GET",
|
|
504
|
+
path: "/v1/customer-portal/customer-session/introspect",
|
|
505
|
+
path_params: {},
|
|
506
|
+
query: {},
|
|
507
|
+
response_type: :json,
|
|
508
|
+
errors: { }
|
|
509
|
+
)
|
|
510
|
+
Models::CustomerCustomerSession.from_json(data)
|
|
511
|
+
end
|
|
512
|
+
|
|
513
|
+
# Get information about the currently authenticated portal user.
|
|
514
|
+
#
|
|
515
|
+
# **Scopes**: `customer_portal:read` `customer_portal:write`
|
|
516
|
+
#
|
|
517
|
+
# @raise [Pago::NetworkError] when the request never reached the API.
|
|
518
|
+
# @return [Models::PortalAuthenticatedUser]
|
|
519
|
+
def get_authenticated_user()
|
|
520
|
+
data = client.request(
|
|
521
|
+
http_method: "GET",
|
|
522
|
+
path: "/v1/customer-portal/customer-session/user",
|
|
523
|
+
path_params: {},
|
|
524
|
+
query: {},
|
|
525
|
+
response_type: :json,
|
|
526
|
+
errors: { }
|
|
527
|
+
)
|
|
528
|
+
Models::PortalAuthenticatedUser.from_json(data)
|
|
529
|
+
end
|
|
530
|
+
|
|
531
|
+
end
|
|
532
|
+
|
|
533
|
+
class Downloadables < ::Pago::Service
|
|
534
|
+
# **Scopes**: `customer_portal:read` `customer_portal:write`
|
|
535
|
+
#
|
|
536
|
+
# @param benefit_id [String, Array<String>, nil] Filter by benefit ID.
|
|
537
|
+
# @param page [Integer] Page number, defaults to 1.
|
|
538
|
+
# @param limit [Integer] Size of a page, defaults to 10. Maximum is 100.
|
|
539
|
+
# @raise [Errors::HTTPValidationError] on HTTP 422.
|
|
540
|
+
# @raise [Pago::NetworkError] when the request never reached the API.
|
|
541
|
+
# @return [Models::ListResourceDownloadableRead]
|
|
542
|
+
def list(benefit_id: nil, page: 1, limit: 10)
|
|
543
|
+
data = client.request(
|
|
544
|
+
http_method: "GET",
|
|
545
|
+
path: "/v1/customer-portal/downloadables/",
|
|
546
|
+
path_params: {},
|
|
547
|
+
query: { "benefit_id" => benefit_id, "page" => page, "limit" => limit },
|
|
548
|
+
response_type: :json,
|
|
549
|
+
errors: { 422 => Errors::HTTPValidationError }
|
|
550
|
+
)
|
|
551
|
+
Models::ListResourceDownloadableRead.from_json(data)
|
|
552
|
+
end
|
|
553
|
+
|
|
554
|
+
# Enumerate every item of `list`, fetching pages on demand.
|
|
555
|
+
#
|
|
556
|
+
# @yieldparam item [Models::DownloadableRead]
|
|
557
|
+
# @return [Pago::Paginator] when called without a block.
|
|
558
|
+
def list_each(benefit_id: nil, limit: 10, &block)
|
|
559
|
+
paginator = ::Pago::Paginator.new do |page_number|
|
|
560
|
+
list(benefit_id: benefit_id, page: page_number, limit: limit)
|
|
561
|
+
end
|
|
562
|
+
block ? paginator.each(&block) : paginator
|
|
563
|
+
end
|
|
564
|
+
|
|
565
|
+
end
|
|
566
|
+
|
|
567
|
+
class LicenseKeys < ::Pago::Service
|
|
568
|
+
# **Scopes**: `customer_portal:read` `customer_portal:write`
|
|
569
|
+
#
|
|
570
|
+
# @param benefit_id [String, nil] Filter by a specific benefit
|
|
571
|
+
# @param page [Integer] Page number, defaults to 1.
|
|
572
|
+
# @param limit [Integer] Size of a page, defaults to 10. Maximum is 100.
|
|
573
|
+
# @raise [Errors::Unauthorized] on HTTP 401.
|
|
574
|
+
# @raise [Errors::ResourceNotFound] on HTTP 404.
|
|
575
|
+
# @raise [Errors::HTTPValidationError] on HTTP 422.
|
|
576
|
+
# @raise [Pago::NetworkError] when the request never reached the API.
|
|
577
|
+
# @return [Models::ListResourceLicenseKeyRead]
|
|
578
|
+
def list(benefit_id: nil, page: 1, limit: 10)
|
|
579
|
+
data = client.request(
|
|
580
|
+
http_method: "GET",
|
|
581
|
+
path: "/v1/customer-portal/license-keys/",
|
|
582
|
+
path_params: {},
|
|
583
|
+
query: { "benefit_id" => benefit_id, "page" => page, "limit" => limit },
|
|
584
|
+
response_type: :json,
|
|
585
|
+
errors: { 401 => Errors::Unauthorized, 404 => Errors::ResourceNotFound, 422 => Errors::HTTPValidationError }
|
|
586
|
+
)
|
|
587
|
+
Models::ListResourceLicenseKeyRead.from_json(data)
|
|
588
|
+
end
|
|
589
|
+
|
|
590
|
+
# Enumerate every item of `list`, fetching pages on demand.
|
|
591
|
+
#
|
|
592
|
+
# @yieldparam item [Models::LicenseKeyRead]
|
|
593
|
+
# @return [Pago::Paginator] when called without a block.
|
|
594
|
+
def list_each(benefit_id: nil, limit: 10, &block)
|
|
595
|
+
paginator = ::Pago::Paginator.new do |page_number|
|
|
596
|
+
list(benefit_id: benefit_id, page: page_number, limit: limit)
|
|
597
|
+
end
|
|
598
|
+
block ? paginator.each(&block) : paginator
|
|
599
|
+
end
|
|
600
|
+
|
|
601
|
+
# Get a license key.
|
|
602
|
+
#
|
|
603
|
+
# **Scopes**: `customer_portal:read` `customer_portal:write`
|
|
604
|
+
#
|
|
605
|
+
# @param id [String]
|
|
606
|
+
# @raise [Errors::ResourceNotFound] on HTTP 404.
|
|
607
|
+
# @raise [Errors::HTTPValidationError] on HTTP 422.
|
|
608
|
+
# @raise [Pago::NetworkError] when the request never reached the API.
|
|
609
|
+
# @return [Models::LicenseKeyWithActivations]
|
|
610
|
+
def get(id)
|
|
611
|
+
data = client.request(
|
|
612
|
+
http_method: "GET",
|
|
613
|
+
path: "/v1/customer-portal/license-keys/{id}",
|
|
614
|
+
path_params: { "id" => id },
|
|
615
|
+
query: {},
|
|
616
|
+
response_type: :json,
|
|
617
|
+
errors: { 404 => Errors::ResourceNotFound, 422 => Errors::HTTPValidationError }
|
|
618
|
+
)
|
|
619
|
+
Models::LicenseKeyWithActivations.from_json(data)
|
|
620
|
+
end
|
|
621
|
+
|
|
622
|
+
# Validate a license key.
|
|
623
|
+
#
|
|
624
|
+
# > This endpoint doesn't require authentication and can be safely used on a public
|
|
625
|
+
# > client, like a desktop application or a mobile app.
|
|
626
|
+
# > If you plan to validate a license key on a server, use the `/v1/license-keys/validate`
|
|
627
|
+
# > endpoint instead.
|
|
628
|
+
#
|
|
629
|
+
# @param body [Hash, Models::LicenseKeyValidate] the request body.
|
|
630
|
+
# @raise [Errors::ResourceNotFound] on HTTP 404.
|
|
631
|
+
# @raise [Errors::HTTPValidationError] on HTTP 422.
|
|
632
|
+
# @raise [Pago::NetworkError] when the request never reached the API.
|
|
633
|
+
# @return [Models::ValidatedLicenseKey]
|
|
634
|
+
def validate(body: {})
|
|
635
|
+
data = client.request(
|
|
636
|
+
http_method: "POST",
|
|
637
|
+
path: "/v1/customer-portal/license-keys/validate",
|
|
638
|
+
path_params: {},
|
|
639
|
+
query: {},
|
|
640
|
+
body: body,
|
|
641
|
+
response_type: :json,
|
|
642
|
+
errors: { 404 => Errors::ResourceNotFound, 422 => Errors::HTTPValidationError }
|
|
643
|
+
)
|
|
644
|
+
Models::ValidatedLicenseKey.from_json(data)
|
|
645
|
+
end
|
|
646
|
+
|
|
647
|
+
# Activate a license key instance.
|
|
648
|
+
#
|
|
649
|
+
# > This endpoint doesn't require authentication and can be safely used on a public
|
|
650
|
+
# > client, like a desktop application or a mobile app.
|
|
651
|
+
# > If you plan to validate a license key on a server, use the `/v1/license-keys/activate`
|
|
652
|
+
# > endpoint instead.
|
|
653
|
+
#
|
|
654
|
+
# @param body [Hash, Models::LicenseKeyActivate] the request body.
|
|
655
|
+
# @raise [Errors::NotPermitted] on HTTP 403.
|
|
656
|
+
# @raise [Errors::ResourceNotFound] on HTTP 404.
|
|
657
|
+
# @raise [Errors::HTTPValidationError] on HTTP 422.
|
|
658
|
+
# @raise [Pago::NetworkError] when the request never reached the API.
|
|
659
|
+
# @return [Models::LicenseKeyActivationRead]
|
|
660
|
+
def activate(body: {})
|
|
661
|
+
data = client.request(
|
|
662
|
+
http_method: "POST",
|
|
663
|
+
path: "/v1/customer-portal/license-keys/activate",
|
|
664
|
+
path_params: {},
|
|
665
|
+
query: {},
|
|
666
|
+
body: body,
|
|
667
|
+
response_type: :json,
|
|
668
|
+
errors: { 403 => Errors::NotPermitted, 404 => Errors::ResourceNotFound, 422 => Errors::HTTPValidationError }
|
|
669
|
+
)
|
|
670
|
+
Models::LicenseKeyActivationRead.from_json(data)
|
|
671
|
+
end
|
|
672
|
+
|
|
673
|
+
# Deactivate a license key instance.
|
|
674
|
+
#
|
|
675
|
+
# > This endpoint doesn't require authentication and can be safely used on a public
|
|
676
|
+
# > client, like a desktop application or a mobile app.
|
|
677
|
+
# > If you plan to validate a license key on a server, use the `/v1/license-keys/deactivate`
|
|
678
|
+
# > endpoint instead.
|
|
679
|
+
#
|
|
680
|
+
# @param body [Hash, Models::LicenseKeyDeactivate] the request body.
|
|
681
|
+
# @raise [Errors::ResourceNotFound] on HTTP 404.
|
|
682
|
+
# @raise [Errors::HTTPValidationError] on HTTP 422.
|
|
683
|
+
# @raise [Pago::NetworkError] when the request never reached the API.
|
|
684
|
+
# @return [nil]
|
|
685
|
+
def deactivate(body: {})
|
|
686
|
+
client.request(
|
|
687
|
+
http_method: "POST",
|
|
688
|
+
path: "/v1/customer-portal/license-keys/deactivate",
|
|
689
|
+
path_params: {},
|
|
690
|
+
query: {},
|
|
691
|
+
body: body,
|
|
692
|
+
response_type: :none,
|
|
693
|
+
errors: { 404 => Errors::ResourceNotFound, 422 => Errors::HTTPValidationError }
|
|
694
|
+
)
|
|
695
|
+
end
|
|
696
|
+
|
|
697
|
+
end
|
|
698
|
+
|
|
699
|
+
class Members < ::Pago::Service
|
|
700
|
+
# List all members of the customer's team.
|
|
701
|
+
#
|
|
702
|
+
# Only available to owners and billing managers of team customers.
|
|
703
|
+
#
|
|
704
|
+
# @param page [Integer] Page number, defaults to 1.
|
|
705
|
+
# @param limit [Integer] Size of a page, defaults to 10. Maximum is 100.
|
|
706
|
+
# @raise [Errors::ListMembers401Error] on HTTP 401.
|
|
707
|
+
# @raise [Errors::ListMembers403Error] on HTTP 403.
|
|
708
|
+
# @raise [Errors::HTTPValidationError] on HTTP 422.
|
|
709
|
+
# @raise [Pago::NetworkError] when the request never reached the API.
|
|
710
|
+
# @return [Models::ListResourceCustomerPortalMember]
|
|
711
|
+
def list_members(page: 1, limit: 10)
|
|
712
|
+
data = client.request(
|
|
713
|
+
http_method: "GET",
|
|
714
|
+
path: "/v1/customer-portal/members",
|
|
715
|
+
path_params: {},
|
|
716
|
+
query: { "page" => page, "limit" => limit },
|
|
717
|
+
response_type: :json,
|
|
718
|
+
errors: { 401 => Errors::ListMembers401Error, 403 => Errors::ListMembers403Error, 422 => Errors::HTTPValidationError }
|
|
719
|
+
)
|
|
720
|
+
Models::ListResourceCustomerPortalMember.from_json(data)
|
|
721
|
+
end
|
|
722
|
+
|
|
723
|
+
# Enumerate every item of `list_members`, fetching pages on demand.
|
|
724
|
+
#
|
|
725
|
+
# @yieldparam item [Models::CustomerPortalMember]
|
|
726
|
+
# @return [Pago::Paginator] when called without a block.
|
|
727
|
+
def list_members_each(limit: 10, &block)
|
|
728
|
+
paginator = ::Pago::Paginator.new do |page_number|
|
|
729
|
+
list_members(page: page_number, limit: limit)
|
|
730
|
+
end
|
|
731
|
+
block ? paginator.each(&block) : paginator
|
|
732
|
+
end
|
|
733
|
+
|
|
734
|
+
# Add a new member to the customer's team.
|
|
735
|
+
#
|
|
736
|
+
# Only available to owners and billing managers of team customers.
|
|
737
|
+
#
|
|
738
|
+
# Rules:
|
|
739
|
+
# - Cannot add a member with the owner role (there must be exactly one owner)
|
|
740
|
+
# - If a member with this email already exists, the existing member is returned
|
|
741
|
+
#
|
|
742
|
+
# @param body [Hash, Models::CustomerPortalMemberCreate] the request body.
|
|
743
|
+
# @raise [Errors::AddMember400Error] on HTTP 400.
|
|
744
|
+
# @raise [Errors::AddMember401Error] on HTTP 401.
|
|
745
|
+
# @raise [Errors::AddMember403Error] on HTTP 403.
|
|
746
|
+
# @raise [Errors::HTTPValidationError] on HTTP 422.
|
|
747
|
+
# @raise [Pago::NetworkError] when the request never reached the API.
|
|
748
|
+
# @return [Models::CustomerPortalMember]
|
|
749
|
+
def add_member(body: {})
|
|
750
|
+
data = client.request(
|
|
751
|
+
http_method: "POST",
|
|
752
|
+
path: "/v1/customer-portal/members",
|
|
753
|
+
path_params: {},
|
|
754
|
+
query: {},
|
|
755
|
+
body: body,
|
|
756
|
+
response_type: :json,
|
|
757
|
+
errors: { 400 => Errors::AddMember400Error, 401 => Errors::AddMember401Error, 403 => Errors::AddMember403Error, 422 => Errors::HTTPValidationError }
|
|
758
|
+
)
|
|
759
|
+
Models::CustomerPortalMember.from_json(data)
|
|
760
|
+
end
|
|
761
|
+
|
|
762
|
+
# Remove a member from the team.
|
|
763
|
+
#
|
|
764
|
+
# Only available to owners and billing managers of team customers.
|
|
765
|
+
#
|
|
766
|
+
# Rules:
|
|
767
|
+
# - Cannot remove yourself
|
|
768
|
+
# - Cannot remove the only owner
|
|
769
|
+
#
|
|
770
|
+
# @param id [String]
|
|
771
|
+
# @raise [Errors::RemoveMember400Error] on HTTP 400.
|
|
772
|
+
# @raise [Errors::RemoveMember401Error] on HTTP 401.
|
|
773
|
+
# @raise [Errors::RemoveMember403Error] on HTTP 403.
|
|
774
|
+
# @raise [Errors::RemoveMember404Error] on HTTP 404.
|
|
775
|
+
# @raise [Errors::HTTPValidationError] on HTTP 422.
|
|
776
|
+
# @raise [Pago::NetworkError] when the request never reached the API.
|
|
777
|
+
# @return [nil]
|
|
778
|
+
def remove_member(id)
|
|
779
|
+
client.request(
|
|
780
|
+
http_method: "DELETE",
|
|
781
|
+
path: "/v1/customer-portal/members/{id}",
|
|
782
|
+
path_params: { "id" => id },
|
|
783
|
+
query: {},
|
|
784
|
+
response_type: :none,
|
|
785
|
+
errors: { 400 => Errors::RemoveMember400Error, 401 => Errors::RemoveMember401Error, 403 => Errors::RemoveMember403Error, 404 => Errors::RemoveMember404Error, 422 => Errors::HTTPValidationError }
|
|
786
|
+
)
|
|
787
|
+
end
|
|
788
|
+
|
|
789
|
+
# Update a member's name or role.
|
|
790
|
+
#
|
|
791
|
+
# Only available to owners and billing managers of team customers.
|
|
792
|
+
#
|
|
793
|
+
# Rules:
|
|
794
|
+
# - Cannot modify your own role (to prevent self-demotion)
|
|
795
|
+
# - Customer must have exactly one owner at all times
|
|
796
|
+
#
|
|
797
|
+
# @param id [String]
|
|
798
|
+
# @param body [Hash, Models::CustomerPortalMemberUpdate] the request body.
|
|
799
|
+
# @raise [Errors::UpdateMember400Error] on HTTP 400.
|
|
800
|
+
# @raise [Errors::UpdateMember401Error] on HTTP 401.
|
|
801
|
+
# @raise [Errors::UpdateMember403Error] on HTTP 403.
|
|
802
|
+
# @raise [Errors::UpdateMember404Error] on HTTP 404.
|
|
803
|
+
# @raise [Errors::HTTPValidationError] on HTTP 422.
|
|
804
|
+
# @raise [Pago::NetworkError] when the request never reached the API.
|
|
805
|
+
# @return [Models::CustomerPortalMember]
|
|
806
|
+
def update_member(id, body: {})
|
|
807
|
+
data = client.request(
|
|
808
|
+
http_method: "PATCH",
|
|
809
|
+
path: "/v1/customer-portal/members/{id}",
|
|
810
|
+
path_params: { "id" => id },
|
|
811
|
+
query: {},
|
|
812
|
+
body: body,
|
|
813
|
+
response_type: :json,
|
|
814
|
+
errors: { 400 => Errors::UpdateMember400Error, 401 => Errors::UpdateMember401Error, 403 => Errors::UpdateMember403Error, 404 => Errors::UpdateMember404Error, 422 => Errors::HTTPValidationError }
|
|
815
|
+
)
|
|
816
|
+
Models::CustomerPortalMember.from_json(data)
|
|
817
|
+
end
|
|
818
|
+
|
|
819
|
+
end
|
|
820
|
+
|
|
821
|
+
class Orders < ::Pago::Service
|
|
822
|
+
# List orders of the authenticated customer.
|
|
823
|
+
#
|
|
824
|
+
# @param product_id [String, Array<String>, nil] Filter by product ID.
|
|
825
|
+
# @param product_billing_type [String, Array<String>, nil] Filter by product billing type. `recurring` will filter data corresponding to subscriptions creations or renewals. `one_time` will filter data corresponding to one-time purchases.
|
|
826
|
+
# @param subscription_id [String, Array<String>, nil] Filter by subscription ID.
|
|
827
|
+
# @param query [String, nil] Search by product or organization name.
|
|
828
|
+
# @param page [Integer] Page number, defaults to 1.
|
|
829
|
+
# @param limit [Integer] Size of a page, defaults to 10. Maximum is 100.
|
|
830
|
+
# @param sorting [Array<String>, nil] Sorting criterion. Several criteria can be used simultaneously and will be applied in order. Add a minus sign `-` before the criteria name to sort by descending order.
|
|
831
|
+
# @raise [Errors::HTTPValidationError] on HTTP 422.
|
|
832
|
+
# @raise [Pago::NetworkError] when the request never reached the API.
|
|
833
|
+
# @return [Models::ListResourceCustomerOrder]
|
|
834
|
+
def list(product_id: nil, product_billing_type: nil, subscription_id: nil, query: nil, page: 1, limit: 10, sorting: ["-created_at"])
|
|
835
|
+
data = client.request(
|
|
836
|
+
http_method: "GET",
|
|
837
|
+
path: "/v1/customer-portal/orders/",
|
|
838
|
+
path_params: {},
|
|
839
|
+
query: { "product_id" => product_id, "product_billing_type" => product_billing_type, "subscription_id" => subscription_id, "query" => query, "page" => page, "limit" => limit, "sorting" => sorting },
|
|
840
|
+
response_type: :json,
|
|
841
|
+
errors: { 422 => Errors::HTTPValidationError }
|
|
842
|
+
)
|
|
843
|
+
Models::ListResourceCustomerOrder.from_json(data)
|
|
844
|
+
end
|
|
845
|
+
|
|
846
|
+
# Enumerate every item of `list`, fetching pages on demand.
|
|
847
|
+
#
|
|
848
|
+
# @yieldparam item [Models::CustomerOrder]
|
|
849
|
+
# @return [Pago::Paginator] when called without a block.
|
|
850
|
+
def list_each(product_id: nil, product_billing_type: nil, subscription_id: nil, query: nil, limit: 10, sorting: ["-created_at"], &block)
|
|
851
|
+
paginator = ::Pago::Paginator.new do |page_number|
|
|
852
|
+
list(product_id: product_id, product_billing_type: product_billing_type, subscription_id: subscription_id, query: query, page: page_number, limit: limit, sorting: sorting)
|
|
853
|
+
end
|
|
854
|
+
block ? paginator.each(&block) : paginator
|
|
855
|
+
end
|
|
856
|
+
|
|
857
|
+
# Get an order by ID for the authenticated customer.
|
|
858
|
+
#
|
|
859
|
+
# @param id [String] The order ID.
|
|
860
|
+
# @raise [Errors::ResourceNotFound] on HTTP 404.
|
|
861
|
+
# @raise [Errors::HTTPValidationError] on HTTP 422.
|
|
862
|
+
# @raise [Pago::NetworkError] when the request never reached the API.
|
|
863
|
+
# @return [Models::CustomerOrder]
|
|
864
|
+
def get(id)
|
|
865
|
+
data = client.request(
|
|
866
|
+
http_method: "GET",
|
|
867
|
+
path: "/v1/customer-portal/orders/{id}",
|
|
868
|
+
path_params: { "id" => id },
|
|
869
|
+
query: {},
|
|
870
|
+
response_type: :json,
|
|
871
|
+
errors: { 404 => Errors::ResourceNotFound, 422 => Errors::HTTPValidationError }
|
|
872
|
+
)
|
|
873
|
+
Models::CustomerOrder.from_json(data)
|
|
874
|
+
end
|
|
875
|
+
|
|
876
|
+
# Update an order for the authenticated customer.
|
|
877
|
+
#
|
|
878
|
+
# @param id [String] The order ID.
|
|
879
|
+
# @param body [Hash, Models::CustomerOrderUpdate] the request body.
|
|
880
|
+
# @raise [Errors::ResourceNotFound] on HTTP 404.
|
|
881
|
+
# @raise [Errors::HTTPValidationError] on HTTP 422.
|
|
882
|
+
# @raise [Pago::NetworkError] when the request never reached the API.
|
|
883
|
+
# @return [Models::CustomerOrder]
|
|
884
|
+
def update(id, body: {})
|
|
885
|
+
data = client.request(
|
|
886
|
+
http_method: "PATCH",
|
|
887
|
+
path: "/v1/customer-portal/orders/{id}",
|
|
888
|
+
path_params: { "id" => id },
|
|
889
|
+
query: {},
|
|
890
|
+
body: body,
|
|
891
|
+
response_type: :json,
|
|
892
|
+
errors: { 404 => Errors::ResourceNotFound, 422 => Errors::HTTPValidationError }
|
|
893
|
+
)
|
|
894
|
+
Models::CustomerOrder.from_json(data)
|
|
895
|
+
end
|
|
896
|
+
|
|
897
|
+
# Get an order's invoice data.
|
|
898
|
+
#
|
|
899
|
+
# @param id [String] The order ID.
|
|
900
|
+
# @raise [Errors::ResourceNotFound] on HTTP 404.
|
|
901
|
+
# @raise [Errors::HTTPValidationError] on HTTP 422.
|
|
902
|
+
# @raise [Pago::NetworkError] when the request never reached the API.
|
|
903
|
+
# @return [Models::CustomerOrderInvoice]
|
|
904
|
+
def invoice(id)
|
|
905
|
+
data = client.request(
|
|
906
|
+
http_method: "GET",
|
|
907
|
+
path: "/v1/customer-portal/orders/{id}/invoice",
|
|
908
|
+
path_params: { "id" => id },
|
|
909
|
+
query: {},
|
|
910
|
+
response_type: :json,
|
|
911
|
+
errors: { 404 => Errors::ResourceNotFound, 422 => Errors::HTTPValidationError }
|
|
912
|
+
)
|
|
913
|
+
Models::CustomerOrderInvoice.from_json(data)
|
|
914
|
+
end
|
|
915
|
+
|
|
916
|
+
# Trigger generation of an order's invoice.
|
|
917
|
+
#
|
|
918
|
+
# @param id [String] The order ID.
|
|
919
|
+
# @raise [Errors::ResourceNotFound] on HTTP 404.
|
|
920
|
+
# @raise [Errors::OrderNotEligibleForInvoice] on HTTP 409.
|
|
921
|
+
# @raise [Errors::MissingInvoiceBillingDetails] on HTTP 422.
|
|
922
|
+
# @raise [Pago::NetworkError] when the request never reached the API.
|
|
923
|
+
# @return [Object]
|
|
924
|
+
def generate_invoice(id)
|
|
925
|
+
data = client.request(
|
|
926
|
+
http_method: "POST",
|
|
927
|
+
path: "/v1/customer-portal/orders/{id}/invoice",
|
|
928
|
+
path_params: { "id" => id },
|
|
929
|
+
query: {},
|
|
930
|
+
response_type: :json,
|
|
931
|
+
errors: { 404 => Errors::ResourceNotFound, 409 => Errors::OrderNotEligibleForInvoice, 422 => Errors::MissingInvoiceBillingDetails }
|
|
932
|
+
)
|
|
933
|
+
data
|
|
934
|
+
end
|
|
935
|
+
|
|
936
|
+
# Get a presigned URL to download an order's receipt PDF.
|
|
937
|
+
#
|
|
938
|
+
# @param id [String] The order ID.
|
|
939
|
+
# @raise [Errors::ResourceNotFound] on HTTP 404.
|
|
940
|
+
# @raise [Errors::HTTPValidationError] on HTTP 422.
|
|
941
|
+
# @raise [Pago::NetworkError] when the request never reached the API.
|
|
942
|
+
# @return [Models::CustomerOrderReceipt]
|
|
943
|
+
def receipt(id)
|
|
944
|
+
data = client.request(
|
|
945
|
+
http_method: "GET",
|
|
946
|
+
path: "/v1/customer-portal/orders/{id}/receipt",
|
|
947
|
+
path_params: { "id" => id },
|
|
948
|
+
query: {},
|
|
949
|
+
response_type: :json,
|
|
950
|
+
errors: { 404 => Errors::ResourceNotFound, 422 => Errors::HTTPValidationError }
|
|
951
|
+
)
|
|
952
|
+
Models::CustomerOrderReceipt.from_json(data)
|
|
953
|
+
end
|
|
954
|
+
|
|
955
|
+
# Get the current payment status for an order.
|
|
956
|
+
#
|
|
957
|
+
# @param id [String] The order ID.
|
|
958
|
+
# @raise [Errors::ResourceNotFound] on HTTP 404.
|
|
959
|
+
# @raise [Errors::HTTPValidationError] on HTTP 422.
|
|
960
|
+
# @raise [Pago::NetworkError] when the request never reached the API.
|
|
961
|
+
# @return [Models::CustomerOrderPaymentStatus]
|
|
962
|
+
def get_payment_status(id)
|
|
963
|
+
data = client.request(
|
|
964
|
+
http_method: "GET",
|
|
965
|
+
path: "/v1/customer-portal/orders/{id}/payment-status",
|
|
966
|
+
path_params: { "id" => id },
|
|
967
|
+
query: {},
|
|
968
|
+
response_type: :json,
|
|
969
|
+
errors: { 404 => Errors::ResourceNotFound, 422 => Errors::HTTPValidationError }
|
|
970
|
+
)
|
|
971
|
+
Models::CustomerOrderPaymentStatus.from_json(data)
|
|
972
|
+
end
|
|
973
|
+
|
|
974
|
+
# Confirm a retry payment using a Stripe confirmation token.
|
|
975
|
+
#
|
|
976
|
+
# @param id [String] The order ID.
|
|
977
|
+
# @param body [Hash, Models::CustomerOrderConfirmPayment] the request body.
|
|
978
|
+
# @raise [Errors::ResourceNotFound] on HTTP 404.
|
|
979
|
+
# @raise [Errors::PaymentAlreadyInProgress] on HTTP 409.
|
|
980
|
+
# @raise [Errors::OrderNotEligibleForRetry] on HTTP 422.
|
|
981
|
+
# @raise [Errors::ManualRetryLimitExceeded] on HTTP 429.
|
|
982
|
+
# @raise [Pago::NetworkError] when the request never reached the API.
|
|
983
|
+
# @return [Models::CustomerOrderPaymentConfirmation]
|
|
984
|
+
def confirm_retry_payment(id, body: {})
|
|
985
|
+
data = client.request(
|
|
986
|
+
http_method: "POST",
|
|
987
|
+
path: "/v1/customer-portal/orders/{id}/confirm-payment",
|
|
988
|
+
path_params: { "id" => id },
|
|
989
|
+
query: {},
|
|
990
|
+
body: body,
|
|
991
|
+
response_type: :json,
|
|
992
|
+
errors: { 404 => Errors::ResourceNotFound, 409 => Errors::PaymentAlreadyInProgress, 422 => Errors::OrderNotEligibleForRetry, 429 => Errors::ManualRetryLimitExceeded }
|
|
993
|
+
)
|
|
994
|
+
Models::CustomerOrderPaymentConfirmation.from_json(data)
|
|
995
|
+
end
|
|
996
|
+
|
|
997
|
+
end
|
|
998
|
+
|
|
999
|
+
class Organizations < ::Pago::Service
|
|
1000
|
+
# Get a customer portal's organization by slug.
|
|
1001
|
+
#
|
|
1002
|
+
# @param slug [String] The organization slug.
|
|
1003
|
+
# @raise [Errors::ResourceNotFound] on HTTP 404.
|
|
1004
|
+
# @raise [Errors::HTTPValidationError] on HTTP 422.
|
|
1005
|
+
# @raise [Pago::NetworkError] when the request never reached the API.
|
|
1006
|
+
# @return [Models::CustomerOrganizationData]
|
|
1007
|
+
def get(slug)
|
|
1008
|
+
data = client.request(
|
|
1009
|
+
http_method: "GET",
|
|
1010
|
+
path: "/v1/customer-portal/organizations/{slug}",
|
|
1011
|
+
path_params: { "slug" => slug },
|
|
1012
|
+
query: {},
|
|
1013
|
+
response_type: :json,
|
|
1014
|
+
errors: { 404 => Errors::ResourceNotFound, 422 => Errors::HTTPValidationError }
|
|
1015
|
+
)
|
|
1016
|
+
Models::CustomerOrganizationData.from_json(data)
|
|
1017
|
+
end
|
|
1018
|
+
|
|
1019
|
+
end
|
|
1020
|
+
|
|
1021
|
+
class Subscriptions < ::Pago::Service
|
|
1022
|
+
# List subscriptions of the authenticated customer.
|
|
1023
|
+
#
|
|
1024
|
+
# **Scopes**: `customer_portal:read` `customer_portal:write`
|
|
1025
|
+
#
|
|
1026
|
+
# @param product_id [String, Array<String>, nil] Filter by product ID.
|
|
1027
|
+
# @param active [Boolean, nil] Filter by active or cancelled subscription.
|
|
1028
|
+
# @param query [String, nil] Search by product or organization name.
|
|
1029
|
+
# @param page [Integer] Page number, defaults to 1.
|
|
1030
|
+
# @param limit [Integer] Size of a page, defaults to 10. Maximum is 100.
|
|
1031
|
+
# @param sorting [Array<String>, nil] Sorting criterion. Several criteria can be used simultaneously and will be applied in order. Add a minus sign `-` before the criteria name to sort by descending order.
|
|
1032
|
+
# @raise [Errors::HTTPValidationError] on HTTP 422.
|
|
1033
|
+
# @raise [Pago::NetworkError] when the request never reached the API.
|
|
1034
|
+
# @return [Models::ListResourceCustomerSubscription]
|
|
1035
|
+
def list(product_id: nil, active: nil, query: nil, page: 1, limit: 10, sorting: ["-started_at"])
|
|
1036
|
+
data = client.request(
|
|
1037
|
+
http_method: "GET",
|
|
1038
|
+
path: "/v1/customer-portal/subscriptions/",
|
|
1039
|
+
path_params: {},
|
|
1040
|
+
query: { "product_id" => product_id, "active" => active, "query" => query, "page" => page, "limit" => limit, "sorting" => sorting },
|
|
1041
|
+
response_type: :json,
|
|
1042
|
+
errors: { 422 => Errors::HTTPValidationError }
|
|
1043
|
+
)
|
|
1044
|
+
Models::ListResourceCustomerSubscription.from_json(data)
|
|
1045
|
+
end
|
|
1046
|
+
|
|
1047
|
+
# Enumerate every item of `list`, fetching pages on demand.
|
|
1048
|
+
#
|
|
1049
|
+
# @yieldparam item [Models::CustomerSubscription]
|
|
1050
|
+
# @return [Pago::Paginator] when called without a block.
|
|
1051
|
+
def list_each(product_id: nil, active: nil, query: nil, limit: 10, sorting: ["-started_at"], &block)
|
|
1052
|
+
paginator = ::Pago::Paginator.new do |page_number|
|
|
1053
|
+
list(product_id: product_id, active: active, query: query, page: page_number, limit: limit, sorting: sorting)
|
|
1054
|
+
end
|
|
1055
|
+
block ? paginator.each(&block) : paginator
|
|
1056
|
+
end
|
|
1057
|
+
|
|
1058
|
+
# Get a subscription for the authenticated customer.
|
|
1059
|
+
#
|
|
1060
|
+
# **Scopes**: `customer_portal:read` `customer_portal:write`
|
|
1061
|
+
#
|
|
1062
|
+
# @param id [String] The subscription ID.
|
|
1063
|
+
# @raise [Errors::ResourceNotFound] on HTTP 404.
|
|
1064
|
+
# @raise [Errors::HTTPValidationError] on HTTP 422.
|
|
1065
|
+
# @raise [Pago::NetworkError] when the request never reached the API.
|
|
1066
|
+
# @return [Models::CustomerSubscription]
|
|
1067
|
+
def get(id)
|
|
1068
|
+
data = client.request(
|
|
1069
|
+
http_method: "GET",
|
|
1070
|
+
path: "/v1/customer-portal/subscriptions/{id}",
|
|
1071
|
+
path_params: { "id" => id },
|
|
1072
|
+
query: {},
|
|
1073
|
+
response_type: :json,
|
|
1074
|
+
errors: { 404 => Errors::ResourceNotFound, 422 => Errors::HTTPValidationError }
|
|
1075
|
+
)
|
|
1076
|
+
Models::CustomerSubscription.from_json(data)
|
|
1077
|
+
end
|
|
1078
|
+
|
|
1079
|
+
# Cancel a subscription of the authenticated customer.
|
|
1080
|
+
#
|
|
1081
|
+
# @param id [String] The subscription ID.
|
|
1082
|
+
# @raise [Errors::AlreadyCanceledSubscription] on HTTP 403.
|
|
1083
|
+
# @raise [Errors::ResourceNotFound] on HTTP 404.
|
|
1084
|
+
# @raise [Errors::HTTPValidationError] on HTTP 422.
|
|
1085
|
+
# @raise [Pago::NetworkError] when the request never reached the API.
|
|
1086
|
+
# @return [Models::CustomerSubscription]
|
|
1087
|
+
def cancel(id)
|
|
1088
|
+
data = client.request(
|
|
1089
|
+
http_method: "DELETE",
|
|
1090
|
+
path: "/v1/customer-portal/subscriptions/{id}",
|
|
1091
|
+
path_params: { "id" => id },
|
|
1092
|
+
query: {},
|
|
1093
|
+
response_type: :json,
|
|
1094
|
+
errors: { 403 => Errors::AlreadyCanceledSubscription, 404 => Errors::ResourceNotFound, 422 => Errors::HTTPValidationError }
|
|
1095
|
+
)
|
|
1096
|
+
Models::CustomerSubscription.from_json(data)
|
|
1097
|
+
end
|
|
1098
|
+
|
|
1099
|
+
# Update a subscription of the authenticated customer.
|
|
1100
|
+
#
|
|
1101
|
+
# @param id [String] The subscription ID.
|
|
1102
|
+
# @param body [Hash, Object] the request body.
|
|
1103
|
+
# @raise [Errors::PaymentFailed] on HTTP 402.
|
|
1104
|
+
# @raise [Errors::Update403Error] on HTTP 403.
|
|
1105
|
+
# @raise [Errors::ResourceNotFound] on HTTP 404.
|
|
1106
|
+
# @raise [Errors::HTTPValidationError] on HTTP 422.
|
|
1107
|
+
# @raise [Pago::NetworkError] when the request never reached the API.
|
|
1108
|
+
# @return [Models::CustomerSubscription]
|
|
1109
|
+
def update(id, body: {})
|
|
1110
|
+
data = client.request(
|
|
1111
|
+
http_method: "PATCH",
|
|
1112
|
+
path: "/v1/customer-portal/subscriptions/{id}",
|
|
1113
|
+
path_params: { "id" => id },
|
|
1114
|
+
query: {},
|
|
1115
|
+
body: body,
|
|
1116
|
+
response_type: :json,
|
|
1117
|
+
errors: { 402 => Errors::PaymentFailed, 403 => Errors::Update403Error, 404 => Errors::ResourceNotFound, 422 => Errors::HTTPValidationError }
|
|
1118
|
+
)
|
|
1119
|
+
Models::CustomerSubscription.from_json(data)
|
|
1120
|
+
end
|
|
1121
|
+
|
|
1122
|
+
end
|
|
1123
|
+
|
|
1124
|
+
class Wallets < ::Pago::Service
|
|
1125
|
+
# List wallets of the authenticated customer.
|
|
1126
|
+
#
|
|
1127
|
+
# @param page [Integer] Page number, defaults to 1.
|
|
1128
|
+
# @param limit [Integer] Size of a page, defaults to 10. Maximum is 100.
|
|
1129
|
+
# @param sorting [Array<String>, nil] Sorting criterion. Several criteria can be used simultaneously and will be applied in order. Add a minus sign `-` before the criteria name to sort by descending order.
|
|
1130
|
+
# @raise [Errors::HTTPValidationError] on HTTP 422.
|
|
1131
|
+
# @raise [Pago::NetworkError] when the request never reached the API.
|
|
1132
|
+
# @return [Models::ListResourceCustomerWallet]
|
|
1133
|
+
def list(page: 1, limit: 10, sorting: ["-created_at"])
|
|
1134
|
+
data = client.request(
|
|
1135
|
+
http_method: "GET",
|
|
1136
|
+
path: "/v1/customer-portal/wallets/",
|
|
1137
|
+
path_params: {},
|
|
1138
|
+
query: { "page" => page, "limit" => limit, "sorting" => sorting },
|
|
1139
|
+
response_type: :json,
|
|
1140
|
+
errors: { 422 => Errors::HTTPValidationError }
|
|
1141
|
+
)
|
|
1142
|
+
Models::ListResourceCustomerWallet.from_json(data)
|
|
1143
|
+
end
|
|
1144
|
+
|
|
1145
|
+
# Enumerate every item of `list`, fetching pages on demand.
|
|
1146
|
+
#
|
|
1147
|
+
# @yieldparam item [Models::CustomerWallet]
|
|
1148
|
+
# @return [Pago::Paginator] when called without a block.
|
|
1149
|
+
def list_each(limit: 10, sorting: ["-created_at"], &block)
|
|
1150
|
+
paginator = ::Pago::Paginator.new do |page_number|
|
|
1151
|
+
list(page: page_number, limit: limit, sorting: sorting)
|
|
1152
|
+
end
|
|
1153
|
+
block ? paginator.each(&block) : paginator
|
|
1154
|
+
end
|
|
1155
|
+
|
|
1156
|
+
# Get a wallet by ID for the authenticated customer.
|
|
1157
|
+
#
|
|
1158
|
+
# @param id [String] The wallet ID.
|
|
1159
|
+
# @raise [Errors::ResourceNotFound] on HTTP 404.
|
|
1160
|
+
# @raise [Errors::HTTPValidationError] on HTTP 422.
|
|
1161
|
+
# @raise [Pago::NetworkError] when the request never reached the API.
|
|
1162
|
+
# @return [Models::CustomerWallet]
|
|
1163
|
+
def get(id)
|
|
1164
|
+
data = client.request(
|
|
1165
|
+
http_method: "GET",
|
|
1166
|
+
path: "/v1/customer-portal/wallets/{id}",
|
|
1167
|
+
path_params: { "id" => id },
|
|
1168
|
+
query: {},
|
|
1169
|
+
response_type: :json,
|
|
1170
|
+
errors: { 404 => Errors::ResourceNotFound, 422 => Errors::HTTPValidationError }
|
|
1171
|
+
)
|
|
1172
|
+
Models::CustomerWallet.from_json(data)
|
|
1173
|
+
end
|
|
1174
|
+
|
|
1175
|
+
end
|
|
1176
|
+
|
|
1177
|
+
end
|
|
1178
|
+
|
|
1179
|
+
end
|
|
1180
|
+
end
|
|
1181
|
+
end
|