cybersource_rest_client 0.0.51 → 0.0.52

Sign up to get free protection for your applications and to get access to all the features.
Files changed (27) hide show
  1. checksums.yaml +4 -4
  2. data/lib/AuthenticationSDK/authentication/jwt/JwtToken.rb +4 -2
  3. data/lib/cybersource_rest_client/models/invoicing_v2_invoice_settings_get200_response_invoice_settings_information.rb +32 -8
  4. data/lib/cybersource_rest_client/models/invoicingv2invoice_settings_invoice_settings_information.rb +32 -4
  5. data/lib/cybersource_rest_client/models/invoicingv2invoices_customer_information.rb +13 -4
  6. data/lib/cybersource_rest_client/models/invoicingv2invoices_customer_information_company.rb +190 -0
  7. data/lib/cybersource_rest_client/models/invoicingv2invoices_order_information_amount_details_freight.rb +20 -4
  8. data/lib/cybersource_rest_client/models/invoicingv2invoices_order_information_line_items.rb +84 -4
  9. data/lib/cybersource_rest_client/models/pts_v2_payments_post201_response_processor_information.rb +17 -1
  10. data/lib/cybersource_rest_client/models/pts_v2_payments_refund_post201_response_processor_information.rb +20 -4
  11. data/lib/cybersource_rest_client/models/pts_v2_payouts_post201_response_recipient_information_card.rb +1 -1
  12. data/lib/cybersource_rest_client/models/ptsv2payments_order_information_amount_details.rb +1 -1
  13. data/lib/cybersource_rest_client/models/ptsv2payments_payment_information_payment_type.rb +11 -1
  14. data/lib/cybersource_rest_client/models/ptsv2payments_processing_information.rb +11 -1
  15. data/lib/cybersource_rest_client/models/ptsv2paymentsidcaptures_order_information_amount_details.rb +1 -1
  16. data/lib/cybersource_rest_client/models/tss_v2_transactions_get200_response.rb +10 -1
  17. data/lib/cybersource_rest_client/models/tss_v2_transactions_get200_response_payment_information.rb +40 -1
  18. data/lib/cybersource_rest_client/models/tss_v2_transactions_get200_response_payment_information_brands.rb +194 -0
  19. data/lib/cybersource_rest_client/models/tss_v2_transactions_get200_response_payment_information_card.rb +27 -1
  20. data/lib/cybersource_rest_client/models/tss_v2_transactions_get200_response_payment_information_features.rb +286 -0
  21. data/lib/cybersource_rest_client/models/tss_v2_transactions_get200_response_payment_information_issuer_information.rb +238 -0
  22. data/lib/cybersource_rest_client/models/tss_v2_transactions_get200_response_payment_information_network.rb +190 -0
  23. data/lib/cybersource_rest_client/models/tss_v2_transactions_get200_response_payout_options.rb +190 -0
  24. data/lib/cybersource_rest_client/models/tss_v2_transactions_get200_response_processing_information.rb +11 -1
  25. data/lib/cybersource_rest_client/models/tss_v2_transactions_get200_response_token_information.rb +24 -4
  26. data/lib/cybersource_rest_client.rb +6 -0
  27. metadata +24 -4
@@ -38,6 +38,12 @@ module CyberSource
38
38
  # Three-digit value that indicates the card type. **IMPORTANT** It is strongly recommended that you include the card type field in request messages even if it is optional for your processor and card type. Omitting the card type can cause the transaction to be processed with the wrong card type. Possible values: - `001`: Visa. For card-present transactions on all processors except SIX, the Visa Electron card type is processed the same way that the Visa debit card is processed. Use card type value `001` for Visa Electron. - `002`: Mastercard, Eurocard[^1], which is a European regional brand of Mastercard. - `003`: American Express - `004`: Discover - `005`: Diners Club - `006`: Carte Blanche[^1] - `007`: JCB[^1] - `014`: Enroute[^1] - `021`: JAL[^1] - `024`: Maestro (UK Domestic)[^1] - `031`: Delta[^1]: Use this value only for Ingenico ePayments. For other processors, use `001` for all Visa card types. - `033`: Visa Electron[^1]. Use this value only for Ingenico ePayments and SIX. For other processors, use `001` for all Visa card types. - `034`: Dankort[^1] - `036`: Cartes Bancaires[^1,4] - `037`: Carta Si[^1] - `039`: Encoded account number[^1] - `040`: UATP[^1] - `042`: Maestro (International)[^1] - `050`: Hipercard[^2,3] - `051`: Aura - `054`: Elo[^3] - `062`: China UnionPay - '070': EFTPOS [^1]: For this card type, you must include the `paymentInformation.card.type` or `paymentInformation.tokenizedCard.type` field in your request for an authorization or a stand-alone credit. [^2]: For this card type on Cielo 3.0, you must include the `paymentInformation.card.type` or `paymentInformation.tokenizedCard.type` field in a request for an authorization or a stand-alone credit. This card type is not supported on Cielo 1.5. [^3]: For this card type on Getnet and Rede, you must include the `paymentInformation.card.type` or `paymentInformation.tokenizedCard.type` field in a request for an authorization or a stand-alone credit. [^4]: For this card type, you must include the `paymentInformation.card.type` in your request for any payer authentication services. #### Used by **Authorization** Required for Carte Blanche and JCB. Optional for all other card types. #### Card Present reply This field is included in the reply message when the client software that is installed on the POS terminal uses the token management service (TMS) to retrieve tokenized payment details. You must contact customer support to have your account enabled to receive these fields in the credit reply message. Returned by the Credit service. This reply field is only supported by the following processors: - American Express Direct - Credit Mutuel-CIC - FDC Nashville Global - OmniPay Direct - SIX #### Google Pay transactions For PAN-based Google Pay transactions, this field is returned in the API response. #### GPX This field only supports transactions from the following card types: - Visa - Mastercard - AMEX - Discover - Diners - JCB - Union Pay International
39
39
  attr_accessor :type
40
40
 
41
+ # This field contains the card brand name. Some of the possible values (not an exhaustive list) are - - VISA - MASTERCARD - AMERICAN EXPRESS - DISCOVER - DINERS CLUB - CARTE BLANCHE - JCB - OPTIMA - TWINPAY CREDIT CARD - TWINPAY DEBIT CARD - WALMART - ENROUTE - LOWES CONSUMER - HOME DEPOT CONSUMER - MBNA - DICKS SPORTWEAR - CASUAL CORNER - SEARS - JAL - DISNEY CARD - SWITCH/SOLO - SAMS CLUB CONSUMER - SAMS CLUB BUSINESS - NICOS HOUSE CARD - BEBE - RESTORATION HARDWARE - DELTA ONLINE - SOLO - VISA ELECTRON - DANKORT - LASER - CARTE BANCAIRE - CARTA SI - ENCODED ACCOUNT - UATP - HOUSEHOLD - MAESTRO - GE CAPITAL - KOREAN CARDS - STYLE CARDS - JCREW - MEIJER - HIPERCARD - AURA - REDECARD - ORICO HOUSE CARD - ELO - CAPITAL ONE PRIVATE LABEL - CARNET - RUPAY - CHINA UNION PAY - FALABELLA PRIVATE LABEL - PROMPTCARD - KOREAN DOMESTIC - BANRICOMPRAS
42
+ attr_accessor :brand_name
43
+
44
+ # This field indicates the 3-letter [ISO Standard Currency Codes](http://apps.cybersource.com/library/documentation/sbc/quickref/currencies.pdf) for the card currency.
45
+ attr_accessor :currency
46
+
41
47
  # Identifier for the issuing bank that provided the customer’s encoded account number. Contact your processor for the bank’s ID.
42
48
  attr_accessor :account_encoder_id
43
49
 
@@ -55,6 +61,8 @@ module CyberSource
55
61
  :'start_year' => :'startYear',
56
62
  :'issue_number' => :'issueNumber',
57
63
  :'type' => :'type',
64
+ :'brand_name' => :'brandName',
65
+ :'currency' => :'currency',
58
66
  :'account_encoder_id' => :'accountEncoderId',
59
67
  :'use_as' => :'useAs'
60
68
  }
@@ -71,6 +79,8 @@ module CyberSource
71
79
  :'start_year' => :'String',
72
80
  :'issue_number' => :'String',
73
81
  :'type' => :'String',
82
+ :'brand_name' => :'String',
83
+ :'currency' => :'String',
74
84
  :'account_encoder_id' => :'String',
75
85
  :'use_as' => :'String'
76
86
  }
@@ -116,6 +126,14 @@ module CyberSource
116
126
  self.type = attributes[:'type']
117
127
  end
118
128
 
129
+ if attributes.has_key?(:'brandName')
130
+ self.brand_name = attributes[:'brandName']
131
+ end
132
+
133
+ if attributes.has_key?(:'currency')
134
+ self.currency = attributes[:'currency']
135
+ end
136
+
119
137
  if attributes.has_key?(:'accountEncoderId')
120
138
  self.account_encoder_id = attributes[:'accountEncoderId']
121
139
  end
@@ -174,6 +192,12 @@ module CyberSource
174
192
  @issue_number = issue_number
175
193
  end
176
194
 
195
+ # Custom attribute writer method with validation
196
+ # @param [Object] currency Value to be assigned
197
+ def currency=(currency)
198
+ @currency = currency
199
+ end
200
+
177
201
  # Custom attribute writer method with validation
178
202
  # @param [Object] account_encoder_id Value to be assigned
179
203
  def account_encoder_id=(account_encoder_id)
@@ -199,6 +223,8 @@ module CyberSource
199
223
  start_year == o.start_year &&
200
224
  issue_number == o.issue_number &&
201
225
  type == o.type &&
226
+ brand_name == o.brand_name &&
227
+ currency == o.currency &&
202
228
  account_encoder_id == o.account_encoder_id &&
203
229
  use_as == o.use_as
204
230
  end
@@ -212,7 +238,7 @@ module CyberSource
212
238
  # Calculates hash code according to all attributes.
213
239
  # @return [Fixnum] Hash code
214
240
  def hash
215
- [suffix, prefix, expiration_month, expiration_year, start_month, start_year, issue_number, type, account_encoder_id, use_as].hash
241
+ [suffix, prefix, expiration_month, expiration_year, start_month, start_year, issue_number, type, brand_name, currency, account_encoder_id, use_as].hash
216
242
  end
217
243
 
218
244
  # Builds the object from hash
@@ -0,0 +1,286 @@
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 TssV2TransactionsGet200ResponsePaymentInformationFeatures
17
+ # This field contains the account funding source. Possible values: - `CREDIT` - `DEBIT` - `PREPAID` - `DEFERRED DEBIT` - `CHARGE`
18
+ attr_accessor :account_funding_source
19
+
20
+ # This field contains the type of prepaid card. Possible values: - `Reloadable` - `Non-reloadable`
21
+ attr_accessor :account_funding_source_sub_type
22
+
23
+ # This field contains the type of issuer product. Example values: - Visa Classic - Visa Signature - Visa Infinite
24
+ attr_accessor :card_product
25
+
26
+ # This field contains the type of BIN based authentication. Possible values: - `S`: Single Message - `D`: Dual Message
27
+ attr_accessor :message_type
28
+
29
+ # This field contains the acceptance level of the PAN. Possible values: - `0` : Normal - `1` : Monitor - `2` : Refuse - `3` : Not Allowed - `4` : Private - `5` : Test
30
+ attr_accessor :acceptance_level
31
+
32
+ # This field contains the type of card platform. Possible values: - `BUSINESS` - `CONSUMER` - `COMMERCIAL` - `GOVERNMENT`
33
+ attr_accessor :card_platform
34
+
35
+ # This field indicates the type of combo card. Possible values: - 0 (Not a combo card) - 1 (Credit and Prepaid Combo card) - 2 (Credit and Debit Combo card)
36
+ attr_accessor :combo_card
37
+
38
+ # Attribute mapping from ruby-style variable name to JSON key.
39
+ def self.attribute_map
40
+ {
41
+ :'account_funding_source' => :'accountFundingSource',
42
+ :'account_funding_source_sub_type' => :'accountFundingSourceSubType',
43
+ :'card_product' => :'cardProduct',
44
+ :'message_type' => :'messageType',
45
+ :'acceptance_level' => :'acceptanceLevel',
46
+ :'card_platform' => :'cardPlatform',
47
+ :'combo_card' => :'comboCard'
48
+ }
49
+ end
50
+
51
+ # Attribute type mapping.
52
+ def self.swagger_types
53
+ {
54
+ :'account_funding_source' => :'String',
55
+ :'account_funding_source_sub_type' => :'String',
56
+ :'card_product' => :'String',
57
+ :'message_type' => :'String',
58
+ :'acceptance_level' => :'String',
59
+ :'card_platform' => :'String',
60
+ :'combo_card' => :'String'
61
+ }
62
+ end
63
+
64
+ # Initializes the object
65
+ # @param [Hash] attributes Model attributes in the form of hash
66
+ def initialize(attributes = {})
67
+ return unless attributes.is_a?(Hash)
68
+
69
+ # convert string to symbol for hash key
70
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
71
+
72
+ if attributes.has_key?(:'accountFundingSource')
73
+ self.account_funding_source = attributes[:'accountFundingSource']
74
+ end
75
+
76
+ if attributes.has_key?(:'accountFundingSourceSubType')
77
+ self.account_funding_source_sub_type = attributes[:'accountFundingSourceSubType']
78
+ end
79
+
80
+ if attributes.has_key?(:'cardProduct')
81
+ self.card_product = attributes[:'cardProduct']
82
+ end
83
+
84
+ if attributes.has_key?(:'messageType')
85
+ self.message_type = attributes[:'messageType']
86
+ end
87
+
88
+ if attributes.has_key?(:'acceptanceLevel')
89
+ self.acceptance_level = attributes[:'acceptanceLevel']
90
+ end
91
+
92
+ if attributes.has_key?(:'cardPlatform')
93
+ self.card_platform = attributes[:'cardPlatform']
94
+ end
95
+
96
+ if attributes.has_key?(:'comboCard')
97
+ self.combo_card = attributes[:'comboCard']
98
+ end
99
+ end
100
+
101
+ # Show invalid properties with the reasons. Usually used together with valid?
102
+ # @return Array for valid properties with the reasons
103
+ def list_invalid_properties
104
+ invalid_properties = Array.new
105
+ invalid_properties
106
+ end
107
+
108
+ # Check to see if the all the properties in the model are valid
109
+ # @return true if the model is valid
110
+ def valid?
111
+ true
112
+ end
113
+
114
+ # Custom attribute writer method with validation
115
+ # @param [Object] account_funding_source Value to be assigned
116
+ def account_funding_source=(account_funding_source)
117
+ @account_funding_source = account_funding_source
118
+ end
119
+
120
+ # Custom attribute writer method with validation
121
+ # @param [Object] account_funding_source_sub_type Value to be assigned
122
+ def account_funding_source_sub_type=(account_funding_source_sub_type)
123
+ @account_funding_source_sub_type = account_funding_source_sub_type
124
+ end
125
+
126
+ # Custom attribute writer method with validation
127
+ # @param [Object] card_product Value to be assigned
128
+ def card_product=(card_product)
129
+ @card_product = card_product
130
+ end
131
+
132
+ # Custom attribute writer method with validation
133
+ # @param [Object] message_type Value to be assigned
134
+ def message_type=(message_type)
135
+ @message_type = message_type
136
+ end
137
+
138
+ # Custom attribute writer method with validation
139
+ # @param [Object] acceptance_level Value to be assigned
140
+ def acceptance_level=(acceptance_level)
141
+ @acceptance_level = acceptance_level
142
+ end
143
+
144
+ # Custom attribute writer method with validation
145
+ # @param [Object] card_platform Value to be assigned
146
+ def card_platform=(card_platform)
147
+ @card_platform = card_platform
148
+ end
149
+
150
+ # Custom attribute writer method with validation
151
+ # @param [Object] combo_card Value to be assigned
152
+ def combo_card=(combo_card)
153
+ @combo_card = combo_card
154
+ end
155
+
156
+ # Checks equality by comparing each attribute.
157
+ # @param [Object] Object to be compared
158
+ def ==(o)
159
+ return true if self.equal?(o)
160
+ self.class == o.class &&
161
+ account_funding_source == o.account_funding_source &&
162
+ account_funding_source_sub_type == o.account_funding_source_sub_type &&
163
+ card_product == o.card_product &&
164
+ message_type == o.message_type &&
165
+ acceptance_level == o.acceptance_level &&
166
+ card_platform == o.card_platform &&
167
+ combo_card == o.combo_card
168
+ end
169
+
170
+ # @see the `==` method
171
+ # @param [Object] Object to be compared
172
+ def eql?(o)
173
+ self == o
174
+ end
175
+
176
+ # Calculates hash code according to all attributes.
177
+ # @return [Fixnum] Hash code
178
+ def hash
179
+ [account_funding_source, account_funding_source_sub_type, card_product, message_type, acceptance_level, card_platform, combo_card].hash
180
+ end
181
+
182
+ # Builds the object from hash
183
+ # @param [Hash] attributes Model attributes in the form of hash
184
+ # @return [Object] Returns the model itself
185
+ def build_from_hash(attributes)
186
+ return nil unless attributes.is_a?(Hash)
187
+ self.class.swagger_types.each_pair do |key, type|
188
+ if type =~ /\AArray<(.*)>/i
189
+ # check to ensure the input is an array given that the the attribute
190
+ # is documented as an array but the input is not
191
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
192
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
193
+ end
194
+ elsif !attributes[self.class.attribute_map[key]].nil?
195
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
196
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
197
+ end
198
+
199
+ self
200
+ end
201
+
202
+ # Deserializes the data based on type
203
+ # @param string type Data type
204
+ # @param string value Value to be deserialized
205
+ # @return [Object] Deserialized data
206
+ def _deserialize(type, value)
207
+ case type.to_sym
208
+ when :DateTime
209
+ DateTime.parse(value)
210
+ when :Date
211
+ Date.parse(value)
212
+ when :String
213
+ value.to_s
214
+ when :Integer
215
+ value.to_i
216
+ when :Float
217
+ value.to_f
218
+ when :BOOLEAN
219
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
220
+ true
221
+ else
222
+ false
223
+ end
224
+ when :Object
225
+ # generic object (usually a Hash), return directly
226
+ value
227
+ when /\AArray<(?<inner_type>.+)>\z/
228
+ inner_type = Regexp.last_match[:inner_type]
229
+ value.map { |v| _deserialize(inner_type, v) }
230
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
231
+ k_type = Regexp.last_match[:k_type]
232
+ v_type = Regexp.last_match[:v_type]
233
+ {}.tap do |hash|
234
+ value.each do |k, v|
235
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
236
+ end
237
+ end
238
+ else # model
239
+ temp_model = CyberSource.const_get(type).new
240
+ temp_model.build_from_hash(value)
241
+ end
242
+ end
243
+
244
+ # Returns the string representation of the object
245
+ # @return [String] String presentation of the object
246
+ def to_s
247
+ to_hash.to_s
248
+ end
249
+
250
+ # to_body is an alias to to_hash (backward compatibility)
251
+ # @return [Hash] Returns the object in the form of hash
252
+ def to_body
253
+ to_hash
254
+ end
255
+
256
+ # Returns the object in the form of hash
257
+ # @return [Hash] Returns the object in the form of hash
258
+ def to_hash
259
+ hash = {}
260
+ self.class.attribute_map.each_pair do |attr, param|
261
+ value = self.send(attr)
262
+ next if value.nil?
263
+ hash[param] = _to_hash(value)
264
+ end
265
+ hash
266
+ end
267
+
268
+ # Outputs non-array value in the form of hash
269
+ # For object, use to_hash. Otherwise, just return the value
270
+ # @param [Object] value Any valid value
271
+ # @return [Hash] Returns the value in the form of hash
272
+ def _to_hash(value)
273
+ if value.is_a?(Array)
274
+ value.compact.map { |v| _to_hash(v) }
275
+ elsif value.is_a?(Hash)
276
+ {}.tap do |hash|
277
+ value.each { |k, v| hash[k] = _to_hash(v) }
278
+ end
279
+ elsif value.respond_to? :to_hash
280
+ value.to_hash
281
+ else
282
+ value
283
+ end
284
+ end
285
+ end
286
+ end
@@ -0,0 +1,238 @@
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 TssV2TransactionsGet200ResponsePaymentInformationIssuerInformation
17
+ # This field contains the issuer name.
18
+ attr_accessor :name
19
+
20
+ # This field contains [2-character ISO Country Codes](http://apps.cybersource.com/library/documentation/sbc/quickref/countries_alpha_list.pdf) for the issuer.
21
+ attr_accessor :country
22
+
23
+ # This field contains the length of the BIN.
24
+ attr_accessor :bin_length
25
+
26
+ # This field contains the customer service phone number for the issuer.
27
+ attr_accessor :phone_number
28
+
29
+ # Attribute mapping from ruby-style variable name to JSON key.
30
+ def self.attribute_map
31
+ {
32
+ :'name' => :'name',
33
+ :'country' => :'country',
34
+ :'bin_length' => :'binLength',
35
+ :'phone_number' => :'phoneNumber'
36
+ }
37
+ end
38
+
39
+ # Attribute type mapping.
40
+ def self.swagger_types
41
+ {
42
+ :'name' => :'String',
43
+ :'country' => :'String',
44
+ :'bin_length' => :'String',
45
+ :'phone_number' => :'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?(:'country')
62
+ self.country = attributes[:'country']
63
+ end
64
+
65
+ if attributes.has_key?(:'binLength')
66
+ self.bin_length = attributes[:'binLength']
67
+ end
68
+
69
+ if attributes.has_key?(:'phoneNumber')
70
+ self.phone_number = attributes[:'phoneNumber']
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
+ invalid_properties
79
+ end
80
+
81
+ # Check to see if the all the properties in the model are valid
82
+ # @return true if the model is valid
83
+ def valid?
84
+ true
85
+ end
86
+
87
+ # Custom attribute writer method with validation
88
+ # @param [Object] name Value to be assigned
89
+ def name=(name)
90
+ @name = name
91
+ end
92
+
93
+ # Custom attribute writer method with validation
94
+ # @param [Object] country Value to be assigned
95
+ def country=(country)
96
+ @country = country
97
+ end
98
+
99
+ # Custom attribute writer method with validation
100
+ # @param [Object] bin_length Value to be assigned
101
+ def bin_length=(bin_length)
102
+ @bin_length = bin_length
103
+ end
104
+
105
+ # Custom attribute writer method with validation
106
+ # @param [Object] phone_number Value to be assigned
107
+ def phone_number=(phone_number)
108
+ @phone_number = phone_number
109
+ end
110
+
111
+ # Checks equality by comparing each attribute.
112
+ # @param [Object] Object to be compared
113
+ def ==(o)
114
+ return true if self.equal?(o)
115
+ self.class == o.class &&
116
+ name == o.name &&
117
+ country == o.country &&
118
+ bin_length == o.bin_length &&
119
+ phone_number == o.phone_number
120
+ end
121
+
122
+ # @see the `==` method
123
+ # @param [Object] Object to be compared
124
+ def eql?(o)
125
+ self == o
126
+ end
127
+
128
+ # Calculates hash code according to all attributes.
129
+ # @return [Fixnum] Hash code
130
+ def hash
131
+ [name, country, bin_length, phone_number].hash
132
+ end
133
+
134
+ # Builds the object from hash
135
+ # @param [Hash] attributes Model attributes in the form of hash
136
+ # @return [Object] Returns the model itself
137
+ def build_from_hash(attributes)
138
+ return nil unless attributes.is_a?(Hash)
139
+ self.class.swagger_types.each_pair do |key, type|
140
+ if type =~ /\AArray<(.*)>/i
141
+ # check to ensure the input is an array given that the the attribute
142
+ # is documented as an array but the input is not
143
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
144
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
145
+ end
146
+ elsif !attributes[self.class.attribute_map[key]].nil?
147
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
148
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
149
+ end
150
+
151
+ self
152
+ end
153
+
154
+ # Deserializes the data based on type
155
+ # @param string type Data type
156
+ # @param string value Value to be deserialized
157
+ # @return [Object] Deserialized data
158
+ def _deserialize(type, value)
159
+ case type.to_sym
160
+ when :DateTime
161
+ DateTime.parse(value)
162
+ when :Date
163
+ Date.parse(value)
164
+ when :String
165
+ value.to_s
166
+ when :Integer
167
+ value.to_i
168
+ when :Float
169
+ value.to_f
170
+ when :BOOLEAN
171
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
172
+ true
173
+ else
174
+ false
175
+ end
176
+ when :Object
177
+ # generic object (usually a Hash), return directly
178
+ value
179
+ when /\AArray<(?<inner_type>.+)>\z/
180
+ inner_type = Regexp.last_match[:inner_type]
181
+ value.map { |v| _deserialize(inner_type, v) }
182
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
183
+ k_type = Regexp.last_match[:k_type]
184
+ v_type = Regexp.last_match[:v_type]
185
+ {}.tap do |hash|
186
+ value.each do |k, v|
187
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
188
+ end
189
+ end
190
+ else # model
191
+ temp_model = CyberSource.const_get(type).new
192
+ temp_model.build_from_hash(value)
193
+ end
194
+ end
195
+
196
+ # Returns the string representation of the object
197
+ # @return [String] String presentation of the object
198
+ def to_s
199
+ to_hash.to_s
200
+ end
201
+
202
+ # to_body is an alias to to_hash (backward compatibility)
203
+ # @return [Hash] Returns the object in the form of hash
204
+ def to_body
205
+ to_hash
206
+ end
207
+
208
+ # Returns the object in the form of hash
209
+ # @return [Hash] Returns the object in the form of hash
210
+ def to_hash
211
+ hash = {}
212
+ self.class.attribute_map.each_pair do |attr, param|
213
+ value = self.send(attr)
214
+ next if value.nil?
215
+ hash[param] = _to_hash(value)
216
+ end
217
+ hash
218
+ end
219
+
220
+ # Outputs non-array value in the form of hash
221
+ # For object, use to_hash. Otherwise, just return the value
222
+ # @param [Object] value Any valid value
223
+ # @return [Hash] Returns the value in the form of hash
224
+ def _to_hash(value)
225
+ if value.is_a?(Array)
226
+ value.compact.map { |v| _to_hash(v) }
227
+ elsif value.is_a?(Hash)
228
+ {}.tap do |hash|
229
+ value.each { |k, v| hash[k] = _to_hash(v) }
230
+ end
231
+ elsif value.respond_to? :to_hash
232
+ value.to_hash
233
+ else
234
+ value
235
+ end
236
+ end
237
+ end
238
+ end