Class: CyberSource::CreateNewWebhooksApi

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

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

Returns a new instance of CreateNewWebhooksApi.



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

def api_client
  @api_client
end

Instance Method Details

#find_products_to_subscribe(organization_id, opts = {}) ⇒ Array<InlineResponse2003>

Find Products You Can Subscribe To Retrieve a list of products and event types that your account is eligible for. These products and events are the ones that you may subscribe to in the next step of creating webhooks.

Parameters:

  • organization_id

    The Organization Identifier.

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

    the optional parameters

Returns:



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

def find_products_to_subscribe(organization_id, opts = {})
  data, status_code, headers = find_products_to_subscribe_with_http_info(organization_id, opts)
  return data, status_code, headers
end

#find_products_to_subscribe_with_http_info(organization_id, opts = {}) ⇒ Array<(Array<InlineResponse2003>, Fixnum, Hash)>

Find Products You Can Subscribe To Retrieve a list of products and event types that your account is eligible for. These products and events are the ones that you may subscribe to in the next step of creating webhooks.

Parameters:

  • organization_id

    The Organization Identifier.

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

def find_products_to_subscribe_with_http_info(organization_id, opts = {})

  if @api_client.config.debugging
      begin
        raise
            @api_client.config.logger.debug 'Calling API: CreateNewWebhooksApi.find_products_to_subscribe ...'
        rescue
            puts 'Cannot write to log'
        end
  end
  # verify the required parameter 'organization_id' is set
  if @api_client.config.client_side_validation && organization_id.nil?
    fail ArgumentError, "Missing the required parameter 'organization_id' when calling CreateNewWebhooksApi.find_products_to_subscribe"
  end
  # resource path
  local_var_path = 'notification-subscriptions/v2/products/{organizationId}'.sub('{' + 'organizationId' + '}', organization_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 'GET' == 'POST'
    post_body = '{}'
  else
    post_body = nil
  end
  is_mle_supported_by_cybs_for_api = false
  if MLEUtility.check_is_mle_for_API(@api_client.merchantconfig, is_mle_supported_by_cybs_for_api, ["find_products_to_subscribe","find_products_to_subscribe_with_http_info"])
    post_body = MLEUtility.encrypt_request_payload(@api_client.merchantconfig, post_body)
  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: CreateNewWebhooksApi#find_products_to_subscribe\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
    rescue
        puts 'Cannot write to log'
    end
  end
  return data, status_code, headers
end

#notification_subscriptions_v2_webhooks_post(opts = {}) ⇒ InlineResponse2015

Create a New Webhook Subscription Create a new webhook subscription. Before creating a webhook, ensure that a signature key has been created. For the example "Create Webhook using oAuth with Client Credentials" - for clients who have more than one oAuth Provider and have different client secrets that they would like to config for a given webhook, they may do so by overriding the keyId inside security config of webhook subscription. See the Developer Center examples section titled "Webhook Security - Create or Store Egress Symmetric Key - Store oAuth Credentials For Symmetric Key" to store these oAuth credentials that CYBS will need for oAuth. For JWT authentication, attach your oAuth details to the webhook subscription. See the example "Create Webhook using oAuth with JWT"

Parameters:

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

    the optional parameters

Options Hash (opts):

Returns:



104
105
106
107
# File 'lib/cybersource_rest_client/api/create_new_webhooks_api.rb', line 104

def notification_subscriptions_v2_webhooks_post(opts = {})
  data, status_code, headers = notification_subscriptions_v2_webhooks_post_with_http_info(opts)
  return data, status_code, headers
end

#notification_subscriptions_v2_webhooks_post_with_http_info(opts = {}) ⇒ Array<(InlineResponse2015, Fixnum, Hash)>

Create a New Webhook Subscription Create a new webhook subscription. Before creating a webhook, ensure that a signature key has been created. For the example &quot;Create Webhook using oAuth with Client Credentials&quot; - for clients who have more than one oAuth Provider and have different client secrets that they would like to config for a given webhook, they may do so by overriding the keyId inside security config of webhook subscription. See the Developer Center examples section titled &quot;Webhook Security - Create or Store Egress Symmetric Key - Store oAuth Credentials For Symmetric Key&quot; to store these oAuth credentials that CYBS will need for oAuth. For JWT authentication, attach your oAuth details to the webhook subscription. See the example &quot;Create Webhook using oAuth with JWT&quot;

Parameters:

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

    the optional parameters

Options Hash (opts):

Returns:

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

    InlineResponse2015 data, response status code and response headers



114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
# File 'lib/cybersource_rest_client/api/create_new_webhooks_api.rb', line 114

def notification_subscriptions_v2_webhooks_post_with_http_info(opts = {})

  if @api_client.config.debugging
      begin
        raise
            @api_client.config.logger.debug 'Calling API: CreateNewWebhooksApi.notification_subscriptions_v2_webhooks_post ...'
        rescue
            puts 'Cannot write to log'
        end
  end
  # resource path
  local_var_path = 'notification-subscriptions/v2/webhooks'

  # 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(opts[:'create_webhook'])
  sdk_tracker = SdkTracker.new
  post_body = sdk_tracker.insert_developer_id_tracker(post_body, 'CreateWebhook', @api_client.config.host, @api_client.merchantconfig.defaultDeveloperId)
  is_mle_supported_by_cybs_for_api = false
  if MLEUtility.check_is_mle_for_API(@api_client.merchantconfig, is_mle_supported_by_cybs_for_api, ["notification_subscriptions_v2_webhooks_post","notification_subscriptions_v2_webhooks_post_with_http_info"])
    post_body = MLEUtility.encrypt_request_payload(@api_client.merchantconfig, post_body)
  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 => 'InlineResponse2015')
  if @api_client.config.debugging
    begin
    raise
        @api_client.config.logger.debug "API called: CreateNewWebhooksApi#notification_subscriptions_v2_webhooks_post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
    rescue
        puts 'Cannot write to log'
    end
  end
  return data, status_code, headers
end

#save_sym_egress_key(v_c_sender_organization_id, v_c_permissions, opts = {}) ⇒ InlineResponse2014

Create Webhook Security Keys Create security keys that CyberSource will use internally to connect to your servers and validate messages using a digital signature. Select the CREATE example for CyberSource to generate the key on our server and maintain it for you as well. Remember to save the key in the API response, so that you can use it to validate messages later.

Parameters:

  • v_c_sender_organization_id

    Sender organization id

  • v_c_permissions

    Encoded user permissions returned by the CGK, for the entity user who initiated the boarding

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

    the optional parameters

Options Hash (opts):

  • :v_c_correlation_id (String)

    A globally unique id associated with your request

  • :save_sym_egress_key (SaveSymEgressKey)

    Provide egress Symmetric key information to save (create or store or refresh)

Returns:



176
177
178
179
# File 'lib/cybersource_rest_client/api/create_new_webhooks_api.rb', line 176

def save_sym_egress_key(v_c_sender_organization_id, v_c_permissions, opts = {})
  data, status_code, headers = save_sym_egress_key_with_http_info(v_c_sender_organization_id, v_c_permissions, opts)
  return data, status_code, headers
end

#save_sym_egress_key_with_http_info(v_c_sender_organization_id, v_c_permissions, opts = {}) ⇒ Array<(InlineResponse2014, Fixnum, Hash)>

Create Webhook Security Keys Create security keys that CyberSource will use internally to connect to your servers and validate messages using a digital signature. Select the CREATE example for CyberSource to generate the key on our server and maintain it for you as well. Remember to save the key in the API response, so that you can use it to validate messages later.

Parameters:

  • v_c_sender_organization_id

    Sender organization id

  • v_c_permissions

    Encoded user permissions returned by the CGK, for the entity user who initiated the boarding

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

    the optional parameters

Options Hash (opts):

  • :v_c_correlation_id (String)

    A globally unique id associated with your request

  • :save_sym_egress_key (SaveSymEgressKey)

    Provide egress Symmetric key information to save (create or store or refresh)

Returns:

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

    InlineResponse2014 data, response status code and response headers



189
190
191
192
193
194
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
257
258
259
# File 'lib/cybersource_rest_client/api/create_new_webhooks_api.rb', line 189

def save_sym_egress_key_with_http_info(v_c_sender_organization_id, v_c_permissions, opts = {})

  if @api_client.config.debugging
      begin
        raise
            @api_client.config.logger.debug 'Calling API: CreateNewWebhooksApi.save_sym_egress_key ...'
        rescue
            puts 'Cannot write to log'
        end
  end
  # verify the required parameter 'v_c_sender_organization_id' is set
  if @api_client.config.client_side_validation && v_c_sender_organization_id.nil?
    fail ArgumentError, "Missing the required parameter 'v_c_sender_organization_id' when calling CreateNewWebhooksApi.save_sym_egress_key"
  end
  #if @api_client.config.client_side_validation && v_c_sender_organization_id !~ Regexp.new(/^[A-Za-z0-9\\-_]+$/)
    #fail ArgumentError, "invalid value for 'v_c_sender_organization_id' when calling CreateNewWebhooksApi.save_sym_egress_key, must conform to the pattern /^[A-Za-z0-9\\-_]+$/."
  #end

  # verify the required parameter 'v_c_permissions' is set
  if @api_client.config.client_side_validation && v_c_permissions.nil?
    fail ArgumentError, "Missing the required parameter 'v_c_permissions' when calling CreateNewWebhooksApi.save_sym_egress_key"
  end
  #if @api_client.config.client_side_validation && !opts[:'v_c_correlation_id'].nil? && opts[:'v_c_correlation_id'] !~ Regexp.new(/^[A-Za-z0-9\\.\\-_:]+$/)
    #fail ArgumentError, "invalid value for 'opts[:\"v_c_correlation_id\"]' when calling CreateNewWebhooksApi.save_sym_egress_key, must conform to the pattern /^[A-Za-z0-9\\.\\-_:]+$/."
  #end

  # resource path
  local_var_path = 'kms/egress/v2/keys-sym'

  # 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'])
  header_params[:'v-c-sender-organization-id'] = v_c_sender_organization_id
  header_params[:'v-c-permissions'] = v_c_permissions
  header_params[:'v-c-correlation-id'] = opts[:'v_c_correlation_id'] if !opts[:'v_c_correlation_id'].nil?

  # form parameters
  form_params = {}

  # http body (model)
  post_body = @api_client.object_to_http_body(opts[:'save_sym_egress_key'])
  sdk_tracker = SdkTracker.new
  post_body = sdk_tracker.insert_developer_id_tracker(post_body, 'SaveSymEgressKey', @api_client.config.host, @api_client.merchantconfig.defaultDeveloperId)
  is_mle_supported_by_cybs_for_api = false
  if MLEUtility.check_is_mle_for_API(@api_client.merchantconfig, is_mle_supported_by_cybs_for_api, ["save_sym_egress_key","save_sym_egress_key_with_http_info"])
    post_body = MLEUtility.encrypt_request_payload(@api_client.merchantconfig, post_body)
  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 => 'InlineResponse2014')
  if @api_client.config.debugging
    begin
    raise
        @api_client.config.logger.debug "API called: CreateNewWebhooksApi#save_sym_egress_key\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
    rescue
        puts 'Cannot write to log'
    end
  end
  return data, status_code, headers
end