mastercard_masterpass_merchant 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (83) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE.txt +24 -0
  3. data/README.md +74 -0
  4. data/lib/mastercard_masterpass_merchant.rb +182 -0
  5. data/lib/mastercard_masterpass_merchant/api/checkout_api.rb +41 -0
  6. data/lib/mastercard_masterpass_merchant/api/decryption_api.rb +40 -0
  7. data/lib/mastercard_masterpass_merchant/api/express_checkout_api.rb +42 -0
  8. data/lib/mastercard_masterpass_merchant/api/merchant_initialization_api.rb +40 -0
  9. data/lib/mastercard_masterpass_merchant/api/postback_api.rb +39 -0
  10. data/lib/mastercard_masterpass_merchant/api/precheckout_data_api.rb +42 -0
  11. data/lib/mastercard_masterpass_merchant/api/session_key_signing_api.rb +40 -0
  12. data/lib/mastercard_masterpass_merchant/api/shopping_cart_api.rb +40 -0
  13. data/lib/mastercard_masterpass_merchant/models/acceptance_option.rb +177 -0
  14. data/lib/mastercard_masterpass_merchant/models/address.rb +243 -0
  15. data/lib/mastercard_masterpass_merchant/models/address_extension_point.rb +176 -0
  16. data/lib/mastercard_masterpass_merchant/models/authentication_options.rb +265 -0
  17. data/lib/mastercard_masterpass_merchant/models/base_card.rb +221 -0
  18. data/lib/mastercard_masterpass_merchant/models/brands.rb +165 -0
  19. data/lib/mastercard_masterpass_merchant/models/card.rb +244 -0
  20. data/lib/mastercard_masterpass_merchant/models/card_extension.rb +189 -0
  21. data/lib/mastercard_masterpass_merchant/models/card_type.rb +174 -0
  22. data/lib/mastercard_masterpass_merchant/models/card_types.rb +166 -0
  23. data/lib/mastercard_masterpass_merchant/models/checkout.rb +259 -0
  24. data/lib/mastercard_masterpass_merchant/models/checkout_dsrp.rb +210 -0
  25. data/lib/mastercard_masterpass_merchant/models/checkout_extension.rb +259 -0
  26. data/lib/mastercard_masterpass_merchant/models/contact.rb +275 -0
  27. data/lib/mastercard_masterpass_merchant/models/date_of_birth.rb +199 -0
  28. data/lib/mastercard_masterpass_merchant/models/decryption_request.rb +199 -0
  29. data/lib/mastercard_masterpass_merchant/models/decryption_response.rb +165 -0
  30. data/lib/mastercard_masterpass_merchant/models/detail.rb +176 -0
  31. data/lib/mastercard_masterpass_merchant/models/details.rb +176 -0
  32. data/lib/mastercard_masterpass_merchant/models/dsrp.rb +199 -0
  33. data/lib/mastercard_masterpass_merchant/models/dsrp_extension.rb +189 -0
  34. data/lib/mastercard_masterpass_merchant/models/dsrp_options.rb +188 -0
  35. data/lib/mastercard_masterpass_merchant/models/error.rb +222 -0
  36. data/lib/mastercard_masterpass_merchant/models/errors.rb +174 -0
  37. data/lib/mastercard_masterpass_merchant/models/express_checkout_request.rb +276 -0
  38. data/lib/mastercard_masterpass_merchant/models/express_checkout_response.rb +201 -0
  39. data/lib/mastercard_masterpass_merchant/models/extension_point.rb +163 -0
  40. data/lib/mastercard_masterpass_merchant/models/installment.rb +221 -0
  41. data/lib/mastercard_masterpass_merchant/models/installment_option.rb +198 -0
  42. data/lib/mastercard_masterpass_merchant/models/installment_options.rb +166 -0
  43. data/lib/mastercard_masterpass_merchant/models/installments.rb +176 -0
  44. data/lib/mastercard_masterpass_merchant/models/issuers.rb +165 -0
  45. data/lib/mastercard_masterpass_merchant/models/merchant_initialization_extension.rb +201 -0
  46. data/lib/mastercard_masterpass_merchant/models/merchant_initialization_request.rb +199 -0
  47. data/lib/mastercard_masterpass_merchant/models/merchant_initialization_response.rb +177 -0
  48. data/lib/mastercard_masterpass_merchant/models/merchant_initialization_response_extension.rb +165 -0
  49. data/lib/mastercard_masterpass_merchant/models/merchant_transaction.rb +274 -0
  50. data/lib/mastercard_masterpass_merchant/models/merchant_transactions.rb +176 -0
  51. data/lib/mastercard_masterpass_merchant/models/option.rb +197 -0
  52. data/lib/mastercard_masterpass_merchant/models/pairing_data_type.rb +186 -0
  53. data/lib/mastercard_masterpass_merchant/models/pairing_data_types.rb +188 -0
  54. data/lib/mastercard_masterpass_merchant/models/payment_acceptance.rb +166 -0
  55. data/lib/mastercard_masterpass_merchant/models/payment_acceptance_types_extension.rb +166 -0
  56. data/lib/mastercard_masterpass_merchant/models/payment_options_extensions.rb +178 -0
  57. data/lib/mastercard_masterpass_merchant/models/precheckout_card.rb +288 -0
  58. data/lib/mastercard_masterpass_merchant/models/precheckout_cards.rb +188 -0
  59. data/lib/mastercard_masterpass_merchant/models/precheckout_data.rb +259 -0
  60. data/lib/mastercard_masterpass_merchant/models/precheckout_data_request.rb +178 -0
  61. data/lib/mastercard_masterpass_merchant/models/precheckout_data_response.rb +211 -0
  62. data/lib/mastercard_masterpass_merchant/models/precheckout_reward_program.rb +243 -0
  63. data/lib/mastercard_masterpass_merchant/models/precheckout_shipping_address.rb +298 -0
  64. data/lib/mastercard_masterpass_merchant/models/precheckout_shipping_addresses.rb +188 -0
  65. data/lib/mastercard_masterpass_merchant/models/private_data.rb +177 -0
  66. data/lib/mastercard_masterpass_merchant/models/private_datas.rb +166 -0
  67. data/lib/mastercard_masterpass_merchant/models/reward_program.rb +221 -0
  68. data/lib/mastercard_masterpass_merchant/models/reward_programs.rb +188 -0
  69. data/lib/mastercard_masterpass_merchant/models/risk_decisioning.rb +178 -0
  70. data/lib/mastercard_masterpass_merchant/models/session_key_signing_request.rb +199 -0
  71. data/lib/mastercard_masterpass_merchant/models/session_key_signing_response.rb +210 -0
  72. data/lib/mastercard_masterpass_merchant/models/shipping_address.rb +265 -0
  73. data/lib/mastercard_masterpass_merchant/models/shopping_cart.rb +210 -0
  74. data/lib/mastercard_masterpass_merchant/models/shopping_cart_item.rb +210 -0
  75. data/lib/mastercard_masterpass_merchant/models/shopping_cart_request.rb +189 -0
  76. data/lib/mastercard_masterpass_merchant/models/shopping_cart_request_extension_point.rb +165 -0
  77. data/lib/mastercard_masterpass_merchant/models/shopping_cart_response.rb +177 -0
  78. data/lib/mastercard_masterpass_merchant/models/tokenization.rb +188 -0
  79. data/lib/mastercard_masterpass_merchant/models/types.rb +174 -0
  80. data/lib/mastercard_masterpass_merchant/models/wallet.rb +177 -0
  81. data/lib/mastercard_masterpass_merchant/tracker/sdk_api_tracker.rb +57 -0
  82. data/lib/mastercard_masterpass_merchant/version.rb +3 -0
  83. metadata +240 -0
@@ -0,0 +1,165 @@
1
+ require 'date'
2
+ require 'roxml'
3
+
4
+
5
+ module MastercardMasterpassMerchant
6
+ # This class contains methods regarding brands information.
7
+ class Brands
8
+ include ROXML
9
+
10
+ xml_name "Brands"
11
+
12
+ # @!attribute brand_id
13
+ # @return [String] the brand identification detail.
14
+ xml_accessor :brand_id, :from =>"BrandId"
15
+
16
+
17
+ # Attribute mapping from ruby-style variable name to JSON key.
18
+ def self.attribute_map
19
+ {
20
+ :brand_id => :BrandId
21
+
22
+ }
23
+ end
24
+
25
+ def initialize(attributes = {})
26
+ return unless attributes.is_a?(Hash)
27
+
28
+ # convert string to symbol for hash key
29
+ attributes = attributes.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}
30
+
31
+
32
+ if attributes.has_key?(:BrandId) || attributes.has_key?(:brand_id)
33
+ self.brand_id = attributes[:BrandId] || attributes[:brand_id]
34
+ end
35
+
36
+ end
37
+
38
+
39
+
40
+
41
+ # Check equality by comparing each attribute.
42
+ def ==(o)
43
+ return true if self.equal?(o)
44
+ self.class == o.class &&
45
+ brand_id == o.brand_id
46
+ end
47
+
48
+ # @see the `==` method
49
+ def eql?(o)
50
+ self == o
51
+ end
52
+
53
+ # Calculate hash code according to all attributes.
54
+ def hash
55
+ [brand_id].hash
56
+ end
57
+
58
+ # build the object from hash
59
+ def build_from_hash(attributes)
60
+ return nil unless attributes.is_a?(Hash)
61
+ self.class.datatype_map.each_pair do |key, type|
62
+ if type =~ /^Array<(.*)>/i
63
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
64
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
65
+ else
66
+ #TODO show warning in debug mode
67
+ end
68
+ elsif !attributes[self.class.attribute_map[key]].nil?
69
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
70
+ else
71
+ # data not found in attributes(hash), not an issue as the data can be optional
72
+ end
73
+ end
74
+
75
+ self
76
+ end
77
+
78
+ def _deserialize(type, value)
79
+ case type.to_sym
80
+ when :DateTime
81
+ DateTime.parse(value)
82
+ when :Date
83
+ Date.parse(value)
84
+ when :String
85
+ value.to_s
86
+ when :Integer
87
+ value.to_i
88
+ when :Float
89
+ value.to_f
90
+ when :BOOLEAN
91
+ if value =~ /^(true|t|yes|y|1)$/i
92
+ true
93
+ else
94
+ false
95
+ end
96
+ when /\AArray<(?<inner_type>.+)>\z/
97
+ inner_type = Regexp.last_match[:inner_type]
98
+ value.map { |v| _deserialize(inner_type, v) }
99
+ when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
100
+ k_type = Regexp.last_match[:k_type]
101
+ v_type = Regexp.last_match[:v_type]
102
+ {}.tap do |hash|
103
+ value.each do |k, v|
104
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
105
+ end
106
+ end
107
+ else # model
108
+ _model = MastercardMasterpassMerchant.const_get(type).new
109
+ _model.build_from_hash(value)
110
+ end
111
+ end
112
+
113
+ def to_s
114
+ to_hash.to_s
115
+ end
116
+
117
+ # to_body is an alias to to_body (backward compatibility))
118
+ def to_body
119
+ to_hash
120
+ end
121
+
122
+ # return the object in the form of hash
123
+ def to_hash
124
+ hash = {}
125
+ self.class.attribute_map.each_pair do |attr, param|
126
+ value = self.send(attr)
127
+ next if value.nil?
128
+ hash[param] = _to_hash(value)
129
+ end
130
+ hash
131
+ end
132
+
133
+ # Method to output non-array value in the form of hash
134
+ # For object, use to_hash. Otherwise, just return the value
135
+ def _to_hash(value)
136
+ if value.is_a?(Array)
137
+ value.compact.map{ |v| _to_hash(v) }
138
+ elsif value.is_a?(Hash)
139
+ {}.tap do |hash|
140
+ value.each { |k, v| hash[k] = _to_hash(v) }
141
+ end
142
+ elsif value.respond_to? :to_hash
143
+ value.to_hash
144
+ else
145
+ value
146
+ end
147
+ end
148
+
149
+
150
+ private
151
+ def after_parse
152
+ self.send(:remove_instance_variable, :@roxml_references) if defined? self.roxml_references
153
+ end
154
+
155
+ # Attribute datatype mapping.
156
+ def self.datatype_map
157
+ {
158
+ :brand_id => 'String'
159
+
160
+ }
161
+ end
162
+ end
163
+
164
+
165
+ end
@@ -0,0 +1,244 @@
1
+ require 'date'
2
+ require 'roxml'
3
+ require_relative '../../mastercard_masterpass_merchant/models/address'
4
+ require_relative '../../mastercard_masterpass_merchant/models/base_card'
5
+ require_relative '../../mastercard_masterpass_merchant/models/checkout_extension'
6
+
7
+
8
+ module MastercardMasterpassMerchant
9
+ class Card
10
+ include ROXML
11
+
12
+ xml_name "Card"
13
+
14
+ # @!attribute brand_id
15
+ # @return [String] the card brand id, for example, master for MasterCard.
16
+ xml_accessor :brand_id, :from =>"BrandId"
17
+
18
+ # @!attribute expiry_month
19
+ # @return [Integer] the expiration month displayed on the payment card.
20
+ xml_accessor :expiry_month, :from =>"ExpiryMonth"
21
+
22
+ # @!attribute account_number
23
+ # @return [String] the account number.
24
+ xml_accessor :account_number, :from =>"AccountNumber"
25
+
26
+ # @!attribute card_holder_name
27
+ # @return [String] the cardholder name.
28
+ xml_accessor :card_holder_name, :from =>"CardHolderName"
29
+
30
+ # @!attribute extension_point
31
+ # @return [CheckoutExtension] the ExtensionPoint for future enhancement.
32
+ xml_accessor :extension_point, :from =>"ExtensionPoint",:as => CheckoutExtension
33
+
34
+ # @!attribute billing_address
35
+ # @return [Address] the billing address for the card holder.
36
+ xml_accessor :billing_address, :from =>"BillingAddress",:as => Address
37
+
38
+ # @!attribute brand_name
39
+ # @return [String] the card brand name, for example, MasterCard.
40
+ xml_accessor :brand_name, :from =>"BrandName"
41
+
42
+ # @!attribute expiry_year
43
+ # @return [Integer] the expiration year displayed on the payment card.
44
+ xml_accessor :expiry_year, :from =>"ExpiryYear"
45
+
46
+
47
+ # Attribute mapping from ruby-style variable name to JSON key.
48
+ def self.attribute_map
49
+ {
50
+ :brand_id => :BrandId ,
51
+ :expiry_month => :ExpiryMonth ,
52
+ :account_number => :AccountNumber ,
53
+ :card_holder_name => :CardHolderName ,
54
+ :extension_point => :ExtensionPoint ,
55
+ :billing_address => :BillingAddress ,
56
+ :brand_name => :BrandName ,
57
+ :expiry_year => :ExpiryYear
58
+
59
+ }
60
+ end
61
+
62
+ def initialize(attributes = {})
63
+ return unless attributes.is_a?(Hash)
64
+
65
+ # convert string to symbol for hash key
66
+ attributes = attributes.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}
67
+
68
+
69
+ if attributes.has_key?(:BrandId) || attributes.has_key?(:brand_id)
70
+ self.brand_id = attributes[:BrandId] || attributes[:brand_id]
71
+ end
72
+
73
+ if attributes.has_key?(:ExpiryMonth) || attributes.has_key?(:expiry_month)
74
+ self.expiry_month = attributes[:ExpiryMonth] || attributes[:expiry_month]
75
+ end
76
+
77
+ if attributes.has_key?(:AccountNumber) || attributes.has_key?(:account_number)
78
+ self.account_number = attributes[:AccountNumber] || attributes[:account_number]
79
+ end
80
+
81
+ if attributes.has_key?(:CardHolderName) || attributes.has_key?(:card_holder_name)
82
+ self.card_holder_name = attributes[:CardHolderName] || attributes[:card_holder_name]
83
+ end
84
+
85
+ if attributes.has_key?(:ExtensionPoint) || attributes.has_key?(:extension_point)
86
+ self.extension_point = attributes[:ExtensionPoint] || attributes[:extension_point]
87
+ end
88
+
89
+ if attributes.has_key?(:BillingAddress) || attributes.has_key?(:billing_address)
90
+ self.billing_address = attributes[:BillingAddress] || attributes[:billing_address]
91
+ end
92
+
93
+ if attributes.has_key?(:BrandName) || attributes.has_key?(:brand_name)
94
+ self.brand_name = attributes[:BrandName] || attributes[:brand_name]
95
+ end
96
+
97
+ if attributes.has_key?(:ExpiryYear) || attributes.has_key?(:expiry_year)
98
+ self.expiry_year = attributes[:ExpiryYear] || attributes[:expiry_year]
99
+ end
100
+
101
+ end
102
+
103
+
104
+
105
+
106
+ # Check equality by comparing each attribute.
107
+ def ==(o)
108
+ return true if self.equal?(o)
109
+ self.class == o.class &&
110
+ brand_id == o.brand_id &&
111
+ expiry_month == o.expiry_month &&
112
+ account_number == o.account_number &&
113
+ card_holder_name == o.card_holder_name &&
114
+ extension_point == o.extension_point &&
115
+ billing_address == o.billing_address &&
116
+ brand_name == o.brand_name &&
117
+ expiry_year == o.expiry_year
118
+ end
119
+
120
+ # @see the `==` method
121
+ def eql?(o)
122
+ self == o
123
+ end
124
+
125
+ # Calculate hash code according to all attributes.
126
+ def hash
127
+ [brand_id, expiry_month, account_number, card_holder_name, extension_point, billing_address, brand_name, expiry_year].hash
128
+ end
129
+
130
+ # build the object from hash
131
+ def build_from_hash(attributes)
132
+ return nil unless attributes.is_a?(Hash)
133
+ self.class.datatype_map.each_pair do |key, type|
134
+ if type =~ /^Array<(.*)>/i
135
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
136
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
137
+ else
138
+ #TODO show warning in debug mode
139
+ end
140
+ elsif !attributes[self.class.attribute_map[key]].nil?
141
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
142
+ else
143
+ # data not found in attributes(hash), not an issue as the data can be optional
144
+ end
145
+ end
146
+
147
+ self
148
+ end
149
+
150
+ def _deserialize(type, value)
151
+ case type.to_sym
152
+ when :DateTime
153
+ DateTime.parse(value)
154
+ when :Date
155
+ Date.parse(value)
156
+ when :String
157
+ value.to_s
158
+ when :Integer
159
+ value.to_i
160
+ when :Float
161
+ value.to_f
162
+ when :BOOLEAN
163
+ if value =~ /^(true|t|yes|y|1)$/i
164
+ true
165
+ else
166
+ false
167
+ end
168
+ when /\AArray<(?<inner_type>.+)>\z/
169
+ inner_type = Regexp.last_match[:inner_type]
170
+ value.map { |v| _deserialize(inner_type, v) }
171
+ when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
172
+ k_type = Regexp.last_match[:k_type]
173
+ v_type = Regexp.last_match[:v_type]
174
+ {}.tap do |hash|
175
+ value.each do |k, v|
176
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
177
+ end
178
+ end
179
+ else # model
180
+ _model = MastercardMasterpassMerchant.const_get(type).new
181
+ _model.build_from_hash(value)
182
+ end
183
+ end
184
+
185
+ def to_s
186
+ to_hash.to_s
187
+ end
188
+
189
+ # to_body is an alias to to_body (backward compatibility))
190
+ def to_body
191
+ to_hash
192
+ end
193
+
194
+ # return the object in the form of hash
195
+ def to_hash
196
+ hash = {}
197
+ self.class.attribute_map.each_pair do |attr, param|
198
+ value = self.send(attr)
199
+ next if value.nil?
200
+ hash[param] = _to_hash(value)
201
+ end
202
+ hash
203
+ end
204
+
205
+ # Method to output non-array value in the form of hash
206
+ # For object, use to_hash. Otherwise, just return the value
207
+ def _to_hash(value)
208
+ if value.is_a?(Array)
209
+ value.compact.map{ |v| _to_hash(v) }
210
+ elsif value.is_a?(Hash)
211
+ {}.tap do |hash|
212
+ value.each { |k, v| hash[k] = _to_hash(v) }
213
+ end
214
+ elsif value.respond_to? :to_hash
215
+ value.to_hash
216
+ else
217
+ value
218
+ end
219
+ end
220
+
221
+
222
+ private
223
+ def after_parse
224
+ self.send(:remove_instance_variable, :@roxml_references) if defined? self.roxml_references
225
+ end
226
+
227
+ # Attribute datatype mapping.
228
+ def self.datatype_map
229
+ {
230
+ :brand_id => 'String',
231
+ :expiry_month => 'Integer',
232
+ :account_number => 'String',
233
+ :card_holder_name => 'String',
234
+ :extension_point => 'CheckoutExtension',
235
+ :billing_address => 'Address',
236
+ :brand_name => 'String',
237
+ :expiry_year => 'Integer'
238
+
239
+ }
240
+ end
241
+ end
242
+
243
+
244
+ end
@@ -0,0 +1,189 @@
1
+ require 'date'
2
+ require 'roxml'
3
+ require_relative '../../mastercard_masterpass_merchant/models/extension_point'
4
+ require_relative '../../mastercard_masterpass_merchant/models/payment_acceptance_types_extension'
5
+
6
+
7
+ module MastercardMasterpassMerchant
8
+ # This class contains different methods related to card verification status.
9
+ class CardExtension
10
+ include ROXML
11
+
12
+ xml_name "CardExtension"
13
+
14
+ # @!attribute card_verification_status
15
+ # @return [String] the card verification status.
16
+ xml_accessor :card_verification_status, :from =>"CardVerificationStatus"
17
+
18
+ # @!attribute payment_acceptance_types_extension
19
+ # @return [PaymentAcceptanceTypesExtension] the payment acceptance types.
20
+ xml_accessor :payment_acceptance_types_extension, :from =>"PaymentAcceptanceTypesExtension",:as => PaymentAcceptanceTypesExtension
21
+
22
+ # @!attribute extension_point
23
+ # @return [ExtensionPoint] the ExtensionPoint for future enhancement.
24
+ xml_accessor :extension_point, :from =>"ExtensionPoint",:as => ExtensionPoint
25
+
26
+
27
+ # Attribute mapping from ruby-style variable name to JSON key.
28
+ def self.attribute_map
29
+ {
30
+ :card_verification_status => :CardVerificationStatus ,
31
+ :payment_acceptance_types_extension => :PaymentAcceptanceTypesExtension ,
32
+ :extension_point => :ExtensionPoint
33
+
34
+ }
35
+ end
36
+
37
+ def initialize(attributes = {})
38
+ return unless attributes.is_a?(Hash)
39
+
40
+ # convert string to symbol for hash key
41
+ attributes = attributes.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}
42
+
43
+
44
+ if attributes.has_key?(:CardVerificationStatus) || attributes.has_key?(:card_verification_status)
45
+ self.card_verification_status = attributes[:CardVerificationStatus] || attributes[:card_verification_status]
46
+ end
47
+
48
+ if attributes.has_key?(:PaymentAcceptanceTypesExtension) || attributes.has_key?(:payment_acceptance_types_extension)
49
+ self.payment_acceptance_types_extension = attributes[:PaymentAcceptanceTypesExtension] || attributes[:payment_acceptance_types_extension]
50
+ end
51
+
52
+ if attributes.has_key?(:ExtensionPoint) || attributes.has_key?(:extension_point)
53
+ self.extension_point = attributes[:ExtensionPoint] || attributes[:extension_point]
54
+ end
55
+
56
+ end
57
+
58
+
59
+
60
+
61
+ # Check equality by comparing each attribute.
62
+ def ==(o)
63
+ return true if self.equal?(o)
64
+ self.class == o.class &&
65
+ card_verification_status == o.card_verification_status &&
66
+ payment_acceptance_types_extension == o.payment_acceptance_types_extension &&
67
+ extension_point == o.extension_point
68
+ end
69
+
70
+ # @see the `==` method
71
+ def eql?(o)
72
+ self == o
73
+ end
74
+
75
+ # Calculate hash code according to all attributes.
76
+ def hash
77
+ [card_verification_status, payment_acceptance_types_extension, extension_point].hash
78
+ end
79
+
80
+ # build the object from hash
81
+ def build_from_hash(attributes)
82
+ return nil unless attributes.is_a?(Hash)
83
+ self.class.datatype_map.each_pair do |key, type|
84
+ if type =~ /^Array<(.*)>/i
85
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
86
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
87
+ else
88
+ #TODO show warning in debug mode
89
+ end
90
+ elsif !attributes[self.class.attribute_map[key]].nil?
91
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
92
+ else
93
+ # data not found in attributes(hash), not an issue as the data can be optional
94
+ end
95
+ end
96
+
97
+ self
98
+ end
99
+
100
+ def _deserialize(type, value)
101
+ case type.to_sym
102
+ when :DateTime
103
+ DateTime.parse(value)
104
+ when :Date
105
+ Date.parse(value)
106
+ when :String
107
+ value.to_s
108
+ when :Integer
109
+ value.to_i
110
+ when :Float
111
+ value.to_f
112
+ when :BOOLEAN
113
+ if value =~ /^(true|t|yes|y|1)$/i
114
+ true
115
+ else
116
+ false
117
+ end
118
+ when /\AArray<(?<inner_type>.+)>\z/
119
+ inner_type = Regexp.last_match[:inner_type]
120
+ value.map { |v| _deserialize(inner_type, v) }
121
+ when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
122
+ k_type = Regexp.last_match[:k_type]
123
+ v_type = Regexp.last_match[:v_type]
124
+ {}.tap do |hash|
125
+ value.each do |k, v|
126
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
127
+ end
128
+ end
129
+ else # model
130
+ _model = MastercardMasterpassMerchant.const_get(type).new
131
+ _model.build_from_hash(value)
132
+ end
133
+ end
134
+
135
+ def to_s
136
+ to_hash.to_s
137
+ end
138
+
139
+ # to_body is an alias to to_body (backward compatibility))
140
+ def to_body
141
+ to_hash
142
+ end
143
+
144
+ # return the object in the form of hash
145
+ def to_hash
146
+ hash = {}
147
+ self.class.attribute_map.each_pair do |attr, param|
148
+ value = self.send(attr)
149
+ next if value.nil?
150
+ hash[param] = _to_hash(value)
151
+ end
152
+ hash
153
+ end
154
+
155
+ # Method to output non-array value in the form of hash
156
+ # For object, use to_hash. Otherwise, just return the value
157
+ def _to_hash(value)
158
+ if value.is_a?(Array)
159
+ value.compact.map{ |v| _to_hash(v) }
160
+ elsif value.is_a?(Hash)
161
+ {}.tap do |hash|
162
+ value.each { |k, v| hash[k] = _to_hash(v) }
163
+ end
164
+ elsif value.respond_to? :to_hash
165
+ value.to_hash
166
+ else
167
+ value
168
+ end
169
+ end
170
+
171
+
172
+ private
173
+ def after_parse
174
+ self.send(:remove_instance_variable, :@roxml_references) if defined? self.roxml_references
175
+ end
176
+
177
+ # Attribute datatype mapping.
178
+ def self.datatype_map
179
+ {
180
+ :card_verification_status => 'String',
181
+ :payment_acceptance_types_extension => 'PaymentAcceptanceTypesExtension',
182
+ :extension_point => 'ExtensionPoint'
183
+
184
+ }
185
+ end
186
+ end
187
+
188
+
189
+ end