Skip to content

Commit

Permalink
fix: Forward Custom Attributes for all Commerce Events
Browse files Browse the repository at this point in the history
  • Loading branch information
BrandonStalnaker committed Jul 17, 2023
1 parent b8cebde commit 58bc597
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/main/kotlin/com/mparticle/kits/AppboyKit.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
5 changes: 5 additions & 0 deletions src/test/kotlin/com/mparticle/kits/AppboyKitTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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<String, String>()
Assert.assertEquals(emptyAttributes, properties)
}
Expand Down

0 comments on commit 58bc597

Please sign in to comment.