Class: ZipMoney::RefundsApi

Inherits:
Object
  • Object
show all
Defined in:
lib/zip_money/api/refunds_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ RefundsApi

Returns a new instance of RefundsApi.



12
13
14
# File 'lib/zip_money/api/refunds_api.rb', line 12

def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



10
11
12
# File 'lib/zip_money/api/refunds_api.rb', line 10

def api_client
  @api_client
end

Instance Method Details

#refunds_create(opts = {}) ⇒ Refund

Create a refund Creates a refund for a previously authorised or captured charge. See #model:xWJer4QQyRumRi9LD for more information. This endpoint will return 201 or otherwise 402 if unable to perform the refund. | Error code | Description | |————————————|————————————————————————————————–| | amount_invalid | The refund amount is greater than the remaining captured total | | invalid_state | 1. The charge is already fully refunded |

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

Returns:



22
23
24
25
# File 'lib/zip_money/api/refunds_api.rb', line 22

def refunds_create(opts = {})
  data, _status_code, _headers = refunds_create_with_http_info(opts)
  return data
end

#refunds_create_with_http_info(opts = {}) ⇒ Array<(Refund, Fixnum, Hash)>

Create a refund Creates a refund for a previously authorised or captured charge. See #model:xWJer4QQyRumRi9LD for more information. This endpoint will return 201 or otherwise 402 if unable to perform the refund. | Error code | Description | |————————————|————————————————————————————————–| | amount_invalid | The refund amount is greater than the remaining captured total | | invalid_state | 1. The charge is already fully refunded |

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

Returns:

  • (Array<(Refund, Fixnum, Hash)>)

    Refund data, response status code and response headers



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# File 'lib/zip_money/api/refunds_api.rb', line 33

def refunds_create_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: RefundsApi.refunds_create ..."
  end
  # resource path
  local_var_path = "/refunds".sub('{format}','json')

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/javascript'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
  header_params[:'Idempotency-Key'] = opts[:'idempotency_key'] if !opts[:'idempotency_key'].nil?

  # form parameters
  form_params = {}

  # http body (model)
  post_body = @api_client.object_to_http_body(opts[:'body'])
  auth_names = ['Authorization']
  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 => 'Refund')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: RefundsApi#refunds_create\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#refunds_list(opts = {}) ⇒ Array<InlineResponse200>

List refunds List all refunds

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :charge_id (String)
  • :skip (Integer)

    Number of items to skip when paging (default to 0)

  • :limit (Integer)

    Number of items to retrieve when paging (default to 100)

Returns:



77
78
79
80
# File 'lib/zip_money/api/refunds_api.rb', line 77

def refunds_list(opts = {})
  data, _status_code, _headers = refunds_list_with_http_info(opts)
  return data
end

#refunds_list_with_http_info(opts = {}) ⇒ Array<(Array<InlineResponse200>, Fixnum, Hash)>

List refunds List all refunds

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :charge_id (String)
  • :skip (Integer)

    Number of items to skip when paging

  • :limit (Integer)

    Number of items to retrieve when paging

Returns:

  • (Array<(Array<InlineResponse200>, Fixnum, Hash)>)

    Array<InlineResponse200> data, response status code and response headers



89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
# File 'lib/zip_money/api/refunds_api.rb', line 89

def refunds_list_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: RefundsApi.refunds_list ..."
  end
  # resource path
  local_var_path = "/refunds".sub('{format}','json')

  # query parameters
  query_params = {}
  query_params[:'chargeId'] = opts[:'charge_id'] if !opts[:'charge_id'].nil?
  query_params[:'skip'] = opts[:'skip'] if !opts[:'skip'].nil?
  query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/javascript'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/javascript'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['Authorization']
  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 => 'Array<InlineResponse200>')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: RefundsApi#refunds_list\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#refunds_retrieve(id, opts = {}) ⇒ Refund

Retrieve a refund Retrieves details of a specific refund

Parameters:

  • id

    The id of the refund

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



133
134
135
136
# File 'lib/zip_money/api/refunds_api.rb', line 133

def refunds_retrieve(id, opts = {})
  data, _status_code, _headers = refunds_retrieve_with_http_info(id, opts)
  return data
end

#refunds_retrieve_with_http_info(id, opts = {}) ⇒ Array<(Refund, Fixnum, Hash)>

Retrieve a refund Retrieves details of a specific refund

Parameters:

  • id

    The id of the refund

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(Refund, Fixnum, Hash)>)

    Refund data, response status code and response headers



143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
# File 'lib/zip_money/api/refunds_api.rb', line 143

def refunds_retrieve_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: RefundsApi.refunds_retrieve ..."
  end
  # verify the required parameter 'id' is set
  fail ArgumentError, "Missing the required parameter 'id' when calling RefundsApi.refunds_retrieve" if id.nil?
  # resource path
  local_var_path = "/refunds/{id}".sub('{format}','json').sub('{' + 'id' + '}', id.to_s)

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/javascript'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/javascript'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['Authorization']
  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 => 'Refund')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: RefundsApi#refunds_retrieve\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end