Class: CyberSourceMergedSpec::CustomerShippingAddressController

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

Overview

CustomerShippingAddressController

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_shipping_address(customer_id, shipping_address_id, profile_id: nil) ⇒ ApiResponse

| | | | | --- | --- | --- | |Customer Shipping Address
A Customer Shipping Address represents tokenized customer shipping information.
A Customer can have [one or more Shipping Addresses](#token-management_customer-shipping-address_list-shipping-addre sses-for-a-customer), with one allocated as the Customers default for use in payments.|      |Deleting a Customers Shipping Address
Your system can use this API to delete an existing Shipping Address for a Customer.
If a customer has more than one Shipping Address then the default Shipping Address cannot be deleted without first selecting a [new default Shipping Address](#token-management_customer-shipping-address_update-a-customer-shi pping-address_samplerequests-dropdown_make-customer-shipping-address-the-d efault_liveconsole-tab-request-body). shipping address. containing user specific TMS configuration.

Parameters:

  • customer_id (String)

    Required parameter: The Id of a Customer.

  • shipping_address_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.



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

def delete_customer_shipping_address(customer_id,
                                     shipping_address_id,
                                     profile_id: nil)
  @api_call
    .request(new_request_builder(HttpMethodEnum::DELETE,
                                 '/tms/v2/customers/{customerId}/shipping-addresses/{shippingAddressId}',
                                 Server::DEFAULT)
               .template_param(new_parameter(customer_id, key: 'customerId')
                                .is_required(true)
                                .should_encode(true))
               .template_param(new_parameter(shipping_address_id, key: 'shippingAddressId')
                                .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.',
                             DeleteCustomerShippingAddressException)
                .local_error('403',
                             'Forbidden: e.g. The profile might not have permission to'\
                              ' perform the operation.',
                             DeleteCustomerShippingAddressException2Exception)
                .local_error('404',
                             'Token Not Found. The Id may not exist or was entered'\
                              ' incorrectly.',
                             DeleteCustomerShippingAddressException3Exception)
                .local_error('409',
                             'Conflict. The token is linked to a Payment Instrument.',
                             DeleteCustomerShippingAddressException4Exception)
                .local_error('410',
                             'Token Not Available. The token has been deleted.',
                             DeleteCustomerShippingAddressException5Exception)
                .local_error('424',
                             'Failed Dependency: e.g. The profile represented by the'\
                              ' profile-id may not exist or the profile-id was entered'\
                              ' incorrectly.',
                             DeleteCustomerShippingAddressException6Exception)
                .local_error('500',
                             'Unexpected error.',
                             DeleteCustomerShippingAddressException7Exception))
    .execute
end

#get_customer_shipping_address(customer_id, shipping_address_id, profile_id: nil) ⇒ ApiResponse

| | | | | --- | --- | --- | |Customer Shipping Address
A Customer Shipping Address represents tokenized customer shipping information.
A Customer can have [one or more Shipping Addresses](#token-management_customer-shipping-address_list-shipping-addre sses-for-a-customer), with one allocated as the Customers default for use in payments.|      |Retrieving a Customer Shipping Address
Your system can use this API to retrieve an existing Shipping Address for a Customer.
To perform a payment with a particular Shipping Address simply specify the [Shipping Address 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). shipping address. containing user specific TMS configuration.

Parameters:

  • customer_id (String)

    Required parameter: The Id of a Customer.

  • shipping_address_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.



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
191
192
193
194
195
196
197
198
199
200
# File 'lib/cyber_source_merged_spec/controllers/customer_shipping_address_controller.rb', line 158

def get_customer_shipping_address(customer_id,
                                  shipping_address_id,
                                  profile_id: nil)
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/tms/v2/customers/{customerId}/shipping-addresses/{shippingAddressId}',
                                 Server::DEFAULT)
               .template_param(new_parameter(customer_id, key: 'customerId')
                                .is_required(true)
                                .should_encode(true))
               .template_param(new_parameter(shipping_address_id, key: 'shippingAddressId')
                                .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(GetCustomerShippingAddressResponse.method(:from_hash))
                .is_api_response(true)
                .local_error('400',
                             'Bad Request: e.g. A required header value could be missing.',
                             GetCustomerShippingAddressException)
                .local_error('403',
                             'Forbidden: e.g. The profile might not have permission to'\
                              ' perform the operation.',
                             GetCustomerShippingAddressException2Exception)
                .local_error('404',
                             'Token Not Found. The Id may not exist or was entered'\
                              ' incorrectly.',
                             GetCustomerShippingAddressException3Exception)
                .local_error('410',
                             'Token Not Available. The token has been deleted.',
                             GetCustomerShippingAddressException4Exception)
                .local_error('424',
                             'Failed Dependency: e.g. The profile represented by the'\
                              ' profile-id may not exist or the profile-id was entered'\
                              ' incorrectly.',
                             GetCustomerShippingAddressException5Exception)
                .local_error('500',
                             'Unexpected error.',
                             GetCustomerShippingAddressException6Exception))
    .execute
end

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

| | | | | --- | --- | --- | |Customer Shipping Address
A Customer Shipping Address represents tokenized customer shipping information.
A Customer can have [one or more Shipping Addresses](#token-management_customer-shipping-address_list-shipping-addre sses-for-a-customer), with one allocated as the Customers default for use in payments.|      |Retrieving all Customer Shipping Addresses
Your system can use this API to retrieve all existing Shipping Addresses 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.



93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
# File 'lib/cyber_source_merged_spec/controllers/customer_shipping_address_controller.rb', line 93

def get_customer_shipping_addresses_list(customer_id,
                                         profile_id: nil,
                                         offset: 0,
                                         limit: 20)
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/tms/v2/customers/{customerId}/shipping-addresses',
                                 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(ShippingAddressListForCustomer.method(:from_hash))
                .is_api_response(true)
                .local_error('400',
                             'Bad Request: e.g. A required header value could be missing.',
                             GetCustomerShippingAddressesListException)
                .local_error('403',
                             'Forbidden: e.g. The profile might not have permission to'\
                              ' perform the operation.',
                             GetCustomerShippingAddressesListException2Exception)
                .local_error('404',
                             'Token Not Found. The Id may not exist or was entered'\
                              ' incorrectly.',
                             GetCustomerShippingAddressesListException3Exception)
                .local_error('410',
                             'Token Not Available. The token has been deleted.',
                             GetCustomerShippingAddressesListException4Exception)
                .local_error('424',
                             'Failed Dependency: e.g. The profile represented by the'\
                              ' profile-id may not exist or the profile-id was entered'\
                              ' incorrectly.',
                             GetCustomerShippingAddressesListException5Exception)
                .local_error('500',
                             'Unexpected error.',
                             GetCustomerShippingAddressesListException6Exception))
    .execute
end

#patch_customers_shipping_address(customer_id, shipping_address_id, patch_customer_shipping_address_request, profile_id: nil, if_match: nil) ⇒ ApiResponse

| | | | | --- | --- | --- | |Customer Shipping Address
A Customer Shipping Address represents tokenized customer shipping information.
A Customer can have [one or more Shipping Addresses](#token-management_customer-shipping-address_list-shipping-addre sses-for-a-customer), with one allocated as the Customers default for use in payments.|      |Updating a Customers Shipping Address
Your system can use this API to update an existing Shipping Addresses for a Customer, including selecting a [default Shipping Address](#token-management_customer-shipping-address_update-a-customer-shi pping-address_samplerequests-dropdown_make-customer-shipping-address-the-d efault_liveconsole-tab-request-body) for use in payments. shipping address. patch_customer_shipping_address_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.

  • shipping_address_id (String)

    Required parameter: The Id of a

  • (PatchCustomerShippingAddressRequest)
  • 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.



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
272
273
274
275
276
277
278
279
280
# File 'lib/cyber_source_merged_spec/controllers/customer_shipping_address_controller.rb', line 227

def patch_customers_shipping_address(customer_id,
                                     shipping_address_id,
                                     patch_customer_shipping_address_request,
                                     profile_id: nil,
                                     if_match: nil)
  @api_call
    .request(new_request_builder(HttpMethodEnum::PATCH,
                                 '/tms/v2/customers/{customerId}/shipping-addresses/{shippingAddressId}',
                                 Server::DEFAULT)
               .template_param(new_parameter(customer_id, key: 'customerId')
                                .is_required(true)
                                .should_encode(true))
               .template_param(new_parameter(shipping_address_id, key: 'shippingAddressId')
                                .is_required(true)
                                .should_encode(true))
               .body_param(new_parameter(patch_customer_shipping_address_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(PatchCustomersShippingAddressResponse.method(:from_hash))
                .is_api_response(true)
                .local_error('400',
                             'Bad Request: e.g. A required header value could be missing.',
                             PatchCustomersShippingAddressException)
                .local_error('403',
                             'Forbidden: e.g. The profile might not have permission to'\
                              ' perform the operation.',
                             PatchCustomersShippingAddressException2Exception)
                .local_error('404',
                             'Token Not Found. The Id may not exist or was entered'\
                              ' incorrectly.',
                             PatchCustomersShippingAddressException3Exception)
                .local_error('410',
                             'Token Not Available. The token has been deleted.',
                             PatchCustomersShippingAddressException4Exception)
                .local_error('412',
                             'Precondition Failed: The If-Match request header value does'\
                              ' not match the current resources ETag',
                             PatchCustomersShippingAddressException5Exception)
                .local_error('424',
                             'Failed Dependency: e.g. The profile represented by the'\
                              ' profile-id may not exist or the profile-id was entered'\
                              ' incorrectly.',
                             PatchCustomersShippingAddressException6Exception)
                .local_error('500',
                             'Unexpected error.',
                             PatchCustomersShippingAddressException7Exception))
    .execute
end

#post_customer_shipping_address(customer_id, post_customer_shipping_address_request, profile_id: nil) ⇒ ApiResponse

| | | | | --- | --- | --- | |Customer Shipping Address
A Customer Shipping Address represents tokenized customer shipping information.
A Customer can have [one or more Shipping Addresses](#token-management_customer-shipping-address_list-shipping-addre sses-for-a-customer), with one allocated as the Customers default for use in payments.|      |Creating a Customer Shipping Address
Your system can use this API to create an existing Customers default or non default Shipping Address.
You can also create additional Customer Shipping Addresses via the [Payments API](#payments_payments_process-a-payment_samplerequests-dropdown_authoriz ation-with-token-create_authorization-create-default-payment-instrument-sh ipping-address-for-existing-customer_liveconsole-tab-request-body). post_customer_shipping_address_request Required parameter: TODO: type description here containing user specific TMS configuration.

Parameters:

  • customer_id (String)

    Required parameter: The Id of a Customer.

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

    Optional parameter: The Id of a profile

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



31
32
33
34
35
36
37
38
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
# File 'lib/cyber_source_merged_spec/controllers/customer_shipping_address_controller.rb', line 31

def post_customer_shipping_address(customer_id,
                                   post_customer_shipping_address_request,
                                   profile_id: nil)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/tms/v2/customers/{customerId}/shipping-addresses',
                                 Server::DEFAULT)
               .template_param(new_parameter(customer_id, key: 'customerId')
                                .is_required(true)
                                .should_encode(true))
               .body_param(new_parameter(post_customer_shipping_address_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(PostCustomerShippingAddressResponse.method(:from_hash))
                .is_api_response(true)
                .local_error('400',
                             'Bad Request: e.g. A required header value could be missing.',
                             PostCustomerShippingAddressException)
                .local_error('403',
                             'Forbidden: e.g. The profile might not have permission to'\
                              ' perform the operation.',
                             PostCustomerShippingAddressException2Exception)
                .local_error('409',
                             'Conflict. The token is linked to a Payment Instrument.',
                             PostCustomerShippingAddressException3Exception)
                .local_error('424',
                             'Failed Dependency: e.g. The profile represented by the'\
                              ' profile-id may not exist or the profile-id was entered'\
                              ' incorrectly.',
                             PostCustomerShippingAddressException4Exception)
                .local_error('500',
                             'Unexpected error.',
                             PostCustomerShippingAddressException5Exception))
    .execute
end