From 55a4ca5bcf46c27dd84b40f6a508ab8364d350b0 Mon Sep 17 00:00:00 2001 From: Gabriel Broadwin Nongsiej Date: Thu, 2 Nov 2023 15:03:56 +0530 Subject: [PATCH 1/2] Added SDK Tracking facility (#120) --- .../api.mustache | 6 ++ .../index.mustache | 1 + src/api/AsymmetricKeyManagementApi.js | 12 ++++ src/api/BatchesApi.js | 4 ++ src/api/BillingAgreementsApi.js | 12 ++++ src/api/CaptureApi.js | 4 ++ src/api/CreditApi.js | 4 ++ src/api/CustomerApi.js | 8 +++ src/api/CustomerPaymentInstrumentApi.js | 8 +++ src/api/CustomerShippingAddressApi.js | 8 +++ src/api/DecisionManagerApi.js | 20 ++++++ src/api/EMVTagDetailsApi.js | 4 ++ src/api/InstrumentIdentifierApi.js | 12 ++++ src/api/InvoiceSettingsApi.js | 4 ++ src/api/InvoicesApi.js | 8 +++ src/api/KeyManagementPasswordApi.js | 4 ++ src/api/KeyManagementPgpApi.js | 4 ++ src/api/KeyManagementScmpApi.js | 4 ++ src/api/MicroformIntegrationApi.js | 4 ++ src/api/PayerAuthenticationApi.js | 12 ++++ src/api/PaymentInstrumentApi.js | 8 +++ src/api/PaymentsApi.js | 12 ++++ src/api/PayoutsApi.js | 4 ++ src/api/PlansApi.js | 8 +++ src/api/PushFundsApi.js | 4 ++ src/api/RefundApi.js | 8 +++ src/api/ReportSubscriptionsApi.js | 8 +++ src/api/ReportsApi.js | 4 ++ src/api/ReversalApi.js | 8 +++ src/api/SearchTransactionsApi.js | 4 ++ src/api/SubscriptionsApi.js | 8 +++ src/api/SymmetricKeyManagementApi.js | 12 ++++ src/api/TaxesApi.js | 8 +++ src/api/UnifiedCheckoutCaptureContextApi.js | 4 ++ src/api/UserManagementSearchApi.js | 4 ++ src/api/VerificationApi.js | 8 +++ src/api/VoidApi.js | 20 ++++++ src/index.js | 1 + src/utilities/tracking/SdkTracker.js | 65 +++++++++++++++++++ 39 files changed, 341 insertions(+) create mode 100644 src/utilities/tracking/SdkTracker.js diff --git a/generator/cybersource-javascript-template/api.mustache b/generator/cybersource-javascript-template/api.mustache index af813bf4..7f769d34 100644 --- a/generator/cybersource-javascript-template/api.mustache +++ b/generator/cybersource-javascript-template/api.mustache @@ -68,6 +68,12 @@ throw new Error("Missing the required parameter '' when calling "); } + <#bodyParam> + var SdkTracker = require('../utilities/tracking/SdkTracker'); + + var sdkTracker = new SdkTracker(); + postBody = sdkTracker.insertDeveloperIdTracker(postBody, '<&vendorExtensions.x-jsdoc-type>', this.apiClient.merchantConfig.runEnvironment); + var pathParams = {<#pathParams> '': <#required><^required>opts['']<#hasMore>, diff --git a/generator/cybersource-javascript-template/index.mustache b/generator/cybersource-javascript-template/index.mustache index 1fd9eb59..16d19659 100644 --- a/generator/cybersource-javascript-template/index.mustache +++ b/generator/cybersource-javascript-template/index.mustache @@ -100,5 +100,6 @@ exports.SensitiveDataMasker = require('./authentication/logging/SensitiveDataMasker.js'); exports.ExternalLoggerWrapper = require('./authentication/logging/ExternalLoggerWrapper.js'); exports.JWEUtility = require('./utilities/JWEUtility.js'); + exports.SdkTracker = require('./utilities/tracking/SdkTracker.js') return exports;<={{ }}=> })); diff --git a/src/api/AsymmetricKeyManagementApi.js b/src/api/AsymmetricKeyManagementApi.js index 09714d29..36d2583a 100644 --- a/src/api/AsymmetricKeyManagementApi.js +++ b/src/api/AsymmetricKeyManagementApi.js @@ -72,6 +72,10 @@ throw new Error("Missing the required parameter 'createP12KeysRequest' when calling createP12Keys"); } + var SdkTracker = require('../utilities/tracking/SdkTracker'); + + var sdkTracker = new SdkTracker(); + postBody = sdkTracker.insertDeveloperIdTracker(postBody, 'module:model/CreateP12KeysRequest', this.apiClient.merchantConfig.runEnvironment); var pathParams = { }; @@ -117,6 +121,10 @@ throw new Error("Missing the required parameter 'deleteBulkP12KeysRequest' when calling deleteBulkP12Keys"); } + var SdkTracker = require('../utilities/tracking/SdkTracker'); + + var sdkTracker = new SdkTracker(); + postBody = sdkTracker.insertDeveloperIdTracker(postBody, 'module:model/DeleteBulkP12KeysRequest', this.apiClient.merchantConfig.runEnvironment); var pathParams = { }; @@ -217,6 +225,10 @@ throw new Error("Missing the required parameter 'updateAsymKeysRequest' when calling updateAsymKey"); } + var SdkTracker = require('../utilities/tracking/SdkTracker'); + + var sdkTracker = new SdkTracker(); + postBody = sdkTracker.insertDeveloperIdTracker(postBody, 'module:model/UpdateAsymKeysRequest', this.apiClient.merchantConfig.runEnvironment); var pathParams = { 'keyId': keyId diff --git a/src/api/BatchesApi.js b/src/api/BatchesApi.js index 09341ca8..7af6596c 100644 --- a/src/api/BatchesApi.js +++ b/src/api/BatchesApi.js @@ -222,6 +222,10 @@ throw new Error("Missing the required parameter 'body' when calling postBatch"); } + var SdkTracker = require('../utilities/tracking/SdkTracker'); + + var sdkTracker = new SdkTracker(); + postBody = sdkTracker.insertDeveloperIdTracker(postBody, 'module:model/Body', this.apiClient.merchantConfig.runEnvironment); var pathParams = { }; diff --git a/src/api/BillingAgreementsApi.js b/src/api/BillingAgreementsApi.js index de6ae4f1..944758f3 100644 --- a/src/api/BillingAgreementsApi.js +++ b/src/api/BillingAgreementsApi.js @@ -78,6 +78,10 @@ throw new Error("Missing the required parameter 'id' when calling billingAgreementsDeRegistration"); } + var SdkTracker = require('../utilities/tracking/SdkTracker'); + + var sdkTracker = new SdkTracker(); + postBody = sdkTracker.insertDeveloperIdTracker(postBody, 'module:model/ModifyBillingAgreement', this.apiClient.merchantConfig.runEnvironment); var pathParams = { 'id': id @@ -130,6 +134,10 @@ throw new Error("Missing the required parameter 'id' when calling billingAgreementsIntimation"); } + var SdkTracker = require('../utilities/tracking/SdkTracker'); + + var sdkTracker = new SdkTracker(); + postBody = sdkTracker.insertDeveloperIdTracker(postBody, 'module:model/IntimateBillingAgreement', this.apiClient.merchantConfig.runEnvironment); var pathParams = { 'id': id @@ -176,6 +184,10 @@ throw new Error("Missing the required parameter 'createBillingAgreement' when calling billingAgreementsRegistration"); } + var SdkTracker = require('../utilities/tracking/SdkTracker'); + + var sdkTracker = new SdkTracker(); + postBody = sdkTracker.insertDeveloperIdTracker(postBody, 'module:model/CreateBillingAgreement', this.apiClient.merchantConfig.runEnvironment); var pathParams = { }; diff --git a/src/api/CaptureApi.js b/src/api/CaptureApi.js index 77beca12..7868bb60 100644 --- a/src/api/CaptureApi.js +++ b/src/api/CaptureApi.js @@ -78,6 +78,10 @@ throw new Error("Missing the required parameter 'id' when calling capturePayment"); } + var SdkTracker = require('../utilities/tracking/SdkTracker'); + + var sdkTracker = new SdkTracker(); + postBody = sdkTracker.insertDeveloperIdTracker(postBody, 'module:model/CapturePaymentRequest', this.apiClient.merchantConfig.runEnvironment); var pathParams = { 'id': id diff --git a/src/api/CreditApi.js b/src/api/CreditApi.js index 73468cd7..8d95bd84 100644 --- a/src/api/CreditApi.js +++ b/src/api/CreditApi.js @@ -72,6 +72,10 @@ throw new Error("Missing the required parameter 'createCreditRequest' when calling createCredit"); } + var SdkTracker = require('../utilities/tracking/SdkTracker'); + + var sdkTracker = new SdkTracker(); + postBody = sdkTracker.insertDeveloperIdTracker(postBody, 'module:model/CreateCreditRequest', this.apiClient.merchantConfig.runEnvironment); var pathParams = { }; diff --git a/src/api/CustomerApi.js b/src/api/CustomerApi.js index a6adf82b..82ed0d7d 100644 --- a/src/api/CustomerApi.js +++ b/src/api/CustomerApi.js @@ -187,6 +187,10 @@ throw new Error("Missing the required parameter 'patchCustomerRequest' when calling patchCustomer"); } + var SdkTracker = require('../utilities/tracking/SdkTracker'); + + var sdkTracker = new SdkTracker(); + postBody = sdkTracker.insertDeveloperIdTracker(postBody, 'module:model/PatchCustomerRequest', this.apiClient.merchantConfig.runEnvironment); var pathParams = { 'customerId': customerId @@ -238,6 +242,10 @@ throw new Error("Missing the required parameter 'postCustomerRequest' when calling postCustomer"); } + var SdkTracker = require('../utilities/tracking/SdkTracker'); + + var sdkTracker = new SdkTracker(); + postBody = sdkTracker.insertDeveloperIdTracker(postBody, 'module:model/PostCustomerRequest', this.apiClient.merchantConfig.runEnvironment); var pathParams = { }; diff --git a/src/api/CustomerPaymentInstrumentApi.js b/src/api/CustomerPaymentInstrumentApi.js index 5fe1d19a..e7dfa9c2 100644 --- a/src/api/CustomerPaymentInstrumentApi.js +++ b/src/api/CustomerPaymentInstrumentApi.js @@ -264,6 +264,10 @@ throw new Error("Missing the required parameter 'patchCustomerPaymentInstrumentRequest' when calling patchCustomersPaymentInstrument"); } + var SdkTracker = require('../utilities/tracking/SdkTracker'); + + var sdkTracker = new SdkTracker(); + postBody = sdkTracker.insertDeveloperIdTracker(postBody, 'module:model/PatchCustomerPaymentInstrumentRequest', this.apiClient.merchantConfig.runEnvironment); var pathParams = { 'customerId': customerId, @@ -322,6 +326,10 @@ throw new Error("Missing the required parameter 'postCustomerPaymentInstrumentRequest' when calling postCustomerPaymentInstrument"); } + var SdkTracker = require('../utilities/tracking/SdkTracker'); + + var sdkTracker = new SdkTracker(); + postBody = sdkTracker.insertDeveloperIdTracker(postBody, 'module:model/PostCustomerPaymentInstrumentRequest', this.apiClient.merchantConfig.runEnvironment); var pathParams = { 'customerId': customerId diff --git a/src/api/CustomerShippingAddressApi.js b/src/api/CustomerShippingAddressApi.js index dfc5d365..3edc9fd3 100644 --- a/src/api/CustomerShippingAddressApi.js +++ b/src/api/CustomerShippingAddressApi.js @@ -264,6 +264,10 @@ throw new Error("Missing the required parameter 'patchCustomerShippingAddressRequest' when calling patchCustomersShippingAddress"); } + var SdkTracker = require('../utilities/tracking/SdkTracker'); + + var sdkTracker = new SdkTracker(); + postBody = sdkTracker.insertDeveloperIdTracker(postBody, 'module:model/PatchCustomerShippingAddressRequest', this.apiClient.merchantConfig.runEnvironment); var pathParams = { 'customerId': customerId, @@ -322,6 +326,10 @@ throw new Error("Missing the required parameter 'postCustomerShippingAddressRequest' when calling postCustomerShippingAddress"); } + var SdkTracker = require('../utilities/tracking/SdkTracker'); + + var sdkTracker = new SdkTracker(); + postBody = sdkTracker.insertDeveloperIdTracker(postBody, 'module:model/PostCustomerShippingAddressRequest', this.apiClient.merchantConfig.runEnvironment); var pathParams = { 'customerId': customerId diff --git a/src/api/DecisionManagerApi.js b/src/api/DecisionManagerApi.js index ab337fdb..820b60eb 100644 --- a/src/api/DecisionManagerApi.js +++ b/src/api/DecisionManagerApi.js @@ -78,6 +78,10 @@ throw new Error("Missing the required parameter 'caseManagementActionsRequest' when calling actionDecisionManagerCase"); } + var SdkTracker = require('../utilities/tracking/SdkTracker'); + + var sdkTracker = new SdkTracker(); + postBody = sdkTracker.insertDeveloperIdTracker(postBody, 'module:model/CaseManagementActionsRequest', this.apiClient.merchantConfig.runEnvironment); var pathParams = { 'id': id @@ -130,6 +134,10 @@ throw new Error("Missing the required parameter 'addNegativeListRequest' when calling addNegative"); } + var SdkTracker = require('../utilities/tracking/SdkTracker'); + + var sdkTracker = new SdkTracker(); + postBody = sdkTracker.insertDeveloperIdTracker(postBody, 'module:model/AddNegativeListRequest', this.apiClient.merchantConfig.runEnvironment); var pathParams = { 'type': type @@ -182,6 +190,10 @@ throw new Error("Missing the required parameter 'caseManagementCommentsRequest' when calling commentDecisionManagerCase"); } + var SdkTracker = require('../utilities/tracking/SdkTracker'); + + var sdkTracker = new SdkTracker(); + postBody = sdkTracker.insertDeveloperIdTracker(postBody, 'module:model/CaseManagementCommentsRequest', this.apiClient.merchantConfig.runEnvironment); var pathParams = { 'id': id @@ -228,6 +240,10 @@ throw new Error("Missing the required parameter 'createBundledDecisionManagerCaseRequest' when calling createBundledDecisionManagerCase"); } + var SdkTracker = require('../utilities/tracking/SdkTracker'); + + var sdkTracker = new SdkTracker(); + postBody = sdkTracker.insertDeveloperIdTracker(postBody, 'module:model/CreateBundledDecisionManagerCaseRequest', this.apiClient.merchantConfig.runEnvironment); var pathParams = { }; @@ -279,6 +295,10 @@ throw new Error("Missing the required parameter 'fraudMarkingActionRequest' when calling fraudUpdate"); } + var SdkTracker = require('../utilities/tracking/SdkTracker'); + + var sdkTracker = new SdkTracker(); + postBody = sdkTracker.insertDeveloperIdTracker(postBody, 'module:model/FraudMarkingActionRequest', this.apiClient.merchantConfig.runEnvironment); var pathParams = { 'id': id diff --git a/src/api/EMVTagDetailsApi.js b/src/api/EMVTagDetailsApi.js index b262a747..b3012330 100644 --- a/src/api/EMVTagDetailsApi.js +++ b/src/api/EMVTagDetailsApi.js @@ -114,6 +114,10 @@ throw new Error("Missing the required parameter 'body' when calling parseEmvTags"); } + var SdkTracker = require('../utilities/tracking/SdkTracker'); + + var sdkTracker = new SdkTracker(); + postBody = sdkTracker.insertDeveloperIdTracker(postBody, 'module:model/Body', this.apiClient.merchantConfig.runEnvironment); var pathParams = { }; diff --git a/src/api/InstrumentIdentifierApi.js b/src/api/InstrumentIdentifierApi.js index 27039c64..1e6eaa51 100644 --- a/src/api/InstrumentIdentifierApi.js +++ b/src/api/InstrumentIdentifierApi.js @@ -244,6 +244,10 @@ throw new Error("Missing the required parameter 'patchInstrumentIdentifierRequest' when calling patchInstrumentIdentifier"); } + var SdkTracker = require('../utilities/tracking/SdkTracker'); + + var sdkTracker = new SdkTracker(); + postBody = sdkTracker.insertDeveloperIdTracker(postBody, 'module:model/PatchInstrumentIdentifierRequest', this.apiClient.merchantConfig.runEnvironment); var pathParams = { 'instrumentIdentifierId': instrumentIdentifierId @@ -295,6 +299,10 @@ throw new Error("Missing the required parameter 'postInstrumentIdentifierRequest' when calling postInstrumentIdentifier"); } + var SdkTracker = require('../utilities/tracking/SdkTracker'); + + var sdkTracker = new SdkTracker(); + postBody = sdkTracker.insertDeveloperIdTracker(postBody, 'module:model/PostInstrumentIdentifierRequest', this.apiClient.merchantConfig.runEnvironment); var pathParams = { }; @@ -349,6 +357,10 @@ throw new Error("Missing the required parameter 'postInstrumentIdentifierEnrollmentRequest' when calling postInstrumentIdentifierEnrollment"); } + var SdkTracker = require('../utilities/tracking/SdkTracker'); + + var sdkTracker = new SdkTracker(); + postBody = sdkTracker.insertDeveloperIdTracker(postBody, 'module:model/PostInstrumentIdentifierEnrollmentRequest', this.apiClient.merchantConfig.runEnvironment); var pathParams = { 'instrumentIdentifierId': instrumentIdentifierId diff --git a/src/api/InvoiceSettingsApi.js b/src/api/InvoiceSettingsApi.js index e26aa0ee..6e8f3dcb 100644 --- a/src/api/InvoiceSettingsApi.js +++ b/src/api/InvoiceSettingsApi.js @@ -114,6 +114,10 @@ throw new Error("Missing the required parameter 'invoiceSettingsRequest' when calling updateInvoiceSettings"); } + var SdkTracker = require('../utilities/tracking/SdkTracker'); + + var sdkTracker = new SdkTracker(); + postBody = sdkTracker.insertDeveloperIdTracker(postBody, 'module:model/InvoiceSettingsRequest', this.apiClient.merchantConfig.runEnvironment); var pathParams = { }; diff --git a/src/api/InvoicesApi.js b/src/api/InvoicesApi.js index 7d2d82b4..eed903b4 100644 --- a/src/api/InvoicesApi.js +++ b/src/api/InvoicesApi.js @@ -72,6 +72,10 @@ throw new Error("Missing the required parameter 'createInvoiceRequest' when calling createInvoice"); } + var SdkTracker = require('../utilities/tracking/SdkTracker'); + + var sdkTracker = new SdkTracker(); + postBody = sdkTracker.insertDeveloperIdTracker(postBody, 'module:model/CreateInvoiceRequest', this.apiClient.merchantConfig.runEnvironment); var pathParams = { }; @@ -330,6 +334,10 @@ throw new Error("Missing the required parameter 'updateInvoiceRequest' when calling updateInvoice"); } + var SdkTracker = require('../utilities/tracking/SdkTracker'); + + var sdkTracker = new SdkTracker(); + postBody = sdkTracker.insertDeveloperIdTracker(postBody, 'module:model/UpdateInvoiceRequest', this.apiClient.merchantConfig.runEnvironment); var pathParams = { 'id': id diff --git a/src/api/KeyManagementPasswordApi.js b/src/api/KeyManagementPasswordApi.js index 55b17a27..f3a7ca73 100644 --- a/src/api/KeyManagementPasswordApi.js +++ b/src/api/KeyManagementPasswordApi.js @@ -78,6 +78,10 @@ throw new Error("Missing the required parameter 'updatePasswordKeysRequest' when calling updatePassword"); } + var SdkTracker = require('../utilities/tracking/SdkTracker'); + + var sdkTracker = new SdkTracker(); + postBody = sdkTracker.insertDeveloperIdTracker(postBody, 'module:model/UpdatePasswordKeysRequest', this.apiClient.merchantConfig.runEnvironment); var pathParams = { 'keyId': keyId diff --git a/src/api/KeyManagementPgpApi.js b/src/api/KeyManagementPgpApi.js index ce979003..2ba18903 100644 --- a/src/api/KeyManagementPgpApi.js +++ b/src/api/KeyManagementPgpApi.js @@ -78,6 +78,10 @@ throw new Error("Missing the required parameter 'updatePGPKeysRequest' when calling updatePGP"); } + var SdkTracker = require('../utilities/tracking/SdkTracker'); + + var sdkTracker = new SdkTracker(); + postBody = sdkTracker.insertDeveloperIdTracker(postBody, 'module:model/UpdatePGPKeysRequest', this.apiClient.merchantConfig.runEnvironment); var pathParams = { 'keyId': keyId diff --git a/src/api/KeyManagementScmpApi.js b/src/api/KeyManagementScmpApi.js index 2a783437..7c9484b5 100644 --- a/src/api/KeyManagementScmpApi.js +++ b/src/api/KeyManagementScmpApi.js @@ -78,6 +78,10 @@ throw new Error("Missing the required parameter 'updatePGPKeysRequest' when calling updateSCMP"); } + var SdkTracker = require('../utilities/tracking/SdkTracker'); + + var sdkTracker = new SdkTracker(); + postBody = sdkTracker.insertDeveloperIdTracker(postBody, 'module:model/UpdatePGPKeysRequest1', this.apiClient.merchantConfig.runEnvironment); var pathParams = { 'keyId': keyId diff --git a/src/api/MicroformIntegrationApi.js b/src/api/MicroformIntegrationApi.js index 20dd4287..fc255c87 100644 --- a/src/api/MicroformIntegrationApi.js +++ b/src/api/MicroformIntegrationApi.js @@ -72,6 +72,10 @@ throw new Error("Missing the required parameter 'generateCaptureContextRequest' when calling generateCaptureContext"); } + var SdkTracker = require('../utilities/tracking/SdkTracker'); + + var sdkTracker = new SdkTracker(); + postBody = sdkTracker.insertDeveloperIdTracker(postBody, 'module:model/GenerateCaptureContextRequest', this.apiClient.merchantConfig.runEnvironment); var pathParams = { }; diff --git a/src/api/PayerAuthenticationApi.js b/src/api/PayerAuthenticationApi.js index 7eb7a4b5..f4571cbc 100644 --- a/src/api/PayerAuthenticationApi.js +++ b/src/api/PayerAuthenticationApi.js @@ -72,6 +72,10 @@ throw new Error("Missing the required parameter 'checkPayerAuthEnrollmentRequest' when calling checkPayerAuthEnrollment"); } + var SdkTracker = require('../utilities/tracking/SdkTracker'); + + var sdkTracker = new SdkTracker(); + postBody = sdkTracker.insertDeveloperIdTracker(postBody, 'module:model/CheckPayerAuthEnrollmentRequest', this.apiClient.merchantConfig.runEnvironment); var pathParams = { }; @@ -117,6 +121,10 @@ throw new Error("Missing the required parameter 'payerAuthSetupRequest' when calling payerAuthSetup"); } + var SdkTracker = require('../utilities/tracking/SdkTracker'); + + var sdkTracker = new SdkTracker(); + postBody = sdkTracker.insertDeveloperIdTracker(postBody, 'module:model/PayerAuthSetupRequest', this.apiClient.merchantConfig.runEnvironment); var pathParams = { }; @@ -162,6 +170,10 @@ throw new Error("Missing the required parameter 'validateRequest' when calling validateAuthenticationResults"); } + var SdkTracker = require('../utilities/tracking/SdkTracker'); + + var sdkTracker = new SdkTracker(); + postBody = sdkTracker.insertDeveloperIdTracker(postBody, 'module:model/ValidateRequest', this.apiClient.merchantConfig.runEnvironment); var pathParams = { }; diff --git a/src/api/PaymentInstrumentApi.js b/src/api/PaymentInstrumentApi.js index 7d3c3cb6..7b154b87 100644 --- a/src/api/PaymentInstrumentApi.js +++ b/src/api/PaymentInstrumentApi.js @@ -187,6 +187,10 @@ throw new Error("Missing the required parameter 'patchPaymentInstrumentRequest' when calling patchPaymentInstrument"); } + var SdkTracker = require('../utilities/tracking/SdkTracker'); + + var sdkTracker = new SdkTracker(); + postBody = sdkTracker.insertDeveloperIdTracker(postBody, 'module:model/PatchPaymentInstrumentRequest', this.apiClient.merchantConfig.runEnvironment); var pathParams = { 'paymentInstrumentId': paymentInstrumentId @@ -238,6 +242,10 @@ throw new Error("Missing the required parameter 'postPaymentInstrumentRequest' when calling postPaymentInstrument"); } + var SdkTracker = require('../utilities/tracking/SdkTracker'); + + var sdkTracker = new SdkTracker(); + postBody = sdkTracker.insertDeveloperIdTracker(postBody, 'module:model/PostPaymentInstrumentRequest', this.apiClient.merchantConfig.runEnvironment); var pathParams = { }; diff --git a/src/api/PaymentsApi.js b/src/api/PaymentsApi.js index 002a5812..c915f992 100644 --- a/src/api/PaymentsApi.js +++ b/src/api/PaymentsApi.js @@ -72,6 +72,10 @@ throw new Error("Missing the required parameter 'createPaymentRequest' when calling createPayment"); } + var SdkTracker = require('../utilities/tracking/SdkTracker'); + + var sdkTracker = new SdkTracker(); + postBody = sdkTracker.insertDeveloperIdTracker(postBody, 'module:model/CreatePaymentRequest', this.apiClient.merchantConfig.runEnvironment); var pathParams = { }; @@ -123,6 +127,10 @@ throw new Error("Missing the required parameter 'incrementAuthRequest' when calling incrementAuth"); } + var SdkTracker = require('../utilities/tracking/SdkTracker'); + + var sdkTracker = new SdkTracker(); + postBody = sdkTracker.insertDeveloperIdTracker(postBody, 'module:model/IncrementAuthRequest', this.apiClient.merchantConfig.runEnvironment); var pathParams = { 'id': id @@ -175,6 +183,10 @@ throw new Error("Missing the required parameter 'refreshPaymentStatusRequest' when calling refreshPaymentStatus"); } + var SdkTracker = require('../utilities/tracking/SdkTracker'); + + var sdkTracker = new SdkTracker(); + postBody = sdkTracker.insertDeveloperIdTracker(postBody, 'module:model/RefreshPaymentStatusRequest', this.apiClient.merchantConfig.runEnvironment); var pathParams = { 'id': id diff --git a/src/api/PayoutsApi.js b/src/api/PayoutsApi.js index b9f869b5..8a23f02d 100644 --- a/src/api/PayoutsApi.js +++ b/src/api/PayoutsApi.js @@ -72,6 +72,10 @@ throw new Error("Missing the required parameter 'octCreatePaymentRequest' when calling octCreatePayment"); } + var SdkTracker = require('../utilities/tracking/SdkTracker'); + + var sdkTracker = new SdkTracker(); + postBody = sdkTracker.insertDeveloperIdTracker(postBody, 'module:model/OctCreatePaymentRequest', this.apiClient.merchantConfig.runEnvironment); var pathParams = { }; diff --git a/src/api/PlansApi.js b/src/api/PlansApi.js index 7661c1b3..948636d5 100644 --- a/src/api/PlansApi.js +++ b/src/api/PlansApi.js @@ -121,6 +121,10 @@ throw new Error("Missing the required parameter 'createPlanRequest' when calling createPlan"); } + var SdkTracker = require('../utilities/tracking/SdkTracker'); + + var sdkTracker = new SdkTracker(); + postBody = sdkTracker.insertDeveloperIdTracker(postBody, 'module:model/CreatePlanRequest', this.apiClient.merchantConfig.runEnvironment); var pathParams = { }; @@ -415,6 +419,10 @@ throw new Error("Missing the required parameter 'updatePlanRequest' when calling updatePlan"); } + var SdkTracker = require('../utilities/tracking/SdkTracker'); + + var sdkTracker = new SdkTracker(); + postBody = sdkTracker.insertDeveloperIdTracker(postBody, 'module:model/UpdatePlanRequest', this.apiClient.merchantConfig.runEnvironment); var pathParams = { 'id': id diff --git a/src/api/PushFundsApi.js b/src/api/PushFundsApi.js index b4a90288..2e7fc454 100644 --- a/src/api/PushFundsApi.js +++ b/src/api/PushFundsApi.js @@ -108,6 +108,10 @@ throw new Error("Missing the required parameter 'vCOrganizationId' when calling createPushFundsTransfer"); } + var SdkTracker = require('../utilities/tracking/SdkTracker'); + + var sdkTracker = new SdkTracker(); + postBody = sdkTracker.insertDeveloperIdTracker(postBody, 'module:model/PushFundsRequest', this.apiClient.merchantConfig.runEnvironment); var pathParams = { }; diff --git a/src/api/RefundApi.js b/src/api/RefundApi.js index effcf109..e0a3e788 100644 --- a/src/api/RefundApi.js +++ b/src/api/RefundApi.js @@ -78,6 +78,10 @@ throw new Error("Missing the required parameter 'id' when calling refundCapture"); } + var SdkTracker = require('../utilities/tracking/SdkTracker'); + + var sdkTracker = new SdkTracker(); + postBody = sdkTracker.insertDeveloperIdTracker(postBody, 'module:model/RefundCaptureRequest', this.apiClient.merchantConfig.runEnvironment); var pathParams = { 'id': id @@ -130,6 +134,10 @@ throw new Error("Missing the required parameter 'id' when calling refundPayment"); } + var SdkTracker = require('../utilities/tracking/SdkTracker'); + + var sdkTracker = new SdkTracker(); + postBody = sdkTracker.insertDeveloperIdTracker(postBody, 'module:model/RefundPaymentRequest', this.apiClient.merchantConfig.runEnvironment); var pathParams = { 'id': id diff --git a/src/api/ReportSubscriptionsApi.js b/src/api/ReportSubscriptionsApi.js index c33fd23d..487aa0e7 100644 --- a/src/api/ReportSubscriptionsApi.js +++ b/src/api/ReportSubscriptionsApi.js @@ -74,6 +74,10 @@ throw new Error("Missing the required parameter 'predefinedSubscriptionRequestBean' when calling createStandardOrClassicSubscription"); } + var SdkTracker = require('../utilities/tracking/SdkTracker'); + + var sdkTracker = new SdkTracker(); + postBody = sdkTracker.insertDeveloperIdTracker(postBody, 'module:model/PredefinedSubscriptionRequestBean', this.apiClient.merchantConfig.runEnvironment); var pathParams = { }; @@ -122,6 +126,10 @@ throw new Error("Missing the required parameter 'createReportSubscriptionRequest' when calling createSubscription"); } + var SdkTracker = require('../utilities/tracking/SdkTracker'); + + var sdkTracker = new SdkTracker(); + postBody = sdkTracker.insertDeveloperIdTracker(postBody, 'module:model/CreateReportSubscriptionRequest', this.apiClient.merchantConfig.runEnvironment); var pathParams = { }; diff --git a/src/api/ReportsApi.js b/src/api/ReportsApi.js index c7cddb83..03e601ce 100644 --- a/src/api/ReportsApi.js +++ b/src/api/ReportsApi.js @@ -74,6 +74,10 @@ throw new Error("Missing the required parameter 'createAdhocReportRequest' when calling createReport"); } + var SdkTracker = require('../utilities/tracking/SdkTracker'); + + var sdkTracker = new SdkTracker(); + postBody = sdkTracker.insertDeveloperIdTracker(postBody, 'module:model/CreateAdhocReportRequest', this.apiClient.merchantConfig.runEnvironment); var pathParams = { }; diff --git a/src/api/ReversalApi.js b/src/api/ReversalApi.js index 28a645f4..a1912ec3 100644 --- a/src/api/ReversalApi.js +++ b/src/api/ReversalApi.js @@ -78,6 +78,10 @@ throw new Error("Missing the required parameter 'authReversalRequest' when calling authReversal"); } + var SdkTracker = require('../utilities/tracking/SdkTracker'); + + var sdkTracker = new SdkTracker(); + postBody = sdkTracker.insertDeveloperIdTracker(postBody, 'module:model/AuthReversalRequest', this.apiClient.merchantConfig.runEnvironment); var pathParams = { 'id': id @@ -124,6 +128,10 @@ throw new Error("Missing the required parameter 'mitReversalRequest' when calling mitReversal"); } + var SdkTracker = require('../utilities/tracking/SdkTracker'); + + var sdkTracker = new SdkTracker(); + postBody = sdkTracker.insertDeveloperIdTracker(postBody, 'module:model/MitReversalRequest', this.apiClient.merchantConfig.runEnvironment); var pathParams = { }; diff --git a/src/api/SearchTransactionsApi.js b/src/api/SearchTransactionsApi.js index 64dc96cb..d179dd04 100644 --- a/src/api/SearchTransactionsApi.js +++ b/src/api/SearchTransactionsApi.js @@ -72,6 +72,10 @@ throw new Error("Missing the required parameter 'createSearchRequest' when calling createSearch"); } + var SdkTracker = require('../utilities/tracking/SdkTracker'); + + var sdkTracker = new SdkTracker(); + postBody = sdkTracker.insertDeveloperIdTracker(postBody, 'module:model/CreateSearchRequest', this.apiClient.merchantConfig.runEnvironment); var pathParams = { }; diff --git a/src/api/SubscriptionsApi.js b/src/api/SubscriptionsApi.js index 038788ef..9c54d42c 100644 --- a/src/api/SubscriptionsApi.js +++ b/src/api/SubscriptionsApi.js @@ -170,6 +170,10 @@ throw new Error("Missing the required parameter 'createSubscriptionRequest' when calling createSubscription"); } + var SdkTracker = require('../utilities/tracking/SdkTracker'); + + var sdkTracker = new SdkTracker(); + postBody = sdkTracker.insertDeveloperIdTracker(postBody, 'module:model/CreateSubscriptionRequest', this.apiClient.merchantConfig.runEnvironment); var pathParams = { }; @@ -413,6 +417,10 @@ throw new Error("Missing the required parameter 'updateSubscription' when calling updateSubscription"); } + var SdkTracker = require('../utilities/tracking/SdkTracker'); + + var sdkTracker = new SdkTracker(); + postBody = sdkTracker.insertDeveloperIdTracker(postBody, 'module:model/UpdateSubscription', this.apiClient.merchantConfig.runEnvironment); var pathParams = { 'id': id diff --git a/src/api/SymmetricKeyManagementApi.js b/src/api/SymmetricKeyManagementApi.js index 9a4de2fe..0a499e3e 100644 --- a/src/api/SymmetricKeyManagementApi.js +++ b/src/api/SymmetricKeyManagementApi.js @@ -72,6 +72,10 @@ throw new Error("Missing the required parameter 'createSharedSecretKeysRequest' when calling createV2SharedSecretKeys"); } + var SdkTracker = require('../utilities/tracking/SdkTracker'); + + var sdkTracker = new SdkTracker(); + postBody = sdkTracker.insertDeveloperIdTracker(postBody, 'module:model/CreateSharedSecretKeysRequest', this.apiClient.merchantConfig.runEnvironment); var pathParams = { }; @@ -123,6 +127,10 @@ throw new Error("Missing the required parameter 'createSharedSecretKeysVerifiRequest' when calling createV2SharedSecretKeysVerifi"); } + var SdkTracker = require('../utilities/tracking/SdkTracker'); + + var sdkTracker = new SdkTracker(); + postBody = sdkTracker.insertDeveloperIdTracker(postBody, 'module:model/CreateSharedSecretKeysVerifiRequest', this.apiClient.merchantConfig.runEnvironment); var pathParams = { }; @@ -169,6 +177,10 @@ throw new Error("Missing the required parameter 'deleteBulkSymmetricKeysRequest' when calling deleteBulkSymmetricKeys"); } + var SdkTracker = require('../utilities/tracking/SdkTracker'); + + var sdkTracker = new SdkTracker(); + postBody = sdkTracker.insertDeveloperIdTracker(postBody, 'module:model/DeleteBulkSymmetricKeysRequest', this.apiClient.merchantConfig.runEnvironment); var pathParams = { }; diff --git a/src/api/TaxesApi.js b/src/api/TaxesApi.js index 058cdd40..725fa0d5 100644 --- a/src/api/TaxesApi.js +++ b/src/api/TaxesApi.js @@ -72,6 +72,10 @@ throw new Error("Missing the required parameter 'taxRequest' when calling calculateTax"); } + var SdkTracker = require('../utilities/tracking/SdkTracker'); + + var sdkTracker = new SdkTracker(); + postBody = sdkTracker.insertDeveloperIdTracker(postBody, 'module:model/TaxRequest', this.apiClient.merchantConfig.runEnvironment); var pathParams = { }; @@ -123,6 +127,10 @@ throw new Error("Missing the required parameter 'id' when calling voidTax"); } + var SdkTracker = require('../utilities/tracking/SdkTracker'); + + var sdkTracker = new SdkTracker(); + postBody = sdkTracker.insertDeveloperIdTracker(postBody, 'module:model/VoidTaxRequest', this.apiClient.merchantConfig.runEnvironment); var pathParams = { 'id': id diff --git a/src/api/UnifiedCheckoutCaptureContextApi.js b/src/api/UnifiedCheckoutCaptureContextApi.js index 644f11f0..c7c59553 100644 --- a/src/api/UnifiedCheckoutCaptureContextApi.js +++ b/src/api/UnifiedCheckoutCaptureContextApi.js @@ -72,6 +72,10 @@ throw new Error("Missing the required parameter 'generateUnifiedCheckoutCaptureContextRequest' when calling generateUnifiedCheckoutCaptureContext"); } + var SdkTracker = require('../utilities/tracking/SdkTracker'); + + var sdkTracker = new SdkTracker(); + postBody = sdkTracker.insertDeveloperIdTracker(postBody, 'module:model/GenerateUnifiedCheckoutCaptureContextRequest', this.apiClient.merchantConfig.runEnvironment); var pathParams = { }; diff --git a/src/api/UserManagementSearchApi.js b/src/api/UserManagementSearchApi.js index c0bbeeed..5c8d10de 100644 --- a/src/api/UserManagementSearchApi.js +++ b/src/api/UserManagementSearchApi.js @@ -72,6 +72,10 @@ throw new Error("Missing the required parameter 'searchRequest' when calling searchUsers"); } + var SdkTracker = require('../utilities/tracking/SdkTracker'); + + var sdkTracker = new SdkTracker(); + postBody = sdkTracker.insertDeveloperIdTracker(postBody, 'module:model/SearchRequest', this.apiClient.merchantConfig.runEnvironment); var pathParams = { }; diff --git a/src/api/VerificationApi.js b/src/api/VerificationApi.js index 96411036..c5af5a32 100644 --- a/src/api/VerificationApi.js +++ b/src/api/VerificationApi.js @@ -72,6 +72,10 @@ throw new Error("Missing the required parameter 'validateExportComplianceRequest' when calling validateExportCompliance"); } + var SdkTracker = require('../utilities/tracking/SdkTracker'); + + var sdkTracker = new SdkTracker(); + postBody = sdkTracker.insertDeveloperIdTracker(postBody, 'module:model/ValidateExportComplianceRequest', this.apiClient.merchantConfig.runEnvironment); var pathParams = { }; @@ -117,6 +121,10 @@ throw new Error("Missing the required parameter 'verifyCustomerAddressRequest' when calling verifyCustomerAddress"); } + var SdkTracker = require('../utilities/tracking/SdkTracker'); + + var sdkTracker = new SdkTracker(); + postBody = sdkTracker.insertDeveloperIdTracker(postBody, 'module:model/VerifyCustomerAddressRequest', this.apiClient.merchantConfig.runEnvironment); var pathParams = { }; diff --git a/src/api/VoidApi.js b/src/api/VoidApi.js index 1cf1eba4..b28dc905 100644 --- a/src/api/VoidApi.js +++ b/src/api/VoidApi.js @@ -72,6 +72,10 @@ throw new Error("Missing the required parameter 'mitVoidRequest' when calling mitVoid"); } + var SdkTracker = require('../utilities/tracking/SdkTracker'); + + var sdkTracker = new SdkTracker(); + postBody = sdkTracker.insertDeveloperIdTracker(postBody, 'module:model/MitVoidRequest', this.apiClient.merchantConfig.runEnvironment); var pathParams = { }; @@ -123,6 +127,10 @@ throw new Error("Missing the required parameter 'id' when calling voidCapture"); } + var SdkTracker = require('../utilities/tracking/SdkTracker'); + + var sdkTracker = new SdkTracker(); + postBody = sdkTracker.insertDeveloperIdTracker(postBody, 'module:model/VoidCaptureRequest', this.apiClient.merchantConfig.runEnvironment); var pathParams = { 'id': id @@ -175,6 +183,10 @@ throw new Error("Missing the required parameter 'id' when calling voidCredit"); } + var SdkTracker = require('../utilities/tracking/SdkTracker'); + + var sdkTracker = new SdkTracker(); + postBody = sdkTracker.insertDeveloperIdTracker(postBody, 'module:model/VoidCreditRequest', this.apiClient.merchantConfig.runEnvironment); var pathParams = { 'id': id @@ -227,6 +239,10 @@ throw new Error("Missing the required parameter 'id' when calling voidPayment"); } + var SdkTracker = require('../utilities/tracking/SdkTracker'); + + var sdkTracker = new SdkTracker(); + postBody = sdkTracker.insertDeveloperIdTracker(postBody, 'module:model/VoidPaymentRequest', this.apiClient.merchantConfig.runEnvironment); var pathParams = { 'id': id @@ -279,6 +295,10 @@ throw new Error("Missing the required parameter 'id' when calling voidRefund"); } + var SdkTracker = require('../utilities/tracking/SdkTracker'); + + var sdkTracker = new SdkTracker(); + postBody = sdkTracker.insertDeveloperIdTracker(postBody, 'module:model/VoidRefundRequest', this.apiClient.merchantConfig.runEnvironment); var pathParams = { 'id': id diff --git a/src/index.js b/src/index.js index 6f14a108..73b97b20 100644 --- a/src/index.js +++ b/src/index.js @@ -5294,5 +5294,6 @@ exports.SensitiveDataMasker = require('./authentication/logging/SensitiveDataMasker.js'); exports.ExternalLoggerWrapper = require('./authentication/logging/ExternalLoggerWrapper.js'); exports.JWEUtility = require('./utilities/JWEUtility.js'); + exports.SdkTracker = require('./utilities/tracking/SdkTracker.js') return exports; })); diff --git a/src/utilities/tracking/SdkTracker.js b/src/utilities/tracking/SdkTracker.js new file mode 100644 index 00000000..ec53f220 --- /dev/null +++ b/src/utilities/tracking/SdkTracker.js @@ -0,0 +1,65 @@ +'use strict' + +const inclusionList = [ + 'module:model/CreateP12KeysRequest', + 'module:model/DeleteBulkP12KeysRequest', + 'module:model/CapturePaymentRequest', + 'module:model/CreateCreditRequest', + 'module:model/AddNegativeListRequest', + 'module:model/CreateBundledDecisionManagerCaseRequest', + 'module:model/FraudMarkingActionRequest', + 'module:model/CheckPayerAuthEnrollmentRequest', + 'module:model/PayerAuthSetupRequest', + 'module:model/ValidateRequest', + 'module:model/CreatePaymentRequest', + 'module:model/IncrementAuthRequest', + 'module:model/CreatePlanRequest', + 'module:model/RefundCaptureRequest', + 'module:model/RefundPaymentRequest', + 'module:model/AuthReversalRequest', + 'module:model/MitReversalRequest', + 'module:model/CreateSubscriptionRequest', + 'module:model/UpdateSubscription', + 'module:model/CreateSharedSecretKeysRequest', + 'module:model/CreateSharedSecretKeysVerifiRequest', + 'module:model/DeleteBulkSymmetricKeysRequest', + 'module:model/TaxRequest', + 'module:model/VoidTaxRequest', + 'module:model/ValidateExportComplianceRequest', + 'module:model/VerifyCustomerAddressRequest', + 'module:model/MitVoidRequest', + 'module:model/VoidCaptureRequest', + 'module:model/VoidCreditRequest', + 'module:model/VoidPaymentRequest', + 'module:model/VoidRefundRequest' +]; + +function SdkTracker() {} + +SdkTracker.prototype.insertDeveloperIdTracker = function insertDeveloperIdTracker(requestObj, requestClass, runEnvironment) { + if (inclusionList.includes(requestClass)) { + var developerIdValue = ''; + + if (runEnvironment == 'apitest.cybersource.com') { + developerIdValue = 'N2RC3Q4K'; + } else { + developerIdValue = 'FS39X8Q7'; + } + + if (requestObj.clientReferenceInformation == undefined) { + requestObj.clientReferenceInformation = {}; + } + + if (requestObj.clientReferenceInformation.partner == undefined) { + requestObj.clientReferenceInformation.partner = {}; + } + + if (!requestObj.clientReferenceInformation.partner.developerId) { + requestObj.clientReferenceInformation.partner.developerId = developerIdValue; + } + } + + return requestObj; +} + +module.exports = SdkTracker; From 6fc9d0afbfe949ab36d238f429549b4fc1b6a773 Mon Sep 17 00:00:00 2001 From: monu-kumar-visa <138751796+monu-kumar-visa@users.noreply.github.com> Date: Wed, 15 Nov 2023 16:06:58 +0530 Subject: [PATCH 2/2] sdk tracker in beta APIS --- src/api/CreateNewWebhooksApi.js | 8 ++++++++ src/api/ManageWebhooksApi.js | 12 ++++++++++++ src/api/MerchantBoardingApi.js | 4 ++++ 3 files changed, 24 insertions(+) diff --git a/src/api/CreateNewWebhooksApi.js b/src/api/CreateNewWebhooksApi.js index 55d02144..e74c0f38 100644 --- a/src/api/CreateNewWebhooksApi.js +++ b/src/api/CreateNewWebhooksApi.js @@ -71,6 +71,10 @@ opts = opts || {}; var postBody = opts['createWebhook']; + var SdkTracker = require('../utilities/tracking/SdkTracker'); + + var sdkTracker = new SdkTracker(); + postBody = sdkTracker.insertDeveloperIdTracker(postBody, 'module:model/CreateWebhook', this.apiClient.merchantConfig.runEnvironment); var pathParams = { }; @@ -177,6 +181,10 @@ throw new Error("Missing the required parameter 'vCPermissions' when calling saveSymEgressKey"); } + var SdkTracker = require('../utilities/tracking/SdkTracker'); + + var sdkTracker = new SdkTracker(); + postBody = sdkTracker.insertDeveloperIdTracker(postBody, 'module:model/SaveSymEgressKey', this.apiClient.merchantConfig.runEnvironment); var pathParams = { }; diff --git a/src/api/ManageWebhooksApi.js b/src/api/ManageWebhooksApi.js index b12ddee1..797eb0c0 100644 --- a/src/api/ManageWebhooksApi.js +++ b/src/api/ManageWebhooksApi.js @@ -242,6 +242,10 @@ throw new Error("Missing the required parameter 'webhookId' when calling replayPreviousWebhook"); } + var SdkTracker = require('../utilities/tracking/SdkTracker'); + + var sdkTracker = new SdkTracker(); + postBody = sdkTracker.insertDeveloperIdTracker(postBody, 'module:model/ReplayWebhooks', this.apiClient.merchantConfig.runEnvironment); var pathParams = { 'webhookId': webhookId @@ -305,6 +309,10 @@ throw new Error("Missing the required parameter 'saveAsymEgressKey' when calling saveAsymEgressKey"); } + var SdkTracker = require('../utilities/tracking/SdkTracker'); + + var sdkTracker = new SdkTracker(); + postBody = sdkTracker.insertDeveloperIdTracker(postBody, 'module:model/SaveAsymEgressKey', this.apiClient.merchantConfig.runEnvironment); var pathParams = { }; @@ -357,6 +365,10 @@ throw new Error("Missing the required parameter 'webhookId' when calling updateWebhookSubscription"); } + var SdkTracker = require('../utilities/tracking/SdkTracker'); + + var sdkTracker = new SdkTracker(); + postBody = sdkTracker.insertDeveloperIdTracker(postBody, 'module:model/UpdateWebhook', this.apiClient.merchantConfig.runEnvironment); var pathParams = { 'webhookId': webhookId diff --git a/src/api/MerchantBoardingApi.js b/src/api/MerchantBoardingApi.js index d71ecab3..6cf7c78b 100644 --- a/src/api/MerchantBoardingApi.js +++ b/src/api/MerchantBoardingApi.js @@ -128,6 +128,10 @@ throw new Error("Missing the required parameter 'postRegistrationBody' when calling postRegistration"); } + var SdkTracker = require('../utilities/tracking/SdkTracker'); + + var sdkTracker = new SdkTracker(); + postBody = sdkTracker.insertDeveloperIdTracker(postBody, 'module:model/PostRegistrationBody', this.apiClient.merchantConfig.runEnvironment); var pathParams = { };