Skip to content

Commit 5395cbc

Browse files
fix: Forward Custom Attributes for all Commerce Events (#150)
1 parent b8cebde commit 5395cbc

2 files changed

Lines changed: 12 additions & 0 deletions

File tree

src/main/kotlin/com/mparticle/kits/AppboyKit.kt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -451,6 +451,13 @@ open class AppboyKit : KitIntegration(), AttributeListener, CommerceListener,
451451
if (KitUtils.isEmpty(currencyValue)) {
452452
currencyValue = CommerceEventUtils.Constants.DEFAULT_CURRENCY_CODE
453453
}
454+
455+
event?.customAttributes?.let {
456+
for ((key, value) in it) {
457+
purchaseProperties.addProperty(key, value)
458+
}
459+
}
460+
454461
Braze.Companion.getInstance(context).logPurchase(
455462
product.sku,
456463
currencyValue,

src/test/kotlin/com/mparticle/kits/AppboyKitTest.kt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -449,6 +449,11 @@ class AppboyKitTests {
449449
properties.remove(CommerceEventUtils.Constants.ATT_AFFILIATION),
450450
"the affiliation"
451451
)
452+
453+
//Custom Attributes
454+
Assert.assertEquals(properties.remove("key1"), "value1")
455+
Assert.assertEquals(properties.remove("key #2"), "value #3")
456+
452457
val emptyAttributes = HashMap<String, String>()
453458
Assert.assertEquals(emptyAttributes, properties)
454459
}

0 commit comments

Comments
 (0)