cybersource_rest_client 0.0.80 → 0.0.81

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (152) hide show
  1. checksums.yaml +4 -4
  2. data/lib/AuthenticationSDK/authentication/jwt/JwtToken.rb +17 -7
  3. data/lib/AuthenticationSDK/core/Authorization.rb +2 -2
  4. data/lib/AuthenticationSDK/core/MerchantConfig.rb +277 -23
  5. data/lib/AuthenticationSDK/util/Cache.rb +144 -8
  6. data/lib/AuthenticationSDK/util/CachedMLEKId.rb +17 -0
  7. data/lib/AuthenticationSDK/util/CertificateUtility.rb +109 -29
  8. data/lib/AuthenticationSDK/util/Constants.rb +4 -0
  9. data/lib/AuthenticationSDK/util/MLEUtility.rb +167 -11
  10. data/lib/AuthenticationSDK/util/Utility.rb +37 -1
  11. data/lib/cybersource_rest_client/api/bank_account_validation_api.rb +6 -2
  12. data/lib/cybersource_rest_client/api/batches_api.rb +24 -8
  13. data/lib/cybersource_rest_client/api/billing_agreements_api.rb +18 -6
  14. data/lib/cybersource_rest_client/api/bin_lookup_api.rb +6 -2
  15. data/lib/cybersource_rest_client/api/capture_api.rb +6 -2
  16. data/lib/cybersource_rest_client/api/chargeback_details_api.rb +6 -2
  17. data/lib/cybersource_rest_client/api/chargeback_summaries_api.rb +6 -2
  18. data/lib/cybersource_rest_client/api/conversion_details_api.rb +6 -2
  19. data/lib/cybersource_rest_client/api/create_new_webhooks_api.rb +18 -6
  20. data/lib/cybersource_rest_client/api/credit_api.rb +6 -2
  21. data/lib/cybersource_rest_client/api/customer_api.rb +24 -8
  22. data/lib/cybersource_rest_client/api/customer_payment_instrument_api.rb +30 -10
  23. data/lib/cybersource_rest_client/api/customer_shipping_address_api.rb +30 -10
  24. data/lib/cybersource_rest_client/api/decision_manager_api.rb +30 -10
  25. data/lib/cybersource_rest_client/api/device_de_association_api.rb +12 -4
  26. data/lib/cybersource_rest_client/api/device_search_api.rb +12 -4
  27. data/lib/cybersource_rest_client/api/download_dtd_api.rb +6 -2
  28. data/lib/cybersource_rest_client/api/download_xsd_api.rb +6 -2
  29. data/lib/cybersource_rest_client/api/emv_tag_details_api.rb +12 -4
  30. data/lib/cybersource_rest_client/api/enrollment_api.rb +104 -0
  31. data/lib/cybersource_rest_client/api/flex_api_api.rb +6 -2
  32. data/lib/cybersource_rest_client/api/instructions_api.rb +452 -0
  33. data/lib/cybersource_rest_client/api/instrument_identifier_api.rb +36 -12
  34. data/lib/cybersource_rest_client/api/interchange_clearing_level_details_api.rb +6 -2
  35. data/lib/cybersource_rest_client/api/invoice_settings_api.rb +12 -4
  36. data/lib/cybersource_rest_client/api/invoices_api.rb +42 -14
  37. data/lib/cybersource_rest_client/api/manage_webhooks_api.rb +42 -14
  38. data/lib/cybersource_rest_client/api/merchant_boarding_api.rb +12 -4
  39. data/lib/cybersource_rest_client/api/merchant_defined_fields_api.rb +24 -8
  40. data/lib/cybersource_rest_client/api/microform_integration_api.rb +6 -2
  41. data/lib/cybersource_rest_client/api/net_fundings_api.rb +6 -2
  42. data/lib/cybersource_rest_client/api/notification_of_changes_api.rb +6 -2
  43. data/lib/cybersource_rest_client/api/offers_api.rb +12 -4
  44. data/lib/cybersource_rest_client/api/orders_api.rb +12 -4
  45. data/lib/cybersource_rest_client/api/payer_authentication_api.rb +18 -6
  46. data/lib/cybersource_rest_client/api/payment_batch_summaries_api.rb +6 -2
  47. data/lib/cybersource_rest_client/api/payment_instrument_api.rb +24 -8
  48. data/lib/cybersource_rest_client/api/payment_links_api.rb +24 -8
  49. data/lib/cybersource_rest_client/api/payment_tokens_api.rb +6 -2
  50. data/lib/cybersource_rest_client/api/payments_api.rb +36 -12
  51. data/lib/cybersource_rest_client/api/payouts_api.rb +6 -2
  52. data/lib/cybersource_rest_client/api/plans_api.rb +48 -16
  53. data/lib/cybersource_rest_client/api/purchase_and_refund_details_api.rb +6 -2
  54. data/lib/cybersource_rest_client/api/push_funds_api.rb +6 -2
  55. data/lib/cybersource_rest_client/api/refund_api.rb +12 -4
  56. data/lib/cybersource_rest_client/api/report_definitions_api.rb +12 -4
  57. data/lib/cybersource_rest_client/api/report_downloads_api.rb +6 -2
  58. data/lib/cybersource_rest_client/api/report_subscriptions_api.rb +30 -10
  59. data/lib/cybersource_rest_client/api/reports_api.rb +18 -6
  60. data/lib/cybersource_rest_client/api/retrieval_details_api.rb +6 -2
  61. data/lib/cybersource_rest_client/api/retrieval_summaries_api.rb +6 -2
  62. data/lib/cybersource_rest_client/api/reversal_api.rb +12 -4
  63. data/lib/cybersource_rest_client/api/search_transactions_api.rb +12 -4
  64. data/lib/cybersource_rest_client/api/secure_file_share_api.rb +12 -4
  65. data/lib/cybersource_rest_client/api/subscriptions_api.rb +48 -16
  66. data/lib/cybersource_rest_client/api/subscriptions_follow_ons_api.rb +12 -4
  67. data/lib/cybersource_rest_client/api/taxes_api.rb +12 -4
  68. data/lib/cybersource_rest_client/api/token_api.rb +12 -4
  69. data/lib/cybersource_rest_client/api/tokenize_api.rb +6 -2
  70. data/lib/cybersource_rest_client/api/tokenized_card_api.rb +24 -8
  71. data/lib/cybersource_rest_client/api/transaction_batches_api.rb +24 -8
  72. data/lib/cybersource_rest_client/api/transaction_details_api.rb +6 -2
  73. data/lib/cybersource_rest_client/api/transient_token_data_api.rb +12 -4
  74. data/lib/cybersource_rest_client/api/unified_checkout_capture_context_api.rb +6 -2
  75. data/lib/cybersource_rest_client/api/user_management_api.rb +6 -2
  76. data/lib/cybersource_rest_client/api/user_management_search_api.rb +6 -2
  77. data/lib/cybersource_rest_client/api/verification_api.rb +12 -4
  78. data/lib/cybersource_rest_client/api/void_api.rb +30 -10
  79. data/lib/cybersource_rest_client/api_client.rb +20 -3
  80. data/lib/cybersource_rest_client/models/acpv1instructions_decline_threshold.rb +232 -0
  81. data/lib/cybersource_rest_client/models/acpv1instructions_mandates.rb +405 -0
  82. data/lib/cybersource_rest_client/models/acpv1instructions_recurring_payment_information.rb +191 -0
  83. data/lib/cybersource_rest_client/models/acpv1instructionsinstruction_idconf_processor_info_payment_instrument_verifi_results.rb +213 -0
  84. data/lib/cybersource_rest_client/models/acpv1instructionsinstruction_idconfirmations_confirmation_data.rb +229 -0
  85. data/lib/cybersource_rest_client/models/acpv1instructionsinstruction_idconfirmations_merchant_information.rb +258 -0
  86. data/lib/cybersource_rest_client/models/acpv1instructionsinstruction_idconfirmations_order_information.rb +377 -0
  87. data/lib/cybersource_rest_client/models/acpv1instructionsinstruction_idconfirmations_order_information_shipping_details.rb +206 -0
  88. data/lib/cybersource_rest_client/models/acpv1instructionsinstruction_idconfirmations_processor_information.rb +425 -0
  89. data/lib/cybersource_rest_client/models/acpv1instructionsinstruction_idconfirmations_processor_information_payment_instrument.rb +190 -0
  90. data/lib/cybersource_rest_client/models/acpv1instructionsinstruction_idcredentials_attachments.rb +258 -0
  91. data/lib/cybersource_rest_client/models/acpv1instructionsinstruction_idcredentials_client_reference_information.rb +215 -0
  92. data/lib/cybersource_rest_client/models/acpv1instructionsinstruction_idcredentials_mandate_reference_data.rb +205 -0
  93. data/lib/cybersource_rest_client/models/acpv1instructionsinstruction_idcredentials_merchant_information.rb +334 -0
  94. data/lib/cybersource_rest_client/models/acpv1instructionsinstruction_idcredentials_merchant_information_merchant_descriptor.rb +250 -0
  95. data/lib/cybersource_rest_client/models/acpv1instructionsinstruction_idcredentials_order_information.rb +228 -0
  96. data/lib/cybersource_rest_client/models/acpv1instructionsinstruction_idcredentials_order_information_amount_detail.rb +354 -0
  97. data/lib/cybersource_rest_client/models/acpv1instructionsinstruction_idcredentials_order_information_items.rb +367 -0
  98. data/lib/cybersource_rest_client/models/acpv1instructionsinstruction_idcredentials_order_information_items_additional_info.rb +231 -0
  99. data/lib/cybersource_rest_client/models/acpv1instructionsinstruction_idcredentials_order_information_items_policies.rb +346 -0
  100. data/lib/cybersource_rest_client/models/acpv1instructionsinstruction_idcredentials_order_information_line_items.rb +190 -0
  101. data/lib/cybersource_rest_client/models/acpv1instructionsinstruction_idcredentials_order_information_ship_to.rb +686 -0
  102. data/lib/cybersource_rest_client/models/acpv1instructionsinstruction_idcredentials_payment_options.rb +217 -0
  103. data/lib/cybersource_rest_client/models/acpv1instructionsinstruction_idcredentials_transaction_data.rb +348 -0
  104. data/lib/cybersource_rest_client/models/acpv1tokens_assurance_data.rb +313 -0
  105. data/lib/cybersource_rest_client/models/acpv1tokens_authenticated_identities.rb +237 -0
  106. data/lib/cybersource_rest_client/models/acpv1tokens_authentication_context.rb +191 -0
  107. data/lib/cybersource_rest_client/models/acpv1tokens_bill_to.rb +400 -0
  108. data/lib/cybersource_rest_client/models/acpv1tokens_buyer_information.rb +229 -0
  109. data/lib/cybersource_rest_client/models/acpv1tokens_buyer_information_personal_identification.rb +212 -0
  110. data/lib/cybersource_rest_client/models/acpv1tokens_consent_data.rb +297 -0
  111. data/lib/cybersource_rest_client/models/acpv1tokens_consumer_identity.rb +268 -0
  112. data/lib/cybersource_rest_client/models/acpv1tokens_device_information.rb +378 -0
  113. data/lib/cybersource_rest_client/models/acpv1tokens_device_information_device_data.rb +302 -0
  114. data/lib/cybersource_rest_client/models/acpv1tokens_enrollment_reference_data.rb +207 -0
  115. data/lib/cybersource_rest_client/models/acpv1tokens_payment_information.rb +215 -0
  116. data/lib/cybersource_rest_client/models/acpv1tokens_payment_information_customer.rb +197 -0
  117. data/lib/cybersource_rest_client/models/acpv1tokens_payment_information_instrument_identifier.rb +206 -0
  118. data/lib/cybersource_rest_client/models/acpv1tokens_payment_information_payment_instrument.rb +197 -0
  119. data/lib/cybersource_rest_client/models/agentic_cancel_purchase_intent_request.rb +257 -0
  120. data/lib/cybersource_rest_client/models/agentic_card_enrollment_bad_request_response400.rb +189 -0
  121. data/lib/cybersource_rest_client/models/agentic_card_enrollment_bad_request_response400_error.rb +238 -0
  122. data/lib/cybersource_rest_client/models/agentic_card_enrollment_bad_request_response400_error_detail.rb +224 -0
  123. data/lib/cybersource_rest_client/models/agentic_card_enrollment_request.rb +325 -0
  124. data/lib/cybersource_rest_client/models/agentic_card_enrollment_response200.rb +206 -0
  125. data/lib/cybersource_rest_client/models/agentic_card_enrollment_response202.rb +219 -0
  126. data/lib/cybersource_rest_client/models/agentic_confirm_transaction_events_request.rb +247 -0
  127. data/lib/cybersource_rest_client/models/agentic_confirm_transaction_events_response202.rb +195 -0
  128. data/lib/cybersource_rest_client/models/agentic_create_purchase_intent_request.rb +327 -0
  129. data/lib/cybersource_rest_client/models/agentic_create_purchase_intent_response200.rb +222 -0
  130. data/lib/cybersource_rest_client/models/agentic_pending_purchase_intent_response202.rb +241 -0
  131. data/lib/cybersource_rest_client/models/agentic_retrieve_payment_credentials_request.rb +247 -0
  132. data/lib/cybersource_rest_client/models/agentic_retrieve_payment_credentials_response200.rb +200 -0
  133. data/lib/cybersource_rest_client/models/agentic_retrieve_payment_credentials_response200_transaction_response_complete.rb +244 -0
  134. data/lib/cybersource_rest_client/models/agentic_retrieve_payment_credentials_response200_transaction_response_with_pending_events.rb +235 -0
  135. data/lib/cybersource_rest_client/models/agentic_update_purchase_intent_request.rb +315 -0
  136. data/lib/cybersource_rest_client/models/boardingv1registrations_organization_information_business_information.rb +36 -1
  137. data/lib/cybersource_rest_client/models/boardingv1registrations_organization_information_business_information_localized_names.rb +254 -0
  138. data/lib/cybersource_rest_client/models/ptsv2payments_travel_information_transit_airline_ancillary_information.rb +22 -5
  139. data/lib/cybersource_rest_client/models/ptsv2payments_travel_information_transit_airline_ancillary_information_service.rb +39 -5
  140. data/lib/cybersource_rest_client/models/ptsv2paymentsidrefunds_travel_information.rb +246 -0
  141. data/lib/cybersource_rest_client/models/ptsv2paymentsidrefunds_travel_information_transit.rb +189 -0
  142. data/lib/cybersource_rest_client/models/ptsv2paymentsidrefunds_travel_information_transit_airline.rb +889 -0
  143. data/lib/cybersource_rest_client/models/ptsv2paymentsidrefunds_travel_information_transit_airline_ancillary_information.rb +259 -0
  144. data/lib/cybersource_rest_client/models/ptsv2paymentsidrefunds_travel_information_transit_airline_ancillary_information_service.rb +213 -0
  145. data/lib/cybersource_rest_client/models/refund_capture_request.rb +1 -1
  146. data/lib/cybersource_rest_client/models/refund_payment_request.rb +1 -1
  147. data/lib/cybersource_rest_client/models/upv1capturecontexts_data.rb +4 -2
  148. data/lib/cybersource_rest_client/models/upv1capturecontexts_data_merchant_defined_information.rb +3 -2
  149. data/lib/cybersource_rest_client/utilities/jwe_utility.rb +1 -1
  150. data/lib/cybersource_rest_client.rb +64 -0
  151. metadata +68 -3
  152. /data/lib/AuthenticationSDK/util/{JWEUtility.rb → AuthJWEUtility.rb} +0 -0
@@ -0,0 +1,297 @@
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.4.38
10
+ =end
11
+
12
+ require 'date'
13
+
14
+ module CyberSource
15
+ class Acpv1tokensConsentData
16
+ # Unique identifier for the consent.
17
+ attr_accessor :id
18
+
19
+ # Type of the consent. Possible value: - `PERSONALIZATION`
20
+ attr_accessor :type
21
+
22
+ # Source of the consent.
23
+ attr_accessor :source
24
+
25
+ # Date and time when the consent was accepted by the consumer. UTC time in Unix epoch format.
26
+ attr_accessor :accepted_time
27
+
28
+ # Date and time until which the consent remains effective. UTC time in Unix epoch format.
29
+ attr_accessor :effective_until
30
+
31
+ # Attribute mapping from ruby-style variable name to JSON key.
32
+ def self.attribute_map
33
+ {
34
+ :'id' => :'id',
35
+ :'type' => :'type',
36
+ :'source' => :'source',
37
+ :'accepted_time' => :'acceptedTime',
38
+ :'effective_until' => :'effectiveUntil'
39
+ }
40
+ end
41
+
42
+ # Attribute mapping from JSON key to ruby-style variable name.
43
+ def self.json_map
44
+ {
45
+ :'id' => :'id',
46
+ :'type' => :'type',
47
+ :'source' => :'source',
48
+ :'accepted_time' => :'accepted_time',
49
+ :'effective_until' => :'effective_until'
50
+ }
51
+ end
52
+
53
+ # Attribute type mapping.
54
+ def self.swagger_types
55
+ {
56
+ :'id' => :'String',
57
+ :'type' => :'String',
58
+ :'source' => :'String',
59
+ :'accepted_time' => :'String',
60
+ :'effective_until' => :'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?(:'id')
73
+ self.id = attributes[:'id']
74
+ end
75
+
76
+ if attributes.has_key?(:'type')
77
+ self.type = attributes[:'type']
78
+ end
79
+
80
+ if attributes.has_key?(:'source')
81
+ self.source = attributes[:'source']
82
+ end
83
+
84
+ if attributes.has_key?(:'acceptedTime')
85
+ self.accepted_time = attributes[:'acceptedTime']
86
+ end
87
+
88
+ if attributes.has_key?(:'effectiveUntil')
89
+ self.effective_until = attributes[:'effectiveUntil']
90
+ end
91
+ end
92
+
93
+ # Show invalid properties with the reasons. Usually used together with valid?
94
+ # @return Array for valid properties with the reasons
95
+ def list_invalid_properties
96
+ invalid_properties = Array.new
97
+ if @id.nil?
98
+ invalid_properties.push('invalid value for "id", id cannot be nil.')
99
+ end
100
+
101
+ if @type.nil?
102
+ invalid_properties.push('invalid value for "type", type cannot be nil.')
103
+ end
104
+
105
+ if @source.nil?
106
+ invalid_properties.push('invalid value for "source", source cannot be nil.')
107
+ end
108
+
109
+ if @accepted_time.nil?
110
+ invalid_properties.push('invalid value for "accepted_time", accepted_time cannot be nil.')
111
+ end
112
+
113
+ #if @accepted_time !~ Regexp.new(/(?!^[*.,'#_\/-]+$)(?!.*\\.\/.*)^.*$/)
114
+ #invalid_properties.push('invalid value for "accepted_time", must conform to the pattern /(?!^[*.,'#_\/-]+$)(?!.*\\.\/.*)^.*$/.')
115
+ #end
116
+
117
+ if @effective_until.nil?
118
+ invalid_properties.push('invalid value for "effective_until", effective_until cannot be nil.')
119
+ end
120
+
121
+ #if @effective_until !~ Regexp.new(/(?!^[*.,'#_\/-]+$)(?!.*\\.\/.*)^.*$/)
122
+ #invalid_properties.push('invalid value for "effective_until", must conform to the pattern /(?!^[*.,'#_\/-]+$)(?!.*\\.\/.*)^.*$/.')
123
+ #end
124
+
125
+ invalid_properties
126
+ end
127
+
128
+ # Check to see if the all the properties in the model are valid
129
+ # @return true if the model is valid
130
+ def valid?
131
+ return false if @id.nil?
132
+ return false if @type.nil?
133
+ return false if @source.nil?
134
+ return false if @accepted_time.nil?
135
+ #return false if @accepted_time !~ Regexp.new(/(?!^[*.,'#_\/-]+$)(?!.*\\.\/.*)^.*$/)
136
+ return false if @effective_until.nil?
137
+ #return false if @effective_until !~ Regexp.new(/(?!^[*.,'#_\/-]+$)(?!.*\\.\/.*)^.*$/)
138
+ true
139
+ end
140
+
141
+ # Custom attribute writer method with validation
142
+ # @param [Object] accepted_time Value to be assigned
143
+ def accepted_time=(accepted_time)
144
+ #if accepted_time.nil?
145
+ #fail ArgumentError, 'accepted_time cannot be nil'
146
+ #end
147
+
148
+ #if accepted_time !~ Regexp.new(/(?!^[*.,'#_\/-]+$)(?!.*\\.\/.*)^.*$/)
149
+ #fail ArgumentError, 'invalid value for "accepted_time", must conform to the pattern /(?!^[*.,'#_\/-]+$)(?!.*\\.\/.*)^.*$/.'
150
+ #end
151
+
152
+ @accepted_time = accepted_time
153
+ end
154
+
155
+ # Custom attribute writer method with validation
156
+ # @param [Object] effective_until Value to be assigned
157
+ def effective_until=(effective_until)
158
+ #if effective_until.nil?
159
+ #fail ArgumentError, 'effective_until cannot be nil'
160
+ #end
161
+
162
+ #if effective_until !~ Regexp.new(/(?!^[*.,'#_\/-]+$)(?!.*\\.\/.*)^.*$/)
163
+ #fail ArgumentError, 'invalid value for "effective_until", must conform to the pattern /(?!^[*.,'#_\/-]+$)(?!.*\\.\/.*)^.*$/.'
164
+ #end
165
+
166
+ @effective_until = effective_until
167
+ end
168
+
169
+ # Checks equality by comparing each attribute.
170
+ # @param [Object] Object to be compared
171
+ def ==(o)
172
+ return true if self.equal?(o)
173
+ self.class == o.class &&
174
+ id == o.id &&
175
+ type == o.type &&
176
+ source == o.source &&
177
+ accepted_time == o.accepted_time &&
178
+ effective_until == o.effective_until
179
+ end
180
+
181
+ # @see the `==` method
182
+ # @param [Object] Object to be compared
183
+ def eql?(o)
184
+ self == o
185
+ end
186
+
187
+ # Calculates hash code according to all attributes.
188
+ # @return [Fixnum] Hash code
189
+ def hash
190
+ [id, type, source, accepted_time, effective_until].hash
191
+ end
192
+
193
+ # Builds the object from hash
194
+ # @param [Hash] attributes Model attributes in the form of hash
195
+ # @return [Object] Returns the model itself
196
+ def build_from_hash(attributes)
197
+ return nil unless attributes.is_a?(Hash)
198
+ self.class.swagger_types.each_pair do |key, type|
199
+ if type =~ /\AArray<(.*)>/i
200
+ # check to ensure the input is an array given that the the attribute
201
+ # is documented as an array but the input is not
202
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
203
+ self.send("#{self.class.json_map[key]}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
204
+ end
205
+ elsif !attributes[self.class.attribute_map[key]].nil?
206
+ self.send("#{self.class.json_map[key]}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
207
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
208
+ end
209
+
210
+ self
211
+ end
212
+
213
+ # Deserializes the data based on type
214
+ # @param string type Data type
215
+ # @param string value Value to be deserialized
216
+ # @return [Object] Deserialized data
217
+ def _deserialize(type, value)
218
+ case type.to_sym
219
+ when :DateTime
220
+ DateTime.parse(value)
221
+ when :Date
222
+ Date.parse(value)
223
+ when :String
224
+ value.to_s
225
+ when :Integer
226
+ value.to_i
227
+ when :Float
228
+ value.to_f
229
+ when :BOOLEAN
230
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
231
+ true
232
+ else
233
+ false
234
+ end
235
+ when :Object
236
+ # generic object (usually a Hash), return directly
237
+ value
238
+ when /\AArray<(?<inner_type>.+)>\z/
239
+ inner_type = Regexp.last_match[:inner_type]
240
+ value.map { |v| _deserialize(inner_type, v) }
241
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
242
+ k_type = Regexp.last_match[:k_type]
243
+ v_type = Regexp.last_match[:v_type]
244
+ {}.tap do |hash|
245
+ value.each do |k, v|
246
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
247
+ end
248
+ end
249
+ else # model
250
+ temp_model = CyberSource.const_get(type).new
251
+ temp_model.build_from_hash(value)
252
+ end
253
+ end
254
+
255
+ # Returns the string representation of the object
256
+ # @return [String] String presentation of the object
257
+ def to_s
258
+ to_hash.to_s
259
+ end
260
+
261
+ # to_body is an alias to to_hash (backward compatibility)
262
+ # @return [Hash] Returns the object in the form of hash
263
+ def to_body
264
+ to_hash
265
+ end
266
+
267
+ # Returns the object in the form of hash
268
+ # @return [Hash] Returns the object in the form of hash
269
+ def to_hash
270
+ hash = {}
271
+ self.class.attribute_map.each_pair do |attr, param|
272
+ value = self.send(attr)
273
+ next if value.nil?
274
+ hash[param] = _to_hash(value)
275
+ end
276
+ hash
277
+ end
278
+
279
+ # Outputs non-array value in the form of hash
280
+ # For object, use to_hash. Otherwise, just return the value
281
+ # @param [Object] value Any valid value
282
+ # @return [Hash] Returns the value in the form of hash
283
+ def _to_hash(value)
284
+ if value.is_a?(Array)
285
+ value.compact.map { |v| _to_hash(v) }
286
+ elsif value.is_a?(Hash)
287
+ {}.tap do |hash|
288
+ value.each { |k, v| hash[k] = _to_hash(v) }
289
+ end
290
+ elsif value.respond_to? :to_hash
291
+ value.to_hash
292
+ else
293
+ value
294
+ end
295
+ end
296
+ end
297
+ end
@@ -0,0 +1,268 @@
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.4.38
10
+ =end
11
+
12
+ require 'date'
13
+
14
+ module CyberSource
15
+ # Consumer Identity data.
16
+ class Acpv1tokensConsumerIdentity
17
+ # Type of Consumer Identity transmitted or collected. Possible values: - `EMAIL_ADDRESS` - `MOBILE_PHONE_NUMBER`
18
+ attr_accessor :identity_type
19
+
20
+ # Consumer Identity value that corresponds to the Consumer Identity Type.
21
+ attr_accessor :identity_value
22
+
23
+ # Identity provider of the Consumer Identity. Possible values: - `VISA` - `PARTNER` (Default)
24
+ attr_accessor :identity_provider
25
+
26
+ # Domain Name/URL(iss) of the Identity provider of the Consumer Identity.
27
+ attr_accessor :identity_provider_url
28
+
29
+ # Attribute mapping from ruby-style variable name to JSON key.
30
+ def self.attribute_map
31
+ {
32
+ :'identity_type' => :'identityType',
33
+ :'identity_value' => :'identityValue',
34
+ :'identity_provider' => :'identityProvider',
35
+ :'identity_provider_url' => :'identityProviderUrl'
36
+ }
37
+ end
38
+
39
+ # Attribute mapping from JSON key to ruby-style variable name.
40
+ def self.json_map
41
+ {
42
+ :'identity_type' => :'identity_type',
43
+ :'identity_value' => :'identity_value',
44
+ :'identity_provider' => :'identity_provider',
45
+ :'identity_provider_url' => :'identity_provider_url'
46
+ }
47
+ end
48
+
49
+ # Attribute type mapping.
50
+ def self.swagger_types
51
+ {
52
+ :'identity_type' => :'String',
53
+ :'identity_value' => :'String',
54
+ :'identity_provider' => :'String',
55
+ :'identity_provider_url' => :'String'
56
+ }
57
+ end
58
+
59
+ # Initializes the object
60
+ # @param [Hash] attributes Model attributes in the form of hash
61
+ def initialize(attributes = {})
62
+ return unless attributes.is_a?(Hash)
63
+
64
+ # convert string to symbol for hash key
65
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
66
+
67
+ if attributes.has_key?(:'identityType')
68
+ self.identity_type = attributes[:'identityType']
69
+ end
70
+
71
+ if attributes.has_key?(:'identityValue')
72
+ self.identity_value = attributes[:'identityValue']
73
+ end
74
+
75
+ if attributes.has_key?(:'identityProvider')
76
+ self.identity_provider = attributes[:'identityProvider']
77
+ end
78
+
79
+ if attributes.has_key?(:'identityProviderUrl')
80
+ self.identity_provider_url = attributes[:'identityProviderUrl']
81
+ end
82
+ end
83
+
84
+ # Show invalid properties with the reasons. Usually used together with valid?
85
+ # @return Array for valid properties with the reasons
86
+ def list_invalid_properties
87
+ invalid_properties = Array.new
88
+ if @identity_type.nil?
89
+ invalid_properties.push('invalid value for "identity_type", identity_type cannot be nil.')
90
+ end
91
+
92
+ if @identity_value.nil?
93
+ invalid_properties.push('invalid value for "identity_value", identity_value cannot be nil.')
94
+ end
95
+
96
+ #if @identity_value !~ Regexp.new(/(?!^[*.,'#_\/-]+$)(?!.*\\.\/.*)^.*$/)
97
+ #invalid_properties.push('invalid value for "identity_value", must conform to the pattern /(?!^[*.,'#_\/-]+$)(?!.*\\.\/.*)^.*$/.')
98
+ #end
99
+
100
+ #if !@identity_provider_url.nil? && @identity_provider_url !~ Regexp.new(/(?!^[*.,'#_\/-]+$)(?!.*\\.\/.*)^.*$/)
101
+ #invalid_properties.push('invalid value for "identity_provider_url", must conform to the pattern /(?!^[*.,'#_\/-]+$)(?!.*\\.\/.*)^.*$/.')
102
+ #end
103
+
104
+ invalid_properties
105
+ end
106
+
107
+ # Check to see if the all the properties in the model are valid
108
+ # @return true if the model is valid
109
+ def valid?
110
+ return false if @identity_type.nil?
111
+ return false if @identity_value.nil?
112
+ #return false if @identity_value !~ Regexp.new(/(?!^[*.,'#_\/-]+$)(?!.*\\.\/.*)^.*$/)
113
+ #return false if !@identity_provider_url.nil? && @identity_provider_url !~ Regexp.new(/(?!^[*.,'#_\/-]+$)(?!.*\\.\/.*)^.*$/)
114
+ true
115
+ end
116
+
117
+ # Custom attribute writer method with validation
118
+ # @param [Object] identity_value Value to be assigned
119
+ def identity_value=(identity_value)
120
+ #if identity_value.nil?
121
+ #fail ArgumentError, 'identity_value cannot be nil'
122
+ #end
123
+
124
+ #if identity_value !~ Regexp.new(/(?!^[*.,'#_\/-]+$)(?!.*\\.\/.*)^.*$/)
125
+ #fail ArgumentError, 'invalid value for "identity_value", must conform to the pattern /(?!^[*.,'#_\/-]+$)(?!.*\\.\/.*)^.*$/.'
126
+ #end
127
+
128
+ @identity_value = identity_value
129
+ end
130
+
131
+ # Custom attribute writer method with validation
132
+ # @param [Object] identity_provider_url Value to be assigned
133
+ def identity_provider_url=(identity_provider_url)
134
+ #if !identity_provider_url.nil? && identity_provider_url !~ Regexp.new(/(?!^[*.,'#_\/-]+$)(?!.*\\.\/.*)^.*$/)
135
+ #fail ArgumentError, 'invalid value for "identity_provider_url", must conform to the pattern /(?!^[*.,'#_\/-]+$)(?!.*\\.\/.*)^.*$/.'
136
+ #end
137
+
138
+ @identity_provider_url = identity_provider_url
139
+ end
140
+
141
+ # Checks equality by comparing each attribute.
142
+ # @param [Object] Object to be compared
143
+ def ==(o)
144
+ return true if self.equal?(o)
145
+ self.class == o.class &&
146
+ identity_type == o.identity_type &&
147
+ identity_value == o.identity_value &&
148
+ identity_provider == o.identity_provider &&
149
+ identity_provider_url == o.identity_provider_url
150
+ end
151
+
152
+ # @see the `==` method
153
+ # @param [Object] Object to be compared
154
+ def eql?(o)
155
+ self == o
156
+ end
157
+
158
+ # Calculates hash code according to all attributes.
159
+ # @return [Fixnum] Hash code
160
+ def hash
161
+ [identity_type, identity_value, identity_provider, identity_provider_url].hash
162
+ end
163
+
164
+ # Builds the object from hash
165
+ # @param [Hash] attributes Model attributes in the form of hash
166
+ # @return [Object] Returns the model itself
167
+ def build_from_hash(attributes)
168
+ return nil unless attributes.is_a?(Hash)
169
+ self.class.swagger_types.each_pair do |key, type|
170
+ if type =~ /\AArray<(.*)>/i
171
+ # check to ensure the input is an array given that the the attribute
172
+ # is documented as an array but the input is not
173
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
174
+ self.send("#{self.class.json_map[key]}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
175
+ end
176
+ elsif !attributes[self.class.attribute_map[key]].nil?
177
+ self.send("#{self.class.json_map[key]}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
178
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
179
+ end
180
+
181
+ self
182
+ end
183
+
184
+ # Deserializes the data based on type
185
+ # @param string type Data type
186
+ # @param string value Value to be deserialized
187
+ # @return [Object] Deserialized data
188
+ def _deserialize(type, value)
189
+ case type.to_sym
190
+ when :DateTime
191
+ DateTime.parse(value)
192
+ when :Date
193
+ Date.parse(value)
194
+ when :String
195
+ value.to_s
196
+ when :Integer
197
+ value.to_i
198
+ when :Float
199
+ value.to_f
200
+ when :BOOLEAN
201
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
202
+ true
203
+ else
204
+ false
205
+ end
206
+ when :Object
207
+ # generic object (usually a Hash), return directly
208
+ value
209
+ when /\AArray<(?<inner_type>.+)>\z/
210
+ inner_type = Regexp.last_match[:inner_type]
211
+ value.map { |v| _deserialize(inner_type, v) }
212
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
213
+ k_type = Regexp.last_match[:k_type]
214
+ v_type = Regexp.last_match[:v_type]
215
+ {}.tap do |hash|
216
+ value.each do |k, v|
217
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
218
+ end
219
+ end
220
+ else # model
221
+ temp_model = CyberSource.const_get(type).new
222
+ temp_model.build_from_hash(value)
223
+ end
224
+ end
225
+
226
+ # Returns the string representation of the object
227
+ # @return [String] String presentation of the object
228
+ def to_s
229
+ to_hash.to_s
230
+ end
231
+
232
+ # to_body is an alias to to_hash (backward compatibility)
233
+ # @return [Hash] Returns the object in the form of hash
234
+ def to_body
235
+ to_hash
236
+ end
237
+
238
+ # Returns the object in the form of hash
239
+ # @return [Hash] Returns the object in the form of hash
240
+ def to_hash
241
+ hash = {}
242
+ self.class.attribute_map.each_pair do |attr, param|
243
+ value = self.send(attr)
244
+ next if value.nil?
245
+ hash[param] = _to_hash(value)
246
+ end
247
+ hash
248
+ end
249
+
250
+ # Outputs non-array value in the form of hash
251
+ # For object, use to_hash. Otherwise, just return the value
252
+ # @param [Object] value Any valid value
253
+ # @return [Hash] Returns the value in the form of hash
254
+ def _to_hash(value)
255
+ if value.is_a?(Array)
256
+ value.compact.map { |v| _to_hash(v) }
257
+ elsif value.is_a?(Hash)
258
+ {}.tap do |hash|
259
+ value.each { |k, v| hash[k] = _to_hash(v) }
260
+ end
261
+ elsif value.respond_to? :to_hash
262
+ value.to_hash
263
+ else
264
+ value
265
+ end
266
+ end
267
+ end
268
+ end