Class: PaymentsApi::TransactionsApi

Inherits:
Object
  • Object
show all
Defined in:
lib/pnap_payments_api/api/transactions_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ TransactionsApi

Returns a new instance of TransactionsApi.



19
20
21
# File 'lib/pnap_payments_api/api/transactions_api.rb', line 19

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

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



17
18
19
# File 'lib/pnap_payments_api/api/transactions_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#transaction_id_get(transaction_id, opts = {}) ⇒ Transaction

Get Transaction. Get transaction details.

Parameters:

  • transaction_id (String)

    The transaction identifier.

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

    the optional parameters

Returns:



27
28
29
30
# File 'lib/pnap_payments_api/api/transactions_api.rb', line 27

def transaction_id_get(transaction_id, opts = {})
  data, _status_code, _headers = transaction_id_get_with_http_info(transaction_id, opts)
  data
end

#transaction_id_get_with_http_info(transaction_id, opts = {}) ⇒ Array<(Transaction, Integer, Hash)>

Get Transaction. Get transaction details.

Parameters:

  • transaction_id (String)

    The transaction identifier.

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

    the optional parameters

Returns:

  • (Array<(Transaction, Integer, Hash)>)

    Transaction data, response status code and response headers



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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# File 'lib/pnap_payments_api/api/transactions_api.rb', line 37

def transaction_id_get_with_http_info(transaction_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: TransactionsApi.transaction_id_get ...'
  end
  # verify the required parameter 'transaction_id' is set
  if @api_client.config.client_side_validation && transaction_id.nil?
    fail ArgumentError, "Missing the required parameter 'transaction_id' when calling TransactionsApi.transaction_id_get"
  end
  # resource path
  local_var_path = '/transactions/{transactionId}'.sub('{' + 'transactionId' + '}', CGI.escape(transaction_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'Transaction'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['OAuth2']

  new_options = opts.merge(
    :operation => :"TransactionsApi.transaction_id_get",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: TransactionsApi#transaction_id_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#transactions_get(opts = {}) ⇒ PaginatedTransactions

Get Transactions. A paginated list of client’s transactions.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :limit (Integer)

    The limit of the number of results returned. The number of records returned may be smaller than the limit. (default to 100)

  • :offset (Integer)

    The number of items to skip in the results. (default to 0)

  • :sort_direction (String)

    Sort Given Field depending on the desired direction. Default sorting is descending. (default to ‘DESC’)

  • :sort_field (String)

    If a sortField is requested, pagination will be done after sorting. Default sorting is by date. (default to ‘date’)

  • :from (Time)

    From the date and time (inclusive) to filter transactions by.

  • :to (Time)

    To the date and time (inclusive) to filter transactions by.

Returns:



95
96
97
98
# File 'lib/pnap_payments_api/api/transactions_api.rb', line 95

def transactions_get(opts = {})
  data, _status_code, _headers = transactions_get_with_http_info(opts)
  data
end

#transactions_get_with_http_info(opts = {}) ⇒ Array<(PaginatedTransactions, Integer, Hash)>

Get Transactions. A paginated list of client&#39;s transactions.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :limit (Integer)

    The limit of the number of results returned. The number of records returned may be smaller than the limit. (default to 100)

  • :offset (Integer)

    The number of items to skip in the results. (default to 0)

  • :sort_direction (String)

    Sort Given Field depending on the desired direction. Default sorting is descending. (default to ‘DESC’)

  • :sort_field (String)

    If a sortField is requested, pagination will be done after sorting. Default sorting is by date. (default to ‘date’)

  • :from (Time)

    From the date and time (inclusive) to filter transactions by.

  • :to (Time)

    To the date and time (inclusive) to filter transactions by.

Returns:

  • (Array<(PaginatedTransactions, Integer, Hash)>)

    PaginatedTransactions data, response status code and response headers



110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
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
# File 'lib/pnap_payments_api/api/transactions_api.rb', line 110

def transactions_get_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: TransactionsApi.transactions_get ...'
  end
  if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 1000
    fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling TransactionsApi.transactions_get, must be smaller than or equal to 1000.'
  end

  if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1
    fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling TransactionsApi.transactions_get, must be greater than or equal to 1.'
  end

  if @api_client.config.client_side_validation && !opts[:'offset'].nil? && opts[:'offset'] < 0
    fail ArgumentError, 'invalid value for "opts[:"offset"]" when calling TransactionsApi.transactions_get, must be greater than or equal to 0.'
  end

  allowable_values = ["ASC", "DESC"]
  if @api_client.config.client_side_validation && opts[:'sort_direction'] && !allowable_values.include?(opts[:'sort_direction'])
    fail ArgumentError, "invalid value for \"sort_direction\", must be one of #{allowable_values}"
  end
  allowable_values = ["date", "amount", "status", "cardPaymentMethodDetails.cardType", "cardPaymentMethodDetails.lastFourDigits", "metadata.invoiceId", "metadata.isAutoCharge"]
  if @api_client.config.client_side_validation && opts[:'sort_field'] && !allowable_values.include?(opts[:'sort_field'])
    fail ArgumentError, "invalid value for \"sort_field\", must be one of #{allowable_values}"
  end
  # resource path
  local_var_path = '/transactions'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
  query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?
  query_params[:'sortDirection'] = opts[:'sort_direction'] if !opts[:'sort_direction'].nil?
  query_params[:'sortField'] = opts[:'sort_field'] if !opts[:'sort_field'].nil?
  query_params[:'from'] = opts[:'from'] if !opts[:'from'].nil?
  query_params[:'to'] = opts[:'to'] if !opts[:'to'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'PaginatedTransactions'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['OAuth2']

  new_options = opts.merge(
    :operation => :"TransactionsApi.transactions_get",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: TransactionsApi#transactions_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end