Class: CyberSourceMergedSpec::CustomerController
- Inherits:
-
BaseController
- Object
- BaseController
- CyberSourceMergedSpec::CustomerController
- Defined in:
- lib/cyber_source_merged_spec/controllers/customer_controller.rb
Overview
CustomerController
Constant Summary
Constants inherited from BaseController
Instance Attribute Summary
Attributes inherited from BaseController
Instance Method Summary collapse
-
#delete_customer(customer_id, profile_id: nil) ⇒ ApiResponse
| | | | | --- | --- | --- | |Customers
A Customer represents your tokenized customer information.
You should associate the Customer Id with the customer account on your systems.
A Customer can have one or more [Payment Instruments](#token-management_customer-payment-instrument_create-a-custom er-payment-instrumentl) or [Shipping Addresses](#token-management_customer-shipping-address_create-a-customer-s hipping-address) with one allocated as the Customers default.| |Deleting a Customer
Your system can use this API to delete a complete Customer.
When a Customer is deleted all associated Payment Instruments & Shipping Addresses are deleted.
Any Instrument Identifiers representing the card number will also be deleted if they are not associated with any other Payment Instruments.
Note: Individual [Payment Instruments](#token-management_customer-payment-instrument_delete-a-custom er-payment-instrument) or [Shipping Addresses](#token-management_customer-shipping-address_delete-a-customer-s hipping-address) can be deleted via their own dedicated API resources. -
#get_customer(customer_id, profile_id: nil) ⇒ ApiResponse
| | | | | --- | --- | --- | |Customers
A Customer represents your tokenized customer information.
You should associate the Customer Id with the customer account on your systems.
A Customer can have one or more [Payment Instruments](#token-management_customer-payment-instrument_create-a-custom er-payment-instrumentl) or [Shipping Addresses](#token-management_customer-shipping-address_create-a-customer-s hipping-address) with one allocated as the Customers default.
Retrieving a Customer
When your customer signs into their account, your system can use this API to retrieve the Customers default Payment Instrument and Shipping Address.
Note: the actual card data will be masked.
If your customer wants to see other available Payment Instruments, your system can [retrieve all Payment Instruments](#token-management_customer-payment-instrument_list-payment-in struments-for-a-customer) associated with the Customer.
The same applies to [Shipping Addresses](#token-management_customer-shipping-address_list-shipping-addre sses-for-a-customer).| |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
To perform a payment with the Customers default details specify the [Customer Id in the payments request](#payments_payments_process-a-payment_samplerequests-dropdown_auth orization-using-tokens_authorization-with-customer-token-id_liveconsole-ta b-request-body).
To perform a payment with a particular Payment Instrument or Shipping Address
specify the [Payment Instrument or Shipping Address Ids 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). -
#patch_customer(customer_id, patch_customer_request, profile_id: nil, if_match: nil) ⇒ ApiResponse
| | | | | --- | --- | --- | |Customers
A Customer represents your tokenized customer information.
You should associate the Customer Id with the customer account on your systems.
A Customer can have one or more [Payment Instruments](#token-management_customer-payment-instrument_create-a-custom er-payment-instrumentl) or [Shipping Addresses](#token-management_customer-shipping-address_create-a-customer-s hipping-address) with one allocated as the Customers default.| |Updating a Customer
Your system can use this API to update a Customers details including selecting a [default Payment Instrument](#token-management_customer_update-a-customer_samplerequests-dr opdown_update-customers-default-payment-instrument_liveconsole-tab-request -body) or [default Shipping Address](#token-management_customer_update-a-customer_samplerequests-dropd own_update-customers-default-shipping-address_liveconsole-tab-request-body ) for use in payments.
Note: Updating a Customers [Payment Instrument](#token-management_customer-payment-instrument_update-a-custome r-payment-instrument) or [Shipping Address](#token-management_customer-shipping-address_update-a-customer-shi pping-address) details is performed using their own dedicated API resources. -
#post_customer(post_customer_request, profile_id: nil) ⇒ ApiResponse
| | | | | --- | --- | --- | |Customers
A Customer represents your tokenized customer information.
You should associate the Customer Id with the customer account on your systems.
A Customer can have one or more [Payment Instruments](#token-management_customer-payment-instrument_create-a-custom er-payment-instrumentl) or [Shipping Addresses](#token-management_customer-shipping-address_create-a-customer-s hipping-address) with one allocated as the Customers default.
Creating a Customer
It is recommended you [create a Customer via a Payment Authorization](#payments_payments_process-a-payment_samplerequests-dropdow n_authorization-with-token-create_authorization-with-customer-token-creati on_liveconsole-tab-request-body), this can be for a zero amount.
The Customer will be created with a Payment Instrument and Shipping Address.
You can also [add additional Payment Instruments to a Customer 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).
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
To perform a payment with the Customers default details specify the [Customer Id in the payments request](#payments_payments_process-a-payment_samplerequests-dropdown_auth orization-using-tokens_authorization-with-customer-token-id_liveconsole-ta b-request-body).
To perform a payment with a particular Payment Instrument or Shipping Address
specify the [Payment Instrument or Shipping Address Ids 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).
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(customer_id, profile_id: nil) ⇒ ApiResponse
| | | |
| --- | --- | --- |
|Customers
A Customer represents your tokenized customer
information.
You should associate the Customer Id with the customer
account on your systems.
A Customer can have one or more [Payment
Instruments](#token-management_customer-payment-instrument_create-a-custom
er-payment-instrumentl) or [Shipping
Addresses](#token-management_customer-shipping-address_create-a-customer-s
hipping-address) with one allocated as the Customers
default.| |Deleting a
Customer
Your system can use this API to delete a complete
Customer.
When a Customer is deleted all associated Payment Instruments
& Shipping Addresses are deleted.
Any Instrument Identifiers
representing the card number will also be deleted if they are not
associated with any other Payment Instruments.
Note: Individual
[Payment
Instruments](#token-management_customer-payment-instrument_delete-a-custom
er-payment-instrument) or [Shipping
Addresses](#token-management_customer-shipping-address_delete-a-customer-s
hipping-address) can be deleted via their own dedicated API resources.
containing user specific TMS configuration.
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 |
# File 'lib/cyber_source_merged_spec/controllers/customer_controller.rb', line 282 def delete_customer(customer_id, profile_id: nil) @api_call .request(new_request_builder(HttpMethodEnum::DELETE, '/tms/v2/customers/{customerId}', 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')) .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.', DeleteCustomerException) .local_error('403', 'Forbidden: e.g. The profile might not have permission to'\ ' perform the operation.', DeleteCustomerException2Exception) .local_error('404', 'Token Not Found. The Id may not exist or was entered'\ ' incorrectly.', DeleteCustomerException3Exception) .local_error('410', 'Token Not Available. The token has been deleted.', DeleteCustomerException4Exception) .local_error('424', 'Failed Dependency: e.g. The profile represented by the'\ ' profile-id may not exist or the profile-id was entered'\ ' incorrectly.', DeleteCustomerException5Exception) .local_error('500', 'Unexpected error.', DeleteCustomerException6Exception)) .execute end |
#get_customer(customer_id, profile_id: nil) ⇒ ApiResponse
| | | |
| --- | --- | --- |
|Customers
A Customer represents your tokenized customer
information.
You should associate the Customer Id with the customer
account on your systems.
A Customer can have one or more [Payment
Instruments](#token-management_customer-payment-instrument_create-a-custom
er-payment-instrumentl) or [Shipping
Addresses](#token-management_customer-shipping-address_create-a-customer-s
hipping-address) with one allocated as the Customers
default.
Retrieving a Customer
When your customer signs into
their account, your system can use this API to retrieve the Customers
default Payment Instrument and Shipping Address.
Note: the actual
card data will be masked.
If your customer wants to see other
available Payment Instruments, your system can [retrieve all Payment
Instruments](#token-management_customer-payment-instrument_list-payment-in
struments-for-a-customer) associated with the Customer.
The same
applies to [Shipping
Addresses](#token-management_customer-shipping-address_list-shipping-addre
sses-for-a-customer).| |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
To perform a payment with the Customers default details
specify the [Customer Id in the payments
request](#payments_payments_process-a-payment_samplerequests-dropdown_auth
orization-using-tokens_authorization-with-customer-token-id_liveconsole-ta
b-request-body).
To perform a payment with a particular Payment
Instrument or Shipping Address
specify the [Payment Instrument or
Shipping Address Ids 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).
containing user specific TMS configuration.
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 |
# File 'lib/cyber_source_merged_spec/controllers/customer_controller.rb', line 136 def get_customer(customer_id, profile_id: nil) @api_call .request(new_request_builder(HttpMethodEnum::GET, '/tms/v2/customers/{customerId}', 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')) .header_param(new_parameter('application/json', key: 'accept'))) .response(new_response_handler .deserializer(APIHelper.method(:custom_type_deserializer)) .deserialize_into(GetCustomerResponse.method(:from_hash)) .is_api_response(true) .local_error('400', 'Bad Request: e.g. A required header value could be missing.', GetCustomerException) .local_error('403', 'Forbidden: e.g. The profile might not have permission to'\ ' perform the operation.', GetCustomerException2Exception) .local_error('404', 'Token Not Found. The Id may not exist or was entered'\ ' incorrectly.', GetCustomerException3Exception) .local_error('410', 'Token Not Available. The token has been deleted.', GetCustomerException4Exception) .local_error('424', 'Failed Dependency: e.g. The profile represented by the'\ ' profile-id may not exist or the profile-id was entered'\ ' incorrectly.', GetCustomerException5Exception) .local_error('500', 'Unexpected error.', GetCustomerException6Exception)) .execute end |
#patch_customer(customer_id, patch_customer_request, profile_id: nil, if_match: nil) ⇒ ApiResponse
| | | |
| --- | --- | --- |
|Customers
A Customer represents your tokenized customer
information.
You should associate the Customer Id with the customer
account on your systems.
A Customer can have one or more [Payment
Instruments](#token-management_customer-payment-instrument_create-a-custom
er-payment-instrumentl) or [Shipping
Addresses](#token-management_customer-shipping-address_create-a-customer-s
hipping-address) with one allocated as the Customers
default.| |Updating a
Customer
Your system can use this API to update a Customers details
including selecting a [default Payment
Instrument](#token-management_customer_update-a-customer_samplerequests-dr
opdown_update-customers-default-payment-instrument_liveconsole-tab-request
-body) or [default Shipping
Address](#token-management_customer_update-a-customer_samplerequests-dropd
own_update-customers-default-shipping-address_liveconsole-tab-request-body
) for use in payments.
Note: Updating a Customers [Payment
Instrument](#token-management_customer-payment-instrument_update-a-custome
r-payment-instrument) or [Shipping
Address](#token-management_customer-shipping-address_update-a-customer-shi
pping-address) details is performed using their own dedicated API
resources.
TODO: type description here
containing user specific TMS configuration.
GET request to make the request conditional.
207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 |
# File 'lib/cyber_source_merged_spec/controllers/customer_controller.rb', line 207 def patch_customer(customer_id, patch_customer_request, profile_id: nil, if_match: nil) @api_call .request(new_request_builder(HttpMethodEnum::PATCH, '/tms/v2/customers/{customerId}', Server::DEFAULT) .template_param(new_parameter(customer_id, key: 'customerId') .is_required(true) .should_encode(true)) .body_param(new_parameter(patch_customer_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(PatchCustomerResponse.method(:from_hash)) .is_api_response(true) .local_error('400', 'Bad Request: e.g. A required header value could be missing.', PatchCustomerException) .local_error('403', 'Forbidden: e.g. The profile might not have permission to'\ ' perform the operation.', PatchCustomerException2Exception) .local_error('404', 'Token Not Found. The Id may not exist or was entered'\ ' incorrectly.', PatchCustomerException3Exception) .local_error('410', 'Token Not Available. The token has been deleted.', PatchCustomerException4Exception) .local_error('412', 'Precondition Failed: The If-Match request header value does'\ ' not match the current resources ETag', PatchCustomerException5Exception) .local_error('424', 'Failed Dependency: e.g. The profile represented by the'\ ' profile-id may not exist or the profile-id was entered'\ ' incorrectly.', PatchCustomerException6Exception) .local_error('500', 'Unexpected error.', PatchCustomerException7Exception)) .execute end |
#post_customer(post_customer_request, profile_id: nil) ⇒ ApiResponse
| | | |
| --- | --- | --- |
|Customers
A Customer represents your tokenized customer
information.
You should associate the Customer Id with the customer
account on your systems.
A Customer can have one or more [Payment
Instruments](#token-management_customer-payment-instrument_create-a-custom
er-payment-instrumentl) or [Shipping
Addresses](#token-management_customer-shipping-address_create-a-customer-s
hipping-address) with one allocated as the Customers
default.
Creating a Customer
It is recommended you [create a
Customer via a Payment
Authorization](#payments_payments_process-a-payment_samplerequests-dropdow
n_authorization-with-token-create_authorization-with-customer-token-creati
on_liveconsole-tab-request-body), this can be for a zero amount.
The
Customer will be created with a Payment Instrument and Shipping
Address.
You can also [add additional Payment Instruments to a Customer
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).
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
To perform a payment with the Customers default details
specify the [Customer Id in the payments
request](#payments_payments_process-a-payment_samplerequests-dropdown_auth
orization-using-tokens_authorization-with-customer-token-id_liveconsole-ta
b-request-body).
To perform a payment with a particular Payment
Instrument or Shipping Address
specify the [Payment Instrument or
Shipping Address Ids 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).
The availability of API features for a merchant may depend on the
portfolio configuration and may need to be enabled at the portfolio level
before they can be added to merchant accounts.
TODO: type description here
containing user specific TMS configuration.
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 |
# File 'lib/cyber_source_merged_spec/controllers/customer_controller.rb', line 57 def post_customer(post_customer_request, profile_id: nil) @api_call .request(new_request_builder(HttpMethodEnum::POST, '/tms/v2/customers', Server::DEFAULT) .body_param(new_parameter(post_customer_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(TmsV2CustomersResponse.method(:from_hash)) .is_api_response(true) .local_error('400', 'Bad Request: e.g. A required header value could be missing.', PostCustomerException) .local_error('403', 'Forbidden: e.g. The profile might not have permission to'\ ' perform the operation.', PostCustomerException2Exception) .local_error('409', 'Conflict. The token is linked to a Payment Instrument.', PostCustomerException3Exception) .local_error('424', 'Failed Dependency: e.g. The profile represented by the'\ ' profile-id may not exist or the profile-id was entered'\ ' incorrectly.', PostCustomerException4Exception) .local_error('500', 'Unexpected error.', PostCustomerException5Exception)) .execute end |