From 58bc597ccc7804dc68747f6bb0e40bb6e465cc3e Mon Sep 17 00:00:00 2001 From: BrandonStalnaker Date: Mon, 17 Jul 2023 15:44:31 -0400 Subject: [PATCH] fix: Forward Custom Attributes for all Commerce Events --- src/main/kotlin/com/mparticle/kits/AppboyKit.kt | 7 +++++++ src/test/kotlin/com/mparticle/kits/AppboyKitTest.kt | 5 +++++ 2 files changed, 12 insertions(+) diff --git a/src/main/kotlin/com/mparticle/kits/AppboyKit.kt b/src/main/kotlin/com/mparticle/kits/AppboyKit.kt index 5e1e216..682cb48 100644 --- a/src/main/kotlin/com/mparticle/kits/AppboyKit.kt +++ b/src/main/kotlin/com/mparticle/kits/AppboyKit.kt @@ -451,6 +451,13 @@ open class AppboyKit : KitIntegration(), AttributeListener, CommerceListener, if (KitUtils.isEmpty(currencyValue)) { currencyValue = CommerceEventUtils.Constants.DEFAULT_CURRENCY_CODE } + + event?.customAttributes?.let { + for ((key, value) in it) { + purchaseProperties.addProperty(key, value) + } + } + Braze.Companion.getInstance(context).logPurchase( product.sku, currencyValue, diff --git a/src/test/kotlin/com/mparticle/kits/AppboyKitTest.kt b/src/test/kotlin/com/mparticle/kits/AppboyKitTest.kt index 0068304..9e4c994 100644 --- a/src/test/kotlin/com/mparticle/kits/AppboyKitTest.kt +++ b/src/test/kotlin/com/mparticle/kits/AppboyKitTest.kt @@ -449,6 +449,11 @@ class AppboyKitTests { properties.remove(CommerceEventUtils.Constants.ATT_AFFILIATION), "the affiliation" ) + + //Custom Attributes + Assert.assertEquals(properties.remove("key1"), "value1") + Assert.assertEquals(properties.remove("key #2"), "value #3") + val emptyAttributes = HashMap() Assert.assertEquals(emptyAttributes, properties) }