cybersource_rest_client 0.0.80 → 0.0.81

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (152) hide show
  1. checksums.yaml +4 -4
  2. data/lib/AuthenticationSDK/authentication/jwt/JwtToken.rb +17 -7
  3. data/lib/AuthenticationSDK/core/Authorization.rb +2 -2
  4. data/lib/AuthenticationSDK/core/MerchantConfig.rb +277 -23
  5. data/lib/AuthenticationSDK/util/Cache.rb +144 -8
  6. data/lib/AuthenticationSDK/util/CachedMLEKId.rb +17 -0
  7. data/lib/AuthenticationSDK/util/CertificateUtility.rb +109 -29
  8. data/lib/AuthenticationSDK/util/Constants.rb +4 -0
  9. data/lib/AuthenticationSDK/util/MLEUtility.rb +167 -11
  10. data/lib/AuthenticationSDK/util/Utility.rb +37 -1
  11. data/lib/cybersource_rest_client/api/bank_account_validation_api.rb +6 -2
  12. data/lib/cybersource_rest_client/api/batches_api.rb +24 -8
  13. data/lib/cybersource_rest_client/api/billing_agreements_api.rb +18 -6
  14. data/lib/cybersource_rest_client/api/bin_lookup_api.rb +6 -2
  15. data/lib/cybersource_rest_client/api/capture_api.rb +6 -2
  16. data/lib/cybersource_rest_client/api/chargeback_details_api.rb +6 -2
  17. data/lib/cybersource_rest_client/api/chargeback_summaries_api.rb +6 -2
  18. data/lib/cybersource_rest_client/api/conversion_details_api.rb +6 -2
  19. data/lib/cybersource_rest_client/api/create_new_webhooks_api.rb +18 -6
  20. data/lib/cybersource_rest_client/api/credit_api.rb +6 -2
  21. data/lib/cybersource_rest_client/api/customer_api.rb +24 -8
  22. data/lib/cybersource_rest_client/api/customer_payment_instrument_api.rb +30 -10
  23. data/lib/cybersource_rest_client/api/customer_shipping_address_api.rb +30 -10
  24. data/lib/cybersource_rest_client/api/decision_manager_api.rb +30 -10
  25. data/lib/cybersource_rest_client/api/device_de_association_api.rb +12 -4
  26. data/lib/cybersource_rest_client/api/device_search_api.rb +12 -4
  27. data/lib/cybersource_rest_client/api/download_dtd_api.rb +6 -2
  28. data/lib/cybersource_rest_client/api/download_xsd_api.rb +6 -2
  29. data/lib/cybersource_rest_client/api/emv_tag_details_api.rb +12 -4
  30. data/lib/cybersource_rest_client/api/enrollment_api.rb +104 -0
  31. data/lib/cybersource_rest_client/api/flex_api_api.rb +6 -2
  32. data/lib/cybersource_rest_client/api/instructions_api.rb +452 -0
  33. data/lib/cybersource_rest_client/api/instrument_identifier_api.rb +36 -12
  34. data/lib/cybersource_rest_client/api/interchange_clearing_level_details_api.rb +6 -2
  35. data/lib/cybersource_rest_client/api/invoice_settings_api.rb +12 -4
  36. data/lib/cybersource_rest_client/api/invoices_api.rb +42 -14
  37. data/lib/cybersource_rest_client/api/manage_webhooks_api.rb +42 -14
  38. data/lib/cybersource_rest_client/api/merchant_boarding_api.rb +12 -4
  39. data/lib/cybersource_rest_client/api/merchant_defined_fields_api.rb +24 -8
  40. data/lib/cybersource_rest_client/api/microform_integration_api.rb +6 -2
  41. data/lib/cybersource_rest_client/api/net_fundings_api.rb +6 -2
  42. data/lib/cybersource_rest_client/api/notification_of_changes_api.rb +6 -2
  43. data/lib/cybersource_rest_client/api/offers_api.rb +12 -4
  44. data/lib/cybersource_rest_client/api/orders_api.rb +12 -4
  45. data/lib/cybersource_rest_client/api/payer_authentication_api.rb +18 -6
  46. data/lib/cybersource_rest_client/api/payment_batch_summaries_api.rb +6 -2
  47. data/lib/cybersource_rest_client/api/payment_instrument_api.rb +24 -8
  48. data/lib/cybersource_rest_client/api/payment_links_api.rb +24 -8
  49. data/lib/cybersource_rest_client/api/payment_tokens_api.rb +6 -2
  50. data/lib/cybersource_rest_client/api/payments_api.rb +36 -12
  51. data/lib/cybersource_rest_client/api/payouts_api.rb +6 -2
  52. data/lib/cybersource_rest_client/api/plans_api.rb +48 -16
  53. data/lib/cybersource_rest_client/api/purchase_and_refund_details_api.rb +6 -2
  54. data/lib/cybersource_rest_client/api/push_funds_api.rb +6 -2
  55. data/lib/cybersource_rest_client/api/refund_api.rb +12 -4
  56. data/lib/cybersource_rest_client/api/report_definitions_api.rb +12 -4
  57. data/lib/cybersource_rest_client/api/report_downloads_api.rb +6 -2
  58. data/lib/cybersource_rest_client/api/report_subscriptions_api.rb +30 -10
  59. data/lib/cybersource_rest_client/api/reports_api.rb +18 -6
  60. data/lib/cybersource_rest_client/api/retrieval_details_api.rb +6 -2
  61. data/lib/cybersource_rest_client/api/retrieval_summaries_api.rb +6 -2
  62. data/lib/cybersource_rest_client/api/reversal_api.rb +12 -4
  63. data/lib/cybersource_rest_client/api/search_transactions_api.rb +12 -4
  64. data/lib/cybersource_rest_client/api/secure_file_share_api.rb +12 -4
  65. data/lib/cybersource_rest_client/api/subscriptions_api.rb +48 -16
  66. data/lib/cybersource_rest_client/api/subscriptions_follow_ons_api.rb +12 -4
  67. data/lib/cybersource_rest_client/api/taxes_api.rb +12 -4
  68. data/lib/cybersource_rest_client/api/token_api.rb +12 -4
  69. data/lib/cybersource_rest_client/api/tokenize_api.rb +6 -2
  70. data/lib/cybersource_rest_client/api/tokenized_card_api.rb +24 -8
  71. data/lib/cybersource_rest_client/api/transaction_batches_api.rb +24 -8
  72. data/lib/cybersource_rest_client/api/transaction_details_api.rb +6 -2
  73. data/lib/cybersource_rest_client/api/transient_token_data_api.rb +12 -4
  74. data/lib/cybersource_rest_client/api/unified_checkout_capture_context_api.rb +6 -2
  75. data/lib/cybersource_rest_client/api/user_management_api.rb +6 -2
  76. data/lib/cybersource_rest_client/api/user_management_search_api.rb +6 -2
  77. data/lib/cybersource_rest_client/api/verification_api.rb +12 -4
  78. data/lib/cybersource_rest_client/api/void_api.rb +30 -10
  79. data/lib/cybersource_rest_client/api_client.rb +20 -3
  80. data/lib/cybersource_rest_client/models/acpv1instructions_decline_threshold.rb +232 -0
  81. data/lib/cybersource_rest_client/models/acpv1instructions_mandates.rb +405 -0
  82. data/lib/cybersource_rest_client/models/acpv1instructions_recurring_payment_information.rb +191 -0
  83. data/lib/cybersource_rest_client/models/acpv1instructionsinstruction_idconf_processor_info_payment_instrument_verifi_results.rb +213 -0
  84. data/lib/cybersource_rest_client/models/acpv1instructionsinstruction_idconfirmations_confirmation_data.rb +229 -0
  85. data/lib/cybersource_rest_client/models/acpv1instructionsinstruction_idconfirmations_merchant_information.rb +258 -0
  86. data/lib/cybersource_rest_client/models/acpv1instructionsinstruction_idconfirmations_order_information.rb +377 -0
  87. data/lib/cybersource_rest_client/models/acpv1instructionsinstruction_idconfirmations_order_information_shipping_details.rb +206 -0
  88. data/lib/cybersource_rest_client/models/acpv1instructionsinstruction_idconfirmations_processor_information.rb +425 -0
  89. data/lib/cybersource_rest_client/models/acpv1instructionsinstruction_idconfirmations_processor_information_payment_instrument.rb +190 -0
  90. data/lib/cybersource_rest_client/models/acpv1instructionsinstruction_idcredentials_attachments.rb +258 -0
  91. data/lib/cybersource_rest_client/models/acpv1instructionsinstruction_idcredentials_client_reference_information.rb +215 -0
  92. data/lib/cybersource_rest_client/models/acpv1instructionsinstruction_idcredentials_mandate_reference_data.rb +205 -0
  93. data/lib/cybersource_rest_client/models/acpv1instructionsinstruction_idcredentials_merchant_information.rb +334 -0
  94. data/lib/cybersource_rest_client/models/acpv1instructionsinstruction_idcredentials_merchant_information_merchant_descriptor.rb +250 -0
  95. data/lib/cybersource_rest_client/models/acpv1instructionsinstruction_idcredentials_order_information.rb +228 -0
  96. data/lib/cybersource_rest_client/models/acpv1instructionsinstruction_idcredentials_order_information_amount_detail.rb +354 -0
  97. data/lib/cybersource_rest_client/models/acpv1instructionsinstruction_idcredentials_order_information_items.rb +367 -0
  98. data/lib/cybersource_rest_client/models/acpv1instructionsinstruction_idcredentials_order_information_items_additional_info.rb +231 -0
  99. data/lib/cybersource_rest_client/models/acpv1instructionsinstruction_idcredentials_order_information_items_policies.rb +346 -0
  100. data/lib/cybersource_rest_client/models/acpv1instructionsinstruction_idcredentials_order_information_line_items.rb +190 -0
  101. data/lib/cybersource_rest_client/models/acpv1instructionsinstruction_idcredentials_order_information_ship_to.rb +686 -0
  102. data/lib/cybersource_rest_client/models/acpv1instructionsinstruction_idcredentials_payment_options.rb +217 -0
  103. data/lib/cybersource_rest_client/models/acpv1instructionsinstruction_idcredentials_transaction_data.rb +348 -0
  104. data/lib/cybersource_rest_client/models/acpv1tokens_assurance_data.rb +313 -0
  105. data/lib/cybersource_rest_client/models/acpv1tokens_authenticated_identities.rb +237 -0
  106. data/lib/cybersource_rest_client/models/acpv1tokens_authentication_context.rb +191 -0
  107. data/lib/cybersource_rest_client/models/acpv1tokens_bill_to.rb +400 -0
  108. data/lib/cybersource_rest_client/models/acpv1tokens_buyer_information.rb +229 -0
  109. data/lib/cybersource_rest_client/models/acpv1tokens_buyer_information_personal_identification.rb +212 -0
  110. data/lib/cybersource_rest_client/models/acpv1tokens_consent_data.rb +297 -0
  111. data/lib/cybersource_rest_client/models/acpv1tokens_consumer_identity.rb +268 -0
  112. data/lib/cybersource_rest_client/models/acpv1tokens_device_information.rb +378 -0
  113. data/lib/cybersource_rest_client/models/acpv1tokens_device_information_device_data.rb +302 -0
  114. data/lib/cybersource_rest_client/models/acpv1tokens_enrollment_reference_data.rb +207 -0
  115. data/lib/cybersource_rest_client/models/acpv1tokens_payment_information.rb +215 -0
  116. data/lib/cybersource_rest_client/models/acpv1tokens_payment_information_customer.rb +197 -0
  117. data/lib/cybersource_rest_client/models/acpv1tokens_payment_information_instrument_identifier.rb +206 -0
  118. data/lib/cybersource_rest_client/models/acpv1tokens_payment_information_payment_instrument.rb +197 -0
  119. data/lib/cybersource_rest_client/models/agentic_cancel_purchase_intent_request.rb +257 -0
  120. data/lib/cybersource_rest_client/models/agentic_card_enrollment_bad_request_response400.rb +189 -0
  121. data/lib/cybersource_rest_client/models/agentic_card_enrollment_bad_request_response400_error.rb +238 -0
  122. data/lib/cybersource_rest_client/models/agentic_card_enrollment_bad_request_response400_error_detail.rb +224 -0
  123. data/lib/cybersource_rest_client/models/agentic_card_enrollment_request.rb +325 -0
  124. data/lib/cybersource_rest_client/models/agentic_card_enrollment_response200.rb +206 -0
  125. data/lib/cybersource_rest_client/models/agentic_card_enrollment_response202.rb +219 -0
  126. data/lib/cybersource_rest_client/models/agentic_confirm_transaction_events_request.rb +247 -0
  127. data/lib/cybersource_rest_client/models/agentic_confirm_transaction_events_response202.rb +195 -0
  128. data/lib/cybersource_rest_client/models/agentic_create_purchase_intent_request.rb +327 -0
  129. data/lib/cybersource_rest_client/models/agentic_create_purchase_intent_response200.rb +222 -0
  130. data/lib/cybersource_rest_client/models/agentic_pending_purchase_intent_response202.rb +241 -0
  131. data/lib/cybersource_rest_client/models/agentic_retrieve_payment_credentials_request.rb +247 -0
  132. data/lib/cybersource_rest_client/models/agentic_retrieve_payment_credentials_response200.rb +200 -0
  133. data/lib/cybersource_rest_client/models/agentic_retrieve_payment_credentials_response200_transaction_response_complete.rb +244 -0
  134. data/lib/cybersource_rest_client/models/agentic_retrieve_payment_credentials_response200_transaction_response_with_pending_events.rb +235 -0
  135. data/lib/cybersource_rest_client/models/agentic_update_purchase_intent_request.rb +315 -0
  136. data/lib/cybersource_rest_client/models/boardingv1registrations_organization_information_business_information.rb +36 -1
  137. data/lib/cybersource_rest_client/models/boardingv1registrations_organization_information_business_information_localized_names.rb +254 -0
  138. data/lib/cybersource_rest_client/models/ptsv2payments_travel_information_transit_airline_ancillary_information.rb +22 -5
  139. data/lib/cybersource_rest_client/models/ptsv2payments_travel_information_transit_airline_ancillary_information_service.rb +39 -5
  140. data/lib/cybersource_rest_client/models/ptsv2paymentsidrefunds_travel_information.rb +246 -0
  141. data/lib/cybersource_rest_client/models/ptsv2paymentsidrefunds_travel_information_transit.rb +189 -0
  142. data/lib/cybersource_rest_client/models/ptsv2paymentsidrefunds_travel_information_transit_airline.rb +889 -0
  143. data/lib/cybersource_rest_client/models/ptsv2paymentsidrefunds_travel_information_transit_airline_ancillary_information.rb +259 -0
  144. data/lib/cybersource_rest_client/models/ptsv2paymentsidrefunds_travel_information_transit_airline_ancillary_information_service.rb +213 -0
  145. data/lib/cybersource_rest_client/models/refund_capture_request.rb +1 -1
  146. data/lib/cybersource_rest_client/models/refund_payment_request.rb +1 -1
  147. data/lib/cybersource_rest_client/models/upv1capturecontexts_data.rb +4 -2
  148. data/lib/cybersource_rest_client/models/upv1capturecontexts_data_merchant_defined_information.rb +3 -2
  149. data/lib/cybersource_rest_client/utilities/jwe_utility.rb +1 -1
  150. data/lib/cybersource_rest_client.rb +64 -0
  151. metadata +68 -3
  152. /data/lib/AuthenticationSDK/util/{JWEUtility.rb → AuthJWEUtility.rb} +0 -0
@@ -70,7 +70,7 @@ module CyberSource
70
70
  post_body = @api_client.object_to_http_body(mit_void_request)
71
71
  sdk_tracker = SdkTracker.new
72
72
  post_body = sdk_tracker.insert_developer_id_tracker(post_body, 'MitVoidRequest', @api_client.config.host, @api_client.merchantconfig.defaultDeveloperId)
73
- inbound_mle_status = "optional"
73
+ inbound_mle_status = "optional"
74
74
  if MLEUtility.check_is_mle_for_API(@api_client.merchantconfig, inbound_mle_status, ["mit_void","mit_void_with_http_info"])
75
75
  begin
76
76
  post_body = MLEUtility.encrypt_request_payload(@api_client.merchantconfig, post_body)
@@ -78,6 +78,9 @@ module CyberSource
78
78
  raise
79
79
  end
80
80
  end
81
+
82
+ is_response_mle_for_api = MLEUtility.check_is_response_mle_for_api(@api_client.merchantconfig, ["mit_void","mit_void_with_http_info"])
83
+
81
84
  auth_names = []
82
85
  data, status_code, headers = @api_client.call_api(:POST, local_var_path,
83
86
  :header_params => header_params,
@@ -85,7 +88,8 @@ module CyberSource
85
88
  :form_params => form_params,
86
89
  :body => post_body,
87
90
  :auth_names => auth_names,
88
- :return_type => 'PtsV2PaymentsVoidsPost201Response')
91
+ :return_type => 'PtsV2PaymentsVoidsPost201Response',
92
+ :isResponseMLEForApi => is_response_mle_for_api)
89
93
  if @api_client.config.debugging
90
94
  begin
91
95
  raise
@@ -153,7 +157,7 @@ module CyberSource
153
157
  post_body = @api_client.object_to_http_body(void_capture_request)
154
158
  sdk_tracker = SdkTracker.new
155
159
  post_body = sdk_tracker.insert_developer_id_tracker(post_body, 'VoidCaptureRequest', @api_client.config.host, @api_client.merchantconfig.defaultDeveloperId)
156
- inbound_mle_status = "optional"
160
+ inbound_mle_status = "optional"
157
161
  if MLEUtility.check_is_mle_for_API(@api_client.merchantconfig, inbound_mle_status, ["void_capture","void_capture_with_http_info"])
158
162
  begin
159
163
  post_body = MLEUtility.encrypt_request_payload(@api_client.merchantconfig, post_body)
@@ -161,6 +165,9 @@ module CyberSource
161
165
  raise
162
166
  end
163
167
  end
168
+
169
+ is_response_mle_for_api = MLEUtility.check_is_response_mle_for_api(@api_client.merchantconfig, ["void_capture","void_capture_with_http_info"])
170
+
164
171
  auth_names = []
165
172
  data, status_code, headers = @api_client.call_api(:POST, local_var_path,
166
173
  :header_params => header_params,
@@ -168,7 +175,8 @@ module CyberSource
168
175
  :form_params => form_params,
169
176
  :body => post_body,
170
177
  :auth_names => auth_names,
171
- :return_type => 'PtsV2PaymentsVoidsPost201Response')
178
+ :return_type => 'PtsV2PaymentsVoidsPost201Response',
179
+ :isResponseMLEForApi => is_response_mle_for_api)
172
180
  if @api_client.config.debugging
173
181
  begin
174
182
  raise
@@ -236,7 +244,7 @@ module CyberSource
236
244
  post_body = @api_client.object_to_http_body(void_credit_request)
237
245
  sdk_tracker = SdkTracker.new
238
246
  post_body = sdk_tracker.insert_developer_id_tracker(post_body, 'VoidCreditRequest', @api_client.config.host, @api_client.merchantconfig.defaultDeveloperId)
239
- inbound_mle_status = "optional"
247
+ inbound_mle_status = "optional"
240
248
  if MLEUtility.check_is_mle_for_API(@api_client.merchantconfig, inbound_mle_status, ["void_credit","void_credit_with_http_info"])
241
249
  begin
242
250
  post_body = MLEUtility.encrypt_request_payload(@api_client.merchantconfig, post_body)
@@ -244,6 +252,9 @@ module CyberSource
244
252
  raise
245
253
  end
246
254
  end
255
+
256
+ is_response_mle_for_api = MLEUtility.check_is_response_mle_for_api(@api_client.merchantconfig, ["void_credit","void_credit_with_http_info"])
257
+
247
258
  auth_names = []
248
259
  data, status_code, headers = @api_client.call_api(:POST, local_var_path,
249
260
  :header_params => header_params,
@@ -251,7 +262,8 @@ module CyberSource
251
262
  :form_params => form_params,
252
263
  :body => post_body,
253
264
  :auth_names => auth_names,
254
- :return_type => 'PtsV2PaymentsVoidsPost201Response')
265
+ :return_type => 'PtsV2PaymentsVoidsPost201Response',
266
+ :isResponseMLEForApi => is_response_mle_for_api)
255
267
  if @api_client.config.debugging
256
268
  begin
257
269
  raise
@@ -319,7 +331,7 @@ module CyberSource
319
331
  post_body = @api_client.object_to_http_body(void_payment_request)
320
332
  sdk_tracker = SdkTracker.new
321
333
  post_body = sdk_tracker.insert_developer_id_tracker(post_body, 'VoidPaymentRequest', @api_client.config.host, @api_client.merchantconfig.defaultDeveloperId)
322
- inbound_mle_status = "optional"
334
+ inbound_mle_status = "optional"
323
335
  if MLEUtility.check_is_mle_for_API(@api_client.merchantconfig, inbound_mle_status, ["void_payment","void_payment_with_http_info"])
324
336
  begin
325
337
  post_body = MLEUtility.encrypt_request_payload(@api_client.merchantconfig, post_body)
@@ -327,6 +339,9 @@ module CyberSource
327
339
  raise
328
340
  end
329
341
  end
342
+
343
+ is_response_mle_for_api = MLEUtility.check_is_response_mle_for_api(@api_client.merchantconfig, ["void_payment","void_payment_with_http_info"])
344
+
330
345
  auth_names = []
331
346
  data, status_code, headers = @api_client.call_api(:POST, local_var_path,
332
347
  :header_params => header_params,
@@ -334,7 +349,8 @@ module CyberSource
334
349
  :form_params => form_params,
335
350
  :body => post_body,
336
351
  :auth_names => auth_names,
337
- :return_type => 'PtsV2PaymentsVoidsPost201Response')
352
+ :return_type => 'PtsV2PaymentsVoidsPost201Response',
353
+ :isResponseMLEForApi => is_response_mle_for_api)
338
354
  if @api_client.config.debugging
339
355
  begin
340
356
  raise
@@ -402,7 +418,7 @@ module CyberSource
402
418
  post_body = @api_client.object_to_http_body(void_refund_request)
403
419
  sdk_tracker = SdkTracker.new
404
420
  post_body = sdk_tracker.insert_developer_id_tracker(post_body, 'VoidRefundRequest', @api_client.config.host, @api_client.merchantconfig.defaultDeveloperId)
405
- inbound_mle_status = "optional"
421
+ inbound_mle_status = "optional"
406
422
  if MLEUtility.check_is_mle_for_API(@api_client.merchantconfig, inbound_mle_status, ["void_refund","void_refund_with_http_info"])
407
423
  begin
408
424
  post_body = MLEUtility.encrypt_request_payload(@api_client.merchantconfig, post_body)
@@ -410,6 +426,9 @@ module CyberSource
410
426
  raise
411
427
  end
412
428
  end
429
+
430
+ is_response_mle_for_api = MLEUtility.check_is_response_mle_for_api(@api_client.merchantconfig, ["void_refund","void_refund_with_http_info"])
431
+
413
432
  auth_names = []
414
433
  data, status_code, headers = @api_client.call_api(:POST, local_var_path,
415
434
  :header_params => header_params,
@@ -417,7 +436,8 @@ module CyberSource
417
436
  :form_params => form_params,
418
437
  :body => post_body,
419
438
  :auth_names => auth_names,
420
- :return_type => 'PtsV2PaymentsVoidsPost201Response')
439
+ :return_type => 'PtsV2PaymentsVoidsPost201Response',
440
+ :isResponseMLEForApi => is_response_mle_for_api)
421
441
  if @api_client.config.debugging
422
442
  begin
423
443
  raise
@@ -78,6 +78,19 @@ module CyberSource
78
78
  end
79
79
  end
80
80
 
81
+ # Check the response body first if it is mle encrypted then do deserialize
82
+ if MLEUtility.check_is_mle_encrypted_response(response.body)
83
+ begin
84
+ body = MLEUtility.decrypt_mle_response_payload(@merchantconfig, response.body)
85
+ response = Typhoeus::Response.new(:code => response.code, :headers => response.headers.to_hash, :body => body)
86
+ rescue => e
87
+ raise ApiError.new(:message => "MLE Encrypted Response Decryption Error Occurred. Error: #{e.message}",
88
+ :code => response.code,
89
+ :response_headers => response.headers,
90
+ :body => response.body)
91
+ end
92
+ end
93
+
81
94
  unless response.success?
82
95
  if response.timed_out?
83
96
  fail ApiError.new('Connection timed out')
@@ -117,9 +130,11 @@ module CyberSource
117
130
  query_params = Addressable::URI.form_encode(query_params)
118
131
  end
119
132
 
133
+ isResponseMLEForApi = opts[:isResponseMLEForApi] || false
134
+
120
135
  headers = opts[:header_params]
121
136
  if @merchantconfig.authenticationType.upcase != Constants::AUTH_TYPE_MUTUAL_AUTH
122
- headers = CallAuthenticationHeader(http_method, path, body_params, headers, query_params)
137
+ headers = CallAuthenticationHeader(http_method, path, body_params, headers, query_params, isResponseMLEForApi)
123
138
  end
124
139
  http_method = http_method.to_sym.downcase
125
140
  header_params = headers.merge(@default_headers)
@@ -188,7 +203,7 @@ module CyberSource
188
203
  end
189
204
  end
190
205
  # Calling Authentication
191
- def CallAuthenticationHeader(http_method, path, body_params, header_params, query_params)
206
+ def CallAuthenticationHeader(http_method, path, body_params, header_params, query_params, isResponseMLEForApi)
192
207
  require_relative '../AuthenticationSDK/core/Authorization.rb'
193
208
  require_relative '../AuthenticationSDK/authentication/payloadDigest/digest.rb'
194
209
  request_target = get_query_param(path, query_params)
@@ -207,7 +222,7 @@ module CyberSource
207
222
  @merchantconfig.requestUrl = url
208
223
  # Calling APISDK, Apisdk.controller.
209
224
  gmtDateTime = DateTime.now.httpdate
210
- token = Authorization.new.getToken(@merchantconfig, gmtDateTime)
225
+ token = Authorization.new.getToken(@merchantconfig, gmtDateTime, isResponseMLEForApi)
211
226
 
212
227
  # Adding client ID header
213
228
  header_params['v-c-client-id'] = @client_id
@@ -267,6 +282,8 @@ module CyberSource
267
282
  # @param [Response] response HTTP response
268
283
  # @param [String] return_type some examples: "User", "Array[User]", "Hash[String,Integer]"
269
284
  def deserialize(response, return_type)
285
+ require_relative '../AuthenticationSDK/util/MLEUtility.rb'
286
+
270
287
  body = response.body
271
288
 
272
289
  # handle file downloading - return the File instance processed in request callbacks
@@ -0,0 +1,232 @@
1
+ =begin
2
+ #CyberSource Merged Spec
3
+
4
+ #All CyberSource API specs merged together. These are available at https://developer.cybersource.com/api/reference/api-reference.html
5
+
6
+ OpenAPI spec version: 0.0.1
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.4.38
10
+ =end
11
+
12
+ require 'date'
13
+
14
+ module CyberSource
15
+ # Decline Threshold data.
16
+ class Acpv1instructionsDeclineThreshold
17
+ # Transaction Decline Threshold amount.
18
+ attr_accessor :amount
19
+
20
+ # ISO 4217 currency code. Currency in which the Transaction Decline Threshold amount is expressed.
21
+ attr_accessor :currency_code
22
+
23
+ # Attribute mapping from ruby-style variable name to JSON key.
24
+ def self.attribute_map
25
+ {
26
+ :'amount' => :'amount',
27
+ :'currency_code' => :'currencyCode'
28
+ }
29
+ end
30
+
31
+ # Attribute mapping from JSON key to ruby-style variable name.
32
+ def self.json_map
33
+ {
34
+ :'amount' => :'amount',
35
+ :'currency_code' => :'currency_code'
36
+ }
37
+ end
38
+
39
+ # Attribute type mapping.
40
+ def self.swagger_types
41
+ {
42
+ :'amount' => :'String',
43
+ :'currency_code' => :'String'
44
+ }
45
+ end
46
+
47
+ # Initializes the object
48
+ # @param [Hash] attributes Model attributes in the form of hash
49
+ def initialize(attributes = {})
50
+ return unless attributes.is_a?(Hash)
51
+
52
+ # convert string to symbol for hash key
53
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
54
+
55
+ if attributes.has_key?(:'amount')
56
+ self.amount = attributes[:'amount']
57
+ end
58
+
59
+ if attributes.has_key?(:'currencyCode')
60
+ self.currency_code = attributes[:'currencyCode']
61
+ end
62
+ end
63
+
64
+ # Show invalid properties with the reasons. Usually used together with valid?
65
+ # @return Array for valid properties with the reasons
66
+ def list_invalid_properties
67
+ invalid_properties = Array.new
68
+ #if !@amount.nil? && @amount !~ Regexp.new(/(?!^[*.,'#_\/-]+$)(?!.*\\.\/.*)^.+$/)
69
+ #invalid_properties.push('invalid value for "amount", must conform to the pattern /(?!^[*.,'#_\/-]+$)(?!.*\\.\/.*)^.+$/.')
70
+ #end
71
+
72
+ #if !@currency_code.nil? && @currency_code !~ Regexp.new(/(?!^[*.,'#_\/-]+$)(?!.*\\.\/.*)^.+$/)
73
+ #invalid_properties.push('invalid value for "currency_code", must conform to the pattern /(?!^[*.,'#_\/-]+$)(?!.*\\.\/.*)^.+$/.')
74
+ #end
75
+
76
+ invalid_properties
77
+ end
78
+
79
+ # Check to see if the all the properties in the model are valid
80
+ # @return true if the model is valid
81
+ def valid?
82
+ #return false if !@amount.nil? && @amount !~ Regexp.new(/(?!^[*.,'#_\/-]+$)(?!.*\\.\/.*)^.+$/)
83
+ #return false if !@currency_code.nil? && @currency_code !~ Regexp.new(/(?!^[*.,'#_\/-]+$)(?!.*\\.\/.*)^.+$/)
84
+ true
85
+ end
86
+
87
+ # Custom attribute writer method with validation
88
+ # @param [Object] amount Value to be assigned
89
+ def amount=(amount)
90
+ #if !amount.nil? && amount !~ Regexp.new(/(?!^[*.,'#_\/-]+$)(?!.*\\.\/.*)^.+$/)
91
+ #fail ArgumentError, 'invalid value for "amount", must conform to the pattern /(?!^[*.,'#_\/-]+$)(?!.*\\.\/.*)^.+$/.'
92
+ #end
93
+
94
+ @amount = amount
95
+ end
96
+
97
+ # Custom attribute writer method with validation
98
+ # @param [Object] currency_code Value to be assigned
99
+ def currency_code=(currency_code)
100
+ #if !currency_code.nil? && currency_code !~ Regexp.new(/(?!^[*.,'#_\/-]+$)(?!.*\\.\/.*)^.+$/)
101
+ #fail ArgumentError, 'invalid value for "currency_code", must conform to the pattern /(?!^[*.,'#_\/-]+$)(?!.*\\.\/.*)^.+$/.'
102
+ #end
103
+
104
+ @currency_code = currency_code
105
+ end
106
+
107
+ # Checks equality by comparing each attribute.
108
+ # @param [Object] Object to be compared
109
+ def ==(o)
110
+ return true if self.equal?(o)
111
+ self.class == o.class &&
112
+ amount == o.amount &&
113
+ currency_code == o.currency_code
114
+ end
115
+
116
+ # @see the `==` method
117
+ # @param [Object] Object to be compared
118
+ def eql?(o)
119
+ self == o
120
+ end
121
+
122
+ # Calculates hash code according to all attributes.
123
+ # @return [Fixnum] Hash code
124
+ def hash
125
+ [amount, currency_code].hash
126
+ end
127
+
128
+ # Builds the object from hash
129
+ # @param [Hash] attributes Model attributes in the form of hash
130
+ # @return [Object] Returns the model itself
131
+ def build_from_hash(attributes)
132
+ return nil unless attributes.is_a?(Hash)
133
+ self.class.swagger_types.each_pair do |key, type|
134
+ if type =~ /\AArray<(.*)>/i
135
+ # check to ensure the input is an array given that the the attribute
136
+ # is documented as an array but the input is not
137
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
138
+ self.send("#{self.class.json_map[key]}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
139
+ end
140
+ elsif !attributes[self.class.attribute_map[key]].nil?
141
+ self.send("#{self.class.json_map[key]}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
142
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
143
+ end
144
+
145
+ self
146
+ end
147
+
148
+ # Deserializes the data based on type
149
+ # @param string type Data type
150
+ # @param string value Value to be deserialized
151
+ # @return [Object] Deserialized data
152
+ def _deserialize(type, value)
153
+ case type.to_sym
154
+ when :DateTime
155
+ DateTime.parse(value)
156
+ when :Date
157
+ Date.parse(value)
158
+ when :String
159
+ value.to_s
160
+ when :Integer
161
+ value.to_i
162
+ when :Float
163
+ value.to_f
164
+ when :BOOLEAN
165
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
166
+ true
167
+ else
168
+ false
169
+ end
170
+ when :Object
171
+ # generic object (usually a Hash), return directly
172
+ value
173
+ when /\AArray<(?<inner_type>.+)>\z/
174
+ inner_type = Regexp.last_match[:inner_type]
175
+ value.map { |v| _deserialize(inner_type, v) }
176
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
177
+ k_type = Regexp.last_match[:k_type]
178
+ v_type = Regexp.last_match[:v_type]
179
+ {}.tap do |hash|
180
+ value.each do |k, v|
181
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
182
+ end
183
+ end
184
+ else # model
185
+ temp_model = CyberSource.const_get(type).new
186
+ temp_model.build_from_hash(value)
187
+ end
188
+ end
189
+
190
+ # Returns the string representation of the object
191
+ # @return [String] String presentation of the object
192
+ def to_s
193
+ to_hash.to_s
194
+ end
195
+
196
+ # to_body is an alias to to_hash (backward compatibility)
197
+ # @return [Hash] Returns the object in the form of hash
198
+ def to_body
199
+ to_hash
200
+ end
201
+
202
+ # Returns the object in the form of hash
203
+ # @return [Hash] Returns the object in the form of hash
204
+ def to_hash
205
+ hash = {}
206
+ self.class.attribute_map.each_pair do |attr, param|
207
+ value = self.send(attr)
208
+ next if value.nil?
209
+ hash[param] = _to_hash(value)
210
+ end
211
+ hash
212
+ end
213
+
214
+ # Outputs non-array value in the form of hash
215
+ # For object, use to_hash. Otherwise, just return the value
216
+ # @param [Object] value Any valid value
217
+ # @return [Hash] Returns the value in the form of hash
218
+ def _to_hash(value)
219
+ if value.is_a?(Array)
220
+ value.compact.map { |v| _to_hash(v) }
221
+ elsif value.is_a?(Hash)
222
+ {}.tap do |hash|
223
+ value.each { |k, v| hash[k] = _to_hash(v) }
224
+ end
225
+ elsif value.respond_to? :to_hash
226
+ value.to_hash
227
+ else
228
+ value
229
+ end
230
+ end
231
+ end
232
+ end