Class: CyberSourceMergedSpec::CustomerPaymentInstrumentController

Inherits:
BaseController
  • Object
show all
Defined in:
lib/cyber_source_merged_spec/controllers/customer_payment_instrument_controller.rb

Overview

CustomerPaymentInstrumentController

Constant Summary

Constants inherited from BaseController

BaseController::GLOBAL_ERRORS

Instance Attribute Summary

Attributes inherited from BaseController

#config, #http_call_back

Instance Method Summary collapse

Methods inherited from BaseController

#initialize, #new_parameter, #new_request_builder, #new_response_handler, user_agent, user_agent_parameters

Constructor Details

This class inherits a constructor from CyberSourceMergedSpec::BaseController

Instance Method Details

#delete_customer_payment_instrument(customer_id, payment_instrument_id, profile_id: nil) ⇒ ApiResponse

| | | | | --- | --- | --- | |Customer Payment Instrument
A Customer Payment Instrument represents tokenized customer payment information such as expiration date, billing address & card type.
A Customer can have [one or more Payment Instruments](#token-management_customer-payment-instrument_retrieve-a-cust omer-payment-instrument), with one allocated as the Customers default for use in payments.
A Payment Instrument token does not store the card number. A Payment Instrument is associated with an [Instrument Identifier](#token-management_instrument-identifier_create-an-instrument-i dentifier) that represents either a payment card number, or in the case of an ACH bank account, the routing and account number.
|      |Deleting a Customers Payment Instrument
Your system can use this API to delete an existing Payment Instrument for a Customer.
Any Instrument Identifiers representing the card number will also be deleted if they are not associated with any other Payment Instruments.
If a customer has more than one Payment Instrument then the default Payment Instrument cannot be deleted without first selecting a [new default Payment Instrument](#token-management_customer-payment-instrument_update-a-custome r-payment-instrument_samplerequests-dropdown_make-customer-payment-instrum ent-the-default_liveconsole-tab-request-body). payment instrument. containing user specific TMS configuration.

Parameters:

  • customer_id (String)

    Required parameter: The Id of a Customer.

  • payment_instrument_id (String)

    Required parameter: The Id of a

  • profile_id (String) (defaults to: nil)

    Optional parameter: The Id of a profile

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



352
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
# File 'lib/cyber_source_merged_spec/controllers/customer_payment_instrument_controller.rb', line 352

def delete_customer_payment_instrument(customer_id,
                                       payment_instrument_id,
                                       profile_id: nil)
  @api_call
    .request(new_request_builder(HttpMethodEnum::DELETE,
                                 '/tms/v2/customers/{customerId}/payment-instruments/{paymentInstrumentId}',
                                 Server::DEFAULT)
               .template_param(new_parameter(customer_id, key: 'customerId')
                                .is_required(true)
                                .should_encode(true))
               .template_param(new_parameter(payment_instrument_id, key: 'paymentInstrumentId')
                                .is_required(true)
                                .should_encode(true))
               .header_param(new_parameter(profile_id, key: 'profile-id'))
               .header_param(new_parameter('application/json', key: 'accept')))
    .response(new_response_handler
                .is_response_void(true)
                .is_api_response(true)
                .local_error('400',
                             'Bad Request: e.g. A required header value could be missing.',
                             DeleteCustomerPaymentInstrumentException)
                .local_error('403',
                             'Forbidden: e.g. The profile might not have permission to'\
                              ' perform the operation.',
                             DeleteCustomerPaymentInstrumentException2Exception)
                .local_error('404',
                             'Token Not Found. The Id may not exist or was entered'\
                              ' incorrectly.',
                             DeleteCustomerPaymentInstrumentException3Exception)
                .local_error('409',
                             'Conflict. The token is linked to a Payment Instrument.',
                             DeleteCustomerPaymentInstrumentException4Exception)
                .local_error('410',
                             'Token Not Available. The token has been deleted.',
                             DeleteCustomerPaymentInstrumentException5Exception)
                .local_error('424',
                             'Failed Dependency: e.g. The profile represented by the'\
                              ' profile-id may not exist or the profile-id was entered'\
                              ' incorrectly.',
                             DeleteCustomerPaymentInstrumentException6Exception)
                .local_error('500',
                             'Unexpected error.',
                             DeleteCustomerPaymentInstrumentException7Exception))
    .execute
end

#get_customer_payment_instrument(customer_id, payment_instrument_id, profile_id: nil) ⇒ ApiResponse

| | | | | --- | --- | --- | |Customer Payment Instrument
A Customer Payment Instrument represents tokenized customer payment information such as expiration date, billing address & card type.
A Customer can have [one or more Payment Instruments](#token-management_customer-payment-instrument_retrieve-a-cust omer-payment-instrument), with one allocated as the Customers default for use in payments.
A Payment Instrument token does not store the card number. A Payment Instrument is associated with an [Instrument Identifier](#token-management_instrument-identifier_create-an-instrument-i dentifier) that represents either a payment card number, or in the case of an ACH bank account, the routing and account number.
|      |Retrieving a Customer Payment Instrument
Your system can use this API to retrieve an existing Payment Instrument for a Customer.
To perform a payment with a particular Payment Instrument simply specify the [Payment Instrument Id in the payments request](#payments_payments_process-a-payment_samplerequests-dropdown_auth orization-using-tokens_authorization-with-customer-payment-instrument-and- shipping-address-token-id_liveconsole-tab-request-body). payment instrument. containing user specific TMS configuration.

Parameters:

  • customer_id (String)

    Required parameter: The Id of a Customer.

  • payment_instrument_id (String)

    Required parameter: The Id of a

  • profile_id (String) (defaults to: nil)

    Optional parameter: The Id of a profile

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



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
# File 'lib/cyber_source_merged_spec/controllers/customer_payment_instrument_controller.rb', line 192

def get_customer_payment_instrument(customer_id,
                                    payment_instrument_id,
                                    profile_id: nil)
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/tms/v2/customers/{customerId}/payment-instruments/{paymentInstrumentId}',
                                 Server::DEFAULT)
               .template_param(new_parameter(customer_id, key: 'customerId')
                                .is_required(true)
                                .should_encode(true))
               .template_param(new_parameter(payment_instrument_id, key: 'paymentInstrumentId')
                                .is_required(true)
                                .should_encode(true))
               .header_param(new_parameter(profile_id, key: 'profile-id'))
               .header_param(new_parameter('application/json', key: 'accept')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(PaymentInstrument11.method(:from_hash))
                .is_api_response(true)
                .local_error('400',
                             'Bad Request: e.g. A required header value could be missing.',
                             GetCustomerPaymentInstrumentException)
                .local_error('403',
                             'Forbidden: e.g. The profile might not have permission to'\
                              ' perform the operation.',
                             GetCustomerPaymentInstrumentException2Exception)
                .local_error('404',
                             'Token Not Found. The Id may not exist or was entered'\
                              ' incorrectly.',
                             GetCustomerPaymentInstrumentException3Exception)
                .local_error('410',
                             'Token Not Available. The token has been deleted.',
                             GetCustomerPaymentInstrumentException4Exception)
                .local_error('424',
                             'Failed Dependency: e.g. The profile represented by the'\
                              ' profile-id may not exist or the profile-id was entered'\
                              ' incorrectly.',
                             GetCustomerPaymentInstrumentException5Exception)
                .local_error('500',
                             'Unexpected error.',
                             GetCustomerPaymentInstrumentException6Exception))
    .execute
end

#get_customer_payment_instruments_list(customer_id, profile_id: nil, offset: 0, limit: 20) ⇒ ApiResponse

| | | | | --- | --- | --- | |Customer Payment Instrument
A Customer Payment Instrument represents tokenized customer payment information such as expiration date, billing address & card type.
A Customer can have [one or more Payment Instruments](#token-management_customer-payment-instrument_retrieve-a-cust omer-payment-instrument), with one allocated as the Customers default for use in payments.
A Payment Instrument token does not store the card number. A Payment Instrument is associated with an [Instrument Identifier](#token-management_instrument-identifier_create-an-instrument-i dentifier) that represents either a payment card number, or in the case of an ACH bank account, the routing and account number.
|      |Retrieving all Customer Payment Instruments
Your system can use this API to retrieve all existing Payment Instruments for a Customer. containing user specific TMS configuration. dataset that should be returned as the first object in the array. Default is 0. returned in the array starting from the offset record in zero-based dataset. Default is 20, maximum is 100.

Parameters:

  • customer_id (String)

    Required parameter: The Id of a Customer.

  • profile_id (String) (defaults to: nil)

    Optional parameter: The Id of a profile

  • offset (Integer) (defaults to: 0)

    Optional parameter: Starting record in zero-based

  • limit (Integer) (defaults to: 20)

    Optional parameter: The maximum number that can be

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



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
# File 'lib/cyber_source_merged_spec/controllers/customer_payment_instrument_controller.rb', line 120

def get_customer_payment_instruments_list(customer_id,
                                          profile_id: nil,
                                          offset: 0,
                                          limit: 20)
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/tms/v2/customers/{customerId}/payment-instruments',
                                 Server::DEFAULT)
               .template_param(new_parameter(customer_id, key: 'customerId')
                                .is_required(true)
                                .should_encode(true))
               .header_param(new_parameter(profile_id, key: 'profile-id'))
               .query_param(new_parameter(offset, key: 'offset'))
               .query_param(new_parameter(limit, key: 'limit'))
               .header_param(new_parameter('application/json', key: 'accept')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(PaymentInstrumentList.method(:from_hash))
                .is_api_response(true)
                .local_error('400',
                             'Bad Request: e.g. A required header value could be missing.',
                             GetCustomerPaymentInstrumentsListException)
                .local_error('403',
                             'Forbidden: e.g. The profile might not have permission to'\
                              ' perform the operation.',
                             GetCustomerPaymentInstrumentsListException2Exception)
                .local_error('404',
                             'Token Not Found. The Id may not exist or was entered'\
                              ' incorrectly.',
                             GetCustomerPaymentInstrumentsListException3Exception)
                .local_error('410',
                             'Token Not Available. The token has been deleted.',
                             GetCustomerPaymentInstrumentsListException4Exception)
                .local_error('424',
                             'Failed Dependency: e.g. The profile represented by the'\
                              ' profile-id may not exist or the profile-id was entered'\
                              ' incorrectly.',
                             GetCustomerPaymentInstrumentsListException5Exception)
                .local_error('500',
                             'Unexpected error.',
                             GetCustomerPaymentInstrumentsListException6Exception))
    .execute
end

#patch_customers_payment_instrument(customer_id, payment_instrument_id, patch_customer_payment_instrument_request, profile_id: nil, if_match: nil) ⇒ ApiResponse

| | | | | --- | --- | --- | |Customer Payment Instrument
A Customer Payment Instrument represents tokenized customer payment information such as expiration date, billing address & card type.
A Customer can have [one or more Payment Instruments](#token-management_customer-payment-instrument_retrieve-a-cust omer-payment-instrument), with one allocated as the Customers default for use in payments.
A Payment Instrument token does not store the card number. A Payment Instrument is associated with an [Instrument Identifier](#token-management_instrument-identifier_create-an-instrument-i dentifier) that represents either a payment card number, or in the case of an ACH bank account, the routing and account number.
|      |Updating a Customers Payment Instrument
Your system can use this API to update an existing Payment Instrument for a Customer, including selecting a [default Payment Instrument](#token-management_customer-payment-instrument_update-a-custome r-payment-instrument_samplerequests-dropdown_make-customer-payment-instrum ent-the-default_liveconsole-tab-request-body) for use in payments. payment instrument. patch_customer_payment_instrument_request Required parameter: TODO: type description here containing user specific TMS configuration. GET request to make the request conditional.

Parameters:

  • customer_id (String)

    Required parameter: The Id of a Customer.

  • payment_instrument_id (String)

    Required parameter: The Id of a

  • (PatchCustomerPaymentInstrumentRequest)
  • profile_id (String) (defaults to: nil)

    Optional parameter: The Id of a profile

  • if_match (String) (defaults to: nil)

    Optional parameter: Contains an ETag value from a

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



267
268
269
270
271
272
273
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
# File 'lib/cyber_source_merged_spec/controllers/customer_payment_instrument_controller.rb', line 267

def patch_customers_payment_instrument(customer_id,
                                       payment_instrument_id,
                                       patch_customer_payment_instrument_request,
                                       profile_id: nil,
                                       if_match: nil)
  @api_call
    .request(new_request_builder(HttpMethodEnum::PATCH,
                                 '/tms/v2/customers/{customerId}/payment-instruments/{paymentInstrumentId}',
                                 Server::DEFAULT)
               .template_param(new_parameter(customer_id, key: 'customerId')
                                .is_required(true)
                                .should_encode(true))
               .template_param(new_parameter(payment_instrument_id, key: 'paymentInstrumentId')
                                .is_required(true)
                                .should_encode(true))
               .body_param(new_parameter(patch_customer_payment_instrument_request)
                            .is_required(true))
               .header_param(new_parameter('application/json;charset=utf-8', key: 'Content-Type'))
               .header_param(new_parameter(profile_id, key: 'profile-id'))
               .header_param(new_parameter(if_match, key: 'if-match'))
               .header_param(new_parameter('application/json', key: 'accept'))
               .body_serializer(proc do |param| param.to_json unless param.nil? end))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(PaymentInstrument11.method(:from_hash))
                .is_api_response(true)
                .local_error('400',
                             'Bad Request: e.g. A required header value could be missing.',
                             PatchCustomersPaymentInstrumentException)
                .local_error('403',
                             'Forbidden: e.g. The profile might not have permission to'\
                              ' perform the operation.',
                             PatchCustomersPaymentInstrumentException2Exception)
                .local_error('404',
                             'Token Not Found. The Id may not exist or was entered'\
                              ' incorrectly.',
                             PatchCustomersPaymentInstrumentException3Exception)
                .local_error('410',
                             'Token Not Available. The token has been deleted.',
                             PatchCustomersPaymentInstrumentException4Exception)
                .local_error('412',
                             'Precondition Failed: The If-Match request header value does'\
                              ' not match the current resources ETag',
                             PatchCustomersPaymentInstrumentException5Exception)
                .local_error('424',
                             'Failed Dependency: e.g. The profile represented by the'\
                              ' profile-id may not exist or the profile-id was entered'\
                              ' incorrectly.',
                             PatchCustomersPaymentInstrumentException6Exception)
                .local_error('500',
                             'Unexpected error.',
                             PatchCustomersPaymentInstrumentException7Exception))
    .execute
end

#post_customer_payment_instrument(customer_id, post_customer_payment_instrument_request, profile_id: nil) ⇒ ApiResponse

| | | | | --- | --- | --- | |Customer Payment Instrument
A Customer Payment Instrument represents tokenized customer payment information such as expiration date, billing address & card type.
A Customer can have [one or more Payment Instruments](#token-management_customer-payment-instrument_retrieve-a-cust omer-payment-instrument), with one allocated as the Customers default for use in payments.
A Payment Instrument token does not store the card number. A Payment Instrument is associated with an [Instrument Identifier](#token-management_instrument-identifier_create-an-instrument-i dentifier) that represents either a payment card number, or in the case of an ACH bank account, the routing and account number.

Creating a Customer Payment Instrument
It is recommended you [create a Customer Payment Instrument via a Payment Authorization](#payments_payments_process-a-payment_samplerequests-dropdow n_authorization-with-token-create_authorization-create-default-payment-ins trument-shipping-address-for-existing-customer_liveconsole-tab-request-bod y), this can be for a zero amount.
In Europe: You should perform Payer Authentication alongside the Authorization.|      |Payment Network Tokens
Network tokens perform better than regular card numbers and they are not necessarily invalidated when a cardholder loses their card, or it expires.
A Payment Network Token will be automatically created and used in future payments if you are enabled for the service.
A Payment Network Token can also be [provisioned for an existing Instrument Identifier](#token-management_instrument-identifier_enroll-an-instrument-i dentifier-for-payment-network-token).
For more information about Payment Network Tokens see the Developer Guide.

Payments with Customers Payment Instrument
To perform a payment with a particular Payment Instrument or Shipping Address specify the [Payment Instrument in the payment request](#payments_payments_process-a-payment_samplerequests-dropdown_auth orization-using-tokens_authorization-with-customer-payment-instrument-and- shipping-address-token-id_liveconsole-tab-request-body). post_customer_payment_instrument_request Required parameter: TODO: type description here containing user specific TMS configuration.

Parameters:

  • customer_id (String)

    Required parameter: The Id of a Customer.

  • (PostCustomerPaymentInstrumentRequest)
  • profile_id (String) (defaults to: nil)

    Optional parameter: The Id of a profile

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



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
# File 'lib/cyber_source_merged_spec/controllers/customer_payment_instrument_controller.rb', line 52

def post_customer_payment_instrument(customer_id,
                                     post_customer_payment_instrument_request,
                                     profile_id: nil)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/tms/v2/customers/{customerId}/payment-instruments',
                                 Server::DEFAULT)
               .template_param(new_parameter(customer_id, key: 'customerId')
                                .is_required(true)
                                .should_encode(true))
               .body_param(new_parameter(post_customer_payment_instrument_request)
                            .is_required(true))
               .header_param(new_parameter('application/json;charset=utf-8', key: 'Content-Type'))
               .header_param(new_parameter(profile_id, key: 'profile-id'))
               .header_param(new_parameter('application/json', key: 'accept'))
               .body_serializer(proc do |param| param.to_json unless param.nil? end))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(PaymentInstrument11.method(:from_hash))
                .is_api_response(true)
                .local_error('400',
                             'Bad Request: e.g. A required header value could be missing.',
                             PostCustomerPaymentInstrumentException)
                .local_error('403',
                             'Forbidden: e.g. The profile might not have permission to'\
                              ' perform the operation.',
                             PostCustomerPaymentInstrumentException2Exception)
                .local_error('409',
                             'Conflict. The token is linked to a Payment Instrument.',
                             PostCustomerPaymentInstrumentException3Exception)
                .local_error('424',
                             'Failed Dependency: e.g. The profile represented by the'\
                              ' profile-id may not exist or the profile-id was entered'\
                              ' incorrectly.',
                             PostCustomerPaymentInstrumentException4Exception)
                .local_error('500',
                             'Unexpected error.',
                             PostCustomerPaymentInstrumentException5Exception))
    .execute
end