cybersource_rest_client 0.0.17 → 0.0.19

Sign up to get free protection for your applications and to get access to all the features.
Files changed (145) hide show
  1. checksums.yaml +4 -4
  2. data/lib/AuthenticationSDK/core/MerchantConfig.rb +2 -0
  3. data/lib/cybersource_rest_client.rb +81 -5
  4. data/lib/cybersource_rest_client/api/authentication_exemptions_api.rb +89 -0
  5. data/lib/cybersource_rest_client/api/payer_authentication_api.rb +154 -0
  6. data/lib/cybersource_rest_client/api/report_definitions_api.rb +9 -0
  7. data/lib/cybersource_rest_client/api/report_downloads_api.rb +3 -0
  8. data/lib/cybersource_rest_client/api/report_subscriptions_api.rb +79 -0
  9. data/lib/cybersource_rest_client/api/reports_api.rb +2 -2
  10. data/lib/cybersource_rest_client/api_client.rb +12 -0
  11. data/lib/cybersource_rest_client/models/authentication_exemptions_request.rb +228 -0
  12. data/lib/cybersource_rest_client/models/buyer_information.rb +20 -20
  13. data/lib/cybersource_rest_client/models/check_payer_auth_enrollment_request.rb +284 -0
  14. data/lib/cybersource_rest_client/models/create_payment_instrument_request.rb +2 -41
  15. data/lib/cybersource_rest_client/models/create_report_subscription_request.rb +27 -2
  16. data/lib/cybersource_rest_client/models/embedded_instrument_identifier_request.rb +226 -0
  17. data/lib/cybersource_rest_client/models/{embedded_instrument_identifier.rb → embedded_instrument_identifier_response.rb} +11 -2
  18. data/lib/cybersource_rest_client/models/{tms_v1_instrument_identifiers_delete409_response__links_payment_instruments.rb → instrument_identifier_payment_instruments_link.rb} +1 -1
  19. data/lib/cybersource_rest_client/models/{instrument_identifier.rb → instrument_identifier_response.rb} +11 -2
  20. data/lib/cybersource_rest_client/models/issuer.rb +208 -0
  21. data/lib/cybersource_rest_client/models/links.rb +10 -1
  22. data/lib/cybersource_rest_client/models/model_409_links.rb +1 -1
  23. data/lib/cybersource_rest_client/models/payment_instrument.rb +9 -9
  24. data/lib/cybersource_rest_client/models/payment_instrument_card.rb +2 -2
  25. data/lib/cybersource_rest_client/models/payment_instrument_instrument_identifier_request.rb +246 -0
  26. data/lib/cybersource_rest_client/models/payment_instrument_self_link.rb +183 -0
  27. data/lib/cybersource_rest_client/models/payment_instruments_links.rb +183 -0
  28. data/lib/cybersource_rest_client/models/personal_identification.rb +1 -1
  29. data/lib/cybersource_rest_client/models/predefined_subscription_request_bean.rb +392 -0
  30. data/lib/cybersource_rest_client/models/pts_v2_payments_post201_response_installment_information.rb +225 -0
  31. data/lib/cybersource_rest_client/models/pts_v2_payments_post201_response_payment_information_tokenized_card.rb +1 -1
  32. data/lib/cybersource_rest_client/models/pts_v2_payments_post201_response_point_of_sale_information_emv.rb +2 -2
  33. data/lib/cybersource_rest_client/models/pts_v2_payouts_post201_response_merchant_information_merchant_descriptor.rb +0 -15
  34. data/lib/cybersource_rest_client/models/ptsv2credits_processing_information.rb +2 -2
  35. data/lib/cybersource_rest_client/models/ptsv2payments_aggregator_information_sub_merchant.rb +1 -1
  36. data/lib/cybersource_rest_client/models/ptsv2payments_installment_information.rb +60 -0
  37. data/lib/cybersource_rest_client/models/ptsv2payments_merchant_information_merchant_descriptor.rb +22 -27
  38. data/lib/cybersource_rest_client/models/ptsv2payments_order_information_amount_details.rb +2 -2
  39. data/lib/cybersource_rest_client/models/ptsv2payments_order_information_bill_to.rb +26 -1
  40. data/lib/cybersource_rest_client/models/ptsv2payments_order_information_line_items.rb +4 -4
  41. data/lib/cybersource_rest_client/models/ptsv2payments_payment_information_card.rb +2 -2
  42. data/lib/cybersource_rest_client/models/ptsv2payments_payment_information_tokenized_card.rb +1 -1
  43. data/lib/cybersource_rest_client/models/ptsv2payments_processing_information.rb +2 -2
  44. data/lib/cybersource_rest_client/models/ptsv2paymentsidcaptures_aggregator_information_sub_merchant.rb +1 -1
  45. data/lib/cybersource_rest_client/models/ptsv2paymentsidcaptures_installment_information.rb +270 -0
  46. data/lib/cybersource_rest_client/models/ptsv2paymentsidcaptures_order_information_amount_details.rb +2 -2
  47. data/lib/cybersource_rest_client/models/ptsv2paymentsidcaptures_processing_information.rb +1 -1
  48. data/lib/cybersource_rest_client/models/ptsv2paymentsidrefunds_payment_information_card.rb +2 -2
  49. data/lib/cybersource_rest_client/models/ptsv2payouts_merchant_information_merchant_descriptor.rb +0 -30
  50. data/lib/cybersource_rest_client/models/ptsv2payouts_payment_information_card.rb +2 -2
  51. data/lib/cybersource_rest_client/models/ptsv2payouts_processing_information.rb +2 -2
  52. data/lib/cybersource_rest_client/models/ptsv2payouts_processing_information_payouts_options.rb +1 -1
  53. data/lib/cybersource_rest_client/models/reporting_v3_report_definitions_get200_response_report_definitions.rb +23 -4
  54. data/lib/cybersource_rest_client/models/reporting_v3_report_definitions_name_get200_response.rb +23 -4
  55. data/lib/cybersource_rest_client/models/reporting_v3_report_definitions_name_get200_response_default_settings.rb +255 -0
  56. data/lib/cybersource_rest_client/models/reporting_v3_report_subscriptions_get200_response_subscriptions.rb +27 -2
  57. data/lib/cybersource_rest_client/models/reporting_v3_reports_get200_response__link.rb +183 -0
  58. data/lib/cybersource_rest_client/models/reporting_v3_reports_get200_response__link_report_download.rb +192 -0
  59. data/lib/cybersource_rest_client/models/reporting_v3_reports_get200_response_report_search_results.rb +13 -4
  60. data/lib/cybersource_rest_client/models/request.rb +210 -0
  61. data/lib/cybersource_rest_client/models/risk_v1_authentication_excemptions_post400_response.rb +225 -0
  62. data/lib/cybersource_rest_client/models/risk_v1_authentication_exemptions_consumer_authentication_information_strong_authentication.rb +269 -0
  63. data/lib/cybersource_rest_client/models/risk_v1_authentication_exemptions_post201_response.rb +255 -0
  64. data/lib/cybersource_rest_client/models/risk_v1_authentication_exemptions_post201_response_consumer_authentication_information.rb +183 -0
  65. data/lib/cybersource_rest_client/models/risk_v1_authentication_exemptions_post201_response_risk_information.rb +199 -0
  66. data/lib/cybersource_rest_client/models/risk_v1_authentication_results_post201_response.rb +285 -0
  67. data/lib/cybersource_rest_client/models/risk_v1_authentication_results_post201_response_consumer_authentication_information.rb +324 -0
  68. data/lib/cybersource_rest_client/models/risk_v1_authentications_post201_response.rb +294 -0
  69. data/lib/cybersource_rest_client/models/risk_v1_authentications_post201_response_consumer_authentication_information.rb +444 -0
  70. data/lib/cybersource_rest_client/models/risk_v1_authentications_post201_response_order_information.rb +183 -0
  71. data/lib/cybersource_rest_client/models/risk_v1_authentications_post201_response_order_information_amount_details.rb +199 -0
  72. data/lib/cybersource_rest_client/models/riskv1authenticationexemptions_acquirer_information.rb +199 -0
  73. data/lib/cybersource_rest_client/models/riskv1authenticationexemptions_device_information.rb +183 -0
  74. data/lib/cybersource_rest_client/models/riskv1authenticationexemptions_merchant_information.rb +258 -0
  75. data/lib/cybersource_rest_client/models/riskv1authenticationexemptions_merchant_information_merchant_descriptor.rb +229 -0
  76. data/lib/cybersource_rest_client/models/riskv1authenticationexemptions_order_information.rb +212 -0
  77. data/lib/cybersource_rest_client/models/riskv1authenticationexemptions_order_information_bill_to.rb +496 -0
  78. data/lib/cybersource_rest_client/models/riskv1authenticationexemptions_order_information_line_items.rb +283 -0
  79. data/lib/cybersource_rest_client/models/riskv1authenticationexemptions_order_information_ship_to.rb +399 -0
  80. data/lib/cybersource_rest_client/models/riskv1authenticationexemptions_payment_information.rb +192 -0
  81. data/lib/cybersource_rest_client/models/riskv1authenticationexemptions_payment_information_card.rb +325 -0
  82. data/lib/cybersource_rest_client/models/riskv1authenticationexemptions_payment_information_tokenized_card.rb +291 -0
  83. data/lib/cybersource_rest_client/models/riskv1authenticationresults_consumer_authentication_information.rb +524 -0
  84. data/lib/cybersource_rest_client/models/riskv1authenticationresults_order_information.rb +194 -0
  85. data/lib/cybersource_rest_client/models/riskv1authenticationresults_order_information_line_items.rb +267 -0
  86. data/lib/cybersource_rest_client/models/riskv1authenticationresults_payment_information.rb +192 -0
  87. data/lib/cybersource_rest_client/models/riskv1authenticationresults_payment_information_card.rb +298 -0
  88. data/lib/cybersource_rest_client/models/riskv1authenticationresults_payment_information_tokenized_card.rb +264 -0
  89. data/lib/cybersource_rest_client/models/riskv1authentications_acquirer_information.rb +274 -0
  90. data/lib/cybersource_rest_client/models/riskv1authentications_buyer_information.rb +196 -0
  91. data/lib/cybersource_rest_client/models/riskv1authentications_client_reference_information.rb +208 -0
  92. data/lib/cybersource_rest_client/models/riskv1authentications_consumer_authentication_information.rb +1359 -0
  93. data/lib/cybersource_rest_client/models/riskv1authentications_consumer_authentication_information_ivr.rb +319 -0
  94. data/lib/cybersource_rest_client/models/riskv1authentications_consumer_authentication_information_strong_authentication.rb +199 -0
  95. data/lib/cybersource_rest_client/models/riskv1authentications_device_information.rb +430 -0
  96. data/lib/cybersource_rest_client/models/riskv1authentications_device_information_raw_data.rb +209 -0
  97. data/lib/cybersource_rest_client/models/riskv1authentications_merchant_information.rb +208 -0
  98. data/lib/cybersource_rest_client/models/{tss_v2_transactions_get200_response_payment_information_payment_type_funding_source.rb → riskv1authentications_merchant_information_merchant_descriptor.rb} +25 -40
  99. data/lib/cybersource_rest_client/models/riskv1authentications_order_information.rb +283 -0
  100. data/lib/cybersource_rest_client/models/riskv1authentications_order_information_line_items.rb +396 -0
  101. data/lib/cybersource_rest_client/models/riskv1authentications_order_information_ship_to.rb +459 -0
  102. data/lib/cybersource_rest_client/models/riskv1authentications_recurring_payment_information.rb +235 -0
  103. data/lib/cybersource_rest_client/models/riskv1authentications_risk_information.rb +183 -0
  104. data/lib/cybersource_rest_client/models/riskv1authentications_risk_information_buyer_history.rb +262 -0
  105. data/lib/cybersource_rest_client/models/riskv1authentications_risk_information_buyer_history_account_history.rb +209 -0
  106. data/lib/cybersource_rest_client/models/riskv1authentications_risk_information_buyer_history_customer_account.rb +279 -0
  107. data/lib/cybersource_rest_client/models/riskv1authentications_travel_information.rb +206 -0
  108. data/lib/cybersource_rest_client/models/riskv1authentications_travel_information_legs.rb +259 -0
  109. data/lib/cybersource_rest_client/models/riskv1authentications_travel_information_passengers.rb +224 -0
  110. data/lib/cybersource_rest_client/models/riskv1decisions_device_information.rb +26 -1
  111. data/lib/cybersource_rest_client/models/riskv1decisions_order_information.rb +13 -4
  112. data/lib/cybersource_rest_client/models/riskv1decisions_order_information_address.rb +325 -0
  113. data/lib/cybersource_rest_client/models/riskv1decisions_order_information_bill_to.rb +26 -1
  114. data/lib/cybersource_rest_client/models/riskv1decisions_payment_information.rb +13 -4
  115. data/lib/cybersource_rest_client/models/riskv1decisions_payment_information_bank.rb +275 -0
  116. data/lib/cybersource_rest_client/models/riskv1decisions_payment_information_card.rb +2 -2
  117. data/lib/cybersource_rest_client/models/riskv1decisions_payment_information_tokenized_card.rb +1 -1
  118. data/lib/cybersource_rest_client/models/riskv1decisions_risk_information.rb +13 -4
  119. data/lib/cybersource_rest_client/models/riskv1decisions_risk_information_marking_details.rb +275 -0
  120. data/lib/cybersource_rest_client/models/tms_v1_instrument_identifiers_delete409_response__links.rb +1 -1
  121. data/lib/cybersource_rest_client/models/{tms_v1_instrument_identifiers_payment_instruments_get200_response_instrument_identifier.rb → tms_v1_instrument_identifiers_payment_instruments_embedded_instrument_identifier.rb} +11 -2
  122. data/lib/cybersource_rest_client/models/tms_v1_instrument_identifiers_payment_instruments_get200_response__embedded__embedded.rb +183 -0
  123. data/lib/cybersource_rest_client/models/tms_v1_instrument_identifiers_payment_instruments_get200_response__embedded__links.rb +183 -0
  124. data/lib/cybersource_rest_client/models/tms_v1_instrument_identifiers_payment_instruments_get200_response__embedded__links_self.rb +183 -0
  125. data/lib/cybersource_rest_client/models/tms_v1_instrument_identifiers_payment_instruments_get200_response__embedded_buyer_information.rb +20 -20
  126. data/lib/cybersource_rest_client/models/tms_v1_instrument_identifiers_payment_instruments_get200_response__embedded_card.rb +2 -2
  127. data/lib/cybersource_rest_client/models/tms_v1_instrument_identifiers_payment_instruments_get200_response_payment_instruments.rb +9 -9
  128. data/lib/cybersource_rest_client/models/tms_v1_instrument_identifiers_payment_instruments_get200_response_personal_identification.rb +1 -1
  129. data/lib/cybersource_rest_client/models/tms_v1_instrument_identifiers_post200_response.rb +10 -1
  130. data/lib/cybersource_rest_client/models/tms_v1_instrument_identifiers_post200_response__links.rb +10 -1
  131. data/lib/cybersource_rest_client/models/tms_v1_instrument_identifiers_post200_response__links_payment_instruments.rb +183 -0
  132. data/lib/cybersource_rest_client/models/tms_v1_instrument_identifiers_post200_response_issuer.rb +208 -0
  133. data/lib/cybersource_rest_client/models/tmsv1instrumentidentifiers_card.rb +1 -1
  134. data/lib/cybersource_rest_client/models/tmsv1paymentinstruments_instrument_identifier.rb +226 -0
  135. data/lib/cybersource_rest_client/models/tss_v2_transactions_get200_response_application_information_applications.rb +1 -1
  136. data/lib/cybersource_rest_client/models/tss_v2_transactions_get200_response_client_reference_information.rb +3 -3
  137. data/lib/cybersource_rest_client/models/tss_v2_transactions_get200_response_payment_information_card.rb +1 -1
  138. data/lib/cybersource_rest_client/models/tss_v2_transactions_get200_response_payment_information_payment_type.rb +12 -31
  139. data/lib/cybersource_rest_client/models/tss_v2_transactions_get200_response_processing_information.rb +1 -1
  140. data/lib/cybersource_rest_client/models/tss_v2_transactions_post201_response__embedded_client_reference_information.rb +2 -2
  141. data/lib/cybersource_rest_client/models/tss_v2_transactions_post201_response__embedded_payment_information_card.rb +1 -1
  142. data/lib/cybersource_rest_client/models/tss_v2_transactions_post201_response__embedded_payment_information_payment_type.rb +9 -9
  143. data/lib/cybersource_rest_client/models/update_payment_instrument_request.rb +2 -41
  144. data/lib/cybersource_rest_client/utilities/flex/token_verification.rb +42 -0
  145. metadata +79 -7
@@ -0,0 +1,396 @@
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 Riskv1authenticationsOrderInformationLineItems
17
+ # Total amount for the item. Normally calculated as the unit price times quantity. When `orderInformation.lineItems[].productCode` is \"gift_card\", this is the purchase amount total for prepaid gift cards in major units. Example: 123.45 USD = 123
18
+ attr_accessor :total_amount
19
+
20
+ # Per-item price of the product. This value cannot be negative. You can include a decimal point (.), but you cannot include any other special characters. CyberSource truncates the amount to the correct number of decimal places. For processor-specific information, see the `amount` field description in [Credit Card Services Using the SCMP API.](http://apps.cybersource.com/library/documentation/dev_guides/CC_Svcs_SCMP_API/html) **Important** Some processors have specific requirements and limitations, such as maximum amounts and maximum field lengths. See these guides for details: - [Merchant Descriptors Using the SCMP API Guide] (https://apps.cybersource.com/library/documentation/dev_guides/Merchant_Descriptors_SCMP_API/html/wwhelp/wwhimpl/js/html/wwhelp.htm) - \"Capture Information for Specific Processors\" section in the [Credit Card Services Using the SCMP API Guide](https://apps.cybersource.com/library/documentation/dev_guides/CC_Svcs_SCMP_API/html/wwhelp/wwhimpl/js/html/wwhelp.htm) #### DCC with a Third-Party Provider Set this field to the converted amount that was returned by the DCC provider. You must include either the 1st line item in the order and this field, or the request-level field `orderInformation.amountDetails.totalAmount` in your request. For details, see \"Dynamic Currency Conversion with a Third Party Provider\" in the [Credit Card Services Using the SCMP API Guide.](https://apps.cybersource.com/library/documentation/dev_guides/CC_Svcs_SCMP_API/html/wwhelp/wwhimpl/js/html/wwhelp.htm) #### FDMS South If you accept IDR or CLP currencies, see the entry for FDMS South in the [Merchant Descriptors Using the SCMP API Guide.] (https://apps.cybersource.com/library/documentation/dev_guides/Merchant_Descriptors_SCMP_API/html/wwhelp/wwhimpl/js/html/wwhelp.htm) #### Zero Amount Authorizations If your processor supports zero amount authorizations, you can set this field to 0 for the authorization to check if the card is lost or stolen. See \"Zero Amount Authorizations\" in the [Credit Card Services Using the SCMP API Guide.](https://apps.cybersource.com/library/documentation/dev_guides/CC_Svcs_SCMP_API/html/wwhelp/wwhimpl/js/html/wwhelp.htm)
21
+ attr_accessor :unit_price
22
+
23
+ # Number of units for this order. The default is `1`. For an authorization or capture transaction (`processingOptions.capture` is set to `true` or `false`), this field is required when _orderInformation.lineItems[].productCode_ is not set to **default** or one of the other values that are related to shipping and/or handling. When orderInformation.lineItems[].productCode is \"gift_card\", this is the total count of individual prepaid gift cards purchased.
24
+ attr_accessor :quantity
25
+
26
+ # When `orderInformation.lineItems[].productCode` is \"gift_card\", this is the currency used for the gift card purchase. For details, see `pa_gift_card_currency` field description in [CyberSource Payer Authentication Using the SCMP API.] (https://apps.cybersource.com/library/documentation/dev_guides/Payer_Authentication_SCMP_API/Payer_Authentication_SCMP_API.pdf) For the possible values, see the [ISO Standard Currency Codes.](http://apps.cybersource.com/library/documentation/sbc/quickref/currencies.pdf)
27
+ attr_accessor :gift_card_currency
28
+
29
+ # Stock Keeping Unit (SKU) code for the product. For an authorization or capture transaction (`processingOptions.capture` is set to `true` or `false`), this field is required when _orderInformation.lineItems[].productCode_ is not set to **default** or one of the other values that are related to shipping and/or handling.
30
+ attr_accessor :product_sku
31
+
32
+ # Brief description of item.
33
+ attr_accessor :product_description
34
+
35
+ # For an authorization or capture transaction (`processingOptions.capture` is set to `true` or `false`), this field is required when `orderInformation.lineItems[].productCode` is not set to `default` or one of the other values that are related to shipping and/or handling.
36
+ attr_accessor :product_name
37
+
38
+ attr_accessor :passenger
39
+
40
+ # Destination to where the item will be shipped. Example: Commercial, Residential, Store
41
+ attr_accessor :shipping_destination_types
42
+
43
+ # Total tax to apply to the product. This value cannot be negative. The tax amount and the offer amount must be in the same currency. The tax amount field is additive. The following example uses a two-exponent currency such as USD: 1. You include each line item in your request. ..- 1st line item has amount=10.00, quantity=1, and taxAmount=0.80 ..- 2nd line item has amount=20.00, quantity=1, and taxAmount=1.60 2. The total amount authorized will be 32.40, not 30.00 with 2.40 of tax included. If you want to include the tax amount and also request the ics_tax service, see Tax Calculation Service Using the SCMP API. This field is frequently used for Level II and Level III transactions. For details, see `tax_amount` field description in [Level II and Level III Processing Using the SCMP API.](https://apps.cybersource.com/library/documentation/dev_guides/Level_2_3_SCMP_API/html/wwhelp/wwhimpl/js/html/wwhelp.htm)
44
+ attr_accessor :tax_amount
45
+
46
+ # Attribute mapping from ruby-style variable name to JSON key.
47
+ def self.attribute_map
48
+ {
49
+ :'total_amount' => :'totalAmount',
50
+ :'unit_price' => :'unitPrice',
51
+ :'quantity' => :'quantity',
52
+ :'gift_card_currency' => :'giftCardCurrency',
53
+ :'product_sku' => :'productSKU',
54
+ :'product_description' => :'productDescription',
55
+ :'product_name' => :'productName',
56
+ :'passenger' => :'passenger',
57
+ :'shipping_destination_types' => :'shippingDestinationTypes',
58
+ :'tax_amount' => :'taxAmount'
59
+ }
60
+ end
61
+
62
+ # Attribute type mapping.
63
+ def self.swagger_types
64
+ {
65
+ :'total_amount' => :'String',
66
+ :'unit_price' => :'String',
67
+ :'quantity' => :'Integer',
68
+ :'gift_card_currency' => :'Integer',
69
+ :'product_sku' => :'String',
70
+ :'product_description' => :'String',
71
+ :'product_name' => :'String',
72
+ :'passenger' => :'Riskv1decisionsOrderInformationPassenger',
73
+ :'shipping_destination_types' => :'String',
74
+ :'tax_amount' => :'String'
75
+ }
76
+ end
77
+
78
+ # Initializes the object
79
+ # @param [Hash] attributes Model attributes in the form of hash
80
+ def initialize(attributes = {})
81
+ return unless attributes.is_a?(Hash)
82
+
83
+ # convert string to symbol for hash key
84
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
85
+
86
+ if attributes.has_key?(:'totalAmount')
87
+ self.total_amount = attributes[:'totalAmount']
88
+ end
89
+
90
+ if attributes.has_key?(:'unitPrice')
91
+ self.unit_price = attributes[:'unitPrice']
92
+ end
93
+
94
+ if attributes.has_key?(:'quantity')
95
+ self.quantity = attributes[:'quantity']
96
+ end
97
+
98
+ if attributes.has_key?(:'giftCardCurrency')
99
+ self.gift_card_currency = attributes[:'giftCardCurrency']
100
+ end
101
+
102
+ if attributes.has_key?(:'productSKU')
103
+ self.product_sku = attributes[:'productSKU']
104
+ end
105
+
106
+ if attributes.has_key?(:'productDescription')
107
+ self.product_description = attributes[:'productDescription']
108
+ end
109
+
110
+ if attributes.has_key?(:'productName')
111
+ self.product_name = attributes[:'productName']
112
+ end
113
+
114
+ if attributes.has_key?(:'passenger')
115
+ self.passenger = attributes[:'passenger']
116
+ end
117
+
118
+ if attributes.has_key?(:'shippingDestinationTypes')
119
+ self.shipping_destination_types = attributes[:'shippingDestinationTypes']
120
+ end
121
+
122
+ if attributes.has_key?(:'taxAmount')
123
+ self.tax_amount = attributes[:'taxAmount']
124
+ end
125
+ end
126
+
127
+ # Show invalid properties with the reasons. Usually used together with valid?
128
+ # @return Array for valid properties with the reasons
129
+ def list_invalid_properties
130
+ invalid_properties = Array.new
131
+ if !@total_amount.nil? && @total_amount.to_s.length > 13
132
+ invalid_properties.push('invalid value for "total_amount", the character length must be smaller than or equal to 13.')
133
+ end
134
+
135
+ if @unit_price.nil?
136
+ invalid_properties.push('invalid value for "unit_price", unit_price cannot be nil.')
137
+ end
138
+
139
+ if @unit_price.to_s.length > 15
140
+ invalid_properties.push('invalid value for "unit_price", the character length must be smaller than or equal to 15.')
141
+ end
142
+
143
+ if !@quantity.nil? && @quantity > 999999999
144
+ invalid_properties.push('invalid value for "quantity", must be smaller than or equal to 999999999.')
145
+ end
146
+
147
+ if !@quantity.nil? && @quantity < 1
148
+ invalid_properties.push('invalid value for "quantity", must be greater than or equal to 1.')
149
+ end
150
+
151
+ if !@product_sku.nil? && @product_sku.to_s.length > 255
152
+ invalid_properties.push('invalid value for "product_sku", the character length must be smaller than or equal to 255.')
153
+ end
154
+
155
+ if !@product_name.nil? && @product_name.to_s.length > 255
156
+ invalid_properties.push('invalid value for "product_name", the character length must be smaller than or equal to 255.')
157
+ end
158
+
159
+ if !@shipping_destination_types.nil? && @shipping_destination_types.to_s.length > 50
160
+ invalid_properties.push('invalid value for "shipping_destination_types", the character length must be smaller than or equal to 50.')
161
+ end
162
+
163
+ if !@tax_amount.nil? && @tax_amount.to_s.length > 15
164
+ invalid_properties.push('invalid value for "tax_amount", the character length must be smaller than or equal to 15.')
165
+ end
166
+
167
+ invalid_properties
168
+ end
169
+
170
+ # Check to see if the all the properties in the model are valid
171
+ # @return true if the model is valid
172
+ def valid?
173
+ return false if !@total_amount.nil? && @total_amount.to_s.length > 13
174
+ return false if @unit_price.nil?
175
+ return false if @unit_price.to_s.length > 15
176
+ return false if !@quantity.nil? && @quantity > 999999999
177
+ return false if !@quantity.nil? && @quantity < 1
178
+ return false if !@product_sku.nil? && @product_sku.to_s.length > 255
179
+ return false if !@product_name.nil? && @product_name.to_s.length > 255
180
+ return false if !@shipping_destination_types.nil? && @shipping_destination_types.to_s.length > 50
181
+ return false if !@tax_amount.nil? && @tax_amount.to_s.length > 15
182
+ true
183
+ end
184
+
185
+ # Custom attribute writer method with validation
186
+ # @param [Object] total_amount Value to be assigned
187
+ def total_amount=(total_amount)
188
+ if !total_amount.nil? && total_amount.to_s.length > 13
189
+ fail ArgumentError, 'invalid value for "total_amount", the character length must be smaller than or equal to 13.'
190
+ end
191
+
192
+ @total_amount = total_amount
193
+ end
194
+
195
+ # Custom attribute writer method with validation
196
+ # @param [Object] unit_price Value to be assigned
197
+ def unit_price=(unit_price)
198
+ if unit_price.nil?
199
+ fail ArgumentError, 'unit_price cannot be nil'
200
+ end
201
+
202
+ if unit_price.to_s.length > 15
203
+ fail ArgumentError, 'invalid value for "unit_price", the character length must be smaller than or equal to 15.'
204
+ end
205
+
206
+ @unit_price = unit_price
207
+ end
208
+
209
+ # Custom attribute writer method with validation
210
+ # @param [Object] quantity Value to be assigned
211
+ def quantity=(quantity)
212
+ if !quantity.nil? && quantity > 999999999
213
+ fail ArgumentError, 'invalid value for "quantity", must be smaller than or equal to 999999999.'
214
+ end
215
+
216
+ if !quantity.nil? && quantity < 1
217
+ fail ArgumentError, 'invalid value for "quantity", must be greater than or equal to 1.'
218
+ end
219
+
220
+ @quantity = quantity
221
+ end
222
+
223
+ # Custom attribute writer method with validation
224
+ # @param [Object] product_sku Value to be assigned
225
+ def product_sku=(product_sku)
226
+ if !product_sku.nil? && product_sku.to_s.length > 255
227
+ fail ArgumentError, 'invalid value for "product_sku", the character length must be smaller than or equal to 255.'
228
+ end
229
+
230
+ @product_sku = product_sku
231
+ end
232
+
233
+ # Custom attribute writer method with validation
234
+ # @param [Object] product_name Value to be assigned
235
+ def product_name=(product_name)
236
+ if !product_name.nil? && product_name.to_s.length > 255
237
+ fail ArgumentError, 'invalid value for "product_name", the character length must be smaller than or equal to 255.'
238
+ end
239
+
240
+ @product_name = product_name
241
+ end
242
+
243
+ # Custom attribute writer method with validation
244
+ # @param [Object] shipping_destination_types Value to be assigned
245
+ def shipping_destination_types=(shipping_destination_types)
246
+ if !shipping_destination_types.nil? && shipping_destination_types.to_s.length > 50
247
+ fail ArgumentError, 'invalid value for "shipping_destination_types", the character length must be smaller than or equal to 50.'
248
+ end
249
+
250
+ @shipping_destination_types = shipping_destination_types
251
+ end
252
+
253
+ # Custom attribute writer method with validation
254
+ # @param [Object] tax_amount Value to be assigned
255
+ def tax_amount=(tax_amount)
256
+ if !tax_amount.nil? && tax_amount.to_s.length > 15
257
+ fail ArgumentError, 'invalid value for "tax_amount", the character length must be smaller than or equal to 15.'
258
+ end
259
+
260
+ @tax_amount = tax_amount
261
+ end
262
+
263
+ # Checks equality by comparing each attribute.
264
+ # @param [Object] Object to be compared
265
+ def ==(o)
266
+ return true if self.equal?(o)
267
+ self.class == o.class &&
268
+ total_amount == o.total_amount &&
269
+ unit_price == o.unit_price &&
270
+ quantity == o.quantity &&
271
+ gift_card_currency == o.gift_card_currency &&
272
+ product_sku == o.product_sku &&
273
+ product_description == o.product_description &&
274
+ product_name == o.product_name &&
275
+ passenger == o.passenger &&
276
+ shipping_destination_types == o.shipping_destination_types &&
277
+ tax_amount == o.tax_amount
278
+ end
279
+
280
+ # @see the `==` method
281
+ # @param [Object] Object to be compared
282
+ def eql?(o)
283
+ self == o
284
+ end
285
+
286
+ # Calculates hash code according to all attributes.
287
+ # @return [Fixnum] Hash code
288
+ def hash
289
+ [total_amount, unit_price, quantity, gift_card_currency, product_sku, product_description, product_name, passenger, shipping_destination_types, tax_amount].hash
290
+ end
291
+
292
+ # Builds the object from hash
293
+ # @param [Hash] attributes Model attributes in the form of hash
294
+ # @return [Object] Returns the model itself
295
+ def build_from_hash(attributes)
296
+ return nil unless attributes.is_a?(Hash)
297
+ self.class.swagger_types.each_pair do |key, type|
298
+ if type =~ /\AArray<(.*)>/i
299
+ # check to ensure the input is an array given that the the attribute
300
+ # is documented as an array but the input is not
301
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
302
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
303
+ end
304
+ elsif !attributes[self.class.attribute_map[key]].nil?
305
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
306
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
307
+ end
308
+
309
+ self
310
+ end
311
+
312
+ # Deserializes the data based on type
313
+ # @param string type Data type
314
+ # @param string value Value to be deserialized
315
+ # @return [Object] Deserialized data
316
+ def _deserialize(type, value)
317
+ case type.to_sym
318
+ when :DateTime
319
+ DateTime.parse(value)
320
+ when :Date
321
+ Date.parse(value)
322
+ when :String
323
+ value.to_s
324
+ when :Integer
325
+ value.to_i
326
+ when :Float
327
+ value.to_f
328
+ when :BOOLEAN
329
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
330
+ true
331
+ else
332
+ false
333
+ end
334
+ when :Object
335
+ # generic object (usually a Hash), return directly
336
+ value
337
+ when /\AArray<(?<inner_type>.+)>\z/
338
+ inner_type = Regexp.last_match[:inner_type]
339
+ value.map { |v| _deserialize(inner_type, v) }
340
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
341
+ k_type = Regexp.last_match[:k_type]
342
+ v_type = Regexp.last_match[:v_type]
343
+ {}.tap do |hash|
344
+ value.each do |k, v|
345
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
346
+ end
347
+ end
348
+ else # model
349
+ temp_model = CyberSource.const_get(type).new
350
+ temp_model.build_from_hash(value)
351
+ end
352
+ end
353
+
354
+ # Returns the string representation of the object
355
+ # @return [String] String presentation of the object
356
+ def to_s
357
+ to_hash.to_s
358
+ end
359
+
360
+ # to_body is an alias to to_hash (backward compatibility)
361
+ # @return [Hash] Returns the object in the form of hash
362
+ def to_body
363
+ to_hash
364
+ end
365
+
366
+ # Returns the object in the form of hash
367
+ # @return [Hash] Returns the object in the form of hash
368
+ def to_hash
369
+ hash = {}
370
+ self.class.attribute_map.each_pair do |attr, param|
371
+ value = self.send(attr)
372
+ next if value.nil?
373
+ hash[param] = _to_hash(value)
374
+ end
375
+ hash
376
+ end
377
+
378
+ # Outputs non-array value in the form of hash
379
+ # For object, use to_hash. Otherwise, just return the value
380
+ # @param [Object] value Any valid value
381
+ # @return [Hash] Returns the value in the form of hash
382
+ def _to_hash(value)
383
+ if value.is_a?(Array)
384
+ value.compact.map { |v| _to_hash(v) }
385
+ elsif value.is_a?(Hash)
386
+ {}.tap do |hash|
387
+ value.each { |k, v| hash[k] = _to_hash(v) }
388
+ end
389
+ elsif value.respond_to? :to_hash
390
+ value.to_hash
391
+ else
392
+ value
393
+ end
394
+ end
395
+ end
396
+ end
@@ -0,0 +1,459 @@
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 Riskv1authenticationsOrderInformationShipTo
17
+ # First line of the shipping address.
18
+ attr_accessor :address1
19
+
20
+ # Second line of the shipping address.
21
+ attr_accessor :address2
22
+
23
+ # State or province of the shipping address. Use the State, Province, and Territory Codes for the United States and Canada.
24
+ attr_accessor :administrative_area
25
+
26
+ # Country of the shipping address. Use the two-character ISO Standard Country Codes.
27
+ attr_accessor :country
28
+
29
+ # Shipping destination of item. Example: Commercial, Residential, Store
30
+ attr_accessor :destination_types
31
+
32
+ # City of the shipping address.
33
+ attr_accessor :locality
34
+
35
+ # First name of the recipient. **Processor specific maximum length** - Litle: 25 - All other processors: 60
36
+ attr_accessor :first_name
37
+
38
+ # Last name of the recipient. **Processor-specific maximum length** - Litle: 25 - All other processors: 60
39
+ attr_accessor :last_name
40
+
41
+ # Phone number associated with the shipping address.
42
+ attr_accessor :phone_number
43
+
44
+ # Postal code for the shipping address. The postal code must consist of 5 to 9 digits. When the billing country is the U.S., the 9-digit postal code must follow this format: [5 digits][dash][4 digits] Example 12345-6789 When the billing country is Canada, the 6-digit postal code must follow this format: [alpha][numeric][alpha][space][numeric][alpha][numeric] Example A1B 2C3 **American Express Direct**\\ Before sending the postal code to the processor, CyberSource removes all nonalphanumeric characters and, if the remaining value is longer than nine characters, truncates the value starting from the right side.
45
+ attr_accessor :postal_code
46
+
47
+ # Indicates destination chosen for the transaction. Possible values: - 01- Ship to cardholder billing address - 02- Ship to another verified address on file with merchant - 03- Ship to address that is different than billing address - 04- Ship to store (store address should be populated on request) - 05- Digital goods - 06- Travel and event tickets, not shipped - 07- Other
48
+ attr_accessor :destination_code
49
+
50
+ # Shipping method for the product. Possible values: - lowcost: Lowest-cost service - sameday: Courier or same-day service - oneday: Next-day or overnight service - twoday: Two-day service - threeday: Three-day service - pickup: Store pick-up - other: Other shipping method - none: No shipping method because product is a service or subscription Required for American Express SafeKey (U.S.).
51
+ attr_accessor :method
52
+
53
+ # Attribute mapping from ruby-style variable name to JSON key.
54
+ def self.attribute_map
55
+ {
56
+ :'address1' => :'address1',
57
+ :'address2' => :'address2',
58
+ :'administrative_area' => :'administrativeArea',
59
+ :'country' => :'country',
60
+ :'destination_types' => :'destinationTypes',
61
+ :'locality' => :'locality',
62
+ :'first_name' => :'firstName',
63
+ :'last_name' => :'lastName',
64
+ :'phone_number' => :'phoneNumber',
65
+ :'postal_code' => :'postalCode',
66
+ :'destination_code' => :'destinationCode',
67
+ :'method' => :'method'
68
+ }
69
+ end
70
+
71
+ # Attribute type mapping.
72
+ def self.swagger_types
73
+ {
74
+ :'address1' => :'String',
75
+ :'address2' => :'String',
76
+ :'administrative_area' => :'String',
77
+ :'country' => :'String',
78
+ :'destination_types' => :'String',
79
+ :'locality' => :'String',
80
+ :'first_name' => :'String',
81
+ :'last_name' => :'String',
82
+ :'phone_number' => :'String',
83
+ :'postal_code' => :'String',
84
+ :'destination_code' => :'Integer',
85
+ :'method' => :'String'
86
+ }
87
+ end
88
+
89
+ # Initializes the object
90
+ # @param [Hash] attributes Model attributes in the form of hash
91
+ def initialize(attributes = {})
92
+ return unless attributes.is_a?(Hash)
93
+
94
+ # convert string to symbol for hash key
95
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
96
+
97
+ if attributes.has_key?(:'address1')
98
+ self.address1 = attributes[:'address1']
99
+ end
100
+
101
+ if attributes.has_key?(:'address2')
102
+ self.address2 = attributes[:'address2']
103
+ end
104
+
105
+ if attributes.has_key?(:'administrativeArea')
106
+ self.administrative_area = attributes[:'administrativeArea']
107
+ end
108
+
109
+ if attributes.has_key?(:'country')
110
+ self.country = attributes[:'country']
111
+ end
112
+
113
+ if attributes.has_key?(:'destinationTypes')
114
+ self.destination_types = attributes[:'destinationTypes']
115
+ end
116
+
117
+ if attributes.has_key?(:'locality')
118
+ self.locality = attributes[:'locality']
119
+ end
120
+
121
+ if attributes.has_key?(:'firstName')
122
+ self.first_name = attributes[:'firstName']
123
+ end
124
+
125
+ if attributes.has_key?(:'lastName')
126
+ self.last_name = attributes[:'lastName']
127
+ end
128
+
129
+ if attributes.has_key?(:'phoneNumber')
130
+ self.phone_number = attributes[:'phoneNumber']
131
+ end
132
+
133
+ if attributes.has_key?(:'postalCode')
134
+ self.postal_code = attributes[:'postalCode']
135
+ end
136
+
137
+ if attributes.has_key?(:'destinationCode')
138
+ self.destination_code = attributes[:'destinationCode']
139
+ end
140
+
141
+ if attributes.has_key?(:'method')
142
+ self.method = attributes[:'method']
143
+ end
144
+ end
145
+
146
+ # Show invalid properties with the reasons. Usually used together with valid?
147
+ # @return Array for valid properties with the reasons
148
+ def list_invalid_properties
149
+ invalid_properties = Array.new
150
+ if !@address1.nil? && @address1.to_s.length > 60
151
+ invalid_properties.push('invalid value for "address1", the character length must be smaller than or equal to 60.')
152
+ end
153
+
154
+ if !@address2.nil? && @address2.to_s.length > 60
155
+ invalid_properties.push('invalid value for "address2", the character length must be smaller than or equal to 60.')
156
+ end
157
+
158
+ if !@administrative_area.nil? && @administrative_area.to_s.length > 2
159
+ invalid_properties.push('invalid value for "administrative_area", the character length must be smaller than or equal to 2.')
160
+ end
161
+
162
+ if !@country.nil? && @country.to_s.length > 2
163
+ invalid_properties.push('invalid value for "country", the character length must be smaller than or equal to 2.')
164
+ end
165
+
166
+ if !@destination_types.nil? && @destination_types.to_s.length > 25
167
+ invalid_properties.push('invalid value for "destination_types", the character length must be smaller than or equal to 25.')
168
+ end
169
+
170
+ if !@locality.nil? && @locality.to_s.length > 50
171
+ invalid_properties.push('invalid value for "locality", the character length must be smaller than or equal to 50.')
172
+ end
173
+
174
+ if !@first_name.nil? && @first_name.to_s.length > 60
175
+ invalid_properties.push('invalid value for "first_name", the character length must be smaller than or equal to 60.')
176
+ end
177
+
178
+ if !@last_name.nil? && @last_name.to_s.length > 60
179
+ invalid_properties.push('invalid value for "last_name", the character length must be smaller than or equal to 60.')
180
+ end
181
+
182
+ if !@phone_number.nil? && @phone_number.to_s.length > 15
183
+ invalid_properties.push('invalid value for "phone_number", the character length must be smaller than or equal to 15.')
184
+ end
185
+
186
+ if !@postal_code.nil? && @postal_code.to_s.length > 10
187
+ invalid_properties.push('invalid value for "postal_code", the character length must be smaller than or equal to 10.')
188
+ end
189
+
190
+ if !@method.nil? && @method.to_s.length > 10
191
+ invalid_properties.push('invalid value for "method", the character length must be smaller than or equal to 10.')
192
+ end
193
+
194
+ invalid_properties
195
+ end
196
+
197
+ # Check to see if the all the properties in the model are valid
198
+ # @return true if the model is valid
199
+ def valid?
200
+ return false if !@address1.nil? && @address1.to_s.length > 60
201
+ return false if !@address2.nil? && @address2.to_s.length > 60
202
+ return false if !@administrative_area.nil? && @administrative_area.to_s.length > 2
203
+ return false if !@country.nil? && @country.to_s.length > 2
204
+ return false if !@destination_types.nil? && @destination_types.to_s.length > 25
205
+ return false if !@locality.nil? && @locality.to_s.length > 50
206
+ return false if !@first_name.nil? && @first_name.to_s.length > 60
207
+ return false if !@last_name.nil? && @last_name.to_s.length > 60
208
+ return false if !@phone_number.nil? && @phone_number.to_s.length > 15
209
+ return false if !@postal_code.nil? && @postal_code.to_s.length > 10
210
+ return false if !@method.nil? && @method.to_s.length > 10
211
+ true
212
+ end
213
+
214
+ # Custom attribute writer method with validation
215
+ # @param [Object] address1 Value to be assigned
216
+ def address1=(address1)
217
+ if !address1.nil? && address1.to_s.length > 60
218
+ fail ArgumentError, 'invalid value for "address1", the character length must be smaller than or equal to 60.'
219
+ end
220
+
221
+ @address1 = address1
222
+ end
223
+
224
+ # Custom attribute writer method with validation
225
+ # @param [Object] address2 Value to be assigned
226
+ def address2=(address2)
227
+ if !address2.nil? && address2.to_s.length > 60
228
+ fail ArgumentError, 'invalid value for "address2", the character length must be smaller than or equal to 60.'
229
+ end
230
+
231
+ @address2 = address2
232
+ end
233
+
234
+ # Custom attribute writer method with validation
235
+ # @param [Object] administrative_area Value to be assigned
236
+ def administrative_area=(administrative_area)
237
+ if !administrative_area.nil? && administrative_area.to_s.length > 2
238
+ fail ArgumentError, 'invalid value for "administrative_area", the character length must be smaller than or equal to 2.'
239
+ end
240
+
241
+ @administrative_area = administrative_area
242
+ end
243
+
244
+ # Custom attribute writer method with validation
245
+ # @param [Object] country Value to be assigned
246
+ def country=(country)
247
+ if !country.nil? && country.to_s.length > 2
248
+ fail ArgumentError, 'invalid value for "country", the character length must be smaller than or equal to 2.'
249
+ end
250
+
251
+ @country = country
252
+ end
253
+
254
+ # Custom attribute writer method with validation
255
+ # @param [Object] destination_types Value to be assigned
256
+ def destination_types=(destination_types)
257
+ if !destination_types.nil? && destination_types.to_s.length > 25
258
+ fail ArgumentError, 'invalid value for "destination_types", the character length must be smaller than or equal to 25.'
259
+ end
260
+
261
+ @destination_types = destination_types
262
+ end
263
+
264
+ # Custom attribute writer method with validation
265
+ # @param [Object] locality Value to be assigned
266
+ def locality=(locality)
267
+ if !locality.nil? && locality.to_s.length > 50
268
+ fail ArgumentError, 'invalid value for "locality", the character length must be smaller than or equal to 50.'
269
+ end
270
+
271
+ @locality = locality
272
+ end
273
+
274
+ # Custom attribute writer method with validation
275
+ # @param [Object] first_name Value to be assigned
276
+ def first_name=(first_name)
277
+ if !first_name.nil? && first_name.to_s.length > 60
278
+ fail ArgumentError, 'invalid value for "first_name", the character length must be smaller than or equal to 60.'
279
+ end
280
+
281
+ @first_name = first_name
282
+ end
283
+
284
+ # Custom attribute writer method with validation
285
+ # @param [Object] last_name Value to be assigned
286
+ def last_name=(last_name)
287
+ if !last_name.nil? && last_name.to_s.length > 60
288
+ fail ArgumentError, 'invalid value for "last_name", the character length must be smaller than or equal to 60.'
289
+ end
290
+
291
+ @last_name = last_name
292
+ end
293
+
294
+ # Custom attribute writer method with validation
295
+ # @param [Object] phone_number Value to be assigned
296
+ def phone_number=(phone_number)
297
+ if !phone_number.nil? && phone_number.to_s.length > 15
298
+ fail ArgumentError, 'invalid value for "phone_number", the character length must be smaller than or equal to 15.'
299
+ end
300
+
301
+ @phone_number = phone_number
302
+ end
303
+
304
+ # Custom attribute writer method with validation
305
+ # @param [Object] postal_code Value to be assigned
306
+ def postal_code=(postal_code)
307
+ if !postal_code.nil? && postal_code.to_s.length > 10
308
+ fail ArgumentError, 'invalid value for "postal_code", the character length must be smaller than or equal to 10.'
309
+ end
310
+
311
+ @postal_code = postal_code
312
+ end
313
+
314
+ # Custom attribute writer method with validation
315
+ # @param [Object] method Value to be assigned
316
+ def method=(method)
317
+ if !method.nil? && method.to_s.length > 10
318
+ fail ArgumentError, 'invalid value for "method", the character length must be smaller than or equal to 10.'
319
+ end
320
+
321
+ @method = method
322
+ end
323
+
324
+ # Checks equality by comparing each attribute.
325
+ # @param [Object] Object to be compared
326
+ def ==(o)
327
+ return true if self.equal?(o)
328
+ self.class == o.class &&
329
+ address1 == o.address1 &&
330
+ address2 == o.address2 &&
331
+ administrative_area == o.administrative_area &&
332
+ country == o.country &&
333
+ destination_types == o.destination_types &&
334
+ locality == o.locality &&
335
+ first_name == o.first_name &&
336
+ last_name == o.last_name &&
337
+ phone_number == o.phone_number &&
338
+ postal_code == o.postal_code &&
339
+ destination_code == o.destination_code &&
340
+ method == o.method
341
+ end
342
+
343
+ # @see the `==` method
344
+ # @param [Object] Object to be compared
345
+ def eql?(o)
346
+ self == o
347
+ end
348
+
349
+ # Calculates hash code according to all attributes.
350
+ # @return [Fixnum] Hash code
351
+ def hash
352
+ [address1, address2, administrative_area, country, destination_types, locality, first_name, last_name, phone_number, postal_code, destination_code, method].hash
353
+ end
354
+
355
+ # Builds the object from hash
356
+ # @param [Hash] attributes Model attributes in the form of hash
357
+ # @return [Object] Returns the model itself
358
+ def build_from_hash(attributes)
359
+ return nil unless attributes.is_a?(Hash)
360
+ self.class.swagger_types.each_pair do |key, type|
361
+ if type =~ /\AArray<(.*)>/i
362
+ # check to ensure the input is an array given that the the attribute
363
+ # is documented as an array but the input is not
364
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
365
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
366
+ end
367
+ elsif !attributes[self.class.attribute_map[key]].nil?
368
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
369
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
370
+ end
371
+
372
+ self
373
+ end
374
+
375
+ # Deserializes the data based on type
376
+ # @param string type Data type
377
+ # @param string value Value to be deserialized
378
+ # @return [Object] Deserialized data
379
+ def _deserialize(type, value)
380
+ case type.to_sym
381
+ when :DateTime
382
+ DateTime.parse(value)
383
+ when :Date
384
+ Date.parse(value)
385
+ when :String
386
+ value.to_s
387
+ when :Integer
388
+ value.to_i
389
+ when :Float
390
+ value.to_f
391
+ when :BOOLEAN
392
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
393
+ true
394
+ else
395
+ false
396
+ end
397
+ when :Object
398
+ # generic object (usually a Hash), return directly
399
+ value
400
+ when /\AArray<(?<inner_type>.+)>\z/
401
+ inner_type = Regexp.last_match[:inner_type]
402
+ value.map { |v| _deserialize(inner_type, v) }
403
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
404
+ k_type = Regexp.last_match[:k_type]
405
+ v_type = Regexp.last_match[:v_type]
406
+ {}.tap do |hash|
407
+ value.each do |k, v|
408
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
409
+ end
410
+ end
411
+ else # model
412
+ temp_model = CyberSource.const_get(type).new
413
+ temp_model.build_from_hash(value)
414
+ end
415
+ end
416
+
417
+ # Returns the string representation of the object
418
+ # @return [String] String presentation of the object
419
+ def to_s
420
+ to_hash.to_s
421
+ end
422
+
423
+ # to_body is an alias to to_hash (backward compatibility)
424
+ # @return [Hash] Returns the object in the form of hash
425
+ def to_body
426
+ to_hash
427
+ end
428
+
429
+ # Returns the object in the form of hash
430
+ # @return [Hash] Returns the object in the form of hash
431
+ def to_hash
432
+ hash = {}
433
+ self.class.attribute_map.each_pair do |attr, param|
434
+ value = self.send(attr)
435
+ next if value.nil?
436
+ hash[param] = _to_hash(value)
437
+ end
438
+ hash
439
+ end
440
+
441
+ # Outputs non-array value in the form of hash
442
+ # For object, use to_hash. Otherwise, just return the value
443
+ # @param [Object] value Any valid value
444
+ # @return [Hash] Returns the value in the form of hash
445
+ def _to_hash(value)
446
+ if value.is_a?(Array)
447
+ value.compact.map { |v| _to_hash(v) }
448
+ elsif value.is_a?(Hash)
449
+ {}.tap do |hash|
450
+ value.each { |k, v| hash[k] = _to_hash(v) }
451
+ end
452
+ elsif value.respond_to? :to_hash
453
+ value.to_hash
454
+ else
455
+ value
456
+ end
457
+ end
458
+ end
459
+ end