diff --git a/src/v0/sources/shopify/util.js b/src/v0/sources/shopify/util.js index 981832363e..b7e79e35a1 100644 --- a/src/v0/sources/shopify/util.js +++ b/src/v0/sources/shopify/util.js @@ -2,15 +2,9 @@ /* eslint-disable @typescript-eslint/naming-convention */ const { v5 } = require('uuid'); const sha256 = require('sha256'); -const { TransformationError } = require('@rudderstack/integrations-lib'); +const { TransformationError, isDefinedAndNotNull } = require('@rudderstack/integrations-lib'); const stats = require('../../../util/stats'); -const { - constructPayload, - extractCustomFields, - flattenJson, - generateUUID, - isDefinedAndNotNull, -} = require('../../util'); +const utils = require('../../util'); const { RedisDB } = require('../../../util/redis/redisConnector'); const { lineItemsMappingJSON, @@ -92,8 +86,8 @@ const getProductsListFromLineItems = (lineItems) => { } const products = []; lineItems.forEach((lineItem) => { - const product = constructPayload(lineItem, lineItemsMappingJSON); - extractCustomFields(lineItem, product, 'root', LINE_ITEM_EXCLUSION_FIELDS); + const product = utils.constructPayload(lineItem, lineItemsMappingJSON); + utils.extractCustomFields(lineItem, product, 'root', LINE_ITEM_EXCLUSION_FIELDS); product.variant = getVariantString(lineItem); products.push(product); }); @@ -103,14 +97,14 @@ const getProductsListFromLineItems = (lineItems) => { const createPropertiesForEcomEvent = (message) => { const { line_items: lineItems } = message; const productsList = getProductsListFromLineItems(lineItems); - const mappedPayload = constructPayload(message, productMappingJSON); - extractCustomFields(message, mappedPayload, 'root', PRODUCT_MAPPING_EXCLUSION_FIELDS); + const mappedPayload = utils.constructPayload(message, productMappingJSON); + utils.extractCustomFields(message, mappedPayload, 'root', PRODUCT_MAPPING_EXCLUSION_FIELDS); mappedPayload.products = productsList; return mappedPayload; }; const extractEmailFromPayload = (event) => { - const flattenedPayload = flattenJson(event); + const flattenedPayload = utils.flattenJson(event); let email; const regex_email = /\bemail\b/i; Object.entries(flattenedPayload).some(([key, value]) => { @@ -182,7 +176,7 @@ const getAnonymousIdAndSessionId = async (message, metricMetadata, redisData = n return { anonymousId, sessionId }; } return { - anonymousId: isDefinedAndNotNull(anonymousId) ? anonymousId : generateUUID(), + anonymousId: isDefinedAndNotNull(anonymousId) ? anonymousId : utils.generateUUID(), sessionId, }; } @@ -281,4 +275,5 @@ module.exports = { checkAndUpdateCartItems, getHashLineItems, getDataFromRedis, + getVariantString, }; diff --git a/src/v1/sources/shopify/transform.js b/src/v1/sources/shopify/transform.js index dee5a14a9d..5ebf4a34fc 100644 --- a/src/v1/sources/shopify/transform.js +++ b/src/v1/sources/shopify/transform.js @@ -1,19 +1,27 @@ /* eslint-disable @typescript-eslint/naming-convention */ -const { processEventFromPixel } = require('./pixelTransform'); +const { processPixelWebEvents } = require('./webpixelTransformations/pixelTransform'); const { process: processWebhookEvents } = require('../../../v0/sources/shopify/transform'); +const { + process: processPixelWebhookEvents, +} = require('./webhookTransformations/serverSideTransform'); const process = async (inputEvent) => { const { event } = inputEvent; - // check on the source Config to identify the event is from the tracker-based (legacy) - // or the pixel-based (latest) implementation. + const { query_parameters } = event; + // check identify the event is from the web pixel based on the pixelEventLabel property. const { pixelEventLabel: pixelClientEventLabel } = event; if (pixelClientEventLabel) { // this is a event fired from the web pixel loaded on the browser // by the user interactions with the store. - const responseV2 = await processEventFromPixel(event); - return responseV2; + const pixelWebEventResponse = await processPixelWebEvents(event); + return pixelWebEventResponse; } - // this is for common logic for server-side events processing for both pixel and tracker apps. + if (query_parameters && query_parameters?.version?.[0] === 'pixel') { + // this is a server-side event from the webhook subscription made by the pixel app. + const pixelWebhookEventResponse = await processPixelWebhookEvents(event); + return pixelWebhookEventResponse; + } + // this is a server-side event from the webhook subscription made by the legacy tracker-based app. const response = await processWebhookEvents(event); return response; }; diff --git a/src/v1/sources/shopify/webhookTransformations/serverSideTransform.js b/src/v1/sources/shopify/webhookTransformations/serverSideTransform.js new file mode 100644 index 0000000000..c31bc74bf1 --- /dev/null +++ b/src/v1/sources/shopify/webhookTransformations/serverSideTransform.js @@ -0,0 +1,174 @@ +/* eslint-disable @typescript-eslint/naming-convention */ +const lodash = require('lodash'); +const get = require('get-value'); +// const { RedisError } = require('@rudderstack/integrations-lib'); +const stats = require('../../../../util/stats'); +const { + getShopifyTopic, + // createPropertiesForEcomEvent, + extractEmailFromPayload, + getAnonymousIdAndSessionId, + // getHashLineItems, +} = require('../../../../v0/sources/shopify/util'); +// const logger = require('../../../logger'); +const { removeUndefinedAndNullValues, isDefinedAndNotNull } = require('../../../../v0/util'); +// const { RedisDB } = require('../../../util/redis/redisConnector'); +const Message = require('../../../../v0/sources/message'); +const { EventType } = require('../../../../constants'); +const { + INTEGERATION, + MAPPING_CATEGORIES, + IDENTIFY_TOPICS, + ECOM_TOPICS, + RUDDER_ECOM_MAP, + SUPPORTED_TRACK_EVENTS, + SHOPIFY_TRACK_MAP, + lineItemsMappingJSON, +} = require('../../../../v0/sources/shopify/config'); +const { + createPropertiesForEcomEventFromWebhook, + getProductsFromLineItems, +} = require('./serverSideUtlis'); + +const NO_OPERATION_SUCCESS = { + outputToSource: { + body: Buffer.from('OK').toString('base64'), + contentType: 'text/plain', + }, + statusCode: 200, +}; + +const identifyPayloadBuilder = (event) => { + const message = new Message(INTEGERATION); + message.setEventType(EventType.IDENTIFY); + message.setPropertiesV2(event, MAPPING_CATEGORIES[EventType.IDENTIFY]); + if (event.updated_at) { + // converting shopify updated_at timestamp to rudder timestamp format + message.setTimestamp(new Date(event.updated_at).toISOString()); + } + return message; +}; + +const ecomPayloadBuilder = (event, shopifyTopic) => { + const message = new Message(INTEGERATION); + message.setEventType(EventType.TRACK); + message.setEventName(RUDDER_ECOM_MAP[shopifyTopic]); + + const properties = createPropertiesForEcomEventFromWebhook(event); + message.properties = removeUndefinedAndNullValues(properties); + // Map Customer details if present + const customerDetails = get(event, 'customer'); + if (customerDetails) { + message.setPropertiesV2(customerDetails, MAPPING_CATEGORIES[EventType.IDENTIFY]); + } + if (event.updated_at) { + message.setTimestamp(new Date(event.updated_at).toISOString()); + } + if (event.customer) { + message.setPropertiesV2(event.customer, MAPPING_CATEGORIES[EventType.IDENTIFY]); + } + if (event.shipping_address) { + message.setProperty('traits.shippingAddress', event.shipping_address); + } + if (event.billing_address) { + message.setProperty('traits.billingAddress', event.billing_address); + } + if (!message.userId && event.user_id) { + message.setProperty('userId', event.user_id); + } + return message; +}; + +const trackPayloadBuilder = (event, shopifyTopic) => { + const message = new Message(INTEGERATION); + message.setEventType(EventType.TRACK); + message.setEventName(SHOPIFY_TRACK_MAP[shopifyTopic]); + // eslint-disable-next-line camelcase + const { line_items: lineItems } = event; + const productsList = getProductsFromLineItems(lineItems, lineItemsMappingJSON); + message.setProperty('properties.products', productsList); + return message; +}; + +const processEvent = async (inputEvent, metricMetadata) => { + let message; + const event = lodash.cloneDeep(inputEvent); + const shopifyTopic = getShopifyTopic(event); + delete event.query_parameters; + switch (shopifyTopic) { + case IDENTIFY_TOPICS.CUSTOMERS_CREATE: + case IDENTIFY_TOPICS.CUSTOMERS_UPDATE: + message = identifyPayloadBuilder(event); + break; + case ECOM_TOPICS.ORDERS_CREATE: + case ECOM_TOPICS.ORDERS_UPDATE: + case ECOM_TOPICS.CHECKOUTS_CREATE: + case ECOM_TOPICS.CHECKOUTS_UPDATE: + message = ecomPayloadBuilder(event, shopifyTopic); + break; + default: + if (!SUPPORTED_TRACK_EVENTS.includes(shopifyTopic)) { + stats.increment('invalid_shopify_event', { + writeKey: metricMetadata.writeKey, + source: metricMetadata.source, + shopifyTopic: metricMetadata.shopifyTopic, + }); + return NO_OPERATION_SUCCESS; + } + message = trackPayloadBuilder(event, shopifyTopic); + break; + } + + if (message.userId) { + message.userId = String(message.userId); + } + if (!get(message, 'traits.email')) { + const email = extractEmailFromPayload(event); + if (email) { + message.setProperty('traits.email', email); + } + } + if (message.type !== EventType.IDENTIFY) { + const { anonymousId } = await getAnonymousIdAndSessionId( + message, + { shopifyTopic, ...metricMetadata }, + null, + ); + if (isDefinedAndNotNull(anonymousId)) { + message.setProperty('anonymousId', anonymousId); + } + } + message.setProperty(`integrations.${INTEGERATION}`, true); + message.setProperty('context.library', { + eventOrigin: 'server', + name: 'RudderStack Shopify Cloud', + version: '2.0.0', + }); + message.setProperty('context.topic', shopifyTopic); + // attaching cart, checkout and order tokens in context object + message.setProperty(`context.cart_token`, event.cart_token); + message.setProperty(`context.checkout_token`, event.checkout_token); + // raw shopify payload passed inside context object under shopifyDetails + message.setProperty('context.shopifyDetails', event); + if (shopifyTopic === 'orders_updated') { + message.setProperty(`context.order_token`, event.token); + } + message = removeUndefinedAndNullValues(message); + return message; +}; +const process = async (event) => { + const metricMetadata = { + writeKey: event.query_parameters?.writeKey?.[0], + source: 'SHOPIFY', + }; + const response = await processEvent(event, metricMetadata); + return response; +}; + +module.exports = { + process, + processEvent, + identifyPayloadBuilder, + ecomPayloadBuilder, + trackPayloadBuilder, +}; diff --git a/src/v1/sources/shopify/webhookTransformations/serverSideUtils.test.js b/src/v1/sources/shopify/webhookTransformations/serverSideUtils.test.js new file mode 100644 index 0000000000..a611d1d8dc --- /dev/null +++ b/src/v1/sources/shopify/webhookTransformations/serverSideUtils.test.js @@ -0,0 +1,112 @@ +const { + getProductsFromLineItems, + createPropertiesForEcomEventFromWebhook, +} = require('./serverSideUtlis'); + +const { constructPayload } = require('../../../../v0/util'); + +const { + lineItemsMappingJSON, + productMappingJSON, +} = require('../../../../v0/sources/shopify/config'); +const Message = require('../../../../v0/sources/message'); +jest.mock('../../../../v0/sources/message'); + +const LINEITEMS = [ + { + id: '41327142600817', + grams: 0, + presentment_title: 'The Collection Snowboard: Hydrogen', + product_id: 7234590408818, + quantity: 1, + sku: '', + taxable: true, + title: 'The Collection Snowboard: Hydrogen', + variant_id: 41327142600817, + variant_title: '', + variant_price: '600.00', + vendor: 'Hydrogen Vendor', + line_price: '600.00', + price: '600.00', + applied_discounts: [], + properties: {}, + }, + { + id: 14234727743601, + gift_card: false, + grams: 0, + name: 'The Collection Snowboard: Nitrogen', + price: '600.00', + product_exists: true, + product_id: 7234590408817, + properties: [], + quantity: 1, + sku: '', + title: 'The Collection Snowboard: Nitrogen', + total_discount: '0.00', + variant_id: 41327142600817, + vendor: 'Hydrogen Vendor', + }, +]; + +describe('serverSideUtils.js', () => { + beforeEach(() => { + Message.mockClear(); + }); + + describe('Test getProductsFromLineItems function', () => { + it('should return empty array if lineItems is empty', () => { + const lineItems = []; + const result = getProductsFromLineItems(lineItems, lineItemsMappingJSON); + expect(result).toEqual([]); + }); + + it('should return array of products', () => { + const mapping = {}; + const result = getProductsFromLineItems(LINEITEMS, lineItemsMappingJSON); + expect(result).toEqual([ + { brand: 'Hydrogen Vendor', price: '600.00', product_id: 7234590408818, quantity: 1 }, + { + brand: 'Hydrogen Vendor', + price: '600.00', + product_id: 7234590408817, + quantity: 1, + title: 'The Collection Snowboard: Nitrogen', + }, + ]); + }); + }); + + describe('Test createPropertiesForEcomEventFromWebhook function', () => { + it('should return empty array if lineItems is empty', () => { + const message = { + line_items: [], + type: 'track', + event: 'checkout created', + }; + const result = createPropertiesForEcomEventFromWebhook(message); + expect(result).toEqual([]); + }); + + it('should return array of products', () => { + const message = { + line_items: LINEITEMS, + type: 'track', + event: 'checkout updated', + }; + const result = createPropertiesForEcomEventFromWebhook(message); + expect(result).toEqual({ + products: [ + { brand: 'Hydrogen Vendor', price: '600.00', product_id: 7234590408818, quantity: 1 }, + { + brand: 'Hydrogen Vendor', + price: '600.00', + product_id: 7234590408817, + quantity: 1, + title: 'The Collection Snowboard: Nitrogen', + }, + ], + }); + }); + }); +}); diff --git a/src/v1/sources/shopify/webhookTransformations/serverSideUtlis.js b/src/v1/sources/shopify/webhookTransformations/serverSideUtlis.js new file mode 100644 index 0000000000..eed03de71f --- /dev/null +++ b/src/v1/sources/shopify/webhookTransformations/serverSideUtlis.js @@ -0,0 +1,45 @@ +const { constructPayload } = require('../../../../v0/util'); + +const { + lineItemsMappingJSON, + productMappingJSON, +} = require('../../../../v0/sources/shopify/config'); + +/** + * Returns an array of products from the lineItems array received from the webhook event + * @param {Array} lineItems + * @param {Object} mapping + * @returns {Array} products + */ +const getProductsFromLineItems = (lineItems, mapping) => { + if (!lineItems || lineItems.length === 0) { + return []; + } + const products = []; + lineItems.forEach((lineItem) => { + // const product = constructPayload(lineItem, lineItemsMappingJSON); + const product = constructPayload(lineItem, mapping); + products.push(product); + }); + return products; +}; + +/** + * Creates properties for the ecommerce webhook events received from the pixel based app + * @param {Object} message + * @returns {Object} properties + */ +const createPropertiesForEcomEventFromWebhook = (message) => { + const { line_items: lineItems } = message; + if (!lineItems || lineItems.length === 0) { + return []; + } + const mappedPayload = constructPayload(message, productMappingJSON); + mappedPayload.products = getProductsFromLineItems(lineItems, lineItemsMappingJSON); + return mappedPayload; +}; + +module.exports = { + createPropertiesForEcomEventFromWebhook, + getProductsFromLineItems, +}; diff --git a/src/v1/sources/shopify/pixelTransform.js b/src/v1/sources/shopify/webpixelTransformations/pixelTransform.js similarity index 94% rename from src/v1/sources/shopify/pixelTransform.js rename to src/v1/sources/shopify/webpixelTransformations/pixelTransform.js index e308f626b4..b1d1c8b2fa 100644 --- a/src/v1/sources/shopify/pixelTransform.js +++ b/src/v1/sources/shopify/webpixelTransformations/pixelTransform.js @@ -2,10 +2,10 @@ // eslint-disable-next-line @typescript-eslint/naming-convention const _ = require('lodash'); const { isDefinedNotNullNotEmpty } = require('@rudderstack/integrations-lib'); -const stats = require('../../../util/stats'); -const logger = require('../../../logger'); -const { removeUndefinedAndNullValues } = require('../../../v0/util'); -const { RedisDB } = require('../../../util/redis/redisConnector'); +const stats = require('../../../../util/stats'); +const logger = require('../../../../logger'); +const { removeUndefinedAndNullValues } = require('../../../../v0/util'); +const { RedisDB } = require('../../../../util/redis/redisConnector'); const { pageViewedEventBuilder, cartViewedEventBuilder, @@ -20,7 +20,7 @@ const { INTEGERATION, PIXEL_EVENT_TOPICS, pixelEventToCartTokenLocationMapping, -} = require('./config'); +} = require('../config'); const NO_OPERATION_SUCCESS = { outputToSource: { @@ -152,13 +152,13 @@ function processPixelEvent(inputEvent) { return message; } -const processEventFromPixel = async (event) => { +const processPixelWebEvents = async (event) => { const pixelEvent = processPixelEvent(event); return removeUndefinedAndNullValues(pixelEvent); }; module.exports = { - processEventFromPixel, + processPixelWebEvents, handleCartTokenRedisOperations, extractCartToken, }; diff --git a/src/v1/sources/shopify/pixelTransform.redisCartToken.test.js b/src/v1/sources/shopify/webpixelTransformations/pixelTransform.redisCartToken.test.js similarity index 87% rename from src/v1/sources/shopify/pixelTransform.redisCartToken.test.js rename to src/v1/sources/shopify/webpixelTransformations/pixelTransform.redisCartToken.test.js index 8f54efc373..1e5cb94b19 100644 --- a/src/v1/sources/shopify/pixelTransform.redisCartToken.test.js +++ b/src/v1/sources/shopify/webpixelTransformations/pixelTransform.redisCartToken.test.js @@ -1,25 +1,25 @@ const { extractCartToken, handleCartTokenRedisOperations } = require('./pixelTransform'); -const { RedisDB } = require('../../../util/redis/redisConnector'); -const stats = require('../../../util/stats'); -const logger = require('../../../logger'); -const { pixelEventToCartTokenLocationMapping } = require('./config'); +const { RedisDB } = require('../../../../util/redis/redisConnector'); +const stats = require('../../../../util/stats'); +const logger = require('../../../../logger'); +const { pixelEventToCartTokenLocationMapping } = require('../config'); -jest.mock('../../../util/redis/redisConnector', () => ({ +jest.mock('../../../../util/redis/redisConnector', () => ({ RedisDB: { setVal: jest.fn(), }, })); -jest.mock('../../../util/stats', () => ({ +jest.mock('../../../../util/stats', () => ({ increment: jest.fn(), })); -jest.mock('../../../logger', () => ({ +jest.mock('../../../../logger', () => ({ info: jest.fn(), error: jest.fn(), })); -jest.mock('./config', () => ({ +jest.mock('../config', () => ({ pixelEventToCartTokenLocationMapping: { cart_viewed: 'properties.cart_id' }, })); diff --git a/src/v1/sources/shopify/pixelUtils.js b/src/v1/sources/shopify/webpixelTransformations/pixelUtils.js similarity index 97% rename from src/v1/sources/shopify/pixelUtils.js rename to src/v1/sources/shopify/webpixelTransformations/pixelUtils.js index 9abef5c2f8..0c1007f311 100644 --- a/src/v1/sources/shopify/pixelUtils.js +++ b/src/v1/sources/shopify/webpixelTransformations/pixelUtils.js @@ -1,6 +1,6 @@ /* eslint-disable no-param-reassign */ -const Message = require('../../../v0/sources/message'); -const { EventType } = require('../../../constants'); +const Message = require('../../../../v0/sources/message'); +const { EventType } = require('../../../../constants'); const { INTEGERATION, PIXEL_EVENT_MAPPING, @@ -10,7 +10,7 @@ const { productViewedEventMappingJSON, productToCartEventMappingJSON, checkoutStartedCompletedEventMappingJSON, -} = require('./config'); +} = require('../config'); function getNestedValue(object, path) { const keys = path.split('.'); diff --git a/src/v1/sources/shopify/pixelUtils.test.js b/src/v1/sources/shopify/webpixelTransformations/pixelUtils.test.js similarity index 99% rename from src/v1/sources/shopify/pixelUtils.test.js rename to src/v1/sources/shopify/webpixelTransformations/pixelUtils.test.js index 4bff8eada4..e8f53a5f15 100644 --- a/src/v1/sources/shopify/pixelUtils.test.js +++ b/src/v1/sources/shopify/webpixelTransformations/pixelUtils.test.js @@ -8,10 +8,9 @@ const { checkoutStepEventBuilder, searchEventBuilder, } = require('./pixelUtils'); -const { EventType } = require('../../../constants'); -const Message = require('../../../v0/sources/message'); +const Message = require('../../../../v0/sources/message'); jest.mock('ioredis', () => require('../../../../test/__mocks__/redis')); -jest.mock('../../../v0/sources/message'); +jest.mock('../../../../v0/sources/message'); describe('utilV2.js', () => { beforeEach(() => { diff --git a/test/integrations/component.test.ts b/test/integrations/component.test.ts index daed7c9e1f..baad6813df 100644 --- a/test/integrations/component.test.ts +++ b/test/integrations/component.test.ts @@ -41,6 +41,7 @@ command .option('-i, --index ', 'Enter Test index') .option('-g, --generate ', 'Enter "true" If you want to generate network file') .option('-id, --id ', 'Enter unique "Id" of the test case you want to run') + .option('-s, --source ', 'Enter Source Name') .parse(); const opts = command.opts(); diff --git a/test/integrations/sources/shopify/data.ts b/test/integrations/sources/shopify/data.ts index a2b27cbbcc..d4498e089c 100644 --- a/test/integrations/sources/shopify/data.ts +++ b/test/integrations/sources/shopify/data.ts @@ -1,8 +1,10 @@ -import { skip } from 'node:test'; import { pixelCheckoutEventsTestScenarios } from './pixelTestScenarios/CheckoutEventsTests'; import { pixelCheckoutStepsScenarios } from './pixelTestScenarios/CheckoutStepsTests'; import { pixelEventsTestScenarios } from './pixelTestScenarios/ProductEventsTests'; -import { v1ServerSideEventsScenarios } from './v1ServerSideEventsTests'; +import { checkoutEventsTestScenarios } from './webhookTestScenarios/CheckoutEventsTests'; +import { genericTrackTestScenarios } from './webhookTestScenarios/GenericTrackTests'; +import { identityTestScenarios } from './webhookTestScenarios/IdentifyTests'; +import { mockFns } from './mocks'; const serverSideEventsScenarios = [ { @@ -1422,6 +1424,7 @@ const serverSideEventsScenarios = [ verifiedEmail: true, }, type: 'track', + anonymousId: '5d3e2cb6-4011-5c9c-b7ee-11bc1e905097', userId: '115310627314723950', }, ], @@ -1430,13 +1433,16 @@ const serverSideEventsScenarios = [ ], }, }, + mockFns, }, ]; export const data = [ + ...serverSideEventsScenarios, + ...checkoutEventsTestScenarios, + ...genericTrackTestScenarios, + ...identityTestScenarios, ...pixelCheckoutEventsTestScenarios, ...pixelCheckoutStepsScenarios, ...pixelEventsTestScenarios, - ...serverSideEventsScenarios, - ...v1ServerSideEventsScenarios, ]; diff --git a/test/integrations/sources/shopify/mocks.ts b/test/integrations/sources/shopify/mocks.ts new file mode 100644 index 0000000000..e1895e7812 --- /dev/null +++ b/test/integrations/sources/shopify/mocks.ts @@ -0,0 +1,5 @@ +import utils from '../../../../src/v0/util'; + +export const mockFns = (_) => { + jest.spyOn(utils, 'generateUUID').mockReturnValue('5d3e2cb6-4011-5c9c-b7ee-11bc1e905097'); +}; diff --git a/test/integrations/sources/shopify/v1ServerSideEventsTests.ts b/test/integrations/sources/shopify/v1ServerSideEventsTests.ts deleted file mode 100644 index 2c323cb370..0000000000 --- a/test/integrations/sources/shopify/v1ServerSideEventsTests.ts +++ /dev/null @@ -1,596 +0,0 @@ -// This file contains the test scenarios for the server-side events from the Shopify GraphQL API for -// the v1 transformation flow -import utils from '../../../../src/v0/util'; -const defaultMockFns = () => { - jest.spyOn(utils, 'generateUUID').mockReturnValue('5d3e2cb6-4011-5c9c-b7ee-11bc1e905097'); -}; -import { dummySourceConfig } from './constants'; - -export const v1ServerSideEventsScenarios = [ - { - name: 'shopify', - description: 'Track Call -> Checkout Updated event', - module: 'source', - version: 'v1', - input: { - request: { - body: [ - { - event: { - id: 35374569160817, - token: 'e89d4437003b6b8480f8bc7f8036a659', - cart_token: 'Z2NwLXVzLWVhc3QxOjAxSjdXRjdOQjY0NlFFNFdQVEg0MTRFM1E2', - email: 'testuser101@gmail.com', - gateway: null, - buyer_accepts_marketing: false, - buyer_accepts_sms_marketing: false, - sms_marketing_phone: null, - created_at: '2024-09-16T03:50:15+00:00', - updated_at: '2024-09-17T03:29:02-04:00', - landing_site: '/', - note: '', - note_attributes: [], - referring_site: '', - shipping_lines: [ - { - code: 'Standard', - price: '6.90', - original_shop_price: '6.90', - original_shop_markup: '0.00', - source: 'shopify', - title: 'Standard', - presentment_title: 'Standard', - phone: null, - tax_lines: [], - custom_tax_lines: null, - markup: '0.00', - carrier_identifier: null, - carrier_service_id: null, - api_client_id: '580111', - delivery_option_group: { - token: '26492692a443ee35c30eb82073bacaa8', - type: 'one_time_purchase', - }, - delivery_expectation_range: null, - delivery_expectation_type: null, - id: null, - requested_fulfillment_service_id: null, - delivery_category: null, - validation_context: null, - applied_discounts: [], - }, - ], - shipping_address: { - first_name: 'testuser', - address1: 'oakwood bridge', - phone: null, - city: 'KLF', - zip: '85003', - province: 'Arizona', - country: 'United States', - last_name: 'dummy', - address2: 'Hedgetown', - company: null, - latitude: null, - longitude: null, - name: 'testuser dummy', - country_code: 'US', - province_code: 'AZ', - }, - taxes_included: false, - total_weight: 0, - currency: 'USD', - completed_at: null, - phone: null, - customer_locale: 'en-US', - line_items: [ - { - key: '41327143059569', - fulfillment_service: 'manual', - gift_card: false, - grams: 0, - presentment_title: 'The Multi-location Snowboard', - presentment_variant_title: '', - product_id: 7234590638193, - quantity: 1, - requires_shipping: true, - sku: '', - tax_lines: [], - taxable: true, - title: 'The Multi-location Snowboard', - variant_id: 41327143059569, - variant_title: '', - variant_price: '729.95', - vendor: 'pixel-testing-rs', - unit_price_measurement: { - measured_type: null, - quantity_value: null, - quantity_unit: null, - reference_value: null, - reference_unit: null, - }, - compare_at_price: null, - line_price: '729.95', - price: '729.95', - applied_discounts: [], - destination_location_id: null, - user_id: null, - rank: null, - origin_location_id: null, - properties: {}, - }, - ], - name: '#35374569160817', - abandoned_checkout_url: - 'https://pixel-testing-rs.myshopify.com/59026964593/checkouts/ac/Z2NwLXVzLWVhc3QxOjAxSjdXRjdOQjY0NlFFNFdQVEg0MTRFM1E2/recover?key=8195f56ee0de230b3a0469cc692f3436', - discount_codes: [], - tax_lines: [], - presentment_currency: 'USD', - source_name: 'web', - total_line_items_price: '729.95', - total_tax: '0.00', - total_discounts: '0.00', - subtotal_price: '729.95', - total_price: '736.85', - total_duties: '0.00', - device_id: null, - user_id: null, - location_id: null, - source_identifier: null, - source_url: null, - source: null, - closed_at: null, - customer: { - id: 7188389789809, - email: 'testuser101@gmail.com', - accepts_marketing: false, - created_at: null, - updated_at: null, - first_name: 'testuser', - last_name: 'dummy', - orders_count: 0, - state: 'disabled', - total_spent: '0.00', - last_order_id: null, - note: null, - verified_email: true, - multipass_identifier: null, - tax_exempt: false, - phone: null, - tags: '', - currency: 'USD', - accepts_marketing_updated_at: null, - admin_graphql_api_id: 'gid://shopify/Customer/7188389789809', - default_address: { - id: null, - customer_id: 7188389789809, - first_name: 'testuser', - last_name: 'dummy', - company: null, - address1: 'oakwood bridge', - address2: 'Hedgetown', - city: 'KLF', - province: 'Arizona', - country: 'United States', - zip: '85003', - phone: null, - name: 'testuser dummy', - province_code: 'AZ', - country_code: 'US', - country_name: 'United States', - default: true, - }, - last_order_name: null, - marketing_opt_in_level: null, - }, - query_parameters: { - topic: ['checkouts_update'], - writeKey: ['2l9QoM7KRMJLMcYhXNUVDT0Mqbd'], - }, - }, - source: dummySourceConfig, - }, - ], - method: 'POST', - headers: { 'Content-Type': 'application/json' }, - }, - pathSuffix: '', - }, - output: { - response: { - status: 200, - body: [ - { - output: { - batch: [ - { - context: { - library: { - name: 'RudderStack Shopify Cloud', - version: '1.0.0', - }, - integration: { - name: 'SHOPIFY', - }, - topic: 'checkouts_update', - cart_token: 'Z2NwLXVzLWVhc3QxOjAxSjdXRjdOQjY0NlFFNFdQVEg0MTRFM1E2', - }, - integrations: { - SHOPIFY: true, - }, - type: 'track', - event: 'Checkout Updated', - properties: { - order_id: 35374569160817, - value: '736.85', - tax: '0.00', - currency: 'USD', - token: 'e89d4437003b6b8480f8bc7f8036a659', - cart_token: 'Z2NwLXVzLWVhc3QxOjAxSjdXRjdOQjY0NlFFNFdQVEg0MTRFM1E2', - email: 'testuser101@gmail.com', - buyer_accepts_marketing: false, - buyer_accepts_sms_marketing: false, - created_at: '2024-09-16T03:50:15+00:00', - updated_at: '2024-09-17T03:29:02-04:00', - landing_site: '/', - note: '', - note_attributes: [], - referring_site: '', - shipping_lines: [ - { - code: 'Standard', - price: '6.90', - original_shop_price: '6.90', - original_shop_markup: '0.00', - source: 'shopify', - title: 'Standard', - presentment_title: 'Standard', - phone: null, - tax_lines: [], - custom_tax_lines: null, - markup: '0.00', - carrier_identifier: null, - carrier_service_id: null, - api_client_id: '580111', - delivery_option_group: { - token: '26492692a443ee35c30eb82073bacaa8', - type: 'one_time_purchase', - }, - delivery_expectation_range: null, - delivery_expectation_type: null, - id: null, - requested_fulfillment_service_id: null, - delivery_category: null, - validation_context: null, - applied_discounts: [], - }, - ], - taxes_included: false, - total_weight: 0, - customer_locale: 'en-US', - name: '#35374569160817', - abandoned_checkout_url: - 'https://pixel-testing-rs.myshopify.com/59026964593/checkouts/ac/Z2NwLXVzLWVhc3QxOjAxSjdXRjdOQjY0NlFFNFdQVEg0MTRFM1E2/recover?key=8195f56ee0de230b3a0469cc692f3436', - discount_codes: [], - tax_lines: [], - presentment_currency: 'USD', - source_name: 'web', - total_line_items_price: '729.95', - total_discounts: '0.00', - subtotal_price: '729.95', - total_duties: '0.00', - products: [ - { - product_id: 7234590638193, - price: '729.95', - brand: 'pixel-testing-rs', - quantity: 1, - key: '41327143059569', - fulfillment_service: 'manual', - gift_card: false, - grams: 0, - presentment_title: 'The Multi-location Snowboard', - presentment_variant_title: '', - requires_shipping: true, - tax_lines: [], - taxable: true, - title: 'The Multi-location Snowboard', - unit_price_measurement: { - measured_type: null, - quantity_value: null, - quantity_unit: null, - reference_value: null, - reference_unit: null, - }, - compare_at_price: null, - line_price: '729.95', - applied_discounts: [], - destination_location_id: null, - user_id: null, - rank: null, - origin_location_id: null, - properties: {}, - variant: '41327143059569 729.95 ', - }, - ], - }, - userId: '7188389789809', - traits: { - email: 'testuser101@gmail.com', - firstName: 'testuser', - lastName: 'dummy', - address: { - id: null, - customer_id: 7188389789809, - first_name: 'testuser', - last_name: 'dummy', - company: null, - address1: 'oakwood bridge', - address2: 'Hedgetown', - city: 'KLF', - province: 'Arizona', - country: 'United States', - zip: '85003', - phone: null, - name: 'testuser dummy', - province_code: 'AZ', - country_code: 'US', - country_name: 'United States', - default: true, - }, - acceptsMarketing: false, - orderCount: 0, - state: 'disabled', - totalSpent: '0.00', - verifiedEmail: true, - taxExempt: false, - tags: '', - currency: 'USD', - adminGraphqlApiId: 'gid://shopify/Customer/7188389789809', - shippingAddress: { - first_name: 'testuser', - address1: 'oakwood bridge', - phone: null, - city: 'KLF', - zip: '85003', - province: 'Arizona', - country: 'United States', - last_name: 'dummy', - address2: 'Hedgetown', - company: null, - latitude: null, - longitude: null, - name: 'testuser dummy', - country_code: 'US', - province_code: 'AZ', - }, - }, - timestamp: '2024-09-17T07:29:02.000Z', - anonymousId: '5d3e2cb6-4011-5c9c-b7ee-11bc1e905097', - }, - ], - }, - }, - ], - }, - }, - mockFns: () => { - defaultMockFns(); - }, - }, - { - name: 'shopify', - description: 'Track Call -> Cart Update event', - module: 'source', - version: 'v1', - input: { - request: { - body: [ - { - event: { - id: 'Z2NwLXVzLWVhc3QxOjAxSjdXRjdOQjY0NlFFNFdQVEg0MTRFM1E2', - token: 'Z2NwLXVzLWVhc3QxOjAxSjdXRjdOQjY0NlFFNFdQVEg0MTRFM1E2', - line_items: [ - { - id: 41327143059569, - properties: null, - quantity: 3, - variant_id: 41327143059569, - key: '41327143059569:90562f18109e0e6484b0c297e7981b30', - discounted_price: '729.95', - discounts: [], - gift_card: false, - grams: 0, - line_price: '2189.85', - original_line_price: '2189.85', - original_price: '729.95', - price: '729.95', - product_id: 7234590638193, - sku: '', - taxable: true, - title: 'The Multi-location Snowboard', - total_discount: '0.00', - vendor: 'pixel-testing-rs', - discounted_price_set: { - shop_money: { - amount: '729.95', - currency_code: 'USD', - }, - presentment_money: { - amount: '729.95', - currency_code: 'USD', - }, - }, - line_price_set: { - shop_money: { - amount: '2189.85', - currency_code: 'USD', - }, - presentment_money: { - amount: '2189.85', - currency_code: 'USD', - }, - }, - original_line_price_set: { - shop_money: { - amount: '2189.85', - currency_code: 'USD', - }, - presentment_money: { - amount: '2189.85', - currency_code: 'USD', - }, - }, - price_set: { - shop_money: { - amount: '729.95', - currency_code: 'USD', - }, - presentment_money: { - amount: '729.95', - currency_code: 'USD', - }, - }, - total_discount_set: { - shop_money: { - amount: '0.0', - currency_code: 'USD', - }, - presentment_money: { - amount: '0.0', - currency_code: 'USD', - }, - }, - }, - ], - note: '', - updated_at: '2024-09-17T08:15:13.280Z', - created_at: '2024-09-16T03:50:15.478Z', - query_parameters: { - topic: ['carts_update'], - writeKey: ['2l9QoM7KRMJLMcYhXNUVDT0Mqbd'], - }, - }, - source: dummySourceConfig, - }, - ], - method: 'POST', - headers: { 'Content-Type': 'application/json' }, - }, - pathSuffix: '', - }, - output: { - response: { - status: 200, - body: [ - { - output: { - batch: [ - { - context: { - library: { - name: 'RudderStack Shopify Cloud', - version: '1.0.0', - }, - integration: { - name: 'SHOPIFY', - }, - topic: 'carts_update', - }, - integrations: { - SHOPIFY: true, - }, - type: 'track', - event: 'Cart Update', - properties: { - id: 'Z2NwLXVzLWVhc3QxOjAxSjdXRjdOQjY0NlFFNFdQVEg0MTRFM1E2', - token: 'Z2NwLXVzLWVhc3QxOjAxSjdXRjdOQjY0NlFFNFdQVEg0MTRFM1E2', - note: '', - updated_at: '2024-09-17T08:15:13.280Z', - created_at: '2024-09-16T03:50:15.478Z', - products: [ - { - product_id: 7234590638193, - price: '729.95', - brand: 'pixel-testing-rs', - quantity: 3, - id: 41327143059569, - properties: null, - key: '41327143059569:90562f18109e0e6484b0c297e7981b30', - discounted_price: '729.95', - discounts: [], - gift_card: false, - grams: 0, - line_price: '2189.85', - original_line_price: '2189.85', - original_price: '729.95', - taxable: true, - title: 'The Multi-location Snowboard', - total_discount: '0.00', - discounted_price_set: { - shop_money: { - amount: '729.95', - currency_code: 'USD', - }, - presentment_money: { - amount: '729.95', - currency_code: 'USD', - }, - }, - line_price_set: { - shop_money: { - amount: '2189.85', - currency_code: 'USD', - }, - presentment_money: { - amount: '2189.85', - currency_code: 'USD', - }, - }, - original_line_price_set: { - shop_money: { - amount: '2189.85', - currency_code: 'USD', - }, - presentment_money: { - amount: '2189.85', - currency_code: 'USD', - }, - }, - price_set: { - shop_money: { - amount: '729.95', - currency_code: 'USD', - }, - presentment_money: { - amount: '729.95', - currency_code: 'USD', - }, - }, - total_discount_set: { - shop_money: { - amount: '0.0', - currency_code: 'USD', - }, - presentment_money: { - amount: '0.0', - currency_code: 'USD', - }, - }, - variant: '41327143059569 ', - }, - ], - }, - anonymousId: '5d3e2cb6-4011-5c9c-b7ee-11bc1e905097', - }, - ], - }, - }, - ], - }, - }, - mockFns: () => { - defaultMockFns(); - }, - }, -]; diff --git a/test/integrations/sources/shopify/webhookTestScenarios/CheckoutEventsTests.ts b/test/integrations/sources/shopify/webhookTestScenarios/CheckoutEventsTests.ts new file mode 100644 index 0000000000..ade496efb7 --- /dev/null +++ b/test/integrations/sources/shopify/webhookTestScenarios/CheckoutEventsTests.ts @@ -0,0 +1,1687 @@ +// This file contains the test scenarios for the server-side events from the Shopify GraphQL API for +// the v1 transformation flow +import { mockFns } from '../mocks'; +import { dummySourceConfig } from '../constants'; + +export const checkoutEventsTestScenarios = [ + { + id: 'c001', + name: 'shopify', + description: 'Track Call -> Checkout Started event from Pixel app', + module: 'source', + version: 'v1', + input: { + request: { + body: [ + { + event: { + id: 35550298931313, + token: '84ad78572dae52a8cbea7d55371afe89', + cart_token: 'Z2NwLXVzLWVhc3QxOjAxSkJaTUVRSjgzNUJUN1BTNjEzRFdRUFFQ', + email: null, + gateway: null, + buyer_accepts_marketing: false, + buyer_accepts_sms_marketing: false, + sms_marketing_phone: null, + created_at: '2024-11-06T02:22:00+00:00', + updated_at: '2024-11-05T21:22:02-05:00', + landing_site: '/', + note: '', + note_attributes: [], + referring_site: '', + shipping_lines: [], + shipping_address: [], + taxes_included: false, + total_weight: 0, + currency: 'USD', + completed_at: null, + phone: null, + customer_locale: 'en-US', + line_items: [ + { + key: '41327142600817', + fulfillment_service: 'manual', + gift_card: false, + grams: 0, + presentment_title: 'The Collection Snowboard: Hydrogen', + presentment_variant_title: '', + product_id: 7234590408817, + quantity: 1, + requires_shipping: true, + sku: '', + tax_lines: [], + taxable: true, + title: 'The Collection Snowboard: Hydrogen', + variant_id: 41327142600817, + variant_title: '', + variant_price: '600.00', + vendor: 'Hydrogen Vendor', + unit_price_measurement: { + measured_type: null, + quantity_value: null, + quantity_unit: null, + reference_value: null, + reference_unit: null, + }, + compare_at_price: null, + line_price: '600.00', + price: '600.00', + applied_discounts: [], + destination_location_id: null, + user_id: null, + rank: null, + origin_location_id: null, + properties: {}, + }, + ], + name: '#35550298931313', + abandoned_checkout_url: + 'https://pixel-testing-rs.myshopify.com/59026964593/checkouts/ac/Z2NwLXVzLWVhc3QxOjAxSkJaTUVRSjgzNUJUN1BTNjEzRFdRUFFQ/recover?key=0385163be3875d3a2117e982d9cc3517&locale=en-US', + discount_codes: [], + tax_lines: [], + presentment_currency: 'USD', + source_name: 'web', + total_line_items_price: '600.00', + total_tax: '0.00', + total_discounts: '0.00', + subtotal_price: '600.00', + total_price: '600.00', + total_duties: '0.00', + device_id: null, + user_id: null, + location_id: null, + source_identifier: null, + source_url: null, + source: null, + closed_at: null, + query_parameters: { + topic: ['checkouts_create'], + version: ['pixel'], + writeKey: ['2mw9SN679HngnXXXHT4oSVVBVmb'], + }, + }, + source: dummySourceConfig, + query_parameters: { + topic: ['carts_update'], + writeKey: ['2mw9SN679HngnXXXHT4oSVVBVmb'], + version: ['pixel'], + }, + }, + ], + method: 'POST', + headers: { 'Content-Type': 'application/json' }, + }, + pathSuffix: '', + }, + output: { + response: { + status: 200, + body: [ + { + output: { + batch: [ + { + context: { + library: { + eventOrigin: 'server', + name: 'RudderStack Shopify Cloud', + version: '2.0.0', + }, + integration: { + name: 'SHOPIFY', + }, + topic: 'checkouts_create', + cart_token: 'Z2NwLXVzLWVhc3QxOjAxSkJaTUVRSjgzNUJUN1BTNjEzRFdRUFFQ', + shopifyDetails: { + id: 35550298931313, + token: '84ad78572dae52a8cbea7d55371afe89', + cart_token: 'Z2NwLXVzLWVhc3QxOjAxSkJaTUVRSjgzNUJUN1BTNjEzRFdRUFFQ', + email: null, + gateway: null, + buyer_accepts_marketing: false, + buyer_accepts_sms_marketing: false, + sms_marketing_phone: null, + created_at: '2024-11-06T02:22:00+00:00', + updated_at: '2024-11-05T21:22:02-05:00', + landing_site: '/', + note: '', + note_attributes: [], + referring_site: '', + shipping_lines: [], + shipping_address: [], + taxes_included: false, + total_weight: 0, + currency: 'USD', + completed_at: null, + phone: null, + customer_locale: 'en-US', + line_items: [ + { + key: '41327142600817', + fulfillment_service: 'manual', + gift_card: false, + grams: 0, + presentment_title: 'The Collection Snowboard: Hydrogen', + presentment_variant_title: '', + product_id: 7234590408817, + quantity: 1, + requires_shipping: true, + sku: '', + tax_lines: [], + taxable: true, + title: 'The Collection Snowboard: Hydrogen', + variant_id: 41327142600817, + variant_title: '', + variant_price: '600.00', + vendor: 'Hydrogen Vendor', + unit_price_measurement: { + measured_type: null, + quantity_value: null, + quantity_unit: null, + reference_value: null, + reference_unit: null, + }, + compare_at_price: null, + line_price: '600.00', + price: '600.00', + applied_discounts: [], + destination_location_id: null, + user_id: null, + rank: null, + origin_location_id: null, + properties: {}, + }, + ], + name: '#35550298931313', + abandoned_checkout_url: + 'https://pixel-testing-rs.myshopify.com/59026964593/checkouts/ac/Z2NwLXVzLWVhc3QxOjAxSkJaTUVRSjgzNUJUN1BTNjEzRFdRUFFQ/recover?key=0385163be3875d3a2117e982d9cc3517&locale=en-US', + discount_codes: [], + tax_lines: [], + presentment_currency: 'USD', + source_name: 'web', + total_line_items_price: '600.00', + total_tax: '0.00', + total_discounts: '0.00', + subtotal_price: '600.00', + total_price: '600.00', + total_duties: '0.00', + device_id: null, + user_id: null, + location_id: null, + source_identifier: null, + source_url: null, + source: null, + closed_at: null, + }, + }, + integrations: { + SHOPIFY: true, + }, + type: 'track', + event: 'Checkout Started', + properties: { + order_id: 35550298931313, + value: '600.00', + tax: '0.00', + currency: 'USD', + products: [ + { + product_id: 7234590408817, + price: '600.00', + brand: 'Hydrogen Vendor', + quantity: 1, + }, + ], + }, + timestamp: '2024-11-06T02:22:02.000Z', + traits: { + shippingAddress: [], + }, + anonymousId: '5d3e2cb6-4011-5c9c-b7ee-11bc1e905097', + }, + ], + }, + }, + ], + }, + }, + }, + { + id: 'c002', + name: 'shopify', + description: 'Track Call -> Checkout Updated event from Pixel app', + module: 'source', + version: 'v1', + input: { + request: { + body: [ + { + event: { + query_parameters: { + topic: ['checkouts_update'], + writeKey: ['2mw9SN679HngnXXXHT4oSVVBVmb'], + version: ['pixel'], + }, + id: 35374569160817, + token: 'e89d4437003b6b8480f8bc7f8036a659', + cart_token: 'Z2NwLXVzLWVhc3QxOjAxSjdXRjdOQjY0NlFFNFdQVEg0MTRFM1E2', + email: 'testuser101@gmail.com', + created_at: '2024-09-16T03:50:1500:00', + updated_at: '2024-09-17T03:29:02-04:00', + note: '', + note_attributes: [], + shipping_address: { + first_name: 'testuser', + address1: 'oakwood bridge', + phone: null, + city: 'KLF', + zip: '85003', + province: 'Arizona', + country: 'United States', + last_name: 'dummy', + address2: 'Hedgetown', + company: null, + latitude: null, + longitude: null, + name: 'testuser dummy', + country_code: 'US', + province_code: 'AZ', + }, + total_weight: 0, + currency: 'USD', + customer_locale: 'en-US', + line_items: [ + { + key: '41327143059569', + fulfillment_service: 'manual', + gift_card: false, + grams: 0, + presentment_title: 'The Multi-location Snowboard', + presentment_variant_title: '', + product_id: 7234590638193, + quantity: 1, + requires_shipping: true, + sku: '', + tax_lines: [], + taxable: true, + title: 'The Multi-location Snowboard', + variant_id: 41327143059569, + variant_title: '', + variant_price: '729.95', + vendor: 'pixel-testing-rs', + unit_price_measurement: { + measured_type: null, + quantity_value: null, + quantity_unit: null, + reference_value: null, + reference_unit: null, + }, + compare_at_price: null, + line_price: '729.95', + price: '729.95', + applied_discounts: [], + destination_location_id: null, + user_id: null, + rank: null, + origin_location_id: null, + properties: {}, + }, + ], + name: '#35374569160817', + abandoned_checkout_url: + 'https://pixel-testing-rs.myshopify.com/59026964593/checkouts/ac/Z2NwLXVzLWVhc3QxOjAxSjdXRjdOQjY0NlFFNFdQVEg0MTRFM1E2/recover?key=8195f56ee0de230b3a0469cc692f3436', + presentment_currency: 'USD', + total_tax: '0.00', + total_discounts: '0.00', + subtotal_price: '729.95', + total_price: '736.85', + total_duties: '0.00', + customer: { + id: 7188389789809, + email: 'testuser101@gmail.com', + accepts_marketing: false, + created_at: null, + updated_at: null, + first_name: 'testuser', + last_name: 'dummy', + orders_count: 0, + state: 'disabled', + total_spent: '0.00', + last_order_id: null, + note: null, + verified_email: true, + multipass_identifier: null, + tax_exempt: false, + phone: null, + tags: '', + currency: 'USD', + accepts_marketing_updated_at: null, + admin_graphql_api_id: 'gid://shopify/Customer/7188389789809', + default_address: { + id: null, + customer_id: 7188389789809, + first_name: 'testuser', + last_name: 'dummy', + company: null, + address1: 'oakwood bridge', + address2: 'Hedgetown', + city: 'KLF', + province: 'Arizona', + country: 'United States', + zip: '85003', + phone: null, + name: 'testuser dummy', + province_code: 'AZ', + country_code: 'US', + country_name: 'United States', + default: true, + }, + last_order_name: null, + marketing_opt_in_level: null, + }, + }, + source: dummySourceConfig, + }, + ], + method: 'POST', + headers: { 'Content-Type': 'application/json' }, + }, + pathSuffix: '', + }, + output: { + response: { + status: 200, + body: [ + { + output: { + batch: [ + { + anonymousId: '5d3e2cb6-4011-5c9c-b7ee-11bc1e905097', + context: { + cart_token: 'Z2NwLXVzLWVhc3QxOjAxSjdXRjdOQjY0NlFFNFdQVEg0MTRFM1E2', + integration: { + name: 'SHOPIFY', + }, + library: { + eventOrigin: 'server', + name: 'RudderStack Shopify Cloud', + version: '2.0.0', + }, + shopifyDetails: { + id: 35374569160817, + token: 'e89d4437003b6b8480f8bc7f8036a659', + cart_token: 'Z2NwLXVzLWVhc3QxOjAxSjdXRjdOQjY0NlFFNFdQVEg0MTRFM1E2', + email: 'testuser101@gmail.com', + created_at: '2024-09-16T03:50:1500:00', + updated_at: '2024-09-17T03:29:02-04:00', + note: '', + note_attributes: [], + shipping_address: { + first_name: 'testuser', + address1: 'oakwood bridge', + phone: null, + city: 'KLF', + zip: '85003', + province: 'Arizona', + country: 'United States', + last_name: 'dummy', + address2: 'Hedgetown', + company: null, + latitude: null, + longitude: null, + name: 'testuser dummy', + country_code: 'US', + province_code: 'AZ', + }, + total_weight: 0, + currency: 'USD', + customer_locale: 'en-US', + line_items: [ + { + key: '41327143059569', + fulfillment_service: 'manual', + gift_card: false, + grams: 0, + presentment_title: 'The Multi-location Snowboard', + presentment_variant_title: '', + product_id: 7234590638193, + quantity: 1, + requires_shipping: true, + sku: '', + tax_lines: [], + taxable: true, + title: 'The Multi-location Snowboard', + variant_id: 41327143059569, + variant_title: '', + variant_price: '729.95', + vendor: 'pixel-testing-rs', + unit_price_measurement: { + measured_type: null, + quantity_value: null, + quantity_unit: null, + reference_value: null, + reference_unit: null, + }, + compare_at_price: null, + line_price: '729.95', + price: '729.95', + applied_discounts: [], + destination_location_id: null, + user_id: null, + rank: null, + origin_location_id: null, + properties: {}, + }, + ], + name: '#35374569160817', + abandoned_checkout_url: + 'https://pixel-testing-rs.myshopify.com/59026964593/checkouts/ac/Z2NwLXVzLWVhc3QxOjAxSjdXRjdOQjY0NlFFNFdQVEg0MTRFM1E2/recover?key=8195f56ee0de230b3a0469cc692f3436', + presentment_currency: 'USD', + total_tax: '0.00', + total_discounts: '0.00', + subtotal_price: '729.95', + total_price: '736.85', + total_duties: '0.00', + customer: { + id: 7188389789809, + email: 'testuser101@gmail.com', + accepts_marketing: false, + created_at: null, + updated_at: null, + first_name: 'testuser', + last_name: 'dummy', + orders_count: 0, + state: 'disabled', + total_spent: '0.00', + last_order_id: null, + note: null, + verified_email: true, + multipass_identifier: null, + tax_exempt: false, + phone: null, + tags: '', + currency: 'USD', + accepts_marketing_updated_at: null, + admin_graphql_api_id: 'gid://shopify/Customer/7188389789809', + default_address: { + id: null, + customer_id: 7188389789809, + first_name: 'testuser', + last_name: 'dummy', + company: null, + address1: 'oakwood bridge', + address2: 'Hedgetown', + city: 'KLF', + province: 'Arizona', + country: 'United States', + zip: '85003', + phone: null, + name: 'testuser dummy', + province_code: 'AZ', + country_code: 'US', + country_name: 'United States', + default: true, + }, + last_order_name: null, + marketing_opt_in_level: null, + }, + }, + topic: 'checkouts_update', + }, + event: 'Checkout Updated', + integrations: { + SHOPIFY: true, + }, + properties: { + currency: 'USD', + order_id: 35374569160817, + products: [ + { + brand: 'pixel-testing-rs', + price: '729.95', + product_id: 7234590638193, + quantity: 1, + }, + ], + tax: '0.00', + value: '736.85', + }, + timestamp: '2024-09-17T07:29:02.000Z', + traits: { + acceptsMarketing: false, + address: { + address1: 'oakwood bridge', + address2: 'Hedgetown', + city: 'KLF', + company: null, + country: 'United States', + country_code: 'US', + country_name: 'United States', + customer_id: 7188389789809, + default: true, + first_name: 'testuser', + id: null, + last_name: 'dummy', + name: 'testuser dummy', + phone: null, + province: 'Arizona', + province_code: 'AZ', + zip: '85003', + }, + adminGraphqlApiId: 'gid://shopify/Customer/7188389789809', + currency: 'USD', + email: 'testuser101@gmail.com', + firstName: 'testuser', + lastName: 'dummy', + orderCount: 0, + shippingAddress: { + address1: 'oakwood bridge', + address2: 'Hedgetown', + city: 'KLF', + company: null, + country: 'United States', + country_code: 'US', + first_name: 'testuser', + last_name: 'dummy', + latitude: null, + longitude: null, + name: 'testuser dummy', + phone: null, + province: 'Arizona', + province_code: 'AZ', + zip: '85003', + }, + state: 'disabled', + tags: '', + taxExempt: false, + totalSpent: '0.00', + verifiedEmail: true, + }, + type: 'track', + userId: '7188389789809', + }, + ], + }, + }, + ], + }, + }, + }, + { + id: 'c003', + name: 'shopify', + description: 'Track Call -> Order Updated event from Pixel app', + module: 'source', + version: 'v1', + input: { + request: { + body: [ + { + event: { + id: 5778367414385, + admin_graphql_api_id: 'gid://shopify/Order/5778367414385', + app_id: 580111, + browser_ip: '139.5.255.205', + cart_token: 'Z2NwLXVzLWVhc3QxOjAxSkJaTUVRSjgzNUJUN1BTNjEzRFdRUFFQ', + checkout_id: 35550298931313, + checkout_token: '84ad78572dae52a8cbea7d55371afe89', + confirmation_number: 'DPPARQ8UJ', + contact_email: 'henry@wfls.com', + created_at: '2024-11-05T21:54:49-05:00', + currency: 'USD', + current_subtotal_price: '600.00', + current_subtotal_price_set: { + shop_money: { + amount: '600.00', + currency_code: 'USD', + }, + presentment_money: { + amount: '600.00', + currency_code: 'USD', + }, + }, + current_total_discounts: '0.00', + current_total_discounts_set: { + shop_money: { + amount: '0.00', + currency_code: 'USD', + }, + presentment_money: { + amount: '0.00', + currency_code: 'USD', + }, + }, + current_total_price: '600.00', + current_total_price_set: { + shop_money: { + amount: '600.00', + currency_code: 'USD', + }, + presentment_money: { + amount: '600.00', + currency_code: 'USD', + }, + }, + current_total_tax: '0.00', + current_total_tax_set: { + shop_money: { + amount: '0.00', + currency_code: 'USD', + }, + presentment_money: { + amount: '0.00', + currency_code: 'USD', + }, + }, + customer_locale: 'en-US', + discount_codes: [], + email: 'henry@wfls.com', + estimated_taxes: false, + merchant_of_record_app_id: null, + name: '#1017', + note: null, + note_attributes: [], + number: 17, + order_number: 1017, + order_status_url: + 'https://pixel-testing-rs.myshopify.com/59026964593/orders/676613a0027fc8240e16d67fdc9f5ac8/authenticate?key=a70bbe7ec8abcc46b77e4331e4df8c60', + original_total_additional_fees_set: null, + original_total_duties_set: null, + payment_gateway_names: ['bogus'], + phone: null, + presentment_currency: 'USD', + source_identifier: '4d92cf60cc24a1bd95929e17ead9845f', + subtotal_price: '600.00', + subtotal_price_set: { + shop_money: { + amount: '600.00', + currency_code: 'USD', + }, + presentment_money: { + amount: '600.00', + currency_code: 'USD', + }, + }, + tax_lines: [], + token: '676613a0027fc8240e16d67fdc9f5ac8', + total_discounts: '0.00', + total_discounts_set: { + shop_money: { + amount: '0.00', + currency_code: 'USD', + }, + presentment_money: { + amount: '0.00', + currency_code: 'USD', + }, + }, + total_line_items_price: '600.00', + total_line_items_price_set: { + shop_money: { + amount: '600.00', + currency_code: 'USD', + }, + presentment_money: { + amount: '600.00', + currency_code: 'USD', + }, + }, + total_price: '600.00', + total_price_set: { + shop_money: { + amount: '600.00', + currency_code: 'USD', + }, + presentment_money: { + amount: '600.00', + currency_code: 'USD', + }, + }, + total_shipping_price_set: { + shop_money: { + amount: '0.00', + currency_code: 'USD', + }, + presentment_money: { + amount: '0.00', + currency_code: 'USD', + }, + }, + total_tax: '0.00', + total_tax_set: { + shop_money: { + amount: '0.00', + currency_code: 'USD', + }, + presentment_money: { + amount: '0.00', + currency_code: 'USD', + }, + }, + total_weight: 0, + updated_at: '2024-11-05T21:54:50-05:00', + user_id: null, + billing_address: { + first_name: 'yodi', + address1: 'Yuma Proving Ground', + phone: null, + city: 'Yuma Proving Ground', + zip: '85365', + province: 'Arizona', + country: 'United States', + last_name: 'waffles', + address2: 'suite 001', + company: null, + latitude: 33.0177811, + longitude: -114.2525392, + name: 'yodi waffles', + country_code: 'US', + province_code: 'AZ', + }, + customer: { + id: 7358220173425, + email: 'henry@wfls.com', + created_at: '2024-10-23T16:03:11-04:00', + updated_at: '2024-11-05T21:54:49-05:00', + first_name: 'yodi', + last_name: 'waffles', + state: 'disabled', + note: null, + verified_email: true, + multipass_identifier: null, + tax_exempt: false, + phone: null, + email_marketing_consent: { + state: 'not_subscribed', + opt_in_level: 'single_opt_in', + consent_updated_at: null, + }, + sms_marketing_consent: null, + tags: '', + currency: 'USD', + tax_exemptions: [], + admin_graphql_api_id: 'gid://shopify/Customer/7358220173425', + default_address: { + id: 8715246862449, + customer_id: 7358220173425, + first_name: 'henry', + last_name: 'waffles', + company: null, + address1: 'Yuimaru Kitchen', + address2: '6', + city: 'Johnson City', + province: 'Tennessee', + country: 'United States', + zip: '37604', + phone: null, + name: 'henry waffles', + province_code: 'TN', + country_code: 'US', + country_name: 'United States', + default: true, + }, + }, + line_items: [ + { + id: 14234727743601, + admin_graphql_api_id: 'gid://shopify/LineItem/14234727743601', + attributed_staffs: [], + current_quantity: 1, + fulfillable_quantity: 1, + fulfillment_service: 'manual', + fulfillment_status: null, + gift_card: false, + grams: 0, + name: 'The Collection Snowboard: Hydrogen', + price: '600.00', + price_set: { + shop_money: { + amount: '600.00', + currency_code: 'USD', + }, + presentment_money: { + amount: '600.00', + currency_code: 'USD', + }, + }, + product_exists: true, + product_id: 7234590408817, + properties: [], + quantity: 1, + requires_shipping: true, + sku: '', + taxable: true, + title: 'The Collection Snowboard: Hydrogen', + total_discount: '0.00', + total_discount_set: { + shop_money: { + amount: '0.00', + currency_code: 'USD', + }, + presentment_money: { + amount: '0.00', + currency_code: 'USD', + }, + }, + variant_id: 41327142600817, + variant_inventory_management: 'shopify', + variant_title: null, + vendor: 'Hydrogen Vendor', + tax_lines: [], + duties: [], + discount_allocations: [], + }, + ], + payment_terms: null, + refunds: [], + shipping_address: { + first_name: 'henry', + address1: 'Yuimaru Kitchen', + phone: null, + city: 'Johnson City', + zip: '37604', + province: 'Tennessee', + country: 'United States', + last_name: 'waffles', + address2: '6', + company: null, + latitude: 36.3528845, + longitude: -82.4006335, + name: 'henry waffles', + country_code: 'US', + province_code: 'TN', + }, + query_parameters: { + topic: ['orders_updated'], + version: ['pixel'], + writeKey: ['2mw9SN679HngnXXXHT4oSVVBVmb'], + }, + }, + source: dummySourceConfig, + }, + ], + method: 'POST', + headers: { 'Content-Type': 'application/json' }, + }, + pathSuffix: '', + }, + output: { + response: { + status: 200, + body: [ + { + output: { + batch: [ + { + context: { + library: { + eventOrigin: 'server', + name: 'RudderStack Shopify Cloud', + version: '2.0.0', + }, + integration: { + name: 'SHOPIFY', + }, + topic: 'orders_updated', + cart_token: 'Z2NwLXVzLWVhc3QxOjAxSkJaTUVRSjgzNUJUN1BTNjEzRFdRUFFQ', + checkout_token: '84ad78572dae52a8cbea7d55371afe89', + shopifyDetails: { + id: 5778367414385, + admin_graphql_api_id: 'gid://shopify/Order/5778367414385', + app_id: 580111, + browser_ip: '139.5.255.205', + cart_token: 'Z2NwLXVzLWVhc3QxOjAxSkJaTUVRSjgzNUJUN1BTNjEzRFdRUFFQ', + checkout_id: 35550298931313, + checkout_token: '84ad78572dae52a8cbea7d55371afe89', + confirmation_number: 'DPPARQ8UJ', + contact_email: 'henry@wfls.com', + created_at: '2024-11-05T21:54:49-05:00', + currency: 'USD', + current_subtotal_price: '600.00', + current_subtotal_price_set: { + shop_money: { + amount: '600.00', + currency_code: 'USD', + }, + presentment_money: { + amount: '600.00', + currency_code: 'USD', + }, + }, + current_total_discounts: '0.00', + current_total_discounts_set: { + shop_money: { + amount: '0.00', + currency_code: 'USD', + }, + presentment_money: { + amount: '0.00', + currency_code: 'USD', + }, + }, + current_total_price: '600.00', + current_total_price_set: { + shop_money: { + amount: '600.00', + currency_code: 'USD', + }, + presentment_money: { + amount: '600.00', + currency_code: 'USD', + }, + }, + current_total_tax: '0.00', + current_total_tax_set: { + shop_money: { + amount: '0.00', + currency_code: 'USD', + }, + presentment_money: { + amount: '0.00', + currency_code: 'USD', + }, + }, + customer_locale: 'en-US', + discount_codes: [], + email: 'henry@wfls.com', + estimated_taxes: false, + merchant_of_record_app_id: null, + name: '#1017', + note: null, + note_attributes: [], + number: 17, + order_number: 1017, + order_status_url: + 'https://pixel-testing-rs.myshopify.com/59026964593/orders/676613a0027fc8240e16d67fdc9f5ac8/authenticate?key=a70bbe7ec8abcc46b77e4331e4df8c60', + original_total_additional_fees_set: null, + original_total_duties_set: null, + payment_gateway_names: ['bogus'], + phone: null, + presentment_currency: 'USD', + source_identifier: '4d92cf60cc24a1bd95929e17ead9845f', + subtotal_price: '600.00', + subtotal_price_set: { + shop_money: { + amount: '600.00', + currency_code: 'USD', + }, + presentment_money: { + amount: '600.00', + currency_code: 'USD', + }, + }, + tax_lines: [], + token: '676613a0027fc8240e16d67fdc9f5ac8', + total_discounts: '0.00', + total_discounts_set: { + shop_money: { + amount: '0.00', + currency_code: 'USD', + }, + presentment_money: { + amount: '0.00', + currency_code: 'USD', + }, + }, + total_line_items_price: '600.00', + total_line_items_price_set: { + shop_money: { + amount: '600.00', + currency_code: 'USD', + }, + presentment_money: { + amount: '600.00', + currency_code: 'USD', + }, + }, + total_price: '600.00', + total_price_set: { + shop_money: { + amount: '600.00', + currency_code: 'USD', + }, + presentment_money: { + amount: '600.00', + currency_code: 'USD', + }, + }, + total_shipping_price_set: { + shop_money: { + amount: '0.00', + currency_code: 'USD', + }, + presentment_money: { + amount: '0.00', + currency_code: 'USD', + }, + }, + total_tax: '0.00', + total_tax_set: { + shop_money: { + amount: '0.00', + currency_code: 'USD', + }, + presentment_money: { + amount: '0.00', + currency_code: 'USD', + }, + }, + total_weight: 0, + updated_at: '2024-11-05T21:54:50-05:00', + user_id: null, + billing_address: { + first_name: 'yodi', + address1: 'Yuma Proving Ground', + phone: null, + city: 'Yuma Proving Ground', + zip: '85365', + province: 'Arizona', + country: 'United States', + last_name: 'waffles', + address2: 'suite 001', + company: null, + latitude: 33.0177811, + longitude: -114.2525392, + name: 'yodi waffles', + country_code: 'US', + province_code: 'AZ', + }, + customer: { + id: 7358220173425, + email: 'henry@wfls.com', + created_at: '2024-10-23T16:03:11-04:00', + updated_at: '2024-11-05T21:54:49-05:00', + first_name: 'yodi', + last_name: 'waffles', + state: 'disabled', + note: null, + verified_email: true, + multipass_identifier: null, + tax_exempt: false, + phone: null, + email_marketing_consent: { + state: 'not_subscribed', + opt_in_level: 'single_opt_in', + consent_updated_at: null, + }, + sms_marketing_consent: null, + tags: '', + currency: 'USD', + tax_exemptions: [], + admin_graphql_api_id: 'gid://shopify/Customer/7358220173425', + default_address: { + id: 8715246862449, + customer_id: 7358220173425, + first_name: 'henry', + last_name: 'waffles', + company: null, + address1: 'Yuimaru Kitchen', + address2: '6', + city: 'Johnson City', + province: 'Tennessee', + country: 'United States', + zip: '37604', + phone: null, + name: 'henry waffles', + province_code: 'TN', + country_code: 'US', + country_name: 'United States', + default: true, + }, + }, + line_items: [ + { + id: 14234727743601, + admin_graphql_api_id: 'gid://shopify/LineItem/14234727743601', + attributed_staffs: [], + current_quantity: 1, + fulfillable_quantity: 1, + fulfillment_service: 'manual', + fulfillment_status: null, + gift_card: false, + grams: 0, + name: 'The Collection Snowboard: Hydrogen', + price: '600.00', + price_set: { + shop_money: { + amount: '600.00', + currency_code: 'USD', + }, + presentment_money: { + amount: '600.00', + currency_code: 'USD', + }, + }, + product_exists: true, + product_id: 7234590408817, + properties: [], + quantity: 1, + requires_shipping: true, + sku: '', + taxable: true, + title: 'The Collection Snowboard: Hydrogen', + total_discount: '0.00', + total_discount_set: { + shop_money: { + amount: '0.00', + currency_code: 'USD', + }, + presentment_money: { + amount: '0.00', + currency_code: 'USD', + }, + }, + variant_id: 41327142600817, + variant_inventory_management: 'shopify', + variant_title: null, + vendor: 'Hydrogen Vendor', + tax_lines: [], + duties: [], + discount_allocations: [], + }, + ], + payment_terms: null, + refunds: [], + shipping_address: { + first_name: 'henry', + address1: 'Yuimaru Kitchen', + phone: null, + city: 'Johnson City', + zip: '37604', + province: 'Tennessee', + country: 'United States', + last_name: 'waffles', + address2: '6', + company: null, + latitude: 36.3528845, + longitude: -82.4006335, + name: 'henry waffles', + country_code: 'US', + province_code: 'TN', + }, + }, + order_token: '676613a0027fc8240e16d67fdc9f5ac8', + }, + integrations: { + SHOPIFY: true, + }, + type: 'track', + event: 'Order Updated', + properties: { + order_id: 5778367414385, + value: '600.00', + tax: '0.00', + currency: 'USD', + products: [ + { + product_id: 7234590408817, + title: 'The Collection Snowboard: Hydrogen', + price: '600.00', + brand: 'Hydrogen Vendor', + quantity: 1, + }, + ], + }, + userId: '7358220173425', + traits: { + email: 'henry@wfls.com', + firstName: 'yodi', + lastName: 'waffles', + address: { + id: 8715246862449, + customer_id: 7358220173425, + first_name: 'henry', + last_name: 'waffles', + company: null, + address1: 'Yuimaru Kitchen', + address2: '6', + city: 'Johnson City', + province: 'Tennessee', + country: 'United States', + zip: '37604', + phone: null, + name: 'henry waffles', + province_code: 'TN', + country_code: 'US', + country_name: 'United States', + default: true, + }, + state: 'disabled', + verifiedEmail: true, + taxExempt: false, + tags: '', + currency: 'USD', + taxExemptions: [], + adminGraphqlApiId: 'gid://shopify/Customer/7358220173425', + shippingAddress: { + first_name: 'henry', + address1: 'Yuimaru Kitchen', + phone: null, + city: 'Johnson City', + zip: '37604', + province: 'Tennessee', + country: 'United States', + last_name: 'waffles', + address2: '6', + company: null, + latitude: 36.3528845, + longitude: -82.4006335, + name: 'henry waffles', + country_code: 'US', + province_code: 'TN', + }, + billingAddress: { + first_name: 'yodi', + address1: 'Yuma Proving Ground', + phone: null, + city: 'Yuma Proving Ground', + zip: '85365', + province: 'Arizona', + country: 'United States', + last_name: 'waffles', + address2: 'suite 001', + company: null, + latitude: 33.0177811, + longitude: -114.2525392, + name: 'yodi waffles', + country_code: 'US', + province_code: 'AZ', + }, + }, + timestamp: '2024-11-06T02:54:50.000Z', + anonymousId: '5d3e2cb6-4011-5c9c-b7ee-11bc1e905097', + }, + ], + }, + }, + ], + }, + }, + }, + { + id: 'c004', + name: 'shopify', + description: 'Track Call -> Order Created event from Pixel app', + module: 'source', + version: 'v1', + input: { + request: { + body: [ + { + event: { + id: 5778367414385, + admin_graphql_api_id: 'gid://shopify/Order/5778367414385', + app_id: 580111, + browser_ip: '139.5.255.205', + cart_token: 'Z2NwLXVzLWVhc3QxOjAxSkJaTUVRSjgzNUJUN1BTNjEzRFdRUFFQ', + checkout_id: 35550298931313, + checkout_token: '84ad78572dae52a8cbea7d55371afe89', + confirmation_number: 'DPPARQ8UJ', + contact_email: 'henry@wfls.com', + created_at: '2024-11-05T21:54:49-05:00', + currency: 'USD', + current_subtotal_price: '600.00', + current_total_discounts: '0.00', + current_total_price: '600.00', + current_total_tax: '0.00', + email: 'henry@wfls.com', + name: '#1017', + order_number: 1017, + order_status_url: + 'https://pixel-testing-rs.myshopify.com/59026964593/orders/676613a0027fc8240e16d67fdc9f5ac8/authenticate?key=a70bbe7ec8abcc46b77e4331e4df8c60', + phone: null, + presentment_currency: 'USD', + subtotal_price: '600.00', + token: '676613a0027fc8240e16d67fdc9f5ac8', + total_discounts: '0.00', + total_line_items_price: '600.00', + total_outstanding: '0.00', + total_price: '600.00', + total_tax: '0.00', + updated_at: '2024-11-05T21:54:50-05:00', + user_id: null, + billing_address: { + first_name: 'yodi', + address1: 'Yuma Proving Ground', + phone: null, + city: 'Yuma Proving Ground', + zip: '85365', + province: 'Arizona', + country: 'United States', + last_name: 'waffles', + address2: 'suite 001', + company: null, + latitude: 33.0177811, + longitude: -114.2525392, + name: 'yodi waffles', + country_code: 'US', + province_code: 'AZ', + }, + customer: { + id: 7358220173425, + email: 'henry@wfls.com', + created_at: '2024-10-23T16:03:11-04:00', + updated_at: '2024-11-05T21:54:49-05:00', + first_name: 'yodi', + last_name: 'waffles', + state: 'disabled', + phone: null, + currency: 'USD', + tax_exemptions: [], + admin_graphql_api_id: 'gid://shopify/Customer/7358220173425', + default_address: { + id: 8715246862449, + customer_id: 7358220173425, + first_name: 'henry', + last_name: 'waffles', + company: null, + address1: 'Yuimaru Kitchen', + address2: '6', + city: 'Johnson City', + province: 'Tennessee', + country: 'United States', + zip: '37604', + phone: null, + name: 'henry waffles', + province_code: 'TN', + country_code: 'US', + country_name: 'United States', + default: true, + }, + }, + line_items: [ + { + id: 14234727743601, + current_quantity: 1, + fulfillable_quantity: 1, + fulfillment_service: 'manual', + gift_card: false, + grams: 0, + name: 'The Collection Snowboard: Hydrogen', + price: '600.00', + product_id: 7234590408817, + quantity: 1, + requires_shipping: true, + sku: '', + taxable: true, + title: 'The Collection Snowboard: Hydrogen', + total_discount: '0.00', + variant_id: 41327142600817, + variant_inventory_management: 'shopify', + variant_title: null, + vendor: 'Hydrogen Vendor', + }, + ], + shipping_address: { + first_name: 'henry', + address1: 'Yuimaru Kitchen', + phone: null, + city: 'Johnson City', + zip: '37604', + province: 'Tennessee', + country: 'United States', + last_name: 'waffles', + address2: '6', + company: null, + latitude: 36.3528845, + longitude: -82.4006335, + name: 'henry waffles', + country_code: 'US', + province_code: 'TN', + }, + query_parameters: { + topic: ['orders_create'], + version: ['pixel'], + writeKey: ['2mw9SN679HngnZkCHT4oSVVBVmb'], + }, + }, + source: dummySourceConfig, + query_parameters: { + topic: ['carts_update'], + writeKey: ['2mw9SN679HngnXXXHT4oSVVBVmb'], + version: ['pixel'], + }, + }, + ], + method: 'POST', + headers: { 'Content-Type': 'application/json' }, + }, + pathSuffix: '', + }, + output: { + response: { + status: 200, + body: [ + { + output: { + batch: [ + { + context: { + library: { + eventOrigin: 'server', + name: 'RudderStack Shopify Cloud', + version: '2.0.0', + }, + integration: { + name: 'SHOPIFY', + }, + topic: 'orders_create', + cart_token: 'Z2NwLXVzLWVhc3QxOjAxSkJaTUVRSjgzNUJUN1BTNjEzRFdRUFFQ', + checkout_token: '84ad78572dae52a8cbea7d55371afe89', + shopifyDetails: { + id: 5778367414385, + admin_graphql_api_id: 'gid://shopify/Order/5778367414385', + app_id: 580111, + browser_ip: '139.5.255.205', + cart_token: 'Z2NwLXVzLWVhc3QxOjAxSkJaTUVRSjgzNUJUN1BTNjEzRFdRUFFQ', + checkout_id: 35550298931313, + checkout_token: '84ad78572dae52a8cbea7d55371afe89', + confirmation_number: 'DPPARQ8UJ', + contact_email: 'henry@wfls.com', + created_at: '2024-11-05T21:54:49-05:00', + currency: 'USD', + current_subtotal_price: '600.00', + current_total_discounts: '0.00', + current_total_price: '600.00', + current_total_tax: '0.00', + email: 'henry@wfls.com', + name: '#1017', + order_number: 1017, + order_status_url: + 'https://pixel-testing-rs.myshopify.com/59026964593/orders/676613a0027fc8240e16d67fdc9f5ac8/authenticate?key=a70bbe7ec8abcc46b77e4331e4df8c60', + phone: null, + presentment_currency: 'USD', + subtotal_price: '600.00', + token: '676613a0027fc8240e16d67fdc9f5ac8', + total_discounts: '0.00', + total_line_items_price: '600.00', + total_outstanding: '0.00', + total_price: '600.00', + total_tax: '0.00', + updated_at: '2024-11-05T21:54:50-05:00', + user_id: null, + billing_address: { + first_name: 'yodi', + address1: 'Yuma Proving Ground', + phone: null, + city: 'Yuma Proving Ground', + zip: '85365', + province: 'Arizona', + country: 'United States', + last_name: 'waffles', + address2: 'suite 001', + company: null, + latitude: 33.0177811, + longitude: -114.2525392, + name: 'yodi waffles', + country_code: 'US', + province_code: 'AZ', + }, + customer: { + id: 7358220173425, + email: 'henry@wfls.com', + created_at: '2024-10-23T16:03:11-04:00', + updated_at: '2024-11-05T21:54:49-05:00', + first_name: 'yodi', + last_name: 'waffles', + state: 'disabled', + phone: null, + currency: 'USD', + tax_exemptions: [], + admin_graphql_api_id: 'gid://shopify/Customer/7358220173425', + default_address: { + id: 8715246862449, + customer_id: 7358220173425, + first_name: 'henry', + last_name: 'waffles', + company: null, + address1: 'Yuimaru Kitchen', + address2: '6', + city: 'Johnson City', + province: 'Tennessee', + country: 'United States', + zip: '37604', + phone: null, + name: 'henry waffles', + province_code: 'TN', + country_code: 'US', + country_name: 'United States', + default: true, + }, + }, + line_items: [ + { + id: 14234727743601, + current_quantity: 1, + fulfillable_quantity: 1, + fulfillment_service: 'manual', + gift_card: false, + grams: 0, + name: 'The Collection Snowboard: Hydrogen', + price: '600.00', + product_id: 7234590408817, + quantity: 1, + requires_shipping: true, + sku: '', + taxable: true, + title: 'The Collection Snowboard: Hydrogen', + total_discount: '0.00', + variant_id: 41327142600817, + variant_inventory_management: 'shopify', + variant_title: null, + vendor: 'Hydrogen Vendor', + }, + ], + shipping_address: { + first_name: 'henry', + address1: 'Yuimaru Kitchen', + phone: null, + city: 'Johnson City', + zip: '37604', + province: 'Tennessee', + country: 'United States', + last_name: 'waffles', + address2: '6', + company: null, + latitude: 36.3528845, + longitude: -82.4006335, + name: 'henry waffles', + country_code: 'US', + province_code: 'TN', + }, + }, + }, + integrations: { + SHOPIFY: true, + }, + type: 'track', + event: 'Order Created', + properties: { + order_id: 5778367414385, + value: '600.00', + tax: '0.00', + currency: 'USD', + products: [ + { + product_id: 7234590408817, + title: 'The Collection Snowboard: Hydrogen', + price: '600.00', + brand: 'Hydrogen Vendor', + quantity: 1, + }, + ], + }, + userId: '7358220173425', + traits: { + email: 'henry@wfls.com', + firstName: 'yodi', + lastName: 'waffles', + address: { + id: 8715246862449, + customer_id: 7358220173425, + first_name: 'henry', + last_name: 'waffles', + company: null, + address1: 'Yuimaru Kitchen', + address2: '6', + city: 'Johnson City', + province: 'Tennessee', + country: 'United States', + zip: '37604', + phone: null, + name: 'henry waffles', + province_code: 'TN', + country_code: 'US', + country_name: 'United States', + default: true, + }, + state: 'disabled', + currency: 'USD', + taxExemptions: [], + adminGraphqlApiId: 'gid://shopify/Customer/7358220173425', + shippingAddress: { + first_name: 'henry', + address1: 'Yuimaru Kitchen', + phone: null, + city: 'Johnson City', + zip: '37604', + province: 'Tennessee', + country: 'United States', + last_name: 'waffles', + address2: '6', + company: null, + latitude: 36.3528845, + longitude: -82.4006335, + name: 'henry waffles', + country_code: 'US', + province_code: 'TN', + }, + billingAddress: { + first_name: 'yodi', + address1: 'Yuma Proving Ground', + phone: null, + city: 'Yuma Proving Ground', + zip: '85365', + province: 'Arizona', + country: 'United States', + last_name: 'waffles', + address2: 'suite 001', + company: null, + latitude: 33.0177811, + longitude: -114.2525392, + name: 'yodi waffles', + country_code: 'US', + province_code: 'AZ', + }, + }, + timestamp: '2024-11-06T02:54:50.000Z', + anonymousId: '5d3e2cb6-4011-5c9c-b7ee-11bc1e905097', + }, + ], + }, + }, + ], + }, + }, + }, +].map((d1) => ({ ...d1, mockFns })); diff --git a/test/integrations/sources/shopify/webhookTestScenarios/GenericTrackTests.ts b/test/integrations/sources/shopify/webhookTestScenarios/GenericTrackTests.ts new file mode 100644 index 0000000000..f04fd7e08e --- /dev/null +++ b/test/integrations/sources/shopify/webhookTestScenarios/GenericTrackTests.ts @@ -0,0 +1,557 @@ +// This file contains the test scenarios for the server-side events from the Shopify GraphQL API for +// the v1 transformation flow +import { mockFns } from '../mocks'; +import { dummySourceConfig } from '../constants'; + +export const genericTrackTestScenarios = [ + { + id: 'c005', + name: 'shopify', + description: 'Track Call -> Cart Update event with no line items from Pixel app', + module: 'source', + version: 'v1', + input: { + request: { + body: [ + { + event: { + query_parameters: { + topic: ['carts_update'], + writeKey: ['2mw9SN679HngnXXXHT4oSVVBVmb'], + version: ['pixel'], + }, + id: 'Z2NwLXVzLWVhc3QxOjAxSjdXRjdOQjY0NlFFNFdQVEg0MTRFM1E2', + token: 'Z2NwLXVzLWVhc3QxOjAxSjdXRjdOQjY0NlFFNFdQVEg0MTRFM1E2', + line_items: [], + note: '', + updated_at: '2024-09-17T08:15:13.280Z', + created_at: '2024-09-16T03:50:15.478Z', + }, + source: dummySourceConfig, + }, + ], + method: 'POST', + headers: { 'Content-Type': 'application/json' }, + }, + pathSuffix: '', + }, + output: { + response: { + status: 200, + body: [ + { + output: { + batch: [ + { + anonymousId: '5d3e2cb6-4011-5c9c-b7ee-11bc1e905097', + context: { + integration: { + name: 'SHOPIFY', + }, + library: { + eventOrigin: 'server', + name: 'RudderStack Shopify Cloud', + version: '2.0.0', + }, + shopifyDetails: { + created_at: '2024-09-16T03:50:15.478Z', + id: 'Z2NwLXVzLWVhc3QxOjAxSjdXRjdOQjY0NlFFNFdQVEg0MTRFM1E2', + line_items: [], + note: '', + token: 'Z2NwLXVzLWVhc3QxOjAxSjdXRjdOQjY0NlFFNFdQVEg0MTRFM1E2', + updated_at: '2024-09-17T08:15:13.280Z', + }, + topic: 'carts_update', + }, + event: 'Cart Update', + integrations: { + SHOPIFY: true, + }, + properties: { + products: [], + }, + type: 'track', + }, + ], + }, + }, + ], + }, + }, + }, + { + id: 'c006', + name: 'shopify', + description: 'Track Call -> Unsupported event from Pixel app', + module: 'source', + version: 'v1', + input: { + request: { + body: [ + { + event: { + id: 35550298931313, + query_parameters: { + topic: ['unsupported_event'], + writeKey: ['2mw9SN679HngnXXXHT4oSVVBVmb'], + version: ['pixel'], + }, + }, + source: dummySourceConfig, + }, + ], + method: 'POST', + headers: { 'Content-Type': 'application/json' }, + }, + pathSuffix: '', + }, + output: { + response: { + status: 200, + body: [ + { + outputToSource: { + body: 'T0s=', + contentType: 'text/plain', + }, + statusCode: 200, + }, + ], + }, + }, + }, + { + id: 'c007', + name: 'shopify', + description: 'Track Call -> generic event from Pixel app', + module: 'source', + version: 'v1', + input: { + request: { + body: [ + { + event: { + id: 5778367414385, + admin_graphql_api_id: 'gid://shopify/Order/5778367414385', + cart_token: 'Z2NwLXVzLWVhc3QxOjAxSkJaTUVRSjgzNUJUN1BTNjEzRFdRUFFQ', + checkout_id: 35550298931313, + checkout_token: '84ad78572dae52a8cbea7d55371afe89', + contact_email: 'henry@wfls.com', + created_at: '2024-11-05T21:54:49-05:00', + currency: 'USD', + current_subtotal_price: '600.00', + current_total_additional_fees_set: null, + current_total_discounts: '0.00', + current_total_duties_set: null, + current_total_price: '600.00', + current_total_tax: '0.00', + email: 'henry@wfls.com', + merchant_of_record_app_id: null, + name: '#1017', + note: null, + note_attributes: [], + order_number: 1017, + original_total_additional_fees_set: null, + original_total_duties_set: null, + payment_gateway_names: ['bogus'], + phone: null, + po_number: null, + presentment_currency: 'USD', + processed_at: '2024-11-05T21:54:48-05:00', + reference: '4d92cf60cc24a1bd95929e17ead9845f', + referring_site: '', + source_identifier: '4d92cf60cc24a1bd95929e17ead9845f', + subtotal_price: '600.00', + subtotal_price_set: { + shop_money: { + amount: '600.00', + currency_code: 'USD', + }, + presentment_money: { + amount: '600.00', + currency_code: 'USD', + }, + }, + token: '676613a0027fc8240e16d67fdc9f5ac8', + total_discounts: '0.00', + total_line_items_price: '600.00', + total_outstanding: '0.00', + total_price: '600.00', + total_tax: '0.00', + total_weight: 0, + updated_at: '2024-11-05T21:54:50-05:00', + user_id: null, + billing_address: { + first_name: 'yodi', + address1: 'Yuma Proving Ground', + phone: null, + city: 'Yuma Proving Ground', + zip: '85365', + province: 'Arizona', + country: 'United States', + last_name: 'waffles', + address2: 'suite 001', + company: null, + latitude: 33.0177811, + longitude: -114.2525392, + name: 'yodi waffles', + country_code: 'US', + province_code: 'AZ', + }, + customer: { + id: 7358220173425, + email: 'henry@wfls.com', + created_at: '2024-10-23T16:03:11-04:00', + updated_at: '2024-11-05T21:54:49-05:00', + first_name: 'yodi', + last_name: 'waffles', + state: 'disabled', + note: null, + verified_email: true, + multipass_identifier: null, + tax_exempt: false, + phone: null, + email_marketing_consent: { + state: 'not_subscribed', + opt_in_level: 'single_opt_in', + consent_updated_at: null, + }, + sms_marketing_consent: null, + tags: '', + currency: 'USD', + tax_exemptions: [], + admin_graphql_api_id: 'gid://shopify/Customer/7358220173425', + default_address: { + id: 8715246862449, + customer_id: 7358220173425, + first_name: 'henry', + last_name: 'waffles', + company: null, + address1: 'Yuimaru Kitchen', + address2: '6', + city: 'Johnson City', + province: 'Tennessee', + country: 'United States', + zip: '37604', + phone: null, + name: 'henry waffles', + province_code: 'TN', + country_code: 'US', + country_name: 'United States', + default: true, + }, + }, + line_items: [ + { + id: 14234727743601, + admin_graphql_api_id: 'gid://shopify/LineItem/14234727743601', + attributed_staffs: [], + current_quantity: 1, + fulfillable_quantity: 1, + fulfillment_service: 'manual', + fulfillment_status: null, + gift_card: false, + grams: 0, + name: 'The Collection Snowboard: Hydrogen', + price: '600.00', + price_set: { + shop_money: { + amount: '600.00', + currency_code: 'USD', + }, + presentment_money: { + amount: '600.00', + currency_code: 'USD', + }, + }, + product_exists: true, + product_id: 7234590408817, + properties: [], + quantity: 1, + requires_shipping: true, + sku: '', + taxable: true, + title: 'The Collection Snowboard: Hydrogen', + total_discount: '0.00', + total_discount_set: { + shop_money: { + amount: '0.00', + currency_code: 'USD', + }, + presentment_money: { + amount: '0.00', + currency_code: 'USD', + }, + }, + variant_id: 41327142600817, + variant_inventory_management: 'shopify', + variant_title: null, + vendor: 'Hydrogen Vendor', + tax_lines: [], + duties: [], + discount_allocations: [], + }, + ], + refunds: [], + shipping_address: { + first_name: 'henry', + address1: 'Yuimaru Kitchen', + phone: null, + city: 'Johnson City', + zip: '37604', + province: 'Tennessee', + country: 'United States', + last_name: 'waffles', + address2: '6', + company: null, + latitude: 36.3528845, + longitude: -82.4006335, + name: 'henry waffles', + country_code: 'US', + province_code: 'TN', + }, + query_parameters: { + topic: ['orders_paid'], + version: ['pixel'], + writeKey: ['2mw9SN679HngnZkCHT4oSVVBVmb'], + }, + }, + source: dummySourceConfig, + }, + ], + method: 'POST', + headers: { 'Content-Type': 'application/json' }, + }, + pathSuffix: '', + }, + output: { + response: { + status: 200, + body: [ + { + output: { + batch: [ + { + context: { + library: { + eventOrigin: 'server', + name: 'RudderStack Shopify Cloud', + version: '2.0.0', + }, + integration: { + name: 'SHOPIFY', + }, + topic: 'orders_paid', + cart_token: 'Z2NwLXVzLWVhc3QxOjAxSkJaTUVRSjgzNUJUN1BTNjEzRFdRUFFQ', + checkout_token: '84ad78572dae52a8cbea7d55371afe89', + shopifyDetails: { + id: 5778367414385, + admin_graphql_api_id: 'gid://shopify/Order/5778367414385', + cart_token: 'Z2NwLXVzLWVhc3QxOjAxSkJaTUVRSjgzNUJUN1BTNjEzRFdRUFFQ', + checkout_id: 35550298931313, + checkout_token: '84ad78572dae52a8cbea7d55371afe89', + contact_email: 'henry@wfls.com', + created_at: '2024-11-05T21:54:49-05:00', + currency: 'USD', + current_subtotal_price: '600.00', + current_total_additional_fees_set: null, + current_total_discounts: '0.00', + current_total_duties_set: null, + current_total_price: '600.00', + current_total_tax: '0.00', + email: 'henry@wfls.com', + merchant_of_record_app_id: null, + name: '#1017', + note: null, + note_attributes: [], + order_number: 1017, + original_total_additional_fees_set: null, + original_total_duties_set: null, + payment_gateway_names: ['bogus'], + phone: null, + po_number: null, + presentment_currency: 'USD', + processed_at: '2024-11-05T21:54:48-05:00', + reference: '4d92cf60cc24a1bd95929e17ead9845f', + referring_site: '', + source_identifier: '4d92cf60cc24a1bd95929e17ead9845f', + subtotal_price: '600.00', + subtotal_price_set: { + shop_money: { + amount: '600.00', + currency_code: 'USD', + }, + presentment_money: { + amount: '600.00', + currency_code: 'USD', + }, + }, + token: '676613a0027fc8240e16d67fdc9f5ac8', + total_discounts: '0.00', + total_line_items_price: '600.00', + total_outstanding: '0.00', + total_price: '600.00', + total_tax: '0.00', + total_weight: 0, + updated_at: '2024-11-05T21:54:50-05:00', + user_id: null, + billing_address: { + first_name: 'yodi', + address1: 'Yuma Proving Ground', + phone: null, + city: 'Yuma Proving Ground', + zip: '85365', + province: 'Arizona', + country: 'United States', + last_name: 'waffles', + address2: 'suite 001', + company: null, + latitude: 33.0177811, + longitude: -114.2525392, + name: 'yodi waffles', + country_code: 'US', + province_code: 'AZ', + }, + customer: { + id: 7358220173425, + email: 'henry@wfls.com', + created_at: '2024-10-23T16:03:11-04:00', + updated_at: '2024-11-05T21:54:49-05:00', + first_name: 'yodi', + last_name: 'waffles', + state: 'disabled', + note: null, + verified_email: true, + multipass_identifier: null, + tax_exempt: false, + phone: null, + email_marketing_consent: { + state: 'not_subscribed', + opt_in_level: 'single_opt_in', + consent_updated_at: null, + }, + sms_marketing_consent: null, + tags: '', + currency: 'USD', + tax_exemptions: [], + admin_graphql_api_id: 'gid://shopify/Customer/7358220173425', + default_address: { + id: 8715246862449, + customer_id: 7358220173425, + first_name: 'henry', + last_name: 'waffles', + company: null, + address1: 'Yuimaru Kitchen', + address2: '6', + city: 'Johnson City', + province: 'Tennessee', + country: 'United States', + zip: '37604', + phone: null, + name: 'henry waffles', + province_code: 'TN', + country_code: 'US', + country_name: 'United States', + default: true, + }, + }, + line_items: [ + { + id: 14234727743601, + admin_graphql_api_id: 'gid://shopify/LineItem/14234727743601', + attributed_staffs: [], + current_quantity: 1, + fulfillable_quantity: 1, + fulfillment_service: 'manual', + fulfillment_status: null, + gift_card: false, + grams: 0, + name: 'The Collection Snowboard: Hydrogen', + price: '600.00', + price_set: { + shop_money: { + amount: '600.00', + currency_code: 'USD', + }, + presentment_money: { + amount: '600.00', + currency_code: 'USD', + }, + }, + product_exists: true, + product_id: 7234590408817, + properties: [], + quantity: 1, + requires_shipping: true, + sku: '', + taxable: true, + title: 'The Collection Snowboard: Hydrogen', + total_discount: '0.00', + total_discount_set: { + shop_money: { + amount: '0.00', + currency_code: 'USD', + }, + presentment_money: { + amount: '0.00', + currency_code: 'USD', + }, + }, + variant_id: 41327142600817, + variant_inventory_management: 'shopify', + variant_title: null, + vendor: 'Hydrogen Vendor', + tax_lines: [], + duties: [], + discount_allocations: [], + }, + ], + refunds: [], + shipping_address: { + first_name: 'henry', + address1: 'Yuimaru Kitchen', + phone: null, + city: 'Johnson City', + zip: '37604', + province: 'Tennessee', + country: 'United States', + last_name: 'waffles', + address2: '6', + company: null, + latitude: 36.3528845, + longitude: -82.4006335, + name: 'henry waffles', + country_code: 'US', + province_code: 'TN', + }, + }, + }, + integrations: { + SHOPIFY: true, + }, + type: 'track', + event: 'Order Paid', + properties: { + products: [ + { + product_id: 7234590408817, + title: 'The Collection Snowboard: Hydrogen', + price: '600.00', + brand: 'Hydrogen Vendor', + quantity: 1, + }, + ], + }, + traits: { + email: 'henry@wfls.com', + }, + anonymousId: '5d3e2cb6-4011-5c9c-b7ee-11bc1e905097', + }, + ], + }, + }, + ], + }, + }, + }, +].map((d2) => ({ ...d2, mockFns })); diff --git a/test/integrations/sources/shopify/webhookTestScenarios/IdentifyTests.ts b/test/integrations/sources/shopify/webhookTestScenarios/IdentifyTests.ts new file mode 100644 index 0000000000..b03f5635b6 --- /dev/null +++ b/test/integrations/sources/shopify/webhookTestScenarios/IdentifyTests.ts @@ -0,0 +1,256 @@ +import { mockFns } from '../mocks'; +import { dummySourceConfig } from '../constants'; + +export const identityTestScenarios = [ + { + id: 'c008', + name: 'shopify', + description: 'Identify Call -> Customer update event from Pixel app', + module: 'source', + version: 'v1', + input: { + request: { + body: [ + { + event: { + id: 7358220173425, + email: 'henry@wfls.com', + created_at: '2024-10-23T16:03:11-04:00', + updated_at: '2024-11-05T21:54:49-05:00', + first_name: 'yodi', + last_name: 'waffles', + orders_count: 0, + state: 'disabled', + total_spent: '0.00', + last_order_id: null, + note: null, + verified_email: true, + multipass_identifier: null, + tax_exempt: false, + tags: '', + last_order_name: null, + currency: 'USD', + phone: null, + addresses: [ + { + id: 8715246895217, + customer_id: 7358220173425, + first_name: 'yodi', + last_name: 'waffles', + company: null, + address1: 'Yuma Proving Ground', + address2: 'suite 001', + city: 'Yuma Proving Ground', + province: 'Arizona', + country: 'United States', + zip: '85365', + phone: null, + name: 'yodi waffles', + province_code: 'AZ', + country_code: 'US', + country_name: 'United States', + default: false, + }, + ], + tax_exemptions: [], + email_marketing_consent: { + state: 'not_subscribed', + opt_in_level: 'single_opt_in', + consent_updated_at: null, + }, + sms_marketing_consent: null, + admin_graphql_api_id: 'gid://shopify/Customer/7358220173425', + default_address: { + id: 8715246862449, + customer_id: 7358220173425, + first_name: 'henry', + last_name: 'waffles', + company: null, + address1: 'Yuimaru Kitchen', + address2: '6', + city: 'Johnson City', + province: 'Tennessee', + country: 'United States', + zip: '37604', + phone: null, + name: 'henry waffles', + province_code: 'TN', + country_code: 'US', + country_name: 'United States', + default: true, + }, + query_parameters: { + topic: ['customers_update'], + version: ['pixel'], + writeKey: ['2mw9SN679HngnXXXHT4oSVVBVmb'], + }, + }, + source: dummySourceConfig, + query_parameters: { + topic: ['carts_update'], + writeKey: ['2mw9SN679HngnXXXHT4oSVVBVmb'], + version: ['pixel'], + }, + }, + ], + method: 'POST', + headers: { 'Content-Type': 'application/json' }, + }, + pathSuffix: '', + }, + output: { + response: { + status: 200, + body: [ + { + output: { + batch: [ + { + context: { + library: { + eventOrigin: 'server', + name: 'RudderStack Shopify Cloud', + version: '2.0.0', + }, + integration: { + name: 'SHOPIFY', + }, + topic: 'customers_update', + shopifyDetails: { + id: 7358220173425, + email: 'henry@wfls.com', + created_at: '2024-10-23T16:03:11-04:00', + updated_at: '2024-11-05T21:54:49-05:00', + first_name: 'yodi', + last_name: 'waffles', + orders_count: 0, + state: 'disabled', + total_spent: '0.00', + last_order_id: null, + note: null, + verified_email: true, + multipass_identifier: null, + tax_exempt: false, + tags: '', + last_order_name: null, + currency: 'USD', + phone: null, + addresses: [ + { + id: 8715246895217, + customer_id: 7358220173425, + first_name: 'yodi', + last_name: 'waffles', + company: null, + address1: 'Yuma Proving Ground', + address2: 'suite 001', + city: 'Yuma Proving Ground', + province: 'Arizona', + country: 'United States', + zip: '85365', + phone: null, + name: 'yodi waffles', + province_code: 'AZ', + country_code: 'US', + country_name: 'United States', + default: false, + }, + ], + tax_exemptions: [], + email_marketing_consent: { + state: 'not_subscribed', + opt_in_level: 'single_opt_in', + consent_updated_at: null, + }, + sms_marketing_consent: null, + admin_graphql_api_id: 'gid://shopify/Customer/7358220173425', + default_address: { + id: 8715246862449, + customer_id: 7358220173425, + first_name: 'henry', + last_name: 'waffles', + company: null, + address1: 'Yuimaru Kitchen', + address2: '6', + city: 'Johnson City', + province: 'Tennessee', + country: 'United States', + zip: '37604', + phone: null, + name: 'henry waffles', + province_code: 'TN', + country_code: 'US', + country_name: 'United States', + default: true, + }, + }, + }, + integrations: { + SHOPIFY: true, + }, + type: 'identify', + userId: '7358220173425', + traits: { + email: 'henry@wfls.com', + firstName: 'yodi', + lastName: 'waffles', + addressList: [ + { + id: 8715246895217, + customer_id: 7358220173425, + first_name: 'yodi', + last_name: 'waffles', + company: null, + address1: 'Yuma Proving Ground', + address2: 'suite 001', + city: 'Yuma Proving Ground', + province: 'Arizona', + country: 'United States', + zip: '85365', + phone: null, + name: 'yodi waffles', + province_code: 'AZ', + country_code: 'US', + country_name: 'United States', + default: false, + }, + ], + address: { + id: 8715246862449, + customer_id: 7358220173425, + first_name: 'henry', + last_name: 'waffles', + company: null, + address1: 'Yuimaru Kitchen', + address2: '6', + city: 'Johnson City', + province: 'Tennessee', + country: 'United States', + zip: '37604', + phone: null, + name: 'henry waffles', + province_code: 'TN', + country_code: 'US', + country_name: 'United States', + default: true, + }, + orderCount: 0, + state: 'disabled', + totalSpent: '0.00', + verifiedEmail: true, + taxExempt: false, + tags: '', + currency: 'USD', + taxExemptions: [], + adminGraphqlApiId: 'gid://shopify/Customer/7358220173425', + }, + timestamp: '2024-11-06T02:54:49.000Z', + }, + ], + }, + }, + ], + }, + }, + }, +].map((d3) => ({ ...d3, mockFns }));