Class: Pago::V2026_04::Services::Refunds
- Defined in:
- lib/pago/v2026_04/services/refunds.rb,
sig/pago/v2026_04/generated.rbs
Instance Attribute Summary
Attributes inherited from Service
Instance Method Summary collapse
-
#create(body: {}) ⇒ Models::Refund
Create a refund.
-
#list(id: nil, organization_id: nil, order_id: nil, subscription_id: nil, customer_id: nil, external_customer_id: nil, succeeded: nil, page: 1, limit: 10, sorting: ["-created_at"]) ⇒ Models::ListResourceRefund
List refunds.
-
#list_each(id: nil, organization_id: nil, order_id: nil, subscription_id: nil, customer_id: nil, external_customer_id: nil, succeeded: nil, limit: 10, sorting: ["-created_at"]) {|item| ... } ⇒ Pago::Paginator
Enumerate every item of
list, fetching pages on demand.
Methods inherited from Service
Constructor Details
This class inherits a constructor from Pago::Service
Instance Method Details
#create(body: {}) ⇒ Models::Refund
Create a refund.
Scopes: refunds:write
56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/pago/v2026_04/services/refunds.rb', line 56 def create(body: {}) data = client.request( http_method: "POST", path: "/v1/refunds/", path_params: {}, query: {}, body: body, response_type: :json, errors: { 403 => Errors::RefundedAlready, 422 => Errors::HTTPValidationError } ) Models::Refund.from_json(data) end |
#list(id: nil, organization_id: nil, order_id: nil, subscription_id: nil, customer_id: nil, external_customer_id: nil, succeeded: nil, page: 1, limit: 10, sorting: ["-created_at"]) ⇒ Models::ListResourceRefund
List refunds.
Scopes: refunds:read refunds:write
24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/pago/v2026_04/services/refunds.rb', line 24 def list(id: nil, organization_id: nil, order_id: nil, subscription_id: nil, customer_id: nil, external_customer_id: nil, succeeded: nil, page: 1, limit: 10, sorting: ["-created_at"]) data = client.request( http_method: "GET", path: "/v1/refunds/", path_params: {}, query: { "id" => id, "organization_id" => organization_id, "order_id" => order_id, "subscription_id" => subscription_id, "customer_id" => customer_id, "external_customer_id" => external_customer_id, "succeeded" => succeeded, "page" => page, "limit" => limit, "sorting" => sorting }, response_type: :json, errors: { 422 => Errors::HTTPValidationError } ) Models::ListResourceRefund.from_json(data) end |
#list_each(id: nil, organization_id: nil, order_id: nil, subscription_id: nil, customer_id: nil, external_customer_id: nil, succeeded: nil, limit: 10, sorting: ["-created_at"]) {|item| ... } ⇒ Pago::Paginator
Enumerate every item of list, fetching pages on demand.
40 41 42 43 44 45 |
# File 'lib/pago/v2026_04/services/refunds.rb', line 40 def list_each(id: nil, organization_id: nil, order_id: nil, subscription_id: nil, customer_id: nil, external_customer_id: nil, succeeded: nil, limit: 10, sorting: ["-created_at"], &block) paginator = ::Pago::Paginator.new do |page_number| list(id: id, organization_id: organization_id, order_id: order_id, subscription_id: subscription_id, customer_id: customer_id, external_customer_id: external_customer_id, succeeded: succeeded, page: page_number, limit: limit, sorting: sorting) end block ? paginator.each(&block) : paginator end |