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,228 @@
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
+ # Order information.
16
+ class Acpv1instructionsinstructionIdcredentialsOrderInformation
17
+ attr_accessor :amount_detail
18
+
19
+ attr_accessor :ship_to
20
+
21
+ attr_accessor :line_items
22
+
23
+ # (Conditional) An indication of the manner in which the purchased goods are to be delivered Possible values: - `NO_DELIVERY` - `ADDRESS_BILLING` - `ADDRESS_ON_FILE` - `ADDRESS_OTHER` - `PICKUP` - `ELECTRONIC`
24
+ attr_accessor :delivery_method
25
+
26
+ # Attribute mapping from ruby-style variable name to JSON key.
27
+ def self.attribute_map
28
+ {
29
+ :'amount_detail' => :'amountDetail',
30
+ :'ship_to' => :'shipTo',
31
+ :'line_items' => :'lineItems',
32
+ :'delivery_method' => :'deliveryMethod'
33
+ }
34
+ end
35
+
36
+ # Attribute mapping from JSON key to ruby-style variable name.
37
+ def self.json_map
38
+ {
39
+ :'amount_detail' => :'amount_detail',
40
+ :'ship_to' => :'ship_to',
41
+ :'line_items' => :'line_items',
42
+ :'delivery_method' => :'delivery_method'
43
+ }
44
+ end
45
+
46
+ # Attribute type mapping.
47
+ def self.swagger_types
48
+ {
49
+ :'amount_detail' => :'Acpv1instructionsinstructionIdcredentialsOrderInformationAmountDetail',
50
+ :'ship_to' => :'Acpv1instructionsinstructionIdcredentialsOrderInformationShipTo',
51
+ :'line_items' => :'Array<Acpv1instructionsinstructionIdcredentialsOrderInformationLineItems>',
52
+ :'delivery_method' => :'String'
53
+ }
54
+ end
55
+
56
+ # Initializes the object
57
+ # @param [Hash] attributes Model attributes in the form of hash
58
+ def initialize(attributes = {})
59
+ return unless attributes.is_a?(Hash)
60
+
61
+ # convert string to symbol for hash key
62
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
63
+
64
+ if attributes.has_key?(:'amountDetail')
65
+ self.amount_detail = attributes[:'amountDetail']
66
+ end
67
+
68
+ if attributes.has_key?(:'shipTo')
69
+ self.ship_to = attributes[:'shipTo']
70
+ end
71
+
72
+ if attributes.has_key?(:'lineItems')
73
+ if (value = attributes[:'lineItems']).is_a?(Array)
74
+ self.line_items = value
75
+ end
76
+ end
77
+
78
+ if attributes.has_key?(:'deliveryMethod')
79
+ self.delivery_method = attributes[:'deliveryMethod']
80
+ end
81
+ end
82
+
83
+ # Show invalid properties with the reasons. Usually used together with valid?
84
+ # @return Array for valid properties with the reasons
85
+ def list_invalid_properties
86
+ invalid_properties = Array.new
87
+ if @amount_detail.nil?
88
+ invalid_properties.push('invalid value for "amount_detail", amount_detail cannot be nil.')
89
+ end
90
+
91
+ invalid_properties
92
+ end
93
+
94
+ # Check to see if the all the properties in the model are valid
95
+ # @return true if the model is valid
96
+ def valid?
97
+ return false if @amount_detail.nil?
98
+ true
99
+ end
100
+
101
+ # Checks equality by comparing each attribute.
102
+ # @param [Object] Object to be compared
103
+ def ==(o)
104
+ return true if self.equal?(o)
105
+ self.class == o.class &&
106
+ amount_detail == o.amount_detail &&
107
+ ship_to == o.ship_to &&
108
+ line_items == o.line_items &&
109
+ delivery_method == o.delivery_method
110
+ end
111
+
112
+ # @see the `==` method
113
+ # @param [Object] Object to be compared
114
+ def eql?(o)
115
+ self == o
116
+ end
117
+
118
+ # Calculates hash code according to all attributes.
119
+ # @return [Fixnum] Hash code
120
+ def hash
121
+ [amount_detail, ship_to, line_items, delivery_method].hash
122
+ end
123
+
124
+ # Builds the object from hash
125
+ # @param [Hash] attributes Model attributes in the form of hash
126
+ # @return [Object] Returns the model itself
127
+ def build_from_hash(attributes)
128
+ return nil unless attributes.is_a?(Hash)
129
+ self.class.swagger_types.each_pair do |key, type|
130
+ if type =~ /\AArray<(.*)>/i
131
+ # check to ensure the input is an array given that the the attribute
132
+ # is documented as an array but the input is not
133
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
134
+ self.send("#{self.class.json_map[key]}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
135
+ end
136
+ elsif !attributes[self.class.attribute_map[key]].nil?
137
+ self.send("#{self.class.json_map[key]}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
138
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
139
+ end
140
+
141
+ self
142
+ end
143
+
144
+ # Deserializes the data based on type
145
+ # @param string type Data type
146
+ # @param string value Value to be deserialized
147
+ # @return [Object] Deserialized data
148
+ def _deserialize(type, value)
149
+ case type.to_sym
150
+ when :DateTime
151
+ DateTime.parse(value)
152
+ when :Date
153
+ Date.parse(value)
154
+ when :String
155
+ value.to_s
156
+ when :Integer
157
+ value.to_i
158
+ when :Float
159
+ value.to_f
160
+ when :BOOLEAN
161
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
162
+ true
163
+ else
164
+ false
165
+ end
166
+ when :Object
167
+ # generic object (usually a Hash), return directly
168
+ value
169
+ when /\AArray<(?<inner_type>.+)>\z/
170
+ inner_type = Regexp.last_match[:inner_type]
171
+ value.map { |v| _deserialize(inner_type, v) }
172
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
173
+ k_type = Regexp.last_match[:k_type]
174
+ v_type = Regexp.last_match[:v_type]
175
+ {}.tap do |hash|
176
+ value.each do |k, v|
177
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
178
+ end
179
+ end
180
+ else # model
181
+ temp_model = CyberSource.const_get(type).new
182
+ temp_model.build_from_hash(value)
183
+ end
184
+ end
185
+
186
+ # Returns the string representation of the object
187
+ # @return [String] String presentation of the object
188
+ def to_s
189
+ to_hash.to_s
190
+ end
191
+
192
+ # to_body is an alias to to_hash (backward compatibility)
193
+ # @return [Hash] Returns the object in the form of hash
194
+ def to_body
195
+ to_hash
196
+ end
197
+
198
+ # Returns the object in the form of hash
199
+ # @return [Hash] Returns the object in the form of hash
200
+ def to_hash
201
+ hash = {}
202
+ self.class.attribute_map.each_pair do |attr, param|
203
+ value = self.send(attr)
204
+ next if value.nil?
205
+ hash[param] = _to_hash(value)
206
+ end
207
+ hash
208
+ end
209
+
210
+ # Outputs non-array value in the form of hash
211
+ # For object, use to_hash. Otherwise, just return the value
212
+ # @param [Object] value Any valid value
213
+ # @return [Hash] Returns the value in the form of hash
214
+ def _to_hash(value)
215
+ if value.is_a?(Array)
216
+ value.compact.map { |v| _to_hash(v) }
217
+ elsif value.is_a?(Hash)
218
+ {}.tap do |hash|
219
+ value.each { |k, v| hash[k] = _to_hash(v) }
220
+ end
221
+ elsif value.respond_to? :to_hash
222
+ value.to_hash
223
+ else
224
+ value
225
+ end
226
+ end
227
+ end
228
+ end
@@ -0,0 +1,354 @@
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
+ # Amount Detail data.
16
+ class Acpv1instructionsinstructionIdcredentialsOrderInformationAmountDetail
17
+ # The final amount that the customer needs to pay or paid.
18
+ attr_accessor :total_amount
19
+
20
+ # (Conditional) ISO 4217 currency code. Currency in which the transactionAmount, subTotal, tax, Shipping& handling or discount amount is expressed. Conditionality - Required when either transactionAmount, subTotal, tax, Shipping& handling or discount amount is present.
21
+ attr_accessor :currency
22
+
23
+ # The total transaction amount before any taxes or discounts are applied.
24
+ attr_accessor :sub_total_amount
25
+
26
+ # The total discount amount applied to the transaction.
27
+ attr_accessor :discount_amount
28
+
29
+ # The total shipping and handling cost(amount) applied to the transaction.
30
+ attr_accessor :shipping_amount
31
+
32
+ # The total shipping and handling cost(amount) applied to the transaction.
33
+ attr_accessor :handling_amount
34
+
35
+ # Attribute mapping from ruby-style variable name to JSON key.
36
+ def self.attribute_map
37
+ {
38
+ :'total_amount' => :'totalAmount',
39
+ :'currency' => :'currency',
40
+ :'sub_total_amount' => :'subTotalAmount',
41
+ :'discount_amount' => :'discountAmount',
42
+ :'shipping_amount' => :'shippingAmount',
43
+ :'handling_amount' => :'handlingAmount'
44
+ }
45
+ end
46
+
47
+ # Attribute mapping from JSON key to ruby-style variable name.
48
+ def self.json_map
49
+ {
50
+ :'total_amount' => :'total_amount',
51
+ :'currency' => :'currency',
52
+ :'sub_total_amount' => :'sub_total_amount',
53
+ :'discount_amount' => :'discount_amount',
54
+ :'shipping_amount' => :'shipping_amount',
55
+ :'handling_amount' => :'handling_amount'
56
+ }
57
+ end
58
+
59
+ # Attribute type mapping.
60
+ def self.swagger_types
61
+ {
62
+ :'total_amount' => :'String',
63
+ :'currency' => :'String',
64
+ :'sub_total_amount' => :'String',
65
+ :'discount_amount' => :'String',
66
+ :'shipping_amount' => :'String',
67
+ :'handling_amount' => :'String'
68
+ }
69
+ end
70
+
71
+ # Initializes the object
72
+ # @param [Hash] attributes Model attributes in the form of hash
73
+ def initialize(attributes = {})
74
+ return unless attributes.is_a?(Hash)
75
+
76
+ # convert string to symbol for hash key
77
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
78
+
79
+ if attributes.has_key?(:'totalAmount')
80
+ self.total_amount = attributes[:'totalAmount']
81
+ end
82
+
83
+ if attributes.has_key?(:'currency')
84
+ self.currency = attributes[:'currency']
85
+ end
86
+
87
+ if attributes.has_key?(:'subTotalAmount')
88
+ self.sub_total_amount = attributes[:'subTotalAmount']
89
+ end
90
+
91
+ if attributes.has_key?(:'discountAmount')
92
+ self.discount_amount = attributes[:'discountAmount']
93
+ end
94
+
95
+ if attributes.has_key?(:'shippingAmount')
96
+ self.shipping_amount = attributes[:'shippingAmount']
97
+ end
98
+
99
+ if attributes.has_key?(:'handlingAmount')
100
+ self.handling_amount = attributes[:'handlingAmount']
101
+ end
102
+ end
103
+
104
+ # Show invalid properties with the reasons. Usually used together with valid?
105
+ # @return Array for valid properties with the reasons
106
+ def list_invalid_properties
107
+ invalid_properties = Array.new
108
+ if @total_amount.nil?
109
+ invalid_properties.push('invalid value for "total_amount", total_amount cannot be nil.')
110
+ end
111
+
112
+ #if @total_amount !~ Regexp.new(/(?!^[*.,'#_\/-]+$)(?!.*\\.\/.*)^.*$/)
113
+ #invalid_properties.push('invalid value for "total_amount", must conform to the pattern /(?!^[*.,'#_\/-]+$)(?!.*\\.\/.*)^.*$/.')
114
+ #end
115
+
116
+ if @currency.nil?
117
+ invalid_properties.push('invalid value for "currency", currency cannot be nil.')
118
+ end
119
+
120
+ #if @currency !~ Regexp.new(/(?!^[*.,'#_\/-]+$)(?!.*\\.\/.*)^.*$/)
121
+ #invalid_properties.push('invalid value for "currency", must conform to the pattern /(?!^[*.,'#_\/-]+$)(?!.*\\.\/.*)^.*$/.')
122
+ #end
123
+
124
+ #if !@sub_total_amount.nil? && @sub_total_amount !~ Regexp.new(/(?!^[*.,'#_\/-]+$)(?!.*\\.\/.*)^.*$/)
125
+ #invalid_properties.push('invalid value for "sub_total_amount", must conform to the pattern /(?!^[*.,'#_\/-]+$)(?!.*\\.\/.*)^.*$/.')
126
+ #end
127
+
128
+ #if !@discount_amount.nil? && @discount_amount !~ Regexp.new(/(?!^[*.,'#_\/-]+$)(?!.*\\.\/.*)^.*$/)
129
+ #invalid_properties.push('invalid value for "discount_amount", must conform to the pattern /(?!^[*.,'#_\/-]+$)(?!.*\\.\/.*)^.*$/.')
130
+ #end
131
+
132
+ #if !@shipping_amount.nil? && @shipping_amount !~ Regexp.new(/(?!^[*.,'#_\/-]+$)(?!.*\\.\/.*)^.+$/)
133
+ #invalid_properties.push('invalid value for "shipping_amount", must conform to the pattern /(?!^[*.,'#_\/-]+$)(?!.*\\.\/.*)^.+$/.')
134
+ #end
135
+
136
+ #if !@handling_amount.nil? && @handling_amount !~ Regexp.new(/(?!^[*.,'#_\/-]+$)(?!.*\\.\/.*)^.+$/)
137
+ #invalid_properties.push('invalid value for "handling_amount", must conform to the pattern /(?!^[*.,'#_\/-]+$)(?!.*\\.\/.*)^.+$/.')
138
+ #end
139
+
140
+ invalid_properties
141
+ end
142
+
143
+ # Check to see if the all the properties in the model are valid
144
+ # @return true if the model is valid
145
+ def valid?
146
+ return false if @total_amount.nil?
147
+ #return false if @total_amount !~ Regexp.new(/(?!^[*.,'#_\/-]+$)(?!.*\\.\/.*)^.*$/)
148
+ return false if @currency.nil?
149
+ #return false if @currency !~ Regexp.new(/(?!^[*.,'#_\/-]+$)(?!.*\\.\/.*)^.*$/)
150
+ #return false if !@sub_total_amount.nil? && @sub_total_amount !~ Regexp.new(/(?!^[*.,'#_\/-]+$)(?!.*\\.\/.*)^.*$/)
151
+ #return false if !@discount_amount.nil? && @discount_amount !~ Regexp.new(/(?!^[*.,'#_\/-]+$)(?!.*\\.\/.*)^.*$/)
152
+ #return false if !@shipping_amount.nil? && @shipping_amount !~ Regexp.new(/(?!^[*.,'#_\/-]+$)(?!.*\\.\/.*)^.+$/)
153
+ #return false if !@handling_amount.nil? && @handling_amount !~ Regexp.new(/(?!^[*.,'#_\/-]+$)(?!.*\\.\/.*)^.+$/)
154
+ true
155
+ end
156
+
157
+ # Custom attribute writer method with validation
158
+ # @param [Object] total_amount Value to be assigned
159
+ def total_amount=(total_amount)
160
+ #if total_amount.nil?
161
+ #fail ArgumentError, 'total_amount cannot be nil'
162
+ #end
163
+
164
+ #if total_amount !~ Regexp.new(/(?!^[*.,'#_\/-]+$)(?!.*\\.\/.*)^.*$/)
165
+ #fail ArgumentError, 'invalid value for "total_amount", must conform to the pattern /(?!^[*.,'#_\/-]+$)(?!.*\\.\/.*)^.*$/.'
166
+ #end
167
+
168
+ @total_amount = total_amount
169
+ end
170
+
171
+ # Custom attribute writer method with validation
172
+ # @param [Object] currency Value to be assigned
173
+ def currency=(currency)
174
+ #if currency.nil?
175
+ #fail ArgumentError, 'currency cannot be nil'
176
+ #end
177
+
178
+ #if currency !~ Regexp.new(/(?!^[*.,'#_\/-]+$)(?!.*\\.\/.*)^.*$/)
179
+ #fail ArgumentError, 'invalid value for "currency", must conform to the pattern /(?!^[*.,'#_\/-]+$)(?!.*\\.\/.*)^.*$/.'
180
+ #end
181
+
182
+ @currency = currency
183
+ end
184
+
185
+ # Custom attribute writer method with validation
186
+ # @param [Object] sub_total_amount Value to be assigned
187
+ def sub_total_amount=(sub_total_amount)
188
+ #if !sub_total_amount.nil? && sub_total_amount !~ Regexp.new(/(?!^[*.,'#_\/-]+$)(?!.*\\.\/.*)^.*$/)
189
+ #fail ArgumentError, 'invalid value for "sub_total_amount", must conform to the pattern /(?!^[*.,'#_\/-]+$)(?!.*\\.\/.*)^.*$/.'
190
+ #end
191
+
192
+ @sub_total_amount = sub_total_amount
193
+ end
194
+
195
+ # Custom attribute writer method with validation
196
+ # @param [Object] discount_amount Value to be assigned
197
+ def discount_amount=(discount_amount)
198
+ #if !discount_amount.nil? && discount_amount !~ Regexp.new(/(?!^[*.,'#_\/-]+$)(?!.*\\.\/.*)^.*$/)
199
+ #fail ArgumentError, 'invalid value for "discount_amount", must conform to the pattern /(?!^[*.,'#_\/-]+$)(?!.*\\.\/.*)^.*$/.'
200
+ #end
201
+
202
+ @discount_amount = discount_amount
203
+ end
204
+
205
+ # Custom attribute writer method with validation
206
+ # @param [Object] shipping_amount Value to be assigned
207
+ def shipping_amount=(shipping_amount)
208
+ #if !shipping_amount.nil? && shipping_amount !~ Regexp.new(/(?!^[*.,'#_\/-]+$)(?!.*\\.\/.*)^.+$/)
209
+ #fail ArgumentError, 'invalid value for "shipping_amount", must conform to the pattern /(?!^[*.,'#_\/-]+$)(?!.*\\.\/.*)^.+$/.'
210
+ #end
211
+
212
+ @shipping_amount = shipping_amount
213
+ end
214
+
215
+ # Custom attribute writer method with validation
216
+ # @param [Object] handling_amount Value to be assigned
217
+ def handling_amount=(handling_amount)
218
+ #if !handling_amount.nil? && handling_amount !~ Regexp.new(/(?!^[*.,'#_\/-]+$)(?!.*\\.\/.*)^.+$/)
219
+ #fail ArgumentError, 'invalid value for "handling_amount", must conform to the pattern /(?!^[*.,'#_\/-]+$)(?!.*\\.\/.*)^.+$/.'
220
+ #end
221
+
222
+ @handling_amount = handling_amount
223
+ end
224
+
225
+ # Checks equality by comparing each attribute.
226
+ # @param [Object] Object to be compared
227
+ def ==(o)
228
+ return true if self.equal?(o)
229
+ self.class == o.class &&
230
+ total_amount == o.total_amount &&
231
+ currency == o.currency &&
232
+ sub_total_amount == o.sub_total_amount &&
233
+ discount_amount == o.discount_amount &&
234
+ shipping_amount == o.shipping_amount &&
235
+ handling_amount == o.handling_amount
236
+ end
237
+
238
+ # @see the `==` method
239
+ # @param [Object] Object to be compared
240
+ def eql?(o)
241
+ self == o
242
+ end
243
+
244
+ # Calculates hash code according to all attributes.
245
+ # @return [Fixnum] Hash code
246
+ def hash
247
+ [total_amount, currency, sub_total_amount, discount_amount, shipping_amount, handling_amount].hash
248
+ end
249
+
250
+ # Builds the object from hash
251
+ # @param [Hash] attributes Model attributes in the form of hash
252
+ # @return [Object] Returns the model itself
253
+ def build_from_hash(attributes)
254
+ return nil unless attributes.is_a?(Hash)
255
+ self.class.swagger_types.each_pair do |key, type|
256
+ if type =~ /\AArray<(.*)>/i
257
+ # check to ensure the input is an array given that the the attribute
258
+ # is documented as an array but the input is not
259
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
260
+ self.send("#{self.class.json_map[key]}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
261
+ end
262
+ elsif !attributes[self.class.attribute_map[key]].nil?
263
+ self.send("#{self.class.json_map[key]}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
264
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
265
+ end
266
+
267
+ self
268
+ end
269
+
270
+ # Deserializes the data based on type
271
+ # @param string type Data type
272
+ # @param string value Value to be deserialized
273
+ # @return [Object] Deserialized data
274
+ def _deserialize(type, value)
275
+ case type.to_sym
276
+ when :DateTime
277
+ DateTime.parse(value)
278
+ when :Date
279
+ Date.parse(value)
280
+ when :String
281
+ value.to_s
282
+ when :Integer
283
+ value.to_i
284
+ when :Float
285
+ value.to_f
286
+ when :BOOLEAN
287
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
288
+ true
289
+ else
290
+ false
291
+ end
292
+ when :Object
293
+ # generic object (usually a Hash), return directly
294
+ value
295
+ when /\AArray<(?<inner_type>.+)>\z/
296
+ inner_type = Regexp.last_match[:inner_type]
297
+ value.map { |v| _deserialize(inner_type, v) }
298
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
299
+ k_type = Regexp.last_match[:k_type]
300
+ v_type = Regexp.last_match[:v_type]
301
+ {}.tap do |hash|
302
+ value.each do |k, v|
303
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
304
+ end
305
+ end
306
+ else # model
307
+ temp_model = CyberSource.const_get(type).new
308
+ temp_model.build_from_hash(value)
309
+ end
310
+ end
311
+
312
+ # Returns the string representation of the object
313
+ # @return [String] String presentation of the object
314
+ def to_s
315
+ to_hash.to_s
316
+ end
317
+
318
+ # to_body is an alias to to_hash (backward compatibility)
319
+ # @return [Hash] Returns the object in the form of hash
320
+ def to_body
321
+ to_hash
322
+ end
323
+
324
+ # Returns the object in the form of hash
325
+ # @return [Hash] Returns the object in the form of hash
326
+ def to_hash
327
+ hash = {}
328
+ self.class.attribute_map.each_pair do |attr, param|
329
+ value = self.send(attr)
330
+ next if value.nil?
331
+ hash[param] = _to_hash(value)
332
+ end
333
+ hash
334
+ end
335
+
336
+ # Outputs non-array value in the form of hash
337
+ # For object, use to_hash. Otherwise, just return the value
338
+ # @param [Object] value Any valid value
339
+ # @return [Hash] Returns the value in the form of hash
340
+ def _to_hash(value)
341
+ if value.is_a?(Array)
342
+ value.compact.map { |v| _to_hash(v) }
343
+ elsif value.is_a?(Hash)
344
+ {}.tap do |hash|
345
+ value.each { |k, v| hash[k] = _to_hash(v) }
346
+ end
347
+ elsif value.respond_to? :to_hash
348
+ value.to_hash
349
+ else
350
+ value
351
+ end
352
+ end
353
+ end
354
+ end