cybersource_rest_client 0.0.46 → 0.0.47

Sign up to get free protection for your applications and to get access to all the features.
Files changed (30) hide show
  1. checksums.yaml +4 -4
  2. data/lib/cybersource_rest_client/api/emv_tag_details_api.rb +152 -0
  3. data/lib/cybersource_rest_client/api/transient_token_data_api.rb +92 -0
  4. data/lib/cybersource_rest_client/api/unified_checkout_capture_context_api.rb +88 -0
  5. data/lib/cybersource_rest_client/models/body.rb +216 -0
  6. data/lib/cybersource_rest_client/models/generate_unified_checkout_capture_context_request.rb +276 -0
  7. data/lib/cybersource_rest_client/models/inline_response_400_3.rb +265 -0
  8. data/lib/cybersource_rest_client/models/inline_response_400_3_details.rb +192 -0
  9. data/lib/cybersource_rest_client/models/pts_v2_payments_post201_response_consumer_authentication_information_issuer_information.rb +52 -4
  10. data/lib/cybersource_rest_client/models/pts_v2_payments_post201_response_issuer_information.rb +4 -20
  11. data/lib/cybersource_rest_client/models/pts_v2_payouts_post201_response.rb +13 -4
  12. data/lib/cybersource_rest_client/models/pts_v2_payouts_post201_response_issuer_information.rb +190 -0
  13. data/lib/cybersource_rest_client/models/ptsv2payments_point_of_sale_information.rb +1 -1
  14. data/lib/cybersource_rest_client/models/ptsv2payments_processing_information_authorization_options.rb +1 -1
  15. data/lib/cybersource_rest_client/models/ptsv2payments_recurring_payment_information.rb +100 -4
  16. data/lib/cybersource_rest_client/models/tss_v2_get_emv_tags200_response.rb +186 -0
  17. data/lib/cybersource_rest_client/models/tss_v2_get_emv_tags200_response_emv_tag_breakdown_list.rb +215 -0
  18. data/lib/cybersource_rest_client/models/tss_v2_post_emv_tags200_response.rb +186 -0
  19. data/lib/cybersource_rest_client/models/tss_v2_post_emv_tags200_response_emv_tag_breakdown_list.rb +266 -0
  20. data/lib/cybersource_rest_client/models/tss_v2_post_emv_tags200_response_parsed_emv_tags_list.rb +212 -0
  21. data/lib/cybersource_rest_client/models/tssv2transactionsemv_tag_details_emv_details_list.rb +224 -0
  22. data/lib/cybersource_rest_client/models/upv1capturecontexts_capture_mandate.rb +242 -0
  23. data/lib/cybersource_rest_client/models/upv1capturecontexts_checkout_api_initialization.rb +264 -0
  24. data/lib/cybersource_rest_client/models/upv1capturecontexts_order_information.rb +201 -0
  25. data/lib/cybersource_rest_client/models/upv1capturecontexts_order_information_amount_details.rb +192 -0
  26. data/lib/cybersource_rest_client/models/upv1capturecontexts_order_information_bill_to.rb +459 -0
  27. data/lib/cybersource_rest_client/models/upv1capturecontexts_order_information_bill_to_company.rb +350 -0
  28. data/lib/cybersource_rest_client/models/upv1capturecontexts_order_information_ship_to.rb +354 -0
  29. data/lib/cybersource_rest_client.rb +21 -0
  30. metadata +45 -24
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7a7da240e798ebf2ebc94feb7b5a16ea7063d22e5ea9ef9cd5502d1c385d9fe5
4
- data.tar.gz: 42a44f628047a260771de48b62cf3003fc7bfc752e6ecc6a67c9e10639ddbaa2
3
+ metadata.gz: 42afa5e1e429ff82e450300d127c796b8b82a5bf70147825cea6d6751b2a3414
4
+ data.tar.gz: 62de3ef1cfab0104dc8d1536a1854b9128d7b018a77378c8f030ea4b4fe3ca9d
5
5
  SHA512:
6
- metadata.gz: 7a745028341fdf150124b3414c46574856a93735bfd6a226985f0d62983378985826fc9954aa921a9834057863c275f522891bfe8adbafae2d32510d22ed05b0
7
- data.tar.gz: 13f5cab06d072151fff26a919a22b22ba940391e1ae501142c416bc6ea51d3baebd4625ec9ce4977d90c877362279ffd6fce517f645ebf9dd77205fc99097b19
6
+ metadata.gz: 43f122b153d106f50330153ad22c39ca53dea0ad9f24f04637ca275f7d9d8d6ad14bc504c5bf4c40e407527f0f9e540adc100b074eb7af34df18b57eb697f899
7
+ data.tar.gz: 3d4fc93faa378a57e0be7d043cdcddc2e5adb79ef5d8eadafc02ce5cbd07b70d19550c8b3a2062dac082541d3e7f0f64e29a9322929bd569682e66aba56ced25
@@ -0,0 +1,152 @@
1
+ =begin
2
+ #CyberSource Merged Spec
3
+
4
+ #All CyberSource API specs merged together. These are available at https://developer.cybersource.com/api/reference/api-reference.html
5
+
6
+ OpenAPI spec version: 0.0.1
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.2.3
10
+
11
+ =end
12
+
13
+ require 'uri'
14
+
15
+ module CyberSource
16
+ class EMVTagDetailsApi
17
+ attr_accessor :api_client
18
+
19
+ def initialize(api_client = ApiClient.default, config)
20
+ @api_client = api_client
21
+ @api_client.set_configuration(config)
22
+ end
23
+ # Retrieve the EMV Dictionary
24
+ # Returns the entire EMV tag dictionary
25
+ # @param [Hash] opts the optional parameters
26
+ # @return [TssV2GetEmvTags200Response]
27
+ def get_emv_tags(opts = {})
28
+ data, status_code, headers = get_emv_tags_with_http_info(opts)
29
+ return data, status_code, headers
30
+ end
31
+
32
+ # Retrieve the EMV Dictionary
33
+ # Returns the entire EMV tag dictionary
34
+ # @param [Hash] opts the optional parameters
35
+ # @return [Array<(TssV2GetEmvTags200Response, Fixnum, Hash)>] TssV2GetEmvTags200Response data, response status code and response headers
36
+ def get_emv_tags_with_http_info(opts = {})
37
+
38
+ if @api_client.config.debugging
39
+ begin
40
+ raise
41
+ @api_client.config.logger.debug 'Calling API: EMVTagDetailsApi.get_emv_tags ...'
42
+ rescue
43
+ puts 'Cannot write to log'
44
+ end
45
+ end
46
+ # resource path
47
+ local_var_path = 'tss/v2/transactions/emvTagDetails'
48
+
49
+ # query parameters
50
+ query_params = {}
51
+
52
+ # header parameters
53
+ header_params = {}
54
+ # HTTP header 'Accept' (if needed)
55
+ header_params['Accept'] = @api_client.select_header_accept(['application/json;charset=utf-8'])
56
+ # HTTP header 'Content-Type'
57
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json;charset=utf-8'])
58
+
59
+ # form parameters
60
+ form_params = {}
61
+
62
+ # http body (model)
63
+ if 'GET' == 'POST'
64
+ post_body = '{}'
65
+ else
66
+ post_body = nil
67
+ end
68
+ auth_names = []
69
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path,
70
+ :header_params => header_params,
71
+ :query_params => query_params,
72
+ :form_params => form_params,
73
+ :body => post_body,
74
+ :auth_names => auth_names,
75
+ :return_type => 'TssV2GetEmvTags200Response')
76
+ if @api_client.config.debugging
77
+ begin
78
+ raise
79
+ @api_client.config.logger.debug "API called: EMVTagDetailsApi#get_emv_tags\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
80
+ rescue
81
+ puts 'Cannot write to log'
82
+ end
83
+ end
84
+ return data, status_code, headers
85
+ end
86
+ # Parse an EMV String
87
+ # Pass an EMV Tag-Length-Value (TLV) string for parsing.
88
+ # @param body
89
+ # @param [Hash] opts the optional parameters
90
+ # @return [TssV2PostEmvTags200Response]
91
+ def parse_emv_tags(body, opts = {})
92
+ data, status_code, headers = parse_emv_tags_with_http_info(body, opts)
93
+ return data, status_code, headers
94
+ end
95
+
96
+ # Parse an EMV String
97
+ # Pass an EMV Tag-Length-Value (TLV) string for parsing.
98
+ # @param body
99
+ # @param [Hash] opts the optional parameters
100
+ # @return [Array<(TssV2PostEmvTags200Response, Fixnum, Hash)>] TssV2PostEmvTags200Response data, response status code and response headers
101
+ def parse_emv_tags_with_http_info(body, opts = {})
102
+
103
+ if @api_client.config.debugging
104
+ begin
105
+ raise
106
+ @api_client.config.logger.debug 'Calling API: EMVTagDetailsApi.parse_emv_tags ...'
107
+ rescue
108
+ puts 'Cannot write to log'
109
+ end
110
+ end
111
+ # verify the required parameter 'body' is set
112
+ if @api_client.config.client_side_validation && body.nil?
113
+ fail ArgumentError, "Missing the required parameter 'body' when calling EMVTagDetailsApi.parse_emv_tags"
114
+ end
115
+ # resource path
116
+ local_var_path = 'tss/v2/transactions/emvTagDetails'
117
+
118
+ # query parameters
119
+ query_params = {}
120
+
121
+ # header parameters
122
+ header_params = {}
123
+ # HTTP header 'Accept' (if needed)
124
+ header_params['Accept'] = @api_client.select_header_accept(['application/hal+json;charset=utf-8'])
125
+ # HTTP header 'Content-Type'
126
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json;charset=utf-8'])
127
+
128
+ # form parameters
129
+ form_params = {}
130
+
131
+ # http body (model)
132
+ post_body = @api_client.object_to_http_body(body)
133
+ auth_names = []
134
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path,
135
+ :header_params => header_params,
136
+ :query_params => query_params,
137
+ :form_params => form_params,
138
+ :body => post_body,
139
+ :auth_names => auth_names,
140
+ :return_type => 'TssV2PostEmvTags200Response')
141
+ if @api_client.config.debugging
142
+ begin
143
+ raise
144
+ @api_client.config.logger.debug "API called: EMVTagDetailsApi#parse_emv_tags\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
145
+ rescue
146
+ puts 'Cannot write to log'
147
+ end
148
+ end
149
+ return data, status_code, headers
150
+ end
151
+ end
152
+ end
@@ -0,0 +1,92 @@
1
+ =begin
2
+ #CyberSource Merged Spec
3
+
4
+ #All CyberSource API specs merged together. These are available at https://developer.cybersource.com/api/reference/api-reference.html
5
+
6
+ OpenAPI spec version: 0.0.1
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.2.3
10
+
11
+ =end
12
+
13
+ require 'uri'
14
+
15
+ module CyberSource
16
+ class TransientTokenDataApi
17
+ attr_accessor :api_client
18
+
19
+ def initialize(api_client = ApiClient.default, config)
20
+ @api_client = api_client
21
+ @api_client.set_configuration(config)
22
+ end
23
+ # Get Transient Token Data
24
+ # Retrieve the data captured by Unfied Checkout. This API is used to retrieve the detailed data represented by the Transient Token. This API will not return PCI payment data (PAN). Include the Request ID in the GET request to retrieve the transaction details.
25
+ # @param transient_token Transient Token returned by the Unified Checkout application.
26
+ # @param [Hash] opts the optional parameters
27
+ # @return [nil]
28
+ def get_transaction_for_transient_token(transient_token, opts = {})
29
+ data, status_code, headers = get_transaction_for_transient_token_with_http_info(transient_token, opts)
30
+ return data, status_code, headers
31
+ end
32
+
33
+ # Get Transient Token Data
34
+ # Retrieve the data captured by Unfied Checkout. This API is used to retrieve the detailed data represented by the Transient Token. This API will not return PCI payment data (PAN). Include the Request ID in the GET request to retrieve the transaction details.
35
+ # @param transient_token Transient Token returned by the Unified Checkout application.
36
+ # @param [Hash] opts the optional parameters
37
+ # @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers
38
+ def get_transaction_for_transient_token_with_http_info(transient_token, opts = {})
39
+
40
+ if @api_client.config.debugging
41
+ begin
42
+ raise
43
+ @api_client.config.logger.debug 'Calling API: TransientTokenDataApi.get_transaction_for_transient_token ...'
44
+ rescue
45
+ puts 'Cannot write to log'
46
+ end
47
+ end
48
+ # verify the required parameter 'transient_token' is set
49
+ if @api_client.config.client_side_validation && transient_token.nil?
50
+ fail ArgumentError, "Missing the required parameter 'transient_token' when calling TransientTokenDataApi.get_transaction_for_transient_token"
51
+ end
52
+ # resource path
53
+ local_var_path = 'up/v1/payment-details/{transientToken}'.sub('{' + 'transientToken' + '}', transient_token.to_s)
54
+
55
+ # query parameters
56
+ query_params = {}
57
+
58
+ # header parameters
59
+ header_params = {}
60
+ # HTTP header 'Accept' (if needed)
61
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
62
+ # HTTP header 'Content-Type'
63
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json;charset=utf-8'])
64
+
65
+ # form parameters
66
+ form_params = {}
67
+
68
+ # http body (model)
69
+ if 'GET' == 'POST'
70
+ post_body = '{}'
71
+ else
72
+ post_body = nil
73
+ end
74
+ auth_names = []
75
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path,
76
+ :header_params => header_params,
77
+ :query_params => query_params,
78
+ :form_params => form_params,
79
+ :body => post_body,
80
+ :auth_names => auth_names)
81
+ if @api_client.config.debugging
82
+ begin
83
+ raise
84
+ @api_client.config.logger.debug "API called: TransientTokenDataApi#get_transaction_for_transient_token\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
85
+ rescue
86
+ puts 'Cannot write to log'
87
+ end
88
+ end
89
+ return data, status_code, headers
90
+ end
91
+ end
92
+ end
@@ -0,0 +1,88 @@
1
+ =begin
2
+ #CyberSource Merged Spec
3
+
4
+ #All CyberSource API specs merged together. These are available at https://developer.cybersource.com/api/reference/api-reference.html
5
+
6
+ OpenAPI spec version: 0.0.1
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.2.3
10
+
11
+ =end
12
+
13
+ require 'uri'
14
+
15
+ module CyberSource
16
+ class UnifiedCheckoutCaptureContextApi
17
+ attr_accessor :api_client
18
+
19
+ def initialize(api_client = ApiClient.default, config)
20
+ @api_client = api_client
21
+ @api_client.set_configuration(config)
22
+ end
23
+ # Generate Unified Checkout Capture Context
24
+ # Generate a one-time use capture context used for the invocation of Unified Checkout. The Request wil contain all of the paramiters for how Unified Chkcout will operate within a client webpage. The resulting payload will be a JWT signed object that can be used to initate Unified Checkout within a merchnat web page
25
+ # @param generate_unified_checkout_capture_context_request
26
+ # @param [Hash] opts the optional parameters
27
+ # @return [nil]
28
+ def generate_unified_checkout_capture_context(generate_unified_checkout_capture_context_request, opts = {})
29
+ data, status_code, headers = generate_unified_checkout_capture_context_with_http_info(generate_unified_checkout_capture_context_request, opts)
30
+ return data, status_code, headers
31
+ end
32
+
33
+ # Generate Unified Checkout Capture Context
34
+ # Generate a one-time use capture context used for the invocation of Unified Checkout. The Request wil contain all of the paramiters for how Unified Chkcout will operate within a client webpage. The resulting payload will be a JWT signed object that can be used to initate Unified Checkout within a merchnat web page
35
+ # @param generate_unified_checkout_capture_context_request
36
+ # @param [Hash] opts the optional parameters
37
+ # @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers
38
+ def generate_unified_checkout_capture_context_with_http_info(generate_unified_checkout_capture_context_request, opts = {})
39
+
40
+ if @api_client.config.debugging
41
+ begin
42
+ raise
43
+ @api_client.config.logger.debug 'Calling API: UnifiedCheckoutCaptureContextApi.generate_unified_checkout_capture_context ...'
44
+ rescue
45
+ puts 'Cannot write to log'
46
+ end
47
+ end
48
+ # verify the required parameter 'generate_unified_checkout_capture_context_request' is set
49
+ if @api_client.config.client_side_validation && generate_unified_checkout_capture_context_request.nil?
50
+ fail ArgumentError, "Missing the required parameter 'generate_unified_checkout_capture_context_request' when calling UnifiedCheckoutCaptureContextApi.generate_unified_checkout_capture_context"
51
+ end
52
+ # resource path
53
+ local_var_path = 'up/v1/capture-contexts'
54
+
55
+ # query parameters
56
+ query_params = {}
57
+
58
+ # header parameters
59
+ header_params = {}
60
+ # HTTP header 'Accept' (if needed)
61
+ header_params['Accept'] = @api_client.select_header_accept(['application/jwt'])
62
+ # HTTP header 'Content-Type'
63
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json;charset=utf-8'])
64
+
65
+ # form parameters
66
+ form_params = {}
67
+
68
+ # http body (model)
69
+ post_body = @api_client.object_to_http_body(generate_unified_checkout_capture_context_request)
70
+ auth_names = []
71
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path,
72
+ :header_params => header_params,
73
+ :query_params => query_params,
74
+ :form_params => form_params,
75
+ :body => post_body,
76
+ :auth_names => auth_names)
77
+ if @api_client.config.debugging
78
+ begin
79
+ raise
80
+ @api_client.config.logger.debug "API called: UnifiedCheckoutCaptureContextApi#generate_unified_checkout_capture_context\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
81
+ rescue
82
+ puts 'Cannot write to log'
83
+ end
84
+ end
85
+ return data, status_code, headers
86
+ end
87
+ end
88
+ end
@@ -0,0 +1,216 @@
1
+ =begin
2
+ #CyberSource Merged Spec
3
+
4
+ #All CyberSource API specs merged together. These are available at https://developer.cybersource.com/api/reference/api-reference.html
5
+
6
+ OpenAPI spec version: 0.0.1
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.2.3
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module CyberSource
16
+ class Body
17
+ # Identifies the service requesting parsing
18
+ attr_accessor :requestor
19
+
20
+ # Number of tags to parse for each EMV tag string provided.
21
+ attr_accessor :parsed_tag_limit
22
+
23
+ # An array of objects, each containing a requestId and the corresponding emvRequestCombinedTags
24
+ attr_accessor :emv_details_list
25
+
26
+ # Attribute mapping from ruby-style variable name to JSON key.
27
+ def self.attribute_map
28
+ {
29
+ :'requestor' => :'requestor',
30
+ :'parsed_tag_limit' => :'parsedTagLimit',
31
+ :'emv_details_list' => :'emvDetailsList'
32
+ }
33
+ end
34
+
35
+ # Attribute type mapping.
36
+ def self.swagger_types
37
+ {
38
+ :'requestor' => :'String',
39
+ :'parsed_tag_limit' => :'Integer',
40
+ :'emv_details_list' => :'Array<Tssv2transactionsemvTagDetailsEmvDetailsList>'
41
+ }
42
+ end
43
+
44
+ # Initializes the object
45
+ # @param [Hash] attributes Model attributes in the form of hash
46
+ def initialize(attributes = {})
47
+ return unless attributes.is_a?(Hash)
48
+
49
+ # convert string to symbol for hash key
50
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
51
+
52
+ if attributes.has_key?(:'requestor')
53
+ self.requestor = attributes[:'requestor']
54
+ end
55
+
56
+ if attributes.has_key?(:'parsedTagLimit')
57
+ self.parsed_tag_limit = attributes[:'parsedTagLimit']
58
+ end
59
+
60
+ if attributes.has_key?(:'emvDetailsList')
61
+ if (value = attributes[:'emvDetailsList']).is_a?(Array)
62
+ self.emv_details_list = value
63
+ end
64
+ end
65
+ end
66
+
67
+ # Show invalid properties with the reasons. Usually used together with valid?
68
+ # @return Array for valid properties with the reasons
69
+ def list_invalid_properties
70
+ invalid_properties = Array.new
71
+ if @requestor.nil?
72
+ invalid_properties.push('invalid value for "requestor", requestor cannot be nil.')
73
+ end
74
+
75
+ if @emv_details_list.nil?
76
+ invalid_properties.push('invalid value for "emv_details_list", emv_details_list cannot be nil.')
77
+ end
78
+
79
+ invalid_properties
80
+ end
81
+
82
+ # Check to see if the all the properties in the model are valid
83
+ # @return true if the model is valid
84
+ def valid?
85
+ return false if @requestor.nil?
86
+ return false if @emv_details_list.nil?
87
+ true
88
+ end
89
+
90
+ # Checks equality by comparing each attribute.
91
+ # @param [Object] Object to be compared
92
+ def ==(o)
93
+ return true if self.equal?(o)
94
+ self.class == o.class &&
95
+ requestor == o.requestor &&
96
+ parsed_tag_limit == o.parsed_tag_limit &&
97
+ emv_details_list == o.emv_details_list
98
+ end
99
+
100
+ # @see the `==` method
101
+ # @param [Object] Object to be compared
102
+ def eql?(o)
103
+ self == o
104
+ end
105
+
106
+ # Calculates hash code according to all attributes.
107
+ # @return [Fixnum] Hash code
108
+ def hash
109
+ [requestor, parsed_tag_limit, emv_details_list].hash
110
+ end
111
+
112
+ # Builds the object from hash
113
+ # @param [Hash] attributes Model attributes in the form of hash
114
+ # @return [Object] Returns the model itself
115
+ def build_from_hash(attributes)
116
+ return nil unless attributes.is_a?(Hash)
117
+ self.class.swagger_types.each_pair do |key, type|
118
+ if type =~ /\AArray<(.*)>/i
119
+ # check to ensure the input is an array given that the the attribute
120
+ # is documented as an array but the input is not
121
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
122
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
123
+ end
124
+ elsif !attributes[self.class.attribute_map[key]].nil?
125
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
126
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
127
+ end
128
+
129
+ self
130
+ end
131
+
132
+ # Deserializes the data based on type
133
+ # @param string type Data type
134
+ # @param string value Value to be deserialized
135
+ # @return [Object] Deserialized data
136
+ def _deserialize(type, value)
137
+ case type.to_sym
138
+ when :DateTime
139
+ DateTime.parse(value)
140
+ when :Date
141
+ Date.parse(value)
142
+ when :String
143
+ value.to_s
144
+ when :Integer
145
+ value.to_i
146
+ when :Float
147
+ value.to_f
148
+ when :BOOLEAN
149
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
150
+ true
151
+ else
152
+ false
153
+ end
154
+ when :Object
155
+ # generic object (usually a Hash), return directly
156
+ value
157
+ when /\AArray<(?<inner_type>.+)>\z/
158
+ inner_type = Regexp.last_match[:inner_type]
159
+ value.map { |v| _deserialize(inner_type, v) }
160
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
161
+ k_type = Regexp.last_match[:k_type]
162
+ v_type = Regexp.last_match[:v_type]
163
+ {}.tap do |hash|
164
+ value.each do |k, v|
165
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
166
+ end
167
+ end
168
+ else # model
169
+ temp_model = CyberSource.const_get(type).new
170
+ temp_model.build_from_hash(value)
171
+ end
172
+ end
173
+
174
+ # Returns the string representation of the object
175
+ # @return [String] String presentation of the object
176
+ def to_s
177
+ to_hash.to_s
178
+ end
179
+
180
+ # to_body is an alias to to_hash (backward compatibility)
181
+ # @return [Hash] Returns the object in the form of hash
182
+ def to_body
183
+ to_hash
184
+ end
185
+
186
+ # Returns the object in the form of hash
187
+ # @return [Hash] Returns the object in the form of hash
188
+ def to_hash
189
+ hash = {}
190
+ self.class.attribute_map.each_pair do |attr, param|
191
+ value = self.send(attr)
192
+ next if value.nil?
193
+ hash[param] = _to_hash(value)
194
+ end
195
+ hash
196
+ end
197
+
198
+ # Outputs non-array value in the form of hash
199
+ # For object, use to_hash. Otherwise, just return the value
200
+ # @param [Object] value Any valid value
201
+ # @return [Hash] Returns the value in the form of hash
202
+ def _to_hash(value)
203
+ if value.is_a?(Array)
204
+ value.compact.map { |v| _to_hash(v) }
205
+ elsif value.is_a?(Hash)
206
+ {}.tap do |hash|
207
+ value.each { |k, v| hash[k] = _to_hash(v) }
208
+ end
209
+ elsif value.respond_to? :to_hash
210
+ value.to_hash
211
+ else
212
+ value
213
+ end
214
+ end
215
+ end
216
+ end