From fd50b1af19b4b19131735705657c50e1b98dd941 Mon Sep 17 00:00:00 2001 From: Jan Kirchner Date: Thu, 26 Aug 2021 17:09:03 +0200 Subject: [PATCH 1/2] feat: add customer_segment to hubspot_client --- packages/hubspot_client/src/hubspot_client.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/hubspot_client/src/hubspot_client.ts b/packages/hubspot_client/src/hubspot_client.ts index b86a3f165..f1941c518 100644 --- a/packages/hubspot_client/src/hubspot_client.ts +++ b/packages/hubspot_client/src/hubspot_client.ts @@ -23,6 +23,7 @@ const ALLOWED_USER_FIELDS = { subscription_plan: _.isString, subscription_price: _.isNumber, segment_paying_user: _.isString, + customer_segment: _.isString, firstname: _.isString, lastname: _.isString, @@ -348,6 +349,7 @@ export class HubspotClient { data.subscription_plan = (user.subscription && user.subscription.plan) ? user.subscription.plan.id : ''; data.subscription_price = (user.subscription && user.subscription.plan) ? user.subscription.plan.monthlyBasePriceUsd : 0; data.segment_paying_user = (!!data.subscription_plan || (user.admin && user.admin.isPayingCustomer)) ? 'true' : 'false'; + data.customer_segment = (user.admin && user.admin.customerSegment) ? user.admin.customerSegment : ''; const cleanedObject = cleanAndCompareWithSchema(data, ALLOWED_USER_FIELDS); return cleanedObject; From 3dbcb3565be53f4edf5d04aed3887f30c3b823ba Mon Sep 17 00:00:00 2001 From: Jan Kirchner Date: Tue, 14 Sep 2021 10:18:02 +0200 Subject: [PATCH 2/2] fix: hubspot client test fix --- test/hubspot_client.test.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/test/hubspot_client.test.ts b/test/hubspot_client.test.ts index 160cae960..a138a048b 100644 --- a/test/hubspot_client.test.ts +++ b/test/hubspot_client.test.ts @@ -157,6 +157,7 @@ describe('HubspotClient', () => { subscription_plan: '', subscription_price: 0, segment_paying_user: 'false', + customer_segment: '', }; const transformedData = hubspotClient._transformUser(userData); expect(transformedData).toEqual(expectedData); @@ -184,6 +185,7 @@ describe('HubspotClient', () => { subscription_plan: '', subscription_price: 0, segment_paying_user: 'false', + customer_segment: '', }; const transformedData = hubspotClient._transformUser(userData, true); expect(transformedData).toEqual(expectedData); @@ -199,6 +201,7 @@ describe('HubspotClient', () => { subscription_plan: '', subscription_price: 0, segment_paying_user: 'false', + customer_segment: '', }; const transformedData = hubspotClient._transformUser(userData, true); expect(transformedData).toEqual(expectedData);