Class: Pago::V2026_04::Services::Payments
- Defined in:
- lib/pago/v2026_04/services/payments.rb,
sig/pago/v2026_04/generated.rbs
Instance Attribute Summary
Attributes inherited from Service
Instance Method Summary collapse
-
#get(id) ⇒ Object
Get a payment by ID.
-
#list(organization_id: nil, checkout_id: nil, order_id: nil, customer_id: nil, status: nil, method: nil, customer_email: nil, page: 1, limit: 10, sorting: ["-created_at"]) ⇒ Models::ListResourcePayment
List payments.
-
#list_each(organization_id: nil, checkout_id: nil, order_id: nil, customer_id: nil, status: nil, method: nil, customer_email: 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
#get(id) ⇒ Object
Get a payment by ID.
Scopes: payments:read
56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/pago/v2026_04/services/payments.rb', line 56 def get(id) data = client.request( http_method: "GET", path: "/v1/payments/{id}", path_params: { "id" => id }, query: {}, response_type: :json, errors: { 404 => Errors::ResourceNotFound, 422 => Errors::HTTPValidationError } ) Unions::Payment.from_json(data) end |
#list(organization_id: nil, checkout_id: nil, order_id: nil, customer_id: nil, status: nil, method: nil, customer_email: nil, page: 1, limit: 10, sorting: ["-created_at"]) ⇒ Models::ListResourcePayment
List payments.
Scopes: payments:read
24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/pago/v2026_04/services/payments.rb', line 24 def list(organization_id: nil, checkout_id: nil, order_id: nil, customer_id: nil, status: nil, method: nil, customer_email: nil, page: 1, limit: 10, sorting: ["-created_at"]) data = client.request( http_method: "GET", path: "/v1/payments/", path_params: {}, query: { "organization_id" => organization_id, "checkout_id" => checkout_id, "order_id" => order_id, "customer_id" => customer_id, "status" => status, "method" => method, "customer_email" => customer_email, "page" => page, "limit" => limit, "sorting" => sorting }, response_type: :json, errors: { 422 => Errors::HTTPValidationError } ) Models::ListResourcePayment.from_json(data) end |
#list_each(organization_id: nil, checkout_id: nil, order_id: nil, customer_id: nil, status: nil, method: nil, customer_email: 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/payments.rb', line 40 def list_each(organization_id: nil, checkout_id: nil, order_id: nil, customer_id: nil, status: nil, method: nil, customer_email: nil, limit: 10, sorting: ["-created_at"], &block) paginator = ::Pago::Paginator.new do |page_number| list(organization_id: organization_id, checkout_id: checkout_id, order_id: order_id, customer_id: customer_id, status: status, method: method, customer_email: customer_email, page: page_number, limit: limit, sorting: sorting) end block ? paginator.each(&block) : paginator end |