diff --git a/Api/BatchesApi.cs b/Api/BatchesApi.cs index 2a8cb40d..07e81124 100644 --- a/Api/BatchesApi.cs +++ b/Api/BatchesApi.cs @@ -18,6 +18,7 @@ using NLog; using AuthenticationSdk.util; using CyberSource.Utilities.Tracking; +using AuthenticationSdk.core; namespace CyberSource.Api { @@ -420,6 +421,22 @@ public ApiResponse< InlineResponse2007 > GetBatchReportWithHttpInfo (string batc localVarPostBody = null; } + bool isMLESupportedByCybsForApi = false; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "GetBatchReport,GetBatchReportAsync,GetBatchReportWithHttpInfo,GetBatchReportAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + // make the HTTP request RestResponse localVarResponse = (RestResponse) Configuration.ApiClient.CallApi(localVarPath, @@ -515,6 +532,22 @@ public async System.Threading.Tasks.Task> GetBat localVarPostBody = null; } + bool isMLESupportedByCybsForApi = false; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "GetBatchReport,GetBatchReportAsync,GetBatchReportWithHttpInfo,GetBatchReportAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + // make the HTTP request RestResponse localVarResponse = (RestResponse)await Configuration.ApiClient.CallApiAsync(localVarPath, @@ -608,6 +641,22 @@ public ApiResponse< InlineResponse2006 > GetBatchStatusWithHttpInfo (string batc localVarPostBody = null; } + bool isMLESupportedByCybsForApi = false; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "GetBatchStatus,GetBatchStatusAsync,GetBatchStatusWithHttpInfo,GetBatchStatusAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + // make the HTTP request RestResponse localVarResponse = (RestResponse) Configuration.ApiClient.CallApi(localVarPath, @@ -703,6 +752,22 @@ public async System.Threading.Tasks.Task> GetBat localVarPostBody = null; } + bool isMLESupportedByCybsForApi = false; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "GetBatchStatus,GetBatchStatusAsync,GetBatchStatusWithHttpInfo,GetBatchStatusAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + // make the HTTP request RestResponse localVarResponse = (RestResponse)await Configuration.ApiClient.CallApiAsync(localVarPath, @@ -811,6 +876,22 @@ public ApiResponse< InlineResponse2005 > GetBatchesListWithHttpInfo (long? offse localVarPostBody = null; } + bool isMLESupportedByCybsForApi = false; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "GetBatchesList,GetBatchesListAsync,GetBatchesListWithHttpInfo,GetBatchesListAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + // make the HTTP request RestResponse localVarResponse = (RestResponse) Configuration.ApiClient.CallApi(localVarPath, @@ -921,6 +1002,22 @@ public async System.Threading.Tasks.Task> GetBat localVarPostBody = null; } + bool isMLESupportedByCybsForApi = false; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "GetBatchesList,GetBatchesListAsync,GetBatchesListWithHttpInfo,GetBatchesListAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + // make the HTTP request RestResponse localVarResponse = (RestResponse)await Configuration.ApiClient.CallApiAsync(localVarPath, @@ -1011,14 +1108,30 @@ public ApiResponse< InlineResponse202 > PostBatchWithHttpInfo (Body body) localVarPostBody = body; // byte array } - //if (logUtility.IsMaskingEnabled(logger)) - //{ - // logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); - //} - //else - //{ - // logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); - //} + + bool isMLESupportedByCybsForApi = false; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "PostBatch,PostBatchAsync,PostBatchWithHttpInfo,PostBatchAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + if (logUtility.IsMaskingEnabled(logger)) + { + logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); + } + else + { + logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); + } // make the HTTP request @@ -1112,14 +1225,29 @@ public async System.Threading.Tasks.Task> PostBat localVarPostBody = body; // byte array } - //if (logUtility.IsMaskingEnabled(logger)) - //{ - // logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); - //} - //else - //{ - // logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); - //} + bool isMLESupportedByCybsForApi = false; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "PostBatch,PostBatchAsync,PostBatchWithHttpInfo,PostBatchAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + if (logUtility.IsMaskingEnabled(logger)) + { + logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); + } + else + { + logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); + } // make the HTTP request diff --git a/Api/BillingAgreementsApi.cs b/Api/BillingAgreementsApi.cs index 1dcfe7a8..1edf6e5e 100644 --- a/Api/BillingAgreementsApi.cs +++ b/Api/BillingAgreementsApi.cs @@ -18,6 +18,7 @@ using NLog; using AuthenticationSdk.util; using CyberSource.Utilities.Tracking; +using AuthenticationSdk.core; namespace CyberSource.Api { @@ -384,14 +385,30 @@ public ApiResponse< PtsV2ModifyBillingAgreementPost201Response > BillingAgreemen localVarPostBody = modifyBillingAgreement; // byte array } - //if (logUtility.IsMaskingEnabled(logger)) - //{ - // logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); - //} - //else - //{ - // logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); - //} + + bool isMLESupportedByCybsForApi = true; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "BillingAgreementsDeRegistration,BillingAgreementsDeRegistrationAsync,BillingAgreementsDeRegistrationWithHttpInfo,BillingAgreementsDeRegistrationAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + if (logUtility.IsMaskingEnabled(logger)) + { + logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); + } + else + { + logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); + } // make the HTTP request @@ -498,14 +515,29 @@ public async System.Threading.Tasks.Task BillingAgreementsIntimationWi localVarPostBody = intimateBillingAgreement; // byte array } - //if (logUtility.IsMaskingEnabled(logger)) - //{ - // logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); - //} - //else - //{ - // logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); - //} + + bool isMLESupportedByCybsForApi = true; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "BillingAgreementsIntimation,BillingAgreementsIntimationAsync,BillingAgreementsIntimationWithHttpInfo,BillingAgreementsIntimationAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + if (logUtility.IsMaskingEnabled(logger)) + { + logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); + } + else + { + logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); + } // make the HTTP request @@ -724,14 +772,29 @@ public async System.Threading.Tasks.Task BillingAgreemen localVarPostBody = createBillingAgreement; // byte array } - //if (logUtility.IsMaskingEnabled(logger)) - //{ - // logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); - //} - //else - //{ - // logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); - //} + + bool isMLESupportedByCybsForApi = true; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "BillingAgreementsRegistration,BillingAgreementsRegistrationAsync,BillingAgreementsRegistrationWithHttpInfo,BillingAgreementsRegistrationAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + if (logUtility.IsMaskingEnabled(logger)) + { + logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); + } + else + { + logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); + } // make the HTTP request @@ -924,14 +1003,29 @@ public async System.Threading.Tasks.Task GetAccountInfoWithHttpInfo (CreateBinLo localVarPostBody = createBinLookupRequest; // byte array } - //if (logUtility.IsMaskingEnabled(logger)) - //{ - // logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); - //} - //else - //{ - // logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); - //} + + bool isMLESupportedByCybsForApi = false; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "GetAccountInfo,GetAccountInfoAsync,GetAccountInfoWithHttpInfo,GetAccountInfoAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + if (logUtility.IsMaskingEnabled(logger)) + { + logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); + } + else + { + logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); + } // make the HTTP request @@ -381,14 +398,29 @@ public async System.Threading.Tasks.Task> GetAcc localVarPostBody = createBinLookupRequest; // byte array } - //if (logUtility.IsMaskingEnabled(logger)) - //{ - // logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); - //} - //else - //{ - // logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); - //} + bool isMLESupportedByCybsForApi = false; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "GetAccountInfo,GetAccountInfoAsync,GetAccountInfoWithHttpInfo,GetAccountInfoAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + if (logUtility.IsMaskingEnabled(logger)) + { + logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); + } + else + { + logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); + } // make the HTTP request diff --git a/Api/CaptureApi.cs b/Api/CaptureApi.cs index 322aa3ab..63a7a74f 100644 --- a/Api/CaptureApi.cs +++ b/Api/CaptureApi.cs @@ -18,6 +18,7 @@ using NLog; using AuthenticationSdk.util; using CyberSource.Utilities.Tracking; +using AuthenticationSdk.core; namespace CyberSource.Api { @@ -284,7 +285,7 @@ public ApiResponse< PtsV2PaymentsCapturesPost201Response > CapturePaymentWithHtt { localVarPathParams.Add("id", Configuration.ApiClient.ParameterToString(id)); // path parameter } - //logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarPathParams)}"); + logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarPathParams)}"); if (capturePaymentRequest != null && capturePaymentRequest.GetType() != typeof(byte[])) { SdkTracker sdkTracker = new SdkTracker(); @@ -296,14 +297,30 @@ public ApiResponse< PtsV2PaymentsCapturesPost201Response > CapturePaymentWithHtt localVarPostBody = capturePaymentRequest; // byte array } - //if (logUtility.IsMaskingEnabled(logger)) - //{ - // logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); - //} - //else - //{ - // logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); - //} + + bool isMLESupportedByCybsForApi = true; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "CapturePayment,CapturePaymentAsync,CapturePaymentWithHttpInfo,CapturePaymentAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + if (logUtility.IsMaskingEnabled(logger)) + { + logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); + } + else + { + logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); + } // make the HTTP request @@ -398,7 +415,7 @@ public async System.Threading.Tasks.Task GetChargebackDe localVarPostBody = null; } + bool isMLESupportedByCybsForApi = false; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "GetChargebackDetails,GetChargebackDetailsAsync,GetChargebackDetailsWithHttpInfo,GetChargebackDetailsAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + // make the HTTP request RestResponse localVarResponse = (RestResponse) Configuration.ApiClient.CallApi(localVarPath, @@ -427,6 +444,22 @@ public async System.Threading.Tasks.Task GetChargeback localVarPostBody = null; } + bool isMLESupportedByCybsForApi = false; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "GetChargebackSummaries,GetChargebackSummariesAsync,GetChargebackSummariesWithHttpInfo,GetChargebackSummariesAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + // make the HTTP request RestResponse localVarResponse = (RestResponse) Configuration.ApiClient.CallApi(localVarPath, @@ -427,6 +444,22 @@ public async System.Threading.Tasks.Task GetConversionDe localVarPostBody = null; } + bool isMLESupportedByCybsForApi = false; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "GetConversionDetail,GetConversionDetailAsync,GetConversionDetailWithHttpInfo,GetConversionDetailAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + // make the HTTP request RestResponse localVarResponse = (RestResponse) Configuration.ApiClient.CallApi(localVarPath, @@ -427,6 +444,22 @@ public async System.Threading.Tasks.Task CreateWebhookSubscriptionWithHttpInfo ( localVarPostBody = createWebhookRequest; // byte array } - //if (logUtility.IsMaskingEnabled(logger)) - //{ - // logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); - //} - //else - //{ - // logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); - //} + + bool isMLESupportedByCybsForApi = false; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "CreateWebhookSubscription,CreateWebhookSubscriptionAsync,CreateWebhookSubscriptionWithHttpInfo,CreateWebhookSubscriptionAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + if (logUtility.IsMaskingEnabled(logger)) + { + logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); + } + else + { + logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); + } // make the HTTP request @@ -465,14 +482,29 @@ public async System.Threading.Tasks.Task> Create localVarPostBody = createWebhookRequest; // byte array } - //if (logUtility.IsMaskingEnabled(logger)) - //{ - // logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); - //} - //else - //{ - // logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); - //} + bool isMLESupportedByCybsForApi = false; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "CreateWebhookSubscription,CreateWebhookSubscriptionAsync,CreateWebhookSubscriptionWithHttpInfo,CreateWebhookSubscriptionAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + if (logUtility.IsMaskingEnabled(logger)) + { + logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); + } + else + { + logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); + } // make the HTTP request @@ -558,7 +590,7 @@ public ApiResponse< List > FindProductsToSubscribeWithHttpIn { localVarPathParams.Add("organizationId", Configuration.ApiClient.ParameterToString(organizationId)); // path parameter } - //logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarPathParams)}"); + logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarPathParams)}"); if (Method.Get == Method.Post) { localVarPostBody = "{}"; @@ -568,6 +600,22 @@ public ApiResponse< List > FindProductsToSubscribeWithHttpIn localVarPostBody = null; } + bool isMLESupportedByCybsForApi = false; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "FindProductsToSubscribe,FindProductsToSubscribeAsync,FindProductsToSubscribeWithHttpInfo,FindProductsToSubscribeAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + // make the HTTP request RestResponse localVarResponse = (RestResponse) Configuration.ApiClient.CallApi(localVarPath, @@ -653,7 +701,7 @@ public async System.Threading.Tasks.Task>> { localVarPathParams.Add("organizationId", Configuration.ApiClient.ParameterToString(organizationId)); // path parameter } - //logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarPathParams)}"); + logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarPathParams)}"); if (Method.Get == Method.Post) { localVarPostBody = "{}"; @@ -663,6 +711,22 @@ public async System.Threading.Tasks.Task>> localVarPostBody = null; } + bool isMLESupportedByCybsForApi = false; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "FindProductsToSubscribe,FindProductsToSubscribeAsync,FindProductsToSubscribeWithHttpInfo,FindProductsToSubscribeAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + // make the HTTP request RestResponse localVarResponse = (RestResponse)await Configuration.ApiClient.CallApiAsync(localVarPath, @@ -778,14 +842,30 @@ public ApiResponse< InlineResponse2013 > SaveSymEgressKeyWithHttpInfo (string vC localVarPostBody = saveSymEgressKey; // byte array } - //if (logUtility.IsMaskingEnabled(logger)) - //{ - // logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); - //} - //else - //{ - // logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); - //} + + bool isMLESupportedByCybsForApi = false; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "SaveSymEgressKey,SaveSymEgressKeyAsync,SaveSymEgressKeyWithHttpInfo,SaveSymEgressKeyAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + if (logUtility.IsMaskingEnabled(logger)) + { + logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); + } + else + { + logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); + } // make the HTTP request @@ -903,14 +983,29 @@ public async System.Threading.Tasks.Task> SaveSy localVarPostBody = saveSymEgressKey; // byte array } - //if (logUtility.IsMaskingEnabled(logger)) - //{ - // logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); - //} - //else - //{ - // logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); - //} + bool isMLESupportedByCybsForApi = false; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "SaveSymEgressKey,SaveSymEgressKeyAsync,SaveSymEgressKeyWithHttpInfo,SaveSymEgressKeyAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + if (logUtility.IsMaskingEnabled(logger)) + { + logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); + } + else + { + logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); + } // make the HTTP request diff --git a/Api/CreditApi.cs b/Api/CreditApi.cs index c9567838..6c1543af 100644 --- a/Api/CreditApi.cs +++ b/Api/CreditApi.cs @@ -18,6 +18,7 @@ using NLog; using AuthenticationSdk.util; using CyberSource.Utilities.Tracking; +using AuthenticationSdk.core; namespace CyberSource.Api { @@ -279,14 +280,30 @@ public ApiResponse< PtsV2CreditsPost201Response > CreateCreditWithHttpInfo (Crea localVarPostBody = createCreditRequest; // byte array } - //if (logUtility.IsMaskingEnabled(logger)) - //{ - // logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); - //} - //else - //{ - // logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); - //} + + bool isMLESupportedByCybsForApi = true; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "CreateCredit,CreateCreditAsync,CreateCreditWithHttpInfo,CreateCreditAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + if (logUtility.IsMaskingEnabled(logger)) + { + logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); + } + else + { + logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); + } // make the HTTP request @@ -380,14 +397,29 @@ public async System.Threading.Tasks.Task DeleteCustomerWithHttpInfo (string customerId, string { localVarPathParams.Add("customerId", Configuration.ApiClient.ParameterToString(customerId)); // path parameter } - //logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarPathParams)}"); + logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarPathParams)}"); if (profileId != null) { localVarHeaderParams.Add("profile-id", Configuration.ApiClient.ParameterToString(profileId)); // header parameter @@ -435,6 +436,22 @@ public ApiResponse DeleteCustomerWithHttpInfo (string customerId, string localVarPostBody = null; } + bool isMLESupportedByCybsForApi = false; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "DeleteCustomer,DeleteCustomerAsync,DeleteCustomerWithHttpInfo,DeleteCustomerAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + // make the HTTP request RestResponse localVarResponse = (RestResponse) Configuration.ApiClient.CallApi(localVarPath, @@ -520,7 +537,7 @@ public async System.Threading.Tasks.Task> DeleteCustomerAsyn { localVarPathParams.Add("customerId", Configuration.ApiClient.ParameterToString(customerId)); // path parameter } - //logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarPathParams)}"); + logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarPathParams)}"); if (profileId != null) { localVarHeaderParams.Add("profile-id", Configuration.ApiClient.ParameterToString(profileId)); // header parameter @@ -534,6 +551,22 @@ public async System.Threading.Tasks.Task> DeleteCustomerAsyn localVarPostBody = null; } + bool isMLESupportedByCybsForApi = false; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "DeleteCustomer,DeleteCustomerAsync,DeleteCustomerWithHttpInfo,DeleteCustomerAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + // make the HTTP request RestResponse localVarResponse = (RestResponse)await Configuration.ApiClient.CallApiAsync(localVarPath, @@ -620,7 +653,7 @@ public ApiResponse< PostCustomerRequest > GetCustomerWithHttpInfo (string custom { localVarPathParams.Add("customerId", Configuration.ApiClient.ParameterToString(customerId)); // path parameter } - //logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarPathParams)}"); + logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarPathParams)}"); if (profileId != null) { localVarHeaderParams.Add("profile-id", Configuration.ApiClient.ParameterToString(profileId)); // header parameter @@ -634,6 +667,22 @@ public ApiResponse< PostCustomerRequest > GetCustomerWithHttpInfo (string custom localVarPostBody = null; } + bool isMLESupportedByCybsForApi = false; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "GetCustomer,GetCustomerAsync,GetCustomerWithHttpInfo,GetCustomerAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + // make the HTTP request RestResponse localVarResponse = (RestResponse) Configuration.ApiClient.CallApi(localVarPath, @@ -721,7 +770,7 @@ public async System.Threading.Tasks.Task> GetCu { localVarPathParams.Add("customerId", Configuration.ApiClient.ParameterToString(customerId)); // path parameter } - //logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarPathParams)}"); + logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarPathParams)}"); if (profileId != null) { localVarHeaderParams.Add("profile-id", Configuration.ApiClient.ParameterToString(profileId)); // header parameter @@ -735,6 +784,22 @@ public async System.Threading.Tasks.Task> GetCu localVarPostBody = null; } + bool isMLESupportedByCybsForApi = false; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "GetCustomer,GetCustomerAsync,GetCustomerWithHttpInfo,GetCustomerAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + // make the HTTP request RestResponse localVarResponse = (RestResponse)await Configuration.ApiClient.CallApiAsync(localVarPath, @@ -830,7 +895,7 @@ public ApiResponse< PatchCustomerRequest > PatchCustomerWithHttpInfo (string cus { localVarPathParams.Add("customerId", Configuration.ApiClient.ParameterToString(customerId)); // path parameter } - //logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarPathParams)}"); + logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarPathParams)}"); if (profileId != null) { localVarHeaderParams.Add("profile-id", Configuration.ApiClient.ParameterToString(profileId)); // header parameter @@ -850,14 +915,30 @@ public ApiResponse< PatchCustomerRequest > PatchCustomerWithHttpInfo (string cus localVarPostBody = patchCustomerRequest; // byte array } - //if (logUtility.IsMaskingEnabled(logger)) - //{ - // logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); - //} - //else - //{ - // logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); - //} + + bool isMLESupportedByCybsForApi = false; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "PatchCustomer,PatchCustomerAsync,PatchCustomerWithHttpInfo,PatchCustomerAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + if (logUtility.IsMaskingEnabled(logger)) + { + logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); + } + else + { + logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); + } // make the HTTP request @@ -956,7 +1037,7 @@ public async System.Threading.Tasks.Task> Patc { localVarPathParams.Add("customerId", Configuration.ApiClient.ParameterToString(customerId)); // path parameter } - //logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarPathParams)}"); + logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarPathParams)}"); if (profileId != null) { localVarHeaderParams.Add("profile-id", Configuration.ApiClient.ParameterToString(profileId)); // header parameter @@ -976,14 +1057,29 @@ public async System.Threading.Tasks.Task> Patc localVarPostBody = patchCustomerRequest; // byte array } - //if (logUtility.IsMaskingEnabled(logger)) - //{ - // logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); - //} - //else - //{ - // logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); - //} + bool isMLESupportedByCybsForApi = false; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "PatchCustomer,PatchCustomerAsync,PatchCustomerWithHttpInfo,PatchCustomerAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + if (logUtility.IsMaskingEnabled(logger)) + { + logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); + } + else + { + logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); + } // make the HTTP request @@ -1081,14 +1177,30 @@ public ApiResponse< PostCustomerRequest > PostCustomerWithHttpInfo (PostCustomer localVarPostBody = postCustomerRequest; // byte array } - //if (logUtility.IsMaskingEnabled(logger)) - //{ - // logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); - //} - //else - //{ - // logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); - //} + + bool isMLESupportedByCybsForApi = false; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "PostCustomer,PostCustomerAsync,PostCustomerWithHttpInfo,PostCustomerAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + if (logUtility.IsMaskingEnabled(logger)) + { + logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); + } + else + { + logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); + } // make the HTTP request @@ -1188,14 +1300,29 @@ public async System.Threading.Tasks.Task> PostC localVarPostBody = postCustomerRequest; // byte array } - //if (logUtility.IsMaskingEnabled(logger)) - //{ - // logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); - //} - //else - //{ - // logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); - //} + bool isMLESupportedByCybsForApi = false; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "PostCustomer,PostCustomerAsync,PostCustomerWithHttpInfo,PostCustomerAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + if (logUtility.IsMaskingEnabled(logger)) + { + logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); + } + else + { + logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); + } // make the HTTP request diff --git a/Api/CustomerPaymentInstrumentApi.cs b/Api/CustomerPaymentInstrumentApi.cs index 56eb3123..028f1cd4 100644 --- a/Api/CustomerPaymentInstrumentApi.cs +++ b/Api/CustomerPaymentInstrumentApi.cs @@ -18,6 +18,7 @@ using NLog; using AuthenticationSdk.util; using CyberSource.Utilities.Tracking; +using AuthenticationSdk.core; namespace CyberSource.Api { @@ -503,8 +504,8 @@ public ApiResponse DeleteCustomerPaymentInstrumentWithHttpInfo (string c { localVarPathParams.Add("paymentInstrumentId", Configuration.ApiClient.ParameterToString(paymentInstrumentId)); // path parameter } - //logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarPathParams)}"); - //logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarPathParams)}"); + logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarPathParams)}"); + logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarPathParams)}"); if (profileId != null) { localVarHeaderParams.Add("profile-id", Configuration.ApiClient.ParameterToString(profileId)); // header parameter @@ -518,6 +519,22 @@ public ApiResponse DeleteCustomerPaymentInstrumentWithHttpInfo (string c localVarPostBody = null; } + bool isMLESupportedByCybsForApi = false; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "DeleteCustomerPaymentInstrument,DeleteCustomerPaymentInstrumentAsync,DeleteCustomerPaymentInstrumentWithHttpInfo,DeleteCustomerPaymentInstrumentAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + // make the HTTP request RestResponse localVarResponse = (RestResponse) Configuration.ApiClient.CallApi(localVarPath, @@ -615,8 +632,8 @@ public async System.Threading.Tasks.Task> DeleteCustomerPaym { localVarPathParams.Add("paymentInstrumentId", Configuration.ApiClient.ParameterToString(paymentInstrumentId)); // path parameter } - //logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarPathParams)}"); - //logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarPathParams)}"); + logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarPathParams)}"); + logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarPathParams)}"); if (profileId != null) { localVarHeaderParams.Add("profile-id", Configuration.ApiClient.ParameterToString(profileId)); // header parameter @@ -630,6 +647,22 @@ public async System.Threading.Tasks.Task> DeleteCustomerPaym localVarPostBody = null; } + bool isMLESupportedByCybsForApi = false; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "DeleteCustomerPaymentInstrument,DeleteCustomerPaymentInstrumentAsync,DeleteCustomerPaymentInstrumentWithHttpInfo,DeleteCustomerPaymentInstrumentAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + // make the HTTP request RestResponse localVarResponse = (RestResponse)await Configuration.ApiClient.CallApiAsync(localVarPath, @@ -728,8 +761,8 @@ public ApiResponse< PostCustomerPaymentInstrumentRequest > GetCustomerPaymentIns { localVarPathParams.Add("paymentInstrumentId", Configuration.ApiClient.ParameterToString(paymentInstrumentId)); // path parameter } - //logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarPathParams)}"); - //logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarPathParams)}"); + logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarPathParams)}"); + logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarPathParams)}"); if (profileId != null) { localVarHeaderParams.Add("profile-id", Configuration.ApiClient.ParameterToString(profileId)); // header parameter @@ -743,6 +776,22 @@ public ApiResponse< PostCustomerPaymentInstrumentRequest > GetCustomerPaymentIns localVarPostBody = null; } + bool isMLESupportedByCybsForApi = false; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "GetCustomerPaymentInstrument,GetCustomerPaymentInstrumentAsync,GetCustomerPaymentInstrumentWithHttpInfo,GetCustomerPaymentInstrumentAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + // make the HTTP request RestResponse localVarResponse = (RestResponse) Configuration.ApiClient.CallApi(localVarPath, @@ -842,8 +891,8 @@ public async System.Threading.Tasks.Task GetCustomerPaymentInstrumentsListWit { localVarPathParams.Add("customerId", Configuration.ApiClient.ParameterToString(customerId)); // path parameter } - //logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarPathParams)}"); + logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarPathParams)}"); if (offset != null) { localVarQueryParams.Add("offset", Configuration.ApiClient.ParameterToString(offset)); // query parameter @@ -955,8 +1020,8 @@ public ApiResponse< PaymentInstrumentList > GetCustomerPaymentInstrumentsListWit { localVarQueryParams.Add("limit", Configuration.ApiClient.ParameterToString(limit)); // query parameter } - //logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarQueryParams)}"); - //logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarQueryParams)}"); + logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarQueryParams)}"); + logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarQueryParams)}"); if (profileId != null) { localVarHeaderParams.Add("profile-id", Configuration.ApiClient.ParameterToString(profileId)); // header parameter @@ -970,6 +1035,22 @@ public ApiResponse< PaymentInstrumentList > GetCustomerPaymentInstrumentsListWit localVarPostBody = null; } + bool isMLESupportedByCybsForApi = false; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "GetCustomerPaymentInstrumentsList,GetCustomerPaymentInstrumentsListAsync,GetCustomerPaymentInstrumentsListWithHttpInfo,GetCustomerPaymentInstrumentsListAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + // make the HTTP request RestResponse localVarResponse = (RestResponse) Configuration.ApiClient.CallApi(localVarPath, @@ -1061,7 +1142,7 @@ public async System.Threading.Tasks.Task> Get { localVarPathParams.Add("customerId", Configuration.ApiClient.ParameterToString(customerId)); // path parameter } - //logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarPathParams)}"); + logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarPathParams)}"); if (offset != null) { localVarQueryParams.Add("offset", Configuration.ApiClient.ParameterToString(offset)); // query parameter @@ -1070,8 +1151,8 @@ public async System.Threading.Tasks.Task> Get { localVarQueryParams.Add("limit", Configuration.ApiClient.ParameterToString(limit)); // query parameter } - //logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarQueryParams)}"); - //logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarQueryParams)}"); + logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarQueryParams)}"); + logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarQueryParams)}"); if (profileId != null) { localVarHeaderParams.Add("profile-id", Configuration.ApiClient.ParameterToString(profileId)); // header parameter @@ -1085,6 +1166,22 @@ public async System.Threading.Tasks.Task> Get localVarPostBody = null; } + bool isMLESupportedByCybsForApi = false; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "GetCustomerPaymentInstrumentsList,GetCustomerPaymentInstrumentsListAsync,GetCustomerPaymentInstrumentsListWithHttpInfo,GetCustomerPaymentInstrumentsListAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + // make the HTTP request RestResponse localVarResponse = (RestResponse)await Configuration.ApiClient.CallApiAsync(localVarPath, @@ -1192,8 +1289,8 @@ public ApiResponse< PatchCustomerPaymentInstrumentRequest > PatchCustomersPaymen { localVarPathParams.Add("paymentInstrumentId", Configuration.ApiClient.ParameterToString(paymentInstrumentId)); // path parameter } - //logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarPathParams)}"); - //logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarPathParams)}"); + logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarPathParams)}"); + logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarPathParams)}"); if (profileId != null) { localVarHeaderParams.Add("profile-id", Configuration.ApiClient.ParameterToString(profileId)); // header parameter @@ -1213,14 +1310,30 @@ public ApiResponse< PatchCustomerPaymentInstrumentRequest > PatchCustomersPaymen localVarPostBody = patchCustomerPaymentInstrumentRequest; // byte array } - //if (logUtility.IsMaskingEnabled(logger)) - //{ - // logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); - //} - //else - //{ - // logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); - //} + + bool isMLESupportedByCybsForApi = false; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "PatchCustomersPaymentInstrument,PatchCustomersPaymentInstrumentAsync,PatchCustomersPaymentInstrumentWithHttpInfo,PatchCustomersPaymentInstrumentAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + if (logUtility.IsMaskingEnabled(logger)) + { + logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); + } + else + { + logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); + } // make the HTTP request @@ -1331,8 +1444,8 @@ public async System.Threading.Tasks.Task PostCustomerPaymentIn { localVarPathParams.Add("customerId", Configuration.ApiClient.ParameterToString(customerId)); // path parameter } - //logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarPathParams)}"); + logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarPathParams)}"); if (profileId != null) { localVarHeaderParams.Add("profile-id", Configuration.ApiClient.ParameterToString(profileId)); // header parameter @@ -1470,14 +1598,30 @@ public ApiResponse< PostCustomerPaymentInstrumentRequest > PostCustomerPaymentIn localVarPostBody = postCustomerPaymentInstrumentRequest; // byte array } - //if (logUtility.IsMaskingEnabled(logger)) - //{ - // logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); - //} - //else - //{ - // logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); - //} + + bool isMLESupportedByCybsForApi = false; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "PostCustomerPaymentInstrument,PostCustomerPaymentInstrumentAsync,PostCustomerPaymentInstrumentWithHttpInfo,PostCustomerPaymentInstrumentAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + if (logUtility.IsMaskingEnabled(logger)) + { + logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); + } + else + { + logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); + } // make the HTTP request @@ -1574,7 +1718,7 @@ public async System.Threading.Tasks.Task DeleteCustomerShippingAddressWithHttpInfo (string cus { localVarPathParams.Add("shippingAddressId", Configuration.ApiClient.ParameterToString(shippingAddressId)); // path parameter } - //logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarPathParams)}"); - //logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarPathParams)}"); + logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarPathParams)}"); + logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarPathParams)}"); if (profileId != null) { localVarHeaderParams.Add("profile-id", Configuration.ApiClient.ParameterToString(profileId)); // header parameter @@ -518,6 +519,22 @@ public ApiResponse DeleteCustomerShippingAddressWithHttpInfo (string cus localVarPostBody = null; } + bool isMLESupportedByCybsForApi = false; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "DeleteCustomerShippingAddress,DeleteCustomerShippingAddressAsync,DeleteCustomerShippingAddressWithHttpInfo,DeleteCustomerShippingAddressAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + // make the HTTP request RestResponse localVarResponse = (RestResponse) Configuration.ApiClient.CallApi(localVarPath, @@ -615,8 +632,8 @@ public async System.Threading.Tasks.Task> DeleteCustomerShip { localVarPathParams.Add("shippingAddressId", Configuration.ApiClient.ParameterToString(shippingAddressId)); // path parameter } - //logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarPathParams)}"); - //logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarPathParams)}"); + logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarPathParams)}"); + logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarPathParams)}"); if (profileId != null) { localVarHeaderParams.Add("profile-id", Configuration.ApiClient.ParameterToString(profileId)); // header parameter @@ -630,6 +647,22 @@ public async System.Threading.Tasks.Task> DeleteCustomerShip localVarPostBody = null; } + bool isMLESupportedByCybsForApi = false; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "DeleteCustomerShippingAddress,DeleteCustomerShippingAddressAsync,DeleteCustomerShippingAddressWithHttpInfo,DeleteCustomerShippingAddressAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + // make the HTTP request RestResponse localVarResponse = (RestResponse)await Configuration.ApiClient.CallApiAsync(localVarPath, @@ -728,8 +761,8 @@ public ApiResponse< PostCustomerShippingAddressRequest > GetCustomerShippingAddr { localVarPathParams.Add("shippingAddressId", Configuration.ApiClient.ParameterToString(shippingAddressId)); // path parameter } - //logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarPathParams)}"); - //logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarPathParams)}"); + logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarPathParams)}"); + logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarPathParams)}"); if (profileId != null) { localVarHeaderParams.Add("profile-id", Configuration.ApiClient.ParameterToString(profileId)); // header parameter @@ -743,6 +776,22 @@ public ApiResponse< PostCustomerShippingAddressRequest > GetCustomerShippingAddr localVarPostBody = null; } + bool isMLESupportedByCybsForApi = false; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "GetCustomerShippingAddress,GetCustomerShippingAddressAsync,GetCustomerShippingAddressWithHttpInfo,GetCustomerShippingAddressAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + // make the HTTP request RestResponse localVarResponse = (RestResponse) Configuration.ApiClient.CallApi(localVarPath, @@ -842,8 +891,8 @@ public async System.Threading.Tasks.Task GetCustomerShippingAddresse { localVarPathParams.Add("customerId", Configuration.ApiClient.ParameterToString(customerId)); // path parameter } - //logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarPathParams)}"); + logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarPathParams)}"); if (offset != null) { localVarQueryParams.Add("offset", Configuration.ApiClient.ParameterToString(offset)); // query parameter @@ -955,8 +1020,8 @@ public ApiResponse< ShippingAddressListForCustomer > GetCustomerShippingAddresse { localVarQueryParams.Add("limit", Configuration.ApiClient.ParameterToString(limit)); // query parameter } - //logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarQueryParams)}"); - //logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarQueryParams)}"); + logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarQueryParams)}"); + logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarQueryParams)}"); if (profileId != null) { localVarHeaderParams.Add("profile-id", Configuration.ApiClient.ParameterToString(profileId)); // header parameter @@ -970,6 +1035,22 @@ public ApiResponse< ShippingAddressListForCustomer > GetCustomerShippingAddresse localVarPostBody = null; } + bool isMLESupportedByCybsForApi = false; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "GetCustomerShippingAddressesList,GetCustomerShippingAddressesListAsync,GetCustomerShippingAddressesListWithHttpInfo,GetCustomerShippingAddressesListAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + // make the HTTP request RestResponse localVarResponse = (RestResponse) Configuration.ApiClient.CallApi(localVarPath, @@ -1061,7 +1142,7 @@ public async System.Threading.Tasks.Task PatchCustomersShipping { localVarPathParams.Add("shippingAddressId", Configuration.ApiClient.ParameterToString(shippingAddressId)); // path parameter } - //logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarPathParams)}"); - //logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarPathParams)}"); + logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarPathParams)}"); + logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarPathParams)}"); if (profileId != null) { localVarHeaderParams.Add("profile-id", Configuration.ApiClient.ParameterToString(profileId)); // header parameter @@ -1213,14 +1310,30 @@ public ApiResponse< PatchCustomerShippingAddressRequest > PatchCustomersShipping localVarPostBody = patchCustomerShippingAddressRequest; // byte array } - //if (logUtility.IsMaskingEnabled(logger)) - //{ - // logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); - //} - //else - //{ - // logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); - //} + + bool isMLESupportedByCybsForApi = false; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "PatchCustomersShippingAddress,PatchCustomersShippingAddressAsync,PatchCustomersShippingAddressWithHttpInfo,PatchCustomersShippingAddressAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + if (logUtility.IsMaskingEnabled(logger)) + { + logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); + } + else + { + logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); + } // make the HTTP request @@ -1331,8 +1444,8 @@ public async System.Threading.Tasks.Task PostCustomerShippingAdd { localVarPathParams.Add("customerId", Configuration.ApiClient.ParameterToString(customerId)); // path parameter } - //logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarPathParams)}"); + logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarPathParams)}"); if (profileId != null) { localVarHeaderParams.Add("profile-id", Configuration.ApiClient.ParameterToString(profileId)); // header parameter @@ -1470,14 +1598,30 @@ public ApiResponse< PostCustomerShippingAddressRequest > PostCustomerShippingAdd localVarPostBody = postCustomerShippingAddressRequest; // byte array } - //if (logUtility.IsMaskingEnabled(logger)) - //{ - // logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); - //} - //else - //{ - // logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); - //} + + bool isMLESupportedByCybsForApi = false; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "PostCustomerShippingAddress,PostCustomerShippingAddressAsync,PostCustomerShippingAddressWithHttpInfo,PostCustomerShippingAddressAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + if (logUtility.IsMaskingEnabled(logger)) + { + logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); + } + else + { + logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); + } // make the HTTP request @@ -1574,7 +1718,7 @@ public async System.Threading.Tasks.Task ActionDecisionManagerCaseWithHttpInfo (s { localVarPathParams.Add("id", Configuration.ApiClient.ParameterToString(id)); // path parameter } - //logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarPathParams)}"); + logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarPathParams)}"); if (caseManagementActionsRequest != null && caseManagementActionsRequest.GetType() != typeof(byte[])) { SdkTracker sdkTracker = new SdkTracker(); @@ -476,14 +477,30 @@ public ApiResponse< InlineResponse200 > ActionDecisionManagerCaseWithHttpInfo (s localVarPostBody = caseManagementActionsRequest; // byte array } - //if (logUtility.IsMaskingEnabled(logger)) - //{ - // logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); - //} - //else - //{ - // logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); - //} + + bool isMLESupportedByCybsForApi = false; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "ActionDecisionManagerCase,ActionDecisionManagerCaseAsync,ActionDecisionManagerCaseWithHttpInfo,ActionDecisionManagerCaseAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + if (logUtility.IsMaskingEnabled(logger)) + { + logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); + } + else + { + logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); + } // make the HTTP request @@ -578,7 +595,7 @@ public async System.Threading.Tasks.Task> ActionD { localVarPathParams.Add("id", Configuration.ApiClient.ParameterToString(id)); // path parameter } - //logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarPathParams)}"); + logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarPathParams)}"); if (caseManagementActionsRequest != null && caseManagementActionsRequest.GetType() != typeof(byte[])) { SdkTracker sdkTracker = new SdkTracker(); @@ -590,14 +607,29 @@ public async System.Threading.Tasks.Task> ActionD localVarPostBody = caseManagementActionsRequest; // byte array } - //if (logUtility.IsMaskingEnabled(logger)) - //{ - // logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); - //} - //else - //{ - // logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); - //} + bool isMLESupportedByCybsForApi = false; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "ActionDecisionManagerCase,ActionDecisionManagerCaseAsync,ActionDecisionManagerCaseWithHttpInfo,ActionDecisionManagerCaseAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + if (logUtility.IsMaskingEnabled(logger)) + { + logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); + } + else + { + logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); + } // make the HTTP request @@ -690,7 +722,7 @@ public ApiResponse< RiskV1UpdatePost201Response > AddNegativeWithHttpInfo (strin { localVarPathParams.Add("type", Configuration.ApiClient.ParameterToString(type)); // path parameter } - //logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarPathParams)}"); + logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarPathParams)}"); if (addNegativeListRequest != null && addNegativeListRequest.GetType() != typeof(byte[])) { SdkTracker sdkTracker = new SdkTracker(); @@ -702,14 +734,30 @@ public ApiResponse< RiskV1UpdatePost201Response > AddNegativeWithHttpInfo (strin localVarPostBody = addNegativeListRequest; // byte array } - //if (logUtility.IsMaskingEnabled(logger)) - //{ - // logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); - //} - //else - //{ - // logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); - //} + + bool isMLESupportedByCybsForApi = false; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "AddNegative,AddNegativeAsync,AddNegativeWithHttpInfo,AddNegativeAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + if (logUtility.IsMaskingEnabled(logger)) + { + logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); + } + else + { + logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); + } // make the HTTP request @@ -804,7 +852,7 @@ public async System.Threading.Tasks.Task CommentDecisionManagerCaseWithHttpInfo ( { localVarPathParams.Add("id", Configuration.ApiClient.ParameterToString(id)); // path parameter } - //logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarPathParams)}"); + logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarPathParams)}"); if (caseManagementCommentsRequest != null && caseManagementCommentsRequest.GetType() != typeof(byte[])) { SdkTracker sdkTracker = new SdkTracker(); @@ -928,14 +991,30 @@ public ApiResponse< InlineResponse201 > CommentDecisionManagerCaseWithHttpInfo ( localVarPostBody = caseManagementCommentsRequest; // byte array } - //if (logUtility.IsMaskingEnabled(logger)) - //{ - // logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); - //} - //else - //{ - // logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); - //} + + bool isMLESupportedByCybsForApi = false; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "CommentDecisionManagerCase,CommentDecisionManagerCaseAsync,CommentDecisionManagerCaseWithHttpInfo,CommentDecisionManagerCaseAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + if (logUtility.IsMaskingEnabled(logger)) + { + logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); + } + else + { + logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); + } // make the HTTP request @@ -1030,7 +1109,7 @@ public async System.Threading.Tasks.Task> Comment { localVarPathParams.Add("id", Configuration.ApiClient.ParameterToString(id)); // path parameter } - //logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarPathParams)}"); + logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarPathParams)}"); if (caseManagementCommentsRequest != null && caseManagementCommentsRequest.GetType() != typeof(byte[])) { SdkTracker sdkTracker = new SdkTracker(); @@ -1042,14 +1121,29 @@ public async System.Threading.Tasks.Task> Comment localVarPostBody = caseManagementCommentsRequest; // byte array } - //if (logUtility.IsMaskingEnabled(logger)) - //{ - // logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); - //} - //else - //{ - // logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); - //} + bool isMLESupportedByCybsForApi = false; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "CommentDecisionManagerCase,CommentDecisionManagerCaseAsync,CommentDecisionManagerCaseWithHttpInfo,CommentDecisionManagerCaseAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + if (logUtility.IsMaskingEnabled(logger)) + { + logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); + } + else + { + logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); + } // make the HTTP request @@ -1141,14 +1235,30 @@ public ApiResponse< RiskV1DecisionsPost201Response > CreateBundledDecisionManage localVarPostBody = createBundledDecisionManagerCaseRequest; // byte array } - //if (logUtility.IsMaskingEnabled(logger)) - //{ - // logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); - //} - //else - //{ - // logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); - //} + + bool isMLESupportedByCybsForApi = false; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "CreateBundledDecisionManagerCase,CreateBundledDecisionManagerCaseAsync,CreateBundledDecisionManagerCaseWithHttpInfo,CreateBundledDecisionManagerCaseAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + if (logUtility.IsMaskingEnabled(logger)) + { + logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); + } + else + { + logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); + } // make the HTTP request @@ -1242,14 +1352,29 @@ public async System.Threading.Tasks.Task FraudUpdateWithHttpInfo (strin { localVarPathParams.Add("id", Configuration.ApiClient.ParameterToString(id)); // path parameter } - //logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarPathParams)}"); + logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarPathParams)}"); if (fraudMarkingActionRequest != null && fraudMarkingActionRequest.GetType() != typeof(byte[])) { SdkTracker sdkTracker = new SdkTracker(); @@ -1354,14 +1479,30 @@ public ApiResponse< RiskV1UpdatePost201Response > FraudUpdateWithHttpInfo (strin localVarPostBody = fraudMarkingActionRequest; // byte array } - //if (logUtility.IsMaskingEnabled(logger)) - //{ - // logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); - //} - //else - //{ - // logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); - //} + + bool isMLESupportedByCybsForApi = false; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "FraudUpdate,FraudUpdateAsync,FraudUpdateWithHttpInfo,FraudUpdateAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + if (logUtility.IsMaskingEnabled(logger)) + { + logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); + } + else + { + logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); + } // make the HTTP request @@ -1456,7 +1597,7 @@ public async System.Threading.Tasks.Task GetDTDV2WithHttpInfo (string reportDefinitionNameVers localVarPostBody = null; } + bool isMLESupportedByCybsForApi = false; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "GetDTDV2,GetDTDV2Async,GetDTDV2WithHttpInfo,GetDTDV2AsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + // make the HTTP request RestResponse localVarResponse = (RestResponse) Configuration.ApiClient.CallApi(localVarPath, @@ -371,6 +388,22 @@ public async System.Threading.Tasks.Task> GetDTDV2AsyncWithH localVarPostBody = null; } + bool isMLESupportedByCybsForApi = false; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "GetDTDV2,GetDTDV2Async,GetDTDV2WithHttpInfo,GetDTDV2AsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + // make the HTTP request RestResponse localVarResponse = (RestResponse)await Configuration.ApiClient.CallApiAsync(localVarPath, diff --git a/Api/DownloadXSDApi.cs b/Api/DownloadXSDApi.cs index c327fe4e..2aaae5ed 100644 --- a/Api/DownloadXSDApi.cs +++ b/Api/DownloadXSDApi.cs @@ -17,6 +17,7 @@ using NLog; using AuthenticationSdk.util; using CyberSource.Utilities.Tracking; +using AuthenticationSdk.core; namespace CyberSource.Api { @@ -278,6 +279,22 @@ public ApiResponse GetXSDV2WithHttpInfo (string reportDefinitionNameVers localVarPostBody = null; } + bool isMLESupportedByCybsForApi = false; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "GetXSDV2,GetXSDV2Async,GetXSDV2WithHttpInfo,GetXSDV2AsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + // make the HTTP request RestResponse localVarResponse = (RestResponse) Configuration.ApiClient.CallApi(localVarPath, @@ -371,6 +388,22 @@ public async System.Threading.Tasks.Task> GetXSDV2AsyncWithH localVarPostBody = null; } + bool isMLESupportedByCybsForApi = false; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "GetXSDV2,GetXSDV2Async,GetXSDV2WithHttpInfo,GetXSDV2AsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + // make the HTTP request RestResponse localVarResponse = (RestResponse)await Configuration.ApiClient.CallApiAsync(localVarPath, diff --git a/Api/EMVTagDetailsApi.cs b/Api/EMVTagDetailsApi.cs index 275f9f93..47102019 100644 --- a/Api/EMVTagDetailsApi.cs +++ b/Api/EMVTagDetailsApi.cs @@ -18,6 +18,7 @@ using NLog; using AuthenticationSdk.util; using CyberSource.Utilities.Tracking; +using AuthenticationSdk.core; namespace CyberSource.Api { @@ -307,6 +308,22 @@ public ApiResponse< TssV2GetEmvTags200Response > GetEmvTagsWithHttpInfo () localVarPostBody = null; } + bool isMLESupportedByCybsForApi = false; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "GetEmvTags,GetEmvTagsAsync,GetEmvTagsWithHttpInfo,GetEmvTagsAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + // make the HTTP request RestResponse localVarResponse = (RestResponse) Configuration.ApiClient.CallApi(localVarPath, @@ -389,6 +406,22 @@ public async System.Threading.Tasks.Task localVarPostBody = null; } + bool isMLESupportedByCybsForApi = false; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "GetEmvTags,GetEmvTagsAsync,GetEmvTagsWithHttpInfo,GetEmvTagsAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + // make the HTTP request RestResponse localVarResponse = (RestResponse)await Configuration.ApiClient.CallApiAsync(localVarPath, @@ -479,14 +512,30 @@ public ApiResponse< TssV2PostEmvTags200Response > ParseEmvTagsWithHttpInfo (Body localVarPostBody = body; // byte array } - //if (logUtility.IsMaskingEnabled(logger)) - //{ - // logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); - //} - //else - //{ - // logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); - //} + + bool isMLESupportedByCybsForApi = false; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "ParseEmvTags,ParseEmvTagsAsync,ParseEmvTagsWithHttpInfo,ParseEmvTagsAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + if (logUtility.IsMaskingEnabled(logger)) + { + logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); + } + else + { + logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); + } // make the HTTP request @@ -580,14 +629,29 @@ public async System.Threading.Tasks.Task GenerateFlexAPICaptureContextWithHttpInfo (Generate localVarPostBody = generateFlexAPICaptureContextRequest; // byte array } - //if (logUtility.IsMaskingEnabled(logger)) - //{ - // logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); - //} - //else - //{ - // logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); - //} + + bool isMLESupportedByCybsForApi = false; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "GenerateFlexAPICaptureContext,GenerateFlexAPICaptureContextAsync,GenerateFlexAPICaptureContextWithHttpInfo,GenerateFlexAPICaptureContextAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + if (logUtility.IsMaskingEnabled(logger)) + { + logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); + } + else + { + logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); + } // make the HTTP request @@ -380,14 +397,29 @@ public async System.Threading.Tasks.Task> GenerateFlexAPICap localVarPostBody = generateFlexAPICaptureContextRequest; // byte array } - //if (logUtility.IsMaskingEnabled(logger)) - //{ - // logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); - //} - //else - //{ - // logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); - //} + bool isMLESupportedByCybsForApi = false; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "GenerateFlexAPICaptureContext,GenerateFlexAPICaptureContextAsync,GenerateFlexAPICaptureContextWithHttpInfo,GenerateFlexAPICaptureContextAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + if (logUtility.IsMaskingEnabled(logger)) + { + logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); + } + else + { + logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); + } // make the HTTP request diff --git a/Api/InstrumentIdentifierApi.cs b/Api/InstrumentIdentifierApi.cs index 132f7a47..8b7a3254 100644 --- a/Api/InstrumentIdentifierApi.cs +++ b/Api/InstrumentIdentifierApi.cs @@ -18,6 +18,7 @@ using NLog; using AuthenticationSdk.util; using CyberSource.Utilities.Tracking; +using AuthenticationSdk.core; namespace CyberSource.Api { @@ -541,7 +542,7 @@ public ApiResponse DeleteInstrumentIdentifierWithHttpInfo (string instru { localVarPathParams.Add("instrumentIdentifierId", Configuration.ApiClient.ParameterToString(instrumentIdentifierId)); // path parameter } - //logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarPathParams)}"); + logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarPathParams)}"); if (profileId != null) { localVarHeaderParams.Add("profile-id", Configuration.ApiClient.ParameterToString(profileId)); // header parameter @@ -555,6 +556,22 @@ public ApiResponse DeleteInstrumentIdentifierWithHttpInfo (string instru localVarPostBody = null; } + bool isMLESupportedByCybsForApi = false; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "DeleteInstrumentIdentifier,DeleteInstrumentIdentifierAsync,DeleteInstrumentIdentifierWithHttpInfo,DeleteInstrumentIdentifierAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + // make the HTTP request RestResponse localVarResponse = (RestResponse) Configuration.ApiClient.CallApi(localVarPath, @@ -640,7 +657,7 @@ public async System.Threading.Tasks.Task> DeleteInstrumentId { localVarPathParams.Add("instrumentIdentifierId", Configuration.ApiClient.ParameterToString(instrumentIdentifierId)); // path parameter } - //logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarPathParams)}"); + logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarPathParams)}"); if (profileId != null) { localVarHeaderParams.Add("profile-id", Configuration.ApiClient.ParameterToString(profileId)); // header parameter @@ -654,6 +671,22 @@ public async System.Threading.Tasks.Task> DeleteInstrumentId localVarPostBody = null; } + bool isMLESupportedByCybsForApi = false; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "DeleteInstrumentIdentifier,DeleteInstrumentIdentifierAsync,DeleteInstrumentIdentifierWithHttpInfo,DeleteInstrumentIdentifierAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + // make the HTTP request RestResponse localVarResponse = (RestResponse)await Configuration.ApiClient.CallApiAsync(localVarPath, @@ -742,12 +775,12 @@ public ApiResponse< PostInstrumentIdentifierRequest > GetInstrumentIdentifierWit { localVarPathParams.Add("instrumentIdentifierId", Configuration.ApiClient.ParameterToString(instrumentIdentifierId)); // path parameter } - //logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarPathParams)}"); + logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarPathParams)}"); if (retrieveBinDetails != null) { localVarQueryParams.Add("retrieveBinDetails", Configuration.ApiClient.ParameterToString(retrieveBinDetails)); // query parameter } - //logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarQueryParams)}"); + logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarQueryParams)}"); if (profileId != null) { localVarHeaderParams.Add("profile-id", Configuration.ApiClient.ParameterToString(profileId)); // header parameter @@ -761,6 +794,22 @@ public ApiResponse< PostInstrumentIdentifierRequest > GetInstrumentIdentifierWit localVarPostBody = null; } + bool isMLESupportedByCybsForApi = false; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "GetInstrumentIdentifier,GetInstrumentIdentifierAsync,GetInstrumentIdentifierWithHttpInfo,GetInstrumentIdentifierAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + // make the HTTP request RestResponse localVarResponse = (RestResponse) Configuration.ApiClient.CallApi(localVarPath, @@ -850,12 +899,12 @@ public async System.Threading.Tasks.Task GetInstrumentIdentifierPaymentInstr { localVarPathParams.Add("instrumentIdentifierId", Configuration.ApiClient.ParameterToString(instrumentIdentifierId)); // path parameter } - //logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarPathParams)}"); + logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarPathParams)}"); if (retrieveBinDetails != null) { localVarQueryParams.Add("retrieveBinDetails", Configuration.ApiClient.ParameterToString(retrieveBinDetails)); // query parameter @@ -973,9 +1038,9 @@ public ApiResponse< PaymentInstrumentList1 > GetInstrumentIdentifierPaymentInstr { localVarQueryParams.Add("limit", Configuration.ApiClient.ParameterToString(limit)); // query parameter } - //logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarQueryParams)}"); - //logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarQueryParams)}"); - //logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarQueryParams)}"); + logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarQueryParams)}"); + logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarQueryParams)}"); + logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarQueryParams)}"); if (profileId != null) { localVarHeaderParams.Add("profile-id", Configuration.ApiClient.ParameterToString(profileId)); // header parameter @@ -989,6 +1054,22 @@ public ApiResponse< PaymentInstrumentList1 > GetInstrumentIdentifierPaymentInstr localVarPostBody = null; } + bool isMLESupportedByCybsForApi = false; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "GetInstrumentIdentifierPaymentInstrumentsList,GetInstrumentIdentifierPaymentInstrumentsListAsync,GetInstrumentIdentifierPaymentInstrumentsListWithHttpInfo,GetInstrumentIdentifierPaymentInstrumentsListAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + // make the HTTP request RestResponse localVarResponse = (RestResponse) Configuration.ApiClient.CallApi(localVarPath, @@ -1082,7 +1163,7 @@ public async System.Threading.Tasks.Task> Ge { localVarPathParams.Add("instrumentIdentifierId", Configuration.ApiClient.ParameterToString(instrumentIdentifierId)); // path parameter } - //logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarPathParams)}"); + logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarPathParams)}"); if (retrieveBinDetails != null) { localVarQueryParams.Add("retrieveBinDetails", Configuration.ApiClient.ParameterToString(retrieveBinDetails)); // query parameter @@ -1095,9 +1176,9 @@ public async System.Threading.Tasks.Task> Ge { localVarQueryParams.Add("limit", Configuration.ApiClient.ParameterToString(limit)); // query parameter } - //logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarQueryParams)}"); - //logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarQueryParams)}"); - //logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarQueryParams)}"); + logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarQueryParams)}"); + logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarQueryParams)}"); + logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarQueryParams)}"); if (profileId != null) { localVarHeaderParams.Add("profile-id", Configuration.ApiClient.ParameterToString(profileId)); // header parameter @@ -1111,6 +1192,22 @@ public async System.Threading.Tasks.Task> Ge localVarPostBody = null; } + bool isMLESupportedByCybsForApi = false; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "GetInstrumentIdentifierPaymentInstrumentsList,GetInstrumentIdentifierPaymentInstrumentsListAsync,GetInstrumentIdentifierPaymentInstrumentsListWithHttpInfo,GetInstrumentIdentifierPaymentInstrumentsListAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + // make the HTTP request RestResponse localVarResponse = (RestResponse)await Configuration.ApiClient.CallApiAsync(localVarPath, @@ -1208,12 +1305,12 @@ public ApiResponse< PatchInstrumentIdentifierRequest > PatchInstrumentIdentifier { localVarPathParams.Add("instrumentIdentifierId", Configuration.ApiClient.ParameterToString(instrumentIdentifierId)); // path parameter } - //logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarPathParams)}"); + logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarPathParams)}"); if (retrieveBinDetails != null) { localVarQueryParams.Add("retrieveBinDetails", Configuration.ApiClient.ParameterToString(retrieveBinDetails)); // query parameter } - //logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarQueryParams)}"); + logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarQueryParams)}"); if (profileId != null) { localVarHeaderParams.Add("profile-id", Configuration.ApiClient.ParameterToString(profileId)); // header parameter @@ -1233,14 +1330,30 @@ public ApiResponse< PatchInstrumentIdentifierRequest > PatchInstrumentIdentifier localVarPostBody = patchInstrumentIdentifierRequest; // byte array } - //if (logUtility.IsMaskingEnabled(logger)) - //{ - // logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); - //} - //else - //{ - // logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); - //} + + bool isMLESupportedByCybsForApi = false; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "PatchInstrumentIdentifier,PatchInstrumentIdentifierAsync,PatchInstrumentIdentifierWithHttpInfo,PatchInstrumentIdentifierAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + if (logUtility.IsMaskingEnabled(logger)) + { + logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); + } + else + { + logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); + } // make the HTTP request @@ -1341,12 +1454,12 @@ public async System.Threading.Tasks.Task PostInstrumentIdentifierWi { localVarQueryParams.Add("retrieveBinDetails", Configuration.ApiClient.ParameterToString(retrieveBinDetails)); // query parameter } - //logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarQueryParams)}"); + logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarQueryParams)}"); if (profileId != null) { localVarHeaderParams.Add("profile-id", Configuration.ApiClient.ParameterToString(profileId)); // header parameter @@ -1478,14 +1606,30 @@ public ApiResponse< PostInstrumentIdentifierRequest > PostInstrumentIdentifierWi localVarPostBody = postInstrumentIdentifierRequest; // byte array } - //if (logUtility.IsMaskingEnabled(logger)) - //{ - // logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); - //} - //else - //{ - // logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); - //} + + bool isMLESupportedByCybsForApi = false; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "PostInstrumentIdentifier,PostInstrumentIdentifierAsync,PostInstrumentIdentifierWithHttpInfo,PostInstrumentIdentifierAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + if (logUtility.IsMaskingEnabled(logger)) + { + logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); + } + else + { + logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); + } // make the HTTP request @@ -1576,7 +1720,7 @@ public async System.Threading.Tasks.Task PostInstrumentIdentifierEnrollmentWithHttpInfo (strin { localVarPathParams.Add("instrumentIdentifierId", Configuration.ApiClient.ParameterToString(instrumentIdentifierId)); // path parameter } - //logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarPathParams)}"); + logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarPathParams)}"); if (profileId != null) { localVarHeaderParams.Add("profile-id", Configuration.ApiClient.ParameterToString(profileId)); // header parameter @@ -1707,14 +1866,30 @@ public ApiResponse PostInstrumentIdentifierEnrollmentWithHttpInfo (strin localVarPostBody = postInstrumentIdentifierEnrollmentRequest; // byte array } - //if (logUtility.IsMaskingEnabled(logger)) - //{ - // logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); - //} - //else - //{ - // logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); - //} + + bool isMLESupportedByCybsForApi = false; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "PostInstrumentIdentifierEnrollment,PostInstrumentIdentifierEnrollmentAsync,PostInstrumentIdentifierEnrollmentWithHttpInfo,PostInstrumentIdentifierEnrollmentAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + if (logUtility.IsMaskingEnabled(logger)) + { + logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); + } + else + { + logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); + } // make the HTTP request @@ -1809,7 +1984,7 @@ public async System.Threading.Tasks.Task> PostInstrumentIden { localVarPathParams.Add("instrumentIdentifierId", Configuration.ApiClient.ParameterToString(instrumentIdentifierId)); // path parameter } - //logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarPathParams)}"); + logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarPathParams)}"); if (profileId != null) { localVarHeaderParams.Add("profile-id", Configuration.ApiClient.ParameterToString(profileId)); // header parameter @@ -1825,14 +2000,29 @@ public async System.Threading.Tasks.Task> PostInstrumentIden localVarPostBody = postInstrumentIdentifierEnrollmentRequest; // byte array } - //if (logUtility.IsMaskingEnabled(logger)) - //{ - // logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); - //} - //else - //{ - // logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); - //} + bool isMLESupportedByCybsForApi = false; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "PostInstrumentIdentifierEnrollment,PostInstrumentIdentifierEnrollmentAsync,PostInstrumentIdentifierEnrollmentWithHttpInfo,PostInstrumentIdentifierEnrollmentAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + if (logUtility.IsMaskingEnabled(logger)) + { + logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); + } + else + { + logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); + } // make the HTTP request diff --git a/Api/InterchangeClearingLevelDetailsApi.cs b/Api/InterchangeClearingLevelDetailsApi.cs index 269f9190..7c21d7bd 100644 --- a/Api/InterchangeClearingLevelDetailsApi.cs +++ b/Api/InterchangeClearingLevelDetailsApi.cs @@ -18,6 +18,7 @@ using NLog; using AuthenticationSdk.util; using CyberSource.Utilities.Tracking; +using AuthenticationSdk.core; namespace CyberSource.Api { @@ -311,6 +312,22 @@ public ApiResponse< ReportingV3InterchangeClearingLevelDetailsGet200Response > G localVarPostBody = null; } + bool isMLESupportedByCybsForApi = false; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "GetInterchangeClearingLevelDetails,GetInterchangeClearingLevelDetailsAsync,GetInterchangeClearingLevelDetailsWithHttpInfo,GetInterchangeClearingLevelDetailsAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + // make the HTTP request RestResponse localVarResponse = (RestResponse) Configuration.ApiClient.CallApi(localVarPath, @@ -427,6 +444,22 @@ public async System.Threading.Tasks.Task GetInvoiceSetting localVarPostBody = null; } + bool isMLESupportedByCybsForApi = false; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "GetInvoiceSettings,GetInvoiceSettingsAsync,GetInvoiceSettingsWithHttpInfo,GetInvoiceSettingsAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + // make the HTTP request RestResponse localVarResponse = (RestResponse) Configuration.ApiClient.CallApi(localVarPath, @@ -395,6 +412,22 @@ public async System.Threading.Tasks.Task UpdateInvoiceSett localVarPostBody = invoiceSettingsRequest; // byte array } - //if (logUtility.IsMaskingEnabled(logger)) - //{ - // logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); - //} - //else - //{ - // logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); - //} + + bool isMLESupportedByCybsForApi = false; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "UpdateInvoiceSettings,UpdateInvoiceSettingsAsync,UpdateInvoiceSettingsWithHttpInfo,UpdateInvoiceSettingsAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + if (logUtility.IsMaskingEnabled(logger)) + { + logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); + } + else + { + logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); + } // make the HTTP request @@ -592,14 +641,29 @@ public async System.Threading.Tasks.Task CreateInvoiceWithHttpIn localVarPostBody = createInvoiceRequest; // byte array } - //if (logUtility.IsMaskingEnabled(logger)) - //{ - // logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); - //} - //else - //{ - // logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); - //} + + bool isMLESupportedByCybsForApi = false; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "CreateInvoice,CreateInvoiceAsync,CreateInvoiceWithHttpInfo,CreateInvoiceAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + if (logUtility.IsMaskingEnabled(logger)) + { + logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); + } + else + { + logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); + } // make the HTTP request @@ -608,14 +625,29 @@ public async System.Threading.Tasks.Task GetAllInvoicesWithHtt { localVarQueryParams.Add("status", Configuration.ApiClient.ParameterToString(status)); // query parameter } - //logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarQueryParams)}"); - //logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarQueryParams)}"); - //logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarQueryParams)}"); + logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarQueryParams)}"); + logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarQueryParams)}"); + logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarQueryParams)}"); if (Method.Get == Method.Post) { localVarPostBody = "{}"; @@ -733,6 +765,22 @@ public ApiResponse< InvoicingV2InvoicesAllGet200Response > GetAllInvoicesWithHtt localVarPostBody = null; } + bool isMLESupportedByCybsForApi = false; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "GetAllInvoices,GetAllInvoicesAsync,GetAllInvoicesWithHttpInfo,GetAllInvoicesAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + // make the HTTP request RestResponse localVarResponse = (RestResponse) Configuration.ApiClient.CallApi(localVarPath, @@ -839,9 +887,9 @@ public async System.Threading.Tasks.Task GetInvoiceWithHttpInfo ( { localVarPathParams.Add("id", Configuration.ApiClient.ParameterToString(id)); // path parameter } - //logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarPathParams)}"); + logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarPathParams)}"); if (Method.Get == Method.Post) { localVarPostBody = "{}"; @@ -947,6 +1011,22 @@ public ApiResponse< InvoicingV2InvoicesGet200Response > GetInvoiceWithHttpInfo ( localVarPostBody = null; } + bool isMLESupportedByCybsForApi = false; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "GetInvoice,GetInvoiceAsync,GetInvoiceWithHttpInfo,GetInvoiceAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + // make the HTTP request RestResponse localVarResponse = (RestResponse) Configuration.ApiClient.CallApi(localVarPath, @@ -1035,7 +1115,7 @@ public async System.Threading.Tasks.Task PerformCancelActionWith { localVarPathParams.Add("id", Configuration.ApiClient.ParameterToString(id)); // path parameter } - //logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarPathParams)}"); + logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarPathParams)}"); if (Method.Post == Method.Post) { localVarPostBody = "{}"; @@ -1141,6 +1237,22 @@ public ApiResponse< InvoicingV2InvoicesPost201Response > PerformCancelActionWith localVarPostBody = null; } + bool isMLESupportedByCybsForApi = false; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "PerformCancelAction,PerformCancelActionAsync,PerformCancelActionWithHttpInfo,PerformCancelActionAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + // make the HTTP request RestResponse localVarResponse = (RestResponse) Configuration.ApiClient.CallApi(localVarPath, @@ -1229,7 +1341,7 @@ public async System.Threading.Tasks.Task PerformSendActionWithHt { localVarPathParams.Add("id", Configuration.ApiClient.ParameterToString(id)); // path parameter } - //logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarPathParams)}"); + logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarPathParams)}"); if (Method.Post == Method.Post) { localVarPostBody = "{}"; @@ -1335,6 +1463,22 @@ public ApiResponse< InvoicingV2InvoicesPost201Response > PerformSendActionWithHt localVarPostBody = null; } + bool isMLESupportedByCybsForApi = false; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "PerformSendAction,PerformSendActionAsync,PerformSendActionWithHttpInfo,PerformSendActionAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + // make the HTTP request RestResponse localVarResponse = (RestResponse) Configuration.ApiClient.CallApi(localVarPath, @@ -1423,7 +1567,7 @@ public async System.Threading.Tasks.Task UpdateInvoiceWithHttpIn { localVarPathParams.Add("id", Configuration.ApiClient.ParameterToString(id)); // path parameter } - //logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarPathParams)}"); + logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarPathParams)}"); if (updateInvoiceRequest != null && updateInvoiceRequest.GetType() != typeof(byte[])) { SdkTracker sdkTracker = new SdkTracker(); @@ -1539,14 +1699,30 @@ public ApiResponse< InvoicingV2InvoicesPost201Response > UpdateInvoiceWithHttpIn localVarPostBody = updateInvoiceRequest; // byte array } - //if (logUtility.IsMaskingEnabled(logger)) - //{ - // logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); - //} - //else - //{ - // logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); - //} + + bool isMLESupportedByCybsForApi = false; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "UpdateInvoice,UpdateInvoiceAsync,UpdateInvoiceWithHttpInfo,UpdateInvoiceAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + if (logUtility.IsMaskingEnabled(logger)) + { + logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); + } + else + { + logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); + } // make the HTTP request @@ -1644,7 +1820,7 @@ public async System.Threading.Tasks.Task DeleteWebhookSubscriptionWithHttpInfo (string webhook { localVarPathParams.Add("webhookId", Configuration.ApiClient.ParameterToString(webhookId)); // path parameter } - //logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarPathParams)}"); + logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarPathParams)}"); if (Method.Delete == Method.Post) { localVarPostBody = "{}"; @@ -472,6 +473,22 @@ public ApiResponse DeleteWebhookSubscriptionWithHttpInfo (string webhook localVarPostBody = null; } + bool isMLESupportedByCybsForApi = false; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "DeleteWebhookSubscription,DeleteWebhookSubscriptionAsync,DeleteWebhookSubscriptionWithHttpInfo,DeleteWebhookSubscriptionAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + // make the HTTP request RestResponse localVarResponse = (RestResponse) Configuration.ApiClient.CallApi(localVarPath, @@ -555,7 +572,7 @@ public async System.Threading.Tasks.Task> DeleteWebhookSubsc { localVarPathParams.Add("webhookId", Configuration.ApiClient.ParameterToString(webhookId)); // path parameter } - //logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarPathParams)}"); + logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarPathParams)}"); if (Method.Delete == Method.Post) { localVarPostBody = "{}"; @@ -565,6 +582,22 @@ public async System.Threading.Tasks.Task> DeleteWebhookSubsc localVarPostBody = null; } + bool isMLESupportedByCybsForApi = false; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "DeleteWebhookSubscription,DeleteWebhookSubscriptionAsync,DeleteWebhookSubscriptionWithHttpInfo,DeleteWebhookSubscriptionAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + // make the HTTP request RestResponse localVarResponse = (RestResponse)await Configuration.ApiClient.CallApiAsync(localVarPath, @@ -650,7 +683,7 @@ public ApiResponse< InlineResponse2004 > GetWebhookSubscriptionByIdWithHttpInfo { localVarPathParams.Add("webhookId", Configuration.ApiClient.ParameterToString(webhookId)); // path parameter } - //logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarPathParams)}"); + logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarPathParams)}"); if (Method.Get == Method.Post) { localVarPostBody = "{}"; @@ -660,6 +693,22 @@ public ApiResponse< InlineResponse2004 > GetWebhookSubscriptionByIdWithHttpInfo localVarPostBody = null; } + bool isMLESupportedByCybsForApi = false; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "GetWebhookSubscriptionById,GetWebhookSubscriptionByIdAsync,GetWebhookSubscriptionByIdWithHttpInfo,GetWebhookSubscriptionByIdAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + // make the HTTP request RestResponse localVarResponse = (RestResponse) Configuration.ApiClient.CallApi(localVarPath, @@ -745,7 +794,7 @@ public async System.Threading.Tasks.Task> GetWeb { localVarPathParams.Add("webhookId", Configuration.ApiClient.ParameterToString(webhookId)); // path parameter } - //logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarPathParams)}"); + logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarPathParams)}"); if (Method.Get == Method.Post) { localVarPostBody = "{}"; @@ -755,6 +804,22 @@ public async System.Threading.Tasks.Task> GetWeb localVarPostBody = null; } + bool isMLESupportedByCybsForApi = false; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "GetWebhookSubscriptionById,GetWebhookSubscriptionByIdAsync,GetWebhookSubscriptionByIdWithHttpInfo,GetWebhookSubscriptionByIdAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + // make the HTTP request RestResponse localVarResponse = (RestResponse)await Configuration.ApiClient.CallApiAsync(localVarPath, @@ -863,9 +928,9 @@ public ApiResponse< List > GetWebhookSubscriptionsByOrgWithH { localVarQueryParams.Add("eventType", Configuration.ApiClient.ParameterToString(eventType)); // query parameter } - //logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarQueryParams)}"); - //logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarQueryParams)}"); - //logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarQueryParams)}"); + logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarQueryParams)}"); + logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarQueryParams)}"); + logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarQueryParams)}"); if (Method.Get == Method.Post) { localVarPostBody = "{}"; @@ -875,6 +940,22 @@ public ApiResponse< List > GetWebhookSubscriptionsByOrgWithH localVarPostBody = null; } + bool isMLESupportedByCybsForApi = false; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "GetWebhookSubscriptionsByOrg,GetWebhookSubscriptionsByOrgAsync,GetWebhookSubscriptionsByOrgWithHttpInfo,GetWebhookSubscriptionsByOrgAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + // make the HTTP request RestResponse localVarResponse = (RestResponse) Configuration.ApiClient.CallApi(localVarPath, @@ -984,9 +1065,9 @@ public async System.Threading.Tasks.Task>> { localVarQueryParams.Add("eventType", Configuration.ApiClient.ParameterToString(eventType)); // query parameter } - //logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarQueryParams)}"); - //logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarQueryParams)}"); - //logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarQueryParams)}"); + logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarQueryParams)}"); + logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarQueryParams)}"); + logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarQueryParams)}"); if (Method.Get == Method.Post) { localVarPostBody = "{}"; @@ -996,6 +1077,22 @@ public async System.Threading.Tasks.Task>> localVarPostBody = null; } + bool isMLESupportedByCybsForApi = false; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "GetWebhookSubscriptionsByOrg,GetWebhookSubscriptionsByOrgAsync,GetWebhookSubscriptionsByOrgWithHttpInfo,GetWebhookSubscriptionsByOrgAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + // make the HTTP request RestResponse localVarResponse = (RestResponse)await Configuration.ApiClient.CallApiAsync(localVarPath, @@ -1117,14 +1214,30 @@ public ApiResponse< InlineResponse2015 > SaveAsymEgressKeyWithHttpInfo (string v localVarPostBody = saveAsymEgressKey; // byte array } - //if (logUtility.IsMaskingEnabled(logger)) - //{ - // logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); - //} - //else - //{ - // logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); - //} + + bool isMLESupportedByCybsForApi = false; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "SaveAsymEgressKey,SaveAsymEgressKeyAsync,SaveAsymEgressKeyWithHttpInfo,SaveAsymEgressKeyAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + if (logUtility.IsMaskingEnabled(logger)) + { + logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); + } + else + { + logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); + } // make the HTTP request @@ -1248,14 +1361,29 @@ public async System.Threading.Tasks.Task> SaveAs localVarPostBody = saveAsymEgressKey; // byte array } - //if (logUtility.IsMaskingEnabled(logger)) - //{ - // logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); - //} - //else - //{ - // logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); - //} + bool isMLESupportedByCybsForApi = false; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "SaveAsymEgressKey,SaveAsymEgressKeyAsync,SaveAsymEgressKeyWithHttpInfo,SaveAsymEgressKeyAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + if (logUtility.IsMaskingEnabled(logger)) + { + logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); + } + else + { + logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); + } // make the HTTP request @@ -1340,7 +1468,7 @@ public ApiResponse UpdateWebhookSubscriptionWithHttpInfo (string webhook { localVarPathParams.Add("webhookId", Configuration.ApiClient.ParameterToString(webhookId)); // path parameter } - //logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarPathParams)}"); + logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarPathParams)}"); if (updateWebhookRequest != null && updateWebhookRequest.GetType() != typeof(byte[])) { SdkTracker sdkTracker = new SdkTracker(); @@ -1352,14 +1480,30 @@ public ApiResponse UpdateWebhookSubscriptionWithHttpInfo (string webhook localVarPostBody = updateWebhookRequest; // byte array } - //if (logUtility.IsMaskingEnabled(logger)) - //{ - // logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); - //} - //else - //{ - // logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); - //} + + bool isMLESupportedByCybsForApi = false; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "UpdateWebhookSubscription,UpdateWebhookSubscriptionAsync,UpdateWebhookSubscriptionWithHttpInfo,UpdateWebhookSubscriptionAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + if (logUtility.IsMaskingEnabled(logger)) + { + logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); + } + else + { + logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); + } // make the HTTP request @@ -1446,7 +1590,7 @@ public async System.Threading.Tasks.Task> UpdateWebhookSubsc { localVarPathParams.Add("webhookId", Configuration.ApiClient.ParameterToString(webhookId)); // path parameter } - //logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarPathParams)}"); + logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarPathParams)}"); if (updateWebhookRequest != null && updateWebhookRequest.GetType() != typeof(byte[])) { SdkTracker sdkTracker = new SdkTracker(); @@ -1458,14 +1602,29 @@ public async System.Threading.Tasks.Task> UpdateWebhookSubsc localVarPostBody = updateWebhookRequest; // byte array } - //if (logUtility.IsMaskingEnabled(logger)) - //{ - // logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); - //} - //else - //{ - // logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); - //} + bool isMLESupportedByCybsForApi = false; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "UpdateWebhookSubscription,UpdateWebhookSubscriptionAsync,UpdateWebhookSubscriptionWithHttpInfo,UpdateWebhookSubscriptionAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + if (logUtility.IsMaskingEnabled(logger)) + { + logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); + } + else + { + logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); + } // make the HTTP request diff --git a/Api/MerchantBoardingApi.cs b/Api/MerchantBoardingApi.cs index c06204d9..42f48da3 100644 --- a/Api/MerchantBoardingApi.cs +++ b/Api/MerchantBoardingApi.cs @@ -18,6 +18,7 @@ using NLog; using AuthenticationSdk.util; using CyberSource.Utilities.Tracking; +using AuthenticationSdk.core; namespace CyberSource.Api { @@ -318,7 +319,7 @@ public ApiResponse< InlineResponse2001 > GetRegistrationWithHttpInfo (string reg { localVarPathParams.Add("registrationId", Configuration.ApiClient.ParameterToString(registrationId)); // path parameter } - //logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarPathParams)}"); + logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarPathParams)}"); if (Method.Get == Method.Post) { localVarPostBody = "{}"; @@ -328,6 +329,22 @@ public ApiResponse< InlineResponse2001 > GetRegistrationWithHttpInfo (string reg localVarPostBody = null; } + bool isMLESupportedByCybsForApi = false; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "GetRegistration,GetRegistrationAsync,GetRegistrationWithHttpInfo,GetRegistrationAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + // make the HTTP request RestResponse localVarResponse = (RestResponse) Configuration.ApiClient.CallApi(localVarPath, @@ -413,7 +430,7 @@ public async System.Threading.Tasks.Task> GetReg { localVarPathParams.Add("registrationId", Configuration.ApiClient.ParameterToString(registrationId)); // path parameter } - //logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarPathParams)}"); + logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarPathParams)}"); if (Method.Get == Method.Post) { localVarPostBody = "{}"; @@ -423,6 +440,22 @@ public async System.Threading.Tasks.Task> GetReg localVarPostBody = null; } + bool isMLESupportedByCybsForApi = false; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "GetRegistration,GetRegistrationAsync,GetRegistrationWithHttpInfo,GetRegistrationAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + // make the HTTP request RestResponse localVarResponse = (RestResponse)await Configuration.ApiClient.CallApiAsync(localVarPath, @@ -519,14 +552,30 @@ public ApiResponse< InlineResponse2012 > PostRegistrationWithHttpInfo (PostRegis localVarPostBody = postRegistrationBody; // byte array } - //if (logUtility.IsMaskingEnabled(logger)) - //{ - // logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); - //} - //else - //{ - // logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); - //} + + bool isMLESupportedByCybsForApi = false; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "PostRegistration,PostRegistrationAsync,PostRegistrationWithHttpInfo,PostRegistrationAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + if (logUtility.IsMaskingEnabled(logger)) + { + logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); + } + else + { + logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); + } // make the HTTP request @@ -626,14 +675,29 @@ public async System.Threading.Tasks.Task> PostRe localVarPostBody = postRegistrationBody; // byte array } - //if (logUtility.IsMaskingEnabled(logger)) - //{ - // logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); - //} - //else - //{ - // logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); - //} + bool isMLESupportedByCybsForApi = false; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "PostRegistration,PostRegistrationAsync,PostRegistrationWithHttpInfo,PostRegistrationAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + if (logUtility.IsMaskingEnabled(logger)) + { + logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); + } + else + { + logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); + } // make the HTTP request diff --git a/Api/MicroformIntegrationApi.cs b/Api/MicroformIntegrationApi.cs index be606d86..12672df7 100644 --- a/Api/MicroformIntegrationApi.cs +++ b/Api/MicroformIntegrationApi.cs @@ -18,6 +18,7 @@ using NLog; using AuthenticationSdk.util; using CyberSource.Utilities.Tracking; +using AuthenticationSdk.core; namespace CyberSource.Api { @@ -279,14 +280,30 @@ public ApiResponse< string > GenerateCaptureContextWithHttpInfo (GenerateCapture localVarPostBody = generateCaptureContextRequest; // byte array } - //if (logUtility.IsMaskingEnabled(logger)) - //{ - // logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); - //} - //else - //{ - // logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); - //} + + bool isMLESupportedByCybsForApi = false; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "GenerateCaptureContext,GenerateCaptureContextAsync,GenerateCaptureContextWithHttpInfo,GenerateCaptureContextAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + if (logUtility.IsMaskingEnabled(logger)) + { + logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); + } + else + { + logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); + } // make the HTTP request @@ -380,14 +397,29 @@ public async System.Threading.Tasks.Task> GenerateCaptureCon localVarPostBody = generateCaptureContextRequest; // byte array } - //if (logUtility.IsMaskingEnabled(logger)) - //{ - // logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); - //} - //else - //{ - // logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); - //} + bool isMLESupportedByCybsForApi = false; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "GenerateCaptureContext,GenerateCaptureContextAsync,GenerateCaptureContextWithHttpInfo,GenerateCaptureContextAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + if (logUtility.IsMaskingEnabled(logger)) + { + logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); + } + else + { + logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); + } // make the HTTP request diff --git a/Api/NetFundingsApi.cs b/Api/NetFundingsApi.cs index 9ee57e41..7f91a8fd 100644 --- a/Api/NetFundingsApi.cs +++ b/Api/NetFundingsApi.cs @@ -18,6 +18,7 @@ using NLog; using AuthenticationSdk.util; using CyberSource.Utilities.Tracking; +using AuthenticationSdk.core; namespace CyberSource.Api { @@ -322,6 +323,22 @@ public ApiResponse< ReportingV3NetFundingsGet200Response > GetNetFundingDetailsW localVarPostBody = null; } + bool isMLESupportedByCybsForApi = false; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "GetNetFundingDetails,GetNetFundingDetailsAsync,GetNetFundingDetailsWithHttpInfo,GetNetFundingDetailsAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + // make the HTTP request RestResponse localVarResponse = (RestResponse) Configuration.ApiClient.CallApi(localVarPath, @@ -445,6 +462,22 @@ public async System.Threading.Tasks.Task GetNotifica localVarPostBody = null; } + bool isMLESupportedByCybsForApi = false; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "GetNotificationOfChangeReport,GetNotificationOfChangeReportAsync,GetNotificationOfChangeReportWithHttpInfo,GetNotificationOfChangeReportAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + // make the HTTP request RestResponse localVarResponse = (RestResponse) Configuration.ApiClient.CallApi(localVarPath, @@ -411,6 +428,22 @@ public async System.Threading.Tasks.Task CreateOrderWithHttpInfo (C localVarPostBody = createOrderRequest; // byte array } - //if (logUtility.IsMaskingEnabled(logger)) - //{ - // logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); - //} - //else - //{ - // logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); - //} + + bool isMLESupportedByCybsForApi = false; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "CreateOrder,CreateOrderAsync,CreateOrderWithHttpInfo,CreateOrderAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + if (logUtility.IsMaskingEnabled(logger)) + { + logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); + } + else + { + logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); + } // make the HTTP request @@ -426,14 +443,29 @@ public async System.Threading.Tasks.Task UpdateOrderWithHttpInfo ( { localVarPathParams.Add("id", Configuration.ApiClient.ParameterToString(id)); // path parameter } - //logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarPathParams)}"); + logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarPathParams)}"); if (updateOrderRequest != null && updateOrderRequest.GetType() != typeof(byte[])) { SdkTracker sdkTracker = new SdkTracker(); @@ -538,14 +570,30 @@ public ApiResponse< PtsV2UpdateOrderPatch201Response > UpdateOrderWithHttpInfo ( localVarPostBody = updateOrderRequest; // byte array } - //if (logUtility.IsMaskingEnabled(logger)) - //{ - // logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); - //} - //else - //{ - // logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); - //} + + bool isMLESupportedByCybsForApi = false; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "UpdateOrder,UpdateOrderAsync,UpdateOrderWithHttpInfo,UpdateOrderAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + if (logUtility.IsMaskingEnabled(logger)) + { + logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); + } + else + { + logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); + } // make the HTTP request @@ -640,7 +688,7 @@ public async System.Threading.Tasks.Task CheckPayerAuthEnrollm localVarPostBody = checkPayerAuthEnrollmentRequest; // byte array } - //if (logUtility.IsMaskingEnabled(logger)) - //{ - // logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); - //} - //else - //{ - // logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); - //} + + bool isMLESupportedByCybsForApi = true; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "CheckPayerAuthEnrollment,CheckPayerAuthEnrollmentAsync,CheckPayerAuthEnrollmentWithHttpInfo,CheckPayerAuthEnrollmentAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + if (logUtility.IsMaskingEnabled(logger)) + { + logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); + } + else + { + logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); + } // make the HTTP request @@ -464,14 +481,29 @@ public async System.Threading.Tasks.Task PayerAuthSetupWi localVarPostBody = payerAuthSetupRequest; // byte array } - //if (logUtility.IsMaskingEnabled(logger)) - //{ - // logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); - //} - //else - //{ - // logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); - //} + + bool isMLESupportedByCybsForApi = true; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "PayerAuthSetup,PayerAuthSetupAsync,PayerAuthSetupWithHttpInfo,PayerAuthSetupAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + if (logUtility.IsMaskingEnabled(logger)) + { + logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); + } + else + { + logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); + } // make the HTTP request @@ -664,14 +712,29 @@ public async System.Threading.Tasks.Task ValidateAuthent localVarPostBody = validateRequest; // byte array } - //if (logUtility.IsMaskingEnabled(logger)) - //{ - // logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); - //} - //else - //{ - // logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); - //} + + bool isMLESupportedByCybsForApi = true; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "ValidateAuthenticationResults,ValidateAuthenticationResultsAsync,ValidateAuthenticationResultsWithHttpInfo,ValidateAuthenticationResultsAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + if (logUtility.IsMaskingEnabled(logger)) + { + logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); + } + else + { + logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); + } // make the HTTP request @@ -864,14 +943,29 @@ public async System.Threading.Tasks.Task GetPaymentB localVarPostBody = null; } + bool isMLESupportedByCybsForApi = false; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "GetPaymentBatchSummary,GetPaymentBatchSummaryAsync,GetPaymentBatchSummaryWithHttpInfo,GetPaymentBatchSummaryAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + // make the HTTP request RestResponse localVarResponse = (RestResponse) Configuration.ApiClient.CallApi(localVarPath, @@ -483,6 +500,22 @@ public async System.Threading.Tasks.Task DeletePaymentInstrumentWithHttpInfo (string paymentIn { localVarPathParams.Add("paymentInstrumentId", Configuration.ApiClient.ParameterToString(paymentInstrumentId)); // path parameter } - //logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarPathParams)}"); + logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarPathParams)}"); if (profileId != null) { localVarHeaderParams.Add("profile-id", Configuration.ApiClient.ParameterToString(profileId)); // header parameter @@ -447,6 +448,22 @@ public ApiResponse DeletePaymentInstrumentWithHttpInfo (string paymentIn localVarPostBody = null; } + bool isMLESupportedByCybsForApi = false; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "DeletePaymentInstrument,DeletePaymentInstrumentAsync,DeletePaymentInstrumentWithHttpInfo,DeletePaymentInstrumentAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + // make the HTTP request RestResponse localVarResponse = (RestResponse) Configuration.ApiClient.CallApi(localVarPath, @@ -532,7 +549,7 @@ public async System.Threading.Tasks.Task> DeletePaymentInstr { localVarPathParams.Add("paymentInstrumentId", Configuration.ApiClient.ParameterToString(paymentInstrumentId)); // path parameter } - //logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarPathParams)}"); + logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarPathParams)}"); if (profileId != null) { localVarHeaderParams.Add("profile-id", Configuration.ApiClient.ParameterToString(profileId)); // header parameter @@ -546,6 +563,22 @@ public async System.Threading.Tasks.Task> DeletePaymentInstr localVarPostBody = null; } + bool isMLESupportedByCybsForApi = false; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "DeletePaymentInstrument,DeletePaymentInstrumentAsync,DeletePaymentInstrumentWithHttpInfo,DeletePaymentInstrumentAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + // make the HTTP request RestResponse localVarResponse = (RestResponse)await Configuration.ApiClient.CallApiAsync(localVarPath, @@ -634,12 +667,12 @@ public ApiResponse< PostPaymentInstrumentRequest > GetPaymentInstrumentWithHttpI { localVarPathParams.Add("paymentInstrumentId", Configuration.ApiClient.ParameterToString(paymentInstrumentId)); // path parameter } - //logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarPathParams)}"); + logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarPathParams)}"); if (retrieveBinDetails != null) { localVarQueryParams.Add("retrieveBinDetails", Configuration.ApiClient.ParameterToString(retrieveBinDetails)); // query parameter } - //logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarQueryParams)}"); + logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarQueryParams)}"); if (profileId != null) { localVarHeaderParams.Add("profile-id", Configuration.ApiClient.ParameterToString(profileId)); // header parameter @@ -653,6 +686,22 @@ public ApiResponse< PostPaymentInstrumentRequest > GetPaymentInstrumentWithHttpI localVarPostBody = null; } + bool isMLESupportedByCybsForApi = false; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "GetPaymentInstrument,GetPaymentInstrumentAsync,GetPaymentInstrumentWithHttpInfo,GetPaymentInstrumentAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + // make the HTTP request RestResponse localVarResponse = (RestResponse) Configuration.ApiClient.CallApi(localVarPath, @@ -742,12 +791,12 @@ public async System.Threading.Tasks.Task PatchPaymentInstrumentWithHt { localVarPathParams.Add("paymentInstrumentId", Configuration.ApiClient.ParameterToString(paymentInstrumentId)); // path parameter } - //logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarPathParams)}"); + logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarPathParams)}"); if (retrieveBinDetails != null) { localVarQueryParams.Add("retrieveBinDetails", Configuration.ApiClient.ParameterToString(retrieveBinDetails)); // query parameter } - //logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarQueryParams)}"); + logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarQueryParams)}"); if (profileId != null) { localVarHeaderParams.Add("profile-id", Configuration.ApiClient.ParameterToString(profileId)); // header parameter @@ -883,14 +948,30 @@ public ApiResponse< PatchPaymentInstrumentRequest > PatchPaymentInstrumentWithHt localVarPostBody = patchPaymentInstrumentRequest; // byte array } - //if (logUtility.IsMaskingEnabled(logger)) - //{ - // logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); - //} - //else - //{ - // logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); - //} + + bool isMLESupportedByCybsForApi = false; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "PatchPaymentInstrument,PatchPaymentInstrumentAsync,PatchPaymentInstrumentWithHttpInfo,PatchPaymentInstrumentAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + if (logUtility.IsMaskingEnabled(logger)) + { + logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); + } + else + { + logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); + } // make the HTTP request @@ -991,12 +1072,12 @@ public async System.Threading.Tasks.Task PostPaymentInstrumentWithHttp { localVarQueryParams.Add("retrieveBinDetails", Configuration.ApiClient.ParameterToString(retrieveBinDetails)); // query parameter } - //logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarQueryParams)}"); + logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarQueryParams)}"); if (profileId != null) { localVarHeaderParams.Add("profile-id", Configuration.ApiClient.ParameterToString(profileId)); // header parameter @@ -1128,14 +1224,30 @@ public ApiResponse< PostPaymentInstrumentRequest > PostPaymentInstrumentWithHttp localVarPostBody = postPaymentInstrumentRequest; // byte array } - //if (logUtility.IsMaskingEnabled(logger)) - //{ - // logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); - //} - //else - //{ - // logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); - //} + + bool isMLESupportedByCybsForApi = false; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "PostPaymentInstrument,PostPaymentInstrumentAsync,PostPaymentInstrumentWithHttpInfo,PostPaymentInstrumentAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + if (logUtility.IsMaskingEnabled(logger)) + { + logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); + } + else + { + logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); + } // make the HTTP request @@ -1226,7 +1338,7 @@ public async System.Threading.Tasks.Task CreateOrderRequestWithHt { localVarPathParams.Add("id", Configuration.ApiClient.ParameterToString(id)); // path parameter } - //logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarPathParams)}"); + logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarPathParams)}"); if (orderPaymentRequest != null && orderPaymentRequest.GetType() != typeof(byte[])) { SdkTracker sdkTracker = new SdkTracker(); @@ -518,14 +519,30 @@ public ApiResponse< PtsV2PaymentsOrderPost201Response > CreateOrderRequestWithHt localVarPostBody = orderPaymentRequest; // byte array } - //if (logUtility.IsMaskingEnabled(logger)) - //{ - // logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); - //} - //else - //{ - // logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); - //} + + bool isMLESupportedByCybsForApi = true; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "CreateOrderRequest,CreateOrderRequestAsync,CreateOrderRequestWithHttpInfo,CreateOrderRequestAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + if (logUtility.IsMaskingEnabled(logger)) + { + logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); + } + else + { + logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); + } // make the HTTP request @@ -620,7 +637,7 @@ public async System.Threading.Tasks.Task CreatePaymentWithHttpInfo (Cr localVarPostBody = createPaymentRequest; // byte array } - //if (logUtility.IsMaskingEnabled(logger)) - //{ - // logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); - //} - //else - //{ - // logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); - //} + + bool isMLESupportedByCybsForApi = true; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "CreatePayment,CreatePaymentAsync,CreatePaymentWithHttpInfo,CreatePaymentAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + if (logUtility.IsMaskingEnabled(logger)) + { + logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); + } + else + { + logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); + } // make the HTTP request @@ -832,14 +880,29 @@ public async System.Threading.Tasks.Task CreateSessionRequestWithHttp localVarPostBody = createSessionReq; // byte array } - //if (logUtility.IsMaskingEnabled(logger)) - //{ - // logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); - //} - //else - //{ - // logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); - //} + + bool isMLESupportedByCybsForApi = true; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "CreateSessionRequest,CreateSessionRequestAsync,CreateSessionRequestWithHttpInfo,CreateSessionRequestAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + if (logUtility.IsMaskingEnabled(logger)) + { + logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); + } + else + { + logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); + } // make the HTTP request @@ -1032,14 +1111,29 @@ public async System.Threading.Tasks.Task IncrementAut { localVarPathParams.Add("id", Configuration.ApiClient.ParameterToString(id)); // path parameter } - //logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarPathParams)}"); + logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarPathParams)}"); if (incrementAuthRequest != null && incrementAuthRequest.GetType() != typeof(byte[])) { SdkTracker sdkTracker = new SdkTracker(); @@ -1144,14 +1238,30 @@ public ApiResponse< PtsV2IncrementalAuthorizationPatch201Response > IncrementAut localVarPostBody = incrementAuthRequest; // byte array } - //if (logUtility.IsMaskingEnabled(logger)) - //{ - // logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); - //} - //else - //{ - // logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); - //} + + bool isMLESupportedByCybsForApi = true; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "IncrementAuth,IncrementAuthAsync,IncrementAuthWithHttpInfo,IncrementAuthAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + if (logUtility.IsMaskingEnabled(logger)) + { + logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); + } + else + { + logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); + } // make the HTTP request @@ -1246,7 +1356,7 @@ public async System.Threading.Tasks.Task RefreshPaymentStatusWithHttp { localVarPathParams.Add("id", Configuration.ApiClient.ParameterToString(id)); // path parameter } - //logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarPathParams)}"); + logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarPathParams)}"); if (refreshPaymentStatusRequest != null && refreshPaymentStatusRequest.GetType() != typeof(byte[])) { SdkTracker sdkTracker = new SdkTracker(); @@ -1370,14 +1495,30 @@ public ApiResponse< PtsV2PaymentsPost201Response1 > RefreshPaymentStatusWithHttp localVarPostBody = refreshPaymentStatusRequest; // byte array } - //if (logUtility.IsMaskingEnabled(logger)) - //{ - // logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); - //} - //else - //{ - // logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); - //} + + bool isMLESupportedByCybsForApi = true; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "RefreshPaymentStatus,RefreshPaymentStatusAsync,RefreshPaymentStatusWithHttpInfo,RefreshPaymentStatusAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + if (logUtility.IsMaskingEnabled(logger)) + { + logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); + } + else + { + logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); + } // make the HTTP request @@ -1472,7 +1613,7 @@ public async System.Threading.Tasks.Task UpdateSessionReqWithHttpInfo { localVarPathParams.Add("id", Configuration.ApiClient.ParameterToString(id)); // path parameter } - //logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarPathParams)}"); + logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarPathParams)}"); if (createSessionRequest != null && createSessionRequest.GetType() != typeof(byte[])) { SdkTracker sdkTracker = new SdkTracker(); @@ -1596,14 +1752,30 @@ public ApiResponse< PtsV2PaymentsPost201Response2 > UpdateSessionReqWithHttpInfo localVarPostBody = createSessionRequest; // byte array } - //if (logUtility.IsMaskingEnabled(logger)) - //{ - // logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); - //} - //else - //{ - // logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); - //} + + bool isMLESupportedByCybsForApi = true; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "UpdateSessionReq,UpdateSessionReqAsync,UpdateSessionReqWithHttpInfo,UpdateSessionReqAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + if (logUtility.IsMaskingEnabled(logger)) + { + logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); + } + else + { + logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); + } // make the HTTP request @@ -1698,7 +1870,7 @@ public async System.Threading.Tasks.Task OctCreatePaymentWithHttpInfo ( localVarPostBody = octCreatePaymentRequest; // byte array } - //if (logUtility.IsMaskingEnabled(logger)) - //{ - // logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); - //} - //else - //{ - // logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); - //} + + bool isMLESupportedByCybsForApi = true; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "OctCreatePayment,OctCreatePaymentAsync,OctCreatePaymentWithHttpInfo,OctCreatePaymentAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + if (logUtility.IsMaskingEnabled(logger)) + { + logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); + } + else + { + logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); + } // make the HTTP request @@ -380,14 +397,29 @@ public async System.Threading.Tasks.Task ActivatePlanWithHttpInfo (s { localVarPathParams.Add("id", Configuration.ApiClient.ParameterToString(id)); // path parameter } - //logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarPathParams)}"); + logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarPathParams)}"); if (Method.Post == Method.Post) { localVarPostBody = "{}"; @@ -595,6 +596,22 @@ public ApiResponse< ActivateDeactivatePlanResponse > ActivatePlanWithHttpInfo (s localVarPostBody = null; } + bool isMLESupportedByCybsForApi = false; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "ActivatePlan,ActivatePlanAsync,ActivatePlanWithHttpInfo,ActivatePlanAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + // make the HTTP request RestResponse localVarResponse = (RestResponse) Configuration.ApiClient.CallApi(localVarPath, @@ -683,7 +700,7 @@ public async System.Threading.Tasks.Task CreatePlanWithHttpInfo (CreatePlanReque localVarPostBody = createPlanRequest; // byte array } - //if (logUtility.IsMaskingEnabled(logger)) - //{ - // logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); - //} - //else - //{ - // logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); - //} + + bool isMLESupportedByCybsForApi = false; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "CreatePlan,CreatePlanAsync,CreatePlanWithHttpInfo,CreatePlanAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + if (logUtility.IsMaskingEnabled(logger)) + { + logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); + } + else + { + logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); + } // make the HTTP request @@ -890,14 +939,29 @@ public async System.Threading.Tasks.Task> Create localVarPostBody = createPlanRequest; // byte array } - //if (logUtility.IsMaskingEnabled(logger)) - //{ - // logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); - //} - //else - //{ - // logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); - //} + bool isMLESupportedByCybsForApi = false; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "CreatePlan,CreatePlanAsync,CreatePlanWithHttpInfo,CreatePlanAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + if (logUtility.IsMaskingEnabled(logger)) + { + logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); + } + else + { + logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); + } // make the HTTP request @@ -985,7 +1049,7 @@ public ApiResponse< ActivateDeactivatePlanResponse > DeactivatePlanWithHttpInfo { localVarPathParams.Add("id", Configuration.ApiClient.ParameterToString(id)); // path parameter } - //logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarPathParams)}"); + logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarPathParams)}"); if (Method.Post == Method.Post) { localVarPostBody = "{}"; @@ -995,6 +1059,22 @@ public ApiResponse< ActivateDeactivatePlanResponse > DeactivatePlanWithHttpInfo localVarPostBody = null; } + bool isMLESupportedByCybsForApi = false; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "DeactivatePlan,DeactivatePlanAsync,DeactivatePlanWithHttpInfo,DeactivatePlanAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + // make the HTTP request RestResponse localVarResponse = (RestResponse) Configuration.ApiClient.CallApi(localVarPath, @@ -1083,7 +1163,7 @@ public async System.Threading.Tasks.Task DeletePlanWithHttpInfo (string id) { localVarPathParams.Add("id", Configuration.ApiClient.ParameterToString(id)); // path parameter } - //logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarPathParams)}"); + logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarPathParams)}"); if (Method.Delete == Method.Post) { localVarPostBody = "{}"; @@ -1189,6 +1285,22 @@ public ApiResponse< DeletePlanResponse > DeletePlanWithHttpInfo (string id) localVarPostBody = null; } + bool isMLESupportedByCybsForApi = false; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "DeletePlan,DeletePlanAsync,DeletePlanWithHttpInfo,DeletePlanAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + // make the HTTP request RestResponse localVarResponse = (RestResponse) Configuration.ApiClient.CallApi(localVarPath, @@ -1277,7 +1389,7 @@ public async System.Threading.Tasks.Task> Delete { localVarPathParams.Add("id", Configuration.ApiClient.ParameterToString(id)); // path parameter } - //logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarPathParams)}"); + logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarPathParams)}"); if (Method.Delete == Method.Post) { localVarPostBody = "{}"; @@ -1287,6 +1399,22 @@ public async System.Threading.Tasks.Task> Delete localVarPostBody = null; } + bool isMLESupportedByCybsForApi = false; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "DeletePlan,DeletePlanAsync,DeletePlanWithHttpInfo,DeletePlanAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + // make the HTTP request RestResponse localVarResponse = (RestResponse)await Configuration.ApiClient.CallApiAsync(localVarPath, @@ -1373,7 +1501,7 @@ public ApiResponse< GetPlanResponse > GetPlanWithHttpInfo (string id) { localVarPathParams.Add("id", Configuration.ApiClient.ParameterToString(id)); // path parameter } - //logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarPathParams)}"); + logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarPathParams)}"); if (Method.Get == Method.Post) { localVarPostBody = "{}"; @@ -1383,6 +1511,22 @@ public ApiResponse< GetPlanResponse > GetPlanWithHttpInfo (string id) localVarPostBody = null; } + bool isMLESupportedByCybsForApi = false; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "GetPlan,GetPlanAsync,GetPlanWithHttpInfo,GetPlanAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + // make the HTTP request RestResponse localVarResponse = (RestResponse) Configuration.ApiClient.CallApi(localVarPath, @@ -1471,7 +1615,7 @@ public async System.Threading.Tasks.Task> GetPlanAs { localVarPathParams.Add("id", Configuration.ApiClient.ParameterToString(id)); // path parameter } - //logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarPathParams)}"); + logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarPathParams)}"); if (Method.Get == Method.Post) { localVarPostBody = "{}"; @@ -1481,6 +1625,22 @@ public async System.Threading.Tasks.Task> GetPlanAs localVarPostBody = null; } + bool isMLESupportedByCybsForApi = false; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "GetPlan,GetPlanAsync,GetPlanWithHttpInfo,GetPlanAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + // make the HTTP request RestResponse localVarResponse = (RestResponse)await Configuration.ApiClient.CallApiAsync(localVarPath, @@ -1564,6 +1724,22 @@ public ApiResponse< GetPlanCodeResponse > GetPlanCodeWithHttpInfo () localVarPostBody = null; } + bool isMLESupportedByCybsForApi = false; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "GetPlanCode,GetPlanCodeAsync,GetPlanCodeWithHttpInfo,GetPlanCodeAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + // make the HTTP request RestResponse localVarResponse = (RestResponse) Configuration.ApiClient.CallApi(localVarPath, @@ -1649,6 +1825,22 @@ public async System.Threading.Tasks.Task> GetPl localVarPostBody = null; } + bool isMLESupportedByCybsForApi = false; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "GetPlanCode,GetPlanCodeAsync,GetPlanCodeWithHttpInfo,GetPlanCodeAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + // make the HTTP request RestResponse localVarResponse = (RestResponse)await Configuration.ApiClient.CallApiAsync(localVarPath, @@ -1753,11 +1945,11 @@ public ApiResponse< GetAllPlansResponse > GetPlansWithHttpInfo (int? offset = nu { localVarQueryParams.Add("name", Configuration.ApiClient.ParameterToString(name)); // query parameter } - //logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarQueryParams)}"); - //logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarQueryParams)}"); - //logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarQueryParams)}"); - //logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarQueryParams)}"); - //logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarQueryParams)}"); + logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarQueryParams)}"); + logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarQueryParams)}"); + logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarQueryParams)}"); + logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarQueryParams)}"); + logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarQueryParams)}"); if (Method.Get == Method.Post) { localVarPostBody = "{}"; @@ -1767,6 +1959,22 @@ public ApiResponse< GetAllPlansResponse > GetPlansWithHttpInfo (int? offset = nu localVarPostBody = null; } + bool isMLESupportedByCybsForApi = false; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "GetPlans,GetPlansAsync,GetPlansWithHttpInfo,GetPlansAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + // make the HTTP request RestResponse localVarResponse = (RestResponse) Configuration.ApiClient.CallApi(localVarPath, @@ -1873,11 +2081,11 @@ public async System.Threading.Tasks.Task> GetPl { localVarQueryParams.Add("name", Configuration.ApiClient.ParameterToString(name)); // query parameter } - //logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarQueryParams)}"); - //logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarQueryParams)}"); - //logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarQueryParams)}"); - //logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarQueryParams)}"); - //logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarQueryParams)}"); + logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarQueryParams)}"); + logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarQueryParams)}"); + logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarQueryParams)}"); + logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarQueryParams)}"); + logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarQueryParams)}"); if (Method.Get == Method.Post) { localVarPostBody = "{}"; @@ -1887,6 +2095,22 @@ public async System.Threading.Tasks.Task> GetPl localVarPostBody = null; } + bool isMLESupportedByCybsForApi = false; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "GetPlans,GetPlansAsync,GetPlansWithHttpInfo,GetPlansAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + // make the HTTP request RestResponse localVarResponse = (RestResponse)await Configuration.ApiClient.CallApiAsync(localVarPath, @@ -1981,7 +2205,7 @@ public ApiResponse< UpdatePlanResponse > UpdatePlanWithHttpInfo (string id, Upda { localVarPathParams.Add("id", Configuration.ApiClient.ParameterToString(id)); // path parameter } - //logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarPathParams)}"); + logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarPathParams)}"); if (updatePlanRequest != null && updatePlanRequest.GetType() != typeof(byte[])) { SdkTracker sdkTracker = new SdkTracker(); @@ -1993,14 +2217,30 @@ public ApiResponse< UpdatePlanResponse > UpdatePlanWithHttpInfo (string id, Upda localVarPostBody = updatePlanRequest; // byte array } - //if (logUtility.IsMaskingEnabled(logger)) - //{ - // logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); - //} - //else - //{ - // logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); - //} + + bool isMLESupportedByCybsForApi = false; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "UpdatePlan,UpdatePlanAsync,UpdatePlanWithHttpInfo,UpdatePlanAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + if (logUtility.IsMaskingEnabled(logger)) + { + logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); + } + else + { + logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); + } // make the HTTP request @@ -2098,7 +2338,7 @@ public async System.Threading.Tasks.Task> Update { localVarPathParams.Add("id", Configuration.ApiClient.ParameterToString(id)); // path parameter } - //logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarPathParams)}"); + logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarPathParams)}"); if (updatePlanRequest != null && updatePlanRequest.GetType() != typeof(byte[])) { SdkTracker sdkTracker = new SdkTracker(); @@ -2110,14 +2350,29 @@ public async System.Threading.Tasks.Task> Update localVarPostBody = updatePlanRequest; // byte array } - //if (logUtility.IsMaskingEnabled(logger)) - //{ - // logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); - //} - //else - //{ - // logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); - //} + bool isMLESupportedByCybsForApi = false; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "UpdatePlan,UpdatePlanAsync,UpdatePlanWithHttpInfo,UpdatePlanAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + if (logUtility.IsMaskingEnabled(logger)) + { + logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); + } + else + { + logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); + } // make the HTTP request diff --git a/Api/PurchaseAndRefundDetailsApi.cs b/Api/PurchaseAndRefundDetailsApi.cs index 3751d903..43ff6301 100644 --- a/Api/PurchaseAndRefundDetailsApi.cs +++ b/Api/PurchaseAndRefundDetailsApi.cs @@ -18,6 +18,7 @@ using NLog; using AuthenticationSdk.util; using CyberSource.Utilities.Tracking; +using AuthenticationSdk.core; namespace CyberSource.Api { @@ -367,6 +368,22 @@ public ApiResponse< ReportingV3PurchaseRefundDetailsGet200Response > GetPurchase localVarPostBody = null; } + bool isMLESupportedByCybsForApi = false; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "GetPurchaseAndRefundDetails,GetPurchaseAndRefundDetailsAsync,GetPurchaseAndRefundDetailsWithHttpInfo,GetPurchaseAndRefundDetailsAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + // make the HTTP request RestResponse localVarResponse = (RestResponse) Configuration.ApiClient.CallApi(localVarPath, @@ -519,6 +536,22 @@ public async System.Threading.Tasks.Task CreatePushFundsTransferWithHttpInfo ( localVarPostBody = pushFundsRequest; // byte array } - //if (logUtility.IsMaskingEnabled(logger)) - //{ - // logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); - //} - //else - //{ - // logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); - //} + + bool isMLESupportedByCybsForApi = true; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "CreatePushFundsTransfer,CreatePushFundsTransferAsync,CreatePushFundsTransferWithHttpInfo,CreatePushFundsTransferAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + if (logUtility.IsMaskingEnabled(logger)) + { + logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); + } + else + { + logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); + } // make the HTTP request @@ -548,14 +565,29 @@ public async System.Threading.Tasks.Task> Crea localVarPostBody = pushFundsRequest; // byte array } - //if (logUtility.IsMaskingEnabled(logger)) - //{ - // logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); - //} - //else - //{ - // logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); - //} + bool isMLESupportedByCybsForApi = true; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "CreatePushFundsTransfer,CreatePushFundsTransferAsync,CreatePushFundsTransferWithHttpInfo,CreatePushFundsTransferAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + if (logUtility.IsMaskingEnabled(logger)) + { + logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); + } + else + { + logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); + } // make the HTTP request diff --git a/Api/RefundApi.cs b/Api/RefundApi.cs index b1795f12..041d7afd 100644 --- a/Api/RefundApi.cs +++ b/Api/RefundApi.cs @@ -18,6 +18,7 @@ using NLog; using AuthenticationSdk.util; using CyberSource.Utilities.Tracking; +using AuthenticationSdk.core; namespace CyberSource.Api { @@ -330,7 +331,7 @@ public ApiResponse< PtsV2PaymentsRefundPost201Response > RefundCaptureWithHttpIn { localVarPathParams.Add("id", Configuration.ApiClient.ParameterToString(id)); // path parameter } - //logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarPathParams)}"); + logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarPathParams)}"); if (refundCaptureRequest != null && refundCaptureRequest.GetType() != typeof(byte[])) { SdkTracker sdkTracker = new SdkTracker(); @@ -342,14 +343,30 @@ public ApiResponse< PtsV2PaymentsRefundPost201Response > RefundCaptureWithHttpIn localVarPostBody = refundCaptureRequest; // byte array } - //if (logUtility.IsMaskingEnabled(logger)) - //{ - // logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); - //} - //else - //{ - // logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); - //} + + bool isMLESupportedByCybsForApi = true; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "RefundCapture,RefundCaptureAsync,RefundCaptureWithHttpInfo,RefundCaptureAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + if (logUtility.IsMaskingEnabled(logger)) + { + logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); + } + else + { + logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); + } // make the HTTP request @@ -444,7 +461,7 @@ public async System.Threading.Tasks.Task RefundPaymentWithHttpIn { localVarPathParams.Add("id", Configuration.ApiClient.ParameterToString(id)); // path parameter } - //logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarPathParams)}"); + logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarPathParams)}"); if (refundPaymentRequest != null && refundPaymentRequest.GetType() != typeof(byte[])) { SdkTracker sdkTracker = new SdkTracker(); @@ -568,14 +600,30 @@ public ApiResponse< PtsV2PaymentsRefundPost201Response > RefundPaymentWithHttpIn localVarPostBody = refundPaymentRequest; // byte array } - //if (logUtility.IsMaskingEnabled(logger)) - //{ - // logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); - //} - //else - //{ - // logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); - //} + + bool isMLESupportedByCybsForApi = true; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "RefundPayment,RefundPaymentAsync,RefundPaymentWithHttpInfo,RefundPaymentAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + if (logUtility.IsMaskingEnabled(logger)) + { + logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); + } + else + { + logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); + } // make the HTTP request @@ -670,7 +718,7 @@ public async System.Threading.Tasks.Task ReplayPreviousWebhooksWithHttpInfo (string webhookId, { localVarPathParams.Add("webhookId", Configuration.ApiClient.ParameterToString(webhookId)); // path parameter } - //logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarPathParams)}"); + logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarPathParams)}"); if (replayWebhooksRequest != null && replayWebhooksRequest.GetType() != typeof(byte[])) { SdkTracker sdkTracker = new SdkTracker(); @@ -288,14 +289,30 @@ public ApiResponse ReplayPreviousWebhooksWithHttpInfo (string webhookId, localVarPostBody = replayWebhooksRequest; // byte array } - //if (logUtility.IsMaskingEnabled(logger)) - //{ - // logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); - //} - //else - //{ - // logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); - //} + + bool isMLESupportedByCybsForApi = false; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "ReplayPreviousWebhooks,ReplayPreviousWebhooksAsync,ReplayPreviousWebhooksWithHttpInfo,ReplayPreviousWebhooksAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + if (logUtility.IsMaskingEnabled(logger)) + { + logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); + } + else + { + logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); + } // make the HTTP request @@ -382,7 +399,7 @@ public async System.Threading.Tasks.Task> ReplayPreviousWebh { localVarPathParams.Add("webhookId", Configuration.ApiClient.ParameterToString(webhookId)); // path parameter } - //logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarPathParams)}"); + logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarPathParams)}"); if (replayWebhooksRequest != null && replayWebhooksRequest.GetType() != typeof(byte[])) { SdkTracker sdkTracker = new SdkTracker(); @@ -394,14 +411,29 @@ public async System.Threading.Tasks.Task> ReplayPreviousWebh localVarPostBody = replayWebhooksRequest; // byte array } - //if (logUtility.IsMaskingEnabled(logger)) - //{ - // logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); - //} - //else - //{ - // logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); - //} + bool isMLESupportedByCybsForApi = false; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "ReplayPreviousWebhooks,ReplayPreviousWebhooksAsync,ReplayPreviousWebhooksWithHttpInfo,ReplayPreviousWebhooksAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + if (logUtility.IsMaskingEnabled(logger)) + { + logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); + } + else + { + logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); + } // make the HTTP request diff --git a/Api/ReportDefinitionsApi.cs b/Api/ReportDefinitionsApi.cs index 8acec807..9dfe5ae0 100644 --- a/Api/ReportDefinitionsApi.cs +++ b/Api/ReportDefinitionsApi.cs @@ -18,6 +18,7 @@ using NLog; using AuthenticationSdk.util; using CyberSource.Utilities.Tracking; +using AuthenticationSdk.core; namespace CyberSource.Api { @@ -361,6 +362,22 @@ public ApiResponse< ReportingV3ReportDefinitionsNameGet200Response > GetResource localVarPostBody = null; } + bool isMLESupportedByCybsForApi = false; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "GetResourceInfoByReportDefinition,GetResourceInfoByReportDefinitionAsync,GetResourceInfoByReportDefinitionWithHttpInfo,GetResourceInfoByReportDefinitionAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + // make the HTTP request RestResponse localVarResponse = (RestResponse) Configuration.ApiClient.CallApi(localVarPath, @@ -477,6 +494,22 @@ public async System.Threading.Tasks.Task GetResourceV2In localVarPostBody = null; } + bool isMLESupportedByCybsForApi = false; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "GetResourceV2Info,GetResourceV2InfoAsync,GetResourceV2InfoWithHttpInfo,GetResourceV2InfoAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + // make the HTTP request RestResponse localVarResponse = (RestResponse) Configuration.ApiClient.CallApi(localVarPath, @@ -667,6 +716,22 @@ public async System.Threading.Tasks.Task DownloadReportWithHttpInfo (DateTime? reportDate, str localVarPostBody = null; } + bool isMLESupportedByCybsForApi = false; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "DownloadReport,DownloadReportAsync,DownloadReportWithHttpInfo,DownloadReportAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + // make the HTTP request RestResponse localVarResponse = (RestResponse) Configuration.ApiClient.CallApi(localVarPath, @@ -422,6 +439,22 @@ public async System.Threading.Tasks.Task> DownloadReportAsyn localVarPostBody = null; } + bool isMLESupportedByCybsForApi = false; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "DownloadReport,DownloadReportAsync,DownloadReportWithHttpInfo,DownloadReportAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + // make the HTTP request RestResponse localVarResponse = (RestResponse)await Configuration.ApiClient.CallApiAsync(localVarPath, diff --git a/Api/ReportSubscriptionsApi.cs b/Api/ReportSubscriptionsApi.cs index 386453f7..ffae2f22 100644 --- a/Api/ReportSubscriptionsApi.cs +++ b/Api/ReportSubscriptionsApi.cs @@ -18,6 +18,7 @@ using NLog; using AuthenticationSdk.util; using CyberSource.Utilities.Tracking; +using AuthenticationSdk.core; namespace CyberSource.Api { @@ -455,7 +456,7 @@ public ApiResponse CreateStandardOrClassicSubscriptionWithHttpInfo (Pred { localVarQueryParams.Add("organizationId", Configuration.ApiClient.ParameterToString(organizationId)); // query parameter } - //logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarQueryParams)}"); + logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarQueryParams)}"); if (predefinedSubscriptionRequestBean != null && predefinedSubscriptionRequestBean.GetType() != typeof(byte[])) { SdkTracker sdkTracker = new SdkTracker(); @@ -467,14 +468,30 @@ public ApiResponse CreateStandardOrClassicSubscriptionWithHttpInfo (Pred localVarPostBody = predefinedSubscriptionRequestBean; // byte array } - //if (logUtility.IsMaskingEnabled(logger)) - //{ - // logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); - //} - //else - //{ - // logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); - //} + + bool isMLESupportedByCybsForApi = false; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "CreateStandardOrClassicSubscription,CreateStandardOrClassicSubscriptionAsync,CreateStandardOrClassicSubscriptionWithHttpInfo,CreateStandardOrClassicSubscriptionAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + if (logUtility.IsMaskingEnabled(logger)) + { + logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); + } + else + { + logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); + } // make the HTTP request @@ -561,7 +578,7 @@ public async System.Threading.Tasks.Task> CreateStandardOrCl { localVarQueryParams.Add("organizationId", Configuration.ApiClient.ParameterToString(organizationId)); // query parameter } - //logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarQueryParams)}"); + logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarQueryParams)}"); if (predefinedSubscriptionRequestBean != null && predefinedSubscriptionRequestBean.GetType() != typeof(byte[])) { SdkTracker sdkTracker = new SdkTracker(); @@ -573,14 +590,29 @@ public async System.Threading.Tasks.Task> CreateStandardOrCl localVarPostBody = predefinedSubscriptionRequestBean; // byte array } - //if (logUtility.IsMaskingEnabled(logger)) - //{ - // logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); - //} - //else - //{ - // logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); - //} + bool isMLESupportedByCybsForApi = false; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "CreateStandardOrClassicSubscription,CreateStandardOrClassicSubscriptionAsync,CreateStandardOrClassicSubscriptionWithHttpInfo,CreateStandardOrClassicSubscriptionAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + if (logUtility.IsMaskingEnabled(logger)) + { + logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); + } + else + { + logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); + } // make the HTTP request @@ -665,7 +697,7 @@ public ApiResponse CreateSubscriptionWithHttpInfo (CreateReportSubscript { localVarQueryParams.Add("organizationId", Configuration.ApiClient.ParameterToString(organizationId)); // query parameter } - //logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarQueryParams)}"); + logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarQueryParams)}"); if (createReportSubscriptionRequest != null && createReportSubscriptionRequest.GetType() != typeof(byte[])) { SdkTracker sdkTracker = new SdkTracker(); @@ -677,14 +709,30 @@ public ApiResponse CreateSubscriptionWithHttpInfo (CreateReportSubscript localVarPostBody = createReportSubscriptionRequest; // byte array } - //if (logUtility.IsMaskingEnabled(logger)) - //{ - // logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); - //} - //else - //{ - // logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); - //} + + bool isMLESupportedByCybsForApi = false; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "CreateSubscription,CreateSubscriptionAsync,CreateSubscriptionWithHttpInfo,CreateSubscriptionAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + if (logUtility.IsMaskingEnabled(logger)) + { + logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); + } + else + { + logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); + } // make the HTTP request @@ -771,7 +819,7 @@ public async System.Threading.Tasks.Task> CreateSubscription { localVarQueryParams.Add("organizationId", Configuration.ApiClient.ParameterToString(organizationId)); // query parameter } - //logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarQueryParams)}"); + logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarQueryParams)}"); if (createReportSubscriptionRequest != null && createReportSubscriptionRequest.GetType() != typeof(byte[])) { SdkTracker sdkTracker = new SdkTracker(); @@ -783,14 +831,29 @@ public async System.Threading.Tasks.Task> CreateSubscription localVarPostBody = createReportSubscriptionRequest; // byte array } - //if (logUtility.IsMaskingEnabled(logger)) - //{ - // logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); - //} - //else - //{ - // logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); - //} + bool isMLESupportedByCybsForApi = false; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "CreateSubscription,CreateSubscriptionAsync,CreateSubscriptionWithHttpInfo,CreateSubscriptionAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + if (logUtility.IsMaskingEnabled(logger)) + { + logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); + } + else + { + logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); + } // make the HTTP request @@ -875,12 +938,12 @@ public ApiResponse DeleteSubscriptionWithHttpInfo (string reportName, st { localVarPathParams.Add("reportName", Configuration.ApiClient.ParameterToString(reportName)); // path parameter } - //logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarPathParams)}"); + logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarPathParams)}"); if (organizationId != null) { localVarQueryParams.Add("organizationId", Configuration.ApiClient.ParameterToString(organizationId)); // query parameter } - //logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarQueryParams)}"); + logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarQueryParams)}"); if (Method.Delete == Method.Post) { localVarPostBody = "{}"; @@ -890,6 +953,22 @@ public ApiResponse DeleteSubscriptionWithHttpInfo (string reportName, st localVarPostBody = null; } + bool isMLESupportedByCybsForApi = false; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "DeleteSubscription,DeleteSubscriptionAsync,DeleteSubscriptionWithHttpInfo,DeleteSubscriptionAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + // make the HTTP request RestResponse localVarResponse = (RestResponse) Configuration.ApiClient.CallApi(localVarPath, @@ -975,12 +1054,12 @@ public async System.Threading.Tasks.Task> DeleteSubscription { localVarPathParams.Add("reportName", Configuration.ApiClient.ParameterToString(reportName)); // path parameter } - //logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarPathParams)}"); + logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarPathParams)}"); if (organizationId != null) { localVarQueryParams.Add("organizationId", Configuration.ApiClient.ParameterToString(organizationId)); // query parameter } - //logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarQueryParams)}"); + logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarQueryParams)}"); if (Method.Delete == Method.Post) { localVarPostBody = "{}"; @@ -990,6 +1069,22 @@ public async System.Threading.Tasks.Task> DeleteSubscription localVarPostBody = null; } + bool isMLESupportedByCybsForApi = false; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "DeleteSubscription,DeleteSubscriptionAsync,DeleteSubscriptionWithHttpInfo,DeleteSubscriptionAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + // make the HTTP request RestResponse localVarResponse = (RestResponse)await Configuration.ApiClient.CallApiAsync(localVarPath, @@ -1068,7 +1163,7 @@ public ApiResponse< ReportingV3ReportSubscriptionsGet200Response > GetAllSubscri { localVarQueryParams.Add("organizationId", Configuration.ApiClient.ParameterToString(organizationId)); // query parameter } - //logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarQueryParams)}"); + logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarQueryParams)}"); if (Method.Get == Method.Post) { localVarPostBody = "{}"; @@ -1078,6 +1173,22 @@ public ApiResponse< ReportingV3ReportSubscriptionsGet200Response > GetAllSubscri localVarPostBody = null; } + bool isMLESupportedByCybsForApi = false; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "GetAllSubscriptions,GetAllSubscriptionsAsync,GetAllSubscriptionsWithHttpInfo,GetAllSubscriptionsAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + // make the HTTP request RestResponse localVarResponse = (RestResponse) Configuration.ApiClient.CallApi(localVarPath, @@ -1157,7 +1268,7 @@ public async System.Threading.Tasks.Task { localVarPathParams.Add("reportName", Configuration.ApiClient.ParameterToString(reportName)); // path parameter } - //logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarPathParams)}"); + logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarPathParams)}"); if (organizationId != null) { localVarQueryParams.Add("organizationId", Configuration.ApiClient.ParameterToString(organizationId)); // query parameter } - //logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarQueryParams)}"); + logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarQueryParams)}"); if (Method.Get == Method.Post) { localVarPostBody = "{}"; @@ -1267,6 +1394,22 @@ public ApiResponse< ReportingV3ReportSubscriptionsGet200ResponseSubscriptions > localVarPostBody = null; } + bool isMLESupportedByCybsForApi = false; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "GetSubscription,GetSubscriptionAsync,GetSubscriptionWithHttpInfo,GetSubscriptionAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + // make the HTTP request RestResponse localVarResponse = (RestResponse) Configuration.ApiClient.CallApi(localVarPath, @@ -1354,12 +1497,12 @@ public async System.Threading.Tasks.Task CreateReportWithHttpInfo (CreateAdhocReportRequest cr { localVarQueryParams.Add("organizationId", Configuration.ApiClient.ParameterToString(organizationId)); // query parameter } - //logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarQueryParams)}"); + logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarQueryParams)}"); if (createAdhocReportRequest != null && createAdhocReportRequest.GetType() != typeof(byte[])) { SdkTracker sdkTracker = new SdkTracker(); @@ -407,14 +408,30 @@ public ApiResponse CreateReportWithHttpInfo (CreateAdhocReportRequest cr localVarPostBody = createAdhocReportRequest; // byte array } - //if (logUtility.IsMaskingEnabled(logger)) - //{ - // logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); - //} - //else - //{ - // logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); - //} + + bool isMLESupportedByCybsForApi = false; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "CreateReport,CreateReportAsync,CreateReportWithHttpInfo,CreateReportAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + if (logUtility.IsMaskingEnabled(logger)) + { + logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); + } + else + { + logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); + } // make the HTTP request @@ -501,7 +518,7 @@ public async System.Threading.Tasks.Task> CreateReportAsyncW { localVarQueryParams.Add("organizationId", Configuration.ApiClient.ParameterToString(organizationId)); // query parameter } - //logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarQueryParams)}"); + logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarQueryParams)}"); if (createAdhocReportRequest != null && createAdhocReportRequest.GetType() != typeof(byte[])) { SdkTracker sdkTracker = new SdkTracker(); @@ -513,14 +530,29 @@ public async System.Threading.Tasks.Task> CreateReportAsyncW localVarPostBody = createAdhocReportRequest; // byte array } - //if (logUtility.IsMaskingEnabled(logger)) - //{ - // logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); - //} - //else - //{ - // logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); - //} + bool isMLESupportedByCybsForApi = false; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "CreateReport,CreateReportAsync,CreateReportWithHttpInfo,CreateReportAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + if (logUtility.IsMaskingEnabled(logger)) + { + logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); + } + else + { + logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); + } // make the HTTP request @@ -609,12 +641,12 @@ public ApiResponse< ReportingV3ReportsIdGet200Response > GetReportByReportIdWith { localVarPathParams.Add("reportId", Configuration.ApiClient.ParameterToString(reportId)); // path parameter } - //logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarPathParams)}"); + logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarPathParams)}"); if (organizationId != null) { localVarQueryParams.Add("organizationId", Configuration.ApiClient.ParameterToString(organizationId)); // query parameter } - //logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarQueryParams)}"); + logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarQueryParams)}"); if (Method.Get == Method.Post) { localVarPostBody = "{}"; @@ -624,6 +656,22 @@ public ApiResponse< ReportingV3ReportsIdGet200Response > GetReportByReportIdWith localVarPostBody = null; } + bool isMLESupportedByCybsForApi = false; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "GetReportByReportId,GetReportByReportIdAsync,GetReportByReportIdWithHttpInfo,GetReportByReportIdAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + // make the HTTP request RestResponse localVarResponse = (RestResponse) Configuration.ApiClient.CallApi(localVarPath, @@ -712,12 +760,12 @@ public async System.Threading.Tasks.Task SearchReportsWithHttpInfo { localVarQueryParams.Add("reportStatus", Configuration.ApiClient.ParameterToString(reportStatus)); // query parameter } - //logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarQueryParams)}"); - //logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarQueryParams)}"); - //logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarQueryParams)}"); - //logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarQueryParams)}"); - //logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarQueryParams)}"); - //logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarQueryParams)}"); - //logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarQueryParams)}"); - //logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarQueryParams)}"); - //logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarQueryParams)}"); + logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarQueryParams)}"); + logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarQueryParams)}"); + logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarQueryParams)}"); + logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarQueryParams)}"); + logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarQueryParams)}"); + logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarQueryParams)}"); + logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarQueryParams)}"); + logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarQueryParams)}"); + logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarQueryParams)}"); if (Method.Get == Method.Post) { localVarPostBody = "{}"; @@ -888,6 +952,22 @@ public ApiResponse< ReportingV3ReportsGet200Response > SearchReportsWithHttpInfo localVarPostBody = null; } + bool isMLESupportedByCybsForApi = false; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "SearchReports,SearchReportsAsync,SearchReportsWithHttpInfo,SearchReportsAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + // make the HTTP request RestResponse localVarResponse = (RestResponse) Configuration.ApiClient.CallApi(localVarPath, @@ -1033,15 +1113,15 @@ public async System.Threading.Tasks.Task GetRetrievalDeta localVarPostBody = null; } + bool isMLESupportedByCybsForApi = false; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "GetRetrievalDetails,GetRetrievalDetailsAsync,GetRetrievalDetailsWithHttpInfo,GetRetrievalDetailsAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + // make the HTTP request RestResponse localVarResponse = (RestResponse) Configuration.ApiClient.CallApi(localVarPath, @@ -427,6 +444,22 @@ public async System.Threading.Tasks.Task GetRetrievalSu localVarPostBody = null; } + bool isMLESupportedByCybsForApi = false; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "GetRetrievalSummary,GetRetrievalSummaryAsync,GetRetrievalSummaryWithHttpInfo,GetRetrievalSummaryAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + // make the HTTP request RestResponse localVarResponse = (RestResponse) Configuration.ApiClient.CallApi(localVarPath, @@ -427,6 +444,22 @@ public async System.Threading.Tasks.Task AuthReversalWithHttp { localVarPathParams.Add("id", Configuration.ApiClient.ParameterToString(id)); // path parameter } - //logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarPathParams)}"); + logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarPathParams)}"); if (authReversalRequest != null && authReversalRequest.GetType() != typeof(byte[])) { SdkTracker sdkTracker = new SdkTracker(); @@ -338,14 +339,30 @@ public ApiResponse< PtsV2PaymentsReversalsPost201Response > AuthReversalWithHttp localVarPostBody = authReversalRequest; // byte array } - //if (logUtility.IsMaskingEnabled(logger)) - //{ - // logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); - //} - //else - //{ - // logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); - //} + + bool isMLESupportedByCybsForApi = true; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "AuthReversal,AuthReversalAsync,AuthReversalWithHttpInfo,AuthReversalAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + if (logUtility.IsMaskingEnabled(logger)) + { + logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); + } + else + { + logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); + } // make the HTTP request @@ -440,7 +457,7 @@ public async System.Threading.Tasks.Task MitReversalWithHttpI localVarPostBody = mitReversalRequest; // byte array } - //if (logUtility.IsMaskingEnabled(logger)) - //{ - // logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); - //} - //else - //{ - // logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); - //} + + bool isMLESupportedByCybsForApi = true; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "MitReversal,MitReversalAsync,MitReversalWithHttpInfo,MitReversalAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + if (logUtility.IsMaskingEnabled(logger)) + { + logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); + } + else + { + logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); + } // make the HTTP request @@ -652,14 +700,29 @@ public async System.Threading.Tasks.Task CreateSearchWithHttpInfo localVarPostBody = createSearchRequest; // byte array } - //if (logUtility.IsMaskingEnabled(logger)) - //{ - // logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); - //} - //else - //{ - // logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); - //} + + bool isMLESupportedByCybsForApi = false; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "CreateSearch,CreateSearchAsync,CreateSearchWithHttpInfo,CreateSearchAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + if (logUtility.IsMaskingEnabled(logger)) + { + logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); + } + else + { + logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); + } // make the HTTP request @@ -422,14 +439,29 @@ public async System.Threading.Tasks.Task GetSearchWithHttpInfo (st { localVarPathParams.Add("searchId", Configuration.ApiClient.ParameterToString(searchId)); // path parameter } - //logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarPathParams)}"); + logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarPathParams)}"); if (Method.Get == Method.Post) { localVarPostBody = "{}"; @@ -524,6 +556,22 @@ public ApiResponse< TssV2TransactionsPost201Response > GetSearchWithHttpInfo (st localVarPostBody = null; } + bool isMLESupportedByCybsForApi = false; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "GetSearch,GetSearchAsync,GetSearchWithHttpInfo,GetSearchAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + // make the HTTP request RestResponse localVarResponse = (RestResponse) Configuration.ApiClient.CallApi(localVarPath, @@ -609,7 +657,7 @@ public async System.Threading.Tasks.Task GetFileWithHttpInfo (string fileId, string organizati localVarPostBody = null; } + bool isMLESupportedByCybsForApi = false; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "GetFile,GetFileAsync,GetFileWithHttpInfo,GetFileAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + // make the HTTP request RestResponse localVarResponse = (RestResponse) Configuration.ApiClient.CallApi(localVarPath, @@ -448,6 +465,22 @@ public async System.Threading.Tasks.Task> GetFileAsyncWithHt localVarPostBody = null; } + bool isMLESupportedByCybsForApi = false; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "GetFile,GetFileAsync,GetFileWithHttpInfo,GetFileAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + // make the HTTP request RestResponse localVarResponse = (RestResponse)await Configuration.ApiClient.CallApiAsync(localVarPath, @@ -569,6 +602,22 @@ public ApiResponse< V1FileDetailsGet200Response > GetFileDetailWithHttpInfo (Dat localVarPostBody = null; } + bool isMLESupportedByCybsForApi = false; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "GetFileDetail,GetFileDetailAsync,GetFileDetailWithHttpInfo,GetFileDetailAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + // make the HTTP request RestResponse localVarResponse = (RestResponse) Configuration.ApiClient.CallApi(localVarPath, @@ -691,6 +740,22 @@ public async System.Threading.Tasks.Task ActivateSubscriptionWithHttpI { localVarPathParams.Add("id", Configuration.ApiClient.ParameterToString(id)); // path parameter } - //logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarPathParams)}"); + logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarPathParams)}"); if (Method.Post == Method.Post) { localVarPostBody = "{}"; @@ -591,6 +592,22 @@ public ApiResponse< ActivateSubscriptionResponse > ActivateSubscriptionWithHttpI localVarPostBody = null; } + bool isMLESupportedByCybsForApi = false; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "ActivateSubscription,ActivateSubscriptionAsync,ActivateSubscriptionWithHttpInfo,ActivateSubscriptionAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + // make the HTTP request RestResponse localVarResponse = (RestResponse) Configuration.ApiClient.CallApi(localVarPath, @@ -679,7 +696,7 @@ public async System.Threading.Tasks.Task CancelSubscriptionWithHttpInfo { localVarPathParams.Add("id", Configuration.ApiClient.ParameterToString(id)); // path parameter } - //logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarPathParams)}"); + logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarPathParams)}"); if (Method.Post == Method.Post) { localVarPostBody = "{}"; @@ -785,6 +818,22 @@ public ApiResponse< CancelSubscriptionResponse > CancelSubscriptionWithHttpInfo localVarPostBody = null; } + bool isMLESupportedByCybsForApi = false; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "CancelSubscription,CancelSubscriptionAsync,CancelSubscriptionWithHttpInfo,CancelSubscriptionAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + // make the HTTP request RestResponse localVarResponse = (RestResponse) Configuration.ApiClient.CallApi(localVarPath, @@ -873,7 +922,7 @@ public async System.Threading.Tasks.Task { localVarPathParams.Add("id", Configuration.ApiClient.ParameterToString(id)); // path parameter } - //logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarPathParams)}"); + logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarPathParams)}"); if (Method.Post == Method.Post) { localVarPostBody = "{}"; @@ -883,6 +932,22 @@ public async System.Threading.Tasks.Task localVarPostBody = null; } + bool isMLESupportedByCybsForApi = false; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "CancelSubscription,CancelSubscriptionAsync,CancelSubscriptionWithHttpInfo,CancelSubscriptionAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + // make the HTTP request RestResponse localVarResponse = (RestResponse)await Configuration.ApiClient.CallApiAsync(localVarPath, @@ -976,14 +1041,30 @@ public ApiResponse< CreateSubscriptionResponse > CreateSubscriptionWithHttpInfo localVarPostBody = createSubscriptionRequest; // byte array } - //if (logUtility.IsMaskingEnabled(logger)) - //{ - // logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); - //} - //else - //{ - // logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); - //} + + bool isMLESupportedByCybsForApi = false; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "CreateSubscription,CreateSubscriptionAsync,CreateSubscriptionWithHttpInfo,CreateSubscriptionAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + if (logUtility.IsMaskingEnabled(logger)) + { + logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); + } + else + { + logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); + } // make the HTTP request @@ -1080,14 +1161,29 @@ public async System.Threading.Tasks.Task localVarPostBody = createSubscriptionRequest; // byte array } - //if (logUtility.IsMaskingEnabled(logger)) - //{ - // logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); - //} - //else - //{ - // logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); - //} + bool isMLESupportedByCybsForApi = false; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "CreateSubscription,CreateSubscriptionAsync,CreateSubscriptionWithHttpInfo,CreateSubscriptionAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + if (logUtility.IsMaskingEnabled(logger)) + { + logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); + } + else + { + logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); + } // make the HTTP request @@ -1187,10 +1283,10 @@ public ApiResponse< GetAllSubscriptionsResponse > GetAllSubscriptionsWithHttpInf { localVarQueryParams.Add("status", Configuration.ApiClient.ParameterToString(status)); // query parameter } - //logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarQueryParams)}"); - //logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarQueryParams)}"); - //logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarQueryParams)}"); - //logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarQueryParams)}"); + logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarQueryParams)}"); + logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarQueryParams)}"); + logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarQueryParams)}"); + logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarQueryParams)}"); if (Method.Get == Method.Post) { localVarPostBody = "{}"; @@ -1200,6 +1296,22 @@ public ApiResponse< GetAllSubscriptionsResponse > GetAllSubscriptionsWithHttpInf localVarPostBody = null; } + bool isMLESupportedByCybsForApi = false; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "GetAllSubscriptions,GetAllSubscriptionsAsync,GetAllSubscriptionsWithHttpInfo,GetAllSubscriptionsAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + // make the HTTP request RestResponse localVarResponse = (RestResponse) Configuration.ApiClient.CallApi(localVarPath, @@ -1300,10 +1412,10 @@ public async System.Threading.Tasks.Task GetSubscriptionWithHttpInfo (strin { localVarPathParams.Add("id", Configuration.ApiClient.ParameterToString(id)); // path parameter } - //logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarPathParams)}"); + logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarPathParams)}"); if (Method.Get == Method.Post) { localVarPostBody = "{}"; @@ -1409,6 +1537,22 @@ public ApiResponse< GetSubscriptionResponse > GetSubscriptionWithHttpInfo (strin localVarPostBody = null; } + bool isMLESupportedByCybsForApi = false; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "GetSubscription,GetSubscriptionAsync,GetSubscriptionWithHttpInfo,GetSubscriptionAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + // make the HTTP request RestResponse localVarResponse = (RestResponse) Configuration.ApiClient.CallApi(localVarPath, @@ -1497,7 +1641,7 @@ public async System.Threading.Tasks.Task> G { localVarPathParams.Add("id", Configuration.ApiClient.ParameterToString(id)); // path parameter } - //logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarPathParams)}"); + logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarPathParams)}"); if (Method.Get == Method.Post) { localVarPostBody = "{}"; @@ -1507,6 +1651,22 @@ public async System.Threading.Tasks.Task> G localVarPostBody = null; } + bool isMLESupportedByCybsForApi = false; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "GetSubscription,GetSubscriptionAsync,GetSubscriptionWithHttpInfo,GetSubscriptionAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + // make the HTTP request RestResponse localVarResponse = (RestResponse)await Configuration.ApiClient.CallApiAsync(localVarPath, @@ -1590,6 +1750,22 @@ public ApiResponse< GetSubscriptionCodeResponse > GetSubscriptionCodeWithHttpInf localVarPostBody = null; } + bool isMLESupportedByCybsForApi = false; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "GetSubscriptionCode,GetSubscriptionCodeAsync,GetSubscriptionCodeWithHttpInfo,GetSubscriptionCodeAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + // make the HTTP request RestResponse localVarResponse = (RestResponse) Configuration.ApiClient.CallApi(localVarPath, @@ -1675,6 +1851,22 @@ public async System.Threading.Tasks.Task SuspendSubscriptionWithHttpInf { localVarPathParams.Add("id", Configuration.ApiClient.ParameterToString(id)); // path parameter } - //logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarPathParams)}"); + logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarPathParams)}"); if (Method.Post == Method.Post) { localVarPostBody = "{}"; @@ -1771,6 +1963,22 @@ public ApiResponse< SuspendSubscriptionResponse > SuspendSubscriptionWithHttpInf localVarPostBody = null; } + bool isMLESupportedByCybsForApi = false; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "SuspendSubscription,SuspendSubscriptionAsync,SuspendSubscriptionWithHttpInfo,SuspendSubscriptionAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + // make the HTTP request RestResponse localVarResponse = (RestResponse) Configuration.ApiClient.CallApi(localVarPath, @@ -1859,7 +2067,7 @@ public async System.Threading.Tasks.Task UpdateSubscriptionWithHttpInfo { localVarPathParams.Add("id", Configuration.ApiClient.ParameterToString(id)); // path parameter } - //logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarPathParams)}"); + logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarPathParams)}"); if (updateSubscription != null && updateSubscription.GetType() != typeof(byte[])) { SdkTracker sdkTracker = new SdkTracker(); @@ -1975,14 +2199,30 @@ public ApiResponse< UpdateSubscriptionResponse > UpdateSubscriptionWithHttpInfo localVarPostBody = updateSubscription; // byte array } - //if (logUtility.IsMaskingEnabled(logger)) - //{ - // logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); - //} - //else - //{ - // logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); - //} + + bool isMLESupportedByCybsForApi = false; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "UpdateSubscription,UpdateSubscriptionAsync,UpdateSubscriptionWithHttpInfo,UpdateSubscriptionAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + if (logUtility.IsMaskingEnabled(logger)) + { + logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); + } + else + { + logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); + } // make the HTTP request @@ -2080,7 +2320,7 @@ public async System.Threading.Tasks.Task { localVarPathParams.Add("id", Configuration.ApiClient.ParameterToString(id)); // path parameter } - //logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarPathParams)}"); + logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarPathParams)}"); if (updateSubscription != null && updateSubscription.GetType() != typeof(byte[])) { SdkTracker sdkTracker = new SdkTracker(); @@ -2092,14 +2332,29 @@ public async System.Threading.Tasks.Task localVarPostBody = updateSubscription; // byte array } - //if (logUtility.IsMaskingEnabled(logger)) - //{ - // logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); - //} - //else - //{ - // logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); - //} + bool isMLESupportedByCybsForApi = false; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "UpdateSubscription,UpdateSubscriptionAsync,UpdateSubscriptionWithHttpInfo,UpdateSubscriptionAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + if (logUtility.IsMaskingEnabled(logger)) + { + logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); + } + else + { + logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); + } // make the HTTP request diff --git a/Api/TaxesApi.cs b/Api/TaxesApi.cs index 2bd47c17..df68290a 100644 --- a/Api/TaxesApi.cs +++ b/Api/TaxesApi.cs @@ -18,6 +18,7 @@ using NLog; using AuthenticationSdk.util; using CyberSource.Utilities.Tracking; +using AuthenticationSdk.core; namespace CyberSource.Api { @@ -325,14 +326,30 @@ public ApiResponse< VasV2PaymentsPost201Response > CalculateTaxWithHttpInfo (Tax localVarPostBody = taxRequest; // byte array } - //if (logUtility.IsMaskingEnabled(logger)) - //{ - // logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); - //} - //else - //{ - // logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); - //} + + bool isMLESupportedByCybsForApi = false; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "CalculateTax,CalculateTaxAsync,CalculateTaxWithHttpInfo,CalculateTaxAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + if (logUtility.IsMaskingEnabled(logger)) + { + logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); + } + else + { + logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); + } // make the HTTP request @@ -426,14 +443,29 @@ public async System.Threading.Tasks.Task VoidTaxWithHttpInfo (VoidTaxReques { localVarPathParams.Add("id", Configuration.ApiClient.ParameterToString(id)); // path parameter } - //logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarPathParams)}"); + logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarPathParams)}"); if (voidTaxRequest != null && voidTaxRequest.GetType() != typeof(byte[])) { SdkTracker sdkTracker = new SdkTracker(); @@ -538,14 +570,30 @@ public ApiResponse< VasV2TaxVoid200Response > VoidTaxWithHttpInfo (VoidTaxReques localVarPostBody = voidTaxRequest; // byte array } - //if (logUtility.IsMaskingEnabled(logger)) - //{ - // logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); - //} - //else - //{ - // logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); - //} + + bool isMLESupportedByCybsForApi = false; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "VoidTax,VoidTaxAsync,VoidTaxWithHttpInfo,VoidTaxAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + if (logUtility.IsMaskingEnabled(logger)) + { + logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); + } + else + { + logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); + } // make the HTTP request @@ -640,7 +688,7 @@ public async System.Threading.Tasks.Task> V { localVarPathParams.Add("id", Configuration.ApiClient.ParameterToString(id)); // path parameter } - //logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarPathParams)}"); + logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarPathParams)}"); if (voidTaxRequest != null && voidTaxRequest.GetType() != typeof(byte[])) { SdkTracker sdkTracker = new SdkTracker(); @@ -652,14 +700,29 @@ public async System.Threading.Tasks.Task> V localVarPostBody = voidTaxRequest; // byte array } - //if (logUtility.IsMaskingEnabled(logger)) - //{ - // logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); - //} - //else - //{ - // logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); - //} + bool isMLESupportedByCybsForApi = false; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "VoidTax,VoidTaxAsync,VoidTaxWithHttpInfo,VoidTaxAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + if (logUtility.IsMaskingEnabled(logger)) + { + logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); + } + else + { + logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); + } // make the HTTP request diff --git a/Api/TokenApi.cs b/Api/TokenApi.cs index e209d024..abb4db50 100644 --- a/Api/TokenApi.cs +++ b/Api/TokenApi.cs @@ -18,6 +18,7 @@ using NLog; using AuthenticationSdk.util; using CyberSource.Utilities.Tracking; +using AuthenticationSdk.core; namespace CyberSource.Api { @@ -290,7 +291,7 @@ public ApiResponse< string > PostTokenPaymentCredentialsWithHttpInfo (string tok { localVarPathParams.Add("tokenId", Configuration.ApiClient.ParameterToString(tokenId)); // path parameter } - //logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarPathParams)}"); + logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarPathParams)}"); if (profileId != null) { localVarHeaderParams.Add("profile-id", Configuration.ApiClient.ParameterToString(profileId)); // header parameter @@ -306,14 +307,30 @@ public ApiResponse< string > PostTokenPaymentCredentialsWithHttpInfo (string tok localVarPostBody = postPaymentCredentialsRequest; // byte array } - //if (logUtility.IsMaskingEnabled(logger)) - //{ - // logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); - //} - //else - //{ - // logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); - //} + + bool isMLESupportedByCybsForApi = false; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "PostTokenPaymentCredentials,PostTokenPaymentCredentialsAsync,PostTokenPaymentCredentialsWithHttpInfo,PostTokenPaymentCredentialsAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + if (logUtility.IsMaskingEnabled(logger)) + { + logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); + } + else + { + logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); + } // make the HTTP request @@ -410,7 +427,7 @@ public async System.Threading.Tasks.Task> PostTokenPaymentCr { localVarPathParams.Add("tokenId", Configuration.ApiClient.ParameterToString(tokenId)); // path parameter } - //logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarPathParams)}"); + logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarPathParams)}"); if (profileId != null) { localVarHeaderParams.Add("profile-id", Configuration.ApiClient.ParameterToString(profileId)); // header parameter @@ -426,14 +443,29 @@ public async System.Threading.Tasks.Task> PostTokenPaymentCr localVarPostBody = postPaymentCredentialsRequest; // byte array } - //if (logUtility.IsMaskingEnabled(logger)) - //{ - // logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); - //} - //else - //{ - // logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); - //} + bool isMLESupportedByCybsForApi = false; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "PostTokenPaymentCredentials,PostTokenPaymentCredentialsAsync,PostTokenPaymentCredentialsWithHttpInfo,PostTokenPaymentCredentialsAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + if (logUtility.IsMaskingEnabled(logger)) + { + logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); + } + else + { + logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); + } // make the HTTP request diff --git a/Api/TransactionBatchesApi.cs b/Api/TransactionBatchesApi.cs index 049b1c5c..6d26c61d 100644 --- a/Api/TransactionBatchesApi.cs +++ b/Api/TransactionBatchesApi.cs @@ -18,6 +18,7 @@ using NLog; using AuthenticationSdk.util; using CyberSource.Utilities.Tracking; +using AuthenticationSdk.core; namespace CyberSource.Api { @@ -391,6 +392,22 @@ public ApiResponse GetTransactionBatchDetailsWithHttpInfo (string id, Da localVarPostBody = null; } + bool isMLESupportedByCybsForApi = false; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "GetTransactionBatchDetails,GetTransactionBatchDetailsAsync,GetTransactionBatchDetailsWithHttpInfo,GetTransactionBatchDetailsAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + // make the HTTP request RestResponse localVarResponse = (RestResponse) Configuration.ApiClient.CallApi(localVarPath, @@ -500,6 +517,22 @@ public async System.Threading.Tasks.Task> GetTransactionBatc localVarPostBody = null; } + bool isMLESupportedByCybsForApi = false; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "GetTransactionBatchDetails,GetTransactionBatchDetailsAsync,GetTransactionBatchDetailsWithHttpInfo,GetTransactionBatchDetailsAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + // make the HTTP request RestResponse localVarResponse = (RestResponse)await Configuration.ApiClient.CallApiAsync(localVarPath, @@ -594,6 +627,22 @@ public ApiResponse< PtsV1TransactionBatchesIdGet200Response > GetTransactionBatc localVarPostBody = null; } + bool isMLESupportedByCybsForApi = false; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "GetTransactionBatchId,GetTransactionBatchIdAsync,GetTransactionBatchIdWithHttpInfo,GetTransactionBatchIdAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + // make the HTTP request RestResponse localVarResponse = (RestResponse) Configuration.ApiClient.CallApi(localVarPath, @@ -689,6 +738,22 @@ public async System.Threading.Tasks.Task GetTransactionBatche localVarPostBody = null; } + bool isMLESupportedByCybsForApi = false; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "GetTransactionBatches,GetTransactionBatchesAsync,GetTransactionBatchesWithHttpInfo,GetTransactionBatchesAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + // make the HTTP request RestResponse localVarResponse = (RestResponse) Configuration.ApiClient.CallApi(localVarPath, @@ -903,6 +984,22 @@ public async System.Threading.Tasks.Task GetTransactionWithHttpInfo localVarPostBody = null; } + bool isMLESupportedByCybsForApi = false; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "GetTransaction,GetTransactionAsync,GetTransactionWithHttpInfo,GetTransactionAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + // make the HTTP request RestResponse localVarResponse = (RestResponse) Configuration.ApiClient.CallApi(localVarPath, @@ -377,6 +394,22 @@ public async System.Threading.Tasks.Task GetPaymentCredentialsForTransientTokenWithHttpInfo localVarPostBody = null; } + bool isMLESupportedByCybsForApi = false; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "GetPaymentCredentialsForTransientToken,GetPaymentCredentialsForTransientTokenAsync,GetPaymentCredentialsForTransientTokenWithHttpInfo,GetPaymentCredentialsForTransientTokenAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + // make the HTTP request RestResponse localVarResponse = (RestResponse) Configuration.ApiClient.CallApi(localVarPath, @@ -418,6 +435,22 @@ public async System.Threading.Tasks.Task> GetPaymentCredenti localVarPostBody = null; } + bool isMLESupportedByCybsForApi = false; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "GetPaymentCredentialsForTransientToken,GetPaymentCredentialsForTransientTokenAsync,GetPaymentCredentialsForTransientTokenWithHttpInfo,GetPaymentCredentialsForTransientTokenAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + // make the HTTP request RestResponse localVarResponse = (RestResponse)await Configuration.ApiClient.CallApiAsync(localVarPath, @@ -508,6 +541,22 @@ public ApiResponse GetTransactionForTransientTokenWithHttpInfo (string t localVarPostBody = null; } + bool isMLESupportedByCybsForApi = false; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "GetTransactionForTransientToken,GetTransactionForTransientTokenAsync,GetTransactionForTransientTokenWithHttpInfo,GetTransactionForTransientTokenAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + // make the HTTP request RestResponse localVarResponse = (RestResponse) Configuration.ApiClient.CallApi(localVarPath, @@ -601,6 +650,22 @@ public async System.Threading.Tasks.Task> GetTransactionForT localVarPostBody = null; } + bool isMLESupportedByCybsForApi = false; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "GetTransactionForTransientToken,GetTransactionForTransientTokenAsync,GetTransactionForTransientTokenWithHttpInfo,GetTransactionForTransientTokenAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + // make the HTTP request RestResponse localVarResponse = (RestResponse)await Configuration.ApiClient.CallApiAsync(localVarPath, diff --git a/Api/UnifiedCheckoutCaptureContextApi.cs b/Api/UnifiedCheckoutCaptureContextApi.cs index 8f64a2af..c330215c 100644 --- a/Api/UnifiedCheckoutCaptureContextApi.cs +++ b/Api/UnifiedCheckoutCaptureContextApi.cs @@ -18,6 +18,7 @@ using NLog; using AuthenticationSdk.util; using CyberSource.Utilities.Tracking; +using AuthenticationSdk.core; namespace CyberSource.Api { @@ -279,14 +280,30 @@ public ApiResponse< string > GenerateUnifiedCheckoutCaptureContextWithHttpInfo ( localVarPostBody = generateUnifiedCheckoutCaptureContextRequest; // byte array } - //if (logUtility.IsMaskingEnabled(logger)) - //{ - // logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); - //} - //else - //{ - // logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); - //} + + bool isMLESupportedByCybsForApi = false; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "GenerateUnifiedCheckoutCaptureContext,GenerateUnifiedCheckoutCaptureContextAsync,GenerateUnifiedCheckoutCaptureContextWithHttpInfo,GenerateUnifiedCheckoutCaptureContextAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + if (logUtility.IsMaskingEnabled(logger)) + { + logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); + } + else + { + logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); + } // make the HTTP request @@ -380,14 +397,29 @@ public async System.Threading.Tasks.Task> GenerateUnifiedChe localVarPostBody = generateUnifiedCheckoutCaptureContextRequest; // byte array } - //if (logUtility.IsMaskingEnabled(logger)) - //{ - // logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); - //} - //else - //{ - // logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); - //} + bool isMLESupportedByCybsForApi = false; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "GenerateUnifiedCheckoutCaptureContext,GenerateUnifiedCheckoutCaptureContextAsync,GenerateUnifiedCheckoutCaptureContextWithHttpInfo,GenerateUnifiedCheckoutCaptureContextAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + if (logUtility.IsMaskingEnabled(logger)) + { + logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); + } + else + { + logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); + } // make the HTTP request diff --git a/Api/UserManagementApi.cs b/Api/UserManagementApi.cs index 2453d856..6f681fe1 100644 --- a/Api/UserManagementApi.cs +++ b/Api/UserManagementApi.cs @@ -18,6 +18,7 @@ using NLog; using AuthenticationSdk.util; using CyberSource.Utilities.Tracking; +using AuthenticationSdk.core; namespace CyberSource.Api { @@ -309,6 +310,22 @@ public ApiResponse< UmsV1UsersGet200Response > GetUsersWithHttpInfo (string orga localVarPostBody = null; } + bool isMLESupportedByCybsForApi = false; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "GetUsers,GetUsersAsync,GetUsersWithHttpInfo,GetUsersAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + // make the HTTP request RestResponse localVarResponse = (RestResponse) Configuration.ApiClient.CallApi(localVarPath, @@ -419,6 +436,22 @@ public async System.Threading.Tasks.Task> localVarPostBody = null; } + bool isMLESupportedByCybsForApi = false; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "GetUsers,GetUsersAsync,GetUsersWithHttpInfo,GetUsersAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + // make the HTTP request RestResponse localVarResponse = (RestResponse)await Configuration.ApiClient.CallApiAsync(localVarPath, diff --git a/Api/UserManagementSearchApi.cs b/Api/UserManagementSearchApi.cs index e4d7a771..b71001c8 100644 --- a/Api/UserManagementSearchApi.cs +++ b/Api/UserManagementSearchApi.cs @@ -18,6 +18,7 @@ using NLog; using AuthenticationSdk.util; using CyberSource.Utilities.Tracking; +using AuthenticationSdk.core; namespace CyberSource.Api { @@ -279,14 +280,30 @@ public ApiResponse< UmsV1UsersGet200Response > SearchUsersWithHttpInfo (SearchRe localVarPostBody = searchRequest; // byte array } - //if (logUtility.IsMaskingEnabled(logger)) - //{ - // logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); - //} - //else - //{ - // logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); - //} + + bool isMLESupportedByCybsForApi = false; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "SearchUsers,SearchUsersAsync,SearchUsersWithHttpInfo,SearchUsersAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + if (logUtility.IsMaskingEnabled(logger)) + { + logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); + } + else + { + logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); + } // make the HTTP request @@ -380,14 +397,29 @@ public async System.Threading.Tasks.Task> localVarPostBody = searchRequest; // byte array } - //if (logUtility.IsMaskingEnabled(logger)) - //{ - // logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); - //} - //else - //{ - // logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); - //} + bool isMLESupportedByCybsForApi = false; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "SearchUsers,SearchUsersAsync,SearchUsersWithHttpInfo,SearchUsersAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + if (logUtility.IsMaskingEnabled(logger)) + { + logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); + } + else + { + logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); + } // make the HTTP request diff --git a/Api/VerificationApi.cs b/Api/VerificationApi.cs index f588f3f4..718d1c30 100644 --- a/Api/VerificationApi.cs +++ b/Api/VerificationApi.cs @@ -18,6 +18,7 @@ using NLog; using AuthenticationSdk.util; using CyberSource.Utilities.Tracking; +using AuthenticationSdk.core; namespace CyberSource.Api { @@ -321,14 +322,30 @@ public ApiResponse< RiskV1ExportComplianceInquiriesPost201Response > ValidateExp localVarPostBody = validateExportComplianceRequest; // byte array } - //if (logUtility.IsMaskingEnabled(logger)) - //{ - // logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); - //} - //else - //{ - // logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); - //} + + bool isMLESupportedByCybsForApi = false; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "ValidateExportCompliance,ValidateExportComplianceAsync,ValidateExportComplianceWithHttpInfo,ValidateExportComplianceAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + if (logUtility.IsMaskingEnabled(logger)) + { + logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); + } + else + { + logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); + } // make the HTTP request @@ -422,14 +439,29 @@ public async System.Threading.Tasks.Task VerifyCustomerAd localVarPostBody = verifyCustomerAddressRequest; // byte array } - //if (logUtility.IsMaskingEnabled(logger)) - //{ - // logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); - //} - //else - //{ - // logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); - //} + + bool isMLESupportedByCybsForApi = false; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "VerifyCustomerAddress,VerifyCustomerAddressAsync,VerifyCustomerAddressWithHttpInfo,VerifyCustomerAddressAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + if (logUtility.IsMaskingEnabled(logger)) + { + logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); + } + else + { + logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); + } // make the HTTP request @@ -622,14 +670,29 @@ public async System.Threading.Tasks.Task MitVoidWithHttpInfo (Mit localVarPostBody = mitVoidRequest; // byte array } - //if (logUtility.IsMaskingEnabled(logger)) - //{ - // logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); - //} - //else - //{ - // logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); - //} + + bool isMLESupportedByCybsForApi = true; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "MitVoid,MitVoidAsync,MitVoidWithHttpInfo,MitVoidAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + if (logUtility.IsMaskingEnabled(logger)) + { + logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); + } + else + { + logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); + } // make the HTTP request @@ -564,14 +581,29 @@ public async System.Threading.Tasks.Task VoidCaptureWithHttpInfo localVarPostBody = voidCaptureRequest; // byte array } - //if (logUtility.IsMaskingEnabled(logger)) - //{ - // logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); - //} - //else - //{ - // logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); - //} + + bool isMLESupportedByCybsForApi = true; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "VoidCapture,VoidCaptureAsync,VoidCaptureWithHttpInfo,VoidCaptureAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + if (logUtility.IsMaskingEnabled(logger)) + { + logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); + } + else + { + logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); + } // make the HTTP request @@ -790,14 +838,29 @@ public async System.Threading.Tasks.Task VoidCreditWithHttpInfo ( localVarPostBody = voidCreditRequest; // byte array } - //if (logUtility.IsMaskingEnabled(logger)) - //{ - // logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); - //} - //else - //{ - // logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); - //} + + bool isMLESupportedByCybsForApi = true; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "VoidCredit,VoidCreditAsync,VoidCreditWithHttpInfo,VoidCreditAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + if (logUtility.IsMaskingEnabled(logger)) + { + logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); + } + else + { + logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); + } // make the HTTP request @@ -1016,14 +1095,29 @@ public async System.Threading.Tasks.Task VoidPaymentWithHttpInfo localVarPostBody = voidPaymentRequest; // byte array } - //if (logUtility.IsMaskingEnabled(logger)) - //{ - // logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); - //} - //else - //{ - // logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); - //} + + bool isMLESupportedByCybsForApi = true; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "VoidPayment,VoidPaymentAsync,VoidPaymentWithHttpInfo,VoidPaymentAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + if (logUtility.IsMaskingEnabled(logger)) + { + logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); + } + else + { + logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); + } // make the HTTP request @@ -1242,14 +1352,29 @@ public async System.Threading.Tasks.Task VoidRefundWithHttpInfo ( localVarPostBody = voidRefundRequest; // byte array } - //if (logUtility.IsMaskingEnabled(logger)) - //{ - // logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); - //} - //else - //{ - // logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); - //} + + bool isMLESupportedByCybsForApi = true; + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "VoidRefund,VoidRefundAsync,VoidRefundWithHttpInfo,VoidRefundAsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + if (logUtility.IsMaskingEnabled(logger)) + { + logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); + } + else + { + logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); + } // make the HTTP request @@ -1468,14 +1609,29 @@ public async System.Threading.Tasks.Task merchConfigDictObj = null + IReadOnlyDictionary merchConfigDictObj = null, + Dictionary mapToControlMLEonAPI = null ) { SetApiClientUsingDefault(apiClient); @@ -99,6 +100,7 @@ public Configuration(ApiClient apiClient = null, DateTimeFormat = dateTimeFormat; Timeout = timeout; MerchantConfigDictionaryObj = merchConfigDictObj; + MapToControlMLEonAPI = mapToControlMLEonAPI; } private string GetClientId() @@ -194,6 +196,8 @@ public void SetApiClientUsingDefault (ApiClient apiClient = null) /// public Dictionary DefaultHeader { get; set; } = new Dictionary(); + public Dictionary MapToControlMLEonAPI { get; set; } = new Dictionary(); + /// /// Add default header. /// diff --git a/MLE.md b/MLE.md new file mode 100644 index 00000000..c7b25ac7 --- /dev/null +++ b/MLE.md @@ -0,0 +1,114 @@ +[![Generic badge](https://img.shields.io/badge/MLE-NEW-GREEN.svg)](https://shields.io/) + +# Message Level Encryption (MLE) Feature + +This feature provides an implementation of Message Level Encryption (MLE) for APIs provided by CyberSource, integrated within our SDK. This feature ensures secure communication by encrypting messages at the application level before they are sent over the network. + +## Configuration + +### Global MLE Configuration + +In the `merchantConfig` object, set the `useMLEGlobally` variable to enable or disable MLE for all supported APIs for the Rest SDK. + +- **Variable**: `useMLEGlobally` +- **Type**: `boolean` +- **Default**: `false` +- **Description**: Enables MLE globally for all APIs when set to `true`. If set to `true`, it will enable MLE for all API calls that support MLE by CyberSource, unless overridden by `mapToControlMLEonAPI`. + +### API-level MLE Control + +Optionally, you can control the MLE feature at the API level using the `mapToControlMLEonAPI` variable in the `merchantConfig` object. + +- **Variable**: `mapToControlMLEonAPI` +- **Type**: `Dictionary` +- **Description**: Overrides the global MLE setting for specific APIs. The key is the function name of the API in the SDK, and the value is a boolean indicating whether MLE should be enabled (`true`) or disabled (`false`) for that specific API call. + +### MLE Key Alias + +Another optional parameter for MLE is `mleKeyAlias`, which specifies the key alias used to retrieve the MLE certificate from the JWT P12 file. + +- **Variable**: `mleKeyAlias` +- **Type**: `string` +- **Default**: `CyberSource_SJC_US` +- **Description**: By default, CyberSource uses the `CyberSource_SJC_US` public certificate to encrypt the payload. However, users can override this default value by setting their own key alias. + +## Notes +- If `useMLEGlobally` is set to true, it will enable MLE for all API calls that support MLE by CyberSource, unless overridden by mapToControlMLEonAPI. +- If `mapToControlMLEonAPI` is not provided or does not contain a specific API function name, the global useMLEGlobally setting will be applied. +- The `mleKeyAlias` parameter is optional and defaults to CyberSource_SJC_US if not specified by the user. Users can override this default value by setting their own key alias. + +## Example Configuration + + private readonly Dictionary _configurationDictionary = new Dictionary(); + + public Dictionary GetConfiguration() + { + _configurationDictionary.Add("authenticationType", "JWT"); + _configurationDictionary.Add("useMLEGlobally", "true"); //globally MLE will be enabled for all the MLE supported APIs by Cybs in SDK + _configurationDictionary.Add("mleKeyAlias", "CyberSource_SJC_US"); //this is optional paramter, not required to set the parameter/value if custom value is not required for MLE key alias. Default value is "CyberSource_SJC_US". + //other properties + } + +Or + + private readonly Dictionary _configurationDictionary = new Dictionary(); + private readonly Dictionary _configurationDictionaryforMLE = new Dictionary(); + + public Dictionary GetMapToControlMLE() + { + _configurationDictionaryforMLE.Add("CreatePayment", true); //CreatePayment function will have MLE=true i.e. (/pts/v2/payments POST API) + _configurationDictionaryforMLE.Add("CapturePayment", false); //capturePayment function will have MLE=false i.e. (/pts/v2/payments/{id}/captures POST API) + + return _configurationDictionaryforMLE; + } + + public Dictionary GetConfiguration() + { + _configurationDictionary.Add("authenticationType", "JWT"); + _configurationDictionary.Add("useMLEGlobally", "true"); //globally MLE will be enabled for all the MLE supported APIs by Cybs in SDK except the APIs marked false in GetMapToControlMLE. + _configurationDictionary.Add("mleKeyAlias", "CyberSource_SJC_US"); //this is optional paramter, not required to set the parameter/value if custom value is not required for MLE key alias. Default value is "CyberSource_SJC_US". + //other properties + } + +Or + + private readonly Dictionary _configurationDictionary = new Dictionary(); + private readonly Dictionary _configurationDictionaryforMLE = new Dictionary(); + + public Dictionary GetMapToControlMLE() + { + _configurationDictionaryforMLE.Add("CreatePayment", true); //CreatePayment function will have MLE=true i.e. (/pts/v2/payments POST API) + _configurationDictionaryforMLE.Add("CapturePayment", false); //capturePayment function will have MLE=false i.e. (/pts/v2/payments/{id}/captures POST API) + + return _configurationDictionaryforMLE; + } + + public Dictionary GetConfiguration() + { + _configurationDictionary.Add("authenticationType", "JWT"); + _configurationDictionary.Add("useMLEGlobally", "false"); //globally MLE will be disabled for all the MLE supported APIs by Cybs in SDK, the APIs marked true in GetMapToControlMLE will only have MLE enabled. + _configurationDictionary.Add("mleKeyAlias", "CyberSource_SJC_US"); //this is optional paramter, not required to set the parameter/value if custom value is not required for MLE key alias. Default value is "CyberSource_SJC_US". + //other properties + } + +In the above examples: +- MLE is enabled/disabled globally (`useMLEGlobally` is true/false). +- `apiFunctionName1` i.e. (CapturePayment) will have MLE disabled/enabled based on value provided. +- `apiFunctionName2` i.e. (CreatePayment) will have MLE enabled. +- `mleKeyAlias` is set to `Custom_Key_Alias`, overriding the default value. + +Please refer given link for sample codes with MLE: +https://github.com/CyberSource/cybersource-rest-samples-csharp/tree/master/Source/Samples/MLEFeature + +## Additional Information + +### API Support +- MLE is initially designed to support a few APIs. +- It can be extended to support more APIs in the future based on requirements and updates. +### Authentication Type +- MLE is only supported with `JWT (JSON Web Token)` authentication type within the SDK. +### Using the SDK +To use the MLE feature in the SDK, configure the `merchantConfig` object as shown above and pass it to the SDK initialization. + +## Contact +For any issues or further assistance, please open an issue on the GitHub repository or contact our support team. diff --git a/README.md b/README.md index 8ac7633a..a3800af3 100644 --- a/README.md +++ b/README.md @@ -81,6 +81,13 @@ More information about this new logging framework can be found in this file : [L ## Features +### Message Level Encryption (MLE) Feature +[![Generic badge](https://img.shields.io/badge/MLE-NEW-GREEN.svg)](https://shields.io/) + +This feature provides an implementation of Message Level Encryption (MLE) for APIs provided by CyberSource, integrated within our SDK. This feature ensures secure communication by encrypting messages at the application level before they are sent over the network. + +More information about this new MLE feature can be found in this file : [MLE.md](MLE.md) + ### MetaKey Support A Meta Key is a single key that can be used by one, some, or all merchants (or accounts, if created by a Portfolio user) in the portfolio. diff --git a/generator/cybersource-csharp-template/Configuration.mustache b/generator/cybersource-csharp-template/Configuration.mustache index 88aeb835..63703f75 100644 --- a/generator/cybersource-csharp-template/Configuration.mustache +++ b/generator/cybersource-csharp-template/Configuration.mustache @@ -40,7 +40,8 @@ namespace {{packageName}}.Client string dateTimeFormat = null, int timeout = 100000, string userAgent = "{{#httpUserAgent}}{{.}}{{/httpUserAgent}}{{^httpUserAgent}}Swagger-Codegen/{{packageVersion}}/csharp{{/httpUserAgent}}", - IReadOnlyDictionary merchConfigDictObj = null + IReadOnlyDictionary merchConfigDictObj = null, + Dictionary mapToControlMLEonAPI = null ) { SetApiClientUsingDefault(apiClient); @@ -90,6 +91,7 @@ namespace {{packageName}}.Client DateTimeFormat = dateTimeFormat; Timeout = {{#netStandard}}TimeSpan.FromMilliseconds({{/netStandard}}timeout{{#netStandard}}){{/netStandard}}; MerchantConfigDictionaryObj = merchConfigDictObj; + MapToControlMLEonAPI = mapToControlMLEonAPI; } private string GetClientId() @@ -187,6 +189,8 @@ namespace {{packageName}}.Client /// public Dictionary DefaultHeader { get; set; } = new Dictionary(); + public Dictionary MapToControlMLEonAPI { get; set; } = new Dictionary(); + /// /// Add default header. /// diff --git a/generator/cybersource-csharp-template/api.mustache b/generator/cybersource-csharp-template/api.mustache index 136df31c..fe04c632 100644 --- a/generator/cybersource-csharp-template/api.mustache +++ b/generator/cybersource-csharp-template/api.mustache @@ -15,6 +15,7 @@ using {{packageName}}.Client; using NLog; using AuthenticationSdk.util; using CyberSource.Utilities.Tracking; +using AuthenticationSdk.core; namespace {{packageName}}.{{apiPackage}} { @@ -324,14 +325,6 @@ namespace {{packageName}}.{{apiPackage}} localVarPostBody = {{paramName}}; // byte array } - //if (logUtility.IsMaskingEnabled(logger)) - //{ - // logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); - //} - //else - //{ - // logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); - //} {{/bodyParam}} {{^bodyParam}} if (Method.{{httpMethod}} == Method.POST) @@ -344,6 +337,32 @@ namespace {{packageName}}.{{apiPackage}} } {{/bodyParam}} + bool isMLESupportedByCybsForApi = {{#vendorExtensions.x-devcenter-metaData.isMLEsupported}}true;{{/vendorExtensions.x-devcenter-metaData.isMLEsupported}}{{^vendorExtensions.x-devcenter-metaData.isMLEsupported}}false;{{/vendorExtensions.x-devcenter-metaData.isMLEsupported}} + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "{{operationId}},{{operationId}}Async,{{operationId}}WithHttpInfo,{{operationId}}AsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + {{#bodyParam}} + if (logUtility.IsMaskingEnabled(logger)) + { + logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); + } + else + { + logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); + } + {{/bodyParam}} + {{#authMethods}} // authentication ({{name}}) required {{#isApiKey}} @@ -513,15 +532,6 @@ namespace {{packageName}}.{{apiPackage}} { localVarPostBody = {{paramName}}; // byte array } - - //if (logUtility.IsMaskingEnabled(logger)) - //{ - // logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); - //} - //else - //{ - // logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); - //} {{/bodyParam}} {{^bodyParam}} if (Method.{{httpMethod}} == Method.POST) @@ -534,6 +544,32 @@ namespace {{packageName}}.{{apiPackage}} } {{/bodyParam}} + bool isMLESupportedByCybsForApi = {{#vendorExtensions.x-devcenter-metaData.isMLEsupported}}true;{{/vendorExtensions.x-devcenter-metaData.isMLEsupported}}{{^vendorExtensions.x-devcenter-metaData.isMLEsupported}}false;{{/vendorExtensions.x-devcenter-metaData.isMLEsupported}} + MerchantConfig merchantConfig = new MerchantConfig(Configuration.MerchantConfigDictionaryObj, Configuration.MapToControlMLEonAPI); + if (MLEUtility.CheckIsMLEForAPI(merchantConfig, isMLESupportedByCybsForApi, "{{operationId}},{{operationId}}Async,{{operationId}}WithHttpInfo,{{operationId}}AsyncWithHttpInfo")) + { + try + { + localVarPostBody = MLEUtility.EncryptRequestPayload(merchantConfig, localVarPostBody); + } + catch (Exception e) + { + logger.Error("Failed to encrypt request body {}", e.Message, e); + throw new ApiException(400,"Failed to encrypt request body : " + e.Message); + } + } + + {{#bodyParam}} + if (logUtility.IsMaskingEnabled(logger)) + { + logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}"); + } + else + { + logger.Debug($"HTTP Request Body :\n{localVarPostBody}"); + } + {{/bodyParam}} + {{#authMethods}} // authentication ({{name}}) required {{#isApiKey}}