Class: CyberSource::SubscriptionsApi

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

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

Returns a new instance of SubscriptionsApi.



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

def api_client
  @api_client
end

Instance Method Details

#activate_subscription(id, opts = {}) ⇒ ActivateSubscriptionResponse

Reactivating a Suspended Subscription # Reactivating a Suspended Subscription You can reactivate a suspended subscription for the next billing cycle. You cannot reactivate a canceled or completed subscription. You can specify whether you want to process missed payments for the period during which the subscription was suspended using the ‘processMissedPayments` query parameter by setting it to true or false. If no value is specified, the system will default to `true`. Important: The "processMissedPayments" query parameter is only effective when the Ask each time before reactivating option is selected in the reactivation settings. If any other option is chosen, the value provided in the request will be ignored by the system. For more information, see the [Recurring Billing User Guide](developer.cybersource.com/docs/cybs/en-us/recurring-billing/user/all/rest/recurring-billing-user/recurring-billing-user-about-guide.html). You can check how many payments were missed and the total amount by retrieving the subscription details, where you will find the `reactivationInformation` object. See: [Retrieving a Subscription](developer.cybersource.com/docs/cybs/en-us/recurring-billing/developer/all/rest/recurring-billing-dev/recur-bill-subscriptions/recur-bill-getting-a-subscription.html).

Parameters:

  • id

    Subscription Id

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

    the optional parameters

Options Hash (opts):

  • :process_missed_payments (BOOLEAN)

    Indicates if missed payments should be processed from the period when the subscription was suspended. By default, this is set to true. When any option other than "Ask each time before reactivating" is selected in the reactivation settings, the value that you enter will be ignored. (default to true)

Returns:



30
31
32
33
# File 'lib/cybersource_rest_client/api/subscriptions_api.rb', line 30

def activate_subscription(id, opts = {})
  data, status_code, headers = activate_subscription_with_http_info(id, opts)
  return data, status_code, headers
end

#activate_subscription_with_http_info(id, opts = {}) ⇒ Array<(ActivateSubscriptionResponse, Fixnum, Hash)>

Reactivating a Suspended Subscription # Reactivating a Suspended Subscription You can reactivate a suspended subscription for the next billing cycle. You cannot reactivate a canceled or completed subscription. You can specify whether you want to process missed payments for the period during which the subscription was suspended using the &#x60;processMissedPayments&#x60; query parameter by setting it to true or false. If no value is specified, the system will default to &#x60;true&#x60;. Important: The &quot;processMissedPayments&quot; query parameter is only effective when the Ask each time before reactivating option is selected in the reactivation settings. If any other option is chosen, the value provided in the request will be ignored by the system. For more information, see the [Recurring Billing User Guide](developer.cybersource.com/docs/cybs/en-us/recurring-billing/user/all/rest/recurring-billing-user/recurring-billing-user-about-guide.html). You can check how many payments were missed and the total amount by retrieving the subscription details, where you will find the &#x60;reactivationInformation&#x60; object. See: [Retrieving a Subscription](developer.cybersource.com/docs/cybs/en-us/recurring-billing/developer/all/rest/recurring-billing-dev/recur-bill-subscriptions/recur-bill-getting-a-subscription.html).

Parameters:

  • id

    Subscription Id

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

    the optional parameters

Options Hash (opts):

  • :process_missed_payments (BOOLEAN)

    Indicates if missed payments should be processed from the period when the subscription was suspended. By default, this is set to true. When any option other than &quot;Ask each time before reactivating&quot; is selected in the reactivation settings, the value that you enter will be ignored.

Returns:



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
107
# File 'lib/cybersource_rest_client/api/subscriptions_api.rb', line 41

def activate_subscription_with_http_info(id, opts = {})

  if @api_client.config.debugging
      begin
        raise
            @api_client.config.logger.debug 'Calling API: SubscriptionsApi.activate_subscription ...'
        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 SubscriptionsApi.activate_subscription"
  end
  # resource path
  local_var_path = 'rbs/v1/subscriptions/{id}/activate'.sub('{' + 'id' + '}', id.to_s)

  # query parameters
  query_params = {}
  query_params[:'processMissedPayments'] = opts[:'process_missed_payments'] if !opts[:'process_missed_payments'].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 '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_subscription","activate_subscription_with_http_info"])
    begin
      post_body = MLEUtility.encrypt_request_payload(@api_client.merchantconfig, post_body)
    rescue
      raise
    end
  end

  is_response_mle_for_api = MLEUtility.check_is_response_mle_for_api(@api_client.merchantconfig, ["activate_subscription","activate_subscription_with_http_info"])

  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 => 'ActivateSubscriptionResponse',
    :isResponseMLEForApi => is_response_mle_for_api)
  if @api_client.config.debugging
    begin
    raise
        @api_client.config.logger.debug "API called: SubscriptionsApi#activate_subscription\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
    rescue
        puts 'Cannot write to log'
    end
  end
  return data, status_code, headers
end

#cancel_subscription(id, opts = {}) ⇒ CancelSubscriptionResponse

Cancel a Subscription Cancel a Subscription

Parameters:

  • id

    Subscription Id

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

    the optional parameters

Returns:



115
116
117
118
# File 'lib/cybersource_rest_client/api/subscriptions_api.rb', line 115

def cancel_subscription(id, opts = {})
  data, status_code, headers = cancel_subscription_with_http_info(id, opts)
  return data, status_code, headers
end

#cancel_subscription_with_http_info(id, opts = {}) ⇒ Array<(CancelSubscriptionResponse, Fixnum, Hash)>

Cancel a Subscription Cancel a Subscription

Parameters:

  • id

    Subscription Id

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

    the optional parameters

Returns:

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

    CancelSubscriptionResponse data, response status code and response headers



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

def cancel_subscription_with_http_info(id, opts = {})

  if @api_client.config.debugging
      begin
        raise
            @api_client.config.logger.debug 'Calling API: SubscriptionsApi.cancel_subscription ...'
        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 SubscriptionsApi.cancel_subscription"
  end
  # resource path
  local_var_path = 'rbs/v1/subscriptions/{id}/cancel'.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, ["cancel_subscription","cancel_subscription_with_http_info"])
    begin
      post_body = MLEUtility.encrypt_request_payload(@api_client.merchantconfig, post_body)
    rescue
      raise
    end
  end

  is_response_mle_for_api = MLEUtility.check_is_response_mle_for_api(@api_client.merchantconfig, ["cancel_subscription","cancel_subscription_with_http_info"])

  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 => 'CancelSubscriptionResponse',
    :isResponseMLEForApi => is_response_mle_for_api)
  if @api_client.config.debugging
    begin
    raise
        @api_client.config.logger.debug "API called: SubscriptionsApi#cancel_subscription\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
    rescue
        puts 'Cannot write to log'
    end
  end
  return data, status_code, headers
end

#create_subscription(create_subscription_request, opts = {}) ⇒ CreateSubscriptionResponse

Create a Subscription Create a Recurring Billing Subscription

Parameters:

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

    the optional parameters

Returns:



198
199
200
201
# File 'lib/cybersource_rest_client/api/subscriptions_api.rb', line 198

def create_subscription(create_subscription_request, opts = {})
  data, status_code, headers = create_subscription_with_http_info(create_subscription_request, opts)
  return data, status_code, headers
end

#create_subscription_with_http_info(create_subscription_request, opts = {}) ⇒ Array<(CreateSubscriptionResponse, Fixnum, Hash)>

Create a Subscription Create a Recurring Billing Subscription

Parameters:

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

    the optional parameters

Returns:

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

    CreateSubscriptionResponse 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
# File 'lib/cybersource_rest_client/api/subscriptions_api.rb', line 208

def create_subscription_with_http_info(create_subscription_request, opts = {})

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

  # 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_subscription_request)
  sdk_tracker = SdkTracker.new
  post_body = sdk_tracker.insert_developer_id_tracker(post_body, 'CreateSubscriptionRequest', @api_client.config.host, @api_client.merchantconfig.defaultDeveloperId)
  inbound_mle_status = "optional"
  if MLEUtility.check_is_mle_for_API(@api_client.merchantconfig, inbound_mle_status, ["create_subscription","create_subscription_with_http_info"])
    begin
      post_body = MLEUtility.encrypt_request_payload(@api_client.merchantconfig, post_body)
    rescue
      raise
    end
  end

  is_response_mle_for_api = MLEUtility.check_is_response_mle_for_api(@api_client.merchantconfig, ["create_subscription","create_subscription_with_http_info"])

  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 => 'CreateSubscriptionResponse',
    :isResponseMLEForApi => is_response_mle_for_api)
  if @api_client.config.debugging
    begin
    raise
        @api_client.config.logger.debug "API called: SubscriptionsApi#create_subscription\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
    rescue
        puts 'Cannot write to log'
    end
  end
  return data, status_code, headers
end

#get_all_subscriptions(opts = {}) ⇒ GetAllSubscriptionsResponse

Get a List of Subscriptions Retrieve Subscriptions by Subscription Code & Subscription 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 Subscription Code

  • :status (String)

    Filter by Subscription Status

  • :customer_id (String)

    Filter by Customer Id

  • :client_reference_information_code (String)

    Filter by Client Reference Information Code / Merchant Reference Number

Returns:



284
285
286
287
# File 'lib/cybersource_rest_client/api/subscriptions_api.rb', line 284

def get_all_subscriptions(opts = {})
  data, status_code, headers = get_all_subscriptions_with_http_info(opts)
  return data, status_code, headers
end

#get_all_subscriptions_with_http_info(opts = {}) ⇒ Array<(GetAllSubscriptionsResponse, Fixnum, Hash)>

Get a List of Subscriptions Retrieve Subscriptions by Subscription Code &amp; Subscription 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 Subscription Code

  • :status (String)

    Filter by Subscription Status

  • :customer_id (String)

    Filter by Customer Id

  • :client_reference_information_code (String)

    Filter by Client Reference Information Code / Merchant Reference Number

Returns:



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
365
366
# File 'lib/cybersource_rest_client/api/subscriptions_api.rb', line 299

def get_all_subscriptions_with_http_info(opts = {})

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

  # 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[:'customerId'] = opts[:'customer_id'] if !opts[:'customer_id'].nil?
  query_params[:'clientReferenceInformationCode'] = opts[:'client_reference_information_code'] if !opts[:'client_reference_information_code'].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_all_subscriptions","get_all_subscriptions_with_http_info"])
    begin
      post_body = MLEUtility.encrypt_request_payload(@api_client.merchantconfig, post_body)
    rescue
      raise
    end
  end

  is_response_mle_for_api = MLEUtility.check_is_response_mle_for_api(@api_client.merchantconfig, ["get_all_subscriptions","get_all_subscriptions_with_http_info"])

  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 => 'GetAllSubscriptionsResponse',
    :isResponseMLEForApi => is_response_mle_for_api)
  if @api_client.config.debugging
    begin
    raise
        @api_client.config.logger.debug "API called: SubscriptionsApi#get_all_subscriptions\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
    rescue
        puts 'Cannot write to log'
    end
  end
  return data, status_code, headers
end

#get_subscription(id, opts = {}) ⇒ GetSubscriptionResponse

Get a Subscription Get a Subscription by Subscription Id

Parameters:

  • id

    Subscription Id

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

    the optional parameters

Returns:



374
375
376
377
# File 'lib/cybersource_rest_client/api/subscriptions_api.rb', line 374

def get_subscription(id, opts = {})
  data, status_code, headers = get_subscription_with_http_info(id, opts)
  return data, status_code, headers
end

#get_subscription_code(opts = {}) ⇒ GetSubscriptionCodeResponse

Get a Subscription Code Get a Unique Subscription Code

Parameters:

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

    the optional parameters

Returns:



456
457
458
459
# File 'lib/cybersource_rest_client/api/subscriptions_api.rb', line 456

def get_subscription_code(opts = {})
  data, status_code, headers = get_subscription_code_with_http_info(opts)
  return data, status_code, headers
end

#get_subscription_code_with_http_info(opts = {}) ⇒ Array<(GetSubscriptionCodeResponse, Fixnum, Hash)>

Get a Subscription Code Get a Unique Subscription Code

Parameters:

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

    the optional parameters

Returns:



465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
# File 'lib/cybersource_rest_client/api/subscriptions_api.rb', line 465

def get_subscription_code_with_http_info(opts = {})

  if @api_client.config.debugging
      begin
        raise
            @api_client.config.logger.debug 'Calling API: SubscriptionsApi.get_subscription_code ...'
        rescue
            puts 'Cannot write to log'
        end
  end
  # resource path
  local_var_path = 'rbs/v1/subscriptions/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_subscription_code","get_subscription_code_with_http_info"])
    begin
      post_body = MLEUtility.encrypt_request_payload(@api_client.merchantconfig, post_body)
    rescue
      raise
    end
  end

  is_response_mle_for_api = MLEUtility.check_is_response_mle_for_api(@api_client.merchantconfig, ["get_subscription_code","get_subscription_code_with_http_info"])

  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 => 'GetSubscriptionCodeResponse',
    :isResponseMLEForApi => is_response_mle_for_api)
  if @api_client.config.debugging
    begin
    raise
        @api_client.config.logger.debug "API called: SubscriptionsApi#get_subscription_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_subscription_with_http_info(id, opts = {}) ⇒ Array<(GetSubscriptionResponse, Fixnum, Hash)>

Get a Subscription Get a Subscription by Subscription Id

Parameters:

  • id

    Subscription Id

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

    the optional parameters

Returns:

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

    GetSubscriptionResponse data, response status code and response headers



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
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
# File 'lib/cybersource_rest_client/api/subscriptions_api.rb', line 384

def get_subscription_with_http_info(id, opts = {})

  if @api_client.config.debugging
      begin
        raise
            @api_client.config.logger.debug 'Calling API: SubscriptionsApi.get_subscription ...'
        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 SubscriptionsApi.get_subscription"
  end
  # resource path
  local_var_path = 'rbs/v1/subscriptions/{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_subscription","get_subscription_with_http_info"])
    begin
      post_body = MLEUtility.encrypt_request_payload(@api_client.merchantconfig, post_body)
    rescue
      raise
    end
  end

  is_response_mle_for_api = MLEUtility.check_is_response_mle_for_api(@api_client.merchantconfig, ["get_subscription","get_subscription_with_http_info"])

  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 => 'GetSubscriptionResponse',
    :isResponseMLEForApi => is_response_mle_for_api)
  if @api_client.config.debugging
    begin
    raise
        @api_client.config.logger.debug "API called: SubscriptionsApi#get_subscription\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
    rescue
        puts 'Cannot write to log'
    end
  end
  return data, status_code, headers
end

#subscriptions_id_payments_get(id, opts = {}) ⇒ GetSubscriptionsPaymentsResponse

Get Payments for a Subscription Retrieve a list of payments for a specific subscription by its ID.

Parameters:

  • id

    Subscription Id

  • 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;

  • :scheduled_payments_count (Integer)

    Number of existing scheduled payments to be returned. Default - &#x60;5&#x60;, Max - &#x60;9999&#x60;

Returns:



537
538
539
540
# File 'lib/cybersource_rest_client/api/subscriptions_api.rb', line 537

def subscriptions_id_payments_get(id, opts = {})
  data, status_code, headers = subscriptions_id_payments_get_with_http_info(id, opts)
  return data, status_code, headers
end

#subscriptions_id_payments_get_with_http_info(id, opts = {}) ⇒ Array<(GetSubscriptionsPaymentsResponse, Fixnum, Hash)>

Get Payments for a Subscription Retrieve a list of payments for a specific subscription by its ID.

Parameters:

  • id

    Subscription Id

  • 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;

  • :scheduled_payments_count (Integer)

    Number of existing scheduled payments to be returned. Default - &#x60;5&#x60;, Max - &#x60;9999&#x60;

Returns:



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
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
# File 'lib/cybersource_rest_client/api/subscriptions_api.rb', line 550

def subscriptions_id_payments_get_with_http_info(id, opts = {})

  if @api_client.config.debugging
      begin
        raise
            @api_client.config.logger.debug 'Calling API: SubscriptionsApi.subscriptions_id_payments_get ...'
        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 SubscriptionsApi.subscriptions_id_payments_get"
  end
  # resource path
  local_var_path = 'rbs/v1/subscriptions/{id}/payments'.sub('{' + 'id' + '}', id.to_s)

  # query parameters
  query_params = {}
  query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?
  query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
  query_params[:'scheduledPaymentsCount'] = opts[:'scheduled_payments_count'] if !opts[:'scheduled_payments_count'].nil?

  # 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, ["subscriptions_id_payments_get","subscriptions_id_payments_get_with_http_info"])
    begin
      post_body = MLEUtility.encrypt_request_payload(@api_client.merchantconfig, post_body)
    rescue
      raise
    end
  end

  is_response_mle_for_api = MLEUtility.check_is_response_mle_for_api(@api_client.merchantconfig, ["subscriptions_id_payments_get","subscriptions_id_payments_get_with_http_info"])

  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 => 'GetSubscriptionsPaymentsResponse',
    :isResponseMLEForApi => is_response_mle_for_api)
  if @api_client.config.debugging
    begin
    raise
        @api_client.config.logger.debug "API called: SubscriptionsApi#subscriptions_id_payments_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
    rescue
        puts 'Cannot write to log'
    end
  end
  return data, status_code, headers
end

#subscriptions_id_payments_put(id, update_payments, opts = {}) ⇒ GetSubscriptionsPaymentsResponse1

Update Payments for a subscription Modifies the state of a subscription’s payments. Currently, the only possible modifications are "skipping" and "restoring" payments. Marking a payment as "skipped" means it will not be processed when its scheduled time arrives. "Restoring" a payment removes it from the list of payments to be skipped.

Parameters:

  • id

    Subscription Id

  • update_payments

    Modify payments of a subscription

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

    the optional parameters

Returns:



627
628
629
630
# File 'lib/cybersource_rest_client/api/subscriptions_api.rb', line 627

def subscriptions_id_payments_put(id, update_payments, opts = {})
  data, status_code, headers = subscriptions_id_payments_put_with_http_info(id, update_payments, opts)
  return data, status_code, headers
end

#subscriptions_id_payments_put_with_http_info(id, update_payments, opts = {}) ⇒ Array<(GetSubscriptionsPaymentsResponse1, Fixnum, Hash)>

Update Payments for a subscription Modifies the state of a subscription&#39;s payments. Currently, the only possible modifications are &quot;skipping&quot; and &quot;restoring&quot; payments. Marking a payment as &quot;skipped&quot; means it will not be processed when its scheduled time arrives. &quot;Restoring&quot; a payment removes it from the list of payments to be skipped.

Parameters:

  • id

    Subscription Id

  • update_payments

    Modify payments of a subscription

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

    the optional parameters

Returns:



638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
# File 'lib/cybersource_rest_client/api/subscriptions_api.rb', line 638

def subscriptions_id_payments_put_with_http_info(id, update_payments, opts = {})

  if @api_client.config.debugging
      begin
        raise
            @api_client.config.logger.debug 'Calling API: SubscriptionsApi.subscriptions_id_payments_put ...'
        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 SubscriptionsApi.subscriptions_id_payments_put"
  end
  # verify the required parameter 'update_payments' is set
  if @api_client.config.client_side_validation && update_payments.nil?
    fail ArgumentError, "Missing the required parameter 'update_payments' when calling SubscriptionsApi.subscriptions_id_payments_put"
  end
  # resource path
  local_var_path = 'rbs/v1/subscriptions/{id}/payments'.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'])
  # 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(update_payments)
  sdk_tracker = SdkTracker.new
  post_body = sdk_tracker.insert_developer_id_tracker(post_body, 'UpdatePayments', @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, ["subscriptions_id_payments_put","subscriptions_id_payments_put_with_http_info"])
    begin
      post_body = MLEUtility.encrypt_request_payload(@api_client.merchantconfig, post_body)
    rescue
      raise
    end
  end

  is_response_mle_for_api = MLEUtility.check_is_response_mle_for_api(@api_client.merchantconfig, ["subscriptions_id_payments_put","subscriptions_id_payments_put_with_http_info"])

  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 => 'GetSubscriptionsPaymentsResponse1',
    :isResponseMLEForApi => is_response_mle_for_api)
  if @api_client.config.debugging
    begin
    raise
        @api_client.config.logger.debug "API called: SubscriptionsApi#subscriptions_id_payments_put\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
    rescue
        puts 'Cannot write to log'
    end
  end
  return data, status_code, headers
end

#suspend_subscription(id, opts = {}) ⇒ SuspendSubscriptionResponse

Suspend a Subscription Suspend a Subscription

Parameters:

  • id

    Subscription Id

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

    the optional parameters

Returns:



713
714
715
716
# File 'lib/cybersource_rest_client/api/subscriptions_api.rb', line 713

def suspend_subscription(id, opts = {})
  data, status_code, headers = suspend_subscription_with_http_info(id, opts)
  return data, status_code, headers
end

#suspend_subscription_with_http_info(id, opts = {}) ⇒ Array<(SuspendSubscriptionResponse, Fixnum, Hash)>

Suspend a Subscription Suspend a Subscription

Parameters:

  • id

    Subscription Id

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

    the optional parameters

Returns:



723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
# File 'lib/cybersource_rest_client/api/subscriptions_api.rb', line 723

def suspend_subscription_with_http_info(id, opts = {})

  if @api_client.config.debugging
      begin
        raise
            @api_client.config.logger.debug 'Calling API: SubscriptionsApi.suspend_subscription ...'
        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 SubscriptionsApi.suspend_subscription"
  end
  # resource path
  local_var_path = 'rbs/v1/subscriptions/{id}/suspend'.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, ["suspend_subscription","suspend_subscription_with_http_info"])
    begin
      post_body = MLEUtility.encrypt_request_payload(@api_client.merchantconfig, post_body)
    rescue
      raise
    end
  end

  is_response_mle_for_api = MLEUtility.check_is_response_mle_for_api(@api_client.merchantconfig, ["suspend_subscription","suspend_subscription_with_http_info"])

  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 => 'SuspendSubscriptionResponse',
    :isResponseMLEForApi => is_response_mle_for_api)
  if @api_client.config.debugging
    begin
    raise
        @api_client.config.logger.debug "API called: SubscriptionsApi#suspend_subscription\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
    rescue
        puts 'Cannot write to log'
    end
  end
  return data, status_code, headers
end

#update_subscription(id, update_subscription, opts = {}) ⇒ UpdateSubscriptionResponse

Update a Subscription Update a Subscription by Subscription Id

Parameters:

  • id

    Subscription Id

  • update_subscription

    Update Subscription

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

    the optional parameters

Returns:



797
798
799
800
# File 'lib/cybersource_rest_client/api/subscriptions_api.rb', line 797

def update_subscription(id, update_subscription, opts = {})
  data, status_code, headers = update_subscription_with_http_info(id, update_subscription, opts)
  return data, status_code, headers
end

#update_subscription_with_http_info(id, update_subscription, opts = {}) ⇒ Array<(UpdateSubscriptionResponse, Fixnum, Hash)>

Update a Subscription Update a Subscription by Subscription Id

Parameters:

  • id

    Subscription Id

  • update_subscription

    Update Subscription

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

    the optional parameters

Returns:

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

    UpdateSubscriptionResponse data, response status code and response headers



808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
# File 'lib/cybersource_rest_client/api/subscriptions_api.rb', line 808

def update_subscription_with_http_info(id, update_subscription, opts = {})

  if @api_client.config.debugging
      begin
        raise
            @api_client.config.logger.debug 'Calling API: SubscriptionsApi.update_subscription ...'
        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 SubscriptionsApi.update_subscription"
  end
  # verify the required parameter 'update_subscription' is set
  if @api_client.config.client_side_validation && update_subscription.nil?
    fail ArgumentError, "Missing the required parameter 'update_subscription' when calling SubscriptionsApi.update_subscription"
  end
  # resource path
  local_var_path = 'rbs/v1/subscriptions/{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_subscription)
  sdk_tracker = SdkTracker.new
  post_body = sdk_tracker.insert_developer_id_tracker(post_body, 'UpdateSubscription', @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_subscription","update_subscription_with_http_info"])
    begin
      post_body = MLEUtility.encrypt_request_payload(@api_client.merchantconfig, post_body)
    rescue
      raise
    end
  end

  is_response_mle_for_api = MLEUtility.check_is_response_mle_for_api(@api_client.merchantconfig, ["update_subscription","update_subscription_with_http_info"])

  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 => 'UpdateSubscriptionResponse',
    :isResponseMLEForApi => is_response_mle_for_api)
  if @api_client.config.debugging
    begin
    raise
        @api_client.config.logger.debug "API called: SubscriptionsApi#update_subscription\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
    rescue
        puts 'Cannot write to log'
    end
  end
  return data, status_code, headers
end