Class: CyberSource::PaymentLinksApi

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

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

Returns a new instance of PaymentLinksApi.



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

def api_client
  @api_client
end

Instance Method Details

Create a Payment Link Pay by Link is an easy and fast way to securely sell products or receive donations online. This solution is ideal for distributing the same payment link to multiple customers. Links for making purchases are referred to as fixed-price links, and links for making donations are referred to as customer-set price links.

Parameters:

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

    the optional parameters

Returns:



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

def create_payment_link(create_payment_link_request, opts = {})
  data, status_code, headers = create_payment_link_with_http_info(create_payment_link_request, opts)
  return data, status_code, headers
end

Create a Payment Link Pay by Link is an easy and fast way to securely sell products or receive donations online. This solution is ideal for distributing the same payment link to multiple customers. Links for making purchases are referred to as fixed-price links, and links for making donations are referred to as customer-set price links.

Parameters:

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

def create_payment_link_with_http_info(create_payment_link_request, opts = {})

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

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

  local_var_path = 'ipl/v2/payment-links'

  # 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_payment_link_request)
  sdk_tracker = SdkTracker.new
  post_body = sdk_tracker.insert_developer_id_tracker(post_body, 'CreatePaymentLinkRequest', @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_payment_link","create_payment_link_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 => 'PblPaymentLinksPost201Response')
  if @api_client.config.debugging
    begin
    raise
        @api_client.config.logger.debug "API called: PaymentLinksApi#create_payment_link\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
    rescue
        puts 'Cannot write to log'
    end
  end
  return data, status_code, headers
end

Get a List of Payment Links Provides a (filtered) list of payment links that have been created in your account. You can filter the list based on the following status types: - ACTIVE - INACTIVE

Parameters:

  • offset

    Page offset number.

  • limit

    Maximum number of items you would like returned. Maximum limit: 1000

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

    the optional parameters

Options Hash (opts):

  • :status (String)

    The status of the purchase or donation link. Possible values: - ACTIVE - INACTIVE

Returns:



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

def get_all_payment_links(offset, limit, opts = {})
  data, status_code, headers = get_all_payment_links_with_http_info(offset, limit, opts)
  return data, status_code, headers
end

Get a List of Payment Links Provides a (filtered) list of payment links that have been created in your account. You can filter the list based on the following status types: - ACTIVE - INACTIVE

Parameters:

  • offset

    Page offset number.

  • limit

    Maximum number of items you would like returned. Maximum limit: 1000

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

    the optional parameters

Options Hash (opts):

  • :status (String)

    The status of the purchase or donation link. Possible values: - ACTIVE - INACTIVE

Returns:



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
178
179
180
181
182
183
184
185
186
187
188
# File 'lib/cybersource_rest_client/api/payment_links_api.rb', line 120

def get_all_payment_links_with_http_info(offset, limit, opts = {})

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

  if @api_client.config.client_side_validation && offset.nil?
    fail ArgumentError, "Missing the required parameter 'offset' when calling PaymentLinksApi.get_all_payment_links"
  end
  # verify the required parameter 'limit' is set

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

  local_var_path = 'ipl/v2/payment-links'

  # query parameters

  query_params = {}
  query_params[:'offset'] = offset
  query_params[:'limit'] = limit
  query_params[:'status'] = opts[:'status'] if !opts[:'status'].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_payment_links","get_all_payment_links_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 => 'PblPaymentLinksAllGet200Response')
  if @api_client.config.debugging
    begin
    raise
        @api_client.config.logger.debug "API called: PaymentLinksApi#get_all_payment_links\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
    rescue
        puts 'Cannot write to log'
    end
  end
  return data, status_code, headers
end

Get Payment Link Details You can retrieve details of a specific payment link. For each payment transaction you can use the Transaction Details API to get more details on the payment transaction.

Parameters:

  • id

    The purchase number.

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

    the optional parameters

Returns:



196
197
198
199
# File 'lib/cybersource_rest_client/api/payment_links_api.rb', line 196

def get_payment_link(id, opts = {})
  data, status_code, headers = get_payment_link_with_http_info(id, opts)
  return data, status_code, headers
end

Get Payment Link Details You can retrieve details of a specific payment link. For each payment transaction you can use the Transaction Details API to get more details on the payment transaction.

Parameters:

  • id

    The purchase number.

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

    the optional parameters

Returns:



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
260
261
262
263
264
265
266
267
# File 'lib/cybersource_rest_client/api/payment_links_api.rb', line 206

def get_payment_link_with_http_info(id, opts = {})

  if @api_client.config.debugging
      begin
        raise
            @api_client.config.logger.debug 'Calling API: PaymentLinksApi.get_payment_link ...'
        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 PaymentLinksApi.get_payment_link"
  end
  # resource path

  local_var_path = 'ipl/v2/payment-links/{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_payment_link","get_payment_link_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 => 'PblPaymentLinksGet200Response')
  if @api_client.config.debugging
    begin
    raise
        @api_client.config.logger.debug "API called: PaymentLinksApi#get_payment_link\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
    rescue
        puts 'Cannot write to log'
    end
  end
  return data, status_code, headers
end

Update a Payment Link You can update all information except the payment link number for a payment link. Changes made to amount/price will apply to new payments made using the payment link.

Parameters:

  • id

    The purchase number.

  • update_payment_link_request

    Updating the purchase or donation link does not resend the link automatically. You must resend the purchase or donation link separately.

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

    the optional parameters

Returns:



276
277
278
279
# File 'lib/cybersource_rest_client/api/payment_links_api.rb', line 276

def update_payment_link(id, update_payment_link_request, opts = {})
  data, status_code, headers = update_payment_link_with_http_info(id, update_payment_link_request, opts)
  return data, status_code, headers
end

Update a Payment Link You can update all information except the payment link number for a payment link. Changes made to amount/price will apply to new payments made using the payment link.

Parameters:

  • id

    The purchase number.

  • update_payment_link_request

    Updating the purchase or donation link does not resend the link automatically. You must resend the purchase or donation link separately.

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

    the optional parameters

Returns:



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
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
# File 'lib/cybersource_rest_client/api/payment_links_api.rb', line 287

def update_payment_link_with_http_info(id, update_payment_link_request, opts = {})

  if @api_client.config.debugging
      begin
        raise
            @api_client.config.logger.debug 'Calling API: PaymentLinksApi.update_payment_link ...'
        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 PaymentLinksApi.update_payment_link"
  end
  # verify the required parameter 'update_payment_link_request' is set

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

  local_var_path = 'ipl/v2/payment-links/{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_payment_link_request)
  sdk_tracker = SdkTracker.new
  post_body = sdk_tracker.insert_developer_id_tracker(post_body, 'UpdatePaymentLinkRequest', @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_payment_link","update_payment_link_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 => 'PblPaymentLinksPost201Response')
  if @api_client.config.debugging
    begin
    raise
        @api_client.config.logger.debug "API called: PaymentLinksApi#update_payment_link\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
    rescue
        puts 'Cannot write to log'
    end
  end
  return data, status_code, headers
end