cybersource_rest_client 0.0.30 → 0.0.34

Sign up to get free protection for your applications and to get access to all the features.
Files changed (155) hide show
  1. checksums.yaml +4 -4
  2. data/lib/AuthenticationSDK/authentication/oauth/OAuthToken.rb +15 -0
  3. data/lib/AuthenticationSDK/core/Authorization.rb +4 -1
  4. data/lib/AuthenticationSDK/core/MerchantConfig.rb +93 -19
  5. data/lib/AuthenticationSDK/util/Constants.rb +77 -75
  6. data/lib/cybersource_rest_client/api/o_auth_api.rb +104 -0
  7. data/lib/cybersource_rest_client/api/payments_api.rb +2 -2
  8. data/lib/cybersource_rest_client/api/refund_api.rb +4 -4
  9. data/lib/cybersource_rest_client/api/void_api.rb +4 -4
  10. data/lib/cybersource_rest_client/api_client.rb +31 -8
  11. data/lib/cybersource_rest_client/configuration.rb +2 -2
  12. data/lib/cybersource_rest_client/models/access_token_response.rb +244 -0
  13. data/lib/cybersource_rest_client/models/add_negative_list_request.rb +1 -1
  14. data/lib/cybersource_rest_client/models/bad_request_error.rb +192 -0
  15. data/lib/cybersource_rest_client/models/create_access_token_request.rb +254 -0
  16. data/lib/cybersource_rest_client/models/fraud_marking_action_request.rb +1 -1
  17. data/lib/cybersource_rest_client/models/inline_response_400_2.rb +1 -1
  18. data/lib/cybersource_rest_client/models/invoicing_v2_invoice_settings_get200_response.rb +1 -1
  19. data/lib/cybersource_rest_client/models/invoicing_v2_invoices_all_get200_response.rb +1 -1
  20. data/lib/cybersource_rest_client/models/invoicing_v2_invoices_all_get200_response_customer_information.rb +20 -4
  21. data/lib/cybersource_rest_client/models/invoicing_v2_invoices_all_get200_response_invoices.rb +1 -1
  22. data/lib/cybersource_rest_client/models/invoicing_v2_invoices_all_get400_response.rb +1 -1
  23. data/lib/cybersource_rest_client/models/invoicing_v2_invoices_all_get404_response.rb +1 -1
  24. data/lib/cybersource_rest_client/models/invoicing_v2_invoices_all_get502_response.rb +1 -1
  25. data/lib/cybersource_rest_client/models/invoicing_v2_invoices_get200_response.rb +2 -2
  26. data/lib/cybersource_rest_client/models/invoicing_v2_invoices_post201_response.rb +2 -2
  27. data/lib/cybersource_rest_client/models/invoicing_v2_invoices_post202_response.rb +1 -1
  28. data/lib/cybersource_rest_client/models/invoicingv2invoices_customer_information.rb +20 -4
  29. data/lib/cybersource_rest_client/models/kms_v2_keys_asym_deletes_post200_response.rb +1 -1
  30. data/lib/cybersource_rest_client/models/kms_v2_keys_asym_get200_response.rb +1 -1
  31. data/lib/cybersource_rest_client/models/kms_v2_keys_asym_post201_response.rb +1 -1
  32. data/lib/cybersource_rest_client/models/kms_v2_keys_sym_deletes_post200_response.rb +1 -1
  33. data/lib/cybersource_rest_client/models/kms_v2_keys_sym_get200_response.rb +1 -1
  34. data/lib/cybersource_rest_client/models/kms_v2_keys_sym_post201_response.rb +1 -1
  35. data/lib/cybersource_rest_client/models/pts_v1_transaction_batches_get200_response.rb +1 -1
  36. data/lib/cybersource_rest_client/models/pts_v1_transaction_batches_get400_response.rb +1 -1
  37. data/lib/cybersource_rest_client/models/pts_v1_transaction_batches_get500_response.rb +1 -1
  38. data/lib/cybersource_rest_client/models/pts_v2_credits_post201_response.rb +3 -3
  39. data/lib/cybersource_rest_client/models/pts_v2_incremental_authorization_patch201_response.rb +3 -3
  40. data/lib/cybersource_rest_client/models/pts_v2_incremental_authorization_patch201_response_error_information.rb +1 -1
  41. data/lib/cybersource_rest_client/models/pts_v2_incremental_authorization_patch201_response_processor_information.rb +6 -0
  42. data/lib/cybersource_rest_client/models/pts_v2_incremental_authorization_patch400_response.rb +1 -1
  43. data/lib/cybersource_rest_client/models/pts_v2_payments_captures_post201_response.rb +3 -3
  44. data/lib/cybersource_rest_client/models/pts_v2_payments_captures_post400_response.rb +1 -1
  45. data/lib/cybersource_rest_client/models/pts_v2_payments_post201_response.rb +13 -4
  46. data/lib/cybersource_rest_client/models/pts_v2_payments_post201_response_consumer_authentication_information.rb +11 -1
  47. data/lib/cybersource_rest_client/models/pts_v2_payments_post201_response_error_information.rb +1 -1
  48. data/lib/cybersource_rest_client/models/pts_v2_payments_post201_response_order_information.rb +13 -4
  49. data/lib/cybersource_rest_client/models/pts_v2_payments_post201_response_order_information_reward_points_details.rb +270 -0
  50. data/lib/cybersource_rest_client/models/{pts_v2_payments_post201_response_payment_information_card.rb → pts_v2_payments_post201_response_payment_account_information.rb} +8 -9
  51. data/lib/cybersource_rest_client/models/pts_v2_payments_post201_response_payment_account_information_card.rb +242 -0
  52. data/lib/cybersource_rest_client/models/pts_v2_payments_post201_response_payment_information.rb +1 -1
  53. data/lib/cybersource_rest_client/models/pts_v2_payments_post201_response_payment_information_tokenized_card.rb +1 -1
  54. data/lib/cybersource_rest_client/models/pts_v2_payments_post201_response_processing_information.rb +1 -1
  55. data/lib/cybersource_rest_client/models/pts_v2_payments_post201_response_processor_information.rb +9 -13
  56. data/lib/cybersource_rest_client/models/pts_v2_payments_post400_response.rb +2 -2
  57. data/lib/cybersource_rest_client/models/pts_v2_payments_post502_response.rb +1 -1
  58. data/lib/cybersource_rest_client/models/pts_v2_payments_refund_post201_response.rb +3 -3
  59. data/lib/cybersource_rest_client/models/pts_v2_payments_refund_post400_response.rb +1 -1
  60. data/lib/cybersource_rest_client/models/pts_v2_payments_reversals_post201_response.rb +3 -3
  61. data/lib/cybersource_rest_client/models/pts_v2_payments_reversals_post400_response.rb +1 -1
  62. data/lib/cybersource_rest_client/models/pts_v2_payments_voids_post201_response.rb +2 -2
  63. data/lib/cybersource_rest_client/models/pts_v2_payments_voids_post400_response.rb +1 -1
  64. data/lib/cybersource_rest_client/models/pts_v2_payouts_post201_response.rb +1 -1
  65. data/lib/cybersource_rest_client/models/pts_v2_payouts_post201_response_error_information.rb +1 -1
  66. data/lib/cybersource_rest_client/models/pts_v2_payouts_post201_response_merchant_information_merchant_descriptor.rb +6 -0
  67. data/lib/cybersource_rest_client/models/pts_v2_payouts_post201_response_order_information_amount_details.rb +2 -2
  68. data/lib/cybersource_rest_client/models/pts_v2_payouts_post201_response_recipient_information_card.rb +1 -1
  69. data/lib/cybersource_rest_client/models/pts_v2_payouts_post400_response.rb +1 -1
  70. data/lib/cybersource_rest_client/models/ptsv2credits_processing_information.rb +2 -2
  71. data/lib/cybersource_rest_client/models/ptsv2payments_client_reference_information.rb +1 -1
  72. data/lib/cybersource_rest_client/models/ptsv2payments_consumer_authentication_information.rb +27 -1
  73. data/lib/cybersource_rest_client/models/ptsv2payments_merchant_information_merchant_descriptor.rb +6 -0
  74. data/lib/cybersource_rest_client/models/ptsv2payments_order_information_amount_details.rb +2 -2
  75. data/lib/cybersource_rest_client/models/ptsv2payments_payment_information_card.rb +4 -4
  76. data/lib/cybersource_rest_client/models/ptsv2payments_payment_information_fluid_data.rb +3 -3
  77. data/lib/cybersource_rest_client/models/ptsv2payments_payment_information_tokenized_card.rb +1 -1
  78. data/lib/cybersource_rest_client/models/ptsv2payments_point_of_sale_information.rb +38 -38
  79. data/lib/cybersource_rest_client/models/ptsv2payments_processing_information.rb +16 -6
  80. data/lib/cybersource_rest_client/models/ptsv2payments_risk_information.rb +15 -4
  81. data/lib/cybersource_rest_client/models/ptsv2payments_risk_information_auxiliary_data.rb +207 -0
  82. data/lib/cybersource_rest_client/models/ptsv2paymentsidcaptures_payment_information_card.rb +1 -1
  83. data/lib/cybersource_rest_client/models/ptsv2paymentsidcaptures_processing_information.rb +15 -5
  84. data/lib/cybersource_rest_client/models/ptsv2paymentsidrefunds_payment_information_card.rb +4 -4
  85. data/lib/cybersource_rest_client/models/ptsv2paymentsidrefunds_processing_information.rb +1 -1
  86. data/lib/cybersource_rest_client/models/ptsv2paymentsidreversals_client_reference_information.rb +17 -1
  87. data/lib/cybersource_rest_client/models/ptsv2paymentsidreversals_processing_information.rb +1 -1
  88. data/lib/cybersource_rest_client/models/ptsv2payouts_merchant_information_merchant_descriptor.rb +6 -0
  89. data/lib/cybersource_rest_client/models/ptsv2payouts_payment_information_card.rb +4 -4
  90. data/lib/cybersource_rest_client/models/resource_not_found_error.rb +192 -0
  91. data/lib/cybersource_rest_client/models/risk_v1_address_verifications_post201_response.rb +3 -3
  92. data/lib/cybersource_rest_client/models/risk_v1_authentication_results_post201_response.rb +3 -3
  93. data/lib/cybersource_rest_client/models/risk_v1_authentication_setups_post201_response.rb +2 -2
  94. data/lib/cybersource_rest_client/models/risk_v1_authentications_post201_response.rb +3 -3
  95. data/lib/cybersource_rest_client/models/risk_v1_authentications_post400_response.rb +1 -1
  96. data/lib/cybersource_rest_client/models/risk_v1_authentications_post400_response_1.rb +1 -1
  97. data/lib/cybersource_rest_client/models/risk_v1_decisions_post201_response.rb +3 -3
  98. data/lib/cybersource_rest_client/models/risk_v1_decisions_post400_response.rb +1 -1
  99. data/lib/cybersource_rest_client/models/risk_v1_decisions_post400_response_1.rb +1 -1
  100. data/lib/cybersource_rest_client/models/risk_v1_export_compliance_inquiries_post201_response.rb +3 -3
  101. data/lib/cybersource_rest_client/models/risk_v1_update_post201_response.rb +2 -2
  102. data/lib/cybersource_rest_client/models/riskv1authenticationresults_consumer_authentication_information.rb +1 -1
  103. data/lib/cybersource_rest_client/models/riskv1authenticationresults_payment_information_card.rb +3 -3
  104. data/lib/cybersource_rest_client/models/riskv1authenticationresults_payment_information_tokenized_card.rb +1 -1
  105. data/lib/cybersource_rest_client/models/riskv1authentications_payment_information_card.rb +3 -3
  106. data/lib/cybersource_rest_client/models/riskv1authentications_payment_information_tokenized_card.rb +1 -1
  107. data/lib/cybersource_rest_client/models/riskv1authenticationsetups_payment_information_card.rb +3 -3
  108. data/lib/cybersource_rest_client/models/riskv1authenticationsetups_payment_information_fluid_data.rb +3 -3
  109. data/lib/cybersource_rest_client/models/riskv1authenticationsetups_payment_information_tokenized_card.rb +1 -1
  110. data/lib/cybersource_rest_client/models/riskv1authenticationsetups_processing_information.rb +1 -1
  111. data/lib/cybersource_rest_client/models/riskv1decisions_client_reference_information.rb +17 -1
  112. data/lib/cybersource_rest_client/models/riskv1decisions_device_information.rb +1 -11
  113. data/lib/cybersource_rest_client/models/riskv1decisions_payment_information_card.rb +3 -3
  114. data/lib/cybersource_rest_client/models/riskv1decisions_payment_information_tokenized_card.rb +1 -1
  115. data/lib/cybersource_rest_client/models/riskv1decisions_risk_information.rb +15 -4
  116. data/lib/cybersource_rest_client/models/riskv1liststypeentries_client_reference_information.rb +224 -0
  117. data/lib/cybersource_rest_client/models/riskv1liststypeentries_payment_information_card.rb +1 -1
  118. data/lib/cybersource_rest_client/models/tss_v2_transactions_get200_response.rb +3 -3
  119. data/lib/cybersource_rest_client/models/tss_v2_transactions_get200_response_consumer_authentication_information.rb +13 -4
  120. data/lib/cybersource_rest_client/models/tss_v2_transactions_get200_response_consumer_authentication_information_strong_authentication.rb +254 -0
  121. data/lib/cybersource_rest_client/models/tss_v2_transactions_get200_response_order_information_amount_details.rb +2 -2
  122. data/lib/cybersource_rest_client/models/tss_v2_transactions_get200_response_payment_information_card.rb +5 -5
  123. data/lib/cybersource_rest_client/models/tss_v2_transactions_get200_response_processing_information.rb +2 -2
  124. data/lib/cybersource_rest_client/models/tss_v2_transactions_get200_response_processing_information_authorization_options.rb +13 -4
  125. data/lib/cybersource_rest_client/models/tss_v2_transactions_get200_response_processor_information.rb +8 -12
  126. data/lib/cybersource_rest_client/models/tss_v2_transactions_get200_response_risk_information.rb +1 -1
  127. data/lib/cybersource_rest_client/models/tss_v2_transactions_post201_response.rb +1 -1
  128. data/lib/cybersource_rest_client/models/tss_v2_transactions_post201_response__embedded_merchant_information.rb +1 -1
  129. data/lib/cybersource_rest_client/models/tss_v2_transactions_post201_response__embedded_order_information_bill_to.rb +17 -1
  130. data/lib/cybersource_rest_client/models/tss_v2_transactions_post201_response__embedded_payment_information_card.rb +3 -3
  131. data/lib/cybersource_rest_client/models/tss_v2_transactions_post201_response__embedded_processing_information.rb +2 -2
  132. data/lib/cybersource_rest_client/models/tss_v2_transactions_post201_response__embedded_processor_information.rb +6 -0
  133. data/lib/cybersource_rest_client/models/tss_v2_transactions_post201_response__embedded_transaction_summaries.rb +2 -2
  134. data/lib/cybersource_rest_client/models/tss_v2_transactions_post400_response.rb +1 -1
  135. data/lib/cybersource_rest_client/models/unauthorized_client_error.rb +192 -0
  136. data/lib/cybersource_rest_client/models/validate_export_compliance_request.rb +1 -1
  137. data/lib/cybersource_rest_client/models/vas_v2_payments_post201_response.rb +2 -2
  138. data/lib/cybersource_rest_client/models/vas_v2_payments_post400_response.rb +1 -1
  139. data/lib/cybersource_rest_client/models/vas_v2_tax_void200_response.rb +2 -2
  140. data/lib/cybersource_rest_client/models/vas_v2_tax_voids_post400_response.rb +1 -1
  141. data/lib/cybersource_rest_client/models/verify_customer_address_request.rb +1 -1
  142. data/lib/cybersource_rest_client.rb +12 -1
  143. metadata +113 -93
  144. data/lib/AuthenticationSDK/resource/TRRReports.json +0 -12
  145. data/lib/AuthenticationSDK/resource/cybs.yml +0 -31
  146. data/lib/AuthenticationSDK/resource/request.json +0 -54
  147. data/lib/AuthenticationSDK/resource/request_capture.json +0 -11
  148. data/lib/AuthenticationSDK/resource/testrest.p12 +0 -0
  149. data/lib/AuthenticationSDK/spec/Authorization_spec.rb +0 -274
  150. data/lib/AuthenticationSDK/spec/MerchantConfigData.rb +0 -59
  151. data/lib/AuthenticationSDK/spec/MerchantConfig_spec.rb +0 -116
  152. data/lib/AuthenticationSDK/spec/PostRequestData.json +0 -54
  153. data/lib/AuthenticationSDK/spec/PutRequestData.json +0 -12
  154. data/lib/AuthenticationSDK/spec/ResponseCodeMessage_spec.rb +0 -60
  155. data/lib/AuthenticationSDK/spec/spec_helper.rb +0 -12
@@ -14,6 +14,9 @@ require 'date'
14
14
 
15
15
  module CyberSource
16
16
  class PtsV2PaymentsPost201ResponseConsumerAuthenticationInformation
17
+ # JSON Web Token (JWT) used to authenticate the consumer with the authentication provider, such as, CardinalCommerce or Rupay. Note - Max Length of this field is 2048 characters.
18
+ attr_accessor :access_token
19
+
17
20
  # Identifies the UI Type the ACS will use to complete the challenge. **NOTE**: Only available for App transactions using the Cardinal Mobile SDK.
18
21
  attr_accessor :acs_rendering_type
19
22
 
@@ -136,6 +139,7 @@ module CyberSource
136
139
  # Attribute mapping from ruby-style variable name to JSON key.
137
140
  def self.attribute_map
138
141
  {
142
+ :'access_token' => :'accessToken',
139
143
  :'acs_rendering_type' => :'acsRenderingType',
140
144
  :'acs_transaction_id' => :'acsTransactionId',
141
145
  :'acs_url' => :'acsUrl',
@@ -182,6 +186,7 @@ module CyberSource
182
186
  # Attribute type mapping.
183
187
  def self.swagger_types
184
188
  {
189
+ :'access_token' => :'String',
185
190
  :'acs_rendering_type' => :'String',
186
191
  :'acs_transaction_id' => :'String',
187
192
  :'acs_url' => :'String',
@@ -233,6 +238,10 @@ module CyberSource
233
238
  # convert string to symbol for hash key
234
239
  attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
235
240
 
241
+ if attributes.has_key?(:'accessToken')
242
+ self.access_token = attributes[:'accessToken']
243
+ end
244
+
236
245
  if attributes.has_key?(:'acsRenderingType')
237
246
  self.acs_rendering_type = attributes[:'acsRenderingType']
238
247
  end
@@ -538,6 +547,7 @@ module CyberSource
538
547
  def ==(o)
539
548
  return true if self.equal?(o)
540
549
  self.class == o.class &&
550
+ access_token == o.access_token &&
541
551
  acs_rendering_type == o.acs_rendering_type &&
542
552
  acs_transaction_id == o.acs_transaction_id &&
543
553
  acs_url == o.acs_url &&
@@ -589,7 +599,7 @@ module CyberSource
589
599
  # Calculates hash code according to all attributes.
590
600
  # @return [Fixnum] Hash code
591
601
  def hash
592
- [acs_rendering_type, acs_transaction_id, acs_url, authentication_path, authorization_payload, authentication_transaction_id, cardholder_message, cavv, cavv_algorithm, challenge_cancel_code, challenge_required, decoupled_authentication_indicator, directory_server_error_code, directory_server_error_description, ecommerce_indicator, eci, eci_raw, effective_authentication_type, ivr, network_score, pareq, pares_status, proof_xml, proxy_pan, sdk_transaction_id, signed_pares_status_reason, specification_version, step_up_url, three_ds_server_transaction_id, ucaf_authentication_data, ucaf_collection_indicator, veres_enrolled, white_list_status_source, xid, directory_server_transaction_id, authentication_result, authentication_status_msg, indicator, interaction_counter, white_list_status].hash
602
+ [access_token, acs_rendering_type, acs_transaction_id, acs_url, authentication_path, authorization_payload, authentication_transaction_id, cardholder_message, cavv, cavv_algorithm, challenge_cancel_code, challenge_required, decoupled_authentication_indicator, directory_server_error_code, directory_server_error_description, ecommerce_indicator, eci, eci_raw, effective_authentication_type, ivr, network_score, pareq, pares_status, proof_xml, proxy_pan, sdk_transaction_id, signed_pares_status_reason, specification_version, step_up_url, three_ds_server_transaction_id, ucaf_authentication_data, ucaf_collection_indicator, veres_enrolled, white_list_status_source, xid, directory_server_transaction_id, authentication_result, authentication_status_msg, indicator, interaction_counter, white_list_status].hash
593
603
  end
594
604
 
595
605
  # Builds the object from hash
@@ -14,7 +14,7 @@ require 'date'
14
14
 
15
15
  module CyberSource
16
16
  class PtsV2PaymentsPost201ResponseErrorInformation
17
- # The reason of the status. Possible values: - AVS_FAILED - CONTACT_PROCESSOR - EXPIRED_CARD - PROCESSOR_DECLINED - INSUFFICIENT_FUND - STOLEN_LOST_CARD - ISSUER_UNAVAILABLE - UNAUTHORIZED_CARD - CVN_NOT_MATCH - EXCEEDS_CREDIT_LIMIT - INVALID_CVN - DECLINED_CHECK - BLACKLISTED_CUSTOMER - SUSPENDED_ACCOUNT - PAYMENT_REFUSED - CV_FAILED - INVALID_ACCOUNT - GENERAL_DECLINE - INVALID_MERCHANT_CONFIGURATION - DECISION_PROFILE_REJECT - SCORE_EXCEEDS_THRESHOLD - PENDING_AUTHENTICATION - ACH_VERIFICATION_FAILED - DECISION_PROFILE_REVIEW - CONSUMER_AUTHENTICATION_REQUIRED - CONSUMER_AUTHENTICATION_FAILED
17
+ # The reason of the status. Possible values: - AVS_FAILED - CONTACT_PROCESSOR - EXPIRED_CARD - PROCESSOR_DECLINED - INSUFFICIENT_FUND - STOLEN_LOST_CARD - ISSUER_UNAVAILABLE - UNAUTHORIZED_CARD - CVN_NOT_MATCH - EXCEEDS_CREDIT_LIMIT - INVALID_CVN - DECLINED_CHECK - BLACKLISTED_CUSTOMER - SUSPENDED_ACCOUNT - PAYMENT_REFUSED - CV_FAILED - INVALID_ACCOUNT - GENERAL_DECLINE - INVALID_MERCHANT_CONFIGURATION - DECISION_PROFILE_REJECT - SCORE_EXCEEDS_THRESHOLD - PENDING_AUTHENTICATION - ACH_VERIFICATION_FAILED - DECISION_PROFILE_REVIEW - CONSUMER_AUTHENTICATION_REQUIRED - CONSUMER_AUTHENTICATION_FAILED - DEBIT_CARD_USAGE_EXCEEDED_LIMIT
18
18
  attr_accessor :reason
19
19
 
20
20
  # The detail message related to the status and reason listed above.
@@ -18,11 +18,14 @@ module CyberSource
18
18
 
19
19
  attr_accessor :invoice_details
20
20
 
21
+ attr_accessor :reward_points_details
22
+
21
23
  # Attribute mapping from ruby-style variable name to JSON key.
22
24
  def self.attribute_map
23
25
  {
24
26
  :'amount_details' => :'amountDetails',
25
- :'invoice_details' => :'invoiceDetails'
27
+ :'invoice_details' => :'invoiceDetails',
28
+ :'reward_points_details' => :'rewardPointsDetails'
26
29
  }
27
30
  end
28
31
 
@@ -30,7 +33,8 @@ module CyberSource
30
33
  def self.swagger_types
31
34
  {
32
35
  :'amount_details' => :'PtsV2PaymentsPost201ResponseOrderInformationAmountDetails',
33
- :'invoice_details' => :'PtsV2PaymentsPost201ResponseOrderInformationInvoiceDetails'
36
+ :'invoice_details' => :'PtsV2PaymentsPost201ResponseOrderInformationInvoiceDetails',
37
+ :'reward_points_details' => :'PtsV2PaymentsPost201ResponseOrderInformationRewardPointsDetails'
34
38
  }
35
39
  end
36
40
 
@@ -49,6 +53,10 @@ module CyberSource
49
53
  if attributes.has_key?(:'invoiceDetails')
50
54
  self.invoice_details = attributes[:'invoiceDetails']
51
55
  end
56
+
57
+ if attributes.has_key?(:'rewardPointsDetails')
58
+ self.reward_points_details = attributes[:'rewardPointsDetails']
59
+ end
52
60
  end
53
61
 
54
62
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -70,7 +78,8 @@ module CyberSource
70
78
  return true if self.equal?(o)
71
79
  self.class == o.class &&
72
80
  amount_details == o.amount_details &&
73
- invoice_details == o.invoice_details
81
+ invoice_details == o.invoice_details &&
82
+ reward_points_details == o.reward_points_details
74
83
  end
75
84
 
76
85
  # @see the `==` method
@@ -82,7 +91,7 @@ module CyberSource
82
91
  # Calculates hash code according to all attributes.
83
92
  # @return [Fixnum] Hash code
84
93
  def hash
85
- [amount_details, invoice_details].hash
94
+ [amount_details, invoice_details, reward_points_details].hash
86
95
  end
87
96
 
88
97
  # Builds the object from hash
@@ -0,0 +1,270 @@
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 PtsV2PaymentsPost201ResponseOrderInformationRewardPointsDetails
17
+ # Loyalty points total balance before redemption. For Example: Points, such as 100
18
+ attr_accessor :points_before_redemption
19
+
20
+ # The total value of loyalty points before redemption in the default currency. Max characters is 12 excluding the \".\" symbol For Example: Points, such as 20.00
21
+ attr_accessor :points_value_before_redemption
22
+
23
+ # Number of loyalty points that were redeemed. For Example: Points, such as 100
24
+ attr_accessor :points_redeemed
25
+
26
+ # The value of the loyalty points that were redeemed in the default currency. Max characters is 12 excluding the \".\" symbol For Example: Points, such as 100.00
27
+ attr_accessor :points_value_redeemed
28
+
29
+ # Loyalty Points remaining total balance after redemption. For Example: Points, such as 20.00
30
+ attr_accessor :points_after_redemption
31
+
32
+ # The value of the remaining loyalty points after redumption in the default currency. Max characters is 12 excluding the \".\" symbol For Example: Points, such as 20.00
33
+ attr_accessor :points_value_after_redemption
34
+
35
+ # Attribute mapping from ruby-style variable name to JSON key.
36
+ def self.attribute_map
37
+ {
38
+ :'points_before_redemption' => :'pointsBeforeRedemption',
39
+ :'points_value_before_redemption' => :'pointsValueBeforeRedemption',
40
+ :'points_redeemed' => :'pointsRedeemed',
41
+ :'points_value_redeemed' => :'pointsValueRedeemed',
42
+ :'points_after_redemption' => :'pointsAfterRedemption',
43
+ :'points_value_after_redemption' => :'pointsValueAfterRedemption'
44
+ }
45
+ end
46
+
47
+ # Attribute type mapping.
48
+ def self.swagger_types
49
+ {
50
+ :'points_before_redemption' => :'String',
51
+ :'points_value_before_redemption' => :'String',
52
+ :'points_redeemed' => :'String',
53
+ :'points_value_redeemed' => :'String',
54
+ :'points_after_redemption' => :'String',
55
+ :'points_value_after_redemption' => :'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?(:'pointsBeforeRedemption')
68
+ self.points_before_redemption = attributes[:'pointsBeforeRedemption']
69
+ end
70
+
71
+ if attributes.has_key?(:'pointsValueBeforeRedemption')
72
+ self.points_value_before_redemption = attributes[:'pointsValueBeforeRedemption']
73
+ end
74
+
75
+ if attributes.has_key?(:'pointsRedeemed')
76
+ self.points_redeemed = attributes[:'pointsRedeemed']
77
+ end
78
+
79
+ if attributes.has_key?(:'pointsValueRedeemed')
80
+ self.points_value_redeemed = attributes[:'pointsValueRedeemed']
81
+ end
82
+
83
+ if attributes.has_key?(:'pointsAfterRedemption')
84
+ self.points_after_redemption = attributes[:'pointsAfterRedemption']
85
+ end
86
+
87
+ if attributes.has_key?(:'pointsValueAfterRedemption')
88
+ self.points_value_after_redemption = attributes[:'pointsValueAfterRedemption']
89
+ end
90
+ end
91
+
92
+ # Show invalid properties with the reasons. Usually used together with valid?
93
+ # @return Array for valid properties with the reasons
94
+ def list_invalid_properties
95
+ invalid_properties = Array.new
96
+ invalid_properties
97
+ end
98
+
99
+ # Check to see if the all the properties in the model are valid
100
+ # @return true if the model is valid
101
+ def valid?
102
+ true
103
+ end
104
+
105
+ # Custom attribute writer method with validation
106
+ # @param [Object] points_before_redemption Value to be assigned
107
+ def points_before_redemption=(points_before_redemption)
108
+ @points_before_redemption = points_before_redemption
109
+ end
110
+
111
+ # Custom attribute writer method with validation
112
+ # @param [Object] points_value_before_redemption Value to be assigned
113
+ def points_value_before_redemption=(points_value_before_redemption)
114
+ @points_value_before_redemption = points_value_before_redemption
115
+ end
116
+
117
+ # Custom attribute writer method with validation
118
+ # @param [Object] points_redeemed Value to be assigned
119
+ def points_redeemed=(points_redeemed)
120
+ @points_redeemed = points_redeemed
121
+ end
122
+
123
+ # Custom attribute writer method with validation
124
+ # @param [Object] points_value_redeemed Value to be assigned
125
+ def points_value_redeemed=(points_value_redeemed)
126
+ @points_value_redeemed = points_value_redeemed
127
+ end
128
+
129
+ # Custom attribute writer method with validation
130
+ # @param [Object] points_after_redemption Value to be assigned
131
+ def points_after_redemption=(points_after_redemption)
132
+ @points_after_redemption = points_after_redemption
133
+ end
134
+
135
+ # Custom attribute writer method with validation
136
+ # @param [Object] points_value_after_redemption Value to be assigned
137
+ def points_value_after_redemption=(points_value_after_redemption)
138
+ @points_value_after_redemption = points_value_after_redemption
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
+ points_before_redemption == o.points_before_redemption &&
147
+ points_value_before_redemption == o.points_value_before_redemption &&
148
+ points_redeemed == o.points_redeemed &&
149
+ points_value_redeemed == o.points_value_redeemed &&
150
+ points_after_redemption == o.points_after_redemption &&
151
+ points_value_after_redemption == o.points_value_after_redemption
152
+ end
153
+
154
+ # @see the `==` method
155
+ # @param [Object] Object to be compared
156
+ def eql?(o)
157
+ self == o
158
+ end
159
+
160
+ # Calculates hash code according to all attributes.
161
+ # @return [Fixnum] Hash code
162
+ def hash
163
+ [points_before_redemption, points_value_before_redemption, points_redeemed, points_value_redeemed, points_after_redemption, points_value_after_redemption].hash
164
+ end
165
+
166
+ # Builds the object from hash
167
+ # @param [Hash] attributes Model attributes in the form of hash
168
+ # @return [Object] Returns the model itself
169
+ def build_from_hash(attributes)
170
+ return nil unless attributes.is_a?(Hash)
171
+ self.class.swagger_types.each_pair do |key, type|
172
+ if type =~ /\AArray<(.*)>/i
173
+ # check to ensure the input is an array given that the the attribute
174
+ # is documented as an array but the input is not
175
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
176
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
177
+ end
178
+ elsif !attributes[self.class.attribute_map[key]].nil?
179
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
180
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
181
+ end
182
+
183
+ self
184
+ end
185
+
186
+ # Deserializes the data based on type
187
+ # @param string type Data type
188
+ # @param string value Value to be deserialized
189
+ # @return [Object] Deserialized data
190
+ def _deserialize(type, value)
191
+ case type.to_sym
192
+ when :DateTime
193
+ DateTime.parse(value)
194
+ when :Date
195
+ Date.parse(value)
196
+ when :String
197
+ value.to_s
198
+ when :Integer
199
+ value.to_i
200
+ when :Float
201
+ value.to_f
202
+ when :BOOLEAN
203
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
204
+ true
205
+ else
206
+ false
207
+ end
208
+ when :Object
209
+ # generic object (usually a Hash), return directly
210
+ value
211
+ when /\AArray<(?<inner_type>.+)>\z/
212
+ inner_type = Regexp.last_match[:inner_type]
213
+ value.map { |v| _deserialize(inner_type, v) }
214
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
215
+ k_type = Regexp.last_match[:k_type]
216
+ v_type = Regexp.last_match[:v_type]
217
+ {}.tap do |hash|
218
+ value.each do |k, v|
219
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
220
+ end
221
+ end
222
+ else # model
223
+ temp_model = CyberSource.const_get(type).new
224
+ temp_model.build_from_hash(value)
225
+ end
226
+ end
227
+
228
+ # Returns the string representation of the object
229
+ # @return [String] String presentation of the object
230
+ def to_s
231
+ to_hash.to_s
232
+ end
233
+
234
+ # to_body is an alias to to_hash (backward compatibility)
235
+ # @return [Hash] Returns the object in the form of hash
236
+ def to_body
237
+ to_hash
238
+ end
239
+
240
+ # Returns the object in the form of hash
241
+ # @return [Hash] Returns the object in the form of hash
242
+ def to_hash
243
+ hash = {}
244
+ self.class.attribute_map.each_pair do |attr, param|
245
+ value = self.send(attr)
246
+ next if value.nil?
247
+ hash[param] = _to_hash(value)
248
+ end
249
+ hash
250
+ end
251
+
252
+ # Outputs non-array value in the form of hash
253
+ # For object, use to_hash. Otherwise, just return the value
254
+ # @param [Object] value Any valid value
255
+ # @return [Hash] Returns the value in the form of hash
256
+ def _to_hash(value)
257
+ if value.is_a?(Array)
258
+ value.compact.map { |v| _to_hash(v) }
259
+ elsif value.is_a?(Hash)
260
+ {}.tap do |hash|
261
+ value.each { |k, v| hash[k] = _to_hash(v) }
262
+ end
263
+ elsif value.respond_to? :to_hash
264
+ value.to_hash
265
+ else
266
+ value
267
+ end
268
+ end
269
+ end
270
+ end
@@ -13,21 +13,20 @@ Swagger Codegen version: 2.2.3
13
13
  require 'date'
14
14
 
15
15
  module CyberSource
16
- class PtsV2PaymentsPost201ResponsePaymentInformationCard
17
- # Last four digits of the cardholder’s account number. This field is included in the reply message when the client software that is installed on the POS terminal uses the token management service (TMS) to retrieve tokenized payment details. You must contact customer support to have your account enabled to receive these fields in the credit reply message. #### PIN debit This field is returned only for tokenized transactions. You can use this value on the receipt that you give to the cardholder. Returned by PIN debit credit and PIN debit purchase. This field is supported only by the following processors: - American Express Direct - Credit Mutuel-CIC - FDC Nashville Global - OmniPay Direct - SIX
18
- attr_accessor :suffix
16
+ class PtsV2PaymentsPost201ResponsePaymentAccountInformation
17
+ attr_accessor :card
19
18
 
20
19
  # Attribute mapping from ruby-style variable name to JSON key.
21
20
  def self.attribute_map
22
21
  {
23
- :'suffix' => :'suffix'
22
+ :'card' => :'card'
24
23
  }
25
24
  end
26
25
 
27
26
  # Attribute type mapping.
28
27
  def self.swagger_types
29
28
  {
30
- :'suffix' => :'String'
29
+ :'card' => :'PtsV2PaymentsPost201ResponsePaymentAccountInformationCard'
31
30
  }
32
31
  end
33
32
 
@@ -39,8 +38,8 @@ module CyberSource
39
38
  # convert string to symbol for hash key
40
39
  attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
41
40
 
42
- if attributes.has_key?(:'suffix')
43
- self.suffix = attributes[:'suffix']
41
+ if attributes.has_key?(:'card')
42
+ self.card = attributes[:'card']
44
43
  end
45
44
  end
46
45
 
@@ -62,7 +61,7 @@ module CyberSource
62
61
  def ==(o)
63
62
  return true if self.equal?(o)
64
63
  self.class == o.class &&
65
- suffix == o.suffix
64
+ card == o.card
66
65
  end
67
66
 
68
67
  # @see the `==` method
@@ -74,7 +73,7 @@ module CyberSource
74
73
  # Calculates hash code according to all attributes.
75
74
  # @return [Fixnum] Hash code
76
75
  def hash
77
- [suffix].hash
76
+ [card].hash
78
77
  end
79
78
 
80
79
  # Builds the object from hash
@@ -0,0 +1,242 @@
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 PtsV2PaymentsPost201ResponsePaymentAccountInformationCard
17
+ # Last four digits of the cardholder’s account number. This field is included in the reply message when the client software that is installed on the POS terminal uses the token management service (TMS) to retrieve tokenized payment details. You must contact customer support to have your account enabled to receive these fields in the credit reply message. #### Google Pay transactions For PAN-based Google Pay transactions, this field is returned in the API response. #### PIN debit This field is returned only for tokenized transactions. You can use this value on the receipt that you give to the cardholder. Returned by PIN debit credit and PIN debit purchase. This field is supported only by the following processors: - American Express Direct - Credit Mutuel-CIC - FDC Nashville Global - OmniPay Direct - SIX
18
+ attr_accessor :suffix
19
+
20
+ # Two-digit month in which the payment card expires. Format: `MM`. Valid values: `01` through `12`. Leading 0 is required. #### Barclays and Streamline For Maestro (UK Domestic) and Maestro (International) cards on Barclays and Streamline, this must be a valid value (`01` through `12`) but is not required to be a valid expiration date. In other words, an expiration date that is in the past does not cause CyberSource to reject your request. However, an invalid expiration date might cause the issuer to reject your request. #### Encoded Account Numbers For encoded account numbers (_type_=039), if there is no expiration date on the card, use `12`. #### FDMS Nashville Required field. #### All other processors Required if `pointOfSaleInformation.entryMode=keyed`. However, this field is optional if your account is configured for relaxed requirements for address data and expiration date. **Important** It is your responsibility to determine whether a field is required for the transaction you are requesting. #### Google Pay transactions For PAN-based Google Pay transactions, this field is returned in the API response.
21
+ attr_accessor :expiration_month
22
+
23
+ # Four-digit year in which the payment card expires. Format: `YYYY`. #### Barclays and Streamline For Maestro (UK Domestic) and Maestro (International) cards on Barclays and Streamline, this must be a valid value (`1900` through `3000`) but is not required to be a valid expiration date. In other words, an expiration date that is in the past does not cause CyberSource to reject your request. However, an invalid expiration date might cause the issuer to reject your request. #### Encoded Account Numbers For encoded account numbers (**_type_**`=039`), if there is no expiration date on the card, use `2021`. #### FDMS Nashville Required field. #### FDC Nashville Global and FDMS South You can send in 2 digits or 4 digits. If you send in 2 digits, they must be the last 2 digits of the year. #### All other processors Required if `pointOfSaleInformation.entryMode=keyed`. However, this field is optional if your account is configured for relaxed requirements for address data and expiration date. **Important** It is your responsibility to determine whether a field is required for the transaction you are requesting. #### Google Pay transactions For PAN-based Google Pay transactions, this field is returned in the API response.
24
+ attr_accessor :expiration_year
25
+
26
+ # Three-digit value that indicates the card type. **IMPORTANT** It is strongly recommended that you include the card type field in request messages even if it is optional for your processor and card type. Omitting the card type can cause the transaction to be processed with the wrong card type. Possible values: - `001`: Visa. For card-present transactions on all processors except SIX, the Visa Electron card type is processed the same way that the Visa debit card is processed. Use card type value `001` for Visa Electron. - `002`: Mastercard, Eurocard[^1], which is a European regional brand of Mastercard. - `003`: American Express - `004`: Discover - `005`: Diners Club - `006`: Carte Blanche[^1] - `007`: JCB[^1] - `014`: Enroute[^1] - `021`: JAL[^1] - `024`: Maestro (UK Domestic)[^1] - `031`: Delta[^1]: Use this value only for Ingenico ePayments. For other processors, use `001` for all Visa card types. - `033`: Visa Electron[^1]. Use this value only for Ingenico ePayments and SIX. For other processors, use `001` for all Visa card types. - `034`: Dankort[^1] - `036`: Cartes Bancaires[^1,4] - `037`: Carta Si[^1] - `039`: Encoded account number[^1] - `040`: UATP[^1] - `042`: Maestro (International)[^1] - `050`: Hipercard[^2,3] - `051`: Aura - `054`: Elo[^3] - `062`: China UnionPay [^1]: For this card type, you must include the `paymentInformation.card.type` or `paymentInformation.tokenizedCard.type` field in your request for an authorization or a stand-alone credit. [^2]: For this card type on Cielo 3.0, you must include the `paymentInformation.card.type` or `paymentInformation.tokenizedCard.type` field in a request for an authorization or a stand-alone credit. This card type is not supported on Cielo 1.5. [^3]: For this card type on Getnet and Rede, you must include the `paymentInformation.card.type` or `paymentInformation.tokenizedCard.type` field in a request for an authorization or a stand-alone credit. [^4]: For this card type, you must include the `paymentInformation.card.type` in your request for any payer authentication services. #### Used by **Authorization** Required for Carte Blanche and JCB. Optional for all other card types. #### Card Present reply This field is included in the reply message when the client software that is installed on the POS terminal uses the token management service (TMS) to retrieve tokenized payment details. You must contact customer support to have your account enabled to receive these fields in the credit reply message. Returned by the Credit service. This reply field is only supported by the following processors: - American Express Direct - Credit Mutuel-CIC - FDC Nashville Global - OmniPay Direct - SIX #### Google Pay transactions For PAN-based Google Pay transactions, this field is returned in the API response. #### GPX This field only supports transactions from the following card types: - Visa - Mastercard - AMEX - Discover - Diners - JCB - Union Pay International
27
+ attr_accessor :type
28
+
29
+ # Bank Identification Number (BIN). This is the initial four to six numbers on a credit card account number. #### Google Pay transactions For PAN-based Google Pay transactions, this field is returned in the API response.
30
+ attr_accessor :prefix
31
+
32
+ # Attribute mapping from ruby-style variable name to JSON key.
33
+ def self.attribute_map
34
+ {
35
+ :'suffix' => :'suffix',
36
+ :'expiration_month' => :'expirationMonth',
37
+ :'expiration_year' => :'expirationYear',
38
+ :'type' => :'type',
39
+ :'prefix' => :'prefix'
40
+ }
41
+ end
42
+
43
+ # Attribute type mapping.
44
+ def self.swagger_types
45
+ {
46
+ :'suffix' => :'String',
47
+ :'expiration_month' => :'String',
48
+ :'expiration_year' => :'String',
49
+ :'type' => :'String',
50
+ :'prefix' => :'String'
51
+ }
52
+ end
53
+
54
+ # Initializes the object
55
+ # @param [Hash] attributes Model attributes in the form of hash
56
+ def initialize(attributes = {})
57
+ return unless attributes.is_a?(Hash)
58
+
59
+ # convert string to symbol for hash key
60
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
61
+
62
+ if attributes.has_key?(:'suffix')
63
+ self.suffix = attributes[:'suffix']
64
+ end
65
+
66
+ if attributes.has_key?(:'expirationMonth')
67
+ self.expiration_month = attributes[:'expirationMonth']
68
+ end
69
+
70
+ if attributes.has_key?(:'expirationYear')
71
+ self.expiration_year = attributes[:'expirationYear']
72
+ end
73
+
74
+ if attributes.has_key?(:'type')
75
+ self.type = attributes[:'type']
76
+ end
77
+
78
+ if attributes.has_key?(:'prefix')
79
+ self.prefix = attributes[:'prefix']
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
+ invalid_properties
88
+ end
89
+
90
+ # Check to see if the all the properties in the model are valid
91
+ # @return true if the model is valid
92
+ def valid?
93
+ true
94
+ end
95
+
96
+ # Custom attribute writer method with validation
97
+ # @param [Object] expiration_month Value to be assigned
98
+ def expiration_month=(expiration_month)
99
+ @expiration_month = expiration_month
100
+ end
101
+
102
+ # Custom attribute writer method with validation
103
+ # @param [Object] expiration_year Value to be assigned
104
+ def expiration_year=(expiration_year)
105
+ @expiration_year = expiration_year
106
+ end
107
+
108
+ # Custom attribute writer method with validation
109
+ # @param [Object] prefix Value to be assigned
110
+ def prefix=(prefix)
111
+ @prefix = prefix
112
+ end
113
+
114
+ # Checks equality by comparing each attribute.
115
+ # @param [Object] Object to be compared
116
+ def ==(o)
117
+ return true if self.equal?(o)
118
+ self.class == o.class &&
119
+ suffix == o.suffix &&
120
+ expiration_month == o.expiration_month &&
121
+ expiration_year == o.expiration_year &&
122
+ type == o.type &&
123
+ prefix == o.prefix
124
+ end
125
+
126
+ # @see the `==` method
127
+ # @param [Object] Object to be compared
128
+ def eql?(o)
129
+ self == o
130
+ end
131
+
132
+ # Calculates hash code according to all attributes.
133
+ # @return [Fixnum] Hash code
134
+ def hash
135
+ [suffix, expiration_month, expiration_year, type, prefix].hash
136
+ end
137
+
138
+ # Builds the object from hash
139
+ # @param [Hash] attributes Model attributes in the form of hash
140
+ # @return [Object] Returns the model itself
141
+ def build_from_hash(attributes)
142
+ return nil unless attributes.is_a?(Hash)
143
+ self.class.swagger_types.each_pair do |key, type|
144
+ if type =~ /\AArray<(.*)>/i
145
+ # check to ensure the input is an array given that the the attribute
146
+ # is documented as an array but the input is not
147
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
148
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
149
+ end
150
+ elsif !attributes[self.class.attribute_map[key]].nil?
151
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
152
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
153
+ end
154
+
155
+ self
156
+ end
157
+
158
+ # Deserializes the data based on type
159
+ # @param string type Data type
160
+ # @param string value Value to be deserialized
161
+ # @return [Object] Deserialized data
162
+ def _deserialize(type, value)
163
+ case type.to_sym
164
+ when :DateTime
165
+ DateTime.parse(value)
166
+ when :Date
167
+ Date.parse(value)
168
+ when :String
169
+ value.to_s
170
+ when :Integer
171
+ value.to_i
172
+ when :Float
173
+ value.to_f
174
+ when :BOOLEAN
175
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
176
+ true
177
+ else
178
+ false
179
+ end
180
+ when :Object
181
+ # generic object (usually a Hash), return directly
182
+ value
183
+ when /\AArray<(?<inner_type>.+)>\z/
184
+ inner_type = Regexp.last_match[:inner_type]
185
+ value.map { |v| _deserialize(inner_type, v) }
186
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
187
+ k_type = Regexp.last_match[:k_type]
188
+ v_type = Regexp.last_match[:v_type]
189
+ {}.tap do |hash|
190
+ value.each do |k, v|
191
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
192
+ end
193
+ end
194
+ else # model
195
+ temp_model = CyberSource.const_get(type).new
196
+ temp_model.build_from_hash(value)
197
+ end
198
+ end
199
+
200
+ # Returns the string representation of the object
201
+ # @return [String] String presentation of the object
202
+ def to_s
203
+ to_hash.to_s
204
+ end
205
+
206
+ # to_body is an alias to to_hash (backward compatibility)
207
+ # @return [Hash] Returns the object in the form of hash
208
+ def to_body
209
+ to_hash
210
+ end
211
+
212
+ # Returns the object in the form of hash
213
+ # @return [Hash] Returns the object in the form of hash
214
+ def to_hash
215
+ hash = {}
216
+ self.class.attribute_map.each_pair do |attr, param|
217
+ value = self.send(attr)
218
+ next if value.nil?
219
+ hash[param] = _to_hash(value)
220
+ end
221
+ hash
222
+ end
223
+
224
+ # Outputs non-array value in the form of hash
225
+ # For object, use to_hash. Otherwise, just return the value
226
+ # @param [Object] value Any valid value
227
+ # @return [Hash] Returns the value in the form of hash
228
+ def _to_hash(value)
229
+ if value.is_a?(Array)
230
+ value.compact.map { |v| _to_hash(v) }
231
+ elsif value.is_a?(Hash)
232
+ {}.tap do |hash|
233
+ value.each { |k, v| hash[k] = _to_hash(v) }
234
+ end
235
+ elsif value.respond_to? :to_hash
236
+ value.to_hash
237
+ else
238
+ value
239
+ end
240
+ end
241
+ end
242
+ end