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
@@ -1,12 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"startDay":"23",
|
3
|
-
"timeZone":"America/Chicago",
|
4
|
-
"reportDefinitionName":"TransactionRequestClass",
|
5
|
-
"startTime":"1100",
|
6
|
-
"reportFrequency":"DAILY",
|
7
|
-
"ReportName":"TRRReport",
|
8
|
-
"reportFormat":"csv",
|
9
|
-
"orgId":"testrest",
|
10
|
-
"reportType":"detail",
|
11
|
-
"reportFields": ["Request.RequestID","Request.TransactionDate","Request.MerchantReferenceNumber","Request.MerchantID"]
|
12
|
-
}
|
@@ -1,31 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# WARNING #
|
3
|
-
# Do not alter the values on the left hand side. "LEFTHANDSIDE" = "EDITABLE".
|
4
|
-
#
|
5
|
-
|
6
|
-
#HTTP_Signature / JWT
|
7
|
-
authenticationType : "jwt"
|
8
|
-
#UNQUIE MERCHANT ID
|
9
|
-
merchantID : "testrest"
|
10
|
-
# CyberSource.Environment.SANDBOX or CyberSource.Environment. or (api.) working domain
|
11
|
-
runEnvironment : "Cybersource.Environment.SANDBOX"
|
12
|
-
# JWT Parameters
|
13
|
-
keyAlias : "testrest"
|
14
|
-
keyPass : "testrest"
|
15
|
-
keyFilename : "testrest"
|
16
|
-
#P12 key path. Enter the folder path where the .p12 file is located.
|
17
|
-
keysDirectory : ".././resource"
|
18
|
-
#EBC portal Values
|
19
|
-
merchantKeyId : "08c94330-f618-42a3-b09d-e1e43be5efda"
|
20
|
-
merchantsecretKey : "yBJxy6LjM2TmcPGu+GaJrHtkke25fPpUX+UY6/L/1tE="
|
21
|
-
#Logging to be enabled or not [true/false].
|
22
|
-
enableLog : true
|
23
|
-
#Log directory Path
|
24
|
-
logDirectory : "../log"
|
25
|
-
#Enter only file name, do not enter the extension type like .log, .txt etc.
|
26
|
-
logFilename : "Cybs"
|
27
|
-
#Log file size in KB "5K" or MB as "5M".
|
28
|
-
logSize : 10485760
|
29
|
-
#Proxy Setup
|
30
|
-
# proxyAddress : "userproxy.com"
|
31
|
-
# proxyPort :
|
@@ -1,54 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"clientReferenceInformation": {
|
3
|
-
"code": "TC50171_3"
|
4
|
-
},
|
5
|
-
"processingInformation": {
|
6
|
-
"commerceIndicator": "internet"
|
7
|
-
},
|
8
|
-
"aggregatorInformation": {
|
9
|
-
"subMerchant": {
|
10
|
-
"cardAcceptorID": "1234567890",
|
11
|
-
"country": "US",
|
12
|
-
"phoneNumber": "650-432-0000",
|
13
|
-
"address1": "900 Metro Center",
|
14
|
-
"postalCode": "94404-2775",
|
15
|
-
"locality": "Foster City",
|
16
|
-
"name": "Visa Inc",
|
17
|
-
"administrativeArea": "CA",
|
18
|
-
"region": "PEN",
|
19
|
-
"email": "test@cybs.com"
|
20
|
-
},
|
21
|
-
"name": "V-Internatio",
|
22
|
-
"aggregatorID": "123456789"
|
23
|
-
},
|
24
|
-
"orderInformation": {
|
25
|
-
"billTo": {
|
26
|
-
"country": "US",
|
27
|
-
"lastName": "VDP",
|
28
|
-
"address2": "Address 2",
|
29
|
-
"address1": "201 S. Division St.",
|
30
|
-
"postalCode": "48104-2201",
|
31
|
-
"locality": "Ann Arbor",
|
32
|
-
"administrativeArea": "MI",
|
33
|
-
"firstName": "RTS",
|
34
|
-
"phoneNumber": "999999999",
|
35
|
-
"district": "MI",
|
36
|
-
"buildingNumber": "123",
|
37
|
-
"company": "Visa",
|
38
|
-
"email": "test@cybs.com"
|
39
|
-
},
|
40
|
-
"amountDetails": {
|
41
|
-
"totalAmount": "102.21",
|
42
|
-
"currency": "USD"
|
43
|
-
}
|
44
|
-
},
|
45
|
-
"paymentInformation": {
|
46
|
-
"card": {
|
47
|
-
"expirationYear": "2031",
|
48
|
-
"number": "5555555555554444",
|
49
|
-
"securityCode": "123",
|
50
|
-
"expirationMonth": "12",
|
51
|
-
"type": "002"
|
52
|
-
}
|
53
|
-
}
|
54
|
-
}
|
Binary file
|
@@ -1,274 +0,0 @@
|
|
1
|
-
require_relative './spec_helper'
|
2
|
-
require_relative '../../AuthenticationSDK/util/Constants.rb'
|
3
|
-
require_relative './MerchantConfigData.rb'
|
4
|
-
require_relative '../core/MerchantConfig.rb'
|
5
|
-
require_relative '../authentication/http/HttpSignatureHeader.rb'
|
6
|
-
require_relative '../authentication/jwt/JwtToken.rb'
|
7
|
-
require_relative '../core/Authorization.rb'
|
8
|
-
require 'net/http'
|
9
|
-
require 'json'
|
10
|
-
require 'date'
|
11
|
-
|
12
|
-
describe Authorization do
|
13
|
-
it 'validating HTTP get Authorization' do
|
14
|
-
cybsPropertyobj=MerchantConfigData.new.merchantConfigProp
|
15
|
-
merchantconfig_obj=Merchantconfig.new cybsPropertyobj
|
16
|
-
merchantconfig_obj.authenticationType='Http_signature'
|
17
|
-
getId='5246387105766473203529' #capture-5289697403596987704107
|
18
|
-
requestTarget='/pts/v2/payments/'
|
19
|
-
merchantconfig_obj.requestTarget=requestTarget + getId
|
20
|
-
url= Constants::HTTPS_URI_PREFIX + merchantconfig_obj.requestHost + merchantconfig_obj.requestTarget
|
21
|
-
merchantconfig_obj.requestUrl=url
|
22
|
-
merchantconfig_obj.requestType='GET'
|
23
|
-
log_obj = MerchantConfigData.new.setLog merchantconfig_obj.logDirectory, merchantconfig_obj.logFilename, merchantconfig_obj.logSize, merchantconfig_obj.enableLog
|
24
|
-
gmtdatetime=DateTime.now.httpdate
|
25
|
-
token = Authorization.new.getToken(merchantconfig_obj, gmtdatetime, log_obj)
|
26
|
-
expect(token).not_to be_empty
|
27
|
-
end
|
28
|
-
it 'validating HTTP post Authorization' do
|
29
|
-
cybsPropertyobj=MerchantConfigData.new.merchantConfigProp
|
30
|
-
merchantconfig_obj=Merchantconfig.new cybsPropertyobj
|
31
|
-
merchantconfig_obj.authenticationType='Http_signature'
|
32
|
-
requestTarget='/pts/v2/payments'
|
33
|
-
requestJsonPath='../PostRequestData.json'
|
34
|
-
merchantconfig_obj.requestTarget=requestTarget
|
35
|
-
url= Constants::HTTPS_URI_PREFIX + merchantconfig_obj.requestHost + merchantconfig_obj.requestTarget
|
36
|
-
merchantconfig_obj.requestUrl=url
|
37
|
-
merchantconfig_obj.requestType='POST'
|
38
|
-
merchantconfig_obj.requestJsonData=File.read(File.expand_path(requestJsonPath,__FILE__))
|
39
|
-
log_obj = MerchantConfigData.new.setLog merchantconfig_obj.logDirectory, merchantconfig_obj.logFilename, merchantconfig_obj.logSize, merchantconfig_obj.enableLog
|
40
|
-
gmtdatetime=DateTime.now.httpdate
|
41
|
-
token = Authorization.new.getToken(merchantconfig_obj, gmtdatetime, log_obj)
|
42
|
-
expect(token).not_to be_empty
|
43
|
-
end
|
44
|
-
it 'validating HTTP put Authorization' do
|
45
|
-
cybsPropertyobj=MerchantConfigData.new.merchantConfigProp
|
46
|
-
merchantconfig_obj=Merchantconfig.new cybsPropertyobj
|
47
|
-
merchantconfig_obj.authenticationType='Http_signature'
|
48
|
-
requestTarget='/reporting/v2/reportSubscriptions/TRRReport?organizationId=testrest'
|
49
|
-
requestJsonPath='../PutRequestData.json'
|
50
|
-
merchantconfig_obj.requestTarget=requestTarget
|
51
|
-
url= Constants::HTTPS_URI_PREFIX + merchantconfig_obj.requestHost + merchantconfig_obj.requestTarget
|
52
|
-
merchantconfig_obj.requestUrl=url
|
53
|
-
merchantconfig_obj.requestType='PUT'
|
54
|
-
merchantconfig_obj.requestJsonData=File.read(File.expand_path(requestJsonPath,__FILE__))
|
55
|
-
log_obj = MerchantConfigData.new.setLog merchantconfig_obj.logDirectory, merchantconfig_obj.logFilename, merchantconfig_obj.logSize, merchantconfig_obj.enableLog
|
56
|
-
gmtdatetime=DateTime.now.httpdate
|
57
|
-
token = Authorization.new.getToken(merchantconfig_obj, gmtdatetime, log_obj)
|
58
|
-
expect(token).not_to be_empty
|
59
|
-
end
|
60
|
-
it 'validating HTTP Delete Authorization' do
|
61
|
-
cybsPropertyobj=MerchantConfigData.new.merchantConfigProp
|
62
|
-
merchantconfig_obj=Merchantconfig.new cybsPropertyobj
|
63
|
-
merchantconfig_obj.authenticationType='Http_signature'
|
64
|
-
getId='5246387105766473203529'
|
65
|
-
requestTarget='/reporting/v2/reportSubscriptions/TRRReport?organizationId=testrest/'
|
66
|
-
merchantconfig_obj.requestTarget=requestTarget + getId
|
67
|
-
url= Constants::HTTPS_URI_PREFIX + merchantconfig_obj.requestHost + merchantconfig_obj.requestTarget
|
68
|
-
merchantconfig_obj.requestUrl=url
|
69
|
-
merchantconfig_obj.requestType='DELETE'
|
70
|
-
log_obj = MerchantConfigData.new.setLog merchantconfig_obj.logDirectory, merchantconfig_obj.logFilename, merchantconfig_obj.logSize, merchantconfig_obj.enableLog
|
71
|
-
gmtdatetime=DateTime.now.httpdate
|
72
|
-
token = Authorization.new.getToken(merchantconfig_obj, gmtdatetime, log_obj)
|
73
|
-
expect(token).not_to be_empty
|
74
|
-
end
|
75
|
-
it 'validating JWT get Authorization' do
|
76
|
-
cybsPropertyobj=MerchantConfigData.new.merchantConfigProp
|
77
|
-
merchantconfig_obj=Merchantconfig.new cybsPropertyobj
|
78
|
-
merchantconfig_obj.authenticationType='JWT'
|
79
|
-
requestTarget='/pts/v2/payments'
|
80
|
-
merchantconfig_obj.keysDirectory=File.expand_path(merchantconfig_obj.keysDirectory,__FILE__)
|
81
|
-
merchantconfig_obj.requestTarget=requestTarget
|
82
|
-
getId='5246387105766473203529' #capture-5289697403596987704107
|
83
|
-
url= Constants::HTTPS_URI_PREFIX + merchantconfig_obj.requestHost + merchantconfig_obj.requestTarget + '/' + getId
|
84
|
-
merchantconfig_obj.requestUrl=url
|
85
|
-
merchantconfig_obj.requestType='GET'
|
86
|
-
log_obj = MerchantConfigData.new.setLog merchantconfig_obj.logDirectory, merchantconfig_obj.logFilename, merchantconfig_obj.logSize, merchantconfig_obj.enableLog
|
87
|
-
gmtdatetime=DateTime.now.httpdate
|
88
|
-
token = Authorization.new.getToken(merchantconfig_obj, gmtdatetime, log_obj)
|
89
|
-
expect(token).not_to be_empty
|
90
|
-
end
|
91
|
-
it 'validating JWT post Authorization' do
|
92
|
-
cybsPropertyobj=MerchantConfigData.new.merchantConfigProp
|
93
|
-
merchantconfig_obj=Merchantconfig.new cybsPropertyobj
|
94
|
-
merchantconfig_obj.authenticationType='JWT'
|
95
|
-
requestTarget='/pts/v2/payments'
|
96
|
-
merchantconfig_obj.keysDirectory=File.expand_path(merchantconfig_obj.keysDirectory,__FILE__)
|
97
|
-
requestJsonPath='../PostRequestData.json'
|
98
|
-
merchantconfig_obj.requestTarget=requestTarget
|
99
|
-
url= Constants::HTTPS_URI_PREFIX + merchantconfig_obj.requestHost + merchantconfig_obj.requestTarget
|
100
|
-
merchantconfig_obj.requestUrl=url
|
101
|
-
merchantconfig_obj.requestType='POST'
|
102
|
-
merchantconfig_obj.requestJsonData=File.read(File.expand_path(requestJsonPath,__FILE__))
|
103
|
-
log_obj = MerchantConfigData.new.setLog merchantconfig_obj.logDirectory, merchantconfig_obj.logFilename, merchantconfig_obj.logSize, merchantconfig_obj.enableLog
|
104
|
-
gmtdatetime=DateTime.now.httpdate
|
105
|
-
token = Authorization.new.getToken(merchantconfig_obj, gmtdatetime, log_obj)
|
106
|
-
expect(token).not_to be_empty
|
107
|
-
end
|
108
|
-
it 'validating JWT put Authorization' do
|
109
|
-
cybsPropertyobj=MerchantConfigData.new.merchantConfigProp
|
110
|
-
merchantconfig_obj=Merchantconfig.new cybsPropertyobj
|
111
|
-
merchantconfig_obj.authenticationType='JWT'
|
112
|
-
requestTarget='/reporting/v2/reportSubscriptions/TRRReport?organizationId=testrest'
|
113
|
-
requestJsonPath='../PutRequestData.json'
|
114
|
-
merchantconfig_obj.keysDirectory=File.expand_path(merchantconfig_obj.keysDirectory,__FILE__)
|
115
|
-
merchantconfig_obj.requestTarget=requestTarget
|
116
|
-
url= Constants::HTTPS_URI_PREFIX + merchantconfig_obj.requestHost + merchantconfig_obj.requestTarget
|
117
|
-
merchantconfig_obj.requestUrl=url
|
118
|
-
merchantconfig_obj.requestType='PUT'
|
119
|
-
merchantconfig_obj.requestJsonData=File.read(File.expand_path(requestJsonPath,__FILE__))
|
120
|
-
log_obj = MerchantConfigData.new.setLog merchantconfig_obj.logDirectory, merchantconfig_obj.logFilename, merchantconfig_obj.logSize, merchantconfig_obj.enableLog
|
121
|
-
gmtdatetime=DateTime.now.httpdate
|
122
|
-
token = Authorization.new.getToken(merchantconfig_obj, gmtdatetime, log_obj)
|
123
|
-
expect(token).not_to be_empty
|
124
|
-
end
|
125
|
-
it 'validating JWT Delete Authorization' do
|
126
|
-
cybsPropertyobj=MerchantConfigData.new.merchantConfigProp
|
127
|
-
merchantconfig_obj=Merchantconfig.new cybsPropertyobj
|
128
|
-
merchantconfig_obj.authenticationType='JWT'
|
129
|
-
getId='5246387105766473203529'
|
130
|
-
requestTarget='/reporting/v2/reportSubscriptions/TRRReport?organizationId=testrest/'
|
131
|
-
merchantconfig_obj.requestTarget=requestTarget + getId
|
132
|
-
url= Constants::HTTPS_URI_PREFIX + merchantconfig_obj.requestHost + merchantconfig_obj.requestTarget
|
133
|
-
merchantconfig_obj.requestUrl=url
|
134
|
-
merchantconfig_obj.requestType='DELETE'
|
135
|
-
log_obj = MerchantConfigData.new.setLog merchantconfig_obj.logDirectory, merchantconfig_obj.logFilename, merchantconfig_obj.logSize, merchantconfig_obj.enableLog
|
136
|
-
gmtdatetime=DateTime.now.httpdate
|
137
|
-
token = Authorization.new.getToken(merchantconfig_obj, gmtdatetime, log_obj)
|
138
|
-
expect(token).not_to be_empty
|
139
|
-
end
|
140
|
-
it 'validating Auth type exception in Authorization' do
|
141
|
-
cybsPropertyobj=MerchantConfigData.new.merchantConfigProp
|
142
|
-
merchantconfig_obj=Merchantconfig.new cybsPropertyobj
|
143
|
-
merchantconfig_obj.authenticationType='Signature'
|
144
|
-
requestTarget='/reporting/v2/reportSubscriptions/TRRReport?organizationId=testrest'
|
145
|
-
requestJsonPath='../PutRequestData.json'
|
146
|
-
merchantconfig_obj.requestTarget=requestTarget
|
147
|
-
url= Constants::HTTPS_URI_PREFIX + merchantconfig_obj.requestHost + merchantconfig_obj.requestTarget
|
148
|
-
merchantconfig_obj.requestUrl=url
|
149
|
-
merchantconfig_obj.requestType='PUT'
|
150
|
-
log_obj = MerchantConfigData.new.setLog merchantconfig_obj.logDirectory, merchantconfig_obj.logFilename, merchantconfig_obj.logSize, merchantconfig_obj.enableLog
|
151
|
-
gmtdatetime=DateTime.now.httpdate
|
152
|
-
expect { Authorization.new.getToken(merchantconfig_obj, gmtdatetime, log_obj) }.to raise_error(StandardError)
|
153
|
-
end
|
154
|
-
it 'validating Request type exception in Authorization' do
|
155
|
-
cybsPropertyobj=MerchantConfigData.new.merchantConfigProp
|
156
|
-
merchantconfig_obj=Merchantconfig.new cybsPropertyobj
|
157
|
-
merchantconfig_obj.authenticationType='Http_Signature'
|
158
|
-
requestTarget='/reporting/v2/reportSubscriptions/TRRReport?organizationId=testrest'
|
159
|
-
requestJsonPath='../PutRequestData.json'
|
160
|
-
merchantconfig_obj.requestTarget=requestTarget
|
161
|
-
url= Constants::HTTPS_URI_PREFIX + merchantconfig_obj.requestHost + merchantconfig_obj.requestTarget
|
162
|
-
merchantconfig_obj.requestUrl=url
|
163
|
-
merchantconfig_obj.requestType=""
|
164
|
-
log_obj = MerchantConfigData.new.setLog merchantconfig_obj.logDirectory, merchantconfig_obj.logFilename, merchantconfig_obj.logSize, merchantconfig_obj.enableLog
|
165
|
-
gmtdatetime=DateTime.now.httpdate
|
166
|
-
expect { Authorization.new.getToken(merchantconfig_obj, gmtdatetime, log_obj) }.to raise_error(StandardError)
|
167
|
-
end
|
168
|
-
# checking for invalid File path for p12 file
|
169
|
-
it 'validating JWT get invalid key directory Authorization' do
|
170
|
-
cybsPropertyobj=MerchantConfigData.new.merchantConfigProp
|
171
|
-
merchantconfig_obj=Merchantconfig.new cybsPropertyobj
|
172
|
-
merchantconfig_obj.authenticationType='JWT'
|
173
|
-
requestTarget='/pts/v2/payments'
|
174
|
-
merchantconfig_obj.keysDirectory='../../../AuthenticationSDK/res'
|
175
|
-
merchantconfig_obj.keysDirectory=File.expand_path(merchantconfig_obj.keysDirectory,__FILE__)
|
176
|
-
merchantconfig_obj.requestTarget=requestTarget
|
177
|
-
getId='5246387105766473203529' #capture-5289697403596987704107
|
178
|
-
url= Constants::HTTPS_URI_PREFIX + merchantconfig_obj.requestHost + merchantconfig_obj.requestTarget + '/' + getId
|
179
|
-
merchantconfig_obj.requestUrl=url
|
180
|
-
merchantconfig_obj.requestType='GET'
|
181
|
-
log_obj = MerchantConfigData.new.setLog merchantconfig_obj.logDirectory, merchantconfig_obj.logFilename, merchantconfig_obj.logSize, merchantconfig_obj.enableLog
|
182
|
-
gmtdatetime=DateTime.now.httpdate
|
183
|
-
expect { Authorization.new.getToken(merchantconfig_obj, gmtdatetime, log_obj) }.to raise_error(StandardError)
|
184
|
-
end
|
185
|
-
it 'validating JWT post invalid keydirectory Authorization' do
|
186
|
-
cybsPropertyobj=MerchantConfigData.new.merchantConfigProp
|
187
|
-
merchantconfig_obj=Merchantconfig.new cybsPropertyobj
|
188
|
-
merchantconfig_obj.authenticationType='JWT'
|
189
|
-
requestTarget='/pts/v2/payments'
|
190
|
-
merchantconfig_obj.keysDirectory='../../../AuthenticationSDK/res'
|
191
|
-
merchantconfig_obj.keysDirectory=File.expand_path(merchantconfig_obj.keysDirectory,__FILE__)
|
192
|
-
requestJsonPath='../PostRequestData.json'
|
193
|
-
merchantconfig_obj.requestTarget=requestTarget
|
194
|
-
url= Constants::HTTPS_URI_PREFIX + merchantconfig_obj.requestHost + merchantconfig_obj.requestTarget
|
195
|
-
merchantconfig_obj.requestUrl=url
|
196
|
-
merchantconfig_obj.requestType='POST'
|
197
|
-
merchantconfig_obj.requestJsonData=File.read(File.expand_path(requestJsonPath,__FILE__))
|
198
|
-
log_obj = MerchantConfigData.new.setLog merchantconfig_obj.logDirectory, merchantconfig_obj.logFilename, merchantconfig_obj.logSize, merchantconfig_obj.enableLog
|
199
|
-
gmtdatetime=DateTime.now.httpdate
|
200
|
-
expect { Authorization.new.getToken(merchantconfig_obj, gmtdatetime, log_obj) }.to raise_error(StandardError)
|
201
|
-
end
|
202
|
-
it 'validating JWT put invalid keysdirectory Authorization' do
|
203
|
-
cybsPropertyobj=MerchantConfigData.new.merchantConfigProp
|
204
|
-
merchantconfig_obj=Merchantconfig.new cybsPropertyobj
|
205
|
-
merchantconfig_obj.authenticationType='JWT'
|
206
|
-
requestTarget='/reporting/v2/reportSubscriptions/TRRReport?organizationId=testrest'
|
207
|
-
requestJsonPath='../PutRequestData.json'
|
208
|
-
merchantconfig_obj.keysDirectory='../../../AuthenticationSDK/res'
|
209
|
-
merchantconfig_obj.keysDirectory=File.expand_path(merchantconfig_obj.keysDirectory,__FILE__)
|
210
|
-
merchantconfig_obj.requestTarget=requestTarget
|
211
|
-
url= Constants::HTTPS_URI_PREFIX + merchantconfig_obj.requestHost + merchantconfig_obj.requestTarget
|
212
|
-
merchantconfig_obj.requestUrl=url
|
213
|
-
merchantconfig_obj.requestType='PUT'
|
214
|
-
merchantconfig_obj.requestJsonData=File.read(File.expand_path(requestJsonPath,__FILE__))
|
215
|
-
log_obj = MerchantConfigData.new.setLog merchantconfig_obj.logDirectory, merchantconfig_obj.logFilename, merchantconfig_obj.logSize, merchantconfig_obj.enableLog
|
216
|
-
gmtdatetime=DateTime.now.httpdate
|
217
|
-
expect { Authorization.new.getToken(merchantconfig_obj, gmtdatetime, log_obj) }.to raise_error(StandardError)
|
218
|
-
end
|
219
|
-
describe GenerateHttpSignature do
|
220
|
-
it 'validating invalid requestType Authorization' do
|
221
|
-
cybsPropertyobj=MerchantConfigData.new.merchantConfigProp
|
222
|
-
merchantconfig_obj=Merchantconfig.new cybsPropertyobj
|
223
|
-
merchantconfig_obj.authenticationType='http_signature'
|
224
|
-
requestTarget='/reporting/v2/reportSubscriptions/TRRReport?organizationId=testrest'
|
225
|
-
requestJsonPath='../PutRequestData.json'
|
226
|
-
merchantconfig_obj.keysDirectory='../../../AuthenticationSDK/res'
|
227
|
-
merchantconfig_obj.keysDirectory=File.expand_path(merchantconfig_obj.keysDirectory,__FILE__)
|
228
|
-
merchantconfig_obj.requestTarget=requestTarget
|
229
|
-
url= Constants::HTTPS_URI_PREFIX + merchantconfig_obj.requestHost + merchantconfig_obj.requestTarget
|
230
|
-
merchantconfig_obj.requestUrl=url
|
231
|
-
merchantconfig_obj.requestType=''
|
232
|
-
merchantconfig_obj.requestJsonData=File.read(File.expand_path(requestJsonPath,__FILE__))
|
233
|
-
log_obj = MerchantConfigData.new.setLog merchantconfig_obj.logDirectory, merchantconfig_obj.logFilename, merchantconfig_obj.logSize, merchantconfig_obj.enableLog
|
234
|
-
gmtdatetime=DateTime.now.httpdate
|
235
|
-
expect { GenerateHttpSignature.new.getToken(merchantconfig_obj, gmtdatetime, log_obj) }.to raise_error(StandardError)
|
236
|
-
end
|
237
|
-
end
|
238
|
-
describe GenerateJwtToken do
|
239
|
-
it 'validating invalid requestType Authorization' do
|
240
|
-
cybsPropertyobj=MerchantConfigData.new.merchantConfigProp
|
241
|
-
merchantconfig_obj=Merchantconfig.new cybsPropertyobj
|
242
|
-
merchantconfig_obj.authenticationType='JWT'
|
243
|
-
requestTarget='/reporting/v2/reportSubscriptions/TRRReport?organizationId=testrest'
|
244
|
-
requestJsonPath='../PutRequestData.json'
|
245
|
-
merchantconfig_obj.keysDirectory='../../../AuthenticationSDK/res'
|
246
|
-
merchantconfig_obj.keysDirectory=File.expand_path(merchantconfig_obj.keysDirectory,__FILE__)
|
247
|
-
merchantconfig_obj.requestTarget=requestTarget
|
248
|
-
url= Constants::HTTPS_URI_PREFIX + merchantconfig_obj.requestHost + merchantconfig_obj.requestTarget
|
249
|
-
merchantconfig_obj.requestUrl=url
|
250
|
-
merchantconfig_obj.requestType=''
|
251
|
-
merchantconfig_obj.requestJsonData=File.read(File.expand_path(requestJsonPath,__FILE__))
|
252
|
-
log_obj = MerchantConfigData.new.setLog merchantconfig_obj.logDirectory, merchantconfig_obj.logFilename, merchantconfig_obj.logSize, merchantconfig_obj.enableLog
|
253
|
-
gmtdatetime=DateTime.now.httpdate
|
254
|
-
expect { GenerateJwtToken.new.getToken(merchantconfig_obj, gmtdatetime, log_obj) }.to raise_error(StandardError)
|
255
|
-
end
|
256
|
-
it 'validating invalid password Authorization' do
|
257
|
-
cybsPropertyobj=MerchantConfigData.new.merchantConfigProp
|
258
|
-
merchantconfig_obj=Merchantconfig.new cybsPropertyobj
|
259
|
-
merchantconfig_obj.authenticationType='JWT'
|
260
|
-
requestTarget='/pts/v2/payments'
|
261
|
-
merchantconfig_obj.keysDirectory='../../../AuthenticationSDK/res'
|
262
|
-
merchantconfig_obj.keysDirectory=File.expand_path(merchantconfig_obj.keysDirectory,__FILE__)
|
263
|
-
merchantconfig_obj.requestTarget=requestTarget
|
264
|
-
merchantconfig_obj.keyPass='test'
|
265
|
-
getId='5246387105766473203529' #capture-5289697403596987704107
|
266
|
-
url= Constants::HTTPS_URI_PREFIX + merchantconfig_obj.requestHost + merchantconfig_obj.requestTarget + '/' + getId
|
267
|
-
merchantconfig_obj.requestUrl=url
|
268
|
-
merchantconfig_obj.requestType='GET'
|
269
|
-
log_obj = MerchantConfigData.new.setLog merchantconfig_obj.logDirectory, merchantconfig_obj.logFilename, merchantconfig_obj.logSize, merchantconfig_obj.enableLog
|
270
|
-
gmtdatetime=DateTime.now.httpdate
|
271
|
-
expect { Authorization.new.getToken(merchantconfig_obj, gmtdatetime, log_obj) }.to raise_error(StandardError)
|
272
|
-
end
|
273
|
-
end
|
274
|
-
end
|
@@ -1,59 +0,0 @@
|
|
1
|
-
public
|
2
|
-
class MerchantConfigData
|
3
|
-
def merchantConfigProp()
|
4
|
-
merchantId='testrest'
|
5
|
-
runEnvironment='cybersource.environment.sandbox'
|
6
|
-
timeout=1000 #In Milliseconds
|
7
|
-
authenticationType='JWT' #'HTTP_Signature'
|
8
|
-
logDirectory='../../../AuthenticationSDK/src/log'
|
9
|
-
logDirectory=File.expand_path(logDirectory,__FILE__)
|
10
|
-
jsonFilePath='./PostRequestData.json'
|
11
|
-
logSize=10485760
|
12
|
-
enableLog=true
|
13
|
-
# proxyAddress='userproxy.com'
|
14
|
-
# proxyPort=''
|
15
|
-
# HTTP Parameters
|
16
|
-
merchantSecretKey='yBJxy6LjM2TmcPGu+GaJrHtkke25fPpUX+UY6/L/1tE='
|
17
|
-
merchantKeyId='08c94330-f618-42a3-b09d-e1e43be5efda'
|
18
|
-
# JWT Parameters
|
19
|
-
keysDirectory='../../../AuthenticationSDK/resource'
|
20
|
-
keysDirectory=File.expand_path(keysDirectory,__FILE__)
|
21
|
-
keyAlias='testrest'
|
22
|
-
keyPass='testrest'
|
23
|
-
keyFilename='testrest'
|
24
|
-
logFilename='Cybs'
|
25
|
-
configurationDictionary={}
|
26
|
-
configurationDictionary['merchantID']=merchantId
|
27
|
-
configurationDictionary['runEnvironment']=runEnvironment
|
28
|
-
configurationDictionary['timeout']=timeout
|
29
|
-
configurationDictionary['authenticationType']=authenticationType
|
30
|
-
configurationDictionary['logDirectory']=logDirectory
|
31
|
-
configurationDictionary['jsonFilePath']=jsonFilePath
|
32
|
-
configurationDictionary['logSize']=logSize
|
33
|
-
configurationDictionary['enableLog']=enableLog
|
34
|
-
# configurationDictionary['proxyPort']=proxyPort
|
35
|
-
configurationDictionary['merchantsecretKey']=merchantSecretKey
|
36
|
-
configurationDictionary['merchantKeyId']=merchantKeyId
|
37
|
-
configurationDictionary['keysDirectory']=keysDirectory
|
38
|
-
configurationDictionary['keyAlias']=keyAlias
|
39
|
-
configurationDictionary['keyPass']=keyPass
|
40
|
-
configurationDictionary['keyFilename'] = keyFilename
|
41
|
-
configurationDictionary['logFilename'] = logFilename
|
42
|
-
return configurationDictionary
|
43
|
-
end
|
44
|
-
def setLog(logDirectory, logFilename, logSize, enableLog)
|
45
|
-
if enableLog == true
|
46
|
-
filename = logDirectory + '/' + logFilename + '.log'
|
47
|
-
datetime = DateTime.now
|
48
|
-
if File.exist?(filename) && File.size(filename) >= logSize
|
49
|
-
updatedFileName = logDirectory + '/' + logFilename + '_' + datetime.strftime('%Y%m%d%H%M%S') + '.log'
|
50
|
-
File.rename(filename, updatedFileName)
|
51
|
-
end
|
52
|
-
@logger = Logger.new(STDOUT)
|
53
|
-
@logger = Logger.new(filename, logSize)
|
54
|
-
@logger.datetime_format = datetime.strftime('%Y-%m-%d %H:%M:%S')
|
55
|
-
else
|
56
|
-
@logger = Logger.new(false)
|
57
|
-
end
|
58
|
-
end
|
59
|
-
end
|