class Bfwd::RefundsApi
Attributes
Public Class Methods
# File lib/bf_ruby2/api/refunds_api.rb, line 19 def initialize(api_client = ApiClient.default) @api_client = api_client end
Public Instance Methods
<p>When creating a refund either the invoice, or invoice payment must be specified.</p><p>Creating a refund by specifying the invoiceID will refund any un-refunded value up to the full value of the payment. When refunding via the invoicePaymentID the same rules apply. Refunds will be processed by the same payment methods that took the payment.</p><p>Refunds can be for a partial amount of the payment. It is possible to create refunds up to the value of the total payment.</p><p>Once a payment or invoice is fully refunded, no more refunds can be created. Errors will be returned if the payment is greater than available refund funds.</p> {"nickname":"Create a new refund","request":"createRefundRequest.html","response":"createRefundResponse.html"} @param refund The refund object to be created. @param [Hash] opts the optional parameters @return [RefundPagedMetadata]
# File lib/bf_ruby2/api/refunds_api.rb, line 28 def create_refund(refund, opts = {}) data, _status_code, _headers = create_refund_with_http_info(refund, opts) return data end
<p>When creating a refund either the invoice, or invoice payment must be specified.</p><p>Creating a refund by specifying the invoiceID will refund any un-refunded value up to the full value of the payment. When refunding via the invoicePaymentID the same rules apply. Refunds will be processed by the same payment methods that took the payment.</p><p>Refunds can be for a partial amount of the payment. It is possible to create refunds up to the value of the total payment.</p><p>Once a payment or invoice is fully refunded, no more refunds can be created. Errors will be returned if the payment is greater than available refund funds.</p> {"nickname":"Create a new refund","request":"createRefundRequest.html","response":"createRefundResponse.html"} @param refund The refund object to be created. @param [Hash] opts the optional parameters @return [Array<(RefundPagedMetadata
, Fixnum, Hash)>] RefundPagedMetadata
data, response status code and response headers
# File lib/bf_ruby2/api/refunds_api.rb, line 38 def create_refund_with_http_info(refund, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: RefundsApi.create_refund ..." end # verify the required parameter 'refund' is set if @api_client.config.client_side_validation && refund.nil? fail ArgumentError, "Missing the required parameter 'refund' when calling RefundsApi.create_refund" end # resource path local_var_path = "/refunds" # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['text/xml', 'application/xml', 'application/json; charset=utf-8']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json; charset=utf-8']) # form parameters form_params = {} # http body (model) post_body = @api_client.object_to_http_body(refund) auth_names = [] data, status_code, headers = @api_client.call_api(:POST, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'RefundPagedMetadata') if @api_client.config.debugging @api_client.config.logger.debug "API called: RefundsApi#create_refund\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
Returns a collection of all refunds. By default 10 values are returned. Refunds are returned in natural order {"nickname":"Get all refunds","response":"getRefundsAll.html"} @param [Hash] opts the optional parameters @option opts [Array<String>] :organizations A list of organization-IDs used to restrict the scope of API calls. @option opts [Integer] :offset The offset from the first refund to return. (default to 0) @option opts [Integer] :records The maximum number of refunds to return. (default to 10) @option opts [String] :order_by Specify a field used to order the result set. (default to created) @option opts [String] :order Ihe direction of any ordering, either ASC or DESC. (default to DESC) @return [RefundPagedMetadata]
# File lib/bf_ruby2/api/refunds_api.rb, line 87 def get_all_refunds(opts = {}) data, _status_code, _headers = get_all_refunds_with_http_info(opts) return data end
Returns a collection of all refunds. By default 10 values are returned. Refunds are returned in natural order {"nickname":"Get all refunds","response":"getRefundsAll.html"} @param [Hash] opts the optional parameters @option opts [Array<String>] :organizations A list of organization-IDs used to restrict the scope of API calls. @option opts [Integer] :offset The offset from the first refund to return. @option opts [Integer] :records The maximum number of refunds to return. @option opts [String] :order_by Specify a field used to order the result set. @option opts [String] :order Ihe direction of any ordering, either ASC or DESC. @return [Array<(RefundPagedMetadata
, Fixnum, Hash)>] RefundPagedMetadata
data, response status code and response headers
# File lib/bf_ruby2/api/refunds_api.rb, line 101 def get_all_refunds_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: RefundsApi.get_all_refunds ..." end if @api_client.config.client_side_validation && opts[:'order'] && !['ASC', 'DESC'].include?(opts[:'order']) fail ArgumentError, 'invalid value for "order", must be one of ASC, DESC' end # resource path local_var_path = "/refunds" # query parameters query_params = {} query_params[:'organizations'] = @api_client.build_collection_param(opts[:'organizations'], :multi) if !opts[:'organizations'].nil? query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil? query_params[:'records'] = opts[:'records'] if !opts[:'records'].nil? query_params[:'order_by'] = opts[:'order_by'] if !opts[:'order_by'].nil? query_params[:'order'] = opts[:'order'] if !opts[:'order'].nil? # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json; charset=utf-8']) # form parameters form_params = {} # http body (model) post_body = nil auth_names = [] data, status_code, headers = @api_client.call_api(:GET, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'RefundPagedMetadata') if @api_client.config.debugging @api_client.config.logger.debug "API called: RefundsApi#get_all_refunds\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
Returns a single refund, specified by the ID parameter. {"nickname":"Retrieve an existing refund","response":"getRefundByID.html"} @param refund_id ID of the Refund
. @param [Hash] opts the optional parameters @option opts [Array<String>] :organizations A list of organization-IDs used to restrict the scope of API calls. @return [RefundPagedMetadata]
# File lib/bf_ruby2/api/refunds_api.rb, line 149 def get_refund_by_id(refund_id, opts = {}) data, _status_code, _headers = get_refund_by_id_with_http_info(refund_id, opts) return data end
Returns a single refund, specified by the ID parameter. {"nickname":"Retrieve an existing refund","response":"getRefundByID.html"} @param refund_id ID of the Refund
. @param [Hash] opts the optional parameters @option opts [Array<String>] :organizations A list of organization-IDs used to restrict the scope of API calls. @return [Array<(RefundPagedMetadata
, Fixnum, Hash)>] RefundPagedMetadata
data, response status code and response headers
# File lib/bf_ruby2/api/refunds_api.rb, line 160 def get_refund_by_id_with_http_info(refund_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: RefundsApi.get_refund_by_id ..." end # verify the required parameter 'refund_id' is set if @api_client.config.client_side_validation && refund_id.nil? fail ArgumentError, "Missing the required parameter 'refund_id' when calling RefundsApi.get_refund_by_id" end # resource path local_var_path = "/refunds/{refund-ID}".sub('{' + 'refund-ID' + '}', refund_id.to_s) # query parameters query_params = {} query_params[:'organizations'] = @api_client.build_collection_param(opts[:'organizations'], :multi) if !opts[:'organizations'].nil? # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json; charset=utf-8']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['text/plain']) # form parameters form_params = {} # http body (model) post_body = nil auth_names = [] data, status_code, headers = @api_client.call_api(:GET, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'RefundPagedMetadata') if @api_client.config.debugging @api_client.config.logger.debug "API called: RefundsApi#get_refund_by_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
Returns a refund for the original payment. {"nickname":"Retrieve by originating payment","response":"getRefundsByPayment.html"} @param payment_id ID of the Payment
. @param [Hash] opts the optional parameters @option opts [Array<String>] :organizations A list of organization-IDs used to restrict the scope of API calls. @return [RefundPagedMetadata]
# File lib/bf_ruby2/api/refunds_api.rb, line 207 def get_refund_for_original_payment(payment_id, opts = {}) data, _status_code, _headers = get_refund_for_original_payment_with_http_info(payment_id, opts) return data end
Returns a refund for the original payment. {"nickname":"Retrieve by originating payment","response":"getRefundsByPayment.html"} @param payment_id ID of the Payment
. @param [Hash] opts the optional parameters @option opts [Array<String>] :organizations A list of organization-IDs used to restrict the scope of API calls. @return [Array<(RefundPagedMetadata
, Fixnum, Hash)>] RefundPagedMetadata
data, response status code and response headers
# File lib/bf_ruby2/api/refunds_api.rb, line 218 def get_refund_for_original_payment_with_http_info(payment_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: RefundsApi.get_refund_for_original_payment ..." end # verify the required parameter 'payment_id' is set if @api_client.config.client_side_validation && payment_id.nil? fail ArgumentError, "Missing the required parameter 'payment_id' when calling RefundsApi.get_refund_for_original_payment" end # resource path local_var_path = "/refunds/original-payment/{payment-ID}".sub('{' + 'payment-ID' + '}', payment_id.to_s) # query parameters query_params = {} query_params[:'organizations'] = @api_client.build_collection_param(opts[:'organizations'], :multi) if !opts[:'organizations'].nil? # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json; charset=utf-8']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['text/plain']) # form parameters form_params = {} # http body (model) post_body = nil auth_names = [] data, status_code, headers = @api_client.call_api(:GET, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'RefundPagedMetadata') if @api_client.config.debugging @api_client.config.logger.debug "API called: RefundsApi#get_refund_for_original_payment\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
Returns a refund for the refund payment. {"nickname":"Retrieve by refund payment","response":"getRefundsByPayment.html"} @param payment_id ID of the Payment
. @param [Hash] opts the optional parameters @option opts [Array<String>] :organizations A list of organization-IDs used to restrict the scope of API calls. @return [RefundPagedMetadata]
# File lib/bf_ruby2/api/refunds_api.rb, line 265 def get_refund_for_refund_payment(payment_id, opts = {}) data, _status_code, _headers = get_refund_for_refund_payment_with_http_info(payment_id, opts) return data end
Returns a refund for the refund payment. {"nickname":"Retrieve by refund payment","response":"getRefundsByPayment.html"} @param payment_id ID of the Payment
. @param [Hash] opts the optional parameters @option opts [Array<String>] :organizations A list of organization-IDs used to restrict the scope of API calls. @return [Array<(RefundPagedMetadata
, Fixnum, Hash)>] RefundPagedMetadata
data, response status code and response headers
# File lib/bf_ruby2/api/refunds_api.rb, line 276 def get_refund_for_refund_payment_with_http_info(payment_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: RefundsApi.get_refund_for_refund_payment ..." end # verify the required parameter 'payment_id' is set if @api_client.config.client_side_validation && payment_id.nil? fail ArgumentError, "Missing the required parameter 'payment_id' when calling RefundsApi.get_refund_for_refund_payment" end # resource path local_var_path = "/refunds/refund-payment/{payment-ID}".sub('{' + 'payment-ID' + '}', payment_id.to_s) # query parameters query_params = {} query_params[:'organizations'] = @api_client.build_collection_param(opts[:'organizations'], :multi) if !opts[:'organizations'].nil? # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json; charset=utf-8']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['text/plain']) # form parameters form_params = {} # http body (model) post_body = nil auth_names = [] data, status_code, headers = @api_client.call_api(:GET, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'RefundPagedMetadata') if @api_client.config.debugging @api_client.config.logger.debug "API called: RefundsApi#get_refund_for_refund_payment\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
Returns a refund for the refund payment. {"nickname":"Retrieve by invoice","response":"getRefundsByInvoice.html"} @param invoice_id ID of the Invoice
. @param [Hash] opts the optional parameters @option opts [Array<String>] :organizations A list of organization-IDs used to restrict the scope of API calls. @return [RefundPagedMetadata]
# File lib/bf_ruby2/api/refunds_api.rb, line 323 def get_refund_for_refunded_invoice(invoice_id, opts = {}) data, _status_code, _headers = get_refund_for_refunded_invoice_with_http_info(invoice_id, opts) return data end
Returns a refund for the refund payment. {"nickname":"Retrieve by invoice","response":"getRefundsByInvoice.html"} @param invoice_id ID of the Invoice
. @param [Hash] opts the optional parameters @option opts [Array<String>] :organizations A list of organization-IDs used to restrict the scope of API calls. @return [Array<(RefundPagedMetadata
, Fixnum, Hash)>] RefundPagedMetadata
data, response status code and response headers
# File lib/bf_ruby2/api/refunds_api.rb, line 334 def get_refund_for_refunded_invoice_with_http_info(invoice_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: RefundsApi.get_refund_for_refunded_invoice ..." end # verify the required parameter 'invoice_id' is set if @api_client.config.client_side_validation && invoice_id.nil? fail ArgumentError, "Missing the required parameter 'invoice_id' when calling RefundsApi.get_refund_for_refunded_invoice" end # resource path local_var_path = "/refunds/invoice/{invoice-ID}".sub('{' + 'invoice-ID' + '}', invoice_id.to_s) # query parameters query_params = {} query_params[:'organizations'] = @api_client.build_collection_param(opts[:'organizations'], :multi) if !opts[:'organizations'].nil? # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json; charset=utf-8']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['text/plain']) # form parameters form_params = {} # http body (model) post_body = nil auth_names = [] data, status_code, headers = @api_client.call_api(:GET, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'RefundPagedMetadata') if @api_client.config.debugging @api_client.config.logger.debug "API called: RefundsApi#get_refund_for_refunded_invoice\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
Retrieves refunds in CSV format. { "nickname":"Refunds CSV","response":"refunds.csv"} @param completed_start The UTC DateTime specifying the start of the interval within which refunds were completed. @param completed_end The UTC DateTime specifying the end of the interval within which refunds were completed. @param [Hash] opts the optional parameters @option opts [Array<String>] :organizations A list of organization-IDs used to restrict the scope of API calls. @option opts [Integer] :offset The offset from the first refund to return. @option opts [Integer] :records The maximum number of refunds to return. @option opts [String] :order_by Specify a field used to order the result set. (default to created) @option opts [String] :order The direction of any ordering, either ASC or DESC. (default to DESC) @return [RefundPagedMetadata]
# File lib/bf_ruby2/api/refunds_api.rb, line 386 def get_refunds_as_csv(completed_start, completed_end, opts = {}) data, _status_code, _headers = get_refunds_as_csv_with_http_info(completed_start, completed_end, opts) return data end
Retrieves refunds in CSV format. { "nickname":"Refunds CSV","response":"refunds.csv"} @param completed_start The UTC DateTime specifying the start of the interval within which refunds were completed. @param completed_end The UTC DateTime specifying the end of the interval within which refunds were completed. @param [Hash] opts the optional parameters @option opts [Array<String>] :organizations A list of organization-IDs used to restrict the scope of API calls. @option opts [Integer] :offset The offset from the first refund to return. @option opts [Integer] :records The maximum number of refunds to return. @option opts [String] :order_by Specify a field used to order the result set. @option opts [String] :order The direction of any ordering, either ASC or DESC. @return [Array<(RefundPagedMetadata
, Fixnum, Hash)>] RefundPagedMetadata
data, response status code and response headers
# File lib/bf_ruby2/api/refunds_api.rb, line 402 def get_refunds_as_csv_with_http_info(completed_start, completed_end, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: RefundsApi.get_refunds_as_csv ..." end # verify the required parameter 'completed_start' is set if @api_client.config.client_side_validation && completed_start.nil? fail ArgumentError, "Missing the required parameter 'completed_start' when calling RefundsApi.get_refunds_as_csv" end # verify the required parameter 'completed_end' is set if @api_client.config.client_side_validation && completed_end.nil? fail ArgumentError, "Missing the required parameter 'completed_end' when calling RefundsApi.get_refunds_as_csv" end if @api_client.config.client_side_validation && opts[:'order'] && !['ASC', 'DESC'].include?(opts[:'order']) fail ArgumentError, 'invalid value for "order", must be one of ASC, DESC' end # resource path local_var_path = "/refunds/csv" # query parameters query_params = {} query_params[:'completed_start'] = completed_start query_params[:'completed_end'] = completed_end query_params[:'organizations'] = @api_client.build_collection_param(opts[:'organizations'], :multi) if !opts[:'organizations'].nil? query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil? query_params[:'records'] = opts[:'records'] if !opts[:'records'].nil? query_params[:'order_by'] = opts[:'order_by'] if !opts[:'order_by'].nil? query_params[:'order'] = opts[:'order'] if !opts[:'order'].nil? # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['text/csv']) # form parameters form_params = {} # http body (model) post_body = nil auth_names = [] data, status_code, headers = @api_client.call_api(:GET, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'RefundPagedMetadata') if @api_client.config.debugging @api_client.config.logger.debug "API called: RefundsApi#get_refunds_as_csv\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
Update a refund {"nickname":"Update a refund","request":"updateRefundRequest.html","response":"updateRefundResponse.html"} @param refund The refund object to be update. @param [Hash] opts the optional parameters @return [RefundPagedMetadata]
# File lib/bf_ruby2/api/refunds_api.rb, line 459 def update_refund(refund, opts = {}) data, _status_code, _headers = update_refund_with_http_info(refund, opts) return data end
Update a refund {"nickname":"Update a refund","request":"updateRefundRequest.html","response":"updateRefundResponse.html"} @param refund The refund object to be update. @param [Hash] opts the optional parameters @return [Array<(RefundPagedMetadata
, Fixnum, Hash)>] RefundPagedMetadata
data, response status code and response headers
# File lib/bf_ruby2/api/refunds_api.rb, line 469 def update_refund_with_http_info(refund, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: RefundsApi.update_refund ..." end # verify the required parameter 'refund' is set if @api_client.config.client_side_validation && refund.nil? fail ArgumentError, "Missing the required parameter 'refund' when calling RefundsApi.update_refund" end # resource path local_var_path = "/refunds" # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['text/xml', 'application/xml', 'application/json; charset=utf-8']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json; charset=utf-8']) # form parameters form_params = {} # http body (model) post_body = @api_client.object_to_http_body(refund) auth_names = [] data, status_code, headers = @api_client.call_api(:PUT, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'RefundPagedMetadata') if @api_client.config.debugging @api_client.config.logger.debug "API called: RefundsApi#update_refund\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end