cybersource_rest_client 0.0.25 → 0.0.26

Sign up to get free protection for your applications and to get access to all the features.
Files changed (41) hide show
  1. checksums.yaml +4 -4
  2. data/lib/cybersource_rest_client.rb +2 -0
  3. data/lib/cybersource_rest_client/api/customer_payment_instrument_api.rb +2 -0
  4. data/lib/cybersource_rest_client/api/customer_shipping_address_api.rb +2 -0
  5. data/lib/cybersource_rest_client/api/payment_instrument_api.rb +2 -0
  6. data/lib/cybersource_rest_client/models/invoice_settings_request.rb +1 -1
  7. data/lib/cybersource_rest_client/models/invoicing_v2_invoice_settings_get200_response_invoice_settings_information.rb +29 -4
  8. data/lib/cybersource_rest_client/models/invoicingv2invoice_settings_invoice_settings_information.rb +343 -0
  9. data/lib/cybersource_rest_client/models/patch_customer_payment_instrument_request.rb +11 -1
  10. data/lib/cybersource_rest_client/models/patch_customer_shipping_address_request.rb +11 -1
  11. data/lib/cybersource_rest_client/models/patch_payment_instrument_request.rb +11 -1
  12. data/lib/cybersource_rest_client/models/post_customer_payment_instrument_request.rb +11 -1
  13. data/lib/cybersource_rest_client/models/post_customer_shipping_address_request.rb +11 -1
  14. data/lib/cybersource_rest_client/models/post_payment_instrument_request.rb +11 -1
  15. data/lib/cybersource_rest_client/models/pts_v2_payments_post201_response_consumer_authentication_information.rb +1 -16
  16. data/lib/cybersource_rest_client/models/pts_v2_payments_post201_response_payment_information.rb +129 -4
  17. data/lib/cybersource_rest_client/models/pts_v2_payments_post201_response_risk_information_velocity_morphing.rb +1 -1
  18. data/lib/cybersource_rest_client/models/ptsv2credits_processing_information.rb +1 -1
  19. data/lib/cybersource_rest_client/models/ptsv2payments_device_information.rb +5 -5
  20. data/lib/cybersource_rest_client/models/ptsv2payments_order_information_amount_details.rb +1 -1
  21. data/lib/cybersource_rest_client/models/ptsv2payments_processing_information.rb +1 -1
  22. data/lib/cybersource_rest_client/models/ptsv2paymentsidcaptures_device_information.rb +5 -5
  23. data/lib/cybersource_rest_client/models/ptsv2paymentsidcaptures_order_information_amount_details.rb +1 -1
  24. data/lib/cybersource_rest_client/models/risk_v1_authentication_results_post201_response_consumer_authentication_information.rb +1 -16
  25. data/lib/cybersource_rest_client/models/risk_v1_authentication_setups_post201_response_consumer_authentication_information.rb +1 -16
  26. data/lib/cybersource_rest_client/models/risk_v1_decisions_post201_response_consumer_authentication_information.rb +2 -32
  27. data/lib/cybersource_rest_client/models/riskv1authenticationresults_consumer_authentication_information.rb +1 -16
  28. data/lib/cybersource_rest_client/models/riskv1authentications_device_information.rb +5 -5
  29. data/lib/cybersource_rest_client/models/riskv1decisions_device_information.rb +5 -5
  30. data/lib/cybersource_rest_client/models/riskv1exportcomplianceinquiries_device_information.rb +5 -5
  31. data/lib/cybersource_rest_client/models/riskv1liststypeentries_device_information.rb +5 -5
  32. data/lib/cybersource_rest_client/models/tmsv2customers__embedded_default_payment_instrument.rb +11 -1
  33. data/lib/cybersource_rest_client/models/tmsv2customers__embedded_default_payment_instrument_bank_account.rb +7 -7
  34. data/lib/cybersource_rest_client/models/tmsv2customers__embedded_default_shipping_address.rb +11 -1
  35. data/lib/cybersource_rest_client/models/tss_v2_transactions_get200_response_device_information.rb +5 -5
  36. data/lib/cybersource_rest_client/models/tss_v2_transactions_get200_response_processing_information.rb +1 -1
  37. data/lib/cybersource_rest_client/models/tss_v2_transactions_get200_response_processor_information.rb +13 -1
  38. data/lib/cybersource_rest_client/models/tss_v2_transactions_get200_response_processor_information_multi_processor_routing.rb +244 -0
  39. data/lib/cybersource_rest_client/models/tss_v2_transactions_post201_response__embedded_device_information.rb +5 -5
  40. data/lib/cybersource_rest_client/models/tss_v2_transactions_post201_response__embedded_processing_information.rb +1 -1
  41. metadata +8 -6
@@ -22,6 +22,9 @@ module CyberSource
22
22
  # The type of token. Valid values: - paymentInstrument
23
23
  attr_accessor :object
24
24
 
25
+ # Flag that indicates whether customer payment instrument is the dafault. Valid values: - `true`: Payment instrument is customer's default. - `false`: Payment instrument is not customer's default.
26
+ attr_accessor :default
27
+
25
28
  # Issuers state for the card number. Valid values: - ACTIVE - CLOSED : The account has been closed.
26
29
  attr_accessor :state
27
30
 
@@ -49,6 +52,7 @@ module CyberSource
49
52
  :'_links' => :'_links',
50
53
  :'id' => :'id',
51
54
  :'object' => :'object',
55
+ :'default' => :'default',
52
56
  :'state' => :'state',
53
57
  :'bank_account' => :'bankAccount',
54
58
  :'card' => :'card',
@@ -68,6 +72,7 @@ module CyberSource
68
72
  :'_links' => :'Tmsv2customersEmbeddedDefaultPaymentInstrumentLinks',
69
73
  :'id' => :'String',
70
74
  :'object' => :'String',
75
+ :'default' => :'BOOLEAN',
71
76
  :'state' => :'String',
72
77
  :'bank_account' => :'Tmsv2customersEmbeddedDefaultPaymentInstrumentBankAccount',
73
78
  :'card' => :'Tmsv2customersEmbeddedDefaultPaymentInstrumentCard',
@@ -101,6 +106,10 @@ module CyberSource
101
106
  self.object = attributes[:'object']
102
107
  end
103
108
 
109
+ if attributes.has_key?(:'default')
110
+ self.default = attributes[:'default']
111
+ end
112
+
104
113
  if attributes.has_key?(:'state')
105
114
  self.state = attributes[:'state']
106
115
  end
@@ -187,6 +196,7 @@ module CyberSource
187
196
  _links == o._links &&
188
197
  id == o.id &&
189
198
  object == o.object &&
199
+ default == o.default &&
190
200
  state == o.state &&
191
201
  bank_account == o.bank_account &&
192
202
  card == o.card &&
@@ -208,7 +218,7 @@ module CyberSource
208
218
  # Calculates hash code according to all attributes.
209
219
  # @return [Fixnum] Hash code
210
220
  def hash
211
- [_links, id, object, state, bank_account, card, buyer_information, bill_to, processing_information, merchant_information, instrument_identifier, metadata, _embedded].hash
221
+ [_links, id, object, default, state, bank_account, card, buyer_information, bill_to, processing_information, merchant_information, instrument_identifier, metadata, _embedded].hash
212
222
  end
213
223
 
214
224
  # Builds the object from hash
@@ -48,9 +48,9 @@ module CyberSource
48
48
  # @return Array for valid properties with the reasons
49
49
  def list_invalid_properties
50
50
  invalid_properties = Array.new
51
- # if !@type.nil? && @type.to_s.length > 1
52
- # invalid_properties.push('invalid value for "type", the character length must be smaller than or equal to 1.')
53
- # end
51
+ if !@type.nil? && @type.to_s.length > 18
52
+ invalid_properties.push('invalid value for "type", the character length must be smaller than or equal to 18.')
53
+ end
54
54
 
55
55
  invalid_properties
56
56
  end
@@ -58,16 +58,16 @@ module CyberSource
58
58
  # Check to see if the all the properties in the model are valid
59
59
  # @return true if the model is valid
60
60
  def valid?
61
- # return false if !@type.nil? && @type.to_s.length > 1
61
+ return false if !@type.nil? && @type.to_s.length > 18
62
62
  true
63
63
  end
64
64
 
65
65
  # Custom attribute writer method with validation
66
66
  # @param [Object] type Value to be assigned
67
67
  def type=(type)
68
- # if !type.nil? && type.to_s.length > 1
69
- # fail ArgumentError, 'invalid value for "type", the character length must be smaller than or equal to 1.'
70
- # end
68
+ if !type.nil? && type.to_s.length > 18
69
+ fail ArgumentError, 'invalid value for "type", the character length must be smaller than or equal to 18.'
70
+ end
71
71
 
72
72
  @type = type
73
73
  end
@@ -19,6 +19,9 @@ module CyberSource
19
19
  # The id of the Shipping Address Token.
20
20
  attr_accessor :id
21
21
 
22
+ # Flag that indicates whether customer shipping address is the dafault. Valid values: - `true`: Shipping Address is customer's default. - `false`: Shipping Address is not customer's default.
23
+ attr_accessor :default
24
+
22
25
  attr_accessor :ship_to
23
26
 
24
27
  attr_accessor :metadata
@@ -28,6 +31,7 @@ module CyberSource
28
31
  {
29
32
  :'_links' => :'_links',
30
33
  :'id' => :'id',
34
+ :'default' => :'default',
31
35
  :'ship_to' => :'shipTo',
32
36
  :'metadata' => :'metadata'
33
37
  }
@@ -38,6 +42,7 @@ module CyberSource
38
42
  {
39
43
  :'_links' => :'Tmsv2customersEmbeddedDefaultShippingAddressLinks',
40
44
  :'id' => :'String',
45
+ :'default' => :'BOOLEAN',
41
46
  :'ship_to' => :'Tmsv2customersEmbeddedDefaultShippingAddressShipTo',
42
47
  :'metadata' => :'Tmsv2customersEmbeddedDefaultShippingAddressMetadata'
43
48
  }
@@ -59,6 +64,10 @@ module CyberSource
59
64
  self.id = attributes[:'id']
60
65
  end
61
66
 
67
+ if attributes.has_key?(:'default')
68
+ self.default = attributes[:'default']
69
+ end
70
+
62
71
  if attributes.has_key?(:'shipTo')
63
72
  self.ship_to = attributes[:'shipTo']
64
73
  end
@@ -112,6 +121,7 @@ module CyberSource
112
121
  self.class == o.class &&
113
122
  _links == o._links &&
114
123
  id == o.id &&
124
+ default == o.default &&
115
125
  ship_to == o.ship_to &&
116
126
  metadata == o.metadata
117
127
  end
@@ -125,7 +135,7 @@ module CyberSource
125
135
  # Calculates hash code according to all attributes.
126
136
  # @return [Fixnum] Hash code
127
137
  def hash
128
- [_links, id, ship_to, metadata].hash
138
+ [_links, id, default, ship_to, metadata].hash
129
139
  end
130
140
 
131
141
  # Builds the object from hash
@@ -66,8 +66,8 @@ module CyberSource
66
66
  # @return Array for valid properties with the reasons
67
67
  def list_invalid_properties
68
68
  invalid_properties = Array.new
69
- if !@ip_address.nil? && @ip_address.to_s.length > 48
70
- invalid_properties.push('invalid value for "ip_address", the character length must be smaller than or equal to 48.')
69
+ if !@ip_address.nil? && @ip_address.to_s.length > 45
70
+ invalid_properties.push('invalid value for "ip_address", the character length must be smaller than or equal to 45.')
71
71
  end
72
72
 
73
73
  if !@host_name.nil? && @host_name.to_s.length > 60
@@ -80,7 +80,7 @@ module CyberSource
80
80
  # Check to see if the all the properties in the model are valid
81
81
  # @return true if the model is valid
82
82
  def valid?
83
- return false if !@ip_address.nil? && @ip_address.to_s.length > 48
83
+ return false if !@ip_address.nil? && @ip_address.to_s.length > 45
84
84
  return false if !@host_name.nil? && @host_name.to_s.length > 60
85
85
  true
86
86
  end
@@ -88,8 +88,8 @@ module CyberSource
88
88
  # Custom attribute writer method with validation
89
89
  # @param [Object] ip_address Value to be assigned
90
90
  def ip_address=(ip_address)
91
- if !ip_address.nil? && ip_address.to_s.length > 48
92
- fail ArgumentError, 'invalid value for "ip_address", the character length must be smaller than or equal to 48.'
91
+ if !ip_address.nil? && ip_address.to_s.length > 45
92
+ fail ArgumentError, 'invalid value for "ip_address", the character length must be smaller than or equal to 45.'
93
93
  end
94
94
 
95
95
  @ip_address = ip_address
@@ -17,7 +17,7 @@ module CyberSource
17
17
  # Type of digital payment solution for the transaction. Possible Values: - `visacheckout`: Visa Checkout. This value is required for Visa Checkout transactions. For details, see `payment_solution` field description in [Visa Checkout Using the SCMP API.](https://apps.cybersource.com/library/documentation/dev_guides/VCO_SCMP_API/html/) - `001`: Apple Pay. - `004`: Cybersource In-App Solution. - `005`: Masterpass. This value is required for Masterpass transactions on OmniPay Direct. For details, see \"Masterpass\" in the [Credit Card Services Using the SCMP API Guide.](https://apps.cybersource.com/library/documentation/dev_guides/CC_Svcs_SCMP_API/html/) - `006`: Android Pay. - `007`: Chase Pay. - `008`: Samsung Pay. - `012`: Google Pay.
18
18
  attr_accessor :payment_solution
19
19
 
20
- # Type of transaction. Some payment card companies use this information when determining discount rates. #### Used by **Authorization** Required payer authentication transactions; otherwise, optional. **Credit** Required for standalone credits on Chase Paymentech solutions; otherwise, optional. Only `internet`, `moto`, `install`, `recurring`, and `recurring_internet` are valid values. #### Ingenico ePayments When you omit this field for Ingenico ePayments, the processor uses the default transaction type they have on file for you instead of the default value (listed in Appendix I, \"Commerce Indicators,\" on page 441.) #### Payer Authentication Transactions For the possible values and requirements, see \"Payer Authentication,\" page 195. #### Other Types of Transactions See Appendix I, \"Commerce Indicators,\" on page 441. #### Card Present You must set this field to `retail`. This field is required for a card-present transaction.
20
+ # Type of transaction. Some payment card companies use this information when determining discount rates. #### Used by **Authorization** Required payer authentication transactions; otherwise, optional. **Credit** Required for standalone credits on Chase Paymentech solutions; otherwise, optional. Only `internet`, `moto`, `install`, `recurring`, and `recurring_internet` are valid values. #### Ingenico ePayments When you omit this field for Ingenico ePayments, the processor uses the default transaction type they have on file for you instead of the default value (listed in Appendix I, \"Commerce Indicators,\" on page 441.) #### Payer Authentication Transactions For the possible values and requirements, see \"Payer Authentication,\" page 195. #### Other Types of Transactions See Appendix I, \"Commerce Indicators,\" on page 441. #### Card Present You must set this field to `retail`. This field is required for a card-present transaction. Note that this should ONLY be used when the cardholder and card are present at the time of the transaction. For all keyed transactions originated from a POS terminal where the cardholder and card are not present, commerceIndicator should be submitted as “moto\"
21
21
  attr_accessor :commerce_indicator
22
22
 
23
23
  # Payouts transaction type. Required for OCT transactions. This field is a pass-through, which means that CyberSource does not verify the value or modify it in any way before sending it to the processor. **Note** When the request includes this field, this value overrides the information in your CyberSource account. For valid values, see the `invoiceHeader_businessApplicationID` field description in [Payouts Using the Simple Order API.](http://apps.cybersource.com/library/documentation/dev_guides/payouts_SO/Payouts_SO_API.pdf)
@@ -16,6 +16,9 @@ module CyberSource
16
16
  class TssV2TransactionsGet200ResponseProcessorInformation
17
17
  attr_accessor :processor
18
18
 
19
+ # An array of object that contains the list of acquirer response codes & reasons if a transaction is routed to multiple acquirers.
20
+ attr_accessor :multi_processor_routing
21
+
19
22
  # Network transaction identifier (TID). You can use this value to identify a specific transaction when you are discussing the transaction with your processor. Not all processors provide this value. Returned by the authorization service. #### PIN debit Transaction identifier generated by the processor. Returned by PIN debit credit. #### GPX Processor transaction ID. #### Cielo For Cielo, this value is the non-sequential unit (NSU) and is supported for all transactions. The value is generated by Cielo or the issuing bank. #### Comercio Latino For Comercio Latino, this value is the proof of sale or non-sequential unit (NSU) number generated by the acquirers Cielo and Rede, or the issuing bank. #### CyberSource through VisaNet and GPN For details about this value for CyberSource through VisaNet and GPN, see \"Network Transaction Identifiers\" in [Credit Card Services Using the SCMP API.](https://apps.cybersource.com/library/documentation/dev_guides/CC_Svcs_SCMP_API/html/) #### Moneris This value identifies the transaction on a host system. It contains the following information: - Terminal used to process the transaction - Shift during which the transaction took place - Batch number - Transaction number within the batch You must store this value. If you give the customer a receipt, display this value on the receipt. **Example** For the value 66012345001069003: - Terminal ID = 66012345 - Shift number = 001 - Batch number = 069 - Transaction number = 003
20
23
  attr_accessor :transaction_id
21
24
 
@@ -52,6 +55,7 @@ module CyberSource
52
55
  def self.attribute_map
53
56
  {
54
57
  :'processor' => :'processor',
58
+ :'multi_processor_routing' => :'multiProcessorRouting',
55
59
  :'transaction_id' => :'transactionId',
56
60
  :'network_transaction_id' => :'networkTransactionId',
57
61
  :'response_id' => :'responseId',
@@ -71,6 +75,7 @@ module CyberSource
71
75
  def self.swagger_types
72
76
  {
73
77
  :'processor' => :'TssV2TransactionsGet200ResponseProcessorInformationProcessor',
78
+ :'multi_processor_routing' => :'Array<TssV2TransactionsGet200ResponseProcessorInformationMultiProcessorRouting>',
74
79
  :'transaction_id' => :'String',
75
80
  :'network_transaction_id' => :'String',
76
81
  :'response_id' => :'String',
@@ -98,6 +103,12 @@ module CyberSource
98
103
  self.processor = attributes[:'processor']
99
104
  end
100
105
 
106
+ if attributes.has_key?(:'multiProcessorRouting')
107
+ if (value = attributes[:'multiProcessorRouting']).is_a?(Array)
108
+ self.multi_processor_routing = value
109
+ end
110
+ end
111
+
101
112
  if attributes.has_key?(:'transactionId')
102
113
  self.transaction_id = attributes[:'transactionId']
103
114
  end
@@ -226,6 +237,7 @@ module CyberSource
226
237
  return true if self.equal?(o)
227
238
  self.class == o.class &&
228
239
  processor == o.processor &&
240
+ multi_processor_routing == o.multi_processor_routing &&
229
241
  transaction_id == o.transaction_id &&
230
242
  network_transaction_id == o.network_transaction_id &&
231
243
  response_id == o.response_id &&
@@ -249,7 +261,7 @@ module CyberSource
249
261
  # Calculates hash code according to all attributes.
250
262
  # @return [Fixnum] Hash code
251
263
  def hash
252
- [processor, transaction_id, network_transaction_id, response_id, provider_transaction_id, approval_code, response_code, avs, card_verification, ach_verification, electronic_verification_results, system_trace_audit_number, response_code_source].hash
264
+ [processor, multi_processor_routing, transaction_id, network_transaction_id, response_id, provider_transaction_id, approval_code, response_code, avs, card_verification, ach_verification, electronic_verification_results, system_trace_audit_number, response_code_source].hash
253
265
  end
254
266
 
255
267
  # Builds the object from hash
@@ -0,0 +1,244 @@
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 TssV2TransactionsGet200ResponseProcessorInformationMultiProcessorRouting
17
+ # Name of the Processor.
18
+ attr_accessor :name
19
+
20
+ # For most processors, this is the error message sent directly from the bank. Returned only when the processor returns this value. **Important** Do not use this field to evaluate the result of the authorization. #### PIN debit Response value that is returned by the processor or bank. **Important** Do not use this field to evaluate the results of the transaction request. Returned by PIN debit credit, PIN debit purchase, and PIN debit reversal. #### AIBMS If this value is `08`, you can accept the transaction if the customer provides you with identification. #### Atos This value is the response code sent from Atos and it might also include the response code from the bank. Format: `aa,bb` with the two values separated by a comma and where: - `aa` is the two-digit error message from Atos. - `bb` is the optional two-digit error message from the bank. #### Comercio Latino This value is the status code and the error or response code received from the processor separated by a colon. Format: [status code]:E[error code] or [status code]:R[response code] Example `2:R06` #### JCN Gateway Processor-defined detail error code. The associated response category code is in the `processorInformation.responseCategoryCode` field. String (3)
21
+ attr_accessor :response_code
22
+
23
+ # Indicates the reason why a request succeeded or failed and possible action to take if a request fails. For details, see the appendix of reason codes in the documentation for the relevant payment method.
24
+ attr_accessor :reason_code
25
+
26
+ # The order in which the transaction was routed to the processor
27
+ attr_accessor :sequence
28
+
29
+ # Attribute mapping from ruby-style variable name to JSON key.
30
+ def self.attribute_map
31
+ {
32
+ :'name' => :'name',
33
+ :'response_code' => :'responseCode',
34
+ :'reason_code' => :'reasonCode',
35
+ :'sequence' => :'sequence'
36
+ }
37
+ end
38
+
39
+ # Attribute type mapping.
40
+ def self.swagger_types
41
+ {
42
+ :'name' => :'String',
43
+ :'response_code' => :'String',
44
+ :'reason_code' => :'String',
45
+ :'sequence' => :'String'
46
+ }
47
+ end
48
+
49
+ # Initializes the object
50
+ # @param [Hash] attributes Model attributes in the form of hash
51
+ def initialize(attributes = {})
52
+ return unless attributes.is_a?(Hash)
53
+
54
+ # convert string to symbol for hash key
55
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
56
+
57
+ if attributes.has_key?(:'name')
58
+ self.name = attributes[:'name']
59
+ end
60
+
61
+ if attributes.has_key?(:'responseCode')
62
+ self.response_code = attributes[:'responseCode']
63
+ end
64
+
65
+ if attributes.has_key?(:'reasonCode')
66
+ self.reason_code = attributes[:'reasonCode']
67
+ end
68
+
69
+ if attributes.has_key?(:'sequence')
70
+ self.sequence = attributes[:'sequence']
71
+ end
72
+ end
73
+
74
+ # Show invalid properties with the reasons. Usually used together with valid?
75
+ # @return Array for valid properties with the reasons
76
+ def list_invalid_properties
77
+ invalid_properties = Array.new
78
+ if !@name.nil? && @name.to_s.length > 30
79
+ invalid_properties.push('invalid value for "name", the character length must be smaller than or equal to 30.')
80
+ end
81
+
82
+ if !@response_code.nil? && @response_code.to_s.length > 10
83
+ invalid_properties.push('invalid value for "response_code", the character length must be smaller than or equal to 10.')
84
+ end
85
+
86
+ invalid_properties
87
+ end
88
+
89
+ # Check to see if the all the properties in the model are valid
90
+ # @return true if the model is valid
91
+ def valid?
92
+ return false if !@name.nil? && @name.to_s.length > 30
93
+ return false if !@response_code.nil? && @response_code.to_s.length > 10
94
+ true
95
+ end
96
+
97
+ # Custom attribute writer method with validation
98
+ # @param [Object] name Value to be assigned
99
+ def name=(name)
100
+ if !name.nil? && name.to_s.length > 30
101
+ fail ArgumentError, 'invalid value for "name", the character length must be smaller than or equal to 30.'
102
+ end
103
+
104
+ @name = name
105
+ end
106
+
107
+ # Custom attribute writer method with validation
108
+ # @param [Object] response_code Value to be assigned
109
+ def response_code=(response_code)
110
+ if !response_code.nil? && response_code.to_s.length > 10
111
+ fail ArgumentError, 'invalid value for "response_code", the character length must be smaller than or equal to 10.'
112
+ end
113
+
114
+ @response_code = response_code
115
+ end
116
+
117
+ # Checks equality by comparing each attribute.
118
+ # @param [Object] Object to be compared
119
+ def ==(o)
120
+ return true if self.equal?(o)
121
+ self.class == o.class &&
122
+ name == o.name &&
123
+ response_code == o.response_code &&
124
+ reason_code == o.reason_code &&
125
+ sequence == o.sequence
126
+ end
127
+
128
+ # @see the `==` method
129
+ # @param [Object] Object to be compared
130
+ def eql?(o)
131
+ self == o
132
+ end
133
+
134
+ # Calculates hash code according to all attributes.
135
+ # @return [Fixnum] Hash code
136
+ def hash
137
+ [name, response_code, reason_code, sequence].hash
138
+ end
139
+
140
+ # Builds the object from hash
141
+ # @param [Hash] attributes Model attributes in the form of hash
142
+ # @return [Object] Returns the model itself
143
+ def build_from_hash(attributes)
144
+ return nil unless attributes.is_a?(Hash)
145
+ self.class.swagger_types.each_pair do |key, type|
146
+ if type =~ /\AArray<(.*)>/i
147
+ # check to ensure the input is an array given that the the attribute
148
+ # is documented as an array but the input is not
149
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
150
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
151
+ end
152
+ elsif !attributes[self.class.attribute_map[key]].nil?
153
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
154
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
155
+ end
156
+
157
+ self
158
+ end
159
+
160
+ # Deserializes the data based on type
161
+ # @param string type Data type
162
+ # @param string value Value to be deserialized
163
+ # @return [Object] Deserialized data
164
+ def _deserialize(type, value)
165
+ case type.to_sym
166
+ when :DateTime
167
+ DateTime.parse(value)
168
+ when :Date
169
+ Date.parse(value)
170
+ when :String
171
+ value.to_s
172
+ when :Integer
173
+ value.to_i
174
+ when :Float
175
+ value.to_f
176
+ when :BOOLEAN
177
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
178
+ true
179
+ else
180
+ false
181
+ end
182
+ when :Object
183
+ # generic object (usually a Hash), return directly
184
+ value
185
+ when /\AArray<(?<inner_type>.+)>\z/
186
+ inner_type = Regexp.last_match[:inner_type]
187
+ value.map { |v| _deserialize(inner_type, v) }
188
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
189
+ k_type = Regexp.last_match[:k_type]
190
+ v_type = Regexp.last_match[:v_type]
191
+ {}.tap do |hash|
192
+ value.each do |k, v|
193
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
194
+ end
195
+ end
196
+ else # model
197
+ temp_model = CyberSource.const_get(type).new
198
+ temp_model.build_from_hash(value)
199
+ end
200
+ end
201
+
202
+ # Returns the string representation of the object
203
+ # @return [String] String presentation of the object
204
+ def to_s
205
+ to_hash.to_s
206
+ end
207
+
208
+ # to_body is an alias to to_hash (backward compatibility)
209
+ # @return [Hash] Returns the object in the form of hash
210
+ def to_body
211
+ to_hash
212
+ end
213
+
214
+ # Returns the object in the form of hash
215
+ # @return [Hash] Returns the object in the form of hash
216
+ def to_hash
217
+ hash = {}
218
+ self.class.attribute_map.each_pair do |attr, param|
219
+ value = self.send(attr)
220
+ next if value.nil?
221
+ hash[param] = _to_hash(value)
222
+ end
223
+ hash
224
+ end
225
+
226
+ # Outputs non-array value in the form of hash
227
+ # For object, use to_hash. Otherwise, just return the value
228
+ # @param [Object] value Any valid value
229
+ # @return [Hash] Returns the value in the form of hash
230
+ def _to_hash(value)
231
+ if value.is_a?(Array)
232
+ value.compact.map { |v| _to_hash(v) }
233
+ elsif value.is_a?(Hash)
234
+ {}.tap do |hash|
235
+ value.each { |k, v| hash[k] = _to_hash(v) }
236
+ end
237
+ elsif value.respond_to? :to_hash
238
+ value.to_hash
239
+ else
240
+ value
241
+ end
242
+ end
243
+ end
244
+ end