Module: MangoApi::Disputes

Extended by:
UriProvider
Defined in:
lib/mangopay/api/service/disputes.rb

Overview

Provides API method delegates concerning the Dispute entity

Class Method Summary collapse

Methods included from UriProvider

provide_uri

Class Method Details

.all {|filter_request = FilterRequest.new| ... } ⇒ Array

Retrieves dispute entities belonging to the current client. Allows configuration of paging and sorting parameters by yielding a filtering object to a provided block. When no filters are specified, will retrieve the first page of 10 newest results.

Allowed FilterRequest params:

  • page

  • per_page

  • sort_field and sort_direction

  • before_date

  • after_date

  • dispute_type

  • status

Yields:

Returns:

  • (Array)

    corresponding Dispute entity objects



156
157
158
159
160
161
162
# File 'lib/mangopay/api/service/disputes.rb', line 156

def all
  uri = provide_uri(:get_disputes)
  filter_request = nil
  yield filter_request = FilterRequest.new if block_given?
  results = HttpClient.get(uri, filter_request)
  parse_results results
end

.close(id) ⇒ Dispute

Closes a dispute, an optional action which effectively confirms that the dispute will not be contested.

Parameters:

  • +id+ (String)

    ID of the dispute to close

Returns:

  • (Dispute)

    the closed Dispute entity object



31
32
33
34
35
# File 'lib/mangopay/api/service/disputes.rb', line 31

def close(id)
  uri = provide_uri(:close_dispute, id)
  response = HttpClient.put(uri, MangoModel::Dispute.new)
  parse response
end

.get(id) ⇒ Dispute

Retrieves a dispute entity.

Parameters:

  • +id+ (String)

    ID of the dispute to retrieve

Returns:

  • (Dispute)

    the requested Dispute entity object



62
63
64
65
66
# File 'lib/mangopay/api/service/disputes.rb', line 62

def get(id)
  uri = provide_uri(:get_dispute, id)
  response = HttpClient.get(uri)
  parse response
end

.of_user(id) {|filter_request = FilterRequest.new| ... } ⇒ Array

Retrieves dispute entities belonging to a certain user. Allows configuration of paging and sorting parameters by yielding a filtering object to a provided block. When no filters are specified, will retrieve the first page of 10 newest results.

Allowed FilterRequest params:

  • page

  • per_page

  • sort_field and sort_direction

  • before_date

  • after_date

  • dispute_type

  • status

Parameters:

  • +id+ (String)

    ID of the user whose disputes to retrieve

Yields:

Returns:

  • (Array)

    corresponding Dispute entity object



85
86
87
88
89
90
91
# File 'lib/mangopay/api/service/disputes.rb', line 85

def of_user(id)
  uri = provide_uri(:get_users_disputes, id)
  filter_request = nil
  yield filter_request = FilterRequest.new if block_given?
  results = HttpClient.get(uri, filter_request)
  parse_results results
end

.of_wallet(id) {|filter_request = FilterRequest.new| ... } ⇒ Array

Retrieves dispute entities belonging to a certain wallet. Allows configuration of paging and sorting parameters by yielding a filtering object to a provided block. When no filters are specified, will retrieve the first page of 10 newest results.

Allowed FilterRequest params:

  • page

  • per_page

  • sort_field and sort_direction

  • before_date

  • after_date

  • dispute_type

  • status

Parameters:

  • +id+ (String)

    ID of the wallet whose disputes to retrieve

Yields:

Returns:

  • (Array)

    corresponding Dispute entity object



110
111
112
113
114
115
116
# File 'lib/mangopay/api/service/disputes.rb', line 110

def of_wallet(id)
  uri = provide_uri(:get_wallets_disputes, id)
  filter_request = nil
  yield filter_request = FilterRequest.new if block_given?
  results = HttpClient.get(uri, filter_request)
  parse_results results
end

.pending_settlement {|filter_request = FilterRequest.new| ... } ⇒ Array

Retrieves dispute entities that allow a settlement transfer. In the event of having credit following a Dispute (because it was lost, or the full amount wasn’t contested), a settlement transfer can optionally be done to transfer funds from the original wallet to the credit wallet. A dispute allows a settlement transfer when there is remaining credit and when funds are still available in the original wallet.

Allowed FilterRequest params:

  • page

  • per_page

  • sort_field and sort_direction

Yields:

Returns:

  • (Array)

    corresponding Dispute entity objects



132
133
134
135
136
137
138
# File 'lib/mangopay/api/service/disputes.rb', line 132

def pending_settlement
  uri = provide_uri(:get_disputes_pending_settlement)
  filter_request = nil
  yield filter_request = FilterRequest.new if block_given?
  results = HttpClient.get(uri, filter_request)
  parse_results results
end

.resubmit(id) ⇒ Dispute

Re-submits a dispute entity if it is reopened requiring more documents.

Parameters:

  • +id+ (String)

    ID of the dispute to re-submit

Returns:

  • (Dispute)

    the re-submitted Dispute entity object



52
53
54
55
56
# File 'lib/mangopay/api/service/disputes.rb', line 52

def resubmit(id)
  uri = provide_uri(:resubmit_dispute, id)
  response = HttpClient.put(uri, MangoModel::Dispute.new)
  parse response
end

.submit(dispute) ⇒ Dispute

Contests a dispute entity.

Parameters:

  • +dispute+ (Dispute)

    the dispute object

Returns:

  • (Dispute)

    the contested Dispute entity object



41
42
43
44
45
# File 'lib/mangopay/api/service/disputes.rb', line 41

def submit(dispute)
  uri = provide_uri(:submit_dispute, dispute.id)
  response = HttpClient.put(uri, dispute)
  parse response
end

.update(dispute) ⇒ Dispute

Updates the dispute entity identifiable by the provided dispute object’s ID.

Dispute optional properties:

  • tag

and updated data

Parameters:

  • +dispute+ (Dispute)

    dispute object with corresponding ID

Returns:

  • (Dispute)

    the updated Dispute entity object



20
21
22
23
24
# File 'lib/mangopay/api/service/disputes.rb', line 20

def update(dispute)
  uri = provide_uri(:update_dispute, dispute.id)
  response = HttpClient.put(uri, dispute)
  parse response
end