From 9809c250ad6778a77c141f8b1627f867bfa111a9 Mon Sep 17 00:00:00 2001 From: Robert Ing Date: Fri, 4 Oct 2024 16:24:10 -0400 Subject: [PATCH 1/2] fix: Report purchase events to mParticle when bundling ecommerce data --- src/BrazeKit-dev.js | 2 ++ test/tests.js | 3 +++ 2 files changed, 5 insertions(+) diff --git a/src/BrazeKit-dev.js b/src/BrazeKit-dev.js index b4b0eb4..cdb753a 100644 --- a/src/BrazeKit-dev.js +++ b/src/BrazeKit-dev.js @@ -129,6 +129,8 @@ var constructor = function () { quantity, eventAttributes ); + + return reportEvent; } function logPurchaseEventPerProduct(event) { diff --git a/test/tests.js b/test/tests.js index 2098679..cfe82de 100644 --- a/test/tests.js +++ b/test/tests.js @@ -1756,6 +1756,7 @@ user.getUserIdentities is not a function,\n`; baz: 'bar', }; + debugger; mParticle.forwarder.process({ EventName: 'eCommerce - Purchase', EventDataType: MessageType.Commerce, @@ -1832,6 +1833,8 @@ user.getUserIdentities is not a function,\n`; var purchaseEventProperties = window.braze.purchaseEventProperties[0]; purchaseEventProperties.should.eql(expectedPurchaseEvent); + + reportService.event.should.be.ok(); }); it('should call changeUser and openSession on init with userIdentificationType MPID passed in forwarding settings', function() { From 34519ddbb4f13dc6724ab3a7815861b5c4d26996 Mon Sep 17 00:00:00 2001 From: Robert Ing Date: Mon, 7 Oct 2024 09:49:29 -0400 Subject: [PATCH 2/2] turn comments --- src/BrazeKit-dev.js | 2 +- test/tests.js | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/BrazeKit-dev.js b/src/BrazeKit-dev.js index cdb753a..7631162 100644 --- a/src/BrazeKit-dev.js +++ b/src/BrazeKit-dev.js @@ -130,7 +130,7 @@ var constructor = function () { eventAttributes ); - return reportEvent; + return reportEvent === true; } function logPurchaseEventPerProduct(event) { diff --git a/test/tests.js b/test/tests.js index cfe82de..5b598e6 100644 --- a/test/tests.js +++ b/test/tests.js @@ -1756,7 +1756,6 @@ user.getUserIdentities is not a function,\n`; baz: 'bar', }; - debugger; mParticle.forwarder.process({ EventName: 'eCommerce - Purchase', EventDataType: MessageType.Commerce, @@ -1834,7 +1833,10 @@ user.getUserIdentities is not a function,\n`; purchaseEventProperties.should.eql(expectedPurchaseEvent); - reportService.event.should.be.ok(); + reportService.event.should.have.property( + 'EventName', + 'eCommerce - Purchase' + ); }); it('should call changeUser and openSession on init with userIdentificationType MPID passed in forwarding settings', function() {