module MangoApi::Refunds
Provides API method delegates concerning the Refund
entity
Public Class Methods
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
-
@param id
[String] ID of the pay-in being refunded @param refund
[Refund] model object of the refund being created @param id_key
[String] idempotency key for future response replication @return [Refund] the newly-created Refund entity object
# 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
Creates a Transfer Refund.
Refund
properties:
-
Required
-
author_id
-
-
Optional
-
tag
-
@param id
[String] ID of the transfer being refunded @param refund
[Refund] model object of the refund being created @param id_key
[String] idempotency key for future response replication @return [Refund] the newly-created Refund entity object
# 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
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
@param id
[String] ID of the pay-in whose refunds to retrieve @return [Array] the requested Refund entity objects
# 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
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
@param id
[String] ID of the pay-out whose refunds to retrieve @return [Array] the requested Refund entity objects
# 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
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
@param id
[String] ID of the repudiation whose refunds to retrieve @return [Array] the requested Refund entity objects
# 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
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
@param id
[String] ID of the transfer whose refunds to retrieve @return [Array] the requested Refund entity objects
# 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
Private Class Methods
Parses a JSON-originating hash into the corresponding Refund entity object.
@param response
[Hash] JSON-originating data hash @return [Refund] corresponding Refund entity object
# File lib/mangopay/api/service/refunds.rb, line 144 def parse(response) MangoModel::Refund.new.dejsonify response end
Parses an Array of JSON-originating hashes into corresponding Refund entity objects.
@param results
[Array] JSON-originating data hashes @return [Array] corresponding Refund entity objects
# File lib/mangopay/api/service/refunds.rb, line 153 def parse_results(results) results.collect do |entity| parse entity end end