Module: MangoApi::Refunds

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

Overview

Provides API method delegates concerning the Refund entity

Class Method Summary collapse

Methods included from UriProvider

provide_uri

Class Method Details

.create_for_pay_in(id, refund, id_key = nil) ⇒ Refund

Creates a Pay-In Refund, which is a request to reimburse a user on their payment card. The money which was paid will automatically go back to the user’s bank account.

Refund properties:

  • Required

    • author_id

  • Optional

    • tag

    • debited_funds

    • fees

Parameters:

  • +id+ (String)

    ID of the pay-in being refunded

  • +refund+ (Refund)

    model object of the refund being created

  • +id_key+ (String)

    idempotency key for future response replication

Returns:

  • (Refund)

    the newly-created Refund entity object



26
27
28
29
30
# File 'lib/mangopay/api/service/refunds.rb', line 26

def create_for_pay_in(id, refund, id_key = nil)
  uri = provide_uri(:create_pay_in_refund, id)
  response = HttpClient.post(uri, refund, id_key)
  parse response
end

.create_for_transfer(id, refund, id_key = nil) ⇒ Refund

Creates a Transfer Refund.

Refund properties:

  • Required

    • author_id

  • Optional

    • tag

Parameters:

  • +id+ (String)

    ID of the transfer being refunded

  • +refund+ (Refund)

    model object of the refund being created

  • +id_key+ (String)

    idempotency key for future response replication

Returns:

  • (Refund)

    the newly-created Refund entity object



44
45
46
47
48
# File 'lib/mangopay/api/service/refunds.rb', line 44

def create_for_transfer(id, refund, id_key = nil)
  uri = provide_uri(:create_transfer_refund, id)
  response = HttpClient.post(uri, refund, id_key)
  parse response
end

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

Retrieves pages of refund entities belonging to a certain pay-in. 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

  • status

  • result_code

Parameters:

  • +id+ (String)

    ID of the pay-in whose refunds to retrieve

Yields:

Returns:

  • (Array)

    the requested Refund entity objects



107
108
109
110
111
112
113
# File 'lib/mangopay/api/service/refunds.rb', line 107

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

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

Retrieves pages of refund entities belonging to a certain pay-out. 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

  • status

  • result_code

Parameters:

  • +id+ (String)

    ID of the pay-out whose refunds to retrieve

Yields:

Returns:

  • (Array)

    the requested Refund entity objects



64
65
66
67
68
69
70
# File 'lib/mangopay/api/service/refunds.rb', line 64

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

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

Retrieves pages of refund entities belonging to a certain repudiation. 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

  • status

  • result_code

Parameters:

  • +id+ (String)

    ID of the repudiation whose refunds to retrieve

Yields:

Returns:

  • (Array)

    the requested Refund entity objects



129
130
131
132
133
134
135
# File 'lib/mangopay/api/service/refunds.rb', line 129

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

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

Retrieves pages of refund entities belonging to a certain transfer. 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

  • status

  • result_code

Parameters:

  • +id+ (String)

    ID of the transfer whose refunds to retrieve

Yields:

Returns:

  • (Array)

    the requested Refund entity objects



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

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