Skip to content

Commit

Permalink
feat: address review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
utsabc committed Dec 6, 2023
1 parent 2868d3c commit de171b4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
4 changes: 3 additions & 1 deletion src/v0/destinations/braze/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ const BRAZE_NON_BILLABLE_ATTRIBUTES = [
'subscription_groups',
];

const BRAZE_PURCHASE_STANDARD_PROPERTIES = ['product_id', 'sku', 'price', 'quantity', 'currency'];
module.exports = {
ConfigCategory,
mappingConfig,
Expand All @@ -64,12 +65,13 @@ module.exports = {
getSubscriptionGroupEndPoint,
getAliasMergeEndPoint,
BRAZE_PARTNER_NAME,
BRAZE_PURCHASE_STANDARD_PROPERTIES,
TRACK_BRAZE_MAX_REQ_COUNT,
IDENTIFY_BRAZE_MAX_REQ_COUNT,
DESTINATION,
CustomAttributeOperationTypes,
DEL_MAX_BATCH_SIZE,
BRAZE_NON_BILLABLE_ATTRIBUTES,
ALIAS_BRAZE_MAX_REQ_COUNT,
SUBSCRIPTION_BRAZE_MAX_REQ_COUNT
SUBSCRIPTION_BRAZE_MAX_REQ_COUNT,
};
7 changes: 4 additions & 3 deletions src/v0/destinations/braze/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ const {
SUBSCRIPTION_BRAZE_MAX_REQ_COUNT,
ALIAS_BRAZE_MAX_REQ_COUNT,
TRACK_BRAZE_MAX_REQ_COUNT,
BRAZE_PURCHASE_STANDARD_PROPERTIES,
} = require('./config');
const { JSON_MIME_TYPE, HTTP_STATUS_CODES } = require('../../util/constant');
const { isObject } = require('../../util');
Expand Down Expand Up @@ -539,7 +540,7 @@ function addMandatoryPurchaseProperties(productId, price, currencyCode, quantity
};
}

function getPurchaseObjs(message, Config) {
function getPurchaseObjs(message, config) {
// ref:https://www.braze.com/docs/api/objects_filters/purchase_object/
const validateForPurchaseEvent = (message) => {
const { properties } = message;
Expand Down Expand Up @@ -634,8 +635,8 @@ function getPurchaseObjs(message, Config) {
parseInt(quantity, 10),
timestamp,
);
const extraProperties = _.omit(product, ['product_id', 'sku', 'price', 'quantity', 'currency']);
if (Object.keys(extraProperties).length > 0 && Config.sendPurchaseEventWithExtraProperties) {
const extraProperties = _.omit(product, BRAZE_PURCHASE_STANDARD_PROPERTIES);
if (Object.keys(extraProperties).length > 0 && config.sendPurchaseEventWithExtraProperties) {
purchaseObj = { ...purchaseObj, properties: extraProperties };
}
purchaseObj = setExternalIdOrAliasObject(purchaseObj, message);
Expand Down

0 comments on commit de171b4

Please sign in to comment.