Class: Yapstone::DisbursementsApi

Inherits:
Object
  • Object
show all
Defined in:
lib/yapstone-payments/api/disbursements_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ DisbursementsApi

Returns a new instance of DisbursementsApi.



19
20
21
# File 'lib/yapstone-payments/api/disbursements_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/yapstone-payments/api/disbursements_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#disburse_payment_by_id(authorization, x_yapstone_ip_address, payment_id, disbursement_requests, opts = {}) ⇒ PaymentResponse

Change payment from "Hold payout" state to be ready for disbursement Disburse payment

Parameters:

  • authorization (String)

    Authorization

  • x_yapstone_ip_address (String)

    IP Address of the client

  • payment_id (String)
  • disbursement_requests (DisbursementRequests)
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :x_yapstone_trace_id (String)

    Optionally provide a unique identifier for this request, for use later if you need to debug this request with Yapstone support. Can be any arbitrary string.

  • :x_yapstone_fpsid (String)

    Device Finger Print Id

Returns:



32
33
34
35
# File 'lib/yapstone-payments/api/disbursements_api.rb', line 32

def disburse_payment_by_id(authorization, x_yapstone_ip_address, payment_id, disbursement_requests, opts = {})
  data, _status_code, _headers = disburse_payment_by_id_with_http_info(authorization, x_yapstone_ip_address, payment_id, disbursement_requests, opts)
  data
end

#disburse_payment_by_id_with_http_info(authorization, x_yapstone_ip_address, payment_id, disbursement_requests, opts = {}) ⇒ Array<(PaymentResponse, Integer, Hash)>

Change payment from &quot;Hold payout&quot; state to be ready for disbursement Disburse payment

Parameters:

  • authorization (String)

    Authorization

  • x_yapstone_ip_address (String)

    IP Address of the client

  • payment_id (String)
  • disbursement_requests (DisbursementRequests)
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :x_yapstone_trace_id (String)

    Optionally provide a unique identifier for this request, for use later if you need to debug this request with Yapstone support. Can be any arbitrary string.

  • :x_yapstone_fpsid (String)

    Device Finger Print Id

Returns:

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

    PaymentResponse data, response status code and response headers



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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
# File 'lib/yapstone-payments/api/disbursements_api.rb', line 47

def disburse_payment_by_id_with_http_info(authorization, x_yapstone_ip_address, payment_id, disbursement_requests, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: DisbursementsApi.disburse_payment_by_id ...'
  end
  # verify the required parameter 'authorization' is set
  if @api_client.config.client_side_validation && authorization.nil?
    fail ArgumentError, "Missing the required parameter 'authorization' when calling DisbursementsApi.disburse_payment_by_id"
  end
  # verify the required parameter 'x_yapstone_ip_address' is set
  if @api_client.config.client_side_validation && x_yapstone_ip_address.nil?
    fail ArgumentError, "Missing the required parameter 'x_yapstone_ip_address' when calling DisbursementsApi.disburse_payment_by_id"
  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 DisbursementsApi.disburse_payment_by_id"
  end
  # verify the required parameter 'disbursement_requests' is set
  if @api_client.config.client_side_validation && disbursement_requests.nil?
    fail ArgumentError, "Missing the required parameter 'disbursement_requests' when calling DisbursementsApi.disburse_payment_by_id"
  end
  # resource path
  local_var_path = '/v2/disbursements/payment/{paymentId}'.sub('{' + 'paymentId' + '}', CGI.escape(payment_id.to_s).gsub('%2F', '/'))

  # 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'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
  header_params[:'Authorization'] = authorization
  header_params[:'X-Yapstone-IPAddress'] = x_yapstone_ip_address
  header_params[:'X-Yapstone-Trace-Id'] = opts[:'x_yapstone_trace_id'] if !opts[:'x_yapstone_trace_id'].nil?
  header_params[:'X-Yapstone-fpsid'] = opts[:'x_yapstone_fpsid'] if !opts[:'x_yapstone_fpsid'].nil?

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

  # http body (model)
  post_body = opts[:body] || @api_client.object_to_http_body(disbursement_requests) 

  # return_type
  return_type = opts[:return_type] || 'PaymentResponse' 

  # auth_names
  auth_names = opts[:auth_names] || ['Bearer']

  new_options = opts.merge(
    :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(:PUT, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: DisbursementsApi#disburse_payment_by_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#disburse_transaction_by_id(authorization, x_yapstone_ip_address, transaction_id, disburse_transaction_req, opts = {}) ⇒ PaymentResponse

Change transaction from "Hold payout" state to be ready for disbursement (payout) Provide the transaction ID for the transaction where you want to shift state so that money can finally be paid out (disbursed).

Parameters:

  • authorization (String)

    Authorization

  • x_yapstone_ip_address (String)

    IP Address of the client

  • transaction_id (String)

    The identification number for the transaction you want to disburse.

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

    the optional parameters

Options Hash (opts):

  • :x_yapstone_trace_id (String)

    Optionally provide a unique identifier for this request, for use later if you need to debug this request with Yapstone support. Can be any arbitrary string.

  • :x_yapstone_fpsid (String)

    Device Finger Print Id

Returns:



122
123
124
125
# File 'lib/yapstone-payments/api/disbursements_api.rb', line 122

def disburse_transaction_by_id(authorization, x_yapstone_ip_address, transaction_id, disburse_transaction_req, opts = {})
  data, _status_code, _headers = disburse_transaction_by_id_with_http_info(authorization, x_yapstone_ip_address, transaction_id, disburse_transaction_req, opts)
  data
end

#disburse_transaction_by_id_with_http_info(authorization, x_yapstone_ip_address, transaction_id, disburse_transaction_req, opts = {}) ⇒ Array<(PaymentResponse, Integer, Hash)>

Change transaction from &quot;Hold payout&quot; state to be ready for disbursement (payout) Provide the transaction ID for the transaction where you want to shift state so that money can finally be paid out (disbursed).

Parameters:

  • authorization (String)

    Authorization

  • x_yapstone_ip_address (String)

    IP Address of the client

  • transaction_id (String)

    The identification number for the transaction you want to disburse.

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

    the optional parameters

Options Hash (opts):

  • :x_yapstone_trace_id (String)

    Optionally provide a unique identifier for this request, for use later if you need to debug this request with Yapstone support. Can be any arbitrary string.

  • :x_yapstone_fpsid (String)

    Device Finger Print Id

Returns:

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

    PaymentResponse data, response status code and response headers



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
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
# File 'lib/yapstone-payments/api/disbursements_api.rb', line 137

def disburse_transaction_by_id_with_http_info(authorization, x_yapstone_ip_address, transaction_id, disburse_transaction_req, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: DisbursementsApi.disburse_transaction_by_id ...'
  end
  # verify the required parameter 'authorization' is set
  if @api_client.config.client_side_validation && authorization.nil?
    fail ArgumentError, "Missing the required parameter 'authorization' when calling DisbursementsApi.disburse_transaction_by_id"
  end
  # verify the required parameter 'x_yapstone_ip_address' is set
  if @api_client.config.client_side_validation && x_yapstone_ip_address.nil?
    fail ArgumentError, "Missing the required parameter 'x_yapstone_ip_address' when calling DisbursementsApi.disburse_transaction_by_id"
  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 DisbursementsApi.disburse_transaction_by_id"
  end
  # verify the required parameter 'disburse_transaction_req' is set
  if @api_client.config.client_side_validation && disburse_transaction_req.nil?
    fail ArgumentError, "Missing the required parameter 'disburse_transaction_req' when calling DisbursementsApi.disburse_transaction_by_id"
  end
  # resource path
  local_var_path = '/v2/disbursements/transaction/{transactionId}'.sub('{' + 'transactionId' + '}', CGI.escape(transaction_id.to_s).gsub('%2F', '/'))

  # 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'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
  header_params[:'Authorization'] = authorization
  header_params[:'X-Yapstone-IPAddress'] = x_yapstone_ip_address
  header_params[:'X-Yapstone-Trace-Id'] = opts[:'x_yapstone_trace_id'] if !opts[:'x_yapstone_trace_id'].nil?
  header_params[:'X-Yapstone-fpsid'] = opts[:'x_yapstone_fpsid'] if !opts[:'x_yapstone_fpsid'].nil?

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

  # http body (model)
  post_body = opts[:body] || @api_client.object_to_http_body(disburse_transaction_req) 

  # return_type
  return_type = opts[:return_type] || 'PaymentResponse' 

  # auth_names
  auth_names = opts[:auth_names] || ['Bearer']

  new_options = opts.merge(
    :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(:PUT, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: DisbursementsApi#disburse_transaction_by_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end