From e7e29bbe7369ed3d7dd49f9dffcb0a40226a1abf Mon Sep 17 00:00:00 2001 From: Ian Streeter Date: Wed, 3 May 2023 17:06:08 +0100 Subject: [PATCH 1/2] Draft currency conversion configuration --- .../currency_conversion_config.json | 47 ++++++++++++++++++- 1 file changed, 45 insertions(+), 2 deletions(-) diff --git a/config/enrichments/currency_conversion_config.json b/config/enrichments/currency_conversion_config.json index 97e9e7dad..e4283f705 100644 --- a/config/enrichments/currency_conversion_config.json +++ b/config/enrichments/currency_conversion_config.json @@ -1,6 +1,5 @@ { - "schema": "iglu:com.snowplowanalytics.snowplow/currency_conversion_config/jsonschema/1-0-0", - + "schema": "iglu:com.snowplowanalytics.snowplow/currency_conversion_config/jsonschema/2-0-0", "data": { "enabled": false, @@ -11,6 +10,50 @@ "apiKey": "{{KEY}}", "baseCurrency": "USD", "rateAt": "EOD_PRIOR" + }, + "mappings": [ + { + "input": "iglu:ecommerce.tracking/product_entity/jsonschema/1-0-0", + "output": "iglu:ecommerce.tracking/converted_product_entity/jsonschema/1-0-0", + "fields": [ + { + "inputField": "price", + "currency": "currency", + "outputField": "price" + }, + { + "inputField": "list_price", + "currency": "currency", + "outputField": "list_price" + } + ] + }, + { + "input": "iglu:ecommerce.tracking/transaction_entity/jsonschema/1-0-0", + "output": "iglu:ecommerce.tracking/converted_transaction_entity/jsonschema/1-0-0", + "fields": [ + { + "inputField": "revenue", + "currency": "currency", + "outputField": "revenue" + }, + { + "inputField": "tax", + "currency": "currency", + "outputField": "tax" + }, + { + "inputField": "shipping", + "currency": "currency", + "outputField": "shipping" + }, + { + "inputField": "discount_amount", + "currency": "currency", + "outputField": "discount_amount" + } + ] } + ] } } From 275995fcc5d060444caf9628b57be89ee80304f0 Mon Sep 17 00:00:00 2001 From: Ian Streeter Date: Fri, 5 May 2023 11:08:23 +0100 Subject: [PATCH 2/2] Draft currency conversion configuration - amendment 1 --- .../currency_conversion_config.json | 30 +++++++++---------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/config/enrichments/currency_conversion_config.json b/config/enrichments/currency_conversion_config.json index e4283f705..1be6b210d 100644 --- a/config/enrichments/currency_conversion_config.json +++ b/config/enrichments/currency_conversion_config.json @@ -13,43 +13,41 @@ }, "mappings": [ { - "input": "iglu:ecommerce.tracking/product_entity/jsonschema/1-0-0", - "output": "iglu:ecommerce.tracking/converted_product_entity/jsonschema/1-0-0", + "field": "contexts", + "schemaCriterion": "iglu:ecommerce.tracking/product_entity/jsonschema/1-*-*", + "derivedContext": "iglu:ecommerce.tracking/normalized_product_entity/jsonschema/1-0-0", + "currencyJsonPath": "$.currency", "fields": [ { - "inputField": "price", - "currency": "currency", + "jsonPath": "$.price", "outputField": "price" }, { - "inputField": "list_price", - "currency": "currency", + "jsonPath": "$.list_price", "outputField": "list_price" } ] }, { - "input": "iglu:ecommerce.tracking/transaction_entity/jsonschema/1-0-0", - "output": "iglu:ecommerce.tracking/converted_transaction_entity/jsonschema/1-0-0", + "field": "contexts", + "schemaCriterion": "iglu:ecommerce.tracking/transaction_entity/jsonschema/1-*-*", + "derivedContext": "iglu:ecommerce.tracking/normalized_transaction_entity/jsonschema/1-0-0", + "currencyJsonPath": "$.currency", "fields": [ { - "inputField": "revenue", - "currency": "currency", + "jsonPath": "$.revenue", "outputField": "revenue" }, { - "inputField": "tax", - "currency": "currency", + "jsonPath": "$.tax", "outputField": "tax" }, { - "inputField": "shipping", - "currency": "currency", + "jsonPath": "$.shipping", "outputField": "shipping" }, { - "inputField": "discount_amount", - "currency": "currency", + "jsonPath": "$.discount_amount", "outputField": "discount_amount" } ]