From 1ec08da9ed6472607371768ee94597064e4c32eb Mon Sep 17 00:00:00 2001 From: Yashasvi Bajpai <33063622+yashasvibajpai@users.noreply.github.com> Date: Wed, 31 Jan 2024 16:57:09 +0530 Subject: [PATCH] fix: value and value_decimal to proper currency subunit measurement --- src/cdk/v2/destinations/reddit/procWorkflow.yaml | 4 ++-- test/integrations/destinations/reddit/processor/data.ts | 4 ++-- test/integrations/destinations/reddit/router/data.ts | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/cdk/v2/destinations/reddit/procWorkflow.yaml b/src/cdk/v2/destinations/reddit/procWorkflow.yaml index 652ee2f784..e6c05ef86d 100644 --- a/src/cdk/v2/destinations/reddit/procWorkflow.yaml +++ b/src/cdk/v2/destinations/reddit/procWorkflow.yaml @@ -60,9 +60,9 @@ steps: template: | const customFields = .message.().({ "currency": .properties.currency, - "value": .properties.revenue !== undefined ? Number(.properties.revenue) : undefined, + "value_decimal": .properties.revenue !== undefined ? Number(.properties.revenue) : undefined, "item_count": (Array.isArray(.properties.products) && .properties.products.length) || (.properties.itemCount && Number(.properties.itemCount)), - "value_decimal": .properties.revenue !== undefined ? Number(.properties.revenue)/100 : undefined, + "value": .properties.revenue !== undefined ? Number(.properties.revenue)*100 : undefined, "conversion_id": .properties.conversionId || .messageId, }); $.removeUndefinedAndNullValues(customFields) diff --git a/test/integrations/destinations/reddit/processor/data.ts b/test/integrations/destinations/reddit/processor/data.ts index 09bbd3e587..f3cd4ebf7b 100644 --- a/test/integrations/destinations/reddit/processor/data.ts +++ b/test/integrations/destinations/reddit/processor/data.ts @@ -128,8 +128,8 @@ export const data = [ event_metadata: { item_count: 2, currency: 'USD', - value: 15, - value_decimal: 0.15, + value: 1500, + value_decimal: 15, products: [ { id: '123', diff --git a/test/integrations/destinations/reddit/router/data.ts b/test/integrations/destinations/reddit/router/data.ts index 1ce7d24abf..e71b69b1fc 100644 --- a/test/integrations/destinations/reddit/router/data.ts +++ b/test/integrations/destinations/reddit/router/data.ts @@ -236,8 +236,8 @@ export const data = [ event_metadata: { item_count: 2, currency: 'USD', - value: 15, - value_decimal: 0.15, + value: 1500, + value_decimal: 15, products: [ { id: '123',