Skip to content

Commit

Permalink
fix: value and value_decimal to proper currency subunit measurement
Browse files Browse the repository at this point in the history
  • Loading branch information
yashasvibajpai committed Jan 31, 2024
1 parent edf24b4 commit 1ec08da
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/cdk/v2/destinations/reddit/procWorkflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions test/integrations/destinations/reddit/processor/data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
4 changes: 2 additions & 2 deletions test/integrations/destinations/reddit/router/data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down

0 comments on commit 1ec08da

Please sign in to comment.