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.
- checksums.yaml +4 -4
- data/lib/AuthenticationSDK/authentication/oauth/OAuthToken.rb +15 -0
- data/lib/AuthenticationSDK/core/Authorization.rb +4 -1
- data/lib/AuthenticationSDK/core/MerchantConfig.rb +93 -19
- data/lib/AuthenticationSDK/util/Constants.rb +77 -75
- data/lib/cybersource_rest_client/api/o_auth_api.rb +104 -0
- data/lib/cybersource_rest_client/api/payments_api.rb +2 -2
- data/lib/cybersource_rest_client/api/refund_api.rb +4 -4
- data/lib/cybersource_rest_client/api/void_api.rb +4 -4
- data/lib/cybersource_rest_client/api_client.rb +31 -8
- data/lib/cybersource_rest_client/configuration.rb +2 -2
- data/lib/cybersource_rest_client/models/access_token_response.rb +244 -0
- data/lib/cybersource_rest_client/models/add_negative_list_request.rb +1 -1
- data/lib/cybersource_rest_client/models/bad_request_error.rb +192 -0
- data/lib/cybersource_rest_client/models/create_access_token_request.rb +254 -0
- data/lib/cybersource_rest_client/models/fraud_marking_action_request.rb +1 -1
- data/lib/cybersource_rest_client/models/inline_response_400_2.rb +1 -1
- data/lib/cybersource_rest_client/models/invoicing_v2_invoice_settings_get200_response.rb +1 -1
- data/lib/cybersource_rest_client/models/invoicing_v2_invoices_all_get200_response.rb +1 -1
- data/lib/cybersource_rest_client/models/invoicing_v2_invoices_all_get200_response_customer_information.rb +20 -4
- data/lib/cybersource_rest_client/models/invoicing_v2_invoices_all_get200_response_invoices.rb +1 -1
- data/lib/cybersource_rest_client/models/invoicing_v2_invoices_all_get400_response.rb +1 -1
- data/lib/cybersource_rest_client/models/invoicing_v2_invoices_all_get404_response.rb +1 -1
- data/lib/cybersource_rest_client/models/invoicing_v2_invoices_all_get502_response.rb +1 -1
- data/lib/cybersource_rest_client/models/invoicing_v2_invoices_get200_response.rb +2 -2
- data/lib/cybersource_rest_client/models/invoicing_v2_invoices_post201_response.rb +2 -2
- data/lib/cybersource_rest_client/models/invoicing_v2_invoices_post202_response.rb +1 -1
- data/lib/cybersource_rest_client/models/invoicingv2invoices_customer_information.rb +20 -4
- data/lib/cybersource_rest_client/models/kms_v2_keys_asym_deletes_post200_response.rb +1 -1
- data/lib/cybersource_rest_client/models/kms_v2_keys_asym_get200_response.rb +1 -1
- data/lib/cybersource_rest_client/models/kms_v2_keys_asym_post201_response.rb +1 -1
- data/lib/cybersource_rest_client/models/kms_v2_keys_sym_deletes_post200_response.rb +1 -1
- data/lib/cybersource_rest_client/models/kms_v2_keys_sym_get200_response.rb +1 -1
- data/lib/cybersource_rest_client/models/kms_v2_keys_sym_post201_response.rb +1 -1
- data/lib/cybersource_rest_client/models/pts_v1_transaction_batches_get200_response.rb +1 -1
- data/lib/cybersource_rest_client/models/pts_v1_transaction_batches_get400_response.rb +1 -1
- data/lib/cybersource_rest_client/models/pts_v1_transaction_batches_get500_response.rb +1 -1
- data/lib/cybersource_rest_client/models/pts_v2_credits_post201_response.rb +3 -3
- data/lib/cybersource_rest_client/models/pts_v2_incremental_authorization_patch201_response.rb +3 -3
- data/lib/cybersource_rest_client/models/pts_v2_incremental_authorization_patch201_response_error_information.rb +1 -1
- data/lib/cybersource_rest_client/models/pts_v2_incremental_authorization_patch201_response_processor_information.rb +6 -0
- data/lib/cybersource_rest_client/models/pts_v2_incremental_authorization_patch400_response.rb +1 -1
- data/lib/cybersource_rest_client/models/pts_v2_payments_captures_post201_response.rb +3 -3
- data/lib/cybersource_rest_client/models/pts_v2_payments_captures_post400_response.rb +1 -1
- data/lib/cybersource_rest_client/models/pts_v2_payments_post201_response.rb +13 -4
- data/lib/cybersource_rest_client/models/pts_v2_payments_post201_response_consumer_authentication_information.rb +11 -1
- data/lib/cybersource_rest_client/models/pts_v2_payments_post201_response_error_information.rb +1 -1
- data/lib/cybersource_rest_client/models/pts_v2_payments_post201_response_order_information.rb +13 -4
- data/lib/cybersource_rest_client/models/pts_v2_payments_post201_response_order_information_reward_points_details.rb +270 -0
- 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
- data/lib/cybersource_rest_client/models/pts_v2_payments_post201_response_payment_account_information_card.rb +242 -0
- data/lib/cybersource_rest_client/models/pts_v2_payments_post201_response_payment_information.rb +1 -1
- data/lib/cybersource_rest_client/models/pts_v2_payments_post201_response_payment_information_tokenized_card.rb +1 -1
- data/lib/cybersource_rest_client/models/pts_v2_payments_post201_response_processing_information.rb +1 -1
- data/lib/cybersource_rest_client/models/pts_v2_payments_post201_response_processor_information.rb +9 -13
- data/lib/cybersource_rest_client/models/pts_v2_payments_post400_response.rb +2 -2
- data/lib/cybersource_rest_client/models/pts_v2_payments_post502_response.rb +1 -1
- data/lib/cybersource_rest_client/models/pts_v2_payments_refund_post201_response.rb +3 -3
- data/lib/cybersource_rest_client/models/pts_v2_payments_refund_post400_response.rb +1 -1
- data/lib/cybersource_rest_client/models/pts_v2_payments_reversals_post201_response.rb +3 -3
- data/lib/cybersource_rest_client/models/pts_v2_payments_reversals_post400_response.rb +1 -1
- data/lib/cybersource_rest_client/models/pts_v2_payments_voids_post201_response.rb +2 -2
- data/lib/cybersource_rest_client/models/pts_v2_payments_voids_post400_response.rb +1 -1
- data/lib/cybersource_rest_client/models/pts_v2_payouts_post201_response.rb +1 -1
- data/lib/cybersource_rest_client/models/pts_v2_payouts_post201_response_error_information.rb +1 -1
- data/lib/cybersource_rest_client/models/pts_v2_payouts_post201_response_merchant_information_merchant_descriptor.rb +6 -0
- data/lib/cybersource_rest_client/models/pts_v2_payouts_post201_response_order_information_amount_details.rb +2 -2
- data/lib/cybersource_rest_client/models/pts_v2_payouts_post201_response_recipient_information_card.rb +1 -1
- data/lib/cybersource_rest_client/models/pts_v2_payouts_post400_response.rb +1 -1
- data/lib/cybersource_rest_client/models/ptsv2credits_processing_information.rb +2 -2
- data/lib/cybersource_rest_client/models/ptsv2payments_client_reference_information.rb +1 -1
- data/lib/cybersource_rest_client/models/ptsv2payments_consumer_authentication_information.rb +27 -1
- data/lib/cybersource_rest_client/models/ptsv2payments_merchant_information_merchant_descriptor.rb +6 -0
- data/lib/cybersource_rest_client/models/ptsv2payments_order_information_amount_details.rb +2 -2
- data/lib/cybersource_rest_client/models/ptsv2payments_payment_information_card.rb +4 -4
- data/lib/cybersource_rest_client/models/ptsv2payments_payment_information_fluid_data.rb +3 -3
- data/lib/cybersource_rest_client/models/ptsv2payments_payment_information_tokenized_card.rb +1 -1
- data/lib/cybersource_rest_client/models/ptsv2payments_point_of_sale_information.rb +38 -38
- data/lib/cybersource_rest_client/models/ptsv2payments_processing_information.rb +16 -6
- data/lib/cybersource_rest_client/models/ptsv2payments_risk_information.rb +15 -4
- data/lib/cybersource_rest_client/models/ptsv2payments_risk_information_auxiliary_data.rb +207 -0
- data/lib/cybersource_rest_client/models/ptsv2paymentsidcaptures_payment_information_card.rb +1 -1
- data/lib/cybersource_rest_client/models/ptsv2paymentsidcaptures_processing_information.rb +15 -5
- data/lib/cybersource_rest_client/models/ptsv2paymentsidrefunds_payment_information_card.rb +4 -4
- data/lib/cybersource_rest_client/models/ptsv2paymentsidrefunds_processing_information.rb +1 -1
- data/lib/cybersource_rest_client/models/ptsv2paymentsidreversals_client_reference_information.rb +17 -1
- data/lib/cybersource_rest_client/models/ptsv2paymentsidreversals_processing_information.rb +1 -1
- data/lib/cybersource_rest_client/models/ptsv2payouts_merchant_information_merchant_descriptor.rb +6 -0
- data/lib/cybersource_rest_client/models/ptsv2payouts_payment_information_card.rb +4 -4
- data/lib/cybersource_rest_client/models/resource_not_found_error.rb +192 -0
- data/lib/cybersource_rest_client/models/risk_v1_address_verifications_post201_response.rb +3 -3
- data/lib/cybersource_rest_client/models/risk_v1_authentication_results_post201_response.rb +3 -3
- data/lib/cybersource_rest_client/models/risk_v1_authentication_setups_post201_response.rb +2 -2
- data/lib/cybersource_rest_client/models/risk_v1_authentications_post201_response.rb +3 -3
- data/lib/cybersource_rest_client/models/risk_v1_authentications_post400_response.rb +1 -1
- data/lib/cybersource_rest_client/models/risk_v1_authentications_post400_response_1.rb +1 -1
- data/lib/cybersource_rest_client/models/risk_v1_decisions_post201_response.rb +3 -3
- data/lib/cybersource_rest_client/models/risk_v1_decisions_post400_response.rb +1 -1
- data/lib/cybersource_rest_client/models/risk_v1_decisions_post400_response_1.rb +1 -1
- data/lib/cybersource_rest_client/models/risk_v1_export_compliance_inquiries_post201_response.rb +3 -3
- data/lib/cybersource_rest_client/models/risk_v1_update_post201_response.rb +2 -2
- data/lib/cybersource_rest_client/models/riskv1authenticationresults_consumer_authentication_information.rb +1 -1
- data/lib/cybersource_rest_client/models/riskv1authenticationresults_payment_information_card.rb +3 -3
- data/lib/cybersource_rest_client/models/riskv1authenticationresults_payment_information_tokenized_card.rb +1 -1
- data/lib/cybersource_rest_client/models/riskv1authentications_payment_information_card.rb +3 -3
- data/lib/cybersource_rest_client/models/riskv1authentications_payment_information_tokenized_card.rb +1 -1
- data/lib/cybersource_rest_client/models/riskv1authenticationsetups_payment_information_card.rb +3 -3
- data/lib/cybersource_rest_client/models/riskv1authenticationsetups_payment_information_fluid_data.rb +3 -3
- data/lib/cybersource_rest_client/models/riskv1authenticationsetups_payment_information_tokenized_card.rb +1 -1
- data/lib/cybersource_rest_client/models/riskv1authenticationsetups_processing_information.rb +1 -1
- data/lib/cybersource_rest_client/models/riskv1decisions_client_reference_information.rb +17 -1
- data/lib/cybersource_rest_client/models/riskv1decisions_device_information.rb +1 -11
- data/lib/cybersource_rest_client/models/riskv1decisions_payment_information_card.rb +3 -3
- data/lib/cybersource_rest_client/models/riskv1decisions_payment_information_tokenized_card.rb +1 -1
- data/lib/cybersource_rest_client/models/riskv1decisions_risk_information.rb +15 -4
- data/lib/cybersource_rest_client/models/riskv1liststypeentries_client_reference_information.rb +224 -0
- data/lib/cybersource_rest_client/models/riskv1liststypeentries_payment_information_card.rb +1 -1
- data/lib/cybersource_rest_client/models/tss_v2_transactions_get200_response.rb +3 -3
- data/lib/cybersource_rest_client/models/tss_v2_transactions_get200_response_consumer_authentication_information.rb +13 -4
- data/lib/cybersource_rest_client/models/tss_v2_transactions_get200_response_consumer_authentication_information_strong_authentication.rb +254 -0
- data/lib/cybersource_rest_client/models/tss_v2_transactions_get200_response_order_information_amount_details.rb +2 -2
- data/lib/cybersource_rest_client/models/tss_v2_transactions_get200_response_payment_information_card.rb +5 -5
- data/lib/cybersource_rest_client/models/tss_v2_transactions_get200_response_processing_information.rb +2 -2
- data/lib/cybersource_rest_client/models/tss_v2_transactions_get200_response_processing_information_authorization_options.rb +13 -4
- data/lib/cybersource_rest_client/models/tss_v2_transactions_get200_response_processor_information.rb +8 -12
- data/lib/cybersource_rest_client/models/tss_v2_transactions_get200_response_risk_information.rb +1 -1
- data/lib/cybersource_rest_client/models/tss_v2_transactions_post201_response.rb +1 -1
- data/lib/cybersource_rest_client/models/tss_v2_transactions_post201_response__embedded_merchant_information.rb +1 -1
- data/lib/cybersource_rest_client/models/tss_v2_transactions_post201_response__embedded_order_information_bill_to.rb +17 -1
- data/lib/cybersource_rest_client/models/tss_v2_transactions_post201_response__embedded_payment_information_card.rb +3 -3
- data/lib/cybersource_rest_client/models/tss_v2_transactions_post201_response__embedded_processing_information.rb +2 -2
- data/lib/cybersource_rest_client/models/tss_v2_transactions_post201_response__embedded_processor_information.rb +6 -0
- data/lib/cybersource_rest_client/models/tss_v2_transactions_post201_response__embedded_transaction_summaries.rb +2 -2
- data/lib/cybersource_rest_client/models/tss_v2_transactions_post400_response.rb +1 -1
- data/lib/cybersource_rest_client/models/unauthorized_client_error.rb +192 -0
- data/lib/cybersource_rest_client/models/validate_export_compliance_request.rb +1 -1
- data/lib/cybersource_rest_client/models/vas_v2_payments_post201_response.rb +2 -2
- data/lib/cybersource_rest_client/models/vas_v2_payments_post400_response.rb +1 -1
- data/lib/cybersource_rest_client/models/vas_v2_tax_void200_response.rb +2 -2
- data/lib/cybersource_rest_client/models/vas_v2_tax_voids_post400_response.rb +1 -1
- data/lib/cybersource_rest_client/models/verify_customer_address_request.rb +1 -1
- data/lib/cybersource_rest_client.rb +12 -1
- metadata +113 -93
- data/lib/AuthenticationSDK/resource/TRRReports.json +0 -12
- data/lib/AuthenticationSDK/resource/cybs.yml +0 -31
- data/lib/AuthenticationSDK/resource/request.json +0 -54
- data/lib/AuthenticationSDK/resource/request_capture.json +0 -11
- data/lib/AuthenticationSDK/resource/testrest.p12 +0 -0
- data/lib/AuthenticationSDK/spec/Authorization_spec.rb +0 -274
- data/lib/AuthenticationSDK/spec/MerchantConfigData.rb +0 -59
- data/lib/AuthenticationSDK/spec/MerchantConfig_spec.rb +0 -116
- data/lib/AuthenticationSDK/spec/PostRequestData.json +0 -54
- data/lib/AuthenticationSDK/spec/PutRequestData.json +0 -12
- data/lib/AuthenticationSDK/spec/ResponseCodeMessage_spec.rb +0 -60
- data/lib/AuthenticationSDK/spec/spec_helper.rb +0 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9306f888d890861c33be4ef9c0c67c6e7e78d053a7339c6c66807de5dd99b0b8
|
4
|
+
data.tar.gz: a4dd82ec40ce761b70acc0f5c3db1d1fce1f2d910093a984b2bdeea0f1ee98f6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '0873f02a4f4d7e0e7322b746219ed0ab3a0aa88083f914797b5c92b34f86772ade6fa3cf3b85be2a64ef4d2013038569bb16c67ef12914790d453e8453eaa02b'
|
7
|
+
data.tar.gz: 49d21f7e4792c7c54452b378b7d2f74535b4c0756430a27ff1aa4b828cf7e97a2217d89af121b4f35a6311ed722f174bfd0a4b3909b95a705ce3cdf034c27630
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require_relative '../../core/ITokenGeneration.rb'
|
2
|
+
require_relative '../../util/Constants.rb'
|
3
|
+
require_relative '../../util/ApiException.rb'
|
4
|
+
require_relative '../../util/Cache.rb'
|
5
|
+
public
|
6
|
+
#JWT Token-generated based on the Request type
|
7
|
+
class GenerateOAuthToken
|
8
|
+
def getToken(merchantconfig_obj,gmtDatetime,log_obj)
|
9
|
+
token = merchantconfig_obj.accessToken
|
10
|
+
rescue StandardError => err
|
11
|
+
ApiException.new.apiexception(err,log_obj)
|
12
|
+
exit!
|
13
|
+
end
|
14
|
+
implements TokenInterface
|
15
|
+
end
|
@@ -1,5 +1,6 @@
|
|
1
1
|
require_relative '../authentication/http/HttpSignatureHeader.rb'
|
2
2
|
require_relative '../authentication/jwt/JwtToken.rb'
|
3
|
+
require_relative '../authentication/oauth/OAuthToken.rb'
|
3
4
|
require_relative '../util/Constants.rb'
|
4
5
|
require_relative '../util/ApiException.rb'
|
5
6
|
public
|
@@ -14,7 +15,9 @@ public
|
|
14
15
|
token = GenerateHttpSignature.new.getToken(merchantconfig_obj, gmtdatetime, log_obj)
|
15
16
|
elsif authenticationType == Constants::AUTH_TYPE_JWT
|
16
17
|
token = GenerateJwtToken.new.getToken(merchantconfig_obj, gmtdatetime, log_obj)
|
17
|
-
elsif authenticationType
|
18
|
+
elsif authenticationType == Constants::AUTH_TYPE_OAUTH
|
19
|
+
token = GenerateOAuthToken.new.getToken(merchantconfig_obj, gmtdatetime, log_obj)
|
20
|
+
else
|
18
21
|
raise StandardError.ner(Constants::ERROR_PREFIX + Constants::AUTH_ERROR)
|
19
22
|
end
|
20
23
|
rescue StandardError => err
|
@@ -30,6 +30,16 @@ public
|
|
30
30
|
@portfolioID = cybsPropertyObj['portfolioID']
|
31
31
|
@logFilename = cybsPropertyObj['logFilename']
|
32
32
|
@solutionId = cybsPropertyObj['solutionId']
|
33
|
+
# MutualAuth & OAuth Parameters
|
34
|
+
@enableClientCert = cybsPropertyObj['enableClientCert']
|
35
|
+
@clientCertDirectory = cybsPropertyObj['clientCertDirectory']
|
36
|
+
@sslClientCert = cybsPropertyObj['sslClientCert']
|
37
|
+
@privateKey = cybsPropertyObj['privateKey']
|
38
|
+
@sslKeyPassword = cybsPropertyObj['sslKeyPassword']
|
39
|
+
@clientId = cybsPropertyObj['clientId']
|
40
|
+
@clientSecret = cybsPropertyObj['clientSecret']
|
41
|
+
@accessToken = cybsPropertyObj['accessToken']
|
42
|
+
@refreshToken = cybsPropertyObj['refreshToken']
|
33
43
|
validateMerchantDetails()
|
34
44
|
logAllProperties(cybsPropertyObj)
|
35
45
|
end
|
@@ -62,13 +72,7 @@ public
|
|
62
72
|
@log_obj.logger.info('START> =======================================')
|
63
73
|
if !logmessage.to_s.empty?
|
64
74
|
ApiException.new.apiwarning(logmessage,log_obj)
|
65
|
-
end
|
66
|
-
if @merchantId.to_s.empty?
|
67
|
-
err = raise StandardError.new(Constants::ERROR_PREFIX + Constants::MERCHANT_ID_NULL)
|
68
|
-
ApiException.new.apiexception(err,log_obj)
|
69
|
-
elsif !@merchantId.instance_of? String
|
70
|
-
@merchantId=@merchantId.to_s
|
71
|
-
end
|
75
|
+
end
|
72
76
|
if @authenticationType.to_s.empty?
|
73
77
|
err = raise StandardError.new(Constants::ERROR_PREFIX + Constants::AUTH_TYPE_MANDATORY)
|
74
78
|
ApiException.new.apiexception(err,log_obj)
|
@@ -80,18 +84,11 @@ public
|
|
80
84
|
if !@runEnvironment.to_s.empty?
|
81
85
|
if !@runEnvironment.instance_of? String
|
82
86
|
@requestHost = @runEnvironment.to_s
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
@requestHost = Constants::BOA_PRODUCTION_URL
|
89
|
-
elsif @runEnvironment.upcase == Constants.BOA_RUN_ENV_SANDBOX
|
90
|
-
@requestHost = Constants::BOA_SANDBOX_URL
|
91
|
-
elsif @runEnvironment.upcase == Constants::IDC_RUN_ENV_PROD
|
92
|
-
@requestHost = Constants::IDC_PRODUCTION_URL
|
93
|
-
elsif @runEnvironment.upcase == Constants.IDC_RUN_ENV_SANDBOX
|
94
|
-
@requestHost = Constants::IDC_SANDBOX_URL
|
87
|
+
end
|
88
|
+
|
89
|
+
if Constants::OLD_RUN_ENVIRONMENT_CONSTANTS.include?(@runEnvironment.upcase)
|
90
|
+
err = raise StandardError.new(Constants::ERROR_PREFIX + Constants::DERPECATED_ENVIRONMENT)
|
91
|
+
ApiException.new.apiexception(err, log_obj)
|
95
92
|
else
|
96
93
|
@requestHost = @runEnvironment
|
97
94
|
end
|
@@ -99,7 +96,41 @@ public
|
|
99
96
|
err = raise StandardError.new(Constants::ERROR_PREFIX + Constants::RUN_ENVIRONMENT)
|
100
97
|
ApiException.new.apiexception(err,log_obj)
|
101
98
|
end
|
99
|
+
|
100
|
+
if !@enableClientCert.nil? && @enableClientCert
|
101
|
+
if @sslClientCert.to_s.empty?
|
102
|
+
err = raise StandardError.new(Constants::ERROR_PREFIX + Constants::SSL_CLIENT_CERT_EMPTY)
|
103
|
+
ApiException.new.apiexception(err,log_obj)
|
104
|
+
elsif !@sslClientCert.instance_of? String
|
105
|
+
@sslClientCert=@sslClientCert.to_s
|
106
|
+
end
|
107
|
+
if @privateKey.to_s.empty?
|
108
|
+
err = raise StandardError.new(Constants::ERROR_PREFIX + Constants::PRIVATE_KEY_EMPTY)
|
109
|
+
ApiException.new.apiexception(err,log_obj)
|
110
|
+
elsif !@privateKey.instance_of? String
|
111
|
+
@privateKey=@privateKey.to_s
|
112
|
+
end
|
113
|
+
if @sslKeyPassword.to_s.empty?
|
114
|
+
err = Constants::WARNING_PREFIX + Constants::SSL_KEY_PASSWORD_EMPTY
|
115
|
+
ApiException.new.apiwarning(err,log_obj)
|
116
|
+
elsif !@sslKeyPassword.instance_of? String
|
117
|
+
@sslKeyPassword=@sslKeyPassword.to_s
|
118
|
+
end
|
119
|
+
if @clientCertDirectory.to_s.empty?
|
120
|
+
err = raise StandardError.new(Constants::ERROR_PREFIX + Constants::CLIENT_CERT_DIR_EMPTY)
|
121
|
+
ApiException.new.apiexception(err,log_obj)
|
122
|
+
elsif !@clientCertDirectory.instance_of? String
|
123
|
+
@clientCertDirectory=@clientCertDirectory.to_s
|
124
|
+
end
|
125
|
+
end
|
126
|
+
|
102
127
|
if @authenticationType.upcase == Constants::AUTH_TYPE_JWT
|
128
|
+
if @merchantId.to_s.empty?
|
129
|
+
err = raise StandardError.new(Constants::ERROR_PREFIX + Constants::MERCHANT_ID_NULL)
|
130
|
+
ApiException.new.apiexception(err,log_obj)
|
131
|
+
elsif !@merchantId.instance_of? String
|
132
|
+
@merchantId=@merchantId.to_s
|
133
|
+
end
|
103
134
|
if @keyAlias.to_s.empty?
|
104
135
|
@keyAlias = @merchantId
|
105
136
|
ApiException.new.apiwarning(Constants::WARNING_PREFIX + Constants::KEY_ALIAS_NULL_EMPTY, log_obj)
|
@@ -128,7 +159,41 @@ public
|
|
128
159
|
@keyFilename=@keyFilename.to_s
|
129
160
|
end
|
130
161
|
end
|
162
|
+
if @authenticationType.upcase == Constants::AUTH_TYPE_MUTUAL_AUTH
|
163
|
+
if @clientId.to_s.empty?
|
164
|
+
err = raise StandardError.new(Constants::ERROR_PREFIX + Constants::CLIENT_ID_EMPTY)
|
165
|
+
ApiException.new.apiexception(err,log_obj)
|
166
|
+
elsif !@clientId.instance_of? String
|
167
|
+
@clientId=@clientId.to_s
|
168
|
+
end
|
169
|
+
if @clientSecret.to_s.empty?
|
170
|
+
err = raise StandardError.new(Constants::ERROR_PREFIX + Constants::CLIENT_SECRET_EMPTY)
|
171
|
+
ApiException.new.apiexception(err,log_obj)
|
172
|
+
elsif !@clientSecret.instance_of? String
|
173
|
+
@clientSecret=@clientSecret.to_s
|
174
|
+
end
|
175
|
+
end
|
176
|
+
if @authenticationType.upcase == Constants::AUTH_TYPE_OAUTH
|
177
|
+
if @accessToken.to_s.empty?
|
178
|
+
err = raise StandardError.new(Constants::ERROR_PREFIX + Constants::ACCESS_TOKEN_EMPTY)
|
179
|
+
ApiException.new.apiexception(err,log_obj)
|
180
|
+
elsif !@accessToken.instance_of? String
|
181
|
+
@accessToken=@accessToken.to_s
|
182
|
+
end
|
183
|
+
if @refreshToken.to_s.empty?
|
184
|
+
err = raise StandardError.new(Constants::ERROR_PREFIX + Constants::REFRESH_TOKEN_EMPTY)
|
185
|
+
ApiException.new.apiexception(err,log_obj)
|
186
|
+
elsif !@refreshToken.instance_of? String
|
187
|
+
@refreshToken=@refreshToken.to_s
|
188
|
+
end
|
189
|
+
end
|
131
190
|
if @authenticationType.upcase == Constants::AUTH_TYPE_HTTP
|
191
|
+
if @merchantId.to_s.empty?
|
192
|
+
err = raise StandardError.new(Constants::ERROR_PREFIX + Constants::MERCHANT_ID_NULL)
|
193
|
+
ApiException.new.apiexception(err,log_obj)
|
194
|
+
elsif !@merchantId.instance_of? String
|
195
|
+
@merchantId=@merchantId.to_s
|
196
|
+
end
|
132
197
|
if @merchantKeyId.to_s.empty?
|
133
198
|
err = raise StandardError.new(Constants::ERROR_PREFIX+ Constants::MERCHANT_KEY_ID_MANDATORY)
|
134
199
|
ApiException.new.apiexception(err,log_obj)
|
@@ -183,6 +248,15 @@ public
|
|
183
248
|
attr_accessor :keyFilename
|
184
249
|
attr_accessor :useMetaKey
|
185
250
|
attr_accessor :portfolioID
|
251
|
+
attr_accessor :enableClientCert
|
252
|
+
attr_accessor :clientCertDirectory
|
253
|
+
attr_accessor :sslClientCert
|
254
|
+
attr_accessor :sslKeyPassword
|
255
|
+
attr_accessor :privateKey
|
256
|
+
attr_accessor :clientId
|
257
|
+
attr_accessor :clientSecret
|
258
|
+
attr_accessor :accessToken
|
259
|
+
attr_accessor :refreshToken
|
186
260
|
attr_accessor :requestJsonData
|
187
261
|
attr_accessor :requestUrl
|
188
262
|
attr_accessor :requestType
|
@@ -1,156 +1,158 @@
|
|
1
1
|
class Constants
|
2
2
|
|
3
3
|
GET_REQUEST_TYPE_LOWER = 'get' unless const_defined?(:GET_REQUEST_TYPE_LOWER)
|
4
|
-
|
4
|
+
|
5
5
|
POST_REQUEST_TYPE_LOWER = 'post' unless const_defined?(:POST_REQUEST_TYPE_LOWER)
|
6
|
-
|
6
|
+
|
7
7
|
PUT_REQUEST_TYPE_LOWER = 'put' unless const_defined?(:PUT_REQUEST_TYPE_LOWER)
|
8
8
|
|
9
9
|
PATCH_REQUEST_TYPE_LOWER = 'patch' unless const_defined?(:PATCH_REQUEST_TYPE_LOWER)
|
10
|
-
|
10
|
+
|
11
11
|
DELETE_REQUEST_TYPE_LOWER = 'delete' unless const_defined?(:DELETE_REQUEST_TYPE_LOWER)
|
12
12
|
|
13
13
|
GET_REQUEST_TYPE = 'GET' unless const_defined?(:GET_REQUEST_TYPE)
|
14
|
-
|
14
|
+
|
15
15
|
POST_REQUEST_TYPE = 'POST' unless const_defined?(:POST_REQUEST_TYPE)
|
16
|
-
|
16
|
+
|
17
17
|
PUT_REQUEST_TYPE = 'PUT' unless const_defined?(:PUT_REQUEST_TYPE)
|
18
18
|
|
19
19
|
PATCH_REQUEST_TYPE = 'PATCH' unless const_defined?(:PATCH_REQUEST_TYPE)
|
20
|
-
|
20
|
+
|
21
21
|
DELETE_REQUEST_TYPE = 'DELETE' unless const_defined?(:DELETE_REQUEST_TYPE)
|
22
22
|
|
23
23
|
V_C_MERCHANT_ID = 'v-c-merchant-id' unless const_defined?(:V_C_MERCHANT_ID)
|
24
|
-
|
24
|
+
|
25
25
|
HOST = 'host' unless const_defined?(:HOST)
|
26
|
-
|
26
|
+
|
27
27
|
DATE = 'date' unless const_defined?(:DATE)
|
28
|
-
|
28
|
+
|
29
29
|
REQUEST_TARGET = '(request-target)' unless const_defined?(:REQUEST_TARGET)
|
30
|
-
|
30
|
+
|
31
31
|
DIGEST = 'digest' unless const_defined?(:DIGEST)
|
32
|
-
|
32
|
+
|
33
33
|
SIGNATURE = 'Signature' unless const_defined?(:SIGNATURE)
|
34
|
-
|
34
|
+
|
35
35
|
HTTPS_URI_PREFIX = 'https://' unless const_defined?(:HTTPS_URI_PREFIX)
|
36
|
-
|
36
|
+
|
37
37
|
BEARER = 'Bearer' unless const_defined?(:BEARER)
|
38
|
-
|
38
|
+
|
39
39
|
MEDIA_TYPE_JSON = 'application/json' unless const_defined?(:MEDIA_TYPE_JSON)
|
40
|
-
|
40
|
+
|
41
41
|
SIGNATURE_ALGORITHM = 'HmacSHA256' unless const_defined?(:SIGNATURE_ALGORITHM)
|
42
|
-
|
42
|
+
|
43
43
|
ALGORITHM = "algorithm=\"" unless const_defined?(:ALGORITHM)
|
44
|
-
|
44
|
+
|
45
45
|
SHA256 = 'SHA-256=' unless const_defined?(:SHA256)
|
46
|
-
|
46
|
+
|
47
47
|
CONTENT_TYPE = 'Content-Type' unless const_defined?(:CONTENT_TYPE)
|
48
|
-
|
48
|
+
|
49
49
|
USER_AGENT = 'User-Agent' unless const_defined?(:USER_AGENT)
|
50
|
-
|
50
|
+
|
51
51
|
USER_AGENT_VALUE = 'Mozilla/5.0' unless const_defined?(:USER_AGENT_VALUE)
|
52
|
-
|
52
|
+
|
53
53
|
KEY_ID = "keyid=\"" unless const_defined?(:KEY_ID)
|
54
|
-
|
54
|
+
|
55
55
|
HEADERS_PARAM = "headers=\"" unless const_defined?(:HEADERS_PARAM)
|
56
|
-
|
56
|
+
|
57
57
|
SIGNATURE_PARAM = "signature=\"" unless const_defined?(:SIGNATURE_PARAM)
|
58
58
|
|
59
59
|
AUTH_TYPE_HTTP = 'HTTP_SIGNATURE' unless const_defined?(:AUTH_TYPE_HTTP)
|
60
|
-
|
61
|
-
AUTH_TYPE_JWT = 'JWT' unless const_defined?(:AUTH_TYPE_JWT)
|
62
60
|
|
63
|
-
|
64
|
-
|
65
|
-
RUN_ENV_PROD = 'CYBERSOURCE.ENVIRONMENT.PRODUCTION'unless const_defined?(:RUN_ENV_PROD)
|
66
|
-
|
67
|
-
SANDBOX_URL = 'apitest.cybersource.com' unless const_defined?(:SANDBOX_URL)
|
68
|
-
|
69
|
-
PRODUCTION_URL = 'api.cybersource.com' unless const_defined?(:PRODUCTION_URL)
|
70
|
-
|
71
|
-
BOA_RUN_ENV_SANDBOX = 'BANKOFAMERICA.ENVIRONMENT.SANDBOX' unless const_defined?(:RUN_ENV_SANDBOX)
|
72
|
-
|
73
|
-
BOA_RUN_ENV_PROD = 'BANKOFAMERICA.ENVIRONMENT.PRODUCTION'unless const_defined?(:RUN_ENV_PROD)
|
74
|
-
|
75
|
-
BOA_SANDBOX_URL = 'apitest.merchant-services.bankofamerica.com' unless const_defined?(:SANDBOX_URL)
|
76
|
-
|
77
|
-
BOA_PRODUCTION_URL = 'api.merchant-services.bankofamerica.com' unless const_defined?(:PRODUCTION_URL)
|
78
|
-
|
79
|
-
IDC_RUN_ENV_SANDBOX = 'CYBERSOURCE.IN.ENVIRONMENT.SANDBOX' unless const_defined?(:RUN_ENV_SANDBOX)
|
61
|
+
AUTH_TYPE_OAUTH = 'OAUTH' unless const_defined?(:AUTH_TYPE_OAUTH)
|
80
62
|
|
81
|
-
|
82
|
-
|
83
|
-
|
63
|
+
AUTH_TYPE_MUTUAL_AUTH = 'MUTUAL_AUTH' unless const_defined?(:AUTH_TYPE_MUTUAL_AUTH)
|
64
|
+
|
65
|
+
AUTH_TYPE_JWT = 'JWT' unless const_defined?(:AUTH_TYPE_JWT)
|
84
66
|
|
85
|
-
|
67
|
+
OLD_RUN_ENVIRONMENT_CONSTANTS = ['CYBERSOURCE.ENVIRONMENT.SANDBOX', 'CYBERSOURCE.ENVIRONMENT.PRODUCTION', 'CYBERSOURCE.IN.ENVIRONMENT.SANDBOX', 'CYBERSOURCE.IN.ENVIRONMENT.PRODUCTION', 'BANKOFAMERICA.ENVIRONMENT.SANDBOX', 'BANKOFAMERICA.ENVIRONMENT.PRODUCTION']
|
86
68
|
|
87
69
|
# constants for fall back logic
|
88
70
|
|
89
71
|
DEFAULT_LOG_SIZE = 10485760 unless const_defined?(:DEFAULT_LOG_SIZE)
|
90
|
-
|
72
|
+
|
91
73
|
DEFAULT_PROXY_ADDRESS = 'userproxy.visa.com' unless const_defined?(:DEFAULT_PROXY_ADDRESS)
|
92
|
-
|
74
|
+
|
93
75
|
DEFAULT_PROXY_PORT = '443' unless const_defined?(:DEFAULT_PROXY_PORT)
|
94
|
-
|
76
|
+
|
95
77
|
DEFAULT_TIMEOUT = '1000' unless const_defined?(:DEFAULT_TIMEOUT)
|
96
|
-
|
78
|
+
|
97
79
|
DEFAULT_LOG_DIRECTORY = '../log' unless const_defined?(:DEFAULT_LOG_DIRECTORY)
|
98
|
-
|
80
|
+
|
99
81
|
DEFAULT_KEY_DIRECTORY = 'resource' unless const_defined?(:DEFAULT_KEY_DIRECTORY)
|
100
|
-
|
82
|
+
|
101
83
|
DEFAULT_LOGFILE_NAME = 'cybs' unless const_defined?(:DEFAULT_LOGFILE_NAME)
|
102
84
|
|
103
85
|
# Constant for Fall back logic and Exception Handling
|
104
86
|
|
105
87
|
REQUEST_JSON_ERROR = 'Request Json File missing. File Path :: ' unless const_defined?(:REQUEST_JSON_ERROR)
|
106
|
-
|
88
|
+
|
107
89
|
INVALID_ENABLE_LOG = 'EnableLog should be (True/False) in cybs.yml' unless const_defined?(:INVALID_ENABLE_LOG)
|
108
|
-
|
90
|
+
|
109
91
|
REFER_LOG = 'Please refer Log for details' unless const_defined?(:REFER_LOG)
|
110
|
-
|
92
|
+
|
111
93
|
MERCHANT_ID_NULL = 'MerchantID is mandatory' unless const_defined?(:MERCHANT_ID_NULL)
|
112
|
-
|
94
|
+
|
113
95
|
INCORRECT_KEY_PASS = 'The keyPass Entered is Incorrect' unless const_defined?(:INCORRECT_KEY_PASS)
|
114
|
-
|
96
|
+
|
115
97
|
AUTH_TYPE_MANDATORY= 'AuthenticationType is Mandatory' unless const_defined?(:AUTH_TYPE_MANDATORY)
|
116
|
-
|
98
|
+
|
117
99
|
MERCHANT_KEY_ID_MANDATORY = 'MerchantKeyId is Mandatory' unless const_defined?(:MERCHANT_KEY_ID_MANDATORY)
|
118
|
-
|
100
|
+
|
119
101
|
MERCHANT_SECRET_KEY_MANDATORY = 'MerchantSecretKey is Mandatory' unless const_defined?(:MERCHANT_SECRET_KEY_MANDATORY)
|
120
102
|
|
121
103
|
PORTFOLIO_ID_MANDATORY = 'PortfolioID is Mandatory' unless const_defined?(:PORTFOLIO_ID_MANDATORY)
|
122
|
-
|
104
|
+
|
123
105
|
KEY_PASS_NULL = 'keyPass is empty, Assigining merchantID value' unless const_defined?(:KEY_PASS_NULL)
|
124
|
-
|
106
|
+
|
125
107
|
REQUEST_JSON_PATH_EMPTY = 'RequestJsonPath not provided. Using Default Value:'unless const_defined?(:REQUEST_JSON_PATH_EMPTY)
|
126
|
-
|
108
|
+
|
127
109
|
REQUEST_TYPE_EMPTY = 'RequestType Property of Merchant Config Not Set' unless const_defined?(:REQUEST_TYPE_EMPTY)
|
128
|
-
|
110
|
+
|
129
111
|
INVALID_REQUEST_TYPE_METHOD = 'Entered Request Type should be (GET/POST/PUT)' unless const_defined?(:INVALID_REQUEST_TYPE_METHOD)
|
130
|
-
|
112
|
+
|
131
113
|
INVALID_LOG_DIRECTORY = 'Entered LogDirectory is Incorrect. Using Default Path: ' unless const_defined?(:INVALID_LOG_DIRECTORY)
|
132
|
-
|
114
|
+
|
133
115
|
RUN_ENVIRONMENT_ERROR = 'Entered RunEnvironment is Incorrect.' unless const_defined?(:RUN_ENVIRONMENT_ERROR)
|
134
|
-
|
116
|
+
|
135
117
|
PROPERTY_FILE_NOT_FOUND = 'Cybs.yml file not found' unless const_defined?(:PROPERTY_FILE_NOT_FOUND)
|
136
118
|
|
137
119
|
ERROR_PREFIX = 'Error: ' unless const_defined?(:ERROR_PREFIX)
|
138
|
-
|
120
|
+
|
139
121
|
WARNING_PREFIX = 'Warning: ' unless const_defined?(:WARNING_PREFIX)
|
140
|
-
|
122
|
+
|
141
123
|
HIDDEN_MERCHANT_PROPERTIES = 'merchantID,merchantKeyId,merchantsecretKey,keyAlias,keyPass' unless const_defined?(:HIDDEN_MERCHANT_PROPERTIES)
|
142
|
-
|
124
|
+
|
143
125
|
RUN_ENVIRONMENT = 'RunEnvironment is Mandatory' unless const_defined?(:RUN_ENVIRONMENT)
|
144
|
-
|
126
|
+
|
145
127
|
KEY_DIRECTORY_EMPTY = 'KeysDirectory not provided. Using Default Path:' unless const_defined?(:KEY_DIRECTORY_EMPTY)
|
146
|
-
|
128
|
+
|
147
129
|
FILE_NOT_FOUND = 'File not found, Re-Enter path/file name, Entered path/file name :: ' unless const_defined?(:FILE_NOT_FOUND)
|
148
|
-
|
130
|
+
|
149
131
|
AUTH_ERROR = 'Check Authentication Type (HTTP_Signature/JWT) in cybs.yml.' unless const_defined?(:AUTH_ERROR)
|
150
|
-
|
132
|
+
|
151
133
|
KEY_FILE_NAME_NULL_EMPTY = 'KeyFilename Empty/Null. Assigining merchantID value' unless const_defined?(:KEY_FILE_NAME_NULL_EMPTY)
|
152
|
-
|
134
|
+
|
153
135
|
KEY_ALIAS_NULL_EMPTY = 'KeyAlias Empty/Null. Assigining merchantID value' unless const_defined?(:KEY_ALIAS_NULL_EMPTY)
|
154
|
-
|
136
|
+
|
155
137
|
INCORRECT_KEY_ALIAS = 'The Entered KeyAlias is Incorrect. Assigining merchantID value' unless const_defined?(:INCORRECT_KEY_ALIAS)
|
138
|
+
|
139
|
+
ENABLE_CLIENT_CERT_EMPTY = 'Enable Clientcert is Empty/Null.' unless const_defined?(:ENABLE_CLIENT_CERT_EMPTY)
|
140
|
+
|
141
|
+
CLIENT_CERT_DIR_EMPTY = 'Client Cert Directory is Empty/Null' unless const_defined?(:CLIENT_CERT_DIR_EMPTY)
|
142
|
+
|
143
|
+
SSL_CLIENT_CERT_EMPTY = 'SSL Client Cert is Empty/Null' unless const_defined?(:SSL_CLIENT_CERT_EMPTY)
|
144
|
+
|
145
|
+
PRIVATE_KEY_EMPTY = 'Private Key is Empty/Null' unless const_defined?(:PRIVATE_KEY_EMPTY)
|
146
|
+
|
147
|
+
SSL_KEY_PASSWORD_EMPTY = 'SSL Key Password is Empty/Null' unless const_defined?(:SSL_KEY_PASSWORD_EMPTY)
|
148
|
+
|
149
|
+
CLIENT_ID_EMPTY = 'Client Id is Empty/Null' unless const_defined?(:CLIENT_ID_EMPTY)
|
150
|
+
|
151
|
+
CLIENT_SECRET_EMPTY = 'Client Secret is Empty/Null' unless const_defined?(:CLIENT_SECRET_EMPTY)
|
152
|
+
|
153
|
+
ACCESS_TOKEN_EMPTY = 'AccessToken is Empty/Null' unless const_defined?(:ACCESS_TOKEN_REQ)
|
154
|
+
|
155
|
+
REFRESH_TOKEN_EMPTY = 'RefreshToken is Empty/Null' unless const_defined?(:REFRESH_TOKEN_REQ)
|
156
|
+
|
157
|
+
DERPECATED_ENVIRONMENT = 'The value provided for this field `RunEnvironment` has been deprecated and will not be used anymore.\n\nPlease refer to the README file [ https://github.com/CyberSource/cybersource-rest-samples-node/blob/master/README.md ] for information about the new values that are accepted.'
|
156
158
|
end
|
@@ -0,0 +1,104 @@
|
|
1
|
+
=begin
|
2
|
+
#OAuth2 API
|
3
|
+
|
4
|
+
#OAuth2 Token Service (OAuth2)
|
5
|
+
|
6
|
+
OpenAPI spec version: v3
|
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 'uri'
|
14
|
+
|
15
|
+
module CyberSource
|
16
|
+
class OAuthApi
|
17
|
+
attr_accessor :api_client
|
18
|
+
|
19
|
+
def initialize(api_client = ApiClient.default, config)
|
20
|
+
@api_client = api_client
|
21
|
+
@api_client.set_configuration(config)
|
22
|
+
end
|
23
|
+
# Create access token and refresh token
|
24
|
+
# This request is used by technology partners to obtain an access token and a refresh token, which are contained in the response. The partner can then use the access token for authentication when submitting API requests to CyberSource on behalf of the merchant. The request must include the authorization code that was included in the URL redirect response from CyberSource (see [full documentation](https://developer.cybersource.com/api/developer-guides/OAuth/cybs_extend_intro.html)). Access tokens expire after 15 minutes. The refresh token is used to create a new access token, it expires after one year.
|
25
|
+
# @param create_access_token_request Request payload
|
26
|
+
# @param [Hash] opts the optional parameters
|
27
|
+
# @option opts [String] :v_c_client_correlation_id We recommended that you submit this header with a unique value in every client request to this endpoint. It is sent back in the response header and logged both in the request log and response log.
|
28
|
+
# @return [AccessTokenResponse]
|
29
|
+
def create_access_token(create_access_token_request, opts = {})
|
30
|
+
data, status_code, headers = create_access_token_with_http_info(create_access_token_request, opts)
|
31
|
+
return data, status_code, headers
|
32
|
+
end
|
33
|
+
|
34
|
+
# Create access token and refresh token
|
35
|
+
# This request is used by technology partners to obtain an access token and a refresh token, which are contained in the response. The partner can then use the access token for authentication when submitting API requests to CyberSource on behalf of the merchant. The request must include the authorization code that was included in the URL redirect response from CyberSource (see [full documentation](https://developer.cybersource.com/api/developer-guides/OAuth/cybs_extend_intro.html)). Access tokens expire after 15 minutes. The refresh token is used to create a new access token, it expires after one year.
|
36
|
+
# @param create_access_token_request Request payload
|
37
|
+
# @param [Hash] opts the optional parameters
|
38
|
+
# @option opts [String] :v_c_client_correlation_id We recommended that you submit this header with a unique value in every client request to this endpoint. It is sent back in the response header and logged both in the request log and response log.
|
39
|
+
# @return [Array<(AccessTokenResponse, Fixnum, Hash)>] AccessTokenResponse data, response status code and response headers
|
40
|
+
def create_access_token_with_http_info(create_access_token_request, opts = {})
|
41
|
+
|
42
|
+
if @api_client.config.debugging
|
43
|
+
begin
|
44
|
+
raise
|
45
|
+
@api_client.config.logger.debug 'Calling API: OAuthApi.create_access_token ...'
|
46
|
+
rescue
|
47
|
+
puts 'Cannot write to log'
|
48
|
+
end
|
49
|
+
end
|
50
|
+
# verify the required parameter 'create_access_token_request' is set
|
51
|
+
if @api_client.config.client_side_validation && create_access_token_request.nil?
|
52
|
+
fail ArgumentError, "Missing the required parameter 'create_access_token_request' when calling OAuthApi.create_access_token"
|
53
|
+
end
|
54
|
+
if @api_client.config.client_side_validation && !opts[:'v_c_client_correlation_id'].nil? && opts[:'v_c_client_correlation_id'].to_s.length > 36
|
55
|
+
fail ArgumentError, 'invalid value for "opts[:"v_c_client_correlation_id"]" when calling OAuthApi.create_access_token, the character length must be smaller than or equal to 36.'
|
56
|
+
end
|
57
|
+
|
58
|
+
if @api_client.config.client_side_validation && !opts[:'v_c_client_correlation_id'].nil? && opts[:'v_c_client_correlation_id'].to_s.length < 36
|
59
|
+
fail ArgumentError, 'invalid value for "opts[:"v_c_client_correlation_id"]" when calling OAuthApi.create_access_token, the character length must be great than or equal to 36.'
|
60
|
+
end
|
61
|
+
|
62
|
+
#if @api_client.config.client_side_validation && !opts[:'v_c_client_correlation_id'].nil? && opts[:'v_c_client_correlation_id'] !~ Regexp.new(/^[A-Za-z0-9\\.\\-_:]+$/)
|
63
|
+
#fail ArgumentError, "invalid value for 'opts[:\"v_c_client_correlation_id\"]' when calling OAuthApi.create_access_token, must conform to the pattern /^[A-Za-z0-9\\.\\-_:]+$/."
|
64
|
+
#end
|
65
|
+
|
66
|
+
# resource path
|
67
|
+
local_var_path = 'oauth2/v3/token'
|
68
|
+
|
69
|
+
# query parameters
|
70
|
+
query_params = {}
|
71
|
+
|
72
|
+
# header parameters
|
73
|
+
header_params = {}
|
74
|
+
# HTTP header 'Accept' (if needed)
|
75
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json;charset=utf-8'])
|
76
|
+
# HTTP header 'Content-Type'
|
77
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(['application/x-www-form-urlencoded'])
|
78
|
+
header_params[:'v-c-client-correlation-id'] = opts[:'v_c_client_correlation_id'] if !opts[:'v_c_client_correlation_id'].nil?
|
79
|
+
|
80
|
+
# form parameters
|
81
|
+
form_params = {}
|
82
|
+
|
83
|
+
# http body (model)
|
84
|
+
post_body = @api_client.object_to_http_body(create_access_token_request)
|
85
|
+
auth_names = []
|
86
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path,
|
87
|
+
:header_params => header_params,
|
88
|
+
:query_params => query_params,
|
89
|
+
:form_params => form_params,
|
90
|
+
:body => post_body,
|
91
|
+
:auth_names => auth_names,
|
92
|
+
:return_type => 'AccessTokenResponse')
|
93
|
+
if @api_client.config.debugging
|
94
|
+
begin
|
95
|
+
raise
|
96
|
+
@api_client.config.logger.debug "API called: OAuthApi#create_access_token\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
97
|
+
rescue
|
98
|
+
puts 'Cannot write to log'
|
99
|
+
end
|
100
|
+
end
|
101
|
+
return data, status_code, headers
|
102
|
+
end
|
103
|
+
end
|
104
|
+
end
|