Class: Pago::V2026_04::Services::Disputes

Inherits:
Service
  • Object
show all
Defined in:
lib/pago/v2026_04/services/disputes.rb,
sig/pago/v2026_04/generated.rbs

Instance Attribute Summary

Attributes inherited from Service

#client

Instance Method Summary collapse

Methods inherited from Service

#initialize

Constructor Details

This class inherits a constructor from Pago::Service

Instance Method Details

#accept(id) ⇒ Models::Dispute

Accept a dispute, conceding the chargeback.

Closes the dispute with the processor (settling it as lost) and records the merchant's decision on the dispute's support case.

Scopes: disputes:write

Parameters:

  • id (String)

    The dispute ID.

Returns:

Raises:



77
78
79
80
81
82
83
84
85
86
87
# File 'lib/pago/v2026_04/services/disputes.rb', line 77

def accept(id)
  data = client.request(
    http_method: "POST",
    path: "/v1/disputes/{id}/accept",
    path_params: { "id" => id },
    query: {},
    response_type: :json,
    errors: { 404 => Errors::ResourceNotFound, 409 => Errors::DisputeNotOpenError, 422 => Errors::HTTPValidationError }
  )
  Models::Dispute.from_json(data)
end

#get(id) ⇒ Models::Dispute

Get a dispute by ID.

Scopes: disputes:read disputes:write

Parameters:

  • id (String)

    The dispute ID.

Returns:

Raises:



52
53
54
55
56
57
58
59
60
61
62
# File 'lib/pago/v2026_04/services/disputes.rb', line 52

def get(id)
  data = client.request(
    http_method: "GET",
    path: "/v1/disputes/{id}",
    path_params: { "id" => id },
    query: {},
    response_type: :json,
    errors: { 404 => Errors::ResourceNotFound, 422 => Errors::HTTPValidationError }
  )
  Models::Dispute.from_json(data)
end

#list(organization_id: nil, order_id: nil, status: nil, page: 1, limit: 10, sorting: ["-created_at"]) ⇒ Models::ListResourceDispute

List disputes.

Scopes: disputes:read disputes:write

Parameters:

  • organization_id (String, Array<String>, nil) (defaults to: nil)

    Filter by organization ID.

  • order_id (String, Array<String>, nil) (defaults to: nil)

    Filter by order ID.

  • status (String, Array<String>, nil) (defaults to: nil)

    Filter by dispute status.

  • page (Integer) (defaults to: 1)

    Page number, defaults to 1.

  • limit (Integer) (defaults to: 10)

    Size of a page, defaults to 10. Maximum is 100.

  • sorting (Array<String>, nil) (defaults to: ["-created_at"])

    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.

  • organization_id: (Object) (defaults to: nil)
  • order_id: (Object) (defaults to: nil)
  • status: (Object) (defaults to: nil)
  • page: (Integer, nil) (defaults to: 1)
  • limit: (Integer, nil) (defaults to: 10)
  • sorting: (Array[String], nil) (defaults to: ["-created_at"])

Returns:

Raises:



20
21
22
23
24
25
26
27
28
29
30
# File 'lib/pago/v2026_04/services/disputes.rb', line 20

def list(organization_id: nil, order_id: nil, status: nil, page: 1, limit: 10, sorting: ["-created_at"])
  data = client.request(
    http_method: "GET",
    path: "/v1/disputes/",
    path_params: {},
    query: { "organization_id" => organization_id, "order_id" => order_id, "status" => status, "page" => page, "limit" => limit, "sorting" => sorting },
    response_type: :json,
    errors: { 422 => Errors::HTTPValidationError }
  )
  Models::ListResourceDispute.from_json(data)
end

#list_each(organization_id: nil, order_id: nil, status: nil, limit: 10, sorting: ["-created_at"]) {|item| ... } ⇒ Pago::Paginator

Enumerate every item of list, fetching pages on demand.

Parameters:

  • organization_id: (Object) (defaults to: nil)
  • order_id: (Object) (defaults to: nil)
  • status: (Object) (defaults to: nil)
  • limit: (Integer, nil) (defaults to: 10)
  • sorting: (Array[String], nil) (defaults to: ["-created_at"])

Yield Parameters:

Returns:



36
37
38
39
40
41
# File 'lib/pago/v2026_04/services/disputes.rb', line 36

def list_each(organization_id: nil, order_id: nil, status: nil, limit: 10, sorting: ["-created_at"], &block)
  paginator = ::Pago::Paginator.new do |page_number|
    list(organization_id: organization_id, order_id: order_id, status: status, page: page_number, limit: limit, sorting: sorting)
  end
  block ? paginator.each(&block) : paginator
end