Skip to content

Commit

Permalink
Chore: Fix Sonar Audit
Browse files Browse the repository at this point in the history
  • Loading branch information
NghiaDTr committed Oct 3, 2024
1 parent 57dd739 commit 0553ed3
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions processor/src/commercetools/action.commercetools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ export const setCustomFields = (fieldName: string, fieldValue: string) => {
*/
export const addInterfaceInteraction = (params: CreateInterfaceInteractionParams) => {
const { sctm_action_type, sctm_request, sctm_response, sctm_id, sctm_created_at } = params;
const interfaceInteractionId = sctm_id ? sctm_id : uuid();
const interfaceInteractionTimestamp = sctm_created_at ? sctm_created_at : createDateNowString();
const interfaceInteractionId = sctm_id || uuid();
const interfaceInteractionTimestamp = sctm_created_at || createDateNowString();

return {
action: 'addInterfaceInteraction',
Expand Down
6 changes: 3 additions & 3 deletions processor/src/utils/app.utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export function parseStringToJsonObject(
try {
return JSON.parse(targetedString);
} catch {
const errorMessage = `${errorPrefix ? errorPrefix : 'SCTM - PAYMENT PROCESSING'} - Failed to parse the JSON string from the custom field ${fieldName}.`;
const errorMessage = `${errorPrefix || 'SCTM - PAYMENT PROCESSING'} - Failed to parse the JSON string from the custom field ${fieldName}.`;
logger.error(errorMessage, {
commerceToolsId: commerceToolsId,
});
Expand All @@ -48,10 +48,10 @@ export function parseStringToJsonObject(
* @return {object} - The object with empty properties removed.
*/
export function removeEmptyProperties(obj: object) {
const clonedObject: { [key: string]: any } = Object.assign({}, obj);
const clonedObject: { [key: string]: any } = { ...obj };

for (const key in clonedObject) {
if (Object.prototype.hasOwnProperty.call(clonedObject, key)) {
if (Object.hasOwn(clonedObject, key)) {
const value = clonedObject[key];

if (
Expand Down
2 changes: 1 addition & 1 deletion processor/src/utils/mollie.utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ export const calculateDueDate = (input?: string): string => {
input = DEFAULT_DUE_DATE + 'd';
}

const match = input.match(DUE_DATE_PATTERN);
const match = DUE_DATE_PATTERN.exec(input);

if (match) {
const days = parseInt(match[1]);
Expand Down

0 comments on commit 0553ed3

Please sign in to comment.