Class: CyberSource::MerchantDefinedFieldsApi

Inherits:
Object
  • Object
show all
Defined in:
lib/cybersource_rest_client/api/merchant_defined_fields_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default, config) ⇒ MerchantDefinedFieldsApi

Returns a new instance of MerchantDefinedFieldsApi.



18
19
20
21
# File 'lib/cybersource_rest_client/api/merchant_defined_fields_api.rb', line 18

def initialize(api_client = ApiClient.default, config)
  @api_client = api_client
  @api_client.set_configuration(config)
end

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



16
17
18
# File 'lib/cybersource_rest_client/api/merchant_defined_fields_api.rb', line 16

def api_client
  @api_client
end

Instance Method Details

#create_merchant_defined_field_definition(reference_type, merchant_defined_field_definition_request, opts = {}) ⇒ Array<InlineResponse2003>

Create merchant defined field for a given reference type

Parameters:

  • reference_type

    The reference type for which merchant defined fields are to be fetched. Available values are Invoice, Purchase, Donation

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

    the optional parameters

Returns:



29
30
31
32
# File 'lib/cybersource_rest_client/api/merchant_defined_fields_api.rb', line 29

def create_merchant_defined_field_definition(reference_type, merchant_defined_field_definition_request, opts = {})
  data, status_code, headers = create_merchant_defined_field_definition_with_http_info(reference_type, merchant_defined_field_definition_request, opts)
  return data, status_code, headers
end

#create_merchant_defined_field_definition_with_http_info(reference_type, merchant_defined_field_definition_request, opts = {}) ⇒ Array<(Array<InlineResponse2003>, Fixnum, Hash)>

Create merchant defined field for a given reference type

Parameters:

  • reference_type

    The reference type for which merchant defined fields are to be fetched. Available values are Invoice, Purchase, Donation

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

    the optional parameters

Returns:

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

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



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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
# File 'lib/cybersource_rest_client/api/merchant_defined_fields_api.rb', line 39

def create_merchant_defined_field_definition_with_http_info(reference_type, merchant_defined_field_definition_request, opts = {})

  if @api_client.config.debugging
      begin
        raise
            @api_client.config.logger.debug 'Calling API: MerchantDefinedFieldsApi.create_merchant_defined_field_definition ...'
        rescue
            puts 'Cannot write to log'
        end
  end
  # verify the required parameter 'reference_type' is set

  if @api_client.config.client_side_validation && reference_type.nil?
    fail ArgumentError, "Missing the required parameter 'reference_type' when calling MerchantDefinedFieldsApi.create_merchant_defined_field_definition"
  end
  # verify enum value

  if @api_client.config.client_side_validation && !['Invoice', 'Purchase', 'Donation'].include?(reference_type)
    fail ArgumentError, "invalid value for 'reference_type', must be one of Invoice, Purchase, Donation"
  end
  # verify the required parameter 'merchant_defined_field_definition_request' is set

  if @api_client.config.client_side_validation && merchant_defined_field_definition_request.nil?
    fail ArgumentError, "Missing the required parameter 'merchant_defined_field_definition_request' when calling MerchantDefinedFieldsApi.create_merchant_defined_field_definition"
  end
  # resource path

  local_var_path = 'invoicing/v2/{referenceType}/merchantDefinedFields'.sub('{' + 'referenceType' + '}', reference_type.to_s)

  # query parameters

  query_params = {}

  # header parameters

  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'])

  # form parameters

  form_params = {}

  # http body (model)

  post_body = @api_client.object_to_http_body(merchant_defined_field_definition_request)
  sdk_tracker = SdkTracker.new
  post_body = sdk_tracker.insert_developer_id_tracker(post_body, 'MerchantDefinedFieldDefinitionRequest', @api_client.config.host, @api_client.merchantconfig.defaultDeveloperId)
  inbound_mle_status = "false"      
  if MLEUtility.check_is_mle_for_API(@api_client.merchantconfig, inbound_mle_status, ["create_merchant_defined_field_definition","create_merchant_defined_field_definition_with_http_info"])
    begin
      post_body = MLEUtility.encrypt_request_payload(@api_client.merchantconfig, post_body)
    rescue
      raise
    end
  end
  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 => 'Array<InlineResponse2003>')
  if @api_client.config.debugging
    begin
    raise
        @api_client.config.logger.debug "API called: MerchantDefinedFieldsApi#create_merchant_defined_field_definition\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
    rescue
        puts 'Cannot write to log'
    end
  end
  return data, status_code, headers
end

#delete_merchant_defined_fields_definitions(reference_type, id, opts = {}) ⇒ nil

Delete a MerchantDefinedField by ID

Parameters:

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

    the optional parameters

Returns:

  • (nil)


114
115
116
117
# File 'lib/cybersource_rest_client/api/merchant_defined_fields_api.rb', line 114

def delete_merchant_defined_fields_definitions(reference_type, id, opts = {})
  data, status_code, headers = delete_merchant_defined_fields_definitions_with_http_info(reference_type, id, opts)
  return data, status_code, headers
end

#delete_merchant_defined_fields_definitions_with_http_info(reference_type, id, opts = {}) ⇒ Array<(nil, Fixnum, Hash)>

Delete a MerchantDefinedField by ID

Parameters:

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

    the optional parameters

Returns:

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

    nil, response status code and response headers



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
179
180
181
182
183
184
185
186
187
188
189
190
191
192
# File 'lib/cybersource_rest_client/api/merchant_defined_fields_api.rb', line 124

def delete_merchant_defined_fields_definitions_with_http_info(reference_type, id, opts = {})

  if @api_client.config.debugging
      begin
        raise
            @api_client.config.logger.debug 'Calling API: MerchantDefinedFieldsApi.delete_merchant_defined_fields_definitions ...'
        rescue
            puts 'Cannot write to log'
        end
  end
  # verify the required parameter 'reference_type' is set

  if @api_client.config.client_side_validation && reference_type.nil?
    fail ArgumentError, "Missing the required parameter 'reference_type' when calling MerchantDefinedFieldsApi.delete_merchant_defined_fields_definitions"
  end
  # verify enum value

  if @api_client.config.client_side_validation && !['Invoice', 'Purchase', 'Donation'].include?(reference_type)
    fail ArgumentError, "invalid value for 'reference_type', must be one of Invoice, Purchase, Donation"
  end
  # verify the required parameter 'id' is set

  if @api_client.config.client_side_validation && id.nil?
    fail ArgumentError, "Missing the required parameter 'id' when calling MerchantDefinedFieldsApi.delete_merchant_defined_fields_definitions"
  end
  # resource path

  local_var_path = 'invoicing/v2/{referenceType}/merchantDefinedFields/{id}'.sub('{' + 'referenceType' + '}', reference_type.to_s).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/hal+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)

  if 'DELETE' == 'POST'
    post_body = '{}'
  else
    post_body = nil
  end
  inbound_mle_status = "false"      
  if MLEUtility.check_is_mle_for_API(@api_client.merchantconfig, inbound_mle_status, ["delete_merchant_defined_fields_definitions","delete_merchant_defined_fields_definitions_with_http_info"])
    begin
      post_body = MLEUtility.encrypt_request_payload(@api_client.merchantconfig, post_body)
    rescue
      raise
    end
  end
  auth_names = []
  data, status_code, headers = @api_client.call_api(:DELETE, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names)
  if @api_client.config.debugging
    begin
    raise
        @api_client.config.logger.debug "API called: MerchantDefinedFieldsApi#delete_merchant_defined_fields_definitions\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
    rescue
        puts 'Cannot write to log'
    end
  end
  return data, status_code, headers
end

#get_merchant_defined_fields_definitions(reference_type, opts = {}) ⇒ Array<InlineResponse2003>

Get all merchant defined fields for a given reference type

Parameters:

  • reference_type

    The reference type for which merchant defined fields are to be fetched. Available values are Invoice, Purchase, Donation

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

    the optional parameters

Returns:



199
200
201
202
# File 'lib/cybersource_rest_client/api/merchant_defined_fields_api.rb', line 199

def get_merchant_defined_fields_definitions(reference_type, opts = {})
  data, status_code, headers = get_merchant_defined_fields_definitions_with_http_info(reference_type, opts)
  return data, status_code, headers
end

#get_merchant_defined_fields_definitions_with_http_info(reference_type, opts = {}) ⇒ Array<(Array<InlineResponse2003>, Fixnum, Hash)>

Get all merchant defined fields for a given reference type

Parameters:

  • reference_type

    The reference type for which merchant defined fields are to be fetched. Available values are Invoice, Purchase, Donation

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

    the optional parameters

Returns:

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

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



208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
# File 'lib/cybersource_rest_client/api/merchant_defined_fields_api.rb', line 208

def get_merchant_defined_fields_definitions_with_http_info(reference_type, opts = {})

  if @api_client.config.debugging
      begin
        raise
            @api_client.config.logger.debug 'Calling API: MerchantDefinedFieldsApi.get_merchant_defined_fields_definitions ...'
        rescue
            puts 'Cannot write to log'
        end
  end
  # verify the required parameter 'reference_type' is set

  if @api_client.config.client_side_validation && reference_type.nil?
    fail ArgumentError, "Missing the required parameter 'reference_type' when calling MerchantDefinedFieldsApi.get_merchant_defined_fields_definitions"
  end
  # verify enum value

  if @api_client.config.client_side_validation && !['Invoice', 'Purchase', 'Donation'].include?(reference_type)
    fail ArgumentError, "invalid value for 'reference_type', must be one of Invoice, Purchase, Donation"
  end
  # resource path

  local_var_path = 'invoicing/v2/{referenceType}/merchantDefinedFields'.sub('{' + 'referenceType' + '}', reference_type.to_s)

  # query parameters

  query_params = {}

  # header parameters

  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'])

  # form parameters

  form_params = {}

  # http body (model)

  if 'GET' == 'POST'
    post_body = '{}'
  else
    post_body = nil
  end
  inbound_mle_status = "false"      
  if MLEUtility.check_is_mle_for_API(@api_client.merchantconfig, inbound_mle_status, ["get_merchant_defined_fields_definitions","get_merchant_defined_fields_definitions_with_http_info"])
    begin
      post_body = MLEUtility.encrypt_request_payload(@api_client.merchantconfig, post_body)
    rescue
      raise
    end
  end
  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 => 'Array<InlineResponse2003>')
  if @api_client.config.debugging
    begin
    raise
        @api_client.config.logger.debug "API called: MerchantDefinedFieldsApi#get_merchant_defined_fields_definitions\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
    rescue
        puts 'Cannot write to log'
    end
  end
  return data, status_code, headers
end

#put_merchant_defined_fields_definitions(reference_type, id, merchant_defined_field_core, opts = {}) ⇒ Array<InlineResponse2003>

Update a MerchantDefinedField by ID

Parameters:

  • reference_type
  • id
  • merchant_defined_field_core
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



282
283
284
285
# File 'lib/cybersource_rest_client/api/merchant_defined_fields_api.rb', line 282

def put_merchant_defined_fields_definitions(reference_type, id, merchant_defined_field_core, opts = {})
  data, status_code, headers = put_merchant_defined_fields_definitions_with_http_info(reference_type, id, merchant_defined_field_core, opts)
  return data, status_code, headers
end

#put_merchant_defined_fields_definitions_with_http_info(reference_type, id, merchant_defined_field_core, opts = {}) ⇒ Array<(Array<InlineResponse2003>, Fixnum, Hash)>

Update a MerchantDefinedField by ID

Parameters:

  • reference_type
  • id
  • merchant_defined_field_core
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

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

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



293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
# File 'lib/cybersource_rest_client/api/merchant_defined_fields_api.rb', line 293

def put_merchant_defined_fields_definitions_with_http_info(reference_type, id, merchant_defined_field_core, opts = {})

  if @api_client.config.debugging
      begin
        raise
            @api_client.config.logger.debug 'Calling API: MerchantDefinedFieldsApi.put_merchant_defined_fields_definitions ...'
        rescue
            puts 'Cannot write to log'
        end
  end
  # verify the required parameter 'reference_type' is set

  if @api_client.config.client_side_validation && reference_type.nil?
    fail ArgumentError, "Missing the required parameter 'reference_type' when calling MerchantDefinedFieldsApi.put_merchant_defined_fields_definitions"
  end
  # verify enum value

  if @api_client.config.client_side_validation && !['Invoice', 'Purchase', 'Donation'].include?(reference_type)
    fail ArgumentError, "invalid value for 'reference_type', must be one of Invoice, Purchase, Donation"
  end
  # verify the required parameter 'id' is set

  if @api_client.config.client_side_validation && id.nil?
    fail ArgumentError, "Missing the required parameter 'id' when calling MerchantDefinedFieldsApi.put_merchant_defined_fields_definitions"
  end
  # verify the required parameter 'merchant_defined_field_core' is set

  if @api_client.config.client_side_validation && merchant_defined_field_core.nil?
    fail ArgumentError, "Missing the required parameter 'merchant_defined_field_core' when calling MerchantDefinedFieldsApi.put_merchant_defined_fields_definitions"
  end
  # resource path

  local_var_path = 'invoicing/v2/{referenceType}/merchantDefinedFields/{id}'.sub('{' + 'referenceType' + '}', reference_type.to_s).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/hal+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(merchant_defined_field_core)
  sdk_tracker = SdkTracker.new
  post_body = sdk_tracker.insert_developer_id_tracker(post_body, 'MerchantDefinedFieldCore', @api_client.config.host, @api_client.merchantconfig.defaultDeveloperId)
  inbound_mle_status = "false"      
  if MLEUtility.check_is_mle_for_API(@api_client.merchantconfig, inbound_mle_status, ["put_merchant_defined_fields_definitions","put_merchant_defined_fields_definitions_with_http_info"])
    begin
      post_body = MLEUtility.encrypt_request_payload(@api_client.merchantconfig, post_body)
    rescue
      raise
    end
  end
  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 => 'Array<InlineResponse2003>')
  if @api_client.config.debugging
    begin
    raise
        @api_client.config.logger.debug "API called: MerchantDefinedFieldsApi#put_merchant_defined_fields_definitions\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
    rescue
        puts 'Cannot write to log'
    end
  end
  return data, status_code, headers
end