Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/add mle #196

Open
wants to merge 16 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
160 changes: 144 additions & 16 deletions Api/BatchesApi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
using NLog;
using AuthenticationSdk.util;
using CyberSource.Utilities.Tracking;
using AuthenticationSdk.core;

namespace CyberSource.Api
{
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -515,6 +532,22 @@ public async System.Threading.Tasks.Task<ApiResponse<InlineResponse2007>> 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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -703,6 +752,22 @@ public async System.Threading.Tasks.Task<ApiResponse<InlineResponse2006>> 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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -921,6 +1002,22 @@ public async System.Threading.Tasks.Task<ApiResponse<InlineResponse2005>> 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,
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -1112,14 +1225,29 @@ public async System.Threading.Tasks.Task<ApiResponse<InlineResponse202>> 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
Expand Down
Loading