Class: CyberSource::PlansApi

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

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

Returns a new instance of PlansApi.



18
19
20
21
# File 'lib/cybersource_rest_client/api/plans_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/plans_api.rb', line 16

def api_client
  @api_client
end

Instance Method Details

#activate_plan(id, opts = {}) ⇒ ActivateDeactivatePlanResponse

Activate a Plan Activate a Plan

Parameters:

  • id

    Plan Id

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

    the optional parameters

Returns:



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

def activate_plan(id, opts = {})
  data, status_code, headers = activate_plan_with_http_info(id, opts)
  return data, status_code, headers
end

#activate_plan_with_http_info(id, opts = {}) ⇒ Array<(ActivateDeactivatePlanResponse, Fixnum, Hash)>

Activate a Plan Activate a Plan

Parameters:

  • id

    Plan Id

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

    the optional parameters

Returns:



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
# File 'lib/cybersource_rest_client/api/plans_api.rb', line 39

def activate_plan_with_http_info(id, opts = {})

  if @api_client.config.debugging
      begin
        raise
            @api_client.config.logger.debug 'Calling API: PlansApi.activate_plan ...'
        rescue
            puts 'Cannot write to log'
        end
  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 PlansApi.activate_plan"
  end
  # resource path
  local_var_path = 'rbs/v1/plans/{id}/activate'.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/json', 'application/hal+json', 'application/json;charset=utf-8', '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 'POST' == '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, ["activate_plan","activate_plan_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 => 'ActivateDeactivatePlanResponse')
  if @api_client.config.debugging
    begin
    raise
        @api_client.config.logger.debug "API called: PlansApi#activate_plan\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
    rescue
        puts 'Cannot write to log'
    end
  end
  return data, status_code, headers
end

#create_plan(create_plan_request, opts = {}) ⇒ CreatePlanResponse

Create a Plan The recurring billing service enables you to manage payment plans and subscriptions for recurring payment schedules. It securely stores your customer’s payment information and personal data within secure Visa data centers, reducing storage risks and PCI DSS scope through the use of *Token Management* (TMS). The three key elements of Cybersource Recurring Billing are: -  Token: stores customer billing, shipping, and payment details. -  Plan: stores the billing schedule. -  Subscription: combines the token and plan, and defines the subscription start date, name, and description. The APIs in this section demonstrate the management of the Plans and Subscriptions. For Tokens please refer to [Token Management](#token-management) The availability of API features for a merchant can depend on the portfolio configuration and may need to be enabled at the portfolio level before they can be added to merchant accounts.

Parameters:

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

    the optional parameters

Returns:



108
109
110
111
# File 'lib/cybersource_rest_client/api/plans_api.rb', line 108

def create_plan(create_plan_request, opts = {})
  data, status_code, headers = create_plan_with_http_info(create_plan_request, opts)
  return data, status_code, headers
end

#create_plan_with_http_info(create_plan_request, opts = {}) ⇒ Array<(CreatePlanResponse, Fixnum, Hash)>

Create a Plan The recurring billing service enables you to manage payment plans and subscriptions for recurring payment schedules. It securely stores your customer&#39;s payment information and personal data within secure Visa data centers, reducing storage risks and PCI DSS scope through the use of *Token Management* (TMS). The three key elements of Cybersource Recurring Billing are: -  Token: stores customer billing, shipping, and payment details. -  Plan: stores the billing schedule. -  Subscription: combines the token and plan, and defines the subscription start date, name, and description. The APIs in this section demonstrate the management of the Plans and Subscriptions. For Tokens please refer to [Token Management](#token-management) The availability of API features for a merchant can depend on the portfolio configuration and may need to be enabled at the portfolio level before they can be added to merchant accounts.

Parameters:

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

    the optional parameters

Returns:

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

    CreatePlanResponse data, response status code and response headers



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
# File 'lib/cybersource_rest_client/api/plans_api.rb', line 118

def create_plan_with_http_info(create_plan_request, opts = {})

  if @api_client.config.debugging
      begin
        raise
            @api_client.config.logger.debug 'Calling API: PlansApi.create_plan ...'
        rescue
            puts 'Cannot write to log'
        end
  end
  # verify the required parameter 'create_plan_request' is set
  if @api_client.config.client_side_validation && create_plan_request.nil?
    fail ArgumentError, "Missing the required parameter 'create_plan_request' when calling PlansApi.create_plan"
  end
  # resource path
  local_var_path = 'rbs/v1/plans'

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json', 'application/hal+json', 'application/json;charset=utf-8', '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(create_plan_request)
  sdk_tracker = SdkTracker.new
  post_body = sdk_tracker.insert_developer_id_tracker(post_body, 'CreatePlanRequest', @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_plan","create_plan_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 => 'CreatePlanResponse')
  if @api_client.config.debugging
    begin
    raise
        @api_client.config.logger.debug "API called: PlansApi#create_plan\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
    rescue
        puts 'Cannot write to log'
    end
  end
  return data, status_code, headers
end

#deactivate_plan(id, opts = {}) ⇒ ActivateDeactivatePlanResponse

Deactivate a Plan Deactivate a Plan

Parameters:

  • id

    Plan Id

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

    the optional parameters

Returns:



185
186
187
188
# File 'lib/cybersource_rest_client/api/plans_api.rb', line 185

def deactivate_plan(id, opts = {})
  data, status_code, headers = deactivate_plan_with_http_info(id, opts)
  return data, status_code, headers
end

#deactivate_plan_with_http_info(id, opts = {}) ⇒ Array<(ActivateDeactivatePlanResponse, Fixnum, Hash)>

Deactivate a Plan Deactivate a Plan

Parameters:

  • id

    Plan Id

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

    the optional parameters

Returns:



195
196
197
198
199
200
201
202
203
204
205
206
207
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
# File 'lib/cybersource_rest_client/api/plans_api.rb', line 195

def deactivate_plan_with_http_info(id, opts = {})

  if @api_client.config.debugging
      begin
        raise
            @api_client.config.logger.debug 'Calling API: PlansApi.deactivate_plan ...'
        rescue
            puts 'Cannot write to log'
        end
  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 PlansApi.deactivate_plan"
  end
  # resource path
  local_var_path = 'rbs/v1/plans/{id}/deactivate'.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/json', 'application/hal+json', 'application/json;charset=utf-8', '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 'POST' == '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, ["deactivate_plan","deactivate_plan_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 => 'ActivateDeactivatePlanResponse')
  if @api_client.config.debugging
    begin
    raise
        @api_client.config.logger.debug "API called: PlansApi#deactivate_plan\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
    rescue
        puts 'Cannot write to log'
    end
  end
  return data, status_code, headers
end

#delete_plan(id, opts = {}) ⇒ DeletePlanResponse

Delete a Plan Delete a Plan is only allowed: - plan status is in ‘DRAFT` - plan status is in `ACTIVE`, and `INACTIVE` only allowed when no subscriptions attached to a plan in the lifetime of a plan

Parameters:

  • id

    Plan Id

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

    the optional parameters

Returns:



264
265
266
267
# File 'lib/cybersource_rest_client/api/plans_api.rb', line 264

def delete_plan(id, opts = {})
  data, status_code, headers = delete_plan_with_http_info(id, opts)
  return data, status_code, headers
end

#delete_plan_with_http_info(id, opts = {}) ⇒ Array<(DeletePlanResponse, Fixnum, Hash)>

Delete a Plan Delete a Plan is only allowed: - plan status is in &#x60;DRAFT&#x60; - plan status is in &#x60;ACTIVE&#x60;, and &#x60;INACTIVE&#x60; only allowed when no subscriptions attached to a plan in the lifetime of a plan

Parameters:

  • id

    Plan Id

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

    the optional parameters

Returns:

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

    DeletePlanResponse data, response status code and response headers



274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
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
# File 'lib/cybersource_rest_client/api/plans_api.rb', line 274

def delete_plan_with_http_info(id, opts = {})

  if @api_client.config.debugging
      begin
        raise
            @api_client.config.logger.debug 'Calling API: PlansApi.delete_plan ...'
        rescue
            puts 'Cannot write to log'
        end
  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 PlansApi.delete_plan"
  end
  # resource path
  local_var_path = 'rbs/v1/plans/{id}'.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/json', 'application/hal+json', 'application/json;charset=utf-8', '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_plan","delete_plan_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,
    :return_type => 'DeletePlanResponse')
  if @api_client.config.debugging
    begin
    raise
        @api_client.config.logger.debug "API called: PlansApi#delete_plan\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
    rescue
        puts 'Cannot write to log'
    end
  end
  return data, status_code, headers
end

#get_plan(id, opts = {}) ⇒ GetPlanResponse

Get a Plan Retrieve a Plan details by Plan Id.

Parameters:

  • id

    Plan Id

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

    the optional parameters

Returns:



343
344
345
346
# File 'lib/cybersource_rest_client/api/plans_api.rb', line 343

def get_plan(id, opts = {})
  data, status_code, headers = get_plan_with_http_info(id, opts)
  return data, status_code, headers
end

#get_plan_code(opts = {}) ⇒ GetPlanCodeResponse

Get a Plan Code Get a Unique Plan Code

Parameters:

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

    the optional parameters

Returns:



421
422
423
424
# File 'lib/cybersource_rest_client/api/plans_api.rb', line 421

def get_plan_code(opts = {})
  data, status_code, headers = get_plan_code_with_http_info(opts)
  return data, status_code, headers
end

#get_plan_code_with_http_info(opts = {}) ⇒ Array<(GetPlanCodeResponse, Fixnum, Hash)>

Get a Plan Code Get a Unique Plan Code

Parameters:

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

    the optional parameters

Returns:

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

    GetPlanCodeResponse data, response status code and response headers



430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
# File 'lib/cybersource_rest_client/api/plans_api.rb', line 430

def get_plan_code_with_http_info(opts = {})

  if @api_client.config.debugging
      begin
        raise
            @api_client.config.logger.debug 'Calling API: PlansApi.get_plan_code ...'
        rescue
            puts 'Cannot write to log'
        end
  end
  # resource path
  local_var_path = 'rbs/v1/plans/code'

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json', 'application/hal+json', 'application/json;charset=utf-8', '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 '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_plan_code","get_plan_code_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 => 'GetPlanCodeResponse')
  if @api_client.config.debugging
    begin
    raise
        @api_client.config.logger.debug "API called: PlansApi#get_plan_code\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
    rescue
        puts 'Cannot write to log'
    end
  end
  return data, status_code, headers
end

#get_plan_with_http_info(id, opts = {}) ⇒ Array<(GetPlanResponse, Fixnum, Hash)>

Get a Plan Retrieve a Plan details by Plan Id.

Parameters:

  • id

    Plan Id

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

    the optional parameters

Returns:

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

    GetPlanResponse data, response status code and response headers



353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
# File 'lib/cybersource_rest_client/api/plans_api.rb', line 353

def get_plan_with_http_info(id, opts = {})

  if @api_client.config.debugging
      begin
        raise
            @api_client.config.logger.debug 'Calling API: PlansApi.get_plan ...'
        rescue
            puts 'Cannot write to log'
        end
  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 PlansApi.get_plan"
  end
  # resource path
  local_var_path = 'rbs/v1/plans/{id}'.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/json', 'application/hal+json', 'application/json;charset=utf-8', '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 '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_plan","get_plan_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 => 'GetPlanResponse')
  if @api_client.config.debugging
    begin
    raise
        @api_client.config.logger.debug "API called: PlansApi#get_plan\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
    rescue
        puts 'Cannot write to log'
    end
  end
  return data, status_code, headers
end

#get_plans(opts = {}) ⇒ GetAllPlansResponse

Get a List of Plans Retrieve Plans by Plan Code & Plan Status.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :offset (Integer)

    Page offset number.

  • :limit (Integer)

    Number of items to be returned. Default - &#x60;20&#x60;, Max - &#x60;100&#x60;

  • :code (String)

    Filter by Plan Code

  • :status (String)

    Filter by Plan Status

  • :name (String)

    Filter by Plan Name. (First sub string or full string) **[Not Recommended]**

Returns:



499
500
501
502
# File 'lib/cybersource_rest_client/api/plans_api.rb', line 499

def get_plans(opts = {})
  data, status_code, headers = get_plans_with_http_info(opts)
  return data, status_code, headers
end

#get_plans_with_http_info(opts = {}) ⇒ Array<(GetAllPlansResponse, Fixnum, Hash)>

Get a List of Plans Retrieve Plans by Plan Code &amp; Plan Status.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :offset (Integer)

    Page offset number.

  • :limit (Integer)

    Number of items to be returned. Default - &#x60;20&#x60;, Max - &#x60;100&#x60;

  • :code (String)

    Filter by Plan Code

  • :status (String)

    Filter by Plan Status

  • :name (String)

    Filter by Plan Name. (First sub string or full string) **[Not Recommended]**

Returns:

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

    GetAllPlansResponse data, response status code and response headers



513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
# File 'lib/cybersource_rest_client/api/plans_api.rb', line 513

def get_plans_with_http_info(opts = {})

  if @api_client.config.debugging
      begin
        raise
            @api_client.config.logger.debug 'Calling API: PlansApi.get_plans ...'
        rescue
            puts 'Cannot write to log'
        end
  end
  # resource path
  local_var_path = 'rbs/v1/plans'

  # query parameters
  query_params = {}
  query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?
  query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
  query_params[:'code'] = opts[:'code'] if !opts[:'code'].nil?
  query_params[:'status'] = opts[:'status'] if !opts[:'status'].nil?
  query_params[:'name'] = opts[:'name'] if !opts[:'name'].nil?

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json', 'application/hal+json', 'application/json;charset=utf-8', '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 '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_plans","get_plans_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 => 'GetAllPlansResponse')
  if @api_client.config.debugging
    begin
    raise
        @api_client.config.logger.debug "API called: PlansApi#get_plans\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
    rescue
        puts 'Cannot write to log'
    end
  end
  return data, status_code, headers
end

#update_plan(id, update_plan_request, opts = {}) ⇒ UpdatePlanResponse

Update a Plan Update a Plan Plan in ‘DRAFT` status - All updates are allowed on Plan with `DRAFT` status Plan in `ACTIVE` status [Following fields are **Not Updatable**] - `planInformation.billingPeriod` - `planInformation.billingCycles` [Update is only allowed to increase billingCycles] - `orderInformation.amountDetails.currency`

Parameters:

  • id

    Plan Id

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

    the optional parameters

Returns:



584
585
586
587
# File 'lib/cybersource_rest_client/api/plans_api.rb', line 584

def update_plan(id, update_plan_request, opts = {})
  data, status_code, headers = update_plan_with_http_info(id, update_plan_request, opts)
  return data, status_code, headers
end

#update_plan_with_http_info(id, update_plan_request, opts = {}) ⇒ Array<(UpdatePlanResponse, Fixnum, Hash)>

Update a Plan Update a Plan Plan in &#x60;DRAFT&#x60; status - All updates are allowed on Plan with &#x60;DRAFT&#x60; status Plan in &#x60;ACTIVE&#x60; status [Following fields are **Not Updatable**] - &#x60;planInformation.billingPeriod&#x60; - &#x60;planInformation.billingCycles&#x60; [Update is only allowed to increase billingCycles] - &#x60;orderInformation.amountDetails.currency&#x60;

Parameters:

  • id

    Plan Id

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

    the optional parameters

Returns:

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

    UpdatePlanResponse data, response status code and response headers



595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
# File 'lib/cybersource_rest_client/api/plans_api.rb', line 595

def update_plan_with_http_info(id, update_plan_request, opts = {})

  if @api_client.config.debugging
      begin
        raise
            @api_client.config.logger.debug 'Calling API: PlansApi.update_plan ...'
        rescue
            puts 'Cannot write to log'
        end
  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 PlansApi.update_plan"
  end
  # verify the required parameter 'update_plan_request' is set
  if @api_client.config.client_side_validation && update_plan_request.nil?
    fail ArgumentError, "Missing the required parameter 'update_plan_request' when calling PlansApi.update_plan"
  end
  # resource path
  local_var_path = 'rbs/v1/plans/{id}'.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/json', 'application/hal+json', 'application/json;charset=utf-8', '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(update_plan_request)
  sdk_tracker = SdkTracker.new
  post_body = sdk_tracker.insert_developer_id_tracker(post_body, 'UpdatePlanRequest', @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, ["update_plan","update_plan_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(:PATCH, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'UpdatePlanResponse')
  if @api_client.config.debugging
    begin
    raise
        @api_client.config.logger.debug "API called: PlansApi#update_plan\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
    rescue
        puts 'Cannot write to log'
    end
  end
  return data, status_code, headers
end